content
stringlengths
5
1.05M
local utils = require("utils") local drawableSprite = require("structs.drawable_sprite") local summitCloud = {} -- cloud02 does not exist local cloudTextures = { "scenery/summitclouds/cloud00", "scenery/summitclouds/cloud01", "scenery/summitclouds/cloud03" } summitCloud.name = "summitcloud" summitCloud.depth = -10550 summitCloud.placements = { name = "summit_cloud" } function summitCloud.sprite(room, entity) utils.setSimpleCoordinateSeed(entity.x, entity.y) local texture = cloudTextures[math.random(1, #cloudTextures)] local sprite = drawableSprite.fromTexture(texture, entity) local scaleX = math.random(0, 1) == 0 and -1 or 1 sprite:setScale(scaleX, 1) return sprite end return summitCloud
local headers = require'http_headers' local function dump(s) for s in s:gmatch'(.-)\r?\n' do local k, v = s:match'(.-)%s*:(.*)' end end dump[[ Accept: text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c Accept-Charset: utf-8 Accept-Encoding: gzip, deflate Accept-Language: en-US Accept-Datetime: Thu, 31 May 2007 20:35:00 GMT Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Cache-Control: no-cache Cache-control: max-age=15 Connection: keep-alive, close Cookie: $Version=1; Skin=new; Content-Length: 348 Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ== content-type: text/plain; Charset=ISO-8859_1 Date: Tue, 15 Nov 1994 08:12:31 GMT Expect: 100-continue From: user@example.com Host: en.wikipedia.org:80 If-Match: "737060cd8c284d8af7ad3082f209582d" If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT If-None-Match: "737060cd8c284d8af7ad3082f209582d" If-Range: "737060cd8c284d8af7ad3082f209582d" If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT Max-Forwards: 10 Pragma: no-cache Proxy-Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== Range: bytes=500-999 Referer: http://en.wikipedia.org/wiki/Main_Page TE: trailers, deflate Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/12.0 Via: 1.0 fred, https/1.1 example.com (Apache/1.1) Warning: 199 Miscellaneous warning X-Requested-With: XMLHttpRequest DNT: 1 (Do Not Track Enabled) X-Forwarded-For: client1, proxy1, proxy2 X-Forwarded-For: 129.78.138.66, 129.78.64.103 X-Forwarded-Proto: https Front-End-Https: on x-att-deviceid: MakeModel/Firmware x-wap-profile: http://wap.samsungmobile.com/uaprof/SGH-I777.xml Proxy-Connection: keep-alive ]] dump[[ Access-Control-Allow-Origin: * Accept-Ranges: bytes Age: 12 Allow: GET, HEAD Cache-Control: max-age=3600 Connection: close Content-Encoding: gzip Content-Language: da Content-Length: 348 Content-Location: /index.htm Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ== Content-Disposition: attachment; filename="fname.ext" Content-Range: bytes 21010-47021/47022 Content-Type: text/html; charset=utf-8 Date: Tue, 15 Nov 1994 08:12:31 GMT ETag: "737060cd8c284d8af7ad3082f209582d" Expires: Thu, 01 Dec 1994 16:00:00 GMT Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT Link: </feed>; rel="alternate" Location: http://www.w3.org/pub/WWW/People.html P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info." Pragma: no-cache Proxy-Authenticate: Basic Refresh: 5; url=http://www.w3.org/pub/WWW/People.html Retry-After: 120 Server: Apache/2.4.1 (Unix) Set-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1 Strict-Transport-Security: max-age=16070400; includeSubDomains Trailer: Max-Forwards Transfer-Encoding: chunked Vary: * Via: 1.0 fred, 1.1 example.com (Apache/1.1) Warning: 199 Miscellaneous warning WWW-Authenticate: Basic X-Frame-Options: deny X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-Powered-By: PHP/5.4.0 X-UA-Compatible: IE=EmulateIE7 X-UA-Compatible: IE=edge X-UA-Compatible: Chrome=1 ]] dump[[ Authorization: Digest username="Mufasa", realm="testrealm@host.com", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", uri="/dir/index.html", qop=auth, nc=00000001, cnonce="0a4f113b", response="6629fae49393a05397450978507c4ef1", opaque="5ccc069c403ebaf9f0171e9517f40e41" ]]
if(select(2, UnitClass('player')) ~= 'WARRIOR') then return end --GLOBAL NAMESPACE local _G = _G; --LUA local unpack = _G.unpack; local select = _G.select; local assert = _G.assert; --BLIZZARD API local UnitDebuff = _G.UnitDebuff; local parent, ns = ... local oUF = ns.oUF local ENRAGE_ID = 12880; local function getEnrageAmount() for i = 1, 40 do local _, _, _, count, _, duration, expires, _, _, _, spellID = UnitBuff("player", i) if(spellID and spellID == ENRAGE_ID) then return floor(expires), duration end end return 0,0 end local BarOnUpdate = function(self, elapsed) if not self.duration then return end self.elapsed = (self.elapsed or 0) + elapsed if self.elapsed >= 0.5 then local timeLeft = (self.duration - GetTime()) if timeLeft > 0 then self:SetValue(timeLeft) else self.start = nil self.duration = nil self:SetValue(0) self:Hide() self:SetScript("OnUpdate", nil) end end end local EnrageOnUpdate = function(self, elapsed) if not self.duration then return end self.elapsed = (self.elapsed or 0) + elapsed if self.elapsed >= 0.5 then local timeLeft = (self.duration - self.elapsed) if timeLeft > 0 then self.bar:SetValue(timeLeft) else self.start = 0; self.duration = 8; self.elapsed = 0; self.bar:SetValue(0); self:SetScript("OnUpdate", nil); self:FadeOut(); end end end local Update = function(self, event, unit) local element = self.Conqueror local enrage = element.Enrage if(element.PreUpdate) then element:PreUpdate(event) end if(enrage:IsShown()) then local start, duration = getEnrageAmount() if(duration and start and (start ~= enrage.start)) then enrage.bar:SetMinMaxValues(0, duration) enrage.bar:SetValue(duration) enrage.elapsed = 0; enrage.start = start enrage.duration = duration enrage:SetScript('OnUpdate', EnrageOnUpdate) enrage:FadeIn(); end end if(element.PostUpdate) then return element:PostUpdate(event) end end local Path = function(self, ...) return (self.Conqueror.Override or Update)(self, ...) end local ForceUpdate = function(element) return Path(element.__owner, 'ForceUpdate') end local Enable = function(self) local bar = self.Conqueror if(bar) then bar.__owner = self bar.ForceUpdate = ForceUpdate self:RegisterEvent('UNIT_AURA', Path, true) local enrage = bar.Enrage; if(enrage.bar:IsObjectType'Texture' and not enrage.bar:GetTexture()) then enrage.bar:SetTexture[[Interface\TargetingFrame\UI-StatusBar]] end enrage.bar:SetMinMaxValues(0, 100) enrage.bar:SetValue(0) enrage:FadeOut() return true end end local Disable = function(self) local bar = self.Conqueror if (bar) then self:UnregisterEvent('UNIT_AURA', Path) end end oUF:AddElement('Conqueror', Path, Enable, Disable)
------------------------------------------------------------------------ --[[ RepeaterCriterion ]]-- -- Applies a criterion to each of the inputs in a Table using the -- same target (the target is repeated). -- Useful for nn.Repeater and nn.Sequencer. ------------------------------------------------------------------------ assert(not nn.RepeaterCriterion, "update nnx package : luarocks install nnx") local RepeaterCriterion, parent = torch.class('nn.RepeaterCriterion', 'nn.Criterion') function RepeaterCriterion:__init(criterion) parent.__init(self) self.criterion = criterion self.gradInput = {} end function RepeaterCriterion:forward(inputTable, target) self.output = 0 for i,input in ipairs(inputTable) do self.output = self.output + self.criterion:forward(input, target) end return self.output end function RepeaterCriterion:backward(inputTable, target) for i,input in ipairs(inputTable) do self.gradInput[i] = nn.rnn.recursiveCopy(self.gradInput[i], self.criterion:backward(input, target)) end return self.gradInput end function RepeaterCriterion:type(type) self.gradInput = nn.rnn.recursiveType(self.gradInput) return self.criterion:type(type) end
vRPclient = Tunnel.getInterface("vRP","robberies") vRProbS = Tunnel.getInterface("robberies","robberies") vRPRob = {} Tunnel.bindInterface("robberiesC", vRPRob) Proxy.addInterface("robberiesC", vRPRob) local stores = {{id = 0, x = 27.76, y = -1339.425292968, z = 29.49702262878, robbed = false}, {id = 1, x = -43.65297698974, y = -1749.421752929, z = 29.42101478576, robbed = false}, {id = 2, x = 1126.567504882, y = -980.948669433, z = 45.415672302246, robbed = false}, {id = 3, x = 1160.589477539, y = -314.78958129882, z = 69.205055236816, robbed = false}, {id = 4, x = 2549.7866210938, y = 384.57153320312, z = 108.62294769288, robbed = false}, {id = 5, x = 2673.4716796875, y = 3286.1538085938, z = 55.241138458252, robbed = false}, {id = 6, x = 1168.6564941406, y = 2718.6403808594, z = 37.157554626464, robbed = false}, {id = 7, x = 546.70965576172, y = 2663.5910644532, z = 42.156513214112, robbed = false}, {id = 8, x = 1706.887084961, y = 4920.4985351562, z = 42.063674926758, robbed = false}, --{id = 9, x = -3047.3142089844, y = 585.82287597656, z = 7.9089288711548, robbed = false}, {id = 10, x = -3249.0600585938, y = 1003.8526611328, z = 12.830713272094, robbed = false}, {id = 11, x = -2959.1184082032, y = 387.3699645996, z = 14.043173789978, robbed = false}, {id = 12, x = -1478.8981933594, y = -375.27380371094, z = 39.163394927978, robbed = false}, {id = 13, x = -1220.5802001954, y = -916.322265625, z = 11.326298713684, robbed = false}, {id = 14, x = -709.40338134766, y = -904.8685913086, z = 19.215589523316, robbed = false}, {id = 15, x = 378.28979492188, y = 333.32037353516, z = 103.56636810302, robbed = false}} local robColors = {r = 255, g = 55, b = 0, a = 125} CONST_ROB_TIME = 90 robTime = CONST_ROB_TIME cooldownTime = 60 * 15 isNearRob = false isRobbing = false function vRPRob.setStoreCooldown(id) for k, v in ipairs(stores) do if (v.id == id) then v.robbed = true resetCD(v) return end end end function resetCD(store) Citizen.SetTimeout(cooldownTime * 1000, function() store.robbed = false end) end Citizen.CreateThread(function() while true do Citizen.Wait(1000) if (robTime > 0) then robTime = robTime - 1 end end end) Citizen.CreateThread(function() while true do Citizen.Wait(0) local ped = GetPlayerPed(-1) local pos = GetEntityCoords(ped, true) isNearRob = false for k, v in ipairs(stores) do DrawMarker(1,v.x, v.y, v.z - 1,0,0,0,0,0,0,0.8,0.8,0.8, robColors.r, robColors.g, robColors.b,robColors.a,0) local dist = Vdist(pos.x, pos.y, pos.z, v.x, v.y, v.z) if(dist < 3.0) then isNearRob = true if (isNearRob) and not (isRobbing) and not (v.robbed) then ShowInfoRevive("~y~Rob the bank press ~p~H~y~.", .35, .8) if (IsControlJustReleased(0,101)) then isRobbing = true robTime = CONST_ROB_TIME robStore(v.id) end elseif (isRobbing) and (isNearRob) then ShowInfoRevive("~y~Robbing the store. You have ~p~"..robTime.."~y~ seconds left.", .35, .8) end end end end end) function robStore(id) vRProbS.robStoreCooldown(id) Citizen.SetTimeout(CONST_ROB_TIME * 1000, function() if isNearRob and isRobbing and not IsEntityDead(GetPlayerPed(-1)) then vRProbS.robStore() end isRobbing = false end) alertPolice() end function alertPolice() local ped = GetPlayerPed(-1) local x,y,z = table.unpack(GetEntityCoords(ped, true)) local streethash = GetStreetNameAtCoord(x, y, z) local street = GetStreetNameFromHashKey(streethash) TriggerEvent("DispatchRobbery", ped, "Attempted Robbery", "None", street) TriggerEvent("DispatchPing", x, y, z, 120) end function ShowInfoRevive(text, x, y) SetTextFont(0) SetTextScale(0.4, 0.4) SetTextColour(255, 255, 255, 255) SetTextEntry("STRING") AddTextComponentString(text) DrawText(x, y) end
---------------- -- Shop class -- ---------------- local File = require 'src/File' local UI = require 'src/ui/UI' local ShopItem = require 'src/shop/ShopItem' local Coin = require 'src/Coin' local Shop = { temperature = 0, money = 0, totalMoney = 0, highestScore = 0, -- Lists circleList = {}, coinsList = {}, itemsList = {}, -- Coins items coinsPickedOnHover = false, coinSpawnTime = 0, coinScale = 3, coinsValue = 5, coinsMovement = false, -- Circle items circleRandomInitialPosition = false, numberOfCircles = 1, -- other items mouseScale = 1, circleSpeed = 30, circleSize = 5 } function Shop.update() local newShop = {} -- Insert items upgrades for tempo, item in ipairs(Shop.itemsList) do table.insert(newShop, ShopItem:new(item.type, item.level)) end Shop.itemsList = newShop -- Insert unlockable items for tempo, item in ipairs(newShop) do if item.type == 'coinsSpawnTime' and item.level > 1 then Shop.addItem('coinsMovement', 1) Shop.addItem('coinScale', 1) if playingOnMobile then Shop.addItem('coinsPickedOnHover', 2) else Shop.addItem('coinsPickedOnHover', 1) end end end Shop.setTemperature() UI.loadShopButtons() File.save() end function Shop.addItem(type, level) local alreadyExists = false for tempo, item in ipairs(Shop.itemsList) do if item.type == type then alreadyExists = true end end if not alreadyExists then table.insert(Shop.itemsList, ShopItem:new(type, level)) end end function Shop.setTemperature() Shop.temperature = 0 for tempo, item in ipairs(Shop.itemsList) do if item.level > 1 then Shop.temperature = Shop.temperature + item.temperature * (item.level-1) end end end function Shop.getItems() local filteredItems = {} for tempo, item in ipairs(Shop.itemsList) do if gameState == 'shop - cold' and item.temperature < 0 or gameState == 'shop - hot' and item.temperature > 0 then table.insert(filteredItems, item) end end return filteredItems end local moneyCooldown = 0 function Shop.receiveMoney(dt) moneyCooldown = moneyCooldown + dt + (Shop.temperature * 0.001) if moneyCooldown >= 1 then Shop.money = Shop.money + 1 Shop.totalMoney = Shop.totalMoney + 1 moneyCooldown = 0 end end local coinsTempo = 0 function Shop.spawnCoins(dt) if Shop.coinSpawnTime > 0 then coinsTempo = coinsTempo + dt if coinsTempo >= Shop.coinSpawnTime then table.insert(Shop.coinsList, Coin:new(Shop.coinScale)) coinsTempo = 0 end end end return Shop
--[[ Copyright 2016 Whizzbang Inc 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. --]] --[[ A collection of delegate functions to be passed into the DefaultPointRenderer for Pentax cameras. **Note: Unlike other point delegates, this point delegates shows all in-active focus points. I'm not sure what the means for the other delegates. Perhaps I'll update them. Perhaps I'll update this file. Notes: * Back focus button sets AFPointsInFocus to 'None' regardless of point selection mode (sucks). AFPointSelected is set correctly with either button. * For phase detection AF, the coordinates taken from the point map represent the center of each AF point. 2017.03.29 - roguephysicist: works for Pentax K-50 with both phase and contrast detection --]] local LrStringUtils = import "LrStringUtils" local LrErrors = import 'LrErrors' require "Utils" PentaxDelegates = {} PentaxDelegates.focusPointsMap = nil PentaxDelegates.focusPointDimen = nil function PentaxDelegates.getAfPoints(photo, metaData) local focusMode = ExifUtils.findFirstMatchingValue(metaData, { "Focus Mode" }) focusMode = splitTrim(focusMode, " ") local result = nil if focusMode[1] == "AF-A" or focusMode[1] == "AF-C" or focusMode[1] == "AF-S" then result = PentaxDelegates.getAfPointsPhase(photo, metaData) elseif focusMode[1] == "Contrast-detect" then result = PentaxDelegates.getAfPointsContrast(photo, metaData) elseif focusMode[1] == "Manual" then LrErrors.throwUserError("Manual focus: no useful focusing information found.") else LrErrors.throwUserError("Could not determine the focus mode of the camera.") end return result end --[[ -- photo - the photo LR object -- metaData - the metadata as read by exiftool --]] function PentaxDelegates.getAfPointsPhase(photo, metaData) local afPointsSelected = ExifUtils.findFirstMatchingValue(metaData, { "AF Point Selected" }) if afPointsSelected == nil then afPointsSelected = {} else afPointsSelected = splitTrim(afPointsSelected, ";") -- pentax separates with ';' afPointsSelected = PentaxDelegates.fixCenter(afPointsSelected) end local afPointsInFocus = ExifUtils.findFirstMatchingValue(metaData, { "AF Points In Focus" }) if afPointsInFocus == nil then afPointsInFocus = {} else afPointsInFocus = splitTrim(afPointsInFocus, ",") afPointsInFocus = PentaxDelegates.fixCenter(afPointsInFocus) end local result = { pointTemplates = DefaultDelegates.pointTemplates, points = {} } for key,value in pairs(PentaxDelegates.focusPointsMap) do local pointsMap = PentaxDelegates.focusPointsMap[key] local x = pointsMap[1] local y = pointsMap[2] local width local height if (#pointsMap > 2) then width = pointsMap[3] height = pointsMap[4] else width = PentaxDelegates.focusPointDimen[1] height = PentaxDelegates.focusPointDimen[2] end local pointType = DefaultDelegates.POINTTYPE_AF_INACTIVE local isInFocus = arrayKeyOf(afPointsInFocus, key) ~= nil local isSelected = arrayKeyOf(afPointsSelected, key) ~= nil if isInFocus and isSelected then pointType = DefaultDelegates.POINTTYPE_AF_SELECTED_INFOCUS elseif isInFocus then pointType = DefaultDelegates.POINTTYPE_AF_INFOCUS elseif isSelected then pointType = DefaultDelegates.POINTTYPE_AF_SELECTED end table.insert(result.points, { pointType = pointType, x = x, y = y, width = width, height = height }) end return result end --[[ Function to get the autofocus points and focus size of the camera when shot in liveview mode returns typical points table --]] function PentaxDelegates.getAfPointsContrast(photo, metaData) local imageSize = ExifUtils.findFirstMatchingValue(metaData, { "Default Crop Size" }) imageSize = splitTrim(imageSize, " ") -- Can image size be obtained from lightroom directly? Or is accessing the metadata faster? local result = { pointTemplates = DefaultDelegates.pointTemplates, points = {} } local contrastAfMode = ExifUtils.findFirstMatchingValue(metaData, { "AF Point Selected" }) contrastAfMode = splitTrim(contrastAfMode, ";") -- pentax separates with ';' local faceDetectSize = ExifUtils.findFirstMatchingValue(metaData, { "Face Detect Frame Size" }) faceDetectSize = splitTrim(faceDetectSize, " ") local facesDetected = ExifUtils.findFirstMatchingValue(metaData, { "Faces Detected" }) facesDetected = tonumber(facesDetected) if (contrastAfMode[1] == "Face Detect AF" and facesDetected > 0) then local faces = {} for face=1,facesDetected do local facePosition = ExifUtils.findFirstMatchingValue(metaData, { "Face " .. face .. " Position" }) facePosition = splitTrim(facePosition, " ") local faceSize = ExifUtils.findFirstMatchingValue(metaData, { "Face " .. face .. " Size" }) faceSize = splitTrim(faceSize, " ") faces[face] = {facePosition, faceSize} local afAreaXPosition = faces[face][1][1]*imageSize[1]/faceDetectSize[1] local afAreaYPosition = faces[face][1][2]*imageSize[2]/faceDetectSize[2] local afAreaWidth = faces[face][2][1]*imageSize[1]/faceDetectSize[1] local afAreaHeight = faces[face][2][2]*imageSize[2]/faceDetectSize[2] if afAreaWidth > 0 and afAreaHeight > 0 then table.insert(result.points, { pointType = DefaultDelegates.POINTTYPE_FACE, x = afAreaXPosition, y = afAreaYPosition, width = afAreaWidth, height = afAreaHeight }) end end elseif (contrastAfMode[1] == "Face Detect AF" and facesDetected == 0) then LrErrors.throwUserError("Face Detect AF mode enabled, but no faces detected.") else -- 'Automatic Tracking AF', 'Fixed Center', 'AF Select' local contrastDetectArea = ExifUtils.findFirstMatchingValue(metaData, { "Contrast Detect AF Area" }) contrastDetectArea = splitTrim(contrastDetectArea, " ") local afAreaXPosition = (contrastDetectArea[1]+0.5*contrastDetectArea[3])*imageSize[1]/faceDetectSize[1] local afAreaYPosition = (contrastDetectArea[2]+0.5*contrastDetectArea[4])*imageSize[2]/faceDetectSize[2] local afAreaWidth = contrastDetectArea[3]*imageSize[1]/faceDetectSize[1] local afAreaHeight = contrastDetectArea[4]*imageSize[2]/faceDetectSize[2] if afAreaWidth > 0 and afAreaHeight > 0 then table.insert(result.points, { pointType = DefaultDelegates.POINTTYPE_FACE, x = afAreaXPosition, y = afAreaYPosition, width = afAreaWidth, height = afAreaHeight }) end end return result end function PentaxDelegates.fixCenter(points) for k,v in pairs(points) do if v == 'Center (vertical)' or v == 'Center (horizontal)' or v == 'Fixed Center' then points[k] = 'Center' end end return points end
-- Scan a dir local function scandir(directory) local i, t, popen = 0, {}, io.popen local pfile = popen('ls "' .. directory .. '"') for filename in pfile:lines() do i = i + 1 t[i] = filename end pfile:close() return t end local t = scandir("themes") for i = 1, #t do t[i] = t[i]:gsub(".lua", "") local cp = require(string.format("themes/%s", t[i])) cp["scheme-name"] = t[i] cp.gitsigns = cp.gitsigns or cp.diff cp.magenta = cp.magenta or cp.syntax.keyword cp.cyan = cp.cyan or cp.accent cp.blue = cp.blue or cp.accent local json_cp = require("json").encode(cp) local file = io.open(string.format("generated_templates/%s.json", t[i]), "w") file:write(json_cp) file:close() end
TagColor = {id = "color", type="wide"} TagColor.__index = TagColor function TagColor:Create(color) local this = { mColor = color } print("Color tag made with value", this.mColor) setmetatable(this, self) return this end function TagColor:AdjustColor(c) -- Don't write into the alpha c:SetXyzw(self.mColor:X(), self.mColor:Y(), self.mColor:Z(), c:W()) return c end function TagColor:Enter() end function TagColor:Exit() end function TagColor:Reset() end
local C = require('erde.constants') -- ----------------------------------------------------------------------------- -- Expr -- ----------------------------------------------------------------------------- local Expr = { ruleName = 'Expr' } -- ----------------------------------------------------------------------------- -- Parse -- ----------------------------------------------------------------------------- function Expr.parse(ctx, opts) local minPrec = opts and opts.minPrec or 1 local node = { ruleName = Expr.ruleName } local lhs if C.UNOPS[ctx.token] then ctx:consume() node.variant = 'unop' node.operand = ctx:Expr({ minPrec = C.UNOPS[ctx.token].prec + 1 }) node.op = ctx:consume() else node = ctx:Terminal() end while true do local binop = C.BINOPS[ctx.token] if not binop or binop.prec < minPrec then break end ctx:consume() node = { ruleName = Expr.ruleName, variant = 'binop', op = binop, node, } if binop.tag == 'ternary' then ctx.isTernaryExpr = true node[#node + 1] = ctx:Expr() ctx.isTernaryExpr = false assert(ctx.token == ':') end node[#node + 1] = binop.assoc == C.LEFT_ASSOCIATIVE and ctx:Expr({ minPrec = binop.prec + 1 }) or ctx:Expr({ minPrec = binop.prec }) end if ctx.token == '>>' then return ctx:Pipe({ initValues = { node }, }) end return node end -- ----------------------------------------------------------------------------- -- Compile -- ----------------------------------------------------------------------------- function Expr.compile(ctx, node) local op = node.op if node.variant == 'unop' then local operand = ctx:compile(node.operand) local function compileUnop(token) return table.concat({ token, operand }, ' ') end if op.tag == 'bnot' then return _VERSION:find('5.[34]') and compileUnop('~') or ('require("bit").bnot(%1)'):format(operand) elseif op.tag == 'not' then return compileUnop('not') else return op.token .. operand end elseif node.variant == 'binop' then local lhs = ctx:compile(node[1]) local rhs = ctx:compile(node[2]) if op.tag == 'ternary' then return table.concat({ '(function()', 'if %s then', 'return %s', 'else', 'return %s', 'end', 'end)()', }, '\n'):format(lhs, rhs, ctx:compile(node[3])) else return ctx:compileBinop(op, lhs, rhs) end end end -- ----------------------------------------------------------------------------- -- Return -- ----------------------------------------------------------------------------- return Expr
if ( SERVER ) then AddCSLuaFile("sh_config_cc.lua") AddCSLuaFile("cc/cl_vgui.lua") include("sh_config_cc.lua") include("cc/sv_cc.lua") include("cc/sv_hooks.lua") end if ( CLIENT ) then include("sh_config_cc.lua") include("cc/cl_vgui.lua") end
TOOL.Category = "Construction" TOOL.Name = "#tool.emitter.name" TOOL.ClientConVar[ "key" ] = "51" TOOL.ClientConVar[ "delay" ] = "1" TOOL.ClientConVar[ "toggle" ] = "1" TOOL.ClientConVar[ "starton" ] = "0" TOOL.ClientConVar[ "effect" ] = "sparks" TOOL.ClientConVar[ "scale" ] = "1" TOOL.Information = { { name = "left" }, { name = "right" } } cleanup.Register( "emitters" ) function TOOL:LeftClick( trace, worldweld ) if ( trace.Entity && trace.Entity:IsPlayer() ) then return false end -- If there's no physics object then we can't constraint it! if ( SERVER && !util.IsValidPhysicsObject( trace.Entity, trace.PhysicsBone ) ) then return false end if ( CLIENT ) then return true end local ply = self:GetOwner() local key = self:GetClientNumber( "key" ) local effect = self:GetClientInfo( "effect" ) local toggle = self:GetClientNumber( "toggle" ) == 1 local starton = self:GetClientNumber( "starton" ) == 1 local scale = math.Clamp( self:GetClientNumber( "scale" ), 0.1, 6 ) local delay = math.Clamp( self:GetClientNumber( "delay" ), 0.05, 20 ) -- We shot an existing emitter - just change its values if ( IsValid( trace.Entity ) && trace.Entity:GetClass() == "gmod_emitter" && trace.Entity.pl == ply ) then trace.Entity:SetEffect( effect ) trace.Entity:SetDelay( delay ) trace.Entity:SetToggle( toggle ) trace.Entity:SetScale( scale ) numpad.Remove( trace.Entity.NumDown ) numpad.Remove( trace.Entity.NumUp ) trace.Entity.NumDown = numpad.OnDown( ply, key, "Emitter_On", trace.Entity ) trace.Entity.NumUp = numpad.OnUp( ply, key, "Emitter_Off", trace.Entity ) trace.Entity.key = key return true end if ( !self:GetSWEP():CheckLimit( "emitters" ) ) then return false end local pos = trace.HitPos if ( trace.Entity != NULL && ( !trace.Entity:IsWorld() || worldweld ) ) then else pos = pos + trace.HitNormal end local ang = trace.HitNormal:Angle() ang:RotateAroundAxis( trace.HitNormal, 0 ) local emitter = MakeEmitter( ply, key, delay, toggle, effect, starton, nil, scale, { Pos = pos, Angle = ang } ) undo.Create( "Emitter" ) undo.AddEntity( emitter ) -- Don't weld to world if ( trace.Entity != NULL && ( !trace.Entity:IsWorld() || worldweld ) ) then local weld = constraint.Weld( emitter, trace.Entity, 0, trace.PhysicsBone, 0, true, true ) if ( IsValid( emitter:GetPhysicsObject() ) ) then emitter:GetPhysicsObject():EnableCollisions( false ) end emitter.nocollide = true ply:AddCleanup( "emitters", weld ) undo.AddEntity( weld ) end undo.SetPlayer( ply ) undo.Finish() return true end function TOOL:RightClick( trace ) return self:LeftClick( trace, true ) end if ( SERVER ) then function MakeEmitter( ply, key, delay, toggle, effect, starton, nocollide, scale, Data ) if ( IsValid( ply ) && !ply:CheckLimit( "emitters" ) ) then return nil end local emitter = ents.Create( "gmod_emitter" ) if ( !IsValid( emitter ) ) then return false end duplicator.DoGeneric( emitter, Data ) emitter:SetEffect( effect ) emitter:SetPlayer( ply ) emitter:SetDelay( delay ) emitter:SetToggle( toggle ) emitter:SetOn( starton ) emitter:SetScale( scale or 1 ) emitter:Spawn() DoPropSpawnedEffect( emitter ) emitter.NumDown = numpad.OnDown( ply, key, "Emitter_On", emitter ) emitter.NumUp = numpad.OnUp( ply, key, "Emitter_Off", emitter ) if ( nocollide && IsValid( emitter:GetPhysicsObject() ) ) then emitter:GetPhysicsObject():EnableCollisions( false ) end local ttable = { key = key, delay = delay, toggle = toggle, effect = effect, pl = ply, nocollide = nocollide, starton = starton, scale = scale } table.Merge( emitter:GetTable(), ttable ) if ( IsValid( ply ) ) then ply:AddCount( "emitters", emitter ) ply:AddCleanup( "emitters", emitter ) end return emitter end duplicator.RegisterEntityClass( "gmod_emitter", MakeEmitter, "key", "delay", "toggle", "effect", "starton", "nocollide", "scale", "Data" ) end function TOOL:UpdateGhostEmitter( ent, pl ) if ( !IsValid( ent ) ) then return end local trace = pl:GetEyeTrace() if ( !trace.Hit || IsValid( trace.Entity ) && ( trace.Entity:GetClass() == "gmod_emitter" || trace.Entity:IsPlayer() ) ) then ent:SetNoDraw( true ) return end ent:SetPos( trace.HitPos ) ent:SetAngles( trace.HitNormal:Angle() ) ent:SetNoDraw( false ) end function TOOL:Think() if ( !IsValid( self.GhostEntity ) || self.GhostEntity:GetModel() != "models/props_lab/tpplug.mdl" ) then self:MakeGhostEntity( "models/props_lab/tpplug.mdl", vector_origin, angle_zero ) end self:UpdateGhostEmitter( self.GhostEntity, self:GetOwner() ) end local ConVarsDefault = TOOL:BuildConVarList() function TOOL.BuildCPanel( CPanel ) CPanel:AddControl( "Header", { Description = "#tool.emitter.desc" } ) CPanel:AddControl( "ComboBox", { MenuButton = 1, Folder = "emitter", Options = { [ "#preset.default" ] = ConVarsDefault }, CVars = table.GetKeys( ConVarsDefault ) } ) CPanel:AddControl( "Numpad", { Label = "#tool.emitter.key", Command = "emitter_key" } ) CPanel:AddControl( "Slider", { Label = "#tool.emitter.delay", Command = "emitter_delay", Type = "Float", Min = 0.01, Max = 2 } ) CPanel:AddControl( "Slider", { Label = "#tool.emitter.scale", Command = "emitter_scale", Type = "Float", Min = 0, Max = 6, Help = true } ) CPanel:AddControl( "Checkbox", { Label = "#tool.emitter.toggle", Command = "emitter_toggle" } ) CPanel:AddControl( "Checkbox", { Label = "#tool.emitter.starton", Command = "emitter_starton" } ) local matselect = CPanel:MatSelect( "emitter_effect", nil, true, 0.25, 0.25 ) for k, v in pairs( list.Get( "EffectType" ) ) do matselect:AddMaterialEx( v.print, v.material or "gui/effects/default.png", k, { emitter_effect = k } ) end CPanel:AddItem( matselect ) end
require("utils") local vector = require("hump.vector") local Class = require("hump.class") local Logo = Class{function(self, img, time, quadData) self.image = img self.time = time if quadData then quadData = {quadData[1], quadData[2], quadData[3], quadData[4], self.image:getWidth(), self.image:getHeight()} else quadData = quadData or {0, 0, self.image:getWidth(), self.image:getHeight(), self.image:getWidth(), self.image:getHeight()} end self.quad = love.graphics.newQuad(quadData[1], quadData[2], quadData[3], quadData[4], quadData[5], quadData[6]) self.currentTime = 0 self.isFinished = false self.onUpdate = function(dt) end self.onFinished = function() end end} function Logo:update(dt) if self.isFinished then return end self.currentTime = self.currentTime + dt if self.currentTime >= self.time then self.isFinished = true if self.onFinished then self:onFinished() end end if self.onUpdate then self.onUpdate(self, dt) end end function Logo:draw() love.graphics.setColor(255, 255, 255, 255) local qx, qy, qw, qh = self.quad:getViewport() local x = (love.graphics.getWidth() / 2) - (qw / 2) local y = (love.graphics.getHeight() / 2) - (qh / 2) love.graphics.drawq(self.image, self.quad, x, y) if self.onDraw then self:onDraw(self) end end return Logo
local ReplicatedStorage = game:GetService("ReplicatedStorage") local TestEZ = require(ReplicatedStorage.DevPackages.TestEZ) TestEZ.TestBootstrap:run( { ReplicatedStorage.Packages.Rodux }, TestEZ.Reporters.TextReporter )
local util = require "formatter.util" return function() return { exe = "eslint_d", args = { "--stdin", "--stdin-filename", util.escape_path(util.get_current_buffer_file_path()), "--fix-to-stdout", }, stdin = true, try_node_modules = true, } end
[[0x5600, ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ ]]
-- local VPPP_UnitNetworkHandler_sync_grenades_cooldown = UnitNetworkHandler.sync_grenades_cooldown -- function UnitNetworkHandler:sync_grenades_cooldown(end_time, duration, sender) -- log("UnitNetworkHandler:sync_grenades_cooldown") -- local peer = self._verify_sender(sender) -- local is_local_player = managers.network:session():local_peer() == peer -- local grenade, amount = managers.blackmarket:equipped_grenade() -- local nade_tweak = tweak_data.blackmarket.projectiles[grenade] -- local is_using_custom_injector = nade_tweak.custom and nade_tweak.base_cooldown -- local is_on_real_cooldown = amount < nade_tweak.max_amount -- mx_print_table({ -- is_local_player = is_local_player, -- is_using_custom_injector = is_using_custom_injector, -- is_on_real_cooldown = is_on_real_cooldown, -- }) -- if is_local_player and is_using_custom_injector and is_on_real_cooldown then -- log('CUSTOM sync_grenades_cooldown') -- -- get_timer_remaining -- return -- Do not use host sync -- end -- return VPPP_UnitNetworkHandler_sync_grenades_cooldown(self, end_time, duration, sender) -- end
COMMAND.name = 'Changelevel' COMMAND.description = 'command.changelevel.description' COMMAND.syntax = 'command.changelevel.syntax' COMMAND.permission = 'moderator' COMMAND.category = 'permission.categories.server_management' COMMAND.arguments = 1 COMMAND.alias = 'map' function COMMAND:on_run(player, map, delay) map = tostring(map) or 'gm_construct' delay = tonumber(delay) or 0 self:notify_staff('command.changelevel.message', { player = get_player_name(player), map = map, delay = delay }) timer.simple(delay, function() RunConsoleCommand('changelevel', map) end) end
-- local dbg = require("debugger") -- dbg.auto_where = 2 local stub_vim = require'spec.helpers.stub_vim'.stub_vim local execute = require'selection_command'.execute local api = require'nvimapi' local get_selection = require'context'.get_selection describe("sort a list", function() -- 0....+....1....+....2. stub_vim{lines = {"prefix ['y', 'z', 'x'] suffix"}, selection = {{1, 20}, {1, 8}}} -- N.B. order is not important for cols, index 0 based local selection = get_selection()[1] it("will find the correct selection", function() assert.is_equal(1, selection.lnb) assert.is_equal("'y', 'z', 'x'", selection.chunk.chunk()) end) describe("sort it", function() execute('sort', ', ') it("will change it", function() assert.is_equal("prefix ['x', 'y', 'z'] suffix", api.line_at(1)) end) end) end) describe("nop", function() stub_vim{lines = {"prefix ['y', 'z', 'x'] suffix"}, selection = {{1, 20}, {1, 8}}} -- N.B. order is not important for cols, index 0 based local selection = get_selection()[1] describe("undefined command", function() execute('no op') it("will not change anything", function() assert.are.same({"prefix ['y', 'z', 'x'] suffix"}, api.buffer()) end) end) end)
local sprite = require "engine.sprite" local TestZone = require "scenes.test_zone" local NorthCity = require "scenes.north_city" -- it's the main menu! local MainMenu = {} local center_x = love.graphics.getWidth() / 2 -- i feel like there's a better way to do this probably? im not good at lua local title_y = 150 local subtitle_font = love.graphics.newFont(32) local subtitle_text = "Hit enter to start!" local subtitle_x = center_x - (subtitle_font:getWidth(subtitle_text) / 2) local subtitle_y = love.graphics.getHeight() - (title_y + subtitle_font:getHeight(subtitle_text)) function MainMenu:enter() love.graphics.setBackgroundColor(230, 230, 230) clouds = sprite.Sprite("assets/images/bg_cloud.png") -- define the title sprite then use its width to set its x pos title = sprite.Sprite("assets/images/title.png") local title_x = center_x - (title:getWidth() / 2) title:setPos(title_x, title_y) end function MainMenu:draw() clouds:draw() title:draw() love.graphics.setColor(0, 0, 0, 255) love.graphics.setFont(subtitle_font) love.graphics.print(subtitle_text, subtitle_x, subtitle_y) love.graphics.setColor(255, 255, 255, 255) end function MainMenu:keypressed(key) if key == "return" then Gamestate.switch(NorthCity) -- secret! elseif debug and key == "t" then Gamestate.switch(TestZone) end end return MainMenu
local nmap = require "nmap" local shortport = require "shortport" local table = require "table" local stdnse = require "stdnse" local string = require "string" local sslcert = require "sslcert" local sslv2 = require "sslv2" local vulns = require "vulns" description = [[ Determines whether the server supports SSLv2, what ciphers it supports and tests for CVE-2015-3197, CVE-2016-0703 and CVE-2016-0800 (DROWN) ]] author = "Bertrand Bonnefoy-Claudet <bertrand@cryptosense.com>" license = "Same as Nmap--See https://nmap.org/book/man-legal.html" -- We can use the set of ciphers detected by sslv2.nse to avoid 1 handshake dependencies = {"sslv2"} categories = {"intrusive", "vuln"} --- -- @output -- 443/tcp open https -- | sslv2-drown: -- | ciphers: -- | SSL2_DES_192_EDE3_CBC_WITH_MD5 -- | SSL2_IDEA_128_CBC_WITH_MD5 -- | SSL2_RC2_128_CBC_WITH_MD5 -- | SSL2_RC4_128_WITH_MD5 -- | SSL2_DES_64_CBC_WITH_MD5 -- | forced_ciphers: -- | SSL2_RC2_128_CBC_EXPORT40_WITH_MD5 -- | SSL2_RC4_128_EXPORT40_WITH_MD5 -- | vulns: -- | CVE-2016-0800: -- | title: OpenSSL: Cross-protocol attack on TLS using SSLv2 (DROWN) -- | state: VULNERABLE -- | ids: -- | CVE:CVE-2016-0800 -- | description: -- | The SSLv2 protocol, as used in OpenSSL before 1.0.1s and 1.0.2 before 1.0.2g and -- | other products, requires a server to send a ServerVerify message before establishing -- | that a client possesses certain plaintext RSA data, which makes it easier for remote -- | attackers to decrypt TLS ciphertext data by leveraging a Bleichenbacher RSA padding -- | oracle, aka a "DROWN" attack. -- | -- | refs: -- | https://www.openssl.org/news/secadv/20160301.txt -- |_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-0800 -- -- @xmloutput -- <table key="ciphers"> -- <elem>SSL2_DES_192_EDE3_CBC_WITH_MD5</elem> -- <elem>SSL2_IDEA_128_CBC_WITH_MD5</elem> -- <elem>SSL2_RC2_128_CBC_WITH_MD5</elem> -- <elem>SSL2_RC4_128_WITH_MD5</elem> -- <elem>SSL2_DES_64_CBC_WITH_MD5</elem> -- </table> -- <table key="forced_ciphers"> -- <elem>SSL2_RC2_128_CBC_EXPORT40_WITH_MD5</elem> -- <elem>SSL2_RC4_128_EXPORT40_WITH_MD5</elem> -- </table> -- <table key="vulns"> -- <table key="CVE-2016-0800"> -- <elem key="title">OpenSSL: Cross-protocol attack on TLS using SSLv2 (DROWN)</elem> -- <elem key="state">VULNERABLE</elem> -- <table key="ids"> -- <elem>CVE:CVE-2016-0800</elem> -- </table> -- <table key="description"> -- <elem> -- The SSLv2 protocol, as used in OpenSSL before 1.0.1s and 1.0.2 before -- 1.0.2g and other products, requires a server to send a ServerVerify -- message before establishing that a client possesses certain plaintext -- RSA data, which makes it easier for remote attackers to decrypt TLS -- ciphertext data by leveraging a Bleichenbacher RSA padding oracle, aka -- a "DROWN" attack. -- </elem> -- </table> -- <table key="refs"> -- <elem>https://www.openssl.org/news/secadv/20160301.txt</elem> -- <elem>https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-0800</elem> -- </table> -- </table> -- </table> -- Those ciphers are weak enough to enable a "General DROWN" attack. local GENERAL_DROWN_CIPHERS = {} for k, v in pairs(sslv2.SSL_CIPHERS) do -- 40 bits or less, or single-DES (56 bits) if v.encrypted_key_length <= 5 or v.str:find("DES_64") then GENERAL_DROWN_CIPHERS[v.str] = true end end portrule = function(host, port) return shortport.ssl(host, port) or sslcert.getPrepareTLSWithoutReconnect(port) end -- Return whether all values of "t1" are also values in "t2". local function values_in(t1, t2) local set = {} for _, e in pairs(t2) do set[e] = true end for _, e in pairs(t1) do if not set[e] then return false end end return true end -- Create a socket ready to begin an SSL negotiation and send client_hello local function do_setup(host, port) local timeout = stdnse.get_timeout(host, 10000, 5000) local status, socket, err local starttls = sslcert.getPrepareTLSWithoutReconnect(port) if starttls then status, socket = starttls(host, port) if not status then stdnse.debug(1, "Can't connect using STARTTLS: %s", socket) return nil end else socket = nmap.new_socket() socket:set_timeout(timeout) status, err = socket:connect(host, port) if not status then stdnse.debug(1, "Can't connect: %s", err) return nil end end socket:set_timeout(timeout) socket:send(sslv2.client_hello(stdnse.keys(sslv2.SSL_CIPHER_CODES))) local status, buffer = sslv2.record_buffer(socket) if not status then socket:close() return false end return socket, buffer end local function try_force_cipher(host, port, cipher) local socket, buffer = do_setup(host, port) if not socket then return false end local i, server_hello = sslv2.record_read(buffer) local code = sslv2.SSL_CIPHER_CODES[cipher] local key_length = sslv2.SSL_CIPHERS[code].key_length local encrypted_key_length = sslv2.SSL_CIPHERS[code].encrypted_key_length local dummy_key = string.rep("\0", key_length) local clear_key = dummy_key:sub(1, key_length - encrypted_key_length) local encrypted_key = dummy_key:sub(key_length - encrypted_key_length + 1) local dummy_client_master_key = sslv2.client_master_secret(cipher, clear_key, encrypted_key) socket:send(dummy_client_master_key) local status, buffer = sslv2.record_buffer(socket, buffer, i) socket:close() if not status then return false end local i, message = sslv2.record_read(buffer, i) -- Treat an error as a failure to force the cipher. if not message or message.message_type == sslv2.SSL_MESSAGE_TYPES.ERROR then return false end return true end local function has_extra_clear_bug(host, port, cipher) local socket, buffer = do_setup(host, port) if not socket then return false end local i, server_hello = sslv2.record_read(buffer) local code = sslv2.SSL_CIPHER_CODES[cipher] local key_length = sslv2.SSL_CIPHERS[code].key_length local encrypted_key_length = sslv2.SSL_CIPHERS[code].encrypted_key_length -- The length of clear_key is intentionally wrong to highlight the bug. local clear_key = string.rep("\0", key_length - encrypted_key_length + 1) local encrypted_key = string.rep("\0", encrypted_key_length) local dummy_client_master_key = sslv2.client_master_secret(cipher, clear_key, encrypted_key) socket:send(dummy_client_master_key) local status, buffer, err = sslv2.record_buffer(socket, buffer, i) socket:close() if not status then return false end local i, message = sslv2.record_read(buffer, i) -- Treat an error as a failure to force the cipher. if not message or message.message_type == sslv2.SSL_MESSAGE_TYPES.ERROR then return false end return true end local function registry_get(host, port) if host.registry.sslv2 then return host.registry.sslv2[port.number .. port.protocol] end end local function unique (t) local tc = {}; for k,v in ipairs(t) do tc[v] = true; end return tc; end function action(host, port) local output = stdnse.output_table() local report = vulns.Report:new("sslv2-drown", host, port) local cve_2015_3197 = { title = "OpenSSL: SSLv2 doesn't block disabled ciphers", state = vulns.STATE.NOT_VULN, IDS = { CVE = 'CVE-2015-3197', }, risk_factor = "Low", description = [[ ssl/s2_srvr.c in OpenSSL 1.0.1 before 1.0.1r and 1.0.2 before 1.0.2f does not prevent use of disabled ciphers, which makes it easier for man-in-the-middle attackers to defeat cryptographic protection mechanisms by performing computations on SSLv2 traffic, related to the get_client_master_key and get_client_hello functions. ]], references = { "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-3197", "https://www.openssl.org/news/secadv/20160128.txt", }, } local cve_2016_0703 = { title = "OpenSSL: Divide-and-conquer session key recovery in SSLv2", state = vulns.STATE.NOT_VULN, IDS = { CVE = 'CVE-2016-0703', }, risk_factor = "High", description = [[ The get_client_master_key function in s2_srvr.c in the SSLv2 implementation in OpenSSL before 0.9.8zf, 1.0.0 before 1.0.0r, 1.0.1 before 1.0.1m, and 1.0.2 before 1.0.2a accepts a nonzero CLIENT-MASTER-KEY CLEAR-KEY-LENGTH value for an arbitrary cipher, which allows man-in-the-middle attackers to determine the MASTER-KEY value and decrypt TLS ciphertext data by leveraging a Bleichenbacher RSA padding oracle, a related issue to CVE-2016-0800. ]], references = { "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-0703", "https://www.openssl.org/news/secadv/20160301.txt", }, } local cve_2016_0800 = { title = "OpenSSL: Cross-protocol attack on TLS using SSLv2 (DROWN)", state = vulns.STATE.NOT_VULN, IDS = { CVE = 'CVE-2016-0800', }, risk_factor = "High", description = [[ The SSLv2 protocol, as used in OpenSSL before 1.0.1s and 1.0.2 before 1.0.2g and other products, requires a server to send a ServerVerify message before establishing that a client possesses certain plaintext RSA data, which makes it easier for remote attackers to decrypt TLS ciphertext data by leveraging a Bleichenbacher RSA padding oracle, aka a "DROWN" attack. ]], references = { "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-0800", "https://www.openssl.org/news/secadv/20160301.txt", }, } local offered_ciphers = registry_get(host, port) or sslv2.test_sslv2(host, port) if not offered_ciphers then output.vulns = report:make_output() return output end if next(offered_ciphers) then output.ciphers = offered_ciphers end -- CVE-2015-3197 local forced_ciphers = {} local all_ciphers = unique(offered_ciphers) for cipher, code in pairs(sslv2.SSL_CIPHER_CODES) do if not all_ciphers[cipher] and try_force_cipher(host, port, cipher) then all_ciphers[cipher] = true table.insert(forced_ciphers, cipher) end end if next(forced_ciphers) then output.forced_ciphers = forced_ciphers cve_2015_3197.state = vulns.STATE.VULN end -- CVE-2016-0703 local cipher, _ = next(all_ciphers) local result = has_extra_clear_bug(host, port, cipher) if result then cve_2016_0703.state = vulns.STATE.VULN end -- CVE-2016-0800 local has_weak_ciphers = false for cipher, _ in pairs(all_ciphers) do if GENERAL_DROWN_CIPHERS[cipher] then has_weak_ciphers = true break end end if has_weak_ciphers or cve_2016_0703.state == vulns.STATE.VULN then cve_2016_0800.state = vulns.STATE.VULN end report:add_vulns(cve_2015_3197) report:add_vulns(cve_2016_0703) report:add_vulns(cve_2016_0800) output.vulns = report:make_output() return output end
object_mobile_som_blistmok = object_mobile_som_shared_blistmok:new { } ObjectTemplates:addTemplate(object_mobile_som_blistmok, "object/mobile/som/blistmok.iff")
object_tangible_tcg_series8_diorama_exogorth_crater = object_tangible_tcg_series8_shared_diorama_exogorth_crater:new { } ObjectTemplates:addTemplate(object_tangible_tcg_series8_diorama_exogorth_crater, "object/tangible/tcg/series8/diorama_exogorth_crater.iff")
GButton = class('GButton', GComponent) local getters = GButton.getters local setters = GButton.setters GButton.UP = "up" GButton.DOWN = "down" GButton.OVER = "over" GButton.SELECTED_OVER = "selectedOver" GButton.DISABLED = "disabled" GButton.SELECTED_DISABLED = "selectedDisabled" function GButton:ctor() GButton.super.ctor(self) self.sound = UIConfig.buttonSound self.soundVolumeScale = UIConfig.buttonSoundVolumeScale self.changeStateOnClick = true self._mode = 0 self._selected = false self._downEffect = 0 self._downEffectValue = 0.8 self._downScaled = false self._down = false self._over = false end function getters:icon() return self._icon end function setters:icon(value) self._icon = value if self._selected and self._selectedIcon~=nil then value = self._selectedIcon else value = self._icon end if self._iconObject then self._iconObject.icon = value end self:updateGear(7) end function getters:title() return self._title end function setters:title(value) self._title = value if self._selected and self._selectedIcon~=nil then value = self._selectedTitle else value = self._title end if self._titleObject then self._titleObject.text = value end self:updateGear(8) end function getters:text() return self._title end function setters:text(value) self.title = value end function getters:selectedIcon() return self._selectedIcon end function setters:selectedIcon(value) self._selectedIcon = value if self._selected and self._selectedIcon~=nil then value = self._selectedIcon else value = self._icon end if self._iconObject then self._iconObject.icon = value end end function getters:selectedTitle() return self._selectedTitle end function setters:selectedTitle(value) self._selectedTitle = value if self._selected and self._selectedTitle~=nil then value = self._selectedTitle else value = self._icon end if self._titleObject then self._titleObject.text = value end end function getters:titleColor() local tf = self:getTextField() if tf~=nil then return tf.color else return 0 end end function setters:titleColor(value) local tf = self:getTextField() if tf~=nil then tf.color = value end self:updateGear(4) end function getters:color() return self.titleColor end function setters:color(value) self.titleColor = value end function getters:titleFontSize() local tf = self:getTextField() if tf~=nil then return tf.size else return 0 end end function setters:titleFontSize(value) local tf = self:getTextField() if tf~=nil then tf.size = value end self:updateGear(4) end function getters:selected() return self._selected end function setters:selected(value) if self._mode == ButtonMode.Common then return end if self._selected~=value then self._selected = value self:setCurrentState() if self._selectedTitle~=nil and self._titleObject~=nil then self._titleObject.text = self._selected and self._selectedTitle or self._title end if self._selectedIcon~=nil then local str = self._selected and self._selectedIcon or self._icon if self._iconObject~=nil then self._iconObject.icon = str end end if self._relatedController~=nil and self.parent~=nil and not self.parent._buildingDisplayList then if self._selected then self._relatedController.selectedPageId = self.pageOption if self._relatedController.autoRadioGroupDepth then self.parent:adjustRadioGroupDepth(self, self._relatedController) end elseif self._mode == ButtonMode.Check and self._relatedController.selectedPageId == self.pageOption then self._relatedController.oppositePageId = self.pageOption end end end end function getters:mode() return self._mode end function setters:mode(value) if self._mode~=value then if value == ButtonMode.Common then self.selected = false end self._mode = value end end function getters:relatedController() return self._relatedController end function setters:relatedController(value) if value ~= self._relatedController then self._relatedController = value self.pageOption = nil end end function GButton:fireClick(downEffect) if downEffect and self._mode == ButtonMode.Common then self:setState(GButton.OVER) GTween.delayedCall(0.1):onComplete(function() self:setState(GButton.DOWN) end) GTween.delayedCall(0.2):onComplete(function() self:setState(GButton.UP) end) end self:_click() end function GButton:getTextField() if self._titleObject.getTextField then return self._titleObject:getTextField() else return self._titleObject end end function GButton:setState(value) if self._buttonController then self._buttonController.selectedPage = value end if self._downEffect == 1 then local cnt = self.numChildren if value == GButton.DOWN or value == GButton.SELECTED_OVER or value == GButton.SELECTED_DISABLED then local color = math.floor(self._downEffectValue*0xFFFFFF) for i=0,cnt-1 do local obj = self:getChildAt(i) if obj.color then obj.color = color end end else for i=0,cnt-1 do local obj = self:getChildAt(i) if obj.color then obj.color = 0xFFFFFF end end end elseif self._downEffect == 2 then if value == GButton.DOWN or value == GButton.SELECTED_OVER or value == GButton.SELECTED_DISABLED then if not self._downScaled then self._downScaled = true self:setScale(self.scaleX * self._downEffectValue, self.scaleY * self._downEffectValue) end else if self._downScaled then self._downScaled = false self:setScale(self.scaleX / self._downEffectValue, self.scaleY / self._downEffectValue) end end end end function GButton:setCurrentState() if self._grayed and self._buttonController~=nil and self._buttonController:hasPage(GButton.DISABLED) then if self._selected then self:setState(GButton.SELECTED_DISABLED) else self:setState(GButton.DISABLED) end else if self._selected then self:setState(self._over and GButton.SELECTED_OVER or GButton.DOWN) else self:setState(self._over and GButton.OVER or GButton.UP) end end end function GButton:handleControllerChanged(c) GButton.super.handleControllerChanged(self, c) if self._relatedController == c then self.selected = self.pageOption == c.selectedPageId end end function GButton:handleGrayedChanged() if self._buttonController ~= nil and self._buttonController:hasPage(GButton.DISABLED) then if self._grayed then if self._selected then self:setState(GButton.SELECTED_DISABLED) else self:setState(GButton.DISABLED) end else if self._selected then self:setState(GButton.DOWN) else self:setState(GButton.UP) end end else GComponent.handleGrayedChanged(self) end end function GButton:constructExtension(buffer) buffer:seek(0, 6) self._mode = buffer:readByte() local str = buffer:readS() if str~=nil then self.sound = UIPackage.getItemAssetByURL(str) end self.soundVolumeScale = buffer:readFloat() self._downEffect = buffer:readByte() self._downEffectValue = buffer:readFloat() if self._downEffect == 2 then self:setPivot(0.5, 0.5, self.pivotAsAnchor) end self._buttonController = self:getController("button") self._titleObject = self:getChild("title") self._iconObject = self:getChild("icon") if self._titleObject~=nil then self._title = self._titleObject.text end if self._iconObject~=nil then self._icon = self._iconObject.icon end if self._mode == ButtonMode.Common then self:setState(GButton.UP) end self:on('touchBegin', self._touchBegin, self) self:on('touchEnd', self._touchEnd, self) self:on('tap', self._click, self) end function GButton:setup_AfterAdd(buffer, beginPos) GObject.setup_AfterAdd(self, buffer, beginPos) if not buffer:seek(beginPos, 6) then return end if buffer:readByte() ~= self.packageItem.objectType then return end local str str = buffer:readS() if str~=nil then self.title = str end str = buffer:readS() if str~=nil then self.selectedTitle = str end str = buffer:readS() if str~=nil then self.icon = str end str = buffer:readS() if str~=nil then self.selectedIcon = str end if buffer:readBool() then self.titleColor = buffer:readColor() end local iv = buffer:readInt() if iv ~= 0 then self.titleFontSize = iv end iv = buffer:readShort() if iv >= 0 then self._relatedController = self.parent:getControllerAt(iv) end self.pageOption = buffer:readS() str = buffer:readS() if str~=nil then self.sound = UIPackage.getItemAssetByURL(str) end if buffer:readBool() then self.soundVolumeScale = buffer:readFloat() end self.selected = buffer:readBool() end function GButton:_touchBegin(context) self._down = true context:captureTouch() if self._mode == ButtonMode.Common then if self._grayed and self._buttonController ~= nil and self._buttonController:hasPage(GButton.DISABLED) then self:setState(GButton.SELECTED_DISABLED) else self:setState(GButton.DOWN) end end end function GButton:_touchEnd() if not self._down then return end self._down = false if self._mode == ButtonMode.Common then if self._grayed and self._buttonController ~= nil and self._buttonController:hasPage(GButton.DISABLED) then self:setState(GButton.DISABLED) elseif self._over then self:setState(GButton.OVER) else self:setState(GButton.UP) end else if not self._over and self._buttonController ~=nil and (self._buttonController.selectedPage == GButton.OVER or self._buttonController.selectedPage == GButton.SELECTED_OVER) then self:setCurrentState() end end end function GButton:_click() if self.sound ~= nil then self.root:playOneShotSound(self.sound, self.soundVolumeScale) end if self._mode == ButtonMode.Check then if self.changeStateOnClick then self.selected = not self._selected self:emit("statusChanged") end elseif self._mode == ButtonMode.Radio then if self.changeStateOnClick and not self._selected then self.selected = true self:emit("statusChanged") end else if self._relatedController~=nil then self._relatedController.selectedPageId = pageOption end end end
add_requires("gtest ^1.11.0", {configs={main=true, gmock=true}}) local tests = { ["any"] = { files = {"any.cpp"} }, ["entity"] = { files = {"entity.cpp"} }, ["eventchannel"] = { files = {"eventchannel.cpp"} }, ["statemachine"] = { files = {"statemachine.cpp"} }, ["storage"] = { files = {"storage.cpp"} }, ["world"] = { files = {"world.cpp"} }, } for name, cfg in pairs(tests) do target(name) set_group("tests") set_kind("binary") set_languages("cxx20") set_warnings("all") add_deps("ige") add_packages("gtest") if is_plat("windows") then add_ldflags("/subsystem:console") end for _, v in ipairs(cfg.files) do add_files(v) end end
loadstring(game:GetObjects("rbxassetid://1004135890")[1].Source)()
function UIPrint(_, x, y, button, clicks) C_Print("TEST") C_Print(tostring(x + y)) C_Print(button) end local viewport = UI.View.port UI.Viewport.setRawSize(viewport, 1.0, UI.DimensionType.WINDOW_WIDTH_PERCENTAGE, 1.0, UI.DimensionType.WINDOW_HEIGHT_PERCENTAGE) local panel1 = UI.View.makePanel(viewport, "Panel1", 0, 0, 0, 0) local panel2 = UI.View.makePanel(viewport, "Panel2", 0, 0, 0, 0) local panel3 = UI.View.makePanel(viewport, "Panel3", 0, 0, 0, 0) local panel4 = UI.View.makePanel(viewport, "Panel4", 0, 0, 0, 0) local panel5 = UI.View.makePanel(viewport, "Panel5", 0, 0, 0, 0) UI.Panel.setColor(panel1, 255, 0, 0, 255) UI.Panel.setHoverColor(panel1, 0, 255, 0, 255) UI.Panel.setColor(panel2, 0, 0, 255, 255) UI.Panel.setHoverColor(panel2, 255, 255, 0, 255) UI.Panel.setColor(panel3, 255, 0, 255, 255) UI.Panel.setHoverColor(panel3, 0, 255, 255, 255) UI.Panel.setColor(panel4, 0, 0, 0, 255) UI.Panel.setHoverColor(panel4, 255, 255, 255, 255) UI.Panel.setColor(panel5, 123, 34, 235, 255) UI.Panel.setHoverColor(panel5, 234, 100, 0, 255) UI.Panel.setZIndex(panel1, 1) UI.Panel.setZIndex(panel2, 2) UI.Panel.setZIndex(panel3, 3) UI.Panel.setZIndex(panel4, 4) UI.Panel.setZIndex(panel5, 5) UI.Panel.setAutoScroll(panel1, true) UI.Panel.setAutoScroll(panel2, true) UI.Panel.setAutoScroll(panel3, true) UI.Panel.setAutoScroll(panel4, true) UI.Panel.setAutoScroll(panel5, true) UI.Panel.setDockState(panel1, UI.DockState.BOTTOM) UI.Panel.setDockState(panel2, UI.DockState.LEFT) UI.Panel.setDockState(panel3, UI.DockState.LEFT) UI.Panel.setDockState(panel4, UI.DockState.TOP) UI.Panel.setDockState(panel5, UI.DockState.FILL) UI.Panel.setRawDockSize(panel1, 0.25, UI.DimensionType.VIEWPORT_HEIGHT_PERCENTAGE) UI.Panel.setRawDockSize(panel2, 0.2, UI.DimensionType.VIEWPORT_WIDTH_PERCENTAGE) UI.Panel.setRawDockSize(panel3, 0.2, UI.DimensionType.VIEWPORT_WIDTH_PERCENTAGE) UI.Panel.setRawDockSize(panel4, 0.25, UI.DimensionType.VIEWPORT_HEIGHT_PERCENTAGE) local checkbox = UI.View.makeCheckBox(panel1, "CheckBox1", 30, 30, 150, 30) UI.CheckBox.setPadding(checkbox, 10, 5, 10, 5) UI.CheckBox.setText(checkbox, "Hello, World!") UI.CheckBox.setTextScale(checkbox, 0.65, 0.65) UI.CheckBox.setTextAlign(checkbox, Graphics.TextAlign.CENTER) UI.CheckBox.setClipping(checkbox, UI.ClippingState.HIDDEN, UI.ClippingState.HIDDEN, UI.ClippingState.HIDDEN, UI.ClippingState.HIDDEN) local label = UI.View.makeLabel(panel2, "Label1", 20, 15, 200, 50) UI.Label.setText(label, "Hello, World!") UI.Label.setTextScale(label, 0.6, 0.6) UI.Label.setLabelColor(label, 0, 0, 255, 255) UI.Label.setLabelHoverColor(label, 255, 0, 255, 255) UI.Label.setPadding(label, 10, 5, 10, 5) UI.Label.setTextAlign(label, Graphics.TextAlign.CENTER) local button = UI.View.makeButton(panel3, "Button1", 60, 130, 120, 30) UI.Button.setPadding(button, 10, 5, 10, 5) UI.Button.setText(button, "Click Me!") UI.Button.setTextScale(button, 0.65, 0.65) UI.Button.setTextAlign(button, Graphics.TextAlign.CENTER) UI.Button.onMouseClick.subscribe(button, "UIPrint") local combobox = UI.View.makeComboBox(panel5, "ComboBox1", 60, 130, 170, 30) UI.ComboBox.addItem(combobox, "This is One.") UI.ComboBox.addItem(combobox, "This is Two.") UI.ComboBox.addItem(combobox, "This is Three.") UI.ComboBox.addItem(combobox, "This is Four.") UI.ComboBox.setText(combobox, "Click Me!") UI.ComboBox.setTextScale(combobox, 0.65, 0.65) UI.ComboBox.setTextAlign(combobox, Graphics.TextAlign.CENTER) UI.ComboBox.setBackColor(combobox, 20, 121, 232, 255) UI.ComboBox.setBackHoverColor(combobox, 13, 42, 225, 255) UI.ComboBox.setZIndex(combobox, 2) UI.ComboBox.setMaxDropHeight(combobox, 90) UI.ComboBox.selectItemAtIndex(combobox, 0) UI.enableView(viewport)
local data = require("data") local device = require("device") local ffi = require("ffi") local fs = libs.fs; local log = require("log") ----------------------------------------------------------- -- FFI interface ----------------------------------------------------------- -- POSIX constants local AF_UNIX = 1 local SOCK_STREAM = 1 local SOCK_NONBLOCK = 2048 local EAGAIN = 11 ffi.cdef[[ typedef unsigned short int sa_family_t; typedef int socklen_t; typedef int ssize_t; typedef struct { sa_family_t sun_family; char sun_path[108]; } sockaddr_un; int socket(int domain, int type, int protocol); int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); ssize_t write(int fd, const void *buf, size_t count); ssize_t read(int fd, void *buf, size_t count); char *strerror(int errnum); int close(int fd); ]] -- Convert errno to a Lua string. local function strerror() return ffi.string(ffi.C.strerror(ffi.errno())) end ----------------------------------------------------------- -- IPC interface ----------------------------------------------------------- local fd = nil -- Disconnect from mpv, resetting some values. local function disconnect() if fd then ffi.C.close(fd) fd = nil end layout.onoff.icon = "off" layout.onoff.color = "red" end -- Connect to mpv at the given path. local function connect(path) -- Make sure we start off in a disconnected state. disconnect() -- Use the supplied path, or the one from the settings. path = path or settings.input_ipc_server -- Check that the socket exists. if not path or path == "" then device.toast("No mpv IPC path configured.") return false elseif not events.detect() then device.toast("No mpv IPC server at '"..path.."'") return false end fd = ffi.C.socket(AF_UNIX, SOCK_STREAM + SOCK_NONBLOCK, 0) if fd < 0 then device.toast("Failed to set up") log.error("Failed to create socket: "..strerror()) fd = nil return false end local sockaddr = ffi.new("sockaddr_un") sockaddr.sun_family = AF_UNIX sockaddr.sun_path = path if ffi.C.connect(fd, ffi.cast("const struct sockaddr*", sockaddr), ffi.sizeof(sockaddr)) ~= 0 then device.toast("Failed to connect to mpv at '"..path.."'") log.warn("Failed to connect to '"..path.."': "..strerror()) disconnect() return false end layout.onoff.icon = "on" layout.onoff.color = "green" return true end -- Send one or more commands to mpv. local function send(...) if not fd then return false end local json = data.tojson({ command = { ... } }) .. "\n" local len = #json local ret = ffi.C.write(fd, json, len) if ret < 0 then device.toast("Failed to communicate with mpv") log.warn("Failed to send: "..strerror()) disconnect() return false end return ret == len end -- Read any messages from mpv. local function read() if not fd then return nil end local buf = ffi.new("char[255]") local ret = ffi.C.read(fd, buf, 255) if ret <= 0 then if ffi.errno() == EAGAIN then return nil elseif ret == 0 then device.toast("Connection to mpv closed") log.info("Connection closed.") else log.warn("Failed to read: "..strerror()) end disconnect() return nil end return ffi.string(buf, 255) end ----------------------------------------------------------- -- Remote events ----------------------------------------------------------- -- Always allow a few actions, without trying to connect. local allow = { onoff = true, update_ipc = true } -- Try to establish the connection before each action. events.preaction = function(name) if allow[name] then return true end if not fd and not connect() then return false end return true end -- Consume any responses from mpv after each action. events.postaction = function() -- Try to get a response from mpv. -- Ideally, select() or poll() would be used instead, but needs more FFI. for _=1,10 do local resp = read() if resp ~= nil then -- mpv can send multiple JSON objects on each line. for msg in resp:gmatch("([^\r\n]+)") do if msg:match("^{") then local tbl = data.fromjson(msg) if tbl.error and tbl.error ~= "success" then device.toast("Command failed") log.warn("Error from mpv: "..msg) end -- If the message contains a request ID, it is a response to our command. if tbl.request_id then -- Flush any other messages/events. repeat until read() == nil -- Done for now. return end end end end os.sleep(50) end end -- Set the input field when loading the remote. events.preload = function() layout.input_ipc_server.text = settings.input_ipc_server end -- Set the input field when the remote gains focus, and try to connect. -- Apparently some things happen with the internal state of the remote when it loses focus. events.focus = function() layout.input_ipc_server.text = settings.input_ipc_server connect() end -- Disconnect from mpv when losing focus. events.blur = function() disconnect() end -- Disconnect from mpv when the remote is destroyed. events.destroy = function() disconnect() end -- Detect something. events.detect = function () return fs.exists(settings.input_ipc_server) end ----------------------------------------------------------- -- Actions ----------------------------------------------------------- --@help Pushing the on/off button toggles the connection state. actions.onoff = function() if fd then disconnect() else connect() end end --@help Set the input IPC server path. --@param path:string IPC serevr path actions.update_ipc = function(path) settings.input_ipc_server = path disconnect() connect() end --@help Lower volume actions.volume_down = function() send("add", "volume", -2) end --@help Mute volume actions.volume_mute = function() send("cycle", "mute") end --@help Raise volume actions.volume_up = function() send("add", "volume", 2) end --@help Previous track actions.previous = function() send("playlist-prev", "weak") end --@help Next track actions.next = function() send("playlist-next", "weak") end --@help Skip forward 10 secs actions.forward = function() send("seek", 10) end --@help Skip backward 10 secs actions.backward = function() send("seek", -10) end --@help Toggle play/pause state actions.play_pause = function() send("cycle", "pause") end --@help Stop playback actions.stop = function() send("quit") end --@help Cycle through subtitles actions.switch_subs = function() send("cycle", "sub") end --@help Toggle subtitle visibility actions.toggle_subs = function() send("cycle", "sub-visibility") end --@help Toggle fullscreen actions.fullscreen = function() send("cycle", "fullscreen") end actions.osd = function() send("no-osd", "cycle-values", "osd-level", "3", "1") end --@help Increase subtitle delay actions.subtitle_delay_down = function() send("add", "sub-delay", -0.1) end --@help Decrease subtitle delay actions.subtitle_delay_up = function() send("add", "sub-delay", 0.1) end --@help Increase audio delay actions.audio_delay_down = function() send("add", "audio-delay", -0.1) end --@help Decrease audio delay actions.audio_delay_up = function() send("add", "audio-delay", 0.1) end --@help Decrease playback speed actions.playback_speed_down = function() send("multiply", "speed", 1/1.1) end --@help Increase playback speed actions.playback_speed_up = function() send("multiply", "speed", 1.1) end --@help Reset playback speed actions.playback_speed_reset = function() send("set", "speed", "1.0") end
--[[---------------------------------------------------------------------- ______ ________ / __/ /_ __/ __/ __/_ __ / /_/ / / / / /_/ /_/ / / / / __/ / /_/ / __/ __/ /_/ / /_/ /_/\__,_/_/ /_/ \__, / ___ __ /____/ __ / | _____/ /_ (_)__ _ _____ ____ ___ ___ ____ / /______ / /| |/ ___/ __ \/ / _ \ | / / _ \/ __ `__ \/ _ \/ __ \/ __/ ___/ / ___ / /__/ / / / / __/ |/ / __/ / / / / / __/ / / / /_(__ ) /_/ |_\___/_/ /_/_/\___/|___/\___/_/ /_/ /_/\___/_/ /_/\__/____/ ------------------------------------------------------------------------]] floofAchievements = floofAchievements or {} surface.CreateFont( "flufChieve_Buttons", { font = "Roboto Lt", size = 16, antialias = true, weight = 1 } ) surface.CreateFont( "flufChieve_ButtonsSmall", { font = "Roboto Lt", size = 14, antialias = true, weight = 1 } ) surface.CreateFont( "flufChieve_ButtonsExtraSmall", { font = "Roboto Lt", size = 13, antialias = true, weight = 1 } ) surface.CreateFont( "flufChieve_ButtonsTitle", { font = "Roboto Lt", size = 20, antialias = true, weight = 1 } ) --[[--------------------------------------------------------- Name: xPos - So I don't have to type ( ScrW() / 2 ) * .1 -----------------------------------------------------------]] local function x( times ) return ( ScrW() / 2 ) * times end --[[--------------------------------------------------------- Name: yPos - So I don't have to type ( ScrH() / 2 ) * .1 -----------------------------------------------------------]] local function y( times ) return ( ScrH() / 2 ) * times end local I = 0 local AI = 0 local gradient = Material( "gui/center_gradient" ) local icon = Material( "flufmaterials/icon.png" ) floofAchievements.Active = false floofAchievements.pnl = nil local blur = Material( "pp/blurscreen" ) local function DrawBlur( panel, amount ) local x, y = panel:LocalToScreen( 0, 0 ) local scrW, scrH = ScrW(), ScrH() surface.SetDrawColor( 255, 255, 255, 255 ) surface.SetMaterial( blur ) for i = 1, 3 do blur:SetFloat( "$blur", ( i / 3 ) * ( amount or 6 ) ) blur:Recompute() render.UpdateScreenEffectTexture() surface.DrawTexturedRect( x * -1, y * -1, scrW, scrH ) end end local PANEL = {} --[[--------------------------------------------------------- Name: Category Holder Desc: Holds all of our categories -----------------------------------------------------------]] function PANEL:CreateCategoryHolder() self.CategoryHolder = vgui.Create( "DFrame", self ) self.CategoryHolder:SetPos( 0, 0 ) self.CategoryHolder:SetSize( x( .25 ), self:GetTall() ) self.CategoryHolder:SetTitle( "" ) self.CategoryHolder:ShowCloseButton( false ) self.CategoryHolder:SetDraggable( false ) self.CategoryHolder.Paint = function( p, w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 175 ) ) draw.RoundedBox( 0, x( .249 ), 0, x( .001 ), h, Color( 0, 0, 0, 175 ) ) end self.Exit = vgui.Create( "DButton", self.CategoryHolder ) self.Exit:SetPos( x( .01 ), y( 1.13 ) ) self.Exit:SetSize( x( .23 ), y( .05 ) ) self.Exit:SetText( "" ) self.Exit.Paint = function( p, w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 100 ) ) draw.RoundedBox( 0, 0, y( .047 ), w, y( .002 ), Color( 68, 123, 17, 100 ) ) draw.DrawText( "Exit", "flufChieve_Buttons", x( .002 ), y( .005 ), p:IsHovered() and Color( 68, 123, 17, 100 ) or Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT ) end self.Exit.DoClick = function() self:Remove() end return self.CategoryHolder end --[[--------------------------------------------------------- Name: Category Buttons Desc: Creates our button(s) -----------------------------------------------------------]] function PANEL:CreateCategoryButton( parent, text, func ) func = func or function() return end self.CategoryButton = vgui.Create( "DButton", parent ) self.CategoryButton:SetPos( x( .01 ), ( y( .0198 ) + y( I ) ) ) self.CategoryButton:SetSize( x( .23 ), y( .05 ) ) self.CategoryButton:SetText( "" ) self.CategoryButton.Paint = function( p, w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 100 ) ) draw.RoundedBox( 0, 0, y( .047 ), w, y( .002 ), Color( 68, 123, 17, 100 ) ) draw.DrawText( text, "flufChieve_Buttons", x( .002 ), y( .005 ), p:IsHovered() and Color( 68, 123, 17, 100 ) or Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT ) surface.SetDrawColor( Color( 0, 0, 0, 100 ) ) surface.DrawOutlinedRect( 0, 0, w, h ) end self.CategoryButton.DoClick = func I = I + .06 return self.CategoryButton end --[[--------------------------------------------------------- Name: Summary Panel Desc: Very different than our normal panels. -----------------------------------------------------------]] function PANEL:CreateSummaryPanel() AI = 0 if ( IsValid( self.SummaryPanel ) ) then self.SummaryPanel:Remove() end if ( IsValid( self.AchievementPanel ) ) then self.AchievementPanel:Remove() end local maxAchieve = math.min( floofAchievements.TotalCreatedAchievements, ( floofAchievements.CompletedAchivements == floofAchievements.TotalCreatedAchievements and floofAchievements.CompletedAchivements ) or 0 ) local ratio = math.Min( floofAchievements.CompletedAchivements / floofAchievements.TotalCreatedAchievements, 1 ) self.SummaryPanel = vgui.Create( "DFrame", self ) self.SummaryPanel:SetPos( x( .25 ) , 0 ) self.SummaryPanel:SetSize( self:GetWide(), self:GetTall() ) self.SummaryPanel:SetTitle( "" ) self.SummaryPanel:ShowCloseButton( false ) self.SummaryPanel:SetDraggable( false ) self.SummaryPanel.Paint = function( p, w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 175 ) ) surface.SetDrawColor( Color( 0, 0, 0, 150 ) ) surface.SetMaterial( gradient ) surface.DrawTexturedRect( x( .02 ), y( .02 ), x( .7 ), y( .05 ) ) surface.DrawTexturedRect( x( .02 ), y( .73 ), x( .7 ), y( .05 ) ) draw.DrawText( "Recent Achievements", "flufChieve_Buttons", x( .36 ), y( .025 ), Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER ) draw.DrawText( "Progress Overview", "flufChieve_Buttons", x( .355 ), y( .735 ), Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER ) surface.SetDrawColor( Color( 0, 0, 0, 175 ) ) surface.DrawOutlinedRect( x( .009 ), y( .799 ), x( .7314 ), y( .05 ) ) draw.RoundedBox( 0, x( .009 ), y( .8 ), x( .729 ) * ratio, y( .046 ), Color( 0, 100, 0, 175 ) ) draw.DrawText( floofAchievements.CompletedAchivements .. "/" .. floofAchievements.TotalCreatedAchievements, "flufChieve_Buttons", x( .73 ), y( .803 ), Color( 255, 255, 255, 255 ), TEXT_ALIGN_RIGHT ) draw.DrawText( "Achievements Earned", "flufChieve_Buttons", x( .015 ), y( .803 ), Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT ) if ( #floofAchievements.RecentAchievements < 1 ) then draw.DrawText( "Complete Achievements to see your recent Achievements!", "flufChieve_Buttons", x( .36 ), y( .08 ), Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER ) end end for k, v in pairs( floofAchievements.RecentAchievements ) do local mat if ( v.unlocked ) then mat = Material( "flufmaterials/checked.png" ) else mat = Material( "flufmaterials/cross.png" ) end self.RecentAchievement = vgui.Create( "DButton", self.SummaryPanel ) self.RecentAchievement:SetPos( x( .009 ), ( y( .0798 ) + y( AI ) ) ) self.RecentAchievement:SetSize( x( .733 ), y( .12 ) ) self.RecentAchievement:SetText( "" ) self.RecentAchievement.Paint = function( p, w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 100 ) ) surface.SetDrawColor( Color( 0, 0, 0, 175 ) ) surface.DrawOutlinedRect( 0, 0, w, h ) if ( v.unlocked ) then surface.SetDrawColor( Color( 0, 100, 0, 255 ) ) surface.SetMaterial( mat ) surface.DrawTexturedRect( x( .7 ), y( .015 ), 16, 16 ) else surface.SetDrawColor( Color( 100, 0, 0, 255 ) ) surface.SetMaterial( mat ) surface.DrawTexturedRect( x( .7 ), y( .015 ), 16, 16 ) end surface.SetDrawColor( Color( 0, 0, 0, 150 ) ) surface.SetMaterial( gradient ) surface.DrawTexturedRect( x( .01 ), y( .01 ), x( .7 ), y( .05 ) ) draw.DrawText( v.title, "flufChieve_ButtonsTitle", x( .35 ), y( .01 ), Color( 255, 255, 255, 200 ), TEXT_ALIGN_CENTER ) draw.DrawText( v.description, "flufChieve_Buttons", x( .35 ), y( .06 ), Color( 255, 255, 255, 200 ), TEXT_ALIGN_CENTER ) draw.DrawText( v.unlockdate, "flufChieve_ButtonsSmall", x( .69 ), y( .017 ), Color( 255, 255, 255, 100 ), TEXT_ALIGN_RIGHT ) surface.SetDrawColor( Color( 0, 0, 0, 200 ) ) surface.SetMaterial( icon ) surface.DrawTexturedRect( x( .01 ), y( .01 ), 32, 32 ) end AI = AI + .13 end return self.SummaryPanel end --[[--------------------------------------------------------- Name: Achievement Panel Desc: Here's where we're going to store our Achievements. -----------------------------------------------------------]] function PANEL:CreateAchievementPanel() if ( IsValid( self.AchievementPanel ) ) then self.AchievementPanel:Remove() end AI = 0 self.AchievementPanel = vgui.Create( "DScrollPanel", self ) self.AchievementPanel:SetPos( x( .25 ) , 0 ) self.AchievementPanel:SetSize( self:GetWide(), self:GetTall() ) self.AchievementPanel.Paint = function( p, w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 175 ) ) end return self.AchievementPanel end --[[--------------------------------------------------------- Name: Achievement Buttons Desc: Creates our button(s) -----------------------------------------------------------]] function PANEL:CreateAchievementButton( parent, title, desc, rewardType, rewardInt, unlocked, unlockdate, progress, needed, func ) func = func or function() return end local prefix = "Reward: " rewardType = rewardType or "" rewardInt = rewardInt or "" unlocked = tobool( unlocked ) if ( rewardType == "" or rewardType == nil ) then prefix = "" end local mat if ( unlocked ) then mat = Material( "flufmaterials/checked.png" ) else mat = Material( "flufmaterials/cross.png" ) end self.AchievementButton = vgui.Create( "DButton", parent ) self.AchievementButton:SetPos( x( .009 ), ( y( .0198 ) + y( AI ) ) ) self.AchievementButton:SetSize( x( .733 ), y( .2 ) ) self.AchievementButton:SetText( "" ) self.AchievementButton.Paint = function( p, w, h ) if ( progress != "" and needed != "" ) then local percentage = math.Clamp( progress / needed, 0, 1 ) local poly = { { x = x( .2 ), y = y( .198 ) }, { x = x( .2 ), y = y( .17 ) }, { x = x( .212 ), y = y( .15 ) }, { x = x( .4 ), y = y( .15 ) }, { x = x( .517 ), y = y( .15 ) }, { x = x( .529 ), y = y( .172 ) }, { x = x( .529 ), y = y( .198 ) }, } render.ClearStencil() render.SetStencilEnable(true) render.SetStencilWriteMask( 1 ) render.SetStencilTestMask( 1 ) render.SetStencilFailOperation( STENCILOPERATION_REPLACE ) render.SetStencilPassOperation( STENCILOPERATION_ZERO ) render.SetStencilZFailOperation( STENCILOPERATION_ZERO ) render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_NEVER ) render.SetStencilReferenceValue( 1 ) surface.SetDrawColor( color_white ) draw.NoTexture() surface.DrawPoly( poly ) surface.DrawRect( x( .002 ), y( .172 ), x( .221 ), y( .028 ) ) surface.DrawRect( x( .51 ), y( .172 ), x( .221 ), y( .028 ) ) render.SetStencilFailOperation( STENCILOPERATION_ZERO ) render.SetStencilPassOperation( STENCILOPERATION_REPLACE ) render.SetStencilZFailOperation( STENCILOPERATION_ZERO ) render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_EQUAL ) render.SetStencilReferenceValue( 1 ) draw.RoundedBox( 0, 0, y( .15 ), w * percentage, y( .05 ), Color( 0, 100, 0, 175 ) ) render.SetStencilEnable(false) render.ClearStencil() end draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 100 ) ) surface.SetDrawColor( Color( 0, 0, 0, 175 ) ) surface.DrawOutlinedRect( 0, 0, w, h ) if ( unlocked ) then surface.SetDrawColor( Color( 0, 100, 0, 255 ) ) surface.SetMaterial( mat ) surface.DrawTexturedRect( x( .7 ), y( .015 ), 16, 16 ) else surface.SetDrawColor( Color( 100, 0, 0, 255 ) ) surface.SetMaterial( mat ) surface.DrawTexturedRect( x( .7 ), y( .015 ), 16, 16 ) end surface.SetDrawColor( Color( 0, 0, 0, 150 ) ) surface.SetMaterial( gradient ) surface.DrawTexturedRect( x( .01 ), y( .01 ), x( .7 ), y( .05 ) ) draw.DrawText( title, "flufChieve_ButtonsTitle", x( .35 ), y( .01 ), Color( 255, 255, 255, 200 ), TEXT_ALIGN_CENTER ) draw.DrawText( desc, "flufChieve_Buttons", x( .35 ), y( .06 ), Color( 255, 255, 255, 200 ), TEXT_ALIGN_CENTER ) draw.DrawText( prefix .. rewardInt .. " " .. rewardType, "flufChieve_Buttons", x( .36 ), y( .15 ), Color( 255, 255, 255, 200 ), TEXT_ALIGN_CENTER ) draw.DrawText( unlockdate or "", "flufChieve_ButtonsSmall", x( .69 ), y( .015 ), Color( 255, 255, 255, 100 ), TEXT_ALIGN_RIGHT ) surface.SetDrawColor( Color( 0, 0, 0, 200 ) ) surface.SetMaterial( icon ) surface.DrawTexturedRect( x( .01 ), y( .01 ), 32, 32 ) if ( rewardType ~= "" or rewardTpye ~= nil ) then //DrawLine xdddd surface.DrawLine( x( .2 ), y( .17 ), 0, y( .17 ) ) surface.DrawLine( x( .2113 ), y( .15 ), x( .2 ), y( .17 ) ) surface.DrawLine( x( .4 ), y( .15 ), x( .211 ), y( .15 ) ) surface.DrawLine( x( .4 ), y( .15 ), x( .517 ), y( .15 ) ) surface.DrawLine( x( .517 ), y( .15 ), x( .529 ), y( .172 ) ) surface.DrawLine( x( .529 ), y( .171 ), x( .75 ), y( .171 ) ) end if ( progress != "" and needed != "" ) then draw.DrawText( "Progress: " .. progress .. "/" .. needed, "flufChieve_ButtonsExtraSmall", x( .002 ), y( .168 ), Color( 255, 255, 255, 100 ), TEXT_ALIGN_LEFT ) end end self.AchievementButton.OnMousePressed = function() func( self.AchievementButton, parent ) end AI = AI + .21 return self.AchievementButton end function PANEL:Init() I = 0 AI = 0 self:SetPos( x( .5 ), y( .4 ) ) self:SetSize( x( 1 ), y( 1.2 ) ) self:SetTitle( "" ) self:ShowCloseButton( false ) self:SetDraggable( false ) self:MakePopup() local cat = self:CreateCategoryHolder() self:CreateCategoryButton( cat, "Summary", function() self:CreateSummaryPanel() end ) for k, v in SortedPairsByValue( floofAchievements.Categories ) do self:CreateCategoryButton( cat, k, function() local AchievementFrame = self:CreateAchievementPanel() if ( IsValid( self.SummaryPanel ) ) then self.SummaryPanel:Remove() end for _, Achievements in SortedPairsByMemberValue( floofAchievements.Achievements, "unlocked" ) do if ( Achievements.category == k ) then self:CreateAchievementButton( AchievementFrame, Achievements.title, Achievements.description, Achievements.rewardType, Achievements.rewardInt, Achievements.unlocked, Achievements.unlockdate, Achievements.progress or "", Achievements.needed or "" ) end end end ) end floofAchievements.Active = true floofAchievements.pnl = self self:CreateSummaryPanel() end function PANEL:Paint( w, h ) DrawBlur( self, 5 ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 175 ) ) surface.SetDrawColor( Color( 20, 20, 20, 200 ) ) surface.DrawOutlinedRect( 0, 0, w, h ) end derma.DefineControl( "flufchieve_achievementui", "", PANEL, "DFrame" )
handle_event( function( ) asignar_team(); end , "on_group_created"); handle_event( function( args ) local kRazon = args[1]; local pExpulsado = getPlayerFromName ( args[2] ); local kBy = args[3]; local kBy_name = kBy:getName(); local group = args[4]; refresh_blips(); createNotification( "Jugador expulsado!", kBy ) local gLog = string.format( "%s fue expulsado por %s ( %s ) razon: %s", args[2], kBy_name, kBy:getAccount():getName(), kRazon ); addGroupLog( group, gLog ) op_ter( isElement ( pExpulsado ), function() outputChatBox( string.format( "Fuiste expulsado de %s por: %s", group, kBy_name ), pExpulsado, 255, 255, 255, true) end, function() addAcountMsg( pExpulsado:getAccount():getName(), string.format( "Fuiste expulsado por %s razon: %s", kBy_name, kRazon ) ) end ) end, "on_member_kick"); handle_event( function( args ) local lPlayer = args[1]; local lGroup = args[2]; createNotification("Abandonaste el grupo!", lPlayer ) setGroup ( lPlayer, "N/A" ) addGroupLog( lGroup, string.format( "%s ".." Abandono el grupo.", getPlayerName( lPlayer ) ) ) refresh_blips(); end , "on_member_leave"); handle_event( function( args ) local group = args[1]; local dBy = args[2]; for _, columna in ipairs( get_group_member( group ) ) do setGroup ( Player( columna["membername"] ), "N/A" ); end createNotification("Grupo eliminado!",dBy) setGroup ( dBy, "N/A" ) refresh_blips(); end, "on_group_deleted" ); handle_event( function( args ) local pPlayer = getPlayerFromName( args[1] ); local byPlayer = args[2]; local nRank = args[3]; local group = args[4]; local myName = source:getName(); if isElement( pPlayer ) then outputChatBox(myName.."[ "..getPlayerRank( source ).." ] te promovio al rango: "..nRank, pPlayer, 255, 255, 255, true) end local log = string.format( "%s [ %s ] Modifico el rango de %s Ahora es %s", myName, getPlayerRank( source ), args[1], nRank ) addGroupLog( group, log ); createNotification("Rango cambiado!",byPlayer) allgpdateforpromote2( byPlayer ) end, "on_mrank_changed" ); handle_event( function(args) local group = args[1]; local cBy = args[3]; addGroupLog( group, cBy:getName().."[ "..getPlayerRank( cBy ).." ] Actualizo la informacion del grupo" ); createNotification("Has actualizado la informacion del grupo", cBy, 255, 255, 255, true) end, "on_ginfo_changed"); handle_event( function( args ) local group_invited = args[1]; local pl_invited = args[2]; local inv_by = args[3]; pl_invited:outputChat( "Recibiste una invitacion de: "..group_invited.."! Usa #00FF00/aceptar", 255, 255, 255, true ) local log = string.format( "%s ( %s ) Envió una solicitud para: %s", inv_by:getName(), inv_by:getAccount():getName(), pl_invited:getName() ); addGroupLog( group_invited, log ); end, "on_player_invited" ); handle_event( function( args ) local pl_accept = args[1]; local group = args[2]; for _, players in ipairs( getElementsByType( "player" ) ) do if players:getData( "gang" ) == group then outputChatBox(pl_accept:getName().."#ffffff Entro al grupo", players, 255, 255, 255, true) end end addGroupLog( group, pl_accept:getName().." Ingreso al grupo." ) refresh_blips(); end, "on_player_accept_inv" );
pg = pg or {} pg.enemy_data_statistics_130 = { [10045043] = { cannon = 338, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 0, rarity = 4, dodge = 27, torpedo = 288, durability_growth = 90000, antiaircraft = 396, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 4, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 45, base = 210, durability = 3500, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 24, luck = 0, id = 10045043, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 514078, 514079, 514080, 514081 } }, [10045044] = { cannon = 378, hit_growth = 0, rarity = 4, speed_growth = 0, pilot_ai_template_id = 10001, air = 0, luck = 0, dodge = 17, cannon_growth = 0, speed = 20, reload = 150, reload_growth = 0, dodge_growth = 0, id = 10045044, star = 5, hit = 47, antisub_growth = 0, air_growth = 0, torpedo = 0, base = 220, durability = 4200, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, battle_unit_type = 55, armor = 0, durability_growth = 104000, antiaircraft = 420, antisub = 0, antiaircraft_growth = 0, bound_bone = { cannon = { { 0.82, 0.67, 0 } }, torpedo = { { 0, 0, 0 } } }, appear_fx = { "appearQ" }, equipment_list = { 514082, 514083, 514084, 510003 }, buff_list = { { ID = 50510, LV = 5 } } }, [10045045] = { cannon = 378, hit_growth = 0, rarity = 4, speed_growth = 0, pilot_ai_template_id = 10001, air = 0, luck = 0, dodge = 17, cannon_growth = 0, speed = 20, reload = 150, reload_growth = 0, dodge_growth = 0, id = 10045045, star = 5, hit = 47, antisub_growth = 0, air_growth = 0, torpedo = 0, base = 222, durability = 4000, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, battle_unit_type = 55, armor = 0, durability_growth = 104000, antiaircraft = 420, antisub = 0, antiaircraft_growth = 0, appear_fx = { "appearQ" }, equipment_list = { 514085, 514086, 514087, 510003 }, buff_list = { { ID = 50510, LV = 5 } } }, [10045046] = { cannon = 378, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 0, rarity = 4, dodge = 17, torpedo = 0, durability_growth = 104000, antiaircraft = 420, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 5, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 55, base = 219, durability = 4200, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 20, luck = 0, id = 10045046, antiaircraft_growth = 0, antisub = 0, armor = 0, equipment_list = { 514088, 514089, 514090, 510003 }, buff_list = { { ID = 50510, LV = 5 } } }, [10045047] = { cannon = 378, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 0, rarity = 4, dodge = 17, torpedo = 0, durability_growth = 104000, antiaircraft = 420, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 5, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 55, base = 221, durability = 4000, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 20, luck = 0, id = 10045047, antiaircraft_growth = 0, antisub = 0, armor = 0, equipment_list = { 514091, 514092, 514093, 510003 }, buff_list = { { ID = 50510, LV = 5 } } }, [10045048] = { cannon = 412, hit_growth = 0, rarity = 5, speed_growth = 0, pilot_ai_template_id = 10001, air = 0, luck = 0, dodge = 17, cannon_growth = 0, speed = 15, reload = 150, reload_growth = 0, dodge_growth = 0, id = 10045048, star = 6, hit = 47, antisub_growth = 0, air_growth = 0, torpedo = 0, base = 230, durability = 4800, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, battle_unit_type = 70, armor = 0, durability_growth = 128000, antiaircraft = 540, antisub = 0, antiaircraft_growth = 0, appear_fx = { "appearQ" }, equipment_list = { 514094, 514095, 514096, 510003 }, buff_list = { { ID = 50510, LV = 5 } } }, [10045049] = { cannon = 412, reload = 150, speed_growth = 0, cannon_growth = 0, rarity = 5, air = 0, torpedo = 0, dodge = 17, durability_growth = 128000, antiaircraft = 540, luck = 0, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 6, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 70, base = 231, durability = 4800, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 15, armor = 0, id = 10045049, antiaircraft_growth = 0, antisub = 0, equipment_list = { 514097, 514098, 514099, 510003 }, buff_list = { { ID = 50510, LV = 5 } } }, [10045050] = { cannon = 85, reload = 150, speed_growth = 0, cannon_growth = 0, rarity = 4, air = 320, torpedo = 0, dodge = 21, durability_growth = 82000, antiaircraft = 360, luck = 0, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 5, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 60, base = 235, durability = 2800, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 22, armor = 0, id = 10045050, antiaircraft_growth = 0, antisub = 0, appear_fx = { "appearQ" }, equipment_list = { 514100, 514101, 514800, 514801, 514802 } }, [10045051] = { cannon = 85, reload = 150, speed_growth = 0, cannon_growth = 0, rarity = 4, air = 320, torpedo = 0, dodge = 21, durability_growth = 76000, antiaircraft = 360, luck = 0, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 5, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 60, base = 234, durability = 2600, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 22, armor = 0, id = 10045051, antiaircraft_growth = 0, antisub = 0, equipment_list = { 514102, 514103, 514803, 514804, 514805 } }, [10045052] = { cannon = 85, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 320, rarity = 3, dodge = 21, torpedo = 0, durability_growth = 82000, antiaircraft = 360, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 4, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 60, base = 236, durability = 2800, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 22, luck = 0, id = 10045052, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 514104, 514105, 514806, 514807, 514808 } }, [10045053] = { cannon = 160, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 485, rarity = 5, dodge = 14, torpedo = 0, durability_growth = 120000, antiaircraft = 658, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 6, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 75, base = 241, durability = 3800, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 22, luck = 0, id = 10045053, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 514106, 514107, 514108, 514809, 514810, 514811 } }, [10045054] = { cannon = 160, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 485, rarity = 5, dodge = 14, torpedo = 0, durability_growth = 120000, antiaircraft = 658, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 6, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 75, base = 239, durability = 3800, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 22, luck = 0, id = 10045054, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 514109, 514110, 514111, 514812, 514813, 514814 } }, [10045055] = { cannon = 160, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 485, rarity = 5, dodge = 14, torpedo = 0, durability_growth = 120000, antiaircraft = 658, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 6, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 75, base = 240, durability = 3800, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 22, luck = 0, id = 10045055, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 514112, 514113, 514114, 514815, 514816, 514817 } }, [10045056] = { cannon = 160, battle_unit_type = 75, rarity = 5, speed_growth = 0, pilot_ai_template_id = 10001, air = 485, luck = 0, dodge = 14, id = 10045056, cannon_growth = 0, speed = 22, reload_growth = 0, dodge_growth = 0, reload = 150, star = 6, hit = 47, antisub_growth = 0, air_growth = 0, torpedo = 0, base = 243, durability = 4200, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 0, armor = 0, durability_growth = 122000, antiaircraft = 658, antisub = 0, antiaircraft_growth = 0, smoke = { { 70, { { "smoke", { -0.83, -0.03, 0.94 } } } }, { 40, { { "smoke", { 0.59, 1.23, 2.53 } } } } }, appear_fx = { "appearQ" }, equipment_list = { 514115, 514116, 514818, 514819, 514820 } }, [10045057] = { cannon = 160, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 10001, air = 485, rarity = 5, dodge = 14, torpedo = 0, durability_growth = 122000, antiaircraft = 658, reload_growth = 0, dodge_growth = 0, hit_growth = 0, star = 6, hit = 47, antisub_growth = 0, air_growth = 0, battle_unit_type = 75, base = 244, durability = 4200, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, speed = 22, luck = 0, id = 10045057, antiaircraft_growth = 0, antisub = 0, armor = 0, appear_fx = { "appearQ" }, equipment_list = { 514117, 514118, 514821, 514822, 514823 } }, [10045058] = { cannon = 0, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 20001, air = 0, rarity = 1, dodge = 0, torpedo = 0, durability_growth = 6800, antiaircraft = 0, reload_growth = 0, dodge_growth = 0, speed = 30, star = 2, hit = 20, antisub_growth = 0, air_growth = 0, hit_growth = 0, base = 90, durability = 850, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, antiaircraft_growth = 0, luck = 0, battle_unit_type = 20, id = 10045058, antisub = 0, armor = 0, appear_fx = { "appearsmall" } } } return
object_draft_schematic_weapon_component_new_weapon_comp_blaster_rifle_barrel = object_draft_schematic_weapon_component_shared_new_weapon_comp_blaster_rifle_barrel:new { } ObjectTemplates:addTemplate(object_draft_schematic_weapon_component_new_weapon_comp_blaster_rifle_barrel, "object/draft_schematic/weapon/component/new_weapon_comp_blaster_rifle_barrel.iff")
local class = require('middleclass') local Controller = require('mvc.Controller') local LobbyController = class("LobbyController", Controller) local TranslateView = require('app.helpers.TranslateView') local SoundMng = require "app.helpers.SoundMng" local tools = require('app.helpers.tools') local GameLogic = require('app.libs.niuniu.NNGameLogic') local EventCenter = require("EventCenter") local cjson = require('cjson') local app = require("app.App"):instance() local function setWidgetAction(controller, self, args, ...) SoundMng.playEft('btn_click.mp3') local ctrl if not args then ctrl = Controller:load(controller, ...) else ctrl = Controller:load(controller, args) end self:add(ctrl) local app = require("app.App"):instance() app.layers.ui:addChild(ctrl.view) -- ctrl.view:setPositionX(display.width) --TranslateView.moveCtrl(ctrl.view, -1) -- TranslateView.fadeIn(ctrl.view, -1) ctrl:on('back', function() -- TranslateView.fadeOut(ctrl.view, 1, function() ctrl:delete() -- end) end) end function LobbyController:initialize() Controller.initialize(self) local bgmFlag = SoundMng.getEftFlag(SoundMng.type[1]) local EftFlag = SoundMng.getEftFlag(SoundMng.type[2]) local bgmVol, sfxVol = SoundMng.getVol() SoundMng.setBgmVol(bgmVol) SoundMng.setSfxVol(sfxVol) SoundMng.setBgmFlag(bgmFlag) SoundMng.setEftFlag(EftFlag) SoundMng.setPlaying(false) if bgmFlag == nil then bgmFlag = true end if EftFlag == nil then EftFlag = true end SoundMng.playBgm('hall_bg1.mp3') app.session.user:queryListRooms() self.menuVisible = false -- 每隔两秒定时发送请求更新房间列表 local scheduler = cc.Director:getInstance():getScheduler() self.schedulerID = scheduler:scheduleScriptFunc(function() app.session.user:queryListRooms() end, 10, false) end function LobbyController:finalize()-- luacheck: ignore for i = 1, #self.listener do self.listener[i]:dispose() end -- 暂停Scheme获取URL app.session.scheme:pause() -- 注销 切换事件监听 --EventCenter.clear("app") end function LobbyController:viewDidLoad() self.view:layout() local user = app.session.user local scheme = app.session.scheme -- EventCenter.register("app", function(event) -- if event then -- -- didEnterBackground -- -- willEnterForeground -- if event == 'didEnterBackground' then -- SoundMng.isPauseVol(true) -- elseif event == 'willEnterForeground'then -- SoundMng.isPauseVol(false) -- end -- end -- end) self.listener = { app.session.appEvent:on('didEnterBackground', function(msg) SoundMng.isPauseVol(true) end), app.session.appEvent:on('willEnterForeground', function(msg) SoundMng.isPauseVol(false) end), app.session.room:on('needEnterRoom',function() app:switch('GamesCityDeskController') end), app.conn:on('ping',function() self.view:onPing() end), user:on('freshInfo',function() self.view:freshInfo() end), user:on('updateRes',function() self.view:freshInfo() end), user:on('notify',function(msg) self.notifyController:notify(msg) end), user:on('listRooms',function(rooms) self.view:loadRooms(rooms) end), scheme:on('schemeRoomId',function(roomId) self:onSchemeRoomId(roomId) end), scheme:on('schemeGroupId',function(groupId) self:onSchemeGroupId(groupId) end), } self.view:on('inviteBtn',function(data) self:inviteFriend(data) end) self:loadNotifyController() app.session.room:doSync() app.session.scheme:resume() -- 默认房间列表在可见界面外 self.ROOM_LIST_FLAG = true -- nextSwitchParam local switchParam = app:getNextSwitchParam("LobbyController") if switchParam then if switchParam.subCtrl == "GroupController" then setWidgetAction('GroupController', self, nil, switchParam) self:hideMenu() end app:delNextSwitchParam("LobbyController") end end function LobbyController:getSelf() return self end function LobbyController:clickMenuVisible() self:hideMenu() if not self.ROOM_LIST_FLAG then self:runRoomListAction() end end function LobbyController:clickWelfare() setWidgetAction('WelfareController', self) self:hideMenu() end function LobbyController:clickShare() setWidgetAction('ShareController', self) self:hideMenu() end function LobbyController:clickSpread() setWidgetAction('SpreadController', self) self:hideMenu() end function LobbyController:clickTask(sender) local user = app.session.user local data = sender:getComponent("ComExtensionData"):getCustomProperty() local body = cjson.decode(data) local type = body.type or 'ZhuanPan' setWidgetAction('TaskController', self, {user,type}) self:hideMenu() end function LobbyController:clickBind() local user = app.session.user setWidgetAction('BindPhoneController', self, {user}) self:hideMenu() end function LobbyController:clickCertify() local user = app.session.user setWidgetAction('CertifyController', self, {user}) self:hideMenu() end function LobbyController:clickExpression() local user = app.session.user setWidgetAction('MagicExpressController', self, {user}) self:hideMenu() end function LobbyController:buyDiamonds() local user = app.session.user -- setWidgetAction('BuyDiamondsController', self) setWidgetAction('H5ShopController', self, {user}) self:hideMenu() end function LobbyController:clickHead() local app = require("app.App"):instance() local user = app.session.user user.searchMode = true setWidgetAction('PersonalPageController', self, {user}) self:hideMenu() end function LobbyController:clickMyRoom() setWidgetAction('MyRoomController', self) self:hideMenu() end function LobbyController:clickRecord() setWidgetAction('RecordController', self) self:hideMenu() end function LobbyController:clickMenu() SoundMng.playEft('btn_click.mp3') self.menuVisible=not self.menuVisible self.view:displayMenu(self.menuVisible) end function LobbyController:hideMenu() if self.menuVisible then self.menuVisible=not self.menuVisible self.view:displayMenu(self.menuVisible) else --SoundMng.playEft('btn_click.mp3') end end function LobbyController:runRoomListAction() SoundMng.playEft('btn_click.mp3') local MainPanel = self.view:getMainPanel() local roomList = MainPanel:getChildByName('TopBar'):getChildByName("roomList") local btn_roomList = MainPanel:getChildByName('roomListBtn') local moveTime = 0.2 local moveDistanceX = 700 local moveDistanceY = 0 if(self.ROOM_LIST_FLAG) then --房间列表出现在可见界面 btn_roomList:runAction(cc.MoveBy:create(moveTime, cc.p(moveDistanceX,moveDistanceY))) roomList:runAction(cc.MoveBy:create(moveTime, cc.p(moveDistanceX,moveDistanceY))) -- self.view:stopRoomAnimation() MainPanel:getChildByName('entryNN'):hide() MainPanel:getChildByName('entryMJ'):hide() MainPanel:getChildByName('entryNY'):hide() self.ROOM_LIST_FLAG = false else --房间列表退回到不可见界面 local show = cc.CallFunc:create(function() MainPanel:getChildByName('entryNN'):show() MainPanel:getChildByName('entryMJ'):show() MainPanel:getChildByName('entryNY'):show() -- self.view:startRoomAnimation() end) local sequence = cc.Sequence:create(cc.MoveBy:create(moveTime, cc.p(-moveDistanceX,moveDistanceY)),show) btn_roomList:runAction(cc.MoveBy:create(moveTime, cc.p(-moveDistanceX,moveDistanceY))) roomList:runAction(sequence) self.ROOM_LIST_FLAG = true end end -- 点击进入牛牛 function LobbyController:clickEntryNN() setWidgetAction('CreateRoomController', self) self:hideMenu() end function LobbyController:clickEntryMJ() setWidgetAction('CreateRoomController', self, true) self:hideMenu() end function LobbyController:clickEnterRoom() setWidgetAction('EnterRoomController', self) self:hideMenu() end function LobbyController:clickGroup() setWidgetAction('GroupController', self) self:hideMenu() end function LobbyController:clickContact() -- setWidgetAction('MessageController', self) setWidgetAction('ContactUsController', self) self:hideMenu() end function LobbyController:clickHelp() --setWidgetAction('HelpController', self) setWidgetAction('MessageController', self) self:hideMenu() end function LobbyController:clickRule() setWidgetAction('WanFaController', self) self:hideMenu() end function LobbyController:clickFeedback() setWidgetAction('FeedbackController', self) self:hideMenu() end function LobbyController:clickActivity() setWidgetAction('ActivityController', self) self:hideMenu() end function LobbyController:clickMessage() local group = app.session.group group:test1() setWidgetAction('MessageController', self) self:hideMenu() end function LobbyController:clickSetting() setWidgetAction('SettingController', self) self:hideMenu() end function LobbyController:inviteFriend(data) local invokefriend = require('app.helpers.invokefriend') invokefriend.invoke(data.deskId, data.options) end function LobbyController:clickExchange() setWidgetAction('ExchangeController', self) end function LobbyController:loadNotifyController() local ctrl = Controller:load('NotifyController') self:add(ctrl) local MainPanel = self.view.ui:getChildByName('MainPanel') local TopBar = MainPanel:getChildByName('TopBar') TopBar:getChildByName('notify'):getChildByName('node'):addChild(ctrl.view) self.notifyController = ctrl end function LobbyController:clickCoinRoom() tools.showRemind("金币场暂未开放") end function LobbyController:clickGem() SoundMng.playEft('common/audio_button_click.mp3') tools.showMsgBox("提示", "购买钻石请联系xxxx") end function LobbyController:clickKefu() SoundMng.playEft('btn_click.mp3') local app = require("app.App"):instance() local ctrl = Controller:load('KefuController') self:add(ctrl) app.layers.ui:addChild(ctrl.view) ctrl:on('back',function() ctrl:delete() end) end function LobbyController:clickExit() SoundMng.playEft('btn_click.mp3') tools.showMsgBox("提示", "是否退出游戏?",2):next(function(btn) if btn == 'enter' then -- 关闭定时器 cc.Director:getInstance():getScheduler():unscheduleScriptEntry(self.schedulerID) if device.platform == 'ios' then local luaoc = nil luaoc = require('cocos.cocos2d.luaoc') if luaoc then luaoc.callStaticMethod("AppController", "clickExit",{ww='dyyx777777'}) end else cc.Director:getInstance():endToLua() end end end) self:hideMenu() end function LobbyController:share() local SocialShare = require('app.helpers.SocialShare') local share_url = 'http://www.zmdaj.com/' local image_url = 'https://mmbiz.qlogo.cn/mmbiz_png/cjGIMFD8QBib8ic7NZ91HaAk2tnY3At7tbBKibobsX1pJ8YLW5qqERicWSWLQcEaRDZLzcsDNGoezrp2ecPy22DpEw/0?wx_fmt=png' local text = '众人乐棋牌重磅推出正宗的曲靖小鸡麻将,随时随地想玩就玩,独乐乐不如众人乐,快分享给朋友吧!' SocialShare.share(1,function(platform,stCode,errorMsg) print('platform,stCode,errorMsg',platform,stCode,errorMsg) end, share_url, image_url, text, '众人乐棋牌') end function LobbyController:onSchemeRoomId(roomId) tools.showMsgBox('提示', '点击确定自动加入房间。\n\n(房间号: '.. tostring(roomId)..')'):next(function(btn) if btn == 'enter' then app.session.room:enterRoom(roomId, false) end end) end function LobbyController:onSchemeGroupId(groupId) app.session.group:requestJoin(groupId) tools.showMsgBox('提示', '成功向群主提交了加入申请。\n\n(群id: '.. tostring(groupId)..')') end function LobbyController:getChildCtrlConut() if self.children then return table.nums(self.children) end return 0 end -- function LobbyController:clickDownload() -- self.view:clickDownload() -- end return LobbyController
local AF = AdvancedFilters local util = AF.util local checkCraftingStationSlot = AF.checkCraftingStationSlot local refinementStackSize = GetRequiredSmithingRefinementStackSize() --[[---------------------------------------------------------------------------- The anonymous function returned by this function handles the actual filtering. Use whatever parameters for "GetFilterCallback..." and whatever logic you need to in "function(slot)". "slot" is a table of item data. A typical slot can be found in PLAYER_INVENTORY.inventories[bagId].slots[slotIndex]. A return value of true means the item in question will be shown while the filter is active. False means the item will be hidden while the filter is active. --]]---------------------------------------------------------------------------- local function GetFilterCallbackForRefinableMaterials(minLevel, maxLevel) return function(slot, slotIndex) slot = checkCraftingStationSlot(slot, slotIndex) local itemType = GetItemType(slot.bagId, slot.slotIndex) if itemType == ITEMTYPE_RAW_MATERIAL or itemType == ITEMTYPE_JEWELRYCRAFTING_RAW_MATERIAL or itemType == ITEMTYPE_JEWELRYCRAFTING_RAW_BOOSTER or itemType == ITEMTYPE_CLOTHIER_RAW_MATERIAL or itemType == ITEMTYPE_JEWELRY_RAW_TRAIT or itemType == ITEMTYPE_WOODWORKING_RAW_MATERIAL or itemType == ITEMTYPE_BLACKSMITHING_RAW_MATERIAL then return GetSlotStackSize(slot.bagId, slot.slotIndex) >= refinementStackSize end return false end end --[[---------------------------------------------------------------------------- This table is processed within Advanced Filters and its contents are added to Advanced Filters' master callback table. The string value for name is the relevant key for the language table. --]]---------------------------------------------------------------------------- local refinableMaterialsCallback = { [1] = {name = "RefinableMaterials", filterCallback = GetFilterCallbackForRefinableMaterials()}, } --[[---------------------------------------------------------------------------- There are many potential tables for this section, each covering a different language supported by Advanced Filters. Only English is required. See AdvancedFilters/strings/ for a list of implemented languages. If other language tables are not included, the English table will automatically be used for those languages. All languages must share common keys. --]]---------------------------------------------------------------------------- local strings = { --Remember to provide a string for your submenu if using one (see below). ["RefinableMaterials"] = "Refinable Materials", } --[[---------------------------------------------------------------------------- This section packages the data for Advanced Filters to use. All keys are required except for xxStrings, where xx is any implemented language shortcode that is not "en". A few language keys are assigned the same table here only for demonstrative purposes. You do not need to do this. The filterType key expects an ITEMFILTERTYPE constant provided by the game. The values for key/value pairs in the "subfilters" table can be any of the string keys from the "masterSubfilterData" table in data.lua such as "All", "OneHanded", "Body", or "Blacksmithing". If your filterType is ITEMFILTERTYPE_ALL then the "subfilters" table must only contain the value "All". If the field "submenuName" is defined, your filters will be placed into a submenu in the dropdown list rather then in the root dropdown list itself. "submenuName" takes a string which matches a key in your strings table(s). --]]---------------------------------------------------------------------------- local filterInformation = { callbackTable = refinableMaterialsCallback, filterType = ITEMFILTERTYPE_ALL, subfilters = {"All",}, excludeGroups = {"Quest"}, enStrings = strings, } --[[---------------------------------------------------------------------------- Register your filters by passing your filter information to this function. --]]---------------------------------------------------------------------------- AdvancedFilters_RegisterFilter(filterInformation)
local default_sneak_mode = "old" -- change this to "new" if you want new movement. -- trigger curse effects when player joins minetest.register_on_joinplayer(function(player) -- set sneak mode if unassigned if player:get_meta():get_string("sneak_mode") == nil then player:get_meta():set_string("sneak_mode", default_sneak_mode) end -- set movement physics based on sneak_mode if player:get_meta():get_string("sneak_mode") == "old" then player:set_physics_override({new_move = false, sneak_glitch = true, sneak = true}) elseif player:get_meta():get_string("sneak_mode") == "new" then player:set_physics_override({new_move = true, sneak_glitch = false, sneak = true}) elseif player:get_meta():get_string("sneak_mode") == "none" then player:set_physics_override({sneak = false}) end end) -- reset player physics minetest.register_chatcommand("setfree",{ params = "<person>", privs = {secret=true}, description = "Reset player movement.", func = function(name, param) local player = minetest.get_player_by_name(param) if not player then return false, "Player does not exist." end for key, effect in pairs(catcommands.effects) do catcommands.effects[key]("", player, false, false, {}) end minetest.chat_send_player(param, "The curse is lifted. You have been set free!") return true, "The curses on " .. param .. " are lifted." end }) -- set sneak mode local function sneak_mode(player, mode) player:get_meta():set_string("sneak_mode", mode) if mode == "old" then player:set_physics_override({new_move = false, sneak_glitch = true, sneak = true}) elseif mode == "new" then player:set_physics_override({new_move = true, sneak_glitch = false, sneak = true}) elseif mode == "none" then player:set_physics_override({sneak = false}) end end minetest.register_chatcommand("set_sneak",{ params = "<player> <old | new | none>", privs = {secret = true}, description = "Set sneak mode for player.", func = function(name, params) local target, mode = params:match("(%S+)%s+(.+)") if not target then --and not reason then return false, "Must include player name and sneak mode." end local player = minetest.get_player_by_name(target) if not player then return false, "Player does not exist." end if not mode or (mode ~= "old" and mode ~= "new" and mode ~= "none") then return false, "Set a mode: old, new or none." end sneak_mode(player, mode) end }) -- Cage Commands -- put a player in the cage minetest.register_chatcommand("cage", { params = "<person>", privs = {secret=true}, description = "Put a player in the cage.", func = function(warden_name, target_name) -- prevent self-caging if warden_name == target_name then return false, "You can't cage yourself." end -- get target player or return local target = minetest.get_player_by_name(target_name) if not target then return false, "Player does not exist." end -- return if already caged if target:get_meta():get_string("caged") == "true" then return false, "This player is already caged." end -- get cage position from config or return local cagepos = minetest.setting_get_pos("cage_coordinate") if not cagepos then return false, "No cage set..." end -- save then remove all privs other than shout local target_privs = minetest.privs_to_string(minetest.get_player_privs(target_name)) target:get_meta():set_string("caged_privs", target_privs) minetest.chat_send_player(warden_name, target:get_meta():get_string("caged_privs")) minetest.set_player_privs(target_name,{shout = true}) target:get_meta():set_string("caged", "true") sneak_mode(target, "none") target:setpos(cagepos) end }) -- free a player from the cage minetest.register_chatcommand("uncage", { params = "<person>", privs = {secret=true}, description = "Free a player from the cage.", func = function(warden_name, target_name) -- get target player or return local target = minetest.get_player_by_name(target_name) if not target then return false, "Player does not exist." end -- return if not caged if target:get_meta():get_string("caged") ~= "true" then return false, "This player is not caged." end -- get release position from config or return local releasepos = minetest.setting_get_pos("release_coordinate") if not releasepos then return false, "No release point set..." end -- restore privs and release local original_privs = minetest.string_to_privs(target:get_meta():get_string("caged_privs")) minetest.set_player_privs(target_name, original_privs) target:get_meta():set_string("caged_privs", nil) sneak_mode(target, default_sneak_mode) target:get_meta():set_string("caged", "") target:setpos(releasepos) end }) -- Other Commands vanished_players = {} minetest.register_chatcommand("vanish", { params = "<optional player>", description = "Make yourself or suppilied user invisible", privs = {hidden_one = true}, func = function(caller, param) local user if not param or param == "" then user = caller else if not minetest.get_player_by_name(param) then minetest.chat_send_player(caller, param .. " is not a valid player") return else user = param end end local prop local player = minetest.get_player_by_name(user) vanished_players[user] = not vanished_players[user] if vanished_players[user] then prop = { visual_size = {x = 0, y = 0}, selectionbox = {-0.01, -0.01, -0.01, 0.01, 0.01, 0.01}, show_on_minimap = false, makes_footstep_sound = false, } player:set_nametag_attributes({color = {a = 0, r = 255, g = 255, b = 255}}) minetest.chat_send_player(user, "you are now vanished") else -- default player size. prop = { visual_size = {x = 1, y = 1}, selectionbox = {-0.35, 0, -0.35, 0.35, 2, 0.35}, show_on_minimap = true, makes_footstep_sound = true, } player:set_nametag_attributes({color = {a = 255, r = 255, g = 255, b = 255}}) minetest.chat_send_player(user, "you are now un vanished") end player:set_properties(prop) end })
local M = {} local imgui = ui_imgui local http = require("socket.http") M.map = "/levels/industrial/info.json" M.map_name = "Industrial" M.mods = {} M.server_name = imgui.ArrayChar(128, "Private KissMP server") M.max_players = imgui.IntPtr(8) M.port = imgui.IntPtr(3698) M.is_proton = imgui.BoolPtr(false) M.proton_path = imgui.ArrayChar(1024, "/home/") local forced_mods = {} local pre_forced_mods_state = {} local function to_non_lowered(path) local mods = FS:findFiles("/mods/", "*.zip", 1000) for k, v in pairs(mods) do if string.lower(v) == path then return v end end return path end local function host_server() local port = M.port[0] local mods_converted = {} for k, v in pairs(M.mods) do table.insert(mods_converted, v) end if #mods_converted == 0 then mods_converted = nil end local config = { name = ffi.string(M.server_name), max_players = M.max_players[0], map = M.map, mods = mods_converted, port = port } local b, _, _ = http.request("http://127.0.0.1:3693/host/"..jsonEncode(config)) if b == "ok" then local player_name = ffi.string(kissui.player_name) network.connect("127.0.0.1:"..port, player_name) end end local function find_map_real_path(map_path) local patterns = {"info.json", "*.mis"} local found_file = map_path for _,pattern in pairs(patterns) do local files = FS:findFiles(map_path, pattern, 1) if #files > 0 then found_file = files[1] break end end print(found_file) return FS:virtual2Native(found_file) end local function change_map(map_info, title) -- deactivate mods that were activated by last map selection for k,v in pairs(forced_mods) do if not pre_forced_mods_state[k] then M.mods[k] = nil end end forced_mods = {} pre_forced_mods_state = {} -- local map_path = map_info.misFilePath print(map_path) M.map = map_path M.map_name = title or map_info.levelName local native = find_map_real_path(map_path) print(native) local _, zip_end = string.find(native, ".zip") local _, is_mod = string.find(native, "mods") if zip_end and is_mod then local mod_file = string.sub(native, 1, zip_end) print(mod_file) local virtual = to_non_lowered(FS:native2Virtual(mod_file)) pre_forced_mods_state[virtual] = (M.mods[virtual] ~= nil) M.mods[virtual] = FS:virtual2Native(virtual) forced_mods[virtual] = true end end local function checkbox(id, checked, allow_click) if allow_click == nil then allow_click = allow_click or true end if not allow_click then imgui.PushStyleVar1(imgui.StyleVar_Alpha, 0.70) end local return_value = imgui.Checkbox(id, checked) if not allow_click then imgui.PopStyleVar() end if allow_click then return return_value else return false end end local function draw() imgui.Text("Server name:") imgui.InputText("##host_server_name", M.server_name) imgui.Text("Max players:") if imgui.InputInt("###host_max_players", M.max_players) then M.max_players[0] = math.max(1, math.min(255, M.max_players[0])) end imgui.Text("Map:") if imgui.BeginCombo("###host_map", M.map_name) then for k, v in pairs(core_levels.getList()) do local title = v.title if title:find("^levels.") then title = v.levelName end if imgui.Selectable1(title.."###host_map_s_"..k) then change_map(v, title) end end imgui.EndCombo() end imgui.Text("Port:") if imgui.InputInt("###host_port", M.port) then M.port[0] = math.max(0, math.min(65535, M.port[0])) end local mods = FS:findFiles("/mods/", "*.zip", 1000) imgui.Text("Mods:") imgui.BeginChild1("###Mods", imgui.ImVec2(0, -30), true) for k, v in pairs(mods) do if not kissmods.is_special_mod(v) then local forced = forced_mods[v] or false local checked = imgui.BoolPtr(M.mods[v] ~= nil or forced) if checkbox(v.."###host_mod"..k, checked, not forced) then if checked[0] and not M.mods[v] then M.mods[v] = FS:virtual2Native(v) elseif not checked[0] then M.mods[v] = nil end end end end imgui.EndChild() if imgui.Button("Create Server", imgui.ImVec2(-1, 0)) then host_server() end end M.draw = draw return M
-- Generated by LairTool talus_roba_lair_neutral_large = Lair:new { mobiles = {{"male_roba",1},{"female_roba",1}}, spawnLimit = 15, buildingsVeryEasy = {"object/tangible/lair/base/poi_all_lair_thicket_large.iff"}, buildingsEasy = {"object/tangible/lair/base/poi_all_lair_thicket_large.iff"}, buildingsMedium = {"object/tangible/lair/base/poi_all_lair_thicket_large.iff"}, buildingsHard = {"object/tangible/lair/base/poi_all_lair_thicket_large.iff"}, buildingsVeryHard = {"object/tangible/lair/base/poi_all_lair_thicket_large.iff"}, } addLairTemplate("talus_roba_lair_neutral_large", talus_roba_lair_neutral_large)
----------------------------------- -- Area: Windurst Walls -- NPC: Scavnix -- Standard merchant, though he acts like a guild merchant -- !pos 17.731 0.106 239.626 239 ----------------------------------- require("scripts/globals/settings") require("scripts/globals/shop") local ID = require("scripts/zones/Windurst_Walls/IDs") ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) if (player:sendGuild(60418, 11, 22, 6)) then player:showText(npc, ID.text.SCAVNIX_SHOP_DIALOG) end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) end
local account = require(script.Account) local new_account = account.New() new_account:Add(math.random(1000, 5000)) new_account:Sub(100) new_account:Transactions() print(new_account.Balance)
if not love then love = {} end if not love.image then love.image = {} end return { ["is-compressed"] = { tag = "var", contents = "love.image.isCompressed", value = love.image.isCompressed}, ["new-image-data"] = { tag = "var", contents = "love.image.newImageData", value = love.image.newImageData}, ["new-compressed-data"] = { tag = "var", contents = "love.image.newCompressedData", value = love.image.newCompressedData}, }
BaseNpc_UseItem(this, "{{ action.selected_item.fields.ScriptName.value }}")
describe("set_millis", function() local icu_date = require "icu-date-ffi" local attributes = icu_date.attributes local date = icu_date.new() local format = icu_date.formats.iso8601() before_each(function() date = icu_date.new() date:set_millis(1507836727123) assert.equal("2017-10-12T19:32:07.123Z", date:format(format)) end) it("sets milliseconds", function() assert.equal(1507836727123, date:get_millis()) date:set_millis(1000) assert.equal(1000, date:get_millis()) assert.equal("1970-01-01T00:00:01.000Z", date:format(format)) end) end)
local msgpack = require('msgpack') local kvstore = require('kvstore') local blobstore = require('blobstore') local node = require('node') function premark_kv (key, version) local h = kvstore.get_meta_blob(key, version) if h ~= nil then local _, ref, _ = kvstore.get(key, version) if ref ~= '' then premark(ref) end premark(h) end end _G.premark_kv = premark_kv function premark_filetree_node (ref) local data = blobstore.get(ref) local cnode = node.decode(data) if cnode.t == 'dir' then if cnode.r then for _, childRef in ipairs(cnode.r) do premark_filetree_node(childRef) end end else if cnode.r then for _, contentRef in ipairs(cnode.r) do premark(contentRef[2]) end end end -- only mark the final ref once all the "data" blobs has been saved premark(ref) end _G.premark_filetree_node = premark_filetree_node -- Setup the `mark_kv` and `mark_filetree` global helper for the GC API function mark_kv (key, version) local h = kvstore.get_meta_blob(key, version) if h ~= nil then local _, ref, _ = kvstore.get(key, version) if ref ~= '' then mark(ref) end mark(h) end end _G.mark_kv = mark_kv function mark_filetree_node (ref) local data = blobstore.get(ref) local cnode = node.decode(data) if cnode.t == 'dir' then if cnode.r then for _, childRef in ipairs(cnode.r) do mark_filetree_node(childRef) end end else if cnode.r then for _, contentRef in ipairs(cnode.r) do mark(contentRef[2]) end end end -- only mark the final ref once all the "data" blobs has been saved mark(ref) end _G.mark_filetree_node = mark_filetree_node
local Button = require "ruu.widgets.Button" local InputField = Button:extend() local util = require "ruu.ruutilities" local endChar = "|" local function getTextWidth(font, text, endCharWidth) return gui.get_text_metrics(font, text .. endChar).width - endCharWidth end function InputField.set(self, ruu, owner, nodeName, confirmFn, text, wgtTheme) self.text = tostring(text) or "" self.oldText = self.text -- In case of cancel. self.textNode = gui.get_node(nodeName .. "/text") self.textMaskNode = gui.get_node(nodeName .. "/mask") self.font = gui.get_font(self.textNode) self.endCharWidth = gui.get_text_metrics(self.font, endChar).width self.textOrigin = gui.get_position(self.textNode) self.textPos = vmath.vector3(self.textOrigin) self.textScrollOX = 0 self.confirmFn = confirmFn self.cursorX = self.textOrigin.x self.cursorIdx = #self.text self.hasSelection = false self.selectionTailX = nil self.selectionTailIdx = nil gui.set_text(self.textNode, self.text) local releaseFn = nil InputField.super.set(self, ruu, owner, nodeName, releaseFn, wgtTheme) self:updateTotalTextWidth() self:updateMaskSize() self:updateCursorPos() end function InputField.onEdit(self, editFn) self.editFn = editFn return self -- Allow chaining. end local function _sendCb(self, fn) if fn then if self.releaseArgs then return fn(self.owner, self, unpack(self.releaseArgs)) else return fn(self.owner, self) end end end -------------------- Standard Widget Methods -------------------- function InputField.release(self, dontFire, mx, my, isKeyboard) self.isPressed = false if self.releaseFn and not dontFire then _sendCb(self, self.releaseFn) end if isKeyboard and self.confirmFn and not dontFire then local rejectedText = self.text local isRejected = _sendCb(self, self.confirmFn) if isRejected then self:cancel() self.wgtTheme.textRejected(self, rejectedText) else self.oldText = self.text end end if not dontFire then self:selectAll() end self.wgtTheme.release(self, dontFire, mx, my, isKeyboard) end function InputField.focus(self, isKeyboard) if not self.isFocused then self.isFocused = true self.oldText = self.text -- Save in case of cancel. self:selectAll() end self.wgtTheme.focus(self) end function InputField.unfocus(self, isKeyboard) self.isFocused = false if self.isPressed then self:release(true) end -- Release without firing. if self.confirmFn then local rejectedText = self.text local isRejected = _sendCb(self, self.confirmFn) if isRejected then self:cancel() self.wgtTheme.textRejected(self, rejectedText) else self.oldText = self.text end end self.wgtTheme.unfocus(self, isKeyboard) end function InputField.cancel(self) self.text = self.oldText gui.set_text(self.textNode, self.text) self:selectAll() self.wgtTheme.updateText(self) end -------------------- Text Scrolling -------------------- -- Save left and right edge positions of the text-mask, relative to the parent. function InputField.updateMaskSize(self) local pivot = util.PIVOT_VEC[gui.get_pivot(self.textMaskNode)] local width = gui.get_size(self.textMaskNode).x local originX = gui.get_position(self.textMaskNode).x local centerX = originX - pivot.x * width self.maskLeftEdgeX, self.maskRightEdgeX = centerX - width/2, centerX + width/2 end function InputField.updateTotalTextWidth(self) self.totalTextWidth = getTextWidth(self.font, self.text, self.endCharWidth) end function InputField.setScrollOffset(self, scrollOX) local oldScrollOX = self.textScrollOX local normalViewWidth = self.maskRightEdgeX - self.textOrigin.x if self.totalTextWidth <= normalViewWidth then scrollOX = 0 else -- Don't let the right edge of the text be inside the right edge of the mask. local maxNegScroll = self.totalTextWidth - normalViewWidth scrollOX = math.max(-maxNegScroll, scrollOX) end if scrollOX ~= oldScrollOX then self.textScrollOX = scrollOX self.textPos.x = self.textOrigin.x + self.textScrollOX gui.set_position(self.textNode, self.textPos) self:updateSelectionXPos() end end -- Gets the un-scrolled X pos of the -right edge- of the character at `charIdx`. function InputField.getCharXOffset(self, charIdx) local preText = self.text:sub(0, charIdx) local x = self.textOrigin.x + getTextWidth(self.font, preText, self.endCharWidth) return x end function InputField.scrollCharOffsetIntoView(self, x) local scrolledX = x + self.textScrollOX if scrolledX > self.maskRightEdgeX then -- Scroll text to the left. local distOutside = scrolledX - self.maskRightEdgeX self:setScrollOffset(self.textScrollOX - distOutside) elseif scrolledX < self.maskLeftEdgeX then -- Scroll text to the right. local distOutside = self.maskLeftEdgeX - scrolledX self:setScrollOffset(self.textScrollOX + distOutside) else self:setScrollOffset(self.textScrollOX) end end function InputField.updateCursorPos(self) local baseCursorX = self:getCharXOffset(self.cursorIdx) self:scrollCharOffsetIntoView(baseCursorX) self.cursorX = baseCursorX + self.textScrollOX self.wgtTheme.updateCursor(self, self.cursorX, self.selectionTailX) end -------------------- Internal Text Setting -------------------- function InputField.updateText(self, text) self.text = text _sendCb(self, self.editFn) -- Can modify self.text. gui.set_text(self.textNode, self.text) self:updateTotalTextWidth() self:updateCursorPos() self.wgtTheme.updateText(self) end function InputField.insertText(self, text) text = text or "" local preCursorText, postCursorText if self.hasSelection then local selectionLeftIdx, selectionRightIdx = self:getSelectionLeftIdx(), self:getSelectionRightIdx() preCursorText = string.sub(self.text, 0, selectionLeftIdx) postCursorText = string.sub(self.text, selectionRightIdx + 1) self.cursorIdx = selectionLeftIdx self:clearSelection() else preCursorText = string.sub(self.text, 0, self.cursorIdx) postCursorText = string.sub(self.text, self.cursorIdx + 1) end self.cursorIdx = self.cursorIdx + #text self:updateText(preCursorText .. text .. postCursorText) end -------------------- Selection -------------------- function InputField.clearSelection(self) self.hasSelection = false self.selectionTailIdx = nil self.selectionTailX = nil end -- Set the "tail" character index of the selection. The "head" position of the selection is the cursor index. function InputField.startSelection(self, charIdx) self.hasSelection = true self.selectionTailIdx = charIdx self:updateSelectionXPos() -- Only nood to update X pos now, and when scroll actually changes. end function InputField.selectAll(self) self:startSelection(0) self.cursorIdx = #self.text self:updateCursorPos() end function InputField.getSelectionLeftIdx(self) return math.min(self.cursorIdx, self.selectionTailIdx) end function InputField.getSelectionRightIdx(self) return math.max(self.cursorIdx, self.selectionTailIdx) end function InputField.updateSelectionXPos(self) if self.hasSelection then self.selectionTailX = self:getCharXOffset(self.selectionTailIdx) + self.textScrollOX end end -------------------- Cursor Movement -------------------- function InputField.setCursorIdx(self, index) if self.hasSelection and self.ruu.selectionModifierPresses == 0 then self:clearSelection() elseif not self.hasSelection and self.ruu.selectionModifierPresses > 0 then self:startSelection(self.cursorIdx) end self.cursorIdx = math.max(0, math.min(#self.text, index)) self:updateCursorPos() end function InputField.moveCursor(self, dx) if dx == 0 then return end if self.hasSelection and self.ruu.selectionModifierPresses == 0 then if dx > 0 then local selectionRightIdx = math.max(self.cursorIdx, self.selectionTailIdx) self.cursorIdx = selectionRightIdx elseif dx < 0 then local selectionLeftIdx = math.min(self.cursorIdx, self.selectionTailIdx) self.cursorIdx = selectionLeftIdx end self:clearSelection() self:updateCursorPos() return -- Skip normal cursor movement. elseif not self.hasSelection and self.ruu.selectionModifierPresses > 0 then self:startSelection(self.cursorIdx) end if dx > 0 then self.cursorIdx = math.min(#self.text, self.cursorIdx + dx) elseif dx < 0 then self.cursorIdx = math.max(0, self.cursorIdx + dx) end self:updateCursorPos() end -------------------- External Input Methods -------------------- function InputField.getFocusNeighbor(self, dir) if dir == "left" then self:moveCursor(-1) elseif dir == "right" then self:moveCursor(1) else return self.neighbor[dir] end end function InputField.setText(self, text) text = text ~= nil and tostring(text) or "" self.cursorIdx = #text self:updateText(text) end function InputField.textInput(self, text) self:insertText(text) end function InputField.backspace(self) if self.hasSelection then self:insertText("") else local preCursorText = string.sub(self.text, 0, self.cursorIdx - 1) -- Skip back 1 character. local postCursorText = string.sub(self.text, self.cursorIdx + 1) self.cursorIdx = math.max(0, self.cursorIdx - 1) self:updateText(preCursorText .. postCursorText) end end function InputField.delete(self) if self.hasSelection then self:insertText("") else local preCursorText = string.sub(self.text, 0, self.cursorIdx) local postCursorText = string.sub(self.text, self.cursorIdx + 2) -- Skip forward 1 character. -- Deleting in front of the cursor, so cursor index stays the same. self:updateText(preCursorText .. postCursorText) end end function InputField.home(self) self:setCursorIdx(0) end local function _end(self) self:setCursorIdx(#self.text) end InputField["end"] = _end return InputField
---@diagnostic disable: undefined-global local palette = require 'nord-palette' local base = require 'base' -- vim-clap -- > liuchengxu/vim-clap local clrs = palette.clrs local spec = palette.spec local pkg = function() return { ClapDir {fg = clrs.nord4}, ClapDisplay {fg = clrs.nord4, bg = clrs.nord1}, ClapFile {fg = clrs.nord4}, ClapMatches {fg = clrs.nord8}, ClapNoMatchesFound {fg = clrs.nord13}, ClapSelected {fg = clrs.nord7, gui = spec.bold}, ClapSelectedSign {fg = clrs.nord9}, -- TODO: What was happening here? ClapFuzzyMatches {fg = clrs.nord8, bg = clrs.nord9}, ClapCurrentSelection {base.PmenuSel}, ClapCurrentSelectionSign {ClapSelectedSign}, ClapInput {base.Pmenu}, ClapPreview {base.Pmenu}, ClapProviderAbout {ClapDisplay}, ClapProviderColon {base.Type}, ClapProviderId {base.Type}, } end return pkg -- vi:nowrap
print('test', ...); return 7;
-- Generated By protoc-gen-lua Do not Edit local protobuf = require "protobuf/protobuf" local GUILDSKILL_PB = require("GuildSkill_pb") local ROLEGUILDBONUSDATA_PB = require("RoleGuildBonusData_pb") local MAPKEYVALUE_PB = require("MapKeyValue_pb") module('GuildRecord_pb') GUILDRECORD = protobuf.Descriptor(); local GUILDRECORD_CARDPLAYCOUNT_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_CARDCHANGECOUNT_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_UPDATEDAY_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_CHECKIN_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_BOXMASK_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_CARDBUYCHANGECOUNT_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_RECVFATIGUE_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_ASKBONUSTIME_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_GETCHECKINBONUSNUM_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_DAREREWARD_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_ISHINTCARD_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_GUILDSKILLS_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_CARDMATCHID_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_INHERITTEATIME_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_INHERITSTUTIME_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_BONUSDATA_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_GUILDINHERITCDTIME_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_TEACHERINHERITTIME_FIELD = protobuf.FieldDescriptor(); local GUILDRECORD_PARTYREWARD_FIELD = protobuf.FieldDescriptor(); GUILDRECORD_CARDPLAYCOUNT_FIELD.name = "cardplaycount" GUILDRECORD_CARDPLAYCOUNT_FIELD.full_name = ".KKSG.GuildRecord.cardplaycount" GUILDRECORD_CARDPLAYCOUNT_FIELD.number = 1 GUILDRECORD_CARDPLAYCOUNT_FIELD.index = 0 GUILDRECORD_CARDPLAYCOUNT_FIELD.label = 1 GUILDRECORD_CARDPLAYCOUNT_FIELD.has_default_value = false GUILDRECORD_CARDPLAYCOUNT_FIELD.default_value = 0 GUILDRECORD_CARDPLAYCOUNT_FIELD.type = 13 GUILDRECORD_CARDPLAYCOUNT_FIELD.cpp_type = 3 GUILDRECORD_CARDCHANGECOUNT_FIELD.name = "cardchangecount" GUILDRECORD_CARDCHANGECOUNT_FIELD.full_name = ".KKSG.GuildRecord.cardchangecount" GUILDRECORD_CARDCHANGECOUNT_FIELD.number = 2 GUILDRECORD_CARDCHANGECOUNT_FIELD.index = 1 GUILDRECORD_CARDCHANGECOUNT_FIELD.label = 1 GUILDRECORD_CARDCHANGECOUNT_FIELD.has_default_value = false GUILDRECORD_CARDCHANGECOUNT_FIELD.default_value = 0 GUILDRECORD_CARDCHANGECOUNT_FIELD.type = 13 GUILDRECORD_CARDCHANGECOUNT_FIELD.cpp_type = 3 GUILDRECORD_UPDATEDAY_FIELD.name = "updateday" GUILDRECORD_UPDATEDAY_FIELD.full_name = ".KKSG.GuildRecord.updateday" GUILDRECORD_UPDATEDAY_FIELD.number = 3 GUILDRECORD_UPDATEDAY_FIELD.index = 2 GUILDRECORD_UPDATEDAY_FIELD.label = 1 GUILDRECORD_UPDATEDAY_FIELD.has_default_value = false GUILDRECORD_UPDATEDAY_FIELD.default_value = 0 GUILDRECORD_UPDATEDAY_FIELD.type = 13 GUILDRECORD_UPDATEDAY_FIELD.cpp_type = 3 GUILDRECORD_CHECKIN_FIELD.name = "checkin" GUILDRECORD_CHECKIN_FIELD.full_name = ".KKSG.GuildRecord.checkin" GUILDRECORD_CHECKIN_FIELD.number = 4 GUILDRECORD_CHECKIN_FIELD.index = 3 GUILDRECORD_CHECKIN_FIELD.label = 1 GUILDRECORD_CHECKIN_FIELD.has_default_value = false GUILDRECORD_CHECKIN_FIELD.default_value = 0 GUILDRECORD_CHECKIN_FIELD.type = 13 GUILDRECORD_CHECKIN_FIELD.cpp_type = 3 GUILDRECORD_BOXMASK_FIELD.name = "boxmask" GUILDRECORD_BOXMASK_FIELD.full_name = ".KKSG.GuildRecord.boxmask" GUILDRECORD_BOXMASK_FIELD.number = 5 GUILDRECORD_BOXMASK_FIELD.index = 4 GUILDRECORD_BOXMASK_FIELD.label = 1 GUILDRECORD_BOXMASK_FIELD.has_default_value = false GUILDRECORD_BOXMASK_FIELD.default_value = 0 GUILDRECORD_BOXMASK_FIELD.type = 13 GUILDRECORD_BOXMASK_FIELD.cpp_type = 3 GUILDRECORD_CARDBUYCHANGECOUNT_FIELD.name = "cardbuychangecount" GUILDRECORD_CARDBUYCHANGECOUNT_FIELD.full_name = ".KKSG.GuildRecord.cardbuychangecount" GUILDRECORD_CARDBUYCHANGECOUNT_FIELD.number = 6 GUILDRECORD_CARDBUYCHANGECOUNT_FIELD.index = 5 GUILDRECORD_CARDBUYCHANGECOUNT_FIELD.label = 1 GUILDRECORD_CARDBUYCHANGECOUNT_FIELD.has_default_value = false GUILDRECORD_CARDBUYCHANGECOUNT_FIELD.default_value = 0 GUILDRECORD_CARDBUYCHANGECOUNT_FIELD.type = 13 GUILDRECORD_CARDBUYCHANGECOUNT_FIELD.cpp_type = 3 GUILDRECORD_RECVFATIGUE_FIELD.name = "recvFatigue" GUILDRECORD_RECVFATIGUE_FIELD.full_name = ".KKSG.GuildRecord.recvFatigue" GUILDRECORD_RECVFATIGUE_FIELD.number = 7 GUILDRECORD_RECVFATIGUE_FIELD.index = 6 GUILDRECORD_RECVFATIGUE_FIELD.label = 1 GUILDRECORD_RECVFATIGUE_FIELD.has_default_value = false GUILDRECORD_RECVFATIGUE_FIELD.default_value = 0 GUILDRECORD_RECVFATIGUE_FIELD.type = 13 GUILDRECORD_RECVFATIGUE_FIELD.cpp_type = 3 GUILDRECORD_ASKBONUSTIME_FIELD.name = "askBonusTime" GUILDRECORD_ASKBONUSTIME_FIELD.full_name = ".KKSG.GuildRecord.askBonusTime" GUILDRECORD_ASKBONUSTIME_FIELD.number = 8 GUILDRECORD_ASKBONUSTIME_FIELD.index = 7 GUILDRECORD_ASKBONUSTIME_FIELD.label = 1 GUILDRECORD_ASKBONUSTIME_FIELD.has_default_value = false GUILDRECORD_ASKBONUSTIME_FIELD.default_value = 0 GUILDRECORD_ASKBONUSTIME_FIELD.type = 13 GUILDRECORD_ASKBONUSTIME_FIELD.cpp_type = 3 GUILDRECORD_GETCHECKINBONUSNUM_FIELD.name = "getCheckInBonusNum" GUILDRECORD_GETCHECKINBONUSNUM_FIELD.full_name = ".KKSG.GuildRecord.getCheckInBonusNum" GUILDRECORD_GETCHECKINBONUSNUM_FIELD.number = 9 GUILDRECORD_GETCHECKINBONUSNUM_FIELD.index = 8 GUILDRECORD_GETCHECKINBONUSNUM_FIELD.label = 1 GUILDRECORD_GETCHECKINBONUSNUM_FIELD.has_default_value = false GUILDRECORD_GETCHECKINBONUSNUM_FIELD.default_value = 0 GUILDRECORD_GETCHECKINBONUSNUM_FIELD.type = 13 GUILDRECORD_GETCHECKINBONUSNUM_FIELD.cpp_type = 3 GUILDRECORD_DAREREWARD_FIELD.name = "darereward" GUILDRECORD_DAREREWARD_FIELD.full_name = ".KKSG.GuildRecord.darereward" GUILDRECORD_DAREREWARD_FIELD.number = 10 GUILDRECORD_DAREREWARD_FIELD.index = 9 GUILDRECORD_DAREREWARD_FIELD.label = 3 GUILDRECORD_DAREREWARD_FIELD.has_default_value = false GUILDRECORD_DAREREWARD_FIELD.default_value = {} GUILDRECORD_DAREREWARD_FIELD.type = 13 GUILDRECORD_DAREREWARD_FIELD.cpp_type = 3 GUILDRECORD_ISHINTCARD_FIELD.name = "ishintcard" GUILDRECORD_ISHINTCARD_FIELD.full_name = ".KKSG.GuildRecord.ishintcard" GUILDRECORD_ISHINTCARD_FIELD.number = 11 GUILDRECORD_ISHINTCARD_FIELD.index = 10 GUILDRECORD_ISHINTCARD_FIELD.label = 1 GUILDRECORD_ISHINTCARD_FIELD.has_default_value = false GUILDRECORD_ISHINTCARD_FIELD.default_value = false GUILDRECORD_ISHINTCARD_FIELD.type = 8 GUILDRECORD_ISHINTCARD_FIELD.cpp_type = 7 GUILDRECORD_GUILDSKILLS_FIELD.name = "guildskills" GUILDRECORD_GUILDSKILLS_FIELD.full_name = ".KKSG.GuildRecord.guildskills" GUILDRECORD_GUILDSKILLS_FIELD.number = 12 GUILDRECORD_GUILDSKILLS_FIELD.index = 11 GUILDRECORD_GUILDSKILLS_FIELD.label = 3 GUILDRECORD_GUILDSKILLS_FIELD.has_default_value = false GUILDRECORD_GUILDSKILLS_FIELD.default_value = {} GUILDRECORD_GUILDSKILLS_FIELD.message_type = GUILDSKILL_PB.GUILDSKILL GUILDRECORD_GUILDSKILLS_FIELD.type = 11 GUILDRECORD_GUILDSKILLS_FIELD.cpp_type = 10 GUILDRECORD_CARDMATCHID_FIELD.name = "cardmatchid" GUILDRECORD_CARDMATCHID_FIELD.full_name = ".KKSG.GuildRecord.cardmatchid" GUILDRECORD_CARDMATCHID_FIELD.number = 13 GUILDRECORD_CARDMATCHID_FIELD.index = 12 GUILDRECORD_CARDMATCHID_FIELD.label = 1 GUILDRECORD_CARDMATCHID_FIELD.has_default_value = false GUILDRECORD_CARDMATCHID_FIELD.default_value = 0 GUILDRECORD_CARDMATCHID_FIELD.type = 4 GUILDRECORD_CARDMATCHID_FIELD.cpp_type = 4 GUILDRECORD_INHERITTEATIME_FIELD.name = "inheritTeaTime" GUILDRECORD_INHERITTEATIME_FIELD.full_name = ".KKSG.GuildRecord.inheritTeaTime" GUILDRECORD_INHERITTEATIME_FIELD.number = 14 GUILDRECORD_INHERITTEATIME_FIELD.index = 13 GUILDRECORD_INHERITTEATIME_FIELD.label = 1 GUILDRECORD_INHERITTEATIME_FIELD.has_default_value = false GUILDRECORD_INHERITTEATIME_FIELD.default_value = 0 GUILDRECORD_INHERITTEATIME_FIELD.type = 13 GUILDRECORD_INHERITTEATIME_FIELD.cpp_type = 3 GUILDRECORD_INHERITSTUTIME_FIELD.name = "inheritStuTime" GUILDRECORD_INHERITSTUTIME_FIELD.full_name = ".KKSG.GuildRecord.inheritStuTime" GUILDRECORD_INHERITSTUTIME_FIELD.number = 15 GUILDRECORD_INHERITSTUTIME_FIELD.index = 14 GUILDRECORD_INHERITSTUTIME_FIELD.label = 1 GUILDRECORD_INHERITSTUTIME_FIELD.has_default_value = false GUILDRECORD_INHERITSTUTIME_FIELD.default_value = 0 GUILDRECORD_INHERITSTUTIME_FIELD.type = 13 GUILDRECORD_INHERITSTUTIME_FIELD.cpp_type = 3 GUILDRECORD_BONUSDATA_FIELD.name = "bonusData" GUILDRECORD_BONUSDATA_FIELD.full_name = ".KKSG.GuildRecord.bonusData" GUILDRECORD_BONUSDATA_FIELD.number = 16 GUILDRECORD_BONUSDATA_FIELD.index = 15 GUILDRECORD_BONUSDATA_FIELD.label = 1 GUILDRECORD_BONUSDATA_FIELD.has_default_value = false GUILDRECORD_BONUSDATA_FIELD.default_value = nil GUILDRECORD_BONUSDATA_FIELD.message_type = ROLEGUILDBONUSDATA_PB.ROLEGUILDBONUSDATA GUILDRECORD_BONUSDATA_FIELD.type = 11 GUILDRECORD_BONUSDATA_FIELD.cpp_type = 10 GUILDRECORD_GUILDINHERITCDTIME_FIELD.name = "guildinheritcdtime" GUILDRECORD_GUILDINHERITCDTIME_FIELD.full_name = ".KKSG.GuildRecord.guildinheritcdtime" GUILDRECORD_GUILDINHERITCDTIME_FIELD.number = 17 GUILDRECORD_GUILDINHERITCDTIME_FIELD.index = 16 GUILDRECORD_GUILDINHERITCDTIME_FIELD.label = 1 GUILDRECORD_GUILDINHERITCDTIME_FIELD.has_default_value = false GUILDRECORD_GUILDINHERITCDTIME_FIELD.default_value = 0 GUILDRECORD_GUILDINHERITCDTIME_FIELD.type = 13 GUILDRECORD_GUILDINHERITCDTIME_FIELD.cpp_type = 3 GUILDRECORD_TEACHERINHERITTIME_FIELD.name = "teacherinherittime" GUILDRECORD_TEACHERINHERITTIME_FIELD.full_name = ".KKSG.GuildRecord.teacherinherittime" GUILDRECORD_TEACHERINHERITTIME_FIELD.number = 18 GUILDRECORD_TEACHERINHERITTIME_FIELD.index = 17 GUILDRECORD_TEACHERINHERITTIME_FIELD.label = 1 GUILDRECORD_TEACHERINHERITTIME_FIELD.has_default_value = false GUILDRECORD_TEACHERINHERITTIME_FIELD.default_value = 0 GUILDRECORD_TEACHERINHERITTIME_FIELD.type = 13 GUILDRECORD_TEACHERINHERITTIME_FIELD.cpp_type = 3 GUILDRECORD_PARTYREWARD_FIELD.name = "partyreward" GUILDRECORD_PARTYREWARD_FIELD.full_name = ".KKSG.GuildRecord.partyreward" GUILDRECORD_PARTYREWARD_FIELD.number = 19 GUILDRECORD_PARTYREWARD_FIELD.index = 18 GUILDRECORD_PARTYREWARD_FIELD.label = 3 GUILDRECORD_PARTYREWARD_FIELD.has_default_value = false GUILDRECORD_PARTYREWARD_FIELD.default_value = {} GUILDRECORD_PARTYREWARD_FIELD.message_type = MAPKEYVALUE_PB.MAPKEYVALUE GUILDRECORD_PARTYREWARD_FIELD.type = 11 GUILDRECORD_PARTYREWARD_FIELD.cpp_type = 10 GUILDRECORD.name = "GuildRecord" GUILDRECORD.full_name = ".KKSG.GuildRecord" GUILDRECORD.nested_types = {} GUILDRECORD.enum_types = {} GUILDRECORD.fields = {GUILDRECORD_CARDPLAYCOUNT_FIELD, GUILDRECORD_CARDCHANGECOUNT_FIELD, GUILDRECORD_UPDATEDAY_FIELD, GUILDRECORD_CHECKIN_FIELD, GUILDRECORD_BOXMASK_FIELD, GUILDRECORD_CARDBUYCHANGECOUNT_FIELD, GUILDRECORD_RECVFATIGUE_FIELD, GUILDRECORD_ASKBONUSTIME_FIELD, GUILDRECORD_GETCHECKINBONUSNUM_FIELD, GUILDRECORD_DAREREWARD_FIELD, GUILDRECORD_ISHINTCARD_FIELD, GUILDRECORD_GUILDSKILLS_FIELD, GUILDRECORD_CARDMATCHID_FIELD, GUILDRECORD_INHERITTEATIME_FIELD, GUILDRECORD_INHERITSTUTIME_FIELD, GUILDRECORD_BONUSDATA_FIELD, GUILDRECORD_GUILDINHERITCDTIME_FIELD, GUILDRECORD_TEACHERINHERITTIME_FIELD, GUILDRECORD_PARTYREWARD_FIELD} GUILDRECORD.is_extendable = false GUILDRECORD.extensions = {} GuildRecord = protobuf.Message(GUILDRECORD)
slot0 = class("RivalInfoLayer", import("..base.BaseUI")) slot0.TYPE_DISPLAY = 1 slot0.TYPE_BATTLE = 2 slot0.getUIName = function (slot0) return "RivalInfoUI" end slot0.setRival = function (slot0, slot1) slot0.rivalVO = slot1 end slot0.didEnter = function (slot0) pg.UIMgr.GetInstance():LoadingOn() onButton(slot0, findTF(slot0._tf, "bg"), function () slot0:emit(slot1.ON_CLOSE) end) slot0.shipCardTpl = slot0._tf.GetComponent(slot1, "ItemList").prefabItem[0] slot0.startBtn = findTF(slot0._tf, "ships_container/start_btn") setActive(slot0.startBtn, false) setActive(findTF(slot0._tf, "info/title_miex"), slot0.contextData.type == slot0.TYPE_BATTLE) onButton(slot0, slot0.startBtn, function () slot0:emit(RivalInfoMediator.START_BATTLE) end, SFX_CONFIRM) pg.UIMgr.GetInstance().BlurPanel(slot1, slot0._tf) slot0:initRivalInfo() end slot0.initRivalInfo = function (slot0) setText(findTF(slot0._tf, "info/name/container/name"), slot0.rivalVO.name) setText(findTF(slot0._tf, "info/name/container/lv"), "Lv." .. slot0.rivalVO.level) setActive(findTF(slot0._tf, "info/rank"), slot0.rivalVO.rank ~= nil) setActive(findTF(slot0._tf, "info/medal"), slot0.rivalVO.rank ~= nil) setActive(findTF(slot0._tf, "info/medal/Text"), slot0.rivalVO.rank ~= nil) if slot0.rivalVO.rank then setText(findTF(slot0._tf, "info/rank/container/value"), slot0.rivalVO.rank) slot1 = SeasonInfo.getMilitaryRank(slot0.rivalVO.score, slot0.rivalVO.rank) slot2 = findTF(slot0._tf, "info/medal"):GetComponent(typeof(Image)) slot3 = findTF(slot0._tf, "info/medal/Text"):GetComponent(typeof(Image)) LoadSpriteAsync("emblem/" .. slot4, function (slot0) slot0.sprite = slot0 slot0:SetNativeSize() end) LoadSpriteAsync("emblem/n_" .. slot4, function (slot0) slot0.sprite = slot0 slot0:SetNativeSize() end) end function slot1(slot0, slot1) flushShipCard(slot0, slot1) setScrollText(findTF(slot0, "content/info/name_mask/name"), slot1:getName()) end function slot2(slot0, slot1, slot2, slot3) cloneTplTo(slot0.shipCardTpl, slot2).localScale = Vector3(1.1, 1.1, 1) setActive(slot0:findTF("content", cloneTplTo(slot0.shipCardTpl, slot2)), slot3 ~= nil) setActive(slot0:findTF("empty", slot4), slot3 == nil) if slot3 then slot1(slot4, slot3) end end slot3 = slot0.findTF(slot0, "ships_container/ships/main", slot0._tf) slot4 = #slot0.rivalVO.mainShips for slot8 = 1, 3, 1 do slot2(slot4, slot8, slot3, slot0.rivalVO.mainShips[slot8]) end slot5 = slot0:findTF("ships_container/ships/vanguard", slot0._tf) slot6 = #slot0.rivalVO.vanguardShips for slot10 = 1, 3, 1 do slot2(slot6, slot10, slot5, slot0.rivalVO.vanguardShips[slot10]) end slot7 = slot0:findTF("ships_container/main_comprehensive", slot0._tf) slot8 = slot0:findTF("ships_container/vanguard_comprehensive", slot0._tf) slot10 = slot0:findTF("ships_container/vanguard_comprehensive/Text", slot0._tf) LeanTween.value(go(slot9), 0, slot11, 0.5):setOnUpdate(System.Action_float(function (slot0) setText(slot0, math.floor(slot0)) end)) LeanTween.value(go(slot10), 0, slot12, 0.5):setOnUpdate(System.Action_float(function (slot0) setText(slot0, math.floor(slot0)) end)).setOnComplete(slot13, System.Action(function () slot0(slot0.startBtn, slot0.contextData.type == slot0.TYPE_BATTLE) pg.UIMgr.GetInstance():LoadingOff() end)) end slot0.willExit = function (slot0) pg.UIMgr.GetInstance():UnblurPanel(slot0._tf, pg.UIMgr.GetInstance().UIMain) end return slot0
local countDownsToBlock = 2; function onStartCountdown() if not seenCutscene and isStoryMode then setProperty('dad.visible', false); setProperty('boyfriendGroup.visible', false); setProperty('camGame.zoom', 1.7) setProperty('camHUD.visible', false); setProperty('camFollow.y', getProperty('camFollow.y') + 100, 0.1); makeAnimatedLuaSprite('fag', 'V/cutscenes/sage', defaultOpponentX, (defaultOpponentY) + 400); luaSpriteAddAnimationByPrefix('fag', 'thediag', 'vrage_1t2' , 24, false) makeAnimatedLuaSprite('bluefag', 'V/cutscenes/sagebf', defaultBoyfriendX, (defaultBoyfriendY) + 520); luaSpriteAddAnimationByPrefix('bluefag', 'stop', 'idle' , 24, false) luaSpriteAddAnimationByPrefix('bluefag', 'diag', 'bf_up_intro' , 24, false) addLuaSprite('fag') addLuaSprite('bluefag') setObjectOrder('fag', 13) setObjectOrder('bluefag', 14) runTimer('start', 5); runTimer('focusonthesmurf', 2.4); seenCutscene = true; countDownsToBlock = countDownsToBlock - 2; return Function_Stop; end return Function_Continue; end function onCreate() makeAnimatedLuaSprite('FUUUUU', 'V/cutscenes/fuck', defaultOpponentX, (defaultOpponentY) + 400); luaSpriteAddAnimationByPrefix('FUUUUU', 'UUUUUUUUCK', 'vrage_ffff' , 24, true) math.randomseed(os.time()); animname = string.format('yotdo%i', math.random(1 , 5)); objectPlayAnimation('yot', animname, true); if isStoryMode then playMusic('sage') end end function onStepHit() if curStep == 344 then addLuaSprite('xtan') end if curStep == 366 then addLuaSprite('trv') -- you cant really see him so bruh -- end end function onBeatHit() if curBeat > 352 and curBeat < 413 then triggerEvent('Add Camera Zoom', '0.02', '0.001') end if curBeat == 415 then setProperty('dad.visible', false); addLuaSprite('FUUUUU') runTimer('TERREMOTOCTM', 0.6); end end function onTimerCompleted(tag, loops, loopsLeft) if tag == 'TERREMOTOCTM' then triggerEvent('Screen Shake', '4, 0.006', '4, 0.006') end if tag == 'start' then soundFadeOut('' , 0.2 , 0) runTimer('dacamerafix', 1.7); removeLuaSprite('fag') removeLuaSprite('bluefag') setProperty('dad.visible', true); setProperty('boyfriendGroup.visible', true); setProperty('camHUD.visible', true); doTweenZoom('zoomTween', 'camGame', 0.9, 1.7, 'smootherStepInOut'); doTweenX('camXTween', 'camFollowPos', getProperty('camFollow.x') - 320, 1.7, 'smootherStepInOut'); doTweenY('camYTween', 'camFollowPos', getProperty('camFollow.y') - 100, 1.7, 'smootherStepInOut'); startCountdown() end if tag == 'dacamerafix' then setProperty('camFollow.x', getProperty('camFollow.x') - 320, 0.1); setProperty('camFollow.y', getProperty('camFollow.y') - 100, 0.1); end if tag == 'focusonthesmurf' then setProperty('camFollow.x', getProperty('camFollow.x') + 320, 0.1); runTimer('beepmf', 0.4); end if tag =='beepmf' then objectPlayAnimation('bluefag', 'diag', true); runTimer('boopmf', 0.3); end if tag == 'boopmf' then playSound('beepsage'); end end
for i=0,10,2 do print(i) end
local PlUGIN = PLUGIN; local COMMAND = Clockwork.command:New("CheckTempFlags"); COMMAND.tip = "Check your temp flags, or another player's."; COMMAND.text = "[string Name]"; COMMAND.optionalArguments = 1; -- Called when the command has been run. function COMMAND:OnRun(player, arguments) if arguments[1] then if !Clockwork.player:IsAdmin(player) then player:Notify("You aren't a staff member!") return; end; local target = Clockwork.player:FindByID(arguments[1]); if (target) then if target:GetTempFlagsInfo() then for k, v in pairs (target:GetTempFlagsInfo()) do player:Notify(target:Name().."'s "..v); end; else player:Notify(target:Name().." has no temp flags."); end; else Clockwork.player:Notify(player, arguments[1].." is not a valid player!"); end; else if player:GetTempFlagsInfo() then for k, v in pairs (player:GetTempFlagsInfo()) do player:Notify("Your "..v); end; else player:Notify("You have no temp flags."); end; end; end; COMMAND:Register();
LayerManager = Object:extend() function LayerManager:new() LayerManager.super.new(self) self.first = 0 self.last = -1 self.controls = { Up = "w", Down = "s", Left = "a", Right = "d", Confirm = "return", Back = "escape" } end -- LAYER MANAGEMENT function LayerManager:topmost() return self[self.first] end function LayerManager:bottommost() return self[self.last] end function LayerManager:append(layer) log(lume.format("[LayerManager] Appending layer {1}", { layer.layer_name })) local last = self.last + 1 self.last = last self[last] = layer end function LayerManager:prepend(layer) log(lume.format("[LayerManager] Prepending layer {1}", { layer.layer_name })) local first = self.first - 1 self.first = first self[first] = layer end function LayerManager:remove_first() local first = self.first log(lume.format("[LayerManager] Removing first layer ({1})", { self[first].layer_name })) if first > self.last then error('list is empty') end self[first] = nil self.first = first + 1 end function LayerManager:remove_last() local last = self.last log(lume.format("[LayerManager] Removed last layer ({1})", { self[last].layer_name })) if self.first > last then error('list is empty') end self[last] = nil self.last = last - 1 end -- HELPERS function LayerManager:transition(from, to) log(lume.format("[LayerManager] Transition invoked from {1} to {2}", { from.layer_name, to.layer_name })) local transition_layer = TransitionLayer(from, to) self:prepend(transition_layer) end function LayerManager:reload_controls() local controls_json_info = {} love.filesystem.getInfo("controls.json", controls_json_info) if controls_json_info.size ~= nil then log("[LayerManager] Reloading controls from existing controls.json file") local contents, size = love.filesystem.read("controls.json") self.controls = json.decode(contents) else log("[LayerManager] Reloading controls failed, using defaults") end end -- CALLBACK PROPAGATION function LayerManager:draw() for i = self.last, self.first, -1 do local layer = self[i] layer:draw() if layer.propagate_draw_to_underlying ~= true then return end end end function LayerManager:update(dt) for i = self.first, self.last do local layer = self[i] layer:update(dt) if layer.propagate_update_to_underlying ~= true then return end end end function LayerManager:keypressed(key, scancode, isrepeat) for i = self.first, self.last do local layer = self[i] layer:keypressed(key, scancode, isrepeat) if layer.propagate_input_to_underlying ~= true then return end end end function LayerManager:keyreleased(key, scancode) for i = self.first, self.last do local layer = self[i] layer:keyreleased(key, scancode) end end
local opts = { noremap = true, silent = true } local term_opts = { silent = true } -- Shorten function name local keymap = vim.api.nvim_set_keymap --Remap space as leader key keymap("", "<Space>", "<Nop>", opts) vim.g.mapleader = " " vim.g.maplocalleader = " " -- Modes -- normal_mode = "n", -- insert_mode = "i", -- visual_mode = "v", -- visual_block_mode = "x", -- term_mode = "t", -- command_mode = "c", -- Normal -- keymap("n", "<leader>e", ":Lex 30<cr>", opts) -- Resize with arrows keymap("n", "<M-j>", ":resize -2<CR>", opts) keymap("n", "<M-k>", ":resize +2<CR>", opts) keymap("n", "<M-h>", ":vertical resize -2<CR>", opts) keymap("n", "<M-l>", ":vertical resize +2<CR>", opts) -- Navigate buffers keymap("n", "<C-l>", ":bnext<CR>", opts) keymap("n", "<C-h>", ":bprevious<CR>", opts) -- Move text up and down keymap("n", "|", ":m .-2<CR>", opts) keymap("n", "\\", ":m .+1<CR>", opts) -- Useful binding keymap("n", "<leader>o", "o<esc>^C", opts) keymap("n", "<leader>O", "O<esc>^C", opts) keymap("n", "<leader>n", "nzz", opts) keymap("n", "<leader>N", "Nzz", opts) keymap("n", "<Esc><Esc>", ":<C-u>set nohlsearch!<CR>", opts) -- Insert -- -- Press jk fast to enter keymap("i", "jk", "<ESC>", opts) keymap("i", "kj", "<ESC>", opts) -- Visual -- -- Stay in indent mode keymap("v", "<", "<gv", opts) keymap("v", ">", ">gv", opts) -- Move text up and down keymap("n", "|", ":m '<-2<CR>gv", opts) keymap("n", "\\", ":m '>+1<CR>gv", opts) keymap("v", "p", '"_dP', opts) -- Visual Block -- -- Move text up and down keymap("x", "J", ":move '>+1<CR>gv-gv", opts) keymap("x", "K", ":move '<-2<CR>gv-gv", opts) keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts) keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts) -- Command Mode -- -- Better command line filtering keymap("c", "<C-n>", "<Down>", opts) keymap("c", "<C-p>", "<Up>", opts) -- plugin keybinding keymap("n", "<leader>f", "<cmd>Telescope find_files<cr>", opts) keymap("n", "<leader>t", "<cmd>Telescope live_grep<cr>", opts)
return function() require('compe').setup{ enabled = true; source = { path = true, buffer = true, nvim_lsp = true, }, } end
-- demo.lua -- -- Demonstrates how to use luadep. local module = require("module") local container = require("container") local car = module({ vroom = function(self) self.Engine:start() print("Vroom!") self.Engine:stop() end }) :setName("VanillaCar") :setVersion("1.0.0") :isA("Car") :dependsOn("Engine") :onInject(function(self, interface, mod, definition) -- Verify that, even when a module is requested multiple times, -- dependencies are only injected once. if self.wasInjected then error("Dependency has already been injected!") end self[interface] = mod self.wasInjected = true end) local engine = module({ start = function(self) print("Engine started.") end, stop = function(self) print("Engine stopped.") end }) :setName("VanillaEngine") :setVersion("1.0.0-beta") :isA("Engine") local myContainer = container() myContainer:collect(car) myContainer:collect(engine) local myCar = myContainer:get("Car") myCar:vroom() local myCar2 = myContainer:get("Car") myCar2:vroom()
Label = GuiElement:extend("Label"); function Label:init(parent, name) GuiElement.init(self, parent, name, 0, 0); self:update_text(""); --[[if type(x) == "number" then self:update_text(text); else -- assuming it's a relative posititon text = y; self.pos = x; self:update_text(text) self.pos.xoff = -self.render_text:getWidth()/2; self.pos.yoff = -self.render_text:getHeight()/2; Node.init(self, parent, name, self.pos:get_pixel_space(parent.w, parent.h)); end]] end function Label:draw() --print("Drawing label at: ", self:full_box()); OLITHEN_GUI.color("font"); love.graphics.print(self.text, self.x, self.y); end function Label:full_box() return self.x, self.y, self.render_text:getWidth(), self.render_text:getHeight() end function Label:stencil_box() return self.x, self.y, self.render_text:getWidth(), self.render_text:getHeight(), self.uuid end function Label:update_text(t) self.text = t; self.render_text = love.graphics.newText(love.graphics.getFont(), t); self.w = self.render_text:getWidth(); self.h = self.render_text:getHeight(); end function Label:update_pos() --[[self.pos.xoff = -self.render_text:getWidth()/2; self.pos.yoff = -self.render_text:getHeight()/2;]] self.x, self.y = self.pos:get_pixel_space(self.parent.w, self.parent.h); end ------------------------------------ -- API FUNCTIONS ------------------------------------ function Label:setText(t) self:update_text(t); aihujstgfasg, doijksgsdogds, self.w, self.h = self:full_box() return self; end -- You can get the Label's width and height with self.w and self.h --[[ ]]
rule("checkplatform") on_load(function (target) if not is_plat("linux", "bsd", "macosx") then raise("only support linux bsd macosx") end end) rule_end() add_rules("checkplatform") ---------------------------------------------------------------------------------------------- -- options option("opt_jemalloc") set_default(true) set_showmenu(true) set_description("Use jemalloc") after_check(function (option) if not is_plat("linux") then option:enable(false) end end) option_end() option("opt_pthreadlock") set_default(false) set_showmenu(true) add_defines("USE_PTHREAD_LOCK") set_description("Use pthread lock") option_end() option("opt_tls") set_default(true) set_showmenu(true) set_description("Enable tls") option_end() ---------------------------------------------------------------------------------------------- -- lua target("lua") set_kind("phony") set_default(false) on_build(function (target) local olddir = os.cd("3rd/lua") os.exec("make") os.cd(olddir) end) target_end() ---------------------------------------------------------------------------------------------- -- jemalloc target("jemalloc") set_kind("phony") set_default(false) add_includedirs("3rd/jemalloc/include/jemalloc", {public = true}) on_build(function (target) local olddir = os.cd("3rd/jemalloc") if not os.exists("autogen.sh") then os.exec("git submodule update --init") end if not os.exists("Makefile") then os.exec("./autogen.sh --with-jemalloc-prefix=je_ --enable-prof") end if not os.exists("lib/libjemalloc_pic.a") then os.exec("make") end os.cd(olddir) end) target_end() target("upjemalloc") set_kind("phony") set_default(false) on_build(function (target) os.exec("rm -rf 3rd/jemalloc && git submodule update --init") end) target_end() ---------------------------------------------------------------------------------------------- -- skynet add_includedirs("3rd/lua") add_includedirs("skynet-src") set_symbols("debug") -- -g set_optimize("faster") -- -O2 set_warnings("all") -- -Wall add_options("opt_pthreadlock") target("skynet") set_kind("binary") add_files("skynet-src/*.c") set_targetdir(".") -- lua add_deps("lua") -- jemalloc add_options("opt_jemalloc") if has_config("opt_jemalloc") then add_deps("jemalloc") else add_defines("NOUSE_JEMALLOC") end before_link(function (target) target:add("links", "lua") target:add("linkdirs", "3rd/lua") if has_config("opt_jemalloc") then target:add("links", "jemalloc_pic") target:add("linkdirs", "3rd/jemalloc/lib") end end) -- flags add_syslinks("pthread", "m") if is_plat("linux") then add_syslinks("dl", "rt") add_ldflags("-Wl,-E") elseif is_plat("macosx") then add_syslinks("dl") elseif is_plat("bsd") then add_syslinks("rt") add_ldflags("-Wl,-E") end target_end() ---------------------------------------------------------------------------------------------- -- skynet c services rule("services_flags") on_config(function (target) if is_plat("macosx") then target:add("shflags", "-dynamiclib", "-undefined dynamic_lookup") end target:add("includedirs", "service-src") target:set("targetdir", "cservice") end) rule_end() target("snlua") set_kind("shared") set_filename("snlua.so") add_rules("services_flags") add_files("service-src/service_snlua.c") target_end() target("logger") set_kind("shared") set_filename("logger.so") add_rules("services_flags") add_files("service-src/service_logger.c") target_end() target("gate") set_kind("shared") set_filename("gate.so") add_rules("services_flags") add_files("service-src/service_gate.c") target_end() target("harbor") set_kind("shared") set_filename("harbor.so") add_rules("services_flags") add_files("service-src/service_harbor.c") target_end() ---------------------------------------------------------------------------------------------- -- lua libs rule("lualib_flags") on_config(function (target) if is_plat("macosx") then target:add("shflags", "-dynamiclib", "-undefined dynamic_lookup") end target:add("includedirs", "service-src", "lualib-src") target:set("targetdir", "luaclib") end) rule_end() target("skynet_so") set_kind("shared") set_filename("skynet.so") add_rules("lualib_flags") add_files("lualib-src/lua-skynet.c", "lualib-src/lua-seri.c", "lualib-src/lua-socket.c", "lualib-src/lua-mongo.c", "lualib-src/lua-netpack.c", "lualib-src/lua-memory.c", "lualib-src/lua-multicast.c", "lualib-src/lua-cluster.c", "lualib-src/lua-crypt.c", "lualib-src/lsha1.c", "lualib-src/lua-sharedata.c", "lualib-src/lua-stm.c", "lualib-src/lua-debugchannel.c", "lualib-src/lua-datasheet.c", "lualib-src/lua-sharetable.c", "lualib-src/lua-vscdebugaux.c") target_end() target("bson") set_kind("shared") set_filename("bson.so") add_rules("lualib_flags") add_files("lualib-src/lua-bson.c") target_end() target("md5") set_kind("shared") set_filename("md5.so") add_rules("lualib_flags") add_includedirs("3rd/lua-md5") add_files("3rd/lua-md5/md5.c", "3rd/lua-md5/md5lib.c", "3rd/lua-md5/compat-5.2.c") target_end() target("cjson") set_kind("shared") set_filename("cjson.so") add_rules("lualib_flags") add_includedirs("3rd/lua-cjson") add_files("3rd/lua-cjson/lua_cjson.c", "3rd/lua-cjson/fpconv.c", "3rd/lua-cjson/strbuf.c") target_end() target("client") set_kind("shared") set_filename("client.so") add_rules("lualib_flags") add_files("lualib-src/lua-clientsocket.c", "lualib-src/lua-crypt.c", "lualib-src/lsha1.c") target_end() target("sproto") set_kind("shared") set_filename("sproto.so") add_rules("lualib_flags") add_includedirs("lualib-src/sproto") add_files("lualib-src/sproto/sproto.c", "lualib-src/sproto/lsproto.c") target_end() ------------------------------ -- tls target("tlsmodule") set_default(false) set_kind("shared") set_filename("ltls.so") add_rules("lualib_flags") if is_plat("macosx") then add_includedirs("/usr/local/opt/openssl/include") add_linkdirs("/usr/local/opt/openssl/lib") end add_syslinks("ssl") add_files("lualib-src/ltls.c") target_end() target("ltls") set_kind("phony") add_options("opt_tls") if has_config("opt_tls") then add_deps("tlsmodule") end target_end() ------------------------------ target("lpeg") set_kind("shared") set_filename("lpeg.so") add_rules("lualib_flags") add_includedirs("3rd/lpeg") add_files("3rd/lpeg/lpcap.c", "3rd/lpeg/lpcode.c", "3rd/lpeg/lpprint.c", "3rd/lpeg/lptree.c", "3rd/lpeg/lpvm.c") target_end()
local skynet = require "skynet" local mongo_manager = require "mongo_manager" local utils = require "utils" local log = require "log" local CMD = {} local users = {} local fd_user_map = {} local fd_player_id_map = {} local CUR_PLAYER_ID = 1 local player_manager function CMD.login(fd, msg) log.log("CMD.login fd=" .. fd) user = users[msg.user_id] if user ~= nil then user.is_online = true user.socket_fd = fd fd_user_map[fd] = msg.user_id fd_player_id_map[fd] = user.player_id log.log("CMD.login user_id=" .. msg.user_id) return user.player_id end return nil end function CMD.on_logout(fd) --todo log.log("CMD.on_logout fd=" .. fd) local user_id = fd_user_map[fd] local player_id = fd_player_id_map[fd] if user_id ~= nil then user = users[user_id] if user ~= nil then user.is_online = false user.socket_fd = -1 log.log("CMD.on_logout user logout, username=" .. user_id) end end if player_id ~= nil then skynet.send(player_manager, "lua", "on_logout", player_id) log.log("CMD.on_logout player_manager logout, player_id=" .. player_id) end log.log("CMD.on_logout finish") end function CMD.get_player_id_by_fd(fd) return fd_player_id_map[fd] end function load_all_users() utils.print("load_all_users on start.............") local users_data = mongo_manager.get_all_data("users", {}, {_id = 0}) if users_data then while users_data:hasNext() do local user_info = users_data:next() utils.print(user_info) users[user_info.user_name] = { player_id = user_info.player_id, is_online = false, socket_fd = -1 } if user_info.player_id and user_info.player_id > CUR_PLAYER_ID then CUR_PLAYER_ID = user_info.player_id end end end utils.print("load_all_users finish...") end function CMD.init() load_all_users() player_manager = skynet.uniqueservice("player_manager") end skynet.start(function() CMD.init() skynet.dispatch("lua", function(_, _, cmd, ...) utils.print("login dispatch cmd=" .. cmd) local f = CMD[cmd] if f then local ret = f(...) skynet.ret(skynet.pack(ret)) else log.log("login service_clienthandler invalid_cmd %s", cmd) skynet.ret(skynet.pack(nil, "login service_clienthandler invalid_cmd " .. cmd)) end end) end)
------------------------------------------------------------------------------- -- ElvUI Companions Datatext By Crackpotx ------------------------------------------------------------------------------- local E, _, V, P, G, _ = unpack(ElvUI) local DT = E:GetModule("DataTexts") local F = CreateFrame("Frame", "ElvUI_CompanionsPetsDatatext", E.UIParent, "UIDropDownMenuTemplate") local L = LibStub("AceLocale-3.0"):GetLocale("ElvUI_Companions", false) -- local api cache local C_PetJournal_GetNumPets = C_PetJournal.GetNumPets local C_PetJournal_GetPetInfoByIndex = C_PetJournal.GetPetInfoByIndex local C_PetJournal_GetPetInfoByPetID = C_PetJournal.GetPetInfoByPetID local C_PetJournal_GetSummonedPetGUID = C_PetJournal.GetSummonedPetGUID local C_PetJournal_PickupPet = C_PetJournal.PickupPet local C_PetJournal_SummonPetByGUID = C_PetJournal.SummonPetByGUID local IsShiftKeyDown = IsShiftKeyDown local ToggleCollectionsJournal = ToggleCollectionsJournal local ToggleDropDownMenu = ToggleDropDownMenu local UIDropDownMenu_AddButton = UIDropDownMenu_AddButton local wipe = table.wipe local tinsert = table.insert local sort = table.sort local format = string.format local join = string.join local menu = {} local startChar = { ["A"] = {}, ["B"] = {}, ["C"] = {}, ["D"] = {}, ["E"] = {}, ["F"] = {}, ["G"] = {}, ["H"] = {}, ["I"] = {}, ["J"] = {}, ["K"] = {}, ["L"] = {}, ["M"] = {}, ["N"] = {}, ["O"] = {}, ["P"] = {}, ["Q"] = {}, ["R"] = {}, ["S"] = {}, ["T"] = {}, ["U"] = {}, ["V"] = {}, ["W"] = {}, ["X"] = {}, ["Y"] = {}, ["Z"] = {}, } local displayString = "" local lastPanel local hexColor = "|cff00ff96" local db, defaults = {}, { char = { id = nil, text = nil, favOne = nil, favTwo = nil, favThree = nil, }, } local function PairsByKeys(startChar, f) local a, i = {}, 0 for n in pairs(startChar) do tinsert(a, n) end sort(a, f) local iter = function() i = i + 1 if a[i] == nil then return nil else return a[i], startChar[a[i]] end end return iter end local function OnEvent(self, ...) lastPanel = self if db.id and db.text then self.text:SetFormattedText(displayString, db.text) end local summonedPetID = C_PetJournal_GetSummonedPetGUID() if summonedPetID then local _, customName, _, _, _, _, _, petName, _, _, _ = C_PetJournal_GetPetInfoByPetID(summonedPetID) local creatureName = petName if customName then creatureName = customName end if creatureName then self.text:SetFormattedText(displayString, creatureName) db.id = summonedPetID db.text = creatureName end else self.text:SetText(("|cffffffff%s|r"):format(L["Companions"])) end end local function ModifiedClick(button, id) local speciesID, customName, petlevel, xp, maxXp, displayID, isFavorite, petName, petIcon, petType, creatureID = C_PetJournal_GetPetInfoByPetID(id) local creatureName = customName and customName or petName if IsShiftKeyDown() then C_PetJournal_PickupPet(id); elseif IsAltKeyDown() and not IsControlKeyDown() then db.favOne = id DEFAULT_CHAT_FRAME:AddMessage((L["%sElvUI Companions:|r %s added as favorite one."]):format(hexColor, creatureName), 1, 1, 1) elseif IsControlKeyDown() and not IsAltKeyDown() then db.favTwo = id DEFAULT_CHAT_FRAME:AddMessage((L["%sElvUI Companions:|r %s added as favorite two."]):format(hexColor, creatureName), 1, 1, 1) elseif IsControlKeyDown() and IsAltKeyDown() then db.favThree = id DEFAULT_CHAT_FRAME:AddMessage((L["%sElvUI Companions:|r %s added as favorite three."]):format(hexColor, creatureName), 1, 1, 1) else C_PetJournal_SummonPetByGUID(id); end end local function CreateMenu(self, level) menu = wipe(menu) local numPets, numOwned = C_PetJournal_GetNumPets() local firstChar if numPets == 0 then menu.hasArrow = false menu.notCheckable = true menu.text = ("|cffff0000%s|r"):format(L["Failed to load companions."]) UIDropDownMenu_AddButton(menu) elseif numOwned <= 20 then for i = 1, numPets do --local speciesID, customName, level, xp, maxXp, displayID, petName, petIcon, petType, creatureID = C_PetJournal_GetPetInfoByPetID(id) local petID, speciesID, isOwned, customName, petlevel, favorite, isRevoked, name, icon, petType, creatureID, sourceText, description, isWildPet = C_PetJournal_GetPetInfoByIndex(i) local creatureName = name if customName then creatureName = customName end --firstChar = strupper(strsub(creatureName, 1, 1)) if isOwned then menu.hasArrow = false -- Start menu creation menu.notCheckable = true menu.text = creatureName menu.icon = icon menu.colorCode = "|cffffffff" menu.func = ModifiedClick menu.arg1 = petID local summonedPetID = C_PetJournal_GetSummonedPetGUID(); if summonedPetID == petID then menu.colorCode = "|cff00ff00" end UIDropDownMenu_AddButton(menu) end end else level = level or 1 if level == 1 then for key, v in PairsByKeys(startChar) do menu.text = key menu.notCheckable = 1 menu.hasArrow = true menu.value = { ["Level1_Key"] = key } UIDropDownMenu_AddButton(menu, level) end if db.favOne ~= nil then local speciesID, customName, petlevel, xp, maxXp, displayID, isFavorite, petName, petIcon, petType, creatureID = C_PetJournal_GetPetInfoByPetID(db.favOne) local creatureName = petName if customName then creatureName = customName end menu.text = format("1. %s", creatureName) menu.icon = petIcon menu.colorCode = "|cffffffff" menu.func = ModifiedClick menu.arg1 = db.favOne menu.hasArrow = nil menu.notCheckable = true local summonedPetID = C_PetJournal_GetSummonedPetGUID(); if summonedPetID == db.favOne then menu.colorCode = hexColor end UIDropDownMenu_AddButton(menu, level) end if db.favTwo ~= nil then local speciesID, customName, petlevel, xp, maxXp, displayID, isFavorite, petName, petIcon, petType, creatureID = C_PetJournal_GetPetInfoByPetID(db.favTwo) local creatureName = petName if customName then creatureName = customName end menu.text = format("2. %s", creatureName) menu.icon = petIcon menu.colorCode = "|cffffffff" menu.func = ModifiedClick menu.arg1 = db.favTwo menu.hasArrow = nil menu.notCheckable = true local summonedPetID = C_PetJournal_GetSummonedPetGUID(); if summonedPetID == db.favTwo then menu.colorCode = hexColor end UIDropDownMenu_AddButton(menu, level) end if db.favThree ~= nil then local speciesID, customName, petlevel, xp, maxXp, displayID, isFavorite, petName, petIcon, petType, creatureID = C_PetJournal_GetPetInfoByPetID(db.favThree) local creatureName = petName if customName then creatureName = customName end menu.text = format("3. %s", creatureName) menu.icon = petIcon menu.colorCode = "|cffffffff" menu.func = ModifiedClick menu.arg1 = db.favThree menu.hasArrow = nil menu.notCheckable = true local summonedPetID = C_PetJournal_GetSummonedPetGUID(); if summonedPetID == db.favThree then menu.colorCode = hexColor end UIDropDownMenu_AddButton(menu, level) end elseif level == 2 then local Level1_Key = UIDROPDOWNMENU_MENU_VALUE["Level1_Key"] for i = 1, numPets do local petID, speciesID, isOwned, customName, _, _, _, name, icon, _, _, _, _, _ = C_PetJournal_GetPetInfoByIndex(i) if isOwned then menu.hasArrow = false; -- Start menu creation menu.notCheckable = true; menu.text = customName and customName or name menu.icon = icon menu.colorCode = "|cffffffff" menu.func = ModifiedClick menu.arg1 = petID local summonedPetID = C_PetJournal_GetSummonedPetGUID(); if summonedPetID == petID then menu.colorCode = hexColor end firstChar = strupper(strsub(customName and customName or name, 1, 1)) if firstChar == "A" and Level1_Key == "A" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "B" and Level1_Key == "B" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "C" and Level1_Key == "C" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "D" and Level1_Key == "D" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "E" and Level1_Key == "E" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "F" and Level1_Key == "F" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "G" and Level1_Key == "G" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "H" and Level1_Key == "H" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "I" and Level1_Key == "I" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "J" and Level1_Key == "J" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "K" and Level1_Key == "K" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "L" and Level1_Key == "L" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "M" and Level1_Key == "M" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "N" and Level1_Key == "N" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "O" and Level1_Key == "O" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "P" and Level1_Key == "P" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "Q" and Level1_Key == "Q" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "R" and Level1_Key == "R" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "S" and Level1_Key == "S" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "T" and Level1_Key == "T" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "U" and Level1_Key == "U" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "V" and Level1_Key == "V" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "W" and Level1_Key == "W" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "X" and Level1_Key == "X" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "Y" and Level1_Key == "Y" then UIDropDownMenu_AddButton(menu, level) end if firstChar == "Z" and Level1_Key == "Z" then UIDropDownMenu_AddButton(menu, level) end --[[ if firstChar >= "A" and firstChar <= "B" and Level1_Key == "AB" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "C" and firstChar <= "D" and Level1_Key == "CD" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "E" and firstChar <= "F" and Level1_Key == "EF" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "G" and firstChar <= "H" and Level1_Key == "GH" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "I" and firstChar <= "J" and Level1_Key == "IJ" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "K" and firstChar <= "L" and Level1_Key == "KL" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "M" and firstChar <= "N" and Level1_Key == "MN" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "O" and firstChar <= "P" and Level1_Key == "OP" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "Q" and firstChar <= "R" and Level1_Key == "QR" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "S" and firstChar <= "T" and Level1_Key == "ST" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "U" and firstChar <= "V" and Level1_Key == "UV" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "W" and firstChar <= "X" and Level1_Key == "WX" then UIDropDownMenu_AddButton(menu, level) end if firstChar >= "Y" and firstChar <= "Z" and Level1_Key == "YZ" then UIDropDownMenu_AddButton(menu, level) end ]] end end end end end local interval = 1 local function OnUpdate(self, elapsed) self.lastUpdate = self.lastUpdate and self.lastUpdate + elapsed or 0 if self.lastUpdate >= interval then OnEvent(self) self.lastUpdate = 0 end end local function OnClick(self, button) DT.tooltip:Hide() if button == "LeftButton" then if not IsShiftKeyDown() then if db.id ~= nil then C_PetJournal_SummonPetByGUID(db.id); end else ToggleCollectionsJournal() CollectionsJournal_SetTab(CollectionsJournal, 2) end elseif button == "RightButton" then if not IsShiftKeyDown() then ToggleDropDownMenu(1, nil, F, self, 0, 0) else db.favOne = nil db.favTwo = nil db.favThree = nil DEFAULT_CHAT_FRAME:AddMessage((L["%sElvUI Companions:|r Reset Favorites"]):format(hexColor), 1, 1, 1) end end end local function OnEnter(self) DT:SetupTooltip(self) local numPets, numOwned = C_PetJournal_GetNumPets(false); DT.tooltip:AddLine((L["%sElvUI|r Companions - Companions Datatext"]):format(hexColor), 1, 1, 1) DT.tooltip:AddLine(L["<Left Click> to resummon/dismiss pet"]) DT.tooltip:AddLine(L["<Right Click> to open pet list"]) DT.tooltip:AddLine(L["<Shift + Left Click> to open pet journal"]) DT.tooltip:AddLine(L["<Shift + Right Click> to reset your favorites (addon only)"]) DT.tooltip:AddLine(" ") DT.tooltip:AddLine(L["<Click> a pet to summon/dismiss it."]) DT.tooltip:AddLine(L["<Shift + Click> a pet to pick it up"]) DT.tooltip:AddLine(L["<Alt + Click> a pet to set as favorite 1"]) DT.tooltip:AddLine(L["<Ctrl + Click> a pet to set as favorite 2"]) DT.tooltip:AddLine(L["<Ctrl + Alt + Click> a pet to set as favorite 3"]) if numOwned == 0 then DT.tooltip:AddLine(L["You have no pets"], 0, 1, 0) else DT.tooltip:AddLine((L["You have %s pets."]):format(numOwned), 0, 1, 0) end DT.tooltip:Show() end local function ValueColorUpdate(hex, r, g, b) displayString = join("", hex, "%s|r") hexColor = hex if lastPanel ~= nil then OnEvent(lastPanel, "ELVUI_COLOR_UPDATE") end end E["valueColorUpdateFuncs"][ValueColorUpdate] = true F:RegisterEvent("PLAYER_ENTERING_WORLD") F:SetScript("OnEvent", function(self, event, ...) self.db = LibStub("AceDB-3.0"):New("CompanionsDB", defaults) db = self.db.char self.initialize = CreateMenu self.displayMode = "MENU" self:UnregisterEvent("PLAYER_ENTERING_WORLD") end) DT:RegisterDatatext("Companions", nil, {"PLAYER_ENTERING_WORLD", "COMPANION_UPDATE", "PET_JOURNAL_LIST_UPDATE"}, OnEvent, OnUpdate, OnClick, OnEnter, nil, L["Companions"]) --DT:RegisterDatatext(L["Companions"], {"PLAYER_ENTERING_WORLD", "COMPANION_UPDATE", "PET_JOURNAL_LIST_UPDATE"}, OnEvent, OnUpdate, OnClick, OnEnter)
--[[-------------------------------------------------------------------------- * * Mello Trainer * (C) Michael Goodwin 2017 * http://github.com/thestonedturtle/mellotrainer/releases * * This menu used the Scorpion Trainer as a framework to build off of. * https://github.com/pongo1231/ScorpionTrainer * (C) Emre Cürgül 2017 * * A lot of useful functionality has been converted from the lambda menu. * https://lambda.menu * (C) Oui 2017 * * Additional Contributors: * WolfKnight (https://forum.fivem.net/u/WolfKnight) * ---------------------------------------------------------------------------]] -- Update voice feature variables function updateVoiceDistanceVariables(distance) featureVPTooClose = false featureVPVeryClose = false featureVPClose = false featureVPNearby = false featureVPDistant = false featureVPFar = false featureVPVeryFar = false featureVPAllPlayers = false if(distance == 0)then featureVPAllPlayers = true; elseif(distance == 5)then featureVPTooClose = true elseif(distance == 25)then featureVPVeryClose = true elseif(distance == 75)then featureVPClose = true elseif(distance == 200)then featureVPNearby = true elseif(distance == 500)then featureVPDistant = true elseif(distance == 2500)then featureVPFar = true elseif(distance == 8000)then featureVPVeryFar = true end end -- Update voice channel variables function updateVoiceChannelVariables(channel) featureChannelDefault = false; featureChannel1 = false; featureChannel2 = false; featureChannel3 = false; featureChannel4 = false; featureChannel5 = false; if(channel == 0)then featureChannelDefault = true else _G["featureChannel"..tostring(channel)] = true end end RegisterNUICallback("voiceopts", function(data, cb) local playerPed = GetPlayerPed(-1) local action = data.action local state = data.newstate local request = data.data[3] local text,text2 if(state) then text = "~g~ON" text2 = "~r~OFF" else text = "~r~OFF" text2 = "~g~ON" end if(action=="channel")then if(request == "0" or request == 0)then NetworkClearVoiceChannel() drawNotification("Voice Channel reset") else NetworkSetVoiceChannel(tonumber(request)) drawNotification("Now In Voice Channel: "..request) end updateVoiceChannelVariables(request) elseif(action=="distance")then local distance = tonumber(request) + 0.00 NetworkSetTalkerProximity(distance) updateVoiceDistanceVariables(distance) if(distance > 0)then drawNotification("Voice Proximity: "..distance.." meters") else drawNotification("Voice Proximity: All Players") end elseif(action=="voicetoggle")then featureVoiceChat = state NetworkSetVoiceActive(state) drawNotification("Voice Chat: "..text) elseif(action=="showtoggle")then featureShowVoiceChatSpeaker = state if(not state)then SendNUIMessage({hidevoice=true}) end drawNotification("Voice Speakers Overlay: "..text) end if(cb)then cb("ok") end end) -- Update voice names Citizen.CreateThread(function() local me = PlayerId(-1) while true do Citizen.Wait(0) if(featureShowVoiceChatSpeaker)then local names = {} local nameCount = 0 for i=0, maxPlayers, 1 do if(NetworkIsPlayerConnected(i)) then if(NetworkIsPlayerTalking(i))then table.insert(names, GetPlayerName(i)) nameCount = nameCount + 1 end end end if(nameCount > 0)then local results = json.encode(names, {indent=true}) SendNUIMessage({ showvoice = true, talkingplayers = results }) else SendNUIMessage({ hidevoice = true }) end end end end)
Talk(0, "慕容公子,请你回燕子坞,若有需要你帮忙时,我再去找你.", "talkname0", 1); Leave(51); ModifyEvent(52, 1, 1, 1, 985, -1, -1, 6300, 6300, 6300, 0, -2, -2); jyx2_ReplaceSceneObject("52","NPC/慕容复","1"); do return end;
/* * PTY Helpers */ #include <errno.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <unistd.h> ffi.cdef[[ /* pty */ struct shl_pty; typedef void (*shl_pty_input_cb) (struct shl_pty *pty, char *u8, size_t len, void *data); pid_t shl_pty_open(struct shl_pty **out, shl_pty_input_cb cb, void *data, unsigned short term_width, unsigned short term_height); void shl_pty_ref(struct shl_pty *pty); void shl_pty_unref(struct shl_pty *pty); void shl_pty_close(struct shl_pty *pty); bool shl_pty_is_open(struct shl_pty *pty); int shl_pty_get_fd(struct shl_pty *pty); pid_t shl_pty_get_child(struct shl_pty *pty); int shl_pty_dispatch(struct shl_pty *pty); int shl_pty_write(struct shl_pty *pty, const char *u8, size_t len); int shl_pty_signal(struct shl_pty *pty, int sig); int shl_pty_resize(struct shl_pty *pty, unsigned short term_width, unsigned short term_height); ]] ffi.cdef[[ /* pty bridge */ int shl_pty_bridge_new(void); void shl_pty_bridge_free(int bridge); int shl_pty_bridge_dispatch(int bridge, int timeout); int shl_pty_bridge_add(int bridge, struct shl_pty *pty); void shl_pty_bridge_remove(int bridge, struct shl_pty *pty); ]]
local ui, uiu, uie = require("ui").quick() local utils = require("utils") local threader = require("threader") local scene = { name = "Benchmark Scene" } local root = uie.column({ uie.topbar({ { "File", { { "New" }, { }, { "Open" }, { "Recent", { { "Totally" }, { "Not A Dummy" }, { "Nested Submenu", { { "Totally" }, { "Not A Dummy" }, { "Nested Submenu", { { "Totally" }, { "Not A Dummy" }, { "Nested Submenu", { { "Totally" }, { "Not A Dummy" }, { "Nested Submenu" } }} }} }} }}, { }, { "Save" }, { "Save As..." }, { }, { "Settings" }, { }, { "Quit", love.event.quit } }}, { "Edit", { { "Undo" }, { "Redo" } }}, { "Map", { { "Stylegrounds" }, { "Metadata" }, { "Save Map Image" } }}, { "Room", { { "Add" }, { "Configure" } }}, { "Help", { { "Update" }, { "About" } }}, { "Debug", { { "Uhh" } }}, }), uie.image("header"), uie.paneled.row({ uie.scrollbox( uie.list( uiu.map(uiu.listRange(2000, 1, -1), function(i) return { text = string.format("%i%s", i, i % 7 == 0 and " (something)" or ""), data = i } end) ):with({ grow = false }):with(uiu.fillWidth):with(function(list) list.selected = list.children[1] or false end):as("versions") ):with(uiu.fillWidth(4.25)):with(uiu.fillHeight), uie.scrollbox( uie.list( uiu.map(uiu.listRange(2000, 1, -1), function(i) return { text = string.format("%i%s", i, i % 7 == 0 and " (something)" or ""), data = i } end) ):with({ grow = false }):with(uiu.fillWidth):with(function(list) list.selected = list.children[1] or false end):as("versions") ):with(uiu.fillWidth(4.25)):with(uiu.fillHeight):with(uiu.at(0.25 + 8)), uie.group({ uie.window("Windowception", uie.panel({ uie.scrollbox( uie.group({ uie.window("Child 1", uie.panel({ uie.label("Oh no") })):with({ x = 10, y = 10}), uie.window("Child 2", uie.panel({ uie.label("Oh no two") })):with({ x = 30, y = 30}) }):with({ width = 200, height = 400 }) ):with({ width = 200, height = 200 }) }):with({ style = { padding = 0 } }) ):with({ x = 20, y = 100 }), uie.window("Hello, World!", uie.paneled.column({ uie.label("This is a big label.", ui.fontBig), -- Labels use Löve2D Text objects under the hood. uie.label({ { 1, 1, 1 }, "This is a ", { 1, 0, 0 }, "colored", { 0, 1, 1 }, " mono-font label."}, ui.fontMono), -- Multi-line labels aren't subjected to the parent element's spacing property. uie.label("This is a two-line label.\nThe following label is updated dynamically."), -- Dynamically updated label. uie.label():with({ update = function(el) el.text = "FPS: " .. love.timer.getFPS() end }), uie.button("This is a button.", function(btn) btn.counter = btn.counter + 1 end):with({ getCounter = function(self) return self._counter or 0 end, setCounter = function(self, value) self._counter = value self.text = "Pressed " .. tostring(value) .. " time" .. (value == 1 and "" or "s") end }):as("counterButton"), uie.button("Disabled"):with({ enabled = false }), uie.button("Useless"), uie.label("Select an item from the list below."):as("selected"), uie.list(uiu.map(uiu.listRange(1, 3), function(i) return { text = string.format("Item %i!", i), data = i } end), function(list, item) list.parent:findChild("selected").text = "Selected " .. tostring(item) end) }) ):with({ x = 200, y = 50 }):as("test"), }):with(uiu.fillWidth(0.5)):with(uiu.fillHeight):with(uiu.at(0.5 + 8)), }):with(uiu.fillWidth):with(uiu.fillHeight(true)), }) scene.root = root function scene.load() end function scene.enter() end return scene
local L = BigWigs:NewBossLocale("Viceroy Nezhar", "koKR") if not L then return end if L then L.tentacles = "암영 촉수" L.guards = "어둠수호병 공허지기" L.interrupted = "%s|1이;가; %s|1을;를; 시전 방해했습니다 (%.1f초 남음)!" end L = BigWigs:NewBossLocale("L'ura", "koKR") if L then --L.warmup_text = "L'ura Active" --L.warmup_trigger = "Such chaos... such anguish. I have never sensed anything like it before." --L.warmup_trigger_2 = "Such musings can wait, though. This entity must die." end L = BigWigs:NewBossLocale("Seat of the Triumvirate Trash", "koKR") if L then L.custom_on_autotalk = "자동 대화" L.custom_on_autotalk_desc = "알레리아 윈드러너의 대화 선택지를 즉시 고릅니다." L.gossip_available = "대화 가능" L.alleria_gossip_trigger = "따라오세요!" -- Allerias yell after the first boss is defeated L.alleria = "알레리아 윈드러너" L.subjugator = "어둠수호병 정복자" L.voidbender = "어둠수호병 공허술사" --L.conjurer = "Shadowguard Conjurer" --L.weaver = "Grand Shadow-Weaver" end
--[[ FastAPI No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: 0.1.0 Generated by: https://openapi-generator.tech ]] --package openapiclient local http_request = require "http.request" local http_util = require "http.util" local dkjson = require "dkjson" local basexx = require "basexx" -- model import local openapiclient_http_validation_error = require "openapiclient.model.http_validation_error" local openapiclient_todo_object_mapping = require "openapiclient.model.todo_object_mapping" local image_text_asciify_api = {} local image_text_asciify_api_mt = { __name = "image_text_asciify_api"; __index = image_text_asciify_api; } local function new_image_text_asciify_api(authority, basePath, schemes) local schemes_map = {} for _,v in ipairs(schemes) do schemes_map[v] = v end local default_scheme = schemes_map.https or schemes_map.http local host, port = http_util.split_authority(authority, default_scheme) return setmetatable({ host = host; port = port; basePath = basePath or "http://localhost"; schemes = schemes_map; default_scheme = default_scheme; http_username = nil; http_password = nil; api_key = {}; access_token = nil; }, image_text_asciify_api_mt) end function image_text_asciify_api:apply_image_text_asciify_post(image, model) local req = http_request.new_from_uri({ scheme = self.default_scheme; host = self.host; port = self.port; path = string.format("%s/image/text/asciify?model=%s", self.basePath, http_util.encodeURIComponent(model)); }) -- set HTTP verb req.headers:upsert(":method", "POST") -- TODO: create a function to select proper accept --local var_content_type = { "multipart/form-data" } req.headers:upsert("accept", "multipart/form-data") -- TODO: create a function to select proper content-type --local var_accept = { "application/json" } req.headers:upsert("content-type", "application/json") req:set_body(http_util.dict_to_query({ ["image"] = image; })) -- make the HTTP call local headers, stream, errno = req:go() if not headers then return nil, stream, errno end local http_status = headers:get(":status") if http_status:sub(1,1) == "2" then local body, err, errno2 = stream:get_body_as_string() -- exception when getting the HTTP body if not body then return nil, err, errno2 end stream:shutdown() local result, _, err3 = dkjson.decode(body) -- exception when decoding the HTTP body if result == nil then return nil, err3 end return openapiclient_TODO_OBJECT_MAPPING.cast(result), headers else local body, err, errno2 = stream:get_body_as_string() if not body then return nil, err, errno2 end stream:shutdown() -- return the error message (http body) return nil, http_status, body end end function image_text_asciify_api:get_versions_image_text_asciify_get() local req = http_request.new_from_uri({ scheme = self.default_scheme; host = self.host; port = self.port; path = string.format("%s/image/text/asciify", self.basePath); }) -- set HTTP verb req.headers:upsert(":method", "GET") -- TODO: create a function to select proper content-type --local var_accept = { "application/json" } req.headers:upsert("content-type", "application/json") -- make the HTTP call local headers, stream, errno = req:go() if not headers then return nil, stream, errno end local http_status = headers:get(":status") if http_status:sub(1,1) == "2" then local body, err, errno2 = stream:get_body_as_string() -- exception when getting the HTTP body if not body then return nil, err, errno2 end stream:shutdown() local result, _, err3 = dkjson.decode(body) -- exception when decoding the HTTP body if result == nil then return nil, err3 end return openapiclient_TODO_OBJECT_MAPPING.cast(result), headers else local body, err, errno2 = stream:get_body_as_string() if not body then return nil, err, errno2 end stream:shutdown() -- return the error message (http body) return nil, http_status, body end end return { new = new_image_text_asciify_api; }
--[[ Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. A copy of the MIT License is included in this file. Terms of the MIT License: --------------------------------------------------- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] local _M = {} --[[获取微服务真实地址]] function _M:get_addr(service_name) local service_prefix = config.service_prefix if service_prefix == nil then service_prefix = "" end -- return k8s service address if ngx.var.name_space ~= "" then return service_prefix .. service_name .. "." .. ngx.var.name_space .. ".svc.cluster.local" end local ns_config = config.ns local tag = ns_config.tag -- router by project for _, value in ipairs(config.router.project) do local prefix = value.name .. "/" if service_name == "generic" and stringUtil:startswith(ngx.var.path, prefix) then tag = value.tag end end local query_subdomain = tag .. "." .. service_prefix .. service_name .. ".service." .. ns_config.domain local ips = {} -- address local port = nil -- port local router_srv_cache = ngx.shared.router_srv_store local router_srv_value = router_srv_cache:get(query_subdomain) if router_srv_value == nil then if not ns_config.ip then ngx.log(ngx.ERR, "DNS ip not exist!") ngx.exit(503) return end local dnsIps = {} if type(ns_config.ip) == 'table' then for _, v in ipairs(ns_config.ip) do table.insert(dnsIps, { v, ns_config.port }) end else table.insert(dnsIps, { ns_config.ip, ns_config.port }) end local dns, err = resolver:new { nameservers = dnsIps, retrans = 5, timeout = 2000 } if not dns then ngx.log(ngx.ERR, "failed to instantiate the resolver: ", err) ngx.exit(503) return end local records, err = dns:query(query_subdomain, { qtype = dns.TYPE_SRV, additional_section = true }) if not records then ngx.log(ngx.ERR, "failed to query the DNS server: ", err) ngx.exit(503) return end if records.errcode then if records.errcode == 3 then ngx.log(ngx.ERR, "DNS error code #" .. records.errcode .. ": ", records.errstr) ngx.exit(503) return else ngx.log(ngx.ERR, "DNS error #" .. records.errcode .. ": ", err) ngx.exit(503) return end end for _, v in pairs(records) do if v.section == dns.SECTION_AN then port = v.port end if v.section == dns.SECTION_AR then table.insert(ips, v.address) end end local ip_len = table.getn(ips) if ip_len == 0 or port == nil then ngx.log(ngx.ERR, "DNS answer didn't include ip or a port , ip len" .. ip_len .. " port " .. port) ngx.exit(503) return end router_srv_cache:set(query_subdomain, table.concat(ips, ",") .. ":" .. port, 2) else local func_itor = string.gmatch(router_srv_value, "([^:]+)") local ips_str = func_itor() port = func_itor() for ip in string.gmatch(ips_str, "([^,]+)") do table.insert(ips, ip) end end -- return ip,port address return ips[math.random(table.getn(ips))] .. ":" .. port end return _M
title_bar = {} -- ** LOCAL UTIL ** local function configure_pause_button_style(button, pause_on_interface) if pause_on_interface then button.style = "fp_sprite-button_tool_active" button.sprite = "utility/pause" button.clicked_sprite = "fp_sprite_pause_light" else button.style = "frame_action_button" button.sprite = "fp_sprite_pause_light" button.clicked_sprite = "utility/pause" end end local function toggle_paused_state(player, button) if not game.is_multiplayer() then local preferences = data_util.get("preferences", player) preferences.pause_on_interface = not preferences.pause_on_interface configure_pause_button_style(button, preferences.pause_on_interface) local frame_main_dialog = data_util.get("main_elements", player).main_frame main_dialog.set_pause_state(player, frame_main_dialog) end end -- ** TOP LEVEL ** function title_bar.build(player) local main_elements = data_util.get("main_elements", player) main_elements.title_bar = {} local flow_title_bar = main_elements.main_frame.add{type="flow", direction="horizontal"} flow_title_bar.style.height = 30 flow_title_bar.style.top_margin = 2 flow_title_bar.style.horizontal_spacing = 8 flow_title_bar.add{type="label", caption={"mod-name.factoryplanner"}, style="heading_1_label"} local label_hint = flow_title_bar.add{type="label"} label_hint.style.font = "heading-2" label_hint.style.margin = {2, 0, 0, 8} main_elements.title_bar["hint_label"] = label_hint local drag_handle = flow_title_bar.add{type="empty-widget", style="flib_titlebar_drag_handle"} drag_handle.drag_target = main_elements.main_frame drag_handle.style.top_margin = 1 -- Buttons flow_title_bar.add{type="button", name="fp_button_title_bar_tutorial", caption={"fp.tutorial"}, style="fp_button_frame_tool", mouse_button_filter={"left"}} flow_title_bar.add{type="button", name="fp_button_title_bar_preferences", caption={"fp.preferences"}, style="fp_button_frame_tool", mouse_button_filter={"left"}} local separation = flow_title_bar.add{type="line", direction="vertical"} separation.style.height = 24 local button_pause = flow_title_bar.add{type="sprite-button", name="fp_sprite-button_title_bar_pause_game", tooltip={"fp.pause_on_interface"}, enabled=(not game.is_multiplayer()), mouse_button_filter={"left"}} button_pause.hovered_sprite = "utility/pause" main_elements.title_bar["pause_button"] = button_pause local preferences = data_util.get("preferences", player) configure_pause_button_style(button_pause, preferences.pause_on_interface) local button_close = flow_title_bar.add{type="sprite-button", name="fp_sprite-button_title_bar_close_interface", sprite="utility/close_white", hovered_sprite="utility/close_black", clicked_sprite="utility/close_black", tooltip={"fp.close_interface"}, style="frame_action_button", mouse_button_filter={"left"}} button_close.style.padding = 2 end -- Enqueues the given message into the message queue; Possible types: error, warning, hint function title_bar.enqueue_message(player, message, type, lifetime, instant_refresh) local message_queue = data_util.get("ui_state", player).message_queue table.insert(message_queue, {text=message, type=type, lifetime=lifetime}) if instant_refresh then title_bar.refresh_message(player) end end -- Refreshes the current message, taking into account priotities and lifetimes -- The messages are displayed in enqueued order, displaying higher priorities first -- The lifetime is decreased for every message on every refresh -- (The algorithm(s) could be more efficient, but it doesn't matter for the small dataset) function title_bar.refresh_message(player) local ui_state = data_util.get("ui_state", player) local message_queue = ui_state.message_queue local title_bar_elements = ui_state.main_elements.title_bar if not title_bar_elements then return end -- The message types are ordered by priority local types = {"error", "warning", "hint"} -- TODO this is not the proper way to do this probably, but it works local subfactory = ui_state.context.subfactory if subfactory and subfactory.valid and subfactory.linearly_dependant then title_bar.enqueue_message(player, {"fp.error_linearly_dependant_recipes"}, "error", 1, false) end local new_message = nil -- Go over the all types and messages, trying to find one that should be shown for _, type in ipairs(types) do -- All messages will have lifetime > 0 at this point for _, message in pairs(message_queue) do -- Find first message of this type, then break if message.type == type then new_message = message break end end -- If a message is found, break because no messages of lower ranked type should be considered if new_message ~= nil then break end end -- Set caption and hide if no message is shown so that the margins work out title_bar_elements.hint_label.caption = (new_message) and {"fp." .. new_message.type .. "_message", new_message.text} or "" title_bar_elements.hint_label.visible = (new_message) -- Decrease the lifetime of every queued message for index, message in pairs(message_queue) do message.lifetime = message.lifetime - 1 if message.lifetime <= 0 then message_queue[index] = nil end end end -- ** EVENTS ** title_bar.gui_events = { on_gui_click = { { name = "fp_sprite-button_title_bar_close_interface", handler = (function(player, _, _) main_dialog.toggle(player) -- can't use simple form because main_dialog is not yet defined end) }, { name = "fp_sprite-button_title_bar_pause_game", handler = toggle_paused_state }, { pattern = "^fp_button_title_bar_[a-z]+$", handler = (function(player, element, _) local dialog_name = string.gsub(element.name, "fp_button_title_bar_", "") modal_dialog.enter(player, {type=dialog_name}) end) } } } title_bar.misc_events = { fp_toggle_pause = (function(player, _) if main_dialog.is_in_focus(player) then local main_elements = data_util.get("main_elements", player) toggle_paused_state(player, main_elements.title_bar.pause_button) end end) }
function love.conf(t) t.window.width = 1024 t.window.height = 768 end
local R = require('mesh/read_msh2') local W = require('mesh/write_ccx') local U = require('mesh/utils') if #arg < 3 then error('Not enough arguments!') end local M = R.read_msh2(arg[1]) U.write_mesh_exo2(M, arg[3], { title = 'cnv: ' .. arg[1], ids = { nsets = 100, ssets = 500 }, fp_type = 'float', fmt = 2 }) local f = assert(io.open(arg[2], 'w')) W.write_ccx_mesh(f, M) f:close()
local Widget do local _obj_0 = require("lapis.html") Widget = _obj_0.Widget end local LuminaryViewUtil do local _parent_0 = Widget local _base_0 = { include_script = function(self, name, path) if path == nil then path = "assets" end return script({ type = "text/javascript" }, function() return raw(require("luminary." .. tostring(path) .. "." .. tostring(name) .. "_js")) end) end, include_style = function(self, name, path) if path == nil then path = "assets" end return style({ type = "text/css" }, function() return raw(require("luminary." .. tostring(path) .. "." .. tostring(name) .. "_css")) end) end } _base_0.__index = _base_0 setmetatable(_base_0, _parent_0.__base) local _class_0 = setmetatable({ __init = function(self, ...) return _parent_0.__init(self, ...) end, __base = _base_0, __name = "LuminaryViewUtil", __parent = _parent_0 }, { __index = function(cls, name) local val = rawget(_base_0, name) if val == nil then return _parent_0[name] else return val end end, __call = function(cls, ...) local _self_0 = setmetatable({}, _base_0) cls.__init(_self_0, ...) return _self_0 end }) _base_0.__class = _class_0 if _parent_0.__inherited then _parent_0.__inherited(_parent_0, _class_0) end LuminaryViewUtil = _class_0 return _class_0 end
-- Global options vim.o.colorcolumn = "81" vim.o.showmode = false vim.o.splitbelow = true vim.o.splitright = true vim.o.wildmode = "longest:full,list:full" vim.o.mouse = "a" vim.o.shiftwidth = 2 vim.o.shiftround = true vim.o.joinspaces = false vim.o.ignorecase = true vim.o.smartcase = true vim.cmd "set wildignore+=*/.git/*,*/dist/*,*/dist-newstyle/*" vim.o.wildignorecase = true vim.o.gdefault = true vim.o.swapfile = false vim.o.writebackup = false vim.o.hidden = true vim.o.inccommand = "nosplit" vim.o.virtualedit = "block,onemore" vim.cmd "set shortmess+=I" -- Window options vim.wo.number = true vim.wo.relativenumber = true vim.wo.wrap = false -- Buffer options vim.bo.expandtab = true
-- gui config file local cfg = {} -- additional css loaded to customize the gui display (see gui/design.css to know the available css elements) -- it is not recommended to modify the vRP core files outside the cfg/ directory, create a new resource instead -- you can load external images/fonts/etc using the NUI absolute path: nui://my_resource/myfont.ttf -- example, changing the gui font (suppose a vrp_mod resource containing a custom font) cfg.css = [[ @font-face { font-family: "Custom Font"; src: url(nui://vrp_mod/customfont.ttf) format("truetype"); } body{ font-family: "Custom Font"; } ]] -- list of static menu types (map of name => {.title,.blipid,.blipcolor,.permissions (optional)}) -- static menus are menu with choices defined by vRP.addStaticMenuChoices(name, choices) cfg.static_menu_types = { ["police_weapons"] = { title = "Arsenal", permissions = {"police.base"} }, ["federal_weapons"] = { title = "Arsenal", permissions = {"federal.weapons"} }, ["emergency_heal"] = { title = "Atendimento Médico" }, ["tribunal_e"] = { title = "Tribunal" }, ["tribunal_s"] = { title = "Tribunal" }, ["tribunal_lobbye"] = { title = "Tribunal" }, ["tribunal_lobbys"] = { title = "Tribunal" }, ["mina_entrada"] = { title = "Mina" }, ["mina_saida"] = { title = "Mina" }, ["federal_entrada"] = { title = "Polícia Federal" }, ["federal_saida"] = { title = "Polícia Federal" }, ["federal_entrada_heli"] = { title = "Polícia Federal" }, ["federal_saida_heli"] = { title = "Polícia Federal" }, ["lavagem_entrada"] = { title = "Fábrica de Dinheiro" }, ["lavagem_saida"] = { title = "Fábrica de Dinheiro" }, ["weed_entrada"] = { title = "Plantação de Maconha" }, ["weed_saida"] = { title = "Plantação de Maconha" }, --["meth_entrada"] = { -- title = "Fábrica de Metanfetamina" --}, --["meth_saida"] = { -- title = "Fábrica de Metanfetamina" --}, ["cocaine_entrada"] = { title = "Fábrica de Cocaina" }, ["cocaine_saida"] = { title = "Fábrica de Cocaina" }, ["bahamas_entrada"] = { title = "Bahamas Club" }, ["bahamas_saida"] = { title = "Bahamas Club" }, ["hospheli_entrada"] = { title = "Heli Samu" }, ["hospheli_saida"] = { title = "Heli Samu" }, ["b2knewsheli_entrada"] = { title = "Heli B2K News" }, ["b2knewsheli_saida"] = { title = "Heli B2K News" }, ["lsquarto01_entrada"] = { title = "Quarto 01" }, ["lsquarto01_saida"] = { title = "Quarto 01" }, ["sicimembros_entrada"] = { title = "Membros Siciliana", permissions = {"siciliana.membros"} }, ["sicimembros_saida"] = { title = "Membros Siciliana", permissions = {"siciliana.membros"} }, ["siciarmas_entrada"] = { title = "Armas Siciliana", permissions = {"siciliana.membros"} }, ["siciarmas_saida"] = { title = "Armas Siciliana", permissions = {"siciliana.membros"} }, ["pripatio_entrada"] = { title = "Prisao Patio", }, ["pripatio_saida"] = { title = "Prisao Patio", }, ["priacad_entrada"] = { title = "Prisao Academia", }, ["priacad_saida"] = { title = "Prisao Academia", }, ["yazukamem_entrada"] = { title = "Yakuza Membros", permissions = {"yakuza.membros"} }, ["yazukamem_saida"] = { title = "Yakuza Membros", permissions = {"yakuza.membros"} } } -- list of static menu points cfg.static_menus = { {"police_weapons", 461.39645385742,-982.65185546875,30.689596176147}, {"federal_weapons", 470.11422729492,-1085.91015625,38.706508636475}, {"emergency_heal", 307.73468017578,-594.71624755859,43.291797637939}, {"tribunal_e", 233.23551940918,-410.48593139648,48.11194229126}, {"tribunal_s",236.01475524902,-413.36260986328,-118.16348266602}, {"tribunal_lobbye", 225.11094665527,-419.61151123047,-118.1996383667}, {"tribunal_lobbys",238.80630493164,-334.22885131836,-118.77348327637}, --{"oab_entrada", 155.37397766113,-1103.2545166016,29.323266983032}, --{"oab_saida", 155.01602172852,-1108.9591064453,37.183734893799}, {"mina_entrada", -596.86285400391,2090.830078125,131.41278076172}, {"mina_saida", -595.21545410156,2085.802734375,131.38134765625}, {"federal_entrada", 416.05096435547,-1086.2639160156,30.057842254639}, {"federal_saida", 467.77380371094,-1097.7532958984,38.706531524658}, {"federal_entrada_heli", 471.49169921875,-1089.7761230469,38.706504821777}, {"federal_saida_heli", 484.60437011719,-1094.1079101563,43.075649261475}, {"lavagem_entrada", 858.64544677734,-3203.6105957031,5.9949970245361}, {"lavagem_saida", 1138.1552734375,-3198.5004882813,-39.665687561035}, {"weed_entrada",2564.1904296875,4680.482421875,34.076770782471}, {"weed_saida",1064.9476318359,-3183.3408203125,-39.163444519043}, --{"meth_entrada", 1454.46875,-1651.9616699219,66.99479675293}, --{"meth_saida", 997.3916015625,-3200.63671875,-36.393688201904}, {"cocaine_entrada", 1416.9096679688,6339.8159179688,24.189083099365}, {"cocaine_saida", 1088.6865234375,-3188.0783691406,-38.993461608887}, --{"yakuza_entrada", -871.18719482422,-1440.8928222656,7.5268039703369}, --{"yakuza_saida", -893.39910888672,-1446.291015625,7.5268030166626}, --{"siciliana_entrada",-2679.4125976563,1316.6683349609,152.0094909668}, --{"siciliana_saida",-2673.47265625,1336.3385009766,140.88259887695} {"hospheli_saida",339.2073059082,-584.13525390625,74.165672302246}, {"hospheli_entrada",325.24520874023,-598.69177246094,43.291786193848}, {"b2knewsheli_entrada",-598.76416015625,-929.82464599609,23.86349105835}, {"b2knewsheli_saida",-569.37023925781,-927.76025390625,36.833557128906}, {"bahamas_entrada",-1388.7598876953,-586.23864746094,30.21915435791}, {"bahamas_saida",-1387.2572021484,-588.40148925781,30.319505691528}, {"lsquarto01_entrada", 1398.3591308594,1157.0681152344,114.33364868164}, {"lsquarto01_saida", 151.6649017334,-1007.326171875,-99.0}, {"sicimembros_entrada",-2678.5578613282,1307.7283935546,147.16165161132}, {"sicimembros_saida",-2679.6118164062,1315.1262207032,147.44288635254}, {"siciarmas_entrada",-2679.6271972656,1319.2336425781,152.00950622559}, {"siciarmas_saida",-2673.2407226563,1336.4757080078,140.88262939453}, {"pripatio_entrada",1724.8452148438,2648.7521972656,45.784439086914}, {"pripatio_saida",1712.1800537109,2565.8725585938,45.564868927002}, {"priacad_entrada",1644.2642822266,2518.2768554688,45.56485748291}, {"priacad_saida",1642.4438476562,2518.6975097656,45.56485748291}, {"yazukamem_entrada",-876.830078125,-1454.7742919922,7.5267992019653}, {"yazukamem_saida",-874.87939453125,-1454.2927246094,7.5268068313599}, } return cfg
local M = {} M.config = function() if not lvim.builtin.lualine.active then return end local components = require "lvim.core.lualine.components" -- Remove treesitter and lsp form the config lvim.builtin.lualine.sections.lualine_x = { components.diagnostics, components.filetype, } -- Replace progressbar with location lvim.builtin.lualine.sections.lualine_z = { components.location, } end return M
local M = { } -- TODO: Setup Debugger menu -- Setup Debugger switch menu calling require(this).setup(override) function M.setup(override) end return M
dust = {} function dust:create() dust = love.graphics.newImage('dust.png') dustSys = love.graphics.newParticleSystem(dust, 170) dustSys:setDirection(0) dustSys:setEmissionRate(70) dustSys:setEmitterLifetime(0.5) dustSys:setParticleLifetime(3) dustSys:setLinearAcceleration(-200,-200, 200,200) dustSys:setSpeed(1000,2000) dustSys:setSpread(math.pi*2) dustSys:setSpin(math.pi*4, math.pi*7) dustSys:setSpinVariation( 0.7 ) dustSys:stop() end
--[[ MIT License Copyright (c) 2022 Michael Wiesendanger Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]]-- local mod = rgpvpw local me = {} mod.testSoundSelfAvoidWarriorEn = me me.tag = "TestSoundSelfAvoidWarriorEn" local testGroupName = "SoundSelfAvoidWarriorEn" local testCategory = RGPVPW_CONSTANTS.CATEGORIES.WARRIOR.id function me.Test() mod.testReporter.StartTestGroup(testGroupName) me.CollectTestCases() mod.testReporter.PlayTestQueueWithDelay(function() mod.testReporter.StopTestGroup() -- asyncron finish of testgroup end) end function me.CollectTestCases() mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidDemoralizingShout) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidDisarm) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidHamstring) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidIntimidatingShout) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidOverpower) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidPummel) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidShieldBash) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidSlam) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidSunderArmor) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidWhirlwind) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidConcussionBlow) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidMortalStrike) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidPiercingHowl) mod.testReporter.AddToTestQueueWithDelay(me.TestSoundSelfAvoidShieldSlam) end function me.TestSoundSelfAvoidDemoralizingShout() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidDemoralizingShout", testCategory, "demoralizing_shout" ) end function me.TestSoundSelfAvoidDisarm() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidDisarm", testCategory, "disarm" ) end function me.TestSoundSelfAvoidHamstring() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidHamstring", testCategory, "hamstring" ) end function me.TestSoundSelfAvoidIntimidatingShout() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidIntimidatingShout", testCategory, "intimidating_shout" ) end function me.TestSoundSelfAvoidOverpower() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidOverpower", testCategory, "overpower" ) end function me.TestSoundSelfAvoidPummel() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidPummel", testCategory, "pummel" ) end function me.TestSoundSelfAvoidShieldBash() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidShieldBash", testCategory, "shield_bash" ) end function me.TestSoundSelfAvoidSlam() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidSlam", testCategory, "slam" ) end function me.TestSoundSelfAvoidSunderArmor() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidSunderArmor", testCategory, "sunder_armor" ) end function me.TestSoundSelfAvoidWhirlwind() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidWhirlwind", testCategory, "whirlwind" ) end function me.TestSoundSelfAvoidConcussionBlow() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidConcussionBlow", testCategory, "concussion_blow" ) end function me.TestSoundSelfAvoidMortalStrike() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidMortalStrike", testCategory, "mortal_strike" ) end function me.TestSoundSelfAvoidPiercingHowl() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidPiercingHowl", testCategory, "piercing_howl" ) end function me.TestSoundSelfAvoidShieldSlam() mod.testHelper.TestSoundSpellMissedSelf( "TestSoundSelfAvoidShieldSlam", testCategory, "shield_slam" ) end
AutomaticRoleCheck.Panel = CreateFrame("Frame", nil, UIParent) AutomaticRoleCheck.Panel:RegisterEvent("ADDON_LOADED") AutomaticRoleCheck.Panel:RegisterEvent("PLAYER_LOGOUT") AutomaticRoleCheck.Panel.name = "AutomaticRoleCheck" AutomaticRoleCheck.Panel.Inner = AutomaticRoleCheck.Panel:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge") AutomaticRoleCheck.Panel.Inner:SetPoint("TOPLEFT", 10, -15) AutomaticRoleCheck.Panel.Inner:SetJustifyH("LEFT") AutomaticRoleCheck.Panel.Inner:SetJustifyV("TOP") AutomaticRoleCheck.Panel.Inner:SetText("AutomaticRoleCheck") AutomaticRoleCheck.Panel.Inner.EnabledButton = CreateFrame("CheckButton", nil, AutomaticRoleCheck.Panel, "ChatConfigCheckButtonTemplate") AutomaticRoleCheck.Panel.Inner.EnabledButton:SetPoint("TOPLEFT", 10, -45) AutomaticRoleCheck.Panel.Inner.EnabledButton.Text:SetFontObject("GameFontHighlightSmall") AutomaticRoleCheck.Panel.Inner.EnabledButton.Text:SetPoint("LEFT", AutomaticRoleCheck.Panel.Inner.EnabledButton, "RIGHT", 0, 1) AutomaticRoleCheck.Panel.Inner.EnabledButton.Text:SetText("Enable AutomaticRoleCheck") AutomaticRoleCheck.Panel.Inner.EnabledButton.tooltip = "If the AutomaticRoleCheck addon is enabled" AutomaticRoleCheck.Panel.Inner.EnabledButton:HookScript("OnClick", function() AutomaticRoleCheck.Options.Enabled = AutomaticRoleCheck.Panel.Inner.EnabledButton:GetChecked() end) AutomaticRoleCheck.Panel:HookScript("OnShow", function() AutomaticRoleCheck.Panel.Inner.EnabledButton:SetChecked(AutomaticRoleCheck.Options.Enabled) end) AutomaticRoleCheck.Panel:HookScript("OnEvent", AutomaticRoleCheck.EventHandler) InterfaceOptions_AddCategory(AutomaticRoleCheck.Panel)
function love.conf(t) t.window.title = "Pong" -- The window title (string) t.window.width = 1280 -- The window width (number) t.window.height = 720 -- The window height (number) t.window.vsync = 1 -- Vertical sync mode (number) t.window.resizable = true -- Let the window be user-resizable (boolean) end
-- refer to jmdasnoy(BMP180),create by pengping -- NodeMCU ESP32 lua handler for Bosch Sensortech BMP-280 Digital pressure and temperature sensor -- -- populate table with register addresses, reset/read values, symbolic settings, expected values ie settings local function populatetable() local bmp={} -- i2c particulars and defaults bmp.i2cinterface =i2c.HW0 -- only works with hardware i2c subsystems bmp.i2caddress = 0x76 -- fixed -- bmp.register = {} -- register hardware addresses bmp.expect = {} -- expected value from register bmp.set = {} -- special values for register -- bmp.register.CHIP_ID = 0xD0 bmp.expect.CHIP_ID = 0x58 -- bmp.register.CALIB_LSB = 0x88 bmp.register.CTRL_MEAS = 0xF4 bmp.register.CONFIG = 0xF5 bmp.register.STATUS = 0xF3 bmp.register.TEMP_LSB = 0xFA bmp.register.PRES_LSB = 0xF7 -- bmp.register.softreset = 0xE0 bmp.set.softreset = 0xB6 -- bmp.oss = 0 -- default oversampling mode, ultra low power, range [0-3] bmp.i2c_err_max = 5 -- maximum number of cumulative i2c read errors -- bmp.name = "BMP280" -- default device name -- bmp.health = "STOP" -- default state of health, other values are INIT , RUN or ERROR -- return bmp end -- local function tick( self ) -- execute function acccording to FSM state self:state() end -- functions for FSM states -- -- forward declarations of state functions local checkchip local resetchip local getcalib local setOverSample local setStandByMode local requestUT local readUT local requestUP local readUP -- forward declarations of functions called from states local readbytes local writebytes local cleancalib local ut2t local up2p local fsm_start local fsm_disable local i2c_ok local i2c_err -- checkchip = function( self ) -- state 0: attempt to get a response from the bus/address and compare with expected signature readbytes( self.i2cinterface, self.i2caddress, self.register.CHIP_ID, 1, function( data, ack ) if not ack then i2c_err( self ) else i2c_ok( self ) if data:byte( 1 ) == self.expect.CHIP_ID then self.state = resetchip self.health = "INIT" else self:chip_err_log(self, data ) fsm_disable( self ) end end end ) end -- resetchip = function ( self ) -- state 1: soft chip reset writebytes( self.i2cinterface, self.i2caddress, self.register.softreset, self.set.softreset , function( data, ack ) if not ack then i2c_err( self ) else i2c_ok( self ) self.state = getcalib end end ) end -- getcalib = function( self ) -- state 2: get EEPROM calibration values 13*16bits readbytes( self.i2cinterface, self.i2caddress, self.register.CALIB_LSB, 26, function( data, ack ) if not ack then i2c_err( self ) else i2c_ok( self ) self.calib = true -- calibration data is validate, if not then ucleancalib/cleancalib will set it to false -- calibration values are signed except AC4, AC5 , AC6 self.T1 = ucleancalib( self, data, 1) self.T2 = cleancalib( self, data, 3) self.T3 = cleancalib( self, data, 5) self.P1 = cleancalib( self, data, 7) self.P2 = cleancalib( self, data, 9) self.P3 = cleancalib( self, data, 11) self.P4 = cleancalib( self, data, 13) self.P5 = cleancalib( self, data, 15) self.P6 = cleancalib( self, data, 17) self.P7 = cleancalib( self, data, 19) self.P8 = cleancalib( self, data, 21) self.P9 = cleancalib( self, data, 23) self.RESERVED = cleancalib( self, data, 25) if self.calib then self.state = requestUT self.health = "RUN" else self:calib_err_log( ) fsm_disable( self ) end end end ) end setOverSample = function ( self ) -- state 3: request temperature measure writebytes( self.i2cinterface, self.i2caddress, self.register.CTRL_MEAS, 0x2E, function( data, ack ) if not ack then i2c_err( self ) else i2c_ok( self ) self.state = setStandByMode end end ) end setStandByMode = function ( self ) -- state 3: request temperature measure writebytes( self.i2cinterface, self.i2caddress, self.register.CONFIG, 0x00, function( data, ack ) if not ack then i2c_err( self ) else i2c_ok( self ) self.state = waitMeasureFinish end end ) end BMP280_MEASURING_BIT 0x01 #define BMP280_IM_UPDATE_BIT 0x08 waitMeasureFinish = function ( self ) -- state 3: request temperature measure readbytes( self.i2cinterface, self.i2caddress, self.register.STATUS, 1 , function( data, ack ) if not ack then i2c_err( self ) else i2c_ok( self ) if bit.isclear( data:byte( 1 ), 3 ) then self.state = waitIMUpdateFinish else self:measure_wait_log( )--waitMeasureFinishlog end end end ) end waitIMUpdateFinish = function ( self ) -- state 3: request temperature measure readbytes( self.i2cinterface, self.i2caddress, self.register.STATUS, 1 , function( data, ack ) if not ack then i2c_err( self ) else i2c_ok( self ) if bit.isclear( data:byte( 1 ), 0 ) then self.state = readUT else self:IM_update_wait_log( )--waitMeasureFinishlog end end end ) end bmp.register.TEMP_LSB = 0xFA bmp.register.PRES_LSB = 0xF7 readUT = function ( self ) -- state 4: read temperature readbytes( self.i2cinterface, self.i2caddress, self.register.TEMP_LSB, 3 , function( data, ack ) if not ack then i2c_err( self ) else i2c_ok( self ) local ut = bit.lshift( data:byte( 0 ) , 12 ) +bit.lshift( data:byte( 1 ) , 4 )+ bit.rshift( data:byte( 2 ) , 4 ) self:temperature_update( ) self.state = readUP end end ) end -- readUP = function ( self ) -- state 6: read pressure readbytes( self.i2cinterface, self.i2caddress, self.register.PRES_LSB, 3 , function( data, ack ) if not ack then i2c_err( self ) else i2c_ok( self ) local up = bit.lshift( data:byte( 0 ) , 12 ) +bit.lshift( data:byte( 1 ) , 4 )+ bit.rshift( data:byte( 2 ) , 4 ) up2p( self , up ) self:pressure_update( ) self.state = setStandByMode end end ) end -- readbytes = function( interface, address, register, nbytes, callback) -- block read multiple bytes from registers and execute callback when done i2c.start( interface ) i2c.address( interface, address, i2c.TRANSMITTER, true ) i2c.write( interface, register, true ) i2c.start( interface ) i2c.address( interface, address, i2c.RECEIVER, true) i2c.read( interface,nbytes ) i2c.stop( interface) i2c.transfer( interface,callback ) end -- writebytes = function( interface, address, register, value, callback) -- write value(s) to register and execute callback when done i2c.start( interface ) i2c.address( interface , address, i2c.TRANSMITTER, true ) i2c.write( interface, register, value, true ) -- value may be multiple bytes i2c.stop( interface ) i2c.transfer( interface,callback ) end -- cleancalib = function( self, data, index) local val = ( data:byte( index + 1 ) + bit.lshift( data:byte( index ), 8 ) ) if val == 0 or val == 0xFFFF then self.calib = false return 0 elseif val>32767 then return (val-65536) else return val end end -- ucleancalib = function( self, data, index) local val = ( data:byte( index + 1 ) + bit.lshift( data:byte( index ), 8 ) ) if val == 0 or val == 0xFFFF then self.calib = false return 0 else return val end end -- conversion functions ut2t = function( self , ut ) local x1 = bit.arshift( ((ut - self.AC6) * self.AC5 ) , 15) local x2 = bit.lshift( self.MC, 11) / (x1 + self.MD) -- round to integer after division x2 = x2>=0 and math.floor(x2+0.5) or math.ceil(x2-0.5) local b5 = x1 + x2 self.B5 = b5 self.T = bit.arshift( ( b5 + 8), 4) / 10 end -- up2p = function( self, up ) local b6 = self.B5-4000 local x1 = bit.arshift( self.B2 * b6 * b6, 23 ) local x2 = bit.arshift( self.AC2 * b6, 11) local x3 = x1 + x2 local b3 = bit.arshift( (bit.lshift( self.AC1 * 4 + x3, self.oss) + 2) , 2) x1 = bit.arshift( self.AC3 * b6, 13) x2 = bit.arshift( self.B1 * b6 * b6 / 4096 , 16) x3 = bit.arshift( x1 + x2 + 2 , 2) local b4 = bit.arshift( self.AC4 * ( x3 + 32768 ), 15) local b7 = ( up - b3 ) * bit.arshift( 50000 , self.oss ) local p = 2 * b7 / b4 p = p>=0 and math.floor(p+0.5) or math.ceil(p-0.5) x1 = bit.arshift( p , 8) x1 = x1 * x1 x1 = bit.arshift( x1 * 3038 , 16) x2 = bit.arshift( -7357 * p , 16 ) self.P = ( p + bit.arshift(( x1 + x2 + 3791) , 4 ) ) / 100 end -- Returns temperature in DegC, double precision. Output value of “51.23” equals 51.23 DegC. -- t_fine carries fine temperature as global value --double bmp280_compensate_T_double(BMP280_S32_t adc_T) --{ -- double var1, var2, T; -- var1 = (((double)adc_T)/16384.0 - ((double)dig_T1)/1024.0) * ((double)dig_T2); -- var2 = ((((double)adc_T)/131072.0 - ((double)dig_T1)/8192.0) * -- (((double)adc_T)/131072.0 - ((double) dig_T1)/8192.0)) * ((double)dig_T3); -- t_fine = (BMP280_S32_t)(var1 + var2); -- T = (var1 + var2) / 5120.0; -- return T; --} --Returns pressure in Pa as double. Output value of “96386.2” equals 96386.2 Pa = 963.862 hPa --double bmp280_compensate_P_double(BMP280_S32_t adc_P) --{ -- double var1, var2, p; -- var1 = ((double)t_fine/2.0) - 64000.0; -- var2 = var1 * var1 * ((double)dig_P6) / 32768.0; -- var2 = var2 + var1 * ((double)dig_P5) * 2.0; -- var2 = (var2/4.0)+(((double)dig_P4) * 65536.0); -- var1 = (((double)dig_P3) * var1 * var1 / 524288.0 + ((double)dig_P2) * var1) / 524288.0; -- var1 = (1.0 + var1 / 32768.0)*((double)dig_P1); -- if (var1 == 0.0) -- { -- return 0; // avoid exception caused by division by zero -- } -- p = 1048576.0 - (double)adc_P; -- p = (p - (var2 / 4096.0)) * 6250.0 / var1; -- var1 = ((double)dig_P9) * p * p / 2147483648.0; -- var2 = p * ((double)dig_P8) / 32768.0; -- p = p + (var1 + var2 + ((double)dig_P7)) / 16.0; -- return p; --} -- FSM control fsm_start = function( self ) self.i2c_err_count = 0 self.state = checkchip end -- fsm_disable = function( self ) self.state = function() end self:fatal_err_log( ) self.health = "ERROR" end -- error handlers i2c_ok = function( self ) if self.i2c_err_count > 0 then self.i2c_err_count = self.i2c_err_count - 1 end end -- i2c_err = function( self ) self:i2c_err_log() if self.i2c_err_count < self.i2c_err_max then self.i2c_err_count = self.i2c_err_count + 1 else fsm_disable( self ) end end -- local function new( interface , oss ) local bmp = populatetable() bmp.i2cinterface = interface or bmp.i2cinterface -- bmp.oss = oss or bmp.oss bmp.oss = bit.band( bmp.oss , 3) -- keep in range [0-3] bmp.pressureread = 0x34 + bit.lshift( bmp.oss, 6) -- error loggers and data available hooks are initially set to do nothing local function donothing( ) end local function waitMeasureFinishLog( ) print("wait measure finish.") end local function waitIMUpdateFinishLog( ) print("wait IM update finish.") end local function readTempFinishLog( self ) print("read temp:"..self.T) end local function readPressFinishLog( self ) print("read press:"..self.P) end local function badi2c( self ) print( (time.get() .. self.name .." no response from i2c bus: %d at address: 0x%X ") : format ( self.i2cinterface , self.i2caddress)) end -- local function badchipsignature( self, data ) print( "i2c device on bus: ", self.i2cinterface, " at address: ", self.i2caddress, "does not have the expected signature for BMP180") print( "expected chip signature", self.expect.CHIP_ID ) print( "received chip signature", data:byte( 1 ) ) end -- local function badcalib( self ) print( self.name .. " One or more invalid calibration values read from chip" ) end -- local function badfatal( self ) print( self.name .. " handler is now disabled" ) end bmp.i2c_err_log = badi2c bmp.chip_err_log = badchipsignature bmp.calib_err_log = badcalib bmp.fatal_err_log = badfatal -- default data update hooks bmp.temperature_update = readTempFinishLog bmp.pressure_update = readPressFinishLog bmp.measure_wait_log = waitMeasureFinishLog bmp.IM_update_wait_log = waitIMUpdateFinishLog -- initial FSM state fsm_start( bmp ) -- exported functions bmp.tick = tick bmp.reset = fsm_start --[[ export the two conversion functions only for testing purposes bmp.ut2t = ut2t bmp.up2p = up2p --]] -- return bmp end -- return { new = new }
local CorePackages = game:GetService("CorePackages") local CoreGui = game:GetService("CoreGui") local RobloxGui = CoreGui:WaitForChild("RobloxGui") local Roact = require(CorePackages.Roact) local ShareGame = RobloxGui.Modules.Settings.Pages.ShareGame local Constants = require(ShareGame.Constants) local BackButton = require(ShareGame.Components.BackButton) local SearchArea = require(ShareGame.Components.SearchArea) local RobloxTranslator = require(RobloxGui.Modules.RobloxTranslator) local Header = Roact.PureComponent:extend("Header") function Header:render() local deviceLayout = self.props.deviceLayout local size = self.props.size local layoutOrder = self.props.layoutOrder local zIndex = self.props.zIndex local closePage = self.props.closePage local searchAreaActive = self.props.searchAreaActive local layoutSpecific = Constants.LayoutSpecific[deviceLayout] local isDesktop = deviceLayout == Constants.DeviceLayout.DESKTOP local isSearchingOnMobile = (not isDesktop) and searchAreaActive return Roact.createElement("Frame", { BackgroundTransparency = 1, Size = size, AnchorPoint = Vector2.new(0, 1), LayoutOrder = layoutOrder, ZIndex = zIndex, }, { Title = Roact.createElement("TextLabel", { BackgroundTransparency = 1, Visible = not isSearchingOnMobile, Position = UDim2.new(0.5, 0, 0.5, 0), Text = RobloxTranslator:FormatByKey("Feature.SettingsHub.Heading.InviteFriends"), TextSize = layoutSpecific.PAGE_TITLE_TEXT_SIZE, TextColor3 = Constants.Color.WHITE, Font = Enum.Font.SourceSansSemibold, ZIndex = self.props.zIndex, }), BackButton = Roact.createElement(BackButton, { isArrow = not isDesktop, visible = not isSearchingOnMobile, position = UDim2.new(0, 0, 0.5, 0), size = UDim2.new( 0, layoutSpecific.BACK_BUTTON_WIDTH, 0, layoutSpecific.BACK_BUTTON_HEIGHT ), anchorPoint = Vector2.new(0, 0.5), zIndex = zIndex, onClick = closePage, }), SearchArea = Roact.createElement(SearchArea, { fullWidthSearchBar = not isDesktop, searchBoxMargin = layoutSpecific.SEARCH_BOX_MARGIN, anchorPoint = Vector2.new(1, 0.5), position = UDim2.new(1, 0, 0.5, 0), zIndex = zIndex, }) }) end return Header
-- Example Config file .------------------- -------- UNIT_DIMENSIONS="NATURE" DESCRIPTION="bala bala bong" -- description or other text things. DIMS={17,107,107} -- number of grid, now only first dimension is valid GW= {3,3,3} -- width of ghost points LENGTH={2*math.pi/(DIMS[1]-GW[1]*2-1)*(DIMS[1]-1), 4*math.pi/(DIMS[2]-GW[2]*2-1)*(DIMS[2]-1), 4*math.pi/(DIMS[3]-GW[3]*2-1)*(DIMS[3]-1)} -- length of simulation domain DT=0.5*LENGTH[3]/(DIMS[3]-1) -- time step LOADFieldS={E1=1,B0=2,N0=0} SP_LIST={"ele"} -- the list of species in the simulation SPECIES= -- pre_define species { ele={desc="ele" ,Z=-1.0, m=1.0, ns=1.0, engine="ColdFluid",pic=0 ,T=0}, H_c={desc="H" ,Z=1.0, m=1, ns=1.0, engine="ColdFulid",pic=0,T=0}, H_g={desc="H" ,Z=1.0, m=1, ns=1.0, engine="GyroGauge", T=1.0e-4, numOfMate=20, PIC=10}, } B0={} -- initial/background magnetic field E1={} -- initial/background electric field is zero if E0==null N0={} -- initial/background density field of electron; rx=(DIMS[2]-1)/2.0 ry=(DIMS[3]-1)/2.0 for k=0,DIMS[1] -1 do for j=0,DIMS[2] -1 do for i=0,DIMS[3] -1 do s=k*DIMS[2]*DIMS[3]+ j*DIMS[3]+i N0[s] = 6.0 B0[s*3+0] = 0.1*(j -ry)/ry*2.0 B0[s*3+1]= -0.1*(i-rx)/rx*2.0 B0[s*3+2]= 1.0-0.2*(i-rx)/rx*2.0 end end end --[[ uncomment this line, if you need Cycle BC. -- Push BC(boundary condition), now only first two are valid -- BC >= GW BC= { -1,-1, -- direction x -1,-1, -- direction y -1,-1 -- direction z } for x=0,DIMS[1] -1 do for y=0,DIMS[2] -1 do for z=0,DIMS[3] -1 do s=x*DIMS[2]*DIMS[3]+ y*DIMS[3]+z qx = (x-GW[1])%(DIMS[1]-2*GW[1]-1)/(DIMS[1]-2*GW[1]-1) *2.0 *math.pi qy = (y-GW[2])%(DIMS[2]-2*GW[2]-1)/(DIMS[2]-2*GW[2]-1) *2.0 *math.pi qz = (z-GW[3])%(DIMS[3]-2*GW[3]-1)/(DIMS[3]-2*GW[3]-1) *2.0 *math.pi a=0.0 for kx=1,1 do for ky=1,1 do a=a+math.sin(qx*kx)*math.sin(qy*ky) end end E0[s*3+0]=0.0 E0[s*3+1]=1.0e-8 *a E0[s*3+2]=1.0e-8 *a end end end --]] ---[[ uncomment this line, if you need absorbing condition. BC= { -1,-1, -- direction z 1,1, -- direction y 1,1 -- direction x } Srcf0=1.9 Srckx=0 Srctau=0.5 function JSrc(t) alpha=t*Srcf0 - Srctau*math.pi*2.0 res={} if alpha<0 then a=math.sin(alpha)*math.exp(-alpha*alpha) else a=math.sin(alpha) end for k=0, DIMS[1]-1 do s=k*DIMS[2]*DIMS[3]+ (DIMS[2]-1)/2*DIMS[3]+10 res[s*3+1]= 1.0e-8*math.sin(2.0*math.pi*(k-GW[1])/(DIMS[1]-GW[1]*2-1))*a end return res end --]] -- The End ---------------------------------------
local NotificationBindable = Instance.new("BindableFunction") NotificationBindable.OnInvoke = callback -- game.StarterGui:SetCore("SendNotification", { Title = "Dynamic Client"; Text = "LagSwitch Activated, Use F3 to Switch between modes."; Icon = "rbxassetid://5718757541"; Duration = 3; Callback = NotificationBindable; }) local a = false; local b = settings(); game:service'UserInputService'.InputEnded:connect(function(i) if i.KeyCode == Enum.KeyCode.F3 then a = not a; -- ic3 was here b.Network.IncommingReplicationLag = a and 1000 or 0; end end)
local PANEL = {} function PANEL:Init() self:SetDeleteOnClose(true) self:MakePopup() self:SetTitle( "" ) self:SetSize(200,200) self:DockPadding(0,20,0,5) self:Center() -- self:InvalidateChildren( ) -- FrameAFK3:SetVisible( true ) -- self.LerpedColor = Color(94, 130, 158) -- self.LerpedColorAlphaBorders = 0 -- self.LerpedColorAlphaBlock = 0 -- self:SetTall( 35 ) -- self.entered = false -- self.special = false -- self.onclick = false -- self.isborder = true -- self.FakeActivated = false -- self.Font = "S_Light_15" -- self.TextAlignX = TEXT_ALIGN_CENTER -- self.TextAlignY = TEXT_ALIGN_CENTER -- self:SetFont( self.Font ) local m_notifAlt = vgui.Create( "DFrame", self ) m_notifAlt:SetDraggable( false ) -- m_notifAlt.StartTime = SysTime() -- m_notifAlt.Length = delay and delay or 8 m_notifAlt:Dock( TOP ) -- m_notifAlt.fx = 0 -- m_notifAlt.fy = 0 -- m_notifAlt.AX = 0 -- m_notifAlt.AY = 0 m_notifAlt:ShowCloseButton(false) m_notifAlt:DockMargin(0, 0, 0, 0) m_notifAlt:SetTitle("") m_notifAlt.Text = "НОВОЕ УВЕДОМЛЕНИЕ" m_notifAlt.Paint = function(s,w,h) -- draw.RoundedBox(0, 0, 0, w, h, Color(35,35,35,200)) draw.SimpleText(s.Text, "S_Bold_20", w/2, 30/2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end self.Title = m_notifAlt -- local x,y = m_notifAlt:GetSize() -- Rich Text panel local richtext = vgui.Create( "DLabel", self ) -- richtext:SetPos(5,35) -- richtext:SetSize( x-10, y-35-40 ) richtext:Dock(TOP) richtext:DockMargin(5, 10, 5, 5) richtext:SetText( '' ) richtext:SetFont( "S_Regular_20" ) richtext:SetWrap( true ) richtext:SetAutoStretchVertical(true) richtext.Paint = function(s,w,h) //draw.RoundedBox(0, 0, 0, w, h, Color(155,35,35,200)) end self.Description = richtext -- self:InvalidateLayout( true ) -- self:SizeToChildren( false, true ) print(self) local selff = self function richtext:OnSizeChanged() -- print('richtext') selff:SizeToChildren( false, true ) end end function PANEL:SetTextTitle(text) self.Title.Text = text end function PANEL:SetTextDescription(text) self.Description:SetText( text ) local selff = self timer.Simple(0,function() if !IsValid(selff) then return end selff.Description:InvalidateLayout( true ) timer.Simple(0.1,function() if !IsValid(selff) then return end -- print(text) -- do selff:SizeToChildren( false, true ) -- end end) -- end) -- self:SizeToChildren( false, true ) end function PANEL:CreateButton(text, callback) local m_button = vgui.Create(".CCButton", self) m_button.Font = "S_Regular_15" m_button:SetSize( 0,25 ) m_button:Dock( TOP ) m_button:DockMargin(5, 5, 5, 0) m_button.Text = text m_button:SetBorders(false) m_button.DoClick = function( s ) if callback then callback(self) end end self.Description:InvalidateLayout( true ) local selff = self function m_button:OnSizeChanged() timer.Simple(0,function() if !IsValid(selff) then return end selff:SizeToChildren( false, true ) end) end return m_button end function PANEL:CreateDropDown(text) local m_button = vgui.Create(".CCDropDown", self) m_button.Text = text m_button.Font = "S_Regular_15" m_button:SetSortItems( false ) m_button:SetSize( 0,25 ) m_button:DockMargin(5, 5, 5, 0) m_button:Dock(TOP) -- for i,v in SortedPairs(komm) do -- pselect:AddChoice(i..' плшк = '..v..' поинтов', i) -- end -- local m_button = vgui.Create(".CCButton", self) -- m_button.Font = "S_Regular_15" -- m_button:SetSize( 0,25 ) -- m_button:Dock( TOP ) -- m_button:DockMargin(5, 5, 5, 0) -- m_button.Text = text -- m_button:SetBorders(false) -- m_button.DoClick = function( s ) -- if callback then -- callback(self) -- end -- end self.Description:InvalidateLayout( true ) local selff = self function m_button:OnSizeChanged() timer.Simple(0,function() if !IsValid(selff) then return end selff:SizeToChildren( false, true ) end) end return m_button end function PANEL:OnSizeChanged() -- print('check') self:Center() end PANEL.Paint = function( s, w, h ) -- TTS.Libs.Interface.Blur( FrameAFK3, 10, 20, 255 ) draw.RoundedBox( 0, 0, 0, w, h,Color( 35, 35, 35, 230 ) ) end vgui.Register( ".CCQuery", PANEL, "DFrame" )
--[[ ╔══════════════════════════════════════════════════════════════════════════════╗ ║ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ║ ║▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌║ ║▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀▀▀ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ║ ║▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ║ ║▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ║ ║▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌║ ║▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀▀▀▀▀▀█░▌ ▐░▌ ▐░▌ ▐░▌▐░█▀▀▀▀█░█▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ║ ║▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ║ ║▐░▌ ▐░▌ ▄▄▄▄▄▄▄▄▄█░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ║ ║▐░▌ ▐░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌║ ║ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ║ ║ ╔═══════════════════════╗ ║ ╠══════════════════════════╣ Object Storage Module ╠═══════════════════════════╣ ║ ╔╩═══════════════════════╩╗ ║ ║ ║ Made with ♥ by Hoidberg ║ ║ ╚═════════════════════════╩═════════════════════════╩══════════════════════════╝ ]] local objectStorage = {} local RunService = game:GetService("RunService") local InstanceEncoder = require(script.InstanceEncoder) local BAD_ARGUMENT = "bad argument #%d (%s expected, got %s)" local function expectA(t, parameter) -- function taken from https://devforum.roblox.com/t/396022/18 assert(parameter, BAD_ARGUMENT:format(1, t, "nil")) assert(typeof(parameter) == t, BAD_ARGUMENT:format(1, t, typeof(parameter))) print(parameter) end return function(obj) expectA("Instance", obj) local hStore = {} local mathError = "There is no need to call any math functions" local objName = obj.Name setmetatable(hStore, { __index = function() error("There is no need to call index") end, __concat = function(Table, Value) error("There is no need to call concat") end, __unm = function(Table) error(mathError) end, __add = function(Table, Value) error(mathError) end, __sub = function(Table, Value) error(mathError) end, __mul = function(Table, Value) error(mathError) end, __div = function(Table, Value) error(mathError) end, __mod = function(Table, Value) error(mathError) end, __pow = function(Table, Value) error(mathError) end, __tostring = function(Table) return objName end, __eq = function(Table, Value) error(mathError) end, __it = function(Table, Value) error(mathError) end, __le = function(Table, Value) error(mathError) end, __metatable = "You cannot modify the metatable of hStore" }) local encodedObj = InstanceEncoder:Encode(obj) table.insert(objectStorage, table.getn(objectStorage) + 1, encodedObj) obj:Destroy() function hStore:get() return InstanceEncoder:Decode(encodedObj) end hStore.EncodedObject = encodedObj return hStore end
--[[ This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:28' 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. **************************************************************************** ]] ----------------- -- Name search -- ----------------- ZO_TradingHouseNameSearchFeature_Keyboard = ZO_TradingHouseNameSearchFeature_Shared:Subclass() function ZO_TradingHouseNameSearchFeature_Keyboard:New(...) return ZO_TradingHouseNameSearchFeature_Shared.New(self, ...) end -- Override function ZO_TradingHouseNameSearchFeature_Keyboard:GetSearchText() return self.nameSearchEdit:GetText() end -- Override function ZO_TradingHouseNameSearchFeature_Keyboard:SetSearchText(newSearchText) self.nameSearchEdit:SetText(newSearchText) self.nameSearchEdit:SetCursorPosition(0) end function ZO_TradingHouseNameSearchFeature_Keyboard:AttachToControl(itemNameSearchControl, itemNameSearchAutoCompleteControl) self.nameSearchEdit = itemNameSearchControl:GetNamedChild("Box") self.nameSearchEdit:SetHandler("OnTextChanged", function() self:OnNameSearchEditTextChanged() end) self.nameSearchEdit:RegisterForEvent(EVENT_MATCH_TRADING_HOUSE_ITEM_NAMES_COMPLETE, function(_, ...) self:OnNameMatchComplete(...) end) self.nameSearchClearButton = itemNameSearchControl:GetNamedChild("Clear") self.nameSearchClearButton:SetEnabled(false) self.nameSearchClearButton:SetHandler("OnClicked", function() self:OnNameSearchClearButtonClicked() end) self.nameSearchAutoComplete = ZO_TradingHouseNameSearchAutoComplete:New(itemNameSearchAutoCompleteControl, self.nameSearchEdit) TRADING_HOUSE_SEARCH:RegisterCallback("OnSearchCriteriaChanged", function() if not IsInGamepadPreferredMode() then self:MarkFiltersDirty() end end) end function ZO_TradingHouseNameSearchFeature_Keyboard:OnNameSearchEditTextChanged() ZO_EditDefaultText_OnTextChanged(self.nameSearchEdit) self.searchText = self.nameSearchEdit:GetText() if not self:IsSearchTextLongEnough() then self.nameSearchAutoComplete:Hide() end self.nameSearchClearButton:SetEnabled(self.searchText ~= "") TRADING_HOUSE_SEARCH:HandleSearchCriteriaChanged(self) end function ZO_TradingHouseNameSearchFeature_Keyboard:OnNameSearchClearButtonClicked() self.nameSearchEdit:SetText("") end function ZO_TradingHouseNameSearchFeature_Keyboard:OnNameMatchComplete(nameMatchId, numResults, backgroundDurationMS) ZO_TradingHouseNameSearchFeature_Shared.OnNameMatchComplete(self, nameMatchId, numResults) if nameMatchId == self.completedItemNameMatchId then self.nameSearchAutoComplete:ShowListForNameSearch(nameMatchId, numResults) end end
local message_pin_map = require("qnFiles/qnPlist/hall/message_pin"); local messageItem= { name="messageItem",type=0,typeName="View",time=0,report=0,x=0,y=0,width=1250,height=130,visible=1,fillParentWidth=1,fillParentHeight=0,nodeAlign=kAlignTop, { name="itemBtn",type=2,typeName="Button",time=79673259,report=0,x=0,y=0,width=1280,height=125,visible=1,fillParentWidth=1,fillParentHeight=0,nodeAlign=kAlignCenter,file="hall/common/bg_blank.png",gridLeft=30,gridRight=30,gridTop=30,gridBottom=30, { name="itemView",type=0,typeName="View",time=79697354,report=0,x=0,y=0,width=1250,height=140,fillTopLeftX=10,fillTopLeftY=5,fillBottomRightX=10,fillBottomRightY=5,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignTop, { name="date_label",type=4,typeName="Text",time=79697447,report=0,x=0,y=0,width=162,height=45,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignRight,fontSize=32,textAlign=kAlignRight,colorRed=118,colorGreen=72,colorBlue=18,string=[[2013/12/26]] }, { name="title_label",type=4,typeName="Text",time=79697494,report=0,x=25,y=15,width=429,height=37,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignTopLeft,fontSize=32,textAlign=kAlignLeft,colorRed=118,colorGreen=72,colorBlue=18,string=[[新活动《一球成名》上线啦!]] }, { name="content",type=4,typeName="Text",time=79697595,report=0,x=25,y=25,width=864,height=30,visible=1,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignBottomLeft,fontSize=26,textAlign=kAlignLeft,colorRed=118,colorGreen=72,colorBlue=18,string=[[标题内容标题内容标题内容标题内容标题内容标题内容标题内容标题内容]] }, { name="attachment",type=1,typeName="Image",time=80277557,report=0,x=180,y=0,width=123,height=73,visible=0,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignRight,file=message_pin_map['msg_attachment.png'] }, { name="envelope",type=1,typeName="Image",time=92806743,report=0,x=180,y=0,width=123,height=73,visible=0,fillParentWidth=0,fillParentHeight=0,nodeAlign=kAlignRight,file=message_pin_map['read_icon.png'] } } }, { name="line",type=1,typeName="Image",time=89206299,report=0,x=0,y=0,width=1280,height=2,fillTopLeftX=10,fillTopLeftY=128,fillBottomRightX=10,fillBottomRightY=0,visible=1,fillParentWidth=1,fillParentHeight=0,nodeAlign=kAlignBottom,file="hall/common/line.png" } } return messageItem;
--region CDynamicList.lua --Author : jefflwq --Date : 2018/04/25 --说明 : 动态大小的List类 --endregion using "Joop" namespace "System.Collections.Generic" { class "CDynamicList" { ListData = false, ___Size = 0, ___ItemType = false, --table or JoopClass Size = function(self) return self.___Size end, TotalSize = function(self) return #self.ListData end, CDynamicList = function(self, itemType) self.ListData = {} if itemType == table then self.___ItemType = table.New elseif class:IsTypeOf(itemType) then self.___ItemType = itemType else self.___ItemType = false end end, AddItem = function(self, item) self.___Size = self.___Size + 1 if self.___Size <= #self.ListData then self.ListData[self.___Size] = item else table.insert(self.ListData, item) end end, Add = function(self, count) count = count or 1 if self.___Size + count <= #self.ListData then self.___Size = self.___Size + count return self:GetItem(self.___Size) end self:___Add(self.___Size + count - #self.ListData) return self:GetItem(self.___Size - count + 1) end, ___Add = function(self, count, addNil) local item for i = 1, count do item = (addNil or not self.___ItemType) and ___Nil or self.___ItemType() table.insert(self.ListData, item) end self.___Size = #self.ListData end, GetItem = function(self, pos) if not pos or pos <= 0 or pos > self.___Size then return nil else if self.ListData[pos] == ___Nil then return nil else return self.ListData[pos] end end end, Resize = function(self, size, freeUnused) if not size or size <= 0 then self.___Size = 0 elseif size <= self.___Size then self.___Size = size else self:Add(size - self.___Size) end if freeUnused then self:FreeUnused() end end, FreeUnused = function(self) for i = #self.ListData, self.___Size + 1, -1 do table.remove(self.ListData, i) end end, Insert = function(self, item, pos) if not pos then self.___Size = self.___Size + 1 table.insert(self.ListData, self.___Size, item == nil and ___Nil or item) return self.___Size end if pos <= 0 then return nil end local len = #self.ListData if pos <= len then if pos <= self.___Size then self.___Size = self.___Size + 1 else self.___Size = pos end table.insert(self.ListData, pos, item == nil and ___Nil or item) return pos end --pos > len self:___Add(pos - len - 1) table.insert(self.ListData, item == nil and ___Nil or item) self.___Size = pos return pos end, Clear = function(self, freeUnused) self.___Size = 0 if freeUnused then self:FreeUnused() end end, Remove = function(self, pos) if pos <= 0 or pos > self.___Size then return false end table.remove(self.ListData, pos) self.___Size = self.___Size - 1 return true end, RemoveItem = function(self, item) local pos = self:Find(item) if pos == 0 then return nil end table.remove(self.ListData, pos) self.___Size = self.___Size - 1 return true end, Find = function(self, item, iStart) for i = iStart or 1, self.___Size do if self:GetItem(i) == item then return i end end return 0 end, FindByKey = function(self, keyName, keyValue, iStart) local item for i = iStart or 1, self.___Size do item = self:GetItem(i) if item and item[keyName] == keyValue then return item, i end end end, RemoveByKey = function(self, keyName, keyValue, removeAll, iStart) local item local count = 0 for i = iStart or 1, self.___Size do item = self:GetItem(i) if item and item[keyName] == keyValue then count = count + 1 table.remove(self.ListData, i) self.___Size = self.___Size - 1 if not removeAll then return count end i = i - 1 end end return count end, Contains = function(self, item, iStart) return self:Find(item, iStart) > 0 end, Unpack = function(self, ...) return self:UnpackFromIndex(1, ...) end, UnpackFromIndex = function(self, index, ...) --- ... 必须也为CList if index == nil or index < 1 then index = 1 end if index <= self.___Size then return self:GetItem(index), self:UnpackFromIndex(index + 1, ...) else if select("#", ...) > 0 then local s = select(1, ...) --if type(s) == "table" and s.class and s.class.name == "CList" then -- return s:GetItem(1), s:Unpack(2, select(2, ...)) --else return s, self:UnpackFromIndex(index, select(2, ...)) --end end end end, } }
------------------------------------------------------------ -- PartyDungeons.lua -- -- Abin -- 2016/09/13 ------------------------------------------------------------ local module = CompactRaid:GetModule("RaidDebuff") if not module then return end local TIER = 7 -- Legion local INSTANCE -- Maw of Souls (727) INSTANCE = 727 module:RegisterDebuff(TIER, INSTANCE, 0, 209858) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 193364) module:RegisterDebuff(TIER, INSTANCE, 0, 197262) -- Neltharion's Lair (767) INSTANCE = 767 module:RegisterDebuff(TIER, INSTANCE, 0, 209858) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 192800) module:RegisterDebuff(TIER, INSTANCE, 0, 199178, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 210150) module:RegisterDebuff(TIER, INSTANCE, 0, 200154, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 186616) -- Vault of the Wardens (707) INSTANCE = 707 module:RegisterDebuff(TIER, INSTANCE, 0, 209858) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 200904) module:RegisterDebuff(TIER, INSTANCE, 0, 192656) module:RegisterDebuff(TIER, INSTANCE, 0, 193069) module:RegisterDebuff(TIER, INSTANCE, 0, 202615) module:RegisterDebuff(TIER, INSTANCE, 0, 193969) module:RegisterDebuff(TIER, INSTANCE, 0, 202658) module:RegisterDebuff(TIER, INSTANCE, 0, 202608) module:RegisterDebuff(TIER, INSTANCE, 0, 193956) -- Violet Hold (777) INSTANCE = 777 module:RegisterDebuff(TIER, INSTANCE, 0, 201476) module:RegisterDebuff(TIER, INSTANCE, 0, 201672) module:RegisterDebuff(TIER, INSTANCE, 0, 201379) module:RegisterDebuff(TIER, INSTANCE, 0, 202779, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 202804, 4) module:RegisterDebuff(TIER, INSTANCE, 0, 202217, 4) module:RegisterDebuff(TIER, INSTANCE, 0, 202300) module:RegisterDebuff(TIER, INSTANCE, 0, 202306) module:RegisterDebuff(TIER, INSTANCE, 0, 205233, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 210879) module:RegisterDebuff(TIER, INSTANCE, 0, 202792, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 204608) module:RegisterDebuff(TIER, INSTANCE, 0, 205513) module:RegisterDebuff(TIER, INSTANCE, 0, 204962, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 202037) -- Court of Stars (800) INSTANCE = 800 module:RegisterDebuff(TIER, INSTANCE, 0, 209858) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 207278) module:RegisterDebuff(TIER, INSTANCE, 0, 208165) module:RegisterDebuff(TIER, INSTANCE, 0, 211391) module:RegisterDebuff(TIER, INSTANCE, 0, 211464) module:RegisterDebuff(TIER, INSTANCE, 0, 224333) module:RegisterDebuff(TIER, INSTANCE, 0, 209667) module:RegisterDebuff(TIER, INSTANCE, 0, 211470) module:RegisterDebuff(TIER, INSTANCE, 0, 214688) -- Eye of Azshara (716) INSTANCE = 716 module:RegisterDebuff(TIER, INSTANCE, 0, 209858) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 191977) module:RegisterDebuff(TIER, INSTANCE, 0, 193018) module:RegisterDebuff(TIER, INSTANCE, 0, 191855) module:RegisterDebuff(TIER, INSTANCE, 0, 192708) module:RegisterDebuff(TIER, INSTANCE, 0, 197105) module:RegisterDebuff(TIER, INSTANCE, 0, 199847) module:RegisterDebuff(TIER, INSTANCE, 0, 193698, 5) -- Halls of Valor (721) INSTANCE = 721 module:RegisterDebuff(TIER, INSTANCE, 0, 209858) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 215430, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 193083) module:RegisterDebuff(TIER, INSTANCE, 0, 192048) module:RegisterDebuff(TIER, INSTANCE, 0, 192305) module:RegisterDebuff(TIER, INSTANCE, 0, 196838, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 193765) module:RegisterDebuff(TIER, INSTANCE, 0, 197966) module:RegisterDebuff(TIER, INSTANCE, 0, 198190, 5) -- The Arcway (726) INSTANCE = 726 module:RegisterDebuff(TIER, INSTANCE, 0, 209858) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 196562) module:RegisterDebuff(TIER, INSTANCE, 0, 196070) module:RegisterDebuff(TIER, INSTANCE, 0, 200227) module:RegisterDebuff(TIER, INSTANCE, 0, 203882) module:RegisterDebuff(TIER, INSTANCE, 0, 195804) module:RegisterDebuff(TIER, INSTANCE, 0, 196805, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 195362, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 211543) module:RegisterDebuff(TIER, INSTANCE, 0, 203957) -- Darkheart Thicket (762) INSTANCE = 762 module:RegisterDebuff(TIER, INSTANCE, 0, 209858) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 196376) module:RegisterDebuff(TIER, INSTANCE, 0, 204611) module:RegisterDebuff(TIER, INSTANCE, 0, 200359) module:RegisterDebuff(TIER, INSTANCE, 0, 200243) module:RegisterDebuff(TIER, INSTANCE, 0, 204243) module:RegisterDebuff(TIER, INSTANCE, 0, 201839) module:RegisterDebuff(TIER, INSTANCE, 0, 200642) module:RegisterDebuff(TIER, INSTANCE, 0, 200631) module:RegisterDebuff(TIER, INSTANCE, 0, 200238) module:RegisterDebuff(TIER, INSTANCE, 0, 200273, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 200182) module:RegisterDebuff(TIER, INSTANCE, 0, 200329) module:RegisterDebuff(TIER, INSTANCE, 0, 204667) module:RegisterDebuff(TIER, INSTANCE, 0, 204246, 4) module:RegisterDebuff(TIER, INSTANCE, 0, 201365) -- Black Rook Hold (740) INSTANCE = 740 module:RegisterDebuff(TIER, INSTANCE, 0, 209858) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 194960) module:RegisterDebuff(TIER, INSTANCE, 0, 197478) module:RegisterDebuff(TIER, INSTANCE, 0, 197418) module:RegisterDebuff(TIER, INSTANCE, 0, 198080) module:RegisterDebuff(TIER, INSTANCE, 0, 199168) module:RegisterDebuff(TIER, INSTANCE, 0, 198635, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 199092) module:RegisterDebuff(TIER, INSTANCE, 0, 221838) module:RegisterDebuff(TIER, INSTANCE, 0, 198446) module:RegisterDebuff(TIER, INSTANCE, 0, 198079) module:RegisterDebuff(TIER, INSTANCE, 0, 214002) module:RegisterDebuff(TIER, INSTANCE, 0, 200084) module:RegisterDebuff(TIER, INSTANCE, 0, 200261) -- Kalazan (860) INSTANCE = 860 module:RegisterDebuff(TIER, INSTANCE, 0, 227325) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 227985) module:RegisterDebuff(TIER, INSTANCE, 0, 227789) module:RegisterDebuff(TIER, INSTANCE, 0, 227508) module:RegisterDebuff(TIER, INSTANCE, 0, 227404) module:RegisterDebuff(TIER, INSTANCE, 0, 227493) module:RegisterDebuff(TIER, INSTANCE, 0, 227832) module:RegisterDebuff(TIER, INSTANCE, 0, 227742) module:RegisterDebuff(TIER, INSTANCE, 0, 227628) module:RegisterDebuff(TIER, INSTANCE, 0, 227615) module:RegisterDebuff(TIER, INSTANCE, 0, 227592) module:RegisterDebuff(TIER, INSTANCE, 0, 227523) module:RegisterDebuff(TIER, INSTANCE, 0, 227502) module:RegisterDebuff(TIER, INSTANCE, 0, 229083) module:RegisterDebuff(TIER, INSTANCE, 0, 229159, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 227977) module:RegisterDebuff(TIER, INSTANCE, 0, 228796, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 228526) module:RegisterDebuff(TIER, INSTANCE, 0, 228576) module:RegisterDebuff(TIER, INSTANCE, 0, 228280) module:RegisterDebuff(TIER, INSTANCE, 0, 228829) -- Cathedral of Eternal Night (900) INSTANCE = 900 module:RegisterDebuff(TIER, INSTANCE, 0, 227325) module:RegisterDebuff(TIER, INSTANCE, 0, 240559, 1) module:RegisterDebuff(TIER, INSTANCE, 0, 236650) module:RegisterDebuff(TIER, INSTANCE, 0, 238583) module:RegisterDebuff(TIER, INSTANCE, 0, 236975) module:RegisterDebuff(TIER, INSTANCE, 0, 242792) module:RegisterDebuff(TIER, INSTANCE, 0, 236954) module:RegisterDebuff(TIER, INSTANCE, 0, 238688) module:RegisterDebuff(TIER, INSTANCE, 0, 234830) module:RegisterDebuff(TIER, INSTANCE, 0, 237726, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 238480) module:RegisterDebuff(TIER, INSTANCE, 0, 243613, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 238410) -- Seat of Triumvirate (945) INSTANCE = 945 module:RegisterDebuff(TIER, INSTANCE, 0, 244588) module:RegisterDebuff(TIER, INSTANCE, 0, 244657, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 246026) module:RegisterDebuff(TIER, INSTANCE, 0, 247246) module:RegisterDebuff(TIER, INSTANCE, 0, 245802) module:RegisterDebuff(TIER, INSTANCE, 0, 248831) module:RegisterDebuff(TIER, INSTANCE, 0, 248733) module:RegisterDebuff(TIER, INSTANCE, 0, 244751) module:RegisterDebuff(TIER, INSTANCE, 0, 244906) module:RegisterDebuff(TIER, INSTANCE, 0, 245289)
function red(n) local find = false for i, v in pairs(ROUND.chair[n].hand) do if isNumeric(v) then find = i break end end if find then local target = false local min = math.huge for i, v in pairs(ROUND.chair) do if i ~= n and v.mode ~= "DELETED" then if #v.hand == 10 then target = i break elseif #v.hand < min then min = #v.hand target = i end end end missCard(target, ROUND.chair[n].hand[find], 2000) explosion(5, ROUND.chair[target].x, 100, 5, 10) donateByIndex(n, target, find) sortHand(ROUND.chair[target].hand) if #ROUND.chair[n].hand == 1 then ROUND.chair[n].uno = "uno" end showCardsGainned(n, -1) showCardsGainned(target, 1) updateScore(n) updateScore(target) --drawTopCard() updateHand(n) updateHand(target) if mustBeEliminated(target) then eliminate(target) end end if #ROUND.chair[n].hand == 0 then endGame(ROUND.chair[n].owner) else passTurn() batataTimer(n) end end function blue(n) for i, v in pairs(ROUND.chair) do if v.mode ~= "DELETED" and n ~= i then v.peace = 2 end end passTurn() batataTimer(n) ROUND.chair[n].confuse = false end function yellow(n) local pool = {} for i, v in pairs(ROUND.chair) do if v.mode ~= "DELETED" and i ~= n then table.insert(pool, i) end end local l = tfm.exec.addImage(IMG.misc.genericLayer, "!1000", 0, 0, player) TIMER.img[l] = os.time()+500 local r = table.remove(pool, math.random(#pool)) if r then local img = tfm.exec.addImage(IMG.misc.thunder, "!1000", ROUND.chair[r].x-50, 15) TIMER.img[img] = os.time()+500 explosion(0, ROUND.chair[r].x, 115, 10, 30) tryDraw(r, math.random(3)) end passTurn() batataTimer(n) end function green(n) local target = false local min = math.huge for i, v in pairs(ROUND.chair) do if v.mode ~= "DELETED" then if #v.hand < min then min = #v.hand target = i end end end if target and #ROUND.chair[n].hand > min then discardCard(n, #ROUND.chair[n].hand-min) explosion(9, ROUND.chair[n].x, 135, 5, 10) explosion(35, ROUND.chair[n].x, 135, 3, 5) explosion(9, ROUND.chair[target].x, 135, 5, 10) explosion(35, ROUND.chair[target].x, 135, 3, 5) end passTurn() batataTimer(n) end function power(n) table.insert(ROUND.pile, table.remove(ROUND.chair[n].hand, math.random(#ROUND.chair[n].hand))) ROUND.topCard.card2 = ROUND.topCard.card ROUND.topCard.card[2] = "ruleBoss" local y = drawTopCard() if #ROUND.chair[n].hand == 1 then ROUND.chair[n].uno = "uno" end updateHand(n) updateScore(n) local fx = {red=13, blue=1, yellow=11, green=9} y = 210 - (#ROUND.pile/108 * 10) for i=1, 10 do local vel = i/10*75 tfm.exec.displayParticle(fx[ROUND.topCard.card[1]] or 0, 430, y+vel, -math.random(7,15)/5, (vel-37)/20, 0, 0) end for i=1, 10 do local vel = i/10*75 tfm.exec.displayParticle(fx[ROUND.topCard.card[1]] or 0, 480, y+vel, math.random(7,15)/5, (vel-37)/20, 0, 0) end ROUND.chair[n].action = {name="PLAY"} ROUND.time = GLOBAL_TIME + 10000 addFunctionTimer(function() ROUND.chair[n].action = nil _G[ROUND.topCard.card[2]](n) end, 1000) end
local tablefuncs = loadfile("./Library/TableFunctions.lua")() local bit = loadfile("./Library/BitFunctions.lua")() local tableToString = tablefuncs.tableToString; local shuffle = tablefuncs.shuffle; local tableCopy = tablefuncs.tableCopy; local ChunkData, VMData = loadfile("./CBI/Templates/Basics.lua")(); local GenChunkDecoder = function(settings) local TypesTable, Functions, Debug = ChunkData(settings) local Decoders = loadfile("./CBI/Templates/Decoders.lua")()(settings); return TypesTable.."\n"..Functions.."\n"..Decoders .. "\n" .. Debug .. "\n"; end local GenVM = function(bytecode, settings) local Setup, Loop = VMData(bytecode, settings) local Opcodes = loadfile("./CBI/Templates/Opcodes.lua")()(settings); -- shuffle(Opcodes); return Setup .. "\n\n local opcode_funcs = {"..table.concat(Opcodes,'\n\n\n').."}\n" .. Loop; end local GenCVM = function(bytecode, settings) local VM = GenChunkDecoder(settings).. string.rep('\n', 6) .. GenVM(bytecode, settings); return VM; end; return GenCVM;
-- This script takes the name of the queue and then checks -- for any expired locks, then inserts any scheduled items -- that are now valid, and lastly returns any work items -- that can be handed over. -- -- Keys: -- 1) queue name -- Args: -- 1) the number of items to return -- 2) the current time if #KEYS ~= 1 then if #KEYS < 1 then error('Peek(): Expected 1 KEYS argument') else error('Peek(): Got ' .. #KEYS .. ', expected 1 KEYS argument') end end local queue = assert(KEYS[1] , 'Peek(): Key "queue" missing') local key = 'ql:q:' .. queue local count = assert(tonumber(ARGV[1]) , 'Peek(): Arg "count" missing or not a number: ' .. (ARGV[2] or 'nil')) local now = assert(tonumber(ARGV[2]) , 'Peek(): Arg "now" missing or not a number: ' .. (ARGV[3] or 'nil')) -- These are the ids that we're going to return local keys = {} -- Iterate through all the expired locks and add them to the list -- of keys that we'll return for index, jid in ipairs(redis.call('zrangebyscore', key .. '-locks', 0, now, 'LIMIT', 0, count)) do table.insert(keys, jid) end -- If we still need jobs in order to meet demand, then we should -- look for all the recurring jobs that need jobs run if #keys < count then -- This is how many jobs we've moved so far local moved = 0 -- These are the recurring jobs that need work local r = redis.call('zrangebyscore', key .. '-recur', 0, now, 'LIMIT', 0, count) for index, jid in ipairs(r) do -- For each of the jids that need jobs scheduled, first -- get the last time each of them was run, and then increment -- it by its interval. While this time is less than now, -- we need to keep putting jobs on the queue local klass, data, priority, tags, retries, interval = unpack(redis.call('hmget', 'ql:r:' .. jid, 'klass', 'data', 'priority', 'tags', 'retries', 'interval')) local _tags = cjson.decode(tags) -- We're saving this value so that in the history, we can accurately -- reflect when the job would normally have been scheduled local score = math.floor(tonumber(redis.call('zscore', key .. '-recur', jid))) while (score <= now) and (moved < (count - #keys)) do local count = redis.call('hincrby', 'ql:r:' .. jid, 'count', 1) moved = moved + 1 -- Add this job to the list of jobs tagged with whatever tags were supplied for i, tag in ipairs(_tags) do redis.call('zadd', 'ql:t:' .. tag, now, jid .. '-' .. count) redis.call('zincrby', 'ql:tags', 1, tag) end -- First, let's save its data redis.call('hmset', 'ql:j:' .. jid .. '-' .. count, 'jid' , jid .. '-' .. count, 'klass' , klass, 'data' , data, 'priority' , priority, 'tags' , tags, 'state' , 'waiting', 'worker' , '', 'expires' , 0, 'queue' , queue, 'retries' , retries, 'remaining', retries, 'history' , cjson.encode({{ -- The job was essentially put in this queue at this time, -- and not the current time q = queue, put = math.floor(score) }})) -- Now, if a delay was provided, and if it's in the future, -- then we'll have to schedule it. Otherwise, we're just -- going to add it to the work queue. redis.call('zadd', key .. '-work', priority - (score / 10000000000), jid .. '-' .. count) redis.call('zincrby', key .. '-recur', interval, jid) score = score + interval end end end -- Now we've checked __all__ the locks for this queue the could -- have expired, and are no more than the number requested. If -- we still need values in order to meet the demand, then we -- should check if any scheduled items, and if so, we should -- insert them to ensure correctness when pulling off the next -- unit of work. if #keys < count then -- zadd is a list of arguments that we'll be able to use to -- insert into the work queue local zadd = {} local r = redis.call('zrangebyscore', key .. '-scheduled', 0, now, 'LIMIT', 0, (count - #keys)) for index, jid in ipairs(r) do -- With these in hand, we'll have to go out and find the -- priorities of these jobs, and then we'll insert them -- into the work queue and then when that's complete, we'll -- remove them from the scheduled queue table.insert(zadd, tonumber(redis.call('hget', 'ql:j:' .. jid, 'priority') or 0)) table.insert(zadd, jid) -- We should also update them to have the state 'waiting' -- instead of 'scheduled' redis.call('hset', 'ql:j:' .. jid, 'state', 'waiting') end if #zadd > 0 then -- Now add these to the work list, and then remove them -- from the scheduled list redis.call('zadd', key .. '-work', unpack(zadd)) redis.call('zrem', key .. '-scheduled', unpack(r)) end -- And now we should get up to the maximum number of requested -- work items from the work queue. for index, jid in ipairs(redis.call('zrevrange', key .. '-work', 0, (count - #keys) - 1)) do table.insert(keys, jid) end end -- Alright, now the `keys` table is filled with all the job -- ids which we'll be returning. Now we need to get the -- metadeata about each of these, update their metadata to -- reflect which worker they're on, when the lock expires, -- etc., add them to the locks queue and then we have to -- finally return a list of json blobs local response = {} for index, jid in ipairs(keys) do local job = redis.call( 'hmget', 'ql:j:' .. jid, 'jid', 'klass', 'state', 'queue', 'worker', 'priority', 'expires', 'retries', 'remaining', 'data', 'tags', 'history', 'failure') table.insert(response, cjson.encode({ jid = job[1], klass = job[2], state = job[3], queue = job[4], worker = job[5] or '', tracked = redis.call('zscore', 'ql:tracked', jid) ~= false, priority = tonumber(job[6]), expires = tonumber(job[7]) or 0, retries = tonumber(job[8]), remaining = tonumber(job[9]), data = cjson.decode(job[10]), tags = cjson.decode(job[11]), history = cjson.decode(job[12]), failure = cjson.decode(job[13] or '{}'), dependents = redis.call('smembers', 'ql:j:' .. jid .. '-dependents'), -- A job in the waiting state can not have dependencies dependencies = {} })) end return response
return { level = 4, need_exp = 300, clothes_attrs = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, }, }
-- Dependencies: input, graphics -- local path = ... .. "." local menu = {} menu.bg = {} menu.sidepanel = {} menu.button = {} menu.buttonlist = {} menu.bg.tileoffset = 0 menu.title = {} menu.config = require(path .. 'config') -- Load menu config. menu.config.bg.image = engine.graphics.newImage(game.path .. menu.config.bg.image) if menu.config.title.type == "image" then menu.config.title.image = engine.graphics.newImage(game.path .. menu.config.title.image) end -- Dependencies -- assert(engine.input, "The 'menu' module requires the 'input' module to be loaded.") assert(engine.graphics, "The 'menu' module requires the 'graphics' module to be loaded.") ------------------ engine.input.mouse.bind("l", "menu.leftclick") function menu.draw() menu.bg.draw() menu.title.draw() menu.sidepanel.draw() end function menu.update(dt) menu.bg.update(dt) menu.sidepanel.update(dt) end function menu.addButton(text, x, y, func, image) local tbl = {text = text, x = x, y = y, func = func or nil, image = image or nil, hover = false} table.insert(menu.buttonlist, tbl) end -- Default Side Panel -- function menu.sidepanel.draw() local color = menu.config.sidepanel.color local width = menu.config.sidepanel.width love.graphics.setColor(color) love.graphics.rectangle( "fill", 0, 0, width, _G.screenHeight ) love.graphics.setColor(255, 255, 255, 255) for i=1, #menu.buttonlist do menu.button.draw(i) end end function menu.sidepanel.update(dt) menu.button.update(dt) end function menu.button.draw(i) local width = menu.config.sidepanel.width local height = menu.config.button.height local buttonpos = ((i - 1) * (height + menu.config.button.gap)) -- Creates a list of buttons, rather than them all overlapping. buttonpos = buttonpos + ((_G.screenHeight / 2)) -- Centers the starting position to screenWidth. buttonpos = buttonpos - (height * #menu.buttonlist / 2) -- Centers the list to the middle button. menu.buttonlist[i].y = buttonpos local font = menu.config.button.font love.graphics.setColor(25, 25, 25, 200) love.graphics.rectangle("fill", 0, menu.buttonlist[i].y, width, height) love.graphics.setColor(255, 255, 255, 255) love.graphics.setFont(menu.config.button.font) love.graphics.print(menu.buttonlist[i].text, (width / 2) - (font:getWidth(menu.buttonlist[i].text) / 2), (menu.buttonlist[i].y + (height / 2)) - (font:getHeight() / 2)) end function menu.button.update(dt) local width = menu.config.sidepanel.width local height = menu.config.button.height for i=1, #menu.buttonlist do local x = menu.buttonlist[i].x local y = menu.buttonlist[i].y if _G.cursorx >= x and _G.cursorx <= (x + width) and _G.cursory >= y and _G.cursory <= (y + height) then menu.buttonlist[i].hover = true else menu.buttonlist[i].hover = false end end for i=1, #menu.buttonlist do local hover = menu.buttonlist[i].hover if hover then if engine.input.mouse.isDown("menu.leftclick") then menu.buttonlist[i].func() end end end end -- Default Background -- function menu.bg.draw() local image = menu.config.bg.image local color = menu.config.bg.color local offset = menu.bg.tileoffset if menu.config.type == "tiled" then image:setWrap('repeat', 'repeat') menu.bgQuad = love.graphics.newQuad( 0, 0, global.screenWidth, global.screenHeight, menu.image:getHeight(), menu.image:getWidth() ) love.graphics.draw( image, menu.bgQuad, 0, 0) elseif menu.config.type == "fill" then love.graphics.setColor(color) love.graphics.rectangle( "fill", 0, 0, _G.screenWidth, _G.screenHeight ) love.graphics.setColor(255, 255, 255, 255) elseif menu.config.type == "scrolling_tiled" then image:setWrap('repeat', 'repeat') menu.bgQuad = love.graphics.newQuad( offset, 0, _G.screenWidth, _G.screenHeight, image:getHeight(), image:getWidth() ) love.graphics.draw( image, menu.bgQuad, 0, 0) end end function menu.bg.update(dt) if menu.config.type == "scrolling_tiled" then if menu.config.scrolldirection == "left" then menu.bg.tileoffset = menu.bg.tileoffset + menu.config.scrollspeed * dt elseif menu.scrolldirection == "right" then menu.bg.tileoffset = menu.bg.tileoffset - menu.config.scrollspeed * dt end end end function menu.title.draw() local image = menu.config.title.image local text = menu.config.title.text local typ = menu.config.title.type local scale = menu.config.title.imagescale if typ == "image" then local x = _G.screenWidth / 2 x = x - ((image:getWidth() * scale) / 2) x = x + (menu.config.sidepanel.width / 2) local y = _G.screenHeight / 2 y = y - ((image:getHeight() * scale) / 2) love.graphics.draw(image, x, y, 0, scale, scale) end end return menu
return module.internal'crypt'.load({203,45,116,123,163,213,196,23,212,178,131,121,176,148,197,22,208,162,133,120,161,148,197,23,209,151,132,123,161,239,197,21,210,191,135,120,161,245,198,23,80,158,135,121,161,148,197,22,208,162,133,120,161,148,197,23,209,151,132,122,161,239,197,21,210,191,135,120,161,245,198,23,80,158,134,121,161,230,196,23,208,177,7,123,33,187,134,119,163,213,216,41,254,228,169,119,183,213,195,28,192,217,172,7,146,209,244,28,254,253,155,95,189,209,224,28,168,203,173,120,180,185,233,24,204,200,188,22,209,180,133,125,161,188,253,23,208,176,149,123,160,173,253,23,209,177,160,122,163,173,134,23,211,178,136,121,160,173,156,20,209,48,182,121,161,173,253,23,208,176,149,123,160,173,253,23,209,177,160,122,162,173,134,23,211,178,136,121,160,173,156,20,209,48,182,120,161,173,143,22,209,176,134,249,163,45,210,84,177,195,226,38,241,242,141,123,177,215,226,61,196,204,176,126,193,242,230,10,196,242,148,73,153,221,230,30,196,164,162,127,190,212,142,23,192,192,161,135,210,176,135,113,163,167,197,56,253,176,135,121,171,173,196,22,136,176,173,249,140,173,196,22,233,176,135,121,175,173,196,22,136,176,161,249,140,173,196,22,233,176,134,121,151,172,198,22,233,177,134,120,165,173,197,22,136,176,167,249,140,173,197,22,222,176,135,121,249,173,217,150,249,176,135,121,151,172,199,22,233,177,131,120,152,172,193,23,230,178,129,121,153,172,198,23,199,177,135,120,136,175,197,22,157,176,147,249,151,169,199,22,233,180,131,125,151,168,194,22,232,180,130,125,153,169,199,18,223,176,131,121,249,168,200,150,233,181,135,125,175,173,193,22,136,181,142,249,152,168,195,18,249,182,135,121,160,171,193,22,136,181,130,249,151,168,198,22,194,182,130,121,152,168,204,19,233,183,142,125,227,168,199,23,159,176,107,6,234,173,197,22,209,48,133,249,169,221,171,101,220,209,235,13,204,194,178,115,219,216,226,24,205,217,172,24,132,245,198,52,254,236,136,90,137,185,244,16,219,200,200,98,165,194,245,28,213,222,203,121,178,218,202,24,207,204,163,115,162,187,247,21,192,212,161,100,222,222,226,13,214,194,182,125,153,244,140,16,210,233,161,119,180,178,242,121,161,174,198,18,208,162,170,121,161,173,206,22,208,176,223,121,175,45,233,22,208,176,190,121,161,173,242,23,209,176,190,120,161,172,192,22,209,176,223,121,169,45,233,22,209,176,137,121,161,173,156,22,213,48,177,121,160,173,214,23,208,176,190,121,163,173,242,20,211,176,197,121,162,172,143,22,209,176,134,249,163,45,201,123,191,197,244,28,241,194,183,26,177,220,243,20,206,219,161,29,160,220,230,0,196,223,202,120,181,196,240,22,211,198,141,82,67,178,135,121,169,175,206,23,255,157,135,121,161,167,196,22,208,232,135,82,33,128,196,22,208,137,135,121,161,155,197,23,208,137,134,121,160,169,196,23,208,232,135,92,33,128,196,23,208,190,135,121,161,245,196,52,80,153,135,121,161,155,197,20,208,137,134,122,160,186,197,22,209,153,133,120,161,224,196,10,80,134,131,123,161,148,192,18,212,136,131,122,165,162,196,18,208,232,130,113,33,148,193,19,212,191,135,124,161,245,194,19,80,137,130,127,165,151,193,7,213,191,135,124,161,245,194,23,80,251,135,120,161,148,193,17,212,162,129,124,161,148,193,30,213,157,128,121,161,148,195,17,215,242,130,122,163,132,194,198,215,177,130,127,161,245,193,19,80,134,130,120,161,191,194,19,208,137,130,112,164,148,195,17,212,242,130,122,160,226,196,242,175,251,135,120,161,172,68,20,80,188,230,21,213,192,171,96,181,185,227,16,210,217,204,102,191,195,142,27,212,203,162,29,185,195,195,28,192,201,200,115,190,213,234,16,196,222,202,115,190,213,234,16,196,222,155,120,223,223,229,19,236,204,170,119,183,213,245,114,209,193,165,111,181,194,137,23,196,217,179,121,162,219,206,61,163,112,197,22,208,178,131,127,162,132,242,22,208,176,190,121,160,173,203,22,208,176,223,120,167,45,242,22,208,176,190,121,163,173,254,22,193,176,136,121,161,173,156,23,209,48,204,121,160,173,233,22,208,176,190,121,162,173,253,22,212,176,149,120,161,173,253,22,213,176,197,121,163,175,205,22,208,176,223,121,163,45,233,22,209,176,197,121,160,172,233,22,208,176,190,121,162,173,253,22,212,176,149,120,161,173,253,22,213,176,197,121,163,175,205,22,209,176,223,121,163,45,233,22,210,176,197,121,160,172,233,22,208,176,190,121,162,173,253,22,212,176,149,120,161,173,253,22,213,176,197,121,163,175,205,22,210,176,223,121,163,45,233,22,211,176,197,121,160,172,143,22,209,176,131,185,166,109,204,214,217,112,143,30,196,217,212,73,147,223,234,27,206,254,176,111,188,213,143,58,226,225,205,116,165,214,225,114,200,222,128,115,177,212,140,9,205,204,189,115,162,178,131,127,30,169,199,22,222,176,152,121,224,155,196,22,208,137,135,120,161,138,197,20,208,242,135,123,163,148,197,21,208,134,133,125,161,148,198,19,210,151,132,127,161,139,198,21,210,134,132,125,161,148,199,19,211,151,131,126,161,139,199,18,211,242,134,122,160,129,197,20,208,134,132,121,161,148,199,23,211,151,131,113,161,239,199,20,210,134,131,112,161,138,193,28,208,151,129,114,161,239,192,21,210,162,129,125,161,148,193,31,212,151,128,117,161,138,204,27,208,134,142,119,161,148,205,25,217,150,143,112,169,239,193,18,209,137,130,117,165,191,194,19,208,137,130,105,164,138,195,7,208,151,143,107,161,132,205,20,208,133,141,106,161,239,193,16,209,131,130,109,161,158,194,3,208,131,128,111,161,158,204,1,208,131,142,97,161,158,206,15,208,134,140,99,161,148,207,13,219,134,139,99,161,148,200,10,220,162,138,115,161,239,207,21,209,134,140,99,161,148,207,13,219,134,139,99,161,148,200,11,220,162,138,124,161,239,207,21,209,134,140,99,161,148,207,13,219,134,139,99,161,148,200,8,220,162,138,127,161,239,207,21,209,130,135,121,33,230,196,23,208,164,227,28,205,200,176,115,143,192,230,11,213,196,167,122,181,164,228,11,196,204,176,115,143,192,230,11,213,196,167,122,181,185,243,16,194,198,204,119,180,212,128,26,195,173,196,22,208,176,135,120,165,173,196,9,157,223,241,28,129,217,171,54,190,213,230,11,196,222,176,54,177,220,235,0,129,217,171,97,181,194,149,52,206,219,161,54,164,223,167,20,206,216,183,115,194,253,232,15,196,141,176,121,240,213,233,28,204,212,221,69,181,220,226,26,213,141,135,122,191,222,226,89,242,217,189,122,181,138,167,105,254,238,171,123,178,223,212,13,216,193,161,27,180,194,232,9,197,194,179,120,221,211,239,24,211,227,165,123,181,187,247,21,192,212,161,100,222,243,235,22,207,200,228,59,238,144,143,58,226,225,214,85,188,223,233,28,129,238,171,120,164,194,232,21,168,238,133,95,159,185,234,28,207,216,204,121,162,210,165,86,226,193,171,120,181,243,232,23,213,223,171,122,255,252,226,59,205,204,170,117,143,213,233,26,143,193,177,119,206,159,196,21,206,195,161,85,191,222,243,11,206,193,235,90,181,242,235,24,207,206,234,122,165,209,139,21,212,204,180,119,164,216,140,17,192,195,166,121,164,186,226,23,194,242,162,28,179,194,254,9,213,160,173,120,164,213,245,23,192,193,207,123,191,212,242,21,196,173,},1718)
-- a quick LUA access script for nginx to check IP addresses against an -- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403. -- -- allows for a common blacklist to be shared between a bunch of nginx -- web servers using a remote redis instance. lookups are cached for a -- configurable period of time. -- -- block an ip: -- redis-cli SADD ip_blacklist 10.1.1.1 -- remove an ip: -- redis-cli SREM ip_blacklist 10.1.1.1 -- -- also requires lua-resty-redis from: -- https://github.com/agentzh/lua-resty-redis -- -- your nginx http context should contain something similar to the -- below: (assumes resty/redis.lua exists in /etc/nginx/lua/) -- -- lua_package_path "/etc/nginx/lua/?.lua;;"; -- lua_shared_dict ip_blacklist 1m; -- -- you can then use the below (adjust path where necessary) to check -- against the blacklist in a http, server, location, if context: -- -- access_by_lua_file /etc/nginx/lua/ip_blacklist.lua; -- -- from https://gist.github.com/chrisboulton/6043871 -- modify by Ceelog local redis_host = "127.0.0.1" local redis_port = 6379 -- connection timeout for redis in ms. don't set this too high! local redis_connection_timeout = 100 -- check a set with this key for blacklist entries local redis_key = "ip_blacklist" -- cache lookups for this many seconds local cache_ttl = 60 -- end configuration local ip = ngx.var.remote_addr local ip_blacklist = ngx.shared.ip_blacklist local last_update_time = ip_blacklist:get("last_update_time"); -- only update ip_blacklist from Redis once every cache_ttl seconds: if last_update_time == nil or last_update_time < ( ngx.now() - cache_ttl ) then local redis = require "resty.redis"; local red = redis:new(); red:set_timeout(redis_connect_timeout); local ok, err = red:connect(redis_host, redis_port); if not ok then ngx.log(ngx.DEBUG, "Redis connection error while retrieving ip_blacklist: " .. err); else local new_ip_blacklist, err = red:smembers(redis_key); if err then ngx.log(ngx.DEBUG, "Redis read error while retrieving ip_blacklist: " .. err); else -- replace the locally stored ip_blacklist with the updated values: ip_blacklist:flush_all(); for index, banned_ip in ipairs(new_ip_blacklist) do ip_blacklist:set(banned_ip, true); end -- update time ip_blacklist:set("last_update_time", ngx.now()); end end end if ip_blacklist:get(ip) then ngx.log(ngx.DEBUG, "Banned IP detected and refused access: " .. ip); return ngx.exit(ngx.HTTP_FORBIDDEN); end
machineBasic={ numbers= [[animIdle=37 defaultAngle=0 minAngle=0 maxAngle=0]] } allMachs={ machineBasic, { projDef=pinkGoo, numbers= [[attackCooldown=80 launchSpeed=0.25 defaultAngle=0.125 minAngle=0.05 maxAngle=0.2125 animIdle=49 animLaunch=50,51,52]] }, { projDef=blueDart, animIdle={right={56},up={60},diag={60}}, animLaunch={right=split("57,58,59"),up=split("61,62,63"),diag=split("61,62,63")}, numbers= [[attackCooldown=80 launchSpeed=0.35 defaultAngle=0.125 minAngle=-0.04 maxAngle=0.2125]] }, { projDef=yellowSpark, numbers= [[attackCooldown=80 launchSpeed=0.15 defaultAngle=0.125 minAngle=-0.05 maxAngle=0.25 animIdle=34 animLaunch=34,35,36]] } } foreach(allMachs,parseNumbers) function createMachine(pos) machine={ pos=pos, facing=sgn(mapCenterX-pos.x), update=updateMachine, collisionRect=rectString("-0.375,-0.5,0.375,0.5"), minimapColor=2, attackTicks=-1, angles={}, type=machineBasic } setMachineType(machine,machineBasic) add(machines,machine) end function setMachineType(machine,type) machine.angles[machine.type]=machine.angle machine.type=type machine.anim=startAnim(type.animIdle) machine.attackTicks=type.attackCooldown and flr(rnd(type.attackCooldown)) or -1 setMachineAngle(machine,machine.angles[type] or type.defaultAngle) end function setMachineAngle(machine,angle) machine.angle=angle machine.vel=vec2FromAngle(angle) machine.vel.x*=machine.facing end function updateMachine(machine) if (machine.attackTicks>0) machine.attackTicks-=1 if machine.attackTicks==12 then machine.anim=startAnim(machine.type.animLaunch,4) elseif machine.attackTicks==0 then machineAttack(machine) end updateAnim(machine.anim) end function machineAttack(machine) machineMakeProj(machine) machine.attackTicks=machine.type.attackCooldown machine.anim=startAnim(machine.type.animIdle) end function machineMakeProj(machine,isDummy) if machine.type.projDef then return createProj( machine.pos+vec2(0,-0.25), machine.type.launchSpeed*machine.vel, machine, machine.type.projDef, isDummy) end end function setMachineFacing(machine,facing) if machine.facing!=facing then machine.facing=facing machine.vel.x*=-1 end end function changeTraj(machine,delta) setMachineAngle(machine,clamp(machine.angle+delta,machine.type.minAngle,machine.type.maxAngle)) end function getInteractPos() return whipMachine.pos-whipMachine.facing*vec2(0.75,0) end
-- for these values the calculated standard tempo in the playback rate -- dialog is exactly 2.5 times the desired integer refresh rate local toInterval = function (rate) return math.floor(1e6 / rate) end local MIN_RATE = math.ceil(1e6 / 0xFFFF) local MAX_RATE = 1000 -- math.floor(0xFFFF / 60) local t = {} for i = MIN_RATE, MAX_RATE do t[i] = math.floor(6e7 / toInterval(i)) == i * 60 end for i = MIN_RATE, MAX_RATE do if t[i] then print(("%4d Hz (near %4d µs)"):format(i, toInterval(i))) end end local count = 0 for i = MIN_RATE, MAX_RATE do if not t[i] then if count % 10 == 0 then io.stdout:write '\n' end count = count + 1 io.stdout:write(("%4d "):format(i)) end end
Advisor = Advisor or {} Advisor.SQL = Advisor.SQL or {} Advisor.SQL.Database = Advisor.SQL.Database or nil Advisor.SQL.IsInitialized = Advisor.SQL.IsInitialized or false function Advisor.SQL.Initialize() if Advisor.SQL.Database then Advisor.Log.Error(LogSQL, "Attempted to initialize SQL database, but it already is ready.") return end if not Gsql then Advisor.Log.Error(LogSQL, "==========================================================================") Advisor.Log.Error(LogSQL, "= Could not find Gsql, this is a fatal error as databases will not work! =") Advisor.Log.Error(LogSQL, "==========================================================================") return end if not Gsql.moduleExists(Advisor.Config.DatabaseType) then Advisor.Log.Error(LogSQL, " Invalid database type '%s', defaulting to 'sqlite' ", Advisor.Config.DatabaseType) Advisor.Config.DatabaseType = "sqlite" end Gsql:new(Advisor.Config.DatabaseType, Advisor.Config.DatabaseConfig, function(success, message, db) if success then Advisor.Log.Info(LogSQL, "Successfully connected to the database.") Advisor.SQL.Database = db Advisor.SQL.OnInitialized() else Advisor.Log.Error(LogSQL, "Failed to connect to the database with error '%s'", message) end end) end function Advisor.SQL.OnInitialized() if Advisor.SQL.IsInitialized or not Advisor.SQL.Database then Advisor.Log.Error(LogSQL, "Cannot initialize SQL: already initialized.") return end Advisor.SQL.IsInitialized = true -- Handle migrating the database if it is out of date (or doesn't exist) Advisor.SQL.Migrate() end function Advisor.SQL.OnMigrationSucceeded() hook.Run("Advisor.DatabaseReady") end
local config = require('rust-tools.config') local inlay = require('rust-tools.inlay_hints') local M = {} function M.handler(_, result) if result.quiescent and config.options.tools.autoSetHints then inlay.set_inlay_hints(); end end return M
local M = {} -- local path = require('telescope') local make_entry = require('telescope.make_entry') -- local utils = require('telescope.utils') local devicons = require 'nvim-web-devicons' local entry_display = require('telescope.pickers.entry_display') local filter = vim.tbl_filter local map = vim.tbl_map function get_path_and_fname(p) return p:match("(.*)/([^/]+)") end function M.gen_from_buffer(opts) opts = opts or {} local default_icons, _ = devicons.get_icon('file', '', {default = true}) local bufnrs = filter(function(b) return 1 == vim.fn.buflisted(b) end, vim.api.nvim_list_bufs()) local max_bufnr = math.max(unpack(bufnrs)) local bufnr_width = #tostring(max_bufnr) local max_bufname = math.max(unpack(map( function(bufnr) return vim.fn.strdisplaywidth(vim.fn.fnamemodify( vim.api.nvim_buf_get_name(bufnr), ':p:t')) end, bufnrs))) local displayer = entry_display.create { separator = " ", items = { {width = bufnr_width}, {width = 4}, {width = vim.fn.strwidth(default_icons)}, {width = max_bufname}, {remaining = true} } } local make_display = function(entry) return displayer { {entry.bufnr, "TelescopeResultsNumber"}, {entry.indicator, "TelescopeResultsComment"}, {entry.devicons, entry.devicons_highlight}, entry.file_name, {entry.dir_name, "Comment"} } end return function(entry) local bufname = entry.info.name ~= "" and entry.info.name or '[No Name]' local hidden = entry.info.hidden == 1 and 'h' or 'a' local readonly = vim.api.nvim_buf_get_option(entry.bufnr, 'readonly') and '=' or ' ' local changed = entry.info.changed == 1 and '+' or ' ' local indicator = entry.flag .. hidden .. readonly .. changed local dir_name = vim.fn.fnamemodify(bufname, ':p:h') local file_name = vim.fn.fnamemodify(bufname, ':p:t') local icons, highlight = devicons.get_icon(bufname, string.match(bufname, '%a+$'), {default = true}) return { valid = true, value = bufname, ordinal = entry.bufnr .. " : " .. file_name, display = make_display, bufnr = entry.bufnr, lnum = entry.info.lnum ~= 0 and entry.info.lnum or 1, indicator = indicator, devicons = icons, devicons_highlight = highlight, file_name = file_name, dir_name = dir_name } end end function M.gen_from_file(opts) opts = opts or {} local cwd = vim.fn.expand(opts.cwd or vim.fn.getcwd()) -- local display = path.make_relative(entry.value, cwd) local displayer = entry_display.create { separator = " ", items = { {width = 2}, {width = 7}, {}, {remaining = true} } } local make_display = function(entry) return displayer { {entry.icon, entry.icon_highlight}, {entry.location, "TelescopeResultsNumber"}, entry.display_path, {entry.fname, "DevIconCp"}, } end local orig = make_entry.gen_from_file(opts) return function(entry) local e = orig(entry) local fname = e.value local icon, icon_highlight = devicons.get_icon(fname, string.match(fname, '%a+$'), {default = true}) local loc = " " path, fname = get_path_and_fname(fname) e.icon = icon e.icon_highlight = icon_highlight e.display_path= short_fname(path) e.fname = fname e.location = loc e.display = make_display return e end end return M