content
stringlengths
5
1.05M
local function recursive_tbl_update(base, new) if new == nil then new = {} end for key, value in pairs(new) do if type(base[key]) == 'table' then recursive_tbl_update(base[key], value) else base[key] = value end end end return { recursive_tbl_update = recursive_tbl_update, }
ring_rifle = { minimumLevel = 0, maximumLevel = -1, customObjectName = "Cad Banes Luck", directObjectTemplate = "object/tangible/wearables/ring/aakuan_ring.iff", craftingValues = {}, customizationStringNames = {}, customizationValues = {}, skillMods = { {"rifle_accuracy", 25}, {"rifle_hit_while_moving", 25}, {"rifle_speed", 25}, {"steadyaim", 25}, {"dodge", 15}, {"counterattack", 15}, } } addLootItemTemplate("ring_rifle", ring_rifle)
local hibernate = "hibernate.cfg.xml" -------------------------------------------------------------------------------- local cfgfile = io.open(hibernate, "r") local buffer = cfgfile:read("*a") cfgfile:close() local host, database = buffer:match('<property name="hibernate.connection.url">jdbc:mysql://(%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?)/(%a*)</property>') local user = buffer:match('<property name="hibernate.connection.username">(%a*)</property>') local password = buffer:match('<property name="hibernate.connection.password">([A-Za-z0-9+/]*=?=?)</property>') local base64 = require("base64") return { host = host, database = database, user = user, password = base64.decode(password), unit = "78455970", }
ai = {lockX=0,lockY=0,distance = 10,aiTimer=0,maxAi=.05, floor, ceiling, flapTimer=0, maxFlap =0.2} function ai:lock(x,y) self.lockX, self.lockY = x,y end function ai:update(x,y,movement,dt) self.aiTimer = self.aiTimer+dt self.flapTimer = self.flapTimer+dt if self.aiTimer >= self.maxAi then self.aiTimer = 0 if movement == "right" then x=x+(physics.velocity*dt)*5 end if movement == "left" then x=x-(physics.velocity*dt)*5 end if movement == "lock" then if x > self.lockX then x = x - (physics.velocity*dt)*5 end if x < self.lockX then x = x + (physics.velocity*dt)*5 end if y > self.lockY then y = y - (physics.jump*dt)*5 end if y < self.lockY then y = y + (physics.jump*dt)*5 end --[[ --check every 3 seconds if arr.y > floor - border then -- if getting too close to the ground arr.y-- end -- do same for ceiling ]] end if self.flapTimer > self.maxFlap then y = y - (physics.jump*dt)*10 self.flapTimer = 0 end end return x,y end
local function Precursors(client, team) local teamNumber = tonumber(team) if not teamNumber then --teamNumber = client:GetTeamNumber() Log("Need team number") end GetGamerules():SwitchTeamType(teamNumber, kPrecursorTeamType) end CreateServerAdminCommand("Console_precursors", Precursors, "Sets a team to precursors")
local main = {} local json = require "dkjson" local lunardrink = require "lunardrink" function main.index(page) page:redirect('index.html') end function main.make(page) local drink = page.GET.drink or "maitai" local tbl = lunardrink.mix_drink(drink) local str = json.encode(tbl) page:enable_cors() page.r.content_type = 'application/json' page:write(str) end return main
---@class Clothing.ClothingPatch : zombie.inventory.types.Clothing.ClothingPatch ---@field public tailorLvl int ---@field public fabricType int ---@field public scratchDefense int ---@field public biteDefense int ---@field public hasHole boolean ---@field public conditionGain int Clothing_ClothingPatch = {} ---@public ---@param arg0 ByteBuffer ---@param arg1 boolean ---@return void function Clothing_ClothingPatch:save_old(arg0, arg1) end ---@public ---@param arg0 ByteBuffer ---@param arg1 int ---@return void function Clothing_ClothingPatch:load(arg0, arg1) end ---@public ---@param arg0 ByteBuffer ---@param arg1 int ---@param arg2 boolean ---@return void function Clothing_ClothingPatch:load_old(arg0, arg1, arg2) end ---@public ---@return int function Clothing_ClothingPatch:getBiteDefense() end ---@public ---@return int function Clothing_ClothingPatch:getFabricType() end ---@public ---@param arg0 ByteBuffer ---@param arg1 boolean ---@return void function Clothing_ClothingPatch:save(arg0, arg1) end ---@public ---@return int function Clothing_ClothingPatch:getScratchDefense() end ---@public ---@return String function Clothing_ClothingPatch:getFabricTypeName() end
local ReplicatedStorage = game:GetService("ReplicatedStorage") local UserInputService = game:GetService("UserInputService") local GuiService = game:GetService("GuiService") local common = ReplicatedStorage.common local lib = ReplicatedStorage.lib local event = ReplicatedStorage.event local PizzaAlpaca = require(lib.PizzaAlpaca) local Platform = PizzaAlpaca.GameModule:extend("Platform") function Platform:create() self.usingController = GuiService:IsTenFootInterface() end function Platform:isUsingController() return self.usingController end function Platform:init() UserInputService.LastInputTypeChanged:connect(function(newType) self.usingController = newType == Enum.UserInputType.Gamepad1 end) end return Platform
ENT.Base = "aw_weapon_base" ENT.Type = "anim" ENT.Author = "The HellBox" ENT.Spawnable = false ENT.ShootingAngle = Angle() ENT.ShootingOffset = 30 ENT.AmmoAmount = 1 ENT.Cooldown = 3 function ENT:PostSetupDataTables() self:NetworkVar( "Int", 3, "HookState" ) end
local cjson = require("cjson"); local redis = require("resty.redis"); local misc = require("misc"); local main = function () local rsp = {}; ngx.header["Access-Control-Allow-Origin"] = "*"; if "POST" ~= ngx.req.get_method() then rsp["result"] = "405"; rsp["message"] = "method not allowed"; ngx.print(cjson.encode(rsp)); return; end local h = ngx.req.get_headers() for k, v in pairs(h) do ngx.log(ngx.DEBUG, k, ": ", v); end local data = ngx.req.get_body_data(); local args, err = ngx.req.get_post_args(); if table.is_empty(args) then ngx.log(ngx.DEBUG, "failed to get post args:", err); rsp["result"] = "406"; rsp["message"] = "missing arguments"; ngx.print(cjson.encode(rsp)); return; end local data = {}; data["sessionid"] = "1234567890abcdefgh"; rsp["result"] = "200"; rsp["message"] = "success"; rsp["data"] = data; ngx.print(cjson.encode(rsp)); end main();
require('colorizer').setup { 'css'; 'scss'; 'javascript'; 'json'; 'yaml'; html = { mode = 'foreground'; } }
return { id = "wcheadphones", name = "Workclock's Headphones", description = "For noobs.", type = "hat", rarity = 3, hidden = false, }
-- state variables local speed = 0 local strafespeed = 0 local rotX, rotY = 0,0 local velocityX, velocityY, velocityZ local startX, startY, startZ -- configurable parameters local options = { invertMouseLook = false, normalMaxSpeed = 2, slowMaxSpeed = 0.2, fastMaxSpeed = 12, smoothMovement = true, acceleration = 0.3, decceleration = 0.15, mouseSensitivity = 0.3, maxYAngle = 188 } local mouseFrameDelay = 0 local rootElement = getRootElement() local localPlayer = getLocalPlayer() local getKeyState = getKeyState do local mta_getKeyState = getKeyState function getKeyState(key) if isMTAWindowActive() then return false else return mta_getKeyState(key) end end end -- PRIVATE local function freecamFrame () -- work out an angle in radians based on the number of pixels the cursor has moved (ever) local cameraAngleX = rotX local cameraAngleY = rotY local freeModeAngleZ = math.sin(cameraAngleY) local freeModeAngleY = math.cos(cameraAngleY) * math.cos(cameraAngleX) local freeModeAngleX = math.cos(cameraAngleY) * math.sin(cameraAngleX) local camPosX, camPosY, camPosZ = getCameraMatrix() -- calculate a target based on the current position and an offset based on the angle local camTargetX = camPosX + freeModeAngleX * 100 local camTargetY = camPosY + freeModeAngleY * 100 local camTargetZ = camPosZ + freeModeAngleZ * 100 -- Work out the distance between the target and the camera (should be 100 units) local camAngleX = camPosX - camTargetX local camAngleY = camPosY - camTargetY local camAngleZ = 0 -- we ignore this otherwise our vertical angle affects how fast you can strafe -- Calulcate the length of the vector local angleLength = math.sqrt(camAngleX*camAngleX+camAngleY*camAngleY+camAngleZ*camAngleZ) -- Normalize the vector, ignoring the Z axis, as the camera is stuck to the XY plane (it can't roll) local camNormalizedAngleX = camAngleX / angleLength local camNormalizedAngleY = camAngleY / angleLength local camNormalizedAngleZ = 0 -- We use this as our rotation vector local normalAngleX = 0 local normalAngleY = 0 local normalAngleZ = 1 -- Perform a cross product with the rotation vector and the normalzied angle local normalX = (camNormalizedAngleY * normalAngleZ - camNormalizedAngleZ * normalAngleY) local normalY = (camNormalizedAngleZ * normalAngleX - camNormalizedAngleX * normalAngleZ) local normalZ = (camNormalizedAngleX * normalAngleY - camNormalizedAngleY * normalAngleX) -- Update the target based on the new camera position (again, otherwise the camera kind of sways as the target is out by a frame) camTargetX = camPosX + freeModeAngleX * 100 camTargetY = camPosY + freeModeAngleY * 100 camTargetZ = camPosZ + freeModeAngleZ * 100 -- Set the new camera position and target setCameraMatrix ( camPosX, camPosY, camPosZ, camTargetX, camTargetY, camTargetZ ) setElementPosition ( localPlayer, camPosX, camPosY, camPosZ ) end local function freecamMouse (cX,cY,aX,aY) --ignore mouse movement if the cursor or MTA window is on --and do not resume it until at least 5 frames after it is toggled off --(prevents cursor mousemove data from reaching this handler) if isCursorShowing() or isMTAWindowActive() then mouseFrameDelay = 5 return elseif mouseFrameDelay > 0 then mouseFrameDelay = mouseFrameDelay - 1 return end -- how far have we moved the mouse from the screen center? local width, height = guiGetScreenSize() aX = aX - width / 2 aY = aY - height / 2 --invert the mouse look if specified if options.invertMouseLook then aY = -aY end rotX = rotX + aX * options.mouseSensitivity * 0.01745 rotY = rotY - aY * options.mouseSensitivity * 0.01745 local PI = math.pi if rotX > PI then rotX = rotX - 2 * PI elseif rotX < -PI then rotX = rotX + 2 * PI end if rotY > PI then rotY = rotY - 2 * PI elseif rotY < -PI then rotY = rotY + 2 * PI end -- limit the camera to stop it going too far up or down - PI/2 is the limit, but we can't let it quite reach that or it will lock up -- and strafeing will break entirely as the camera loses any concept of what is 'up' if rotY < -PI / 2.05 then rotY = -PI / 2.05 elseif rotY > PI / 2.05 then rotY = PI / 2.05 end end -- PUBLIC function getFreecamVelocity() return velocityX,velocityY,velocityZ end -- params: x, y, z sets camera's position (optional) function setFreecamEnabled (x, y, z) startX, startY, startZ = getElementPosition(localPlayer) addEventHandler("onClientRender", rootElement, freecamFrame) addEventHandler("onClientCursorMove",rootElement, freecamMouse) setElementData(localPlayer, "freecamTV:state", true) setPedWeaponSlot(localPlayer, 0) setElementPosition(localPlayer, x, y, z) setCameraMatrix(x, y, z, x - 100, y - 30, z - 30) toggleAllControls(false, true, false) return true end -- param: dontChangeFixedMode leaves toggleCameraFixedMode alone if true, disables it if false or nil (optional) function setFreecamDisabled() velocityX,velocityY,velocityZ = 0,0,0 speed = 0 strafespeed = 0 removeEventHandler("onClientRender", rootElement, freecamFrame) removeEventHandler("onClientCursorMove",rootElement, freecamMouse) setElementData(localPlayer, "freecamTV:state", false) setCameraTarget(localPlayer, localPlayer) toggleAllControls(true) setElementPosition(localPlayer, startX, startY, startZ) return true end function isFreecamEnabled() return getElementData(localPlayer,"freecamTV:state") end function getFreecamOption(theOption, value) return options[theOption] end function setFreecamOption(theOption, value) if options[theOption] ~= nil then options[theOption] = value return true else return false end end addEvent("doSetFreecamEnabledTV", true) addEventHandler("doSetFreecamEnabledTV", rootElement, setFreecamEnabled) addEvent("doSetFreecamDisabledTV", true) addEventHandler("doSetFreecamDisabledTV", rootElement, setFreecamDisabled) addEvent("doSetFreecamOptionTV", true) addEventHandler("doSetFreecamOptionTV", rootElement, setFreecamOption) function onStart() for k, v in pairs(getElementsByType("player")) do if getElementData(v, "freecamTV:state") == true then setElementCollisionsEnabled(v, false) end end end addEventHandler("onClientResourceStart", getResourceRootElement(), onStart) function onDataChange(name) if getElementType(source) == "player" and name == "freecamTV:state" then setElementCollisionsEnabled(source, not getElementData(source, "freecamTV:state")) end end addEventHandler("onClientElementDataChange", rootElement, onDataChange)
NPC = {} NPC.Jobs = {} NPC.Jobs.ValidJobs = { ["unemployed"] = { name = "Unemployed", paycheck = 10 }, ["ems"] = { name = "EMS", paycheck = 150, whitelisted = false, ranks = { [1] = "EMT", [2] = "Paramedic", [3] = "Lieutenant of EMS", [4] = "Assistant Chief", [5] = "Chief of EMS" }, }, ["police"] = { name = "Police officer", paycheck = 150, whitelisted = false, ranks = { [1] = "Cadet", [2] = "Trooper", [3] = "Corporal", [4] = "Sergeant", [5] = "Staff Sergeant", [6] = "Inspector", [7] = "Lieutenant", [8] = "Captain", [9] = "Major", [10] = "Commander", [11] = "Lieutenant Colonel", [12] = "Assistant Chief", [13] = "Chief of Police" } }, ["towtruck"] = { name = "Tow Trucker", paycheck = 20 }, ["foodtruck"] = { name = "Food Truck", paycheck = 50 }, ["taxi"] = { name = "Taxi driver", paycheck = 20 }, ["trucker"] = { name = "Delivery Job", paycheck = 10 }, ["entertainer"] = { name = "Entertainer", paycheck = 10 }, ["news"] = { name = "News Reporter", paycheck = 60 }, ["defender"] = { name = "Public Defender", paycheck = 100 }, ["district attorney"] = { name = "District Attorney", paycheck = 70 }, ["judge"] = { name = "Judge", paycheck = 50 }, ["broadcaster"] = { name = "Broadcaster", paycheck = 50 }, ["doctor"] = { name = "Doctor", paycheck = 25 }, ["therapist"] = { name = "Therapist", paycheck = 25 }, ["driving instructor"] = { name = "Driving Instructor", paycheck = 10 }, ["foodtruckvendor"] = { name = "Food Truck Vendor", paycheck = 10 }, ["pdm"] = { name = "Car Dealer", paycheck = 50 }, }
local previewers = require("telescope.previewers") local Job = require("plenary.job") local new_maker = function(filepath, bufnr, opts) opts = opts or {} filepath = vim.fn.expand(filepath) Job:new({ command = "file", args = { "--mime-type", "-b", filepath }, on_exit = function(j) local mime_type = vim.split(j:result()[1], "/")[1] if mime_type == "text" then previewers.buffer_previewer_maker(filepath, bufnr, opts) else vim.schedule(function() vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "BINARY" }) end) end end }):sync() end require("telescope").setup { defaults = { buffer_previewer_maker = new_maker, preview = { filesize_limit = 0.5, }, vimgrep_arguments = { "rg", "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case", }, prompt_prefix = "  ", layout_strategy = "vertical", layout_config = { height = 0.9, mirror = false, prompt_position = "bottom", }, set_env = { ["COLORTERM"] = "truecolor" }, }, pickers = { find_files = { find_command = { "fd", "--type", "f", "--strip-cwd-prefix", "--hidden", "--exclude", ".git", "--exclude", ".venv", "--exclude", "__pycache__", }, } }, extensions = { fzf = { fuzzy = true, override_generic_sorter = true, override_file_sorter = true, case_mode = "ignore_case", } } } require("telescope").load_extension("fzf")
local base = require('imgui.Widget') ---@class xe.ToolPanel:im.Widget local M = class('editor.ToolPanel', base) local im = imgui local wi = require('imgui.Widget') function M:ctor() base.ctor(self, 'Tools') --self:setFlags( -- im.WindowFlags.NoTitleBar, -- im.WindowFlags.HorizontalScrollbar) self._panels = {} self._btns = {} self._tabbar = wi.TabBar('xe.tools.TabBar') self:addChild(self._tabbar) local def = require('xe.node_def._def') def.regist() local data = require('xe.tools.data') for _, v in ipairs(data) do local tab = self:_createTab(v.label) for i, item in ipairs(v.content) do --assert(item.name:sub(1, 7) == 'Insert_') local name = item.name--:sub(8) local icon_name = string.filename(item.bitmap or '') local d = def.getDefine(name) if d and d.icon then icon_name = d.icon end local icon = require('xe.node.icon').getIcon(icon_name) local tooltip = name if d and d.disptype then tooltip = i18n(d.disptype) end local function f() require('xe.main').getEditor():getTree():newNode(name) end local btn, btn2 = tab:addContent(icon, tooltip, f) if i < #v.content then tab:addChild(im.sameLine) end self._btns[name] = { btn, btn2 } end end end function M:_createTab(title) local panel = require('xe.tools.TabContent')(title) panel:addTo(self._tabbar) table.insert(self._panels, panel) return panel end function M:disable(name) local t = self._btns[name] if not t then return end t[1]:setVisible(false) t[2]:setVisible(true) end function M:enable(name) local t = self._btns[name] if not t then return end t[1]:setVisible(true) t[2]:setVisible(false) end function M:disableAll() for k, v in pairs(self._btns) do v[1]:setVisible(false) v[2]:setVisible(true) end end function M:enableAll() for k, v in pairs(self._btns) do v[1]:setVisible(true) v[2]:setVisible(false) end end return M
-- ============== -- SIGNIFY BUBBLE -- ============== -- Created by datwaft <github.com/datwaft> local settings = { color = vim.g.bubbly_colors.signify, style = vim.g.bubbly_styles.signify, symbol = vim.g.bubbly_symbols.signify, } if not settings.color then require'bubbly.utils.io'.warning[[[BUBBLY.NVIM] => [WARNING] Couldn't load color configuration for the component 'signify', the default color will be used.]] settings.color = vim.g.bubbly_colors.default end if not settings.style then require'bubbly.utils.io'.warning[[[BUBBLY.NVIM] => [WARNING] Couldn't load style configuration for the component 'signify', the default style will be used.]] settings.style = vim.g.bubbly_styles.default end if not settings.symbol then require'bubbly.utils.io'.warning[[[BUBBLY.NVIM] => [WARNING] Couldn't load symbol configuration for the component 'signify', the default symbol will be used.]] settings.symbol = vim.g.bubbly_symbols.default end return function(inactive) if inactive then return nil end if vim.fn.exists('*sy#repo#get_stats') == 0 then return nil end local added, modified, removed = unpack(vim.fn['sy#repo#get_stats']()) if added == -1 then added = 0 end if modified == -1 then modified = 0 end if removed == -1 then removed = 0 end return { { data = added ~= 0 and settings.symbol.added:format(added), color = settings.color.added, style = settings.style.added, }, { data = modified ~= 0 and settings.symbol.modified:format(modified), color = settings.color.modified, style = settings.style.modified, }, { data = removed ~= 0 and settings.symbol.removed:format(removed), color = settings.color.removed, style = settings.style.removed, }, } end
DEBUG = true ConGuardInstances = {} function init() if (SERVER) then addEvent("onPlayerNetworkTimeout", true) addEvent("onPlayerNetworkInterruptionLimitReached", true) addEventHandler( "onPlayerResourceStart", root, function(resource) if (getResourceRootElement(resource) == resourceRoot) then addPlayer(source) end end ) addEventHandler("onPlayerLeave", root, removePlayer) local import = importDefaultSettings() if (import ~= true) then iprintd("[ConGuard] Failed to launch", import) return cancelEvent() end iprintd("[ConGuard] Launched successfully...") end if (CLIENT) then addEvent("onConGuardCreated", true) addEvent("onConGuardDestroyed", true) addEvent("onConGuardSettingChange", true) addEvent("onConGuardSyncAll", true) addEvent("onClientPlayerConnectionStatus", true) addEventHandler("onClientPlayerConnectionStatus", resourceRoot, setPlayerConnectionStatus) addEventHandler("onConGuardCreated", resourceRoot, onCreated) addEventHandler("onConGuardDestroyed", resourceRoot, onDestroyed) addEventHandler("onConGuardSettingChange", resourceRoot, onSettingChange) addEventHandler("onConGuardSyncAll", resourceRoot, onSyncAll) addEventHandler("onClientElementStreamIn", root, registerStreamedInPlayer) addEventHandler("onClientElementStreamOut", root, unregisterStreamedInPlayer) addEventHandler("onClientRender", root, renderLostConnectionImages) initializeStreamedInPlayers() end end addEventHandler(SERVER and "onResourceStart" or "onClientResourceStart", resourceRoot, init)
--[[ Copyright 2014-2015 The Luvit Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --]] local env = require('env') local log = require('log').log local jsonParse = require('json').parse local http = require('coro-http') return function (path, etag) local url = "https://api.github.com" .. path log("github request", url) local headers = { {"User-Agent", "lit"}, } -- Set GITHUB_TOKEN to a token from https://github.com/settings/tokens/new to increase the rate limit local token = env.get("GITHUB_TOKEN") if token then headers[#headers + 1] = {"Authorization", "token " .. token} end if etag then headers[#headers + 1] = {"If-None-Match", etag} end local head, json = http.request("GET", url, headers) json = jsonParse(json) or json return head, json, url end
-- Main grid methods local layouts = {} -- Define monitor names for layout purposes local display_home = "f.lux profile" local display_laptop = "Color LCD" local display_monitor = "Thunderbolt Display" -- Define window layouts -- Format reminder: -- {"App name", "Window name", "Display Name", "unitrect", "framerect", "fullframerect"}, layouts.layouts = { { name="Home Laptop", description='15" MacBook Pro personal laptop screen' }, { name="Work Laptop", description='13" MacBook Air work laptop screen' }, { name="Office Setup", description="Dual monitor setup at the office", small={ {"Spark", nil, display_laptop, {hs.layout.maximized}, nil, nil}, {"Fantastical 2", nil, display_laptop, {hs.layout.maximized}, nil, nil}, }, large={ {"Google Chrome", nil, display_monitor, {0, 0, 2/3, 1}, nil, nil}, {"Sublime Text", nil, display_monitor, {1/3, 1/3, 1/3, 2/3}, nil, nil} } }, } function layouts.applyLayout(layout) print('Layout ' .. layout.name .. ' selected') if lastNumberOfScreens > 1 then -- Multiple monitors print('We have multiple monitors') hs.layout.apply(layout.large, function(windowTitle, layoutWindowTitle) return string.sub(windowTitle, 1, string.len(layoutWindowTitle)) == layoutWindowTitle end) end -- Multiple monitors print('We have a single screen') hs.layout.apply(layout.small, function(windowTitle, layoutWindowTitle) return string.sub(windowTitle, 1, string.len(layoutWindowTitle)) == layoutWindowTitle end) end layouts.chooser = hs.chooser.new(function(selection) if not selection then return end layouts.applyLayout(layouts.layouts[selection.uuid]) end) -- chooser:choices(choices) local i = 0 local choices = hs.fnutils.imap(layouts.layouts, function(layout) i = i + 1 return { uuid=i, text=layout.name, subText=layout.description } end) layouts.chooser:choices(choices) layouts.chooser:searchSubText(true) layouts.chooser:rows(#choices) layouts.chooser:width(20) return layouts
-------------------------------------------------------------------------------- -- Here is a handy Lua command line script for listing all nodes that are owned -- by specific players (like steel doors, locked chests, etc.) in your map -- database. Just change the following variables at the head of the script: -- -- * path - the path of the map.sqlite database to be read -- * area - the region of the map to be searched, specified as minimum and -- maximum mapblock positions -- * owner_name- the name of the owner to search for (nil will search for all -- owners) -- * node_name- the name of the owned nodes to search for (nil will search for -- all owned nodes) -- -- Keep in mind, this script can take some time to process very large databases, -- so it is strongly recommended to limit the search area to no more than ~50 -- cubic mapblocks at a time. -------------------------------------------------------------------------------- package.path = "/home/minetest/maplib/?.lua;" .. package.path local maplib = require "maplib" local path = "/root/.minetest/worlds/world/map.sqlite" local area = MapArea( { x = -10, y = -10, z = -10 }, { x = 10, y = 5, z = 10 } ) local node_name = nil local node_owner = "sorcerykid" --------------------------------------- local decode_node_pos = maplib.decode_node_pos local pos_to_string = maplib.pos_to_string local map_db = MapDatabase( path, false ) print( "Creating cache..." ) map_db.create_cache( false ) print( "Examining database..." ) local block_total = 0 local node_count = 0 for index, block in map_db.iterate_area( area ) do local nodemeta_map = block.get_nodemeta_map( ) local nodename_map = block.nodename_map local node_list -- don't waste cpu cycles getting nodes unless there is meta if next( nodemeta_map ) then node_list = block.get_node_list( ) end block_total = block_total + 1 for i, m in pairs( nodemeta_map ) do local name = nodename_map[ node_list[ i ].id ] local owner = m.fields.owner or m.fields.doors_owner if owner and ( not node_owner or owner == node_owner ) and ( not node_name or name == node_name ) then node_count = node_count + 1 print( string.format( "%s owned by %s at %s.", name, owner, pos_to_string( decode_node_pos( i, index ) ) ) ) end end end print( string.format( "Found %d owned nodes (scanned %d map blocks).", node_count, block_total ) )
--[[ This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:25' using the latest game version. NOTE: This file should only be used as IDE support; it should NOT be distributed with addons! **************************************************************************** CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC. **************************************************************************** ]] -- Singleton that registers for the alert events local ZO_AlertText_Manager = ZO_Object:Subclass() function ZO_AlertText_Manager:New() local manager = ZO_Object.New(self) manager:Initialize() return manager end local function OnAlertEvent(eventCode, ...) local alertHandlers = ZO_AlertText_GetHandlers() if alertHandlers[eventCode] then local category, message, soundId, noSuppression = alertHandlers[eventCode](...) if category then if message and message ~= "" then if noSuppression then ZO_AlertNoSuppression(category, soundId, message) else ZO_Alert(category, soundId, message) end else ZO_SoundAlert(category, soundId) end end end end function ZO_AlertEvent(eventId, ...) OnAlertEvent(eventId, ...) end function ZO_AlertText_Manager:Initialize() local alertHandlers = ZO_AlertText_GetHandlers() for event in pairs(alertHandlers) do EVENT_MANAGER:RegisterForEvent("AlertTextManager", event, OnAlertEvent) end EVENT_MANAGER:AddFilterForEvent("AlertTextManager", EVENT_COMBAT_EVENT, REGISTER_FILTER_IS_ERROR, true) self.recentMessages = ZO_RecentMessages:New() end function ZO_AlertText_Manager:ShouldDisplayMessage(soundId) return self.recentMessages:ShouldDisplayMessage(soundId) end function ZO_AlertText_Manager:AddRecent(soundId) return self.recentMessages:AddRecent(soundId) end ALERT_EVENT_MANAGER = ZO_AlertText_Manager:New() -- Base Class ZO_AlertText_Base = ZO_Object:Subclass() function ZO_AlertText_Base:New(...) local manager = ZO_Object.New(self) manager:Initialize(...) return manager end function ZO_AlertText_Base:Initialize(control) -- Should be overridden end --add customization for message categories here -- Previous colors: error = INTERFACE_GENERAL_COLOR_ERROR, alert = INTERFACE_GENERAL_COLOR_ALERT, colorType = INTERFACE_COLOR_TYPE_GENERAL local AlertParams = { [UI_ALERT_CATEGORY_ERROR] = { color = ZO_ColorDef:New(GetInterfaceColor(INTERFACE_COLOR_TYPE_TEXT_COLORS, INTERFACE_TEXT_COLOR_SELECTED)), }, [UI_ALERT_CATEGORY_ALERT] = { color = ZO_ColorDef:New(GetInterfaceColor(INTERFACE_COLOR_TYPE_TEXT_COLORS, INTERFACE_TEXT_COLOR_SELECTED)), }, } function ZO_AlertText_Base:GetAlertColor(category) local color = AlertParams[UI_ALERT_CATEGORY_ALERT].color local params = AlertParams[category] if(params) then color = params.color or color end return color end local function InternalPerformAlert(category, soundId, message) if IsInGamepadPreferredMode() then ALERT_MESSAGES_GAMEPAD:InternalPerformAlert(category, soundId, message) else ALERT_MESSAGES:InternalPerformAlert(category, soundId, message) end end --[[ Global Alert Functions ]]-- function ZO_Alert(category, soundId, message, ...) if(not message) then return end message = zo_strformat(message, ...) if(message == "") then return end if(ALERT_EVENT_MANAGER:ShouldDisplayMessage(message)) then InternalPerformAlert(category, soundId, message) else ZO_SoundAlert(category, soundId) end end function ZO_AlertNoSuppression(category, soundId, message, ...) if(not message) then return end message = zo_strformat(message, ...) if(message == "") then return end InternalPerformAlert(category, soundId, message) end function ZO_SoundAlert(category, soundId) if(soundId and soundId ~= "" and ALERT_EVENT_MANAGER:ShouldDisplayMessage(soundId)) then PlaySound(soundId) ALERT_EVENT_MANAGER:AddRecent(soundId) end end
--------------------------------------------------------------------------------- -- -- @type EditorCommand -- --------------------------------------------------------------------------------- local EditorCommand = Class( "EditorCommand" ) function EditorCommand.register( clazz, name ) editorCommandRegistryClass( clazz, name ) clazz._commandName = name -- log.info( 'register Lua Editor Command', name ) end function EditorCommand:setup( option ) end --------------------------------------------------------------------------------- function EditorCommand:redo() end function EditorCommand:undo() end function EditorCommand:canUndo() return true end function EditorCommand:hasHistory() return true end function EditorCommand:toString() return self._commandName end function EditorCommand:getResult() return nil end --------------------------------------------------------------------------------- return EditorCommand
-- -- Setup nvim-cmp. -- local cmp = require'cmp' local lspkind = require "lspkind" lspkind.init() cmp.setup({ snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) end, }, formatting = { format = lspkind.cmp_format { with_text = true, menu = { buffer = '[buf]', nvim_lsp = '[LSP]', nvim_lua = '[api]', path = '[path]', luasnip = '[snip]', cmdline = '[CMD]' }, }, }, mapping = { ['<C-d>'] = cmp.mapping.scroll_docs(-4), ['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-Space>'] = cmp.mapping.complete(), ['<C-e>'] = cmp.mapping.close(), ['<CR>'] = cmp.mapping.confirm({ select = true }), }, sources = { { name = 'nvim_lua' }, { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, { name = 'buffer', keyword_length = 5 }, } }) -- Use buffer source for `/`. cmp.setup.cmdline('/', { sources = { { name = 'buffer', keyword_length = 3 } } }) -- Use cmdline & path source for ':'. -- cmp.setup.cmdline(':', { -- sources = cmp.config.sources({ -- { name = 'path' } -- }, { -- { name = 'cmdline', keyword_length = 4 } -- }) -- }) -- Setup lspconfig. -- require('lspconfig')[%YOUR_LSP_SERVER%].setup { -- capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- } -- Add vim-dadbod-completion in sql files vim.cmd [[ augroup DadbodSql au! autocmd FileType sql,mysql,plsql lua require('cmp').setup.buffer { sources = { { name = 'vim-dadbod-completion' } } } augroup END ]]
LibRoot.Imgui = SrcDir() .. "r1.render/imgui" -- ============================================================================== ModuleRefInclude["imgui"] = function() includedirs { LibRoot.Imgui .. "/", LibRoot.Imgui .. "/backends/", LibRoot.Imgui .. "/freetype/", LibRoot.Imgui .. "/misc/cpp/", LibRoot.Imgui .. "-ex/", LibRoot.Imgui .. "-nodes/", LibRoot.Imgui .. "-implot/", LibRoot.Imgui .. "-filedlg/", } ModuleRefInclude["freetype"]() end -- ============================================================================== project "r1-imgui" kind "StaticLib" language "C++" cppdialect "C++20" SetDefaultBuildConfiguration() SetDefaultOutputDirectories("r1") ModuleRefInclude["glfw"]() ModuleRefInclude["imgui"]() defines { "IMGUI_IMPL_OPENGL_LOADER_GLAD2", } files { LibRoot.Imgui .. "/*.cpp", LibRoot.Imgui .. "/*.h", LibRoot.Imgui .. "/freetype/*.cpp", LibRoot.Imgui .. "/freetype/*.h", LibRoot.Imgui .. "/backends/imgui_impl_glfw.*", LibRoot.Imgui .. "/backends/imgui_impl_opengl3.*", LibRoot.Imgui .. "/misc/cpp/*.*", LibRoot.Imgui .. "-nodes/*.cpp", LibRoot.Imgui .. "-nodes/*.h", LibRoot.Imgui .. "-implot/*.cpp", LibRoot.Imgui .. "-implot/*.h", LibRoot.Imgui .. "-filedlg/*.cpp", LibRoot.Imgui .. "-filedlg/*.h", } ModuleRefLink["imgui"] = function() links { "r1-imgui" } end
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB local B = E:GetModule('Blizzard') local _G = _G function B:KillBlizzard() if E.global.general.disableTutorialButtons then _G.HelpOpenTicketButtonTutorial:Kill() _G.HelpPlate:Kill() _G.HelpPlateTooltip:Kill() end _G.EJMicroButtonAlert:Kill() _G.Advanced_UIScaleSlider:Kill() _G.Advanced_UseUIScale:Kill() end
ITEM.name = "VSS Vintorez" ITEM.description= "The VSS 'Vintorez' is issued primarily to Spetsnaz units for undercover or clandestine operations, a role made evident by its ability to be stripped down for transport in a specially fitted briefcase.\nThe weapon has an integral suppressor which wraps around the barrel.\nThe barrel itself has a series of small ports drilled in the rifling grooves, leading into the suppressor which slows and cools the exhaust gases.\nIt uses a subsonic 9x39 mm SP-5 cartridge to avoid a sonic boom.\n\nAmmo: 9x39mm\nMagazine Capacity: 20" ITEM.model = "models/weapons/ethereal/w_vss.mdl" ITEM.class = "cw_kk_ins2_vss" ITEM.weaponCategory = "primary" ITEM.width = 4 ITEM.height = 2 ITEM.price = 30000 ITEM.weight = 10
-------------------------------------------------------------------------------- -- Module declaration -- local mod, CL = BigWigs:NewBoss("Priestess Delrissa", 585, 532) if not mod then return end mod:RegisterEnableMob(24553, -- Apoko 24554, -- Eramas Brightblaze 24555, -- Garaxxas 24556, -- Zelfan 24557, -- Kagani Nightstrike 24558, -- Ellrys Duskhallow 24559, -- Warlord Salaris 24560, -- Priestess Delrissa 24561 -- Yazzai ) mod.engageId = 1895 -- mod.respawnTime = 0 -- resets, doesn't respawn -------------------------------------------------------------------------------- -- Initialization -- function mod:GetOptions() return { -- Priestess Delrissa 46192, -- Renew 46193, -- Power Word: Shield -- Apoko 27621, -- Windfury Totem -- Yazzai 44178, -- Blizzard 13323, -- Polymorph -- Ellrys Duskhallow {44141, "ICON"}, -- Seed of Corruption }, { [46192] = self.displayName, -- Priestess Delrissa [27621] = -5104, -- Apoko [44178] = -5101, -- Yazzai [44141] = -5099, -- Ellrys Duskhallow } end function mod:OnBossEnable() -- Priestess Delrissa self:Log("SPELL_AURA_APPLIED", "Renew", 44174, 46192) -- normal, heroic self:Log("SPELL_AURA_APPLIED", "PowerWordShield", 44291, 46193) -- normal, heroic -- Apoko self:Log("SPELL_CAST_SUCCESS", "WindfuryTotem", 27621) -- Yazzai self:Log("SPELL_CAST_SUCCESS", "Blizzard", 44178, 46195) -- normal, heroic self:Log("SPELL_AURA_APPLIED", "Polymorph", 13323) -- Ellrys Duskhallow self:Log("SPELL_AURA_APPLIED", "SeedOfCorruption", 44141) self:Log("SPELL_AURA_REMOVED", "SeedOfCorruptionRemoved", 44141) -- General _AURA_REMOVED events: self:Log("SPELL_AURA_REMOVED", "Removed", 13323, 44174, 46192) -- Polymorh, normal/heroic Renew end -------------------------------------------------------------------------------- -- Event Handlers -- -- Priestess Delrissa function mod:Renew(args) self:TargetMessage(46192, args.destName, "yellow") self:TargetBar(46192, 15, args.destName) end function mod:PowerWordShield(args) self:TargetMessage(46193, args.destName, "yellow") end -- Apoko function mod:WindfuryTotem(args) self:Message(args.spellId, "yellow") end -- Yazzai function mod:Blizzard(args) self:Message(44178, "red", nil, CL.casting:format(args.spellName)) end function mod:Polymorph(args) self:TargetMessage(args.spellId, args.destName, "orange") self:TargetBar(args.spellId, 8, args.destName) end -- Ellrys Duskhallow function mod:SeedOfCorruption(args) self:TargetMessage(args.spellId, args.destName, "red") self:TargetBar(args.spellId, 18, args.destName) self:PrimaryIcon(args.spellId, args.destName) end function mod:SeedOfCorruptionRemoved(args) self:PrimaryIcon(args.spellId) self:StopBar(args.spellName, args.destName) end -- General _AURA_REMOVED events: function mod:Removed(args) self:StopBar(args.spellName, args.destName) end
local end_up = 0.35 local skill = Skill( "fire_ball" ) skill:SetDescription("Throw a fireball, which explodes on impact.") skill:SetStages({ end_up }) skill:SetCastTime( 0.5 ) skill:SetMaxLive( 10 ) skill:SetCooldown( 10 ) skill:SetDamageType( "fire" ) local moveSpeed = 5000 local blastRange = 1000 local blastDamage = 50 local blastPower = 15 blastRange = blastRange * blastRange local sounds = { "fire_hit", "fire_hit2" } function skill:Stage1( ent ) local caster = ent:GetCaster() if CLIENT and caster != LocalPlayer() then return end local forward = caster:GetRight():Cross(_VECTOR.UP) ent:SetPos( _VECTOR.UP * 50 + caster:GetPos() - forward * 30 ) ent:SetAngles( forward:Angle() ) print("stage1") end function skill:Transition1( ent ) if CLIENT then print(tostring(ent) .. "emit fire_engine") ent:EmitSound( "fire_engine" ) return end ent:InitPhys(ELEMENT_PHYS_TYPE.PROJECTILE) ent:PhysWake() print("trans1") print(ent) print(ent.velocity) ent.velocity = ent:GetCaster():GetAimVector() * moveSpeed print(ent.velocity) end function skill:Stage2( ent ) if CLIENT then return end print("stage2") print(ent) print(ent.velocity) --ent:ReachVelocity( ent.velocity ) local physObj = ent:GetPhysicsObject() physObj:SetVelocity(ent.velocity) end function skill:ActivationConditions( caster ) return caster:WaterLevel() < 2 end if CLIENT then function skill:Activate( ent, caster ) sound.Play("fire_ignite", ent:GetPos()) caster:PlayAnimation("shoot_fire1") sound.Play(sounds[math.random(1, 2)], caster:GetPos()) ent:CreateParticleEffect("element_fire_ball", 1) end end if SERVER then function skill:Spawn( ent, caster ) ent:SetModel( "models/props_wasteland/rockgranite02a.mdl" ) ent:SetModelScale( 0.3 ) ent:SetInvisible(true) ent:InitPhys(ELEMENT_PHYS_TYPE.GHOST) ent:SetCustomCollisionCheck( true ) local forward = caster:GetRight():Cross(_VECTOR.UP) ent:SetPos( _VECTOR.UP * 50 + caster:GetPos() - forward * 30 ) ent:SetAngles( forward:Angle() ) end function skill:PhysicsCollide( ent, data, phys ) ent:SetDestroyFlag(true) end end function skill:OnRemove( ent ) print("on remove") if CLIENT then print("on remove") ParticleEffect("element_fire_explode", ent:GetPos(), Angle()) print(tostring(ent) .. "stop fire_engine") ent:StopSound("fire_engine") sound.Play("fire_explode", ent:GetPos()) return end local pos = ent:GetPos() local hits = bounds.objectsInSphere( player.GetAll(), pos, blastRange ) for _, hit in next, hits do if !EntsInSight(ent, hit.obj) then continue end local damage = ( 1 - hit.distance / blastRange ) * blastDamage print(hit.obj, damage, hit.obj:GetMaxHealth()) local velocity = hit.obj:GetPos() - pos velocity.z = velocity.z + 100 hit.obj:SetVelocity(velocity:GetNormalized() * blastPower * damage) self:Hit(ent, hit.obj, damage, DMG_GENERIC, velocity) end end skill_manager.Register( skill )
-- credit to atom0s for help with decompiling -- Decompiled using luadec 2.2 rev: for Lua 5.1 from https://github.com/viruscamp/luadec return {}
slot0 = class("MetaCharacterRepairLayer", import("...base.BaseUI")) slot0.getUIName = function (slot0) return "MetaCharacterRepairUI" end slot0.init = function (slot0) slot0:initTipText() slot0:initData() slot0:findUI() slot0:addListener() end slot0.didEnter = function (slot0) slot0:doRepairProgressPanelAni() slot0:updateAttrListPanel() slot0:updateRepairBtn(true) slot0:updateDetailPanel() for slot4, slot5 in ipairs(MetaCharacterConst.REPAIR_ATTRS) do if not slot0.curMetaCharacterVO:getAttrVO(slot5):isLock() then triggerToggle(slot0.attrTFList[slot5], true) break end end slot0:TryPlayGuide() end slot0.willExit = function (slot0) return end slot0.onBackPressed = function (slot0) if isActive(slot0.repairEffectBoxPanel) then slot0:closeRepairEffectBoxPanel() return elseif isActive(slot0.detailPanel) then slot0:closeDetailPanel() return else slot0:emit(slot0.ON_BACK_PRESSED) end end slot0.initTipText = function (slot0) setText(slot1, i18n("meta_repair")) setText(slot2, i18n("meta_repair")) setText(slot3, i18n("meta_repair")) setText(slot0:findTF("Repair/AttrListPanel/AttrItemContainer/AttrItemReload/SelectedPanel/AttrRepairTipText"), i18n("meta_repair")) end slot0.initData = function (slot0) slot0.metaCharacterProxy = getProxy(MetaCharacterProxy) slot0.bayProxy = getProxy(BayProxy) slot0.attrTFList = {} slot0.curAttrName = nil slot0.curMetaShipID = slot0.contextData.shipID slot0.curShipVO = nil slot0.curMetaCharacterVO = nil slot0:updateData() end slot0.findUI = function (slot0) slot0.repairPanel = slot0:findTF("Repair") slot0.attrListPanel = slot0:findTF("AttrListPanel", slot0.repairPanel) slot0.attrItemContainer = slot0:findTF("AttrItemContainer", slot0.attrListPanel) slot0.attrCannonTF = slot0:findTF("AttrItemCannon", slot0.attrItemContainer) slot0.attrTorpedoTF = slot0:findTF("AttrItemTorpedo", slot0.attrItemContainer) slot0.attrAirTF = slot0:findTF("AttrItemAir", slot0.attrItemContainer) slot0.attrReloadTF = slot0:findTF("AttrItemReload", slot0.attrItemContainer) slot0.attrTFList.cannon = slot0.attrCannonTF slot0.attrTFList.torpedo = slot0.attrTorpedoTF slot0.attrTFList.air = slot0.attrAirTF slot0.attrTFList.reload = slot0.attrReloadTF slot0.repairPercentText = slot0:findTF("SynProgressPanel/SynRate/NumTextText", slot0.repairPanel) slot0.repairSliderTF = slot0:findTF("SynProgressPanel/Slider", slot0.repairPanel) slot0.repairBtn = slot0:findTF("RepairBtn", slot0.repairPanel) slot0.repairBtnDisable = slot0:findTF("RepairBtnDisable", slot0.repairPanel) slot0.showDetailLine = slot0:findTF("ShowDetailLine") slot0.showDetailBtn = slot0:findTF("ShowDetailBtn", slot0.showDetailLine) slot0.detailPanel = slot0:findTF("Detail") slot0.detailBG = slot0:findTF("BG", slot0.detailPanel) slot0.detailTF = slot0:findTF("Panel", slot0.detailPanel) slot0.detailCloseBtn = slot0:findTF("CloseBtn", slot0.detailTF) slot0.detailLineTpl = slot0:findTF("DetailLineTpl", slot0.detailTF) slot0.detailItemTpl = slot0:findTF("DetailItemTpl", slot0.detailTF) slot0.detailItemContainer = slot0:findTF("ScrollView/Viewport/Content", slot0.detailTF) slot0.repairEffectBoxPanel = slot0:findTF("RepairEffectBox") end slot0.addListener = function (slot0) for slot4, slot5 in pairs(slot0.attrTFList) do onToggle(slot0, slot5, function (slot0) if slot0 == true then slot0.curAttrName = slot0 slot0:updateRepairBtn() else slot0.curAttrName = nil slot0:updateRepairBtn(true) end end, SFX_PANEL) end onButton(slot0, slot0.repairBtn, function () pg.m02:sendNotification(GAME.REPAIR_META_CHARACTER, { shipID = slot0.curMetaShipID, attr = slot0.curAttrName }) end, SFX_PANEL) onButton(slot0, slot0.showDetailBtn, function () if not isActive(slot0.detailPanel) then slot0:openDetailPanel() end end, SFX_PANEL) onButton(slot0, slot0.showDetailLine, function () if not isActive(slot0.detailPanel) then slot0:openDetailPanel() end end, SFX_PANEL) onButton(slot0, slot0.detailCloseBtn, function () slot0:closeDetailPanel() end, SFX_CANCEL) onButton(slot0, slot0.detailBG, function () slot0:closeDetailPanel() end, SFX_CANCEL) end slot0.TryPlayGuide = function (slot0) pg.SystemGuideMgr.GetInstance():PlayByGuideId("NG0027") end slot0.doRepairProgressPanelAni = function (slot0) slot2 = GetComponent(slot0.repairSliderTF, typeof(Slider)) slot2.minValue = 0 slot2.maxValue = 1 slot3 = slot2.value if slot0.curMetaCharacterVO:getRepairRate() > 0 then slot0:managedTween(LeanTween.value, nil, go(slot0.repairSliderTF), slot3, slot1, 0.5):setOnUpdate(System.Action_float(function (slot0) slot0:updateRepairProgressPanel(slot0) end)).setOnComplete(slot5, System.Action(function () slot0:updateRepairProgressPanel(slot0) end)) else slot0.updateRepairProgressPanel(slot0, slot1) end end slot0.updateRepairProgressPanel = function (slot0, slot1) setSlider(slot0.repairSliderTF, 0, 1, slot1 or slot0.curMetaCharacterVO:getRepairRate()) setText(slot0.repairPercentText, string.format("%d", (slot1 or slot0.curMetaCharacterVO.getRepairRate()) * 100)) end slot0.updateAttrListPanel = function (slot0) for slot4, slot5 in ipairs(MetaCharacterConst.REPAIR_ATTRS) do slot0:updateAttrItem(slot0.attrTFList[slot5], slot5) end end slot0.updateAttrItem = function (slot0, slot1, slot2) slot3 = slot0:findTF("LockPanel", slot1) slot4 = slot0:findTF("UnSelectPanel", slot1) slot5 = slot0:findTF("SelectedPanel", slot1) if slot0.curMetaCharacterVO:getAttrVO(slot2):isLock() then setActive(slot4, false) setActive(slot5, false) setActive(slot3, true) slot1:GetComponent("Toggle").interactable = false else slot8 = slot1:GetComponent("Toggle") setActive(slot4, not slot8.isOn) setActive(slot5, slot8.isOn) setActive(slot3, false) slot8.interactable = true slot12 = slot0:findTF("AttrRepairValue/Image", slot5) slot13 = slot0:findTF("AttrRepairValue/NextValueText", slot5) slot14 = slot0:findTF("IconTpl", slot5) slot16 = slot0:findTF("NumText", slot15) slot17 = slot6:getAddition() setText(slot9, "+" .. slot17) setText(slot10, "+" .. slot17) setText(slot11, "+" .. slot17) slot20 = nil slot20 = (slot6:isMaxLevel() or slot6:getItem()) and slot6:getItemByLevel(slot6:getLevel() - 1) if getProxy(BagProxy):getItemCountById(slot20:getItemId()) < slot20:getTotalCnt() then slot23 = setColorStr(slot23, COLOR_RED) end setText(slot16, slot23 .. "/" .. slot22) updateDrop(slot14, slot24, { hideName = true }) onButton(slot0, slot14, function () slot0:emit(BaseUI.ON_DROP, slot0) end, SFX_PANEL) setActive(slot12, not slot19) setActive(slot13, not slot19) if slot19 then setText(slot13, slot17) else setText(slot13, "+" .. slot17 + slot20:getAdditionValue()) end if slot19 then setActive(slot14, false) setActive(slot15, false) else setActive(slot14, true) setActive(slot15, true) end end end slot0.updateRepairBtn = function (slot0, slot1) if slot1 == true then setActive(slot0.repairBtn, false) setActive(slot0.repairBtnDisable, false) return end slot2 = slot0.curMetaCharacterVO:getAttrVO(slot0.curAttrName) slot5 = nil slot9 = (slot2:isMaxLevel() or slot2:getItem()) and slot2:getItemByLevel(slot2:getLevel() - 1):getTotalCnt() <= getProxy(BagProxy):getItemCountById((slot2.isMaxLevel() or slot2.getItem()) and slot2.getItemByLevel(slot2.getLevel() - 1):getItemId()) if slot4 then setActive(slot0.repairBtn, false) setActive(slot0.repairBtnDisable, false) elseif not slot9 then setActive(slot0.repairBtn, false) setActive(slot0.repairBtnDisable, true) else setActive(slot0.repairBtn, true) setActive(slot0.repairBtnDisable, false) end end slot0.updateDetailItem = function (slot0, slot1, slot2) setText(slot5, i18n("meta_repair_effect_unlock", slot2.progress)) setActive(slot0:findTF("LockPanel", slot1), slot2.progress > slot0.curMetaCharacterVO:getRepairRate() * 100) slot13 = UIItemList.New(slot0:findTF("LineContainer", slot1), slot0.detailLineTpl) slot13:make(function (slot0, slot1, slot2) slot3 = slot0:findTF("AttrLine", slot2) slot4 = slot0:findTF("UnlockTipLine", slot2) slot5 = slot0:findTF("Text", slot2) if slot0 == UIItemList.EventUpdate then if slot1 + 1 == 1 then setActive(slot3, false) setActive(slot4, false) setActive(slot5, true) setText(slot5, i18n("meta_repair_effect_unlock", slot1)) return end if slot1 <= slot2 + 1 then setActive(slot3, true) setActive(slot4, false) setImageSprite(slot6, LoadSprite("attricon", slot3[slot1 - 1][1])) setText(slot7, AttributeType.Type2Name(slot10)) setText(slot0:findTF("NumText", slot3), "+" .. slot3[slot1 - 1][2]) else setActive(slot3, false) setActive(slot4, true) setScrollText(slot0:findTF("Text", slot4), slot4[slot1 - 1 - slot2]) end end end) slot13.align(slot13, #slot2:getAttrAdditionList() + #slot2:getDescs() + 1) end slot0.updateDetailPanel = function (slot0) setActive(slot0.detailPanel, false) slot0.detailList = UIItemList.New(slot0.detailItemContainer, slot0.detailItemTpl) slot0.detailList:make(function (slot0, slot1, slot2) if slot0 == UIItemList.EventUpdate then slot1:updateDetailItem(slot2, slot0[slot1 + 1]) end end) slot0.detailList.align(slot2, #slot0.curMetaCharacterVO:getEffects()) end slot0.updateData = function (slot0) slot0.curShipVO = slot0.bayProxy:getShipById(slot0.curMetaShipID) slot0.curMetaCharacterVO = slot0.curShipVO:getMetaCharacter() end slot0.checkSpecialEffect = function (slot0) slot2 = slot0.bayProxy:getShipById(slot0.curMetaShipID).getMetaCharacter(slot1) slot3 = slot2:getRepairRate() * 100 slot4 = slot0.curMetaCharacterVO:getRepairRate() * 100 for slot9, slot10 in ipairs(slot5) do if slot4 < slot10.progress and slot11 <= slot3 then slot0:openRepairEffectBoxPanel(slot10) break end end end slot0.openRepairEffectBoxPanel = function (slot0, slot1) slot7 = slot1.progress slot8 = slot0:findTF("BG", slot0.repairEffectBoxPanel) onButton(slot0, slot9, function () slot0:closeRepairEffectBoxPanel() end, SFX_CANCEL) slot12 = UIItemList.New(slot10, slot11) slot12:make(function (slot0, slot1, slot2) slot3 = slot0:findTF("AttrLine", slot2) slot4 = slot0:findTF("UnlockTipLine", slot2) if slot0 == UIItemList.EventUpdate then if slot1 + 1 == 1 then setActive(slot3, false) setActive(slot4, true) setScrollText(slot0:findTF("Text", slot4), i18n("meta_repair_effect_special", slot1)) elseif slot1 > 1 and slot1 <= 1 + slot2 then setActive(slot3, true) setActive(slot4, false) setImageSprite(slot5, LoadSprite("attricon", slot3[slot1 - 1][1])) setText(slot6, AttributeType.Type2Name(slot9)) setText(slot0:findTF("NumText", slot3), "+" .. slot3[slot1 - 1][2]) elseif slot1 > 1 + slot2 and slot1 <= slot4 then setActive(slot3, false) setActive(slot4, true) setScrollText(slot0:findTF("Text", slot4), slot5[slot1 - (1 + slot2)]) end end end) slot12.align(slot12, slot6) setActive(slot0.repairEffectBoxPanel, true) pg.UIMgr.GetInstance():BlurPanel(slot0.repairEffectBoxPanel, false, { weight = LayerWeightConst.TOP_LAYER }) end slot0.closeRepairEffectBoxPanel = function (slot0) pg.UIMgr.GetInstance():UnblurPanel(slot0.repairEffectBoxPanel) setActive(slot0.repairEffectBoxPanel, false) end slot0.openDetailPanel = function (slot0) setActive(slot0.detailPanel, true) pg.UIMgr.GetInstance():BlurPanel(slot0.detailPanel, false, { weight = LayerWeightConst.TOP_LAYER }) slot0.isOpening = true slot0:managedTween(LeanTween.value, nil, go(slot0.detailTF), slot0.detailTF.rect.width, 0, 0.3):setOnUpdate(System.Action_float(function (slot0) setAnchoredPosition(slot0.detailTF, { x = slot0 }) end)).setOnComplete(slot1, System.Action(function () slot0.isOpening = nil end)) end slot0.closeDetailPanel = function (slot0) if slot0.isClosing or slot0.isOpening then return end slot0.isClosing = true slot0:managedTween(LeanTween.value, nil, go(slot0.detailTF), 0, slot0.detailTF.rect.width, 0.3):setOnUpdate(System.Action_float(function (slot0) setAnchoredPosition(slot0.detailTF, { x = slot0 }) end)).setOnComplete(slot1, System.Action(function () slot0.isClosing = nil setActive(slot0.detailPanel, false) pg.UIMgr.GetInstance():UnblurPanel(slot0.detailPanel) end)) end return slot0
object_tangible_loot_npc_loot_disguise_makeup_kit_generic = object_tangible_loot_npc_loot_shared_disguise_makeup_kit_generic:new { } ObjectTemplates:addTemplate(object_tangible_loot_npc_loot_disguise_makeup_kit_generic, "object/tangible/loot/npc/loot/disguise_makeup_kit_generic.iff")
-- Link's collider player = world:newCircleCollider(1300, 800, 40) player:setCollisionClass("Player") -- Player properties player.width = 96 -- width of the animation frames player.height = 96 -- height of the animation frames player.speed = 360 player.isMoving = false player.dir = "down" player.item = 2 -- number corresponds to some item -- Player can be in many states: -- 0: normal, walking state -- 1: attacking -- 2: found item player.state = 0 player.timer = 0 -- Health; Player starts at full hearts player.max_hearts = 3 player.hearts = player.max_hearts player.grids = {} player.grids.walk = anim8.newGrid(player.width, player.height, sprites.linkWalkSheet:getWidth(), sprites.linkWalkSheet:getHeight(), 0, 0, 6) player.animations = {} player.animations.walkDown = anim8.newAnimation(player.grids.walk('1-2', 1), 0.1) player.animations.walkRight = anim8.newAnimation(player.grids.walk('1-2', 2), 0.125) player.animations.walkLeft = anim8.newAnimation(player.grids.walk('1-2', 2), 0.125) player.animations.walkUp = anim8.newAnimation(player.grids.walk('1-2', 3), 0.1) player.holdSprite = sprites.weapons.wooden_sword player.weaponType = "" player.weaponId = 0 player.weaponTag = 0 function playerAttackComplete() -- state 1 is standard attack animation if player.state == 1 then player.state = 0 if player.dir == "down" then player.anim = player.animations.walkDown elseif player.dir == "left" then player.anim = player.animations.walkLeft elseif player.dir == "right" then player.anim = player.animations.walkRight elseif player.dir == "up" then player.anim = player.animations.walkUp end player.anim:gotoFrame(1) -- go to standing frame end end player.animations.attackDown = anim8.newAnimation(player.grids.walk(2,1, 3,1, 2,1), {0.07, 0.3, 0.07}, playerAttackComplete) player.animations.attackRight = anim8.newAnimation(player.grids.walk(2,2, 3,2, 2,2), {0.07, 0.3, 0.07}, playerAttackComplete) player.animations.attackLeft = anim8.newAnimation(player.grids.walk(2,2, 3,2, 2,2), {0.07, 0.3, 0.07}, playerAttackComplete) player.animations.attackUp = anim8.newAnimation(player.grids.walk(2,3, 3,3, 2,3), {0.07, 0.3, 0.07}, playerAttackComplete) -- This value stores the player's current animation player.anim = player.animations.walkDown function player:update(dt) if player.timer > 0 then player.timer = player.timer - dt if player.timer < 0 then -- Found Item state if player.state == 2 then player.state = 0 end end end -- State 0: normal state, walking around if player.state == 0 then -- Freeze the animation if the player isn't moving if player.isMoving then player.anim:update(dt) end local vectorX = 0 local vectorY = 0 -- Keyboard direction checks for movement if love.keyboard.isDown("left") then vectorX = -1 player.anim = player.animations.walkLeft player.dir = "left" end if love.keyboard.isDown("right") then vectorX = 1 player.anim = player.animations.walkRight player.dir = "right" end if love.keyboard.isDown("up") then vectorY = -1 player.anim = player.animations.walkUp player.dir = "up" end if love.keyboard.isDown("down") then vectorY = 1 player.anim = player.animations.walkDown player.dir = "down" end player:setLinearVelocity(vectorX * player.speed, vectorY * player.speed) -- Check if player is moving if vectorX == 0 and vectorY == 0 then player.isMoving = false player.anim:gotoFrame(1) -- go to standing frame elseif not player.isMoving then player.isMoving = true player.anim:gotoFrame(2) end if love.keyboard.isDown("h") then player.hello = true else player.hello = false end elseif player.state == 1 then player.anim:update(dt) elseif player.state == 2 then player.isMoving = false player:setLinearVelocity(0, 0) end player:searchForItems() end function player:draw() love.graphics.setColor(1,1,1,1) local px = player:getX() local py = player:getY() -- sx represents the scale on the x axis for the player animation -- If it is -1, the animation will flip horizontally (for walking left) local sx = 1 if player.anim == player.animations.walkLeft or player.anim == player.animations.attackLeft then sx = -1 end if player.state == 0 or player.state == 1 then -- Draw the player's walk animation love.graphics.setColor(1, 1, 1, 1) --love.graphics.draw(sprites.linkWalkSheet, px, py - 182, nil, nil, nil, sprites.hello:getWidth()/2, sprites.hello:getHeight()/2) player.anim:draw(sprites.linkWalkSheet, px, py, nil, sx, 1, player.width/2, player.height/2) elseif player.state == 2 then love.graphics.draw(sprites.linkGet, px, py, nil, nil, 1, player.width/2, player.height/2) love.graphics.draw(player.holdSprite, px - 34, py - 46, 3*math.pi/2, nil, 1, 4, player.holdSprite:getHeight()/2) end if player.hello then love.graphics.draw(sprites.hello, px, py - 182, nil, nil, nil, sprites.hello:getWidth()/2, sprites.hello:getHeight()/2) end end function player:equipWeapon(type, id, tag) player.weaponType = type player.weaponId = id player.weaponTag = tag end function player:attack() if gamestate ~= 0 then return end if player.state == 0 then player.state = 1 player:setLinearVelocity(0, 0) if player.dir == "down" then player.anim = player.animations.attackDown elseif player.dir == "left" then player.anim = player.animations.attackLeft elseif player.dir == "right" then player.anim = player.animations.attackRight elseif player.dir == "up" then player.anim = player.animations.attackUp end if player.weaponTag ~= 0 then if player.weaponType == "sword" then sword:attack(player.weaponId) end end end end -- searches nearby items to pick up function player:searchForItems() for i,a in ipairs(items) do if distanceBetween(player:getX(), player:getY(), a.x, a.y) < 45 then player.state = 2 player.holdSprite = a.sprite player.timer = 0.85 a.collected = true if a.type == "sword" then addWeapon(a.type, a.id) end end end end -- Draws the hearts to the upper-left corner of the screen function player:drawHealth() local width = sprites.heart_filled:getWidth() + 10 for i=1, player.max_hearts do local offset = (i-1) * width local heartSprite = sprites.heart_filled if i > player.hearts then heartSprite = sprites.heart_empty end if player.hearts - i == -0.5 then heartSprite = sprites.heart_half end love.graphics.draw(heartSprite, 10 + offset, 10) end end
modifier_mana_into_health = class(Modifier) LinkLuaModifier("modifier_mana_into_health", modifier_mana_into_health) function modifier_mana_into_health:OnCreated () self.GetModifierBonus = self.GetModifierBonus self:SetVisible(true) end function modifier_mana_into_health:OnAttached() if(self:GetCaster():GetId() == self:GetParent():GetId()) then self:SetAuraRadius(20) else self.AbilityHandler = AbilitiesNotificationBus.Connect(self) end end -- Do checks here for mana spent and add health function modifier_mana_into_health:OnSpellStartFilter(id) self.OldMana = self:GetParent():GetValue("mana") end function modifier_mana_into_health:OnSpellStart(id) local currentMana = self:GetParent():GetValue("mana") local manaSpent = self.OldMana - currentMana local healAmount = self:GetAbility():GetSpecialValue("mana_to_health_percentage") / 100 self:GetParent():SetValue("hp",manaSpent * healAmount) end
local Util = require('opus.util') local Peripheral = Util.shallowCopy(_G.peripheral) function Peripheral.getList() if _G.device then return _G.device end local deviceList = { } for _,side in pairs(Peripheral.getNames()) do Peripheral.addDevice(deviceList, side) end return deviceList end function Peripheral.addDevice(deviceList, side) local name = side pcall(function() local ptype = Peripheral.getType(side) local dev = Peripheral.wrap(side) if not ptype or not dev then return end if ptype == 'modem' then if not Peripheral.call(name, 'isWireless') then -- ptype = 'wireless_modem' -- else ptype = 'wired_modem' if dev.isAccessPoint then -- avoid open computer relays being registered -- as 'wired_modem' ptype = dev.getMetadata().name or 'wired_modem' end end end local sides = { front = true, back = true, top = true, bottom = true, left = true, right = true } if sides[name] then local i = 1 local uniqueName = ptype while deviceList[uniqueName] do uniqueName = ptype .. '_' .. i i = i + 1 end name = uniqueName end -- this can randomly fail if not deviceList[name] then deviceList[name] = dev if deviceList[name] then Util.merge(deviceList[name], { name = name, type = ptype, side = side, }) end end end) return deviceList[name] end function Peripheral.getBySide(side) return Util.find(Peripheral.getList(), 'side', side) end function Peripheral.getByType(typeName) return Util.find(Peripheral.getList(), 'type', typeName) end function Peripheral.getByMethod(method) for _,p in pairs(Peripheral.getList()) do if p[method] then return p end end end -- match any of the passed arguments function Peripheral.get(args) if type(args) == 'string' then args = { type = args } end if args.name then return _G.device[args.name] end if args.type then local p = Peripheral.getByType(args.type) if p then return p end end if args.method then local p = Peripheral.getByMethod(args.method) if p then return p end end if args.side then local p = Peripheral.getBySide(args.side) if p then return p end end end return Peripheral
---Model API documentation ---Model API documentation ---@class model model = {} ---Cancels all animation on a model component. ---@param url string|hash|url the model for which to cancel the animation function model.cancel(url) end ---Gets the id of the game object that corresponds to a model skeleton bone. ---The returned game object can be used for parenting and transform queries. ---This function has complexity O(n), where n is the number of bones in the model skeleton. ---Game objects corresponding to a model skeleton bone can not be individually deleted. ---@param url string|hash|url the model to query ---@param bone_id string|hash id of the corresponding bone ---@return hash id of the game object function model.get_go(url, bone_id) end ---Plays an animation on a model component with specified playback ---mode and parameters. ---An optional completion callback function can be provided that will be called when ---the animation has completed playing. If no function is provided, ---a model_animation_done <> message is sent to the script that started the animation. --- The callback is not called (or message sent) if the animation is ---cancelled with model.cancel <>. The callback is called (or message sent) only for ---animations that play with the following playback modes: --- --- --- * go.PLAYBACK_ONCE_FORWARD --- --- * go.PLAYBACK_ONCE_BACKWARD --- --- * go.PLAYBACK_ONCE_PINGPONG ---@param url string|hash|url the model for which to play the animation ---@param anim_id string|hash id of the animation to play ---@param playback constant playback mode of the animation ---@param play_properties table optional table with properties Play properties table: ---@param complete_function function(self, message_id, message, sender)) function to call when the animation has completed. function model.play_anim(url, anim_id, playback, play_properties, complete_function) end return model
-- Minecraft Computercraft script for having a turtle build a cylindrical tower. -- Assumes no obstructions, turtle starts from the base of the tower on the left side -- and builds straight up. -- Requires: nothing -- Instructions: -- 0) Fuel turtle -- 1) Fill the inventory with blocks the tower shoud be made of -- 2) Supply two argumnents <radius> and <height> local args = {...} local radius = tonumber(args[1]); local topHeight = tonumber(args[2]); local slot = 1; turtle.select(slot); print("Creating tower with radius " .. radius .. " and height " .. topHeight); for h=1,topHeight,1 do turtle.up(); for i=0,3,1 do local x = radius; local y = 0; local turnedRight = false; while (x ~= 0 or y ~= radius) do local up = math.abs(radius - math.sqrt((x)*(x)+(y+1)*(y+1)) ); local right = math.abs(radius - math.sqrt((x-1)*(x-1)+(y)*(y)) ); if (right < up) then if not turnedRight then turtle.turnRight(); turnedRight = true; end turtle.forward(); x = x - 1; else if turnedRight then turtle.turnLeft(); turnedRight = false; end turtle.forward(); y = y + 1; end -- Switch slots if needed while turtle.getItemCount(slot) == 0 do slot = slot + 1; print("Switching to slot " .. slot); turtle.select(slot); end turtle.placeDown(); end end print("Finshed Row " .. h); end
local modkeys = {} --modkeys.super = 'Mod4' --modkeys.ctrl = 'Control' --modkeys.shift = 'Shift' --modkeys.alt = 'Mod1' return modkeys
return { name = 'Sabalan Pipeline', checkpoints = { LinearTransform(Vec3(0.040810, 0.000000, 0.999167), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.999167, 0.000000, 0.040810), Vec3(-873.548828, 148.250992, -708.107422)), LinearTransform(Vec3(-0.621267, 0.000000, 0.783599), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.783599, 0.000000, -0.621267), Vec3(-918.188599, 148.249039, -709.004028)), LinearTransform(Vec3(-0.955319, 0.000000, 0.295577), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.295577, 0.000000, -0.955319), Vec3(-993.619141, 145.144363, -791.446289)), LinearTransform(Vec3(-0.994734, 0.000000, -0.102488), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.102488, 0.000000, -0.994734), Vec3(-982.796875, 141.439270, -879.000000)), LinearTransform(Vec3(0.062728, 0.000000, -0.998031), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.998031, 0.000000, 0.062728), Vec3(-943.194763, 141.439301, -928.031006)), LinearTransform(Vec3(0.035173, 0.000000, -0.999381), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.999381, 0.000000, 0.035173), Vec3(-871.032227, 141.439316, -926.590820)), LinearTransform(Vec3(-0.023073, 0.000000, -0.999734), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.999734, 0.000000, -0.023073), Vec3(-786.595703, 137.084351, -923.982422)), LinearTransform(Vec3(-0.107318, 0.000000, -0.994225), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.994225, 0.000000, -0.107318), Vec3(-727.982422, 137.889465, -933.671326)), LinearTransform(Vec3(0.478607, 0.000000, -0.878029), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.878029, 0.000000, 0.478607), Vec3(-609.885742, 111.927536, -892.936523)), LinearTransform(Vec3(0.322418, 0.000000, -0.946598), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.946598, 0.000000, 0.322418), Vec3(-550.372070, 97.813385, -850.600586)), LinearTransform(Vec3(-0.477613, 0.000000, -0.878570), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.878570, 0.000000, -0.477613), Vec3(-494.983826, 97.076263, -860.379333)), LinearTransform(Vec3(-0.420910, 0.000000, -0.907102), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.907102, 0.000000, -0.420910), Vec3(-429.010468, 87.176102, -895.666382)), LinearTransform(Vec3(0.679180, 0.000000, -0.733972), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.733972, 0.000000, 0.679180), Vec3(-369.366333, 84.629807, -897.900513)), LinearTransform(Vec3(0.851037, 0.000000, -0.525106), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.525106, 0.000000, 0.851037), Vec3(-323.733398, 83.904190, -838.912354)), LinearTransform(Vec3(0.737380, 0.000000, 0.675478), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.675478, 0.000000, 0.737380), Vec3(-335.213837, 82.394157, -781.056396)), LinearTransform(Vec3(-0.231818, 0.000000, 0.972759), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.972759, 0.000000, -0.231818), Vec3(-439.801758, 87.754128, -715.454102)), LinearTransform(Vec3(-0.987821, 0.000000, 0.155592), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.155592, 0.000000, -0.987821), Vec3(-566.183594, 98.402374, -785.805054)), LinearTransform(Vec3(-0.049289, 0.000000, 0.998785), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.998785, 0.000000, -0.049289), Vec3(-587.813110, 101.550957, -815.151184)), LinearTransform(Vec3(0.249029, 0.000000, 0.968496), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.968496, 0.000000, 0.249029), Vec3(-663.054321, 119.811272, -796.182556)), LinearTransform(Vec3(-0.041559, 0.000000, 0.999136), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.999136, 0.000000, -0.041559), Vec3(-743.568481, 133.398636, -777.671936)), LinearTransform(Vec3(-0.479584, 0.000000, 0.877496), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.877496, 0.000000, -0.479584), Vec3(-826.613342, 143.662018, -788.986450)), LinearTransform(Vec3(-0.999760, 0.000000, -0.021917), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.021917, 0.000000, -0.999760), Vec3(-867.026001, 141.440231, -826.721497)), LinearTransform(Vec3(-0.999627, 0.000000, 0.027296), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.027296, 0.000000, -0.999627), Vec3(-847.940430, 140.220551, -908.130859)), LinearTransform(Vec3(-0.999971, 0.000000, -0.007612), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.007612, 0.000000, -0.999971), Vec3(-846.760742, 142.785049, -961.679688)), LinearTransform(Vec3(-0.984779, 0.000000, -0.173809), Vec3(0.000000, 1.000000, 0.000000), Vec3(0.173809, 0.000000, -0.984779), Vec3(-877.958740, 153.569138, -1103.340454)), LinearTransform(Vec3(-0.866149, 0.000000, 0.499786), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.499786, 0.000000, -0.866149), Vec3(-877.676758, 153.522079, -1141.957031)), LinearTransform(Vec3(-0.611927, 0.000000, 0.790915), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.790915, 0.000000, -0.611927), Vec3(-914.613281, 153.533066, -1194.987305)), }, spawns = { LinearTransform(Vec3(-0.100266, 0.000000, 0.994961), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.994961, 0.000000, -0.100266), Vec3(-827.687500, 148.215637, -704.163086)), LinearTransform(Vec3(-0.068231, 0.000000, 0.997670), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.997670, 0.000000, -0.068231), Vec3(-827.256836, 148.174606, -705.504395)), LinearTransform(Vec3(-0.045572, 0.000000, 0.998961), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.998961, 0.000000, -0.045572), Vec3(-827.167786, 148.158051, -706.863647)), LinearTransform(Vec3(-0.015325, 0.000000, 0.999883), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.999883, 0.000000, -0.015325), Vec3(-827.130920, 148.158020, -708.112488)), LinearTransform(Vec3(0.013045, 0.000000, 0.999915), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.999915, 0.000000, 0.013045), Vec3(-827.129456, 148.153091, -709.433411)), LinearTransform(Vec3(0.041404, 0.000000, 0.999143), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.999143, 0.000000, 0.041404), Vec3(-827.163147, 148.132614, -710.939514)), LinearTransform(Vec3(0.067842, 0.000000, 0.997696), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.997696, 0.000000, 0.067842), Vec3(-827.226746, 148.134140, -712.240173)), LinearTransform(Vec3(0.103644, 0.000000, 0.994614), Vec3(0.000000, 1.000000, 0.000000), Vec3(-0.994614, 0.000000, 0.103644), Vec3(-827.324585, 148.137070, -713.502747)), }, }
cpgf.import("cpgf", "builtin.debug"); function overrideEventReceiver(receiver, room, env, driver) local Room = room; local Driver = driver; local skin = env.getSkin(); local font = env.getFont("../../media/fonthaettenschweiler.bmp"); if font then skin.setFont(font); end local window = env.addWindow(irr.rect_s32(460,375,630,470), false, "Use 'E' + 'R' to change"); local ListBox = env.addListBox(irr.rect_s32(2,22,165,88), window); ListBox.addItem("Diffuse"); ListBox.addItem("Bump mapping"); ListBox.addItem("Parallax mapping"); ListBox.setSelected(1); ProblemText = env.addStaticText("Your hardware or this renderer is not able to use the needed shaders for this material. Using fall back materials.", irr.rect_s32(150,20,470,80)); ProblemText.setOverrideColor(irr.SColor(100,255,255,255)); local renderer = Driver.getMaterialRenderer(irr.EMT_PARALLAX_MAP_SOLID); if renderer and renderer.getRenderCapability() == 0 then ListBox.setSelected(2); end local setMaterial = function() local type = irr.EMT_SOLID; local index = ListBox.getSelected(); if index == 0 then type = irr.EMT_SOLID; elseif index == 1 then type = irr.EMT_NORMAL_MAP_SOLID; elseif index == 2 then type = irr.EMT_PARALLAX_MAP_SOLID; end Room.setMaterialType(type); local renderer = Driver.getMaterialRenderer(type); if not renderer or renderer.getRenderCapability() ~= 0 then ProblemText.setVisible(true); else ProblemText.setVisible(false); end end setMaterial(); receiver.OnEvent = function(me, event) if event.EventType == irr.EET_KEY_INPUT_EVENT and not event.KeyInput.PressedDown and Room and ListBox then local sel = ListBox.getSelected(); if event.KeyInput.Key == irr.KEY_KEY_R then sel = sel + 1; elseif event.KeyInput.Key == irr.KEY_KEY_E then sel = sel - 1; else return false; end if sel > 2 then sel = 0; end if sel < 0 then sel = 2; end ListBox.setSelected(sel); setMaterial(); end return false; end end function start() local driverType=irr.driverChoiceConsole(); if driverType==irr.EDT_COUNT then return 1; end local device = irr.createDevice(driverType, irr.dimension2d_u32(640, 480)); if device == nil then return 1; end local driver = device.getVideoDriver(); local smgr = device.getSceneManager(); local env = device.getGUIEnvironment(); driver.setTextureCreationFlag(irr.ETCF_ALWAYS_32_BIT, true); env.addImage(driver.getTexture("../../media/irrlichtlogo2.png"), irr.position2d_s32(10,10)); local camera = smgr.addCameraSceneNodeFPS(); camera.setPosition(irr.vector3df(-200,200,-200)); device.getCursorControl().setVisible(false); driver.setFog(irr.SColor(0,138,125,81), irr.EFT_FOG_LINEAR, 250, 1000, 0.003, true, false); local roomMesh = smgr.getMesh("../../media/room.3ds"); local room = nil; if roomMesh then smgr.getMeshManipulator().makePlanarTextureMapping(roomMesh.getMesh(0), 0.003); local normalMap = driver.getTexture("../../media/rockwall_height.bmp"); if normalMap then driver.makeNormalMapTexture(normalMap, 9.0); end local tangentMesh = smgr.getMeshManipulator().createMeshWithTangents(roomMesh.getMesh(0)); room = smgr.addMeshSceneNode(tangentMesh); room.setMaterialTexture(0, driver.getTexture("../../media/rockwall.jpg")); room.setMaterialTexture(1, normalMap); room.getMaterial(0).SpecularColor.set(0,0,0,0); room.setMaterialFlag(irr.EMF_FOG_ENABLE, true); room.setMaterialType(irr.EMT_PARALLAX_MAP_SOLID); room.getMaterial(0).MaterialTypeParam = 0.035; tangentMesh.drop(); end local earthMesh = smgr.getMesh("../../media/earth.x"); if earthMesh then local manipulator = smgr.getMeshManipulator(); local tangentSphereMesh = manipulator.createMeshWithTangents(earthMesh.getMesh(0)); manipulator.setVertexColorAlpha(tangentSphereMesh, 200); local m = irr.matrix4(); m.setScale (irr.vector3df(50,50,50) ); manipulator.transformMesh( tangentSphereMesh, m ); local sphere = smgr.addMeshSceneNode(tangentSphereMesh); sphere.setPosition(irr.vector3df(-70,130,45)); local earthNormalMap = driver.getTexture("../../media/earthbump.jpg"); if earthNormalMap then driver.makeNormalMapTexture(earthNormalMap, 20.0); sphere.setMaterialTexture(1, earthNormalMap); sphere.setMaterialType(irr.EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA); end sphere.setMaterialFlag(irr.EMF_FOG_ENABLE, true); local anim = smgr.createRotationAnimator(irr.vector3df(0,0.1,0)); sphere.addAnimator(anim); anim.drop(); tangentSphereMesh.drop(); end local light1 = smgr.addLightSceneNode(nil, irr.vector3df(0,0,0), irr.SColorf(0.5, 1.0, 0.5, 0.0), 800.0); light1.setDebugDataVisible ( irr.EDS_BBOX ); local anim = smgr.createFlyCircleAnimator (irr.vector3df(50,300,0),190.0, -0.003); light1.addAnimator(anim); anim.drop(); local bill = smgr.addBillboardSceneNode(light1, irr.dimension2d_f32(60, 60)); bill.setMaterialFlag(irr.EMF_LIGHTING, false); bill.setMaterialFlag(irr.EMF_ZWRITE_ENABLE, false); bill.setMaterialType(irr.EMT_TRANSPARENT_ADD_COLOR); bill.setMaterialTexture(0, driver.getTexture("../../media/particlered.bmp")); local light2 = smgr.addLightSceneNode(nil, irr.vector3df(0,0,0), irr.SColorf(1.0, 0.2, 0.2, 0.0), 800.0); anim = smgr.createFlyCircleAnimator(irr.vector3df(0,150,0), 200.0, 0.001, irr.vector3df(0.2, 0.9, 0.0)); light2.addAnimator(anim); anim.drop(); bill = smgr.addBillboardSceneNode(light2, irr.dimension2d_f32(120, 120)); bill.setMaterialFlag(irr.EMF_LIGHTING, false); bill.setMaterialFlag(irr.EMF_ZWRITE_ENABLE, false); bill.setMaterialType(irr.EMT_TRANSPARENT_ADD_COLOR); bill.setMaterialTexture(0, driver.getTexture("../../media/particlewhite.bmp")); local ps = smgr.addParticleSystemSceneNode(false, light2); local em = ps.createBoxEmitter(irr.aabbox3d_f32(-3,0,-3,3,1,3), irr.vector3df(0.0,0.03,0.0), 80,100, irr.SColor(0,255,255,255), irr.SColor(0,255,255,255), 400,1100); em.setMinStartSize(irr.dimension2d_f32(30.0, 40.0)); em.setMaxStartSize(irr.dimension2d_f32(30.0, 40.0)); ps.setEmitter(em); em.drop(); local paf = ps.createFadeOutParticleAffector(); ps.addAffector(paf); paf.drop(); ps.setMaterialFlag(irr.EMF_LIGHTING, false); ps.setMaterialFlag(irr.EMF_ZWRITE_ENABLE, false); ps.setMaterialTexture(0, driver.getTexture("../../media/fireball.bmp")); ps.setMaterialType(irr.EMT_TRANSPARENT_VERTEX_ALPHA); local receiver = irr.IEventReceiverWrapper(); overrideEventReceiver(receiver, room, env, driver); device.setEventReceiver(receiver); local lastFPS = -1; while device.run() do if device.isWindowActive() then driver.beginScene(true, true, 0); smgr.drawAll(); env.drawAll(); driver.endScene(); local fps = driver.getFPS(); if lastFPS ~= fps then local tmp = "Per pixel lighting example - cpgf Irrlicht Lua Binding ["; tmp = tmp .. driver.getName(); tmp = tmp .. "] FPS:"; tmp = tmp .. fps; device.setWindowCaption(tmp); lastFPS = fps; end end end device.drop(); return 0; end start();
local terminalOverRednet = require("remoteShell.terminalOverRednet") peripheral.find("modem", function(side) rednet.open(side) end) -- TODO: mbs support? choosable startup program -- TODO: arg checks -- TODO: file transfer -- TODO: folder/drive mounting -- TODO: remote peripherals -- TODO: client catch terminate events and give menu to quite or forward terminate -- TODO: vnc mode -- TODO: encrypt mode? -- TODO: forward connections or prevent connecting through a server -- TODO: send diconnect on server terminate local args = table.pack(...) local function main() if args[1] == "client" then local hostId = tonumber(args[2]) terminalOverRednet.connectToRemoteTerminal(hostId, term.current()) elseif args[1] == "server" then terminalOverRednet.remoteTerminalDeamon() end end parallel.waitForAny(terminalOverRednet.eventTranslatorDeamon, main)
require("rrpg.lua"); local __o_rrpgObjs = require("rrpgObjs.lua"); require("rrpgGUI.lua"); require("rrpgDialogs.lua"); require("rrpgLFM.lua"); require("ndb.lua"); function newfrmInstalled() __o_rrpgObjs.beginObjectsLoading(); local obj = gui.fromHandle(_obj_newObject("form")); local self = obj; local sheet = nil; rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject")); function obj:setNodeObject(nodeObject) sheet = nodeObject; self.sheet = nodeObject; self:_oldSetNodeObjectFunction(nodeObject); end; function obj:setNodeDatabase(nodeObject) self:setNodeObject(nodeObject); end; _gui_assignInitialParentForForm(obj.handle); obj:beginUpdate(); obj:setName("frmInstalled"); obj:setAlign("client"); obj.scrollBox1 = gui.fromHandle(_obj_newObject("scrollBox")); obj.scrollBox1:setParent(obj); obj.scrollBox1:setAlign("client"); obj.scrollBox1:setName("scrollBox1"); obj.installedPluginsList = gui.fromHandle(_obj_newObject("recordList")); obj.installedPluginsList:setParent(obj.scrollBox1); obj.installedPluginsList:setAlign("client"); obj.installedPluginsList:setField("installedPluginsList"); obj.installedPluginsList:setName("installedPluginsList"); obj.installedPluginsList:setTemplateForm("frmInstalledPlugin"); obj._e_event0 = obj.installedPluginsList:addEventListener("onCompare", function (self, nodeA, nodeB) if nodeA.enabled and nodeB.enabled then return utils.compareStringPtBr(nodeA.name, nodeB.name); elseif nodeA.enabled then return 1; elseif nodeB.enabled then return -1; end; end, obj); function obj:_releaseEvents() __o_rrpgObjs.removeEventListenerById(self._e_event0); end; obj._oldLFMDestroy = obj.destroy; function obj:destroy() self:_releaseEvents(); if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then self:setNodeDatabase(nil); end; if self.installedPluginsList ~= nil then self.installedPluginsList:destroy(); self.installedPluginsList = nil; end; if self.scrollBox1 ~= nil then self.scrollBox1:destroy(); self.scrollBox1 = nil; end; self:_oldLFMDestroy(); end; obj:endUpdate(); __o_rrpgObjs.endObjectsLoading(); return obj; end; local _frmInstalled = { newEditor = newfrmInstalled, new = newfrmInstalled, name = "frmInstalled", dataType = "", formType = "undefined", formComponentName = "form", title = "", description=""}; frmInstalled = _frmInstalled; rrpg.registrarForm(_frmInstalled); return _frmInstalled;
gemai = {} b.dofile("actions.lua") b.dofile("context.lua") b.dofile("entity.lua")
-- This is a part of uJIT's testing suite. -- Copyright (C) 2020-2021 LuaVela Authors. See Copyright Notice in COPYRIGHT -- Copyright (C) 2015-2020 IPONWEB Ltd. See Copyright Notice in COPYRIGHT -- This test assumes that JIT is on, starts recording on 2-th iteration and -- fails with "missing metamethod" message (grep NOMM for more info). jit.on() assert(jit.status()) jit.opt.start('hotloop=1') local n = 0 local mt = { __newindex = nil } debug.setmetatable(n, mt) for i = 1, 3 do -- Recording starts here. if (i == 2) then n[1] = "mystring" end end
local g, opt = vim.g, vim.opt opt.termguicolors = true opt.background = "dark" g.material_style = "darker" require("material").setup({ popup_menu = "dark", text_contrast = { darker = true }, contrast_widonws = { "packer", "fzf", "terminal" }, }) require("which-key").register({ ["<leader>mm"] = { "<cmd>lua require('material.functions').toggle_style()<CR>", "Toogle scheme", }, }, { noremap = true, silent = true, }) vim.cmd([[colorscheme material]])
require("ypcall") -- must be first, as it changes globals require("asm") require("testing") local labels = asm.loadlabels("build/taus.lbl") function test_chartEffConvert () local chartEffConvertDivisor if labels.chartEffConvert == labels.div3 then chartEffConvertDivisor = 3 elseif labels.chartEffConvert == labels.div3125 then chartEffConvertDivisor = 3.125 else error("unknown chartEffConvert") end for i=0,255 do asm.waitbefore() asm.waitbefore() local raw = i / chartEffConvertDivisor local expected = math.floor(i / chartEffConvertDivisor) memory.setregister("a", i) asm.jsr(labels.chartEffConvert) local result = memory.getregister("a") if result ~= expected then error("i " .. i .. " expected: " .. expected .. " actual: " .. result .. " raw: " .. raw) end asm.waitbefore() emu.poweron() end end function test_drawChartBackground () asm.waitbefore() asm.waitbefore() local levelEffs = {8, 8, 9, 9, 8, 9, 16, 17, 48, 1} for i, levelEffs in ipairs(levelEffs) do memory.writebyte(labels.levelEffs+(i-1), levelEffs) end asm.jsr(labels.drawChartBackground) local n = 0x48 -- none local r = 0x49 -- right local l = 0x4A -- left local b = 0x4B -- both local gn = 0x50 -- gridline none local gr = 0x51 -- gridline right local gl = 0x52 -- gridline left local gb = 0x53 -- gridline both local goldenPlayfield = { {gn, gn, gn, gn, gn, gn, gn, gn, gn, gn}, { n, n, n, n, l, n, n, n, n, n}, {gn, gn, gn, gn, gl, gn, gn, gn, gn, gn}, { n, n, n, n, l, n, n, n, n, n}, {gn, gn, gn, gr, gl, gn, gn, gn, gn, gn}, { n, b, r, b, l, n, n, n, n, n}, } local failed = false for i, row in ipairs(goldenPlayfield) do i = i - 1 for j, expected in ipairs(row) do j = j - 1 local b = memory.readbyte(labels.playfield + (14 + i) * 10 + j) if b ~= expected then failed = true print(string.format("playfield (%d,%d) expected: %X actual: %X", i, j, expected, b)) end end end if failed then error("playfield did not match expected") end end function test_drawChartSprites () asm.waitbefore() asm.waitbefore() local levelEffs = { 48, 14, 14, 48, 16, 14, 14, 16, 16, 8, 8, 16, 9, 8, 14, 0, 0, 0, 0, 0, } for i, levelEffs in ipairs(levelEffs) do memory.writebyte(labels.levelEffs+(i-1), levelEffs) end memory.writebyte(labels.oamStagingLength, 0) asm.jsr(labels.drawChartBackground) asm.jsr(labels.drawChartSprites) local d0 = 0x40 -- endcap, diff 0 local d1 = 0x41 -- endcap, diff 1 local d2 = 0x42 -- endcap, diff 2 local d3 = 0x43 -- endcap, diff 3 local d4 = 0x44 -- endcap, diff 4 local d5 = 0x45 -- endcap, diff 5 local d6 = 0x46 -- endcap, diff 6 local d7 = 0x47 -- endcap, diff 7 local f = 0x4C -- seven-pixel filler local e = 0x4D -- single endcap local an = 0x22 -- attributes, normal local af = 0x62 -- attributes, flip horiz local goldenSprites = { -- Y, Tile, Attr, X {48 , e, an, 0}, {14 , e, af, 0}, {14 , e, an, 8}, {48 , e, af, 8}, {14+7, d2, af, 16}, {14-1, f, af, 16}, {14+7, d2, an, 24}, {14-1, f, an, 24}, {16 , e, an, 32}, { 8 , e, af, 32}, { 8 , e, an, 40}, {16 , e, af, 40}, { 8+7, d1, af, 48}, { 8-1, f, af, 48}, {14 , e, an, 56}, } for _, sprite in ipairs(goldenSprites) do sprite[1] = 0x2F + 20 * 8 - sprite[1] sprite[4] = 0x60 + sprite[4] end local failed = false local expected = #goldenSprites * 4 local actual = memory.readbyte(labels.oamStagingLength) if actual ~= expected then failed = true print(string.format("oamStagingLength expected: %d actual %d", expected, actual)) end for i, sprite in ipairs(goldenSprites) do i = i - 1 for j, expected in ipairs(sprite) do j = j - 1 local b = memory.readbyte(labels.oamStaging + (i * 4) + j) if b ~= expected then failed = true print(string.format("oamStaging (%d,%d) expected: %X actual: %X", i, j, expected, b)) end end end if failed then error("oamStaging did not match expected") end end testing.run()
scriptPath = chinGetScriptPath() chiDefaultFloorObj = chiObjectCreate("CHI_WORLD_DEFAULTFLOOR") chiDefaultFloorSurf = chiObjectLoadSurface(scriptPath.."/obj/D01_FloorTile.obj") chiObjectAddSurface(chiDefaultFloorObj,chiDefaultFloorSurf) chiDefaultFloorMat = chiMaterialCreate("CHI_WORLD_DEFAULTFLOOR") chiDefaultFloorTex = chiTextureLoad(scriptPath.."/textures/C01_FloorTile.png") chiMaterialSetProperty(chiDefaultFloorMat,"DiffuseTexture",chiDefaultFloorTex) chiMaterialSetProperty(chiDefaultFloorMat,"DiffuseTextureEnabled",true) chiObjectSetProperty(chiDefaultFloorObj,"Material",chiDefaultFloorMat)
--[[ TheNexusAvenger Controls the UI for the timer and round loading. --]] local Workspace = game:GetService("Workspace") local Players = game:GetService("Players") local Lighting = game:GetService("Lighting") local ReplicatedStorage = game:GetService("ReplicatedStorage") local ReplicatedStorageProject = require(ReplicatedStorage:WaitForChild("Project"):WaitForChild("ReplicatedStorage")) local FlashScreen = ReplicatedStorageProject:GetResource("UI.FlashScreen") local TextTimer = ReplicatedStorageProject:GetResource("UI.TextTimer") local CurrentRoundState = ReplicatedStorageProject:GetResource("State.CurrentRound") local GameTypes = ReplicatedStorageProject:GetResource("Data.GameTypes") --Connect creating the uesr interface. CurrentRoundState:ConnectTo("CurrentRound",{ Start = function(self,CurrentRound) --Create the user interface. local RoundGui = Instance.new("ScreenGui") RoundGui.Name = "RoundGui" RoundGui.ResetOnSpawn = false RoundGui.DisplayOrder = 5 RoundGui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui") self.CurrentRoundGui = RoundGui local LoadingTopFrame = Instance.new("Frame") LoadingTopFrame.BackgroundColor3 = Color3.new(0,0,0) LoadingTopFrame.BorderSizePixel = 0 LoadingTopFrame.Size = UDim2.new(1,0,0.4,0) LoadingTopFrame.Position = UDim2.new(0,0,-0.3,0) LoadingTopFrame.Visible = false LoadingTopFrame.Parent = RoundGui local LoadingBottomFrame = Instance.new("Frame") LoadingBottomFrame.BackgroundColor3 = Color3.new(0,0,0) LoadingBottomFrame.BorderSizePixel = 0 LoadingBottomFrame.Size = UDim2.new(1,0,0.4,0) LoadingBottomFrame.Position = UDim2.new(0,0,0.9,0) LoadingBottomFrame.Visible = false LoadingBottomFrame.Parent = RoundGui local TimerMessageText = Instance.new("TextLabel") TimerMessageText.BackgroundTransparency = 1 TimerMessageText.Size = UDim2.new(1,0,0.05,0) TimerMessageText.Position = UDim2.new(0,0,0.02,0) TimerMessageText.Font = "SourceSansBold" TimerMessageText.TextColor3 = Color3.new(0,0,0) TimerMessageText.TextStrokeColor3 = Color3.new(1,1,1) TimerMessageText.TextStrokeTransparency = 0 TimerMessageText.TextScaled = true TimerMessageText.Visible = false TimerMessageText.Parent = RoundGui local TimerTimeText = Instance.new("TextLabel") TimerTimeText.BackgroundTransparency = 1 TimerTimeText.Size = UDim2.new(1,0,0.075,0) TimerTimeText.Position = UDim2.new(0.5,0,0.06 + (0.075/2),0) TimerTimeText.AnchorPoint = Vector2.new(0.5,0.5) TimerTimeText.Font = "SourceSansBold" TimerTimeText.TextColor3 = Color3.new(0,0,0) TimerTimeText.TextStrokeColor3 = Color3.new(1,1,1) TimerTimeText.TextStrokeTransparency = 0 TimerTimeText.TextScaled = true TimerTimeText.Visible = false TimerTimeText.Parent = RoundGui local GameTypeNameText = Instance.new("TextLabel") GameTypeNameText.BackgroundTransparency = 1 GameTypeNameText.Size = UDim2.new(1,0,0.075,0) GameTypeNameText.Position = UDim2.new(0,0,0.125,0) GameTypeNameText.Font = "SourceSansBold" GameTypeNameText.TextColor3 = Color3.new(0,0,0) GameTypeNameText.TextStrokeColor3 = Color3.new(1,1,1) GameTypeNameText.TextStrokeTransparency = 0 GameTypeNameText.TextScaled = true GameTypeNameText.Visible = false GameTypeNameText.Parent = RoundGui local GameTypeDescriptionText = Instance.new("TextLabel") GameTypeDescriptionText.BackgroundTransparency = 1 GameTypeDescriptionText.Size = UDim2.new(1,0,0.05,0) GameTypeDescriptionText.Position = UDim2.new(0,0,0.18,0) GameTypeDescriptionText.Font = "SourceSansBold" GameTypeDescriptionText.TextColor3 = Color3.new(0,0,0) GameTypeDescriptionText.TextStrokeColor3 = Color3.new(1,1,1) GameTypeDescriptionText.TextStrokeTransparency = 0 GameTypeDescriptionText.TextScaled = true GameTypeDescriptionText.Visible = false GameTypeDescriptionText.Parent = RoundGui --Display the loading information. if CurrentRound.State == "LOADING" then --Flash the screen and blur the screen. local Blur = Instance.new("DepthOfFieldEffect") Blur.FocusDistance = 50 Blur.InFocusRadius = 10 Blur.Parent = Lighting FlashScreen() --Set the camera. local LoadingCameraPositionPart = CurrentRound.Map:WaitForChild("LoadingCameraPosition") local Camera = Workspace.CurrentCamera Camera.CameraType = Enum.CameraType.Scriptable Camera.CFrame = LoadingCameraPositionPart.CFrame Camera.Focus = LoadingCameraPositionPart.CFrame * CFrame.new(0,0,-1) --Display the information. local GameData = GameTypes[CurrentRound.Name] LoadingTopFrame.Visible = true LoadingBottomFrame.Visible = true TimerMessageText.Visible = false TimerTimeText.Visible = false GameTypeNameText.Visible = true GameTypeDescriptionText.Visible = true GameTypeNameText.Text = string.upper(GameData.DisplayName) GameTypeDescriptionText.Text = GameData.Description --Wait for the character to load. if CurrentRound.Players:Contains(Players.LocalPlayer) then Players.LocalPlayer.CharacterAdded:Wait() local Character = Players.LocalPlayer.Character if Character then local Humanoid = Character:FindFirstChildOfClass("Humanoid") if Humanoid then Camera.CameraSubject = Humanoid end end else while CurrentRound.State == "LOADING" do CurrentRound:GetPropertyChangedSignal("State"):Wait() end end Blur:Destroy() FlashScreen() Camera.CameraType = Enum.CameraType.Custom end --Update the visible components. LoadingTopFrame.Visible = false LoadingBottomFrame.Visible = false TimerMessageText.Visible = true TimerTimeText.Visible = true GameTypeNameText.Visible = false GameTypeDescriptionText.Visible = false --Set up the round timer. local TimerTextChangedEvent = CurrentRound:GetPropertyChangedSignal("TimerText"):Connect(function() TimerMessageText.Text = CurrentRound.TimerText end) TimerMessageText.Text = CurrentRound.TimerText local RoundTimer = TextTimer.new(TimerTimeText,CurrentRound.Timer) self.CurrentRoundTimer = RoundTimer --Wait for the round to end. while CurrentRoundState.CurrentRound == CurrentRound and CurrentRound.State ~= "ENDED" do CurrentRound:GetPropertyChangedSignal("State"):Wait() end TimerTextChangedEvent:Disconnect() RoundTimer:Destroy() --Display the round end. if self:IsActive() then --Display the blur and the user interface. local Blur = Instance.new("DepthOfFieldEffect") Blur.FocusDistance = 50 Blur.InFocusRadius = 10 Blur.Parent = Lighting LoadingTopFrame.Visible = true LoadingBottomFrame.Visible = true TimerMessageText.Visible = false TimerTimeText.Visible = false FlashScreen() --Set the camera. local LoadingCameraPositionPart = CurrentRound.Map:WaitForChild("LoadingCameraPosition") local Camera = Workspace.CurrentCamera Camera.CameraType = Enum.CameraType.Scriptable Camera.CFrame = LoadingCameraPositionPart.CFrame Camera.Focus = LoadingCameraPositionPart.CFrame * CFrame.new(0,0,-1) --Wait for the player to be done viewing the end. CurrentRoundState.CurrentRoundChanged:Wait() if not Players.LocalPlayer.Character then Players.LocalPlayer.CharacterAdded:Wait() end FlashScreen() --Reset the camera. Camera.CameraType = Enum.CameraType.Custom local Character = Players.LocalPlayer.Character if Character then local Humanoid = Character:FindFirstChildOfClass("Humanoid") if Humanoid then Camera.CameraSubject = Humanoid end end --Destroy the user interface. Blur:Destroy() self:Clear() end end, Clear = function(self) if self.CurrentRoundGui then self.CurrentRoundGui:Destroy() self.CurrentRoundGui = nil end if self.CurrentRoundTimer then self.CurrentRoundTimer:Destroy() self.CurrentRoundTimer = nil end end, }) --Connect flashing the client on character spawning, except the first spawn. if not Players.LocalPlayer.Character then Players.LocalPlayer.CharacterAdded:Wait() end Players.LocalPlayer.CharacterAdded:Connect(FlashScreen)
local WIDGET, VERSION = 'CheckBox', 2 local GUI = LibStub('NetEaseGUI-2.0') local CheckBox = GUI:NewClass(WIDGET, 'CheckButton', VERSION) if not CheckBox then return end function CheckBox:Constructor() self:SetSize(16, 16) --customized self:SetBackdrop{ bgFile = [[Interface\BUTTONS\WHITE8X8.blp]], edgeFile = [[Interface\BUTTONS\WHITE8X8.blp]], edgeSize = 1, tileSize = 1, tile = true, insets = { left = 0, right = 0, top = 0, bottom = 0 } } self:SetBackdropColor(0.1, 0.1, 0.1, 1) self:SetBackdropBorderColor(0, 0, 0, 1) self:SetHighlightTexture(nil) --end --self:SetNormalTexture([[Interface\Buttons\UI-CheckBox-Up]]) self:SetCheckedTexture([[Interface\Buttons\UI-CheckBox-Check]]) --self:SetPushedTexture([[Interface\Buttons\UI-CheckBox-Down]]) self:SetDisabledCheckedTexture([[INTERFACE\BUTTONS\UI-CheckBox-Check-Disabled]]) local Text = self:CreateFontString(nil, 'OVERLAY') Text:SetPoint('LEFT', self, 'RIGHT', 2, 0) self:SetFontString(Text) self:SetNormalFontObject('GameFontNormalSmall') self:SetHighlightFontObject('GameFontHighlightSmall') self:SetDisabledFontObject('GameFontDisableSmall') self.Text = Text end function CheckBox:SetText(text) self.Text:SetText(text) self:SetHitRectInsets(0, - self.Text:GetWidth(), 0, 0) end
local layerBase = require("games/common2/module/layerBase"); --[[ 玩家头像功能层 ]] local HeadLayer = class(layerBase); HeadLayer.Delegate = { }; HeadLayer.s_cmds = { }; HeadLayer.ctor = function(self) self:init(); end HeadLayer.dtor = function(self) end HeadLayer.init = function (self) if PrivateRoomIsolater.getInstance():isInJiFenRoom() then return; end if PrivateRoomIsolater.getInstance():isInPrivateRoom() then local config = table.verify(GameProcessManager2.getInstance():getGameConfig()); local playerNumer = number.valueOf(config.playerNumer,3); for seat = 1, playerNumer do if not self.m_views[seat] then self:addView(seat,self.m_viewConfig[seat]); end end end end HeadLayer.resetHeadPosition = function (self,seat,uid,info,isFast) local config = self.m_viewConfig[seat]; if self.m_views[seat] and config.pos then self.m_views[seat]:setPos(config.pos.x,config.pos.y); self.m_views[seat]:setAlign(config.align); end end -- 初始化layer的配置 HeadLayer.initViewConfig = function(self) self.m_viewConfig = { [1] = { path = "games/common2/module/head/headViewBase"; }; [2] = { path = "games/common2/module/head/headViewBase"; }; [3] = { path = "games/common2/module/head/headViewBase"; }; }; local config = table.verify(GameProcessManager2.getInstance():getGameConfig()); for k, v in ipairs(self.m_viewConfig) do self.m_viewConfig[k].config = config; end end HeadLayer.onLogout = function(self,seat,uid,info,isFast) if self.m_views[seat] and seat ~= PlayerSeat.getInstance():getMyLocalSeat() then if PrivateRoomIsolater.getInstance():isInPrivateRoom() then if PrivateRoomIsolater.getInstance():isInJiFenRoom() then Log.d("HeadLayer.onLogout seat = ",seat) self:removeView(seat); else self.m_views[seat]:clear(); end else self:removeView(seat); end InteractionInfo.getInstance():reset(seat); end end HeadLayer.s_stateFuncMap = { [GameMechineConfig.STATUS_LOGIN] = "init"; [GameMechineConfig.STATUS_NONE] = "onLogout"; [GameMechineConfig.STATUS_LOGOUT] = "onLogout"; [GameMechineConfig.STATUS_GAMEOVER] = "resetHeadPosition"; }; HeadLayer.s_actionFuncMap = { [GameMechineConfig.ACTION_NS_REFRESH_PRIVATE_ROOM] = "init"; } HeadLayer.s_cmdConfig = { }; return HeadLayer; --[[ 公共头像模块说明 头像模块使用说明: 1、公共头像模块,提供了一个基础的头像功能,可以显示头像信息、VIP状态、邀请按钮、银币信息、昵称信息、 破产状态(破产时,头像上显示破产的动画)、防作弊逻辑、比赛分数计算 2、子游戏可自定义头像,通过继承的方式,把功能头像的功能添加到子游戏中。 3、互动道具、聊天等动画的位置都是根据头像位置来计算的,通过InteractionInfo来设置对于位置的头像相关信息,来获取坐标信息。 头像位置发生变化时,需要通知InteractionInfo来刷新坐标信息。 4、破产时,头像上会播放破产动画,在准备后会停止动画。 5、开启防作弊时,昵称和头像都不显示真实的信息。 6、若子游戏的头像完全是自己定义的,需要处理破产动画、防作弊、比赛积分刷新、银币刷新、昵称刷新等逻辑。如果是继承的方式就不需要子游戏单独处理。 监听的状态: STATUS_LOGIN:私人房创建时,重新调用头像初始化的逻辑 STATUS_LOGOUT:如果是其它玩家,删除头像 STATUS_GAMEOVER:重置头像位置 STATUS_JOIN/STATUS_LOGIN/STATUS_GAMEOVER:刷新头像相关的个人信息 STATUS_READY/STATUS_PLAYING:停止头像上的破产动画 监听的动作: ACTION_NS_REFRESH_PRIVATE_ROOM:私人房时,重新调用头像初始化的逻辑 ACTION_NS_UPDATE_USERINFO:个人信息或身份信息发生变化时,刷新头像 ACTION_NS_ROBOT:托管状态变化时,通知头像刷新 ACTION_NS_MATCH_SCORE:比赛时,分数变化,通知头像刷新分数 ACTION_NS_REFRESH_USERPROPERTY:刷新用户的资产信息 headview中提供setNickNameMaxLen:设置默认的昵称最大长度 ]]
TestModule = {} register_module(TestModule,"TestModule"); function TestModule.Init() io.write("TestModule Init!\n"); io.write("Addr of pPluginManager " .. tostring(pPluginManager) .. "\n"); local pKernelModule = pPluginManager:FindKernelModule("NFCKernelModule"); io.write("Addr of NFCKernelModule " .. tostring(pKernelModule) .. "\n"); local pLogicClassModule = pPluginManager:FindLogicClassModule("NFCLogicClassModule"); io.write("Addr of NFCLogicClassModule " .. tostring(pLogicClassModule) .. "\n"); local pElementInfoModule = pPluginManager:FindElementInfoModule("NFCElementInfoModule"); io.write("Addr of NFCElementInfoModule " .. tostring(pElementInfoModule) .. "\n"); pLuaScriptModule:AddClassCallBack("Player", "TestModule.OnClassCommonEvent"); end function TestModule.AfterInit() io.write("TestModule AfterInit!" .. tostring(pLuaScriptModule) .. "\n"); local pKernelModule = pPluginManager:FindKernelModule("NFCKernelModule"); pKernelModule:CreateScene(1); local pObject = pKernelModule:CreateObject(NFGUID(), 1, 0, "Player", "", NFCDataList()); local OID = pObject:Self(); --property callback pLuaScriptModule:AddPropertyCallBack(OID, "MAXHP", "TestModule.MaxPropertyCallBack"); pKernelModule:SetPropertyInt(OID,"MAXHP",100); --record callback pLuaScriptModule:AddRecordCallBack(OID, "TaskList", "TestModule.TaskListCallBack"); local varTask = NFCDataList(); varTask:AddString("Task_From_Lua"); varTask:AddInt(1); varTask:AddInt(1); pLuaScriptModule:AddRow(OID, "TaskList", varTask); pKernelModule:SetRecordInt(OID, "TaskList", 0, 1, 3); pKernelModule:SetRecordString(OID, "TaskList", 0, 0, "NewStr_Task_From_Lua"); --event callback pLuaScriptModule:AddEventCallBack(OID, 1, "TestModule.EventCallBack"); local obj = NFCDataList(); obj:AddInt(21); obj:AddFloat(22.5); obj:AddString("str23"); local ident = NFGUID(); ident:SetHead(241); ident:SetData(242); obj:AddObject(ident); pKernelModule:DoEvent(OID, 1, obj); --Hearback pLuaScriptModule:AddHeartBeat(OID, "strHeartBeatName", "TestModule.HearCallBack", 2, 55555); end function TestModule.MaxPropertyCallBack(self, propertyName, oldVar, newVar) local nOldVar = oldVar:GetInt(); local nNewVar = newVar:GetInt(); local obj = NFCDataList(); io.write("Hello Lua MaxPropertyCallBack oldVar:" .. tostring(nOldVar) .. " newVar:" .. tostring(nNewVar) .. "\n"); end function TestModule.TaskListCallBack(self, recordName, nOpType, nRow, nCol, oldVar, newVar) io.write("Hello Lua TaskListCallBack ") if nCol == 0 then local nOldVar = oldVar:GetString(); local nNewVar = newVar:GetString(); io.write(" nOpType:".. tostring(nOpType).. " oldVar:".. tostring(nOldVar) .." newVar:" .. tostring(nNewVar) .. "\n"); end if nCol == 1 then local nOldVar = oldVar:GetInt(); local nNewVar = newVar:GetInt(); io.write(" nOpType:".. tostring(nOpType).. " oldVar:".. tostring(nOldVar) .." newVar:" .. tostring(nNewVar) .. "\n"); end end function TestModule.EventCallBack(self, nEventID, arg) local nValue = arg:Int(0); local fValue = arg:Float(1); local strValue = arg:String(2); local ident = arg:Object(3); local head = ident:GetHead(); local data = ident:GetData(); io.write("Hello Lua EventCallBack nEventID:".. nEventID .. "\n"); io.write("\r\targ:nValue:".. tostring(nValue) .. " fValue:"..tostring(fValue).. " strValue:"..tostring(strValue).." head:"..tostring(head).." data:"..tostring(data).."\n"); end function TestModule.HearCallBack(self, strHeartBeat, fTime, nCount) local obj = NFCDataList(); --local s = os.clock() local s = pPluginManager:GetNowTime(); if oldTime == nil then oldTime = s end io.write("Hello Lua HearCallBack :".. strHeartBeat .. " Time:" .. (s-oldTime) .. "\n"); oldTime = s; end function TestModule.OnClassCommonEvent(self, strClassName, eventID, varData) io.write("onClassCommonEvent, ClassName: " .. tostring(strClassName) .. " EventID: " .. tostring(eventID) .. "\n"); end function TestModule.OnRecordCommonEvent(self, recordName, nOpType, nRow, nCol, oldVar, newVar) io.write("OnRecordCommonEvent, self: " .. tostring(self) .. " nOpType: " .. tostring(nOpType) .. " oldVar: " .. tostring(oldVar) .. " newVar: " .. tostring(newVar) .. "\n"); end function TestModule.OnPropertyCommEvent(self, strPropertyName, oldVar, newVar) io.write("OnPropertyCommEvent, self: " .. tostring(self) .. " strPropertyName: " .. tostring(strPropertyName) .. " oldVar: " .. tostring(oldVar) .. " newVar: " .. tostring(newVar) .. "\n"); end function TestModule.Execute() io.write("TestModule Execute!\n"); end function TestModule.BeforeShut() io.write("TestModule BeforeShut!\n"); end function TestModule.Shut() io.write("TestModule Shut!\n"); end
ENT.Type = "anim" ENT.Base = "base_wire_entity" ENT.PrintName = "Wire Keyboard" ENT.Author = "Divran" ENT.Contact = "www.wiremod.com" ENT.Purpose = "Send key input to the server." ENT.Instructions = "Click Use on it to activate it." ENT.Spawnable = false ENT.AdminSpawnable = false
-- MONOXIDE UI LIB BETA 0.1 - DO NOT SHARE WITH ANYONE WHO IS NOT A BETA TESTER. getgenv().MonoxideWindows = {} local CoreGui = game:GetService("CoreGui") if not MonoxideWindows then MonoxideWindows = {} end for i,v in next, MonoxideWindows do if CoreGui:FindFirstChild("MonoxideLib"):FindFirstChild(v) then CoreGui:FindFirstChild("MonoxideLib"):FindFirstChild(v):Destroy() end end -- Instances: local function ripple(obj) spawn( function() local Mouse = game.Players.LocalPlayer:GetMouse() local Circle = Instance.new("ImageLabel") Circle.Name = "Circle" Circle.Parent = obj Circle.BackgroundColor3 = Color3.fromRGB(255, 255, 255) Circle.BackgroundTransparency = 1.000 Circle.ZIndex = 10 Circle.Image = "rbxassetid://266543268" Circle.ImageColor3 = Color3.fromRGB(255, 255, 255) Circle.ImageTransparency = 0.4 local NewX, NewY = Mouse.X - Circle.AbsolutePosition.X, Mouse.Y - Circle.AbsolutePosition.Y Circle.Position = UDim2.new(0, NewX, 0, NewY) local Size = 0 if obj.AbsoluteSize.X > obj.AbsoluteSize.Y then Size = obj.AbsoluteSize.X * 1.5 elseif obj.AbsoluteSize.X < obj.AbsoluteSize.Y then Size = obj.AbsoluteSize.Y * 1.5 elseif obj.AbsoluteSize.X == obj.AbsoluteSize.Y then Size = obj.AbsoluteSize.X * 1.5 end Circle:TweenSizeAndPosition( UDim2.new(0, Size, 0, Size), UDim2.new(0.5, -Size / 2, 0.5, -Size / 2), "Out", "Quad", 0.2, false ) for i = 1, 20 do Circle.ImageTransparency = Circle.ImageTransparency + 0.05 wait(0.3 / 10) end Circle:Destroy() end ) end local ScreenGui = CoreGui:FindFirstChild("MonoxideLib") or Instance.new("ScreenGui") --Properties: ScreenGui.Name = "MonoxideLib" ScreenGui.Parent = CoreGui; local UserInputService = game:GetService("UserInputService") ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling local function MakeDraggable(topbarobject, object) local Dragging = nil local DragInput = nil local DragStart = nil local StartPosition = nil local function Update(input) local Delta = input.Position - DragStart local pos = UDim2.new( StartPosition.X.Scale, StartPosition.X.Offset + Delta.X, StartPosition.Y.Scale, StartPosition.Y.Offset + Delta.Y ) object.Position = pos end topbarobject.InputBegan:Connect( function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then Dragging = true DragStart = input.Position StartPosition = object.Position input.Changed:Connect( function() if input.UserInputState == Enum.UserInputState.End then Dragging = false end end ) end end ) topbarobject.InputChanged:Connect( function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then DragInput = input end end ) UserInputService.InputChanged:Connect( function(input) if input == DragInput and Dragging then Update(input) end end ) end local lib = {} local TweenService = game:GetService("TweenService") local function SimpleTween(Object, Length, Style, Direction, Properties) local Tween = TweenService:Create( Object, TweenInfo.new(Length, Enum.EasingStyle[Style].Value, Enum.EasingDirection[Direction].Value), Properties ) Tween:Play() Tween.Completed:Wait() Tween:Destroy() end function lib:Window(title, ver,font, outcolor) local TextLabel = Instance.new("TextLabel") local VerLabel = Instance.new("TextLabel") local Outline = Instance.new("Frame") local ExitButton = Instance.new("TextButton") local UIListLayout = Instance.new("UIListLayout") local Content = Instance.new("ScrollingFrame") local UICorner = Instance.new("UICorner") local Window = Instance.new("Frame") local Topbar = Instance.new("Frame") Outline.Name = string.lower(title) table.insert(MonoxideWindows, string.lower(title)) local current = table.getn(MonoxideWindows) local RNG = Random.new() local RNG2 = Random.new() Outline.Parent = ScreenGui Outline.AnchorPoint = Vector2.new(0.5, 0.5) Outline.BackgroundColor3 = outcolor or Color3.fromRGB(0, 0, 0) Outline.BorderColor3 = Color3.fromRGB(0, 0, 0) Outline.BorderSizePixel = 2 Outline.Position = UDim2.new(0.5 + RNG:NextNumber() * 0.05,0, 0.5 + RNG2:NextNumber() * 0.05, 0) Outline.ClipsDescendants = true Outline.Size = UDim2.new(0, 0, 0, 0) Outline:TweenSize( UDim2.new(0, 432, 0, 284), Enum.EasingDirection.In, "Quint", .6, true ) UICorner.CornerRadius = UDim.new(0, 9) UICorner.Parent = Outline Window.Name = "Window" Window.Parent = Outline Window.ClipsDescendants = true Window.AnchorPoint = Vector2.new(0.5, 0.5) Window.BackgroundColor3 = Color3.fromRGB(31, 31, 31) Window.BorderColor3 = Color3.fromRGB(0, 0, 0) Topbar.BackgroundTransparency = .9 Window.BorderSizePixel = 2 Window.Position = UDim2.new(0.5, 0, 0.5, 0) Window.Size = UDim2.new(0, 428, 0, 280) Topbar.Name = "Topbar" Topbar.Parent = Window Topbar.BackgroundColor3 = Color3.fromRGB(57, 57, 57) Topbar.Size = UDim2.new(0, 428, 0, 24) local UICorner_Top = Instance.new("UICorner") ExitButton.Parent = Topbar ExitButton.Text = "x" ExitButton.BackgroundTransparency = 1 ExitButton.TextStrokeTransparency = 1 ExitButton.AnchorPoint = Vector2.new(0, 1) ExitButton.Position = UDim2.new(0,12,0,20) ExitButton.Font = Enum.Font.GothamSemibold ExitButton.TextSize = 16.00 ExitButton.Size = UDim2.new(0,10,0,10) ExitButton.TextColor3 = Color3.fromRGB(199, 199, 199) ExitButton.MouseButton1Down:Connect(function() table.remove(MonoxideWindows, current) Outline:TweenSize( UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, "Quint", .6, true ) wait(.6) Outline:Destroy() end) UICorner_Top.Parent = Topbar MakeDraggable(Topbar, Outline) TextLabel.Parent = Topbar TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255) TextLabel.BackgroundTransparency = 1.000 TextLabel.BorderSizePixel = 0 TextLabel.Position = UDim2.new(0,0,0,2) TextLabel.Size = UDim2.new(0, 432, 0, 24) TextLabel.Font = font or Enum.Font.GothamSemibold TextLabel.Text = string.upper(title) or "Window" TextLabel.TextColor3 = Color3.fromRGB(190, 190, 190) TextLabel.TextSize = 18.000 TextLabel.TextWrapped = true VerLabel.AnchorPoint = Vector2.new(1.2,0) VerLabel.Parent = Topbar VerLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255) VerLabel.BackgroundTransparency = 1.000 VerLabel.BorderSizePixel = 0 VerLabel.Position = UDim2.new(0.99,0,0,0) VerLabel.TextXAlignment = Enum.TextXAlignment.Right VerLabel.Size = UDim2.new(0, 100, 0, 24) VerLabel.Font = Enum.Font.SourceSansBold VerLabel.Text = string.lower(ver) or "Window" VerLabel.TextColor3 = Color3.fromRGB(133, 133, 133) VerLabel.TextSize = 16.000 VerLabel.TextWrapped = true local UICorner = Instance.new("UICorner") UICorner.Parent = Window local window = {} Content.Name = "Content" Content.Parent = Window Content.BackgroundColor3 = Color3.fromRGB(255, 255, 255) Content.BackgroundTransparency = 1.000 Content.BorderSizePixel = 0 Content.AnchorPoint = Vector2.new(0.5, 0.5) Content.Position = UDim2.new(0.5, 0, 0.555, 0) Content.Size = UDim2.new(0, 425, 0, 253) UIListLayout.Parent = Content UIListLayout.FillDirection = Enum.FillDirection.Vertical UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder UIListLayout.Padding = UDim.new(0.00999999978, 0) function window:Message(text, buttonname, duration) local notframe = Instance.new("Frame") local tex = Instance.new("TextLabel") local corn = Instance.new("UICorner") local confirmbtn = Instance.new("TextButton") -- local exitbtn = Instance.new("ImageButton") -- frame notframe.Size = UDim2.new(0,200,0,200) notframe.ClipsDescendants = true notframe.BackgroundColor3 = Color3.fromRGB(50,50,50) notframe.AnchorPoint = Vector2.new(0.5,0.5) notframe.Parent = Window notframe.Position = UDim2.new(.5,0,.5,0) notframe.BackgroundTransparency = 1 corn.Parent = notframe corn:Clone().Parent = confirmbtn tex.Parent = notframe tex.BackgroundTransparency = 1 tex.BorderSizePixel = 0 tex.TextColor3 = Color3.fromRGB(255,255,255) tex.Text = text tex.TextWrapped = true tex.Size = UDim2.new(0,200,0,160) -- button confirmbtn.Size = UDim2.new(0,80,0,30) confirmbtn.AnchorPoint = Vector2.new(.5,.5) confirmbtn.BackgroundColor3 = Color3.fromRGB(20,20,20) confirmbtn.TextColor3 = Color3.fromRGB(255,255,255) confirmbtn.Position = UDim2.new(.5,0,0,160) confirmbtn.Parent = notframe confirmbtn.Text = buttonname confirmbtn.MouseButton1Down:Connect(function() notframe:TweenSize(UDim2.new(0,0,0,0)) wait(1) notframe:Destroy() end) SimpleTween(notframe, .5, "Quint", "Out", {BackgroundTransparency = 0}) SimpleTween(confirmbtn, .5, "Quint", "Out", {BackgroundTransparency = 0}) if duration then wait(duration) notframe:TweenSize(UDim2.new(0,0,0,0)) wait(1) notframe:Destroy() end end function window:Rainbow(speed) speed = speed or 1 coroutine.wrap(function() -- so does not wait for this function to finish (as it is infinite) while true do SimpleTween(Outline, speed, "Linear", "Out", { BackgroundColor3 = Color3.new(1, 0, 0) }) SimpleTween(Outline, speed, "Linear", "Out", { BackgroundColor3 = Color3.new(0, 1, 0) }) SimpleTween(Outline, speed, "Linear", "Out", { BackgroundColor3 = Color3.new(0, 0, 1) }) SimpleTween(Outline, speed, "Linear", "Out", { BackgroundColor3 = Color3.new(1, 1, 0) }) SimpleTween(Outline, speed, "Linear", "Out", { BackgroundColor3 = Color3.new(0, 1, 1) }) SimpleTween(Outline, speed, "Linear", "Out", { BackgroundColor3 = Color3.new(1, 0, 1) }) SimpleTween(Outline, speed, "Linear", "Out", { BackgroundColor3 = Color3.new(1, .5, .5) }) end end)() end function window:GetWindow() return Window end function window:Dropdown(text, list, callback) -- Based on dawid's Vape lib (soon i'll make a new one) local droptog = false local framesize = 0 local itemcount = 0 local Dropdown = Instance.new("Frame") local DropdownCorner = Instance.new("UICorner") local DropdownBtn = Instance.new("TextButton") local DropdownTitle = Instance.new("TextLabel") local ArrowImg = Instance.new("ImageLabel") local DropItemHolder = Instance.new("ScrollingFrame") local DropLayout = Instance.new("UIListLayout") Dropdown.Name = "Dropdown" Dropdown.Parent = Content Dropdown.BackgroundColor3 = Color3.fromRGB(20, 20, 20) Dropdown.ClipsDescendants = true Dropdown.Position = UDim2.new(-0.541071415, 0, -0.532915354, 0) Dropdown.Size = UDim2.new(0, 363, 0, 42) DropdownCorner.CornerRadius = UDim.new(0, 5) DropdownCorner.Name = "DropdownCorner" DropdownCorner.Parent = Dropdown DropdownBtn.Name = "DropdownBtn" DropdownBtn.Parent = Dropdown DropdownBtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255) DropdownBtn.BackgroundTransparency = 1.000 DropdownBtn.Size = UDim2.new(0, 363, 0, 42) DropdownBtn.Font = Enum.Font.SourceSans DropdownBtn.Text = "" DropdownBtn.TextColor3 = Color3.fromRGB(0, 0, 0) DropdownBtn.TextSize = 14.000 DropdownTitle.Name = "DropdownTitle" DropdownTitle.Parent = Dropdown DropdownTitle.BackgroundColor3 = Color3.fromRGB(255, 255, 255) DropdownTitle.BackgroundTransparency = 1.000 DropdownTitle.Position = UDim2.new(0.0358126722, 0, 0, 0) DropdownTitle.Size = UDim2.new(0, 187, 0, 42) DropdownTitle.Font = Enum.Font.Gotham DropdownTitle.Text = text DropdownTitle.TextColor3 = Color3.fromRGB(255, 255, 255) DropdownTitle.TextSize = 14.000 DropdownTitle.TextXAlignment = Enum.TextXAlignment.Left ArrowImg.Name = "ArrowImg" ArrowImg.Parent = DropdownTitle ArrowImg.BackgroundColor3 = Color3.fromRGB(255, 255, 255) ArrowImg.BackgroundTransparency = 1.000 ArrowImg.Position = UDim2.new(1.65240645, 0, 0.190476194, 0) ArrowImg.Size = UDim2.new(0, 26, 0, 26) ArrowImg.Image = "http://www.roblox.com/asset/?id=6034818375" DropItemHolder.Name = "DropItemHolder" DropItemHolder.Parent = DropdownTitle DropItemHolder.Active = true DropItemHolder.BackgroundColor3 = Color3.fromRGB(255, 255, 255) DropItemHolder.BackgroundTransparency = 1.000 DropItemHolder.BorderSizePixel = 0 DropItemHolder.Position = UDim2.new(-0.00400000019, 0, 1.04999995, 0) DropItemHolder.Size = UDim2.new(0, 342, 0, 0) DropItemHolder.CanvasSize = UDim2.new(0, 0, 0, 0) DropItemHolder.ScrollBarThickness = 3 DropLayout.Name = "DropLayout" DropLayout.Parent = DropItemHolder DropLayout.SortOrder = Enum.SortOrder.LayoutOrder DropdownBtn.MouseButton1Click:Connect( function() if droptog == false then Dropdown:TweenSize( UDim2.new(0, 363, 0, 55 + framesize), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, .2, true ) TweenService:Create( ArrowImg, TweenInfo.new(.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 270} ):Play() wait(.2) Content.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y) else Dropdown:TweenSize( UDim2.new(0, 363, 0, 42), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, .2, true ) TweenService:Create( ArrowImg, TweenInfo.new(.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 0} ):Play() wait(.2) Content.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y) end droptog = not droptog end ) for i, v in next, list do itemcount = itemcount + 1 if itemcount <= 3 then framesize = framesize + 26 DropItemHolder.Size = UDim2.new(0, 342, 0, framesize) end local Item = Instance.new("TextButton") local ItemCorner = Instance.new("UICorner") Item.Name = "Item" Item.Parent = DropItemHolder Item.BackgroundColor3 = Color3.fromRGB(20, 20, 20) Item.ClipsDescendants = true Item.Size = UDim2.new(0, 335, 0, 25) Item.AutoButtonColor = false Item.Font = Enum.Font.Gotham Item.Text = v Item.TextColor3 = Color3.fromRGB(255, 255, 255) Item.TextSize = 15.000 ItemCorner.CornerRadius = UDim.new(0, 4) ItemCorner.Name = "ItemCorner" ItemCorner.Parent = Item Item.MouseEnter:Connect( function() TweenService:Create( Item, TweenInfo.new(.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(37, 37, 37)} ):Play() end ) Item.MouseLeave:Connect( function() TweenService:Create( Item, TweenInfo.new(.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(34, 34, 34)} ):Play() end ) Item.MouseButton1Click:Connect( function() droptog = not droptog DropdownTitle.Text = v pcall(callback, v) Dropdown:TweenSize( UDim2.new(0, 363, 0, 42), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, .2, true ) TweenService:Create( ArrowImg, TweenInfo.new(.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Rotation = 0} ):Play() wait(.2) Content.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y) end ) DropItemHolder.CanvasSize = UDim2.new(0, 0, 0, DropLayout.AbsoluteContentSize.Y) end Content.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y) end -- New Textbox function window:Textbox(text, disapeer, callback) -- Based on dawid's Vape lib (soon i'll make a new one) callback = callback or function(...) end local textbox = Instance.new("Frame") local title = Instance.new("TextLabel") local textboxframe = Instance.new("Frame") local textboxmain = Instance.new("TextBox") textbox.Name = "textbox" textbox.Parent = Content textbox.BackgroundColor3 = Color3.fromRGB(255, 255, 255) textbox.BackgroundTransparency = 1.000 textbox.Position = UDim2.new(0.503712893, 0, 0.239035085, 0) title.Name = "title" title.Parent = textbox title.BackgroundColor3 = Color3.fromRGB(255, 255, 255) title.BackgroundTransparency = 1 title.BorderSizePixel = 0 title.Position = UDim2.new(0, 6, 0, 0) title.Size = UDim2.new(0, 23, 1, 0) title.ZIndex = 2 title.Font = Enum.Font.Gotham title.Text = text title.TextColor3 = Color3.fromRGB(255, 255, 255) title.TextSize = 14.000 title.TextXAlignment = Enum.TextXAlignment.Left textbox.Size = UDim2.new(0, title.TextBounds.X + 185, 0, 30) textboxframe.Name = "textboxframe" textboxframe.Parent = textbox textboxframe.AnchorPoint = Vector2.new(1, 0.5) textboxframe.BackgroundColor3 = Color3.fromRGB(20, 20, 20) textboxframe.BorderSizePixel = 0 textboxframe.Position = UDim2.new(1, 0, 0.5, 0) textboxframe.Size = UDim2.new(0, 165, 0, 26) textboxmain.Name = "textboxmain" textboxmain.Parent = textboxframe textboxmain.BackgroundColor3 = Color3.fromRGB(20, 20, 20) textboxmain.BorderSizePixel = 0 textboxmain.Size = UDim2.new(0, 165, 0, 26) textboxmain.Font = Enum.Font.Gotham textboxmain.Text = "" textboxmain.TextColor3 = Color3.fromRGB(255, 255, 255) textboxmain.TextSize = 14.000 Content.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y + 10) textboxmain.FocusLost:Connect( function(ep) if ep then if #textboxmain.Text > 0 then pcall(callback, textboxmain.Text) if disapeer then textboxmain.Text = "" end end end end ) end function window:Slider(text, min, max, start, callback) -- Based on dawid's Vape lib (soon i'll make a new one) local inputService = game:GetService("UserInputService") local slider = Instance.new("Frame") local round = Instance.new("UICorner") local title = Instance.new("TextLabel") local placetoslide = Instance.new("TextButton") local slideframe = Instance.new("Frame") local value = Instance.new("TextLabel") local dragging = false slider.Name = "slider" slider.Parent = Content slider.BackgroundColor3 = Color3.fromRGB(255, 255, 255) slider.BackgroundTransparency = 1.000 slider.Position = UDim2.new(0.503712893, 0, 0.239035085, 0) title.Name = "title" title.Parent = slider title.BackgroundColor3 = Color3.fromRGB(255, 255, 255) title.BackgroundTransparency = 1.000 title.BorderSizePixel = 0 title.Position = UDim2.new(0, 6, 0, 0) title.Size = UDim2.new(0, 23, 1, 0) title.ZIndex = 2 title.Font = Enum.Font.Gotham title.Text = text title.TextColor3 = Color3.fromRGB(255, 255, 255) title.TextSize = 14.000 title.TextXAlignment = Enum.TextXAlignment.Left slider.Size = UDim2.new(0, title.TextBounds.X + 185, 0, 30) placetoslide.Name = "slideplace" placetoslide.Parent = slider placetoslide.AnchorPoint = Vector2.new(1, 0.5) placetoslide.BackgroundColor3 = Color3.fromRGB(20, 20, 20) placetoslide.BorderSizePixel = 0 placetoslide.Position = UDim2.new(1, 0, 0.5, 0) placetoslide.Size = UDim2.new(0, 165, 0, 26) placetoslide.AutoButtonColor = false placetoslide.Text = "" round.Parent = placetoslide slideframe.Name = "slideframe" slideframe.Parent = placetoslide slideframe.BackgroundColor3 = Color3.fromRGB(40, 40, 40) slideframe.BorderSizePixel = 0 slideframe.Size = UDim2.new((start or 0) / max, 0, 1, 0) round:Clone().Parent = slideframe value.Name = "value" value.Parent = placetoslide value.BackgroundTransparency = 1 value.BorderSizePixel = 0 value.Size = UDim2.new(1, 0, 1, 0) value.Font = Enum.Font.Gotham value.Text = tostring(start and math.floor((start / max) * (max - min) + min) or 0) value.TextColor3 = Color3.fromRGB(255, 255, 255) value.TextSize = 14 Content.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y + 10) slideframe.ClipsDescendants = true local function slide(input) local pos = UDim2.new( math.clamp((input.Position.X - placetoslide.AbsolutePosition.X) / placetoslide.AbsoluteSize.X, 0, 1), 0, 1, 0 ) slideframe:TweenSize(pos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.1, true) local s = math.floor(((pos.X.Scale * max) / max) * (max - min) + min) value.Text = tostring(s) callback(s) end placetoslide.InputBegan:Connect( function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then slide(input) dragging = true end end ) placetoslide.InputEnded:Connect( function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then ripple(slideframe) dragging = false end end ) inputService.InputChanged:Connect( function(input) if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then slide(input) end end ) end function window:Button(text, callback) callback = callback or function(...) end local button = Instance.new("TextButton") local MouseEnter = TweenService:Create( button, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.In), { BackgroundColor3 = Color3.fromRGB(25, 25, 25) } ) local MouseLeave = TweenService:Create( button, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { BackgroundColor3 = Color3.fromRGB(20, 20, 20) } ) button.Name = "button" button.Parent = Content button.BackgroundColor3 = Color3.fromRGB(20, 20, 20) button.BorderSizePixel = 0 button.AutoButtonColor = false button.Font = Enum.Font.Gotham button.Text = string.upper(text) button.TextColor3 = Color3.fromRGB(255, 255, 255) button.TextSize = 14.000 button.Size = UDim2.new(0, button.TextBounds.X + 15, 0, 27) button.ClipsDescendants = true Content.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y + 10) button.MouseEnter:Connect( function() MouseEnter:Play() end ) button.MouseLeave:Connect( function() MouseLeave:Play() end ) button.MouseButton1Click:Connect( function() ripple(button) pcall(callback) end ) end return window; end return lib -- Return the lib so it can be used with loadstring()
include("shared.lua") AddCSLuaFile("shared.lua") function ENT:SpawnFunction(ply, tr) if (!tr.Hit) then return end local ent=ents.Create(ClassName) ent:SetPos(tr.HitPos+tr.HitNormal*50) ent:Spawn() ent:Activate() ent.Owner=ply ent:SetSkin(math.random(0,1)) ent:SetBodygroup(3,1) return ent end ENT.Aerodynamics = { Rotation = { Front = Vector(0, 2, 0), Right = Vector(0, 0, 40), -- Rotate towards flying direction Top = Vector(0, -10, 0) }, Lift = { Front = Vector(0, 0, 24.5), -- Go up when flying forward Right = Vector(0, 0, 0), Top = Vector(0, 0, -0.5) }, Rail = Vector(1, 5, 5), Drag = { Directional = Vector(0.01, 0.01, 0.01), Angular = Vector(0.05, 0.1, 0.05) } } function ENT:PhysicsUpdate(ph) self:base("wac_pl_base").PhysicsUpdate(self,ph) if self.rotorRpm > 0.5 and self.rotorRpm < 0.89 and IsValid(self.rotorModel) then self.rotorModel:SetBodygroup(1,2) elseif self.rotorRpm > 0.9 and IsValid(self.rotorModel) then self.rotorModel:SetBodygroup(1,2) elseif self.rotorRpm < 0.8 and IsValid(self.rotorModel) then self.rotorModel:SetBodygroup(1,1) end if self.active then self:SetBodygroup(3,0) else self:SetBodygroup(3,1) end local geardown,t1=self:LookupSequence("geardown") local gearup,t2=self:LookupSequence("gearup") local trace=util.QuickTrace(self:LocalToWorld(Vector(0,0,62)), self:LocalToWorld(Vector(0,0,50)), {self, self.Wheels[1], self.Wheels[2], self.Wheels[3], self.TopRotor}) local phys=self:GetPhysicsObject() if IsValid(phys) and not self.disabled then if self.controls.throttle>0.9 and self.rotorRpm>0.8 and phys:GetVelocity():Length() > 1299 and trace.HitPos:Distance( self:LocalToWorld(Vector(0,0,62)) ) > 50 and self:GetSequence() != gearup then self:ResetSequence(gearup) self:SetPlaybackRate(1.0) self:SetBodygroup(2,1) for i=1,3 do self.wheels[i]:SetRenderMode(RENDERMODE_TRANSALPHA) self.wheels[i]:SetColor(Color(255,255,255,0)) self.wheels[i]:SetSolid(SOLID_NONE) end elseif self.controls.throttle<0.6 and trace.HitPos:Distance( self:LocalToWorld(Vector(0,0,62)) ) > 50 and self:GetSequence() == gearup then self:ResetSequence(geardown) self:SetPlaybackRate(1.0) timer.Simple(t1,function() if self.wheels then for i=1,3 do self.wheels[i]:SetRenderMode(RENDERMODE_NORMAL) self.wheels[i]:SetColor(Color(255,255,255,255)) self.wheels[i]:SetSolid(SOLID_VPHYSICS) end self:SetBodygroup(2,0) end end) end end end function ENT:addRotors() self:base("wac_pl_base").addRotors(self) self.rotorModel.TouchFunc = function() end end
local K, C = unpack(select(2, ...)) local Module = K:GetModule("Skins") function Module:ReskinSpy() if not C["Skins"].Spy then return end if not K.CheckAddOnState("Spy") then return end if Spy_MainWindow.Background then Spy_MainWindow.Background:CreateBorder() Spy_MainWindow:StripTextures() else Spy_MainWindow:CreateBorder(nil, nil, nil, true) end Spy_AlertWindow:CreateBorder(nil, nil, nil, true) Spy_MainWindow.CloseButton:SkinCloseButton() Spy_MainWindow.CloseButton:SetSize(28, 28) Spy_MainWindow.CloseButton:SetPoint("TOPRIGHT", 0, -7) Spy_AlertWindow:SetPoint("TOP", UIParent, "TOP", 0, -130) end
--[[ Jason A. Petrasko forked from josip on the love2d forums, posted here: https://love2d.org/forums/viewtopic.php?f=5&t=89025&hilit=love+editor and on GH here: https://github.com/jmiskovic/indeck no license attached anywhere? ]] -- make sure we have a class commons implementation! if (class == nil) then class_commons = true class = require 'class' end local buffer = {} -- platform independant text buffer local lexer = require 'glsl-lexer' local clipboard = "" -- shared between buffer instances --helper functions local insertCharAt = function(text, c, pos) local first = text:sub(1, pos) local last = text:sub(pos + 1) return first .. c .. last end local repeatN = function(n, f, ...) for i=1,n do f(...) end end local function drawToken(dcon, text, col, row, tokenType) local color = dcon.highlighting[tokenType] or {1,1,1} local x = col * dcon.fontWidth local y = row * dcon.fontHeight love.graphics.setFont(dcon.font) love.graphics.setColor(color[1],color[2],color[3],1.0) love.graphics.print(text, x, y) love.graphics.setColor(color[1],color[2],color[3],0.7) love.graphics.print(text, x+0.2, y+0.2) end local function drawRectangle(dcon, col, row, width, tokenType) local color = dcon.highlighting[tokenType] or {1,1,1} local x = col * dcon.fontWidth local y = row * dcon.fontHeight local width = width * dcon.fontWidth local height = dcon.fontHeight love.graphics.setColor(color) love.graphics.rectangle('fill', x, y, width, height) end local function drawRectangleDown(dcon, col, row, width, _height, tokenType) local color = dcon.highlighting[tokenType] or {1,1,1} local x = col * dcon.fontWidth local y = row * dcon.fontHeight local width = width * dcon.fontWidth local height = dcon.fontHeight * (_height+1) love.graphics.setColor(color) love.graphics.rectangle('fill', x, y, width, height) end function buffer.new(_dcon, initialText) -- cols, rows, drawToken, drawRectangle, initialText) local buffer = { -- all coordinates in text space (integers) cols = _dcon.cols, rows = _dcon.rows, name = '', cursor = {x=0, y=1}, -- x is 0-indexed, y is 1-indexed selection = {x=0, y=1}, -- x is 0-indexed, y is 1-indexed -- selected text spans between cursor and selection marker scroll = {x=5, y=0}, -- both 0-indexed lines = {}, -- text broken in lines lexed = {}, -- text lines broken into tokens dcon = _dcon, -- 'public' api getText = function(self) return table.concat(self.lines, "\n") end, getCursorLine = function(self) return self.lines[self.cursor.y] end, setName = function(self, name) self.name = name:gsub("%c", "") end, setText = function(self, text) self.lines = {} self.lexed = lexer(text) for i, line in ipairs(self.lexed) do lineStrings = {} for l, token in ipairs(line) do table.insert(lineStrings, token.data) end table.insert(self.lines, table.concat(lineStrings, "")) end self:updateView() self:deselect() end, newcontext = function(self,_dcon) self.cols = _dcon.cols self.rows = _dcon.rows self.dcon = _dcon end, drawCode = function(self) local linesToDraw = math.min(self.rows, #(self.lexed)-self.scroll.y) local selectionFrom, selectionTo = self:selectionSpan() local selectionWidth = (selectionTo.x + selectionTo.y * self.cols) - (selectionFrom.x + selectionFrom.y * self.cols) -- background drawRectangleDown(self.dcon,0,0,self.cols,self.rows,'background') -- highlight cursor line if selectionWidth == 0 then drawRectangle(self.dcon,-1, self.cursor.y - self.scroll.y, self.cols + 2, 'cursorline') end -- selection local x, y = selectionFrom.x, selectionFrom.y drawRectangle(self.dcon,x - self.scroll.x, y - self.scroll.y, selectionWidth, 'selection') selectionWidth = selectionWidth - (self.cols - selectionFrom.x) while selectionWidth > 0 do y = y + 1 drawRectangle(self.dcon,0 - self.scroll.x, y - self.scroll.y, selectionWidth, 'selection') --selectionWidth = selectionWidth - self.lines[y]:len() --self.cols selectionWidth = selectionWidth - self.cols end -- file content for y = 1, linesToDraw do local x = -self.scroll.x local currentLine = y + self.scroll.y -- draw cursor line and caret if currentLine == self.cursor.y then drawToken(self.dcon,"|", self.cursor.x - self.scroll.x - 0.5, y, 'caret') end -- draw single line of text local lineTokens = self.lexed[currentLine] for j, token in ipairs(lineTokens) do drawToken(self.dcon,token.data, x, y, token.type) --print('token',x,y) x = x + #token.data end end -- status line drawToken(self.dcon,self.statusLine, self.cols - #self.statusLine, 0, 'comment') end, -- cursor movement cursorGoPx = function(self,px,py) self.cursor.x = math.floor(px / self.dcon.fontWidth) self.cursor.y = math.floor(py / self.dcon.fontHeight) + self.scroll.y self:deselect() self:updateView() end, cursorUp = function(self) self.cursor.y = self.cursor.y - 1 self:updateView() end, cursorDown = function(self) self.cursor.y = self.cursor.y + 1 self:updateView() end, cursorJumpUp = function(self) repeatN(10, self.cursorUp, self) end, cursorJumpDown = function(self) repeatN(10, self.cursorDown, self) end, cursorLeft = function(self) if self.cursor.x == 0 then if self.cursor.y > 1 then self:cursorUp() self:cursorEnd() else return false; end else self.cursor.x = self.cursor.x - 1 self:updateView() end return true end, cursorRight = function(self) local length = string.len(self.lines[self.cursor.y]) if self.cursor.x == length then if self.cursor.y < #(self.lines) then self:cursorDown() self:cursorHome() else return false end else self.cursor.x = self.cursor.x + 1 self:updateView() end return true end, cursorJumpLeft = function(self) self:cursorLeft() local pattern = self:charAtCursor():find("[%d%l%u]") and "[%d%l%u]" or "%s" self:repeatOverPattern(pattern, self.cursorLeft, self) end, cursorJumpRight = function(self) self:cursorRight() local pattern = self:charAtCursor():find("[%d%l%u]") and "[%d%l%u]" or "%s" self:repeatOverPattern(pattern, self.cursorRight, self) end, cursorHome = function(self) self.cursor.x = 0 self:updateView() end, cursorEnd = function(self) self.cursor.x = string.len(self.lines[self.cursor.y]) self:updateView() end, cursorPageUp = function(self) self.cursor.y = self.cursor.y - self.rows self:updateView() end, cursorPageDown = function(self) self.cursor.y = self.cursor.y + self.rows self:updateView() end, cursorJumpHome = function(self) self.cursor.x, self.cursor.y = 0, 1 self:updateView() end, cursorJumpEnd = function(self) self.cursor.y = #self.lines self.cursor.x = #self.lines[self.cursor.y] self:updateView() end, -- inserting and removing characters insertCharacter = function(self, c) self:deleteSelection() self.lines[self.cursor.y] = insertCharAt(self.lines[self.cursor.y], c, self.cursor.x) self:lexLine(self.cursor.y) self.cursor.x = self.cursor.x + 1 self:updateView() self:deselect() end, insertTab = function(self) self:deleteSelection() self:insertString(" ") self:deselect() end, breakLine = function(self, withoutIndent) self:deleteSelection() local nl = self.lines[self.cursor.y] local bef = nl:sub(1,self.cursor.x) local aft = nl:sub(self.cursor.x + 1, #nl) local indent = #(bef:match("^%s+") or "") self.lines[self.cursor.y] = bef self:lexLine(self.cursor.y) table.insert(self.lines, self.cursor.y + 1, aft) table.insert(self.lexed, self.cursor.y + 1, {}) self:lexLine(self.cursor.y + 1) self:cursorHome() self:cursorDown() self:deselect() if not withoutIndent then repeatN(indent, self.insertCharacter, self, " ") end end, deleteRight = function(self) if self:isSelected() then self:deleteSelection() else local length = string.len(self.lines[self.cursor.y]) if length == self.cursor.x then -- end of line if self.cursor.y < #self.lines then -- if we have another line, remove newline by joining lines local nl = self.lines[self.cursor.y] .. self.lines[self.cursor.y + 1] self.lines[self.cursor.y] = nl self:lexLine(self.cursor.y) table.remove(self.lines, self.cursor.y + 1) table.remove(self.lexed, self.cursor.y + 1) end else -- middle of line, remove char local nl = self.lines[self.cursor.y] local bef = nl:sub(1, self.cursor.x) local aft = nl:sub(self.cursor.x + 2, string.len(nl)) self.lines[self.cursor.y] = bef..aft self:lexLine(self.cursor.y) end end end, deleteLeft = function(self) if self:isSelected() then self:deleteSelection() elseif self:cursorLeft() then self:deleteRight() end end, deleteWord = function(self) self:deleteLeft() local pattern = self:charAtCursor():find("[%d%l%u]") and "[%d%l%u]" or "%s" self:repeatOverPattern(pattern, self.deleteLeft, self) end, -- clipboard cutText = function(self) if self:isSelected() then self:copyText() self:deleteSelection() else clipboard = self.lines[self.cursor.y] .. '\n' table.remove(self.lines, self.cursor.y) table.remove(self.lexed, self.cursor.y) end self:updateView() end, copyText = function(self) if self:isSelected() then local selectionFrom, selectionTo = self:selectionSpan() local lines = {} for y = selectionFrom.y, selectionTo.y do local fromX = y == selectionFrom.y and selectionFrom.x or 0 local toX = y == selectionTo.y and selectionTo.x or self.lines[y]:len() table.insert(lines, self.lines[y]:sub(fromX + 1, toX)) end clipboard = table.concat(lines, '\n') else -- copy cursor line clipboard = self.lines[self.cursor.y] .. '\n' end end, pasteText = function(self) self:deleteSelection() self:insertString(clipboard) end, -- helper functions isSelected = function(self) return self.selection.x ~= self.cursor.x or self.selection.y ~= self.cursor.y end, selectionSpan = function(self) if self.selection.y * self.cols + self.selection.x < self.cursor.y * self.cols + self.cursor.x then return self.selection, self.cursor else return self.cursor, self.selection end end, deleteSelection = function(self) if not self:isSelected() then return end local selectionFrom, selectionTo = self:selectionSpan() local singleLineChange = selectionFrom.y == selectionTo.y local lines = {} for y = selectionTo.y, selectionFrom.y, -1 do local fromX = y == selectionFrom.y and selectionFrom.x or 0 local toX = y == selectionTo.y and selectionTo.x or self.lines[y]:len() if y > selectionFrom.y and y < selectionTo.y then table.remove(self.lines, y) table.remove(self.lexed, y) else local fromX = y == selectionFrom.y and selectionFrom.x or 0 local toX = y == selectionTo.y and selectionTo.x or self.lines[y]:len() local bef = self.lines[y]:sub(0, fromX) local aft = self.lines[y]:sub(toX + 1, self.lines[y]:len()) self.lines[y] = bef .. aft end end self.cursor.x, self.cursor.y = selectionFrom.x, selectionFrom.y self:deselect() if singleLineChange then self:lexLine(self.cursor.y) else self:deleteRight() self:lexAll() end self:updateView() end, deselect = function(self) self.selection.x, self.selection.y = self.cursor.x, self.cursor.y end, jumpToLine = function(self, lineNumber, columnNumber) lineNumber = math.min(lineNumber or 1, #self.lines) columnNumber = math.min(columnNumber or 0, #self.lines[lineNumber] - 1) self.cursor.x = columnNumber self.cursor.y = lineNumber self.scroll.y = math.max(lineNumber - math.floor(self.rows / 2), 0) self.scroll.x = math.max(columnNumber - math.floor(7 * self.cols / 8), 0) self:deselect() end, insertString = function(self, str) local singleLineChange = true for c in str:gmatch(".") do if c == '\n' then singleLineChange = false self:deselect() self:breakLine(true) elseif c:match('%C') then self.lines[self.cursor.y] = insertCharAt(self.lines[self.cursor.y], c, self.cursor.x) self.cursor.x = self.cursor.x + 1 end end if singleLineChange then self:lexLine(self.cursor.y) else self:lexAll() end self:deselect() end, charAtCursor = function(self) return self.lines[self.cursor.y]:sub(self.cursor.x, self.cursor.x) end, lexLine = function(self, lineNum) self.lexed[lineNum] = lexer(self.lines[lineNum])[1] end, lexAll = function(self) -- lexing single line cannot handle multiline comments and strings self.lexed = lexer(self:getText()) end, updateView = function(self) self.cursor.y = math.max(self.cursor.y, 1) self.cursor.y = math.min(self.cursor.y, #(self.lines)) local lineLength = string.len(self.lines[self.cursor.y] or "") self.cursor.x = math.max(self.cursor.x, 0) self.cursor.x = math.min(self.cursor.x, lineLength) if self.cursor.y <= self.scroll.y then self.scroll.y = self.cursor.y - 1 elseif self.cursor.y > self.scroll.y + self.rows then self.scroll.y = self.cursor.y - self.rows end if self.cursor.x < self.scroll.x then self.scroll.x = math.max(self.cursor.x - 10, 0) elseif self.cursor.x > self.scroll.x + self.cols then self.scroll.x = self.cursor.x + 10 - self.cols end self.statusLine = string.format('L%d C%d %s', self.cursor.y, self.cursor.x, self.name) end, repeatOverPattern = function(self, pattern, moveF, ...) -- execute moveF() over text as long as character matches pattern and cursor moves while self:charAtCursor():match(pattern) do local oldX, oldY = self.cursor.x, self.cursor.y moveF(...) if (oldX == self.cursor.x and oldY == self.cursor.y) then break end end end, setName = function(self,name) self.name = name or '?' self:updateView() end, mouseDown = function(self,x,y) end, } -- generate all select_ and move_ actions for _, functionName in ipairs({'Up', 'Down', 'Left', 'Right', 'JumpUp', 'JumpDown', 'JumpLeft', 'JumpRight', 'Home', 'End', 'PageUp', 'PageDown', 'JumpHome', 'JumpEnd'}) do buffer['select' .. functionName] = function(self) --self.selection = self.selection or {x= self.cursor.x, y= self.cursor.y} self['cursor' .. functionName](self) end buffer['move' .. functionName] = function(self) self['cursor' .. functionName](self) self:deselect() end end buffer:setText(initialText or "") return buffer end --[[ Lua pattern matching str:find(pattern) finds the first instance of pattern in string and returns its position str:gmatch(pattern) when called repeatedly, returns each successive instance of pattern in string str:gsub(pattern, repl) returns a string where all instances of pattern in string have been replaced with repl str:match(pattern) returns the first instance of pattern in string X represents the character X itself as long as it is not a magic character . represents any single character %a represents all letters A-Z and a-z %c represents all control characters such as Null, Tab, Carr.Return, Linefeed, Delete, etc %d represents all digits 0-9 %l represents all lowercase letters a-z %p represents all punctuation characters or symbols such as . , ? ! : ; @ [ ] _ { } ~ %s represents all white space characters such as Tab, Carr.Return, Linefeed, Space, etc %u represents all uppercase letters A-Z %w represents all alphanumeric characters A-Z and a-z and 0-9 %x represents all hexadecimal digits 0-9 and A-F and a-f %z represents the character with code \000 because embedded zeroes in a pattern do not work The upper case letter versions of the above reverses their meaning i.e. %A represents all non-letters and %D represents all non-digits + one or more repetitions * or - zero or more repetitions ? optional (zero or one occurrence) %Y represents the character Y if it is any non-alphanumeric character This is the standard way to get a magic character to match itself Any punctuation character (even a non magic one) preceded by a % represents itself e.g. %% represents % percent and %+ represents + plus [set] represents the class which is the union of all characters in the set A range of characters is specified by separating first and last character of range with a - hyphen e.g. 1-5 All classes described above may also be used as components in the set e.g. [%w~] (or [~%w]) represents all alphanumeric characters plus the ~ tilde [^set] represents the complement of set, where set is interpreted as above e.g. [^A-Z] represents any character except upper case letters --]] local LovEdit = class { drawContext = {} } LovEdit.keymapping = { buffer = { ['up'] = 'moveUp', ['down'] = 'moveDown', ['left'] = 'moveLeft', ['alt+up'] = 'moveJumpUp', ['alt+down'] = 'moveJumpDown', ['ctrl+left'] = 'moveJumpLeft', ['ctrl+right'] = 'moveJumpRight', ['right'] = 'moveRight', ['home'] = 'moveHome', ['end'] = 'moveEnd', ['pageup'] = 'movePageUp', ['pagedown'] = 'movePageDown', ['ctrl+home'] = 'moveJumpHome', ['ctrl+end'] = 'moveJumpEnd', ['shift+up'] = 'selectUp', ['alt+shift+up'] = 'selectJumpUp', ['shift+down'] = 'selectDown', ['alt+shift+down'] = 'selectJumpDown', ['shift+left'] = 'selectLeft', ['ctrl+shift+left'] = 'selectJumpLeft', ['ctrl+shift+right'] = 'selectJumpRight', ['shift+right'] = 'selectRight', ['shift+home'] = 'selectHome', ['shift+end'] = 'selectEnd', ['shift+pageup'] = 'selectPageUp', ['shift+pagedown'] = 'selectPageDown', ['tab'] = 'insertTab', ['return'] = 'breakLine', ['enter'] = 'breakLine', ['delete'] = 'deleteRight', ['backspace'] = 'deleteLeft', ['ctrl+backspace'] = 'deleteWord', ['ctrl+x'] = 'cutText', ['ctrl+c'] = 'copyText', ['ctrl+v'] = 'pasteText', }, macros = { ['ctrl+shift+backspace'] = function(self) editorBuffer:setText("") end, ['alt+l'] = function(self) editorBuffer:insertString('love.graphics.') end, }, } LovEdit.highlighting = { -- taken from base16-woodland background = {0.05, 0.1, 0.05}, --editor background cursorline = {0.2, 0.2, 0.2}, --cursor background caret = {0.7, 1.0, 0.7}, --cursor whitespace = {0.0, 0.0, 0.0}, --spaces, newlines, tabs, and carriage returns comment = {0.6, 0.6, 0.6}, --either multi-line or single-line comments string_start = {0.75, 0.75, 0.5}, --starts and ends of a string. There will be no non-string tokens between these two. string_end = {0.75, 0.75, 0.5}, string = {0.9, 0.9, 0.5}, --part of a string that isn't an escape escape = {0.6, 0.9, 0.5}, --a string escape, like \n, only found inside strings keyword = {0.9, 0.6, 0.9}, --keywords. Like "while", "end", "do", etc btype = {0.75, 0.9, 0.75}, --value types funcs = {0.75, 0.75, 1.0}, -- functions value = {0.8, 0.5, 0.3}, --special values. Only true, false, and nil ident = {0.9, 0.5, 0.3}, --identifier. Variables, function names, etc number = {0.8, 0.8, 0.3}, --numbers, including both base 10 (and scientific notation) and hexadecimal symbol = {0.8, 0.8, 0.8}, --symbols, like brackets, parenthesis, ., .., etc vararg = {0.792, 0.498, 0.196}, --... operator = {0.7, 0.9, 0.7}, --operators, like +, -, %, =, ==, >=, <=, ~=, etc label_start = {0.615, 0.545, 0.439}, --the starts and ends of labels. Always equal to '::'. Between them there can only be whitespace and label tokens. label_end = {0.615, 0.545, 0.439}, label = {0.776, 0.737, 0.694}, --basically an ident between a label_start and label_end. unidentified = {0.827, 0.360, 0.360}, --anything that isn't one of the above tokens. Consider them errors. Invalid escapes are also unidentified. selection = {0.207, 0.223, 0.215}, } function LovEdit:init(conf) love.keyboard.setKeyRepeat(true) local font = love.graphics.newFont(conf.font, conf.font_size) self.drawContext.font = font self.drawContext.fontWidth = font:getWidth(' ') self.drawContext.fontHeight = font:getHeight() self.drawContext.highlighting = self.highlighting local width, height = love.graphics.getDimensions() self.drawContext.cols = math.floor(width / self.drawContext.fontWidth) self.drawContext.rows = math.floor(height / self.drawContext.fontHeight) - 1 self.drawContext.w = self.drawContext.cols * self.drawContext.fontWidth self.drawContext.h = self.drawContext.rows * self.drawContext.fontHeight self.editorBuffer = buffer.new(self.drawContext, conf.content) self.editorBuffer:setName(conf.name) self.mouse_aware = true self.window = false end function LovEdit:update(dt) -- if we allowed, study the mouse if self.mouse_aware then if love.mouse.isDown(1) then local mx = love.mouse.getX() - self.ulx local my = love.mouse.getY() - self.uly if (mx < 0) or (mx > self.drawContext.w) or (my < 0) or (my > self.drawContext.h) then return else self.editorBuffer:cursorGoPx(mx,my) end end end end function LovEdit:wheelmoved(x,y) if y > 0 then self.editorBuffer:moveUp() elseif y < 0 then self.editorBuffer:moveDown() end end function LovEdit:draw() if self.window then love.graphics.setCanvas(self.canvas) love.graphics.clear() love.graphics.setBlendMode("alpha") self.editorBuffer:drawCode() love.graphics.setCanvas() love.graphics.setColor(1, 1, 1, 1) love.graphics.setBlendMode("alpha", "premultiplied") love.graphics.draw(self.canvas,self.ulx,self.uly) love.graphics.setBlendMode("alpha") else self.editorBuffer:drawCode() end end function LovEdit:keypressed(k) if love.keyboard.isDown('lshift') or love.keyboard.isDown('rshift') then k = 'shift+'.. k end if love.keyboard.isDown('lalt') then k = 'alt+'.. k end if love.keyboard.isDown('ralt') then k = 'ralt+'.. k end if love.keyboard.isDown('lctrl') then k = 'ctrl+'.. k end if self.keymapping.buffer[k] then local functionName = self.keymapping.buffer[k] self.editorBuffer[functionName](self.editorBuffer) end if self.keymapping.macros[k] then self.keymapping.macros[k]() end end function LovEdit:textinput(k) if not love.keyboard.isDown('lctrl') and not love.keyboard.isDown('lalt') then self.editorBuffer:insertCharacter(k) end end function LovEdit:resize(w,h) self.drawContext.cols = math.floor(w / self.drawContext.fontWidth) self.drawContext.rows = math.floor(h / self.drawContext.fontHeight) - 1 self.drawContext.w = self.drawContext.cols * self.drawContext.fontWidth self.drawContext.h = self.drawContext.rows * self.drawContext.fontHeight self.editorBuffer:newcontext(self.drawContext) end function LovEdit:setName(name) self.editorBuffer:setName(name) end function LovEdit:getText() return self.editorBuffer:getText() end function LovEdit:setText(txt) self.editorBuffer:setText(txt) end function LovEdit:getColsPx(px_width) return math.floor(px_width / self.drawContext.fontWidth) end function LovEdit:getRowsPx(px_height) return math.floor(px_height / self.drawContext.fontHeight) end function LovEdit:getColsPxSnap(px_width) return math.floor(px_width / self.drawContext.fontWidth) * self.drawContext.fontWidth end function LovEdit:getRowsPxSnap(px_height) return math.floor(px_height / self.drawContext.fontHeight) * self.drawContext.fontHeight end function LovEdit:makeWindow(w,h,x,y) if w then -- make us a window self.window = true self.ww = w self.wh = h self.ulx = x or 0 self.uly = y or 0 self:resize(w,h) self.canvas = love.graphics.newCanvas(w, h) else -- nope, back to full-screen self.window = false self:resize(love.graphics.getWidth(),love.graphics.getHeight()) self.canvas = nil end end function LovEdit:place(x,y) self.ulx = x or 0 self.uly = y or 0 end return LovEdit
--- === cp.apple.finalcutpro.content.Clip === --- --- Represents a clip of media inside FCP. local axutils = require("cp.ui.axutils") local Table = require("cp.ui.Table") local Clip = {} Clip.mt = {} Clip.type = {} --- cp.apple.finalcutpro.content.Clip.type.filmstrip --- Constant --- A constant for clips which are represented by a filmstrip. Clip.type.filmstrip = "filmstrip" --- cp.apple.finalcutpro.content.Clip.type.row --- Constant --- A constant for clips which are represented by a table row. Clip.type.row = "row" --- cp.apple.finalcutpro.content.Clip:UI() -> axuielement --- Method --- Returns the `axuielement` for the clip. --- --- Parameters: --- * None --- --- Returns: --- * The `axuielement` for the clip. function Clip.mt:UI() return self._element end --- cp.apple.finalcutpro.content.Clip:getType() -> Clip.type --- Method --- Returns the type of clip (one of the `Clip.type` values) --- --- Parameters: --- * None --- --- Returns: --- * The `Clip.type` value (e.g. `Clip.type.row` or Clip.type.filmstrip`) function Clip.mt:getType() return self._type end --- cp.apple.finalcutpro.content.Clip:getTitle() -> String --- Method --- Returns the title of the clip. --- --- Parameters: --- * None --- --- Returns: --- * The clip title. function Clip.mt:getTitle() if self:getType() == Clip.type.row then local colIndex = self._options.columnIndex local cell = self._element[colIndex] return Table.cellTextValue(cell) else return self._element:attributeValue("AXDescription") end end --- cp.apple.finalcutpro.content.Clip.new(element[, options]) -> Clip --- Constructor --- Creates a new `Clip` pointing at the specified element, with the specified options. --- --- Parameters: --- * `element` - The `axuielement` the clip represents. --- * `options` - A table containing the options for the clip. --- --- Returns: --- * The new `Clip`. --- --- Notes: --- * The options may be: --- ** `columnIndex` - A number which will be used to specify the column number to find the title in, if relevant. function Clip.new(element, options) local o = { _element = element, _options = options or {}, _type = element:attributeValue("AXRole") == "AXRow" and Clip.type.row or Clip.type.filmstrip, } return setmetatable(o, {__index = Clip.mt}) end --- cp.apple.finalcutpro.content.Clip.is(thing) -> boolean --- Function --- Checks if the specified `thing` is a `Clip` instance. --- --- Parameters: --- * `thing` - The thing to check. --- --- Returns: --- * `true` if the `thing` is a `Clip`, otherwise returns `false`. function Clip.is(thing) return thing and getmetatable(thing) == Clip.mt end return Clip
-- STRIP CAMERA 1 stripCamera1 = nil stripCamera1Col = nil stripCamera1ColWarn = nil stripCamera1Speed = nil function resourceStart(res) -- STRIP CAMERA 1 stripCamera1 = createObject(1293, 1342.5859375, -1471.4306640625, 12.939081573486, 0, 0, 347.48364257813) exports.pool:allocateElement(stripCamera1) stripCamera1Col = createColTube(1342.5859375, -1471.4306640625, 5, 80, 9) exports.pool:allocateElement(stripCamera1Col) stripCamera1ColWarn = createColTube(1342.5859375, -1471.4306640625, 5, 150, 10) exports.pool:allocateElement(stripCamera1ColWarn) stripCamera1Speed = 65 addEventHandler("onColShapeHit", stripCamera1ColWarn, sendWarning) addEventHandler("onColShapeHit", stripCamera1Col, monitorSpeed) addEventHandler("onColShapeLeave", stripCamera1Col, stopMonitorSpeed) end addEventHandler("onResourceStart", getResourceRootElement(), resourceStart) -- dynamic stuff function monitorSpeed(element, matchingDimension) if (matchingDimension) and (getElementType(element)=="vehicle")then local thePlayer = getVehicleOccupant(element) if thePlayer then local timer = setTimer(checkSpeed, 200, 40, element, thePlayer, source) setElementData(thePlayer, "cameratimer", timer, false) end end end function stopMonitorSpeed(element, matchingDimension) if (matchingDimension) and (getElementType(element)=="vehicle") then local thePlayer = getVehicleOccupant(element) if thePlayer then local timer = getElementData(thePlayer, "cameratimer") if isTimer( timer ) then killTimer( timer ) end removeElementData( thePlayer, "cameratimer" ) end end end function checkSpeed(vehicle, player, colshape) speedx, speedy, speedz = getElementVelocity(vehicle) if (speedx) and (speedy) and (speedz) then speed = ((speedx^2 + speedy^2 + speedz^2)^(0.5)*100) if (colshape==stripCamera1Col) then -- strip camera 1 if (speed>stripCamera1Speed) then local x, y, z = getElementPosition(player) local timer = getElementData(player, "cameratimer") if timer then killTimer(timer) removeElementData(player, "cameratimer") end setTimer(sendWarningToCops, 1000, 1, vehicle, player, colshape, x, y, z, speed) end end end end lawVehicles = { [416]=true, [433]=true, [427]=true, [490]=true, [528]=true, [407]=true, [544]=true, [523]=true, [470]=true, [598]=true, [596]=true, [597]=true, [599]=true, [432]=true, [601]=true } function sendWarningToCops(vehicle, player, colshape, x, y, z, speed) local direction = "in an unknown direction" local areaname = getZoneName(x, y, z) local nx, ny, nz = getElementPosition(player) local vehname = getVehicleName(vehicle) local vehid = getElementModel(vehicle) if not (lawVehicles[vehid]) then local dx = nx - x local dy = ny - y if dy > math.abs(dx) then direction = "northbound" elseif dy < -math.abs(dx) then direction = "southbound" elseif dx > math.abs(dy) then direction = "eastbound" elseif dx < -math.abs(dy) then direction = "westbound" end exports.global:givePlayerAchievement(player, 13) triggerClientEvent(player, "cameraEffect", player) local theTeam = getTeamFromName("Los Santos Police Department") local teamPlayers = getPlayersInTeam(theTeam) for key, value in ipairs(teamPlayers) do local duty = tonumber(getElementData(value, "duty")) if (duty>0) then outputChatBox("DISPATCH: All units we have a traffic violation at " .. areaname .. ". ((" .. getPlayerName(player) .. "))", value, 255, 194, 14) outputChatBox("DISPATCH: Vehicle was a " .. vehname .. " travelling at " .. tostring(math.ceil(speed)) .. " Mph.", value, 255, 194, 14) outputChatBox("DISPATCH: Vehicle was last seen heading " .. direction .. ".", value, 255, 194, 14) end end end end function sendWarning(element, matchingDimension) if (matchingDimension) and (getElementType(element)=="vehicle")then local thePlayer = getVehicleOccupant(element) if (isElement(thePlayer) and (thePlayer~=getRootElement())) then outputChatBox("You are entering a speed control area. The speed limit is 60Kph (40Mph). Watch your speed.", thePlayer) outputChatBox("Courtesy of the Los Santos Police Department.", thePlayer) end end end function showspeed(thePlayer) local veh = getPedOccupiedVehicle(thePlayer) speedx, speedy, speedz = getElementVelocity (veh) actualspeed = ((speedx^2 + speedy^2 + speedz^2)^(0.5)*100) outputChatBox("SPEED: " .. actualspeed .. "(" .. getTrainSpeed(veh) .. ")") setVehicleEngineState(veh, true) end
-- Fetching script: copy all files necessary for the MIT Linux release -- of the scheduler. -- The `root` variable points to the Lua framework's root directory. root = "../luafwk" -- List of file copies to perform: -- -- * ">" lines introduce a new target directory; -- paths are relative to the current working directory. -- -- * "-" lines list files to copy in the latest target directory; -- paths are relative to `root`. -- script = [[ >. -/common/misc/coxpcall.lua -/common/misc/print.lua -/common/luasocket/common/ltn12.lua -/common/luasocket/common/mime.lua -/common/luasocket/common/socket.lua >utils -/common/utils/loader.lua -/common/utils/path.lua -/common/utils/table.lua >utils/ltn12 -/common/utils/ltn12/source.lua >c -/common/checks/checks.c -/common/checks/checks.h -/common/lpack/lpack.c -/common/lpack/lpack.h -/linux/liblua/mem_define.h -/common/luasocket/common/mime/mime.c -/common/luasocket/common/mime/mime.h >log -/common/log/common/log/init.lua -/common/log/common/log/tcp.lua -/common/log/common/log/tools.lua >c/log -/common/log/common/log_store.h -/common/log/common/log_store.c -/common/log/common/log_storeflash.h -/common/log/linux/log_storeflash.c >sched -/common/sched/common/sched/timer.lua -/common/sched/common/sched/init.lua -/common/sched/linux/sched/fd.lua -/common/sched/linux/sched/platform.lua -/common/misc/pipe.lua -/common/misc/lock.lua >shell -/common/shell/common/shell/telnet.lua >c/socket -/common/luasocket/linux/socket.h -/common/luasocket/linux/auxiliar.h -/common/luasocket/linux/buffer.h -/common/luasocket/linux/except.h -/common/luasocket/linux/inet.h -/common/luasocket/linux/io.h -/common/luasocket/linux/luasocket.h -/common/luasocket/linux/options.h -/common/luasocket/linux/select.h -/common/luasocket/linux/tcp.h -/common/luasocket/linux/timeout.h -/common/luasocket/linux/udp.h -/common/luasocket/linux/unix.h -/common/luasocket/linux/usocket.h -/common/luasocket/linux/auxiliar.c -/common/luasocket/linux/buffer.c -/common/luasocket/linux/except.c -/common/luasocket/linux/inet.c -/common/luasocket/linux/io.c -/common/luasocket/linux/luasocket.c -/common/luasocket/linux/options.c -/common/luasocket/linux/select.c -/common/luasocket/linux/tcp.c -/common/luasocket/linux/timeout.c -/common/luasocket/linux/udp.c -/common/luasocket/linux/unix.c -/common/luasocket/linux/usocket.c >socket -/common/luasocket/common/socket/ftp.lua -/common/luasocket/common/socket/http.lua -/common/luasocket/common/socket/smtp.lua -/common/luasocket/common/socket/tp.lua -/common/luasocket/common/socket/url.lua -/common/luasocket/linux/socket/platform.lua >c/telnet -/common/shell/common/telnet/actions.h -/common/shell/common/telnet/buffers.h -/common/shell/common/telnet/editor.h -/common/shell/common/telnet/history.h -/common/shell/common/telnet/teel.h -/common/shell/common/telnet/telnet.h -/common/shell/common/telnet/teel_internal.h -/common/shell/common/telnet/actions.c -/common/shell/common/telnet/buffers.c -/common/shell/common/telnet/editor.c -/common/shell/common/telnet/history.c -/common/shell/common/telnet/teel.c -/common/shell/common/telnet/telnet.c ]] -- Interpret the script string: -- create the necessary directories and perform file copies. -- Actual operations are performed through `os.execute`, -- and any execution error will halt the Lua script. -- function process_script(script) local target for op, arg in script :gmatch "([^\r\n])([^\r\n]*)" do local cmd if op==">" then target = arg cmd = "mkdir -p "..target elseif op=="-" then cmd = "cp "..root..arg.." "..target.."/" elseif op=="#" then -- pass the comment else error "Invalid script" end print (cmd) assert(0==os.execute(cmd)) end end process_script(script)
local sql = read_file_in_plugin_dir("sequences.sql") local key = "sequences" local function check(host, unix_ts) local result = storage:query(sql, host, unix_ts) if not(result.rows[1] == nil) and not(result.rows[1][1] == nil) then local sequence_name, remaining_capacity = result.rows[1][1], result.rows[1][2] local jsonb = { host = host, key = key, created_at = get_last_created_at(host, key, unix_ts), custom_details ={sequence_name=sequence_name, remaining_capacity=remaining_capacity} } local jsonb, err = json.encode(jsonb) if err then error(err) end storage:insert_metric({ host = host, plugin = plugin_name, json = jsonb }) end end return check
azura_black_ethereum = class({}) -------------------------------------------------------------------------------- -- Ability Start function azura_black_ethereum:OnSpellStart() -- unit identifier local caster = self:GetCaster() local target = self:GetCursorTarget() -- get references local max_target = self:GetSpecialValueFor("max_target") local damage = self:GetSpecialValueFor("damage_tooltip") local search_radius = self:GetSpecialValueFor("search_radius") local bolt_per_unit = self:GetSpecialValueFor("bolt_per_unit") local modifier_name = "modifier_azura_multishot_crossbow" -- find affected targets local enemies = FindUnitsInRadius( caster:GetTeamNumber(), -- int, your team number target:GetOrigin(), -- point, center point nil, -- handle, cacheUnit. (not known) search_radius, -- float, radius. or use FIND_UNITS_EVERYWHERE DOTA_UNIT_TARGET_TEAM_ENEMY, -- int, team filter DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, -- int, type filter 0, -- int, flag filter FIND_CLOSEST, -- int, order filter false -- bool, can grow cache ) -- prepare damageTable local damageTable = { victim = target, attacker = caster, damage_type = DAMAGE_TYPE_MAGICAL, damage = damage, ability = self, --Optional. } -- prepare modifier local modifier = caster:FindModifierByNameAndCaster(modifier_name, caster) -- for each affected targets, up until max_target local hit_target = 0 for _,enemy in pairs(enemies) do -- end if hits max_target if hit_target >= max_target then break end -- Apply Damage damageTable.victim = enemy ApplyDamage(damageTable) -- Increase bolt charges if modifier~=nil then modifier:AddStack( bolt_per_unit ) end -- increase hit target hit_target = hit_target + 1 -- play effects self:PlayEffects2( enemy ) end self:PlayEffects() end -------------------------------------------------------------------------------- -- Effects function azura_black_ethereum:PlayEffects() -- get resources local sound_cast = "Hero_ShadowShaman.EtherShock.Cast" -- -- play effects -- local nFXIndex = ParticleManager:CreateParticle( particle_target, PATTACH_WORLDORIGIN, nil ) -- ParticleManager:SetParticleControl( nFXIndex, 0, target:GetOrigin() ) -- ParticleManager:SetParticleControl( nFXIndex, 1, target:GetOrigin() ) -- ParticleManager:ReleaseParticleIndex( nFXIndex ) -- play sounds EmitSoundOn( sound_cast, self:GetCaster() ) end function azura_black_ethereum:PlayEffects2( target ) -- get resources local particle_cast = "particles/units/heroes/hero_shadowshaman/shadowshaman_ether_shock.vpcf" local sound_target = "Hero_ShadowShaman.EtherShock.Target" -- play effects local nFXIndex = ParticleManager:CreateParticle( particle_cast, PATTACH_CUSTOMORIGIN, nil ); ParticleManager:SetParticleControlEnt( nFXIndex, 0, self:GetCaster(), PATTACH_POINT_FOLLOW, "attach_attack1", self:GetCaster():GetOrigin() + Vector( 0, 0, 96 ), true ); ParticleManager:SetParticleControlEnt( nFXIndex, 1, target, PATTACH_POINT_FOLLOW, "attach_hitloc", target:GetOrigin(), true ); ParticleManager:ReleaseParticleIndex( nFXIndex ); -- play sounds EmitSoundOn( sound_target, target ) end
Config = {} Config.PlateLetters = 4 Config.PlateNumbers = 4 Config.PlateUseSpace = false Config.SpawnVehicle = true -- TRUE if you want spawn vehicle when buy Config.TestDrive = true -- TRUE if you want enable test drive Config.TestDriveTime = 10 -- TIME in SEC Config.Build2060 = true Config.Locale = 'en'
--[[-------------------------------------------------------------------------- Copyright (c) 2009-2021, Google LLC All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --]]-------------------------------------------------------------------------- local upb = require("lupb") upb.generated_pool = upb.DefPool() local module_metatable = { __index = function(t, k) local package = t._filedef:package() if package then k = package .. "." .. k end local pool = upb.generated_pool local def = pool:lookup_msg(k) or pool:lookup_enum(k) local v = nil if def and def:file():name() == t._filedef:name() then v = def t[k] = v end return v end } function upb._generated_module(desc_string) local file = upb.generated_pool:add_file(desc_string) local module = {_filedef = file} setmetatable(module, module_metatable) return module end return upb
--[[ Copyright 2017 wrxck <[email protected]> This code is licensed under the MIT. See LICENSE for details. ]] local statistics = {} local mattata = require('mattata') local redis = require('mattata-redis') function statistics:init() statistics.help = [[/statistics - Shows statistical information about the current chat's top ten users (ordered by message count). Alias: /stats.]] end function statistics.get_name(user) if user.name then return user.name end local text = '' if user.first_name then text = user.first_name .. ' ' end if user.last_name then text = text .. user.last_name end return text end function statistics.get_messages(id, chat) local info = {} local user = redis:hgetall('user:' .. id) info.messages = tonumber( redis:get('messages:' .. id .. ':' .. chat) ) or 0 info.name = statistics.get_name(user) return info end function statistics.get_statistics(chat, title, total) local hash = 'chat:' .. chat .. ':users' local users = redis:smembers(hash) local user_info = {} for i = 1, #users do local id = users[i] local user = statistics.get_messages( id, chat ) table.insert( user_info, user ) end table.sort( user_info, function(a, b) if a.messages and b.messages then return a.messages > b.messages end end ) local total = 0 for n, user in pairs(user_info) do local message_count = user_info[n].messages total = total + message_count end local text = '' local output = {} for i = 1, 10 do table.insert( output, user_info[i] ) end for k, v in pairs(output) do local message_count = v.messages local percent = tostring( mattata.round( (message_count / total) * 100, 1 ) ) text = text .. mattata.escape_html(v.name) .. ': <b>' .. mattata.comma_value(message_count) .. '</b> [' .. percent .. '%]\n' end if text == nil or text == '' then return 'No messages have been sent in this chat!' end return '<b>Statistics for:</b> ' .. mattata.escape_html(title) .. '\n\n' .. text .. '\n<b>Total messages sent:</b> ' .. mattata.comma_value(total) end function statistics:process_message(message) if message.left_chat_member then redis:srem( 'chat:' .. message.chat.id .. ':users', message.left_chat_member.id ) return message end if message.from.name then redis:hset( 'user:' .. message.from.id, 'name', message.from.name ) end if message.from.first_name then redis:hset( 'user:' .. message.from.id, 'first_name', message.from.first_name ) end if message.from.last_name then redis:hset( 'user:' .. message.from.id, 'last_name', message.from.last_name ) end if message.chat.type ~= 'private' then redis:sadd( 'chat:' .. message.chat.id .. ':users', message.from.id ) end redis:incr('messages:' .. message.from.id .. ':' .. message.chat.id) return message end function statistics:on_message(message) if message.chat.type == 'private' then return end return mattata.send_message( message.chat.id, statistics.get_statistics( message.chat.id, message.chat.title, message.message_id ), 'html' ) end return statistics
--- -- Created by IntelliJ IDEA. -- @author [email protected] -- @copyright 2012 임창진 -- local storyboard = require("storyboard") local PS = require("classes.ParticleSugar").instance() local scene = storyboard.newScene() function scene:createScene(event) end -- Called immediately after scene has moved onscreen: function scene:enterScene(event) storyboard.removeAll() local group = self.view display.newText(group, "effect 1",20,20,native.systemFont, 24) ----------- particle begin ------------- Runtime:addEventListener('enterFrame', PS ) local dustEm = PS:newEmitter{ name="em1", x=0,y=0, rotation=0, visible=true, loop=false, autoDestroy=false } dustEm:setParentGroup(group) dustEm.x = 160 dustEm.y = 160 PS:newParticleType{ name="starPt",prop={ scaleStart = 1, scaleVariation = 0, velocityStart = 60, velocityVariation = 30, rotationStart = 0, rotationVariation = 0, directionVariation = 360, killOutsideScreen = false, lifeTime = 500, alphaStart = 1, fadeOutSpeed = -2, fadeOutDelay = 150, imagePath={ "image/s1.png", }, imageWidth=10, imageHeight=10, } } PS:attachParticleType("em1", "starPt", 50, 300, 0) ----------- particle end ------------- -- button -- local caption = display.newText(group, "Prev",20,420,native.systemFont, 24) caption:addEventListener('touch',function(event) if event.phase == 'ended' then storyboard.gotoScene("scene.effect6") end end) local caption1 = display.newText(group, "start emit",100,420,native.systemFont, 24) caption1:addEventListener('touch',function() PS:startEmitter('em1') end) local caption2 = display.newText(group, "Next",240,420,native.systemFont, 24) caption2:addEventListener('touch',function(event) if event.phase == 'ended' then storyboard.gotoScene("scene.effect2") end end) -- button end -- end -- Called when scene is about to move offscreen: function scene:exitScene(event) local group = self.view Runtime:removeEventListener('enterFrame', PS ) PS:cleanUp() end -- If scene's view is removed, scene:destroyScene() will be called just prior to: function scene:destroyScene(event) local group = self.view collectgarbage('collect') end ----------------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION ----------------------------------------------------------------------------------------- -- "createScene" event is dispatched if scene's view does not exist scene:addEventListener("createScene", scene) -- "enterScene" event is dispatched whenever scene transition has finished scene:addEventListener("enterScene", scene) -- "exitScene" event is dispatched whenever before next scene's transition begins scene:addEventListener("exitScene", scene) -- "destroyScene" event is dispatched before view is unloaded, which can be -- automatically unloaded in low memory situations, or explicitly via a call to -- storyboard.purgeScene() or storyboard.removeScene(). scene:addEventListener("destroyScene", scene) ----------------------------------------------------------------------------------------- return scene
local ffi = require "ffi" local ffi_cdef = ffi.cdef ffi_cdef[[ typedef struct ripemd160_ctx { uint32_t state[5]; uint64_t count; uint8_t block[64]; unsigned int index; } RIPEMD160_CTX; ]]
local net_ReadEntity = net.ReadEntity local net_ReadString = net.ReadString local net_ReadUInt = net.ReadUInt local net_Receive = net.Receive local tostring = tostring local isnumber = isnumber local IsValid = IsValid PLib:Precache_G("net.Start", net.Start) local net_Start = PLib:Get_G("net.Start") local math_random = math.random local SysTime = SysTime local nets = {} local function checkNetStart(name, timeout) if (timeout != nil) then local lastNet = nets[name] if (lastNet != nil) then if (nets[name] == false) then return false end if (lastNet[2] > math_random(22, 28)) then nets[name] = false return false end if (SysTime() - lastNet) < timeout then nets[name] = {SysTime(), lastNet[2] + 1} return false end end lastNet = {SysTime(), 0} end return true end function net.Start(name, unreliable, timeout, tag) if (checkNetStart(tag or name, timeout) == false) then Error("Too frequent requests to server!") end net_Start(name, unreliable) end local matOptions = PLib["MatPresets"]["Pic"] local acts = { [0] = function() PLib["Achievements"] = {} for tag, tbl in pairs(net.ReadCompressTable() or {}) do if (tbl != nil) then local mat = tbl[2] if (mat != nil) then tbl[2] = (isnumber(mat) and PLib:GetStandardAchievementIcon(mat) or Material(mat, matOptions)) end PLib["Achievements"][tostring(tag)] = tbl end end end, [1] = function() local ply = net_ReadEntity() if IsValid(ply) then local id = net_ReadString() ply:GotAchievement(id) if (ply == LocalPlayer()) then PLib.AchievementVGUI(id) end end end, [2] = function() end, [3] = function() local url = net_ReadString() if url == "" then PLib["ServerLogo"] = nil else PLib["ServerLogo"] = Material(url, matOptions) end RunConsoleCommand("plib_logo_update") end, [4] = function() local NETCALL = PLib["NetCallback"] NETCALL:Run(net_ReadString(), net.ReadCompressTable()) end, [5] = function() PLib:SetServerName(net_ReadString()) end, } net_Receive("PLib", function(len) local act = acts[net_ReadUInt(3)] if (act != nil) then act() end end)
local uv = require('uv') local parseUrl = require('url').parse local connect = require('coro-net').connect local tlsWrap = require('coro-tls').wrap local rex = require('rex') local getaddrinfo = require('./utils').getaddrinfo local httpCodec = require('http-codec') local wrapper = require('coro-wrapper') local httpAuth = require('./http-auth') local os = require('os') local function parseProps(data, string) for key, value in string:gmatch('([^ ";=]+)="([^"]+)"') do data[key] = value end for key, value in string:gmatch('([^ ";=]+)=([^ ";=]+)') do data[key] = value end end local function readBody(read) local body = "" for chunk in read do if not chunk then return end if #chunk == 0 then return body end body = body .. chunk end end local months = { Jan = 1, Feb = 2, Mar = 3, Apr = 4, May = 5, Jun = 6, Jul = 7, Aug = 8, Sep = 9, Oct = 10, Nov = 11, Dec = 12, } local function parseDate(date) -- parses dates like: Apr 28 15:31:07 2016 GMT local pattern = "(%a+) (%d+) (%d+):(%d+):(%d+) (%d+) (%a+)" local month, day, hour, min, sec, year, tz = date:match(pattern) month = months[month] -- TODO: account for timezone to get accurate timestamp return os.time({ year = year, month = month, day = day, hour = hour, min = min, sec = sec }), tz end --[[ --------------------------------- Attributes --------------------------------- target: String hostname or ip address timeout: Uint32 timeout in ms --------------------------------- Config Params -------------------------------- url: URL / String between 1 and 8096 characters long Target URL auth_password: Optional / String between 1 and 255 characters long Optional auth password auth_user: Optional / String between 1 and 255 characters long Optional auth user body: Optional / String between 1 and 255 characters long Body match regular expression (body is limited to 100k) body_matches: Optional / Hash Body match regular expressions (body is limited to 100k, matches are truncated to 80 characters) Hash [String,String between 1 and 50 characters long,String matching the regex /^[-_ a-z0-9]+$/i:String,String between 1 and 255 characters long] Array or object with number of items between 0 and 4 follow_redirects: Optional / Boolean Follow redirects (default: true) headers: Optional / Hash Arbitrary headers which are sent with the request. Hash [String between 1 and 50 characters : String between 1 and 50 characters] Array or object with number of items between 0 and 10. A value which is not one of: content-length, user-agent, host, connection, keep-alive, transfer-encoding, upgrade method: Optional / String / One of (HEAD, GET, POST, PUT, DELETE, INFO) HTTP method (default: GET) payload: Optional / String between 0 and 1024 characters long Specify a request body (limited to 1024 characters). If following a redirect, payload will only be sent to first location ------------------------------------- Metrics ---------------------------------- body_match: String The string representing the body match specified in a remote.http check. body_match_one: String The string representing a single body_matches value specified in a remote.http check. This metrics are only present when using a body_matches option. one is the actual key you have specified for the body_matches option. body_match_two: String The string representing a single body_matches value specified in a remote.http check. This metrics are only present when using a body_matches option. two is the actual key you have specified for the body_matches option. bytes: Int32 The number of bytes returned from a response payload. cert_end: Uint32 The absolute timestamp in seconds for the certificate expiration. This is only available when performing a check on an HTTPS server. cert_end_in: Int32 The relative timestamp in seconds til certification expiration. This is only available when performing a check on an HTTPS server. cert_error: String A string describing a certificate error in our validation. This is only available when performing a check on an HTTPS server. cert_issuer: String The issue string for the certificate. This is only available when performing a check on an HTTPS server. cert_start: Uint32 The absolute timestamp of the issue of the certificate. This is only available when performing a check on an HTTPS server. cert_subject: String The subject of the certificate. This is only available when performing a check on an HTTPS server. cert_subject_alternative_names: String The alternative name for the subject of the certificate. This is only available when performing a check on an HTTPS server. code: String The status code returned. duration: Uint32 The time took to finish executing the check in milliseconds. truncated: Uint32 The number of bytes that the result was truncated by. tt_connect: Uint32 The time to connect measured in milliseconds. tt_firstbyte: Uint32 The time to first byte measured in milliseconds. ----------------------------------------------------------------------------]]-- return function (attributes, config, register, set) local start = uv.now() local body local read, write, socket, req, res local redirects_left = config.follow_redirects and 100 or 0 local cookies = {} local function request(urlString, authProps) local url = parseUrl(urlString, true) -- Get host and ip from url, fallback to attributes local ssl = url.protocol == "https" local port = tonumber(url.port) or ssl and 443 or 80 local host = url.hostname or attributes.target -- Resolve hostname and record time spent local ip = assert(getaddrinfo(host, port, attributes.family)) set("tt_resolve", uv.now() - start) set("ip", ip) set("port", port) -- Connect to TCP port and record time spent read, write, socket = assert(connect { host = ip, port = port }) set("tt_connect", uv.now() - start) register(socket) if ssl then read, write, ssl = tlsWrap(read, write, {}) set("tt_ssl", uv.now() - start) local cert = ssl:peer() local expires = parseDate(cert:notafter()) set("cert_end", expires) set("cert_end_in", expires - os.time()) set("cert_start", parseDate(cert:notbefore())) set("cert_issuer", tostring(cert:issuer())) set("cert_subject", tostring(cert:subject())) -- TODO: cert_subject_alternative_names -- TODO: cert_error end read = wrapper.reader(read, httpCodec.decoder()) write = wrapper.writer(write, httpCodec.encoder()) req = { method = config.method or "GET", path = url.path, {"Host", url.host}, {"User-Agent", "Rackspace Monitoring Agent"}, } local cookieList = {} for key, value in pairs(cookies) do if value:match(" ") then value = '"' .. value .. '"' end cookieList[#cookieList + 1] = key .. '=' .. value end if #cookieList > 0 then req[#req + 1] = {"Cookie", table.concat(cookieList, ", ")} end if config.auth_user and config.auth_password then local auth = httpAuth(config.auth_user, config.auth_password, authProps) req[#req + 1] = {"Authorization", auth} end if config.payload then req[#req + 1] = {"Content-Length", #config.payload} end if config.headers then for key, value in pairs(config.headers) do req[#req + 1] = {key, value} end end -- p(req) write(req) if config.payload then write(config.payload) end write("") res = read() -- p(res) set("tt_firstbyte", uv.now() - start) set("code", res.code) if not authProps and tonumber(res.code) == 401 then for i = 1, #res do local name = res[i][1]:lower() if name == "set-cookie" then parseProps(cookies, res[i][2]) elseif name == "www-authenticate" then local challenge = res[i][2] if challenge:match("^Digest ") then authProps = { method = req.method, uri = req.path, body = readBody(read) } parseProps(authProps, challenge) end end end if authProps then return request(urlString, authProps) end end if redirects_left > 0 and tonumber(res.code) == 301 and res.location then redirects_left = redirects_left - 1 write() return request(res.location) end end request(config.url) body = readBody(read) -- p(body) local bytes = #body set("bytes", bytes) if bytes > 100000 then body = body:sub(1, 100000) end set("truncated", bytes - #body) if config.body then set("body_match", rex.match(body, config.body)) end if config.body_matches then for key, reg in pairs(config.body_matches) do set("body_match_" .. key, rex.match(body, reg)) end end -- TODO: finish HTTP check set("duration", uv.now() - start) end
---Find primes smaller than this number: LIMIT=100000 primes={} ---Checks to see if a number is prime or not function isPrime(n) for i, prime in pairs(primes) do if prime*2 > n then break end if (n%prime == 0) then return end end table.insert(primes, n) end ---Print all the prime numbers within range for i=2,LIMIT do isPrime(i) end print(#primes)
--- Utility module for loading files into tables and -- saving tables into files. -- Implemented separately to avoid interdependencies, -- as it is used in the bootstrapping stage of the cfg module. --module("luarocks.persist", package.seeall) local persist = {} package.loaded["luarocks.persist"] = persist local util = require("luarocks.util") --- Load a Lua file containing assignments, storing them in a table. -- The global environment is not propagated to the loaded file. -- @param filename string: the name of the file. -- @param tbl table or nil: if given, this table is used to store -- loaded values. -- @return table or (nil, string): a table with the file's assignments -- as fields, or nil and a message in case of errors. function persist.load_into_table(filename, tbl) assert(type(filename) == "string") assert(type(tbl) == "table" or not tbl) local result, chunk, ran, err result = tbl or {} local globals = {} local globals_mt = { __index = function(t, n) globals[n] = true return rawget(t, n) end } local save_mt = getmetatable(result) setmetatable(result, globals_mt) if _VERSION == "Lua 5.1" then -- Lua 5.1 chunk, err = loadfile(filename) if chunk then setfenv(chunk, result) ran, err = pcall(chunk) end else -- Lua 5.2 chunk, err = loadfile(filename, "t", result) if chunk then ran, err = pcall(chunk) end end setmetatable(result, save_mt) if not chunk then if err:sub(1,5) ~= filename:sub(1,5) then return false, err end return nil, "Error loading file: "..err end if not ran then return nil, "Error running file: "..err end return result, globals end local write_table --- Write a value as Lua code, invoking write_table. -- This function handles only numbers, strings and tables -- are keys (tables are handled recursively). -- @param out userdata: a file object, open for writing. -- @param v: the value to be written. -- @param level number: the indentation level -- @param sub_order table: optional prioritization table -- @see write_table local function write_value(out, v, level, sub_order) if type(v) == "table" then write_table(out, v, level + 1, sub_order) elseif type(v) == "string" then if v:match("\n") then local open, close = "[[", "]]" local equals = 0 while v:find(open,1,true) or v:find(close,1,true) do equals = equals + 1 local eqs = ("="):rep(equals) open, close = "["..eqs.."[", "]"..eqs.."]" end out:write(open.."\n"..v..close) else out:write("\""..v:gsub("\"", "\\\"").."\"") end else out:write(tostring(v)) end end --- Write a table as Lua code representing a table to disk -- (that is, in curly brackets notation). -- This function handles only numbers, strings and tables -- are keys (tables are handled recursively). -- @param out userdata: a file object, open for writing. -- @param tbl table: the table to be written. -- @param level number: the indentation level -- @param field_order table: optional prioritization table write_table = function(out, tbl, level, field_order) out:write("{") local sep = "\n" local indentation = " " local indent = true local i = 1 for k, v, sub_order in util.sortedpairs(tbl, field_order) do out:write(sep) if indent then for n = 1,level do out:write(indentation) end end sep = ",\n" indent = true if type(k) == "number" then if k ~= i then out:write("["..tostring(k).."]=") else i = i + 1 end indent = false sep = ", " elseif type(k) == "table" then out:write("[") write_table(out, k, level + 1) out:write("] = ") else if k:match("^[a-zA-Z_][a-zA-Z0-9_]*$") then out:write(k.." = ") else out:write("['"..k:gsub("'", "\\'").."'] = ") end end write_value(out, v, level, sub_order) end if sep ~= "\n" then out:write("\n") for n = 1,level-1 do out:write(indentation) end end out:write("}") end --- Writes a table to an io-like object. -- @param out userdata: a file object, open for writing. -- @param tbl table: the table to be written. -- @param field_order table: optional prioritization table -- @return userdata The file object originally passed in as the `out` parameter. local function write_table(out, tbl, field_order) for k, v, sub_order in util.sortedpairs(tbl, field_order) do out:write(k.." = ") write_value(out, v, 0, sub_order) out:write("\n") end return out end --- Save the contents of a table to a string. -- Each element of the table is saved as a global assignment. -- Only numbers, strings and tables (containing numbers, strings -- or other recursively processed tables) are supported. -- @param tbl table: the table containing the data to be written -- @param field_order table: an optional array indicating the order of top-level fields. -- @return string function persist.save_from_table_to_string(tbl, field_order) local out = {buffer = {}} function out:write(data) table.insert(self.buffer, data) end write_table(out, tbl, field_order) return table.concat(out.buffer) end --- Save the contents of a table in a file. -- Each element of the table is saved as a global assignment. -- Only numbers, strings and tables (containing numbers, strings -- or other recursively processed tables) are supported. -- @param filename string: the output filename -- @param tbl table: the table containing the data to be written -- @param field_order table: an optional array indicating the order of top-level fields. -- @return boolean or (nil, string): true if successful, or nil and a -- message in case of errors. function persist.save_from_table(filename, tbl, field_order) local out = io.open(filename, "w") if not out then return nil, "Cannot create file at "..filename end write_table(out, tbl, field_order) out:close() return true end return persist
workspace "SBXS" language "D" configurations { "Test" } location "build" filter "configurations:Test" flags { "UnitTest", "CodeCoverage" } optimize "Off" project "UnitTests" kind "ConsoleApp" files {"src/run_unit_tests.d", "src/sbxs/**.d"} targetdir "build"
--[[ -- Clone table format ["CLONED GAME ID"] = { [CLONE REVISION] = { id = "ORIGINAL GAME ID", version = REVISION } } ]] return { ["GTME01"] = { [2] = { id = "GALE01", version = 2 }, -- UnclePunch Training Mode }, ["MNCE02"] = { [2] = { id = "GALE01", version = 2 }, -- Melee Netplay Community Build }, ["SDRE32"] = { [3] = { id = "GALE01", version = 2 }, -- SSBM SD Remix }, ["RSBE01"] = { -- Brawl versions 1.0, 1.1 have the same memory locations for controller data as 1.2 [0] = { id = "RSBE01", version = 2 }, -- Super Smash Bros. Brawl (v1.0) [1] = { id = "RSBE01", version = 2 }, -- Super Smash Bros. Brawl (v1.1) }, ["G2ME0R"] = { [0] = { id = "G2ME01", version = 0 }, -- Metroid Prime 2: Echoes Randomizer }, ["KHPE01"] = { [0] = { id = "GKYE01", version = 0 }, -- Kirby Air Ride Hack Pack }, ["GZLE99"] = { [0] = { id = "GZLE01", version = 0 }, -- The Legend of Zelda: The Wind Waker Randomizer }, ["GALJ01"] = { [0] = { id = "GALE01", version = 0 }, -- Dairantou Smash Brothers DX (Japan) (v1.0) [1] = { id = "GALE01", version = 1 }, -- Dairantou Smash Brothers DX (Japan) (v1.1) [2] = { id = "GALE01", version = 2 }, -- Dairantou Smash Brothers DX (Japan) (v1.2) }, }
-- mod-version:2 -- lite-xl 2.0 local core = require "core" local style = require "core.style" local command = require "core.command" local keymap = require "core.keymap" local DocView = require "core.docview" local config = require "core.config" -- Colors can be configured as follows: -- underline color = `style.bracketmatch_color` -- bracket color = `style.bracketmatch_char_color` -- background color = `style.bracketmatch_block_color` -- frame color = `style.bracketmatch_frame_color` config.plugins.bracketmatch = { highligh_both = true, -- highlight the current bracket too style = "underline", -- can be "underline", "block", "frame", "none" color_char = false, -- color the bracket line_size = math.ceil(1 * SCALE), -- the size of the lines used in "underline" and "frame" } local bracket_maps = { -- [ ] ( ) { } { [91] = 93, [40] = 41, [123] = 125, direction = 1 }, -- ] [ ) ( } { { [93] = 91, [41] = 40, [125] = 123, direction = -1 }, } local function get_token_at(doc, line, col) local column = 0 for _,type,text in doc.highlighter:each_token(line) do column = column + #text if column >= col then return type, text end end end local function get_matching_bracket(doc, line, col, line_limit, open_byte, close_byte, direction) local end_line = line + line_limit * direction local depth = 0 while line ~= end_line do local byte = doc.lines[line]:byte(col) if byte == open_byte and get_token_at(doc, line, col) ~= "comment" then depth = depth + 1 elseif byte == close_byte and get_token_at(doc, line, col) ~= "comment" then depth = depth - 1 if depth == 0 then return line, col end end local prev_line, prev_col = line, col line, col = doc:position_offset(line, col, direction) if line == prev_line and col == prev_col then break end end end local state = {} local select_adj = 0 local function update_state(line_limit) line_limit = line_limit or math.huge -- reset if we don't have a document (eg. DocView isn't focused) local doc = core.active_view.doc if not doc then state = {} return end -- early exit if nothing has changed since the last call local line, col = doc:get_selection() local change_id = doc:get_change_id() if state.doc == doc and state.line == line and state.col == col and state.change_id == change_id and state.limit == line_limit then return end -- find matching bracket if we're on a bracket local line2, col2 for _, map in ipairs(bracket_maps) do for i = 0, -1, -1 do local line, col = doc:position_offset(line, col, i) local open = doc.lines[line]:byte(col) local close = map[open] if close and get_token_at(doc, line, col) ~= "comment" then -- i == 0 if the cursor is on the left side of a bracket (or -1 when on right) select_adj = i + 1 -- if i == 0 then select_adj = 1 else select_adj = 0 end line2, col2 = get_matching_bracket(doc, line, col, line_limit, open, close, map.direction) goto found end end end ::found:: -- update state = { change_id = change_id, doc = doc, line = line, col = col, line2 = line2, col2 = col2, limit = line_limit, } end local update = DocView.update function DocView:update(...) update(self, ...) update_state(100) end local function redraw_char(dv, x, y, line, col, bg_color, char_color) local x1 = x + dv:get_col_x_offset(line, col) local x2 = x + dv:get_col_x_offset(line, col + 1) local lh = dv:get_line_height() local token = get_token_at(dv.doc, line, col) if not char_color then char_color = style.syntax[token] end local font = style.syntax_fonts[token] or dv:get_font() local char = string.sub(dv.doc.lines[line], col, col) if not bg_color then -- redraw background core.push_clip_rect(x1, y, x2 - x1, lh) local dlt = DocView.draw_line_text DocView.draw_line_text = function() end dv:draw_line_body(line, x, y) DocView.draw_line_text = dlt core.pop_clip_rect() else renderer.draw_rect(x1, y, x2 - x1, lh, bg_color) end renderer.draw_text(font, char, x1, y + dv:get_line_text_y_offset(), char_color) end local function draw_decoration(dv, x, y, line, col) local conf = config.plugins.bracketmatch local color = style.bracketmatch_color or style.syntax["function"] local char_color = style.bracketmatch_char_color or (conf.style == "block" and style.background or style.syntax["keyword"]) local block_color = style.bracketmatch_block_color or style.line_number2 local frame_color = style.bracketmatch_frame_color or style.line_number2 local h = conf.line_size if conf.color_char or conf.style == "block" then redraw_char(dv, x, y, line, col, conf.style == "block" and block_color, conf.color_char and char_color) end if conf.style == "underline" then local x1 = x + dv:get_col_x_offset(line, col) local x2 = x + dv:get_col_x_offset(line, col + 1) local lh = dv:get_line_height() renderer.draw_rect(x1, y + lh - h, x2 - x1, h, color) elseif conf.style == "frame" then local x1 = x + dv:get_col_x_offset(line, col) local x2 = x + dv:get_col_x_offset(line, col + 1) local lh = dv:get_line_height() renderer.draw_rect(x1, y + lh - h, x2 - x1, h, frame_color) renderer.draw_rect(x1, y, x2 - x1, h, frame_color) renderer.draw_rect(x1, y, h, lh, frame_color) renderer.draw_rect(x2, y, h, lh, frame_color) end end local draw_line_text = DocView.draw_line_text function DocView:draw_line_text(idx, x, y) draw_line_text(self, idx, x, y) if self.doc == state.doc and state.line2 then if idx == state.line2 then draw_decoration(self, x, y, idx, state.col2) end if idx == state.line and config.plugins.bracketmatch.highligh_both then draw_decoration(self, x, y, idx, state.col + select_adj - 1) end end end command.add("core.docview", { ["bracket-match:move-to-matching"] = function() update_state() if state.line2 then core.active_view.doc:set_selection(state.line2, state.col2) end end, ["bracket-match:select-to-matching"] = function() update_state() if state.line2 then core.active_view.doc:set_selection(state.line, state.col, state.line2, state.col2 + select_adj) end end, }) keymap.add { ["ctrl+m"] = "bracket-match:move-to-matching", ["ctrl+shift+m"] = "bracket-match:select-to-matching", }
gen_medium_win_s01_loot_deed = { minimumLevel = 0, maximumLevel = -1, customObjectName = "Medium Generic House, Style 1 (Windowed) Blueprint", directObjectTemplate = "object/tangible/loot/loot_schematic/gen_md_win_01_loot_schem.iff", craftingValues = { }, customizationStringNames = {}, customizationValues = {} } addLootItemTemplate("gen_medium_win_s01_loot_deed", gen_medium_win_s01_loot_deed)
local loader = function(loader, ...) local record = require"_cqueues.dns.record" for k, v in pairs(record.class) do if type(k) == "string" then record[k] = v end end for k, v in pairs(record.type) do if type(k) == "string" then record[k] = v end end for k, v in pairs(require"cqueues.dns.packet".section) do if type(k) == "string" then record[k] = v end end return record end return loader(loader, ...)
local constants = require("constants") local styles = data.raw["gui-style"].default styles.rb_list_box_item = { type = "button_style", parent = "list_box_item", left_padding = 4, right_padding = 4, horizontally_squashable = "on", horizontally_stretchable = "on", disabled_graphical_set = styles.list_box_item.default_graphical_set, disabled_font_color = styles.list_box_item.default_font_color } styles.rb_last_selected_list_box_item = { type = "button_style", parent = "rb_list_box_item", default_font_color = constants.colors.yellow.tbl, disabled_font_color = constants.colors.yellow.tbl } styles.rb_unresearched_list_box_item = { type = "button_style", parent = "rb_list_box_item", default_font_color = constants.colors.unresearched.tbl, disabled_font_color = constants.colors.unresearched.tbl } styles.rb_table_button = { type = "button_style", parent = "rb_list_box_item", horizontally_stretchable = "off", horizontally_squashable = "off", top_margin = -3, right_margin = -8, bottom_margin = -5, left_margin = -8, } -- FLOW STYLES styles.rb_main_frame_flow = { type = "horizontal_flow_style", horizontal_spacing = 12 } styles.rb_main_info_pane_flow = { type = "vertical_flow_style", vertical_spacing = 8 } styles.rb_quick_ref_content_flow = { type = "vertical_flow_style", bottom_padding = 12, left_padding = 12, right_padding = 0, top_padding = 6 } styles.rb_search_content_flow = { type = "vertical_flow_style", padding = 12, top_padding = 8, vertical_spacing = 10 } styles.rb_warning_flow = { type = "vertical_flow_style", padding = 12, horizontal_align = "center", vertical_align = "center", vertical_spacing = 8, horizontally_stretchable = "on", vertically_stretchable = "on", } -- FRAME STYLES styles.rb_main_info_frame = { type = "frame_style", parent = "inside_shallow_frame", width = 450 } styles.rb_search_results_frame = { type = "frame_style", parent = "deep_frame_in_shallow_frame", height = 28 * 18, width = 250, horizontally_stretchable = "on" } styles.rb_search_results_subheader_frame = { type = "frame_style", parent = "subheader_frame", height = 28, horizontally_stretchable = "on", horizontal_flow_style = { type = "horizontal_flow_style", horizontal_align = "center" } } styles.rb_subheader_frame = { type = "frame_style", parent = "subheader_frame", height = 0, -- Negate the height requirement minimal_height = 36 } styles.rb_quick_ref_content_frame = { type = "frame_style", parent = "inside_shallow_frame", width = 224 } styles.rb_slot_table_frame = { type = "frame_style", parent = "slot_button_deep_frame", maximal_height = 200, natural_height = 40, width = 40 * 5 } styles.rb_settings_category_frame = { type = "frame_style", parent = "bordered_frame", horizontally_stretchable = "on", right_padding = 8 } styles.rb_inside_warning_frame = { type = "frame_style", parent = "inside_shallow_frame", graphical_set = { base = { position = {17, 0}, corner_size = 8, center = {position = {411, 25}, size = {1, 1}}, draw_type = "outer" }, shadow = default_inner_shadow } } styles.rb_inside_deep_frame_under_tabs = { type = "frame_style", parent = "invisible_frame", graphical_set = { base = { center = {position = {42, 8}, size = {1, 1}}, top = {position = {93, 0}, size = {1, 8}}, draw_type = "outer" }, shadow = { top = {position = {191, 128}, size = {1, 8}}, tint = hard_shadow_color, scale = 0.5, draw_type = "inner" } } } -- LABEL STYLES styles.rb_hyperlink_label = { type = "label_style", -- parent = "hyperlink_label", font_color = {110, 179, 255}, hovered_font_color = {154, 250, 255}, } styles.rb_table_label = { type = "label_style", font = "default-semibold", horizontally_stretchable = "on" } styles.rb_toolbar_label = { type = "label_style", parent = "subheader_caption_label", -- left_padding = 4, horizontally_squashable = "on" } styles.rb_unresearched_toolbar_label = { type = "label_style", parent = "rb_toolbar_label", font_color = constants.colors.unresearched.tbl, } styles.rb_slot_label = { type = "label_style", parent = "count_label", height = 36, width = 35, vertical_align = "bottom", horizontal_align = "right", right_padding = 3 } styles.rb_slot_label_top = { type = "label_style", parent = "rb_slot_label", vertical_align = "top", top_padding = 3 } styles.rb_list_box_label = { type = "label_style", parent = "bold_label", bottom_padding = 2 } -- LINE STYLES styles.rb_dark_line = { type = "line_style", horizontally_stretchable = "on", left_margin = -8, right_margin = -8, top_margin = -2, bottom_margin = -2, border = { border_width = 8, horizontal_line = {filename = "__RecipeBook__/graphics/dark-line.png", size = {1, 8}} } } -- SCROLL PANE STYLES styles.rb_list_box_scroll_pane = { type = "scroll_pane_style", parent = "list_box_scroll_pane", graphical_set = { shadow = default_inner_shadow }, vertical_flow_style = { type = "vertical_flow_style", vertical_spacing = 0, horizontally_stretchable = "on" } } styles.rb_page_scroll_pane = { type = "scroll_pane_style", parent = "flib_naked_scroll_pane_no_padding", vertical_flow_style = { type = "vertical_flow_style", padding = 12, top_padding = 8, vertical_spacing = 8 } } styles.rb_search_results_scroll_pane = { type = "scroll_pane_style", parent = "rb_list_box_scroll_pane", vertically_stretchable = "on" -- height = 28 * constants.search_results_visible_items } -- styles.rb_settings_content_scroll_pane = { -- type = "scroll_pane_style", -- parent = "rb_naked_scroll_pane", -- vertical_flow_style = { -- type = "vertical_flow_style", -- padding = 4 -- } -- } -- TABLE STYLES styles.rb_info_table = { type = "table_style", parent = "mods_table", top_margin = -6, -- To hide the strange first row styling bottom_margin = 1, top_cell_padding = 1, bottom_cell_padding = 3, column_alignments = { {column = 1, alignment = "middle-left"}, {column = 2, alignment = "middle-right"}, } } -- TEXTFIELD STYLES styles.rb_search_textfield = { type = "textbox_style", parent = "flib_widthless_textfield", horizontally_stretchable = "on", } styles.rb_search_invalid_textfield = { type = "textbox_style", parent = "flib_widthless_invalid_textfield", horizontally_stretchable = "on", }
--AUTOCOMPLETE FOR IDEA DO NOT REMOVE OR REQUIRE ---@class DRAW_PIXELS drawpixels = {} ---Method for drawing circle: function drawpixels.circle(buffer_info, pox_x, pox_y, diameter, red, green, blue, alpha)end ---Method for drawing filled circle: function drawpixels.filled_circle(buffer_info, pos_x, pos_y, diameter, red, green, blue, alpha) end ---Method for drawing rectangle: function drawpixels.rect(buffer_info, pos_x, pos_y, rect_width, rect_height, red, green, blue, alpha) end ---Method for drawing filled rectangle: function drawpixels.filled_rect(buffer_info, pos_x, pos_y, rect_width, rect_height, red, green, blue, alpha, angle) end ---Fill buffer with the color: function drawpixels.fill(buffer_info, red, green, blue, alpha) end ---Draw a line between two points: function drawpixels.line(buffer_info, x0, y0, x1, y1, red, green, blue, alpha) end ---Draw a pixel: function drawpixels.pixel(buffer_info, x, y, red, green, blue, alpha) end ---Read color from a position in the buffer: function drawpixels.color(buffer_info, x, y) end return
local naughty = require("naughty") local xresources = require("beautiful.xresources") local dpi = xresources.apply_dpi local gears = require("gears") local theme_path = string.format("%s/.config/awesome/themes/%s/", os.getenv("HOME"), "something") local theme = {} ------------ -- colors -- ------------ theme.font = "SFMono Nerd Font 10" theme.font_medium = "SFMono Nerd Font 13" theme.font_big = "SFMono Nerd Font 15" theme.primary = "#11171d" theme.primary_dark = "#0c1115" theme.secondary = "#1d262d" theme.secondary_bright = "#1f2931" theme.foreground = "#a8a8a8" theme.foreground_dark = "#575064" theme.foreground_bright = "#ffffff" theme.red = "#8c6983" theme.green = "#828793" theme.yellow = "#888293" theme.blue = "#918795" theme.magenta = "#92a28e" theme.cyan = "#7d8f8c" theme.progress_bar_normal = theme.blue theme.progress_bar_off = theme.red theme.bg_normal = theme.primary theme.bg_focus = theme.secondary theme.bg_urgent = theme.red theme.bg_minimize = theme.primary_dark theme.bg_systray = theme.bg_normal theme.fg_normal = theme.foreground theme.fg_focus = theme.foreground_bright theme.fg_urgent = theme.foreground_bright theme.fg_minimize = theme.foreground theme.useless_gap = dpi(10) theme.border_width = 0 theme.border_normal = theme.secondary theme.border_focus = theme.secondary_bright theme.border_marked = theme.red theme.wibar_bg = theme.bg_normal theme.wibar_fg = theme.fg_normal theme.bg_systray = theme.secondary theme.systray_icon_spacing = dpi(12) theme.tag_non_empty = theme.foreground theme.tag_empty = theme.secondary theme.tag_ind = theme.secondary_bright theme.tag_hover = "#ffffff" theme.volume_color_normal = "#398a4e" theme.volume_color_high = "#8a395b" theme.volume_color_muted = "#353d45" ----------- -- bling -- ----------- theme.flash_focus_start_opacity = 0.8 theme_flash_focus_step = 0.1 theme.tag_preview_client_opacity = 1 theme.tag_preview_client_bg = theme.primary theme.tag_preview_widget_bg = theme.primary theme.tag_preview_widget_border_color = theme.secondary theme.tag_preview_client_border_color = theme.secondary theme.tag_preview_client_border_width = 0 theme.tag_preview_widget_border_width = 0 theme.tag_preview_widget_border_radius = 5 theme.tag_preview_client_border_radius = 5 ------------------- -- notifications -- ------------------- theme.notification_max_height = dpi(80) theme.notification_bg = theme.primary theme.notification_fg = theme.foreground naughty.config.padding = 20 naughty.config.spacing = 10 naughty.config.defaults.border_width = dpi(0) naughty.config.defaults.margin = 15 ----------------- -- other stuff -- ----------------- theme.menu_submenu_icon = theme_path.."submenu.png" theme.menu_height = dpi(28) theme.menu_width = dpi(180) theme.menu_font = theme.font theme.corner_radius = 10 theme.bar_corner_radius = 22 theme.wallpaper = theme_path.."background.png" theme.layout_fairh = theme_path.."layouts/fairhw.png" theme.layout_fairv = theme_path.."layouts/fairvw.png" theme.layout_floating = theme_path.."layouts/floatingw.png" theme.layout_magnifier = theme_path.."layouts/magnifierw.png" theme.layout_max = theme_path.."layouts/maxw.png" theme.layout_fullscreen = theme_path.."layouts/fullscreenw.png" theme.layout_tilebottom = theme_path.."layouts/tilebottomw.png" theme.layout_tileleft = theme_path.."layouts/tileleftw.png" theme.layout_tile = theme_path.."layouts/tilew.png" theme.layout_tiletop = theme_path.."layouts/tiletopw.png" theme.layout_spiral = theme_path.."layouts/spiralw.png" theme.layout_dwindle = theme_path.."layouts/dwindlew.png" theme.layout_cornernw = theme_path.."layouts/cornernww.png" theme.layout_cornerne = theme_path.."layouts/cornernew.png" theme.layout_cornersw = theme_path.."layouts/cornersww.png" theme.layout_cornerse = theme_path.."layouts/cornersew.png" return theme
-- @Author:pandayu -- @Version:1.0 -- @DateTime:2018-09-09 -- @Project:pandaCardServer CardGame -- @Contact: QQ:815099602 local model = require "game.model.role_model" local CTask = require "game.model.role.task" local config = require "game.template.task" local countMgr = require "game.model.countMgr" local timetool = require "include.timetool" local CMail = require "game.model.role.mail" local math_floor = math.floor local table_insert =table.insert local table_remove = table.remove local _M = model:extends() _M.class = "role.tasklist" _M.push_name = "tasklist" _M.changed_name_in_role = "tasklist" local cjson = require "include.cjson" _M.is_list = true _M.child_model = CTask _M.is_key_num = true function _M:__up_version() _M.super.__up_version(self) end function _M:on_time_up() self.tocs = self:init_tocs() end function _M:init_tocs() return {} end --[[function _M:init_tocs() local tocs = {} for id,task in pairs(self.data) do local proto = config:get(id) if proto and proto.type and proto.subtype then -- and not config:check_arry(tocs[proto.type],proto.subtype) --if task:get_status() ~= 3 then tocs[proto.type] = tocs[proto.type] or {}; table_insert(tocs[proto.type],proto.subtype) --end end end ngx.log(ngx.ERR,"tocs:",cjson.encode(tocs)) return tocs end]]-- function _M:init() --ngx.log(ngx.ERR,self.class,":22222222=:",self.push_name) self.triggerlist = {} self.chains = {} self.ids = {} for id,v in pairs(self.data) do local trigger_id = config:get_trigger_id(id) if trigger_id then self.triggerlist[trigger_id] = self.triggerlist[trigger_id] or {} table_insert(self.triggerlist[trigger_id],v) end local chain_id = config:get_chain_id(id) if chain_id and chain_id > 0 then self.chains[chain_id] = id end self.ids[id] = 1 end self:refresh() end function _M:get_client_data() local data = _M.super.get_client_data(self) data.p = self.tocs data.fundnum = countMgr:get_type_count(countMgr.type.fund) return data end function _M:add_tasks() local ids = config:get_ids(self.chains,self.ids) for i,id in ipairs(ids) do if not self.data[id] and config:check_condition(self.role,config:get_active_condition(id)) then self:append(id) end end end function _M:refresh() for id,task in pairs(self.data) do if task:failed() then if not config:is_task_end(id) then if not self:accept_next_task(task,id) then task:set_s(4) end else self:remove(id) end else local rs = task:trigger(0) if rs then self:accept_next_task(task,id) end end end self:add_tasks() local last_tocs = self.tocs self.tocs = self:init_tocs() if last_tocs ~= self.tocs then self:update_p(self.tocs) end local last_fundnum = self.fundnum self.fundnum = countMgr:get_type_count(countMgr.type.fund) if last_fundnum ~= self.fundnum then self:update_fundnum(self.fundnum) end end function _M:on_level_up() self:init() end function _M:on_vip_up() --self:refresh() end function _M:on_time_up() self:init() end function _M:update_p() end function _M:update_fundnum() end function _M:new_task(pid) return CTask:new(self.role,{p=pid,g=0,s=1},pid) end function _M:append(pid,ltime) self.max_id = self.max_id + 1 local task = self:new_task(pid,ltime) _M.super.append(self,pid,task) local trigger_id = config:get_trigger_id(pid) self.triggerlist[trigger_id] = self.triggerlist[trigger_id] or {} table_insert(self.triggerlist[trigger_id],task) local chain_id = config:get_chain_id(pid) if chain_id and chain_id >0 then self.chains[chain_id] = pid end self.ids[pid] = 1 task:trigger(0) end function _M:remove(id) local trigger_id = config:get_trigger_id(id) if self.triggerlist[trigger_id] then for k,v in ipairs(self.triggerlist[trigger_id]) do if v == id then table_remove(self.triggerlist[trigger_id],k) end end end local chain_id = config:get_chain_id(id) if chain_id then self.chains[chain_id] = nil end self.ids[id] = nil _M.super.remove(self,id) end function _M:finish(id) local task = self:get(id) if not task then return false end local profit,newtask = task:finish() if self.role and profit then self.role:gain_resource(profit) end self:accept_next_task(task,id,newtask) return true,profit end function _M:accept_next_task(task,id,newtask) local set_newtask =false if not newtask then newtask = config:get_next_task(id,task.data.g) end if newtask and newtask > 0 and config:check_condition(self.role,config:get_active_condition(newtask)) then if newtask == id then else self:remove(id) if math_floor(newtask / 1000) == config.total_pay_day then self:append(newtask,timetool:get_hour_time(0)) else self:append(newtask) end end set_newtask =true end return set_newtask end function _M:trigger(trigger_id,value,...) if not self.triggerlist[trigger_id] then return false end for id,task in ipairs(self.triggerlist[trigger_id]) do local rs = task:trigger(value,...) -- ngx.log(ngx.ERR,"trigger_id:",trigger_id," id:",id, "task.p",task.data.p) local task_id = task.data.p if rs then self:accept_next_task(task,task_id,newtask) elseif config:is_send_mail(task_id) and task:can_finish() then self:send_mail(task_id,task) end end end function _M:get_schedule(id) local task = self:get(id) if not task then return 0 end return task:get_schedule() end function _M:send_mail(id,task) local mail = { t = 1, s = 0, h = config:get_name(id) or "", c = config:get_des(id) or "", p = config:get_profit(id) or {}, } self.role:receive_mail(CMail:new(nil,mail)) local profit,newtask = task:finish() self:accept_next_task(task,id,newtask) if math_floor(id / 1000) == config.total_pay_day then self:trigger(config.trigger_type.pay_daynum,1) end end return _M
AddCSLuaFile() if CLIENT then SWEP.PrintName = "MP5" SWEP.Author = "DarkRP Developers" SWEP.Slot = 2 SWEP.SlotPos = 0 SWEP.IconLetter = "x" killicon.AddFont("weapon_mp52", "CSKillIcons", SWEP.IconLetter, Color(255, 80, 0, 255)) end SWEP.Base = "weapon_cs_base2" SWEP.Spawnable = true SWEP.AdminOnly = false SWEP.Category = "DarkRP (Weapon)" SWEP.ViewModel = "models/weapons/cstrike/c_smg_mp5.mdl" SWEP.WorldModel = "models/weapons/w_smg_mp5.mdl" SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.HoldType = "smg" SWEP.Primary.Sound = Sound("Weapon_MP5Navy.Single") SWEP.Primary.Recoil = 0.5 SWEP.Primary.Damage = 15 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.005 SWEP.Primary.ClipSize = 32 SWEP.Primary.Delay = 0.08 SWEP.Primary.DefaultClip = 32 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.IronSightsPos = Vector(-5.3, -7, 2.1) SWEP.IronSightsAng = Vector(0.9, 0.1, 0)
local _0_0 = nil do local name_23_0_ = "conjure.client.clojure.nrepl" local loaded_23_0_ = package.loaded[name_23_0_] local module_23_0_ = nil if ("table" == type(loaded_23_0_)) then module_23_0_ = loaded_23_0_ else module_23_0_ = {} end module_23_0_["aniseed/module"] = name_23_0_ module_23_0_["aniseed/locals"] = (module_23_0_["aniseed/locals"] or {}) module_23_0_["aniseed/local-fns"] = (module_23_0_["aniseed/local-fns"] or {}) package.loaded[name_23_0_] = module_23_0_ _0_0 = module_23_0_ end local function _1_(...) _0_0["aniseed/local-fns"] = {require = {a = "conjure.aniseed.core", action = "conjure.client.clojure.nrepl.action", bridge = "conjure.bridge", config = "conjure.client.clojure.nrepl.config", eval = "conjure.eval", mapping = "conjure.mapping", nvim = "conjure.aniseed.nvim", str = "conjure.aniseed.string"}} return {require("conjure.aniseed.core"), require("conjure.client.clojure.nrepl.action"), require("conjure.bridge"), require("conjure.client.clojure.nrepl.config"), require("conjure.eval"), require("conjure.mapping"), require("conjure.aniseed.nvim"), require("conjure.aniseed.string")} end local _2_ = _1_(...) local a = _2_[1] local action = _2_[2] local bridge = _2_[3] local config = _2_[4] local eval = _2_[5] local mapping = _2_[6] local nvim = _2_[7] local str = _2_[8] do local _ = ({nil, _0_0, nil})[2] end local buf_suffix = nil do local v_23_0_ = nil do local v_23_0_0 = ".cljc" _0_0["buf-suffix"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["buf-suffix"] = v_23_0_ buf_suffix = v_23_0_ end local comment_prefix = nil do local v_23_0_ = nil do local v_23_0_0 = "; " _0_0["comment-prefix"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["comment-prefix"] = v_23_0_ comment_prefix = v_23_0_ end local config0 = nil do local v_23_0_ = nil do local v_23_0_0 = config _0_0["config"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["config"] = v_23_0_ config0 = v_23_0_ end local context = nil do local v_23_0_ = nil do local v_23_0_0 = nil local function context0(header) local _3_0 = header if _3_0 then local _4_0 = string.match(_3_0, "%(%s*ns%s+(.-)%)") if _4_0 then local _5_0 = string.gsub(_4_0, "%^:.-%s+", "") if _5_0 then local _6_0 = string.gsub(_5_0, "%^%b{}%s+", "") if _6_0 then local _7_0 = str.split(_6_0, "%s+") if _7_0 then return a.first(_7_0) else return _7_0 end else return _6_0 end else return _5_0 end else return _4_0 end else return _3_0 end end v_23_0_0 = context0 _0_0["context"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["context"] = v_23_0_ context = v_23_0_ end local eval_file = nil do local v_23_0_ = nil do local v_23_0_0 = nil local function eval_file0(opts) return action["eval-file"](opts) end v_23_0_0 = eval_file0 _0_0["eval-file"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["eval-file"] = v_23_0_ eval_file = v_23_0_ end local eval_str = nil do local v_23_0_ = nil do local v_23_0_0 = nil local function eval_str0(opts) return action["eval-str"](opts) end v_23_0_0 = eval_str0 _0_0["eval-str"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["eval-str"] = v_23_0_ eval_str = v_23_0_ end local doc_str = nil do local v_23_0_ = nil do local v_23_0_0 = nil local function doc_str0(opts) return action["doc-str"](opts) end v_23_0_0 = doc_str0 _0_0["doc-str"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["doc-str"] = v_23_0_ doc_str = v_23_0_ end local def_str = nil do local v_23_0_ = nil do local v_23_0_0 = nil local function def_str0(opts) return action["def-str"](opts) end v_23_0_0 = def_str0 _0_0["def-str"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["def-str"] = v_23_0_ def_str = v_23_0_ end local completions = nil do local v_23_0_ = nil do local v_23_0_0 = nil local function completions0(opts) return action.completions(opts) end v_23_0_0 = completions0 _0_0["completions"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["completions"] = v_23_0_ completions = v_23_0_ end local on_filetype = nil do local v_23_0_ = nil do local v_23_0_0 = nil local function on_filetype0() mapping.buf("n", config0.mappings.disconnect, "conjure.client.clojure.nrepl.server", "disconnect") mapping.buf("n", config0.mappings["connect-port-file"], "conjure.client.clojure.nrepl.action", "connect-port-file") mapping.buf("n", config0.mappings.interrupt, "conjure.client.clojure.nrepl.action", "interrupt") mapping.buf("n", config0.mappings["last-exception"], "conjure.client.clojure.nrepl.action", "last-exception") mapping.buf("n", config0.mappings["result-1"], "conjure.client.clojure.nrepl.action", "result-1") mapping.buf("n", config0.mappings["result-2"], "conjure.client.clojure.nrepl.action", "result-2") mapping.buf("n", config0.mappings["result-3"], "conjure.client.clojure.nrepl.action", "result-3") mapping.buf("n", config0.mappings["view-source"], "conjure.client.clojure.nrepl.action", "view-source") mapping.buf("n", config0.mappings["session-clone"], "conjure.client.clojure.nrepl.action", "clone-current-session") mapping.buf("n", config0.mappings["session-fresh"], "conjure.client.clojure.nrepl.action", "clone-fresh-session") mapping.buf("n", config0.mappings["session-close"], "conjure.client.clojure.nrepl.action", "close-current-session") mapping.buf("n", config0.mappings["session-close-all"], "conjure.client.clojure.nrepl.action", "close-all-sessions") mapping.buf("n", config0.mappings["session-list"], "conjure.client.clojure.nrepl.action", "display-sessions") mapping.buf("n", config0.mappings["session-next"], "conjure.client.clojure.nrepl.action", "next-session") mapping.buf("n", config0.mappings["session-prev"], "conjure.client.clojure.nrepl.action", "prev-session") mapping.buf("n", config0.mappings["session-select"], "conjure.client.clojure.nrepl.action", "select-session-interactive") mapping.buf("n", config0.mappings["session-type"], "conjure.client.clojure.nrepl.action", "display-session-type") mapping.buf("n", config0.mappings["run-all-tests"], "conjure.client.clojure.nrepl.action", "run-all-tests") mapping.buf("n", config0.mappings["run-current-ns-tests"], "conjure.client.clojure.nrepl.action", "run-current-ns-tests") mapping.buf("n", config0.mappings["run-alternate-ns-tests"], "conjure.client.clojure.nrepl.action", "run-alternate-ns-tests") mapping.buf("n", config0.mappings["run-current-test"], "conjure.client.clojure.nrepl.action", "run-current-test") mapping.buf("n", config0.mappings["refresh-changed"], "conjure.client.clojure.nrepl.action", "refresh-changed") mapping.buf("n", config0.mappings["refresh-all"], "conjure.client.clojure.nrepl.action", "refresh-all") mapping.buf("n", config0.mappings["refresh-clear"], "conjure.client.clojure.nrepl.action", "refresh-clear") nvim.ex.command_("-nargs=+ -buffer ConjureConnect", bridge["viml->lua"]("conjure.client.clojure.nrepl.action", "connect-host-port", {args = "<f-args>"})) nvim.ex.command_("-nargs=1 -buffer ConjureShadowSelect", bridge["viml->lua"]("conjure.client.clojure.nrepl.action", "shadow-select", {args = "<f-args>"})) nvim.ex.command_("-nargs=1 -buffer ConjurePiggieback", bridge["viml->lua"]("conjure.client.clojure.nrepl.action", "piggieback", {args = "<f-args>"})) nvim.ex.command_("-nargs=0 -buffer ConjureOutSubscribe", bridge["viml->lua"]("conjure.client.clojure.nrepl.action", "out-subscribe", {})) nvim.ex.command_("-nargs=0 -buffer ConjureOutUnsubscribe", bridge["viml->lua"]("conjure.client.clojure.nrepl.action", "out-unsubscribe", {})) return action["passive-ns-require"]() end v_23_0_0 = on_filetype0 _0_0["on-filetype"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["on-filetype"] = v_23_0_ on_filetype = v_23_0_ end local on_load = nil do local v_23_0_ = nil do local v_23_0_0 = nil local function on_load0() nvim.ex.augroup("conjure_clojure_nrepl_cleanup") nvim.ex.autocmd_() nvim.ex.autocmd("VimLeavePre *", bridge["viml->lua"]("conjure.client.clojure.nrepl.server", "disconnect", {})) nvim.ex.augroup("END") return action["connect-port-file"]() end v_23_0_0 = on_load0 _0_0["on-load"] = v_23_0_0 v_23_0_ = v_23_0_0 end _0_0["aniseed/locals"]["on-load"] = v_23_0_ on_load = v_23_0_ end return nil
--the goal --[[spawn weather entity checker to instantly fall to ground to find a column to spawn snow in create table for snow to spawn when player enters new node spawn new entities create column of snow repeat when player goes out radius delete particlespawner ]] --radius of rain local rad = 7 weather = 2 local weather_table = {} local weather_particle_table = {} local weather_timer = 0 local update_timer = 0.25 local weather_change_timer = 0 local weather_change_goal = math.random(200,400) minetest.register_globalstep(function(dtime) if weather == 0 then return end weather_timer = weather_timer + dtime local update_weather = false if weather_timer > update_timer then weather_timer = 0 update_weather = true end weather_change_timer = weather_change_timer + dtime if weather_change_timer > weather_change_goal then weather_change_goal = math.random(200,400) weather = math.random(0,2) print("weather changed to "..weather) weather_change_timer = 0 end for _,player in ipairs(minetest.get_connected_players()) do --get center of node position local pos = vector.floor(vector.add(player:get_pos(),0.5)) local name = player:get_player_name() local test_table = {} --build an environment map upside down if update_weather == true then --or (weather_table[name] and not vector.equals(pos,weather_table[name])) then --clear particle spawners if weather_particle_table[name] and table.getn(weather_particle_table[name]) > 0 then for _,id in ipairs(weather_particle_table[name]) do --print("delete old pas") minetest.delete_particlespawner(id) end end weather_particle_table[name] = {} for x = -rad,rad do test_table[x] = {} for z = -rad,rad do test_table[x][z] = {} --set a high point local high = pos.y+rad --try to get the lowest point for y = rad,-rad,-1 do local ipos = vector.add(pos,vector.new(x,y,z)) --index position local light = minetest.get_node_light(ipos, 0.5) if light == 15 then --set a new low if the point if pos.y+y < high then --print("new y is "..y) test_table[x][z] = pos.y + y end else break end end end end end if table.getn(test_table) > 0 then --generate new table for particlspawener ids if not weather_particle_table[name] then weather_particle_table[name] = {} end for x = -rad,rad do for z = -rad,rad do if test_table and test_table[x] and test_table[x][z] and type(test_table[x][z]) == "number" then --create particle columns --print("THE LOW FOR X "..x.." Z "..z.." IS: "..test_table[x][z]) local id if weather == 1 then id = minetest.add_particlespawner({ amount = 1, time = 0, minpos = {x=pos.x+x-0.5,y=test_table[x][z],z=pos.z+z-0.5}, maxpos = {x=pos.x+x+0.5,y=pos.y+rad,z=pos.z+z+0.5}, minvel = {x=0, y=-25, z=0}, maxvel = {x=0, y=-25, z=0}, minacc = {x=0, y=0, z=0}, maxacc = {x=0, y=0, z=0}, minexptime = 1, maxexptime = 1, minsize = 4, maxsize = 6, collisiondetection = true, collision_removal = true, object_collision = true, vertical = true, texture = "rain.png", playername = name, }) elseif weather == 2 then id = minetest.add_particlespawner({ time = 0, amount = 1, minpos = {x=pos.x+x-0.5,y=test_table[x][z],z=pos.z+z-0.5}, maxpos = {x=pos.x+x+0.5,y=pos.y+rad,z=pos.z+z+0.5}, minvel = {x=0, y=-1, z=0}, maxvel = {x=0, y=-3, z=0}, minacc = {x=-1, y=0, z=-1}, maxacc = {x=1, y=0, z=1}, minexptime = 1, maxexptime = 2, minsize = 2, maxsize = 3, collisiondetection = true, collision_removal = true, object_collision = true, vertical = true, texture = "snow.png", playername = name, }) end table.insert(weather_particle_table[name],id) end end end end --store the table weather_table[name] = pos end end) --a hook for other mods to use function delete_weather_particle_spawners() --delete particle spawners for _,player in ipairs(minetest.get_connected_players()) do local name = player:get_player_name() if weather_particle_table[name] and table.getn(weather_particle_table[name]) > 0 then for _,id in ipairs(weather_particle_table[name]) do minetest.delete_particlespawner(id) end end weather_particle_table[name] = {} end end
local socket = require "levent.socket" local levent = require "levent.levent" local seri = require "levent.tpseri" local dns = require "levent.dns" local mt = {} mt.__index = mt BUFLEN = 4096 mt.get_base_header = function(self) local start_pos, end_pos while true do self.client_buffer = self.client_buffer .. self.client:recv(BUFLEN) start_pos, end_pos = self.client_buffer:find("\n") if start_pos then break end end base_header = self.client_buffer:sub(1, start_pos) local result = {} for i in string.gmatch(base_header, "%S+") do table.insert(result, i) end self.client_buffer = self.client_buffer:sub(start_pos + 1, -1) return table.unpack(result) end mt.connect_target = function(self, host) local i = host:find(":") local port if not i then port = 80 else host = host:sub(1, i) port = tonumber(host:sub(i,-1)) end local ips, err = dns.resolve(host) local ip = ips[1] self.target, err = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.target:connect(ip, port) end mt.method_CONNECT = function(self) print("enter method connect") self.path = self.path:sub(8, -1) local i = self.path:find("/") local host = self.path:sub(1, i - 1) local path = self.path:sub(i, -1) self:connect_target(host) self.target:sendall("HTTP/1.1 200 Connection established\n Proxy-agent: 0.0.1\n\n") self.client_buffer = "" self:flush_two_socket() end mt.keep_request = function(self) print("keep request") while true do local req, err = self.client:recv(BUFLEN) if req and #req > 0 then self.target:sendall(req) else break end end end mt.keep_resp = function(self) print("keep resp") while true do local resp, err = self.target:recv(BUFLEN) if resp and #resp > 0 then self.client:sendall(resp) else break end end end mt.flush_two_socket = function(self) levent.spawn(self.keep_resp, self) levent.spawn(self.keep_request, self) levent.sleep(1) end mt.method_others = function(self) self.path = self.path:sub(8, -1) local i = self.path:find("/") local host = self.path:sub(1, i - 1) local path = self.path:sub(i, -1) self:connect_target(host) local first_data = string.format("%s %s %s\r\n", self.method, path, self.protocol)..self.client_buffer print(string.format("%q", first_data)) self.target:sendall(first_data) self:flush_two_socket() end local other_method = { OPTIONS=1, GET = 1, HEAD = 1, POST=1, PUT=1, DELETE=1, TRACE=1, } mt.handle = function(self, csock) self.client = csock self.client_buffer = "" self.timeout = timeout self.method, self.path, self.protocol = self:get_base_header() print(self.method, self.path, self.protocol) if self.method == "CONNECT" then self:method_CONNECT() elseif other_method[self.method] then self:method_others() end self.client:close() self.target:close() print("close all socket") end local sock, err = socket.socket(socket.AF_INET, socket.SOCK_STREAM) assert(sock, errmsg) print("bind:", sock:bind("0.0.0.0", 8858)) print("listen:", sock:listen()) function start_server() while true do local csock, err = sock:accept() if not csock then print("accept failed:", err) break end print("new conn from:", csock:getpeername()) local a = {} setmetatable(a, mt) levent.spawn(a.handle, a, csock) end end levent.start(start_server)
---@class ItemBoostGroup local ItemBoostGroup = { ID = "", Entries = {}, Limit = -1, Applied = 0, Chance = 100, Type = "ItemBoostGroup" } ItemBoostGroup.__index = ItemBoostGroup ---@param boost ItemBoost ---@param vars table local function SetVars(boost, vars) if vars ~= nil then if vars.Limit ~= nil then boost.Limit = vars.Limit end if vars.Chance ~= nil then boost.Chance = vars.Chance end end end ---@param id string ---@param entries table ---@param vars table|nil ---@return ItemBoostGroup function ItemBoostGroup:Create(id, entries, vars) local this = { ID = id, Entries = entries, } setmetatable(this, self) SetVars(this, vars) return this end ---@type ItemBoostGroup Classes.ItemBoostGroup = ItemBoostGroup local function PropertyMatch(itemBoostProp, prop) if itemBoostProp == nil or itemBoostProp == "" then return true else return itemBoostProp == prop end end ---@param itemBoost ItemBoost ---@param stat string ---@param statType string local function CanAddBoost(itemBoost,stat,statType) if itemBoost.Limit > 0 and itemBoost.Applied >= itemBoost.Limit then return false end if itemBoost.ObjectCategories ~= nil then local objectCategory = Ext.StatGetAttribute(stat, "ObjectCategory") if itemBoost.ObjectCategories[objectCategory] ~= true then return false end end if statType == "Weapon" then local weaponType = Ext.StatGetAttribute(stat, "WeaponType") if itemBoost.WeaponType ~= "" then if weaponType == itemBoost.WeaponType then if itemBoost.TwoHanded ~= nil then local isTwoHanded = Ext.StatGetAttribute(stat, "IsTwoHanded") if isTwoHanded == "Yes" and itemBoost.TwoHanded == true then return true else return false end else return true end else return false end elseif itemBoost.BlockWeaponTypes ~= nil and itemBoost.BlockWeaponTypes[weaponType] == true then return false elseif itemBoost.TwoHanded ~= nil then local isTwoHanded = Ext.StatGetAttribute(stat, "IsTwoHanded") if isTwoHanded == "Yes" and itemBoost.TwoHanded == true then return true else return false end end end if PropertyMatch(itemBoost.StatType, statType) then if itemBoost.SlotType ~= "" then local slot = Ext.StatGetAttribute(stat, "Slot") if itemBoost.SlotType == slot or itemBoost.SlotType == "Ring" and slot == "Ring2" then return true else return false end end end return true end ---@param itemBoost ItemBoost local function RollForBoost(itemBoost) if itemBoost.Chance < 100 and itemBoost.Chance > 0 then local roll = Ext.Random(1,100) if roll <= itemBoost.Chance then return true end elseif itemBoost.Chance >= 100 then return true end return false end function ItemBoostGroup:ResetApplied() for i,v in pairs(self.Entries) do v.Applied = 0 end end ---@param totalEntries integer ---@return ItemBoost[] function ItemBoostGroup:GetRandomEntries(totalEntries) local ranEntries = {} local shuffled = LeaderLib.Common.ShuffleTable(self.Entries) local total = 0 while total < totalEntries do local entry = LeaderLib.Common.GetRandomTableEntry(shuffled) table.insert(ranEntries, entry) total = total + 1 end return ranEntries end ---@param item string ---@param stat string ---@param statType string ---@param level integer ---@param mod number ---@param noRandomization boolean ---@param limit integer|nil ---@param minAmount integer|nil ---@return ItemBoostGroup function ItemBoostGroup:Apply(item,stat,statType,level,mod,noRandomization,limit,minAmount) if limit == nil then if self.Limit > 0 then limit = self.Limit else limit = 0 end end if minAmount == nil then minAmount = 0 end if limit > 0 and self.Applied >= limit then self.Applied = 0 return limit end if self.Chance < 100 and self.Chance > 0 then local roll = Ext.Random(1,100) if roll > self.Chance then return 0 end end local totalApplied = 0 if #self.Entries > 0 then --LeaderLib.PrintDebug("Applying boosts from group: " .. tostring(self.ID) .. " | Total: " .. tostring(#self.Entries)) if noRandomization == true then for i,v in pairs(self.Entries) do if limit > 0 and totalApplied >= limit then self:ResetApplied() return totalApplied end if CanAddBoost(v, stat, statType) then if v.MinLevel <= 0 and v.MaxLevel <= 0 then v:Apply(item,mod) totalApplied = totalApplied + 1 elseif level >= v.MinLevel and (level <= v.MaxLevel or v.MaxLevel <= 0) then v:Apply(item,mod) totalApplied = totalApplied + 1 end end end else if minAmount > 0 then local validEntries = {} for i,v in pairs(self.Entries) do if CanAddBoost(v, stat, statType) then if v.MinLevel <= 0 and v.MaxLevel <= 0 or (level >= v.MinLevel and (level <= v.MaxLevel or v.MaxLevel <= 0)) then table.insert(validEntries, v) end end end if #validEntries > 1 then local loopLimit = 0 while totalApplied < minAmount and loopLimit < 50 do if (limit > 0 and totalApplied >= limit) or #validEntries == 0 then self:ResetApplied() return totalApplied end ---@type ItemBoost local entry = LeaderLib.Common.GetRandomTableEntry(validEntries) if CanAddBoost(entry, stat, statType) then if entry.MinLevel <= 0 and entry.MaxLevel <= 0 or (level >= entry.MinLevel and (level <= entry.MaxLevel or entry.MaxLevel <= 0)) then if RollForBoost(entry) then entry:Apply(item,mod) totalApplied = totalApplied + 1 if entry.Applied >= entry.Limit then local index = 1 for i,v in ipairs(validEntries) do if v == entry then index = i break end end table.remove(validEntries, index) end end end end loopLimit = loopLimit + 1 end elseif #validEntries == 1 then local entry = validEntries[1] if RollForBoost(entry) then entry:Apply(item,mod) totalApplied = totalApplied + 1 end else self:ResetApplied() return totalApplied end else for i,v in pairs(self.Entries) do if limit > 0 and totalApplied >= limit then self:ResetApplied() return totalApplied end if CanAddBoost(v, stat, statType) then if v.MinLevel <= 0 and v.MaxLevel <= 0 or (level >= v.MinLevel and (level <= v.MaxLevel or v.MaxLevel <= 0)) then if RollForBoost(v) then v:Apply(item,mod) totalApplied = totalApplied + 1 end end end end end end if totalApplied == 0 then local shuffled = LeaderLib.Common.ShuffleTable(self.Entries) for i,v in pairs(shuffled) do if CanAddBoost(v, stat, statType) then if v.MinLevel <= 0 and v.MaxLevel <= 0 or (level >= v.MinLevel and (level <= v.MaxLevel or v.MaxLevel <= 0)) then v:Apply(item,mod) totalApplied = totalApplied + 1 self:ResetApplied() return totalApplied end end end end end self:ResetApplied() return totalApplied end
--[[ This file is a general memory stream interface. The primary objective is to satisfy the needs of the truetype parser, but it can be used in general cases. It differs from the MemoryStream object in that it can't write, and it has more specific data type reading convenience calls. More specifically, all of the numeric reading assumes the data in the stream is formatted in 'big-endian' order. That is, the high order bytes come first. ]] local ffi = require("ffi") local bit = require("bit") local bor, lshift = bit.bor, bit.lshift local min = math.min --[[ Standard 'object' construct. __call is implemented so we get a 'constructor' sort of feel: binstream(data, size, position) ]] local binstream = { bigend = true; } setmetatable(binstream, { __call = function(self, ...) return self:new(...) end, }) local binstream_mt = { __index = binstream; } function binstream.init(self, data, size, position, littleendian) position = position or 0 --print("SIZE: ", data, size, position, littleendian) assert(size > 0); local obj = { bigend = not littleendian; data = ffi.cast("uint8_t *", data); size = tonumber(size); cursor = tonumber(position); lineCount = 1; } setmetatable(obj, binstream_mt) return obj end function binstream.new(self, data, size, position, littleendian) return self:init(data, size, position, littleendian); end -- get a subrange of the memory stream -- returning a new memory stream function binstream.range(self, size, pos) pos = pos or self.cursor; if pos < 0 or size < 0 then return false, "pos or size < 0" end if pos > self.size then return false, "pos > self.size" end if ((size > (self.size - pos))) then return false, "size is greater than remainder"; end return binstream(self.data+pos, size, 0 , not self.bigend) end -- report how many bytes remain to be read -- from stream function binstream.remaining(self) --return tonumber(self.size - self.cursor) return self.size - self.cursor end function binstream.isEOF(self) return self:remaining() < 1 end function binstream.getLine(self) return self.lineCount; end function binstream.incrementLineCount(self, n) n = n or 1; self.lineCount = self.lineCount + n; end -- move to a particular position, in bytes function binstream.seek(self, pos) -- if position specified outside of range -- just set it past end of stream if (pos > self.size) or (pos < 0) then self.cursor = self.size return false, self.cursor; else self.cursor = pos; end return true; end -- Report the current cursor position. function binstream.tell(self) return self.cursor; end binstream.getPosition = binstream.tell; -- move the cursor ahead by the amount -- specified in the offset -- seek, relative to current position function binstream.skip(self, offset) offset = offset or 1; return self:seek(self.cursor + offset); end -- Seek forward to an even numbered byte boundary -- This could be expanded to seek to next highest -- alignment, based on any number, defaulting to 2 function binstream.skipToEven(self) self:skip(self.cursor % 2); end function binstream.alignTo(self, num) self:skip(self.cursor % num) end function binstream.getPositionPointer(self) return self.data + self.cursor; end -- get 8 bits, and don't advance the cursor function binstream.peekOctet(self, offset) offset = offset or 0 if (self.cursor+offset >= self.size) then return -1; end return self.data[self.cursor+offset]; end -- get 8 bits, and advance the cursor function binstream.readOctet(self) -- check to ensure we don't go beyond end if (self.cursor >= self.size) then return false, "EOF"; end self.cursor = self.cursor + 1; return self.data[self.cursor-1] end -- A pure functional iterator of the octets -- in the stream. -- The stream is not affected by subsequent calls -- to the iterator. -- The iterator can be started at any given offset -- indicated by the initial 'state' function binstream.octets(self, state) state = state or 0 local function octet_gen(params, state) --print("STATE: ", state) -- check to see if we've reach end of stream if params.size - state < 1 then return nil; end return state+1, params.data[state] end return octet_gen, self, state end -- Read an integer value -- The parameter 'n' determines how many bytes to read. -- 'n' can be up to 8 -- The routine will deal with big or little endian function binstream.read(self, n) local v = 0; local i = 0; if self:remaining() < n then return false, "NOT ENOUGH DATA AVAILABLE" end if self.bigend then while (i < n) do local octet = self:readOctet() v = bor(lshift(v, 8), octet); i = i + 1; end else while (i < n) do v = bor(v, lshift(self:readOctet(), 8*i)); i = i + 1; end end return v; end -- BUGBUG, do error checking against end of stream function binstream.readBytes(self, n, bytes) if n < 1 then return false, "must specify more then 0 bytes" end -- see how many bytes are remaining to be read local nActual = min(n, self:remaining()) -- read the minimum between remaining and 'n' bytes = bytes or ffi.new("uint8_t[?]", nActual) ffi.copy(bytes, self.data+self.cursor, nActual) self:skip(nActual) -- if minimum is less than n, return false, and the number -- actually read if nActual < n then return false, nActual; end return bytes, nActual; end -- Read bytes and turn into a Lua string -- Read up to 'n' bytes, or up to a '\0' if -- 'n' is not specified. function binstream.readString(self, n) local str = nil; --print("BS: ", self:remaining()) if self:isEOF() then return false, "EOF" end if not n then -- read to null terminator str = ffi.string(self.data+self.cursor) --print("binstream, STR: ", str) self.cursor = self.cursor + #str + 1; else -- read a specific number of bytes, turn into Lua string str = ffi.string(self.data+self.cursor, n) self.cursor = self.cursor + n; end return str; end function binstream.readNumber(self, n) return tonumber(self:read(n)); end -- Read 8-bit signed integer function binstream.readInt8(self) return tonumber(ffi.cast('int8_t', self:read(1))) end -- Read 8-bit unsigned integer function binstream.readUInt8(self) return tonumber(ffi.cast('uint8_t', self:read(1))) end -- Read 16-bit signed integer function binstream.readInt16(self) return tonumber(ffi.cast('int16_t', self:read(2))) end -- Read 16-bit unsigned integer function binstream.readUInt16(self) return tonumber(ffi.cast('uint16_t', self:read(2))) end -- Read Signed 32-bit integer function binstream.readInt32(self) return tonumber(ffi.cast('int32_t', self:read(4))) end -- Read unsigned 32-bit integer function binstream.readUInt32(self) return tonumber(ffi.cast('uint32_t', self:read(4))) end -- Read signed 64-bit integer function binstream.readInt64(self) return tonumber(ffi.cast('int64_t', self:read(8))) end -- Read unsigned 64-bit integer -- we don't convert to a lua number because those -- can't actually represent the full range of a 64-bit integer function binstream.readUInt64(self) local v = 0ULL; --ffi.cast("uint64_t", 0); local i = 0; if self.bigend then while (i < 8) do v = bor(lshift(v, 8), self:readOctet()); i = i + 1; end else while (i < 8) do local byte = ffi.cast("uint64_t",self:readOctet()); local shifted = lshift(byte, 8*i) v = bor(v, lshift(byte, 8*i)); i = i + 1; end end return v; end --[[ Writing to a binary stream ]] function binstream.writeOctet(self, octet) if (self.cursor >= self.size) then return false, "EOF"; end self.data[self.cursor] = octet; self.cursor = self.cursor + 1; return true; end function binstream.writeInt(self, value, n) if self:remaining() < n then return false, "NOT ENOUGH DATA AVAILABLE" end if self.bigend then local i = n-1; while (i >= 0) do self:writeOctet(band(rshift(value,i*8), 0xff)) i = i - 1; end else local i = 0; while (i < n) do self:writeOctet(band(rshift(value,i*8), 0xff)) i = i + 1; end end return v; end function binstream.writeBytes(self, bytes, n) n = n or #bytes if n > self:remaining() then return false, "Not enough space" end ffi.copy(self.data+self.cursor, ffi.cast("const char *", bytes, n)) self:skip(n) return true; end function binstream.writeString(self, str) return self:writeBytes(str) end function binstream.writeInt8(self, n) return self:writeInt(n, 1); end function binstream.writeUInt8(self, n) return self:writeInt(ffi.cast("uint8_t",n), 1) end function binstream.writeInt16(self, n) return self:writeInt(ffi.cast("int16_t",n), 2); end function binstream.writeUint16(self, n) return self:writeInt(ffi.cast("uint16_t",n), 2); end function binstream.writeInt32(self, n) return self:writeInt(ffi.cast("int32_t",n), 4); end function binstream.writeUInt32(self, n) return self:writeInt(ffi.cast("uint32_t",n), 4); end function binstream.writeInt64(self, n) return self:writeInt(ffi.cast("int64_t",n), 8); end function binstream.writeUInt64(self, n) return self:writeInt(ffi.cast("uint64_t",n), 8); end -- Some various fixed formats function binstream.readFixed(self) local decimal = self:readInt16(); local fraction = self:readUInt16(); return decimal + fraction / 65535; end function binstream.readF2Dot14(self) return self:readInt16() / 16384; end -- Convenient types named in the documentation binstream.readFWord = binstream.readInt16; binstream.readUFWord = binstream.readUInt16; binstream.readOffset16 = binstream.readUInt16; binstream.readOffset32 = binstream.readUInt32; binstream.readWORD = binstream.readUInt16; binstream.readDWORD = binstream.readUInt32; binstream.readBYTE = binstream.readOctet; return binstream
log = {}; function log.format(...) local s = ""; local first = true; for _, v in pairs({...}) do if first then s = tostring(v); first = false; else s = s .. " " .. tostring(v); end end return s; end function log.critical(...) obe.Debug.critical(log.format(...)); end function log.error(...) obe.Debug.error(log.format(...)); end function log.warn(...) obe.Debug.warn(log.format(...)); end function log.info(...) obe.Debug.info(log.format(...)); end function log.debug(...) obe.Debug.debug(log.format(...)); end function log.trace(...) obe.Debug.trace(log.format(...)); end -- print = log.debug;
local _=BaseEntity.new("help_screen",true) _.active=false _.drawUnscaledUi=function() local message="F12 - debugger" love.graphics.print("Help:", 0, 80) love.graphics.print(message, 0, 100) end return _
local cutils = require 'libcutils' local cVector = require 'libvctr' local basic_serialize = require 'Q/UTILS/lua/basic_serialize' local should_save = require 'Q/UTILS/lua/should_save' -- TODO Indrajeet make 2 args, one is name of table, other is filename -- function internal_save(name, value, saved) local function internal_save( name, value, Tsaved, fp ) if not should_save(name, value) then return end assert(type(Tsaved) == "table") if ( ( type(value) == "number" ) or ( type(value) == "string" ) or ( type(value) == "boolean" ) ) then fp:write(name, " = ") fp:write(basic_serialize(value), "\n") elseif type(value) == "table" then local tbl = value fp:write(name, " = ") if Tsaved[tbl] then -- value already saved? fp:write(Tsaved[tbl], "\n") -- use its previous name else Tsaved[tbl] = name -- save name for next time fp:write("{}\n") -- create a new table for k, v in pairs(tbl) do -- save its fields local fieldname = string.format("%s[%s]", name, basic_serialize(k)) internal_save(fieldname, v, Tsaved, fp) end end elseif ( type(value) == "lVector" ) then local vec = value vec:eov() -- Debatable whether we should do this or not local reincarnate_str = vec:shutdown() if ( reincarnate_str ) then assert(type(reincarnate_str) == "string") local y = loadstring(reincarnate_str)() assert(type(y) == "table") y = string.gsub(reincarnate_str, "return ", "" ) fp:write(name, " = lVector ( ", y, " ) " ) fp:write("\n") print(y) --=========================== --TODO internal_save(name .. "._meta", vec._meta, Tsaved, fp) fp:write(name .. ":persist(true)") fp:write("\n") else print("Not saving lVector because eov=false or is_memo=false ", name) end elseif ( type(value) == "Scalar" ) then local sclr = value local scalar_str = sclr:reincarnate() assert(type(scalar_str) == "string") fp:write(name .. " = " .. scalar_str) fp:write("\n") elseif ( type(value) == "lAggregator" ) then print("Serialization of Aggregators not supported as yet"); -- TODO P2 elseif ( type(value) == "lDNN" ) then print("Serialization of DNNs not supported as yet"); -- TODO P2 else error("cannot save " .. name .. " of type " .. type(value)) end end local function save() local data_dir = cVector.get_globals("data_dir") assert(cutils.isdir(data_dir)) local meta_file = data_dir .. "/q_meta.lua" -- note .lua suffix local aux_file = data_dir .. "/q_aux.lua" if cutils.isfile(meta_file) or cutils.isfile(aux_file) then print("Warning! Over-writing meta data file ", meta_file) print("Warning! Over-writing aux data file ", aux_file) cutils.delete(meta_file) cutils.delete(aux_file) end print("Writing to ", meta_file, aux_file) --================================================ local fp = assert(io.open(aux_file, "w+")) local str = string.format( "local T = {}; T.max_file_num = %s; return T", cVector.get_globals("max_file_num")) fp:write(str) fp:close() --================================================ fp = assert(io.open(meta_file, "w+")) fp:write("local lVector = require 'Q/RUNTIME/VCTR/lua/lVector'\n") fp:write("local cVector = require 'libvctr'\n") fp:write("local Scalar = require 'libsclr'\n") fp:write("local cmem = require 'libcmem'\n") fp:write("local cmem = require 'libcutils'\n") -- saved is a table that keeps track of things we have already saved -- so that we don't save them a second time around -- TODO But why exactly is it needed? local Tsaved = {} -- For all globals, for k, v in pairs(_G) do internal_save(k, v, Tsaved, fp); -- print("Saving ", k, v) end fp:close() print("Saved to " .. meta_file) return meta_file end return require('Q/q_export').export('save', save)
keyCodes = {[0] = "leftMouse", [1] = "middleMouse", [2] = "rightMouse", [13] = "enter", [276] = "left", [273] = "up", [275] = "right", [274] = "down", [304] = "shift", [32] = "space", [8] = "backspace", [303] = "shift", [301] = "capslock"} shiftKeyCodes = {[39] = "\"",[44] = "<",[45] = "_",[46] = ">",[47] = "?",[48] = ")", [49] = "!",[50] = "@",[51] = "#", [52] = "$",[53] = "%", [54] = "^", [55] = "&",[56] = "*",[57] = "(", [59] = ":", [61] = "+", [91] = "{", [92] = "|", [93] = "}", [96] = "~"} undoTips = { ["framePress"]="Cycle Selected Frame", ["backingPress"]="Cycle Selected Backing", ["restoreFrame"]="Reverse Changes to Frame", ["restoreSignPixels"]="Reverse Dump", ["removeFrame"]="Remove New Frame", ["insertFrame"]="Restore Deleted Frame", ["restoreIcon"]="Reverse Icon Change", ["reverseStroke"]="Undo Stroke", ["restoreColor"]="Restore Color", ["restoreFromTemplate"]="Reverse Template Load" } toolTips = { ["framePress"]="Cycle through possible frame colors", ["backingRight"]="Select next backing type", ["backingLeft"]="Select previous backing type", ["frameRight"]="Move to next animation frame", ["frameLeft"]="Move to previous animation frame", ["shiftRight"]="Shift current animation frame right one pixel (bleed is lost)", ["shiftLeft"]="Shift current animation frame left one pixel (bleed is lost)", ["shiftDown"]="Shift current animation frame down one pixel (bleed is lost)", ["shiftUp"]="Shift current animation frame up one pixel (bleed is lost)", ["clearPress"]="Clear current animation frame", ["isWired"]="Toggle if this sign will be wired. Frame #1 will be used as an 'off' frame.", ["dumpPress"] = "Clear and remove all animation frames", ["frameAdd"] = "Add a new animation frame (copies current to end)", ["frameDelete"] = "Remove current animation frame", ["printPress"]="Print a copy of this sign to the sign dispenser", ["iconGrab"]="Update the current inventory icon", ["spectrumPress"]="Select a new paint color", ["spectrumClose"]="Close color selector window", ["pickToggle"]="Select \"Color Selector\" mode. Turns off after use", ["fillToggle"]="Toggle \"Fill\" mode", ["colorInput"]="Bring up the color selection window", ["nameInput"] = "Enter new sign name", ["alphaInput"]="Manually enter new paint color alpha", ["alphaSlider"]="Adjust paint color alpha", ["lightSelect"]="Set the color of light this sign will give off" } spectrumRGBTable = {{{234, 216, 216},{255, 221, 220},{246, 204, 203},{245, 196, 194},{246, 186, 187},{246, 178, 179},{246, 170, 169},{245, 162, 161},{245, 154, 153},{245, 145, 144},{245, 136, 134},{246, 128, 126},{245, 120, 118},{244, 111, 110},{245, 103, 101},{245, 94, 93},{246, 86, 85},{245, 78, 75},{245, 70, 68},{245, 62, 61},{245, 52, 50},{245, 44, 42},{245, 35, 33},{244, 27, 24},{244, 18, 16},{246, 9, 8},{244, 5, 4},{234, 5, 4},{225, 6, 4},{217, 6, 4},{209, 5, 4},{201, 4, 4},{192, 5, 5},{184, 5, 5},{176, 5, 4},{167, 5, 4},{158, 5, 4},{151, 4, 5},{142, 5, 4},{135, 5, 4},{126, 5, 5},{119, 5, 4},{110, 4, 4},{100, 4, 4},{92, 5, 4},{84, 4, 4},{77, 5, 5},{68, 4, 5},{60, 4, 4},{51, 4, 4},{43, 4, 4},{35, 5, 4},{26, 5, 4},{13, 0, 0},{13, 8, 8}},{{247, 234, 231},{255, 240, 237},{255, 219, 218},{255, 211, 208},{255, 201, 199},{255, 191, 190},{255, 183, 178},{255, 174, 171},{255, 164, 161},{255, 154, 151},{255, 145, 140},{255, 136, 130},{255, 128, 123},{255, 118, 113},{255, 109, 102},{255, 99, 94},{255, 90, 85},{255, 81, 75},{255, 72, 66},{255, 63, 57},{255, 53, 46},{255, 45, 38},{255, 34, 28},{255, 25, 18},{255, 17, 8},{255, 7, 0},{255, 1, 0},{253, 2, 0},{242, 2, 0},{232, 1, 0},{225, 0, 0},{214, 0, 0},{205, 0, 0},{196, 0, 0},{187, 0, 0},{177, 0, 0},{168, 0, 0},{159, 0, 0},{148, 0, 0},{140, 0, 0},{131, 0, 0},{123, 0, 0},{113, 0, 0},{103, 0, 0},{94, 0, 0},{85, 0, 0},{75, 0, 0},{65, 0, 0},{57, 0, 0},{47, 0, 0},{37, 0, 0},{28, 0, 0},{18, 0, 0},{4, 0, 0},{4, 4, 4}},{{243, 224, 222},{255, 230, 227},{254, 212, 210},{253, 204, 200},{254, 195, 192},{254, 187, 181},{253, 179, 172},{253, 171, 164},{254, 162, 155},{254, 153, 147},{254, 146, 137},{254, 136, 127},{253, 129, 120},{253, 120, 110},{253, 112, 102},{254, 103, 93},{253, 96, 85},{253, 86, 76},{253, 78, 66},{252, 71, 56},{252, 60, 48},{253, 53, 40},{254, 43, 31},{252, 36, 22},{254, 28, 12},{253, 18, 3},{250, 13, 0},{242, 13, 0},{233, 13, 0},{224, 13, 0},{216, 12, 0},{206, 11, 0},{197, 12, 0},{189, 11, 0},{180, 10, 0},{171, 10, 0},{161, 10, 0},{154, 8, 0},{144, 8, 0},{136, 7, 0},{128, 6, 0},{120, 6, 0},{112, 6, 0},{101, 6, 0},{93, 6, 0},{85, 6, 0},{76, 3, 0},{65, 4, 0},{57, 4, 0},{48, 3, 0},{40, 2, 0},{33, 2, 0},{22, 2, 0},{8, 0, 0},{8, 5, 4}},{{243, 224, 223},{255, 232, 227},{254, 214, 211},{253, 206, 201},{254, 197, 192},{254, 189, 180},{253, 180, 172},{254, 174, 165},{253, 165, 155},{254, 156, 147},{254, 149, 137},{255, 140, 130},{252, 132, 120},{253, 123, 110},{253, 116, 103},{254, 108, 93},{253, 99, 84},{253, 90, 75},{254, 83, 66},{252, 75, 57},{252, 65, 48},{252, 58, 40},{253, 48, 31},{253, 41, 22},{253, 33, 14},{253, 23, 4},{251, 18, 0},{242, 19, 0},{233, 19, 0},{224, 19, 0},{216, 17, 0},{207, 16, 0},{197, 16, 0},{188, 16, 0},{181, 15, 0},{172, 14, 0},{161, 13, 0},{153, 12, 0},{144, 12, 0},{137, 11, 0},{129, 10, 0},{120, 10, 0},{110, 9, 0},{100, 9, 0},{93, 8, 0},{85, 7, 0},{75, 6, 0},{65, 6, 0},{56, 5, 0},{47, 4, 0},{39, 3, 0},{31, 4, 0},{21, 4, 0},{7, 0, 0},{7, 5, 4}},{{243, 226, 223},{255, 233, 227},{254, 214, 208},{253, 207, 201},{254, 199, 193},{254, 191, 183},{253, 182, 173},{253, 175, 166},{253, 167, 156},{255, 158, 145},{255, 151, 137},{254, 143, 129},{253, 135, 118},{253, 127, 112},{253, 118, 102},{254, 111, 94},{254, 102, 85},{253, 94, 75},{254, 87, 68},{253, 79, 59},{254, 71, 50},{254, 63, 41},{253, 55, 30},{253, 47, 22},{253, 38, 12},{254, 29, 3},{252, 24, 0},{243, 24, 0},{233, 23, 0},{224, 23, 0},{216, 22, 0},{208, 21, 1},{198, 20, 0},{189, 19, 0},{180, 18, 0},{171, 18, 0},{162, 16, 0},{154, 15, 0},{146, 14, 0},{136, 13, 0},{128, 13, 0},{119, 12, 0},{111, 11, 0},{100, 11, 0},{93, 9, 0},{84, 9, 0},{75, 8, 0},{67, 7, 0},{57, 6, 0},{48, 5, 0},{41, 4, 0},{30, 3, 0},{21, 2, 0},{8, 0, 0},{7, 5, 4}},{{244, 227, 223},{255, 234, 227},{253, 215, 208},{253, 208, 201},{254, 201, 192},{254, 193, 183},{254, 184, 174},{254, 176, 165},{253, 168, 156},{254, 161, 145},{254, 154, 138},{255, 146, 130},{254, 138, 119},{253, 130, 111},{253, 122, 102},{253, 114, 95},{253, 107, 85},{254, 99, 75},{253, 91, 67},{253, 83, 60},{254, 74, 50},{254, 67, 41},{253, 60, 31},{253, 52, 22},{253, 43, 13},{254, 35, 2},{252, 31, 0},{243, 29, 0},{233, 28, 0},{224, 28, 0},{216, 27, 0},{208, 26, 0},{197, 25, 0},{189, 23, 0},{180, 23, 0},{172, 22, 0},{162, 20, 0},{154, 19, 0},{147, 19, 0},{136, 17, 0},{128, 16, 0},{120, 15, 0},{111, 14, 0},{101, 12, 0},{92, 11, 0},{84, 11, 0},{75, 10, 0},{67, 8, 0},{58, 7, 0},{49, 6, 0},{42, 5, 0},{31, 4, 0},{21, 2, 0},{8, 0, 0},{7, 5, 4}},{{243, 226, 222},{255, 235, 227},{254, 219, 209},{254, 209, 201},{254, 201, 191},{253, 194, 182},{253, 187, 173},{253, 179, 166},{254, 171, 156},{253, 163, 145},{253, 156, 137},{254, 149, 129},{254, 141, 121},{253, 133, 111},{253, 126, 103},{252, 119, 93},{253, 112, 84},{253, 102, 75},{253, 95, 66},{252, 89, 58},{253, 80, 46},{253, 73, 40},{253, 65, 29},{253, 57, 21},{254, 50, 14},{254, 42, 3},{250, 37, 0},{241, 36, 0},{233, 34, 0},{224, 33, 0},{217, 33, 0},{207, 31, 0},{197, 29, 0},{189, 28, 0},{180, 27, 0},{171, 26, 0},{162, 25, 0},{153, 23, 0},{145, 21, 0},{136, 21, 0},{128, 20, 0},{121, 17, 0},{111, 17, 0},{101, 15, 0},{93, 14, 0},{83, 12, 0},{74, 11, 0},{66, 11, 0},{58, 9, 1},{50, 7, 1},{40, 6, 0},{31, 5, 0},{22, 4, 0},{8, 0, 0},{8, 5, 4}},{{244, 227, 223},{255, 235, 226},{255, 219, 209},{254, 210, 201},{254, 203, 191},{253, 195, 182},{253, 189, 173},{254, 181, 165},{253, 174, 155},{254, 166, 146},{253, 159, 138},{253, 151, 129},{253, 144, 122},{253, 136, 112},{253, 129, 102},{254, 122, 93},{253, 115, 85},{252, 106, 75},{253, 100, 67},{252, 93, 58},{253, 84, 47},{254, 79, 40},{253, 70, 30},{254, 63, 22},{254, 56, 14},{255, 48, 3},{250, 42, 0},{241, 42, 0},{234, 41, 0},{224, 39, 0},{216, 37, 0},{207, 35, 0},{198, 34, 0},{190, 33, 0},{180, 31, 0},{171, 30, 0},{161, 28, 0},{152, 26, 0},{145, 25, 0},{137, 24, 0},{127, 23, 0},{121, 21, 0},{111, 20, 0},{101, 17, 0},{92, 16, 0},{84, 15, 0},{75, 13, 0},{66, 12, 0},{58, 10, 0},{50, 9, 0},{39, 7, 0},{30, 6, 0},{22, 5, 0},{9, 0, 0},{8, 5, 4}},{{242, 228, 224},{255, 236, 226},{254, 219, 210},{252, 212, 202},{254, 204, 190},{253, 197, 183},{254, 190, 174},{253, 182, 166},{253, 175, 154},{254, 169, 146},{254, 162, 138},{254, 155, 129},{253, 147, 121},{253, 139, 112},{253, 133, 103},{254, 126, 94},{254, 118, 85},{252, 111, 76},{253, 104, 66},{253, 97, 58},{254, 90, 49},{252, 82, 39},{252, 75, 30},{254, 69, 24},{253, 60, 13},{254, 52, 2},{252, 49, 0},{243, 46, 0},{234, 46, 0},{223, 44, 0},{216, 43, 0},{207, 40, 0},{198, 39, 0},{189, 37, 0},{180, 36, 0},{171, 33, 0},{163, 32, 0},{154, 29, 0},{145, 29, 0},{137, 27, 0},{129, 25, 0},{119, 24, 0},{109, 22, 0},{100, 21, 0},{92, 17, 0},{85, 16, 0},{76, 15, 0},{66, 14, 0},{57, 11, 0},{49, 10, 0},{40, 8, 0},{31, 6, 0},{22, 5, 0},{8, 0, 0},{9, 5, 4}},{{242, 228, 223},{255, 238, 227},{255, 221, 210},{253, 214, 202},{254, 206, 191},{253, 198, 182},{254, 191, 173},{255, 185, 166},{254, 177, 155},{254, 171, 146},{253, 165, 138},{254, 158, 129},{253, 151, 121},{254, 144, 112},{253, 136, 102},{254, 129, 94},{253, 123, 85},{253, 116, 76},{254, 109, 66},{253, 101, 58},{253, 93, 49},{253, 87, 41},{253, 81, 31},{253, 74, 23},{254, 66, 12},{254, 58, 2},{251, 54, 0},{243, 53, 0},{234, 51, 0},{224, 48, 0},{216, 47, 0},{207, 46, 0},{197, 42, 0},{189, 41, 0},{180, 39, 0},{172, 38, 0},{163, 36, 0},{154, 33, 0},{144, 32, 0},{137, 30, 0},{128, 28, 0},{119, 26, 0},{110, 24, 0},{101, 23, 0},{93, 21, 0},{85, 18, 0},{76, 16, 0},{66, 15, 0},{58, 13, 0},{47, 11, 0},{40, 10, 0},{32, 7, 0},{22, 4, 0},{9, 0, 0},{8, 5, 4}},{{243, 229, 223},{255, 238, 226},{254, 222, 210},{254, 214, 201},{254, 207, 191},{253, 202, 182},{253, 194, 173},{254, 187, 164},{254, 180, 155},{254, 174, 147},{253, 167, 139},{254, 160, 129},{253, 154, 119},{254, 146, 110},{253, 141, 102},{253, 132, 93},{253, 127, 86},{252, 120, 76},{253, 112, 66},{253, 108, 57},{252, 99, 48},{253, 94, 41},{254, 87, 31},{253, 79, 22},{253, 72, 12},{255, 65, 3},{250, 60, 0},{242, 59, 1},{233, 56, 0},{224, 54, 0},{216, 53, 0},{205, 51, 0},{198, 48, 0},{190, 46, 0},{179, 43, 0},{171, 42, 0},{162, 40, 0},{153, 37, 0},{145, 35, 0},{136, 33, 0},{127, 31, 0},{119, 29, 0},{110, 28, 0},{101, 25, 0},{93, 22, 0},{84, 20, 0},{75, 18, 0},{66, 18, 0},{58, 14, 0},{48, 11, 0},{40, 11, 0},{32, 8, 0},{22, 6, 0},{7, 0, 0},{7, 5, 4}},{{244, 229, 224},{255, 239, 226},{253, 222, 210},{254, 215, 201},{254, 210, 191},{253, 203, 182},{254, 195, 173},{254, 189, 164},{254, 182, 155},{254, 176, 147},{253, 170, 139},{254, 163, 129},{253, 157, 120},{253, 150, 110},{253, 144, 103},{253, 137, 93},{253, 131, 85},{253, 124, 76},{253, 117, 67},{253, 112, 57},{252, 104, 47},{253, 98, 39},{253, 92, 30},{254, 85, 23},{254, 77, 14},{254, 70, 3},{251, 67, 0},{243, 65, 1},{233, 61, 0},{223, 60, 0},{216, 58, 0},{205, 55, 0},{197, 53, 0},{190, 50, 0},{181, 49, 0},{171, 47, 0},{162, 43, 0},{154, 41, 0},{145, 39, 0},{137, 36, 0},{128, 35, 0},{120, 32, 0},{110, 29, 0},{101, 27, 0},{93, 25, 0},{85, 22, 0},{75, 20, 0},{66, 19, 0},{58, 15, 0},{49, 13, 0},{39, 11, 0},{31, 8, 0},{22, 7, 0},{7, 0, 0},{7, 6, 4}},{{244, 230, 223},{255, 239, 228},{254, 223, 210},{253, 217, 201},{255, 211, 192},{254, 204, 183},{253, 197, 173},{254, 190, 165},{253, 184, 155},{254, 179, 147},{254, 173, 138},{254, 166, 130},{253, 160, 121},{253, 154, 112},{253, 147, 102},{253, 141, 94},{253, 134, 85},{253, 127, 75},{254, 122, 67},{253, 115, 58},{254, 108, 49},{253, 103, 42},{253, 96, 31},{254, 90, 23},{253, 83, 13},{253, 77, 3},{251, 72, 0},{243, 69, 1},{234, 67, 0},{223, 65, 0},{216, 62, 0},{207, 59, 0},{197, 57, 0},{188, 54, 0},{180, 52, 0},{172, 50, 0},{163, 47, 0},{154, 44, 0},{145, 43, 0},{137, 41, 0},{127, 37, 0},{120, 34, 0},{111, 31, 0},{101, 29, 0},{93, 27, 0},{84, 24, 0},{75, 22, 0},{67, 20, 0},{58, 17, 0},{48, 14, 0},{41, 11, 0},{31, 10, 0},{21, 7, 0},{7, 0, 0},{8, 6, 4}},{{244, 231, 222},{255, 241, 228},{253, 224, 209},{253, 218, 200},{255, 212, 192},{255, 206, 184},{253, 199, 173},{254, 193, 165},{254, 187, 156},{254, 181, 147},{254, 175, 139},{254, 169, 130},{253, 163, 120},{253, 157, 112},{253, 151, 103},{252, 143, 94},{254, 138, 85},{254, 132, 75},{253, 127, 67},{254, 120, 59},{254, 112, 50},{253, 107, 43},{253, 101, 31},{254, 95, 22},{253, 89, 13},{254, 82, 4},{251, 77, 0},{243, 75, 0},{235, 73, 0},{224, 70, 0},{216, 68, 0},{206, 64, 0},{197, 62, 0},{189, 58, 0},{181, 56, 0},{171, 55, 0},{162, 51, 0},{154, 48, 0},{146, 47, 0},{136, 43, 0},{127, 41, 0},{119, 38, 0},{111, 34, 0},{102, 32, 0},{93, 28, 0},{84, 26, 0},{75, 24, 0},{67, 22, 0},{58, 19, 0},{50, 16, 0},{40, 13, 0},{32, 10, 1},{22, 7, 0},{8, 0, 0},{8, 6, 4}},{{244, 231, 223},{255, 242, 227},{253, 226, 210},{253, 220, 201},{254, 212, 192},{254, 208, 182},{253, 202, 172},{254, 195, 165},{255, 190, 157},{254, 184, 147},{254, 178, 138},{254, 172, 130},{252, 166, 120},{253, 160, 111},{253, 155, 103},{253, 147, 92},{253, 142, 84},{253, 136, 76},{253, 130, 66},{253, 125, 57},{253, 118, 48},{252, 113, 41},{254, 107, 31},{253, 100, 21},{252, 94, 12},{254, 88, 3},{250, 84, 0},{242, 82, 0},{234, 78, 0},{222, 75, 0},{214, 72, 0},{205, 69, 0},{197, 66, 0},{188, 63, 0},{179, 60, 0},{171, 59, 0},{162, 55, 0},{154, 52, 0},{146, 49, 0},{136, 46, 0},{127, 44, 0},{119, 40, 0},{110, 37, 0},{102, 35, 0},{93, 30, 0},{84, 28, 0},{75, 26, 0},{66, 23, 0},{58, 21, 0},{50, 17, 0},{39, 14, 0},{31, 11, 0},{21, 8, 0},{8, 0, 0},{8, 6, 4}},{{244, 232, 223},{255, 243, 226},{255, 226, 209},{255, 221, 201},{253, 214, 191},{254, 209, 181},{253, 204, 172},{254, 198, 164},{255, 192, 156},{254, 187, 147},{254, 181, 138},{254, 175, 130},{252, 170, 121},{253, 164, 111},{254, 158, 102},{253, 151, 92},{253, 146, 84},{254, 141, 77},{253, 136, 67},{252, 130, 56},{254, 123, 48},{253, 119, 42},{254, 112, 30},{254, 106, 22},{253, 99, 13},{254, 94, 4},{251, 90, 0},{242, 87, 0},{234, 84, 1},{222, 81, 0},{215, 77, 0},{206, 75, 0},{198, 71, 0},{189, 68, 0},{179, 65, 0},{170, 62, 0},{162, 59, 0},{154, 55, 0},{146, 53, 0},{137, 50, 0},{128, 46, 0},{118, 42, 0},{110, 40, 0},{101, 37, 0},{92, 34, 0},{84, 31, 0},{75, 28, 0},{65, 25, 0},{58, 22, 0},{50, 18, 0},{39, 15, 0},{30, 12, 0},{22, 8, 0},{8, 0, 0},{8, 6, 4}},{{243, 232, 223},{255, 242, 227},{254, 227, 208},{254, 222, 200},{255, 216, 191},{254, 210, 183},{254, 205, 173},{254, 200, 165},{253, 194, 155},{254, 189, 147},{254, 183, 138},{254, 177, 129},{253, 173, 122},{253, 168, 112},{254, 161, 102},{253, 155, 94},{254, 150, 86},{253, 144, 76},{253, 139, 66},{252, 134, 59},{253, 128, 49},{254, 122, 41},{253, 116, 30},{252, 111, 22},{253, 106, 13},{254, 100, 3},{252, 95, 0},{243, 92, 0},{233, 89, 0},{224, 86, 0},{217, 83, 0},{207, 79, 0},{198, 75, 0},{189, 73, 0},{180, 69, 0},{171, 66, 0},{162, 63, 0},{155, 58, 0},{146, 56, 0},{136, 53, 0},{128, 49, 0},{119, 45, 0},{110, 42, 0},{101, 39, 0},{93, 36, 0},{85, 34, 0},{75, 29, 0},{66, 25, 0},{59, 23, 0},{49, 18, 0},{40, 15, 0},{31, 12, 1},{21, 8, 1},{9, 0, 0},{8, 6, 4}},{{243, 233, 223},{255, 244, 228},{254, 228, 209},{253, 223, 201},{254, 217, 192},{254, 213, 184},{254, 206, 172},{254, 201, 164},{253, 197, 156},{254, 191, 148},{254, 186, 138},{254, 181, 128},{252, 175, 121},{253, 171, 112},{254, 164, 102},{254, 158, 94},{253, 155, 86},{254, 149, 75},{254, 143, 66},{252, 138, 58},{252, 132, 48},{253, 128, 42},{253, 122, 33},{253, 116, 24},{253, 111, 12},{255, 106, 3},{253, 101, 0},{243, 98, 0},{233, 94, 0},{224, 91, 0},{218, 88, 0},{207, 83, 0},{197, 80, 0},{188, 77, 0},{180, 73, 0},{172, 71, 0},{163, 65, 0},{154, 62, 0},{144, 60, 0},{137, 56, 0},{127, 52, 0},{120, 50, 0},{111, 45, 1},{102, 41, 1},{93, 39, 0},{84, 35, 0},{76, 31, 0},{67, 28, 0},{58, 24, 0},{49, 19, 0},{40, 16, 0},{30, 13, 1},{22, 9, 1},{9, 0, 0},{8, 6, 4}},{{243, 233, 223},{255, 245, 225},{255, 229, 209},{254, 224, 201},{254, 220, 191},{254, 215, 183},{253, 209, 172},{253, 204, 165},{254, 199, 156},{255, 194, 147},{254, 189, 138},{252, 184, 128},{252, 179, 120},{254, 174, 111},{253, 169, 101},{253, 163, 93},{252, 158, 85},{253, 154, 75},{254, 148, 66},{253, 142, 58},{253, 137, 48},{253, 133, 42},{253, 128, 32},{253, 122, 22},{254, 117, 13},{254, 112, 3},{250, 108, 0},{242, 104, 0},{233, 100, 0},{224, 97, 0},{216, 93, 0},{206, 89, 0},{198, 85, 0},{188, 81, 0},{179, 78, 0},{171, 74, 0},{163, 70, 0},{153, 67, 0},{144, 64, 0},{137, 59, 0},{127, 56, 0},{119, 52, 0},{111, 48, 0},{100, 45, 0},{93, 41, 0},{84, 36, 0},{76, 32, 0},{67, 29, 1},{58, 25, 0},{48, 20, 0},{40, 17, 0},{31, 15, 0},{22, 11, 0},{9, 1, 0},{7, 6, 4}},{{244, 234, 224},{255, 246, 227},{255, 231, 209},{253, 226, 202},{254, 220, 192},{254, 216, 182},{253, 211, 171},{254, 206, 165},{254, 201, 156},{253, 197, 147},{254, 191, 139},{255, 187, 129},{253, 182, 120},{254, 177, 111},{253, 173, 101},{252, 166, 93},{253, 162, 85},{253, 157, 74},{253, 153, 67},{253, 147, 58},{254, 142, 48},{253, 138, 42},{253, 133, 32},{253, 127, 22},{254, 123, 14},{254, 118, 3},{251, 114, 0},{242, 110, 0},{233, 105, 0},{224, 102, 0},{216, 99, 0},{206, 94, 0},{198, 89, 0},{189, 86, 0},{180, 83, 0},{171, 77, 0},{162, 74, 0},{152, 70, 0},{143, 67, 0},{136, 63, 0},{127, 59, 0},{118, 54, 0},{111, 50, 1},{101, 47, 1},{92, 43, 0},{83, 39, 0},{75, 34, 0},{66, 30, 1},{58, 26, 0},{49, 23, 0},{40, 19, 0},{31, 15, 0},{21, 11, 0},{8, 2, 0},{7, 6, 4}},{{244, 233, 223},{255, 246, 228},{255, 232, 210},{253, 227, 200},{253, 223, 190},{254, 218, 182},{254, 212, 173},{254, 208, 166},{253, 203, 156},{254, 198, 147},{254, 193, 138},{254, 189, 130},{253, 185, 120},{252, 180, 111},{253, 174, 103},{253, 170, 94},{253, 166, 85},{253, 161, 75},{254, 157, 66},{254, 151, 58},{254, 147, 49},{253, 142, 40},{252, 137, 30},{253, 133, 22},{254, 127, 12},{254, 123, 3},{252, 119, 0},{243, 115, 0},{234, 111, 0},{224, 107, 0},{216, 102, 0},{205, 98, 0},{197, 95, 0},{189, 91, 0},{180, 86, 0},{172, 81, 0},{162, 78, 0},{153, 74, 0},{144, 69, 1},{135, 66, 0},{128, 62, 0},{119, 57, 0},{111, 53, 0},{101, 49, 0},{92, 45, 0},{85, 41, 0},{75, 37, 0},{66, 32, 0},{57, 28, 0},{49, 23, 0},{40, 21, 1},{32, 16, 1},{21, 11, 0},{7, 2, 0},{7, 6, 4}},{{244, 233, 223},{255, 247, 228},{254, 233, 210},{254, 228, 201},{254, 224, 190},{254, 220, 183},{254, 214, 174},{254, 209, 165},{252, 206, 156},{254, 201, 146},{255, 196, 139},{253, 192, 130},{253, 188, 120},{252, 184, 111},{253, 178, 103},{253, 174, 94},{253, 170, 85},{254, 166, 75},{254, 161, 67},{254, 156, 58},{253, 152, 50},{253, 148, 42},{253, 143, 31},{254, 138, 23},{254, 134, 14},{255, 130, 4},{252, 126, 0},{244, 121, 0},{234, 116, 0},{224, 112, 0},{216, 108, 0},{206, 104, 0},{197, 100, 0},{189, 95, 0},{180, 90, 0},{172, 87, 0},{163, 82, 0},{153, 77, 0},{145, 73, 1},{137, 70, 0},{128, 64, 0},{119, 58, 0},{111, 57, 0},{101, 52, 0},{93, 47, 0},{85, 43, 0},{75, 38, 0},{67, 34, 0},{57, 28, 0},{49, 24, 0},{41, 22, 1},{31, 16, 1},{22, 11, 0},{7, 2, 0},{7, 6, 4}},{{244, 235, 224},{255, 249, 227},{253, 234, 209},{254, 229, 202},{254, 225, 191},{253, 222, 183},{254, 216, 173},{253, 212, 165},{253, 209, 156},{254, 204, 146},{254, 199, 139},{254, 195, 129},{252, 191, 119},{252, 187, 111},{253, 182, 102},{253, 178, 94},{253, 174, 84},{253, 170, 75},{253, 166, 66},{252, 162, 57},{252, 157, 47},{253, 153, 40},{253, 149, 32},{252, 144, 21},{253, 140, 12},{254, 136, 3},{251, 131, 0},{241, 126, 0},{232, 122, 0},{223, 119, 0},{215, 113, 0},{205, 109, 0},{197, 104, 0},{189, 98, 0},{180, 94, 0},{170, 90, 0},{162, 85, 0},{153, 81, 0},{145, 76, 0},{137, 72, 0},{127, 66, 0},{120, 62, 0},{110, 59, 0},{100, 53, 0},{93, 49, 0},{84, 45, 0},{74, 40, 0},{66, 35, 0},{57, 30, 0},{48, 25, 0},{39, 21, 0},{31, 18, 0},{21, 12, 0},{7, 2, 0},{7, 6, 4}},{{244, 235, 224},{255, 249, 227},{253, 235, 209},{254, 230, 201},{254, 226, 191},{253, 223, 182},{254, 218, 173},{254, 215, 165},{254, 211, 156},{254, 206, 146},{254, 202, 139},{255, 198, 130},{253, 194, 121},{252, 190, 111},{253, 186, 103},{253, 182, 94},{253, 178, 85},{253, 174, 76},{254, 170, 67},{253, 166, 57},{252, 163, 48},{252, 158, 41},{253, 153, 31},{253, 150, 22},{253, 145, 13},{253, 142, 3},{250, 138, 0},{242, 133, 0},{234, 128, 0},{224, 124, 0},{216, 118, 0},{206, 114, 0},{197, 109, 0},{189, 104, 0},{180, 99, 0},{171, 95, 0},{163, 90, 0},{153, 84, 0},{145, 80, 0},{136, 75, 0},{128, 70, 0},{120, 66, 0},{109, 61, 0},{101, 55, 0},{94, 51, 0},{84, 47, 0},{74, 41, 0},{66, 36, 0},{58, 33, 1},{49, 28, 0},{39, 22, 0},{31, 17, 0},{21, 13, 0},{8, 2, 0},{7, 6, 4}},{{245, 237, 224},{255, 250, 228},{253, 235, 210},{253, 232, 201},{254, 229, 192},{255, 224, 182},{254, 220, 173},{254, 217, 166},{253, 213, 155},{254, 209, 146},{255, 205, 139},{254, 201, 130},{253, 198, 121},{254, 193, 113},{254, 189, 103},{253, 184, 94},{254, 182, 85},{252, 178, 76},{254, 174, 68},{254, 170, 60},{252, 166, 49},{253, 162, 40},{253, 158, 31},{254, 154, 22},{252, 151, 12},{254, 147, 3},{252, 142, 0},{242, 138, 0},{233, 133, 0},{224, 128, 0},{216, 123, 0},{207, 119, 0},{198, 113, 0},{188, 107, 0},{179, 102, 0},{172, 98, 0},{163, 94, 0},{153, 88, 0},{144, 83, 0},{136, 78, 0},{129, 74, 0},{119, 68, 0},{110, 62, 0},{102, 58, 0},{93, 55, 1},{84, 48, 0},{76, 43, 0},{67, 38, 0},{58, 34, 0},{49, 29, 0},{40, 23, 0},{31, 17, 0},{22, 12, 0},{8, 4, 0},{6, 6, 4}},{{245, 238, 223},{255, 251, 227},{254, 237, 210},{254, 234, 201},{253, 230, 192},{255, 225, 182},{254, 221, 172},{254, 219, 166},{254, 215, 156},{254, 211, 146},{254, 207, 138},{253, 204, 129},{253, 201, 122},{253, 196, 112},{253, 193, 103},{253, 188, 93},{253, 185, 85},{253, 182, 76},{254, 179, 68},{254, 174, 59},{253, 171, 49},{254, 167, 42},{254, 164, 30},{253, 160, 21},{253, 156, 13},{255, 152, 4},{252, 148, 0},{242, 143, 0},{233, 139, 0},{225, 134, 0},{215, 128, 0},{206, 122, 0},{198, 118, 0},{187, 112, 0},{179, 106, 0},{172, 102, 0},{162, 97, 0},{154, 92, 0},{145, 87, 0},{136, 81, 0},{127, 76, 0},{120, 71, 0},{111, 65, 0},{101, 60, 0},{93, 56, 1},{84, 50, 0},{76, 45, 0},{66, 39, 0},{58, 35, 0},{48, 30, 0},{40, 24, 0},{31, 18, 0},{22, 13, 0},{8, 4, 0},{6, 6, 4}},{{244, 237, 222},{255, 251, 225},{254, 237, 209},{254, 234, 202},{254, 231, 192},{254, 227, 182},{254, 224, 172},{254, 221, 166},{254, 217, 156},{254, 215, 146},{253, 210, 137},{253, 206, 130},{252, 204, 121},{253, 200, 111},{253, 196, 101},{253, 193, 93},{252, 190, 85},{252, 186, 76},{253, 183, 67},{252, 180, 57},{252, 177, 48},{254, 173, 40},{254, 170, 30},{253, 166, 20},{253, 162, 13},{254, 158, 4},{251, 155, 0},{242, 151, 0},{234, 145, 0},{224, 140, 0},{216, 134, 0},{206, 128, 0},{197, 122, 0},{189, 117, 0},{180, 112, 0},{171, 106, 0},{162, 101, 0},{153, 95, 0},{145, 90, 0},{136, 85, 0},{127, 80, 0},{118, 73, 0},{110, 68, 0},{101, 63, 0},{92, 58, 1},{83, 53, 1},{74, 46, 1},{65, 41, 0},{58, 37, 0},{48, 31, 0},{40, 24, 0},{32, 20, 0},{21, 14, 0},{8, 4, 0},{7, 6, 4}},{{244, 238, 223},{255, 252, 227},{254, 239, 209},{254, 235, 200},{255, 233, 191},{254, 229, 183},{254, 225, 174},{254, 223, 167},{254, 219, 156},{254, 217, 146},{253, 213, 138},{254, 209, 129},{253, 206, 120},{252, 204, 111},{253, 200, 101},{253, 197, 94},{253, 193, 84},{253, 190, 75},{253, 187, 67},{252, 184, 57},{252, 181, 47},{253, 178, 40},{254, 174, 31},{253, 171, 22},{253, 167, 12},{254, 164, 3},{251, 162, 0},{242, 157, 0},{234, 150, 0},{225, 144, 0},{216, 139, 0},{205, 133, 0},{196, 127, 0},{189, 121, 0},{179, 116, 0},{171, 110, 0},{162, 104, 0},{153, 98, 0},{145, 93, 0},{137, 88, 0},{127, 83, 0},{118, 77, 0},{110, 72, 0},{102, 66, 0},{93, 60, 0},{84, 54, 0},{74, 47, 0},{66, 44, 0},{58, 38, 0},{48, 32, 0},{41, 25, 0},{31, 20, 0},{22, 16, 0},{8, 4, 0},{6, 6, 4}},{{246, 239, 225},{255, 254, 228},{254, 239, 208},{254, 236, 200},{254, 234, 191},{254, 231, 183},{254, 228, 173},{254, 224, 165},{254, 222, 155},{254, 219, 146},{253, 215, 136},{254, 212, 127},{254, 208, 122},{252, 205, 111},{253, 203, 102},{253, 200, 93},{253, 197, 85},{254, 195, 76},{254, 191, 67},{253, 187, 59},{253, 185, 48},{252, 182, 41},{254, 179, 31},{254, 175, 23},{254, 174, 14},{255, 171, 3},{253, 166, 0},{243, 160, 0},{233, 155, 0},{224, 149, 0},{215, 143, 0},{205, 137, 0},{197, 131, 0},{189, 125, 0},{179, 120, 0},{170, 115, 0},{162, 108, 0},{153, 102, 0},{145, 96, 0},{137, 90, 1},{128, 84, 0},{119, 79, 0},{111, 73, 0},{102, 68, 0},{92, 62, 0},{85, 55, 0},{75, 50, 0},{67, 45, 0},{58, 39, 0},{48, 32, 0},{41, 26, 0},{32, 21, 1},{21, 16, 1},{6, 4, 0},{7, 6, 4}},{{246, 239, 225},{255, 254, 228},{254, 241, 209},{254, 237, 201},{254, 235, 191},{254, 233, 182},{254, 230, 173},{254, 226, 165},{253, 224, 156},{254, 221, 147},{254, 218, 138},{254, 215, 128},{254, 212, 121},{253, 211, 111},{253, 207, 103},{254, 204, 94},{253, 201, 86},{254, 199, 76},{255, 196, 67},{253, 192, 59},{254, 189, 50},{254, 187, 42},{253, 184, 30},{253, 181, 23},{254, 179, 14},{255, 177, 3},{252, 172, 0},{244, 166, 0},{234, 161, 0},{224, 155, 1},{216, 149, 0},{206, 142, 0},{197, 136, 0},{190, 130, 1},{180, 124, 1},{171, 119, 0},{163, 113, 0},{153, 105, 0},{145, 100, 0},{136, 94, 0},{127, 88, 0},{119, 82, 0},{111, 76, 1},{101, 69, 1},{92, 64, 0},{85, 58, 1},{75, 53, 1},{67, 46, 0},{58, 40, 0},{49, 33, 0},{41, 28, 0},{32, 22, 1},{21, 16, 1},{7, 5, 0},{7, 6, 4}},{{244, 239, 223},{255, 255, 226},{254, 241, 209},{254, 239, 202},{253, 238, 191},{253, 234, 183},{254, 231, 173},{254, 230, 164},{254, 226, 156},{254, 223, 147},{254, 221, 138},{255, 218, 129},{253, 216, 120},{253, 214, 110},{252, 211, 102},{252, 209, 93},{252, 205, 84},{253, 202, 76},{253, 200, 67},{253, 198, 59},{253, 195, 49},{252, 192, 39},{253, 189, 30},{252, 187, 22},{252, 185, 13},{255, 183, 2},{252, 179, 0},{243, 172, 0},{233, 166, 0},{223, 159, 0},{216, 154, 0},{205, 147, 0},{198, 141, 0},{190, 135, 0},{179, 128, 0},{172, 123, 0},{163, 117, 0},{152, 110, 0},{144, 104, 0},{136, 98, 0},{128, 91, 0},{119, 85, 0},{110, 79, 0},{102, 73, 0},{94, 67, 0},{84, 60, 0},{75, 54, 0},{67, 48, 0},{57, 41, 0},{49, 34, 0},{40, 27, 0},{30, 23, 0},{21, 18, 0},{8, 6, 0},{8, 7, 5}},{{244, 240, 224},{255, 255, 226},{254, 242, 210},{254, 240, 202},{253, 238, 190},{254, 236, 183},{254, 233, 174},{253, 231, 164},{254, 228, 156},{253, 226, 146},{252, 224, 137},{254, 221, 129},{252, 218, 120},{252, 217, 110},{253, 215, 102},{252, 212, 94},{252, 209, 84},{254, 206, 75},{254, 204, 68},{252, 203, 58},{253, 200, 47},{252, 197, 40},{254, 194, 31},{253, 193, 24},{252, 191, 14},{253, 189, 3},{251, 186, 0},{242, 178, 0},{233, 172, 0},{224, 165, 0},{215, 159, 0},{206, 152, 0},{198, 145, 0},{188, 139, 0},{179, 133, 0},{170, 127, 0},{161, 120, 0},{153, 114, 0},{144, 108, 0},{136, 100, 0},{128, 94, 0},{119, 88, 0},{109, 81, 0},{102, 75, 0},{93, 69, 0},{84, 62, 0},{75, 55, 0},{66, 49, 0},{57, 42, 0},{50, 35, 0},{41, 29, 0},{30, 24, 0},{22, 17, 0},{8, 6, 0},{8, 7, 5}},{{245, 242, 226},{255, 255, 227},{254, 243, 209},{254, 241, 201},{253, 239, 191},{254, 237, 184},{254, 234, 173},{254, 233, 165},{253, 231, 156},{254, 230, 147},{254, 226, 137},{254, 224, 128},{254, 221, 122},{252, 219, 112},{253, 218, 103},{253, 215, 94},{253, 213, 85},{253, 210, 75},{254, 209, 67},{253, 206, 58},{253, 203, 48},{253, 203, 41},{253, 199, 31},{253, 197, 24},{252, 195, 14},{254, 194, 4},{251, 189, 0},{242, 183, 0},{233, 177, 0},{223, 170, 0},{215, 163, 0},{205, 157, 0},{196, 150, 0},{188, 143, 0},{180, 137, 0},{171, 130, 0},{162, 123, 0},{154, 116, 0},{145, 110, 0},{137, 103, 0},{128, 96, 0},{120, 90, 0},{111, 83, 0},{102, 76, 0},{93, 71, 1},{85, 65, 1},{76, 56, 0},{67, 51, 0},{57, 44, 0},{48, 37, 0},{39, 30, 0},{31, 24, 1},{22, 17, 0},{8, 5, 0},{8, 6, 4}},{{245, 241, 226},{255, 255, 228},{254, 246, 210},{254, 243, 201},{254, 241, 191},{254, 239, 183},{255, 237, 173},{254, 235, 165},{253, 233, 156},{255, 232, 147},{255, 229, 137},{254, 228, 129},{254, 225, 122},{253, 223, 112},{253, 220, 102},{254, 219, 93},{254, 217, 85},{253, 215, 76},{252, 213, 66},{253, 210, 58},{253, 209, 50},{253, 207, 41},{254, 206, 31},{253, 203, 23},{252, 201, 12},{254, 199, 3},{251, 196, 0},{242, 188, 0},{233, 182, 0},{223, 175, 0},{215, 168, 0},{206, 161, 0},{198, 154, 0},{189, 147, 0},{180, 140, 0},{172, 133, 0},{163, 126, 0},{153, 120, 0},{145, 114, 0},{137, 107, 0},{128, 100, 0},{120, 93, 0},{112, 86, 0},{101, 79, 0},{92, 74, 1},{84, 67, 1},{76, 59, 1},{66, 52, 0},{57, 46, 0},{49, 39, 0},{39, 32, 1},{31, 24, 1},{23, 18, 0},{8, 5, 0},{8, 7, 4}},{{245, 242, 224},{255, 255, 227},{254, 246, 209},{253, 244, 200},{254, 242, 191},{253, 241, 182},{254, 239, 173},{255, 237, 165},{254, 235, 156},{254, 234, 146},{254, 231, 138},{253, 230, 128},{253, 229, 120},{253, 226, 110},{253, 225, 101},{253, 224, 94},{252, 221, 84},{253, 219, 75},{253, 218, 66},{252, 216, 57},{252, 215, 49},{253, 213, 40},{253, 211, 31},{252, 209, 22},{253, 207, 12},{254, 206, 3},{251, 204, 0},{243, 196, 0},{233, 188, 0},{224, 181, 1},{216, 174, 1},{205, 167, 0},{197, 160, 0},{189, 152, 0},{179, 145, 0},{171, 137, 0},{162, 131, 0},{153, 125, 0},{144, 118, 0},{136, 111, 0},{128, 104, 0},{119, 96, 0},{110, 89, 0},{101, 83, 0},{93, 75, 0},{85, 68, 1},{74, 61, 0},{66, 54, 0},{58, 47, 0},{49, 41, 0},{40, 34, 0},{31, 27, 0},{21, 18, 0},{8, 5, 0},{8, 8, 5}},{{246, 243, 225},{255, 255, 227},{253, 247, 209},{254, 245, 200},{254, 244, 190},{254, 244, 183},{254, 241, 173},{255, 239, 165},{255, 237, 156},{254, 236, 145},{254, 235, 138},{254, 233, 130},{253, 231, 120},{253, 230, 111},{253, 228, 103},{253, 227, 93},{252, 226, 84},{253, 224, 76},{253, 222, 67},{253, 221, 57},{253, 220, 48},{253, 217, 40},{253, 216, 30},{253, 214, 21},{253, 213, 13},{254, 211, 3},{251, 209, 0},{242, 201, 0},{233, 193, 0},{225, 186, 1},{216, 180, 1},{205, 173, 0},{198, 165, 0},{189, 157, 0},{180, 149, 0},{171, 142, 0},{162, 135, 0},{154, 129, 0},{144, 122, 0},{135, 113, 0},{129, 107, 0},{120, 99, 0},{110, 91, 0},{101, 84, 0},{94, 77, 0},{85, 70, 1},{74, 64, 0},{66, 56, 0},{58, 49, 0},{48, 42, 0},{40, 34, 0},{32, 28, 0},{21, 19, 0},{8, 6, 0},{8, 8, 5}},{{245, 243, 224},{255, 255, 227},{253, 248, 209},{253, 247, 201},{254, 246, 191},{254, 244, 183},{254, 242, 173},{254, 241, 165},{254, 241, 156},{255, 239, 146},{253, 237, 138},{254, 236, 128},{253, 234, 120},{254, 232, 112},{253, 231, 103},{253, 229, 93},{254, 229, 86},{253, 227, 75},{252, 226, 66},{252, 225, 59},{253, 223, 48},{253, 223, 41},{253, 222, 31},{252, 221, 21},{252, 219, 12},{254, 217, 3},{250, 213, 0},{243, 206, 0},{234, 199, 0},{224, 192, 1},{216, 184, 1},{207, 176, 0},{199, 169, 0},{189, 161, 0},{180, 153, 0},{172, 146, 0},{163, 139, 0},{154, 131, 0},{144, 124, 0},{136, 116, 0},{128, 109, 0},{121, 102, 0},{111, 93, 0},{101, 86, 0},{92, 79, 0},{84, 72, 0},{75, 64, 0},{68, 58, 0},{58, 49, 0},{48, 42, 0},{40, 34, 0},{32, 28, 0},{22, 19, 0},{7, 6, 0},{7, 8, 5}},{{245, 243, 225},{255, 255, 228},{253, 248, 209},{253, 248, 200},{254, 248, 192},{254, 246, 184},{254, 244, 173},{253, 244, 166},{253, 242, 156},{255, 241, 146},{254, 240, 137},{253, 239, 127},{253, 238, 120},{253, 236, 112},{253, 235, 103},{254, 234, 93},{254, 233, 86},{253, 231, 75},{253, 230, 66},{252, 229, 60},{252, 227, 48},{254, 227, 41},{254, 227, 32},{252, 225, 22},{253, 224, 13},{255, 223, 3},{251, 219, 0},{243, 211, 0},{233, 204, 0},{223, 196, 0},{216, 189, 1},{207, 181, 0},{198, 173, 0},{188, 165, 0},{181, 157, 0},{172, 150, 0},{163, 142, 0},{153, 135, 0},{145, 128, 0},{136, 120, 0},{127, 112, 0},{119, 104, 0},{111, 96, 0},{101, 89, 0},{92, 82, 0},{85, 74, 0},{76, 67, 0},{67, 59, 0},{58, 50, 0},{48, 43, 0},{40, 36, 0},{32, 29, 1},{23, 20, 1},{7, 6, 0},{7, 7, 5}},{{246, 244, 224},{255, 255, 227},{254, 250, 210},{253, 250, 201},{254, 249, 192},{254, 247, 183},{255, 247, 172},{254, 246, 166},{254, 245, 156},{253, 243, 145},{253, 243, 137},{254, 243, 128},{252, 241, 119},{253, 240, 111},{253, 239, 103},{253, 238, 92},{252, 237, 84},{253, 236, 76},{253, 236, 67},{252, 234, 58},{253, 233, 48},{253, 233, 42},{253, 231, 30},{253, 231, 22},{254, 230, 13},{255, 229, 3},{251, 227, 0},{241, 217, 0},{233, 209, 0},{224, 203, 0},{216, 195, 0},{206, 186, 0},{198, 177, 0},{189, 170, 0},{180, 163, 0},{171, 155, 0},{163, 147, 0},{153, 140, 0},{144, 132, 0},{135, 123, 0},{127, 115, 0},{120, 107, 0},{111, 100, 0},{100, 92, 0},{92, 84, 0},{84, 76, 0},{76, 68, 0},{66, 60, 0},{59, 53, 0},{49, 45, 0},{40, 36, 0},{31, 28, 1},{21, 20, 1},{7, 7, 0},{7, 8, 5}},{{246, 245, 223},{255, 255, 226},{254, 251, 209},{253, 251, 201},{255, 250, 192},{254, 249, 183},{255, 248, 171},{254, 248, 165},{254, 247, 157},{255, 246, 145},{254, 245, 137},{254, 244, 127},{253, 244, 118},{252, 243, 111},{252, 242, 102},{252, 243, 91},{253, 241, 84},{253, 239, 75},{253, 239, 67},{253, 239, 58},{254, 238, 48},{252, 237, 40},{253, 236, 29},{253, 236, 22},{253, 235, 11},{255, 234, 1},{250, 231, 0},{241, 223, 0},{233, 215, 0},{225, 208, 1},{216, 199, 1},{205, 190, 0},{197, 182, 0},{188, 174, 0},{180, 167, 0},{171, 159, 0},{162, 150, 0},{153, 143, 0},{143, 136, 0},{135, 127, 0},{128, 119, 0},{120, 110, 0},{110, 102, 0},{100, 94, 1},{92, 85, 0},{85, 78, 0},{76, 69, 0},{65, 62, 0},{58, 55, 0},{49, 46, 0},{40, 38, 0},{31, 29, 1},{22, 20, 1},{8, 7, 0},{7, 8, 5}},{{245, 245, 224},{255, 255, 226},{254, 253, 208},{254, 252, 201},{254, 252, 192},{255, 251, 182},{255, 250, 174},{255, 250, 166},{255, 249, 156},{255, 248, 147},{255, 248, 139},{255, 247, 129},{255, 246, 120},{254, 247, 111},{253, 246, 102},{254, 246, 93},{255, 246, 85},{253, 245, 76},{254, 245, 67},{253, 244, 60},{255, 243, 49},{255, 243, 40},{255, 243, 29},{254, 242, 23},{254, 241, 12},{255, 241, 2},{253, 239, 0},{245, 231, 0},{235, 222, 0},{225, 215, 1},{217, 206, 0},{207, 196, 0},{199, 187, 0},{190, 180, 0},{181, 172, 0},{172, 163, 0},{163, 155, 0},{154, 147, 0},{146, 139, 0},{138, 129, 0},{129, 121, 0},{120, 113, 0},{111, 104, 0},{103, 96, 0},{94, 88, 1},{84, 80, 1},{75, 71, 1},{65, 64, 1},{56, 56, 0},{49, 47, 0},{41, 38, 0},{32, 31, 1},{22, 21, 1},{7, 7, 0},{7, 7, 4}},{{243, 245, 224},{255, 255, 227},{254, 253, 209},{254, 253, 202},{254, 253, 193},{253, 252, 183},{252, 251, 174},{252, 252, 166},{252, 252, 157},{252, 251, 147},{252, 252, 138},{252, 251, 130},{252, 249, 121},{253, 250, 112},{253, 250, 103},{252, 248, 92},{252, 249, 85},{251, 249, 78},{250, 248, 67},{250, 248, 59},{252, 248, 49},{252, 248, 41},{251, 248, 31},{250, 247, 24},{250, 246, 14},{252, 246, 3},{249, 244, 1},{240, 236, 0},{230, 226, 0},{220, 218, 0},{213, 210, 0},{205, 201, 0},{196, 192, 0},{187, 184, 0},{178, 175, 0},{170, 166, 0},{160, 158, 0},{153, 150, 0},{145, 141, 0},{135, 132, 0},{127, 124, 0},{118, 116, 0},{108, 107, 0},{100, 99, 0},{91, 91, 1},{82, 82, 1},{74, 73, 1},{66, 66, 1},{57, 57, 0},{49, 47, 0},{39, 39, 0},{31, 31, 1},{21, 21, 1},{7, 8, 0},{8, 8, 4}},{{243, 245, 224},{255, 255, 228},{251, 254, 210},{251, 253, 201},{250, 252, 192},{249, 253, 183},{248, 253, 173},{248, 252, 166},{246, 252, 156},{245, 252, 148},{246, 251, 138},{246, 251, 128},{244, 251, 121},{244, 251, 111},{245, 251, 102},{243, 250, 93},{242, 250, 83},{241, 249, 75},{240, 249, 66},{240, 249, 58},{239, 249, 48},{237, 249, 40},{235, 248, 29},{237, 248, 24},{236, 248, 13},{236, 248, 2},{233, 245, 0},{223, 236, 0},{215, 228, 0},{208, 220, 1},{200, 210, 1},{192, 202, 0},{183, 193, 0},{175, 184, 0},{168, 176, 0},{159, 167, 0},{151, 159, 0},{142, 150, 0},{135, 142, 0},{126, 134, 0},{119, 125, 0},{110, 116, 0},{101, 108, 0},{93, 100, 0},{86, 92, 0},{78, 83, 0},{70, 74, 0},{62, 65, 0},{54, 57, 0},{46, 48, 0},{37, 40, 1},{29, 31, 0},{20, 22, 0},{7, 9, 0},{7, 7, 5}},{{243, 245, 224},{255, 255, 228},{248, 253, 209},{247, 253, 201},{246, 252, 192},{244, 253, 183},{244, 253, 173},{242, 251, 165},{240, 253, 155},{240, 252, 148},{239, 250, 140},{240, 251, 130},{236, 252, 121},{235, 251, 111},{235, 249, 103},{233, 250, 94},{232, 250, 86},{231, 249, 75},{231, 249, 66},{229, 249, 59},{227, 250, 48},{225, 249, 41},{223, 248, 31},{224, 248, 24},{223, 248, 13},{221, 248, 2},{219, 246, 0},{210, 237, 0},{203, 228, 0},{197, 219, 1},{188, 210, 1},{180, 202, 0},{172, 194, 0},{164, 185, 0},{157, 175, 0},{150, 168, 0},{142, 160, 0},{133, 150, 0},{126, 142, 0},{119, 134, 0},{111, 124, 0},{103, 115, 0},{96, 108, 1},{88, 99, 1},{80, 91, 1},{73, 83, 0},{64, 74, 0},{58, 65, 0},{51, 56, 0},{43, 49, 0},{34, 39, 1},{26, 30, 1},{18, 22, 0},{7, 8, 0},{7, 7, 5}},{{242, 245, 225},{255, 255, 228},{247, 254, 210},{244, 253, 200},{243, 253, 192},{241, 253, 183},{240, 252, 171},{237, 251, 164},{236, 252, 156},{235, 252, 147},{233, 251, 139},{233, 251, 131},{232, 251, 121},{228, 250, 111},{226, 250, 102},{225, 250, 93},{224, 251, 86},{222, 249, 75},{221, 248, 65},{217, 249, 57},{216, 248, 49},{216, 247, 42},{213, 249, 31},{211, 249, 22},{210, 247, 12},{209, 247, 2},{205, 245, 0},{198, 236, 0},{191, 229, 0},{186, 219, 1},{179, 210, 0},{170, 203, 0},{162, 194, 0},{154, 184, 0},{147, 176, 0},{140, 168, 0},{134, 159, 0},{125, 150, 0},{119, 142, 0},{112, 134, 0},{105, 125, 0},{98, 116, 0},{91, 108, 0},{84, 99, 0},{77, 90, 1},{68, 83, 0},{60, 75, 0},{55, 65, 0},{48, 56, 0},{39, 49, 0},{32, 40, 0},{26, 31, 1},{18, 22, 1},{6, 9, 0},{6, 8, 5}},{{241, 246, 224},{255, 255, 227},{244, 254, 210},{242, 253, 201},{239, 253, 193},{238, 252, 183},{235, 253, 172},{233, 253, 164},{231, 252, 156},{229, 252, 146},{227, 252, 139},{226, 251, 130},{224, 250, 120},{222, 250, 111},{219, 250, 102},{217, 251, 93},{213, 250, 85},{211, 250, 74},{211, 250, 64},{208, 250, 57},{206, 250, 49},{204, 249, 42},{200, 249, 30},{197, 250, 21},{196, 249, 12},{195, 248, 3},{191, 245, 0},{184, 237, 0},{177, 230, 0},{171, 221, 0},{164, 212, 0},{158, 202, 0},{149, 194, 0},{143, 185, 0},{137, 177, 0},{130, 168, 0},{125, 160, 0},{118, 151, 0},{112, 142, 1},{105, 133, 0},{98, 124, 0},{91, 116, 0},{84, 108, 0},{78, 99, 0},{71, 91, 0},{65, 83, 0},{56, 73, 0},{51, 64, 0},{45, 56, 0},{37, 49, 0},{29, 40, 0},{24, 31, 0},{17, 21, 0},{5, 9, 0},{6, 8, 5}},{{240, 246, 224},{254, 255, 226},{239, 255, 209},{237, 253, 201},{236, 253, 192},{234, 253, 183},{231, 253, 173},{227, 253, 165},{225, 252, 156},{224, 252, 146},{221, 252, 139},{217, 252, 129},{214, 251, 120},{213, 252, 112},{212, 251, 103},{207, 251, 93},{203, 250, 85},{202, 250, 76},{200, 250, 66},{198, 249, 58},{194, 249, 49},{192, 248, 41},{189, 249, 31},{186, 248, 21},{184, 247, 13},{183, 249, 3},{179, 246, 0},{172, 237, 0},{165, 229, 0},{159, 221, 0},{153, 212, 0},{147, 201, 0},{141, 193, 0},{134, 184, 0},{128, 176, 0},{122, 168, 0},{116, 159, 0},{108, 151, 0},{102, 142, 0},{96, 134, 0},{90, 125, 0},{85, 116, 0},{79, 107, 0},{71, 99, 0},{66, 91, 0},{59, 83, 0},{52, 73, 0},{46, 64, 0},{40, 57, 0},{34, 49, 0},{27, 41, 0},{22, 31, 1},{16, 21, 1},{3, 8, 0},{6, 8, 5}},{{238, 245, 224},{251, 255, 228},{237, 254, 210},{236, 254, 202},{233, 253, 190},{230, 253, 182},{226, 253, 173},{222, 253, 164},{220, 253, 156},{218, 253, 146},{215, 252, 138},{210, 252, 129},{207, 252, 121},{204, 252, 112},{203, 250, 102},{198, 250, 92},{195, 251, 85},{191, 251, 76},{190, 252, 66},{187, 249, 58},{181, 250, 49},{180, 250, 41},{177, 250, 31},{174, 249, 22},{171, 249, 13},{169, 250, 2},{163, 246, 0},{158, 238, 0},{152, 230, 0},{146, 221, 0},{140, 213, 0},{135, 202, 0},{131, 194, 0},{124, 185, 0},{117, 177, 0},{112, 170, 0},{107, 160, 0},{100, 151, 0},{94, 144, 0},{90, 135, 0},{83, 125, 0},{77, 116, 0},{72, 108, 0},{67, 100, 0},{61, 91, 0},{54, 83, 0},{49, 73, 1},{44, 64, 0},{38, 58, 0},{32, 49, 0},{25, 41, 1},{20, 31, 1},{15, 22, 0},{2, 9, 0},{6, 8, 5}},{{237, 245, 224},{249, 255, 227},{237, 255, 210},{234, 254, 202},{230, 253, 191},{225, 252, 182},{221, 253, 173},{219, 253, 165},{216, 254, 156},{211, 253, 146},{209, 251, 139},{206, 252, 129},{201, 252, 121},{197, 253, 111},{194, 251, 102},{189, 250, 93},{186, 251, 84},{183, 252, 75},{179, 251, 65},{176, 250, 57},{173, 250, 48},{169, 250, 41},{165, 249, 31},{162, 249, 22},{157, 249, 12},{154, 249, 2},{151, 246, 0},{144, 238, 0},{139, 230, 0},{135, 222, 0},{129, 211, 0},{123, 202, 0},{119, 195, 0},{115, 186, 0},{108, 178, 0},{103, 169, 0},{98, 160, 0},{93, 151, 0},{89, 143, 0},{82, 135, 0},{78, 127, 0},{72, 117, 0},{66, 108, 0},{61, 100, 0},{57, 92, 0},{51, 83, 1},{44, 73, 1},{41, 65, 0},{35, 58, 0},{28, 49, 0},{23, 41, 0},{18, 31, 1},{14, 21, 0},{2, 9, 0},{6, 8, 4}},{{235, 244, 224},{247, 255, 226},{234, 255, 208},{230, 254, 202},{226, 253, 192},{222, 253, 183},{217, 253, 174},{215, 253, 165},{210, 253, 155},{205, 253, 146},{203, 252, 139},{199, 252, 130},{194, 251, 120},{189, 252, 110},{186, 251, 102},{181, 251, 95},{177, 251, 85},{173, 251, 76},{168, 251, 65},{165, 250, 57},{161, 250, 47},{157, 251, 40},{153, 251, 32},{148, 250, 22},{143, 250, 12},{140, 251, 3},{137, 247, 0},{131, 239, 0},{126, 230, 0},{122, 222, 0},{118, 213, 0},{112, 204, 0},{108, 195, 0},{104, 187, 0},{99, 178, 0},{96, 168, 0},{90, 160, 0},{84, 151, 0},{81, 143, 0},{75, 134, 0},{71, 126, 0},{65, 117, 0},{59, 109, 0},{55, 100, 0},{51, 91, 0},{46, 82, 0},{41, 74, 0},{37, 65, 0},{31, 57, 0},{25, 49, 0},{22, 40, 0},{16, 30, 0},{12, 22, 0},{0, 9, 0},{5, 8, 5}},{{236, 245, 225},{246, 255, 227},{231, 253, 208},{226, 253, 201},{222, 254, 191},{218, 254, 185},{213, 253, 175},{209, 253, 165},{205, 253, 156},{200, 253, 146},{195, 253, 137},{190, 253, 129},{187, 252, 121},{183, 252, 110},{177, 252, 103},{172, 252, 94},{169, 251, 86},{165, 251, 77},{160, 251, 68},{156, 250, 58},{151, 251, 48},{147, 250, 41},{142, 251, 31},{137, 249, 23},{133, 249, 14},{128, 251, 2},{125, 248, 0},{119, 239, 1},{115, 230, 1},{111, 221, 1},{107, 213, 1},{103, 204, 0},{99, 196, 0},{94, 186, 0},{90, 177, 0},{84, 170, 0},{80, 161, 0},{75, 153, 0},{72, 144, 0},{67, 135, 0},{63, 126, 0},{58, 118, 0},{53, 109, 0},{50, 100, 0},{45, 91, 0},{41, 83, 0},{36, 75, 0},{32, 66, 0},{28, 58, 0},{23, 49, 0},{19, 39, 0},{15, 30, 1},{9, 22, 1},{0, 9, 0},{5, 8, 4}},{{234, 245, 224},{244, 255, 227},{229, 254, 210},{224, 254, 201},{218, 254, 191},{213, 254, 183},{209, 253, 174},{204, 253, 165},{199, 253, 155},{194, 253, 146},{189, 253, 137},{183, 253, 128},{179, 252, 121},{175, 252, 111},{169, 252, 102},{164, 252, 92},{160, 251, 85},{155, 251, 77},{150, 251, 67},{144, 251, 58},{138, 251, 48},{135, 251, 40},{129, 251, 30},{123, 251, 22},{118, 250, 13},{114, 251, 2},{111, 248, 0},{105, 239, 0},{101, 231, 0},{99, 221, 0},{94, 214, 0},{92, 204, 0},{85, 196, 0},{81, 186, 0},{78, 177, 0},{75, 170, 0},{71, 161, 0},{67, 152, 0},{63, 144, 0},{58, 135, 0},{56, 125, 0},{52, 118, 0},{48, 109, 0},{45, 100, 0},{40, 92, 0},{36, 84, 0},{32, 75, 0},{27, 66, 0},{24, 58, 0},{21, 49, 0},{18, 40, 0},{14, 31, 1},{8, 22, 1},{0, 9, 0},{5, 8, 4}},{{232, 245, 223},{243, 255, 226},{227, 254, 209},{222, 254, 200},{216, 255, 190},{211, 254, 182},{205, 254, 173},{200, 254, 165},{195, 253, 155},{189, 253, 146},{183, 253, 137},{179, 253, 130},{173, 252, 122},{167, 252, 111},{161, 253, 102},{156, 252, 94},{152, 251, 86},{146, 252, 76},{139, 252, 66},{134, 252, 58},{129, 252, 48},{123, 251, 41},{118, 251, 30},{111, 251, 22},{106, 250, 13},{101, 251, 4},{97, 249, 0},{94, 239, 0},{90, 231, 0},{86, 222, 0},{83, 215, 0},{81, 205, 0},{75, 196, 0},{71, 187, 0},{70, 178, 1},{66, 171, 1},{64, 162, 0},{60, 152, 0},{56, 144, 0},{52, 135, 0},{50, 127, 0},{46, 118, 0},{42, 109, 0},{39, 99, 0},{36, 92, 0},{32, 85, 0},{29, 74, 0},{25, 66, 0},{21, 58, 0},{18, 50, 0},{16, 39, 0},{11, 31, 0},{8, 23, 0},{0, 8, 0},{5, 8, 4}},{{232, 246, 224},{240, 255, 226},{224, 254, 208},{218, 254, 200},{214, 254, 191},{207, 253, 183},{200, 253, 172},{195, 254, 165},{189, 253, 155},{183, 253, 146},{177, 254, 138},{172, 253, 129},{165, 253, 121},{159, 253, 112},{153, 254, 102},{147, 252, 93},{142, 252, 85},{134, 252, 74},{128, 252, 66},{122, 253, 58},{116, 253, 47},{110, 252, 40},{105, 251, 31},{97, 251, 22},{91, 251, 13},{87, 252, 4},{82, 249, 0},{79, 239, 0},{76, 231, 0},{73, 223, 0},{70, 215, 0},{68, 206, 0},{65, 197, 0},{63, 187, 0},{61, 178, 0},{57, 170, 0},{54, 161, 0},{51, 152, 0},{49, 144, 0},{46, 135, 0},{42, 127, 0},{40, 118, 0},{36, 109, 0},{33, 100, 0},{31, 93, 0},{28, 84, 0},{25, 74, 0},{21, 66, 0},{18, 58, 0},{15, 49, 0},{12, 39, 0},{9, 31, 0},{6, 22, 0},{0, 9, 0},{5, 8, 4}},{{230, 245, 224},{237, 255, 227},{221, 254, 209},{216, 254, 200},{209, 254, 191},{202, 254, 183},{195, 254, 172},{189, 254, 166},{182, 253, 156},{176, 254, 146},{171, 254, 139},{163, 254, 129},{157, 253, 120},{151, 253, 112},{144, 253, 101},{137, 253, 92},{131, 252, 85},{125, 252, 76},{119, 252, 66},{112, 252, 58},{105, 252, 48},{100, 251, 42},{93, 251, 32},{86, 251, 22},{79, 251, 13},{73, 252, 4},{69, 249, 0},{66, 240, 0},{63, 231, 0},{61, 222, 0},{59, 215, 0},{57, 206, 0},{54, 197, 0},{51, 189, 0},{48, 179, 0},{46, 171, 0},{44, 163, 0},{42, 154, 0},{41, 145, 0},{37, 135, 0},{34, 127, 0},{32, 119, 0},{30, 110, 0},{27, 101, 0},{25, 93, 0},{22, 84, 0},{18, 75, 0},{17, 66, 0},{15, 57, 0},{12, 50, 0},{10, 40, 0},{8, 31, 0},{6, 23, 0},{0, 9, 0},{4, 9, 4}},{{229, 245, 224},{235, 255, 228},{219, 254, 210},{212, 253, 201},{205, 254, 191},{199, 254, 183},{191, 254, 173},{185, 254, 166},{177, 254, 156},{170, 255, 146},{165, 254, 138},{157, 254, 130},{150, 253, 121},{143, 253, 111},{137, 252, 102},{129, 253, 92},{120, 254, 85},{114, 253, 76},{109, 254, 67},{101, 254, 58},{93, 253, 49},{89, 252, 42},{80, 252, 32},{73, 252, 23},{66, 253, 14},{59, 253, 5},{56, 249, 0},{53, 241, 0},{50, 233, 0},{48, 222, 0},{46, 214, 0},{45, 206, 0},{44, 196, 0},{41, 188, 0},{38, 180, 0},{36, 172, 0},{35, 163, 0},{32, 154, 0},{32, 145, 0},{29, 136, 0},{27, 127, 0},{25, 119, 0},{24, 110, 0},{21, 102, 0},{20, 92, 0},{19, 85, 0},{14, 75, 0},{13, 67, 0},{13, 58, 0},{10, 49, 0},{7, 40, 0},{7, 31, 0},{5, 22, 0},{0, 9, 0},{4, 9, 4}},{{227, 244, 225},{235, 255, 228},{217, 254, 209},{209, 254, 201},{203, 254, 191},{196, 254, 182},{186, 255, 172},{180, 254, 164},{173, 253, 156},{164, 254, 147},{158, 254, 138},{151, 254, 129},{143, 252, 121},{135, 252, 111},{126, 252, 102},{120, 252, 94},{113, 253, 85},{106, 253, 76},{100, 253, 67},{91, 253, 59},{83, 253, 49},{77, 252, 40},{70, 252, 31},{61, 252, 22},{54, 251, 13},{47, 252, 4},{44, 250, 0},{41, 242, 0},{39, 233, 0},{39, 222, 0},{37, 213, 0},{34, 206, 0},{33, 197, 0},{32, 188, 0},{29, 179, 0},{29, 171, 0},{27, 162, 0},{24, 153, 0},{24, 144, 0},{23, 136, 0},{22, 127, 0},{21, 118, 0},{19, 110, 0},{16, 101, 0},{15, 93, 0},{14, 84, 0},{12, 74, 0},{11, 66, 0},{9, 57, 0},{7, 49, 0},{5, 41, 0},{4, 33, 0},{5, 23, 0},{0, 9, 0},{4, 8, 4}},{{226, 244, 224},{232, 255, 227},{215, 254, 210},{207, 255, 202},{200, 255, 191},{192, 254, 181},{182, 255, 172},{176, 254, 165},{168, 253, 156},{159, 255, 146},{152, 254, 138},{144, 253, 128},{137, 253, 120},{128, 253, 112},{119, 253, 100},{112, 254, 91},{104, 254, 83},{98, 254, 75},{91, 253, 67},{82, 252, 58},{73, 252, 47},{65, 254, 39},{57, 254, 30},{48, 254, 21},{41, 253, 12},{32, 254, 3},{29, 252, 0},{28, 244, 0},{24, 234, 0},{26, 223, 0},{25, 216, 0},{22, 207, 0},{21, 198, 0},{20, 190, 0},{20, 181, 0},{20, 172, 0},{19, 163, 0},{18, 153, 0},{16, 144, 0},{15, 137, 0},{15, 128, 0},{15, 119, 0},{14, 111, 0},{11, 101, 0},{10, 92, 0},{8, 84, 0},{9, 75, 0},{7, 66, 0},{5, 58, 0},{5, 50, 0},{4, 41, 0},{3, 32, 0},{3, 22, 0},{0, 9, 0},{4, 8, 4}},{{226, 244, 224},{230, 255, 228},{212, 255, 209},{204, 255, 201},{194, 254, 191},{186, 254, 182},{177, 254, 174},{170, 255, 166},{160, 254, 156},{152, 254, 147},{144, 254, 138},{134, 254, 129},{126, 254, 121},{118, 253, 111},{111, 253, 101},{101, 255, 92},{92, 255, 84},{85, 254, 75},{77, 254, 66},{69, 253, 58},{58, 254, 48},{54, 253, 40},{44, 253, 31},{36, 253, 21},{27, 253, 11},{18, 255, 3},{14, 251, 0},{13, 242, 0},{12, 233, 0},{13, 223, 0},{11, 215, 0},{11, 207, 0},{11, 197, 0},{10, 189, 0},{10, 180, 0},{8, 172, 0},{7, 163, 0},{7, 155, 0},{6, 146, 0},{7, 137, 0},{6, 129, 0},{4, 120, 0},{6, 111, 0},{5, 101, 0},{4, 92, 0},{3, 85, 0},{3, 76, 0},{2, 67, 0},{3, 59, 0},{3, 50, 0},{1, 40, 0},{1, 31, 0},{0, 22, 0},{0, 9, 0},{4, 8, 4}},{{225, 245, 224},{227, 255, 228},{209, 255, 209},{202, 255, 201},{191, 255, 192},{182, 254, 182},{173, 254, 174},{165, 254, 166},{155, 254, 157},{147, 255, 148},{138, 254, 139},{128, 255, 130},{120, 254, 122},{112, 254, 113},{104, 253, 104},{93, 254, 95},{86, 255, 87},{76, 254, 78},{67, 254, 68},{59, 255, 58},{48, 254, 50},{42, 254, 43},{32, 254, 34},{22, 254, 24},{13, 255, 14},{4, 255, 7},{0, 251, 2},{1, 242, 1},{1, 235, 2},{0, 225, 1},{0, 216, 0},{1, 207, 1},{1, 199, 1},{0, 190, 0},{1, 180, 0},{0, 172, 1},{0, 164, 1},{0, 155, 0},{0, 147, 0},{0, 138, 0},{0, 129, 0},{0, 120, 0},{1, 111, 0},{1, 102, 1},{0, 94, 1},{0, 85, 1},{0, 75, 0},{0, 67, 1},{0, 59, 0},{0, 49, 0},{0, 40, 0},{0, 32, 0},{0, 23, 0},{0, 9, 0},{4, 8, 4}},{{223, 245, 223},{227, 255, 227},{210, 255, 212},{200, 254, 203},{191, 255, 195},{183, 255, 185},{174, 255, 176},{164, 255, 168},{156, 254, 161},{146, 255, 152},{137, 254, 142},{129, 255, 135},{121, 254, 126},{112, 255, 118},{103, 255, 108},{94, 255, 100},{86, 254, 92},{77, 255, 84},{68, 254, 75},{59, 255, 65},{49, 255, 56},{41, 254, 51},{31, 254, 41},{22, 255, 31},{13, 255, 23},{2, 255, 14},{0, 253, 9},{0, 245, 9},{0, 235, 8},{0, 226, 8},{0, 217, 8},{0, 207, 8},{0, 200, 8},{0, 190, 6},{0, 182, 6},{1, 173, 6},{1, 164, 5},{0, 155, 5},{0, 147, 4},{0, 138, 3},{0, 128, 4},{0, 119, 4},{0, 112, 3},{0, 102, 3},{0, 94, 3},{0, 85, 2},{0, 75, 1},{0, 67, 2},{0, 59, 2},{0, 49, 1},{1, 41, 0},{0, 32, 1},{0, 23, 1},{0, 9, 0},{4, 8, 4}},{{223, 245, 223},{227, 255, 229},{210, 254, 213},{200, 255, 204},{191, 255, 197},{184, 255, 190},{175, 255, 180},{165, 255, 171},{157, 254, 164},{147, 254, 155},{137, 255, 146},{129, 254, 139},{122, 254, 131},{113, 254, 123},{103, 255, 113},{94, 255, 106},{86, 254, 97},{76, 254, 90},{68, 254, 83},{59, 255, 73},{50, 255, 64},{42, 254, 58},{33, 254, 49},{24, 255, 40},{14, 254, 31},{4, 255, 23},{0, 253, 19},{1, 244, 17},{0, 235, 17},{1, 225, 17},{1, 217, 16},{1, 208, 15},{0, 198, 15},{1, 190, 14},{1, 181, 13},{1, 173, 13},{1, 163, 11},{0, 154, 10},{0, 146, 10},{0, 137, 8},{0, 128, 9},{0, 120, 8},{0, 111, 8},{0, 102, 6},{0, 94, 6},{0, 85, 5},{0, 75, 5},{0, 67, 3},{0, 58, 4},{0, 49, 3},{1, 40, 2},{0, 31, 1},{0, 23, 0},{0, 9, 0},{4, 8, 4}},{{224, 245, 226},{227, 255, 233},{210, 255, 216},{201, 255, 207},{192, 255, 200},{184, 255, 192},{175, 254, 182},{166, 255, 176},{157, 255, 169},{148, 255, 160},{139, 254, 153},{130, 254, 145},{121, 254, 136},{112, 254, 128},{103, 254, 120},{95, 254, 113},{85, 253, 104},{76, 254, 96},{68, 254, 90},{59, 254, 81},{50, 254, 72},{43, 254, 65},{33, 254, 57},{23, 253, 49},{14, 253, 40},{5, 255, 33},{0, 252, 29},{0, 242, 29},{1, 233, 28},{1, 224, 25},{0, 216, 23},{1, 207, 24},{0, 198, 23},{1, 190, 21},{0, 180, 20},{0, 172, 20},{0, 163, 19},{0, 154, 17},{0, 145, 15},{0, 136, 15},{0, 128, 15},{0, 121, 14},{1, 111, 12},{1, 101, 11},{1, 94, 11},{1, 86, 10},{1, 77, 8},{0, 66, 7},{0, 58, 5},{0, 50, 5},{0, 40, 5},{0, 31, 3},{0, 22, 1},{0, 8, 0},{4, 8, 4}},{{225, 245, 228},{227, 255, 234},{210, 253, 217},{202, 254, 210},{192, 255, 203},{184, 255, 195},{176, 254, 185},{166, 255, 178},{157, 255, 172},{149, 254, 163},{140, 255, 157},{131, 255, 150},{122, 253, 142},{113, 254, 133},{103, 254, 126},{95, 254, 119},{87, 254, 111},{78, 254, 103},{68, 253, 97},{60, 253, 89},{50, 254, 79},{43, 254, 72},{33, 253, 66},{25, 253, 58},{14, 255, 49},{5, 255, 42},{1, 252, 37},{1, 243, 37},{1, 233, 35},{1, 225, 34},{0, 217, 31},{1, 208, 32},{1, 198, 31},{0, 190, 28},{0, 181, 27},{1, 172, 27},{1, 163, 26},{0, 154, 23},{0, 146, 21},{0, 137, 22},{0, 128, 20},{0, 121, 18},{1, 111, 17},{1, 102, 15},{1, 94, 14},{1, 85, 12},{1, 77, 12},{1, 67, 10},{1, 59, 8},{0, 50, 7},{0, 41, 6},{0, 32, 5},{0, 22, 3},{0, 8, 0},{4, 8, 4}},{{225, 245, 229},{228, 255, 234},{210, 254, 218},{201, 254, 212},{192, 255, 203},{184, 254, 197},{175, 255, 188},{166, 255, 182},{158, 254, 174},{148, 255, 166},{138, 255, 161},{131, 255, 155},{122, 253, 147},{113, 254, 139},{104, 254, 130},{96, 254, 123},{87, 254, 117},{77, 254, 109},{68, 253, 101},{61, 253, 95},{51, 254, 88},{43, 254, 81},{34, 254, 74},{26, 254, 65},{16, 254, 58},{7, 254, 51},{2, 251, 46},{1, 243, 42},{2, 234, 42},{2, 225, 43},{1, 216, 40},{1, 206, 40},{1, 198, 37},{1, 189, 34},{0, 180, 34},{2, 172, 33},{2, 163, 29},{0, 154, 27},{0, 146, 27},{0, 137, 25},{1, 128, 24},{1, 120, 22},{1, 111, 21},{1, 102, 19},{1, 94, 16},{1, 84, 14},{0, 75, 14},{0, 67, 12},{0, 59, 8},{0, 51, 9},{0, 41, 8},{0, 32, 6},{0, 22, 4},{0, 9, 0},{4, 10, 4}},{{224, 245, 229},{228, 255, 235},{211, 255, 220},{201, 254, 214},{192, 255, 205},{184, 255, 199},{175, 254, 191},{167, 254, 186},{158, 254, 178},{148, 254, 169},{138, 255, 165},{131, 255, 159},{123, 254, 152},{114, 253, 144},{105, 254, 137},{96, 254, 129},{87, 254, 122},{78, 254, 116},{69, 254, 110},{61, 254, 102},{51, 254, 94},{44, 253, 89},{35, 254, 82},{26, 254, 74},{16, 254, 68},{7, 254, 61},{2, 251, 56},{2, 243, 52},{2, 234, 51},{2, 224, 50},{2, 217, 48},{1, 207, 47},{1, 198, 45},{1, 188, 41},{2, 179, 39},{2, 172, 38},{1, 164, 35},{1, 154, 33},{2, 146, 33},{0, 137, 29},{1, 128, 28},{1, 120, 27},{1, 111, 25},{1, 101, 23},{1, 93, 21},{1, 85, 18},{0, 76, 17},{1, 67, 14},{0, 59, 11},{0, 51, 10},{0, 41, 9},{0, 32, 7},{0, 22, 3},{0, 9, 0},{4, 10, 5}},{{224, 244, 229},{228, 255, 239},{211, 255, 221},{202, 254, 215},{192, 254, 210},{183, 254, 203},{174, 254, 195},{167, 254, 190},{158, 254, 182},{149, 254, 175},{139, 254, 169},{131, 254, 163},{122, 253, 157},{113, 253, 149},{105, 254, 143},{96, 253, 137},{88, 254, 131},{79, 254, 124},{70, 254, 119},{60, 253, 111},{51, 252, 104},{44, 252, 99},{35, 252, 90},{25, 253, 83},{16, 253, 77},{7, 254, 71},{3, 252, 66},{2, 242, 64},{2, 232, 61},{2, 223, 58},{2, 216, 57},{2, 206, 55},{1, 197, 53},{1, 188, 50},{3, 180, 47},{2, 172, 46},{1, 163, 43},{0, 154, 39},{2, 145, 39},{0, 137, 36},{1, 128, 33},{1, 119, 32},{0, 110, 29},{1, 101, 27},{1, 93, 25},{1, 84, 23},{0, 75, 19},{1, 66, 16},{0, 58, 15},{0, 50, 12},{0, 41, 10},{0, 32, 8},{1, 24, 5},{0, 8, 0},{5, 7, 6}},{{224, 244, 230},{228, 255, 240},{211, 255, 221},{203, 255, 217},{193, 254, 213},{183, 253, 206},{175, 254, 198},{167, 253, 193},{158, 254, 187},{150, 255, 181},{141, 254, 175},{132, 254, 167},{123, 253, 161},{114, 254, 154},{105, 254, 149},{96, 254, 143},{88, 254, 137},{78, 254, 131},{69, 254, 126},{61, 253, 118},{52, 253, 110},{44, 253, 106},{35, 253, 99},{26, 253, 93},{17, 253, 87},{7, 255, 80},{2, 252, 77},{3, 242, 74},{3, 233, 70},{3, 224, 67},{3, 216, 65},{2, 206, 61},{1, 197, 58},{2, 189, 57},{3, 181, 55},{2, 172, 51},{1, 163, 49},{1, 155, 45},{2, 145, 45},{1, 137, 41},{1, 128, 37},{1, 119, 37},{2, 110, 34},{2, 101, 30},{1, 92, 28},{1, 84, 26},{0, 75, 21},{1, 66, 19},{1, 59, 18},{1, 51, 14},{0, 41, 10},{0, 32, 8},{1, 24, 7},{0, 8, 0},{5, 7, 6}},{{224, 243, 230},{229, 255, 240},{212, 255, 225},{201, 255, 218},{193, 255, 213},{184, 254, 209},{174, 254, 199},{168, 254, 195},{159, 254, 191},{148, 254, 184},{139, 254, 177},{131, 254, 173},{124, 254, 167},{114, 254, 158},{105, 254, 153},{96, 254, 148},{88, 253, 142},{79, 254, 137},{71, 254, 131},{62, 253, 124},{53, 254, 118},{46, 254, 114},{35, 253, 106},{27, 253, 100},{18, 253, 94},{8, 254, 89},{3, 251, 85},{3, 242, 82},{3, 234, 80},{4, 225, 76},{3, 215, 71},{3, 206, 71},{3, 197, 68},{3, 189, 63},{3, 181, 61},{3, 172, 57},{2, 163, 53},{2, 155, 50},{3, 146, 48},{1, 136, 43},{1, 128, 42},{1, 119, 41},{2, 110, 37},{3, 101, 35},{2, 92, 31},{2, 84, 27},{1, 75, 25},{0, 67, 22},{1, 59, 19},{1, 51, 16},{0, 41, 13},{0, 32, 11},{0, 23, 7},{0, 9, 0},{5, 9, 4}},{{224, 244, 232},{229, 255, 242},{211, 255, 227},{202, 255, 222},{193, 255, 215},{184, 254, 211},{175, 254, 204},{168, 255, 200},{158, 254, 193},{149, 254, 187},{140, 254, 182},{131, 254, 176},{124, 254, 173},{115, 254, 165},{106, 254, 159},{97, 254, 154},{89, 253, 148},{80, 254, 144},{72, 254, 138},{62, 253, 131},{54, 253, 126},{46, 253, 123},{35, 253, 114},{27, 253, 109},{19, 253, 104},{10, 254, 98},{5, 251, 94},{4, 242, 91},{3, 233, 87},{6, 224, 85},{3, 215, 80},{3, 206, 79},{4, 197, 74},{4, 189, 70},{3, 181, 68},{2, 172, 64},{3, 164, 59},{2, 154, 55},{3, 146, 54},{2, 137, 50},{1, 128, 48},{1, 118, 45},{2, 110, 41},{2, 101, 38},{1, 93, 34},{1, 85, 31},{0, 76, 28},{1, 67, 25},{1, 59, 22},{1, 50, 18},{0, 41, 14},{1, 32, 12},{0, 22, 9},{0, 9, 0},{5, 9, 4}},{{225, 245, 233},{229, 255, 244},{210, 255, 227},{201, 254, 224},{193, 253, 218},{185, 254, 212},{176, 254, 206},{168, 253, 204},{157, 254, 198},{149, 255, 192},{141, 254, 187},{132, 254, 180},{124, 254, 176},{114, 253, 171},{107, 253, 168},{98, 253, 161},{89, 253, 156},{79, 253, 150},{71, 253, 146},{63, 253, 141},{55, 253, 134},{46, 252, 130},{34, 252, 124},{27, 252, 120},{19, 252, 114},{9, 253, 108},{4, 250, 106},{5, 240, 101},{5, 233, 96},{5, 224, 94},{3, 215, 90},{4, 206, 86},{3, 197, 82},{4, 188, 79},{3, 179, 76},{2, 171, 73},{3, 163, 68},{1, 155, 64},{2, 145, 62},{0, 135, 57},{1, 128, 52},{1, 119, 48},{2, 110, 46},{2, 100, 43},{2, 93, 39},{2, 85, 35},{1, 76, 29},{1, 66, 28},{0, 57, 25},{0, 49, 20},{1, 41, 16},{1, 32, 13},{1, 23, 9},{0, 9, 0},{5, 8, 6}},{{224, 245, 234},{229, 255, 246},{211, 254, 229},{202, 254, 225},{193, 253, 220},{185, 254, 215},{176, 254, 210},{169, 253, 206},{158, 254, 201},{150, 254, 197},{142, 254, 192},{132, 254, 184},{123, 253, 181},{114, 253, 176},{107, 253, 172},{98, 253, 167},{89, 253, 163},{80, 253, 158},{71, 253, 152},{63, 253, 147},{55, 253, 142},{46, 252, 138},{34, 253, 132},{28, 252, 127},{19, 252, 122},{10, 253, 117},{4, 249, 113},{4, 241, 109},{5, 232, 105},{4, 223, 102},{3, 214, 99},{4, 206, 94},{4, 197, 89},{4, 188, 87},{3, 179, 84},{3, 171, 78},{3, 162, 74},{1, 153, 70},{1, 144, 66},{0, 135, 61},{1, 127, 56},{2, 120, 54},{2, 111, 51},{1, 101, 47},{0, 93, 42},{2, 85, 38},{2, 75, 34},{1, 67, 31},{0, 56, 25},{0, 48, 22},{1, 41, 18},{1, 32, 12},{1, 23, 9},{0, 9, 0},{5, 8, 7}},{{224, 244, 235},{228, 255, 246},{211, 254, 232},{203, 253, 227},{194, 254, 222},{186, 253, 218},{175, 253, 213},{167, 254, 210},{160, 254, 203},{150, 253, 198},{141, 254, 195},{132, 254, 192},{125, 252, 187},{116, 253, 181},{106, 252, 175},{98, 252, 171},{90, 253, 166},{81, 253, 163},{72, 253, 159},{64, 253, 153},{55, 253, 149},{48, 252, 146},{36, 252, 141},{28, 252, 135},{21, 251, 132},{10, 253, 126},{6, 251, 122},{7, 242, 117},{6, 232, 113},{5, 223, 109},{4, 214, 107},{5, 206, 102},{5, 197, 95},{4, 188, 93},{5, 180, 88},{5, 171, 83},{4, 162, 79},{3, 152, 75},{3, 144, 71},{2, 136, 66},{2, 127, 63},{2, 119, 58},{2, 111, 54},{1, 102, 50},{2, 93, 46},{2, 84, 42},{1, 74, 36},{2, 65, 31},{1, 58, 26},{0, 49, 23},{0, 41, 18},{0, 32, 14},{0, 23, 11},{0, 8, 0},{5, 9, 5}},{{224, 244, 234},{229, 255, 247},{210, 254, 234},{203, 253, 229},{195, 254, 223},{186, 254, 219},{175, 254, 215},{167, 254, 212},{159, 253, 207},{151, 254, 202},{141, 254, 200},{133, 254, 196},{126, 252, 192},{116, 253, 187},{106, 253, 182},{98, 253, 176},{90, 254, 173},{81, 254, 171},{73, 253, 166},{64, 253, 161},{56, 253, 156},{49, 251, 153},{37, 252, 149},{28, 252, 146},{21, 252, 141},{11, 253, 137},{7, 250, 133},{8, 242, 129},{6, 232, 124},{6, 223, 120},{5, 215, 114},{5, 207, 108},{5, 197, 103},{4, 188, 99},{5, 180, 95},{5, 171, 91},{4, 162, 86},{3, 153, 81},{3, 144, 76},{3, 136, 71},{3, 128, 67},{2, 119, 62},{1, 110, 58},{3, 102, 55},{2, 93, 50},{2, 84, 44},{1, 75, 37},{1, 65, 34},{1, 58, 30},{1, 49, 25},{1, 41, 21},{1, 32, 15},{0, 23, 11},{0, 8, 0},{5, 9, 5}},{{224, 245, 235},{228, 255, 249},{211, 255, 234},{203, 254, 231},{194, 254, 228},{185, 254, 225},{175, 254, 218},{167, 255, 216},{159, 254, 213},{150, 253, 208},{141, 253, 204},{133, 254, 200},{124, 252, 196},{115, 252, 193},{107, 253, 189},{99, 253, 184},{90, 252, 182},{81, 252, 178},{73, 253, 173},{64, 253, 169},{56, 252, 166},{49, 251, 163},{38, 252, 158},{29, 251, 153},{21, 251, 148},{12, 252, 145},{7, 249, 143},{7, 242, 137},{6, 232, 131},{6, 222, 126},{6, 214, 123},{5, 206, 118},{5, 196, 112},{5, 188, 108},{5, 180, 103},{4, 171, 98},{5, 161, 93},{4, 153, 86},{4, 145, 82},{3, 136, 77},{2, 127, 73},{3, 119, 68},{3, 110, 63},{2, 101, 58},{3, 93, 53},{2, 84, 47},{1, 75, 41},{1, 66, 38},{1, 58, 32},{1, 49, 27},{1, 39, 22},{1, 32, 17},{1, 23, 10},{0, 8, 0},{5, 8, 7}},{{223, 245, 236},{227, 255, 250},{211, 254, 235},{203, 254, 232},{193, 255, 228},{186, 254, 226},{176, 254, 222},{167, 255, 219},{158, 254, 217},{150, 252, 214},{141, 252, 208},{133, 253, 203},{125, 252, 201},{116, 253, 199},{108, 253, 194},{99, 252, 190},{89, 251, 188},{82, 252, 184},{73, 252, 180},{64, 251, 176},{55, 252, 173},{49, 251, 170},{39, 252, 165},{29, 250, 162},{21, 250, 159},{13, 252, 155},{8, 248, 153},{7, 240, 147},{6, 231, 140},{6, 221, 136},{6, 214, 131},{5, 206, 124},{4, 196, 118},{5, 187, 114},{6, 179, 108},{3, 170, 104},{4, 161, 99},{4, 153, 90},{4, 146, 88},{3, 136, 82},{3, 127, 77},{3, 118, 73},{3, 109, 67},{2, 100, 61},{3, 93, 57},{3, 83, 51},{1, 75, 45},{1, 67, 39},{1, 58, 33},{1, 49, 28},{1, 40, 23},{1, 31, 18},{1, 22, 13},{0, 8, 2},{5, 8, 7}},{{225, 245, 237},{228, 255, 249},{211, 254, 239},{203, 253, 235},{193, 254, 229},{185, 254, 226},{176, 254, 224},{169, 254, 220},{160, 254, 219},{151, 253, 217},{142, 253, 213},{132, 253, 207},{125, 253, 204},{116, 254, 203},{107, 253, 199},{100, 252, 195},{91, 251, 192},{82, 251, 190},{75, 252, 188},{65, 251, 185},{56, 252, 179},{51, 252, 175},{40, 252, 175},{30, 250, 171},{21, 250, 167},{13, 251, 165},{8, 249, 162},{8, 240, 155},{7, 230, 149},{8, 222, 143},{7, 215, 136},{6, 205, 132},{6, 196, 126},{5, 187, 120},{5, 179, 116},{6, 169, 111},{5, 161, 104},{4, 153, 97},{4, 145, 91},{4, 137, 87},{3, 127, 81},{2, 118, 76},{4, 109, 71},{4, 99, 65},{2, 92, 58},{3, 84, 53},{2, 75, 46},{1, 66, 40},{1, 57, 35},{2, 49, 31},{0, 39, 24},{1, 31, 18},{1, 23, 13},{0, 10, 2},{5, 8, 6}},{{225, 245, 238},{229, 255, 252},{210, 254, 240},{203, 254, 238},{193, 254, 233},{185, 254, 231},{176, 254, 229},{168, 253, 225},{160, 254, 223},{150, 253, 222},{142, 253, 217},{133, 254, 212},{125, 254, 210},{116, 254, 208},{107, 254, 205},{99, 252, 202},{91, 251, 200},{81, 252, 197},{73, 252, 196},{65, 252, 193},{55, 253, 188},{50, 252, 185},{39, 252, 185},{29, 251, 180},{21, 251, 176},{12, 252, 175},{5, 249, 172},{7, 240, 165},{6, 232, 159},{7, 222, 152},{6, 215, 147},{5, 206, 143},{5, 197, 135},{4, 188, 128},{4, 179, 123},{5, 170, 118},{5, 162, 111},{4, 154, 106},{3, 144, 98},{3, 136, 92},{3, 128, 88},{1, 119, 82},{3, 109, 76},{4, 100, 69},{2, 93, 63},{3, 84, 58},{2, 75, 51},{0, 65, 45},{1, 58, 40},{1, 49, 33},{0, 39, 25},{1, 30, 20},{1, 22, 14},{0, 9, 3},{5, 8, 6}},{{223, 245, 239},{228, 255, 255},{210, 255, 243},{202, 253, 240},{194, 254, 239},{184, 254, 236},{177, 253, 233},{167, 254, 230},{158, 254, 228},{151, 254, 226},{141, 254, 222},{131, 254, 220},{124, 253, 218},{116, 253, 216},{106, 252, 213},{97, 253, 211},{88, 252, 209},{80, 252, 206},{73, 252, 203},{64, 253, 201},{54, 252, 200},{47, 252, 197},{37, 252, 194},{27, 251, 192},{20, 252, 190},{11, 252, 187},{5, 249, 184},{6, 241, 178},{4, 232, 171},{4, 222, 165},{4, 213, 158},{4, 205, 152},{5, 197, 145},{4, 189, 138},{4, 179, 132},{3, 171, 125},{3, 163, 118},{4, 153, 114},{3, 144, 107},{1, 135, 100},{2, 127, 94},{2, 119, 87},{2, 109, 80},{3, 101, 75},{2, 93, 67},{1, 84, 61},{1, 74, 56},{1, 66, 50},{1, 57, 44},{0, 48, 36},{0, 40, 27},{1, 32, 22},{0, 23, 16},{0, 8, 4},{5, 8, 7}},{{224, 245, 240},{228, 255, 255},{210, 255, 245},{201, 254, 241},{193, 254, 239},{184, 253, 237},{176, 254, 234},{168, 254, 233},{158, 254, 232},{150, 254, 230},{141, 254, 228},{131, 254, 226},{123, 253, 223},{115, 253, 221},{105, 253, 218},{95, 253, 218},{87, 253, 216},{80, 253, 213},{72, 253, 210},{63, 253, 209},{53, 253, 208},{45, 252, 205},{35, 252, 204},{27, 252, 202},{18, 252, 199},{10, 253, 197},{5, 250, 194},{4, 241, 188},{3, 232, 181},{4, 222, 175},{4, 214, 167},{3, 206, 160},{3, 197, 153},{4, 188, 147},{3, 180, 141},{2, 172, 133},{2, 163, 124},{2, 154, 118},{2, 145, 114},{2, 136, 106},{2, 127, 98},{1, 120, 91},{1, 111, 85},{2, 101, 78},{1, 93, 71},{1, 84, 64},{0, 75, 57},{1, 67, 52},{0, 58, 46},{0, 50, 38},{0, 41, 30},{0, 32, 23},{0, 23, 18},{0, 8, 5},{5, 8, 8}},{{225, 246, 242},{228, 255, 255},{210, 255, 245},{201, 255, 243},{192, 254, 240},{184, 253, 241},{175, 254, 240},{168, 254, 237},{158, 254, 234},{148, 254, 233},{140, 254, 230},{131, 254, 229},{123, 253, 228},{114, 254, 227},{105, 253, 224},{95, 253, 224},{87, 254, 224},{78, 254, 220},{69, 254, 219},{61, 253, 217},{51, 253, 214},{44, 253, 213},{35, 252, 211},{27, 252, 209},{17, 253, 207},{8, 254, 207},{2, 251, 203},{2, 242, 196},{3, 233, 190},{3, 223, 182},{2, 214, 175},{3, 206, 168},{1, 197, 159},{1, 189, 152},{3, 180, 146},{1, 172, 138},{1, 163, 130},{1, 154, 125},{1, 146, 117},{1, 137, 111},{1, 128, 104},{0, 120, 96},{0, 110, 88},{1, 100, 80},{1, 93, 73},{1, 84, 67},{1, 74, 60},{1, 65, 53},{1, 59, 47},{0, 51, 39},{0, 41, 32},{0, 32, 24},{0, 23, 18},{0, 9, 6},{5, 8, 6}},{{225, 245, 243},{228, 255, 255},{210, 254, 247},{201, 254, 245},{192, 254, 244},{184, 254, 244},{173, 255, 241},{166, 255, 242},{156, 254, 240},{146, 255, 238},{139, 255, 237},{130, 255, 236},{122, 254, 236},{112, 254, 235},{103, 254, 232},{94, 254, 230},{86, 254, 230},{77, 254, 228},{69, 254, 227},{60, 255, 225},{50, 254, 224},{42, 255, 222},{32, 254, 220},{24, 254, 219},{14, 255, 218},{5, 255, 219},{0, 253, 214},{1, 244, 207},{0, 235, 200},{0, 225, 191},{0, 217, 184},{1, 208, 177},{1, 199, 168},{0, 190, 160},{1, 180, 153},{0, 173, 147},{0, 164, 140},{0, 154, 132},{0, 146, 124},{0, 137, 117},{0, 129, 110},{0, 121, 102},{0, 111, 94},{0, 102, 87},{0, 94, 80},{0, 85, 72},{0, 76, 63},{0, 67, 55},{0, 59, 48},{0, 50, 40},{0, 41, 32},{0, 32, 25},{0, 23, 18},{0, 9, 5},{5, 8, 7}},{{226, 246, 243},{228, 255, 255},{209, 255, 249},{202, 255, 249},{192, 254, 247},{183, 254, 245},{173, 254, 244},{164, 255, 245},{155, 255, 244},{146, 255, 243},{138, 255, 243},{130, 254, 242},{121, 254, 241},{111, 254, 238},{103, 253, 237},{93, 254, 237},{85, 252, 235},{77, 253, 234},{68, 254, 234},{60, 253, 234},{49, 253, 232},{41, 253, 231},{31, 253, 230},{23, 253, 228},{13, 253, 227},{4, 253, 227},{0, 252, 224},{0, 243, 216},{0, 232, 208},{0, 224, 200},{0, 216, 192},{0, 207, 184},{0, 198, 177},{0, 189, 169},{0, 180, 161},{0, 172, 154},{0, 163, 146},{0, 154, 137},{0, 146, 130},{0, 137, 122},{0, 128, 115},{0, 120, 106},{1, 111, 97},{1, 101, 91},{0, 93, 84},{0, 85, 76},{0, 76, 65},{0, 67, 58},{0, 58, 50},{0, 50, 42},{0, 41, 34},{0, 31, 27},{0, 22, 20},{0, 9, 6},{5, 7, 7}},{{225, 245, 243},{228, 255, 255},{209, 254, 250},{201, 254, 249},{191, 254, 247},{182, 253, 247},{173, 253, 246},{164, 252, 244},{156, 253, 241},{145, 251, 241},{137, 251, 243},{129, 252, 242},{121, 252, 239},{111, 252, 238},{102, 251, 237},{94, 251, 238},{83, 249, 235},{75, 250, 234},{66, 250, 235},{58, 249, 235},{48, 249, 232},{41, 247, 231},{32, 248, 232},{23, 248, 230},{13, 247, 228},{3, 248, 228},{0, 246, 225},{0, 237, 218},{0, 227, 209},{0, 219, 202},{0, 211, 193},{0, 201, 185},{0, 193, 178},{0, 184, 170},{0, 177, 162},{0, 168, 153},{0, 160, 145},{0, 152, 139},{0, 143, 131},{0, 135, 121},{0, 125, 114},{0, 116, 106},{0, 108, 96},{0, 99, 89},{0, 91, 82},{0, 83, 75},{0, 74, 68},{0, 65, 59},{0, 57, 50},{0, 49, 44},{0, 40, 36},{0, 31, 28},{0, 22, 20},{0, 9, 7},{5, 7, 8}},{{224, 245, 242},{227, 255, 255},{209, 254, 250},{201, 253, 248},{193, 252, 248},{183, 251, 246},{172, 251, 245},{166, 250, 243},{156, 250, 243},{145, 250, 243},{138, 249, 243},{130, 249, 241},{120, 249, 238},{110, 249, 239},{102, 248, 237},{94, 248, 237},{85, 247, 236},{76, 247, 235},{67, 246, 234},{57, 245, 231},{49, 245, 232},{42, 244, 232},{30, 244, 231},{21, 243, 229},{13, 242, 227},{3, 243, 227},{0, 241, 223},{0, 232, 218},{0, 224, 210},{0, 215, 200},{0, 206, 194},{0, 197, 186},{0, 190, 177},{0, 181, 168},{0, 172, 161},{0, 165, 155},{0, 157, 146},{0, 148, 137},{0, 139, 130},{0, 132, 122},{0, 124, 114},{0, 114, 107},{0, 106, 99},{0, 98, 90},{0, 89, 82},{0, 80, 74},{0, 72, 68},{0, 63, 59},{0, 56, 52},{0, 48, 44},{0, 39, 36},{0, 31, 27},{0, 21, 19},{0, 9, 10},{5, 9, 8}},{{223, 244, 241},{226, 255, 255},{209, 253, 250},{201, 251, 247},{193, 250, 248},{183, 250, 247},{172, 250, 244},{165, 249, 243},{155, 248, 244},{145, 248, 244},{137, 247, 241},{129, 246, 240},{120, 245, 240},{111, 246, 239},{102, 244, 237},{93, 244, 237},{86, 243, 236},{75, 243, 234},{66, 242, 234},{58, 241, 233},{49, 241, 233},{41, 240, 232},{31, 239, 232},{22, 238, 229},{13, 237, 228},{3, 238, 228},{0, 236, 224},{0, 227, 217},{0, 218, 211},{0, 210, 201},{0, 202, 194},{0, 194, 186},{0, 185, 178},{0, 177, 170},{0, 170, 161},{0, 162, 154},{0, 153, 146},{0, 145, 137},{0, 137, 129},{0, 129, 124},{0, 120, 115},{0, 111, 106},{0, 103, 99},{0, 94, 91},{0, 88, 83},{0, 79, 74},{0, 71, 67},{0, 62, 59},{0, 55, 52},{0, 46, 44},{0, 37, 36},{1, 30, 27},{1, 21, 19},{0, 8, 8},{5, 8, 8}},{{225, 243, 242},{228, 255, 255},{209, 252, 251},{201, 250, 248},{191, 249, 248},{184, 248, 246},{174, 247, 245},{165, 246, 245},{157, 246, 245},{146, 246, 244},{137, 244, 241},{129, 244, 243},{121, 243, 241},{111, 242, 239},{102, 241, 239},{94, 241, 239},{85, 240, 237},{75, 239, 237},{66, 238, 237},{60, 237, 235},{50, 237, 235},{42, 236, 234},{31, 235, 232},{23, 234, 231},{14, 233, 231},{4, 232, 231},{0, 229, 227},{0, 223, 220},{0, 214, 212},{0, 205, 202},{0, 197, 196},{0, 190, 187},{0, 180, 179},{0, 173, 171},{0, 166, 163},{0, 158, 154},{0, 151, 148},{0, 142, 141},{0, 134, 130},{0, 125, 123},{0, 117, 116},{0, 109, 108},{0, 101, 99},{0, 93, 92},{0, 85, 84},{0, 77, 74},{0, 70, 67},{0, 62, 60},{0, 53, 53},{0, 45, 44},{0, 37, 37},{1, 29, 29},{1, 19, 19},{0, 8, 8},{5, 9, 8}},{{224, 243, 241},{228, 255, 255},{210, 251, 250},{202, 249, 248},{191, 248, 249},{184, 246, 247},{174, 245, 246},{166, 245, 246},{157, 245, 245},{146, 244, 244},{138, 243, 243},{129, 242, 242},{121, 240, 240},{112, 240, 241},{102, 238, 241},{93, 238, 239},{85, 237, 238},{75, 235, 237},{66, 234, 237},{59, 233, 236},{50, 233, 235},{41, 232, 233},{30, 231, 232},{22, 230, 233},{13, 228, 232},{3, 228, 232},{0, 225, 228},{0, 217, 219},{0, 210, 212},{0, 201, 203},{0, 193, 196},{0, 185, 187},{0, 177, 179},{0, 169, 172},{0, 162, 164},{0, 154, 156},{0, 147, 147},{0, 138, 140},{0, 131, 133},{0, 123, 124},{0, 115, 117},{0, 108, 109},{0, 100, 99},{0, 91, 92},{0, 83, 84},{0, 75, 75},{0, 68, 66},{0, 60, 58},{0, 51, 52},{1, 44, 44},{0, 37, 37},{1, 29, 30},{1, 19, 19},{0, 8, 8},{5, 9, 8}},{{223, 242, 242},{227, 255, 255},{209, 250, 249},{202, 248, 249},{192, 247, 249},{183, 245, 247},{174, 245, 247},{165, 244, 247},{156, 242, 245},{148, 241, 244},{139, 240, 244},{129, 240, 242},{121, 237, 241},{112, 237, 243},{102, 237, 241},{93, 234, 239},{86, 234, 239},{76, 233, 237},{67, 231, 237},{58, 230, 237},{49, 229, 235},{41, 227, 234},{32, 226, 234},{23, 224, 232},{13, 224, 231},{3, 224, 232},{0, 221, 228},{0, 212, 220},{0, 204, 212},{0, 197, 205},{1, 190, 198},{0, 181, 188},{0, 174, 180},{0, 168, 173},{0, 159, 164},{0, 151, 157},{0, 143, 149},{0, 136, 140},{0, 129, 134},{0, 122, 124},{0, 113, 115},{0, 105, 108},{1, 97, 101},{1, 89, 92},{0, 83, 84},{0, 75, 76},{0, 67, 66},{0, 59, 59},{0, 51, 52},{0, 44, 43},{0, 35, 36},{1, 29, 28},{1, 21, 19},{0, 7, 8},{5, 8, 7}},{{224, 242, 243},{228, 255, 255},{209, 249, 249},{202, 246, 250},{192, 245, 249},{182, 244, 247},{173, 243, 248},{165, 241, 246},{156, 240, 245},{147, 239, 246},{138, 237, 243},{129, 237, 243},{120, 235, 243},{111, 235, 242},{102, 232, 240},{92, 231, 240},{85, 230, 239},{76, 229, 237},{67, 228, 237},{58, 226, 236},{48, 225, 236},{41, 223, 235},{32, 223, 233},{23, 220, 232},{13, 219, 232},{3, 220, 232},{0, 215, 229},{0, 207, 222},{0, 200, 215},{1, 192, 205},{1, 186, 198},{0, 177, 190},{0, 170, 181},{0, 164, 173},{0, 155, 165},{0, 147, 157},{0, 139, 149},{0, 133, 140},{0, 126, 133},{0, 119, 125},{0, 111, 116},{0, 103, 108},{0, 94, 101},{0, 87, 92},{0, 81, 84},{0, 73, 76},{0, 65, 67},{0, 57, 60},{0, 50, 53},{0, 43, 44},{0, 34, 36},{0, 28, 29},{0, 20, 20},{0, 7, 7},{5, 8, 7}},{{225, 243, 244},{228, 255, 255},{209, 247, 250},{202, 246, 251},{192, 245, 248},{182, 243, 248},{173, 242, 247},{165, 240, 246},{157, 238, 247},{147, 238, 246},{138, 236, 243},{129, 234, 244},{122, 233, 244},{112, 231, 243},{101, 229, 242},{92, 228, 240},{84, 225, 241},{77, 224, 239},{67, 224, 237},{58, 222, 238},{48, 220, 237},{41, 219, 235},{32, 218, 235},{22, 216, 234},{14, 214, 234},{4, 214, 235},{0, 210, 231},{0, 202, 224},{0, 195, 215},{0, 188, 206},{0, 181, 200},{0, 172, 191},{0, 166, 182},{0, 158, 173},{0, 150, 165},{0, 144, 159},{0, 136, 149},{0, 128, 141},{0, 122, 134},{0, 114, 125},{0, 108, 120},{0, 100, 110},{0, 92, 101},{0, 85, 93},{0, 78, 84},{0, 71, 77},{0, 63, 70},{0, 56, 60},{0, 49, 53},{0, 42, 44},{0, 34, 36},{1, 26, 29},{1, 19, 19},{0, 7, 7},{4, 7, 7}},{{224, 242, 244},{226, 255, 255},{209, 247, 250},{203, 245, 251},{191, 244, 249},{182, 243, 248},{173, 241, 246},{166, 238, 246},{156, 236, 248},{147, 236, 245},{137, 233, 244},{128, 232, 243},{122, 230, 243},{112, 228, 244},{103, 226, 243},{93, 225, 241},{84, 221, 241},{76, 221, 239},{67, 220, 240},{58, 217, 239},{49, 216, 237},{41, 215, 237},{31, 213, 236},{22, 211, 236},{13, 210, 236},{4, 208, 235},{0, 205, 231},{0, 199, 224},{0, 190, 215},{0, 183, 205},{0, 177, 199},{0, 168, 191},{0, 162, 183},{0, 155, 175},{0, 147, 165},{0, 141, 159},{0, 134, 150},{0, 126, 141},{0, 120, 135},{0, 112, 125},{1, 104, 119},{0, 97, 111},{0, 90, 100},{0, 83, 93},{0, 77, 85},{0, 69, 77},{0, 62, 71},{0, 54, 60},{0, 47, 53},{0, 41, 44},{0, 33, 35},{1, 25, 29},{0, 18, 20},{0, 6, 7},{4, 7, 7}},{{224, 241, 243},{227, 255, 255},{209, 246, 250},{202, 244, 250},{192, 242, 249},{182, 241, 248},{172, 238, 247},{165, 237, 246},{157, 235, 248},{147, 233, 246},{137, 232, 245},{129, 230, 245},{121, 228, 244},{111, 225, 243},{103, 224, 242},{94, 222, 242},{85, 219, 239},{75, 218, 239},{66, 217, 240},{58, 213, 238},{49, 213, 239},{40, 211, 237},{30, 209, 238},{22, 207, 236},{13, 205, 235},{3, 204, 236},{0, 200, 233},{1, 193, 225},{0, 186, 216},{0, 179, 206},{0, 173, 200},{0, 166, 192},{0, 158, 184},{0, 151, 175},{0, 145, 167},{0, 138, 158},{0, 130, 150},{0, 123, 142},{0, 116, 135},{0, 109, 129},{0, 103, 119},{0, 95, 111},{0, 88, 102},{0, 81, 92},{0, 75, 86},{0, 68, 78},{0, 61, 70},{0, 55, 58},{0, 46, 52},{0, 39, 46},{0, 32, 36},{0, 26, 28},{0, 18, 20},{0, 5, 7},{4, 8, 7}},{{223, 240, 242},{228, 255, 255},{209, 244, 251},{201, 242, 249},{192, 241, 250},{183, 239, 249},{172, 236, 248},{164, 235, 247},{157, 233, 247},{147, 231, 247},{138, 229, 245},{129, 227, 246},{121, 224, 245},{111, 222, 243},{103, 221, 242},{94, 219, 243},{85, 217, 241},{75, 215, 240},{66, 213, 240},{59, 211, 239},{49, 208, 238},{40, 207, 236},{30, 205, 238},{23, 203, 238},{14, 201, 237},{4, 199, 237},{0, 194, 234},{0, 189, 226},{0, 183, 218},{0, 174, 208},{0, 168, 201},{0, 162, 191},{0, 154, 183},{0, 147, 175},{0, 140, 168},{0, 134, 159},{0, 127, 150},{0, 121, 144},{0, 114, 135},{0, 107, 128},{0, 100, 119},{0, 93, 110},{0, 85, 102},{0, 79, 92},{0, 73, 86},{0, 66, 78},{0, 59, 69},{0, 52, 61},{0, 45, 52},{0, 38, 45},{0, 31, 35},{0, 26, 29},{0, 17, 21},{0, 5, 8},{4, 8, 7}},{{223, 240, 242},{229, 255, 255},{209, 243, 251},{202, 241, 250},{192, 240, 251},{183, 237, 249},{173, 235, 249},{165, 232, 248},{155, 230, 246},{146, 228, 248},{140, 225, 246},{130, 223, 247},{121, 221, 246},{111, 219, 244},{103, 216, 242},{93, 215, 243},{84, 211, 243},{76, 209, 241},{67, 208, 241},{58, 206, 239},{49, 204, 241},{41, 201, 239},{31, 199, 238},{22, 196, 238},{13, 194, 237},{3, 193, 237},{0, 189, 235},{0, 182, 227},{0, 176, 217},{1, 169, 209},{1, 162, 202},{0, 156, 193},{0, 149, 183},{0, 142, 175},{0, 136, 168},{0, 129, 161},{0, 122, 151},{0, 116, 143},{0, 109, 137},{0, 104, 129},{0, 97, 120},{0, 90, 111},{0, 83, 102},{0, 77, 93},{0, 71, 85},{0, 64, 80},{0, 56, 71},{0, 50, 61},{0, 44, 53},{0, 36, 45},{0, 31, 37},{0, 24, 29},{0, 16, 21},{0, 6, 7},{4, 8, 7}},{{224, 239, 242},{228, 255, 255},{209, 242, 251},{202, 240, 249},{192, 238, 251},{183, 235, 249},{173, 233, 249},{165, 230, 247},{154, 227, 246},{147, 225, 247},{140, 223, 245},{130, 221, 245},{121, 218, 247},{110, 214, 244},{103, 213, 242},{94, 211, 244},{84, 208, 242},{75, 205, 242},{66, 203, 241},{58, 201, 241},{48, 198, 240},{42, 196, 238},{32, 194, 239},{23, 191, 237},{13, 188, 237},{2, 187, 238},{0, 182, 235},{0, 176, 226},{0, 171, 218},{1, 164, 210},{1, 158, 202},{0, 151, 193},{0, 144, 185},{0, 138, 176},{0, 132, 168},{0, 125, 162},{0, 119, 152},{0, 113, 142},{0, 106, 136},{0, 101, 129},{0, 93, 119},{0, 87, 112},{0, 81, 102},{0, 75, 94},{0, 68, 85},{0, 62, 79},{0, 55, 71},{0, 48, 61},{0, 43, 54},{0, 36, 45},{0, 29, 36},{1, 23, 30},{0, 16, 22},{0, 5, 7},{4, 7, 7}},{{224, 239, 242},{227, 254, 255},{210, 242, 251},{201, 239, 249},{191, 236, 249},{183, 233, 249},{174, 231, 249},{166, 228, 247},{156, 225, 248},{147, 224, 247},{137, 220, 245},{129, 218, 245},{121, 215, 244},{111, 212, 243},{102, 210, 244},{95, 207, 244},{85, 205, 243},{76, 201, 242},{67, 199, 242},{59, 197, 242},{49, 193, 241},{41, 191, 238},{31, 189, 240},{23, 185, 239},{13, 183, 238},{4, 180, 240},{0, 176, 236},{0, 171, 227},{0, 166, 218},{0, 158, 209},{0, 152, 202},{0, 145, 194},{0, 140, 186},{0, 133, 177},{0, 128, 168},{0, 122, 161},{0, 115, 152},{0, 109, 145},{0, 103, 136},{0, 97, 128},{0, 91, 119},{0, 84, 112},{0, 78, 102},{0, 72, 95},{0, 65, 87},{0, 60, 78},{0, 53, 69},{0, 47, 61},{0, 42, 55},{0, 35, 45},{0, 29, 38},{0, 22, 29},{0, 15, 20},{0, 4, 6},{4, 8, 7}},{{223, 238, 242},{227, 254, 255},{209, 241, 251},{201, 238, 249},{192, 236, 250},{182, 232, 249},{174, 228, 248},{165, 226, 248},{156, 222, 248},{147, 219, 246},{137, 217, 245},{128, 214, 245},{120, 211, 245},{112, 208, 243},{102, 205, 245},{94, 202, 244},{85, 200, 243},{76, 196, 241},{67, 194, 242},{57, 192, 241},{48, 188, 241},{40, 185, 239},{31, 183, 240},{23, 179, 238},{13, 177, 238},{3, 174, 239},{0, 169, 235},{0, 164, 227},{0, 159, 219},{0, 152, 209},{0, 145, 202},{0, 140, 193},{0, 135, 185},{0, 127, 176},{0, 122, 168},{0, 117, 160},{0, 111, 152},{0, 104, 145},{0, 97, 136},{0, 93, 129},{0, 87, 120},{0, 81, 111},{0, 75, 102},{0, 69, 94},{0, 62, 88},{0, 57, 79},{0, 52, 70},{0, 46, 61},{0, 40, 55},{0, 33, 45},{0, 27, 37},{0, 20, 29},{0, 15, 19},{0, 5, 6},{4, 8, 8}},{{224, 238, 242},{227, 253, 255},{211, 239, 252},{202, 235, 251},{192, 233, 251},{183, 230, 250},{174, 226, 249},{165, 224, 249},{156, 220, 248},{148, 217, 248},{139, 214, 247},{130, 210, 247},{122, 208, 246},{113, 206, 246},{103, 201, 245},{94, 199, 245},{86, 195, 244},{78, 192, 244},{68, 189, 243},{60, 186, 242},{50, 183, 242},{42, 180, 242},{33, 176, 242},{24, 173, 240},{14, 170, 239},{4, 167, 240},{0, 163, 236},{0, 158, 228},{0, 153, 220},{0, 146, 211},{0, 140, 203},{0, 135, 194},{1, 129, 187},{1, 123, 179},{0, 117, 171},{0, 112, 162},{0, 107, 154},{0, 100, 146},{1, 94, 138},{1, 90, 130},{1, 83, 120},{0, 77, 112},{0, 72, 103},{0, 65, 94},{0, 61, 88},{0, 55, 79},{0, 49, 71},{0, 43, 62},{0, 38, 54},{0, 32, 44},{0, 26, 38},{0, 20, 29},{0, 14, 20},{0, 4, 6},{4, 8, 7}},{{224, 238, 242},{228, 252, 255},{211, 239, 252},{202, 234, 251},{192, 231, 251},{182, 228, 250},{174, 224, 248},{166, 221, 249},{156, 218, 248},{147, 214, 247},{139, 211, 247},{129, 208, 247},{122, 204, 245},{112, 201, 246},{103, 198, 244},{94, 194, 244},{86, 191, 245},{78, 188, 245},{68, 184, 243},{59, 181, 241},{51, 178, 241},{43, 174, 242},{33, 171, 242},{24, 167, 240},{14, 164, 238},{4, 161, 240},{0, 158, 237},{0, 153, 228},{0, 146, 220},{0, 141, 212},{0, 136, 203},{0, 130, 194},{1, 124, 187},{1, 118, 178},{0, 113, 170},{0, 108, 163},{1, 102, 155},{0, 97, 145},{1, 92, 137},{1, 86, 129},{1, 79, 120},{0, 74, 112},{0, 69, 104},{0, 64, 95},{0, 59, 88},{0, 53, 79},{0, 46, 70},{0, 42, 62},{0, 36, 54},{0, 31, 45},{1, 25, 38},{1, 20, 30},{1, 14, 21},{0, 4, 6},{4, 8, 7}},{{223, 236, 242},{228, 251, 255},{210, 237, 252},{201, 233, 252},{192, 230, 250},{183, 227, 249},{173, 221, 248},{165, 219, 249},{156, 216, 248},{147, 212, 247},{138, 208, 246},{129, 205, 246},{123, 201, 246},{113, 197, 245},{103, 194, 245},{94, 190, 244},{86, 186, 244},{76, 182, 244},{67, 180, 243},{59, 175, 242},{49, 171, 242},{41, 168, 239},{32, 165, 240},{24, 161, 239},{14, 157, 240},{3, 154, 239},{0, 151, 235},{0, 146, 228},{0, 140, 221},{0, 135, 211},{0, 130, 204},{0, 124, 194},{0, 119, 186},{0, 113, 179},{0, 108, 170},{0, 103, 162},{0, 98, 155},{0, 93, 145},{0, 88, 137},{0, 82, 128},{0, 76, 119},{0, 72, 112},{0, 67, 104},{0, 61, 96},{0, 56, 88},{0, 50, 79},{0, 46, 71},{0, 40, 61},{0, 35, 54},{0, 30, 47},{0, 24, 38},{0, 19, 28},{0, 14, 21},{0, 3, 8},{4, 6, 8}},{{223, 237, 242},{227, 250, 255},{209, 235, 251},{201, 231, 251},{191, 228, 252},{184, 225, 249},{174, 220, 249},{165, 216, 249},{155, 213, 248},{146, 210, 246},{138, 206, 246},{130, 202, 248},{123, 198, 247},{113, 194, 245},{103, 190, 244},{93, 187, 243},{86, 183, 244},{77, 178, 244},{68, 176, 243},{60, 171, 243},{50, 167, 243},{41, 163, 241},{32, 160, 241},{24, 157, 240},{13, 152, 240},{4, 147, 241},{0, 144, 237},{0, 140, 229},{0, 135, 222},{1, 129, 212},{0, 125, 204},{0, 120, 194},{0, 115, 186},{0, 109, 179},{0, 104, 172},{1, 99, 163},{1, 94, 155},{0, 90, 145},{0, 84, 137},{1, 80, 130},{0, 74, 121},{0, 69, 113},{0, 64, 104},{0, 59, 96},{0, 54, 88},{0, 49, 80},{0, 43, 72},{0, 38, 62},{0, 34, 55},{0, 28, 46},{0, 23, 38},{0, 18, 29},{0, 14, 20},{0, 3, 8},{4, 6, 8}},{{223, 235, 242},{228, 249, 255},{210, 235, 253},{201, 230, 252},{191, 226, 251},{183, 221, 250},{174, 218, 250},{167, 215, 250},{155, 209, 248},{146, 207, 248},{139, 202, 248},{130, 198, 248},{122, 194, 248},{113, 191, 247},{104, 186, 246},{94, 181, 245},{85, 178, 245},{77, 174, 246},{69, 170, 244},{60, 165, 243},{49, 161, 243},{42, 158, 242},{33, 154, 243},{23, 149, 241},{15, 146, 241},{5, 142, 243},{0, 136, 239},{0, 133, 231},{1, 128, 222},{1, 124, 212},{0, 118, 206},{0, 114, 198},{0, 109, 188},{0, 104, 180},{0, 99, 170},{1, 94, 163},{0, 89, 155},{1, 85, 146},{1, 81, 137},{1, 76, 129},{1, 71, 122},{0, 66, 112},{0, 60, 104},{0, 55, 97},{0, 53, 88},{0, 47, 80},{0, 40, 72},{0, 36, 62},{0, 33, 54},{0, 27, 47},{0, 22, 39},{0, 18, 29},{0, 13, 20},{0, 3, 7},{4, 6, 8}},{{223, 235, 242},{228, 249, 255},{209, 234, 252},{200, 229, 252},{190, 225, 251},{183, 220, 250},{173, 216, 250},{166, 212, 249},{156, 206, 247},{147, 203, 247},{138, 199, 248},{129, 195, 247},{122, 190, 246},{113, 187, 247},{104, 181, 247},{94, 177, 246},{85, 174, 245},{76, 170, 245},{68, 166, 243},{59, 160, 242},{49, 156, 244},{41, 152, 243},{32, 148, 242},{23, 143, 239},{15, 140, 241},{3, 134, 242},{0, 130, 239},{0, 126, 231},{0, 121, 222},{0, 117, 211},{0, 113, 206},{0, 108, 196},{0, 103, 187},{1, 98, 181},{1, 95, 171},{0, 91, 164},{0, 85, 155},{0, 81, 146},{0, 76, 137},{0, 72, 129},{0, 67, 121},{0, 63, 114},{0, 57, 105},{0, 52, 97},{0, 49, 88},{0, 45, 80},{0, 39, 73},{0, 35, 63},{0, 31, 55},{0, 26, 47},{0, 21, 38},{0, 17, 30},{0, 12, 20},{0, 3, 7},{4, 6, 8}},{{223, 234, 242},{227, 248, 255},{209, 231, 253},{201, 228, 251},{192, 223, 251},{183, 219, 250},{172, 214, 249},{165, 210, 250},{156, 206, 250},{147, 200, 247},{137, 197, 245},{130, 192, 247},{122, 188, 247},{113, 183, 248},{103, 178, 246},{95, 174, 245},{87, 169, 245},{75, 164, 245},{67, 161, 245},{59, 156, 244},{51, 150, 245},{41, 147, 242},{32, 144, 242},{22, 137, 242},{13, 132, 241},{4, 129, 241},{0, 126, 238},{0, 121, 230},{0, 116, 223},{0, 112, 213},{0, 109, 205},{0, 104, 195},{0, 98, 189},{1, 94, 182},{1, 90, 172},{0, 86, 163},{1, 81, 155},{0, 78, 148},{1, 74, 139},{1, 69, 130},{0, 63, 120},{0, 59, 114},{0, 55, 106},{0, 51, 95},{0, 47, 88},{0, 43, 80},{0, 37, 73},{0, 34, 64},{0, 29, 55},{0, 24, 47},{0, 20, 38},{0, 16, 28},{0, 12, 21},{0, 2, 10},{4, 6, 8}},{{223, 234, 242},{228, 247, 255},{210, 231, 253},{201, 227, 251},{193, 222, 251},{183, 217, 250},{173, 211, 249},{165, 208, 250},{156, 203, 250},{147, 198, 248},{138, 193, 246},{129, 188, 248},{122, 184, 248},{113, 180, 248},{103, 175, 246},{95, 170, 245},{86, 166, 245},{76, 160, 245},{68, 155, 246},{59, 151, 243},{50, 147, 244},{41, 142, 243},{33, 137, 243},{23, 132, 243},{15, 126, 242},{5, 123, 242},{0, 119, 239},{0, 115, 231},{0, 111, 222},{0, 106, 213},{0, 102, 205},{0, 98, 196},{0, 94, 190},{1, 89, 182},{1, 85, 172},{1, 82, 163},{0, 78, 155},{1, 74, 148},{1, 69, 139},{0, 65, 130},{0, 61, 121},{1, 56, 113},{1, 51, 105},{0, 48, 95},{0, 45, 87},{0, 40, 80},{0, 35, 72},{0, 32, 64},{0, 28, 55},{0, 23, 47},{0, 19, 39},{0, 15, 28},{0, 11, 21},{0, 2, 9},{4, 6, 8}},{{223, 233, 242},{227, 245, 255},{209, 229, 253},{200, 225, 250},{191, 220, 251},{184, 215, 252},{175, 209, 251},{165, 205, 250},{157, 200, 248},{148, 195, 250},{139, 190, 250},{130, 185, 248},{121, 180, 247},{112, 176, 247},{103, 171, 247},{95, 165, 247},{86, 161, 246},{76, 156, 246},{68, 151, 247},{60, 145, 244},{51, 140, 243},{43, 136, 245},{32, 131, 244},{24, 126, 243},{14, 120, 243},{6, 116, 244},{2, 111, 241},{1, 107, 233},{1, 103, 223},{1, 99, 214},{0, 95, 208},{0, 92, 198},{1, 89, 191},{1, 85, 182},{1, 80, 172},{1, 76, 164},{1, 72, 156},{0, 68, 147},{1, 64, 138},{1, 61, 131},{0, 57, 122},{0, 53, 115},{1, 49, 107},{1, 45, 96},{0, 41, 88},{1, 38, 81},{0, 33, 72},{1, 30, 63},{1, 27, 56},{0, 22, 47},{0, 18, 39},{1, 14, 31},{1, 11, 22},{0, 1, 8},{4, 6, 8}},{{223, 231, 242},{227, 245, 255},{210, 228, 253},{200, 224, 250},{191, 219, 252},{184, 213, 252},{175, 207, 251},{166, 202, 250},{157, 197, 249},{148, 193, 249},{140, 188, 249},{130, 182, 249},{121, 176, 248},{113, 173, 249},{103, 167, 248},{95, 161, 247},{86, 157, 247},{76, 152, 247},{68, 146, 247},{60, 141, 244},{51, 135, 244},{43, 131, 246},{33, 126, 245},{25, 120, 243},{15, 114, 244},{6, 110, 244},{1, 104, 242},{1, 100, 233},{1, 99, 224},{1, 94, 215},{1, 90, 207},{1, 86, 198},{2, 83, 190},{2, 80, 182},{0, 76, 172},{0, 72, 163},{0, 68, 156},{0, 65, 147},{1, 61, 139},{0, 57, 131},{0, 54, 123},{0, 50, 115},{0, 47, 106},{1, 43, 96},{1, 38, 88},{1, 36, 81},{0, 32, 72},{2, 29, 62},{1, 25, 56},{0, 21, 47},{0, 17, 38},{0, 13, 30},{0, 10, 22},{0, 1, 8},{4, 6, 8}},{{223, 230, 242},{228, 244, 255},{211, 229, 253},{201, 222, 253},{192, 218, 252},{183, 212, 251},{174, 205, 249},{167, 200, 249},{157, 194, 251},{148, 189, 250},{139, 186, 249},{130, 179, 248},{122, 173, 248},{112, 168, 248},{105, 163, 247},{95, 158, 246},{86, 153, 246},{76, 147, 246},{68, 141, 246},{60, 136, 246},{50, 131, 245},{43, 126, 245},{34, 120, 244},{24, 113, 244},{16, 109, 244},{5, 105, 246},{0, 100, 242},{1, 95, 232},{1, 91, 224},{2, 89, 215},{1, 86, 208},{1, 82, 196},{2, 79, 189},{1, 75, 182},{0, 71, 173},{1, 68, 164},{0, 65, 156},{1, 61, 148},{1, 57, 140},{1, 54, 132},{0, 51, 124},{0, 48, 113},{1, 45, 104},{1, 40, 97},{0, 36, 88},{1, 34, 80},{0, 30, 73},{0, 27, 63},{0, 23, 54},{0, 19, 47},{0, 16, 38},{0, 13, 28},{0, 10, 21},{0, 1, 8},{4, 6, 7}},{{223, 230, 242},{227, 243, 255},{210, 228, 253},{201, 221, 252},{192, 216, 253},{184, 210, 252},{173, 204, 250},{166, 199, 249},{156, 191, 250},{147, 186, 250},{139, 182, 249},{129, 176, 248},{122, 171, 249},{113, 165, 248},{103, 159, 246},{94, 154, 246},{86, 148, 247},{76, 142, 246},{67, 137, 245},{60, 132, 246},{50, 126, 247},{43, 120, 245},{33, 114, 244},{24, 108, 245},{14, 102, 244},{5, 96, 244},{0, 93, 242},{0, 89, 232},{1, 86, 225},{1, 82, 214},{1, 80, 208},{1, 77, 198},{1, 73, 190},{1, 69, 182},{1, 67, 173},{0, 65, 164},{0, 60, 155},{0, 57, 148},{0, 54, 140},{0, 52, 131},{0, 47, 123},{0, 44, 114},{0, 41, 104},{0, 37, 97},{0, 34, 89},{0, 32, 79},{0, 28, 73},{0, 25, 64},{0, 22, 55},{0, 18, 47},{0, 15, 39},{0, 13, 30},{0, 9, 21},{0, 1, 7},{4, 6, 8}},{{223, 230, 243},{228, 242, 255},{210, 226, 252},{201, 219, 252},{190, 214, 251},{185, 208, 253},{175, 202, 251},{165, 197, 250},{157, 190, 250},{148, 185, 250},{140, 178, 250},{130, 172, 249},{122, 167, 250},{113, 162, 249},{104, 155, 248},{95, 148, 248},{87, 143, 248},{76, 137, 248},{68, 132, 247},{62, 127, 248},{51, 120, 247},{44, 114, 247},{34, 108, 246},{24, 102, 245},{14, 96, 245},{4, 90, 245},{0, 86, 241},{1, 84, 233},{1, 81, 225},{1, 76, 215},{2, 74, 210},{2, 71, 200},{2, 68, 191},{2, 65, 184},{0, 61, 174},{0, 59, 165},{0, 55, 156},{0, 53, 148},{2, 51, 141},{1, 48, 132},{0, 43, 124},{0, 41, 115},{0, 38, 106},{0, 34, 98},{0, 32, 89},{1, 29, 81},{1, 26, 73},{0, 23, 65},{0, 20, 56},{0, 17, 47},{0, 15, 39},{0, 11, 30},{0, 7, 21},{0, 0, 8},{4, 6, 9}},{{222, 230, 242},{226, 241, 255},{210, 225, 253},{201, 218, 251},{190, 212, 251},{184, 205, 252},{174, 200, 250},{165, 195, 251},{157, 187, 250},{149, 182, 250},{140, 176, 250},{131, 169, 250},{121, 163, 250},{112, 158, 249},{105, 151, 249},{95, 145, 249},{86, 139, 249},{76, 133, 248},{68, 128, 248},{61, 121, 248},{51, 115, 246},{44, 110, 247},{34, 103, 246},{25, 96, 246},{15, 89, 245},{6, 84, 246},{1, 80, 242},{1, 77, 233},{1, 74, 225},{2, 72, 217},{1, 69, 210},{2, 66, 201},{2, 63, 192},{1, 60, 182},{0, 57, 173},{0, 55, 166},{0, 51, 158},{1, 49, 150},{1, 47, 141},{0, 44, 132},{0, 40, 124},{0, 38, 115},{1, 35, 106},{1, 32, 98},{0, 29, 89},{1, 26, 81},{1, 24, 73},{0, 22, 65},{0, 19, 56},{0, 15, 46},{0, 13, 39},{0, 10, 29},{0, 6, 21},{0, 0, 9},{4, 5, 9}},{{222, 230, 242},{228, 241, 255},{209, 223, 254},{201, 217, 253},{192, 210, 252},{183, 204, 251},{174, 197, 250},{165, 192, 250},{155, 184, 251},{148, 178, 250},{139, 173, 248},{129, 166, 249},{121, 160, 248},{112, 153, 249},{102, 147, 249},{95, 140, 249},{86, 135, 249},{77, 129, 247},{68, 124, 247},{60, 116, 247},{51, 110, 248},{42, 104, 247},{34, 97, 246},{25, 90, 245},{15, 84, 245},{6, 78, 246},{0, 73, 243},{1, 71, 234},{1, 68, 226},{1, 66, 216},{1, 62, 209},{2, 60, 200},{1, 59, 191},{0, 56, 183},{0, 52, 173},{0, 51, 165},{0, 48, 157},{1, 44, 151},{0, 43, 140},{0, 40, 132},{0, 38, 123},{0, 35, 115},{0, 32, 105},{1, 30, 97},{0, 28, 88},{1, 25, 81},{1, 22, 73},{0, 19, 63},{0, 17, 56},{0, 15, 47},{0, 13, 39},{0, 10, 31},{0, 6, 20},{0, 0, 8},{5, 5, 9}},{{222, 229, 241},{227, 240, 255},{208, 222, 253},{200, 215, 252},{192, 208, 253},{183, 202, 252},{174, 195, 250},{167, 189, 251},{156, 182, 252},{147, 176, 249},{139, 171, 248},{129, 164, 249},{122, 157, 248},{113, 150, 249},{103, 144, 249},{95, 136, 249},{86, 130, 249},{76, 124, 247},{68, 118, 248},{61, 112, 248},{50, 104, 247},{42, 99, 246},{33, 91, 246},{24, 85, 245},{15, 79, 245},{6, 71, 246},{0, 67, 242},{0, 65, 234},{0, 62, 226},{1, 60, 216},{1, 57, 209},{1, 55, 199},{1, 53, 193},{1, 51, 184},{0, 48, 174},{0, 46, 165},{0, 43, 157},{0, 40, 150},{0, 39, 140},{0, 37, 132},{0, 35, 123},{1, 33, 116},{1, 29, 107},{1, 28, 96},{0, 25, 89},{0, 22, 80},{0, 20, 74},{0, 18, 64},{0, 15, 57},{0, 14, 46},{0, 11, 38},{0, 8, 31},{0, 6, 20},{0, 0, 8},{5, 5, 9}},{{222, 227, 241},{227, 238, 255},{210, 221, 253},{202, 214, 252},{194, 209, 254},{183, 201, 252},{174, 193, 250},{167, 188, 251},{156, 179, 250},{146, 173, 251},{139, 166, 251},{131, 160, 251},{122, 153, 249},{114, 147, 251},{105, 141, 250},{95, 133, 249},{87, 126, 250},{78, 119, 250},{69, 112, 248},{61, 106, 249},{52, 100, 248},{44, 94, 248},{34, 86, 248},{26, 79, 247},{17, 72, 247},{7, 65, 248},{1, 61, 244},{2, 59, 236},{2, 56, 228},{2, 55, 218},{2, 53, 210},{3, 51, 200},{1, 47, 194},{1, 45, 185},{2, 43, 175},{2, 42, 167},{2, 40, 159},{1, 37, 150},{1, 35, 141},{0, 33, 133},{1, 31, 125},{1, 28, 117},{1, 26, 108},{1, 24, 98},{1, 23, 91},{1, 21, 82},{0, 18, 73},{1, 17, 65},{0, 14, 56},{0, 12, 46},{0, 9, 38},{0, 6, 30},{0, 5, 21},{0, 0, 8},{5, 5, 8}},{{222, 227, 241},{227, 236, 255},{210, 220, 254},{202, 213, 253},{193, 207, 253},{184, 198, 252},{173, 191, 251},{166, 185, 251},{156, 177, 250},{146, 169, 250},{138, 162, 251},{131, 156, 252},{123, 150, 250},{113, 142, 250},{104, 136, 249},{96, 129, 249},{87, 123, 250},{79, 115, 249},{69, 108, 248},{60, 102, 248},{51, 94, 248},{44, 87, 248},{34, 80, 249},{24, 73, 248},{16, 66, 247},{7, 58, 248},{0, 54, 243},{2, 53, 236},{2, 50, 229},{3, 50, 218},{2, 47, 209},{1, 44, 199},{1, 42, 193},{1, 41, 184},{2, 39, 175},{2, 37, 167},{2, 34, 160},{1, 33, 151},{1, 31, 140},{1, 29, 134},{1, 26, 126},{1, 24, 116},{0, 23, 108},{1, 21, 98},{0, 20, 90},{0, 18, 82},{0, 16, 73},{1, 15, 64},{0, 13, 56},{0, 11, 48},{0, 9, 39},{0, 6, 31},{0, 5, 21},{0, 0, 8},{4, 5, 8}},{{222, 227, 240},{227, 236, 255},{209, 219, 253},{201, 211, 252},{191, 205, 253},{184, 196, 252},{174, 188, 252},{166, 183, 252},{157, 176, 251},{148, 168, 251},{138, 160, 250},{130, 154, 251},{122, 148, 250},{112, 140, 249},{104, 132, 249},{96, 125, 249},{88, 117, 250},{78, 111, 249},{69, 104, 250},{60, 96, 248},{52, 90, 249},{44, 84, 249},{34, 75, 248},{26, 67, 248},{17, 60, 248},{6, 52, 247},{0, 48, 243},{2, 46, 236},{2, 44, 227},{2, 44, 218},{1, 42, 210},{1, 40, 201},{2, 39, 195},{1, 36, 185},{1, 35, 176},{2, 33, 167},{2, 30, 158},{0, 29, 150},{1, 28, 141},{1, 26, 135},{1, 24, 125},{0, 23, 117},{0, 21, 108},{1, 20, 99},{0, 18, 91},{1, 16, 81},{0, 15, 73},{0, 13, 64},{0, 11, 57},{1, 9, 48},{1, 7, 39},{0, 6, 30},{0, 4, 22},{0, 0, 9},{4, 4, 7}},{{222, 226, 240},{229, 235, 255},{210, 218, 253},{201, 210, 252},{191, 203, 253},{184, 195, 253},{174, 186, 252},{166, 181, 252},{156, 174, 252},{148, 165, 251},{140, 158, 250},{130, 150, 251},{121, 144, 249},{113, 136, 250},{105, 129, 249},{95, 120, 249},{86, 113, 249},{78, 106, 249},{69, 99, 250},{60, 91, 249},{50, 84, 248},{45, 78, 248},{33, 69, 247},{25, 62, 247},{17, 55, 248},{6, 45, 248},{0, 41, 245},{1, 41, 237},{2, 38, 230},{2, 38, 220},{2, 36, 211},{2, 35, 201},{1, 33, 194},{1, 31, 185},{1, 30, 175},{2, 30, 168},{1, 26, 158},{0, 26, 150},{2, 24, 141},{0, 23, 134},{0, 21, 125},{0, 20, 116},{0, 18, 107},{0, 18, 99},{0, 16, 92},{0, 14, 81},{0, 13, 72},{0, 11, 65},{0, 10, 57},{1, 7, 48},{1, 6, 39},{0, 5, 30},{0, 4, 22},{0, 0, 9},{4, 4, 7}},{{222, 225, 241},{228, 233, 255},{211, 217, 253},{203, 209, 252},{192, 201, 254},{183, 193, 252},{174, 184, 251},{167, 178, 252},{156, 169, 251},{148, 162, 251},{140, 155, 250},{131, 147, 250},{124, 140, 250},{114, 133, 250},{105, 124, 250},{96, 116, 250},{87, 109, 249},{78, 101, 249},{70, 94, 249},{61, 86, 250},{51, 78, 249},{44, 70, 248},{34, 64, 248},{26, 55, 248},{16, 46, 248},{7, 39, 249},{3, 35, 246},{2, 33, 237},{2, 32, 229},{3, 31, 221},{2, 31, 212},{2, 29, 201},{1, 27, 193},{2, 27, 185},{2, 26, 177},{2, 24, 167},{2, 23, 158},{1, 21, 150},{3, 20, 141},{1, 20, 134},{0, 17, 124},{1, 17, 116},{0, 16, 107},{1, 13, 98},{0, 11, 90},{0, 10, 81},{0, 11, 73},{1, 9, 64},{0, 7, 56},{1, 7, 49},{1, 6, 40},{0, 4, 30},{0, 2, 22},{0, 0, 9},{5, 5, 8}},{{222, 225, 241},{227, 233, 255},{210, 215, 253},{203, 207, 251},{193, 200, 252},{183, 190, 251},{174, 182, 250},{168, 176, 252},{158, 166, 251},{148, 160, 251},{139, 152, 249},{131, 144, 250},{124, 135, 251},{114, 128, 250},{105, 119, 249},{96, 113, 250},{88, 104, 249},{79, 96, 247},{70, 89, 249},{61, 82, 250},{52, 74, 249},{44, 65, 248},{34, 58, 247},{26, 50, 248},{16, 42, 247},{7, 34, 247},{2, 29, 243},{3, 28, 235},{3, 27, 227},{3, 26, 219},{3, 25, 211},{2, 23, 201},{1, 23, 192},{2, 22, 184},{2, 21, 176},{1, 20, 167},{3, 19, 160},{0, 17, 151},{1, 16, 140},{1, 16, 133},{1, 15, 124},{1, 14, 116},{1, 12, 107},{2, 11, 99},{2, 10, 90},{1, 9, 82},{0, 8, 73},{0, 8, 63},{0, 7, 56},{0, 6, 48},{0, 5, 39},{0, 4, 31},{0, 2, 21},{0, 0, 8},{5, 5, 8}},{{222, 225, 241},{227, 232, 255},{210, 214, 252},{202, 206, 251},{194, 198, 252},{185, 190, 252},{176, 182, 251},{167, 174, 250},{159, 166, 251},{150, 159, 251},{141, 151, 248},{132, 142, 249},{124, 134, 250},{115, 126, 249},{106, 118, 248},{97, 110, 248},{88, 101, 246},{80, 93, 246},{73, 87, 248},{64, 79, 247},{53, 70, 245},{45, 63, 246},{36, 54, 245},{27, 46, 244},{20, 37, 245},{9, 29, 244},{5, 24, 241},{5, 23, 233},{5, 22, 225},{4, 22, 216},{5, 22, 208},{5, 20, 199},{4, 20, 191},{4, 18, 182},{3, 17, 174},{3, 17, 165},{2, 16, 157},{2, 15, 149},{3, 14, 140},{2, 13, 132},{2, 13, 124},{2, 11, 114},{3, 11, 106},{4, 10, 98},{2, 9, 89},{1, 8, 81},{2, 7, 72},{2, 7, 63},{1, 5, 56},{0, 5, 47},{0, 4, 39},{0, 3, 30},{0, 2, 20},{0, 0, 7},{4, 5, 7}},{{223, 224, 239},{229, 231, 255},{210, 214, 251},{202, 206, 250},{196, 198, 252},{185, 190, 251},{176, 180, 249},{167, 174, 250},{159, 166, 249},{151, 157, 248},{143, 151, 248},{136, 143, 247},{126, 134, 247},{117, 125, 246},{109, 117, 245},{101, 109, 245},{91, 101, 244},{83, 93, 244},{76, 86, 245},{67, 77, 244},{57, 69, 243},{50, 62, 242},{39, 53, 241},{32, 44, 240},{26, 35, 241},{16, 27, 241},{11, 22, 237},{11, 22, 229},{8, 22, 221},{8, 21, 213},{8, 20, 205},{8, 19, 195},{8, 19, 188},{8, 18, 180},{6, 16, 171},{6, 16, 163},{5, 15, 154},{6, 14, 146},{4, 13, 138},{4, 13, 130},{5, 12, 121},{5, 11, 113},{5, 10, 104},{3, 9, 95},{1, 9, 87},{2, 8, 79},{3, 6, 70},{3, 6, 62},{3, 6, 55},{1, 5, 46},{0, 4, 38},{1, 3, 29},{0, 3, 21},{0, 0, 7},{4, 5, 7}},{{224, 225, 240},{229, 232, 255},{211, 214, 251},{203, 205, 250},{195, 198, 252},{188, 190, 249},{178, 181, 247},{171, 174, 248},{161, 164, 247},{153, 156, 246},{144, 147, 244},{138, 141, 245},{130, 133, 243},{120, 123, 243},{112, 115, 242},{103, 107, 242},{96, 101, 242},{87, 91, 241},{79, 83, 241},{70, 75, 239},{62, 67, 238},{55, 59, 237},{45, 51, 238},{36, 42, 236},{27, 34, 235},{17, 26, 236},{13, 21, 232},{14, 20, 224},{14, 20, 216},{14, 19, 208},{12, 19, 201},{11, 17, 191},{13, 16, 183},{12, 16, 176},{10, 14, 167},{10, 15, 160},{10, 15, 152},{8, 13, 144},{8, 12, 135},{8, 11, 127},{7, 11, 118},{6, 10, 112},{6, 9, 103},{5, 9, 93},{4, 8, 86},{6, 7, 77},{4, 6, 69},{4, 6, 62},{3, 5, 54},{2, 4, 45},{3, 4, 37},{2, 3, 29},{1, 2, 20},{0, 0, 7},{5, 5, 8}},{{223, 224, 240},{231, 232, 255},{213, 214, 250},{205, 204, 249},{196, 197, 250},{188, 189, 247},{180, 181, 246},{172, 172, 246},{163, 163, 245},{154, 156, 245},{147, 146, 243},{138, 139, 243},{130, 132, 241},{123, 123, 241},{114, 113, 239},{106, 105, 238},{98, 98, 239},{89, 90, 238},{81, 81, 237},{72, 73, 236},{64, 65, 234},{58, 57, 235},{48, 48, 234},{40, 40, 231},{31, 32, 231},{23, 23, 232},{20, 17, 229},{19, 16, 220},{17, 18, 212},{17, 17, 203},{16, 16, 196},{14, 16, 188},{13, 15, 181},{14, 14, 171},{13, 13, 163},{11, 12, 156},{12, 11, 148},{12, 11, 141},{10, 9, 132},{10, 9, 124},{9, 10, 116},{9, 8, 109},{8, 8, 101},{7, 8, 92},{7, 6, 84},{7, 6, 76},{4, 6, 68},{5, 5, 61},{2, 4, 53},{3, 3, 44},{3, 4, 36},{1, 3, 27},{1, 1, 19},{0, 0, 7},{5, 5, 8}},{{224, 224, 239},{232, 231, 255},{214, 214, 251},{206, 206, 249},{198, 197, 249},{189, 188, 247},{180, 180, 245},{173, 171, 244},{165, 162, 244},{156, 155, 243},{148, 147, 242},{141, 138, 242},{132, 130, 239},{124, 121, 238},{114, 113, 236},{107, 104, 236},{99, 97, 235},{91, 89, 236},{84, 80, 234},{77, 73, 233},{69, 63, 233},{61, 56, 231},{52, 46, 230},{43, 39, 230},{34, 31, 230},{26, 21, 228},{23, 16, 226},{22, 16, 220},{20, 16, 209},{19, 16, 199},{19, 15, 194},{19, 14, 186},{17, 14, 176},{17, 13, 169},{15, 12, 161},{15, 12, 153},{14, 11, 145},{12, 10, 137},{11, 10, 131},{11, 10, 122},{11, 8, 113},{10, 8, 108},{9, 7, 99},{10, 6, 89},{8, 6, 82},{7, 7, 76},{6, 5, 69},{5, 4, 60},{4, 4, 52},{2, 3, 43},{1, 3, 36},{2, 2, 28},{2, 1, 20},{0, 0, 7},{5, 4, 8}},{{225, 224, 240},{232, 231, 255},{213, 213, 249},{206, 206, 248},{199, 197, 248},{191, 187, 244},{181, 178, 243},{174, 170, 244},{166, 161, 243},{159, 154, 240},{150, 146, 239},{143, 137, 239},{134, 129, 236},{127, 120, 237},{118, 111, 236},{111, 102, 235},{102, 96, 234},{94, 88, 234},{88, 79, 233},{80, 71, 230},{72, 62, 229},{64, 54, 229},{56, 44, 229},{47, 36, 227},{38, 29, 225},{30, 19, 223},{26, 14, 220},{25, 14, 214},{24, 14, 207},{23, 13, 197},{22, 12, 191},{22, 12, 182},{21, 12, 174},{20, 10, 168},{18, 10, 160},{18, 10, 152},{17, 10, 144},{15, 10, 135},{15, 10, 127},{13, 8, 121},{13, 7, 111},{12, 7, 105},{11, 7, 97},{10, 6, 88},{8, 6, 81},{7, 6, 74},{8, 5, 67},{7, 5, 59},{5, 4, 52},{4, 4, 42},{2, 3, 36},{4, 3, 28},{4, 2, 19},{0, 0, 7},{4, 4, 8}},{{225, 224, 240},{231, 230, 255},{213, 213, 248},{209, 204, 245},{202, 195, 245},{193, 187, 243},{183, 177, 242},{176, 170, 240},{168, 161, 238},{161, 152, 237},{153, 145, 236},{145, 136, 235},{137, 129, 234},{129, 120, 234},{122, 110, 233},{115, 102, 232},{107, 95, 230},{99, 86, 229},{91, 77, 228},{83, 68, 225},{76, 60, 225},{68, 53, 225},{61, 43, 222},{53, 35, 221},{45, 26, 222},{35, 16, 221},{31, 10, 216},{31, 12, 209},{29, 12, 202},{29, 11, 192},{27, 11, 186},{26, 10, 177},{25, 10, 169},{24, 9, 163},{22, 8, 156},{22, 9, 149},{21, 8, 138},{19, 8, 131},{18, 8, 124},{15, 7, 118},{16, 6, 109},{15, 6, 102},{14, 5, 94},{13, 5, 86},{12, 5, 79},{10, 4, 71},{8, 4, 64},{7, 4, 57},{7, 3, 51},{7, 2, 41},{4, 3, 34},{4, 2, 27},{4, 2, 17},{0, 0, 5},{4, 4, 7}},{{226, 225, 238},{235, 231, 255},{215, 213, 248},{210, 204, 245},{203, 195, 244},{195, 187, 243},{184, 177, 240},{177, 170, 238},{169, 161, 236},{164, 153, 236},{156, 146, 235},{148, 137, 234},{140, 128, 232},{133, 119, 232},{125, 111, 228},{117, 102, 227},{112, 94, 226},{104, 85, 224},{96, 77, 222},{87, 69, 222},{80, 60, 220},{74, 53, 218},{66, 43, 217},{58, 35, 214},{50, 26, 212},{42, 17, 212},{37, 12, 208},{37, 12, 203},{36, 11, 196},{34, 11, 187},{31, 11, 180},{31, 11, 171},{30, 10, 164},{28, 9, 157},{27, 8, 150},{27, 8, 144},{26, 8, 135},{24, 9, 129},{21, 8, 122},{19, 7, 116},{19, 7, 107},{18, 6, 101},{17, 6, 92},{16, 5, 84},{15, 4, 78},{13, 4, 71},{8, 3, 63},{8, 3, 55},{9, 3, 49},{9, 2, 40},{5, 2, 33},{4, 2, 26},{3, 2, 17},{0, 0, 6},{4, 4, 7}},{{226, 224, 238},{235, 230, 255},{217, 212, 246},{209, 204, 242},{203, 195, 243},{194, 187, 241},{187, 178, 237},{180, 171, 236},{172, 161, 234},{166, 153, 234},{159, 145, 232},{152, 136, 230},{145, 128, 229},{137, 119, 227},{129, 111, 225},{123, 103, 224},{116, 95, 222},{108, 86, 220},{101, 79, 219},{93, 70, 217},{86, 60, 216},{78, 53, 214},{72, 43, 212},{65, 36, 209},{58, 27, 206},{50, 17, 205},{45, 12, 202},{44, 12, 196},{42, 13, 190},{40, 12, 182},{40, 11, 176},{37, 11, 168},{35, 10, 159},{34, 10, 152},{32, 11, 146},{30, 10, 139},{29, 9, 131},{28, 9, 125},{25, 8, 119},{24, 7, 112},{22, 7, 105},{20, 7, 96},{19, 6, 88},{18, 6, 82},{17, 5, 76},{14, 4, 67},{12, 4, 60},{11, 4, 53},{10, 4, 46},{9, 3, 39},{7, 2, 33},{6, 2, 26},{4, 1, 19},{0, 0, 6},{4, 4, 8}},{{226, 224, 237},{235, 231, 255},{219, 212, 245},{210, 204, 241},{204, 195, 241},{196, 187, 239},{189, 177, 235},{182, 170, 234},{175, 162, 233},{170, 154, 231},{162, 144, 228},{155, 135, 226},{149, 128, 226},{141, 119, 223},{133, 111, 221},{127, 102, 219},{120, 94, 216},{113, 86, 216},{105, 79, 213},{99, 69, 212},{91, 59, 210},{84, 53, 208},{78, 42, 205},{71, 35, 203},{64, 26, 200},{58, 17, 200},{52, 12, 197},{50, 11, 190},{47, 12, 183},{47, 12, 176},{46, 10, 169},{42, 10, 162},{40, 10, 153},{39, 10, 148},{36, 10, 142},{35, 10, 134},{33, 9, 125},{30, 8, 120},{28, 8, 114},{26, 7, 107},{26, 7, 102},{23, 5, 92},{22, 6, 85},{20, 6, 78},{19, 5, 73},{17, 4, 65},{14, 4, 58},{12, 4, 51},{10, 3, 44},{9, 3, 38},{7, 2, 31},{6, 2, 25},{4, 1, 18},{0, 0, 5},{4, 5, 7}},{{226, 223, 236},{236, 230, 254},{219, 213, 244},{214, 205, 242},{208, 196, 239},{200, 187, 236},{192, 177, 233},{186, 170, 232},{179, 161, 229},{174, 153, 227},{166, 144, 224},{159, 135, 222},{152, 128, 220},{146, 120, 219},{139, 112, 216},{132, 102, 213},{127, 93, 211},{120, 85, 209},{111, 76, 206},{105, 69, 203},{99, 60, 201},{93, 53, 199},{85, 43, 197},{78, 34, 195},{71, 25, 193},{65, 16, 191},{60, 12, 187},{57, 12, 181},{56, 11, 174},{54, 10, 167},{52, 10, 162},{50, 10, 154},{47, 10, 148},{45, 10, 142},{43, 8, 134},{42, 9, 129},{39, 8, 121},{35, 8, 114},{34, 7, 109},{32, 7, 103},{31, 7, 96},{28, 6, 89},{26, 6, 82},{24, 6, 75},{21, 6, 70},{19, 4, 63},{17, 4, 56},{15, 4, 49},{13, 3, 44},{11, 3, 36},{8, 2, 29},{7, 1, 22},{4, 1, 16},{0, 0, 5},{5, 4, 6}},{{226, 224, 235},{236, 231, 253},{220, 214, 242},{215, 205, 239},{208, 196, 237},{203, 188, 235},{195, 178, 232},{189, 170, 230},{182, 161, 227},{175, 153, 224},{168, 145, 223},{161, 136, 220},{156, 129, 216},{150, 120, 214},{143, 112, 212},{137, 103, 209},{132, 95, 206},{125, 86, 203},{117, 78, 201},{111, 69, 199},{105, 60, 197},{100, 53, 195},{90, 42, 191},{84, 34, 189},{79, 26, 188},{71, 17, 186},{66, 13, 180},{64, 13, 175},{63, 12, 169},{61, 10, 162},{58, 10, 156},{55, 10, 150},{52, 11, 144},{50, 11, 137},{49, 9, 130},{48, 9, 125},{44, 8, 117},{40, 8, 110},{39, 8, 104},{36, 8, 99},{34, 6, 93},{30, 6, 86},{28, 6, 79},{25, 5, 72},{24, 6, 67},{22, 5, 60},{20, 4, 54},{19, 4, 46},{16, 3, 43},{13, 2, 36},{10, 2, 28},{7, 2, 21},{4, 1, 15},{0, 0, 4},{5, 5, 5}},{{229, 224, 236},{239, 230, 255},{222, 212, 241},{215, 205, 237},{211, 197, 235},{204, 188, 232},{196, 178, 228},{190, 170, 227},{184, 161, 224},{179, 154, 222},{170, 145, 219},{165, 135, 216},{161, 128, 215},{154, 119, 212},{146, 111, 208},{140, 103, 204},{133, 96, 203},{128, 86, 200},{123, 78, 197},{116, 69, 196},{108, 59, 192},{104, 53, 190},{95, 43, 186},{88, 35, 183},{83, 27, 182},{76, 17, 178},{72, 12, 175},{71, 12, 169},{68, 12, 163},{65, 11, 156},{63, 11, 150},{60, 11, 145},{57, 10, 139},{55, 9, 133},{52, 9, 126},{51, 9, 121},{47, 7, 114},{44, 7, 107},{43, 8, 102},{40, 7, 96},{37, 6, 88},{34, 6, 83},{31, 6, 78},{28, 5, 71},{26, 5, 65},{23, 4, 59},{22, 4, 53},{20, 4, 46},{17, 3, 40},{13, 3, 35},{10, 2, 27},{8, 2, 20},{6, 2, 16},{0, 0, 5},{5, 4, 7}},{{229, 224, 235},{239, 229, 253},{224, 213, 239},{217, 205, 236},{213, 197, 234},{204, 188, 230},{197, 178, 226},{193, 171, 224},{187, 162, 221},{181, 154, 219},{174, 145, 216},{169, 137, 213},{163, 128, 212},{157, 120, 208},{150, 111, 204},{144, 104, 200},{138, 96, 199},{132, 87, 196},{126, 78, 193},{121, 70, 192},{115, 61, 187},{108, 54, 186},{102, 44, 182},{95, 35, 178},{89, 27, 175},{84, 18, 173},{79, 13, 169},{76, 13, 163},{75, 13, 157},{71, 11, 151},{69, 12, 146},{66, 12, 140},{62, 10, 134},{60, 10, 128},{57, 10, 123},{55, 9, 116},{51, 9, 110},{48, 9, 105},{46, 8, 99},{43, 8, 93},{39, 7, 86},{38, 7, 81},{34, 6, 75},{31, 5, 68},{28, 5, 63},{25, 3, 58},{23, 3, 50},{20, 4, 45},{18, 3, 39},{15, 3, 33},{12, 1, 26},{10, 2, 20},{6, 2, 15},{0, 0, 3},{5, 4, 6}},{{229, 223, 235},{240, 230, 252},{227, 214, 239},{220, 205, 235},{212, 197, 232},{207, 188, 228},{200, 177, 225},{195, 171, 221},{190, 162, 218},{183, 153, 216},{178, 145, 212},{172, 136, 209},{167, 129, 207},{161, 120, 204},{154, 112, 200},{148, 104, 198},{143, 94, 194},{137, 86, 190},{132, 79, 188},{126, 71, 185},{119, 61, 181},{115, 54, 178},{108, 44, 175},{102, 35, 171},{97, 28, 167},{91, 19, 166},{87, 13, 163},{83, 13, 155},{81, 13, 150},{77, 12, 144},{74, 11, 140},{71, 10, 134},{68, 11, 128},{66, 11, 122},{63, 9, 117},{58, 10, 111},{56, 10, 105},{53, 8, 101},{50, 8, 94},{47, 8, 88},{44, 7, 83},{40, 6, 77},{37, 6, 70},{34, 6, 65},{32, 5, 61},{30, 5, 54},{26, 4, 48},{23, 4, 43},{18, 3, 37},{17, 2, 30},{14, 2, 25},{10, 2, 20},{7, 2, 14},{0, 0, 2},{5, 5, 6}},{{230, 224, 235},{243, 231, 252},{227, 215, 238},{219, 205, 233},{214, 196, 231},{209, 186, 227},{204, 178, 224},{198, 171, 219},{191, 163, 216},{185, 153, 213},{181, 145, 209},{175, 137, 206},{169, 129, 202},{164, 122, 199},{157, 113, 196},{152, 103, 193},{147, 95, 190},{142, 87, 187},{136, 80, 183},{131, 71, 180},{124, 61, 177},{119, 54, 173},{113, 44, 169},{109, 36, 165},{103, 28, 162},{98, 18, 161},{93, 13, 158},{89, 14, 150},{85, 14, 145},{83, 14, 139},{80, 12, 135},{76, 11, 129},{73, 11, 123},{70, 12, 117},{67, 10, 112},{63, 10, 107},{60, 9, 101},{57, 7, 97},{53, 8, 91},{51, 8, 85},{47, 8, 80},{43, 7, 75},{40, 6, 68},{37, 6, 64},{35, 6, 57},{32, 5, 51},{27, 4, 46},{24, 4, 40},{20, 3, 36},{17, 2, 29},{15, 2, 24},{10, 2, 19},{7, 2, 13},{0, 0, 2},{4, 5, 5}},{{231, 224, 235},{244, 231, 251},{227, 213, 237},{220, 205, 231},{217, 196, 229},{211, 187, 227},{205, 178, 220},{199, 170, 217},{194, 163, 215},{190, 155, 213},{183, 145, 207},{178, 137, 203},{172, 129, 201},{167, 121, 197},{162, 113, 193},{157, 104, 190},{151, 96, 186},{146, 87, 183},{142, 78, 180},{136, 70, 176},{130, 62, 171},{124, 55, 169},{120, 45, 164},{113, 36, 159},{110, 29, 158},{104, 19, 154},{99, 15, 150},{96, 15, 146},{92, 15, 139},{88, 14, 135},{85, 14, 129},{81, 13, 122},{78, 11, 118},{74, 11, 114},{70, 12, 109},{67, 10, 103},{64, 9, 98},{62, 9, 93},{56, 9, 88},{53, 9, 83},{49, 8, 77},{47, 7, 72},{43, 7, 68},{39, 6, 62},{36, 6, 55},{33, 6, 50},{30, 4, 44},{25, 4, 39},{22, 3, 32},{18, 2, 30},{16, 2, 23},{12, 2, 18},{8, 1, 13},{0, 0, 1},{4, 5, 6}},{{231, 225, 234},{244, 232, 250},{228, 213, 236},{222, 205, 231},{218, 197, 226},{213, 188, 224},{207, 179, 220},{202, 171, 216},{197, 163, 213},{193, 154, 210},{186, 146, 205},{181, 137, 200},{177, 130, 199},{171, 120, 193},{165, 113, 188},{161, 105, 185},{155, 97, 182},{150, 87, 178},{146, 80, 175},{139, 71, 170},{134, 62, 166},{130, 55, 163},{125, 45, 160},{119, 38, 154},{114, 29, 150},{109, 20, 145},{106, 16, 141},{101, 16, 139},{97, 15, 134},{93, 14, 129},{91, 14, 123},{86, 14, 118},{83, 12, 115},{79, 12, 109},{75, 11, 104},{72, 11, 99},{68, 10, 94},{64, 9, 88},{59, 10, 83},{57, 9, 80},{53, 8, 74},{49, 7, 69},{45, 7, 65},{42, 6, 58},{39, 6, 51},{34, 6, 47},{32, 5, 43},{27, 5, 38},{24, 4, 32},{20, 3, 29},{16, 2, 22},{13, 2, 18},{8, 2, 12},{0, 0, 1},{4, 5, 6}},{{233, 224, 235},{244, 230, 249},{229, 213, 233},{225, 205, 230},{219, 196, 225},{213, 188, 220},{208, 180, 218},{206, 171, 214},{201, 163, 209},{194, 154, 206},{190, 146, 200},{185, 137, 196},{180, 130, 194},{174, 122, 189},{169, 114, 185},{165, 105, 182},{160, 96, 177},{155, 88, 172},{151, 80, 169},{145, 72, 164},{141, 62, 161},{136, 55, 157},{130, 46, 151},{125, 38, 149},{121, 29, 146},{116, 19, 142},{113, 15, 138},{108, 15, 133},{103, 14, 126},{99, 15, 122},{97, 14, 118},{92, 12, 114},{88, 13, 108},{85, 13, 102},{81, 12, 97},{76, 11, 94},{72, 11, 89},{69, 10, 85},{64, 10, 80},{61, 9, 76},{57, 8, 70},{53, 8, 65},{49, 7, 60},{45, 6, 54},{41, 6, 48},{37, 5, 45},{33, 5, 41},{30, 6, 35},{27, 4, 31},{22, 3, 25},{16, 3, 21},{13, 1, 17},{10, 2, 11},{0, 0, 1},{4, 4, 4}},{{233, 224, 234},{245, 231, 247},{230, 214, 232},{226, 205, 230},{220, 195, 226},{215, 188, 219},{210, 180, 215},{207, 171, 212},{202, 163, 207},{197, 155, 202},{194, 147, 199},{187, 138, 194},{183, 130, 189},{179, 122, 186},{174, 114, 182},{170, 105, 177},{165, 97, 173},{161, 89, 170},{156, 81, 166},{149, 73, 160},{146, 64, 156},{141, 56, 153},{136, 46, 147},{131, 39, 144},{126, 30, 140},{122, 21, 135},{118, 17, 130},{115, 17, 127},{109, 16, 122},{106, 16, 117},{102, 15, 114},{98, 13, 109},{94, 12, 103},{89, 13, 99},{85, 13, 94},{80, 11, 91},{75, 10, 85},{73, 10, 81},{70, 11, 78},{64, 9, 73},{59, 9, 67},{57, 8, 62},{53, 8, 57},{47, 7, 52},{43, 6, 48},{40, 7, 43},{34, 6, 37},{30, 5, 34},{28, 3, 30},{23, 3, 24},{17, 3, 21},{15, 3, 16},{11, 2, 10},{1, 0, 1},{5, 4, 5}},{{231, 223, 232},{245, 231, 248},{232, 215, 234},{228, 205, 226},{223, 196, 223},{218, 189, 219},{212, 179, 211},{206, 172, 209},{202, 163, 206},{200, 154, 201},{195, 146, 197},{190, 138, 192},{187, 129, 186},{181, 120, 182},{176, 112, 178},{173, 105, 174},{167, 96, 169},{162, 88, 166},{159, 80, 162},{154, 72, 155},{150, 63, 151},{145, 56, 148},{140, 45, 143},{135, 38, 137},{132, 30, 135},{127, 20, 130},{123, 16, 124},{119, 16, 122},{114, 15, 119},{110, 14, 113},{106, 14, 109},{101, 13, 105},{98, 12, 99},{93, 13, 95},{88, 12, 93},{83, 11, 87},{79, 10, 82},{78, 9, 78},{72, 9, 74},{68, 9, 70},{62, 8, 65},{58, 7, 60},{54, 8, 55},{49, 8, 52},{45, 5, 47},{40, 5, 41},{35, 6, 37},{31, 5, 34},{27, 3, 29},{23, 3, 23},{18, 3, 19},{15, 1, 15},{11, 2, 10},{0, 0, 2},{5, 5, 7}},{{232, 224, 231},{247, 230, 246},{234, 214, 234},{229, 205, 226},{223, 196, 221},{219, 189, 217},{213, 179, 211},{209, 171, 206},{206, 163, 204},{202, 155, 201},{196, 146, 194},{192, 137, 189},{188, 130, 186},{183, 121, 182},{179, 112, 176},{175, 104, 172},{170, 97, 167},{165, 89, 163},{162, 80, 159},{159, 72, 152},{155, 62, 149},{150, 56, 144},{146, 45, 137},{140, 37, 132},{137, 29, 130},{132, 19, 124},{128, 16, 120},{124, 15, 117},{119, 14, 112},{116, 14, 108},{111, 13, 105},{106, 12, 100},{101, 12, 96},{97, 12, 91},{93, 10, 88},{88, 11, 84},{82, 11, 78},{78, 10, 75},{73, 9, 73},{70, 9, 67},{64, 9, 62},{60, 7, 57},{56, 7, 53},{51, 7, 49},{48, 6, 45},{42, 5, 40},{39, 5, 37},{33, 5, 32},{28, 4, 27},{24, 3, 23},{20, 2, 19},{15, 2, 14},{10, 2, 9},{0, 0, 0},{6, 5, 6}},{{234, 224, 231},{250, 231, 244},{234, 213, 231},{229, 204, 225},{225, 195, 219},{221, 187, 214},{216, 178, 210},{212, 170, 204},{209, 163, 199},{205, 155, 196},{201, 145, 192},{195, 136, 186},{191, 129, 181},{187, 121, 179},{184, 112, 173},{179, 104, 167},{174, 95, 162},{171, 86, 160},{167, 79, 155},{161, 72, 149},{156, 61, 144},{153, 54, 139},{149, 46, 135},{144, 36, 128},{140, 27, 125},{137, 19, 121},{132, 15, 116},{129, 13, 112},{124, 13, 108},{118, 14, 103},{114, 13, 99},{111, 11, 97},{104, 11, 93},{98, 11, 88},{94, 11, 85},{90, 11, 79},{85, 11, 74},{81, 9, 71},{77, 8, 67},{73, 7, 63},{68, 8, 57},{64, 7, 53},{59, 6, 49},{54, 6, 45},{50, 5, 42},{44, 5, 38},{40, 4, 34},{37, 4, 28},{30, 4, 26},{26, 3, 21},{22, 2, 17},{17, 3, 14},{11, 2, 9},{2, 0, 0},{7, 4, 5}},{{235, 225, 232},{251, 231, 243},{235, 212, 228},{230, 204, 223},{226, 196, 219},{222, 187, 212},{219, 178, 207},{216, 171, 203},{210, 162, 197},{208, 153, 193},{203, 145, 188},{198, 137, 182},{197, 128, 176},{192, 120, 172},{189, 111, 166},{185, 103, 162},{181, 95, 156},{178, 87, 151},{172, 78, 147},{169, 70, 140},{165, 61, 136},{162, 54, 132},{159, 44, 127},{154, 35, 119},{150, 26, 116},{147, 18, 112},{142, 13, 106},{138, 13, 104},{133, 12, 99},{127, 13, 94},{123, 13, 91},{119, 11, 88},{112, 11, 85},{107, 11, 80},{102, 11, 76},{97, 10, 72},{92, 10, 67},{87, 9, 64},{83, 9, 62},{78, 8, 58},{73, 7, 52},{68, 6, 49},{63, 6, 46},{56, 6, 43},{52, 5, 40},{48, 4, 36},{42, 4, 32},{39, 4, 28},{31, 2, 25},{26, 3, 20},{23, 2, 16},{17, 3, 13},{13, 2, 9},{2, 0, 0},{7, 4, 4}},{{234, 223, 230},{250, 231, 242},{236, 212, 226},{233, 204, 221},{230, 196, 216},{226, 186, 209},{222, 178, 203},{219, 171, 199},{215, 161, 194},{211, 153, 188},{207, 144, 181},{205, 136, 177},{202, 128, 173},{199, 120, 166},{195, 111, 160},{191, 103, 155},{187, 94, 148},{184, 87, 143},{181, 78, 139},{178, 69, 132},{174, 60, 127},{172, 53, 123},{169, 43, 116},{163, 35, 109},{160, 26, 103},{158, 17, 98},{155, 13, 94},{149, 12, 92},{143, 12, 88},{137, 12, 85},{133, 10, 83},{126, 11, 77},{121, 11, 74},{116, 10, 71},{110, 9, 68},{105, 9, 65},{99, 9, 60},{93, 9, 57},{89, 8, 54},{83, 7, 51},{77, 6, 49},{72, 4, 46},{66, 5, 42},{61, 6, 38},{56, 5, 35},{50, 5, 31},{45, 3, 28},{39, 4, 25},{34, 3, 21},{30, 2, 20},{24, 2, 15},{20, 2, 13},{15, 0, 9},{3, 0, 0},{5, 5, 5}},{{236, 223, 229},{252, 231, 242},{239, 212, 225},{236, 204, 219},{234, 196, 213},{230, 187, 206},{226, 177, 199},{223, 169, 194},{219, 162, 190},{218, 154, 184},{213, 144, 177},{210, 136, 171},{208, 128, 167},{205, 119, 160},{201, 111, 152},{198, 103, 145},{195, 94, 140},{192, 86, 135},{190, 77, 128},{186, 68, 122},{184, 59, 117},{182, 52, 112},{178, 42, 104},{175, 34, 97},{172, 25, 91},{169, 15, 85},{166, 11, 82},{161, 11, 79},{155, 10, 76},{148, 11, 73},{144, 11, 71},{136, 9, 67},{131, 9, 64},{125, 9, 63},{120, 8, 60},{114, 8, 55},{106, 8, 52},{99, 8, 51},{95, 7, 49},{89, 6, 46},{83, 7, 43},{78, 6, 40},{71, 5, 37},{65, 5, 34},{60, 4, 30},{54, 4, 26},{49, 4, 24},{43, 2, 22},{37, 3, 19},{32, 2, 16},{25, 2, 14},{21, 2, 11},{15, 1, 7},{2, 0, 0},{5, 4, 5}},{{238, 223, 228},{255, 229, 238},{241, 213, 220},{239, 205, 216},{237, 195, 211},{232, 187, 204},{230, 177, 195},{228, 169, 189},{225, 160, 184},{224, 151, 180},{221, 144, 171},{217, 136, 163},{214, 127, 157},{212, 118, 150},{210, 108, 145},{209, 101, 140},{203, 92, 135},{203, 83, 128},{199, 75, 121},{194, 68, 114},{193, 58, 107},{190, 51, 104},{187, 42, 95},{184, 33, 88},{183, 24, 81},{181, 15, 75},{176, 10, 72},{170, 10, 68},{164, 10, 66},{158, 10, 64},{152, 9, 63},{145, 9, 61},{139, 9, 56},{133, 7, 54},{127, 7, 52},{120, 7, 50},{114, 7, 46},{109, 6, 42},{102, 6, 40},{98, 6, 38},{91, 6, 36},{83, 5, 32},{77, 4, 31},{70, 4, 29},{65, 4, 27},{60, 3, 22},{54, 2, 20},{46, 3, 19},{42, 2, 14},{35, 2, 11},{28, 2, 10},{22, 1, 9},{16, 0, 5},{5, 0, 0},{6, 5, 4}},{{239, 223, 227},{255, 229, 234},{243, 214, 218},{240, 204, 212},{239, 195, 207},{235, 187, 200},{234, 176, 191},{231, 170, 184},{230, 160, 179},{228, 151, 173},{225, 143, 166},{222, 135, 157},{221, 128, 151},{219, 118, 144},{218, 109, 136},{215, 101, 130},{211, 92, 125},{210, 83, 118},{209, 74, 111},{206, 68, 105},{205, 57, 96},{201, 51, 91},{199, 42, 84},{197, 31, 78},{194, 22, 71},{193, 14, 62},{188, 9, 59},{182, 9, 57},{176, 8, 53},{169, 9, 53},{163, 9, 50},{156, 8, 49},{149, 7, 46},{143, 6, 43},{136, 6, 42},{129, 7, 39},{123, 6, 37},{117, 7, 36},{109, 6, 33},{104, 4, 32},{96, 4, 30},{89, 5, 27},{82, 5, 25},{75, 4, 25},{70, 4, 22},{64, 4, 18},{57, 2, 17},{48, 3, 15},{43, 1, 11},{37, 2, 8},{30, 2, 7},{23, 1, 7},{17, 1, 4},{5, 0, 0},{7, 5, 4}},{{238, 223, 224},{255, 227, 231},{245, 210, 216},{242, 202, 209},{241, 192, 200},{240, 182, 194},{238, 173, 185},{236, 165, 178},{234, 156, 171},{234, 148, 163},{232, 138, 158},{230, 130, 149},{229, 121, 143},{227, 112, 134},{226, 103, 127},{225, 95, 119},{223, 86, 111},{221, 77, 105},{220, 68, 97},{219, 59, 90},{217, 49, 83},{214, 42, 75},{213, 33, 67},{211, 23, 60},{209, 14, 53},{210, 5, 45},{204, 0, 40},{198, 0, 38},{192, 0, 37},{183, 0, 36},{178, 0, 35},{169, 0, 34},{161, 0, 32},{154, 1, 30},{149, 1, 29},{141, 0, 27},{134, 1, 26},{127, 1, 25},{118, 1, 24},{112, 0, 22},{103, 1, 20},{98, 1, 20},{90, 0, 18},{81, 0, 17},{75, 0, 14},{69, 0, 14},{62, 0, 12},{53, 0, 10},{46, 0, 10},{40, 0, 8},{33, 0, 4},{26, 1, 3},{18, 1, 2},{5, 0, 0},{8, 5, 4}},{{239, 225, 226},{255, 231, 235},{249, 213, 218},{244, 205, 209},{243, 195, 200},{241, 187, 194},{240, 178, 186},{238, 170, 180},{236, 163, 173},{235, 154, 165},{233, 147, 157},{232, 137, 150},{232, 128, 143},{230, 120, 135},{228, 111, 128},{226, 104, 120},{224, 96, 114},{224, 86, 107},{222, 78, 98},{219, 71, 90},{218, 61, 84},{217, 53, 76},{215, 44, 67},{214, 35, 60},{214, 27, 52},{213, 19, 45},{208, 13, 39},{201, 13, 37},{193, 12, 38},{185, 12, 37},{179, 12, 35},{171, 11, 33},{163, 12, 31},{156, 11, 30},{150, 10, 30},{143, 10, 28},{134, 9, 27},{128, 7, 24},{121, 8, 25},{113, 7, 23},{105, 7, 21},{98, 6, 19},{91, 6, 18},{82, 5, 17},{75, 5, 16},{70, 4, 14},{63, 4, 11},{54, 4, 10},{48, 3, 9},{40, 2, 6},{33, 2, 6},{26, 2, 5},{18, 1, 2},{5, 0, 0},{8, 5, 4}},{{245, 244, 245},{255, 255, 255},{245, 242, 242},{240, 237, 238},{235, 233, 233},{231, 228, 228},{227, 223, 224},{222, 218, 219},{218, 214, 214},{214, 209, 209},{209, 204, 203},{204, 199, 199},{201, 195, 195},{197, 189, 190},{191, 184, 184},{187, 180, 180},{182, 174, 176},{178, 170, 169},{173, 165, 165},{169, 161, 160},{165, 155, 155},{160, 151, 150},{156, 146, 146},{152, 140, 141},{147, 136, 136},{142, 132, 131},{137, 127, 127},{133, 122, 122},{129, 118, 118},{123, 114, 114},{119, 109, 109},{114, 104, 105},{109, 100, 100},{104, 95, 95},{100, 91, 91},{94, 87, 87},{90, 82, 82},{85, 78, 78},{80, 74, 74},{76, 69, 69},{71, 65, 64},{66, 60, 60},{60, 55, 57},{56, 51, 52},{51, 48, 47},{47, 42, 43},{42, 38, 38},{36, 34, 34},{32, 29, 29},{27, 25, 25},{22, 20, 21},{17, 16, 16},{13, 12, 11},{2, 2, 2},{7, 6, 6}},{{246, 246, 246},{255, 255, 255},{244, 246, 246},{240, 241, 241},{234, 237, 237},{229, 233, 232},{225, 229, 229},{220, 225, 224},{215, 220, 219},{210, 216, 215},{205, 211, 211},{200, 207, 206},{195, 203, 202},{191, 198, 198},{186, 194, 192},{181, 190, 188},{176, 185, 183},{172, 181, 179},{167, 176, 175},{162, 171, 170},{157, 167, 166},{152, 163, 162},{148, 159, 158},{142, 154, 153},{138, 150, 149},{133, 146, 143},{128, 141, 139},{123, 136, 134},{119, 131, 129},{115, 126, 125},{110, 121, 120},{106, 116, 114},{101, 111, 110},{97, 106, 106},{92, 102, 100},{88, 96, 95},{83, 92, 90},{79, 87, 86},{74, 82, 81},{70, 77, 76},{65, 72, 72},{61, 67, 66},{56, 62, 61},{52, 57, 56},{48, 53, 51},{43, 48, 47},{39, 43, 42},{34, 38, 37},{30, 33, 32},{26, 28, 27},{21, 23, 23},{16, 18, 18},{12, 13, 13},{2, 3, 3},{7, 6, 7}},{{246, 245, 246},{255, 255, 255},{244, 244, 244},{240, 239, 239},{235, 235, 235},{231, 230, 231},{226, 225, 226},{221, 221, 221},{217, 217, 217},{212, 212, 212},{207, 207, 207},{203, 202, 203},{198, 198, 198},{193, 193, 193},{188, 188, 189},{184, 185, 184},{180, 179, 179},{174, 174, 175},{170, 170, 170},{165, 165, 165},{161, 161, 161},{156, 157, 157},{152, 152, 152},{147, 147, 147},{143, 142, 142},{138, 137, 138},{133, 133, 133},{128, 128, 128},{124, 124, 124},{120, 119, 119},{115, 114, 114},{110, 110, 110},{105, 105, 105},{101, 100, 101},{96, 96, 96},{91, 92, 91},{87, 87, 86},{83, 82, 82},{77, 78, 77},{73, 73, 73},{68, 68, 68},{63, 64, 64},{59, 59, 59},{54, 54, 54},{49, 49, 50},{45, 45, 45},{41, 41, 40},{36, 36, 35},{31, 31, 31},{26, 27, 27},{22, 21, 22},{17, 17, 17},{13, 13, 12},{3, 3, 3},{7, 7, 7}},{{245, 245, 246},{255, 255, 255},{244, 245, 245},{239, 240, 240},{235, 235, 235},{230, 230, 231},{225, 225, 226},{221, 221, 221},{217, 217, 216},{212, 212, 212},{207, 207, 208},{203, 203, 203},{198, 198, 199},{193, 194, 193},{189, 189, 188},{184, 184, 184},{180, 179, 180},{174, 174, 175},{169, 171, 170},{166, 165, 166},{161, 161, 161},{157, 156, 157},{151, 151, 151},{146, 147, 147},{143, 143, 142},{138, 138, 138},{132, 133, 133},{128, 129, 128},{124, 123, 124},{120, 119, 119},{115, 115, 115},{110, 110, 110},{105, 105, 106},{101, 101, 101},{96, 96, 96},{91, 92, 92},{87, 87, 87},{82, 82, 82},{77, 78, 77},{73, 72, 73},{69, 68, 68},{63, 64, 63},{59, 59, 59},{54, 54, 54},{50, 49, 50},{45, 45, 45},{40, 41, 40},{36, 36, 35},{31, 31, 32},{27, 27, 27},{21, 22, 21},{17, 17, 17},{13, 13, 12},{2, 2, 3},{7, 6, 7}},{{246, 245, 246},{255, 255, 255},{245, 244, 245},{240, 240, 240},{236, 235, 235},{230, 230, 231},{225, 227, 225},{221, 222, 221},{217, 217, 217},{212, 211, 213},{207, 207, 208},{202, 202, 203},{198, 198, 198},{193, 194, 193},{188, 189, 188},{184, 184, 184},{180, 180, 180},{174, 175, 175},{170, 170, 171},{166, 166, 166},{161, 161, 161},{157, 157, 156},{152, 152, 151},{147, 147, 147},{143, 142, 142},{138, 138, 138},{133, 133, 134},{129, 128, 129},{124, 124, 124},{119, 120, 119},{115, 115, 115},{110, 110, 110},{106, 105, 106},{100, 101, 101},{96, 96, 96},{92, 91, 92},{87, 87, 87},{82, 82, 82},{77, 78, 78},{73, 73, 73},{68, 68, 68},{63, 64, 64},{59, 58, 59},{55, 54, 54},{50, 50, 50},{45, 45, 45},{40, 41, 40},{36, 36, 36},{31, 31, 32},{27, 27, 27},{22, 22, 22},{17, 17, 17},{13, 13, 12},{3, 2, 3},{7, 6, 7}},{{246, 245, 246},{255, 255, 255},{245, 245, 244},{240, 240, 241},{235, 235, 235},{231, 230, 231},{226, 226, 226},{221, 222, 222},{217, 217, 217},{212, 212, 212},{207, 208, 208},{203, 202, 202},{199, 198, 198},{193, 194, 193},{188, 189, 189},{184, 184, 184},{179, 179, 179},{175, 175, 175},{171, 171, 171},{165, 166, 166},{161, 161, 161},{157, 157, 156},{152, 153, 152},{148, 147, 147},{143, 143, 142},{137, 138, 138},{134, 133, 133},{129, 128, 129},{124, 124, 124},{119, 120, 119},{115, 115, 115},{110, 110, 110},{105, 105, 106},{101, 101, 101},{97, 96, 96},{91, 92, 92},{87, 87, 87},{82, 82, 82},{78, 78, 77},{73, 73, 73},{68, 68, 68},{63, 63, 64},{59, 59, 59},{55, 55, 55},{50, 50, 50},{45, 46, 44},{40, 41, 41},{36, 36, 37},{32, 31, 31},{26, 27, 26},{22, 21, 22},{17, 16, 18},{12, 13, 13},{2, 3, 3},{7, 8, 7}},{{247, 247, 247},{255, 255, 255},{254, 255, 254},{250, 250, 251},{246, 245, 246},{240, 240, 240},{235, 235, 236},{230, 230, 230},{225, 225, 225},{220, 221, 220},{215, 216, 215},{210, 211, 211},{205, 206, 206},{201, 201, 201},{196, 196, 195},{191, 191, 190},{186, 186, 186},{181, 180, 181},{176, 176, 176},{171, 171, 171},{166, 165, 167},{161, 161, 162},{157, 156, 156},{152, 151, 151},{147, 147, 146},{141, 142, 142},{136, 136, 136},{132, 132, 131},{126, 127, 127},{122, 121, 122},{118, 117, 117},{111, 112, 112},{107, 107, 107},{102, 102, 102},{97, 97, 97},{91, 92, 92},{87, 87, 87},{82, 83, 82},{77, 78, 77},{72, 73, 72},{68, 67, 67},{63, 62, 62},{57, 58, 57},{52, 53, 53},{48, 48, 48},{43, 43, 43},{38, 38, 38},{32, 33, 33},{28, 28, 28},{23, 23, 23},{18, 19, 18},{13, 13, 13},{9, 8, 8},{0, 0, 0},{4, 4, 4}},{{238, 237, 238},{252, 252, 252},{237, 237, 237},{232, 232, 232},{228, 228, 228},{224, 224, 224},{219, 219, 220},{215, 214, 214},{210, 210, 210},{206, 206, 206},{201, 201, 202},{197, 197, 197},{193, 193, 193},{188, 188, 188},{184, 183, 184},{180, 179, 180},{175, 176, 175},{170, 170, 171},{166, 166, 166},{161, 162, 162},{157, 158, 157},{154, 152, 153},{149, 148, 149},{144, 145, 144},{140, 139, 140},{135, 135, 136},{131, 131, 131},{127, 126, 127},{122, 122, 122},{118, 117, 118},{113, 113, 114},{109, 110, 109},{104, 104, 105},{100, 100, 100},{96, 96, 96},{91, 92, 92},{86, 87, 87},{82, 82, 83},{78, 78, 79},{74, 74, 74},{70, 70, 69},{65, 66, 65},{60, 60, 61},{56, 56, 56},{52, 52, 52},{47, 47, 47},{43, 43, 43},{38, 39, 39},{34, 34, 34},{30, 29, 29},{25, 25, 25},{20, 22, 21},{16, 17, 17},{7, 7, 7},{11, 11, 11}}}
local AddonName, AddonTable = ... AddonTable.shadowlab = { -- Ambassador Hellmaw 27885, -- Soul-Wand of the Aldor 27887, -- Platinum Shield of the Valorous 27888, -- Dream-Wing Helm 27889, -- Jaedenfire Gloves of Annihilation 27908, -- Leggings of Assassination 27884, -- Ornate Boots -- Blackheart the Inciter 27890, -- Wand of the Netherwing 28134, -- Brooch of Heightened Potential 27892, -- Cloak of the Inciter 27893, -- Ornate Leggings of the Venerated 27891, -- Adamantine Figurine -- Grandmaster Vorpil 27901, -- Blackout Truncheon 27898, -- Wrathfire Hand-Cannon 27775, -- Hallowed Pauldrons 27897, -- Breastplate of Many Graces 27468, -- Moonglade Handwraps 27909, -- Tidefury Kilt 27900, -- Jewel of Charismatic Mystique -- Murmur 27903, -- Sonic Spear 27905, -- Greatsword of Horrid Dreams 29353, -- Shockwave Truncheon 27913, -- Whispering Blade of Slaying 27910, -- Silvermoon Crest Shield 27803, -- Shoulderguards of the Bold 27778, -- Spaulders of Oblivion 28230, -- Hallowed Garments 27912, -- Harness of the Deep Currants 28232, -- Robe of Oblivion 29357, -- Master Thief's Gloves 29261, -- Girdle of Ferocity 30532, -- Kirin Tor Master's Trousers 27902, -- Silent Slippers of Meditation }
--[[ With Luade, you can share text, URLs and files with your scripts. For that, just create a script IN THIS DIRECTORY. Then, when you share a text, an URL or a file, you can select 'Run Lua Script' and select the script you created. --]] sharesheet.string() -- Retrieves text sharesheet.url() -- Retrieves an URL sharesheet.filePath() -- Retrieves the path of a file -- One of the previous functions should return something depending on what you shared. They will return `nil` if the script is ran from the app.
local keymap = require 'utils'.keymap -- Set barbar's options vim.g.bufferline = { -- Enable/disable auto-hiding the tab bar when there is a single buffer auto_hide = false, -- Enable/disable current/total tabpages indicator (top right corner) tabpages = true, -- Enable/disable close button closable = false, -- Enables/disable clickable tabs -- - left-click: go to buffer -- - middle-click: delete buffer clickable = true, -- Enable/disable icons -- if set to 'numbers', will show buffer index in the tabline -- if set to 'both', will show buffer index and icons in the tabline icons = false, -- If true, new buffers will be inserted at the end of the list. -- Default is to insert after current buffer. insert_at_end = true, -- Sets the maximum padding width with which to surround each tab maximum_padding = 1, -- Sets the maximum buffer name length. maximum_length = 20, } keymap("n", "<C-K>", ":BufferNext<CR>") keymap("n", "<C-J>", ":BufferPrevious<CR>") keymap("n", "<Leader>c", ":BufferClose<CR>")
-- -- Quiz: sample project -- By TiagoDanin -- Version: 1.0.0 --[==[ The MIT License (MIT) Copyright (c) 2016 Tiago Danin 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. ]==]-- --------------------------------------------------------------------------------------- -- Libs -- local json = require("json") local widget = require( "widget" ) -- Base -- local background = display.newImage("bg.jpg", display.contentCenterX, display.contentCenterY) local question = '' local answer = '' local quest = '' local game = false local text = widget.newButton { defaultFile = "bt2.png", label = "Question", labelColor = { default = {1, 1, 1}, }, font = native.systemFont, fontSize = 21, } text.x = 160; text.y = 40 -- API Trivia -- local url = "http://jservice.io/api/random/" function trivia(event) if ( event.isError ) then question = 'Network error!' answer = 'Network error!' else local data = json.decode(event.response) question = data[1].question answer = data[1].answer end local ok = function(event) box:removeSelf() box = native.newTextBox(160, 80, 280, 230) box.anchorY = 0 box.text = answer box.size = 20 box.isEditable = false end bt = widget.newButton { defaultFile = "bt.png", label = "View Answer", labelColor = { default = {1, 1, 1}, }, font = native.systemFont, fontSize = 21, emSboss = true, onPress = ok, } bt.x = 160; bt.y = 340 box = native.newTextBox(160, 80, 280, 230) box.anchorY = 0 box.text = question box.size = 20 box.isEditable = false game = true return true end -- Menu -- function load(event) local new_question = function(event) if game then box:removeSelf() bt:removeSelf() game = false network.request(url, "GET", trivia) else network.request(url, "GET", trivia) end end local new = widget.newButton { defaultFile = "bt.png", label = "New Question", labelColor = { default = {1, 1, 1}, }, font = native.systemFont, fontSize = 21, emSboss = true, onPress = new_question, } new.x = 160; new.y = 420 end timer.performWithDelay( 150, load )
function get_info(cmd, default) local f = io.popen (cmd, "r"); local rev = nil if f ~= nil then rev = f:read("*a") f:close (); end if rev == nil or rev == "" then rev = default end return rev end -- NOTE: cal also be found in '.git/HEAD' BRANCH_PATH = get_info("git rev-parse --abbrev-ref HEAD", "none\n") -- NOTE: can be found in '.git/refs/heads/<BRANCH_PATH>' REVISION = get_info("git rev-parse HEAD", "none\n") USER_NAME = get_info("git config user.name", "none\n") REVISION = string.gsub(REVISION,"\n", "") USER_NAME = string.gsub(USER_NAME,"\n", "") BRANCH_PATH = string.gsub(BRANCH_PATH,"\n", "") -- BRANCH_PATH = "(* indicates active branch in following list)\n [\n " .. string.gsub(BRANCH_PATH,"\n", "\n ") .."]" print("INFO: repository info") print(" REVISION = " .. REVISION) print(" USER_NAME = " .. USER_NAME) print(" BRANCH_PATH = " .. BRANCH_PATH) print()
local routing = require 'web.middleware.routing' local describe, it, assert = describe, it, assert describe('web.middleware.routing', function() it('', function() assert.not_nil(routing) end) end)
-- Copyright 2017-2022 Jason Tackaberry -- -- 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 rtk = require('rtk.core') --- A scrollable single-child container. -- -- Viewports intentionally only support a single child, but that child can of course be a -- @{rtk.Container|container}. -- -- When child widgets within the viewport are dragging (where `ondragstart()` returns a positive -- value), the viewport's scrollbar will appear if the dragging child has its -- `show_scrollbar_on_drag` attribute set to true (as is default). This is a common idiom -- for drag-and-drop as it reveals where in the viewport the user is dragging, and also -- invites edge scrolling by dragging outside the boundary of the viewport (and this is -- supported by `rtk.Viewport`). -- -- -- The default `rtk.Viewport` behavior is optimized for vertical scrolling while trying to -- minimize the need to scroll horizontally. -- -- @warning Vertical scrollbars only -- Currently only vertical scrollbars are supported. Horizontal scrolling can be -- achieved programmatically (e.g. via `scrollto()`) but horizontal scrollbars -- haven't yet been implemented. -- -- @class rtk.Viewport -- @inherits rtk.Widget rtk.Viewport = rtk.class('rtk.Viewport', rtk.Widget) --- Scrollbar Constants. -- -- Used with the `vscrollbar` attribute, where lowercase strings of these constants without -- the `SCROLLBAR_` prefix can be used for convenience (e.g. `never` instead of -- `rtk.Viewport.SCROLLBAR_NEVER`). -- -- @section scrollbarconst -- @compact --- Never show the scrollbar, and so user can only scroll the viewport by using the -- mouse wheel. Programmatic scrolling is also possible. -- @meta 'never' rtk.Viewport.static.SCROLLBAR_NEVER = 0 --- Only show the scrollbar when the mouse hovers over the @{vscrollbar_gutter|gutter -- area}. Space is not reserved for the scrollbar: the child is able to consume this -- space and the scrollbar will be drawn over top. -- @meta 'hover' rtk.Viewport.static.SCROLLBAR_HOVER = 1 --- Always show the scrollbar. Unlike `SCROLLBAR_HOVER`, space is reserved for the scrollbar -- and so the child won't overlap with the scrollbar handle. -- @meta 'always' rtk.Viewport.static.SCROLLBAR_ALWAYS = 2 --- Class API --- @section api rtk.Viewport.register{ [1] = rtk.Attribute{alias='child'}, --- The child widget that is to scroll within this viewport. -- -- This attribute may be passed as the first positional argument during initialization: -- -- @code -- -- This ... -- local vp = rtk.Viewport{box} -- -- ... is equivalent to this -- local vp = rtk.Viewport{child=box} -- -- Because `rtk.Viewport` doesn't implement the `rtk.Container` interface (instead being -- a much simpler single-child type container), there's no method analogous to -- `rtk.Container:add()`. Placing the single child within the viewport is done by -- setting this attribute. It does mean that viewports don't provide the -- @{container.cellattrs|cell attributes} capability; the widget's -- @{rtk.Widget.margin|margin} is respected, however, and can be used to provide -- visual distance between the viewport boundary and the child widget. -- -- @meta read/write -- @type rtk.Widget child = rtk.Attribute{reflow=rtk.Widget.REFLOW_FULL}, --- Vertical scroll offset in pixels. See also `scrollby()` and `scrollto()`. -- @meta read/write -- @type number scroll_left = rtk.Attribute{ default=0, -- Scrolling doesn't affect layout reflow=rtk.Widget.REFLOW_NONE, calculate=function(self, attr, value, target) return math.round(value) end, }, --- Horizontal scroll offset in pixels. See also `scrollby()` and `scrollto()`. -- @meta read/write -- @type number scroll_top=rtk.Reference('scroll_left'), --- Controls whether scrolling the viewport either programmatically or via the mouse wheel -- should animate smoothly (default nil). -- -- If nil, the global `rtk.smoothscroll` value is used. If true or false, it explicitly -- overrides the global default for this viewport. -- -- @meta read/write -- @type boolean|nil smoothscroll = rtk.Attribute{reflow=rtk.Widget.REFLOW_NONE}, --- The thickness of the scrollbar handle in pixels. The scrollbar position ignores -- `padding` and is always aligned to the viewport's border. -- @meta read/write -- @type number scrollbar_size = 15, --- Visibility of the vertical scrollbar (default `SCROLLBAR_HOVER`). -- @meta read/write -- @type scrollbarconst vscrollbar = rtk.Attribute{ default=rtk.Viewport.SCROLLBAR_HOVER, calculate={ never=rtk.Viewport.SCROLLBAR_NEVER, always=rtk.Viewport.SCROLLBAR_ALWAYS, hover=rtk.Viewport.SCROLLBAR_HOVER, }, }, --- Number of pixels inside the viewport area to offset the vertical scrollbar, where -- 0 positions the scrollbar at the right edge of the viewport as normal (default 0). -- -- Any positive value will draw the scrollbar that number of pixels inside the -- viewport. Negative values will have undefined behavior. -- @meta read/write -- @type number vscrollbar_offset = rtk.Attribute{ default=0, -- Scrollbar offset doesn't affect layout reflow=rtk.Widget.REFLOW_NONE, }, --- Number of pixels from the edge of the viewport that defines the "hot zone" where -- when the mouse this region a `SCROLLBAR_HOVER` scrollbar will appear with a low -- opacity. The opacity increases once the mouse moves directly over the scrollbar -- handle. -- @meta read/write -- @type number vscrollbar_gutter = 25, -- TODO: implement horizontal scrollbars hscrollbar = rtk.Attribute{ default=rtk.Viewport.SCROLLBAR_NEVER, calculate=rtk.Reference('vscrollbar'), }, hscrollbar_offset = 0, hscrollbar_gutter = 25, --- Controls whether the `child` widget should be asked to constrain its width to the -- viewport's box (false) or if the viewport's inner width should be flexible and -- allow the child infinite width under the assumption that we want to allow -- horizontal scrolling (true) (default is false). -- @meta read/write -- @type boolean flexw = false, --- Like `flexw` but for height (default true). -- @meta read/write -- @type boolean flexh = true, --- If set, a shadow will be drawn around the viewport with the specified color (default nil). -- The alpha channel in the color affects the weight of the shadow (e.g. `#00000066`). -- @meta read/write -- @type colortype shadow = nil, --- When `shadow` is set, this defines the apparent distance the viewport is hovering above -- what's underneath (default 20). -- @meta read/write -- @type number elevation = 20, -- Overides from rtk.Widget -- -- Ensure dragging the scrollbar doesn't cause any outer viewport we belong to -- to show its scrollbar. show_scrollbar_on_drag = false, -- Ensure touch-dragging immediately calls `handle_dragstart` without any delay. touch_activate_delay = 0, } --- Create a new viewport with the given attributes. -- -- @display rtk.Viewport -- @treturn rtk.Viewport the new viewport widget function rtk.Viewport:initialize(attrs, ...) rtk.Widget.initialize(self, attrs, self.class.attributes.defaults, ...) -- Force setting of child viewport/window self:_handle_attr('child', self.calc.child, nil, true) -- Force calculation of scrollbar colors based on bg color self:_handle_attr('bg', self.calc.bg) self._backingstore = nil -- If scroll*() is called then the offset is dirtied so that it can be clamped -- upon next draw or event. self._needs_clamping = false -- If not nil, then we need to emit onscroll() on next draw. Value is the previous -- scroll position. Initialize to non-nil value to ensure we trigger onscroll() -- after first draw. self._last_draw_scroll_left = nil self._last_draw_scroll_top = nil -- Scrollbar geometry updated during _reflow() -- -- Vertical scrollbar position relative to parent self._vscrollx = 0 self._vscrolly = 0 self._vscrollh = 0 self._vscrolla = { -- Initialize scrollbar alpha based on whether the scrollbar is always visible. current=self.calc.vscrollbar == rtk.Viewport.SCROLLBAR_ALWAYS and 0.1 or 0, target=0, delta=0.05 } self._vscroll_in_gutter = false end function rtk.Viewport:_handle_attr(attr, value, oldval, trigger, reflow) local ok = rtk.Widget._handle_attr(self, attr, value, oldval, trigger, reflow) if ok == false then return ok end if attr == 'child' then if oldval then -- This is basically what rtk.Container:_unparent_child() does, reproduced -- here as rtk.Viewport doesn't subclass rtk.Container. oldval:_unrealize() oldval.viewport = nil oldval.parent = nil oldval.window = nil self:_sync_child_refs(oldval, 'remove') end if value then -- Similar to rtk.Container:_reparent_child() value.viewport = self value.parent = self value.window = self.window self:_sync_child_refs(value, 'add') end elseif attr == 'bg' then -- If no bg is specified, use the window background. It's not guaranteed value = value or rtk.theme.bg local luma = rtk.color.luma(value) -- Default alphas for scrollbar. Recalculated based on bg luma when bg is set. -- The idea here is to increase opacity of the scrollbar when luma is within the -- middle range, and then taper off to 0 roughly below 0.2 and above 0.8 where -- the white or black scrollbar is more easily visible. -- around the middle range local offset = math.max(0, 1 - (1.5 - 3*luma)^2) self._scrollbar_alpha_proximity = 0.19 * (1+offset^0.2) self._scrollbar_alpha_hover = 0.44 * (1+offset^0.4) self._scrollbar_color = luma < 0.5 and '#ffffff' or '#000000' elseif attr == 'shadow' then -- Force regeneration on reflow. self._shadow = nil elseif attr == 'scroll_top' or attr == 'scroll_left' then self._needs_clamping = true end return true end function rtk.Viewport:_sync_child_refs(child, action) -- Hijack the rtk.Container implementation, which doesn't depend on anything not -- already available in rtk.Viewport. return rtk.Container._sync_child_refs(self, child, action) end function rtk.Viewport:_reflow(boxx, boxy, boxw, boxh, fillw, fillh, clampw, clamph, uiscale, viewport, window) local calc = self.calc calc.x, calc.y = self:_get_box_pos(boxx, boxy) local w, h, tp, rp, bp, lp = self:_get_content_size(boxw, boxh, fillw, fillh, clampw, clamph) local hpadding = lp + rp local vpadding = tp + bp -- Determine bounding box for child local inner_maxw = w or (boxw - hpadding) local inner_maxh = h or (boxh - vpadding) -- Amount of the inner box we need to steal from children for scrollbar. Only -- do so if scrollbar is always visible. local scrollw, scrollh = 0, 0 if calc.vscrollbar == rtk.Viewport.SCROLLBAR_ALWAYS then -- Vertical scrollbar takes from width scrollw = calc.scrollbar_size * rtk.scale.value inner_maxw = inner_maxw - scrollw end if calc.hscrollbar == rtk.Viewport.SCROLLBAR_ALWAYS then -- Horizontal scrollbar takes from height scrollh = calc.scrollbar_size * rtk.scale.value inner_maxh = inner_maxh - scrollh end local child = calc.child local innerw, innerh local hmargin, vmargin local ccalc if child and child.visible == true then ccalc = child.calc hmargin = ccalc.lmargin + ccalc.rmargin vmargin = ccalc.tmargin + ccalc.bmargin -- Remove child margin from max inner size inner_maxw = inner_maxw - hmargin inner_maxh = inner_maxh - vmargin local wx, wy, ww, wh = child:reflow( -- box 0, 0, inner_maxw, inner_maxh, -- Explicitly pass false to child widget for fill flags to prevent clamping to -- the above box. The child of a viewport should express its full size and -- reflow within that, while the viewport simply scrolls within it. false, false, not calc.flexw, not calc.flexh, uiscale, -- Set the child's viewport to us self, window ) if calc.halign == rtk.Widget.CENTER then wx = wx + math.max(0, inner_maxw - ccalc.w) / 2 elseif calc.halign == rtk.Widget.RIGHT then wx = wx + math.max(0, (inner_maxw - ccalc.w) - rp) end if calc.valign == rtk.Widget.CENTER then wy = wy + math.max(0, inner_maxh - ccalc.h) / 2 elseif calc.valign == rtk.Widget.BOTTOM then wy = wy + math.max(0, (inner_maxh - ccalc.h) - bp) end -- Update child position if alignment had changed it ccalc.x = wx ccalc.y = wy child:_realize_geometry() -- calc size of viewport takes into account widget's size and x/y offset within -- the viewport, clamping to the viewport's box. We take the ceiling because technically -- dimensions could be fractional (thanks to rtk.scale) but we need to ensure we create -- a backing store image with integer dimensions. innerw = math.ceil(rtk.clamp(ww + wx, fillw and inner_maxw, inner_maxw)) innerh = math.ceil(rtk.clamp(wh + wy, fillh and inner_maxh, inner_maxh)) else -- Without a child to define influence our size, default to the child bounding -- box. innerw, innerh = inner_maxw, inner_maxh hmargin, vmargin = 0, 0 end -- Only need to add child margin back in if we're using child's size. If using our own -- size, w/h will be non-nil and that already incorporates child margin. calc.w = (w or (innerw + scrollw + hmargin)) + hpadding calc.h = (h or (innerh + scrollh + vmargin)) + vpadding if not self._backingstore then self._backingstore = rtk.Image(innerw, innerh) else self._backingstore:resize(innerw, innerh, false) end self._vscrollh = 0 self._needs_clamping = true if ccalc then self._scroll_clamp_left = math.max(0, ccalc.w - calc.w + lp + rp + ccalc.lmargin + ccalc.rmargin) self._scroll_clamp_top = math.max(0, ccalc.h - calc.h + tp + bp + ccalc.tmargin + ccalc.bmargin) end end function rtk.Viewport:_realize_geometry() local calc = self.calc local tp, rp, bp, lp = self:_get_padding_and_border() if self.child then local innerh = self._backingstore.h local ch = self.child.calc.h if calc.vscrollbar ~= rtk.Viewport.SCROLLBAR_NEVER and ch > innerh then self._vscrollx = calc.x + calc.w - calc.scrollbar_size * rtk.scale.value - calc.vscrollbar_offset self._vscrolly = calc.y + calc.h * calc.scroll_top / ch + tp self._vscrollh = calc.h * innerh / ch end end if self.shadow then if not self._shadow then self._shadow = rtk.Shadow(calc.shadow) end self._shadow:set_rectangle(calc.w, calc.h, calc.elevation) end self._pre = {tp=tp, rp=rp, bp=bp, lp=lp} end function rtk.Viewport:_unrealize() self._backingstore = nil if self.child then self.child:_unrealize() end end function rtk.Viewport:_draw(offx, offy, alpha, event, clipw, cliph, cltargetx, cltargety, parentx, parenty) rtk.Widget._draw(self, offx, offy, alpha, event, clipw, cliph, cltargetx, cltargety, parentx, parenty) local calc = self.calc local pre = self._pre -- Preserve drawing target client coordinates which are used to adjust scrollbar -- to client coordinates self.cltargetx = cltargetx self.cltargety = cltargety local x = calc.x + offx + pre.lp local y = calc.y + offy + pre.tp local lastleft, lasttop local scrolled = calc.scroll_left ~= self._last_draw_scroll_left or calc.scroll_top ~= self._last_draw_scroll_top if scrolled then lastleft, lasttop = self._last_draw_scroll_left or 0, self._last_draw_scroll_top or 0 if self:onscrollpre(lastleft, lasttop, event) == false then -- Scroll was rejected by the handler. Revert. calc.scroll_left = lastleft or 0 calc.scroll_top = lasttop -- Don't fire onscroll() later. scrolled = false else self._last_draw_scroll_left = calc.scroll_left self._last_draw_scroll_top = calc.scroll_top end end if y + calc.h < 0 or y > cliph or calc.ghost then -- Viewport would not be visible on current drawing target return false end self:_handle_drawpre(offx, offy, alpha, event) -- Force alpha to 1.0 here and when we draw the child just below as the correctv -- alpha will be applied when blitting. self:_draw_bg(offx, offy, 1.0, event) local child = calc.child if child and child.realized then self:_clamp() x = x + child.calc.lmargin y = y + child.calc.tmargin -- Redraw the backing store, first "clearing" it according to what's currently painted -- underneath it. self._backingstore:blit{src=gfx.dest, sx=x, sy=y, mode=rtk.Image.FAST_BLIT} self._backingstore:pushdest() -- Explicitly draw child with alpha=1.0 because ... child:_draw( -calc.scroll_left, -calc.scroll_top, 1.0, event, calc.w, calc.h, cltargetx + x, cltargety + y, 0, 0 ) child:_draw_debug_box(-calc.scroll_left, -calc.scroll_top, event) self._backingstore:popdest() -- ... we apply the proper alpha when blitting the viewport backing store onto the -- destination. self._backingstore:blit{dx=x, dy=y, alpha=alpha * calc.alpha} self:_draw_scrollbars(offx, offy, cltargetx, cltargety, alpha * calc.alpha, event) end if calc.shadow then self._shadow:draw(calc.x + offx, calc.y + offy, alpha * calc.alpha) end self:_draw_borders(offx, offy, alpha) if scrolled then self:onscroll(lastleft, lasttop, event) end self:_handle_draw(offx, offy, alpha, event) end function rtk.Viewport:_draw_scrollbars(offx, offy, cltargetx, cltargety, alpha, event) local calc = self.calc local animate = self._vscrolla.current ~= self._vscrolla.target if calc.vscrollbar == rtk.Viewport.SCROLLBAR_ALWAYS or (calc.vscrollbar == rtk.Viewport.SCROLLBAR_HOVER and self._vscrollh > 0 and ((not rtk.dnd.dragging and self._vscroll_in_gutter) or animate or self._vscrolla.target>0)) then -- scrollbar coordinates relative to parent local scrx = offx + self._vscrollx local scry = offy + calc.y + calc.h * calc.scroll_top / self.child.calc.h local should_handle_hovering = rtk.point_in_box( event.x, event.y, -- Add drawing target client coordinates for testing mouse position scrx + cltargetx, scry + cltargety, calc.scrollbar_size * rtk.scale.value, self._vscrollh ) if (should_handle_hovering and self._vscroll_in_gutter) or rtk.dnd.dragging == self then self._vscrolla.target = self._scrollbar_alpha_hover self._vscrolla.delta = 0.1 elseif self._vscroll_in_gutter or calc.vscrollbar == rtk.Viewport.SCROLLBAR_ALWAYS then self._vscrolla.target = self._scrollbar_alpha_proximity self._vscrolla.delta = 0.1 end if animate then local newval if self._vscrolla.current < self._vscrolla.target then newval = math.min(self._vscrolla.current + self._vscrolla.delta, self._vscrolla.target) else newval = math.max(self._vscrolla.current - self._vscrolla.delta, self._vscrolla.target) end self._vscrolla.current = newval self:queue_draw() end self:setcolor(self._scrollbar_color) gfx.a = self._vscrolla.current * alpha gfx.rect(scrx, scry, calc.scrollbar_size * rtk.scale.value, self._vscrollh + 1, 1) end end function rtk.Viewport:_handle_event(clparentx, clparenty, event, clipped, listen) local calc = self.calc local pre = self._pre listen = self:_should_handle_event(listen) local x = calc.x + clparentx local y = calc.y + clparenty local hovering = rtk.point_in_box(event.x, event.y, x, y, calc.w, calc.h) local dragging = rtk.dnd.dragging local is_child_dragging = dragging and dragging.viewport == self local child = self.child -- Don't check for listen==true at this level as we want to handle the case where -- we are currently in proximity of the scrollbar and some other widget goes -- modal. At that point we want to be able to hide the scrollbar. if event.type == rtk.Event.MOUSEMOVE then local vscroll_in_gutter = false if listen and is_child_dragging and dragging.scroll_on_drag then if event.y - 20 < y then self:scrollby(0, -math.max(5, math.abs(y - event.y)), false) elseif event.y + 20 > y + calc.h then self:scrollby(0, math.max(5, math.abs(y + calc.h - event.y)), false) end if dragging.show_scrollbar_on_drag then -- Show scrollbar when we have a child dragging. self._vscrolla.target = self._scrollbar_alpha_proximity self._vscrolla.delta = 0.03 end elseif listen and not dragging and not event.handled and hovering then if calc.vscrollbar ~= rtk.Viewport.SCROLLBAR_NEVER and self._vscrollh > 0 then local gutterx = self._vscrollx + clparentx - calc.vscrollbar_gutter local guttery = calc.y + clparenty -- Are we hovering in the scrollbar gutter? if rtk.point_in_box(event.x, event.y, gutterx, guttery, calc.vscrollbar_gutter + calc.scrollbar_size*rtk.scale.value, calc.h) then vscroll_in_gutter = true if event.x >= self._vscrollx + clparentx then event:set_handled(self) end -- Ensure we queue draw if we leave the scrollbar handle but still in -- the gutter. self:queue_draw() end end end if vscroll_in_gutter ~= self._vscroll_in_gutter or self._vscrolla.current > 0 then self._vscroll_in_gutter = vscroll_in_gutter if calc.vscrollbar == rtk.Viewport.SCROLLBAR_HOVER then if not vscroll_in_gutter and not is_child_dragging then self._vscrolla.target = 0 self._vscrolla.delta = 0.02 end -- Ensure we redraw to reflect mouse leaving gutter. But we -- don't mark the event as handled because we're ok with lower -- z-order widgets handling the mouseover as well. self:queue_draw() end end elseif listen and not event.handled and event.type == rtk.Event.MOUSEDOWN then if not self:cancel_animation('scroll_top') then self:_reset_touch_scroll() end if self._vscroll_in_gutter and event.x >= self._vscrollx + clparentx then local scrolly = self:_get_vscrollbar_client_pos() if event.y < scrolly or event.y > scrolly + self._vscrollh then self:_handle_scrollbar(event, nil, self._vscrollh / 2, true) end event:set_handled(self) end end if (not event.handled or event.type == rtk.Event.MOUSEMOVE) and not (event.type == rtk.Event.MOUSEMOVE and self.window:_is_touch_scrolling(self)) and self.child and self.child.visible and self.child.realized then self:_clamp() self.child:_handle_event( x - calc.scroll_left + pre.lp + child.calc.lmargin, y - calc.scroll_top + pre.tp + child.calc.tmargin, event, clipped or not hovering, listen ) end if listen and hovering and not event.handled and event.type == rtk.Event.MOUSEWHEEL then -- Only scroll and handle this effect if the inner height is greater than the -- viewport height. In other words, if we don't actually have anything to scroll, -- let this scroll event be handled by the parent viewport (if any). if self.child and self._vscrollh > 0 and event.wheel ~= 0 then local distance = event.wheel * math.min(calc.h/2, 120) self:scrollby(0, distance) event:set_handled(self) end end rtk.Widget._handle_event(self, clparentx, clparenty, event, clipped, listen) end function rtk.Viewport:_get_vscrollbar_client_pos() local calc = self.calc return self.clienty + calc.h * calc.scroll_top / self.child.calc.h end function rtk.Viewport:_handle_scrollbar(event, hoffset, voffset, gutteronly, natural) local calc = self.calc local pre = self._pre if voffset ~= nil then self:cancel_animation('scroll_top') if gutteronly then local ssy = self:_get_vscrollbar_client_pos() if event.y >= ssy and event.y <= ssy + self._vscrollh then -- Mouse is not in the gutter. return false end end local innerh = calc.h - pre.tp - pre.bp local target if natural then target = calc.scroll_top + (voffset - event.y) else local pct = rtk.clamp(event.y - self.clienty - voffset, 0, innerh) / innerh target = pct * (self.child.calc.h) end -- Explicitly don't smooth scroll with scollbar movements. self:scrollto(calc.scroll_left, target, false) end end function rtk.Viewport:_handle_dragstart(event, x, y, t) -- Superclass method disables dragging so don't call it. local draggable, droppable = self:ondragstart(self, event, x, y, t) if draggable ~= nil then return draggable, droppable end if math.abs(y - event.y) > 0 then if self._vscroll_in_gutter and event.x >= self._vscrollx + self.offx + self.cltargetx then -- If here, we are dragging the scroll handle itself. Second return value of false -- indicates we are not droppable return {true, y - self:_get_vscrollbar_client_pos(), nil, false}, false elseif rtk.touchscroll and event.buttons & rtk.mouse.BUTTON_LEFT ~= 0 and self._vscrollh > 0 then self.window:_set_touch_scrolling(self, true) return {true, y, {{x, y, t}}, true}, false end end return false, false end function rtk.Viewport:_handle_dragmousemove(event, arg) local ok = rtk.Widget._handle_dragmousemove(self, event) if ok == false or event.simulated then return ok end local vscrollbar, lasty, samples, natural = table.unpack(arg) if vscrollbar then self:_handle_scrollbar(event, nil, lasty, false, natural) if natural then -- We are touch scrolling. Update our internal drag state with the latest -- mouse y position. arg[2] = event.y samples[#samples+1] = {event.x, event.y, event.time} end -- Some widget above the viewport (and under the mouse) may already have requested -- a mouse cursor, but we want to override that in case we are touch scrolling, so -- we force-replace the cursor (by passing true here). self.window:request_mouse_cursor(rtk.mouse.cursors.POINTER, true) end return true end function rtk.Viewport:_reset_touch_scroll() -- Verify self.window is valid because if viewport was unparented or hidden while in -- the middle of a kinetic scroll, when the animation finishes this gets called, but -- self.window may be nil at that point. if self.window then self.window:_set_touch_scrolling(self, false) end end function rtk.Viewport:_handle_dragend(event, arg) local ok = rtk.Widget._handle_dragend(self, event) if ok == false then return ok end local vscrollbar, lasty, samples, natural = table.unpack(arg) if natural then local now = event.time local x1, y1, t1 = event.x, event.y, event.time for i = #samples, 1, -1 do local x, y, t = table.unpack(samples[i]) if now - t > 0.2 then break end x1, y1, t1 = x, y, t end local v = 0 if t1 ~= event.time then v = (event.y - y1) - (event.time - t1) end local distance = v * rtk.scale.value local x, y = self:_get_clamped_scroll(self.calc.scroll_left, self.calc.scroll_top - distance) -- FIXME: duration should be a function of distance local duration = 1 self:animate{attr='scroll_top', dst=y, duration=duration, easing='out-cubic'} :done(function() self:_reset_touch_scroll() end) :cancelled(function() self:_reset_touch_scroll() end) end -- In case we release the mouse in a different location (off the scrollbar -- handle or even outside the gutter), ensure the new state gets redrawn. self:queue_draw() -- Handle the event to prevent mouseup from closing modal popups when rtk.touchscroll -- is true (in which case unhandled mouseups cause modal widgets to be cleared). event:set_handled(self) return true end function rtk.Viewport:_scrollto(x, y, smooth, animx, animy) local calc = self.calc if not smooth or not self.realized then x = x or self.scroll_left y = y or self.scroll_top if x == calc.scroll_left and y == calc.scroll_top then return end -- We blindly accept the provided positions as the child hasn't been reflowed so -- we can't sanity check the bounds. Instead, the offsets will be clamped on next -- draw or event. self._needs_clamping = true calc.scroll_left = x calc.scroll_top = y -- Sync to user-facing attributes. self.scroll_left = calc.scroll_left self.scroll_top = calc.scroll_top self:queue_draw() else -- Unlike above, we can clamp now before starting the animation because we know -- we're realized. x, y = self:_get_clamped_scroll(x or calc.scroll_left, y or calc.scroll_top) animx = animx or self:get_animation('scroll_left') animy = animy or self:get_animation('scroll_top') if calc.scroll_left ~= x and (not animx or animx.dst ~= x) then self:animate{attr='scroll_left', dst=x, duration=0.15} end if calc.scroll_top ~= y and (not animy or animy.dst ~= y) then self:animate{attr='scroll_top', dst=y, duration=0.2, easing='out-sine'} end end end function rtk.Viewport:_get_smoothscroll(override) if override ~= nil then return override end local calc = self.calc if calc.smoothscroll ~= nil then return calc.smoothscroll end -- Fall back to global default return rtk.smoothscroll end --- Scrolls the viewport to a specific horizontal and/or vertical offset. -- -- If either value is nil then the current position will be used, allowing you to scroll -- only in one direction. Values that exceed the viewport bounds will be clamped as -- needed. -- -- This is a shorthand for calling `attr()` on the `scroll_left` and `scroll_top` attributes, -- but unlike `attr()` this also allows overriding `smoothscroll`. -- -- @tparam number|nil x the offset from the left edge to scroll the viewport, or nil to not -- scroll horizontally -- @tparam number|nil y the offset from the top edge to scroll the viewport, or nil to -- not scroll vertically -- @tparam boolean|nil smooth true to force smooth scrolling even if `smoothscroll` is false, -- false to force-disable smooth scrolling even if `smoothscroll` is true, or nil to use -- the current value of `smoothscroll` function rtk.Viewport:scrollto(x, y, smooth) self:_scrollto(x, y, self:_get_smoothscroll(smooth)) end --- Scrolls the viewport horizontally and/or vertically by a relative offset. -- -- @tparam number|nil offx the offset from the current `scroll_left` value, or nil to not -- scroll horizontally -- @tparam number|nil offy the offset from the current `scroll_top` value, or nil to -- not scroll vertically -- @tparam boolean|nil smooth true to force smooth scrolling even if `smoothscroll` is false, -- false to force-disable smooth scrolling even if `smoothscroll` is true, or nil to use -- the current value of `smoothscroll` function rtk.Viewport:scrollby(offx, offy, smooth) local calc = self.calc local x, y, animx, animy smooth = self:_get_smoothscroll(smooth) if smooth then -- Compound the offset with any current animation(s) so that we maintain -- velocity with rapid scrolling. animx = self:get_animation('scroll_left') animy = self:get_animation('scroll_top') x = (animx and animx.dst or calc.scroll_left) + (offx or 0) y = (animy and animy.dst or calc.scroll_top) + (offy or 0) else x = calc.scroll_left + (offx or 0) y = calc.scroll_top + (offy or 0) end self:_scrollto(x, y, smooth, animx, animy) end --- Returns true if the viewport's child has at least one dimension greater -- than the viewport's own bounding box such that scrolling would be necessary -- to see the entire child. -- -- @treturn boolean true if the viewport's child is larger than the viewport, -- false otherwise. function rtk.Viewport:scrollable() if not self.child then return false end local vcalc = self.calc local ccalc = self.child.calc return ccalc.w > vcalc.w or ccalc.h > vcalc.h end -- Clamp viewport position to fit child's current dimensions. Caller must ensure child -- has been realized. function rtk.Viewport:_get_clamped_scroll(left, top) -- Clamp viewport position to fit child's current dimensions left = rtk.clamp(left, 0, self._scroll_clamp_left) top = rtk.clamp(top, 0, self._scroll_clamp_top) return left, top end function rtk.Viewport:_clamp() if self._needs_clamping then local calc = self.calc calc.scroll_left, calc.scroll_top = self:_get_clamped_scroll(self.scroll_left, self.scroll_top) -- Sync to user-facing attributes. self.scroll_left, self.scroll_top = calc.scroll_left, calc.scroll_top self._needs_clamping = false end end --- Event Handlers. -- -- See also @{widget.handlers|handlers for rtk.Widget}. -- -- @section viewport.handlers --- Called when the viewport scrolls *before* the `child` is drawn. -- -- The `scroll_left` and `scroll_top` attributes indicate the new scroll -- offsets. -- -- This callback has the opportunity to block or mutate the scroll position before the -- viewport `child` is drawn. Because it's invoked before the child is drawn, handlers -- must not access any of the child's attributes that are populated on draw, such as -- `offx`/`offy` or `clientx`/`clienty`. -- -- @tparam number last_left the last horizontal scroll offset before the change -- @tparam number last_top the last vertical scroll offset before the change -- @tparam rtk.Event event the event that occurred at the time of the redraw when -- the change in scroll position was noticed -- @treturn boolean|nil if false, the scroll is rejected and the previous scroll -- offsets are restored, otherwise any other value allows the scroll to occur. function rtk.Viewport:onscrollpre(last_left, last_top, event) end --- Called when the viewport scrolls after the `child` is drawn. -- -- The `scroll_left` and `scroll_top` attributes indicate the new scroll -- offsets. -- -- Because this is invoked after the child is drawn, draw-provided attributes such as -- offx`/`offy` or `clientx`/`clienty` will be available. -- -- This callback is invoked prior to `ondraw()`. -- -- @tparam number last_left the last horizontal scroll offset before the change -- @tparam number last_top the last vertical scroll offset before the change -- @tparam rtk.Event event the event that occurred at the time of the redraw when -- the change in scroll position was noticed -- @treturn nil Return value has no significance. This is a notification event only. function rtk.Viewport:onscroll(last_left, last_top, event) end
Tags_prototype = function() local this = {} this.__public_static = { -- Public Static Variables -- Public Static Funcs } this.__private_static = { -- Private Static Variables -- Private Static Funcs } this.__public = { -- Public Variables list = {}, key_bindings = {}, selected_index = 1 -- Public Funcs } this.__private = { -- Private Variables -- Private Funcs } this.__construct = function() -- Constructor end return this end Tags = createClass(Tags_prototype)
---- -- Tests for the xlsxwriter.lua worksheet class. -- -- Copyright 2014, John McNamara, [email protected] -- require "Test.More" plan(10) ---- -- Tests setup. -- local expected local got local caption local Worksheet = require "xlsxwriter.worksheet" local Sharedstrings = require "xlsxwriter.sharedstrings" local worksheet local cell_ref ---- -- 1. Test the _write_dimension() method with no dimensions set. -- caption = " \tWorksheet: _write_dimension()" expected = '<dimension ref="A1"/>' worksheet = Worksheet:new() worksheet:_set_filehandle(io.tmpfile()) worksheet:_write_dimension() got = worksheet:_get_data() is(got, expected, caption) ---- -- 2. Test the _write_dimension() method with dimensions set. -- cell_ref = 'A1' caption = string.format(" \tWorksheet: _write_dimension('%s')", cell_ref) expected = string.format('<dimension ref="%s"/>', cell_ref) worksheet = Worksheet:new() worksheet.str_table = Sharedstrings:new() worksheet:_set_filehandle(io.tmpfile()) worksheet:write(cell_ref, 'some string') worksheet:_write_dimension() got = worksheet:_get_data() is(got, expected, caption) ---- -- 3. Test the _write_dimension() method with dimensions set. -- cell_ref = 'A1048576' caption = string.format(" \tWorksheet: _write_dimension('%s')", cell_ref) expected = string.format('<dimension ref="%s"/>', cell_ref) worksheet = Worksheet:new() worksheet.str_table = Sharedstrings:new() worksheet:_set_filehandle(io.tmpfile()) worksheet:write(cell_ref, 'some string') worksheet:_write_dimension() got = worksheet:_get_data() is(got, expected, caption) ---- -- 4. Test the _write_dimension() method with dimensions set. -- cell_ref = 'XFD1' caption = string.format(" \tWorksheet: _write_dimension('%s')", cell_ref) expected = string.format('<dimension ref="%s"/>', cell_ref) worksheet = Worksheet:new() worksheet.str_table = Sharedstrings:new() worksheet:_set_filehandle(io.tmpfile()) worksheet:write(cell_ref, 'some string') worksheet:_write_dimension() got = worksheet:_get_data() is(got, expected, caption) ---- -- 5. Test the _write_dimension() method with dimensions set. -- cell_ref = 'XFD1048576' caption = string.format(" \tWorksheet: _write_dimension('%s')", cell_ref) expected = string.format('<dimension ref="%s"/>', cell_ref) worksheet = Worksheet:new() worksheet.str_table = Sharedstrings:new() worksheet:_set_filehandle(io.tmpfile()) worksheet:write(cell_ref, 'some string') worksheet:_write_dimension() got = worksheet:_get_data() is(got, expected, caption) ---- -- 6. Test the _write_dimension() method with dimensions set. -- cell_ref = 'A1' caption = string.format(" \tWorksheet: _write_dimension('%s')", cell_ref) expected = string.format('<dimension ref="%s"/>', cell_ref) worksheet = Worksheet:new() worksheet.str_table = Sharedstrings:new() worksheet:_set_filehandle(io.tmpfile()) worksheet:write(cell_ref, 'some string') worksheet:_write_dimension() got = worksheet:_get_data() is(got, expected, caption) ---- -- 7. Test the _write_dimension() method with dimensions set. -- cell_ref = 'A1:B2' caption = string.format(" \tWorksheet: _write_dimension('%s')", cell_ref) expected = string.format('<dimension ref="%s"/>', cell_ref) worksheet = Worksheet:new() worksheet.str_table = Sharedstrings:new() worksheet:_set_filehandle(io.tmpfile()) worksheet:write('A1', 'some string') worksheet:write('B2', 'some string') worksheet:_write_dimension() got = worksheet:_get_data() is(got, expected, caption) ---- -- 8. Test the _write_dimension() method with dimensions set. -- cell_ref = 'A1:B2' caption = string.format(" \tWorksheet: _write_dimension('%s')", cell_ref) expected = string.format('<dimension ref="%s"/>', cell_ref) worksheet = Worksheet:new() worksheet.str_table = Sharedstrings:new() worksheet:_set_filehandle(io.tmpfile()) worksheet:write('B2', 'some string') worksheet:write('A1', 'some string') worksheet:_write_dimension() got = worksheet:_get_data() is(got, expected, caption) ---- -- 9. Test the _write_dimension() method with dimensions set. -- cell_ref = 'B2:H11' caption = string.format(" \tWorksheet: _write_dimension('%s')", cell_ref) expected = string.format('<dimension ref="%s"/>', cell_ref) worksheet = Worksheet:new() worksheet.str_table = Sharedstrings:new() worksheet:_set_filehandle(io.tmpfile()) worksheet:write('B2', 'some string') worksheet:write('H11', 'some string') worksheet:_write_dimension() got = worksheet:_get_data() is(got, expected, caption) ---- -- 10. Test the _write_dimension() method with dimensions set. -- cell_ref = 'A1:XFD1048576' caption = string.format(" \tWorksheet: _write_dimension('%s')", cell_ref) expected = string.format('<dimension ref="%s"/>', cell_ref) worksheet = Worksheet:new() worksheet.str_table = Sharedstrings:new() worksheet:_set_filehandle(io.tmpfile()) worksheet:write('A1', 'some string') worksheet:write('XFD1048576', 'some string') worksheet:_write_dimension() got = worksheet:_get_data() is(got, expected, caption)
---------------------------------------- -- Outfitter Copyright 2006-2018 John Stephen -- All rights reserved, unauthorized redistribution is prohibited ---------------------------------------- Outfitter.Debug = { InventoryCache = false, EquipmentChanges = false, EquipmentManager = false, NewItems = false, TemporaryItems = false, Optimize = false, } ---------------------------------------- Outfitter.CreditPlayersByRealm = -- -- 0 Friend -- 1 Tester or developer (bugfixes, enhancements, etc.) -- 2 Localizer -- 3 Donor ---------------------------------------- { ["Ace Library"] = { ["LibBabble"] = 2, ["LibBabble-Zone"] = 2, ["LibBabble-SubZone"] = 2, ["LibBabble-Inventory"] = 2, ["LibDataBroker"] = 2, ["LibTipHooker"] = 2, ["LibDropdown"] = 2, }, [Outfitter.cGermanLocalization] = { ["Ani"] = 2, ["Zokrym"] = 2, ["Dessa"] = 2, }, [Outfitter.cChineseLocalization] = { ["AndyAska"] = 2, ["xingdvd"] = 2, }, [Outfitter.cFrenchLocalization] = { ["Jullye"] = 2, ["Quetzaco"] = 2, ["Ekhurr"] = 2, ["Negwe"] = 2, }, [Outfitter.cSpanishLocalization] = { ["Marutak"] = 2, ["Marosth"] = 2, }, [Outfitter.cRussianLocalization] = { ["Delika"] = 2, }, [Outfitter.cKoreanLocalization] = { ["Unknown"] = 2, }, [Outfitter.cContributingDeveloper] = { ["Dridzt"] = 1, ["Bruce Quinton"] = 1, ["Kal_Zakath13"] = 1, ["Smurfy"] = 1, ["XMinionX"] = 1, ["Dussander"] = 1, ["Echobravo"] = 1, ["MacGregor"] = 1, ["LaoTseu"] = 1, ["Irozal"] = 1, ["EmForAce"] = 1, ["durandal42"] = 1, ["Dicebar"] = 1, ["Silarn"] = 1, ["slippycheeze"] = 1, ["binul"] = 1, ["elaundar"] = 1, ["Bodar"] = 1, ["chullah"] = 1, ["AoR_Derangement"] = 1, }, ["Tester"] = { ["Whishann"] = 1, ["HunterZ"] = 1, ["docthis"] = 1, ["Irdx"] = 1, ["TigaFIN"] = 1, ["iceeagle"] = 1, ["Denrax"] = 1, ["rasmoe"] = 1, ["Katlefiya"] = 1, ["gtmsece"] = 1, ["Militis"] = 1, ["Casard"] = 1, ["saltorio"] = 1, ["elusif"] = 1, ["DanoPDX"] = 1, }, [""] = { ["Kristi H."] = 3, ["Lawrence C."] = 3, ["Hellrush"] = 3, ["Fusyion"] = 3, ["Matt R."] = 3, ["Richard F.\n<Greatest Addon Supporter>"] = 3, }, ["Alterac Mountains"] = { ["Asgeirr\n<The Stone Council>"] = 3, }, ["Aman'Thul"] = { ["Blessmie\n<Chairman of the Horde>"] = 3, ["Zanoroy\n<The Mighty Few>"] = 3, }, ["Antonidas"] = { ["Colina\n<Drunken Monkey Brigade>"] = 3, }, ["Anvilmar"] = { ["Droodwrmycar"] = 3, }, ["Azgalore"] = { ["Dankris\n<Caligula's Pleasures>"] = 3, }, ["Azjol-Nerub"] = { ["Mythris"] = 3, }, ["Blackwater Raiders"] = { ["Maumau\n<No Quarter>"] = 3, }, ["Bronzebeard"] = { ["Jiminimonka\n<Go Rin No Sho>"] = 3, }, ["Dalaran"] = { ["Y C\n<Blurred Reality>"] = 3, }, ["Defias Brotherhood"] = { ["Maelmoor"] = 3, }, ["Draenor"] = { ["Emmerald\n<Adept>"] = 3, }, ["Draka"] = { ["Nagem\n<Loch Modan Yacht Club"] = 3, }, ["Durotar"] = { ["Haguen"] = 3, }, Ghostlands = { Nounchok = 3, }, ["Gnomeregan"] = { ["Calind\n<Swords of the Alliance>"] = 3, }, ["Jubei'Thos"] = { ["Thoresen\n<Verb>"] = 3, ["Thorgils"] = 3, }, ["Kargath"] = { ["Leara"] = 3, ["Burnaron\nLiga of Faliviens"] = 3, }, ["Khaz Modan"] = { ["Faizal"] = 3, }, ["Khaz'goroth"] = { ["Xentric\n<Cult of the Nuzzled Nark>"] = 3, }, ["Kul'Tiras"] = { ["Tharca"] = 3, }, ["Lightbringer"] = { ["Teldra\n<The Trust>"] = 3, }, ["Llane"] = { ["Chirily"] = 3, }, ["Malfurion"] = { ["Zetac\n<Hold Fast>"] = 3, }, ["Moonglade"] = { ["Ciev"] = 3, }, ["Rexxar"] = { ["Blitzi\n<Absolution>"] = 3, }, ["Scilla"] = { ["Blam\n<Syndicate>"] = 3, }, ["Sentinels"] = { ["Dhaktar"] = 3, }, ["Skywall"] = { ["Valerya"] = 3, }, ["Suramar"] = { ["Zendex"] = 3, ["Klaxon\n<Forbidden Planet"] = 3, }, ["Terrokkar"] = { ["Extropianus\n<The First Immortals>"] = 3, }, ["Thorium Brotherhood"] = { ["Pitchifus\n<Bloodforged>"] = 0, Tiae = 0, Airmid = 0, Pistachio = 0, Fizzlebang = 0, [Outfitter.cGuildCreditFormat:format("Bloodforged")] = 1, }, ["Ysondre"] = { ["Steikfrit"] = 3, }, ["Zangarmarsh"] = { ["Feliany"] = 3, }, } Outfitter.BannedCharacters = { } ---------------------------------------- ---------------------------------------- gOutfitter_Settings = nil gOutfitter_GlobalSettings = nil Outfitter.Initialized = false Outfitter.Suspended = false -- Outfit state Outfitter.OutfitStack = {} Outfitter.OutfitStack.Outfits = {} Outfitter.CurrentOutfit = nil Outfitter.ExpectedOutfit = nil Outfitter.CurrentInventoryOutfit = nil Outfitter.EquippedNeedsUpdate = false Outfitter.LastEquipmentUpdateTime = 0 Outfitter.SpecialState = {} -- The current state as determined by the engine, not necessarily the state of the outfit itself -- Player state Outfitter.CurrentZone = "" Outfitter.CurrentZoneIDs = {} Outfitter.InCombat = false Outfitter.MaybeInCombat = false Outfitter.IsDead = false Outfitter.IsFeigning = false Outfitter.BankFrameIsOpen = false Outfitter.VoidStorageIsOpen = false Outfitter.HasHWEvent = false Outfitter.SettingTypeInfo = { string = {Default = "", FrameType = "EditBox" }, number = {Default = 0, FrameType = "EditBox" }, stringtable = {Default = {}, FrameType = "ScrollableEditBox"}, zonelist = {Default = {}, FrameType = "ZoneListEditBox" }, boolean = {Default = false, FrameType = "Checkbox" }, } Outfitter.Style = {} Outfitter.Style.ButtonBar = { ButtonHeight = 37, ButtonWidth = 37, BackgroundTextureHeight = 128, BackgroundTextureWidth = 128, BackgroundWidth = 42, BackgroundWidth0 = 26, BackgroundWidthN = 27, BackgroundHeight = 41, BackgroundHeight0 = 28, BackgroundHeightN = 25, } -- UI Outfitter.CurrentPanel = 0 Outfitter.Collapsed = {} Outfitter.SelectedOutfit = nil Outfitter.DisplayIsDirty = true Outfitter.OutfitInfoCache = {} Outfitter.MaxSimpleTitles = 10 function Outfitter:FormatItemList(pList) local vNumItems = #pList if vNumItems == 0 then return "" elseif vNumItems == 1 then return string.format(self.cSingleItemFormat, pList[1]) elseif vNumItems == 2 then return string.format(self.cTwoItemFormat, pList[1], pList[2]) else local vStartIndex, vEndIndex, vPrefix, vRepeat, vSuffix = string.find(self.cMultiItemFormat, "(.*){{(.*)}}(.*)") local vResult local vParamIndex = 1 if vPrefix and string.find(vPrefix, "%%") then vResult = string.format(vPrefix, pList[1]) vParamIndex = 2 else vResult = vPrefix or "" end if vRepeat then for vIndex = vParamIndex, vNumItems - 1 do vResult = vResult..string.format(vRepeat, pList[vIndex]) end end if vSuffix then vResult = vResult..string.format(vSuffix, pList[vNumItems]) end return vResult end end -- Define global variables to be used directly in the XML -- file since those references can't be object paths Outfitter_cTitle = Outfitter.cTitle Outfitter_cTitleVersion = Outfitter.cTitleVersion Outfitter_cCreateUsingTitle = Outfitter.cCreateUsingTitle Outfitter_cAutomationLabel = Outfitter.cAutomationLabel Outfitter_cOutfitterTabTitle = Outfitter.cOutfitterTabTitle Outfitter_cOptionsTabTitle = Outfitter.cOptionsTabTitle Outfitter_cAboutTabTitle = Outfitter.cAboutTabTitle Outfitter_cNewOutfit = Outfitter.cNewOutfit Outfitter_cNameAlreadyUsedError = Outfitter.cNameAlreadyUsedError Outfitter_cEnableAll = Outfitter.cEnableAll Outfitter_cEnableNone = Outfitter.cEnableNone Outfitter_cOptionsTitle = Outfitter.cOptionsTitle Outfitter_cEditScriptTitle = Outfitter.cEditScriptTitle Outfitter_cEditScriptEllide = Outfitter.cEditScriptEllide Outfitter_cPresetScript = Outfitter.cPresetScript Outfitter_cSettings = Outfitter.cSettings Outfitter_cSource = Outfitter.cSource Outfitter_cIconFilterLabel = Outfitter.cIconFilterLabel Outfitter_cIconSetLabel = Outfitter.cIconSetLabel -- These definitions are for backward compatibility with third-party addons -- which call into Outfitter directly (OutfitterFu, FishingBuddy, ArkInventory) -- Hopefully the authors of those addons will eventually migrate their code to -- use the new functions instead so that these can eventually be eliminated. Outfitter_cCompleteOutfits = Outfitter.cCompleteOutfits Outfitter_cAccessoryOutfits = Outfitter.cAccessoryOutfits Outfitter_cOddsNEndsOutfits = Outfitter.cOddsNEndsOutfits function Outfitter_OnLoad(...) return Outfitter:OnLoad(...) end function Outfitter_IsInitialized(...) return Outfitter:IsInitialized(...) end function Outfitter_Update(...) return Outfitter:Update(...) end function Outfitter_FindOutfitByStatID(...) return Outfitter:FindOutfitByStatID(...) end function Outfitter_FindOutfitByName(...) return Outfitter:FindOutfitByName(...) end function Outfitter_GetCategoryOrder(...) return Outfitter:GetCategoryOrder(...) end function Outfitter_GetOutfitsByCategoryID(...) return Outfitter:GetOutfitsByCategoryID(...) end function Outfitter_HasVisibleOutfits(...) return Outfitter:HasVisibleOutfits(...) end function Outfitter_OutfitIsVisible(...) return Outfitter:OutfitIsVisible(...) end function Outfitter_GenerateSmartOutfit(pName, pStat, pInventoryCache, pAllowEmptyOutfit) return Outfitter:GenerateSmartOutfit(pName, pStat, pInventoryCache, pAllowEmptyOutfit) end function Outfitter_AddOutfit(...) return Outfitter:AddOutfit(...) end function Outfitter_DeleteOutfit(...) return Outfitter:DeleteOutfit(...) end function Outfitter_WearOutfit(pOutfit, pCategoryID, pWearBelowOutfit) return Outfitter:WearOutfit(pOutfit) end function Outfitter_RemoveOutfit(...) return Outfitter:RemoveOutfit(...) end function Outfitter_WearingOutfit(...) return Outfitter:WearingOutfit(...) end function Outfitter_RegisterOutfitEvent(...) return Outfitter:RegisterOutfitEvent(...) end function Outfitter_UnregisterOutfitEvent(...) return Outfitter:UnregisterOutfitEvent(...) end function Outfitter_GetCurrentOutfitInfo(...) return Outfitter:GetCurrentOutfitInfo(...) end function Outfitter_SetShowMinimapButton(...) return Outfitter:SetShowMinimapButton(...) end function Outfitter_GetItemInfoFromLink(...) return Outfitter:GetItemInfoFromLink(...) end function Outfitter_GetOutfitsUsingItem(...) return Outfitter:GetOutfitsUsingItem(...) end function OutfitterItemList_GetEquippableItems(...) return Outfitter:GetInventoryCache(...) end function OutfitterItemList_GetMissingItems(pItemList, ...) return pItemList:GetMissingItems(...) end function Outfitter.ItemList_GetEquippableItems(...) return Outfitter:GetInventoryCache(...) end function Outfitter.ItemList_GetMissingItems(pItemList, ...) return pItemList:GetMissingItems(...) end function Outfitter:OutfitUsesItem(pOutfit, pItemInfo) return pOutfit:OutfitUsesItem(pItemInfo) end -- Outfitter.cMinEquipmentUpdateInterval = 1.5 Outfitter.cInitializationEvents = { ["PLAYER_ENTERING_WORLD"] = true, ["BAG_UPDATE"] = true, ["UNIT_INVENTORY_CHANGED"] = true, ["ZONE_CHANGED_NEW_AREA"] = true, ["ZONE_CHANGED"] = true, ["ZONE_CHANGED_INDOORS"] = true, ["PLAYER_ALIVE"] = true, } -- Beginning in patch 8.0, WoW throws errors when registering for events which don't exist. This table contains all builtin event IDs so they can be avoided when registering events. Outfitter.BuiltinEvents = { ["TIMER"] = true, ["GAMETOOLTIP_SHOW"] = true, ["GAMETOOLTIP_HIDE"] = true, ["BATTLEGROUND"] = true, ["NOT_BATTLEGROUND"] = true, ["BATTLEGROUND_AV"] = true, ["NOT_BATTLEGROUND_AV"] = true, ["BATTLEGROUND_AB"] = true, ["NOT_BATTLEGROUND_AB"] = true, ["BATTLEGROUND_ARENA"] = true, ["NOT_BATTLEGROUND_ARENA"] = true, ["BATTLEGROUND_BLADESEDGE"] = true, ["NOT_BATTLEGROUND_BLADESEDGE"] = true, ["BATTLEGROUND_EOTS"] = true, ["NOT_BATTLEGROUND_EOTS"] = true, ["BATTLEGROUND_GILNEAS"] = true, ["NOT_BATTLEGROUND_GILNEAS"] = true, ["BATTLEGROUND_IOC"] = true, ["NOT_BATTLEGROUND_IOC"] = true, ["BATTLEGROUND_NAGRAND"] = true, ["NOT_BATTLEGROUND_NAGRAND"] = true, ["BATTLEGROUND_LORDAERON"] = true, ["NOT_BATTLEGROUND_LORDAERON"] = true, ["BATTLEGROUND_ROV"] = true, ["NOT_BATTLEGROUND_ROV"] = true, ["BATTLEGROUND_SEWERS"] = true, ["NOT_BATTLEGROUND_SEWERS"] = true, ["BATTLEGROUND_SOTA"] = true, ["NOT_BATTLEGROUND_SOTA"] = true, ["BATTLEGROUND_TWINPEAKS"] = true, ["NOT_BATTLEGROUND_TWINPEAKS"] = true, ["BATTLEGROUND_WG"] = true, ["NOT_BATTLEGROUND_WG"] = true, ["BATTLEGROUND_WSG"] = true, ["NOT_BATTLEGROUND_WSG"] = true, ["CASTER_FORM"] = true, ["NOT_CASTER_FORM"] = true, ["BEAR_FORM"] = true, ["NOT_BEAR_FORM"] = true, ["CAT_FORM"] = true, ["NOT_CAT_FORM"] = true, ["TRAVEL_FORM"] = true, ["NOT_TRAVEL_FORM"] = true, ["MOONKIN_FORM"] = true, ["NOT_MOONKIN_FORM"] = true, -- ["TREE_FORM"] = true, -- ["NOT_TREE_FORM"] = true, ["STEALTH"] = true, ["NOT_STEALTH"] = true, ["MOUNTED"] = true, ["NOT_MOUNTED"] = true, ["SPIRIT_REGEN"] = true, ["NOT_SPIRIT_REGEN"] = true, ["GHOST_WOLF"] = true, ["NOT_GHOST_WOLF"] = true, ["FEIGN_DEATH"] = true, ["NOT_FEIGN_DEATH"] = true, ["SWIMMING"] = true, ["NOT_SWIMMING"] = true, ["CITY"] = true, ["NOT_CITY"] = true, ["EVOCATE"] = true, ["NOT_EVOCATE"] = true, ["DINING"] = true, ["NOT_DINING"] = true, } Outfitter.BANKED_FONT_COLOR = CreateColor(0.25, 0.2, 1.0) Outfitter.BANKED_FONT_COLOR_CODE = "|cff4033ff" Outfitter.OUTFIT_MESSAGE_COLOR = CreateColor(0.2, 0.75, 0.3) Outfitter.IsWoW4 = true Outfitter.cItemLinkFormat = "|Hitem:(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+):(-?%d+)|h%[([^%]]*)%]|h" -- Phantom items are items which appear to be in a slot but which are actually the by-product of some other item being equipped in a different slot. This is being used in Patch 7 (Legion) for the artifact weapons which occupy both weapon slots. -- /dump {Outfitter:GetInventoryItemInfo("MainHandSlot").Code,Outfitter:GetInventoryItemInfo("SecondaryHandSlot").Code} Outfitter.PhantomItemIDs = { [133948] = true, -- Monk, Fists of the Heavaens [128293] = true, -- DK, Blades of the Fallen Prince [127830] = true, -- DH, Twinblades of the Deceiver [128831] = true, -- DH, Aldrachi Warblades [128859] = true, -- Druid, Fangs of Ashmane [128822] = true, -- Druid, Claws of Ursoc [133959] = true, -- Mage, Heart of the Phoenix [128867] = true, -- Paladin, Oathseeker [133958] = true, -- Priest, Secrets of the Void [128869] = true, -- Rogue, The Kingslayers [134552] = true, -- Rogue, Fortune [128479] = true, -- Rogue, Akaari's Will [128936] = true, -- Shaman, The Highkeeper's Ward [128873] = true, -- Shaman, Fury of the Stonemother [128934] = true, -- Shaman, Shield of the Sea Queen [137246] = true, -- Warlock, Spine of Thal'kiel [134553] = true, -- Warrior, Helya's Wrath [128288] = true, -- Warrior, Scaleshard } Outfitter.cUniqueGemItemIDs = { [33140] = 33140, -- Blood of Amber, ItemCode 33140, +13 Spell Critical Strike Rating [33139] = 33139, -- Brilliant Bladestone, ItemCode 33139, +12 Intellect [34256] = 34256, -- Charmed Amani Jewel, ItemCode 34256, +15 Stamina [33131] = 33131, -- Crimson Sun, ItemCode 33131, +24 Attack Power [33132] = 33132, -- Delicate Fire Ruby, ItemCode 33132, +12 Agility [33133] = 33133, -- Don Julio's Heart, ItemCode 33133 [33144] = 33144, -- Facet of Eternity, ItemCode 33144, +12 Defense Rating [33135] = 33135, -- Falling Star, ItemCode 33135, +18 Stamina [33141] = 33141, -- Great Bladestone, ItemCode 33141, +12 Spell Hit Rating [33134] = 33134, -- Kailee's Rose, ItemCode 33134, +26 Healing and +9 Spell Damage [33138] = 33138, -- Mystic Bladestone, ItemCode 33138, +12 Resilience Rating [32735] = 32735, -- Radiant Spencerite, ItemCode 32735, +20 Attack Power [33142] = 33142, -- Rigid Bladestone, ItemCode 33142, +12 Hit Rating [33137] = 33137, -- Sparkling Falling Star, ItemCode 33137, +12 Spirit [33143] = 3220, -- Stone of Blades, ItemCode 33143, +12 Critical Strike Rating [27679] = 2891, -- Sublime Mystic Dawnstone, ItemCode 27679, +10 Resilience Rating [27786] = 2899, -- Barbed Deep Peridot, ItemCode 27786 & 27809, +3 Stamina, +4 Critical Strike Rating [27809] = 2899, -- Barbed Deep Peridot, ItemCode 27786 & 27809, +3 Stamina, +4 Critical Strike Rating [30598] = 3103, -- Don Amancio's Heart, ItemCode 30598, +8 Strength (numerous enchants of +8 str) [30571] = 3065, -- Don Rodrigo's Heart, ItemCode 30571, +8 Strength [34831] = 3268, -- Eye of the Sea, ItemCode 34831, +15 Stamina [28360] = 2943, -- Mighty Blood Garnet, ItemCode 28360, +14 Attack Power [28361] = 2944, -- Mighty Blood Garnet, ItemCode 28361, +14 Attack Power [27785] = 2898, -- Notched Deep Peridot, ItemCode 27785, +3 Stamina, +4 Spell Critical Strike Rating [27820] = 2923, -- Notched Deep Peridot, ItemCode 27820, +3 Stamina, +4 Spell Critical Strike Rating [27777] = 2896, -- Stark Blood Garnet, ItemCode 27777, +8 Spell Damage [27812] = 2924, -- Stark Blood Garnet, ItemCode 27812, +8 Spell Damage [28557] = 2970, -- Swift Starfire Diamond, ItemCode 28557, +12 Spell Damage and Minor Run Speed Increase [28556] = 2969, -- Swift Windfire Diamond, ItemCode 28556, +20 Attack Power and Minor Run Speed Increase [32634] = 3156, -- Unstable Amethyst, ItemCode 32634, +8 Attack Power and +6 Stamina [32635] = 3157, -- Unstable Peridot, ItemCode 32635, [32636] = 3158, -- Unstable Sapphire, ItemCode 32636 [32637] = 3159, -- Unstable Citrine, ItemCode 32637, +8 Attack Power [32638] = 3160, -- Unstable Topaz, ItemCode 32638 [32639] = 3161, -- Unstable Talasite, ItemCode 32639 -- WotLK unique-equipped [42701] = 3749, -- Enchanted Pearl, +4 all stats, ItemCode 42701 [42702] = 3750, -- Enchanted Tear, +6 all stats, ItemCode 42702 [44066] = 3792, -- Kharmaa's Grace, +20 resilience, ItemCode 44066 -- WotLK JC Prismatics (unique-equipped x 3) [36766] = "PRISM3", -- Bright Dragon's Eye, 54att, ItemCode 36766 [36767] = "PRISM3", -- Solid Dragon's Eye, 41stam, ItemCode 36767 [42142] = "PRISM3", -- Bold Dragon's Eye, 27str, ItemCode 42142 [42143] = "PRISM3", -- Delicate Dragon's Eye, 27agi, ItemCode 42143 [42144] = "PRISM3", -- Runed Dragon's Eye, 32spell, ItemCode 42144 [42145] = "PRISM3", -- Sparkling Dragon's Eye, 27spi, ItemCode 42145 [42146] = "PRISM3", -- Lustrous Dragon's Eye, 11mp5, ItemCode 42146 [42148] = "PRISM3", -- Brilliant Dragon's Eye, 27int, ItemCode 42148 [42149] = "PRISM3", -- Smooth Dragon's Eye, 27crit, ItemCode 42149 [42150] = "PRISM3", -- Quick Dragon's Eye, 27haste, ItemCode 42150 [42151] = "PRISM3", -- Subtle Dragon's Eye, 27dodge, ItemCode 42151 [42152] = "PRISM3", -- Flashing Dragon's Eye, 27parry, ItemCode 42152 [42153] = "PRISM3", -- Fractured Dragon's Eye, 27armorpen, ItemCode 42153 [42154] = "PRISM3", -- Precise Dragon's Eye, 27exp, ItemCode 42154 [42155] = "PRISM3", -- Stormy Dragon's Eye, 32spellpen, ItemCode 42155 [42156] = "PRISM3", -- Rigid Dragon's Eye, 27hit, ItemCode 42156 [42157] = "PRISM3", -- Thick Dragon's Eye, 27def, ItemCode 42157 [42158] = "PRISM3", -- Mystic Dragon's Eye, 27resil, ItemCode 42158 -- Patch 3.2 [49110] = 49110, -- Nightmare Tear -- Cataclysm JC [52255] = "PRISM3", -- Bold Chimera's Eye [52257] = "PRISM3", -- Brilliant Chimera's Eye [52258] = "PRISM3", -- Delicate Chimera's Eye [52259] = "PRISM3", -- Flashing Chimera's Eye [52269] = "PRISM3", -- Fractured Chimera's Eye [52267] = "PRISM3", -- Mystic Chimera's Eye [52260] = "PRISM3", -- Precise Chimera's Eye [52268] = "PRISM3", -- Quick Chimera's Eye [52264] = "PRISM3", -- Rigid Chimera's Eye [52266] = "PRISM3", -- Smooth Chimera's Eye [52261] = "PRISM3", -- Solid Chimera's Eye [52262] = "PRISM3", -- Sparkling Chimera's Eye [52263] = "PRISM3", -- Stormy Chimera's Eye [52265] = "PRISM3", -- Subtle Chimera's Eye -- MoP JC [83141] = "FACET2", -- Bold Serpent's Eye [83142] = "FACET2", -- Quick Serpent's Eye [83143] = "FACET2", -- Fractured Serpent's Eye [83144] = "FACET2", -- Rigid Serpent's Eye [83145] = "FACET2", -- Subtle Serpent's Eye [83146] = "FACET2", -- Smooth Serpent's Eye [83147] = "FACET2", -- Precise Serpent's Eye [83148] = "FACET2", -- Solid Serpent's Eye [83149] = "FACET2", -- Sparkling Serpent's Eye [83150] = "FACET2", -- Brilliant Serpent's Eye [83151] = "FACET2", -- Delicate Serpent's Eye [83152] = "FACET2", -- Flashing Serpent's Eye -- MoP Cogwheel [77540] = 77540, -- Subtle Tinker's Gear [77541] = 77541, -- Smooth Tinker's Gear [77542] = 77542, -- Quick Tinker's Gear [77543] = 77543, -- Precise Tinker's Gear [77544] = 77544, -- Flashing Tinker's Gear [77545] = 77545, -- Rigid Tinker's Gear [77546] = 77546, -- Sparkling Tinker's Gear [77547] = 77547, -- Fractured Tinker's Gear -- MoP JC [93404] = "FACET2", -- Resplendent [93405] = "FACET2", -- Lucent [93406] = "FACET2", -- Willful [93408] = "FACET2", -- Tense [93409] = "FACET2", -- Assassin's [93410] = "FACET2", -- Mysterious } StaticPopupDialogs.OUTFITTER_CANT_RELOADUI = { text = Outfitter.cCantReloadUI, button1 = OKAY, OnAccept = function() end, OnCancel = function() end, timeout = 0, whileDead = 1, hideOnEscape = 1, showAlert = 1, } StaticPopupDialogs.OUTFITTER_SERVER_FULL = { text = Outfitter.cTooManyServerOutfits, button1 = OKAY, OnAccept = function() end, OnCancel = function() end, timeout = 0, whileDead = 1, hideOnEscape = 1, showAlert = 1, } StaticPopupDialogs.OUTFITTER_CANT_SET_ICON = { text = Outfitter.cCantSetIcon, button1 = Outfitter.cChangeIcon, button2 = CANCEL, OnAccept = function() end, OnCancel = function() end, timeout = 0, whileDead = 1, hideOnEscape = 1, showAlert = 1, } StaticPopupDialogs.OUTFITTER_CONFIRM_DELETE = { text = Outfitter.cConfirmDeleteMsg, button1 = DELETE, button2 = CANCEL, OnAccept = function() Outfitter:DeleteSelectedOutfit() end, timeout = 0, whileDead = 1, hideOnEscape = 1 } StaticPopupDialogs.OUTFITTER_CONFIRM_REBUILD = { text = Outfitter.cConfirmRebuildMsg, button1 = Outfitter.cRebuild, button2 = CANCEL, OnAccept = function() Outfitter:RebuildOutfit(Outfitter.OutfitToRebuild) Outfitter.OutfitToRebuild = nil end, timeout = 0, whileDead = 1, hideOnEscape = 1, } StaticPopupDialogs.OUTFITTER_CONFIRM_SET_CURRENT = { text = Outfitter.cConfirmSetCurrentMsg, button1 = Outfitter.cSetCurrent, button2 = CANCEL, OnAccept = function() Outfitter:SetOutfitToCurrent(Outfitter.OutfitToRebuild); Outfitter.OutfitToRebuild = nil end, timeout = 0, whileDead = 1, hideOnEscape = 1, } Outfitter.cCategoryDescriptions = { Complete = Outfitter.cCompleteCategoryDescription, Accessory = Outfitter.cAccessoryCategoryDescription, OddsNEnds = Outfitter.cOddsNEndsCategoryDescription, BoEs = Outfitter.cBoEsCategoryDescription, } Outfitter.cSlotNames = { -- First priority goes to armor "HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot", "WaistSlot", "LegsSlot", "FeetSlot", -- Second priority goes to weapons "MainHandSlot", "SecondaryHandSlot", "RangedSlot", -- Last priority goes to items with no durability "BackSlot", "NeckSlot", "ShirtSlot", "TabardSlot", "Finger0Slot", "Finger1Slot", "Trinket0Slot", "Trinket1Slot", "AmmoSlot", } Outfitter.cSlotOrder = {} for vIndex, vSlotName in ipairs(Outfitter.cSlotNames) do Outfitter.cSlotOrder[vSlotName] = vIndex end Outfitter.cSlotDisplayNames = { HeadSlot = HEADSLOT, NeckSlot = NECKSLOT, ShoulderSlot = SHOULDERSLOT, BackSlot = BACKSLOT, ChestSlot = CHESTSLOT, ShirtSlot = SHIRTSLOT, TabardSlot = TABARDSLOT, WristSlot = WRISTSLOT, HandsSlot = HANDSSLOT, WaistSlot = WAISTSLOT, LegsSlot = LEGSSLOT, FeetSlot = FEETSLOT, Finger0Slot = Outfitter.cFinger0SlotName, Finger1Slot = Outfitter.cFinger1SlotName, Trinket0Slot = Outfitter.cTrinket0SlotName, Trinket1Slot = Outfitter.cTrinket1SlotName, MainHandSlot = MAINHANDSLOT, SecondaryHandSlot = SECONDARYHANDSLOT, RangedSlot = RANGEDSLOT, AmmoSlot = AMMOSLOT, } Outfitter.cInvTypeToSlotName = { INVTYPE_2HWEAPON = {SlotName = "MainHandSlot", MetaSlotName = "TwoHandSlot"}, INVTYPE_BODY = {SlotName = "ShirtSlot"}, INVTYPE_CHEST = {SlotName = "ChestSlot"}, INVTYPE_CLOAK = {SlotName = "BackSlot"}, INVTYPE_FEET = {SlotName = "FeetSlot"}, INVTYPE_FINGER = {SlotName = "Finger0Slot"}, INVTYPE_HAND = {SlotName = "HandsSlot"}, INVTYPE_HEAD = {SlotName = "HeadSlot"}, INVTYPE_HOLDABLE = {SlotName = "SecondaryHandSlot"}, INVTYPE_LEGS = {SlotName = "LegsSlot"}, INVTYPE_NECK = {SlotName = "NeckSlot"}, INVTYPE_ROBE = {SlotName = "ChestSlot"}, INVTYPE_SHIELD = {SlotName = "SecondaryHandSlot"}, INVTYPE_SHOULDER = {SlotName = "ShoulderSlot"}, INVTYPE_TABARD = {SlotName = "TabardSlot"}, INVTYPE_TRINKET = {SlotName = "Trinket0Slot"}, INVTYPE_WAIST = {SlotName = "WaistSlot"}, INVTYPE_WEAPON = {SlotName = "MainHandSlot", MetaSlotName = "Weapon0Slot"}, INVTYPE_WEAPONMAINHAND = {SlotName = "MainHandSlot"}, INVTYPE_WEAPONOFFHAND = {SlotName = "SecondaryHandSlot"}, INVTYPE_WRIST = {SlotName = "WristSlot"}, INVTYPE_RANGED = {SlotName = "RangedSlot"}, INVTYPE_RANGEDRIGHT = {SlotName = "AmmoSlot"}, INVTYPE_THROWN = {SlotName = "RangedSlot"}, INVTYPE_RELIC = {SlotName = "RangedSlot"}, } Outfitter.cHalfAlternateStatSlot = { Trinket0Slot = "Trinket1Slot", Finger0Slot = "Finger1Slot", Weapon0Slot = "Weapon1Slot", } Outfitter.cFullAlternateStatSlot = { Trinket0Slot = "Trinket1Slot", Trinket1Slot = "Trinket0Slot", Finger0Slot = "Finger1Slot", Finger1Slot = "Finger0Slot", Weapon0Slot = "Weapon1Slot", Weapon1Slot = "Weapon0Slot", } Outfitter.cCategoryOrder = { "Complete", "Accessory" } Outfitter.cItemAliases = { [18608] = 18609, -- Benediction -> Anathema [18609] = 18608, -- Anathema -> Benediction [17223] = 17074, -- Thunderstrike -> Shadowstrike [17074] = 17223, -- Shadowstrike -> Thunderstrike [46069] = 46106, -- Alliance Lance -> Argent Lance [46070] = 46106, -- Horde Lance -> Argent Lance [46106] = 46069, -- Argent Lance -> Alliance Lance (will be replaced by Horde Lance at runtime) } Outfitter.cIgnoredUnusedItems = { [2901] = "Mining Pick", [5956] = "Blacksmith hammer", [6219] = "Arclight Spanner", [7005] = "Skinning Knife", [7297] = "Morbent's Bane", [10696] = "Enchanted Azsharite Felbane Sword", [10697] = "Enchanted Azsharite Felbane Dagger", [10698] = "Enchanted Azsharite Felbane Staff", [20406] = "Twilight Cultist Mantle", [20407] = "Twilight Cultist Robe", [20408] = "Twilight Cultist Cowl", [136350] = "Brumdysla, Hammer of Vrorsk" } Outfitter.cSmartOutfits = { -- {Name = Outfitter.cFishingOutfit, StatID = "FISHING", ScriptID = "Fishing"}, -- {Name = Outfitter.cHerbalismOutfit, StatID = "HERBALISM", ScriptID = "Herbalism"}, -- {Name = Outfitter.cMiningOutfit, StatID = "MINING", ScriptID = "Mining"}, -- {Name = Outfitter.cSkinningOutfit, StatID = "SKINNING", ScriptID = "Skinning"}, } Outfitter.cSpecialIDEvents = { Bear = {Equip = "BEAR_FORM", Unequip = "NOT_BEAR_FORM"}, Cat = {Equip = "CAT_FORM", Unequip = "NOT_CAT_FORM"}, Travel = {Equip = "TRAVEL_FORM", Unequip = "NOT_TRAVEL_FORM"}, Moonkin = {Equip = "MOONKIN_FORM", Unequip = "NOT_MOONKIN_FORM"}, -- Tree = {Equip = "TREE_FORM", Unequip = "NOT_TREE_FORM"}, Prowl = {Equip = "STEALTH", Unequip = "NOT_STEALTH"}, Caster = {Equip = "CASTER_FORM", Unequip = "NOT_CASTER_FORM"}, Stealth = {Equip = "STEALTH", Unequip = "NOT_STEALTH"}, GhostWolf = {Equip = "GHOST_WOLF", Unequip = "NOT_GHOST_WOLF"}, Feigning = {Equip = "FEIGN_DEATH", Unequip = "NOT_FEIGN_DEATH"}, Evocate = {Equip = "EVOCATE", Unequip = "NOT_EVOCATE"}, Dining = {Equip = "DINING", Unequip = "NOT_DINING"}, City = {Equip = "CITY", Unequip = "NOT_CITY"}, Riding = {Equip = "MOUNTED", Unequip = "NOT_MOUNTED"}, Swimming = {Equip = "SWIMMING", Unequip = "NOT_SWIMMING"}, Spirit = {Equip = "SPIRIT_REGEN", Unequip = "NOT_SPIRIT_REGEN"}, ArgentDawn = {Equip = "ARGENT_DAWN", Unequip = "NOT_ARGENT_DAWN"}, Battleground = {Equip = "BATTLEGROUND", Unequip = "NOT_BATTLEGROUND"}, AB = {Equip = "BATTLEGROUND_AB", Unequip = "NOT_BATTLEGROUND_AB"}, AV = {Equip = "BATTLEGROUND_AV", Unequip = "NOT_BATTLEGROUND_AV"}, WSG = {Equip = "BATTLEGROUND_WSG", Unequip = "NOT_BATTLEGROUND_WSG"}, EotS = {Equip = "BATTLEGROUND_EOTS", Unequip = "NOT_BATTLEGROUND_EOTS"}, SotA = {Equip = "BATTLEGROUND_SOTA", Unequip = "NOT_BATTLEGROUND_SOTA"}, IoC = {Equip = "BATTLEGROUND_IOC", Unequip = "NOT_BATTLEGROUND_IOC"}, Wintergrasp = {Equip = "BATTLEGROUND_WG", Unequip = "NOT_BATTLEGROUND_WG"}, Sewers = {Equip = "BATTLEGROUND_SEWERS", Unequip = "NOT_BATTLEGROUND_SEWERS"}, Gilneas = {Equip = "BATTLEGROUND_GILNEAS", Unequip = "NOT_BATTLEGROUND_GILNEAS"}, TwinPeaks = {Equip = "BATTLEGROUND_TWINPEAKS", Unequip = "NOT_BATTLEGROUND_TWINPEAKS"}, RingOfValor = {Equip = "BATTLEGROUND_ROV", Unequip = "NOT_BATTLEGROUND_ROV"}, Arena = {Equip = "BATTLEGROUND_ARENA", Unequip = "NOT_BATTLEGROUND_ARENA"}, BladesEdgeArena = {Equip = "BATTLEGROUND_BLADESEDGE", Unequip = "NOT_BATTLEGROUND_BLADESEDGE"}, NagrandArena = {Equip = "BATTLEGROUND_NAGRAND", Unequip = "NOT_BATTLEGROUND_NAGRAND"}, LordaeronArena = {Equip = "BATTLEGROUND_LORDAERON", Unequip = "NOT_BATTLEGROUND_LORDAERON"}, } Outfitter.cClassSpecialOutfits = { WARRIOR = { }, DRUID = { {Name = Outfitter.cDruidCasterForm, ScriptID = "Caster"}, {Name = Outfitter.cDruidBearForm, ScriptID = "Bear"}, {Name = Outfitter.cDruidCatForm, ScriptID = "Cat"}, {Name = Outfitter.cDruidTravelForm, ScriptID = "Travel"}, {Name = Outfitter.cDruidMoonkinForm, ScriptID = "Moonkin"}, {Name = Outfitter.cDruidTreeOfLifeForm, ScriptID = "Tree"}, {Name = Outfitter.cDruidProwl, ScriptID = "Prowl"}, }, PRIEST = { }, ROGUE = { {Name = Outfitter.cRogueStealth, ScriptID = "Stealth"}, }, SHAMAN = { {Name = Outfitter.cShamanGhostWolf, ScriptID = "GhostWolf"}, }, HUNTER = { }, MAGE = { }, DEATHKNIGHT = { }, MONK = { }, DEMONHUNTER = { }, } Outfitter.cSpellIDToSpecialID = { [13165] = "Hawk", [14318] = "Hawk", [14319] = "Hawk", [14320] = "Hawk", [14321] = "Hawk", [14322] = "Hawk", [25296] = "Hawk", [27044] = "Hawk", [61846] = "Hawk", [61847] = "Hawk", [12051] = "Evocate", [2645] = "GhostWolf", [5384] = "Feigning", [58984] = "Prowl", } Outfitter.cAuraIconSpecialID = { [134062] = "Dining", [132805] = "Dining", } -- Note that zone special outfits will be worn in the order -- the are listed here, with later outfits being worn over -- earlier outfits (when they're being applied at the same time) -- This allows BG-specific outfits to take priority over the generic -- BG outfit Outfitter.cZoneSpecialIDs = { "ArgentDawn", "City", "Battleground", "Arena", "AV", "AB", "WSG", "EotS", "SotA", "IoC", "BladesEdgeArena", "NagrandArena", "LordaeronArena", } Outfitter.cZoneSpecialIDMap = { --[[ [GetMapNameByID(22)] = {"ArgentDawn"}, -- Western Plaguelands [GetMapNameByID(23)] = {"ArgentDawn"}, -- Eastern Plaguelands [GetMapNameByID(765)] = {"ArgentDawn"}, -- Stratholme [GetMapNameByID(763)] = {"ArgentDawn"}, -- Scholomance [GetMapNameByID(535)] = {"Naxx"}, -- Naxxramas [GetMapNameByID(401)] = {"Battleground", "AV"}, -- Alterac Valley [GetMapNameByID(461)] = {"Battleground", "AB"}, -- Arathi Basin [GetMapNameByID(443)] = {"Battleground", "WSG"}, -- Warsong Gulch [Outfitter.LSZ["Silverwing Hold"] ] = {"Battleground", "WSG"}, -- Silverwing Hold [Outfitter.LSZ["Warsong Lumber Mill"] ] = {"Battleground", "WSG"}, -- Warsong Lumber Mill [GetMapNameByID(482)] = {"Battleground", "EotS"}, -- Eye of the Storm [GetMapNameByID(512)] = {"Battleground", "SotA"}, -- Strand of the Ancients [GetMapNameByID(540)] = {"Battleground", "IoC"}, -- Isle of Conquest [GetMapNameByID(501)] = {"Battleground", "Wintergrasp"}, -- Wintergrasp [GetMapNameByID(736)] = {"Battleground", "Gilneas"}, -- Battle for Gilneas [GetMapNameByID(626)] = {"Battleground", "TwinPeaks"}, -- Twin Peaks [Outfitter.LSZ["Wildhammer Stronghold"] ] = {"Battleground", "TwinPeaks"}, -- Wildhammer Stronghold [Outfitter.LSZ["Dragonmaw Stronghold"] ] = {"Battleground", "TwinPeaks"}, -- Dragonmaw Stronghold -- Arenas -- [GetMapNameByID(Dalaran Sewers)] = {"Battleground", "Arena", "Sewers"}, -- Dalaran Sewers -- [GetMapNameByID(The Ring of Valor)] = {"Battleground", "Arena", "RingOfValor"}, -- The Ring of Valor -- [GetMapNameByID(Blade's Edge Arena)] = {"Battleground", "BladesEdgeArena", "Arena"}, -- Blade's Edge Arena -- [GetMapNameByID(Nagrand Arena)] = {"Battleground", "NagrandArena", "Arena"}, -- Nagrand Arena -- [GetMapNameByID(Ruins of Lordaeron)] = {"Battleground", "LordaeronArena", "Arena"}, -- Ruins of Lordaeron [GetMapNameByID(341)] = {"City"}, -- Ironforge [Outfitter.LSZ["City of Ironforge"] ] = {"City"}, -- City of Ironforge [Outfitter.LSZ["Miwana's Longhouse"] ] = {"City"}, -- Miwana's Longhouse [GetMapNameByID(381)] = {"City"}, -- Darnassus -- [GetMapNameByID(Stormwind)] = {"City"}, -- Stormwind [GetMapNameByID(301)] = {"City"}, -- Stormwind City [GetMapNameByID(321)] = {"City"}, -- Orgrimmar [GetMapNameByID(362)] = {"City"}, -- Thunder Bluff [GetMapNameByID(382)] = {"City"}, -- Undercity [GetMapNameByID(480)] = {"City"}, -- Silvermoon City [GetMapNameByID(471)] = {"City"}, -- The Exodar [GetMapNameByID(481)] = {"City"}, -- Shattrath City [GetMapNameByID(504)] = {"City"}, -- Dalaran [GetMapNameByID(903)] = {"City"}, -- Shrine of Two Moons [GetMapNameByID(905)] = {"City"}, -- Shrine of Seven Stars ]] } -- As of patch 3.3 automated combat swaps aren't allowed. I'm -- leaving the code in but emptying the slot list in -- case an acceptable workaround is discovered which would -- make it useful again. Outfitter.cCombatEquipmentSlots = { --[[ MainHandSlot = true, SecondaryHandSlot = true, ]] } Outfitter.InventoryCache = nil Outfitter.cMaxDisplayedItems = 14 Outfitter.cPanelFrames = { "OutfitterMainFrame", "OutfitterOptionsFrame", "OutfitterAboutFrame", } Outfitter.cShapeshiftIDInfo = { -- Druid [5487] = {ID = "Bear", MaybeInCombat = true}, [768] = {ID = "Cat"}, [783] = {ID = "Travel"}, [24858] = {ID = "Moonkin"}, CasterForm = {ID = "Caster"}, -- this is a psuedo-form which is active when no other druid form is -- Rogue [1784] = {ID = "Stealth"}, } function Outfitter:ToggleOutfitterFrame() if self:IsOpen() then OutfitterFrame:Hide() else OutfitterFrame:Show() end end function Outfitter:IsOpen() return OutfitterFrame:IsVisible() end function Outfitter:OnLoad() for vEventID, _ in pairs(self.cInitializationEvents) do self.EventLib:RegisterEvent(vEventID, self.InitializationCheck, self) end end function Outfitter:OnShow() self.SetFrameLevel(OutfitterFrame, PaperDollFrame:GetFrameLevel() - 1) self:ShowPanel(1) -- Always switch to the main view when showing the window end function Outfitter:OnHide() self:ClearSelection() if self.QuickSlots and self.QuickSlots.Close then self.QuickSlots:Close() end if self.NameOutfitDialog and self.NameOutfitDialog:IsShown() then self.NameOutfitDialog:Cancel() end if self.RebuildOutfitDialog and self.RebuildOutfitDialog:IsShown() then self.RebuildOutfitDialog:Cancel() end OutfitterFrame:Hide() -- This seems redundant, but the OnHide handler gets called -- in response to the parent being hidden (the character window) -- so calling Hide() on the frame here ensures that when the -- character window is hidden then Outfitter won't be displayed -- next time it's opened end function Outfitter:SchedulePlayerEnteringWorld() self.SchedulerLib:RescheduleTask(0.05, self.PlayerEnteringWorld, self) end function Outfitter:PlayerEnteringWorld() self.IsCasting = false self.IsChanneling = false self:BeginEquipmentUpdate() self:FlushInventoryCache() self:RegenEnabled() self:UpdateAuraStates() self:ScheduleUpdateZone() self:ResumeLoadScreenEvents() self:ScheduleSynch() -- Always sync on entering world -- self:SynchronizeEM() self:EndEquipmentUpdate() end function Outfitter:PlayerLeavingWorld() -- To improve load screen performance, suspend events which are -- fired repeatedly and rapidly during zoning self.Suspended = true self.EventLib:UnregisterEvent("BAG_UPDATE", self.BagUpdate, self) self.EventLib:UnregisterEvent("UNIT_INVENTORY_CHANGED", self.UnitInventoryChanged, self) self.EventLib:UnregisterEvent("UNIT_AURA", self.UnitAuraChanged, self) self.EventLib:UnregisterEvent("PLAYERBANKSLOTS_CHANGED", self.BankSlotsChanged, self) end function Outfitter:ResumeLoadScreenEvents() if self.Suspended then -- To improve load screen performance, suspend events which are -- fired repeatedly and rapidly during zoning self.Suspended = false self.EventLib:RegisterEvent("BAG_UPDATE", self.BagUpdate, self) self.EventLib:RegisterEvent("UNIT_INVENTORY_CHANGED", self.UnitInventoryChanged, self, true) -- Register as a blind event handler (no event id param) self.EventLib:RegisterEvent("UNIT_AURA", self.UnitAuraChanged, self) self.EventLib:RegisterEvent("PLAYERBANKSLOTS_CHANGED", self.BankSlotsChanged, self) end end function Outfitter:VariablesLoaded() self.Settings = gOutfitter_Settings end function Outfitter:BankSlotsChanged() self:ScheduleSynch() end function Outfitter:BagUpdate() self:ScheduleSynch() end Outfitter.OutfitEvents = {} function Outfitter:RegisterOutfitEvent(pEvent, pFunction) local vHandlers = self.OutfitEvents[pEvent] if not vHandlers then vHandlers = {} self.OutfitEvents[pEvent] = vHandlers end table.insert(vHandlers, pFunction) end function Outfitter:UnregisterOutfitEvent(pEvent, pFunction) local vHandlers = self.OutfitEvents[pEvent] if not vHandlers then return end for vIndex, vFunction in ipairs(vHandlers) do if vFunction == pFunction then table.remove(vHandlers, vIndex) return end end end function Outfitter:DispatchOutfitEvent(pEvent, pParameter1, pParameter2) -- Don't send out events until we're initialized if not self.Initialized then return end -- Post a message local vHandlers = self.OutfitEvents[pEvent] if vHandlers then for _, vFunction in ipairs(vHandlers) do -- Call in protected mode so that if they fail it doesn't -- screw up Outfitter or other addons wishing to be notified local vSucceeded, vMessage = pcall(vFunction, pEvent, pParameter1, pParameter2) if vMessage then self:ErrorMessage("Error dispatching event "..pEvent) self:ErrorMessage(vMessage) end end end local vEventID if pEvent == "WEAR_OUTFIT" then vEventID = "OUTFIT_EQUIPPED" elseif pEvent == "UNWEAR_OUTFIT" then vEventID = "OUTFIT_UNEQUIPPED" end local vOutfits = self.OutfitScriptEvents[vEventID] if vOutfits then local vScriptContext = vOutfits[pParameter2] if vScriptContext then local vSucceeded, vMessage = pcall(vScriptContext.Function, vScriptContext, vEventID) if vMessage then self:ErrorMessage("Error dispatching outfit event %s", pEvent or "nil") self:ErrorMessage(vMessage) end end end -- Translate to the event ids for dispatch through the event system if pEvent == "WEAR_OUTFIT" then self.EventLib:DispatchEvent("WEAROUTFIT") elseif pEvent == "UNWEAR_OUTFIT" then self.EventLib:DispatchEvent("UNWEAROUTFIT") end -- Set the correct Helm and Cloak settings. self.OutfitStack:UpdateOutfitDisplay() --self.SchedulerLib:ScheduleUniqueTask(0.5, self.OutfitStack.UpdateOutfitDisplay, self.OutfitStack) self.SchedulerLib:ScheduleUniqueTask(0.1, self.UpdateCurrentOutfitIcon, self) end function Outfitter:UpdateCurrentOutfitIcon() local _, vOutfit = self:GetCurrentOutfitInfo() local vTexture = self.OutfitBar:GetOutfitTexture(vOutfit) if type(vTexture) == "number" then vTexture = self:ConvertTextureIDToPath(vTexture) end SetPortraitToTexture(OutfitterMinimapButton.CurrentOutfitTexture, vTexture) end function Outfitter:BankFrameOpened() self.BankFrameIsOpen = true self:BankSlotsChanged() end function Outfitter:BankFrameClosed() self.BankFrameIsOpen = false self:BankSlotsChanged() end function Outfitter:VoidStorageFrameOpened() self.VoidStorageIsOpen = true end function Outfitter:VoidStorageFrameClosed() self.VoidStorageIsOpen = false end function Outfitter:RegenDisabled(pEvent) self.InCombat = true if self.OutfitBar then self.OutfitBar:AdjustAlpha() end self.OutfitStack:UpdateOutfitDisplay() self:SuspendSecureActions() end function Outfitter:RegenEnabled(pEvent) self:BeginEquipmentUpdate() self.InCombat = false self:EndEquipmentUpdate() if self.OutfitBar then self.OutfitBar:AdjustAlpha() end self.OutfitStack:UpdateOutfitDisplay() self:ResumeSecureActions() end function Outfitter:SuspendSecureActions() for index = 1, self.cMaxDisplayedItems do local item = _G["OutfitterItem"..(index - 1)] item:suspendSecureActions() end end function Outfitter:ResumeSecureActions() for index = 1, self.cMaxDisplayedItems do local item = _G["OutfitterItem"..(index - 1)] item:resumeSecureActions() end end function Outfitter:PlayerDead(pEvent) self.IsDead = true end function Outfitter:PlayerAlive(pEvent) self:BeginEquipmentUpdate() self.IsDead = false self:UpdateAuraStates() self:EndEquipmentUpdate() end function Outfitter:UnitHealthOrManaChanged(pUnitID) if pUnitID ~= "player" then return end self:BeginEquipmentUpdate() -- Check to see if the player is full while dining if self.SpecialState.Dining and self:PlayerIsFull() then self:SetSpecialOutfitEnabled("Dining", false) end -- If the mana drops, see if there was a recent spellcast local vPlayerMana = UnitPower("player") if vPlayerMana and (not self.PreviousManaLevel or vPlayerMana < self.PreviousManaLevel) then local vTime = GetTime() if self.SpellcastSentTime and vTime < self.SpellcastSentTime + 10 then self.SpellcastSentTime = nil -- Five second rule has begun if self.SpiritRegenEnabled then self.SpiritRegenEnabled = false self:SetSpecialOutfitEnabled("Spirit", false) end self.SchedulerLib:RescheduleTask(5.0, self.SpiritRegenTimer, self) end end self.PreviousManaLevel = vPlayerMana -- if self.SpellcastSentMana then self.SchedulerLib:RescheduleTask(0.01, self.CheckSpellcastManaDrop, self) end -- self:EndEquipmentUpdate() end function Outfitter:UnitSpellcastDebug(pEventID, pUnitID, pSpellName) if pUnitID ~= "player" then return end self:DebugMessage("UnitSpellcastDebug: %s %s %s", pEventID, pUnitID, pSpellName) end function Outfitter:UnitSpellcastSent(pEventID, pUnitID, pSpellName) if pUnitID ~= "player" then return end self.SpellcastSentTime = GetTime() if not self.IsCasting then self.IsCasting = true end end function Outfitter:UnitSpellcastChannelStart(pEventID, pUnitID, pSpellName) if pUnitID ~= "player" then return end self.IsChanneling = true end function Outfitter:UnitSpellcastChannelStop(pEventID, pUnitID, pSpellName) if pUnitID ~= "player" then return end if not self.IsChanneling then return end self:BeginEquipmentUpdate() self.IsChanneling = false self.IsCasting = false self:SetUpdateDelay(GetTime(), 0.5) -- Need a short delay because the 'in combat' message doesn't come until after the spellcast is done self:EndEquipmentUpdate() end function Outfitter:UnitSpellcastStop(pEventID, pUnitID, pSpellName) if pUnitID ~= "player" then return end if not self.IsCasting then return end self:BeginEquipmentUpdate() self.IsCasting = false self:SetUpdateDelay(GetTime(), 0.5) -- Need a short delay because the 'in combat' message doesn't come until after the spellcast is done self:EndEquipmentUpdate() end function Outfitter:SpiritRegenTimer() self.SpiritRegenEnabled = true self:SetSpecialOutfitEnabled("Spirit", true) end function Outfitter:PlayerIsFull() if UnitHealth("player") < (UnitHealthMax("player") * 0.85) then return false end if UnitPowerType("player") ~= 0 then return true end return UnitPower("player") > (UnitPowerMax("player") * 0.85) end function Outfitter:UnitInventoryChanged(pUnitID) if pUnitID == "player" then self:ScheduleSynch() end end function Outfitter:InventoryChanged() self.DisplayIsDirty = true -- Update the list so the checkboxes reflect the current state local vNewItemsOutfit, vCurrentOutfit = self:GetNewItemsOutfit(self.CurrentOutfit) if vNewItemsOutfit then -- Save the new outfit self.CurrentOutfit = vCurrentOutfit -- Update the selected outfit or temporary outfit self:SubtractOutfit(vNewItemsOutfit, self.ExpectedOutfit) if next(vNewItemsOutfit.Items) then if self.SelectedOutfit then self:UpdateOutfitFromInventory(self.SelectedOutfit, vNewItemsOutfit) else self:UpdateTemporaryOutfit(vNewItemsOutfit) end end if self.QuickSlots and self.QuickSlots.InventoryChanged then self.QuickSlots:InventoryChanged(false) end end -- Fire off an event if the current outfit matches the expected outfit if not self.EquippedNeedsUpdate and self:OutfitItemsAreSame(self.CurrentOutfit, self.ExpectedOutfit, nil, true) then if self.Debug.TemporaryItems then self:DebugMessage("Swap complete") end self.EventLib:DispatchEvent("OUTFITTER_SWAP_COMPLETE") elseif self.Debug.TemporaryItems then self:DebugMessage("Swap not complete") self:DebugTable(self.CurrentOutfit, "CurrentOutfit", 2) self:DebugTable(self.ExpectedOutfit, "ExpectedOutfit", 2) end -- self:Update(true) end function Outfitter:ExecuteCommand(pCommand) local vCommands = { wear = {useOutfit = true, func = self.WearOutfitNow}, unwear = {useOutfit = true, func = self.RemoveOutfitNow}, toggle = {useOutfit = true, func = self.ToggleOutfitNow}, reset = {func = self.AskReset}, deposit = {useOutfit = true, func = self.DepositOutfit}, depositunique = {useOutfit = true, func = self.DepositOutfitUnique}, depositothers = {useOutfit = true, func = self.DepositOtherOutfits}, withdraw = {useOutfit = true, func = self.WithdrawOutfit}, withdrawothers = {useOutfit = true, func = self.WithdrawOtherOutfits}, update = {useOutfit = true, func = self.SetOutfitToCurrent}, updatetitle = {func = function () Outfitter.OutfitStack:UpdateOutfitDisplay() end}, summary = {func = self.OutfitSummary}, rating = {func = self.RatingSummary}, iteminfo = {func = self.ShowLinkInfo}, itemstats = {func = self.ShowLinkStats}, missing = {func = self.ShowMissingItems}, sound = {func = self.SetSoundOption}, help = {func = self.ShowCommandHelp}, disable = {func = self.DisableAutoChanges}, enable = {func = self.EnableAutoChanges}, errors = {func = self.SetErrorsOption}, daxdax = {func = self.SetErrorsOption}, } -- Evaluate options if the command uses them local vCommand if string.find(pCommand, "|h") then -- Commands which use item links don't appear to parse correctly vCommand = pCommand else vCommand = SecureCmdOptionParse(pCommand) end if not vCommand then return end -- local vStartIndex, vEndIndex, vCommand, vParameter = string.find(vCommand, "(%w+) ?(.*)") if not vCommand then self:ShowCommandHelp() return end vCommand = strlower(vCommand) local vCommandInfo = vCommands[vCommand] if not vCommandInfo then self:ShowCommandHelp() self:ErrorMessage("Unknown command %s", vCommand) return end local vOutfit = nil local vCategoryID = nil if vCommandInfo.useOutfit then if vParameter and vParameter:len() > 0 then vOutfit, vCategoryID = self:FindOutfitByName(vParameter) else vOutfit = self:GetCurrentCompleteOutfit() if not vOutfit then self:ErrorMessage("No Complete outfit is equipped") return end vCategoryID = vOutfit.CategoryID end if not vOutfit then self:ErrorMessage("Couldn't find outfit named "..vParameter) return end Outfitter.HasHWEvent = true vCommandInfo.func(self, vOutfit) Outfitter.HasHWEvent = false else vCommandInfo.func(self, vParameter) end end function Outfitter:DisableAutoChanges() self:SetAutoSwitch(false) self:NoteMessage(self.cAutoChangesDisabled) end function Outfitter:EnableAutoChanges() self:SetAutoSwitch(true) self:NoteMessage(self.cAutoChangesEnabled) end function Outfitter:ShowCommandHelp() self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter wear outfitName"..NORMAL_FONT_COLOR_CODE..": Wear an outfit") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter unwear outfitName"..NORMAL_FONT_COLOR_CODE..": Remove an outfit") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter toggle outfitName"..NORMAL_FONT_COLOR_CODE..": Wears or removes an outfit") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter reset"..NORMAL_FONT_COLOR_CODE..": Resets Outfitter, restoring default settings and outfits") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter reset bar"..NORMAL_FONT_COLOR_CODE..": Resets the position of the outfit bar") self:NoteMessage("") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter deposit outfitName"..NORMAL_FONT_COLOR_CODE..": Deposits an outfit to the bank") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter depositunique outfitName"..NORMAL_FONT_COLOR_CODE..": Deposits an outfit to the bank, except for items used by other outfits") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter depositothers outfitName"..NORMAL_FONT_COLOR_CODE..": Deposits all outfits except one to the bank") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter withdraw outfitName"..NORMAL_FONT_COLOR_CODE..": Withdraws an outfit from the bank") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter withdrawothers outfitName"..NORMAL_FONT_COLOR_CODE..": Withdraws all outfits except one from the bank") self:NoteMessage("") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter update [outfitName]"..NORMAL_FONT_COLOR_CODE..": Updates the outfit with currently equipped items, or the current Complete outfit if no outfit is specified") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter updatetitle"..NORMAL_FONT_COLOR_CODE..": Refreshes the current player title based on equipped items") self:NoteMessage("") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter sound [on|off]"..NORMAL_FONT_COLOR_CODE..": Turns equipment sound effects off during Outfitter's gear changes") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter disable"..NORMAL_FONT_COLOR_CODE..": Prevents all scripts from running") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter enable"..NORMAL_FONT_COLOR_CODE..": Allows enabled scripts to run") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter missing"..NORMAL_FONT_COLOR_CODE..": Generates a list of items which are in your outfits but can't be found") self:NoteMessage(HIGHLIGHT_FONT_COLOR_CODE.."/outfitter errors [on|off]"..NORMAL_FONT_COLOR_CODE..": Enables/disables missing item messages during gear changes") end function Outfitter:UnequipItemByName(pItemName) local vInventoryID = tonumber(pItemName) if pItemName ~= tostring(vInventoryID) then local vLowerItemName = pItemName:lower() -- Search the inventory for a matching item name vInventoryID = nil for _, vSlotID in ipairs(self.cSlotIDs) do local vItemCodes, vItemName = self:GetSlotIDLinkInfo(vSlotID) if vItemName and vItemName:lower() == vLowerItemName then vInventoryID = vSlotID end end if not vInventoryID then self:ErrorMessage("Couldn't find an item named "..pItemName) end end local vEmptyBagSlot = self:GetEmptyBagSlot(NUM_BAG_SLOTS, 1) if not vEmptyBagSlot then self:ErrorMessage("Couldn't unequip "..pItemName.." because all bags are full") return end PickupInventoryItem(vInventoryID) PickupContainerItem(vEmptyBagSlot.BagIndex, vEmptyBagSlot.BagSlotIndex) end function Outfitter:AskRebuildOutfit(pOutfit) self.OutfitToRebuild = pOutfit StaticPopup_Show("OUTFITTER_CONFIRM_REBUILD", self.OutfitToRebuild.Name) end function Outfitter:AskSetCurrent(pOutfit) self.OutfitToRebuild = pOutfit StaticPopup_Show("OUTFITTER_CONFIRM_SET_CURRENT", self.OutfitToRebuild.Name) end function Outfitter:RebuildOutfit(pOutfit) if not pOutfit then return end local vStatConfig = pOutfit.StatConfig if not vStatConfig and pOutfit.StatID then vStatConfig = {{StatID = pOutfit.StatID}} end local vOutfit = self:GenerateSmartOutfit( pOutfit.Name, vStatConfig, self:GetInventoryCache(), false, function (pNewOutfit) local vNewItems = pNewOutfit:GetItems() if pOutfit:IsComplete() then local vOldItems = pOutfit:GetItems() for vItemSlot, vOldItem in pairs(vOldItems) do if not vNewItems[vItemSlot] then vNewItems[vItemSlot] = vOldItem end end end pOutfit:SetItems(vNewItems) self:OutfitSettingsChanged(pOutfit) self:WearOutfit(pOutfit) self:Update(true) end) if vOutfit then local vNewItems = vOutfit:GetItems() if pOutfit:IsComplete() then local vOldItems = pOutfit:GetItems() for vItemSlot, vOldItem in pairs(vOldItems) do if not vNewItems[vItemSlot] then vNewItems[vItemSlot] = vOldItem end end end pOutfit:SetItems(vNewItems) self:OutfitSettingsChanged(pOutfit) self:WearOutfit(pOutfit) self:Update(true) end end function Outfitter:SetOutfitToCurrent(pOutfit) if not pOutfit then return end pOutfit:SetToCurrentInventory() self:OutfitSettingsChanged(pOutfit) self:WearOutfit(pOutfit) self:Update(true) self:NoteMessage("Updated the outfit '"..pOutfit:GetName().."' to currently equipped items") end function Outfitter:AskDeleteOutfit(pOutfit) gOutfitter_OutfitToDelete = pOutfit StaticPopup_Show("OUTFITTER_CONFIRM_DELETE", gOutfitter_OutfitToDelete.Name) end function Outfitter:DeleteSelectedOutfit() if not gOutfitter_OutfitToDelete then return end self:DeleteOutfit(gOutfitter_OutfitToDelete) self:Update(true) end function Outfitter:TalentsChanged() --self.CanDualWield2H = self.PlayerClass == "WARRIOR" and GetSpecialization() == 2 end function Outfitter:SetScript(pOutfit, pScript) self:DeactivateScript(pOutfit) if pScript == "" then pScript = nil end pOutfit.Script = pScript pOutfit.ScriptID = nil self:OutfitSettingsChanged(self.SelectedOutfit) self:ActivateScript(pOutfit) end function Outfitter:SetScriptID(pOutfit, pScriptID) self:DeactivateScript(pOutfit) if pScriptID == "" then pScriptID = nil end pOutfit.Script = nil pOutfit.ScriptID = pScriptID self:OutfitSettingsChanged(self.SelectedOutfit) self:ActivateScript(pOutfit) end function Outfitter:GetScript(pOutfit) if pOutfit.ScriptID then local vPresetScript = self:GetPresetScriptByID(pOutfit.ScriptID) if vPresetScript then local vScript = vPresetScript.Script:gsub("([\r\t])", {["\r"] = "", ["\t"] = " "}) return vScript, pOutfit.ScriptID end else return pOutfit.Script end end function Outfitter:ShowPanel(pPanelIndex) self:CancelDialogs() -- Force any dialogs to close if they're open if self.CurrentPanel > 0 and self.CurrentPanel ~= pPanelIndex then self:HidePanel(self.CurrentPanel) end -- NOTE: Don't check for redundant calls since this function -- will be called to reset the field values as well as to -- actually show the panel when it's hidden self.CurrentPanel = pPanelIndex local vPanelFrame = _G[self.cPanelFrames[pPanelIndex]] vPanelFrame:Show() PanelTemplates_SetTab(OutfitterFrame, pPanelIndex) -- Update the control values if pPanelIndex == 1 then -- Main panel elseif pPanelIndex == 2 then -- Options panel elseif pPanelIndex == 3 then -- About panel if not self.AboutView then self.AboutView = self:New(self._AboutView) end else self:ErrorMessage("Unknown index (%d) in ShowPanel()", pPanelIndex) end self:Update(false) end function Outfitter:HidePanel(pPanelIndex) if self.CurrentPanel ~= pPanelIndex then return end _G[self.cPanelFrames[pPanelIndex]]:Hide() self.CurrentPanel = 0 end function Outfitter:CancelDialogs() end function Outfitter:AddOutfitMenu(menu, outfit) -- This shouldn't happen if not outfit then self:ErrorMessage("Outfit is nil for menu") return end menu:AddCategoryTitle(outfit:GetName()) -- General menu:AddFunction(PET_RENAME, function (menu) self:PerformAction("RENAME", outfit) end) menu:AddSelect(self.cKeyBinding, { self.cNone, _G["BINDING_NAME_OUTFITTER_OUTFIT1"], _G["BINDING_NAME_OUTFITTER_OUTFIT2"], _G["BINDING_NAME_OUTFITTER_OUTFIT3"], _G["BINDING_NAME_OUTFITTER_OUTFIT4"], _G["BINDING_NAME_OUTFITTER_OUTFIT5"], _G["BINDING_NAME_OUTFITTER_OUTFIT6"], _G["BINDING_NAME_OUTFITTER_OUTFIT7"], _G["BINDING_NAME_OUTFITTER_OUTFIT8"], _G["BINDING_NAME_OUTFITTER_OUTFIT9"], _G["BINDING_NAME_OUTFITTER_OUTFIT10"] }, function () if outfit.BindingIndex then return outfit.BindingIndex + 1 else return 1 end end, function (menu, value) if value == 1 then self:SetOutfitBindingIndex(outfit, nil) else self:SetOutfitBindingIndex(outfit, value - 1) end end) -- Get the titles --[[ local titles = self:GetSortedTitles() -- Build the menu local maxTitlesPerMenu = 30 menu:AddChildMenu(self.cPlayerTitle, function (submenu) local startIndex = 1 -- Add the None item submenu:AddToggle(self.cNone, function () return outfit.ShowTitleID == nil end, function (menu, value) outfit.ShowTitleID = nil Outfitter.HasHWEvent = true self.OutfitStack:UpdateOutfitDisplay() Outfitter.HasHWEvent = false end) -- Add a select menu for groups of titles while startIndex <= #titles do local endIndex = startIndex + maxTitlesPerMenu - 1 if endIndex > #titles then endIndex = #titles end self:AddTitleSelectMenu(submenu, tostring(startIndex).." - "..tostring(endIndex), outfit, titles, startIndex, maxTitlesPerMenu) startIndex = endIndex + 1 end end)]] menu:AddChildMenu(self.cBankCategoryTitle, function (submenu) submenu:AddFunction(self.cDepositToBank, function () self:PerformAction("DEPOSIT", outfit) end, not self.BankFrameIsOpen) submenu:AddFunction(self.cDepositUniqueToBank, function () self:PerformAction("DEPOSITUNIQUE", outfit) end, not self.BankFrameIsOpen) submenu:AddFunction(self.cWithdrawFromBank, function () self:PerformAction("WITHDRAW", outfit) end, not self.BankFrameIsOpen) submenu:AddDivider() submenu:AddFunction(self.cDepositOthersToBank, function () self:PerformAction("DEPOSITOTHERS", outfit) end, not self.BankFrameIsOpen) submenu:AddFunction(self.cWithdrawOthersFromBank, function () self:PerformAction("WITHDRAWOTHERS", outfit) end, not self.BankFrameIsOpen) end) if outfit.CategoryID ~= "Complete" then menu:AddToggle(self.cUnequipOthers, function () return outfit.UnequipOthers end, function (menu, value) outfit.UnequipOthers = value or nil self:OutfitSettingsChanged(outfit) end) end menu:AddToggle(self.cIgnoreComparisons, function () return outfit.IgnoreComparisons end, function (menu, value) outfit.IgnoreComparisons = value or nil end) menu:AddFunction(DELETE, function () self:PerformAction("DELETE", outfit) end) -- Rebuild menu:AddCategoryTitle(self.cRebuild) menu:AddFunction(self.cSetCurrentItems, function () self:PerformAction("SET_CURRENT", outfit) end) local statName if outfit.StatConfig then statName = self:GetStatConfigName(outfit.StatConfig) elseif outfit.StatID then statName = self:GetStatIDName(outfit.StatID) end if statName then menu:AddFunction(format(self.cRebuildOutfitFormat, statName), function () self:PerformAction("REBUILD", outfit) end) end menu:AddFunction(self.cRebuildFor, function () self:PerformAction("REBUILD_FOR", outfit) end) -- Automation menu:AddCategoryTitle(self.cAutomation) local presetScript = self:GetPresetScriptByID(outfit.ScriptID) local scriptName if presetScript then scriptName = presetScript.Name elseif outfit.Script then scriptName = self.cCustomScript else scriptName = nil end menu:AddChildMenu(string.format(self.cScriptFormat, scriptName or self.cNoScript), function (submenu) local hasAnyScript = self:GetScript(outfit) ~= nil submenu:AddToggle(self.cNoScript, function () return (outfit.ScriptID == nil) and not hasAnyScript end, function (menu, value) self:PerformAction("PRESET_NONE", outfit) end) submenu:AddFunction(self.cEditScriptEllide, function () self:PerformAction("EDIT_SCRIPT", outfit) end, (outfit.ScriptID == nil) and hasAnyScript) local previousCategory, foundSelectedScript for _, presetScript in ipairs(self.PresetScripts) do if not presetScript.Class or presetScript.Class == self.PlayerClass then -- Get the category for this script local category = presetScript.Category or presetScript.Class or "GENERAL" -- Add the category once it changes if previousCategory ~= category then self:AddScriptCategorySubmenu(submenu, category, function () return outfit.ScriptID end, function (menu, value) self:PerformAction("PRESET_"..value, outfit) end) previousCategory = category foundSelectedScript = false end if outfit.ScriptID == presetScript.ID then foundSelectedScript = true end end -- if end -- for end) menu:AddFunction(self.cScriptSettings, function () self:PerformAction("SCRIPT_SETTINGS", outfit) end, scriptName == nil) menu:AddToggle(self.cDisableScript, function () return outfit.Disabled end, function (menu, value) self:SetScriptEnabled(outfit, not value) end, scriptName == nil) menu:AddToggle(self.cDisableOutfitInCombat, function () return outfit.CombatDisabled end, function (menu, value) self:PerformAction("COMBATDISABLE", outfit) end, scriptName == nil) -- Outfit bar if self.OutfitBar then menu:AddCategoryTitle(self.cOutfitBar) menu:AddToggle(self.cShowInOutfitBar, function () return self.OutfitBar:IsOutfitShown(outfit) end, function (menu, value) self:PerformAction("OUTFITBAR_SHOW", outfit) end) menu:AddFunction(self.cChangeIcon.."...", function () self:PerformAction("OUTFITBAR_CHOOSEICON", outfit) end) end end function Outfitter:GetSortedTitles() local titles = {} -- Gather the list of known titles local numTitles = GetNumTitles() for titleIndex = 1, numTitles do if IsTitleKnown(titleIndex) then local titleName = GetTitleName(titleIndex) table.insert(titles, {name = titleName, index = titleIndex}) end end -- Sort the list table.sort(titles, function (a, b) return a.name < b.name end) return titles end function Outfitter:AddTitleSelectMenu(menu, menuTitle, outfit, titles, startIndex, maxTitles) -- Calculate the endIndex local endIndex = startIndex + maxTitles - 1 if endIndex > #titles then endIndex = #titles end -- Build the list of values local values = {} for titleIndex = startIndex, endIndex do table.insert(values, titles[titleIndex].name) end menu:AddSelect(menuTitle, values, function () local selectedTitleIndex = outfit.ShowTitleID if not selectedTitleIndex then selectedTitleIndex = -1 end for titleIndex = startIndex, endIndex do if titles[titleIndex].index == selectedTitleIndex then return titleIndex - startIndex + 1 end end end, function (menu, value) local title = titles[value + startIndex - 1] -- No title for the first index if title.index == -1 then outfit.ShowTitleID = nil -- Find the titleID for the index else outfit.ShowTitleID = title.index end Outfitter.HasHWEvent = true self.OutfitStack:UpdateOutfitDisplay() Outfitter.HasHWEvent = false end) end function Outfitter:AddScriptCategorySubmenu(menu, category, get, set) local title = self.cScriptCategoryName[category] if not title then local isFemale = UnitSex("player") == 3 if isFemale then title = LOCALIZED_CLASS_NAMES_FEMALE[category] else title = LOCALIZED_CLASS_NAMES_MALE[category] end end assert(title, "no name found for category "..tostring(category)) menu:AddChildMenu(title, function (submenu) for _, presetScript in ipairs(self.PresetScripts) do local scriptCategory = presetScript.Category or presetScript.Class or "GENERAL" -- Add the item if it's the right category if (not presetScript.Class or presetScript.Class == self.PlayerClass) and scriptCategory == category then -- Ellide the name if there are inputs local name = presetScript.Name local scriptFields = self:ParseScriptFields(presetScript.Script) if scriptFields.Inputs ~= nil and #scriptFields.Inputs ~= 0 then name = name.."..." end -- Add the item submenu:AddToggle(name, function () return get() == presetScript.ID end, function (menu, value) set(menu, presetScript.ID) end, nil, { desc = Outfitter:GetScriptDescription(presetScript.Script) }) end -- if end -- for end) end function Outfitter.ItemDropDownMenuFunc(dropdown, menu) local listItem = dropdown:GetParent():GetParent() local outfit = listItem:GetOutfit() Outfitter:AddOutfitMenu(menu, outfit) end function Outfitter.ItemDropDown_Initialize(pFrame) local vItem = pFrame:GetParent():GetParent() local vOutfit = vItem:GetOutfit() Outfitter:InitializeOutfitMenu(pFrame, vOutfit) pFrame:SetHeight(pFrame.SavedHeight) end function Outfitter:SetAutoSwitch(pAutoSwitch) local vDisableAutoSwitch = not pAutoSwitch if self.Settings.Options.DisableAutoSwitch == vDisableAutoSwitch then return end self.Settings.Options.DisableAutoSwitch = vDisableAutoSwitch if pAutoSwitch then self:ActivateAllScripts() else self:DeactivateAllScripts() end self.DisplayIsDirty = true self:Update(false) end function Outfitter:SetShowTooltipInfo(pShowInfo) self.Settings.Options.DisableToolTipInfo = not pShowInfo self:Update(false) end function Outfitter:SetShowItemComparisons(pShowComparisons) self.Settings.Options.DisableItemComparisons = not pShowComparisons if pShowComparisons and not self.ExtendedCompareTooltip then self.ExtendedCompareTooltip = self:New(self._ExtendedCompareTooltip) end end function Outfitter:SetShowMinimapButton(pShowButton) self.Settings.Options.HideMinimapButton = not pShowButton if self.Settings.Options.HideMinimapButton then OutfitterMinimapButton:Hide() else OutfitterMinimapButton:Show() end self:Update(false) end function Outfitter:SetShowHotkeyMessages(pShowHotkeyMessages) self.Settings.Options.DisableHotkeyMessages = not pShowHotkeyMessages self:Update(false) end function Outfitter:OutfitIsVisible(pOutfit) return not pOutfit.Disabled and not pOutfit:IsEmpty() and (not pOutfit.OutfitBar or not pOutfit.OutfitBar.Hide) end function Outfitter:HasVisibleOutfits(pOutfits) if not pOutfits then return false end for vIndex, vOutfit in pairs(pOutfits) do if self:OutfitIsVisible(vOutfit) then return true end end return false end function Outfitter:GetCategoryOrder() return self.cCategoryOrder end function Outfitter:GetOutfitsByCategoryID(pCategoryID) return self.Settings.Outfits[pCategoryID] end function Outfitter.MinimapDropDown_InitializeOutfitList(pFrame) -- Just return if not initialized yet if not Outfitter.Initialized then return end -- local vInventoryCache = Outfitter:GetInventoryCache() local vCategoryOrder = Outfitter:GetCategoryOrder() for vCategoryIndex, vCategoryID in ipairs(vCategoryOrder) do local vCategoryName = Outfitter["c"..vCategoryID.."Outfits"] local vOutfits = Outfitter:GetOutfitsByCategoryID(vCategoryID) if Outfitter:HasVisibleOutfits(vOutfits) then Outfitter:AddCategoryMenuItem(vCategoryName) for vIndex, vOutfit in ipairs(vOutfits) do if Outfitter:OutfitIsVisible(vOutfit) then local vWearingOutfit = Outfitter:WearingOutfit(vOutfit) local vMissingItems, vBankedItems = vInventoryCache:GetMissingItems(vOutfit) local vItemColor = NORMAL_FONT_COLOR_CODE if vMissingItems then vItemColor = RED_FONT_COLOR_CODE elseif vBankedItems then vItemColor = Outfitter.BANKED_FONT_COLOR_CODE end Outfitter:AddMenuItem( pFrame, vOutfit:GetName(), {CategoryID = vCategoryID, Index = vIndex}, vWearingOutfit, -- Checked nil, -- Level vItemColor, -- Color nil, -- Disabled {icon = Outfitter.OutfitBar:GetOutfitTexture(vOutfit)}) end end end end end function Outfitter.DropDown_OnClick(pItem, pOwner, pValue) if not pOwner then Outfitter:DebugTable(pItem, "OnClick Item") return end if pOwner.AutoSetValue then pOwner:SetSelectedValue(pValue) end if pOwner.ChangedValueFunc then pOwner.ChangedValueFunc(pOwner, pValue) end CloseDropDownMenus() end function Outfitter:GenerateItemListString(pLabel, pListColorCode, pItems) local vItemList = nil for vIndex, vOutfitItem in ipairs(pItems) do if not vItemList then vItemList = HIGHLIGHT_FONT_COLOR_CODE..pLabel..pListColorCode..tostring(vOutfitItem.Name) else vItemList = vItemList..self.cMissingItemsSeparator..tostring(vOutfitItem.Name) end end return vItemList end function Outfitter.AddNewbieTip(pItem, pNormalText, pRed, pGreen, pBlue, pNewbieText, pNoNormalText) if GetCVarBool("UberTooltips") then GameTooltip_SetDefaultAnchor(GameTooltip, pItem) if pNormalText then GameTooltip:SetText(pNormalText, pRed, pGreen, pBlue) GameTooltip:AddLine(pNewbieText, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1) else GameTooltip:SetText(pNewbieText, pRed, pGreen, pBlue, 1, 1) end GameTooltip:Show() else if not pNoNormalText then GameTooltip:SetOwner(pItem, "ANCHOR_RIGHT") GameTooltip:SetText(pNormalText, pRed, pGreen, pBlue) end end end function Outfitter:ShowOutfitTooltip(pOutfit, pOwner, pMissingItems, pBankedItems, pShowEmptyTooltips, pTooltipAnchor) -- local vInventoryCache = self:GetInventoryCache() -- local vMissingItems, vBankedItems = vInventoryCache:GetMissingItems(pOutfit) local vDescription = self:GetOutfitDescription(pOutfit) if pMissingItems or pBankedItems or pShowEmptyTooltips then GameTooltip:SetOwner(pOwner, pTooltipAnchor or "ANCHOR_LEFT") GameTooltip:AddLine(pOutfit:GetName()) if vDescription then GameTooltip:AddLine(vDescription, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b, true) end if pMissingItems then local vItemList = self:GenerateItemListString(self.cMissingItemsLabel, RED_FONT_COLOR_CODE, pMissingItems) GameTooltip:AddLine(vItemList, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, true) end if pBankedItems then local vItemList = self:GenerateItemListString(self.cBankedItemsLabel, self.BANKED_FONT_COLOR_CODE, pBankedItems) GameTooltip:AddLine(vItemList, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, true) end GameTooltip:Show() elseif vDescription then self.AddNewbieTip(pOwner, pOutfit:GetName(), 1.0, 1.0, 1.0, vDescription, 1) end ResetCursor() end function Outfitter:GetOutfitDescription(pOutfit) return self:GetScriptDescription(self:GetScript(pOutfit)) end function Outfitter:OutfitHasSettings(pOutfit) return self:ScriptHasSettings(self:GetScript(pOutfit)) end function Outfitter:ToggleOutfitMenuAtCursor(outfit) if self.outfitMenu then self:HideOutfitMenu() else self:ShowOutfitMenuAtCursor(outfit) end end function Outfitter:ShowOutfitMenuAtCursor(outfit) if self.outfitMenu then return end -- Create the items local items = Outfitter:New(Outfitter.UIElementsLib._DropDownMenuItems, function () -- Close the menu after a short delay when a menu item is selected Outfitter.SchedulerLib:ScheduleTask(0.1, function () self:HideOutfitMenu() end) end) -- Get the items Outfitter:AddOutfitMenu(items, outfit) -- Get the cursor position local cursorX, cursorY = GetCursorPosition() local scaling = UIParent:GetEffectiveScale() cursorX = cursorX / scaling cursorY = cursorY / scaling -- Use the screen quadrant as an anchor for the menu local quadrant = Outfitter:GetScreenQuadrantFromCoordinates(cursorX, cursorY) -- Show the menu self.outfitMenu = Outfitter:New(Outfitter.UIElementsLib._DropDownMenu) self.outfitMenu:Show(items, quadrant, UIParent, "BOTTOMLEFT", cursorX, cursorY) self.outfitMenu.cleanup = function () self.outfitMenu = nil end end function Outfitter:HideOutfitMenu() if not self.outfitMenu then return end self.outfitMenu:Hide() end function Outfitter:Item_CheckboxClicked(pItem) if pItem.isCategory then return end local vOutfits = Outfitter.Settings.Outfits[pItem.categoryID] if not vOutfits then -- Error: outfit category not found return end local vOutfit = vOutfits[pItem.outfitIndex] if not vOutfit then -- Error: outfit not found return end local vCheckbox = _G[pItem:GetName().."OutfitSelected"] if vCheckbox:GetChecked() then vOutfit.Disabled = nil Outfitter:WearOutfit(vOutfit) else Outfitter:RemoveOutfit(vOutfit) end self.DisplayIsDirty = true self:Update(true) end function Outfitter:Item_StoreOnServerClicked(pItem) if pItem.isCategory then return end local vOutfits = self.Settings.Outfits[pItem.categoryID] if not vOutfits then -- Error: outfit category not found return end local vOutfit = vOutfits[pItem.outfitIndex] if not vOutfit then -- Error: outfit not found return end local vCheckbox = _G[pItem:GetName().."OutfitServerButton"] if vCheckbox:GetChecked() then if vOutfit ~= self.SelectedOutfit then self:WearOutfit(vOutfit) self:SelectOutfit(vOutfit) else vOutfit:StoreOnServer() end else vOutfit:StoreLocally() end self.DisplayIsDirty = true self:Update(true) end function Outfitter:AddOutfitsToList(pOutfits, pCategoryID, pItemIndex, pFirstItemIndex, pInventoryCache) local vOutfits = pOutfits[pCategoryID] local vItemIndex = pItemIndex local vFirstItemIndex = pFirstItemIndex local vItem = _G["OutfitterItem"..pItemIndex] if vFirstItemIndex == 0 then vItem:SetToCategory(pCategoryID, false) vItemIndex = vItemIndex + 1 else vFirstItemIndex = vFirstItemIndex - 1 end if vItemIndex >= self.cMaxDisplayedItems then return vItemIndex, vFirstItemIndex end if not self.Collapsed[pCategoryID] and vOutfits then for vIndex, vOutfit in ipairs(vOutfits) do if vFirstItemIndex == 0 then local vItem2 = _G["OutfitterItem"..vItemIndex] vItem2:SetToOutfit(vOutfit, pCategoryID, vIndex, pInventoryCache) vItemIndex = vItemIndex + 1 if vItemIndex >= self.cMaxDisplayedItems then return vItemIndex, vFirstItemIndex end else vFirstItemIndex = vFirstItemIndex - 1 end end end return vItemIndex, vFirstItemIndex end function Outfitter:AddOutfitItemsToList(pOutfitItems, pCategoryID, pItemIndex, pFirstItemIndex) local vItemIndex = pItemIndex local vFirstItemIndex = pFirstItemIndex local vItem = _G["OutfitterItem"..pItemIndex] if vFirstItemIndex == 0 then vItem:SetToCategory(pCategoryID, false) vItemIndex = vItemIndex + 1 else vFirstItemIndex = vFirstItemIndex - 1 end if vItemIndex >= self.cMaxDisplayedItems then return vItemIndex, vFirstItemIndex end if not self.Collapsed[pCategoryID] then for vIndex, vOutfitItem in ipairs(pOutfitItems) do if vFirstItemIndex == 0 then local vItem2 = _G["OutfitterItem"..vItemIndex] vItem2:SetToItem(vOutfitItem) vItemIndex = vItemIndex + 1 if vItemIndex >= self.cMaxDisplayedItems then return vItemIndex, vFirstItemIndex end else vFirstItemIndex = vFirstItemIndex - 1 end end end return vItemIndex, vFirstItemIndex end function Outfitter:SortOutfits() for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do table.sort(vOutfits, Outfitter.CompareOutfitNames) end end function Outfitter.CompareOutfitNames(pOutfit1, pOutfit2) if pOutfit1.Name ~= pOutfit2.Name then if not pOutfit1.Name then return false end if not pOutfit2.Name then return true end return pOutfit1.Name < pOutfit2.Name end return pOutfit1.StoredInEM and not pOutfit2.StoredInEM end function Outfitter:Update(pOutfitsChanged) -- Flush the caches if pOutfitsChanged then wipe(self.OutfitInfoCache) end -- Just leave if we're not visible (when does this happen?) if not OutfitterFrame:IsVisible() then return end -- if self.CurrentPanel == 1 then -- Main panel if not self.DisplayIsDirty then return end self.DisplayIsDirty = false -- Sort the outfits self:SortOutfits() -- Get the equippable items so outfits can be marked if they're missing anything local vInventoryCache = self:GetInventoryCache() -- Update the slot enables if they're shown if pOutfitsChanged and OutfitterSlotEnables:IsVisible() then self:UpdateSlotEnables(self.SelectedOutfit, vInventoryCache) end vInventoryCache:CompiledUnusedItemsList() -- Update the list OutfitterMainFrameHighlight:Hide() local vFirstItemIndex = FauxScrollFrame_GetOffset(OutfitterMainFrameScrollFrame) local vItemIndex = 0 vInventoryCache:ResetIgnoreItemFlags() for vCategoryIndex, vCategoryID in ipairs(self.cCategoryOrder) do vItemIndex, vFirstItemIndex = self:AddOutfitsToList(self.Settings.Outfits, vCategoryID, vItemIndex, vFirstItemIndex, vInventoryCache) if vItemIndex >= self.cMaxDisplayedItems then break end end if vItemIndex < self.cMaxDisplayedItems and vInventoryCache.UnusedItems then vItemIndex, vFirstItemIndex = self:AddOutfitItemsToList(vInventoryCache.UnusedItems, "OddsNEnds", vItemIndex, vFirstItemIndex) end -- Add the BoEs local vBoEItems = vInventoryCache:GetBoEItems() if vItemIndex < self.cMaxDisplayedItems and vBoEItems and #vBoEItems > 0 then vItemIndex, vFirstItemIndex = self:AddOutfitItemsToList(vBoEItems, "BoEs", vItemIndex, vFirstItemIndex) end -- Hide any unused items for vItemIndex2 = vItemIndex, (self.cMaxDisplayedItems - 1) do local vItemName = "OutfitterItem"..vItemIndex2 local vItem = _G[vItemName] vItem:Hide() end -- Count the total items local vTotalNumItems = 0 -- Add in the main categories for vCategoryIndex, vCategoryID in ipairs(self.cCategoryOrder) do vTotalNumItems = vTotalNumItems + 1 local vOutfits = self.Settings.Outfits[vCategoryID] if not self.Collapsed[vCategoryID] and vOutfits then vTotalNumItems = vTotalNumItems + #vOutfits end end -- Add in the Odd 'n Ends category if vInventoryCache.UnusedItems then vTotalNumItems = vTotalNumItems + 1 if not self.Collapsed["OddsNEnds"] then vTotalNumItems = vTotalNumItems + #vInventoryCache.UnusedItems end end -- Add in the BoEs category if vBoEItems and #vBoEItems then vTotalNumItems = vTotalNumItems + 1 if not self.Collapsed["BoEs"] then vTotalNumItems = vTotalNumItems + #vBoEItems end end FauxScrollFrame_Update( OutfitterMainFrameScrollFrame, vTotalNumItems, -- numItems self.cMaxDisplayedItems, -- numToDisplay 18, -- valueStep nil, nil, nil, -- button, smallWidth, bigWidth nil, -- highlightFrame 0, 0) -- smallHighlightWidth, bigHighlightWidth elseif self.CurrentPanel == 2 then -- Options panel OutfitterAutoSwitch:SetChecked(self.Settings.Options.DisableAutoSwitch) OutfitterShowMinimapButton:SetChecked(not self.Settings.Options.HideMinimapButton) OutfitterTooltipInfo:SetChecked(not self.Settings.Options.DisableToolTipInfo) OutfitterShowHotkeyMessages:SetChecked(not self.Settings.Options.DisableHotkeyMessages) OutfitterShowOutfitBar:SetChecked(self.Settings.OutfitBar.ShowOutfitBar) OutfitterItemComparisons:SetChecked(not self.Settings.Options.DisableItemComparisons) end end function Outfitter.OnVerticalScroll(pScrollFrame) Outfitter.DisplayIsDirty = true Outfitter:Update(false) end function Outfitter:SelectOutfit(pOutfit) if not self:IsOpen() then return end self.SelectedOutfit = pOutfit -- Get the equippable items so outfits can be marked if they're missing anything local vInventoryCache = self:GetInventoryCache() -- Update the slot enables self:UpdateSlotEnables(pOutfit, vInventoryCache) OutfitterSlotEnables:Show() -- Done, rebuild the list self.DisplayIsDirty = true end function Outfitter:UpdateSlotEnables(pOutfit, pInventoryCache) for _, vInventorySlot in ipairs(self.cSlotNames) do local vCheckbox = _G["OutfitterEnable"..vInventorySlot] if not pOutfit:SlotIsEnabled(vInventorySlot) then vCheckbox:SetChecked(false) else if pOutfit:SlotIsEquipped(vInventorySlot, pInventoryCache) then vCheckbox:SetCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check") vCheckbox.IsUnknown = false else vCheckbox:SetCheckedTexture("Interface\\Addons\\Outfitter\\Textures\\CheckboxUnknown") vCheckbox.IsUnknown = true end vCheckbox:SetChecked(true) end end end function Outfitter:ClearSelection() self.SelectedOutfit = nil self.DisplayIsDirty = true OutfitterSlotEnables:Hide() end function Outfitter:FindOutfitItemIndex(pOutfit) local vOutfitCategoryID, vOutfitIndex = self:FindOutfit(pOutfit) if not vOutfitCategoryID then return nil end local vItemIndex = 0 for vCategoryIndex, vCategoryID in ipairs(self.cCategoryOrder) do vItemIndex = vItemIndex + 1 if not self.Collapsed[vCategoryID] then if vOutfitCategoryID == vCategoryID then return vItemIndex + vOutfitIndex - 1 else vItemIndex = vItemIndex + #self.Settings.Outfits[vCategoryID] end end end return nil end function Outfitter:WearOutfitByName(pOutfitName, pLayerID) vOutfit = self:FindOutfitByName(pOutfitName) if not vOutfit then self:ErrorMessage("Couldn't find outfit named %s", pOutfitName) return end self:WearOutfit(vOutfit, pLayerID) end function Outfitter:RemoveOutfitByName(pOutfitName, pLayerID) vOutfit = self:FindOutfitByName(pOutfitName) if not vOutfit then self:ErrorMessage("Couldn't find outfit named %s", pOutfitName) return end self:RemoveOutfit(vOutfit) end function Outfitter:WearOutfitNow(pOutfit, pLayerID, pCallerIsScript) self:BeginEquipmentUpdate() self:WearOutfit(pOutfit, pLayerID, pCallerIsScript) self:EndEquipmentUpdate(nil, true) end function Outfitter:WearOutfit(pOutfit, pLayerID, pCallerIsScript) self:BeginEquipmentUpdate() -- Update the equipment pOutfit.didEquip = pCallerIsScript pOutfit.didUnequip = false self.EquippedNeedsUpdate = true -- Add the outfit to the stack if pOutfit.CategoryID == "Complete" then self.OutfitStack:Clear() elseif pOutfit.UnequipOthers then self.OutfitStack:ClearCategory("Accessory") end self.OutfitStack:AddOutfit(pOutfit, pLayerID) -- If it's a Complete outfit, push it onto the list of recent complete outfits if pOutfit.CategoryID == "Complete" and pOutfit:GetName() then local vOutfitName = pOutfit:GetName() for vRecentIndex, vRecentName in ipairs(self.Settings.RecentCompleteOutfits) do if vRecentName == vOutfitName then table.remove(self.Settings.RecentCompleteOutfits, vRecentIndex) break end end table.insert(self.Settings.RecentCompleteOutfits, vOutfitName) end -- If Outfitter is open then also select the outfit. This is important -- because the UI can't function correctly if the selected outfit and -- top outfit don't stay the same. if self:IsOpen() then if self.OutfitStack:IsTopmostOutfit(pOutfit) then self:SelectOutfit(pOutfit) else self:ClearSelection() end end self:EndEquipmentUpdate("Outfitter:WearOutfit") end function Outfitter:RemoveOutfitNow(pOutfit, pCallerIsScript) self:BeginEquipmentUpdate() self:RemoveOutfit(pOutfit, pCallerIsScript) self:EndEquipmentUpdate(nil, true) end function Outfitter:RemoveOutfit(pOutfit, pCallerIsScript) -- HACK: Disabling the unequipping of Complete outfits to see it works better -- for more end-user situations -- UPDATE: It doesn't :( Stealth, riding and other gear as Complete outfits -- fail to unequip --if pOutfit.CategoryID == "Complete" then -- return --end -- Remove it from the stack if not self.OutfitStack:RemoveOutfit(pOutfit) then return end -- If it's a Complete outfit, move it to the bottom of the list of recent complete outfits if pOutfit.CategoryID == "Complete" and pOutfit:GetName() then for vRecentIndex, vRecentName in ipairs(self.Settings.RecentCompleteOutfits) do if vRecentName == pOutfit:GetName() then table.remove(self.Settings.RecentCompleteOutfits, vRecentIndex) break end end table.insert(self.Settings.RecentCompleteOutfits, 1, pOutfit:GetName()) end -- self:BeginEquipmentUpdate() -- Clear the selection if the outfit being removed -- is selected too if self.SelectedOutfit == pOutfit then self:ClearSelection() end -- Update the list pOutfit.didEquip = false pOutfit.didUnequip = pCallerIsScript self.EquippedNeedsUpdate = true self:EndEquipmentUpdate("Outfitter:RemoveOutfit") self:DispatchOutfitEvent("UNWEAR_OUTFIT", pOutfit:GetName(), pOutfit) -- If they're removing a complete outfit, find something else to wear instead if pOutfit.CategoryID == "Complete" and #self.Settings.RecentCompleteOutfits then local vOutfit while not vOutfit do local vOutfitName = self.Settings.RecentCompleteOutfits[#self.Settings.RecentCompleteOutfits] vOutfit = self:FindOutfitByName(vOutfitName) if vOutfit and vOutfit.CategoryID == "Complete" then self:WearOutfit(vOutfit) break end table.remove(self.Settings.RecentCompleteOutfits) if #self.Settings.RecentCompleteOutfits then break end end end end function Outfitter:ToggleOutfitNow(pOutfit) if self:WearingOutfit(pOutfit) then self:RemoveOutfitNow(pOutfit) return false else self:WearOutfitNow(pOutfit) return true end end function Outfitter:ToggleOutfit(pOutfit) if self:WearingOutfit(pOutfit) then self:RemoveOutfit(pOutfit) return false else self:WearOutfit(pOutfit) return true end end function Outfitter:SetSoundOption(pParam) if pParam == "on" then self.Settings.EnableEquipSounds = true self:NoteMessage("Outfitter will no longer affect sounds during equipment changes") elseif pParam == "off" then self.Settings.EnableEquipSounds = nil self:NoteMessage("Outfitter will now disable sound effects during equipment changes") else self:NoteMessage("Valid sound options are 'on' and 'off'") end end function Outfitter:SetErrorsOption(pParam) if pParam == "on" then self.Settings.DisableEquipErrors = nil self:NoteMessage("Outfitter will report errors during equipment changes") elseif pParam == "off" then self.Settings.DisableEquipErrors = true self:NoteMessage("Outfitter will not report errors during equipment changes") else self:NoteMessage("Valid error options are 'on' and 'off'") end end function Outfitter:ShowLinkStats(pLink) local vStats = self:GetItemLinkStats(pLink) if not vStats then self:NoteMessage("Couldn't get item stats from the link provided") return end for vStatName, vStatValue in pairs(vStats) do self:NoteMessage("%s: %s", vStatName, vStatValue or "nil") end end function Outfitter:ShowLinkInfo(pLink) local vItemInfo = self:GetItemInfoFromLink(pLink) if not vItemInfo then self:NoteMessage("Couldn't get item info from the link provided") return end self:NoteMessage("Name: "..vItemInfo.Name) self:NoteMessage("Quality: "..vItemInfo.Quality) self:NoteMessage("Code: "..vItemInfo.Code) self:NoteMessage("SubCode: "..vItemInfo.SubCode) self:NoteMessage("Type: "..vItemInfo.Type) self:NoteMessage("SubType: "..vItemInfo.SubType) self:NoteMessage("InvType: "..vItemInfo.InvType) self:NoteMessage("Level: "..vItemInfo.Level) if vItemInfo.EnchantCode then self:NoteMessage("EnchantCode: "..vItemInfo.EnchantCode) end if vItemInfo.JewelCode1 then self:NoteMessage("JewelCode1: "..vItemInfo.JewelCode1) end if vItemInfo.JewelCode2 then self:NoteMessage("JewelCode2: "..vItemInfo.JewelCode2) end if vItemInfo.JewelCode3 then self:NoteMessage("JewelCode3: "..vItemInfo.JewelCode3) end if vItemInfo.JewelCode4 then self:NoteMessage("JewelCode4: "..vItemInfo.JewelCode4) end if vItemInfo.UniqueID then self:NoteMessage("UniqueID: "..vItemInfo.UniqueID) end if vItemInfo.ReforgeID then self:NoteMessage("ReforgeID: "..vItemInfo.ReforgeID) end if vItemInfo.InstanceDifficultyID then self:NoteMessage("InstanceDifficultyID: "..vItemInfo.InstanceDifficultyID) end if vItemInfo.UpgradeTypeID then self:NoteMessage("UpgradeTypeID: "..vItemInfo.UpgradeTypeID) end if vItemInfo.UpgradeID then self:NoteMessage("UpgradeID: "..vItemInfo.UpgradeID) end if vItemInfo.BonusIDs and vItemInfo.BonusIDs ~= "::" then self:NoteMessage("BonusIDs: "..vItemInfo.BonusIDs) end end -- don't know where this function went; putting in a stub so its callers don't fail function Outfitter:GetItemLinkStats(pLink) return end function Outfitter:DepositOutfitUnique(pOutfit) self:DepositOutfit(pOutfit, true) end StaticPopupDialogs.OUTFITTER_CONFIRM_RESET = { text = Outfitter.cConfirmResetMsg, button1 = Outfitter.cReset, button2 = CANCEL, OnAccept = function() Outfitter:Reset() end, timeout = 0, whileDead = 1, hideOnEscape = 1, } function Outfitter:AskReset(param) -- Reset the bar position without prompting if strlower(param) == "bar" then self.OutfitBar:ResetPosition() self:NoteMessage("Outfit bar position reset") -- Ask the user if they're certain before resetting the entire addon else StaticPopup_Show("OUTFITTER_CONFIRM_RESET") end end function Outfitter:Reset() OutfitterFrame:Hide() self:ClearSelection() self.OutfitStack:Clear() self:InitializeSettings() self.CurrentOutfit = self:GetInventoryOutfit() self:InitializeOutfits() -- self:SynchronizeEM() self.EquippedNeedsUpdate = false end function Outfitter:SetOutfitBindingIndex(pOutfit, pBindingIndex) if pBindingIndex then for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vOutfitIndex, vOutfit in ipairs(vOutfits) do if vOutfit.BindingIndex == pBindingIndex then vOutfit.BindingIndex = nil end end end end pOutfit.BindingIndex = pBindingIndex end Outfitter.LastBindingIndex = nil Outfitter.LastBindingTime = nil Outfitter.cMinBindingTime = 0.75 function Outfitter:WearBoundOutfit(pBindingIndex) -- Check for the user spamming the button to prevent the outfit from -- toggling if they're panicking local vTime = GetTime() if self.LastBindingIndex == pBindingIndex then local vElapsed = vTime - self.LastBindingTime if vElapsed < self.cMinBindingTime then self.LastBindingTime = vTime return end end -- for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vOutfitIndex, vOutfit in ipairs(vOutfits) do if vOutfit.BindingIndex == pBindingIndex then vOutfit.Disabled = nil Outfitter.HasHWEvent = true if vCategoryID == "Complete" then self:WearOutfitNow(vOutfit) if not self.Settings.Options.DisableHotkeyMessages then UIErrorsFrame:AddMessage(format(self.cEquipOutfitMessageFormat, vOutfit:GetName()), self.OUTFIT_MESSAGE_COLOR.r, self.OUTFIT_MESSAGE_COLOR.g, self.OUTFIT_MESSAGE_COLOR.b) end else local vEquipped = self:ToggleOutfitNow(vOutfit, vCategoryID) if not self.Settings.Options.DisableHotkeyMessages then if vEquipped then UIErrorsFrame:AddMessage(format(self.cEquipOutfitMessageFormat, vOutfit:GetName()), self.OUTFIT_MESSAGE_COLOR.r, self.OUTFIT_MESSAGE_COLOR.g, self.OUTFIT_MESSAGE_COLOR.b) else UIErrorsFrame:AddMessage(format(self.cUnequipOutfitMessageFormat, vOutfit:GetName()), self.OUTFIT_MESSAGE_COLOR.r, self.OUTFIT_MESSAGE_COLOR.g, self.OUTFIT_MESSAGE_COLOR.b) end end end Outfitter.HasHWEvent = false -- Remember the binding used to filter for button spam self.LastBindingIndex = pBindingIndex self.LastBindingTime = vTime return end end end end function Outfitter:FindOutfit(pOutfit) for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vOutfitIndex, vOutfit in ipairs(vOutfits) do if vOutfit == pOutfit then return vCategoryID, vOutfitIndex end end end return nil, nil end function Outfitter:FindOutfitByName(pName) if not pName or pName == "" then return nil end local vLowerName = strlower(pName) for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vOutfitIndex, vOutfit in ipairs(vOutfits) do if strlower(vOutfit:GetName()) == vLowerName then return vOutfit, vCategoryID, vOutfitIndex end end end return nil, nil end function Outfitter:GetOutfitCategoryID(pOutfit) for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vOutfitIndex, vOutfit in ipairs(vOutfits) do if vOutfit == pOutfit then return vCategoryID, vOutfitIndex end end end end -- Outfitter doesn't use this function, but other addons such as -- Fishing Buddy might use it to locate specific generated outfits function Outfitter:FindOutfitByStatID(pStatID) if not pStatID or pStatID == "" then return nil end for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vOutfitIndex, vOutfit in ipairs(vOutfits) do if vOutfit.StatID and vOutfit.StatID == pStatID then return vOutfit, vCategoryID, vOutfitIndex end end end return nil end function Outfitter:OutfitSummary() end function Outfitter:RatingSummary() local vRatingIDs = { "Weapon", "Defense", "Dodge", "Parry", "Block", "Melee Hit", "Ranged Hit", "Spell Hit", "Melee Crit", "Ranged Crit", "Spell Crit", "Melee Hit Taken", "Ranged Hit Taken", "Spell Hit Taken", "Melee Crit Taken", "Ranged Crit Taken", "Spell Crit Taken", "Melee Haste", "Ranged Haste", "Spell Haste", } for vRatingID, vRatingName in ipairs(vRatingIDs) do local vRating = GetCombatRating(vRatingID) local vRatingBonus = GetCombatRatingBonus(vRatingID) if vRatingBonus > 0 then self:NoteMessage(vRatingName..": "..(vRating / vRatingBonus)) end end end -- Work-in-progress for bag organization. Probably will get split into another addon -- at some point, just playing around with it for now. local gOutfitter_SortBagItems local gOutfitter_Categories = { "Armor", "Weapons", "Consumables", "Potions", "Healthstone", "Mana gem", "Flasks", "Elixirs", "Bandages", "Trinkets", "Tradeskill", "Herbs", "Metals", "Gems", "Cloth", "Leather", "Cooking", "Spices", "Meat", "QuestItems", "Loot", "BoEs", "Junk", } local gOutfitterItemCorrections = { [6533] = {Type = "Consumable", SubType = "Other"}, -- Aquadynamic Fish Attractor [27503] = {SubType = "Scroll"}, -- Scroll of Protection V [27515] = {Type = "Trade Goods", SubType = "Meat", InvType = ""}, -- Huge Spotted Feltail } function Outfitter:CorrectItemInfo(pItemInfo) local vCorrection = gOutfitterItemCorrections[pItemInfo.Code] if not vCorrection then return end for vIndex, vValue in pairs(vCorrection) do pItemInfo[vIndex] = vValue end end function Outfitter.GetItemSortRank(pItem) if pItem.ItemIsUsed then return 0 elseif pItem.Quality == 0 then return 3 elseif pItem.Equippable then return 2 else return 1 end end function Outfitter:RunThreads() if self.SortBagsCoroutineRef then local vSuccess, vMessage = coroutine.resume(self.SortBagsCoroutineRef, self) if not vSuccess then self:ErrorMessage("SortBags resume failed: %s", vMessage) end end end Outfitter._BagIterator = {} Outfitter.cGeneralBagType = 0 function Outfitter._BagIterator:Construct(pStartIndex, pEndIndex) self:Reset(pStartIndex, pEndIndex) end function Outfitter._BagIterator:Reset(pStartIndex, pEndIndex) if not pStartIndex then pStartIndex = NUM_BAG_SLOTS pEndIndex = 0 end if not pEndIndex then pEndIndex = pStartIndex end if pStartIndex <= pEndIndex then self.Direction = 1 else self.Direction = -1 end self.BagIndex = pStartIndex self.EndBagIndex = pEndIndex self.BagSlotIndex = 0 if pStartIndex == pEndIndex or Outfitter:GetBagType(self.BagIndex)== Outfitter.cGeneralBagType then self.NumBagSlots = GetContainerNumSlots(self.BagIndex) else self.NumBagSlots = 0 end end function Outfitter._BagIterator:NextSlot() self.BagSlotIndex = self.BagSlotIndex + 1 while self.BagSlotIndex > self.NumBagSlots do if self.BagIndex == self.EndBagIndex then return false end self.BagIndex = self.BagIndex + self.Direction self.BagSlotIndex = 1 if Outfitter:GetBagType(self.BagIndex) == Outfitter.cGeneralBagType then self.NumBagSlots = GetContainerNumSlots(self.BagIndex) else self.NumBagSlots = 0 end end return true end function Outfitter:ItemUsesBothWeaponSlots(pItem) if not pItem then self:DebugMessage("ItemUsesBothWeaponSlots: nil item") self:DebugStack() return false end if pItem.InvType ~= "INVTYPE_2HWEAPON"then return false end if not self.CanDualWield2H then return true end if not pItem.SubType then self:DebugMessage("ItemUsesBothWeaponSlots: SubType not specified") self:DebugTable(pItem, "pItem") self:DebugStack() end return false end function Outfitter:GetItemMetaSlot(pItem) if pItem.MetaSlotName == "TwoHandSlot" and not self:ItemUsesBothWeaponSlots(pItem) then return "Weapon0Slot" else return pItem.MetaSlotName end end function Outfitter:GetCompiledOutfit() local vCompiledOutfit = self:NewEmptyOutfit() vCompiledOutfit.SourceOutfit = {} -- Start with the current inventory if self.CurrentInventoryOutfit then local vItems = self.CurrentInventoryOutfit:GetItems() for vInventorySlot, vOutfitItem in pairs(vItems) do vCompiledOutfit:SetItem(vInventorySlot, vOutfitItem) vCompiledOutfit.SourceOutfit[vInventorySlot] = "Equipped" end end -- Layer each selected outfit for vStackIndex, vOutfit in ipairs(Outfitter.OutfitStack.Outfits) do local vItems = vOutfit:GetItems() if vItems then for vInventorySlot, vOutfitItem in pairs(vItems) do vCompiledOutfit:SetItem(vInventorySlot, vOutfitItem) vCompiledOutfit.SourceOutfit[vInventorySlot] = vOutfit:GetName() end end end -- Make sure the OH slot is marked as empty if a 2H weapon is equipped -- and the player can't dual-wield 2H weapons vCompiledOutfit:AdjustOffhandSlot() return vCompiledOutfit end function Outfitter:GetCurrentCompleteOutfit() for vStackIndex, vOutfit in ipairs(self.OutfitStack.Outfits) do if vOutfit.CategoryID == "Complete" then return vOutfit end end end function Outfitter:GetExpectedOutfit(pExcludeOutfit) local vCompiledOutfit = self:NewEmptyOutfit() vCompiledOutfit.SourceOutfit = {} for vStackIndex, vOutfit in ipairs(self.OutfitStack.Outfits) do if vOutfit ~= pExcludeOutfit then local vItems = vOutfit:GetItems() for vInventorySlot, vOutfitItem in pairs(vItems) do vCompiledOutfit:SetItem(vInventorySlot, vOutfitItem) vCompiledOutfit.SourceOutfit[vInventorySlot] = vOutfit:GetName() end end end return vCompiledOutfit end function Outfitter:GetBagType(pBagIndex) if pBagIndex == 0 or pBagIndex == -1 then -- special case 0 and -1 since ContainerIDToInventoryID will barf on it return Outfitter.cGeneralBagType end if pBagIndex < 0 then pBagIndex = 4 - pBagIndex end local vItemLink = GetInventoryItemLink("player", ContainerIDToInventoryID(pBagIndex)) if not vItemLink then return nil end return GetItemFamily(vItemLink) end function Outfitter:GetEmptyBagSlot(pStartBagIndex, pStartBagSlotIndex, pIncludeBank) local vStartBagIndex = pStartBagIndex local vStartBagSlotIndex = pStartBagSlotIndex if not vStartBagIndex then vStartBagIndex = NUM_BAG_SLOTS end if not vStartBagSlotIndex then vStartBagSlotIndex = 1 end local vEndBagIndex = 0 if pIncludeBank then vEndBagIndex = -1 end for vBagIndex = vStartBagIndex, vEndBagIndex, -1 do local vNumEmptySlots, vBagType = GetContainerNumFreeSlots(vBagIndex) if vNumEmptySlots > 0 then local vNumBagSlots = GetContainerNumSlots(vBagIndex) for vSlotIndex = vStartBagSlotIndex, vNumBagSlots do if not GetContainerItemLink(vBagIndex, vSlotIndex) then return {BagIndex = vBagIndex, BagSlotIndex = vSlotIndex, BagType = vBagType} end end end vStartBagSlotIndex = 1 end return nil end function Outfitter:GetEmptyBagSlotList() local vEmptyBagSlots = {} local vBagIndex = NUM_BAG_SLOTS local vBagSlotIndex = 1 while true do local vBagSlotInfo = self:GetEmptyBagSlot(vBagIndex, vBagSlotIndex) if not vBagSlotInfo then return vEmptyBagSlots end table.insert(vEmptyBagSlots, vBagSlotInfo) vBagIndex = vBagSlotInfo.BagIndex vBagSlotIndex = vBagSlotInfo.BagSlotIndex + 1 end end function Outfitter:GetEmptyBankSlotList() local vEmptyBagSlots = {} local vBagIndex = NUM_BAG_SLOTS + NUM_BANKBAGSLOTS local vBagSlotIndex = 1 while true do local vBagSlotInfo = self:GetEmptyBagSlot(vBagIndex, vBagSlotIndex, true) if not vBagSlotInfo then return vEmptyBagSlots elseif vBagSlotInfo.BagIndex > NUM_BAG_SLOTS or vBagSlotInfo.BagIndex < 0 then table.insert(vEmptyBagSlots, vBagSlotInfo) end vBagIndex = vBagSlotInfo.BagIndex vBagSlotIndex = vBagSlotInfo.BagSlotIndex + 1 end end function Outfitter:FindItemsInBagsForSlot(pSlotName, pIgnoreItems) -- Alias the slot names down for finger and trinket local vInventorySlot = pSlotName if vInventorySlot == "Finger1Slot" then vInventorySlot = "Finger0Slot" elseif vInventorySlot == "Trinket1Slot" then vInventorySlot = "Trinket0Slot" end -- local vItems = {} local vNumBags, vFirstBagIndex = self:GetNumBags() for vBagIndex = vFirstBagIndex, vNumBags do local vNumBagSlots = GetContainerNumSlots(vBagIndex) if vNumBagSlots > 0 then for vSlotIndex = 1, vNumBagSlots do local vItemInfo = self:GetBagItemInfo(vBagIndex, vSlotIndex) if vItemInfo and (not pIgnoreItems or not pIgnoreItems[vItemInfo.Code]) then local vItemSlotName = vItemInfo.ItemSlotName if vItemInfo.MetaSlotName then vItemSlotName = self:GetItemMetaSlot(vItemInfo) end if vItemSlotName == "TwoHandSlot" then vItemSlotName = "MainHandSlot" elseif vItemSlotName == "Weapon0Slot" then if vInventorySlot == "MainHandSlot" or vInventorySlot == "SecondaryHandSlot" then vItemSlotName = vInventorySlot end end if vItemSlotName == vInventorySlot then table.insert(vItems, vItemInfo) end end end end end if #vItems == 0 then return nil end return vItems end function Outfitter:OpenNameOutfitDialog(pOutfit) if not self.NameOutfitDialog then self.NameOutfitDialog = Outfitter:New(Outfitter._NameOutfitDialog, UIParent) end self.NameOutfitDialog:Open(pOutfit) end function Outfitter:OpenRebuildOutfitDialog(pOutfit) if not self.RebuildOutfitDialog then self.RebuildOutfitDialog = Outfitter:New(Outfitter._RebuildOutfitDialog, UIParent) end self.RebuildOutfitDialog:Open(pOutfit) end function Outfitter:CreateNewOutfit() self:OpenNameOutfitDialog(nil) end function Outfitter:NewNakedOutfit(pName) local vOutfit = self:NewEmptyOutfit(pName) for _, vInventorySlot in ipairs(Outfitter.cSlotNames) do vOutfit:AddItem(vInventorySlot, nil) end return vOutfit end function Outfitter:NewEmptyItemInfo() return { Name = "", Code = 0, SubCode = 0, EnchantCode = 0, JewelCode1 = 0, JewelCode2 = 0, JewelCode3 = 0, JewelCode4 = 0, UniqueID = 0, UpgradeTypeID = 0, InstanceDifficultyID = 0, BonusIDs = "::", UpgradeID = 0, InvType = nil, } end function Outfitter.AzeriteCodesMatch(azeriteCodes1, azeriteCodes2) if not azeriteCodes1 and not azeriteCodes2 then return true end if not azeriteCodes1 or not azeriteCodes2 then return false end if #azeriteCodes1 ~= #azeriteCodes2 then return false end for powerID, _ in pairs(azeriteCodes1) do if not azeriteCodes2[powerID] then return false end end return true end function Outfitter:GetInventoryOutfit(pName, pOutfit) local vOutfit if pOutfit then vOutfit = pOutfit else vOutfit = self:NewEmptyOutfit(pName) end for _, vInventorySlot in ipairs(Outfitter.cSlotNames) do local vItemInfo = self:GetInventoryItemInfo(vInventorySlot) -- To avoid extra memory operations, only update the item if it's different local vExistingItem = vOutfit:GetItem(vInventorySlot) if not vItemInfo then if not vExistingItem or vExistingItem.Code ~= 0 then vOutfit:AddItem(vInventorySlot, nil) end else if not vExistingItem or vExistingItem.Code ~= vItemInfo.Code or vExistingItem.SubCode ~= vItemInfo.SubCode or vExistingItem.EnchantCode ~= vItemInfo.EnchantCode or vExistingItem.JewelCode1 ~= vItemInfo.JewelCode1 or vExistingItem.JewelCode2 ~= vItemInfo.JewelCode2 or vExistingItem.JewelCode3 ~= vItemInfo.JewelCode3 or vExistingItem.JewelCode4 ~= vItemInfo.JewelCode4 or vExistingItem.UniqueID ~= vItemInfo.UniqueID or vExistingItem.UpgradeItemID ~= vItemInfo.UpgradeItemID or vExistingItem.InstanceDifficultyID ~= vItemInfo.InstanceDifficultyID or vExistingItem.BonusIDs ~= vItemInfo.BonusIDs or vExistingItem.UpgradeID ~= vItemInfo.UpgradeID or vExistingItem.ReforgeID ~= vItemInfo.ReforgeID or not Outfitter.AzeriteCodesMatch(vExistingItem.AzeriteCodes, vItemInfo.AzeriteCodes) then vOutfit:AddItem(vInventorySlot, vItemInfo) end end end return vOutfit end function Outfitter:UpdateOutfitFromInventory(pOutfit, pNewItemsOutfit) if not pNewItemsOutfit then return end local vNewItems = pNewItemsOutfit:GetItems() pOutfit:AddNewItems(vNewItems) self:OutfitSettingsChanged(pOutfit) end function Outfitter:SubtractOutfit(pOutfit1, pOutfit2, pCheckAlternateSlots) local vInventoryCache = self:GetInventoryCache() -- Remove items from pOutfit1 if they match the item in pOutfit2 for _, vInventorySlot in ipairs(self.cSlotNames) do local vItem1 = pOutfit1:GetItem(vInventorySlot) local vItem2 = pOutfit2:GetItem(vInventorySlot) if vInventoryCache:ItemsAreSame(vItem1, vItem2) then pOutfit1:RemoveItem(vInventorySlot) elseif pCheckAlternateSlots then local vAlternateSlotName = self.cFullAlternateStatSlot[vInventorySlot] vItem2 = pOutfit2:GetItem(vAlternateSlotName) if vInventoryCache:ItemsAreSame(vItem1, vItem2) then pOutfit1:RemoveItem(vInventorySlot) end end end end function Outfitter:OutfitItemsAreSame(pOutfit1, pOutfit2, pCheckAlternateSlots, pIgnoreAmmo) local vInventoryCache = self:GetInventoryCache() for _, vInventorySlot in ipairs(Outfitter.cSlotNames) do local vItem1 = pOutfit1:GetItem(vInventorySlot) local vItem2 = pOutfit2:GetItem(vInventorySlot) if vInventoryCache:ItemsAreSame(vItem1, vItem2) then -- do nothing elseif pCheckAlternateSlots then local vAlternateSlotName = self.cFullAlternateStatSlot[vInventorySlot] vItem2 = pOutfit2:GetItem(vAlternateSlotName) if vInventoryCache:ItemsAreSame(vItem1, vItem2) then -- do nothing else return false end else return false end end return true end function Outfitter:GetNewItemsOutfit(pPreviousOutfit) -- Get the current outfit and the list -- of equippable items self.CurrentInventoryOutfit = self:GetInventoryOutfit(self.CurrentInventoryOutfit) local vInventoryCache = self:GetInventoryCache() -- Create a temporary outfit from the differences local vNewItemsOutfit = self:NewEmptyOutfit() local vOutfitHasItems = false for _, vInventorySlot in ipairs(self.cSlotNames) do local vCurrentItem = self.CurrentInventoryOutfit:GetItem(vInventorySlot) local vPreviousItem = pPreviousOutfit:GetItem(vInventorySlot) local vSkipSlot = false if vInventorySlot == "SecondaryHandSlot" then local vMainHandItem = pPreviousOutfit:GetItem("MainHandSlot") if not vMainHandItem then --self:DebugMessage("MainHandItem is nil") --self:DebugTable(pPreviousOutfit:GetItems(), "Items") end if self:ItemUsesBothWeaponSlots(vMainHandItem) then vSkipSlot = true end end if not vSkipSlot and not vInventoryCache:InventorySlotContainsItem(vInventorySlot, vPreviousItem) then if self.Debug.NewItems then self:DebugMessage("New item in slot %s", tostring(vInventorySlot)) self:DebugTable(vCurrentItem, "NewItem", 1) end vNewItemsOutfit:SetItem(vInventorySlot, vCurrentItem) vOutfitHasItems = true end end if not vOutfitHasItems then return nil end return vNewItemsOutfit, self.CurrentInventoryOutfit end function Outfitter:UpdateTemporaryOutfit(pNewItemsOutfit) -- Just return if nothing has changed if not pNewItemsOutfit then return end -- Merge the new items with an existing temporary outfit local vTemporaryOutfit = Outfitter.OutfitStack:GetTemporaryOutfit() local vUsingExistingTempOutfit = false if vTemporaryOutfit then local vNewItems = pNewItemsOutfit:GetItems() for vInventorySlot, vItem in pairs(vNewItems) do vTemporaryOutfit:SetItem(vInventorySlot, vItem) end vUsingExistingTempOutfit = true -- Otherwise add the new items as the temporary outfit else vTemporaryOutfit = pNewItemsOutfit end -- Subtract out items which are expected to be in the outfit local vExpectedOutfit = self:GetExpectedOutfit(vTemporaryOutfit) self:SubtractOutfit(vTemporaryOutfit, vExpectedOutfit) if vTemporaryOutfit:IsEmpty() then if vUsingExistingTempOutfit then self:RemoveOutfit(vTemporaryOutfit) end else if not vUsingExistingTempOutfit then Outfitter.OutfitStack:AddOutfit(vTemporaryOutfit) end end -- Add the new items to the current compiled outfit local vNewItems = pNewItemsOutfit:GetItems() if self.Debug.EquipmentChanges then self:DebugMessage("Adding new items to temporary outfit") self:DebugTable(vNewItems, "NewItems", 2) end for vInventorySlot, vItem in pairs(vNewItems) do Outfitter.ExpectedOutfit:SetItem(vInventorySlot, vItem) end end function Outfitter:SetSlotEnable(pSlotName, pEnable) if not self.SelectedOutfit then return end if pEnable then Outfitter:DebugMessage("Enabling slot "..pSlotName) self.SelectedOutfit:SetInventoryItem(pSlotName) else self.SelectedOutfit:RemoveItem(pSlotName) end self.DisplayIsDirty = true end function Outfitter:GetOutfitByScriptID(pScriptID) for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for _, vOutfit in ipairs(vOutfits) do if vOutfit.ScriptID == pScriptID then return vOutfit end end end return nil end function Outfitter:GetOutfitByName(name) for categoryID, outfits in pairs(self.Settings.Outfits) do for _, outfit in ipairs(outfits) do if outfit.Name == name then return outfit end end end return nil end Outfitter.AuraStates = { Dining = false, GhostWolf = false, Feigning = false, Evocate = false, Monkey = false, Hawk = false, Cheetah = false, Pack = false, Beast = false, Wild = false, Viper = false, Dragonhawk = false, Prowl = false, } function Outfitter:GetPlayerAuraStates() local vBuffIndex = 1 for vKey, _ in pairs(self.AuraStates) do self.AuraStates[vKey] = false end while true do local vName, _, vTexture, _, _, _, _, _, _, _, vSpellID = UnitBuff("player", vBuffIndex) if not vName then return self.AuraStates end -- local vSpecialID = Outfitter.cAuraIconSpecialID[vName] if not vSpecialID then vSpecialID = Outfitter.cAuraIconSpecialID[vTexture] end if not vSpecialID then vSpecialID = self.cSpellIDToSpecialID[vSpellID] end if vSpecialID then self.AuraStates[vSpecialID] = true end vBuffIndex = vBuffIndex + 1 end end function Outfitter:GetBuffTooltipText(pBuffIndex) local tooltip = self.TooltipLib:SharedTooltip() tooltip:ClearLines() tooltip:SetUnitBuff("player", pBuffIndex) if not tooltip:IsShown() then return end -- Find the first two text lines local tooltipName = tooltip:GetName() local textLeft1 = _G[tooltipName.."TextLeft1"] local textLeft2 = _G[tooltipName.."TextLeft2"] -- Retrieve the first line if it's shown local text1 if textLeft1:IsShown() then text1 = textLeft1:GetText() end -- if IsShown -- Retrieve the second line if it's shown local text2 if OutfitterTooltipTextLeft2:IsShown() then text2 = textLeft2:GetText() end -- if IsShown return text1, text2 end function Outfitter:UpdateSwimming() self:BeginEquipmentUpdate() self.EventLib:DispatchEvent("TIMER") self:UpdateMountedState() local vSwimming = false if IsSwimming() then vSwimming = true end if not self.SpecialState.Swimming then self.SpecialState.Swimming = false end self:SetSpecialOutfitEnabled("Swimming", vSwimming) self:EndEquipmentUpdate() end function Outfitter:UnitAuraChanged(pEvent, pUnitID) if pUnitID ~= "player" then return end if self.InCombat then self.SchedulerLib:ScheduleUniqueTask(2.0, self.UpdateAuraStates, self) else self:UpdateAuraStates() end end function Outfitter:UpdateAuraStates() self:BeginEquipmentUpdate() -- Check for special aura outfits local vAuraStates = self:GetPlayerAuraStates() for vSpecialID, vIsActive in pairs(vAuraStates) do if vSpecialID == "Feigning" then self.IsFeigning = vIsActive end if not Outfitter.SpecialState[vSpecialID] then self.SpecialState[vSpecialID] = false end -- Don't equip the dining outfit if health and mana are almost topped up if vSpecialID == "Dining" and vIsActive and self:PlayerIsFull() then vIsActive = false end -- Update the state self:SetSpecialOutfitEnabled(vSpecialID, vIsActive) end self:UpdateMountedState() self:EndEquipmentUpdate() -- Update shapeshift state on aura change too -- NOTE: Currently (WoW client 2.3) the shapeshift info isn't -- always up-to-date when the AURA event comes in, so update -- the shapeshift state after about 1 frame to allow the state to -- synch self.SchedulerLib:ScheduleUniqueTask(0.01, self.UpdateShapeshiftState, self) end function Outfitter:UpdateMountedState() local vRiding = IsMounted() and not UnitOnTaxi("player") self:SetSpecialOutfitEnabled("Riding", vRiding) end function Outfitter:UpdateShapeshiftState() -- During loading screens, shapeshift/DK-Presence auras disappear briefly. -- depending on outfit setup, this may remove some or all the player's gear -- and then put it right back on when aura reappears, but this leaves them -- at low health or mana etc. due to the stat loss of not having their gear on. -- so we defer shapeshift checks until loading screen stuff is completed. if self.Suspended then self.SchedulerLib:ScheduleUniqueTask(0.1, self.UpdateShapeshiftState, self) return end self:BeginEquipmentUpdate() if not self.Settings.ShapeshiftIndexInfo then self.Settings.ShapeshiftIndexInfo = {} end -- Search for the active shapeshift form, plus while searching deactivate any forms which aren't the active one local activeForm local numForms = GetNumShapeshiftForms() --self:DebugMessage("Outfitter:UpdateShapeshiftState(): %d forms", numForms) for index = 1, numForms do local texture, isActive, isCastable, shapeshiftID = GetShapeshiftFormInfo(index) local _ --self:DebugMessage("%s: %s texture = %s %s", tostring(index), tostring(shapeshiftID), tostring(texture), isActive and "ACTIVE" or "not active") local shapeshiftInfo = self.cShapeshiftIDInfo[shapeshiftID] if shapeshiftInfo then self.Settings.ShapeshiftIndexInfo[index] = shapeshiftInfo else shapeshiftInfo = self.Settings.ShapeshiftIndexInfo[index] end if shapeshiftInfo then if not isActive then self:UpdateShapeshiftInfo(shapeshiftInfo, false) else activeForm = shapeshiftInfo end end end -- Substitute the druid caster pseudo-form if necessary or deactivate it -- if it's not if self.PlayerClass == "DRUID" then if not activeForm then activeForm = self.cShapeshiftIDInfo.CasterForm else self:UpdateShapeshiftInfo(self.cShapeshiftIDInfo.CasterForm, false) end end -- Activate the new form if activeForm then self:UpdateShapeshiftInfo(activeForm, true) end self:EndEquipmentUpdate() end function Outfitter:UpdateShapeshiftInfo(pShapeshiftInfo, pIsActive) -- Ensure a proper boolean if pIsActive then pIsActive = true else pIsActive = false end -- --Outfitter:DebugMessage("Outfitter:UpdateShapeshiftInfo(%s, %s)", tostring(pShapeshiftInfo.ID), tostring(pIsActive)) --Outfitter:DebugStack() if self.SpecialState[pShapeshiftInfo.ID] == nil then self.SpecialState[pShapeshiftInfo.ID] = self:WearingOutfitWithScriptID(pShapeshiftInfo.ID) end if self.SpecialState[pShapeshiftInfo.ID] ~= pIsActive then if pIsActive and pShapeshiftInfo.MaybeInCombat then self.MaybeInCombat = true end self:SetSpecialOutfitEnabled(pShapeshiftInfo.ID, pIsActive) end end function Outfitter:SetSpecialOutfitEnabled(pSpecialID, pEnable) -- Ensure a proper boolean if pEnable then pEnable = true else pEnable = false end if self.SpecialState[pSpecialID] == pEnable then return end -- Suspend or resume monitoring the player health -- if the dining outfit is being changed if pSpecialID == "Dining" and pEnable then self.EventLib:RegisterEvent("UNIT_HEALTH", self.UnitHealthOrManaChanged, self, true) -- Register as a blind event handler else self.EventLib:UnregisterEvent("UNIT_HEALTH", self.UnitHealthOrManaChanged, self) end -- self.SpecialState[pSpecialID] = pEnable -- Dispatch the special ID events local vEvents = self.cSpecialIDEvents[pSpecialID] if vEvents then if pEnable then self.EventLib:DispatchEvent(vEvents.Equip) else self.EventLib:DispatchEvent(vEvents.Unequip) end else self:ErrorMessage("No events found for "..pSpecialID) end end function Outfitter:WearingOutfitWithScriptID(pSpecialID) for vIndex, vOutfit in ipairs(self.OutfitStack.Outfits) do if vOutfit.ScriptID == pSpecialID then return true, vIndex end end end function Outfitter:ScheduleUpdateZone() self.SchedulerLib:RescheduleTask(0.01, self.UpdateZone, self) end function Outfitter:UpdateZone() local vCurrentZone = GetZoneText() local name, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID = GetInstanceInfo() -- Just return if the zone isn't changing if vCurrentZone == self.CurrentZone then return end self.CurrentZone = vCurrentZone self.CurrentZoneIDs = self:GetCurrentZoneIDs(self.CurrentZoneIDs) self:BeginEquipmentUpdate() -- for _, vSpecialID in ipairs(self.cZoneSpecialIDs) do local vIsActive = self.CurrentZoneIDs[vSpecialID] == true local vCurrentIsActive = self.SpecialState[vSpecialID] if vCurrentIsActive == nil then vCurrentIsActive = self:WearingOutfitWithScriptID(vSpecialID) self.SpecialState[vSpecialID] = vCurrentIsActive end self:SetSpecialOutfitEnabled(vSpecialID, vIsActive) end self:EndEquipmentUpdate() end function Outfitter:GetCurrentZoneIDs(pRecycleTable) local vZoneIDs = self:RecycleTable(pRecycleTable) local vZoneSpecialIDMap = self.cZoneSpecialIDMap[self.CurrentZone] if not vZoneSpecialIDMap then vZoneSpecialIDMap = self.cZoneSpecialIDMap[GetRealZoneText()] end local vPVPType, vIsArena, vFactionName = GetZonePVPInfo() if vZoneSpecialIDMap then for _, vZoneSpecialID in ipairs(vZoneSpecialIDMap) do if vZoneSpecialID ~= "City" or vPVPType ~= "hostile" then vZoneIDs[vZoneSpecialID] = true end end end local inInstance, instanceType = IsInInstance() vZoneIDs.Battleground = instanceType == "pvp" or instanceType == "arena" return vZoneIDs end function Outfitter:InZoneType(pZoneType) return self.CurrentZoneIDs[pZoneType] == true end function Outfitter:InBattlegroundZone() local name, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID = GetInstanceInfo() return instanceType == "pvp" or instanceType == "arena" end function Outfitter:SetAllSlotEnables(pEnable) if pEnable then self.SelectedOutfit:EnableAllSlots() else self.SelectedOutfit:DisableAllSlots() end self:OutfitSettingsChanged(self.SelectedOutfit) self:Update(true) end function Outfitter:OutfitSettingsChanged(pOutfit) if not pOutfit then return end local vTargetCategoryID = pOutfit:CalculateOutfitCategory() if pOutfit.CategoryID ~= vTargetCategoryID then local vOutfitCategoryID, vOutfitIndex = self:FindOutfit(pOutfit) if not vOutfitCategoryID then self:ErrorMessage(pOutfit:GetName().." not found in outfit list") return end if vOutfitCategoryID ~= pOutfit.CategoryID then self:DebugMessage("OutfitSettingsChanged: "..pOutfit:GetName().." says it's in "..pOutfit.CategoryID.." but it's in "..vOutfitCategoryID) end table.remove(self.Settings.Outfits[vOutfitCategoryID], vOutfitIndex) self:AddOutfit(pOutfit) end self.DisplayIsDirty = true self:DispatchOutfitEvent("EDIT_OUTFIT", pOutfit:GetName(), pOutfit) end function Outfitter:DeleteOutfit(pOutfit) local vWearingOutfit = self:WearingOutfit(pOutfit) -- Deselect the outfit if pOutfit == self.SelectedOutfit then self:ClearSelection() end -- Remove the outfit if it's being worn self:RemoveOutfit(pOutfit) self:DeactivateScript(pOutfit) local vOutfitCategoryID, vOutfitIndex = self:FindOutfit(pOutfit) if not vOutfitCategoryID then return end -- Delete the outfit table.remove(self.Settings.Outfits[vOutfitCategoryID], vOutfitIndex) pOutfit:Delete() -- self.DisplayIsDirty = true self:DispatchOutfitEvent("DELETE_OUTFIT", pOutfit:GetName(), pOutfit) end function Outfitter:AddOutfit(pOutfit) local vCategoryID vCategoryID = pOutfit:CalculateOutfitCategory() if not self.Settings.Outfits then self.Settings.Outfits = {} end if not self.Settings.Outfits[vCategoryID] then self.Settings.Outfits[vCategoryID] = {} end table.insert(self.Settings.Outfits[vCategoryID], pOutfit) pOutfit.CategoryID = vCategoryID self.DisplayIsDirty = true self:DispatchOutfitEvent("ADD_OUTFIT", pOutfit:GetName(), pOutfit) return vCategoryID end function Outfitter:SlotEnableClicked(pCheckbox, pButton) -- If the user is attempting to drop an item put it in the slot for them if CursorHasItem() then PickupInventoryItem(self.cSlotIDs[pCheckbox.SlotName]) return end -- local vChecked = pCheckbox:GetChecked() if pCheckbox.IsUnknown then pCheckbox.IsUnknown = false pCheckbox:SetCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check") vChecked = true end self:SetSlotEnable(pCheckbox.SlotName, vChecked) self:OutfitSettingsChanged(self.SelectedOutfit) self:Update(true) end function Outfitter:FindMultipleItemLocation(pItems, pInventoryCache) for vListIndex, vListItem in ipairs(pItems) do local vItem = pInventoryCache:FindItemOrAlt(vListItem) if vItem then return vItem, vListItem end end return nil, nil end function Outfitter:FindAndAddItemsToOutfit(pOutfit, pSlotName, pItems, pInventoryCache) vItemLocation, vItem = self:FindMultipleItemLocation(pItems, pInventoryCache) if vItemLocation then local vInventorySlot = pSlotName if not vInventorySlot then vInventorySlot = vItemLocation.ItemSlotName end pOutfit:AddItem(vInventorySlot, vItem) end end function Outfitter:IsInitialized() return self.Initialized end function Outfitter:InitializationCheck() -- Don't initialize for a short time after WoW comes up to allow -- time for WoW to load inventory, bags, talent trees, etc. self.SchedulerLib:RescheduleTask(1, self.Initialize, self) end function Outfitter:Initialize() if self.Initialized then return end -- Unregister the initialization events for vEventID, _ in pairs(self.cInitializationEvents) do self.EventLib:UnregisterEvent(vEventID, self.InitializationCheck, self) end -- Make sure they're not upgrading with a reloadui when there are new files if tonumber(GetAddOnMetadata("Outfitter", "X-ReloadTag")) ~= 2 then OutfitterMinimapButton:Hide() -- Remove access to Outfitter so more errors don't start coming up OutfitterButtonFrame:Hide() StaticPopup_Show("OUTFITTER_CANT_RELOADUI") return end -- Get the basic player info self.PlayerName = UnitName("player") self.RealmName = GetRealmName() local _, vPlayerClass = UnitClass("player") self.PlayerClass = vPlayerClass -- Swap in the Horde Lance for the Alliance Lance mapping if UnitFactionGroup("player") == "Horde" then Outfitter.cItemAliases[46106] = 46070 -- Argent Lance -> Horde Lance end -- Initialize the global settings if they didn't get loaded if not gOutfitter_GlobalSettings then self:InitializeGlobalSettings() end -- Refuse to load for select characters if (self.BannedCharacters[self.RealmName] and self.BannedCharacters[self.RealmName][self.PlayerName]) or gOutfitter_GlobalSettings.Banned then gOutfitter_GlobalSettings.Banned = true OutfitterMinimapButton:Hide() OutfitterButtonFrame:Hide() self:ErrorMessage("Your character is banned from Outfitter. Use something else for your gear management.") return end -- Hook onto C_PetJournal.SummonPetByGUID so that the cooldown can be monitored -- hooksecurefunc(C_PetJournal, "SummonPetByGUID", function () self.SummonPetByGUIDTime = GetTime() end) -- self.SummonPetByGUIDTime = GetTime() -- Initialize the main UI tabs self._SidebarWindowFrame.Construct(OutfitterFrame) PanelTemplates_SetNumTabs(OutfitterFrame, #self.cPanelFrames) OutfitterFrame.selectedTab = self.CurrentPanel PanelTemplates_UpdateTabs(OutfitterFrame) -- Install the /outfit command handler SlashCmdList.OUTFITTER = function (pCommand) Outfitter:ExecuteCommand(pCommand) end SLASH_OUTFITTER1 = "/outfitter" if not SlashCmdList.UNEQUIP then SlashCmdList.UNEQUIP = self.UnequipItemByName SLASH_UNEQUIP1 = "/unequip" end -- Initialize the slot ID map self.cSlotIDs = {} self.cSlotIDToInventorySlot = {} for _, vInventorySlot in ipairs(self.cSlotNames) do local vSlotID = GetInventorySlotInfo(vInventorySlot) self.cSlotIDs[vInventorySlot] = vSlotID self.cSlotIDToInventorySlot[vSlotID] = vInventorySlot end -- Initialize the scripts Outfitter:InitializeScripts() -- Initialize the settings if not gOutfitter_Settings then self:InitializeSettings() else self.Settings = gOutfitter_Settings end -- Initialize the outfits self.CurrentOutfit = self:GetInventoryOutfit() if not self.Settings.Outfits then self:InitializeOutfits() end -- self:InstallDefaultSpecializationIcons() self:AttachOutfitMethods() self:CheckDatabase() -- Initialize the outfit stack self.OutfitStack:Initialize() -- Clean up any recent complete outfits which don't exist as -- well as duplicate entries local vUsedRecentNames = {} for vIndex = #self.Settings.RecentCompleteOutfits, 1, -1 do local vName = self.Settings.RecentCompleteOutfits[vIndex] if not self:FindOutfitByName(vName) or vUsedRecentNames[vName] then table.remove(self.Settings.RecentCompleteOutfits, vIndex) else vUsedRecentNames[vName] = true end end -- Set the minimap button if self.Settings.Options.HideMinimapButton then OutfitterMinimapButton:Hide() else OutfitterMinimapButton:Show() end if not self.Settings.Options.MinimapButtonAngle and not self.Settings.Options.MinimapButtonX then self.Settings.Options.MinimapButtonAngle = -1.5708 end if self.Settings.Options.MinimapButtonAngle then OutfitterMinimapButton:SetPositionAngle(self.Settings.Options.MinimapButtonAngle) else OutfitterMinimapButton:SetPosition(self.Settings.Options.MinimapButtonX, self.Settings.Options.MinimapButtonY) end -- Move the Blizzard UI over a bit -- PaperDollSidebarTabs:SetPoint("BOTTOMRIGHT", CharacterFrameInsetRight, "TOPRIGHT", -30, -1) -- Initialize player state self.SpiritRegenEnabled = true -- Done initializing self.Initialized = true -- Make sure the outfit state is good self:SetSpecialOutfitEnabled("Riding", false) self:SetSpecialOutfitEnabled("Spirit", false) self:UpdateAuraStates() -- Start listening for events self.EventLib:RegisterEvent("PLAYER_ENTERING_WORLD", self.SchedulePlayerEnteringWorld, self) self.EventLib:RegisterEvent("PLAYER_LEAVING_WORLD", self.PlayerLeavingWorld, self) -- For monitoring mounted and dining states self.EventLib:RegisterEvent("UNIT_AURA", self.UnitAuraChanged, self) --hooksecurefunc("ShapeshiftBar_UpdateState", function () Outfitter.SchedulerLib:ScheduleUniqueTask(0.01, self.UpdateShapeshiftState, self) end) -- For monitoring plaguelands and battlegrounds self.EventLib:RegisterEvent("ZONE_CHANGED_NEW_AREA", self.ScheduleUpdateZone, self) self.EventLib:RegisterEvent("ZONE_CHANGED", self.ScheduleUpdateZone, self) self.EventLib:RegisterEvent("ZONE_CHANGED_INDOORS", self.ScheduleUpdateZone, self) -- For monitoring player combat state self.EventLib:RegisterEvent("PLAYER_REGEN_ENABLED", self.RegenEnabled, self) self.EventLib:RegisterEvent("PLAYER_REGEN_DISABLED", self.RegenDisabled, self) -- For monitoring player dead/alive state self.EventLib:RegisterEvent("PLAYER_DEAD", self.PlayerDead, self) self.EventLib:RegisterEvent("PLAYER_ALIVE", self.PlayerAlive, self) self.EventLib:RegisterEvent("PLAYER_UNGHOST", self.PlayerAlive, self) self.EventLib:RegisterEvent("UNIT_INVENTORY_CHANGED", self.UnitInventoryChanged, self, true) -- Register as a blind event handler (no event id param) self.EventLib:RegisterCustomEvent("OUTFITTER_INVENTORY_CHANGED", self.InventoryChanged, self, true) -- Register as a blind event handler (no event id param) -- For indicating which outfits are missing items self.EventLib:RegisterEvent("BAG_UPDATE", self.BagUpdate, self) self.EventLib:RegisterEvent("PLAYERBANKSLOTS_CHANGED", self.BankSlotsChanged, self) -- For monitoring bank bags self.EventLib:RegisterEvent("BANKFRAME_OPENED", self.BankFrameOpened, self) self.EventLib:RegisterEvent("BANKFRAME_CLOSED", self.BankFrameClosed, self) -- For monitoring void storage -- self.EventLib:RegisterEvent("VOID_STORAGE_OPEN", self.VoidStorageFrameOpened, self) -- self.EventLib:RegisterEvent("VOID_STORAGE_CLOSE", self.VoidStorageFrameClosed, self) -- For unequipping the dining outfit self.EventLib:RegisterEvent("UNIT_MANA", self.UnitHealthOrManaChanged, self, true) -- Register as a blind event handler (no event id param) -- For monitoring spellcasts --[[ for _, vEventID in ipairs({ "UNIT_SPELLCAST_CHANNEL_START", "UNIT_SPELLCAST_CHANNEL_STOP", "UNIT_SPELLCAST_CHANNEL_UPDATE", "UNIT_SPELLCAST_DELAYED", "UNIT_SPELLCAST_FAILED", "UNIT_SPELLCAST_FAILED_QUIET", "UNIT_SPELLCAST_INTERRUPTED", "UNIT_SPELLCAST_SENT", "UNIT_SPELLCAST_START", "UNIT_SPELLCAST_STOP", "UNIT_SPELLCAST_SUCCEEDED", "UNIT_SPELLMISS" }) do self.EventLib:RegisterEvent(vEventID, self.UnitSpellcastDebug, self) end ]] self.EventLib:RegisterEvent("UNIT_SPELLCAST_SENT", self.UnitSpellcastSent, self) self.EventLib:RegisterEvent("UNIT_SPELLCAST_START", self.UnitSpellcastSent, self) self.EventLib:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", self.UnitSpellcastStop, self) self.EventLib:RegisterEvent("UNIT_SPELLCAST_STOP", self.UnitSpellcastStop, self) self.EventLib:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START", self.UnitSpellcastChannelStart, self) self.EventLib:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", self.UnitSpellcastChannelStop, self) self.EventLib:RegisterEvent("UNIT_SPELLCAST_FAILED", self.UnitSpellcastStop, self) self.EventLib:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET", self.UnitSpellcastStop, self) self.EventLib:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", self.UnitSpellcastStop, self) -- -- self.EventLib:RegisterEvent("CHARACTER_POINTS_CHANGED", self.TalentsChanged, self) -- self.EventLib:RegisterEvent("PLAYER_TALENT_UPDATE", self.TalentsChanged, self) -- self:TalentsChanged() -- Patch GameTooltip so we can monitor hide/show events self:HookScript(GameTooltip, "OnShow", self.GameToolTip_OnShow) self:HookScript(GameTooltip, "OnHide", self.GameToolTip_OnHide) -- Patch MobInfo tooltip since it replaces the GameToolTip (blech) if MI2_TooltipFrame then self:HookScript(MI2_TooltipFrame, "OnShow", self.GameToolTip_OnShow) self:HookScript(MI2_TooltipFrame, "OnHide", self.GameToolTip_OnHide) end -- Synchronize with the Equipment Manager -- self:StartMonitoringEM() -- self:DispatchOutfitEvent("OUTFITTER_INIT") self.SchedulerLib:ScheduleUniqueRepeatingTask(0.5, self.UpdateSwimming, self, nil, "Outfitter:UpdateSwimming") -- Activate all outfit scripts if not self.Settings.Options.DisableAutoSwitch then self:ActivateAllScripts() end -- Install the "Used by outfits" tooltip feature hooksecurefunc(GameTooltip, "SetBagItem", self.GameTooltip_SetBagItem) hooksecurefunc(GameTooltip, "SetInventoryItem", self.GameTooltip_SetInventoryItem) hooksecurefunc(GameTooltip, "SetHyperlink", self.GameTooltip_SetHyperlink) -- Install the item compare tooltips if not self.Settings.Options.DisableItemComparisons then self.ExtendedCompareTooltip = self:New(Outfitter._ExtendedCompareTooltip) end -- Fire things up with a simulated entrance self:SchedulePlayerEnteringWorld() end function Outfitter:StartMonitoringEM() self.EventLib:RegisterEvent("EQUIPMENT_SETS_CHANGED", self.SynchronizeEM, self) end function Outfitter:StopMonitoringEM() self.EventLib:UnregisterEvent("EQUIPMENT_SETS_CHANGED", self.SynchronizeEM, self) end -- Blizzard added icon numbers in patch 6 but no API for mapping between the number and the path, so create a texture to use for doing the mapping function Outfitter:ConvertTextureIDToPath(pID) if type(pID) ~= "number" then return pID end if not self.IDConversionTexture then self.IDConversionTexture = OutfitterFrame:CreateTexture(nil, "BACKGROUND") self.IDConversionTexture:Hide() end self.IDConversionTexture:SetTexture(pID) return self.IDConversionTexture:GetTexture() end function Outfitter:ConvertTextureIDToString(pID) if type(pID) ~= "number" then return pID end local vPath = self:ConvertTextureIDToPath(pID) return string.match(vPath, ".-([^\\]-)$") end function Outfitter:InitializeSettings() gOutfitter_Settings = { Version = 22, Options = {}, LastOutfitStack = {}, LayerIndex = {}, RecentCompleteOutfits = {}, } self.Settings = gOutfitter_Settings self.OutfitBar:InitializeSettings() end function Outfitter:InitializeGlobalSettings() gOutfitter_GlobalSettings = { Version = 1, SavedScripts = {}, } end function Outfitter:AttachOutfitMethods() for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vIndex, vOutfit in ipairs(vOutfits) do if vOutfit.StoredInEM then local equipmentSetID = C_EquipmentSet.GetEquipmentSetID(vOutfit.Name) if equipmentSetID then vOutfit.equipmentSetID = equipmentSetID end setmetatable(vOutfit, Outfitter._OutfitMetaTableEM) else setmetatable(vOutfit, Outfitter._OutfitMetaTable) end end end end function Outfitter:SynchronizeEM() local equipmentSetIDs = C_EquipmentSet.GetEquipmentSetIDs() -- Mark all the EM outfits as unused for vCategoryID, outfits in pairs(self.Settings.Outfits) do for vIndex, outfit in ipairs(outfits) do if outfit.StoredInEM then outfit.Unused = true end end end -- If NumEquipmentSets is zero, assume that the EM is flaking out -- and save the EM-based outfits so they can be restored if the EM -- happens to straighten up later if #equipmentSetIDs == 0 then if not self.Settings.PreservedEMOutfits then self.Settings.PreservedEMOutfits = {} end for vCategoryID, outfits in pairs(self.Settings.Outfits) do for vIndex, outfit in ipairs(outfits) do if outfit.StoredInEM then self.Settings.PreservedEMOutfits[outfit.Name] = outfit end end end end -- Scan the EM outfits for _, equipmentSetID in ipairs(equipmentSetIDs) do local name = C_EquipmentSet.GetEquipmentSetInfo(equipmentSetID) local outfit = self:FindEMOutfitByName(name) -- If the outfit is missing, see if it can be restored from -- the preserved list if not outfit and self.Settings.PreservedEMOutfits then outfit = self.Settings.PreservedEMOutfits[name] if outfit then setmetatable(outfit, Outfitter._OutfitMetaTableEM) outfit.equipmentSetID = equipmentSetID self:AddOutfit(outfit) self:ActivateScript(outfit) if not outfit.equipmentSetID then Outfitter:TestMessage("no equipmentsetID 1") end end end if not outfit then outfit = { Name = name, StoredInEM = true, equipmentSetID = equipmentSetID, Items = {}, } setmetatable(outfit, Outfitter._OutfitMetaTableEM) self:AddOutfit(outfit) if not outfit.equipmentSetID then Outfitter:TestMessage("no equipmentsetID 2") end else outfit.Unused = nil end end -- Delete unused outfits for vCategoryID, outfits in pairs(self.Settings.Outfits) do local vNumOutfits = #outfits local vIndex = 1 while vIndex <= vNumOutfits do local outfit = outfits[vIndex] if outfit.StoredInEM and outfit.Unused then self:DeactivateScript(outfit) table.remove(outfits, vIndex) vNumOutfits = vNumOutfits - 1 else vIndex = vIndex + 1 end end end -- If NumEquipmentSets is not zero, assume that the EM is working correctly -- and get rid of any preserved outfits if #equipmentSetIDs > 0 then self.Settings.PreservedEMOutfits = nil end -- Done self.DisplayIsDirty = true end function Outfitter:FindEMOutfitByName(pName) local vLowerName = pName:lower() for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vIndex, vOutfit in ipairs(vOutfits) do if vOutfit.StoredInEM and vOutfit.Name:lower() == vLowerName then return vOutfit end end end end function Outfitter:InitializeOutfits() -- Cache the inventory local vOutfit, vItemLocation, vItem local vInventoryCache = self:GetInventoryCache() -- Create the outfit categories self.Settings.Outfits = {} for vCategoryIndex, vCategoryID in ipairs(Outfitter.cCategoryOrder) do self.Settings.Outfits[vCategoryID] = {} end -- Load the EM outfits -- self:SynchronizeEM() -- Create the normal outfit using the current -- inventory and set it as the currently equipped outfit vOutfit = self:FindOutfitByName(Outfitter.cNormalOutfit) if not vOutfit then vOutfit = self:GetInventoryOutfit(Outfitter.cNormalOutfit) self:AddOutfit(vOutfit) end self.Settings.LastOutfitStack = {{Name = Outfitter.cNormalOutfit}} Outfitter.OutfitStack.Outfits = {vOutfit} -- Create the naked outfit vOutfit = self:NewNakedOutfit(Outfitter.cNakedOutfit) self:AddOutfit(vOutfit) -- Generate the smart outfits for vSmartIndex, vSmartOutfit in ipairs(Outfitter.cSmartOutfits) do vOutfit = self:GenerateSmartOutfit(vSmartOutfit.Name, vSmartOutfit.StatID, vInventoryCache) if vOutfit then vOutfit.ScriptID = vSmartOutfit.ScriptID self:AddOutfit(vOutfit) end end self:InitializeSpecialOccasionOutfits() end function Outfitter:CreateEmptySpecialOccasionOutfit(pScriptID, pName, pAllowDuplicates) -- Return the existing outfit if duplicates aren't allowed vOutfit = self:GetOutfitByName(pName) if vOutfit and not pAllowDuplicates then -- Assign the script to the existing outfit if there isn't one already if not vOutfit.ScriptID then vOutfit.ScriptID = pScriptID end return vOutfit end -- Create the outfit vOutfit = self:NewEmptyOutfit(pName) vOutfit.ScriptID = pScriptID self:AddOutfit(vOutfit) -- Done return vOutfit end function Outfitter:InitializeSpecialOccasionOutfits() local vInventoryCache = self:GetInventoryCache() local vOutfit -- Create talent tree outfits -- self:InitializeTalentTreeOutfits() -- Create class-specific outfits self:InitializeClassOutfits() end function Outfitter:InstallDefaultSpecializationIcons() --local numSpecs = GetNumSpecializations() --for specIndex = 1, numSpecs do -- local _, specName, _, specIconID = GetSpecializationInfo(specIndex) -- local scriptID = "SPECIALIZATION_"..specIndex -- Outfitter.OutfitBar.cDefaultScriptIcons[scriptID] = specIconID --end end function Outfitter:InitializeTalentTreeOutfits() --local playerClass = UnitClass("player") -- --local numSpecs = GetNumSpecializations() --for specIndex = 1, numSpecs do -- local _, specName, _, specIconID = GetSpecializationInfo(specIndex) -- -- -- Done when the names run out -- if not specName then -- return -- end -- -- -- Create the outfit -- local scriptID = "SPECIALIZATION_"..specIndex -- local outfitName = playerClass..": "..specName -- local outfit = self:CreateEmptySpecialOccasionOutfit(scriptID, outfitName) -- outfit:SetIcon(specIconID) --end end function Outfitter:InitializeClassOutfits() local vOutfits = self.cClassSpecialOutfits[Outfitter.PlayerClass] if not vOutfits then return end for vIndex, vOutfitInfo in ipairs(vOutfits) do self:CreateEmptySpecialOccasionOutfit(vOutfitInfo.ScriptID, vOutfitInfo.Name) end end Outfitter.cDeformat = { s = "(.-)", d = "(-?[%d]+)", f = "(-?[%d%.]+)", g = "(-?[%d%.]+)", ["%"] = "%%", } function Outfitter:ConvertFormatStringToSearchPattern(pFormat) local vFormat = pFormat:gsub( "[%[%]%.]", function (pChar) return "%"..pChar end) return vFormat:gsub( "%%[%-%d%.]-([sdgf%%])", self.cDeformat) end function Outfitter:FindTooltipLine(pTooltip, pText, pPlain) local vTooltipName = pTooltip:GetName() for vLineIndex = 1, 100 do local vLeftTextFrame = _G[vTooltipName.."TextLeft"..vLineIndex] if not vLeftTextFrame then break end local vLeftText = vLeftTextFrame:GetText() if vLeftText and vLeftText:find(pText, nil, pPlain) then return vLineIndex, vLeftTextFrame end end -- for vLineIndex end function Outfitter:CanEquipBagItem(pBagIndex, pBagSlotIndex) local vItemInvType = self:GetBagItemInvType(pBagIndex, pBagSlotIndex) -- Disabling minLevel check because new drops pre WoD are showing as minLevel 100 despite only requiring 90 return Outfitter.cInvTypeToSlotName[vItemInvType] ~= nil -- and (not vItemMinLevel or UnitLevel("player") >= vItemMinLevel) end function Outfitter:ArrayIsEmpty(pArray) if not pArray then return true end return next(pArray) == nil end function Outfitter:GetScreenQuadrantFromCoordinates(x, y) local vertEdge, horizEdge = self:GetNearestFrameEdgesFromCoordinates(UIParent, x, y) return vertEdge..horizEdge end function Outfitter:GetNearestFrameEdgesFromCoordinates(frame, x, y) local horizCenter = 0.5 * (frame:GetLeft() + frame:GetRight()) local vertCenter = 0.5 * (frame:GetTop() + frame:GetBottom()) local isTop = y > vertCenter local isLeft = x < horizCenter return isTop and "TOP" or "BOTTOM", isLeft and "LEFT" or "RIGHT", isTop and "BOTTOM" or "TOP", isLeft and "RIGHT" or "LEFT" end ---------------------------------------- Outfitter._NameOutfitDialog = {} ---------------------------------------- function Outfitter._NameOutfitDialog:New(pParent) return Outfitter:New(Outfitter.UIElementsLib._ModalDialogFrame, pParent, Outfitter._cNewOutfit, 315, 207) end function Outfitter._NameOutfitDialog:Construct(pParent) self:Hide() --self:SetTopLevel(true) self:SetFrameStrata("DIALOG") self:EnableMouse(true) -- Controls self.InfoSection = Outfitter:New(Outfitter.UIElementsLib._Section, self, Outfitter.cInfo) self.BuildSection = Outfitter:New(Outfitter.UIElementsLib._Section, self, Outfitter.cBuild) self.StatsSection = Outfitter:New(Outfitter.UIElementsLib._Section, self, Outfitter.cStats) self.Name = Outfitter:New(Outfitter.UIElementsLib._EditBox, self.InfoSection, Outfitter.cNameLabel, 40, 170) self.ScriptMenu = Outfitter:New(Outfitter.UIElementsLib._TitledDropDownMenuButton, self.InfoSection, function (menu, ...) self:ScriptMenuFunc(menu, ...) end) self.ScriptMenu:SetTitle(Outfitter.cAutomationLabel) self.EmptyOutfitCheckButton = Outfitter:New(Outfitter.UIElementsLib._CheckButton, self.BuildSection, Outfitter.cUseEmptyOutfit, true) self.ExistingOutfitCheckButton = Outfitter:New(Outfitter.UIElementsLib._CheckButton, self.BuildSection, Outfitter.cUseCurrentOutfit, true) self.GenerateOutfitCheckButton = Outfitter:New(Outfitter.UIElementsLib._CheckButton, self.BuildSection, Outfitter.cCreateUsingTitle, true) self.MultiStatConfig = Outfitter:New(Outfitter._MultiStatConfig, self.StatsSection) self.Error = self:CreateFontString(nil, "ARTWORK", "GameFontRed") -- Layout self:SetPoint("TOPLEFT", OutfitterFrame, "TOPLEFT", 20, -40) -- Info section self.InfoSection:SetPoint("TOPLEFT", self, "TOPLEFT", 20, -25) self.InfoSection:SetWidth(295) self.InfoSection:SetHeight(100) self.Name:SetPoint("TOPLEFT", self.InfoSection, "TOPLEFT", 100, -20) self.ScriptMenu:SetPoint("TOPLEFT", self.Name, "TOPLEFT", 0, -35) self.ScriptMenu:SetWidth(170) -- Build section self.BuildSection:SetPoint("TOPLEFT", self.InfoSection, "TOPRIGHT", 10, 0) self.BuildSection:SetPoint("BOTTOM", self.InfoSection, "BOTTOM") self.BuildSection:SetPoint("RIGHT", self, "RIGHT", -20, 0) self.EmptyOutfitCheckButton:SetPoint("TOPLEFT", self.BuildSection, "TOPLEFT", 30, -23) self.ExistingOutfitCheckButton:SetPoint("TOPLEFT", self.EmptyOutfitCheckButton, "TOPLEFT", 0, -25) self.GenerateOutfitCheckButton:SetPoint("TOPLEFT", self.ExistingOutfitCheckButton, "TOPLEFT", 0, -25) -- Stats section self.StatsSection:SetPoint("TOPLEFT", self.InfoSection, "BOTTOMLEFT", 0, -10) self.StatsSection:SetPoint("RIGHT", self.BuildSection, "RIGHT", 0, 0) self.MultiStatConfig:SetPoint("TOPLEFT", self.StatsSection, "TOPLEFT", 25, -15) -- Error message self.Error:Hide() self.Error:SetWidth(280) self.Error:SetPoint("RIGHT", self.DoneButton, "LEFT", -30, 0) -- Events self:SetScript("OnShow", function (self) Outfitter.UIElementsLib:BeginDialog(self) end) self:SetScript("OnHide", function (self) Outfitter.UIElementsLib:EndDialog(self) end) self.Name:SetScript("OnEnterPressed", function () self:Done() end) self.Name:SetScript("OnTextChanged", function () self:Update() end) self.ScriptMenu.ItemClickedFunc = function (pMenu, pValue) self:PresetScriptChanged(pMenu, pValue) end self.EmptyOutfitCheckButton:SetScript("OnClick", function (pCheckButton) self.EmptyOutfitCheckButton:SetChecked(true) self.ExistingOutfitCheckButton:SetChecked(false) self.GenerateOutfitCheckButton:SetChecked(false) self.MultiStatConfig:Hide() self:AdjustSize() end) self.ExistingOutfitCheckButton:SetScript("OnClick", function (pCheckButton) self.EmptyOutfitCheckButton:SetChecked(false) self.ExistingOutfitCheckButton:SetChecked(true) self.GenerateOutfitCheckButton:SetChecked(false) self.MultiStatConfig:Hide() self:AdjustSize() end) self.GenerateOutfitCheckButton:SetScript("OnClick", function (pCheckButton) self.EmptyOutfitCheckButton:SetChecked(false) self.ExistingOutfitCheckButton:SetChecked(false) self.GenerateOutfitCheckButton:SetChecked(true) self.MultiStatConfig:Show() self:AdjustSize() end) self.MultiStatConfig.OnNumLinesChanged = function (pMultiStatConfig, pNumLines) self:AdjustSize() end self.MultiStatConfig.OnChange = function () self:Update(true) end end function Outfitter._NameOutfitDialog:Open(pOutfit) self.OutfitToRename = pOutfit if self.OutfitToRename then self.Title:SetText(Outfitter.cRenameOutfit) self.Name:SetText(self.OutfitToRename.Name) else self.Title:SetText(Outfitter.cNewOutfit) self.Name:SetText("") self.ScriptMenu:SetCurrentValueText(Outfitter.cNone) self.EmptyOutfitCheckButton:SetChecked(false) self.ExistingOutfitCheckButton:SetChecked(true) self.GenerateOutfitCheckButton:SetChecked(false) self.MultiStatConfig:SetConfig(nil) self.MultiStatConfig:Hide() end self:AdjustSize() self:Show() self.Name:SetFocus() end function Outfitter._NameOutfitDialog:AdjustSize() local vHeight = 78 local vWidth = 335 if not self.OutfitToRename then self.ScriptMenu:Show() self.InfoSection:SetHeight(100) vHeight = vHeight + 100 vWidth = vWidth + 200 if self.MultiStatConfig:IsShown() then local vStatConfigHeight = self.MultiStatConfig:GetHeight() vHeight = vHeight + vStatConfigHeight + 33 local vStatWidth = 20 + self.MultiStatConfig:GetWidth() + 20 if vStatWidth > vWidth then vWidth = vStatWidth end self.StatsSection:SetHeight(vStatConfigHeight + 25) self.StatsSection:Show() else self.StatsSection:Hide() end self.BuildSection:Show() else self.ScriptMenu:Hide() self.InfoSection:SetHeight(65) vHeight = vHeight + 65 self.BuildSection:Hide() self.StatsSection:Hide() end self:SetWidth(vWidth) self:SetHeight(vHeight) end function Outfitter._NameOutfitDialog:ScriptMenuFunc(menu) local category menu:AddToggle(Outfitter.cNoScript, function () return self.ScriptID end, function (menu, value) self:PresetScriptChanged(menu, "NONE") end) for _, presetScript in ipairs(Outfitter.PresetScripts) do if not presetScript.Class or presetScript.Class == Outfitter.PlayerClass then local newCategory = presetScript.Category or presetScript.Class or "GENERAL" if category ~= newCategory then category = newCategory Outfitter:AddScriptCategorySubmenu(menu, category, function () return self.ScriptID end, function (menu, value) self:PresetScriptChanged(menu, value) end) end end end end function Outfitter._NameOutfitDialog:Done() local vName = self.Name:GetText() if vName and vName ~= "" then if self.OutfitToRename then local vWearingOutfit = Outfitter:WearingOutfit(self.OutfitToRename) local vPreviousName = self.OutfitToRename.Name Outfitter:DispatchOutfitEvent("WILL_RENAME_OUTFIT", self.OutfitToRename, vPreviousName, vName) if vWearingOutfit then Outfitter:DispatchOutfitEvent("UNWEAR_OUTFIT", self.OutfitToRename.Name, self.OutfitToRename) end self.OutfitToRename:SetName(vName) Outfitter.DisplayIsDirty = true if vWearingOutfit then Outfitter:DispatchOutfitEvent("WEAR_OUTFIT", self.OutfitToRename.Name, self.OutfitToRename) end Outfitter:DispatchOutfitEvent("DID_RENAME_OUTFIT", self.OutfitToRename, vPreviousName, vName) else -- Create the new outift local vScriptID = self.ScriptID local vOutfit if self.EmptyOutfitCheckButton:GetChecked() then vOutfit = Outfitter:NewEmptyOutfit(vName) elseif self.ExistingOutfitCheckButton:GetChecked() then vOutfit = Outfitter:GetInventoryOutfit(vName) else local vStatConfig = self.MultiStatConfig:GetConfig() vOutfit = Outfitter:GenerateSmartOutfit(vName, vStatConfig, Outfitter:GetInventoryCache(), true, function (pOutfit) if pOutfit and not pOutfit:IsEmpty() then pOutfit.StatConfig = vStatConfig self:AddOutfit(pOutfit, vScriptID) else Outfitter:ErrorMessage(Outfitter.cNoItemsWithStat); end end) self:Hide() return end if not vOutfit then vOutfit = Outfitter:NewEmptyOutfit(vName) end self:AddOutfit(vOutfit, vScriptID) end end self:Hide() end function Outfitter._NameOutfitDialog:PresetScriptChanged(menu, scriptID) -- Change the ID to nil if it's NONE if scriptID == "NONE" then scriptID = nil end -- Save the ID self.ScriptID = scriptID -- Get the script local script if scriptID then script = Outfitter:GetPresetScriptByID(scriptID) end -- Update the menu self.ScriptMenu:SetCurrentValueText(script and script.Name or "None") -- Set the default name if there isn't one or it's the previous default local name = self.Name:GetText() if scriptID and (not name or name == "" or name == self.PreviousDefaultName) then name = script.Name self.Name:SetText(name) self.PreviousDefaultName = name end end function Outfitter._NameOutfitDialog:CheckForStatOutfit(pMenu, pValue) self:Update(true) end function Outfitter._NameOutfitDialog:Cancel() self:Hide() end function Outfitter._NameOutfitDialog:Update(pCheckForStatOutfit) local vEnableDoneButton = true local vErrorMessage -- If there's no name entered then disable the okay button local vName = self.Name:GetText() if not vName or vName == "" then vEnableDoneButton = false else local vOutfit = Outfitter:FindOutfitByName(vName) if vOutfit and vOutfit ~= self.OutfitToRename then vErrorMessage = Outfitter.cNameAlreadyUsedError vEnableDoneButton = false end end -- if not vErrorMessage and pCheckForStatOutfit and self.GenerateOutfitCheckButton:GetChecked() then local vStat = self.MultiStatConfig:GetConfig() if vStat and not vStat.Complex then -- Don't attempt to test for iterative outfits vOutfit = Outfitter:GenerateSmartOutfit("temp outfit", vStat, Outfitter:GetInventoryCache()) if not vOutfit or vOutfit:IsEmpty() then vErrorMessage = Outfitter.cNoItemsWithStatError end end end if vErrorMessage then self.Error:SetText(vErrorMessage) self.Error:Show() else self.Error:Hide() end self.DoneButton:SetEnabled(vEnableDoneButton) self:AdjustSize() end function Outfitter._NameOutfitDialog:AddOutfit(pOutfit, pScriptID) -- Add the outfit local vCategoryID = Outfitter:AddOutfit(pOutfit) -- Set the script if pScriptID and pScriptID ~= "NONE" then Outfitter:SetScriptID(pOutfit, pScriptID) end -- Wear the outfit Outfitter:WearOutfit(pOutfit) Outfitter:Update(true) end ---------------------------------------- Outfitter._RebuildOutfitDialog = {} ---------------------------------------- function Outfitter._RebuildOutfitDialog:New(pParent) return Outfitter:New(Outfitter.UIElementsLib._ModalDialogFrame, pParent, Outfitter.cRebuild, 315, 207) end function Outfitter._RebuildOutfitDialog:Construct(pParent) self:Hide() --self:SetTopLevel(true) self:SetFrameStrata("DIALOG") self:EnableMouse(true) -- Controls self.StatsSection = Outfitter:New(Outfitter.UIElementsLib._Section, self, Outfitter.cStats) self.MultiStatConfig = Outfitter:New(Outfitter._MultiStatConfig, self.StatsSection) -- Layout self:SetPoint("TOPLEFT", OutfitterFrame, "TOPLEFT", 20, -40) -- Stats section self.StatsSection:SetPoint("TOPLEFT", self, "TOPLEFT", 20, -25) self.StatsSection:SetPoint("RIGHT", self, "RIGHT", -20, 0) self.MultiStatConfig:SetPoint("TOPLEFT", self.StatsSection, "TOPLEFT", 25, -15) -- Events self:SetScript("OnShow", function (self) Outfitter.UIElementsLib:BeginDialog(self) end) self:SetScript("OnHide", function (self) Outfitter.UIElementsLib:EndDialog(self) end) self.MultiStatConfig.OnNumLinesChanged = function (pMultiStatConfig, pNumLines) self:AdjustSize() end end function Outfitter._RebuildOutfitDialog:Open(pOutfit) self.Outfit = pOutfit if self.Outfit.StatID and not self.Outfit.StatConfig then self.Outfit.StatConfig = {{StatID = self.Outfit.StatID}} end self.MultiStatConfig:SetConfig(self.Outfit.StatConfig) self:AdjustSize() self:Show() end function Outfitter._RebuildOutfitDialog:AdjustSize() local vStatConfigHeight = self.MultiStatConfig:GetHeight() local vHeight = 51 + vStatConfigHeight + 48 local vWidth = 40 + self.MultiStatConfig:GetWidth() + 40 self.StatsSection:SetHeight(vStatConfigHeight + 25) self:SetWidth(vWidth) self:SetHeight(vHeight) end function Outfitter._RebuildOutfitDialog:Done() self.Outfit.StatConfig = self.MultiStatConfig:GetConfig() self:Hide() Outfitter:RebuildOutfit(self.Outfit) end function Outfitter._RebuildOutfitDialog:Cancel() self:Hide() end function Outfitter._RebuildOutfitDialog:Update(pCheckForStatOutfit) local vEnableDoneButton = true local vErrorMessage -- If there's no name entered then disable the okay button local vName = self.Name:GetText() if not vName or vName == "" then vEnableDoneButton = false else local vOutfit = Outfitter:FindOutfitByName(vName) if vOutfit and vOutfit ~= self.OutfitToRename then vErrorMessage = Outfitter.cNameAlreadyUsedError vEnableDoneButton = false end end -- if not vErrorMessage and pCheckForStatOutfit and self.GenerateOutfitCheckButton:GetChecked() then local vStat = self.MultiStatConfig:GetConfig() if vStat and not vStat.Complex then -- Don't attempt to test for iterative outfits vOutfit = Outfitter:GenerateSmartOutfit("temp outfit", vStat, Outfitter:GetInventoryCache()) if not vOutfit or vOutfit:IsEmpty() then vErrorMessage = Outfitter.cNoItemsWithStatError end end end if vErrorMessage then self.Error:SetText(vErrorMessage) self.Error:Show() else self.Error:Hide() end self.DoneButton:SetEnabled(vEnableDoneButton) self:AdjustSize() end ---------------------------------------- -- ---------------------------------------- function Outfitter:SetButtonEnable(pButton, pEnabled) if pEnabled then pButton:Enable() pButton:SetAlpha(1.0) pButton:EnableMouse(true) --_G[pButton:GetName().."Text"]:SetAlpha(1.0) else pButton:Disable() pButton:SetAlpha(0.7) pButton:EnableMouse(false) --_G[pButton:GetName().."Text"]:SetAlpha(0.7) end end function Outfitter:GetIndexedOutfit(categoryID, index) -- Ensure settings are in place if not self.Settings or not self.Settings.Outfits then return end -- Get the outfits for the category local outfits = self.Settings.Outfits[categoryID] if not outfits then return end -- Get the indexed outfit local outfit = outfits[index] if not outfit then return end -- Done return outfit end function Outfitter:GetOutfitFromDropdown(pDropdown) return pDropdown:GetParent():GetParent():GetOutfit() end Outfitter.OutfitMenuActions = {} function Outfitter.OutfitMenuActions:DELETE(pOutfit) self:AskDeleteOutfit(pOutfit) end function Outfitter.OutfitMenuActions:RENAME(pOutfit) Outfitter:OpenNameOutfitDialog(pOutfit) end function Outfitter.OutfitMenuActions:SCRIPT_SETTINGS(pOutfit) OutfitterEditScriptDialog:Open(pOutfit) end function Outfitter.OutfitMenuActions:EDIT_SCRIPT(pOutfit) if pOutfit.ScriptID == nil and pOutfit.Script == nil then pOutfit.Script = pOutfit.SavedScript pOutfit.SavedScript = nil end OutfitterEditScriptDialog:Open(pOutfit, true) end function Outfitter.OutfitMenuActions:DISABLE(pOutfit) self:SetScriptEnabled(pOutfit, pOutfit.Disabled) end function Outfitter:SetScriptEnabled(pOutfit, pEnable) if (not pEnable) == (pOutfit.Disabled or false) then return end pOutfit.Disabled = not pEnable if pOutfit.Disabled then self:DeactivateScript(pOutfit) else self:ActivateScript(pOutfit) end self:OutfitSettingsChanged(pOutfit) end function Outfitter.OutfitMenuActions:IGNORETITLE(pOutfit) pOutfit.ShowTitleID = nil self.OutfitStack:UpdateOutfitDisplay() self:OutfitSettingsChanged(pOutfit) end function Outfitter.OutfitMenuActions:COMBATDISABLE(pOutfit) if pOutfit.CombatDisabled then pOutfit.CombatDisabled = nil else pOutfit.CombatDisabled = true end self:OutfitSettingsChanged(pOutfit) end function Outfitter.OutfitMenuActions:REBUILD(pOutfit) self:AskRebuildOutfit(pOutfit) end function Outfitter.OutfitMenuActions:REBUILD_FOR(pOutfit) Outfitter:OpenRebuildOutfitDialog(pOutfit) end function Outfitter.OutfitMenuActions:SET_CURRENT(pOutfit) self:AskSetCurrent(pOutfit) end function Outfitter.OutfitMenuActions:UNEQUIP_OTHERS(pOutfit) if pOutfit.UnequipOthers then pOutfit.UnequipOthers = nil else pOutfit.UnequipOthers = true end self:OutfitSettingsChanged(pOutfit) end function Outfitter.OutfitMenuActions:IGNORE_COMPARISONS(pOutfit) if pOutfit.IgnoreComparisons then pOutfit.IgnoreComparisons = nil else pOutfit.IgnoreComparisons = true end self:OutfitSettingsChanged(pOutfit) end function Outfitter.OutfitMenuActions:DEPOSIT(pOutfit) self:DepositOutfit(pOutfit) end function Outfitter.OutfitMenuActions:DEPOSITUNIQUE(pOutfit) self:DepositOutfit(pOutfit, true) end function Outfitter.OutfitMenuActions:WITHDRAW(pOutfit) self:WithdrawOutfit(pOutfit) end function Outfitter.OutfitMenuActions:DEPOSITOTHERS(pOutfit) self:DepositOtherOutfits(pOutfit) end function Outfitter.OutfitMenuActions:WITHDRAWOTHERS(pOutfit) self:WithdrawOtherOutfits(pOutfit) end function Outfitter.OutfitMenuActions:DEPOSITVOID(pOutfit) self:DepositOutfitToVoidStorage(pOutfit) end function Outfitter.OutfitMenuActions:DEPOSITUNIQUEVOID(pOutfit) self:DepositOutfitToVoidStorage(pOutfit, true) end function Outfitter.OutfitMenuActions:WITHDRAWVOID(pOutfit) self:WithdrawOutfitFromVoidStorage(pOutfit) end function Outfitter.OutfitMenuActions:OUTFITBAR_SHOW(pOutfit) local vSettings = self.OutfitBar:GetOutfitSettings(pOutfit) vSettings.Hide = not vSettings.Hide self:OutfitSettingsChanged(pOutfit) end function Outfitter.OutfitMenuActions:OUTFITBAR_CHOOSEICON(pOutfit) OutfitterChooseIconDialog:Open(pOutfit) end function Outfitter:PerformAction(pActionID, pOutfit) local vActionFunc = Outfitter.OutfitMenuActions[pActionID] if vActionFunc then vActionFunc(self, pOutfit) elseif string.sub(pActionID, 1, 8) == "BINDING_" then local vBindingIndex = string.sub(pActionID, 9) if vBindingIndex == "NONE" then Outfitter:SetOutfitBindingIndex(pOutfit, nil) else Outfitter:SetOutfitBindingIndex(pOutfit, tonumber(vBindingIndex)) end elseif string.sub(pActionID, 1, 7) == "PRESET_" then local vScriptID = string.sub(pActionID, 8) if vScriptID == "NONE" then Outfitter:DeactivateScript(pOutfit) pOutfit.SavedScript = pOutfit.Script pOutfit.ScriptID = nil pOutfit.Script = nil else pOutfit.SavedScript = nil Outfitter:SetScriptID(pOutfit, vScriptID) -- If the script has settings then open the -- dialog if Outfitter:OutfitHasSettings(pOutfit) then OutfitterEditScriptDialog:Open(pOutfit) end end Outfitter:OutfitSettingsChanged(pOutfit) elseif string.sub(pActionID, 1, 6) == "TITLE_" then local vTitleID = tonumber(string.sub(pActionID, 7)) pOutfit.ShowTitleID = vTitleID self.SchedulerLib:ScheduleUniqueTask(0.5, self.OutfitStack.UpdateOutfitDisplay, self.OutfitStack) elseif string.sub(pActionID, 1, 13) == "REBUILD_STAT_" then local vStatID = string.sub(pActionID, 14) pOutfit.StatID = vStatID Outfitter:AskRebuildOutfit(pOutfit) else return end Outfitter:Update(true) end function Outfitter.OutfitItemSelected(dropdown, item) local outfit = Outfitter:GetOutfitFromDropdown(dropdown) if not outfit then Outfitter:ErrorMessage("Outfit for menu item "..tostring(pItem.name).." not found") return end local value = item if type(value) ~= "string" then value = item.option.value if not value and item[1] then value = item.option.args[item[1]] end end Outfitter:PerformAction(value, outfit) end ---------------------------------------- -- ---------------------------------------- function Outfitter.ScrollbarTrench_SizeChanged(pScrollbarTrench) local vScrollbarTrenchName = pScrollbarTrench:GetName() local vScrollbarTrenchMiddle = _G[vScrollbarTrenchName.."Middle"] local vMiddleHeight= pScrollbarTrench:GetHeight() - 51 vScrollbarTrenchMiddle:SetHeight(vMiddleHeight) end function Outfitter.InputBox_OnLoad(self, pChildDepth) if not pChildDepth then pChildDepth = 0 end local vParent = self:GetParent() for vDepthIndex = 1, pChildDepth do vParent = vParent:GetParent() end if vParent.lastEditBox then self.prevEditBox = vParent.lastEditBox self.nextEditBox = vParent.lastEditBox.nextEditBox self.prevEditBox.nextEditBox = self self.nextEditBox.prevEditBox = self else self.prevEditBox = self self.nextEditBox = self end vParent.lastEditBox = self end function Outfitter.InputBox_TabPressed(self) local vReverse = IsShiftKeyDown() local vEditBox = self for vIndex = 1, 50 do local vNextEditBox if vReverse then vNextEditBox = vEditBox.prevEditBox else vNextEditBox = vEditBox.nextEditBox end if vNextEditBox:IsVisible() and not vNextEditBox.isDisabled then vNextEditBox:SetFocus() return end vEditBox = vNextEditBox end end function Outfitter:ToggleUI(pToggleCharWindow) if self:IsOpen() then OutfitterFrame:Hide() if pToggleCharWindow then HideUIPanel(CharacterFrame) end else self:OpenUI() end end function Outfitter:OpenUI() ShowUIPanel(CharacterFrame) CharacterFrame_ShowSubFrame("PaperDollFrame") OutfitterFrame:Show() end function Outfitter:WearingOutfitName(pOutfitName) local vOutfit = Outfitter:FindOutfitByName(pOutfitName) return vOutfit and Outfitter:WearingOutfit(vOutfit) end function Outfitter:WearingOutfit(pOutfit) return Outfitter.OutfitStack:FindOutfit(pOutfit) end function Outfitter:CheckDatabase() -- Just reset if they're running a really old version if self.Settings.Version < 18 then self:Reset() end -- Remove ranged slot (WoW patch 5) if self.Settings.Version < 19 then if self.Settings.Outfits then for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vIndex, vOutfit in ipairs(vOutfits) do if vOutfit.Items then vOutfit.Items.RangedSlot = nil end end end end self.Settings.Version = 19 end --[[ Added ID11,12 and 13 for WoW patch 6 if self.Settings.Version < 20 then if self.Settings.Outfits then for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vIndex, vOutfit in ipairs(vOutfits) do for _, vItem in pairs(vOutfit.Items) do vItem.ID11 = 0 vItem.ID12 = 0 vItem.ID13 = 0 end end end end self.Settings.Version = 20 end ]]-- superseded below -- Added InstanceDifficultyID, BonusIDs for WoW patch 6 -- Added UpgradeTypeID, UpgradeID for WoW patch 6.2 if self.Settings.Version < 21 then if self.Settings.Outfits then for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vIndex, vOutfit in ipairs(vOutfits) do for _, vItem in pairs(vOutfit.Items) do vItem.UpgradeTypeID = 0 vItem.InstanceDifficultyID = 0 vItem.BonusIDs = "0" vItem.UpgradeID = 0 vItem.ReforgeID = nil vItem.ID11 = nil vItem.ID12 = nil vItem.ID13 = nil end end end end self.Settings.Version = 21 end -- Normalized BonusIDs if self.Settings.Version < 22 then if self.Settings.Outfits then for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vIndex, vOutfit in ipairs(vOutfits) do for _, vItem in pairs(vOutfit.Items) do if not vItem.BonusIDs or vItem.BonusIDs == "0" or vItem.BonusIDs == "0:0:0" then vItem.BonusIDs = "::" end end end end end self.Settings.Version = 22 end -- Repair missing settings if not self.Settings.RecentCompleteOutfits then self.Settings.RecentCompleteOutfits = {} end if not self.Settings.LayerIndex then self.Settings.LayerIndex = {} end if not self.Settings.LastOutfitStack then self.Settings.LastOutfitStack = {} end if not self.Settings.RecentCompleteOutfits then self.Settings.RecentCompleteOutfits = {} end if not self.Settings.OutfitBar then self.Settings.OutfitBar = {} self.Settings.OutfitBar.ShowOutfitBar = true end -- Scan the outfits and make sure everything is in order for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vIndex, vOutfit in ipairs(vOutfits) do vOutfit:CheckOutfit(vCategoryID) end end end function Outfitter:CheckOutfitCategories() local vAllOutfits = {} for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for _, vOutfit in ipairs(vOutfits) do table.insert(vAllOutfits, vOutfit) end end for _, vOutfit in ipairs(vAllOutfits) do self:OutfitSettingsChanged(vOutfit) end end function Outfitter:UpdateInvTypes() local vInventoryCache = self:GetInventoryCache() local vResult = true for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vIndex, vOutfit in ipairs(vOutfits) do if not vOutfit:UpdateInvTypes(vInventoryCache) then vResult = false end end end return vResult end function Outfitter:UpdateSubTypes() local vInventoryCache = self:GetInventoryCache() local vResult = true for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vIndex, vOutfit in ipairs(vOutfits) do if not vOutfit:UpdateSubTypes(vInventoryCache) then vResult = false end end end return vResult end function Outfitter:UpdateDatabaseItemCodes() local vInventoryCache = self:GetInventoryCache() local vResult = true for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vIndex, vOutfit in ipairs(vOutfits) do if not vOutfit:UpdateDatabaseItemCodes(vInventoryCache) then vResult = false end end end return vResult end function Outfitter:GetPlayerStat(pStatIndex) local _, vEffectiveValue, vPosValue, vNegValue = UnitStat("player", pStatIndex) return vEffectiveValue - vPosValue - vNegValue, vPosValue + vNegValue end function Outfitter:GetDepositList(pOutfit, pUniqueItemsOnly) -- Deselect any outfits to avoid them from being updated when -- items get put away self:ClearSelection() -- Build a list of items for the outfit local vInventoryCache = self:GetInventoryCache() vInventoryCache:ResetIgnoreItemFlags() -- Make a copy of the outfit local vUnequipOutfit = self:NewEmptyOutfit() local vItems = pOutfit:GetItems() for vInventorySlot, vItem in pairs(vItems) do vUnequipOutfit:SetItem(vInventorySlot, vItem) end -- Subtract out items from other outfits if unique is specified if pUniqueItemsOnly then for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vOutfitIndex, vOutfit in ipairs(vOutfits) do if vOutfit ~= pOutfit then local vMissingItems, vBankedItems = vInventoryCache:GetMissingItems(vOutfit) -- Only subtract out items from outfits which aren't themselves partialy banked if vBankedItems == nil then self:SubtractOutfit(vUnequipOutfit, vOutfit, true) end end -- if vOutfit end -- for vOutfitIndex end -- for vCategoryID end -- if pUniqueItemsOnly return vUnequipOutfit, vInventoryCache end function Outfitter:DepositOutfit(pOutfit, pUniqueItemsOnly) local vUnequipOutfit, vInventoryCache = self:GetDepositList(pOutfit, pUniqueItemsOnly) -- Build the change list vInventoryCache:ResetIgnoreItemFlags() local vEquipmentChangeList = Outfitter:New(Outfitter._EquipmentChanges) vEquipmentChangeList:addUnequipChangesForOutfit(vUnequipOutfit, vInventoryCache) -- Eliminate items which are already banked local vChangeIndex = 1 local vNumChanges = #vEquipmentChangeList while vChangeIndex <= vNumChanges do vEquipmentChange = vEquipmentChangeList[vChangeIndex] if self:IsBankBagIndex(vEquipmentChange.FromLocation.BagIndex) then table.remove(vEquipmentChangeList, vChangeIndex) vNumChanges = vNumChanges - 1 else vChangeIndex = vChangeIndex + 1 end end -- Get the list of empty bank slots local vEmptyBankSlots = self:GetEmptyBankSlotList() -- Execute the changes vEquipmentChangeList:execute(vEmptyBankSlots, vExpectedInventoryCache) self:DispatchOutfitEvent("EDIT_OUTFIT", pOutfit:GetName(), pOutfit) end function Outfitter:DepositOtherOutfits(pOutfit) -- Deselect any outfits to avoid them from being updated when -- items get put away self:ClearSelection() -- Get a list of equippable items local vInventoryCache = self:GetInventoryCache() vInventoryCache:ResetIgnoreItemFlags() -- Mark all items in the current outfit so they won't be deposited local vItems = pOutfit:GetItems() for vInventorySlot, vOutfitItem in pairs(vItems) do local vItem, vIgnoredItem = vInventoryCache:FindItemOrAlt(vOutfitItem, true) -- Nothing more to do, the find command marks the item end -- for -- Build a list of items in all outfits local vEquipmentChangeList = {} for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vOutfitIndex, vOutfit in ipairs(vOutfits) do if vOutfit ~= pOutfit then local vItems = vOutfit:GetItems() for vInventorySlot, vOutfitItem in pairs(vItems) do local vItem, vIgnoredItem = vInventoryCache:FindItemOrAlt(vOutfitItem, true) if vItem and not self:IsBankBagIndex(vItem.Location.BagIndex) then vEquipmentChangeList:addChange({FromLocation = vItem.Location, Item = vItem, ToLocation = nil}) end end -- for end -- if vOutfit end -- for vOutfitIndex end -- for vCategoryID if #vEquipmentChangeList == 0 then return end -- Get the list of empty bank slots local vEmptyBankSlots = self:GetEmptyBankSlotList() -- Execute the changes vEquipmentChangeList:execute(vEmptyBankSlots, vExpectedInventoryCache) self:DispatchOutfitEvent("EDIT_OUTFIT", pOutfit:GetName(), pOutfit) end function Outfitter:WithdrawOutfit(pOutfit) local vInventoryCache = self:GetInventoryCache() -- Build a list of items for the outfit vInventoryCache:ResetIgnoreItemFlags() local vEquipmentChangeList = Outfitter:New(Outfitter._EquipmentChanges) vEquipmentChangeList:addUnequipChangesForOutfit(pOutfit, vInventoryCache) if not vEquipmentChangeList then return end -- Eliminate items which aren't in the bank local vChangeIndex = 1 local vNumChanges = #vEquipmentChangeList while vChangeIndex <= vNumChanges do vEquipmentChange = vEquipmentChangeList[vChangeIndex] if not self:IsBankBagIndex(vEquipmentChange.FromLocation.BagIndex) then table.remove(vEquipmentChangeList, vChangeIndex) vNumChanges = vNumChanges - 1 else vChangeIndex = vChangeIndex + 1 end end -- Get the list of empty bag slots local vEmptyBagSlots = self:GetEmptyBagSlotList() -- Execute the changes vEquipmentChangeList:execute(vEmptyBagSlots, vExpectedInventoryCache) self:DispatchOutfitEvent("EDIT_OUTFIT", pOutfit:GetName(), pOutfit) end function Outfitter:WithdrawOtherOutfits(pOutfit) local vInventoryCache = self:GetInventoryCache() -- Build a list of items in all other outfits local vEquipmentChangeList = {} for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for vOutfitIndex, vOutfit in ipairs(vOutfits) do if vOutfit ~= pOutfit then local vItems = vOutfit:GetItems() for vInventorySlot, vOutfitItem in pairs(vItems) do local vItem, vIgnoredItem = vInventoryCache:FindItemOrAlt(vOutfitItem, true) if vItem and self:IsBankBagIndex(vItem.Location.BagIndex) then table.insert(vEquipmentChangeList, {FromLocation = vItem.Location, Item = vItem, ToLocation = nil}) end end -- for end -- if vOutfit end -- for vOutfitIndex end -- for vCategoryID if #vEquipmentChangeList == 0 then return end -- Get the list of empty bag slots local vEmptyBagSlots = self:GetEmptyBagSlotList() -- Execute the changes self:ExecuteEquipmentChangeList2(vEquipmentChangeList, vEmptyBagSlots, self.cWithdrawBagsFullError, vExpectedInventoryCache) self:DispatchOutfitEvent("EDIT_OUTFIT", pOutfit:GetName(), pOutfit) end local VOID_DEPOSIT_MAX = 8 function Outfitter:DepositOutfitToVoidStorage(pOutfit, pUniqueItemsOnly) local vUnequipOutfit, vInventoryCache = self:GetDepositList(pOutfit, pUniqueItemsOnly) -- Get a list of the deposit slot contents local vItemIDByDepositSlot = {} local vDepositSlotByItemID = {} for vIndex = 1, VOID_DEPOSIT_MAX do local vItemID, vTextureName = GetVoidTransferDepositInfo(vIndex) if vItemID then vItemIDByDepositSlot[vIndex] = vItemID vDepositSlotByItemID[vItemID] = vIndex end end -- Eliminate items which are already in the deposit area local vItems = vUnequipOutfit:GetItems() for vInventorySlot, vOutfitItem in pairs(vItems) do if vDepositSlotByItemID[vOutfitItem.Code] then vItems[vInventorySlot] = nil end end -- Get a list of items which are available to move vInventoryCache:ResetIgnoreItemFlags() local vEquipmentChangeList = Outfitter:New(Outfitter._EquipmentChanges) vEquipmentChangeList:addUnequipChangesForOutfit(vUnequipOutfit, vInventoryCache) -- Move the items to the deposit slots for _, vEquipmentChange in ipairs(vEquipmentChangeList) do -- Find an empty slot local vDepositIndex for vIndex = 1, VOID_DEPOSIT_MAX do if not vItemIDByDepositSlot[vIndex] then vDepositIndex = vIndex break end end -- No more slots if not vDepositIndex then Outfitter:DebugMessage("No empty void storage slots") break end -- Move the item Outfitter:DebugMessage("Moving item to deposit slot %s", tostring(vDepositIndex)) self:PickupItemLocation(vEquipmentChange.FromLocation) ClickVoidTransferDepositSlot(vDepositIndex, false) vItemIDByDepositSlot[vDepositIndex] = vEquipmentChange.Item.Code vDepositSlotByItemID[vEquipmentChange.Item.Code] = vDepositIndex end self:DispatchOutfitEvent("EDIT_OUTFIT", pOutfit:GetName(), pOutfit) end function Outfitter.GameToolTip_OnShow(...) Outfitter.EventLib:DispatchEvent("GAMETOOLTIP_SHOW") end function Outfitter.GameToolTip_OnHide(...) Outfitter.EventLib:DispatchEvent("GAMETOOLTIP_HIDE") end function Outfitter:GetOutfitsUsingItem(pItemInfo) local vFoundOutfits for vCategoryID, vOutfits in pairs(self.Settings.Outfits) do for _, vOutfit in ipairs(vOutfits) do if vOutfit:OutfitUsesItem(pItemInfo) then if not vFoundOutfits then vFoundOutfits = {} end table.insert(vFoundOutfits, vOutfit) end end end return vFoundOutfits end function Outfitter:GetOutfitsListAsText(pOutfits) if not pOutfits or #pOutfits == 0 then return end local vInventoryCache = self:GetInventoryCache() local vNames = nil for _, vOutfit in ipairs(pOutfits) do local vMissingItems, vBankedItems = vInventoryCache:GetMissingItems(vOutfit) local vName if vOutfit.Disabled then vName = GRAY_FONT_COLOR_CODE elseif vMissingItems then vName = RED_FONT_COLOR_CODE elseif vBankedItems then vName = self.BANKED_FONT_COLOR_CODE else vName = HIGHLIGHT_FONT_COLOR_CODE end vName = vName..vOutfit:GetName()..FONT_COLOR_CODE_CLOSE if vNames then vNames = vNames..", "..vName else vNames = vName end end return vNames end function Outfitter:AddOutfitsUsingItemToTooltip(pTooltip, pItemInfo) local vOutfitListString if self.OutfitInfoCache.OutfitsUsingItem and self.OutfitInfoCache.OutfitsUsingItem.Link and self.OutfitInfoCache.OutfitsUsingItem.Link == pItemInfo.Link then vOutfitListString = self.OutfitInfoCache.OutfitsUsingItem.String else local vOutfits = self:GetOutfitsUsingItem(pItemInfo) if vOutfits then vOutfitListString = self:GetOutfitsListAsText(vOutfits) end -- Update the cache if pItemInfo.Link then if not self.OutfitInfoCache.OutfitsUsingItem then self.OutfitInfoCache.OutfitsUsingItem = {} end self.OutfitInfoCache.OutfitsUsingItem.Link = pItemInfo.Link self.OutfitInfoCache.OutfitsUsingItem.String = vOutfitListString end end -- if vOutfitListString then local vEquipmentSetsPattern = Outfitter:ConvertFormatStringToSearchPattern(EQUIPMENT_SETS) local vTooltipListString = EQUIPMENT_SETS:format(vOutfitListString) local vLineIndex, vLineFrame = Outfitter:FindTooltipLine(pTooltip, vEquipmentSetsPattern) -- Found an existing EQUIPMENT_SETS line if vLineIndex then vLineFrame:SetText(vTooltipListString) -- Add a new line else pTooltip:AddLine(vTooltipListString, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true) pTooltip:Show() end end end function Outfitter.GameTooltip_SetBagItem(pTooltip, pBag, pSlot, ...) if not Outfitter.Settings.Options.DisableToolTipInfo then local vItemInfo = Outfitter:GetBagItemInfo(pBag, pSlot) if vItemInfo then Outfitter:AddOutfitsUsingItemToTooltip(pTooltip, vItemInfo) end end end function Outfitter.GameTooltip_SetInventoryItem(pTooltip, pUnit, pSlotID, pNameOnly, ...) -- Add the list of outfits the item is used by if not Outfitter.Settings.Options.DisableToolTipInfo and UnitIsUnit(pUnit, "player") then local vInventorySlot = Outfitter.cSlotIDToInventorySlot[pSlotID] local vItemInfo = Outfitter:GetSlotIDItemInfo(pSlotID) if vItemInfo then vItemInfo.Location = {SlotName = vInventorySlot} Outfitter:AddOutfitsUsingItemToTooltip(pTooltip, vItemInfo) end end end function Outfitter.GameTooltip_SetHyperlink(pTooltip, pLink, ...) -- Add the list of outfits the item is used by if not Outfitter.Settings.Options.DisableToolTipInfo then local vItemInfo = Outfitter:GetItemInfoFromLink(pLink) if vItemInfo then Outfitter:AddOutfitsUsingItemToTooltip(pTooltip, vItemInfo) end end end function Outfitter:InitializeFrameMethods(pFrame, pMethods) if pMethods then for vMethodField, vMethodFunction in pairs(pMethods) do pFrame[vMethodField] = vMethodFunction end end end function Outfitter:InitializeFrameWidgets(pFrame, pWidgets) if pWidgets then local vFrameName = pFrame:GetName() for _, vWidgetName in pairs(pWidgets) do if string.sub(vWidgetName, -1) == "*" then vWidgetName = vWidgetName:sub(1, -2) pFrame[vWidgetName] = {ParentFrame = _G[vFrameName..vWidgetName]} local vIndex = 1 while true do local vWidget = _G[vFrameName..vWidgetName..vIndex] if not vWidget then break end vWidget:SetID(vIndex) table.insert(pFrame[vWidgetName], vWidget) vIndex = vIndex + 1 end else pFrame[vWidgetName] = _G[vFrameName..vWidgetName] end end end end function Outfitter:TooltipContainsLine(pTooltip, pText) local vTooltipName = pTooltip:GetName() for vLine = 1, 30 do local vText = _G[vTooltipName.."TextLeft"..vLine] if not vText then return false end local vTextString = vText:GetText() if not vTextString then return false end if vTextString:find(pText) then local vColor = {} vColor.r, vColor.g, vColor.b = vText:GetTextColor() local vHSVColor = Outfitter:RGBToHSV(vColor) return true, vHSVColor.s > 0.2 and vHSVColor.v > 0.2 and (vHSVColor.h < 50 or vHSVColor.h > 150), pText == vTextString, vLine end end end function Outfitter:RGBToHSV(pRGBColor) local vHSVColor = {} local vBaseAngle local vHueColor if not pRGBColor.r or not pRGBColor.g or not pRGBColor.b then vHSVColor.h = 0 vHSVColor.s = 0 vHSVColor.v = 1 return vHSVColor end if pRGBColor.r >= pRGBColor.g and pRGBColor.r >= pRGBColor.b then -- Red is dominant vHSVColor.v = pRGBColor.r vBaseAngle = 0 if pRGBColor.g >= pRGBColor.b then vHSVColor.s = 1 - pRGBColor.b vHueColor = pRGBColor.g else vHSVColor.s = 1 - pRGBColor.g vHueColor = -pRGBColor.b end elseif pRGBColor.g >= pRGBColor.b then -- Green is dominant vHSVColor.v = pRGBColor.g vBaseAngle = 120 if pRGBColor.r >= pRGBColor.b then vHSVColor.s = 1 - pRGBColor.b vHueColor = -pRGBColor.r else vHSVColor.s = 1 - pRGBColor.r vHueColor = pRGBColor.b end else -- Blue is dominant vHSVColor.v = pRGBColor.b vBaseAngle = 240 if pRGBColor.r >= pRGBColor.g then vHSVColor.s = 1 - pRGBColor.g vHueColor = pRGBColor.r else vHSVColor.s = 1 - pRGBColor.r vHueColor = -pRGBColor.g end end vHSVColor.h = vBaseAngle + (vHueColor / vHSVColor.v) * 60 if vHSVColor.h < 0 then vHSVColor.h = vHSVColor.h + 360 end return vHSVColor end function Outfitter:FrameEditBox(pEditBox) local vLeftTexture = pEditBox:CreateTexture(nil, "ARTWORK") vLeftTexture:SetWidth(12) vLeftTexture:SetPoint("TOPLEFT", pEditBox, "TOPLEFT", -11, 0) vLeftTexture:SetPoint("BOTTOMLEFT", pEditBox, "BOTTOMLEFT", -11, -9) vLeftTexture:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-FilterBorder") vLeftTexture:SetTexCoord(0, 0.09375, 0, 1) local vRightTexture = pEditBox:CreateTexture(nil, "ARTWORK") vRightTexture:SetWidth(12) vRightTexture:SetPoint("TOPRIGHT", pEditBox, "TOPRIGHT", -12, 0) vRightTexture:SetPoint("BOTTOMRIGHT", pEditBox, "BOTTOMRIGHT", -12, -9) vRightTexture:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-FilterBorder") vRightTexture:SetTexCoord(0.90625, 1, 0, 1) local vMiddleTexture = pEditBox:CreateTexture(nil, "ARTWORK") vMiddleTexture:SetPoint("TOPLEFT", vLeftTexture, "TOPRIGHT") vMiddleTexture:SetPoint("BOTTOMLEFT", vLeftTexture, "BOTTOMRIGHT") vMiddleTexture:SetPoint("TOPRIGHT", vRightTexture, "TOPLEFT") vMiddleTexture:SetPoint("BOTTOMRIGHT", vRightTexture, "BOTTOMLEFT") vMiddleTexture:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-FilterBorder") vMiddleTexture:SetTexCoord(0.09375, 0.90625, 0, 1) end function Outfitter:ConstructFrame(pFrame, pMethods, ...) for vKey, vValue in pairs(pMethods) do if vKey == "Widgets" and type(vValue) == "table" then if not pFrame.Widgets then pFrame.Widgets = {} end local vNamePrefix if pFrame.GetName then vNamePrefix = pFrame:GetName() else vNamePrefix = vValue._Prefix end if vNamePrefix then for _, vName in ipairs(vValue) do local vWidget = _G[vNamePrefix..vName] if vWidget == nil then self:ErrorMessage("Couldn't find global "..vNamePrefix..vName) else pFrame.Widgets[vName] = vWidget end end else Outfitter:ErrorMessage("ConstructFrame: Can't initialize widgets for frame because there's no name prefix") Outfitter:DebugStack() end else pFrame[vKey] = vValue end end if pMethods.Construct then pFrame:Construct(...) end return pFrame end function Outfitter.InitializeFrame(pObject, ...) if not pObject then Outfitter:DebugMessage("InitializeFrame called with nil object") Outfitter:DebugStack() return end local vNumClasses = select("#", ...) for vIndex = 1, vNumClasses do local vFunctionTable = select(vIndex, ...) for vFunctionName, vFunction in pairs(vFunctionTable) do if type(vFunction) == "table" then local vTable = {} pObject[vFunctionName] = vTable local vNamePrefix if pObject.GetName then vNamePrefix = pObject:GetName() else vNamePrefix = pObject[vFunctionName.."Prefix"] end for _, vName in ipairs(vFunction) do local vValue = _G[vNamePrefix..vName] if vValue == nil then self:ErrorMessage("Couldn't find global "..vNamePrefix..vName) else vTable[vName] = vValue end end else pObject[vFunctionName] = vFunction end end end end function Outfitter:GetCurrentOutfitInfo() return self.OutfitStack:GetCurrentOutfitInfo() end function Outfitter:SetUpdateDelay(pTime, pDelay) local vUpdateTime = pTime + (pDelay - self.cMinEquipmentUpdateInterval) if vUpdateTime > self.LastEquipmentUpdateTime then self.LastEquipmentUpdateTime = vUpdateTime end end function Outfitter:CalcItemHasUseFeature(pItemLink) -- Grab a tooltip local tooltip = self.TooltipLib:SharedTooltip() tooltip:ClearLines() -- Set it to the link if not tooltip:SetHyperlink(pItemLink) then return false end -- Scan for a "Use:" line local tooltipName = tooltip:GetName() for vLineIndex = 1, 100 do local vLeftTextFrame = _G[tooltipName.."TextLeft"..vLineIndex] if not vLeftTextFrame then break end local vLeftText = vLeftTextFrame:GetText() if vLeftText then local vStartIndex, vEndIndex = vLeftText:find(Outfitter.cUseTooltipLineFormat) if vStartIndex then return true end end end -- for vLineIndex return false end function Outfitter:CalcItemUseDuration(pItemLink) -- Grab a tooltip local tooltip = self.TooltipLib:SharedTooltip() tooltip:ClearLines() -- Set it to the link tooltip:SetHyperlink(pItemLink) -- Scan for a "Use:" line local tooltipName = tooltip:GetName() for vLineIndex = 1, 100 do local vLeftTextFrame = _G[tooltipName.."TextLeft"..vLineIndex] if not vLeftTextFrame then break end local vLeftText = vLeftTextFrame:GetText() if vLeftText then local vStartIndex, vEndIndex, vSeconds = vLeftText:find(Outfitter.cUseDurationTooltipLineFormat) if not vSeconds then vStartIndex, vEndIndex, vSeconds = vLeftText:find(Outfitter.cUseDurationTooltipLineFormat2) end if vSeconds then return tonumber(vSeconds) end end end -- for vLineIndex return 0 end Outfitter.cItemHasUseFeature = {} Outfitter.cItemUseDuration = {} function Outfitter:ItemHasUseFeature(pItemLink) local vItemCode = self:ParseItemLink2(pItemLink)[1] local vHasUseFeature if self.cItemHasUseFeature[vItemCode] ~= nil then vHasUseFeature = self.cItemHasUseFeature[vItemCode] else vHasUseFeature = self:CalcItemHasUseFeature(pItemLink) self.cItemHasUseFeature[vItemCode] = vHasUseFeature end return vHasUseFeature end function Outfitter:GetItemUseDuration(pItemLink) local vItemCode = self:ParseItemLink2(pItemLink)[1] local vUseDuration if self.cItemUseDuration[vItemCode] then vUseDuration = self.cItemUseDuration[vItemCode] else vUseDuration = self:CalcItemUseDuration(pItemLink) if not vUseDuration then vUseDuration = 0 end self.cItemUseDuration[vItemCode] = vUseDuration end return vUseDuration end function Outfitter:InventoryItemIsActive(pInventorySlot) -- See if the item is on cooldown at all local vSlotID = self.cSlotIDs[pInventorySlot] local vItemLink = self:GetInventorySlotIDLink(vSlotID) local vItemCode = self:GetSlotIDLinkInfo(vSlotID)[1] local vStartTime, vDuration, vEnable = GetItemCooldown(vItemCode) if not vStartTime or vStartTime == 0 then return false end -- Determine if there's an activity period for the item local vUseDuration = self:GetItemUseDuration(vItemLink) -- If the time since started is less than the use duration the item is still active -- and shouldn't be unequipped return GetTime() < vStartTime + vUseDuration end -- Some diagnostic code for finding functions that take a long time to -- execute. This isn't installed automatically and must be manually called function Outfitter:Hook() self:HookTable(Outfitter, "Outfitter") end function Outfitter:HookTable(pTable, pPrefix) for vKey, vValue in pairs(pTable) do if type(vKey) == "string" and type(vValue) == "function" and not vKey:find("Outfitter") then pTable[vKey] = function (...) local vStartTime = GetTime() local vResult = {vValue(...)} local vEndTime = GetTime() if vEndTime - vStartTime > 0.1 then self:DebugMessage("Function %s.%s took %f seconds", pPrefix, vKey, vEndTime - vStartTime) end return unpack(vResult) end end end end function Outfitter:ShowAllLinks() for vCategory, vOutfits in pairs(self.Settings.Outfits) do for _, vOutfit in ipairs(vOutfits) do local vItems = vOutfit:GetItems() for _, vItem in pairs(vItems) do if vItem.Code ~= 0 then self:NoteMessage(self:GenerateItemLink(vItem)) end end end end end function Outfitter:GenerateItemLink(pItem) if not pItem or pItem.Code == 0 then return end local _, _, vQuality = GetItemInfo(pItem.Code) if pItem.Quality then vQuality = pItem.Quality end local _, _, _, vQualityColorCode = GetItemQualityColor(vQuality or 1) return string.format("|c%s|Hitem:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%s%s|h[%s]|h|r", vQualityColorCode, pItem.Code, pItem.EnchantCode or 0, pItem.JewelCode1 or 0, pItem.JewelCode2 or 0, pItem.JewelCode3 or 0, pItem.JewelCode4 or 0, pItem.SubCode or 0, pItem.UniqueID or 0, pItem.LinkLevel or 0, 0, pItem.UpgradeTypeID or 0, pItem.InstanceDifficultyID or 0, pItem.BonusIDs or "::", (pItem.UpgradeItemType and pItem.UpgradeItemType ~= 0) and (":"..pItem.UpgradeID) or "", pItem.Name or "unknown"), vQuality or 1 end function Outfitter:ShowMissingItems() if not Outfitter.BankFrameIsOpen then Outfitter:ErrorMessage(Outfitter.cMustBeAtBankError) return end local vInventoryCache = Outfitter:GetInventoryCache() local vFoundItems for vCategory, vOutfits in pairs(self.Settings.Outfits) do for _, vOutfit in ipairs(vOutfits) do local vMissingItems = vInventoryCache:GetMissingItems(vOutfit) if vMissingItems then for _, vItem in pairs(vMissingItems) do if not vFoundItems then Outfitter:NoteMessage(Outfitter.cMissingItemReportIntro) vFoundItems = true end Outfitter:NoteMessage(Outfitter:GenerateItemLink(vItem)) end end end end if not vFoundItems then Outfitter:NoteMessage(Outfitter.cNoMissingItems) end end function Outfitter:CallCompanionByName(pName) local vNumCompanions = GetNumCompanions("CRITTER") local vLowerName = pName:lower() for vIndex = 1, vNumCompanions do if GetCompanionInfo("CRITTER", vIndex):lower() == vLowerName then CallCompanion("CRITTER", vIndex) return end end self:ErrorMessage("CallCompanionByName: couldn't find a pet named %s", tostring(pName)) end function Outfitter:PlayerIsOnQuestID(pQuestID) local vNumQuests = GetNumQuestLogEntries() for vQuestIndex = 1, vNumQuests do local vQuestLink = GetQuestLink(vQuestIndex) if vQuestLink then local _, _, vQuestID = vQuestLink:find("|Hquest:(%d+)") if tonumber(vQuestID) == pQuestID then local _, _, vComplete = GetQuestLogLeaderBoard(1, vQuestIndex) return true, vComplete end end end return false end function Outfitter:GetTrackingEnabled(pTexture) local vNumTypes = GetNumTrackingTypes() for vIndex = 1, vNumTypes do local vName, vTexture, vActive = GetTrackingInfo(vIndex) if vTexture == pTexture then return vActive, vIndex end end end function Outfitter:SetTrackingEnabled(pTexture, pEnabled) local vActive, vIndex = self:GetTrackingEnabled(pTexture) if vActive ~= pEnabled then SetTracking(vIndex, pEnabled == true or pEnabled == 1) end end ---------------------------------------- Outfitter._ExtendedCompareTooltip = {} ---------------------------------------- function Outfitter._ExtendedCompareTooltip:Construct() hooksecurefunc("GameTooltip_ShowCompareItem", function (pShift) if not Outfitter.Settings.Options.DisableItemComparisons then self:ShowCompareItem(pShift) end end) GameTooltip:HookScript("OnHide", function () self:HideCompareItems() end) GameTooltip:HookScript("OnTooltipSetItem", function () if not IsModifiedClick("COMPAREITEMS") then self:HideCompareItems() end end) self.Tooltips = {} self.NumTooltipsShown = 0 self.MaxTooltipsShown = 5 end function Outfitter._ExtendedCompareTooltip:ShowCompareItem() self:HideCompareItems() local _, vLink = GameTooltip:GetItem() if not vLink then return end local vTooltipItemCodes, vTooltipItemName = Outfitter:ParseItemLink2(vLink) if not vTooltipItemCodes then return end local vTooltipItemFamilyName, vTooltipItemLink, vTooltipItemQuality, vTooltipItemLevel, vTooltipItemMinLevel, vTooltipItemType, vTooltipItemSubType, vTooltipItemCount, vTooltipItemInvType = GetItemInfo(vTooltipItemCodes[1]) if not vTooltipItemInvType then return end -- Figure out which direction to stack in local vLeftDist = GameTooltip:GetLeft() or 0 local vRightDist = GetScreenWidth() - (GameTooltip:GetRight() or 0) self.LeftToRight = vLeftDist < vRightDist -- Figure out which tooltip to attach to and -- append the 'used by' info on shopping tooltips self.AnchorToTooltip = nil for vIndex, vShoppingTooltip in ipairs(GameTooltip.shoppingTooltips) do local _, vShoppingLink = vShoppingTooltip:GetItem() local vShoppingItemInfo = Outfitter:GetItemInfoFromLink(vShoppingLink) if vShoppingItemInfo then Outfitter:AddOutfitsUsingItemToTooltip(vShoppingTooltip, vShoppingItemInfo) vShoppingTooltip:Show() end -- Keep the first shopping tooltip for an anchor since it's the one Blizzard positions at the end if not self.AnchorToTooltip then self.AnchorToTooltip = vShoppingTooltip end end if not self.AnchorToTooltip then self.AnchorToTooltip = GameTooltip end -- Determine which slots need to be examined local vInvSlotInfo = Outfitter.cInvTypeToSlotName[vTooltipItemInvType] if not vInvSlotInfo then return end local vInventorySlots = {} table.insert(vInventorySlots, vInvSlotInfo.SlotName) local vMetaSlotName = vInvSlotInfo.MetaSlotName or vInvSlotInfo.SlotName if vMetaSlotName == "Weapon0Slot" then table.insert(vInventorySlots, "SecondaryHandSlot") elseif vMetaSlotName == "Finger0Slot" then table.insert(vInventorySlots, "Finger1Slot") elseif vMetaSlotName == "Trinket0Slot" then table.insert(vInventorySlots, "Trinket1Slot") end -- Search outfits for items which can go in the same slot but which aren't -- listed in any of the currently shown tooltips local vShoppingItems = {} for vCategoryID, vOutfits in pairs(Outfitter.Settings.Outfits) do for vOutfitIndex, vOutfit in ipairs(vOutfits) do if not vOutfit.IgnoreComparisons then for _, vInventorySlot in ipairs(vInventorySlots) do local vItem = vOutfit:GetItem(vInventorySlot) if vItem then local vItemLink, vItemQuality = Outfitter:GenerateItemLink(vItem) if vItemLink and vItemQuality >= 2 then table.insert(vShoppingItems, {Item = vItem, OutfitName = vOutfit:GetName(), Link = vItemLink}) end end end end end end table.sort(vShoppingItems, function (pItem1, pItem2) return (pItem1.Item.Level or 0) > (pItem2.Item.Level or 0) end) for _, vItem in ipairs(vShoppingItems) do if self.NumTooltipsShown >= self.MaxTooltipsShown then break end if not self:ShoppingItemIsShown(vItem.Item) then self:AddShoppingLink(vItem.OutfitName, vItem.Item.Name, vItem.Link) end end end function Outfitter._ExtendedCompareTooltip:HideCompareItems() for _, vTooltip in ipairs(self.Tooltips) do vTooltip:ClearAllPoints() vTooltip:Hide() end self.NumTooltipsShown = 0 self.MaxTooltipsShown = 5 end function Outfitter._ExtendedCompareTooltip:ItemsAreEquivalent(pItemInfo1, pItemInfo2) if not pItemInfo1 or not pItemInfo2 then return false end return pItemInfo1.Code == pItemInfo2.Code and pItemInfo1.SubCode == pItemInfo2.SubCode and (pItemInfo1.UniqueID == pItemInfo2.UniqueID or pItemInfo1.InvType == "INVTYPE_AMMO" or pItemInfo2.InvType == "INVTYPE_AMMO") end function Outfitter._ExtendedCompareTooltip:ShoppingItemIsShown(pItemInfo) local _, vTooltipLink = GameTooltip:GetItem() local vTooltipItemInfo = Outfitter:GetItemInfoFromLink(vTooltipLink) if not vTooltipItemInfo then return false end --Outfitter:DebugMessage("ShoppingLinkIsShown: Comparing GameTooltip %s to %s", tostring(vTooltipLink):gsub("|", "||"), tostring(vLink):gsub("|", "||")) if self:ItemsAreEquivalent(pItemInfo, vTooltipItemInfo) then return true end for vIndex = 1, 100 do local vTooltip = _G["ShoppingTooltip"..vIndex] if not vTooltip then break end if not vTooltip:IsVisible() then break end local _, vTooltipLink = vTooltip:GetItem() local vTooltipItemInfo = Outfitter:GetItemInfoFromLink(vTooltipLink) --Outfitter:DebugMessage("ShoppingLinkIsShown: Comparing ShoppingTooltip%d %s to %s", vIndex, tostring(vTooltipLink):gsub("|", "||"), tostring(vLink):gsub("|", "||")) --Outfitter:DebugTable(vTooltipItemInfo, "ItemInfo") if self:ItemsAreEquivalent(pItemInfo, vTooltipItemInfo) then return true end end for vIndex, vTooltip in ipairs(self.Tooltips) do if vIndex > self.NumTooltipsShown then break end local _, vTooltipLink = vTooltip:GetItem() local vTooltipItemInfo = Outfitter:GetItemInfoFromLink(vTooltipLink) --Outfitter:DebugMessage("ShoppingLinkIsShown: Comparing OutfitterShoppingTooltip%d %s to %s", vIndex, tostring(vTooltipLink):gsub("|", "||"), tostring(vLink):gsub("|", "||")) if self:ItemsAreEquivalent(pItemInfo, vTooltipItemInfo) then return true end end return false end function Outfitter._ExtendedCompareTooltip:AddShoppingLink(pTitle, pItemName, pLink) self.NumTooltipsShown = self.NumTooltipsShown + 1 local vTooltip = self.Tooltips[self.NumTooltipsShown] if not vTooltip then vTooltip = CreateFrame("GameTooltip", "OutfitterCompareTooltip"..self.NumTooltipsShown, UIParent, "ShoppingTooltipTemplate") vTooltip:SetOwner(UIParent, "ANCHOR_NONE") vTooltip:Hide() self.Tooltips[self.NumTooltipsShown] = vTooltip else local vTooltipName = vTooltip:GetName() local vLine = 2 while true do local vTextLeft = _G[vTooltipName.."TextLeft"..vLine] if not vTextLeft then break end local vPoint, vRelativeTo, vRelativePoint, vOffsetX, vOffsetY = vTextLeft:GetPoint(1) if not vPoint then break end vTextLeft:SetPoint(vPoint, vRelativeTo, vRelativePoint, 0, vOffsetY) vLine = vLine + 1 end end local vTooltipName = vTooltip:GetName() vTooltip:SetOwner(self.AnchorToTooltip, "ANCHOR_NONE") if self.LeftToRight then vTooltip:SetPoint("TOPLEFT", self.AnchorToTooltip, "TOPRIGHT", 0, 0) else vTooltip:SetPoint("TOPRIGHT", self.AnchorToTooltip, "TOPLEFT", 0, 0) end vTooltip:SetHyperlink(pLink) -- Shift all lines down by one self:ShiftTooltipDown(vTooltip) -- Set the first line to the outfit name and Outfitter label local vTextLeft, vTextRight = _G[vTooltipName.."TextLeft1"], _G[vTooltipName.."TextRight1"] vTextLeft:SetText(pTitle) vTextLeft:SetTextColor(0.5, 0.5, 0.5) vTextRight:SetText(Outfitter.cTitle) vTextRight:SetTextColor(0.5, 0.5, 0.5) vTextRight:Show() -- Call LibTipHooker clients so they can add extra info if Outfitter.LibTipHooker.HandlerList.item then for vHandler in pairs(Outfitter.LibTipHooker.HandlerList.item) do vHandler(vTooltip, pItemName, pLink) end end -- Add "Used by:" info (should integrate this with LibTipHooker) local vItemInfo = Outfitter:GetItemInfoFromLink(pLink) if vItemInfo then Outfitter:AddOutfitsUsingItemToTooltip(vTooltip, vItemInfo) end vTooltip:Show() self.AnchorToTooltip = vTooltip end function Outfitter._ExtendedCompareTooltip:ShiftTooltipDown(tooltip) local name = tooltip:GetName() local origNumLines = tooltip:NumLines() -- Make room for the last line tooltip:AddLine("Test", NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1) -- Shift all lines down, starting from the bottom and going up for line = origNumLines, 1, -1 do local textLeft, textRight = _G[name.."TextLeft"..line], _G[name.."TextRight"..line] local nextTextLeft, nextTextRight = _G[name.."TextLeft"..(line + 1)], _G[name.."TextRight"..(line + 1)] self:CopyFontString(textLeft, nextTextLeft, line > 3) self:CopyFontString(textRight, nextTextRight, false) end -- Re-position any textures being used for line = 1, tooltip:NumLines() do local texture = _G[name.."Texture"..line] if not texture then break end if texture:IsVisible() then local point, relativeTo, relativePoint, offsetX, offsetY = texture:GetPoint(1) relativeTo = relativeTo:GetName():gsub("(%d+)$", function (index) return tonumber(index) + 1 end) texture:ClearAllPoints() texture:SetPoint(point, relativeTo, relativePoint, offsetX, offsetY) end end end function Outfitter._ExtendedCompareTooltip:CopyFontString(from, to, copyWidth) -- to:SetFont(from:GetFont()) -- to:SetJustifyH(from:GetJustifyH()) -- to:SetJustifyV(from:GetJustifyV()) -- to:SetShadowColor(from:GetShadowColor()) -- to:SetShadowOffset(from:GetShadowOffset()) -- to:SetSpacing(from:GetSpacing()) to:SetTextColor(from:GetTextColor()) to:SetText(from:GetText()) if copyWidth and from:GetWidth() then to:SetWidth(from:GetWidth()) end end function Outfitter:NewEmptyOutfit(pName) local vOutfit = { Name = pName, Items = {}, } setmetatable(vOutfit, Outfitter._OutfitMetaTable) return vOutfit end function Outfitter:GetIconIndex(pTexture) if not pTexture then return end if type(pTexture) == "number" then return pTexture end local _, _, vTexture = pTexture:find("([^\\]*)$") vTexture = vTexture:lower() for vIndex = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED do local vTexture2 = GetInventoryItemTexture("player", vIndex) if vTexture2 then _, _, vTexture2 = vTexture2:find("([^\\]*)$") if vTexture2:lower() == vTexture then return -vIndex end end end local vMacroIcons = {INV_MISC_QUESTIONMARK} GetMacroItemIcons(vMacroIcons) GetMacroIcons(vMacroIcons) local vNumIcons = #vMacroIcons for vIndex = 1, vNumIcons do local vTexture2 = vMacroIcons[vIndex] _, _, vTexture2 = vTexture2:find("([^\\]*)$") if vTexture2:lower() == vTexture then return vIndex end end end function Outfitter:GetMountIDByName(name) local lowerName = name:lower() local mountIDs = C_MountJournal.GetMountIDs() for _, mountID in ipairs(mountIDs) do local mountName = C_MountJournal.GetMountInfoByID(mountID) if mountName:lower() == lowerName then return mountID end end end function Outfitter:GetCompanionIDByName(nameToFind) local numPets = C_PetJournal.GetNumPets(false) local lowerName = nameToFind:lower() for index = 1, numPets do local petID, speciesID, isOwned, customName, level, favorite, isRevoked, name = C_PetJournal.GetPetInfoByIndex(index, false) if name:lower() == lowerName then return petID end end Outfitter:DebugMessage("GetCompanionByName(%s): Not found", tostring(nameToFind)) end function Outfitter:GetSummonedCompanionID() return C_PetJournal.GetSummonedPetGUID() end function Outfitter:SummonCompanionByGUID(pID, pDelay) Outfitter:DebugMessage("SummonCompanionByGUID: %s delay =%s", tostring(pID), tostring(pDelay)) if not pID then return end self.SummonPetID = pID self.DismissPetID = nil if pDelay then Outfitter.SchedulerLib:ScheduleTask(pDelay or 2, self.SynchronizeCompanionState, self) else self:SynchronizeCompanionState() end end function Outfitter:SummonCompanionByName(pName, pDelay) Outfitter:DebugMessage("SummonCompanionByName(%s, %s)", tostring(pName), tostring(pDelay)) local vPetID = self:GetCompanionIDByName(pName) if not vPetID then return false end self:SummonCompanionByGUID(vPetID, pDelay) return true end function Outfitter:DismissCompanionByGUID(pID, pDelay) Outfitter:DebugMessage("DismissCompanionByGUID: %s delay =%s", tostring(pID), tostring(pDelay)) if not pID then return end -- Cancel an existing summon request if possible if pID == self.SummonPetID then self.SummonPetID = nil return end -- Save the desired state self.DismissPetID = pID self.SummonPetID = nil -- Synchronize the state or schedule synchronization if desired if pDelay then Outfitter.SchedulerLib:ScheduleTask(pDelay or 2, self.SynchronizeCompanionState, self) else self:SynchronizeCompanionState() end end function Outfitter:DismissCompanionByName(pName) Outfitter:DebugMessage("DismissCompanionByName(%s)", tostring(pName)) local vPetID = self:GetCompanionIDByName(pName) if not vPetID then return false end self:DismissCompanionByGUID(vPetID) return true end function Outfitter:CanSummonOrDismissCompanion() if IsFlying() or self.InCombat or self.IsDead or self.IsFeigning or self.IsCasting or self.IsChanneling or (GetTime() - self.SummonPetByGUIDTime < 3) then return false end return true end function Outfitter:SynchronizeCompanionState() -- Just return if we're not trying to summon or dismiss a pet if not self.SummonPetID and not self.DismissPetID then Outfitter:DebugMessage("SynchronizeCompanionState: no pet ID to summon/dismiss. Canceling.") return end -- If the state can't be adjusted right now (ie, flying or channeling/casting) -- then reschedule if not self:CanSummonOrDismissCompanion() then Outfitter.SchedulerLib:ScheduleTask(1, function() self:SynchronizeCompanionState() end) return end local vSummonedPetID = C_PetJournal.GetSummonedPetGUID() Outfitter:DebugMessage("SynchronizeCompanionState: SummonedPetID = %s", tostring(vSummonedPetID)) -- If there's not a pet summoned but there's a pet to be dismissed -- then reschedule in order to watch for the pet getting auto-summoned -- by the game. For example, if you summon Ragnaros upon opening the -- cooking window, then mount up and fly off without closing the window, -- there will no longer be a pet summoned. If you then close the cooking -- window it will try to dismiss Ragnaros but won't see anything currently -- summoned (the game auto-dismissed Ragnaros when you started flying). -- We want to watch for a pet to be auto-summoned by the game and then dismiss -- it if it's the one we were trying to get rid of if self.DismissPetID then if not vSummonedPetID then Outfitter:DebugMessage("SynchronizeCompanionState: Rescheduling dismissal of %s because no pet is summoned", tostring(self.DismissPetID)) Outfitter.SchedulerLib:ScheduleTask(1, function() self:SynchronizeCompanionState() end) else if vSummonedPetID == self.DismissPetID then C_PetJournal.SummonPetByGUID(self.DismissPetID) end -- Clear the ID since the pet has now been dismissed or some other pet was summoned Outfitter:DebugMessage("Finished dismissing pet %s", tostring(self.DismissPetID)) self.DismissPetID = nil return end end if self.SummonPetID then if vSummonedPetID ~= self.SummonPetID then Outfitter:DebugMessage("SynchronizeCompanionState: Summoning %s", tostring(self.SummonPetID)) C_PetJournal.SummonPetByGUID(self.SummonPetID) end -- Clear the ID since the desired pet is the summoned pet Outfitter:DebugMessage("Finished summoning pet %s", tostring(self.SummonPetID)) self.SummonPetID = nil return end end function Outfitter:GetTalentTreeName(pIndex) --local _, vName = GetSpecializationInfo(pIndex) --return vName end function Outfitter:Run(pText) local vCommand = pText:match("^(/[^%s]+)") or "" local vMessage if vCommand ~= pText then vMessage = pText:sub(vCommand:len() + 2); else vMessage = "" end vCommand = vCommand:upper() for vCommandID, vCommandFunc in pairs(SlashCmdList) do local vIndex = 1 local vString = _G["SLASH_"..vCommandID..vIndex] while vString do if vString:upper() == vCommand then vCommandFunc(pText) return end vIndex = vIndex + 1 vString = _G["SLASH_"..vCommandID..vIndex] end end end ---------------------------------------- Outfitter._ListItem = {} ---------------------------------------- function Outfitter._ListItem:construct() self.OutfitMenu = _G[self:GetName().."OutfitMenu"] self.OutfitMenu.ParentItem = self self.UpdateTooltip = self.OnEnter self.SecureAction = _G[self:GetName().."SecureAction"] self.SecureAction:RegisterForClicks("LeftButtonUp", "RightButtonUp") self.SecureAction:HookScript("PreClick", function (frame, ...) self:PreClick(...) end) self.SecureAction:HookScript("PostClick", function (frame, ...) self:OnClick(...) end) self:RegisterForClicks("LeftButtonUp", "RightButtonUp") self:HookScript("PreClick", self.PreClick) self:HookScript("PostClick", self.OnClick) self.SecureAction:HookScript("OnEnter", function (frame, ...) self:OnEnter(...) end) self.SecureAction:HookScript("OnLeave", function (frame, ...) self:OnLeave(...) end) self:disableSecureActions() end function Outfitter._ListItem:disableSecureActions() if InCombatLockdown() then return end self.SecureAction:Hide() self.SecureAction:SetParent(UIParent) self.SecureAction:ClearAllPoints() end function Outfitter._ListItem:enableSecureActions() if InCombatLockdown() then return end self.SecureAction:Show() self.SecureAction:SetParent(self) self.SecureAction:SetAllPoints() -- Configure the secure button if self.isOutfitItem then self.SecureAction:SetAttribute("type", nil) self.SecureAction:SetAttribute("target-bag", self.outfitItem.Location.BagIndex) self.SecureAction:SetAttribute("target-slot", self.outfitItem.Location.BagSlotIndex) else self.SecureAction:SetAttribute("type", nil) self.SecureAction:SetAttribute("target-bag", nil) self.SecureAction:SetAttribute("target-slot", nil) end end function Outfitter._ListItem:suspendSecureActions() if self.isOutfitItem then self:disableSecureActions() self.suspendDidDisableActions = true else self.suspendDidDisableActions = nil end end function Outfitter._ListItem:resumeSecureActions() if self.suspendDidDisableActions then self:enableSecureActions() self.suspendDidDisableActions = nil end end function Outfitter._ListItem:SetToOutfit(pOutfit, pCategoryID, pOutfitIndex, pInventoryCache) local vItemName = self:GetName() local vOutfitFrameName = vItemName.."Outfit" local vOutfitFrame = _G[vOutfitFrameName] local vItemFrame = _G[vItemName.."Item"] local vCategoryFrame = _G[vItemName.."Category"] local vMissingItems, vBankedItems = pInventoryCache:GetMissingItems(pOutfit) vOutfitFrame:Show() vCategoryFrame:Hide() vItemFrame:Hide() local vItemSelectedCheckmark = _G[vOutfitFrameName.."Selected"] local vItemNameField = _G[vOutfitFrameName.."Name"] local vItemMenu = _G[vOutfitFrameName.."Menu"] local vItemServerButton = _G[vOutfitFrameName.."ServerButton"] vItemSelectedCheckmark:Show() if Outfitter:WearingOutfit(pOutfit) then vItemSelectedCheckmark:SetChecked(true) else vItemSelectedCheckmark:SetChecked(nil) end vItemServerButton:SetChecked(pOutfit.StoredInEM) self.MissingItems = vMissingItems self.BankedItems = vBankedItems if pOutfit.Disabled then vItemNameField:SetText(format(Outfitter.cDisabledOutfitName, pOutfit:GetName())) self.DefaultColor = GRAY_FONT_COLOR else vItemNameField:SetText(pOutfit:GetName()) if vMissingItems then self.DefaultColor = RED_FONT_COLOR elseif vBankedItems then self.DefaultColor = Outfitter.BANKED_FONT_COLOR else self.DefaultColor = NORMAL_FONT_COLOR end end vItemNameField:SetTextColor(self.DefaultColor.r, self.DefaultColor.g, self.DefaultColor.b) vItemMenu:Show() self.isCategory = false self.isOutfitItem = false self.outfitItem = nil self.categoryID = pOutfit.CategoryID self.outfitIndex = pOutfitIndex self:Show() -- Show the script icon if there's one attached local vScriptIcon = _G[vOutfitFrameName.."ScriptIcon"] if pOutfit.ScriptID or pOutfit.Script then vScriptIcon:SetTexture("Interface\\Addons\\Outfitter\\Textures\\Gear") if Outfitter.Settings.Options.DisableAutoSwitch or pOutfit.Disabled then vScriptIcon:SetVertexColor(0.4, 0.4, 0.4) else vScriptIcon:SetVertexColor(1, 1, 1) end vScriptIcon:Show() else vScriptIcon:Hide() end -- Update the highlighting if Outfitter.SelectedOutfit == pOutfit then OutfitterMainFrameHighlight:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0) OutfitterMainFrameHighlight:Show() end -- Configure the secure button self:disableSecureActions() end function Outfitter._ListItem:SetToItem(pOutfitItem) local vItemName = self:GetName() local vCategoryFrameName = vItemName.."Category" local vItemFrameName = vItemName.."Item" local vItemFrame = _G[vItemFrameName] local vOutfitFrame = _G[vItemName.."Outfit"] local vCategoryFrame = _G[vCategoryFrameName] self.isOutfitItem = true self.isCategory = false self.outfitItem = pOutfitItem vItemFrame:Show() vOutfitFrame:Hide() vCategoryFrame:Hide() local vItemNameField = _G[vItemFrameName.."Name"] local vItemIcon = _G[vItemFrameName.."Icon"] vItemNameField:SetText(pOutfitItem.Name) if pOutfitItem.Quality then self.DefaultColor = ITEM_QUALITY_COLORS[(pOutfitItem.Quality ~= 7 and pOutfitItem.Quality) or 6] else self.DefaultColor = GRAY_FONT_COLOR end if pOutfitItem.Texture then vItemIcon:SetTexture(pOutfitItem.Texture) vItemIcon:Show() else vItemIcon:Hide() end vItemNameField:SetTextColor(self.DefaultColor.r, self.DefaultColor.g, self.DefaultColor.b) -- Configure the secure button self:enableSecureActions() self:Show() end function Outfitter._ListItem:SetToCategory(pCategoryID) local vCategoryName = Outfitter["c"..pCategoryID.."Outfits"] local vItemName = self:GetName() local vCategoryFrameName = vItemName.."Category" local vOutfitFrame = _G[vItemName.."Outfit"] local vItemFrame = _G[vItemName.."Item"] local vCategoryFrame = _G[vCategoryFrameName] vOutfitFrame:Hide() vCategoryFrame:Show() vItemFrame:Hide() local vItemNameField = _G[vCategoryFrameName.."Name"] local vExpandButton = _G[vCategoryFrameName.."Expand"] self.MissingItems = nil self.BankedItems = nil if Outfitter.Collapsed[pCategoryID] then vExpandButton:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up") else vExpandButton:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up") end vItemNameField:SetText(vCategoryName) self.isCategory = true self.isOutfitItem = false self.outfitItem = nil self.categoryID = pCategoryID -- Configure the secure button self:disableSecureActions() self:Show() end function Outfitter._ListItem:SetTextColor(r, g, b) local nameField if self.isCategory then nameField = _G[self:GetName().."CategoryName"] else nameField = _G[self:GetName().."OutfitName"] end nameField:SetTextColor(r, g, b) end function Outfitter._ListItem:PreClick(button, down) self.usingSpell = SpellCanTargetItem() or SpellCanTargetItemID() end function Outfitter._ListItem:OnClick(button, down) if down or self.usingSpell then return end if self.isCategory then local vCategoryOutfits = Outfitter.Settings.Outfits[self.categoryID] Outfitter.Collapsed[self.categoryID] = not Outfitter.Collapsed[self.categoryID] Outfitter.DisplayIsDirty = true elseif self.isOutfitItem then if button == "LeftButton" then Outfitter:PickupItemLocation(self.outfitItem.Location) StackSplitFrame:Hide() else if MerchantFrame:IsShown() and MerchantFrame.selectedTab == 2 then -- Don't sell the item if the buyback tab is selected return else if self.outfitItem.Location.BagIndex then UseContainerItem(self.outfitItem.Location.BagIndex, self.outfitItem.Location.BagSlotIndex) StackSplitFrame:Hide() end end end else local outfit = self:GetOutfit() if not outfit then Outfitter:TestMessage("outfit not found") -- Error: outfit not found return end if button == "LeftButton" then outfit.Disabled = nil Outfitter:WearOutfit(outfit) else Outfitter:ToggleOutfitMenuAtCursor(outfit) end end Outfitter:Update(true) end function Outfitter._ListItem:OnEnter() self:SetTextColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b) if self.isCategory then local vDescription = Outfitter.cCategoryDescriptions[self.categoryID] if vDescription then local vCategoryName = Outfitter["c"..self.categoryID.."Outfits"] Outfitter.AddNewbieTip(self, vCategoryName, 1.0, 1.0, 1.0, vDescription, 1) end ResetCursor() elseif self.isOutfitItem then local vHasCooldown, vRepairCost GameTooltip:SetOwner(self, "ANCHOR_RIGHT") if self.outfitItem.Location.SlotName or self.outfitItem.Location.SlotID then if not self.outfitItem.Location.SlotID then self.outfitItem.Location.SlotID = Outfitter.cSlotIDs[self.outfitItem.Location.SlotName] end GameTooltip:SetInventoryItem("player", self.outfitItem.Location.SlotID) elseif self.outfitItem.Location.BagIndex == -1 then GameTooltip:SetInventoryItem("player", BankButtonIDToInvSlotID(self.outfitItem.Location.BagSlotIndex)) else vHasCooldown, vRepairCost = GameTooltip:SetBagItem(self.outfitItem.Location.BagIndex, self.outfitItem.Location.BagSlotIndex) end GameTooltip:Show() if InRepairMode() and (vRepairCost and vRepairCost > 0) then GameTooltip:AddLine(TEXT(REPAIR_COST), "", 1, 1, 1) SetTooltipMoney(GameTooltip, vRepairCost) GameTooltip:Show() elseif MerchantFrame:IsShown() and MerchantFrame.selectedTab == 1 then if self.outfitItem.Location.BagIndex then ShowContainerSellCursor(self.outfitItem.Location.BagIndex, self.outfitItem.Location.BagSlotIndex) end else ResetCursor() end else local vOutfit = self:GetOutfit() Outfitter:ShowOutfitTooltip(vOutfit, self, self.MissingItems, self.BankedItems) end end function Outfitter._ListItem:OnLeave() if self.isCategory then self:SetTextColor(1, 1, 1) else self:SetTextColor(self.DefaultColor.r, self.DefaultColor.g, self.DefaultColor.b) end GameTooltip:Hide() end function Outfitter._ListItem:GetOutfit() if self.isCategory then return nil end return Outfitter:GetIndexedOutfit(self.categoryID, self.outfitIndex) end
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://assets-cdn.github.com"> <link rel="dns-prefetch" href="https://avatars0.githubusercontent.com"> <link rel="dns-prefetch" href="https://avatars1.githubusercontent.com"> <link rel="dns-prefetch" href="https://avatars2.githubusercontent.com"> <link rel="dns-prefetch" href="https://avatars3.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-4324702744188e5d6edc78c06517458705b8d6596db5054c244444b56c494c99.css" integrity="sha256-QyRwJ0QYjl1u3HjAZRdFhwW41llttQVMJEREtWxJTJk=" media="all" rel="stylesheet" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-dc68b8984be0bf4b18485cbbae5a1a783216fb2ff01cfa4758292684cbdd9605.css" integrity="sha256-3Gi4mEvgv0sYSFy7rloaeDIW+y/wHPpHWCkmhMvdlgU=" media="all" rel="stylesheet" /> <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/site-cfab053e93f0e27f4c63d4ff6b7957bd25f711667fe678e747f8a4d88c47b38d.css" integrity="sha256-z6sFPpPw4n9MY9T/a3lXvSX3EWZ/5njnR/ik2IxHs40=" media="all" rel="stylesheet" /> <meta name="viewport" content="width=device-width"> <title>NortTM/test.lua at master · WebShark025/NortTM · GitHub</title> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta content="https://avatars0.githubusercontent.com/u/12953043?v=4&amp;s=400" property="og:image" /><meta content="GitHub" property="og:site_name" /><meta content="object" property="og:type" /><meta content="WebShark025/NortTM" property="og:title" /><meta content="https://github.com/WebShark025/NortTM" property="og:url" /><meta content="NortTM - Official NortTeam antispam bot. Based on yagop/telegram-bot . Special thanks to: AmirSBSS - ParsaAlemi - MohammadTicTic &amp; all." property="og:description" /> <link rel="assets" href="https://assets-cdn.github.com/"> <meta name="pjax-timeout" content="1000"> <meta name="request-id" content="0524:7A51:841E2F:EBB428:596FB96D" data-pjax-transient> <meta name="selected-link" value="repo_source" data-pjax-transient> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-analytics" content="UA-3769691-2"> <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="https://collector.githubapp.com/github-external/browser_event" name="octolytics-event-url" /><meta content="0524:7A51:841E2F:EBB428:596FB96D" name="octolytics-dimension-request_id" /><meta content="iad" name="octolytics-dimension-region_edge" /><meta content="iad" name="octolytics-dimension-region_render" /> <meta content="/&lt;user-name&gt;/&lt;repo-name&gt;/blob/show" data-pjax-transient="true" name="analytics-location" /> <meta class="js-ga-set" name="dimension1" content="Logged Out"> <meta name="hostname" content="github.com"> <meta name="user-login" content=""> <meta name="expected-hostname" content="github.com"> <meta name="js-proxy-site-detection-payload" content="NzkwOWYyMDExZmI1MzZlY2UzYjA1ZDI5ZWNjMmU2MjAwM2Y2YmEzMzQ5Y2Q1NjZiN2I0NjRlY2E4ZWVjOTNmZnx7InJlbW90ZV9hZGRyZXNzIjoiNS4xMTMuOTEuMjciLCJyZXF1ZXN0X2lkIjoiMDUyNDo3QTUxOjg0MUUyRjpFQkI0Mjg6NTk2RkI5NkQiLCJ0aW1lc3RhbXAiOjE1MDA0OTQxOTUsImhvc3QiOiJnaXRodWIuY29tIn0="> <meta name="html-safe-nonce" content="04c723dc2986399db26cd0632d412c1c8ca4a744"> <meta http-equiv="x-pjax-version" content="688aafcb5ed907c08441a31f2cf00ced"> <link href="https://github.com/WebShark025/NortTM/commits/master.atom" rel="alternate" title="Recent Commits to NortTM:master" type="application/atom+xml"> <meta name="description" content="NortTM - Official NortTeam antispam bot. Based on yagop/telegram-bot . Special thanks to: AmirSBSS - ParsaAlemi - MohammadTicTic &amp; all."> <meta name="go-import" content="github.com/WebShark025/NortTM git https://github.com/WebShark025/NortTM.git"> <meta content="12953043" name="octolytics-dimension-user_id" /><meta content="WebShark025" name="octolytics-dimension-user_login" /><meta content="58180314" name="octolytics-dimension-repository_id" /><meta content="WebShark025/NortTM" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="58180314" name="octolytics-dimension-repository_network_root_id" /><meta content="WebShark025/NortTM" name="octolytics-dimension-repository_network_root_nwo" /><meta content="false" name="octolytics-dimension-repository_explore_github_marketplace_ci_cta_shown" /> <link rel="canonical" href="https://github.com/WebShark025/NortTM/blob/master/tg/test.lua" data-pjax-transient> <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#000000"> <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico"> <meta name="theme-color" content="#1e2327"> <meta name="u2f-support" content="true"> </head> <body class="logged-out env-production page-blob"> <div class="position-relative js-header-wrapper "> <a href="#start-of-content" tabindex="1" class="px-2 py-4 show-on-focus js-skip-to-content">Skip to content</a> <div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div> <header class="site-header js-details-container Details" role="banner"> <div class="site-nav-container"> <a class="header-logo-invertocat" href="https://github.com/" aria-label="Homepage" data-ga-click="(Logged out) Header, go to homepage, icon:logo-wordmark"> <svg aria-hidden="true" class="octicon octicon-mark-github" height="32" version="1.1" viewBox="0 0 16 16" width="32"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg> </a> <button class="btn-link float-right site-header-toggle js-details-target" type="button" aria-label="Toggle navigation" aria-expanded="false"> <svg aria-hidden="true" class="octicon octicon-three-bars" height="24" version="1.1" viewBox="0 0 12 16" width="18"><path fill-rule="evenodd" d="M11.41 9H.59C0 9 0 8.59 0 8c0-.59 0-1 .59-1H11.4c.59 0 .59.41.59 1 0 .59 0 1-.59 1h.01zm0-4H.59C0 5 0 4.59 0 4c0-.59 0-1 .59-1H11.4c.59 0 .59.41.59 1 0 .59 0 1-.59 1h.01zM.59 11H11.4c.59 0 .59.41.59 1 0 .59 0 1-.59 1H.59C0 13 0 12.59 0 12c0-.59 0-1 .59-1z"/></svg> </button> <div class="site-header-menu"> <nav class="site-header-nav"> <a href="/features" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:features" data-selected-links="/features /features/code-review /features/project-management /features/integrations /features"> Features </a> <a href="/business" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:business" data-selected-links="/business /business/security /business/customers /business"> Business </a> <a href="/explore" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:explore" data-selected-links="/explore /trending /trending/developers /stars /integrations /integrations/feature/code /integrations/feature/collaborate /integrations/feature/ship showcases showcases_search showcases_landing /explore"> Explore </a> <a href="/marketplace" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:marketplace" data-selected-links=" /marketplace"> Marketplace </a> <a href="/pricing" class="js-selected-navigation-item nav-item" data-ga-click="Header, click, Nav menu - item:pricing" data-selected-links="/pricing /pricing/developer /pricing/team /pricing/business-hosted /pricing/business-enterprise /pricing"> Pricing </a> </nav> <div class="site-header-actions"> <div class="header-search scoped-search site-scoped-search js-site-search" role="search"> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/WebShark025/NortTM/search" class="js-site-search-form" data-scoped-search-url="/WebShark025/NortTM/search" data-unscoped-search-url="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div> <label class="form-control header-search-wrapper js-chromeless-input-container"> <a href="/WebShark025/NortTM/blob/master/tg/test.lua" class="header-search-scope no-underline">This repository</a> <input type="text" class="form-control header-search-input js-site-search-focus js-site-search-field is-clearable" data-hotkey="s" name="q" value="" placeholder="Search" aria-label="Search this repository" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off"> <input type="hidden" class="js-site-search-type-field" name="type" > </label> </form></div> <a class="text-bold site-header-link" href="/login?return_to=%2FWebShark025%2FNortTM%2Fblob%2Fmaster%2Ftg%2Ftest.lua" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in">Sign in</a> <span class="text-gray">or</span> <a class="text-bold site-header-link" href="/join?source=header-repo" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up">Sign up</a> </div> </div> </div> </header> </div> <div id="start-of-content" class="show-on-focus"></div> <div id="js-flash-container"> </div> <div role="main"> <div itemscope itemtype="http://schema.org/SoftwareSourceCode"> <div id="js-repo-pjax-container" data-pjax-container> <div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav"> <div class="container repohead-details-container"> <ul class="pagehead-actions"> <li> <a href="/login?return_to=%2FWebShark025%2FNortTM" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to watch a repository" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg> Watch </a> <a class="social-count" href="/WebShark025/NortTM/watchers" aria-label="2 users are watching this repository"> 2 </a> </li> <li> <a href="/login?return_to=%2FWebShark025%2FNortTM" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to star a repository" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"/></svg> Star </a> <a class="social-count js-social-count" href="/WebShark025/NortTM/stargazers" aria-label="4 users starred this repository"> 4 </a> </li> <li> <a href="/login?return_to=%2FWebShark025%2FNortTM" class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to fork a repository" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-repo-forked" height="16" version="1.1" viewBox="0 0 10 16" width="10"><path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg> Fork </a> <a href="/WebShark025/NortTM/network" class="social-count" aria-label="12 users forked this repository"> 12 </a> </li> </ul> <h1 class="public "> <svg aria-hidden="true" class="octicon octicon-repo" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg> <span class="author" itemprop="author"><a href="/WebShark025" class="url fn" rel="author">WebShark025</a></span><!-- --><span class="path-divider">/</span><!-- --><strong itemprop="name"><a href="/WebShark025/NortTM" data-pjax="#js-repo-pjax-container">NortTM</a></strong> </h1> </div> <div class="container"> <nav class="reponav js-repo-nav js-sidenav-container-pjax" itemscope itemtype="http://schema.org/BreadcrumbList" role="navigation" data-pjax="#js-repo-pjax-container"> <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> <a href="/WebShark025/NortTM" class="js-selected-navigation-item selected reponav-item" data-hotkey="g c" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches /WebShark025/NortTM" itemprop="url"> <svg aria-hidden="true" class="octicon octicon-code" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"/></svg> <span itemprop="name">Code</span> <meta itemprop="position" content="1"> </a> </span> <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> <a href="/WebShark025/NortTM/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /WebShark025/NortTM/issues" itemprop="url"> <svg aria-hidden="true" class="octicon octicon-issue-opened" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"/></svg> <span itemprop="name">Issues</span> <span class="Counter">0</span> <meta itemprop="position" content="2"> </a> </span> <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> <a href="/WebShark025/NortTM/pulls" class="js-selected-navigation-item reponav-item" data-hotkey="g p" data-selected-links="repo_pulls /WebShark025/NortTM/pulls" itemprop="url"> <svg aria-hidden="true" class="octicon octicon-git-pull-request" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg> <span itemprop="name">Pull requests</span> <span class="Counter">0</span> <meta itemprop="position" content="3"> </a> </span> <a href="/WebShark025/NortTM/projects" class="js-selected-navigation-item reponav-item" data-selected-links="repo_projects new_repo_project repo_project /WebShark025/NortTM/projects"> <svg aria-hidden="true" class="octicon octicon-project" height="16" version="1.1" viewBox="0 0 15 16" width="15"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg> Projects <span class="Counter" >0</span> </a> <div class="reponav-dropdown js-menu-container"> <button type="button" class="btn-link reponav-item reponav-dropdown js-menu-target " data-no-toggle aria-expanded="false" aria-haspopup="true"> Insights <svg aria-hidden="true" class="octicon octicon-triangle-down v-align-middle text-gray" height="11" version="1.1" viewBox="0 0 12 16" width="8"><path fill-rule="evenodd" d="M0 5l6 6 6-6z"/></svg> </button> <div class="dropdown-menu-content js-menu-content"> <div class="dropdown-menu dropdown-menu-sw"> <a class="dropdown-item" href="/WebShark025/NortTM/pulse" data-skip-pjax> <svg aria-hidden="true" class="octicon octicon-pulse" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M11.5 8L8.8 5.4 6.6 8.5 5.5 1.6 2.38 8H0v2h3.6l.9-1.8.9 5.4L9 8.5l1.6 1.5H14V8z"/></svg> Pulse </a> <a class="dropdown-item" href="/WebShark025/NortTM/graphs" data-skip-pjax> <svg aria-hidden="true" class="octicon octicon-graph" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M16 14v1H0V0h1v14h15zM5 13H3V8h2v5zm4 0H7V3h2v10zm4 0h-2V6h2v7z"/></svg> Graphs </a> </div> </div> </div> </nav> </div> </div> <div class="container new-discussion-timeline experiment-repo-nav"> <div class="repository-content"> <a href="/WebShark025/NortTM/blob/741871b92093548b853e19644d96acdc2a0aa1c4/tg/test.lua" class="d-none js-permalink-shortcut" data-hotkey="y">Permalink</a> <!-- blob contrib key: blob_contributors:v21:e00be2598286b71148df424fb0c637e7 --> <div class="file-navigation js-zeroclipboard-container"> <div class="select-menu branch-select-menu js-menu-container js-select-menu float-left"> <button class=" btn btn-sm select-menu-button js-menu-target css-truncate" data-hotkey="w" type="button" aria-label="Switch branches or tags" aria-expanded="false" aria-haspopup="true"> <i>Branch:</i> <span class="js-select-button css-truncate-target">master</span> </button> <div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax> <div class="select-menu-modal"> <div class="select-menu-header"> <svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg> <span class="select-menu-title">Switch branches/tags</span> </div> <div class="select-menu-filters"> <div class="select-menu-text-filter"> <input type="text" aria-label="Filter branches/tags" id="context-commitish-filter-field" class="form-control js-filterable-field js-navigation-enable" placeholder="Filter branches/tags"> </div> <div class="select-menu-tabs"> <ul> <li class="select-menu-tab"> <a href="#" data-tab-filter="branches" data-filter-placeholder="Filter branches/tags" class="js-select-menu-tab" role="tab">Branches</a> </li> <li class="select-menu-tab"> <a href="#" data-tab-filter="tags" data-filter-placeholder="Find a tag…" class="js-select-menu-tab" role="tab">Tags</a> </li> </ul> </div> </div> <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches" role="menu"> <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring"> <a class="select-menu-item js-navigation-item js-navigation-open selected" href="/WebShark025/NortTM/blob/master/tg/test.lua" data-name="master" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target js-select-menu-filter-text"> master </span> </a> </div> <div class="select-menu-no-results">Nothing to show</div> </div> <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags"> <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring"> <a class="select-menu-item js-navigation-item js-navigation-open " href="/WebShark025/NortTM/tree/v2.0.7-stable/tg/test.lua" data-name="v2.0.7-stable" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v2.0.7-stable"> v2.0.7-stable </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/WebShark025/NortTM/tree/v2.0.6-stable/tg/test.lua" data-name="v2.0.6-stable" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v2.0.6-stable"> v2.0.6-stable </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/WebShark025/NortTM/tree/v2.0.5-stable/tg/test.lua" data-name="v2.0.5-stable" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v2.0.5-stable"> v2.0.5-stable </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/WebShark025/NortTM/tree/v2.0.3-stable/tg/test.lua" data-name="v2.0.3-stable" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v2.0.3-stable"> v2.0.3-stable </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/WebShark025/NortTM/tree/v2.0.2-stable/tg/test.lua" data-name="v2.0.2-stable" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v2.0.2-stable"> v2.0.2-stable </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/WebShark025/NortTM/tree/v2.0.1-beta/tg/test.lua" data-name="v2.0.1-beta" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v2.0.1-beta"> v2.0.1-beta </span> </a> <a class="select-menu-item js-navigation-item js-navigation-open " href="/WebShark025/NortTM/tree/v2.0.0-beta/tg/test.lua" data-name="v2.0.0-beta" data-skip-pjax="true" rel="nofollow"> <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg> <span class="select-menu-item-text css-truncate-target" title="v2.0.0-beta"> v2.0.0-beta </span> </a> </div> <div class="select-menu-no-results">Nothing to show</div> </div> </div> </div> </div> <div class="BtnGroup float-right"> <a href="/WebShark025/NortTM/find/master" class="js-pjax-capture-input btn btn-sm BtnGroup-item" data-pjax data-hotkey="t"> Find file </a> <button aria-label="Copy file path to clipboard" class="js-zeroclipboard btn btn-sm BtnGroup-item tooltipped tooltipped-s" data-copied-hint="Copied!" type="button">Copy path</button> </div> <div class="breadcrumb js-zeroclipboard-target"> <span class="repo-root js-repo-root"><span class="js-path-segment"><a href="/WebShark025/NortTM"><span>NortTM</span></a></span></span><span class="separator">/</span><span class="js-path-segment"><a href="/WebShark025/NortTM/tree/master/tg"><span>tg</span></a></span><span class="separator">/</span><strong class="final-path">test.lua</strong> </div> </div> <include-fragment class="commit-tease" src="/WebShark025/NortTM/contributors/master/tg/test.lua"> <div> Fetching contributors&hellip; </div> <div class="commit-tease-contributors"> <img alt="" class="loader-loading float-left" height="16" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-32-EAF2F5.gif" width="16" /> <span class="loader-error">Cannot retrieve contributors at this time</span> </div> </include-fragment> <div class="file"> <div class="file-header"> <div class="file-actions"> <div class="BtnGroup"> <a href="/WebShark025/NortTM/raw/master/tg/test.lua" class="btn btn-sm BtnGroup-item" id="raw-url">Raw</a> <a href="/WebShark025/NortTM/blame/master/tg/test.lua" class="btn btn-sm js-update-url-with-hash BtnGroup-item" data-hotkey="b">Blame</a> <a href="/WebShark025/NortTM/commits/master/tg/test.lua" class="btn btn-sm BtnGroup-item" rel="nofollow">History</a> </div> <a class="btn-octicon tooltipped tooltipped-nw" href="https://desktop.github.com" aria-label="Open this file in GitHub Desktop" data-ga-click="Repository, open with desktop, type:windows"> <svg aria-hidden="true" class="octicon octicon-device-desktop" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M15 2H1c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5.34c-.25.61-.86 1.39-2.34 2h8c-1.48-.61-2.09-1.39-2.34-2H15c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm0 9H1V3h14v8z"/></svg> </a> <button type="button" class="btn-octicon disabled tooltipped tooltipped-nw" aria-label="You must be signed in to make or propose changes"> <svg aria-hidden="true" class="octicon octicon-pencil" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M0 12v3h3l8-8-3-3-8 8zm3 2H1v-2h1v1h1v1zm10.3-9.3L12 6 9 3l1.3-1.3a.996.996 0 0 1 1.41 0l1.59 1.59c.39.39.39 1.02 0 1.41z"/></svg> </button> <button type="button" class="btn-octicon btn-octicon-danger disabled tooltipped tooltipped-nw" aria-label="You must be signed in to make or propose changes"> <svg aria-hidden="true" class="octicon octicon-trashcan" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 12H3V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9zm1-10H2V3h9v1z"/></svg> </button> </div> <div class="file-info"> 127 lines (106 sloc) <span class="file-info-divider"></span> 2.51 KB </div> </div> <div itemprop="text" class="blob-wrapper data type-lua"> <table class="highlight tab-size js-file-line-container" data-tab-size="8"> <tr> <td id="L1" class="blob-num js-line-number" data-line-number="1"></td> <td id="LC1" class="blob-code blob-code-inner js-file-line">started <span class="pl-k">=</span> <span class="pl-c1">0</span></td> </tr> <tr> <td id="L2" class="blob-num js-line-number" data-line-number="2"></td> <td id="LC2" class="blob-code blob-code-inner js-file-line">our_id <span class="pl-k">=</span> <span class="pl-c1">0</span></td> </tr> <tr> <td id="L3" class="blob-num js-line-number" data-line-number="3"></td> <td id="LC3" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L4" class="blob-num js-line-number" data-line-number="4"></td> <td id="LC4" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> vardump</span>(<span class="pl-smi">value</span>, <span class="pl-smi">depth</span>, <span class="pl-smi">key</span>)</td> </tr> <tr> <td id="L5" class="blob-num js-line-number" data-line-number="5"></td> <td id="LC5" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">local</span> linePrefix <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">&quot;</span><span class="pl-pds">&quot;</span></span></td> </tr> <tr> <td id="L6" class="blob-num js-line-number" data-line-number="6"></td> <td id="LC6" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">local</span> spaces <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">&quot;</span><span class="pl-pds">&quot;</span></span></td> </tr> <tr> <td id="L7" class="blob-num js-line-number" data-line-number="7"></td> <td id="LC7" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L8" class="blob-num js-line-number" data-line-number="8"></td> <td id="LC8" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> key <span class="pl-k">~=</span> <span class="pl-c1">nil</span> <span class="pl-k">then</span></td> </tr> <tr> <td id="L9" class="blob-num js-line-number" data-line-number="9"></td> <td id="LC9" class="blob-code blob-code-inner js-file-line"> linePrefix <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">&quot;</span>[<span class="pl-pds">&quot;</span></span><span class="pl-k">..</span>key<span class="pl-k">..</span><span class="pl-s"><span class="pl-pds">&quot;</span>] = <span class="pl-pds">&quot;</span></span></td> </tr> <tr> <td id="L10" class="blob-num js-line-number" data-line-number="10"></td> <td id="LC10" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L11" class="blob-num js-line-number" data-line-number="11"></td> <td id="LC11" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L12" class="blob-num js-line-number" data-line-number="12"></td> <td id="LC12" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> depth <span class="pl-k">==</span> <span class="pl-c1">nil</span> <span class="pl-k">then</span></td> </tr> <tr> <td id="L13" class="blob-num js-line-number" data-line-number="13"></td> <td id="LC13" class="blob-code blob-code-inner js-file-line"> depth <span class="pl-k">=</span> <span class="pl-c1">0</span></td> </tr> <tr> <td id="L14" class="blob-num js-line-number" data-line-number="14"></td> <td id="LC14" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">else</span></td> </tr> <tr> <td id="L15" class="blob-num js-line-number" data-line-number="15"></td> <td id="LC15" class="blob-code blob-code-inner js-file-line"> depth <span class="pl-k">=</span> depth <span class="pl-k">+</span> <span class="pl-c1">1</span></td> </tr> <tr> <td id="L16" class="blob-num js-line-number" data-line-number="16"></td> <td id="LC16" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> i<span class="pl-k">=</span><span class="pl-c1">1</span>, depth <span class="pl-k">do</span> spaces <span class="pl-k">=</span> spaces <span class="pl-k">..</span> <span class="pl-s"><span class="pl-pds">&quot;</span> <span class="pl-pds">&quot;</span></span> <span class="pl-k">end</span></td> </tr> <tr> <td id="L17" class="blob-num js-line-number" data-line-number="17"></td> <td id="LC17" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L18" class="blob-num js-line-number" data-line-number="18"></td> <td id="LC18" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L19" class="blob-num js-line-number" data-line-number="19"></td> <td id="LC19" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> <span class="pl-c1">type</span>(value) <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">&#39;</span>table<span class="pl-pds">&#39;</span></span> <span class="pl-k">then</span></td> </tr> <tr> <td id="L20" class="blob-num js-line-number" data-line-number="20"></td> <td id="LC20" class="blob-code blob-code-inner js-file-line"> mTable <span class="pl-k">=</span> <span class="pl-c1">getmetatable</span>(value)</td> </tr> <tr> <td id="L21" class="blob-num js-line-number" data-line-number="21"></td> <td id="LC21" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> mTable <span class="pl-k">==</span> <span class="pl-c1">nil</span> <span class="pl-k">then</span></td> </tr> <tr> <td id="L22" class="blob-num js-line-number" data-line-number="22"></td> <td id="LC22" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(spaces <span class="pl-k">..</span>linePrefix<span class="pl-k">..</span><span class="pl-s"><span class="pl-pds">&quot;</span>(table) <span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L23" class="blob-num js-line-number" data-line-number="23"></td> <td id="LC23" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">else</span></td> </tr> <tr> <td id="L24" class="blob-num js-line-number" data-line-number="24"></td> <td id="LC24" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(spaces <span class="pl-k">..</span><span class="pl-s"><span class="pl-pds">&quot;</span>(metatable) <span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L25" class="blob-num js-line-number" data-line-number="25"></td> <td id="LC25" class="blob-code blob-code-inner js-file-line"> value <span class="pl-k">=</span> mTable</td> </tr> <tr> <td id="L26" class="blob-num js-line-number" data-line-number="26"></td> <td id="LC26" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span> </td> </tr> <tr> <td id="L27" class="blob-num js-line-number" data-line-number="27"></td> <td id="LC27" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> tableKey, tableValue <span class="pl-k">in</span> <span class="pl-c1">pairs</span>(value) <span class="pl-k">do</span></td> </tr> <tr> <td id="L28" class="blob-num js-line-number" data-line-number="28"></td> <td id="LC28" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">vardump</span>(tableValue, depth, tableKey)</td> </tr> <tr> <td id="L29" class="blob-num js-line-number" data-line-number="29"></td> <td id="LC29" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L30" class="blob-num js-line-number" data-line-number="30"></td> <td id="LC30" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">elseif</span> <span class="pl-c1">type</span>(value) <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">&#39;</span>function<span class="pl-pds">&#39;</span></span> <span class="pl-k">or</span> </td> </tr> <tr> <td id="L31" class="blob-num js-line-number" data-line-number="31"></td> <td id="LC31" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">type</span>(value) <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">&#39;</span>thread<span class="pl-pds">&#39;</span></span> <span class="pl-k">or</span> </td> </tr> <tr> <td id="L32" class="blob-num js-line-number" data-line-number="32"></td> <td id="LC32" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">type</span>(value) <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">&#39;</span>userdata<span class="pl-pds">&#39;</span></span> <span class="pl-k">or</span></td> </tr> <tr> <td id="L33" class="blob-num js-line-number" data-line-number="33"></td> <td id="LC33" class="blob-code blob-code-inner js-file-line"> value <span class="pl-k">==</span> <span class="pl-c1">nil</span></td> </tr> <tr> <td id="L34" class="blob-num js-line-number" data-line-number="34"></td> <td id="LC34" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">then</span></td> </tr> <tr> <td id="L35" class="blob-num js-line-number" data-line-number="35"></td> <td id="LC35" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(spaces<span class="pl-k">..</span><span class="pl-c1">tostring</span>(value))</td> </tr> <tr> <td id="L36" class="blob-num js-line-number" data-line-number="36"></td> <td id="LC36" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">else</span></td> </tr> <tr> <td id="L37" class="blob-num js-line-number" data-line-number="37"></td> <td id="LC37" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(spaces<span class="pl-k">..</span>linePrefix<span class="pl-k">..</span><span class="pl-s"><span class="pl-pds">&quot;</span>(<span class="pl-pds">&quot;</span></span><span class="pl-k">..</span><span class="pl-c1">type</span>(value)<span class="pl-k">..</span><span class="pl-s"><span class="pl-pds">&quot;</span>) <span class="pl-pds">&quot;</span></span><span class="pl-k">..</span><span class="pl-c1">tostring</span>(value))</td> </tr> <tr> <td id="L38" class="blob-num js-line-number" data-line-number="38"></td> <td id="LC38" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L39" class="blob-num js-line-number" data-line-number="39"></td> <td id="LC39" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L40" class="blob-num js-line-number" data-line-number="40"></td> <td id="LC40" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L41" class="blob-num js-line-number" data-line-number="41"></td> <td id="LC41" class="blob-code blob-code-inner js-file-line"><span class="pl-c1">print</span> (<span class="pl-s"><span class="pl-pds">&quot;</span>HI, this is lua script<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L42" class="blob-num js-line-number" data-line-number="42"></td> <td id="LC42" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L43" class="blob-num js-line-number" data-line-number="43"></td> <td id="LC43" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> ok_cb</span>(<span class="pl-smi">extra</span>, <span class="pl-smi">success</span>, <span class="pl-smi">result</span>)</td> </tr> <tr> <td id="L44" class="blob-num js-line-number" data-line-number="44"></td> <td id="LC44" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L45" class="blob-num js-line-number" data-line-number="45"></td> <td id="LC45" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L46" class="blob-num js-line-number" data-line-number="46"></td> <td id="LC46" class="blob-code blob-code-inner js-file-line"><span class="pl-c"><span class="pl-c">--</span> Notification code {{{</span></td> </tr> <tr> <td id="L47" class="blob-num js-line-number" data-line-number="47"></td> <td id="LC47" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L48" class="blob-num js-line-number" data-line-number="48"></td> <td id="LC48" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> get_title </span>(<span class="pl-smi">P</span>, <span class="pl-smi">Q</span>)</td> </tr> <tr> <td id="L49" class="blob-num js-line-number" data-line-number="49"></td> <td id="LC49" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (Q.<span class="pl-smi">type</span> <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">&#39;</span>user<span class="pl-pds">&#39;</span></span>) <span class="pl-k">then</span></td> </tr> <tr> <td id="L50" class="blob-num js-line-number" data-line-number="50"></td> <td id="LC50" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> P.<span class="pl-smi">first_name</span> <span class="pl-k">..</span> <span class="pl-s"><span class="pl-pds">&quot;</span> <span class="pl-pds">&quot;</span></span> <span class="pl-k">..</span> P.<span class="pl-smi">last_name</span></td> </tr> <tr> <td id="L51" class="blob-num js-line-number" data-line-number="51"></td> <td id="LC51" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">elseif</span> (Q.<span class="pl-smi">type</span> <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">&#39;</span>chat<span class="pl-pds">&#39;</span></span>) <span class="pl-k">then</span></td> </tr> <tr> <td id="L52" class="blob-num js-line-number" data-line-number="52"></td> <td id="LC52" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> Q.<span class="pl-smi">title</span></td> </tr> <tr> <td id="L53" class="blob-num js-line-number" data-line-number="53"></td> <td id="LC53" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">elseif</span> (Q.<span class="pl-smi">type</span> <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">&#39;</span>encr_chat<span class="pl-pds">&#39;</span></span>) <span class="pl-k">then</span></td> </tr> <tr> <td id="L54" class="blob-num js-line-number" data-line-number="54"></td> <td id="LC54" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">&#39;</span>Secret chat with <span class="pl-pds">&#39;</span></span> <span class="pl-k">..</span> P.<span class="pl-smi">first_name</span> <span class="pl-k">..</span> <span class="pl-s"><span class="pl-pds">&#39;</span> <span class="pl-pds">&#39;</span></span> <span class="pl-k">..</span> P.<span class="pl-smi">last_name</span></td> </tr> <tr> <td id="L55" class="blob-num js-line-number" data-line-number="55"></td> <td id="LC55" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">else</span></td> </tr> <tr> <td id="L56" class="blob-num js-line-number" data-line-number="56"></td> <td id="LC56" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">&#39;</span><span class="pl-pds">&#39;</span></span></td> </tr> <tr> <td id="L57" class="blob-num js-line-number" data-line-number="57"></td> <td id="LC57" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L58" class="blob-num js-line-number" data-line-number="58"></td> <td id="LC58" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L59" class="blob-num js-line-number" data-line-number="59"></td> <td id="LC59" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L60" class="blob-num js-line-number" data-line-number="60"></td> <td id="LC60" class="blob-code blob-code-inner js-file-line"><span class="pl-k">local</span> lgi <span class="pl-k">=</span> <span class="pl-c1">require</span> (<span class="pl-s"><span class="pl-pds">&#39;</span>lgi<span class="pl-pds">&#39;</span></span>)</td> </tr> <tr> <td id="L61" class="blob-num js-line-number" data-line-number="61"></td> <td id="LC61" class="blob-code blob-code-inner js-file-line"><span class="pl-k">local</span> notify <span class="pl-k">=</span> lgi.<span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">&#39;</span>Notify<span class="pl-pds">&#39;</span></span>)</td> </tr> <tr> <td id="L62" class="blob-num js-line-number" data-line-number="62"></td> <td id="LC62" class="blob-code blob-code-inner js-file-line">notify.<span class="pl-c1">init</span> (<span class="pl-s"><span class="pl-pds">&quot;</span>Telegram updates<span class="pl-pds">&quot;</span></span>)</td> </tr> <tr> <td id="L63" class="blob-num js-line-number" data-line-number="63"></td> <td id="LC63" class="blob-code blob-code-inner js-file-line"><span class="pl-k">local</span> icon <span class="pl-k">=</span> <span class="pl-c1">os.getenv</span>(<span class="pl-s"><span class="pl-pds">&quot;</span>HOME<span class="pl-pds">&quot;</span></span>) <span class="pl-k">..</span> <span class="pl-s"><span class="pl-pds">&quot;</span>/.telegram-cli/telegram-pics/telegram_64.png<span class="pl-pds">&quot;</span></span></td> </tr> <tr> <td id="L64" class="blob-num js-line-number" data-line-number="64"></td> <td id="LC64" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L65" class="blob-num js-line-number" data-line-number="65"></td> <td id="LC65" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> do_notify </span>(<span class="pl-smi">user</span>, <span class="pl-smi">msg</span>)</td> </tr> <tr> <td id="L66" class="blob-num js-line-number" data-line-number="66"></td> <td id="LC66" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">local</span> n <span class="pl-k">=</span> notify.<span class="pl-smi">Notification</span>.<span class="pl-c1">new</span>(user, msg, icon)</td> </tr> <tr> <td id="L67" class="blob-num js-line-number" data-line-number="67"></td> <td id="LC67" class="blob-code blob-code-inner js-file-line"> n:<span class="pl-c1">show</span> ()</td> </tr> <tr> <td id="L68" class="blob-num js-line-number" data-line-number="68"></td> <td id="LC68" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L69" class="blob-num js-line-number" data-line-number="69"></td> <td id="LC69" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L70" class="blob-num js-line-number" data-line-number="70"></td> <td id="LC70" class="blob-code blob-code-inner js-file-line"><span class="pl-c"><span class="pl-c">--</span> }}}</span></td> </tr> <tr> <td id="L71" class="blob-num js-line-number" data-line-number="71"></td> <td id="LC71" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L72" class="blob-num js-line-number" data-line-number="72"></td> <td id="LC72" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> on_msg_receive </span>(<span class="pl-smi">msg</span>)</td> </tr> <tr> <td id="L73" class="blob-num js-line-number" data-line-number="73"></td> <td id="LC73" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> started <span class="pl-k">==</span> <span class="pl-c1">0</span> <span class="pl-k">then</span></td> </tr> <tr> <td id="L74" class="blob-num js-line-number" data-line-number="74"></td> <td id="LC74" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span></td> </tr> <tr> <td id="L75" class="blob-num js-line-number" data-line-number="75"></td> <td id="LC75" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L76" class="blob-num js-line-number" data-line-number="76"></td> <td id="LC76" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> msg.<span class="pl-smi">out</span> <span class="pl-k">then</span></td> </tr> <tr> <td id="L77" class="blob-num js-line-number" data-line-number="77"></td> <td id="LC77" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span></td> </tr> <tr> <td id="L78" class="blob-num js-line-number" data-line-number="78"></td> <td id="LC78" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L79" class="blob-num js-line-number" data-line-number="79"></td> <td id="LC79" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">do_notify</span> (<span class="pl-c1">get_title</span> (msg.<span class="pl-smi">from</span>, msg.<span class="pl-smi">to</span>), msg.<span class="pl-smi">text</span>)</td> </tr> <tr> <td id="L80" class="blob-num js-line-number" data-line-number="80"></td> <td id="LC80" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L81" class="blob-num js-line-number" data-line-number="81"></td> <td id="LC81" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (msg.<span class="pl-smi">text</span> <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">&#39;</span>ping<span class="pl-pds">&#39;</span></span>) <span class="pl-k">then</span></td> </tr> <tr> <td id="L82" class="blob-num js-line-number" data-line-number="82"></td> <td id="LC82" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (msg.<span class="pl-smi">to</span>.<span class="pl-smi">id</span> <span class="pl-k">==</span> our_id) <span class="pl-k">then</span></td> </tr> <tr> <td id="L83" class="blob-num js-line-number" data-line-number="83"></td> <td id="LC83" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">send_msg</span> (msg.<span class="pl-smi">from</span>.<span class="pl-smi">print_name</span>, <span class="pl-s"><span class="pl-pds">&#39;</span>pong<span class="pl-pds">&#39;</span></span>, ok_cb, <span class="pl-c1">false</span>)</td> </tr> <tr> <td id="L84" class="blob-num js-line-number" data-line-number="84"></td> <td id="LC84" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">else</span></td> </tr> <tr> <td id="L85" class="blob-num js-line-number" data-line-number="85"></td> <td id="LC85" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">send_msg</span> (msg.<span class="pl-smi">to</span>.<span class="pl-smi">print_name</span>, <span class="pl-s"><span class="pl-pds">&#39;</span>pong<span class="pl-pds">&#39;</span></span>, ok_cb, <span class="pl-c1">false</span>)</td> </tr> <tr> <td id="L86" class="blob-num js-line-number" data-line-number="86"></td> <td id="LC86" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L87" class="blob-num js-line-number" data-line-number="87"></td> <td id="LC87" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span></td> </tr> <tr> <td id="L88" class="blob-num js-line-number" data-line-number="88"></td> <td id="LC88" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L89" class="blob-num js-line-number" data-line-number="89"></td> <td id="LC89" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (msg.<span class="pl-smi">text</span> <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">&#39;</span>PING<span class="pl-pds">&#39;</span></span>) <span class="pl-k">then</span></td> </tr> <tr> <td id="L90" class="blob-num js-line-number" data-line-number="90"></td> <td id="LC90" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (msg.<span class="pl-smi">to</span>.<span class="pl-smi">id</span> <span class="pl-k">==</span> our_id) <span class="pl-k">then</span></td> </tr> <tr> <td id="L91" class="blob-num js-line-number" data-line-number="91"></td> <td id="LC91" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">fwd_msg</span> (msg.<span class="pl-smi">from</span>.<span class="pl-smi">print_name</span>, msg.<span class="pl-smi">id</span>, ok_cb, <span class="pl-c1">false</span>)</td> </tr> <tr> <td id="L92" class="blob-num js-line-number" data-line-number="92"></td> <td id="LC92" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">else</span></td> </tr> <tr> <td id="L93" class="blob-num js-line-number" data-line-number="93"></td> <td id="LC93" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">fwd_msg</span> (msg.<span class="pl-smi">to</span>.<span class="pl-smi">print_name</span>, msg.<span class="pl-smi">id</span>, ok_cb, <span class="pl-c1">false</span>)</td> </tr> <tr> <td id="L94" class="blob-num js-line-number" data-line-number="94"></td> <td id="LC94" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L95" class="blob-num js-line-number" data-line-number="95"></td> <td id="LC95" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span></td> </tr> <tr> <td id="L96" class="blob-num js-line-number" data-line-number="96"></td> <td id="LC96" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">end</span></td> </tr> <tr> <td id="L97" class="blob-num js-line-number" data-line-number="97"></td> <td id="LC97" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L98" class="blob-num js-line-number" data-line-number="98"></td> <td id="LC98" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L99" class="blob-num js-line-number" data-line-number="99"></td> <td id="LC99" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> on_our_id </span>(<span class="pl-smi">id</span>)</td> </tr> <tr> <td id="L100" class="blob-num js-line-number" data-line-number="100"></td> <td id="LC100" class="blob-code blob-code-inner js-file-line"> our_id <span class="pl-k">=</span> id</td> </tr> <tr> <td id="L101" class="blob-num js-line-number" data-line-number="101"></td> <td id="LC101" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L102" class="blob-num js-line-number" data-line-number="102"></td> <td id="LC102" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L103" class="blob-num js-line-number" data-line-number="103"></td> <td id="LC103" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> on_user_update </span>(<span class="pl-smi">user</span>, <span class="pl-smi">what</span>)</td> </tr> <tr> <td id="L104" class="blob-num js-line-number" data-line-number="104"></td> <td id="LC104" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">--</span>vardump (user)</span></td> </tr> <tr> <td id="L105" class="blob-num js-line-number" data-line-number="105"></td> <td id="LC105" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L106" class="blob-num js-line-number" data-line-number="106"></td> <td id="LC106" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L107" class="blob-num js-line-number" data-line-number="107"></td> <td id="LC107" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> on_chat_update </span>(<span class="pl-smi">chat</span>, <span class="pl-smi">what</span>)</td> </tr> <tr> <td id="L108" class="blob-num js-line-number" data-line-number="108"></td> <td id="LC108" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">--</span>vardump (chat)</span></td> </tr> <tr> <td id="L109" class="blob-num js-line-number" data-line-number="109"></td> <td id="LC109" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L110" class="blob-num js-line-number" data-line-number="110"></td> <td id="LC110" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L111" class="blob-num js-line-number" data-line-number="111"></td> <td id="LC111" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> on_secret_chat_update </span>(<span class="pl-smi">schat</span>, <span class="pl-smi">what</span>)</td> </tr> <tr> <td id="L112" class="blob-num js-line-number" data-line-number="112"></td> <td id="LC112" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">--</span>vardump (schat)</span></td> </tr> <tr> <td id="L113" class="blob-num js-line-number" data-line-number="113"></td> <td id="LC113" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L114" class="blob-num js-line-number" data-line-number="114"></td> <td id="LC114" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L115" class="blob-num js-line-number" data-line-number="115"></td> <td id="LC115" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> on_get_difference_end </span>()</td> </tr> <tr> <td id="L116" class="blob-num js-line-number" data-line-number="116"></td> <td id="LC116" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L117" class="blob-num js-line-number" data-line-number="117"></td> <td id="LC117" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L118" class="blob-num js-line-number" data-line-number="118"></td> <td id="LC118" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> cron</span>()</td> </tr> <tr> <td id="L119" class="blob-num js-line-number" data-line-number="119"></td> <td id="LC119" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">--</span> do something</span></td> </tr> <tr> <td id="L120" class="blob-num js-line-number" data-line-number="120"></td> <td id="LC120" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">postpone</span> (cron, <span class="pl-c1">false</span>, <span class="pl-c1">1.0</span>)</td> </tr> <tr> <td id="L121" class="blob-num js-line-number" data-line-number="121"></td> <td id="LC121" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> <tr> <td id="L122" class="blob-num js-line-number" data-line-number="122"></td> <td id="LC122" class="blob-code blob-code-inner js-file-line"> </td> </tr> <tr> <td id="L123" class="blob-num js-line-number" data-line-number="123"></td> <td id="LC123" class="blob-code blob-code-inner js-file-line"><span class="pl-k">function</span><span class="pl-en"> on_binlog_replay_end </span>()</td> </tr> <tr> <td id="L124" class="blob-num js-line-number" data-line-number="124"></td> <td id="LC124" class="blob-code blob-code-inner js-file-line"> started <span class="pl-k">=</span> <span class="pl-c1">1</span></td> </tr> <tr> <td id="L125" class="blob-num js-line-number" data-line-number="125"></td> <td id="LC125" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">postpone</span> (cron, <span class="pl-c1">false</span>, <span class="pl-c1">1.0</span>)</td> </tr> <tr> <td id="L126" class="blob-num js-line-number" data-line-number="126"></td> <td id="LC126" class="blob-code blob-code-inner js-file-line"><span class="pl-k">end</span></td> </tr> </table> </div> </div> <button type="button" data-facebox="#jump-to-line" data-facebox-class="linejump" data-hotkey="l" class="d-none">Jump to Line</button> <div id="jump-to-line" style="display:none"> <!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="" class="js-jump-to-line-form" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div> <input class="form-control linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line&hellip;" aria-label="Jump to line" autofocus> <button type="submit" class="btn">Go</button> </form> </div> </div> <div class="modal-backdrop js-touch-events"></div> </div> </div> </div> </div> <div class="container site-footer-container"> <div class="site-footer " role="contentinfo"> <ul class="site-footer-links float-right"> <li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact GitHub</a></li> <li><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li> <li><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li> <li><a href="https://shop.github.com" data-ga-click="Footer, go to shop, text:shop">Shop</a></li> <li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li> <li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li> </ul> <a href="https://github.com" aria-label="Homepage" class="site-footer-mark" title="GitHub"> <svg aria-hidden="true" class="octicon octicon-mark-github" height="24" version="1.1" viewBox="0 0 16 16" width="24"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg> </a> <ul class="site-footer-links"> <li>&copy; 2017 <span title="0.10711s from unicorn-2623586551-1z8k7">GitHub</span>, Inc.</li> <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li> <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li> <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li> <li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li> <li><a href="https://help.github.com" data-ga-click="Footer, go to help, text:help">Help</a></li> </ul> </div> </div> <div id="ajax-error-message" class="ajax-error-message flash flash-error"> <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg> <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg> </button> You can't perform that action at this time. </div> <script crossorigin="anonymous" integrity="sha256-LI212Ua3AejeiXp6KA86A7SdjqlXF5YNVFiQeojQcQQ=" src="https://assets-cdn.github.com/assets/frameworks-2c8db5d946b701e8de897a7a280f3a03b49d8ea95717960d5458907a88d07104.js"></script> <script async="async" crossorigin="anonymous" integrity="sha256-QX/1bEmr1keI6YSHZQkwMhC03sFuugwuA8WDl4TUBNU=" src="https://assets-cdn.github.com/assets/github-417ff56c49abd64788e984876509303210b4dec16eba0c2e03c5839784d404d5.js"></script> <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none"> <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg> <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span> <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span> </div> <div class="facebox" id="facebox" style="display:none;"> <div class="facebox-popup"> <div class="facebox-content" role="dialog" aria-labelledby="facebox-header" aria-describedby="facebox-description"> </div> <button type="button" class="facebox-close js-facebox-close" aria-label="Close modal"> <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg> </button> </div> </div> </body> </html>