content
stringlengths 5
1.05M
|
---|
if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
end
if ( CLIENT ) then
SWEP.PrintName = "DH-17"
SWEP.Author = "Syntax_Error752"
SWEP.ViewModelFOV = 70
SWEP.Slot = 1
SWEP.SlotPos = 5
SWEP.WepSelectIcon = surface.GetTextureID("HUD/killicons/DH17")
killicon.Add( "weapon_752_dh17", "HUD/killicons/DH17", Color( 255, 80, 0, 255 ) )
end
SWEP.HoldType = "pistol"
SWEP.Base = "weapon_swsft_base"
SWEP.Category = "Star Wars"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_DH17.mdl"
SWEP.WorldModel = "models/weapons/w_DH17.mdl"
local FireSound = Sound ("weapons/DH17_fire.wav");
local ReloadSound = Sound ("weapons/DH17_reload.wav");
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Recoil = 0.5
SWEP.Primary.Damage = 18.75
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.02
SWEP.Primary.ClipSize = 25
SWEP.Primary.Delay = 0.2
SWEP.Primary.DefaultClip = 75
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "ar2"
SWEP.Primary.Tracer = "effect_sw_laser_red"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.IronSightsPos = Vector (-3.7, -9, 1)
function SWEP:PrimaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
if ( !self:CanPrimaryAttack() ) then return end
// Play shoot sound
self.Weapon:EmitSound( FireSound )
// Shoot the bullet
self:CSShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone )
// Remove 1 bullet from our clip
self:TakePrimaryAmmo( 1 )
if ( self.Owner:IsNPC() ) then return end
// Punch the player's view
self.Owner:ViewPunch( Angle( math.Rand(-1,1) * self.Primary.Recoil, math.Rand(-1,1) *self.Primary.Recoil, 0 ) )
// In singleplayer this function doesn't get called on the client, so we use a networked float
// to send the last shoot time. In multiplayer this is predicted clientside so we don't need to
// send the float.
if ( (game.SinglePlayer() && SERVER) || CLIENT ) then
self.Weapon:SetNetworkedFloat( "LastShootTime", CurTime() )
end
end
function SWEP:CSShootBullet( dmg, recoil, numbul, cone )
numbul = numbul or 1
cone = cone or 0.01
local bullet = {}
bullet.Num = numbul
bullet.Src = self.Owner:GetShootPos() // Source
bullet.Dir = self.Owner:GetAimVector() // Dir of bullet
bullet.Spread = Vector( cone, cone, 0 ) // Aim Cone
bullet.Tracer = 1 // Show a tracer on every x bullets
bullet.TracerName = self.Primary.Tracer
bullet.Force = 5 // Amount of force to give to phys objects
bullet.Damage = dmg
self.Owner:FireBullets( bullet )
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) // View model animation
self.Owner:MuzzleFlash() // Crappy muzzle light
self.Owner:SetAnimation( PLAYER_ATTACK1 ) // 3rd Person Animation
if ( self.Owner:IsNPC() ) then return end
// CUSTOM RECOIL !
if ( (game.SinglePlayer() && SERVER) || ( !game.SinglePlayer() && CLIENT && IsFirstTimePredicted() ) ) then
local eyeang = self.Owner:EyeAngles()
eyeang.pitch = eyeang.pitch - recoil
self.Owner:SetEyeAngles( eyeang )
end
end
function SWEP:Reload()
if self:GetNWBool("Scoped") then
self.Weapon:SetNWBool("Scoped", false)
self.Owner:GetViewModel():SetNoDraw(false)
self.Owner:SetFOV( 0, 0.25 )
self:AdjustMouseSensitivity()
end
if (self.Weapon:Clip1() < self.Primary.ClipSize) then
if self.Owner:GetAmmoCount(self.Primary.Ammo) > 0 then
self.Weapon:EmitSound( ReloadSound )
end
self.Weapon:DefaultReload( ACT_VM_RELOAD_EMPTY );
self:SetIronsights( false )
end
end
function SWEP:SecondaryAttack()
if ( !self.IronSightsPos ) then return end
if ( self.NextSecondaryAttack > CurTime() ) then return end
bIronsights = !self.Weapon:GetNetworkedBool( "Ironsights", false )
self:SetIronsights( bIronsights )
self.NextSecondaryAttack = CurTime() + 0.3
if self:GetNWBool("Scoped") then
self.Weapon:SetNWBool("Scoped", false)
self.Owner:GetViewModel():SetNoDraw(false)
self.Owner:SetFOV( 0, 0.25 )
self:AdjustMouseSensitivity()
elseif not self:GetNWBool("Scoped") then
self.Weapon:SetNWBool("Scoped", true)
self.Owner:GetViewModel():SetNoDraw(true)
self.Owner:SetFOV( 40, 0.25 )
self:AdjustMouseSensitivity()
self.Weapon:EmitSound( "weapons/scope_zoom_sw752.wav" )
end
end
function SWEP:AdjustMouseSensitivity()
if self:GetNWBool("Scoped") then
return 0.1
else if not self:GetNWBool("Scoped") then
return -1
end
end
end
function SWEP:DrawHUD()
if (CLIENT) then
if not self:GetNWBool("Scoped") then
local x, y
if ( self.Owner == LocalPlayer() && self.Owner:ShouldDrawLocalPlayer() ) then
local tr = util.GetPlayerTrace( self.Owner )
// tr.mask = ( CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_GRATE|CONTENTS_AUX )
local trace = util.TraceLine( tr )
local coords = trace.HitPos:ToScreen()
x, y = coords.x, coords.y
else
x, y = ScrW() / 2.0, ScrH() / 2.0
end
local scale = 10 * self.Primary.Cone
local LastShootTime = self.Weapon:GetNetworkedFloat( "LastShootTime", 0 )
scale = scale * (2 - math.Clamp( (CurTime() - LastShootTime) * 5, 0.0, 1.0 ))
surface.SetDrawColor( 255, 0, 0, 255 )
local gap = 40 * scale
local length = gap + 20 * scale
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
return;
end
local Scale = ScrH()/480
local w, h = 320*Scale, 240*Scale
local cx, cy = ScrW()/2, ScrH()/2
local scope_sniper_lr = surface.GetTextureID("hud/scopes/752/scope_synsw_lr")
local scope_sniper_ll = surface.GetTextureID("hud/scopes/752/scope_synsw_ll")
local scope_sniper_ul = surface.GetTextureID("hud/scopes/752/scope_synsw_ul")
local scope_sniper_ur = surface.GetTextureID("hud/scopes/752/scope_synsw_ur")
local SNIPERSCOPE_MIN = -0.75
local SNIPERSCOPE_MAX = -2.782
local SNIPERSCOPE_SCALE = 0.4
local x = ScrW() / 2.0
local y = ScrH() / 2.0
surface.SetDrawColor( 0, 0, 0, 255 )
local gap = 0
local length = gap + 9999
surface.SetDrawColor( 0, 0, 0, 255 )
--[[
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
]]--
render.UpdateRefractTexture()
surface.SetDrawColor(255, 255, 255, 255)
surface.SetTexture(scope_sniper_lr)
surface.DrawTexturedRect(cx, cy, w, h)
surface.SetTexture(scope_sniper_ll)
surface.DrawTexturedRect(cx-w, cy, w, h)
surface.SetTexture(scope_sniper_ul)
surface.DrawTexturedRect(cx-w, cy-h, w, h)
surface.SetTexture(scope_sniper_ur)
surface.DrawTexturedRect(cx, cy-h, w, h)
surface.SetDrawColor(0, 0, 0, 255)
if cx-w > 0 then
surface.DrawRect(0, 0, cx-w, ScrH())
surface.DrawRect(cx+w, 0, cx-w, ScrH())
end
end
end
|
object_tangible_furniture_decorative_wod_pro_tree_04 = object_tangible_furniture_decorative_shared_wod_pro_tree_04:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_decorative_wod_pro_tree_04, "object/tangible/furniture/decorative/wod_pro_tree_04.iff")
|
local World = BaseClass()
ECS.World = World
ECS.World.allWorlds = {}
function World:Constructor( name )
self.name = name
self.behaviour_mgrs = {}
self.behaviour_mgrs_lookup = {}
setmetatable(self.behaviour_mgrs_lookup, {__mode = "kv"})
self.IsCreated = true
table.insert(ECS.World.allWorlds, self)
end
function World:GetBehaviourManagers( )
return self.behaviour_mgrs
end
function World:GetOrCreateManager( script_behaviour_mgr_type )
local mgr = self:GetExistingManager(script_behaviour_mgr_type)
if not mgr then
mgr = self:CreateManager(script_behaviour_mgr_type)
end
return mgr
end
function World:CreateManager( script_behaviour_mgr_type )
assert(script_behaviour_mgr_type, "World:CreateManager nil mgr type")
local mgr = script_behaviour_mgr_type.New()
table.insert(self.behaviour_mgrs, mgr)
self.behaviour_mgrs_lookup[script_behaviour_mgr_type] = mgr
return mgr
end
function World:GetExistingManager( script_behaviour_mgr_type )
return self.behaviour_mgrs_lookup[script_behaviour_mgr_type]
end
function World:DestroyManager( )
end
return World
|
-- Copyright 2008 Steven Barth <[email protected]>
-- Licensed to the public under the Apache License 2.0.
require("luci.sys")
require("luci.sys.zoneinfo")
require("luci.tools.webadmin")
require("luci.util")
m = Map("system", translate("System"), translate("Here you can configure the basic aspects of your device like its hostname or the timezone."))
s = m:section(TypedSection, "system", "")
s.anonymous = true
s.addremove = false
local sysinfo = luci.util.ubus("system", "info") or { }
local boardinfo = luci.util.ubus("system", "board") or { }
local uptime = sysinfo.uptime or 0
local loads = sysinfo.load or { 0, 0, 0 }
local memory = sysinfo.memory or {
total = 0,
free = 0,
buffered = 0,
shared = 0
}
s:option(DummyValue, "_system", translate("Model")).value = boardinfo.model or "?"
s:option(DummyValue, "_cpu", translate("System")).value = boardinfo.system or "?"
s:option(DummyValue, "_la", translate("Load")).value =
string.format("%.2f, %.2f, %.2f", loads[1] / 65535.0, loads[2] / 65535.0, loads[3] / 65535.0)
s:option(DummyValue, "_memtotal", translate("Memory")).value =
string.format("%.2f MB (%.0f%% %s, %.0f%% %s)",
tonumber(memory.total) / 1024 / 1024,
100 * memory.buffered / memory.total,
tostring(translate("buffered")),
100 * memory.free / memory.total,
tostring(translate("free"))
)
s:option(DummyValue, "_systime", translate("Local Time")).value =
os.date("%c")
s:option(DummyValue, "_uptime", translate("Uptime")).value =
luci.tools.webadmin.date_format(tonumber(uptime))
hn = s:option(Value, "hostname", translate("Hostname"))
function hn.write(self, section, value)
Value.write(self, section, value)
luci.sys.hostname(value)
end
tz = s:option(ListValue, "zonename", translate("Timezone"))
tz:value("UTC")
for i, zone in ipairs(luci.sys.zoneinfo.TZ) do
tz:value(zone[1])
end
function tz.write(self, section, value)
local function lookup_zone(title)
for _, zone in ipairs(luci.sys.zoneinfo.TZ) do
if zone[1] == title then return zone[2] end
end
end
AbstractValue.write(self, section, value)
self.map.uci:set("system", section, "timezone", lookup_zone(value) or "GMT0")
end
return m
|
local PlatModule = {}
local HPL = 32 --Half PLatform length
local PL = 64 --Full PLatform length
local PW = 8 --Platform width
local ps = 128 --Platform speed
local MD = 0.1 --Maximal deviation
function PlatModule.__index(t, k)
return rawget(t, k) or PlatModule[k]
end
local function lerp(x, a, b)
if a > b then
return lerp(x, b, a)
elseif x < a then
return a
elseif x > b then
return b
end
return x
end
function PlatModule.new(angle, cx, cy, upperLimit, lowerLimit, localPlayer)
local sin, cos = math.sin(angle), math.cos(angle)
local t = {}
t.angle = angle
t.center = {cx, cy} --Platform line center
t.limits = {upperLimit, lowerLimit} --Platform Y limits
if math.abs(sin) < math.sin(0.5) then --Freaking inaccurate trigonometric functions
t.olimits = {(lowerLimit - cx) - HPL, (upperLimit - cx) + HPL}
else
t.olimits = {(lowerLimit - cy) / sin + HPL + PW * cos, (upperLimit - cy) / sin - HPL - PW * cos} --Platform X limits relative to the PLatform line
end
t.offset = 0 --X offset relative to the PLatform line
t.localPlayer = localPlayer --false if the platform is controlled by AI or online player
return setmetatable(t, PlatModule)
end
function PlatModule.move(t, offset)
t.offset = lerp(t.offset + offset * ps, t.olimits[1], t.olimits[2])
end
function PlatModule.draw(t)
love.graphics.push()
love.graphics.translate(unpack(t.center))
love.graphics.rotate(t.angle)
love.graphics.rectangle('fill', t.offset - HPL, -PW, PL, PW)
love.graphics.pop()
end
-- Ball intersection test functions
--bx, by, br = Ball X, Ball Y, Ball radius
local function intersectionPoints(a, b, c, br)
local fds = a*a+b*b --Factor vector's dot product with itself
assert(fds ~= 0, "A and B factors both are equal to zero")
local d = c*c - br*br*fds
local ad = math.abs(d)
local x0, y0 = -a*c/fds, -b*c/fds
if d > MD then
return
elseif ad < MD then
return {x0, y0}
else
local k = br*br - c*c / fds
local m = math.sqrt(k / fds)
return {x0 + b*m, y0 - a*m}, {x0 - b*m, y0 + a*m}
end
end
local function between(x, a, b)
if a > b then
return between(x, b, a)
end
return a <= x and x <= b
end
local function getABC(x1, y1, x2, y2)
return y1 - y2, x2 - x1, x1*y2 - x2*y1
end
local function det(a, b, c, d)
return a*d - c*b
end
local function intersects(x1, y1, x2, y2, br) --Intersection points of the ball and the platform
local a, b, c = getABC(x1, y1, x2, y2)
local i1, i2 = intersectionPoints(a, b, c, br)
if i1 == nil then
return
elseif i2 == nil then
i2 = i1
end
return i1, i2
end
function PlatModule.rayIntersects(t, x3, y3, x4, y4, inside)
--(x3, y3) = ray start, (x4, y4) = second ray point, inside = inside the platform limits
local sin, cos = math.sin(t.angle), math.cos(t.angle)
local cx, cy = t.center[1], t.center[2]
local x1, y1 = cx + (t.offset + HPL) * cos, cy + (t.offset + HPL) * sin
local x2, y2 = cx + (t.offset - HPL) * cos, cy + (t.offset - HPL) * sin
local a1, b1, c1 = getABC(x1, y1, x2, y2)
local a2, b2, c2 = getABC(x3, y3, x4, y4)
local div = det(a1, b1, a2, b2)
if div == 0 then
return
end
local ix, iy
ix = -det(c1, b1, c2, b2) / div
iy = -det(a1, c1, a2, c2) / div
if (ix - x3) * (x4 - x3) < 0 then --Check if the intersection point is on the ray
return
end
if inside then
if t.angle == math.pi then
if not between(ix, t.limits[1], t.limits[2]) then
return
end
elseif not between(iy, t.limits[1], t.limits[2]) then
return
end
end
return ix, iy
end
function PlatModule.intersects(t, bx, by, br)
local sin, cos = math.sin(t.angle), math.cos(t.angle)
local cx, cy = t.center[1], t.center[2]
local dx, dy = cx - bx, cy - by
local x1, y1 = dx + (t.offset + HPL) * cos, dy + (t.offset + HPL) * sin
local x2, y2 = dx + (t.offset - HPL) * cos, dy + (t.offset - HPL) * sin
local i1, i2 = intersects(x1, y1, x2, y2, br)
if i1 ~= nil then
return between(i1[1], x2, x1) or between(i2[1], x2, x1)
elseif dx*dx + dy*dy <= br * br then
return true
end
end
function PlatModule.getX(t, y)
local cx, cy = t.center[1], t.center[2]
local ctg = 1 / math.tan(t.angle)
if t.angle == math.pi / 2 then
return cx
end
return cx + (y - cy) * ctg
end
function PlatModule.getY(t, x)
local cx, cy = t.center[1], t.center[2]
local tg = math.tan(t.angle)
if t.angle == math.pi / 2 then
return cy
end
return cy + (x - cx) * tg
end
function PlatModule.getCurY(t)
return t.center[2] + t.offset * math.sin(t.angle)
end
function PlatModule.lost(t, bx, by, br)
local cx, cy = t.center[1] - bx, t.center[2] - by
local sin, cos = math.sin(t.angle), math.cos(t.angle)
local x1, y1 = cx + HPL * cos, cy + HPL * sin
local i1, i2 = intersects(cx, cy, x1, y1, br)
if i1 then
return true
end
end
return PlatModule
|
local KEYWORDS = {
["and"] = true, ["break"] = true, ["do"] = true, ["else"] = true,
["elseif"] = true, ["end"] = true, ["false"] = true, ["for"] = true,
["function"] = true, ["if"] = true, ["in"] = true, ["local"] = true,
["nil"] = true, ["not"] = true, ["or"] = true, ["repeat"] = true,
["return"] = true, ["then"] = true, ["true"] = true, ["until"] = true,
["while"] = true
}
local function isValidVariable(variable)
return variable ~= "" and KEYWORDS[variable] == nil and string.find(variable, "^[_%a]+[_%w]+$") ~= nil
end
local function amountify(amount)
return amount == 1 and "is " .. amount or "are " .. amount
end
local function pluralize(amount, string)
return amount == 1 and string or string .. "s"
end
local function leadingZeros(formatter, argument, argumentLeadingZeros)
if type(argument) ~= "number" then
formatter:writeRaw(tostring(argument))
else
argument = tostring(argument)
formatter:writeRaw(string.rep("0", argumentLeadingZeros - #argument) .. argument)
end
end
local function width(formatter, argument, argumentWidth)
argument = tostring(argument)
formatter:writeRaw(argument .. string.rep(" ", argumentWidth - #argument))
end
local function debugTable(formatter, tbl)
formatter:writeRaw("{")
for key, value in pairs(tbl) do
formatter:write("[{:?}] = {:?}", key, value)
if next(tbl, key) ~= nil then
formatter:writeRaw(", ")
end
end
formatter:writeRaw("}")
end
local function debugTableExtended(formatter, tbl)
-- Special case for empty tables.
if next(tbl) == nil then
formatter:writeRaw("{}")
return
end
formatter:writeLineRaw("{")
formatter:indent()
for key, value in pairs(tbl) do
formatter:write("[{:?}] = {:#?}", key, value)
if next(tbl, key) ~= nil then
formatter:writeRaw(",")
end
formatter:writeLine("")
end
formatter:unindent()
formatter:writeRaw("}")
end
local function debugImpl(formatter, argument, isExtendedForm)
local argumentType = typeof(argument)
if argumentType == "string" then
formatter:writeRaw(string.format("%q", argument))
elseif argumentType == "table" then
local argumentMetatable = getmetatable(argument)
if argumentMetatable ~= nil and argumentMetatable.__fmtDebug ~= nil then
-- This type implements the metamethod we made up to line up with
-- Rust's `Debug` trait.
-- TODO: Handle this weird case with new output...
argumentMetatable.__fmtDebug(argument, formatter, isExtendedForm)
else
formatter:addTable(argument)
formatter:lock()
if isExtendedForm then
debugTableExtended(formatter, argument)
else
debugTable(formatter, argument)
end
formatter:unlock()
end
elseif argumentType == "Instance" then
formatter:writeRaw(argument:GetFullName())
else
formatter:writeRaw(tostring(argument))
end
end
local function precision(formatter, argument, argumentPrecision)
if type(argument) ~= "number" then
formatter:writeRaw(tostring(argument))
else
formatter:writeRaw(string.format("%." .. argumentPrecision .. "f", tostring(argument)))
end
end
local function sign(formatter, argument)
if type(argument) ~= "number" then
formatter:writeRaw(tostring(argument))
else
formatter:writeRaw(argument >= 0 and "+" .. tostring(argument) or tostring(argument))
end
end
local function interpolate(formatter, parameter, writer)
local formatParameterStart = string.find(parameter, ":")
local leftSide = string.sub(parameter, 1, formatParameterStart and formatParameterStart - 1 or -1)
local rightSide = formatParameterStart ~= nil and string.sub(parameter, formatParameterStart + 1 or -1) or nil
local positionalParameter = tonumber(leftSide)
local isRegularParameter = leftSide == ""
local argument
if positionalParameter ~= nil then
if positionalParameter < 0 or positionalParameter % 1 ~= 0 then
error("Invalid positional parameter `" .. positionalParameter .. "`.", 4)
end
if positionalParameter + 1 > #writer.arguments then
error("Invalid positional argument " .. positionalParameter .. " (there " .. amountify(#writer.arguments) .. " " .. pluralize(#writer.arguments, "argument") .. "). Note: Positional arguments are zero-based.", 4)
end
writer.biggestPositionalParameter = math.max(writer.biggestPositionalParameter, positionalParameter + 1)
argument = writer.arguments[positionalParameter + 1]
elseif isRegularParameter then
writer.currentArgument += 1
argument = writer.arguments[writer.currentArgument]
else
if not isValidVariable(leftSide) then
error("Invalid named parameter `" .. leftSide .. "`.", 4)
end
if writer.namedParameters == nil or writer.namedParameters[leftSide] == nil then
error("There is no named argument `" .. leftSide .. "`.", 4)
end
writer.hadNamedParameter = true
argument = writer.namedParameters[leftSide]
end
if rightSide ~= nil then
local number = tonumber(rightSide)
local firstCharacter = string.sub(rightSide, 1, 1)
local numberAfterFirstCharacter = tonumber(string.sub(rightSide, 2))
if rightSide == "?" then
debugImpl(formatter, argument, false)
elseif rightSide == "#?" then
debugImpl(formatter, argument, true)
elseif rightSide == "+" then
sign(formatter, argument)
elseif firstCharacter == "." and numberAfterFirstCharacter ~= nil then
precision(formatter, argument, numberAfterFirstCharacter)
elseif firstCharacter == "0" and numberAfterFirstCharacter ~= nil then
leadingZeros(formatter, argument, numberAfterFirstCharacter)
elseif number ~= nil and number > 0 then
width(formatter, argument, number)
else
error("Unsupported format parameter `" .. rightSide .. "`.", 4)
end
else
formatter:writeRaw(tostring(argument))
end
end
local function composeWriter(arguments)
local lastArgument = arguments[#arguments]
return {
arguments = arguments;
currentArgument = 0;
biggestPositionalParameter = 0;
namedParameters = type(lastArgument) == "table" and lastArgument or nil;
hadNamedParameter = false;
}
end
local function writeFmt(formatter, template, ...)
local index = 1
local writer = composeWriter({...})
while index <= #template do
local brace = string.find(template, "[%{%}]", index)
-- There are no remaining braces in the string, so we can write the
-- rest of the string to the formatter.
if brace == nil then
formatter:writeRaw(string.sub(template, index))
break
end
local braceCharacter = string.sub(template, brace, brace)
local characterAfterBrace = string.sub(template, brace + 1, brace + 1)
if characterAfterBrace == braceCharacter then
-- This brace starts a literal '{', written as '{{'.
formatter:writeRaw(braceCharacter)
index = brace + 2
else
if braceCharacter == "}" then
error("Unmatched '}'. If you intended to write '}', you can escape it using '}}'.", 3)
else
local closeBrace = string.find(template, "}", index + 1)
if closeBrace == nil then
error("Expected a '}' to close format specifier. If you intended to write '{', you can escape it using '{{'.", 3)
else
-- If there are any unwritten characters before this
-- parameter, write them to the formatter.
if brace - index > 0 then
formatter:writeRaw(string.sub(template, index, brace - 1))
end
local formatSpecifier = string.sub(template, brace + 1, closeBrace - 1)
interpolate(formatter, formatSpecifier, writer)
index = closeBrace + 1
end
end
end
end
local numberOfArguments = writer.hadNamedParameter and #writer.arguments - 1 or #writer.arguments
if writer.currentArgument > numberOfArguments then
error(writer.currentArgument .. " " .. pluralize(writer.currentArgument, "parameter") .. " found in template string, but there " .. amountify(numberOfArguments) .. " " .. pluralize(numberOfArguments, "argument") .. ".", 3)
end
if numberOfArguments > writer.currentArgument and writer.biggestPositionalParameter < numberOfArguments then
error(writer.currentArgument .. " " .. pluralize(writer.currentArgument, "parameter") .. " found in template string, but there " .. amountify(numberOfArguments) .. " " .. pluralize(numberOfArguments, "argument") .. ".", 3)
end
end
return writeFmt
|
fx_version 'cerulean'
game 'gta5'
description 'QB-cnr'
version '1.0.0'
shared_script 'config.lua'
server_script 'server/*.lua'
client_scripts {
'client/*.lua'
}
files {
}
lua54 'yes'
|
--花騎士団の白馬
--Script by XyLeN
function c100425021.initial_effect(c)
--special summon rule
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM)
e1:SetTargetRange(POS_FACEUP_DEFENSE,0)
e1:SetCountLimit(1,100425021+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c100425021.spcon)
c:RegisterEffect(e1)
--negate attack
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100425021,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,100425021)
e2:SetCondition(c100425021.negcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c100425021.negtg)
e2:SetOperation(c100425021.negop)
c:RegisterEffect(e2)
end
function c100425021.spfilter(c)
return c:IsFaceup() and c:IsLevelBelow(2)
end
function c100425021.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.IsExistingMatchingCard(c100425021.spfilter,tp,LOCATION_MZONE,0,1,nil,tp)
end
function c100425021.negcon(e,tp,eg,ep,ev,re,r,rp)
local at=Duel.GetAttacker()
return at:GetControler()~=tp
end
function c100425021.negtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and aux.TRUE(chkc) end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c100425021.negop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if Duel.NegateAttack() and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
|
--[[
Copyright 2021 Manticore Games, Inc.
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.
--]]
------------------------------------------------------------------------------------------------------------------------
-- Slots Trigger Manager Client
-- Author Morticai (META) - (https://www.coregames.com/user/d1073dbcc404405cbef8ce728e53d380)
-- Date: 2021/5/20
-- Version 0.0.1
------------------------------------------------------------------------------------------------------------------------
-- REQUIRES
------------------------------------------------------------------------------------------------------------------------
local API = require(script:GetCustomProperty("API"))
------------------------------------------------------------------------------------------------------------------------
-- OBJECTS
------------------------------------------------------------------------------------------------------------------------
local LOCAL_PLAYER = Game.GetLocalPlayer()
local Networking = script:GetCustomProperty("Networking"):WaitForObject()
------------------------------------------------------------------------------------------------------------------------
-- LOCAL FUNCTIONS
------------------------------------------------------------------------------------------------------------------------
while not LOCAL_PLAYER.clientUserData.SlotTriggers do
Task.Wait()
end
local function OnDisable()
for _, trigger in pairs(LOCAL_PLAYER.clientUserData.SlotTriggers) do
trigger.isInteractable = false
end
end
local function OnEnable()
if LOCAL_PLAYER.clientUserData.slotId then
OnDisable()
else
for slotId, trigger in pairs(LOCAL_PLAYER.clientUserData.SlotTriggers) do
local triggerData = Networking:FindChildByName(slotId)
if triggerData then
local playerId = triggerData:GetCustomProperty("playerId")
if playerId == "" then
trigger.isInteractable = true
else
trigger.isInteractable = false
end
end
Task.Wait()
end
end
end
------------------------------------------------------------------------------------------------------------------------
-- LISTENERS
------------------------------------------------------------------------------------------------------------------------
Events.Connect(API.Broadcasts.enableTriggers, OnEnable)
OnEnable()
|
--region CSize.lua
--Author : jefflwq
--Date : 2016/04/24
--说明 : Size类
--endregion
using "Joop"
namespace "System.Drawing"
{
class "CSize"
{
-- 此 Size 的 Width 。
Width = false,
-- 此 Size 的 Height 。
Height = false,
-- 初始化 Size 类的新实例。
CSize =
function(self, width, height)
self.Width = width or 0
self.Height = height or 0
end,
SetSize =
function(self, width, height)
self.Width = width or 0
self.Height = height or 0
end,
GetSize =
function(self)
return self.Width, self.Height
end,
Empty =
function(self)
self.Width = 0
self.Height = 0
end,
-- 获取一个值,该值指示此 Size 是否为空。
-- 返回结果:
-- 如果 Width 和 Height 均为 0,则为 true;否则为 false。
IsEmpty =
function(self)
return self.Width == 0 and self.Height == 0
end,
-- 指定此 Size 是否与指定 size 相同。
Equals =
function(self, size)
return self.Width == size.Width and self.Height == size.Height
end,
-- 克隆此 Size。
Clone =
function(self)
return CSize(self.Width, self.Height)
end,
-- 将此 Size 加上指定的 Size。
Add =
function(self, size)
self.Width = self.Width + size.Width
self.Height = self.Height + size.Height
end,
AddWH =
function(self, width, height)
self.Width = self.Width + width
self.Height = self.Height + height
end,
-- 将此 Size 减去指定的 Size。
Subtract =
function(self, size)
self.Width = self.Width - size.Width
self.Height = self.Height - size.Height
end,
SubtractWH =
function(self, width, height)
self.Width = self.Width - width
self.Height = self.Height - height
end,
-- 将此 Size 转换为可读字符串。
ToString =
function(self)
return "Width=" .. self.Width .. ", Height=" .. self.Height
end,
}
}
|
if oo == nil then oo = require "loop.base" end
function assertClassMembers(object)
assert(oo.isinstanceof(object, Class) == true)
assert(object.classAttrib == "classAttrib")
assert(object:classMethod() == "classMethod")
assert(object.classMethod == methods.classMethod)
assert(rawget(object, "classAttrib") == nil)
assert(rawget(object, "classMethod") == nil)
end
function assertNoObjectMembers(object)
assert(object.attrib == nil)
assert(object.method == nil)
end
function assertObjectMembers(object)
assert(object.attrib == "attribute")
assert(object:method() == "method")
assert(object.method == methods.method)
assert(rawget(object, "attrib") == "attribute")
assert(rawget(object, "method") == methods.method)
end
local tabop = require "loop.table"
methods = tabop.memoize(function(name)
return function(self)
local class = assert(oo.getclass(self))
assert(oo.isclass(class))
return name
end
end)
Class = oo.class{
classAttrib = "classAttrib",
classMethod = methods.classMethod,
}
do -- oo.getmember
assert(Class.classAttrib == "classAttrib")
assert(Class.classMethod == methods.classMethod)
assert(oo.getmember(Class, "classAttrib") == "classAttrib")
assert(oo.getmember(Class, "classMethod") == methods.classMethod)
end
do -- oo.members
local expected = {
classAttrib = "classAttrib",
classMethod = methods.classMethod,
}
for name, value in oo.members(Class) do
if name ~= "__index" then
local expectedvalue = expected[name]
expected[name] = nil
assert(expectedvalue ~= nil)
assert(value == expectedvalue)
end
end
assert(next(expected) == nil)
end
do -- oo.isclass and oo.isinstanceof
local Fake = setmetatable({
classAttrib = "classAttrib",
classMethod = methods.classMethod,
}, { __call = oo.new })
Fake.__index = Fake
assert(oo.isclass() == false)
assert(oo.isclass(Fake) == false)
assert(oo.isclass(Class) == true)
local object = Fake()
assert(oo.isinstanceof(object, Class) == false)
end
do -- oo.getclass and oo.isinstanceof
local values = {
[false] = false,
[true] = false,
[0] = false,
fake = getmetatable(""),
[{}] = false,
[function() end] = false,
[coroutine.create(function() end)] = false,
[io.stdout] = getmetatable(io.stdout),
}
for object, class in pairs(values) do
if object == false then object = nil end
if class == false then class = nil end
assert(oo.getclass(object) == class)
assert(oo.isinstanceof(object, Class) == false)
end
end
do -- class members
local object = Class()
assertClassMembers(object)
assertNoObjectMembers(object)
end
do -- object members
local object = Class{ attrib = "attribute" }
object.method = methods.method
assertClassMembers(object)
assertObjectMembers(object)
end
do -- overriden object members
local object = Class{ classAttrib = "overridenAttrib" }
object.classMethod = methods.overridenMethod
assert(object.classAttrib == "overridenAttrib")
assert(object.classMethod == methods.overridenMethod)
assert(object:classMethod() == "overridenMethod")
assertNoObjectMembers(object)
end
do -- __new metamethod
function Class:__new()
local object = oo.rawnew(self)
object.initAttrib = "initAttrib"
object.initMethod = methods.initMethod
return object
end
local function assertInitialized(object)
assert(object.initAttrib == "initAttrib")
assert(object:initMethod() == "initMethod")
assert(object.initMethod == methods.initMethod)
assert(rawget(object, "initAttrib") == "initAttrib")
assert(rawget(object, "initMethod") == methods.initMethod)
end
local function assertNoInitialized(object)
assert(object.initAttrib == nil)
assert(object.initMethod == nil)
assert(rawget(object, "initAttrib") == nil)
assert(rawget(object, "initMethod") == nil)
end
local object = Class()
assertClassMembers(object)
assertInitialized(object)
local object = oo.new(Class)
assertClassMembers(object)
assertInitialized(object)
local object = oo.rawnew(Class)
assertClassMembers(object)
assertNoInitialized(object)
local object = oo.rawnew(Class, {
attrib = "attribute",
method = methods.method,
})
assertClassMembers(object)
assertObjectMembers(object)
assertNoInitialized(object)
Class.__new = nil
end
do -- __new metamethod and oo.rawnew
function Class:__new() return "fake instance" end
assert(Class() == "fake instance")
assert(oo.new(Class) == "fake instance")
assertClassMembers(oo.rawnew(Class))
local object = oo.rawnew(Class, {
attrib = "attribute",
method = methods.method,
})
assertClassMembers(object)
assertObjectMembers(object)
Class.__new = nil
end
|
return function(luma,fage)
local eztask = luma:import "eztask"
local lmath = luma:import "lmath"
local class = luma:import "class"
-------------------------------------------------------------------------------
local camera=fage.class.object:extend()
function camera:__tostring()
return "camera"
end
camera.callbacks={}
-------------------------------------------------------------------------------
function camera:new()
camera.super.new(self)
self.transform = eztask.property.new(lmath.matrix4.new())
self.projection = eztask.property.new(lmath.matrix4.new())
self.viewport_size = eztask.property.new(lmath.vector2.new())
self.field_of_view = eztask.property.new(70)
self.viewport_size: attach(camera.callbacks.viewport_size,self)
self.field_of_view: attach(camera.callbacks.field_of_view,self)
end
function camera:delete()
camera.super.delete(self)
end
function camera:draw()
end
function camera:update_projection()
self.projection.value:set_perspective(
self.field_of_view.value,
self.viewport_size.value.x/self.viewport_size.value.y,
0.5,1000
)
end
-------------------------------------------------------------------------------
camera.callbacks.viewport_size=function(instance)
instance:update_projection()
end
camera.callbacks.field_of_view=function(instance)
instance:update_projection()
end
-------------------------------------------------------------------------------
return camera
end
|
-- configure the monitor names here
MACBOOK_MONITOR = 'Built-in Retina Display'
WIDE_MONITOR = 'DELL U3415W'
ACER_MONITOR = 'KG271'
DELL_MONITOR = 'PLX2481H'
|
#!/usr/bin/env lua
local glfw = require("moonglfw")
local gl = require("moongl")
local glmath = require("moonglmath")
local cp = require("moonchipmunk")
local toolbox = require("moonchipmunk.toolbox")
cp.glmath_compat(true)
local pi, infinity = math.pi, math.huge
local sin, cos, abs = math.sin, math.cos, math.abs
local fmt = string.format
local vec2 = glmath.vec2
local clamp = glmath.clamp
local identity = cp.transform_identity()
-- Initializations ------------------------------------------------------------
local TITLE = "Pump"
local FW, FH = 640, 480 -- width and height of the field
local W, H = 1024, 768 -- window width and height
local BG_COLOR = {0x07/255, 0x36/255, 0x42/255, 1.0}
local FONT_COLOR, FONT_SIZE = {0xfd/250, 0xf6/250, 0xe3/250, 1.0}, 12/H
glfw.version_hint(3, 3, 'core')
glfw.window_hint('samples', 32)
local window = glfw.create_window(W, H, TITLE)
glfw.make_context_current(window)
gl.init()
toolbox.init(W, H)
local camera = toolbox.camera()
local function resize(window, width, height)
W, H = width, height
toolbox.resize(W, H)
toolbox.set_matrices(camera:view(), camera:projection(-FW/2, FW/2, -FH/2, FH/2))
gl.viewport(0, 0, W, H)
end
glfw.set_window_size_callback(window, resize)
resize(window, W, H)
-- Fonts ----------------------------------------------------------------------
local font = toolbox.font("../ttf-bitstream-vera-1.10/VeraMoBd.ttf", 40/H)
-- Demo inits -----------------------------------------------------------------
local num_balls = 5
local function add_ball(space, pos)
local pos = vec2(pos[1], pos[2])
local body = space:add_body(cp.body_new(1.0, cp.moment_for_circle(1.0, 30, 0, {0, 0})))
body:set_position(pos)
local shape = space:add_shape(cp.circle_shape_new(body, 30, {0, 0}))
shape:set_elasticity(0.0)
shape:set_friction(0.5)
return body
end
local space = cp.space_new()
local grabber = toolbox.grabber(window, space)
local grabbable, not_grabbable = grabber:filters()
local filter_none = {group=0, categories=0, mask=0 }
space:set_gravity({0, -600})
local static_body = space:get_static_body()
-- beveling all of the line segments slightly helps prevent things from getting stuck on cracks
local shape = space:add_shape(cp.segment_shape_new(static_body, {-256,16}, {-256,300}, 2.0))
shape:set_elasticity(0.0)
shape:set_friction(0.5)
shape:set_filter(not_grabbable)
local shape = space:add_shape(cp.segment_shape_new(static_body, {-256,16}, {-192,0}, 2.0))
shape:set_elasticity(0.0)
shape:set_friction(0.5)
shape:set_filter(not_grabbable)
local shape = space:add_shape(cp.segment_shape_new(static_body, {-192,0}, {-192, -64}, 2.0))
shape:set_elasticity(0.0)
shape:set_friction(0.5)
shape:set_filter(not_grabbable)
local shape = space:add_shape(cp.segment_shape_new(static_body, {-128,-64}, {-128,144}, 2.0))
shape:set_elasticity(0.0)
shape:set_friction(0.5)
shape:set_filter(not_grabbable)
local shape = space:add_shape(cp.segment_shape_new(static_body, {-192,80}, {-192,176}, 2.0))
shape:set_elasticity(0.0)
shape:set_friction(0.5)
shape:set_filter(not_grabbable)
local shape = space:add_shape(cp.segment_shape_new(static_body, {-192,176}, {-128,240}, 2.0))
shape:set_elasticity(0.0)
shape:set_friction(0.5)
shape:set_filter(not_grabbable)
local shape = space:add_shape(cp.segment_shape_new(static_body, {-128,144}, {192,64}, 2.0))
shape:set_elasticity(0.0)
shape:set_friction(0.5)
shape:set_filter(not_grabbable)
local verts = {{-30,-80}, {-30, 80}, { 30, 64}, { 30,-80}}
local plunger = space:add_body(cp.body_new(1.0, infinity))
plunger:set_position({-160,-80})
local shape = space:add_shape(cp.poly_shape_new(plunger, verts, 0.0, identity))
shape:set_elasticity(1.0)
shape:set_friction(0.5)
shape:set_filter({group=0, categories=1, mask=1})
-- add balls to hopper
local balls = {}
for i=0, num_balls-1 do
table.insert(balls, add_ball(space, {-224 + i,80 + 64*i}))
end
-- add small gear
local small_gear = space:add_body(cp.body_new(10.0, cp.moment_for_circle(10.0, 80, 0, {0, 0})))
small_gear:set_position({-160,-160})
small_gear:set_angle(-pi/2.0)
local shape = space:add_shape(cp.circle_shape_new(small_gear, 80.0, {0, 0}))
shape:set_filter(cp.shape_filter_none())
space:add_constraint(cp.pivot_joint_new(static_body, small_gear, {-160,-160}, {0, 0}))
-- add big gear
local big_gear = space:add_body(cp.body_new(40.0, cp.moment_for_circle(40.0, 160, 0, {0, 0})))
big_gear:set_position({80,-160})
big_gear:set_angle(pi/2.0)
local shape = space:add_shape(cp.circle_shape_new(big_gear, 160.0, {0, 0}))
shape:set_filter(cp.shape_filter_none())
space:add_constraint(cp.pivot_joint_new(static_body, big_gear, {80,-160}, {0, 0}))
-- connect the plunger to the small gear.
space:add_constraint(cp.pin_joint_new(small_gear, plunger, {80,0}, {0,0}))
-- connect the gears.
space:add_constraint(cp.gear_joint_new(small_gear, big_gear, -pi/2.0, -2.0))
-- feeder mechanism
local bottom, top = -300.0, 32.0
local feeder = space:add_body(cp.body_new(1.0,
cp.moment_for_segment(1.0, {-224.0, bottom}, {-224.0, top}, 0.0)))
feeder:set_position({-224, (bottom + top)/2.0})
local len = top - bottom
local shape = space:add_shape(cp.segment_shape_new(feeder, {0.0, len/2.0}, {0.0, -len/2.0}, 20.0))
shape:set_filter(grabbable)
space:add_constraint(cp.pivot_joint_new(static_body, feeder, {-224.0, bottom}, {0.0, -len/2.0}))
local anchor = feeder:world_to_local({-224.0, -160.0})
space:add_constraint(cp.pin_joint_new(feeder, small_gear, anchor, {0.0, 80.0}))
-- motorize the second gear
motor = space:add_constraint(cp.simple_motor_new(static_body, big_gear, 3.0))
-- Input handling -------------------------------------------------------------
local toggle_fullscreen = toolbox.toggle_fullscreen(window)
local keys = {} -- keys[k] = true if key k is pressed
local key_x, key_y = 0, 0
local function control_machine(key, action)
if action == 'repeat' then return end
if key == 'up' then key_y = key_y + ((action=='press') and 1 or -1)
elseif key == 'down' then key_y = key_y + ((action=='press') and -1 or 1)
elseif key == 'left' then key_x = key_x + ((action=='press') and -1 or 1)
elseif key == 'right' then key_x = key_x + ((action=='press') and 1 or -1)
end
end
glfw.set_key_callback(window, function(window, key, scancode, action)
if key == 'escape' and action == 'press' then
glfw.set_window_should_close(window, true)
elseif key == 'f11' and action == 'press' then toggle_fullscreen()
else
keys[key] = action ~= 'release'
end
control_machine(key, action)
end)
glfw.set_cursor_pos_callback(window, function(window, x, y)
grabber:cursor_pos_callback(x, y)
end)
glfw.set_mouse_button_callback(window, function(window, button, action, shift, control, alt, super)
grabber:mouse_button_callback(button, action, shift, control, alt, super)
end)
-- Game loop ------------------------------------------------------------------
local timer = toolbox.frame_timer()
local spf = 1/60 -- 1 / desired fps
local fdt = 1/120 -- fixed dt for physics updates
local n_physics_updates = toolbox.fixed_dt_counter(fdt)
local n, dt
local renderer = toolbox.renderer(space)
collectgarbage()
collectgarbage('stop')
while not glfw.window_should_close(window) do
glfw.wait_events_timeout(spf)
dt = timer:update() -- duration of the current frame
n = n_physics_updates(dt) -- no. of physics updates to do in this frame
local coef = (2.0 + key_y)/3.0
local rate = key_x*30.0*coef
for i=1, n do
motor:set_rate(rate)
motor:set_max_force(rate==0.0 and 0.0 or 1000000.0)
space:step(fdt)
grabber:step(fdt)
for _, ball in ipairs(balls) do
local pos = ball: get_position()
if pos.x > 320.0 then
ball:set_velocity({0, 0})
ball:set_position({-224.0, 200.0})
end
end
end
glfw.set_window_title(window, fmt("%s - fps=%.0f, n=%d", TITLE, timer:fps(), n))
gl.clear_color(BG_COLOR)
gl.clear('color')
renderer:begin()
space:debug_draw()
renderer:done()
font:draw("Use the arrow keys to control the machine.", .05, .9, FONT_SIZE, FONT_COLOR)
glfw.swap_buffers(window)
collectgarbage()
end
toolbox.cleanup()
|
-- sample test.lua
-- sample2 test.lua
|
conky.config = {
alignment = 'middle_left',
background = true,
border_width = 1,
cpu_avg_samples = 2,
default_color = 'ffffff',
default_outline_color = 'ffffff',
default_shade_color = 'ff00cc',
draw_borders = false,
draw_graph_borders = true,
draw_outline = false,
draw_shades = true,
use_xft = true,
font = 'Anonymous Pro Minus:size=9',
gap_x = 32,
gap_y = 24,
minimum_height = 540,
minimum_width = 380,
maximum_width = 380,
net_avg_samples = 2,
no_buffers = true,
double_buffer = true,
out_to_console = false,
out_to_stderr = false,
extra_newline = false,
own_window = true,
own_window_transparent = true,
own_window_class = 'Conky',
own_window_type = 'override',
own_window_hints = 'undecorated,below,skip_pager,skip_taskbar',
stippled_borders = 0,
update_interval = 3.0,
uppercase = false,
use_spacer = 'none',
show_graph_scale = false,
show_graph_range = false,
own_window_argb_visual = true,
own_window_argb_value = 0
}
conky.text = [[
${font Wargames-Regular:size=16}${color ccff00}PWR$font ${battery_percent BAT1}% ${battery_bar 8 BAT1}$color
### SYSTEM ###
${font Wargames-Regular:size=16}${color 00ffcc}SYS ${stippled_hr 2}$color$font
HOST${alignr}${color 00ffcc}"$nodename" Satellite L745$color
OS${alignr}${color 00ffcc}Linus Mint 19.1 Tessa$color
KERNEL${alignr}${color 00ffcc}$sysname $kernel$color
ARCHITECTURE${alignr}${color 00ffcc}$machine$color
UPTIME${alignr}${color 00ffcc}$uptime_short$color
### CPU ###
${font Wargames-Regular:size=16}${color ff00cc}CPU ${stippled_hr 2}$color$font
INTEL i7-8700K${alignr}4 (8) @ 4.0GHz
CORE 1 @ ${freq 1}MHz${alignc -36}${hwmon 0 temp 1}°C${alignr}${cpu cpu1}% (${cpu cpu3}%)
CORE 2 @ ${freq 2}MHz${alignc -36}${hwmon 0 temp 2}°C${alignr}${cpu cpu2}% (${cpu cpu4}%)
CORE 3 @ ${freq 3}MHz${alignc -36}${hwmon 1 temp 3}°C${alignr}${cpu cpu3}% (${cpu cpu5}%)
CORE 4 @ ${freq 4}MHz${alignc -36}${hwmon 1 temp 4}°C${alignr}${cpu cpu4}% (${cpu cpu6}%)
LOGICAL 1 ${color ff00cc}${cpubar cpu1 8,120}$color${alignr}(3) ${color ff00cc}${cpubar cpu3 8,120}$color
LOGICAL 2 ${color ff00cc}${cpubar cpu2 8,120}$color${alignr}(4) ${color ff00cc}${cpubar cpu4 8,120}$color
PROCESSES${alignc -12}${running_processes} / ${processes}$color${alignr}${cpu}%
${color ff00cc}${cpugraph cpu0 24 ff00cc}$color
${color ff00cc}CPU MEM Disk PID Name$color
${top cpu 1} ${top mem 1} ${top io_perc 3} ${top pid 1} ${top name 1}
${top cpu 2} ${top mem 2} ${top io_perc 3} ${top pid 2} ${top name 2}
${top cpu 3} ${top mem 3} ${top io_perc 3} ${top pid 3} ${top name 3}
### MEMORY ###
${font Wargames-Regular:size=16}${color 4cff00}MEM ${stippled_hr 2}$color$font
SO-DIMM DDR4${alignr}6GB @ 1600MHz
RAM ${alignc}${mem} / ${memmax}${alignr}$memperc%
${color 4cff00}${membar 8}$color
SWAP ${alignc}${swap} / ${swapmax}${alignr}$swapperc%
${color 4cff00}${swapbar 8}$color
${color 4cff00}MEM CPU Disk PID Name$color
${top_mem mem 1} ${top_mem cpu 1} ${top_mem io_perc 1} ${top_mem pid 1} ${top_mem name 1}
${top_mem mem 2} ${top_mem cpu 2} ${top_mem io_perc 2} ${top_mem pid 2} ${top_mem name 2}
${top_mem mem 3} ${top_mem cpu 3} ${top_mem io_perc 3} ${top_mem pid 3} ${top_mem name 3}
### STORAGE ###
${font Wargames-Regular:size=16}${color ff3300}HDD ${stippled_hr 2}$color$font
${exec hddtemp /dev/sda}${alignr}750GB @ 5400 RPM
/ (${fs_type /})${alignc}${fs_used /} / ${fs_size /}${alignr}${fs_used_perc /}%
${color ff3300}${fs_bar 8 /}$color
/home (${fs_type /home})${alignc}${fs_used /home} / ${fs_size /home}${alignr}${fs_used_perc /home}%
${color ff3300}${fs_bar 6 /home}$color
READ ${color ff3300}${diskiograph_read /dev/sda 24,120 300001 ff3300}$color${alignr}WRITE ${color ff3300}${diskiograph_write /dev/sda 24,120 300001 ff3300}$color
${diskio_read}/s${alignr}${diskio_write}/s
### NETWORK ###
${font Wargames-Regular:size=16}${color 3300ff}NET ${stippled_hr 2}$color$font
${wireless_essid wlp4s0}${alignr}WLAN @ 5.0GHz
DOWNLOAD ${color 3300ff}${downspeedgraph wlp4s0 24,120 300001 3300ff}$color${alignr}UPLOAD ${color 3300ff}${upspeedgraph wlp4s0 24,120 300001 3300ff}$color
${downspeed wlp4s0}/s (${totaldown wlp4s0})${alignr}${upspeed wlp4s0}/s (${totalup wlp2s0})
]]
|
-- _.reduce.lua
--
-- Reduces collection to a value which is the accumulated result of
-- running each element in collection through iteratee, where each
-- successive invocation is supplied the return value of the previous.
-- If accumulator is not provided the first element of collection is used
-- as the initial value. The iteratee is bound to selfArg and invoked
-- with four arguments: (accumulator, value, index|key, collection).
-- @usage _.print(_.reduce({1, 2, 3}, function(total, n)
-- return n + total;
-- end))
-- --> 6
-- _.print(_.reduce({a = 1, b = 2}, function(result, n, key)
-- result[key] = n * 3
-- return result;
-- end, {}))
-- --> {["a"]=3, ["b"]=6}
--
-- @param collection The collection to iterate over.
-- @param[opt=_.identity] iteratee The function invoked per iteration.
-- @param[opt=<first element>] accumulator The initial value.
-- @param[opt] selfArg The self binding of predicate.
-- @return Returns the accumulated value.
_.reduce = function (collection, iteratee, accumulator, selfArg)
local accumulator = accumulator
for k, v in _.iter(collection) do
if _.isNil(accumulator) then
accumulator = v
else
accumulator = callIteratee(iteratee, selfArg, accumulator, v, k, collection)
end
end
return accumulator
end
|
do
local gridbak = swapoutgrid()
local grid = {}
getmygrid = function (x,y)
grid[x] = grid[x] or {}
return grid[x][y] or 10
end
setmygrid = function (x,y,v)
grid[x] = grid[x] or {}
grid[x][y] = v
end
local gg = getmygrid
function swapingrid(g)
grid = g
end
function swapoutgrid()
return grid
end
function rendergrid2()
local s = 5
local h = 10
for x = -100,100,s do
for y = -100,100,s do
h1 = gg(x,y)
h2 = gg(x+s,y)
h3 = gg(x,y+s)
drawLine(x,h1,y,x+s,h2,y)
drawLine(x,h1,y,x, h3,y+s)
end
end
end
swapingrid(gridbak)
clearError()
continue()
end
function rendergrid2() end
for i=0,90,5 do
setmygrid(i,0,70)
end
function applygridaveraging()
local gg = getmygrid
local s = 5
for x=-50,50,s do
for y=-50,50,s do
local h1 = gg(x, y)
local h2 = gg(x+s,y)
local h3 = gg(x+s,y+s)
local h4 = gg(x ,y+s)
local h = gg(x,y)
local avg = (h1+h2+h3+h4)/4
h = h + (avg - h) * 0.1
--h = avg
--h = 5
setmygrid(x,y,h)
end
end
end
clearTrace()
for i=1,20,1 do
local r = 20
local x = (math.random(r)-r/2) * 5
local y = (math.random(r)-r/2) * 5
local z = math.random(90) + 5
setmygrid(x,y,z)
end
do
setmygrid(0,0,50)
setmygrid(0,5,50)
setmygrid(0,10,50)
setmygrid(0,15,50)
end
clearError()
continue()
setBufferName("griddy.lua")
_gridbak = swapoutgrid()
print2(_gridbak[0][0])
swapingrid(_gridbak)
continue()
print2(getErrorText())
do
closeBuffer()
switchToBuffer("synth.lua - command")
end
print2(getFunction(update))
function update()
WidgetLib.callAll("update")
for i=1,#skythings,1 do
local thing = skythings[i]
local planepos = vec3d(transform.getTranslation(airplane.lspace))
local tween = thing.p - planepos
local dist = Vector3D.magnitude(tween)
tween = Vector3D.normalize(tween)
if dist < (30 + thing.r) then
thing.p = planepos + (tween * (30+thing.r))
end
end
local r,g,b = getClearColor()
r = r - 10
if r < 0 then r = 0 end
setClearColor(r,g,b)
SynthNode.updateSynthNode(sineConNode)
SynthNode.updateSynthNode(sineConNode2)
SynthNode.updateSynthNode(sineGenNode)
SynthNode.updateSynthNode(lpfEffNode)
SynthNode.updateSynthNode(sinkNode)
--applygridaveraging()
end
|
local addon = select(2, ...)
local kCommandHandlers = {
details = function(elem)
return elem
end,
width = function(elem, width)
local numericWidth = tonumber(width)
if numericWidth then
elem:SetWidth(numericWidth)
end
return { width = elem:GetWidth() }
end,
height = function(elem, height)
local numericHeight = tonumber(height)
if numericHeight then
elem:SetHeight(numericHeight)
end
return { height = elem:GetHeight() }
end,
}
function addon.tweakFocus(how)
local elem = _G.GetMouseFocus()
local message = '>> focus="%s", request="%s", result follows'
print(message:format(elem:GetName(), how))
local command, args = how:match('^(%S+)%s*(.*)')
if command then
local handler = kCommandHandlers[command]
local result = 'unknown command'
if handler then
result = handler(elem, args)
end
addon.dump(result)
end
end
|
-- Copyright (c) 2019 Redfern, Trevor <[email protected]>
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
local Component = require "moonpie.ui.components.component"
local image = require "moonpie.graphics.image"
local layouts = require "moonpie.ui.layouts"
Component("image", function(props)
local source = props.source
local i = {
layout = layouts.image,
source = source
}
i.image = image.load(source)
return i
end)
|
package.path = '../../lua-otalk/?.lua;' .. '../src/?.lua;' .. package.path
require "verse".init("client")
c = verse.new()
local converter = require "converter"
local utils = require "utils"
require "jingleStanza"
local iqStanza = jingleStanza()
local jingle = require "jingle"
jingle.registerJingle(converter)
jingle.registerContent(converter)
local ice = require "ice"
ice.registerTransport(converter)
ice.registerCandidate(converter)
ice.registerFingerprint(converter)
ice.registerSCTP(converter)
local rtp = require "rtp"
rtp.registerDescription(converter)
rtp.registerPayload(converter)
rtp.registerFeedback(converter)
rtp.registerMoreFeedback(converter)
rtp.registerHeader(converter)
rtp.registerParameter(converter)
rtp.registerTalkyDescription(converter)
rtp.registerContentGroup(converter)
rtp.registerSourceGroup(converter)
rtp.registerSource(converter)
rtp.registerSourceParameter(converter)
rtp.registerMute(converter)
rtp.registerUnmute(converter)
local toTable = converter.toTable("jingle", "urn:xmpp:jingle:1")
local jingleTable = toTable(iqStanza:get_child("jingle", "urn:xmpp:jingle:1"))
local meta = {__tostring = utils.tableString}
utils.setMetatableRecursively(jingleTable, meta)
print(jingleTable)
local toStanza = converter.toStanza("jingle", "urn:xmpp:jingle:1")
local newStanza = toStanza(jingleTable)
print(newStanza)
require "jingleTable"
local sdpStanza = toStanza(export)
print(sdpStanza)
|
Global.cmp = Global.cmp or {}
Global.cmp.custom_loaded_packages = Global.cmp.custom_loaded_packages or {}
BLT.CustomPackageManager = {}
local C = BLT.CustomPackageManager
C.custom_packages = {}
C.ext_convert = {dds = "texture", png = "texture", tga = "texture", jpg = "texture"}
--Hopefully will be functional at some point.
function C:RegisterPackage(id, directory, config)
local func_name = "CustomPackageManager:RegisterPackage"
if (not Utils:CheckParamsValidty({id, directory, config},
{
func_name = func_name,
params = {
{ type="string", allow_nil = false },
{ type="string", allow_nil = false },
{ type="table", allow_nil = false }
}
})) then
return false
end
id = id:key()
if self.custom_packages[id] then
BLT:log("[ERROR] Package with ID '%s' already exists! Returning...", id)
return false
end
self.custom_packages[id] = {dir = directory, config = config}
return true
end
function C:LoadPackage(id)
id = id:key()
if self.custom_packages[id] then
local pck = self.custom_packages[id]
self:LoadPackageConfig(pck.dir, pck.config)
Global.cmp.custom_loaded_packages[id] = true
return true
end
end
function C:UnLoadPackage(id)
id = id:key()
if self.custom_packages[id] then
local pck = self.custom_packages[id]
self:UnloadPackageConfig(pck.config)
Global.cmp.custom_loaded_packages[id] = false
return false
end
end
function C:PackageLoaded(id)
return Global.cmp.custom_loaded_packages[id:key()]
end
function C:HasPackage(id)
return not not self.custom_packages[id:key()]
end
function C:LoadPackageConfig(directory, config)
if not SystemFS then
BLT:log("[ERROR] SystemFS does not exist! Custom Packages cannot function without this! Do you have an outdated game version?")
return
end
if config.load_clbk and not config.load_clbk() then
return
end
local loading = {}
for i, child in ipairs(config) do
if type(child) == "table" then
local typ = child._meta
local path = child.path
local load_clbk = child.load_clbk
if not load_clbk or load_clbk(path, typ) then
if typ == "unit_load" or typ == "add" then
self:LoadPackageConfig(directory, child)
elseif typ and path then
path = Utils.Path:Normalize(path)
local ids_ext = Idstring(self.ext_convert[typ] or typ)
local ids_path = Idstring(path)
local file_path = Utils.Path:Combine(directory, path) ..".".. typ
if SystemFS:exists(file_path) then
if (not DB:has(ids_ext, ids_path) or child.force) then
FileManager:AddFile(ids_ext, ids_path, file_path)
if child.reload then
PackageManager:reload(ids_ext, ids_path)
end
if child.load then
table.insert(loading, {ids_ext, ids_path, file_path})
end
end
else
BLT:log("[ERROR] File does not exist! %s", tostring(file_path))
end
else
BLT:log("[ERROR] Node in %s does not contain a definition for both type and path", tostring(directory))
end
end
end
end
--For some reason this needs to be here, instead of loading in the main loop or the game will go into a hissy fit
for _, file in pairs(loading) do
FileManager:LoadAsset(unpack(file))
end
end
function C:UnloadPackageConfig(config)
BLT:log("Unloading added files")
for i, child in ipairs(config) do
if type(child) == "table" then
local typ = child._meta
local path = child.path
if typ and path then
path = Utils.Path:Normalize(path)
local ids_ext = Idstring(self.ext_convert[typ] or typ)
local ids_path = Idstring(path)
if DB:has(ids_ext, ids_path) then
if child.unload ~= false then
FileManager:UnLoadAsset(ids_ext, ids_path)
end
FileManager:RemoveFile(ids_ext, ids_path)
end
elseif typ == "unit_load" or typ == "add" then
self:UnloadPackageConfig(child)
else
BLT:log("[ERROR] Some node does not contain a definition for both type and path")
end
end
end
end
|
--SDMachine.lua
local ffi = require("ffi")
local sysd = require("systemd_ffi")
local fsutil = require("fs-util")
local strutil = require("string-util")
local fun = require("fun")
local function nil_gen()
return nil;
end
local SDMachine = {}
local SDMachine_mt = {
__index = SDMachine;
}
local function isNotUnit(name)
return not strutil.startswith(name, "unit:")
end
function SDMachine.machineNames(self)
-- filter these out
-- if (startswith(*a, "unit:") || !machine_name_is_valid(*a))
return fun.filter(isNotUnit, fsutil.files_in_directory("/run/systemd/machines/"))
end
function SDMachine.sessionNames(self)
return fsutil.files_in_directory("/run/systemd/sessions/")
end
function SDMachine.seatNames(self)
return fsutil.files_in_directory("/run/systemd/seats/")
end
return SDMachine
|
local menu_height= 400
local menu_width= 250
local menu_x= {
[PLAYER_1]= _screen.w * .25,
[PLAYER_2]= _screen.w * .75,
}
local menus= {}
for i, pn in ipairs(GAMESTATE:GetHumanPlayers()) do
menus[pn]= setmetatable({}, nesty_menu_stack_mt)
end
local explanations= {}
local ready_indicators= {}
local turn_chart_mods= {
nesty_options.bool_player_mod_val("Mirror"),
nesty_options.bool_player_mod_val("Backwards"),
nesty_options.bool_player_mod_val("Left"),
nesty_options.bool_player_mod_val("Right"),
nesty_options.bool_player_mod_val("Shuffle"),
nesty_options.bool_player_mod_val("SoftShuffle"),
nesty_options.bool_player_mod_val("SuperShuffle"),
}
local removal_chart_mods= {
nesty_options.bool_player_mod_val("NoHolds"),
nesty_options.bool_player_mod_val("NoRolls"),
nesty_options.bool_player_mod_val("NoMines"),
nesty_options.bool_player_mod_val("HoldRolls"),
nesty_options.bool_player_mod_val("NoJumps"),
nesty_options.bool_player_mod_val("NoHands"),
nesty_options.bool_player_mod_val("NoLifts"),
nesty_options.bool_player_mod_val("NoFakes"),
nesty_options.bool_player_mod_val("NoQuads"),
nesty_options.bool_player_mod_val("NoStretch"),
}
local insertion_chart_mods= {
nesty_options.bool_player_mod_val("Little"),
nesty_options.bool_player_mod_val("Wide"),
nesty_options.bool_player_mod_val("Big"),
nesty_options.bool_player_mod_val("Quick"),
nesty_options.bool_player_mod_val("BMRize"),
nesty_options.bool_player_mod_val("Skippy"),
nesty_options.bool_player_mod_val("Mines"),
nesty_options.bool_player_mod_val("Echo"),
nesty_options.bool_player_mod_val("Stomp"),
nesty_options.bool_player_mod_val("Planted"),
nesty_options.bool_player_mod_val("Floored"),
nesty_options.bool_player_mod_val("Twister"),
}
local chart_mods= {
nesty_options.submenu("turn_chart_mods", turn_chart_mods),
nesty_options.submenu("removal_chart_mods", removal_chart_mods),
nesty_options.submenu("insertion_chart_mods", insertion_chart_mods),
}
local gameplay_options= {
nesty_options.bool_config_val(player_config, "ComboUnderField"),
nesty_options.bool_config_val(player_config, "FlashyCombo"),
nesty_options.bool_config_val(player_config, "GameplayShowStepsDisplay"),
nesty_options.bool_config_val(player_config, "GameplayShowScore"),
nesty_options.bool_config_val(player_config, "JudgmentUnderField"),
nesty_options.bool_config_val(player_config, "Protiming"),
}
-- The time life bar doesn't work sensibly outside the survival courses, so
-- keep it out of the menu.
local life_type_enum= {"LifeType_Bar", "LifeType_Battery"}
local life_options= {
nesty_options.enum_player_mod_single_val("bar_type", "LifeType_Bar", "LifeSetting"),
nesty_options.enum_player_mod_single_val("battery_type", "LifeType_Battery", "LifeSetting"),
nesty_options.enum_player_mod_single_val("normal_drain", "DrainType_Normal", "DrainSetting"),
nesty_options.enum_player_mod_single_val("no_recover", "DrainType_NoRecover", "DrainSetting"),
nesty_options.enum_player_mod_single_val("sudden_death", "DrainType_SuddenDeath", "DrainSetting"),
nesty_options.enum_player_mod_single_val("fail_immediate", "FailType_Immediate", "FailSetting"),
nesty_options.enum_player_mod_single_val("fail_immediate_continue", "FailType_ImmediateContinue", "FailSetting"),
nesty_options.enum_player_mod_single_val("fail_end_of_song", "FailType_EndOfSong", "FailSetting"),
nesty_options.enum_player_mod_single_val("fail_off", "FailType_Off", "FailSetting"),
nesty_options.float_player_mod_val_new("BatteryLives", 1, 2, 1, 10, 4),
}
-- I suppose now would be a good time to mention that, since the float menu code ...thingy doesn't rely on powers of 10 anymore,
-- the values passed in will be different.
local base_options= {
notefield_prefs_speed_type_menu(),
notefield_prefs_speed_mod_menu(),
--Turns out the music rate can't handle values higher than 3!
nesty_options.float_song_mod_val_new("MusicRate", 0.1, 1, .1, 3, 1),
nesty_options.float_song_mod_toggle_val("Haste", 1, 0),
notefield_perspective_menu(),
nesty_options.float_config_toggle_val(notefield_prefs_config, "reverse", -1, 1),
nesty_options.float_config_val_new(notefield_prefs_config, "zoom", 0.1, 1),
nesty_options.submenu("chart_mods", chart_mods),
{name= "noteskin", translatable= true, menu= nesty_option_menus.noteskins},
{name= "shown_noteskins", translatable= true, menu= nesty_option_menus.shown_noteskins, args= {}},
nesty_options.bool_config_val(notefield_prefs_config, "hidden"),
nesty_options.bool_config_val(notefield_prefs_config, "sudden"),
advanced_notefield_prefs_menu(),
nesty_options.submenu("gameplay_options", gameplay_options),
nesty_options.submenu("life_options", life_options),
nesty_options.bool_song_mod_val("AssistClap"),
nesty_options.bool_song_mod_val("AssistMetronome"),
nesty_options.bool_song_mod_val("StaticBackground"),
nesty_options.bool_song_mod_val("RandomBGOnly"),
nesty_options.float_config_val_new(player_config, "ScreenFilter", 0.1, 0.5, 0, 1),
get_notefield_mods_toggle_menu(true, true),
{name= "reload_noteskins", translatable= true, type= "action",
execute= function() NOTESKIN:reload_skins() end},
}
local player_ready= {}
local function exit_if_both_ready()
for i, pn in ipairs(GAMESTATE:GetHumanPlayers()) do
if not player_ready[pn] then return end
end
SCREENMAN:GetTopScreen():StartTransitioningScreen("SM_GoToNextScreen")
end
local prev_explanation= {}
local function update_explanation(pn)
local cursor_item= menus[pn]:get_cursor_item()
if cursor_item then
local new_expl= cursor_item.name or cursor_item.text
local expl_com= "change_explanation"
if cursor_item.explanation then
new_expl= cursor_item.explanation
expl_com= "translated_explanation"
end
if new_expl ~= prev_explanation[pn] then
prev_explanation[pn]= new_expl
explanations[pn]:playcommand(expl_com, {text= new_expl})
end
end
end
local function input(event)
local pn= event.PlayerNumber
if not pn then return end
if not menus[pn] then return end
if menu_stack_generic_input(menus, event)
and event.type == "InputEventType_FirstPress" then
if event.GameButton == "Back" then
SCREENMAN:GetTopScreen():StartTransitioningScreen("SM_GoToPrevScreen")
else
player_ready[pn]= true
ready_indicators[pn]:playcommand("show_ready")
exit_if_both_ready()
end
else
if player_ready[pn] and not menus[pn]:can_exit_screen() then
player_ready[pn]= false
ready_indicators[pn]:playcommand("hide_ready")
end
end
update_explanation(pn)
end
local frame= Def.ActorFrame{
OnCommand= function(self)
SCREENMAN:GetTopScreen():AddInputCallback(input)
for pn, menu in pairs(menus) do
menu:push_menu_stack(nesty_option_menus.menu, base_options, "play_song")
menu:update_cursor_pos()
update_explanation(pn)
end
end,
}
local item_params= {
text_commands= {
Font= "Common Condensed", OnCommand= function(self)
self:diffuse(color("#3D1D23")):diffusealpha(0):decelerate(0.2):diffusealpha(1)
end,
OffCommand=function(self)
self:smooth(0.3):diffusealpha(0)
end,
},
text_width= .7,
value_text_commands= {
Font= "Common Condensed", OnCommand= function(self)
self:diffuse(color("#AC214A")):diffusealpha(0):decelerate(0.2):diffusealpha(1)
end,
OffCommand=function(self)
self:smooth(0.3):diffusealpha(0)
end,
},
value_image_commands= {
OnCommand= function(self)
self:diffusealpha(0):smooth(0.3):diffusealpha(1)
end,
OffCommand=function(self)
self:smooth(0.3):diffusealpha(0)
end,
},
value_width= .25,
type_images= {
bool= THEME:GetPathG("", "menu_icons/bool"),
choice= THEME:GetPathG("", "menu_icons/bool"),
menu= THEME:GetPathG("", "menu_icons/menu"),
},
}
for pn, menu in pairs(menus) do
frame[#frame+1]= LoadActor(
THEME:GetPathG("ScreenOptions", "halfpage")) .. {
InitCommand= function(self)
self:xy(menu_x[pn], 360)
end;
OnCommand=function(self)
self:diffusealpha(0):zoomx(0.8):decelerate(0.3):diffusealpha(1):zoomx(1)
end;
OffCommand=function(self)
self:decelerate(0.3):diffusealpha(0)
end;
}
frame[#frame+1]= menu:create_actors{
x= menu_x[pn], y= 120, width= menu_width, height= menu_height,
translation_section= "notefield_options",
num_displays= 1, pn= pn, el_height= 36,
menu_sounds= {
pop= THEME:GetPathS("Common", "Cancel"),
push= THEME:GetPathS("_common", "row"),
act= THEME:GetPathS("Common", "start"),
move= THEME:GetPathS("Common", "value"),
move_up= THEME:GetPathS("Common", "value"),
move_down= THEME:GetPathS("Common", "value"),
inc= THEME:GetPathS("_switch", "up"),
dec= THEME:GetPathS("_switch", "down"),
},
display_params= {
el_zoom= 0.8, item_params= item_params, item_mt= nesty_items.value, heading_height = 48,
on= function(self)
self:diffusealpha(0):decelerate(0.2):diffusealpha(1)
end,
off= function(self)
self:decelerate(0.2):diffusealpha(0)
end,
},
}
frame[#frame+1]= Def.BitmapText{
Font= "Common Normal", InitCommand= function(self)
explanations[pn]= self
self:xy(menu_x[pn] - (menu_width / 2), _screen.cy+154)
:diffuse(ColorDarkTone((PlayerColor(pn)))):horizalign(left):vertalign(top)
:wrapwidthpixels(menu_width / .8):zoom(.75)
:horizalign(left)
end,
change_explanationCommand= function(self, param)
local text= ""
if THEME:HasString("notefield_explanations", param.text) then
text= THEME:GetString("notefield_explanations", param.text)
end
self:playcommand("translated_explanation", {text= text})
end,
translated_explanationCommand= function(self, param)
self:stoptweening():settext(param.text):cropright(1):linear(.5):cropright(0)
end,
}
frame[#frame+1]= Def.BitmapText{
Font= "Common Condensed", Text= "READY!", InitCommand= function(self)
ready_indicators[pn]= self
self:xy(menu_x[pn], 146):zoom(1.5):diffuse(Color.Green):strokecolor(color("#2E540F")):diffusealpha(0)
end,
show_readyCommand= function(self)
self:stoptweening():decelerate(.5):diffusealpha(1)
end,
hide_readyCommand= function(self)
self:stoptweening():accelerate(.5):diffusealpha(0)
end,
}
local metrics_name = "PlayerNameplate" .. ToEnumShortString(pn)
frame[#frame+1] = LoadActor(
THEME:GetPathG("ScreenPlayerOptions", "PlayerNameplate"), pn) .. {
InitCommand=function(self)
self:name(metrics_name)
ActorUtil.LoadAllCommandsAndSetXY(self,"ScreenPlayerOptions")
self:x(menu_x[pn])
end
}
end
return frame
|
mail = {
-- mark webmail fork for other mods
fork = "webmail",
-- api version
apiversion = 1.1,
-- mail directory
maildir = minetest.get_worldpath().."/mails",
-- allow item/node attachments
allow_attachments = minetest.settings:get("mail.allow_attachments") == "true",
webmail = {
-- disallow banned players in the webmail interface
disallow_banned_players = minetest.settings:get("webmail.disallow_banned_players") == "true",
-- url and key to the webmail server
url = minetest.settings:get("webmail.url"),
key = minetest.settings:get("webmail.key")
},
tan = {}
}
local MP = minetest.get_modpath(minetest.get_current_modname())
dofile(MP .. "/chatcommands.lua")
dofile(MP .. "/migrate.lua")
dofile(MP .. "/attachment.lua")
dofile(MP .. "/hud.lua")
dofile(MP .. "/storage.lua")
dofile(MP .. "/api.lua")
dofile(MP .. "/gui.lua")
dofile(MP .. "/onjoin.lua")
-- optional webmail stuff below
local http = minetest.request_http_api()
if http then
local webmail_url = mail.webmail.url
local webmail_key = mail.webmail.key
if not webmail_url then error("webmail.url is not defined") end
if not webmail_key then error("webmail.key is not defined") end
print("[mail] loading webmail-component with endpoint: " .. webmail_url)
mail.handlers = {}
dofile(MP .. "/webmail/tan.lua")
dofile(MP .. "/webmail/webmail.lua")
dofile(MP .. "/webmail/hook.lua")
dofile(MP .. "/webmail/handler_auth.lua")
dofile(MP .. "/webmail/handler_send.lua")
dofile(MP .. "/webmail/handler_messages.lua")
dofile(MP .. "/webmail/handler_delete.lua")
dofile(MP .. "/webmail/handler_mark_read.lua")
dofile(MP .. "/webmail/handler_mark_unread.lua")
mail.webmail_init(http, webmail_url, webmail_key)
end
-- migrate storage
mail.migrate()
|
local LibDBIcon = LibStub("LibDBIcon-1.0")
--- @type ClickedInternal
local _, Addon = ...
--- @type Localization
local L = LibStub("AceLocale-3.0"):GetLocale("Clicked")
-- Local support functions
--- @param default string|boolean
--- @return Binding.LoadOption
local function GetLoadOptionTemplate(default)
local template = {
selected = false,
value = default
}
return template
end
--- @return Binding.LoadOption
local function GetNegatableLoadOptionTemplate()
return GetLoadOptionTemplate(true)
end
--- @return Binding.NegatableStringLoadOption
local function GetNegatableStringLoadOptionTemplate()
local template = {
selected = false,
negated = false,
value = ""
}
return template
end
--- @param default number|string
--- @return Binding.TriStateLoadOption
local function GetTriStateLoadOptionTemplate(default)
local template = {
selected = 0,
single = default,
multiple = {
default
}
}
return template
end
-- Public addon API
--- Get the default values for a Clicked profile.
---
--- @return Database
function Clicked:GetDatabaseDefaults()
local database = {
profile = {
version = nil,
options = {
onKeyDown = false,
tooltips = false,
minimap = {
hide = false
}
},
groups = {},
bindings = {},
blacklist = {},
nextGroupId = 1,
nextBindingId = 1
}
}
return database
end
--- Reload the database, this should be called after high-level profile changes have been made, such as switching the active profile, or importing a proifle.
function Clicked:ReloadDatabase()
Addon:UpgradeDatabaseProfile(Addon.db.profile)
if Addon.db.profile.options.minimap.hide then
LibDBIcon:Hide("Clicked")
else
LibDBIcon:Show("Clicked")
end
Addon:BlacklistOptions_Refresh()
Clicked:ReloadActiveBindings()
end
--- Create a new binding group. Groups are purely cosmetic and have no additional impact on binding functionality.
--- @return Group
function Clicked:CreateGroup()
local identifier = Addon.db.profile.nextGroupId
Addon.db.profile.nextGroupId = Addon.db.profile.nextGroupId + 1
local group = {
name = L["New Group"],
displayIcon = "Interface\\ICONS\\INV_Misc_QuestionMark",
identifier = "group-" .. identifier
}
table.insert(Addon.db.profile.groups, group)
return group
end
--- Delete a binding group. If the group is not empty, it will also delete all child-bindings.
--- @param group Group
function Clicked:DeleteGroup(group)
assert(type(group) == "table", "bad argument #1, expected table but got " .. type(group))
for i, e in ipairs(Addon.db.profile.groups) do
if e.identifier == group.identifier then
table.remove(Addon.db.profile.groups, i)
break
end
end
for i = #Addon.db.profile.bindings, 1, -1 do
local binding = Addon.db.profile.bindings[i]
if binding.parent == group.identifier then
table.remove(Addon.db.profile.bindings, i)
end
end
end
--- Iterate trough all configured groups. This function can be used in a `for in` loop.
---
--- @return function iterator
--- @return table t
--- @return number i
function Clicked:IterateGroups()
return ipairs(Addon.db.profile.groups)
end
--- Create a new binding. This will create and return a new binding, however it will not automatically reload the active bindings, after configuring the
--- returned binding (to make it loadable), manually reload the active bindings using `ReloadActiveBindings`.
---
--- @return Binding
--- @see Clicked#ReloadActiveBindings
function Clicked:CreateBinding()
local binding = Addon:GetNewBindingTemplate()
table.insert(Addon.db.profile.bindings, binding)
return binding
end
--- Delete a binding. If the binding exists it will delete it from the database, if the binding is currently loaded, it will automatically reload the active
--- bindings.
--- @param binding Binding The binding to delete
function Clicked:DeleteBinding(binding)
assert(Addon:IsBindingType(binding), "bad argument #1, expected Binding but got " .. type(binding))
for index, other in ipairs(Addon.db.profile.bindings) do
if other == binding then
table.remove(Addon.db.profile.bindings, index)
break
end
end
end
--- Iterate through all configured bindings, this will also include any bindings avaialble in the current profile that are not currently loaded. This function
--- can be used in a `for in` loop.
--- @return function iterator
--- @return table t
--- @return number i
function Clicked:IterateConfiguredBindings()
return ipairs(Addon.db.profile.bindings)
end
--@debug@
--- @param from string
function Clicked:UpgradeDatabase(from)
Addon:UpgradeDatabaseProfile(Addon.db.profile, from)
Clicked:ReloadActiveBindings()
end
--@end-debug@
-- Private addon API
--- @return Binding
function Addon:GetNewBindingTemplate()
local template = {
type = Addon.BindingTypes.SPELL,
identifier = Addon:GetNextBindingIdentifier(),
keybind = "",
parent = nil,
action = {
spellValue = "",
itemValue = "",
macroValue = "",
macroName = L["Run custom macro"],
macroIcon = [[Interface\ICONS\INV_Misc_QuestionMark]],
executionOrder = 1,
interrupt = false,
startAutoAttack = false,
startPetAttack = false,
cancelQueuedSpell = false,
targetUnitAfterCast = false
},
targets = {
hovercast = {
hostility = Addon.TargetHostility.ANY,
vitals = Addon.TargetVitals.ANY
},
regular = {
Addon:GetNewBindingTargetTemplate()
},
hovercastEnabled = false,
regularEnabled = true
},
load = {
never = false,
class = GetTriStateLoadOptionTemplate(select(2, UnitClass("player"))),
race = GetTriStateLoadOptionTemplate(select(2, UnitRace("player"))),
playerNameRealm = GetLoadOptionTemplate(UnitName("player")),
combat = GetNegatableLoadOptionTemplate(),
spellKnown = GetLoadOptionTemplate(""),
inGroup = GetLoadOptionTemplate(Addon.GroupState.PARTY_OR_RAID),
playerInGroup = GetLoadOptionTemplate(""),
form = GetTriStateLoadOptionTemplate(1),
pet = GetNegatableLoadOptionTemplate(),
stealth = GetNegatableLoadOptionTemplate(),
mounted = GetNegatableLoadOptionTemplate(),
outdoors = GetNegatableLoadOptionTemplate(),
swimming = GetNegatableLoadOptionTemplate(),
instanceType = GetTriStateLoadOptionTemplate("NONE"),
zoneName = GetLoadOptionTemplate(""),
equipped = GetLoadOptionTemplate(""),
channeling = GetNegatableStringLoadOptionTemplate(),
flying = GetNegatableLoadOptionTemplate(),
flyable = GetNegatableLoadOptionTemplate(),
specialization = GetTriStateLoadOptionTemplate(1),
talent = GetTriStateLoadOptionTemplate(1),
pvpTalent = GetTriStateLoadOptionTemplate(1),
warMode = GetNegatableLoadOptionTemplate()
},
integrations = {
}
}
if Addon:IsGameVersionAtleast("RETAIL") then
--- @type number
local specIndex = GetSpecialization()
-- Initial spec
if specIndex == 5 then
specIndex = 1
end
template.load.specialization = GetTriStateLoadOptionTemplate(specIndex)
--- @type number
local covenantId = C_Covenants.GetActiveCovenantID()
-- No covenant selected
if covenantId == 0 then
covenantId = 1
end
template.load.covenant = GetTriStateLoadOptionTemplate(covenantId)
end
return template
end
--- @return Binding.Target
function Addon:GetNewBindingTargetTemplate()
local template = {
unit = Addon.TargetUnits.DEFAULT,
hostility = Addon.TargetHostility.ANY,
vitals = Addon.TargetVitals.ANY
}
return template
end
--- @return integer
function Addon:GetNextBindingIdentifier()
local identifier = Addon.db.profile.nextBindingId
Addon.db.profile.nextBindingId = Addon.db.profile.nextBindingId + 1
return identifier
end
--- @param original Binding
--- @param replacement Binding
function Addon:ReplaceBinding(original, replacement)
assert(Addon:IsBindingType(original), "bad argument #1, expected Binding but got " .. type(original))
assert(Addon:IsBindingType(replacement), "bad argument #2, expected Binding but got " .. type(replacement))
for index, binding in ipairs(Addon.db.profile.bindings) do
if binding == original then
Addon.db.profile.bindings[index] = replacement
Clicked:ReloadActiveBindings()
break
end
end
end
---@param original Binding
---@return Binding
function Addon:CloneBinding(original)
assert(Addon:IsBindingType(original), "bad argument #1, expected Binding but got " .. type(original))
local clone = Addon:DeepCopyTable(original)
clone.identifier = Addon:GetNextBindingIdentifier()
clone.keybind = ""
clone.integrations = {}
table.insert(Addon.db.profile.bindings, clone)
Clicked:ReloadActiveBindings()
return clone
end
--- Upgrade the version of the specified profile to the latest version, this process is incremental and will upgrade a profile with intermediate steps of all
--- versions in between the input version and the current version.
---
--- For example, if the current version is `0.17` and the input profile is `0.14`, it will incrementally upgrade by going `0.14`->`0.15`->`0.16`->`0.17`.
--- This will ensure support for even very old profiles.
---
--- @param profile table
--- @param from string|nil
function Addon:UpgradeDatabaseProfile(profile, from)
from = from or profile.version
-- Don't use any constants in this function to prevent breaking the updater
-- when the value of a constant changes. Always use direct values that are
-- read from the database.
if from == nil then
-- Incredible hack because I accidentially removed the serialized version
-- number in 0.12.0. This will check for all the characteristics of a 0.12
-- profile to determine if it's an existing profile, or a new profile.
local function IsProfileFrom_0_12()
if profile.bindings and profile.bindings.next and profile.bindings.next > 1 then
return true
end
if profile.groups and profile.groups.next and profile.groups.next > 1 then
return true
end
if profile.blacklist and #profile.blacklist > 0 then
return true
end
return false
end
local function IsProfileFrom_0_4()
if profile.bindings and #profile.bindings > 0 then
return true
end
return false
end
if IsProfileFrom_0_12() then
from = "0.12.0"
elseif IsProfileFrom_0_4() then
from = "0.4.0"
else
profile.version = Clicked.VERSION
return
end
end
if from == Clicked.VERSION then
return
end
local function FinalizeVersionUpgrade(newVersion)
print(Addon:GetPrefixedAndFormattedString(L["Upgraded profile from version %s to version %s"], from or "UNKNOWN", newVersion))
profile.version = newVersion
from = newVersion
end
-- version 0.4.x to 0.5.0
if string.sub(from, 1, 3) == "0.4" then
for _, binding in ipairs(profile.bindings) do
if #binding.targets > 0 and binding.targets[1].unit == "GLOBAL" then
binding.targetingMode = "GLOBAL"
binding.targets = {
{
unit = "TARGET",
type = "ANY"
}
}
else
binding.targetingMode = "DYNAMIC_PRIORITY"
end
binding.load.inGroup = {
selected = false,
state = "IN_GROUP_PARTY_OR_RAID"
}
binding.load.playerInGroup = {
selected = false,
player = ""
}
end
FinalizeVersionUpgrade("0.5.0")
end
-- version 0.5.x to 0.6.0
if string.sub(from, 1, 3) == "0.5" then
for _, binding in ipairs(profile.bindings) do
binding.load.stance = {
selected = 0,
single = 1,
multiple = {
1
}
}
binding.load.talent = {
selected = 0,
single = 1,
multiple = {
1
}
}
end
FinalizeVersionUpgrade("0.6.0")
end
-- version 0.6.x to 0.7.0
if string.sub(from, 1, 3) == "0.6" then
profile.blacklist = {}
for _, binding in ipairs(profile.bindings) do
binding.primaryTarget = {
unit = binding.targets[1].unit,
hostility = binding.targets[1].type
}
binding.secondaryTargets = binding.targets
table.remove(binding.secondaryTargets, 1)
for _, target in ipairs(binding.secondaryTargets) do
target.hostility = target.type
target.type = nil
end
if binding.type == "MACRO" then
binding.primaryTarget = {
unit = "GLOBAL",
hostility = "ANY"
}
elseif binding.type == "UNIT_SELECT" or binding.type == "UNIT_MENU" then
binding.primaryTarget = {
unit = "HOVERCAST",
hostility = "ANY"
}
else
if binding.targetingMode == "HOVERCAST" then
binding.primaryTarget = {
unit = "HOVERCAST",
hostility = "ANY"
}
elseif binding.targetingMode == "GLOBAL" then
binding.primaryTarget = {
unit = "GLOBAL",
hostility = "ANY"
}
end
end
-- Run this sanity check last, to force any bindings using the left
-- or right mouse buttons to be HOVERCAST.
if binding.keybind == "BUTTON1" or binding.keybind == "BUTTON2" then
binding.primaryTarget = {
unit = "HOVERCAST",
hostility = binding.primaryTarget.hostility
}
end
binding.action.stopcasting = binding.action.stopCasting
binding.action.stopCasting = nil
binding.action.macrotext = binding.action.macro
binding.action.macro = nil
binding.action.macroMode = "FIRST"
binding.targets = nil
binding.targetingMode = nil
end
FinalizeVersionUpgrade("0.7.0")
end
-- version 0.7.x to 0.8.0
if string.sub(from, 1, 3) == "0.7" then
for _, binding in ipairs(profile.bindings) do
binding.primaryTarget.vitals = "ANY"
if binding.primaryTarget.unit == "GLOBAL" then
binding.primaryTarget.unit = "DEFAULT"
end
for _, target in ipairs(binding.secondaryTargets) do
if target.unit == "GLOBAL" then
target.unit = "DEFAULT"
end
target.vitals = "ANY"
end
binding.load.combat.value = binding.load.combat.state
binding.load.combat.state = nil
binding.load.spellKnown.value = binding.load.spellKnown.spell
binding.load.spellKnown.spell = nil
binding.load.inGroup.value = binding.load.inGroup.state
binding.load.inGroup.state = nil
binding.load.playerInGroup.value = binding.load.playerInGroup.player
binding.load.playerInGroup.player = nil
binding.load.pet = {
selected = false,
value = "ACTIVE"
}
if Addon:IsGameVersionAtleast("RETAIL") then
binding.load.pvpTalent = {
selected = 0,
single = 1,
multiple = {
1
}
}
binding.load.warMode = {
selected = false,
value = "IN_WAR_MODE"
}
end
binding.actions = {
spell = {
displayName = binding.action.spell,
displayIcon = "",
value = binding.action.spell,
interruptCurrentCast = binding.action.stopcasting
},
item = {
displayName = binding.action.item,
displayIcon = "",
value = binding.action.item,
interruptCurrentCast = binding.action.stopcasting
},
macro = {
displayName = "",
displayIcon = "",
value = binding.action.macrotext,
mode = binding.action.macroMode
},
unitSelect = {
displayName = "",
displayIcon = ""
},
unitMenu = {
displayName = "",
displayIcon = ""
}
}
binding.action = nil
binding.icon = nil
end
profile.options = {
onKeyDown = false
}
FinalizeVersionUpgrade("0.8.0")
end
-- 0.8.x to 0.9.0
if string.sub(from, 1, 3) == "0.8" then
for _, binding in ipairs(profile.bindings) do
binding.load.form = {
selected = 0,
single = 1,
multiple = {
1
}
}
binding.load.stance = nil
binding.actions.spell.startAutoAttack = true
binding.actions.item.startAutoAttack = true
binding.actions.item.stopCasting = nil
end
Addon:ShowInformationPopup("Clicked: Binding stance/shapeshift form load options have been reset, sorry for the inconvenience.")
FinalizeVersionUpgrade("0.9.0")
end
-- 0.9.x to 0.10.0
if string.sub(from, 1, 3) == "0.9" then
profile.bindings.next = 1
for _, binding in ipairs(profile.bindings) do
binding.actions.spell.startAutoAttack = nil
binding.actions.item.startAutoAttack = nil
binding.identifier = profile.bindings.next
profile.bindings.next = profile.bindings.next + 1
local class = select(2, UnitClass("player"))
binding.load.class = {
selected = 0,
single = class,
multiple = {
class
}
}
local race = select(2, UnitRace("player"))
binding.load.race = {
selected = 0,
single = race,
multiple = {
race
}
}
binding.load.playerNameRealm = {
selected = false,
value = UnitName("player")
}
end
profile.groups = {
next = 1
}
FinalizeVersionUpgrade("0.10.0")
end
-- 0.10.x to 0.11.0
if string.sub(from, 1, 4) == "0.10" then
for _, binding in ipairs(profile.bindings) do
local hovercast = {
enabled = false,
hostility = "ANY",
vitals = "ANY"
}
local regular = {
enabled = false
}
if binding.primaryTarget.unit == "HOVERCAST" then
hovercast.enabled = true
hovercast.hostility = binding.primaryTarget.hostility
hovercast.vitals = binding.primaryTarget.vitals
table.insert(regular, {
unit = "DEFAULT",
hostility = "ANY",
vitals = "ANY"
})
else
if binding.primaryTarget.unit == "MOUSEOVER" and Addon:IsMouseButton(binding.keybind) then
hovercast.enabled = true
hovercast.hostility = binding.primaryTarget.hostility
hovercast.vitals = binding.primaryTarget.vitals
end
regular.enabled = true
table.insert(regular, binding.primaryTarget)
for _, target in ipairs(binding.secondaryTargets) do
table.insert(regular, target)
end
end
if binding.type == Addon.BindingTypes.MACRO then
while #regular > 0 do
table.remove(regular, 1)
end
regular[1] = Addon:GetNewBindingTargetTemplate()
hovercast.hostility = Addon.TargetHostility.ANY
hovercast.vitals = Addon.TargetVitals.ANY
end
binding.targets = {
hovercast = hovercast,
regular = regular
}
binding.primaryTarget = nil
binding.secondaryTargets = nil
end
for _, group in ipairs(profile.groups) do
group.displayIcon = group.icon
group.icon = nil
end
FinalizeVersionUpgrade("0.11.0")
end
-- 0.11.x to 0.12.0
if string.sub(from, 1, 4) == "0.11" then
for _, binding in ipairs(profile.bindings) do
binding.action = {
spellValue = binding.actions.spell.value,
itemValue = binding.actions.item.value,
macroValue = binding.actions.macro.value,
macroMode = binding.actions.macro.mode,
interrupt = binding.type == Addon.BindingTypes.SPELL and binding.actions.spell.interruptCurrentCast or binding.type == Addon.BindingTypes.ITEM and binding.actions.item.interruptCurrentCast or false,
allowStartAttack = true
}
binding.cache = {
displayName = "",
displayIcon = ""
}
binding.actions = nil
end
FinalizeVersionUpgrade("0.12.0")
end
-- 0.12.x to 0.13.0
if string.sub(from, 1, 4) == "0.12" then
for _, binding in ipairs(profile.bindings) do
binding.action.cancelQueuedSpell = false
end
FinalizeVersionUpgrade("0.13.0")
end
-- 0.13.x to 0.14.0
if string.sub(from, 1, 4) == "0.13" then
for _, binding in ipairs(profile.bindings) do
binding.load.covenant = {
selected = 0,
single = 1,
multiple = {
1
}
}
binding.action.targetUnitAfterCast = false
end
FinalizeVersionUpgrade("0.14.0")
end
-- 0.14.x to 0.15.0
if string.sub(from, 1, 4) == "0.14" then
for _, binding in ipairs(profile.bindings) do
binding.load.instanceType = {
selected = 0,
single = "NONE",
multiple = {
"NONE"
}
}
end
FinalizeVersionUpgrade("0.15.0")
end
-- 0.15.x to 0.16.0
if string.sub(from, 1, 4) == "0.15" then
profile.options.tooltips = false
for _, binding in ipairs(profile.bindings) do
binding.integrations = {}
end
FinalizeVersionUpgrade("0.16.0")
end
-- 0.16.x to 0.17.0
if string.sub(from, 1, 4) == "0.16" then
profile.options.minimap = profile.minimap
profile.minimap = nil
FinalizeVersionUpgrade("0.17.0")
end
-- 0.17.x to 1.0.0
if string.sub(from, 1, 4) == "0.17" then
for _, binding in ipairs(profile.bindings) do
binding.action.macroName = L["Run custom macro"]
binding.action.macroIcon = [[Interface\ICONS\INV_Misc_QuestionMark]]
if binding.type == Addon.BindingTypes.MACRO then
binding.action.macroName = binding.cache.displayName
binding.action.macroIcon = binding.cache.displayIcon
end
binding.action.executionOrder = 1
binding.load.combat.value = binding.load.combat.value == "IN_COMBAT"
binding.load.pet.value = binding.load.pet.value == "ACTIVE"
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
binding.load.warMode.value = binding.load.warMode.value == "IN_WAR_MODE"
binding.load.flying = {
selected = false,
value = true
}
binding.load.flyable = {
selected = false,
value = true
}
end
binding.load.stealth = {
selected = false,
value = true
}
binding.load.mounted = {
selected = false,
value = true
}
binding.load.outdoors = {
selected = false,
value = true
}
binding.load.swimming = {
selected = false,
value = true
}
binding.load.zoneName = {
selected = false,
value = ""
}
binding.cache = nil
end
local function GetRelatedBindings(binding)
local result = {}
for _, other in ipairs(profile.bindings) do
if other ~= binding and other.keybind == binding.keybind and other.type ~= "APPEND" and other.action.macroMode ~= "APPEND" then
table.insert(result, other)
end
end
return ipairs(result)
end
for _, binding in ipairs(profile.bindings) do
if binding.type == Addon.BindingTypes.MACRO then
if binding.action.macroMode == "FIRST" then
for _, other in GetRelatedBindings(binding) do
other.action.executionOrder = other.action.executionOrder + 1
end
elseif binding.action.macroMode == "LAST" then
local last = 0
for _, other in GetRelatedBindings(binding) do
if other.action.executionOrder > last then
last = other.action.executionOrder
end
end
binding.action.executionOrder = last + 1
elseif binding.action.macroMode == "Append" then
binding.type = "APPEND"
end
end
binding.action.macroMode = nil
end
FinalizeVersionUpgrade("1.0.0")
end
-- 1.0.x to 1.1.0
if string.sub(from, 1, 3) == "1.0" then
for _, binding in ipairs(profile.bindings) do
binding.targets.regularEnabled = binding.targets.regular.enabled
binding.targets.regular.enabled = nil
binding.targets.hovercastEnabled = binding.targets.hovercast.enabled
binding.targets.hovercast.enabled = nil
end
profile.nextGroupId = profile.groups.next
profile.groups.next = nil
profile.nextBindingId = profile.bindings.next
profile.bindings.next = nil
FinalizeVersionUpgrade("1.1.0")
end
-- 1.1.x to 1.2.0
if string.sub(from, 1, 3) == "1.1" then
for _, binding in ipairs(profile.bindings) do
binding.load.equipped = {
selected = false,
value = ""
}
end
FinalizeVersionUpgrade("1.2.0")
end
-- 1.2.x to 1.3.0
if string.sub(from, 1, 3) == "1.2" then
for _, binding in ipairs(profile.bindings) do
binding.action.startAutoAttack = binding.action.allowStartAttack
binding.action.startPetAttack = false
binding.action.allowStartAttack = nil
end
FinalizeVersionUpgrade("1.3.0")
end
-- 1.3.x to 1.4.0
if string.sub(from, 1, 3) == "1.3" then
for _, binding in ipairs(profile.bindings) do
binding.load.channeling = {
selected = false,
negated = false,
value = ""
}
-- Somehow `load.never` could potentially be nil in some magical circumstances..
-- This should make sure that doesn't happen.
if binding.load.never == nil then
binding.load.never = false
end
end
FinalizeVersionUpgrade("1.4.0")
end
-- 1.4.x to 1.5.0
if string.sub(from, 1, 3) == "1.4" then
for _, binding in ipairs(profile.bindings) do
binding.load.flying = binding.load.flying or {
selected = false,
value = false
}
binding.load.flyable = binding.load.flyable or {
selected = false,
value = false
}
binding.load.specialization = binding.load.specialization or {
selected = 0,
single = 1,
multiple = {
1
}
}
binding.load.talent = binding.load.talent or {
selected = 0,
single = 1,
multiple = {
1
}
}
binding.load.pvpTalent = binding.load.pvpTalent or {
selected = 0,
single = 1,
multiple = {
1
}
}
binding.load.warMode = binding.load.warMode or {
selected = false,
value = true
}
end
FinalizeVersionUpgrade("1.5.0")
end
profile.version = Clicked.VERSION
end
|
--[[ Copyright (c) 2018 Optera
* Part of LTN Content Reader
*
* See LICENSE.md in the project directory for license information.
--]]
local flib = require('__flib__.data-util')
local provider_reader_entity = flib.copy_prototype(data.raw["constant-combinator"]["constant-combinator"], "ltn-provider-reader")
provider_reader_entity.item_slot_count = 50 -- will be overwritten in final-fixes
provider_reader_entity.icon = "__LTN_Content_Reader__/graphics/icons/ltn-provider-reader.png"
provider_reader_entity.icon_size = 64
provider_reader_entity.icon_mipmaps = 4
local provider_reader_item = flib.copy_prototype(data.raw["item"]["constant-combinator"], "ltn-provider-reader")
provider_reader_item.icon = "__LTN_Content_Reader__/graphics/icons/ltn-provider-reader.png"
provider_reader_item.icon_size = 64
provider_reader_item.icon_mipmaps = 4
provider_reader_item.subgroup = "circuit-network-2"
provider_reader_item.order = "ltnr-a"
-- provider_reader_item.order = provider_reader_item.order.."b" -- sort after constant_combinator
local provider_reader_recipe = flib.copy_prototype(data.raw["recipe"]["constant-combinator"], "ltn-provider-reader")
local requester_reader_entity = flib.copy_prototype(data.raw["constant-combinator"]["constant-combinator"], "ltn-requester-reader")
requester_reader_entity.item_slot_count = 50 -- will be overwritten in final-fixes
requester_reader_entity.icon = "__LTN_Content_Reader__/graphics/icons/ltn-requester-reader.png"
requester_reader_entity.icon_size = 64
requester_reader_entity.icon_mipmaps = 4
requester_reader_entity.sprites = make_4way_animation_from_spritesheet(
{ layers =
{
{
filename = "__LTN_Content_Reader__/graphics/entity/ltn-requester-reader.png",
width = 58,
height = 52,
frame_count = 1,
shift = util.by_pixel(0, 5),
hr_version =
{
scale = 0.5,
filename = "__LTN_Content_Reader__/graphics/entity/hr-ltn-requester-reader.png",
width = 114,
height = 102,
frame_count = 1,
shift = util.by_pixel(0, 5),
},
},
{
filename = "__base__/graphics/entity/combinator/constant-combinator-shadow.png",
width = 50,
height = 34,
frame_count = 1,
shift = util.by_pixel(9, 6),
draw_as_shadow = true,
hr_version =
{
scale = 0.5,
filename = "__base__/graphics/entity/combinator/hr-constant-combinator-shadow.png",
width = 98,
height = 66,
frame_count = 1,
shift = util.by_pixel(8.5, 5.5),
draw_as_shadow = true,
},
},
},
})
local requester_reader_item = flib.copy_prototype(data.raw["item"]["constant-combinator"], "ltn-requester-reader")
requester_reader_item.icon = "__LTN_Content_Reader__/graphics/icons/ltn-requester-reader.png"
requester_reader_item.icon_size = 64
requester_reader_item.icon_mipmaps = 4
requester_reader_item.subgroup = "circuit-network-2"
requester_reader_item.order = "ltnr-b"
-- requester_reader_item.order = requester_reader_item.order.."c" -- sort after constant_combinator
local requester_reader_recipe = flib.copy_prototype(data.raw["recipe"]["constant-combinator"], "ltn-requester-reader")
local delivery_reader_entity = flib.copy_prototype(data.raw["constant-combinator"]["constant-combinator"], "ltn-delivery-reader")
delivery_reader_entity.item_slot_count = 50 -- will be overwritten in final-fixes
delivery_reader_entity.icon = "__LTN_Content_Reader__/graphics/icons/ltn-delivery-reader.png"
delivery_reader_entity.icon_size = 64
delivery_reader_entity.icon_mipmaps = 4
delivery_reader_entity.sprites = make_4way_animation_from_spritesheet(
{ layers =
{
{
filename = "__LTN_Content_Reader__/graphics/entity/ltn-delivery-reader.png",
width = 58,
height = 52,
frame_count = 1,
shift = util.by_pixel(0, 5),
hr_version =
{
scale = 0.5,
filename = "__LTN_Content_Reader__/graphics/entity/hr-ltn-delivery-reader.png",
width = 114,
height = 102,
frame_count = 1,
shift = util.by_pixel(0, 5),
},
},
{
filename = "__base__/graphics/entity/combinator/constant-combinator-shadow.png",
width = 50,
height = 34,
frame_count = 1,
shift = util.by_pixel(9, 6),
draw_as_shadow = true,
hr_version =
{
scale = 0.5,
filename = "__base__/graphics/entity/combinator/hr-constant-combinator-shadow.png",
width = 98,
height = 66,
frame_count = 1,
shift = util.by_pixel(8.5, 5.5),
draw_as_shadow = true,
},
},
},
})
local delivery_reader_item = flib.copy_prototype(data.raw["item"]["constant-combinator"], "ltn-delivery-reader")
delivery_reader_item.icon = "__LTN_Content_Reader__/graphics/icons/ltn-delivery-reader.png"
delivery_reader_item.icon_size = 64
delivery_reader_item.icon_mipmaps = 4
delivery_reader_item.subgroup = "circuit-network-2"
delivery_reader_item.order = "ltnr-c"
-- delivery_reader_item.order = requester_reader_item.order.."d" -- sort after constant_combinator
local delivery_reader_recipe = flib.copy_prototype(data.raw["recipe"]["constant-combinator"], "ltn-delivery-reader")
data:extend({
{
type = "item-subgroup",
name = "circuit-network-2",
group = "logistics",
order = data.raw["item-subgroup"]["circuit-network"].order.."2"
},
provider_reader_entity,
provider_reader_item,
provider_reader_recipe,
requester_reader_entity,
requester_reader_item,
requester_reader_recipe,
delivery_reader_entity,
delivery_reader_item,
delivery_reader_recipe,
})
-- add to circuit-network-2 if exists otherwise create tech
if data.raw["technology"]["circuit-network-2"] then
table.insert( data.raw["technology"]["circuit-network-2"].effects, { type = "unlock-recipe", recipe = "ltn-provider-reader" } )
table.insert( data.raw["technology"]["circuit-network-2"].effects, { type = "unlock-recipe", recipe = "ltn-requester-reader" } )
table.insert( data.raw["technology"]["circuit-network-2"].effects, { type = "unlock-recipe", recipe = "ltn-delivery-reader" } )
else
data:extend({
{
type = "technology",
name = "circuit-network-2",
icon = "__base__/graphics/technology/circuit-network.png",
icon_size = 256, icon_mipmaps = 4,
prerequisites = {"circuit-network"},
effects =
{
{ type = "unlock-recipe", recipe = "ltn-provider-reader" },
{ type = "unlock-recipe", recipe = "ltn-requester-reader" },
{ type = "unlock-recipe", recipe = "ltn-delivery-reader" },
},
unit =
{
count = 150,
ingredients = {
{"automation-science-pack", 1},
{"logistic-science-pack", 1},
},
time = 30
},
order = "a-d-d"
}
})
end
|
--[[
Copyright (c) 2015-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
--]]
require 'fb.luaunit'
local t2c = require 'torch2caffe.lib'
-- local logging= require 'fb.util.logging'
Test = {}
g_SLOW = "" -- set to "" to run slow tests
local fwk
if pcall(function() require 'cudnn' end) then
print("Using `cudnn`")
fwk = cudnn
else
print("Using `nn`")
fwk = nn
end
local function check(module, input_dims)
module:apply(function(m) m:evaluate() end)
local opts = {
prototxt=os.tmpname(),
caffemodel=os.tmpname(),
inputs={{name="data", input_dims=input_dims}},
}
t2c.run(opts, module)
return opts
end
local function check_opts(module, opts)
module:apply(function(m) m:evaluate() end)
opts.prototxt=os.tmpname()
opts.caffemodel=os.tmpname()
t2c.run(opts, module)
end
function Test:testSequential()
local m = nn.Sequential()
m:add(nn.Linear(100, 40))
m:add(nn.ReLU())
m:add(nn.LogSoftMax())
check(m, {400, 100})
end
function Test:testLinear()
local m = nn.Linear(100, 4096)
check(m, {2, 100})
end
function Test:testSpatialConvolutionMM()
local m = nn.SpatialConvolutionMM(3,32,3,3,1,1,1,1)
check(m, {1,3,100,100})
end
function Test:testFBThreshold()
local m = nn.Threshold(0, 1e-6)
check(m, {2, 100})
end
local function vggConv()
local m = nn.Sequential()
m:add(fwk.SpatialConvolution(3, 64, 3, 3, 1, 1, 1, 1))
m:add(fwk.ReLU())
m:add(fwk.SpatialMaxPooling(2,2,2,2))
m:add(fwk.SpatialConvolution(64,128, 3,3, 1,1, 1,1))
m:add(fwk.ReLU())
m:add(fwk.SpatialMaxPooling(2,2,2,2))
m:add(fwk.SpatialConvolution(128,256, 3,3, 1,1, 1,1))
m:add(fwk.ReLU())
m:add(fwk.SpatialConvolution(256,256, 3,3, 1,1, 1,1))
m:add(fwk.ReLU())
m:add(fwk.SpatialMaxPooling(2,2,2,2))
m:add(fwk.SpatialConvolution(256,512, 3,3, 1,1, 1,1))
m:add(fwk.ReLU())
m:add(fwk.SpatialConvolution(512,512, 3,3, 1,1, 1,1))
m:add(fwk.ReLU())
m:add(fwk.SpatialMaxPooling(2,2,2,2))
m:add(fwk.SpatialConvolution(512,512, 3,3, 1,1, 1,1))
m:add(fwk.ReLU())
m:add(fwk.SpatialConvolution(512,512, 3,3, 1,1, 1,1))
m:add(fwk.ReLU())
m:add(fwk.SpatialMaxPooling(2,2,2,2))
return m
end
function Test:testVggConv()
local m = vggConv()
check(m, {1,3,32,32})
end
local function vggLinear()
local m = nn:Sequential()
m:add(nn.View(512))
m:add(nn.Linear(512, 4096))
m:add(nn.Threshold(1e-6, 0))
m:add(nn.Dropout())
m:add(nn.Linear(4096, 2))
m:add(nn.LogSoftMax())
return m
end
function Test:testVggLinear()
local m = vggLinear()
check(m, {2,512})
end
function Test:testVggCombined()
local mm = nn.Sequential()
mm:add(vggConv())
mm:add(vggLinear())
check(mm, {2,3,32,32})
end
-- Doesn't work b/c of an transposition issue - in Caffe we transpose,
-- in Torch we don't.
-- We get a more efficient evaluation using the Caffe method.
-- function Test:testLogSumExp()
-- local m = nn.LogSumExp()
-- check(m, {5, 2})
-- end
-- function Test:testTemporalConvolution()
-- local m = nn.Sequential()
-- m:add(nn.TemporalConvolution(2, 3, 3, 1))
-- check(m, {1,1,8,2})
-- end
function Test:testConvolution()
local m = nn.SpatialConvolution(3,64,11,11,4,4,2,2)
check(m, {1, 3, 224, 224})
end
function Test:testReLU()
local m = nn.ReLU()
check(m, {10,20})
end
function Test:testSpatialMaxPooling()
local m = nn.SpatialMaxPooling(3,3,2,2)
check(m, {1, 3, 224, 224})
end
function Test:testDropout()
local m = nn.Sequential()
m:add(nn.SpatialMaxPooling(3,3,2,2))
m:add(nn.Dropout())
check(m, {1, 3, 224, 224})
end
function Test:testView()
local m = nn.View(3 * 5 * 5)
check(m, {2, 3, 5, 5})
end
function Test:testAlexnet()
-- this is AlexNet that was presented in the One Weird Trick paper.
-- http://arxiv.org/abs/1404.5997
local features = nn.Sequential()
features:add(nn.SpatialConvolution(3,64,11,11,4,4,2,2)) -- 224 -> 55
features:add(nn.Dropout())
features:add(nn.ReLU(true))
features:add(nn.SpatialMaxPooling(3,3,2,2)) -- 55 -> 27
features:add(nn.SpatialConvolution(64,192,5,5,1,1,2,2)) -- 27 -> 27
features:add(nn.Dropout())
features:add(nn.ReLU(true))
features:add(nn.SpatialMaxPooling(3,3,2,2)) -- 27 -> 13
features:add(nn.SpatialConvolution(192,384,3,3,1,1,1,1)) -- 13 -> 13
features:add(nn.Dropout())
features:add(nn.ReLU(true))
features:add(nn.SpatialConvolution(384,256,3,3,1,1,1,1)) -- 13 -> 13
features:add(nn.Dropout())
features:add(nn.ReLU(true))
features:add(nn.SpatialConvolution(256,256,3,3,1,1,1,1)) -- 13 -> 13
features:add(nn.Dropout())
features:add(nn.ReLU(true))
features:add(nn.SpatialMaxPooling(3,3,2,2)) -- 13 -> 6
local classifier = nn.Sequential()
classifier:add(nn.View(256*6*6))
local s = nn.Sequential()
s:add(nn.Linear(256*6*6, 4))
s:add(nn.Dropout())
s:add(nn.ReLU())
classifier:add(s)
local s = nn.Sequential()
s:add(nn.Linear(4, 4))
s:add(nn.Dropout())
s:add(nn.ReLU())
classifier:add(s)
classifier:add(nn.Linear(4, 20))
classifier:add(nn.LogSoftMax())
local model = nn.Sequential():add(features):add(classifier)
check(model, {10, 3, 224, 224})
end
local function inception(input_size, config)
local concat = nn.Concat(2)
if config[1][1] ~= 0 then
local conv1 = nn.Sequential()
conv1:add(nn.SpatialConvolution(input_size, config[1][1],1,1,1,1))
conv1:add(nn.Dropout())
conv1:add(nn.ReLU(true))
concat:add(conv1)
end
local conv3 = nn.Sequential()
conv3:add(nn.SpatialConvolution(input_size, config[2][1],1,1,1,1))
conv3:add(nn.Dropout())
conv3:add(nn.ReLU(true))
conv3:add(nn.SpatialConvolution(config[2][1], config[2][2],3,3,1,1,1,1))
conv3:add(nn.Dropout())
conv3:add(nn.ReLU(true))
concat:add(conv3)
local conv3xx = nn.Sequential()
conv3xx:add(nn.SpatialConvolution(input_size, config[3][1],1,1,1,1))
conv3xx:add(nn.Dropout())
conv3xx:add(nn.ReLU())
conv3xx:add(nn.SpatialConvolution(config[3][1], config[3][2],3,3,1,1,1,1))
conv3xx:add(nn.Dropout())
conv3xx:add(nn.ReLU())
conv3xx:add(nn.SpatialConvolution(config[3][2], config[3][2],3,3,1,1,1,1))
conv3xx:add(nn.Dropout())
conv3xx:add(nn.ReLU())
concat:add(conv3xx)
local pool = nn.Sequential()
if config[4][1] == 'max' then
pool:add(nn.SpatialMaxPooling(3,3,1,1,1,1):ceil())
elseif config[4][1] == 'avg' then
pool:add(nn.SpatialAveragePooling(3,3,1,1,1,1):ceil())
else
error('Unknown pooling')
end
if config[4][2] ~= 0 then
pool:add(nn.SpatialConvolution(input_size, config[4][2],1,1,1,1))
pool:add(nn.Dropout())
pool:add(nn.ReLU(true))
end
concat:add(pool)
return concat
end
local function Label(module, label)
module[label] = true
return module
end
function Test:testInceptionComponents()
local incept = inception(3, {{ 1},{ 1, 1},{ 1, 1},{'max', 1}})
for i=1,#incept.modules do
print("checking model")
local m = incept.modules[i]
print(m)
check(m, {10, 3, 16, 16})
end
end
function Test:testInception()
local incept = inception(3, {{ 1},{ 1, 1},{ 1, 1},{'max', 1}})
check(incept, {1, 3, 3, 3})
end
Test[g_SLOW .. 'testGoogLeNet'] = function(self)
local features = nn.Sequential()
features:add(nn.SpatialConvolution(3,64,7,7,2,2,3,3), 'isLayer1')
features:add(nn.Dropout()):add(nn.ReLU(true))
features:add(nn.SpatialMaxPooling(3,3,2,2):ceil())
features:add(nn.SpatialConvolution(64,64,1,1))
features:add(nn.Dropout()):add(nn.ReLU(true))
features:add(nn.SpatialConvolution(64,192,3,3,1,1,1,1))
features:add(nn.Dropout()):add(nn.ReLU(true))
features:add(nn.SpatialMaxPooling(3,3,2,2):ceil())
features:add(inception( 192, {{ 64},{ 64, 64},
{ 64, 96},{'max', 32}})) -- 3(a)
features:add(inception( 256, {{ 64},{ 64, 96},
{ 64, 96},{'max', 64}})) -- 3(b)
features:add(Label(inception( 320, {{ 0},{128,160},
{ 64, 96},{'max', 0}}), 'is3c')) -- 3(c)
features:add(nn.SpatialConvolution(576,576,2,2,2,2))
features:add(inception( 576, {{224},{ 64, 96},
{ 96,128},{'max',128}})) -- 4(a)
features:add(inception( 576, {{192},{ 96,128},
{ 96,128},{'max',128}})) -- 4(b)
features:add(inception( 576, {{160},{128,160},
{128,160},{'max', 96}})) -- 4(c)
features:add(Label(inception( 576, {{ 96},{128,192},
{160,192},{'max', 96}}), 'is4d')) -- 4(d)
local main_branch = nn.Sequential()
main_branch:add(inception( 576, {{ 0},{128,192},
{192,256},{'max', 0}})) -- 4(e)
main_branch:add(nn.SpatialConvolution(1024,1024,2,2,2,2))
main_branch:add(nn.Dropout())
main_branch:add(inception(1024, {{352},{192,320},
{160,224},{'max',128}})) -- 5(a)
main_branch:add(Label(inception(1024, {{352},{192,320},
{192,224},{'max',128}}), 'is5b')) -- 5(b)
main_branch:add(nn.SpatialMaxPooling(7,7,1,1))
main_branch:add(Label(nn.View(1024):setNumInputDims(3), 'isLastFeatures'))
main_branch:add(Label(nn.Linear(1024,1000), 'isLastLinear'))
local model = nn.Sequential():add(features):add(main_branch)
check(model, {1, 3, 224, 224})
end
function Test:testParallelModel()
local m = nn.Sequential()
local pt = nn.ParallelTable()
pt:add(nn.LookupTable(5, 10))
pt:add(nn.LookupTable(8, 10))
pt:add(nn.LookupTable(12, 10))
m:add(pt)
m:add(nn.JoinTable(1, 2))
m:add(nn.Reshape(10 * (18 + 18 + 12)))
m:add(nn.ReLU())
m:add(nn.Linear(10 * (18 + 18 + 12), 2))
check_opts(m, {inputs={
{name="parallel_1", input_dims={1,18},
tensor=torch.FloatTensor(1,18):fill(1)},
{name="parallel_2", input_dims={1,18},
tensor=torch.FloatTensor(1,18):fill(1)},
{name="parallel_3", input_dims={1,12},
tensor=torch.FloatTensor(1,12):fill(1)},
}})
end
LuaUnit:main()
|
local Region = require("refactoring.region")
local function selection_setup(refactor)
local region = Region:from_current_selection(refactor.bufnr)
local region_node = region:to_ts_node(refactor.ts:get_root())
local scope = refactor.ts:get_scope(region_node)
refactor.region = region
refactor.region_node = region_node
refactor.scope = scope
refactor.whitespace.highlight_start = vim.fn.indent(region.start_row)
refactor.whitespace.highlight_end = vim.fn.indent(region.end_row)
if refactor.scope == nil then
return false, "Scope is nil"
end
return true, refactor
end
return selection_setup
|
--
-- CBxx opcodes
--
local logger = require "logger"
local common_ops = require "opcodes.common"
local BIT = common_ops.BIT
local SET = common_ops.SET
local RES = common_ops.RES
local RL = common_ops.RL
local RLC = common_ops.RLC
local RR = common_ops.RR
local RRC = common_ops.RRC
local SLA = common_ops.SLA
local SLL = common_ops.SLL
local SRA = common_ops.SRA
local SRL = common_ops.SRL
-- locals for faster access (maybe remove this later)
local contend, read_mem_byte, write_mem_byte
local FLAG_S = 128
local FLAG_Z = 64
local FLAG_B5 = 32
local FLAG_H = 16
local FLAG_B3 = 8
local FLAG_PV = 4
local FLAG_N = 2
local FLAG_C = 1
local FLAG_N_OFF = 253
local FLAG_PV_OFF = 251
local FLAG_Z_OFF = 191
local FLAG_H_OFF = 239
local FLAG_S_OFF = 127
local FLAG_C_OFF = 254
---
-- Templates for opcodes creation: RL, RR, SLA, SRA, etc
local regular_pattern = [[
local %s, logger = ...
return function (cpu)
--logger.debug("%s %s")
cpu.%s = %s(cpu, cpu.%s)
cpu.PC = (cpu.PC + 1) & 0xffff
end
]]
-- Variant of the opcode where (HL) is used
local hl_pattern = [[
local %s, logger, read_mem_byte, contend, write_mem_byte = ...
return function (cpu)
--logger.debug("%s (HL)")
local HL = cpu.L | cpu.H << 8
local byte = read_mem_byte(cpu, HL)
contend(cpu, HL, 1)
byte = %s(cpu, byte)
write_mem_byte(cpu, HL, byte)
cpu.PC = (cpu.PC + 1) & 0xffff
end
]]
local function generate_opcodes (opcodes, base, operation_name, operation)
local variants = { "B", "C", "D", "E", "H", "L", "(HL)", "A" }
for i, variant in ipairs(variants) do
if variant == "(HL)" then
local source = hl_pattern:format(operation_name, operation_name, operation_name)
opcodes[base + i - 1] = load(source, source, "t", {})(operation, logger, read_mem_byte, contend, write_mem_byte)
else
local source = regular_pattern:format(operation_name, operation_name, variant, variant, operation_name, variant)
opcodes[base + i - 1] = load(source, source, "t", {})(operation, logger)
end
end
end
local function generate_bit_opcodes (opcodes, base, regular_pattern, hl_pattern)
local i = 0
local variants = { "B", "C", "D", "E", "H", "L", "(HL)", "A" }
for bit = 0, 7 do
for _, variant in ipairs(variants) do
if variant == "(HL)" then
local source = hl_pattern:format(bit, variant, bit, variant)
opcodes[base + i] = load(source, source, "t", {})(BIT, logger, read_mem_byte, contend, write_mem_byte)
else
local source = regular_pattern:format(bit, variant, bit, variant)
opcodes[base + i] = load(source, source, "t", {})(BIT, logger)
end
i = i + 1
end
end
end
-- operation is either RES or SET
local function generate_res_set_opcodes (opcodes, base, regular_pattern, hl_pattern, operation)
local i = 0
local variants = { "B", "C", "D", "E", "H", "L", "(HL)", "A" }
for bit = 0, 7 do
for _, variant in ipairs(variants) do
if variant == "(HL)" then
local source = hl_pattern:format(bit, bit)
opcodes[base + i] = load(source, source, "t", {})(operation, logger, read_mem_byte, contend, write_mem_byte)
else
local source = regular_pattern:format(bit, variant, variant, bit, variant)
opcodes[base + i] = load(source, source, "t", {})(operation, logger)
end
i = i + 1
end
end
end
local opcodes = {}
function opcodes.bind_io (binds)
read_mem_byte = assert(binds.memory.read_mem_byte)
write_mem_byte = assert(binds.memory.write_mem_byte)
contend = assert(binds.memory.contend)
-- Generate opcodes for RLC: RLC B, RLC C, RLC D, RLC E, RLC H, RLC L, RLC (HL), RLC A
generate_opcodes(opcodes, 0x00, "RLC", RLC)
-- Generate opcodes for RRC: RRC B, RRC C, RRC D, RRC E, RRC H, RRC L, RRC (HL), RRC A
generate_opcodes(opcodes, 0x08, "RRC", RRC)
-- Generate opcodes for RL: RL B, RL C, RL D, RL E, RL H, RL L, RL (HL), RL A
generate_opcodes(opcodes, 0x10, "RL", RL)
-- Generate opcodes for RR: RR B, RR C, RR D, RR E, RR H, RR L, RR (HL), RR A
generate_opcodes(opcodes, 0x18, "RR", RR)
-- Generate opcodes for SLA: SLA B, SLA C, SLA D, SLA E, SLA H, SLA L, SLA (HL), SLA A
generate_opcodes(opcodes, 0x20, "SLA", SLA)
-- Generate opcodes for SRA: SRA B, SRA C, SRA D, SRA E, SRA H, SRA L, SRA (HL), SRA A
generate_opcodes(opcodes, 0x28, "SRA", SRA)
-- Generate opcodes for SLL: SLL B, SLL C, SLL D, SLL E, SLL H, SLL L, SLL (HL), SLL A
generate_opcodes(opcodes, 0x30, "SLL", SLL)
-- Generate opcodes for SRL: SRL B, SRL C, SRL D, SRL E, SRL H, SRL L, SRL (HL), SRL A
generate_opcodes(opcodes, 0x38, "SRL", SRL)
-- Generate opcodes for BIT operations: BIT 0,B ... BIT 1,B ... ... BIT 7,A
generate_bit_opcodes(opcodes, 0x40, [[
local BIT, logger = ...
return function (cpu)
--logger.debug("BIT %s,%s")
BIT(cpu, %s, cpu.%s)
cpu.PC = (cpu.PC + 1) & 0xffff
end
]],
[[
local BIT, logger, read_mem_byte, contend, write_mem_byte = ...
return function (cpu)
--logger.debug("BIT %s,(HL)", cpu.PC)
local HL = cpu.L | cpu.H << 8
local byte = read_mem_byte(cpu, HL)
--logger.debug("(HL)=%s", byte)
BIT(cpu, %s, byte)
contend(cpu, HL, 1)
cpu.PC = (cpu.PC + 1) & 0xffff
end
]])
-- Generate opcodes for RES operations: RES 0,B ... RES 1,B ... ... RES 7,A
generate_res_set_opcodes(opcodes, 0x80, [[
local RES, logger = ...
return function (cpu)
--logger.debug("RES %s,%s")
cpu.%s = RES(cpu, %s, cpu.%s)
cpu.PC = (cpu.PC + 1) & 0xffff
end
]],
[[
local RES, logger, read_mem_byte, contend, write_mem_byte = ...
return function (cpu)
--logger.debug("RES %s,(HL)")
local HL = cpu.L | cpu.H << 8
local byte = read_mem_byte(cpu, HL)
byte = RES(cpu, %s, byte)
contend(cpu, HL, 1)
write_mem_byte(cpu, HL, byte)
cpu.PC = (cpu.PC + 1) & 0xffff
end
]], RES)
-- Generate opcodes for SET operations: SET 0,B ... SET 1,B ... ... SET 7,A
generate_res_set_opcodes(opcodes, 0xc0, [[
local SET, logger = ...
return function (cpu)
--logger.debug("SET %s,%s")
cpu.%s = SET(cpu, %s, cpu.%s)
cpu.PC = (cpu.PC + 1) & 0xffff
end
]],
[[
local SET, logger, read_mem_byte, contend, write_mem_byte = ...
return function (cpu)
--logger.debug("SET %s,(HL)")
local HL = cpu.L | cpu.H << 8
local byte = read_mem_byte(cpu, HL)
byte = SET(cpu, %s, byte)
contend(cpu, HL, 1)
write_mem_byte(cpu, HL, byte)
cpu.PC = (cpu.PC + 1) & 0xffff
end
]], SET)
end
return opcodes
|
local lu = require('test.luaunit')
local spectacle = require('spectacle')
local t = {}
function t.testHeader()
local result = spectacle.Header(1, 'text', {id='meh'})
local expected = '<Header size={1} id="meh">text</Header>'
lu.assertEquals(result, expected)
end
function t.testPara()
local result = spectacle.Para('paragraph')
local expected = '<Text>paragraph</Text>'
lu.assertEquals(result, expected)
end
function t.testImage()
local result = spectacle.Image('', 'image.png', 'an image')
local expected = '<Image src="image.png" />'
lu.assertEquals(result, expected)
end
function t.testBlockQuote()
local result = spectacle.BlockQuote('Be excellent to each other.')
local expected = [[
<BlockQuote>
<Quote>Be excellent to each other.</Quote>
</BlockQuote>]]
lu.assertEquals(result, expected)
end
function t.testCode()
local result = spectacle.Code('let x = 10', {})
local expected = '<Code>let x = 10</Code>'
lu.assertEquals(result, expected)
end
function t.testCodeBlock()
local result = spectacle.CodeBlock('let x = 10', {})
local expected = '<CodePane>let x = 10</CodePane>'
lu.assertEquals(result, expected)
end
function t.testLink()
local result = spectacle.Link('spectacle',
'http://github.com/formidablelabs/spectacle',
'')
local expected = '<Link href="http://github.com/formidablelabs/spectacle">spectacle</Link>'
lu.assertEquals(result, expected)
end
function t.testOrderedList()
local result = spectacle.OrderedList({"one", "two", "three"})
local expected = [[
<List>
<ListItem>one</ListItem>
<ListItem>two</ListItem>
<ListItem>three</ListItem>
</List>]]
lu.assertEquals(result, expected)
end
function t.testUnorderedList()
local result = spectacle.BulletList({"one", "two", "three"})
local expected = [[
<List>
<ListItem>one</ListItem>
<ListItem>two</ListItem>
<ListItem>three</ListItem>
</List>]]
lu.assertEquals(result, expected)
end
return t
|
local format = string.format
local concat = table.concat
local insert = table.insert
local inspect = vim.inspect
local function inspect_args(...)
local res = {}
for i = 1, select("#", ...) do
local v = select(i, ...)
insert(res, inspect(v, {newline='';indent=''}))
end
return concat(res, ', ')
end
local function get_timer_fn()
return vim and vim.loop and (function()
local hrtime = vim.loop.hrtime
local start = hrtime()
return function() return (hrtime() - start)/1e6 end
end)() or os.clock
end
local clock = get_timer_fn()
local wrapped_fns = {}
local wrapped_mt = {
__call = function(t, ...)
local fn = rawget(t, 'fn')
local argc = select("#", ...)
local args = {...}
local start = clock()
return (function(...)
local finish = clock()
insert(t.times, {
start = start;
finish = finish;
args = args;
argc = argc;
})
return ...
end)(fn(...))
end;
}
local function wrap(fn)
if type(fn) == 'table' and getmetatable(fn) == wrapped_mt then
return fn
end
if wrapped_fns[fn] then
return wrapped_fns[fn]
end
local R = setmetatable({
fn = fn;
-- info = debug.getinfo(fn);
info = select(2, pcall(debug.getinfo, fn));
times = {};
}, wrapped_mt)
wrapped_fns[fn] = R
return R
end
local linear_mt = {
__tostring = function(t)
return format("%s(%s): %gms (%f -> %f)", t.node.name or "", inspect_args(unpack(t.time.args, 1, t.time.argc)), t.time.finish - t.time.start, t.time.start, t.time.finish)
end;
}
local function linearized()
local times = {}
for fn, t in pairs(wrapped_fns) do
for _, time in ipairs(t.times) do
insert(times, setmetatable({
time = time;
node = t;
}, linear_mt))
end
end
return times
end
WRAP = function(fn) return fn end
if os.getenv("AK_PROFILER") then
require = wrap(require)
require.name = 'require'
WRAP = wrap
function ASHKAN_PROFILE_FINISH_FUNCTION(filename)
linearized()
local data = linearized()
table.sort(data, function(a, b)
if a.time.start == b.time.start then
return a.time.finish < b.time.finish
else
return a.time.start < b.time.start
end
end)
local function mktree(X, i)
local R = {
n = X;
c = {};
}
local S
while data[i] do
local t = data[i]
local is_contained = X.time.start < t.time.start and t.time.finish < X.time.finish
if is_contained then
S, i = mktree(t, i+1)
insert(R.c, S)
else
return R, i
end
end
return R, i
end
local T = mktree(setmetatable({node = {name = 'root'}, time={args={}, argc=0, start=0, finish=math.huge}}, linear_mt), 1)
local function print_em(x, depth)
depth = depth or 0
io.write((' '):rep(depth), tostring(x.n), '\n')
for i, v in ipairs(x.c) do
print_em(v, depth+1)
end
end
if filename then
io.output(io.open(filename, "w"))
else
io.output(io.stderr)
end
print_em(T)
os.exit(0)
end
vim.schedule(ASHKAN_PROFILE_FINISH_FUNCTION)
end
function M(name, fn, ...)
local X = wrap(fn)
X.name = name
return X(...)
end
return {
-- profile_startup_time = function(...)
-- local info = debug.getinfo(1)
-- local filename = info.short_src
-- local output_filename = os.tmpname()
-- vim.cmd("edit "..output_filename)
-- -- return coroutine.wrap(function(...)
-- -- local co = coroutine.running()
-- local handle
-- handle = vim.loop.spawn("nvim", {
-- stdio = {nil, nil, 2};
-- env = {
-- "ASHKAN_PROFILER=1";
-- };
-- args = vim.tbl_flatten {
-- "-c"; "luafile "..filename;
-- {...};
-- "-c"; format("lua ASHKAN_PROFILE_FINISH_FUNCTION(%q)", output_filename);
-- };
-- }, function()
-- handle:close()
-- -- coroutine.resume(co)
-- end)
-- -- coroutine.yield()
-- -- local file = io.open(output_filename)
-- -- if not file then
-- -- return
-- -- end
-- -- local data = file:read "*a"
-- -- file:close()
-- -- -- os.remove(output_filename)
-- -- return data
-- -- end)
-- end;
linearized = linearized;
wrap = wrap;
}
|
return {'ewijkse'}
|
local grandTotal = 0;
local TotalWithdraw = 0;
local TotalDeposit = 0;
local cols = {["one"]=0, ["two"]=0, ["thr"]=0 , ["fou"]=0, ["fiv"]=0, ["six"]=0, ["sev"]=0, ["egh"]=0, ["nin"]=0, ["ten"]=0, ["ele"]=0, ["twe"]=0};
local colsWithdraw = {["one"]=0, ["two"]=0, ["thr"]=0 , ["fou"]=0, ["fiv"]=0, ["six"]=0, ["sev"]=0, ["egh"]=0, ["nin"]=0, ["ten"]=0, ["ele"]=0, ["twe"]=0};
local colsDeposit = {["one"]=0, ["two"]=0, ["thr"]=0 , ["fou"]=0, ["fiv"]=0, ["six"]=0, ["sev"]=0, ["egh"]=0, ["nin"]=0, ["ten"]=0, ["ele"]=0, ["twe"]=0};
function handle_record(record)
grandTotal = grandTotal + record:get('OVERALL');
for key, value in pairs(cols) do
cols[key] = cols[key] + record:get(key);
colsWithdraw[key] = colsWithdraw[key] + record:get("WITH_" .. key);
colsDeposit[key] = colsDeposit[key] + record:get("DEP_" .. key);
TotalWithdraw = TotalWithdraw + record:get("WITH_" .. key);
TotalDeposit = TotalDeposit + record:get("DEP_" .. key);
end
end
function complete(result)
result:set("GRAND_TOTAL", grandTotal);
result:set("TOTAL_WITHDRAW", TotalWithdraw);
result:set("TOTAL_DEPOSIT", TotalDeposit);
for key, value in pairs(cols) do
result:set("TOTAL_" .. key, value);
end
for key, value in pairs(colsWithdraw) do
result:set("WITH_" .. key, value);
end
for key, value in pairs(colsDeposit) do
result:set("DEPOSIT_" .. key, value);
end
end
|
local moon = require("moon")
local json = require("json")
local httpserver = require("moon.http.server")
local conf = ...
httpserver.content_max_len = 8192
httpserver.header_max_len = 8192
httpserver.error = function(fd, err)
moon.warn(fd," disconnected:", err)
end
local cluster_etc
local function load_cluster_etc()
cluster_etc = {}
local res = json.decode(io.readfile(conf.config))
for _,v in ipairs(res) do
cluster_etc[v.node] = v
end
end
load_cluster_etc()
httpserver.on("/reload",function(request, response)
load_cluster_etc()
response.status_code = 200
response:write_header("Content-Type","text/plain")
response:write("OK")
end)
httpserver.on("/cluster",function(request, response)
local query = request.parse_query()
local node = tonumber(query.node)
local cfg = cluster_etc[node]
if not cfg or not cfg.host or not cfg.port then
response.status_code = 404
response:write_header("Content-Type","text/plain")
response:write("cluster node not found "..tostring(query.node))
return
end
response.status_code = 200
response:write_header("Content-Type","application/json")
response:write(json.encode({host = cfg.host, port = cfg.port}))
end)
httpserver.listen(conf.host, conf.port, conf.timeout)
print("Cluster etc http server start", conf.host, conf.port)
moon.shutdown(function()
moon.quit()
end)
|
--- 模块功能:MQTT客户端数据接收处理
-- @author openLuat
-- @module mqtt.mqttInMsg
-- @license MIT
-- @copyright openLuat
-- @release 2018.03.28
module(...,package.seeall)
--- MQTT客户端数据接收处理
-- @param mqttClient,MQTT客户端对象
-- @return 处理成功返回true,处理出错返回false
-- @usage mqttInMsg.proc(mqttClient)
function proc(mqttClient)
local result,data
while true do
result,data = mqttClient:receive(2000)
--接收到数据
if result then
log.info("mqttInMsg.proc",data.topic,string.toHex(data.payload))
--TODO:根据需求自行处理data.payload
--如果mqttOutMsg中有等待发送的数据,则立即退出本循环
if mqttOutMsg.waitForSend() then return true end
else
break
end
end
return result or data=="timeout"
end
|
-- Torch/Lua Kalman Filter based Ball tracker test script
-- (c) 2013 Stephen McGill
local torch = require 'torch'
torch.Tensor = torch.DoubleTensor
local libKalman = require 'libKalman'
-- set the seed
math.randomseed(1234)
-- Debugging options
local show_kalman_gain = false
local debug_each_state = false
local test_two = true
-- 3 dimensional kalman filter
local myDim = 10;
local nIter = 5000;
-- Control input
local u_k_input = torch.Tensor( myDim ):zero()
-- Set the observations
local obs1 = torch.Tensor( myDim ):zero()
-- Initialize the filter
local kalman1 = libKalman.new_filter(myDim)
local x,P = kalman1:get_state()
if test_two then
kalman2 = libKalman.new_filter(myDim)
obs2 = torch.Tensor(myDim):zero()
end
-- Print the initial state
local initial_str = 'Initial State:\n'
for d=1,x:size(1) do
initial_str = initial_str..string.format(' %.3f',x[d])
end
print(initial_str)
-- Begin the test loop
for i=1,nIter do
-- Make an observation
obs1[1] = i + .2*(math.random()-.5)
for p=2,obs1:size(1)-1 do
obs1[p] = i/p + 1/(5*p)*(math.random()-.5)
end
-- Perform prediction
kalman1:predict( u_k_input )
local x_pred, P_pred = kalman1:get_prior()
-- Perform correction
kalman1:correct( obs1 )
x,P = kalman1:get_state()
if test_two then
for p=1,obs2:size(1) do
obs2[p] = 1/obs1[p]
end
kalman2:predict( u_k_input )
kalman2:correct( obs2 )
end
-- Print debugging information
if debug_each_state then
-- Save prediction string
local prior_str = 'Prior:\t'
for d=1,x_pred:size(1) do
prior_str = prior_str..string.format(' %f',x_pred[d])
end
-- Save observation string
local observation_str = 'Observe:\t'
for d=1,obs1:size(1) do
observation_str = observation_str..string.format(' %f',obs1[d])
end
-- Save corrected state string
local state_str = 'State:\t'
for d=1,x:size(1) do
state_str = state_str..string.format(' %f',x[d])
end
print('Iteration',i)
print(prior_str)
print(observation_str)
print(state_str)
if show_kalman_gain then
-- Save the Kalman gain and A strings
local kgain_str = 'Kalman gain\n'
local K = kalman1.K_k;
for i=1,K:size(1) do
for j=1,K:size(2) do
kgain_str = kgain_str..string.format(' %f',K[i][j])
end
kgain_str = kgain_str..'\n'
end
local a_str = 'A:\n'
local A = kalman1.A;
for i=1,A:size(1) do
for j=1,A:size(2) do
a_str = a_str..string.format(' %.3f',A[i][j])
end
a_str = a_str..'\n'
end
print(a_str)
print(kgain_str)
end
end
end
x,P = kalman1:get_state()
local final_str = 'Final State:\n'
for d=1,x:size(1) do
final_str = final_str..string.format(' %.3f',x[d])
end
print(final_str)
|
--
-- _ninja.lua
-- Define the Ninja Build action.
--
premake.actions.ninja = {}
premake.abstract.ninjaVar = {}
local ninja = premake.actions.ninja
local ninjaVar = premake.abstract.ninjaVar
local solution = premake.solution
local project = premake5.project
local clean = premake.actions.clean
local config = premake5.config
ninja.buildFileHandle = {}
local slnDone = {}
local globalScope = {}
ninja.rootVar = "$root/"
--
-- The Ninja build action. Currently only tested with C++
--
newaction {
trigger = "ninja",
shortname = "Ninja Build",
description = { "Generate ninja files for Ninja Build. Default action will place ninja files in the targetdir", },
--"'ninja local' will place ninja files in the source tree"},
-- temporary
isnextgen = true,
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
valid_languages = { "C", "C++" },
valid_tools = {
cc = { "gcc", "icc" },
},
buildFileHandle = nil,
onStart = function()
local slnList = Seq:ipairs(solution.list)
if slnList:count() > 1 then
printDebug('Building solutions : '..slnList:select('name'):mkstring(', '))
else
printDebug('Building solution : '..slnList:first().name)
end
end,
onSolution = function(sln)
ninja.onSolution(sln.name)
end,
onEnd = function()
ninja.onEnd()
end,
execute = function()
ninja.onExecute()
end,
oncleansolution = function(sln)
clean.file(sln, ninja.getSolutionBuildFilename(sln))
clean.file(sln, path.join(sln.basedir, 'build.ninja'))
ninja.setNinjaBuildDir(sln)
clean.file(sln, path.join(ninja.builddir, 'buildedges.ninja'))
clean.file(sln, path.join(ninja.builddir, '.ninja_log'))
end,
}
function ninja.onSolution(slnName)
local sln = solution.list[slnName]
if not sln then
print('Could not find solution '..slnName)
return
end
-- Build included solutions first
if not slnDone[slnName] then
if sln.includesolution then
for _,v in ipairs(sln.includesolution) do
ninja.onSolution(v)
end
end
ninja.setNinjaBuildDir(sln)
ninja.openFile(path.join(ninja.builddir, 'buildedges.ninja'))
ninja.generateSolution(sln, globalScope)
-- Must come after the main buildedges.ninja as we need to write out the default build statements
ninja.checkIgnoreFiles(sln.basedir)
ninja.generateDefaultBuild(sln, sln.basedir, globalScope)
slnDone[slnName] = true
end
end
-- After the last solution
function ninja.onEnd()
local f = ninja.openFile(path.join(ninja.builddir, 'buildedges.ninja'))
ninja.writeFooter(globalScope)
ninja.closeFile(f)
-- Write a default build for the repoRoot
if repoRoot ~= ninja.builddir and (not ninja.scope[repoRoot]) then
ninja.checkIgnoreFiles(repoRoot)
--ninja.generateDefaultBuild(nil, repoRoot, globalScope)
end
slnDone = {}
end
function ninja.openFile(filename)
if not ninja.buildFileHandle[filename] then
ninja.buildFileName = filename
ninja.buildFileHandle[filename] = premake.generateStart(filename, true)
globalScope = ninja.newScope(filename)
else
io.output(ninja.buildFileHandle[filename])
globalScope = ninja.scope[filename]
end
return filename
end
function ninja.closeFile(filename)
if filename ~= ninja.buildFileName then
error('Close files in order. Expected '..ninja.buildFileName)
end
if filename and ninja.buildFileHandle[filename] then
local h = ninja.buildFileHandle[filename]
if _OPTIONS['debug'] and type(h) == 'userdata' then
local fileLen = h:seek('end', 0)
local cwd = os.getcwd()
if fileLen then
printf('Generated %s : %.0f kb', path.getrelative(cwd, filename), fileLen/1024.0)
end
end
premake.generateEnd(h, filename)
ninja.buildFileHandle[filename] = nil
end
ninja.buildFileName = nil
end
function ninja.getSolutionBuildFilename(sln)
return path.join(sln.basedir, 'build_'..sln.name..'.ninja')
end
function ninja.setNinjaBuildDir(sln)
-- builddir is where the build log & main ninja file is placed
if (not ninja.builddir) then
ninja.builddir = iif( sln.ninjaBuildDir, sln.ninjaBuildDir, repoRoot)
ninja.builddir = ninja.builddir:replace(ninja.rootVar,repoRoot)
ninja.checkIgnoreFiles(ninja.builddir)
end
ninja.builddir = path.getabsolute(ninja.builddir)
end
function ninja.onExecute()
local args = Seq:new(_ARGS)
if not args:contains('nobuild') then
local cmd = 'ninja'
if _OPTIONS['threads'] then
cmd = cmd .. ' -j'..tostring(_OPTIONS['threads'])
end
if os.isfile('build.ninja') then
print('Building with ninja...')
else
local dir = os.getcwd()
while dir ~= '/' do
if os.isfile(path.join(dir,'build.ninja')) then
break
end
dir = path.getdirectory(dir)
end
if dir == '/' then
print('Unknown build, no solution found in current directory or its parents')
return
end
local ninjadir = path.getrelative(os.getcwd(), dir)
if ninjadir:startswith('..') then ninjadir = dir end
print('Running ninja on '..ninjadir)
cmd = cmd .. ' -q -C ' .. dir
end
local rv = os.executef(cmd)
if rv ~= 0 then
os.exit(rv)
end
elseif args:contains('print') then
local printAction = premake.action.get('print')
premake.action.call(printAction.trigger)
end
end
function ninja.checkIgnoreFiles(dir)
local sourceControls = {
{ dir = '.git', ignore = '.gitignore' },
{ dir = '.hg', ignore = '.hgignore' },
}
local foundFile = {}
if _OPTIONS['automated'] then
return
end
for _,sc in ipairs(sourceControls) do
if os.isdir(path.join(dir, sc.dir)) then
local ignoreFile = path.join(dir, sc.ignore)
local foundIgnore = false
if os.isfile(ignoreFile) then
local f = io.open(ignoreFile, "r")
for line in f:lines() do
if line:find('.ninja',1,true) then
foundIgnore = true
end
end
io.close(f)
end
if not foundIgnore then
-- Not found
print('Did not find *.ninja in the '..sc.ignore..' file ('..dir..'). Do you want to add it? [Recommended] (Y/n)')
local key = io.input():read(1)
if key:lower() == 'y' then
local f
if os.isfile(ignoreFile) then
f = io.open(ignoreFile, "a")
else
f = io.open(ignoreFile, "w")
end
f:write('*.ninja\n')
io.close(f)
end
end
end
end
end
-- returns the input files per config, per buildaction
-- local filesInConfig = getInputFiles(prj)[cfg.shortname][buildaction]
function ninja.getInputFiles(prj)
if prj.filesPerConfig then
return prj.filesPerConfig
end
local tmr = timer.start('ninja.getInputFiles')
local tr = project.getsourcetree(prj)
local filesPerConfig = {} -- list of files per config
local defaultAction = 'Compile'
for cfg in project.eachconfig(prj) do
filesPerConfig[cfg] = {}
end
premake.tree.traverse(tr, {
onleaf = function(node, depth)
-- figure out what configurations contain this file
local inall = true
local filename = node.abspath
local custom = false
for cfg in project.eachconfig(prj) do
local filecfg = config.getfileconfig(cfg, filename) or {}
local buildaction = filecfg.buildaction or defaultAction
local t = filesPerConfig[cfg][buildaction] or {}
filesPerConfig[cfg][buildaction] = t
--table.insert( filesPerConfig[cfg][buildaction], filename)
t[filename] = filecfg
table.insert( t, filename )
--custom = (filecfg.buildrule ~= nil)
end
end
})
prj.filesPerConfig = filesPerConfig
timer.stop(tmr)
return filesPerConfig
end
--
-- Escape a string so it can be written to a ninja build file.
--
function ninja.esc(value)
local result
if (type(value) == "table") then
result = { }
for _,v in ipairs(value) do
table.insert(result, ninja.esc(v))
end
return result
else
-- handle simple replacements
result = value:gsub("%$%(", "%$%$%(")
return result
end
end
function ninja.escPath(value)
return value
end
-- Get the syntax for accessing a variable, with correct escaping
function ninja.escVarName(varName)
if string.sub(varName,1,1) == '$' then
return varName
end
if #varName == 0 then
return varName
end
if true or string.find(varName, ".", 1, true) then
varName = '${' .. varName .. '}'
else
varName = '$' .. varName
end
return varName
end
-- Returns (newVarName, found)
-- newVarName : a mangled varName which will refer to the specified unique value
-- found : true is if it's already found
-- Just to make the ninja file look nicer
ninja.scope = {}
ninjaVar = {}
ninjaVar.nameToValue = {}
ninjaVar.findNameIdx = {}
ninjaVar.valueToName = {}
ninjaVar.valueToWeight = {}
function ninja.newScope(scopeName)
local s = inheritFrom(ninjaVar)
ninja.scope[scopeName] = s
s:set('','')
s:set('builddir', ninja.builddir)
s:set('root', repoRoot)
s:set('tmp', '')
return s
end
-- Call this function 'threshold' times with the same value & it'll set the var
-- returns : useThis, isNewVar
function ninjaVar:trySet(varName, value, threshold)
-- Check if it is already a variable
local existingVarName = self.valueToName[value]
if existingVarName then
return ninja.escVarName(existingVarName), false
end
local count = (self.valueToWeight[value] or 0) + 1
self.valueToWeight[value] = count
if count > threshold then
-- Create a new var
self:set(varName, value)
return ninja.escVarName(varName), true
else
return value, false
end
end
-- returns varName, alreadyExists
function ninjaVar:set(varName, value, alternateVarNames)
local varNameM = varName
local i = 1
while self.nameToValue[varNameM] do
-- Found a var which already exists with this value
if self.nameToValue[varNameM] == value then
return varNameM,true
end
if alternateVarNames and #alternateVarNames > 0 then
varNameM = alternateVarNames[1]
alternateVarNames = table.remove(alternateVarNames, 1)
else
i = (self.findNameIdx[varName] or i) + 1
self.findNameIdx[varName] = i
varNameM = varName .. tostring(i)
end
end
self.nameToValue[varNameM] = value
self.valueToName[value] = varNameM
return varNameM,false
end
function ninjaVar:add(name, valuesToAdd)
local r = self.nameToValue[name]
if r then
if type(r) ~= 'table' then
r = { r }
end
for _,v in ipairs(valuesToAdd) do
table.insert(r, v)
end
self.nameToValue[name] = r
else
self.nameToValue[name] = valuesToAdd
end
end
function ninjaVar:get(name)
return self.nameToValue[name]
end
-- returns varName, alreadyExists
function ninjaVar:getName(value, setNameIfNew)
local var = self.valueToName[value]
if (not var) and setNameIfNew then
return self:set(setNameIfNew, value)
end
return var, true
end
-- Substitutes variables in to v, to make the string the smallest size
function ninjaVar:getBest(v)
if v == '' then return '' end
local tmr = timer.start('ninja.getBest')
-- try $root first
v = string.replace(v, repoRoot, ninja.rootVar)
local bestV = self.valueToName[v]
--[[
local bestV = v
for varValue,varName in pairs(self.valueToName) do
if type(varValue) == 'string' and #varValue > 0 then
local varNameN = ninja.escVarName(varName)
local replaced = string.replace(v, varValue, varNameN)
local replaced2 = string.replace(bestV, varValue, varNameN)
if #replaced < #bestV then
bestV = replaced
end
if #replaced2 < #bestV then
bestV = replaced2
end
end
end
]]
if bestV then
v = ninja.escVarName(bestV)
end
timer.stop(tmr)
return v
end
function ninjaVar:include(otherScopeName)
local otherScope = ninja.scope[otherScopeName]
if not otherScope then
error('Could not find ninja var scope ' .. otherScopeName)
end
for k,v in pairs(otherScope.nameToValue) do
self.nameToValue[k] = v
self.valueToName[v] = k
end
end
function ninjaVar:getBuildVars(inputs, weight, newVarPrefix)
newVarPrefix = newVarPrefix or 'tmp'
local rv = {}
for k,v in pairs(inputs or {}) do
if v ~= '' and not v:startswith('$') then
if v:find(repoRoot,1,true) then
v = string.replace(v, repoRoot, ninja.rootVar)
inputs[k] = v
end
local vWeight = (self.valueToWeight[v] or 0) + weight
self.valueToWeight[v] = vWeight
local createNewVars = iif( vWeight > 5, newVarPrefix, nil)
local varName, alreadyExists = self:getName(v, createNewVars)
if varName and k ~= varName then
inputs[k] = ninja.escVarName(varName)
end
if not alreadyExists then
rv[varName] = v
end
end
end
return rv
end
|
local component = require("component")
local event = require("event")
local serialization = require("serialization")
local eventHandler = require("gachLib.type.eventHandler")
local state = require("gachLib.state")
local gLn = {
event = {
onDirectoryAdded = eventHandler(),
onDirectoryRemoved = eventHandler(),
onPong = eventHandler(),
onGetStateAnswer = eventHandler(),
},
directory = {
-- [name] = address
},
protocol = "gachLib.state",
--DEBUG
debug = {}
}
local doc = {
directory = "-- Table of name and address of computers in network."
}
local private = {
port = 1,
eventListener = nil,
stateTimer = nil,
stateSubscription = nil,
stateChanged = false,
stateSubsciber = {},
pingWaiter = {
-- [onPongId] = { waiter = 2, callbcack = func}
}
}
function private.createPackage(code, targetName, targetAddress, data)
local packet = {
code = code,
source = {
name = nm.computername,
address = gLn.nm.modemProxy.address
},
target = {
name = targetName,
address = targetAddress
}
}
if data ~= nil and type(data) ~= "function" then
packet.data = data
end
return serialization.serialize({gLn.protocol, packet})
end
function private.messageCheck(message)
local ret = 0
if message ~= nil and message.source ~= nil and message.target ~= nil then
ret = 1
if message.target.name == "BROADCAST" or message.target.name == nm.computername or message.target.address == gLn.nm.modemProxy.address then
ret = 2
end
end
return ret
end
function private.onModemMessage(eventName, receiverAddress, senderAddress, port, distance, protocol, message)
message = serialization.unserialize(message)
-- DEBUG
local messageCheck = private.messageCheck(message)
gLn.debug[#gLn.debug + 1] = {messageCheck, message}
if messageCheck > 0 then
if gLn.directory[message.source.name] == nil or gLn.directory[message.source.name] ~= message.source.address then
gLn.directory[message.source.name] = message.source.address
gLn.event.onDirectoryAdded:trigger(message.source)
end
if message.code == "di" then
-- discovery
gLn.nm.sendMessage(
private.port,
message.source.address,
private.createPackage("dia", message.source.name, message.source.address))
elseif message.code == "rm" then
-- computer stoped
gLn.directory[message.source.name] = nil
private.stateSubsciber[message.source.name] = nil
gLn.event.onDirectoryRemoved:trigger(message.source)
end
if messageCheck > 1 then
if message.code == "ping" then
-- ping
gLn.nm.sendMessage(
private.port,
message.source.address,
private.createPackage("pong", message.source.name, message.source.address))
elseif message.code == "pong" then
-- pong
gLn.event.onPong:trigger(message.source)
elseif message.code == "gs" then
-- getState
gLn.nm.sendMessage(
private.port,
message.source.address,
private.createPackage("gsa", message.source.name, message.source.address, state.getState()))
elseif message.code == "gsa" then
-- getState answer
gLn.event.onGetStateAnswer:trigger({source = message.source, state = message.data})
elseif message.code == "ss" then
-- state subscibe
private.stateSubsciber[message.source.name] = true
elseif message.code == "sus" then
-- state unsubscibe
private.stateSubsciber[message.source.name] = nil
end
end
end
end
function private.onTimer()
-- State
if private.stateChanged then
for desName,_ in pairs(private.stateSubsciber) do
local desAddress = gLn.nameToAddress(desName)
gLn.nm.sendMessage(
private.port,
desAddress,
private.createPackage("gsa", desName, desAddress, state.getState()))
end
private.stateChanged = false
end
-- Ping
for onPongId,value in pairs(private.pingWaiter) do
value.waiter = value.waiter - 1
if value.waiter <= 0 then
value.callback(false)
gLn.event.onPong:remove(onPongId)
private.pingWaiter[onPongId] = nil
end
end
end
doc.getName = "function():boolean -- Discovers computers in network and fills 'directory' with the answers. Return true when sended."
function gLn.discover()
return gLn.nm.broadcastMessage(private.port, private.createPackage("di", "BROADCAST", "BROADCAST", state.getState()))
end
function gLn.getState(name, callback)
checkArg(1, name, "string")
checkArg(2, callback, "function")
local i = gLn.event.onGetStateAnswer:add(function(stateAnswer)
if stateAnswer.source.name == name then
gLn.event.onGetStateAnswer:remove(i)
callback(stateAnswer.state)
end
end)
--------------
gLn.nm.sendMessage(
gLn.directory[name],
private.port,
private.createPackage("gs", name, gLn.directory[name]))
end
doc.subscribeState = "function(name:string[, func:function]):boolean -- Subscribes the state of a computer with given name. Gets state on 'event.onGetStateAnswer' or pass it as parameter func."
function gLn.subscribeState(name, func)
checkArg(1, name, "string")
if func ~= nil and type(func) == "function" then
gLn.event.onGetStateAnswer:add(function(message)
if message.source.name == name then
func(message)
end
end)
end
return gLn.nm.sendMessage(
private.port,
gLn.directory[name],
private.createPackage("ss", name, gLn.directory[name]))
end
doc.unsubscribeState = "function(name:string):boolean -- Unsubscribes the state of a computer with given name."
function gLn.unsubscribeState(name)
checkArg(1, name, "string")
return gLn.nm.sendMessage(
gLn.directory[name],
private.port,
private.createPackage("sus", name, gLn.directory[name]))
end
function gLn.ping(name, callback)
checkArg(1, name, "string")
checkArg(2, callback, "function")
if func ~= nil and type(func) == "function" then
local onPongId = gLn.event.onPong:add(function(message)
if message.source.name == name then
callback(true)
gLn.event.onPong:remove(onPongId)
private.pingWaiter[onPongId] = nil
end
end)
private.pingWaiter[onPongId] = {waiter = 2, callback = callback}
end
end
doc.nameToAddress = "function(name:string):string -- Gets the address of a computer with given name."
function gLn.nameToAddress(name)
checkArg(1, name, "string")
return gLn.directory[name]
end
doc.addressToName = "function(address:string):string -- Gets the name of a computer with given address."
function gLn.addressToName(address)
checkArg(1, address, "string")
for k, v in pairs(gLn.directory) do
if v == address then
return k
end
end
return nil
end
doc.getName = "function(name:string[, port:number]):void -- Inits the gachLib.network."
function gLn.init(name, port)
gLn.nm.modemProxy.open(private.port)
private.timer = event.timer(5, private.onTimer, math.huge)
private.stateSubscription = state.subscribe(function(new, old)
private.stateChanged = true
end)
gLn.discover()
end
end
doc.getName = "function():void -- Destroys the gachLib.network like before 'init'."
function gLn.destroy()
if gLn.nm.modemProxy.isOpen(private.port) then
gLn.nm.broadcastMessage(private.port, private.createPackage("rm", "BROADCAST", "BROADCAST", state.getState()))
gLn.nm.modemProxy.close(private.port)
end
if private.timer ~= nil and type(private.timer) == "number" then
event.cancel(private.timer)
end
if private.stateSubscription ~= nil and type(private.stateSubscription) == "number" then
state.unsubscribe(private.stateSubscription)
end
end
end
return gLn, gLn.protocol, doc
|
--!A cross-platform build utility based on Lua
--
-- 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.
--
-- Copyright (C) 2015-present, TBOOX Open Source Group.
--
-- @author ruki
-- @file xmake.lua
--
-- export all symbols for windows/dll
--
-- @note: we don't need any export macros to a classes or functions!
-- and we can't use /GL (Whole Program Optimization) when use this approach!
--
-- @see https://github.com/xmake-io/xmake/issues/1123
--
rule("utils.symbols.export_all")
before_load(function (target)
-- @note it only supports windows/dll now
assert(target:is_shared(), 'rule("utils.symbols.export_all"): only for shared target(%s)!', target:name())
if target:is_plat("windows") then
assert(target:get("optimize") ~= "smallest", 'rule("utils.symbols.export_all"): does not support set_optimize("smallest") for target(%s)!', target:name())
local allsymbols_filepath = path.join(target:autogendir(), "rules", "symbols", "export_all.def")
target:add("shflags", "/def:" .. allsymbols_filepath, {force = true})
end
end)
before_link("export_all")
|
-----------------------------------
-- Area: Gusgen Mines
-- NPC: Degga
-- Type: Standard Info NPC
-- !pos 40 -68 -259
-----------------------------------
require("scripts/globals/titles");
require("scripts/globals/quests");
require("scripts/globals/settings");
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
player:startEvent(12); -- i have nothing to say to you standar dialog
end;
function onEventUpdate(player,csid,option)
-- printf("CSID2: %u",csid);
-- printf("RESULT2: %u",option);
end;
function onEventFinish(player,csid,option)
end;
|
-- config
local opts = {
}
(require 'mp.options').read_options(opts,"annotation")
local mpmsg = require 'mp.msg'
local dump = require 'dump'
local debug = require 'debug'
local msg = {}
local function wrap_message(...)
local info = debug.getinfo(3)
return '[' .. info.short_src .. ']:' .. info.currentline , ...
end
function msg.fatal(...)
mpmsg.fatal(wrap_message(...))
end
function msg.error(...)
mpmsg.error(wrap_message(...))
end
function msg.warn(...)
mpmsg.warn(wrap_message(...))
end
function msg.info(...)
mpmsg.info(wrap_message(...))
end
function msg.verbose(...)
mpmsg.verbose(wrap_message(...))
end
function msg.debug(...)
mpmsg.debug(wrap_message(...))
end
function msg.trace(...)
mpmsg.trace(wrap_message(...))
end
return msg
|
--[[minetest.register_craft({
output = "multitest:shears",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"", "default:wood", ""},
{"multitest:handle_grip", "", "multitest:handle_grip"}
}
})
minetest.register_craft({
output = "multitest:wood_shears",
recipe = {
{"default:tree", "", "default:tree"},
{"", "default:wood", ""},
{"multitest:handle_grip", "", "multitest:handle_grip"}
}
})
minetest.register_craft({
output = "multitest:stone_shears",
recipe = {
{"default:cobble", "", "default:cobble"},
{"", "default:wood", ""},
{"multitest:handle_grip", "", "multitest:handle_grip"}
}
})]]--
minetest.register_craft({
output = "multitest:rubber_raw 4",
recipe = {
{"default:clay_lump", "default:papyrus", "default:clay_lump"},
{"default:papyrus", "bucket:bucket_water", "default:papyrus"},
{"default:clay_lump", "default:papyrus", "default:clay_lump"},
},
replacements = {{ "bucket:bucket_water", "bucket:bucket_empty" }}
})
minetest.register_craft({
type = "cooking",
recipe = "multitest:rubber_raw",
output = "multitest:rubber",
})
minetest.register_craft({
output = "multitest:handle_grip 2",
recipe = {
{"", "", ""},
{"multitest:rubber", "multitest:rubber", "multitest:rubber"},
{"", "", ""}
}
})
minetest.register_craft({
type = "cooking",
recipe = "multitest:blackcobble",
output = "multitest:blackstone",
})
minetest.register_craft({
output = "multitest:rubberblock",
recipe = {
{"multitest:rubber", "multitest:rubber", ""},
{"multitest:rubber", "multitest:rubber", ""},
{"", "", ""}
}
})
minetest.register_craft({
output = "multitest:scraper",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"", "default:steel_ingot", ""},
{"", "multitest:handle_grip", ""}
}
})
minetest.register_craft({
output = "multitest:blackstone_paved",
recipe = {
{"multitest:scraper", "multitest:blackstone", ""},
{"", "", ""},
{"", "", ""},
},
replacements = {{ "multitest:scraper", "multitest:scraper" }}
})
minetest.register_craft({
output = "multitest:rubber 4",
recipe = {
{"multitest:rubberblock", "", ""},
{"", "", ""},
{"", "", ""},
},
})
minetest.register_craft({
output = "multitest:blackstone",
recipe = {
{"default:stone", "default:stone", "default:stone"},
{"default:stone", "dye:black", "default:stone"},
{"default:stone", "default:stone", "default:stone"},
},
})
minetest.register_craft({
output = "multitest:blackstone_brick",
recipe = {
{"multitest:blackstone", "multitest:blackstone", ""},
{"multitest:blackstone", "multitest:blackstone", ""},
{"", "", ""},
},
})
--[[ maintenant dans farming redo
minetest.register_craft({
output = "multitest:hayblock 4",
recipe = {
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"farming:wheat", "farming:wheat", "farming:wheat"},
},
})
--]]
minetest.register_craft({
output = "multitest:checkered_floor",
recipe = {
{"default:stone", "multitest:blackstone", ""},
{"multitest:blackstone", "default:stone", ""},
{"", "", ""},
},
})
minetest.register_craft({
output = "multitest:checkered_floor",
recipe = {
{"multitest:blackstone", "default:stone", ""},
{"default:stone", "multitest:blackstone", ""},
{"", "", ""},
},
})
minetest.register_craft({
output = "multitest:checkered_floor",
recipe = {
{"multitest:blackstone", "default:stone", ""},
{"default:stone", "multitest:blackstone", ""},
{"", "", ""},
},
})
for i, v in ipairs(multitest.colors) do
minetest.register_craft({
output = "multitest:carpet_"..v.." 4",
recipe = {
{"wool:"..v, "wool:"..v, ""},
{"", "", ""},
{"", "", ""},
},
})
end
minetest.register_craft({
output = "multitest:lamp",
recipe = {
{"", "default:tree", ""},
{"default:tree", "default:torch", "default:tree"},
{"", "default:tree", ""},
},
})
minetest.register_craft({
output = "multitest:door_mat",
recipe = {
{"wool:black", "wool:black", "wool:black"},
{"wool:black", "wool:brown", "wool:black"},
{"wool:black", "wool:black", "wool:black"},
},
})
minetest.register_craft({
output = "multitest:andesite 4",
recipe = {
{"default:stone", "default:stone", "default:stone"},
{"default:cobble", "default:cobble", "default:cobble"},
{"default:stone", "default:stone", "default:stone"},
},
})
minetest.register_craft({
output = "multitest:andesite_smooth",
recipe = {
{"multitest:andesite", "multitest:scraper", ""},
{"", "", ""},
{"", "", ""},
},
replacements = {{ "multitest:scraper", "multitest:scraper" }}
})
minetest.register_craft({
output = "multitest:granite 4",
recipe = {
{"multitest:andesite", "default:bronze_ingot", ""},
{"", "", ""},
{"", "", ""},
},
})
minetest.register_craft({
output = "multitest:granite_smooth",
recipe = {
{"multitest:granite", "multitest:scraper", ""},
{"", "", ""},
{"", "", ""},
},
replacements = {{ "multitest:scraper", "multitest:scraper" }}
})
minetest.register_craft({
output = "multitest:diorite 4",
recipe = {
{"multitest:andesite", "default:clay_lump", ""},
{"", "", ""},
{"", "", ""},
},
})
minetest.register_craft({
output = "multitest:diorite_smooth",
recipe = {
{"multitest:diorite", "multitest:scraper", ""},
{"", "", ""},
{"", "", ""},
},
replacements = {{ "multitest:scraper", "multitest:scraper" }}
})
minetest.register_craft({
output = "multitest:diorite",
recipe = {
{"multitest:diorite_smooth", "", ""},
{"", "", ""},
{"", "", ""},
},
})
minetest.register_craft({
output = "multitest:granite",
recipe = {
{"multitest:granite_smooth", "", ""},
{"", "", ""},
{"", "", ""},
},
})
minetest.register_craft({
output = "multitest:andesite",
recipe = {
{"multitest:andesite_smooth", "", ""},
{"", "", ""},
{"", "", ""},
},
})
minetest.register_craft({
output = "multitest:sandstone_carved",
recipe = {
{"default:sandstone", "multitest:scraper", ""},
{"", "", ""},
{"", "", ""},
},
replacements = {{ "multitest:scraper", "multitest:scraper" }}
})
minetest.register_craft({
output = "multitest:sponge_block 4",
recipe = {
{"", "dye:yellow", ""},
{"", "wool:white", ""},
{"", "farming:wheat", ""},
},
})
|
--- 功能: 安全停服
--- 用法: stop
function gm.stop(args)
local reason = args[1] or "gm"
game.stop(reason)
end
function gm.saveall(args)
game.saveall()
end
--- 功能: 将某玩家踢下线
--- 用法: kick 玩家ID [玩家ID]
function gm.kick(args)
local isok,args = checkargs(args,"int","*")
if not isok then
return gm.say("用法: kick pid1 pid2 ...")
end
for i,v in ipairs(args) do
local pid = tonumber(v)
playermgr.kick(pid,"gm")
end
end
--- 功能: 将所有玩家踢下线
--- 用法: kickall
function gm.kickall(args)
playermgr.kickall("gm")
end
--- 功能: 执行一段lua脚本
--- 用法: exec lua脚本
function gm.exec(args)
local cmdline = table.concat(args," ")
local chunk = load(cmdline,"=(load)","bt")
return chunk()
end
gm.runcmd = gm.exec
--- 功能: 执行一个文件
--- 用法: dofile lua文件
function gm.dofile(args)
local isok,args = checkargs(args,"string")
if not isok then
return gm.say("用法: dofile lua文件")
end
local filename = args[1]
-- loadfile need execute skynet.cache.clear to reload
--local chunk = loadfile(filename,"bt")
local fd = io.open(filename,"rb")
local script = fd:read("*all")
fd:close()
return exec(script)
end
--- 功能: 获取服务器状态
--- 用法: status
function gm.status(args)
local info = {
time = os.date("%Y-%m-%d %H:%M:%S",os.time()),
id = skynet.getenv("id"),
index = skynet.getenv("index"),
area = skynet.getenv("area"),
mqlen = skynet.mqlen(),
task = skynet.task(),
}
local data = table.dump(info)
return gm.say(data)
end
--- 功能: 热更新某模块
--- 用法: hotfix 模块名 ...
function gm.hotfix(args)
local fails = {}
for i,path in ipairs(args) do
local isok,errmsg = hotfix.hotfix(path)
if not isok then
table.insert(fails,{path=path,errmsg=errmsg})
end
end
for i,path in ipairs(fails) do
gm.say(string.format("热更失败:%s",path))
end
if next(fails) then
return gm.say("update fail:\n" .. table.dump(fails))
end
end
gm.reload = gm.hotfix
--- 用法: loglevel [日志等级]
--- 举例: loglevel <=> 查看日志等级
--- 举例: loglevel debug/trace/info/warn/error/fatal <=> 设置对应日志等级
function gm.loglevel(args)
local loglevel = args[1]
if not loglevel then
local loglevel,name = logger.check_loglevel(logger.loglevel)
return gm.say(name)
else
local ok,loglevel,name = pcall(logger.check_loglevel,loglevel)
if not ok then
local errmsg = loglevel
return gm.say(errmsg)
end
logger.setloglevel(loglevel)
return name
end
end
return gm
|
local CmdHandler = {}
CmdHandler.__index = CmdHandler;
function CmdHandler.New(Player, Options)
local self = {}
self.Master = Player;
self.Prefix = Options.Prefix;
self.Commands = {};
self.IgnoreCommands = {};
return setmetatable(self, CmdHandler)
end
function CmdHandler:CheckCommand(RawMsg)
local h0 = RawMsg:split(" ")[1]:gsub(self.Prefix, "");
return h0:lower();
end
function CmdHandler:AddCommand(CommandInfo)
self.Commands[CommandInfo.ID] = CommandInfo;
end
function CmdHandler:Listen()
self.Master.Chatted:Connect(function(Msg)
local Cmd = self:CheckCommand(Msg);
if Cmd ~= "" then
local FoundCmd = false;
local Args = Msg:split(" ")
table.remove(Args, 1)
for _,Command in pairs(self.Commands) do
for _,Alias in pairs(Command.Aliases) do
if Cmd:lower() == Alias:lower() then
FoundCmd = true;
return Command.Run(self.Master, Args)
end
end
end
if not FoundCmd then
return false;
end
end
end)
end
return CmdHandler;
|
local httpColumns = {}
local httpRows = {}
local updateInterval = 1000
local lastUpdateTime = 0
function getScoreboardColumns( )
-- Only update http data if someone is looking
if getTickCount() - lastUpdateTime > updateInterval then
lastUpdateTime = getTickCount()
refreshServerScoreboard()
end
return httpColumns
end
function getScoreboardRows( )
return httpRows
end
local function getName(element)
local etype = getElementType(element)
if etype == "player" then
return getPlayerName(element)
elseif etype == "team" then
return getTeamName(element)
end
end
local function getRowData( element )
if not isElement(element) then return end
local rowData = {getElementType(element),}
for i, column in ipairs(httpColumns) do
if column.name == "name" then
table.insert(rowData, getName(element))
elseif column.name == "ping" then
local ping = ""
if getElementType(element) == "player" then
ping = getPlayerPing(element)
end
table.insert(rowData, ping)
else
table.insert(rowData, getElementData(element,column.name) or "")
end
end
return rowData
end
function refreshServerScoreboard()
local scoreboardNewColumns = {}
for i, column in ipairs(scoreboardColumns) do
local visibleToElement = column.visibleTo
if visibleToElement == nil or visibleToElement == rootElement then
table.insert(scoreboardNewColumns,{name=column.name,size=column.size})
end
end
httpColumns = scoreboardNewColumns
local scoreboardNewRows = {}
for i, player in ipairs(getElementsByType("player")) do
if not getPlayerTeam(player) then
table.insert(scoreboardNewRows,getRowData(player))
end
end
for i,team in ipairs(getElementsByType("team")) do
if isElement(team) then -- Sanity check, as sometimes team is not valid here. (Why?)
table.insert(scoreboardNewRows,getRowData(team))
for i,player in ipairs(getPlayersInTeam(team)) do
if isElement(player) and getElementType(player) == "player" then
table.insert(scoreboardNewRows,getRowData(player))
end
end
end
end
httpRows = scoreboardNewRows
end
|
petBehavior = {
actionQueue = {}
}
function petBehavior.init()
petBehavior.entityTypeReactions = {
["player"] = petBehavior.reactToPlayer,
["itemDrop"] = petBehavior.reactToItemDrop,
["monster"] = petBehavior.reactToMonster,
["object"] = petBehavior.reactToObject
}
petBehavior.actions = {
["emote"] = petBehavior.emote
}
petBehavior.actionStates = {
["inspect"] = "inspectAction",
["follow"] = "followAction",
["eat"] = "eatAction",
["beg"] = "begAction",
["play"] = "pounceAction",
["sleep"] = "sleepAction",
["starving"] = "starvingAction"
}
self.currentActionScore = 0
self.actionParams = config.getParameter("actionParams")
self.actionInterruptThreshold = config.getParameter("actionParams.interruptThreshold", 15)
self.inspected = {}
end
--Queue an action to later be sorted by score
--score is optional
function petBehavior.queueAction(type, args, score)
table.insert(petBehavior.actionQueue, {type = type, args = args, score = score})
end
function petBehavior.performAction(action)
if petBehavior.actions[action.type] and self.actionCooldowns[action.type] <= 0 and self.actionState.stateDesc() == "" then
return petBehavior.actions[action.type](args)
end
return false
end
--Score all actions in the queue, then try them until one returns a success
function petBehavior.run()
if self.actionState.stateDesc() == "" then
self.currentActionScore = 0
end
--Add state actions to the reaction queue
for actionName,_ in pairs(petBehavior.actionStates) do
petBehavior.queueAction(actionName)
end
--Sort actions based on score
for _,queuedAction in pairs(petBehavior.actionQueue) do
queuedAction.score = queuedAction.score or petBehavior.scoreAction(queuedAction.type)
end
table.sort(petBehavior.actionQueue, function(a, b) return a.score > b.score end)
--Pick the first valid option
for _,action in pairs(petBehavior.actionQueue) do
if action.score <= 0 or action.score <= self.currentActionScore + self.actionInterruptThreshold then break end
local picked = false
if not self.actionParams[action.type] or action.score > self.actionParams[action.type].minScore then
if petBehavior.actionStates[action.type] and self.actionState.stateDesc() ~= petBehavior.actionStates[action.type] then
if (action.args and self.actionState.pickState(action.args)) then
picked = true
elseif(petBehavior.actionStates[action.type] and self.actionState.pickState({[petBehavior.actionStates[action.type]] = true})) then
picked = true
end
elseif petBehavior.actions[action.type] and petBehavior.performAction(action.type) then
picked = true
end
end
if picked then
self.currentActionScore = action.score
break
end
end
petBehavior.actionQueue = {}
end
--Evaluate an action and set a weight
function petBehavior.scoreAction(action)
if action == "eat" or action == "beg" then
return status.resource("hunger")
elseif action == "follow" then
return status.resource("curiosity")
elseif action == "inspect" then
return status.resource("curiosity")
elseif action == "play" then
return status.resource("playful")
elseif action == "sleep" then
return status.resource("sleepy")
elseif action == "emote" then
return 100
else
return 0
end
end
----------------------------------------
--ENTITY REACTIONS
----------------------------------------
function petBehavior.reactTo(entityId)
local entityType = world.entityType(entityId)
if petBehavior.entityTypeReactions[entityType] then
petBehavior.entityTypeReactions[entityType](entityId)
end
end
function petBehavior.reactToPlayer(entityId)
local playerUuid = world.entityUniqueId(entityId)
--Check hands for goodies
local primaryItem = world.entityHandItem(entityId, "primary")
local altItem = world.entityHandItem(entityId, "alt")
local foodLiking = itemFoodLiking(primaryItem) or itemFoodLiking(altItem)
if foodLiking then
local score = status.resource("hunger") - (100 - foodLiking)
petBehavior.queueAction("beg", {begTarget = entityId}, score)
end
if storage.knownPlayers[tostring(playerUuid)] then
petBehavior.queueAction("follow", {followTarget = entityId})
else
petBehavior.queueAction("inspect", {inspectTarget = entityId, approachDistance = 4})
end
end
function petBehavior.reactToItemDrop(entityId)
local entityName = world.entityName(entityId)
local foodLiking = itemFoodLiking(entityName)
if foodLiking then
local score = status.resource("hunger") - (100 - foodLiking)
petBehavior.queueAction("eat", {eatTarget = entityId}, score)
elseif foodLiking == nil then
petBehavior.queueAction("inspect", {inspectTarget = entityId, approachDistance = 2}, status.resource("hunger"))
end
end
function petBehavior.reactToMonster(entityId)
local entityName = world.monsterType(entityId)
if entityName == "petball" then
petBehavior.queueAction("play", {pounceTarget = entityId})
end
end
function petBehavior.reactToObject(entityId)
local entityName = world.entityName(entityId)
if entityName == "pethouse" then
petBehavior.queueAction("sleep", {sleepTarget = entityId})
end
end
----------------------------------------
--ACTIONS
----------------------------------------
function petBehavior.emote(emoteName)
emote(emoteName)
return false
end
|
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel( "models/props/cs_office/computer_monitor.mdl" )
self:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics,
self:SetMoveType( MOVETYPE_VPHYSICS ) -- after all, gmod is a physics
self:SetSolid( SOLID_VPHYSICS ) -- Toolbox
self:SetRenderMode(RENDERMODE_TRANSALPHA)
self:SetUseType( SIMPLE_USE )
self._24Clock = true
self:SetNWBool("24Clock",true)
self.t = SysTime() + 5
self.w = false
self:SetKeyValue("fademindist", 2000)
self:SetKeyValue("fademaxdist", 2000)
end
local l = 0
function ENT:Think()
if not WireAddon then return end
if l > SysTime() then return end
l = SysTime() + 1
end
function ENT:Use()
self._24Clock = not self._24Clock
self:SetNWBool("24Clock",self._24Clock)
self:EmitSound("buttons/button14.wav")
end
function ENT:SpawnFunction( ply, tr, ClassName )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 16
local ent = ents.Create( ClassName )
ent:SetPos( SpawnPos )
ent:SetAngles(Angle(0,ply:EyeAngles().y + 180,0))
ent:Spawn()
ent:Activate()
return ent
end
|
util.AddNetworkString("RaidSystem_GetMessage")
function RaidSystem.SendMessage(activator, msg)
net.Start("RaidSystem_GetMessage")
net.WriteString(msg)
net.Send(activator)
end
function RaidSystem.BroadCastMessage(msg)
net.Start("RaidSystem_GetMessage")
net.WriteString(msg)
net.Broadcast()
end
|
--------------------------------------------------------------------------------
Libraries.Items = {}
--------------------------------------------------------------------------------
-- Items Library
--------------------------------------------------------------------------------
-- Helmets
Libraries.Items.Helmets = {
["Example Helmet"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
}
}
--------------------------------------------------------------------------------
-- Armors
Libraries.Items.Armors = {
["Demonic Plate Mail"] = {
itemID = 0,
reqLevel = 900,
reqVocations = {},
armor = 22,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.20,
incrHealing = 0.08,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.06,
incrCriticalChance = 0.04,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Nightmare Gown"] = {
itemID = 0,
reqLevel = 1,
reqVocations = {},
armor = 22,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.20,
incrHealing = 0.22,
incrAttackSpeed = 0.05,
incrDamageReduction = 0.05,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Crusader Plate"] = {
itemID = 0,
reqLevel = 900,
reqVocations = {},
armor = 22,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.15,
incrHealing = 0.05,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.05,
incrCriticalChance = 0.03,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Titan Armor"] = {
itemID = 0,
reqLevel = 8,
reqVocations = {},
armor = 22,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.06,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.03,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Azurite Armor"] = {
itemID = 0,
reqLevel = 650,
reqVocations = {},
armor = 22,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.12,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.04,
incrCriticalChance = 0.03,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Cultist Robe"] = {
itemID = 0,
reqLevel = 600,
reqVocations = {},
armor = 20,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.20,
incrHealing = 0.05,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.02,
incrCriticalChance = 0.04,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Destruction Armor"] = {
itemID = 0,
reqLevel = 1,
reqVocations = {},
armor = 22,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.08,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.02,
incrCriticalChance = 0.02,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Demonic Armor"] = {
itemID = 0,
reqLevel = 900,
reqVocations = {},
armor = 22,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.18,
incrHealing = 0.00,
incrAttackSpeed = 0.03,
incrDamageReduction = 0.00,
incrCriticalChance = 0.05,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Whitesteel Mail"] = {
itemID = 0,
reqLevel = 300,
reqVocations = {},
armor = 22,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.22,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.04,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Dragon Armor"] = {
itemID = 0,
reqLevel = 1,
reqVocations = {},
armor = 22,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.10,
incrHealing = 0.00,
incrAttackSpeed = 0.03,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.05,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Ancient Armor"] = {
itemID = 0,
reqLevel = 150,
reqVocations = {},
armor = 18,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.05,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.05,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.05,
incrDeathProtection = 0.05,
incrHolyProtection = 0.00,
incrSpeed = 50,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Ornate Chestplate"] = {
itemID = 0,
reqLevel = 200,
reqVocations = {},
armor = 16,
incrMeleeSkill = 0,
incrShieldingSkill = 3,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.08,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Demon Armor"] = {
itemID = 0,
reqLevel = 80,
reqVocations = {},
armor = 16,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.05,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 50,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Royal Draken Mail"] = {
itemID = 0,
reqLevel = 100,
reqVocations = {1},
armor = 16,
incrMeleeSkill = 0,
incrShieldingSkill = 3,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.05,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Prismatic Armor"] = {
itemID = 0,
reqLevel = 120,
reqVocations = {1, 2},
armor = 16,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.05,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 30,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Magic Plate Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 17,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Yalahari Armor"] = {
itemID = 0,
reqLevel = 80,
reqVocations = {1},
armor = 16,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.03,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Depth Iorica"] = {
itemID = 0,
reqLevel = 150,
reqVocations = {2},
armor = 16,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 3,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.05,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Dragon Scale Mail"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 15,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Dwarven Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 17,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.05,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Fireborn Giant Armor"] = {
itemID = 0,
reqLevel = 100,
reqVocations = {1},
armor = 15,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 2,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.05,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Earthborn Titan Armor"] = {
itemID = 0,
reqLevel = 100,
reqVocations = {1},
armor = 15,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.05,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Windborn Colossus Armor"] = {
itemID = 0,
reqLevel = 100,
reqVocations = {1},
armor = 15,
incrMeleeSkill = 2,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.05,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Oceanborn Leviathan Armor"] = {
itemID = 0,
reqLevel = 100,
reqVocations = {1},
armor = 15,
incrMeleeSkill = 0,
incrShieldingSkill = 1,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.05,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Master Archer's Armor"] = {
itemID = 0,
reqLevel = 80,
reqVocations = {2},
armor = 15,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 3,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Elite Draken Mail"] = {
itemID = 0,
reqLevel = 100,
reqVocations = {1, 2},
armor = 15,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 20,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Golden Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 14,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Skullcracker Armor"] = {
itemID = 0,
reqLevel = 85,
reqVocations = {1},
armor = 14,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.05,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Crown Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 13,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Amazon Armor"] = {
itemID = 0,
reqLevel = 60,
reqVocations = {2},
armor = 13,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 3,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Lavos Armor"] = {
itemID = 0,
reqLevel = 60,
reqVocations = {1, 2},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.03,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Crystalline Armor"] = {
itemID = 0,
reqLevel = 60,
reqVocations = {1, 2},
armor = 13,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.03,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
-- ALL ARMORS UNDER THIS COMMENT HAVE INCOMPLETE STATS
["Voltage Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Swamplair Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Divine Plate"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Molten Plate"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Frozen Plate"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Zaoan Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Knight Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["The Robe of the Ice Queen"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Dragon Robe"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Velvet Mantle"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Greenwood Coat"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Robe of the Underworld"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Paladin Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Royal Scale Robe"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Calopteryx Cape"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Gill Coat"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Buckle"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Goo Shell"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Furious Frock"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Moo'tah Plate"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Heat Core"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Noble Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Blue Robe"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Terra Mantle"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Glacier Robe"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Lightning Robe"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Magma Coat"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Witchhunter's Coat"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Dark Lord's Cape"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Spellweaver's Robe"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Zaoan Robe"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Albino Plate"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Plate Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Dark Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Mammoth Fur Cape"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Belted Cape"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Scale Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Elven Mail"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Leopard Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Focus Cape"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Leather Harness"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Glooth Cape"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Brass Armor"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Spirit Cloak"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
}
}
--------------------------------------------------------------------------------
-- Legs
Libraries.Items.Legs = {
["Example Legs"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
}
}
--------------------------------------------------------------------------------
-- Boots
Libraries.Items.Boots = {
["Example Boots"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
incrMeleeSkill = 0,
incrShieldingSkill = 0,
incrDistanceSkill = 0,
incrMagicLevel = 0,
incrWandSkill = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrPhysicalProtection = 0.00,
incrEarthProtection = 0.00,
incrFireProtection = 0.00,
incrEnergyProtection = 0.00,
incrIceProtection = 0.00,
incrDeathProtection = 0.00,
incrHolyProtection = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
}
}
--------------------------------------------------------------------------------
-- Weapons
Libraries.Items.Weapons = {
["Example Item"] = {
itemID = 0,
goldPrice = 0,
tokensPrice = 0
}
}
--------------------------------------------------------------------------------
-- Shields
Libraries.Items.Shields = {
-- ALL SHIELDS UNDER THIS COMMENT HAVE INCOMPLETE STATS
["Demonic Great Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Eternium Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["White Great Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Crimson Great Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Rift Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Ornate Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Eagle Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Cultist Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Spellbook of Dark Mysteries"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Nightmare Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Demonic Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Titanium Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Ancient Demon Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Great Dragon Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Relic Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Mastermind Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Demon Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Vampire Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Crown Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Tower Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Dragon Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Medusa Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Mino Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Spike Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Battle Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Plate Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Ancient Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Warrior's Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Dark Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Phoenix Shield"] = {
itemID = 0,
reqLevel = 0,
reqVocations = {},
armor = 0,
chain = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrDamagePenetration = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
incrPhysicalProtection = 0.00,
incrLifeLeech = 0.00,
incrSpeed = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
}
}
--------------------------------------------------------------------------------
-- Charms
Libraries.Items.Charms = {
["Example Charm"] = {
itemID = 0,
incrMagicLevel = 0,
incrDamage = 0.00,
incrHealing = 0.00,
incrAttackSpeed = 0.00,
incrAttackBonus = 0,
incrDamageReduction = 0.00,
incrCriticalChance = 0.00,
incrDodgeChance = 0.00,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
}
}
--------------------------------------------------------------------------------
-- Creature Products
Libraries.Items.CreatureProducts = {
["Example Item"] = {
itemID = 0,
goldPrice = 0,
tokensPrice = 0
}
}
--------------------------------------------------------------------------------
-- Mount Items
Libraries.Items.MountItems = {
["Example Item"] = {
itemID = 0,
goldPrice = 0,
tokensPrice = 0
}
}
--------------------------------------------------------------------------------
-- Outfit Items
Libraries.Items.OutfitItems = {
["Example Item"] = {
itemID = 0,
goldPrice = 0,
tokensPrice = 0
}
}
--------------------------------------------------------------------------------
-- Consumables
Libraries.Items.Consumables = {
["Example Item"] = {
itemID = 0,
goldPrice = 0,
tokensPrice = 0
}
}
--------------------------------------------------------------------------------
-- Currencies
Libraries.Items.Currencies = {
["Gold Coin"] = {
itemID = 0,
goldValue = 1,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Platinum Coin"] = {
itemID = 0,
goldValue = 100,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Crystal Coin"] = {
itemID = 0,
goldValue = 10000,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Diamond Coin"] = {
itemID = 0,
goldValue = 1000000,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Supreme Gold Coin"] = {
itemID = 0,
goldValue = 100000000,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Evolunia Token"] = {
itemID = 0,
goldValue = 0,
evoluniaTokensValue = 1,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Great Evolunia Token"] = {
itemID = 0,
goldValue = 0,
evoluniaTokensValue = 100,
dungeonTokensValue = 0,
eventTokensValue = 0
},
["Dungeon Token"] = {
itemID = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 1,
eventTokensValue = 0
},
["Great Dungeon Token"] = {
itemID = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 100,
eventTokensValue = 0
},
["Event Token"] = {
itemID = 0,
goldValue = 0,
evoluniaTokensValue = 0,
dungeonTokensValue = 0,
eventTokensValue = 1
}
}
--------------------------------------------------------------------------------
-- Others
Libraries.Items.Others = {
["Example Item"] = {
itemID = 0,
goldPrice = 0,
tokensPrice = 0
}
}
--------------------------------------------------------------------------------
|
local function tooltip(state, action)
state = state or nil
if action.type == 'setTooltip' then
return action.text
end
return state
end
return tooltip
|
-- File: premake5.lua
-- Brief: Build script for the premake build system. Run 'premake5 gmake' to
-- build GNU specific makefiles.
-- Author: Alexander DuPree
-- WORKSPACE CONFIGURATION --
workspace "Matrix-CPP"
configurations { "debug", "release" }
if _ACTION == "clean" then
os.rmdir("bin/")
os.rmdir("lib/")
os.rmdir("gmake/")
os.rmdir("gmake2/")
end
local project_action = "UNDEFINED"
if _ACTION ~= nill then project_action = _ACTION end
location (project_action)
-- PLATFORM CONFIGURATIONS --
-- COMPILER/LINKER CONFIG --
flags "FatalWarnings"
warnings "Extra"
filter "configurations:debug*"
buildoptions { "-fprofile-arcs", "-ftest-coverage" }
defines { "DEBUG" }
links "gcov"
symbols "On"
filter "configurations:release*"
defines { "NDEBUG" }
optimize "On"
filter "toolset:gcc"
buildoptions {
"-Wall", "-Wextra", "-Werror", "-std=c++17"
}
filter {} -- close filter
project "Matrix-CPP"
kind "StaticLib"
language "C++"
targetdir "lib/%{cfg.buildcfg}/"
targetname "Matrix-CPP"
local include = "include/"
includedirs (include)
project "Tests"
kind "ConsoleApp"
language "C++"
links "Matrix-CPP"
targetdir "bin/tests/"
targetname "%{cfg.buildcfg}_tests"
local include = "include/"
local test_src = "tests/"
local test_inc = "third_party/"
files (test_src .. "**.cpp")
includedirs { test_inc, include }
--postbuildcommands ".././bin/tests/%{cfg.buildcfg}_tests"
filter {} -- close filter
|
{ -- Sunny Day
["titleBGA"] = color("#FFAA00"),
["titleBGB"] = color("#FFD500"),
["titleBGPattern"] = color("#FFFF00"),
["swmeHF"] = color("#FFC400"),
["swmeFooter"] = color("#FFB300"),
["swmeBGA"] = color("#FFD500"),
["swmeBGB"] = color("#FFEA00"),
["swmeGrid"] = color("#FFFF00"),
["swmePattern"] = color("#FFFFFF55"),
["serviceBG"] = color("#FF8400"),
["playModeIconsBaseColor"] = color("#FFFF00"),
["playModeIconsBaseGradient"] = color("#FFFF3A"),
["playModeIconsEmblem"] = color("#00000075"),
["headerTextColor"] = color("#000000"),
["headerTextGradient"] = color("#000000"),
["midShadeA"] = color("#660400"),
["headerSortA"] = color("#FFAA0099"),
["headerSortB"] = color("#FFAA0055"),
["headerStripeA"] = color("#FF8400"),
["headerStripeB"] = color("#FF9900"),
["promptBG"] = color("#FF7700"),
["wheelHighlightFade"] = color("#FFA60050"),
["wheelHighlightA"] = color("#FFAE00"),
["wheelHighlightB"] = color("#FFBF01"),
["wheelSongItem"] = color("#F2BA00"),
["wheelSectionItemA"] = color("#FFC500"),
["wheelSectionItemB"] = color("#FFDD00"),
["SSMHelpPopup"] = color("#FF8400"),
["gameplayHeader"] = color("#995000"),
["gameplayTitle"] = color("#FF7800"),
["gameplayMeter"] = color("#FFB300"),
["lifeFrame"] = color("#FFB300"),
["lifeMeter"] = color("#FFCF00"),
["menuBlockBase"] = color("#FF6600"),
["menuBlockGlow"] = color("#FF8400"),
["titlemenuBlockGlow"] = color("#FF7500"),
["menuBlockHighlightA"] = color("#FFB700"),
["menuBlockHighlightB"] = color("#FFDE00"),
["menuTextGainFocus"] = color("#FFFF00"),
["menuTextLoseFocus"] = color("#000000"),
["optionExplanationBG"] = color("#00000050"),
["difficultyBeginner"] = color("#0EA7FF"),
["difficultyEasy"] = color("#00F4BD"),
["difficultyMedium"] = color("#FF8100"),
["difficultyHard"] = color("#F70825"),
["difficultyChallenge"] = color("#A907FF"),
["difficultyEdit"] = color("#9199D4"),
["difficultyCouple"] = color("#ed0972"),
["difficultyRoutine"] = color("#ff9a00")
}, -- End of Sunny Day
|
object_tangible_loot_creature_loot_collections_exar_kun_lost_journal_page_04 = object_tangible_loot_creature_loot_collections_shared_exar_kun_lost_journal_page_04:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_exar_kun_lost_journal_page_04, "object/tangible/loot/creature/loot/collections/exar_kun_lost_journal_page_04.iff")
|
module 'mock'
--------------------------------------------------------------------
local SupportedTextureAssetTypes = ''
function getSupportedTextureAssetTypes()
return SupportedTextureAssetTypes
end
function addSupportedTextureAssetType( t )
if SupportedTextureAssetTypes ~= '' then
SupportedTextureAssetTypes = SupportedTextureAssetTypes .. ';'
end
SupportedTextureAssetTypes = SupportedTextureAssetTypes .. t
end
--------------------------------------------------------------------
CLASS: TextureInstanceBase ()
:MODEL{}
function TextureInstanceBase:getSize()
return 1, 1
end
function TextureInstanceBase:getOrignalSize()
return self:getSize()
end
function TextureInstanceBase:getOutputSize()
return self:getSize()
end
function TextureInstanceBase:getMoaiTexture()
end
function TextureInstanceBase:getMoaiTextureUV()
local tex = self:getMoaiTexture()
local uvrect = { self:getUVRect() }
return tex, uvrect
end
function TextureInstanceBase:getUVRect()
return 0,0,1,1
end
function TextureInstanceBase:isPacked()
return false
end
|
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- hide the status bar
display.setStatusBar( display.HiddenStatusBar )
-- include the Corona "composer" module
local composer = require "composer"
-- load menu screen
composer.gotoScene( "FB" )
|
Emoticons_Settings={
["CHAT_MSG_OFFICER"]=true, --1
["CHAT_MSG_GUILD"]=true, --2
["CHAT_MSG_PARTY"]=true, --3
["CHAT_MSG_PARTY_LEADER"]=true, --dont count, tie to 3
["CHAT_MSG_PARTY_GUIDE"]=true, --dont count, tie to 3
["CHAT_MSG_RAID"]=true, --4
["CHAT_MSG_RAID_LEADER"]=true, --dont count, tie to 4
["CHAT_MSG_RAID_WARNING"]=true, --dont count, tie to 4
["CHAT_MSG_SAY"]=true, --5
["CHAT_MSG_YELL"]=true, --6
["CHAT_MSG_WHISPER"]=true, --7
["CHAT_MSG_WHISPER_INFORM"]=true, --dont count, tie to 7
["CHAT_MSG_CHANNEL"]=true, --8
["CHAT_MSG_BN_WHISPER"]=true, --9
["CHAT_MSG_BN_WHISPER_INFORM"]=true,--dont count, tie to 9
["CHAT_MSG_BN_CONVERSATION"]=true,--10
["CHAT_MSG_INSTANCE_CHAT"]=true,--11
["CHAT_MSG_INSTANCE_CHAT_LEADER"]=true,--dont count, tie to 11
["MAIL"]=true,
["TWITCHBUTTON"]=true,
["sliderX"]=-35,
["sliderY"]=0,
["chatIconsSize"]=20,
["detailsIconsSize"]=16,
["MinimapPos"] = 45,
["MINIMAPBUTTON"] = true,
["FAVEMOTES"] = {true,true,true,true,true,true,true,true,true,true,
true,true,true,true,true,true,true,true,true,true,
true,true,true,true,true,true,true,true,true,true,
true,true,true,true,true,true}
};
Emoticons_Eyecandy = false;
local origsettings = {
["CHAT_MSG_OFFICER"]=true,
["CHAT_MSG_GUILD"]=true,
["CHAT_MSG_PARTY"]=true,
["CHAT_MSG_PARTY_LEADER"]=true,
["CHAT_MSG_PARTY_GUIDE"]=true,
["CHAT_MSG_RAID"]=true,
["CHAT_MSG_RAID_LEADER"]=true,
["CHAT_MSG_RAID_WARNING"]=true,
["CHAT_MSG_SAY"]=true,
["CHAT_MSG_YELL"]=true,
["CHAT_MSG_WHISPER"]=true,
["CHAT_MSG_WHISPER_INFORM"]=true,
["CHAT_MSG_BN_WHISPER"]=true,
["CHAT_MSG_BN_WHISPER_INFORM"]=true,
["CHAT_MSG_BN_CONVERSATION"]=true,
["CHAT_MSG_CHANNEL"]=true,
["CHAT_MSG_INSTANCE_CHAT"]=true,
["MAIL"]=true,
["TWITCHBUTTON"]=true,
["sliderX"]=-35,
["sliderY"]=0,
["chatIconsSize"]=20,
["detailsIconsSize"]=16,
["MinimapPos"] = 45,
["MINIMAPBUTTON"] = true,
["FAVEMOTES"] = {true,true,true,true,true,true,true,true,true,true,
true,true,true,true,true,true,true,true,true,true,
true,true,true,true,true,true,true,true,true,true,
true,true,true,true,true,true}
};
local defaultpack={
["bdumTss"]="Interface\\AddOns\\TemniUgolok\\resources\\bdumTss.tga",
["burn"]="Interface\\AddOns\\TemniUgolok\\resources\\burn.tga",
["damagNahuiNeNuzhen"]="Interface\\AddOns\\TemniUgolok\\resources\\damagNahuiNeNuzhen.tga",
["dcPriest"]="Interface\\AddOns\\TemniUgolok\\resources\\dcPriest.tga",
["derzhiVKurse"]="Interface\\AddOns\\TemniUgolok\\resources\\derzhiVKurse.tga",
["doubleTilt"]="Interface\\AddOns\\TemniUgolok\\resources\\doubleTilt.tga",
["feelsBadMan"]="Interface\\AddOns\\TemniUgolok\\resources\\feelsBadMan.tga",
["gloom"]="Interface\\AddOns\\TemniUgolok\\resources\\gloom.tga",
["gloomChmok"]="Interface\\AddOns\\TemniUgolok\\resources\\gloomChmok.tga",
["hmm"]="Interface\\AddOns\\TemniUgolok\\resources\\hmm.tga",
["jirokUprls"]="Interface\\AddOns\\TemniUgolok\\resources\\jirokUprls.tga",
["kappaPride"]="Interface\\AddOns\\TemniUgolok\\resources\\kappaPride.tga",
["kovanich"]="Interface\\AddOns\\TemniUgolok\\resources\\kovanich.tga",
["mirkusha"]="Interface\\AddOns\\TemniUgolok\\resources\\mirkusha.tga",
["molodchaga"]="Interface\\AddOns\\TemniUgolok\\resources\\molodchaga.tga",
["monkas"]="Interface\\AddOns\\TemniUgolok\\resources\\monkas.tga",
["neShutiTak"]="Interface\\AddOns\\TemniUgolok\\resources\\neShutiTak.tga",
["ohueliSovsem"]="Interface\\AddOns\\TemniUgolok\\resources\\ohueliSovsem.tga",
["olegalul"]="Interface\\AddOns\\TemniUgolok\\resources\\olegalul.tga",
["opa"]="Interface\\AddOns\\TemniUgolok\\resources\\opa.tga",
["pepeclown"]="Interface\\AddOns\\TemniUgolok\\resources\\pepeclown.tga",
["pepega"]="Interface\\AddOns\\TemniUgolok\\resources\\pepega.tga",
["pogChamp"]="Interface\\AddOns\\TemniUgolok\\resources\\pogChamp.tga",
["raintru"]="Interface\\AddOns\\TemniUgolok\\resources\\raintru.tga",
["raintruEbalo"]="Interface\\AddOns\\TemniUgolok\\resources\\raintruEbalo.tga",
["raintruKaef"]="Interface\\AddOns\\TemniUgolok\\resources\\raintruKaef.tga",
["raintruNeKaef"]="Interface\\AddOns\\TemniUgolok\\resources\\raintruNeKaef.tga",
["sadboy"]="Interface\\AddOns\\TemniUgolok\\resources\\sadboy.tga",
["shto"]="Interface\\AddOns\\TemniUgolok\\resources\\shto.tga",
["slowPoke"]="Interface\\AddOns\\TemniUgolok\\resources\\slowPoke.tga",
["spsBlizzard"]="Interface\\AddOns\\TemniUgolok\\resources\\spsBlizzard.tga",
["wut"]="Interface\\AddOns\\TemniUgolok\\resources\\wut.tga",
["zachemObidel"]="Interface\\AddOns\\TemniUgolok\\resources\\zachemObidel.tga",
["zemlyaPuhom"]="Interface\\AddOns\\TemniUgolok\\resources\\zemlyaPuhom.tga",
["hyena"]="Interface\\AddOns\\TemniUgolok\\resources\\fiend.tga",
["wipe"]="Interface\\AddOns\\TemniUgolok\\resources\\oshotikZaebal.tga",
["jason"]="Interface\\AddOns\\TemniUgolok\\resources\\jason.tga",
["lovushkaJerokera"]="Interface\\AddOns\\TemniUgolok\\resources\\lovushkaJerokera.tga",
["nePonimayu"]="Interface\\AddOns\\TemniUgolok\\resources\\nePonimayu.tga",
["ponimayu"]="Interface\\AddOns\\TemniUgolok\\resources\\ponimayu.tga",
["sho"]="Interface\\AddOns\\TemniUgolok\\resources\\sho.tga",
["sheal"]="Interface\\AddOns\\TemniUgolok\\resources\\sheal.tga",
["arms"]="Interface\\AddOns\\TemniUgolok\\resources\\arms.tga",
["know"]="Interface\\AddOns\\TemniUgolok\\resources\\know.tga",
["taktikaGalaktika"]="Interface\\AddOns\\TemniUgolok\\resources\\taktikaGalaktika.tga",
["opyatLokalka"]="Interface\\AddOns\\TemniUgolok\\resources\\opyatLokalka.tga",
["lgbt"]="Interface\\AddOns\\TemniUgolok\\resources\\lgbt.tga",
["milik"]="Interface\\AddOns\\TemniUgolok\\resources\\milik.tga",
["milikiNahuiNenuzhni"]="Interface\\AddOns\\TemniUgolok\\resources\\milikiNahuiNenuzhni.tga",
["warCry"]="Interface\\AddOns\\TemniUgolok\\resources\\warCry.tga",
["gatil"]="Interface\\AddOns\\TemniUgolok\\resources\\gatil.tga",
["melanh"]="Interface\\AddOns\\TemniUgolok\\resources\\melanh.tga",
["dushniUgolok"]="Interface\\AddOns\\TemniUgolok\\resources\\dushniUgolok.tga",
["5head"]="Interface\\AddOns\\TemniUgolok\\resources\\5head.tga",
["2head"]="Interface\\AddOns\\TemniUgolok\\resources\\2head.tga",
["lya"]="Interface\\AddOns\\TemniUgolok\\resources\\lya.tga",
["iniciativnost"]="Interface\\AddOns\\TemniUgolok\\resources\\iniciativnost.tga",
["kekw"]="Interface\\AddOns\\TemniUgolok\\resources\\kekw.tga",
["kyrian"]="Interface\\AddOns\\TemniUgolok\\resources\\kyrian.tga",
["necrolord"]="Interface\\AddOns\\TemniUgolok\\resources\\necrolord.tga",
["nightFae"]="Interface\\AddOns\\TemniUgolok\\resources\\night_fae.tga",
["venthyr"]="Interface\\AddOns\\TemniUgolok\\resources\\venthyr.tga",
["etoKill"]="Interface\\AddOns\\TemniUgolok\\resources\\etoKill.tga",
["etoNeKill"]="Interface\\AddOns\\TemniUgolok\\resources\\etoNeKill.tga",
["cel"]="Interface\\AddOns\\TemniUgolok\\resources\\cel.tga",
["olegaKek"]="Interface\\AddOns\\TemniUgolok\\resources\\olegaKek.tga",
["iziOsvoenie"]="Interface\\AddOns\\TemniUgolok\\resources\\iziOsvoenie.tga",
["kenona"]="Interface\\AddOns\\TemniUgolok\\resources\\kenona.tga",
["masque"]="Interface\\AddOns\\TemniUgolok\\resources\\masque.tga",
["pepelE"]="Interface\\AddOns\\TemniUgolok\\resources\\pepelE.tga",
};
local emoticons={
--Filename
["bdumTss"]="bdumTss",
["burn"]="burn",
["damagNahuiNeNuzhen"]="damagNahuiNeNuzhen",
["toenak"]="dcPriest",
["derzhiVKurse"]="derzhiVKurse",
["doubleTilt"]="doubleTilt",
["feelsBadMan"]="feelsBadMan",
["gloom"]="gloom",
["gloomChmok"]="gloomChmok",
["hmm"]="hmm",
["jirokUprls"]="jirokUprls",
["kappaPride"]="kappaPride",
["kupikupi"]="kovanich",
["mirkusha"]="mirkusha",
["molodchaga"]="molodchaga",
["monkas"]="monkas",
["neShutiTak"]="neShutiTak",
["ohueliSovsem"]="ohueliSovsem",
["olegalul"]="olegalul",
["opa"]="opa",
["pepeclown"]="pepeclown",
["pepega"]="pepega",
["pogChamp"]="pogChamp",
["raintru"]="raintru",
["raintruEbalo"]="raintruEbalo",
["raintruKaef"]="raintruKaef",
["raintruNeKaef"]="raintruNeKaef",
["sadboy"]="sadboy",
["shto"]="shto",
["slowPoke"]="slowPoke",
["spsBlizzard"]="spsBlizzard",
["wut"]="wut",
["zachemObidel"]="zachemObidel",
["zemlyaPuhom"]="zemlyaPuhom",
["lovushkaJerokera"]="lovushkaJerokera",
["nePonimayu"]="nePonimayu",
["ponimayu"]="ponimayu",
["sho"]="sho",
["know"]="know",
["taktikaGalaktika"]="taktikaGalaktika",
["opyatLokalka"]="opyatLokalka",
["wipe"]="wipe",
["milik"]="milik",
["milikiNahuiNenuzhni"]="milikiNahuiNenuzhni",
["gatil"]="gatil",
["melanh"]="melanh",
["dushniUgolok"]="dushniUgolok",
["5head"]="5head",
["hyena"]="hyena",
["2head"]="2head",
["lya"]="lya",
["iniciativnost"]="iniciativnost",
["kekw"]="kekw",
["kyrian"]="kyrian",
["necrolord"]="necrolord",
["nightFae"]="nightFae",
["venthyr"]="venthyr",
["etoKill"]="etoKill",
["etoNeKill"]="etoNeKill",
["olegaKek"]="olegaKek",
["iziOsvoenie"]="iziOsvoenie",
["pepelE"]="pepelE",
--Filename lowercase
["bdumtss"]="bdumTss",
["damagnahuinenuzhen"]="damagNahuiNeNuzhen",
["derzhivkurse"]="derzhiVKurse",
["doubletilt"]="doubleTilt",
["feelsbadman"]="feelsBadMan",
["gloomchmok"]="gloomChmok",
["jirokuprls"]="jirokUprls",
["kappapride"]="kappaPride",
["neshutitak"]="neShutiTak",
["ohuelisovsem"]="ohueliSovsem",
["pogchamp"]="pogChamp",
["raintruebalo"]="raintruEbalo",
["raintrukaef"]="raintruKaef",
["raintrunekaef"]="raintruNeKaef",
["slowpoke"]="slowPoke",
["spsblizzard"]="spsBlizzard",
["zachemobidel"]="zachemObidel",
["zemlyapuhom"]="zemlyaPuhom",
["jason"]="jason",
["lovushkajerokera"]="lovushkaJerokera",
["neponimayu"]="nePonimayu",
["taktikagalaktika"]="taktikaGalaktika",
["opyatlokalka"]="opyatLokalka",
["milikinahuinenuzhni"]="milikiNahuiNenuzhni",
["dushniugolok"]="dushniUgolok",
["nightfae"]="nightFae",
["etokill"]="etoKill",
["etonekill"]="etoNeKill",
["olegakek"]="olegaKek",
["iziosvoenie"]="iziOsvoenie",
["kenona"]="kenona",
["masque"]="masque",
["pepele"]="pepelE",
["pepel"]="pepelE",
--Discord-style
[":bdum_tss:"]="bdumTss",
[":bdumtss:"]="bdumTss",
[":BURN:"]="burn",
[":damag_nahui_ne_nuzhen:"]="damagNahuiNeNuzhen",
[":toenak:"]="dcPriest",
[":derzhi_v_kurse:"]="derzhiVKurse",
[":double_tilt:"]="doubleTilt",
[":duble_tilt:"]="doubleTilt",
[":FeelsBadMan:"]="feelsBadMan",
[":gloom:"]="gloom",
[":gloom_chmok:"]="gloomChmok",
[":GloomChmok:"]="gloomChmok",
[":hmm:"]="hmm",
[":jirok_uprls:"]="jirokUprls",
[":Kappapride:"]="kappaPride",
[":kupikupi:"]="kovanich",
[":mirkusha:"]="mirkusha",
[":molodchaga:"]="molodchaga",
[":monkas:"]="monkas",
[":ne_shuti_tak:"]="neShutiTak",
[":ohueli_sovsem:"]="ohueliSovsem",
[":olegalul:"]="olegalul",
[":pepeclown:"]="pepeclown",
[":opa:"]="opa",
[":raintru_nekaef:"]="raintruNeKaef",
[":shto:"]="shto",
[":PEPEGA:"]="pepega",
[":SADBOY:"]="sadboy",
[":slowpoke:"]="slowPoke",
[":sps_blizzard:"]="spsBlizzard",
[":zachem_obidel:"]="zachemObidel",
[":raintru_kaef:"]="raintruKaef",
[":zemlya_puhom:"]="zemlyaPuhom",
[":wut:"]="wut",
[":PogChamp:"]="pogChamp",
[":raintru_ebalo:"]="raintruEbalo",
[":raintru:"]="raintru",
[":Jason:"]="jason",
[":lovushkaJerokera:"]="lovushkaJerokera",
[":neponimayu:"]="nePonimayu",
[":ponimayu:"]="ponimayu",
[":sho:"]="sho",
[":known:"]="know",
[":taktika_galaktika:"]="taktikaGalaktika",
[":opyat_lokalka:"]="opyatLokalka",
[":lgbt:"]="lgbt",
[":milik:"]="milik",
[":miliki_nahui_ne_nuzhni:"]="milikiNahuiNenuzhni",
[":gatil:"]="gatil",
[":melanh:"]="melanh",
[":wipe:"]="wipe",
[":dushni_ugolok:"]="dushniUgolok",
[":5head:"]="5head",
[":hyena:"]="hyena",
[":2head:"]="2head",
[":lya:"]="lya",
[":iniciativnost:"]="iniciativnost",
[":kekw:"]="kekw",
[":kyrian:"]="kyrian",
[":necrolord:"]="necrolord",
[":nightFae:"]="nightFae",
[":venthyr:"]="venthyr",
[":eto_kill:"]="etoKill",
[":eto_ne_kill:"]="etoNeKill",
[":olega_kek:"]="olegaKek",
[":izi_osvoenie:"]="iziOsvoenie",
[":kenona:"]="kenona",
[":masque:"]="masque",
[":pepel_e:"]="pepelE",
--shortcuts
[":bdum:"]="bdumTss",
[":dnnn:"]="damagNahuiNeNuzhen",
[":dvk:"]="derzhiVKurse",
[":dt:"]="doubleTilt",
[":fbm:"]="feelsBadMan",
[":gc:"]="gloomChmok",
[":ju:"]="jirokUprls",
[":kp:"]="kappaPride",
[":mldg:"]="molodchaga",
[":nst:"]="neShutiTak",
[":os:"]="ohueliSovsem",
[":olul:"]="olegalul",
[":pc:"]="pepeclown",
[":rnk:"]="raintruNeKaef",
[":sps:"]="spsBlizzard",
[":zo:"]="zachemObidel",
[":rk:"]="raintruKaef",
[":zp:"]="zemlyaPuhom",
[":pch:"]="pogChamp",
[":re:"]="raintruEbalo",
[":jsn:"]="jason",
[":lshj:"]="lovushkaJerokera",
[":npnm:"]="nePonimayu",
[":pnm:"]="ponimayu",
[":tg:"]="taktikaGalaktika",
[":op:"]="opyatLokalka",
[":mnnn:"]="milikiNahuiNenuzhni",
[":du:"]="dushniUgolok",
[":ini:"]="iniciativnost",
[":kr:"]="kyrian",
[":nl:"]="necrolord",
[":nf:"]="nightFae",
[":vr:"]="venthyr",
[":ek:"]="etoKill",
[":enk:"]="etoNeKill",
[":okek:"]="olegaKek",
[":izi:"]="iziOsvoenie",
[":pe:"]="pepelE",
--------------------------------------
--hidden
--------------------------------------
["warCry"]="warCry",
["warcry"]="warCry",
[":warcry:"]="warCry",
[":wc:"]="warCry",
[":cel:"]="cel",
--lgbt
["lgbt"]="lgbt",
["pidor"]="lgbt",
["pidoras"]="lgbt",
["pedik"]="lgbt",
["pidr"]="lgbt",
["пидор"]="lgbt",
["пидорас"]="lgbt",
["педик"]="lgbt",
["пидр"]="lgbt",
};
local dropdown_options={
[01]= {"Старые",
"bdumtss",
":bdum:",
"burn",
"kupikupi",
"molodchaga",
":mldg:",
"neshutitak",
":nst:",
"sadboy",
"slowpoke",
"wut",
"sho",
"shto",
"know"},
[02]= {"Тёмный уголок",
"toenak",
"gatil",
"melanh",
"raintru",
"hyena",
"jirokuprls",
":ju:",
"lovushkajerokera",
":lshj:",
--
"raintruebalo",
":re:",
"raintrukaef",
":rk:",
"raintrunekaef",
":rnk:",
"gloom",
"gloomchmok",
":gc:",
"doubletilt",
":dt:",
"kenona"},
[03]= {"Тёмные memes",
"spsblizzard",
":sps:",
"zemlyapuhom",
":zp:",
"taktikagalaktika",
":tg:",
"opyatlokalka",
":op:",
"damagnahuinenuzhen",
":dnnn:",
"milik",
"milikinahuinenuzhni",
":mnnn:",
"dushniugolok",
":du:",
"iniciativnost",
":ini:",
"etokill",
":ek:",
"etonekill",
":enk:",
"pepel",
":pe:",
"iziOsvoenie",
":izi:",
"masque"},
[04]= {"Олего-смайлы",
"ohuelisovsem",
":os:",
"olegalul",
":olul:",
"olegakek",
":okek:",
"hmm",
"zachemobidel",
":zo:",
"5head",
"2head",
"mirkusha"},
[05]= {"Текстовые",
"lya",
"opa",
"neponimayu",
":npnm:",
"ponimayu",
":pnm:",
"wipe"},
[06]= {"Memes",
"jason",
":jsn:",
"derzhivkurse",
":dvk:",
"kekw",
"pogchamp",
":pch:",
"kappapride",
":kp:",
"pepega",
"feelsbadman",
":fbm:",
"pepeclown",
":pc:",
"monkas"},
[07]= {"Ковенанты",
"kyrian",
":kr:",
"necrolord",
":nl:",
"nightfae",
":nf:",
"venthyr",
":vr:"}
};
local ItemTextFrameSetText = ItemTextPageText.SetText;
-- Call this in a mod's initialization to move the minimap button to its saved position (also used in its movement)
-- ** do not call from the mod's OnLoad, VARIABLES_LOADED or later is fine. **
function stripChars(str)
local tableAccents = {}
tableAccents["À"] = "A"
tableAccents["Á"] = "A"
tableAccents["Â"] = "A"
tableAccents["Ã"] = "A"
tableAccents["Ä"] = "A"
tableAccents["Å"] = "A"
tableAccents["Æ"] = "AE"
tableAccents["Ç"] = "C"
tableAccents["È"] = "E"
tableAccents["É"] = "E"
tableAccents["Ê"] = "E"
tableAccents["Ë"] = "E"
tableAccents["Ì"] = "I"
tableAccents["Í"] = "I"
tableAccents["Î"] = "I"
tableAccents["Ï"] = "I"
tableAccents["Ð"] = "D"
tableAccents["Ñ"] = "N"
tableAccents["Ò"] = "O"
tableAccents["Ó"] = "O"
tableAccents["Ô"] = "O"
tableAccents["Õ"] = "O"
tableAccents["Ö"] = "O"
tableAccents["Ø"] = "O"
tableAccents["Ù"] = "U"
tableAccents["Ú"] = "U"
tableAccents["Û"] = "U"
tableAccents["Ü"] = "U"
tableAccents["Ý"] = "Y"
tableAccents["Þ"] = "P"
tableAccents["ß"] = "s"
tableAccents["à"] = "a"
tableAccents["á"] = "a"
tableAccents["â"] = "a"
tableAccents["ã"] = "a"
tableAccents["ä"] = "a"
tableAccents["å"] = "a"
tableAccents["æ"] = "ae"
tableAccents["ç"] = "c"
tableAccents["è"] = "e"
tableAccents["é"] = "e"
tableAccents["ê"] = "e"
tableAccents["ë"] = "e"
tableAccents["ì"] = "i"
tableAccents["í"] = "i"
tableAccents["î"] = "i"
tableAccents["ï"] = "i"
tableAccents["ð"] = "eth"
tableAccents["ñ"] = "n"
tableAccents["ò"] = "o"
tableAccents["ó"] = "o"
tableAccents["ô"] = "o"
tableAccents["õ"] = "o"
tableAccents["ö"] = "o"
tableAccents["ø"] = "o"
tableAccents["ù"] = "u"
tableAccents["ú"] = "u"
tableAccents["û"] = "u"
tableAccents["ü"] = "u"
tableAccents["ý"] = "y"
tableAccents["þ"] = "p"
tableAccents["ÿ"] = "y"
local normalisedString = ''
local normalisedString = str: gsub("[%z\1-\127\194-\244][\128-\191]*", tableAccents)
return normalisedString
end
function MyMod_MinimapButton_Reposition()
MyMod_MinimapButton:SetPoint("TOPLEFT","Minimap","TOPLEFT",52-(80*cos(Emoticons_Settings["MinimapPos"])),(80*sin(Emoticons_Settings["MinimapPos"]))-52)
end
-- Only while the button is dragged this is called every frame
function MyMod_MinimapButton_DraggingFrame_OnUpdate()
local xpos,ypos = GetCursorPosition()
local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom()
MyMod_MinimapButton:SetToplevel(true)
xpos = xmin-xpos/UIParent:GetScale()+70 -- get coordinates as differences from the center of the minimap
ypos = ypos/UIParent:GetScale()-ymin-70
Emoticons_Settings["MinimapPos"] = math.deg(math.atan2(ypos,xpos)) -- save the degrees we are relative to the minimap center
MyMod_MinimapButton_Reposition() -- move the button
end
-- Put your code that you want on a minimap button click here. arg1="LeftButton", "RightButton", etc
function MyMod_MinimapButton_OnClick()
Lib_ToggleDropDownMenu(1, nil, EmoticonChatFrameDropDown, MyMod_MinimapButton, 0, 0);
end
function ItemTextPageText.SetText(self,msg,...)
if(Emoticons_Settings["MAIL"] and msg ~= nil) then
msg = Emoticons_RunReplacement(msg);
end
ItemTextFrameSetText(self,msg,...);
end
local OpenMailBodyTextSetText = OpenMailBodyText.SetText;
function OpenMailBodyText.SetText(self,msg,...)
if(Emoticons_Settings["MAIL"] and msg ~= nil) then
msg = Emoticons_RunReplacement(msg);
end
OpenMailBodyTextSetText(self,msg,...);
end
function Emoticons_LoadChatFrameDropdown(self, level, menuList)
local info = Lib_UIDropDownMenu_CreateInfo();
if (level or 1) == 1 then
for k,v in ipairs(dropdown_options) do
if (Emoticons_Settings["FAVEMOTES"][k]) then
info.hasArrow = true;
info.text = v[1];
info.value = false;
info.menuList = k;
Lib_UIDropDownMenu_AddButton(info);
end
end
else
first=true;
for ke,va in ipairs(dropdown_options[menuList]) do
if (first) then
first = false;
else
--print(ke.." "..va);
info.text = "|T"..defaultpack[emoticons[va]].."%:20%:20".."|t "..va;
info.value = va;
info.func = Emoticons_Dropdown_OnClick;
Lib_UIDropDownMenu_AddButton(info, level);
end
end
end
end
function Emoticons_Setxposi(x)
Emoticons_Settings["sliderX"]=x;
b:SetPoint("TOPLEFT",Emoticons_Settings["sliderX"],Emoticons_Settings["sliderY"]);
end
function Emoticons_Setyposi(y)
Emoticons_Settings["sliderY"]=y;
b:SetPoint("TOPLEFT",Emoticons_Settings["sliderX"],Emoticons_Settings["sliderY"]);
end
function Chat_Icons_Size_Changed(y)
Emoticons_Settings["chatIconsSize"]=y;
end
function Details_Icons_Size_Changed(y)
Emoticons_Settings["detailsIconsSize"]=y;
end
function Emoticons_Dropdown_OnClick(self,arg1,arg2,arg3)
if(ACTIVE_CHAT_EDIT_BOX ~= nil) then
ACTIVE_CHAT_EDIT_BOX:Insert(self.value);
end
end
function Emoticons_MailFrame_OnChar(self)
local msg = self:GetText();
if(Emoticons_Eyecandy and Emoticons_Settings["MAIL"] and string.sub(msg,1,1) ~= "/") then
self:SetText(Emoticons_RunReplacement(msg));
end
end
local sm = SendMail;
function SendMail(recipient,subject,msg,...)
if(Emoticons_Eyecandy and Emoticons_Settings["MAIL"]) then
msg = Emoticons_Deformat(msg);
end
sm(recipient,subject,msg,...);
end
local scm = SendChatMessage;
function SendChatMessage(msg,...)
if(Emoticons_Eyecandy) then
msg = Emoticons_Deformat(msg);
end
scm(msg,...);
end
local bnsw = BNSendWhisper;
function BNSendWhisper(id,msg,...)
if(Emoticons_Eyecandy) then
msg = Emoticons_Deformat(msg);
end
bnsw(id,msg,...);
end
function Emoticons_UpdateChatFilters()
for k,v in pairs(Emoticons_Settings) do
if(k ~= "MAIL" and k ~= "TWITCHBUTTON" and k ~= "sliderX" and k ~= "sliderY") then
if(v) then
ChatFrame_AddMessageEventFilter(k,Emoticons_MessageFilter)
else
ChatFrame_RemoveMessageEventFilter(k,Emoticons_MessageFilter);
end
end
end
end
function Emoticons_MessageFilter(self, event, msg, ...)
msg = Emoticons_RunReplacement(msg);
return false, msg, ...
end
-- addon hat saved vars geladen
function Emoticons_OnEvent(self,event,...)
if(event == "ADDON_LOADED" and select(1,...) == "TemniUgolok") then
for k,v in pairs(origsettings) do
if(Emoticons_Settings[k] == nil) then
Emoticons_Settings[k] = v;
end
end
Emoticons_UpdateChatFilters();
b:SetPoint("TOPLEFT",Emoticons_Settings["sliderX"],Emoticons_Settings["sliderY"]);
b:SetWidth(24);
b:SetHeight(24);
b:RegisterForClicks("AnyUp", "AnyDown");
b:SetNormalTexture("Interface\\AddOns\\TemniUgolok\\logo.tga");
Emoticons_SetTwitchButton(Emoticons_Settings["TWITCHBUTTON"]);
Emoticons_SetMinimapButton(Emoticons_Settings["MINIMAPBUTTON"]);
MyMod_MinimapButton_Reposition();
end
end
function Emoticons_OptionsWindow_OnShow(self)
for k,v in pairs(Emoticons_Settings) do
local cb = getglobal("EmoticonsOptionsControlsPanel"..k);
if(cb ~= nil) then
cb:SetChecked(Emoticons_Settings[k]);
end
end
SliderXText:SetText("Position X: "..Emoticons_Settings["sliderX"]);
SliderYText:SetText("Position Y: "..Emoticons_Settings["sliderY"]);
ChatIconsSizeText:SetText("Chat Icons Size: "..Emoticons_Settings["chatIconsSize"]);
ChatIconsSize:SetValue(Emoticons_Settings["chatIconsSize"])
DetailsIconsSizeText:SetText("Details Icons Size: "..Emoticons_Settings["detailsIconsSize"]);
DetailsIconsSize:SetValue(Emoticons_Settings["detailsIconsSize"])
--EmoticonsOptionsControlsPanelEyecandy:SetChecked(Emoticons_Eyecandy);
favall = CreateFrame("CheckButton","favall_GlobalName",EmoticonsOptionsControlsPanel,"UIRadioButtonTemplate" );
--getglobal("favall_GlobalName"):SetChecked(false);
favall:SetPoint("TOPLEFT", 17,-380);
getglobal(favall:GetName().."Text"):SetText("Check all");
favall.tooltip = "Check all boxes below.";
getglobal("favall_GlobalName"):SetScript("OnClick",
function(self)
if (self:GetChecked()) then
if (getglobal("favnone_GlobalName"):GetChecked() == true) then
getglobal("favnone_GlobalName"):SetChecked(false);
end
self:SetChecked(true);
for n,m in ipairs(Emoticons_Settings["FAVEMOTES"]) do
Emoticons_Settings["FAVEMOTES"][n] = true;
--print("favCheckButton_"..dropdown_options[n][1]);
if (getglobal("favCheckButton_"..dropdown_options[n][1]):GetChecked() == false) then
getglobal("favCheckButton_"..dropdown_options[n][1]):SetChecked(true);
end
end
else
--Emoticons_Settings["FAVEMOTES"][a] = false;
end
end
);
favnone = CreateFrame("CheckButton", "favnone_GlobalName", favall_GlobalName,"UIRadioButtonTemplate" );
--getglobal("favnone_GlobalName"):SetChecked(false);
favnone:SetPoint("TOPLEFT", 110,0);
getglobal(favnone:GetName().."Text"):SetText("Uncheck all");
favnone.tooltip = "Uncheck all boxes below.";
getglobal("favnone_GlobalName"):SetScript("OnClick",
function(self)
if (self:GetChecked()) then
if (getglobal("favall_GlobalName"):GetChecked() == true) then
getglobal("favall_GlobalName"):SetChecked(false);
end
self:SetChecked(true);
for n,m in ipairs(Emoticons_Settings["FAVEMOTES"]) do
Emoticons_Settings["FAVEMOTES"][n] = false;
if (getglobal("favCheckButton_"..dropdown_options[n][1]):GetChecked()==true) then
getglobal("favCheckButton_"..dropdown_options[n][1]):SetChecked(false);
end
end
--Emoticons_Settings["FAVEMOTES"][a] = true;
else
--Emoticons_Settings["FAVEMOTES"][a] = false;
end
end
);
favframe = CreateFrame("Frame", "favframe_GlobalName", favall_GlobalName, BackdropTemplateMixin and "BackdropTemplate");
favframe:SetPoint("TOPLEFT", 0,-24);
favframe:SetSize(590,125);
favframe:SetBackdrop({bgFile="Interface\\ChatFrame\\ChatFrameBackground",edgeFile="Interface\\Tooltips\\UI-Tooltip-Border",tile=true,tileSize=5,edgeSize= 2,});
favframe:SetBackdropColor(0, 0, 0,0.5);
first=true;
itemcnt=0
for a,c in ipairs(dropdown_options) do
if first then
favCheckButton = CreateFrame("CheckButton", "favCheckButton_"..c[1], favframe_GlobalName, "ChatConfigCheckButtonTemplate");
first=false;
favCheckButton:SetPoint("TOPLEFT", 0, 3);
else
--favbuttonlist=loadstring("favCheckButton_"..anchor);
favCheckButton = CreateFrame("CheckButton", "favCheckButton_"..c[1], favframe_GlobalName, "ChatConfigCheckButtonTemplate");
favCheckButton:SetParent("favCheckButton_"..anchor);
if ((itemcnt % 10) ~= 0) then
favCheckButton:SetPoint("TOPLEFT", 0, -16);
else
favCheckButton:SetPoint("TOPLEFT", 110, 9*16);
end
end
itemcnt=itemcnt+1;
anchor=c[1];
--code=[[print("favCheckButton_"..b[1]..":SetText(b[1])")]];
getglobal(favCheckButton:GetName().."Text"):SetText(c[1]);
if (getglobal("favCheckButton_"..c[1]):GetChecked() ~= Emoticons_Settings["FAVEMOTES"][a]) then
getglobal("favCheckButton_"..c[1]):SetChecked(Emoticons_Settings["FAVEMOTES"][a]);
end
favCheckButton.tooltip = "Checked boxes will show in the dropdownlist.";
favCheckButton:SetScript("OnClick",
function(self)
if (self:GetChecked()) then
Emoticons_Settings["FAVEMOTES"][a] = true;
else
Emoticons_Settings["FAVEMOTES"][a] = false;
end
end
);
end
end
function Emoticons_Deformat(msg)
for k,v in pairs(emoticons) do
msg=string.gsub(msg,"|T"..defaultpack[k].."%:28%:28|t",v);
end
return msg;
end
function Emoticons_RunReplacement(msg)
--remember to watch out for |H|h|h's
local outstr = "";
local origlen = string.len(msg);
local startpos = 1;
local endpos;
while(startpos <= origlen) do
endpos = origlen;
local pos = string.find(msg,"|H",startpos,true);
if(pos ~= nil) then
endpos = pos;
end
outstr = outstr .. Emoticons_InsertEmoticons(string.sub(msg,startpos,endpos)); --run replacement on this bit
startpos = endpos + 1;
if(pos ~= nil) then
endpos = string.find(msg,"|h",startpos,true);
if(endpos == nil) then
endpos = origlen;
end
if(startpos < endpos) then
outstr = outstr .. string.sub(msg,startpos,endpos); --don't run replacement on this bit
startpos = endpos + 1;
end
end
end
return outstr;
end
function Emoticons_SetEyecandy(state)
if(state) then
Emoticons_Eyecandy = true;
if(ACTIVE_CHAT_EDIT_BOX~=nil) then
ACTIVE_CHAT_EDIT_BOX:SetText(Emoticons_RunReplacement(ACTIVE_CHAT_EDIT_BOX:GetText()));
end
else
Emoticons_Eyecandy = false;
if(ACTIVE_CHAT_EDIT_BOX~=nil) then
ACTIVE_CHAT_EDIT_BOX:SetText(Emoticons_Deformat(ACTIVE_CHAT_EDIT_BOX:GetText()));
end
end
end
function Emoticons_SetTwitchButton(state)
if(state) then
state = true;
else
state = false;
end
Emoticons_Settings["TWITCHBUTTON"]=state;
if(state) then
TestButton:Hide();
else
TestButton:Hide();
end
end
function Emoticons_SetMinimapButton(state)
if(state) then
state = true;
else
state = false;
end
Emoticons_Settings["MINIMAPBUTTON"]=state;
if(state) then
MyMod_MinimapButton:Show();
else
MyMod_MinimapButton:Hide();
end
end
function Emoticons_InsertEmoticons(msg)
--print(table.getn(words)) ;
for k,v in pairs(emoticons) do
if (string.find(msg,k,1,true)) then
msg = string.gsub(msg,"(%s)"..k.."(%s)","%1|T"..defaultpack[v].."%:"..Emoticons_Settings["chatIconsSize"].."%:"..Emoticons_Settings["chatIconsSize"].."|t%2");
msg = string.gsub(msg,"(%s)"..k.."$","%1|T"..defaultpack[v].."%:"..Emoticons_Settings["chatIconsSize"].."%:"..Emoticons_Settings["chatIconsSize"].."|t");
msg = string.gsub(msg,"^"..k.."(%s)","|T"..defaultpack[v].."%:"..Emoticons_Settings["chatIconsSize"].."%:"..Emoticons_Settings["chatIconsSize"].."|t%1");
msg = string.gsub(msg,"^"..k.."$","|T"..defaultpack[v].."%:"..Emoticons_Settings["chatIconsSize"].."%:"..Emoticons_Settings["chatIconsSize"].."|t");
msg = string.gsub(msg,"(%s)"..k.."(%c)","%1|T"..defaultpack[v].."%:"..Emoticons_Settings["chatIconsSize"].."%:"..Emoticons_Settings["chatIconsSize"].."|t%2");
msg = string.gsub(msg,"(%s)"..k.."(%s)","%1|T"..defaultpack[v].."%:"..Emoticons_Settings["chatIconsSize"].."%:"..Emoticons_Settings["chatIconsSize"].."|t%2");
end
end
return msg;
end
function TemniUgolok_SetEmojiToDetails(msg)
--print(table.getn(words)) ;
for k,v in pairs(emoticons) do
if (string.find(msg,k,1,true)) then
msg = string.gsub(msg,"(%s)"..k.."(%s)","%1|T"..defaultpack[v].."%:"..Emoticons_Settings["detailsIconsSize"].."%:"..Emoticons_Settings["detailsIconsSize"].."|t%2");
msg = string.gsub(msg,"(%s)"..k.."$","%1|T"..defaultpack[v].."%:"..Emoticons_Settings["detailsIconsSize"].."%:"..Emoticons_Settings["detailsIconsSize"].."|t");
msg = string.gsub(msg,"^"..k.."(%s)","|T"..defaultpack[v].."%:"..Emoticons_Settings["detailsIconsSize"].."%:"..Emoticons_Settings["detailsIconsSize"].."|t%1");
msg = string.gsub(msg,"^"..k.."$","|T"..defaultpack[v].."%:"..Emoticons_Settings["detailsIconsSize"].."%:"..Emoticons_Settings["detailsIconsSize"].."|t");
msg = string.gsub(msg,"(%s)"..k.."(%c)","%1|T"..defaultpack[v].."%:"..Emoticons_Settings["detailsIconsSize"].."%:"..Emoticons_Settings["detailsIconsSize"].."|t%2");
msg = string.gsub(msg,"(%s)"..k.."(%s)","%1|T"..defaultpack[v].."%:"..Emoticons_Settings["detailsIconsSize"].."%:"..Emoticons_Settings["detailsIconsSize"].."|t%2");
end
end
return msg;
end
function Emoticons_SetType(chattype,state)
if(state) then
state = true;
else
state = false;
end
if(chattype == "CHAT_MSG_RAID") then
Emoticons_Settings["CHAT_MSG_RAID_LEADER"] = state;
Emoticons_Settings["CHAT_MSG_RAID_WARNING"] = state;
end
if(chattype == "CHAT_MSG_PARTY") then
Emoticons_Settings["CHAT_MSG_PARTY_LEADER"] = state;
Emoticons_Settings["CHAT_MSG_PARTY_GUIDE"] = state;
end
if(chattype == "CHAT_MSG_WHISPER") then
Emoticons_Settings["CHAT_MSG_WHISPER_INFORM"] = state;
end
if(chattype == "CHAT_MSG_INSTANCE_CHAT") then
Emoticons_Settings["CHAT_MSG_INSTANCE_CHAT_LEADER"] = state;
end
if(chattype == "CHAT_MSG_BN_WHISPER") then
Emoticons_Settings["CHAT_MSG_BN_WHISPER_INFORM"] = state;
end
Emoticons_Settings[chattype] = state;
Emoticons_UpdateChatFilters();
end
b = CreateFrame("Button", "TestButton", ChatFrame1, "UIPanelButtonTemplate");
|
---------------------------------------------------------------------------
--- Popup layout
--
-- @module layout.popup
-- @alias popup
---------------------------------------------------------------------------
local popup = {}
--- Popup layout.
popup.name = "popup"
function popup.arrange(p)
-- Fullscreen?
local area
if fs then
area = p.geometry
else
area = p.workarea
end
for _, c in pairs(p.clients) do
local g = {
x = area.x,
y = area.y,
width = area.width,
height = area.height
}
p.geometries[c] = g
end
end
return popup
|
--[[
TheNexusAvenger
Icon for showing the state of a test.
--]]
local NexusUnitTestingPluginProject = require(script.Parent.Parent)
local NexusUnitTesting = NexusUnitTestingPluginProject:GetResource("NexusUnitTestingModule")
local TEST_ICON_SPRITESHEET = "http://www.roblox.com/asset/?id=4595118527"
local ICON_SIZE = Vector2.new(256,256)
local ICON_POSITIONS = {
[NexusUnitTesting.TestState.NotRun] = Vector2.new(0,0),
[NexusUnitTesting.TestState.InProgress] = Vector2.new(256,0),
[NexusUnitTesting.TestState.Passed] = Vector2.new(512,0),
[NexusUnitTesting.TestState.Failed] = Vector2.new(768,0),
[NexusUnitTesting.TestState.Skipped] = Vector2.new(0,256),
}
local ICON_COLORS = {
[NexusUnitTesting.TestState.NotRun] = Color3.new(0,170/255,255/255),
[NexusUnitTesting.TestState.InProgress] = Color3.new(255/255,150/255,0),
[NexusUnitTesting.TestState.Passed] = Color3.new(0,200/255,0),
[NexusUnitTesting.TestState.Failed] = Color3.new(200/255,0,0),
[NexusUnitTesting.TestState.Skipped] = Color3.new(220/255,220/255,0),
}
local NexusWrappedInstance = NexusUnitTestingPluginProject:GetResource("NexusPluginFramework.Base.NexusWrappedInstance")
local TestStateIcon = NexusWrappedInstance:Extend()
TestStateIcon:SetClassName("TestStateIcon")
--[[
Creates a Test State Icon.
--]]
function TestStateIcon:__new()
self:InitializeSuper("ImageLabel")
--Set up changing the test state.
self:__SetChangedOverride("TestState",function()
self.ImageColor3 = ICON_COLORS[self.TestState]
self.ImageRectOffset = ICON_POSITIONS[self.TestState]
end)
--Add an indicator for if there is any output.
local OutputIndicator = NexusWrappedInstance.new("Frame")
OutputIndicator.BackgroundColor3 = Color3.new(0,170/255,255/255)
OutputIndicator.Size = UDim2.new(0.5,0,0.5,0)
OutputIndicator.Position = UDim2.new(0.5,0,0.5,0)
OutputIndicator.Parent = self
local UICorner = NexusWrappedInstance.new("UICorner")
UICorner.CornerRadius = UDim.new(0.5,0)
UICorner.Parent = OutputIndicator
self:__SetChangedOverride("OutputIndicator",function() end)
self.OutputIndicator = OutputIndicator
--Set up showing and hiding the indicator.
self:__SetChangedOverride("HasOutput",function()
OutputIndicator.Visible = self.HasOutput
end)
--Set the defaults.
self.BackgroundTransparency = 1
self.Image = TEST_ICON_SPRITESHEET
self.ImageRectSize = ICON_SIZE
self.TestState = NexusUnitTesting.TestState.NotRun
self.HasOutput = false
end
return TestStateIcon
|
--function fwrite(fmt,...)
-- print(arg.n)
-- return io.write(string.format(fmt,unpack({...})))
--end
--s,e = string.find("dubowen","bowe")
--print(fwrite(1,s,e))
--============================================================
--局部变量测试
--============================================================
function test_func()
local a
local f = function ()
a = a + 1
return a
end
a = 10 --a要么为全局变量,要么先声明
return f
end
testFunc = test_func()
print(testFunc())
print(testFunc())
--function myFunc()
-- print("execute outer myFunc")
--end
function test_func2()
local myFunc
local f = function ()
myFunc()
end
--myFunc要想被f访问到,要么声明成全局(可在函数外声明,也可以赋值给一个全局变量)
--要么是局部的,但是不必须先声明
myFunc = function ()
print("execute myFunc")
end
return f
end
local testFunc2 = test_func2()
testFunc2()
--============================================================
--变长参数
--============================================================
--使用变长参数完成对nunmber列表求和
local function my_sum(...)
local sum = 0
for i,v in ipairs(...) do
sum = sum + v
end
return sum
end
print(my_sum{1,1,2,nil,6,8}) -->11 说明nil后面的6,8都没有遍历到
--如果变长参数中故意传入nil
--那么就要使用select函数来访问变长参数列表了.
--select得以参数如果传入的是整数n, 返回的是第i个元素开始到最后一个元素结束的列表
--如果传入的是"#",则返回参数列表的总长度
print("=============")
function my_sum2(...)
local sum = 0
local arg
for i=1,select('#',...) do
--从输出结果可见,select(i,...) 返回的是第i个元素开始到最后一个元素结束的列表
--print(select(i,...)) -->2 4 6 nil 5 8
arg = select(i,...) --返回多个数
if arg then --只取第一个返回值
sum = sum + arg
end
end
return sum
end
print(my_sum2(2,4,6,nil,5,8)) -->25 说明nil后边的值都遍历到了
local tinsert = table.insert
local function my_append(x, ...)
local t = {...}
tinsert(t, x)
return unpack(t)
end
local function my_append2(x, arg1, ...)
print("my_append2",x,arg1)
if arg1 == nil then
return x
else
return arg1, my_append2(x, ...)
end
end
local function my_print(...)
-- ...:wangliang arg:table: 0x7fd943e14c30 type(...): string type(arg):table
print("...:" .. tostring(...) .. " arg:" .. tostring(arg) .. " type(...): " .. type(...) .. " type(arg):" ..type(arg))
--#arg:0 #...:9
print("#arg:" .. (#arg) .. " #...:" ..(#...) )
--print(unpack(arg))
-- print(arg[-1],arg[-2])
print("------arg不知道是啥玩意-----")
for i,v in pairs(arg) do
print(i,v)
-- -1 io.stdout:setvbuf('no')
-- -3 jnlua
-- -2 -e
-- 0 /Users/wangliang/adtworkspace/LuaDemo/src/Test.lua
end
print("-----------")
print(tostring(...)) --取第一个
print(...) --取所有
print("参数的个数是:" .. #{...}) --#{...}表示参数的个数
print("pre", ...) --pre wangliang liang hello 12
print(... , "post") --wangliang post
print(my_append2("post",...)) --wangliang liang hello 12 post
print(my_append("post",...)) --wangliang liang hello 12 post
end
my_print("wangliang","liang", "hello",12)
print("==============")
local arr = {n=10;1,2}
print(#arr) --2
print("==============")
--============================================================
--链表
--============================================================
--table 特性
-- 使用table生成正序和倒序的链表
-- 使用table生成链表
local list = nil
local file = io.open("/Users/wangliang/adtworkspace/LuaDemo/src/readme","r") -->打开本本件
print("file" , file)
local last = nil
--将本文件按行顺序读入list中
local lineCount=0
for line in file:lines() do
lineCount = lineCount + 1
local current = {next = nil, value = line}
-- last must not be a local var
if last then
last.next = current
else
last = current
end
list = list or last
last = current
print(lineCount .. " " .. line .. " " .. "" .. tostring(list) .. " " .. tostring(list.next) .. " " ..tostring(last))
end
file:close() -- 关闭文件
print(list)
--print(list.next)
--print(list.next.next)
-- 输出list
local l = list
while l do
print(l.value)
l = l.next
end
local path = "/Users/wangliang/adtworkspace/LuaDemo/src/readme"
---- 以下是按行倒序的方法
print("以下是按行倒序输出文件:\n")
local file = io.open(path,"r") -->打开本本件
list = nil --清空list之前的内容
for line in file:lines() do
list = {next = list, value = line}
end
file:close() -- 关闭文件
-- 输出list
local l = list
while l do
print(l.value)
l = l.next
end
MyObject = {}
function MyObject:new (o)
o = o or {} -- create object if user does not provide one
setmetatable(o, self)
self.__index = self
return o
end
function MyObject:method1()
print("method1 self is " .. tostring(self) .. " " .. tostring(MyObject))
self:method2()
end
function MyObject:method2()
print("method2 self is " .. tostring(self) .. " " .. tostring(MyObject))
end
SelfObject = {a = 10}
print("SelfObject is " .. tostring(SelfObject))
--MyObject.method1(SelfObject)
--MyObjectNew继承自MyObject
local MyObjectNew = MyObject:new()
print("MyObjectNew is " .. tostring(MyObjectNew))
MyObjectNew:method1()
|
NewShipType = StartShipConfig()
NewShipType.displayedName="$1702"
NewShipType.sobDescription="$1703"
NewShipType.maxhealth=getShipNum(NewShipType, "maxhealth", 1000)
NewShipType.regentime=300
NewShipType.minRegenTime=220
NewShipType.sideArmourDamage=1.2
NewShipType.rearArmourDamage=1.4
setTacticsMults(NewShipType, "ENGINEACCEL", 1.10, 0.90, 1.0)
setTacticsMults(NewShipType, "THRUSTERACCEL", 1.10, 0.90, 1.0)
setTacticsMults(NewShipType, "ROTATION", 0.95, 1.05, 1.0)
setTacticsMults(NewShipType, "ROTATIONACCEL", 1.10, 0.90, 1.0)
setTacticsMults(NewShipType, "FIRERATE", 0.98, 1.02, 1.0)
NewShipType.isTransferable=0
NewShipType.defaultROE="Defensive"
NewShipType.defaultStance="Aggressive"
NewShipType.mass=40
NewShipType.collisionMultiplier=1
NewShipType.thrusterMaxSpeed=230
NewShipType.mainEngineMaxSpeed=230
NewShipType.rotationMaxSpeed=171
NewShipType.thrusterAccelTime=3
NewShipType.thrusterBrakeTime=1
NewShipType.mainEngineAccelTime=3
NewShipType.mainEngineBrakeTime=1
NewShipType.rotationAccelTime=0.6
NewShipType.rotationBrakeTime=0.6
NewShipType.thrusterUsage=1
NewShipType.accelerationAngle=90
NewShipType.mirrorAngle=0
NewShipType.secondaryTurnAngle=0
NewShipType.maxBankingAmount=85
NewShipType.descendPitch=0
NewShipType.goalReachEpsilon=5
NewShipType.slideMoveRange=0
NewShipType.controllerType="Ship"
NewShipType.tumbleStaticX=0
NewShipType.tumbleStaticY=0
NewShipType.tumbleStaticZ=0
NewShipType.tumbleDynamicX=0
NewShipType.tumbleDynamicY=0
NewShipType.tumbleDynamicZ=0
NewShipType.tumbleSpecialDynamicX=0
NewShipType.tumbleSpecialDynamicY=0
NewShipType.tumbleSpecialDynamicZ=0
NewShipType.relativeMoveFactor=6
NewShipType.swayUpdateTime=2
NewShipType.swayOffsetRandomX=10
NewShipType.swayOffsetRandomY=10
NewShipType.swayOffsetRandomZ=10
NewShipType.swayBobbingFactor=0.2
NewShipType.swayRotateFactor=0.2
NewShipType.dustCloudDamageTime=160
NewShipType.nebulaDamageTime=40
NewShipType.MinimalFamilyToFindPathAround="SuperCap"
NewShipType.BuildFamily="Mover_Hgn"
NewShipType.AttackFamily="Corvette"
NewShipType.DockFamily="Mover"
NewShipType.AvoidanceFamily="Strikecraft"
NewShipType.DisplayFamily="Corvette"
NewShipType.AutoFormationFamily="Fighter"
NewShipType.CollisionFamily="Small"
NewShipType.ArmourFamily="MoverArmour"
setSupplyValue(NewShipType, "SPMovers", 1.0)
setSupplyValue(NewShipType, "LayoutFighter", 1.0)
NewShipType.agileFlight=1
NewShipType.homingDistance=2000
NewShipType.homingDelay=0.5
NewShipType.fighterValue=0
NewShipType.corvetteValue=0
NewShipType.frigateValue=0
NewShipType.neutralValue=4
NewShipType.antiFighterValue=0
NewShipType.antiCorvetteValue=0
NewShipType.antiFrigateValue=0
NewShipType.totalValue=0
NewShipType.buildCost=200
NewShipType.buildTime=20
NewShipType.buildPriorityOrder=30
NewShipType.retaliationRange=4800
NewShipType.retaliationDistanceFromGoal=160
NewShipType.visualRange=6000
NewShipType.prmSensorRange=6000
NewShipType.secSensorRange=6000
NewShipType.detectionStrength=1
NewShipType.TOIcon="Square"
NewShipType.TOScale=1
NewShipType.TODistanceFade0=7000
NewShipType.TODistanceDisappear0=5000
NewShipType.TODistanceFade1=2500
NewShipType.TODistanceDisappear1=2000
NewShipType.TODistanceFade2=12000
NewShipType.TODistanceDisappear2=35000
NewShipType.TOGroupScale=0.0005
NewShipType.TOGroupMergeSize=6000
NewShipType.mouseOverMinFadeSize=0.0002
NewShipType.mouseOverMaxFadeSize=10000
NewShipType.healthBarStyle=0
NewShipType.nlips=0.0005
NewShipType.nlipsRange=6000
NewShipType.nlipsFar=0.0002
NewShipType.nlipsFarRange=10000
NewShipType.SMRepresentation="HardDot"
NewShipType.meshRenderLimit=11000
NewShipType.dotRenderLimit=10
NewShipType.visibleInSecondary=1
NewShipType.goblinsStartFade=410
NewShipType.goblinsOff=410
NewShipType.minimumZoomFactor=0.77
NewShipType.selectionLimit=150000
NewShipType.preciseATILimit=0
NewShipType.selectionPriority=75
NewShipType.militaryUnit=1
NewShipType.alternativeHyperspaceV="hyperspace_gate_kpr"
NewShipType.alternativeHyperspaceA="etg/special/SPECIAL_ABILITIES_HYPERSPACE_IN"
NewShipType.alternativeHyperspaceTime=12.5
addAbility(NewShipType,"MoveCommand",1,0);
addAbility(NewShipType,"CanDock",1,1);
NewShipType.dockTimeBetweenTwoFormations=1
NewShipType.dockTimeBeforeStart=2
NewShipType.dockNrOfShipsInDockFormation=1
NewShipType.dockFormation="delta"
NewShipType.queueFormation="dockline"
NewShipType.dontDockWithOtherRaceShips=0
NewShipType.ignoreRaceWhenDocking=1
addAbility(NewShipType,"CanLaunch");
NewShipType.launchTimeBetweenTwoFormations=1
NewShipType.launchTimeBeforeStart=2
NewShipType.launchNrOfShipsInDockFormation=1
NewShipType.launchFormation="delta"
addAbility(NewShipType,"ParadeCommand",1);
addAbility(NewShipType,"WaypointMove");
if hypBool == 1 then
addAbility(NewShipType,"HyperSpaceCommand",0,1,100,600,10,15);
end
addAbility(NewShipType,"CanAttack",1,1,1,0,0.35,1,"Corvette, Fighter, Frigate,Mothership, SmallCapitalShip, BigCapitalShip","FlyBy_Interceptor_vs_Frigate",{Fighter="Flyby_Interceptor_vs_Fighter"},{SubSystem="TopAttack_Interceptor_vs_Subsystem"},{SmallCapitalShip="Flyby_Interceptor_vs_CapShip"},{BigCapitalShip="Flyby_Interceptor_vs_CapShip"},{Mothership="Flyby_Bomber_vs_Mothership"},{ResourceLarge="Flyby_Interceptor_vs_ResourceLarge"});
addAbility(NewShipType,"GuardCommand",1,3000,500);
if hypBool == 1 then
addAbility(NewShipType,"HyperspaceViaGateCommand",1,3,1,0.3);
end
LoadSharedModel(NewShipType,"Kpr_Mover");
StartShipWeaponConfig(NewShipType,"Kpr_KineticDriver","Weapon_KineticDriver","Weapon_KineticDriver");
addShield(NewShipType,"EMP",75,20);
AddShipMultiplier(NewShipType,"NebulaSensitivity","ThisShipOnly","Linear",0,0,0);
AddShipMultiplier(NewShipType,"DustCloudSensitivity","ThisShipOnly","Linear",0,0,0);
addAbility(NewShipType,"RetireAbility",1,0);
NewShipType.battleScarCoverage=1
NewShipType.sobDieTime=0.1
NewShipType.sobSpecialDieTime=1
NewShipType.specialDeathSpeed=40
NewShipType.chanceOfSpecialDeath=0
NewShipType.deadSobFadeTime=1
setEngineTrail(NewShipType,0,3.4,"trail_ribbon.tga",0.1,0.1,0.025,2);
setEngineTrail(NewShipType,1,3.4,"trail_ribbon.tga",0.1,0.1,0.025,2);
setEngineBurn(NewShipType,17,0.5,1,12,0,0.7,0.1,35);
loadShipPatchList(NewShipType,"data:sound/sfx/ship/misc/",0,"Engines/KeeperMoverEng","",1,"Ambience/KeeperMoverAmb","");
|
PauseState = Class {__includes = BaseState}
function PauseState:enter(params)
self.level = params.level
end
function PauseState:update(dt)
if love.keyboard.wasPressed('return') then
love.event.quit()
end
if love.keyboard.wasPressed('escape') then
gStateMachine:change('play', {level = self.level})
end
end
function PauseState:render()
-- Render the level, but don't update it
if self.level ~= nil then
self.level:render()
end
love.graphics.setColor(0, 0, 0, 0.6)
love.graphics.rectangle('fill', 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT)
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setFont(gFonts['large'])
love.graphics.printf('Paused!', 0, 50, WINDOW_WIDTH, 'center')
love.graphics.setFont(gFonts['medium'])
love.graphics.printf(
"Hit 'escape' again to resume,\n'enter' to exit.",
0,
WINDOW_HEIGHT / 2 - 50,
WINDOW_WIDTH,
'center'
)
end
|
dofile"setup.lua"
test("+eth", function()
local n = net.init()
local datat={payload="xxx"}
local etht = {src="01:02:03:01:02:03", dst="04:05:06:04:05:06"}
local pkt = "0405060405060102030102030800787878"
local dtag = n:data(datat)
local etag = n:eth(etht)
local b = n:block()
dump(n)
assert(pkt == h(b), h(b))
etht.ptag = etag
datat.ptag = dtag
local dtag = n:data(datat)
local etag = n:eth(etht)
local b = n:block()
dump(n)
assert(pkt == h(b), h(b))
n:clear()
etht.ptag = nil
datat.ptag = nil
etht.payload = datat.payload
local etag = n:eth(etht)
local b = n:block()
dump(n)
assert(pkt == h(b), h(b))
etht.ptag = etag
local _ = n:eth(etht)
local b = n:block()
dump(n)
assert(_ == etag, _)
assert(pkt == h(b), h(b))
n:clear()
end)
|
local Receptor = class('Receptor', Base):include(Stateful)
function Receptor:initialize(x, y, width, height, rotation, red, green, blue)
Base.initialize(self)
self.x = x
self.y = y
self.rotation = rotation
self.width = width
self.height = height
self.r = red
self.g = green
self.b = blue
self.charge_ratio = 0
self.body = love.physics.newBody(game.world, x, y)
local shape = love.physics.newCircleShape(self.width / 2)
self.fixture = love.physics.newFixture(self.body, shape)
self.fixture:setUserData(self)
self.sprites = require('images.receptor')
self.body:setAngle(rotation)
end
function Receptor:draw()
g.push('all')
g.translate(self.x, self.y)
g.rotate(self.rotation)
-- g.draw(self.mesh)
g.setColor(self.r, self.g, self.b)
g.draw(self.sprites.texture, self.sprites.quads['receptor-base'], 0, 0, 0, 1, 1, self.width / 2, self.height / 2)
g.setColor(255, 255, 255)
g.draw(self.sprites.texture, self.sprites.quads['receptor-sprite'], 0, 0, 0, 1, 1, self.width / 2, self.height / 2)
local frame_index = math.ceil(self.charge_ratio * 5)
if frame_index > 0 then
g.draw(self.sprites.texture, self.sprites.quads['receptor-progress-' .. frame_index], 0, 0, 0, 1, 1, self.width / 2, self.height / 2)
end
-- g.setColor(self.r, self.g, self.b, self.charge_ratio * 255)
-- g.ellipse('fill', 0, 0, self.width, self.height)
g.pop()
end
local function equalish(a, b)
return math.ceil(a) == math.ceil(b)
end
function Receptor:charge(dt, r, g, b)
if equalish(r, self.r) and equalish(g, self.g) and equalish(b, self.b) then
self.charge_ratio = 1
end
-- local color = self.charge_ratio * 255
-- self.mesh:setVertexAttribute(1, 3, color, color, color)
-- self.mesh:setVertexAttribute(2, 3, color, color, color)
end
function Receptor:setRotation(phi)
self.rotation = phi
self.body:setAngle(phi)
end
return Receptor
|
modifier_responses = modifier_responses or class({})
-- Hidden, permanent, not purgable
function modifier_responses:IsHidden() return false end
function modifier_responses:IsPurgable() return false end
function modifier_responses:IsPermanent() return true end
function modifier_responses:CheckState() return {
[MODIFIER_STATE_INVULNERABLE] = true,
[MODIFIER_STATE_UNSELECTABLE] = true,
[MODIFIER_STATE_NO_HEALTH_BAR] = true,
[MODIFIER_STATE_NOT_ON_MINIMAP] = true,
[MODIFIER_STATE_NO_UNIT_COLLISION] = true,
[MODIFIER_STATE_OUT_OF_GAME] = true
} end
function modifier_responses:DeclareFunctions() return {
MODIFIER_EVENT_ON_ORDER,
MODIFIER_EVENT_ON_DEATH,
MODIFIER_EVENT_ON_TAKEDAMAGE,
MODIFIER_EVENT_ON_ABILITY_EXECUTED,
} end
function modifier_responses:OnOrder(event) self.FireOutput('OnOrder', event) end
function modifier_responses:OnDeath(event) self.FireOutput('OnUnitDeath', event) end
function modifier_responses:OnTakeDamage(event) self.FireOutput('OnTakeDamage', event) end
function modifier_responses:OnAbilityExecuted(event) self.FireOutput('OnAbilityExecuted', event) end
|
-- Copyright (C) 2016-2018 Draios Inc dba Sysdig.
--
-- This file is part of falco.
--
-- 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 mod = {}
local outputs = {}
function mod.stdout(priority, priority_num, msg, options)
if options.buffered == 0 then
io.stdout:setvbuf 'no'
end
print (msg)
end
function mod.stdout_cleanup()
io.stdout:flush()
end
-- Note: not actually closing/reopening stdout
function mod.stdout_reopen(options)
end
function mod.file_validate(options)
if (not type(options.filename) == 'string') then
error("File output needs to be configured with a valid filename")
end
local file, err = io.open(options.filename, "a+")
if file == nil then
error("Error with file output: "..err)
end
file:close()
end
function mod.file_open(options)
if ffile == nil then
ffile = io.open(options.filename, "a+")
if options.buffered == 0 then
ffile:setvbuf 'no'
end
end
end
function mod.file(priority, priority_num, msg, options)
if options.keep_alive == "true" then
mod.file_open(options)
else
ffile = io.open(options.filename, "a+")
end
ffile:write(msg, "\n")
if options.keep_alive == nil or
options.keep_alive ~= "true" then
ffile:close()
ffile = nil
end
end
function mod.file_cleanup()
if ffile ~= nil then
ffile:flush()
ffile:close()
ffile = nil
end
end
function mod.file_reopen(options)
if options.keep_alive == "true" then
mod.file_cleanup()
mod.file_open(options)
end
end
function mod.syslog(priority, priority_num, msg, options)
falco.syslog(priority_num, msg)
end
function mod.syslog_cleanup()
end
function mod.syslog_reopen()
end
function mod.program_open(options)
if pfile == nil then
pfile = io.popen(options.program, "w")
if options.buffered == 0 then
pfile:setvbuf 'no'
end
end
end
function mod.program(priority, priority_num, msg, options)
-- XXX Ideally we'd check that the program ran
-- successfully. However, the luajit we're using returns true even
-- when the shell can't run the program.
-- Note: options are all strings
if options.keep_alive == "true" then
mod.program_open(options)
else
pfile = io.popen(options.program, "w")
end
pfile:write(msg, "\n")
if options.keep_alive == nil or
options.keep_alive ~= "true" then
pfile:close()
pfile = nil
end
end
function mod.program_cleanup()
if pfile ~= nil then
pfile:flush()
pfile:close()
pfile = nil
end
end
function mod.program_reopen(options)
if options.keep_alive == "true" then
mod.program_cleanup()
mod.program_open(options)
end
end
function output_event(event, rule, source, priority, priority_num, format)
-- If format starts with a *, remove it, as we're adding our own
-- prefix here.
if format:sub(1,1) == "*" then
format = format:sub(2)
end
if source == "syscall" then
format = "*%evt.time: "..priority.." "..format
else
format = "*%jevt.time: "..priority.." "..format
end
msg = formats.format_event(event, rule, source, priority, format)
for index,o in ipairs(outputs) do
o.output(priority, priority_num, msg, o.options)
end
end
function output_cleanup()
formats.free_formatters()
for index,o in ipairs(outputs) do
o.cleanup()
end
end
function output_reopen()
for index,o in ipairs(outputs) do
o.reopen(o.options)
end
end
function add_output(output_name, buffered, options)
if not (type(mod[output_name]) == 'function') then
error("rule_loader.add_output(): invalid output_name: "..output_name)
end
-- outputs can optionally define a validation function so that we don't
-- find out at runtime (when an event finally matches a rule!) that the options are invalid
if (type(mod[output_name.."_validate"]) == 'function') then
mod[output_name.."_validate"](options)
end
if options == nil then
options = {}
end
options.buffered = buffered
table.insert(outputs, {output = mod[output_name],
cleanup = mod[output_name.."_cleanup"],
reopen = mod[output_name.."_reopen"],
options=options})
end
return mod
|
local api = vim.api
local M = {
funcs = {
g = {},
b = {},
},
}
function M.create_autogrp(autogrp)
api.nvim_command('augroup ' .. autogrp .. ' | autocmd! | autogrp end')
end
function M.get_autocmd(autocmd)
vim.validate { autocmd = { autocmd, 'table' } }
if not autocmd.event and not autocmd.group then
vim.notify(
'Missing arguments!! get_autocmd need event or group attribbute',
'ERROR',
{ title = 'Nvim Autocmd' }
)
return false
end
local autocmd_str = { 'autocmd' }
autocmd_str[#autocmd_str + 1] = autocmd.group ~= nil and autocmd.group or nil
autocmd_str[#autocmd_str + 1] = autocmd.event ~= nil and autocmd.event or nil
local ok, _ = pcall(api.nvim_exec, table.concat(autocmd_str, ' '), true)
if not ok then
return nil
end
return true
-- TODO: Work in parse autocmd output
end
function M.has_autocmd(autocmd)
return M.get_autocmd(autocmd) ~= nil
end
function M.set_autocmd(autocmd)
vim.validate { autocmd = { autocmd, 'table' } }
if not autocmd.event then
vim.notify('Missing arguments!! set_autocmd need event attribbute', 'ERROR', { title = 'Nvim Autocmd' })
return false
end
local autocmd_str = { 'autocmd' }
local once = autocmd.once ~= nil and '++once' or nil
local nested = autocmd.nested ~= nil and '++nested' or nil
local cmd = autocmd.cmd ~= nil and autocmd.cmd or nil
local event = autocmd.event ~= nil and autocmd.event or nil
local group = autocmd.group ~= nil and autocmd.group or nil
local clean = autocmd.clean ~= nil and autocmd.clean or nil
local pattern = autocmd.pattern ~= nil and autocmd.pattern or nil
if group ~= nil then
autocmd_str[#autocmd_str + 1] = group
end
if event ~= nil then
if type(event) == 'table' then
event = table.concat(event, ',')
end
autocmd_str[#autocmd_str + 1] = event
end
if pattern ~= nil then
if type(pattern) == 'table' then
pattern = table.concat(pattern, ',')
end
autocmd_str[#autocmd_str + 1] = pattern
end
if once ~= nil then
autocmd_str[#autocmd_str + 1] = once
end
if nested ~= nil then
autocmd_str[#autocmd_str + 1] = nested
end
if cmd == nil then
autocmd_str[1] = 'autocmd!'
else
autocmd_str[#autocmd_str + 1] = cmd
end
if clean ~= nil and group ~= nil then
M.create_autogrp(group)
elseif group ~= nil and not M.has_autocmd { group = group } then
M.create_autogrp(group)
end
api.nvim_command(table.concat(autocmd_str, ' '))
end
return M
|
--@name MusicPlayer
--@author Sparky
--@model models/props_lab/citizenradio.mdl
if SERVER then
hook.add("PlayerSay", "Hey", function(ply, txt)
if ply==owner() and txt:sub(1, 6)=="!song " then
net.start("playSong")
net.writeString(txt:sub(7))
net.send()
return ""
end
end)
else
local function loadSong(songURL)
if song then song:stop() end
bass.loadURL(songURL, "3d noblock", function(snd, err, errtxt)
if snd then
song = snd
snd:setFade(500, 100000)
snd:setVolume(2)
pcall(snd.setLooping, snd, true) -- pcall in case of audio stream
hook.add("think", "snd", function()
if isValid(snd) and isValid(chip()) then
snd:setPos(chip():getPos())
end
end)
else
print(errtxt)
end
end)
url = nil
end
net.receive("playSong", function(len)
url = net.readString()
if not hasPermission("bass.loadURL", url) then
print("Press E to grant URL sound permission")
return
end
loadSong(url)
end)
setupPermissionRequest({"bass.loadURL"}, "URL sounds from external sites", true)
hook.add("permissionrequest", "permission", function()
if url and hasPermission("bass.loadURL", url) then
loadSong(url)
end
end)
end
|
local _, private = ...
--[[ Lua Globals ]]
-- luacheck: globals
--[[ Core ]]
local Aurora = private.Aurora
local Base = Aurora.Base
local Skin = Aurora.Skin
--do --[[ FrameXML\PetitionFrame.lua ]]
--end
--do --[[ FrameXML\PetitionFrame.xml ]]
--end
function private.FrameXML.PetitionFrame()
local PetitionFrame = _G.PetitionFrame
if private.isRetail then
Skin.ButtonFrameTemplate(_G.PetitionFrame)
-- BlizzWTF: The portrait in the template is not being used.
local portrait, bg, scrollTop, scrollBottom, scrollMiddle, scrollUp, scrollDown = _G.select(18, _G.PetitionFrame:GetRegions())
portrait:Hide()
bg:Hide()
scrollTop:Hide()
scrollBottom:Hide()
scrollMiddle:Hide()
scrollUp:Hide()
scrollDown:Hide()
else
Base.SetBackdrop(PetitionFrame)
PetitionFrame:SetBackdropOption("offsets", {
left = 14,
right = 34,
top = 14,
bottom = 75,
})
local portrait, tl, tr, bl, br = PetitionFrame:GetRegions()
portrait:Hide()
tl:Hide()
tr:Hide()
bl:Hide()
br:Hide()
end
_G.PetitionFrameCharterTitle:SetPoint("TOPLEFT", 8, -private.FRAME_TITLE_HEIGHT)
_G.PetitionFrameCharterTitle:SetTextColor(1, 1, 1)
_G.PetitionFrameCharterTitle:SetShadowColor(0, 0, 0)
_G.PetitionFrameMasterTitle:SetTextColor(1, 1, 1)
_G.PetitionFrameMasterTitle:SetShadowColor(0, 0, 0)
_G.PetitionFrameMemberTitle:SetTextColor(1, 1, 1)
_G.PetitionFrameMemberTitle:SetShadowColor(0, 0, 0)
_G.PetitionFrameInstructions:SetPoint("RIGHT", -8, 0)
if private.isRetail then
-- BlizzWTF: This should use the title text included in the template
_G.PetitionFrameNpcNameText:SetAllPoints(_G.PetitionFrame.TitleText)
else
local bg = PetitionFrame:GetBackdropTexture("bg")
_G.PetitionFrameNpcNameText:ClearAllPoints()
_G.PetitionFrameNpcNameText:SetPoint("TOPLEFT", bg)
_G.PetitionFrameNpcNameText:SetPoint("BOTTOMRIGHT", bg, "TOPRIGHT", 0, -private.FRAME_TITLE_HEIGHT)
end
Skin.UIPanelButtonTemplate(_G.PetitionFrameCancelButton)
_G.PetitionFrameCancelButton:SetPoint("BOTTOMRIGHT", -4, 4)
Skin.UIPanelButtonTemplate(_G.PetitionFrameSignButton)
Skin.UIPanelButtonTemplate(_G.PetitionFrameRequestButton)
if private.isClassic then
Skin.UIPanelCloseButton(_G.PetitionFrameCloseButton)
end
Skin.UIPanelButtonTemplate(_G.PetitionFrameRenameButton)
_G.PetitionFrameRenameButton:ClearAllPoints()
_G.PetitionFrameRenameButton:SetPoint("TOPLEFT", _G.PetitionFrameRequestButton, "TOPRIGHT", 1, 0)
_G.PetitionFrameRenameButton:SetPoint("BOTTOMRIGHT", _G.PetitionFrameCancelButton, "BOTTOMLEFT", -1, 0)
end
|
-- The spin opponent phase
local opponentPhaseSpin = {}
opponentPhaseSpin.__index = opponentPhaseSpin
opponentPhaseSpin.DEFAULT_BULLET_COOLDOWN = 0.3
opponentPhaseSpin.DEFAULT_BULLET_SPEED = 750
opponentPhaseSpin.NUM_LIVES = 4
opponentPhaseSpin.INTRO_TEXT = "SHPEEEEN"
--------------------
-- MAIN CALLBACKS --
--------------------
function opponentPhaseSpin.new()
local self = classes.opponentBase.new(opponentPhaseSpin)
-- Randomize direction to one of 8 directions
local r = love.math.random()
if r <= 0.5 then
self.xspeed = 400
self.yspeed = 200
else
self.xspeed = 200
self.yspeed = 400
end
if r % 0.5 <= 0.25 then self.xspeed = -self.xspeed end
if r % 0.25 <= 0.125 then self.yspeed = -self.yspeed end
self.angspeed = 2.4 * math.pi
return self
end
function opponentPhaseSpin:update(dt)
-- Call superclass method
classes.opponentBase.update(self, dt)
if self.stunned then return end
self.x = self.x + self.xspeed * dt
if self.x < self.radius then
self.x = self.radius
self.xspeed = math.abs(self.xspeed)
elseif self.x >= ARENA_WIDTH - self.radius then
self.x = ARENA_WIDTH - self.radius - 1
self.xspeed = -math.abs(self.xspeed)
end
self.y = self.y + self.yspeed * dt
if self.y < self.radius then
self.y = self.radius
self.yspeed = math.abs(self.yspeed)
elseif self.y >= ARENA_HEIGHT - self.radius then
self.y = ARENA_HEIGHT - self.radius - 1
self.yspeed = -math.abs(self.yspeed)
end
self.angle = self.angle + self.angspeed * dt
end
function opponentPhaseSpin:draw()
-- Optional - draw default opponent
classes.opponentBase.draw(self)
end
function opponentPhaseSpin:onDestroy()
-- Call default superclass method
classes.opponentBase.onDestroy(self)
end
classes.opponentPhaseSpin = opponentPhaseSpin
|
--animationMotionHandlerconverts continuous movement
--into pixel-y movement.
local animationMotionHandler = {}
animationMotionHandler.__index = animationMotionHandler
function animationMotionHandler.create(timer)
local proto = {}
setmetatable(proto, animationMotionHandler)
proto.timer = timer
proto.x = nil
proto.y = nil
--class variables here
return proto
end
function animationMotionHandler:init(x, y)
self.x = x
self.y = y
end
function animationMotionHandler:update(time, x, y)
if self.timer:update(time) == true then
self.x = math.floor(x)
self.y = math.floor(y)
end
end
return animationMotionHandler
|
local class = require "libs.middleclass"
Deck = class("Deck")
function Deck:initialize()
print "Deck:initialize()"
self.cards = {}
for i = 1, 6 do
local temp_card = Card:new()
temp_card.name = "Overtake +2"
table.insert(self.cards, temp_card)
end
for i = 1, 12 do
local temp_card = Card:new()
temp_card.name = "Overtake +3"
table.insert(self.cards, temp_card)
end
for i = 1, 6 do
local temp_card = Card:new()
temp_card.name = "Overtake +4"
table.insert(self.cards, temp_card)
end
for i = 1, 3 do
local temp_card = Card:new()
temp_card.name = "Wrong Line"
table.insert(self.cards, temp_card)
end
for i = 1, 3 do
local temp_card = Card:new()
temp_card.name = "Off Circuit"
table.insert(self.cards, temp_card)
end
for i = 1, 3 do
local temp_card = Card:new()
temp_card.name = "Lose Control"
table.insert(self.cards, temp_card)
end
for i = 1, 4 do
local temp_card = Card:new()
temp_card.name = "Tailender Turbo"
table.insert(self.cards, temp_card)
end
for i = 1, 8 do
local temp_card = Card:new()
temp_card.name = "Pit Stop"
table.insert(self.cards, temp_card)
end
end
function Deck:shuffle()
shuffle(self.cards)
end
function Deck:draw_card()
return table.remove(self.cards)
end
function Deck:__tostring()
local temp_string = ""
for i = 1, #self.cards do
temp_string = temp_string .. tostring(i) .. "> " .. self.cards[i].name .. "\n"
end
return temp_string
end
|
local sc = table.deepcopy(data.raw["arithmetic-combinator"]["arithmetic-combinator"])
sc.name = "statsd-combinator"
sc.icon = "__factorystatsd__/graphics/icons/statsd-combinator.png"
sc.icon_mipmaps = 1
sc.icon_size = 64
sc.minable.result = "statsd-combinator"
sc.active_energy_usage = "100KW"
sc.corpse = "statsd-combinator-remnants"
sc.output_connection_bounding_box = {
{-0.5, -0.5},
{0.5, -0.5},
}
sc.sprites = {
east = {
layers = {
{
filename = "__factorystatsd__/graphics/entity/statsd-combinator/statsd-combinator.png",
frame_count = 1,
height = 64,
hr_version = {
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-statsd-combinator.png",
frame_count = 1,
height = 124,
priority = "high",
scale = 0.5,
shift = {0.015625, 0.234375},
width = 144,
x = 144,
y = 0
},
priority = "high",
scale = 1,
shift = {0.03125, 0.25},
width = 74,
x = 74,
y = 0
},
{
draw_as_shadow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/statsd-combinator-shadow.png",
frame_count = 1,
height = 78,
hr_version = {
draw_as_shadow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-statsd-combinator-shadow.png",
frame_count = 1,
height = 156,
priority = "high",
scale = 0.5,
shift = {0.421875, 0.765625},
width = 148,
x = 148,
y = 0
},
priority = "high",
scale = 1,
shift = {0.4375, 0.75},
width = 76,
x = 76,
y = 0
}
}
},
north = {
layers = {
{
filename = "__factorystatsd__/graphics/entity/statsd-combinator/statsd-combinator.png",
frame_count = 1,
height = 64,
hr_version = {
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-statsd-combinator.png",
frame_count = 1,
height = 124,
priority = "high",
scale = 0.5,
shift = {0.015625, 0.234375},
width = 144,
x = 0,
y = 0
},
priority = "high",
scale = 1,
shift = {0.03125, 0.25},
width = 74,
x = 0,
y = 0
},
{
draw_as_shadow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/statsd-combinator-shadow.png",
frame_count = 1,
height = 78,
hr_version = {
draw_as_shadow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-statsd-combinator-shadow.png",
frame_count = 1,
height = 156,
priority = "high",
scale = 0.5,
shift = {0.421875, 0.765625},
width = 148,
x = 0,
y = 0
},
priority = "high",
scale = 1,
shift = {0.4375, 0.75},
width = 76,
x = 0,
y = 0
}
}
},
south = {
layers = {
{
filename = "__factorystatsd__/graphics/entity/statsd-combinator/statsd-combinator.png",
frame_count = 1,
height = 64,
hr_version = {
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-statsd-combinator.png",
frame_count = 1,
height = 124,
priority = "high",
scale = 0.5,
shift = {0.015625, 0.234375},
width = 144,
x = 288,
y = 0
},
priority = "high",
scale = 1,
shift = {0.03125, 0.25},
width = 74,
x = 148,
y = 0
},
{
draw_as_shadow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/statsd-combinator-shadow.png",
frame_count = 1,
height = 78,
hr_version = {
draw_as_shadow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-statsd-combinator-shadow.png",
frame_count = 1,
height = 156,
priority = "high",
scale = 0.5,
shift = {0.421875, 0.765625},
width = 148,
x = 296,
y = 0
},
priority = "high",
scale = 1,
shift = {0.4375, 0.75},
width = 76,
x = 152,
y = 0
}
}
},
west = {
layers = {
{
filename = "__factorystatsd__/graphics/entity/statsd-combinator/statsd-combinator.png",
frame_count = 1,
height = 64,
hr_version = {
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-statsd-combinator.png",
frame_count = 1,
height = 124,
priority = "high",
scale = 0.5,
shift = {0.015625, 0.234375},
width = 144,
x = 432,
y = 0
},
priority = "high",
scale = 1,
shift = {0.03125, 0.25},
width = 74,
x = 222,
y = 0
},
{
draw_as_shadow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/statsd-combinator-shadow.png",
frame_count = 1,
height = 78,
hr_version = {
draw_as_shadow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-statsd-combinator-shadow.png",
frame_count = 1,
height = 156,
priority = "high",
scale = 0.5,
shift = {0.421875, 0.765625},
width = 148,
x = 444,
y = 0
},
priority = "high",
scale = 1,
shift = {0.4375, 0.75},
width = 76,
x = 228,
y = 0
}
}
}
}
sc.multiply_symbol_sprites = {
east = {
draw_as_glow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/display.png",
height = 11,
hr_version = {
draw_as_glow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-display.png",
height = 22,
scale = 0.5,
shift = {
0,
-0.328125
},
width = 30,
},
shift = {
0,
-0.328125
},
width = 15,
},
north = {
draw_as_glow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/display.png",
height = 11,
hr_version = {
draw_as_glow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-display.png",
height = 22,
scale = 0.5,
shift = {
0,
-0.140625
},
width = 30,
},
shift = {
0,
-0.140625
},
width = 15,
},
south = {
draw_as_glow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/display.png",
height = 11,
hr_version = {
draw_as_glow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-display.png",
height = 22,
scale = 0.5,
shift = {
0,
-0.140625
},
width = 30,
},
shift = {
0,
-0.140625
},
width = 15,
},
west = {
draw_as_glow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/display.png",
height = 11,
hr_version = {
draw_as_glow = true,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-display.png",
height = 22,
scale = 0.5,
shift = {
0,
-0.328125
},
width = 30,
},
shift = {
0,
-0.328125
},
width = 15,
}
}
sc.and_symbol_sprites = sc.multiply_symbol_sprites
sc.divide_symbol_sprites = sc.multiply_symbol_sprites
sc.left_shift_symbol_sprites = sc.multiply_symbol_sprites
sc.minus_symbol_sprites = sc.multiply_symbol_sprites
sc.modulo_symbol_sprites = sc.multiply_symbol_sprites
sc.or_symbol_sprites = sc.multiply_symbol_sprites
sc.plus_symbol_sprites = sc.multiply_symbol_sprites
sc.power_symbol_sprites = sc.multiply_symbol_sprites
sc.right_shift_symbol_sprites = sc.multiply_symbol_sprites
sc.xor_symbol_sprites = sc.multiply_symbol_sprites
local corpse = table.deepcopy(data.raw["corpse"]["arithmetic-combinator-remnants"])
corpse.name = "statsd-combinator-remnants"
corpse.icon = "__factorystatsd__/graphics/icons/statsd-combinator.png"
corpse.icon_mipmaps = 1
corpse.icon_size = 64
corpse.animation = {
axially_symmetrical = false,
direction_count = 4,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/statsd-combinator-remnants.png",
frame_count = 1,
height = 78,
hr_version = {
axially_symmetrical = false,
direction_count = 4,
filename = "__factorystatsd__/graphics/entity/statsd-combinator/hr-statsd-combinator-remnants.png",
frame_count = 1,
height = 156,
line_length = 1,
scale = 0.5,
variation_count = 1,
width = 156
},
line_length = 1,
variation_count = 1,
width = 78
}
corpse.localised_name = {
"remnant-name",
{
"entity-name.statsd-combinator"
}
}
data:extend({sc, corpse})
|
-- ... dot.lua
|
---
--- Event.lua
---
--- Copyright (C) 2018 Xrysnow. All rights reserved.
---
local mbg = require('util.mbg.main')
local String = require('util.mbg.String')
---@class mbg.Event
local Event = {}
mbg.Event = Event
local function _Event()
---@type mbg.Event
local ret = {}
---@type mbg.Condition
ret.Condition = nil
---@type mbg.DataOperateAction|mbg.CommandAction|mbg.ReflexBoardAction
ret.Action = nil
return ret
end
local mt = {
__call = function()
return _Event()
end
}
setmetatable(Event, mt)
---ParseFrom
---@param c mbg.String
---@return mbg.Event
function Event.ParseFrom(c)
local e = Event()
e.Condition = mbg.Condition.ParseFrom(mbg.ReadString(c, ':'))
e.Action = mbg.ActionHelper.ParseFrom(c)
return e
end
---ParseEvents
---@param c mbg.String
---@return mbg.Event[]
function Event.ParseEvents(c)
if not c or c:isempty() then
return nil
else
local ret = {}
local events = c:split(';')
for _, v in pairs(events) do
if v ~= '' then
table.insert(ret, Event.ParseFrom(String(v)))
end
end
return ret
end
end
|
project "CppSharp.Runtime"
SetupManagedProject()
kind "SharedLib"
clr "Unsafe"
files { "**.cs" }
links { "System" }
configuration "vs*"
defines { "MSVC" }
configuration "macosx"
defines { "LIBCXX" }
|
local PLUGIN = PLUGIN;
local COMMAND = Clockwork.command:New("PlaySound");
COMMAND.tip = "Make all players play a sound.";
COMMAND.text = "<string SoundPath>";
COMMAND.access = "a";
COMMAND.arguments = 1;
-- Called when the command has been run.
function COMMAND:OnRun(player, arguments)
BroadcastLua("surface.PlaySound('"..arguments[1].."')");
end;
COMMAND:Register();
|
local PLUGIN = PLUGIN
PLUGIN.name = "Radio Chatbox"
PLUGIN.author = "faust"
PLUGIN.description = "Creates another chatbox above the regular one for radio chatter only."
ix.config.Add("enableRadioChatbox", true, "Whether or not to show radio messages in their own chatbox.", nil, {
category = "Extended Radio"
})
if (CLIENT) then
function PLUGIN:ChatboxPositionChanged(x, y, width, height)
--print(ix.gui.chat:GetSize())
--print(self.rpanel:GetSize())
if (IsValid(self.rpanel)) then
local w,h = ix.gui.chat:GetDefaultSize()
local border = 16
local magic = (643-459-border)
local magicHeight = 155
--print(self.rpanel:GetSize())
-- print(x,y)
-- print(" ")
-- print(self.rpanel:GetPos())
-- print( (643-459) == (border - h) )
self.rpanel:SetSize(w, magicHeight)
self.rpanel:SetPos(x, y - magic) --+ border - h)
end
end
function PLUGIN:CreateRadiochat()
if (IsValid(self.rpanel)) then
self.rpanel:Remove()
end
self.rpanel = vgui.Create("radioChatbox")
self.rpanel:SetupPosition(util.JSONToTable(ix.option.Get("chatPosition", "")))
--hook.Run("ChatboxCreated")
end
function PLUGIN:InitPostEntity()
self:CreateRadiochat()
--hook.Run("ChatboxPositionChanged",x,y,width,height)
end
-- function PLUGIN:PlayerBindPress(client, bind, pressed)
-- bind = bind:lower()
-- --print("Is this on?")
-- if (bind:find("messagemode") and pressed) then
-- --print("Got this far")
-- if ((IsValid(self.rpanel)) and (ix.config.Get("enableRadioChatbox"))) then
-- --print("Message mode bind worked")
-- self.rpanel:SetActive(true)
-- end
-- ix.gui.chat:SetActive(true)
-- return true
-- end
-- end
--hook.Add("PlayerBindPress", "PlayerBindPress", PLUGIN:radioBindPress())
-- function PLUGIN:ChatText(index, name, text, messageType)
-- if (messageType == "none" and IsValid(self.rpanel)) then
-- self.rpanel:AddMessage(text)
-- --ix.gui.chat:AddMessage(text)
-- end
-- end
-- luacheck: globals chat
chat.ixAddText = chat.ixAddText or chat.AddText
function chat.AddText(...)
local chat_class = CHAT_CLASS
local radiocheck = false
if (chat_class != nil) then
if (ix.config.Get("enableRadioChatbox") == false) then
radiocheck = false
elseif ((chat_class.uniqueID == "radio") or (chat_class.uniqueID == "radio_yell") or (chat_class.uniqueID == "radio_whisper")) then
radiocheck = true
end
end
--print(IsValid(PLUGIN.rpanel))
if (IsValid(ix.gui.chat) and !radiocheck) then
--print("Hi")
ix.gui.chat:AddMessage(...)
--print("Regular")
elseif (IsValid(PLUGIN.rpanel) and radiocheck) then
-- print("Here now")
PLUGIN.rpanel:AddMessage(...)
--print("New")
end
-- log chat message to console
local text = {}
for _, v in ipairs({...}) do
if (istable(v) or isstring(v)) then
text[#text + 1] = v
elseif (isentity(v) and v:IsPlayer()) then
text[#text + 1] = team.GetColor(v:Team())
text[#text + 1] = v:Name()
elseif (type(v) != "IMaterial") then
text[#text + 1] = tostring(v)
end
end
text[#text + 1] = "\n"
MsgC(unpack(text))
end
else
util.AddNetworkString("ixChatMessage")
net.Receive("ixChatMessage", function(length, client)
local text = net.ReadString()
if ((client.ixNextChat or 0) < CurTime() and isstring(text) and text:find("%S")) then
hook.Run("PlayerSay", client, text)
client.ixNextChat = CurTime() + 0.5
end
end)
end
|
-- $MXC_V · $MXNAME
local colors = {
bg = "${XBG}",
fg = "${XFG}",
-- yellow = "${CX3}",
-- cyan = "${CX6}",
darkblue = "${CX4}",
-- green = "${CX2}",
-- orange = "${SBG}",
violet = "${C13}",
magenta = "${C05}",
blue = "${C04}",
red = "${CX1}",
white = "${C15}",
darker_black = "${SK1}",
black = "${C00}", -- nvim bg
black2 = "${WK1}",
one_bg = "${SK3}", -- real bg of onedark
one_bg2 = "${WK2}",
one_bg3 = "${WK3}",
grey = "${C08}",
grey_fg = "${C07}",
grey_fg2 = "${WK4}",
light_grey = "${WK6}",
baby_pink = "${C11}",
pink = "${CX1}",
line = "${SBG}", -- for lines like vertsplit
green = "${C02}",
vibrant_green = "${C12}",
nord_blue = "${SBG}",
yellow = "${C03}",
sun = "${CX3}",
purple = "${C13}",
dark_purple = "${C05}",
teal = "${SBG}",
orange = "${EBG}",
cyan = "${C06}",
statusline_bg = "${SK0}",
statusline_fg = "${SBG}",
-- statusline_bg = "${SK3}",
lightbg = "${WK1}",
lightbg2 = "${SK1}",
--
fullblack = "#000000",
-- #########
cx1 = "$CX1",
cx2 = "$CX2",
cx3 = "$CX3",
cx4 = "$CX4",
cx5 = "$CX5",
cx6 = "$CX6",
--
cy1 = "$CY1",
cy2 = "$CY2",
cy3 = "$CY3",
cy4 = "$CY4",
cy5 = "$CY5",
cy6 = "$CY6",
--
cf1 = "$CF1",
cf2 = "$CF2",
cf3 = "$CF3",
cf4 = "$CF4",
cf5 = "$CF5",
cf6 = "$CF6",
--
c00 = "$C00",
c01 = "$C01",
c02 = "$C02",
c03 = "$C03",
c04 = "$C04",
c05 = "$C05",
c06 = "$C06",
c07 = "$C07",
c08 = "$C08",
c09 = "$C09",
c10 = "$C10",
c11 = "$C11",
c12 = "$C12",
c13 = "$C13",
c14 = "$C14",
c15 = "$C15",
sbg = "$SBG",
sfg = "$SFG",
wbg = "$WBG",
wfg = "$WFG",
ebg = "$EBG",
efg = "$EFG",
xbg = "$XBG",
xfg = "$XFG",
obg = "$OBG",
ofg = "$OFG",
wbx = "$WBX",
wfx = "$WFX",
sk0 = "$SK0",
sk1 = "$SK1",
sk2 = "$SK2",
sk3 = "$SK3",
sk4 = "$SK4",
sk5 = "$SK5",
sk6 = "$SK6",
sk7 = "$SK7",
sk8 = "$SK8",
sk9 = "$SK9",
wk0 = "$WK0",
wk1 = "$WK1",
wk2 = "$WK2",
wk3 = "$WK3",
wk4 = "$WK4",
wk5 = "$WK5",
wk6 = "$WK6",
wk7 = "$WK7",
wk8 = "$WK8",
wk9 = "$WK9",
ek0 = "$EK0",
ek1 = "$EK1",
ek2 = "$EK2",
ek3 = "$EK3",
ek4 = "$EK4",
ek5 = "$EK5",
ek6 = "$EK6",
ek7 = "$EK7",
ek8 = "$EK8",
ek9 = "$EK9"
}
return colors
|
T('Given an empty table',
function (T)
local t = {}
T('When an item is inserted into a table',
function (T)
assert(#t == 0)
table.insert(t, 111)
T:assert(#t == 1, 'Then the size of the table is 1')
T:assert(t[1] == 111, 'Then the item is stored in index 1')
T('When the index is set to nil',
function (T)
assert(#t == 1)
t[1] = nil
T:assert(#t == 0, 'Then the size of the table is 0')
pcall(function ()
T:error(function () end, 'THIS TEST INTENTIONALLY FAILS')
end)
end)
T('When another item is inserted',
function (T)
assert(#t == 1)
table.insert(t, 222)
T:assert(#t == 2, 'Then the size of the table is 2')
T:assert(t[2] == 222, 'Then the second item is stored in index 2')
T('When the first item is removed with table.remove',
function (T)
assert(#t == 2)
table.remove(t, 1)
T:assert(#t == 1, 'Then the size of the table is 1')
T:assert(t[1] == 222, 'Then the second item has moved to index 1')
end)
T('When the first item is set to nil',
function (T)
assert(#t == 2)
t[1] = nil
T:assert(#t == 2, 'Then the size of the table is 2')
T:assert(t[2] == 222, 'Then the second item remains in index 2')
pcall(function ()
T:assert(false, 'THIS TEST INTENTIONALLY FAILS')
end)
end)
end)
end)
end)
T('Given a value of two', function (T)
local value = 2
T('When the value is increased by five', function (T)
-- here, value is 2
value = value + 5
local foo = 10
T:assert(value == 7 and foo == 10, 'Then the value equals seven')
end)
T('When the value is decreased by five', function (T)
-- value is 2 again; this test is isolated from the "increased by five" test
value = value - 5
T:assert(value == -3, 'Then the value equals negative three')
end)
end)
T('Given a value of two', function (T)
local value = 2
T:assert(value == 2, 'Then the value equals two')
end)
|
local ipc = require 'libipc'
-- Make 3 files
torch.save('f1.t7', torch.randn(1, 2))
torch.save('f2.t7', torch.randn(2, 2))
torch.save('f3.t7', torch.randn(3, 2))
-- Create a named workqueue
local q = ipc.workqueue('my queue')
-- Create 2 background workers that read from the named workqueue
local workers = ipc.map(2, function()
-- This function is not a closure, its a totally clean Lua environment
local ipc = require 'libipc'
-- Open the queue by name (the main thread already created it)
local q = ipc.workqueue('my queue')
repeat
-- Read the next file name off the workqueue
local fileName = q:read()
if fileName then
-- Load the file and write its contents back into the workqueue
q:write(torch.load(fileName))
end
until fileName == nil
end)
-- Write the file names into the workqueue
q:write('f1.t7')
q:write('f2.t7')
q:write('f3.t7')
-- Read back the 3 answers and print them
print(q:read())
print(q:read())
print(q:read())
-- Write nil 2X to tell both workers to finish
q:write(nil)
q:write(nil)
-- Wait for the workers to finish up
workers:join()
-- Shutdown the workqueue
q:close()
-- Cleanup
os.execute('rm f1.t7')
os.execute('rm f2.t7')
os.execute('rm f3.t7')
|
function read_txt_file(path)
local file, errorMessage = io.open(path, "r")
if not file then
error("Could not read the file:" .. errorMessage .. "\n")
end
local content = file:read "*all"
file:close()
return content
end
local Boundary = "----WebKitFormBoundaryePkpFF7tjBAqx29L"
local BodyBoundary = "--" .. Boundary
local LastBoundary = "--" .. Boundary .. "--"
local CRLF = "\r\n"
local FileBody = read_txt_file("tests/lua/test.txt")
-- We don't need different file names here because the test should
-- always replace the uploaded file with the new one. This will avoid
-- the problem with directories having too much files and slowing down
-- the application, which is not what we are trying to test here.
-- This will also avoid overloading wrk with more things do to, which
-- can influence the test results.
local Filename = "test.txt"
local ContentDisposition = "Content-Disposition: form-data; name=\"file\"; filename=\"" .. Filename .. "\""
wrk.method = "POST"
wrk.headers["Content-Type"] = "multipart/form-data; boundary=" .. Boundary
wrk.body = BodyBoundary .. CRLF .. ContentDisposition .. CRLF .. CRLF .. FileBody .. CRLF .. LastBoundary .. CRLF
|
local floor = math.floor
local gcolor = require('gears.color')
local M = {}
function M.lighten(color, amount)
local r, g, b
r, g, b = gcolor.parse_color(color)
r = 255 * r
g = 255 * g
b = 255 * b
r = r + floor(2.55 * amount)
g = g + floor(2.55 * amount)
b = b + floor(2.55 * amount)
r = r > 255 and 255 or r
g = g > 255 and 255 or g
b = b > 255 and 255 or b
return ("#%02x%02x%02x"):format(r, g, b)
end
return M
|
m = Map("mosdns")
m.title = translate("MosDNS")
m.description = translate("MosDNS is a 'programmable' DNS forwarder.")
m:section(SimpleSection).template = "mosdns/mosdns_status"
s = m:section(TypedSection, "mosdns")
s.addremove = false
s.anonymous = true
enable = s:option(Flag, "geo_auto_update", translate("Enable Auto Database Update"))
enable.rmempty = false
enable = s:option(Flag, "syncconfig", translate("Enable Config Update"))
enable.rmempty = false
o = s:option(ListValue, "geo_update_week_time", translate("Update Cycle"))
o:value("*", translate("Every Day"))
o:value("1", translate("Every Monday"))
o:value("2", translate("Every Tuesday"))
o:value("3", translate("Every Wednesday"))
o:value("4", translate("Every Thursday"))
o:value("5", translate("Every Friday"))
o:value("6", translate("Every Saturday"))
o:value("7", translate("Every Sunday"))
o.default = "*"
update_time = s:option(ListValue, "geo_update_day_time", translate("Update Time (Every Day)"))
for t = 0, 23 do
update_time:value(t, t..":00")
end
update_time.default = 0
data_update = s:option(Button, "geo_update_database", translate("Database Update"))
data_update.inputtitle = translate("Check And Update")
data_update.inputstyle = "reload"
data_update.write = function()
luci.sys.exec("/etc/mosdns/mosupdater.sh >/dev/null 2>&1 &")
end
return m
|
local core = require "core"
local common = require "core.common"
local style = require "core.style"
local View = require "core.view"
local function lines(text)
if text == "" then return 0 end
local l = 1
for _ in string.gmatch(text, "\n") do
l = l + 1
end
return l
end
local item_height_result = {}
local function get_item_height(item)
local h = item_height_result[item]
if not h then
h = {}
local l = 1 + lines(item.text) + lines(item.info or "")
h.normal = style.font:get_height() + style.padding.y
h.expanded = l * style.font:get_height() + style.padding.y
h.current = h.normal
h.target = h.current
item_height_result[item] = h
end
return h
end
local LogView = View:extend()
LogView.context = "session"
function LogView:new()
LogView.super.new(self)
self.last_item = core.log_items[#core.log_items]
self.expanding = {}
self.scrollable = true
self.yoffset = 0
end
function LogView:get_name()
return "Log"
end
local function is_expanded(item)
local item_height = get_item_height(item)
return item_height.target == item_height.expanded
end
function LogView:expand_item(item)
item = get_item_height(item)
item.target = item.target == item.expanded and item.normal or item.expanded
table.insert(self.expanding, item)
end
function LogView:each_item()
local x, y = self:get_content_offset()
y = y + style.padding.y + self.yoffset
return coroutine.wrap(function()
for i = #core.log_items, 1, -1 do
local item = core.log_items[i]
local h = get_item_height(item).current
coroutine.yield(i, item, x, y, self.size.x, h)
y = y + h
end
end)
end
function LogView:on_mouse_moved(px, py, ...)
LogView.super.on_mouse_moved(self, px, py, ...)
local hovered = false
for _, item, x, y, w, h in self:each_item() do
if px >= x and py >= y and px < x + w and py < y + h then
hovered = true
self.hovered_item = item
break
end
end
if not hovered then self.hovered_item = nil end
end
function LogView:on_mouse_pressed(button, mx, my, clicks)
if LogView.super.on_mouse_pressed(self, button, mx, my, clicks) then return end
if self.hovered_item then
self:expand_item(self.hovered_item)
end
end
function LogView:update()
local item = core.log_items[#core.log_items]
if self.last_item ~= item then
self.last_item = item
self.scroll.to.y = 0
self.yoffset = -(style.font:get_height() + style.padding.y)
end
local expanding = self.expanding[1]
if expanding then
self:move_towards(expanding, "current", expanding.target)
if expanding.current == expanding.target then
table.remove(self.expanding, 1)
end
end
self:move_towards("yoffset", 0)
LogView.super.update(self)
end
local function draw_text_multiline(font, text, x, y, color)
local th = font:get_height()
local resx = x
for line in text:gmatch("[^\n]+") do
resx = renderer.draw_text(style.font, line, x, y, color)
y = y + th
end
return resx, y
end
function LogView:draw()
self:draw_background(style.background)
local th = style.font:get_height()
local lh = th + style.padding.y -- for one line
for _, item, x, y, w in self:each_item() do
x = x + style.padding.x
local time = os.date(nil, item.time)
x = common.draw_text(style.font, style.dim, time, "left", x, y, w, lh)
x = x + style.padding.x
x = common.draw_text(style.code_font, style.dim, is_expanded(item) and "-" or "+", "left", x, y, w, lh)
x = x + style.padding.x
w = w - (x - self:get_content_offset())
if is_expanded(item) then
y = y + common.round(style.padding.y / 2)
_, y = draw_text_multiline(style.font, item.text, x, y, style.text)
local at = "at " .. common.home_encode(item.at)
_, y = common.draw_text(style.font, style.dim, at, "left", x, y, w, lh)
if item.info then
_, y = draw_text_multiline(style.font, item.info, x, y, style.dim)
end
else
local line, has_newline = string.match(item.text, "([^\n]+)(\n?)")
if has_newline ~= "" then
line = line .. " ..."
end
_, y = common.draw_text(style.font, style.text, line, "left", x, y, w, lh)
end
end
end
return LogView
|
local Log = {}
Log.LEVELS = {
OFF = 0,
ERROR = 1,
WARNING = 2,
INFO = 3,
DEBUG = 4,
}
Log.LEVEL_NAMES = {
[0] =
"OFF",
"ERROR",
"WARNING",
"INFO",
"DEBUG",
}
Log.currentLevel = Log.LEVELS.INFO
function Log:message(level, message, ...)
if level > self.currentLevel then
return
end
print(string.format("[%s] %s", Log.LEVEL_NAMES[level], message))
if (...) then
if (#{...}) > 1 or type(...) == "table" then
tprint({...})
else
print(...)
end
end
end
function Log:error(m, ...) self:message(self.LEVELS.ERROR, m, ...) end
function Log:warning(m, ...) self:message(self.LEVELS.WARNING, m, ...) end
function Log:info(m, ...) self:message(self.LEVELS.INFO, m, ...) end
function Log:debug(m, ...) self:message(self.LEVELS.DEBUG, m, ...) end
function Log:setLevel(l)
self.currentLevel = l
end
return Log
|
ExtraItem.ID = "ZPSlam"
ExtraItem.Name = "ExtraItemSlamName"
ExtraItem.Price = 6
function ExtraItem:OnBuy(ply)
local Weap = ply:GetWeapon("weapon_slam")
if IsValid(Weap) then
ply:GiveAmmo(3, "slam", true)
else
ply:Give("weapon_slam")
end
end
WeaponManager:AddWeaponMultiplier("npc_tripmine", 4)
WeaponManager:AddWeaponMultiplier("npc_satchel", 4)
|
data:extend{
{
type = "armor",
name = "power-armor-mk3",
icon = "__advanced-equipment__/graphics/icons/power-armor-mk3.png",
icon_size = 32,
icon_mipmaps = 4,
resistances =
{
{
type = "physical",
decrease = 12,
percent = 50
},
{
type = "acid",
decrease = 0,
percent = 80
},
{
type = "explosion",
decrease = 80,
percent = 60
},
{
type = "fire",
decrease = 0,
percent = 80
}
},
subgroup = "armor",
order = "f[power-armor-mk3]",
stack_size = 1,
infinite = true,
equipment_grid = "advanced-equipment-grid",
inventory_size_bonus = 50
}
}
|
local ffi = require "ffi"
ffi.cdef[[
typedef struct glsl_shader_t
{
int ID;
bool Owner;
}glsl_shader_t;
]]
GLSLShader = ffi.typeof("glsl_shader_t");
GLSLShader_mt = {
__index = {
CreateFromText = function(self, text, stype)
local src_array = ffi.new("char*[1]", ffi.cast("char *",text));
local lpSuccess = ffi.new("int[1]");
self.ID = ogm.glCreateShader(stype);
self.Owner = true;
ogm.glShaderSource(self.ID, 1, src_array, nil);
self:Compile();
return self;
end,
CreateFromFile = function(self, fname, stype)
local fp = io.open(fname, "r");
local src_buf = fp:read("*all");
self:CreateFromText(src_buf, stype)
fp:close();
return shader;
end,
Compile = function(self)
ogm.glCompileShader(self.ID);
end,
GetValue = function(self, nameenum)
local lpParams = ffi.new("int[1]");
ogm.glGetShaderiv(self.ID, nameenum, lpParams)
return lpParams[0];
end,
GetShaderType = function(self)
return self:GetValue(GL_SHADER_TYPE);
end,
GetDeleteStatus = function(self)
return self:GetValue(GL_DELETE_STATUS);
end,
GetCompileStatus = function(self)
return self:GetValue(GL_COMPILE_STATUS);
end,
GetInfoLogLength = function(self)
return self:GetValue(GL_INFO_LOG_LENGTH);
end,
GetSourceLength = function(self)
return self:GetValue(GL_SHADER_SOURCE_LENGTH);
end,
GetSource = function(self)
local bufSize = self:GetSourceLength();
local source = Array1D(bufSize+1, "char")
local lpLength = ffi.new("int[1]");
ogm.glGetShaderSource(self.ID, bufSize, lpLength, source)
return ffi.string(source);
end,
GetInfoLog = function(self)
local bufSize = self:GetInfoLogLength();
local log = Array1D(bufSize+1, "char")
local lpLength = ffi.new("int[1]");
ogm.glGetShaderInfoLog(self.ID, bufSize, lpLength, log)
return ffi.string(log);
end,
},
}
GLSLShader = ffi.metatype("glsl_shader_t", GLSLShader_mt);
GPUProgram = {}
GPUProgram_mt = {}
function GPUProgram.new(fragtext, vertext)
local self = {}
self.ID = ogm.glCreateProgram();
if fragtext ~= nil then
self.FragmentShader = GLSLShader():CreateFromText(fragtext, GL_FRAGMENT_SHADER);
GPUProgram.AttachShader(self, self.FragmentShader);
end
if vertext ~= nil then
self.VertexShader = GLSLShader():CreateFromText(vertext, GL_VERTEX_SHADER);
GPUProgram.AttachShader(self, self.VertexShader);
end
GPUProgram.Link(self)
setmetatable(self, GPUProgram_mt)
return self
end
function GPUProgram:AttachShader(shader)
ogm.glAttachShader(self.ID, shader.ID);
end
function GPUProgram:Link()
ogm.glLinkProgram(self.ID);
local lpLinked = ffi.new("int[1]");
ogm.glGetProgramiv(self.ID, GL_LINK_STATUS, lpLinked);
self.LinkStatus = lpLinked[0];
if(0 == linked) then
print("shader linking failed");
end
end
function GPUProgram:Validate()
ogm.glValidateProgram(self.ID);
end
function GPUProgram:Use()
ogm.glUseProgram(self.ID);
end
local function get_ProgramValue(programid, nameenum)
local lpParams = ffi.new("int[1]");
ogm.glGetProgramiv(programid, nameenum, lpParams)
return lpParams[0];
end
function GPUProgram:GetDeleteStatus()
return get_ProgramValue(self.ID, GL_DELETE_STATUS);
end
function GPUProgram:GetLinkStatus()
return get_ProgramValue(self.ID, GL_LINK_STATUS);
end
function GPUProgram:GetValidateStatus()
return get_ProgramValue(self.ID, GL_VALIDATE_STATUS);
end
function GPUProgram:GetInfoLogLength()
return get_ProgramValue(self.ID, GL_INFO_LOG_LENGTH);
end
function GPUProgram:GetAttachedShaderCount()
return get_ProgramValue(self.ID, GL_ATTACHED_SHADERS);
end
function GPUProgram:GetActiveAttributeCount()
return get_ProgramValue(self.ID, GL_ACTIVE_ATTRIBUTES);
end
function GPUProgram:GetActiveAttributeMaxLength()
return get_ProgramValue(self.ID, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH);
end
function GPUProgram:GetActiveUniformCount()
return get_ProgramValue(self.ID, GL_ACTIVE_UNIFORMS);
end
function GPUProgram:GetActiveUniformMaxLength()
return get_ProgramValue(self.ID, GL_ACTIVE_UNIFORM_MAX_LENGTH);
end
function GPUProgram:GetInfoLog()
local bufSize = self:GetInfoLogLength();
local buff = ffi.new("char[?]", bufSize+1)
local lpLength = ffi.new("int[1]");
ogm.glGetProgramInfoLog(self.ID, bufSize, lpLength, buff)
return ffi.string(buff);
end
function GPUProgram:Print()
print("==== GLSL Program ====")
print(string.format("Delete Status: 0x%x", self:GetDeleteStatus()))
print(string.format("Link Status: 0x%x", self:GetLinkStatus()))
print(string.format("Validate Status: 0x%x", self:GetValidateStatus()))
print(string.format("Log Length: 0x%x", self:GetInfoLogLength()))
print(string.format("Attached Shaders: 0x%x", self:GetAttachedShaderCount()))
print(string.format("Active Attributes: 0x%x", self:GetActiveAttributeCount()))
print(string.format("Active Max Length: 0x%x", self:GetActiveAttributeMaxLength()))
print(string.format("Active Uniforms: 0x%x", self:GetActiveUniformCount()))
print(string.format("Active Uniform Length: 0x%x", self:GetActiveUniformMaxLength()))
print("==== LOG ====");
print(self:GetInfoLog());
end
function GetUniform(self, name)
local loc = ogm.glGetUniformLocation(self.ID, name);
--print("GetUniform: ", name, loc);
local lpsize = ffi.new("int[1]");
local lputype = ffi.new("int[1]");
local buff = Array1D(256, "char");
local bufflen = 255;
local lplength = ffi.new("int[1]");
ogm.glGetActiveUniform (self.ID, loc, bufflen, lplength, lpsize, lputype, buff);
local size = lpsize[0];
local utype = lputype[0];
local namelen = lplength[0];
local iname = ffi.string(buff);
--[[
print("==========");
print("Name: ", name);
print("Location: ", loc);
print(string.format("Type: 0x%x", utype));
print("Size: ", size);
print("IName: ", ffi.string(buff), namelen);
--]]
return loc, utype, size;
end
-- This table of properties helps in the
-- process of retrieving and setting uniform
-- values of a shader
local uniformprops = {}
uniformprops[GL_FLOAT] = {1, "float", ogm.glGetUniformfv, ogm.glUniform1fv, 1, "float[1]"};
uniformprops[GL_FLOAT_VEC2] = {2, "float", ogm.glGetUniformfv, ogm.glUniform2fv, 1, "float[2]"};
uniformprops[GL_FLOAT_VEC3] = {3, "float", ogm.glGetUniformfv, ogm.glUniform3fv, 1, "float[3]"};
uniformprops[GL_FLOAT_VEC4] = {4, "float", ogm.glGetUniformfv, ogm.glUniform4fv, 1, "float[4]"};
uniformprops[GL_DOUBLE] = {1, "double", ogm.glGetUniformdv, ogm.glUniform1dv, 1, "double[1]"};
uniformprops[GL_DOUBLE_VEC2] = {2, "double", ogm.glGetUniformdv, ogm.glUniform2dv, 1, "double[2]"};
uniformprops[GL_DOUBLE_VEC3] = {3, "double", ogm.glGetUniformdv, ogm.glUniform3dv, 1, "double[3]"};
uniformprops[GL_DOUBLE_VEC4] = {4, "double", ogm.glGetUniformdv, ogm.glUniform4dv, 1, "double[4]"};
uniformprops[GL_INT] = {1, "int", ogm.glGetUniformiv, ogm.glUniform1iv, 1, "int[1]"};
uniformprops[GL_INT_VEC2] = {2, "int", ogm.glGetUniformiv, ogm.glUniform2iv, 1, "int[2]"};
uniformprops[GL_INT_VEC3] = {3, "int", ogm.glGetUniformiv, ogm.glUniform3iv, 1, "int[3]"};
uniformprops[GL_INT_VEC4] = {4, "int", ogm.glGetUniformiv, ogm.glUniform4iv, 1, "int[4]"};
uniformprops[GL_BOOL] = {1, "int", ogm.glGetUniformiv, ogm.glUniform1iv, 1, "int[1]"};
uniformprops[GL_BOOL_VEC2] = {2, "int", ogm.glGetUniformiv, ogm.glUniform2iv, 1, "int[2]"};
uniformprops[GL_BOOL_VEC3] = {3, "int", ogm.glGetUniformiv, ogm.glUniform3iv, 1, "int[3]"};
uniformprops[GL_BOOL_VEC4] = {4, "int", ogm.glGetUniformiv, ogm.glUniform4iv, 1, "int[4]"};
uniformprops[GL_FLOAT_MAT2] = {4, "float", ogm.glGetUniformfv, ogm.glUniformMatrix2fv, 1, "float[4]"};
uniformprops[GL_FLOAT_MAT3] = {9, "float", ogm.glGetUniformfv, ogm.glUniformMatrix3fv, 1, "float[9]"};
uniformprops[GL_FLOAT_MAT4] = {16, "float", ogm.glGetUniformfv, ogm.glUniformMatrix4fv, 1, "float[16]"};
uniformprops[GL_SAMPLER_1D] = {1, "int", ogm.glGetUniformiv, ogm.glUniform1iv, 1, "int[1]"};
uniformprops[GL_SAMPLER_1D_SHADOW] = {1, "int", ogm.glGetUniformiv, ogm.glUniform1iv, 1, "int[1]"};
uniformprops[GL_SAMPLER_2D] = {1, "int", ogm.glGetUniformiv, ogm.glUniform1iv, 1, "int[1]"};
uniformprops[GL_SAMPLER_2D_SHADOW] = {1, "int", ogm.glGetUniformiv, ogm.glUniform1iv, 1, "int[1]"};
uniformprops[GL_SAMPLER_3D] = {1, "int", ogm.glGetUniformiv, ogm.glUniform1iv, 1, "int[1]"};
uniformprops[GL_SAMPLER_CUBE] = {1, "int", ogm.glGetUniformiv, ogm.glUniform1iv, 1, "int[1]"};
function GetUniformValue(self, name)
local loc, utype, size = GetUniform(self, name);
if loc == nil then return nil end;
local uprops = uniformprops[utype];
--[[
print("================")
print("GPUProgram:GetUniformValue")
print("Name: ", name);
print("Loc: ", loc);
print("Size: ", size);
print("----");
--]]
local ncomps = uprops[1]
local basetype = uprops[2]
local getfunc = uprops[3]
local narrelem = uprops[5];
local typedecl = uprops[6];
-- print(ncomps, basetype, typedecl);
-- Create a buffer of the appropriate size
-- to hold the results
local buff = ffi.new(typedecl);
-- Call the getter to get the value
getfunc(self.ID, loc, buff);
return buff, ncomps;
end
function SetUniformValue(self, name, value)
local loc, utype, size = GetUniform(self, name);
if loc == nil then return nil end;
local uprops = uniformprops[utype];
--[[
print("================")
print("GPUProgram:GetUniformValue")
print("Name: ", name);
print("Loc: ", loc);
print("Size: ", size);
print("----");
--]]
local ncomps = uprops[1]
local basetype = uprops[2]
local setfunc = uprops[4]
local narrelem = uprops[5];
local typedecl = uprops[6];
--print(ncomps, basetype, typedecl);
-- Create a buffer of the appropriate size
-- to hold the results
local buff = ffi.new(typedecl);
-- copy value into buffer
if ncomps == 1 then
buff[0] = value
else
for i=0,ncomps-1 do
buff[i] = value[i];
end
end
-- Call the setter to get the value
setfunc(loc, narrelem, buff);
end
function glsl_get(self, key)
-- First, try the object itself as it might
-- be a simple field access
local field = rawget(self,key)
if field ~= nil then
-- print("returning self field: ", field)
return field
end
-- Next, try the class table, as it might be a
-- function for the class
field = rawget(GPUProgram,key)
if field ~= nil then
-- print("returning glsl field: ", field)
return field
end
-- Last, do whatever magic to return a value
-- or nil
local value, ncomps = GetUniformValue(self, key)
if ncomps == 1 then
return value[0];
end
return value
end
function glsl_set(self, key, value)
-- See if the field exists in the table
local field = rawget(self,key)
if field ~= nil then
rawset(self, key, value)
end
-- Otherwise, try to set the value
-- in the shader
SetUniformValue(self, key, value)
end
GPUProgram_mt.__index = glsl_get
GPUProgram_mt.__newindex = glsl_set
function GLSLProgram(fragtext, vertext)
local prog = GPUProgram.new(fragtext, vertext)
return prog
end
function CreateGLSLProgramFromFiles(fragname, vertname)
local fragtext = nil;
local verttext = nil;
local fp = nil;
if fragname then
fp = io.open(fragname, "r");
fragtext = fp:read("*all");
--print(fragtext);
fp:close();
end
if vertname then
fp = io.open(vertname, "r");
verttext = fp:read("*all");
fp:close();
end
local prog = GLSLProgram(fragtext, verttext);
return prog;
end
return GLSLProgram
|
--
-- classic
--
-- Copyright (c) 2014, rxi
--
-- This module is free software; you can redistribute it and/or modify it under
-- the terms of the MIT license. See LICENSE for details.
--
-- copied from also https://github.com/rxi/classic
--
local lua_version = _VERSION:match("[%d%.]*$")
local isOldLua = (#lua_version == 3 and lua_version < "5.3")
local upper = string.upper
local sub = string.sub
local lwtk = require("lwtk")
local Class = lwtk.Class
local getSuperClass = lwtk.get.superClass
local Object = {}
Object.__index = Object
Object.__name = "lwtk.Object"
setmetatable(Object, Class)
function Object:new()
end
local fallbackToString
if isOldLua then
fallbackToString = function(self)
local mt = getmetatable(self)
setmetatable(self, nil)
local s = tostring(self)
setmetatable(self, mt)
return mt.__name..": "..s:match("([^ :]*)$")
end
end
function Object.newSubClass(className, superClass)
local newClass = {}
for k, v in pairs(superClass) do
if k ~= "extra" then
newClass[k] = v
end
end
newClass.__index = newClass
newClass.__name = className
if isOldLua and not newClass.__tostring then
newClass.__tostring = fallbackToString
end
setmetatable(newClass, Class)
getSuperClass[newClass] = superClass
return newClass
end
function Object:is(T)
local mt = getmetatable(self)
while mt do
if mt == T then
return true
end
mt = getSuperClass[mt]
end
return false
end
function Object:setAttributes(attr)
if attr ~= nil then
assert(type(attr) == "table", "table expected")
for k, v in pairs(attr) do
assert(type(k) == "string", "attribute names must be string")
local setterName = "set"..upper(sub(k, 1, 1))..sub(k, 2)
local setter = self[setterName]
assert(type(setter) == "function", "unknown attribute '"..k.."'")
setter(self, v)
end
end
end
return Object
|
---@class CS.FairyEditor.GlobalPublishSettings.AtlasSetting
---@field public maxSize number
---@field public paging boolean
---@field public sizeOption string
---@field public forceSquare boolean
---@field public allowRotation boolean
---@field public trimImage boolean
---@type CS.FairyEditor.GlobalPublishSettings.AtlasSetting
CS.FairyEditor.GlobalPublishSettings.AtlasSetting = { }
---@return CS.FairyEditor.GlobalPublishSettings.AtlasSetting
function CS.FairyEditor.GlobalPublishSettings.AtlasSetting.New() end
return CS.FairyEditor.GlobalPublishSettings.AtlasSetting
|
function widget:GetInfo()
return {
name = 'DontBreakCloak',
desc = 'Sets units to hold fire when cloaked',
author = 'Niobium',
version = '1.1',
date = 'April 2011',
license = 'GNU GPL, v2 or later',
layer = 0,
enabled = true, -- loaded by default?
}
end
----------------------------------------------------------------
-- Var
----------------------------------------------------------------
local isCommander = VFS.Include("luarules/configs/comDefIDs.lua")
----------------------------------------------------------------
-- Speedups
----------------------------------------------------------------
local CMD_CLOAK = 37382
local CMD_FIRE_STATE = CMD.FIRE_STATE
local CMD_INSERT = CMD.INSERT
local CMD_OPT_ALT = CMD.OPT_ALT
local spGetMyTeamID = Spring.GetMyTeamID
local spGiveOrderToUnit = Spring.GiveOrderToUnit
----------------------------------------------------------------
-- Callins
----------------------------------------------------------------
function widget:Initialize()
if Spring.IsReplay() or Spring.GetGameFrame() > 0 then
widget:PlayerChanged()
end
end
function widget:PlayerChanged(playerID)
if Spring.GetSpectatingState() and Spring.GetGameFrame() > 0 then
widgetHandler:RemoveWidget(self)
end
end
function widget:GameStart()
widget:PlayerChanged()
end
function widget:UnitCommand(uID, uDefID, uTeam, cmdID, cmdParams, cmdOpts)
if cmdID < 0 then return end
if (cmdID == CMD_CLOAK) and isCommander[uDefID] and (uTeam == spGetMyTeamID()) then
widget:PlayerChanged()
if cmdParams[1] == 1 then
spGiveOrderToUnit(uID, CMD_FIRE_STATE, {0}, 0)
spGiveOrderToUnit(uID, CMD_INSERT, {0, 0, 0}, CMD_OPT_ALT)
else
spGiveOrderToUnit(uID, CMD_FIRE_STATE, {2}, 0)
end
end
end
|
---@deprecated
---Replaced by [C_Soulbinds.GetConduitCollectionData](https://github.com/Gethe/wow-ui-source/blob/9.1.5/Interface/AddOns/Blizzard_Deprecated/Deprecated_9_0_5.lua#L29)
function C_Soulbinds.GetConduitItemLevel() end
|
local function getPickupType(i)
if i == 2 then
return 30
elseif i == 1 then
return 31
end
local w = GenerateRandomIntInRange(5, 17, _i)
if w == 8 or w == 6 then
w = 4
end
return w
end
local function createPickup(ptype, etype, unk, x, y, z)
if ptype == 30 then
CreatePickupWithAmmo(0x972daa10, etype, 0, x, y, z, _i)
elseif ptype == 31 then
CreatePickupWithAmmo(0x3fc62578, etype, 0, x, y, z, _i)
else
CreatePickupWithAmmo(GetWeapontypeModel(ptype, _i), etype, 60, x, y, z, _i)
end
end
local pickupSeed
local function createPickups()
echo("creating algo pickups\n")
SetRandomSeed(pickupSeed)
createPickup( getPickupType( 2 ), 23, 200, -563.10640000, 293.52680000, 5.65930000 )
createPickup( getPickupType( 2 ), 23, 200, 79.41570000, -839.53680000, 3.99560000 )
createPickup( getPickupType( 2 ), 23, 200, -277.35550000, -533.76340000, 3.92420000 )
createPickup( getPickupType( 2 ), 23, 200, -491.51540000, -173.97790000, 6.90340000 )
createPickup( getPickupType( 2 ), 23, 200, -235.68930000, 739.30850000, 6.12510000 )
createPickup( getPickupType( 2 ), 23, 200, -539.49120000, 1362.38800000, 16.47050000 )
createPickup( getPickupType( 2 ), 23, 200, -180.02360000, -823.41240000, 4.11750000 )
createPickup( getPickupType( 2 ), 23, 200, 173.60920000, 236.49170000, 13.76010000 )
createPickup( getPickupType( 2 ), 23, 200, 89.24590000, 1152.34900000, 13.57080000 )
createPickup( getPickupType( 2 ), 23, 200, 63.60470000, -439.60590000, 13.75830000 )
createPickup( getPickupType( 2 ), 23, 200, -226.95040000, 1714.70300000, 14.75500000 )
createPickup( getPickupType( 2 ), 23, 200, 130.44570000, 467.39240000, 13.91780000 )
createPickup( getPickupType( 2 ), 23, 200, -529.52310000, -339.29980000, 5.04460000 )
createPickup( getPickupType( 2 ), 23, 200, -477.98870000, 1707.35300000, 7.46380000 )
createPickup( getPickupType( 2 ), 23, 200, -636.54130000, -45.71210000, 3.81230000 )
createPickup( getPickupType( 2 ), 23, 200, 140.68720000, -857.79680000, 3.77320000 )
--createPickup( getPickupType( 2 ), 23, 200, -108.89000000, 64499, 4.11910000 )
createPickup( getPickupType( 2 ), 23, 200, 348.54010000, -431.52940000, 3.54320000 )
createPickup( getPickupType( 2 ), 23, 200, 166.63900000, 1080.60900000, 13.62470000 )
createPickup( getPickupType( 2 ), 23, 200, -145.57280000, 1694.71300000, 15.72350000 )
createPickup( getPickupType( 2 ), 23, 200, 64.54370000, 261.20720000, 14.53200000 )
createPickup( getPickupType( 2 ), 23, 200, -507.19360000, 533.97330000, 5.67160000 )
createPickup( getPickupType( 2 ), 23, 200, -410.23560000, -141.84080000, 11.61790000 )
createPickup( getPickupType( 2 ), 23, 200, -248.26890000, -589.95000000, 3.78540000 )
createPickup( getPickupType( 2 ), 23, 200, 115.38710000, 741.87240000, 13.56160000 )
createPickup( getPickupType( 2 ), 23, 200, 49.21290000, 1350.85200000, 15.25260000 )
createPickup( getPickupType( 2 ), 23, 200, 332.02520000, -158.35070000, 8.06910000 )
createPickup( getPickupType( 1 ), 23, 200, -462.60650000, 775.56370000, 8.98430000 )
createPickup( getPickupType( 1 ), 23, 200, -66.39730000, 1550.17700000, 17.64730000 )
createPickup( getPickupType( 1 ), 23, 200, -47.94850000, 35.91300000, 13.84780000 )
createPickup( getPickupType( 1 ), 23, 200, -210.80500000, 1410.40400000, 19.35510000 )
createPickup( getPickupType( 1 ), 23, 200, 136.81580000, 387.45690000, 14.02680000 )
createPickup( getPickupType( 1 ), 23, 200, -604.36200000, 339.06450000, 3.67190000 )
createPickup( getPickupType( 1 ), 23, 200, -135.90700000, 819.94900000, 17.62560000 )
createPickup( getPickupType( 1 ), 23, 200, -437.64390000, 430.90700000, 8.93740000 )
createPickup( getPickupType( 1 ), 23, 200, -522.79810000, 1018.30500000, 8.79210000 )
createPickup( getPickupType( 1 ), 23, 200, -593.54960000, 1165.60900000, 8.94090000 )
createPickup( getPickupType( 1 ), 23, 200, 89.78390000, 1251.53900000, 14.86610000 )
createPickup( getPickupType( 1 ), 23, 200, -108.15450000, 1271.20900000, 19.43000000 )
createPickup( getPickupType( 1 ), 23, 200, -5.26000000, -447.87000000, 13.75820000 )
createPickup( getPickupType( 1 ), 23, 200, 171.83730000, -807.45750000, 3.97040000 )
createPickup( getPickupType( 1 ), 23, 200, 0.32430000, -761.24270000, 4.08570000 )
createPickup( getPickupType( 1 ), 23, 200, -526.37620000, 593.51290000, 12.12300000 )
createPickup( getPickupType( 1 ), 23, 200, -554.97370000, 806.93090000, 8.05520000 )
createPickup( getPickupType( 1 ), 23, 200, 13.89740000, 1147.71300000, 13.24760000 )
createPickup( getPickupType( 1 ), 23, 200, 179.53490000, 691.26530000, 7.18630000 )
createPickup( getPickupType( 1 ), 23, 200, -463.63800000, 899.77910000, 8.96270000 )
createPickup( getPickupType( 1 ), 23, 200, -467.32180000, 1556.19000000, 17.47570000 )
createPickup( getPickupType( 1 ), 23, 200, -284.66330000, 1600.64600000, 19.41570000 )
createPickup( getPickupType( 1 ), 23, 200, -311.56230000, 1733.49700000, 12.12580000 )
createPickup( getPickupType( 1 ), 23, 200, -99.43640000, 1350.29900000, 19.41500000 )
createPickup( getPickupType( 1 ), 23, 200, -534.05160000, 1610.99600000, 8.39809000 )
createPickup( getPickupType( 1 ), 23, 200, 91.99830000, -318.91000000, 13.61250000 )
createPickup( getPickupType( 1 ), 23, 200, -619.61000000, -115.38000000, 5.59590000 )
createPickup( getPickupType( 1 ), 23, 200, 361.06920000, -477.77790000, 4.81800000 )
createPickup( getPickupType( 1 ), 23, 200, -404.86420000, 1487.26800000, 17.86060000 )
createPickup( getPickupType( 1 ), 23, 200, -572.86970000, 227.56950000, 3.66220000 )
createPickup( getPickupType( 0 ), 23, 200, 150.65500000, 913.75690000, 7.35240000 )
createPickup( getPickupType( 0 ), 23, 200, -151.58120000, 1004.30900000, 5.22660000 )
createPickup( getPickupType( 0 ), 23, 200, -126.16370000, 554.53360000, 13.76430000 )
createPickup( getPickupType( 0 ), 23, 200, -389.27630000, 1763.59200000, 8.23320000 )
createPickup( getPickupType( 0 ), 23, 200, -414.94510000, 376.06220000, 11.07520000 )
createPickup( getPickupType( 0 ), 23, 200, -348.11940000, 631.42010000, 13.58580000 )
createPickup( getPickupType( 0 ), 23, 200, -561.26700000, 1457.39500000, 16.53680000 )
createPickup( getPickupType( 0 ), 23, 200, -656.75510000, 1140.68700000, 8.81430000 )
createPickup( getPickupType( 0 ), 23, 200, 286.89990000, -392.37890000, 3.97690000 )
createPickup( getPickupType( 0 ), 23, 200, 267.28000000, -686.88580000, 3.87500000 )
createPickup( getPickupType( 0 ), 23, 200, 185.85650000, 801.42330000, 7.45320000 )
createPickup( getPickupType( 0 ), 23, 200, -33.85220000, 772.73390000, 13.64890000 )
createPickup( getPickupType( 0 ), 23, 200, -658.17000000, 809.31000000, 3.10420000 )
--createPickup( getPickupType( 0 ), 23, 200, 65123, 1658.10000000, 20.08190000 )
--createPickup( getPickupType( 0 ), 23, 200, 65307, 1445.20000000, 19.45000000 )
createPickup( getPickupType( 0 ), 23, 200, -579.01340000, 1414.69400000, 14.47110000 )
createPickup( getPickupType( 0 ), 23, 200, -570.93210000, 158.32300000, 3.66220000 )
createPickup( getPickupType( 0 ), 23, 200, -641.65510000, -195.11170000, 3.94450000 )
createPickup( getPickupType( 0 ), 23, 200, -373.43770000, 1563.55700000, 19.15690000 )
createPickup( getPickupType( 0 ), 23, 200, -242.26720000, -515.22510000, 3.93780000 )
createPickup( getPickupType( 0 ), 23, 200, 83.27290000, 128.63830000, 13.74580000 )
createPickup( getPickupType( 0 ), 23, 200, 100.85700000, -751.07600000, 3.95820000 )
createPickup( getPickupType( 0 ), 23, 200, 148.27850000, -520.31800000, 13.76100000 )
createPickup( getPickupType( 0 ), 23, 200, -145.85800000, -436.54300000, 13.71600000 )
createPickup( getPickupType( 0 ), 23, 200, 30.52840000, -319.98200000, 13.72060000 )
createPickup( getPickupType( 0 ), 23, 200, -121.35400000, -765.42500000, 4.20210000 )
createPickup( getPickupType( 0 ), 23, 200, -301.78400000, -408.61900000, 3.82400000 )
createPickup( getPickupType( 0 ), 23, 200, -221.12500000, -244.63100000, 13.55080000 )
createPickup( getPickupType( 0 ), 23, 200, 345.52040000, -409.60800000, 3.69260000 )
createPickup( getPickupType( 0 ), 23, 200, -187.78400000, -104.23300000, 13.59230000 )
createPickup( getPickupType( 0 ), 23, 200, 23.03970000, -41.08220000, 13.81190000 )
createPickup( getPickupType( 0 ), 23, 200, -105.90000000, 129.42250000, 13.72260000 )
createPickup( getPickupType( 0 ), 23, 200, -470.49600000, 190.20460000, 8.85820000 )
createPickup( getPickupType( 0 ), 23, 200, -108.92700000, 371.07960000, 13.80730000 )
createPickup( getPickupType( 0 ), 23, 200, -308.23960000, 455.43910000, 13.69960000 )
createPickup( getPickupType( 0 ), 23, 200, 113.34910000, 650.53870000, 13.71280000 )
createPickup( getPickupType( 0 ), 23, 200, -69.89160000, 1147.73100000, 13.76710000 )
createPickup( getPickupType( 0 ), 23, 200, 29.31370000, 761.22520000, 13.50620000 )
createPickup( getPickupType( 0 ), 23, 200, 52.12710000, 889.81030000, 13.65160000 )
createPickup( getPickupType( 0 ), 23, 200, -616.57000000, 1001.96400000, 8.91920000 )
createPickup( getPickupType( 0 ), 23, 200, -491.81600000, 949.22980000, 8.96670000 )
createPickup( getPickupType( 0 ), 23, 200, 5.79550000, 1028.96500000, 13.72000000 )
createPickup( getPickupType( 0 ), 23, 200, -542.94400000, 1303.59300000, 16.25890000 )
createPickup( getPickupType( 0 ), 23, 200, -273.10860000, 1211.38200000, 17.78520000 )
createPickup( getPickupType( 0 ), 23, 200, -292.14300000, 1331.30300000, 23.60140000 )
createPickup( getPickupType( 0 ), 23, 200, -364.25800000, 1371.32500000, 14.19140000 )
createPickup( getPickupType( 0 ), 23, 200, -34.57900000, 1410.33300000, 19.42230000 )
createPickup( getPickupType( 0 ), 23, 200, -161.42200000, 1555.53300000, 17.37360000 )
createPickup( getPickupType( 0 ), 23, 200, 210.82320000, -105.36900000, 13.76120000 )
createPickup( getPickupType( 0 ), 23, 200, -124.28630000, -530.18220000, 13.76020000 )
createPickup( getPickupType( 0 ), 23, 200, -220.20000000, -883.72000000, 3.67810000 )
createPickup( getPickupType( 0 ), 23, 200, -107.78000000, -821.86000000, 4.12670000 )
createPickup( getPickupType( 0 ), 23, 200, 78.03000000, -670.74000000, 13.76770000 )
createPickup( getPickupType( 0 ), 23, 200, 151.18900000, -613.04700000, 9.63030000 )
createPickup( getPickupType( 0 ), 23, 200, -27.54000000, -823.69000000, 4.45430000 )
createPickup( getPickupType( 0 ), 23, 200, 200.28920000, -698.77010000, 3.95350000 )
createPickup( getPickupType( 0 ), 23, 200, -195.15000000, -711.21000000, 3.96790000 )
createPickup( getPickupType( 0 ), 23, 200, 100.96000000, -512.62000000, 15.08830000 )
createPickup( getPickupType( 0 ), 23, 200, 306.47000000, -623.30000000, 4.19430000 )
createPickup( getPickupType( 0 ), 23, 200, -79.41310000, 614.20590000, 13.76610000 )
createPickup( getPickupType( 0 ), 23, 200, -385.48000000, 738.49000000, 13.76610000 )
createPickup( getPickupType( 0 ), 23, 200, -434.99950000, 1101.79400000, 9.24650000 )
createPickup( getPickupType( 0 ), 23, 200, -31.37680000, 959.19130000, 13.92130000 )
createPickup( getPickupType( 0 ), 23, 200, -268.25000000, 751.37000000, 10.86610000 )
createPickup( getPickupType( 0 ), 23, 200, -199.04800000, 880.55260000, 5.15900000 )
createPickup( getPickupType( 0 ), 23, 200, -330.31000000, 1134.31000000, 12.49350000 )
createPickup( getPickupType( 0 ), 23, 200, -174.81230000, 938.15850000, 10.64700000 )
createPickup( getPickupType( 0 ), 23, 200, -115.90590000, 1043.57100000, 5.15920000 )
createPickup( getPickupType( 0 ), 23, 200, -315.16000000, 867.71000000, 8.89900000 )
createPickup( getPickupType( 0 ), 23, 200, -564.60000000, 1183.60000000, 9.01900000 )
createPickup( getPickupType( 0 ), 23, 200, -498.02150000, 1183.31100000, 13.21080000 )
createPickup( getPickupType( 0 ), 23, 200, -414.29530000, 1365.34600000, 15.55880000 )
createPickup( getPickupType( 0 ), 23, 200, -468.98060000, 1468.96400000, 17.86100000 )
createPickup( getPickupType( 0 ), 23, 200, -112.28410000, 1672.74500000, 17.61140000 )
createPickup( getPickupType( 0 ), 23, 200, -219.91810000, 1277.23200000, 22.09290000 )
createPickup( getPickupType( 0 ), 23, 200, 2.40000000, 1197.70000000, 16.47760000 )
createPickup( getPickupType( 0 ), 23, 200, -25.70000000, 1250.90000000, 19.43250000 )
createPickup( getPickupType( 0 ), 23, 200, -65.74770000, 1498.05800000, 17.44880000 )
createPickup( getPickupType( 0 ), 23, 200, -383.30600000, 319.06300000, 13.75090000 )
--createPickup( getPickupType( 0 ), 23, 200, 65250, 344.20000000, 13.66590000 )
createPickup( getPickupType( 0 ), 23, 200, -212.60000000, 346.70000000, 14.03540000 )
createPickup( getPickupType( 0 ), 23, 200, -66.26470000, 278.22370000, 13.76360000 )
createPickup( getPickupType( 0 ), 23, 200, -181.14000000, 491.28420000, 13.71490000 )
createPickup( getPickupType( 0 ), 23, 200, -24.70000000, 405.20000000, 14.76350000 )
createPickup( getPickupType( 0 ), 23, 200, 51.61110000, 464.46720000, 13.69600000 )
createPickup( getPickupType( 0 ), 23, 200, 27.60000000, 374.20000000, 13.70190000 )
createPickup( getPickupType( 0 ), 23, 200, -603.98900000, 612.11540000, 3.85550000 )
createPickup( getPickupType( 0 ), 23, 200, -337.70000000, 215.40000000, 13.74920000 )
createPickup( getPickupType( 0 ), 23, 200, -383.50000000, 556.30000000, 13.77870000 )
createPickup( getPickupType( 0 ), 23, 200, -442.96920000, 590.37180000, 10.25190000 )
createPickup( getPickupType( 0 ), 23, 200, 141.80000000, 211.20000000, 13.76310000 )
createPickup( getPickupType( 0 ), 23, 200, -192.30000000, 162.40000000, 13.98940000 )
createPickup( getPickupType( 0 ), 23, 200, -348.60300000, -188.71300000, 13.64900000 )
createPickup( getPickupType( 0 ), 23, 200, -273.48200000, -157.81400000, 13.88300000 )
createPickup( getPickupType( 0 ), 23, 200, -117.97000000, -335.54000000, 13.73490000 )
createPickup( getPickupType( 0 ), 23, 200, -12.45000000, -218.40000000, 13.63990000 )
createPickup( getPickupType( 0 ), 23, 200, 179.94720000, -254.52090000, 11.85560000 )
createPickup( getPickupType( 0 ), 23, 200, 264.98180000, -302.83180000, 5.59270000 )
createPickup( getPickupType( 0 ), 23, 200, 162.58500000, -158.31150000, 13.92630000 )
createPickup( getPickupType( 0 ), 23, 200, 113.02140000, -39.66420000, 13.76250000 )
createPickup( getPickupType( 0 ), 23, 200, -126.60700000, -117.37200000, 13.81500000 )
createPickup( getPickupType( 0 ), 23, 200, 207.01740000, 20.70740000, 13.71320000 )
createPickup( getPickupType( 0 ), 23, 200, -254.45000000, -43.88000000, 13.76330000 )
createPickup( getPickupType( 0 ), 23, 200, -347.84500000, 105.27390000, 13.81310000 )
createPickup( getPickupType( 0 ), 23, 200, -345.03400000, -100.46700000, 13.70210000 )
createPickup( getPickupType( 0 ), 23, 200, -445.05100000, 131.98950000, 8.83120000 )
createPickup( getPickupType( 0 ), 23, 200, -490.37520000, 25.33320000, 6.86600000 )
createPickup( getPickupType( 0 ), 23, 200, -572.51200000, 86.31020000, 3.81230000 )
createPickup( getPickupType( 0 ), 23, 200, 29.85000000, -601.28000000, 13.69580000 )
createPickup( getPickupType( 0 ), 23, 200, -184.29000000, 102.09000000, 13.76770000 )
end
AddEventHandler('createGunPickups', function(seed)
pickupSeed = seed
RemoveAllPickupsOfType(23)
createPickups()
end)
|
--- - #########################################################################
---- # #
---- # Copyright (C) OpenTX #
----- # #
---- # License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html #
---- # #
---- # This program is free software; you can redistribute it and/or modify #
---- # it under the terms of the GNU General Public License version 2 as #
---- # published by the Free Software Foundation. #
---- # #
---- # This program is distributed in the hope that it will be useful #
---- # but WITHOUT ANY WARRANTY; without even the implied warranty of #
---- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
---- # GNU General Public License for more details. #
---- # #
---- #########################################################################
local version = "v2.00"
local VALUE = 0
local COMBO = 1
local COLUMN_2 = 300
local edit = false
local page = 1
local current = 1
local refreshState = 0
local refreshIndex = 0
local calibrationState = 0
local pageOffset = 0
local calibrationStep = 0
local pages = {}
local fields = {}
local modifications = {}
local wingBitmaps = {}
local mountBitmaps = {}
local margin = 1
local spacing = 8
local counter = 0
local configFields = {
{ "Wing type", COMBO, 0x80, nil, { "Normal", "Delta", "VTail" } },
{ "Mounting type", COMBO, 0x81, nil, { "Horz", "Horz rev.", "Vert", "Vert rev." } },
}
local wingBitmapsFile = { "/SCRIPTS/TOOLS/bmp/plane.bmp", "/SCRIPTS/TOOLS/bmp/delta.bmp", "/SCRIPTS/TOOLS/bmp/vtail.bmp" }
local mountBitmapsFile = { "/SCRIPTS/TOOLS/bmp/horz.bmp", "/SCRIPTS/TOOLS/bmp/horz-r.bmp", "/SCRIPTS/TOOLS/bmp/vert.bmp", "/SCRIPTS/TOOLS/bmp/vert-r.bmp" }
local settingsFields = {
{"SxR functions", COMBO, 0x9C, nil, { "Disable", "Enable" } },
{"Quick Mode:", COMBO, 0xAA, nil, { "Disable", "Enable" } },
{"CH5 mode", COMBO, 0xA8, nil, { "AIL2", "AUX1" } },
{"CH6 mode", COMBO, 0xA9, nil, { "ELE2", "AUX2" } },
{"AIL direction", COMBO, 0x82, nil, { "Normal", "Invers" }, { 255, 0 } },
{"ELE direction", COMBO, 0x83, nil, { "Normal", "Invers" }, { 255, 0 } },
{"RUD direction", COMBO, 0x84, nil, { "Normal", "Invers" }, { 255, 0 } },
{"AIL2 direction", COMBO, 0x9A, nil, { "Normal", "Invers" }, { 255, 0 } },
{"ELE2 direction", COMBO, 0x9B, nil, { "Normal", "Invers" }, { 255, 0 } },
{"AIL stab gain", VALUE, 0x85, nil, 0, 200, "%"},
{"ELE stab gain", VALUE, 0x86, nil, 0, 200, "%"},
{"RUD stab gain", VALUE, 0x87, nil, 0, 200, "%"},
{"AIL autolvl gain", VALUE, 0x88, nil, 0, 200, "%"},
{"ELE autolvl gain", VALUE, 0x89, nil, 0, 200, "%"},
{"ELE hover gain", VALUE, 0x8C, nil, 0, 200, "%"},
{"RUD hover gain", VALUE, 0x8D, nil, 0, 200, "%"},
{"AIL knife gain", VALUE, 0x8E, nil, 0, 200, "%"},
{"RUD knife gain", VALUE, 0x90, nil, 0, 200, "%"},
{"AIL autolvl offset", VALUE, 0x91, nil, -20, 20, "%", 0x6C},
{"ELE autolvl offset", VALUE, 0x92, nil, -20, 20, "%", 0x6C},
{"ELE hover offset", VALUE, 0x95, nil, -20, 20, "%", 0x6C},
{"RUD hover offset", VALUE, 0x96, nil, -20, 20, "%", 0x6C},
{"AIL knife offset", VALUE, 0x97, nil, -20, 20, "%", 0x6C},
{"RUD knife offset", VALUE, 0x99, nil, -20, 20, "%", 0x6C},
}
local calibrationFields = {
{ "X:", VALUE, 0x9E, 0, -100, 100, "%" },
{ "Y:", VALUE, 0x9F, 0, -100, 100, "%" },
{ "Z:", VALUE, 0xA0, 0, -100, 100, "%" }
}
local function drawScreenTitle(title, page, pages)
if math.fmod(math.floor(getTime() / 100), 10) == 0 then
title = version
end
if LCD_W == 480 then
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W - 40, 5, page .. "/" .. pages, MENU_TITLE_COLOR)
else
lcd.drawScreenTitle(title, page, pages)
end
end
-- Change display attribute to current field
local function addField(step)
local field = fields[current]
local min, max
if field[2] == VALUE then
min = field[5]
max = field[6]
elseif field[2] == COMBO then
min = 0
max = #(field[5]) - 1
end
if (step < 0 and field[4] > min) or (step > 0 and field[4] < max) then
field[4] = field[4] + step
end
end
-- Select the next or previous page
local function selectPage(step)
page = 1 + ((page + step - 1 + #pages) % #pages)
refreshIndex = 0
calibrationStep = 0
pageOffset = 0
end
-- Select the next or previous editable field
local function selectField(step)
current = 1 + ((current + step - 1 + #fields) % #fields)
if current > 7 + pageOffset then
pageOffset = current - 7
elseif current <= pageOffset then
pageOffset = current - 1
end
end
local function drawProgressBar()
if LCD_W == 480 then
local width = (300 * refreshIndex) / #fields
lcd.drawRectangle(100, 10, 300, 6)
lcd.drawFilledRectangle(102, 13, width, 2);
else
local width = (60 * refreshIndex) / #fields
lcd.drawRectangle(45, 1, 60, 6)
lcd.drawFilledRectangle(47, 3, width, 2);
end
end
-- Redraw the current page
local function redrawFieldsPage(event)
lcd.clear()
drawScreenTitle("SxR", page, #pages)
if refreshIndex < #fields then
drawProgressBar()
end
for index = 1, 10, 1 do
local field = fields[pageOffset + index]
if field == nil then
break
end
local attr = current == (pageOffset + index) and ((edit == true and BLINK or 0) + INVERS) or 0
lcd.drawText(1, margin + spacing * index, field[1], attr)
if field[4] == nil then
lcd.drawText(LCD_W, margin + spacing * index, "---", RIGHT + attr)
else
if field[2] == VALUE then
lcd.drawNumber(LCD_W, margin + spacing * index, field[4], RIGHT + attr)
elseif field[2] == COMBO then
if field[4] >= 0 and field[4] < #(field[5]) then
lcd.drawText(LCD_W, margin + spacing * index, field[5][1 + field[4]], RIGHT + attr)
end
end
end
end
end
local function telemetryRead(field)
return sportTelemetryPush(0x17, 0x30, 0x0C30, field)
end
local function telemetryWrite(field, value)
return sportTelemetryPush(0x17, 0x31, 0x0C30, field + value * 256)
end
local telemetryPopTimeout = 0
local function refreshNext()
if refreshState == 0 then
if calibrationState == 1 then
if telemetryWrite(0x9D, calibrationStep) == true then
refreshState = 1
calibrationState = 2
telemetryPopTimeout = getTime() + 120 -- normal delay is 500ms
end
elseif #modifications > 0 then
telemetryWrite(modifications[1][1], modifications[1][2])
modifications[1] = nil
elseif refreshIndex < #fields then
local field = fields[refreshIndex + 1]
if telemetryRead(field[3]) == true then
refreshState = 1
telemetryPopTimeout = getTime() + 80 -- normal delay is 500ms
end
end
elseif refreshState == 1 then
local physicalId, primId, dataId, value = sportTelemetryPop()
if physicalId == 0x1A and primId == 0x32 and dataId == 0x0C30 then
local fieldId = value % 256
if calibrationState == 2 then
if fieldId == 0x9D then
refreshState = 0
calibrationState = 0
calibrationStep = (calibrationStep + 1) % 7
end
else
local field = fields[refreshIndex + 1]
if fieldId == field[3] then
local value = math.floor(value / 256)
if field[3] == 0xAA then
value = bit32.band(value, 0x0001)
end
if field[3] >= 0x9E and field[3] <= 0xA0 then
local b1 = value % 256
local b2 = math.floor(value / 256)
value = b1 * 256 + b2
value = value - bit32.band(value, 0x8000) * 2
end
if field[2] == COMBO and #field == 6 then
for index = 1, #(field[6]), 1 do
if value == field[6][index] then
value = index - 1
break
end
end
elseif field[2] == VALUE and #field == 8 then
value = value - field[8] + field[5]
end
fields[refreshIndex + 1][4] = value
refreshIndex = refreshIndex + 1
refreshState = 0
end
end
elseif getTime() > telemetryPopTimeout then
fields[refreshIndex + 1][4] = nil
refreshIndex = refreshIndex + 1
refreshState = 0
calibrationState = 0
end
end
end
local function updateField(field)
local value = field[4]
if field[2] == COMBO and #field == 6 then
value = field[6][1 + value]
elseif field[2] == VALUE and #field == 8 then
value = value + field[8] - field[5]
end
modifications[#modifications + 1] = { field[3], value }
end
-- Main
local function runFieldsPage(event)
if event == EVT_VIRTUAL_EXIT then -- exit script
return 2
elseif event == EVT_VIRTUAL_ENTER then -- toggle editing/selecting current field
if fields[current][4] ~= nil then
edit = not edit
if edit == false then
updateField(fields[current])
end
end
elseif edit then
if event == EVT_VIRTUAL_INC or event == EVT_VIRTUAL_INC_REPT then
addField(1)
elseif event == EVT_VIRTUAL_DEC or event == EVT_VIRTUAL_DEC_REPT then
addField(-1)
end
else
if event == EVT_VIRTUAL_NEXT then
selectField(1)
elseif event == EVT_VIRTUAL_PREV then
selectField(-1)
end
end
redrawFieldsPage(event)
return 0
end
local function runConfigPage(event)
fields = configFields
local result = runFieldsPage(event)
if LCD_W == 128 then
local mountText = { "Label is facing the sky", "Label is facing ground", "Label is left when", "Label is right when" }
if fields[2][4] ~= nil then
lcd.drawText(1, 30, "Pins toward tail")
lcd.drawText(1, 40, mountText[1 + fields[2][4]])
if fields[2][4] > 1 then
lcd.drawText(1, 50, "looking from the tail")
end
end
else
if fields[1][4] ~= nil then
if LCD_W == 480 then
if wingBitmaps[1 + fields[1][4]] == nil then
wingBitmaps[1 + fields[1][4]] = Bitmap.open(wingBitmapsFile[1 + fields[1][4]])
end
lcd.drawBitmap(wingBitmaps[1 + fields[1][4]], 10, 90)
else
lcd.drawPixmap(20, 28, wingBitmapsFile[1 + fields[1][4]])
end
end
if fields[2][4] ~= nil then
if LCD_W == 480 then
if mountBitmaps[1 + fields[2][4]] == nil then
mountBitmaps[1 + fields[2][4]] = Bitmap.open(mountBitmapsFile[1 + fields[2][4]])
end
lcd.drawBitmap(mountBitmaps[1 + fields[2][4]], 190, 110)
else
lcd.drawPixmap(128, 28, mountBitmapsFile[1 + fields[2][4]])
end
end
end
return result
end
local function runSettingsPage(event)
fields = settingsFields
return runFieldsPage(event)
end
-- Init
local function init()
current, edit, refreshState, refreshIndex = 1, false, 0, 0
if LCD_W == 480 then
margin = 10
spacing = 20
wingBitmapsFile = { "/SCRIPTS/TOOLS/img/plane_b.png", "/SCRIPTS/TOOLS/img/delta_b.png", "/SCRIPTS/TOOLS/img/planev_b.png" }
mountBitmapsFile = { "/SCRIPTS/TOOLS/img/up.png", "/SCRIPTS/TOOLS/img/down.png", "/SCRIPTS/TOOLS/img/vert.png", "/SCRIPTS/TOOLS/img/vert-r.png" }
end
pages = {
runConfigPage,
runSettingsPage,
}
end
-- Main
local function run(event)
if event == nil then
error("Cannot be run as a model script!")
return 2
elseif event == EVT_VIRTUAL_NEXT_PAGE then
selectPage(1)
elseif event == EVT_VIRTUAL_PREV_PAGE then
killEvents(event);
selectPage(-1)
end
local result = pages[page](event)
refreshNext()
return result
end
return { init = init, run = run }
|
-- A library to allow registration of callbacks to receive
-- notifications on loot events.
local MAJOR_VERSION = "LibLootNotify-1.0"
local MINOR_VERSION = tonumber(("$Revision: 1023 $"):match("%d+")) or 0
local lib, oldMinor = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
if not lib then return end
local Debug = LibStub("LibDebug-1.0")
local AceTimer = LibStub("AceTimer-3.0")
local AceHook = LibStub("AceHook-3.0")
local AceComm = LibStub("AceComm-3.0")
AceHook:Embed(lib)
AceComm:Embed(lib)
local deformat = LibStub("LibDeformat-3.0")
local CallbackHandler = LibStub("CallbackHandler-1.0")
lib.callbacks = lib.callbacks or CallbackHandler:New(lib)
local callbacks = lib.callbacks
lib.frame = lib.frame or CreateFrame("Frame", MAJOR_VERSION .. "_Frame")
local frame = lib.frame
frame:UnregisterAllEvents()
frame:SetScript("OnEvent", nil)
-- Some tables we need to cache the contents of the loot slots
local distributionCache = {}
local distributionTimers = {}
-- Sets the timeout before emulating a loot message
local EMULATE_TIMEOUT = 5
-- Create a handle for a emulation timer
local function GenerateDistributionID(player, itemLink, quantity)
local itemid, suffixid, uniqueid = tostring(itemLink):match("|Hitem:(%d+):%d+:%d+:%d+:%d+:%d+:(\-*%d+):(\-*%d+)")
return format('%s:%s:%s',
tostring(player),
tostring(itemid..":"..uniqueid),
tostring(quantity))
end
local function ParseLootMessage(msg)
local player = UnitName("player")
local item, quantity = deformat(msg, LOOT_ITEM_SELF_MULTIPLE)
if item and quantity then
return player, item, tonumber(quantity)
end
quantity = 1
item = deformat(msg, LOOT_ITEM_SELF)
if item then
return player, item, tonumber(quantity)
end
player, item, quantity = deformat(msg, LOOT_ITEM_MULTIPLE)
if player and item and quantity then
return player, item, tonumber(quantity)
end
quantity = 1
player, item = deformat(msg, LOOT_ITEM)
return player, item, tonumber(quantity)
end
function lib.BonusMessageReceiver(prefix, message, distribution, sender)
local announce = (IsInRaid() and UnitIsGroupLeader("player"))
local command, rewardType, rewardLink, numCoins, currencyID = strsplit("^", message)
if rewardType == "item" then
EPGP:LogBonusLootRoll(sender, numCoins, rewardLink, currencyID)
if announce then
EPGP.callbacks:Fire("CoinLootGood", sender, rewardLink, numCoins)
end
elseif rewardType == "money" then
EPGP:LogBonusLootRoll(sender, numCoins, nil, currencyID)
if announce then
EPGP.callbacks:Fire("CoinLootBad", sender, numCoins)
end
end
end
local function HandleBonusLootResult(rewardType, rewardLink, rewardQuantity)
local _, numCoins = GetCurrencyInfo(currentCurrencyID or 776)
lib:SendCommMessage("EPGPBONUS", format("BONUS_LOOT_RESULT^%s^%s^%s^%s",
tostring(rewardType),
tostring(rewardLink),
tostring(numCoins),
tostring(currentCurrencyID or 0)),
"RAID", nil, "ALERT")
end
-- Just add items here; the itemLink has a unique id, so this will
-- grow slightly over time but reload will clear it.
local announcedLoot = {}
local function CorpseLootReceiver(prefix, message, distribution, sender)
announcedLoot[message] = true
end
local function HandleLootWindow()
local loot = {}
-- Don't send events if we're not in a raid or are in LFR
local _, _, diffculty = GetInstanceInfo()
if not UnitInRaid("player") or diffculty == 7 then return end
for i = 1, GetNumLootItems() do
local itemLink = GetLootSlotLink(i)
if itemLink ~= nil and announcedLoot[itemLink] == nil then
table.insert(loot, itemLink)
announcedLoot[itemLink] = true
end
end
if #loot > 0 then
Debug("loot count: %s", #loot)
EPGP.callbacks:Fire("LootEpics", loot)
end
end
local function HandleLootMessage(msg)
local player, itemLink, quantity = ParseLootMessage(msg)
if player and itemLink and quantity then
Debug('Firing LootReceived(%s, %s, %d)', player, itemLink, quantity)
-- See if we can find a timer for the out of range bug
local distributionID = GenerateDistributionID(player, itemLink, quantity)
if distributionTimers[distributionID] then
-- A timer has been found for this item, stop that timer asap
Debug('Stopping loot message emulate timer %s', distributionID)
AceTimer:CancelTimer(distributionTimers[distributionID], true)
distributionTimers[distributionID] = null
distributionCache[distributionID] = null
end
-- See if we can find a entry in the distributionCache.
-- This happens when the loot message is sent before the LOOT_SLOT_CLEARED event
local slotData = distributionCache[distributionID]
if slotData then
-- The loot message for this item has been sent before the slot cleared event.
-- Clear out the distributionCache
Debug('STOPPING all handling for %s, loot message sent before LOOT_SLOT_CLEARED.', distributionID)
distributionCache[slotData.slotID] = null
distributionCache[distributionID] = null
end
callbacks:Fire("LootReceived", player, itemLink, quantity)
end
end
local function EmulateEvent(event, ...)
for _, frame in pairs({GetFramesRegisteredForEvent(event)}) do
local func = frame:GetScript('OnEvent')
pcall(func, frame, event, ...)
end
end
--[[ BLIZZARD BUGFIX: Looter out of range
For a long time there has been a bug when people
that receive masterloot but they're out of range
of the Master Looter (ML), the ML doesn't receive
the 'player X receives Item Y.' message. The code
below tries to fix this problem by hooking the
GiveMasterLoot() function and remembering to which
player the ML tried to send the loot. The ML always
receives the LOOT_SLOT_CLEARED events, so we can
safely assume that the last player the ML tried to
send to loot to, is the one who received the item.
This obviously only works when using master loot, not
group loot.
]]--
-- Triggers when MasterLoot has been handed out but
-- no loot message has been received within the timeframe
local function OnLootTimer(slotData)
local candidate = slotData.candidate
local itemLink = slotData.itemLink
local quantity = slotData.quantity
local distributionID = slotData.distributionID
if not distributionID then return end
distributionTimers[distributionID] = null
distributionCache[distributionID] = null
Debug('Emulating lootmessage for %s', distributionID)
print(format('No loot message received while %s received %sx%s, player was probably out of range. Emulating loot message locally:',
candidate,
itemLink,
quantity))
-- Emulate the event so other addons can benefit from it aswell.
if quantity == 1 then
EmulateEvent('CHAT_MSG_LOOT', LOOT_ITEM:format(candidate, itemLink), '', '', '', '')
else
EmulateEvent('CHAT_MSG_LOOT', LOOT_ITEM_MULTIPLE:format(candidate, itemLink, quantity), '', '', '', '')
end
end
--- This handler gets called when a loot slot gets cleared.
-- This is where we detect who got the item
local function LOOT_SLOT_CLEARED(event, slotID, ...)
-- Someone looted a slot, lets see if we have someone registered for it
local slotData = distributionCache[slotID]
if slotData then
-- Ok, we know who got the item but the server might also still send the
-- 'player X receives Item Y' message. We'll need to wait for a little while
-- and see if the server still sends us this message. If it doesn't, we should
-- emulate the message ourselves. Note that this is fairly optimized because it
-- only starts timers for loot that was handed out using GiveMasterLoot() and
-- doesn't start timers for any normal loot.
-- Fetch the name for the timer from the slotData
local distributionID = slotData.distributionID
Debug("LibLootNotify: (%s) creating timer %s", event, distributionID)
-- Schedule a timer for this loot
distributionTimers[distributionID] = AceTimer:ScheduleTimer(OnLootTimer, EMULATE_TIMEOUT, slotData)
end
-- Clear our slot entry since the slot is now empty
distributionCache[slotID] = nil
end
-- Hook the GiveMasterLoot function so we can intercept the slotID and candidate
local function GiveMasterLootHandler(slotID, candidateID, ...)
local candidate = tostring(GetMasterLootCandidate(slotID, candidateID))
local itemLink = tostring(GetLootSlotLink(slotID))
Debug("LibLootNotify: GiveMasterLoot(%s, %s)", itemLink, candidate)
local slotData = {
candidate = candidate,
itemLink = itemLink,
quantity = select(3, GetLootSlotInfo(slotID)) or 1,
slotID = slotID
}
local distributionID = GenerateDistributionID(candidate, itemLink, slotData.quantity)
slotData.distributionID = distributionID
-- Sometimes the CHAT_MSG_LOOT event is called before the LOOT_SLOT_CLEARED and sometimes
-- it's the way around. We're registering two ways of looking up the item in our table.
-- One way is by slotID and the other is by player:itemlink:quantity. These keys will never
-- overlap so it's safe to store them in the same table.
distributionCache[slotID] = slotData
distributionCache[distributionID] = slotData
end
-- Unhook the function if it's already hooked by older versions of the library
if lib:IsHooked("GiveMasterLoot") then lib:Unhook("GiveMasterLoot") end
lib:Hook("GiveMasterLoot", GiveMasterLootHandler, true)
-- There's no need to wipe the tables on the LOOT_CLOSED event,
-- the LOOT_SLOT_CLEARED and CHAT_MSG_LOOT events will clear the
-- table keys themselves.
--[[###############################################--
REGISTER EVENTS
--###############################################]]--
frame:RegisterEvent("CHAT_MSG_LOOT")
frame:RegisterEvent("LOOT_SLOT_CLEARED")
frame:RegisterEvent("LOOT_OPENED")
frame:RegisterEvent("BONUS_ROLL_RESULT")
frame:RegisterEvent("SPELL_CONFIRMATION_PROMPT")
lib:RegisterComm("EPGPBONUS", lib.BonusMessageReceiver)
lib:RegisterComm("EPGPCORPSELOOT", CorpseLootReceiver)
local currentCurrencyID = nil
frame:SetScript("OnEvent",
function(self, event, ...)
if event == "CHAT_MSG_LOOT" then
HandleLootMessage(...)
elseif event == "LOOT_OPENED" then
HandleLootWindow(...)
elseif event == "LOOT_SLOT_CLEARED" then
LOOT_SLOT_CLEARED(event, ...)
elseif event == "BONUS_ROLL_RESULT" then
HandleBonusLootResult(...)
elseif event == "SPELL_CONFIRMATION_PROMPT" then
local spellID, confirmType, text, duration, currencyID = ...;
if confirmType == CONFIRMATION_PROMPT_BONUS_ROLL then
currentCurrencyID = currencyID
end
end
end)
frame:Show()
--[[###############################################--
UNIT TESTS
--###############################################]]--
function lib:DebugTest()
EmulateEvent('CHAT_MSG_LOOT',
LOOT_ITEM:format(UnitName('player'),
select(2, GetItemInfo(40592))),
'', '', '', '')
EmulateEvent('CHAT_MSG_LOOT',
LOOT_ITEM_SELF:format(select(2, GetItemInfo(32386))),
'', '', '', '')
EmulateEvent('CHAT_MSG_LOOT',
LOOT_ITEM_SELF:format(select(2, GetItemInfo(43954))),
'', '', '', '')
end
-- Print the content of the distribution caches
function lib:PrintDistributionCaches()
Debug('distributionCache:')
for id=1, 20 do
local data = distributionCache[id]
if data then Debug(' - %s :: %s', id, data.distributionID) end
end
for id, data in pairs(distributionCache) do
if data then Debug(' - %s :: %s', id, data.distributionID) end
end
Debug('distributionTimers:')
for id, data in pairs(distributionTimers) do
Debug(' - %s :: %s', id, tostring(data))
end
end
-- This tests all the possible situations for the loot detection patch.
function lib:LootTest()
-- Make a little array of itemlinks for testing purposes.
local items = {40592, 32386, 40244}
for id, itemID in pairs(items) do
local item = select(2, GetItemInfo(itemID))
if not item then return print(format('DEBUG ITEM %d NOT FOUND!', itemID)) end
items[id] = item
end
-- Backup all the functions we use for the looting patch and replace them with the unit test functions
local _GetMasterLootCandidate = GetMasterLootCandidate
GetMasterLootCandidate = function() return UnitName('player') end
local _GetLootSlotLink = GetLootSlotLink
GetLootSlotLink = function(slotID) return items[slotID] end
local _GetLootSlotInfo = GetLootSlotInfo
GetLootSlotInfo = function(slotID) return 1, 1, 1, 1, 1, 1 end
local ___GiveMasterLoot = _GiveMasterLoot
_GiveMasterLoot = function() end
-- Send an item with LOOT_SLOT_CLEARED event AFTER the loot message
Debug('--- ITEM 1 ---')
GiveMasterLoot(1, 1)
HandleLootMessage(LOOT_ITEM_SELF:format(items[1]), '', '', '', '')
LOOT_SLOT_CLEARED("LOOT_SLOT_CLEARED", 1)
-- Send an item with LOOT_SLOT_CLEARED event BEFORE the loot message
Debug('--- ITEM 2 ---')
GiveMasterLoot(2, 1)
LOOT_SLOT_CLEARED("LOOT_SLOT_CLEARED", 2)
HandleLootMessage(LOOT_ITEM_SELF:format(items[2]), '', '', '', '')
-- Sends an item without sending a loot message, this will trigger the emulated loot message
Debug('--- ITEM 3 ---')
GiveMasterLoot(3, 1)
LOOT_SLOT_CLEARED("LOOT_SLOT_CLEARED", 3)
Debug('Showing tables, only %s should show up here.', items[3])
lib:PrintDistributionCaches()
-- Restore the old functions
_GiveMasterLoot = __GiveMasterLoot
GetMasterLootCandidate = _GetMasterLootCandidate
GetLootSlotLink = _GetLootSlotLink
GetLootSlotInfo = _GetLootSlotInfo
end
-- /script LibStub("LibLootNotify-1.0"):PrintDistributionCaches()
-- /script LibStub("LibLootNotify-1.0"):LootTest()
-- /script LibStub("LibLootNotify-1.0"):DebugTest()
|
--Set The Global Prefix
_G = GLOBAL
--modimporter all
--modimport("scripts/c-library/fn_init")
--Game Requirements
require = _G.require
unpack = _G.unpack
rawget = _G.rawget
getmetatable = _G.getmetatable
next = _G.next
ANCHOR_MIDDLE = 0
SCALEMODE_FILLSCREEN = 1
SCALEMODE_PROPORTIONAL = 2
SPECIAL_EVENTS = _G.SPECIAL_EVENTS
AllRecipes = _G.AllRecipes
Ingredient = _G.Ingredient
RECIPETABS = _G.RECIPETABS
Recipe = _G.Recipe
TECH = _G.TECH
MAINSCREEN_TOOL_LIST = _G.MAINSCREEN_TOOL_LIST
MAINSCREEN_TORSO_LIST = _G.MAINSCREEN_TORSO_LIST
MAINSCREEN_HAT_LIST = _G.MAINSCREEN_HAT_LIST
RESOLUTION_X = _G.RESOLUTION_X
RESOLUTION_Y = _G.RESOLUTION_Y
resolvefilepath = _G.resolvefilepath
softresolvefilepath = _G.softresolvefilepath
FRONTEND_TITLE_COLOUR = _G.FRONTEND_TITLE_COLOUR
title_x = 20
title_y = 10
ANCHOR_MIDDLE = 0
ANCHOR_BOTTOM = 0
ANCHOR_LEFT = 1
ANCHOR_RIGHT = 2
ANCHOR_TOP = 1
SCALEMODE_FILLSCREEN = 1
SCALEMODE_PROPORTIONAL = 2
BACK_BUTTON_Y = _G.BACK_BUTTON_Y
BACK_BUTTON_X = _G.BACK_BUTTON_X
GOLD = _G.GOLD
MOVE_DOWN = _G.MOVE_DOWN
MOVE_UP = _G.MOVE_UP
MOVE_RIGHT = _G.MOVE_RIGHT
MOVE_LEFT = _G.MOVE_LEFT
FRONTEND_PORTAL_COLOUR = _G.FRONTEND_PORTAL_COLOUR
BUTTONFONT = _G.BUTTONFONT
TALKINGFONT = _G.TALKINGFONT
NEWFONT = _G.NEWFONT
NEWFONT_OUTLINE = _G.NEWFONT_OUTLINE
MAX_CHAT_INPUT_LENGTH = _G.MAX_CHAT_INPUT_LENGTH
--Mod Stuff
KnownModIndex = _G.KnownModIndex
--Ingame Stuff
TheFrontEnd = _G.TheFrontEnd
TheWorld = _G.TheWorld
TheSim = _G.TheSim
TheNet = _G.TheNet
TheInput = _G.TheInput
SetPause = _G.SetPause
GetClosestInstWithTag = _G.GetClosestInstWithTag
SetDebugEntity = _G.SetDebugEntity
TUNING = _G.TUNING
TheMixer = _G.TheMixer
SpawnPrefab = _G.SpawnPrefab
SetSharedLootTable = _G.SetSharedLootTable
Vector3 = _G.Vector3
SEASONS = _G.SEASONS
FUELTYPE = _G.FUELTYPE
ACTIONS = _G.ACTIONS
GetTime = _G.GetTime
AllPlayers = _G.AllPlayers
STRINGS = _G.STRINGS
TheInputProxy = _G.TheInputProxy
FADE_IN = _G.FADE_IN
WORLD_FESTIVAL_EVENT = _G.WORLD_FESTIVAL_EVENT
FESTIVAL_EVENTS = _G.FESTIVAL_EVENTS
SCREEN_FADE_TIME = _G.SCREEN_FADE_TIME
TheInventory = _G.TheInventory
FE_MUSIC = GLOBAL.FE_MUSIC
DST_CHARACTERLIST = _G.DST_CHARACTERLIST
FRONTEND_CHARACTER_FAR_COLOUR = _G.FRONTEND_CHARACTER_FAR_COLOUR
FRONTEND_SMOKE_COLOUR = _G.FRONTEND_SMOKE_COLOUR
FRAMES = _G.FRAMES
CONTROL_CANCEL = _G. CONTROL_CANCEL
CONTROL_MENU_MISC_2 = _G.CONTROL_MENU_MISC_2
CONTROL_PREVVALUE = _G.CONTROL_PREVVALUE
CONTROL_PAUSE = _G.CONTROL_PAUSE
CONTROL_ACCEPT = _G.CONTROL_ACCEPT
CONTROL_NEXTVALUE = _G.CONTROL_NEXTVALUE
BGCOLOURS = _G.BGCOLOURS
Settings = _G.Settings
DoRestart = _G.DoRestart
Profile = _G.Profile
SCROLL_REPEAT_TIME = .05
MOUSE_SCROLL_REPEAT_TIME = 0
TITLEFONT = _G.TITLEFONT
rcol = RESOLUTION_X/2 -200
lcol = -RESOLUTION_X/2 + 280
title_x = 20
title_y = 10
subtitle_offset_x = 20
subtitle_offset_y = -260
bottom_offset = 60
menuX = lcol+10
menuY = -215
GetSkinName = _G.GetSkinName
allscreens = {"options", "main", "mods", "serverlisting", "servercreation", "morgue", "collection", "mysterybox", "playersummary", "purchasepackscreen", "wardrobescreen"}
allnomain = {"options", "mods", "serverlisting", "servercreation", "morgue", "collection", "mysterybox", "playersummary"}
options = {"options"}
main = {"main"}
mods = {"mods"}
serverlisting = {"serverlisting"}
servercreation = {"servercreation"}
morgue = {"morgue"}
collection = {"collection"}
mysterybox = {"mysterybox"}
playersummary = {"playersummary"}
redux = "screens/redux/"
retro = "screens/"
--Require Stuff
require "mods"
require "playerdeaths"
require "saveindex"
require "map/extents"
require "perfutil"
require "maputil"
require "constants"
require "knownerrors"
require "usercommands"
require "builtinusercommands"
require "emotes"
require "os"
Screen = require "widgets/screen"
AnimButton = require "widgets/animbutton"
ImageButton = require "widgets/imagebutton"
Menu = require "widgets/menu"
Text = require "widgets/text"
Image = require "widgets/image"
UIAnim = require "widgets/uianim"
Widget = require "widgets/widget"
Button = require "widgets/button"
PopupDialogScreen = require "screens/redux/popupdialog"
RedeemDialog = require "screens/redeemdialog"
FestivalEventScreen = require "screens/redux/festivaleventscreen"
MovieDialog = require "screens/moviedialog"
CreditsScreen = require "screens/creditsscreen"
ModsScreen = require "screens/redux/modsscreen"
OptionsScreen = require "screens/redux/optionsscreen"
PlayerSummaryScreen = require "screens/redux/playersummaryscreen"
QuickJoinScreen = require "screens/redux/quickjoinscreen"
ServerListingScreen = require "screens/redux/serverlistingscreen"
ServerCreationScreen = require "screens/redux/servercreationscreen"
--TEMPLATES = require "widgets/redux/templates"
TEMPLATES = require "widgets/redux/templates"
TEMPLATES_OLD = require "widgets/templates"
if KnownModIndex:IsModEnabled("workshop-1386797248") then
CTEMPLATES = require "widgets/redux/ctemplates"
end
FriendsManager = require "widgets/friendsmanager"
OnlineStatus = require "widgets/onlinestatus"
ThankYouPopup = require "screens/thankyoupopup"
SkinGifts = require("skin_gifts")
Stats = require("stats")
--SPecialitys
function MakeMainMenuButton(text, onclick, tooltip)
local btn = Button()
end
function IsSpecialEventActive(event)
return WORLD_SPECIAL_EVENT == event
end
function IsAnyFestivalEventActive()
return WORLD_FESTIVAL_EVENT ~= FESTIVAL_EVENTS.NONE
end
function IsFestivalEventActive(event)
return WORLD_FESTIVAL_EVENT == event
end
function JapaneseOnPS4()
if PLATFORM=="PS4" and APP_REGION == "SCEJ" then
return true
end
return false
end
function GetPlayer()
return ThePlayer
end
function GetWorld()
return TheWorld
end
function NewUpdate(self, which, fn)
self.oldInit = self.which
self.which = function(self)
self.oldInit(self)
end
end
function ShowLoading()
if global_loading_widget then
global_loading_widget:SetEnabled(true)
end
end
--Modmain Stuff
ts = "talestone/"
--Stategraph Stuff
State = _G.State
TimeEvent = _G.TimeEvent
EventHandler = _G.EventHandler
TheCamera = _G.TheCamera
--Components stuff
FUELTYPE = _G.FUELTYPE
print("Tale Teller Loaded..")
print("Version 5.0.0")
print("Author: Matthew")
|
scrW,scrH = System:screenSize();
x0 = scrW/6;
y0 = scrH/10;
w = scrW - x0*2;
h = scrH / 3;
customError2 = CustomError(x0,y0*2 + h,w,h );
customError2:backgroundColor(0xff0000);
customError2:callback( function(tag)
print("customError2", tag);
end)
|
slot0 = type
slot1 = string.sub
slot2 = string.byte
slot3 = string.format
slot4 = string.match
slot5 = string.gmatch
slot6 = table.concat
slot7 = require("bit")
slot8 = slot7.band
slot10 = slot7.ror
slot11 = slot7.tohex
slot12 = slot7.lshift
slot13 = slot7.rshift
slot14 = slot7.arshift
slot36 = {
[0] = {
shift = 4,
mask = 9,
[9] = {
[0] = {
[0] = {
[0] = "mulNMSs",
"mlaNMSDs",
"umaalDNMS",
"mlsDNMS",
"umullDNMSs",
"umlalDNMSs",
"smullDNMSs",
"smlalDNMSs",
shift = 21,
mask = 7
},
{
[0] = "swpDMN",
false,
false,
false,
"swpbDMN",
false,
false,
false,
"strexDMN",
"ldrexDN",
"strexdDN",
"ldrexdDN",
"strexbDMN",
"ldrexbDN",
"strexhDN",
"ldrexhDN",
shift = 20,
mask = 15
},
shift = 24,
mask = 1
},
{
[0] = "strhDL",
"ldrhDL",
shift = 20,
mask = 1
},
{
[0] = "ldrdDL",
"ldrsbDL",
shift = 20,
mask = 1
},
{
[0] = "strdDL",
"ldrshDL",
shift = 20,
mask = 1
},
shift = 5,
mask = 3
},
_ = {
shift = 20,
mask = 25,
[16] = {
[0] = {
[0] = {
[0] = "mrsD",
"msrM",
shift = 21,
mask = 1
},
{
"bxM",
false,
"clzDM",
shift = 21,
mask = 3
},
{
"bxjM",
shift = 21,
mask = 3
},
{
"blxM",
shift = 21,
mask = 3
},
false,
{
[0] = "qaddDMN",
"qsubDMN",
"qdaddDMN",
"qdsubDMN",
shift = 21,
mask = 3
},
false,
{
"bkptK",
shift = 21,
mask = 3
},
shift = 4,
mask = 7
},
{
[0] = {
[0] = "smlabbNMSD",
"smlatbNMSD",
"smlabtNMSD",
"smlattNMSD",
shift = 5,
mask = 3
},
{
[0] = "smlawbNMSD",
"smulwbNMS",
"smlawtNMSD",
"smulwtNMS",
shift = 5,
mask = 3
},
{
[0] = "smlalbbDNMS",
"smlaltbDNMS",
"smlalbtDNMS",
"smlalttDNMS",
shift = 5,
mask = 3
},
{
[0] = "smulbbNMS",
"smultbNMS",
"smulbtNMS",
"smulttNMS",
shift = 5,
mask = 3
},
shift = 21,
mask = 3
},
shift = 7,
mask = 1
},
_ = {
shift = 0,
mask = 4294967295.0,
[slot9(3785359360.0)] = "nop",
_ = {
[0] = "andDNPs",
"eorDNPs",
"subDNPs",
"rsbDNPs",
"addDNPs",
"adcDNPs",
"sbcDNPs",
"rscDNPs",
"tstNP",
"teqNP",
"cmpNP",
"cmnNP",
"orrDNPs",
"movDPs",
"bicDNPs",
"mvnDPs",
shift = 21,
mask = 15
}
}
}
},
{
[16.0] = "movwDW",
mask = 31,
[20.0] = "movtDW",
shift = 20,
[22.0] = "msrNW",
[18] = {
[0] = "nopv6",
shift = 0,
_ = "msrNW",
mask = 983295
},
_ =
},
{
{
[0] = "strtDL",
"ldrtDL",
nil,
nil,
"strbtDL",
"ldrbtDL",
shift = 20,
mask = 5
},
shift = 21,
mask = 9,
_ = {
[0] = "strDL",
"ldrDL",
nil,
nil,
"strbDL",
"ldrbDL",
shift = 20,
mask = 5
}
},
{
[0] = ,
{
[0] = false,
{
[0] = "sadd16DNM",
"sasxDNM",
"ssaxDNM",
"ssub16DNM",
"sadd8DNM",
false,
false,
"ssub8DNM",
shift = 5,
mask = 7
},
{
[0] = "qadd16DNM",
"qasxDNM",
"qsaxDNM",
"qsub16DNM",
"qadd8DNM",
false,
false,
"qsub8DNM",
shift = 5,
mask = 7
},
{
[0] = "shadd16DNM",
"shasxDNM",
"shsaxDNM",
"shsub16DNM",
"shadd8DNM",
false,
false,
"shsub8DNM",
shift = 5,
mask = 7
},
false,
{
[0] = "uadd16DNM",
"uasxDNM",
"usaxDNM",
"usub16DNM",
"uadd8DNM",
false,
false,
"usub8DNM",
shift = 5,
mask = 7
},
{
[0] = "uqadd16DNM",
"uqasxDNM",
"uqsaxDNM",
"uqsub16DNM",
"uqadd8DNM",
false,
false,
"uqsub8DNM",
shift = 5,
mask = 7
},
{
[0] = "uhadd16DNM",
"uhasxDNM",
"uhsaxDNM",
"uhsub16DNM",
"uhadd8DNM",
false,
false,
"uhsub8DNM",
shift = 5,
mask = 7
},
{
[0] = "pkhbtDNMU",
false,
"pkhtbDNMU",
{
shift = 16,
[15.0] = "sxtb16DMU",
_ = "sxtab16DNMU",
mask = 15
},
"pkhbtDNMU",
"selDNM",
"pkhtbDNMU",
shift = 5,
mask = 7
},
false,
{
[0] = "ssatDxMu",
"ssat16DxM",
"ssatDxMu",
{
shift = 16,
[15.0] = "sxtbDMU",
_ = "sxtabDNMU",
mask = 15
},
"ssatDxMu",
false,
"ssatDxMu",
shift = 5,
mask = 7
},
{
[0] = "ssatDxMu",
"revDM",
"ssatDxMu",
{
shift = 16,
[15.0] = "sxthDMU",
_ = "sxtahDNMU",
mask = 15
},
"ssatDxMu",
"rev16DM",
"ssatDxMu",
shift = 5,
mask = 7
},
{
shift = 5,
mask = 7,
[3] = {
shift = 16,
[15.0] = "uxtb16DMU",
_ = "uxtab16DNMU",
mask = 15
}
},
false,
{
[0] = "usatDwMu",
"usat16DwM",
"usatDwMu",
{
shift = 16,
[15.0] = "uxtbDMU",
_ = "uxtabDNMU",
mask = 15
},
"usatDwMu",
false,
"usatDwMu",
shift = 5,
mask = 7
},
{
[0] = "usatDwMu",
"rbitDM",
"usatDwMu",
{
shift = 16,
[15.0] = "uxthDMU",
_ = "uxtahDNMU",
mask = 15
},
"usatDwMu",
"revshDM",
"usatDwMu",
shift = 5,
mask = 7
},
{
shift = 12,
mask = 15,
[15] = {
"smuadNMS",
"smuadxNMS",
"smusdNMS",
"smusdxNMS",
shift = 5,
mask = 7
},
_ = {
[0] = "smladNMSD",
"smladxNMSD",
"smlsdNMSD",
"smlsdxNMSD",
shift = 5,
mask = 7
}
},
false,
false,
false,
{
[0] = "smlaldDNMS",
"smlaldxDNMS",
"smlsldDNMS",
"smlsldxDNMS",
shift = 5,
mask = 7
},
{
[0] = {
shift = 12,
[15.0] = "smmulNMS",
_ = "smmlaNMSD",
mask = 15
},
{
shift = 12,
[15.0] = "smmulrNMS",
_ = "smmlarNMSD",
mask = 15
},
false,
false,
false,
false,
"smmlsNMSD",
"smmlsrNMSD",
shift = 5,
mask = 7
},
false,
false,
{
[0] = {
shift = 12,
[15.0] = "usad8NMS",
_ = "usada8NMSD",
mask = 15
},
shift = 5,
mask = 7
},
false,
{
nil,
"sbfxDMvw",
shift = 5,
mask = 3
},
{
nil,
"sbfxDMvw",
shift = 5,
mask = 3
},
{
[0] = {
shift = 0,
[15.0] = "bfcDvX",
_ = "bfiDMvX",
mask = 15
},
shift = 5,
mask = 3
},
{
[0] = {
shift = 0,
[15.0] = "bfcDvX",
_ = "bfiDMvX",
mask = 15
},
shift = 5,
mask = 3
},
{
nil,
"ubfxDMvw",
shift = 5,
mask = 3
},
{
nil,
"ubfxDMvw",
shift = 5,
mask = 3
},
shift = 20,
mask = 31
},
shift = 4,
mask = 1
},
{
[0] = {
[0] = "stmdaNR",
"stmNR",
{
shift = 16,
mask = 63,
_ = "stmdbNR",
[45.0] = "pushR"
},
"stmibNR",
shift = 23,
mask = 3
},
{
[0] = "ldmdaNR",
{
shift = 16,
[61.0] = "popR",
_ = "ldmNR",
mask = 63
},
"ldmdbNR",
"ldmibNR",
shift = 23,
mask = 3
},
shift = 20,
mask = 1
},
{
[0] = "bB",
"blB",
shift = 24,
mask = 1
},
{
shift = 8,
mask = 15,
[10] = {
[0] = {
[0] = "vmovFmDN",
"vstmFNdr",
shift = 23,
mask = 3,
_ = {
[0] = "vstrFdl",
{
_ = "vstmdbFNdr",
shift = 16,
[13.0] = "vpushFdr",
mask = 15
},
shift = 21,
mask = 1
}
},
{
[0] = "vmovFDNm",
{
_ = "vldmFNdr",
shift = 16,
[13.0] = "vpopFdr",
mask = 15
},
shift = 23,
mask = 3,
_ = {
[0] = "vldrFdl",
"vldmdbFNdr",
shift = 21,
mask = 1
}
},
shift = 20,
mask = 1
},
[11] = {
[0] = {
[0] = "vmovGmDN",
"vstmGNdr",
shift = 23,
mask = 3,
_ = {
[0] = "vstrGdl",
{
_ = "vstmdbGNdr",
shift = 16,
[13.0] = "vpushGdr",
mask = 15
},
shift = 21,
mask = 1
}
},
{
[0] = "vmovGDNm",
{
_ = "vldmGNdr",
shift = 16,
[13.0] = "vpopGdr",
mask = 15
},
shift = 23,
mask = 3,
_ = {
[0] = "vldrGdl",
"vldmdbGNdr",
shift = 21,
mask = 1
}
},
shift = 20,
mask = 1
},
_ = {
shift = 0,
mask = 0
}
},
{
[0] = {
[0] = {
shift = 8,
mask = 15,
[10] = {
[0] = "vmlaF.dnm",
"vmlsF.dnm",
[147456.0] = "vfnmsF.dnm",
[163840.0] = "vfmaF.dnm",
[16385.0] = "vnmlaF.dnm",
mask = 180225,
[32769.0] = "vnmulF.dnm",
[163841.0] = "vfmsF.dnm",
[32768.0] = "vmulF.dnm",
[180224.0] = "vmovF.dY",
[49153.0] = "vsubF.dnm",
shift = 6,
[16384.0] = "vnmlsF.dnm",
[49152.0] = "vaddF.dnm",
[131072.0] = "vdivF.dnm",
[147457.0] = "vfnmaF.dnm",
[180225] = {
[0] = "vmovF.dm",
"vabsF.dm",
[513.0] = "vsqrtF.dm",
[2049.0] = "vcmpeF.dm",
[4096.0] = "vcvt.f32.u32Fdm",
mask = 7681,
[4097.0] = "vcvt.f32.s32Fdm",
[2561.0] = "vcmpzeF.d",
[2048.0] = "vcmpF.dm",
[6145.0] = "vcvt.u32F.dm",
[6144.0] = "vcvtr.u32F.dm",
[2560.0] = "vcmpzF.d",
[6656.0] = "vcvtr.s32F.dm",
[6657.0] = "vcvt.s32F.dm",
shift = 7,
[512.0] = "vnegF.dm",
[3585.0] = "vcvtG.dF.m"
}
},
[11] = {
[0] = "vmlaG.dnm",
"vmlsG.dnm",
[147456.0] = "vfnmsG.dnm",
[163840.0] = "vfmaG.dnm",
[16385.0] = "vnmlaG.dnm",
mask = 180225,
[32769.0] = "vnmulG.dnm",
[163841.0] = "vfmsG.dnm",
[32768.0] = "vmulG.dnm",
[180224.0] = "vmovG.dY",
[49153.0] = "vsubG.dnm",
shift = 6,
[16384.0] = "vnmlsG.dnm",
[49152.0] = "vaddG.dnm",
[131072.0] = "vdivG.dnm",
[147457.0] = "vfnmaG.dnm",
[180225] = {
[0] = "vmovG.dm",
"vabsG.dm",
[513.0] = "vsqrtG.dm",
[2049.0] = "vcmpeG.dm",
[4096.0] = "vcvt.f64.u32GdFm",
mask = 7681,
[4097.0] = "vcvt.f64.s32GdFm",
[2561.0] = "vcmpzeG.d",
[2048.0] = "vcmpG.dm",
[6145.0] = "vcvt.u32FdG.m",
[6144.0] = "vcvtr.u32FdG.m",
[2560.0] = "vcmpzG.d",
[6656.0] = "vcvtr.s32FdG.m",
[6657.0] = "vcvt.s32FdG.m",
shift = 7,
[512.0] = "vnegG.dm",
[3585.0] = "vcvtF.dG.m"
}
}
},
{
shift = 8,
mask = 15,
[10] = {
[0] = "vmovFnD",
"vmovFDn",
mask = 15,
shift = 20,
[14.0] = "vmsrD",
[15] = {
shift = 12,
[15.0] = "vmrs",
_ = "vmrsD",
mask = 15
}
}
},
shift = 4,
mask = 1
},
"svcT",
shift = 24,
mask = 1
}
}
slot37 = {
[0] = false,
{
shift = 0,
mask = 0
},
{
shift = 0,
mask = 0
},
{
shift = 0,
mask = 0
},
false,
"blxB",
{
shift = 0,
mask = 0
},
{
shift = 0,
mask = 0
}
}
slot38 = {
[0] = "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
"r8",
"r9",
"r10",
"r11",
"r12",
"sp",
"lr",
"pc"
}
slot39 = {
[0] = "eq",
"ne",
"hs",
"lo",
"mi",
"pl",
"vs",
"vc",
"hi",
"ls",
"ge",
"lt",
"gt",
"le",
"al"
}
slot40 = {
[0] = "lsl",
"lsr",
"asr",
"ror"
}
function slot41(slot0, slot1, slot2)
slot3 = slot0.pos
slot4 = ""
if slot0.rel then
if slot0.symtab[slot0.rel] then
slot4 = "\t->" .. slot5
elseif slot0(slot0.op, 234881024) ~= 167772160 then
slot4 = "\t; 0x" .. slot1(slot0.rel)
end
end
if slot0.hexdump > 0 then
slot0.out(slot2("%08x %s %-5s %s%s\n", slot0.addr + slot3, slot1(slot0.op), slot1, slot3(slot2, ", "), slot4))
else
slot0.out(slot2("%08x %-5s %s%s\n", slot0.addr + slot3, slot1, slot3(slot2, ", "), slot4))
end
slot0.pos = slot3 + 4
end
function slot42(slot0)
return slot0(slot0, ".long", {
"0x" .. slot1(slot0.op)
})
end
function slot43(slot0, slot1, slot2)
slot3 = slot0[slot1(slot2(slot1, 16), 15)]
slot4, slot5 = nil
slot6 = slot1(slot1, 67108864) == 0
if not slot6 and slot1(slot1, 33554432) == 0 then
slot5 = slot1(slot1, 4095)
if slot1(slot1, 8388608) == 0 then
slot5 = -slot5
end
if slot3 == "pc" then
slot0.rel = slot0.addr + slot2 + 8 + slot5
end
slot5 = "#" .. slot5
elseif slot6 and slot1(slot1, 4194304) ~= 0 then
slot5 = slot1(slot1, 15) + slot1(slot2(slot1, 4), 240)
if slot1(slot1, 8388608) == 0 then
slot5 = -slot5
end
if slot3 == "pc" then
slot0.rel = slot0.addr + slot2 + 8 + slot5
end
slot5 = "#" .. slot5
else
slot5 = slot0[slot1(slot1, 15)]
if not slot6 then
if slot1(slot1, 4064) == 0 then
elseif slot1(slot1, 4064) == 96 then
slot5 = slot3("%s, rrx", slot5)
else
if slot1(slot2(slot1, 7), 31) == 0 then
slot7 = 32
end
slot5 = slot3("%s, %s #%d", slot5, slot4[slot1(slot2(slot1, 5), 3)], slot7)
end
end
if slot1(slot1, 8388608) == 0 then
slot5 = "-" .. slot5
end
end
slot4 = (slot5 ~= "#0" or slot3("[%s]", slot3)) and (slot1(slot1, 16777216) ~= 0 or slot3("[%s], %s", slot3, slot5)) and slot3("[%s, %s]", slot3, slot5)
if slot1(slot1, 18874368) == 18874368 then
slot4 = slot4 .. "!"
end
return slot4
end
function slot44(slot0, slot1, slot2)
slot3 = slot0[slot1(slot2(slot1, 16), 15)]
slot4 = slot1(slot1, 255) * 4
if slot1(slot1, 8388608) == 0 then
slot4 = -slot4
end
if slot3 == "pc" then
slot0.rel = slot0.addr + slot2 + 8 + slot4
end
if slot4 == 0 then
return slot3("[%s]", slot3)
else
return slot3("[%s, #%d]", slot3, slot4)
end
end
function slot45(slot0, slot1, slot2, slot3)
if slot1 == "s" then
return slot0("s%d", 2 * slot1(slot2(slot0, slot2), 15) + slot1(slot2(slot0, slot3), 1))
else
return slot0("d%d", slot1(slot2(slot0, slot2), 15) + slot1(slot2(slot0, slot3 - 4), 16))
end
end
function slot46(slot0)
slot7, slot10, slot9, slot8 = slot0(slot0.code, slot0.pos + 1, slot0.pos + 4)
slot7 = {}
slot8 = ""
slot9, slot10, slot11, slot12 = nil
slot0.op = slot1(slot2(slot5, 24), slot2(slot4, 16), slot2(slot3, 8), slot2)
slot0.rel = nil
slot14 = nil
if slot3(slot6, 28) == 15 then
slot14 = slot4[slot5(slot3(slot6, 25), 7)]
else
if slot13 ~= 14 then
slot8 = slot6[slot13]
end
slot14 = slot7[slot5(slot3(slot6, 25), 7)]
end
while slot8(slot14) ~= "string" do
if not slot14 then
return slot9(slot0)
end
slot14 = slot14[slot5(slot3(slot6, slot14.shift), slot14.mask)] or slot14._
end
slot10, slot11 = slot10(slot14, "^([a-z0-9]*)(.*)")
if slot11(slot16, 1, 1) == "." then
slot18, slot11 = slot10(slot11, "^([a-z0-9.]*)(.*)")
slot8 = slot8 .. slot15
end
for slot18 in slot12(slot11, ".") do
slot19 = nil
if slot18 == "D" then
slot19 = slot13[slot5(slot3(slot6, 12), 15)]
elseif slot18 == "N" then
slot19 = slot13[slot5(slot3(slot6, 16), 15)]
elseif slot18 == "S" then
slot19 = slot13[slot5(slot3(slot6, 8), 15)]
elseif slot18 == "M" then
slot19 = slot13[slot5(slot6, 15)]
elseif slot18 == "d" then
slot19 = slot14(slot6, slot12, 12, 22)
elseif slot18 == "n" then
slot19 = slot14(slot6, slot12, 16, 7)
elseif slot18 == "m" then
slot19 = slot14(slot6, slot12, 0, 5)
elseif slot18 == "P" then
if slot5(slot6, 33554432) ~= 0 then
slot19 = slot15(slot5(slot6, 255), 2 * slot5(slot3(slot6, 8), 15))
else
slot19 = slot13[slot5(slot6, 15)]
if slot5(slot6, 4080) ~= 0 then
slot7[#slot7 + 1] = slot19
slot20 = slot16[slot5(slot3(slot6, 5), 3)]
slot21 = nil
if slot5(slot6, 3984) == 0 then
if slot20 == "ror" then
slot20 = "rrx"
else
slot21 = "#32"
end
else
slot21 = (slot5(slot6, 16) == 0 and "#" .. slot5(slot3(slot6, 7), 31)) or slot13[slot5(slot3(slot6, 8), 15)]
end
if slot10 == "mov" then
slot10 = slot20
slot19 = slot21
elseif slot21 then
slot19 = slot17("%s %s", slot20, slot21)
else
slot19 = slot20
end
end
end
elseif slot18 == "L" then
slot19 = slot18(slot0, slot6, slot1)
elseif slot18 == "l" then
slot19 = slot19(slot0, slot6, slot1)
elseif slot18 == "B" then
slot20 = slot0.addr + slot1 + 8 + slot20(slot2(slot6, 8), 6)
if slot13 == 15 then
slot20 = slot20 + slot5(slot3(slot6, 23), 2)
end
slot0.rel = slot20
slot19 = "0x" .. slot21(slot20)
elseif slot18 == "F" then
slot12 = "s"
elseif slot18 == "G" then
slot12 = "d"
elseif slot18 == "." then
slot8 = slot8 .. ((slot12 == "s" and ".f32") or ".f64")
elseif slot18 == "R" then
if slot5(slot6, 2097152) ~= 0 and #slot7 == 1 then
slot7[1] = slot7[1] .. "!"
end
slot20 = {}
for slot24 = 0, 15, 1 do
if slot5(slot3(slot6, slot24), 1) == 1 then
slot20[#slot20 + 1] = slot13[slot24]
end
end
slot19 = "{" .. slot22(slot20, ", ") .. "}"
elseif slot18 == "r" then
if slot5(slot6, 2097152) ~= 0 and #slot7 == 2 then
slot7[1] = slot7[1] .. "!"
end
slot20 = tonumber(slot11(slot9, 2))
slot21 = slot5(slot6, 255)
if slot12 == "d" then
slot21 = slot3(slot21, 1)
end
slot7[#slot7] = slot17("{%s-%s%d}", slot9, slot12, (slot20 + slot21) - 1)
elseif slot18 == "W" then
slot19 = slot5(slot6, 4095) + slot5(slot3(slot6, 4), 61440)
elseif slot18 == "T" then
slot19 = "#0x" .. slot21(slot5(slot6, 16777215), 6)
elseif slot18 == "U" then
if slot5(slot3(slot6, 7), 31) == 0 then
slot19 = nil
end
elseif slot18 == "u" then
slot19 = slot5(slot3(slot6, 7), 31)
if slot5(slot6, 64) == 0 then
if slot19 == 0 then
slot19 = nil
else
slot19 = "lsl #" .. slot19
end
elseif slot19 == 0 then
slot19 = "asr #32"
else
slot19 = "asr #" .. slot19
end
elseif slot18 == "v" then
slot19 = slot5(slot3(slot6, 7), 31)
elseif slot18 == "w" then
slot19 = slot5(slot3(slot6, 16), 31)
elseif slot18 == "x" then
slot19 = slot5(slot3(slot6, 16), 31) + 1
elseif slot18 == "X" then
slot19 = slot5(slot3(slot6, 16), 31) - slot9 + 1
elseif slot18 == "Y" then
slot19 = slot5(slot3(slot6, 12), 240) + slot5(slot6, 15)
elseif slot18 == "K" then
slot19 = "#0x" .. slot21(slot5(slot3(slot6, 4), 65520) + slot5(slot6, 15), 4)
elseif slot18 == "s" and slot5(slot6, 1048576) ~= 0 then
slot8 = "s" .. slot8
end
if slot19 then
slot9 = slot19
if slot8(slot19) == "number" then
slot19 = "#" .. slot19
end
slot7[#slot7 + 1] = slot19
end
end
return slot23(slot0, slot10 .. slot8, slot7)
end
function slot47(slot0, slot1, slot2)
slot3 = (slot2 and (slot1 or 0) + slot2) or #slot0.code
slot0.pos = slot1 or 0
slot0.rel = nil
while slot0.pos < slot3 do
slot0(slot0)
end
end
return {
create = function (slot0, slot1, slot2)
return {
code = slot0,
addr = slot1 or 0,
out = slot2 or io.write,
symtab = {},
disass = slot0,
hexdump = 8
}
end,
disass = function (slot0, slot1, slot2)
slot0(slot0, slot1, slot2):disass()
end,
regname = function (slot0)
if slot0 < 16 then
return slot0[slot0]
end
return "d" .. slot0 - 16
end
}
|
--[[
Image coordinates/cropping transformation functions.
]]
require 'image'
-------------------------------------------------------------------------------
-- Coordinate transformation
-------------------------------------------------------------------------------
function getTransform(center, scale, rot, res)
local h = 200 * scale
local t = torch.eye(3)
-- Scaling
t[1][1] = res / h
t[2][2] = res / h
-- Translation
t[1][3] = res * (-center[1] / h + .5)
t[2][3] = res * (-center[2] / h + .5)
-- Rotation
if rot ~= 0 then
rot = -rot
local r = torch.eye(3)
local ang = rot * math.pi / 180
local s = math.sin(ang)
local c = math.cos(ang)
r[1][1] = c
r[1][2] = -s
r[2][1] = s
r[2][2] = c
-- Need to make sure rotation is around center
local t_ = torch.eye(3)
t_[1][3] = -res/2
t_[2][3] = -res/2
local t_inv = torch.eye(3)
t_inv[1][3] = res/2
t_inv[2][3] = res/2
t = t_inv * r * t_ * t
end
return t
end
function transform(pt, center, scale, rot, res, invert)
local pt_ = torch.ones(3)
pt_[1],pt_[2] = pt[1]-1,pt[2]-1
local t = getTransform(center, scale, rot, res)
if invert then
t = torch.inverse(t)
end
local new_point = (t*pt_):sub(1,2)
return new_point:int():add(1)
end
function transformBenchmark(pt, center, scale, rot, res, invert)
local pt_ = torch.ones(3)
pt_[1] = pt[1]
pt_[2] = pt[2]
local t = getTransform(center, scale, rot, res)
if invert then
t = torch.inverse(t)
end
local new_point = (t*pt_):sub(1,2):int()
return new_point
end
-------------------------------------------------------------------------------
-- Cropping
-------------------------------------------------------------------------------
function checkDims(dims)
return dims[3] < dims[4] and dims[5] < dims[6]
end
function crop2(img, center, scale, rot, res)
local ndim = img:nDimension()
if ndim == 2 then img = img:view(1,img:size(1),img:size(2)) end
local ht,wd = img:size(2), img:size(3)
local tmpImg,newImg = img, torch.zeros(img:size(1), res, res)
-- Modify crop approach depending on whether we zoom in/out
-- This is for efficiency in extreme scaling cases
local scaleFactor = (200 * scale) / res
if scaleFactor < 2 then
scaleFactor = 1
else
local newSize = math.floor(math.max(ht,wd) / scaleFactor)
if newSize < 2 then
-- Zoomed out so much that the image is now a single pixel or less
if ndim == 2 then
newImg = newImg:view(newImg:size(2),newImg:size(3))
end
return newImg
else
tmpImg = image.scale(img,newSize)
ht,wd = tmpImg:size(2),tmpImg:size(3)
end
end
-- Calculate upper left and bottom right coordinates defining crop region
local c,s = center:float()/scaleFactor, scale/scaleFactor
local ul = transform({1,1}, c, s, 0, res, true)
local br = transform({res+1,res+1}, c, s, 0, res, true)
if scaleFactor >= 2 then br:add(-(br - ul - res)) end
-- If the image is to be rotated, pad the cropped area
local pad = math.ceil(torch.norm((ul - br):float())/2 - (br[1]-ul[1])/2)
if rot ~= 0 then ul:add(-pad); br:add(pad) end
-- Define the range of pixels to take from the old image
local old_ = {1,-1,math.max(1, ul[2]), math.min(br[2], ht+1) - 1,
math.max(1, ul[1]), math.min(br[1], wd+1) - 1}
-- And where to put them in the new image
local new_ = {1,-1,math.max(1, -ul[2] + 2), math.min(br[2], ht+1) - ul[2],
math.max(1, -ul[1] + 2), math.min(br[1], wd+1) - ul[1]}
-- Initialize new image and copy pixels over
local newImg = torch.zeros(img:size(1), br[2] - ul[2], br[1] - ul[1])
if not pcall(function() newImg:sub(unpack(new_)):copy(tmpImg:sub(unpack(old_))) end) then
print("Error occurred during crop!")
return nil
end
if rot ~= 0 then
-- Rotate the image and remove padded area
newImg = image.rotate(newImg, rot * math.pi / 180, 'bilinear')
newImg = newImg:sub(1,-1,pad+1,newImg:size(2)-pad,pad+1,newImg:size(3)-pad):clone()
end
if scaleFactor < 2 then newImg = image.scale(newImg,res,res) end
if ndim == 2 then newImg = newImg:view(newImg:size(2),newImg:size(3)) end
return newImg
end
------------------------------------------------------------------------------------------------------------
function random_crop(img, width, height, iW, iH)
return img[{{}, {iW, iW+width -1}, {iH, iH + height -1}}]
end
------------------------------------------------------------------------------------------------------------
function resize_image(input, size, interpolation)
local interpolation = interpolation or 'bicubic'
local w, h = input:size(3), input:size(2)
if (w <= h and w == size) or (h <= w and h == size) then
return input
end
if w < h then
return image.scale(input, size, h/w * size, interpolation)
else
return image.scale(input, w/h * size, size, interpolation)
end
end
-------------------------------------------------------------------------------
-- Flipping functions
-------------------------------------------------------------------------------
function flip(x)
local y = torch.FloatTensor(x:size())
for i = 1, x:size(1) do
image.hflip(y[i], x[i]:float())
end
return y:typeAs(x)
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.