content
stringlengths 5
1.05M
|
---|
#!/usr/bin/env tarantool
require('console').listen(os.getenv('ADMIN'))
box.cfg({
listen = os.getenv('LISTEN'),
iproto_threads = tonumber(arg[1]),
})
|
local typedFunction = require(game:GetService("ReplicatedStorage"):WaitForChild("typedFunction"))
return typedFunction({
"Sunshine",
"function",
"number"
}, function(Sunshine, system, index)
Sunshine.systems[index] = system
end)
|
local MAJOR, MINOR = "Holdem:Card", 2
-- Get a reference to the package information if any
local APkg = Apollo.GetPackage(MAJOR)
-- If there was an older version loaded we need to see if this is newer
if APkg and (APkg.nVersion or 0) >= MINOR then
return -- no upgrade needed
end
-- Set a reference to the actual package or create an empty table
local Card = APkg and APkg.tPackage or {}
Card = {}
Card.__index = Card
Card.__eq = function (c1, c2)
return c1:tostring() == c2:tostring()
end
Card.SUIT_TO_STRING = {
"S",
"H",
"D",
"C"
}
Card.RANK_TO_STRING = {
[2] = "2",
[3] = "3",
[4] = "4",
[5] = "5",
[6] = "6",
[7] = "7",
[8] = "8",
[9] = "9",
[10] = "T",
[11] = "J",
[12] = "Q",
[13] = "K",
[14] = "A"
}
Card.STRING_TO_SUIT = {}
Card.STRING_TO_RANK = {}
for k, v in pairs(Card.SUIT_TO_STRING) do
Card.STRING_TO_SUIT[v] = k
end
for k, v in pairs(Card.RANK_TO_STRING) do
Card.STRING_TO_RANK[v] = k
end
setmetatable(Card, {
__call = function (cls, ...)
return cls.new(...)
end,
})
function Card:new(rank, suit)
local self = setmetatable({}, Card)
self.rank = rank
self.suit = suit
if self.rank < 2 or self.rank > 14 then
Print("invalid card rank!")
end
if self.suit < 1 or self.suit > 4 then
Print("invalid card suit!")
end
return self
end
function Card:tostring()
return self.RANK_TO_STRING[self.rank]..self.SUIT_TO_STRING[self.suit]
end
Apollo.RegisterPackage(Card, MAJOR, MINOR, {})
|
-- Path of Building
--
-- Class: Item Slot
-- Item Slot control, extends the basic dropdown control.
--
--local launch, main = ...
local pairs = pairs
local t_insert = table.insert
local m_min = math.min
local typeLabel = {
{ label = "主手", slotName = "Weapon 1" },
{ label = "副手", slotName = "Weapon 2" },
{ label = "第二武器栏主手", slotName = "Weapon 1 Swap" },
{ label = "第二武器栏副手", slotName = "Weapon 2 Swap" },
{ label = "头盔", slotName = "Helmet" },
{ label = "胸甲", slotName = "Body Armour" },
{ label = "手套", slotName = "Gloves" },
{ label = "鞋子", slotName = "Boots" },
{ label = "项链", slotName = "Amulet" },
{ label = "戒指 1", slotName = "Ring 1" },
{ label = "戒指 2", slotName = "Ring 2" },
{ label = "腰带", slotName = "Belt" },
{ label = "药剂 1", slotName = "Flask 1" },
{ label = "药剂 2", slotName = "Flask 2" },
{ label = "药剂 3", slotName = "Flask 3" },
{ label = "药剂 4", slotName = "Flask 4" },
{ label = "药剂 5", slotName = "Flask 5" },
{ label = "珠宝 1", slotName = "Socket #1" },
{ label = "珠宝 2", slotName = "Socket #2" },
{ label = "珠宝 3", slotName = "Socket #3" },
{ label = "珠宝 4", slotName = "Socket #4" },
{ label = "珠宝 5", slotName = "Socket #5" },
{ label = "珠宝 6", slotName = "Socket #6" },
{ label = "珠宝 7", slotName = "Socket #7" },
{ label = "珠宝 8", slotName = "Socket #8" },
{ label = "珠宝 9", slotName = "Socket #9" },
{ label = "珠宝 10", slotName = "Socket #10" },
{ label = "珠宝 11", slotName = "Socket #11" },
{ label = "珠宝 12", slotName = "Socket #12" },
{ label = "珠宝 13", slotName = "Socket #13" },
{ label = "珠宝 14", slotName = "Socket #14" },
{ label = "珠宝 15", slotName = "Socket #15" },
{ label = "深渊珠宝#1", slotName = "Abyssal #1" },
{ label = "深渊珠宝#2", slotName = "Abyssal #2" },
{ label = "深渊珠宝#3", slotName = "Abyssal #3" },
{ label = "深渊珠宝#4", slotName = "Abyssal #4" },
{ label = "深渊珠宝#5", slotName = "Abyssal #5" },
{ label = "深渊珠宝#6", slotName = "Abyssal #6" },
{ label = "深渊珠宝#7", slotName = "Abyssal #7" },
{ label = "深渊珠宝#8", slotName = "Abyssal #8" },
{ label = "深渊珠宝#9", slotName = "Abyssal #9" },
{ label = "深渊珠宝#10", slotName = "Abyssal #10" },
{ label = "深渊珠宝#11", slotName = "Abyssal #11" },
{ label = "深渊珠宝#12", slotName = "Abyssal #12" },
{ label = "深渊珠宝#13", slotName = "Abyssal #13" },
{ label = "深渊珠宝#14", slotName = "Abyssal #14" },
{ label = "深渊珠宝#15", slotName = "Abyssal #15" },
{ label = "深渊珠宝#16", slotName = "Abyssal #16" },
{ label = "深渊珠宝#17", slotName = "Abyssal #17" },
{ label = "深渊珠宝#18", slotName = "Abyssal #18" },
{ label = "深渊珠宝#19", slotName = "Abyssal #19" },
{ label = "深渊珠宝#20", slotName = "Abyssal #20" },
{ label = "深渊珠宝#21", slotName = "Abyssal #21" },
}
local ItemSlotClass = newClass("ItemSlotControl", "DropDownControl", function(self, anchor, x, y, itemsTab, slotName, slotLabel, nodeId)
self.DropDownControl(anchor, x, y, 310, 20, { }, function(index, value)
if self.items[index] ~= self.selItemId then
self:SetSelItemId(self.items[index])
itemsTab:PopulateSlots()
itemsTab:AddUndoState()
itemsTab.build.buildFlag = true
end
end)
self.anchor.collapse = true
self.enabled = function()
return #self.items > 1
end
self.shown = function()
return not self.inactive
end
self.itemsTab = itemsTab
self.items = { }
self.selItemId = 0
self.slotName = slotName
--Slots with names like "Weapon 2 Abyssal Socket #1" will match the first group of digits as the slotNum for abyssal sockets, which is checked against the abyssal socket count on the parent item when considering whether an abyssal socket is active or not.
--This fix ensures that we if possible match against the end of the string by anchoring the match, falling back on matching anywhere if that's not possible. This ensures that the match for items like "Weapon 2Swap" is still correct.
self.slotNum = tonumber(slotName:match("%d+$") or slotName:match("%d+"))
if slotName:match("Flask") then
self.controls.activate = new("CheckBoxControl", {"RIGHT",self,"LEFT"}, -2, 0, 20, nil, function(state)
self.active = state
itemsTab.activeItemSet[self.slotName].active = state
itemsTab:AddUndoState()
itemsTab.build.buildFlag = true
end)
self.controls.activate.enabled = function()
return self.selItemId ~= 0
end
self.controls.activate.tooltipText = "启用这瓶药剂."
self.labelOffset = -24
else
self.labelOffset = -2
end
self.abyssalSocketList = { }
self.tooltipFunc = function(tooltip, mode, index, itemId)
local item = itemsTab.items[self.items[index]]
if main.popups[1] or mode == "OUT" or not item or (not self.dropped and itemsTab.selControl and itemsTab.selControl ~= self.controls.activate) then
tooltip:Clear()
elseif tooltip:CheckForUpdate(item, launch.devModeAlt, itemsTab.build.outputRevision) then
itemsTab:AddItemTooltip(tooltip, item, self)
end
end
self.label = slotLabel or slotName
for index in pairs(typeLabel) do
if self.label==typeLabel[index].slotName then
self.label=typeLabel[index].label
end
end
self.nodeId = nodeId
end)
function ItemSlotClass:SetSelItemId(selItemId)
if self.nodeId then
if self.itemsTab.build.spec then
self.itemsTab.build.spec.jewels[self.nodeId] = selItemId
if selItemId ~= self.selItemId then
self.itemsTab.build.spec:BuildClusterJewelGraphs()
self.itemsTab.build.spec:BuildAllDependsAndPaths()
end
end
else
self.itemsTab.activeItemSet[self.slotName].selItemId = selItemId
end
self.selItemId = selItemId
end
function ItemSlotClass:Populate()
wipeTable(self.items)
wipeTable(self.list)
self.items[1] = 0
self.list[1] = "None"
self.selIndex = 1
for _, item in pairs(self.itemsTab.items) do
if self.itemsTab:IsItemValidForSlot(item, self.slotName) then
t_insert(self.items, item.id)
t_insert(self.list, colorCodes[item.rarity]..item.name)
if item.id == self.selItemId then
self.selIndex = #self.list
end
end
end
if not self.selItemId or not self.itemsTab.items[self.selItemId] or not self.itemsTab:IsItemValidForSlot(self.itemsTab.items[self.selItemId], self.slotName) then
self:SetSelItemId(0)
end
-- Update Abyssal Sockets
local abyssalSocketCount = 0
if self.selItemId > 0 then
local selItem = self.itemsTab.items[self.selItemId]
abyssalSocketCount = selItem.abyssalSocketCount or 0
end
for i, abyssalSocket in ipairs(self.abyssalSocketList) do
abyssalSocket.inactive = i > abyssalSocketCount
end
end
function ItemSlotClass:CanReceiveDrag(type, value)
return type == "Item" and self.itemsTab:IsItemValidForSlot(value, self.slotName)
end
function ItemSlotClass:ReceiveDrag(type, value, source)
if value.id and self.itemsTab.items[value.id] then
self:SetSelItemId(value.id)
else
local newItem = new("Item", value.raw)
newItem:NormaliseQuality()
self.itemsTab:AddItem(newItem, true)
self:SetSelItemId(newItem.id)
end
self.itemsTab:PopulateSlots()
self.itemsTab:AddUndoState()
self.itemsTab.build.buildFlag = true
end
function ItemSlotClass:Draw(viewPort)
local x, y = self:GetPos()
local width, height = self:GetSize()
DrawString(x + self.labelOffset, y + 2, "RIGHT_X", height - 4, "VAR", "^7"..self.label..":")
self.DropDownControl:Draw(viewPort)
self:DrawControls(viewPort)
if not main.popups[1] and self.nodeId and not self.dropped and ( (self:IsMouseOver() and (self.otherDragSource or not self.itemsTab.selControl))) then
SetDrawLayer(nil, 15)
-- x + width + 5
local viewerY
if self.DropDownControl.dropUp and self.DropDownControl.dropped then
viewerY = y + 20
else
viewerY = m_min(y - 300 - 5, viewPort.y + viewPort.height - 304)
end
local viewerX =x
--m_min(y, viewPort.y + viewPort.height - 304)
--local viewerY = m_min(y - 300 - 5, viewPort.y + viewPort.height - 304)
SetDrawColor(1, 1, 1)
DrawImage(nil, viewerX, viewerY, 304, 304)
local viewer = self.itemsTab.socketViewer
local node = self.itemsTab.build.spec.nodes[self.nodeId]
viewer.zoom = 5
local scale = self.itemsTab.build.spec.tree.size / 1500
viewer.zoomX = -node.x / scale
viewer.zoomY = -node.y / scale
SetViewport(viewerX + 2, viewerY + 2, 300, 300)
viewer:Draw(self.itemsTab.build, { x = 0, y = 0, width = 300, height = 300 }, { })
SetDrawLayer(nil, 30)
SetDrawColor(1, 1, 1, 0.2)
DrawImage(nil, 149, 0, 2, 300)
DrawImage(nil, 0, 149, 300, 2)
SetViewport()
SetDrawLayer(nil, 0)
end
end
function ItemSlotClass:OnKeyDown(key)
if not self:IsShown() or not self:IsEnabled() then
return
end
local mOverControl = self:GetMouseOverControl()
if mOverControl and mOverControl == self.controls.activate then
return mOverControl:OnKeyDown(key)
end
return self.DropDownControl:OnKeyDown(key)
end
|
the_curse_of_agony_everlasting_curse = class({})
LinkLuaModifier( 'the_curse_of_agony_everlasting_curse_modifier', 'encounters/the_curse_of_agony/the_curse_of_agony_everlasting_curse_modifier', LUA_MODIFIER_MOTION_NONE )
function the_curse_of_agony_everlasting_curse:OnSpellStart()
local victim = GetRandomHeroEntities(1)
if not victim then return end
victim = victim[1]
local victim_loc = victim:GetAbsOrigin()
--- Get Caster, Victim, Player, Point ---
local caster = self:GetCaster()
local caster_loc = caster:GetAbsOrigin()
local playerID = caster:GetPlayerOwnerID()
local player = PlayerResource:GetPlayer(playerID)
local team = caster:GetTeamNumber()
--- Get Special Values ---
local AoERadius = self:GetSpecialValueFor("AoERadius")
local duration = self:GetSpecialValueFor("duration")
local damage = self:GetSpecialValueFor("damage")
local damage_duration = self:GetSpecialValueFor("damage_duration")
local damage_interval = self:GetSpecialValueFor("damage_interval")
local damage_instances = self:GetSpecialValueFor("damage_instances")
local delay = self:GetSpecialValueFor("delay")
local curse_interval = self:GetSpecialValueFor("curse_interval")
-- Sound --
local sound = {"bane_bane_kill_05", "bane_bane_kill_06",
"bane_bane_kill_07", "bane_bane_kill_08"}
EmitAnnouncerSound( sound[RandomInt(1, #sound)] )
-- Modifier --
local modifier = victim:AddNewModifier(caster, self, "the_curse_of_agony_everlasting_curse_modifier", {duration = (duration/3) - delay})
PersistentModifier_Add(modifier)
-- Modifier --
local modifier = victim:AddNewModifier(caster, self, "the_curse_of_agony_everlasting_curse_modifier", {duration = (duration/2) - delay})
PersistentModifier_Add(modifier)
-- Modifier --
local modifier = victim:AddNewModifier(caster, self, "the_curse_of_agony_everlasting_curse_modifier", {duration = (duration/1) - delay})
PersistentModifier_Add(modifier)
for i=1,duration/curse_interval do
local location
local timer2 = Timers:CreateTimer( (i*curse_interval) - delay, function()
local modifier = caster:FindModifierByName("the_curse_of_agony_banished_modifier")
if modifier == nil then
location = victim:GetAbsOrigin()
-- Sound --
local sound = {"bane_bane_laugh_02", "bane_bane_laugh_03",
"bane_bane_laugh_04", "bane_bane_laugh_05"}
EmitAnnouncerSound( sound[RandomInt(1, #sound)] )
EncounterGroundAOEWarningSticky(location, AoERadius, delay+duration)
end
end)
PersistentTimer_Add(timer2)
local timer3 = Timers:CreateTimer( i*curse_interval, function()
local modifier = caster:FindModifierByName("the_curse_of_agony_banished_modifier")
if modifier == nil then
-- Particle --
local particle = ParticleManager:CreateParticle("particles/units/heroes/hero_enigma/enigma_blackhole_n.vpcf", PATTACH_CUSTOMORIGIN, nil)
ParticleManager:SetParticleControl( particle, 0, location )
ParticleManager:SetParticleControl( particle, 1, location )
PersistentParticle_Add(particle)
local timer1 = Timers:CreateTimer(0, function()
-- DOTA_UNIT_TARGET_TEAM_FRIENDLY; DOTA_UNIT_TARGET_TEAM_ENEMY; DOTA_UNIT_TARGET_TEAM_BOTH
local units = FindUnitsInRadius(team, location, nil, AoERadius, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_FLAG_NONE, FIND_ANY_ORDER, false)
for _,victim in pairs(units) do
-- Apply Damage --
EncounterApplyDamage(victim, caster, self, damage*damage_interval, DAMAGE_TYPE_MAGICAL, DOTA_DAMAGE_FLAG_NONE)
end
return damage_interval
end)
PersistentTimer_Add(timer1)
local timer4 = Timers:CreateTimer(damage_duration, function()
ParticleManager:DestroyParticle( particle, false )
ParticleManager:ReleaseParticleIndex( particle )
particle = nil
Timers:RemoveTimer(timer1)
timer1 = nil
end)
PersistentTimer_Add(timer4)
end
end)
PersistentTimer_Add(timer3)
end
end
function the_curse_of_agony_everlasting_curse:OnAbilityPhaseStart()
local caster = self:GetCaster()
local playerID = caster:GetPlayerOwnerID()
local player = PlayerResource:GetPlayer(playerID)
return true
end
function the_curse_of_agony_everlasting_curse:GetManaCost(abilitylevel)
return self.BaseClass.GetManaCost(self, abilitylevel)
end
function the_curse_of_agony_everlasting_curse:GetCooldown(abilitylevel)
return self.BaseClass.GetCooldown(self, abilitylevel)
end
|
-- Do not edit! This file was generated by blocks/signal/singlepolelowpassfilter_spec.py
local radio = require('radio')
local jigs = require('tests.jigs')
jigs.TestBlock(radio.SinglepoleLowpassFilterBlock, {
{
desc = "1e-2 cutoff, 256 Float32 input, 256 Float32 output",
args = {0.01},
inputs = {radio.types.Float32.vector_from_array({-0.73127151, 0.69486749, 0.52754927, -0.48986191, -0.00912983, -0.10101787, 0.30318594, 0.57744670, -0.81228077, -0.94330502, 0.67153019, -0.13446586, 0.52456015, -0.99578792, -0.10922561, 0.44308007, -0.54247558, 0.89054137, 0.80285490, -0.93882000, -0.94910830, 0.08282494, 0.87829834, -0.23759152, -0.56680119, -0.15576684, -0.94191837, -0.55661666, -0.12422481, -0.00837552, -0.53383112, -0.53826690, -0.56243795, -0.08079307, -0.42043677, -0.95702058, 0.67515594, 0.11290865, 0.28458872, -0.62818748, 0.98508680, 0.71989304, -0.75822008, -0.33460963, 0.44296879, 0.42238355, 0.87288117, -0.15578599, 0.66007137, 0.34061113, -0.39326301, 0.17516121, 0.76495802, 0.69239485, 0.01056764, 0.17800452, -0.93094832, -0.51452005, 0.59480852, -0.17137200, -0.65398520, 0.09759752, 0.40608153, 0.34897169, -0.25059396, -0.12207674, 0.01685298, 0.55688524, 0.04187684, -0.21348982, -0.02061296, -0.94085008, -0.91302544, 0.40676415, 0.96637541, 0.18636747, -0.21280062, -0.65930158, 0.00447712, 0.96415329, 0.54104626, 0.07923490, 0.72057962, -0.53564775, 0.02754333, 0.90493482, 0.15558961, -0.08173654, -0.46144104, 0.09599262, 0.91423255, -0.98858166, 0.56731045, 0.64097184, 0.77235913, 0.48100683, 0.61827981, 0.03735657, 0.12271573, -0.14781864, -0.88775343, 0.74002033, 0.13999867, -0.60032117, 0.00944094, -0.03014978, -0.28642008, -0.30784416, 0.07695759, 0.24697889, 0.22490492, -0.08370640, -0.94405001, -0.54078996, -0.64557749, 0.16892174, 0.72201771, 0.59687787, 0.59419513, 0.63287473, -0.48941192, 0.68348968, 0.34622705, -0.83353174, -0.96661872, -0.97087997, 0.51117355, -0.50088155, -0.78102273, 0.24960417, -0.31115428, -0.86096931, -0.68074894, 0.05476080, -0.66371012, -0.45417112, 0.42317989, -0.09059674, -0.35599643, -0.05245798, -0.95273077, -0.22688580, -0.15816264, -0.62392139, -0.78247666, 0.79963702, 0.02023196, -0.58181804, 0.21129727, 0.63407934, -0.95836377, -0.96427095, -0.70707649, 0.43767095, -0.67954481, 0.40921125, 0.35635161, 0.08940433, -0.55880052, 0.95118904, 0.59562171, 0.03319904, -0.55360842, 0.29701284, -0.21020398, 0.15169193, -0.35750839, 0.26189572, -0.88242978, -0.40278813, 0.93580663, 0.75106847, -0.38722676, 0.71702880, -0.37927276, 0.87857687, 0.48768425, -0.16765547, -0.49528381, -0.98303950, 0.75743574, -0.92416686, 0.63882822, 0.92440224, 0.14056113, -0.65696579, 0.73556215, 0.94755048, 0.40804628, 0.01774749, -0.24406233, -0.30613822, -0.58847648, 0.34830603, -0.13409975, -0.61176270, -0.79115158, 0.33191505, -0.40785465, -0.00040016, -0.34930867, 0.74324304, 0.79935658, -0.96381402, -0.59829396, -0.34451860, 0.97409946, 0.56540078, -0.32180870, -0.57394040, 0.34891015, 0.67540216, 0.86437494, -0.31230038, 0.76478642, 0.37422037, -0.03100256, 0.97101647, -0.53071910, 0.45093039, -0.83063954, -0.66061169, 0.82197559, -0.57406360, 0.51823235, 0.20041765, 0.68226439, -0.26378399, -0.31942952, -0.41756943, 0.73483962, 0.20796506, 0.90861493, 0.77453023, -0.72930807, 0.10234095, -0.79145002, -0.92172438, -0.85361314, 0.73233670, 0.57623291, 0.65701193, -0.31820506, 0.23037209, 0.56380719, -0.24392074, 0.14156306, -0.55257183, -0.83651346, -0.46655273, 0.78153634, 0.12889367, 0.85013437, -0.08446148, -0.44563445, 0.57402933})},
outputs = {radio.types.Float32.vector_from_array({-0.01131006, -0.01152324, 0.00773945, 0.00808294, 0.00011536, -0.00159179, 0.00158424, 0.01515536, 0.01105455, -0.01643980, -0.02013462, -0.01120541, -0.00482549, -0.01196437, -0.02868474, -0.02263395, -0.02347111, -0.01736180, 0.00936581, 0.00697322, -0.02244173, -0.03514574, -0.01919358, -0.00869051, -0.02086266, -0.03139278, -0.04739884, -0.06910945, -0.07750180, -0.07715531, -0.08315463, -0.09716382, -0.11118211, -0.11769136, -0.12180303, -0.13933951, -0.13938877, -0.12288868, -0.11293960, -0.11476029, -0.10569055, -0.07605156, -0.07429186, -0.08889584, -0.08447015, -0.06847348, -0.04632248, -0.03379880, -0.02495389, -0.00870515, -0.00925021, -0.01233730, 0.00258448, 0.02504438, 0.03514192, 0.03697139, 0.02418253, 0.00107846, 0.00228687, 0.00876512, -0.00427122, -0.01274436, -0.00456009, 0.00725884, 0.00855584, 0.00252735, 0.00082175, 0.00966994, 0.01863145, 0.01540092, 0.01130382, -0.00391610, -0.03246754, -0.03929323, -0.01684041, 0.00150917, 0.00105366, -0.01246712, -0.02220918, -0.00654108, 0.01694111, 0.02601053, 0.03757612, 0.03927400, 0.03020067, 0.04368846, 0.05873944, 0.05806471, 0.04786768, 0.04073488, 0.05509928, 0.05224501, 0.04411343, 0.06143654, 0.08139513, 0.09826230, 0.11222468, 0.11889354, 0.11769158, 0.11366283, 0.09413049, 0.08893390, 0.09979358, 0.08958723, 0.07767733, 0.07495429, 0.06773959, 0.05645317, 0.05113597, 0.05456430, 0.06017477, 0.06049723, 0.04273031, 0.01844359, -0.00047563, -0.00783301, 0.00618881, 0.02639580, 0.04400079, 0.06161796, 0.06193079, 0.06301677, 0.07699340, 0.06707500, 0.03715855, 0.00604322, -0.00125367, -0.00105571, -0.02084936, -0.02842351, -0.02849625, -0.04574319, -0.06817290, -0.07574585, -0.08282103, -0.09754863, -0.09501052, -0.08692777, -0.09114601, -0.09464391, -0.10726286, -0.12218925, -0.12436488, -0.13261390, -0.15026356, -0.14535013, -0.12817374, -0.13289465, -0.13451445, -0.11727873, -0.11866648, -0.14473185, -0.16610447, -0.16513312, -0.16376603, -0.16288137, -0.14600262, -0.13459219, -0.13768873, -0.12736085, -0.09949783, -0.08669458, -0.09206170, -0.09318257, -0.08895759, -0.08711086, -0.08759952, -0.08636861, -0.09329437, -0.11028609, -0.09863083, -0.06949022, -0.06171343, -0.05470366, -0.04778770, -0.03858712, -0.01626253, -0.01080983, -0.02072866, -0.04295165, -0.04511230, -0.04629557, -0.04927666, -0.02357503, -0.00637476, -0.01416443, -0.01251070, 0.01390780, 0.03444365, 0.03996367, 0.03522724, 0.02562801, 0.01099890, 0.00694412, 0.01004230, -0.00180406, -0.02344614, -0.02982357, -0.03007556, -0.03545943, -0.03977128, -0.03244834, -0.00758634, -0.00989522, -0.03374915, -0.04728702, -0.03608702, -0.01116040, -0.00704772, -0.02068363, -0.02352421, -0.00695424, 0.01707552, 0.02508587, 0.03130818, 0.04795595, 0.05178086, 0.06471767, 0.06952555, 0.06614091, 0.05822231, 0.03335722, 0.03482109, 0.03757827, 0.03555237, 0.04556749, 0.05780979, 0.06249393, 0.05154068, 0.03854775, 0.04226236, 0.05553677, 0.07108822, 0.09492130, 0.09268455, 0.08012073, 0.06698442, 0.03841597, 0.00976978, 0.00759187, 0.02759576, 0.04581587, 0.04963876, 0.04674485, 0.05758192, 0.06074822, 0.05728603, 0.04915724, 0.02615268, 0.00519011, 0.00990119, 0.02367590, 0.03808548, 0.04874951, 0.03904295, 0.03982104})}
},
{
desc = "1e-2 cutoff, 256 ComplexFloat32 input, 256 ComplexFloat32 output",
args = {0.01},
inputs = {radio.types.ComplexFloat32.vector_from_array({{0.65553629, -0.97523654}, {0.34082329, -0.81663376}, {-0.76979506, 0.77012014}, {-0.91995299, -0.52073330}, {0.97631699, -0.15797283}, {-0.76888371, -0.66523314}, {-0.51715940, 0.48801285}, {-0.79433179, 0.82152885}, {-0.24344546, 0.94052809}, {0.81844544, -0.41195285}, {-0.49317971, -0.04597981}, {-0.79974169, 0.30410039}, {-0.92075950, -0.97898769}, {0.96516722, -0.40890029}, {0.19314128, -0.10031093}, {-0.37343827, -0.87407041}, {0.82678401, 0.93962657}, {0.93959302, -0.77727538}, {-0.56961346, 0.23561376}, {0.95990574, 0.08582640}, {0.37637961, 0.32366887}, {-0.48182800, 0.08320452}, {-0.38535777, -0.50723761}, {-0.83726245, -0.43842655}, {0.96675342, -0.10419552}, {0.30402106, 0.28693217}, {0.88146901, -0.21904290}, {-0.38643140, -0.34551716}, {-0.36652973, 0.69426954}, {0.78700048, -0.39438137}, {-0.33133319, 0.08845083}, {0.15797088, 0.19192508}, {-0.50980401, -0.95925194}, {-0.51248139, -0.85534495}, {0.10240951, -0.85816729}, {-0.84974039, 0.27076420}, {-0.41835687, 0.58436954}, {-0.01347791, 0.72529793}, {-0.69164079, 0.00285917}, {0.58996701, -0.84578598}, {0.89845592, -0.65351576}, {0.55241799, 0.96979177}, {0.64310026, -0.36043200}, {-0.78624445, 0.02871650}, {0.83871394, -0.41302100}, {0.78751761, -0.71663874}, {0.82096338, -0.93648010}, {-0.36786264, 0.80617654}, {0.60771257, 0.81430751}, {0.68143702, 0.49236977}, {0.37919036, -0.64369029}, {-0.13472399, -0.68420619}, {0.42964891, 0.33555749}, {-0.49482721, -0.87117159}, {0.92677176, 0.61650527}, {0.09853987, 0.08275530}, {0.70258534, -0.09338064}, {-0.20857909, -0.32266170}, {-0.48406181, -0.95118302}, {0.29287767, -0.16663224}, {0.14120726, -0.87535673}, {-0.29011312, -0.72343177}, {-0.74974197, -0.48177409}, {0.65786874, -0.20440537}, {-0.19783570, 0.22488984}, {-0.53294069, -0.98504567}, {0.05740348, 0.00179924}, {0.29767919, -0.12336609}, {0.37302625, 0.46284387}, {-0.52325064, -0.00985550}, {-0.04234622, -0.54987586}, {-0.17550774, 0.12081487}, {0.81387901, 0.83541310}, {-0.44954929, 0.29283035}, {-0.90360534, -0.85689718}, {0.02338342, 0.75484818}, {-0.68106455, 0.53205574}, {0.76601923, -0.37639597}, {0.38511392, 0.69798225}, {-0.25677133, 0.40256533}, {0.47283623, 0.18915559}, {0.71255422, 0.79320872}, {0.92015761, 0.14246538}, {-0.64744818, -0.49880919}, {-0.56476265, 0.13903470}, {0.51550025, -0.89573354}, {0.36327291, 0.43430653}, {-0.30403697, 0.03011161}, {-0.67040372, 0.45979229}, {-0.91858262, 0.96244210}, {0.61588746, 0.25689700}, {-0.46494752, 0.82572573}, {0.91887766, -0.72174770}, {0.55151451, 0.68386173}, {0.31943470, 0.40081555}, {-0.10988253, 0.84861559}, {0.94241506, -0.23529337}, {0.60542303, -0.13415682}, {-0.67049158, -0.34906545}, {-0.74733984, 0.81776953}, {0.91884816, -0.76162654}, {0.20135815, -0.18355180}, {-0.76381993, -0.40904897}, {-0.50356728, 0.49915361}, {-0.99198210, -0.62032259}, {-0.12245386, -0.95793062}, {0.25505316, 0.21125507}, {0.67066473, -0.58678836}, {-0.43043676, 0.08467886}, {-0.45354861, 0.17147619}, {-0.49823555, 0.36705431}, {0.58218145, 0.61730921}, {0.94723225, 0.09075401}, {-0.01838144, 0.71139538}, {0.53813475, 0.14108926}, {-0.23348723, -0.43190512}, {-0.78372163, 0.61509818}, {-0.76385695, 0.49453047}, {0.09057418, 0.92989063}, {0.52213132, 0.94703954}, {-0.72681195, 0.00074295}, {0.14515658, -0.37749708}, {0.00606498, -0.28636247}, {0.05678794, -0.99831057}, {-0.11537134, -0.10089571}, {-0.39040163, -0.20119449}, {0.56617463, 0.36682576}, {-0.01540173, 0.29533648}, {-0.24488358, -0.59217191}, {-0.99224871, -0.44475749}, {0.19632840, 0.76332581}, {0.65884250, 0.02192042}, {0.97403622, -0.07683806}, {0.66918695, -0.18206932}, {0.48926124, 0.97518337}, {-0.38932681, -0.65937436}, {0.24006742, 0.06191236}, {-0.28115594, -0.99296153}, {-0.22167473, -0.14826106}, {-0.18949586, 0.72249067}, {0.16885605, 0.46766159}, {0.79581833, 0.49754697}, {-0.01459590, 0.49153668}, {0.28071079, 0.29749086}, {0.25935072, -0.18600205}, {0.25852406, 0.26746503}, {0.87423593, 0.56494737}, {0.69253606, 0.53499961}, {0.63065171, 0.21092477}, {-0.30109984, -0.47083348}, {0.41604009, 0.74788415}, {0.08849352, -0.69586009}, {0.66595060, -0.03091384}, {-0.06579474, -0.90922385}, {0.02056185, 0.48949531}, {-0.15480438, -0.28964537}, {0.31368709, -0.96051723}, {0.01432719, 0.89225417}, {0.38089520, -0.19615254}, {0.37781647, 0.20998783}, {-0.58222121, -0.58458334}, {0.77205056, -0.46186161}, {-0.85023046, 0.66135520}, {0.04639554, -0.26358366}, {0.02303784, 0.47345135}, {-0.66289276, 0.30613399}, {0.42687401, 0.63000691}, {-0.46047872, 0.21933267}, {-0.53577226, 0.12208935}, {-0.65527403, 0.57953525}, {0.73343575, -0.34071288}, {-0.55536288, 0.92757678}, {0.41338065, 0.68758518}, {-0.93893105, 0.79878664}, {0.24490412, -0.36694169}, {-0.13646875, 0.52318597}, {0.57082391, -0.62019825}, {0.25177300, -0.66874093}, {0.94609958, -0.11284689}, {0.82629001, 0.45649573}, {0.21251979, -0.47603193}, {0.05318464, -0.72276050}, {-0.72380400, 0.43149957}, {-0.27782047, 0.50275260}, {-0.51901281, 0.43631628}, {0.43695384, -0.38900825}, {-0.78722912, -0.20598429}, {-0.01527700, -0.80005163}, {-0.62647748, -0.88931382}, {0.19502714, 0.77775222}, {-0.56688440, -0.93057311}, {0.40784720, 0.62982112}, {0.92824322, 0.22635791}, {-0.31511366, 0.67573726}, {-0.76386577, 0.38527387}, {-0.80953830, -0.20058849}, {-0.00995424, -0.24421147}, {-0.66280484, -0.53656536}, {0.64029998, -0.07484839}, {0.15986548, -0.57618594}, {0.42987013, -0.33976549}, {0.18723717, 0.81897414}, {0.98878682, -0.90756410}, {0.59488541, 0.71517563}, {-0.36085111, -0.23370475}, {0.16050752, 0.83768046}, {-0.20014282, 0.76006031}, {0.51712108, -0.69545382}, {0.82735986, -0.96963781}, {-0.70964354, 0.32962242}, {-0.88576066, -0.24102025}, {-0.74004227, -0.07422146}, {0.67996067, 0.81216872}, {-0.92906070, -0.87829649}, {0.68124807, -0.91437042}, {-0.45281947, -0.76512659}, {-0.81792456, -0.94475424}, {0.27502602, 0.48922855}, {0.37354276, 0.69124550}, {0.32603237, -0.22059613}, {0.26212606, 0.93918961}, {0.28320667, -0.51381654}, {-0.87963182, 0.87033200}, {0.18099099, -0.30077052}, {0.21070550, 0.12051519}, {0.04434354, -0.87839073}, {-0.29354489, -0.17469995}, {-0.60126334, 0.76021045}, {-0.15176044, 0.32477134}, {0.42709291, 0.48656613}, {0.44223061, 0.50441700}, {-0.49683860, 0.95280737}, {-0.69798046, 0.83729482}, {0.70913750, 0.70432854}, {-0.89437741, -0.81756383}, {0.62611163, -0.06166634}, {-0.25949362, 0.96937495}, {-0.91976410, 0.06293010}, {-0.11330045, -0.74359375}, {-0.20962349, 0.41529480}, {0.76463121, -0.95076066}, {0.04901912, -0.81924683}, {0.60078692, -0.82842946}, {-0.93161339, -0.23152760}, {0.46521235, -0.37358665}, {-0.73999017, 0.58914447}, {0.61383879, 0.71171957}, {-0.39251104, -0.15033928}, {-0.50922000, 0.11435498}, {-0.33978567, -0.32267332}, {0.56724286, 0.91259229}, {0.16828065, -0.79062414}, {0.30514985, -0.10277656}, {0.97606111, 0.43876299}, {0.66957223, 0.40257251}, {0.07123801, 0.79363680}})},
outputs = {radio.types.ComplexFloat32.vector_from_array({{0.01013872, -0.01508329}, {0.02523509, -0.04233032}, {0.01781990, -0.04174032}, {-0.00886545, -0.03659210}, {-0.00771948, -0.04595727}, {-0.00427247, -0.05726764}, {-0.02403063, -0.05823715}, {-0.04357121, -0.03618197}, {-0.05827400, -0.00781028}, {-0.04757832, 0.00060641}, {-0.04107594, -0.00649487}, {-0.05980206, -0.00230180}, {-0.08456200, -0.01266860}, {-0.08125945, -0.03374220}, {-0.06083116, -0.04057408}, {-0.06173801, -0.05438909}, {-0.05281672, -0.05169278}, {-0.02386366, -0.04758282}, {-0.01740329, -0.05448845}, {-0.01082858, -0.04783150}, {0.01017375, -0.04001857}, {0.00822816, -0.03248787}, {-0.00543851, -0.03804116}, {-0.02417968, -0.05149037}, {-0.02142900, -0.05828999}, {-0.00111198, -0.05366067}, {0.01725756, -0.05095081}, {0.02438013, -0.05810642}, {0.01198047, -0.05091513}, {0.01811301, -0.04470204}, {0.02460021, -0.04805090}, {0.02115799, -0.04222818}, {0.01506197, -0.05278966}, {-0.00121490, -0.07922182}, {-0.00751961, -0.10327297}, {-0.01884545, -0.10916342}, {-0.03787527, -0.09256096}, {-0.04338258, -0.06944212}, {-0.05294621, -0.05603220}, {-0.05288097, -0.06733593}, {-0.02822484, -0.08844169}, {-0.00491213, -0.08081435}, {0.01373005, -0.06889001}, {0.01109143, -0.07188947}, {0.01155985, -0.07560951}, {0.03635405, -0.09074236}, {0.06010676, -0.11350308}, {0.06525529, -0.11200745}, {0.06694636, -0.08347990}, {0.08481390, -0.06068820}, {0.09859436, -0.06115132}, {0.09932557, -0.07979739}, {0.10081457, -0.08272135}, {0.09668805, -0.08844653}, {0.10037782, -0.08964939}, {0.11313064, -0.07606134}, {0.12202165, -0.07387290}, {0.12588765, -0.07802245}, {0.11128104, -0.09531067}, {0.10488192, -0.10965092}, {0.10835133, -0.12237484}, {0.10269672, -0.14331681}, {0.08343735, -0.15752371}, {0.07943548, -0.16326374}, {0.08409334, -0.15789676}, {0.07018971, -0.16476940}, {0.06066377, -0.17487982}, {0.06427909, -0.17135052}, {0.07266410, -0.16079976}, {0.06809299, -0.14881974}, {0.05723902, -0.15287334}, {0.05209908, -0.15478055}, {0.06036075, -0.13520350}, {0.06412847, -0.11357155}, {0.04121653, -0.11878251}, {0.02632782, -0.11668658}, {0.01534155, -0.09317353}, {0.01618093, -0.08788396}, {0.03348417, -0.08019173}, {0.03443340, -0.06068981}, {0.03671001, -0.04966079}, {0.05390807, -0.03293112}, {0.07749255, -0.01744106}, {0.07931331, -0.02241288}, {0.05811154, -0.02728397}, {0.05555209, -0.03814333}, {0.06742509, -0.04410003}, {0.06625561, -0.03555307}, {0.04913517, -0.02687633}, {0.02303957, -0.00404828}, {0.01764532, 0.01493560}, {0.01943399, 0.03121776}, {0.02585346, 0.03186027}, {0.04779526, 0.03028879}, {0.05978718, 0.04612781}, {0.06117881, 0.06402503}, {0.07216258, 0.07153039}, {0.09386972, 0.06360374}, {0.08995972, 0.05416266}, {0.06524844, 0.05973638}, {0.06588273, 0.05875691}, {0.08117025, 0.04232100}, {0.06996024, 0.03184656}, {0.04819441, 0.03225505}, {0.02357303, 0.02938329}, {0.00560767, 0.00406466}, {0.00748503, -0.00760937}, {0.02157092, -0.01318210}, {0.02461911, -0.02054011}, {0.01018560, -0.01594299}, {-0.00485004, -0.00712076}, {-0.00340168, 0.00832396}, {0.02035790, 0.01901759}, {0.03409405, 0.03083560}, {0.04107809, 0.04306655}, {0.04451921, 0.03723655}, {0.02740967, 0.03891804}, {0.00262651, 0.05487605}, {-0.00786792, 0.07520910}, {0.00185174, 0.10191184}, {-0.00137119, 0.11341812}, {-0.01032483, 0.10408282}, {-0.00766662, 0.09059582}, {-0.00645737, 0.06792434}, {-0.00716369, 0.04882261}, {-0.01476453, 0.04264019}, {-0.01158927, 0.04388292}, {-0.00271237, 0.05276670}, {-0.00665412, 0.04654355}, {-0.02558214, 0.02906638}, {-0.03710075, 0.03309435}, {-0.02272681, 0.04421551}, {0.00323077, 0.04199843}, {0.02854540, 0.03669498}, {0.04557931, 0.04782644}, {0.04571505, 0.05123144}, {0.04199247, 0.04040620}, {0.04005805, 0.02475645}, {0.03104202, 0.00634019}, {0.02372253, 0.01502527}, {0.02266951, 0.03296775}, {0.03688822, 0.04687617}, {0.04782978, 0.06072362}, {0.05046609, 0.07104861}, {0.05725780, 0.07057521}, {0.06349627, 0.06965207}, {0.07905176, 0.08037189}, {0.10083864, 0.09489787}, {0.11818425, 0.10349912}, {0.11962545, 0.09627780}, {0.11770282, 0.09758463}, {0.12186524, 0.09537070}, {0.12976408, 0.08118014}, {0.13503233, 0.06412859}, {0.13015585, 0.05565328}, {0.12405355, 0.05702272}, {0.12267358, 0.03592348}, {0.12395214, 0.03375650}, {0.12623060, 0.04347843}, {0.13406041, 0.04234751}, {0.12675220, 0.03524399}, {0.12576738, 0.01796918}, {0.12066792, 0.02049877}, {0.10450301, 0.02601675}, {0.10234433, 0.02845785}, {0.08928238, 0.03963487}, {0.08287030, 0.05288749}, {0.07978717, 0.06438768}, {0.06191084, 0.06767654}, {0.04157471, 0.07643466}, {0.04149757, 0.07776403}, {0.04296807, 0.08443519}, {0.03944302, 0.10680396}, {0.03009463, 0.12648889}, {0.01842970, 0.12925531}, {0.01953672, 0.12767363}, {0.02565026, 0.12222394}, {0.03757935, 0.09850813}, {0.05494357, 0.08337275}, {0.08065632, 0.08610879}, {0.09422795, 0.08314307}, {0.09542269, 0.06203036}, {0.08209903, 0.05560688}, {0.06406808, 0.06833623}, {0.04976223, 0.08074633}, {0.04695381, 0.07898031}, {0.04008395, 0.06733492}, {0.02643226, 0.04969243}, {0.01568907, 0.02202710}, {0.00853083, 0.01962030}, {0.00251570, 0.01664982}, {-0.00002183, 0.01148328}, {0.02064321, 0.02436999}, {0.02948750, 0.03756823}, {0.01188757, 0.05281606}, {-0.01281487, 0.05403871}, {-0.02509299, 0.04548775}, {-0.03472188, 0.03200497}, {-0.03399592, 0.02155868}, {-0.02056874, 0.01082272}, {-0.01081147, -0.00367842}, {-0.00093268, 0.00384694}, {0.01728489, 0.00235779}, {0.04124377, -0.00069068}, {0.04358763, 0.00677725}, {0.03914078, 0.01590888}, {0.03731705, 0.04012790}, {0.04106521, 0.03988586}, {0.06058909, 0.01289930}, {0.06053555, 0.00260163}, {0.03398804, 0.00389150}, {0.00779156, -0.00110450}, {0.00662131, 0.01034298}, {0.00256384, 0.00900029}, {-0.00134821, -0.01900402}, {0.00222644, -0.04439177}, {-0.01749613, -0.06946413}, {-0.02535155, -0.07436072}, {-0.01453641, -0.05380300}, {-0.00326693, -0.04485953}, {0.00593075, -0.03235793}, {0.01418158, -0.02477807}, {0.00451842, -0.01849765}, {-0.00642673, -0.00911647}, {-0.00016984, -0.01162235}, {0.00378007, -0.02298437}, {-0.00019108, -0.03856081}, {-0.01402453, -0.02831235}, {-0.02523720, -0.01065593}, {-0.02019818, 0.00222207}, {-0.00612818, 0.01748017}, {-0.00678321, 0.03947732}, {-0.02505280, 0.06594242}, {-0.02410530, 0.08774585}, {-0.02622463, 0.08328032}, {-0.02956251, 0.06710581}, {-0.02297785, 0.07906894}, {-0.04050583, 0.09258907}, {-0.05523055, 0.07919770}, {-0.05851657, 0.07167035}, {-0.04812259, 0.06117173}, {-0.03404988, 0.03190408}, {-0.02294654, 0.00543376}, {-0.02735340, -0.01112793}, {-0.03372078, -0.02014259}, {-0.03692751, -0.01618564}, {-0.03773634, 0.00443456}, {-0.03314593, 0.01297986}, {-0.04606708, 0.01202182}, {-0.05777308, 0.00842804}, {-0.05246809, 0.01729120}, {-0.03946929, 0.01864273}, {-0.03092619, 0.00424847}, {-0.01015398, 0.00931352}, {0.01561195, 0.02203777}, {0.02658662, 0.03985700}})}
},
}, {epsilon = 1.0e-06})
|
bt_sounds = {}
bt_sounds.wood_sounds = {}
bt_sounds.wood_sounds.footstep = {name = "wood_footstep", gain = 0.75}
bt_sounds.wood_sounds.dug = {name = "wood_dug", gain = 0.25}
bt_sounds.wood_sounds.dig = {name = "wood_dig", gain = 0.5}
bt_sounds.wood_sounds.place = {name = "wood_place", gain = 1.0}
bt_sounds.stone_sounds = {}
bt_sounds.stone_sounds.footstep = {name = "stone_footstep", gain = 0.75}
bt_sounds.stone_sounds.dug = {name = "stone_dug", gain = 0.25}
bt_sounds.stone_sounds.dig = {name = "stone_dig", gain = 0.5}
bt_sounds.stone_sounds.place = {name = "stone_place", gain = 1.0}
bt_sounds.leaves_sounds = {}
bt_sounds.leaves_sounds.footstep = {name = "leaves_footstep", gain = 1.0}
bt_sounds.leaves_sounds.dug = {name = "leaves_dug", gain = 0.30}
bt_sounds.leaves_sounds.dig = {name = "leaves_dig", gain = 0.25}
bt_sounds.leaves_sounds.place = {name = "leaves_place", gain = 1.0}
bt_sounds.dirt_sounds = {}
bt_sounds.dirt_sounds.footstep = {name = "dirt_footstep", gain = 0.25}
bt_sounds.dirt_sounds.dug = {name = "dirt_dug", gain = 0.25}
bt_sounds.dirt_sounds.dig = {name = "dirt_dig", gain = 0.25}
bt_sounds.dirt_sounds.place = {name = "dirt_place", gain = 0.25}
|
Item.new("poison", "Poison", "")
|
local _, ns = ...
local B, C, L, DB, P = unpack(ns)
local S = P:GetModule("Skins")
--------------------------
-- Credit: ElvUI_WindTools
--------------------------
function S:Myslot()
local Myslot = LibStub("Myslot-5.0", true)
if not Myslot then return end
local frame = Myslot.MainFrame
B.StripTextures(frame)
B.SetBD(frame)
for _, child in pairs {frame:GetChildren()} do
local objType = child:GetObjectType()
if objType == "Button" and child.Text then
B.Reskin(child)
elseif objType == "CheckButton" then
B.ReskinCheck(child)
elseif objType == "Frame" then
if floor(child:GetWidth() - 600) == 0 and floor(child:GetHeight() - 400) == 0 then
child:SetBackdrop(nil)
local bg = B.CreateBDFrame(child, 0)
bg:SetInside()
for _, subChild in pairs {child:GetChildren()} do
if subChild:GetObjectType() == "ScrollFrame" then
B.ReskinScroll(subChild.ScrollBar)
break
end
end
elseif child.initialize and child.Icon and child.Button then
P.ReskinDropDown(child)
child.Button:SetSize(20, 20)
end
end
end
end
S:RegisterSkin("Myslot", S.Myslot)
|
ped = PlayerPedID()
Citizen.CreateThread(function()
SetPlayerHealthRechargeMultiplier(ped, 0.0)
SetPedSuffersCriticalHits(ped, true)
if IsControlPressed(0, 25) then
DisableControlAction(0, 22, true) -- Combat Rolling
end
local isGunASniper = false
while true do
Citizen.Wait(0)
local selectedGun = GetSelectedPedWeapon(ped)
if selectedGun == 100416529 then -- Sniper Rifle
isGunASniper = true
elseif selectedGun == 205991906 then -- Heavy Sniper
isGunASniper = true
elseif selectedGun == -3342088282 then -- Marksman Rifle
isGunASniper = true
else
isGunASniper = false
end
if not isGunASniper then
HideHudComponentThisFrame(14)
end
end
if not animatdictloaded then
Citizen.CreateThread(function()
while true do
Wait(1)
RequestAnimDict('move_m@_idles@shake_off')
animatdictloaded = true
while not HasAnimDictLoaded('move_m@_idles@shake_off') do
Wait(150)
end
end
end)
end
end)
RegisterCommand('heal', function()
local veh = GetVehiclePedIsIn(ped,false)
if IsPedInVehicle(ped, veh, false) then
Notif("~r~Player cannot heal in Vehicle!")
else
if GetEntityHealth(ped) >> 200 then
TaskPlayAnim(ped, "move_m@_idles@shake_off", "shakeoff_1", 8.0, 1.0, 1, 2, 0, false,false,false)
--exports['pogressBar']:drawBar(5000, "Healing Player") -- Uncomment this line if pogressbar is installed
FreezeEntityPosition(ped, true)
Citizen.Wait(5000)
FreezeEntityPosition(ped, false)
SetEntityHealth(ped, 200)
Notif("~y~Player has been healed!")
print("player healed")
else
Notif("~r~The Player is already at Max Health")
end
end
end, false)
function Notif( text )
SetNotificationTextEntry( "STRING" )
AddTextComponentString( text )
DrawNotification( false, false )
end
RegisterCommand('armor', function()
local veh = GetVehiclePedIsIn(ped,false)
if IsPedInVehicle(ped, veh, false) then
Notif("~r~Player cannot armor up in Vehicle!")
else
if GetEntityHealth(ped) >> 200 then
TaskPlayAnim(ped, "move_m@_idles@shake_off", "shakeoff_1", 8.0, 1.0, 1, 2, 0, false,false,false)
--exports['pogressBar']:drawBar(7000, "Healing Player") -- Uncomment this line if pogressbar is installed
FreezeEntityPosition(ped, true)
Citizen.Wait(5000)
FreezeEntityPosition(ped, false)
SetEntityArmor(ped, 200)
Notif("~y~Player has been Armored!")
print("player armored")
else
Notif("~r~The Player is already at Max Armor")
end
end
end, false)
|
local ScrollViewCell = import("..ui.ScrollViewCell");
local ChapterListCell = class("ChapterListCell", ScrollViewCell);
function ChapterListCell:ctor(size, begin_index, end_index, datatable)
local bgImage = "#button_background.png";
local start_pos_x = display.cx - 290;
-- iPhone
-- local start_pos_y = 80;
-- iPhone5
local start_pos_y = size.height;
local colWidth = 148;
local isPayed = GameData.BuyState == "TRUE" and true or false;
local nativefont = "DFYuanW7-GB";
-- local nativefont = "Marker Felt";
local fontcolor = ccc3(71,32,25);
local fontsize = 18;
display.addSpriteFramesWithFile(CHAPTER_SELECT_TEXTURE_PLIST,CHAPTER_SELECT_TEXTURE_PNG);
local batch = display.newBatchNode(CHAPTER_SELECT_TEXTURE_PNG);
self:addChild(batch);
self.buttons = {};
local titletable = {}
local imagetable = {}
local freetable = {}
local ch_idtable = {}
local ch_indextable = {}
local begin = begin_index
local length = end_index
for i = begin, length do
titletable[#titletable + 1] = datatable[i]["title"]
imagetable[#imagetable + 1] = datatable[i]["image"]
freetable [#freetable + 1] = datatable[i]["free"]
ch_idtable[#ch_idtable + 1] = datatable[i]["ch_id"]
ch_indextable[#ch_indextable + 1] = datatable[i]["ch_index"]
end
local x = start_pos_x;
local y = start_pos_y;
local index = begin_index;
local count = end_index - begin_index + 1;
for col = 1, count do
-- background
local background = display.newSprite(bgImage, x, y);
batch:addChild(background);
background.levelindex = col + index - 1;
-- icon
local icon = display.newSprite(imagetable[col], x, y + 15.5);
batch:addChild(icon);
-- label
local label = ui.newTTFLabel({
text = titletable[col],
font = nativefont,
size = fontsize,
x = x,
y = y - 40,
color = fontcolor,
align = ui.TEXT_ALIGN_CENTER
});
self:addChild(label);
local m_IsFree = freetable[col] > 0 and true or false;
if not (isPayed or m_IsFree) then
fade = display.newSprite("#fad_small.png", x, y + 15.5):addTo(batch)
background.isFree = false
else
background.isFree = true
end
background.ch_id = ch_idtable[col]
background.ch_index = ch_indextable[col]
self.buttons[#self.buttons + 1] = background;
x = x + colWidth;
end
end
function ChapterListCell:onTouch(event, x, y)
if event == "began" then
local button = self:checkButton(x, y);
if button then
print "touch";
end
elseif event == "moved" then
print "moved";
end
end
function ChapterListCell:onTap(x, y)
local button = self:checkButton(x, y);
if button then
self:dispatchEvent(
{
name = "onTapChapterIcon",
levelindex = button.levelindex,
isfree = button.isFree,
chapter = button.ch_id,
chindex = button.ch_index
});
end
end
function ChapterListCell:checkButton(x, y)
local pos = CCPoint(x, y);
for i = 1, #self.buttons do
local button = self.buttons[i];
if button:getBoundingBox():containsPoint(pos) then
-- print ("Button Index Order:", i);
return button;
end
end
return nil;
end
return ChapterListCell;
|
#! /usr/bin/luajit
--[[ run.lua usage
- Run with no arguments to run unit tests and generate coverage reports.
- Run with one argument to only test and generate coverage reports for files where the argument is a
substring of the file name.
]]
local STATS_FILE_NAME = "luacov.stats.out"
local REPORT_FILE_NAME = "luacov.report.out"
local DEBUG = os.getenv("DEBUG") == "true" and true or false
local function print_debug(...)
if DEBUG then print(...) end
end
local function exec(cmd)
print("> " .. cmd)
os.execute(cmd)
end
local function ends_with(str, ending)
print_debug(str .. " ends with " .. ending .. "? Ending: " .. str:sub(-(#ending + 4), -5))
return str:sub(-(#ending + 4), -5) == ending
end
os.remove(STATS_FILE_NAME)
local filter = arg[1]
if filter == nil then filter = "" end
local pattern = ""
if filter ~= "" then
pattern = ("--pattern='%s_spec'"):format(filter)
end
local debug_env = "DEBUG=FALSE"
if os.getenv("DEBUG") ~= "FALSE" then
debug_env = "DEBUG=TRUE"
end
local unit_test_env = "UNIT_TEST=FALSE"
if os.getenv("UNIT_TEST") ~= "FALSE" then
unit_test_env = "UNIT_TEST=TRUE"
end
exec(("env %s %s busted --lua=luajit --coverage %s ."):format(debug_env, unit_test_env, pattern))
local file = io.open(STATS_FILE_NAME, "r")
local lines = {}
local retain = 0
for line in file:lines() do
-- if line is a header and the entry should be retained, retain 2 lines (this and the next)
if line:find(".lua") and not (line:find("/usr/") or line:find("_spec"))
and (filter == "" or ends_with(line, filter)) then
retain = 2
end
-- if a line should be retained, insert it into lines and decrement retainer
if retain > 0 then
table.insert(lines, line)
retain = retain - 1
end
end
file = io.open(STATS_FILE_NAME, "w")
for _, line in ipairs(lines) do
file:write(line .. "\n")
end
file:close()
os.execute("sleep 1")
os.execute("luacov")
os.execute("less " .. REPORT_FILE_NAME)
|
--[[
docs.lua
Generates markdown documentation from the Carbon sources.
Requires LuaFileSystem!
Built specifically for Carbon and Carbon-like inline documentation.
]]
local ok, lfs = pcall(require, "lfs")
if (not ok) then
error("LFS is required to use docs.lua!")
end
local template_typical_constructor = [[
class public @{class} {class}:New({arguments})
-alias: class public @{class} {class}:PlacementNew(@{class}? out{arg_comma}{arguments})
-alias: object public @void {class}:Init({arguments})
]]
local template_constructor_init_pair = [[
class public @{class} {class}:New{suffix}({arguments})
-alias: object public @void {class}:Init{suffix}({arguments})
]]
local docs = {
hand_files = {
"index.md, Index",
"Getting_Started.md, Tutorials, Getting Started",
"Using_Carbide.md, Tutorials, Using Carbide",
"Types.md, Tutorials, Carbon Types"
},
files_written = {},
parser = {},
generator = {},
classes_by_name = {},
shorts = {
required = [[<span class="doc-arg-level doc-required">required</span>]],
optional = [[<span class="doc-arg-level doc-optional">optional</span>]],
internal = [[<span class="doc-arg-level doc-internal">internal</span>]],
unknown = [[<span class="doc-unknown">unknown</span>]],
class = [[<span class="doc-scope doc-class">class</span>]],
object = [[<span class="doc-scope doc-object">object</span>]],
public = [[<span class="doc-visibility doc-public">public</span>]],
private = [[<span class="doc-visibility doc-private">private</span>]]
},
macros = {
typical_constructor = function(whole)
local class, arguments = whole:match("^([^%(]+)%((.*)%)$")
return (template_typical_constructor
:gsub("{arg_comma}", (#arguments > 0) and ", " or "")
:gsub("{class}", class)
:gsub("{arguments}", arguments)
)
end,
constructor_init_pair = function(whole)
local suffix, class, arguments = whole:match("^(%S+)%s+([^%(]+)%((.*)%)$")
return (template_constructor_init_pair
:gsub("{arg_comma}", (#arguments > 0) and ", " or "")
:gsub("{suffix}", suffix)
:gsub("{class}", class)
:gsub("{arguments}", arguments)
)
end
},
-- Parser attributes
fs_base = "./Carbon",
-- Generator attributes
file_url_base = "https://github.com/lua-carbon/carbon/tree/master/",
doc_url_base = "carbon.lpghatguy.com",
doc_dir = "./docs"
}
local function do_macros(document)
return document:gsub("%$([%w_]+)(%b())", function(name, arg_string)
local arguments = arg_string:sub(2, -2)
local macro = docs.macros[name]
if (not macro) then
print(("WARNING: Invalid macro %q!"):format(name))
return
end
return macro(arguments)
end)
end
local function path_join(a, b)
return ((a .. "/" .. b):gsub("//+", "/"))
end
local function path_leaf(a)
return (a:match("([^/]+)/*$"))
end
-- FIXME: this breaks with readthedocs
local function absolute_link_to_class(name)
return "http://" .. path_join(path_join(docs.doc_url_base, "Classes"), name)
end
local function link_to_type(name)
return "Types#" .. name
end
local function link_to_class(name)
return path_join("Classes", name)
end
local function path_to_class(name)
return path_join("Classes", name) .. ".md"
end
local function escape_html(str)
return (str:gsub("<", "<"):gsub(">", ">"))
end
local function clean_string(a)
-- Strip \r, trim whitespace
a = a:gsub("\r", "")
a = a:match("^\n*(.-)\n*$")
-- Strip excessive indentation
local indent_level = #a:match("^(\t*)")
a = a:sub(indent_level + 1):gsub("\n" .. ("\t"):rep(indent_level), "\n")
a = a:match("^%s*(.-)%s*$")
return a
end
local function process_string(s)
s = escape_html(s)
s = s:gsub("```([^\n]+)\n(.-)```", function(args, body)
return ("<code class=\"%s hljs\">%s</code>"):format(args, body)
end)
s = s:gsub("%b``", function(whole)
if (#whole > 3) then
return ("<code>%s</code>"):format(whole:sub(2, -2))
else
return whole
end
end)
-- This is really sketchy
s = s .. "\n\n"
s = s:gsub("\n%- *(.-)\n\n", function(contents)
contents = contents:gsub("\n%- *([^\n]*)", "<li>%1</li>")
contents = contents:gsub("\n", "<br />")
return "\n<ul><li>" .. contents .. "</li></ul>\n"
end)
return clean_string(s)
end
local function dictionary_shallow_copy(a, b)
b = b or {}
for key, value in pairs(a) do
b[key] = value
end
return b
end
local function dictionary_deep_copy(a, b)
b = b or {}
for key, value in pairs(a) do
if (type(value) == "table") then
b[key] = dictionary_deep_copy(value)
else
b[key] = value
end
end
return b
end
local function dictionary_shallow_merge(a, b)
for key, value in pairs(a) do
if (b[key] == nil) then
b[key] = value
end
end
return b
end
local function make_class_base(name)
return {
__priority = math.huge,
type = "class",
name = name,
description = "[no description]",
members = {},
inherits = {},
type_aliases = {
[name:match("([^%.]+)$")] = name
}
}
end
local function parse_method_declaration(source, out)
source = do_macros(source)
local start, finish, prefix, name, args = source:find("(.-)%s+([^%s]-)(%b())")
if (not start) then
error("Invalid method declaration: " .. tostring(source))
end
local sans_class, class_founds = prefix:gsub("^class%s*", "")
local sans_object, object_founds = prefix:gsub("^object%s*", "")
local sans_scope = class_founds > 0 and sans_class or sans_object
local scope = class_founds > 0 and "class" or object_founds > 0 and "object" or " "
local sans_public, publics = sans_scope:gsub("^public%s*", "")
local sans_private, privates = sans_scope:gsub("^private%s*", "")
local sans_vis = publics > 0 and sans_public or sans_private
local visibility = publics > 0 and "public" or privates > 0 and "private" or "unknown"
if (visibility == "unknown") then
print("DOCGEN WARNING: Unknown visibility in method:", name)
end
out.definition = source
out.type = "method"
out.prefix = prefix
out.scope = scope
out.visibility = visibility
out.returns = sans_vis
out.name = name
out.args = args:sub(2, -2)
out.declaration = ("%s %s%s"):format(sans_vis, name, args)
out.aka = {}
return finish
end
function docs.parser.method(out)
local finish = parse_method_declaration(out.definition, out)
-- Parse all the argument descriptions for this method.
out.arg_descriptions = {}
local start, finish, last = 0, 0, finish
local arg = 0
while (true) do
local prefix, name, description
start, finish, prefix, name, description = out.definition:find("\t([^\t\n:]-)([^%s:]+):%s*([^\n]+)", finish + 1)
if (not start) then
break
end
arg = arg + 1
if (#prefix == 0) then
print(("DOCGEN WARNING: Unknown prefix %q for argument %d in method %q!"):format(
prefix, arg, out.name
))
prefix = "unknown"
end
last = math.max(last, finish)
table.insert(out.arg_descriptions, {prefix = prefix, name = name, description = description})
end
-- Run a routine to find the end of -alias directives.
-- Necessary to do *before* we calculate the description.
local start, finish, last = 0, 0, last
while (true) do
local alias
start, finish, class_target, definition = out.definition:find("%-alias%s*([^:]*):%s*([^\n]+)", finish + 1)
if (not start) then
break
end
last = math.max(last, finish)
end
out.description = clean_string(out.definition:sub(last + 1))
-- Actually parse the -alias directives for this method.
local start, finish, last = 0, 0, 0
while (true) do
local alias
start, finish, class_target, definition = out.definition:find("%-alias%s*([^:]*):%s*([^\n]+)", finish + 1)
if (not start) then
break
end
last = finish
local item = {}
parse_method_declaration(definition, item)
dictionary_shallow_merge(out, item)
if (#class_target > 0) then
local class = docs.classes_by_name[class_target]
if (not class) then
class = make_class_base(class_target)
docs.classes_by_name[class_target] = class
end
local alt_version = dictionary_deep_copy(out)
dictionary_shallow_copy(item, alt_version)
table.insert(class.members, alt_version)
end
table.insert(out.aka, item)
end
end
function docs.parser.classes(body, class_list)
local objects = {}
local len_class_list = #class_list
local len_body = #body
for i = 1, len_class_list do
local class = class_list[i]
local low_bound, high_bound
if (i < len_class_list) then
low_bound, high_bound = class[1], class_list[i + 1][1]
else
low_bound, high_bound = class[1], #body
end
local object, existing
if (docs.classes_by_name[class[2]]) then
object = docs.classes_by_name[class[2]]
existing = true
else
object = make_class_base(class[2])
docs.classes_by_name[class[2]] = object
end
table.insert(objects, object)
-- Match #description
local start, finish, description = body:find("#description%s+(%b{})", low_bound)
if (start and finish < high_bound) then
-- Strip braces used for matching
description = description:sub(2, -2)
description = clean_string(description)
object.description = description
end
-- Match #inherits
local start, finish, inherits_string = body:find("#inherits%s+([^\n]+)", low_bound)
if (start and finish < high_bound) then
for key in inherits_string:gmatch("%s*([^,\r\n]+)%s*") do
table.insert(object.inherits, key)
end
end
-- Match #priority
local start, finish, priority = body:find("#priority%s+(%-?[%d%.]+)", low_bound)
if (start and finish < high_bound) then
object.priority = tonumber(priority) or priority
end
-- Match #alias TypeA TypeB
local start, finish = 0, low_bound
while (true) do
local source, target
start, finish, source, target = body:find("#alias%s+([%w_%.]+)%s+([%w_%.]+)", finish)
if (not start or finish > high_bound) then
break
end
object.type_aliases[source] = target
end
-- Match #method priority {...}
local start, finish = 0, low_bound
while (true) do
local definition
start, finish, priority, definition = body:find("#method%s*(%-?[%d%.]*)%s*(%b{})", finish)
if (not start or finish > high_bound) then
break
end
definition = definition:sub(2, -2)
definition = clean_string(definition)
local method = {
priority = tonumber(priority) or object.__priority,
type = "method",
definition = definition
}
docs.parser.method(method)
table.insert(object.members, method)
end
-- Match #property visibility class name {...}
local start, finish = 0, low_bound
while (true) do
local visibility, class, name, description
start, finish, visibility, class, name, description = body:find("#property%s*(%w+)%s*([^\n]-)%s+([%w%._]+)%s*(%b{})", finish)
if (not start or finish > high_bound) then
break
end
description = description:sub(2, -2)
description = clean_string(description)
if (visibility ~= "public" and visibility ~= "private") then
print(("DOCGEN WARNING: Unknown visibility %q in property %s!"):format(
visibility, name
))
visibility = "unknown"
end
local property = {
priority = object.__priority,
type = "property",
visibility = visibility,
class = class,
name = name,
description = description
}
table.insert(object.members, property)
end
end
return objects
end
function docs.parser.body(body, out)
-- Discover all the classes in the file and their bounds
local class_list = {}
local start, finish = 0, 0
while (true) do
local classname
start, finish, classname = body:find("#class%s+([%w_%. ]+)", finish + 1)
if (not start) then
break
end
table.insert(class_list, {start, classname})
end
out.classes = docs.parser.classes(body, class_list)
end
function docs.parser.file(filename, out)
local handle, err = io.open(filename, "rb")
if (not handle) then
error(("Could not open file %q for parsing: %s"):format(
filename, err
))
end
local body = handle:read("*a")
handle:close()
local object = {
type = "file",
name = path_leaf(filename),
filename = filename
}
docs.parser.body(body, object)
table.insert(out.files, object)
local seen = {}
for key, value in ipairs(object.classes) do
value.filename = filename
if (not seen[value]) then
seen[value] = true
table.insert(out.classes, value)
end
end
return object
end
function docs.parser.directory(dirname, out)
local mode = lfs.attributes(dirname, "mode")
if (mode ~= "directory") then
error(("Could not parse directory %q: not a directory"):format(
dirname
))
end
local result = {
type = "directory",
name = path_leaf(dirname),
members = {}
}
for filename in lfs.dir(dirname) do
if (filename ~= "." and filename ~= "..") then
local path = path_join(dirname, filename)
local object = docs.parser.parse(path, out)
if (not object) then
error("Got no object parsing file " .. path)
end
table.insert(result.members, object)
end
end
return result
end
function docs.parser.parse(path, out)
local mode = lfs.attributes(path, "mode")
if (mode == "directory") then
return docs.parser.directory(path, out)
elseif (mode == "file") then
return docs.parser.file(path, out)
end
return nil, "Unknown file mode: " .. mode
end
function docs.generator.write_file_if_changed(path, contents)
table.insert(docs.files_written, path)
local full_path = path_join(docs.doc_dir, path)
local handle, err = io.open(full_path, "rb")
if (handle) then
local old = handle:read("*a")
handle:close()
if (old == contents) then
return
end
end
docs.generator.write_file(path, contents)
end
function docs.generator.write_file(path, contents)
local handle, err = io.open(path_join(docs.doc_dir, path), "wb")
if (not handle) then
error(("Couldn't open file %q: %s"):format(
path, err
))
end
handle:write(contents)
handle:close()
end
local function do_template(template, data)
for key, value in pairs(data) do
template = template:gsub(("{%s}"):format(key), tostring(value))
end
return template
end
-- <link href="../../style.css" rel="stylesheet" type="text/css"/>
local template_class = clean_string [[
<h1 class="class-title">{name}</h1>
<span class="file-link">(in [{filename}]({file_link}))</span><br/>
{escaped_description}
{inherits_string}
<hr />
## Methods
{methods_string}
<hr />
## Properties
{properties_string}
]]
local template_inherits = [[
<span class="bold">Inherits {inherits_list}</span>
]]
local template_method_name = clean_string [[
<h4 class="method-name">!!{scope} !!{visibility} {escaped_name}({backticked_args})</h4>
<p class="method-returns bold">Returns <code>{escaped_returns}</code></p>
]]
local template_method = clean_string [[
{name_string}{aka_string}
<ul class="doc-arg-list">
{arg_descriptions_string}
</ul>
{escaped_description}
]]
local template_arg_description = clean_string [[
<li>!!{prefix} `{name}`: {description}</li>
]]
local template_property = clean_string [[
#### !!{visibility} {class_string} {name}
{description}
]]
local function process_method(method)
local arg_descriptions_buffer = {}
for key, description in ipairs(method.arg_descriptions) do
table.insert(arg_descriptions_buffer, clean_string(do_template(template_arg_description, description)))
end
method.arg_descriptions_string = table.concat(arg_descriptions_buffer, "\n")
-- Make args code-styled
method.escaped_args = method.args:gsub("<", "<"):gsub(">", ">")
method.backticked_args = #method.args > 0 and ("<code>%s</code>"):format(method.escaped_args) or ""
-- Escape the name and return types so we can use template syntax in them
method.escaped_name = escape_html(method.name)
method.escaped_returns = escape_html(method.returns)
method.escaped_description = process_string(escape_html(method.description))
if (#method.scope <= 1) then
method.scope = "unknown"
end
method.name_string = do_template(template_method_name, method)
end
function docs.generator.class(class)
local path = path_to_class(class.name)
local body = template_class
-- Default values for these lists in their string form.
class.methods_string = "[none]"
class.properties_string = "[none]"
-- Build an inhertiance string using @ directives.
local inherits_buffer = {}
for key, ancestor in ipairs(class.inherits) do
table.insert(inherits_buffer, "@" .. ancestor)
end
if (#inherits_buffer > 0) then
class.inherits_list = table.concat(inherits_buffer, ", ")
class.inherits_string = do_template(template_inherits, class)
else
class.inherits_string = ""
end
class.file_link = docs.file_url_base .. class.filename
class.escaped_description = process_string(class.description)
-- Sort members based on their priority
table.sort(class.members, function(a, b)
if (a.priority < b.priority) then
return true
elseif (a.priority > b.priority) then
return false
end
if (a.visibility == "public" and b.visibility == "private") then
return true
elseif (b.visibility == "public" and a.visibility == "private") then
return false
end
if (a.scope == "class" and b.scope ~= "class") then
return true
elseif (b.scope == "class" and a.scope ~= "class") then
return false
end
return a.name < b.name
end)
-- Handle methods and properties
local methods_buffer = {}
local properties_buffer = {}
for key, member in pairs(class.members) do
if (member.type == "method") then
process_method(member)
local aka_buffer = {}
for key, alias in ipairs(member.aka) do
process_method(alias)
table.insert(aka_buffer, do_template(template_method_name, alias))
end
member.aka_string = table.concat(aka_buffer, "\n")
table.insert(methods_buffer, do_template(template_method, member))
elseif (member.type == "property") then
if (#member.class > 0) then
member.class_string = "<code>" .. member.class .. "</code>"
else
member.class_string = "<code>[unknown]</code>"
end
table.insert(properties_buffer, do_template(template_property, member))
end
end
class.methods_string = next(methods_buffer) and table.concat(methods_buffer, "\n<hr/>\n") or class.methods_string
class.properties_string = next(properties_buffer) and table.concat(properties_buffer, "\n<hr/>\n") or class.properties_string
body = do_template(body, class)
-- Replace @ClassName with a link to that class.
body = body:gsub("@([%w_%.]+)", function(target)
local post = ""
if (not target:sub(-1, -1):match("[%w_]")) then
post = target:sub(-1, -1)
target = target:sub(1, -2)
end
-- Lowercase aliases are internal types, uppercase are classes.
if (target:sub(1, 1):lower() == target:sub(1, 1)) then
return ("<a href=\"%s\">%s</a>%s"):format(
link_to_type(target), target,
post
)
else
return ("<a href=\"%s\">%s</a>%s"):format(
link_to_class(class.type_aliases[target] or target), target,
post
)
end
end)
-- Inserts shorts using !!image&arg
body = body:gsub("!!([\\%w_]+)^?([%w_]*)", function(name, arg)
if (name:sub(1, 1) == "\\") then
return "!!" .. name:sub(2)
end
if (#arg > 0) then
return docs.shorts[name]:format(arg) or "UNKNOWN SHORT"
else
return docs.shorts[name]:format(" ") or "UNKNOWN SHORT"
end
end)
docs.generator.write_file_if_changed(path, body)
end
function docs.generator.root(object)
object.classes_by_name = {}
for key, class in ipairs(object.classes) do
object.classes_by_name[class.name] = object
end
for key, class in ipairs(object.classes) do
docs.generator.class(class)
end
end
function docs.update_mkdocs()
local handle = io.open("mkdocs.yml", "rb")
local body = handle:read("*a")
handle:close()
local filename_buffer = {}
for key, file in ipairs(docs.hand_files) do
table.insert(filename_buffer, "- [" .. file .. "]")
end
-- Sort the written files really well
table.sort(docs.files_written, function(a, b)
a = a:match("([^/]+)%.md$")
b = b:match("([^/]+)%.md$")
if (a:match("^" .. b)) then
return false
elseif (b:match("^" .. a)) then
return true
else
return a < b
end
end)
for key, file in ipairs(docs.files_written) do
table.insert(filename_buffer, ("- [%s, %s, %s]"):format(
file, file:match("^(.+)/.-$"), file:match("([^/]+)%.md$")
))
end
-- table.insert(filename_buffer, "- [style.css]")
body = body:gsub("pages%:.+", "pages:\n" .. table.concat(filename_buffer, "\n"))
handle = io.open("mkdocs.yml", "wb")
handle:write(body)
handle:close()
end
function docs.update()
local out = {
classes = {},
files = {}
}
local parsed = docs.parser.directory(docs.fs_base, out)
docs.generator.root(out)
docs.update_mkdocs()
end
return docs
|
require "IrrLua"
--[[
This Tutorial shows how to do 2d graphics with the Irrlicht Engine.
It shows how to draw images, keycolor based sprites,
transparent rectangles and different fonts. You will may consider
this useful if you want to make a 2d game with the engine, or if
you want to draw a cool interface or head up display for your 3d game.
--]]
--[[
At first, we let the user select the driver type, then
start up the engine, set a caption, and get a pointer
to the video driver.
--]]
function main()
-- let user select driver type
local installPath = "../../../"
print("Please select the driver you want for this example:\n" ..
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.2\n" ..
" (d) Software Renderer\n (e) Apfelbaum Software Renderer\n (f) NullDevice\n (otherKey) exit\n\n")
local answer = io.read("*line")
local driverTypes = {["a"] = irr.video.EDT_DIRECT3D9,
["b"] = irr.video.EDT_DIRECT3D8,
["c"] = irr.video.EDT_OPENGL,
["d"] = irr.video.EDT_SOFTWARE,
["e"] = irr.video.EDT_SOFTWARE2,
["f"] = irr.video.EDT_NULL }
local type = driverTypes[answer]
if type == nil then
return 0
end
-- create device
local device = irr.createDevice(driverType, irr.core.dimension2d(512, 384))
if device == nil then
return 1 -- could not create selected driver.
end
device:setWindowCaption("Irrlicht Engine - 2D Graphics Demo")
local driver = device:getVideoDriver()
--[[
All 2d graphics in this example are put together into one texture,
2ddemo.bmp. Because we want to draw colorkey based sprites, we need
to load this texture and tell the engine, which
part of it should be transparent based on a colorkey. In this example,
we don't tell it the color directly, we just say "Hey Irrlicht Engine,
you'll find the color I want at position (0,0) on the texture.".
Instead, it would be also possible to call
driver->makeColorKeyTexture(images, video::SColor(0,0,0,0)), to make
e.g. all black pixels transparent. Please note, that makeColorKeyTexture
just creates an alpha channel based on the color.
--]]
local images = driver:getTexture(installPath .. "media/2ddemo.bmp")
driver:makeColorKeyTexture(images, irr.core.position2d(0,0))
--[[
To be able to draw some text with two different fonts, we load them.
Ok, we load just one, as first font we just use the default font which is
built into the engine.
Also, we define two rectangles, which specify the position of the
images of the red imps (little flying creatures) in the texture.
--]]
font = device:getGUIEnvironment():getBuiltInFont()
font2 = device:getGUIEnvironment():getFont(installPath .. "media/fonthaettenschweiler.bmp")
local imp1 = irr.core.rect(349,15,385,78)
local imp2 = irr.core.rect(387,15,423,78)
local imp3
--[[
Everything is prepared, now we can draw everything in the draw loop,
between the begin scene and end scene calls. In this example, we
are just doing 2d graphics, but it would be no problem to mix them
with 3d graphics. Just try it out, and draw some 3d vertices or set
up a scene with the scene manager and draw it.
--]]
while device:run() and driver ~= nil do
if device:isWindowActive() then
local time = device:getTimer():getTime()
driver:beginScene(true, true, irr.video.SColor(0,120,102,136))
--[[
First, we draw 3 sprites, using the alpha channel we created with
makeColorKeyTexture. The last parameter specifiys that the drawing
method should use thiw alpha channel. The parameter before the last
one specifies a color, with wich the sprite should be colored.
(255,255,255,255) is full white, so the sprite will look like the
original. The third sprite is drawed colored based on the time.
--]]
-- draw fire & dragons background world
driver:draw2DImage(images, irr.core.position2d(50,50),
irr.core.rect(0,0,342,224), nil,
irr.video.SColor(255,255,255,255), true)
if (math.mod((time / 500) , 2)) < 0.5 then imp3 = imp1 else imp3 = imp2 end
-- draw flying imp
driver:draw2DImage(images, irr.core.position2d(164,125), imp3, nil,
irr.video.SColor(255,255,255,255), true)
-- draw second flying imp with colorcylce
driver:draw2DImage(images, irr.core.position2d(270,105), imp3, nil,
irr.video.SColor(255,math.mod(time, 255),255,255), true)
--[[
Drawing text is really simple. The code should be self explanatory.
--]]
-- draw some text
if font ~= nil then
font:draw("This demo shows that Irrlicht is also capable of drawing 2D graphics.",
irr.core.rect(130,10,300,50), irr.video.SColor(255,255,255,255))
end
-- draw some other text
if font2 ~= nil then
font2:draw("Also mixing with 3d graphics is possible.",
irr.core.rect(130,20,300,60),
irr.video.SColor(255,math.mod(time, 255), math.mod(time,255),255))
--[[
At last, we draw the Irrlicht Engine logo (without using a color or
an alpha channel) and a transparent 2d Rectangle at the position of
the mouse cursor.
--]]
-- draw logo
driver:draw2DImage(images, irr.core.position2d(10,10), irr.core.rect(354,87,442,118))
-- draw transparent rect under cursor
m = device:getCursorControl():getPosition()
driver:draw2DRectangle(irr.video.SColor(100,255,255,255),
irr.core.rect(m.X - 20, m.Y - 20,
m.X + 20, m.Y + 20))
driver:endScene()
end
end
end
--[[
That's all, it was not really difficult, I hope.
--]]
device:drop()
return 0
end
main()
|
--[[
Copyright 2014 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.
--]]
require('tap')(function(test)
local async = require('async')
local Agent = require('../agent').Agent
test('test endpoints', function()
async.series({
function(callback)
-- Test Service Net
local serviceNets = {
'dfw',
'ord',
'lon',
'syd',
'hkg',
'iad'
}
local function iter(location, callback)
local options = {
['config'] = { ['snet_region'] = location }
}
local ag = Agent:new(options)
ag:loadEndpoints(function(err, endpoints)
assert(not err)
assert(#endpoints == 3)
for i, _ in ipairs(endpoints) do
assert(endpoints[i]['srv_query']:find('snet%-'..location) ~= nil)
end
callback()
end)
end
async.forEach(serviceNets, iter, callback)
end,
function(callback)
-- Test 1 Custom Endpoints
local options = {
['config'] = { ['endpoints'] = '127.0.0.1:5040', }
}
local ag = Agent:new(options)
ag:loadEndpoints(function(err, endpoints)
assert(not err)
assert(#endpoints == 1)
assert(endpoints[1].host == '127.0.0.1')
assert(endpoints[1].port == 5040)
callback()
end)
end,
function(callback)
-- Test 3 Custom Endpoints
local options = {
['config'] = { ['endpoints'] = '127.0.0.1:5040,127.0.0.1:5041,127.0.0.1:5042', }
}
local ag = Agent:new(options)
ag:loadEndpoints(function(err, endpoints)
assert(err == nil)
assert(#endpoints == 3)
assert(endpoints[1].host == '127.0.0.1')
assert(endpoints[1].port== 5040)
assert(endpoints[2].host == '127.0.0.1')
assert(endpoints[2].port== 5041)
assert(endpoints[3].host == '127.0.0.1')
assert(endpoints[3].port== 5042)
callback()
end)
end,
function(callback)
-- Test query_endpoints
local options = {
['config'] = { ['query_endpoints'] = 'srv1,srv2,srv3', }
}
local ag = Agent:new(options)
ag:loadEndpoints(function(err, endpoints)
assert(not err)
assert(#endpoints == 3)
for i, _ in ipairs(endpoints) do
assert(endpoints[i]['srv_query']:find('srv'..i) ~= nil)
end
callback()
end)
end,
function(callback)
-- Add nil case with no selections
-- This is the default use case
local options = { ['config'] = {} }
local ag = Agent:new(options)
ag:loadEndpoints(function(err, endpoints)
assert(not err)
assert(#endpoints == 3)
for i, _ in ipairs(endpoints) do
assert(endpoints[i]['srv_query'])
end
callback()
end)
end
})
end)
test('test features (get)', function()
local features = require('../features')
assert(#features.get() > 0)
end)
test('test features (disable)', function()
local features = require('../features')
features.disable('health')
assert(features.get('health').disabled)
end)
test('test features (disable+remove)', function()
local features = require('../features')
p('before', features.get())
features.disable('upgrades', true)
assert(not features.get('upgrades'))
p(features.get())
end)
end)
|
-- updated for HWCE by Mikali
dofilepath("data:scripts/techfunc.lua")
dofilepath("data:scripts/rules/lib/objectlist_techvariants.lua")
dofilepath("data:scripts/playerspatch_ships_util.lua")
function Create_Vgr_Carrier(CustomGroup, playerIndex, shipID)
if Player_GetNumberOfVariantSquadronsOfTypeAwakeOrSleeping(playerIndex, "vgr_mothership") == 0 then
if playerIndex == Universe_CurrentPlayer() then
UI_SetElementVisible("NewResearchMenu", "NonCombat", 0);
end
end
end
function Update_Vgr_Carrier(CustomGroup, playerIndex, shipID)
--SobGroup_CreateIfNotExist("vgr_carrier"..playerIndex)
--SobGroup_Clear("vgr_carrier"..playerIndex)
--SobGroup_SobGroupAdd("vgr_carrier"..playerIndex, CustomGroup)
NoSalvageScuttle(CustomGroup, playerIndex, shipID)
end
|
-- class
function Pattern(path)
-- private members
local _path = path
-- public members
return {
type = "Pattern",
similar = function(self, similarity)
-- TODO: set min similarity
return self
end,
getFilename = function(self)
return _path
end,
}
end
--
-- local Pattern = {}
-- package.loaded["Pattern"] = Pattern
--
-- Pattern.__index = Pattern
--
-- function Pattern:new(filename)
-- o = o or {}
-- setmetatable(o,self)
-- self._filename = filename
--
-- return self
-- end
-- function Pattern:mask()
-- end
-- function Pattern:similar()
-- end
-- function Pattern:targetOffset()
-- end
-- function Pattern:getTargetOffset()
-- end
-- return Pattern
|
--
-- blockdiagram: DSL for specifying and launching microblx system
-- compositions
--
-- Copyright (C) 2013 Markus Klotzbuecher <[email protected]>
-- Copyright (C) 2014-2020 Markus Klotzbuecher <[email protected]>
--
-- SPDX-License-Identifier: BSD-3-Clause
--
local ubx = require "ubx"
local umf = require "umf"
local utils = require "utils"
local has_json, json = pcall(require, "cjson")
local strict = require "strict"
local M={}
-- shortcuts
local foreach = utils.foreach
local ts = tostring
local fmt = string.format
local insert = table.insert
local safets = ubx.safe_tostr
-- node configuration
_NC = nil
USE_STDERR = false
local red=ubx.red
local blue=ubx.blue
local cyan=ubx.cyan
local green=ubx.green
local yellow=ubx.yellow
local magenta=ubx.magenta
local crit, err, warn, notice, info = nil, nil, nil, nil, nil
local function stderr(msg)
if USE_STDERR then utils.stderr(msg) end
end
--- Create logging helper functions.
local function def_loggers(nd, src)
err = function(format, ...)
local msg = fmt(format, unpack{...}); stderr(msg); ubx.err(nd, src, msg)
end
warn = function(format, ...)
local msg = fmt(format, unpack{...}); stderr(msg); ubx.warn(nd, src, msg)
end
notice = function(format, ...)
local msg = fmt(format, unpack{...}); stderr(msg); ubx.notice(nd, src, msg)
end
info = function(format, ...)
local msg = fmt(format, unpack{...}); stderr(msg); ubx.info(nd, src, msg)
end
end
local function err_exit(code, format, ...)
err(format, ...)
os.exit(code)
end
--- Return the block table identified by bfqn at the level of sys
-- @param sys system
-- @param bfqn block fqn string
local function blocktab_get(sys, bfqn)
local s = sys
-- first index to the right subsystem
local elem = utils.split(bfqn, "%/")
local bname = elem[#elem]
for i=1,#elem-1 do
s = s.subsystems[elem[i]]
if not M.is_system(s) then return false end
end
-- then locate the right block
for _,v in pairs(s.blocks) do
if v.name==bname then return v end
end
return false
end
--- Check whether val is a nodeconfig reference
-- @param val value to check
-- @return nil or nodeconfig string name
local function check_noderef(val)
if type(val) ~= 'string' then return end
return string.match(val, "^%s*&([%w_-]+)")
end
--- apply func to systems including all subsystems
-- @param func function(system, name, parent-system)
-- @param root root system
-- @return list of return values of func
local function mapsys(func, root)
local res = {}
local function __mapsys(sys,name,psys)
res[#res+1] = func(sys, name, psys)
if not sys.subsystems then return end
for k,s in pairs(sys.subsystems) do __mapsys(s, k, sys) end
end
__mapsys(root)
return res
end
--- Apply func to all objs of system[systab] in breadth first
-- @param func function(obj, index/key, parent_system)
-- @param root_sys root system
-- @param systab which system table to map (blocks, configurations, ...)
-- @return list of return values of func
local function mapobj_bf(func, root_sys, systab)
local res = {}
local queue = { root_sys }
-- breadth first
while #queue > 0 do
local next_sys = table.remove(queue, 1) -- pop
-- process all nc's of s
foreach(
function (o, k)
res[#res+1] = func(o, k, next_sys)
end, next_sys[systab])
-- add s's subsystems to queue
foreach(function (subsys) queue[#queue+1] = subsys end, next_sys.subsystems)
end
return res
end
local function mapblocks(func, root_sys) return mapobj_bf(func, root_sys, 'blocks') end
local function mapconns(func, root_sys) return mapobj_bf(func, root_sys, 'connections') end
local function mapconfigs(func, root_sys) return mapobj_bf(func, root_sys, 'configurations') end
local function mapndconfigs(func, root_sys) return mapobj_bf(func, root_sys, 'node_configurations') end
local function mapimports(func, root_sys) return mapobj_bf(func, root_sys, 'imports') end
---
--- Model
---
local AnySpec=umf.AnySpec
local NumberSpec=umf.NumberSpec
local StringSpec=umf.StringSpec
local TableSpec=umf.TableSpec
local ObjectSpec=umf.ObjectSpec
local system = umf.class("system")
--- imports spec
local imports_spec = TableSpec
{
name='imports',
sealed='both',
array = { StringSpec{} },
}
-- blocks
local blocks_spec = TableSpec
{
name='blocks',
array = {
TableSpec
{
name='block',
dict = { name=StringSpec{}, type=StringSpec{} },
sealed='both',
}
},
sealed='both',
}
-- connections
local function conn_check_srctgt(class, conn, vres)
local res = true
if not conn._src then
umf.add_msg(vres, "err", "invalid src block ".. conn.src)
res = false
end
if not conn._tgt then
umf.add_msg(vres, "err", "invalid tgt block ".. conn.tgt)
res = false
end
return res
end
local connections_spec = TableSpec
{
name='connections',
array = {
TableSpec
{
name='connection',
postcheck = conn_check_srctgt,
dict = {
src=StringSpec{},
tgt=StringSpec{},
buffer_length=NumberSpec{ min=0 },
},
sealed='both',
optional={'buffer_length' },
}
},
sealed='both',
}
-- node_config
local node_config_spec = TableSpec {
name='node configs',
sealed='both',
dict = {
__other = {
TableSpec {
name = 'node config',
sealed='both',
dict = {
type = StringSpec{},
config = AnySpec{},
}
}
}
}
}
-- configuration
local function config_check_tgt(class, cfg, vres)
if cfg._tgt then return true end
umf.add_msg(vres, "err", "invalid target block ".. cfg.name)
return false
end
local configs_spec = TableSpec
{
name='configurations',
-- regular block configs
array = {
TableSpec
{
name='configuration',
postcheck = config_check_tgt,
dict = {
name=StringSpec{},
config=TableSpec{ name="config" },
},
sealed='both',
},
},
sealed='both'
}
local subsystems_spec = TableSpec {
name='subsystems',
dict={}, -- self reference added below
sealed='both',
}
-- Check that hash references are valid
local function sys_check_block_ref(class, sys, vres)
local res = true
local function check_config(c,_,s)
local function check_hash(val, tab, key)
local name = string.match(val, ".*#([%w_%-%/]+)")
if not name then return end
local bt = blocktab_get(s, name)
if not bt then
umf.add_msg(vres, "err", "unable to resolve block ref "..val)
res = false
end
end
utils.maptree(check_hash,
c.config,
function(v,_) return type(v)=='string' end)
end
mapconfigs(check_config, sys)
return res
end
--- Check all nodecfg references
local function sys_check_nodecfg_refs(class, sys, vres)
local res = true
-- first build a nodecfg table
local nc_list = {}
mapndconfigs(
function (o,k) nc_list[k] = o end, sys)
mapconfigs(
function (c,k,p)
for name,val in pairs(c.config) do
local nodecfg = check_noderef(val)
if nodecfg and not nc_list[nodecfg] then
res = false
umf.add_msg(vres, "err", "unable to resolve node config &"..nodecfg)
end
end
end, sys)
return res
end
local function sys_check_refs(class, sys, vres)
local res1 = sys_check_nodecfg_refs(class, sys, vres)
local res2 = sys_check_block_ref(class, sys, vres)
return res1 and res2
end
--- system spec
local system_spec = ObjectSpec
{
name='system',
type=system,
sealed='both',
postcheck = sys_check_refs,
dict={
subsystems = subsystems_spec,
imports=imports_spec,
blocks=blocks_spec,
connections=connections_spec,
node_configurations=node_config_spec,
configurations=configs_spec,
_parent=AnySpec{},
_name=AnySpec{},
_fqn=AnySpec{},
},
optional={ 'subsystems', 'imports', 'blocks', 'connections',
'node_configurations', 'configurations',
'_name', '_parent', '_fqn' },
}
-- add self references to subsystems dictionary
system_spec.dict.subsystems.dict.__other = { system_spec }
--- return the fqn of system s
-- @param sys system whos fqn to determine
-- @return fqn string
local function sys_fqn_get(sys)
local fqn = {}
local function __fqn_get(s)
if s._parent == nil then return
else __fqn_get(s._parent) end
fqn[#fqn+1] = s._name
fqn[#fqn+1] = '/'
end
assert(M.is_system(sys), "fqn_get: argument not a system")
__fqn_get(sys)
return table.concat(fqn)
end
--- Resolve config and connection references to blocks
-- checking will be done in the check function
-- @param root_sys
local function resolve_refs(root_sys)
local function connref_resolve(sys, connref)
local bref, portname = unpack(utils.split(connref, "%."))
local btab = blocktab_get(sys, bref)
return btab, portname
end
mapconfigs(
function(c,_,p)
c._tgt = blocktab_get(p, c.name)
end, root_sys)
mapconns(
function(c,_,p)
c._src, c._srcport = connref_resolve(p, c.src)
c._tgt, c._tgtport = connref_resolve(p, c.tgt)
end, root_sys)
end
--- system_populate_meta
-- populate the meta data of a system
-- can be called multiple times
-- @param system
local function system_populate_meta(self)
self.imports = self.imports or {}
self.blocks = self.blocks or {}
self.node_configurations = self.node_configurations or {}
self.configurations = self.configurations or {}
self.connections = self.connections or {}
mapsys(
function(s,n,p)
if p == nil then s._name='root' else s._name = n end
if p ~= nil then s._parent = p end
s._fqn = sys_fqn_get(s)
end, self)
mapblocks(
function(b,i,p)
local mt = {
_parent = p,
_index = i,
_fqn = p._fqn .. b.name
}
mt.__index = mt
mt.__newindex = mt
setmetatable(b, mt)
end, self)
mapconfigs(
function(c,i,p)
local mt = {
_parent = p,
_index = i,
_fqn = p._fqn..'configurations['..ts(i)..']'
}
mt.__index = mt
mt.__newindex = mt
setmetatable(c, mt)
end, self)
mapconns(
function(c,i,p)
local mt = {
_parent = p,
_index = i,
_fqn = p._fqn..'connections['..ts(i)..']'
}
mt.__index = mt
mt.__newindex = mt
setmetatable(c, mt)
end, self)
-- just try to resolv, checking will complain if unresolved
-- references remain
resolve_refs(self)
end
--- System constructor
function system:init()
system_populate_meta(self)
end
local function is_system(s)
return umf.uoo_type(s) == 'instance' and umf.instance_of(system, s)
end
--- Validate a blockdiagram model.
function system:validate(verbose)
return umf.check(self, system_spec, verbose)
end
--- read blockdiagram system file from usc or json file
-- @param fn file name of file (usc or json)
-- @param file_type optional file type (usc|json). Auto-detected from extension if not provided
local function load(fn, file_type)
local function read_json()
local f = assert(io.open(fn, "r"))
local data = json.decode(f:read("*all"))
return system(data)
end
if file_type == nil then
file_type = string.match(fn, "^.+%.(.+)$")
end
local suc, mod
if file_type == 'json' then
if not has_json then
print("no cjson library found, unable to load json")
os.exit(1)
end
suc, mod = pcall(read_json, fn)
elseif file_type == 'usc' or file_type == 'lua' then
suc, mod = pcall(dofile, fn)
else
print("ubx-launch error: unknown file type "..ts(file_type))
os.exit(1)
end
if not is_system(mod) then
print("failed to load "..ts(fn).."\n"..ts(mod))
os.exit(1)
end
return mod
end
---
--- late checking
---
--- check for unconnected input ports
local function lc_unconn_inports(nd, res)
local function blk_chk_unconn_inports(b)
ubx.ports_foreach(b,
function(p)
if p.in_interaction == nil then
res[#res+1] = yellow("unconnected input port ", true) ..
green(safets(b.name)) .. "." ..
cyan(safets(p.name))
end
end, ubx.is_inport)
end
ubx.blocks_map(nd, blk_chk_unconn_inports, ubx.is_cblock_instance)
end
--- check for unconnected output ports
local function lc_unconn_outports(nd, res)
local function blk_chk_unconn_outports(b)
ubx.ports_foreach(b,
function(p)
if p.out_interaction == nil then
res[#res+1] = yellow("unconnected output port ", true) ..
green(safets(b.name)) .. "." ..
cyan(safets(p.name))
end
end, ubx.is_outport)
end
ubx.blocks_map(nd, blk_chk_unconn_outports, ubx.is_cblock_instance)
end
-- table of late checks
-- this is used by by ubx-launch for help and cmdline handling
M._checks = {
unconn_inports = {
fun=lc_unconn_inports, desc="warn about unconnected input ports"
},
unconn_outports = {
fun=lc_unconn_outports, desc="warn about unconnected output ports"
}
}
--- Run a late validation
-- @param conf launch configuration
-- @param nd ubx_node
local function late_checks(conf, nd)
if not conf.checks then return end
local res = {}
info("running late validation (%s)", table.concat(conf.checks, ", "))
foreach(
function (chk)
if not M._checks[chk] then
err_exit(1, "unknown check %s", chk)
end
M._checks[chk].fun(nd,res)
end,
conf.checks or {})
foreach(function(v) warn(v) end, res)
if #res > 0 and conf.werror then
err_exit(1, "warnings raised and treating warnings as errors")
end
end
--- is active block instance predicate
local function is_active_inst(b)
return ubx.is_instance(b) and ubx.block_isactive(b)
end
--- is inactive block instance predicate
local function is_inactive_inst(b)
return ubx.is_instance(b) and not ubx.block_isactive(b)
end
--- Start up a system
-- @param self system specification to load
-- @param nd node info
function system.startup(self, nd)
local function block_start(b)
local bname = safets(b.name)
info("starting block %s", green(bname))
local ret = ubx.block_tostate(b, 'active')
if ret ~= 0 then
err_exit(ret, "failed to start block %s: %s",
bname, (ubx.retval_tostr[ret] or ts(ret)))
end
end
-- start all non-active blocks
ubx.blocks_map(nd, block_start, is_inactive_inst)
-- start the active blocks
ubx.blocks_map(nd, block_start, is_active_inst)
end
-- Pulldown a blockdiagram system
-- @param self system specification to load
-- @param nd configuration table
function system.pulldown(self, nd) ubx.node_rm(nd) end
--- Find and return ubx_block ptr
-- @param nd node_info
-- @param btab block table
-- @return bptr
local function get_ubx_block(nd, btab)
assert(btab._fqn, "missing fqn entry of " .. ts(btab))
return ubx.block_get(nd, btab._fqn)
end
--- load the systems modules
-- ensure modules are only loaded once
-- @param nd ubx_node into which to import
-- @param s system
local function import_modules(nd, s)
local loaded = {}
mapimports(
function(m)
if loaded[m] then return
else
ubx.load_module(nd, m)
loaded[m]=true
end
end, s)
end
--- Instantiate blocks
-- @param nd ubx_node into which to instantiate the blocks
-- @param root_sys system
local function create_blocks(nd, root_sys)
mapblocks(
function(b,i,p)
info("creating block %s [%s]", green(b._fqn), blue(b.type))
ubx.block_create(nd, b.type, b._fqn)
end, root_sys)
end
---
--- configuration handling
---
--- Instantiate ubx_data for all node configurations incl. subsystems
-- NCs defined higher in the composition tree override lower ones.
-- @param root_sys root system
-- @return table of initialized config-name=ubx_data tuples
local function build_nodecfg_tab(nd, root_sys)
local NC = {}
-- instantiate a node config and add it to global table. skip it if
-- a config of the same name exists
local function create_nc(cfg, name, s)
if NC[name] then
notice("node config %s in %s shadowed by a higher one", name, s._fqn)
return
end
local d = ubx.data_alloc(nd, cfg.type, 1)
ubx.data_set(d, cfg.config, true)
NC[name] = d
info("creating node config %s [%s] %s",
blue(name), magenta(cfg.type),
yellow(utils.tab2str(cfg.config)))
end
mapndconfigs(create_nc, root_sys)
return NC
end
--- Substitute #blockname with corresponding ubx_block_t ptrs
-- @param nd node_info
-- @param c configuration
-- @param s parent system
local function preproc_configs(nd, c, s)
local function replace_hash(val, tab, key)
local name = string.match(val, ".*#([%w_%-%/]+)")
if not name then return end
local bfqn = s._fqn..name
local ptr = ubx.block_get(nd, bfqn)
if ptr==nil then
err_exit(1, "error: failed to resolve # blockref to block %s", bfqn)
elseif ubx.is_proto(ptr) then
err_exit(1, "error: block #%s is a proto block", bfqn)
end
info("resolved # blockref to %s", magenta(bfqn))
tab[key]=ptr
end
utils.maptree(replace_hash, c.config, function(v,_) return type(v)=='string' end)
end
--- apply a single configuration to a block
--
-- This can be a regular or a node config value. In the latter case,
-- it will be looked up in NC. This function assumes that the config
-- exists.
--
-- @param b ubx_block_t*
-- @param name configuration name
-- @param val configuration value
-- @param NC node configuration table
local function apply_cfg_val(b, name, val, NC)
local blkcfg = ubx.block_config_get(b, name)
local blkfqn = safets(b.name)
-- check for references to node configs
local nodecfg = check_noderef(val)
if nodecfg then
if not NC[nodecfg] then
err_exit(1, "invalid node config reference '%s'", val)
end
info("nodecfg %s.%s with %s %s",
green(blkfqn), blue(name), yellow(nodecfg),
yellow(utils.tab2str(NC[nodecfg])))
local ret = ubx.config_assign(blkcfg, NC[nodecfg])
if ret < 0 then
err_exit(1, "failed to assign nodecfg %s to %s: %s",
utils.tab2str(NC[nodecfg]),
green(blkfqn.."."..blue(name)),
ubx.retval_tostr[ret])
end
else -- regular config
info("cfg %s.%s: %s", green(blkfqn), blue(name), yellow(utils.tab2str(val)))
ubx.set_config(b, name, val)
end
end
--- Configure a the given block with a config
-- (scalar, table or node cfg reference '&ndcfg'
-- @param cfg config table
-- @param b ubx_block_t
-- @param NC global config table
-- @param configured table to remember already configured block-configs
-- @param nonexist table to remember nonexisting configurations
local function apply_config(cfg, b, NC, configured, nonexist)
for name,val in pairs(cfg.config) do
local cfgfqn = cfg._tgt._fqn..'.'..name
if ubx.block_config_get(b, name) == nil then
nonexist[cfgfqn] = true
goto continue
end
if configured[cfgfqn] then
notice("skipping config %s: already configured with %s", cfgfqn, utils.tab2str(val))
goto continue
end
apply_cfg_val(b, name, val, NC)
configured[cfgfqn] = true
::continue::
end
end
--- Configure the previously unconfigured configs
--
-- This function is to be called after init and is intended to
-- configure dynamically added configs. Thus, it will ignore all
-- configurations that are not in the nonexist table
--
-- @param cfg config table
-- @param b ubx_block_t
-- @param NC global config table
-- @param configured table to remember already configured block-configs
-- @param nonexist table to remember nonexisting configurations
local function reapply_config(cfg, b, NC, configured, nonexist)
for name,val in pairs(cfg.config) do
local cfgfqn = cfg._tgt._fqn..'.'..name
-- skip all but the previously non-existing. Don't exit for the
-- previously configured ( nonexist[] = false ) so that we get
-- the "skipping already configured" message
if nonexist[cfgfqn] == nil then goto continue end
if ubx.block_config_get(b, name) == nil then
err_exit(1, "block %s [%s] has no config '%s'",
cfg._tgt._fqn, cfg._tgt.type, name)
nonexist[cfgfqn] = false
goto continue
end
notice("late config of %s with %s", cfgfqn, utils.tab2str(val))
if configured[cfgfqn] then
notice("skipping config %s: already configured with %s", cfgfqn, utils.tab2str(val))
goto continue
end
apply_cfg_val(b, name, val, NC)
configured[cfgfqn] = true
::continue::
end
end
--- configure all blocks
-- @param nd node_info
-- @param root_sys root system
-- @param NC
local function configure_blocks(nd, root_sys, NC)
-- table of already configured configs
-- { [<blkfqn.config>] = true }
-- to avoid double configuration
local configured = {}
-- table of configurations that were skipped because
-- non-existant. These will be retried in reapply_config to handle
-- dynamically created configurations that will be interpreted in
-- the start hook.
local nonexist = {}
-- substitue #blockname syntax
mapconfigs(function(c, i, s) preproc_configs(nd, c, s, i) end, root_sys)
-- apply configurations to blocks
mapconfigs(
function(cfg, i)
local b = get_ubx_block(nd, cfg._tgt)
if b == nil then
err_exit(1, "error: config %s for block %s: no such block found",
cfg._fqn, cfg.name)
end
local bstate = b:get_block_state()
if bstate ~= 'preinit' then
warn("applying configs: block %s not in state preinit but %s", cfg._tgt._fqn, bstate)
return
end
apply_config(cfg, b, NC, configured, nonexist)
end, root_sys)
-- initialize all blocks (brings them to state 'inactive')
mapblocks(
function(btab,i,p)
local b = get_ubx_block(nd, btab)
info("initializing block %s", safets(b.name))
local ret = ubx.block_init(b)
if ret ~= 0 then
err_exit(ret, "failed to initialize block %s: %d",
btab.name, tonumber(ret))
end
end, root_sys)
-- reapply configurations to blocks
mapconfigs(
function(cfg, i)
local b = get_ubx_block(nd, cfg._tgt)
if b == nil then
err_exit(1, "error: config %s for block %s: no such block found",
cfg._fqn, cfg.name)
end
local bstate = b:get_block_state()
if bstate ~= 'inactive' then
warn("reapplying configs: block %s not in state preinit but %s",
cfg._tgt._fqn, bstate)
return
end
reapply_config(cfg, b, NC, configured, nonexist)
end, root_sys)
-- check that all initially non-existing configs were configured
for cfgfqn, val in pairs(nonexist) do
assert(val==true, fmt("unconfigured nonexist config %s reapply", cfgfqn))
end
end
--- Connect blocks
-- @param nd node_info
-- @param root_sys root system
local function connect_blocks(nd, root_sys)
local function do_connect(c, i, p)
local srcblk = c._src._fqn
local srcport = c._srcport
local tgtblk = c._tgt._fqn
local tgtport = c._tgtport
-- are we connecting to an interaction?
if srcport==nil then
-- src is interaction, target a port
local ib = ubx.block_get(nd, srcblk)
if ib==nil then
err_exit(1, "do_connect: unknown src block %s", srcblk)
end
if not ubx.is_iblock_instance(ib) then
err_exit(1, "%s is not a valid iblock instance", srcblk)
end
local btgt = ubx.block_get(nd, tgtblk)
local ptgt = ubx.port_get(btgt, tgtport)
if ubx.port_connect_in(ptgt, ib) ~= 0 then
err_exit(1, "failed to connect interaction %s to port %s.%s",
srcblk, tgtblk, tgtport)
end
info("connecting %s (iblock) -> %s.%s", srcblk, tgtblk, tgtport)
elseif tgtport==nil then
-- src is a port, target is an interaction
local ib = ubx.block_get(nd, tgtblk)
if ib==nil then
err_exit(1, "do_connect: unknown tgt block %s", tgtblk)
end
if not ubx.is_iblock_instance(ib) then
err_exit(1, "%s not a valid iblock instance", tgtblk)
end
local bsrc = ubx.block_get(nd, srcblk)
local psrc = ubx.port_get(bsrc, srcport)
if ubx.port_connect_out(psrc, ib) ~= 0 then
err_exit(1, "failed to connect %s.%s to %s (iblock)",
srcblk, srcport, tgtblk)
end
info("connecting %s.%s -> %s (iblock)", srcblk, srcport, tgtblk)
else
-- both src and target are ports
local bufflen = c.buffer_length or 1
info("connecting %s.%s -[%d]-> %s.%s",
srcblk, srcport, bufflen, tgtblk, tgtport)
local bsrc = ubx.block_get(nd, srcblk)
local btgt = ubx.block_get(nd, tgtblk)
if bsrc==nil then
err_exit(1, "ERR: src block %s not found", srcblk)
end
if btgt==nil then
err_exit(1, "ERR: tgt block %s not found", tgtblk)
end
ubx.conn_lfds_cyclic(bsrc, srcport, btgt, tgtport, bufflen)
end
end
mapconns(do_connect, root_sys)
end
--- Merge one system into another
-- No duplicate handling. Running the validation after a merge is strongly recommended.
-- @param self targed of the merge
-- @param sys system which to merge into self
function system.merge(self, sys)
local function do_merge(dest, src)
foreach(function (imp) insert(dest.imports, imp) end, src.imports)
foreach(function (blk) insert(dest.blocks, blk) end, src.blocks)
foreach(function (cfg) insert(dest.configurations, cfg) end, src.configurations)
foreach(function (conn) insert(dest.connections, conn) end, src.connections)
foreach(
function (ndcfg, name)
if dest.node_configurations[name] then
warn("merge: overriding existing destination system node_config %s", name)
end
dest.node_configurations[name] = ndcfg
end, src.node_configurations)
if src.subsystems and not dest.subsystems then dest.subsystems={} end
foreach(
function (subsys, name)
if dest.subsystems[name] then
warn("merge: overriding existing destination subsystem %s", name)
end
dest.subsystems[name] = subsys
end, src.subsystems)
if src.subsystems then
do_merge(dest.subsystems, src.subsystems)
end
end
do_merge(self, sys)
end
--- Launch a blockdiagram system
-- @param self system specification to load
-- @param t configuration table
-- @return nd node handle
function system.launch(self, t)
if self:validate(false) > 0 then self:validate(true) os.exit(1) end
-- fire it up
t = t or {}
t.nodename = t.nodename or "n"
USE_STDERR = t.use_stderr or false
local nd = ubx.node_create(t.nodename,
{ loglevel=t.loglevel,
mlockall=t.mlockall,
dumpable=t.dumpable })
def_loggers(nd, "launch")
import_modules(nd, self)
create_blocks(nd, self)
_NC = build_nodecfg_tab(nd, self)
configure_blocks(nd, self, _NC)
connect_blocks(nd, self)
late_checks(t, nd)
if not t.nostart then system.startup(self, nd) end
return nd
end
-- exports
M.is_system = is_system
M.system = system
M.system_spec = system_spec
M.load = load
return M
|
-----------------------------------
-- Area: Toraimarai Canal (169)
-----------------------------------
require("scripts/globals/zone")
-----------------------------------
zones = zones or {}
zones[tpz.zone.TORAIMARAI_CANAL] =
{
text =
{
SEALED_SHUT = 3, -- It's sealed shut with incredibly strong magic.
ITEM_CANNOT_BE_OBTAINED = 6428, -- You cannot obtain the <item>. Come back after sorting your inventory.
ITEM_OBTAINED = 6434, -- Obtained: <item>.
GIL_OBTAINED = 6435, -- Obtained <number> gil.
KEYITEM_OBTAINED = 6437, -- Obtained key item: <keyitem>.
FELLOW_MESSAGE_OFFSET = 6463, -- I'm ready. I suppose.
GEOMAGNETRON_ATTUNED = 7056, -- Your <keyitem> has been attuned to a geomagnetic fount in the corresponding locale.
CONQUEST_BASE = 7095, -- Tallying conquest results...
FISHING_MESSAGE_OFFSET = 7254, -- You can't fish here.
CHEST_UNLOCKED = 7362, -- You unlock the chest!
PLAYER_OBTAINS_ITEM = 7531, -- <name> obtains <item>!
UNABLE_TO_OBTAIN_ITEM = 7532, -- You were unable to obtain the item.
PLAYER_OBTAINS_TEMP_ITEM = 7533, -- <name> obtains the temporary item: <item>!
ALREADY_POSSESS_TEMP = 7534, -- You already possess that temporary item.
NO_COMBINATION = 7539, -- You were unable to enter a combination.
REGIME_REGISTERED = 9617, -- New training regime registered!
COMMON_SENSE_SURVIVAL = 10665, -- It appears that you have arrived at a new survival guide provided by the Adventurers' Mutual Aid Network. Common sense dictates that you should now be able to teleport here from similar tomes throughout the world.
HOMEPOINT_SET = 10693, -- Home point set!
},
mob =
{
CANAL_MOOCHER_PH =
{
[17469575] = 17469578,
[17469576] = 17469578,
[17469577] = 17469578,
},
KONJAC_PH =
{
[17469629] = 17469632,
[17469630] = 17469632,
[17469631] = 17469632,
},
MAGIC_SLUDGE = 17469516,
HINGE_OILS_OFFSET = 17469666,
MIMIC = 17469761,
},
npc =
{
TOME_OF_MAGIC_OFFSET = 17469828,
TREASURE_COFFER = 17469835,
CASKET_BASE = 17469772,
},
}
return zones[tpz.zone.TORAIMARAI_CANAL]
|
sqlite = {}
function sqlite.statement:new(query)
self.__index = self
self.source = query
self._binds = {}
self._state = nil
return self
end
function sqlite.statement:pluck(bool)
if bool == false then
self._state = nil
else
self._state = 'pluck'
end
return self
end
function sqlite.statement:expand(bool)
if bool == false then
self._state = nil
else
self._state = 'expand'
end
return self
end
function sqlite.statement:raw(bool)
if bool == false then
self._state = nil
else
self._state = 'raw'
end
return self
end
function sqlite.statement:run(...)
self:bind(...)
return exports[GetCurrentResourceName()].run(self.source, self._binds, self._state)
end
function sqlite.statement:all(...)
self:bind(...)
return exports[GetCurrentResourceName()].all(self.source, self._binds, self._state)
end
function sqlite.statement:get(...)
self:bind(...)
return exports[GetCurrentResourceName()].get(self.source, self._binds, self._state)
end
function sqlite.statement:columns(...)
self:bind(...)
return exports[GetCurrentResourceName()].columns(self.source, self._binds, self._state)
end
function sqlite.statement:bind(...)
for _, param in pairs(...) do
table.insert(self._binds, param)
end
return self
end
function sqlite.statement:iterate(...)
self:bind(...)
local iter = 0
return function()
iter = iter + 1
end
end
function sqlite.prepare(query)
return sqlite.statement:new(query)
end
function sqlite.transaction(query, params)
return exports[GetCurrentResourceName()].transaction(query, params)
end
function sqlite.transaction.deferred(query, params)
return exports[GetCurrentResourceName()].transaction_deferred(query, params)
end
function sqlite.transaction.immediate(query, params)
return exports[GetCurrentResourceName()].transaction_immediate(query, params)
end
function sqlite.transaction.exclusive(query, params)
return exports[GetCurrentResourceName()].transaction_exclusive(query, params)
end
function sqlite.exec(query)
return exports[GetCurrentResourceName()].execute(query)
end
function sqlite.pragma(query, simple)
return exports[GetCurrentResourceName()].pragma(query, simple)
end
function sqlite.backup(path, cb)
return exports[GetCurrentResourceName()].backup(path, cb)
end
function sqlite.backup:sync(path)
local result
local success = false
exports[GetCurrentResourceName()].backup(path, function(r)
result = r
success = true
end)
while success == false do
Citizen.Wait(0)
end
return result
end
function sqlite.action(path, cb)
return exports[GetCurrentResourceName()]['function'](path, cb)
end
|
local Types = require(script.Parent.Types)
local TYPE_MISMATCH_ERROR = "Type mistmatch between initialValue (%s) and targetValue(%s)"
local Linear = {}
Linear.__index = Linear
function Linear.new(targetValue: Types.MotorValue, options: Types.LinearOptions?)
assert(targetValue, "Missing argument #1: targetValue")
options = options or {}
return setmetatable({
_targetValue = targetValue,
_velocity = options.velocity or 1,
}, Linear)
end
function Linear:step(state, dt)
local position = state.value
local velocity = self._velocity -- Linear motion ignores the state's velocity
local goal = self._targetValue
local positionType = typeof(position)
local goalType = typeof(goal)
assert(positionType == goalType, TYPE_MISMATCH_ERROR:format(positionType, goalType))
local dPos = dt * velocity
local complete
if positionType == "number" then
complete = dPos >= math.abs(goal - position)
position = position + dPos * (goal > position and 1 or -1)
else
local posToGoal = goal - position
complete = dPos >= posToGoal.Magnitude
position = position + posToGoal.Unit * dPos
end
if complete then
position = self._targetValue
velocity = 0
end
return {
complete = complete,
value = position,
velocity = velocity,
}
end
return Linear
|
-- cmd([[colorscheme everforest]]) -- Put your favorite colorscheme here
-- Nightfox config
local nightfox = require("nightfox")
nightfox.setup({
fox = "duskfox",
alt_nc = true,
styles = {
comments = "italic",
keywords = "bold",
functions = "italic,bold",
},
inverse = {
visual = true,
search = true,
match_paren = true,
},
colors = {
bg = "#000000",
},
})
nightfox.load()
-- Good info on overriding colors: https://gist.github.com/romainl/379904f91fa40533175dfaec4c833f2f
-- Note had to add the SpecialKey to keep highlight on yank working alongside the CursorLine override
vim.api.nvim_exec(
[[
function! MyHighlights() abort
highlight CursorLine guifg=NONE guibg=#353A54
highlight CmpItemAbbr guifg=#9FA4B6
highlight SpecialKey guibg=NONE
highlight CmpItemKind guifg=#8289A0
highlight CmpItemMenu guifg=#8289A0
highlight PmenuSel guibg=#73daca guifg=#111111
highlight Pmenu guibg=#2E3248
highlight GitSignsAddNr guifg=#26A07A
highlight GitSignsDeleteNr guifg=#E87D7D
highlight GitSignsChangeNr guifg=#AD991F
endfunction
augroup MyColors
autocmd!
autocmd ColorScheme * call MyHighlights()
augroup END]],
true
)
|
local RD = {}
local nettable = {};
local ent_table = {};
local resourcenames = {}
local resources = {}
local status = false
local rd_cache = cache.create(1, true) --Store data for 1 second
--Local functions/variables
--Precache some sounds for snapping
for i=1,3 do
util.PrecacheSound( "physics/metal/metal_computer_impact_bullet"..i..".wav" )
end
util.PrecacheSound( "physics/metal/metal_box_impact_soft2.wav" )
local nextnetid = 1;
--These functions send all needed info the client
--nettable
--[[local function CreateEmptyNetwork(netid, ply)
umsg.Start("RD_AddNet", ply)
umsg.Short(netid)
umsg.End()
end
local function SendResoureDataToNetwork(netid, resource, maxvalue, value, ply)
umsg.Start("RD_AddResoureToNet", ply)
umsg.Short(netid)
umsg.String(resource)
umsg.Long(maxvalue)
umsg.Long(value)
umsg.End()
end
--Needed?
local function AddConToNetwork(netid, conid, ply)
umsg.Start("RD_AddConToNet", ply)
umsg.Short(netid)
umsg.Short(conid)
umsg.End()
end
--Needed?
local function ClearCons(netid, ply)
umsg.Start("RD_RemoveNetCons", ply)
umsg.Short(netid)
umsg.End()
end
local function RemoveNetWork(netid, ply)
umsg.Start("RD_RemoveNet", ply)
umsg.Short(netid)
umsg.End()
end
--ent_table
local function CreateEmptyEntity(entid, ply)
umsg.Start("RD_AddEnt", ply)
umsg.Short(entid)
umsg.End()
end
local function SendResoureDataToEntity(entid, resource, maxvalue, value, ply)
umsg.Start("RD_AddResoureToEnt", ply)
umsg.Short(entid)
umsg.String(resource)
umsg.Long(maxvalue)
umsg.Long(value)
umsg.End()
end
local function ChangeNetWorkOnEntity(entid, netid, ply)
umsg.Start("RD_ChangeNetOnEnt", ply)
umsg.Short(entid)
umsg.Short(netid)
umsg.End()
end
local function RemoveEnt(entid, ply)
umsg.Start("RD_RemoveEnt", ply)
umsg.Short(entid)
umsg.End()
end]]
-- End: These functions send all needed info the client
--[[local function UpdateNetworksAndEntities()
--Sentd ent_table first
if table.Count(ent_table) ~= 0 then
for k, v in pairs(ent_table) do
if v.clear then
RemoveEnt(k)
ent_table[k] = nil
elseif v.new then
CreateEmptyEntity(k)
if v.network ~= 0 then
ChangeNetWorkOnEntity(k, v.network)
end
if table.Count(v.resources) > 0 then
for l, w in pairs(v.resources) do
SendResoureDataToEntity(k, l, w.maxvalue, w.value)
end
end
v.new = false
v.haschanged = false
elseif v.haschanged then
ChangeNetWorkOnEntity(k, v.network)
if table.Count(v.resources) > 0 then
for l, w in pairs(v.resources) do
if w.haschanged then
SendResoureDataToEntity(k, l, w.maxvalue, w.value)
w.haschanged = false
end
end
end
v.haschanged = false
end
end
end
--now lets send the nettable
if table.Count(nettable) ~= 0 then
for k, v in pairs(nettable) do
if v.clear then
RemoveNetWork(k)
nettable[k] = nil
elseif v.new then
CreateEmptyNetwork(k)
if table.Count(v.resources) > 0 then
for l, w in pairs(v.resources) do
SendResoureDataToNetwork(k, l, w.maxvalue, w.value)
w.haschanged = false
end
end
if table.Count(v.cons) > 0 then
for l, w in pairs(v.cons) do
AddConToNetwork(k, w)
end
end
v.new = false
v.haschanged = false
elseif v.haschanged then
if table.Count(v.resources) > 0 then
for l, w in pairs(v.resources) do
if w.haschanged then
SendResoureDataToNetwork(k, l, w.maxvalue, w.value)
w.haschanged = false
end
end
end
ClearCons(k)
if table.Count(v.cons) > 0 then
for l, w in pairs(v.cons) do
AddConToNetwork(k, w)
end
end
v.haschanged = false
end
end
end
end
local function SendEntireNetWorkToClient(ply)
--Sentd ent_table first
if table.Count(ent_table) ~= 0 then
for k, v in pairs(ent_table) do
if not v.clear then
CreateEmptyEntity(k, ply)
if v.network ~= 0 then
ChangeNetWorkOnEntity(k, v.network, ply)
end
if table.Count(v.resources) > 0 then
for l, w in pairs(v.resources) do
SendResoureDataToEntity(k, l, w.maxvalue, w.value, ply)
end
end
end
end
end
--now lets send the nettable
if table.Count(nettable) ~= 0 then
for k, v in pairs(nettable) do
if not v.clear then
CreateEmptyNetwork(k, ply)
if table.Count(v.resources) > 0 then
for l, w in pairs(v.resources) do
SendResoureDataToNetwork(k, l, w.maxvalue, w.value, ply)
end
end
if table.Count(v.cons) > 0 then
for l, w in pairs(v.cons) do
AddConToNetwork(k, w, ply)
end
end
end
end
end
end]]
local function WriteBool(bool)
net.WriteBit(bool)
end
local function WriteShort(short)
return net.WriteInt(short, 16);
end
local function WriteLong(long)
return net.WriteInt(long, 32);
end
util.AddNetworkString("RD_Entity_Data")
local function sendEntityData(ply, entid, rddata)
net.Start("RD_Entity_Data")
WriteShort(entid) --send key to update
WriteBool(false) --Update
WriteShort(rddata.network) --send network used in entity
local nr_of_resources = table.Count(rddata.resources);
WriteShort(nr_of_resources) --How many resources are going to be send?
if nr_of_resources > 0 then
for l, w in pairs(rddata.resources) do
net.WriteString(l)
WriteLong(w.maxvalue)
WriteLong(w.value)
end
end
if ply then
net.Send(ply)
--net.Broadcast()
else
net.Broadcast()
end
end
util.AddNetworkString("RD_Network_Data")
local function sendNetworkData(ply, netid, rddata)
net.Start("RD_Network_Data")
WriteShort(netid) --send key to update
WriteBool(false) --Update
local nr_of_resources = table.Count(rddata.resources);
WriteShort(nr_of_resources) --How many resources are going to be send?
if nr_of_resources > 0 then
for l, w in pairs(rddata.resources) do
net.WriteString(l)
WriteLong(w.maxvalue)
WriteLong(w.value)
end
end
local nr_of_cons = #rddata.cons;
WriteShort(nr_of_cons) --How many connections are going to be send?
if nr_of_cons > 0 then
for l, w in pairs(rddata.cons) do
WriteShort(w)
end
end
if ply then
net.Send(ply)
--net.Broadcast()
else
net.Broadcast()
end
end
--[[
function RD.GetEntityTable(ent)
local entid = ent:EntIndex( )
return ent_table[entid] or {}
end
function RD.GetNetTable(netid)
return nettable[netid] or {}
end
]]
local function RequestResourceData(ply, com, args)
if not args then ply:ChatPrint("RD BUG: You forgot to provide arguments") return end
if not args[1] then ply:ChatPrint("RD BUG: You forgot to enter the type") return end
if not args[2] then ply:ChatPrint("RD BUG: You forgot to enter the entid/netid") return end
local data, tmpdata
if args[1] == "ENT" then
data = rd_cache:get("entity_"..args[2]);
if not data then
tmpdata = ent_table[tonumber(args[2])]
if not tmpdata then ply:ChatPrint("RD BUG: INVALID ENTID") return end
data = {}
data.network = tmpdata.network
data.resources = {}
local OverlaySettings = list.Get("LSEntOverlayText")[tmpdata.ent:GetClass()]
local storage = true
if OverlaySettings then
local num = OverlaySettings.num or 0
local resnames = OverlaySettings.resnames
local genresnames = OverlaySettings.genresnames
if num != -1 then
storage = false
local v
if resnames and table.Count(resnames) > 0 then
for _, k in pairs(resnames) do
data.resources[k] = {value = RD.GetResourceAmount(tmpdata.ent, k), maxvalue = RD.GetNetworkCapacity(tmpdata.ent, k)}
end
end
if genresnames and table.Count(genresnames) > 0 then
for _, k in pairs(genresnames) do
data.resources[k] = {value = RD.GetResourceAmount(tmpdata.ent, k), maxvalue = RD.GetNetworkCapacity(tmpdata.ent, k)}
end
end
end
end
if storage then
for k, v in pairs(tmpdata.resources) do
data.resources[k] = {value = RD.GetResourceAmount(tmpdata.ent, k), maxvalue = RD.GetNetworkCapacity(tmpdata.ent, k)}
end
end
rd_cache:add("entity_"..args[2], data)
end
sendEntityData(ply, tonumber(args[2]), data)
elseif args[1] == "NET" then
data = rd_cache:get("network_"..args[2]);
if not data then
tmpdata = nettable[tonumber(args[2])]
if not tmpdata then ply:ChatPrint("RD BUG: INVALID NETID") return end
data = {}
data.resources = {}
for k, v in pairs(tmpdata.resources) do
data.resources[k] = {value = RD.GetNetResourceAmount(tonumber(args[2]), k), maxvalue = RD.GetNetNetworkCapacity(tonumber(args[2]), k)}
end
data.cons = {}
for k, v in pairs(tmpdata.cons) do
table.insert(data.cons, v)
end
rd_cache:add("network_"..args[2], data)
end
sendNetworkData(ply, tonumber(args[2]), data)
else
ply:ChatPrint("RD BUG: INVALID TYPE")
end
end
concommand.Add( "RD_REQUEST_RESOURCE_DATA", RequestResourceData )
--Remove All Entities that are registered by RD, without RD they won't work anyways!
local function ClearEntities()
if table.Count(ent_table) ~= 0 then
for k, v in pairs(ent_table) do
local ent = ents.GetByIndex( k );
if ent and IsValid(ent) and ent ~= NULL then
ent:Remove()
end
end
end
end
local function ClearNets()
umsg.Start("RD_ClearNets")
umsg.End()
end
local function RD_Initial_Spawn( ply )
--SendEntireNetWorkToClient(ply)
end
--End local functions
--[[
The Constructor for this Custom Addon Class
]]
function RD.__Construct()
if status then return false , CAF.GetLangVar("This Addon is already Active!") end
nextnetid = 1
ClearNets()
ClearEntities()
nettable = {};
ent_table = {};
CAF.AddHook("think3", UpdateNetworksAndEntities)
hook.Add( "PlayerInitialSpawn", "RD_Initial_Spawn", RD_Initial_Spawn )
for k, ply in pairs(player.GetAll( )) do
SendEntireNetWorkToClient(ply)
end
CAF.AddServerTag("RD")
status = true
return true
end
--[[
The Destructor for this Custom Addon Class
]]
function RD.__Destruct()
if not status then return false , CAF.GetLangVar("This Addon is already disabled!") end
nextnetid = 1
ClearNets()
ClearEntities()
nettable = {};
ent_table = {};
CAF.RemoveHook("think3", UpdateNetworksAndEntities)
hook.Remove( "PlayerInitialSpawn", "RD_Initial_Spawn")
CAF.RemoveServerTag("RD")
status = false
return true
end
--[[
Get the required Addons for this Addon Class
]]
function RD.GetRequiredAddons()
return {}
end
--[[
Get the Boolean Status from this Addon Class
]]
function RD.GetStatus()
return status
end
--[[
Get the Version of this Custom Addon Class
]]
function RD.GetVersion()
return 3.1, "Alpha"
end
--[[
Get any custom options this Custom Addon Class might have
]]
function RD.GetExtraOptions()
return {}
end
--[[
Get the Custom String Status from this Addon Class
]]
function RD.GetCustomStatus()
return "Not Implemented Yet"
end
function RD.AddResourcesToSend()
end
CAF.RegisterAddon("Resource Distribution", RD, "1")
--[[
RemoveRDEntity( entity)
Call this when you want to remove the registered RD entity from the RD3 syncing (happens in the base_rd_entity/init.lua: OnRemove Function, if you override this function, don't forget to add this call!!)
]]
function RD.RemoveRDEntity(ent)
if not ent or not IsValid(ent) then return end
if ent.IsNode then
--RemoveNetWork(ent.netid)
--nettable[ent.netid].clear = true
nettable[ent.netid] = nil;
elseif ent_table[ent:EntIndex()] then
--RemoveEnt(ent:EntIndex())
--ent_table[ent:EntIndex()].clear = true
ent_table[ent:EntIndex()] = nil
end
end
--[[
RegisterNonStorageDevice( entity)
Used to register non-storage Device ( devices that have a max of 0 for all resources)
Add the to-display resources to the "list.Set( "LSEntOverlayText" , "generator_energy_fusion", {HasOOO = true, num = 2, resnames = {"nitrogen","heavy water"}} )" call specific for your Sent
]]
function RD.RegisterNonStorageDevice(ent)
if not IsValid( ent ) then return false, "Not a valid entity" end
if not ent_table[ent:EntIndex( )] then
ent_table[ent:EntIndex()] = {}
local index = ent_table[ent:EntIndex( )];
index.resources = {}
index.network = 0;
index.clear = false
index.haschanged = false;
index.new = true;
index.ent = ent
elseif ent_table[ent:EntIndex( )].ent ~= ent then
ent_table[ent:EntIndex()] = {}
local index = ent_table[ent:EntIndex( )];
index.resources = {}
index.network = 0;
index.clear = false
index.haschanged = false;
index.new = true;
index.ent = ent
end
end
--[[
AddResource(entity, resource, maximum amount, default value)
Add a resource to the Entity, you can use this for any amount, but it's recomended to only call this if your entity can store resources (max amount > 0 )
Even if it requires multiple resources, registering the ones that can store resources is enough.
Note: If your device doesn't store anything just use RegisterNonStorageDevice instead of this, it's more optimized for it
]]
function RD.AddResource(ent, resource, maxamount, defaultvalue)
if not IsValid( ent ) then return false, "Not a valid entity" end
if not resource then return false, "No resource given" end
if not defaultvalue then defaultvalue = 0 end
if not maxamount then maxamount = 0 end
if not table.HasValue(resources, resource) then
table.insert(resources, resource)
end
if ent_table[ent:EntIndex( )] and ent_table[ent:EntIndex( )].ent == ent then
local index = ent_table[ent:EntIndex( )];
if index.resources[resource] then
if index.network ~= 0 then
nettable[index.network].resources[resource].maxvalue = nettable[index.network].resources[resource].maxvalue - index.resources[resource].maxvalue;
if nettable[index.network].resources[resource].value > nettable[index.network].resources[resource].maxvalue then
nettable[index.network].resources[resource].value = nettable[index.network].resources[resource].maxvalue;
end
end
else
index.resources[resource] = {}
end
index.resources[resource].maxvalue = maxamount
index.resources[resource].value = defaultvalue
index.resources[resource].haschanged = true
if index.network ~= 0 then
nettable[index.network].resources[resource].maxvalue = nettable[index.network].resources[resource].maxvalue + maxamount;
nettable[index.network].resources[resource].value = nettable[index.network].resources[resource].value + defaultvalue;
if nettable[index.network].resources[resource].value > nettable[index.network].resources[resource].maxvalue then
nettable[index.network].resources[resource].value = nettable[index.network].resources[resource].maxvalue;
nettable[index.network].resources[resource].haschanged = true
end
end
index.haschanged = true;
else
ent_table[ent:EntIndex()] = {}
local index = ent_table[ent:EntIndex( )];
index.resources = {}
index.resources[resource] = {}
index.resources[resource].maxvalue = maxamount;
index.resources[resource].value = defaultvalue;
index.network = 0;
index.clear = false
index.haschanged = false;
index.new = true;
index.ent = ent
end
return true
end
--[[
AddNetResource(Netid, resource, maximum amount, default value)
Add a resource to the network with the specified Netid, you can use this for any amount, but it's recomended to only call this if your entity can store resources (max amount > 0 )
Even if it requires multiple resources, registering the ones that can store resources is enough.
Note: If your device doesn't store anything just use RegisterNonStorageDevice instead of this, it's more optimized for it
]]
function RD.AddNetResource(netid, resource, maxamount, defaultvalue)
if not netid or not nettable[netid] then return false, "Not a valid Network ID" end
if not resource then return false, "No resource given" end
if not defaultvalue then defaultvalue = 0 end
if not maxamount then maxamount = 0 end
if maxamount < defaultvalue then defaultvalue = maxamount end
if not table.HasValue(resources, resource) then
table.insert(resources, resource)
end
local index = nettable[netid]
if not index.resources[resource] then
index.resources[resource] = {}
index.resources[resource].maxvalue = maxamount
index.resources[resource].value = defaultvalue
index.resources[resource].haschanged = true
index.haschanged = true
else
index.resources[resource].maxvalue = index.resources[resource].maxvalue + maxamount
index.resources[resource].value = index.resources[resource].value + defaultvalue
if index.resources[resource].value > index.resources[resource].maxvalue then
index.resources[resource].value = index.resources[resource].maxvalue
end
index.resources[resource].haschanged = true
index.haschanged = true
end
return true
end
--[[
ConsumeNetResource( netid, resource, amount)
Only use this if you got a special sent (like the Resource Pumps) which don't have direct netinfo stored
This means not Registered using RegisterNonStorageDevice() or Addresource(), one you used those you definetly don't need to use this one (except for special cases)
Returns the actual amount consumed!!
]]
function RD.ConsumeNetResource(netid, resource, amount)
if not nettable[netid] then return 0, "Not a valid network" end
if not resource then return 0, "No resource given" end
if not amount then return 0, "No amount given" end
local origamount = amount
local consumed = 0;
local index = {}
index.network = netid
if nettable[index.network] and nettable[index.network].resources and nettable[index.network].resources[resource] then
if nettable[index.network].resources[resource].maxvalue > 0 then
if nettable[index.network].resources[resource].value >= amount then
nettable[index.network].resources[resource].value = nettable[index.network].resources[resource].value - amount
nettable[index.network].resources[resource].haschanged = true
nettable[index.network].haschanged = true
elseif nettable[index.network].resources[resource].value > 0 then
amount = nettable[index.network].resources[resource].value
nettable[index.network].resources[resource].value = 0
nettable[index.network].resources[resource].haschanged = true
nettable[index.network].haschanged = true
else
amount = 0
end
consumed = amount
end
end
if consumed ~= origamount then
if table.Count(nettable[index.network].cons) > 0 then
for k, v in pairs(RD.getConnectedNets(index.network)) do
amount = origamount - consumed
if v ~= index.network then
if nettable[v] and nettable[v].resources and nettable[v].resources[resource] then
if nettable[v].resources[resource].maxvalue > 0 then
if nettable[v].resources[resource].value >= amount then
nettable[v].resources[resource].value = nettable[v].resources[resource].value - amount
nettable[v].resources[resource].haschanged = true
nettable[v].haschanged = true
elseif nettable[v].resources[resource].value > 0 then
amount = nettable[v].resources[resource].value
nettable[v].resources[resource].value = 0
nettable[v].resources[resource].haschanged = true
nettable[v].haschanged = true
else
amount = 0
end
consumed = consumed + amount
if (consumed >= origamount) then
break;
end
end
end
end
end
end
end
return consumed
end
--[[
ConsumeResource(entity, resource , amount)
Use this to consume resource (if you call this from inside the entity use self where the entity needs to be)
It will return the amount of resources actually consumed!!
]]
function RD.ConsumeResource(ent, resource, amount)
if not IsValid( ent ) then return 0, "Not a valid entity" end
if not resource then return 0, "No resource given" end
if not amount then return 0, "No amount given" end
local origamount = amount
local consumed = 0;
if ent_table[ent:EntIndex( )] then
local index = ent_table[ent:EntIndex( )];
if index.network == 0 then
if index.resources[resource] then
if index.resources[resource].maxvalue > 0 then
if index.resources[resource].value >= amount then
index.resources[resource].value = index.resources[resource].value - amount
index.resources[resource].haschanged = true
index.haschanged = true
elseif index.resources[resource].value > 0 then
amount = index.resources[resource].value
index.resources[resource].value = 0
index.resources[resource].haschanged = true
index.haschanged = true
end
consumed = amount;
end
end
else
consumed = RD.ConsumeNetResource(index.network, resource, amount)
end
end
return consumed;
end
--[[
SupplyNetResource(netid, resource, amount)
Only use this if you got a special sent (like the Resource Pumps) which don't have direct netinfo stored
This means not Registered using RegisterNonStorageDevice() or Addresource(), one you used those you definetly don't need to use this one (except for special cases)
Returns the amount of resources it couldn't supply to the network (lack of storage fe)
]]
function RD.SupplyNetResource(netid, resource, amount)
if not amount then return 0, "No amount given" end
if not nettable[netid] then return amount, "Not a valid network" end
if not resource then return amount, "No resource given" end
local index = {}
local left = amount
index.network = netid
if nettable[index.network] and nettable[index.network].resources and nettable[index.network].resources[resource] then
if nettable[index.network].resources[resource].maxvalue > nettable[index.network].resources[resource].value + amount then
nettable[index.network].resources[resource].value = nettable[index.network].resources[resource].value + amount
amount = 0;
nettable[index.network].haschanged = true
nettable[index.network].resources[resource].haschanged = true
elseif nettable[index.network].resources[resource].maxvalue > nettable[index.network].resources[resource].value then
amount = nettable[index.network].resources[resource].maxvalue - nettable[index.network].resources[resource].value
nettable[index.network].resources[resource].value = nettable[index.network].resources[resource].maxvalue
nettable[index.network].haschanged = true
nettable[index.network].resources[resource].haschanged = true
end
left = amount
end
if left > 0 then
if table.Count(nettable[index.network].cons) > 0 then
for k, v in pairs(RD.getConnectedNets(index.network)) do
amount = left
if v ~= index.network then
if nettable[v] and nettable[v].resources and nettable[v].resources[resource] then
if nettable[v].resources[resource].maxvalue > nettable[v].resources[resource].value + amount then
nettable[v].resources[resource].value = nettable[v].resources[resource].value + amount
amount = 0;
nettable[v].haschanged = true
nettable[v].resources[resource].haschanged = true
elseif nettable[v].resources[resource].maxvalue > nettable[v].resources[resource].value then
amount = nettable[v].resources[resource].maxvalue - nettable[v].resources[resource].value
nettable[v].resources[resource].value = nettable[v].resources[resource].maxvalue
nettable[v].haschanged = true
nettable[v].resources[resource].haschanged = true
end
left = amount
if left <= 0 then
break
end
end
end
end
end
end
return left
end
--[[
SupplyResource(entity, resource, amount)
Supplies the network connected to the specific Entity (mostly self) the specific amount of resources
Returns the amount of resources it couldn't store
]]
function RD.SupplyResource(ent, resource, amount)
if not amount then return 0, "No amount given" end
if not IsValid( ent ) then return amount, "Not a valid entity" end
if not resource then return amount, "No resource given" end
local left = 0;
if ent_table[ent:EntIndex( )] then
local index = ent_table[ent:EntIndex( )];
if index.network == 0 then
if index.resources[resource] then
if index.resources[resource].maxvalue > index.resources[resource].value + amount then
index.resources[resource].value = index.resources[resource].value + amount
index.haschanged = true
index.resources[resource].haschanged = true
amount = 0
elseif index.resources[resource].maxvalue > index.resources[resource].value then
amount = index.resources[resource].maxvalue - index.resources[resource].value
index.resources[resource].value = index.resources[resource].maxvalue
index.resources[resource].haschanged = true
index.haschanged = true
end
left = amount;
end
else
left = RD.SupplyNetResource(index.network, resource, amount)
end
end
return left;
end
--[[
Link(entity, netid)
This function connects the specific (valid) entity to the specific (valid) network
This is called by the Link tool(s)
]]
function RD.Link(ent, netid)
RD.Unlink(ent) --Just to be sure
if ent_table[ent:EntIndex( )] then
if nettable[netid] then
local index = ent_table[ent:EntIndex( )]
local netindex = nettable[netid]
for k, v in pairs(index.resources) do
local resindex = netindex.resources[k]
if not resindex then
netindex.resources[k] = {}
resindex = netindex.resources[k]
resindex.maxvalue = 0
resindex.value = 0
end
if index.resources[k].maxvalue > 0 then
resindex.maxvalue = resindex.maxvalue + index.resources[k].maxvalue
resindex.value = resindex.value + index.resources[k].value
end
resindex.haschanged = true
end
table.insert(netindex.entities, ent)
index.network = netid
index.haschanged = true
netindex.haschanged = true
end
end
end
--[[
Unlink(entity)
This function unlinks the device from it's network
This is called by the Link tool(s)
]]
function RD.Unlink(ent)
if ent_table[ent:EntIndex( )] then
local index = ent_table[ent:EntIndex( )]
if index.network ~= 0 then
if nettable[index.network] then
for k, v in pairs(index.resources) do
if index.resources[k].maxvalue > 0 then
local resindex = nettable[index.network].resources[k]
local percent = resindex.value / resindex.maxvalue
index.resources[k].value = index.resources[k].maxvalue * percent
resindex.maxvalue = resindex.maxvalue - index.resources[k].maxvalue
resindex.value = resindex.value - index.resources[k].value
index.resources[k].haschanged = true
resindex.haschanged = true
end
end
index.haschanged = true
nettable[index.network].haschanged = true
for k, v in pairs(nettable[index.network].entities) do
if v == ent then
table.remove(nettable[index.network].entities, k)
--remove beams
RD.Beam_clear( ent )
break
end
end
end
index.network = 0
end
end
end
--[[
UnlinkAllFromNode( netid)
This function disconnects all devices and network connection from the network with that specific netid
This is called by the Link tool(s)
]]
function RD.UnlinkAllFromNode(netid)
if nettable[netid] then
for k, v in pairs(nettable[netid].cons) do
--[[for l, w in pairs(nettable[v].cons) do
if w == netid then
table.remove(nettable[v].cons, l)
break
end
end
table.remove(nettable[netid].cons, k)]]
RD.UnlinkNodes(netid, v)
end
for l, w in pairs(nettable[netid].entities) do
RD.Unlink(w)
--table.remove(nettable[netid].entities, l)
end
--[[for l, w in pairs(nettable[netid].resources) do
w.value = 0
w.maxvalue = 0
w.haschanged = true
end]]
nettable[netid].haschanged = true
return true
end
return false
end
--[[
UnLinkNodes(netid, netid2)
This function will break the link between these 2 networks
This is called by the Link tool(s)
]]
function RD.UnlinkNodes(netid, netid2)
if nettable[netid] and nettable[netid2] then
for k, v in pairs(nettable[netid].cons) do
if v == netid2 then
table.remove(nettable[netid].cons, k)
end
end
for k, v in pairs(nettable[netid2].cons) do
if v == netid then
table.remove(nettable[netid2].cons, k)
end
end
nettable[netid].haschanged = true
nettable[netid2].haschanged = true
return true
end
return false
end
--[[
linkNodes(netid, netid2)
This function will create a link between these 2 networks
This is called by the Link tool(s)
]]
function RD.linkNodes(netid, netid2)
if netid and netid2 and netid == netid2 then return end
if nettable[netid] and nettable[netid2] then
if not table.HasValue(nettable[netid].cons, netid2) then
table.insert(nettable[netid].cons, netid2)
table.insert(nettable[netid2].cons, netid)
nettable[netid].haschanged = true
nettable[netid2].haschanged = true
return true
end
end
return false
end
--[[
nettable[netid] = {}
nettable[netid].resources = {}
nettable[netid].resources[resource] = {}
nettable[netid].resources[resource] .value = value
nettable[netid].resources[resource] .maxvalue = value
nettable[netid].resources[resource].haschanged = true/false
nettable[netid].entities = {}
nettable[netid].haschanged = true/false
nettable[netid].clear = true/false
nettable[netid].new = true/false
]]
--[[
CreateNetwork(entity)
Used to register a Resource Node with the system
Returns the id of the network
]]
function RD.CreateNetwork(ent)
local nextid = nextnetid
nextnetid = nextnetid + 1
nettable[nextid] = {}
local index = nettable[nextid]
index.resources = {}
index.entities = {}
index.cons = {}
index.haschanged = false
index.clear = false
index.new = true
index.nodeent = ent
return nextid
end
-- [[ Save Stuff - Testing]]
local function MySaveFunction( save )
print("Calling RD Save method")
local data = {
net = nettable,
ents = ent_table,
res_names = resourcenames,
res = resources
}
saverestore.WriteTable( data, save )
end
local function MyRestoreFunction( restore )
print("Calling RD Restore method");
local data = saverestore.ReadTable( restore )
PrintTable(data)
nettable = data.net;
ent_table = data.ents;
for k, v in pairs(nettable) do -- needed?
v.haschanged = true;
v.new = true;
end
for k, v in pairs(ent_table) do -- needed?
v.haschanged = true;
v.new = true;
end
resourcenames = data.res_names;
resources = data.res;
end
saverestore.AddSaveHook( "caf_rd_save", MySaveFunction )
saverestore.AddRestoreHook( "caf_rd_save", MyRestoreFunction )
--[[ Dupe Stuff]]
function RD.BuildDupeInfo( ent )
--save any beams
RD.Beam_dup_save( ent )
if ent.IsPump then
if ent.netid ~= 0 then
local nettable = RD.GetNetTable(ent.netid)
if nettable.nodeent then
local info = {}
info.node = nettable.nodeent:EntIndex()
duplicator.StoreEntityModifier( ent, "RDPumpDupeInfo", info )
end
end
return
end
if not ent.IsNode then return end
local nettable = RD.GetNetTable(ent.netid)
local info = {}
--info.resources = table.Copy(nettable.resources)
local entids = {}
if table.Count(nettable.entities) > 0 then
for k, v in pairs(nettable.entities) do
table.insert(entids, v:EntIndex())
end
end
local cons = {}
if table.Count(nettable.cons) > 0 then
for k, v in pairs(nettable.cons) do
local nettab = RD.GetNetTable(v)
if nettab and table.Count(nettab) > 0 and nettab.nodeent and IsValid(nettab.nodeent) then
table.insert(cons, nettab.nodeent:EntIndex())
end
end
end
info.entities = entids
info.cons = cons
if info.entities then
duplicator.StoreEntityModifier( ent, "RDDupeInfo", info )
end
end
--apply the DupeInfo
function RD.ApplyDupeInfo( ent, CreatedEntities )
if (ent.EntityMods) and (ent.EntityMods.RDDupeInfo) and (ent.EntityMods.RDDupeInfo.entities) then
local RDDupeInfo = ent.EntityMods.RDDupeInfo
if RDDupeInfo.entities and table.Count(RDDupeInfo.entities) > 0 then
for _,ent2ID in pairs(RDDupeInfo.entities) do
local ent2 = CreatedEntities[ ent2ID ]
if ent2 and ent2:IsValid() then
RD.Link(ent2, ent.netid)
end
end
end
if RDDupeInfo.cons and table.Count(RDDupeInfo.cons) > 0 then
for _,ent2ID in pairs(RDDupeInfo.cons) do
local ent2 = CreatedEntities[ ent2ID ]
if ent2 and ent2:IsValid() then
RD.linkNodes(ent.netid, ent2.netid)
end
end
end
ent.EntityMods.RDDupeInfo = nil --trash this info, we'll never need it again
elseif ent.EntityMods and ent.EntityMods.RDPumpDupeInfo and ent.EntityMods.RDPumpDupeInfo.node then
--This entity is a pump and has a network to connect to
local ent2 = CreatedEntities[ ent.EntityMods.RDPumpDupeInfo.node ] --Get the new node entity
if ent2 then
ent:SetNetwork(ent2.netid)
ent:SetResourceNode(ent2)
end
end
--restore any beams
RD.Beam_dup_build( ent, CreatedEntities )
end
--[[ Shared stuff ]]
function RD.getConnectedNets(netid)
local contable = {}
local tmpcons = { netid}
while(table.Count(tmpcons) > 0) do
for k, v in pairs(tmpcons) do
if not table.HasValue(contable, v) then
table.insert(contable, v)
if nettable[v] and nettable[v].cons then
if table.Count(nettable[v].cons) > 0 then
for l, w in pairs(nettable[v].cons) do
table.insert(tmpcons, w)
end
end
end
end
table.remove(tmpcons, k)
end
end
return contable
end
function RD.GetNetResourceAmount(netid, resource)
if not nettable[netid] then return 0, "Not a valid network" end
if not resource then return 0, "No resource given" end
local amount = 0
local index = {}
index.network = netid
if table.Count(nettable[index.network].cons) > 0 then
for k, v in pairs(RD.getConnectedNets(index.network)) do
if nettable[v] and nettable[v].resources and nettable[v].resources[resource] then
amount = amount + nettable[v].resources[resource].value
end
end
else
if nettable[index.network].resources[resource] then
amount = nettable[index.network].resources[resource].value
end
end
return amount
end
function RD.GetResourceAmount(ent, resource)
if not IsValid( ent ) then return 0, "Not a valid entity" end
if not resource then return 0, "No resource given" end
local amount = 0
if ent_table[ent:EntIndex( )] then
local index = ent_table[ent:EntIndex( )];
if index.network == 0 then
if index.resources[resource] then
amount = index.resources[resource].value
end
else
amount = RD.GetNetResourceAmount(index.network, resource)
end
end
return amount
end
function RD.GetUnitCapacity(ent, resource)
if not IsValid( ent ) then return 0, "Not a valid entity" end
if not resource then return 0, "No resource given" end
local amount = 0
if ent_table[ent:EntIndex( )] then
local index = ent_table[ent:EntIndex( )];
if index.resources[resource] then
amount = index.resources[resource].maxvalue
end
end
return amount
end
function RD.GetNetNetworkCapacity(netid, resource)
if not nettable[netid] then return 0, "Not a valid Network" end
if not resource then return 0, "No resource given" end
local amount = 0
local index = {}
index.network = netid
if table.Count(nettable[index.network].cons) > 0 then
for k, v in pairs(RD.getConnectedNets(index.network)) do
if nettable[v] and nettable[v].resources and nettable[v].resources[resource] then
amount = amount + nettable[v].resources[resource].maxvalue
end
end
else
if nettable[index.network].resources[resource] then
amount = nettable[index.network].resources[resource].maxvalue
end
end
return amount
end
function RD.GetNetworkCapacity(ent, resource)
if not IsValid( ent ) then return 0, "Not a valid entity" end
if not resource then return 0, "No resource given" end
local amount = 0
if ent_table[ent:EntIndex( )] then
local index = ent_table[ent:EntIndex( )];
if index.network == 0 then
if index.resources[resource] then
amount = index.resources[resource].maxvalue
end
else
amount = RD.GetNetNetworkCapacity(index.network, resource)
end
end
return amount
end
function RD.GetEntityTable(ent)
local entid = ent:EntIndex( )
return ent_table[entid] or {}
end
function RD.GetNetTable(netid)
return nettable[netid] or {}
end
function RD.AddProperResourceName(resource, name)
if not resource or not name then return end
if not table.HasValue(resources, resource) then
table.insert(resources, resource)
end
resourcenames[resource] = name
end
function RD.GetProperResourceName(resource)
if not resource then return "" end
if resourcenames[resource] then
return resourcenames[resource]
end
return resource
end
function RD.GetAllRegisteredResources()
if not resourcenames or table.Count(resourcenames) < 0 then
return {}
end
return table.Copy(resourcenames)
end
function RD.GetRegisteredResources()
return table.Copy(resources)
end
function RD.GetNetworkIDs()
local ids = {}
if table.Count(nettable) > 0 then
for k, v in pairs(nettable) do
if not v.clear then
table.insert(ids, k)
end
end
end
return ids
end
function RD.PrintDebug(ent)
if ent then
if ent.IsNode then
local nettable = RD.GetNetTable(ent.netid)
PrintTable(nettable)
elseif ent.IsValve then
--
elseif ent.IsPump then
--
else
local enttable = RD.GetEntityTable(ent)
PrintTable(enttable)
end
end
end
-----------------------------------------
--START BEAMS BY MADDOG
-----------------------------------------
--Name: RD.Beam_settings
--Desc: Sends beam info to the clientside.
--Args:
-- beamMaterial - the material to use (defualt cable/cable2)
-- beamSize - the size of the beam, design 2
-- beamColor - the beam color (default: Color(255, 255, 255, 255)
function RD.Beam_settings( ent, beamMaterial, beamSize, beamColor )
--get beam color
local beamR, beamG, beamB, beamA = beamColor.R or 255, beamColor.G or 255, beamColor.B or 255, beamColor.A or 255
--send beam info to ent/clientside
ent:SetNWString( "BeamInfo", ((beamMaterial or "cable/cable2") .. ";" .. tostring(beamSize or 2) .. ";" .. tostring(beamR or 255) .. ";" .. tostring(beamG or 255) .. ";" .. tostring(beamB or 255) .. ";" .. tostring(beamA or 255)) )
end
--Name: RD.Beam_add
--Desc: Add a beam to a ent
--Args:
-- sEnt: The ent to save the beam to
-- eEnt: The entity to base the vector off
-- beamVec: The local vector (based on eEnt) to place the beam
function RD.Beam_add(sEnt, eEnt, beamVec)
--get how many beams there currently are
local iBeam = (sEnt:GetNWInt( "Beams" ) or 0) + 1
--send beam data
--clicked entity
sEnt:SetNWEntity( "BeamEnt" .. tostring(iBeam), eEnt )
--clicked local vector
sEnt:SetNWVector( "Beam" .. tostring(iBeam), beamVec or Vector(0, 0, 0) )
--how many beams (points)
sEnt:SetNWInt( "Beams", iBeam )
end
--Name: RD.Beam_switch
--Desc: Switches the beam settings from one ent to another.
--Args:
-- Ent1: The ent to get the current beams from
-- Ent2: Where to send the beam settings to
function RD.Beam_switch( Ent1, Ent2 )
--transfer beam data
Ent2:SetNWString( "BeamInfo", Ent1:GetNWString( "BeamInfo" ))
--loop through all beams
for i=1, Ent1:GetNWInt( "Beams" ) do
--transfer beam data
Ent2:SetNWVector("Beam"..tostring(i), Ent1:GetNWVector( "Beam"..tostring(i) ))
Ent2:SetNWEntity("BeamEnt"..tostring(i), Ent1:GetNWEntity( "BeamEnt" .. tostring(i) ))
end
--how many beam points
Ent2:SetNWInt( "Beams", Ent1:GetNWInt( "Beams" ) )
--set beams to zero
Ent1:SetNWInt( "Beams", 0 )
end
--Name: RD.Beam_clear
--Desc: Sets beams to zero to stop from them rendering
--Args:
-- ent - the ent to clean the beams from
function RD.Beam_clear( ent )
ent:SetNWInt( "Beams", 0 )
end
--Name: Rd.Beam_get_table
--Desc: Used to return a table of beam info for adv dup support
--Args:
-- ent - the ent to get the beam info from
function RD.Beam_dup_save( ent )
--the table to return
local beamTable = {}
--amount of beams to draw
beamTable.Beams = ent:GetNWInt( "Beams" )
--if we have beams, then create them
if beamTable.Beams and beamTable.Beams ~= 0 then
--store beam info
beamTable.BeamInfo = ent:GetNWString("BeamInfo")
--loop through all beams
for i=1,beamTable.Beams do
--store beam vector
beamTable["Beam" .. tostring(i)] = ent:GetNWVector( "Beam" .. tostring(i) )
--store beam entity
beamTable["BeamEnt" .. tostring(i)] = ent:GetNWEntity( "BeamEnt" .. tostring(i) ):EntIndex()
end
else
return --no beams to save
end
--store beam table into duplicator
duplicator.StoreEntityModifier( ent, "RDBeamDupeInfo", beamTable )
end
--Name: Rd.Beam_set_table
--Desc: Sets beams from a table
--Args:
-- ent - the ent to get the beam info from
function RD.Beam_dup_build( ent, CreatedEntities )
--exit if no beam dup info
if not ent.EntityMods or not ent.EntityMods.RDBeamDupeInfo then return end
--get the beam info table
local beamTable = ent.EntityMods.RDBeamDupeInfo
--transfer beam data
ent:SetNWString( "BeamInfo", beamTable.BeamInfo)
--loop through all beams
for i=1, beamTable.Beams do
--transfer beam data
ent:SetNWVector("Beam"..tostring(i), beamTable["Beam"..tostring(i) ])
ent:SetNWEntity("BeamEnt"..tostring(i), CreatedEntities[ beamTable[ "BeamEnt" .. tostring(i) ] ])
end
--how many beam points
ent:SetNWInt( "Beams", beamTable.Beams )
end
-----------------------------------------
--END BEAMS BY MADDOG
-----------------------------------------
--Alternate use code--
local hookcount = 0
function InputFromClientMenu(ply, cmd, args) --This is essentially a controlled ent_fire...I probably overcomplicated it a fuckton right there just too add in that 4th argument. T_T
local ent = ents.GetByIndex(args[1])
if not ent or (ent:GetPos():Distance(ply:GetPos()) > 750) then ply:ChatPrint("You cannot perform that action.") return end
if not ent.InputsBeingTriggered then ent.InputsBeingTriggered = {} end
local input = args[2]
if not ent.InputsBeingTriggered[input] then ent.InputsBeingTriggered[input] = {} end
local valuez = args[3]
if args[4] and ent.InputsBeingTriggered[input].bool and ent.InputsBeingTriggered[input].bool == true and ent.InputsBeingTriggered[input].value and ent.InputsBeingTriggered[input].value == valuez and ent.InputsBeingTriggered[input].EndTime and ent.InputsBeingTriggered[input].EndTime == CurTime() + args[4] then return end
if ent.InputsBeingTriggered[input].hooknum then hook.Remove("Think","ButtonHoldThinkNumber"..ent.InputsBeingTriggered[input].hooknum) end
if not args[4] or (args[4] and tonumber(args[4]) == 0) then
ent:TriggerInput(input,tonumber(valuez))
elseif tonumber(args[4]) == -1 then
hook.Add("Think","ButtonHoldThinkNumber"..hookcount,function() if ent and ent:IsValid() then ent:TriggerInput(input,tonumber(valuez)) end end)
ent.InputsBeingTriggered[input].bool = true
ent.InputsBeingTriggered[input].value=valuez
ent.InputsBeingTriggered[input].hooknum = hookcount
ent.InputsBeingTriggered[input].EndTime = 0
hookcount = hookcount + 1
else
hook.Add("Think","ButtonHoldThinkNumber"..hookcount,function() if ent and ent:IsValid() then ent:TriggerInput(input,tonumber(valuez)) end end)
ent.InputsBeingTriggered[input].bool = true
ent.InputsBeingTriggered[input].value=valuez
ent.InputsBeingTriggered[input].hooknum = hookcount
ent.InputsBeingTriggered[input].EndTime = CurTime()+args[4]
timer.Simple(tonumber(args[4]),function() hook.Remove("Think","ButtonHoldThinkNumber"..hookcount) ent.InputsBeingTriggered[input].bool = false end)
hookcount = hookcount + 1
end
end
concommand.Add("send_input_selection_to_server", InputFromClientMenu)
function SwapUsage(ply,cmd,args)
if not ply.useaction then ply.useaction = false end
ply.useaction = not ply.useaction
end
concommand.Add("RD_swap_use_key", SwapUsage)
|
vim.opt.expandtab = true
|
--------------------------------
-- @module BillBoard
-- @extend Sprite
-- @parent_module cc
--------------------------------
-- Get the billboard rotation mode.
-- @function [parent=#BillBoard] getMode
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- Set the billboard rotation mode.
-- @function [parent=#BillBoard] setMode
-- @param self
-- @param #int mode
--------------------------------
-- @overload self, string, int
-- @overload self, int
-- @overload self, string, rect_table, int
-- @function [parent=#BillBoard] create
-- @param self
-- @param #string filename
-- @param #rect_table rect
-- @param #int mode
-- @return BillBoard#BillBoard ret (retunr value: cc.BillBoard)
--------------------------------
-- Creates a BillBoard with a Texture2D object.<br>
-- After creation, the rect will be the size of the texture, and the offset will be (0,0).<br>
-- param texture A pointer to a Texture2D object.<br>
-- return An autoreleased BillBoard object
-- @function [parent=#BillBoard] createWithTexture
-- @param self
-- @param #cc.Texture2D texture
-- @param #int mode
-- @return BillBoard#BillBoard ret (return value: cc.BillBoard)
return nil
|
return {
tag = 'graphicsTransforms',
summary = 'Reset the coordinate system.',
description = 'Resets the transformation to the origin.',
arguments = {},
returns = {},
notes = 'This is called at the beginning of every frame to reset the coordinate space.'
}
|
do
local function It(a) return { __tag = "It", a } end
local function Mk(a) return { __tag = "Mk", a } end
local function Foo(tmp) return tmp end
(nil)(Foo);
(nil)(function(tmp) return tmp end);
(nil)(It);
(nil)(Mk)
end
|
include("shared.lua")
ENT.RenderGroup = RENDERGROUP_BOTH
surface.CreateFont( "CivDrinkFont", {
font = "Nexa Light", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
size = 75,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
local civBackground = Material("blues-bar/civbackdrop.png","noclamp smooth")
local faces = {
Material("blues-bar/angry.png","noclamp smooth"),
Material("blues-bar/neutral.png","noclamp smooth"),
Material("blues-bar/happy.png","noclamp smooth"),
Material("blues-bar/veryhappy.png","noclamp smooth"),
}
function ENT:Draw()
self:DrawModel()
if self.scaleTime == nil then
self.scaleTime = 0
self.scale = self:GetModelScale()
self.alpha = 0
self.face = math.random(1,4)
end
if self:GetIsDying() then
self.scaleTime = self.scaleTime - FrameTime()
self.alpha = self.scaleTime * 255
self:SetModelScale(berp(self.scaleTime,0 , self.scale))
else
if self.scaleTime < 1 then
self:SetModelScale(berp(self.scaleTime,0 , self.scale))
self.scaleTime = self.scaleTime + (FrameTime() / 1)
self.alpha = self.scaleTime * 255
end
end
if self:GetIsDying() ~= true then
self:GetGlass():DrawModel()
end
--Draw Cam2D3D HERE
local ang = Angle(-90,0,0) + Angle(90 , self:GetAngles().y - 270, 90)
cam.Start3D2D(self:GetPos() + Vector(0,0,100) , ang, 0.045)
surface.SetMaterial(civBackground)
surface.SetDrawColor(255,255,255,self.alpha)
surface.DrawTexturedRect(-256 , 0 , 1024/2 , 1124/2)
draw.SimpleText(self:GetWantedDrink() , "CivDrinkFont",0 , 20,Color(30,30,30 , self.alpha),1,0)
surface.SetMaterial(faces[self:GetEmotion()])
surface.SetDrawColor(255,255,255,self.alpha)
surface.DrawTexturedRect(-350 / 2 , 100 , 350,350)
cam.End3D2D()
end
function berp(v ,s, e)
v = math.Clamp(v , 0 ,1)
v = (math.sin(v * math.pi * (0.2 + 2.5 * v * v * v)) * math.pow(1 - v, 2.2) + v) * (1 + (1.2 * (1 - v)))
return v
end
function ENT:SetRagdollBones( b )
self.m_bRagdollSetup = b
end
function ENT:DrawTranslucent()
self:Draw()
end
|
local t = Def.ActorFrame{};
-- a row
t[#t+1] = Def.Quad {
OnCommand=function(self)
self:zoomto(_screen.w*0.85,_screen.h*0.0625)
end;
};
return t;
|
-- Misc. Constants
WQ_MOD_NAME = "WoWQuote";
WQ_VERSION = "0.8.5";
WQ_MEDIA_PATH = "Interface\\AddOns\\"..WQ_MOD_NAME.."\\media\\";
WQ_DEFAULT_MEDIA_TYPE = ".mp3";
WQ_MIN_SOUND_DELAY = 3;
WQ_MAX_ALIAS_LEN = 20;
WQ_MIN_SEARCH_LEN = 3;
-- Private Vars
local playerName = UnitName("player");
-- Public Vars
WQSoundTimer = time();
-- Variables to save
WQ_SETTINGS = {};
WQ_SETTINGS.broadcast = {
["CHAT_MSG_SAY"] = true,
["CHAT_MSG_PARTY"] = true,
["CHAT_MSG_RAID"] = true,
["CHAT_MSG_RAID_LEADER"] = true,
["CHAT_MSG_GUILD"] = true,
["CHAT_MSG_OFFICER"] = true
};
WQ_SETTINGS.aliases = {};
function WQ_Init()
WQ_Print(string.format(WQ_MSG["msg_loaded"],WQ_MOD_NAME,WQ_VERSION));
SlashCmdList["WQ"] = WQ_ShowUI;
SLASH_WQ1 = "/wq";
SlashCmdList["WQHELP"] = WQ_Help;
SLASH_WQHELP1 = "/wqh";
SLASH_WQHELP2 = "/wqh";
SlashCmdList["WQBROADCAST"] = WQ_SetChannel;
SLASH_WQBROADCAST1 = "/wqb";
SLASH_WQBROADCAST2 = "/wqbroadcast";
SlashCmdList["WQSAY"] = WQ_Say;
SLASH_WQSAY1 = "/wqs";
SLASH_WQSAY2 = "/wqsay";
SlashCmdList["WQPARTY"] = WQ_Party;
SLASH_WQPARTY1 = "/wqp";
SLASH_WQPARTY2 = "/wqparty";
SlashCmdList["WQRAID"] = WQ_Raid;
SLASH_WQRAID1 = "/wqr";
SLASH_WQRAID2 = "/wqraid";
SlashCmdList["WQGUILD"] = WQ_Guild;
SLASH_WQGUILD1 = "/wqg";
SLASH_WQGUILD2 = "/wqguild";
SlashCmdList["WQOFFICER"] = WQ_Officer;
SLASH_WQOFFICER1 = "/wqo";
SLASH_WQOFFICER2 = "/wqofficer";
SlashCmdList["WQLIST"] = WQ_List;
SLASH_WQLIST1 = "/wql";
SLASH_WQLIST2 = "/wqlist";
SlashCmdList["WQCATEGORY"] = WQ_CatList;
SLASH_WQCATEGORY1 = "/wqc";
SLASH_WQCATEGORY2 = "/wqcategory";
SlashCmdList["WQALIAS"] = WQ_Alias;
SLASH_WQALIAS1 = "/wqa";
SLASH_WQALIAS2 = "/wqalias";
SlashCmdList["WQFIND"] = WQ_Find;
SLASH_WQFIND1 = "/wqf";
SLASH_WQFIND2 = "/wqfind";
WQ_HandleSettings();
end
function WQ_MsgSort(a,b)
return WQmedia[a].msg < WQmedia[b].msg;
end
function WQ_IndexByMsg(category)
local indexlist = {};
local nr = {};
for k,v in pairs(WQmedia) do
if (v.cat == category) then
table.insert(indexlist,k);
end
end
table.sort(indexlist,WQ_MsgSort);
return indexlist;
end
function WQ_HandleSettings()
if (WQ_SETTINGS.broadcast["CHAT_MSG_RAID"] == true) then
WQ_SETTINGS.broadcast["CHAT_MSG_RAID_LEADER"] = true;
else
WQ_SETTINGS.broadcast["CHAT_MSG_RAID_LEADER"] = false;
end
for k,v in pairs(WQ_SETTINGS.broadcast) do
if v == true then
WQ:RegisterEvent(k);
else
WQ:UnregisterEvent(k);
end
end
end
function WQ_OnEvent(event, arg1, arg2, arg3)
if (event == "ADDON_LOADED" and arg1 == WQ_MOD_NAME) then
WQ_Init();
end
if (arg1~=nil and arg2~=nil and arg2~=playerName) then
local i,v = WQ_CatchMedia(event,arg1);
if ( i ~= nil and type(v)=="table" ) then
WQ_Play(i);
end
end
end
function WQ_SetChannel(cmd)
if (tostring(cmd) == "") then
WQ_Print(string.format(WQ_MSG["msg_conf_title"],WQ_MOD_NAME));
WQ_PrintTable(WQ_ShowSettings("broadcast"),true);
return;
end
local arg1,arg2 = WQ_GetCmd(cmd);
local chan = string.find(arg1,"[sprgo]");
if (chan == nil) then
WQ_Msg("err_miss_channel");
return;
end
if (strlower(tostring(arg2))~="on" and strlower(tostring(arg2))~="off") then
WQ_Msg("err_miss_switch");
return;
end
if (arg2=="off") then
WQ_SETTINGS.broadcast[WQChannels[arg1].event] = false;
WQ_Msg("msg_chan_off",WQChannels[arg1].name);
WQ:UnregisterEvent(WQChannels[arg1].event);
if (arg1 == "r") then
WQ_SETTINGS.broadcast["CHAT_MSG_RAID_LEADER"] = false;
WQ:UnregisterEvent("CHAT_MSG_RAID_LEADER");
end
else
WQ_SETTINGS.broadcast[WQChannels[arg1].event] = true;
WQ_Msg("msg_chan_on",WQChannels[arg1].name);
if (arg1 == "r") then
WQ_SETTINGS.broadcast["CHAT_MSG_RAID_LEADER"] = true;
WQ:RegisterEvent("CHAT_MSG_RAID_LEADER");
end
WQ:RegisterEvent(WQChannels[arg1].event);
end
end
function WQ_ShowSettings(s)
local tab = {};
if (s == "broadcast") then
local chans = {"s","p","r","g","o"};
local sw;
for k,v in pairs(chans) do
if (WQ_SETTINGS.broadcast[WQChannels[v]["event"]] == true) then
sw = "on";
else
sw = "off";
end
tab[WQChannels[v]["name"]] = sw;
end
end
return tab;
end
function WQ_CatchMedia(event,str)
local pattern = WQ_get_pattern(str,"%(~[%w]*~%)");
if pattern ~= nil then
return WQ_GetMedia(pattern);
end
return nil;
end
function WQ_get_pattern(text,pattern)
local i, j = string.find(text,pattern);
if (i~=nil and j~=nil) then
local s = string.sub(text,i,j);
return string.gsub(s,"[~%(%)]","");
else
return nil;
end
end
function WQ_GetMedia(key)
if ( type(WQmedia[tonumber(key)]) == "table" ) then
return tonumber(key),WQmedia[tonumber(key)];
end
for i,v in pairs(WQmedia) do
if (v.id == key) then
return i,v;
end
end
return nil,nil;
end
function WQ_Play(id)
local delay = WQ_MIN_SOUND_DELAY;
if (type(WQmedia[id].len)=="number") then
delay = WQmedia[id].len;
end
if (time() >= WQSoundTimer) then
WQSoundTimer = time()+delay;
local file = WQ_MEDIA_PATH .. WQmedia[id].file;
PlaySoundFile(file);
end
end
function WQ_Send(id,system)
local i;
if (id == nil or WQ_trim(id) == "" ) then
return;
end
i = WQ_GetIDbyAlias(id);
if (i == nil) then
i = (WQ_GetMedia(id));
end;
if (i == nil) then
WQ_NotFound(id);
return;
end
local msg = "[ " .. WQmedia[i].msg .. " ] (~" .. i .. "~)";
SendChatMessage(msg,system);
WQ_Play(i);
end
function WQ_Say(id) WQ_Send(id,"SAY"); end
function WQ_Guild(id) WQ_Send(id,"GUILD"); end
function WQ_Officer(id) WQ_Send(id,"OFFICER"); end
function WQ_Party(id) WQ_Send(id,"PARTY"); end
function WQ_Raid(id) WQ_Send(id,"RAID"); end
function WQ_NotFound(id)
WQ_Msg("err_quote_not_found",id);
PlaySound("TellMessage");
end
function WQ_Print(msg)
DEFAULT_CHAT_FRAME:AddMessage(msg,0.5,0.5,0.9);
end
function WQ_Msg(msg,p1,p2,p3)
WQ_Print(WQ_MOD_NAME .. ": " .. string.format(WQ_MSG[msg],p1,p2,p3));
end
function WQ_Find(str)
if str ~= nil then
str = WQ_trim(string.lower(str));
end;
if string.len(str) < WQ_MIN_SEARCH_LEN then
WQ_Msg("err_search_len",WQ_MIN_SEARCH_LEN);
return;
end;
local found=0;
for k,v in pairs(WQcategories) do
found = found + WQ_List(k,str);
end;
WQ_Msg("msg_search_count",found);
end;
function WQ_Alias(cmd)
local id,alias = WQ_GetCmd(cmd);
if (id == nil or WQ_trim(id) == "") then
WQ_Msg("err_no_alias_id");
return;
end
local i = (WQ_GetMedia(id));
if (i == nil) then
WQ_NotFound(id);
return;
end
if (alias == nil or WQ_trim(alias) == "") then
if (type(WQ_SETTINGS.aliases[i])=="string") then
WQ_SETTINGS.aliases[i] = nil;
WQ_Msg("msg_alias_disabled",id);
else
WQ_Msg("err_alias_not_found",id);
end;
return;
end
if alias ~= nil and alias ~= "" and string.len(alias)<WQ_MAX_ALIAS_LEN and string.find(alias,'^[%a]+[%w]*$') ~= nil then
alias = string.lower(alias);
WQ_SETTINGS.aliases[i] = alias;
WQ_Msg("msg_alias_set",id,alias);
return;
else
WQ_Msg("err_wrong_alias");
end
end
function WQ_GetIDbyAlias(alias)
for k,v in pairs(WQ_SETTINGS.aliases) do
if (v == alias) then
return k;
end;
end;
return nil;
end
function WQ_Help()
WQ_PrintTable(WQ_HELP);
end
function WQ_PrintTable(t,show)
for i,v in pairs(t) do
local msg = "|cff7090ff" .. v;
if (show) then
msg = "|cffffffff" .. i .. " : " .. msg;
end
DEFAULT_CHAT_FRAME:AddMessage(msg,0.5,0.5,0.9);
end
end
function WQ_CatList()
WQ_Print(string.format(WQ_MSG["msg_cat_title"],WQ_MOD_NAME));
WQ_PrintTable(WQcategories,true);
end
function WQ_List(cmd,search)
local cat = tonumber(cmd);
local alias = "";
local found = 0;
if (WQcategories[cat] == nil) then
WQ_Msg("err_cat_id");
return;
end
if (search == nil) then
WQ_Print(string.format(WQ_MSG["msg_qlist_title"],WQ_MOD_NAME,WQcategories[cat]));
end;
for k,v in pairs(WQ_IndexByMsg(cat)) do
if (type(WQ_SETTINGS.aliases[v])=="string") then
alias = ", " .. WQ_SETTINGS.aliases[v] .. " ";
else
alias = "";
end;
if (search ~= nil) then
local f = (string.find(string.lower(WQmedia[v].msg), search));
if f ~= nil then
DEFAULT_CHAT_FRAME:AddMessage("|cffffffff" .. WQmedia[v].id .. alias .. " : |cff7090ff" .. WQmedia[v].msg,0.5,0.5,0.9);
found = found + 1;
end;
else
DEFAULT_CHAT_FRAME:AddMessage("|cffffffff" .. WQmedia[v].id .. alias .. " : |cff7090ff" .. WQmedia[v].msg,0.5,0.5,0.9);
end;
end
return found;
end
function WQ_GetCmd(msg)
if (msg) then
local a,b=string.find(msg, "[^%s]+");
if (not ((a==nil) and (b==nil))) then
local cmd=string.lower(string.sub(msg,a,b));
return cmd, string.sub(msg,string.find(cmd,"$")+1);
else
return "";
end;
end;
end;
function WQ_GetArgument(msg)
if (msg) then
local a,b=string.find(msg, "[^=]+");
if (not ((a==nil) and (b==nil))) then
local cmd=string.lower(string.sub(msg,a,b));
return cmd, string.sub(msg, string.find(cmd,"$")+1);
else
return "";
end;
end;
end;
function WQ_trim(s)
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
end
function WQ_ShowUI()
WQUI:Toggle();
end
|
local abs = math.abs
local format = string.format
local insert = table.insert
local path = string.gsub(..., "[^.]+$", "")
local Base = require(path.."Base")
local Expression = require(path.."Expression")
local util = require(path.."util")
local signs = util.signs
local Preproc = Base:extend()
function Preproc:init(options)
self.options = options or {}
end
function Preproc:error(msg, got)
if got ~= nil then
msg = msg..', got '..tostring(got)
end
error(format('%s:%d: Error: %s', self.fn, self.line, msg), 2)
end
function Preproc:iter(statements)
assert(statements)
local i = 0
return function()
i = i + 1
local s = statements[i]
if s == nil then return end
self.i = i
self.s = s
self.fn = s.fn
self.line = s.line
return s
end
end
function Preproc:lookup(t)
if t.tt == 'VARSYM' then
local name = t.tok
t.tt = 'NUM'
t.tok = self.variables[name]
if t.tok == nil then
self:error('undefined variable', name)
end
end
end
function Preproc:resolve(t)
if t.tt == 'RELLABEL' then
t.tt = 'LABEL'
-- exploits the fact that user labels can't begin with a number
local name = t.tok:sub(2)
t.tok = tostring(self.i)..name
elseif t.tt == 'RELLABELSYM' then
local i = self.i
t.tt = 'LABELSYM'
local rel = signs(t.tok)
assert(rel ~= 0, 'Internal Error: relative label without signs')
local name = t.tok:sub(abs(rel) + 1)
local seen = 0
-- TODO: don't iterate over *every* label, just the ones nearby.
-- we could do this by popping labels as we pass over them.
-- (would need to iterate once forwards and once backwards
-- for plus and minus labels respectively)
if rel > 0 then
for _, rl in ipairs(self.plus_labels) do
if rl.name == name and rl.index > i then
seen = seen + 1
if seen == rel then
t.tok = tostring(rl.index)..name
break
end
end
end
else
for _, rl in ipairs(self.minus_labels) do
if rl.name == name and rl.index < i then
seen = seen - 1
if seen == rel then
t.tok = tostring(rl.index)..name
break
end
end
end
end
if seen ~= rel then
self:error('could not find appropriate relative label', t.tok)
end
end
end
function Preproc:check(s, i, tt)
local t = s[i]
if t == nil then
local err = ("expected another argument for %s at position %i"):format(self.s.type, self.i)
self:error(err)
end
if t.tt ~= tt then
local err = ("argument %i of %s expected type %s"):format(i, s.type, tt)
self:error(err, t.tt)
end
return t.tok
end
function Preproc:evaluate(t)
if t.tt == 'EXPR' then
local result, err = self.expr:eval(t.tok)
if err then
self:error('failed to evaulate ('..t.tok..')', err)
end
t.tt = 'NUM'
t.tok = result
end
self:lookup(t)
end
function Preproc:process(statements)
self.variables = {}
self.plus_labels = {} -- constructed forwards
self.minus_labels = {} -- constructed backwards
self.expr = Expression(self.variables)
-- first pass: resolve variables and collect relative labels
local new_statements = {}
for s in self:iter(statements) do
for j, t in ipairs(s) do
self:evaluate(t)
end
if s.type == '!VAR' then
local a = self:check(s, 1, 'VAR')
local b = self:check(s, 2, 'NUM')
self.variables[a] = b
elseif s.type == '!LABEL' then
if s[1].tt == 'RELLABEL' then
local label = s[1].tok
local rl = {
index = #new_statements + 1,
name = label:sub(2)
}
local c = label:sub(1, 1)
if c == '+' then
insert(self.plus_labels, rl)
elseif c == '-' then
insert(self.minus_labels, 1, rl) -- remember, it's backwards
else
error('Internal Error: unexpected token for relative label')
end
end
insert(new_statements, s)
else
insert(new_statements, s)
end
end
-- second pass: resolve relative labels
for s in self:iter(new_statements) do
for j, t in ipairs(s) do
self:resolve(t)
end
end
return new_statements
end
return Preproc
|
function Auctionator.Utilities.StringJoin(array, delimiter)
local result = ""
for index, item in ipairs(array) do
if index == #array then
result = result .. item
else
result = result .. item .. delimiter
end
end
return result
end
|
object_tangible_gcw_crafting_quest_gcw_heat_resistant_wiring = object_tangible_gcw_crafting_quest_shared_gcw_heat_resistant_wiring:new {
}
ObjectTemplates:addTemplate(object_tangible_gcw_crafting_quest_gcw_heat_resistant_wiring, "object/tangible/gcw/crafting_quest/gcw_heat_resistant_wiring.iff")
|
--爱莎-窒息的痛楚
function c60150817.initial_effect(c)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,60150817)
e2:SetCondition(c60150817.spcon)
e2:SetOperation(c60150817.spop)
c:RegisterEffect(e2)
--xyz limit
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
e4:SetValue(c60150817.xyzlimit)
c:RegisterEffect(e4)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(60150817,1))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,60150817)
e1:SetTarget(c60150817.sptg2)
e1:SetOperation(c60150817.spop2)
c:RegisterEffect(e1)
end
function c60150817.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(Card.IsAbleToDeckOrExtraAsCost,tp,LOCATION_REMOVED,LOCATION_REMOVED,2,nil)
end
function c60150817.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(60150817,0))
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeckOrExtraAsCost,tp,LOCATION_REMOVED,LOCATION_REMOVED,2,2,nil)
Duel.SendtoDeck(g,nil,2,REASON_COST)
end
function c60150817.xyzlimit(e,c)
if not c then return false end
return not (c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_SPELLCASTER))
end
function c60150817.filter(c,e,tp)
return c:IsSetCard(0x3b23) and c:IsType(TYPE_MONSTER) and c:IsAttribute(ATTRIBUTE_DARK)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c60150817.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c60150817.filter,tp,LOCATION_DECK,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_DECK,LOCATION_DECK,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c60150817.spop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c60150817.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
local tc=g:GetFirst()
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
--xyz limit
local e4=Effect.CreateEffect(e:GetHandler())
e4:SetDescription(aux.Stringid(60150822,0))
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CLIENT_HINT)
e4:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
e4:SetReset(RESET_EVENT+0xfe0000)
e4:SetValue(c60150817.xyzlimit)
tc:RegisterEffect(e4)
Duel.SpecialSummonComplete()
Duel.BreakEffect()
local c=e:GetHandler()
local res=0
res=Duel.TossCoin(tp,1)
if res==0 then
local g=Duel.GetFieldCard(tp,LOCATION_DECK,0)
Duel.DisableShuffleCheck()
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
if res==1 then
local g=Duel.GetFieldCard(1-tp,LOCATION_DECK,0)
Duel.DisableShuffleCheck()
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
end
end
|
--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
ActionsManager.registerModHandler("ability", modRoll);
ActionsManager.registerResultHandler("ability", onRoll);
end
function performPartySheetRoll(draginfo, rActor, sAbilityStat)
local rRoll = getRoll(rActor, sAbilityStat);
local nTargetDC = DB.getValue("partysheet.abilitydc", 0);
if nTargetDC == 0 then
nTargetDC = nil;
end
rRoll.nTarget = nTargetDC;
if DB.getValue("partysheet.hiderollresults", 0) == 1 then
rRoll.bSecret = true;
rRoll.bTower = true;
end
ActionsManager.performAction(draginfo, rActor, rRoll);
end
function performRoll(draginfo, rActor, sAbilityStat)
local rRoll = getRoll(rActor, sAbilityStat);
if User.isHost() and CombatManager.isCTHidden(ActorManager.getCTNode(rActor)) then
rRoll.bSecret = true;
end
ActionsManager.performAction(draginfo, rActor, rRoll);
end
function getRoll(rActor, sAbilityStat)
local rRoll = {};
rRoll.sType = "ability";
rRoll.aDice = { "d20" };
rRoll.nMod = ActorManager2.getAbilityBonus(rActor, sAbilityStat);
rRoll.sDesc = "[ABILITY]";
rRoll.sDesc = rRoll.sDesc .. " " .. StringManager.capitalize(sAbilityStat);
rRoll.sDesc = rRoll.sDesc .. " check";
return rRoll;
end
function modRoll(rSource, rTarget, rRoll)
local aAddDesc = {};
local aAddDice = {};
local nAddMod = 0;
if rSource then
local bEffects = false;
local sActionStat = nil;
local sAbility = string.match(rRoll.sDesc, "%[ABILITY%] (%w+) check");
if sAbility then
sAbility = string.lower(sAbility);
else
if string.match(rRoll.sDesc, "%[STABILIZATION%]") then
sAbility = "constitution";
end
end
-- GET ACTION MODIFIERS
local nEffectCount;
aAddDice, nAddMod, nEffectCount = EffectManager35E.getEffectsBonus(rSource, {"ABIL"}, false, {sAbility});
if (nEffectCount > 0) then
bEffects = true;
end
-- GET CONDITION MODIFIERS
if EffectManager35E.hasEffectCondition(rSource, "Frightened") or
EffectManager35E.hasEffectCondition(rSource, "Panicked") or
EffectManager35E.hasEffectCondition(rSource, "Shaken") then
nAddMod = nAddMod - 2;
bEffects = true;
end
if EffectManager35E.hasEffectCondition(rSource, "Sickened") then
nAddMod = nAddMod - 2;
bEffects = true;
end
-- GET STAT MODIFIERS
local nBonusStat, nBonusEffects = ActorManager2.getAbilityEffectsBonus(rSource, sAbility);
if nBonusEffects > 0 then
bEffects = true;
nAddMod = nAddMod + nBonusStat;
end
-- HANDLE NEGATIVE LEVELS
local nNegLevelMod, nNegLevelCount = EffectManager35E.getEffectsBonus(rSource, {"NLVL"}, true);
if nNegLevelCount > 0 then
nAddMod = nAddMod - nNegLevelMod;
bEffects = true;
end
-- IF EFFECTS HAPPENED, THEN ADD NOTE
if bEffects then
local sEffects = "";
local sMod = StringManager.convertDiceToString(aAddDice, nAddMod, true);
if sMod ~= "" then
sEffects = "[" .. Interface.getString("effects_tag") .. " " .. sMod .. "]";
else
sEffects = "[" .. Interface.getString("effects_tag") .. "]";
end
table.insert(aAddDesc, sEffects);
end
end
if #aAddDesc > 0 then
rRoll.sDesc = rRoll.sDesc .. " " .. table.concat(aAddDesc, " ");
end
for _,vDie in ipairs(aAddDice) do
if vDie:sub(1,1) == "-" then
table.insert(rRoll.aDice, "-p" .. vDie:sub(3));
else
table.insert(rRoll.aDice, "p" .. vDie:sub(2));
end
end
rRoll.nMod = rRoll.nMod + nAddMod;
end
function onRoll(rSource, rTarget, rRoll)
local rMessage = ActionsManager.createActionMessage(rSource, rRoll);
if rRoll.nTarget then
local nTotal = ActionsManager.total(rRoll);
local nTargetDC = tonumber(rRoll.nTarget) or 0;
rMessage.text = rMessage.text .. " (vs. DC " .. nTargetDC .. ")";
if nTotal >= nTargetDC then
rMessage.text = rMessage.text .. " [SUCCESS]";
else
rMessage.text = rMessage.text .. " [FAILURE]";
end
end
Comm.deliverChatMessage(rMessage);
end
|
-- Quick and dirty test
require 'Q/UTILS/lua/strict'
local Scalar = require 'libsclr'
local qmem = require 'Q/UTILS/lua/qmem'
local Q = require 'Q'
local chunk_size = qmem.chunk_size
local x, y, z, n1, n2
--=====================================
local T = {}
for i = 1, 3 do T[#T+1] = i end
x = Q.mk_col(T, "I4")
for i = 1, 3 do
local s = x:get1(i-1)
assert(type(s) == "Scalar")
assert(s == Scalar.new(i, "I4"))
end
--=====================================
local len = 3
y = Q.const({ val = 1, len = len, qtype = "F4"}):eval()
Q.print_csv(y)
for i = 1, len do
assert(y:get1(i-1) == Scalar.new(1, "F4"))
end
--=====================================
y = Q.seq({ start = 10, by = 20, len = 3, qtype = "I2"}):eval()
Q.print_csv(y)
--=====================================
y = Q.rand({ lb = 0, ub = 1, len = 3, qtype = "F8"}):eval()
Q.print_csv(y)
--=====================================
z = Q.vvadd(x, y):eval()
Q.print_csv({x, y, z})
--=====================================
y = Q.period({ start = 1, by = 4, period = 2, len = 5, qtype = "I8"}):eval()
Q.print_csv(y)
--=====================================
n1, n2 = Q.min(y):eval()
print("min ", n1, n2)
n1, n2 = Q.max(y):eval()
print("max ", n1, n2)
n1, n2 = Q.sum(y):eval()
print("sum ", n1, n2)
local len = chunk_size + 17
x = Q.const({val = 1, qtype = "I1", len = len}):memo(true)
y = Q.const({val = 1, qtype = "F4", len = len}):memo(true)
for i = 1, 10 do
z = Q.vvadd(x, y):memo(true)
n1, n2 = Q.sum(z):eval()
assert(n1 == Scalar.new(2*len))
end
print("Success")
os.exit()
|
------------------------------------------------------------------------------
-- kong-plugin-soap2rest 1.0.2-1
------------------------------------------------------------------------------
-- Copyright 2021 adesso SE
--
-- 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.
------------------------------------------------------------------------------
-- Author: Daniel Kraft <[email protected]>
------------------------------------------------------------------------------
local xml2lua = require "xml2lua"
local handler = require "xmlhandler.tree"
local utils = require "kong.plugins.soap2rest.utils"
--local inspect = require "inspect"
local _M = {}
-- Identify namespaces from the WSDL schema
-- @param raw_schema Schema Excerpt from the WSDL
-- @return 1: Lua table with namespaces and the appropriate abbreviations
-- 2: Abbreviations of the target namespace
local function parse_namespaces(raw_schema)
local namespaces = {}
local targetNamespace = ""
-- Identify WSDL namespaces and the appropriate abbreviations
for key, value in pairs(raw_schema._attr) do
if string.match(key, '^(xmlns):') == 'xmlns' then
namespaces[string.match(key, ':(.*)$')] = value
elseif key == 'targetNamespace' then
targetNamespace = value
end
end
-- Identifying the abbreviations of the target namespace
for key, value in pairs(namespaces) do
if value == targetNamespace then
targetNamespace = key
break
end
end
return namespaces, targetNamespace
end
-- Identifying the types of SOAP requests and responses
-- @param raw_schema Schema Excerpt from the WSDL
-- @return Mapping of InputMessage or OutputMessage and their types
local function parse_schema(raw_schema)
-- Identify the types
local types = {}
for key, value in pairs(raw_schema['xs:complexType']) do
if value._attr.name:sub(-#'_OutputMessage') == '_OutputMessage' then
if value['xs:sequence'] ~= nil and value['xs:sequence']['xs:element'] ~= nil then
-- xs typen are basic values
if value['xs:sequence']['xs:element']._attr.type ~= nil and value['xs:sequence']['xs:element']._attr.type:find('^xs:') == nil then
types[value._attr.name] = value['xs:sequence']['xs:element']._attr.type:gsub("schemas:", "")
else
types[value._attr.name] = value['xs:sequence']['xs:element']._attr.name
end
elseif value['xs:element'] ~= nil then
if value['xs:element']._attr.type ~= nil then
types[value._attr.name] = value['xs:element']._attr.type:gsub("schemas:", "")
else
types[value._attr.name] = value['xs:element']._attr.name
end
end
end
end
-- Assigning the types to InputMessage and OutputMessage respectively.
local schema = {}
for key, value in pairs(raw_schema['xs:element']) do
if value._attr.name:sub(-#'_OutputMessage') == '_OutputMessage' then
schema[value._attr.name] = types[value._attr.name]
elseif value._attr.name:sub(-#'_InputMessage') ~= '_InputMessage' then
schema[value._attr.name] = (value._attr.type ~= nil and value._attr.type:gsub("schemas:", "") or value._attr.name)
end
end
return schema
end
-- Identify the SOAP operations
-- @param raw_operations Operation Excerpt from the WSDL
-- @param schema Mapping of InputMessage or OutputMessage and their types
-- @return Mapping of OperationID and return types and possible faults
local function parse_operations(raw_operations, schema)
local operations = {}
for key, value in pairs(raw_operations) do
local response, fault400, fault500 = nil, nil, nil
if value.output ~= nil then
response = schema[value.output._attr.message:gsub("wsdl:", "")]
end
-- Identifying the faults
if value.fault ~= nil then
-- Special case where only one fault is indicated
if table.getn(value.fault) < 2 then
-- Identifying the Client Faults
if string.match(value.fault._attr.name, '_(4)[0-9][0-9]$') == '4' then
fault400 = {
name = value.fault._attr.name,
type = schema[value.fault._attr.name]
}
-- Identify the server faults
elseif string.match(value.fault._attr.name, '_(5)[0-9][0-9]$') == '5' then
fault500 = {
name = value.fault._attr.name,
type = schema[value.fault._attr.name]
}
end
else
for key, value in pairs(value.fault) do
-- Identifying the Client Faults
if string.match(value._attr.name, '_(4)[0-9][0-9]$') == '4' then
if fault400 == nil or string.match(value._attr.name, '_(400)$') == '400'then
fault400 = {
name = value._attr.name,
type = schema[value._attr.name]
}
end
-- Identify the server faults
elseif string.match(value._attr.name, '_(5)[0-9][0-9]$') == '5' then
if fault500 == nil or string.match(value._attr.name, '_(500)$') == '500'then
fault500 = {
name = value._attr.name,
type = schema[value._attr.name]
}
end
end
end
end
end
-- Composing the SAOP return types
operations[value._attr.name] = {
soap = {
response=response,
fault400=fault400,
fault500=fault500
}
}
end
return operations
end
-- Analysing ordered response models and soap arrays
-- @param complex_types Excerpt of all ComplexTypes from the WSDL
-- @return 1. Configuration of the return types
-- 2. Collection of the names of all SOAP arrays
local function parse_complexTypes(complex_types)
local models = {}
local soap_arrays = {}
for _, type in pairs(complex_types) do
if type['xs:sequence'] ~= nil then
local attr = {}
-- Checking whether it is an array of attributes
if table.getn(type['xs:sequence']['xs:element']) > 1 then
for _, value in pairs(type['xs:sequence']['xs:element']) do
-- Collecting attributes and their type
table.insert(attr, {
name = value._attr.name,
type = (value._attr.type:sub(1, #"schemas:") == "schemas:" and string.gsub(value._attr.type, "([^:]*:)", "" ) or nil)
})
-- Collecting the names of SOAP arrays
if value._attr.maxOccurs ~= nil and value._attr.maxOccurs == "unbounded" and not utils.has_value(soap_arrays, value._attr.name) then
table.insert(soap_arrays, value._attr.name)
end
end
else
local value = type['xs:sequence']['xs:element']
-- Collecting attributes and their type
table.insert(attr, {
name = value._attr.name,
type = (value._attr.type:sub(1, #"schemas:") == "schemas:" and string.gsub(value._attr.type, "([^:]*:)", "" ) or nil)
})
-- Collecting the names of SOAP arrays
if value._attr.maxOccurs ~= nil and value._attr.maxOccurs == "unbounded" and not utils.has_value(soap_arrays, value._attr.name) then
table.insert(soap_arrays, value._attr.name)
end
end
models[type._attr.name] = attr
end
end
return models, soap_arrays
end
-- Analysing the WSDL file and initiating the cached plug-in configuration
-- @param plugin_conf Plugin configuration
function _M.parse(plugin_conf)
-- Reading the WSDL file
local status, wsdl_content = pcall(utils.read_file, plugin_conf.wsdl_path)
if not status then
kong.log.err("Unable to read WSDL file '"..plugin_conf.wsdl_path.."' \n\t", wsdl_content)
return
end
-- Convert WSDL file into a Lua table
local wsdl_handler = handler:new()
local parser = xml2lua.parser(wsdl_handler)
parser:parse(wsdl_content)
plugin_conf.wsdl_content = wsdl_content
-- Identify namespaces from the WSDL schema
local status, namespaces, targetNamespace = pcall(parse_namespaces, wsdl_handler.root.definitions.types['xs:schema'])
if not status then
kong.log.err("Unable to parse WSDL namespaces\n\t", namespaces)
return
end
plugin_conf.namespaces = namespaces
plugin_conf.targetNamespace = targetNamespace
-- Identifying the types of SOAP requests and responses
local status, schema = pcall(parse_schema, wsdl_handler.root.definitions.types['xs:schema'])
if not status then
kong.log.err("Unable to parse WSDL schema\n\t", schema)
return
end
-- Identify the SOAP operations
local status, operations = pcall(parse_operations, wsdl_handler.root.definitions.portType.operation, schema)
if not status then
kong.log.err("Unable to parse WSDL operations\n\t", operations)
return
end
plugin_conf.operations = operations
-- Analysing ordered response models and soap arrays
local status, models, soap_arrays = pcall(parse_complexTypes, wsdl_handler.root.definitions.types['xs:schema']['xs:complexType'])
if not status then
kong.log.err("Unable to parse WSDL complexType\n\t", models)
return
end
plugin_conf.models = models
plugin_conf.soap_arrays = soap_arrays
end
return _M
|
module("luci.controller.qbittorrent",package.seeall)
function index()
if not nixio.fs.access("/etc/config/qbittorrent") then
return
end
entry({"admin", "nas", "qBittorrent"}, cbi("qbittorrent"), _("qBittorrent"))
entry({"admin", "nas", "qBittorrent", "status"}, call("act_status")).leaf = true
end
function act_status()
local e={}
e.running=luci.sys.call("pgrep qbittorrent-nox >/dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
|
local luaunit = require("luaunit")
require("optional_id")
TestOptionalId = {}
function TestOptionalId:test_optional_id()
local r = OptionalId:from_file("src/fixed_struct.bin")
luaunit.assertEquals(r._unnamed0, 0x50)
luaunit.assertEquals(r._unnamed1, 0x41)
luaunit.assertEquals(r._unnamed2, "\x43\x4b\x2d\x31\xff")
end
|
-- load app code
local App = dofile("../code/sts-diffusion.lua")
diffusion = App {
polyOrder = 1,
lower = {0.0, 0.0},
upper = {2*math.pi, 2*math.pi},
cells = {8, 8},
errEps = 1e-8,
factor = 10,
extraStages = 1,
stepper = 'RKL1',
-- initial conditions
init = function (t, xn)
local x, y = xn[1], xn[2]
return 0.0
end,
source = function (t, xn)
local x, y = xn[1], xn[2]
local amn = {{0,10,0}, {10,0,0}, {10,0,0}}
local bmn = {{0,10,0}, {10,0,0}, {10,0,0}}
local t1, t2 = 0.0, 0.0
local f = 0.0
for m = 0,2 do
for n = 0,2 do
t1 = amn[m+1][n+1]*math.cos(m*x)*math.cos(n*y)
t2 = bmn[m+1][n+1]*math.sin(m*x)*math.sin(n*y)
f = f + -(m*m+n*n)*(t1+t2)
end
end
return -f/50.0
end,
exact = function (t, xn)
local x, y = xn[1], xn[2]
local amn = {{0,10,0}, {10,0,0}, {10,0,0}}
local bmn = {{0,10,0}, {10,0,0}, {10,0,0}}
local t1, t2 = 0.0, 0.0
local f = 0.0
for m = 0,2 do
for n = 0,2 do
t1 = amn[m+1][n+1]*math.cos(m*x)*math.cos(n*y)
t2 = bmn[m+1][n+1]*math.sin(m*x)*math.sin(n*y)
f = f + (t1+t2)
end
end
return f/50.0
end,
}
diffusion()
|
cmdBaseWhiteList = {}
eventHandlers = {}
function dgsCreateCmd(x,y,w,h,relative,parent)
if not(type(x) == "number") then error(dgsGenAsrt(x,"dgsCreateCmd",1,"number")) end
if not(type(y) == "number") then error(dgsGenAsrt(y,"dgsCreateCmd",2,"number")) end
if not(type(w) == "number") then error(dgsGenAsrt(w,"dgsCreateCmd",3,"number")) end
if not(type(h) == "number") then error(dgsGenAsrt(h,"dgsCreateCmd",4,"number")) end
local cmdMemo = dgsCreateMemo(x,y,w,h,"",relative,parent)
dgsMemoSetReadOnly(cmdMemo,true)
dgsSetData(cmdMemo,"asPlugin","dgs-dxcmd")
dgsSetData(cmdMemo,"readOnlyCaretShow",true)
dgsSetData(cmdMemo,"textSize",{1.3,1.3})
dgsMemoSetWordWrapState(cmdMemo,true)
dgsSetData(cmdMemo,"bgColor",tocolor(0,0,0,180))
dgsSetData(cmdMemo,"textColor",tocolor(255,255,255,255))
dgsSetData(cmdMemo,"caretColor",tocolor(255,255,255,255))
dgsSetFont(cmdMemo,"arial")
dgsSetData(cmdMemo,"leading",tonumber(leading) or 20)
dgsSetData(cmdMemo,"preName","")
dgsSetData(cmdMemo,"whitelist",cmdBaseWhiteList)
dgsSetData(cmdMemo,"cmdType","function")
dgsSetData(cmdMemo,"cmdHistory",{[0]=""})
dgsSetData(cmdMemo,"cmdCurrentHistory",0)
local sx,sy = dgsGetSize(cmdMemo,false)
local edit = dgsCreateEdit(0,-20,sx,20,"",false,cmdMemo,tocolor(255,255,255,255))
dgsSetData(edit,"textSize",{1.3,1.3})
dgsSetFont(edit,"arial")
addEventHandler("onDgsEditAccepted",edit,function()
local cmd = dgsElementData[source].mycmd
if dgsGetPluginType(cmd) == "dgs-dxcmd" then
local text = dgsElementData[source].text
dgsEditClearText(source)
if text ~= "" then
receiveCmdEditInput(cmd,text)
end
end
end,false)
for k,v in pairs(eventHandlers) do
dgsEditAddAutoComplete(edit,k,false)
end
dgsSetPositionAlignment(edit,_,"bottom")
dgsSetData(cmdMemo,"cmdEdit",edit)
dgsSetData(cmdMemo,"hitoutofparent",true)
dgsSetData(edit,"cursorStyle",1)
dgsSetData(edit,"cursorThick",1.2)
dgsSetData(edit,"mycmd",cmdMemo)
addEventHandler("onDgsTextChange",edit,function()
local text = dgsElementData[source].text
local parent = dgsElementData[source].mycmd
if isElement(parent) then
if dgsGetPluginType(parent) == "dgs-dxcmd" then
local hisid = dgsElementData[parent].cmdCurrentHistory
local history = dgsElementData[parent].cmdHistory
if history[hisid] ~= text then
dgsSetData(parent,"cmdCurrentHistory",0)
end
end
end
end,false)
triggerEvent("onDgsPluginCreate",cmdMemo,sourceResource)
return cmdMemo
end
function dgsCmdSetMode(cmd,mode,output)
if not(dgsGetPluginType(cmd) == "dgs-dxcmd") then error(dgsGenAsrt(cmd,"dgsCmdSetMode",1,"plugin dgs-dxcmd")) end
if not(type(mode) == "string") then error(dgsGenAsrt(mode,"dgsCmdSetMode",2,"plugin string")) end
if mode == "function" or mode == "event" then
triggerEvent("onCMDModePreChange",cmd,mode)
if not wasEventCancelled() then
dgsSetData(cmd,"cmdType","event")
if output then
outputCmdMessage(cmd,"[Mode]Current Mode is ‘"..(mode == "function" and "Function" or "Event").." CMD’")
end
return true
end
end
return false
end
function dgsCmdClearText(cmd)
if not(dgsGetPluginType(cmd) == "dgs-dxcmd") then error(dgsGenAsrt(cmd,"dgsCmdClearText",1,"plugin dgs-dxcmd")) end
dgsSetData(cmd,"texts",{})
end
function dgsCmdAddEventToWhiteList(cmd,rules)
if not(dgsGetPluginType(cmd) == "dgs-dxcmd") then error(dgsGenAsrt(cmd,"dgsCmdAddEventToWhiteList",1,"plugin dgs-dxcmd")) end
if not(type(rules) == "table") then error(dgsGenAsrt(rules,"dgsCmdAddEventToWhiteList",2,"table")) end
if cmd == "all" then
for k,v in pairs(getElementsByType("dgs-dxcmd")) do
local oldrule = dgsGetData(v,"whitelist")
local newrule = table.merger(oldrule,rules)
if newrule then
dgsSetData(v,"whitelist",newrule)
end
end
cmdBaseWhiteList = table.merger(cmdBaseWhiteList,rules)
else
local oldrule = dgsGetData(cmd,"whitelist")
local newrule = table.merger(oldrule,rules)
if newrule then
dgsSetData(cmd,"whitelist",newrule)
end
end
end
function dgsCmdRemoveEventFromWhiteList(cmd,rules)
if not(dgsGetPluginType(cmd) == "dgs-dxcmd") then error(dgsGenAsrt(cmd,"dgsCmdRemoveEventFromWhiteList",1,"plugin dgs-dxcmd")) end
if not(type(rules) == "table") then error(dgsGenAsrt(rules,"dgsCmdRemoveEventFromWhiteList",2,"table")) end
if cmd == "all" then
for k,v in pairs(getElementsByType("dgs-dxcmd")) do
local oldrule = dgsGetData(v,"whitelist")
local newrule = table.complement(oldrule,rules)
if newrule then
dgsSetData(v,"whitelist",newrule)
end
end
cmdBaseWhiteList = table.complement(cmdBaseWhiteList,rules)
else
local oldrule = dgsGetData(cmd,"whitelist")
local newrule = table.complement(oldrule,rules)
if newrule then
dgsSetData(cmd,"whitelist",newrule)
end
end
end
function dgsCmdRemoveAllEvents(cmd)
if not(dgsGetPluginType(cmd) == "dgs-dxcmd" or cmd == "all") then error(dgsGenAsrt(cmd,"dgsCmdRemoveAllEvents",1,"plugin dgs-dxcmd/string","all")) end
if cmd == "all" then
cmdBaseWhiteList = {}
for k,v in pairs(getElementsByType("dgs-dxcmd")) do
dgsSetData(v,"whitelist",{})
end
else
dgsSetData(cmd,"whitelist",{})
end
end
function dgsCmdIsInWhiteList(cmd,rule)
if not(dgsGetPluginType(cmd) == "dgs-dxcmd" or cmd == "all") then error(dgsGenAsrt(cmd,"dgsCmdIsInWhiteList",1,"plugin dgs-dxcmd/string","all")) end
if not(type(rule) == "string") then error(dgsGenAsrt(rule,"dgsCmdIsInWhiteList",2,"string")) end
if table.find(preinstallWhiteList,rule) then
return true
else
if cmd == "all" then
if table.find(cmdBaseWhiteList,rule) then
return true
end
else
local wtlist = dgsGetData(cmd,"whitelist")
if table.find(wtlist,rule) then
return true
end
end
end
return false
end
function outputCmdMessage(cmd,str)
if not(dgsGetPluginType(cmd) == "dgs-dxcmd") then error(dgsGenAsrt(cmd,"outputCmdMessage",1,"plugin dgs-dxcmd")) end
dgsMemoAppendText(cmd,str.."\n",true)
local textTable = dgsElementData[cmd].text
local toLine = #textTable
local toIndex = utf8.len(textTable[toLine][0])
dgsMemoSetCaretPosition(cmd,toIndex,toLine)
end
function receiveCmdEditInput(cmd,str)
if dgsGetPluginType(cmd) == "dgs-dxcmd" then
local history = dgsGetData(cmd,"cmdHistory")
if history[1] ~= str then
table.insert(history,1,str)
dgsSetData(cmd,"cmdHistory",history)
end
executeCmdCommand(cmd,unpack(split(str," ")))
end
end
function dgsCmdGetEdit(cmd)
if dgsGetPluginType(cmd) == "dgs-dxcmd" then
return dgsElementData[cmd].cmdEdit
end
return false
end
function configCMD(source)
local dxedit = dgsElementData[source].cmdEdit
local scalex,scaley = unpack(dgsGetData(source,"textSize"))
local sx,sy = dgsGetSize(source,false)
dgsSetPosition(dxedit,0,sy-scaley*20,false)
dgsSetSize(dxedit,sx,scaley*20,false)
end
function dgsCmdAddCommandHandler(str,func)
eventHandlers[str] = eventHandlers[str] or {}
if not(type(str) == "string") then error(dgsGenAsrt(str,"dgsCmdAddCommandHandler",1,"string")) end
if not(type(func) == "function") then error(dgsGenAsrt(func,"dgsCmdAddCommandHandler",2,"function")) end
return table.insert(eventHandlers[str],func)
end
function dgsCmdRemoveCommandHandler(str,func)
eventHandlers[str] = eventHandlers[str] or {}
if not(type(str) == "string") then error(dgsGenAsrt(str,"dgsCmdRemoveCommandHandler",1,"string")) end
if not(type(func) == "function") then error(dgsGenAsrt(func,"dgsCmdRemoveCommandHandler",2,"function")) end
local id = table.find(eventHandlers[str],func)
if id then
return table.remove(eventHandlers[str],id)
end
return true
end
function executeCmdCommand(cmd,str,...)
local arg = {...}
local ifound = false
local cmdType = dgsGetData(cmd,"cmdType")
if cmdType == "function" then
outputCmdMessage(cmd,"Execute: "..str)
for k,v in pairs(eventHandlers[str] or {}) do
if type(v) == "function" then
ifound = true
v(cmd,unpack(arg))
break
end
end
if not ifound then
outputCmdMessage(cmd,"Coundn't Find Command:"..str)
end
elseif cmdType == "event" then
outputCmdMessage(cmd,"Trigger: "..str)
if dgsCmdIsInWhiteList(cmd,dgsGetData(cmd,"preName")..str) then
ifound = true
triggerEvent(dgsGetData(cmd,"preName")..str,cmd,...)
end
if not ifound then
outputCmdMessage(cmd,"Access Denied When Calling Event:"..str)
end
end
end
function dgsEventCmdSetPreName(cmd,preName)
if not(dgsGetPluginType(cmd) == "dgs-dxcmd") then error(dgsGenAsrt(cmd,"dgsEventCmdSetPreName",1,"plugin dgs-dxcmd")) end
if not(type(preName) == "string") then error(dgsGenAsrt(preName,"dgsEventCmdSetPreName",1,"string")) end
return dgsSetData(cmd,"preName",preName)
end
|
-- Do You Believe in Gravity?
local s, id = GetID()
function s.initial_effect( c )
-- search
local e1 = Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
e1:SetRange(LOCATION_SZONE)
e1:SetCountLimit(1, id)
e1:SetCondition(s.searchcon)
e1:SetOperation(s.searchop)
c:RegisterEffect(e1)
-- activate
local e2 = Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e2)
end
s.listed_series = { 0xf00 }
s.listed_names = { 1090076077 }
function s.searchfilter( c, e, tp )
return (c:IsSetCard(0xf00) and c:IsType(TYPE_MONSTER)) or
(c:IsCode(1090076077))
end
function s.fieldsearchfilter( c, e, tp )
return c:IsSetCard(0xf00) and c:IsType(TYPE_MONSTER) and c:IsFaceup() and
c:IsControler(tp)
end
function s.searchcon( e, tp, eg, ep, ev, re, r, rp )
return Duel.GetTurnPlayer() == tp and Duel.IsExistingMatchingCard(
s.fieldsearchfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp
) and
Duel.IsExistingMatchingCard(
s.searchfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp
)
end
function s.searchop( e, tp, eg, ep, ev, re, r, rp, chk, chkc )
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
local g = Duel.SelectMatchingCard(
tp, s.searchfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp
)
local tc = g:GetFirst()
if tc then
Duel.SendtoHand(tc, tp, REASON_EFFECT)
end
end
|
cc = cc or {}
---Image object
---@class Image : Ref
local Image = {}
cc.Image = Image
--------------------------------
--
---@return bool
function Image:hasPremultipliedAlpha() end
--------------------------------
---brief Save Image data to the specified file, with specified format.<br>
---param filePath the file's absolute path, including file suffix.<br>
---param isToRGB whether the image is saved as RGB format.
---@param filename string
---@param isToRGB bool
---@return bool
function Image:saveToFile(filename, isToRGB) end
--------------------------------
--
---@return bool
function Image:hasAlpha() end
--------------------------------
--
---@return bool
function Image:isCompressed() end
--------------------------------
--
---@return int
function Image:getHeight() end
--------------------------------
---brief Load the image from the specified path.<br>
---param path the absolute file path.<br>
---return true if loaded correctly.
---@param path string
---@return bool
function Image:initWithImageFile(path) end
--------------------------------
--
---@return int
function Image:getWidth() end
--------------------------------
--
---@return int
function Image:getBitPerPixel() end
--------------------------------
--
---@return int
function Image:getFileType() end
--------------------------------
--
---@return string
function Image:getFilePath() end
--------------------------------
--
---@return int
function Image:getNumberOfMipmaps() end
--------------------------------
--
---@return int
function Image:getRenderFormat() end
--------------------------------
--- treats (or not) PVR files as if they have alpha premultiplied.<br>
---Since it is impossible to know at runtime if the PVR images have the alpha channel premultiplied, it is<br>
---possible load them as if they have (or not) the alpha channel premultiplied.<br>
---By default it is disabled.
---@param haveAlphaPremultiplied bool
---@return Image
function Image:setPVRImagesHavePremultipliedAlpha(haveAlphaPremultiplied) end
--------------------------------
---Enables or disables premultiplied alpha for PNG files.<br>
---param enabled (default: true)
---@param enabled bool
---@return Image
function Image:setPNGPremultipliedAlphaEnabled(enabled) end
--------------------------------
---js ctor
---@return Image
function Image:Image() end
return Image
|
--* This Document is AutoGenerate by OrangeFilter, Don't Change it! *
---@meta
---
---[3.6]camera clear mode
---
---@class OF_CameraClearFlags
---
---[3.6]clear color and depth
---
---@field OF_CameraClearFlags_ColorAndDepth
---
---[3.6]clear depth only
---
---@field OF_CameraClearFlags_DepthOnly
---
---[3.6]don't clear
---
---@field OF_CameraClearFlags_Nothing
---
---[4.6]clear color only
---
---@field OF_CameraClearFlags_ColorOnly
OF_CameraClearFlags = {}
return OF_CameraClearFlags
|
local lspconfig = require("lspconfig/util")
local o = require("nvim-lsp-ts-utils.options")
local format = string.format
local uv = vim.loop
local api = vim.api
local exec = api.nvim_exec
local tsserver_fts = {
"javascript", "javascriptreact", "typescript", "typescriptreact"
}
local tsserver_extensions = {"js", "jsx", "ts", "tsx"}
local node_modules = "/node_modules/.bin"
local M = {}
M.echo_warning = function(message)
vim.api.nvim_echo({{"nvim-lsp-ts-utils: " .. message, "WarningMsg"}}, true,
{})
end
M.removed_warning = function(method)
M.echo_warning(method ..
" has been removed! Please see the readme for instructions.")
end
M.debug_log = function(target)
if not o.get().debug then return end
if type(target) == "table" then
print(vim.inspect(target))
else
print(target)
end
end
M.define_buf_command = function(name, fn)
vim.cmd(format("command! -buffer %s lua require'nvim-lsp-ts-utils'.%s",
name, fn))
end
M.define_buf_augroup = function(name, event, fn)
exec(format([[
augroup %s
autocmd! * <buffer>
autocmd %s <buffer> lua require'nvim-lsp-ts-utils'.%s
augroup END
]], name, event, fn), false)
end
M.print_no_actions_message = function() print("No code actions available") end
M.parse_args = function(args, bufnr)
local parsed = {}
for _, arg in pairs(args) do
if arg == "$FILENAME" then
table.insert(parsed, M.buffer.name(bufnr))
else
table.insert(parsed, arg)
end
end
return parsed
end
M.file = {
mv = function(source, target)
local ok = uv.fs_rename(source, target)
if not ok then
error("failed to move " .. source .. " to " .. target)
end
end,
cp = function(source, target)
local ok = uv.fs_copyfile(source, target)
if not ok then
error("failed to copy " .. source .. " to " .. target)
end
end,
rm = function(path, force)
local ok = uv.fs_unlink(path)
if not force and not ok then error("failed to remove " .. path) end
end,
dir_file = function(dir, index)
local handle = uv.fs_scandir(dir)
for i = 1, index do
local file = uv.fs_scandir_next(handle)
if i == index and file then return file end
end
return nil
end,
exists = function(path)
local file = uv.fs_open(path, "r", 438)
if file then
uv.fs_close(file)
return true
end
return false
end,
check_ft = function(bufnr)
if not bufnr then bufnr = 0 end
local ft = api.nvim_buf_get_option(bufnr, "filetype")
if not M.table.contains(tsserver_fts, ft) then
error("invalid filetype")
end
end,
stat = function(path)
local fd = uv.fs_open(path, "r", 438)
if not fd then return nil end
local stat = uv.fs_fstat(fd)
uv.fs_close(fd)
return stat
end,
extension = function(filename) return vim.fn.fnamemodify(filename, ":e") end,
has_tsserver_extension = function(filename)
local extension = M.file.extension(filename)
-- assume no extension == directory (which needs to be validated)
return extension == "" or
M.table.contains(tsserver_extensions, extension)
end
}
M.find_bin = function(cmd)
local local_bin = M.buffer.root() .. node_modules .. "/" .. cmd
if M.file.exists(local_bin) then
M.debug_log("using local executable " .. local_bin)
return local_bin
else
M.debug_log("using system executable " .. cmd)
return cmd
end
end
M.table = {
contains = function(list, candidate)
for _, element in pairs(list) do
if element == candidate then return true end
end
return false
end,
len = function(table)
local count = 0
for _ in pairs(table) do count = count + 1 end
return count
end
}
M.cursor = {
pos = function(winnr)
if not winnr then winnr = 0 end
local pos = api.nvim_win_get_cursor(winnr)
return pos[1], pos[2]
end,
set = function(row, col, winnr)
if not winnr then winnr = 0 end
api.nvim_win_set_cursor(winnr, {row, col})
end
}
M.buffer = {
name = function(bufnr)
if not bufnr then bufnr = api.nvim_get_current_buf() end
return api.nvim_buf_get_name(bufnr)
end,
bufnr = function(name)
local info = vim.fn.getbufinfo(name)[1]
return info and info.bufnr or nil
end,
to_string = function(bufnr)
if not bufnr then bufnr = api.nvim_get_current_buf() end
local content = api.nvim_buf_get_lines(bufnr, 0, -1, false)
return table.concat(content, "\n") .. "\n"
end,
line = function(row, bufnr)
return
api.nvim_buf_get_lines(bufnr and bufnr or 0, row - 1, row, false)[1]
end,
insert_text = function(row, col, text, bufnr)
if not bufnr then bufnr = api.nvim_get_current_buf() end
api.nvim_buf_set_text(bufnr, row, col, row, col, {text})
end,
root = function(fname)
if not fname then fname = M.buffer.name() end
return lspconfig.root_pattern("tsconfig.json")(fname) or
lspconfig.root_pattern("package.json", "jsconfig.json",
".git")(fname)
end
}
M.string = {
split_at_newline = function(str)
local split = {}
for line in string.gmatch(str, "([^\n]*)\n?") do
table.insert(split, line)
end
-- remove final empty newline
table.remove(split)
return split
end
}
return M
|
-- coding: utf-8
local Shared = ...
local Msg, ErrMsg = Shared.Msg, Shared.ErrMsg
local MacroInit, MacroStep = Shared.MacroInit, Shared.MacroStep
local pack, loadmacro, utils = Shared.pack, Shared.loadmacro, Shared.utils
local MacroCallFar = Shared.MacroCallFar
local FarMacroCallToLua = Shared.FarMacroCallToLua
local GetLastParseError = Shared.GetLastParseError
Shared = nil
local F = far.Flags
-- enum MACROPLUGINRETURNTYPE
local MPRT_NORMALFINISH, MPRT_ERRORFINISH, MPRT_HASNOMACRO, MPRT_PLUGINCALL =
F.MPRT_NORMALFINISH, F.MPRT_ERRORFINISH, F.MPRT_HASNOMACRO, F.MPRT_PLUGINCALL
-- enum FARMACROSTATE
local MACROSTATE_NOMACRO, MACROSTATE_EXECUTING, MACROSTATE_EXECUTING_COMMON =
F.MACROSTATE_NOMACRO, F.MACROSTATE_EXECUTING, F.MACROSTATE_EXECUTING_COMMON
-- unsigned __int64 MACROFLAGS_MFLAGS
local MFLAGS_ENABLEOUTPUT, MFLAGS_NOSENDKEYSTOPLUGINS, MFLAGS_POSTFROMPLUGIN =
0x1, 0x2, 0x10000000
local KEY_NONE = 0x30001
local MCODE_F_PLUGIN_CALL = 0x80C4F
local type, setmetatable = type, setmetatable
local bit = bit or bit64
local band, bor, bxor, lshift = bit.band, bit.bor, bit.bxor, bit.lshift
--------------------------------------------------------------------------------
local MCODE_F_KEYMACRO = 0x80C68
local Import = {
RestoreMacroChar = function() return MacroCallFar(MCODE_F_KEYMACRO, 1) end,
ScrBufLock = function() return MacroCallFar(MCODE_F_KEYMACRO, 2) end,
ScrBufUnlock = function() return MacroCallFar(MCODE_F_KEYMACRO, 3) end,
ScrBufResetLockCount = function() return MacroCallFar(MCODE_F_KEYMACRO, 4) end,
ScrBufGetLockCount = function() return MacroCallFar(MCODE_F_KEYMACRO, 5) end,
ScrBufSetLockCount = function(v) return MacroCallFar(MCODE_F_KEYMACRO, 6, v) end,
GetUseInternalClipboard = function() return MacroCallFar(MCODE_F_KEYMACRO, 7) end,
SetUseInternalClipboard = function(v) return MacroCallFar(MCODE_F_KEYMACRO, 8, v) end,
KeyNameToKey = function(v) return MacroCallFar(MCODE_F_KEYMACRO, 9, v) end,
KeyToText = function(v) return MacroCallFar(MCODE_F_KEYMACRO, 10, v) end,
}
--------------------------------------------------------------------------------
local NewMacroRecord do
local MacroRecord = {
m_id = 0, -- идентификатор загруженного макроса в плагине LuaMacro
m_flags = 0, -- флаги макропоследовательности
m_key = -1, -- назначенная клавиша
m_textkey= nil, -- текстовое представление назначенной клавиши
m_value = nil, -- значение, хранимое исполняющимся макросом
m_handle = nil, -- хэндл исполняющегося макроса
m_area = nil -- макрообласть, из которой стартовал макрос
}
local meta = { __index=MacroRecord }
function MacroRecord:GetFlags() return self.m_flags end
function MacroRecord:SetFlags(f) self.m_flags=f end
function MacroRecord:GetHandle() return self.m_handle end
function MacroRecord:SetHandle(handle) self.m_handle=handle end
function MacroRecord:GetValue() return self.m_value end
function MacroRecord:SetValue(val) self.m_value=val end
function MacroRecord:GetStartArea() return self.m_area end
NewMacroRecord = function (MacroId, Flags, Key, TextKey)
return setmetatable({m_id=MacroId, m_flags=Flags, m_key=Key, m_textkey=TextKey,
m_area=far.MacroGetArea() }, meta)
end
end
--------------------------------------------------------------------------------
-- Специализированная очередь, оптимизированная для очередей макросов.
-- Оптимизация по скорости и памяти, имеет смысл при добавлении в цикле сотен тысяч элементов.
-- Данная оптимизация накладывает следующие ограничения (соблюдаемые в нашем случае):
-- Элементы должны быть таблицами.
-- Очередь добавляет в элементы поле _next.
-- Нельзя добавлять элемент в очередь, если он уже имеется в этой очереди.
local NewQueue do
local queue = {}
local meta = { __index=queue }
function queue:add(v)
if self.last ~= nil then
self.last._next = v
self.last = v
else
self.first, self.last = v, v
end
end
function queue:addqueue(q)
if q.last ~= nil then
if self.last ~= nil then
self.last._next = q.first
self.last = q.last
else
self.first, self.last = q.first, q.last
end
end
end
function queue:remove()
if self.first ~= nil then
self.first = self.first._next
if self.first==nil then self.last=nil end
end
end
function queue:empty() return self.first==nil end
NewQueue = function() return setmetatable({}, meta) end
end
--------------------------------------------------------------------------------
local NewMacroState do
local MacroState = {
IntKey = 0, -- "описание реально нажатой клавиши"
HistoryDisableMask = 0,
UseInternalClipboard = false,
MacroQueue = nil
}
local meta = { __index=MacroState }
function MacroState:GetCurMacro() return self.MacroQueue.first end
function MacroState:RemoveCurMacro() self.MacroQueue:remove() end
NewMacroState = function() return setmetatable({ MacroQueue=NewQueue() }, meta) end
end
--------------------------------------------------------------------------------
local NewStack do
local stack = {}
local meta = { __index=stack }
function stack:top() return self[#self] end
function stack:pop() local v=self[#self]; self[#self]=nil; return v; end
function stack:push(v) self[#self+1]=v end
function stack:empty() return self[1]==nil end
NewStack = function() return setmetatable({}, meta) end
end
--------------------------------------------------------------------------------
local KeyMacro = {}
local CurState = NewMacroState()
local StateStack = NewStack()
local MacroIsRunning = 0
--------------------------------------------------------------------------------
local function GetCurMacro() return CurState:GetCurMacro() end
local function GetTopMacro() return StateStack[1] and StateStack:top():GetCurMacro() end
local function RemoveCurMacro() CurState:RemoveCurMacro() end
local function IsExecuting()
local m = GetCurMacro()
if m and m:GetHandle() then
return band(m:GetFlags(),MFLAGS_NOSENDKEYSTOPLUGINS)~=0 and MACROSTATE_EXECUTING or MACROSTATE_EXECUTING_COMMON
else
return StateStack[1] and MACROSTATE_EXECUTING_COMMON or MACROSTATE_NOMACRO
end
end
local function IsHistoryDisable (TypeHistory)
local State = StateStack:top() or CurState
return State:GetCurMacro() and band(State.HistoryDisableMask, lshift(1,TypeHistory))~=0 and 1 or 0
end
local function IsDisableOutput()
local m = GetCurMacro()
return m and band(m:GetFlags(),MFLAGS_ENABLEOUTPUT)==0 and 1 or 0
end
local function PushState (withClip)
if withClip then
CurState.UseInternalClipboard = Import.GetUseInternalClipboard()
end
StateStack:push(CurState)
CurState = NewMacroState()
end
local function PopState (withClip)
if StateStack[1] then
StateStack:top().MacroQueue:addqueue(CurState.MacroQueue)
CurState = StateStack:pop()
if withClip then
Import.SetUseInternalClipboard(CurState.UseInternalClipboard)
end
end
end
function KeyMacro.InitInternalVars (InitedRAM)
if InitedRAM then
CurState.MacroQueue = NewQueue()
end
CurState.HistoryDisableMask = 0
end
function KeyMacro.mmode (Action, Value) -- N=MMode(Action[,Value])
local TopMacro = GetTopMacro()
if not TopMacro then return false end
local result = 0
local flags = TopMacro:GetFlags()
if Action==1 then -- enable/disable output
result = band(flags, MFLAGS_ENABLEOUTPUT)==1 and 0 or 1
if (Value==0 or Value==1 or Value==2) and Value~=result then
TopMacro:SetFlags(bxor(flags, MFLAGS_ENABLEOUTPUT))
far.Text() -- M#2389: mmode(1,x): вывод на экран включается/отключается не вовремя
end
elseif Action==2 then -- get MacroRecord flags
result = bor(lshift(flags,8), TopMacro:GetStartArea())
end
return result
end
local function ACall (macro, param)
local EntryStackSize = #StateStack
macro:SetValue(true)
PushState(true)
local lockCount = Import.ScrBufGetLockCount()
Import.ScrBufSetLockCount(0)
local Result = pack(param[1](unpack(param,2,param.n)))
Import.ScrBufSetLockCount(lockCount)
if #StateStack > EntryStackSize then
PopState(true)
macro:SetValue(Result)
end
end
local function GetInputFromMacro()
while true do
while MacroIsRunning==0 and not GetCurMacro() do
if StateStack[1] then
PopState(true)
else
CurState = NewMacroState()
return MPRT_HASNOMACRO
end
end
local macro = GetCurMacro()
if not macro then break end
if not macro:GetHandle() then
PushState(false)
macro:SetHandle(MacroInit(macro.m_id))
PopState(false)
if not macro:GetHandle() then
RemoveCurMacro()
Import.RestoreMacroChar()
break
end
end
Import.ScrBufResetLockCount()
local OldCurState = CurState
MacroIsRunning = MacroIsRunning + 1
PushState(false)
local value, handle = macro:GetValue(), macro:GetHandle()
local r1,r2
if type(value) == "userdata" then -- Plugin.Call/SyncCall
r1,r2 = MacroStep(handle, FarMacroCallToLua(value))
elseif type(value) == "table" then -- mf.acall, eval
r1,r2 = MacroStep(handle, unpack(value,1,value.n))
elseif value ~= nil then -- Plugin.Menu/Config/Command, ...
r1,r2 = MacroStep(handle, value)
else
r1,r2 = MacroStep(handle)
end
PopState(false)
macro:SetValue(nil)
MacroIsRunning = MacroIsRunning - 1
if band(macro:GetFlags(),MFLAGS_ENABLEOUTPUT) == 0 then
Import.ScrBufLock()
end
if r1 == MPRT_NORMALFINISH or r1 == MPRT_ERRORFINISH then
if macro.caller then macro.caller:SetValue(r1==MPRT_NORMALFINISH and r2) end
if band(macro:GetFlags(),MFLAGS_ENABLEOUTPUT) == 0 then
Import.ScrBufUnlock()
end
OldCurState:RemoveCurMacro()
if not GetCurMacro() then
Import.RestoreMacroChar()
end
for k = #macro,1,-1 do -- exit handlers
local tbl = macro[k]
tbl.func(unpack(tbl, 1, tbl.n))
end
elseif r1 == MPRT_PLUGINCALL then
KeyMacro.CallPlugin(r2, true)
elseif r1 == "acall" then
ACall(macro, r2)
elseif r1 == "eval" then
local m = r2[1]
PushState(true)
KeyMacro.PostNewMacro(m, m.flags, r2[2], false).caller = macro
else
return r1,r2
end
end
end
-- (1) mf.eval (2) keypress macro (3) mf.postmacro
-- (4) command line (5) macro browser (6) autostarting macros
function KeyMacro.PostNewMacro (macroId, flags, textKey, postFromPlugin)
flags = flags or 0
if postFromPlugin then
flags = bor(flags, MFLAGS_POSTFROMPLUGIN)
end
local aKey = textKey and Import.KeyNameToKey(textKey) or 0
local macro = NewMacroRecord(macroId, flags, aKey, textKey)
CurState.MacroQueue:add(macro)
return macro
end
local function TryToPostMacro (Mode, TextKey, IntKey)
local m = utils.GetMacro(Mode, TextKey, true, false)
if m then
if m.index then
KeyMacro.PostNewMacro(m, m.flags, TextKey, false)
CurState.HistoryDisableMask = 0
CurState.IntKey = IntKey
end
return true
end
end
function KeyMacro.DisableHistory (Mask)
Mask = type(Mask)=="number" and math.floor(Mask)
local t = StateStack:top()
local oldHistoryDisable = t and t.HistoryDisableMask or 0
if t and Mask then t.HistoryDisableMask = Mask end
return oldHistoryDisable
end
local function GetLastPressedKey()
for level=#StateStack,1,-1 do
local state = StateStack[level]
local m = state:GetCurMacro()
if m and 0~=band(m:GetFlags(),MFLAGS_POSTFROMPLUGIN) then return m.m_key end
if state.IntKey > 0 then return state.IntKey end
end
return 0
end
--Mode = 0 - возвращается код клавиши, Mode = 1 - возвращается наименование клавиши.
--Type = 0 - возвращает реально нажатое сочетание, которым вызывался макрос,
-- Type = 1 - возвращает клавишу, на которую назначен макрос.
function KeyMacro.akey (Mode, Type)
local TopMacro = GetTopMacro()
if TopMacro then
local IsCodeOutput = (tonumber(Mode) or 0) == 0
local IsPressedKey = (tonumber(Type) or 0) == 0
if IsPressedKey then
local key = GetLastPressedKey()
return IsCodeOutput and key or (key>0 and Import.KeyToText(key)) or ""
else
return IsCodeOutput and TopMacro.m_key or TopMacro.m_textkey or Import.KeyToText(TopMacro.m_key)
end
end
return false
end
function KeyMacro.TransformKey (key)
local lkey = key:lower()
if lkey == "selword" then
return 1
elseif lkey == "xlat" then
return 2
elseif lkey == "akey" then
if StateStack:empty() then return nil end
local k = GetLastPressedKey()
return 3, k > 0 and k or 0
else
local iKey = Import.KeyNameToKey(key)
return 3, iKey==-1 and KEY_NONE or iKey
end
end
function KeyMacro.CallPlugin (Params, AsyncCall)
local Result = false
if type(Params[1]) == "string" then
local EntryStackSize = #StateStack
if AsyncCall then
Result = true
GetCurMacro():SetValue(true)
PushState(true)
end
local lockCount = Import.ScrBufGetLockCount()
Import.ScrBufSetLockCount(0)
local ResultCallPlugin = MacroCallFar(MCODE_F_PLUGIN_CALL, AsyncCall, unpack(Params,1,Params.n))
Import.ScrBufSetLockCount(lockCount)
local isSynchroCall = true
if AsyncCall then
if #StateStack > EntryStackSize then -- эта проверка нужна, т.к. PopState() мог уже быть вызван.
PopState(true)
else
isSynchroCall = false
end
end
if isSynchroCall then
Result = ResultCallPlugin
if AsyncCall then
GetCurMacro():SetValue(Result)
end
end
end
return Result
end
function KeyMacro.AddExitHandler (func, ...)
if type(func) == "function" then
local TopMacro = GetTopMacro()
if TopMacro then
TopMacro[#TopMacro+1] = { n=select("#", ...); func=func; ... }
return ...
end
end
end
local OP_ISEXECUTING = 1
local OP_ISDISABLEOUTPUT = 2
local OP_HISTORYDISABLEMASK = 3
local OP_ISHISTORYDISABLE = 4
local OP_ISTOPMACROOUTPUTDISABLED = 5
local OP_ISPOSTMACROENABLED = 6
local OP_POSTNEWMACRO = 7
local OP_SETMACROVALUE = 8
local OP_GETINPUTFROMMACRO = 9
local OP_TRYTOPOSTMACRO = 10
local OP_GETLASTERROR = 11
function KeyMacro.Dispatch (opcode, ...)
local p1 = (...)
if opcode == OP_ISEXECUTING then
return IsExecuting()
elseif opcode == OP_GETINPUTFROMMACRO then
if not utils.LoadingInProgress() then return GetInputFromMacro() end
elseif opcode == OP_ISDISABLEOUTPUT then
return IsDisableOutput()
elseif opcode == OP_HISTORYDISABLEMASK then
local OldMask = CurState.HistoryDisableMask
if p1 then CurState.HistoryDisableMask = p1 end
return OldMask
elseif opcode == OP_ISHISTORYDISABLE then
return IsHistoryDisable(p1)
elseif opcode==OP_ISTOPMACROOUTPUTDISABLED then
local mr = GetTopMacro()
return mr and 0==band(mr:GetFlags(),MFLAGS_ENABLEOUTPUT) and 1 or 0
elseif opcode == OP_ISPOSTMACROENABLED then
return not (IsExecuting() and GetCurMacro()) and 1 or 0
elseif opcode == OP_POSTNEWMACRO then -- from API MacroControl(MSSC_POST)
local Lang,Code,Flags,AKey,onlyCheck = ...
local f1,f2 = loadmacro(Lang,Code)
if f1 then
CurState.MacroQueue:add(NewMacroRecord({ f1,f2,HasFunction=true },Flags,AKey))
return true
elseif not onlyCheck then
ErrMsg(f2, Msg.MMacroParseErrorTitle)
end
elseif opcode == OP_SETMACROVALUE then
local m = GetCurMacro()
if m then m:SetValue(p1) end
elseif opcode == OP_TRYTOPOSTMACRO then
return TryToPostMacro(...)
elseif opcode == OP_GETLASTERROR then
return GetLastParseError()
end
end
return KeyMacro
|
-- dofile("TCPLEDTest.lua");
--dofile("dht_test.lua");
dofile("TCPLEDTest.lua");
|
-- Locks all wands for given amount of ticks.
LOCKED = "locked"
function Lock(Player, Ticks)
if g_PlayersEnabled[Player:GetUUID()] then
g_PlayersEnabled[Player:GetUUID()] = LOCKED
Player:GetWorld():ScheduleTask(Ticks,
function (World)
g_PlayersEnabled[Player:GetUUID()] = true
end)
end
end
-- Checks if World.Block.Type == Type
function IsType(World, Block, Type)
local valid, BlockType, BlockMeta = World:GetBlockTypeMeta(Block.x, Block.y, Block.z)
return BlockType == Type
end
-- Checks if World.Block.Type == Type and World.Block.Meta == Meta
function IsTypeMeta(World, Block, Type, Meta)
local valid, BlockType, BlockMeta = World:GetBlockTypeMeta(Block.x, Block.y, Block.z)
return BlockType == Type and BlockMeta == Meta
end
|
--[[
_______ ______ ______ _____ _ _ _______ ______ ______ _____ _ _
| |______ |_____] |_____/ | |____/ |_____| |_____] |_____/ | | |____/
|_____ |______ |_____] | \_ __|__ | \_ | | |_____] | \_ |_____| | \_
MIT License
Copyright (c) 2018 BinarySpace
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--]]
local Brikabrok = LibStub("AceAddon-3.0"):GetAddon("Brikabrok")
local StdUi = LibStub('StdUi');
brikabrokGlances = {
["AUR00001"] = { -- Test 1
["Description"] = "Un état vide, sans aucune données.",
["Nom"] = "État",
["bAjout"] = false,
},
-----------------------
-- BORDEL : 00010 à 00100
-----------------------
["AUR00010"] = { -- Vêtement en feu
["Type"] = 1,
["Description"] = "Une partie des vêtements de ce personnage sont en flammes.",
["Nom"] = "Vêtements en feu",
["OnLifeTimeEffet"] = "texte$Vos vêtements ne sont plus en flammes.$1;",
["Createur"] = "Telkostrasz",
["OnUpdateCondi"] = "rand$<=$20;",
["Icone"] = "INV_Fabric_Spellfire",
["OnUpdateEffet"] = "aura$AUR00011$0$1$1;",
["OnReceiveEffet"] = "parole$voit ses vêtements prendre feu !$2;texte${r}Vos vêtements prennent feu !$3;son$Sound\\\\Spells\\\\FireWardTarget.wav$2$12;",
},
["AUR00011"] = { -- Blessure : Brulure fraiche
["Nom"] = "Brûlure fraîche",
["Type"] = 1,
["EtatCat"] = 7,
["Description"] = "Ce personnage a récemment été brûlé. Cette brûlure n'a pas encore été traitée.",
["Icone"] = "Spell_Fire_Incinerate",
["Createur"] = "Telkostrasz",
["OnDestroyEffet"] = "texte$Votre brûlure est guérie.$1;",
},
["AUR00012"] = { -- Plaie à l'oeil gauche
["Type"] = 1,
["Description"] = "Une coupure légère au niveau de l'oeil gauche.\nVisibilité réduite.",
["Icone"] = "Ability_Rogue_BloodyEye",
["EtatCat"] = 7,
["Nom"] = "Plaie à l'oeil gauche",
["Createur"] = "Telkostrasz",
},
["AUR00013"] = { -- Plaie à l'oeil droit
["Type"] = 1,
["Description"] = "Une coupure légère au niveau de l'oeil droit.\nVisibilité réduite.",
["Icone"] = "Ability_Rogue_BloodyEye",
["EtatCat"] = 7,
["Nom"] = "Plaie à l'oeil droit",
["Createur"] = "Telkostrasz",
},
["AUR00014"] = { -- Fumée du sèche-cheveux
["EtatCat"] = 12,
["Type"] = 1,
["Description"] = "Cette personne est couverte d'une épaisse couche de poussières et de cendres.",
["Date"] = "25/05/11, 00:26:07 par Telkostrasz",
["Nom"] = "Poussières et cendres",
["Createur"] = "Telkostrasz",
["OnUpdateCondi"] = "isswimming$==$\"1\";",
["Icone"] = "inv_misc_dust",
["DureeDefaut"] = 20,
["OnUpdateEffet"] = "aura$AUR00014$0$2$1;texte${me} est maintenant propre après son passage dans l'eau.$1;son$Sound\\\\Spells\\\\WaterElementalLow_Imapct_Base2.wav$1$0;",
},
-----------------------
-- Humeur et emotions et comportements : 00501 à 00550
-----------------------
-- Comportement
["AUR00501"] = { -- Apathique
["Createur"] = "Telkosträsz",
["Description"] = "Ce personnage est mou, totalement amorphe.",
["Icone"] = "Spell_Shadow_MindSteal",
["Nom"] = "Apathique",
["EtatCat"] = 5,
},
["AUR00511"] = { -- Calme
["Createur"] = "Telkosträsz",
["Description"] = "Ce personnage est calme.",
["Icone"] = "Ability_Mage_PotentSpirit",
["Nom"] = "Calme",
["EtatCat"] = 5,
},
["AUR00512"] = { -- Agité
["Createur"] = "Telkosträsz",
["Description"] = "Ce personnage est très agité. Il ne tient pas en place.",
["Icone"] = "Achievement_BG_captureflag_EOS",
["Nom"] = "Agité",
["EtatCat"] = 5,
},
["AUR00509"] = { -- Dans la lune
["Createur"] = "Ænys",
["Description"] = "Ce personnage est dans la lune, perdu dans ses pensées.",
["Icone"] = "Ability_Druid_Eclipse",
["Nom"] = "Dans la lune",
["EtatCat"] = 5,
},
["AUR00504"] = { -- Aux aguets
["Description"] = "Ce personnage est attentif à tout ce qui se passe autour de lui ... Il peut être très réactif en cas de problème.",
["Icone"] = "Ability_Druid_SupriseAttack",
["Nom"] = "Aux aguets",
["Createur"] = "Elindorië",
["EtatCat"] = 5,
},
["AUR00513"] = { -- Observateur
["Createur"] = "Kâsu",
["Description"] = "Ce personnage observe tranquillement les gens autours de lui en faisant attention aux moindres détails.",
["Icone"] = "ACHIEVEMENT_GUILDPERK_EVERYONES A HERO_RANK2",
["Nom"] = "Observateur",
["EtatCat"] = 5,
},
["AUR00514"] = { -- Timbré
["Createur"] = "Anundæl",
["Description"] = "Ce personnage a peut-être une case en moins, une pathologie particulière ou une mentalité hors des sentiers battus. Mieux vaut garder ses distances.",
["Icone"] = "INV_Misc_Ticket_Tarot_Madness",
["Nom"] = "Timbré",
["EtatCat"] = 5,
},
["AUR00516"] = { -- Farceur
["Createur"] = "Fimble",
["Description"] = "Toujours prêt à rire de quelque chose ou quelqu'un, ou à tourner des paroles en ridicule.",
["Icone"] = "Achievement_Character_Gnome_Male",
["Nom"] = "Farceur",
["EtatCat"] = 5,
},
["AUR00518"] = { -- Ivre
["Createur"] = "Telkostrasz",
["Description"] = "Ce personnage est complèment ivre !",
["Icone"] = "INV_Drink_29_SunkissedWine",
["Nom"] = "Ivre mort",
["EtatCat"] = 5,
["Type"] = 1,
},
-- Humeur
["AUR00517"] = { -- Amoureux
["Createur"] = "Märion",
["Description"] = "Ce personnage est amoureux, et cela se voit !",
["Icone"] = "Achievement_WorldEvent_Valentine",
["Nom"] = "Amoureux",
["EtatCat"] = 6,
},
["AUR00502"] = { -- Content
["Createur"] = "Telkosträsz",
["Description"] = "Ce personnage est heureux et de bonne humeur.",
["Icone"] = "Spell_Shaman_GiftEarthmother",
["Nom"] = "Content",
["EtatCat"] = 6,
},
["AUR00505"] = { -- Colère
["Createur"] = "Telkosträsz",
["Description"] = "Ce personnage est en colère.",
["Icone"] = "Spell_Misc_EmotionAngry",
["Nom"] = "En colère",
["EtatCat"] = 6,
},
["AUR00506"] = { -- Triste
["Createur"] = "Telkosträsz",
["Description"] = "Ce personnage est triste.",
["Icone"] = "Spell_Misc_EmotionSad",
["Nom"] = "Triste",
["EtatCat"] = 6,
},
["AUR00508"] = { -- Impassible
["Createur"] = "Telkosträsz",
["Description"] = "Quelle que soit son humeur, ce personnage la cache derrière un visage fermé et inexpressif.",
["Icone"] = "Ability_Rogue_Disguise",
["Nom"] = "Impassible",
["EtatCat"] = 6,
},
["AUR00510"] = { -- Affectueux
["Createur"] = "Telkosträsz",
["Description"] = "Ce personnage montre de affection à tout ce qui l'entoure.",
["Icone"] = "INV_ValentinesCandy",
["Nom"] = "Affectueux",
["EtatCat"] = 6,
},
-- ACTION
["AUR00515"] = { -- Fume le cigare
["Createur"] = "Darnat",
["Description"] = "Qui a dit que fumer nuisait à la santé ?",
["Icone"] = "INV_Misc_Flute_01",
["Nom"] = "Fume le cigare",
["EtatCat"] = 13,
},
-- Odeur : 00551 à 00600
["AUR00551"] = { -- Sang
["Createur"] = "Telkostrasz",
["Description"] = "Ce personnage est poursuivi par une odeur de sang séché.",
["Icone"] = "Spell_Shadow_BloodBoil",
["Nom"] = "Odeur de sang",
["EtatCat"] = 4,
},
["AUR00552"] = { -- Tabac
["Createur"] = "Telkostrasz",
["Description"] = "Une vieille odeur de tabac froid émane de ce personnage.",
["Icone"] = "INV_Misc_Dust_02",
["Nom"] = "Odeur de tabac",
["EtatCat"] = 4,
},
["AUR00553"] = { -- Fromage
["Createur"] = "Telkostrasz",
["Description"] = "Ce personnage sent le fromage fort !",
["Icone"] = "INV_Misc_Food_03",
["Nom"] = "Odeur de fromage",
["EtatCat"] = 4,
},
["AUR00554"] = { -- Rose
["Description"] = "Une odeur de rose émane de ce personnage.",
["Icone"] = "INV_RoseBouquet01",
["Nom"] = "Odeur de rose",
["Createur"] = "Ulra",
["EtatCat"] = 4,
},
["AUR00555"] = { -- Printemps
["Createur"] = "Bérénisse",
["Description"] = "Une fraiche odeur fleurie et légère émane de cette personne.",
["Icone"] = "INV_Misc_TrailofFlowers",
["Nom"] = "Odeur du printemps",
["EtatCat"] = 4,
},
["AUR00556"] = { -- Foret
["Description"] = "Une odeur de fleur pafumée, de forêt et d'une piquante et fraiche rosée se fait sentir sur ce personnage.",
["Icone"] = "Ability_Druid_Flourish",
["Nom"] = "Odeur de la forêt",
["Createur"] = "Nandieb",
["EtatCat"] = 4,
},
["AUR00557"] = { -- Cadavre
["Description"] = "Ce personnage dégage une odeur de cadavre en putréfaction.",
["Icone"] = "Spell_Shadow_DeathCoil",
["Nom"] = "Odeur de cadavre",
["Createur"] = "Telkostrasz",
["EtatCat"] = 4,
},
["AUR00558"] = { -- Œuf pourri
["Description"] = "Ce personnage dégage une atroce odeur d'œuf pourri.",
["Icone"] = "Achievement_Halloween_RottenEgg_01",
["Nom"] = "Odeur d'œuf pourri",
["Createur"] = "Telkostrasz",
["EtatCat"] = 4,
},
["AUR00559"] = { -- Viande fraiche
["Description"] = "Une belle odeur de viande fraiche émane de ce personnage.",
["Icone"] = "INV_Misc_Food_Meat_Raw_03",
["Nom"] = "Odeur de viande fraiche",
["Createur"] = "Telkostrasz",
["EtatCat"] = 4,
},
["AUR00560"] = { -- Poisson
["Description"] = "Ce personnage sent le poisson frais !",
["Icone"] = "INV_Misc_Fish_17",
["Nom"] = "Odeur de poisson frais",
["Createur"] = "Telkostrasz",
["EtatCat"] = 4,
},
["AUR00561"] = { -- Mer
["Description"] = "Une fine odeur d'eau salée et de crustacé émane de cette personne.",
["Icone"] = "INV_Misc_Fish_15",
["Nom"] = "Odeur de la mer",
["Createur"] = "Telkostrasz",
["EtatCat"] = 4,
},
["AUR00562"] = { -- Animal
["Description"] = "Ce personnage dégage une odeur d'animal.",
["Icone"] = "Ability_Hunter_CatlikeReflexes",
["Nom"] = "Odeur d'animal",
["Createur"] = "Telkostrasz",
["EtatCat"] = 4,
},
-- Maladie 00601 à 00700
["AUR00601"] = { -- Rhume
["Description"] = "Ce personnage montre les symptômes d'un gros rhume : nez qui coule, toux passagère et parfois des petites montées de fièvre.",
["Icone"] = "INV_Elemental_Mote_Water01",
["Nom"] = "Rhume",
["Createur"] = "Telkostrasz",
["EtatCat"] = 8,
["Type"] = 1,
},
["AUR00602"] = { -- Asthme
["Description"] = "Cette personne est très rapidemment essouflée. Elle souffre aussi de crises d'asthme passagères.",
["Icone"] = "inv_misc_volatileair",
["Nom"] = "Asthme",
["Createur"] = "Telkostrasz",
["EtatCat"] = 8,
["Type"] = 1,
},
-- Malédictions 00701 à 00800
["AUR00701"] = { -- Malédiction de douleur
["Description"] = "Des illusions dévorent le corps de cette personne, mais la douleur est bien réelle...",
["Icone"] = "Ability_Vanish",
["Nom"] = "Malédiction de douleur",
["Createur"] = "Knilthas",
["EtatCat"] = 9,
["Type"] = 1,
},
["AUR00702"] = { -- Malédiction de désespoir
["Description"] = "Des voix internes rabaissent sans arrêt ce personnage.",
["Icone"] = "Spell_Holy_PrayerofShadowProtection",
["Nom"] = "Malédiction de désespoir",
["Createur"] = "Knilthas",
["EtatCat"] = 9,
["Type"] = 1,
},
["AUR00703"] = { -- Malédiction de l'ombre
["Description"] = "Tout sort de soin dirigé vers ce personnage le blesse.",
["Icone"] = "Ability_Rogue_EnvelopingShadows",
["Nom"] = "Malédiction de l'ombre",
["Createur"] = "Telkostrasz",
["EtatCat"] = 9,
["Type"] = 1,
},
-- Magie 00801 à 00900
["AUR00801"] = { -- Silence
["Description"] = "Une magie empêche ce personnage d'incanter des sorts.",
["Icone"] = "SPELL_HOLY_SILENCE",
["Nom"] = "Silence",
["Createur"] = "Knilthas",
["EtatCat"] = 10,
["Type"] = 1,
},
["AUR00802"] = { -- Miniature
["Description"] = "Une magie a diminué la taille de ce personnage !",
["Icone"] = "INV_Gizmo_Poltryiser_01",
["Nom"] = "Miniaturisé",
["Createur"] = "Knilthas",
["EtatCat"] = 10,
["Type"] = 1,
},
["AUR00803"] = { -- Lenteur
["Description"] = "Des chaines magiques sont appliquées aux membres moteurs de ce personnage. Il est ralenti dans ses mouvements.",
["Icone"] = "Spell_Nature_TimeStop",
["Nom"] = "Lenteur",
["Createur"] = "Knilthas",
["EtatCat"] = 10,
["Type"] = 1,
},
["AUR00804"] = { -- Illusion
["Description"] = "Ce personnage cache quelque chose sous une toile illusoire, ceux qui y sont sensibles sentiront que quelque chose cloche.",
["Icone"] = "INV_Inscription_TarotIllusion",
["Nom"] = "Illusion",
["Createur"] = "Céralynde",
["EtatCat"] = 10,
["Type"] = 2,
},
-- Apparence : 00901 à 01000
["AUR00503"] = { -- Fatigue
["Description"] = "Ce personnage est fatigué. Il n'a apparemment pas dormi depuis longtemps.",
["Icone"] = "Spell_Nature_Sleep",
["Nom"] = "Fatigue",
["Createur"] = "Telkostrasz",
["EtatCat"] = 11,
},
["AUR00901"] = { -- Sourire éclatant
["Description"] = "Cette personne a visiblement une excellente hygiène buccale. Son sourire est éclatant !",
["Icone"] = "Achievement_Halloween_Smiley_01",
["Nom"] = "Sourire éclatant",
["Createur"] = "Telkostrasz",
["EtatCat"] = 11,
["Type"] = 3,
},
["AUR00902"] = { -- Silhouette musclée
["Description"] = "Ce personnage fait de la gonflette, et cela se voit !",
["Icone"] = "Spell_Nature_Strength",
["Nom"] = "Silhouette musclée",
["Createur"] = "Telkostrasz",
["EtatCat"] = 11,
["Type"] = 3,
},
["AUR00903"] = { -- Soin de l'apparence
["Description"] = "Ce personnage attache visiblement beaucoup d'importance à son apparence.",
["Icone"] = "Achievement_BG_most_damage_killingblow_dieleast",
["Nom"] = "Soin de l'apparence",
["Createur"] = "Telkostrasz",
["EtatCat"] = 11,
["Type"] = 3,
},
["AUR00904"] = { -- Peinture de guerre
["Description"] = "Ce personnage porte des peintures de guerre sur le visage.",
["Icone"] = "ability_rogue_preparation",
["Nom"] = "Peintures de guerre",
["Createur"] = "Telkostrasz",
["EtatCat"] = 11,
["Type"] = 2,
},
["AUR00905"] = { -- Trempé
["Description"] = "Ce personnage est trempé.",
["Icone"] = "inv_misc_volatilewater",
["Nom"] = "Trempé jusqu'aux os",
["Createur"] = "Telkostrasz",
["EtatCat"] = 11,
["Type"] = 2,
},
["AUR00906"] = { -- Richesse
["Createur"] = "Telkostrasz",
["Description"] = "Vêtements de qualité, bourse bien remplie ... Tout indique que ce personnage n'a aucun soucis financier, bien au contraire !",
["Icone"] = "ACHIEVEMENT_GUILDPERK_CASHFLOW_RANK2",
["Nom"] = "Richesse",
["EtatCat"] = 11,
},
["AUR00907"] = { -- Pauvreté
["Createur"] = "Telkostrasz",
["Description"] = "Vêtements sales et troués, estomac qui gronde ... Tout indique que ce personnage est sans le sou.",
["Icone"] = "INV_Misc_Pelt_Bear_Ruin_05",
["Nom"] = "Pauvreté",
["EtatCat"] = 11,
},
["AUR00908"] = { -- Pupille dilatée
["Description"] = "Ce personnage a les pupilles dilatées.",
["Icone"] = "Ability_Hunter_BeastWithin",
["Nom"] = "Mydriase",
["Createur"] = "Damön",
["EtatCat"] = 11,
["Type"] = 1,
},
-- Aura 01001 à 01100
["AUR01001"] = { -- Confiance
["Description"] = "Cette personne dégage une aura inspirant la confiance.",
["Icone"] = "Spell_Holy_AuraMastery",
["Nom"] = "Confiance",
["Createur"] = "Telkostrasz",
["EtatCat"] = 14,
["Type"] = 2,
},
["AUR01002"] = { -- Louche
["Description"] = "Ce personne n'a pas l'air net. Il inspire la méfiance.",
["Icone"] = "Ability_Rogue_WrongfullyAccused",
["Nom"] = "Louche",
["Createur"] = "Telkostrasz",
["EtatCat"] = 14,
["Type"] = 2,
},
-- Symptômes 01101 à 01200
["AUR01101"] = { -- Paralysie
["Description"] = "Cette personne est paralisée et est incapable de bouger. Ses muscles sont crispés et ne répondent plus.",
["Icone"] = "Ability_Rogue_DeadenedNerves",
["Nom"] = "Paralysie",
["Createur"] = "Knilthas",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR01102"] = { -- Engourdissement
["Description"] = "Les membres de cette personne sont engourdis. Il a difficile à se mouvoir et son sens du toucher est affecté.",
["Icone"] = "Spell_Frost_ManaRecharge",
["Nom"] = "Engourdissements",
["Createur"] = "Knilthas",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR01103"] = { -- Affaiblissement
["Description"] = "Ce personnage est affaiblit. Sa vivacité est diminuée, tout comme ses réflexes.",
["Icone"] = "Spell_Shadow_ManaFeed",
["Nom"] = "Affaiblissement",
["Createur"] = "Knilthas",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR01104"] = { -- Somnolence
["Description"] = "La somnolence s'acharne sur ce personnage. Il a du mal à rester éveillé et concentré.",
["Icone"] = "Spell_Nature_Polymorph",
["Nom"] = "Somnolence",
["Createur"] = "Knilthas",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR01105"] = { -- Surdité
["Description"] = "Ce personnage a perdu partiellement ses capacités auditives.",
["Icone"] = "INV_Misc_Ear_Human_02",
["Nom"] = "Surdité",
["Createur"] = "Knilthas",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR01106"] = { -- Cécité
["Description"] = "Cette personne a partiellement (ou totalement) perdu la vue.",
["Icone"] = "Spell_Arcane_Blink",
["Nom"] = "Cécité",
["Createur"] = "Telkostrasz",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR01107"] = { -- Aphasie
["Description"] = "Ce personnage a perdu l'usage de la parole.",
["Icone"] = "Ability_Priest_Silence",
["Nom"] = "Aphasie",
["Createur"] = "Telkostrasz",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR01108"] = { -- Nausée
["Description"] = "Cette personne est parfois prise de vomissements.",
["Icone"] = "Spell_Shadow_SoulLeech",
["Nom"] = "Nausée",
["Createur"] = "Telkostrasz",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR01109"] = { -- Fièvre
["Description"] = "Cette personne est fiévreuse.",
["Icone"] = "Spell_Shadow_MindRot",
["Nom"] = "Fièvre",
["Createur"] = "Telkostrasz",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR01110"] = { -- Toux faible
["Description"] = "Cette personne tousse de temps en temps.",
["Icone"] = "Ability_Rogue_MasterOfSubtlety",
["Nom"] = "Faible toux",
["Createur"] = "Telkostrasz",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR00507"] = { -- Migraine
["Type"] = 1,
["Description"] = "Ce personnage souffre d'une migraine abominable.",
["Icone"] = "Spell_Arcane_MindMastery",
["Nom"] = "Migraine",
["Createur"] = "Telkostrasz",
["EtatCat"] = 16,
},
["AUR00015"] = { -- Boiter
["Type"] = 1,
["Description"] = "Ce personnage boite et risque parfois de trébucher lors de ses déplacements.",
["Icone"] = "Ability_Rogue_Trip",
["Nom"] = "Boiteux",
["Createur"] = "Telkostrasz",
["OnUpdateCondi"] = "rand$<=$2;speed$>$0;ismount$~=$\"1\"",
["OnUpdateEffet"] = "parole${randtext:trébuche+trébuche mais retrouve aussitôt son équilibre+trébuche et perd son équilibre+trébuche, perd son équilibre et s'étale lamentablement par terre}.$2;",
["EtatCat"] = 16,
},
["AUR01111"] = { -- Amnésie partielle
["Description"] = "Cette personne a actuellement perdu une partie de ses souvenirs.",
["Icone"] = "Ability_Druid_Dreamstate",
["Nom"] = "Amnésie passagère",
["Createur"] = "Telkostrasz",
["EtatCat"] = 16,
["Type"] = 1,
},
["AUR01112"] = { -- Amnésie totale
["Description"] = "Cette personne a perdu toute sa mémoire. Elle ne sait même plus qui elle est.",
["Icone"] = "Ability_Druid_Dreamstate",
["Nom"] = "Amnésie totale",
["Createur"] = "Telkostrasz",
["EtatCat"] = 16,
["Type"] = 1,
},
----------------------
-- Partagés par Lady Kara
----------------------
["AUR04334"] = {
["EtatCat"] = 4,
["Type"] = 3,
["Description"] = "Le doux et reposant parfum du thé pandaren émane de ce personnage.",
["Icone"] = "INV_Drink_25_HoneyTea",
["Date"] = "10/11/12, 19:40:57 par Oruku",
["Nom"] = "Odeur de thé",
["VerNum"] = 2,
["Createur"] = "Oruku",
},
["AUR04038"] = {
["EtatCat"] = 5,
["Type"] = 1,
["Description"] = "Ce personnage est mélancolique et son esprit est dévoré par ses sentiments négatifs.",
["Icone"] = "achievement_boss_devourerofsouls",
["Date"] = "20/10/13, 03:06:55 par Gueulelune",
["Nom"] = "Dévoré(e) par l'amertume",
["Createur"] = "Gueulelune",
["VerNum"] = 3,
},
["AUR04572"] = {
["EtatCat"] = 12,
["Createur"] = "Faraa",
["Description"] = "Ce personnage a un totem accroché dans le dos. Il s'agit peut-être d'un chaman.",
["Icone"] = "Spell_Shaman_TotemRecall",
["Date"] = "07/01/13, 06:19:29 par Faraa",
["Nom"] = "Totem",
["VerNum"] = 2,
},
["AUR04933"] = {
["EtatCat"] = 12,
["Type"] = 3,
["Description"] = "Ce personnage porte des distinctions militaires. Il est au moins un soldat reconnu de sa faction.",
["Icone"] = "ACHIEVEMENT_GUILDPERK_HONORABLEMENTION_RANK2",
["Date"] = "28/09/11, 14:34:50 par Galeb",
["Nom"] = "Distinctions",
["VerNum"] = 2,
["Createur"] = "Galeb",
},
["AUR04639"] = {
["EtatCat"] = 5,
["Createur"] = "Faraa",
["Description"] = "Ce personnage est un grunt de la Horde.",
["Icone"] = "INV_Shoulder_Leather_Horde_B_03",
["Date"] = "07/01/13, 06:22:58 par Faraa",
["Nom"] = "Grunt",
["VerNum"] = 2,
},
["AUR04919"] = {
["EtatCat"] = 11,
["Type"] = 3,
["Description"] = "Ce personnage porte des vêtements en tissu de haute qualité!",
["Icone"] = "INV_Chest_Cloth_44",
["Date"] = "13/11/11, 01:41:58 par Gueulelune",
["Nom"] = "Tissu de haute qualité",
["VerNum"] = 2,
["Createur"] = "Gueulelune",
},
["AUR04825"] = {
["EtatCat"] = 12,
["Createur"] = "Lightshope",
["Description"] = "Ce personnage a des rouleaux de bandages accroché à sa ceinture ou dans son sac..",
["Icone"] = "inv_misc_bandage_01",
["Date"] = "05/01/14, 02:07:40 par Lightshope",
["Nom"] = "Rouleaux de bandages",
["VerNum"] = 2,
},
["AUR04543"] = {
["EtatCat"] = 10,
["Createur"] = "Arakara",
["Description"] = "En vous approchant de ce personnage, vous ressentez une forte attirance, et il ou elle prend l'apparence de ce qui vous attire.",
["Icone"] = "INV_ValentinesBoxOfChocolates02",
["Date"] = "30/12/12, 21:32:42 par Arakara",
["Nom"] = "Aura envoutante",
["VerNum"] = 2,
},
["AUR04907"] = {
["EtatCat"] = 12,
["Createur"] = "Faraa",
["Description"] = "Ce personnage porte une sacoche pleine d'herbes et de plantes au niveau de la hanche.",
["Icone"] = "INV_Misc_Bag_HerbPouch",
["Date"] = "07/01/13, 06:39:13 par Faraa",
["Nom"] = "Sacoche d'herbes",
["VerNum"] = 3,
},
["AUR04586"] = {
["EtatCat"] = 12,
["Createur"] = "Gueulelune",
["Description"] = "Ce personnage porte une sacoche à la ceinture. Si vous avez une affinité avec les esprits ou avec les Arcanes, vous pouvez sentir qu'il contient des éclats d'âmes.",
["Icone"] = "INV_Misc_Bag_Soulbag",
["Date"] = "19/07/12, 15:19:06 par Gueulelune",
["Nom"] = "Sacoche d'âmes",
["VerNum"] = 2,
},
["AUR04094"] = {
["EtatCat"] = 4,
["Type"] = 1,
["Description"] = "Ce personnage empeste l'alcool. Yerk!",
["Icone"] = "INV_Drink_05",
["Date"] = "28/09/11, 14:44:04 par Galeb",
["Nom"] = "Odeur d'alcool",
["VerNum"] = 2,
["Createur"] = "Galeb",
},
["AUR04173"] = {
["EtatCat"] = 14,
["Createur"] = "Faraa",
["Description"] = "Ce personnage porte une rune de feu qui l'entoure d'une aura ardente.",
["Icone"] = "Spell_Fire_Rune",
["Date"] = "07/01/13, 06:15:30 par Faraa",
["Nom"] = "Rune de Feu",
["VerNum"] = 2,
},
["AUR04436"] = {
["EtatCat"] = 9,
["Type"] = 1,
["Description"] = "L'âme de ce personnage est retenue par un autre, et doit ainsi obéir à des ordres qui ne sont pas les siens. Un tel sort ne peut pas être dissipé.",
["Icone"] = "ability_warlock_soulsiphon",
["Date"] = "30/12/12, 21:37:03 par Arakara",
["Nom"] = "Âme prisonnière",
["Createur"] = "Arakara",
["VerNum"] = 2,
},
["AUR04375"] = {
["EtatCat"] = 12,
["Createur"] = "Galeb",
["Description"] = "Ce personnage porte des bandages.",
["Icone"] = "INV_Misc_Bandage_15",
["Date"] = "28/09/11, 15:07:15 par Galeb",
["Nom"] = "Couvert de bandages",
["VerNum"] = 3,
},
["AUR04196"] = {
["EtatCat"] = 4,
["Createur"] = "Baboullinet",
["Description"] = "Ce personnage sent la poudre à canon. Il a dû manipuler des explosifs récemment.",
["Icone"] = "Ability_Vehicle_SiegeEngineCannon",
["Date"] = "28/09/11, 16:03:31 par Baboullinet",
["Nom"] = "Odeur de poudre à canon",
["VerNum"] = 3,
},
["AUR04136"] = {
["EtatCat"] = 12,
["Type"] = 1,
["Description"] = "L'armure de ce personnage a apparemment du vécu. On peut y voir des marques de combats passés.",
["Icone"] = "Trade_Archaeology_GeneralBeauregardsLastStand",
["Date"] = "28/09/11, 15:15:54 par Galeb",
["Nom"] = "Armure abîmée",
["VerNum"] = 2,
["Createur"] = "Galeb",
},
["AUR04889"] = {
["EtatCat"] = 12,
["Createur"] = "Argalist",
["Description"] = "Ce personnage porte une sacoche pleine de parchemins. Il s'agit probablement d'un coursier ou d'un calligraphe.",
["Icone"] = "inv_misc_enchantedscroll",
["Date"] = "15/12/12, 05:09:39 par Argalist",
["Nom"] = "Rouleaux de parchemins",
["VerNum"] = 3,
},
["AUR04320"] = {
["EtatCat"] = 12,
["Type"] = 3,
["Description"] = "L'armure et les armes de ce personnage portent de puissants enchantement. Impressionant!",
["Icone"] = "INV_Enchant_EssenceAstralLarge",
["Date"] = "28/09/11, 15:27:05 par Galeb",
["Nom"] = "Enchanté",
["VerNum"] = 2,
["Createur"] = "Galeb",
},
["AUR04417"] = {
["EtatCat"] = 11,
["Type"] = 3,
["Description"] = "Ce personnage est très réputé! Vous le connaissez sans doute déjà de nom.",
["Icone"] = "Achievement_Reputation_08",
["Date"] = "28/09/11, 14:36:55 par Galeb",
["Nom"] = "Réputé",
["VerNum"] = 2,
["Createur"] = "Galeb",
},
["AUR04305"] = {
["EtatCat"] = 11,
["Type"] = 3,
["Description"] = "Ce personnage est un druide accomplit! Des ramures de cerf poussent sur son front.",
["Icone"] = "TRADE_ARCHAEOLOGY_ANTLEREDCLOAKCLASP",
["Date"] = "28/09/11, 15:23:13 par Galeb",
["Nom"] = "Ramures de cerf",
["VerNum"] = 2,
["Createur"] = "Galeb",
},
["AUR04901"] = {
["Createur"] = "Balsey",
["Description"] = "Ce personnage fait parti de la Croisade écarlate.",
["Icone"] = "INV_Misc_Token_ScarletCrusade",
["Date"] = "05/03/12, 21:46:44 par Balsey",
["Nom"] = "Croisade écarlate",
["VerNum"] = 2,
},
["AUR04205"] = {
["EtatCat"] = 12,
["Createur"] = "Faraa",
["Description"] = "Ce personnage porte un médaillon qui montre son appartenance au Clan Loup-de-Givre des montagnes d'Altérac.",
["Icone"] = "INV_Jewelry_FrostwolfTrinket_01",
["Date"] = "07/01/13, 06:36:35 par Faraa",
["Nom"] = "Clan Loup-de-Givre",
["VerNum"] = 2,
},
["AUR04058"] = {
["EtatCat"] = 9,
["Createur"] = "Arakara",
["Description"] = "Ce personnage a vu son âme brisée et n'est à présent plus que l'ombre de lui-même.",
["Icone"] = "Ability_Warlock_ImprovedSoulLeech",
["Date"] = "30/12/12, 21:39:44 par Arakara",
["Nom"] = "Âme brisée",
["VerNum"] = 2,
},
["AUR04911"] = {
["EtatCat"] = 12,
["Createur"] = "Galeb",
["Description"] = "Ce personnage porte des fioles à la ceinture. Sans doute un alchimiste ou un apothicaire.",
["Icone"] = "ACHIEVEMENT_GUILDPERK_CHUG A LUG_RANK2",
["Date"] = "28/09/11, 14:33:39 par Galeb",
["Nom"] = "Chimiste",
["VerNum"] = 2,
},
["AUR04156"] = {
["EtatCat"] = 5,
["Createur"] = "Valmadra",
["Description"] = "Ce personnage, probablement un druide ou une druidesse, est capable de passer d'une forme à une autre.",
["Icone"] = "spell_druid_wildcharge",
["Date"] = "15/11/13, 23:31:40 par Valmadra",
["Nom"] = "Changeforme",
["VerNum"] = 2,
},
["AUR04363"] = {
["EtatCat"] = 12,
["Createur"] = "Gueulelune",
["Description"] = "Ce personnage porte un médaillon des Réprouvés... comme trophée ou comme preuve d'allégeance?",
["Icone"] = "Inv_Misc_Tournaments_Symbol_Scourge",
["Date"] = "05/01/13, 21:23:27 par Gueulelune",
["Nom"] = "Médaillon Réprouvé",
["VerNum"] = 4,
},
["AUR04662"] = {
["EtatCat"] = 11,
["Createur"] = "Baboullinet",
["Description"] = "Ce personnage transpire en abondance.",
["Icone"] = "Spell_Nature_FocusedMind",
["Date"] = "28/09/11, 16:20:52 par Baboullinet",
["Nom"] = "En sueur",
["VerNum"] = 2,
},
["AUR04168"] = {
["EtatCat"] = 11,
["Type"] = 3,
["Description"] = "Ce personnage porte des bijoux. Magnifique!",
["Icone"] = "inv_jewelry_necklace_110",
["Date"] = "15/11/13, 23:36:45 par Valmadra",
["Nom"] = "Bijoux",
["VerNum"] = 2,
["Createur"] = "Valmadra",
},
["AUR04158"] = {
["EtatCat"] = 14,
["Type"] = 3,
["Description"] = "Si vous avez une affinité avec les éléments, vous pouvez sentir que ce personnage est très proche des éléments.",
["Icone"] = "spell_Shaman_convection",
["Date"] = "28/09/11, 14:27:27 par Galeb",
["Nom"] = "Aura élémentaire",
["VerNum"] = 2,
["Createur"] = "Galeb",
},
["AUR04162"] = {
["EtatCat"] = 14,
["Type"] = 3,
["Description"] = "Une puissante aura arcanique émane de ce personnage.",
["Icone"] = "Spell_Arcane_FocusedPower",
["Date"] = "06/03/11, 20:39:06 par Norah",
["Nom"] = "Aura des arcanes",
["Createur"] = "Norah",
["VerNum"] = 3,
},
["AUR04720"] = {
["EtatCat"] = 14,
["Createur"] = "Faraa",
["Description"] = "Ce personnage porte une rune des Arcanes qui l'entoure d'une aura magique.",
["Icone"] = "Spell_Arcane_Rune",
["Date"] = "07/01/13, 06:16:37 par Faraa",
["Nom"] = "Rune des Arcanes",
["VerNum"] = 2,
},
["AUR04438"] = {
["EtatCat"] = 5,
["Createur"] = "Faraa",
["Description"] = "Cet animal est dressé pour le combat, pour servir d'animal de compagnie ou de monture.",
["Icone"] = "Ability_Hunter_BeastTaming",
["Date"] = "08/01/13, 04:14:38 par Faraa",
["Nom"] = "Dressé",
["VerNum"] = 2,
},
["AUR04604"] = {
["EtatCat"] = 11,
["Createur"] = "Abittbol",
["Description"] = "Ce personnage est taché de sang.",
["Icone"] = "Ability_Warrior_BloodFrenzy",
["Date"] = "09/03/12, 18:31:43 par Abittbol",
["Nom"] = "Taches de sang",
["VerNum"] = 2,
},
["AUR04291"] = {
["EtatCat"] = 5,
["Createur"] = "Galeb",
["Description"] = "Ce personnage rigole pour un rien!",
["Icone"] = "INV_Misc_Ticket_Tarot_Lunacy",
["Date"] = "28/09/11, 15:28:44 par Galeb",
["Nom"] = "Humour facile",
["VerNum"] = 2,
},
["AUR04492"] = {
["EtatCat"] = 14,
["Createur"] = "Faraa",
["Description"] = "Ce personnage porte une Rune de Nature qui l'entoure d'une aura sauvage.",
["Icone"] = "Spell_Nature_Rune",
["Date"] = "07/01/13, 06:15:00 par Faraa",
["Nom"] = "Rune de Nature",
["VerNum"] = 3,
},
["AUR04245"] = {
["EtatCat"] = 4,
["Type"] = 3,
["Description"] = "Ce personnage est impregné de l'odeur du bon houblon, comme une bière faite avec passion! Ça peut donner envie de faire un tour à l'auberge du coin!",
["Icone"] = "INV_Drink_16",
["Date"] = "10/11/12, 19:44:41 par Oruku",
["Nom"] = "Bonne odeur de bière",
["VerNum"] = 4,
["Createur"] = "Oruku",
},
["AUR04353"] = {
["EtatCat"] = 14,
["Createur"] = "Faraa",
["Description"] = "Ce personnage porte une rune de givre qui l'entoure d'une aura glaciale.",
["Icone"] = "Spell_Ice_Rune",
["Date"] = "07/01/13, 06:14:56 par Faraa",
["Nom"] = "Rune de Givre",
["VerNum"] = 4,
},
["AUR04619"] = {
["EtatCat"] = 12,
["Createur"] = "Gueulelune",
["Description"] = "Ce personnage porte un grimoire occulte. Peut-être est-il connaisseur des arts interdits de la Nécromancie ou de la Démonologie?",
["Icone"] = "ability_warlock_ancientgrimoire",
["Date"] = "19/07/12, 12:53:05 par Gueulelune",
["Nom"] = "Grimoire sombre",
["VerNum"] = 2,
},
["AUR04312"] = {
["EtatCat"] = 12,
["Createur"] = "Galeb",
["Description"] = "Ce personnage porte des bandages couverts de tâches de sang.",
["Icone"] = "INV_Misc_Bandage_08",
["Date"] = "28/09/11, 15:07:51 par Galeb",
["Nom"] = "Couvert de bandages sanglants",
["VerNum"] = 2,
},
["AUR04942"] = {
["EtatCat"] = 11,
["Type"] = 3,
["Description"] = "Ce personnage porte des vêtements en cuir de haute qualité!",
["Icone"] = "Trade_Archaeology_Decorated Leather Boot Heel",
["Date"] = "12/11/11, 22:37:08 par Galeb",
["Nom"] = "Cuir de haute qualité",
["VerNum"] = 4,
["Createur"] = "Galeb",
},
["AUR04803"] = {
["EtatCat"] = 11,
["Type"] = 1,
["Description"] = "Ce personnage est couvert d'ichor dégoûtant et puant. Beuarh!",
["Icone"] = "Spell_DeathKnight_Explode_Ghoul",
["Date"] = "28/09/11, 14:31:18 par Galeb",
["Nom"] = "Couvert d'ichor",
["VerNum"] = 2,
["Createur"] = "Galeb",
},
["AUR04577"] = {
["EtatCat"] = 12,
["Createur"] = "Gueulelune",
["Description"] = "Ce personnage porte un grimoire de de sorcier. Peut-être est-il connaisseur des arts des Arcanes?",
["Icone"] = "INV_Misc_Book_16",
["Date"] = "19/07/12, 12:50:42 par Gueulelune",
["Nom"] = "Grimoire des arcanes",
["VerNum"] = 2,
},
["AUR04322"] = {
["EtatCat"] = 14,
["Createur"] = "Faraa",
["Description"] = "Ce personnage porte une rune d'ombre qui l'entoure d'une aura ténèbreuse.",
["Icone"] = "Spell_Shadow_Rune",
["Date"] = "07/01/13, 06:15:59 par Faraa",
["Nom"] = "Rune d'Ombre",
["VerNum"] = 2,
},
["AUR04677"] = {
["EtatCat"] = 4,
["Type"] = 1,
["Description"] = "Ce personnage empeste l'odeur du vomi. Bwerk!",
["Icone"] = "Ability_Creature_Poison_06",
["Date"] = "28/09/11, 14:52:21 par Galeb",
["Nom"] = "Odeur de gerbe",
["VerNum"] = 2,
["Createur"] = "Galeb",
},
["AUR04497"] = {
["EtatCat"] = 3,
["Createur"] = "Galeb",
["Description"] = "Ce personnage est en patrouille et maintient l'ordre dans les environs.",
["Icone"] = "Spell_Holy_Heroism",
["Date"] = "15/07/12, 20:01:37 par Galeb",
["Nom"] = "En patrouille",
["VerNum"] = 2,
},
["AUR04600"] = {
["EtatCat"] = 10,
["Createur"] = "Arakara",
["Description"] = "Ce personnage est un démon, ou a volé les pouvoirs d'un démon.",
["Icone"] = "Ability_Warlock_DemonicPower",
["Date"] = "30/12/12, 21:47:41 par Arakara",
["Nom"] = "Démoniaque",
["VerNum"] = 2,
},
["AUR04067"] = {
["EtatCat"] = 12,
["Createur"] = "Galeb",
["Description"] = "Ce personnage porte à la ceinture un marteau de forgeron, un petit sac de clous et d'autres objets utiles à un artisan.",
["Icone"] = "Ability_Repair",
["Date"] = "28/09/11, 15:00:00 par Galeb",
["Nom"] = "Artisan",
["VerNum"] = 2,
},
["AUR04322"] = {
["EtatCat"] = 11,
["Type"] = 3,
["Description"] = "Ce personnage porte une magnifique armure étincelante!",
["Icone"] = "INV_Chest_Plate03",
["Date"] = "12/11/11, 22:41:44 par Galeb",
["Nom"] = "Armure étincelante",
["VerNum"] = 3,
["Createur"] = "Galeb",
},
["AUR04939"] = {
["EtatCat"] = 14,
["Type"] = 3,
["Description"] = "En étant aux cotés de ce personnage, vous sentez une aura qui vous pousse à donner le meilleur de vous-même. Ce personnage est tellement classe, c'est inspirant!",
["Icone"] = "ACHIEVEMENT_GUILDPERK_MRPOPULARITY_RANK2",
["Date"] = "06/03/12, 12:31:43 par Abittbol",
["Nom"] = "Aura : grande classe",
["VerNum"] = 2,
["Createur"] = "Abittbol",
},
["AUR04422"] = {
["EtatCat"] = 14,
["Createur"] = "Faraa",
["Description"] = "Ce personnage porte une rune du sacré qui l'entoure d'une aura de lumière.",
["Icone"] = "Spell_Holy_Rune",
["Date"] = "07/01/13, 06:14:42 par Faraa",
["Nom"] = "Rune du Sacré",
["VerNum"] = 2,
},
["AUR04106"] = {
["EtatCat"] = 10,
["Createur"] = "Faraa",
["Description"] = "Ce personnage est entouré d'une rune de clairvoyance qui lui permet de détecter les invisibilités magiques.",
["Icone"] = "INV_Misc_Rune_03",
["Date"] = "07/01/13, 06:17:53 par Faraa",
["Nom"] = "Rune de Clairvoyance",
["VerNum"] = 3,
},
["AUR04086"] = {
["EtatCat"] = 12,
["Createur"] = "Faraa",
["Description"] = "Ce personnage porte une fourrure animale sur lui. Est-ce une peau d'ours, de loup... ou autre chose?",
["Icone"] = "INV_Misc_Pelt_10",
["Date"] = "07/01/13, 06:48:20 par Faraa",
["Nom"] = "Fourrure",
["VerNum"] = 2,
},
-----------------------
-- Quetes : 00101 à 00500
-----------------------
-- Quête : Traitresse ! Horde --
["AUR00101"] = { -- Distraction de Gryshka
["Description"] = "Ce personnage a distrait Gryshka. Il peut en profiter pour lui dérober un objet !",
["OnLifeTimeCondi"] = "queststep(QUE00003)$==$\"006\";",
["Nom"] = "Distraction : Gryshka",
["EtatCat"] = 3,
["bAjout"] = false,
["OnLifeTimeEffet"] = "quest$QUE00003$005$1;",
["Createur"] = "Telkostrasz",
["Icone"] = "Achievement_Character_Orc_Female",
["OnReceiveEffet"] = "texte$Gryshka est distraite !\nProfitez en pour la fouiller !$3;",
},
-- Quête : Traitresse ! Alliance --
["AUR00102"] = { -- Distraction de Erika
["Description"] = "Ce personnage a distrait Erika. Il peut en profiter pour lui dérober un objet !",
["OnLifeTimeCondi"] = "queststep(QUE00002)$==$\"006\";",
["Nom"] = "Distraction : Erika",
["bAjout"] = false,
["EtatCat"] = 3,
["OnLifeTimeEffet"] = "quest$QUE00002$005$1;",
["Createur"] = "Telkostrasz",
["Icone"] = "Achievement_Character_Human_Female",
["OnReceiveEffet"] = "texte$Erika est distraite !\nProfitez en pour la fouiller !$3;",
},
}
local pairs, tinsert = pairs, tinsert;
local iconPrefix = "Interface\\Icons\\"
local cleanTable = {}
function Brikabrok.cleanTable()
for _, clin in pairs(brikabrokGlances) do
if clin["Icone"] ~= nil and clin["Nom"] ~= nil then
tinsert(cleanTable, { iconTexture = iconPrefix..clin["Icone"], name = clin["Nom"]:lower(), contentSTR = clin["Description"]});
end
end
end
Brikabrok.cleanTable()
function Brikabrok.getGlancesList(filter)
-- No filter or bad filter
if filter == nil or filter:len() == 0 then
return cleanTable;
end
filter = filter:lower();
local newList = {};
for _, clin in pairs(brikabrokGlances) do
if Brikabrok.safeMatch(clin["Nom"]:lower(), filter) then
tinsert(newList, { iconTexture = iconPrefix..clin["Icone"], name = clin["Nom"], contentSTR = clin["Description"]})
end
end
return newList;
end
-- thx trp3
local ID_CHARS = {};
for i=48, 57 do
tinsert(ID_CHARS, string.char(i));
end
for i=65, 90 do
tinsert(ID_CHARS, string.char(i));
end
for i=97, 122 do
tinsert(ID_CHARS, string.char(i));
end
local sID_CHARS = #ID_CHARS;
function Brikabrok.generateID()
local ID = date("%m%d%H%M%S");
for i=1, 5 do
ID = ID .. ID_CHARS[math.random(1, sID_CHARS)];
end
return ID;
end
function Brikabrok:ShowGlancesFrame(dataType)
local buildTable = {}
local iconBrowserFrame = StdUi:Window(nil, "Brikabrok : Coup d'oeil", 800, 600);
iconBrowserFrame:SetPoint('CENTER');
local searchBox = StdUi:SearchEditBox(iconBrowserFrame, 400, 30, 'Écrivez le mot clé ici');
searchBox:SetFontSize(16);
searchBox:SetScript('OnEnterPressed', function()
local input = searchBox:GetText()
buildTable = self.getGlancesList(input)
iconBrowserFrame.searchResults:SetData(buildTable, true);
end);
StdUi:GlueTop(searchBox, iconBrowserFrame, 20, -50, 'LEFT');
local searchButton = StdUi:Button(iconBrowserFrame, 80, 30, 'Chercher');
searchButton:SetScript("OnClick", function()
local input = searchBox:GetText()
buildTable = Brikabrok.getIconList(input)
iconBrowserFrame.searchResults:SetData(buildTable, true);
end)
StdUi:GlueRight(searchButton, searchBox, 5, 0);
local addFavoritesButton = StdUi:Button(iconBrowserFrame, 30, 30, '');
addFavoritesButton.texture = StdUi:Texture(addFavoritesButton, 17, 17, [[Interface\Common\ReputationStar]]);
addFavoritesButton.texture:SetPoint('CENTER');
addFavoritesButton.texture:SetBlendMode('ADD');
addFavoritesButton.texture:SetTexCoord(0, 0.5, 0, 0.5);
StdUi:GlueRight(addFavoritesButton, searchButton, 5, 0);
local cols = {
{
name = '',
width = 48,
align = 'LEFT',
index = 'iconTexture',
format = 'icon',
sortable = false,
},
{
name = 'Nom',
width = 250,
align = 'LEFT',
index = 'name',
format = 'string',
},
{
name = 'Description',
width = 400,
align = 'LEFT',
index = 'contentSTR',
format = 'string',
},
}
iconBrowserFrame.searchResults = StdUi:ScrollTable(iconBrowserFrame, cols, 8, 50);
iconBrowserFrame.searchResults:EnableSelection(true);
StdUi:GlueBelow(iconBrowserFrame.searchResults, searchBox, 0, - 40, 'LEFT') ;
local selectionButton = StdUi:Button(iconBrowserFrame, 100, 30, 'Apprendre');
selectionButton:SetScript("OnClick", function()
local index = iconBrowserFrame.searchResults:GetSelection()
local iconData = iconBrowserFrame.searchResults:GetRow(index)
local presetID = Brikabrok.generateID();
--local glance = {}
--glance.TI = iconData.name
--glance.TX = iconData.contentSTR
--glance.IC = string.gsub(iconData.iconTexture, iconPrefix, "")
--TRP3_API.register.glance.saveSlotPreset(glance)
TRP3_Presets.peek[presetID] = {}
TRP3_Presets.peek[presetID].icon = string.gsub(iconData.iconTexture, iconPrefix, "")
TRP3_Presets.peek[presetID].title = iconData.name
TRP3_Presets.peek[presetID].text = iconData.contentSTR
if not TRP3_Presets.peekCategory["Brikabrok"] then
TRP3_Presets.peekCategory["Brikabrok"] = {};
end
tinsert(TRP3_Presets.peekCategory["Brikabrok"], presetID);
end)
StdUi:GlueBelow(selectionButton, iconBrowserFrame.searchResults, 10, -15,"CENTER");
Brikabrok.getGlancesList("")
end
function Brikabrok:commandGlances(input)
Brikabrok:ShowGlancesFrame("meme")
end
|
--[[
Copyright 2012-2015 The Luvit Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License")
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
require('tap')(function(test)
local fs = require('fs')
local Path = require('path')
local string = require('string')
local bit = require('bit')
local los = require('los')
local is_windows = los.type() == 'win32'
local __dirname = module.dir
test('fs chmod', function(expect)
local mode_async
local mode_sync
-- On Windows chmod is only able to manipulate read-only bit
-- TODO: test on windows
if is_windows then
mode_async = 256 --[[tonumber('0400', 8)]] -- read-only
mode_sync = 438 --[[tonumber('0600', 8)]] -- read-write
else
mode_async = 511 --[[tonumber('0777', 8)]]
mode_sync = 420 --[[tonumber('0644', 8)]]
end
local file1 = Path.join(__dirname, 'fixtures', 'a.lua')
local file2 = Path.join(__dirname, 'fixtures', 'a1.lua')
local function maskMode(mode, mask)
return bit.band(mode, mask or 511 --[[tonumber('0777',8)]])
end
fs.chmod(file1, mode_async, expect(function(err)
assert(not err)
if is_windows then
assert(maskMode(maskMode(fs.statSync(file1).mode), mode_async))
else
assert(mode_async == maskMode(fs.statSync(file1).mode))
end
-- TODO: accept mode in number
assert(fs.chmodSync(file1, mode_sync))
if is_windows then
assert(maskMode(maskMode(fs.statSync(file1).mode), mode_sync))
else
assert(mode_sync == maskMode(fs.statSync(file1).mode))
end
end))
fs.open(file2, 'a', tonumber('0666', 8), expect(function(err, fd)
assert(not err)
fs.fchmod(fd, mode_async, expect(function(err)
assert(not err)
if is_windows then
assert(maskMode(maskMode(fs.fstatSync(fd).mode), mode_async))
else
assert(mode_async == maskMode(fs.fstatSync(fd).mode))
end
-- TODO: accept mode in number
assert(fs.fchmodSync(fd, mode_sync))
if is_windows then
assert(maskMode(maskMode(fs.fstatSync(fd).mode), mode_sync))
else
assert(mode_sync == maskMode(fs.fstatSync(fd).mode))
end
fs.close(fd)
end))
end))
-- lchmod
if fs.lchmod then
local link = Path.join(__dirname, 'tmp', 'symbolic-link')
fs.unlinkSync(link)
fs.symlinkSync(file2, link)
fs.lchmod(link, mode_async, expect(function(err)
assert(not err)
p(fs.lstatSync(link).mode)
assert(mode_async == maskMode(fs.lstatSync(link).mode))
-- TODO: accept mode in number
fs.lchmodSync(link, string.format('%o', mode_sync))
assert(mode_sync == maskMode(fs.lstatSync(link).mode))
end))
end
end)
end)
|
local Milo = require('milo')
local UI = require('opus.ui')
local itemDB = require('core.itemDB')
local colors = _G.colors
local device = _G.device
local wizardPage = UI.WizardPage {
title = 'Level Emitter',
index = 2,
[1] = UI.TextArea {
x = 2, y = 1,
height = 2,
textColor = colors.yellow,
value = 'Emit a redstone signal if an\nitem amount if over a threshold',
},
form = UI.Form {
x = 1, ex = -1, y = 3, ey = -1,
manualControls = true,
itemName = UI.TextEntry {
formLabel = 'Item', formKey = 'item', formIndex = 1,
help = 'Item to monitor',
required = true,
},
side = UI.Chooser {
formLabel = 'Side', formKey = 'side', formIndex = 2,
width = 10,
choices = {
{name = 'Down', value = 'down'},
{name = 'Up', value = 'up'},
{name = 'North', value = 'north'},
{name = 'South', value = 'south'},
{name = 'West', value = 'west'},
{name = 'East', value = 'east'},
},
required = true,
},
amount = UI.TextEntry {
formLabel = 'Amount', formKey = 'amount', formIndex = 3,
width = 7,
transform = 'number',
help = 'Threshold value',
required = true,
},
signal = UI.Checkbox {
formLabel = 'Signal', formKey = 'signal', formIndex = 4,
help = 'Enable redstone signal when over threshold',
},
scanItem = UI.Button {
x = 15, y = 6,
text = 'Scan item', event = 'scan_turtle',
help = 'Scan an item from the turtle inventory',
},
},
}
function wizardPage:setNode(node)
self.node = node
if not self.node.emitter then
self.node.emitter = {
signal = { value = true }
}
end
self.form:setValues(self.node.emitter)
end
function wizardPage:validate()
return self.form:save()
end
function wizardPage:isValidType(node)
local m = device[node.name]
return m and m.type == 'redstone_integrator' and {
name = 'Level Emitter',
value = 'emitter',
category = 'custom',
help = 'Emit redstone signals',
}
end
function wizardPage:isValidFor(node)
return node.mtype == 'emitter'
end
function wizardPage:enable()
Milo:pauseCrafting({ key = 'gridInUse', msg = 'Crafting paused' })
UI.WizardPage.enable(self)
end
function wizardPage:disable()
Milo:resumeCrafting({ key = 'gridInUse' })
UI.WizardPage.disable(self)
end
function wizardPage:eventHandler(event)
if event.type == 'scan_turtle' then
local inventory = Milo:getTurtleInventory()
for _,item in pairs(inventory) do
self.form.itemName.value = itemDB:makeKey(item)
break
end
self:draw()
Milo:emptyInventory()
end
end
UI:getPage('nodeWizard').wizard:add({ emiter = wizardPage })
|
local _=require 'leda'
return _.stage{
handler=function (...)
print(...)
leda.push(...)
end,
serial=true,
name="Console print",
}
|
local self = {}
GLib.Lua.LoadStore = GLib.MakeConstructor (self)
function self:ctor (frameVariable)
self.FrameVariable = frameVariable
self.Index = 0
end
function self:Clone (clone)
clone = clone or self.__ictor ()
clone:Copy (self)
return clone
end
function self:Copy (source)
self:SetFrameVariable (source:GetFrameVariable ())
self:SetIndex (source:GetIndex ())
return self
end
function self:GetBracketedExpression (outerPrecedence)
local expression, precedence = self:GetExpression ()
if outerPrecedence > precedence or
(outerPrecedence == precedence and not GLib.Lua.IsPrecedenceAssociative (precedence)) then
expression = "(" .. expression .. ")"
end
return expression
end
function self:GetExpression ()
if self:IsLoad () then
local expression = nil
local expressionPrecedence = nil
if self:IsExpressionInlineable () then
local lastStoreId = self:GetLastStoreId ()
expression = self.FrameVariable.LoadStoreExpressions [lastStoreId]
expressionPrecedence = self.FrameVariable.LoadStoreExpressionPrecedences [lastStoreId]
end
if not expression then
expression = self.FrameVariable:GetNameOrFallbackName ()
expressionPrecedence = GLib.Lua.Precedence.Atom
end
expressionPrecedence = expressionPrecedence or GLib.Lua.Precedence.Lowest
return expression, expressionPrecedence
end
return self.FrameVariable.LoadStoreExpressions [self.Index], self.FrameVariable.LoadStoreExpressionPrecedences [self.Index]
end
function self:GetExpressionPrecedence ()
local _, expressionPrecedence = self:GetExpression ()
return expressionPrecedence
end
function self:GetExpressionRawValue ()
if self:IsLoad () then
if self:IsExpressionInlineable () then
local lastStoreId = self:GetLastStoreId ()
return self.FrameVariable.LoadStoreExpressionRawValues [lastStoreId]
end
return nil
end
return self.FrameVariable.LoadStoreExpressionRawValues [self.Index]
end
function self:GetFrameVariable ()
return self.FrameVariable
end
function self:GetIndex ()
return self.Index
end
function self:GetInstruction (instruction)
return self.FrameVariable:GetFunctionBytecodeReader ():GetInstruction (self:GetInstructionId ())
end
function self:GetInstructionId ()
return self.FrameVariable.LoadStoreInstructions [self.Index]
end
function self:GetLastStore (loadStore)
return self.FrameVariable:GetLoadStore (self:GetLastStoreId (), loadStore)
end
function self:GetLastStoreId ()
return self.FrameVariable.LoadStoreLastStoreIds [self.Index]
end
function self:GetLoadCount ()
return self.FrameVariable.LoadStoreLoadCounts [self.Index] or 0
end
function self:GetNext (loadStore)
return self.FrameVariable:GetLoadStore (self.Index + 1, loadStore or self)
end
function self:GetNextLoad (loadStore)
local index = self.Index + 1
while self.FrameVariable.LoadStoreTypes [index] and self.FrameVariable.LoadStoreTypes [index] ~= "Load" do
index = index + 1
end
return self.FrameVariable:GetLoadStore (index, loadStore or self)
end
function self:GetNextStore (loadStore)
local index = self.Index + 1
while self.FrameVariable.LoadStoreTypes [index] and self.FrameVariable.LoadStoreTypes [index] ~= "Store" do
index = index + 1
end
return self.FrameVariable:GetLoadStore (index, loadStore or self)
end
function self:GetPrevious (loadStore)
return self.FrameVariable:GetLoadStore (self.Index - 1, loadStore or self)
end
function self:IsExpressionInlineable ()
if self:IsLoad () then
local lastStoreId = self:GetLastStoreId ()
return self.FrameVariable.LoadStoreExpressionInlineables [lastStoreId] or false
end
return self.FrameVariable.LoadStoreExpressionInlineables [self.Index] or false
end
function self:IsLoad ()
return self.FrameVariable.LoadStoreTypes [self.Index] == "Load"
end
function self:IsStore ()
return self.FrameVariable.LoadStoreTypes [self.Index] == "Store"
end
function self:SetExpression (expression, expressionPrecedence)
expressionPrecedence = expressionPrecedence or GLib.Lua.Precedence.Lowest
self.FrameVariable.LoadStoreExpressions [self.Index] = expression
self.FrameVariable.LoadStoreExpressionPrecedences [self.Index] = expressionPrecedence
end
function self:SetExpressionPrecedence (expressionPrecedence)
self.FrameVariable.LoadStoreExpressionPrecedences [self.Index] = expressionPrecedence
end
function self:SetExpressionRawValue (expressionRawValue)
self.FrameVariable.LoadStoreExpressionRawValues [self.Index] = expressionRawValue
end
function self:SetExpressionInlineable (expressionInlineable)
self.FrameVariable.LoadStoreExpressionInlineables [self.Index] = expressionInlineable
end
function self:SetFrameVariable (frameVariable)
self.FrameVariable = frameVariable
end
function self:SetIndex (index)
self.Index = index
end
function self:SetInstructionId (instructionId)
self.FrameVariable.LoadStoreInstructions [self.Index] = instructionId
end
function self:SetLastStore (loadStoreOrIndex)
if type (loadStoreOrIndex) == "table" then
loadStoreOrIndex = loadStoreOrIndex:GetIndex ()
end
self.FrameVariable.LoadStoreLastStoreIds [self.Index] = loadStoreOrIndex
end
function self:SetLoadCount (loadCount)
self.FrameVariable.LoadStoreLoadCounts [self.Index] = loadCount
end
function self:ToString ()
local loadStore = self:IsLoad () and "Load" or "Store"
loadStore = loadStore .. self:GetIndex ()
loadStore = loadStore .. " "
loadStore = loadStore .. self.FrameVariable:GetNameOrFallbackName ()
local instruction = self:GetInstruction ()
if instruction then
loadStore = loadStore .. "\t" .. instruction:ToString ()
end
return loadStore
end
self.__tostring = self.ToString
|
---------------------------------------------------------------------------------------------
-- Requirement summary:
-- SDL must re-assign "default" policies to app in case "default" policies was updated via PolicyTable update
--
-- Description:
-- PoliciesManager must: re-assign updated "default" policies to this app
-- In case Policies Manager assigns the "default" policies to app AND the value of "default" policies was updated in case of PolicyTable update
-- 1. Used preconditions:
-- a) Set SDL to first life cycle state.
-- b) Set permissions for default section.
-- c) Register and activate app, consent device.
-- 2. Performed steps:
-- a) Verify applied permision by send RPC (allowed and disallowed)
-- b) Update policy with new permissions in defult section
-- c) Verify applied permision by send RPC (allowed and disallowed)
--
-- Expected result:
-- a) SDL respons SUCCESS for allowed RPC and DISALLOW for disallow
-- b) PTU successfully passed
-- c) SDL respons SUCCESS for allowed RPC and DISALLOW for disallow
---------------------------------------------------------------------------------------------
--[[ General configuration parameters ]]
--ToDo: shall be removed when issue: "ATF does not stop HB timers by closing session and connection" is fixed
config.defaultProtocolVersion = 2
config.application1.registerAppInterfaceParams.appName = "SPT"
config.application1.registerAppInterfaceParams.isMediaApplication = true
config.application1.registerAppInterfaceParams.fullAppID = "1234567"
--[[ Required Shared libraries ]]
local commonFunctions = require ('user_modules/shared_testcases/commonFunctions')
local commonSteps = require ('user_modules/shared_testcases/commonSteps')
local commonPreconditions = require ('user_modules/shared_testcases/commonPreconditions')
local testCasesForPolicyTable = require ('user_modules/shared_testcases/testCasesForPolicyTable')
local utils = require ('user_modules/utils')
--[[ General Precondition before ATF start ]]
commonSteps:DeleteLogsFiles()
commonSteps:DeletePolicyTable()
testCasesForPolicyTable.Delete_Policy_table_snapshot()
commonPreconditions:BackupFile("sdl_preloaded_pt.json")
local function SetPermissionsForDefault()
local pathToFile = config.pathToSDL .. 'sdl_preloaded_pt.json'
local file = io.open(pathToFile, "r")
local json_data = file:read("*all") -- may be abbreviated to "*a";
file:close()
local json = require("modules/json")
local data = json.decode(json_data)
if data.policy_table.functional_groupings["DataConsent-2"] then
data.policy_table.functional_groupings["DataConsent-2"] = nil
end
-- set for group in default section permissions with RPCs and HMI levels for them
data.policy_table.functional_groupings[data.policy_table.app_policies.default.groups[1]] = {rpcs = {
OnHMIStatus =
{hmi_levels = {"BACKGROUND", "FULL", "LIMITED", "NONE"}},
OnPermissionsChange =
{hmi_levels = {"BACKGROUND", "FULL", "LIMITED", "NONE"}},
OnSystemRequest =
{hmi_levels = {"BACKGROUND", "FULL", "LIMITED", "NONE"}},
SystemRequest =
{hmi_levels = {"BACKGROUND", "FULL", "LIMITED", "NONE"}},
Show =
{hmi_levels = {"BACKGROUND", "FULL", "LIMITED", "NONE"}},
}}
data = json.encode(data)
file = io.open(pathToFile, "w")
file:write(data)
file:close()
end
SetPermissionsForDefault()
--[[ General Settings for configuration ]]
Test = require('connecttest')
require('cardinalities')
require('user_modules/AppTypes')
--[[ Preconditions ]]
commonFunctions:newTestCasesGroup("Postconditions")
function Test:Precondition_Register_Activate_App_And_Consent_Device()
local RequestIdActivateApp = self.hmiConnection:SendRequest("SDL.ActivateApp", {appID = self.applications["SPT"]})
EXPECT_HMIRESPONSE(RequestIdActivateApp, { result = { code = 0, isSDLAllowed = false}, method = "SDL.ActivateApp"})
:Do(function(_,_)
local RequestIdGetUserFriendlyMessage = self.hmiConnection:SendRequest("SDL.GetUserFriendlyMessage", {language = "EN-US", messageCodes = {"DataConsent"}})
EXPECT_HMIRESPONSE(RequestIdGetUserFriendlyMessage,{result = {code = 0, method = "SDL.GetUserFriendlyMessage"}})
:Do(function(_,_)
self.hmiConnection:SendNotification("SDL.OnAllowSDLFunctionality", {allowed = true, source = "GUI", device = {id = utils.getDeviceMAC(), name = utils.getDeviceName()}})
EXPECT_HMICALL("BasicCommunication.ActivateApp")
:Do(function(_,data)
self.hmiConnection:SendResponse(data.id,"BasicCommunication.ActivateApp", "SUCCESS", {})
EXPECT_NOTIFICATION("OnHMIStatus", {hmiLevel = "FULL", systemContext = "MAIN"})
end)
end)
end)
end
--[[ Test ]]
function Test:TestStep_Check_Allowed_RPC()
local CorIdRAI = self.mobileSession:SendRPC("Show", { mediaClock = "00:00:01", mainField1 = "Show1" })
EXPECT_HMICALL("UI.Show", {})
:Do(function(_,data)
self.hmiConnection:SendResponse(data.id, "UI.Show", "SUCCESS", { })
end)
EXPECT_RESPONSE(CorIdRAI, { success = true, resultCode = "SUCCESS"})
end
function Test:TestStep_Check_Disallowed_RPC()
local cid = self.mobileSession:SendRPC("AddSubMenu", { menuID = 1000, position = 500, menuName ="SubMenupositive" })
EXPECT_RESPONSE(cid, { success = false, resultCode = "DISALLOWED" })
end
function Test:TestStep_Update_Policy_With_New_Permission_In_Default_Section()
local requestId = self.hmiConnection:SendRequest("SDL.GetPolicyConfigurationData",
{ policyType = "module_config", property = "endpoints" })
EXPECT_HMIRESPONSE(requestId)
:Do(function()
self.hmiConnection:SendNotification("BasicCommunication.OnSystemRequest", { requestType = "PROPRIETARY", fileName = "filename"})
EXPECT_NOTIFICATION("OnSystemRequest", { requestType = "PROPRIETARY" })
:Do(function()
local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest", { fileName = "PolicyTableUpdate", requestType = "PROPRIETARY"},
"files/ptu_general_default_app-1234567.json")
local systemRequestId
EXPECT_HMICALL("BasicCommunication.SystemRequest")
:Do(function(_,data)
systemRequestId = data.id
self.hmiConnection:SendNotification("SDL.OnReceivedPolicyUpdate", { policyfile = "/tmp/fs/mp/images/ivsu_cache/PolicyTableUpdate" })
local function to_run()
self.hmiConnection:SendResponse(systemRequestId,"BasicCommunication.SystemRequest", "SUCCESS", {})
end
RUN_AFTER(to_run, 800)
self.mobileSession:ExpectResponse(CorIdSystemRequest, {success = true, resultCode = "SUCCESS"})
end)
end)
end)
EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate",
{status = "UPDATING"}, {status = "UP_TO_DATE"}):Times(2)
end
function Test:TestStep_Check_Allowed_RPC()
local CorIdRAI = self.mobileSession:SendRPC("Show", { mediaClock = "00:00:01", mainField1 = "Show1"})
EXPECT_RESPONSE(CorIdRAI, { success = false, resultCode = "DISALLOWED"})
end
function Test:TestStep_Check_Disallowed_RPC()
local cid = self.mobileSession:SendRPC("AddSubMenu",
{
menuID = 1000,
position = 500,
menuName ="SubMenupositive"
})
EXPECT_HMICALL("UI.AddSubMenu")
:Do(function(_,data)
self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", {})
end)
EXPECT_RESPONSE(cid, { success = true, resultCode = "SUCCESS" })
end
--[[ Postconditions ]]
commonFunctions:newTestCasesGroup("Postconditions")
testCasesForPolicyTable:Restore_preloaded_pt()
function Test.Postcondition_Stop()
StopSDL()
end
return Test
|
return require 'async.async'
|
--[[
Copyright (c) 2019 igor725, scaledteam
released under The MIT license http://opensource.org/licenses/MIT
]]
SURV_MAX_HEALTH = 10
SURV_MAX_OXYGEN = 10
SURV_INV_SIZE = 255
SURV_DEF_SPAWNRAD = 32
gmLoad('lng')
gmLoad('names')
gmLoad('gui')
gmLoad('blocks')
gmLoad('timers')
gmLoad('craft')
gmLoad('items')
gmLoad('damage')
gmLoad('inventory')
gmLoad('commands')
gmLoad('daynight')
-- gmLoad('mobs')
gmLoad('firespread')
gmLoad('anticheat')
config.types.spawnRadius = 'number'
if not config:get('spawnRadius')then
config:set('spawnRadius', SURV_DEF_SPAWNRAD)
end
function survCanPlace(id)
return (id < 7 or id > 11)and
(id < 149 or id > 151)
end
function survUpdatePermission(player, id)
if not isValidBlockID(id)then return end
local quantity = player.inventory[id]
local canPlace = player.isInGodmode or (quantity > 0 and survCanPlace(id))
player:setBlockPermissions(id, canPlace, player.isInGodmode)
end
hooks:add('onHeldBlockChange', 'surv_init', function(player, id)
survUpdateBlockInfo(player)
end)
hooks:add('postPlayerFirstSpawn', 'surv_init', function(player)
player:sendMessage('LuaClassic Survival Dev', MT_STATUS1)
for i = 0, 8 do
player:setHotBar(i, 0)
end
end)
hooks:add('onPlayerHandshakeDone', 'surv_init', function(player)
if not player:isSupported('PlayerClick')or
not player:isSupported('HackControl')or
not player:isSupported('EnvColors')or
not player:isSupported('BlockDefinitions')or
not player:isSupported('BlockDefinitionsExt', 2)or
not player:isSupported('EnvMapAspect')or
not player:isSupported('HeldBlock')then
player:kick(KICK_SURVCPE, true)
return
end
end)
hooks:add('onPlayerCreate', 'surv_init', function(player)
player.lastClickedBlock = newVector(0, 0, 0)
player.currClickedBlock = newVector(0, 0, 0)
player.inventory = ffi.new('uint8_t[?]', SURV_INV_SIZE + 1)
player.health = SURV_MAX_HEALTH
player.oxygen = SURV_MAX_OXYGEN
player.action = SURV_ACT_NONE
player.breakProgress = 0
player.pvpmode = false
player.oxyshow = false
player.heldTool = 0
player.deaths = 0
end)
hooks:add('postPlayerSpawn', 'surv_init', function(player)
local h = player.isInGodmode and 1 or 0
player:hackControl(h, h, h, 0, 1, -1)
for i = 1, SURV_INV_SIZE do
if isValidBlockID(i)then
survUpdatePermission(player, i)
end
end
end)
hooks:add('onPlayerClick', 'surv_init', function(player, ...)
local button = select(1, ...)
local action = select(2, ...)
local tgid = select(5, ...)
local x, y, z = select(6, ...)
if button == 1 and action == 0 then
local held = player:getHeldBlock()
if (held < 149 or held > 150)or
player.action ~= SURV_ACT_NONE then
return
end
local quantity = player.inventory[held]
if quantity < 1 then
return
end
if player.health < 10 then
survHeal(player, .5)
player.inventory[held] = quantity - 1
survUpdateBlockInfo(player)
if quantity == 1 then
survUpdateInventory(player)
player:holdThis(0)
end
else
player:sendMessage(SURV_NOT_HUNGRY)
end
return
end
if action == 1 then
survStopBreaking(player)
return
end
local dist_entity = 9999
local dist_block = 9999
local tgentity
if x ~= -1 and y ~= -1 and z ~= -1 then
dist_block = distance(x + .5, y + .5, z + .5, player:getPos())
else
survStopBreaking(player)
end
tgentity = entities[tgid]
if tgentity then
x, y, z = player:getPos()
dist_entity = distance(x, y, z, tgentity:getPos())
end
if dist_block < dist_entity then
survBlockAction(player, button, action, x, y, z)
elseif dist_entity < dist_block and dist_entity < 3.5 then
if button == 0 and action == 0 then
if not player.nextHit then
player.nextHit = 0
end
if tgentity and ctime > player.nextHit then
-- get damage from sword
local power, toolType = survPlayerGetTool(player)
local damage = 1
if toolType == 4 then
damage = power
end
-- critical damage
local blocks = math.max(0, player.fallingStartY and (player.fallingStartY - player.pos.y) or 0)
survDamage(player, tgentity, damage + blocks, SURV_DMG_PLAYER)
survStopBreaking(player)
-- timeout
player.nextHit = ctime + 0.5
end
end
end
end)
saveAdd('deaths', '>I')
saveAdd('health', '>f')
saveAdd('oxygen', '>f')
saveAdd('isInGodmode', 'bool')
saveAdd('pvpmode', 'bool')
saveAdd('homepos', '>fff', function(player, x, y, z)
return newVector(x, y, z)
end, function(val)
return val.x, val.y, val.z
end)
saveAdd('homeang', '>ff', function(player, y, p)
return newAngle(y, p)
end, function(val)
return val.yaw, val.pitch
end)
saveAdd('homeworld', 'string')
|
object_ship_nova_orion_pirate_heavy_tier6 = object_ship_shared_nova_orion_pirate_heavy_tier6:new {
}
ObjectTemplates:addTemplate(object_ship_nova_orion_pirate_heavy_tier6, "object/ship/nova_orion_pirate_heavy_tier6.iff")
|
do
SkynetIADSSAMTrackingRadar = {}
SkynetIADSSAMTrackingRadar = inheritsFrom(SkynetIADSSAMSearchRadar)
function SkynetIADSSAMTrackingRadar:create(unit)
local instance = self:superClass():create(unit)
setmetatable(instance, self)
self.__index = self
return instance
end
end
|
local K, C, L = unpack(select(2, ...))
if C.Unitframe.Enable ~= true and C.Raidframe.Enable ~= true and C.Nameplates.Enable ~= true then return end
local _, ns = ...
local oUF = ns.oUF or oUF
assert(oUF, "KkthnxUI was unable to locate oUF.")
-- Lua API
local _G = _G
local format = format
local math_floor = math.floor
local string_format = string.format
local string_gsub = string.gsub
local string_len = string.len
-- Wow API
local C_PetJournal_GetPetTeamAverageLevel = C_PetJournal.GetPetTeamAverageLevel
local GetPVPTimer = _G.GetPVPTimer
local GetQuestDifficultyColor = _G.GetQuestDifficultyColor
local GetQuestGreenRange = _G.GetQuestGreenRange
local GetRelativeDifficultyColor = _G.GetRelativeDifficultyColor
local GetTime = _G.GetTime
local IsPVPTimerRunning = _G.IsPVPTimerRunning
local QuestDifficultyColors = _G.QuestDifficultyColors
local UnitBattlePetLevel = _G.UnitBattlePetLevel
local UnitClass = _G.UnitClass
local UnitClassification = _G.UnitClassification
local UnitEffectiveLevel = _G.UnitEffectiveLevel
local UnitGroupRolesAssigned = _G.UnitGroupRolesAssigned
local UnitGUID = _G.UnitGUID
local UnitHealth = _G.UnitHealth
local UnitHealthMax = _G.UnitHealthMax
local UnitIsAFK = _G.UnitIsAFK
local UnitIsBattlePetCompanion = _G.UnitIsBattlePetCompanion
local UnitIsConnected = _G.UnitIsConnected
local UnitIsCorpse = _G.UnitIsCorpse
local UnitIsDND = _G.UnitIsDND
local UnitIsPlayer = _G.UnitIsPlayer
local UnitIsPVP = _G.UnitIsPVP
local UnitIsPVPFreeForAll = _G.UnitIsPVPFreeForAll
local UnitIsUnit = _G.UnitIsUnit
local UnitIsWildBattlePet = _G.UnitIsWildBattlePet
local UnitLevel = _G.UnitLevel
local UnitName = _G.UnitName
local UNITNAME_SUMMON_TITLE17 = _G.UNITNAME_SUMMON_TITLE17
local UnitPower = _G.UnitPower
local UnitPowerMax = _G.UnitPowerMax
local UnitReaction = _G.UnitReaction
local UnitDetailedThreatSituation = _G.UnitDetailedThreatSituation
local UnitThreatPercentageOfLead = _G.UnitThreatPercentageOfLead
-- Global variables that we don"t cache, list them here for mikk"s FindGlobals script
-- GLOBALS: SPELL_POWER_MANA, UNKNOWN, Hex, Role, _TAGS, r, g, b, u
local function UnitName(unit)
local name, realm = _G.UnitName(unit)
if name == UNKNOWN and K.Class == "MONK" and UnitIsUnit(unit, "pet") then
name = UNITNAME_SUMMON_TITLE17:format(_G.UnitName("player"))
else
return name, realm
end
end
-- KkthnxUI Unitframe Tags
oUF.Tags.Events["KkthnxUI:GetNameColor"] = "UNIT_NAME_UPDATE UNIT_POWER"
oUF.Tags.Methods["KkthnxUI:GetNameColor"] = function(unit)
local unitReaction = UnitReaction(unit, "player")
local _, unitClass = UnitClass(unit)
if (UnitIsPlayer(unit)) then
local class = K.Colors.class[unitClass]
if not class then return "" end
return Hex(class[1], class[2], class[3])
elseif (unitReaction) then
local reaction = K.Colors.reaction[unitReaction]
return Hex(reaction[1], reaction[2], reaction[3])
else
return "|cffc2c2c2"
end
end
-- We will just use this for now.
oUF.Tags.Events["KkthnxUI:NameColor"] = "UNIT_NAME_UPDATE UNIT_POWER"
oUF.Tags.Methods["KkthnxUI:NameColor"] = function(unit)
return string_format("|cff%02x%02x%02x", 1 * 255, 1 * 255, 1 * 255)
end
oUF.Tags.Events["KkthnxUI:DruidMana"] = "UNIT_POWER UNIT_MAXPOWER"
oUF.Tags.Methods["KkthnxUI:DruidMana"] = function(unit)
local min, max = UnitPower(unit, SPELL_POWER_MANA), UnitPowerMax(unit, SPELL_POWER_MANA)
if (min == max) then
return K.ShortValue(min)
else
return K.ShortValue(min).."/"..K.ShortValue(max)
end
end
oUF.Tags.OnUpdateThrottle["KkthnxUI:PvPTimer"] = 1
oUF.Tags.Methods["KkthnxUI:PvPTimer"] = function(unit)
if (UnitIsPVPFreeForAll(unit) or UnitIsPVP(unit)) then
local pvpTime = (GetPVPTimer() or 0)/1000
if (not IsPVPTimerRunning()) or (pvpTime < 1) or (pvpTime > 300) then --999?
return ""
end
return K.FormatTime(math_floor(pvpTime))
end
end
oUF.Tags.Events["KkthnxUI:DifficultyColor"] = "UNIT_LEVEL PLAYER_LEVEL_UP"
oUF.Tags.Methods["KkthnxUI:DifficultyColor"] = function(unit)
local r, g, b = 0.55, 0.57, 0.61
if (UnitIsWildBattlePet(unit) or UnitIsBattlePetCompanion(unit)) then
local level = UnitBattlePetLevel(unit)
local teamLevel = C_PetJournal_GetPetTeamAverageLevel()
if teamLevel < level or teamLevel > level then
local c = GetRelativeDifficultyColor(teamLevel, level)
r, g, b = c.r, c.g, c.b
else
local c = QuestDifficultyColors["difficult"]
r, g, b = c.r, c.g, c.b
end
else
local DiffColor = UnitLevel(unit) - UnitLevel("player")
if (DiffColor >= 5) then
r, g, b = 0.69, 0.31, 0.31
elseif (DiffColor >= 3) then
r, g, b = 0.71, 0.43, 0.27
elseif (DiffColor >= -2) then
r, g, b = 0.84, 0.75, 0.65
elseif (-DiffColor <= GetQuestGreenRange()) then
r, g, b = 0.33, 0.59, 0.33
else
r, g, b = 0.55, 0.57, 0.61
end
end
return Hex(r, g, b)
end
oUF.Tags.Events["KkthnxUI:ClassificationColor"] = "UNIT_CLASSIFICATION_CHANGED"
oUF.Tags.Methods["KkthnxUI:ClassificationColor"] = function(unit)
local c = UnitClassification(unit)
if(c == "rare" or c == "elite") then
return Hex(0.69, 0.31, 0.31) -- Red
elseif(c == "rareelite" or c == "worldboss") then
return Hex(0.69, 0.31, 0.31) -- Red
end
end
oUF.Tags.Events["KkthnxUI:Level"] = "UNIT_LEVEL PLAYER_LEVEL_UP"
oUF.Tags.Methods["KkthnxUI:Level"] = function(unit)
local level = UnitLevel(unit)
if (UnitIsWildBattlePet(unit) or UnitIsBattlePetCompanion(unit)) then
return UnitBattlePetLevel(unit)
elseif (level > 0) then
return level
else
return "??"
end
end
oUF.Tags.Events["KkthnxUI:NameVeryShort"] = "UNIT_NAME_UPDATE"
oUF.Tags.Methods["KkthnxUI:NameVeryShort"] = function(unit)
local Name = UnitName(unit) or UNKNOWN
return Name ~= nil and K.UTF8Sub(Name, 5, true) or ""
end
oUF.Tags.Events["KkthnxUI:NameShort"] = "UNIT_NAME_UPDATE"
oUF.Tags.Methods["KkthnxUI:NameShort"] = function(unit)
local Name = UnitName(unit) or UNKNOWN
return Name ~= nil and K.UTF8Sub(Name, 8, true) or ""
end
oUF.Tags.Events["KkthnxUI:NameMedium"] = "UNIT_NAME_UPDATE"
oUF.Tags.Methods["KkthnxUI:NameMedium"] = function(unit)
local Name = UnitName(unit) or UNKNOWN
return Name ~= nil and K.UTF8Sub(Name, 15, true) or ""
end
oUF.Tags.Events["KkthnxUI:NameLong"] = "UNIT_NAME_UPDATE"
oUF.Tags.Methods["KkthnxUI:NameLong"] = function(unit)
local Name = UnitName(unit) or UNKNOWN
return Name ~= nil and K.UTF8Sub(Name, 20, true) or ""
end
local unitStatus = {}
oUF.Tags.OnUpdateThrottle["KkthnxUI:StatusTimer"] = 1
oUF.Tags.Methods["KkthnxUI:StatusTimer"] = function(unit)
if not UnitIsPlayer(unit) then return end
local guid = UnitGUID(unit)
if (UnitIsAFK(unit)) then
if not unitStatus[guid] or unitStatus[guid] and unitStatus[guid][1] ~= "AFK" then
unitStatus[guid] = {"AFK", GetTime()}
end
elseif(UnitIsDND(unit)) then
if not unitStatus[guid] or unitStatus[guid] and unitStatus[guid][1] ~= "DND" then
unitStatus[guid] = {"DND", GetTime()}
end
else
unitStatus[guid] = nil
end
if unitStatus[guid] ~= nil then
local status = unitStatus[guid][1]
local timer = GetTime() - unitStatus[guid][2]
local mins = math_floor(timer / 60)
local secs = math_floor(timer - (mins * 60))
return ("%s (%01.f:%02.f)"):format(status, mins, secs)
else
return ""
end
end
oUF.Tags.Events["KkthnxUI:RaidRole"] = "GROUP_ROSTER_UPDATE PLAYER_ROLES_ASSIGNED"
oUF.Tags.Methods["KkthnxUI:RaidRole"] = function(unit)
local role = UnitGroupRolesAssigned(unit)
local string = ""
if role then
if role == "TANK" then
string = "|cff0099CCT|r"
elseif role == "HEALER" then
string = "|cff00FF00H|r"
end
return string
end
end
oUF.Tags.Events["KkthnxUI:ThreatPercent"] = "UNIT_THREAT_LIST_UPDATE GROUP_ROSTER_UPDATE"
oUF.Tags.Methods["KkthnxUI:ThreatPercent"] = function(unit)
local _, _, percent = UnitDetailedThreatSituation("player", unit)
if(percent and percent > 0) and (IsInGroup() or UnitExists("pet")) then
return format("%.0f%%", percent)
else
return ""
end
end
oUF.Tags.Events["KkthnxUI:ThreatColor"] = "UNIT_THREAT_LIST_UPDATE GROUP_ROSTER_UPDATE"
oUF.Tags.Methods["KkthnxUI:ThreatColor"] = function(unit)
local _, status = UnitDetailedThreatSituation("player", unit)
if (status) and (IsInGroup() or UnitExists("pet")) then
return Hex(GetThreatStatusColor(status))
else
return ""
end
end
-- </ Nameplate Tags > --
oUF.Tags.Events["KkthnxUI:NameplateLevel"] = "UNIT_LEVEL PLAYER_LEVEL_UP"
oUF.Tags.Methods["KkthnxUI:NameplateLevel"] = function(unit)
local level = UnitLevel(unit)
local classification = UnitClassification(unit)
if (UnitIsWildBattlePet(unit) or UnitIsBattlePetCompanion(unit)) then
return UnitBattlePetLevel(unit)
end
if level == K.Level and classification == "normal" then
return " "
elseif (level > 0) then
return level
else
return "??"
end
end
oUF.Tags.Events["KkthnxUI:NameplateNameLong"] = "UNIT_NAME_UPDATE"
oUF.Tags.Methods["KkthnxUI:NameplateNameLong"] = function(unit)
local name = UnitName(unit)
return K.UTF8Sub(name, 18, true)
end
oUF.Tags.Events["KkthnxUI:NameplateNameLongAbbrev"] = "UNIT_NAME_UPDATE"
oUF.Tags.Methods["KkthnxUI:NameplateNameLongAbbrev"] = function(unit)
local name = UnitName(unit)
local newname = (string_len(name) > 18) and string_gsub(name, "%s?(.[\128-\191]*)%S+%s", "%1. ") or name
return K.UTF8Sub(newname, 18, false)
end
oUF.Tags.Events["KkthnxUI:NameplateNameColor"] = "UNIT_POWER UNIT_FLAGS"
oUF.Tags.Methods["KkthnxUI:NameplateNameColor"] = function(unit)
local reaction = UnitReaction(unit, "player")
if not UnitIsUnit("player", unit) and UnitIsPlayer(unit) and (reaction and reaction >= 5) then
local color = K.Colors.power["MANA"]
return string_format("|cff%02x%02x%02x", color[1] * 255, color[2] * 255, color[3] * 255)
elseif UnitIsPlayer(unit) then
return _TAGS["raidcolor"](unit)
elseif reaction then
local color = K.Colors.reaction[reaction]
return string_format("|cff%02x%02x%02x", color[1] * 255, color[2] * 255, color[3] * 255)
else
r, g, b = 0.33, 0.59, 0.33
return string_format("|cff%02x%02x%02x", r * 255, g * 255, b * 255)
end
end
oUF.Tags.Events["KkthnxUI:NameplateHealth"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH NAME_PLATE_UNIT_ADDED"
oUF.Tags.Methods["KkthnxUI:NameplateHealth"] = function(unit)
local health = UnitHealth(unit)
local maxhealth = UnitHealthMax(unit)
if maxhealth == 0 then
return 0
else
return ("%s - %d%%"):format(K.ShortValue(health), health / maxhealth * 100 + 0.5)
end
end
|
local CorePackages = game:GetService("CorePackages")
local Roact = require(CorePackages.Roact)
local RoactRodux = require(CorePackages.RoactRodux)
local Components = script.Parent.Parent.Parent.Components
local ActionBindingsChart = require(Components.ActionBindings.ActionBindingsChart)
local UtilAndTab = require(Components.UtilAndTab)
local Actions = script.Parent.Parent.Parent.Actions
local ActionBindingsUpdateSearchFilter = require(Actions.ActionBindingsUpdateSearchFilter)
local Constants = require(script.Parent.Parent.Parent.Constants)
local PADDING = Constants.GeneralFormatting.MainRowPadding
local MainViewActionBindings = Roact.Component:extend("MainViewActionBindings")
function MainViewActionBindings:init()
self.onUtilTabHeightChanged = function(utilTabHeight)
self:setState({
utilTabHeight = utilTabHeight
})
end
self.onSearchTermChanged = function(newSearchTerm)
self.props.dispatchActionBindingsUpdateSearchFilter(newSearchTerm, {})
end
self.utilRef = Roact.createRef()
self.state = {
utilTabHeight = 0
}
end
function MainViewActionBindings:didMount()
local utilSize = self.utilRef.current.Size
self:setState({
utilTabHeight = utilSize.Y.Offset
})
end
function MainViewActionBindings:didUpdate()
local utilSize = self.utilRef.current.Size
if utilSize.Y.Offset ~= self.state.utilTabHeight then
self:setState({
utilTabHeight = utilSize.Y.Offset
})
end
end
function MainViewActionBindings:render()
local size = self.props.size
local formFactor = self.props.formFactor
local tabList = self.props.tabList
local searchTerm = self.props.bindingsSearchTerm
local utilTabHeight = self.state.utilTabHeight
return Roact.createElement("Frame", {
Size = size,
BackgroundColor3 = Constants.Color.BaseGray,
BackgroundTransparency = 1,
LayoutOrder = 3,
}, {
UIListLayout = Roact.createElement("UIListLayout", {
Padding = UDim.new(0, PADDING),
SortOrder = Enum.SortOrder.LayoutOrder,
}),
UtilAndTab = Roact.createElement(UtilAndTab, {
windowWidth = size.X.Offset,
formFactor = formFactor,
tabList = tabList,
searchTerm = searchTerm,
layoutOrder = 1,
refForParent = self.utilRef,
onHeightChanged = self.onUtilTabHeightChanged,
onSearchTermChanged = self.onSearchTermChanged,
}),
ActionBindings = utilTabHeight > 0 and Roact.createElement(ActionBindingsChart, {
size = UDim2.new(1, 0, 1, -utilTabHeight),
searchTerm = searchTerm,
layoutOrder = 2,
}),
})
end
local function mapStateToProps(state, props)
return {
bindingsSearchTerm = state.ActionBindingsData.bindingsSearchTerm,
}
end
local function mapDispatchToProps(dispatch)
return {
dispatchActionBindingsUpdateSearchFilter = function(searchTerm, filters)
dispatch(ActionBindingsUpdateSearchFilter(searchTerm, filters))
end
}
end
return RoactRodux.UNSTABLE_connect2(mapStateToProps, mapDispatchToProps)(MainViewActionBindings)
|
local B = require("core.Broadcast")
return {
listeners = {
questStart = function(state)
return function(self, quest)
B.sayAt(self, "<blue>questStart")
B.sayAt(self, "<red>Quest Started: !<red>");
if quest.config.description then
B.sayAt(self, B.line(80));
B.sayAt(self, "<bold>" .. quest.config.description, 80);
end
if quest.config.rewards.length then
B.sayAt(self);
B.sayAt(self, "<b><yellow>" + B.center(80, "Rewards") + "");
B.sayAt(self, "<b><yellow>" + B.center(80, "-------") + "");
for _, reward in pairs(quest.config.rewards) do
local rewardClass = state.QuestRewardManager:get(reward.type);
B.sayAt(self, " " ..
rewardClass.display(state, quest, reward.config, self));
end
end
B.sayAt(self, B.line(80));
end
end,
questProgress = function(state)
return function(self, quest, progress)
B.sayAt(self, "<red><yellow> progress:" .. progress.percent);
end
end,
questTurnInReady = function(state)
return function(self, quest)
B.sayAt(self,
"<bold><yellow>${} ready to turn in!" .. quest.config.title);
end
end,
questComplete = function(state)
return function(self, quest)
B.sayAt(self, "<bold><yellow>Quest Complete: ${}!" .. quest.config.title);
if quest.config.completionMessage then
B.sayAt(self, B.line(80));
B.sayAt(self, quest.config.completionMessage);
end
end
end,
questReward = function(state)
---
---Player received a quest reward
---@param reward table Reward config _not_ an instance of QuestReward
return function(self, reward)
--- do stuff when the player receives a quest reward. Generally the Reward instance
--- will emit an event that will be handled elsewhere and display its own message
--- e.g., 'currency' or 'experience'. But if you want to handle that all in one
--- place instead, or you'd like to show some supplemental message you can do that here
end
end,
},
}
|
--[[
© 2020 TERRANOVA do not share, re-distribute or modify
without permission of its author.
--]]
ITEM.name = "Approved Coffee";
ITEM.model = "models/props_nunk/popcan01a.mdl";
ITEM.width = 1;
ITEM.height = 1;
ITEM.description = "Poorly manufactured coffee poured into an old, unmarked can. It has caffeine.";
ITEM.category = "Civil-Approved Drinks";
ITEM.permit = "consumables";
ITEM.flag = "f"
ITEM.price = 12;
ITEM.capacity = 375
ITEM.restoreStamina = 5;
ITEM.dropSound = {
"terranova/ui/can1.wav",
"terranova/ui/can2.wav",
"terranova/ui/can3.wav",
}
|
-- Author: philh30
--
-- 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 cosock = require "cosock"
local socket = require "cosock.socket"
local commands = require('commands')
local log = require('log')
local capabilities = require('st.capabilities')
local utilities = require('utilities')
local capdefs = require('capabilitydefs')
local evlClient = require('envisalink')
local events = require "evthandler"
local function initconfigEVL(device)
local ip
local port
local addr_is_valid = false
ip, port = utilities.validate_address(device.preferences.lanAddressEVL)
if ip ~= nil then
conf.ip = ip
conf.port = port
addr_is_valid = true
else
log.warn ('Invalid EVL LAN address')
end
conf.alarmcode = device.preferences.alarmCodeEVL
conf.password = device.preferences.passwordEVL
conf.zoneclosedelay = tonumber(device.preferences.zoneCloseDelay)
conf.wiredzonemax = tonumber(device.preferences.wiredZoneMax)
if conf.alarmcode ~= nil then
if string.len(device.preferences.alarmCodeEVL) ~= 4 then
log.warn('Invalid alarmcode (not 4 digits')
end
else
log.warn('Invalid alarmcode (not a number)')
end
log.info (string.format('Using config prefs: %s:%d, alarmcode: %d', conf.ip, conf.port, conf.alarmcode))
return(addr_is_valid)
end
---------------------------------------
-- Init Lifecycle Handler
local function init_handler(driver, device)
log.debug(device.id .. ": " .. device.device_network_id .. " : " .. device.model .. " > INITIALIZING PRIMARY PARTITION")
socket.sleep(5)
initialized = true
log.warn('Starting up connection')
if initconfigEVL(device) then
if not evlClient.is_loggedin(driver) then
if not evlClient.is_connected(driver) then
if not commands.connect_to_envisalink(driver,device) then
evlClient.reconnect(driver)
end
end
end
end
log.debug ('Initialization Success!')
end
---------------------------------------
-- InfoChanged Lifecycle Handler
local function add_zones(driver,zoneType,zoneString)
if #zoneString > 0 then
log.debug (string.format('Add %s Zones: %s', zoneType, zoneString))
local zoneTable = utilities.splitString(zoneString,',')
for _, zone in ipairs(zoneTable) do
events.add_zone(driver,zoneType,zone,nil)
end
end
end
local function infoChanged_handler(driver,device, event, args)
log.info(device.id .. ": " .. device.device_network_id .. " > INFO CHANGED PRIMARY PARTITION")
local changed = false
local connection_changed = false
conf.zoneclosedelay = tonumber(device.preferences.zoneCloseDelay)
conf.wiredzonemax = tonumber(device.preferences.wiredZoneMax)
if args.old_st_store.preferences.lanAddressEVL ~= device.preferences.lanAddressEVL then
changed = true
connection_changed = true
end
if (args.old_st_store.preferences.passwordEVL ~= device.preferences.passwordEVL) or (args.old_st_store.preferences.alarmCodeEVL ~= device.preferences.alarmCodeEVL) then
changed = true
end
if changed then
local valid_addr = initconfigEVL(device)
-- Determine if need to (re) connect
if connection_changed and valid_addr then
log.info ('Renewing connection to Envisalink')
if timers.reconnect then
driver:cancel_timer(timers.reconnect)
end
if timers.waitlogin then
driver:cancel_timer(timers.waitlogin)
end
timers.reconnect = nil
socket.sleep(.1)
timers.waitlogin = nil
if evlClient.is_connected(driver) then
evlClient.disconnect(driver)
end
if not commands.connect_to_envisalink(driver,device) then
evlClient.reconnect(driver)
end
end
end
if device.preferences.addZones then
add_zones(driver,'Contact',device.preferences.contactZones)
add_zones(driver,'Motion',device.preferences.motionZones)
add_zones(driver,'Carbon Monoxide',device.preferences.coZones)
add_zones(driver,'Smoke',device.preferences.smokeZones)
add_zones(driver,'Leak',device.preferences.leakZones)
add_zones(driver,'Glass Break',device.preferences.glassZones)
end
if device.preferences.addSwitches or device.preferences.addPartition or device.preferences.addTriggers then
local device_list = driver:get_devices()
local found = {
['disarm'] = false,
['armAway'] = false,
['armStay'] = false,
['armInstant'] = false,
['armMax'] = false,
['armNight'] = false,
['chime'] = false,
['triggerOne'] = false,
['triggerTwo'] = false,
}
for _, dev in ipairs(device_list) do
local dev_id = dev.device_network_id:match('envisalink|s|(.+)|1')
if dev_id then found[dev_id] = true end
end
if device.preferences.addSwitches then
if not found['disarm'] then events.createDevice(driver,'switch','Switch','disarm|1',nil) end
if not found['armAway'] then events.createDevice(driver,'switch','Switch','armAway|1',nil) end
if not found['armStay'] then events.createDevice(driver,'switch','Switch','armStay|1',nil) end
if (not found['armInstant']) and device.preferences.armInstantSupported then events.createDevice(driver,'switch','Switch','armInstant|1',nil) end
if (not found['armMax']) and device.preferences.armMaxSupported then events.createDevice(driver,'switch','Switch','armMax|1',nil) end
if (not found['armNight']) and device.preferences.armNightSupported then events.createDevice(driver,'switch','Switch','armNight|1',nil) end
end
if device.preferences.addPartition then
local part_found = false
for _, dev in ipairs(device_list) do
if dev.device_network_id:match('envisalink|p|2') then
part_found = true
break
end
end
if not part_found then
events.createDevice(driver,'partition', 'Partition', 2, nil)
end
end
if device.preferences.addTriggers then
if not found['triggerOne'] then events.createDevice(driver,'switch','Switch','triggerOne|1',nil) end
if not found['triggerTwo'] then events.createDevice(driver,'switch','Switch','triggerTwo|1',nil) end
end
end
local supported_modes = {'disarm','armAway','armStay'}
if device.preferences.armInstantSupported then
table.insert(supported_modes,'armInstant')
end
if device.preferences.armMaxSupported then
table.insert(supported_modes,'armMax')
end
if device.preferences.armNightSupported then
table.insert(supported_modes,'armNight')
end
device:emit_event(capabilities[capdefs.alarmMode.name].supportedAlarmModes({value = supported_modes}))
end
local function removed_handler(driver, device)
log.info(device.id .. ": " .. device.device_network_id .. " > REMOVED PRIMARY PARTITION")
initialized = false
end
---------------------------------------
-- Primary Partition Sub-Driver
local primary_partition_driver = {
NAME = "Primary Partition",
lifecycle_handlers = {
init = init_handler,
infoChanged = infoChanged_handler,
removed = removed_handler,
deleted = removed_handler,
},
capability_handlers = {},
can_handle = function(opts, driver, device, ...)
return device.model == "Honeywell Primary Partition"
end
}
return primary_partition_driver
|
local HDC1000 = require("HDC1000")
local sda, scl = 1, 2
local drdyn = false
do
i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once
HDC1000.setup(drdyn)
-- prototype is config(address, resolution, heater)
HDC1000.config() -- default values are used if called with no arguments.
print(string.format("Temperature: %.2f °C\nHumidity: %.2f %%", HDC1000.getTemp(), HDC1000.getHumi()))
-- Don't forget to release it after use
HDC1000 = nil -- luacheck: no unused
package.loaded["HDC1000"] = nil
end
|
local _={}
_[5]={}
_[4]={tags=_[5],text="ok"}
_[3]={_[4]}
_[2]={"return"}
_[1]={"text",_[3]}
return {_[1],_[2]}
--[[
{ "text", { {
tags = {},
text = "ok"
} } }
{ "return" }
]]--
|
--[[
Data module for evolutionary families.
The structure of the module is as following: there's a table for each Pokémon,
containing the "ndex" and possibly other infos. The field "notes" contains a
string that is put above the sprite. The field "evos", if any, should contain an
array of tables of Pokémons that evolves from the Pokémon the table belongs to.
Other fields are used to describe the methods used to evolve into this Pokémon.
The field "method" should be one of the constants evo.methods.*, there may be a
field [evo.methods.THISMETHOD] if required by the method (see details after) and
a field conditions, that is a table indexed by evo.conditions.* with values as
described by the condition itself.
--]]
local mw = require('mw')
local tab = require('Wikilib-tables') -- luacheck: no unused
local str = require('Wikilib-strings') -- luacheck: no unused
local links = require('Links')
local ms = require('MiniSprite')
local pokes = require("Poké-data")
local altforms = require("AltForms-data")
local useless = require("UselessForms-data")
local sup = require("Sup-data")
local evo = {}
--[[
Those two tables hold evolution methods and conditions common to multiple
evolutionary line. The meaning of each value is self-explanatory. There's a
special value, 'OTHER', that handles anything that is unique to a single line.
Method and condition 'OTHER' should be used ONLY to handle methods/conditions
that occur in AT MOST ONE evolutionary lines. Should that method/condition be
used again in a new evolutionary line, it's best if we add a new constant to
identify it.
Follows a detailed description of the use of each method and condition.
Methods:
- OTHER: requires [evo.methods.OTHER] to contain the image to be printed.
Doesn't have any default text but relies on the fact that it may be
provided via OTHER condition if needed.
- LEVEL: [evo.methods.LEVEL] may contain the level for evolution, if any,
otherwise nil, meaning that evolution is possible at any level
(given that all other conditions are met).
- HAPPINESS: should be a condition for LEVEL method, but everywhere is
considered a standalone method. Doesn't have any parameters.
- STONE: requires [evo.methods.STONE] to be the name of the evostone.
- TRADE: no parameters.
- BREED: used in the baby form, showing that it may be breeded from the next
phase.
--]]
evo.methods = {}
evo.methods.OTHER = 0
evo.methods.LEVEL = 1
evo.methods.HAPPINESS = 2
evo.methods.STONE = 3
evo.methods.TRADE = 4
evo.methods.BREED = 5
evo.methods.UNKNOWN = 6
--[[
Conditions:
- OTHER: any custom text passed in this condition will be displayed.
- TIME: time of the day, with first uppercase. Normally either "Giorno" or
"Notte".
- ITEM: the name of the item required for evolution, with correct case.
- LOCATION: the place in which evolution may occur.
- MOVE: the name of the move that has to be known by the Pokémon, lowercase.
- GENDER: the gender required, with first uppercase.
- TRADED_FOR: the ndex of the Pokémon required for the trade (makes sense
only as a condition with TRADE method).
- BREEDONLY: this condition specifies that the BREED doesn't imply the
evolution, thus the second phase doesn't need a method and so.
Make sense only as a condition with BREED method.
NB: the value false for a condition is reserved for multigen to signal that
that condition disappeared in a later generation
--]]
evo.conditions = {}
evo.conditions.OTHER = 0
evo.conditions.TIME = 1
evo.conditions.ITEM = 2
evo.conditions.LOCATION = 3
evo.conditions.MOVE = 4
evo.conditions.GENDER = 5
evo.conditions.TRADED_FOR = 6
evo.conditions.BREEDONLY = 7
evo.conditions.REGION = 8
evo.bulbasaur = {
ndex = 1,
name = 'bulbasaur',
evos = {
{
ndex = 2,
name = 'ivysaur',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 3,
name = 'venusaur',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
}
}
}
}
}
evo.ivysaur, evo.venusaur = evo.bulbasaur, evo.bulbasaur
evo[1], evo[2], evo[3] = evo.bulbasaur, evo.bulbasaur, evo.bulbasaur
evo.charmander = {
ndex = 4,
name = 'charmander',
evos = {
{
ndex = 5,
name = 'charmeleon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 6,
name = 'charizard',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.charmeleon, evo.charizard = evo.charmander, evo.charmander
evo[4], evo[5], evo[6] = evo.charmander, evo.charmander, evo.charmander
evo.squirtle = {
ndex = 7,
name = 'squirtle',
evos = {
{
ndex = 8,
name = 'wartortle',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 9,
name = 'blastoise',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.wartortle, evo.blastoise = evo.squirtle, evo.squirtle
evo[7], evo[8], evo[9] = evo.squirtle, evo.squirtle, evo.squirtle
evo.caterpie = {
ndex = 10,
name = 'caterpie',
evos = {
{
ndex = 11,
name = 'metapod',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 7,
evos = {
{
ndex = 12,
name = 'butterfree',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 10,
}
}
}
}
}
evo.metapod, evo.butterfree = evo.caterpie, evo.caterpie
evo[10], evo[11], evo[12] = evo.caterpie, evo.caterpie, evo.caterpie
evo.weedle = {
ndex = 13,
name = 'weedle',
evos = {
{
ndex = 14,
name = 'kakuna',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 7,
evos = {
{
ndex = 15,
name = 'beedrill',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 10,
}
}
}
}
}
evo.kakuna, evo.beedrill = evo.weedle, evo.weedle
evo[13], evo[14], evo[15] = evo.weedle, evo.weedle, evo.weedle
evo.pidgey = {
ndex = 16,
name = 'pidgey',
evos = {
{
ndex = 17,
name = 'pidgeotto',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
evos = {
{
ndex = 18,
name = 'pidgeot',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.pidgeotto, evo.pidgeot = evo.pidgey, evo.pidgey
evo[16], evo[17], evo[18] = evo.pidgey, evo.pidgey, evo.pidgey
evo.rattata = {
ndex = 19,
name = 'rattata',
evos = {
{
ndex = 20,
name = 'raticate',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
}
}
}
evo.raticate = evo.rattata
evo[19], evo[20] = evo.rattata, evo.rattata
evo.spearow = {
ndex = 21,
name = 'spearow',
evos = {
{
ndex = 22,
name = 'fearow',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
}
}
}
evo.fearow = evo.spearow
evo[21], evo[22] = evo.spearow, evo.spearow
evo.ekans = {
ndex = 23,
name = 'ekans',
evos = {
{
ndex = 24,
name = 'arbok',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 22,
}
}
}
evo.arbok = evo.ekans
evo[23], evo[24] = evo.ekans, evo.ekans
evo.pichu = {
ndex = 172,
name = 'pichu',
method = evo.methods.BREED,
evos = {
{
ndex = 25,
name = 'pikachu',
method = evo.methods.HAPPINESS,
evos = {
{
ndex = 26,
name = 'raichu',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietratuono'
},
{
ndex = '026A',
name = 'raichuA',
notes = altforms.raichu.names.A,
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietratuono',
conditions = { [evo.conditions.REGION] = 'Alola' },
}
}
}
}
}
evo.pikachu, evo.raichu, evo.raichuA = evo.pichu, evo.pichu, evo.pichu
evo[172], evo[25], evo[26], evo['026A'] =
evo.pichu, evo.pichu, evo.pichu, evo.pichu
evo.sandshrew = {
ndex = 27,
name = 'sandshrew',
evos = {
{
ndex = 28,
name = 'sandslash',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 22,
}
}
}
evo.sandslash = evo.sandshrew
evo[27], evo[28] = evo.sandshrew, evo.sandshrew
evo["nidoran♀"] = {
ndex = 29,
name = 'nidoran♀',
evos = {
{
ndex = 30,
name = 'nidorina',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 31,
name = 'nidoqueen',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietralunare',
}
}
}
}
}
evo.nidorina, evo.nidoqueen = evo["nidoran♀"], evo["nidoran♀"]
evo[29], evo[30], evo[31] = evo["nidoran♀"], evo["nidoran♀"], evo["nidoran♀"]
evo["nidoran♂"] = {
ndex = 32,
name = 'nidoran♂',
evos = {
{
ndex = 33,
name = 'nidorino',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 34,
name = 'nidoking',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietralunare',
}
}
}
}
}
evo.nidorino, evo.nidoking = evo["nidoran♂"], evo["nidoran♂"]
evo[32], evo[33], evo[34] = evo["nidoran♂"], evo["nidoran♂"], evo["nidoran♂"]
evo.cleffa = {
ndex = 173,
name = 'cleffa',
method = evo.methods.BREED,
evos = {
{
ndex = 35,
name = 'clefairy',
method = evo.methods.HAPPINESS,
evos = {
{
ndex = 36,
name = 'clefable',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietralunare'
}
}
}
}
}
evo.clefairy, evo.clefable = evo.cleffa, evo.cleffa
evo[173], evo[35], evo[36] = evo.cleffa, evo.cleffa, evo.cleffa
evo.vulpix = {
ndex = 37,
name = 'vulpix',
evos = {
{
ndex = 38,
name = 'ninetales',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafocaia',
}
}
}
evo.ninetales = evo.vulpix
evo[37], evo[38] = evo.vulpix, evo.vulpix
evo.igglybuff = {
ndex = 174,
name = 'igglybuff',
method = evo.methods.BREED,
evos = {
{
ndex = 39,
name = 'jigglypuff',
method = evo.methods.HAPPINESS,
evos = {
{
ndex = 40,
name = 'wigglytuff',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietralunare',
}
}
}
}
}
evo.jigglypuff, evo.wigglytuff = evo.igglybuff, evo.igglybuff
evo[174], evo[39], evo[40] = evo.igglybuff, evo.igglybuff, evo.igglybuff
evo.zubat = {
ndex = 41,
name = 'zubat',
evos = {
{
ndex = 42,
name = 'golbat',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 22,
evos = {
{
ndex = 169,
name = 'crobat',
method = evo.methods.HAPPINESS,
}
}
}
}
}
evo.golbat, evo.crobat = evo.zubat, evo.zubat
evo[41], evo[42], evo[169] = evo.zubat, evo.zubat, evo.zubat
evo.oddish = {
ndex = 43,
name = 'oddish',
evos = {
{
ndex = 44,
name = 'gloom',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 21,
evos = {
{
ndex = 45,
name = 'vileplume',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafoglia'
},
{
ndex = 182,
name = 'bellossom',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrasolare'
}
}
}
}
}
evo.gloom, evo.vileplume, evo.bellossom = evo.oddish, evo.oddish, evo.oddish
evo[43], evo[44], evo[45], evo[182] =
evo.oddish, evo.oddish, evo.oddish, evo.oddish
evo.paras = {
ndex = 46,
name = 'paras',
evos = {
{
ndex = 47,
name = 'parasect',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 24,
}
}
}
evo.parasect = evo.paras
evo[46], evo[47] = evo.paras, evo.paras
evo.venonat = {
ndex = 48,
name = 'venonat',
evos = {
{
ndex = 49,
name = 'venomoth',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 31,
}
}
}
evo.venomoth = evo.venonat
evo[48], evo[49] = evo.venonat, evo.venonat
evo.diglett = {
ndex = 50,
name = 'diglett',
evos = {
{
ndex = 51,
name = 'dugtrio',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 26,
}
}
}
evo.dugtrio = evo.diglett
evo[50], evo[51] = evo.diglett, evo.diglett
evo.meowth = {
ndex = 52,
name = 'meowth',
evos = {
{
ndex = 53,
name = 'persian',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 28,
}
}
}
evo.persian = evo.meowth
evo[52], evo[53] = evo.meowth, evo.meowth
evo.psyduck = {
ndex = 54,
name = 'psyduck',
evos = {
{
ndex = 55,
name = 'golduck',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 33,
}
}
}
evo.golduck = evo.psyduck
evo[54], evo[55] = evo.psyduck, evo.psyduck
evo.mankey = {
ndex = 56,
name = 'mankey',
evos = {
{
ndex = 57,
name = 'primeape',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 28,
}
}
}
evo.primeape = evo.mankey
evo[56], evo[57] = evo.mankey, evo.mankey
evo.growlithe = {
ndex = 58,
name = 'growlithe',
evos = {
{
ndex = 59,
name = 'arcanine',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafocaia',
}
}
}
evo.arcanine = evo.growlithe
evo[58], evo[59] = evo.growlithe, evo.growlithe
evo.poliwag = {
ndex = 60,
name = 'poliwag',
evos = {
{
ndex = 61,
name = 'poliwhirl',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
evos = {
{
ndex = 62,
name = 'poliwrath',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietraidrica'
},
{
ndex = 186,
name = 'politoed',
method = evo.methods.TRADE,
conditions = { [evo.conditions.ITEM] = 'Roccia di Re' },
}
}
}
}
}
evo.poliwhirl, evo.poliwrath, evo.politoed = evo.poliwag, evo.poliwag, evo.poliwag
evo[60], evo[61], evo[62], evo[186] =
evo.poliwag, evo.poliwag, evo.poliwag, evo.poliwag
evo.abra = {
ndex = 63,
name = 'abra',
evos = {
{
ndex = 64,
name = 'kadabra',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 65,
name = 'alakazam',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.OTHER] = table.concat{
"oppure<div>",
links.bag("Filo dell'unione"),
"</div>usando un [[Filo dell'unione]]",
},
},
}
}
}
}
}
evo.kadabra, evo.alakazam = evo.abra, evo.abra
evo[63], evo[64], evo[65] = evo.abra, evo.abra, evo.abra
evo.machop = {
ndex = 66,
name = 'machop',
evos = {
{
ndex = 67,
name = 'machoke',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 28,
evos = {
{
ndex = 68,
name = 'machamp',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.OTHER] = table.concat{
"oppure<div>",
links.bag("Filo dell'unione"),
"</div>usando un [[Filo dell'unione]]",
},
},
}
}
}
}
}
evo.machoke, evo.machamp = evo.machop, evo.machop
evo[66], evo[67], evo[68] = evo.machop, evo.machop, evo.machop
evo.bellsprout = {
ndex = 69,
name = 'bellsprout',
evos = {
{
ndex = 70,
name = 'weepinbell',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 21,
evos = {
{
ndex = 71,
name = 'victreebel',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafoglia',
}
}
}
}
}
evo.weepinbell, evo.victreebel = evo.bellsprout, evo.bellsprout
evo[69], evo[70], evo[71] = evo.bellsprout, evo.bellsprout, evo.bellsprout
evo.tentacool = {
ndex = 72,
name = 'tentacool',
evos = {
{
ndex = 73,
name = 'tentacruel',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.tentacruel = evo.tentacool
evo[72], evo[73] = evo.tentacool, evo.tentacool
evo.geodude = {
ndex = 74,
name = 'geodude',
evos = {
{
ndex = 75,
name = 'graveler',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
evos = {
{
ndex = 76,
name = 'golem',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.OTHER] = table.concat{
"oppure<div>",
links.bag("Filo dell'unione"),
"</div>usando un [[Filo dell'unione]]",
},
},
}
}
}
}
}
evo.graveler, evo.golem = evo.geodude, evo.geodude
evo[74], evo[75], evo[76] = evo.geodude, evo.geodude, evo.geodude
evo.ponyta = {
ndex = 77,
name = 'ponyta',
evos = {
{
ndex = 78,
name = 'rapidash',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.rapidash = evo.ponyta
evo[77], evo[78] = evo.ponyta, evo.ponyta
evo.slowpoke = {
ndex = 79,
name = 'slowpoke',
evos = {
{
ndex = 80,
name = 'slowbro',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
},
{
ndex = 199,
name = 'slowking',
method = evo.methods.TRADE,
conditions = { [evo.conditions.ITEM] = 'Roccia di Re' }
}
}
}
evo.slowbro, evo.slowking = evo.slowpoke, evo.slowpoke
evo[79], evo[80], evo[199] = evo.slowpoke, evo.slowpoke, evo.slowpoke
evo.magnemite = {
ndex = 81,
name = 'magnemite',
evos = {
{
ndex = 82,
name = 'magneton',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
evos = {
{
ndex = 462,
name = 'magnezone',
method = evo.methods.LEVEL,
-- conditions = { [evo.conditions.LOCATION] = 'Campo magnetico speciale' },
conditions = {
[evo.conditions.LOCATION] = 'Campo magnetico speciale',
[evo.conditions.OTHER] = table.concat{
"oppure<div>",
links.bag("Pietratuono"),
"</div>usando una [[Pietratuono]]",
},
}
}
}
}
}
}
evo.magneton, evo.magnezone = evo.magnemite, evo.magnemite
evo[81], evo[82], evo[462] = evo.magnemite, evo.magnemite, evo.magnemite
evo["farfetch'd"] = { ndex = 83, name = "farfetch'd" }
evo[83] = evo["farfetch'd"]
evo.doduo = {
ndex = 84,
name = 'doduo',
evos = {
{
ndex = 85,
name = 'dodrio',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 31,
}
}
}
evo.dodrio = evo.doduo
evo[84], evo[85] = evo.doduo, evo.doduo
evo.seel = {
ndex = 86,
name = 'seel',
evos = {
{
ndex = 87,
name = 'dewgong',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
}
evo.dewgong = evo.seel
evo[86], evo[87] = evo.seel, evo.seel
evo.grimer = {
ndex = 88,
name = 'grimer',
evos = {
{
ndex = 89,
name = 'muk',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 38,
}
}
}
evo.muk = evo.grimer
evo[88], evo[89] = evo.grimer, evo.grimer
evo.shellder = {
ndex = 90,
name = 'shellder',
evos = {
{
ndex = 91,
name = 'cloyster',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietraidrica',
}
}
}
evo.cloyster = evo.shellder
evo[90], evo[91] = evo.shellder, evo.shellder
evo.gastly = {
ndex = 92,
name = 'gastly',
evos = {
{
ndex = 93,
name = 'haunter',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
evos = {
{
ndex = 94,
name = 'gengar',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.OTHER] = table.concat{
"oppure<div>",
links.bag("Filo dell'unione"),
"</div>usando un [[Filo dell'unione]]",
},
},
}
}
}
}
}
evo.haunter, evo.gengar = evo.gastly, evo.gastly
evo[92], evo[93], evo[94] = evo.gastly, evo.gastly, evo.gastly
evo.onix = {
ndex = 95,
name = 'onix',
evos = {
{
ndex = 208,
name = 'steelix',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.ITEM] = 'Metalcoperta',
[evo.conditions.OTHER] = "oppure usando [[Metalcoperta]]" .. sup.LPA,
},
}
}
}
evo.steelix = evo.onix
evo[95], evo[208] = evo.onix, evo.onix
evo.drowzee = {
ndex = 96,
name = 'drowzee',
evos = {
{
ndex = 97,
name = 'hypno',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 26,
}
}
}
evo.hypno = evo.drowzee
evo[96], evo[97] = evo.drowzee, evo.drowzee
evo.krabby = {
ndex = 98,
name = 'krabby',
evos = {
{
ndex = 99,
name = 'kingler',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 28,
}
}
}
evo.kingler = evo.krabby
evo[98], evo[99] = evo.krabby, evo.krabby
evo.voltorb = {
ndex = 100,
name = 'voltorb',
evos = {
{
ndex = 101,
name = 'electrode',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.electrode = evo.voltorb
evo[100], evo[101] = evo.voltorb, evo.voltorb
evo.exeggcute = {
ndex = 102,
name = 'exeggcute',
evos = {
{
ndex = 103,
name = 'exeggutor',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafoglia',
},
{
ndex = '103A',
name = 'exeggutorA',
notes = altforms.exeggutor.names.A,
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafoglia',
conditions = { [evo.conditions.REGION] = 'Alola' },
},
}
}
evo.exeggutor, evo.exeggutorA = evo.exeggcute, evo.exeggcute
evo[102], evo[103], evo['103A'] = evo.exeggcute, evo.exeggcute, evo.exeggcute
evo.cubone = {
ndex = 104,
name = 'cubone',
evos = {
{
ndex = 105,
name = 'marowak',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 28,
},
{
ndex = '105A',
name = 'marowakA',
notes = altforms.marowak.names.A,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 28,
conditions = { [evo.conditions.TIME] = 'Notte',
[evo.conditions.REGION] = 'Alola' },
}
}
}
evo.marowak, evo.marowakA = evo.cubone, evo.cubone
evo[104], evo[105], evo['105A'] = evo.cubone, evo.cubone, evo.cubone
evo.tyrogue = {
ndex = 236,
name = 'tyrogue',
method = evo.methods.BREED,
evos = {
{
ndex = 106,
name = 'hitmonlee',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
conditions = { [evo.conditions.OTHER] = 'Con [[Attacco]] > [[Difesa]]' }
},
{
ndex = 107,
name = 'hitmonchan',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
conditions = { [evo.conditions.OTHER] = 'Con [[Attacco]] < [[Difesa]]' }
},
{
ndex = 237,
name = 'hitmontop',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
conditions = { [evo.conditions.OTHER] = 'Con [[Attacco]] = [[Difesa]]' }
}
}
}
evo.hitmonlee, evo.hitmonchan, evo.hitmontop = evo.tyrogue, evo.tyrogue, evo.tyrogue
evo[236], evo[106], evo[107], evo[237] = evo.tyrogue, evo.tyrogue, evo.tyrogue, evo.tyrogue
evo.lickitung = {
ndex = 108,
name = 'lickitung',
evos = {
{
ndex = 463,
name = 'lickilicky',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Rotolamento' }
}
}
}
evo.lickilicky = evo.lickitung
evo[108], evo[463] = evo.lickitung, evo.lickitung
evo.koffing = {
ndex = 109,
name = 'koffing',
evos = {
{
ndex = 110,
name = 'weezing',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
},
{
ndex = '110G',
name = 'weezingG',
notes = altforms.weezing.names.G,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
conditions = { [evo.conditions.REGION] = 'Galar' },
}
}
}
evo.weezing, evo.weezingG = evo.koffing, evo.koffing
evo[109], evo[110], evo['110G'] = evo.koffing, evo.koffing, evo.koffing
evo.rhyhorn = {
ndex = 111,
name = 'rhyhorn',
evos = {
{
ndex = 112,
name = 'rhydon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 42,
evos = {
{
ndex = 464,
name = 'rhyperior',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.ITEM] = 'Copertura',
[evo.conditions.OTHER] = "oppure usando [[Copertura]]" .. sup.LPA,
},
}
}
}
}
}
evo.rhydon, evo.rhyperior = evo.rhyhorn, evo.rhyhorn
evo[111], evo[112], evo[464] = evo.rhyhorn, evo.rhyhorn, evo.rhyhorn
evo.happiny = {
ndex = 440,
name = 'happiny',
method = evo.methods.BREED,
conditions = { [evo.conditions.ITEM] = 'Fortunaroma'},
evos = {
{
ndex = 113,
name = 'chansey',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.ITEM] = 'Pietraovale',
[evo.conditions.TIME] = 'Giorno'},
evos = {
{
ndex = 242,
name = 'blissey',
method = evo.methods.HAPPINESS,
}
}
}
}
}
evo.chansey, evo.blissey = evo.happiny, evo.happiny
evo[440], evo[113], evo[242] = evo.happiny, evo.happiny, evo.happiny
evo.tangela = {
ndex = 114,
name = 'tangela',
evos = {
{
ndex = 465,
name = 'tangrowth',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Forzantica' },
}
}
}
evo.tangrowth = evo.tangela
evo[114], evo[465] = evo.tangela, evo.tangela
evo.kangaskhan = { ndex = 115, name = 'kangaskhan' }
evo[115] = evo.kangaskhan
evo.horsea = {
ndex = 116,
name = 'horsea',
evos = {
{
ndex = 117,
name = 'seadra',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
evos = {
{
ndex = 230,
name = 'kingdra',
method = evo.methods.TRADE,
conditions = { [evo.conditions.ITEM] = 'Squama Drago' },
}
}
}
}
}
evo.seadra, evo.kingdra = evo.horsea, evo.horsea
evo[116], evo[117], evo[230] = evo.horsea, evo.horsea, evo.horsea
evo.goldeen = {
ndex = 118,
name = 'goldeen',
evos = {
{
ndex = 119,
name = 'seaking',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 33,
}
}
}
evo.seaking = evo.goldeen
evo[118], evo[119] = evo.goldeen, evo.goldeen
evo.staryu = {
ndex = 120,
name = 'staryu',
evos = {
{
ndex = 121,
name = 'starmie',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietraidrica',
}
}
}
evo.starmie = evo.staryu
evo[120], evo[121] = evo.staryu, evo.staryu
evo["mime jr."] = {
ndex = 439,
name = 'mime jr.',
method = evo.methods.BREED,
conditions = { [evo.conditions.ITEM] = 'Bizzoaroma' },
evos = {
{
ndex = 122,
name = 'mr. mime',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Mimica' },
},
{
ndex = '122G',
name = "mr. mimeG",
notes = altforms["mr. mime"].names.G,
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Mimica',
[evo.conditions.REGION] = 'Galar' },
evos = {
{
ndex = 866,
name = "mr. rime",
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 42,
}
}
},
}
}
evo["mr. mime"] = evo["mime jr."]
evo[439], evo[122] = evo["mime jr."], evo["mime jr."]
evo["mr. rime"], evo["mr. mimeG"] = evo["mime jr."], evo["mime jr."]
evo['122G'], evo[866] = evo["mr. mimeG"], evo["mr. mimeG"]
evo.scyther = {
ndex = 123,
name = 'scyther',
evos = {
{
ndex = 212,
name = 'scizor',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.ITEM] = 'Metalcoperta',
[evo.conditions.OTHER] = "oppure usando [[Metalcoperta]]" .. sup.LPA,
},
},
{
ndex = 900,
name = 'kleavor',
method = evo.methods.STONE,
[evo.methods.STONE] = "Augite nera",
},
}
}
evo.scizor, evo.kleavor = evo.scyther, evo.scyther
evo[123], evo[212], evo[900] = evo.scyther, evo.scyther, evo.scyther
evo.smoochum = {
ndex = 238,
name = 'smoochum',
method = evo.methods.BREED,
evos = {
{
ndex = 124,
name = 'jynx',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.jynx = evo.smoochum
evo[238], evo[124] = evo.smoochum, evo.smoochum
evo.elekid = {
ndex = 239,
name = 'elekid',
method = evo.methods.BREED,
evos = {
{
ndex = 125,
name = 'electabuzz',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
evos = {
{
ndex = 466,
name = 'electivire',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.ITEM] = 'Elettritore',
[evo.conditions.OTHER] = "oppure usando [[Elettritore]]" .. sup.LPA,
},
}
}
}
}
}
evo.electabuzz, evo.electivire = evo.elekid, evo.elekid
evo[239], evo[125], evo[466] = evo.elekid, evo.elekid, evo.elekid
evo.magby = {
ndex = 240,
name = 'magby',
method = evo.methods.BREED,
evos = {
{
ndex = 126,
name = 'magmar',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
evos = {
{
ndex = 467,
name = 'magmortar',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.ITEM] = 'Magmatore',
[evo.conditions.OTHER] = "oppure usando [[Magmatore]]" .. sup.LPA,
},
}
}
}
}
}
evo.magmar, evo.magmortar = evo.magby, evo.magby
evo[240], evo[126], evo[467] = evo.magby, evo.magby, evo.magby
evo.pinsir = { ndex = 127, name = 'pinsir' }
evo[127] = evo.pinsir
evo.tauros = { ndex = 128, name = 'tauros' }
evo[128] = evo.tauros
evo.magikarp = {
ndex = 129,
name = 'magikarp',
evos = {
{
ndex = 130,
name = 'gyarados',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
}
}
}
evo.gyarados = evo.magikarp
evo[129], evo[130] = evo.magikarp, evo.magikarp
evo.lapras = { ndex = 131, name = 'lapras' }
evo[131] = evo.lapras
evo.ditto = { ndex = 132, name = 'ditto' }
evo[132] = evo.ditto
evo.eevee = {
ndex = 133,
name = 'eevee',
evos = {
{
ndex = 134,
name = 'vaporeon',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietraidrica',
},
{
ndex = 135,
name = 'jolteon',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietratuono',
},
{
ndex = 136,
name = 'flareon',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafocaia',
},
{
ndex = 196,
name = 'espeon',
method = evo.methods.HAPPINESS,
conditions = { [evo.conditions.TIME] = 'Giorno' },
},
{
ndex = 197,
name = 'umbreon',
method = evo.methods.HAPPINESS,
conditions = { [evo.conditions.TIME] = 'Notte' },
},
{
ndex = 470,
name = 'leafeon',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafoglia',
conditions = {
[evo.conditions.OTHER] = table.concat{
"oppure<div>",
links.bag('Mappa città'),
"</div>[[Livello|aumento di livello]] presso una [[Roccia Muschio]]",
},
},
},
{
ndex = 471,
name = 'glaceon',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietragelo',
conditions = {
[evo.conditions.OTHER] = table.concat{
"oppure<div>",
links.bag('Mappa città'),
"</div>[[Livello|aumento di livello]] presso una [[Roccia Ghiaccio]]",
},
},
},
{
ndex = 700,
name = 'sylveon',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.OTHER] = "Con il [[affetto|legame]] moderatamente alto<div>avendo appreso una mossa di tipo [[Folletto]]</div>" },
}
}
}
evo.vaporeon, evo.jolteon, evo.flareon, evo.espeon, evo.umbreon, evo.leafeon, evo.glaceon, evo.sylveon =
evo.eevee, evo.eevee, evo.eevee, evo.eevee, evo.eevee, evo.eevee, evo.eevee, evo.eevee
evo[133], evo[134], evo[135], evo[136], evo[196], evo[197], evo[470], evo[471], evo[700] =
evo.eevee, evo.eevee, evo.eevee, evo.eevee, evo.eevee, evo.eevee, evo.eevee, evo.eevee, evo.eevee
evo.porygon = {
ndex = 137,
name = 'porygon',
evos = {
{
ndex = 233,
name = 'porygon2',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.ITEM] = 'Upgrade',
[evo.conditions.OTHER] = "oppure usando [[Upgrade]]" .. sup.LPA,
},
evos = {
{
ndex = 474,
name = 'porygon-z',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.ITEM] = 'Dubbiodisco',
[evo.conditions.OTHER] = "oppure usando [[Dubbiodisco]]" .. sup.LPA,
},
}
}
}
}
}
evo.porygon2, evo["porygon-z"] = evo.porygon, evo.porygon
evo[137], evo[233], evo[474] = evo.porygon, evo.porygon, evo.porygon
evo.omanyte = {
ndex = 138,
name = 'omanyte',
evos = {
{
ndex = 139,
name = 'omastar',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.omastar = evo.omanyte
evo[138], evo[139] = evo.omanyte, evo.omanyte
evo.kabuto = {
ndex = 140,
name = 'kabuto',
evos = {
{
ndex = 141,
name = 'kabutops',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.kabutops = evo.kabuto
evo[140], evo[141] = evo.kabuto, evo.kabuto
evo.aerodactyl = { ndex = 142, name = 'aerodactyl' }
evo[142] = evo.aerodactyl
evo.munchlax = {
ndex = 446,
name = 'munchlax',
method = evo.methods.BREED,
conditions = { [evo.conditions.ITEM] = 'Gonfioaroma' },
evos = {
{
ndex = 143,
name = 'snorlax',
method = evo.methods.HAPPINESS,
}
}
}
evo.snorlax = evo.munchlax
evo[446], evo[143] = evo.munchlax, evo.munchlax
evo.articuno = { ndex = 144, name = 'articuno' }
evo[144] = evo.articuno
evo.zapdos = { ndex = 145, name = 'zapdos' }
evo[145] = evo.zapdos
evo.moltres = { ndex = 146, name = 'moltres' }
evo[146] = evo.moltres
evo.dratini = {
ndex = 147,
name = 'dratini',
evos = {
{
ndex = 148,
name = 'dragonair',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
evos = {
{
ndex = 149,
name = 'dragonite',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 55,
}
}
}
}
}
evo.dragonair, evo.dragonite = evo.dratini, evo.dratini
evo[147], evo[148], evo[149] = evo.dratini, evo.dratini, evo.dratini
evo.mewtwo = { ndex = 150, name = 'mewtwo' }
evo[150] = evo.mewtwo
evo.mew = { ndex = 151, name = 'mew' }
evo[151] = evo.mew
evo.chikorita = {
ndex = 152,
name = 'chikorita',
evos = {
{
ndex = 153,
name = 'bayleef',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 154,
name = 'meganium',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
}
}
}
}
}
evo.bayleef, evo.meganium = evo.chikorita, evo.chikorita
evo[152], evo[153], evo[154] = evo.chikorita, evo.chikorita, evo.chikorita
evo.cyndaquil = {
ndex = 155,
name = 'cyndaquil',
evos = {
{
ndex = 156,
name = 'quilava',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 14,
evos = {
{
ndex = 157,
name = 'typhlosion',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
},
{
ndex = '157H',
name = 'typhlosionH',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
conditions = { [evo.conditions.REGION] = 'Hisui' },
}
}
}
}
}
evo.quilava, evo.typhlosion, evo.typhlosionH = evo.cyndaquil, evo.cyndaquil, evo.cyndaquil
evo[155], evo[156], evo[157], evo['157H'] = evo.cyndaquil, evo.cyndaquil, evo.cyndaquil, evo.cyndaquil
evo.totodile = {
ndex = 158,
name = 'totodile',
evos = {
{
ndex = 159,
name = 'croconaw',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
evos = {
{
ndex = 160,
name = 'feraligatr',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
}
}
evo.croconaw, evo.feraligatr = evo.totodile, evo.totodile
evo[158], evo[159], evo[160] = evo.totodile, evo.totodile, evo.totodile
evo.sentret = {
ndex = 161,
name = 'sentret',
evos = {
{
ndex = 162,
name = 'furret',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 15,
}
}
}
evo.furret = evo.sentret
evo[161], evo[162] = evo.sentret, evo.sentret
evo.hoothoot = {
ndex = 163,
name = 'hoothoot',
evos = {
{
ndex = 164,
name = 'noctowl',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
}
}
}
evo.noctowl = evo.hoothoot
evo[163], evo[164] = evo.hoothoot, evo.hoothoot
evo.ledyba = {
ndex = 165,
name = 'ledyba',
evos = {
{
ndex = 166,
name = 'ledian',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
}
}
}
evo.ledian = evo.ledyba
evo[165], evo[166] = evo.ledyba, evo.ledyba
evo.spinarak = {
ndex = 167,
name = 'spinarak',
evos = {
{
ndex = 168,
name = 'ariados',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 22,
}
}
}
evo.ariados = evo.spinarak
evo[167], evo[168] = evo.spinarak, evo.spinarak
evo.chinchou = {
ndex = 170,
name = 'chinchou',
evos = {
{
ndex = 171,
name = 'lanturn',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 27,
}
}
}
evo.lanturn = evo.chinchou
evo[170], evo[171] = evo.chinchou, evo.chinchou
evo.togepi = {
ndex = 175,
name = 'togepi',
method = evo.methods.BREED,
evos = {
{
ndex = 176,
name = 'togetic',
method = evo.methods.HAPPINESS,
evos = {
{
ndex = 468,
name = 'togekiss',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrabrillo',
}
}
}
}
}
evo.togetic, evo.togekiss = evo.togepi, evo.togepi
evo[175], evo[176], evo[468] = evo.togepi, evo.togepi, evo.togepi
evo.natu = {
ndex = 177,
name = 'natu',
evos = {
{
ndex = 178,
name = 'xatu',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
}
}
}
evo.xatu = evo.natu
evo[177], evo[178] = evo.natu, evo.natu
evo.mareep = {
ndex = 179,
name = 'mareep',
evos = {
{
ndex = 180,
name = 'flaaffy',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 15,
evos = {
{
ndex = 181,
name = 'ampharos',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
}
}
evo.flaaffy, evo.ampharos = evo.mareep, evo.mareep
evo[179], evo[180], evo[181] = evo.mareep, evo.mareep, evo.mareep
evo.azurill = {
ndex = 298,
name = 'azurill',
method = evo.methods.BREED,
conditions = { [evo.conditions.ITEM] = 'Marearoma' },
evos = {
{
ndex = 183,
name = 'marill',
method = evo.methods.HAPPINESS,
evos = {
{
ndex = 184,
name = 'azumarill',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
}
}
}
}
}
evo.marill, evo.azumarill = evo.azurill, evo.azurill
evo[298], evo[183], evo[184] = evo.azurill, evo.azurill, evo.azurill
evo.bonsly = {
ndex = 438,
name = 'bonsly',
method = evo.methods.BREED,
conditions = { [evo.conditions.ITEM] = 'Roccioaroma' },
evos = {
{
ndex = 185,
name = 'sudowoodo',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Mimica' },
}
}
}
evo.sudowoodo = evo.bonsly
evo[438], evo[185] = evo.bonsly, evo.bonsly
evo.hoppip = {
ndex = 187,
name = 'hoppip',
evos = {
{
ndex = 188,
name = 'skiploom',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
evos = {
{
ndex = 189,
name = 'jumpluff',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 27,
}
}
}
}
}
evo.skiploom, evo.jumpluff = evo.hoppip, evo.hoppip
evo[187], evo[188], evo[189] = evo.hoppip, evo.hoppip, evo.hoppip
evo.aipom = {
ndex = 190,
name = 'aipom',
evos = {
{
ndex = 424,
name = 'ambipom',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Doppiosmash' },
}
}
}
evo.ambipom = evo.aipom
evo[190], evo[424] = evo.aipom, evo.aipom
evo.sunkern = {
ndex = 191,
name = 'sunkern',
evos = {
{
ndex = 192,
name = 'sunflora',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrasolare',
}
}
}
evo.sunflora = evo.sunkern
evo[191], evo[192] = evo.sunkern, evo.sunkern
evo.yanma = {
ndex = 193,
name = 'yanma',
evos = {
{
ndex = 469,
name = 'yanmega',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Forzantica' },
}
}
}
evo.yanmega = evo.yanma
evo[193], evo[469] = evo.yanma, evo.yanma
evo.wooper = {
ndex = 194,
name = 'wooper',
evos = {
{
ndex = 195,
name = 'quagsire',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
}
}
}
evo.quagsire = evo.wooper
evo[194], evo[195] = evo.wooper, evo.wooper
evo.murkrow = {
ndex = 198,
name = 'murkrow',
evos = {
{
ndex = 430,
name = 'honchkrow',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Neropietra',
}
}
}
evo.honchkrow = evo.murkrow
evo[198], evo[430] = evo.murkrow, evo.murkrow
evo.misdreavus = {
ndex = 200,
name = 'misdreavus',
evos = {
{
ndex = 429,
name = 'mismagius',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Neropietra',
}
}
}
evo.mismagius = evo.misdreavus
evo[200], evo[429] = evo.misdreavus, evo.misdreavus
evo.unown = { ndex = 201, name = 'unown' }
evo[201] = evo.unown
evo.wynaut = {
ndex = 360,
name = 'wynaut',
method = evo.methods.BREED,
conditions = { [evo.conditions.ITEM] = 'Distraroma' },
evos = {
{
ndex = 202,
name = 'wobbuffet',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 15,
}
}
}
evo.wobbuffet = evo.wynaut
evo[360], evo[202] = evo.wynaut, evo.wynaut
evo.girafarig = { ndex = 203, name = 'girafarig' }
evo[203] = evo.girafarig
evo.pineco = {
ndex = 204,
name = 'pineco',
evos = {
{
ndex = 205,
name = 'forretress',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 31,
}
}
}
evo.forretress = evo.pineco
evo[204], evo[205] = evo.pineco, evo.pineco
evo.dunsparce = { ndex = 206, name = 'dunsparce' }
evo[206] = evo.dunsparce
evo.gligar = {
ndex = 207,
name = 'gligar',
evos = {
{
ndex = 472,
name = 'gliscor',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.ITEM] = 'Affilodente',
[evo.conditions.TIME] = 'Notte' },
}
}
}
evo.gliscor = evo.gligar
evo[207], evo[472] = evo.gligar, evo.gligar
evo.snubbull = {
ndex = 209,
name = 'snubbull',
evos = {
{
ndex = 210,
name = 'granbull',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 23,
}
}
}
evo.granbull = evo.snubbull
evo[209], evo[210] = evo.snubbull, evo.snubbull
evo.qwilfish = { ndex = 211, name = 'qwilfish' }
evo[211] = evo.qwilfish
evo.shuckle = { ndex = 213, name = 'shuckle' }
evo[213] = evo.shuckle
evo.heracross = { ndex = 214, name = 'heracross' }
evo[214] = evo.heracross
evo.sneasel = {
ndex = 215,
name = 'sneasel',
evos = {
{
ndex = 461,
name = 'weavile',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.ITEM] = 'Affilartigli',
[evo.conditions.TIME] = 'Notte' },
}
}
}
evo.weavile = evo.sneasel
evo[215], evo[461] = evo.sneasel, evo.sneasel
evo.teddiursa = {
ndex = 216,
name = 'teddiursa',
evos = {
{
ndex = 217,
name = 'ursaring',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
evos = {
{
ndex = 901,
name = 'ursaluna',
method = evo.methods.STONE,
[evo.methods.STONE] = "Blocco di torba",
conditions = { [evo.conditions.TIME] = "Luna piena" },
}
}
}
}
}
evo.ursaring, evo.ursaluna = evo.teddiursa, evo.teddiursa
evo[216], evo[217], evo[901] = evo.teddiursa, evo.teddiursa, evo.teddiursa
evo.slugma = {
ndex = 218,
name = 'slugma',
evos = {
{
ndex = 219,
name = 'magcargo',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 38,
}
}
}
evo.magcargo = evo.slugma
evo[218], evo[219] = evo.slugma, evo.slugma
evo.swinub = {
ndex = 220,
name = 'swinub',
evos = {
{
ndex = 221,
name = 'piloswine',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 33,
evos = {
{
ndex = 473,
name = 'mamoswine',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Forzantica' },
}
}
}
}
}
evo.piloswine, evo.mamoswine = evo.swinub, evo.swinub
evo[220], evo[221], evo[473] = evo.swinub, evo.swinub, evo.swinub
evo.corsola = { ndex = 222, name = 'corsola' }
evo[222] = evo.corsola
evo.remoraid = {
ndex = 223,
name = 'remoraid',
evos = {
{
ndex = 224,
name = 'octillery',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
}
}
}
evo.octillery = evo.remoraid
evo[223], evo[224] = evo.remoraid, evo.remoraid
evo.delibird = { ndex = 225, name = 'delibird' }
evo[225] = evo.delibird
evo.mantyke = {
ndex = 458,
name = 'mantyke',
method = evo.methods.BREED,
conditions = { [evo.conditions.ITEM] = 'Ondaroma' },
evos = {
{
ndex = 226,
name = 'mantine',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.OTHER] = 'Con [[Remoraid]] in [[squadra]]' },
}
}
}
evo.mantine = evo.mantyke
evo[458], evo[226] = evo.mantyke, evo.mantyke
evo.skarmory = { ndex = 227, name = 'skarmory' }
evo[227] = evo.skarmory
evo.houndour = {
ndex = 228,
name = 'houndour',
evos = {
{
ndex = 229,
name = 'houndoom',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 24,
}
}
}
evo.houndoom = evo.houndour
evo[228], evo[229] = evo.houndour, evo.houndour
evo.phanpy = {
ndex = 231,
name = 'phanpy',
evos = {
{
ndex = 232,
name = 'donphan',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
}
}
}
evo.donphan = evo.phanpy
evo[231], evo[232] = evo.phanpy, evo.phanpy
evo.stantler = {
ndex = 234,
name = 'stantler',
evos = {
{
ndex = 899,
name = 'wyrdeer',
method = evo.methods.OTHER,
[evo.methods.OTHER] = "Usando [[Barrierassalto]] 20 volte come [[Tecnica rapida]]",
}
}
}
evo.wyrdeer = evo.stantler
evo[234], evo[899] = evo.stantler, evo.stantler
evo.smeargle = { ndex = 235, name = 'smeargle' }
evo[235] = evo.smeargle
evo.miltank = { ndex = 241, name = 'miltank' }
evo[241] = evo.miltank
evo.raikou = { ndex = 243, name = 'raikou' }
evo[243] = evo.raikou
evo.entei = { ndex = 244, name = 'entei' }
evo[244] = evo.entei
evo.suicune = { ndex = 245, name = 'suicune' }
evo[245] = evo.suicune
evo.larvitar = {
ndex = 246,
name = 'larvitar',
evos = {
{
ndex = 247,
name = 'pupitar',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
evos = {
{
ndex = 248,
name = 'tyranitar',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 55,
}
}
}
}
}
evo.pupitar, evo.tyranitar = evo.larvitar, evo.larvitar
evo[246], evo[247], evo[248] = evo.larvitar, evo.larvitar, evo.larvitar
evo.lugia = { ndex = 249, name = 'lugia' }
evo[249] = evo.lugia
evo["ho-oh"] = { ndex = 250, name = 'ho-oh' }
evo[250] = evo["ho-oh"]
evo.celebi = { ndex = 251, name = 'celebi' }
evo[251] = evo.celebi
evo.treecko = {
ndex = 252,
name = 'treecko',
evos = {
{
ndex = 253,
name = 'grovyle',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 254,
name = 'sceptile',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.grovyle, evo.sceptile = evo.treecko, evo.treecko
evo[252], evo[253], evo[254] = evo.treecko, evo.treecko, evo.treecko
evo.torchic = {
ndex = 255,
name = 'torchic',
evos = {
{
ndex = 256,
name = 'combusken',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 257,
name = 'blaziken',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.combusken, evo.blaziken = evo.torchic, evo.torchic
evo[255], evo[256], evo[257] = evo.torchic, evo.torchic, evo.torchic
evo.mudkip = {
ndex = 258,
name = 'mudkip',
evos = {
{
ndex = 259,
name = 'marshtomp',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 260,
name = 'swampert',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.marshtomp, evo.swampert = evo.mudkip, evo.mudkip
evo[258], evo[259], evo[260] = evo.mudkip, evo.mudkip, evo.mudkip
evo.poochyena = {
ndex = 261,
name = 'poochyena',
evos = {
{
ndex = 262,
name = 'mightyena',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
}
}
}
evo.mightyena = evo.poochyena
evo[261], evo[262] = evo.poochyena, evo.poochyena
evo.zigzagoon = {
ndex = 263,
name = 'zigzagoon',
evos = {
{
ndex = 264,
name = 'linoone',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
}
}
}
evo.linoone = evo.zigzagoon
evo[263], evo[264] = evo.zigzagoon, evo.zigzagoon
evo.wurmple = {
ndex = 265,
name = 'wurmple',
evos = {
{
ndex = 266,
name = 'silcoon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 7,
conditions = { [evo.conditions.OTHER] = 'A seconda della [[personalità]]' },
evos = {
{
ndex = 267,
name = 'beautifly',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 10,
}
}
},
{
ndex = 268,
name = 'cascoon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 7,
conditions = { [evo.conditions.OTHER] = 'A seconda della [[personalità]]' },
evos = {
{
ndex = 269,
name = 'dustox',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 10,
}
}
}
}
}
evo.silcoon, evo.beautifly, evo.cascoon, evo.dustox = evo.wurmple, evo.wurmple, evo.wurmple, evo.wurmple
evo[265], evo[266], evo[267], evo[268], evo[269] = evo.wurmple, evo.wurmple, evo.wurmple, evo.wurmple, evo.wurmple
evo.lotad = {
ndex = 270,
name = 'lotad',
evos = {
{
ndex = 271,
name = 'lombre',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 14,
evos = {
{
ndex = 272,
name = 'ludicolo',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietraidrica',
}
}
}
}
}
evo.lombre, evo.ludicolo = evo.lotad, evo.lotad
evo[270], evo[271], evo[272] = evo.lotad, evo.lotad, evo.lotad
evo.seedot = {
ndex = 273,
name = 'seedot',
evos = {
{
ndex = 274,
name = 'nuzleaf',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 14,
evos = {
{
ndex = 275,
name = 'shiftry',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafoglia',
}
}
}
}
}
evo.nuzleaf, evo.shiftry = evo.seedot, evo.seedot
evo[273], evo[274], evo[275] = evo.seedot, evo.seedot, evo.seedot
evo.taillow = {
ndex = 276,
name = 'taillow',
evos = {
{
ndex = 277,
name = 'swellow',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 22,
}
}
}
evo.swellow = evo.taillow
evo[276], evo[277] = evo.taillow, evo.taillow
evo.wingull = {
ndex = 278,
name = 'wingull',
evos = {
{
ndex = 279,
name = 'pelipper',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
}
}
}
evo.pelipper = evo.wingull
evo[278], evo[279] = evo.wingull, evo.wingull
evo.ralts = {
ndex = 280,
name = 'ralts',
evos = {
{
ndex = 281,
name = 'kirlia',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
evos = {
{
ndex = 282,
name = 'gardevoir',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
},
{
ndex = 475,
name = 'gallade',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietralbore',
conditions = { [evo.conditions.GENDER] = 'Maschio' },
}
}
}
}
}
evo.kirlia, evo.gardevoir, evo.gallade = evo.ralts, evo.ralts, evo.ralts
evo[280], evo[281], evo[282], evo[475] = evo.ralts, evo.ralts, evo.ralts, evo.ralts
evo.surskit = {
ndex = 283,
name = 'surskit',
evos = {
{
ndex = 284,
name = 'masquerain',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 22,
}
}
}
evo.masquerain = evo.surskit
evo[283], evo[284] = evo.surskit, evo.surskit
evo.shroomish = {
ndex = 285,
name = 'shroomish',
evos = {
{
ndex = 286,
name = 'breloom',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 23,
}
}
}
evo.breloom = evo.shroomish
evo[285], evo[286] = evo.shroomish, evo.shroomish
evo.slakoth = {
ndex = 287,
name = 'slakoth',
evos = {
{
ndex = 288,
name = 'vigoroth',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
evos = {
{
ndex = 289,
name = 'slaking',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.vigoroth, evo.slaking = evo.slakoth, evo.slakoth
evo[287], evo[288], evo[289] = evo.slakoth, evo.slakoth, evo.slakoth
evo.nincada = {
ndex = 290,
name = 'nincada',
evos = {
{
ndex = 291,
name = 'ninjask',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
},
{
ndex = 292,
name = 'shedinja',
method = evo.methods.OTHER,
[evo.methods.OTHER] = links.bag("Poké Ball"),
conditions = { [evo.conditions.OTHER] = 'Con spazio in [[squadra]]<div>e almeno una [[Poké Ball]] nella [[Borsa]]</div>' },
}
}
}
evo.ninjask, evo.shedinja = evo.nincada, evo.nincada
evo[290], evo[291], evo[292] = evo.nincada, evo.nincada, evo.nincada
evo.whismur = {
ndex = 293,
name = 'whismur',
evos = {
{
ndex = 294,
name = 'loudred',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
evos = {
{
ndex = 295,
name = 'exploud',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
}
}
evo.loudred, evo.exploud = evo.whismur, evo.whismur
evo[293], evo[294], evo[295] = evo.whismur, evo.whismur, evo.whismur
evo.makuhita = {
ndex = 296,
name = 'makuhita',
evos = {
{
ndex = 297,
name = 'hariyama',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 24,
}
}
}
evo.hariyama = evo.makuhita
evo[296], evo[297] = evo.makuhita, evo.makuhita
evo.nosepass = {
ndex = 299,
name = 'nosepass',
evos = {
{
ndex = 476,
name = 'probopass',
method = evo.methods.LEVEL,
conditions = {
[evo.conditions.LOCATION] = 'Campo magnetico speciale',
[evo.conditions.OTHER] = table.concat{
"oppure<br>",
links.bag("Pietratuono"),
"<br>usando una [[Pietratuono]]<br>",
"oppure facendolo uscire dalla ball alle [[Pendici Corona]]",
},
},
}
}
}
evo.probopass = evo.nosepass
evo[299], evo[476] = evo.nosepass, evo.nosepass
evo.skitty = {
ndex = 300,
name = 'skitty',
evos = {
{
ndex = 301,
name = 'delcatty',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietralunare',
}
}
}
evo.delcatty = evo.skitty
evo[300], evo[301] = evo.skitty, evo.skitty
evo.sableye = { ndex = 302, name = 'sableye' }
evo[302] = evo.sableye
evo.mawile = { ndex = 303, name = 'mawile' }
evo[303] = evo.mawile
evo.aron = {
ndex = 304,
name = 'aron',
evos = {
{
ndex = 305,
name = 'lairon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
evos = {
{
ndex = 306,
name = 'aggron',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 42,
}
}
}
}
}
evo.lairon, evo.aggron = evo.aron, evo.aron
evo[304], evo[305], evo[306] = evo.aron, evo.aron, evo.aron
evo.meditite = {
ndex = 307,
name = 'meditite',
evos = {
{
ndex = 308,
name = 'medicham',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
}
}
}
evo.medicham = evo.meditite
evo[307], evo[308] = evo.meditite, evo.meditite
evo.electrike = {
ndex = 309,
name = 'electrike',
evos = {
{
ndex = 310,
name = 'manectric',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 26,
}
}
}
evo.manectric = evo.electrike
evo[309], evo[310] = evo.electrike, evo.electrike
evo.plusle = { ndex = 311, name = 'plusle' }
evo[311] = evo.plusle
evo.minun = { ndex = 312, name = 'minun' }
evo[312] = evo.minun
evo.volbeat = { ndex = 313, name = 'volbeat' }
evo[313] = evo.volbeat
evo.illumise = { ndex = 314, name = 'illumise' }
evo[314] = evo.illumise
evo.budew = {
ndex = 406,
name = 'budew',
method = evo.methods.BREED,
conditions = { [evo.conditions.ITEM] = 'Rosaroma' },
evos = {
{
ndex = 315,
name = 'roselia',
method = evo.methods.HAPPINESS,
conditions = { [evo.conditions.TIME] = 'Giorno' },
evos = {
{
ndex = 407,
name = 'roserade',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrabrillo',
}
}
}
}
}
evo.roselia, evo.roserade = evo.budew, evo.budew
evo[406], evo[315], evo[407] = evo.budew, evo.budew, evo.budew
evo.gulpin = {
ndex = 316,
name = 'gulpin',
evos = {
{
ndex = 317,
name = 'swalot',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 26,
}
}
}
evo.swalot = evo.gulpin
evo[316], evo[317] = evo.gulpin, evo.gulpin
evo.carvanha = {
ndex = 318,
name = 'carvanha',
evos = {
{
ndex = 319,
name = 'sharpedo',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.sharpedo = evo.carvanha
evo[318], evo[319] = evo.carvanha, evo.carvanha
evo.wailmer = {
ndex = 320,
name = 'wailmer',
evos = {
{
ndex = 321,
name = 'wailord',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.wailord = evo.wailmer
evo[320], evo[321] = evo.wailmer, evo.wailmer
evo.numel = {
ndex = 322,
name = 'numel',
evos = {
{
ndex = 323,
name = 'camerupt',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 33,
}
}
}
evo.camerupt = evo.numel
evo[322], evo[323] = evo.numel, evo.numel
evo.torkoal = { ndex = 324, name = 'torkoal' }
evo[324] = evo.torkoal
evo.spoink = {
ndex = 325,
name = 'spoink',
evos = {
{
ndex = 326,
name = 'grumpig',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
}
}
}
evo.grumpig = evo.spoink
evo[325], evo[326] = evo.spoink, evo.spoink
evo.spinda = { ndex = 327, name = 'spinda' }
evo[327] = evo.spinda
evo.trapinch = {
ndex = 328,
name = 'trapinch',
evos = {
{
ndex = 329,
name = 'vibrava',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
evos = {
{
ndex = 330,
name = 'flygon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 45,
}
}
}
}
}
evo.vibrava, evo.flygon = evo.trapinch, evo.trapinch
evo[328], evo[329], evo[330] = evo.trapinch, evo.trapinch, evo.trapinch
evo.cacnea = {
ndex = 331,
name = 'cacnea',
evos = {
{
ndex = 332,
name = 'cacturne',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
}
}
}
evo.cacturne = evo.cacnea
evo[331], evo[332] = evo.cacnea, evo.cacnea
evo.swablu = {
ndex = 333,
name = 'swablu',
evos = {
{
ndex = 334,
name = 'altaria',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
}
}
}
evo.altaria = evo.swablu
evo[333], evo[334] = evo.swablu, evo.swablu
evo.zangoose = { ndex = 335, name = 'zangoose' }
evo[335] = evo.zangoose
evo.seviper = { ndex = 336, name = 'seviper' }
evo[336] = evo.seviper
evo.lunatone = { ndex = 337, name = 'lunatone' }
evo[337] = evo.lunatone
evo.solrock = { ndex = 338, name = 'solrock' }
evo[338] = evo.solrock
evo.barboach = {
ndex = 339,
name = 'barboach',
evos = {
{
ndex = 340,
name = 'whiscash',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.whiscash = evo.barboach
evo[339], evo[340] = evo.barboach, evo.barboach
evo.corphish = {
ndex = 341,
name = 'corphish',
evos = {
{
ndex = 342,
name = 'crawdaunt',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.crawdaunt = evo.corphish
evo[341], evo[342] = evo.corphish, evo.corphish
evo.baltoy = {
ndex = 343,
name = 'baltoy',
evos = {
{
ndex = 344,
name = 'claydol',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
evo.claydol = evo.baltoy
evo[343], evo[344] = evo.baltoy, evo.baltoy
evo.lileep = {
ndex = 345,
name = 'lileep',
evos = {
{
ndex = 346,
name = 'cradily',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.cradily = evo.lileep
evo[345], evo[346] = evo.lileep, evo.lileep
evo.anorith = {
ndex = 347,
name = 'anorith',
evos = {
{
ndex = 348,
name = 'armaldo',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.armaldo = evo.anorith
evo[347], evo[348] = evo.anorith, evo.anorith
-- What to do with different evo methods? Answer: we go ignorant!
evo.feebas = {
ndex = 349,
name = 'feebas',
evos = {
{
ndex = 350,
name = 'milotic',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.ITEM] = "Squama Bella",
[evo.conditions.OTHER] = table.concat{
"oppure<div>",
links.bag("Fascia Blu"),
"</div>[[Livello|Aumento di livello]]<div>con la [[Bellezza (virtù)|virtù Bellezza]] alta</div>",
},
}
}
}
}
evo.milotic = evo.feebas
evo[349], evo[350] = evo.feebas, evo.feebas
evo.castform = { ndex = 351, name = 'castform' }
evo[351] = evo.castform
evo.kecleon = { ndex = 352, name = 'kecleon' }
evo[352] = evo.kecleon
evo.shuppet = {
ndex = 353,
name = 'shuppet',
evos = {
{
ndex = 354,
name = 'banette',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
}
}
}
evo.banette = evo.shuppet
evo[353], evo[354] = evo.shuppet, evo.shuppet
evo.duskull = {
ndex = 355,
name = 'duskull',
evos = {
{
ndex = 356,
name = 'dusclops',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
evos = {
{
ndex = 477,
name = 'dusknoir',
method = evo.methods.TRADE,
conditions = {
[evo.conditions.ITEM] = 'Terrorpanno',
[evo.conditions.OTHER] = "oppure usando [[Terrorpanno]]" .. sup.LPA,
},
}
}
}
}
}
evo.dusclops, evo.dusknoir = evo.duskull, evo.duskull
evo[355], evo[356], evo[477] = evo.duskull, evo.duskull, evo.duskull
evo.tropius = { ndex = 357, name = 'tropius' }
evo[357] = evo.tropius
evo.chingling = {
ndex = 433,
name = 'chingling',
method = evo.methods.BREED,
conditions = { [evo.conditions.ITEM] = 'Puroaroma' },
evos = {
{
ndex = 358,
name = 'chimecho',
method = evo.methods.HAPPINESS,
conditions = { [evo.conditions.TIME] = 'Notte' }
}
}
}
evo.chimecho = evo.chingling
evo[433], evo[358] = evo.chingling, evo.chingling
evo.absol = { ndex = 359, name = 'absol' }
evo[359] = evo.absol
evo.snorunt = {
ndex = 361,
name = 'snorunt',
evos = {
{
ndex = 362,
name = 'glalie',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 42,
},
{
ndex = 478,
name = 'froslass',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietralbore',
conditions = { [evo.conditions.GENDER] = 'Femmina' }
}
}
}
evo.glalie, evo.froslass = evo.snorunt, evo.snorunt
evo[361], evo[362], evo[478] = evo.snorunt, evo.snorunt, evo.snorunt
evo.spheal = {
ndex = 363,
name = 'spheal',
evos = {
{
ndex = 364,
name = 'sealeo',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
evos = {
{
ndex = 365,
name = 'walrein',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 44,
}
}
}
}
}
evo.sealeo, evo.walrein = evo.spheal, evo.spheal
evo[363], evo[364], evo[365] = evo.spheal, evo.spheal, evo.spheal
evo.clamperl = {
ndex = 366,
name = 'clamperl',
evos = {
{
ndex = 367,
name = 'huntail',
method = evo.methods.TRADE,
conditions = { [evo.conditions.ITEM] = 'Dente Abissi' },
},
{
ndex = 368,
name = 'gorebyss',
method = evo.methods.TRADE,
conditions = { [evo.conditions.ITEM] = 'Squamabissi' },
}
}
}
evo.huntail, evo.gorebyss = evo.clamperl, evo.clamperl
evo[366], evo[367], evo[368] = evo.clamperl, evo.clamperl, evo.clamperl
evo.relicanth = { ndex = 369, name = 'relicanth' }
evo[369] = evo.relicanth
evo.luvdisc = { ndex = 370, name = 'luvdisc' }
evo[370] = evo.luvdisc
evo.bagon = {
ndex = 371,
name = 'bagon',
evos = {
{
ndex = 372,
name = 'shelgon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
evos = {
{
ndex = 373,
name = 'salamence',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 50,
}
}
}
}
}
evo.shelgon, evo.salamence = evo.bagon, evo.bagon
evo[371], evo[372], evo[373] = evo.bagon, evo.bagon, evo.bagon
evo.beldum = {
ndex = 374,
name = 'beldum',
evos = {
{
ndex = 375,
name = 'metang',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
evos = {
{
ndex = 376,
name = 'metagross',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 45,
}
}
}
}
}
evo.metang, evo.metagross = evo.beldum, evo.beldum
evo[374], evo[375], evo[376] = evo.beldum, evo.beldum, evo.beldum
evo.regirock = { ndex = 377, name = 'regirock' }
evo[377] = evo.regirock
evo.regice = { ndex = 378, name = 'regice' }
evo[378] = evo.regice
evo.registeel = { ndex = 379, name = 'registeel' }
evo[379] = evo.registeel
evo.latias = { ndex = 380, name = 'latias' }
evo[380] = evo.latias
evo.latios = { ndex = 381, name = 'latios' }
evo[381] = evo.latios
evo.kyogre = { ndex = 382, name = 'kyogre' }
evo[382] = evo.kyogre
evo.groudon = { ndex = 383, name = 'groudon' }
evo[383] = evo.groudon
evo.rayquaza = { ndex = 384, name = 'rayquaza' }
evo[384] = evo.rayquaza
evo.jirachi = { ndex = 385, name = 'jirachi' }
evo[385] = evo.jirachi
evo.deoxys = { ndex = 386, name = 'deoxys' }
evo[386] = evo.deoxys
evo.turtwig = {
ndex = 387,
name = 'turtwig',
evos = {
{
ndex = 388,
name = 'grotle',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
evos = {
{
ndex = 389,
name = 'torterra',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
}
}
}
}
}
evo.grotle, evo.torterra = evo.turtwig, evo.turtwig
evo[387], evo[388], evo[389] = evo.turtwig, evo.turtwig, evo.turtwig
evo.chimchar = {
ndex = 390,
name = 'chimchar',
evos = {
{
ndex = 391,
name = 'monferno',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 14,
evos = {
{
ndex = 392,
name = 'infernape',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.monferno, evo.infernape = evo.chimchar, evo.chimchar
evo[390], evo[391], evo[392] = evo.chimchar, evo.chimchar, evo.chimchar
evo.piplup = {
ndex = 393,
name = 'piplup',
evos = {
{
ndex = 394,
name = 'prinplup',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 395,
name = 'empoleon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.prinplup, evo.empoleon = evo.piplup, evo.piplup
evo[393], evo[394], evo[395] = evo.piplup, evo.piplup, evo.piplup
evo.starly = {
ndex = 396,
name = 'starly',
evos = {
{
ndex = 397,
name = 'staravia',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 14,
evos = {
{
ndex = 398,
name = 'staraptor',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
}
}
}
evo.staravia, evo.staraptor = evo.starly, evo.starly
evo[396], evo[397], evo[398] = evo.starly, evo.starly, evo.starly
evo.bidoof = {
ndex = 399,
name = 'bidoof',
evos = {
{
ndex = 400,
name = 'bibarel',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 15,
}
}
}
evo.bibarel = evo.bidoof
evo[399], evo[400] = evo.bidoof, evo.bidoof
evo.kricketot = {
ndex = 401,
name = 'kricketot',
evos = {
{
ndex = 402,
name = 'kricketune',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 10,
}
}
}
evo.kricketune = evo.kricketot
evo[401], evo[402] = evo.kricketot, evo.kricketot
evo.shinx = {
ndex = 403,
name = 'shinx',
evos = {
{
ndex = 404,
name = 'luxio',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 15,
evos = {
{
ndex = 405,
name = 'luxray',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
}
}
evo.luxio, evo.luxray = evo.shinx, evo.shinx
evo[403], evo[404], evo[405] = evo.shinx, evo.shinx, evo.shinx
evo.cranidos = {
ndex = 408,
name = 'cranidos',
evos = {
{
ndex = 409,
name = 'rampardos',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.rampardos = evo.cranidos
evo[408], evo[409] = evo.cranidos, evo.cranidos
evo.shieldon = {
ndex = 410,
name = 'shieldon',
evos = {
{
ndex = 411,
name = 'bastiodon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.bastiodon = evo.shieldon
evo[410], evo[411] = evo.shieldon, evo.shieldon
evo.burmy = {
ndex = 412,
name = 'burmy',
notes = useless.burmy.names.base,
evos = {
{
ndex = 413,
name = 'wormadam',
notes = useless.burmy.names.base,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
conditions = { [evo.conditions.GENDER] = 'Femmina' },
},
{
ndex = 414,
name = 'mothim',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
conditions = { [evo.conditions.GENDER] = 'Maschio' },
}
}
}
evo.wormadam, evo.mothim = evo.burmy, evo.burmy
evo[412], evo[413], evo[414] = evo.burmy, evo.burmy, evo.burmy
evo.combee = {
ndex = 415,
name = 'combee',
evos = {
{
ndex = 416,
name = 'vespiquen',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 21,
conditions = { [evo.conditions.GENDER] = 'Femmina' },
}
}
}
evo.vespiquen = evo.combee
evo[415], evo[416] = evo.combee, evo.combee
evo.pachirisu = { ndex = 417, name = 'pachirisu' }
evo[417] = evo.pachirisu
evo.buizel = {
ndex = 418,
name = 'buizel',
evos = {
{
ndex = 419,
name = 'floatzel',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 26,
}
}
}
evo.floatzel = evo.buizel
evo[418], evo[419] = evo.buizel, evo.buizel
evo.cherubi = {
ndex = 420,
name = 'cherubi',
evos = {
{
ndex = 421,
name = 'cherrim',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
}
}
}
evo.cherrim = evo.cherubi
evo[420], evo[421] = evo.cherubi, evo.cherubi
evo.shellos = {
ndex = 422,
name = 'shellos',
notes = useless.shellos.names.base,
evos = {
{
ndex = 423,
name = 'gastrodon',
notes = useless.shellos.names.base,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.gastrodon = evo.shellos
evo[422], evo[423] = evo.shellos, evo.shellos
evo.drifloon = {
ndex = 425,
name = 'drifloon',
evos = {
{
ndex = 426,
name = 'drifblim',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 28,
}
}
}
evo.drifblim = evo.drifloon
evo[425], evo[426] = evo.drifloon, evo.drifloon
evo.buneary = {
ndex = 427,
name = 'buneary',
evos = {
{
ndex = 428,
name = 'lopunny',
method = evo.methods.HAPPINESS,
}
}
}
evo.lopunny = evo.buneary
evo[427], evo[428] = evo.buneary, evo.buneary
evo.glameow = {
ndex = 431,
name = 'glameow',
evos = {
{
ndex = 432,
name = 'purugly',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 38,
}
}
}
evo.purugly = evo.glameow
evo[431], evo[432] = evo.glameow, evo.glameow
evo.stunky = {
ndex = 434,
name = 'stunky',
evos = {
{
ndex = 435,
name = 'skuntank',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
}
evo.skuntank = evo.stunky
evo[434], evo[435] = evo.stunky, evo.stunky
evo.bronzor = {
ndex = 436,
name = 'bronzor',
evos = {
{
ndex = 437,
name = 'bronzong',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 33,
}
}
}
evo.bronzong = evo.bronzor
evo[436], evo[437] = evo.bronzor, evo.bronzor
evo.chatot = { ndex = 441, name = 'chatot' }
evo[441] = evo.chatot
evo.spiritomb = { ndex = 442, name = 'spiritomb' }
evo[442] = evo.spiritomb
evo.gible = {
ndex = 443,
name = 'gible',
evos = {
{
ndex = 444,
name = 'gabite',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 24,
evos = {
{
ndex = 445,
name = 'garchomp',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 48,
}
}
}
}
}
evo.gabite, evo.garchomp = evo.gible, evo.gible
evo[443], evo[444], evo[445] = evo.gible, evo.gible, evo.gible
evo.riolu = {
ndex = 447,
name = 'riolu',
method = evo.methods.BREED,
evos = {
{
ndex = 448,
name = 'lucario',
method = evo.methods.HAPPINESS,
conditions = { [evo.conditions.TIME] = 'Giorno' },
}
}
}
evo.lucario = evo.riolu
evo[447], evo[448] = evo.riolu, evo.riolu
evo.hippopotas = {
ndex = 449,
name = 'hippopotas',
evos = {
{
ndex = 450,
name = 'hippowdon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
}
evo.hippowdon = evo.hippopotas
evo[449], evo[450] = evo.hippopotas, evo.hippopotas
evo.skorupi = {
ndex = 451,
name = 'skorupi',
evos = {
{
ndex = 452,
name = 'drapion',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.drapion = evo.skorupi
evo[451], evo[452] = evo.skorupi, evo.skorupi
evo.croagunk = {
ndex = 453,
name = 'croagunk',
evos = {
{
ndex = 454,
name = 'toxicroak',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
}
}
}
evo.toxicroak = evo.croagunk
evo[453], evo[454] = evo.croagunk, evo.croagunk
evo.carnivine = { ndex = 455, name = 'carnivine' }
evo[455] = evo.carnivine
evo.finneon = {
ndex = 456,
name = 'finneon',
evos = {
{
ndex = 457,
name = 'lumineon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 31,
}
}
}
evo.lumineon = evo.finneon
evo[456], evo[457] = evo.finneon, evo.finneon
evo.snover = {
ndex = 459,
name = 'snover',
evos = {
{
ndex = 460,
name = 'abomasnow',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.abomasnow = evo.snover
evo[459], evo[460] = evo.snover, evo.snover
evo.rotom = { ndex = 479, name = 'rotom' }
evo[479] = evo.rotom
evo.uxie = { ndex = 480, name = 'uxie' }
evo[480] = evo.uxie
evo.mesprit = { ndex = 481, name = 'mesprit' }
evo[481] = evo.mesprit
evo.azelf = { ndex = 482, name = 'azelf' }
evo[482] = evo.azelf
evo.dialga = { ndex = 483, name = 'dialga' }
evo[483] = evo.dialga
evo.palkia = { ndex = 484, name = 'palkia' }
evo[484] = evo.palkia
evo.heatran = { ndex = 485, name = 'heatran' }
evo[485] = evo.heatran
evo.regigigas = { ndex = 486, name = 'regigigas' }
evo[486] = evo.regigigas
evo.giratina = { ndex = 487, name = 'giratina' }
evo[487] = evo.giratina
evo.cresselia = { ndex = 488, name = 'cresselia' }
evo[488] = evo.cresselia
evo.phione = {
ndex = 489,
name = 'phione',
method = evo.methods.BREED,
conditions = { [evo.conditions.BREEDONLY] = true },
evos = {
{
ndex = 490,
name = 'manaphy',
}
}
}
evo.manaphy = evo.phione
evo[489], evo[490] = evo.phione, evo.phione
evo.darkrai = { ndex = 491, name = 'darkrai' }
evo[491] = evo.darkrai
evo.shaymin = { ndex = 492, name = 'shaymin' }
evo[492] = evo.shaymin
evo.arceus = { ndex = 493, name = 'arceus' }
evo[493] = evo.arceus
evo.victini = { ndex = 494, name = 'victini' }
evo[494] = evo.victini
evo.snivy = {
ndex = 495,
name = 'snivy',
evos = {
{
ndex = 496,
name = 'servine',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 17,
evos = {
{
ndex = 497,
name = 'serperior',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.servine, evo.serperior = evo.snivy, evo.snivy
evo[495], evo[496], evo[497] = evo.snivy, evo.snivy, evo.snivy
evo.tepig = {
ndex = 498,
name = 'tepig',
evos = {
{
ndex = 499,
name = 'pignite',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 17,
evos = {
{
ndex = 500,
name = 'emboar',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.pignite, evo.emboar = evo.tepig, evo.tepig
evo[498], evo[499], evo[500] = evo.tepig, evo.tepig, evo.tepig
evo.oshawott = {
ndex = 501,
name = 'oshawott',
evos = {
{
ndex = 502,
name = 'dewott',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 17,
evos = {
{
ndex = 503,
name = 'samurott',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
},
{
ndex = '503H',
name = 'samurottH',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
conditions = { [evo.conditions.REGION] = 'Hisui' },
}
}
}
}
}
evo.dewott, evo.samurott, evo.samurottH = evo.oshawott, evo.oshawott, evo.oshawott
evo[501], evo[502], evo[503], evo['503H'] = evo.oshawott, evo.oshawott, evo.oshawott, evo.oshawott
evo.patrat = {
ndex = 504,
name = 'patrat',
evos = {
{
ndex = 505,
name = 'watchog',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
}
}
}
evo.watchog = evo.patrat
evo[504], evo[505] = evo.patrat, evo.patrat
evo.lillipup = {
ndex = 506,
name = 'lillipup',
evos = {
{
ndex = 507,
name = 'herdier',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 508,
name = 'stoutland',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
}
}
}
}
}
evo.herdier, evo.stoutland = evo.lillipup, evo.lillipup
evo[506], evo[507], evo[508] = evo.lillipup, evo.lillipup, evo.lillipup
evo.purrloin = {
ndex = 509,
name = 'purrloin',
evos = {
{
ndex = 510,
name = 'liepard',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
}
}
}
evo.liepard = evo.purrloin
evo[509], evo[510] = evo.purrloin, evo.purrloin
evo.pansage = {
ndex = 511,
name = 'pansage',
evos = {
{
ndex = 512,
name = 'simisage',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafoglia',
}
}
}
evo.simisage = evo.pansage
evo[511], evo[512] = evo.pansage, evo.pansage
evo.pansear = {
ndex = 513,
name = 'pansear',
evos = {
{
ndex = 514,
name = 'simisear',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafocaia',
}
}
}
evo.simisear = evo.pansear
evo[513], evo[514] = evo.pansear, evo.pansear
evo.panpour = {
ndex = 515,
name = 'panpour',
evos = {
{
ndex = 516,
name = 'simipour',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietraidrica',
}
}
}
evo.simipour = evo.panpour
evo[515], evo[516] = evo.panpour, evo.panpour
evo.munna = {
ndex = 517,
name = 'munna',
evos = {
{
ndex = 518,
name = 'musharna',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietralunare',
}
}
}
evo.musharna = evo.munna
evo[517], evo[518] = evo.munna, evo.munna
evo.pidove = {
ndex = 519,
name = 'pidove',
evos = {
{
ndex = 520,
name = 'tranquill',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 21,
evos = {
{
ndex = 521,
name = 'unfezant',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
}
}
}
}
}
evo.tranquill, evo.unfezant = evo.pidove, evo.pidove
evo[519], evo[520], evo[521] = evo.pidove, evo.pidove, evo.pidove
evo.blitzle = {
ndex = 522,
name = 'blitzle',
evos = {
{
ndex = 523,
name = 'zebstrika',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 27,
}
}
}
evo.zebstrika = evo.blitzle
evo[522], evo[523] = evo.blitzle, evo.blitzle
evo.roggenrola = {
ndex = 524,
name = 'roggenrola',
evos = {
{
ndex = 525,
name = 'boldore',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
evos = {
{
ndex = 526,
name = 'gigalith',
method = evo.methods.TRADE,
}
}
}
}
}
evo.boldore, evo.gigalith = evo.roggenrola, evo.roggenrola
evo[524], evo[525], evo[526] = evo.roggenrola, evo.roggenrola, evo.roggenrola
evo.woobat = {
ndex = 527,
name = 'woobat',
evos = {
{
ndex = 528,
name = 'swoobat',
method = evo.methods.HAPPINESS,
}
}
}
evo.swoobat = evo.woobat
evo[527], evo[528] = evo.woobat, evo.woobat
evo.drilbur = {
ndex = 529,
name = 'drilbur',
evos = {
{
ndex = 530,
name = 'excadrill',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 31,
}
}
}
evo.excadrill = evo.drilbur
evo[529], evo[530] = evo.drilbur, evo.drilbur
evo.audino = { ndex = 531, name = 'audino' }
evo[531] = evo.audino
evo.timburr = {
ndex = 532,
name = 'timburr',
evos = {
{
ndex = 533,
name = 'gurdurr',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
evos = {
{
ndex = 534,
name = 'conkeldurr',
method = evo.methods.TRADE,
}
}
}
}
}
evo.gurdurr, evo.conkeldurr = evo.timburr, evo.timburr
evo[532], evo[533], evo[534] = evo.timburr, evo.timburr, evo.timburr
evo.tympole = {
ndex = 535,
name = 'tympole',
evos = {
{
ndex = 536,
name = 'palpitoad',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
evos = {
{
ndex = 537,
name = 'seismitoad',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.palpitoad, evo.seismitoad = evo.tympole, evo.tympole
evo[535], evo[536], evo[537] = evo.tympole, evo.tympole, evo.tympole
evo.throh = { ndex = 538, name = 'throh' }
evo[538] = evo.throh
evo.sawk = { ndex = 539, name = 'sawk' }
evo[539] = evo.sawk
evo.sewaddle = {
ndex = 540,
name = 'sewaddle',
evos = {
{
ndex = 541,
name = 'swadloon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
evos = {
{
ndex = 542,
name = 'leavanny',
method = evo.methods.HAPPINESS,
}
}
}
}
}
evo.swadloon, evo.leavanny = evo.sewaddle, evo.sewaddle
evo[540], evo[541], evo[542] = evo.sewaddle, evo.sewaddle, evo.sewaddle
evo.venipede = {
ndex = 543,
name = 'venipede',
evos = {
{
ndex = 544,
name = 'whirlipede',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 22,
evos = {
{
ndex = 545,
name = 'scolipede',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
}
}
evo.whirlipede, evo.scolipede = evo.venipede, evo.venipede
evo[543], evo[544], evo[545] = evo.venipede, evo.venipede, evo.venipede
evo.cottonee = {
ndex = 546,
name = 'cottonee',
evos = {
{
ndex = 547,
name = 'whimsicott',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrasolare',
}
}
}
evo.whimsicott = evo.cottonee
evo[546], evo[547] = evo.cottonee, evo.cottonee
evo.petilil = {
ndex = 548,
name = 'petilil',
evos = {
{
ndex = 549,
name = 'lilligant',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrasolare',
},
{
ndex = '549H',
name = 'lilligantH',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrasolare',
conditions = { [evo.conditions.REGION] = 'Hisui' },
},
}
}
evo.lilligant, evo.lilligantH = evo.petilil, evo.petilil
evo[548], evo[549], evo['549H'] = evo.petilil, evo.petilil, evo.petilil
evo.basculin = { ndex = 550, name = 'basculin', notes = altforms.basculin.names.base }
evo[550] = evo.basculin
evo.sandile = {
ndex = 551,
name = 'sandile',
evos = {
{
ndex = 552,
name = 'krokorok',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 29,
evos = {
{
ndex = 553,
name = 'krookodile',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
}
}
evo.krokorok, evo.krookodile = evo.sandile, evo.sandile
evo[551], evo[552], evo[553] = evo.sandile, evo.sandile, evo.sandile
evo.darumaka = {
ndex = 554,
name = 'darumaka',
evos = {
{
ndex = 555,
name = 'darmanitan',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
}
}
}
evo.darmanitan = evo.darumaka
evo[554], evo[555] = evo.darumaka, evo.darumaka
evo.maractus = { ndex = 556, name = 'maractus' }
evo[556] = evo.maractus
evo.dwebble = {
ndex = 557,
name = 'dwebble',
evos = {
{
ndex = 558,
name = 'crustle',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
}
evo.crustle = evo.dwebble
evo[557], evo[558] = evo.dwebble, evo.dwebble
evo.scraggy = {
ndex = 559,
name = 'scraggy',
evos = {
{
ndex = 560,
name = 'scrafty',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 39,
}
}
}
evo.scrafty = evo.scraggy
evo[559], evo[560] = evo.scraggy, evo.scraggy
evo.sigilyph = { ndex = 561, name = 'sigilyph' }
evo[561] = evo.sigilyph
evo.yamask = {
ndex = 562,
name = 'yamask',
evos = {
{
ndex = 563,
name = 'cofagrigus',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
}
evo.cofagrigus = evo.yamask
evo[562], evo[563] = evo.yamask, evo.yamask
evo.tirtouga = {
ndex = 564,
name = 'tirtouga',
evos = {
{
ndex = 565,
name = 'carracosta',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
}
}
}
evo.carracosta = evo.tirtouga
evo[564], evo[565] = evo.tirtouga, evo.tirtouga
evo.archen = {
ndex = 566,
name = 'archen',
evos = {
{
ndex = 567,
name = 'archeops',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
}
}
}
evo.archeops = evo.archen
evo[566], evo[567] = evo.archen, evo.archen
evo.trubbish = {
ndex = 568,
name = 'trubbish',
evos = {
{
ndex = 569,
name = 'garbodor',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
evo.garbodor = evo.trubbish
evo[568], evo[569] = evo.trubbish, evo.trubbish
evo.zorua = {
ndex = 570,
name = 'zorua',
evos = {
{
ndex = 571,
name = 'zoroark',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.zoroark = evo.zorua
evo[570], evo[571] = evo.zorua, evo.zorua
evo.minccino = {
ndex = 572,
name = 'minccino',
evos = {
{
ndex = 573,
name = 'cinccino',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrabrillo',
}
}
}
evo.cinccino = evo.minccino
evo[572], evo[573] = evo.minccino, evo.minccino
evo.gothita = {
ndex = 574,
name = 'gothita',
evos = {
{
ndex = 575,
name = 'gothorita',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
evos = {
{
ndex = 576,
name = 'gothitelle',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 41,
}
}
}
}
}
evo.gothorita, evo.gothitelle = evo.gothita, evo.gothita
evo[574], evo[575], evo[576] = evo.gothita, evo.gothita, evo.gothita
evo.solosis = {
ndex = 577,
name = 'solosis',
evos = {
{
ndex = 578,
name = 'duosion',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
evos = {
{
ndex = 579,
name = 'reuniclus',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 41,
}
}
}
}
}
evo.duosion, evo.reuniclus = evo.solosis, evo.solosis
evo[577], evo[578], evo[579] = evo.solosis, evo.solosis, evo.solosis
evo.ducklett = {
ndex = 580,
name = 'ducklett',
evos = {
{
ndex = 581,
name = 'swanna',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
}
}
}
evo.swanna = evo.ducklett
evo[580], evo[581] = evo.ducklett, evo.ducklett
evo.vanillite = {
ndex = 582,
name = 'vanillite',
evos = {
{
ndex = 583,
name = 'vanillish',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
evos = {
{
ndex = 584,
name = 'vanilluxe',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 47,
}
}
}
}
}
evo.vanillish, evo.vanilluxe = evo.vanillite, evo.vanillite
evo[582], evo[583], evo[584] = evo.vanillite, evo.vanillite, evo.vanillite
evo.deerling = {
ndex = 585,
name = 'deerling',
notes = useless.deerling.names.base,
evos = {
{
ndex = 586,
name = 'sawsbuck',
notes = useless.sawsbuck.names.base,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
}
evo.sawsbuck = evo.deerling
evo[585], evo[586] = evo.deerling, evo.deerling
evo.emolga = { ndex = 587, name = 'emolga' }
evo[587] = evo.emolga
evo.karrablast = {
ndex = 588,
name = 'karrablast',
evos = {
{
ndex = 589,
name = 'escavalier',
method = evo.methods.TRADE,
conditions = { [evo.conditions.TRADED_FOR] = 616 },
}
}
}
evo.escavalier = evo.karrablast
evo[588], evo[589] = evo.karrablast, evo.karrablast
evo.foongus = {
ndex = 590,
name = 'foongus',
evos = {
{
ndex = 591,
name = 'amoonguss',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 39,
}
}
}
evo.amoonguss = evo.foongus
evo[590], evo[591] = evo.foongus, evo.foongus
evo.frillish = {
ndex = 592,
name = 'frillish',
notes = useless.frillish.names.base,
evos = {
{
ndex = 593,
name = 'jellicent',
notes = useless.frillish.names.base,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.jellicent = evo.frillish
evo[592], evo[593] = evo.frillish, evo.frillish
evo.alomomola = { ndex = 594, name = 'alomomola' }
evo[594] = evo.alomomola
evo.joltik = {
ndex = 595,
name = 'joltik',
evos = {
{
ndex = 596,
name = 'galvantula',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
evo.galvantula = evo.joltik
evo[595], evo[596] = evo.joltik, evo.joltik
evo.ferroseed = {
ndex = 597,
name = 'ferroseed',
evos = {
{
ndex = 598,
name = 'ferrothorn',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.ferrothorn = evo.ferroseed
evo[597], evo[598] = evo.ferroseed, evo.ferroseed
evo.klink = {
ndex = 599,
name = 'klink',
evos = {
{
ndex = 600,
name = 'klang',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 38,
evos = {
{
ndex = 601,
name = 'klinklang',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 49,
}
}
}
}
}
evo.klang, evo.klinklang = evo.klink, evo.klink
evo[599], evo[600], evo[601] = evo.klink, evo.klink, evo.klink
evo.tynamo = {
ndex = 602,
name = 'tynamo',
evos = {
{
ndex = 603,
name = 'eelektrik',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 39,
evos = {
{
ndex = 604,
name = 'eelektross',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietratuono',
}
}
}
}
}
evo.eelektrik, evo.eelektross = evo.tynamo, evo.tynamo
evo[602], evo[603], evo[604] = evo.tynamo, evo.tynamo, evo.tynamo
evo.elgyem = {
ndex = 605,
name = 'elgyem',
evos = {
{
ndex = 606,
name = 'beheeyem',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 42,
}
}
}
evo.beheeyem = evo.elgyem
evo[605], evo[606] = evo.elgyem, evo.elgyem
evo.litwick = {
ndex = 607,
name = 'litwick',
evos = {
{
ndex = 608,
name = 'lampent',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 41,
evos = {
{
ndex = 609,
name = 'chandelure',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Neropietra',
}
}
}
}
}
evo.lampent, evo.chandelure = evo.litwick, evo.litwick
evo[607], evo[608], evo[609] = evo.litwick, evo.litwick, evo.litwick
evo.axew = {
ndex = 610,
name = 'axew',
evos = {
{
ndex = 611,
name = 'fraxure',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 38,
evos = {
{
ndex = 612,
name = 'haxorus',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 48,
}
}
}
}
}
evo.fraxure, evo.haxorus = evo.axew, evo.axew
evo[610], evo[611], evo[612] = evo.axew, evo.axew, evo.axew
evo.cubchoo = {
ndex = 613,
name = 'cubchoo',
evos = {
{
ndex = 614,
name = 'beartic',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
}
}
}
evo.beartic = evo.cubchoo
evo[613], evo[614] = evo.cubchoo, evo.cubchoo
evo.cryogonal = { ndex = 615, name = 'cryogonal' }
evo[615] = evo.cryogonal
evo.shelmet = {
ndex = 616,
name = 'shelmet',
evos = {
{
ndex = 617,
name = 'accelgor',
method = evo.methods.TRADE,
conditions = { [evo.conditions.TRADED_FOR] = 588 },
}
}
}
evo.accelgor = evo.shelmet
evo[616], evo[617] = evo.shelmet, evo.shelmet
evo.stunfisk = { ndex = 618, name = 'stunfisk' }
evo[618] = evo.stunfisk
evo.mienfoo = {
ndex = 619,
name = 'mienfoo',
evos = {
{
ndex = 620,
name = 'mienshao',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 50,
}
}
}
evo.mienshao = evo.mienfoo
evo[619], evo[620] = evo.mienfoo, evo.mienfoo
evo.druddigon = { ndex = 621, name = 'druddigon' }
evo[621] = evo.druddigon
evo.golett = {
ndex = 622,
name = 'golett',
evos = {
{
ndex = 623,
name = 'golurk',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 43,
}
}
}
evo.golurk = evo.golett
evo[622], evo[623] = evo.golett, evo.golett
evo.pawniard = {
ndex = 624,
name = 'pawniard',
evos = {
{
ndex = 625,
name = 'bisharp',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 52,
}
}
}
evo.bisharp = evo.pawniard
evo[624], evo[625] = evo.pawniard, evo.pawniard
evo.bouffalant = { ndex = 626, name = 'bouffalant' }
evo[626] = evo.bouffalant
evo.rufflet = {
ndex = 627,
name = 'rufflet',
evos = {
{
ndex = 628,
name = 'braviary',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 54,
},
{
ndex = '628H',
name = 'braviaryH',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 54,
conditions = { [evo.conditions.REGION] = 'Hisui' },
},
}
}
evo.braviary, evo.braviaryH = evo.rufflet, evo.rufflet
evo[627], evo[628], evo['628H'] = evo.rufflet, evo.rufflet, evo.rufflet
evo.vullaby = {
ndex = 629,
name = 'vullaby',
evos = {
{
ndex = 630,
name = 'mandibuzz',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 54,
}
}
}
evo.mandibuzz = evo.vullaby
evo[629], evo[630] = evo.vullaby, evo.vullaby
evo.heatmor = { ndex = 631, name = 'heatmor' }
evo[631] = evo.heatmor
evo.durant = { ndex = 632, name = 'durant' }
evo[632] = evo.durant
evo.deino = {
ndex = 633,
name = 'deino',
evos = {
{
ndex = 634,
name = 'zweilous',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 50,
evos = {
{
ndex = 635,
name = 'hydreigon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 64,
}
}
}
}
}
evo.zweilous, evo.hydreigon = evo.deino, evo.deino
evo[633], evo[634], evo[635] = evo.deino, evo.deino, evo.deino
evo.larvesta = {
ndex = 636,
name = 'larvesta',
evos = {
{
ndex = 637,
name = 'volcarona',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 59,
}
}
}
evo.volcarona = evo.larvesta
evo[636], evo[637] = evo.larvesta, evo.larvesta
evo.cobalion = { ndex = 638, name = 'cobalion' }
evo[638] = evo.cobalion
evo.terrakion = { ndex = 639, name = 'terrakion' }
evo[639] = evo.terrakion
evo.virizion = { ndex = 640, name = 'virizion' }
evo[640] = evo.virizion
evo.tornadus = { ndex = 641, name = 'tornadus' }
evo[641] = evo.tornadus
evo.thundurus = { ndex = 642, name = 'thundurus' }
evo[642] = evo.thundurus
evo.reshiram = { ndex = 643, name = 'reshiram' }
evo[643] = evo.reshiram
evo.zekrom = { ndex = 644, name = 'zekrom' }
evo[644] = evo.zekrom
evo.landorus = { ndex = 645, name = 'landorus' }
evo[645] = evo.landorus
evo.kyurem = { ndex = 646, name = 'kyurem' }
evo[646] = evo.kyurem
evo.keldeo = { ndex = 647, name = 'keldeo' }
evo[647] = evo.keldeo
evo.meloetta = { ndex = 648, name = 'meloetta' }
evo[648] = evo.meloetta
evo.genesect = { ndex = 649, name = 'genesect' }
evo[649] = evo.genesect
evo.chespin = {
ndex = 650,
name = 'chespin',
evos = {
{
ndex = 651,
name = 'quilladin',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 652,
name = 'chesnaught',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.quilladin, evo.chesnaught = evo.chespin, evo.chespin
evo[650], evo[651], evo[652] = evo.chespin, evo.chespin, evo.chespin
evo.fennekin = {
ndex = 653,
name = 'fennekin',
evos = {
{
ndex = 654,
name = 'braixen',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 655,
name = 'delphox',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.braixen, evo.delphox = evo.fennekin, evo.fennekin
evo[653], evo[654], evo[655] = evo.fennekin, evo.fennekin, evo.fennekin
evo.froakie = {
ndex = 656,
name = 'froakie',
evos = {
{
ndex = 657,
name = 'frogadier',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 658,
name = 'greninja',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
}
}
evo.frogadier, evo.greninja = evo.froakie, evo.froakie
evo[656], evo[657], evo[658] = evo.froakie, evo.froakie, evo.froakie
evo.bunnelby = {
ndex = 659,
name = 'bunnelby',
evos = {
{
ndex = 660,
name = 'diggersby',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
}
}
}
evo.diggersby = evo.bunnelby
evo[659], evo[660] = evo.bunnelby, evo.bunnelby
evo.fletchling = {
ndex = 661,
name = 'fletchling',
evos = {
{
ndex = 662,
name = 'fletchinder',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 17,
evos = {
{
ndex = 663,
name = 'talonflame',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
}
}
}
}
}
evo.fletchinder, evo.talonflame = evo.fletchling, evo.fletchling
evo[661], evo[662], evo[663] = evo.fletchling, evo.fletchling, evo.fletchling
evo.scatterbug = {
ndex = 664,
name = 'scatterbug',
evos = {
{
ndex = 665,
name = 'spewpa',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 9,
evos = {
{
ndex = 666,
name = 'vivillon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 12,
}
}
}
}
}
evo.spewpa, evo.vivillon = evo.scatterbug, evo.scatterbug
evo[664], evo[665], evo[666] = evo.scatterbug, evo.scatterbug, evo.scatterbug
evo.litleo = {
ndex = 667,
name = 'litleo',
evos = {
{
ndex = 668,
name = 'pyroar',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
}
}
}
evo.pyroar = evo.litleo
evo[667], evo[668] = evo.litleo, evo.litleo
evo["flabébé"] = {
ndex = 669,
name = 'flabébé',
notes = useless.floette.names.base,
evos = {
{
ndex = 670,
name = 'floette',
notes = useless.floette.names.base,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 19,
evos = {
{
ndex = 671,
name = 'florges',
notes = useless.floette.names.base,
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrabrillo',
}
}
}
}
}
evo.floette, evo.florges = evo["flabébé"], evo["flabébé"]
evo[669], evo[670], evo[671] = evo["flabébé"], evo["flabébé"], evo["flabébé"]
evo.skiddo = {
ndex = 672,
name = 'skiddo',
evos = {
{
ndex = 673,
name = 'gogoat',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
}
}
}
evo.gogoat = evo.skiddo
evo[672], evo[673] = evo.skiddo, evo.skiddo
evo.pancham = {
ndex = 674,
name = 'pancham',
evos = {
{
ndex = 675,
name = 'pangoro',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
conditions = { [evo.conditions.OTHER] = 'Con un Pokémon [[Buio]] in [[squadra]]' },
}
}
}
evo.pangoro = evo.pancham
evo[674], evo[675] = evo.pancham, evo.pancham
evo.furfrou = { ndex = 676, name = 'furfrou' }
evo[676] = evo.furfrou
evo.espurr = {
ndex = 677,
name = 'espurr',
evos = {
{
ndex = 678,
name = 'meowstic',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
}
}
}
evo.meowstic = evo.espurr
evo[677], evo[678] = evo.espurr, evo.espurr
evo.honedge = {
ndex = 679,
name = 'honedge',
evos = {
{
ndex = 680,
name = 'doublade',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
evos = {
{
ndex = 681,
name = 'aegislash',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Neropietra',
}
}
}
}
}
evo.doublade, evo.aegislash = evo.honedge, evo.honedge
evo[679], evo[680], evo[681] = evo.honedge, evo.honedge, evo.honedge
evo.spritzee = {
ndex = 682,
name = 'spritzee',
evos = {
{
ndex = 683,
name = 'aromatisse',
method = evo.methods.TRADE,
conditions = { [evo.conditions.ITEM] = 'Bustina aromi' },
}
}
}
evo.aromatisse = evo.spritzee
evo[682], evo[683] = evo.spritzee, evo.spritzee
evo.swirlix = {
ndex = 684,
name = 'swirlix',
evos = {
{
ndex = 685,
name = 'slurpuff',
method = evo.methods.TRADE,
conditions = { [evo.conditions.ITEM] = 'Dolcespuma' },
}
}
}
evo.slurpuff = evo.swirlix
evo[684], evo[685] = evo.swirlix, evo.swirlix
evo.inkay = {
ndex = 686,
name = 'inkay',
evos = {
{
ndex = 687,
name = 'malamar',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
conditions = { [evo.conditions.OTHER] = 'Capovolgendo la console' },
}
}
}
evo.malamar = evo.inkay
evo[686], evo[687] = evo.inkay, evo.inkay
evo.binacle = {
ndex = 688,
name = 'binacle',
evos = {
{
ndex = 689,
name = 'barbaracle',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 39,
}
}
}
evo.barbaracle = evo.binacle
evo[688], evo[689] = evo.binacle, evo.binacle
evo.skrelp = {
ndex = 690,
name = 'skrelp',
evos = {
{
ndex = 691,
name = 'dragalge',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 41,
}
}
}
evo.dragalge = evo.skrelp
evo[690], evo[691] = evo.skrelp, evo.skrelp
evo.clauncher = {
ndex = 692,
name = 'clauncher',
evos = {
{
ndex = 693,
name = 'clawitzer',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
}
}
}
evo.clawitzer = evo.clauncher
evo[692], evo[693] = evo.clauncher, evo.clauncher
evo.helioptile = {
ndex = 694,
name = 'helioptile',
evos = {
{
ndex = 695,
name = 'heliolisk',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrasolare',
}
}
}
evo.heliolisk = evo.helioptile
evo[694], evo[695] = evo.helioptile, evo.helioptile
evo.tyrunt = {
ndex = 696,
name = 'tyrunt',
evos = {
{
ndex = 697,
name = 'tyrantrum',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 39,
conditions = { [evo.conditions.TIME] = 'Giorno' },
}
}
}
evo.tyrantrum = evo.tyrunt
evo[696], evo[697] = evo.tyrunt, evo.tyrunt
evo.amaura = {
ndex = 698,
name = 'amaura',
evos = {
{
ndex = 699,
name = 'aurorus',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 39,
conditions = { [evo.conditions.TIME] = 'Notte' },
}
}
}
evo.aurorus = evo.amaura
evo[698], evo[699] = evo.amaura, evo.amaura
evo.hawlucha = { ndex = 701, name = 'hawlucha' }
evo[701] = evo.hawlucha
evo.dedenne = { ndex = 702, name = 'dedenne' }
evo[702] = evo.dedenne
evo.carbink = { ndex = 703, name = 'carbink' }
evo[703] = evo.carbink
evo.goomy = {
ndex = 704,
name = 'goomy',
evos = {
{
ndex = 705,
name = 'sliggoo',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
evos = {
{
ndex = 706,
name = 'goodra',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 50,
conditions = { [evo.conditions.OTHER] = "Se [[Pioggia battente|piove]] o c'è [[Nebbia (condizione atmosferica)|nebbia]] nell'overworld" },
}
}
},
{
ndex = '705H',
name = 'sliggooH',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
conditions = { [evo.conditions.REGION] = 'Hisui' },
evos = {
{
ndex = '706H',
name = 'goodraH',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 50,
conditions = { [evo.conditions.OTHER] = "Se [[Pioggia battente|piove]] nell'overworld" },
}
}
},
}
}
evo.sliggoo, evo.goodra = evo.goomy, evo.goomy
evo[704], evo[705], evo[706] = evo.goomy, evo.goomy, evo.goomy
evo.sliggooH, evo.goodraH = evo.goomy, evo.goomy
evo['705H'], evo['706H'] = evo.goomy, evo.goomy
evo.klefki = { ndex = 707, name = 'klefki' }
evo[707] = evo.klefki
evo.phantump = {
ndex = 708,
name = 'phantump',
evos = {
{
ndex = 709,
name = 'trevenant',
method = evo.methods.TRADE,
}
}
}
evo.trevenant = evo.phantump
evo[708], evo[709] = evo.phantump, evo.phantump
evo.pumpkaboo = {
ndex = 710,
name = 'pumpkaboo',
notes = altforms.pumpkaboo.names.base,
evos = {
{
ndex = 711,
name = 'gourgeist',
notes = altforms.gourgeist.names.base,
method = evo.methods.TRADE,
}
}
}
evo.gourgeist = evo.pumpkaboo
evo[710], evo[711] = evo.pumpkaboo, evo.pumpkaboo
evo.bergmite = {
ndex = 712,
name = 'bergmite',
evos = {
{
ndex = 713,
name = 'avalugg',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
},
{
ndex = '713H',
name = 'avaluggH',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 37,
conditions = { [evo.conditions.REGION] = 'Hisui' },
},
}
}
evo.avalugg, evo.avaluggH = evo.bergmite, evo.bergmite
evo[712], evo[713], evo['713H'] = evo.bergmite, evo.bergmite, evo.bergmite
evo.noibat = {
ndex = 714,
name = 'noibat',
evos = {
{
ndex = 715,
name = 'noivern',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 48,
}
}
}
evo.noivern = evo.noibat
evo[714], evo[715] = evo.noibat, evo.noibat
evo.xerneas = { ndex = 716, name = 'xerneas' }
evo[716] = evo.xerneas
evo.yveltal = { ndex = 717, name = 'yveltal' }
evo[717] = evo.yveltal
evo.zygarde = { ndex = 718, name = 'zygarde' }
evo[718] = evo.zygarde
evo.diancie = { ndex = 719, name = 'diancie' }
evo[719] = evo.diancie
evo.hoopa = { ndex = 720, name = 'hoopa' }
evo[720] = evo.hoopa
evo.volcanion = { ndex = 721, name = 'volcanion' }
evo[721] = evo.volcanion
evo.rowlet = {
ndex = 722,
name = 'rowlet',
evos = {
{
ndex = 723,
name = 'dartrix',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 17,
evos = {
{
ndex = 724,
name = 'decidueye',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
},
{
ndex = '724H',
name = 'decidueyeH',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
conditions = { [evo.conditions.REGION] = 'Hisui' },
},
}
}
}
}
evo.dartrix, evo.decidueye, evo.decidueyeH = evo.rowlet, evo.rowlet, evo.rowlet
evo[722], evo[723], evo[724], evo['724H'] = evo.rowlet, evo.rowlet, evo.rowlet, evo.rowlet
evo.litten = {
ndex = 725,
name = 'litten',
evos = {
{
ndex = 726,
name = 'torracat',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 17,
evos = {
{
ndex = 727,
name = 'incineroar',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
}
}
}
evo.torracat, evo.incineroar = evo.litten, evo.litten
evo[725], evo[726], evo[727] = evo.litten, evo.litten, evo.litten
evo.popplio = {
ndex = 728,
name = 'popplio',
evos = {
{
ndex = 729,
name = 'brionne',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 17,
evos = {
{
ndex = 730,
name = 'primarina',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
}
}
}
evo.brionne, evo.primarina = evo.popplio, evo.popplio
evo[728], evo[729], evo[730] = evo.popplio, evo.popplio, evo.popplio
evo.pikipek = {
ndex = 731,
name = 'pikipek',
evos = {
{
ndex = 732,
name = 'trumbeak',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 14,
evos = {
{
ndex = 733,
name = 'toucannon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 28,
}
}
}
}
}
evo.trumbeak, evo.toucannon = evo.pikipek, evo.pikipek
evo[731], evo[732], evo[733] = evo.pikipek, evo.pikipek, evo.pikipek
evo.yungoos = {
ndex = 734,
name = 'yungoos',
evos = {
{
ndex = 735,
name = 'gumshoos',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
conditions = { [evo.conditions.TIME] = 'Giorno' },
}
}
}
evo.gumshoos = evo.yungoos
evo[734], evo[735] = evo.yungoos, evo.yungoos
evo.grubbin = {
ndex = 736,
name = 'grubbin',
evos = {
{
ndex = 737,
name = 'charjabug',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
evos = {
{
ndex = 738,
name = 'vikavolt',
method = evo.methods.LEVEL,
conditions = {
[evo.conditions.LOCATION] = 'Campo magnetico speciale',
[evo.conditions.OTHER] = table.concat{
"oppure<div>",
links.bag("Pietratuono"),
"</div>usando una [[Pietratuono]]",
},
},
}
}
}
}
}
evo.charjabug, evo.vikavolt = evo.grubbin, evo.grubbin
evo[736], evo[737], evo[738] = evo.grubbin, evo.grubbin, evo.grubbin
evo.crabrawler = {
ndex = 739,
name = 'crabrawler',
evos = {
{
ndex = 740,
name = 'crabominable',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.LOCATION] = 'Monte Lanakila' },
}
}
}
evo.crabominable = evo.crabrawler
evo[739], evo[740] = evo.crabrawler, evo.crabrawler
evo.oricorio = { ndex = 741, name = 'oricorio' }
evo[741] = evo.oricorio
evo.cutiefly = {
ndex = 742,
name = 'cutiefly',
evos = {
{
ndex = 743,
name = 'ribombee',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
}
}
}
evo.ribombee = evo.cutiefly
evo[742], evo[743] = evo.cutiefly, evo.cutiefly
evo.rockruff = {
ndex = 744,
name = 'rockruff',
evos = {
{
ndex = 745,
name = 'lycanroc',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
conditions = {
-- [evo.conditions.OTHER] = 'Di [[Tempo|giorno]]',
[evo.conditions.TIME] = 'Giorno',
}
},
{
ndex = '745N',
name = 'lycanrocN',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
conditions = {
-- [evo.conditions.OTHER] = 'Di [[Tempo|notte]]',
[evo.conditions.TIME] = 'Notte',
}
},
{
ndex = '745C',
name = 'lycanrocC',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
conditions = {
-- [evo.conditions.OTHER] = 'Al tramonto se ha [[Mente Locale]]{{#invoke: sup | UsUl}}{{gensup|8|plus=yes}}',
[evo.conditions.TIME] = 'Tramonto',
[evo.conditions.OTHER] = 'con [[Mente Locale]]',
}
}
}
}
evo.lycanroc, evo.lycanrocN, evo.lycanrocC =
evo.rockruff, evo.rockruff, evo.rockruff
evo[744], evo[745], evo['745N'], evo['745C'] =
evo.rockruff, evo.rockruff, evo.rockruff, evo.rockruff
evo.wishiwashi = { ndex = 746, name = 'wishiwashi' }
evo[746] = evo.wishiwashi
evo.mareanie = {
ndex = 747,
name = 'mareanie',
evos = {
{
ndex = 748,
name = 'toxapex',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 38,
}
}
}
evo.toxapex = evo.mareanie
evo[747], evo[748] = evo.mareanie, evo.mareanie
evo.mudbray = {
ndex = 749,
name = 'mudbray',
evos = {
{
ndex = 750,
name = 'mudsdale',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.mudsdale = evo.mudbray
evo[749], evo[750] = evo.mudbray, evo.mudbray
evo.dewpider = {
ndex = 751,
name = 'dewpider',
evos = {
{
ndex = 752,
name = 'araquanid',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 22,
}
}
}
evo.araquanid = evo.dewpider
evo[751], evo[752] = evo.dewpider, evo.dewpider
evo.fomantis = {
ndex = 753,
name = 'fomantis',
evos = {
{
ndex = 754,
name = 'lurantis',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
conditions = { [evo.conditions.TIME] = 'Giorno' },
}
}
}
evo.lurantis = evo.fomantis
evo[753], evo[754] = evo.fomantis, evo.fomantis
evo.morelull = {
ndex = 755,
name = 'morelull',
evos = {
{
ndex = 756,
name = 'shiinotic',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 24,
}
}
}
evo.shiinotic = evo.morelull
evo[755], evo[756] = evo.morelull, evo.morelull
evo.salandit = {
ndex = 757,
name = 'salandit',
evos = {
{
ndex = 758,
name = 'salazzle',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 33,
conditions = { [evo.conditions.GENDER] = 'Femmina' },
}
}
}
evo.salazzle = evo.salandit
evo[757], evo[758] = evo.salandit, evo.salandit
evo.stufful = {
ndex = 759,
name = 'stufful',
evos = {
{
ndex = 760,
name = 'bewear',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 27,
}
}
}
evo.bewear = evo.stufful
evo[759], evo[760] = evo.stufful, evo.stufful
evo.bounsweet = {
ndex = 761,
name = 'bounsweet',
evos = {
{
ndex = 762,
name = 'steenee',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
evos = {
{
ndex = 763,
name = 'tsareena',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Pestone' },
}
}
}
}
}
evo.steenee, evo.tsareena = evo.bounsweet, evo.bounsweet
evo[761], evo[762], evo[763] = evo.bounsweet, evo.bounsweet, evo.bounsweet
evo.comfey = { ndex = 764, name = 'comfey' }
evo[764] = evo.comfey
evo.oranguru = { ndex = 765, name = 'oranguru' }
evo[765] = evo.oranguru
evo.passimian = { ndex = 766, name = 'passimian' }
evo[766] = evo.passimian
evo.wimpod = {
ndex = 767,
name = 'wimpod',
evos = {
{
ndex = 768,
name = 'golisopod',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
}
evo.golisopod = evo.wimpod
evo[767], evo[768] = evo.wimpod, evo.wimpod
evo.sandygast = {
ndex = 769,
name = 'sandygast',
evos = {
{
ndex = 770,
name = 'palossand',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 42,
}
}
}
evo.palossand = evo.sandygast
evo[769], evo[770] = evo.sandygast, evo.sandygast
evo.pyukumuku = { ndex = 771, name = 'pyukumuku' }
evo[771] = evo.pyukumuku
evo["tipo zero"] = {
ndex = 772,
name = 'tipo zero',
evos = {
{
ndex = 773,
name = 'silvally',
method = evo.methods.HAPPINESS,
}
}
}
evo.silvally = evo["tipo zero"]
evo[772], evo[773] = evo["tipo zero"], evo["tipo zero"]
evo.minior = { ndex = 774, name = 'minior' }
evo[774] = evo.minior
evo.komala = { ndex = 775, name = 'komala' }
evo[775] = evo.komala
evo.turtonator = { ndex = 776, name = 'turtonator' }
evo[776] = evo.turtonator
evo.togedemaru = { ndex = 777, name = 'togedemaru' }
evo[777] = evo.togedemaru
evo.mimikyu = { ndex = 778, name = 'mimikyu' }
evo[778] = evo.mimikyu
evo.bruxish = { ndex = 779, name = 'bruxish' }
evo[779] = evo.bruxish
evo.drampa = { ndex = 780, name = 'drampa' }
evo[780] = evo.drampa
evo.dhelmise = { ndex = 781, name = 'dhelmise' }
evo[781] = evo.dhelmise
evo["jangmo-o"] = {
ndex = 782,
name = 'jangmo-o',
evos = {
{
ndex = 783,
name = 'hakamo-o',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
evos = {
{
ndex = 784,
name = 'kommo-o',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 45,
}
}
}
}
}
evo["hakamo-o"], evo["kommo-o"] = evo["jangmo-o"], evo["jangmo-o"]
evo[782], evo[783], evo[784] = evo["jangmo-o"], evo["jangmo-o"], evo["jangmo-o"]
evo['tapu koko'] = { ndex = 785, name = 'tapu koko' }
evo[785] = evo['tapu koko']
evo['tapu lele'] = { ndex = 786, name = 'tapu lele' }
evo[786] = evo['tapu lele']
evo['tapu bulu'] = { ndex = 787, name = 'tapu bulu' }
evo[787] = evo['tapu bulu']
evo['tapu fini'] = { ndex = 788, name = 'tapu fini' }
evo[788] = evo['tapu fini']
evo.cosmog = {
ndex = 789,
name = 'cosmog',
evos = {
{
ndex = 790,
name = 'cosmoem',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 43,
evos = {
{
ndex = 791,
name = 'solgaleo',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 53,
conditions = { [evo.conditions.OTHER] = 'In [[Pokémon Sole e Luna|Sole]], [[Pokémon Ultrasole e Ultraluna|Ultrasole]] e [[Pokémon Spada e Scudo|Spada]]' }
},
{
ndex = 792,
name = 'lunala',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 53,
conditions = { [evo.conditions.OTHER] = 'In [[Pokémon Sole e Luna|Luna]], [[Pokémon Ultrasole e Ultraluna|Ultraluna]] e [[Pokémon Spada e Scudo|Scudo]]' }
}
}
}
}
}
evo.cosmoem, evo.solgaleo, evo.lunala = evo.cosmog, evo.cosmog, evo.cosmog
evo[789], evo[790], evo[791], evo[792] = evo.cosmog, evo.cosmog, evo.cosmog, evo.cosmog
evo.nihilego = { ndex = 793, name = 'nihilego' }
evo[793] = evo.nihilego
evo.buzzwole = { ndex = 794, name = 'buzzwole' }
evo[794] = evo.buzzwole
evo.pheromosa = { ndex = 795, name = 'pheromosa' }
evo[795] = evo.pheromosa
evo.xurkitree = { ndex = 796, name = 'xurkitree' }
evo[796] = evo.xurkitree
evo.celesteela = { ndex = 797, name = 'celesteela' }
evo[797] = evo.celesteela
evo.kartana = { ndex = 798, name = 'kartana' }
evo[798] = evo.kartana
evo.guzzlord = { ndex = 799, name = 'guzzlord' }
evo[799] = evo.guzzlord
evo.necrozma = { ndex = 800, name = 'necrozma' }
evo[800] = evo.necrozma
evo.magearna = { ndex = 801, name = 'magearna' }
evo[801] = evo.magearna
evo.marshadow = { ndex = 802, name = 'marshadow' }
evo[802] = evo.marshadow
evo.poipole = {
ndex = 803,
name = 'poipole',
evos = {
{
ndex = 804,
name = 'naganadel',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Dragopulsar' },
}
}
}
evo.naganadel = evo.poipole
evo[803], evo[804] = evo.poipole, evo.poipole
evo.stakataka = { ndex = 805, name = 'stakataka' }
evo[805] = evo.stakataka
evo.blacephalon = { ndex = 806, name = 'blacephalon' }
evo[806] = evo.blacephalon
evo.zeraora = { ndex = 807, name = 'zeraora' }
evo[807] = evo.zeraora
evo.meltan = {
ndex = 808,
name = 'meltan',
evos = {
{
ndex = 809,
name = 'melmetal',
method = evo.methods.OTHER,
[evo.methods.OTHER] = '<span class="text-small">Con 400 [[Caramelle]] Meltan in [[Pokémon GO]]</span>',
}
}
}
evo.melmetal = evo.meltan
evo[808], evo[809] = evo.meltan, evo.meltan
-- Pokémon without an ndex
evo.grookey = {
ndex = 810,
name = 'grookey',
evos = {
{
ndex = 811,
name = 'thwackey',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 812,
name = 'rillaboom',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
}
}
}
}
}
evo.thwackey, evo.rillaboom = evo.grookey, evo.grookey
evo[810], evo[811], evo[812] = evo.grookey, evo.grookey, evo.grookey
evo.scorbunny = {
ndex = 813,
name = 'scorbunny',
evos = {
{
ndex = 814,
name = 'raboot',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 815,
name = 'cinderace',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
}
}
}
}
}
evo.raboot, evo.cinderace = evo.scorbunny, evo.scorbunny
evo[813], evo[814], evo[815] = evo.scorbunny, evo.scorbunny, evo.scorbunny
evo.sobble = {
ndex = 816,
name = 'sobble',
evos = {
{
ndex = 817,
name = 'drizzile',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 16,
evos = {
{
ndex = 818,
name = 'inteleon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
}
}
}
}
}
evo.drizzile, evo.inteleon = evo.sobble, evo.sobble
evo[816], evo[817], evo[818] = evo.sobble, evo.sobble, evo.sobble
evo.skwovet = {
ndex = 819,
name = 'skwovet',
evos = {
{
ndex = 820,
name = 'greedent',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 24,
},
}
}
evo.greedent = evo.skwovet
evo[819], evo[820] = evo.skwovet, evo.skwovet
evo.rookidee = {
ndex = 821,
name = 'rookidee',
evos = {
{
ndex = 822,
name = 'corvisquire',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
evos = {
{
ndex = 823,
name = 'corviknight',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 38,
}
}
}
}
}
evo.corvisquire, evo.corviknight = evo.rookidee, evo.rookidee
evo[821], evo[822], evo[823] = evo.rookidee, evo.rookidee, evo.rookidee
evo.blipbug = {
ndex = 824,
name = 'blipbug',
evos = {
{
ndex = 825,
name = 'dottler',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 10,
evos = {
{
ndex = 826,
name = 'orbeetle',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
}
}
},
}
}
evo.dottler, evo.orbeetle = evo.blipbug, evo.blipbug
evo[824], evo[825], evo[826] = evo.blipbug, evo.blipbug, evo.blipbug
evo.nickit = {
ndex = 827,
name = 'nickit',
evos = {
{
ndex = 828,
name = 'thievul',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
}
}
}
evo.thievul = evo.nickit
evo[827], evo[828] = evo.nickit, evo.nickit
evo.gossifleur = {
ndex = 829,
name = 'gossifleur',
evos = {
{
ndex = 830,
name = 'eldegoss',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
},
}
}
evo.eldegoss = evo.gossifleur
evo[829], evo[830] = evo.gossifleur, evo.gossifleur
evo.wooloo = {
ndex = 831,
name = 'wooloo',
evos = {
{
ndex = 832,
name = 'dubwool',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 24,
}
}
}
evo.dubwool = evo.wooloo
evo[831], evo[832] = evo.wooloo,evo.wooloo
evo.chewtle = {
ndex = 833,
name = 'chewtle',
evos = {
{
ndex = 834,
name = 'drednaw',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 22,
}
}
}
evo.drednaw = evo.chewtle
evo[833], evo[834] = evo.chewtle, evo.chewtle
evo.yamper = {
ndex = 835,
name = 'yamper',
evos = {
{
ndex = 836,
name = 'boltund',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
}
}
}
evo.boltund = evo.yamper
evo[835], evo[836] = evo.yamper, evo.yamper
evo.rolycoly = {
ndex = 837,
name = 'rolycoly',
evos = {
{
ndex = 838,
name = 'carkol',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 18,
evos = {
{
ndex = 839,
name = 'coalossal',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
},
}
}
evo.carkol, evo.coalossal = evo.rolycoly, evo.rolycoly
evo[837], evo[838], evo[839] = evo.rolycoly, evo.rolycoly, evo.rolycoly
evo.applin = {
ndex = 840,
name = 'applin',
evos = {
{
ndex = 841,
name = 'flapple',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Aspropomo',
},
{
ndex = 842,
name = 'appletun',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Dolcepomo',
}
}
}
evo.flapple, evo.appletun = evo.applin, evo.applin
evo[840], evo[841], evo[842] = evo.applin, evo.applin, evo.applin
evo.silicobra = {
ndex = 843,
name = 'silicobra',
evos = {
{
ndex = 844,
name = 'sandaconda',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 36,
}
}
}
evo.sandaconda = evo.silicobra
evo[843], evo[844] = evo.silicobra, evo.silicobra
evo.cramorant = { ndex = 845, name = 'cramorant' }
evo[845] = evo.cramorant
evo.arrokuda = {
ndex = 846,
name = 'arrokuda',
evos = {
{
ndex = 847,
name = 'barraskewda',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 26,
}
}
}
evo.barraskewda = evo.arrokuda
evo[846], evo[847] = evo.arrokuda, evo.arrokuda
evo.toxel = {
ndex = 848,
name = 'toxel',
method = evo.methods.BREED,
evos = {
{
ndex = 849,
name = 'toxtricity',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
conditions = { [evo.conditions.OTHER] = 'A seconda della [[natura]]' }
},
{
ndex = '849B',
name = 'toxtricityB',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
conditions = { [evo.conditions.OTHER] = 'A seconda della [[natura]]' }
},
}
}
evo.toxtricity, evo.toxtricityB = evo.toxel, evo.toxel
evo[848], evo[849], evo['849B'] = evo.toxel, evo.toxel, evo.toxel
evo.sizzlipede = {
ndex = 850,
name = 'sizzlipede',
evos = {
{
ndex = 851,
name = 'centiskorch',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 28,
},
}
}
evo.centiskorch = evo.sizzlipede
evo[850], evo[851] = evo.sizzlipede, evo.sizzlipede
evo.clobbopus = {
ndex = 852,
name = 'clobbopus',
evos = {
{
ndex = 853,
name = 'grapploct',
method = evo.methods.LEVEL,
conditions = { [evo.conditions.MOVE] = 'Provocazione' }
},
}
}
evo.grapploct = evo.clobbopus
evo[852], evo[853] = evo.clobbopus, evo.clobbopus
evo.sinistea = {
ndex = 854,
name = 'sinistea',
notes = useless.sinistea.names.base,
evos = {
{
ndex = 855,
name = 'polteageist',
notes = useless.polteageist.names.base,
method = evo.methods.STONE,
[evo.methods.STONE] = 'Teiera rotta'
}
}
}
evo.polteageist = evo.sinistea
evo[854], evo[855] = evo.sinistea, evo.sinistea
evo.hatenna = {
ndex = 856,
name = 'hatenna',
evos = {
{
ndex = 857,
name = 'hattrem',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
evos = {
{
ndex = 858,
name = 'hatterene',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 42
}
}
}
}
}
evo.hattrem, evo.hatterene = evo.hatenna, evo.hatenna
evo[856], evo[857], evo[858] = evo.hatenna, evo.hatenna, evo.hatenna
evo.impidimp = {
ndex = 859,
name = 'impidimp',
evos = {
{
ndex = 860,
name = 'morgrem',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 32,
evos = {
{
ndex = 861,
name = 'grimmsnarl',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 42
}
}
}
}
}
evo.morgrem, evo.grimmsnarl = evo.impidimp, evo.impidimp
evo[859], evo[860], evo[861] = evo.impidimp, evo.impidimp, evo.impidimp
evo.milcery = {
ndex = 868,
name = 'milcery',
evos = {
{
ndex = 869,
name = 'alcremie',
method = evo.methods.OTHER,
[evo.methods.OTHER] = table.concat{
"<div>",
links.bag("Bonbonfragola"),
links.bag("Bonboncuore"),
links.bag("Bonbonbosco"),
links.bag("Bonbonfoglio"),
links.bag("Bonbonfiore"),
links.bag("Bonbonstella"),
links.bag("Bonbonfiocco"),
"</div>Facendo una piroetta mentre tiene un [[Bonbon]]",
},
}
}
}
evo.alcremie = evo.milcery
evo[868], evo[869] = evo.milcery, evo.milcery
evo.falinks = { ndex = 870, name = 'falinks' }
evo[870] = evo.falinks
evo.pincurchin = { ndex = 871, name = 'pincurchin' }
evo[871] = evo.pincurchin
evo.snom = {
ndex = 872,
name = 'snom',
evos = {
{
ndex = 873,
name = 'frosmoth',
method = evo.methods.HAPPINESS,
conditions = { [evo.conditions.TIME] = 'Notte' },
}
}
}
evo.frosmoth = evo.snom
evo[872], evo[873] = evo.snom, evo.snom
evo.stonjourner = { ndex = 874, name = 'stonjourner' }
evo[874] = evo.stonjourner
evo.eiscue = { ndex = 875, name = 'eiscue' }
evo[875] = evo.eiscue
evo.indeedee = { ndex = 876, name = 'indeedee' }
evo[876] = evo.indeedee
evo.indeedeeF = { ndex = '876F', name = 'indeedeeF' }
evo['876F'] = evo.indeedeeF
evo.morpeko = { ndex = 877, name = 'morpeko' }
evo[877] = evo.morpeko
evo.cufant = {
ndex = 878,
name = 'cufant',
evos = {
{
ndex = 879,
name = 'copperajah',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 34,
}
}
}
evo.copperajah = evo.cufant
evo[878], evo[879] = evo.cufant, evo.cufant
evo.dracozolt = { ndex = 880, name = 'dracozolt' }
evo[880] = evo.dracozolt
evo.arctozolt = { ndex = 881, name = 'arctozolt' }
evo[881] = evo.arctozolt
evo.dracovish = { ndex = 882, name = 'dracovish' }
evo[882] = evo.dracovish
evo.arctovish = { ndex = 883, name = 'arctovish' }
evo[883] = evo.arctovish
evo.duraludon = { ndex = 884, name = 'duraludon' }
evo[884] = evo.duraludon
evo.dreepy = {
ndex = 885,
name = 'dreepy',
evos = {
{
ndex = 886,
name = 'drakloak',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 50,
evos = {
{
ndex = 887,
name = 'dragapult',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 60,
}
}
}
}
}
evo.drakloak, evo.dragapult = evo.dreepy, evo.dreepy
evo[885], evo[886], evo[887] = evo.dreepy, evo.dreepy, evo.dreepy
evo.zacian = { ndex = 888, name = 'zacian' }
evo[888] = evo.zacian
evo.zamazenta = { ndex = 889, name = 'zamazenta' }
evo[889] = evo.zamazenta
evo.eternatus = { ndex = 890, name = 'eternatus' }
evo[890] = evo.eternatus
evo.kubfu = {
ndex = 891,
name = 'kubfu',
evos = {
{
ndex = 892,
name = 'urshifu',
notes = altforms.urshifu.names.base,
method = evo.methods.OTHER,
[evo.methods.OTHER] = "Vedendo il [[Torre Buio|Rotolo del Buio]]",
},
{
ndex = '892P',
name = 'urshifuP',
notes = altforms.urshifu.names.P,
method = evo.methods.OTHER,
[evo.methods.OTHER] = "Vedendo il [[Torre Acqua|Rotolo dell'Acqua]]",
},
}
}
evo.urshifu, evo.urshifuP = evo.kubfu, evo.kubfu
evo[891], evo[892], evo['892P'] = evo.kubfu, evo.kubfu, evo.kubfu
evo.zarude = { ndex = 893, name = 'zarude' }
evo[893] = evo.zarude
evo.regieleki = { ndex = 894, name = 'regieleki' }
evo[894] = evo.regieleki
evo.regidrago = { ndex = 895, name = 'regidrago' }
evo[895] = evo.regidrago
evo.glastrier = { ndex = 896, name = 'glastrier' }
evo[896] = evo.glastrier
evo.spectrier = { ndex = 897, name = 'spectrier' }
evo[897] = evo.spectrier
evo.calyrex = { ndex = 898, name = 'calyrex' }
evo[898] = evo.calyrex
evo.enamorus = { ndex = 905, name = 'enamorus' }
evo[905] = evo.enamorus
-- Alternative forms with evolutions
evo.rattataA = {
ndex = '019A',
name = 'rattataA',
notes = altforms.rattata.names.A,
evos = {
{
ndex = '020A',
name = 'raticateA',
notes = altforms.raticate.names.A,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
conditions = { [evo.conditions.TIME] = 'Notte' },
}
}
}
evo.raticateA = evo.rattataA
evo['019A'], evo['020A'] = evo.rattataA, evo.rattataA
evo.sandshrewA = {
ndex = '027A',
name = 'sandshrewA',
notes = altforms.sandshrew.names.A,
evos = {
{
ndex = '028A',
name = 'sandslashA',
notes = altforms.sandslash.names.A,
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietragelo',
}
}
}
evo.sandslashA = evo.sandshrewA
evo['027A'], evo['028A'] = evo.sandshrewA, evo.sandshrewA
evo.vulpixA = {
ndex = '037A',
name = 'vulpixA',
notes = altforms.vulpix.names.A,
evos = {
{
ndex = '038A',
name = 'ninetalesA',
notes = altforms.ninetales.names.A,
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietragelo',
}
}
}
evo.ninetalesA = evo.vulpixA
evo['037A'], evo['038A'] = evo.vulpixA, evo.vulpixA
evo.diglettA = {
ndex = '050A',
name = 'diglettA',
notes = altforms.diglett.names.A,
evos = {
{
ndex = '051A',
name = 'dugtrioA',
notes = altforms.dugtrio.names.A,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 26,
}
}
}
evo.dugtrioA = evo.diglettA
evo['050A'], evo['051A'] = evo.diglettA, evo.diglettA
evo.meowthA = {
ndex = '052A',
name = 'meowthA',
notes = altforms.meowth.names.A,
evos = {
{
ndex = '053A',
name = 'persianA',
notes = altforms.persian.names.A,
method = evo.methods.HAPPINESS,
}
}
}
evo.persianA = evo.meowthA
evo['052A'], evo['053A'] = evo.meowthA, evo.meowthA
evo.meowthG = {
ndex = '052G',
name = 'meowthG',
notes = altforms.meowth.names.G,
evos = {
{
ndex = 863,
name = 'perrserker',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 28,
}
}
}
evo.perrserker = evo.meowthG
evo['052G'], evo[863] = evo.meowthG, evo.meowthG
evo.growlitheH = {
ndex = '058H',
name = 'growlitheH',
evos = {
{
ndex = '059H',
name = 'arcanineH',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietrafocaia',
}
}
}
evo.arcanineH = evo.growlitheH
evo['058H'], evo['059H'] = evo.growlitheH, evo.growlitheH
evo.geodudeA = {
ndex = '074A',
name = 'geodudeA',
notes = altforms.geodude.names.A,
evos = {
{
ndex = '075A',
name = 'gravelerA',
notes = altforms.graveler.names.A,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
evos = {
{
ndex = '076A',
name = 'golemA',
notes = altforms.golem.names.A,
method = evo.methods.TRADE,
}
}
}
}
}
evo.gravelerA, evo.golemA = evo.geodudeA, evo.geodudeA
evo['074A'], evo['075A'], evo['076A'] = evo.geodudeA, evo.geodudeA, evo.geodudeA
evo.ponytaG = {
ndex = '077G',
name = 'ponytaG',
notes = altforms.ponyta.names.G,
evos = {
{
ndex = '078G',
name = 'rapidashG',
notes = altforms.rapidash.names.G,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 40,
}
}
}
evo.rapidashG = evo.ponytaG
evo['077G'], evo['078G'] = evo.ponytaG, evo.ponytaG
evo.slowpokeG = {
ndex = '079G',
name = 'slowpokeG',
evos = {
{
ndex = '080G',
name = 'slowbroG',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Fascia Galarnoce',
},
{
ndex = '199G',
name = 'slowkingG',
method = evo.methods.STONE,
[evo.methods.STONE] = 'Corona Galarnoce',
}
}
}
evo.slowbroG, evo.slowkingG = evo.slowpokeG, evo.slowpokeG
evo['079G'], evo['080G'], evo['199G'] = evo.slowpokeG, evo.slowpokeG, evo.slowpokeG
evo["farfetch'dG"] = {
ndex = '083G',
name = "farfetch'dG",
notes = altforms["farfetch'd"].names.G,
evos = {
{
ndex = 865,
name = "sirfetch'd",
method = evo.methods.OTHER,
[evo.methods.OTHER] = '<span class="text-small">Ottenendo tre [[brutto colpo|brutti colpi]] nella stessa lotta</span>',
}
}
}
evo["sirfetch'd"] = evo["farfetch'dG"]
evo['083G'], evo[865] = evo["farfetch'dG"], evo["farfetch'dG"]
evo.grimerA = {
ndex = '088A',
name = 'grimerA',
notes = altforms.grimer.names.A,
evos = {
{
ndex = '089A',
name = 'mukA',
notes = altforms.muk.names.A,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 38,
}
}
}
evo.mukA = evo.grimerA
evo['088A'], evo['089A'] = evo.grimerA, evo.grimerA
evo.voltorbH = {
ndex = '100H',
name = 'voltorbH',
evos = {
{
ndex = '101H',
name = 'electrodeH',
method = evo.methods.STONE,
[evo.methods.STONE] = "Pietrafoglia",
}
}
}
evo.electrodeH = evo.voltorbH
evo['100H'], evo['101H'] = evo.voltorbH, evo.voltorbH
evo.qwilfishH = {
ndex = '211H',
name = 'qwilfishH',
notes = altforms.qwilfish.names.H,
evos = {
{
ndex = 904,
name = 'overqwil',
method = evo.methods.OTHER,
[evo.methods.OTHER] = "Usando [[Mille Fielespine]] 20 volte come [[Tecnica potente]]",
}
}
}
evo.overqwil = evo.qwilfishH
evo['211H'], evo[904] = evo.qwilfishH, evo.qwilfishH
evo.sneaselH = {
ndex = '215H',
name = 'sneaselH',
notes = altforms.sneasel.names.H,
evos = {
{
ndex = 903,
name = 'sneasler',
method = evo.methods.STONE,
[evo.methods.STONE] = "Affilartigli",
conditions = { [evo.conditions.TIME] = 'Giorno' }
}
}
}
evo.sneasler = evo.sneaselH
evo['215H'], evo[903] = evo.sneaselH, evo.sneaselH
evo.corsolaG = {
ndex = '222G',
name = 'corsolaG',
notes = altforms.corsola.names.G,
evos = {
{
ndex = 864,
name = 'cursola',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 38,
}
}
}
evo.cursola = evo.corsolaG
evo['222G'], evo[864] = evo.corsolaG, evo.corsolaG
evo.zigzagoonG = {
ndex = '263G',
name = 'zigzagoonG',
notes = altforms.zigzagoon.names.G,
evos = {
{
ndex = '264G',
name = 'linooneG',
notes = altforms.linoone.names.G,
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 20,
evos = {
{
ndex = 862,
name = 'obstagoon',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 35,
conditions = { [evo.conditions.TIME] = 'Notte' },
}
}
}
}
}
evo.linooneG, evo.obstagoon = evo.zigzagoonG, evo.zigzagoonG
evo['263G'], evo['264G'], evo[862] = evo.zigzagoonG, evo.zigzagoonG, evo.zigzagoonG
evo.basculinBi = {
ndex = '550Bi',
name = 'basculinBi',
notes = altforms.basculin.names.Bi,
evos = {
{
ndex = 902,
name = 'basculegion',
notes = altforms.basculegion.names.base,
method = evo.methods.OTHER,
[evo.methods.OTHER] = [=[<span class="text-small">Avendo subito almeno 294 PS di danni da [[contraccolpo]]</span>]=],
conditions = { [evo.conditions.GENDER] = 'Maschio' }
},
{
ndex = '902F',
name = 'basculegionF',
notes = altforms.basculegion.names.F,
method = evo.methods.OTHER,
[evo.methods.OTHER] = [=[<span class="text-small">Avendo subito almeno 294 PS di danni da [[contraccolpo]]</span>]=],
conditions = { [evo.conditions.GENDER] = 'Femmina' }
},
}
}
evo.basculegion, evo.basculegionF = evo.basculinBi, evo.basculinBi
evo['550Bi'], evo[902], evo['902F'] = evo.basculinBi, evo.basculinBi, evo.basculinBi
evo.darumakaG = {
ndex = '554G',
name = 'darumakaG',
notes = altforms.darumaka.names.G,
evos = {
{
ndex = '555G',
name = 'darmanitanG',
notes = altforms.darmanitan.names.G,
method = evo.methods.STONE,
[evo.methods.STONE] = 'Pietragelo',
}
}
}
evo.darmanitanG = evo.darumakaG
evo['554G'], evo['555G'] = evo.darumakaG, evo.darumakaG
evo.yamaskG = {
ndex = '562G',
name = 'yamaskG',
notes = altforms.yamask.names.G,
evos = {
{
ndex = 867,
name = 'runerigus',
method = evo.methods.OTHER,
[evo.methods.OTHER] = [=[
<span class="text-small"><div>Avendo subito almeno 49PS di danni,</div>
<div>passare sotto l'arco di pietra nella [[Conca delle Sabbie]]</div></span>]=],
}
}
}
evo.runerigus = evo.yamaskG
evo['562G'], evo[867] = evo.yamaskG, evo.yamaskG
evo.zoruaH = {
ndex = '570H',
name = 'zoruaH',
evos = {
{
ndex = '571H',
name = 'zoroarkH',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 30,
conditions = { [evo.conditions.REGION] = 'Hisui' },
}
}
}
evo.zoroarkH = evo.zoruaH
evo['570H'], evo['571H'] = evo.zoruaH, evo.zoruaH
--[[
Given a Pokémon's tree builds versions for its alternative forms and binds them
with the expected names. Tables are created only for the Pokémon and it's
evolutions, not for it's preevo (actually it takes ndexes from it's traversal
of the tree).
If a node doesn't have the "notes" field it's kept as is, without adding
neither notes nor adding the abbr to the ndex.
--]]
local createAlternativeForm = function(altdata, basetab)
-- Internal tree map function
local function mapTree(evotab, func)
local result = func(mw.clone(evotab))
if evotab.evos then
result.evos = table.map(result.evos, function(v)
return mapTree(v, func)
end)
end
return result
end
table.map(altdata.names, function(name, abbr)
local ndexes = {}
if abbr == "base" then
return
end
local newtab = mapTree(basetab, function(basenode)
if basenode.notes then
table.insert(ndexes, basenode.ndex)
basenode.ndex = string.tf(basenode.ndex) .. abbr
basenode.name = tostring(basenode.name) .. abbr
basenode.notes = name
end
return basenode
end)
table.map(ndexes, function(ndex)
evo[string.tf(ndex) .. abbr] = newtab
evo[pokes[ndex].name:lower() .. abbr] = newtab
end)
end)
end
evo.unown = { ndex = 201, name = 'unown' }
evo[201] = evo.unown
evo.basculinB = { ndex = '550B', name = 'basculinB', notes = altforms.basculin.names.B }
evo['550B'] = evo.basculinB
evo.meowsticF = {
ndex = 677,
name = 'espurr',
evos = {
{
ndex = "678F",
name = 'meowsticF',
method = evo.methods.LEVEL,
[evo.methods.LEVEL] = 25,
}
}
}
evo["678F"] = evo.meowsticF
evo.sinisteaA = {
ndex = '854A',
name = 'sinisteaA',
notes = useless.sinistea.names["A"],
evos = {
{
ndex = '855A',
name = 'polteageistA',
notes = useless.polteageist.names["A"],
method = evo.methods.STONE,
[evo.methods.STONE] = 'Teiera crepata'
}
}
}
evo.polteageistA = evo.sinisteaA
evo['854A'], evo['855A'] = evo.sinisteaA, evo.sinisteaA
createAlternativeForm(useless.burmy, evo.burmy)
createAlternativeForm(useless.shellos, evo.shellos)
createAlternativeForm(altforms.pumpkaboo, evo.pumpkaboo)
createAlternativeForm(useless.deerling, evo.deerling)
createAlternativeForm(useless.frillish, evo.frillish)
createAlternativeForm(useless.floette, evo.floette)
-- Alternative forms without evolutions, here just to avoid burst of the module
-- when indexing them
--[[
Simple function that creates empty tables for all alternative forms but base
--]]
local emptyAlternativeForms = function(altdata, name)
local ndex = pokes[name].ndex
table.map(altdata.names, function(_, abbr)
if abbr == "base" then
return
end
-- Avoid to overwrite an existing table
if evo[name .. abbr] then
return
end
evo[name .. abbr] = {
ndex = ndex and (string.tf(ndex) .. abbr) or nil,
name = name .. abbr
}
if ndex then
evo[string.tf(ndex) .. abbr] = evo[name .. abbr]
end
end)
end
-- Given that emptyAlternativeForms can't overwrite an existing table, simply
-- maps over altforms and useless
local nopokes = { 'mega', 'megaxy', 'archeo', 'alola', 'galar', 'gigamax',
'hisui' }
for k, v in pairs(altforms) do
if type(k) == 'string' and not table.search(nopokes, k) then
emptyAlternativeForms(v, k)
end
end
for k, v in pairs(useless) do
if type(k) == 'string' and not table.search(nopokes, k) then
emptyAlternativeForms(v, k)
end
end
--[[
Data for Pokémon that can change alternative form: in a subtable to split
them from evolutions.
For each Pokémon there's an array, whose elements are arrays themselves
containing forms that should be put at that stage in the evobox. Anyway,
any form is supposed to be able to change to any other form listed here.
--]]
evo.forms = {}
-- Local variable to avoid to write evo.forms
local efs = evo.forms
--[[
Methods:
- OTHER: just print the value of [evo.forms.methods.OTHER].
- NONE: doesn't print anything.
- ITEM: [evo.forms.methods.ITEM] should contain the name of the item.
--]]
efs.methods = {}
efs.methods.OTHER = 0
efs.methods.NONE = 1
efs.methods.ITEM = 2
efs.castform = {
{ { ndex = 351, name = 'castform' } },
{ {
ndex = '351S',
name = 'castformS',
notes = 'Sotto il [[Luce solare intensa|sole]]',
method = efs.methods.NONE,
} },
{ {
ndex = '351P',
name = 'castformP',
notes = 'Sotto la [[Pioggia battente|pioggia]]',
method = efs.methods.NONE,
} },
{ {
ndex = '351N',
name = 'castformN',
notes = 'Sotto la [[Grandine (condizione atmosferica)|grandine]]',
method = efs.methods.NONE,
} },
}
efs.castformS, efs.castformP, efs.castformN =
efs.castform, efs.castform, efs.castform
efs[351], efs['351S'], efs['351P'], efs['351N'] =
efs.castform, efs.castform, efs.castform, efs.castform
efs.deoxys = {
{ { ndex = 386, name = 'deoxys' } },
{ { ndex = '386A', name = 'deoxysA', method = efs.methods.NONE } },
{ { ndex = '386D', name = 'deoxysD', method = efs.methods.NONE } },
{ { ndex = '386V', name = 'deoxysV', method = efs.methods.NONE } },
}
efs.deoxysA, efs.deoxysD, efs.deoxysV =
efs.deoxys, efs.deoxys, efs.deoxys
efs[386], efs['386A'], efs['386D'], efs['386V'] =
efs.deoxys, efs.deoxys, efs.deoxys, efs.deoxys
efs.rotom = {
{ { ndex = 479, name = 'rotom' } },
{ { ndex = '479C', name = 'rotomC', method = efs.methods.NONE } },
{ { ndex = '479L', name = 'rotomL', method = efs.methods.NONE } },
{ { ndex = '479G', name = 'rotomG', method = efs.methods.NONE } },
{ { ndex = '479V', name = 'rotomV', method = efs.methods.NONE } },
{ { ndex = '479T', name = 'rotomT', method = efs.methods.NONE } },
}
efs.rotomC, efs.rotomL, efs.rotomG, efs.rotomV, efs.rotomT =
efs.rotom, efs.rotom, efs.rotom, efs.rotom, efs.rotom
efs[479], efs['479C'], efs['479L'], efs['479G'], efs['479V'], efs['479T'] =
efs.rotom, efs.rotom, efs.rotom, efs.rotom, efs.rotom, efs.rotom
efs.giratina = {
{ {
ndex = 487,
name = 'giratina',
notes = '[[Mondo Distorto]]<br>oppure<br>tenendo la Grigiosfera',
} },
{ {
ndex = '487O',
name = 'giratinaO',
notes = '[[Mondo Pokémon]],<br>senza tenere la Grigiosfera',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Grigiosfera',
} },
}
efs.giratinaO = efs.giratina
efs[487], efs['487O'] = efs.giratina, efs.giratina
efs.shaymin = {
{ {
ndex = 492,
name = 'shaymin',
notes = 'Di notte e nel PC',
} },
{ {
ndex = '492C',
name = 'shayminC',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Gracidea',
} },
}
efs.shayminC = efs.shaymin
efs[492], efs['492C'] = efs.shaymin, efs.shaymin
-- No notes because right now it isn't used to build evobox
efs.arceus = {
{ { ndex = 493, name = 'arceus' } },
{ { ndex = '493L', name = 'arceusL', method = efs.methods.NONE } },
{ { ndex = '493Vo', name = 'arceusVo', method = efs.methods.NONE } },
{ { ndex = '493Ve', name = 'arceusVe', method = efs.methods.NONE } },
{ { ndex = '493T', name = 'arceusT', method = efs.methods.NONE } },
{ { ndex = '493R', name = 'arceusR', method = efs.methods.NONE } },
{ { ndex = '493C', name = 'arceusC', method = efs.methods.NONE } },
{ { ndex = '493S', name = 'arceusS', method = efs.methods.NONE } },
{ { ndex = '493Ai', name = 'arceusAi', method = efs.methods.NONE } },
{ { ndex = '493Fu', name = 'arceusFu', method = efs.methods.NONE } },
{ { ndex = '493Aq', name = 'arceusAq', method = efs.methods.NONE } },
{ { ndex = '493Er', name = 'arceusEr', method = efs.methods.NONE } },
{ { ndex = '493El', name = 'arceusEl', method = efs.methods.NONE } },
{ { ndex = '493P', name = 'arceusP', method = efs.methods.NONE } },
{ { ndex = '493G', name = 'arceusG', method = efs.methods.NONE } },
{ { ndex = '493D', name = 'arceusD', method = efs.methods.NONE } },
{ { ndex = '493B', name = 'arceusB', method = efs.methods.NONE } },
{ { ndex = '493Fo', name = 'arceusFo', method = efs.methods.NONE } },
}
efs[493] = efs.arceus
efs.darmanitan = {
{ { ndex = 555, name = 'darmanitan' } },
{ { ndex = '555Z', name = 'darmanitanZ', method = efs.methods.NONE } },
}
efs.darmanitanZ = efs.darmanitan
efs[555], efs['555Z'] = efs.darmanitan, efs.darmanitan
efs.darmanitanG = {
{ { ndex = '555G', name = 'darmanitanG' } },
{ { ndex = '555GZ', name = 'darmanitanGZ', method = efs.methods.NONE } },
}
efs.darmanitanGZ = efs.darmanitanG
efs['555G'], efs['555GZ'] = efs.darmanitanG, efs.darmanitanG
efs.tornadus = {
{ { ndex = 641, name = 'tornadus' } },
{ {
ndex = '641T',
name = 'tornadusT',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Verispecchio',
} },
}
efs.tornadusT = efs.tornadus
efs[641], efs['641T'] = efs.tornadus, efs.tornadus
efs.thundurus = {
{ { ndex = 642, name = 'thundurus' } },
{ {
ndex = '642T',
name = 'thundurusT',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Verispecchio',
} },
}
efs.thundurusT = efs.thundurus
efs[642], efs['642T'] = efs.thundurus, efs.thundurus
efs.landorus = {
{ { ndex = 645, name = 'landorus' } },
{ {
ndex = '645T',
name = 'landorusT',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Verispecchio',
} },
}
efs.landorusT = efs.landorus
efs[645], efs['645T'] = efs.landorus, efs.landorus
efs.kyurem = {
{ { ndex = '646N', name = 'kyuremN', notes = ms.staticLua(644) .. ' con [[Zekrom]]' } },
{ {
ndex = 664,
name = 'kyurem',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Cuneo DNA',
} },
{ {
ndex = '646B',
name = 'kyuremB',
notes = ms.staticLua(643) .. ' con [[Reshiram]]',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Cuneo DNA',
} },
}
efs.kyuremB, efs.kyuremN = efs.kyurem, efs.kyurem
efs[664], efs['646B'], efs['646N'] = efs.kyurem, efs.kyurem, efs.kyurem
efs.meloetta = {
{ { ndex = 648, name = 'meloetta' } },
{ {
ndex = '648D',
name = 'meloettaD',
method = efs.methods.OTHER,
[efs.methods.OTHER] = links.bag('MT Normale') .. '<br>Usando [[Cantoantico]]',
} },
}
efs.meloettaD = efs.meloetta
efs[648], efs['648D'] = efs.meloetta, efs.meloetta
efs.greninja = {
{ { ndex = 658, name = 'greninja' } },
{ {
ndex = '658A',
name = 'greninjaA',
notes = 'Dopo aver mandato KO un Pokémon',
method = efs.methods.NONE,
} },
}
efs.greninjaA = efs.greninja
efs[658], efs['658A'] = efs.greninja, efs.greninja
efs.aegislash = {
{ {
ndex = 681,
name = 'aegislash',
notes = 'Usando [[Scudo Reale]]',
} },
{ {
ndex = '681S',
name = 'aegislashS',
notes = 'Usando una mossa non di [[stato]]',
method = efs.methods.NONE,
} },
}
efs.aegislashS = efs.aegislash
efs[681], efs['681S'] = efs.aegislash, efs.aegislash
efs.zygarde = {
{ { ndex = '718D', name = 'zygardeD' } },
{ {
ndex = 718,
name = 'zygarde',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Teca Zygarde',
} },
{ {
ndex = '718P',
name = 'zygardeP',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Teca Zygarde',
} },
}
efs.zygardeD, efs.zygardeP = efs.zygarde, efs.zygarde
efs[718], efs['718D'], efs['718P'] = efs.zygarde, efs.zygarde, efs.zygarde
efs.hoopa = {
{ { ndex = 720, name = 'hoopa', notes = 'Dopo tre giorni o se depositato nel box' } },
{ {
ndex = '720L',
name = 'hoopaL',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Vaso del vincolo',
} },
}
efs.hoopaL = efs.hoopa
efs[720], efs['720L'] = efs.hoopa, efs.hoopa
efs.oricorio = {
{ {
ndex = '741C', name = 'oricorioC',
notes = links.bag('Nettare Giallo') .. '[[Nettare Giallo]]',
} },
{ {
ndex = '741H', name = 'oricorioH', method = efs.methods.NONE,
notes = links.bag('Nettare Rosa') .. '[[Nettare Rosa]]',
} },
{ {
ndex = 741, name = 'oricorio', method = efs.methods.NONE,
notes = links.bag('Nettare Rosso') .. '[[Nettare Rosso]]',
} },
{ {
ndex = '741B', name = 'oricorioB', method = efs.methods.NONE,
notes = links.bag('Nettare Viola') .. '[[Nettare Viola]]',
} },
}
efs.oricorioC, efs.oricorioH, efs.oricorioB =
efs.oricorio, efs.oricorio, efs.oricorio
efs[741], efs['741C'], efs['741H'], efs['741B'] =
efs.oricorio, efs.oricorio, efs.oricorio, efs.oricorio
efs.wishiwashi = {
{ { ndex = 746, name = 'wishiwashi' } },
{ {
ndex = '746B',
name = 'wishiwashiB',
notes = 'Con più di un quarto dei PS a partire dal livello 20',
method = efs.methods.NONE,
} },
}
efs.wishiwashiB = efs.wishiwashi
efs[746], efs['746B'] = efs.wishiwashi, efs.wishiwashi
efs.silvally = {
{ { ndex = 773, name = 'silvally' } },
{ { ndex = '773L', name = 'silvallyL', method = efs.methods.NONE } },
{ { ndex = '773Vo', name = 'silvallyVo', method = efs.methods.NONE } },
{ { ndex = '773Ve', name = 'silvallyVe', method = efs.methods.NONE } },
{ { ndex = '773T', name = 'silvallyT', method = efs.methods.NONE } },
{ { ndex = '773R', name = 'silvallyR', method = efs.methods.NONE } },
{ { ndex = '773C', name = 'silvallyC', method = efs.methods.NONE } },
{ { ndex = '773S', name = 'silvallyS', method = efs.methods.NONE } },
{ { ndex = '773Ai', name = 'silvallyAi', method = efs.methods.NONE } },
{ { ndex = '773Fu', name = 'silvallyFu', method = efs.methods.NONE } },
{ { ndex = '773Aq', name = 'silvallyAq', method = efs.methods.NONE } },
{ { ndex = '773Er', name = 'silvallyEr', method = efs.methods.NONE } },
{ { ndex = '773El', name = 'silvallyEl', method = efs.methods.NONE } },
{ { ndex = '773P', name = 'silvallyP', method = efs.methods.NONE } },
{ { ndex = '773G', name = 'silvallyG', method = efs.methods.NONE } },
{ { ndex = '773D', name = 'silvallyD', method = efs.methods.NONE } },
{ { ndex = '773B', name = 'silvallyB', method = efs.methods.NONE } },
{ { ndex = '773Fo', name = 'silvallyFo', method = efs.methods.NONE } },
}
efs.minior = {
{ { ndex = 774, name = 'minior' } },
{ {
ndex = '774R',
name = 'miniorR',
notes = 'Con meno di metà dei PS',
method = efs.methods.NONE,
} },
}
efs.miniorR = efs.minior
efs[774], efs['774R'] = efs.minior, efs.minior
efs.necrozma = {
{ { ndex = 800, name = 'necrozma' } },
{
{
ndex = '800V',
name = 'necrozmaV',
notes = ms.staticLua(791) .. ' con [[Solgaleo]]',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Necrosolix',
},
{
ndex = '800A',
name = 'necrozmaA',
notes = ms.staticLua(792) .. ' con [[Lunala]]',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Necrolunix',
},
},
{ {
ndex = '800U',
name = 'necrozmaU',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Ultranecrozium Z',
} },
}
efs.necrozmaV, efs.necrozmaA, efs.necrozmaU =
efs.necrozma, efs.necrozma, efs.necrozma
efs[800], efs['800V'], efs['800A'], efs['800U'] =
efs.necrozma, efs.necrozma, efs.necrozma, efs.necrozma
efs.cramorant = {
{ { ndex = 845, name = 'cramorant' } },
{ {
ndex = '845T',
name = 'cramorantT',
method = efs.methods.OTHER,
[efs.methods.OTHER] = "N/D",
} },
{ {
ndex = '845I',
name = 'cramorantI',
method = efs.methods.OTHER,
[efs.methods.OTHER] = "N/D",
} },
}
efs.cramorantT, efs.cramorantI = efs.cramorant, efs.cramorant
efs[845], efs['845T'], efs['845I'] = efs.cramorant, efs.cramorant, efs.cramorant
efs.eiscue = {
{ { ndex = 875, name = 'eiscue' } },
{ {
ndex = '875L',
name = 'eiscueL',
method = efs.methods.OTHER,
[efs.methods.OTHER] = "N/D",
} },
}
efs.eiscueL = efs.eiscue
efs[875], efs['875L'] = efs.eiscue, efs.eiscue
efs.morpeko = {
{ { ndex = 877, name = 'morpeko' } },
{ {
ndex = '877V',
name = 'morpekoV',
method = efs.methods.OTHER,
[efs.methods.OTHER] = "Cambia forma ogni turno<br>per l'abilità [[Pancialterna]]",
} },
}
efs.morpekoV = efs.morpeko
efs[877], efs['877V'] = efs.morpeko, efs.morpeko
efs.zacian = {
{ { ndex = 888, name = 'zacian' } },
{ {
ndex = '888R',
name = 'zacianR',
method = efs.methods.OTHER,
[efs.methods.OTHER] = "N/D",
} },
}
efs.zacianR = efs.zacian
efs[888], efs['888R'] = efs.zacian, efs.zacian
efs.zamazenta = {
{ { ndex = 888, name = 'zamazenta' } },
{ {
ndex = '889R',
name = 'zamazentaR',
method = efs.methods.OTHER,
[efs.methods.OTHER] = "N/D",
} },
}
efs.zamazentaR = efs.zamazenta
efs[889], efs['889R'] = efs.zamazenta, efs.zamazenta
efs.eternatus = {
{ { ndex = 890, name = 'eternatus' } },
{ {
ndex = '890D',
name = 'eternatusD',
method = efs.methods.OTHER,
[efs.methods.OTHER] = "N/D",
} },
}
efs.eternatusD = efs.eternatus
efs[890], efs['890D'] = efs.eternatus, efs.eternatus
efs.enamorus = {
{ { ndex = 905, name = 'enamorus' } },
{ {
ndex = '905T',
name = 'enamorusT',
method = efs.methods.UNKNOWN,
-- [efs.methods.ITEM] = 'Verispecchio',
} },
}
efs.enamorusT = efs.enamorus
efs[905], efs['905T'] = efs.enamorus, efs.enamorus
efs.burmy = {
{ {
ndex = 412, name = 'burmy',
notes = 'Dopo aver lottato in un altro luogo',
} },
{ {
ndex = '412Sc', name = 'burmySc', method = efs.methods.NONE,
notes = 'Dopo aver lottato in un edificio',
} },
{ {
ndex = '412Sa', name = 'burmySa', method = efs.methods.NONE,
notes = 'Dopo aver lottato in una grotta o su una spiaggia',
} },
}
efs.burmySc, efs.Sa = efs.burmy, efs.burmy
efs[412], efs['412Sc'], efs['412Sa'] = efs.burmy, efs.burmy, efs.burmy
efs.cherrim = {
{ { ndex = 421, name = 'cherrim' } },
{ {
ndex = '421S',
name = 'cherrimS',
notes = 'Sotto il [[Luce solare intensa|sole]]',
method = efs.methods.NONE,
} },
}
efs.cherrimS = efs.cherrim
efs[421], efs['421S'] = efs.cherrim, efs.cherrim
efs.keldeo = {
{ { ndex = 647, name = 'keldeo' } },
{ {
ndex = '647R',
name = 'keldeoR',
method = efs.methods.OTHER,
[efs.methods.OTHER] = links.bag('MT Lotta') .. '<br>Imparando [[Spadamistica]]',
} },
}
efs.keldeoR = efs.keldeo
efs[647], efs['647R'] = efs.keldeo, efs.keldeo
efs.genesect = {
{ { ndex = 649, name = 'genesect', } },
{ {
ndex = '649I', name = 'genesectI', method = efs.methods.NONE,
notes = 'Tenendo ' .. links.bag('Idromodulo'),
} },
{ {
ndex = '649V', name = 'genesectV', method = efs.methods.NONE,
notes = 'Tenendo ' .. links.bag('Voltmodulo'),
} },
{ {
ndex = '649P', name = 'genesectP', method = efs.methods.NONE,
notes = 'Tenendo ' .. links.bag('Piromodulo'),
} },
{ {
ndex = '649G', name = 'genesectG', method = efs.methods.NONE,
notes = 'Tenendo ' .. links.bag('Gelomodulo'),
} },
}
efs.genesectI, efs.genesectV, efs.genesectP, efs.genesectG =
efs.genesect, efs.genesect, efs.genesect, efs.genesect
efs[649], efs['649I'], efs['649V'], efs['649P'], efs['649G'] =
efs.oricorio, efs.oricorio, efs.oricorio, efs.oricorio, efs.genesect
efs.xerneas = {
{ { ndex = 716, name = 'xerneas', notes = 'Fuori dalla lotta' } },
{ {
ndex = '716A',
name = 'xerneasA',
notes = 'In lotta',
method = efs.methods.NONE,
} },
}
efs.xerneasA = efs.xerneas
efs[716], efs['716A'] = efs.xerneas, efs.xerneas
efs.mimikyu = {
{ { ndex = 778, name = 'mimikyu' } },
{ {
ndex = '778S',
name = 'mimikyuS',
notes = 'Venendo colpito in lotta',
method = efs.methods.NONE,
} },
}
efs.mimikyuS = efs.mimikyu
efs[778], efs['778S'] = efs.mimikyu, efs.mimikyu
efs.charizard = {
{ { ndex = '006MX', name = 'charizardMX' } },
{
{
ndex = 6,
name = 'charizard',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Charizardite X',
}
},
{
{
ndex = '006MY',
name = 'charizardMY',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Charizardite Y',
}
},
}
efs.charizardMX, efs.charizardMY = efs.charizard, efs.charizard
efs[6], efs['006MX'], efs['006MY'] = efs.charizard, efs.charizard, efs.charizard
efs.mewtwo = {
{ { ndex = '150MX', name = 'mewtwoMX' } },
{
{
ndex = 150,
name = 'mewtwo',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Mewtwoite X',
}
},
{
{
ndex = '150MY',
name = 'mewtwoMY',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Mewtwoite Y',
}
},
}
efs.mewtwoMX, efs.mewtwoMY = efs.mewtwo, efs.mewtwo
efs[150], efs['150MX'], efs['150MY'] = efs.mewtwo, efs.mewtwo, efs.mewtwo
efs.kyogre = {
{ { ndex = 382, name = 'kyogre' } },
{
{
ndex = '382A',
name = 'kyogreA',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Gemma blu',
}
},
}
efs.kyogreA = efs.kyogre
efs[382], efs['382A'] = efs.kyogre, efs.kyogre
efs.groudon = {
{ { ndex = 383, name = 'groudon' } },
{
{
ndex = '383A',
name = 'groudonA',
method = efs.methods.ITEM,
[efs.methods.ITEM] = 'Gemma rossa',
}
},
}
efs.groudonA = efs.groudon
efs[383], efs['383A'] = efs.groudon, efs.groudon
efs.rayquaza = {
{ { ndex = 384, name = 'rayquaza' } },
{
{
ndex = '384M',
name = 'rayquazaM',
method = efs.methods.NONE,
}
},
}
efs.rayquazaM = efs.rayquaza
efs[384], efs['384M'] = efs.rayquaza, efs.rayquaza
local createMega = function(pkmn, ndex, item)
efs[pkmn] = {
{ { ndex = ndex, name = pkmn } },
{
{
ndex = string.tf(ndex) .. 'M',
name = pkmn .. 'M',
method = efs.methods.ITEM,
[efs.methods.ITEM] = item,
}
},
}
efs[pkmn .. 'M'] = efs[pkmn]
efs[ndex], efs[string.tf(ndex) .. 'M'] = efs[pkmn], efs[pkmn]
end
createMega('venusaur', 3, 'Venusaurite')
createMega('blastoise', 9, 'Blastoisite')
createMega('beedrill', 15, 'Beedrillite')
createMega('pidgeot', 18, 'Pidgeotite')
createMega('alakazam', 65, 'Alakazamite')
createMega('slowbro', 80, 'Slowbroite')
createMega('gengar', 94, 'Gengarite')
createMega('kangaskhan', 115, 'Kangaskhanite')
createMega('pinsir', 127, 'Pinsirite')
createMega('gyarados', 130, 'Gyaradosite')
createMega('aerodactyl', 142, 'Aerodactylite')
createMega('ampharos', 181, 'Ampharosite')
createMega('steelix', 208, 'Steelixite')
createMega('scizor', 212, 'Scizorite')
createMega('heracross', 214, 'Heracrossite')
createMega('houndoom', 229, 'Houndoomite')
createMega('tyranitar', 248, 'Tyranitarite')
createMega('sceptile', 254, 'ceptilite')
createMega('blaziken', 257, 'Blazikenite')
createMega('swampert', 260, 'Swampertite')
createMega('gardevoir', 282, 'Gardevoirite')
createMega('sableye', 302, 'Sableyite')
createMega('mawile', 303, 'Mawilite')
createMega('aggron', 306, 'Aggronite')
createMega('medicham', 308, 'Medichamite')
createMega('manectric', 310, 'Manectricite')
createMega('sharpedo', 319, 'Sharpedite')
createMega('camerupt', 323, 'Cameruptite')
createMega('altaria', 334, 'Altarite')
createMega('banette', 354, 'Banettite')
createMega('absol', 359, 'Absolite')
createMega('glalie', 362, 'Glalite')
createMega('salamence', 373, 'Salamencite')
createMega('metagross', 376, 'Metagrossite')
createMega('latias', 380, 'Latiasite')
createMega('latios', 381, 'Latiosite')
createMega('lopunny', 428, 'Lopunnite')
createMega('garchomp', 445, 'Garchompite')
createMega('lucario', 448, 'Lucarite')
createMega('abomasnow', 460, 'Abomasnowite')
createMega('gallade', 475, 'Galladite')
createMega('audino', 531, 'Audinite')
createMega('diancie', 719, 'Diancite')
return evo
|
require("luacom")
local obj = luacom.CreateObject("testlua.Teste")
print(obj:Sum(2,3))
print(type(obj:I2A(3)))
print(obj:IntDivide(5,2))
print("Finishing...")
|
vim.opt.completeopt = { "menuone", "noselect" }
vim.opt.shortmess:append "c"
local cmp = require "cmp"
cmp.setup {
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end
},
sources = {
{ name = "buffer" },
{ name = "path" },
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
},
}
|
--
-- Tests for the system module
--
local system = require 'system'
local tasty = require 'tasty'
local group = tasty.test_group
local test = tasty.test_case
local assert = tasty.assert
--- helper function, combining with_wd and with_tmpdir
function in_tmpdir (callback)
return function ()
system.with_tmpdir('test-sytem-tmpdir', function (tmpdir)
system.with_wd(tmpdir, callback)
end)
end
end
--- dummy string for testing
local token = 'Banana'
--- check if token can be written into a file in given directory; returns the
--- content of this file.
function write_read_token (dir, filename)
local filename = string.format('%s/%s', dir, 'foo.txt')
local fh = io.open(filename, 'w')
fh:write(token .. '\n')
fh:close()
return io.open(filename):read '*l'
end
-- Check existence static fields
return {
group 'static fields' {
test('arch', function ()
assert.are_equal(type(system.arch), 'string')
end),
test('compiler_name', function ()
assert.are_equal(type(system.compiler_name), 'string')
end),
test('compiler_version', function ()
assert.are_equal(type(system.compiler_version), 'table')
end),
test('os', function ()
assert.are_equal(type(system.os), 'string')
end),
},
group 'environment' {
test('getenv returns same result as os.getenv', function ()
assert.are_equal(system.getenv 'PATH', os.getenv 'PATH')
end),
test('setenv sets environment values', function ()
system.setenv('HSLUA_SYSTEM_MODULE', 'test')
-- apparently this works differently on Windows.
local getenv = system.os == 'mingw32' and system.getenv or os.getenv
assert.are_equal(getenv 'HSLUA_SYSTEM_MODULE', 'test')
end),
},
group 'getwd' {
test('returns a string', function ()
assert.are_equal(type(system.getwd()), 'string')
end)
},
group 'env' {
test('returns a table', function ()
assert.are_equal(type(system.env()), 'table')
end)
},
group 'ls' {
test('returns a table', function ()
assert.are_equal(type(system.ls('.')), 'table')
end),
test('lists files in directory', in_tmpdir(function ()
io.open('README.org', 'w'):close()
assert.are_same(system.ls '.', {'README.org'})
end)),
test('argument defaults to `.`', function ()
assert.are_equal(#system.ls('.'), #system.ls())
end),
test('fails when arg is not a directory', function ()
assert.error_matches(
function () system.ls('thisdoesnotexist') end,
'thisdoesnotexist'
)
assert.error_matches(
function () system.ls('README.md') end,
'README%.md'
)
end)
},
group 'mkdir' {
test('create directory', in_tmpdir(function ()
system.mkdir 'foo'
assert.are_equal((system.ls())[1], 'foo')
end)),
test('create nested directories', in_tmpdir(function ()
system.mkdir('foo/bar', true)
assert.are_equal((system.ls())[1], 'foo')
assert.are_equal((system.ls 'foo')[1], 'bar')
end)),
test('cannot create existing directory', in_tmpdir(function ()
assert.error_matches(function () system.mkdir '.' end, '%.')
end)),
test('optionally ignores existing directories', in_tmpdir(function ()
system.mkdir 'foo'
system.mkdir('foo', true)
end)),
test('normal operation', in_tmpdir(function () system.mkdir 'foo' end)),
},
group 'rmdir' {
test('remove empty directory', in_tmpdir(function ()
system.mkdir 'remove-me'
system.rmdir 'remove-me'
assert.are_same(system.ls(), {})
end)),
test('fail if directory is not empty', in_tmpdir(function ()
system.mkdir('outer/inner', true)
assert.error_matches(function () system.rmdir('outer') end, '.')
end)),
test('optionally delete recursively', in_tmpdir(function ()
system.mkdir('outer/inner', true)
system.rmdir('outer', true)
assert.are_same(system.ls(), {})
end))
},
group 'tmpdirname' {
test('returns a string', function ()
assert.are_equal(type(system.tmpdirname()), 'string')
end)
},
group 'with_env' {
test('resets environment', function ()
-- TODO: this test fails on Windows for unknown reasons and is
-- disabled on there for that reason. This needs fixing.
if system.os == 'mingw32' then return nil end
local outer_value = 'outer test value'
local inner_value = 'inner test value'
local inner_only = 'test #2'
function check_env ()
assert.are_equal(os.getenv 'HSLUA_SYSTEM_TEST', inner_value)
assert.are_equal(
os.getenv 'HSLUA_SYSTEM_TEST_INNER_ONLY',
inner_only
)
assert.is_nil(os.getenv 'HSLUA_SYSTEM_TEST_OUTER_ONLY')
end
local test_env = {
HSLUA_SYSTEM_TEST = inner_value,
HSLUA_SYSTEM_TEST_INNER_ONLY = inner_only
}
system.setenv('HSLUA_SYSTEM_TEST_OUTER_ONLY', outer_value)
system.setenv('HSLUA_SYSTEM_TEST', outer_value)
system.with_env(test_env, check_env)
assert.are_equal(system.getenv 'HSLUA_SYSTEM_TEST', outer_value)
assert.is_nil(system.getenv 'HSLUA_SYSTEM_TEST_INNER_ONLY')
assert.are_equal(
system.getenv 'HSLUA_SYSTEM_TEST_OUTER_ONLY',
outer_value
)
end)
},
group 'with_tmpdir' {
test('no base directory given', function ()
assert.are_equal(system.with_tmpdir('foo', write_read_token), token)
end),
test('cwd as base directory', function ()
assert.are_equal(system.with_tmpdir('.', 'foo', write_read_token), token)
end),
},
group 'with_wd' {
test('can change to test directory', function ()
system.with_wd('test', function ()
local cwd = system.getwd()
assert.is_truthy(cwd:match 'test$')
end)
end),
test('returns to old directory once done', function ()
local cwd = system.getwd()
system.with_wd('test', function () end)
assert.are_equal(system.getwd(), cwd)
end),
test('working directory is passed to callback', function ()
system.with_wd('test', function (path)
assert.is_truthy(system.getwd():match (path .. '$'))
end)
end),
test('all callback results are returned', function ()
local a, b, c = system.with_wd('test', function (path)
return 'a', 'b', 'c'
end)
assert.are_same({a, b, c}, {'a', 'b', 'c'})
end),
},
}
|
if not globals then globals = {} end
function globals.init()
global = global or {}
global["preset-data"] = global["preset-data"] or {}
global["preset-names"] = global["preset-names"] or {}
global["presets-selected"] = global["presets-selected"] or {}
global["inventories-open"] = global["inventories-open"] or {}
global.on_tick = global.on_tick or false
end
function globals.init_player(player)
local index = player.index
global["preset-data"][index] = global["preset-data"][index] or {}
global["preset-names"][index] = global["preset-names"][index] or {}
global["presets-selected"][index] = global["presets-selected"][index] or 0
end
|
function hello()
return "hello world"
end
|
object_static_particle_pt_water_drop_base = object_static_particle_shared_pt_water_drop_base:new {
}
ObjectTemplates:addTemplate(object_static_particle_pt_water_drop_base, "object/static/particle/pt_water_drop_base.iff")
|
-- * Metronome IM *
--
-- This file is part of the Metronome XMPP server and is released under the
-- ISC License, please see the LICENSE file in this source package for more
-- information about copyright and licensing.
--
-- As per the sublicensing clause, this file is also MIT/X11 Licensed.
-- ** Copyright (c) 2009-2013, Kim Alvefur, Matthew Wild, Tobias Markmann, Waqas Hussain
local st = require "util.stanza";
local zlib = require "zlib";
local add_task = require "util.timer".add_task;
local pcall = pcall;
local tostring = tostring;
local xmlns_compression_feature = "http://jabber.org/features/compress";
local xmlns_compression_protocol = "http://jabber.org/protocol/compress";
local xmlns_stream = "http://etherx.jabber.org/streams";
local compression_stream_feature = st.stanza("compression", {xmlns = xmlns_compression_feature}):tag("method"):text("zlib"):up();
local add_filter = require "util.filters".add_filter;
local compression_level = module:get_option_number("compression_level", 7);
local size_limit = module:get_option_number("compressed_data_max_size", 131072);
local host_session = hosts[module.host];
if not compression_level or compression_level < 1 or compression_level > 9 then
module:log("warn", "Invalid compression level in config: %s", tostring(compression_level));
module:log("warn", "Module loading aborted. Compression won't be available");
return;
end
module:hook("stream-features", function(event)
local origin, features = event.origin, event.features;
if not origin.compressed and origin.type == "c2s" then
features:add_child(compression_stream_feature);
end
end, 97);
module:hook("s2s-stream-features", function(event)
local origin, features = event.origin, event.features;
if not origin.compressed and (host_session.dialback_capable or session.type == "s2sin") then
features:add_child(compression_stream_feature);
end
end, 97);
-- Hook to activate compression if remote server supports it.
module:hook_stanza(xmlns_stream, "features", function(session, stanza)
if not session.compressed and not session.compressing and
(session.type == "s2sout_unauthed" or session.type == "s2sout") then
local comp_st = stanza:child_with_name("compression");
if comp_st then
for a in comp_st:children() do
local algorithm = a[1]
if algorithm == "zlib" then
session.log("debug", "Preparing to enable compression...");
session.compressing = true;
return;
end
end
session.log("debug", "Remote server supports no compression algorithm we support");
end
end
end, 250);
module:hook("s2sout-established", function(event)
local session = event.session;
if session.compressing then
add_task(3, function()
if not session.destroyed then
session.compressing = nil;
(session.sends2s or session.send)(
st.stanza("compress", {xmlns = xmlns_compression_protocol}):tag("method"):text("zlib")
);
end
end);
end
end);
-- returns either nil or a fully functional ready to use inflate stream
local function get_deflate_stream(session)
local status, deflate_stream = pcall(zlib.deflate, compression_level);
if status == false then
local error_st = st.stanza("failure", {xmlns = xmlns_compression_protocol}):tag("setup-failed");
(session.sends2s or session.send)(error_st);
session.log("error", "Failed to create zlib.deflate filter");
module:log("error", "%s", tostring(deflate_stream));
return;
end
return deflate_stream;
end
-- returns either nil or a fully functional ready to use inflate stream
local function get_inflate_stream(session)
local status, inflate_stream = pcall(zlib.inflate);
if status == false then
local error_st = st.stanza("failure", {xmlns = xmlns_compression_protocol}):tag("setup-failed");
(session.sends2s or session.send)(error_st);
session.log("error", "Failed to create zlib.inflate filter");
module:log("error", "%s", tostring(inflate_stream));
return;
end
return inflate_stream;
end
-- setup compression for a stream
local function setup_compression(session, deflate_stream)
add_filter(session, "bytes/out", function(t)
local status, compressed, eof = pcall(deflate_stream, tostring(t), "sync");
if status == false then
module:log("warn", "Decompressed data processing failed: %s", tostring(compressed));
session:close({
condition = "undefined-condition";
text = compressed;
extra = st.stanza("failure", {xmlns = "http://jabber.org/protocol/compress"}):tag("processing-failed");
});
return;
end
return compressed;
end);
end
-- setup decompression for a stream
local function setup_decompression(session, inflate_stream)
add_filter(session, "bytes/in", function(data)
local status, decompressed, eof;
if data and #data > size_limit then
status, decompressed = false, "Received compressed data exceeded the max allowed size!";
else
status, decompressed, eof = pcall(inflate_stream, data);
end
if status == false then
module:log("warn", "Compressed data processing failed: %s", tostring(decompressed));
session:close({
condition = "undefined-condition";
text = decompressed;
extra = st.stanza("failure", {xmlns = "http://jabber.org/protocol/compress"}):tag("processing-failed");
});
return;
end
return decompressed;
end);
end
module:hook("stanza/http://jabber.org/protocol/compress:compressed", function(event)
local session = event.origin;
if session.type == "s2sout" then
session.log("debug", "Activating compression...")
local deflate_stream = get_deflate_stream(session);
if not deflate_stream then return true; end
local inflate_stream = get_inflate_stream(session);
if not inflate_stream then return true; end
setup_compression(session, deflate_stream);
setup_decompression(session, inflate_stream);
session:reset_stream();
session:open_stream();
session.compressed = true;
module:fire_event("s2sout-compressed", session);
return true;
end
end);
module:hook("stanza/http://jabber.org/protocol/compress:compress", function(event)
local session, stanza = event.origin, event.stanza;
if session.type == "c2s" or session.type == "s2sin" then
if session.compressed then
local error_st = st.stanza("failure", {xmlns = xmlns_compression_protocol}):tag("setup-failed");
(session.sends2s or session.send)(error_st);
session.log("debug", "Client tried to establish another compression layer");
return true;
end
local method = stanza:child_with_name("method");
method = method and (method[1] or "");
if method == "zlib" then
session.log("debug", "zlib compression enabled");
-- create deflate and inflate streams
local deflate_stream = get_deflate_stream(session);
if not deflate_stream then return true; end
local inflate_stream = get_inflate_stream(session);
if not inflate_stream then return true; end
(session.sends2s or session.send)(st.stanza("compressed", {xmlns = xmlns_compression_protocol}));
setup_compression(session, deflate_stream);
setup_decompression(session, inflate_stream);
session:reset_stream();
session.compressed = true;
module:fire_event(session.type .. "-compressed", session);
elseif method then
session.log("debug", "%s compression selected, but we don't support it", tostring(method));
local error_st = st.stanza("failure", {xmlns = xmlns_compression_protocol}):tag("unsupported-method");
(session.sends2s or session.send)(error_st);
else
(session.sends2s or session.send)(st.stanza("failure", {xmlns = xmlns_compression_protocol}):tag("setup-failed"));
end
return true;
else
return (session.sends2s or session.send)(
st.stanza("failure", { xmlns = xmlns_compression_protocol })
:tag("error", { type = "auth" })
:tag("not-authorized", { xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas" }):up()
:tag("text", { xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas" }):text(
"Authentication is required, before compressing a stream"
):up():up()
);
end
end);
module:hook("stanza/http://jabber.org/protocol/compress:failure", function(event)
local session, stanza = event.origin, event.stanza;
session.log("warn", "Remote entity refused to enable compression, failure stanza dump: %s", tostring(stanza));
return true;
end);
|
-----------------------------------
-- Area: Gustav tunnel (212)
-- NPC: qm1 (???)
-- Quests: Cloak and Dagger (Evisceration WSNM "Baronial Bat")
-- !pos 52.8, -1, 19.9 212
-----------------------------------
require("scripts/globals/wsquest")
local ID = require("scripts/zones/Gustav_Tunnel/IDs")
function onTrigger(player,npc)
tpz.wsquest.handleQmTrigger(tpz.wsquest.evisceration,player,ID.mob.BARONIAL_BAT)
end
|
object_mobile_col_forage_hungry_worm = object_mobile_shared_col_forage_hungry_worm:new {
}
ObjectTemplates:addTemplate(object_mobile_col_forage_hungry_worm, "object/mobile/col_forage_hungry_worm.iff")
|
--Returns a sine wave based on game time. Mod will modify the period of the wave and abs is wether or not you want
-- the abs value of the wave
function GetSineVal(mod, abs, inst)
local time = (inst and inst:GetTimeAlive() or GetTime()) * (mod or 1)
local val = math.sin(PI * time)
if abs then
return math.abs(val)
else
return val
end
end
--Lerp a number from a to b over t
function Lerp(a,b,t)
return a + (b - a) * t
end
--Remap a value (i) from one range (a - b) to another (x - y)
function Remap(i, a, b, x, y)
return (((i - a)/(b - a)) * (y - x)) + x
end
--Round a number to idp decimal points. Rounds up.
function RoundUp(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
function RoundDown(num, idp)
local mult = 10^(idp or 0)
return math.ceil(num * mult - 0.5) / mult
end
--Rounds numToRound to the nearest multiple of "mutliple"
function RoundToNearest(numToRound, multiple)
local half = multiple/2
return numToRound+half - (numToRound+half) % multiple
end
--Clamps a number between two values
function math.clamp(num, min, max)
num = math.min(num, max)
num = math.max(num, min)
return num
end
function IsNumberEven(num)
return (num % 2) == 0
end
|
--[=[
multi-sync-config.lua v3.2 2021-01-03
Each rule must define:
src - a directory or a file
dest - a directory
And optionally:
name - rule name, does not need to be unique
expression - evaluated as a boolean, so anything other than false and nil is true. If false, the rule will be skipped
syncCmd
listCmd
cmdSyntax
In expression, src and dest, {computername} and {username} will be replaced with the actual computername and username
and ~ will be replaced with the value of $HOME
For rsync to work as expected, all directories should include trailing /
]=]
textEditor = "editor"
-- Defaults, if these are not specified here, must be specified for every rule
syncCmd = [[sudo rsync -qa --delete-before --exclude lost+found --exclude '.Trash-*']]
listCmd = [[rsync -nva --delete-before --exclude lost+found --exclude '.Trash-*']]
cmdSyntax = [[cmd.." "..src.." "..dest]]
rules = {
{
name = "home",
src = "/home/",
dest = "/media/{username}/backup/{computername}/home/"
}
}
post = [[
if isDir('/media/{username}/backup/{computername}/home/{username}/.config/') then
copyFile(dbFile, '/media/{username}/backup/{computername}/home/{username}/.config/')
end
]]
|
local CoreGui = game:GetService("CoreGui")
local CorePackages = game:GetService("CorePackages")
local AppTempCommon = CorePackages.AppTempCommon
local Modules = CoreGui.RobloxGui.Modules
local ShareGame = Modules.Settings.Pages.ShareGame
local Immutable = require(AppTempCommon.Common.Immutable)
local SetSearchAreaActive = require(ShareGame.Actions.SetSearchAreaActive)
local SetSearchText = require(ShareGame.Actions.SetSearchText)
return function(state, action)
state = state or {
SearchAreaActive = false,
SearchText = "",
}
if action.type == SetSearchAreaActive.name then
state = Immutable.Set(state, "SearchAreaActive", action.isActive)
elseif action.type == SetSearchText.name then
state = Immutable.Set(state, "SearchText", action.searchText)
end
return state
end
|
local ruleHelp = {}
local R = {}
local ruleMake = {}
function ruleHelp:setR(r)
R=r
end
--根据散牌整理出规则牌
function ruleHelp:tidyHandCards(handcards)
table.sort(handcards,function(v1,v2)
return v1:values() < v2:values()
end)
local ruleCards = {}
ruleCards[R.rule.Ti_zimo] = {}--提
ruleCards[R.rule.Kan] = {}--坎
ruleCards[R.rule.None] = {}
--1,4,5,9,9,9,10
local i = 1
local handCnt = #handcards
while(i <= (handCnt-3) )
do
local ok = true
local card = handcards[i]
local kanIndex = 0
for j=1, 3 do
if handcards[i+j].value ~= card.value or handcards[i+j].capital ~= card.capital then
ok = false
break
end
if j == 2 then
kanIndex = i+j
end
end
if ok then
table.insert(ruleCards[R.rule.Ti_zimo], {handcards[i].id, handcards[i+1].id, handcards[i+2].id, handcards[i+3].id})
i = i + 3
elseif kanIndex ~= 0 then
table.insert(ruleCards[R.rule.Kan], {handcards[kanIndex-2].id, handcards[kanIndex-1].id, handcards[kanIndex-0].id})
i = i + 2
else
i = i + 1
end
end
if handcards[handCnt-2]:equal(handcards[handCnt-1]) and handcards[handCnt-1]:equal(handcards[handCnt-0]) then
table.insert(ruleCards[R.rule.Kan], {handcards[handCnt-2].id, handcards[handCnt-1].id, handcards[handCnt-0].id})
end
local tmpCards = {}
for i=1, handCnt do
local r = false
for k,v in pairs(ruleCards[R.rule.Ti_zimo]) do
for kk,vv in pairs(v) do
if handcards[i].id == vv then
r = true
break
end
end
if r then
break
end
end
if not r then
for k,v in pairs(ruleCards[R.rule.Kan]) do
for kk,vv in pairs(v) do
if handcards[i].id == vv then
r = true
break
end
end
if r then
break
end
end
end
if not r then
ruleCards[R.rule.None][#ruleCards[R.rule.None]+1] = handcards[i].id
end
end
return ruleCards
end
function ruleMake:findChi(ids, cards, card)
local tmpCards = {}
local valueList = {}
local res = {}
local keyId = card
local ccnt = #cards
if keyId then ccnt=ccnt+1 end
if ccnt < 3 then
return res
end
for k,v in pairs(cards) do
if not tmpCards[ids[v].value] then tmpCards[ids[v].value] = {} valueList[#valueList+1]=ids[v].value end
table.insert(tmpCards[ids[v].value], ids[v])
end
if keyId then
if not tmpCards[ids[keyId].value] then tmpCards[ids[keyId].value] = {} valueList[#valueList+1]=ids[keyId].value end
table.insert(tmpCards[ids[keyId].value], ids[keyId])
end
table.sort(valueList, function(a,b)return a<b end)
for i=1,#valueList do
local clist = tmpCards[valueList[i]]
if #clist >= 3 then
for j=1, #clist-2 do
for k=j+1, #clist-1 do
for n=k+1, #clist do
if clist[j].capital ~= clist[k].capital or clist[j].capital ~= clist[n].capital then
table.insert(res, {clist[j].id, clist[k].id, clist[n].id})
end
end
end
end
end
local a = tmpCards[valueList[i]+0]
local b = tmpCards[valueList[i]+1]
local c = tmpCards[valueList[i]+2]
local fcap = nil
if b and c then
for k,v in pairs(a) do
fcap = v.capital
local bcard = nil
for bk,bv in pairs(b) do
if fcap == bv.capital then
bcard = bv
for ck,cv in pairs(c) do
if fcap == cv.capital then
ccard = cv
table.insert(res, {v.id, bcard.id, ccard.id})
end
end
end
end
end
end
end
if tmpCards[R.value.v2] and tmpCards[R.value.v7] and tmpCards[R.value.v10] then
for k,v in pairs(tmpCards[R.value.v2]) do
local cap = v.capital
local bcard = nil
for k7,v7 in pairs(tmpCards[R.value.v7]) do
if v7.capital == cap then
bcard = v7
break
end
end
local ccard = nil
for k10,v10 in pairs(tmpCards[R.value.v10]) do
if v10.capital == cap then
ccard = v10
break
end
end
if bcard and ccard then
table.insert(res, {v.id, bcard.id, ccard.id})
end
end
end
--移除跟key不相关的
local pos = 0
while keyId and true do
pos = pos + 1
if pos > #res then
break
end
if res[pos][1] ~= keyId and res[pos][2] ~= keyId and res[pos][3] ~= keyId then
table.remove(res, pos)
pos = 0
end
end
--移除重复的组合
table.sort(res, function(a,b) return ids[a[1]].value < ids[b[1]].value end)
pos = 0
while true do
pos = pos + 1
if pos > #res-1 then break end
if ids[res[pos][1]]:equal(ids[res[pos+1][1]]) and
ids[res[pos][2]]:equal(ids[res[pos+1][2]]) and
ids[res[pos][3]]:equal(ids[res[pos+1][3]]) then
table.remove(res, pos)
pos = 0
end
end
return res
end
function ruleMake:Chi(ids, cards, card)
local resrule = {}
local keyCardCnt = 1
for k,v in pairs(cards) do
if ids[v]:equal(ids[card]) then
keyCardCnt = keyCardCnt+1
end
end
local rulelist = ruleMake:findChi(ids, cards, card)
for k,v in pairs(rulelist) do
local rulekeyCnt = 0
for kk,vv in pairs(v) do
if ids[vv]:equal(ids[card]) then rulekeyCnt = rulekeyCnt+1 end
end
if rulekeyCnt == keyCardCnt then resrule[#resrule+1]={v[1],v[2],v[3]} end
end
if keyCardCnt == 1 then
return resrule
elseif keyCardCnt == 3 then
resrule = {}
for k,v in pairs(rulelist) do
local subcards = {}
for i=1,#cards do subcards[#subcards+1]=cards[i] end
for kk,vv in pairs(v) do
for i=1,#subcards do if subcards[i] == vv then table.remove(subcards,i) break end end
end
local ecard = 0
for i=1,#subcards do if ids[subcards[i]]:equal(ids[card]) then ecard = subcards[i] table.remove(subcards,i) break end end
local subres = ruleMake:Chi(ids, subcards, ecard)
for kk,vv in pairs(subres) do
if #vv == 6 then
resrule[#resrule+1] = {v[1],v[2],v[3],vv[1],vv[2],vv[3],vv[4],vv[5],vv[6]}
return resrule
end
end
end
return resrule
else
local frule = ruleMake:findChi(ids, cards)
for k,v in pairs(frule) do
for ck,cv in pairs(v) do
if ids[cv]:equal(ids[card]) then
local filterCards = {}
for csk,csv in pairs(cards) do
if csv ~= v[1] and csv ~= v[2] and csv ~= v[3] then
table.insert(filterCards, csv)
end
end
local subrule = ruleMake:findChi(ids, filterCards, card)
if #subrule > 0 then
resrule[#resrule+1] = {v[1], v[2], v[3], subrule[1][1], subrule[1][2], subrule[1][3]}
end
break
end
end
end
local i = #resrule
--[[
while true do
if i < 1 then break end
if #resrule[i] ~= keyCardCnt*3 then
table.remove(resrule, i)
i = #resrule
else
i=i-1
end
end
]]--
i = 1
local j = i+1
while true do
if j > #resrule then
i=i+1
j=i+1
end
if #resrule < 2 or i >= #resrule then break end
local ca = 0
local cb = 0
for k,v in pairs(resrule[j]) do ca = ca + ids[v]:values() end
for k,v in pairs(resrule[i]) do cb = cb + ids[v]:values() end
if ca ~= 0 and ca == cb then
table.remove(resrule, j)
j=i+1
else
j=j+1
end
end
return resrule
end
end
function ruleMake:Peng(ids, cards, card)
local tmpCards = {}
local res = {}
local keyId = card
for k,v in pairs(cards) do table.insert(tmpCards, ids[v]) end
table.insert(tmpCards, ids[keyId])
table.sort(tmpCards,function(v1,v2)
return v1:values() < v2:values()
end)
local pos = 1
while pos <= (#tmpCards-2) do
if tmpCards[pos].value == tmpCards[pos+1].value and tmpCards[pos].value == tmpCards[pos+2].value then
if tmpCards[pos].capital == tmpCards[pos+1].capital and tmpCards[pos].capital == tmpCards[pos+2].capital then
table.insert(res, {tmpCards[pos].id, tmpCards[pos+1].id, tmpCards[pos+2].id})
end
end
pos = pos + 1
end
pos = 0
while true do
pos = pos + 1
if pos > #res then
break
end
if res[pos][1] ~= keyId and res[pos][2] ~= keyId and res[pos][3] ~= keyId then
table.remove(res, pos)
pos = 0
end
end
return res
end
function ruleMake:TiPao(ids, cards, card)
local res = {}
for k,v in pairs(cards) do
if ids[v[1]]:equal(ids[card]) and ids[v[2]]:equal(ids[card]) and ids[v[3]]:equal(ids[card]) then
table.insert(res, {v[1], v[2], v[3], card})
end
end
return res
end
function ruleHelp:getHupaiType(cardMgr, ids, isZhuang, addCards)
local res = {}
local handcards = {}
for k,v in pairs(cardMgr.handed[R.rule.None]) do
table.insert(handcards, ids[v])
end
if addCards then
for k,v in pairs(addCards) do
table.insert(handcards, ids[v])
end
end
table.sort(handcards, function (v1,v2) return v1:values() < v2:values() end)
local cardthree = 0
for k,v in pairs(cardMgr.history) do
if v.payrule == R.rule.Kan or v.payrule == R.rule.Wei or v.payrule == R.rule.Wei_chou or v.payrule == R.rule.Peng or v.payrule == R.rule.Ti or v.payrule == R.rule.Ti_zimo then
cardthree = cardthree + 1
end
end
--[[
print("cardthree", cardMgr.wufuBaojingIndex, cardthree)
local desc = ""
for k,v in pairs(handcards) do
desc = desc .. (v.capital and "B" or "S") .. v.value .. ","
end
print(desc)
]]--
--五福
if cardMgr.wufuBaojingIndex and cardthree == 5 then
return R.wintype.wufu
end
--五福跑双
--if cardMgr.wufuBaojingIndex and cardthree == 4 and ruleHelp:noneSingle(handcards) then
-- return R.wintype.paoshuang
--end
if not cardMgr.wufuBaojingIndex and cardthree == 4 and ruleHelp:noneSingle(handcards) then
return R.wintype.siqinglianhu
end
--平胡
if not cardMgr.wufuBaojingIndex and ruleHelp:noneSingle(handcards) then
if cardthree == 3 then
return R.wintype.sandalianhu
else
return R.wintype.pinghu
end
end
return R.wintype.none
end
function ruleHelp:getBestHupaiType(handcards, TizimoCnt)
--qidui
if #handcards >= 14 then
local cardtwo = 0
local noneCards = {}
for k,v in pairs(handcards) do
local values = v:values()
if not noneCards[values] then noneCards[values] = {} end
table.insert(noneCards[values],v)
end
for k,v in pairs(noneCards) do if #v >= 2 then cardtwo=cardtwo+1 end end
if cardtwo >= 7 then
return R.wintype.qidui
end
end
--tianhu
if ruleHelp:noneSingle(handcards) then
return R.wintype.tianhu
end
--shuanglong
if TizimoCnt == 2 then
return R.wintype.shuanglong
end
return R.wintype.none
end
function ruleHelp:noneSingle(cards, haveYidui)
table.sort(cards, function(a,b) return a.value<b.value end)
local cardcnt = #cards
if cardcnt == 0 then return true end
if cardcnt == 1 then return false end
local remains = {}
local idx=1
local acard = cards[idx]
local bcard = {value=acard.value+1, capital=acard.capital, id=0}
local ccard = {value=acard.value+2, capital=acard.capital, id=0}
idx=2
while( idx <= cardcnt ) do--顺序吃,组合成员固定
if bcard.id == 0 then
if cards[idx].value == bcard.value and cards[idx].capital == bcard.capital then
bcard.id = cards[idx].id
else
remains[#remains+1]=cards[idx]
end
elseif ccard.id == 0 then
if cards[idx].value == ccard.value and cards[idx].capital == ccard.capital then
ccard.id = cards[idx].id
break
else
remains[#remains+1]=cards[idx]
end
end
idx=idx+1
end
if bcard.id > 0 and ccard.id > 0 then
for i=idx+1,cardcnt do remains[#remains+1]=cards[i] end
if ruleHelp:noneSingle(remains, haveYidui) then return true end
end
local keyvalue = R.value.v2
if acard.value == R.value.v2 then--2710,组合成员固定
idx=2
local keycapital = acard.capital
keyvalue = R.value.v7
remains = {}
while( idx <= cardcnt ) do
if keycapital == cards[idx].capital and keyvalue == cards[idx].value then
if keyvalue == R.value.v7 then
keyvalue = R.value.v10
elseif keyvalue == R.value.v10 then
keyvalue = nil
break
end
else
remains[#remains+1]=cards[idx]
end
idx=idx+1
end
end
if not keyvalue then
for i=idx+1,cardcnt do remains[#remains+1]=cards[i] end
if ruleHelp:noneSingle(remains, haveYidui) then return true end
end
acard = cards[1]
idx=2
local vlist = {}
remains = {}
while( idx <= cardcnt and cards[idx].value == acard.value ) do--大小三搭,组合成员bu固定,例如d1d1s1,d1s1s1,碰也可以一起检测
vlist[#vlist+1] = cards[idx]
idx = idx + 1
end
for i=idx,cardcnt do remains[#remains+1]=cards[i] end
for i=1, #vlist do
for j=i+1, #vlist do
local checklist={}
for k=1, #vlist do
if k ~= i and k ~= j then
remains[#remains+1]=cards[k]
checklist[#checklist+1]=cards[k]
end
end
if ruleHelp:noneSingle(remains, haveYidui) then
return true
else
for is=1,#checklist do
for js=1,#remains do
if checklist[is].id == remains[js].id then
table.remove(remains, js)
break
end
end
end
end
end
end
if cards[1].value == cards[2].value and cards[1].capital == cards[2].capital then--唯一一对
remains = {}
for i=3,cardcnt do remains[#remains+1]=cards[i] end
if not haveYidui then
haveYidui = true
if ruleHelp:noneSingle(remains, haveYidui) then return true end
end
end
end
--[[
function ruleHelp:testHupai(handed, ids, payCard)
local headCards = {}
for k,v in pairs(handed) do
table.insert(headCards, ids[v])
end
if payCard then table.insert(headCards, ids[payCard]) end
table.sort(headCards, function (v1, v2)
return v1:values() < v2:values()
end)
return ruleHelp:noneSingle(headCards)
end
--]]
--增加一张addcard牌,放到cards里面,能否产出rule的规则牌
function ruleHelp:makeRulesCard(rule, ids, cards, addcard)
if R.rule.Chi == rule then
return ruleMake:Chi(ids, cards, addcard)
elseif R.rule.Peng == rule then
return ruleMake:Peng(ids, cards, addcard)
elseif R.rule.Wei == rule then
return ruleMake:Peng(ids, cards, addcard)
elseif R.rule.Ti == rule or R.rule.Pao == rule then
return ruleMake:TiPao(ids, cards, addcard)
--elseif R.rule.Hupai == rule then
--return ruleMake:Hupai(ids, cardMgr, addcard)
end
return {}
end
function ruleMake:Chi_test(ids, cards)
local res = ruleMake:findChi(ids, cards)
return #res > 0
end
function ruleMake:Peng_test(ids, cards)
local tmpCards = {}
if #cards ~= 3 then
return false
end
for k,v in pairs(cards) do table.insert(tmpCards, ids[v]) end
table.sort(tmpCards,function(v1,v2)
return v1:values() < v2:values()
end)
if tmpCards[1].value == tmpCards[2].value and tmpCards[1].value == tmpCards[3].value then
if tmpCards[1].capital == tmpCards[2].capital and tmpCards[1].capital == tmpCards[3].capital then
return true
end
end
end
function ruleMake:TiPao_test(ids, cards)
local tmpCards = {}
local res = {}
for k,v in pairs(cards) do table.insert(tmpCards, ids[v]) end
table.sort(tmpCards,function(v1,v2)
return v1:values() < v2:values()
end)
if #cards == 4 then
if tmpCards[1].value == tmpCards[2].value and tmpCards[1].value == tmpCards[3].value and tmpCards[1].value == tmpCards[4].value then
if tmpCards[1].capital == tmpCards[2].capital and tmpCards[1].capital == tmpCards[3].capital and tmpCards[1].capital == tmpCards[4].capital then
return true
end
end
end
end
function ruleHelp:testRulesCard(rule, ids, cards)
if R.rule.Chi == rule then
return ruleMake:Chi_test(ids, cards)
elseif R.rule.Peng == rule or R.rule.Wei == rule or R.rule.Kan == rule then
return ruleMake:Peng_test(ids, cards)
elseif R.rule.Ti == rule or R.rule.Pao == rule then
return ruleMake:TiPao_test(ids, cards, card)
end
end
function ruleHelp:isForceRule1(rule)
return rule == R.rule.Ti or
rule == R.rule.Ti_zimo or
rule == R.rule.Ti_kan or
rule == R.rule.Ti_wei or
rule == R.rule.Kan or
rule == R.rule.Wei or
rule == R.rule.Wei_chou
end
function ruleHelp:isForceRule2(rule)
return rule == R.rule.Pao or
rule == R.rule.Pao_kan or
rule == R.rule.Pao_wei or
rule == R.rule.Pao_peng
end
function ruleHelp:compareRuleLevel(r1, r2)
return tonumber(r1) > tonumber(r2)
end
--是否需要显示系统发的牌
function ruleHelp:hideSystemCard(rule)
return rule == R.rule.Ti_zimo or
rule == R.rule.Wei or
rule == R.rule.Wei_chou
end
function ruleHelp:checkWufuBaojing(history, hands, ids)
local threeCnt = 0
for k,v in pairs(history) do
if v.payrule == R.rule.Ti_zimo or v.payrule == R.rule.Kan or v.payrule == R.rule.Wei or v.payrule == R.rule.Wei_chou or v.payrule == R.rule.Peng then
threeCnt = threeCnt + 1
end
end
local twoIndex = nil
local tmpcards = {}
for i=1, #hands do
if not tmpcards[ids[hands[i]]:values()] then tmpcards[ids[hands[i]]:values()] = 0 end
tmpcards[ids[hands[i]]:values()] = tmpcards[ids[hands[i]]:values()] + 1
if tmpcards[ids[hands[i]]:values()] > 1 then
twoIndex = true
break
end
end
return threeCnt == 4 and twoIndex
end
return ruleHelp
|
local msg = require('mp.msg')
local log = {
debug = function(format, ...)
return msg.debug(format:format(...))
end,
info = function(format, ...)
return msg.info(format:format(...))
end,
warn = function(format, ...)
return msg.warn(format:format(...))
end,
dump = function(item, ignore)
local level = 2
if "table" ~= type(item) then
msg.info(tostring(item))
return
end
local count = 1
local tablecount = 1
local result = {
"{ @" .. tostring(tablecount)
}
local seen = {
[item] = tablecount
}
local recurse
recurse = function(item, space)
for key, value in pairs(item) do
if not (key == ignore) then
if "table" == type(value) then
if not (seen[value]) then
tablecount = tablecount + 1
seen[value] = tablecount
count = count + 1
result[count] = space .. tostring(key) .. ": { @" .. tostring(tablecount)
recurse(value, space .. " ")
count = count + 1
result[count] = space .. "}"
else
count = count + 1
result[count] = space .. tostring(key) .. ": @" .. tostring(seen[value])
end
else
if "string" == type(value) then
value = ("%q"):format(value)
end
count = count + 1
result[count] = space .. tostring(key) .. ": " .. tostring(value)
end
end
end
end
recurse(item, " ")
count = count + 1
result[count] = "}"
return msg.info(table.concat(result, "\n"))
end
}
local options = require('mp.options')
local utils = require('mp.utils')
local script_name = 'torque-progressbar'
mp.get_osd_size = mp.get_osd_size or mp.get_screen_size
local settings = {
__defaults = { }
}
local settingsMeta = {
__reload = function(self)
for key, value in pairs(self.__defaults) do
settings[key] = value
end
options.read_options(self, script_name .. '/main')
if self['bar-height-inactive'] <= 0 then
self['bar-hide-inactive'] = true
self['bar-height-inactive'] = 1
end
end,
__migrate = function(self)
local oldConfig = mp.find_config_file(('lua-settings/%s.conf'):format(script_name))
local newConfigFile = ('lua-settings/%s/main.conf'):format(script_name)
local newConfig = mp.find_config_file(newConfigFile)
if oldConfig and not newConfig then
local folder, _ = utils.split_path(oldConfig)
local configDir = utils.join_path(folder, script_name)
newConfig = utils.join_path(configDir, 'main.conf')
log.info(('Old configuration detected. Attempting to migrate %q -> %q'):format(oldConfig, newConfig))
local dirExists = mp.find_config_file(configDir)
if dirExists and not utils.readdir(configDir) then
log.warn(('Configuration migration failed. %q exists and does not appear to be a folder'):format(configDir))
return
else
if not dirExists then
local res = utils.subprocess({
args = {
'mkdir',
configDir
}
})
if res.error or res.status ~= 0 then
log.warn(('Making directory %q failed.'):format(configDir))
return
end
end
end
local res = utils.subprocess({
args = {
'mv',
oldConfig,
newConfig
}
})
if res.error or res.status ~= 0 then
log.warn(('Moving file %q -> %q failed.'):format(oldConfig, newConfig))
return
end
if mp.find_config_file(newConfigFile) then
return log.info('Configuration successfully migrated.')
end
end
end,
__newindex = function(self, key, value)
self.__defaults[key] = value
return rawset(self, key, value)
end
}
settingsMeta.__index = settingsMeta
setmetatable(settings, settingsMeta)
settings:__migrate()
local helpText = { }
settings['hover-zone-height'] = 40
helpText['hover-zone-height'] = [[Sets the height of the rectangular area at the bottom of the screen that expands
the progress bar and shows playback time information when the mouse is hovered
over it.
]]
settings['top-hover-zone-height'] = 40
helpText['top-hover-zone-height'] = [[Sets the height of the rectangular area at the top of the screen that shows the
file name and system time when the mouse is hovered over it.
]]
settings['display-scale-factor'] = 1
helpText['display-scale-factor'] = [[Acts as a multiplier to increase the size of every UI element. Useful for high-
DPI displays that cause the UI to be rendered too small (happens at least on
macOS).
]]
settings['default-style'] = [[\fnSource Sans Pro\b1\bord2\shad0\fs30\c&HFC799E&\3c&H2D2D2D&]]
helpText['default-style'] = [[Default style that is applied to all UI elements. A string of ASS override tags.
Individual elements have their own style settings which override the tags here.
Changing the font will likely require changing the hover-time margin settings
and the offscreen-pos settings.
Here are some useful ASS override tags (omit square brackets):
\fn[Font Name]: sets the font to the named font.
\fs[number]: sets the font size to the given number.
\b[1/0]: sets the text bold or not (\b1 is bold, \b0 is regular weight).
\i[1/0]: sets the text italic or not (same semantics as bold).
\bord[number]: sets the outline width to the given number (in pixels).
\shad[number]: sets the shadow size to the given number (pixels).
\c&H[BBGGRR]&: sets the fill color for the text to the given color (hex pairs in
the order, blue, green, red).
\3c&H[BBGGRR]&: sets the outline color of the text to the given color.
\4c&H[BBGGRR]&: sets the shadow color of the text to the given color.
\alpha&H[AA]&: sets the line's transparency as a hex pair. 00 is fully opaque
and FF is fully transparent. Some UI elements are composed of
multiple layered lines, so adding transparency may not look good.
For further granularity, \1a&H[AA]& controls the fill opacity,
\3a&H[AA]& controls the outline opacity, and \4a&H[AA]& controls
the shadow opacity.
]]
settings['enable-bar'] = true
helpText['enable-bar'] = [[Controls whether or not the progress bar is drawn at all. If this is disabled,
it also (naturally) disables the click-to-seek functionality.
]]
settings['bar-hide-inactive'] = false
helpText['bar-hide-inactive'] = [[Causes the bar to not be drawn unless the mouse is hovering over it or a
request-display call is active. This is somewhat redundant with setting bar-
height-inactive=0, except that it can allow for very rudimentary context-
sensitive behavior because it can be toggled at runtime. For example, by using
the binding `f cycle pause; script-binding progressbar/toggle-inactive-bar`, it
is possible to have the bar be persistently present only in windowed or
fullscreen contexts, depending on the default setting.
]]
settings['bar-height-inactive'] = 2
helpText['bar-height-inactive'] = [[Sets the height of the bar display when the mouse is not in the active zone and
there is no request-display active. A value of 0 or less will cause bar-hide-
inactive to be set to true and the bar height to be set to 1. This should result
in the desired behavior while avoiding annoying debug logging in mpv (libass
does not like zero-height objects).
]]
settings['bar-height-active'] = 8
helpText['bar-height-active'] = [[Sets the height of the bar display when the mouse is in the active zone or
request-display is active. There is no logic attached to this, so 0 or negative
values may have unexpected results.
]]
settings['progress-bar-width'] = 0
helpText['progress-bar-width'] = [[If greater than zero, changes the progress bar style to be a small segment
rather than a continuous bar and sets its width.
]]
settings['seek-precision'] = 'exact'
helpText['seek-precision'] = [[Affects precision of seeks due to clicks on the progress bar. Should be 'exact' or
'keyframes'. Exact is slightly slower, but won't jump around between two
different times when clicking in the same place.
Actually, this gets passed directly into the `seek` command, so the value can be
any of the arguments supported by mpv, though the ones above are the only ones
that really make sense.
]]
settings['bar-default-style'] = [[\bord0\shad0]]
helpText['bar-default-style'] = [[A string of ASS override tags that get applied to all three layers of the bar:
progress, cache, and background. You probably don't want to remove \bord0 unless
your default-style includes it.
]]
settings['bar-foreground-style'] = ''
helpText['bar-foreground-style'] = [[A string of ASS override tags that get applied only to the progress layer of the
bar.
]]
settings['bar-cache-style'] = [[\c&H515151&]]
helpText['bar-cache-style'] = [[A string of ASS override tags that get applied only to the cache layer of the
bar. The default sets only the color.
]]
settings['bar-background-style'] = [[\c&H2D2D2D&]]
helpText['bar-background-style'] = [[A string of ASS override tags that get applied only to the background layer of
the bar. The default sets only the color.
]]
settings['enable-elapsed-time'] = true
helpText['enable-elapsed-time'] = [[Sets whether or not the elapsed time is displayed at all.
]]
settings['elapsed-style'] = ''
helpText['elapsed-style'] = [[A string of ASS override tags that get applied only to the elapsed time display.
]]
settings['elapsed-left-margin'] = 4
helpText['elapsed-left-margin'] = [[Controls how far from the left edge of the window the elapsed time display is
positioned.
]]
settings['elapsed-bottom-margin'] = 0
helpText['elapsed-bottom-margin'] = [[Controls how far above the expanded progress bar the elapsed time display is
positioned.
]]
settings['enable-remaining-time'] = true
helpText['enable-remaining-time'] = [[Sets whether or not the remaining time is displayed at all.
]]
settings['remaining-style'] = ''
helpText['remaining-style'] = [[A string of ASS override tags that get applied only to the remaining time
display.
]]
settings['remaining-right-margin'] = 4
helpText['remaining-right-margin'] = [[Controls how far from the right edge of the window the remaining time display is
positioned.
]]
settings['remaining-bottom-margin'] = 0
helpText['remaining-bottom-margin'] = [[Controls how far above the expanded progress bar the remaining time display is
positioned.
]]
settings['enable-hover-time'] = true
helpText['enable-hover-time'] = [[Sets whether or not the calculated time corresponding to the mouse position
is displayed when the mouse hovers over the progress bar.
]]
settings['hover-time-style'] = [[\fs26]]
helpText['hover-time-style'] = [[A string of ASS override tags that get applied only to the hover time display.
Unfortunately, due to the way the hover time display is animated, alpha values
set here will be overridden. This is subject to change in future versions.
]]
settings['hover-time-left-margin'] = 120
helpText['hover-time-left-margin'] = [[Controls how close to the left edge of the window the hover time display can
get. If this value is too small, it will end up overlapping the elapsed time
display.
]]
settings['hover-time-right-margin'] = 130
helpText['hover-time-right-margin'] = [[Controls how close to the right edge of the window the hover time display can
get. If this value is too small, it will end up overlapping the remaining time
display.
]]
settings['hover-time-bottom-margin'] = 0
helpText['hover-time-bottom-margin'] = [[Controls how far above the expanded progress bar the remaining time display is
positioned.
]]
settings['enable-title'] = true
helpText['enable-title'] = [[Sets whether or not the video title is displayed at all.
]]
settings['title-style'] = ''
helpText['title-style'] = [[A string of ASS override tags that get applied only to the video title display.
]]
settings['title-left-margin'] = 4
helpText['title-left-margin'] = [[Controls how far from the left edge of the window the video title display is
positioned.
]]
settings['title-top-margin'] = 0
helpText['title-top-margin'] = [[Controls how far from the top edge of the window the video title display is
positioned.
]]
settings['title-print-to-cli'] = true
helpText['title-print-to-cli'] = [[Controls whether or not the script logs the video title and playlist position
to the console every time a new video starts.
]]
settings['enable-system-time'] = true
helpText['enable-system-time'] = [[Sets whether or not the system time is displayed at all.
]]
settings['system-time-style'] = ''
helpText['system-time-style'] = [[A string of ASS override tags that get applied only to the system time display.
]]
settings['system-time-format'] = '%H:%M'
helpText['system-time-format'] = [[Sets the format used for the system time display. This must be a strftime-
compatible format string.
]]
settings['system-time-right-margin'] = 4
helpText['system-time-right-margin'] = [[Controls how far from the right edge of the window the system time display is
positioned.
]]
settings['system-time-top-margin'] = 0
helpText['system-time-top-margin'] = [[Controls how far from the top edge of the window the system time display is
positioned.
]]
settings['pause-indicator'] = true
helpText['pause-indicator'] = [[Sets whether or not the pause indicator is displayed. The pause indicator is a
momentary icon that flashes in the middle of the screen, similar to youtube.
]]
settings['pause-indicator-foreground-style'] = [[\c&HFEFEFE&]]
helpText['pause-indicator-foreground-style'] = [[A string of ASS override tags that get applied only to the foreground of the
pause indicator.
]]
settings['pause-indicator-background-style'] = [[\c&H2D2D2D&]]
helpText['pause-indicator-background-style'] = [[A string of ASS override tags that get applied only to the background of the
pause indicator.
]]
settings['enable-chapter-markers'] = true
helpText['enable-chapter-markers'] = [[Sets whether or not the progress bar is decorated with chapter markers. Due to
the way the chapter markers are currently implemented, videos with a large
number of chapters may slow down the script somewhat, but I have yet to run
into this being a problem.
]]
settings['chapter-marker-width'] = 2
helpText['chapter-marker-width'] = [[Controls the width of each chapter marker when the progress bar is inactive.
]]
settings['chapter-marker-width-active'] = 4
helpText['chapter-marker-width-active'] = [[Controls the width of each chapter marker when the progress bar is active.
]]
settings['chapter-marker-active-height-fraction'] = 1
helpText['chapter-marker-active-height-fraction'] = [[Modifies the height of the chapter markers when the progress bar is active. Acts
as a multiplier on the height of the active progress bar. A value greater than 1
will cause the markers to be taller than the expanded progress bar, whereas a
value less than 1 will cause them to be shorter.
]]
settings['chapter-marker-before-style'] = [[\c&HFC799E&]]
helpText['chapter-marker-before-style'] = [[A string of ASS override tags that get applied only to chapter markers that have
not yet been passed.
]]
settings['chapter-marker-after-style'] = [[\c&H2D2D2D&]]
helpText['chapter-marker-after-style'] = [[A string of ASS override tags that get applied only to chapter markers that have
already been passed.
]]
settings['request-display-duration'] = 1
helpText['request-display-duration'] = [[Sets the amount of time in seconds that the UI stays on the screen after it
receives a request-display signal. A value of 0 will keep the display on screen
only as long as the key bound to it is held down.
]]
settings['redraw-period'] = 0.03
helpText['redraw-period'] = [[Controls how often the display is redrawn, in seconds. This does not seem to
significantly affect the smoothness of animations, and it is subject to the
accuracy limits imposed by the scheduler mpv uses. Probably not worth changing
unless you have major performance problems.
]]
settings['animation-duration'] = 0.25
helpText['animation-duration'] = [[Controls how long the UI animations take. A value of 0 disables all animations
(which breaks the pause indicator).
]]
settings['elapsed-offscreen-pos'] = -100
helpText['elapsed-offscreen-pos'] = [[Controls how far off the left side of the window the elapsed time display tries
to move when it is inactive. If you use a non-default font, this value may need
to be tweaked. If this value is not far enough off-screen, the elapsed display
will disappear without animating all the way off-screen. Positive values will
cause the display to animate the wrong direction.
]]
settings['remaining-offscreen-pos'] = -100
helpText['remaining-offscreen-pos'] = [[Controls how far off the left side of the window the remaining time display
tries to move when it is inactive. If you use a non-default font, this value may
need to be tweaked. If this value is not far enough off-screen, the elapsed
display will disappear without animating all the way off-screen. Positive values
will cause the display to animate the wrong direction.
]]
settings['hover-time-offscreen-pos'] = -50
helpText['hover-time-offscreen-pos'] = [[Controls how far off the bottom of the window the mouse hover time display tries
to move when it is inactive. If you use a non-default font, this value may need
to be tweaked. If this value is not far enough off-screen, the elapsed
display will disappear without animating all the way off-screen. Positive values
will cause the display to animate the wrong direction.
]]
settings['system-time-offscreen-pos'] = -100
helpText['system-time-offscreen-pos'] = [[Controls how far off the left side of the window the system time display tries
to move when it is inactive. If you use a non-default font, this value may need
to be tweaked. If this value is not far enough off-screen, the elapsed display
will disappear without animating all the way off-screen. Positive values will
cause the display to animate the wrong direction.
]]
settings['title-offscreen-pos'] = -40
helpText['title-offscreen-pos'] = [[Controls how far off the left side of the window the video title display tries
to move when it is inactive. If you use a non-default font, this value may need
to be tweaked. If this value is not far enough off-screen, the elapsed display
will disappear without animating all the way off-screen. Positive values will
cause the display to animate the wrong direction.
]]
settings:__reload()
local Stack
do
local _class_0
local removeElementMetadata, reindex
local _base_0 = {
insert = function(self, element, index)
if index then
table.insert(self, index, element)
element[self] = index
else
table.insert(self, element)
element[self] = #self
end
if self.containmentKey then
element[self.containmentKey] = true
end
end,
remove = function(self, element)
if element[self] == nil then
error("Trying to remove an element that doesn't exist in this stack.")
end
table.remove(self, element[self])
reindex(self, element[self])
return removeElementMetadata(self, element)
end,
clear = function(self)
local element = table.remove(self)
while element do
removeElementMetadata(self, element)
element = table.remove(self)
end
end,
removeSortedList = function(self, elementList)
if #elementList < 1 then
return
end
for i = 1, #elementList - 1 do
local element = table.remove(elementList)
table.remove(self, element[self])
removeElementMetadata(self, element)
end
local lastElement = table.remove(elementList)
table.remove(self, lastElement[self])
reindex(self, lastElement[self])
return removeElementMetadata(self, lastElement)
end,
removeList = function(self, elementList)
table.sort(elementList, function(a, b)
return a[self] < b[self]
end)
return self:removeSortedList(elementList)
end
}
_base_0.__index = _base_0
_class_0 = setmetatable({
__init = function(self, containmentKey)
self.containmentKey = containmentKey
end,
__base = _base_0,
__name = "Stack"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
local self = _class_0
removeElementMetadata = function(self, element)
element[self] = nil
if self.containmentKey then
element[self.containmentKey] = false
end
end
reindex = function(self, start)
if start == nil then
start = 1
end
for i = start, #self do
(self[i])[self] = i
end
end
Stack = _class_0
end
local Window
do
local _class_0
local osdScale
local _base_0 = { }
_base_0.__index = _base_0
_class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "Window"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
local self = _class_0
osdScale = settings['display-scale-factor']
self.__class.w, self.__class.h = 0, 0
self.update = function(self)
local w, h = mp.get_osd_size()
w, h = math.floor(w / osdScale), math.floor(h / osdScale)
if w ~= self.w or h ~= self.h then
self.w, self.h = w, h
return true
else
return false
end
end
Window = _class_0
end
local Rect
do
local _class_0
local _base_0 = {
cacheMaxBounds = function(self)
self.xMax = self.x + self.w
self.yMax = self.y + self.h
end,
setPosition = function(self, x, y)
self.x = x or self.x
self.y = y or self.y
return self:cacheMaxBounds()
end,
setSize = function(self, w, h)
self.w = w or self.w
self.h = h or self.h
return self:cacheMaxBounds()
end,
reset = function(self, x, y, w, h)
self.x = x or self.x
self.y = y or self.y
self.w = w or self.w
self.h = h or self.h
return self:cacheMaxBounds()
end,
move = function(self, x, y)
self.x = self.x + (x or self.x)
self.y = self.y + (y or self.y)
return self:cacheMaxBounds()
end,
stretch = function(self, w, h)
self.w = self.w + (w or self.w)
self.h = self.h + (h or self.h)
return self:cacheMaxBounds()
end,
containsPoint = function(self, x, y)
return (x >= self.x) and (x < self.xMax) and (y >= self.y) and (y < self.yMax)
end
}
_base_0.__index = _base_0
_class_0 = setmetatable({
__init = function(self, x, y, w, h)
if x == nil then
x = -1
end
if y == nil then
y = -1
end
if w == nil then
w = -1
end
if h == nil then
h = -1
end
self.x, self.y, self.w, self.h = x, y, w, h
return self:cacheMaxBounds()
end,
__base = _base_0,
__name = "Rect"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
Rect = _class_0
end
local AnimationQueue
do
local _class_0
local animationList, deletionQueue
local _base_0 = { }
_base_0.__index = _base_0
_class_0 = setmetatable({
__init = function() end,
__base = _base_0,
__name = "AnimationQueue"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
local self = _class_0
animationList = Stack('active')
deletionQueue = { }
self.addAnimation = function(animation)
if not (animation.active) then
return animationList:insert(animation)
end
end
self.removeAnimation = function(animation)
if animation.active then
return animationList:remove(animation)
end
end
self.destroyAnimationStack = function()
return animationList:clear()
end
self.animate = function()
if #animationList == 0 then
return
end
local currentTime = mp.get_time()
for _, animation in ipairs(animationList) do
if animation:update(currentTime) then
table.insert(deletionQueue, animation)
end
end
if #deletionQueue > 0 then
return animationList:removeSortedList(deletionQueue)
end
end
self.active = function()
return #animationList > 0
end
AnimationQueue = _class_0
end
local EventLoop
do
local _class_0
local _base_0 = {
reconfigure = function(self)
settings:__reload()
AnimationQueue.destroyAnimationStack()
for _, zone in ipairs(self.activityZones) do
zone:reconfigure()
end
for _, element in ipairs(self.uiElements) do
element:reconfigure()
end
end,
addZone = function(self, zone)
if zone == nil then
return
end
return self.activityZones:insert(zone)
end,
removeZone = function(self, zone)
if zone == nil then
return
end
return self.activityZones:remove(zone)
end,
generateUIFromZones = function(self)
local seenUIElements = { }
self.script = { }
self.uiElements:clear()
AnimationQueue.destroyAnimationStack()
for _, zone in ipairs(self.activityZones) do
for _, uiElement in ipairs(zone.elements) do
if not (seenUIElements[uiElement]) then
self:addUIElement(uiElement)
seenUIElements[uiElement] = true
end
end
end
return self.updateTimer:resume()
end,
addUIElement = function(self, uiElement)
if uiElement == nil then
error('nil UIElement added.')
end
self.uiElements:insert(uiElement)
return table.insert(self.script, '')
end,
removeUIElement = function(self, uiElement)
if uiElement == nil then
error('nil UIElement removed.')
end
table.remove(self.script, uiElement[self.uiElements])
return self.uiElements:remove(uiElement)
end,
resize = function(self)
for _, zone in ipairs(self.activityZones) do
zone:resize()
end
for _, uiElement in ipairs(self.uiElements) do
uiElement:resize()
end
end,
redraw = function(self, forceRedraw)
if Window:update() then
self:resize()
end
for index, zone in ipairs(self.activityZones) do
zone:update(self.displayRequested, false)
end
AnimationQueue.animate()
for index, uiElement in ipairs(self.uiElements) do
if uiElement:redraw() then
self.script[index] = uiElement:stringify()
end
end
return mp.set_osd_ass(Window.w, Window.h, table.concat(self.script, '\n'))
end
}
_base_0.__index = _base_0
_class_0 = setmetatable({
__init = function(self)
self.script = { }
self.uiElements = Stack()
self.activityZones = Stack()
self.displayRequested = false
self.updateTimer = mp.add_periodic_timer(settings['redraw-period'], (function()
local _base_1 = self
local _fn_0 = _base_1.redraw
return function(...)
return _fn_0(_base_1, ...)
end
end)())
self.updateTimer:stop()
mp.register_event('shutdown', function()
return self.updateTimer:kill()
end)
local displayRequestTimer
local displayDuration = settings['request-display-duration']
mp.add_key_binding("tab", "request-display", function(event)
if event.event == "repeat" then
return
end
if event.event == "down" or event.event == "press" then
if displayRequestTimer then
displayRequestTimer:kill()
end
self.displayRequested = true
end
if event.event == "up" or event.event == "press" then
if displayDuration == 0 then
self.displayRequested = false
else
displayRequestTimer = mp.add_timeout(displayDuration, function()
self.displayRequested = false
end)
end
end
end, {
complex = true
})
return mp.add_key_binding('ctrl+r', 'reconfigure', (function()
local _base_1 = self
local _fn_0 = _base_1.reconfigure
return function(...)
return _fn_0(_base_1, ...)
end
end)(), {
repeatable = false
})
end,
__base = _base_0,
__name = "EventLoop"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
EventLoop = _class_0
end
local Animation
do
local _class_0
local _base_0 = {
update = function(self, now)
if self.isReversed then
self.linearProgress = math.max(0, math.min(1, self.linearProgress + (self.lastUpdate - now) * self.durationR))
if self.linearProgress == 0 then
self.isFinished = true
end
else
self.linearProgress = math.max(0, math.min(1, self.linearProgress + (now - self.lastUpdate) * self.durationR))
if self.linearProgress == 1 then
self.isFinished = true
end
end
self.lastUpdate = now
local progress = math.pow(self.linearProgress, self.accel)
self.value = (1 - progress) * self.initialValue + progress * self.endValue
self.updateCb(self.value)
if self.isFinished and self.finishedCb then
self:finishedCb()
end
return self.isFinished
end,
interrupt = function(self, reverse)
self.finishedCb = nil
self.lastUpdate = mp.get_time()
self.isReversed = reverse
if not (self.active) then
self.isFinished = false
return AnimationQueue.addAnimation(self)
end
end
}
_base_0.__index = _base_0
_class_0 = setmetatable({
__init = function(self, initialValue, endValue, duration, updateCb, finishedCb, accel)
if accel == nil then
accel = 1
end
self.initialValue, self.endValue, self.duration, self.updateCb, self.finishedCb, self.accel = initialValue, endValue, duration, updateCb, finishedCb, accel
self.value = self.initialValue
self.linearProgress = 0
self.lastUpdate = mp.get_time()
self.durationR = 1 / self.duration
self.isFinished = (self.duration <= 0)
self.active = false
self.isReversed = false
end,
__base = _base_0,
__name = "Animation"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
Animation = _class_0
end
local UIElement
do
local _class_0
local _base_0 = {
stringify = function(self)
self.needsUpdate = false
if not self.active then
return ''
else
return table.concat(self.line)
end
end,
activate = function(self, activate)
if activate == true then
self.animation:interrupt(false)
self.active = true
else
self.animation:interrupt(true)
self.animation.finishedCb = function()
self.active = false
end
end
end,
reconfigure = function(self)
self.needsUpdate = true
self.animationDuration = settings['animation-duration']
end,
resize = function(self)
return error('UIElement updateSize called')
end,
redraw = function(self)
return self.needsUpdate
end
}
_base_0.__index = _base_0
_class_0 = setmetatable({
__init = function(self)
self.needsUpdate = false
self.active = false
self.animationDuration = settings['animation-duration']
end,
__base = _base_0,
__name = "UIElement"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
UIElement = _class_0
end
local PauseIndicator
do
local _class_0
local _base_0 = {
stringify = function(self)
return table.concat(self.line)
end,
resize = function(self)
local w, h = 0.5 * Window.w, 0.5 * Window.h
self.line[5] = ([[%g,%g]]):format(w, h)
self.line[12] = ([[%g,%g]]):format(w, h)
end,
redraw = function()
return true
end,
animate = function(self, value)
local scale = value * 50 + 100
local scaleStr = ([[{\fscx%g\fscy%g]]):format(scale, scale)
local alphaStr = ('%02X'):format(value * value * 255)
self.line[1] = scaleStr
self.line[8] = scaleStr
self.line[3] = alphaStr
self.line[10] = alphaStr
end,
destroy = function(self, animation)
return self.eventLoop:removeUIElement(self)
end
}
_base_0.__index = _base_0
_class_0 = setmetatable({
__init = function(self, eventLoop, paused)
self.eventLoop = eventLoop
local w, h = 0.5 * Window.w, 0.5 * Window.h
self.line = {
[[{\fscx0\fscy0]],
[[\alpha&H]],
0,
[[&\pos(]],
([[%g,%g]]):format(w, h),
([[)\an5\bord0%s\p1}]]):format(settings['pause-indicator-background-style']),
0,
[[{\fscx0\fscy0]],
[[\alpha&H]],
0,
[[&\pos(]],
([[%g,%g]]):format(w, h),
([[)\an5\bord0%s\p1}]]):format(settings['pause-indicator-foreground-style']),
0
}
if paused then
self.line[7] = 'm 75 37.5 b 75 58.21 58.21 75 37.5 75 16.79 75 0 58.21 0 37.5 0 16.79 16.79 0 37.5 0 58.21 0 75 16.79 75 37.5 m 23 20 l 23 55 33 55 33 20 m 42 20 l 42 55 52 55 52 20\n'
self.line[14] = 'm 0 0 m 75 75 m 23 20 l 23 55 33 55 33 20 m 42 20 l 42 55 52 55 52 20'
else
self.line[7] = 'm 75 37.5 b 75 58.21 58.21 75 37.5 75 16.79 75 0 58.21 0 37.5 0 16.79 16.79 0 37.5 0 58.21 0 75 16.79 75 37.5 m 25.8333 17.18 l 25.8333 57.6 60.8333 37.39\n'
self.line[14] = 'm 0 0 m 75 75 m 25.8333 17.18 l 25.8333 57.6 60.8333 37.39'
end
AnimationQueue.addAnimation(Animation(0, 1, settings['animation-duration'], (function()
local _base_1 = self
local _fn_0 = _base_1.animate
return function(...)
return _fn_0(_base_1, ...)
end
end)(), (function()
local _base_1 = self
local _fn_0 = _base_1.destroy
return function(...)
return _fn_0(_base_1, ...)
end
end)()))
return self.eventLoop:addUIElement(self)
end,
__base = _base_0,
__name = "PauseIndicator"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
PauseIndicator = _class_0
end
local eventLoop = EventLoop()
local notFrameStepping = false
if settings['pause-indicator'] then
local PauseIndicatorWrapper
PauseIndicatorWrapper = function(event, paused)
if notFrameStepping then
return PauseIndicator(eventLoop, paused)
elseif paused then
notFrameStepping = true
end
end
mp.add_key_binding('.', 'step-forward', function()
notFrameStepping = false
return mp.commandv('frame_step')
end, {
repeatable = true
})
mp.add_key_binding(',', 'step-backward', function()
notFrameStepping = false
return mp.commandv('frame_back_step')
end, {
repeatable = true
})
mp.observe_property('pause', 'bool', PauseIndicatorWrapper)
end
local initDraw
initDraw = function()
mp.unregister_event(initDraw)
notFrameStepping = true
eventLoop:resize()
eventLoop:redraw()
return eventLoop.updateTimer:resume()
end
local fileLoaded
fileLoaded = function()
return mp.register_event('playback-restart', initDraw)
end
return mp.register_event('file-loaded', fileLoaded)
|
require "core/gamestate"
require "states/gameplaystate"
require "core/color"
require "core/label"
require "core/math"
TitleState = GameState:new()
function TitleState:load()
self.title = Label:new()
self.title.font = Content["Fonts"]["Title"]
self.title.text = "Snake"
local x, y = love.graphics.getDimensions()
self.title.x = 0
self.title.y = 0
self.title.ox = self.title.font:getWidth(self.title.text) / 2
self.title.oy = self.title.font:getHeight(self.title.text) / 2
self.title.color = 0x00ff10ff
self.startX = 80
self.startY = y - 50
self.anchorX = x - 100
self.anchorY = y - 70
self.destX = x / 2
self.destY = y / 2 - 50
self.lerpIndex = 0
self.destinationReached = false
self.lerpSpeed = 0.8
self.pressStartText = Label:new()
self.pressStartText.x = x / 2
self.pressStartText.y = y / 2 + 40
self.pressStartText.font = Content["Fonts"]["SubTitle"]
self.pressStartText.text = "enter to start"
self.pressStartText.ox = self.pressStartText.font:getWidth(self.pressStartText.text) / 2
self.pressStartText.oy = self.pressStartText.font:getHeight(self.pressStartText.text) / 2
self.pressStartText.color = 0x265e19ff
self.mapTable = {}
local i = 1
for k, __ in pairs(Content["Maps"]) do
self.mapTable[i] = k
i = i + 1
end
self.mapSelector = Label:new()
self.mapSelector.x = x / 2
self.mapSelector.y = y / 2 + 10
self.mapSelector.font = Content["Fonts"]["SubTitle"]
self.selectedMap = 1
self.mapSelector.text = self.mapTable[self.selectedMap]
self.mapSelector.ox = self.mapSelector.font:getWidth(self.mapSelector.text) / 2
self.mapSelector.oy = self.mapSelector.font:getHeight(self.mapSelector.text) / 2
self.mapSelector.color = 0xffb200ff
self.mapSelectorL = Label:new()
self.mapSelectorL.font = Content["Fonts"]["SubTitle"]
self.mapSelectorL.text = self.mapTable[overflowclamp(self.selectedMap - 1, 1, #self.mapTable)]
self.mapSelectorL.x = x / 2 - self.mapSelector.font:getWidth(self.mapSelector.text) / 2 - self.mapSelectorL.font:getWidth(self.mapSelectorL.text) / 2 - 20
self.mapSelectorL.y = y / 2 + 10
self.mapSelectorL.ox = self.mapSelectorL.font:getWidth(self.mapSelectorL.text) / 2
self.mapSelectorL.oy = self.mapSelectorL.font:getHeight(self.mapSelectorL.text) / 2
self.mapSelectorL.color = 0xffb20066
self.mapSelectorR = Label:new()
self.mapSelectorR.font = Content["Fonts"]["SubTitle"]
self.mapSelectorR.text = self.mapTable[overflowclamp(self.selectedMap + 1, 1, #self.mapTable)]
self.mapSelectorR.x = x / 2 + self.mapSelector.font:getWidth(self.mapSelector.text) / 2 + self.mapSelectorR.font:getWidth(self.mapSelectorR.text) / 2 + 20
self.mapSelectorR.y = y / 2 + 10
self.mapSelectorR.ox = self.mapSelectorR.font:getWidth(self.mapSelectorR.text) / 2
self.mapSelectorR.oy = self.mapSelectorR.font:getHeight(self.mapSelectorR.text) / 2
self.mapSelectorR.color = 0xffb20066
end
function TitleState:update(dt)
if not self.destinationReached then
if self.lerpIndex >= 1 then
self.destinationReached = true
end
self.title.x, self.title.y = lerp2(self.startX, self.startY, self.anchorX, self.anchorY, self.destX, self.destY, self.lerpIndex)
self.lerpIndex = self.lerpIndex + dt * self.lerpSpeed
end
end
function TitleState:draw()
love.graphics.clear(convertColor(0x001100ff))
self.title:draw()
if self.destinationReached then
self.pressStartText:draw()
self.mapSelector:draw()
self.mapSelectorL:draw()
self.mapSelectorR:draw()
end
end
function TitleState:keypressed(key)
if key == "left" or key == "a" then
self.selectedMap = overflowclamp(self.selectedMap - 1, 1, #self.mapTable)
self.mapSelector.text = self.mapTable[self.selectedMap]
self.mapSelector.ox = self.mapSelector.font:getWidth(self.mapSelector.text) / 2
self.mapSelector.oy = self.mapSelector.font:getHeight(self.mapSelector.text) / 2
self.mapSelectorL.text = self.mapTable[overflowclamp(self.selectedMap - 1, 1, #self.mapTable)]
self.mapSelectorL.ox = self.mapSelectorL.font:getWidth(self.mapSelector.text) / 2
self.mapSelectorL.oy = self.mapSelectorL.font:getHeight(self.mapSelector.text) / 2
self.mapSelectorR.text = self.mapTable[overflowclamp(self.selectedMap + 1, 1, #self.mapTable)]
self.mapSelectorR.ox = self.mapSelectorR.font:getWidth(self.mapSelector.text) / 2
self.mapSelectorR.oy = self.mapSelectorR.font:getHeight(self.mapSelector.text) / 2
end
if key == "right" or key == "d" then
self.selectedMap = overflowclamp(self.selectedMap + 1, 1, #self.mapTable)
self.mapSelector.text = self.mapTable[self.selectedMap]
self.mapSelector.ox = self.mapSelector.font:getWidth(self.mapSelector.text) / 2
self.mapSelector.oy = self.mapSelector.font:getHeight(self.mapSelector.text) / 2
self.mapSelectorL.text = self.mapTable[overflowclamp(self.selectedMap - 1, 1, #self.mapTable)]
self.mapSelectorL.ox = self.mapSelectorL.font:getWidth(self.mapSelector.text) / 2
self.mapSelectorL.oy = self.mapSelectorL.font:getHeight(self.mapSelector.text) / 2
self.mapSelectorR.text = self.mapTable[overflowclamp(self.selectedMap + 1, 1, #self.mapTable)]
self.mapSelectorR.ox = self.mapSelectorR.font:getWidth(self.mapSelector.text) / 2
self.mapSelectorR.oy = self.mapSelectorR.font:getHeight(self.mapSelector.text) / 2
end
if self.destinationReached and key == "return" then
game.stateManager:push(GamePlayState:new(), self.mapSelector.text)
end
if not self.destinationReached and key == "return" then
self.lerpIndex = 1
end
if key == "escape" then
game.stateManager:pop()
end
end
|
-- EP1 CM Wave Reader Configuration -- Configuration window for the addon
local function ConfigurationWindow(configuration, addonName)
local this =
{
title = addonName .. " - Configuration",
open = false,
changed = false,
}
local _configuration = configuration
local _showWindowSettings = function()
local success
local anchorList =
{
"Top Left (Disabled)", "Left", "Bottom Left",
"Top", "Center", "Bottom",
"Top Right", "Right", "Bottom Right",
}
if imgui.Checkbox("Enable", _configuration.enable) then
_configuration.enable = not _configuration.enable
this.changed = true
end
if imgui.Checkbox("Separate spawns", _configuration.spaceSpawns) then
_configuration.spaceSpawns = not _configuration.spaceSpawns
this.changed = true
end
local colors
success,
_configuration.currentWavesColorR,
_configuration.currentWavesColorG,
_configuration.currentWavesColorB = imgui.SliderInt3("Current room's color (R,G,B)",
_configuration.currentWavesColorR,
_configuration.currentWavesColorG,
_configuration.currentWavesColorB,
0, 255)
if success then
_configuration.changed = true
this.changed = true
end
if imgui.Checkbox("No title bar", _configuration.noTitleBar == "NoTitleBar") then
if _configuration.noTitleBar == "NoTitleBar" then
_configuration.noTitleBar = ""
else
_configuration.noTitleBar = "NoTitleBar"
end
this.changed = true
end
if imgui.Checkbox("No resize", _configuration.noResize == "NoResize") then
if _configuration.noResize == "NoResize" then
_configuration.noResize = ""
else
_configuration.noResize = "NoResize"
end
this.changed = true
end
if imgui.Checkbox("No move", _configuration.noMove == "NoMove") then
if _configuration.noMove == "NoMove" then
_configuration.noMove = ""
else
_configuration.noMove = "NoMove"
end
this.changed = true
end
if imgui.Checkbox("Always Auto Resize", _configuration.AlwaysAutoResize == "AlwaysAutoResize") then
if _configuration.AlwaysAutoResize == "AlwaysAutoResize" then
_configuration.AlwaysAutoResize = ""
else
_configuration.AlwaysAutoResize = "AlwaysAutoResize"
end
this.changed = true
end
if imgui.Checkbox("Transparent window", _configuration.transparentWindow) then
_configuration.transparentWindow = not _configuration.transparentWindow
this.changed = true
end
imgui.Text("Position and Size")
imgui.PushItemWidth(0.50 * imgui.GetWindowWidth())
success, _configuration.anchor = imgui.Combo("Anchor", _configuration.anchor, anchorList, table.getn(anchorList))
imgui.PopItemWidth()
if success then
_configuration.changed = true
this.changed = true
end
imgui.PushItemWidth(0.25 * imgui.GetWindowWidth())
success, _configuration.X = imgui.InputInt("X", _configuration.X)
imgui.PopItemWidth()
if success then
_configuration.changed = true
this.changed = true
end
imgui.SameLine(0, 0)
imgui.SetCursorPosX(0.50 * imgui.GetWindowWidth())
imgui.PushItemWidth(0.25 * imgui.GetWindowWidth())
success, _configuration.Y = imgui.InputInt("Y", _configuration.Y)
imgui.PopItemWidth()
if success then
_configuration.changed = true
this.changed = true
end
imgui.PushItemWidth(0.25 * imgui.GetWindowWidth())
success, _configuration.W = imgui.InputInt("Width", _configuration.W)
imgui.PopItemWidth()
if success then
_configuration.changed = true
this.changed = true
end
imgui.SameLine(0, 0)
imgui.SetCursorPosX(0.50 * imgui.GetWindowWidth())
imgui.PushItemWidth(0.25 * imgui.GetWindowWidth())
success, _configuration.H = imgui.InputInt("Height", _configuration.H)
imgui.PopItemWidth()
if success then
_configuration.changed = true
this.changed = true
end
if imgui.TreeNodeEx("Monster Counts Window") then
if imgui.Checkbox("Enable Monster Counts", _configuration.countsEnable) then
_configuration.countsEnable = not _configuration.countsEnable
this.changed = true
end
if imgui.Checkbox("Show Individual Monsters in Wave", _configuration.countsIndividual) then
_configuration.countsIndividual = not _configuration.countsIndividual
this.changed = true
end
if imgui.Checkbox("Enable Debug Mode", _configuration.countsDebug) then
_configuration.countsDebug = not _configuration.countsDebug
this.changed = true
end
if imgui.Checkbox("No title bar", _configuration.countsNoTitleBar == "NoTitleBar") then
if _configuration.countsNoTitleBar == "NoTitleBar" then
_configuration.countsNoTitleBar = ""
else
_configuration.countsNoTitleBar = "NoTitleBar"
end
this.changed = true
end
if imgui.Checkbox("No resize", _configuration.countsNoResize == "NoResize") then
if _configuration.countsNoResize == "NoResize" then
_configuration.countsNoResize = ""
else
_configuration.countsNoResize = "NoResize"
end
this.changed = true
end
if imgui.Checkbox("No move", _configuration.countsNoMove == "NoMove") then
if _configuration.countsNoMove == "NoMove" then
_configuration.countsNoMove = ""
else
_configuration.countsNoMove = "NoMove"
end
this.changed = true
end
if imgui.Checkbox("Always Auto Resize", _configuration.countsAlwaysAutoResize == "AlwaysAutoResize") then
if _configuration.countsAlwaysAutoResize == "AlwaysAutoResize" then
_configuration.countsAlwaysAutoResize = ""
else
_configuration.countsAlwaysAutoResize = "AlwaysAutoResize"
end
this.changed = true
end
if imgui.Checkbox("Transparent window", _configuration.countsTransparentWindow) then
_configuration.countsTransparentWindow = not _configuration.countsTransparentWindow
this.changed = true
end
imgui.Text("Position and Size")
imgui.PushItemWidth(0.50 * imgui.GetWindowWidth())
success, _configuration.countsAnchor = imgui.Combo("Anchor", _configuration.countsAnchor, anchorList, table.getn(anchorList))
imgui.PopItemWidth()
if success then
_configuration.changed = true
this.changed = true
end
imgui.PushItemWidth(0.25 * imgui.GetWindowWidth())
success, _configuration.countsX = imgui.InputInt("X", _configuration.countsX)
imgui.PopItemWidth()
if success then
_configuration.changed = true
this.changed = true
end
imgui.SameLine(0, 0)
imgui.SetCursorPosX(0.50 * imgui.GetWindowWidth())
imgui.PushItemWidth(0.25 * imgui.GetWindowWidth())
success, _configuration.countsY = imgui.InputInt("Y", _configuration.countsY)
imgui.PopItemWidth()
if success then
_configuration.changed = true
this.changed = true
end
imgui.PushItemWidth(0.25 * imgui.GetWindowWidth())
success, _configuration.countsW = imgui.InputInt("Width", _configuration.countsW)
imgui.PopItemWidth()
if success then
_configuration.changed = true
this.changed = true
end
imgui.SameLine(0, 0)
imgui.SetCursorPosX(0.50 * imgui.GetWindowWidth())
imgui.PushItemWidth(0.25 * imgui.GetWindowWidth())
success, _configuration.countsH = imgui.InputInt("Height", _configuration.countsH)
imgui.PopItemWidth()
if success then
_configuration.changed = true
this.changed = true
end
imgui.TreePop()
end
end
this.Update = function()
if this.open == false then
return
end
local success
imgui.SetNextWindowSize(500, 400, 'FirstUseEver')
success, this.open = imgui.Begin(this.title, this.open)
_showWindowSettings()
imgui.End()
end
-- Inserts tabs/spaces for saving the options.lua
this.InsertTabs = function(level)
for i=0,level do
io.write(" ")
end
end
-- Recursively save a table to a file. Has some awful hacks.
this.SaveTableToFile = function(tbl, level)
if level == 0 then
io.write("return\n")
end
this.InsertTabs(level-1)
io.write("{\n")
for key,val in pairs(tbl) do
local skey
local ktype = type(key)
local sval
local vtype = type(val)
-- Hack to avoid writing out the internal changed var
if tostring(key) ~= "changed" then
if vtype == "string" then
sval = string.format("%q", val)
this.InsertTabs(level)
io.write(string.format("%s = %s,\n", key, sval))
elseif vtype == "number" then
-- Hack for hex...
if tostring(key) == "flagMask" or tostring(key) == "flagNum" then
sval = string.format("0x%-0.8X", val)
else
sval = string.format("%s", val)
end
this.InsertTabs(level)
io.write(string.format("%s = %s,\n", key, sval))
elseif vtype == "boolean" then
sval = tostring(val)
this.InsertTabs(level)
io.write(string.format("%s = %s,\n", key, sval))
elseif vtype == "table" then
-- Very hackish... Don't write the index for nested tables
-- Why? Because I'm assuming there aren't any nested tables with
-- any real indexes..
if level == 0 then
this.InsertTabs(level)
io.write(string.format("%s = \n", key))
end
-- And recurse to write the table in this place
this.SaveTableToFile(val, level+1)
end
end
end
this.InsertTabs(level-1)
if level ~= 0 then
io.write("},\n")
else
io.write("}\n")
end
end
-- Save options to the file.
this.SaveOptions = function(tbl, fileName)
local file = io.open(fileName, "w")
if file ~= nil then
io.output(file)
this.SaveTableToFile(tbl, 0)
io.close(file)
end
end
-- Retrieve main window options
this.GetWindowOptions = function()
local opts = { _configuration.noMove, _configuration.noResize, _configuration.noTitleBar, _configuration.AlwaysAutoResize }
return opts
end
-- Retrieve monster counts window options
this.GetMonstersWindowOptions = function()
local opts = { _configuration.countsNoMove, _configuration.countsNoResize, _configuration.countsNoTitleBar, _configuration.countsAlwaysAutoResize }
return opts
end
return this
end
return
{
ConfigurationWindow = ConfigurationWindow,
}
|
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )
ENT.Damage = 4
ENT.Blast = Sound( "hgn/stalker/anom/burner_blow.mp3" )
ENT.Death = Sound( "ambient/fire/mtov_flame2.wav" )
ENT.Burn = Sound( "Fire.Plasma" )
local anomalyID = tostring(math.Rand(1,2))
--Wake variables
ENT.WakeRange = 600
ENT.SleepTimer = 0
ENT.IsSleeping = true --starts the anomaly out sleeping so it doesn't use a ton of server assets
function ENT:Initialize()
self.Entity:SetMoveType( MOVETYPE_NONE )
self.Entity:SetSolid( SOLID_NONE )
self.Entity:SetModel( "models/props_junk/watermelon01.mdl" )
self.Entity:SetKeyValue("renderamt", "0")
self.Entity:SetMaterial("models/props_combine/portalball001_sheet")
self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS_TRIGGER )
self.Entity:SetTrigger( true )
self.Entity:SetNotSolid( true )
self.Entity:DrawShadow( false )
self.Entity:SetCollisionBounds( Vector( -100, -100, -100 ), Vector( 100, 100, 100 ) )
self.Entity:PhysicsInitBox( Vector( -100, -100, -100 ), Vector( 100, 100, 100 ) )
self.BurnTime = 0
end
function ENT:OnRemove()
timer.Destroy(anomalyID)
end
function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 16
local ent = ents.Create( self.ClassName )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
// Spawns a random artifact every 4 hour
--timer.Create(anomalyID, 14400, 0, function()
timer.Create(anomalyID, 7200 + math.random(7200), 0, function()
if math.random(100) < 20 then
local rnd = math.floor(math.Rand(1,101))
if rnd > 1 and rnd < 40 then // 40 %
nut.item.spawn("droplet", tr.HitPos+(Vector( math.Rand(-160,160), math.Rand(-160,160), 10 )), nil, AngleRand(), {})
elseif rnd > 40 and rnd < 60 then // 20 %
nut.item.spawn("fireball", tr.HitPos+(Vector( math.Rand(-160,160), math.Rand(-160,160), 10 )), nil, AngleRand(), {})
elseif rnd > 60 and rnd < 80 then // 20 %
nut.item.spawn("mamasbeads", tr.HitPos+(Vector( math.Rand(-160,160), math.Rand(-160,160), 10 )), nil, AngleRand(), {})
elseif rnd > 80 and rnd < 88 then // 8 %
nut.item.spawn("crystal", tr.HitPos+(Vector( math.Rand(-160,160), math.Rand(-160,160), 10 )), nil, AngleRand(), {})
elseif rnd > 88 and rnd < 96 then // 8 %
nut.item.spawn("eye", tr.HitPos+(Vector( math.Rand(-160,160), math.Rand(-160,160), 10 )), nil, AngleRand(), {})
elseif rnd > 96 and rnd < 101 then // 4 %
nut.item.spawn("flame", tr.HitPos+(Vector( math.Rand(-160,160), math.Rand(-160,160), 10 )), nil, AngleRand(), {})
end
end
end )
return ent
end
function ENT:SetArtifact( ent )
self.Artifact = ent
end
function ENT:GetArtifact()
return self.Artifact or NULL
end
function ENT:GetRadiationRadius()
return 200
end
function ENT:Think()
if self.SleepTimer < CurTime() then
if self:ShouldWake(self.WakeRange) then
self.IsSleeping = false
self.SleepTimer = CurTime() + 5
else
self.IsSleeping = true
self.SleepTimer = CurTime() + 5
end
end
if self.IsSleeping then return end
if self.BurnTime and self.BurnTime >= CurTime() then
local tbl = player.GetAll()
tbl = table.Add( tbl, ents.FindByClass( "npc*" ) )
for k,ent in pairs( tbl ) do
if ent:GetPos():Distance( self.Entity:GetPos() ) < 150 then
if ent:IsPlayer() then
local dmg = DamageInfo()
dmg:SetDamage( self.Damage )
dmg:SetDamageType( DMG_ACID )
dmg:SetAttacker( self.Entity )
dmg:SetInflictor( self.Entity )
ent:TakeDamageInfo( dmg )
elseif string.find( ent:GetClass(), "npc" ) then
ent:TakeDamage( self.Damage )
end
end
end
elseif self.BurnTime and self.BurnTime < CurTime() then
self.BurnTime = nil
self.Entity:StopSound( self.Burn )
self.Entity:EmitSound( self.Death, 150, 100 )
self.Entity:SetNWBool( "Burn", false )
end
end
function ENT:Touch( ent )
if ent == self.Entity:GetArtifact() then return end
if self.BurnTime != nil then
if self.BurnTime >= CurTime() then
return
end
end
self.BurnTime = CurTime() + 10
self.Entity:SetNWBool( "Burn", true )
self.Entity:EmitSound( self.Blast, 150, 100 )
self.Entity:EmitSound( self.Burn, 100, 100 )
end
function ENT:ShouldWake( range )
local entities = ents.FindInSphere(self:GetPos(), range)
for _,v in pairs(entities) do
if v:IsPlayer() then
return true
end
end
return false
end
function ENT:UpdateTransmitState()
return TRANSMIT_ALWAYS
end
|
local PLUGIN = PLUGIN
PLUGIN.biosignalLocations = PLUGIN.biosignalLocations or {}
PLUGIN.requestLocations = PLUGIN.requestLocations or {}
PLUGIN.cameraData = PLUGIN.cameraData or {}
PLUGIN.hudObjectives = PLUGIN.hudObjectives or {}
PLUGIN.socioStatus = PLUGIN.socioStatus or "GREEN"
PLUGIN.terminalMaterialIdx = PLUGIN.terminalMaterialIdx or 0
PLUGIN.terminalsToDraw = PLUGIN.terminalsToDraw or {}
function PLUGIN:UpdateBiosignalLocations()
local curTime = CurTime()
local client = LocalPlayer()
-- Clear expired requests.
for i, data in ipairs(self.requestLocations) do
if (curTime - data.time >= ix.config.Get("expireRequests")) then
self.requestLocations[i] = nil
end
end
-- Clear active biosignals and expired lost biosignals.
for unit, data in pairs(self.biosignalLocations) do
if (!IsValid(unit) or !unit:IsCombine() or (!client:GetNetVar("IsBiosignalGone") and !unit:GetNetVar("IsBiosignalGone")) or curTime - data.time >= 120) then
self.biosignalLocations[unit] = nil
end
data.isLost = true
end
-- Add active biosignals, update camera data.
if (!client:GetNetVar("IsBiosignalGone", false)) then
for _, v in pairs(player.GetAll()) do
if (v:IsCombine() and v != client and !v:GetNetVar("IsBiosignalGone", false) and v:Alive()) then
local physBone = v:LookupBone("ValveBiped.Bip01_Head1")
local position = nil
if (physBone) then
local bonePosition = v:GetBonePosition(physBone)
if (bonePosition) then
position = bonePosition + Vector(0, 0, 16)
end
else
position = v:GetPos() + Vector(0, 0, 80)
end
self.biosignalLocations[v] = {
pos = position,
time = curTime,
isLost = false,
isKnockedOut = v:GetLocalVar("ragdoll"),
digits = string.match(v:Name(), "%d%d%d%d?%d?") or "???"
}
end
end
end
end
net.Receive("CombineRequestSignal", function()
local client = net.ReadEntity()
local text = net.ReadString()
if (IsValid(client)) then
local physBone = client:LookupBone("ValveBiped.Bip01_Head1")
local position = nil
if (physBone) then
local bonePosition = client:GetBonePosition(physBone)
if (bonePosition) then
position = bonePosition + Vector(0, 0, 16)
end
else
position = client:GetPos() + Vector(0, 0, 80)
end
table.insert(PLUGIN.requestLocations, {
time = CurTime(),
pos = position,
text = text
})
end
end)
net.Receive("UpdateBiosignalCameraData", function()
local data = net.ReadTable()
local newCameraData = {}
for entIndex, players in pairs(data) do
local combineCamera = Entity(entIndex)
if (IsValid(combineCamera)) then
newCameraData[combineCamera] = players
end
end
PLUGIN.cameraData = newCameraData
end)
net.Receive("RecalculateHUDObjectives", function()
local status = net.ReadString()
local objectives = net.ReadTable()
local lines = {}
if (status) then
PLUGIN.socioStatus = status
end
if (objectives) then
for k, v in pairs(string.Split(objectives.text, "\n")) do
if (string.StartWith(v, "^")) then
table.insert(lines, "<:: " .. string.sub(v, 2) .. " ::>")
end
end
PLUGIN.hudObjectives = lines
end
PLUGIN:UpdateBiosignalLocations()
end)
|
--;===========================================================
--; DEBUG HOTKEYS
--;===========================================================
--key, ctrl, alt, shift, pause, debug key, function
addHotkey('c', true, false, false, true, false, 'toggleClsnDraw()')
addHotkey('d', true, false, false, true, false, 'toggleDebugDraw()')
addHotkey('d', false, false, true, true, false, 'toggleDebugDraw(true)')
addHotkey('s', true, false, false, true, true, 'changeSpeed()')
addHotkey('KP_PLUS', true, false, false, true, true, 'changeSpeed(1)')
addHotkey('KP_MINUS', true, false, false, true, true, 'changeSpeed(-1)')
addHotkey('l', true, false, false, true, true, 'toggleStatusDraw()')
addHotkey('v', true, false, false, true, true, 'toggleVsync()')
addHotkey('1', true, false, false, true, true, 'toggleAI(1)')
addHotkey('1', true, true, false, true, true, 'togglePlayer(1)')
addHotkey('2', true, false, false, true, true, 'toggleAI(2)')
addHotkey('2', true, true, false, true, true, 'togglePlayer(2)')
addHotkey('3', true, false, false, true, true, 'toggleAI(3)')
addHotkey('3', true, true, false, true, true, 'togglePlayer(3)')
addHotkey('4', true, false, false, true, true, 'toggleAI(4)')
addHotkey('4', true, true, false, true, true, 'togglePlayer(4)')
addHotkey('5', true, false, false, true, true, 'toggleAI(5)')
addHotkey('5', true, true, false, true, true, 'togglePlayer(5)')
addHotkey('6', true, false, false, true, true, 'toggleAI(6)')
addHotkey('6', true, true, false, true, true, 'togglePlayer(6)')
addHotkey('7', true, false, false, true, true, 'toggleAI(7)')
addHotkey('7', true, true, false, true, true, 'togglePlayer(7)')
addHotkey('8', true, false, false, true, true, 'toggleAI(8)')
addHotkey('8', true, true, false, true, true, 'togglePlayer(8)')
addHotkey('F1', false, false, false, false, true, 'kill(2);kill(4);kill(6);kill(8);debugFlag(1)')
addHotkey('F1', true, false, false, false, true, 'kill(1);kill(3);kill(5);kill(7);debugFlag(2)')
addHotkey('F2', false, false, false, false, true, 'kill(1,1);kill(2,1);kill(3,1);kill(4,1);kill(5,1);kill(6,1);kill(7,1);kill(8,1);debugFlag(1);debugFlag(2)')
addHotkey('F2', true, false, false, false, true, 'kill(1,1);kill(3,1);kill(5,1);kill(7,1);debugFlag(2)')
addHotkey('F2', false, false, true, false, true, 'kill(2,1);kill(4,1);kill(6,1);kill(8,1);debugFlag(1)')
addHotkey('F3', false, false, false, false, true, 'powMax(1);powMax(2);debugFlag(1);debugFlag(2)')
addHotkey('F3', true, false, true, false, true, 'toggleMaxPowerMode();debugFlag(1);debugFlag(2)')
addHotkey('F4', false, false, false, false, true, 'roundReset()')
addHotkey('F4', false, false, true, false, true, 'reload()')
addHotkey('F5', false, false, false, false, true, 'setTime(0);debugFlag(1);debugFlag(2)')
addHotkey('SPACE', false, false, false, false, true, 'full(1);full(2);full(3);full(4);full(5);full(6);full(7);full(8);setTime(getRoundTime());debugFlag(1);debugFlag(2);clearConsole()')
addHotkey('i', true, false, false, true, true, 'stand(1);stand(2);stand(3);stand(4);stand(5);stand(6);stand(7);stand(8)')
addHotkey('PAUSE', false, false, false, true, true, 'togglePause()')
addHotkey('PAUSE', true, false, false, true, true, 'step()')
addHotkey('SCROLLLOCK', false, false, false, true, true, 'step()')
local speedMul = 1
local speedAdd = 0
function changeSpeed(add)
if add ~= nil then
speedAdd = speedAdd + add / 100
elseif speedMul >= 4 then
speedMul = 0.25
else
speedMul = speedMul * 2
end
setAccel(math.max(0.01, speedMul + speedAdd))
end
function toggleAI(p)
local oldid = id()
if player(p) then
if ailevel() > 0 then
setAILevel(0)
else
setAILevel(config.Difficulty)
end
playerid(oldid)
end
end
function kill(p, ...)
local oldid = id()
if player(p) then
local n = ...
if not n then n = 0 end
setLife(n)
playerid(oldid)
end
end
function powMax(p)
local oldid = id()
if player(p) then
setPower(powermax())
setGuardPoints(guardpointsmax())
setDizzyPoints(dizzypointsmax())
playerid(oldid)
end
end
function full(p)
local oldid = id()
if player(p) then
setLife(lifemax())
setPower(powermax())
setGuardPoints(guardpointsmax())
setDizzyPoints(dizzypointsmax())
setRedLife(0)
removeDizzy()
playerid(oldid)
end
end
function stand(p)
local oldid = id()
if player(p) then
selfState(0)
playerid(oldid)
end
end
function debugFlag(side)
if start ~= nil and start.t_savedData.debugFlag ~= nil then
start.t_savedData.debugflag[side] = true
end
end
--;===========================================================
--; DEBUG STATUS INFO
--;===========================================================
function statusInfo(p)
local oldid = id()
if not player(p) then return false end
local ret = string.format(
'P%d: %d; LIF:%4d; POW:%4d; ATK:%4d; DEF:%4d; RED:%4d; GRD:%4d; STN:%4d',
playerno(), id(), life(), power(), attack(), defence(), redlife(), guardpoints(), dizzypoints()
)
playerid(oldid)
return ret
end
loadDebugStatus('statusInfo')
--;===========================================================
--; DEBUG PLAYER/HELPER INFO
--;===========================================================
function customState()
if not incustomstate() then return "" end
return " (in " .. stateownername() .. " " .. stateownerid() .. "'s state)"
end
function boolToInt(bool)
if bool then return 1 end
return 0
end
function engineInfo()
return string.format('VSync: %d; Speed: %d/%d%%', vsync(), gameLogicSpeed(), gamespeed())
end
function playerInfo()
return string.format('%s %d%s', name(), id(), customState())
end
function actionInfo()
return string.format(
'ActionID: %d (P%d); SPR: %d,%d; ElemNo: %d/%d; Time: %d/%d (%d/%d)',
anim(), animowner(), spritegroup(), spritenumber(), animelemno(0), animelemcount(), animelemtimesum(), animelemlength(), animtimesum(), animlength()
)
end
function stateInfo()
return string.format(
'State No: %d (P%d); CTRL: %s; Type: %s; MoveType: %s; Physics: %s; Time: %d',
stateno(), stateowner(), boolToInt(ctrl()), statetype(), movetype(), physics(), time()-1
)
end
loadDebugInfo({'engineInfo', 'playerInfo', 'actionInfo', 'stateInfo'})
--;===========================================================
--; MATCH LOOP
--;===========================================================
local endFlag = false
--function called during match via config.json CommonLua
function loop()
hook.run("loop.start")
if start == nil then --match started via command line without -loadmotif flag
if esc() then
endMatch()
os.exit()
end
if indialogue() then
dialogueReset()
end
togglePostMatch(false)
toggleDialogueBars(false)
return
end
--credits
if main.credits ~= -1 and getKey(motif.attract_mode.credits_key) then
sndPlay(motif.files.snd_data, motif.attract_mode.credits_snd[1], motif.attract_mode.credits_snd[2])
main.credits = main.credits + 1
resetKey()
end
--music
start.f_stageMusic()
--match start
if roundstart() then
setLifebarElements({bars = main.lifebar.bars})
if roundno() == 1 then
speedMul = 1
speedAdd = 0
start.victoryInit = false
start.resultInit = false
start.continueInit = false
start.hiscoreInit = false
endFlag = false
if indialogue() then
dialogueReset()
end
if gamemode('training') then
menu.f_trainingReset()
end
end
start.turnsRecoveryInit = false
start.rankInit = false
start.dialogueInit = false
end
if winnerteam() ~= -1 and player(winnerteam()) and roundstate() == 4 then
--turns life recovery
start.f_turnsRecovery()
--rank
start.f_rank()
end
--dialogue
if indialogue() then
start.f_dialogue()
hook.run("loop.dialog")
--match end
elseif roundstate() == -1 then
if not endFlag then
resetMatchData(false)
endFlag = true
end
--victory screen
if start.f_victory() then
return
--result screen
elseif start.f_result() then
return
--continue screen
elseif start.f_continue() then
return
end
clearColor(motif.selectbgdef.bgclearcolor[1], motif.selectbgdef.bgclearcolor[2], motif.selectbgdef.bgclearcolor[3])
togglePostMatch(false)
end
hook.run("loop." .. gamemode() .. "#always")
--pause menu
if main.pauseMenu then
playerBufReset()
menu.f_run()
hook.run("loop.pause")
else
hook.run("loop." .. gamemode())
main.f_cmdInput()
--esc / m
if (esc() or (main.f_input(main.t_players, {'m'})) and not network()) and not start.challengerInit then
if network() or gamemode('demo') or gamemode('randomtest') or (not config.EscOpensMenu and esc()) then
endMatch()
else
menu.f_init()
end
--demo mode
elseif gamemode('demo') and ((motif.attract_mode.enabled == 1 and main.credits > 0 and not sndPlaying(motif.files.snd_data, motif.attract_mode.credits_snd[1], motif.attract_mode.credits_snd[2])) or (motif.attract_mode.enabled == 0 and main.f_input(main.t_players, {'pal'})) or gametime() >= motif.demo_mode.fight_endtime) then
endMatch()
--challenger
elseif gamemode('arcade') then
if start.challenger > 0 then
start.f_challenger()
else
--TODO: detecting players that are part of P1 team
--[[for i = 1, #main.t_cmd do
if commandGetState(main.t_cmd[i], '/s') then
print(i)
end
end]]
if main.f_input(main.t_players, {'s'}) and main.playerInput ~= 1 and (motif.attract_mode.enabled == 0 or main.credits ~= 0) then
start.challenger = main.playerInput
end
end
end
end
end
|
local playsession = {
{"datadrian", {2221}},
{"toddrofls", {425045}},
{"mewmew", {87066}},
{"wellczech", {26914}},
{"tykak", {190831}},
{"autopss", {325227}},
{"rikkert", {83918}},
{"KIRkomMAX", {120351}},
{"beranabus", {1991}},
{"Kirari", {1467}},
{"Alexfeed23", {8953}},
{"Cloudtv", {3161}},
{"Fexx", {1635}},
{"drbln", {19924}},
{"Zymoran", {10915}},
{"crash893", {1760}},
{"651782904", {844}}
}
return playsession
|
-- scaffolding entry point for libiconv-genie-buildable
return dofile("libiconv-genie-buildable.lua")
|
-- This needs to be pushed from the C++
modules = {}
globals = {}
function Bind()
--This is not necessary and even adds a little overhead, but makes LUA API
--more consistent and clean. globals._transform:XXX() can be use directly.
--Havent found any better way of doing this
globals.Transform = {}
function closure(v)
f = function(...)
return v(globals._transform, ...)
end
return f
end
for k, v in pairs(getmetatable(globals._transform)) do
if string.match(tostring(k), "^[A-Z]") then
fname = tostring(k)
globals.Transform[fname] = closure(v)
end
end
end
-- Start single module, it is required in case when new
-- modules are added in runtime
function StartModule(m)
if modules[m] ~= nil then
if modules[m].Start ~= nil then modules[m].Start() end
end
end
-- Start all modules
function Start()
for i, m in pairs(modules) do
if m.Start ~= nil then m.Start() end
end
end
-- Update all modules
function Update()
for i, m in pairs(modules) do
if m.Update ~= nil then m.Update() end
end
end
-- PreDraw all modules
function PreDraw()
for i, m in pairs(modules) do
if m.PreDraw ~= nil then m.PreDraw() end
end
end
-- Register module
function RegisterModule(m)
modules[m] = require(m)
end
-- Deregister module
function DeregisterModule(m)
modules[m] = nil
end
-- Discover and print registered modules information
function DiscoverModules()
print('Discovering modules...')
for i, m in pairs(modules) do
print (i, m)
for k, v in pairs(m) do
print (" -> ", k, v)
end
end
print('Discovering globals...')
for k, v in pairs(globals) do
print (k, v)
end
end
|
-- // Services
local Players = game:GetService("Players")
-- // Vars
local LocalPlayer = Players.LocalPlayer
local Vortex = LocalPlayer.PlayerScripts.Vortex
local sVortex = getsenv(Vortex)
-- // Set reserve ammo as infinite
debug.setupvalue(sVortex.GetAmmoData, 2, 1/0)
|
return {
PlaceObj("ModItemOptionToggle", {
"name", "ClearOnLaunch",
"DisplayName", T(302535920011469, "Clear On Launch"),
"Help", T(302535920011536, "Clear cargo for rocket/pod/elevator when launched (not all cargo, just for the same type)."),
"DefaultValue", false,
}),
}
|
local HttpEnv = require "charon.net.HttpEnv"
local test = {}
test['deve retornar path /pedido/varejo'] = function()
local header = os.read(CHARON_PATH .. '/tests/charon/net/HttpEnv/example-1.txt')
local parser = HttpEnv.new(header)
assert(parser:requestUri() == '/pedido/varejo?id=1234&descricao=teste')
end
return test
|
local Spell = { }
Spell.LearnTime = 120
Spell.ApplyFireDelay = 0.3
Spell.Description = [[
Makes your opponent hear
white noise.
Works only on players.
]]
Spell.NodeOffset = Vector(-1219, -922, 0)
Spell.AccuracyDecreaseVal = 0.3
function Spell:OnFire(wand)
local ent, tr = wand:HPWGetAimEntity(800)
if IsValid(ent) and ent:IsPlayer() then
local filter = RecipientFilter()
filter:AddPlayer(ent)
local snd = CreateSound(ent, "synth/white_noise.wav", filter)
snd:Play()
snd:ChangeVolume(1, 0)
snd:ChangeVolume(0, 20)
end
end
HpwRewrite:AddSpell("Muffliato", Spell)
|
local core = require("resty.rocketmq.core")
local client = require("resty.rocketmq.client")
local utils = require("resty.rocketmq.utils")
local trace = require("resty.rocketmq.trace")
local RESPONSE_CODE = core.RESPONSE_CODE
local cjson_safe = require("cjson.safe")
local ngx = ngx
local ngx_timer_at = ngx.timer.at
---@class producer
local _M = {}
_M.__index = _M
function _M.new(nameservers, groupName, enableMsgTrace)
local cli, err = client.new(nameservers)
if not cli then
return nil, err
end
---@type producer
local producer = setmetatable({
client = cli,
groupName = groupName or "DEFAULT_PRODUCER",
sendMessageHookList = {},
endTransactionHookList = {},
}, _M)
if enableMsgTrace then
producer.traceDispatcher = trace.new(nameservers, trace.PRODUCE)
producer:registerSendMessageHook(producer.traceDispatcher.hook)
producer:registerEndTransactionHook(producer.traceDispatcher.hook)
end
return producer
end
function _M.addRPCHook(self, hook)
self.client:addRPCHook(hook)
if self.traceDispatcher then
self.traceDispatcher.producer:addRPCHook(hook)
end
end
function _M.setUseTLS(self, useTLS)
self.client:setUseTLS(useTLS)
if self.traceDispatcher then
self.traceDispatcher.producer:setUseTLS(useTLS)
end
end
function _M.setTimeout(self, timeout)
self.client:setTimeout(timeout)
if self.traceDispatcher then
self.traceDispatcher.producer:setTimeout(timeout)
end
end
function _M.registerSendMessageHook(self, hook)
if type(hook) == 'table' and type(hook.sendMessageBefore) == 'function' and type(hook.sendMessageAfter) == 'function' then
table.insert(self.sendMessageHookList, hook)
else
error('hook should be functions')
end
end
function _M.registerEndTransactionHook(self, hook)
if type(hook) == 'table' and type(hook.endTransaction) == 'function' then
table.insert(self.endTransactionHookList, hook)
else
error('hook should be functions')
end
end
local function selectOneMessageQueue(topicPublishInfo)
local index = topicPublishInfo.sendWhichQueue
topicPublishInfo.sendWhichQueue = index + 1
local pos = math.abs(index) % #topicPublishInfo.messageQueueList
return topicPublishInfo.messageQueueList[pos + 1]
end
local function sendHeartbeatToAllBroker(self)
local heartbeatData = {
clientID = '' .. ngx.worker.pid(),
producerDataSet = { { groupName = self.groupName } },
consumerDataSet = setmetatable({}, cjson_safe.empty_array_mt)
}
for brokerName, brokers in pairs(self.client.brokerAddrTable) do
local addr = brokers[0]
if addr then
local h, b, err = self.client:sendHeartbeat(addr, heartbeatData)
end
end
end
function _M:start()
local self = self
sendHeartbeatToAllBroker(self)
local loop
loop = function()
if self.exit then
return
end
self.client:updateAllTopicRouteInfoFromNameserver()
sendHeartbeatToAllBroker(self)
ngx_timer_at(30, loop)
end
ngx_timer_at(30, loop)
if self.traceDispatcher then
self.traceDispatcher:start()
end
end
function _M:stop()
self.exit = true
if self.traceDispatcher then
self.traceDispatcher:stop()
end
end
local function getSendResult(h, msg, mqSelected, err)
if not h then
return nil, err
end
if h.code ~= core.RESPONSE_CODE.SUCCESS then
return nil, h.remark
end
return {
messageQueue = {
topic = msg.topic,
brokerName = mqSelected.brokerName,
queueId = tonumber(mqSelected.queueId),
},
offsetMsgId = h.extFields.msgId,
msgId = msg.properties.UNIQ_KEY,
queueOffset = tonumber(h.extFields.queueOffset),
}
end
local function produce(self, msg)
if not core.checkTopic(msg.topic) or not core.checkMessage(msg.body) then
return nil, 'invalid topic or message'
end
local topicPublishInfo, err = self.client:tryToFindTopicPublishInfo(msg.topic)
if not topicPublishInfo then
return nil, err
end
local mqSelected = selectOneMessageQueue(topicPublishInfo)
local brokerAddr = self.client:findBrokerAddressInPublish(mqSelected.brokerName, msg.topic)
msg.queueId = mqSelected.queueId
local context
if #self.sendMessageHookList > 0 then
context = {
producer = self,
producerGroup = self.groupName,
communicationMode = "SYNC",
bornHost = "127.0.0.1",
brokerAddr = brokerAddr,
message = msg,
mq = mqSelected,
msgType = core.Normal_Msg,
}
if msg.properties.TRAN_MSG == 'true' then
context.msgType = core.Trans_Msg_Half
elseif msg.properties.DELAY then
context.msgType = core.Delay_Msg
end
for _, hook in ipairs(self.sendMessageHookList) do
hook:sendMessageBefore(context)
end
end
local h, _, err = self.client:sendMessage(brokerAddr, msg)
local sendResult, err = getSendResult(h, msg, mqSelected, err)
if #self.sendMessageHookList > 0 then
if sendResult then
context.sendResult = sendResult
else
context.exception = err
end
for _, hook in ipairs(self.sendMessageHookList) do
hook:sendMessageAfter(context)
end
end
if not sendResult then
return nil, err
end
h.sendResult = sendResult
return h
end
local function genMsg(groupName, topic, message, tags, keys, properties)
properties = properties or {}
return {
producerGroup = groupName,
topic = topic,
defaultTopic = "TBW102",
defaultTopicQueueNums = 4,
sysFlag = 0,
bornTimeStamp = ngx.now() * 1000,
flag = 0,
properties = {
UNIQ_KEY = utils.genUniqId(),
KEYS = keys,
TAGS = tags,
WAIT = properties.waitStoreMsgOk or 'true',
DELAY = properties.delayTimeLevel,
},
reconsumeTimes = 0,
unitMode = false,
maxReconsumeTimes = 0,
batch = false,
body = message,
}
end
function _M:send(topic, message, tags, keys, properties)
return produce(self, genMsg(self.groupName, topic, message, tags, keys, properties))
end
function _M:setTransactionListener(transactionListener)
if type(transactionListener.executeLocalTransaction) ~= 'function' then
return nil, 'invalid callback'
end
self.transactionListener = transactionListener
end
-- todo add check callback
function _M:sendMessageInTransaction(topic, arg, message, tags, keys, properties)
if not self.transactionListener then
return nil, "TransactionListener is null"
end
local msg = genMsg(self.groupName, topic, message, tags, keys, properties)
msg.properties.TRANS_MSG = 'true'
msg.properties.PGROUP = self.groupName
local h, err = produce(self, msg)
if not h then
return nil, err
end
local localTransactionState = core.TRANSACTION_NOT_TYPE
if h.code == RESPONSE_CODE.SUCCESS then
msg.properties.__transationId__ = h.transationId
msg.transationId = msg.properties.UNIQ_KEY
localTransactionState = self.transactionListener:executeLocalTransaction(msg, arg)
else
localTransactionState = core.TRANSACTION_ROLLBACK_TYPE
end
local _, commitLogOffset = utils.decodeMessageId(h.extFields.offsetMsgId or h.extFields.msgId)
local brokerAddr = self.client:findBrokerAddressInPublish(h.sendResult.messageQueue.brokerName, topic)
if #self.endTransactionHookList > 0 then
local context = {
producerGroup = self.groupName,
brokerAddr = brokerAddr,
message = msg,
msgId = msg.properties.UNIQ_KEY,
transactionId = msg.properties.UNIQ_KEY,
transactionState = core.TRANSACTION_TYPE_MAP[localTransactionState],
fromTransactionCheck = false,
}
for _, hook in ipairs(self.endTransactionHookList) do
hook:endTransaction(context)
end
end
self.client:endTransactionOneway(brokerAddr, {
producerGroup = self.groupName,
transationId = h.transationId,
commitLogOffset = commitLogOffset,
commitOrRollback = localTransactionState,
tranStateTableOffset = h.extFields.queueOffset,
msgId = h.extFields.msgId,
})
return h
end
function _M:batchSend(msgs)
local first
local batch_body = {}
for _, m in ipairs(msgs) do
if not core.checkTopic(m.topic) or not core.checkMessage(m.body) then
return nil, 'invalid topic or message'
end
local msg = genMsg(self.groupName, m.topic, m.body, m.tags, m.keys, m.properties)
if msg.properties.DELAY then
return nil, 'TimeDelayLevel is not supported for batching'
end
if not first then
first = msg
if msg.topic:find(core.RETRY_GROUP_TOPIC_PREFIX, nil, true) == 1 then
return nil, 'Retry Group is not supported for batching'
end
else
if msg.topic ~= first.topic then
return nil, 'The topic of the messages in one batch should be the same'
end
if msg.properties.WAIT ~= first.properties.WAIT then
return nil, 'The waitStoreMsgOK of the messages in one batch should the same'
end
end
table.insert(batch_body, core.encodeMsg(msg))
end
return produce(self, {
producerGroup = self.groupName,
topic = first.topic,
defaultTopic = "TBW102",
defaultTopicQueueNums = 4,
sysFlag = 0,
bornTimeStamp = ngx.now() * 1000,
flag = 0,
properties = {
UNIQ_KEY = utils.genUniqId(),
WAIT = first.waitStoreMsgOk,
},
reconsumeTimes = 0,
unitMode = false,
maxReconsumeTimes = 0,
batch = true,
body = table.concat(batch_body),
})
end
return _M
|
--[[
desc: TOUCH, a lib that encapsulate touch function.
author: Musoucrow
since: 2018-5-27
alter: 2019-8-19
]]--
local _INPUT = require("lib.input")
local _Caller = require("core.caller")
local _pointMap = {} ---@type table<id, Lib.TOUCH.Point>
---@type table<string, Core.Caller>
local _callerMap = {
onPressed = _Caller.New(),
onReleased = _Caller.New(),
onMoved = _Caller.New()
}
---@param point Lib.TOUCH.Point
---@return boolean
local function _IsPressed(point)
return point.status == _INPUT.enum.pressed
end
---@param point Lib.TOUCH.Point
---@return boolean
local function _IsReleased(point)
return point.status == _INPUT.enum.released
end
---@param point Lib.TOUCH.Point
---@return boolean
local function _IsHold(point)
return point.status == _INPUT.enum.hold
end
local function _NewPoint(id, x, y, dx, dy, pressure)
if (_pointMap[id]) then
_pointMap[id].x = x
_pointMap[id].y = y
_pointMap[id].dx = dx
_pointMap[id].dy = dy
_pointMap[id].pressure = pressure
_pointMap[id].moving = true
else
---@class Lib.TOUCH.Point
_pointMap[id] = {x = x, y = y, dx = dx, dy = dy, pressure = pressure, moving = true, IsPressed = _IsPressed, IsReleased = _IsReleased, IsHold = _IsHold}
end
end
local _TOUCH = {} ---@class Lib.TOUCH
---@param type string
---@param obj table
---@param Func func
function _TOUCH.AddListener(type, obj, Func)
_callerMap[type]:AddListener(obj, Func)
end
---@param type string
---@param obj table
---@param Func func
function _TOUCH.DelListener(type, obj, Func)
_callerMap[type]:DelListener(obj, Func)
end
---@return table<id, Lib.TOUCH.Point>
function _TOUCH.GetPoints()
return _pointMap
end
---@return Lib.TOUCH.Point
function _TOUCH.GetPoint(id)
return _pointMap[id]
end
---@param id any
---@param x int
---@param y int
---@param dx int
---@param dy int
---@param pressure int @It always is 1.
function _TOUCH.Moved(id, x, y, dx, dy, pressure)
_NewPoint(id, x, y, dx, dy, pressure)
_callerMap.onMoved:Call(id, x, y, dx, dy, pressure)
end
---@param id any
---@param x int
---@param y int
---@param dx int
---@param dy int
---@param pressure int @It always is 1.
function _TOUCH.Pressed(id, x, y, dx, dy, pressure)
_NewPoint(id, x, y, dx, dy, pressure)
_pointMap[id].status = _INPUT.enum.pressed
_callerMap.onPressed:Call(id, x, y, dx, dy, pressure)
end
---@param id any
---@param x int
---@param y int
---@param dx int
---@param dy int
---@param pressure int @It always is 1.
function _TOUCH.Released(id, x, y, dx, dy, pressure)
_NewPoint(id, x, y, dx, dy, pressure)
_pointMap[id].status = _INPUT.enum.released
_callerMap.onReleased:Call(id, x, y, dx, dy, pressure)
end
function _TOUCH.LateUpdate()
for k, v in pairs(_pointMap) do
if (v.moving) then
v.moving = false
elseif (v.moving == false) then
v.dx = 0
v.dy = 0
v.moving = nil
end
if (v.status == _INPUT.enum.pressed) then
v.status = _INPUT.enum.hold
elseif (v.status == _INPUT.enum.released) then
_pointMap[k] = nil
end
end
end
return _TOUCH
|
object_static_worldbuilding_terminal_floor_banking_01 = object_static_worldbuilding_terminal_shared_floor_banking_01:new {
}
ObjectTemplates:addTemplate(object_static_worldbuilding_terminal_floor_banking_01, "object/static/worldbuilding/terminal/floor_banking_01.iff")
|
IMBA_MUTATION_TIMER = nil
IMBA_MUTATION_PERIODIC_SPELLS = {}
IMBA_MUTATION_PERIODIC_SPELLS[1] = {"sun_strike", "Sunstrike", "Red", -1}
IMBA_MUTATION_PERIODIC_SPELLS[2] = {"thundergods_wrath", "Thundergod's Wrath", "Red", 3.5}
IMBA_MUTATION_PERIODIC_SPELLS[3] = {"rupture", "Rupture", "Red", 10.0}
IMBA_MUTATION_PERIODIC_SPELLS[4] = {"torrent", "Torrent", "Red", 10}
IMBA_MUTATION_PERIODIC_SPELLS[5] = {"cold_feet", "Cold Feet", "Red", 4.0}
IMBA_MUTATION_PERIODIC_SPELLS[6] = {"stampede", "Stampede", "Green", 5.0}
IMBA_MUTATION_PERIODIC_SPELLS[7] = {"bloodlust", "Bloodlust", "Green", 30.0}
IMBA_MUTATION_PERIODIC_SPELLS[8] = {"aphotic_shield", "Aphotic Shield", "Green", 15.0}
--IMBA_MUTATION_PERIODIC_SPELLS[9] = {"track", "Track", "Red", 20.0}
-- Negative Spellcasts
IMBA_MUTATION_PERIODIC_SPELLS[1] = {}
IMBA_MUTATION_PERIODIC_SPELLS[1][1] = {"sun_strike", "Sunstrike", "Red", -1}
IMBA_MUTATION_PERIODIC_SPELLS[1][2] = {"thundergods_wrath", "Thundergod's Wrath", "Red", 3.5}
IMBA_MUTATION_PERIODIC_SPELLS[1][3] = {"rupture", "Rupture", "Red", 10.0}
IMBA_MUTATION_PERIODIC_SPELLS[1][4] = {"torrent", "Torrent", "Red", 10}
IMBA_MUTATION_PERIODIC_SPELLS[1][5] = {"cold_feet", "Cold Feet", "Red", 4.0}
-- Positive Spellcasts
IMBA_MUTATION_PERIODIC_SPELLS[2] = {}
IMBA_MUTATION_PERIODIC_SPELLS[2][1] = {"stampede", "Stampede", "Green", 5.0}
IMBA_MUTATION_PERIODIC_SPELLS[2][2] = {"bloodlust", "Bloodlust", "Green", 30.0}
IMBA_MUTATION_PERIODIC_SPELLS[2][3] = {"aphotic_shield", "Aphotic Shield", "Green", 15.0}
-- TO DO
-- "telekinesis",
-- "glimpse",
-- "shallow_grave",
-- "false_promise",
-- "bloodrage",
IMBA_MUTATION_WORMHOLE_COLORS = {}
IMBA_MUTATION_WORMHOLE_COLORS[1] = Vector(100, 0, 0)
IMBA_MUTATION_WORMHOLE_COLORS[2] = Vector(0, 100, 0)
IMBA_MUTATION_WORMHOLE_COLORS[3] = Vector(0, 0, 100)
IMBA_MUTATION_WORMHOLE_COLORS[4] = Vector(100, 100, 0)
IMBA_MUTATION_WORMHOLE_COLORS[5] = Vector(100, 0, 100)
IMBA_MUTATION_WORMHOLE_COLORS[6] = Vector(0, 100, 100)
IMBA_MUTATION_WORMHOLE_COLORS[7] = Vector(0, 100, 100)
IMBA_MUTATION_WORMHOLE_COLORS[8] = Vector(100, 0, 100)
IMBA_MUTATION_WORMHOLE_COLORS[9] = Vector(100, 100, 0)
IMBA_MUTATION_WORMHOLE_COLORS[10] = Vector(0, 0, 100)
IMBA_MUTATION_WORMHOLE_COLORS[11] = Vector(0, 100, 0)
IMBA_MUTATION_WORMHOLE_COLORS[12] = Vector(100, 0, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS = {}
IMBA_MUTATION_WORMHOLE_POSITIONS[1] = Vector(-2471, -5025, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[2] = Vector(-576, -4320, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[3] = Vector(794, -3902, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[4] = Vector(2630, -3700, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[5] = Vector(3203, -6064, 0) -- Bot Lane Wormhole
IMBA_MUTATION_WORMHOLE_POSITIONS[6] = Vector(1111, -5804, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[7] = Vector(4419, -5114, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[8] = Vector(6156, -4831, 0) -- Bot Lane Wormhole
IMBA_MUTATION_WORMHOLE_POSITIONS[9] = Vector(6084, -3022, 0) -- Bone Lane Wormhole
IMBA_MUTATION_WORMHOLE_POSITIONS[10] = Vector(4422, -1765, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[11] = Vector(6186, -654, 0) -- Bot Lane Wormhole
IMBA_MUTATION_WORMHOLE_POSITIONS[12] = Vector(4754, -84, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[13] = Vector(3318, -58, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[14] = Vector(5008, 1799, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[15] = Vector(1534, -649, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[16] = Vector(2641, -2003, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[17] = Vector(3939, 2279, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[18] = Vector(2309, 4643, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[19] = Vector(843, 2300, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[20] = Vector(-544, -361, 0) -- Mid Lane Wormhole (Center)
IMBA_MUTATION_WORMHOLE_POSITIONS[21] = Vector(354, -1349, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[22] = Vector(289, -2559, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[23] = Vector(-1534, -2893, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[24] = Vector(-5366, -2570, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[25] = Vector(-5238, -1727, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[26] = Vector(-3363, -1210, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[27] = Vector(-4535, 10, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[28] = Vector(-4420, 1351, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[29] = Vector(-6161, 440, 0) -- Top Lane Wormhole
IMBA_MUTATION_WORMHOLE_POSITIONS[30] = Vector(-2110, 376, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[31] = Vector(-840, 1384, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[32] = Vector(-388, 2537, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[33] = Vector(-36, 4042, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[34] = Vector(-1389, 4325, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[35] = Vector(-2812, 3633, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[36] = Vector(-4574, 4804, 0)
IMBA_MUTATION_WORMHOLE_POSITIONS[37] = Vector(-6339, 3841, 0) -- Top Lane Wormhole
IMBA_MUTATION_WORMHOLE_POSITIONS[38] = Vector(-5971, 5455, 0) -- Top Lane Wormhole
IMBA_MUTATION_WORMHOLE_POSITIONS[39] = Vector(-3099, 6112, 0) -- Top Lane Wormhole
IMBA_MUTATION_WORMHOLE_POSITIONS[40] = Vector(-1606, 6103, 0) -- Top Lane Wormhole
--IMBA_MUTATION_WORMHOLE_INTERVAL = 600
--IMBA_MUTATION_WORMHOLE_DURATION = 600
IMBA_MUTATION_WORMHOLE_PREVENT_DURATION = 3
-- Tug of War
IMBA_MUTATION_TUG_OF_WAR_DEATH_COUNT = 0
IMBA_MUTATION_TUG_OF_WAR_START = {}
IMBA_MUTATION_TUG_OF_WAR_START[DOTA_TEAM_BADGUYS] = Vector(4037, 3521, 0)
IMBA_MUTATION_TUG_OF_WAR_START[DOTA_TEAM_GOODGUYS] = Vector(-4448, -3936, 0)
IMBA_MUTATION_TUG_OF_WAR_TARGET = {}
IMBA_MUTATION_TUG_OF_WAR_TARGET[DOTA_TEAM_BADGUYS] = Vector(-5864, -5340, 0)
IMBA_MUTATION_TUG_OF_WAR_TARGET[DOTA_TEAM_GOODGUYS] = Vector(5654, 4939, 0)
-- Minefield
IMBA_MUTATION_MINEFIELD_MAP_SIZE = 7000
-- Airdrop
IMBA_MUTATION_AIRDROP_TIMER = 120.0 + 1.0 -- don't ask
IMBA_MUTATION_AIRDROP_MAP_SIZE = 5000
IMBA_MUTATION_AIRDROP_ITEM_TIER_1_MINUTES = 5
IMBA_MUTATION_AIRDROP_ITEM_TIER_2_MINUTES = 10
IMBA_MUTATION_AIRDROP_ITEM_TIER_3_MINUTES = 15
IMBA_MUTATION_AIRDROP_ITEM_MINIMUM_GOLD_COST = 1000
IMBA_MUTATION_AIRDROP_ITEM_TIER_1_GOLD_COST = 2000
IMBA_MUTATION_AIRDROP_ITEM_TIER_2_GOLD_COST = 3500
IMBA_MUTATION_AIRDROP_ITEM_TIER_3_GOLD_COST = 5000
IMBA_MUTATION_AIRDROP_ITEM_SPAWN_DELAY = 10
IMBA_MUTATION_AIRDROP_ITEM_VISION_LINGER = 10
IMBA_MUTATION_AIRDROP_ITEM_SPAWN_RADIUS = 300
IMBA_MUTATION_RESTRICTED_ITEMS = {
"item_imba_ironleaf_boots",
"item_imba_travel_boots",
"item_imba_travel_boots_2",
-- Removed items!
"item_imba_triumvirate",
"item_imba_sange_azura",
"item_imba_azura_yasha",
"item_imba_travel_boots",
"item_imba_travel_boots_2",
"item_imba_cyclone",
"item_imba_recipe_cyclone",
"item_imba_plancks_artifact",
"item_recipe_imba_plancks_artifact",
"item_nokrash_blade",
"item_recipe_nokrash_blade",
}
-- Speed Freaks
_G.IMBA_MUTATION_SPEED_FREAKS_PROJECTILE_SPEED = 500
_G.IMBA_MUTATION_SPEED_FREAKS_MOVESPEED_PCT = 50 -- %
_G.IMBA_MUTATION_SPEED_FREAKS_MAX_MOVESPEED = 1000
-- Death Explosion
_G.IMBA_MUTATION_DEATH_EXPLOSION_DAMAGE = 400
_G.IMBA_MUTATION_DEATH_EXPLOSION_DAMAGE_INCREASE_PER_MIN = 50
_G.IMBA_MUTATION_DEATH_EXPLOSION_RADIUS = 400
_G.IMBA_MUTATION_DEATH_EXPLOSION_DELAY = 1.0 -- seconds
_G.IMBA_MUTATION_DEATH_EXPLOSION_BUILDING_DAMAGE = 25 -- %
_G.IMBA_MUTATION_DEATH_EXPLOSION_MAX_MINUTES = 30 -- minutes
-- Ultimate Level
IMBA_MUTATION_ULTIMATE_LEVEL = 100
-- Killstreak Power
_G.IMBA_MUTATION_KILLSTREAK_POWER = 20 -- %
_G.IMBA_MUTATION_KILLSTREAK_POWER_MAX_SIZE = 100 -- %
-- Defense of the Ants
_G.IMBA_MUTATION_DEFENSE_OF_THE_ANTS_SCALE = 5 -- %
_G.IMBA_MUTATION_DEFENSE_OF_THE_ANTS_MIN_SCALE = -75 -- %
-- River Flows
_G.IMBA_MUTATION_RIVER_FLOWS_MOVESPEED = 1000
-- Monkey Business
_G.IMBA_MUTATION_MONKEY_BUSINESS_DELAY = 3.0
-- Slark Mode
_G.IMBA_MUTATION_SLARK_MODE_HEALTH_REGEN = 5 -- %
_G.IMBA_MUTATION_SLARK_MODE_MANA_REGEN = 2 -- %
-- Danger Zone
IMBA_MUTATION_DANGER_ZONE_TIMER = 10.0 + 1.0 -- don't ask
-- All Random Deathmatch
--if IsInToolsMode() then
-- IMBA_MUTATION_ARDM_RESPAWN_COUNT = 5
--else
if Is10v10Map() then
IMBA_MUTATION_ARDM_RESPAWN_COUNT = 50
else
IMBA_MUTATION_ARDM_RESPAWN_COUNT = 30
end
--end
IMBA_MUTATION_ARDM_RESPAWN_SCORE = {}
IMBA_MUTATION_ARDM_RESPAWN_SCORE[2] = IMBA_MUTATION_ARDM_RESPAWN_COUNT
IMBA_MUTATION_ARDM_RESPAWN_SCORE[3] = IMBA_MUTATION_ARDM_RESPAWN_COUNT
|
function onCreate()
-- background shit
makeLuaSprite('bg', 'entry', -300, -200);
setScrollFactor('bg', 0.9, 0.9);
makeLuaSprite('warning', 'entryWarning', -3, -5);
setObjectCamera('warning', 'camHUD')
setProperty('warning.visible', false)
addLuaSprite('bg', false);
addLuaSprite('warning', true);
close(true); --For performance reasons, close this script once the stage is fully loaded, as this script won't be used anymore after loading the stage
end
|
---[===[
local oldpr=print
require("wx")
print=oldpr
os.setlocale("C") --to let serialize work for numbers
local ID_IDCOUNTER = wx.wxID_HIGHEST + 1
function NewID()
ID_IDCOUNTER = ID_IDCOUNTER + 1
return ID_IDCOUNTER
end
Config = require"ide.config"
Config:init("Lua2SCIDE", "sonoro")
config = Config.config
require"ide.settings"
require"ide.perspectives"
require"ide.findreplace"
require"ide.scriptgui"
require"ide.bootsc"
require"ide.editor"
IdentifiersList = require"ide.identifiers"
CallStack = require"ide.callstack"
require"ide.help"
require"ide.toppanel"
require"ide.idescriptrun"
require"sc.midi"
---------------------------------
-- Equivalent to C's "cond ? a : b", all terms will be evaluated
function iff(cond, a, b) if cond then return a else return b end end
-- Markers for editor marker margin
BREAKPOINT_MARKER = 1
BREAKPOINT_MARKER_VALUE = 2 -- = 2^BREAKPOINT_MARKER
CURRENT_LINE_MARKER = 2
CURRENT_LINE_MARKER_VALUE = 4 -- = 2^CURRENT_LINE_MARKER
-- ASCII values for common chars
local char_CR = string.byte("\r")
local char_LF = string.byte("\n")
-- Global variables
programName = nil -- the name of the wxLua program to be used when starting debugger
editorApp = wx.wxGetApp()
-- wxWindow variables
frame = nil -- wxFrame the main top level window
notebook = nil -- wxNotebook of editors
errorLog = nil -- wxStyledTextCtrl log window for messages
in_evt_focus = false -- true when in editor focus event to avoid recursion
openDocuments = {} -- open notebook editor documents[winId] = {
-- editor = wxStyledTextCtrl,
-- index = wxNotebook page index,
-- filePath = full filepath, nil if not saved,
-- fileName = just the filename,
-- modTime = wxDateTime of disk file or nil,
-- isModified = bool is the document modified? }
exitingProgram = false -- are we currently exiting, ID_EXIT
wxkeywords = nil -- a string of the keywords for scintilla of wxLua's wx.XXX items
font = nil -- fonts to use for the editor
fontItalic = nil
-- Pick some reasonable fixed width fonts to use for the editor
if wx.__WXMSW__ then
font = wx.wxFont(10, wx.wxFONTFAMILY_MODERN, wx.wxFONTSTYLE_NORMAL, wx.wxFONTWEIGHT_NORMAL, false,"",wx.wxFONTENCODING_CP1253 )--,wx.wxFONTENCODING_ISO8859_1)--, "Andale Mono")
fontItalic = wx.wxFont(10, wx.wxFONTFAMILY_MODERN, wx.wxFONTSTYLE_ITALIC, wx.wxFONTWEIGHT_NORMAL, false,"",wx.wxFONTENCODING_CP1253)--,wx.wxFONTENCODING_ISO8859_1)--, "Andale Mono")
else
font = wx.wxFont(10, wx.wxFONTFAMILY_MODERN, wx.wxFONTSTYLE_NORMAL, wx.wxFONTWEIGHT_NORMAL, false, "")--,wx.wxFONTENCODING_ISO8859_1)
fontItalic = wx.wxFont(10, wx.wxFONTFAMILY_MODERN, wx.wxFONTSTYLE_ITALIC, wx.wxFONTWEIGHT_NORMAL, false, "")--,wx.wxFONTENCODING_ISO8859_1)
end
-- ----------------------------------------------------------------------------
---------------------------------------------------
function DoDir(func,path,pattern,recur,level)
level=level or 0
if recur==nil then recur=false end
pattern=pattern or ""
local dir=wx.wxDir(path);
if ( not dir:IsOpened() ) then
print("error apertura")
error()
return;
end
--print("Enumerating object files in current directory:",dir:GetName());
local cont,filename = dir:GetFirst(pattern,wx.wxDIR_FILES + wx.wxDIR_HIDDEN)-- filespec, flags);
while ( cont ) do
func(filename,level,path)
cont,filename = dir:GetNext();
end
if recur then
local cont,filename = dir:GetFirst("",wx.wxDIR_DIRS + wx.wxDIR_HIDDEN)-- filespec, flags);
while ( cont ) do
func(filename,level,path)
DoDir(func,path.."/"..filename,pattern,recur,level+1)
cont,filename = dir:GetNext();
end
end
end
function abriredit(eventFileName_,line)
eventFileName_ = wx.wxFileName(eventFileName_):GetFullPath()
--print("abriredit",eventFileName_,line)
if line then line=line-1 end
--try to reuse
for id, document in pairs(openDocuments) do
local editor = document.editor
local filePath = document.filePath
--TODO: unix is case sensitive
--check that now
if filePath and string.upper(filePath) == string.upper(eventFileName_) and filePath ~=eventFileName_ then
wx.wxMessageBox("different case in filepath xxxxxxxxx " .. filePath .. " " ..eventFileName_)
end
----------------------------
--if filePath and string.upper(filePath) == string.upper(eventFileName_) then
if filePath and filePath == eventFileName_ then
--print("reuse ",filePath , eventFileName_)
editor:MarkerDeleteAll(CURRENT_LINE_MARKER)
local selection = document.index
notebook:SetSelection(selection)
SetEditorSelection(selection)
if line then
editor:SetSelection(editor:PositionFromLine(line), editor:GetLineEndPosition(line))
editor:MarkerAdd(line, CURRENT_LINE_MARKER)
editor:EnsureVisibleEnforcePolicy(line)
end
return true
end
end
local editor = LoadFile(eventFileName_, nil, true)
if editor then
if line then
editor:SetSelection(editor:PositionFromLine(line), editor:GetLineEndPosition(line))
editor:MarkerAdd(line, CURRENT_LINE_MARKER)
editor:EnsureVisibleEnforcePolicy(line)
end
--editor:SetReadOnly(true)
return true
else
return false
end
end
function ideGetScriptLaneStatus()
local tmplinda = lanes.linda()
mainlinda:send("GetScriptLaneStatus",tmplinda)
local key,val=tmplinda:receive(3,"GetScriptLaneStatusResp")
if key then
return val
else --timeout
return nil
end
end
function checkendScript(lane)
if not lane then return true end
local status=ideGetScriptLaneStatus()
if status=="error" or status=="done" or status=="cancelled" or status=="killed" then
print("checkend status ",status)
end
if status=="error" or status=="done" or status=="cancelled" or status=="killed" then
print("checkend ffinished",status)
EnableDebugCommands(false,false)
return true
end
return false
end
function checkend(lane)
if not lane then return true end
local status=lane.status
if status=="error" or status=="done" or status=="cancelled" or status=="killed" then
print("checkend status ",status)
end
if status=="error" or status=="done" or status=="cancelled" then --or status=="killed" then
print("checkend ffinished",status)
EnableDebugCommands(false,false)
return true
end
return false
end
function checkendBAK(lane)
if not lane then return true end
local status=lane.status
--print("checkend status ",status)
if status=="error" or status=="done" or status=="cancelled" or status=="killed" then
print("checkend ffinished",status)
--do return true end
print"going to join"
local v,err,stack_tbl= lane:join(0.1)
print("checkend post lane:join")
EnableDebugCommands(false,false)
if v==nil then
if err then
local onlyerrorst=err:match(":%d+:(.+)")
print( "Error: "..tostring(err).."\n" )
--idlelinda:send("prerror","Error: "..tostring(err).."\n"..tostring(onlyerrorst).."\n")
if type(stack_tbl)=="table" then
local function compile_error(err)
local info = {}
--catch error from require
local err2=err:match("from file%s+'.-':.-([%w%p]*:%d+:)")
--catch error from loadfile
if not err2 then
err2 = err:match("loadfile error:([%w%p]*:%d+:)")
end
if err2 then
info.source="@"..err2:match(":-(.-):%d*:")
info.currentline=err2:match(":(%d*):")
return info
end
end
local info=compile_error(err)
if (info) then
print("comp err source: ",info.source)
print("comp err line: ",info.currentline)
local stack_tbl2={}
for i,v in ipairs(stack_tbl) do
stack_tbl2[i+1]=stack_tbl[i]
end
stack_tbl2[1]=info
stack_tbl=stack_tbl2
end
print("print stack table")
prtable(stack_tbl)
--io.stderr:write( "\t", table.concat(stack_tbl,"\n\t"), "\n" );
for k,v in ipairs(stack_tbl) do
if v.what~="C" then
abriredit(v.source:sub(2),v.currentline)
break
end
end
CallStack:MakeStack(stack_tbl,onlyerrorst)
else
print( "checkend no stack" );
end
else
print( "checkend time out" );
end
else
print("lane returns:",v)
end
--print("hiding panel")
--manager:GetPane(panel):Hide()
return true
end
return false
end
function CreateLog()
local errorLog = wxstc.wxStyledTextCtrl(managedpanel,--notebookLogs,
wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize,wx.wxBORDER_NONE )
--errorLog:Show(false)
errorLog:SetFont(font)
errorLog:StyleSetFont(wxstc.wxSTC_STYLE_DEFAULT, font)
--errorLog:SetCodePage(wxstc.wxSTC_CP_UTF8)
--errorLog:SetCodePage(0)
for i = 0, 32 do
errorLog:StyleSetCharacterSet(i, wxstc.wxSTC_CHARSET_ANSI)
end
errorLog:StyleClearAll()
errorLog:StyleSetForeground(1, wx.wxColour(128, 0, 0)) -- error
errorLog:SetMarginWidth(1, 16) -- marker margin
errorLog:SetMarginType(1, wxstc.wxSTC_MARGIN_SYMBOL);
errorLog:MarkerDefine(CURRENT_LINE_MARKER, wxstc.wxSTC_MARK_ARROWS, wx.wxBLACK, wx.wxWHITE)
errorLog:SetReadOnly(true)
errorLog:SetUseTabs(true)
errorLog:SetTabWidth(4)
errorLog:SetIndent(4)
--errorLog:SetUseHorizontalScrollBar(false)
errorLog:Connect(wx.wxEVT_SET_FOCUS,function (event)
currentSTC=errorLog
event:Skip()
end)
--errorLog:SetWrapMode(1)
return errorLog
end
--ok with cycles
local function tableTotree(t,dometatables,tree)
local strTG = {}
local basicToStr=tostring
if type(t) ~="table" then return basicToStr(t) end
local recG = 0
local nameG="SELF"..recG
local ancest ={}
local root = tree:AddRoot("Root",-1)
local function _ToStr(t,strT,rec,name,tparent)
if ancest[t] then
strT[#strT + 1]=ancest[t]
tree:AppendItem(tparent,ancest[t])
return
end
rec = rec + 1
ancest[t]=name
strT[#strT + 1]='{'
--local tlevel = tree:AppendItem(tparent,name)
local count=0
-------------
--if t.name then strT[#strT + 1]=string.rep("\t",rec).."name:"..tostring(t.name) end
----------------
---[[
local sorted_names = {}
for k,v in pairs(t) do
table.insert(sorted_names, k)
end
table.sort(sorted_names,function(a,b) return tostring(a) < tostring(b) end)
-----------------
for _, namek in ipairs(sorted_names) do
local k,v = namek,t[namek]
--]]
--for k,v in pairs(t) do
local str = ""
count=count+1
strT[#strT + 1]="\n"
local kstr
if type(k) == "table" then
local name2=string.format("%s.KEY%d",name,count)
strT[#strT + 1]=string.rep("\t",rec).."["
local strTK = {}
_ToStr(k,strTK,rec,name2)
kstr=table.concat(strTK)
strT[#strT + 1]=kstr.."]="
else
kstr = basicToStr(k)
strT[#strT + 1]=string.rep("\t",rec).."["..kstr.."]="
str = str .. kstr
end
if type(v) == "table" then
local name2=string.format("%s[%s]",name,kstr)
local tlev2 = tree:AppendItem(tparent,kstr .. " : " .. tostring(v))
_ToStr(v,strT,rec,name2,tlev2)
else
strT[#strT + 1]=basicToStr(v)
str = str .. " : ".. basicToStr(v)
tree:AppendItem(tparent,str)
end
end
if dometatables then
local mt = getmetatable(t)
if mt then
local namemt = string.format("%s.METATABLE",name)
local strMT = {}
local tlev2 = tree:AppendItem(tparent,namemt)
_ToStr(mt,strMT,rec,namemt,tlev2)
local metastr=table.concat(strMT)
strT[#strT + 1] = "\n"..string.rep("\t",rec).."[METATABLE]="..metastr
end
end
strT[#strT + 1]='}'
rec = rec - 1
return
end
_ToStr(t,strTG,recG,nameG,root)
return table.concat(strTG)
end
function CreateTreeLog()
local tree = wx.wxTreeCtrl(managedpanel,wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize,wx.wxBORDER_NONE + wx.wxTR_HIDE_ROOT + wx.wxTR_HAS_BUTTONS )
function tree:ShowTable(t)
tree:DeleteAllItems()
tableTotree(t,true,tree)
--tree:Expand(tree:GetRootItem())
local root = tree:GetRootItem()
local child, cookie = tree:GetFirstChild(root)
while child:IsOk() do
tree:Expand(child)
child, cookie = tree:GetNextChild(root,cookie)
end
end
return tree
end
function AppInit()
--wx.wxIdleEvent.SetMode(wx.wxIDLE_PROCESS_SPECIFIED)
frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "Lua2SC",wx.wxDefaultPosition , wx.wxSize(800, 600), wx.wxDEFAULT_FRAME_STYLE ) --wx.wxBORDER_SIMPLE
--frame:SetExtraStyle(wx.wxWS_EX_PROCESS_IDLE)
---[[
--instead of requestmore on idle
local ID_TIMERIDLEWAKEUP = 2
wakeupidletimer = wx.wxTimer(frame,ID_TIMERIDLEWAKEUP)
frame:Connect(wx.wxEVT_TIMER,
function (event)
local id=event:GetId()
if id==ID_TIMERIDLEWAKEUP then
wx.wxWakeUpIdle()
end
end)
wakeupidletimer:Start(30,false)
--]]
--[[
-- wrap into protected call as DragAcceptFiles fails on MacOS with
-- wxwidgets 2.8.12 even though it should work according to change notes
-- for 2.8.10: "Implemented wxWindow::DragAcceptFiles() on all platforms."
pcall(function() frame:DragAcceptFiles(true) end)
frame:Connect(wx.wxEVT_DROP_FILES,function(evt)
print"DragandDrop"
local files = evt:GetFiles()
if not files or #files == 0 then return end
for i,f in ipairs(files) do
LoadFile(f,nil,true)
end
end)
--]]
frameDropTarget = wx.wxLuaFileDropTarget();
frameDropTarget.OnDropFiles = function(self, x, y, filenames)
for i = 1, #filenames do
LoadFile(filenames[i], nil, true)
end
return true
end
frame:SetDropTarget(frameDropTarget)
managedpanel = wx.wxPanel(frame, wx.wxID_ANY)
manager = Manager()
manager:SetManagedWindow(managedpanel);
statusBar = frame:CreateStatusBar( 5 )
local status_txt_width = statusBar:GetTextExtent("OVRW")
frame:SetStatusWidths({-1, status_txt_width, status_txt_width, status_txt_width*5,-1})
frame:SetStatusText("Welcome to Lua2SC")
toppanel = CreateTopPanel()
local mainsizer = wx.wxBoxSizer(wx.wxVERTICAL)
mainsizer:Add(toppanel.window,0,wx.wxGROW)
mainsizer:Add(managedpanel,1,wx.wxGROW)
frame:SetSizer(mainsizer)
mainsizer:SetSizeHints(frame)
-- ----------------------------------------------------------------------------
-- Add the child windows to the frame
notebook = wxaui.wxAuiNotebook(managedpanel, wx.wxID_ANY,
wx.wxDefaultPosition, wx.wxDefaultSize,
--wx.wxCLIP_CHILDREN + wx.wxBORDER_NONE +
wxaui.wxAUI_NB_CLOSE_ON_ACTIVE_TAB + wxaui.wxAUI_NB_TAB_MOVE + wxaui.wxAUI_NB_WINDOWLIST_BUTTON + wxaui.wxAUI_NB_SCROLL_BUTTONS )
notebook:Connect(wxaui.wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,--wx.wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
function (event)
if not exitingProgram then
SetEditorSelection(event:GetSelection())
local editor = GetEditor(event:GetSelection())
local id = editor:GetId()
--print("id",id)
if(openDocuments[id]) then
frame:SetTitle(openDocuments[id].filePath or "")
end
end
event:Skip() -- skip to let page change
--wx.wxMessageBox(wxT("pagina cambia"));
end)
local function ResetDocumentsIndex()
for id, document in pairs(openDocuments) do
document.index = notebook:GetPageIndex(document.editor)
end
end
notebook:Connect(wx.wxID_ANY, wxaui.wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, function(evt)
--local editor = GetEditor(evt:GetSelection())
--local id = editor:GetId()
--print("wxEVT_AUINOTEBOOK_DRAG_DONE",openDocuments[id].filePath)
ResetDocumentsIndex()
evt:Skip()
end)
notebook:Connect(wx.wxID_ANY, wxaui.wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, function(evt)
--local ctrl = evt:GetEventObject():DynamicCast("wxAuiNotebook");
--if (ctrl:GetPage(evt:GetSelection()):IsKindOf(wx.wxClassInfo.FindClass("wxHtmlWindow"))) then
local editor = GetEditor()
local id = editor:GetId()
if SaveModifiedDialog(editor, true) ~= wx.wxID_CANCEL then
RemovePage(openDocuments[id].index)
else
evt:Veto();
end
evt:Skip()
end)
--------------- notebookLogs
notebookLogs = wxaui.wxAuiNotebook(managedpanel, wx.wxID_ANY,
wx.wxDefaultPosition, wx.wxDefaultSize,
wxaui.wxAUI_NB_TAB_MOVE + wxaui.wxAUI_NB_TAB_SPLIT) -- + wxaui.wxAUI_NB_TAB_EXTERNAL_MOVE
notebookLogs:Connect(wxaui.wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,function(evt)
notebookLogs:Refresh();
evt:Skip()
end)
errorLog = CreateLog()
ScLog = CreateLog()
DebugLog = CreateTreeLog()
notebookLogs:AddPage(errorLog, "Log", true)
notebookLogs:AddPage(ScLog, "SC Log", false)
notebookLogs:AddPage(CallStack:Create(managedpanel).window, "Call stack", false)
notebookLogs:AddPage(DebugLog, "DebugLog", false)
--------- manager
manager:AddPane(notebook, wxaui.wxAuiPaneInfo():Name("notebook"):CenterPane():CloseButton(false):PaneBorder(false))
manager:AddPane(notebookLogs, wxaui.wxAuiPaneInfo():Name("notebookLogs"):Bottom():CaptionVisible(false):CloseButton(false):PaneBorder(false):MinSize(100,100):BestSize(200,200):FloatingSize(400,200));
manager:AddPane(IdentifiersList:Create(managedpanel).window, wxaui.wxAuiPaneInfo():Name("IdentifiersList"):Right():Row(1):Layer(0):CloseButton(false):CaptionVisible(false):PaneBorder(false))
CreateScriptGUI()
-- ---------------------------------------------------------------------------
-- Finish creating the frame and show it
manager:GetArtProvider():SetMetric(wxaui.wxAUI_DOCKART_PANE_BORDER_SIZE,2)
manager:GetArtProvider():SetMetric(wxaui.wxAUI_DOCKART_SASH_SIZE,2)
--manager:GetArtProvider():SetMetric(wxaui.wxAUI_DOCKART_CAPTION_SIZE,7)
manager:GetArtProvider():SetMetric(wxaui.wxAUI_DOCKART_GRADIENT_TYPE, wxaui.wxAUI_GRADIENT_NONE)
manager:Update()
ConfigLoadOpenDocuments(Config)
if notebook:GetPageCount() > 0 then
notebook:SetSelection(0)
else
local editor = NewFile()
end
--frame:SetIcon(wxLuaEditorIcon) --FIXME add this back
local bitmap = wx.wxBitmap(require"ide.lua_xpm")
local icon = wx.wxIcon()
icon:CopyFromBitmap(bitmap)
frame:SetIcon(icon)
bitmap:delete()
icon:delete()
frame:Show(true)
--wx.wxToolTip.Enable(true)
notebookLogs:SetArtProvider(wxaui.wxAuiSimpleTabArt())--wxAuiDefaultTabArt wxAuiSimpleTabArt
notebook:SetArtProvider(wxaui.wxAuiSimpleTabArt())
--notebookLogs:Refresh();
notebookLogs:Split(notebookLogs:GetPageIndex(errorLog),wx.wxLEFT)
--InitUdP()
---------
menuBar = wx.wxMenuBar()
InitFileMenu()
InitEditMenu()
InitFindMenu()
InitRunMenu()
InitSCMenu()
InitPerspectivesMenu()
InitDocumentsMenu()
InitHelpMenu()
frame:Connect(wx.wxEVT_CLOSE_WINDOW, CloseWindow)
frame:SetMenuBar(menuBar)
manager:Update()
--------
--midilane = pmidi.gen(this_file_settings.options.midiin, this_file_settings.options.midiout, lanes ,scriptlinda,midilinda,{print=thread_print,
--prerror=thread_error_print,
--prtable=prtable,idlelinda = idlelinda})
-- print"globals"
-- for k,v in pairs(_G) do
-- print(k,v)
-- end
-- print("ID_CANCEL_BUTTON",ID_CANCEL_BUTTON)
end
--from ZeroBrane
function fixUTF8(s, replacement)
local p, len, invalid = 1, #s, {}
while p <= len do
if p == s:find("[%z\1-\127]", p) then p = p + 1
elseif p == s:find("[\194-\223][\128-\191]", p) then p = p + 2
elseif p == s:find( "\224[\160-\191][\128-\191]", p)
or p == s:find("[\225-\236][\128-\191][\128-\191]", p)
or p == s:find( "\237[\128-\159][\128-\191]", p)
or p == s:find("[\238-\239][\128-\191][\128-\191]", p) then p = p + 3
elseif p == s:find( "\240[\144-\191][\128-\191][\128-\191]", p)
or p == s:find("[\241-\243][\128-\191][\128-\191][\128-\191]", p)
or p == s:find( "\244[\128-\143][\128-\191][\128-\191]", p) then p = p + 4
else
s = s:sub(1, p-1)..replacement..s:sub(p+1)
table.insert(invalid, p)
end
end
return s, invalid
end
function fixSTCOutput(s)
s = s:gsub("[\128-\255]","\022")
return s:gsub("[^%w%s%p]+",function(m) return string.format("%q",m) end)
end
function DisplayOutput(message, iserror)
--print("DisplayOutput",message)
--message = wx.wxString(message):ToUTF8()
--message = fixUTF8(message,"\022")
--message = fixSTCOutput(message)
--print("DisplayOutput",message)
local wlen=string.len(message)
local pos=errorLog:GetLength()
errorLog:SetReadOnly(false)
errorLog:AppendText(message)
errorLog:GotoPos(errorLog:GetLength())
if iserror then
--errorLog:MarkerAdd(errorLog:GetLineCount()-1, CURRENT_LINE_MARKER)
errorLog:StartStyling(pos,0)
errorLog:SetStyling(wlen,1)
end
errorLog:SetReadOnly(true)
--if currentSTCed then currentSTCed:SetFocus() end
end
function ClearLog(LogW)
LogW:SetReadOnly(false)
LogW:ClearAll()
LogW:SetReadOnly(true)
end
function DisplayLog(message, LogW)
LogW:SetReadOnly(false)
LogW:AppendText(message)
LogW:GotoPos(LogW:GetLength())
LogW:SetReadOnly(true)
end
function ConfigSaveOpenDocuments(config)
local config_openDocuments={}
local sortedDocs = {}
for id, document in pairs(openDocuments) do
sortedDocs[#sortedDocs + 1] = {name = notebook:GetPageText(document.index),
document = document}
end
table.sort(sortedDocs, function(a, b) return string.upper(a.name) < string.upper(b.name) end)
for i,v in ipairs(sortedDocs) do
config_openDocuments[#config_openDocuments +1]=v.document.filePath
print(v.document.filePath)
end
---table.sort(config_openDocuments,function(a,b) return string.upper(a) < string.upper(b) end)
config_openDocuments.lastDirectory = lastDirectory
config:save_table("openDocuments",config_openDocuments)
end
function ConfigLoadOpenDocuments(config)
local config_openDocuments = config:load_table("openDocuments")
--prtable(config_openDocuments)
if config_openDocuments then
for i,v in ipairs(config_openDocuments) do
print(v)
abriredit(v)
end
lastDirectory = config_openDocuments.lastDirectory
else
abriredit(lua2scpath.."/examples/simple_theme.lua")
end
end
-- ----------------------------------------------------------------------------
-- Get/Set notebook editor page, use nil for current page, returns nil if none
function GetEditor(selection)
local editor = nil
if selection == nil then
selection = notebook:GetSelection()
end
if (selection >= 0) and (selection < notebook:GetPageCount()) then
editor = notebook:GetPage(selection):DynamicCast("wxStyledTextCtrl")
end
return editor
end
-- init new notebook page selection, use nil for current page
function SetEditorSelection(selection)
local editor = GetEditor(selection)
if editor then
editor:SetFocus()
editor:SetSTCFocus(true)
IsFileAlteredOnDisk(editor)
end
UpdateStatusText(editor) -- update even if nil
end
-- ----------------------------------------------------------------------------
-- Update the statusbar text of the frame using the given editor.
-- Only update if the text has changed.
statusTextTable = { "OVR?", "R/O?", "Cursor Pos","CodeP" }
function UpdateStatusText(editor)
local texts = { "", "", "" }
if frame and editor then
local pos = editor:GetCurrentPos()
local line = editor:LineFromPosition(pos)
local col = 1 + pos - editor:PositionFromLine(line)
texts = { iff(editor:GetOvertype(), "OVR", "INS"),
iff(editor:GetReadOnly(), "R/O", "R/W"),
"Ln "..tostring(line + 1).." Col "..tostring(col),
"CodeP "..tostring(editor:GetCodePage())}
for n = 1, 4 do
if (texts[n] ~= statusTextTable[n]) then
frame:SetStatusText(texts[n], n)
statusTextTable[n] = texts[n]
end
end
end
end
-- ----------------------------------------------------------------------------
-- Get file modification time, returns a wxDateTime (check IsValid) or nil if
-- the file doesn't exist
function GetFileModTime(filePath)
if filePath and (string.len(filePath) > 0) then
local fn = wx.wxFileName(filePath)
if fn:FileExists() then
return fn:GetModificationTime()
end
end
return nil
end
-- Check if file is altered, show dialog to reload it
function IsFileAlteredOnDisk(editor)
if not editor then return end
local id = editor:GetId()
if openDocuments[id] then
local filePath = openDocuments[id].filePath
local fileName = openDocuments[id].fileName
local oldModTime = openDocuments[id].modTime
if filePath and (string.len(filePath) > 0) and oldModTime and oldModTime:IsValid() then
local modTime = GetFileModTime(filePath)
if modTime == nil then
openDocuments[id].modTime = nil
wx.wxMessageBox(fileName.." is no longer on the disk.",
"Lua2SC Message",
wx.wxOK + wx.wxCENTRE, frame)
elseif modTime:IsValid() and oldModTime:IsEarlierThan(modTime) then
local ret = wx.wxMessageBox(fileName.." has been modified on disk.\nDo you want to reload it?",
"Lua2SC Message",
wx.wxYES_NO + wx.wxCENTRE, frame)
if ret ~= wx.wxYES or LoadFile(filePath, editor, true) then
openDocuments[id].modTime = nil
end
end
end
end
end
-- Set if the document is modified and update the notebook page text
function SetDocumentModified(id, modified)
local pageText = openDocuments[id].fileName or "untitled.lua"
if modified then
pageText = "* "..pageText
end
openDocuments[id].isModified = modified
notebook:SetPageText(openDocuments[id].index, pageText)
end
function IsLuaFile(filePath)
return filePath and (string.len(filePath) > 4) and
(string.lower(string.sub(filePath, -4)) == ".lua")
end
--]]
function InitDocumentsMenu()
local ID_DOCS=NewID()
local ID_CLOSEALL=NewID()
local ID_CLOSEALL_BUT_THIS=NewID()
local ID_SORT_DOCS = NewID()
local docsMenu=wx.wxMenu({
{ ID_CLOSEALL,"Close All","Close All" },
{ ID_CLOSEALL_BUT_THIS,"Close All But this","Close All But this" },
{ ID_SORT_DOCS,"Sort Alphabetic","Order Documents" },
{}
})
menuBar:Append(docsMenu, "Documents")
frame:Connect(ID_CLOSEALL, wx.wxEVT_COMMAND_MENU_SELECTED,function(event)
-- local editor = GetEditor()
-- local id = editor:GetId()
-- if SaveModifiedDialog(editor, true) ~= wx.wxID_CANCEL then
-- RemovePage(openDocuments[id].index,true)
-- end
for id, document in pairs(openDocuments) do
if (SaveModifiedDialog(document.editor, true) ~= wx.wxID_CANCEL) then
document.isModified = false
RemovePage(openDocuments[id].index,true)
end
end
end)
frame:Connect(ID_CLOSEALL_BUT_THIS, wx.wxEVT_COMMAND_MENU_SELECTED,function(event)
local editor = GetEditor()
local thisid = editor:GetId()
for id, document in pairs(openDocuments) do
if (thisid~=id) and (SaveModifiedDialog(document.editor, true) ~= wx.wxID_CANCEL) then
document.isModified = false
RemovePage(openDocuments[id].index,true)
end
end
end)
frame:Connect(ID_SORT_DOCS, wx.wxEVT_COMMAND_MENU_SELECTED,function(event)
local editor = GetEditor()
local thisid = editor:GetId()
local sortedDocs = {}
for id, document in pairs(openDocuments) do
sortedDocs[#sortedDocs + 1] = {name = notebook:GetPageText(document.index),
document = document}
-- notebook:RemovePage(document.index)
end
while notebook:GetPageCount() > 0 do
notebook:RemovePage(0)
end
table.sort(sortedDocs, function(a, b) return string.upper(a.name) < string.upper(b.name) end)
for i, v in ipairs(sortedDocs) do
notebook:AddPage(v.document.editor, v.name, true)
v.document.index = notebook:GetSelection()
end
notebook:SetSelection(openDocuments[thisid].index)
end)
end
-- -----------------------------------------------------------------
function InitFileMenu()
local ID_NEW = wx.wxID_NEW
local ID_OPEN = wx.wxID_OPEN
local ID_CLOSE = NewID()
local ID_SAVE = wx.wxID_SAVE
local ID_SAVEAS = wx.wxID_SAVEAS
local ID_SAVEALL = NewID()
local ID_EXIT = wx.wxID_EXIT
fileMenu = wx.wxMenu({
{ ID_NEW, "&New\tCtrl-N", "Create an empty document" },
{ ID_OPEN, "&Open...\tCtrl-O", "Open an existing document" },
{ ID_CLOSE, "&Close page\tCtrl+W", "Close the current editor window" },
{ },
{ ID_SAVE, "&Save\tCtrl-S", "Save the current document" },
{ ID_SAVEAS, "Save &As...\tAlt-S", "Save the current document to a file with a new name" },
{ ID_SAVEALL, "Save A&ll...\tCtrl-Shift-S", "Save all open documents" },
{ },
{ ID_EXIT, "E&xit\tAlt-X", "Exit Program" }})
menuBar:Append(fileMenu, "&File")
local ID_MRU=NewID()
mruMenu=wx.wxMenu()
fileMenu:Append(ID_MRU,"Recent Files",mruMenu)
file_history=wx.wxFileHistory()
file_history:Load(Config.config)
file_history:UseMenu(mruMenu)
file_history:AddFilesToMenu()
frame:Connect(ID_NEW, wx.wxEVT_COMMAND_MENU_SELECTED, NewFile)
frame:Connect(wx.wxID_FILE1, wx.wxID_FILE9, wx.wxEVT_COMMAND_MENU_SELECTED, function(event)
--print(file_history:GetHistoryFile(event:GetId() - wx.wxID_FILE1))
local file=file_history:GetHistoryFile(event:GetId() - wx.wxID_FILE1)
local ret=abriredit(file)
if not ret then
wx.wxMessageBox("Unable to load file '"..file.."'.",
"Lua2SC Error",
wx.wxOK + wx.wxCENTRE, frame)
file_history:RemoveFileFromHistory(event:GetId() - wx.wxID_FILE1)
end
end)
frame:Connect(ID_OPEN, wx.wxEVT_COMMAND_MENU_SELECTED, OpenFile)
frame:Connect(ID_SAVE, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event)
local editor = GetEditor()
local id = editor:GetId()
local filePath = openDocuments[id].filePath
SaveFile(editor, filePath)
end)
frame:Connect(ID_SAVE, wx.wxEVT_UPDATE_UI,
function (event)
local editor = GetEditor()
if editor then
local id = editor:GetId()
if openDocuments[id] then
event:Enable(openDocuments[id].isModified)
end
end
end)
frame:Connect(ID_SAVEAS, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event)
local editor = GetEditor()
SaveFileAs(editor)
end)
frame:Connect(ID_SAVEAS, wx.wxEVT_UPDATE_UI,
function (event)
local editor = GetEditor()
event:Enable(editor ~= nil)
end)
frame:Connect(ID_SAVEALL, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event)
SaveAll()
end)
frame:Connect(ID_SAVEALL, wx.wxEVT_UPDATE_UI,
function (event)
local atLeastOneModifiedDocument = false
for id, document in pairs(openDocuments) do
if document.isModified then
atLeastOneModifiedDocument = true
break
end
end
event:Enable(atLeastOneModifiedDocument)
end)
frame:Connect(ID_CLOSE, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event)
local editor = GetEditor()
local id = editor:GetId()
if SaveModifiedDialog(editor, true) ~= wx.wxID_CANCEL then
RemovePage(openDocuments[id].index,true)
end
end)
frame:Connect(ID_CLOSE, wx.wxEVT_UPDATE_UI,
function (event)
event:Enable((GetEditor() ~= nil))
end)
frame:Connect( ID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event)
if not SaveOnExit(true) then return end
frame:Close() -- will handle wxEVT_CLOSE_WINDOW
--CloseWatchWindow()
CloseScriptGUI()
end)
end
------------------------------------------
function NewFile(event)
local editor = CreateEditor("untitled.lua")
frame:SetTitle("untitled.lua")
--[[
print("codepage",editor:GetCodePage())
local _text = ""
for i=0,255 do
_text = _text .. string.char(i) .. string.format(" represents %4d\r\n",i)
end
local text2,rep = fixUTF8(_text,"\22")
--editor:AddText(wx.wxString(text2))
editor:AddTextRaw(_text)
--]]
--SetupKeywords(editor, true)
return editor
end
-- Find an editor page that hasn't been used at all, eg. an untouched NewFile()
function FindDocumentToReuse()
local editor = nil
for id, document in pairs(openDocuments) do
if (document.editor:GetLength() == 0) and
(not document.isModified) and (not document.filePath) and
not (document.editor:GetReadOnly() == true) then
editor = document.editor
print("FindDocumentToReuse",document.filePath)
break
end
end
return editor
end
function LoadFile(filePath, editor, file_must_exist)
local file_text = ""
local handle = io.open(filePath, "rb")
if handle then
file_text = handle:read("*a")
handle:close()
elseif file_must_exist then
return nil
end
if not editor then
editor = FindDocumentToReuse()
end
if not editor then
editor = CreateEditor(wx.wxFileName(filePath):GetFullName() or "untitled.lua")
end
editor:Clear()
editor:ClearAll()
--SetupKeywords(editor, IsLuaFile(filePath))
editor:MarkerDeleteAll(BREAKPOINT_MARKER)
editor:MarkerDeleteAll(CURRENT_LINE_MARKER)
editor:AppendText(file_text)
editor:EmptyUndoBuffer()
local id = editor:GetId()
openDocuments[id].filePath = filePath
openDocuments[id].fileName = wx.wxFileName(filePath):GetFullName()
openDocuments[id].modTime = GetFileModTime(filePath)
SetDocumentModified(id, false)
editor:Colourise(0, -1)
--openDocuments[id].identifiers=MakeIdentifiers(editor)
frame:SetTitle(filePath or "")
IdentifiersList:SetEditor(editor)
return editor
end
lastDirectory=""
function OpenFile(event)
--try to open current document folder
local editor = GetEditor()
if editor and openDocuments[editor:GetId()].filePath then
local fn = wx.wxFileName(openDocuments[editor:GetId()].filePath)
fn:Normalize()
lastDirectory = fn:GetPath(wx.wxPATH_GET_VOLUME)
end
local fileDialog = wx.wxFileDialog(frame, "Open file",
lastDirectory,
"",
"Lua files (*.lua)|*.lua|Text files (*.txt)|*.txt|All files (*)|*",
wx.wxFD_OPEN + wx.wxFD_FILE_MUST_EXIST)
if fileDialog:ShowModal() == wx.wxID_OK then
--if not LoadFile(fileDialog:GetPath(), nil, true) then
if not abriredit(fileDialog:GetPath(), nil) then
wx.wxMessageBox("Unable to load file '"..fileDialog:GetPath().."'.",
"Lua2SC Error",
wx.wxOK + wx.wxCENTRE, frame)
else
file_history:AddFileToHistory(fileDialog:GetPath())
lastDirectory=fileDialog:GetDirectory()
end
end
fileDialog:Destroy()
end
function _FileSelector(path,pattern,save)
local msg,flags
if save then
msg = "Save file as"
flags = wx.wxFD_SAVE + wx.wxFD_OVERWRITE_PROMPT
else
msg = "Open file"
flags = wx.wxFD_OPEN + wx.wxFD_FILE_MUST_EXIST
end
pattern= pattern or "*"
path=path or lastDirectory
local ret=""
local fileDialog = wx.wxFileDialog(frame, msg,
path,
"",
pattern.." files (*."..pattern..")|*."..pattern.."|All files (*)|*",
flags)
if fileDialog:ShowModal() == wx.wxID_OK then
ret= fileDialog:GetPath()
lastDirectory=fileDialog:GetDirectory()
end
fileDialog:Destroy()
return ret
end
-- save the file to filePath or if filePath is nil then call SaveFileAs
function SaveFile(editor, filePath)
if not filePath then
local saved =SaveFileAs(editor)
if saved then
IdentifiersList:SetEditor(editor)
end
else
local backPath = filePath..".bak"
os.remove(backPath)
os.rename(filePath, backPath)
local handle = io.open(filePath, "wb")
if handle then
local st = editor:GetText()
handle:write(st)
handle:close()
editor:EmptyUndoBuffer()
local id = editor:GetId()
openDocuments[id].filePath = filePath
openDocuments[id].fileName = wx.wxFileName(filePath):GetFullName()
openDocuments[id].modTime = GetFileModTime(filePath)
SetDocumentModified(id, false)
IdentifiersList:SetEditor(editor)
frame:SetTitle(filePath or "")
return true
else
wx.wxMessageBox("Unable to save file '"..filePath.."'.",
"Lua2SC Error Saving",
wx.wxOK + wx.wxCENTRE, frame)
end
end
return false
end
function SaveFileAs(editor)
local id = editor:GetId()
local saved = false
local fn = wx.wxFileName(openDocuments[id].filePath or lastDirectory.."/untitled.lua")
--print("openDocuments[id].filePath",openDocuments[id].filePath)
--print("lastDirectory",lastDirectory)
fn:Normalize() -- want absolute path for dialog
--print("fn es:",fn:GetPath(wx.wxPATH_GET_VOLUME))
local fileDialog = wx.wxFileDialog(frame, "Save file as",
fn:GetPath(wx.wxPATH_GET_VOLUME),
fn:GetFullName(),
"Lua files (*.lua)|*.lua|Text files (*.txt)|*.txt|All files (*)|*",
wx.wxFD_SAVE + wx.wxFD_OVERWRITE_PROMPT)
if fileDialog:ShowModal() == wx.wxID_OK then
local filePath = fileDialog:GetPath()
if SaveFile(editor, filePath) then
--SetupKeywords(editor, IsLuaFile(filePath))
saved = true
end
end
fileDialog:Destroy()
return saved
end
function SaveAll()
for id, document in pairs(openDocuments) do
local editor = document.editor
local filePath = document.filePath
if document.isModified then
SaveFile(editor, filePath) -- will call SaveFileAs if necessary
end
end
end
function RemovePage(index,delete)
local prevIndex = nil
local nextIndex = nil
local newOpenDocuments = {}
local todestroy
for id, document in pairs(openDocuments) do
if document.index < index then
newOpenDocuments[id] = document
prevIndex = document.index
elseif document.index == index then
--document.editor:Destroy()
todestroy=document.editor
elseif document.index > index then
document.index = document.index - 1
if nextIndex == nil then
nextIndex = document.index
end
newOpenDocuments[id] = document
end
end
openDocuments = newOpenDocuments
if delete then
--notebook:RemovePage(index)
-- todestroy:Destroy()
notebook:DeletePage(index)
if nextIndex then
notebook:SetSelection(nextIndex)
elseif prevIndex then
notebook:SetSelection(prevIndex)
end
SetEditorSelection(nil) -- will use notebook GetSelection to update
end
end
-- Show a dialog to save a file before closing editor.
-- returns wxID_YES, wxID_NO, or wxID_CANCEL if allow_cancel
function SaveModifiedDialog(editor, allow_cancel)
local result = wx.wxID_NO
local id = editor:GetId()
local document = openDocuments[id]
local filePath = document.filePath
local fileName = document.fileName
if document.isModified then
local message
if fileName then
message = "Save changes to '"..fileName.."' before exiting?"
else
message = "Save changes to 'untitled' before exiting?"
end
local dlg_styles = wx.wxYES_NO + wx.wxCENTRE + wx.wxICON_QUESTION
if allow_cancel then dlg_styles = dlg_styles + wx.wxCANCEL end
local dialog = wx.wxMessageDialog(frame, message,
"Save Changes?",
dlg_styles)
result = dialog:ShowModal()
dialog:Destroy()
if result == wx.wxID_YES then
SaveFile(editor, filePath)
end
end
return result
end
function SaveOnExit(allow_cancel)
for id, document in pairs(openDocuments) do
if (SaveModifiedDialog(document.editor, allow_cancel) == wx.wxID_CANCEL) then
return false
end
document.isModified = false
end
return true
end
function AppIDLE(event)
if exitingProgram then return end
local requestmore=false
---[[
--if not timer:IsRunning() then print("timer stoped") end
--if not checkstatus(script_lane) then print(script_lane.status) end
if checkendScript(script_lane) then
script_lane = nil
--print("collectgarbage",collectgarbage"count")
--collectgarbage()
--print("collectgarbage",collectgarbage"count")
end
local key,val=idlelinda:receive(0,"Metro","DoDir","_FileSelector","TextToClipBoard","prout","proutSC","debugger","QueueAction","statusSC","/status.reply","OSCReceive","_midiEventCb","wxeval" )
if val then
--print("idlelinda receive ",key,val)
if key=="prout" then
DisplayOutput(val[1],val[2])
elseif key=="proutSC" then
DisplayLog(val, ScLog)
for looppr = 1,10 do
local key2,val2 = idlelinda:receive(0,"proutSC")
if val2 then
DisplayLog(val2, ScLog)
else
break
end
end
elseif key=="debugger" then
for k,v in ipairs(val[3]) do
if v.what~="C" then
abriredit(v.source:sub(2),v.currentline)
break
end
end
--abriredit(val[1]:sub(2),val[2])
CallStack:MakeStack(val[3],"",val[4])
if val[5] then
EnableDebugCommands(val[5]);
end
elseif key=="Metro" then
toppanel:set_transport(val)
--timer:Start(300,wx.wxTIMER_ONE_SHOT)
lanes.timer(scriptlinda,"beatRequest",0.3,0)
elseif key=="TextToClipBoard" then
putTextToClipBoard(val)
elseif key=="statusSC" then
--thread_print("timerstatus")
IDESCSERVER:status()
elseif key=="/status.reply" then
toppanel:printStatus(val)
lanes.timer(idlelinda,"statusSC",1,0)
elseif key=="OSCReceive" then
OSCFunc.handleOSCReceive(val)
elseif key=="QueueAction" then
doQueueAction(val)
elseif key == "_midiEventCb" then
--if write note send to editor
if G_do_write_midi then
if val.type==midi.noteOn then
local editor = GetEditor()
if editor then
if not G_do_write_midi_number then
editor:AddText([["]] .. numberToNote(val.byte2) .. [[",]])
else
editor:AddText(tostring(val.byte2) .. [[,]])
end
end
end
end
elseif key=="DoDir" then
--print("receive DoDir")
local res={}
local function ff(n,l,p)
--print(n,l,p)
res[#res+1]={file=n,lev=l,path=p}
end
DoDir(ff,val[1],val[2],val[3])
--print("res es:")
--prtable(res)
val[4]:send("dodirResp",res)
elseif key=="_FileSelector" then
local res=_FileSelector(val[1],val[2],val[3])
val[4]:send("_FileSelectorResp",res)
elseif key == "wxeval" then
local succes,res = pcall(val[1])
val[2]:send("wxevalResp",{succes,res})
end
requestmore=true
end
if requestmore then event:RequestMore(true) end
--event:Skip()
end
function ToggleDebugMarker(editor, line)
local markers = editor:MarkerGet(line)
if markers >= CURRENT_LINE_MARKER_VALUE then
markers = markers - CURRENT_LINE_MARKER_VALUE
end
local id = editor:GetId()
if markers >= BREAKPOINT_MARKER_VALUE then
editor:MarkerDelete(line, BREAKPOINT_MARKER)
if debuggerlinda then
debuggerlinda:send("brpoints",{"delete","@"..openDocuments[editor:GetId()].filePath,line+1})
end
else
editor:MarkerAdd(line, BREAKPOINT_MARKER)
if debuggerlinda then
debuggerlinda:send("brpoints",{"add","@"..openDocuments[editor:GetId()].filePath,line+1})
end
end
end
function ClearAllCurrentLineMarkers()
for id, document in pairs(openDocuments) do
local editor = document.editor
editor:MarkerDeleteAll(CURRENT_LINE_MARKER)
end
end
--[[
frame:Connect(ID_TOGGLEBREAKPOINT, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event)
local editor = GetEditor()
local line = editor:LineFromPosition(editor:GetCurrentPos())
ToggleDebugMarker(editor, line)
end)
frame:Connect(ID_TOGGLEBREAKPOINT, wx.wxEVT_UPDATE_UI, OnUpdateUIEditMenu)
--]]
function SaveIfModified(editor)
local id = editor:GetId()
if openDocuments[id].isModified then
local saved = false
if not openDocuments[id].filePath then
local ret = wx.wxMessageBox("You must save the program before running it.\nPress cancel to abort running.","Save file?", wx.wxOK + wx.wxCANCEL + wx.wxCENTRE, frame)
if ret == wx.wxOK then
saved = SaveFileAs(editor)
end
else
saved = SaveFile(editor, openDocuments[id].filePath)
end
if saved then
openDocuments[id].isModified = false
else
return false -- not saved
end
end
return true -- saved
end
-----------------------------------------
ActionsQueue={}
function QueueAction(interval,action)
action.timestamp = lanes.now_secs() + interval
ActionsQueue[#ActionsQueue+1] = action
table.sort(ActionsQueue,function(a,b) return a.timestamp > b.timestamp end)
lanes.timer(idlelinda,"QueueAction",interval,0)
end
function doQueueAction(clocktimestamp)
local action=ActionsQueue[#ActionsQueue]
while action and action.timestamp <= lanes.now_secs() do
table.remove(ActionsQueue)
action[1](action[2])
action=ActionsQueue[#ActionsQueue]
--print("doit","\t",#ActionsQueue)
end
if #ActionsQueue > 0 then
lanes.timer(idlelinda,"QueueAction",ActionsQueue[#ActionsQueue].timestamp - lanes.now_secs(),0)
end
end
-----------------------------------------------------
local function strconcat(...)
local str=""
for i=1, select('#', ...) do
str = str .. tostring(select(i, ...)) .. "\t"
end
str = str .. "\n"
return str
end
function thread_print(...)
idlelinda:send("prout",{strconcat(...),false})
end
function thread_error_print(...)
idlelinda:send("prout",{strconcat(...),true})
end
function putTextToClipBoard(text)
local clipboard=wx.wxClipboard.Get()
if (clipboard:Open()) then
clipboard:SetData( wx.wxTextDataObject(text) );
clipboard:Close();
end
end
-- ---------------------------------------------------------------------------
-- Attach the handler for closing the frame
function CloseWindow(event)
exitingProgram = true -- don't handle focus events
if not SaveOnExit(event:CanVeto()) then
event:Veto()
exitingProgram = false
return
end
print("Main frame Closing")
wakeupidletimer:Stop()
local count_cancel = 0
while script_lane and (count_cancel < 10) do
--local cancelled,err=script_lane:cancel(0.1)
local cancelled,err = ideCancelScript(0.1)
print("script cancel on close",cancelled,err)
if cancelled then
script_lane = nil
end
count_cancel = count_cancel + 1
end
ConfigSaveOpenDocuments(Config)
file_history:Save(Config.config)
ConfigSavePerspectives()
CloseScriptGUI()
manager:UnInit();
Config:delete() -- always delete the config
config=nil
event:Skip()
if IDESCSERVER.inited then
IDESCSERVER:quit()
IDESCSERVER:close()
end
--midilane:cancel(0.1)
--MidiClose()
--pmidi.exit_midi_thread()
print("Main frame Closed")
end
AppInit()
wx.wxGetApp():MainLoop()
--]===]
|
--- Module implementing the LuaRocks "purge" command.
-- Remove all rocks from a given tree.
module("luarocks.purge", package.seeall)
local util = require("luarocks.util")
local fs = require("luarocks.fs")
local path = require("luarocks.path")
local search = require("luarocks.search")
local deps = require("luarocks.deps")
local repos = require("luarocks.repos")
local manif = require("luarocks.manif")
local cfg = require("luarocks.cfg")
help_summary = "Remove all installed rocks from a tree."
help_arguments = "--tree=<tree>"
help = [[
This command removes all rocks from a given tree.
The --tree argument is mandatory: luarocks purge does not
assume a default tree.
]]
function run(...)
local flags = util.parse_flags(...)
local tree = flags["tree"]
if type(tree) ~= "string" then
return nil, "The --tree argument is mandatory, see help."
end
local results = {}
local query = search.make_query("")
query.exact_name = false
search.manifest_search(results, path.rocks_dir(tree), query)
for package, versions in util.sortedpairs(results) do
for version, repositories in util.sortedpairs(versions, function(a,b) return deps.compare_versions(b,a) end) do
util.printout("Removing "..package.." "..version.."...")
local ok, err = repos.delete_version(package, version, true)
if not ok then
util.printerr(err)
end
end
end
return manif.make_manifest(cfg.rocks_dir, "one")
end
|
if not CREDENTIALS.sentry then return end
require("xlib_sentry")
if not sentry then
XLIB.Warn("Sentry did not require() correctly")
return
end
local options = {}
-- Make a copy so we can modify it
for k, v in pairs(CREDENTIALS.sentry.options or {}) do
options[k] = v
end
if options.auto and (options.auto:lower() ~= "true" or options.auto ~= "1") then
print('XLIB Sentry automatic loading disabled. Either unset CREDENTIAL_STORE.sentry.auto or set to "auto" or "1" to re-enable.)')
return
end
options.no_detour = (options.no_detour or ""):Split(" ")
sentry.Setup(CREDENTIALS.sentry.dsn, options)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.