content
stringlengths
5
1.05M
return { native_macos_fullscreen_mode = false, font_size = 16, keys = { { key = "f", mods = "CTRL|SUPER", action = "ToggleFullScreen" }, } }
ReconnectDialog = { OnInit = function() ReconnectDialog_beh:SubscribeForMessages(StrId("BUTTON_CLICKED")) ReconnectDialog_beh:SubscribeForMessages(StrId("NET_CONNECTED")) end, OnMessage = function(msg) if(msg:HasAction(StrId("BUTTON_CLICKED"))) then if(msg.contextNode.tag == "disconnect_but") then CogSwitchBackToScene("none") CogSwitchBackToScene("none") end end if(msg:HasAction(StrId("NET_CONNECTED"))) then CogSwitchBackToScene("none") end end, Update = function(delta, absolute) end } ReconnectDialog_beh = Behavior() ReconnectDialog_beh:Register(ReconnectDialog, "ReconnectDialog")
local isInventoryVisible = false local screenSize = Vector2(guiGetScreenSize()) local IconTextures = {} local inventoryHeight = 800 local borderSpace = 150 local listSpace = 2 local listItemWidth = 215 local listItemHeight = 60 local slotSpace = 15 local weaponSlotSize = (listItemHeight + slotSpace) * 3 - slotSpace local equipSlotSize = math.floor(weaponSlotSize / 2 - slotSpace / 2) local capacityBarWidth = 15 local capacityBarHeight = weaponSlotSize * 2 + slotSpace local capacityBarTexture local isMouseReleased = false local isMousePressed = false local isRightMousePressed = false local prevRightMouseState = false local prevMouseState = false local mouseX, mouseY = 0, 0 local isDragging, dragType, dragItem, dragSlot local dragItemSize = 45 local weightErrorTimer local currentBarWeight = 0 local separateWindowWidth = 350 local separateWindowHeight = 200 local isSeparateWindowVisible = false local separateItem local separateCount = 0 local colors = { border = tocolor(255, 255, 255), item = tocolor(255, 255, 255, 38), item_icon = tocolor(255, 255, 255, 39), selection = tocolor(255, 255, 255, 20), } local itemLists = {} function localize(name) local res = getResourceFromName("pb_lang") if (res) and (getResourceState(res) == "running") then return exports.pb_lang:localize(name) else return name end end function isMouseOver(x, y, w, h) return mouseX >= x and mouseX <= x + w and mouseY >= y and mouseY <= y + h end function showSeparateWindow(item) if isSeparateWindowVisible then return end isSeparateWindowVisible = true separateItem = item separateCount = math.floor(item.count / 2) end function hideSeparateWindow(drop) if not isSeparateWindowVisible then return end if drop then local count = math.max(1, math.min(separateItem.count, separateCount)) triggerServerEvent("dropBackpackItem", resourceRoot, separateItem.name, count) end isSeparateWindowVisible = false separateItem = nil separateCount = nil end function startDragging(slotType, item, slotName) if isDragging then return end if isSeparateWindowVisible then stopDragging() return end isDragging = true dragType = slotType dragSlot = slotName dragItem = item setCursorAlpha(0) end local function showWeightError() if isTimer(weightErrorTimer) then killTimer(weightErrorTimer) end weightErrorTimer = setTimer(function () end, 2000, 1) end function tryPickupLootItem(item) if not isItem(item) then return end if getBackpackTotalWeight() + getItemWeight(item) > getBackpackCapacity() then showWeightError() end playItemSound(item) triggerServerEvent("pickupLootItem", resourceRoot, item.lootElement, nil, item.name) end function stopDragging(slotType, slot) if not isDragging then return end -- slotType - куда -- dragType - откуда if slotType == "weapon" then if dragType == "loot" then triggerServerEvent("pickupLootItem", resourceRoot, dragItem.lootElement, slot, dragItem.name) elseif dragType == "weapon" then if string.find(dragSlot, "primary") and string.find(slot, "primary") and dragSlot ~= slot then triggerServerEvent("switchPrimaryWeapons", resourceRoot) end elseif dragType == "backpack" then triggerServerEvent("putBackpackItemToWeapon", resourceRoot, dragItem.name, slot) end elseif slotType == "backpack" then if dragType == "loot" then tryPickupLootItem(dragItem) elseif dragType == "weapon" then triggerServerEvent("putWeaponToBackpack", resourceRoot, dragSlot) end elseif slotType == "equipment" then if dragType == "loot" then triggerServerEvent("pickupLootItem", resourceRoot, dragItem.lootElement, dragItem.name) end elseif slotType == "loot" then if dragType == "weapon" then saveActiveWeaponClip() triggerServerEvent("dropPlayerWeapon", resourceRoot, dragSlot) elseif dragType == "backpack" then if getKeyState("lctrl") then showSeparateWindow(dragItem) else triggerServerEvent("dropBackpackItem", resourceRoot, dragItem.name) end elseif dragType == "equipment" then if dragSlot == "backpack" and Config.defaultBackpackCapacity < getBackpackTotalWeight() then showWeightError() return end triggerServerEvent("dropPlayerEquipment", resourceRoot, dragSlot) end end isDragging = false dragType = nil dragItem = nil dragSlot = nil setCursorAlpha(255) end local function drawDragItem() if not isDragging or not dragItem then return end local size = dragItemSize local x, y = mouseX - size / 2, mouseY - size / 2 local item = dragItem if getKeyState("lctrl") then local offset = 6 dxDrawRectangle(x - 1 + offset, y - 1 + offset, size + 2 , size + 2, colors.item) dxDrawRectangle(x + offset, y + offset, size, size, tocolor(0, 0, 0, 220)) end dxDrawRectangle(x - 1, y - 1, size + 2 , size + 2, colors.item) dxDrawRectangle(x, y, size, size, tocolor(0, 0, 0, 220)) if IconTextures[item.name] then dxDrawImage(x, y, size, size, IconTextures[item.name]) end end function createItemsList(title, dragType) return { title = title, dragType = dragType, scroll = 0, x = 0, y = 0, width = listItemWidth, height = inventoryHeight, page = math.floor(inventoryHeight / (listItemHeight + listSpace) - listSpace) + 1 } end function drawItemsList(list, items, x, y) local title = localize(list.title) local dragType = list.dragType local width = list.width local height = list.height list.x = x list.y = y list.scroll = math.min(math.max(0, #items - list.page), list.scroll) local cy = y if title then dxDrawText(title, x + 5, y - 25, x + 5, y - 5, tocolor(255, 255, 255, 200), 1, "default", "left", "bottom") end local itemIconSize = listItemHeight for i = 1 + list.scroll, 1 + list.scroll + list.page do local item = items[i] if item and item ~= dragItem then dxDrawRectangle(x, cy, listItemWidth, listItemHeight, colors.item) dxDrawRectangle(x, cy, itemIconSize, itemIconSize, colors.item_icon) if IconTextures[item.name] then dxDrawImage(x, cy, itemIconSize, itemIconSize, IconTextures[item.name]) end if Items[item.name].readableName then local offset = 25 if item.count and item.count >= 100 then offset = 35 end dxDrawText(localize(Items[item.name].readableName), x + itemIconSize + 5, cy, x + listItemWidth - offset, cy + listItemHeight, tocolor(255, 255, 255, 200), 1, "default", "left", "center", true) end if item.count and item.count > 1 then dxDrawText(item.count, x, cy, x + listItemWidth - 10, cy + listItemHeight, tocolor(255, 255, 255, 200), 1, "default-bold", "right", "center") end -- Прогресс использования if list.dragType == "backpack" and getUsingItemName() == item.name then dxDrawRectangle(x, cy, listItemWidth * getUsingProgress(), listItemHeight, tocolor(0, 0, 0, 150)) end if isMouseOver(x, cy, listItemWidth, listItemHeight) then dxDrawRectangle(x, cy, listItemWidth, listItemHeight, colors.selection) if isMousePressed then startDragging(dragType, item) elseif isRightMousePressed then if list.dragType == "loot" then tryPickupLootItem(item) elseif list.dragType == "backpack" then useItem(item) end end end end cy = cy + listItemHeight + listSpace end if isMouseOver(x, y, width, height) then if isMouseReleased and isDragging then stopDragging(dragType) end end end local function drawWeaponSlot(slot, x, y, size, hotkey) if isMouseOver(x, y, size, size) then if isMouseReleased and isDragging then stopDragging("weapon", slot) end end dxDrawRectangle(x - 1, y - 1, size + 2 , size + 2, colors.item) dxDrawRectangle(x, y, size, size, tocolor(0, 0, 0, 220)) local item = getWeaponSlot(slot) if not item or item == dragItem then return end if IconTextures[item.name] then dxDrawImage(x, y, size, size, IconTextures[item.name]) end local nameX = 10 if hotkey then local rx = x local ry = y local rs = 30 nameX = nameX + 30 dxDrawRectangle(rx - 1, ry - 1, rs + 2, rs + 2) dxDrawRectangle(rx, ry, rs, rs, tocolor(0, 0, 0, 255)) dxDrawText(hotkey, rx, ry, rx + rs, ry + rs, tocolor(255, 255, 255, 255), 1.5, "default-bold", "center", "center") end if Items[item.name].readableName then dxDrawText(localize(Items[item.name].readableName), x + nameX, y, x + size - 3, y + 30, tocolor(255, 255, 255, 200), 1.5, "default-bold", "left", "center", true) end local ammoText = "" local ammoName = "" local clip, ammo = getWeaponAmmo(item) if slot ~= "melee" and clip and ammo then ammoText = clip .. " / " .. ammo ammoName = localize(Items[Items[item.name].ammo].readableName) end if slot == "grenade" and clip then ammoText = clip end dxDrawText(ammoText, x + 5, y, x + size, y + size - 5, tocolor(255, 255, 255, 200), 1, "default-bold", "left", "bottom", false) dxDrawText(ammoName, x + size / 2, y, x + size - 5, y + size - 5, tocolor(255, 255, 255, 100), 1, "default", "right", "bottom", false) if isMouseOver(x, y, size, size) then dxDrawRectangle(x, y, size, size, colors.selection) if isMousePressed then startDragging("weapon", item, slot) elseif isRightMousePressed then saveActiveWeaponClip() triggerServerEvent("dropPlayerWeapon", resourceRoot, slot) end end end local function drawEquipmentSlot(slot, x, y, size) if isMouseOver(x, y, size, size) then if isMouseReleased and isDragging then stopDragging("equipment", slot) end end dxDrawRectangle(x - 1, y - 1, size + 2 , size + 2, colors.item) dxDrawRectangle(x, y, size, size, tocolor(0, 0, 0, 220)) local item = getEquipmentSlot(slot) if not item or item == dragItem then return end if IconTextures[item.name] then dxDrawImage(x, y, size, size, IconTextures[item.name]) end local itemClass = Items[item.name] if itemClass and itemClass.vars and itemClass.vars.health and item.health < itemClass.vars.health then local mul = (1 - item.health / itemClass.vars.health) local h = size * mul dxDrawRectangle(x, y + size - h, size, h, tocolor(255, 0, 0, 80)) end if isMouseOver(x, y, size, size) then dxDrawRectangle(x, y, size, size, colors.selection) if isMousePressed then startDragging("equipment", item, slot) end end end local function drawBackpackCapacity(x, y, width, height) local totalWeight, capacity = getBackpackTotalWeight(), getBackpackCapacity() currentBarWeight = currentBarWeight + (totalWeight - currentBarWeight) * 0.1 dxDrawRectangle(x - 1, y - 1, width + 2 , height + 2, colors.item) dxDrawRectangle(x, y, width, height, tocolor(0, 0, 0, 220)) local mul = currentBarWeight / capacity--(math.sin(getTickCount()*0.001) + 1) / 2 dxDrawImageSection(x, y + height * (1-mul), width, height * mul, 0, 128-128*mul, 1, 128*mul, capacityBarTexture) if isMouseOver(x, y, width, height) and not isDragging then local str = localize("inventory_backpack_weight") .. ": " .. tostring(totalWeight) .. "/" .. tostring(capacity) local width = dxGetTextWidth(str) + 10 local height = 20 local x = mouseX - 5 local y = mouseY - 25 dxDrawRectangle(x - 1, y - 1, width + 2 , height + 2, colors.item) dxDrawRectangle(x, y, width, height, tocolor(0, 0, 0, 220)) dxDrawText(str, mouseX, mouseY - 23) end end local function drawWeightError() local str = localize("inventory_no_space") dxDrawText(str, 2, screenSize.y*0.5 + 2, screenSize.x + 2, screenSize.y + 2, tocolor(0, 0, 0, 200), 2.5, "default-bold", "center", "center") dxDrawText(str, 0, screenSize.y*0.5, screenSize.x, screenSize.y, tocolor(255, 255, 255, 200), 2.5, "default-bold", "center", "center") end local function drawButton(text, x, y, width, height, bg, color, scale) if not bg then bg = tocolor(250, 250, 250) end if not color then color = tocolor(0, 0, 0, 200) end if not scale then scale = 1.5 end dxDrawRectangle(x, y, width, height, bg) dxDrawRectangle(x, y + height - 5, width, 5, tocolor(0, 0, 0, 10)) dxDrawText(text, x, y, x + width, y + height, color, scale, "default-bold", "center", "center") if isMouseOver(x, y, width, height) then dxDrawRectangle(x, y, width, height, tocolor(0, 0, 0, 100)) if isMousePressed then return true end end return false end local function drawSeparateWindow(x, y, width, height) if not separateItem then hideSeparateWindow() return end dxDrawRectangle(x-1, y-1, width+2, height+2, tocolor(255, 255, 255, 50)) dxDrawRectangle(x, y, width, height, tocolor(0, 0, 0, 255)) dxDrawText(localize("invetory_split_enter_amount")..": #FFFFFF" .. localize(tostring(Items[separateItem.name].readableName)), x + 10, y, x + width, y + height * 0.4, tocolor(120, 120, 120), 1.2, "default-bold", "left", "center", true, false, false, true) local bw = (width - 25) / 2 local bh = 50 local bx = x + 10 local by = y + height - bh - 10 if drawButton(localize("invetory_split_drop"), bx, by, bw, bh) then hideSeparateWindow(true) return end bx = bx + bw + 5 if drawButton(localize("invetory_split_cancel"), bx, by, bw, bh) then hideSeparateWindow() return end bx = x + 10 bw = width - 20 by = by - bh - 10 dxDrawRectangle(bx, by, bw, bh, tocolor(0, 0, 0)) if drawButton("Min\n1", bx, by, bh, bh, tocolor(88, 88, 88), tocolor(255, 255, 255, 200), 1) then separateCount = 1 end if drawButton("Max\n"..tostring(separateItem.count), bx + bw -bh, by, bh, bh, tocolor(88, 88, 88), tocolor(255, 255, 255, 200), 1) then separateCount = separateItem.count end dxDrawText(tostring(separateCount), bx, by, bx + bw, by + bh, tocolor(255, 255, 255), 1.8, "default-bold", "center", "center") end function drawActionMessage(text) local x = screenSize.x * 0.62 local y = screenSize.y * 0.55 local width = dxGetTextWidth(text, 1.5, "default") + 20 local height = 30 dxDrawRectangle(x-1, y-1, height+2, height+2, tocolor(255, 255, 255, 38)) dxDrawRectangle(x, y, height, height, tocolor(0, 0, 0, 220)) dxDrawText("F", x, y, x+height,y+height, tocolor(255, 255, 255, 255), 1.5, "default-bold", "center", "center") x = x + height + 5 dxDrawRectangle(x, y, width, height, tocolor(0, 0, 0, 100)) dxDrawText(text, x+2, y+2, x+width+2,y+height+2, tocolor(0, 0, 0, 255), 1.5, "default", "center", "center") dxDrawText(text, x, y, x+width,y+height, tocolor(255, 255, 255, 255), 1.5, "default", "center", "center") end addEventHandler("onClientRender", root, function () if not isInventoryVisible then return end local currentMouseState = getKeyState("mouse1") if not prevMouseState and currentMouseState then isMousePressed = true else isMousePressed = false end if isMTAWindowActive() then isMousePressed = false end if prevMouseState and not currentMouseState then isMouseReleased = true else isMouseReleased = false end prevMouseState = currentMouseState if getKeyState("mouse2") and not prevRightMouseState then isRightMousePressed = true else isRightMousePressed = false end prevRightMouseState = getKeyState("mouse2") local mx, my = getCursorPosition() if mx then mx = mx * screenSize.x my = my * screenSize.y else mx, my = 0, 0 end mouseX, mouseY = mx, my local x = borderSpace local y = screenSize.y / 2 - inventoryHeight / 2 dxDrawRectangle(0, 0, screenSize.x, screenSize.y, tocolor(0, 0, 0, 200)) -- Содержимое рюкзака и лут drawItemsList(itemLists.loot, getLootItems(), x, y) x = x + listItemWidth + 15 dxDrawLine(x, y, x, y + (itemLists.loot.page + 1) * (listItemHeight + listSpace) - listSpace, tocolor(255, 255, 255, 38)) x = x + 15 drawItemsList(itemLists.backpack, getBackpackItems(), x, y) -- Слоты оружия local x = screenSize.x - borderSpace - weaponSlotSize - slotSpace - weaponSlotSize dxDrawText(localize("inventory_section_weapons"), x + 5, y - 25, x + weaponSlotSize, y - 5, tocolor(255, 255, 255, 200), 1, "default", "left", "bottom") drawWeaponSlot("primary1", x, y, weaponSlotSize, "1") drawWeaponSlot("primary2", x + slotSpace + weaponSlotSize, y, weaponSlotSize, "2") drawWeaponSlot("secondary", x, y + slotSpace + weaponSlotSize, weaponSlotSize, "3") drawWeaponSlot("melee", x + slotSpace + weaponSlotSize, y + slotSpace + weaponSlotSize, weaponSlotSize, "4") drawWeaponSlot("grenade", x + slotSpace + weaponSlotSize, y + slotSpace * 2 + weaponSlotSize * 2, weaponSlotSize, "5") -- Слоты снаряжения x = x - slotSpace - equipSlotSize dxDrawText(localize("inventory_section_equipment"), x + 5, y - 25, x + equipSlotSize, y - 5, tocolor(255, 255, 255, 200), 1, "default", "left", "bottom") drawEquipmentSlot("helmet", x, y, equipSlotSize) drawEquipmentSlot("backpack", x, y + slotSpace + equipSlotSize, equipSlotSize) drawEquipmentSlot("armor", x, y + slotSpace * 2 + equipSlotSize * 2, equipSlotSize) drawEquipmentSlot("ghillie", x, y + slotSpace * 3 + equipSlotSize * 3, equipSlotSize) -- Заполненность рюкзака x = x - slotSpace - capacityBarWidth drawBackpackCapacity(x, y, capacityBarWidth, capacityBarHeight) -- Рюкзак переполнен if isTimer(weightErrorTimer) then drawWeightError() end if not getKeyState("mouse1") and isDragging then stopDragging() end drawDragItem() if isSeparateWindowVisible then dxDrawRectangle(0, 0, screenSize.x, screenSize.y, tocolor(0, 0, 0, 200)) drawSeparateWindow( screenSize.x/2 - separateWindowWidth/2, screenSize.y/2 - separateWindowHeight/2, separateWindowWidth, separateWindowHeight ) end end) addEventHandler("onClientResourceStart", resourceRoot, function () for name, item in pairs(Items) do local filename = item.icon or name .. ".png" local path = "assets/icons/"..filename if fileExists(path) then IconTextures[name] = dxCreateTexture(path) end end capacityBarTexture = dxCreateTexture("assets/bar.png", "argb", true, "clamp") inventoryHeight = math.min(inventoryHeight, screenSize.y - 100) if screenSize.x <= 1050 then local mul = (screenSize.x - 800) / (1050 - 800) local minScale = 0.6 local scale = minScale + mul * (1 - minScale) * 0.5 slotSpace = slotSpace * scale listItemWidth = listItemWidth * scale listItemHeight = listItemHeight * scale weaponSlotSize = weaponSlotSize * scale equipSlotSize = equipSlotSize * scale capacityBarWidth = capacityBarWidth * scale capacityBarHeight = capacityBarHeight * scale borderSpace = borderSpace * scale / 2 elseif screenSize.x < 1250 then borderSpace = 1 elseif screenSize.x < 1400 then borderSpace = 15 end itemLists.loot = createItemsList("inventory_section_loot", "loot") itemLists.backpack = createItemsList("inventory_section_backpack", "backpack") isInventoryVisible = false end) function showInventory(visible) isInventoryVisible = visible showCursor(visible ,false) if visible then triggerServerEvent("requireClientBackpack", resourceRoot) end end function isInventoryShowing() return isInventoryVisible end addEventHandler("onClientKey", root, function (key, down) if not down then return end local delta if key == "mouse_wheel_up" then delta = -1 elseif key == "mouse_wheel_down" then delta = 1 else return end if not isInventoryVisible then return end for name, list in pairs(itemLists) do if isMouseOver(list.x, list.y, list.width, list.height) then list.scroll = math.max(0, list.scroll + delta) end end end) if not isResourceRunning("pb_gameplay") then bindKey("tab", "down", function () if isResourceRunning("pb_gameplay") then return end showInventory(not isInventoryVisible) end) end addEventHandler("onClientKey", root, function (button, down) if not isSeparateWindowVisible or not down then return end if button == "backspace" then separateCount = tonumber(string.sub(tostring(separateCount), 1, -2)) or 0 end if tonumber(button) then separateCount = tonumber(tostring(separateCount) .. button) end cancelEvent() end) -- export function setVisible(visible) showInventory(not not visible) end function isVisible() return not not isInventoryVisible end
if CONSTANTS == nil then CONSTANTS = { MIN_PLAYERS = 2, COMEDY_SECONDS = 60, WAITING_FOR_NEXT_ROUND_SECONDS = 10, NOISE_DELAY_SECOND = 6, BOO_DISQUALIFICATION_RATIO = 0.8, MIN_ROUND_TIME = 10, SOUND_CHEERS = { "vo/npc/Barney/ba_laugh01.wav", "vo/npc/Barney/ba_laugh02.wav", "vo/npc/Barney/ba_laugh03.wav", "vo/npc/Barney/ba_laugh04.wav", "vo/ravenholm/madlaugh01.wav", "vo/ravenholm/madlaugh02.wav", "vo/ravenholm/madlaugh03.wav", "vo/ravenholm/madlaugh04.wav", "vo/Citadel/br_laugh01.wav", "vo/eli_lab/al_laugh02.wav", "vo/npc/male01/likethat.wav" }, SOUND_BOOS = { "vo/npc/male01/no01.wav", "vo/npc/male01/no02.wav", "vo/npc/male01/moan01.wav", "vo/npc/male01/moan02.wav", "vo/npc/male01/moan03.wav", "vo/npc/male01/moan04.wav", "vo/npc/male01/moan05.wav" }, POS_COMEDIAN = Vector( -70.559410, -132.616959, 10 ), COMEDIAN_BOX_Y = 0 } end
local AS = unpack(AddOnSkins) if not AS:CheckAddOn('Analyst') then return end function AS:Analyst() AS:SkinFrame(EconomyFrame) EconomyFrame:SetHeight(450) EconomyFrame:SetWidth(364) EconomyFrameTitleFrame:ClearAllPoints() EconomyFrameTitleFrame:SetPoint('TOP', EconomyFrame, 'TOP', 0, -5) AS:SkinCloseButton(EconomyFrameCloseButton) AS:SkinFrame(EconomyFrameTopStats) AS:SkinFrame(EconomyFrameLeftStats) AS:SkinFrame(EconomyFrameRightStats) AS:SkinDropDownBox(EconomyFramePeriodDropDown) AS:SkinDropDownBox(EconomyFrameLeftStatsReportDropDown) AS:SkinDropDownBox(EconomyFrameRightStatsReportDropDown) AS:SkinCheckBox(EconomyFrameAllCharacters) end AS:RegisterSkin('Analyst', AS.Analyst)
--[[ TTT -> Boot Entry (Shared) by Tassilo (https://github.com/TASSIA710) --]] -- Derive gamemode from base DeriveGamemode("base") -- Define base variable TTT = {} -- Define version TTT.VerData = { Major = 0, Minor = 0, Patch = 1, Build = 1, Head = "b1ae5c712b84483ccff46662d42c16795210558a", Branch = "master" } TTT.VerMM = TTT.VerData.Major .. "." .. TTT.VerData.Minor TTT.VerMMP = TTT.VerMM .. "." .. TTT.VerData.Patch TTT.VerMMPB = TTT.VerMMP .. ", build " .. TTT.VerData.Build TTT.Version = TTT.VerMMP -- Gamemode constants GM.Name = "Trouble in Terrorist Town" GM.Author = "Tassilo" GM.Email = "[email protected]" GM.Website = "https://tassia.net/" TTT.GM = GM
local cache = {} local log = require('nvim-magic.log') local pathlib = require('plenary.path') local DIR = pathlib.new(vim.fn.stdpath('cache')):joinpath('nvim-magic-openai') DIR:mkdir({ parents = true, exist_ok = true }) local CacheMethods = {} function CacheMethods:save(filename, contents) local path = tostring(self.directory:joinpath(filename)) local fh, errmsg = io.open(path, 'w') assert(errmsg == nil, errmsg) fh:write(contents) fh:close() log.fmt_debug('Saved to cache path=%s', path) end local CacheMt = { __index = CacheMethods } function cache.new(directory) assert(type(directory) == 'string' and directory ~= '') local directory_path = DIR:joinpath(directory) directory_path:mkdir({ parents = true, exist_ok = true }) return setmetatable({ directory = directory_path, }, CacheMt) end -- for use when caching isn't wanted local DummyCacheMethods = {} function DummyCacheMethods:save(filename, _) -- luacheck: ignore log.fmt_debug('Dummy cache received request to save filename=%s', filename) end local DummyCacheMt = { __index = DummyCacheMethods } function cache.new_dummy() return setmetatable({}, DummyCacheMt) end return cache
local Core, Constants = unpack(select(2, ...)) local AceHook = Core.Libs.AceHook local Colors = Constants.COLORS local MOUSE_ENTER = Constants.EVENTS.MOUSE_ENTER local MOUSE_LEAVE = Constants.EVENTS.MOUSE_LEAVE local UPDATE_CONFIG = Constants.EVENTS.UPDATE_CONFIG -- luacheck: push ignore 113 local Mixin = Mixin local FCFDock_GetInsertIndex = FCFDock_GetInsertIndex local FCFDock_HideInsertHighlight = FCFDock_HideInsertHighlight local FCF_DockFrame = FCF_DockFrame local GENERAL_CHAT_DOCK = GENERAL_CHAT_DOCK local GeneralDockManager = GeneralDockManager local GetCursorPosition = GetCursorPosition local UIParent = UIParent -- luacheck: pop local ChatDockMixin = {} function ChatDockMixin:Init(parent) self.state = { mouseOver = false } self:SetWidth(Core.db.profile.frameWidth) self:SetHeight(Constants.DOCK_HEIGHT) self:ClearAllPoints() self:SetPoint("TOPLEFT", parent, "TOPLEFT") self:SetFadeInDuration(0.6) self:SetFadeOutDuration(0.6) self.scrollFrame:SetHeight(Constants.DOCK_HEIGHT) self.scrollFrame:SetPoint("TOPLEFT", _G.ChatFrame2Tab, "TOPRIGHT") self.scrollFrame.child:SetHeight(Constants.DOCK_HEIGHT) -- Gradient background local opacity = 0.4 self:SetGradientBackground(50, 250, Colors.black, opacity) -- Override drag behaviour -- Disable undocking frames self:RawHook("FCF_StopDragging", function (chatFrame) chatFrame:StopMovingOrSizing(); _G[chatFrame:GetName().."Tab"]:UnlockHighlight(); FCFDock_HideInsertHighlight(GENERAL_CHAT_DOCK); local mouseX, mouseY = GetCursorPosition(); mouseX, mouseY = mouseX / UIParent:GetScale(), mouseY / UIParent:GetScale(); FCF_DockFrame(chatFrame, FCFDock_GetInsertIndex(GENERAL_CHAT_DOCK, chatFrame, mouseX, mouseY), true); end, true) self:QuickHide() if self.subscriptions == nil then self.subscriptions = { Core:Subscribe(MOUSE_ENTER, function () -- Don't hide tabs when mouse is over self.state.mouseOver = true self:Show() end), Core:Subscribe(MOUSE_LEAVE, function () -- Hide chat tab when mouse leaves self.state.mouseOver = false if Core.db.profile.chatShowOnMouseOver then -- When chatShowOnMouseOver is on, synchronize the chat tab's fade out with -- the chat self:HideDelay(Core.db.profile.chatHoldTime) else -- Otherwise hide it immediately on mouse leave self:Hide() end end), Core:Subscribe(UPDATE_CONFIG, function (key) if key == "frameWidth" then self:SetWidth(Core.db.profile.frameWidth) self:SetGradientBackground(50, 250, Colors.black, opacity) end end) } end end local isCreated = false Core.Components.CreateChatDock = function (parent) if isCreated then error("ChatDock already exists. Only one ChatDock can exist at a time.") end local FadingFrameMixin = Core.Components.FadingFrameMixin local GradientBackgroundMixin = Core.Components.GradientBackgroundMixin isCreated = true local object = Mixin(GeneralDockManager, FadingFrameMixin, GradientBackgroundMixin, ChatDockMixin) AceHook:Embed(object) FadingFrameMixin.Init(object) GradientBackgroundMixin.Init(object) ChatDockMixin.Init(object, parent) return object end
local uv = vim.loop local DIR_SEP = package.config:sub(1, 1) local os_name = uv.os_uname().sysname local is_windows = os_name == 'Windows' or os_name == 'Windows_NT' local path_sep = is_windows and ";" or ":" local exe = is_windows and ".exe" or "" local function is_installed(bin) local env_path = os.getenv('PATH') local base_paths = vim.split(env_path, path_sep, true) for key, value in pairs(base_paths) do if uv.fs_stat(value .. DIR_SEP .. bin .. exe) then return true end end return false end return {is_installed = is_installed}
--!nolint UnknownGlobal --[[ SERVER PLUGINS' NAMES MUST START WITH "Server:" OR "Server-" CLIENT PLUGINS' NAMES MUST START WITH "Client:" OR "Client-" Plugins have full access to the server/client tables and most variables. You can use the MakePluginEvent to use the script instead of setting up an event. PlayerChatted will get chats from the custom chat and nil players. PlayerJoined will fire after the player finishes initial loading CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event. service.Events.PlayerChatted(function(plr, msg) print(msg..' from '..plr.Name..' Example Plugin') end) service.Events.PlayerJoined(function(p) print(p.Name..' Joined! Example Plugin') end) service.Events.CharacterAdded(function(p) server.RunCommand('name',plr.Name,'BobTest Example Plugin') end) --]] return function() server.Commands.ExampleCommand = { Prefix = server.Settings.Prefix; -- Prefix to use for command Commands = {"example"}; -- Commands Args = {"arg1"}; -- Command arguments Description = "Example command"; -- Command Description Hidden = true; -- Is it hidden from the command list? Fun = false; -- Is it fun? AdminLevel = "Players"; -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas") Function = function(plr,args) -- Function to run for command print("HELLO WORLD FROM AN EXAMPLE COMMAND :)") print("Player supplied args[1] "..tostring(args[1])) end } end
Point = Object:extend("Point") function Point.prototype:constructor(x, y) self.x = x or 0 self.y = y or 0 end function Point.prototype:set(x, y) self.x = x or self.x self.y = y or self.y end function Point.prototype:copy(point) self.x = point.x self.y = point.y end function Point.prototype:get() return self.x, self.y end
-- © 2008 David Given. -- WordGrinder is licensed under the MIT open source license. See the COPYING -- file in this distribution for the full text. local ParseWord = wg.parseword local bitand = bit32.band local bitor = bit32.bor local bitxor = bit32.bxor local bit = bit32.btest local time = wg.time local compress = wg.compress local decompress = wg.decompress local writeu8 = wg.writeu8 local readu8 = wg.readu8 local escape = wg.escape local unescape = wg.unescape local string_format = string.format local unpack = rawget(_G, "unpack") or table.unpack local MAGIC = "WordGrinder dumpfile v1: this is not a text file!" local ZMAGIC = "WordGrinder dumpfile v2: this is not a text file!" local TMAGIC = "WordGrinder dumpfile v3: this is a text file; diff me!" local STOP = 0 local TABLE = 1 local BOOLEANTRUE = 2 local BOOLEANFALSE = 3 local STRING = 4 local NUMBER = 5 local CACHE = 6 local NEGNUMBER = 7 local BRIEFWORD = 8 local DOCUMENTSETCLASS = 100 local DOCUMENTCLASS = 101 local PARAGRAPHCLASS = 102 local WORDCLASS = 103 local MENUCLASS = 104 local function writetostream(object, write, writeo) local function save(key, t, force) if (type(t) == "table") then local m = GetClass(t) if (m ~= ParagraphClass) and (key ~= ".current") then for k, i in ipairs(t) do save(key.."."..k, i) end if (t ~= DocumentSet.documents) then -- Save the keys in alphabetical order, so we get repeatable -- files. local keys = {} for k in pairs(t) do if (type(k) ~= "number") then if not k:find("^_") then keys[#keys+1] = k end end end table.sort(keys) for _, k in ipairs(keys) do save(key.."."..k, t[k]) end end end elseif (type(t) == "boolean") then writeo(key, tostring(t)) elseif (type(t) == "string") then writeo(key, '"'..escape(t)..'"') elseif (type(t) == "number") then writeo(key, tostring(t)) else error("unsupported type "..type(t)) end end save("", object) if (GetClass(object) == DocumentSetClass) then save(".current", object:_findDocument(object.current.name)) local function save_document(i, d) write("#") write(tostring(i)) write("\n") for _, p in ipairs(d) do write(p.style) for _, s in ipairs(p) do write(" ") write(s) end write("\n") end write(".") write("\n") end if object.clipboard then save_document("clipboard", object.clipboard) end for i, d in ipairs(object.documents) do save_document(i, d) end end return true end function SaveToStream(filename, object) -- Write the file to a *different* filename (so that crashes during -- writing doesn't corrupt the file). local fp, e = io.open(filename..".new", "wb") if not fp then return nil, e end local fpw = fp.write local ss = {} local write = function(s) ss[#ss+1] = s end local writeo = function(k, v) write(k) write(": ") write(v) write("\n") end local r = writetostream(object, write, writeo) local s = table.concat(ss) local e if r then r, e = fp:write(TMAGIC, "\n", s) end r, e = fp:close() if e then return r, e end -- At this point, we know the new file has been written correctly. -- We can remove the old one and rename the new one to be the old -- one. On proper operating systems we could do this in a single -- os.rename, but Windows doesn't support clobbering renames. os.remove(filename) r, e = os.rename(filename..".new", filename) if e then -- Yikes! The old file has gone, but we couldn't rename the new -- one... return r, e..": the filename of your document has changed" end return r, e end function SaveDocumentSetRaw(filename) DocumentSet:purge() return SaveToStream(filename, DocumentSet) end function Cmd.SaveCurrentDocumentAs(filename) if not filename then filename = FileBrowser("Save Document Set", "Save as:", true) if not filename then return false end if filename:find("/[^.]*$") then filename = filename .. ".wg" end end DocumentSet.name = filename ImmediateMessage("Saving...") DocumentSet:clean() local r, e = SaveDocumentSetRaw(DocumentSet.name) if not r then ModalMessage("Save failed", "The document could not be saved: "..e) else NonmodalMessage("Save succeeded.") end return r end function Cmd.SaveCurrentDocument() local name = DocumentSet.name if not name then name = FileBrowser("Save Document Set", "Save as:", true) if not name then return false end if name:find("/[^.]*$") then name = name .. ".wg" end DocumentSet.name = name end return Cmd.SaveCurrentDocumentAs(name) end local function loadfromstream(fp) local cache = {} local load local function populate_table(t) local n = tonumber(fp:read("*l")) for i = 1, n do t[i] = load() end while true do local k = load() if not k then break end t[k] = load() end return t end local load_cb = { ["DS"] = function() local t = {} setmetatable(t, {__index = DocumentSetClass}) cache[#cache + 1] = t return populate_table(t) end, ["D"] = function() local t = {} setmetatable(t, {__index = DocumentClass}) cache[#cache + 1] = t return populate_table(t) end, ["P"] = function() local t = {} setmetatable(t, {__index = ParagraphClass}) cache[#cache + 1] = t return populate_table(t) end, ["W"] = function() -- Words used to be objects of their own; they've been replaced -- with simple strings. local t = {} -- Ensure we allocate a cache entry *before* calling -- populate_table(), or else the numbers will go all wrong; the -- original implementation put t here. local cn = #cache + 1 cache[cn] = {} populate_table(t) cache[cn] = t.text return t.text end, ["M"] = function() local t = {} setmetatable(t, {__index = MenuClass}) cache[#cache + 1] = t return populate_table(t) end, ["T"] = function() local t = {} cache[#cache + 1] = t return populate_table(t) end, ["S"] = function() local s = fp:read("*l") cache[#cache + 1] = s return s end, ["N"] = function() local n = tonumber(fp:read("*l")) cache[#cache + 1] = n return n end, ["B"] = function() local s = fp:read("*l") s = (s == "T") cache[#cache + 1] = s return s end, ["."] = function() return nil end } load = function() local s = fp:read("*l") if not s then error("unexpected EOF when reading file") end local n = tonumber(s) if n then return cache[n] end local f = load_cb[s] if not f then error("can't load type "..s) end return f() end return load() end function loadfromstreamz(fp) local cache = {} local load local data = decompress(fp:read("*a")) local offset = 1 local function populate_table(t) local n n, offset = readu8(data, offset) for i = 1, n do t[i] = load() end while true do local k = load() if not k then break end t[k] = load() end return t end local load_cb = { [CACHE] = function() local n n, offset = readu8(data, offset) return cache[n] end, [DOCUMENTSETCLASS] = function() local t = {} setmetatable(t, {__index = DocumentSetClass}) cache[#cache + 1] = t return populate_table(t) end, [DOCUMENTCLASS] = function() local t = {} setmetatable(t, {__index = DocumentClass}) cache[#cache + 1] = t return populate_table(t) end, [PARAGRAPHCLASS] = function() local t = {} setmetatable(t, {__index = ParagraphClass}) cache[#cache + 1] = t return populate_table(t) end, [WORDCLASS] = function() -- Words used to be objects of their own; they've been replaced -- with simple strings. local t = {} -- Ensure we allocate a cache slot *before* calling populate_table, -- or else the numbers all go wrong. local cn = #cache + 1 cache[cn] = {} populate_table(t) cache[cn] = t.text return t.text end, [BRIEFWORD] = function() -- Words used to be objects of their own; they've been replaced -- with simple strings. local t = load() cache[#cache+1] = t return t end, [MENUCLASS] = function() local t = {} setmetatable(t, {__index = MenuClass}) cache[#cache + 1] = t return populate_table(t) end, [TABLE] = function() local t = {} cache[#cache + 1] = t return populate_table(t) end, [STRING] = function() local n n, offset = readu8(data, offset) local s = data:sub(offset, offset+n-1) offset = offset + n cache[#cache + 1] = s return s end, [NUMBER] = function() local n n, offset = readu8(data, offset) cache[#cache + 1] = n return n end, [NEGNUMBER] = function() local n n, offset = readu8(data, offset) n = -n cache[#cache + 1] = n return n end, [BOOLEANTRUE] = function() cache[#cache + 1] = true return true end, [BOOLEANFALSE] = function() cache[#cache + 1] = false return false end, [STOP] = function() return nil end } load = function() local n n, offset = readu8(data, offset) local f = load_cb[n] if not f then error("can't load type "..n.." at offset "..offset) end return f() end return load() end function loadfromstreamt(fp) local data = CreateDocumentSet() data.menu = CreateMenuBindings() data.documents = {} while true do local line = fp:read("*l") if not line then break end if line:find("^%.") then local _, _, k, p, v = line:find("^(.*)%.([^.:]+): (.*)$") -- This is setting a property value. local o = data for e in k:gmatch("[^.]+") do if e:find('^[0-9]+') then e = tonumber(e) end if not o[e] then if (o == data.documents) then o[e] = CreateDocument() else o[e] = {} end end o = o[e] end if v:find('^-?[0-9][0-9.e+-]*$') then v = tonumber(v) elseif (v == "true") then v = true elseif (v == "false") then v = false elseif v:find('^".*"$') then v = v:sub(2, -2) v = unescape(v) else error( string.format("malformed property %s.%s: %s", k, p, v)) end if p:find('^[0-9]+$') then p = tonumber(p) end o[p] = v elseif line:find("^#") then local id = line:sub(2) local doc if (id == "clipboard") then doc = data.clipboard if not doc then doc = {} data.clipboard = doc end else doc = data.documents[tonumber(id)] end local index = 1 while true do line = fp:read("*l") if not line or (line == ".") then break end local words = SplitString(line, " ") local para = CreateParagraph(unpack(words)) doc[index] = para index = index + 1 end else error( string.format("malformed line when reading file: %s", line)) end end -- Patch up document names. for i, d in ipairs(data.documents) do data.documents[d.name] = d end data.current = data.documents[data.current] -- Remove any broken clipboard (works around a bug in v0.6 saved files). if data.clipboard and (#data.clipboard == 0) then data.clipboard = nil end return data end function LoadFromStream(filename) local fp, e = io.open(filename, "rb") if not fp then return nil, ("'"..filename.."' could not be opened: "..e) end local loader = nil local magic = fp:read("*l") if (magic == MAGIC) then loader = loadfromstream elseif (magic == ZMAGIC) then loader = loadfromstreamz elseif (magic == TMAGIC) then loader = loadfromstreamt else fp:close() return nil, ("'"..filename.."' is not a valid WordGrinder file.") end local d, e = loader(fp) fp:close() return d, e end local function loaddocument(filename) local d, e = LoadFromStream(filename) if e then return nil, e end -- Even if the changed flag was set in the document on disk, remove it. d:clean() d.name = filename return d end function Cmd.LoadDocumentSet(filename) if not ConfirmDocumentErasure() then return false end if not filename then filename = FileBrowser("Load Document Set", "Load file:", false) if not filename then return false end end ImmediateMessage("Loading "..filename.."...") local d, e = loaddocument(filename) if not d then if not e then e = "The load failed, probably because the file could not be opened." end ModalMessage("Load failed", e) QueueRedraw() return false end -- Downgrading documents is not supported. local fileformat = d.fileformat or 1 if (fileformat > FILEFORMAT) then ModalMessage("Cannot load document", "This document belongs to a newer version of " .. "WordGrinder and cannot be loaded. Sorry.") QueueRedraw() return false end DocumentSet = d Document = d.current if (fileformat < FILEFORMAT) then UpgradeDocument(fileformat) FireEvent(Event.DocumentUpgrade, fileformat, FILEFORMAT) DocumentSet.fileformat = FILEFORMAT DocumentSet.menu = CreateMenuBindings() end FireEvent(Event.RegisterAddons) DocumentSet:touch() ResizeScreen() FireEvent(Event.DocumentLoaded) UpdateDocumentStyles() RebuildDocumentsMenu(DocumentSet.documents) QueueRedraw() if (fileformat < FILEFORMAT) then ModalMessage("Document upgraded", "You are trying to open a file belonging to an earlier ".. "version of WordGrinder. That's not a problem, but if you ".. "save the file again it may not work on the old version. ".. "Also, all keybindings defined in this file will get reset ".. "to their default values.") end -- The document is NOT dirty immediately after a load. DocumentSet.changed = false return true end function UpgradeDocument(oldversion) DocumentSet.addons = DocumentSet.addons or {} -- Upgrade version 1 to 2. if (oldversion < 2) then -- Update wordcount. for _, document in ipairs(DocumentSet.documents) do local wc = 0 for _, p in ipairs(document) do wc = wc + #p end document.wordcount = wc end -- Status bar defaults to on. DocumentSet.statusbar = true end -- Upgrade version 2 to 3. if (oldversion < 3) then -- Idle time defaults to 3. DocumentSet.idletime = 3 end -- Upgrade version 5 to 6. if (oldversion < 6) then -- This is the version which made WordClass disappear. The -- conversion's actually done as part of the stream loader -- (where WORDCLASS and BRIEFWORD are parsed). end -- Upgrade version 6 to 7. if (oldversion < 7) then -- This is the version where DocumentSet.styles vanished. Each paragraph.style -- is now a string containing the name of the style; styles are looked up on -- demand. local function convertStyles(document) for _, p in ipairs(document) do if (type(p.style) ~= "string") then p.style = p.style.name end end end for _, document in ipairs(DocumentSet.documents) do convertStyles(document) end if DocumentSet.clipboard then convertStyles(DocumentSet.clipboard) end DocumentSet.styles = nil end -- Upgrade version 7 to 8. if (oldversion < 8) then -- This version added the LN paragraph style type; documents are forwards -- compatible but not backward compatible. -- A bug on 0.7.2 meant that the styles were still exported in -- WordGrinder files, even though they were never used. DocumentSet.styles = nil DocumentSet.idletime = nil end end
-- Copyright 2007-2016 Mitchell mitchell.att.foicica.com. See LICENSE. package.path = table.concat({ _USERHOME..'/?.lua', _USERHOME..'/modules/?.lua', _USERHOME..'/modules/?/init.lua', _HOME..'/modules/?.lua', _HOME..'/modules/?/init.lua', package.path }, ';'); local so = not WIN32 and '/?.so' or '/?.dll' package.cpath = table.concat({ _USERHOME..so, _USERHOME..'/modules'..so, _HOME..'/modules'..so, package.cpath }, ';') textadept = require('textadept') local user_init = _USERHOME..'/init.lua' if lfs.attributes(user_init) then dofile(user_init) end
-- Tests for quickfix window's title local helpers = require('test.functional.helpers')(after_each) local insert, source = helpers.insert, helpers.source local clear, expect = helpers.clear, helpers.expect describe('qf_title', function() setup(clear) it('is working', function() insert([[ Results of test_qf_title:]]) source([[ set efm=%E%f:%l:%c:%m cgetexpr ['file:1:1:message'] let qflist=getqflist() call setqflist(qflist, 'r') copen let g:quickfix_title=w:quickfix_title wincmd p $put =g:quickfix_title ]]) -- Assert buffer contents. expect([[ Results of test_qf_title: :setqflist()]]) end) end)
local vehicleList = { vehicle_1 = 1, vehicle_2 = 2, vehicle_3 = 3, vehicle_4 = 4, vehicle_5 = 5, vehicle_6 = 6, vehicle_7 = 7, vehicle_8 = 8, vehicle_9 = 9, vehicle_10 = 10, vehicle_11 = 11, vehicle_12 = 12, vehicle_13 = 13, vehicle_14 = 14, vehicle_15 = 15, vehicle_16 = 16, vehicle_17 = 17, vehicle_18 = 18, vehicle_19 = 19, vehicle_20 = 20, vehicle_21 = 21, vehicle_22 = 22, vehicle_23 = 23, vehicle_24 = 24 } AddRemoteEvent("CallVehicleSpawnMenu", function(player) CallRemoteEvent(player, "ShowVehicleSpawnMenu", vehicleList) end) AddRemoteEvent("CallSpawnVehicle", function(player, model) local vehicleid = model:gsub("vehicle_", "") local x, y, z = GetPlayerLocation(player) local heading = GetPlayerHeading(player) if PlayerData[player].vehicle ~= nil then DestroyVehicle(PlayerData[player].vehicle) end local vehicle = CreateVehicle(vehicleid, x, y, z, heading) PlayerData[player].vehicle = vehicle SetPlayerInVehicle(player, vehicle) end) AddRemoteEvent("CallSetVehicleColor", function(player, color) local vehicle = GetPlayerVehicle(player) SetVehicleColor(vehicle, "0x"..color) end) AddRemoteEvent("CallSetVehiclePlate", function(player, text) local vehicle = GetPlayerVehicle(player) SetVehicleLicensePlate(vehicle, text) end) AddRemoteEvent("CallAttachVehicleNitro", function(player) local vehicle = GetPlayerVehicle(player) AttachVehicleNitro(vehicle, true) end) AddRemoteEvent("CallRepairVehicle", function(player) local vehicle = GetPlayerVehicle(player) SetVehicleHealth(vehicle, 5000) for i=1,8 do SetVehicleDamage(vehicle, i, 0) end end)
function lang_switch_keys(lang) local in_lang = {} local langs = { [1] = {lang_key = "tr", lang_name = "Türkçe", script_name = "Satır Oluştur", sub_menu = "Satır/Oluştur"}, [2] = {lang_key = "en", lang_name = "English", script_name = "Create Lines", sub_menu = "Lines/Create"} } local lang_list = {} local script_name_list = {} local sub_menu_list = {} for i = 1, #langs do lang_list[langs[i].lang_key] = langs[i].lang_name script_name_list[langs[i].lang_key] = langs[i].script_name sub_menu_list[langs[i].lang_key] = langs[i].sub_menu end if lang == langs[1].lang_key then in_lang["module_incompatible"] = "Mag modülünün kurulu sürümü bu lua dosyası ile uyumsuz!\n\nModül dosyasının en az \"%s\" sürümü veya daha üstü gerekiyor.\n\n\nŞimdi indirme sayfasına gitmek ister misiniz?" in_lang["module_not_found"] = "Mag modülü bulunamadı!\n\nBu lua dosyasını kullanmak için Mag modülünü indirip Aegisub programı kapalıyken\n\"Aegisub/automation/include/\" dizinine taşımanız gerekiyor.\n\n\nŞimdi indirme sayfasına gitmek ister misiniz?" in_lang["module_yes"] = "Git" in_lang["module_no"] = "Daha Sonra" in_lang["sub_menu"] = langs[1].sub_menu in_lang["s_name"] = langs[1].script_name in_lang["s_desc"] = "Satır oluşturmaya yardım eder." in_lang["tabKey1"] = "Gömülü Yazı" in_lang["tabKey2"] = "Şarkı" in_lang["key1"] = "Başlangıç süresi ({%s}), bitiş süresinden ({%s}) büyük." in_lang["guiLabelKey1"] = "Başlangıç zamanı:" in_lang["guiLabelKey2"] = "Bitiş zamanı:" in_lang["guiLabelKey3"] = "Bir metin girin:" in_lang["guiLabelKey4"] = "Satır başlangıç zamanı:" in_lang["guiLabelKey5"] = "Satır süresi:" in_lang["buttonKey1"] = "Satır Oluştur" in_lang["buttonKey2"] = "Kapat" in_lang["buttonKey3"] = "Panoyu Yapıştır" elseif lang == langs[2].lang_key then in_lang["module_incompatible"] = "The installed version of the Mag module is incompatible with this lua file!\n\nAt least \"%s\" version or higher of the module file is required.\n\n\nWould you like to go to the download page now?" in_lang["module_not_found"] = "The module named Mag could not be found!\n\nTo use this file, you need to download the module named mag\nand move it to \"Aegisub/automation/include/\" directory when Aegisub is off.\n\n\nDo you want to go to download page now?" in_lang["module_yes"] = "Go" in_lang["module_no"] = "Later" in_lang["sub_menu"] = langs[2].sub_menu in_lang["s_name"] = langs[2].script_name in_lang["s_desc"] = "Helps to create a line." in_lang["tabKey1"] = "Hardsub" in_lang["tabKey2"] = "Karaoke" in_lang["key1"] = "Start time ({%s}) is bigger than end time ({%s})." in_lang["guiLabelKey1"] = "Start time:" in_lang["guiLabelKey2"] = "End time:" in_lang["guiLabelKey3"] = "Type a text:" in_lang["guiLabelKey4"] = "Line start time:" in_lang["guiLabelKey5"] = "Line duration:" in_lang["buttonKey1"] = "Create Line" in_lang["buttonKey2"] = "Close" in_lang["buttonKey3"] = "Paste Clipboard" end return in_lang, lang_list, script_name_list, sub_menu_list end c_lang_switch = "en" c_lang, c_lang_list, c_script_name_list, c_sub_name_list = lang_switch_keys(c_lang_switch) script_name = c_lang.s_name script_description = c_lang.s_desc script_version = "1.3" script_author = "Magnum357" script_mag_version = "1.1.5.0" script_file_name = "mag.create_lines" script_file_ext = ".lua" include_unicode = true include_clipboard = true include_karaskel = true mag_import, mag = pcall(require, "mag") if mag_import then mag.lang = c_lang_switch c_lock_gui = false c_buttons1 = {c_lang.buttonKey1, c_lang.buttonKey2} c_buttons2 = {c_lang.buttonKey1, c_lang.buttonKey3, c_lang.buttonKey2} c_hardsub_start_time = 0 c_hardsub_end_time = 0 c = {} c.kdur = "30000" gui = { main1 = { {class = "label", x = 0, y = 0, width = 1, height = 1, label = c_lang.guiLabelKey1}, {class = "label", x = 0, y = 1, width = 1, height = 1, label = c_lang.guiLabelKey2}, label1 = {class = "label", x = 1, y = 0, width = 10, height = 1}, label2 = {class = "label", x = 1, y = 1, width = 10, height = 1}, {class = "label", x = 0, y = 2, width = 1, height = 1, label = c_lang.guiLabelKey3}, text = {class = "edit", name = "u_text", x = 1, y = 2, width = 10, height = 1}, }, main2 = { label1 = {class = "label", x = 0, y = 0, width = 1, height = 1, label = c_lang.guiLabelKey4}, label2 = {class = "label", x = 1, y = 0, width = 1, height = 1}, {class = "label", x = 0, y = 1, width = 1, height = 1, label = c_lang.guiLabelKey5}, duration = {class = "edit", name = "u_duration", x = 1, y = 1, width = 1, height = 1}, {class = "label", x = 0, y = 2, width = 1, height = 1, label = c_lang.guiLabelKey3}, text = {class = "edit", name = "u_text", x = 1, y = 2, width = 1, height = 1}, } } end function hardsub(subs,sel,act) if not mag.is.video() then mag.show.log(1, mag.window.lang.message("is_video")) else local current_time = mag.convert.ms_from_frame(aegisub.project_properties().video_position) if current_time < 0 then current_time = 1 end if c_hardsub_start_time == 0 and c_hardsub_end_time == 0 then c_hardsub_start_time = current_time elseif c_hardsub_start_time > 0 and c_hardsub_end_time == 0 then c_hardsub_end_time = current_time local jump if c_hardsub_start_time > c_hardsub_end_time then mag.show.log(1, mag.string.format(c_lang.key1, mag.convert.ms_to_time(c_hardsub_start_time), mag.convert.ms_to_time(c_hardsub_end_time))) else local ok, config gui.main1.label1.label = mag.convert.ms_to_time(c_hardsub_start_time) gui.main1.label2.label = mag.convert.ms_to_time(c_hardsub_end_time) repeat ok, config = mag.window.dialog(gui.main1, c_buttons1) until ok == mag.convert.ascii(c_buttons1[1]) and not mag.is.empty(config.u_text) or ok == mag.convert.ascii(c_buttons1[2]) if ok == mag.convert.ascii(c_buttons1[1]) then local l = table.copy(subs[act]) l.layer = 0 l.start_time = c_hardsub_start_time l.end_time = c_hardsub_end_time l.text = config.u_text l.actor = "" l.effect = "" l.margin_l = 0 l.margin_r = 0 l.margin_t = 0 jump = act + 1 subs.insert(jump, l) end end c_hardsub_start_time = 0 c_hardsub_end_time = 0 if jump ~= nil then return {jump} end end end end function karaoke(subs,sel,act) if not mag.is.video() then mag.show.log(1, mag.window.lang.message("is_video")) else local ok, config local line_end_time = subs[act].end_time gui.main2.label2.label = mag.convert.ms_to_time(line_end_time) gui.main2.text.value = "" repeat if ok == mag.convert.ascii(c_buttons2[2]) then gui.main2.text.value = mag.clip.get() end gui.main2.duration.value = mag.convert.ms_to_time(c.kdur) ok, config = mag.window.dialog(gui.main2, c_buttons2) c.kdur = mag.convert.time_to_ms(config.u_duration) until ok == mag.convert.ascii(c_buttons2[1]) and not mag.is.empty(config.u_text) or ok == mag.convert.ascii(c_buttons2[3]) if ok == mag.convert.ascii(c_buttons1[1]) then local l = table.copy(subs[act]) l.layer = 0 l.start_time = line_end_time l.end_time = line_end_time + c.kdur l.text = config.u_text l.actor = "" l.effect = "" l.margin_l = 0 l.margin_r = 0 l.margin_t = 0 subs.insert(act + 1, l) return {act + 1} end end end function check_macro1(subs,sel,act) if c_lock_gui then mag.show.log(1, mag.window.lang.message("restart_aegisub")) else local fe, fee = pcall(hardsub, subs, sel, act) mag.window.funce(fe, fee) mag.window.undo_point() return fee end end function check_macro2(subs, sel, act) if c_lock_gui then mag.show.log(1, mag.window.lang.message("restart_aegisub")) else mag.config.get(c) local fe, fee = pcall(karaoke, subs, sel, act) mag.window.funce(fe, fee) mag.window.undo_point() mag.config.set(c) return fee end end function mag_redirect_gui() local mag_module_link = "https://github.com/magnum357i/Magnum-s-Aegisub-Scripts" local k = aegisub.dialog.display({{class = "label", label = mag_gui_message}}, {c_lang.module_yes, c_lang.module_no}) if k == c_lang.module_yes then os.execute("start "..mag_module_link) end end if mag_import then if mag_module_version:gsub("%.", "") < script_mag_version:gsub("%.", "") then mag_gui_message = string.format(c_lang.module_incompatible, script_mag_version) aegisub.register_macro(script_name, script_desription, mag_redirect_gui) else mag.window.register(c_sub_name_list[c_lang_switch].."/"..c_lang.tabKey1, check_macro1) mag.window.register(c_sub_name_list[c_lang_switch].."/"..c_lang.tabKey2, check_macro2) mag.window.lang.register(c_sub_name_list[c_lang_switch]) end else mag_gui_message = c_lang.module_not_found aegisub.register_macro(script_name, script_desription, mag_redirect_gui) end
local file = require('pl.file') local path = require('pl.path') local stringx = require('pl.stringx') local json = require('dkjson') local stats = require('haproxy.stats') local SPEC_DIR = path.abspath(path.dirname(stringx.lstrip(debug.getinfo(1, 'S').source, '@'))) local function fixture(name) return file.read(path.join(SPEC_DIR, 'fixtures', name)) end describe('Client', function() it('initializes correctly with default values', function() local client = stats.Client() assert.equal(getmetatable(client), stats.Client) end) it('accepts socket configuration', function() local client = stats.Client('127.0.0.1', 8000, 1) assert.same( { address = '127.0.0.1', port = 8000, timeout = 1, }, client) end) it('can be initialized with _init() or new()', function() local client1 = stats.Client() local client2 = stats.Client.new() assert.same(client1, client2) end) it('should use LuaSocket outside of HAProxy', function() local client = stats.Client() local socket = require('socket') assert.same(getmetatable(client.tcp()), getmetatable(socket.tcp())) end) end) describe('stats parser', function() it('should parse CSV correctly', function() local response = fixture('stats.csv') local parsed = json.decode(fixture('stats.json')) assert.same(stats.parse_stats(response), parsed) end) end) describe('info parser', function() it('should parse info correctly', function() local response = fixture('info.txt') local parsed = json.decode(fixture('info.json')) assert.same(stats.parse_info(response), parsed) end) end)
return { assignment_late = { [72] = {X = 4, Y = 80, Sheet = 3926313458}, [36] = {X = 404, Y = 524, Sheet = 3926307971}, [96] = {X = 204, Y = 404, Sheet = 3926327588}, [48] = {X = 576, Y = 576, Sheet = 3926311105} }, trending_flat = { [72] = {X = 688, Y = 536, Sheet = 3926316119}, [36] = {X = 84, Y = 84, Sheet = 3926305904}, [96] = {X = 304, Y = 104, Sheet = 3926319860}, [48] = {X = 888, Y = 836, Sheet = 3926311105} }, present_to_all = { [72] = {X = 156, Y = 308, Sheet = 3926313458}, [36] = {X = 924, Y = 324, Sheet = 3926307971}, [96] = {X = 204, Y = 504, Sheet = 3926333840}, [48] = {X = 368, Y = 264, Sheet = 3926309567} }, filter_frames = { [72] = {X = 80, Y = 536, Sheet = 3926317787}, [36] = {X = 964, Y = 124, Sheet = 3926305904}, [96] = {X = 204, Y = 204, Sheet = 3926327588}, [48] = {X = 160, Y = 472, Sheet = 3926311105} }, view_compact = { [48] = {X = 680, Y = 784, Sheet = 3926311105}, [36] = {X = 964, Y = 884, Sheet = 3926305904}, [72] = {X = 536, Y = 4, Sheet = 3926319099}, [96] = {X = 104, Y = 704, Sheet = 3926319860} }, style = { [48] = {X = 784, Y = 368, Sheet = 3926309567}, [36] = {X = 284, Y = 604, Sheet = 3926305904}, [72] = {X = 232, Y = 232, Sheet = 3926319099}, [96] = {X = 804, Y = 104, Sheet = 3926319860} }, power_settings_new = { [72] = {X = 156, Y = 840, Sheet = 3926314806}, [36] = {X = 44, Y = 364, Sheet = 3926305904}, [96] = {X = 604, Y = 104, Sheet = 3926330123}, [48] = {X = 628, Y = 56, Sheet = 3926309567} }, crop_5_4 = { [72] = {X = 460, Y = 156, Sheet = 3926317787}, [36] = {X = 324, Y = 684, Sheet = 3926305904}, [96] = {X = 904, Y = 904, Sheet = 3926326846}, [48] = {X = 212, Y = 56, Sheet = 3926311105} }, panorama_vertical = { [72] = {X = 612, Y = 312, Sheet = 3926312257}, [36] = {X = 4, Y = 884, Sheet = 3926305904}, [96] = {X = 504, Y = 804, Sheet = 3926330123}, [48] = {X = 628, Y = 836, Sheet = 3926309567} }, alarm_on = { [72] = {X = 764, Y = 764, Sheet = 3926314806}, [36] = {X = 404, Y = 444, Sheet = 3926307971}, [96] = {X = 504, Y = 704, Sheet = 3926328650}, [48] = {X = 264, Y = 368, Sheet = 3926311105} }, filter_1 = { [72] = {X = 764, Y = 536, Sheet = 3926317787}, [36] = {X = 364, Y = 484, Sheet = 3926305904}, [96] = {X = 204, Y = 904, Sheet = 3926327588}, [48] = {X = 472, Y = 56, Sheet = 3926312257} }, check_box = {[48] = {X = 4, Y = 836, Sheet = 3926311105}}, radio_button_unchecked = {[48] = {X = 628, Y = 420, Sheet = 3926309567}}, radio_button_checked = {[48] = {X = 784, Y = 420, Sheet = 3926309567}}, indeterminate_check_box = {[48] = {X = 4, Y = 732, Sheet = 3926307971}}, event_available = { [72] = {X = 764, Y = 764, Sheet = 3926316119}, [36] = {X = 204, Y = 84, Sheet = 3926305904}, [96] = {X = 904, Y = 604, Sheet = 3926326846}, [48] = {X = 628, Y = 940, Sheet = 3926311105} }, filter_9_plus = { [72] = {X = 156, Y = 688, Sheet = 3926317787}, [36] = {X = 644, Y = 164, Sheet = 3926305904}, [96] = {X = 104, Y = 104, Sheet = 3926327588}, [48] = {X = 368, Y = 472, Sheet = 3926311105} }, zoom_out = { [72] = {X = 916, Y = 616, Sheet = 3926312257}, [36] = {X = 284, Y = 164, Sheet = 3926307971}, [96] = {X = 504, Y = 804, Sheet = 3926334787}, [48] = {X = 108, Y = 160, Sheet = 3926312257} }, vertical_align_bottom = { [48] = {X = 836, Y = 160, Sheet = 3926311105}, [36] = {X = 124, Y = 524, Sheet = 3926305904}, [72] = {X = 80, Y = 232, Sheet = 3926319099}, [96] = {X = 104, Y = 404, Sheet = 3926319860} }, print = { [72] = {X = 536, Y = 460, Sheet = 3926313458}, [36] = {X = 84, Y = 404, Sheet = 3926307971}, [96] = {X = 4, Y = 504, Sheet = 3926333840}, [48] = {X = 56, Y = 368, Sheet = 3926309567} }, replay = { [72] = {X = 156, Y = 384, Sheet = 3926313458}, [36] = {X = 244, Y = 524, Sheet = 3926307971}, [96] = {X = 404, Y = 804, Sheet = 3926333840}, [48] = {X = 576, Y = 4, Sheet = 3926309567} }, replay_5 = { [72] = {X = 308, Y = 4, Sheet = 3926313458}, [36] = {X = 924, Y = 284, Sheet = 3926307971}, [96] = {X = 204, Y = 804, Sheet = 3926333840}, [48] = {X = 888, Y = 56, Sheet = 3926309567} }, sentiment_neutral = { [72] = {X = 764, Y = 536, Sheet = 3926314806}, [36] = {X = 524, Y = 364, Sheet = 3926307971}, [96] = {X = 4, Y = 204, Sheet = 3926330123}, [48] = {X = 160, Y = 576, Sheet = 3926307971} }, lock_outline = { [48] = {X = 368, Y = 56, Sheet = 3926309567}, [36] = {X = 524, Y = 644, Sheet = 3926305904}, [72] = {X = 536, Y = 308, Sheet = 3926319099}, [96] = {X = 4, Y = 604, Sheet = 3926335698} }, reply_all = { [72] = {X = 308, Y = 384, Sheet = 3926313458}, [36] = {X = 204, Y = 524, Sheet = 3926307971}, [96] = {X = 604, Y = 804, Sheet = 3926333840}, [48] = {X = 888, Y = 160, Sheet = 3926309567} }, swap_horiz = { [72] = {X = 536, Y = 156, Sheet = 3926316119}, [36] = {X = 804, Y = 364, Sheet = 3926305904}, [96] = {X = 704, Y = 104, Sheet = 3926319860}, [48] = {X = 56, Y = 212, Sheet = 3926309567} }, repeat_one = { [72] = {X = 80, Y = 460, Sheet = 3926313458}, [36] = {X = 364, Y = 484, Sheet = 3926307971}, [96] = {X = 704, Y = 704, Sheet = 3926333840}, [48] = {X = 212, Y = 4, Sheet = 3926309567} }, next_week = { [48] = {X = 264, Y = 784, Sheet = 3926309567}, [36] = {X = 244, Y = 964, Sheet = 3926305904}, [72] = {X = 840, Y = 308, Sheet = 3926319099}, [96] = {X = 4, Y = 604, Sheet = 3926330123} }, ring_volume = { [72] = {X = 612, Y = 232, Sheet = 3926313458}, [36] = {X = 84, Y = 524, Sheet = 3926307971}, [96] = {X = 604, Y = 704, Sheet = 3926333840}, [48] = {X = 368, Y = 784, Sheet = 3926307971} }, battery_alert = { [72] = {X = 308, Y = 156, Sheet = 3926313458}, [36] = {X = 204, Y = 404, Sheet = 3926307971}, [96] = {X = 304, Y = 604, Sheet = 3926328650}, [48] = {X = 732, Y = 836, Sheet = 3926311105} }, report = { [72] = {X = 156, Y = 232, Sheet = 3926313458}, [36] = {X = 964, Y = 444, Sheet = 3926307971}, [96] = {X = 704, Y = 804, Sheet = 3926333840}, [48] = {X = 4, Y = 56, Sheet = 3926309567} }, tonality = { [72] = {X = 536, Y = 764, Sheet = 3926317787}, [36] = {X = 564, Y = 164, Sheet = 3926305904}, [96] = {X = 4, Y = 804, Sheet = 3926321212}, [48] = {X = 524, Y = 108, Sheet = 3926312257} }, cloud = { [48] = {X = 264, Y = 940, Sheet = 3926311105}, [36] = {X = 324, Y = 764, Sheet = 3926305904}, [72] = {X = 156, Y = 460, Sheet = 3926319099}, [96] = {X = 504, Y = 304, Sheet = 3926328650} }, account_circle = { [72] = {X = 80, Y = 312, Sheet = 3926312257}, [36] = {X = 124, Y = 204, Sheet = 3926307971}, [96] = {X = 804, Y = 804, Sheet = 3926328650}, [48] = {X = 472, Y = 264, Sheet = 3926311105} }, rotate_left = { [72] = {X = 460, Y = 916, Sheet = 3926313458}, [36] = {X = 324, Y = 324, Sheet = 3926307971}, [96] = {X = 604, Y = 904, Sheet = 3926333840}, [48] = {X = 784, Y = 940, Sheet = 3926307971} }, battery_20 = { [72] = {X = 80, Y = 764, Sheet = 3926313458}, [36] = {X = 204, Y = 84, Sheet = 3926307971}, [96] = {X = 904, Y = 604, Sheet = 3926328650}, [48] = {X = 888, Y = 940, Sheet = 3926311105} }, rounded_corner = { [72] = {X = 536, Y = 840, Sheet = 3926313458}, [36] = {X = 764, Y = 444, Sheet = 3926307971}, [96] = {X = 504, Y = 904, Sheet = 3926333840}, [48] = {X = 420, Y = 784, Sheet = 3926307971} }, rotate_right = { [72] = {X = 156, Y = 764, Sheet = 3926313458}, [36] = {X = 244, Y = 484, Sheet = 3926307971}, [96] = {X = 704, Y = 904, Sheet = 3926333840}, [48] = {X = 56, Y = 784, Sheet = 3926307971} }, computer = { [72] = {X = 764, Y = 232, Sheet = 3926317787}, [36] = {X = 924, Y = 924, Sheet = 3926305904}, [96] = {X = 4, Y = 804, Sheet = 3926326846}, [48] = {X = 368, Y = 732, Sheet = 3926311105} }, music_note = { [48] = {X = 56, Y = 524, Sheet = 3926309567}, [36] = {X = 364, Y = 804, Sheet = 3926305904}, [72] = {X = 764, Y = 536, Sheet = 3926319099}, [96] = {X = 204, Y = 404, Sheet = 3926334787} }, camera_roll = { [72] = {X = 688, Y = 236, Sheet = 3926312257}, [36] = {X = 964, Y = 844, Sheet = 3926305904}, [96] = {X = 204, Y = 404, Sheet = 3926328650}, [48] = {X = 56, Y = 160, Sheet = 3926311105} }, restaurant_menu = { [72] = {X = 4, Y = 384, Sheet = 3926313458}, [36] = {X = 44, Y = 484, Sheet = 3926307971}, [96] = {X = 404, Y = 904, Sheet = 3926333840}, [48] = {X = 680, Y = 4, Sheet = 3926309567} }, transform = { [72] = {X = 232, Y = 460, Sheet = 3926314806}, [36] = {X = 844, Y = 244, Sheet = 3926305904}, [96] = {X = 404, Y = 104, Sheet = 3926321212}, [48] = {X = 108, Y = 576, Sheet = 3926311105} }, description = { [48] = {X = 368, Y = 108, Sheet = 3926311105}, [36] = {X = 204, Y = 524, Sheet = 3926305904}, [72] = {X = 80, Y = 384, Sheet = 3926319099}, [96] = {X = 404, Y = 104, Sheet = 3926326846} }, cake = { [72] = {X = 916, Y = 460, Sheet = 3926313458}, [36] = {X = 764, Y = 4, Sheet = 3926307971}, [96] = {X = 504, Y = 804, Sheet = 3926329330}, [48] = {X = 316, Y = 784, Sheet = 3926311105} }, room = { [72] = {X = 688, Y = 384, Sheet = 3926313458}, [36] = {X = 884, Y = 444, Sheet = 3926307971}, [96] = {X = 804, Y = 904, Sheet = 3926333840}, [48] = {X = 160, Y = 836, Sheet = 3926307971} }, room_service = { [72] = {X = 308, Y = 232, Sheet = 3926313458}, [36] = {X = 764, Y = 484, Sheet = 3926307971}, [96] = {X = 304, Y = 904, Sheet = 3926333840}, [48] = {X = 316, Y = 940, Sheet = 3926307971} }, error_outline = { [72] = {X = 460, Y = 764, Sheet = 3926316119}, [36] = {X = 364, Y = 124, Sheet = 3926305904}, [96] = {X = 904, Y = 504, Sheet = 3926326846}, [48] = {X = 56, Y = 888, Sheet = 3926311105} }, line_weight = { [72] = {X = 764, Y = 80, Sheet = 3926316119}, [36] = {X = 484, Y = 404, Sheet = 3926305904}, [96] = {X = 104, Y = 404, Sheet = 3926333840}, [48] = {X = 472, Y = 108, Sheet = 3926309567} }, settings_input_composite = { [72] = {X = 80, Y = 688, Sheet = 3926313458}, [36] = {X = 404, Y = 4, Sheet = 3926307971}, [96] = {X = 504, Y = 304, Sheet = 3926330123}, [48] = {X = 160, Y = 680, Sheet = 3926307971} }, filter_9 = { [72] = {X = 612, Y = 688, Sheet = 3926317787}, [36] = {X = 484, Y = 124, Sheet = 3926305904}, [96] = {X = 404, Y = 4, Sheet = 3926327588}, [48] = {X = 316, Y = 368, Sheet = 3926311105} }, unfold_more = { [48] = {X = 56, Y = 732, Sheet = 3926311105}, [36] = {X = 764, Y = 684, Sheet = 3926305904}, [72] = {X = 80, Y = 4, Sheet = 3926319099}, [96] = {X = 304, Y = 304, Sheet = 3926319860} }, speaker_phone = { [72] = {X = 840, Y = 616, Sheet = 3926312257}, [36] = {X = 364, Y = 964, Sheet = 3926305904}, [96] = {X = 204, Y = 804, Sheet = 3926319860}, [48] = {X = 628, Y = 888, Sheet = 3926309567} }, library_books = { [72] = {X = 612, Y = 156, Sheet = 3926316119}, [36] = {X = 404, Y = 124, Sheet = 3926305904}, [96] = {X = 904, Y = 304, Sheet = 3926333840}, [48] = {X = 472, Y = 4, Sheet = 3926309567} }, directions_boat = { [48] = {X = 888, Y = 576, Sheet = 3926311105}, [36] = {X = 84, Y = 524, Sheet = 3926305904}, [72] = {X = 840, Y = 80, Sheet = 3926319099}, [96] = {X = 4, Y = 304, Sheet = 3926321212} }, timer_3 = { [72] = {X = 764, Y = 384, Sheet = 3926316119}, [36] = {X = 284, Y = 244, Sheet = 3926305904}, [96] = {X = 904, Y = 864, Sheet = 3926319099}, [48] = {X = 576, Y = 420, Sheet = 3926311105} }, remove = { [72] = {X = 536, Y = 232, Sheet = 3926313458}, [36] = {X = 884, Y = 284, Sheet = 3926307971}, [96] = {X = 104, Y = 904, Sheet = 3926333840}, [48] = {X = 420, Y = 160, Sheet = 3926309567} }, restore = { [72] = {X = 156, Y = 4, Sheet = 3926313458}, [36] = {X = 124, Y = 524, Sheet = 3926307971}, [96] = {X = 204, Y = 904, Sheet = 3926333840}, [48] = {X = 888, Y = 784, Sheet = 3926307971} }, party_mode = { [72] = {X = 384, Y = 540, Sheet = 3926312257}, [36] = {X = 444, Y = 884, Sheet = 3926305904}, [96] = {X = 504, Y = 704, Sheet = 3926330123}, [48] = {X = 940, Y = 940, Sheet = 3926309567} }, more = { [48] = {X = 576, Y = 680, Sheet = 3926309567}, [36] = {X = 4, Y = 964, Sheet = 3926305904}, [72] = {X = 764, Y = 460, Sheet = 3926319099}, [96] = {X = 404, Y = 404, Sheet = 3926334787} }, check_box_outline_blank = {[48] = {X = 940, Y = 784, Sheet = 3926311105}}, looks = { [72] = {X = 156, Y = 460, Sheet = 3926317787}, [36] = {X = 684, Y = 644, Sheet = 3926305904}, [96] = {X = 904, Y = 204, Sheet = 3926334787}, [48] = {X = 108, Y = 420, Sheet = 3926309567} }, queue = { [72] = {X = 916, Y = 764, Sheet = 3926313458}, [36] = {X = 484, Y = 444, Sheet = 3926307971}, [96] = {X = 704, Y = 504, Sheet = 3926333840}, [48] = {X = 732, Y = 420, Sheet = 3926309567} }, event = { [36] = {X = 124, Y = 84, Sheet = 3926305904}, [24] = {X = 228, Y = 4, Size = 24, Sheet = 3926305904}, [96] = {X = 304, Y = 704, Sheet = 3926326846}, [72] = {X = 916, Y = 384, Sheet = 3926314806}, [48] = {X = 212, Y = 732, Sheet = 3926311105} }, flash_on = { [72] = {X = 384, Y = 384, Sheet = 3926316119}, [36] = {X = 844, Y = 804, Sheet = 3926305904}, [96] = {X = 304, Y = 404, Sheet = 3926326846}, [48] = {X = 472, Y = 316, Sheet = 3926311105} }, border_outer = { [72] = {X = 840, Y = 916, Sheet = 3926314806}, [36] = {X = 324, Y = 244, Sheet = 3926307971}, [96] = {X = 504, Y = 504, Sheet = 3926329330}, [48] = {X = 732, Y = 4, Sheet = 3926311105} }, battery_charging_90 = { [72] = {X = 688, Y = 764, Sheet = 3926313458}, [36] = {X = 84, Y = 364, Sheet = 3926307971}, [96] = {X = 4, Y = 304, Sheet = 3926327588}, [48] = {X = 836, Y = 628, Sheet = 3926311105} }, radio = { [72] = {X = 764, Y = 916, Sheet = 3926313458}, [36] = {X = 484, Y = 404, Sheet = 3926307971}, [96] = {X = 304, Y = 504, Sheet = 3926333840}, [48] = {X = 368, Y = 420, Sheet = 3926309567} }, cloud_queue = { [48] = {X = 368, Y = 940, Sheet = 3926311105}, [36] = {X = 324, Y = 844, Sheet = 3926305904}, [72] = {X = 916, Y = 536, Sheet = 3926319099}, [96] = {X = 4, Y = 304, Sheet = 3926328650} }, add_to_photos = { [72] = {X = 232, Y = 312, Sheet = 3926312257}, [36] = {X = 564, Y = 124, Sheet = 3926307971}, [96] = {X = 404, Y = 704, Sheet = 3926328650}, [48] = {X = 940, Y = 212, Sheet = 3926311105} }, visibility = { [72] = {X = 232, Y = 844, Sheet = 3926312257}, [36] = {X = 84, Y = 44, Sheet = 3926307971}, [96] = {X = 604, Y = 4, Sheet = 3926321212}, [48] = {X = 576, Y = 56, Sheet = 3926311105} }, local_library = { [48] = {X = 264, Y = 472, Sheet = 3926309567}, [36] = {X = 4, Y = 724, Sheet = 3926305904}, [72] = {X = 840, Y = 4, Sheet = 3926319099}, [96] = {X = 204, Y = 504, Sheet = 3926335698} }, looks_one = { [72] = {X = 4, Y = 80, Sheet = 3926317787}, [36] = {X = 44, Y = 684, Sheet = 3926305904}, [96] = {X = 204, Y = 104, Sheet = 3926335698}, [48] = {X = 160, Y = 368, Sheet = 3926309567} }, developer_mode = { [48] = {X = 888, Y = 680, Sheet = 3926311105}, [36] = {X = 204, Y = 604, Sheet = 3926305904}, [72] = {X = 612, Y = 688, Sheet = 3926319099}, [96] = {X = 104, Y = 204, Sheet = 3926326846} }, priority_high = { [72] = {X = 764, Y = 764, Sheet = 3926313458}, [36] = {X = 164, Y = 364, Sheet = 3926307971}, [96] = {X = 404, Y = 504, Sheet = 3926333840}, [48] = {X = 420, Y = 264, Sheet = 3926309567} }, stay_current_portrait = { [72] = {X = 840, Y = 4, Sheet = 3926317787}, [36] = {X = 84, Y = 964, Sheet = 3926305904}, [96] = {X = 604, Y = 904, Sheet = 3926321212}, [48] = {X = 108, Y = 680, Sheet = 3926309567} }, colorize = { [72] = {X = 4, Y = 4, Sheet = 3926317787}, [36] = {X = 804, Y = 924, Sheet = 3926305904}, [96] = {X = 704, Y = 704, Sheet = 3926326846}, [48] = {X = 420, Y = 784, Sheet = 3926311105} }, near_me = { [72] = {X = 612, Y = 384, Sheet = 3926317787}, [36] = {X = 604, Y = 764, Sheet = 3926305904}, [96] = {X = 4, Y = 404, Sheet = 3926334787}, [48] = {X = 368, Y = 732, Sheet = 3926309567} }, refresh = { [72] = {X = 764, Y = 384, Sheet = 3926313458}, [36] = {X = 404, Y = 84, Sheet = 3926307971}, [96] = {X = 104, Y = 704, Sheet = 3926333840}, [48] = {X = 368, Y = 212, Sheet = 3926309567} }, format_list_numbered = { [72] = {X = 384, Y = 232, Sheet = 3926316119}, [36] = {X = 44, Y = 204, Sheet = 3926305904}, [96] = {X = 204, Y = 504, Sheet = 3926327588}, [48] = {X = 576, Y = 4, Sheet = 3926312257} }, star_half = { [36] = {X = 84, Y = 924, Sheet = 3926305904}, [24] = {X = 60, Y = 4, Size = 24, Sheet = 3926305904}, [96] = {X = 4, Y = 704, Sheet = 3926319860}, [72] = {X = 840, Y = 156, Sheet = 3926319099}, [48] = {X = 524, Y = 732, Sheet = 3926309567} }, folder = { [72] = {X = 156, Y = 80, Sheet = 3926316119}, [36] = {X = 804, Y = 44, Sheet = 3926305904}, [96] = {X = 604, Y = 204, Sheet = 3926326846}, [48] = {X = 108, Y = 472, Sheet = 3926311105} }, settings_voice = { [72] = {X = 156, Y = 540, Sheet = 3926312257}, [36] = {X = 324, Y = 4, Sheet = 3926307971}, [96] = {X = 404, Y = 404, Sheet = 3926330123}, [48] = {X = 264, Y = 836, Sheet = 3926307971} }, wb_cloudy = { [72] = {X = 840, Y = 384, Sheet = 3926313458}, [36] = {X = 44, Y = 84, Sheet = 3926307971}, [96] = {X = 404, Y = 204, Sheet = 3926319860}, [48] = {X = 108, Y = 888, Sheet = 3926311105} }, cached = { [72] = {X = 688, Y = 536, Sheet = 3926313458}, [36] = {X = 204, Y = 124, Sheet = 3926307971}, [96] = {X = 204, Y = 804, Sheet = 3926329330}, [48] = {X = 420, Y = 732, Sheet = 3926311105} }, redo = { [72] = {X = 232, Y = 764, Sheet = 3926313458}, [36] = {X = 444, Y = 84, Sheet = 3926307971}, [96] = {X = 904, Y = 604, Sheet = 3926333840}, [48] = {X = 472, Y = 212, Sheet = 3926309567} }, star = { [36] = {X = 44, Y = 804, Sheet = 3926305904}, [24] = {X = 116, Y = 4, Size = 24, Sheet = 3926305904}, [96] = {X = 704, Y = 504, Sheet = 3926319860}, [72] = {X = 384, Y = 156, Sheet = 3926317787}, [48] = {X = 472, Y = 732, Sheet = 3926309567} }, }
local type = type local unpack = unpack local assert = assert local format = string.format local string_byte = string.byte local string_sub = string.sub local string_match = string.match local string_split = string.split local io_LoadString = io.LoadString local next = next local pairs = pairs local ipairs = ipairs local tonumber = tonumber local tostring = tostring local rawget = rawget local rawset = rawset local getfenv = getfenv local setfenv = setfenv local pcall = pcall local xpcall = xpcall local getmetatable = debug.getmetatable local d_setmetatable = debug.setmetatable local os_time = os.time local debug_getinfo = debug.getinfo local loadfile = loadfile local loadstring = loadstring local table_insert = table.insert local table_remove = table.remove local table_concat = table.concat local table_copy = table.copy local table_invert = table.invert local min = math.min local max = math.max local abs = math.abs local dofile = dofile local _G = _G ----------- No globals from this point ------------ local _NOGLOBALS --------------------------------------------------- local function ParseAny(s, t, ...) local f = assert(loadstring(s)) setfenv(f, t or {}) return f(...) end local SpecSymbols = table_invert{"$", "#", "-", "=", "{", "*"} local function SpecSym(s) local t = {} for i = -1, -1/0, -1 do local c = string_sub(s, i, i) if SpecSymbols[c] then t[c] = true elseif t["-"] then return "", t else return string_sub(s, 1, i), t end end end local function ParseVal(v, sym, t) if sym["*"] then return ParseAny(v, t) elseif sym["$"] and not sym["#"] then return v elseif not sym["-"] then return tonumber(v) or ParseAny("return "..v) end end local function AssignToName(t, s, v, fmt) if s == "" then return elseif string_sub(s, 1, 1) ~= "[" then s = "."..s end return ParseAny(format(fmt or "local t, v = ...; t%s = v", s, s, s), {}, t, v) end local function AssignVal(k, v, sym, t) v = ParseVal(v, sym, t) AssignToName(t, k, v) end local function ParseTextTable(s, r, SkipEmpty, AssignTables) r = r or {} local t1 = string_split(s, "\r\n", true) local ht = string_split(t1[1], "\t", true) local BaseR = r local LastR = {} for i = 1, #t1 - 1 do local t = string_split(t1[i + 1], "\t", true) local rt = {} local KeySym for j = 1, min(#ht, #t) do local v, k, sym = t[j], SpecSym(ht[j]) if sym["="] then if type(i) == "number" then i, KeySym = SpecSym(v) else table_copy(KeySym, sym, true) if sym["{"] then if sym["#"] or sym["*"] then AssignVal(i, v, sym, r) end LastR[#LastR + 1] = r if AssignTables then r = AssignToName(r, i, nil, "local t = ...; local v = {}; t%s = v; return v") else r = AssignToName(r, i, nil, "local t = ...; local v = t%s; if v == nil then v = {}; t%s = v; end; return v") end -- for k = j, #t do -- AssignVal(k - j + 1, t[k], sym, rt) -- end elseif i == "}" then r = LastR[#LastR] LastR[#LastR] = nil else AssignVal(i, v, sym, r) end i = "" break end else AssignVal(k, v, sym, rt) end end if type(i) ~= "number" then AssignToName(r, i, rt) elseif not SkipEmpty or next(r) then r[i] = rt end end return BaseR end _G.ParseTextTable = ParseTextTable function _G.LoadTextTable(s, r, SkipEmpty, AssignTables) return ParseTextTable(io_LoadString(s), r, SkipEmpty, AssignTables) end local function ParseBasicTextTable(s, StartingLinesCount) local t = string_split(s, "\r\n", true) for i = StartingLinesCount + 1, #t do t[i] = string_split(t[i], "\t", true) end return t end _G.ParseBasicTextTable = ParseBasicTextTable function _G.LoadBasicTextTable(s, StartingLinesCount) return ParseBasicTextTable(io_LoadString(s), StartingLinesCount) end local function ParseNumbersTextTable(s, StartingLinesCount) local t = string_split(s, "\r\n", true) for i = StartingLinesCount + 1, #t do local t1 = string_split(t[i], "\t", true) for k, v in ipairs(t1) do t1[k] = tonumber(v) or ParseAny("return "..v) end t[i] = t1 end return t end _G.ParseNumbersTextTable = ParseNumbersTextTable function _G.LoadNumbersTextTable(s, StartingLinesCount) return ParseNumbersTextTable(io_LoadString(s), StartingLinesCount) end function _G.TransposeTextTable(t) local new = {} for k1, _t in pairs(t) do for k, v in pairs(_t) do new[k] = new[k] or {} new[k][k1] = v end end return new end
-- This example script demonstrates how to change scenes. Voice = Character { dialogName="Mysterious Voice", textColor="#600" } -- Uncomment one (and only one) of these to see the different results -- of changing scenes at the end of the OUTSIDE_DOOR scene. Player = Character { dialogName="Eric" } -- Player = Character { dialogName="Lobby" } -- Player = Character { dialogName="Mitch Xadrian" } START = Scene { "There is a suspicious door before you.", ChangeToScene "OUTSIDE_DOOR", } OUTSIDE_DOOR = Scene { Voice "Who is it?", "You respond with your name.", ChangeToScene(function () if Player.dialogName == "Eric" then return "GREET_ERIC" elseif Player.dialogName == "Lobby" then return "GREET_LOBBY" else return "GREET_EVERYONE_ELSE" end end), } GREET_ERIC = Scene { Voice "Nice to see, come on in!" } GREET_LOBBY = Scene { Voice "Get out of here you free-loading bum!" } GREET_EVERYONE_ELSE = Scene { Voice "Don't know you. Get Lost." }
WASocialProxy = {} function WASocialProxy.share(platform,shareContent,shareWithApi,extInfo,callback) local param = {platform = platform ,shareContent = shareContent , shareWithApi = shareWithApi ,extInfo = extInfo ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","share",param) end function WASocialProxy.appInvite(platform, appLinkUrl, previewImageUrl, callback) local param = {platform = platform ,appLinkUrl = appLinkUrl , previewImageUrl = previewImageUrl ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","appInvite",param) end function WASocialProxy.queryInvitableFriends(platform, duration, callback) local param = {platform = platform ,duration = duration , callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","queryInvitableFriends",param) end function WASocialProxy.gameInvite(platform, title, message, ids, callback) local param = {platform = platform ,title = title , message = message ,ids,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","gameInvite",param) end function WASocialProxy.createInviteRecord(platform, result,callback) local param = {platform = platform ,result = result , callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","createInviteRecord",param) end function WASocialProxy.inviteInstallReward(platform,token,callback) local param = {platform = platform ,token = token , callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","inviteInstallReward",param) end function WASocialProxy.inviteEventReward(platform, eventName, callback) local param = {platform = platform ,eventName = eventName , callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","inviteEventReward",param) end function WASocialProxy.queryFriends(platform,callback) local param = {platform = platform ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","queryFriends",param) end function WASocialProxy.queryFBGraphObjects(objectType,callback) local param = {objectType = objectType ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","queryFBGraphObjects",param) end function WASocialProxy.fbSendGift(title, message, objectId, receipts,callback) local param = {title = title ,message = message,objectId = objectId, receipts = receipts ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","fbSendGift",param) end function WASocialProxy.fbAskForGift(title,message,objectId, receipts, callback) local param = {title = title ,message = message,objectId = objectId,receipts = receipts,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","fbSendGift",param) end function WASocialProxy.fbQueryReceivedGifts(callback) local param = {callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","fbQueryReceivedGifts",param) end function WASocialProxy.fbQueryAskForGiftRequests(callback) local param = {callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","fbQueryAskForGiftRequests",param) end function WASocialProxy.fbDeleteRequest(requestId, callback) local param = {requestId = requestId , callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","fbDeleteRequest",param) end function WASocialProxy.getGroupByGid(platform, gids, extInfo,callback) local param = {platform = platform , gids = gids ,extInfo = extInfo ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","getGroupByGid",param) end function WASocialProxy.getCurrentAppLinkedGroup(platform,extInfo,callback) local param = {platform = platform , extInfo = extInfo ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","getCurrentAppLinkedGroup",param) end function WASocialProxy.getCurrentUserGroup(platform, extInfo,callback) local param = {platform = platform , extInfo = extInfo ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","getCurrentUserGroup",param) end function WASocialProxy.getGroups(platform,extInfo, callback) local param = {platform = platform , extInfo = extInfo ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","getGroups",param) end function WASocialProxy.joinGroup(platform, groupId,extInfo,callback) local param = {platform = platform ,groupId = groupId, extInfo = extInfo ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","joinGroup",param) end function WASocialProxy.openGroupPage(platform, groupUri, extInfo) local param = {platform = platform ,groupUri = groupUri, extInfo = extInfo} luaoc.callStaticMethod("WALuaSocialProxy","openGroupPage",param) end function WASocialProxy.sendRequest(platform, requestType, title, message, objectId, receiptIds, extInfo,callback) local param = {platform = platform , requestType = requestType , title = title ,message = message ,objectId = objectId ,receiptIds = receiptIds , extInfo = extInfo ,callback = callback} luaoc.callStaticMethod("WALuaSocialProxy","sendRequest",param) end
RANDOM:seed(17) --for getting the same piece always we seed it with fixed number -------------------------first the SynthDefs------------------------------ -- we will getting requiring a lua file with synthdefs in this script folder -- and call sync for waiting to async complete path = require"sc.path" path.require_here() require"synthdefs" Sync() ------------------------------------ the sequences and players -------------------- scale = {modes.mixolydian + 7} -- mixolydian mode shifted a fifth (7 semitones) ---- ostinato piano player with 4 kind of sounds ------------------ -- not OscPianoEP because rho and others are init time parameters so that a new node must be created -- poly = 4 sets a maximum polyphony of 4 tipe1={amp = 0.8,rho = 0.2,mh = 0.3} tipe2={amp = 0.2,rho = 1 ,mh = 1} tipe3={amp = 0.5,rho = 0.2,mh = 1} tipe4={amp = 0.5,rho = 0.6,mh = 1.5} ostinato = OscEP{inst="oteypiano",sends={db2amp(-15),0},dontfree=true,poly=4,channel={level=db2amp(-9)}}:Bind(PS( { delta=LOOP{LS{1.5,1,1,0.5}:rep(3),LS{1,0.5,1,0.5,1}}*0.5, dur = 1, escale = scale, degree=7*5+1 + LS{LS{0}:rep(17*15),LOOP{-7}}, pan=noisefStream({-1,1}), }, LOOP{tipe1,tipe2,tipe3,tipe4} )) ostinato.inserts = {{"soundboard"}} ------------ piano melody player ------------------------------- -- piano melody with fixed notes and variable dur. rho, rcore and mh change the sound of piano -- poly = 10 means maximum polyphony of 10 notes seqdegree = {1,5,10,4,8,5,9,3,7} -- 9 notes piano=OscEP{inst="oteypiano",sends={db2amp(-15),0},poly=10,dontfree=true,channel={level=db2amp(3)}} piano.inserts = {{"soundboard"}} -- infinite long playing sequence pianoseq={ -- 4 noteseq hight octave, the rest low octave degree = LOOP(seqdegree) + LS{LS{7*5}:rep(9*4),LOOP{7*4}}, escale = scale, dur = LS{LS{2}:rep(9*2), --9*2=18 ; 2 noteseqs WRS({LS{2/3}:rep(3),AGLS(scramble,{0.5,1,0.5})},{3,2},12)*2, --12*3=36=9*4 --4 noteseqs WRS({LS{2/3}:rep(3),AGLS(scramble,{0.5,1,0.5})},{3,2},9*4), --9*4*3 -- 12 noteseqs WRS({LS{2/3}:rep(3),AGLS(scramble,{0.5,1,0.5})},{3,2},-1)*0.5*3/2}, --... amp = noisefStream{0.4,0.7}, pan = noisefStream{-1,1}, rho = WRS({0.2,1},{12,1},-1), rcore = WRS({1,2},{12,1},-1), mh = RSinf{0.3,1,1.5} } -- end of piano part pianoendseq = { degree = LOOP(seqdegree) + LS{LS{7*5}:rep(9*4),LOOP{7*4}}, escale = scale, dur = LS{WRS({LS{2/3}:rep(3),AGLS(scramble,{0.5,1,0.5})},{3,2},3*3), WRS({LS{2/3}:rep(3),AGLS(scramble,{0.5,1,0.5})},{3,2},3*2)*2, LS{2}:rep(9)}, amp = noisefStream{0.4,0.7}, pan = noisefStream{-1,1}, rho = WRS({0.2,1},{12,1},-1), rcore = WRS({1,2},{12,1},-1), mh = RSinf{0.3,1,1.5} } -------------------- Jet sound effect ------------------------- Jet = OscEP{dontfree=false,sends={db2amp(-30)},channel={level=db2amp(-11)}}:Bind{ inst={"Jetsound","Jetsound2"}, note = LS{60}, dur =30, time = 20 } ----------------------- drone player ------------------------- drone = OscEP{inst="bowdrone",sends={db2amp(-15),0},channel={level=db2amp(-7)},poly=3}:Bind{ degree = 7*2 + 1, escale = scale, dur = 12*3, amp = 0.2 } ----------------------- violin player ------------------------- violin = OscEP{inst="bowed",sends={db2amp(-15)},channel={level=db2amp(-9)}} violin.inserts = {{"bowsoundboard"}} -- first sequence violinseq = { degree = LOOP{1,5,LSS{4,3,2,1,0,-1,-2,1}+7} + 7*5, escale = scale, dur = LS{LS{4}:rep(12),LS{1/3}:rep(12*4)}, legato = LOOP{1,1,0.8}, c3=200, force =2.5, amp =LOOP{0.9,0.7,1} } -- second sequence violinseq2 = { degree = LOOP{1,5,LSS{4,3,2,1,0,-1,-2,1}+7}+7*5, escale = scale, dur = LS{LS{2}:rep(12*2),LS{0.5}:rep(12*2),LS{1/3}:rep(12*2),LS{0.25}:rep(12*6)}, legato = LOOP{1,1,0.8}, c3=200, force =2.5, amp =LOOP{0.9,0.7,1}, } --------------------- cello player -------------------------------- cello = OscEP{inst="bowed",sends={db2amp(-15)},channel={level=db2amp(-6)}}:Bind{ degree = LS({{1,5},{0,2},{-1,4},{-2,1}},2)+7*4, escale = scale, dur = 4*2, pan = {-0.5,0.5}, amp =0.5, } cello.inserts = {{"bowsoundboard"}} --------------- Actions structure -------------------------------------- actioncue=ActionEP() actioncue:Bind{ actions=LS{ STOP(-4,unpack(OSCPlayers)), START(0,Jet), START(4,ostinato), --GOTO(6,200), BINDSTART(20,piano,pianoseq), START(200,drone), BINDSTART(220,violin, violinseq), START(276,cello), BINDSTART(276 + 24*2,violin, violinseq2), START(360,cello), STOP(420,drone), BINDSTART(424,piano,pianoendseq), ACTION(488,function() ostinato.playing=false end), } } ------------ Master section ---------------------------------------- Master.inserts={ {"Compander",{thresh=-10,slopeAbove=.66,bypass=0}}, {"Limiter",{thresh=0,bypass=0}}, } --DiskOutBuffer([[mixolidian_mantra4.wav]]) Effects={FX("dwgreverb",db2amp(0.77),nil,{c1=1.3,c3=10,len=1500})} theMetro:tempo(100) theMetro:start()
local L = BigWigs:NewBossLocale("Atal'Dazar Trash", "ptBR") if not L then return end if L then L.skyscreamer = "Gritacéu Devorante" L.tlonja = "T'lonja" L.shieldbearer = "Escudeiro de Zul" L.witchdoctor = "Mandingueira Zanchuli" L.kisho = "Dinomante Kish'o" L.priestess = "Sacerdotisa Dourada" L.stalker = "Espreitador Umbralâmina" L.confessor = "Confessor Dazar'ai" L.augur = "Áugure Dazar'ai" end
object_mobile_iris_sinclair = object_mobile_shared_iris_sinclair:new { } ObjectTemplates:addTemplate(object_mobile_iris_sinclair, "object/mobile/iris_sinclair.iff")
local Tile = require 'src.world.tiles.Tile' local Grass = class(..., Tile) function Grass:initialize(cell) Tile.initialize(self,cell,1,1) end return Grass
require("/quests/scripts/portraits.lua") require("/quests/scripts/questutil.lua") require("/scripts/util.lua") function init() setPortraits() script.setUpdateDelta(100) quest.setObjectiveList({{"^green;Abandon this quest^reset; to set a ^orange; bookmark here^reset;.", false}}) quest.setText("^green;Abandon this quest^reset; to ^orange;set a bookmark^reset;.") self.countdown = 2 self.timer = 0 self.checkedFUMemento = false self.logging = false end function questFail() if self.logging then sb.logInfo("bookmarkuestnote: giving manual marker") end player.startQuest( buildDescriptor("bookmarkuest", sb.makeUuid(), mcontroller.position(), player.worldId()), player.serverUuid(), player.worldId() ) player.startQuest("bookmarkuestnote") end function update(dt) --wait 3 secs for the world to load aaa if not self.checkedFUMemento then self.checkedFUMemento = true checkFUMemento() end if self.timer ~= -1 then if self.timer <= self.countdown then self.timer = self.timer + dt else self.timer = -1 checkMemento() end end end function checkMemento() if self.logging then sb.logInfo("bookmarquestnote: checking original memento...") end if player.hasItem("mementomori") then if self.logging then sb.logInfo("bookmarquestnote: player has original memento") end local worldPropertyDeathPos = world.getProperty("mementomori.lastDeathPosition") if self.logging then sb.logInfo("bookmarquestnote: original mmori data: %s", worldPropertyDeathPos) end if worldPropertyDeathPos ~= nil then local worldIdIthink = worldPropertyDeathPos[1] --aaaa player.hasQuest() is currently bugged it seems??? -- if player.hasQuest("bookmarkuest_mori." .. idwhatevaaa) then sb.logInfo("playerhasquest bookmarkuest_mori.%s", idwhatevaaa) return end -- sb.logInfo("bookmarkquestnote: player has quest ID bookmarkuest_mori.%s: %s", idwhatevaaa, player.hasQuest("bookmarkuest_mori." .. idwhatevaaa)) player.startQuest( buildDescriptor("bookmarkuest_mori", worldIdIthink, worldPropertyDeathPos, player.worldId()), player.serverUuid(), player.worldId() ) end end end function checkFUMemento() if self.logging then sb.logInfo("bookmarquestnote: checking FU memento...") end if player.hasItem("fumementomori") then if self.logging then sb.logInfo("bookmarquestnote: player has FUmemento") end local statusPropertyDeathPos = status.statusProperty("mementomori.lastDeathInfo") if self.logging then sb.logInfo("bookmarquestnote: FU mmori data: %s", statusPropertyDeathPos) end if statusPropertyDeathPos ~= nil then player.startQuest( buildDescriptor("bookmarkuest_mori", statusPropertyDeathPos.worldId, statusPropertyDeathPos.position, statusPropertyDeathPos.worldId), player.serverUuid(), statusPropertyDeathPos.worldId or player.worldId() ) end end end function buildDescriptor(template, idwhatev, coords, worldId) local descriptor = { templateId = template, questId = template .. "." .. idwhatev, seed = generateSeed(), parameters = {} } descriptor.parameters.worldId = {type = "noDetail", name = tostring(worldId)} descriptor.parameters.posX = {type = "noDetail", name = tostring(coords[1])} descriptor.parameters.posY = {type = "noDetail", name = tostring(coords[2])} return descriptor end
ESX = nil local wzial = false local delete = false Citizen.CreateThread(function() while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(10) end while ESX.GetPlayerData().job == nil do Citizen.Wait(100) end ESX.PlayerData = ESX.GetPlayerData() Blips() end) RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) ESX.PlayerData = xPlayer Blips() end) RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) ESX.PlayerData.job = job wpracy = false Blips() end) function Blips() if Config.Blip then if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == "ambulance" then if Config.EMS then -- local EMS = AddBlipForCoord(Config.PosEMS.x, Config.PosEMS.y, Config.PosEMS.z) SetBlipSprite(EMS, 43) SetBlipScale (EMS, 1.0) SetBlipColour(EMS, 2) SetBlipAsShortRange(EMS, true) BeginTextCommandSetBlipName("STRING") AddTextComponentString("Helicoptère médical") EndTextCommandSetBlipName(EMS) end end if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == "police" then if Config.EMS then -- local LSPD = AddBlipForCoord(Config.PosLSPD.x, Config.PosLSPD.y, Config.PosLSPD.z) SetBlipSprite(LSPD, 43) SetBlipScale (LSPD, 1.0) SetBlipColour(LSPD, 3) SetBlipAsShortRange(LSPD, true) BeginTextCommandSetBlipName("STRING") AddTextComponentString("Helicoptère police") EndTextCommandSetBlipName(LSPD) end end end end Citizen.CreateThread(function() while true do Citizen.Wait(7) if wzial then Citizen.Wait(Config.Delay * 60000) wzial = false end end end) Citizen.CreateThread(function() while true do Citizen.Wait(7) local ped = PlayerPedId() local pos = GetEntityCoords(ped) local delay = Config.Delay if Config.LSPD then if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == "police" then if GetDistanceBetweenCoords(pos, Config.PosLSPD.x, Config.PosLSPD.y, Config.PosLSPD.z, true) < 20 then DrawMarker(Config.MarkerType, Config.PosLSPD.x, Config.PosLSPD.y, Config.PosLSPD.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) ESX.Game.Utils.DrawText3D({ x = Config.PosLSPD.x, y = Config.PosLSPD.y, z = Config.PosLSPD.z + 1 }, '~h~~b~[E] ~w~Prendre un hélicoptère', 0.8) end if GetDistanceBetweenCoords(pos, Config.PosLSPD.x, Config.PosLSPD.y, Config.PosLSPD.z, true) < 3 then if IsControlJustReleased(0, Config.Przycisk) then if not wzial then ESX.ShowNotification("~g~L'hélicoptère sera bientôt disponible ..") Citizen.Wait(Config.Czas * 1000) DoScreenFadeOut(500) Citizen.Wait(500) ESX.Game.SpawnVehicle(Config.Helikopter, { x = Config.HeliLSPD.x, y = Config.HeliLSPD.y, z = Config.HeliLSPD.z }, Config.HeliLSPD.h, function(heliLSPD) TaskWarpPedIntoVehicle(GetPlayerPed(-1), heliLSPD, -1) wzial = true delete = true end) Citizen.Wait(500) DoScreenFadeIn(500) else ESX.ShowNotification("Vous avez déjà pris un hélicoptère. Tu dois attendre ~r~" .. delay .. " ~w~minutes") end end end end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(7) local ped = PlayerPedId() local pos = GetEntityCoords(ped) local delay = Config.Delay if Config.EMS then if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == "ambulance" then if GetDistanceBetweenCoords(pos, Config.PosEMS.x, Config.PosEMS.y, Config.PosEMS.z, true) < 20 then DrawMarker(Config.MarkerType, Config.PosEMS.x, Config.PosEMS.y, Config.PosEMS.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) ESX.Game.Utils.DrawText3D({ x = Config.PosEMS.x, y = Config.PosEMS.y, z = Config.PosEMS.z + 1 }, '~h~~b~[E] ~w~Prendre un hélicoptère', 0.8) end if GetDistanceBetweenCoords(pos, Config.PosEMS.x, Config.PosEMS.y, Config.PosEMS.z, true) < 3 then if IsControlJustReleased(0, Config.Przycisk) then if not wzial then ESX.ShowNotification("~g~L'hélicoptère sera bientôt disponible ..") Citizen.Wait(Config.Czas * 1000) DoScreenFadeOut(500) Citizen.Wait(500) ESX.Game.SpawnVehicle(Config.Helikopter, { x = Config.HeliEMS.x, y = Config.HeliEMS.y, z = Config.HeliEMS.z }, Config.HeliEMS.h, function(heliEMS) TaskWarpPedIntoVehicle(GetPlayerPed(-1), heliEMS, -1) wzial = true delete = true end) Citizen.Wait(500) DoScreenFadeIn(500) else ESX.ShowNotification("Vous avez déjà pris un hélicoptère. Tu dois attendre ~r~" .. delay .. " ~w~minutes") end end end end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(7) local ped = PlayerPedId() local pos = GetEntityCoords(ped) if delete then DrawMarker(34, Config.DeleterEMS.x, Config.DeleterEMS.y, Config.DeleterEMS.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 2.5, 2.5, 2.5, 255, 0, 0, 100, false, true, 2, false, false, false, false) if GetDistanceBetweenCoords(pos, Config.DeleterEMS.x, Config.DeleterEMS.y, Config.DeleterEMS.z, true) < 3 then if IsControlJustReleased(0, Config.Przycisk) then ESX.Game.DeleteVehicle(GetVehiclePedIsIn(ped, false)) ESX.ShowNotification("~r~Vous avez remorqué un hélicoptère") delete = false end end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(7) local ped = PlayerPedId() local pos = GetEntityCoords(ped) if delete then DrawMarker(34, Config.DeleterLSPD.x, Config.DeleterLSPD.y, Config.DeleterLSPD.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 2.5, 2.5, 2.5, 255, 0, 0, 100, false, true, 2, false, false, false, false) if GetDistanceBetweenCoords(pos, Config.DeleterLSPD.x, Config.DeleterLSPD.y, Config.DeleterLSPD.z, true) < 3 then if IsControlJustReleased(0, Config.Przycisk) then ESX.Game.DeleteVehicle(GetVehiclePedIsIn(ped, false)) ESX.ShowNotification("~r~Vous avez remorqué un hélicoptère") delete = false end end end end end)
cflags{ '-Wall', '-Wextra', '-Wno-clobbered', '-Wno-stringop-overflow', '-D NOZOPFLI', '-isystem $builddir/pkg/zlib/include', } exe('pigz', [[ pigz.c yarn.c try.c $builddir/pkg/zlib/libz.a ]], {'pkg/zlib/headers'}) file('bin/pigz', '755', '$outdir/pigz') man{'pigz.1'} for _, alias in ipairs{'gzip', 'gunzip', 'zcat'} do sym('bin/'..alias, 'pigz') sym('share/man/man1/'..alias..'.1.gz', 'pigz.1.gz') end fetch 'git'
--[[-- h1. four.Renderer Renders renderables object with a camera. --]]-- -- Module definition local lub = require 'lub' local four = require 'four' local ffi = require 'ffi' local lens = require 'lens' local lib = lub.class 'four.Renderer' local V2 = four.V2 local V4 = four.V4 local Buffer = four.Buffer local Geometry = four.Geometry local elapsed = lens.elapsed -- h2. Renderer backends lib.GL32 = 1 lib.GLES = 2 lib.DEFAULT = lib.GL32 -- h2. Constructor --[[-- @Renderer(def)@ is a new renderer. @def@ keys: * @backend@, the renderer backend (defaults to @GL32@). * @size@, a @V2@ defining the viewport size (defaults to V2(480,270). * @error_line_pattern@, a string used to parse GPU compiler logs. Must split a line in three part, before the GLSL file number, the file number, after the file number. --]]-- function lib.new(def) local self = { backend = lib.DEFAULT, frame_start_time = -1, size = V2(480, 270), stats = lib.statsTable (), error_line_pattern = "([^:]+: *)(%d+)(:.*)", debug = true, -- More logging/diagnostics r = nil, -- Backend renderer object (private) initialized = false } -- true when backend was initalized setmetatable(self, lib) if def then self:set(def) end self:_setBackend() return self end function lib:set(def) if def.backend then self.backend = def.backend end if def.size then self.size = def.size end if def.error_line_pattern then self.error_line_pattern = def.error_line_pattern end end function lib:_setBackend() if self.backend == lib.GL32 then self.r = four.RendererGL32(self) elseif self.backend == lib.GLES then error ("GLES backend renderer unimplemented") end end -- Backend initialization function lib:_init() if not self.initialized then self.r:init() self.initialized = true end end -- h2. Renderer info function lib:info() self:_init() return self.r:getInfo() end function lib:caps() self:_init() return self.r:getCaps() end function lib:limits() self:_init() return self.r:getLimits() end -- h2. Render statistics function lib:stats() return self.stats end function lib.statsTable () return { frame_stamp = nil, -- start time of current frame frame_time = 0, -- duration of last frame max_frame_time = -math.huge, min_frame_time = math.huge, renderables = 0, -- renderables count of last frame max_renderables = -math.huge, vertices = 0, -- vertex count of last frame max_vertices = -math.huge, faces = 0, -- face count of last frame max_faces = -math.huge, sample_stamp = elapsed(), -- start time of sample sample_frame_count = 0, -- number of frames in sample frame_hz = 0, -- frame rate max_frame_hz = -math.huge, min_frame_hz = math.huge } end function lib:resetStats() self.stats = lib.statsTable () end function lib:beginStats(now) local stats = self.stats stats.frame_stamp = now stats.renderables = 0 stats.vertices = 0 stats.faces = 0 end function lib:endStats() local now = elapsed() local stats = self.stats stats.frame_time = now - stats.frame_stamp stats.max_frame_time = math.max(stats.frame_time, stats.max_frame_time) stats.min_frame_time = math.min(stats.frame_time, stats.min_frame_time) stats.max_renderables = math.max(stats.renderables, stats.max_renderables) stats.max_vertices = math.max(stats.vertices, stats.max_vertices) stats.max_faces = math.max(stats.faces, stats.max_faces) local sample_duration = now - stats.sample_stamp stats.sample_frame_count = stats.sample_frame_count + 1; if sample_duration > 1000 then stats.frame_hz = (stats.sample_frame_count / sample_duration) * 1000 stats.max_frame_hz = math.max(stats.frame_hz, stats.max_frame_hz) stats.min_frame_hz = math.min(stats.frame_hz, stats.min_frame_hz) stats.sample_frame_count = 0 stats.sample_stamp = now end end function lib:addGeometryStats(g) -- TODO this doesn't work once data was uploaded on the GPU. local stats = self.stats local v_count = g.index:scalarLength() local f_count = 0 if g.primitive == Geometry.TRIANGLES then f_count = v_count / 3 elseif g.primitive == Geometry.TRIANGLE_STRIP then f_count = v_count - 2 elseif g.primitive == Geometry.TRIANGLE_FAN then f_count = v_count - 2 elseif g.primitive == Geometry.TRIANGLES_ADJACENCY then f_count = v_count / 6 elseif g.primitive == Geometry.TRIANGLE_STRIP_ADJACENCY then fcount = v_count / 2 - 4 end stats.vertices = stats.vertices + v_count stats.faces = stats.faces + f_count stats.renderables = stats.renderables + 1 end -- h2. Renderer log --[[-- @self:log(msg)@ is called by the backend renderer to log message @msg@. Clients can override the function to redirect the renderer log (the default implementation @print@s the message). --]]-- function lib:log(msg) print(msg) end function lib:logInfo(verbose) local info = self:info() local verbose = verbose and true if not verbose then local msg = string.format("Renderer OpenGL %s / GLSL %s\n %s", info.version, info.shading_language_version, info.renderer) self:log(msg) else self:log("Renderer") for k, v in pairs(self:info()) do self:log(string.format("* %s = %s", k, v)) end end end function lib:logStats() local stats = self.stats local s = string.format self:log("Renderer stats (min/max)") self:log(s("+ %dHz (%d/%d)", stats.frame_hz, stats.min_frame_hz, stats.max_frame_hz)) self:log(s("+ %.1fms frame time (%.1f/%.1f)", stats.frame_time, stats.min_frame_time, stats.max_frame_time)) self:log(s("+ %d frame renderables (-/%d)", stats.renderables, stats.max_renderables)) self:log(s("+ %d frame vertices (-/%d)", stats.vertices, stats.max_vertices)) self:log(s("+ %d frame faces (-/%d)", stats.faces, stats.max_faces)) end -- h2. Screen coordinates --[[-- @r:normalizeScreenPos(pos [,flip])@ is the normalized position of `pos` expressed relative to the bottom left (top left if `flip` is true) corner of the rendering surface. --]]-- function lib:normalizeScreenPos(pos, flip) local np = V2.div (pos, self.size) if flip then np[2] = 1 - np[2] end return np end -- h2. Rendering objects -- @renderable(cam, o)@ is @true@ if @o@ can be rendered with @cam@. function lib:isRenderable(cam, o) local visible = o.visible == nil or o.visible local effect = cam.effect_override or o.effect return visible and o.geometry and effect end function lib:addRenderable(cam, o) if self:isRenderable(cam, o) and not cam.cull(o) then self:addGeometryStats(o.geometry) self.r:renderQueueAdd(cam, o) end end -- @render(cam, objs [, framebuffer])@ renders the renderables in @objs@ with @cam@. function lib:render(cam, objs, framebuffer) local now = elapsed() self:beginStats(now) self:_init () self.frame_start_time = now for _, o in ipairs(objs) do if not (o.render_list) then self:addRenderable(cam, o) else for _, o in ipairs(o) do self:addRenderable(cam, o) end end end self.r:renderQueueFlush(cam, framebuffer) self:endStats() end return lib
---@diagnostic disable: undefined-global -- GENERATE BY _ItemSetGen.js select(2,...).ItemSetMake()S(-17)B'2/4'I(10,35111)I(1,35112)I(7,35113)I(3,35114)I(5,35115)S(-16)B'2/4'I(5,35077)I(10,35078)I(1,35079)I(7,35080)I(3,35081)S(-15)B'2/4'I(5,35088)I(10,35089)I(1,35090)I(7,35091)I(3,35092)S(-14)B'2/4'I(10,35032)I(1,35033)I(7,35034)I(3,35035)I(5,35036)S(-13)B'2/4'I(5,35048)I(10,35049)I(1,35050)I(7,35051)I(3,35052)S(-12)B'2/4'I(10,34998)I(1,34999)I(7,35000)I(3,35001)I(5,35002)S(-11)B'2/4'I(3,35096)I(1,35097)I(10,35098)I(5,35099)I(7,35100)S(-10)B'2/4'I(10,35022)I(1,35023)I(7,35024)I(3,35025)I(5,35026)S(-9)B'2/4'I(5,35059)I(10,35060)I(1,35061)I(7,35062)I(3,35063)S(-8)B'2/4'I(10,35083)I(1,35084)I(7,35085)I(3,35086)I(5,35087)S(-7)B'2/4'I(5,34990)I(10,34991)I(1,34992)I(7,34993)I(3,34994)S(-6)B'2/4'I(10,35053)I(1,35054)I(7,35055)I(3,35056)I(5,35057)S(-5)B'2/4'I(3,35009)I(1,35010)I(10,35011)I(5,35012)I(7,35013)S(-4)B'2/4'I(5,35042)I(10,35043)I(1,35044)I(7,35045)I(3,35046)S(-3)B'2/4'I(10,35003)I(1,35004)I(7,35005)I(3,35006)I(5,35007)S(-2)B'2/4'I(5,35066)I(10,35067)I(1,35068)I(7,35069)I(3,35070)S(-1)B'2/4'I(5,35027)I(10,35028)I(1,35029)I(7,35030)I(3,35031)S(1)B'2/3/4/5'I(5,11726)I(7,11728)I(1,11729)I(10,11730)I(8,11731)S(41)B'2'I(22,12939)I(21,12940)S(65)B'2'I(13,13183)I(13,13218)S(81)B'2/3/3/4/5/5'I(5,13388)I(7,13389)I(1,13390)I(8,13391)I(11,13392)S(121)B'2/3/4/5'I(6,14636)I(5,14637)I(7,14638)I(10,14640)I(8,14641)S(122)B'2/3/4/5'I(5,14626)I(9,14629)I(8,14631)I(7,14632)I(3,14633)S(123)B'2/3/4/5'I(5,14611)I(7,14612)I(6,14614)I(10,14615)I(8,14616)S(124)B'2/3/4/5'I(6,14620)I(8,14621)I(10,14622)I(7,14623)I(5,14624)S(141)B'3'I(5,15053)I(7,15054)I(3,15055)S(142)B'2/3/4'I(5,15056)I(7,15057)I(3,15058)I(10,21278)S(143)B'2'I(7,15062)I(10,15063)S(144)B'2'I(5,15066)I(3,15067)S(161)B'2/3/4/5'I(5,10399)I(7,10400)I(10,10401)I(8,10402)I(6,10403)S(162)B'2/3/4/5'I(7,10410)I(8,10411)I(6,10412)I(10,10413)I(5,6473)S(163)B'2/3/4/5/6'I(5,10328)I(6,10329)I(7,10330)I(10,10331)I(8,10332)I(9,10333)S(181)B'2/4/6/8'I(8,16682)I(9,16683)I(10,16684)I(6,16685)I(1,16686)I(7,16687)I(5,16688)I(3,16689)S(182)B'2/4/6/8'I(5,16690)I(8,16691)I(10,16692)I(1,16693)I(7,16694)I(3,16695)I(6,16696)I(9,16697)S(183)B'2/4/6/8'I(1,16698)I(7,16699)I(5,16700)I(3,16701)I(6,16702)I(9,16703)I(8,16704)I(10,16705)S(184)B'2/4/6/8'I(1,16707)I(3,16708)I(7,16709)I(9,16710)I(8,16711)I(10,16712)I(6,16713)I(5,16721)S(185)B'2/4/4/6/8'I(5,16706)I(9,16714)I(8,16715)I(6,16716)I(10,16717)I(3,16718)I(7,16719)I(1,16720)S(186)B'2/4/6/8'I(5,16674)I(8,16675)I(10,16676)I(1,16677)I(7,16678)I(3,16679)I(6,16680)I(9,16681)S(187)B'2/4/6/8'I(5,16666)I(1,16667)I(7,16668)I(3,16669)I(8,16670)I(9,16671)I(10,16672)I(6,16673)S(188)B'2/4/6/8'I(9,16722)I(6,16723)I(10,16724)I(8,16725)I(5,16726)I(1,16727)I(7,16728)I(3,16729)S(189)B'2/4/6/8'I(5,16730)I(1,16731)I(7,16732)I(3,16733)I(8,16734)I(9,16735)I(6,16736)I(10,16737)S(201)B'3/5/8'I(1,16795)I(7,16796)I(3,16797)I(5,16798)I(9,16799)I(8,16800)I(10,16801)I(6,16802)S(202)B'3/5/8'I(8,16811)I(10,16812)I(1,16813)I(7,16814)I(5,16815)I(3,16816)I(6,16817)I(9,16819)S(203)B'3/5/8'I(8,16803)I(9,16804)I(10,16805)I(6,16806)I(3,16807)I(1,16808)I(5,16809)I(7,16810)S(204)B'3/5/8'I(5,16820)I(1,16821)I(7,16822)I(3,16823)I(8,16824)I(9,16825)I(10,16826)I(6,16827)S(205)B'3/5/8'I(6,16828)I(8,16829)I(9,16830)I(10,16831)I(5,16833)I(1,16834)I(7,16835)I(3,16836)S(206)B'3/5/8'I(5,16845)I(1,16846)I(7,16847)I(3,16848)I(8,16849)I(9,16850)I(6,16851)I(10,16852)S(207)B'3/5/8'I(8,16837)I(6,16838)I(10,16839)I(9,16840)I(5,16841)I(1,16842)I(7,16843)I(3,16844)S(208)B'3/5/5/8'I(5,16853)I(1,16854)I(7,16855)I(3,16856)I(9,16857)I(6,16858)I(8,16859)I(10,16860)S(209)B'3/5/8'I(9,16861)I(8,16862)I(10,16863)I(6,16864)I(5,16865)I(1,16866)I(7,16867)I(3,16868)S(210)B'3/5/8'I(6,16818)I(8,16912)I(10,16913)I(1,16914)I(7,16915)I(5,16916)I(3,16917)I(9,16918)S(211)B'3/5/8'I(8,16919)I(10,16920)I(1,16921)I(7,16922)I(5,16923)I(3,16924)I(6,16925)I(9,16926)S(212)B'3/5/8'I(8,16927)I(10,16928)I(1,16929)I(7,16930)I(5,16931)I(3,16932)I(6,16933)I(9,16934)S(213)B'3/5/8'I(3,16832)I(5,16905)I(8,16906)I(10,16907)I(1,16908)I(7,16909)I(6,16910)I(9,16911)S(214)B'3/5/8'I(5,16897)I(8,16898)I(10,16899)I(1,16900)I(7,16901)I(3,16902)I(6,16903)I(9,16904)S(215)B'3/5/8'I(9,16935)I(6,16936)I(3,16937)I(7,16938)I(1,16939)I(10,16940)I(8,16941)I(5,16942)S(216)B'3/5/8'I(9,16943)I(6,16944)I(3,16945)I(7,16946)I(1,16947)I(10,16948)I(8,16949)I(5,16950)S(217)B'3/5/8'I(9,16951)I(6,16952)I(3,16953)I(7,16954)I(1,16955)I(10,16956)I(8,16957)I(5,16958)S(218)B'3/5/8'I(9,16959)I(6,16960)I(3,16961)I(7,16962)I(1,16963)I(10,16964)I(8,16965)I(5,16966)S(221)B'6'I(6,7948)I(7,7949)I(5,7950)I(10,7951)I(8,7952)I(1,7953)S(241)B'2'I(12,17064)I(12,17082)S(261)B'4'I(22,18202)I(21,18203)I(16,18204)I(2,18205)S(281)B'2/4/6'I(8,16509)I(10,16510)I(5,16513)I(1,16514)I(7,16515)I(3,16516)S(282)B'2/4/6'I(8,16405)I(10,16406)I(1,16429)I(5,16430)I(7,16431)I(3,16432)S(301)B'2/4/6'I(8,16518)I(10,16519)I(1,16521)I(5,16522)I(7,16523)I(3,16524)S(321)B'2/4/6'I(5,12422)I(6,12424)I(9,12425)I(8,12426)I(1,12427)I(3,12428)I(7,12429)S(341)B'2/4/6'I(8,16485)I(10,16487)I(1,16489)I(7,16490)I(5,16491)I(3,16492)S(342)B'2/4/6'I(1,17610)I(7,17611)I(5,17612)I(3,17613)I(8,17616)I(10,17617)S(343)B'2/4/6'I(8,16369)I(10,16391)I(5,16413)I(7,16414)I(3,16415)I(1,16416)S(344)B'2/4/6'I(8,17594)I(10,17596)I(1,17598)I(7,17599)I(5,17600)I(3,17601)S(345)B'2/4/6'I(1,17570)I(7,17571)I(5,17572)I(3,17573)I(8,17576)I(10,17577)S(346)B'2/4/6'I(8,17562)I(10,17564)I(1,17566)I(7,17567)I(5,17568)I(3,17569)S(347)B'2/4/6'I(8,16498)I(10,16499)I(5,16505)I(1,16506)I(3,16507)I(7,16508)S(348)B'2/4/6'I(8,16392)I(10,16396)I(5,16417)I(1,16418)I(7,16419)I(3,16420)S(361)B'2/4/6'I(5,16525)I(1,16526)I(7,16527)I(3,16528)I(10,16530)I(8,16531)S(362)B'2/4/6'I(8,16401)I(10,16403)I(5,16425)I(7,16426)I(3,16427)I(1,16428)S(381)B'2/4/6'I(8,16393)I(10,16397)I(5,16421)I(7,16422)I(3,16423)I(1,16424)S(382)B'2/4/6'I(8,16494)I(10,16496)I(3,16501)I(7,16502)I(1,16503)I(5,16504)S(383)B'2/3/6'I(5,16541)I(1,16542)I(7,16543)I(3,16544)I(8,16545)I(10,16548)S(384)B'2/3/6'I(5,16477)I(1,16478)I(7,16479)I(3,16480)I(8,16483)I(10,16484)S(386)B'2/3/6'I(8,16573)I(10,16574)I(5,16577)I(1,16578)I(7,16579)I(3,16580)S(387)B'2/3/6'I(1,16533)I(7,16534)I(5,16535)I(3,16536)I(8,16539)I(10,16540)S(388)B'2/3/6'I(8,16437)I(10,16440)I(1,16441)I(7,16442)I(5,16443)I(3,16444)S(389)B'2/3/6'I(1,17602)I(7,17603)I(3,17604)I(5,17605)I(8,17607)I(10,17608)S(390)B'2/3/6'I(8,17618)I(10,17620)I(3,17622)I(1,17623)I(5,17624)I(7,17625)S(391)B'2/3/6'I(8,17586)I(10,17588)I(3,17590)I(1,17591)I(5,17592)I(7,17593)S(392)B'2/3/6'I(1,17578)I(7,17579)I(3,17580)I(5,17581)I(8,17583)I(10,17584)S(393)B'2/3/6'I(8,16558)I(10,16560)I(1,16561)I(3,16562)I(5,16563)I(7,16564)S(394)B'2/3/6'I(8,16446)I(5,16453)I(10,16454)I(1,16455)I(7,16456)I(3,16457)S(395)B'2/3/6'I(8,16462)I(10,16463)I(1,16465)I(5,16466)I(7,16467)I(3,16468)S(396)B'2/3/6'I(5,16565)I(1,16566)I(7,16567)I(3,16568)I(8,16569)I(10,16571)S(397)B'2/3/6'I(10,16448)I(3,16449)I(7,16450)I(1,16451)I(5,16452)I(8,16459)S(398)B'2/3/6'I(5,16549)I(1,16550)I(3,16551)I(7,16552)I(8,16554)I(10,16555)S(401)B'2/2/4/6'I(8,16409)I(10,16410)I(5,16433)I(1,16434)I(7,16435)I(3,16436)S(402)B'2/3/6'I(10,16471)I(8,16472)I(5,16473)I(1,16474)I(7,16475)I(3,16476)S(421)B'3'I(5,19682)I(7,19683)I(8,19684)S(441)B'3'I(5,19685)I(10,19686)I(9,19687)S(442)B'2/2'I(5,19688)I(3,19689)S(443)B'3'I(5,19690)I(3,19691)I(10,19692)S(444)B'3'I(5,19693)I(7,19694)I(3,19695)S(461)B'2'I(21,19865)I(22,19866)S(462)B'2/2'I(11,19893)I(11,19905)S(463)B'2'I(21,19896)I(22,19910)S(464)B'2'I(11,19873)I(11,19912)S(465)B'2'I(11,19863)I(11,19920)S(466)B'2'I(11,19898)I(11,19925)S(467)B'2/3'I(6,20041)I(8,20048)I(3,20057)S(468)B'2/3'I(6,20042)I(8,20049)I(3,20058)S(469)B'2/3'I(6,20043)I(8,20050)I(3,20055)S(470)B'2/3'I(6,20044)I(8,20051)I(3,20056)S(471)B'2/3'I(6,20045)I(8,20052)I(3,20059)S(472)B'2/3'I(6,20046)I(8,20053)I(3,20060)S(473)B'2/3'I(6,20047)I(8,20054)I(3,20061)S(474)B'2/3/5'I(2,19577)I(5,19822)I(6,19823)I(9,19824)I(12,19951)S(475)B'2/3/5'I(2,19588)I(5,19825)I(6,19826)I(9,19827)I(12,19952)S(476)B'2/3/5'I(2,19609)I(5,19828)I(6,19829)I(9,19830)I(12,19956)S(477)B'2/3/5'I(2,19621)I(3,19831)I(6,19832)I(9,19833)I(12,19953)S(478)B'2/3/5'I(2,19617)I(5,19834)I(3,19835)I(9,19836)I(12,19954)S(479)B'2/3/5'I(2,19613)I(5,19838)I(6,19839)I(9,19840)I(12,19955)S(480)B'2/3/5'I(2,19594)I(3,19841)I(6,19842)I(9,19843)I(12,19958)S(481)B'2/3/5'I(2,19605)I(9,19848)I(3,19849)I(12,19957)I(5,20033)S(482)B'2/3/5'I(2,19601)I(3,19845)I(9,19846)I(12,19959)I(5,20034)S(483)B'2/3'I(6,20150)I(8,20154)I(3,20158)S(484)B'2/3'I(6,20195)I(8,20199)I(3,20203)S(485)B'2/3'I(8,20159)I(6,20163)I(3,20176)S(486)B'2/3'I(8,20186)I(6,20190)I(3,20194)S(487)B'2/3'I(6,20204)I(8,20208)I(3,20212)S(488)B'2/3'I(8,20167)I(6,20171)I(3,20175)S(489)B'2/3/4'I(5,15050)I(3,15051)I(7,15052)I(8,16984)S(490)B'2/3'I(5,15045)I(7,15046)I(10,20296)S(491)B'2/3'I(5,15048)I(3,15049)I(7,20295)S(492)B'3'I(3,20406)I(5,20407)I(1,20408)S(493)B'3/3/5'I(1,21353)I(3,21354)I(8,21355)I(7,21356)I(5,21357)S(494)B'3'I(21,21407)I(11,21408)I(16,21409)S(495)B'3'I(13,21392)I(11,21393)I(16,21394)S(496)B'3/5'I(1,21329)I(3,21330)I(5,21331)I(7,21332)I(8,21333)S(497)B'3/5'I(8,21359)I(1,21360)I(3,21361)I(7,21362)I(5,21364)S(498)B'3'I(13,21404)I(11,21405)I(16,21406)S(499)B'3/5'I(5,21334)I(3,21335)I(7,21336)I(1,21337)I(8,21338)S(500)B'3'I(21,21416)I(11,21417)I(16,21418)S(501)B'3/5'I(1,21372)I(8,21373)I(5,21374)I(7,21375)I(3,21376)S(502)B'3'I(21,21398)I(11,21399)I(16,21400)S(503)B'3/5'I(5,21343)I(8,21344)I(3,21345)I(7,21346)I(1,21347)S(504)B'3'I(21,21413)I(11,21414)I(16,21415)S(505)B'3/5'I(1,21387)I(8,21388)I(5,21389)I(7,21390)I(3,21391)S(506)B'3'I(13,21395)I(11,21396)I(16,21397)S(507)B'3/5'I(1,21348)I(8,21349)I(3,21350)I(5,21351)I(7,21352)S(508)B'3'I(21,21410)I(11,21411)I(16,21412)S(509)B'3/5'I(8,21365)I(1,21366)I(3,21367)I(7,21368)I(5,21370)S(510)B'3'I(13,21401)I(11,21402)I(16,21403)S(511)B'2/4/6/8'I(6,21994)I(8,21995)I(9,21996)I(5,21997)I(10,21998)I(1,21999)I(7,22000)I(3,22001)S(512)B'2/4/6/8'I(6,22002)I(8,22003)I(9,22004)I(1,22005)I(10,22006)I(7,22007)I(3,22008)I(5,22009)S(513)B'2/4/6/6/8'I(6,22106)I(8,22107)I(9,22108)I(1,22109)I(10,22110)I(7,22111)I(3,22112)I(5,22113)S(514)B'2/4/6/8'I(6,22078)I(9,22079)I(1,22080)I(10,22081)I(3,22082)I(5,22083)I(8,22084)I(7,22085)S(515)B'2/4/6/8'I(6,22010)I(9,22011)I(1,22013)I(10,22015)I(3,22016)I(7,22017)I(5,22060)I(8,22061)S(516)B'2/4/6/8'I(6,22086)I(8,22087)I(9,22088)I(5,22089)I(10,22090)I(1,22091)I(7,22092)I(3,22093)S(517)B'2/4/6/8'I(6,22062)I(9,22063)I(8,22064)I(1,22065)I(10,22066)I(7,22067)I(3,22068)I(5,22069)S(518)B'2/4/6/8'I(6,22070)I(9,22071)I(7,22072)I(3,22073)I(1,22074)I(5,22075)I(8,22076)I(10,22077)S(519)B'2/4/6/8'I(9,22095)I(8,22096)I(1,22097)I(6,22098)I(10,22099)I(7,22100)I(3,22101)I(5,22102)S(520)B'4/8'I(5,22301)I(1,22302)I(7,22303)I(10,22304)I(3,22305)I(6,22306)I(8,22311)I(9,22313)S(521)B'2/4/6/8'I(5,22488)I(7,22489)I(1,22490)I(3,22491)I(8,22492)I(10,22493)I(6,22494)I(9,22495)I(11,23064)S(522)B'2/4/6'I(8,22856)I(10,22864)I(5,22879)I(7,22880)I(1,23257)I(3,23258)S(523)B'2/4/6/8'I(5,22416)I(7,22417)I(1,22418)I(3,22419)I(8,22420)I(10,22421)I(6,22422)I(9,22423)I(11,23059)S(524)B'2/4/6/8'I(5,22476)I(7,22477)I(1,22478)I(3,22479)I(8,22480)I(10,22481)I(6,22482)I(9,22483)I(11,23060)S(525)B'2/4/6/8'I(5,22512)I(7,22513)I(1,22514)I(3,22515)I(8,22516)I(10,22517)I(6,22518)I(9,22519)I(11,23061)S(526)B'2/4/6/8'I(5,22496)I(7,22497)I(1,22498)I(3,22499)I(8,22500)I(10,22501)I(6,22502)I(9,22503)I(11,23062)S(527)B'2/4/6/8'I(5,22464)I(7,22465)I(1,22466)I(3,22467)I(8,22468)I(10,22469)I(6,22470)I(9,22471)I(11,23065)S(528)B'2/4/6/8'I(9,22424)I(5,22425)I(10,22426)I(7,22427)I(1,22428)I(3,22429)I(8,22430)I(6,22431)I(11,23066)S(529)B'2/4/6/8'I(5,22504)I(7,22505)I(1,22506)I(3,22507)I(8,22508)I(10,22509)I(6,22510)I(9,22511)I(11,23063)S(530)B'2/4/6/8'I(5,22436)I(7,22437)I(1,22438)I(3,22439)I(8,22440)I(10,22441)I(6,22442)I(9,22443)I(11,23067)S(533)B'3'I(10,23078)I(5,23087)I(9,23090)S(534)B'3'I(10,23081)I(5,23089)I(9,23093)S(535)B'3'I(10,23082)I(5,23088)I(9,23092)S(536)B'3'I(10,23084)I(5,23085)I(9,23091)S(537)B'2/4/6'I(8,22858)I(10,22868)I(5,22872)I(7,22873)I(3,23243)I(1,23244)S(538)B'2/4/6'I(8,22857)I(10,22867)I(5,22876)I(7,22887)I(1,23259)I(3,23260)S(539)B'2/4/6'I(8,22852)I(10,22863)I(5,22877)I(7,22878)I(1,23253)I(3,23254)S(540)B'2/4/6'I(8,22859)I(10,22869)I(7,22882)I(5,22885)I(1,23261)I(3,23262)S(541)B'2/4/6'I(8,22855)I(10,22865)I(7,22881)I(5,22884)I(1,23255)I(3,23256)S(542)B'2/4/6'I(8,22860)I(10,22870)I(7,22883)I(5,22886)I(1,23263)I(3,23264)S(543)B'2/4/6'I(8,22843)I(10,22862)I(5,22874)I(7,22875)I(1,23251)I(3,23252)S(544)B'2/4/6'I(5,23272)I(7,23273)I(10,23274)I(8,23275)I(1,23276)I(3,23277)S(545)B'2/4/6'I(10,23286)I(8,23287)I(5,23300)I(7,23301)I(1,23314)I(3,23315)S(546)B'2/4/6'I(10,23290)I(8,23291)I(7,23304)I(5,23305)I(1,23318)I(3,23319)S(547)B'2/4/6'I(10,23282)I(8,23283)I(7,23296)I(5,23297)I(1,23310)I(3,23311)S(548)B'2/4/6'I(10,23284)I(8,23285)I(5,23298)I(7,23299)I(1,23312)I(3,23313)S(549)B'2/4/6'I(10,23288)I(8,23289)I(7,23302)I(5,23303)I(1,23316)I(3,23317)S(550)B'2/4/6'I(8,23278)I(10,23279)I(5,23292)I(7,23293)I(1,23306)I(3,23307)S(551)B'2/4/6'I(10,23280)I(8,23281)I(5,23294)I(7,23295)I(1,23308)I(3,23309)S(552)B'3'I(6,21846)I(10,21847)I(5,21848)S(553)B'3'I(3,21869)I(8,21870)I(5,21871)S(554)B'3'I(6,21873)I(3,21874)I(5,21875)S(555)B'2/4'I(9,21849)I(6,21850)I(10,21851)I(7,21852)I(8,21853)I(5,21854)I(5,21855)S(556)B'3'I(7,21859)I(8,21860)I(5,21861)I(5,21862)S(557)B'3'I(10,21863)I(3,21864)I(5,21865)S(558)B'3'I(9,21866)I(8,21867)I(5,21868)S(559)B'2'I(7,24262)I(1,24266)S(560)B'2/4'I(10,23482)I(6,23484)I(8,23487)I(7,23488)I(5,23489)S(561)B'2/4'I(5,23490)I(10,23491)I(1,23493)I(9,23494)S(562)B'3'I(9,23506)I(5,23507)I(10,23508)S(563)B'3'I(5,23509)I(6,23510)I(8,23511)I(7,23512)S(564)B'3'I(5,23513)I(10,23514)I(9,23515)I(1,23516)S(565)B'3'I(7,23523)I(6,23524)I(8,23525)S(566)B'2'I(10,23520)I(1,23521)I(5,23522)I(3,33173)S(567)B'2/4'I(5,24544)I(1,24545)I(3,24546)I(7,24547)I(10,24549)S(568)B'2/4'I(5,24552)I(1,24553)I(3,24554)I(7,24555)I(10,24556)S(569)B'3'I(10,23517)I(7,23518)I(1,23519)S(570)B'2'I(9,24249)I(6,24255)S(571)B'2'I(7,24261)I(1,24264)S(572)B'2'I(7,24263)I(1,24267)S(573)B'3'I(10,25685)I(8,25686)I(7,25687)S(574)B'3'I(5,25689)I(7,25690)I(8,25691)S(575)B'3'I(6,25695)I(5,25696)I(9,25697)S(576)B'3'I(7,25692)I(8,25693)I(6,25694)S(577)B'2/4'I(1,25830)I(5,25831)I(3,25832)I(7,25833)I(10,25834)S(578)B'2/4'I(5,25997)I(1,25998)I(3,25999)I(10,26000)I(7,26001)S(579)B'2/4'I(3,25854)I(1,25855)I(5,25856)I(10,25857)I(7,25858)S(580)B'2/4'I(5,27469)I(10,27470)I(1,27471)I(7,27472)I(3,27473)S(581)B'2/4'I(10,27707)I(1,27708)I(7,27709)I(3,27710)I(5,27711)S(582)B'2/4'I(5,27702)I(10,27703)I(1,27704)I(7,27705)I(3,27706)S(583)B'2/4'I(5,27879)I(10,27880)I(1,27881)I(7,27882)I(3,27883)S(584)B'2/4'I(10,28126)I(1,28127)I(7,28128)I(3,28129)I(5,28130)S(585)B'2/4'I(10,28136)I(1,28137)I(7,28138)I(3,28139)I(5,28140)S(586)B'2/4'I(1,28331)I(7,28332)I(3,28333)I(5,28334)I(10,28335)S(587)B'2/4'I(5,28831)I(10,28832)I(1,28833)I(7,28834)I(3,28835)S(588)B'2/4'I(5,28851)I(10,28852)I(1,28853)I(7,28854)I(3,28855)S(589)B'2/4'I(5,28679)I(10,28680)I(1,28681)I(3,28683)I(7,28724)S(590)B'2/4'I(5,28699)I(10,28700)I(1,28701)I(7,28702)I(3,28703)S(591)B'2/4'I(10,28624)I(1,28625)I(7,28626)I(3,28627)I(5,28628)S(592)B'2/4'I(10,28817)I(1,28818)I(7,28819)I(3,28820)I(5,28821)S(593)B'2/4'I(5,28689)I(10,28690)I(1,28691)I(7,28692)I(3,28693)S(594)B'2/4'I(5,28841)I(10,28842)I(1,28843)I(7,28844)I(3,28845)S(595)B'2/4'I(5,28613)I(10,28614)I(1,28615)I(7,28616)I(3,28617)S(596)B'2/4'I(5,28805)I(10,28806)I(1,28807)I(7,28808)I(3,28809)S(597)B'2/4'I(10,28704)I(1,28705)I(7,28706)I(3,28707)I(5,28708)S(598)B'2/4'I(10,28856)I(1,28857)I(7,28858)I(3,28859)I(5,28860)S(599)B'2/4'I(3,28714)I(1,28715)I(10,28716)I(5,28717)I(7,28718)S(600)B'2/4'I(3,28866)I(1,28867)I(10,28868)I(5,28869)I(7,28870)S(601)B'2/4'I(10,28618)I(1,28619)I(7,28620)I(3,28622)I(5,28623)S(602)B'2/4'I(10,28811)I(1,28812)I(7,28813)I(3,28814)I(5,28815)S(603)B'2/4'I(5,28694)I(10,28695)I(1,28696)I(7,28697)I(3,28698)S(604)B'2/4'I(5,28846)I(10,28847)I(1,28848)I(7,28849)I(3,28850)S(605)B'2/4'I(10,28684)I(1,28685)I(7,28686)I(3,28687)I(5,28688)S(606)B'2/4'I(10,28836)I(1,28837)I(7,28838)I(3,28839)I(5,28840)S(607)B'2/4'I(5,28709)I(10,28710)I(1,28711)I(7,28712)I(3,28713)S(608)B'2/4'I(5,28861)I(10,28862)I(1,28863)I(7,28864)I(3,28865)S(609)B'2/4'I(10,28719)I(1,28720)I(7,28721)I(3,28722)I(5,28723)S(610)B'2/4'I(10,28871)I(1,28872)I(7,28873)I(3,28874)I(5,28875)S(611)B'2/4'I(10,25654)I(8,25655)I(7,25656)I(5,25657)S(612)B'2/4'I(8,25659)I(5,25660)I(10,25661)I(7,25662)S(613)B'2/4'I(8,25668)I(10,25669)I(7,25670)I(5,25671)S(614)B'2/4'I(8,25673)I(10,25674)I(7,25675)I(5,25676)S(615)B'2/4'I(3,30186)I(1,30187)I(10,30188)I(5,30200)I(7,30201)S(616)B'3'I(5,29515)I(6,29516)I(9,29517)S(617)B'3'I(5,29519)I(6,29520)I(9,29521)S(618)B'3'I(5,29522)I(9,29523)I(6,29524)S(619)B'3'I(5,29525)I(6,29526)I(9,29527)S(620)B'2/4'I(10,27509)I(3,27776)I(7,27908)I(5,28204)I(1,28414)S(621)B'2/4'I(1,29044)I(5,29045)I(7,29046)I(3,29047)I(10,29048)S(622)B'2/4'I(5,30144)I(10,30145)I(1,30146)I(7,30148)I(3,30149)S(623)B'2/4'I(10,27535)I(3,27739)I(7,27839)I(5,28203)I(1,28285)S(624)B'2/4'I(1,29061)I(5,29062)I(7,29063)I(3,29064)I(10,29065)S(625)B'2/4'I(5,29066)I(10,29067)I(1,29068)I(7,29069)I(3,29070)S(626)B'2/4'I(5,29071)I(10,29072)I(1,29073)I(7,29074)I(3,29075)S(627)B'2/4'I(5,30134)I(10,30135)I(1,30136)I(7,30137)I(3,30138)S(628)B'2/4'I(5,30123)I(10,30124)I(1,30125)I(7,30126)I(3,30127)S(629)B'2/4'I(5,30129)I(10,30130)I(1,30131)I(7,30132)I(3,30133)S(630)B'2/4'I(10,27510)I(3,27802)I(7,27909)I(5,28231)I(1,28349)S(631)B'2/4'I(1,29028)I(5,29029)I(7,29030)I(3,29031)I(10,29032)S(632)B'2/4'I(5,29033)I(10,29034)I(1,29035)I(7,29036)I(3,29037)S(633)B'2/4'I(5,29038)I(10,29039)I(1,29040)I(7,29042)I(3,29043)S(634)B'2/4'I(5,30164)I(10,30165)I(1,30166)I(7,30167)I(3,30168)S(635)B'2/4'I(5,30169)I(10,30170)I(1,30171)I(7,30172)I(3,30173)S(636)B'2/4'I(5,30185)I(10,30189)I(1,30190)I(7,30192)I(3,30194)S(637)B'2/4'I(10,27468)I(3,27737)I(7,27873)I(5,28202)I(1,28348)S(638)B'2/4'I(1,29086)I(5,29087)I(7,29088)I(3,29089)I(10,29090)S(639)B'2/4'I(5,29091)I(10,29092)I(1,29093)I(7,29094)I(3,29095)S(640)B'2/2/4/4'I(5,29096)I(10,29097)I(1,29098)I(7,29099)I(3,29100)S(641)B'2/4'I(5,30222)I(10,30223)I(1,30228)I(7,30229)I(3,30230)S(642)B'2/4'I(5,30216)I(10,30217)I(1,30219)I(7,30220)I(3,30221)S(643)B'2/4'I(5,30231)I(10,30232)I(1,30233)I(7,30234)I(3,30235)S(644)B'2/4'I(10,27537)I(3,27778)I(7,27948)I(5,28232)I(1,28415)S(645)B'2/2/4'I(1,28963)I(5,28964)I(7,28966)I(3,28967)I(10,28968)S(646)B'2/4'I(10,30211)I(1,30212)I(7,30213)I(5,30214)I(3,30215)S(647)B'2/4'I(10,27508)I(3,27738)I(7,27838)I(5,28229)I(1,28278)S(648)B'2/4'I(1,29076)I(5,29077)I(7,29078)I(3,29079)I(10,29080)S(649)B'2/4'I(5,30196)I(10,30205)I(1,30206)I(7,30207)I(3,30210)S(650)B'2/4'I(10,27474)I(3,27801)I(7,27874)I(5,28228)I(1,28275)S(651)B'2/4'I(1,29081)I(5,29082)I(7,29083)I(3,29084)I(10,29085)S(652)B'2/4'I(5,30139)I(10,30140)I(1,30141)I(7,30142)I(3,30143)S(653)B'2/4'I(10,27475)I(3,27803)I(7,27977)I(5,28205)I(1,28350)S(654)B'2/4'I(1,29011)I(5,29012)I(7,29015)I(3,29016)I(10,29017)S(655)B'2/4'I(5,29019)I(10,29020)I(1,29021)I(7,29022)I(3,29023)S(656)B'2/4'I(5,30113)I(10,30114)I(1,30115)I(7,30116)I(3,30117)S(657)B'2/4'I(5,30118)I(10,30119)I(1,30120)I(7,30121)I(3,30122)S(658)B'2/4'I(10,27465)I(3,27796)I(7,27907)I(5,28191)I(1,28193)S(659)B'2/4'I(10,27531)I(3,27797)I(7,27837)I(1,28224)I(5,28264)S(660)B'2/4'I(10,27528)I(3,27713)I(7,27936)I(1,28192)I(5,28401)S(661)B'2/4'I(10,27497)I(3,27771)I(7,27870)I(1,28225)I(5,28403)S(662)B'2/4'I(10,27536)I(3,27775)I(7,27875)I(5,28230)I(1,28413)S(663)B'2/4'I(1,29049)I(5,29050)I(7,29053)I(3,29054)I(10,29055)S(664)B'2/4'I(5,29056)I(10,29057)I(1,29058)I(7,29059)I(3,29060)S(665)B'2/4'I(5,30150)I(10,30151)I(1,30152)I(7,30153)I(3,30154)S(666)B'2/4'I(5,30159)I(10,30160)I(1,30161)I(7,30162)I(3,30163)S(667)B'2'I(2,31338)I(11,31339)S(668)B'2/4'I(10,31026)I(1,31027)I(5,31028)I(7,31029)I(3,31030)I(9,34448)I(6,34558)I(8,34575)S(669)B'2/4'I(10,31001)I(1,31003)I(5,31004)I(7,31005)I(3,31006)I(9,34443)I(6,34549)I(8,34570)S(670)B'2/4'I(10,31050)I(1,31051)I(5,31052)I(7,31053)I(3,31054)I(9,34436)I(6,34541)I(8,34564)S(671)B'2/4'I(10,31055)I(1,31056)I(5,31057)I(7,31058)I(3,31059)I(9,34447)I(6,34557)I(8,34574)S(672)B'2/4'I(10,30969)I(1,30972)I(5,30975)I(7,30977)I(3,30979)I(9,34441)I(6,34546)I(8,34569)S(673)B'2/4'I(10,30970)I(1,30974)I(5,30976)I(7,30978)I(3,30980)I(9,34442)I(6,34547)I(8,34568)S(674)B'2/4'I(10,31061)I(1,31064)I(5,31065)I(7,31067)I(3,31070)I(9,34434)I(6,34528)I(8,34563)S(675)B'2/4'I(10,31060)I(1,31063)I(5,31066)I(7,31068)I(3,31069)I(9,34435)I(6,34527)I(8,34562)S(676)B'2/4'I(10,31034)I(1,31039)I(5,31042)I(7,31044)I(3,31048)I(9,34444)I(6,34556)I(8,34573)S(677)B'2/4'I(10,31035)I(1,31040)I(5,31043)I(7,31046)I(3,31049)I(9,34446)I(6,34555)I(8,34572)S(678)B'2/4'I(10,31032)I(1,31037)I(5,31041)I(7,31045)I(3,31047)I(9,34445)I(6,34554)I(8,34571)S(679)B'2/4'I(10,30985)I(1,30987)I(5,30991)I(7,30995)I(3,30998)I(9,34433)I(6,34488)I(8,34560)S(680)B'2/4'I(10,30982)I(1,30989)I(5,30990)I(7,30993)I(3,30997)I(9,34431)I(6,34485)I(8,34561)S(681)B'2/4'I(10,30983)I(1,30988)I(5,30992)I(7,30994)I(3,30996)I(9,34432)I(6,34487)I(8,34559)S(682)B'2/4'I(10,31011)I(1,31015)I(5,31018)I(7,31021)I(3,31024)I(9,34439)I(6,34545)I(8,34567)S(683)B'2/4'I(10,31007)I(1,31012)I(5,31016)I(7,31019)I(3,31022)I(9,34438)I(6,34543)I(8,34565)S(684)B'2/4'I(10,31008)I(1,31014)I(5,31017)I(7,31020)I(3,31023)I(9,34437)I(6,34542)I(8,34566)S(685)B'2/4'I(10,31375)I(1,31376)I(7,31377)I(3,31378)I(5,31379)S(686)B'2/4'I(5,31396)I(10,31397)I(1,31400)I(7,31406)I(3,31407)S(687)B'2/4'I(10,31409)I(1,31410)I(7,31411)I(3,31412)I(5,31413)S(688)B'2/4'I(10,31589)I(1,31590)I(7,31591)I(3,31592)I(5,31593)S(689)B'2/4'I(10,31584)I(1,31585)I(7,31586)I(3,31587)I(5,31588)S(690)B'2/4'I(5,31613)I(10,31614)I(1,31616)I(7,31618)I(3,31619)S(691)B'2/4'I(10,31620)I(1,31622)I(7,31623)I(3,31624)I(5,31625)S(692)B'2/4'I(10,31621)I(1,31626)I(7,31627)I(3,31628)I(5,31629)S(693)B'2/4'I(5,31630)I(10,31631)I(1,31632)I(7,31633)I(3,31634)S(694)B'2/4'I(5,31635)I(10,31636)I(1,31637)I(7,31638)I(3,31639)S(695)B'2/4'I(5,31640)I(10,31641)I(1,31642)I(7,31643)I(3,31644)S(696)B'2/4'I(5,31646)I(10,31647)I(1,31648)I(7,31649)I(3,31650)S(697)B'2/3/6'I(10,29600)I(8,29601)I(5,29602)I(7,29603)I(1,29604)I(3,29605)S(698)B'2/3/6'I(8,29612)I(10,29613)I(7,29614)I(5,29615)I(1,29616)I(3,29617)S(699)B'2/2'I(21,32837)I(22,32838)S(700)B'2/4'I(5,31992)I(10,31993)I(7,31995)I(3,31996)I(1,31997)S(701)B'2/4'I(5,30486)I(10,30487)I(1,30488)I(7,30489)I(3,30490)S(702)B'2/4'I(10,31973)I(1,31974)I(7,31975)I(3,31976)I(5,31977)S(703)B'2/4'I(5,32004)I(10,32005)I(1,32006)I(7,32007)I(3,32008)S(704)B'2/4'I(3,31979)I(1,31980)I(10,31981)I(5,31982)I(7,31983)S(705)B'2/4'I(10,32015)I(1,32016)I(7,32017)I(3,32018)I(5,32019)S(706)B'2/4'I(5,31960)I(10,31961)I(1,31962)I(7,31963)I(3,31964)S(707)B'2/4'I(10,32034)I(1,32035)I(7,32036)I(3,32037)I(5,32038)S(708)B'2/4'I(5,32020)I(10,32021)I(1,32022)I(7,32023)I(3,32024)S(709)B'2/4'I(10,31987)I(1,31988)I(7,31989)I(3,31990)I(5,31991)S(710)B'2/4'I(3,32047)I(1,32048)I(10,32049)I(5,32050)I(7,32051)S(711)B'2/4'I(10,31967)I(1,31968)I(7,31969)I(3,31971)I(5,31972)S(712)B'2/4'I(5,32009)I(10,32010)I(1,32011)I(7,32012)I(3,32013)S(713)B'2/4'I(10,31998)I(1,31999)I(7,32000)I(3,32001)I(5,32002)S(714)B'2/4'I(5,32039)I(10,32040)I(1,32041)I(7,32042)I(3,32043)S(715)B'2/4'I(5,32029)I(10,32030)I(1,32031)I(7,32032)I(3,32033)S(716)B'2/4'I(10,32056)I(1,32057)I(7,32058)I(3,32059)I(5,32060)S(717)B'2/3/6'I(8,29606)I(10,29607)I(7,29608)I(5,29609)I(1,29610)I(3,29611)S(718)B'2/4/6'I(8,29594)I(10,29595)I(5,29596)I(7,29597)I(1,29598)I(3,29599)S(719)B'2'I(22,32945)I(21,32946)S(720)B'2/4'I(10,33690)I(1,33691)I(7,33692)I(3,33693)I(5,33694)S(721)B'2/4'I(10,33671)I(1,33672)I(7,33673)I(3,33674)I(5,33675)S(722)B'2/4'I(10,33767)I(1,33768)I(7,33769)I(3,33770)I(5,33771)S(723)B'2/4'I(5,33664)I(10,33665)I(1,33666)I(7,33667)I(3,33668)S(724)B'2/4'I(3,33757)I(1,33758)I(10,33759)I(5,33760)I(7,33761)S(725)B'2/4'I(5,33722)I(10,33723)I(1,33724)I(7,33725)I(3,33726)S(726)B'2/4'I(5,33749)I(10,33750)I(1,33751)I(7,33752)I(3,33753)S(727)B'2/4'I(5,33695)I(10,33696)I(1,33697)I(7,33698)I(3,33699)S(728)B'2/4'I(10,33717)I(1,33718)I(7,33719)I(3,33720)I(5,33721)S(729)B'2/4'I(10,33744)I(1,33745)I(7,33746)I(3,33747)I(5,33748)S(730)B'2/4'I(10,33700)I(1,33701)I(7,33702)I(3,33703)I(5,33704)S(731)B'2/4'I(5,33738)I(10,33739)I(1,33740)I(7,33741)I(3,33742)S(732)B'2/4'I(5,33706)I(10,33707)I(1,33708)I(7,33709)I(3,33710)S(733)B'2/4'I(5,33711)I(10,33712)I(1,33713)I(7,33714)I(3,33715)S(734)B'2/4'I(10,33676)I(1,33677)I(7,33678)I(3,33679)I(5,33680)S(735)B'2/4'I(3,33682)I(1,33683)I(10,33684)I(5,33685)I(7,33686)S(736)B'2/4'I(5,33728)I(10,33729)I(1,33730)I(7,33731)I(3,33732)S(737)B'2'I(13,28189)I(13,34703)S(738)B'2/4'I(10,35328)I(1,35329)I(7,35330)I(3,35331)I(5,35332)S(739)B'2/4'I(1,35333)I(7,35334)I(10,35335)I(3,35336)I(5,35337)S(740)B'2/4'I(10,35338)I(1,35339)I(7,35340)I(3,35341)I(5,35342)S(741)B'2/4'I(3,35343)I(1,35344)I(10,35345)I(5,35346)I(7,35347)S(742)B'2/4'I(10,35356)I(1,35357)I(7,35358)I(3,35359)I(5,35360)S(743)B'2/4'I(10,35371)I(1,35372)I(7,35373)I(3,35374)I(5,35375)S(744)B'2/4'I(10,35361)I(1,35362)I(7,35363)I(3,35364)I(5,35365)S(745)B'2/4'I(10,35366)I(1,35367)I(7,35368)I(3,35369)I(5,35370)S(746)B'2/4'I(5,35386)I(10,35387)I(1,35388)I(7,35389)I(3,35390)S(747)B'2/4'I(5,35391)I(10,35392)I(1,35393)I(7,35394)I(3,35395)S(748)B'2/4'I(5,35381)I(10,35382)I(1,35383)I(7,35384)I(3,35385)S(749)B'2/4'I(5,35376)I(10,35377)I(1,35378)I(7,35379)I(3,35380)S(750)B'2/4'I(5,35407)I(10,35408)I(1,35409)I(7,35410)I(3,35411)S(751)B'2/4'I(5,35402)I(10,35403)I(1,35404)I(7,35405)I(3,35406)S(752)B'2/4'I(5,35412)I(10,35413)I(1,35414)I(7,35415)I(3,35416)
--------------------------------------------------------------------------------------- -- @function 增强的table模块 -- @author ArisHu -- @Note --------------------------------------------------------------------------------------- local base = _G local table = require("table") local string = require("string") local legend = require("legend") legend.common.table = {} local _M = legend.common.table function _M: return _M
local layerBase = require("games/common2/module/layerBase"); --[[ 房间保险任务奖励 ]] local RoomTaskReward = class(layerBase); RoomTaskReward.s_cmds = { }; RoomTaskReward.ctor = function(self) self:removeStateBroadcast(); end RoomTaskReward.dtor = function(self) end RoomTaskReward.parseViewConfig = function(self) local viewConfig = { ["onlooker"] = {}; }; return viewConfig; end -- 初始化layer的配置 RoomTaskReward.initViewConfig = function(self) self.m_viewConfig = { [1] = { path = "games/common2/module/roomtaskreward/roomTaskRewardView"; }; [2] = { }; [3] = { }; }; end return RoomTaskReward; --[[ 完成牌任务,领奖奖励 创建方式 local action = GameMechineConfig.ACTION_NS_CREATVIEW; local data = {viewName = GameMechineConfig.VIEW_BOXVIEW} MechineManage.getInstance():receiveAction(action,data); 监听动作: ACTION_NS_SHOWBOXVIEW:显示宝箱界面 ACTION_NS_OPEN_BOX:打开宝箱,领奖奖励 ]]
--!A cross-platform build utility based on Lua -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- Copyright (C) 2015 - 2019, TBOOX Open Source Group. -- -- @author ruki -- @file clean.lua -- -- imports import("core.base.option") import("core.project.cache") import("core.package.package") -- clear the unused or invalid package directories function _clear_packagedirs(packagedir) -- clear them local package_name = path.filename(packagedir) for _, versiondir in ipairs(os.dirs(path.join(packagedir, "*"))) do local version = path.filename(versiondir) for _, hashdir in ipairs(os.dirs(path.join(versiondir, "*"))) do local hash = path.filename(hashdir) local references_file = path.join(hashdir, "references.txt") local referenced = false local references = os.isfile(references_file) and io.load(references_file) or nil if references then for projectdir, refdate in pairs(references) do if os.isdir(projectdir) then referenced = true break end end end local manifest_file = path.join(hashdir, "manifest.txt") local status = nil if os.emptydir(hashdir) then status = "empty" elseif not referenced then status = "unused" elseif not os.isfile(manifest_file) then status = "invalid" end if status then local description = string.format("remove this ${magenta}%s-%s${clear}/${yellow}%s${clear} (${red}%s${clear})", package_name, version, hash, status) local confirm = utils.confirm({default = true, description = description}) if confirm then os.rm(hashdir) end end end if os.emptydir(versiondir) then os.rm(versiondir) end end if os.emptydir(packagedir) then os.rm(packagedir) end end -- clean the given or all package caches function main(package_names) -- trace print("clearing packages ..") -- clear all unused packages local installdir = package.installdir() if package_names then for _, package_name in ipairs(package_names) do for _, packagedir in ipairs(os.dirs(path.join(installdir, package_name:sub(1, 1), package_name))) do _clear_packagedirs(packagedir) end end else for _, packagedir in ipairs(os.dirs(path.join(installdir, "*", "*"))) do _clear_packagedirs(packagedir) end end -- trace print("clearing caches ..") -- clear cache directory os.rm(package.cachedir()) -- clear require cache local require_cache = cache("local.require") require_cache:clear() require_cache:flush() end
-------------------------------- -- NO JUMPING -------------------------------- loadfile(GetDataPath() .. "Scripts/Locale.lua")() local specialGear = nil function onGameInit() Goals = loc("Jumping is disabled") end function onNewTurn() SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) end function onGearAdd(gear) if (GetGearType(gear) == gtJetpack) or (GetGearType(gear) == gtRope) or (GetGearType(gear) == gtParachute) then specialGear = gear SetInputMask(band(0xFFFFFFFF, bnot(gmHJump))) end end function onGearDelete(gear) if (GetGearType(gear) == gtJetpack) or (GetGearType(gear) == gtRope) or (GetGearType(gear) == gtParachute) then specialGear = nil SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) end end
local _unpack = unpack local _stringformat = string.format local _tostring = tostring local _tonumber = tonumber --VALIDATION if(not KEYS[1]) then return redis.error_reply('NO ROOM NAME KEY') end if(not ARGV[1]) then return redis.error_reply('NO NODE TIME KEY') end if(ARGV[2] and not cjson.decode(ARGV[2])) then return redis.error_reply('NO UPDATE DATA') end --======================================================================== -- UTILITY Functions --======================================================================== local convertValueType = function(value) local newVal, isNumeric, isString isNumeric = _tonumber(value) if(isNumeric) then return isNumeric else isString = _tostring(value) if(not isString) then return nil elseif(isString == 'true' or isString == 'false') then return isString == 'true' else return isString end end end local function isValidRoomType(type) return type and (type == 'realtime' or type == 'turnbased' or type == 'system' or type == 'standard') --todo: add different types here or reference table end --======================================================================== -- CORE Functions --======================================================================== local clientRoomName = KEYS[1] local nodeTime = cjson.decode(ARGV[1]) local omitRoomData = ARGV[2] local rk = { countsOverall = "counts|overall", tickRooms = "tick|rooms", roomName = "rooms|"..KEYS[1], roomInfo = "rooms|"..KEYS[1].."|info", roomHistory = "rooms|"..KEYS[1].."|history", roomMessages = "rooms|"..KEYS[1].."|messages", roomBots = "rooms|"..KEYS[1].."|bots", roomReserves = "rooms|"..KEYS[1].."|reserves", roomOptIns = "rooms|"..KEYS[1].."|optIns", roomMatchState = "rooms|"..KEYS[1].."|matchState", roomTurnState = "rooms|"..KEYS[1].."|turnState" } local numSubscribers = 0 local sessionIds = {} local response = {} local roomExists, userId, roomType, roomSubscribeType, isClientBot, roomData local isGameRoom,isTurnBased,seatKey, seat, searchTerm, searchResult, hexastore, isSystem, reservesOnly, isLobby, isOverall local numBots --skip system rooms isSystem = redis.call('hexists', rk.roomInfo, 'isSystem') == 1 if(isSystem) then return redis.status_reply('SYSTEM OK') end --check if room exists roomExists = redis.call('exists', rk.roomInfo) == 1 and redis.call('hexists',rk.roomInfo, 'destroying') == 0 if(not roomExists) then return redis.error_reply('ROOM NO EXIST - '..clientRoomName) end --check if room is locked if(not redis.call('exists', rk.roomName..':locked') == 0) then return redis.error_reply('ROOM LOCKED - '..clientRoomName) end --check roomType roomType = redis.call('hget', rk.roomInfo, 'roomType') if(not isValidRoomType(roomType)) then return redis.error_reply('INVALID ROOM TYPE - '..clientRoomName) end --get session ids to room searchTerm = '[pos||is-sub-of||'..clientRoomName..'||' searchResult = redis.call('zrangebylex', 'hex|sessions:rooms', searchTerm, searchTerm..'\xff') if(#searchResult <= 0) then return redis.error_reply('EMPTY ROOM - '..clientRoomName) end for x=1, #searchResult do sessionIds[x] = searchResult[x]:sub(#searchTerm) end --get room info --TODO: only get certain fields roomData = redis.call('hgetall', rk.roomInfo) local x = 1 while x <= #roomData do response[roomData[x]] = convertValueType(roomData[x+1]) x = x + 2 end isGameRoom = redis.call('hexists', rk.roomInfo, 'isGameRoom') == 1 isTurnBased = redis.call('hexists', rk.roomInfo, 'isTurnBased') == 1 isLobby = redis.call('hexists', rk.roomInfo, 'isLobby') == 1 isOverall = redis.call('hexists', rk.roomInfo, 'isOverall') == 1 --get subs roomType = _tonumber(response.roomType) numBots = _tonumber(response.bots) --[[local response = { room = clientRoomName, botsList = numBots and redis.call('smembers', rk.roomBots) or {} }]] --if game room if(isGameRoom) then --lobby overwrites all if(isLobby) then if(isOverall) then response.counts = redis.call('zrange', rk.countsOverall, 0,-1, 'WITHSCORES') else response.counts = redis.call('zrange', rk.countsGame, 0,-1, 'WITHSCORES') end else --any type of game room (except lobby) response.players = sessionIds if(isGameRoom and not isTurnBased) then -- only real time end if(isTurnBased) then local optInKey = redis.call('lindex', rk.roomOptIns, 0) local matchId -- turn based response.matchState = redis.call('lindex', rk.roomMatchState, 0) response.turnState = redis.call('lindex', rk.roomTurnState, 0) response.optIns = redis.call('lindex', rk.roomTurnState, 0) end end else end local dataToSend = { sessionIds = sessionIds, messageId = -1, message = { phase = "roomUpdate", room = clientRoomName, response = response } } --overwrite or set to default some the message.response (to prevent meddling) response.room = clientRoomName response.roomType = roomType response.isGameRoom = isGameRoom or nil response.isTurnBased = isTurnBased or nil response.isSystem = isSystem or nil response.roomUpdateType = redis.call('hget', rk.roomInfo, 'roomUpdateType') --increment message id local nextId = redis.call('hincrby', rk.roomInfo, "nextMessageId", 1) --add message id to ensure ordered messages by the time it reaches node dataToSend.messageId = nextId --send user connecting to room message list to be processed by room queue redis.call('zadd', rk.roomMessages, nextId, cjson.encode(dataToSend.message)) --encode message and sessionId(s) for redis local encoded = cjson.encode(dataToSend) --https://redis.io/commands/eval#available-libraries redis.call('publish', rk.roomName, encoded) redis.call('zadd',rk.tickRooms,nodeTime,clientRoomName) return redis.status_reply('UPDATE OK')
local BaseCommand = class("BaseCommand") function BaseCommand:ctor() end function BaseCommand:Execute(notification) end return BaseCommand
-- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. local async = require 'lualine.utils.async' local utils = require 'lualine.utils.utils' local highlight = require 'lualine.highlight' local Diff = require('lualine.component'):new() -- Vars -- variable to store git diff stats Diff.git_diff = nil -- accumulates async output to process in the end Diff.diff_data = '' -- variable to store git_diff getter async function Diff.get_git_diff = nil -- default colors Diff.default_colors = { added = '#f0e130', removed = '#90ee90', modified = '#ff0038' } -- Initializer Diff.new = function(self, options, child) local new_instance = self._parent:new(options, child or Diff) local default_symbols = {added = '+', modified = '~', removed = '-'} new_instance.options.symbols = vim.tbl_extend('force', default_symbols, new_instance.options.symbols or {}) if new_instance.options.colored == nil then new_instance.options.colored = true end -- apply colors if not new_instance.options.color_added then new_instance.options.color_added = utils.extract_highlight_colors('DiffAdd', 'fg') or Diff.default_colors.added end if not new_instance.options.color_modified then new_instance.options.color_modified = utils.extract_highlight_colors('DiffChange', 'fg') or Diff.default_colors.modified end if not new_instance.options.color_removed then new_instance.options.color_removed = utils.extract_highlight_colors('DiffDelete', 'fg') or Diff.default_colors.removed end -- create highlights and save highlight_name in highlights table if new_instance.options.colored then new_instance.highlights = { added = highlight.create_component_highlight_group( {fg = new_instance.options.color_added}, 'diff_added', new_instance.options), modified = highlight.create_component_highlight_group( {fg = new_instance.options.color_modified}, 'diff_modified', new_instance.options), removed = highlight.create_component_highlight_group( {fg = new_instance.options.color_removed}, 'diff_removed', new_instance.options) } end -- call update functions so git diff is present when component is loaded Diff.update_git_diff_getter() Diff.update_git_diff() vim.api.nvim_exec([[ autocmd lualine BufEnter * lua require'lualine.components.diff'.update_git_diff_getter() autocmd lualine BufEnter * lua require'lualine.components.diff'.update_git_diff() autocmd lualine BufWritePost * lua require'lualine.components.diff'.update_git_diff() ]], false) return new_instance end -- Function that runs everytime statusline is updated Diff.update_status = function(self) if Diff.git_diff == nil then return '' end local colors = {} if self.options.colored then -- load the highlights and store them in colors table for name, highlight_name in pairs(self.highlights) do colors[name] = highlight.component_format_highlight(highlight_name) end end local result = {} -- loop though data and load available sections in result table for _, name in ipairs {'added', 'modified', 'removed'} do if Diff.git_diff[name] and Diff.git_diff[name] > 0 then if self.options.colored then table.insert(result, colors[name] .. self.options.symbols[name] .. Diff.git_diff[name]) else table.insert(result, self.options.symbols[name] .. Diff.git_diff[name]) end end end if #result > 0 then return table.concat(result, ' ') else return '' end end -- Api to get git sign count -- scheme : -- { -- added = added_count, -- modified = modified_count, -- removed = removed_count, -- } -- error_code = { added = -1, modified = -1, removed = -1 } function Diff.get_sign_count() Diff.update_git_diff_getter() Diff.update_git_diff() return Diff.git_diff or {added = -1, modified = -1, removed = -1} end -- process diff data and update git_diff{ added, removed, modified } function Diff.process_diff(data) -- Adapted from https://github.com/wbthomason/nvim-vcs.lua local added, removed, modified = 0, 0, 0 for line in vim.gsplit(data, '\n') do if string.find(line, [[^@@ ]]) then local tokens = vim.fn.matchlist(line, [[^@@ -\v(\d+),?(\d*) \+(\d+),?(\d*)]]) local line_stats = { mod_count = tokens[3] == '' and 1 or tonumber(tokens[3]), new_count = tokens[5] == '' and 1 or tonumber(tokens[5]) } if line_stats.mod_count == 0 and line_stats.new_count > 0 then added = added + line_stats.new_count elseif line_stats.mod_count > 0 and line_stats.new_count == 0 then removed = removed + line_stats.mod_count else local min = math.min(line_stats.mod_count, line_stats.new_count) modified = modified + min added = added + line_stats.new_count - min removed = removed + line_stats.mod_count - min end end end Diff.git_diff = {added = added, modified = modified, removed = removed} end -- Updates the async function for current file function Diff.update_git_diff_getter() -- stop older function properly before overwritting it if Diff.get_git_diff then Diff.get_git_diff:stop() end -- Donn't show git diff when current buffer doesn't have a filename if #vim.fn.expand('%') == 0 then Diff.get_git_diff = nil; Diff.git_diff = nil; return end Diff.get_git_diff = async:new({ cmd = string.format( [[git -C %s --no-pager diff --no-color --no-ext-diff -U0 -- %s]], vim.fn.expand('%:h'), vim.fn.expand('%:t')), on_stdout = function(_, data) if data then Diff.diff_data = Diff.diff_data .. data end end, on_stderr = function(_, data) if data then Diff.git_diff = nil Diff.diff_data = '' end end, on_exit = function() if Diff.diff_data ~= '' then Diff.process_diff(Diff.diff_data) else Diff.git_diff = {added = 0, modified = 0, removed = 0} end end }) end -- Update git_diff veriable function Diff.update_git_diff() vim.schedule_wrap(function() if Diff.get_git_diff then Diff.diff_data = '' Diff.get_git_diff:start() end end)() end return Diff
function parse._pre_fold(str) local str = str local special_chars = charset.get_data().special_chars local function replace(name, dst) local src = special_chars[name] if src then local pattern = string.gsub(src, "[][()^$%%]", "%%%1") str = string.gsub(str, pattern, dst) end end replace("nobreak_space", " ") replace("minus_sign", "-") replace("hyphen_sign", "-") replace("nobreak_hyphen", "-") replace("figure_dash", "-") str = string.gsub(str, "\t+", " ") str = string.gsub(str, "^ +", "") str = string.gsub(str, " +$", "") str = string.gsub(str, " +", " ") return str end
-- This file just contains the array of unit groups that can be spawned via the radio menu. -- The idea is just to keep the clutter down in the radio menu file, which will contain all of the actual code and logic. -- You must create groups matching the names found below. Ideally the description field should accurately describe the group's composition. -- Location isn't important, as spawning will be done via map mark points. -- For all entries below, -- The array key is what will appear in the F10 menu (Keep it short!) -- 'name' must match the group name in the DCS Mission Editor -- 'description' is a string of text that will be displayed when the group spawns -- 'sound' is OPTIONAL, and should be the filename of the sound you want to play when the group spawns. -- For sounds you must include the sound file in the mission somehow or it won't be able to play. -- The easiest way to do this is to make a new trigger which does "SOUND TO COUNTRY" on mission start. -- You can simply send each sound file to a country like Abkhazia and it will be included in the .miz file for use by scripting as well. -- The array is broken up into categories. Each category can have a max of TEN spawnable groups. -- If you exceed ten you'll need to make another category and update the radio menu lua as well. spawnable = {} -- "Armor" category spawnable.armor = { ['4x BTR-80s'] = { name = 'BTR-1', description = '4x APC BTR-80s', sound = 'tvurdy00.wav', -- Alright, bring it on! smoke = 'red', relative = false, action = 'clone', }, ['4x T72 MBTs'] = { name = 'T72-1', description = '4x T72 Main Battle Tanks', sound = 'ttardy00.wav', -- Ready to roll out! smoke = 'red', relative = false, action = 'clone', }, } -- "Air Defences" category spawnable.airdefences = { ['SA-6 SAM Site'] = { name = 'KUB-1', description = 'SA-6 Gainful (2k12 Куб) with 4 Launchers, 1 Straight Flush Radar, 1 P-19 EWR', sound = 'tvkpss01.wav', -- I have ways of blowing things up smoke = 'red', relative = false, action = 'clone', }, ['4x ZU-23'] = { name = 'ZU-1', description = '4x ZU-23s in assorted configurations', sound = 'tfbwht00.wav', -- Fired up smoke = 'red', relative = false, action = 'clone', }, ['SA-10 SAM Site'] = { name = 'Grumble-1', description = 'SA-10 Grumble (S-300) with a Command Post, Big Bird EWR, Clamshell TAR, Flap Lid TER, and 8 Launchers', sound = 'TAdUpd07.wav', -- Nuclear Missile Ready smoke = 'red', relative = false, action = 'clone', }, } -- "Modern Fighters" category spawnable.fighters = { ['2x MiG-29A IR'] = { name = 'MIG-1', description = 'Two MiG-29As armed with IR Missiles', smoke = 'red', relative = false, action = 'clone', }, ['2x MiG-29A Guns'] = { name = 'MIG-2', description = 'Two MiG-29As armed with guns', smoke = 'red', relative = false, action = 'clone', }, } -- "Warbird" category spawnable.warbirds = { ['2x Fw 190-D9'] = { name = 'D9-1', description = 'Two Fw 190-D9s', smoke = 'red', relative = false, action = 'clone', }, } -- "Infantry" category spawnable.infantry = { ['10x Assorted Infantry'] = { name = 'Infantry-1', description = 'Ten Assorted Russian Infantry', sound = 'tmawht03.wav', -- Gimme somethin to shoot smoke = 'red', relative = false, action = 'clone', }, } -- "Helicopters" category spawnable.helicopters = { ['Mi-24V'] = { name = 'Hind-1', description = 'An Mi-24V Hind Attack Helicopter', sound = 'pcowht03.wav', -- Let us attack smoke = false, relative = false, action = 'clone', }, } -- "Boats" category spawnable.boats = { ['Kirov'] = { name = 'Kirov-1', description = 'CGN 1144.2 Pyotr Velikiy Kirov', sound = 'tbardy00.wav', -- Cattlebruiser Operational smoke = 'red', relative = false, action = 'clone', }, ['Kuznetsov'] = { name = 'Kuznetsov-1', description = 'CV 1143.5 Admiral Kuznetsov (2017)', sound = 'pcaRdy00.wav', -- Carrier has arrived smoke = 'red', relative = false, action = 'clone', }, ['4x Cargo Ships'] = { name = 'Cargo-1', description = '4x Unarmed Cargo Ships', sound = 'pprRdy00.wav', smoke = 'red', relative = false, action = 'clone', }, } -- "AWACS" category spawnable.awacs = { ['A-50'] = { name = 'A-50 1', description = 'A-50 AWACS at 35,000ft', sound = 'pabYes01.wav', smoke = false, relative = true, action = 'clone', }, } -- "AWACS" friendly category spawnable.fawacs = { ['E-3A Sentry'] = { name = 'E-3A 1', description = 'E-3A Sentry at 35,000ft. Contact "Overlord" on 140.0', sound = 'pabRdy00.wav', -- Warp Field Stabilized smoke = false, relative = true, action = 'respawn', }, ['E-2D Hawkeye'] = { name = 'E-2D 1', description = 'E-2D Hawkeye at 30,000ft. Contact "Magic" on 141.0', sound = 'pabPss00.wav', -- We sense a soul in search of answers smoke = false, relative = true, action = 'respawn', }, } -- "Boats" friendly category spawnable.fboats = { ['CVN-74 John C. Stennis'] = { name = 'CVN-74 John C. Stennis 1', description = 'CVN-74 John C. Stennis. ATC 127, TCN 74, ICLS 7', sound = 'pcaRdy00.wav', smoke = false, relative = true, action = 'respawn', }, ['CVN-73 George Washington'] = { name = 'CVN-73 George Washington 1', description = 'CVN-73 George Washington. ATC 129, TCN 73, ICLS 8', sound = 'pcaRdy00.wav', smoke = false, relative = true, action = 'respawn', }, ['CV 1143.5 Admiral Kuznetsov (2017)'] = { name = 'Super Kuznetsov 1', description = 'CV 1143.5 Admiral Kuznetsov (2017). ATC 128', sound = 'pcaRdy00.wav', smoke = false, relative = true, action = 'respawn', }, ['CV 1143.5 Admiral Kuznetsov'] = { name = 'Kuznetsov 1', description = 'CV 1143.5 Admiral Kuznetsov. ATC 126', sound = 'pcaRdy00.wav', smoke = false, relative = true, action = 'respawn', }, ['LHA Tarawa'] = { name = 'LHA-1 Tarawa 1', description = 'LHA Tarawa. ATC 125, TCN 76, ICLS 5', sound = 'pcaRdy00.wav', smoke = false, relative = true, action = 'respawn', }, } -- "Tankers" friendly category spawnable.ftankers = { ['Basket KC-130'] = { name = 'Texaco 1', description = 'KC-130 (Basket) Tanker, 255KIAS at 15,000ft. Contact on 130.0, TCN 30X', sound = 'TDrPss01.wav', -- In case of a water landing, you may be used as a flotation device smoke = false, relative = true, action = 'respawn', }, ['Basket KC-135MPRS '] = { name = 'Texaco 2', description = 'KC-135MPRS (Basket) Tanker, 270KIAS at 25,000ft. Contact on 131.0, TCN 31X', sound = 'TDrPss02.wav', -- To hurl chunks, please use the vomit bag in front of you smoke = false, relative = true, action = 'respawn', }, ['Basket S-3B '] = { name = 'Texaco 3', description = 'S-3B (Basket) Tanker, 270KIAS at 25,000ft. Contact on 132.0, TCN 32X', sound = 'TDrPss03.wav', -- Keep your arms and legs inside smoke = false, relative = true, action = 'respawn', }, ['Boom KC-135 (Fast)'] = { name = 'Shell 1', description = 'KC-135 (Boom) Tanker, 270KIAS at 25,000ft. Contact on 133.0, TCN 33X', sound = 'TDrYes00.wav', -- In the pipe, 5x5 smoke = false, relative = true, action = 'respawn', }, ['Boom KC-135 (Slow)'] = { name = 'Shell 2', description = 'KC-135 (Boom) Tanker, 220KIAS at 10,000ft. Contact on 134.0, TCN 34X', sound = 'TDrYes04.wav', -- Strap yourselves in boys smoke = false, relative = true, action = 'respawn', }, ['Basket Il-78M'] = { name = 'Texaco 4', description = 'Il-78M (Basket) Tanker, 270KIAS at 25,000ft. Contact on 135.0, No TCN', sound = 'tvkpss00.wav', -- This is very interesting, but stupid smoke = false, relative = true, action = 'respawn', }, }
--[[ 处理房间公共的逻辑、升降场、破产判断等 ]] RoomLogic = class(); RoomLogic.getInstance = function() if not RoomLogic.s_instance then RoomLogic.s_instance = new(RoomLogic); end return RoomLogic.s_instance; end RoomLogic.releaseInstance = function() delete(RoomLogic.s_instance); RoomLogic.s_instance = nil; end RoomLogic.ctor = function(self) end RoomLogic.dtor = function(self) end RoomLogic.checkIsLevelDown = function(self) if PrivateRoomIsolater.getInstance():isInPrivateRoom() then return false; end local curGameId = GameInfoIsolater.getInstance():getCurGameId(); local userMoney = self:getCurRoomProperty(); local curLevelId = GameRoomData.getInstance():getRoomLevel(); -- 当前房间的level if curLevelId == 0 then return false; end local newLevelId = GameInfoIsolater.getInstance():getPlayableLevelIdByLoginMoney(curGameId, userMoney, curLevelId); return newLevelId < curLevelId; end -- 结算时,检测场次升降级 RoomLogic.checkIsLevelUp = function (self,isByLoginMoney) Log.d("RoomLogic----checkIsLevelUp" , "isByLoginMoney = ",isByLoginMoney); local kickStatus = GameInfoIsolater.getInstance():getKickUserStatus(); if kickStatus and number.valueOf(kickStatus) == 9001 then --此时server要升级,重新走换桌流程 GameInfoIsolater.getInstance():setKickUserStatus(false); MechineManage.getInstance():receiveAction(GameMechineConfig.ACTION_NS_CHANGETABLE); return true; end local flag = false; local roomUpLevelInfo = GameInfoIsolater.getInstance():getRoomUpLevelInfo(); -- 升降级信息 Log.d("RoomLogic----checkIsLevelUp" , "roomUpLevelInfo = ",roomUpLevelInfo); if not table.isEmpty(roomUpLevelInfo) then if roomUpLevelInfo.flag == 1 then --升级 self:_handleLevelUp(roomUpLevelInfo.level); flag = true; elseif roomUpLevelInfo.flag == -1 then --降级 -- 降级时,调用支付 GameInfoIsolater.getInstance():setRoomUpLevelInfo({}); self:_handleLevelDown(); flag = true; end else if isByLoginMoney then return not self:checkIsLegalPlay(); else return not self:isLegalToPlay(); end end return flag; end -- 银币发生变化,校验当前场次是否满足继续游戏 -- 根据场次退场银币上下线判断 RoomLogic.isLegalToPlay = function(self) return self:_checkIsLegal(true); end --当前场次是否能继续游戏 --根据入场银币上下线来判断 RoomLogic.checkIsLegalPlay = function(self) return self:_checkIsLegal(false); end --获取当前这个房间对应的资产 RoomLogic.getCurRoomProperty = function(self) return RoomPropertyData.getInstance():getCurPropertyNum(); end -- 检查是否破产了 RoomLogic.checkIsBankrupt = function(self) return RoomPropertyData.getInstance():isMineBankrupt(); end -- 房间里面是否显示破产 RoomLogic.isShowBankruptPayInRoom = function(self) return BankruptIsolater.getInstance():isShowBankruptPayInRoom(); end RoomLogic._handleLevelUp = function(self,newLevelId) if not newLevelId then return; end Log.d("RoomLogic","_handleLevelUp"); GameRoomData.getInstance():setRoomLevel(newLevelId); GameInfoIsolater.getInstance():setCurRoomLevelId(newLevelId); MechineManage.getInstance():receiveAction(GameMechineConfig.ACTION_NS_ROOMUPCHANGE); local data = {exp = 0, level = newLevelId}; MechineManage.getInstance():receiveAction(GameMechineConfig.ACTION_NS_ROOMLEVELUP_ANIM,data); GameInfoIsolater.getInstance():setRoomUpLevelInfo({}); end RoomLogic._handleLevelDown = function(self) Log.d("RoomLogic","_handleLevelDown"); local curGameId = GameInfoIsolater.getInstance():getCurGameId(); local curLevelId = GameRoomData.getInstance():getRoomLevel(); local minLoginMoney = GameInfoIsolater.getInstance():getPropByLevelPropName(curGameId,curLevelId,"min_money"); minLoginMoney = number.valueOf(minLoginMoney); local userMoney = self:getCurRoomProperty(); local diff = minLoginMoney - userMoney; local data = { gameid = curGameId; level = curLevelId; scene = PayConfig.eGoodsListId.Degrade, cm = diff; }; local info = {}; info.param = data; info.scene = data.scene; local action = GameMechineConfig.ACTION_RECHARGE; MechineManage.getInstance():receiveAction(action,info); GameInfoIsolater.getInstance():setDegradeInfo({}); end RoomLogic._checkIsLegal = function(self,isByExitMoney) if self:checkIsBankrupt() then MechineManage.getInstance():receiveAction(GameMechineConfig.ACTION_NS_CHECK_ROOM_BANKRUPT); return false; end local curLevelId = GameRoomData.getInstance():getRoomLevel(); -- 当前房间的level if PrivateRoomIsolater.getInstance():checkIsPrivateRoomLevel(curLevelId) then local propertyId = RoomPropertyData.getInstance():getCurPropertyId(); local userMoney = self:getCurRoomProperty(); if UserPropertyIsolater.getInstance():checkIsCrystal(propertyId) and userMoney <= 0 then self:_handleLackCrystalInPrivateRoom(); return false; end return true; end local curGameId = GameInfoIsolater.getInstance():getCurGameId(); local userMoney = self:getCurRoomProperty(); local newLevelId; if isByExitMoney then newLevelId = GameInfoIsolater.getInstance():getPlayableLevelIdWithMoney(curGameId, userMoney, curLevelId); else newLevelId = GameInfoIsolater.getInstance():getPlayableLevelIdByLoginMoney(curGameId, userMoney, curLevelId); end if newLevelId and curLevelId > 0 then Log.d("RoomLogic._checkIsLegal----","isByExitMoney = ",isByExitMoney,"curLevelId = ",curLevelId," newLevelId = " , newLevelId); if GameInfoIsolater.getInstance():isLevelExist(curGameId,curLevelId) then -- 本地保存的level是合法的 if newLevelId > curLevelId then --升级 self:_handleLevelUp(newLevelId); GameInfoIsolater.getInstance():setDegradeInfo({}); return false; elseif newLevelId == curLevelId then --保级 GameInfoIsolater.getInstance():setCurRoomLevelId(newLevelId); GameInfoIsolater.getInstance():setDegradeInfo({}); return true; else --降级 self:_handleLevelDown(); return false; end else -- 本地保存的level是非法的 if _DEBUG then debug.traceback(); error("本地保存的level是非法的"); end end end return true; end RoomLogic._handleLackCrystalInPrivateRoom = function(self) local params = { title = "金条不足"; text = "你的金条已经不够了,即将离开房间。请在补充金条后再继续约牌。"; textColor = {143,92,31}; textSize = 30; textAlign = kAlignLeft; okBtnText = "离开房间"; okObj = self; okFunc = self._jumpToHall; cancleBtnText = "前往商场"; cancleObj = self; cancleFunc = self._jumpToShop; doNeedCloseBtn = true; closeObj = self; closeFunc = self._jumpToHall; }; MessageBox.showWithParams(params); end RoomLogic._jumpToShop = function(self) PayIsolater.getInstance():jumpToMarket("crystal"); MechineManage.getInstance():receiveAction(GameMechineConfig.ACTION_NS_FORCE_EXIT); end RoomLogic._jumpToHall = function(self) GameInfoIsolater.getInstance():setGameToWhereState(States.Hall); MechineManage.getInstance():receiveAction(GameMechineConfig.ACTION_NS_FORCE_EXIT); end RoomLogic.s_actionFuncMap = { }
local AnimationPlayer = require("lib/AnimationPlayer") local Globals = require("game/GameConstants") local Resources = require("game/Resources") local Player = {ANGEL = 1, DEVIL = 2} local FLASH_DURATION = 0.2 function Player:new(type) newPlayer = {} newPlayer.type = type self.__index = self self.flashing = true self.lastFlashTime = 0 self.flashMode = false return setmetatable(newPlayer, self) end function Player:init(grid, row, col) self.row, self.col = row, col self.currentPos = {x = 0, y = 0} self.desiredPos = {x = 0, y = 0} self.scale = 3 self.moveSpeed = 10 if self.type == Player.DEVIL then self.anim = AnimationPlayer:new(Resources.DevilTexture, 3, 1) else self.anim = AnimationPlayer:new(Resources.AngelTexture, 3, 1) end self.anim:add("idle", "1-2", 0.2, true) self.anim:add("squashed", "3-3", 1, false) love.graphics.setColor(1, 1, 1) self.anim:play("idle") self.spriteDir = {x = -1, y = -1} -- whether the Player is facing left (-1) or right(1) self.currentPos.x, self.currentPos.y = self:getPosOnGrid(grid) self.desiredPos.x, self.desiredPos.y = self:getPosOnGrid(grid) end function Player:show(grid, xOff, yOff) if self.flashing then love.graphics.setColor(1, 1, 0, 1) else love.graphics.setColor(1, 1, 1, 1) end if self.anim.currentAnim then self.anim:show( self.currentPos.x + (xOff or 0), self.currentPos.y + (yOff or 0), 0, self.spriteDir.x * self.scale, self.scale ) end end function Player:getPosOnGrid(grid) local posX, posY = grid:getTilePos(self.row, self.col) if self.spriteDir.x == -1 then posX = posX + 44 end return posX + 10, posY end function Player:playAnim(anim) self.anim:play(anim) end function Player:update(dt) -- if self.flashMode then local time = love.timer.getTime() if time - self.lastFlashTime > FLASH_DURATION then self.lastFlashTime = time self.flashing = not self.flashing end else self.flashing = false end if self.currentPos.x > self.desiredPos.x then -- if Player moved past the desired spot if self.spriteDir.x == 1 then self.currentPos.x = self.desiredPos.x else self.currentPos.x = self.currentPos.x - self.moveSpeed self:playAnim("squashed") end elseif self.currentPos.x < self.desiredPos.x then if self.spriteDir.x == -1 then self.currentPos.x = self.desiredPos.x else self.currentPos.x = self.currentPos.x + self.moveSpeed self:playAnim("squashed") end end if self.currentPos.y > self.desiredPos.y then if self.spriteDir.y == 1 then self.currentPos.y = self.desiredPos.y else self.currentPos.y = self.currentPos.y - self.moveSpeed self:playAnim("squashed") end elseif self.currentPos.y < self.desiredPos.y then if self.spriteDir.y == -1 then self.currentPos.y = self.desiredPos.y else self.currentPos.y = self.currentPos.y + self.moveSpeed love.graphics.print("logging") self:playAnim("squashed") end end if self.currentPos.x == self.desiredPos.x and self.desiredPos.y == self.desiredPos.y then self:playAnim("idle") end self.anim:update(dt) end function Player:isMoving() return (self.currentPos.x ~= self.desiredPos.x or self.currentPos.y ~= self.desiredPos.y) end function Player:moveLeft(grid) if self.col > 1 and grid.tiles[self.row][self.col - 1].pathable then self.col = self.col - 1 end self.spriteDir.x = -1 end function Player:moveRight(grid) if self.col < grid.cols and grid.tiles[self.row][self.col + 1].pathable then self.col = self.col + 1 end self.spriteDir.x = 1 end function Player:moveUp(grid) if self.row > 1 and grid.tiles[self.row - 1][self.col].pathable then self.row = self.row - 1 end self.spriteDir.y = -1 end function Player:moveDown(grid) if self.row < grid.rows and grid.tiles[self.row + 1][self.col].pathable then self.row = self.row + 1 end self.spriteDir.y = 1 end function Player:updatePos(grid) self.desiredPos.x, self.desiredPos.y = self:getPosOnGrid(grid) end function Player:moveTo(grid, row, col) self.row, self.col = row, col self.currentPos.x, self.currentPos.y = self:getPosOnGrid(grid) self.desiredPos.x, self.desiredPos.y = self:getPosOnGrid(grid) end return Player
vim.opt_local.textwidth = 85
----------------------------------- -- Area: Cape Teriggan -- NM: Killer Jonny ----------------------------------- require("scripts/globals/status") ----------------------------------- function onMobInitialize(mob) mob:setMobMod(tpz.mobMod.ADD_EFFECT, 1) mob:setMod(tpz.mod.DOUBLE_ATTACK, 100) end function onAdditionalEffect(mob, target, damage) return tpz.mob.onAddEffect(mob, target, damage, tpz.mob.ae.POISON, {power = 120}) end function onMobDeath(mob, player, isKiller) end function onMobDespawn(mob) mob:setRespawnTime(math.random(28800, 86400)) -- 8 to 24 hours end
local Tunnel = module("vrp", "lib/Tunnel") local Proxy = module("vrp", "lib/Proxy") vRP = Proxy.getInterface("vRP") async(function() vRP.loadScript("vrp_carwash", "server") end)
local _, ctp = ... --- KNOWN ISSUES: -- - When ignoring things at the very bottom, it will shift around weird local CreateFrame = CreateFrame local GetMoney = GetMoney local PlaySound = PlaySound local UnitClass = UnitClass local UnitName = UnitName local UnitLevel = UnitLevel local BuyTrainerService = BuyTrainerService local SelectTrainerService = SelectTrainerService local GetTrainerServiceSkillLine = GetTrainerServiceSkillLine local GetTrainerSelectionIndex = GetTrainerSelectionIndex local GetTrainerGreetingText = GetTrainerGreetingText local GetTrainerServiceCost = GetTrainerServiceCost local GetTrainerServiceIcon = GetTrainerServiceIcon local GetTrainerServiceLevelReq = GetTrainerServiceLevelReq local GetTrainerServiceTypeFilter = GetTrainerServiceTypeFilter local GetTrainerServiceSkillReq = GetTrainerServiceSkillReq local GetTrainerServiceNumAbilityReq = GetTrainerServiceNumAbilityReq local GetTrainerServiceAbilityReq = GetTrainerServiceAbilityReq local SetTrainerServiceTypeFilter = SetTrainerServiceTypeFilter local GetTrainerServiceInfo = GetTrainerServiceInfo local GetTrainerServiceDescription = GetTrainerServiceDescription local GetCoinTextureString = GetCoinTextureString local IsShiftKeyDown = IsShiftKeyDown local SetPortraitTexture = SetPortraitTexture local SetMoneyFrameColor = SetMoneyFrameColor local CloseTrainer = CloseTrainer local CloseDropDownMenus = CloseDropDownMenus local IsTradeskillTrainer = IsTradeskillTrainer local IsTrainerServiceLearnSpell = IsTrainerServiceLearnSpell local CollapseTrainerSkillLine = CollapseTrainerSkillLine local ExpandTrainerSkillLine = ExpandTrainerSkillLine local EasyMenu = EasyMenu local UpdateMicroButtons = UpdateMicroButtons local GetNumPrimaryProfessions = GetNumPrimaryProfessions local FauxScrollFrame_SetOffset = FauxScrollFrame_SetOffset local FauxScrollFrame_GetOffset = FauxScrollFrame_GetOffset local FauxScrollFrame_Update = FauxScrollFrame_Update local MoneyFrame_Update = MoneyFrame_Update local StaticPopup_Show = StaticPopup_Show local StaticPopup_Visible = StaticPopup_Visible local StaticPopup_Hide = StaticPopup_Hide local format = format local strupper = strupper local strlen = strlen local tinsert = tinsert local TRAIN = TRAIN CLASS_TRAINER_SKILLS_DISPLAYED = 11 CLASS_TRAINER_SKILL_HEIGHT = 16 MAX_LEARNABLE_PROFESSIONS = 2 SKILL_TEXT_WIDTH = 270 -- Trainer Filter Default Values TRAINER_FILTER_AVAILABLE = 1 TRAINER_FILTER_UNAVAILABLE = 1 TRAINER_FILTER_USED = 0 TRAINER_FILTER_IGNORED = 1 UIPanelWindows["ClassTrainerPlusFrame"] = UIPanelWindows["ClassTrainerFrame"] ClassTrainerPlusDBPC = {} local _, englishClass = UnitClass("player") englishClass = string.gsub(string.lower(englishClass), "^%l", string.upper) local classSpellIds = _G[format("ClassTrainerPlus%sSpellIds", englishClass)] ctp.Abilities:Load(classSpellIds) local function UpdateUserFilters() ctp.Abilities:Update(ClassTrainerPlusDBPC) ctp.TrainerServices:Update() if (ClassTrainerPlusFrame and ClassTrainerPlusFrame:IsVisible()) then ClassTrainerPlusFrame_Update() end end StaticPopupDialogs["CONFIRM_PROFESSION"] = { preferredIndex = 3, text = format(PROFESSION_CONFIRMATION1, "XXX"), button1 = ACCEPT, button2 = CANCEL, OnAccept = function() BuyTrainerService(ClassTrainerPlusFrame.selectedService) ClassTrainerPlusFrame.showSkillDetails = nil ClassTrainerPlus_SetSelection(ClassTrainerPlusFrame.selectedService) ClassTrainerPlusFrame_Update() end, OnShow = function(self) local profCount = GetNumPrimaryProfessions() if (profCount == 0) then _G[self:GetName() .. "Text"]:SetText( format(PROFESSION_CONFIRMATION1, GetTrainerServiceSkillLine(ClassTrainerPlusFrame.selectedService)) ) else _G[self:GetName() .. "Text"]:SetText( format(PROFESSION_CONFIRMATION2, GetTrainerServiceSkillLine(ClassTrainerPlusFrame.selectedService)) ) end end, showAlert = 1, timeout = 0, hideOnEscape = 1 } function ClassTrainerPlusFrame_Show() ShowUIPanel(ClassTrainerPlusFrame) if (not ClassTrainerPlusFrame:IsVisible()) then CloseTrainer() return end ClassTrainerPlusTrainButton:Disable() --Reset scrollbar ClassTrainerPlusListScrollFrameScrollBar:SetMinMaxValues(0, 0) ClassTrainerPlusListScrollFrameScrollBar:SetValue(0) ClassTrainerPlus_SelectFirstLearnableSkill() ctp.TrainerServices:Update() ClassTrainerPlusFrame_Update() UpdateMicroButtons() end function ClassTrainerPlusFrame_Hide() HideUIPanel(ClassTrainerPlusFrame) end local trainAllCostTooltip = CreateFrame("GameTooltip", "CTPTrainAllCostTooltip", UIParent, "GameTooltipTemplate") function ClassTrainerPlusFrame_OnLoad(self) self:RegisterEvent("TRAINER_UPDATE") self:RegisterEvent("TRAINER_DESCRIPTION_UPDATE") self:RegisterEvent("TRAINER_SERVICE_INFO_NAME_UPDATE") self:RegisterEvent("ADDON_LOADED") self:RegisterEvent("TRAINER_CLOSED") ClassTrainerPlusDetailScrollFrame.scrollBarHideable = 1 local function ShowCostTooltip() trainAllCostTooltip:SetOwner(ClassTrainerPlusTrainButton, "ANCHOR_RIGHT") local coloredCoinString = GetCoinTextureString(ctp.TrainerServices.availableCost) if (GetMoney() < ctp.TrainerServices.availableCost) then coloredCoinString = RED_FONT_COLOR_CODE .. coloredCoinString .. FONT_COLOR_CODE_CLOSE end trainAllCostTooltip:AddLine(format("Total cost: %s", coloredCoinString)) trainAllCostTooltip:Show() end local mousedOver = false ClassTrainerPlusTrainButton:SetScript( "OnEnter", function() mousedOver = true end ) ClassTrainerPlusTrainButton:SetScript( "OnLeave", function() mousedOver = false trainAllCostTooltip:Hide() end ) self:SetScript( "OnUpdate", function() if (IsTradeskillTrainer()) then return end if (IsShiftKeyDown()) then ClassTrainerPlusTrainButton:SetText(ctp.L.TRAIN_ALL) if (mousedOver) then ShowCostTooltip() end else ClassTrainerPlusTrainButton:SetText(TRAIN) trainAllCostTooltip:Hide() end end ) end function ClassTrainerPlus_OnSearchTextChanged(self) SearchBoxTemplate_OnTextChanged(self) local filterChanged = ctp.TrainerServices:SetFilter(self:GetText()) if (not filterChanged) then return end ctp.TrainerServices:ApplyFilter() ClassTrainerPlus_SelectFirstLearnableSkill() ClassTrainerPlusFrame_Update() end local function TrainerUpdateHandler() ctp.TrainerServices:Update() local selectedIndex = GetTrainerSelectionIndex() if (selectedIndex > 1) then -- Select the first available ability local service = ctp.TrainerServices:GetService(selectedIndex) if (selectedIndex > ctp.TrainerServices.totalServices) then FauxScrollFrame_SetOffset(ClassTrainerPlusListScrollFrame, 0) ClassTrainerPlusListScrollFrameScrollBar:SetValue(0) local firstAbility = ctp.TrainerServices:GetFirstVisibleNonHeaderService() if (firstAbility == nil) then selectedIndex = nil else selectedIndex = firstAbility.serviceId end elseif (service and service.isHidden) then while (service and (service.isHidden or service.type == "header")) do selectedIndex = selectedIndex + 1 service = ctp.TrainerServices:GetService(selectedIndex) end if (selectedIndex > ctp.TrainerServices.totalServices) then selectedIndex = nil end end ClassTrainerPlus_SetSelection(selectedIndex) else ClassTrainerPlus_SelectFirstLearnableSkill() end ClassTrainerPlusFrame_Update() end function ClassTrainerPlusFrame_OnEvent(self, event, ...) if (event == "ADDON_LOADED" and ... == "ClassTrainerPlus") then SetTrainerServiceTypeFilter("available", TRAINER_FILTER_AVAILABLE) SetTrainerServiceTypeFilter("unavailable", TRAINER_FILTER_UNAVAILABLE) SetTrainerServiceTypeFilter("used", TRAINER_FILTER_USED) ClassTrainerPlusDBPC = ClassTrainerPlusDBPC or {} UpdateUserFilters() end if (not self:IsVisible()) then return end if (event == "TRAINER_UPDATE") then TrainerUpdateHandler() elseif (event == "TRAINER_DESCRIPTION_UPDATE") then ClassTrainerPlus_SetSelection(GetTrainerSelectionIndex()) elseif (event == "TRAINER_SERVICE_INFO_NAME_UPDATE") then -- It would be really cool if I could uniquely identify the button associated -- with a particular spell here, and only update the name on that button. TrainerUpdateHandler() elseif (event == "TRAINER_CLOSED") then ClassTrainerPlusFrame_Hide() end end function ClassTrainerPlusFrame_Update() SetPortraitTexture(ClassTrainerPlusFramePortrait, "npc") ClassTrainerPlusNameText:SetText(UnitName("npc")) ClassTrainerPlusGreetingText:SetText(GetTrainerGreetingText()) local numFilteredTrainerServices = ctp.TrainerServices.visibleServices local skillOffset = FauxScrollFrame_GetOffset(ClassTrainerPlusListScrollFrame) -- If no spells then clear everything out if (numFilteredTrainerServices == 0) then ClassTrainerPlusCollapseAllButton:Disable() ClassTrainerPlusFrame.selectedService = nil else ClassTrainerPlusCollapseAllButton:Enable() end -- If selectedService is nil hide everything if (not ClassTrainerPlusFrame.selectedService) then ClassTrainerPlus_HideSkillDetails() ClassTrainerPlusTrainButton:Disable() end -- Change the setup depending on if its a class trainer or tradeskill trainer if (IsTradeskillTrainer()) then ClassTrainerPlus_SetToTradeSkillTrainer() else ClassTrainerPlus_SetToClassTrainer() end -- ScrollFrame update FauxScrollFrame_Update( ClassTrainerPlusListScrollFrame, numFilteredTrainerServices, CLASS_TRAINER_SKILLS_DISPLAYED, CLASS_TRAINER_SKILL_HEIGHT, nil, nil, nil, ClassTrainerPlusSkillHighlightFrame, 293, 316 ) --ClassTrainerPlusUsedButton:Show(); ClassTrainerPlusMoneyFrame:Show() ClassTrainerPlusSkillHighlightFrame:Hide() -- Fill in the skill buttons for i = 1, CLASS_TRAINER_SKILLS_DISPLAYED, 1 do local skillIndex = i + skillOffset local skillButton = _G["ClassTrainerPlusSkill" .. i] local serviceName, serviceSubText, serviceType, isExpanded local moneyCost if (skillIndex <= numFilteredTrainerServices) then local service = ctp.TrainerServices:GetServiceAtPosition(skillIndex) serviceName = service.name serviceSubText = service.subText serviceType = service.type isExpanded = service.isExpanded if (not serviceName) then serviceName = UNKNOWN end -- Set button widths if scrollbar is shown or hidden if (ClassTrainerPlusListScrollFrame:IsVisible()) then skillButton:SetWidth(293) else skillButton:SetWidth(323) end local skillSubText = _G["ClassTrainerPlusSkill" .. i .. "SubText"] -- Type stuff if (serviceType == "header") then local skillText = _G["ClassTrainerPlusSkill" .. i .. "Text"] skillText:SetText(serviceName) skillText:SetWidth(0) skillButton:SetNormalFontObject("GameFontNormal") skillSubText:Hide() if (isExpanded) then skillButton:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up") else skillButton:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up") end _G["ClassTrainerPlusSkill" .. i .. "Highlight"]:SetTexture("Interface\\Buttons\\UI-PlusButton-Hilight") else skillButton:SetNormalTexture("") _G["ClassTrainerPlusSkill" .. i .. "Highlight"]:SetTexture("") local skillText = _G["ClassTrainerPlusSkill" .. i .. "Text"] skillText:SetText(" " .. serviceName) if (serviceSubText and serviceSubText ~= "") then skillSubText:SetText(format(PARENS_TEMPLATE, serviceSubText)) skillText:SetWidth(0) skillSubText:SetPoint("LEFT", "ClassTrainerPlusSkill" .. i .. "Text", "RIGHT", 10, 0) skillSubText:Show() else skillSubText:Hide() -- A bit of a hack. If there's no subtext, we'll set a width to ensure that we don't overflow. skillText:SetWidth(SKILL_TEXT_WIDTH) end -- Cost Stuff moneyCost, _ = GetTrainerServiceCost(skillIndex) if (serviceType == "available") then if (not service.isIgnored) then skillButton:SetNormalFontObject("GameFontNormalLeftGreen") ClassTrainerPlus_SetSubTextColor(skillButton, 0, 0.6, 0) else skillButton:SetNormalFontObject("ClassTrainerPlusIgnoredFont") ClassTrainerPlus_SetSubTextColor(skillButton, 0.6, 0.6, 0.1) end elseif (serviceType == "used") then skillButton:SetNormalFontObject("GameFontDisable") ClassTrainerPlus_SetSubTextColor(skillButton, 0.5, 0.5, 0.5) else if (service.isIgnored) then skillButton:SetText(skillButton:GetText() .. " |cFFffffa3*|r") end skillButton:SetNormalFontObject("GameFontNormalLeftRed") ClassTrainerPlus_SetSubTextColor(skillButton, 0.6, 0, 0) end end skillButton:SetID(service.serviceId) skillButton:Show() -- Place the highlight and lock the highlight state if (ctp.TrainerServices:IsSelected(service.serviceId)) then ClassTrainerPlusSkillHighlightFrame:SetPoint("TOPLEFT", "ClassTrainerPlusSkill" .. i, "TOPLEFT", 0, 0) ClassTrainerPlusSkillHighlightFrame:Show() skillButton:LockHighlight() ClassTrainerPlus_SetSubTextColor( skillButton, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b ) if (moneyCost and moneyCost > 0) then ClassTrainerPlusCostLabel:Show() end else skillButton:UnlockHighlight() end else skillButton:Hide() end end -- Show skill details if the skill is visible if (ctp.TrainerServices:IsSelected(ClassTrainerPlusFrame.selectedService)) then ClassTrainerPlus_ShowSkillDetails() else ClassTrainerPlus_HideSkillDetails() end -- Set the expand/collapse all button texture if (ctp.TrainerServices.allHeadersCollapsed) then ClassTrainerPlusCollapseAllButton.collapsed = 1 ClassTrainerPlusCollapseAllButton:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up") else ClassTrainerPlusCollapseAllButton.collapsed = nil ClassTrainerPlusCollapseAllButton:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up") end end function ClassTrainerPlus_SelectFirstLearnableSkill() if (ctp.TrainerServices.visibleServices > 0) then ClassTrainerPlusFrame.showSkillDetails = 1 local firstAbility = ctp.TrainerServices:GetFirstVisibleNonHeaderService() if (firstAbility ~= nil) then ClassTrainerPlus_SetSelection(firstAbility.serviceId) else ClassTrainerPlusFrame.showSkillDetails = nil ClassTrainerPlusFrame.selectedService = nil ClassTrainerPlus_SetSelection() end FauxScrollFrame_SetOffset(ClassTrainerPlusListScrollFrame, 0) else ClassTrainerPlusFrame.showSkillDetails = nil ClassTrainerPlusFrame.selectedService = nil ClassTrainerPlus_SetSelection() end ClassTrainerPlusListScrollFrame:SetVerticalScroll(0) end function ClassTrainerPlus_SetSelection(id) -- General Info if (not id) then ClassTrainerPlus_HideSkillDetails() ClassTrainerPlusTrainButton:Disable() return end local showIgnored = TRAINER_FILTER_IGNORED == 1 local serviceName, serviceSubText, serviceType, isExpanded local service = ctp.TrainerServices:GetService(id) if (service == nil) then print("ClassTrainerPlus: Could not retrieve the correct service. If the trainer window is blank, close and reopen it. If the window is still blank, disable ClassTrainerPlus and report the issue to the author.") return; end serviceName = service.name serviceSubText = service.subText serviceType = service.type isExpanded = service.isExpanded ClassTrainerPlusSkillHighlightFrame:Show() if (serviceType == "available") then if (not service.isIgnored) then ClassTrainerPlusSkillHighlight:SetVertexColor(0, 1.0, 0) else ClassTrainerPlusSkillHighlight:SetVertexColor(1.0, 1.0, 0.6) end elseif (serviceType == "used") then ClassTrainerPlusSkillHighlight:SetVertexColor(0.5, 0.5, 0.5) elseif (serviceType == "unavailable") then ClassTrainerPlusSkillHighlight:SetVertexColor(0.9, 0, 0) else -- Is header, so collapse or expand header ClassTrainerPlusSkillHighlightFrame:Hide() if (isExpanded) then CollapseTrainerSkillLine(id) else ExpandTrainerSkillLine(id) end return end if (ClassTrainerPlusFrame.showSkillDetails) then ClassTrainerPlus_ShowSkillDetails() else ClassTrainerPlus_HideSkillDetails() --ClassTrainerPlusTrainButton:Disable(); return end if (not serviceName) then serviceName = UNKNOWN end ClassTrainerPlusSkillName:SetText(serviceName) if (not serviceSubText) then serviceSubText = "" end ClassTrainerPlusSubSkillName:SetText(PARENS_TEMPLATE:format(serviceSubText)) ClassTrainerPlusFrame.selectedService = id SelectTrainerService(id) ClassTrainerPlusSkillIcon:SetNormalTexture(GetTrainerServiceIcon(id)) -- Build up the requirements string local requirements = "" -- Level Requirements local reqLevel = GetTrainerServiceLevelReq(id) local separator = "" if (reqLevel > 1) then separator = ", " local _, isPetLearnSpell = IsTrainerServiceLearnSpell(id) if (isPetLearnSpell) then if (UnitLevel("pet") >= reqLevel) then requirements = requirements .. format(TRAINER_PET_LEVEL, reqLevel) else requirements = requirements .. format(TRAINER_PET_LEVEL_RED, reqLevel) end else if (UnitLevel("player") >= reqLevel) then requirements = requirements .. format(TRAINER_REQ_LEVEL, reqLevel) else requirements = requirements .. format(TRAINER_REQ_LEVEL_RED, reqLevel) end end end -- Skill Requirements local skill, rank, hasReq = GetTrainerServiceSkillReq(id) if (skill) then if (hasReq) then requirements = requirements .. separator .. format(TRAINER_REQ_SKILL_RANK, skill, rank) else requirements = requirements .. separator .. format(TRAINER_REQ_SKILL_RANK_RED, skill, rank) end separator = ", " end -- Ability Requirements local numRequirements = GetTrainerServiceNumAbilityReq(id) local ability, abilityType if (numRequirements > 0) then for i = 1, numRequirements, 1 do ability, hasReq = GetTrainerServiceAbilityReq(id, i) _, _, abilityType = GetTrainerServiceInfo(id) if (ability) then if (hasReq or (abilityType == "used")) then requirements = requirements .. separator .. format(TRAINER_REQ_ABILITY, ability) else requirements = requirements .. separator .. format(TRAINER_REQ_ABILITY_RED, ability) end end separator = ", " end end if (requirements ~= "") then ClassTrainerPlusSkillRequirements:SetText(REQUIRES_LABEL .. " " .. requirements) else ClassTrainerPlusSkillRequirements:SetText("") end -- Money Frame and cost local moneyCost, isProfession = GetTrainerServiceCost(id) local unavailable if (moneyCost == 0) then ClassTrainerPlusDetailMoneyFrame:Hide() ClassTrainerPlusCostLabel:Hide() ClassTrainerPlusSkillDescription:SetPoint("TOPLEFT", "ClassTrainerPlusCostLabel", "TOPLEFT", 0, 0) else ClassTrainerPlusDetailMoneyFrame:Show() ClassTrainerPlusCostLabel:Show() ClassTrainerPlusSkillDescription:SetPoint("TOPLEFT", "ClassTrainerPlusCostLabel", "BOTTOMLEFT", 0, -10) if (GetMoney() >= moneyCost) then SetMoneyFrameColor("ClassTrainerPlusDetailMoneyFrame", "white") else SetMoneyFrameColor("ClassTrainerPlusDetailMoneyFrame", "red") unavailable = 1 end end MoneyFrame_Update("ClassTrainerPlusDetailMoneyFrame", moneyCost) if (isProfession) then ClassTrainerPlusFrame.showDialog = true local profCount = GetNumPrimaryProfessions() if profCount >= 2 then unavailable = 1 end else ClassTrainerPlusFrame.showDialog = nil end if (not showIgnored and service.isIgnored) then unavailable = 1 end ClassTrainerPlusSkillDescription:SetText(GetTrainerServiceDescription(id)) if (serviceType == "available" and not unavailable) then ClassTrainerPlusTrainButton:Enable() else ClassTrainerPlusTrainButton:Disable() end -- Determine what type of spell to display local isLearnSpell local isPetLearnSpell isLearnSpell, isPetLearnSpell = IsTrainerServiceLearnSpell(id) if (isLearnSpell) then if (isPetLearnSpell) then ClassTrainerPlusSkillName:SetText(ClassTrainerPlusSkillName:GetText() .. TRAINER_PET_SPELL_LABEL) end end ClassTrainerPlusDetailScrollFrame:UpdateScrollChildRect() -- Close the confirmation dialog if you choose a different skill if (StaticPopup_Visible("CONFIRM_PROFESSION")) then StaticPopup_Hide("CONFIRM_PROFESSION") end end function ClassTrainerPlusSkillButton_OnClick(self, button) if (ClassTrainerPlusToggleFrame ~= nil and ClassTrainerPlusToggleFrame:IsVisible()) then CloseDropDownMenus() end if (button == "LeftButton") then local service = ctp.TrainerServices:GetService(self:GetID()) ClassTrainerPlusFrame.selectedService = service.serviceId ClassTrainerPlusFrame.showSkillDetails = 1 ClassTrainerPlus_SetSelection(self:GetID()) ClassTrainerPlusFrame_Update() elseif (button == "RightButton" and not IsTradeskillTrainer()) then local service = ctp.TrainerServices:GetService(self:GetID()) if (service.type == "header" or service.type == "used") then return end PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON) local menuTitle = service.menuTitle local checked = false if (service.isIgnored) then checked = true end local menu = { {text = menuTitle, isTitle = true, classicChecks = true}, { text = ctp.L["IGNORED"], checked = checked, func = function() PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON) local ability = ctp.Abilities:GetByNameAndSubText(service.name, service.subText) local spellId = ability and ability.spellId or 0 if (spellId ~= nil and spellId > 0) then if (ClassTrainerPlusDBPC[spellId] == nil) then ClassTrainerPlusDBPC[spellId] = checked end ClassTrainerPlusDBPC[spellId] = not ClassTrainerPlusDBPC[spellId] else print(format("ClassTrainerPlus: could not find spell for %s", service.name)) end UpdateUserFilters() TrainerUpdateHandler() end, classicChecks = true } } local menuFrame = CreateFrame("Frame", "ClassTrainerPlusToggleFrame", UIParent, "UIDropDownMenuTemplate") EasyMenu(menu, menuFrame, "cursor", 10, 35, "MENU") end end function ClassTrainerPlusTrainButton_OnClick() if (IsTradeskillTrainer() and ClassTrainerPlusFrame.showDialog) then StaticPopup_Show("CONFIRM_PROFESSION") else if (not IsTradeskillTrainer() and IsShiftKeyDown()) then if (GetMoney() < ctp.TrainerServices.availableCost) then print("ClassTrainerPlus: You don't have enough money to train everything!") return end ClassTrainerPlusFrame:UnregisterEvent("TRAINER_UPDATE") local idsToLearn = ctp.TrainerServices:VisibleAvailableServiceIds() for i = #idsToLearn, 1, -1 do local id = idsToLearn[i] BuyTrainerService(id) end ClassTrainerPlusFrame:RegisterEvent("TRAINER_UPDATE") print( format( "ClassTrainerPlus: You learned %d spells at a cost of %s", #idsToLearn, GetCoinTextureString(ctp.TrainerServices.availableCost) ) ) else BuyTrainerService(ClassTrainerPlusFrame.selectedService) end local nextSelection = ctp.TrainerServices:GetNextAvailableServiceId(ClassTrainerPlusFrame.selectedService) if (nextSelection ~= nil and nextSelection <= ctp.TrainerServices.totalServices) then ClassTrainerPlusFrame.showSkillDetails = 1 ClassTrainerPlus_SetSelection(nextSelection) else ClassTrainerPlusFrame.showSkillDetails = nil ClassTrainerPlusFrame.selectedService = nil end ClassTrainerPlusFrame_Update() end end function ClassTrainerPlus_SetSubTextColor(button, r, g, b) button.subR = r button.subG = g button.subB = b _G[button:GetName() .. "SubText"]:SetTextColor(r, g, b) end function ClassTrainerPlusCollapseAllButton_OnClick(self) if (self.collapsed) then self.collapsed = nil ExpandTrainerSkillLine(0) else self.collapsed = 1 ClassTrainerPlusListScrollFrameScrollBar:SetValue(0) CollapseTrainerSkillLine(0) end end function ClassTrainerPlus_HideSkillDetails() ClassTrainerPlusSkillName:Hide() ClassTrainerPlusSkillIcon:Hide() ClassTrainerPlusSkillRequirements:Hide() ClassTrainerPlusSkillDescription:Hide() ClassTrainerPlusDetailMoneyFrame:Hide() ClassTrainerPlusCostLabel:Hide() end function ClassTrainerPlus_ShowSkillDetails() ClassTrainerPlusSkillName:Show() ClassTrainerPlusSkillIcon:Show() ClassTrainerPlusSkillRequirements:Show() ClassTrainerPlusSkillDescription:Show() ClassTrainerPlusDetailMoneyFrame:Show() --ClassTrainerPlusCostLabel:Show(); end function ClassTrainerPlus_SetToTradeSkillTrainer() CLASS_TRAINER_SKILLS_DISPLAYED = 10 ClassTrainerPlusSkill11:Hide() ClassTrainerPlusListScrollFrame:SetHeight(168) ClassTrainerPlusDetailScrollFrame:SetHeight(135) ClassTrainerPlusHorizontalBarLeft:SetPoint("TOPLEFT", "ClassTrainerPlusFrame", "TOPLEFT", 15, -259) end function ClassTrainerPlus_SetToClassTrainer() CLASS_TRAINER_SKILLS_DISPLAYED = 11 ClassTrainerPlusListScrollFrame:SetHeight(184) ClassTrainerPlusDetailScrollFrame:SetHeight(119) ClassTrainerPlusHorizontalBarLeft:SetPoint("TOPLEFT", "ClassTrainerPlusFrame", "TOPLEFT", 15, -275) end -- Dropdown functions function ClassTrainerPlusFrameFilterDropDown_OnLoad(self) UIDropDownMenu_Initialize(self, ClassTrainerPlusFrameFilterDropDown_Initialize) UIDropDownMenu_SetText(self, FILTER) UIDropDownMenu_SetWidth(self, 130) end function ClassTrainerPlusFrameFilterDropDown_Initialize() -- Available button local info = {} local checked = nil if (GetTrainerServiceTypeFilter("available")) then checked = 1 end info.text = GREEN_FONT_COLOR_CODE .. AVAILABLE .. FONT_COLOR_CODE_CLOSE info.value = "available" info.func = ClassTrainerPlusFrameFilterDropDown_OnClick info.checked = checked info.keepShownOnClick = 1 info.classicChecks = true UIDropDownMenu_AddButton(info) if (not IsTradeskillTrainer()) then -- Ignored button info = {} checked = nil if (TRAINER_FILTER_IGNORED == 1) then checked = 1 end info.text = LIGHTYELLOW_FONT_COLOR_CODE .. ctp.L["IGNORED"] .. FONT_COLOR_CODE_CLOSE info.value = "ignored" info.func = ClassTrainerPlusFrameFilterDropDown_OnClick info.checked = checked info.keepShownOnClick = 1 info.classicChecks = true UIDropDownMenu_AddButton(info) end -- Unavailable button info = {} checked = nil if (GetTrainerServiceTypeFilter("unavailable")) then checked = 1 end info.text = RED_FONT_COLOR_CODE .. UNAVAILABLE .. FONT_COLOR_CODE_CLOSE info.value = "unavailable" info.func = ClassTrainerPlusFrameFilterDropDown_OnClick info.checked = checked info.keepShownOnClick = 1 info.classicChecks = true UIDropDownMenu_AddButton(info) -- Already Known button info = {} checked = nil if (GetTrainerServiceTypeFilter("used")) then checked = 1 end info.text = GRAY_FONT_COLOR_CODE .. USED .. FONT_COLOR_CODE_CLOSE info.value = "used" info.func = ClassTrainerPlusFrameFilterDropDown_OnClick info.checked = checked info.keepShownOnClick = 1 info.classicChecks = true UIDropDownMenu_AddButton(info) end function ClassTrainerPlusFrameFilterDropDown_OnClick(self) local newFilterValue = 0 if (UIDropDownMenuButton_GetChecked(self)) then newFilterValue = 1 end ClassTrainerPlusListScrollFrameScrollBar:SetValue(0) FauxScrollFrame_SetOffset(ClassTrainerPlusListScrollFrame, 0) _G["TRAINER_FILTER_" .. strupper(self.value)] = newFilterValue if (self.value == "ignored") then TrainerUpdateHandler() else SetTrainerServiceTypeFilter(self.value, newFilterValue) end end local function trim(str) return (string.gsub(str, "^%s*(.-)%s*$", "%1")) end SLASH_CTP1 = "/ctp" SLASH_CTP2 = "/ClassTrainerPlus" SlashCmdList["CTP"] = function(msg) local _, _, cmd, args = string.find(msg, "%s?(%w+)%s?(.*)") cmd = trim(string.lower(cmd)) args = trim(string.lower(args)) if (cmd == "import" and args == "") then print("You must include the import string when importing") return elseif (cmd == "import") then local import = {} if (strlen(args) % 3 ~= 0) then print("ClassTrainerPlus could not import due to a malformed input string") return end for i = 1, strlen(args), 3 do local part = string.sub(args, i, i + 2) if (strlen(part) ~= 3) then print(format("ClassTrainerPlus ran into a malformed part, '%s', and aborted the import", part)) return end local spellId = tonumber(part, 36) if (not ctp.Abilities:IsSpellIdStored(spellId)) then print(format("ClassTrainerPlus is aborting the import because spellId %d does not belong to this class", spellId)) return end tinsert(import, spellId) end local newImports = 0 for _, v in ipairs(import) do if (ClassTrainerPlusDBPC[v] ~= true) then ClassTrainerPlusDBPC[v] = true newImports = newImports + 1 end end UpdateUserFilters() TrainerUpdateHandler() print( format( "ClassTrainerPlus imported %d new ignored abilities (%d were already ignored)", newImports, #import - newImports ) ) elseif (cmd == "clear") then ClassTrainerPlusDBPC = {} ctp.Abilities:Load(classSpellIds) TrainerUpdateHandler() print("ClassTrainerPlus database cleared") end end
--Création de la table qui va contenir toute les infos de chaque joueurs present sur le serveur PlayerData = {} DialogNPC = {} GameTime = 12.0 PLAYER_STATE_FREE = 1 PLAYER_STATE_IN_DIALOG = 2
while not _G["DataBase"] do Task.Wait() end local database = _G["DataBase"] function OnResourceChanged(player, resourceName, resourceValue) if resourceName == "Score Total" or resourceValue == 0 then return end --print("Resource Changed " .. resourceName) player:AddResource("Score Total", resourceValue) end function ConnectPlayer(player) Task.Wait(1) player.resourceChangedEvent:Connect(OnResourceChanged) end -- Game.playerJoinedEvent:Connect(ConnectPlayer)
local args, ops = require("shell").parse(...) if ops.s then while true do local line = io.stdin:read("l") if not line or #line == 0 then break end print(line) end else for k, v in pairs(args) do io.stdout:write(v) if k < #args then io.stdout:write(" ") end end end if not ops.n and not ops.s then print() end
description = [[ Determines which methods are supported by the RTSP (real time streaming protocol) server. ]] --- -- @usage -- nmap -p 554 --script rtsp-methods <ip> -- -- @output -- PORT STATE SERVICE -- 554/tcp open rtsp -- | rtsp-methods: -- |_ DESCRIBE, SETUP, PLAY, TEARDOWN, OPTIONS -- -- @args rtsp-methods.path the path to query, defaults to "*" which queries -- the server itself, rather than a specific url. -- -- -- Version 0.1 -- Created 23/10/2011 - v0.1 - created by Patrik Karlsson <[email protected]> -- author = "Patrik Karlsson" license = "Same as Nmap--See http://nmap.org/book/man-legal.html" categories = {"default", "safe"} require 'rtsp' require 'shortport' portrule = shortport.port_or_service(554, "rtsp", "tcp", "open") action = function(host, port) local path = stdnse.get_script_args('rtsp-methods.path') or '*' local helper = rtsp.Helper:new(host, port) local status = helper:connect() if ( not(status) ) then stdnse.print_debug(2, "ERROR: Failed to connect to RTSP server") return end local response status, response = helper:options(path) helper:close() if ( status ) then return stdnse.format_output(true, response.headers['Public']) end end
local _, nMainbar = ... local cfg = nMainbar.Config if (not cfg.MainMenuBar.skinButton) then return end local _G, pairs, unpack = _G, pairs, unpack local path = 'Interface\\AddOns\\nMainbar\\media\\' local function IsSpecificButton(self, name) local sbut = self:GetName():match(name) if (sbut) then return true else return false end end local function UpdateVehicleButton() for i = 1, NUM_OVERRIDE_BUTTONS do local hotkey = _G['OverrideActionBarButton'..i..'HotKey'] if (cfg.button.showVehicleKeybinds) then hotkey:SetFont(cfg.button.hotkeyFont, cfg.button.hotkeyFontsize + 3, 'OUTLINE') hotkey:SetVertexColor(unpack(cfg.color.HotKeyText)) else hotkey:Hide() end end end hooksecurefunc('PetActionBar_Update', function() for _, name in pairs({ 'PetActionButton', 'PossessButton', 'StanceButton', }) do for i = 1, 12 do local button = _G[name..i] if (button) then button:SetNormalTexture(path..'textureNormal') if (not InCombatLockdown()) then local cooldown = _G[name..i..'Cooldown'] cooldown:ClearAllPoints() cooldown:SetPoint('TOPRIGHT', button, -2, -2) cooldown:SetPoint('BOTTOMLEFT', button, 1, 1) end if (not button.Shadow) then local normal = _G[name..i..'NormalTexture2'] or _G[name..i..'NormalTexture'] normal:ClearAllPoints() normal:SetPoint('TOPRIGHT', button, 1.5, 1.5) normal:SetPoint('BOTTOMLEFT', button, -1.5, -1.5) normal:SetVertexColor(cfg.color.Normal[1], cfg.color.Normal[2], cfg.color.Normal[3], 1) local icon = _G[name..i..'Icon'] icon:SetTexCoord(0.05, 0.95, 0.05, 0.95) icon:SetPoint('TOPRIGHT', button, 1, 1) icon:SetPoint('BOTTOMLEFT', button, -1, -1) local flash = _G[name..i..'Flash'] flash:SetTexture(flashtex) button:SetCheckedTexture(path..'textureChecked') button:GetCheckedTexture():SetAllPoints(normal) button:SetPushedTexture(path..'texturePushed') button:GetPushedTexture():SetAllPoints(normal) button:SetHighlightTexture(path..'textureHighlight') button:GetHighlightTexture():SetAllPoints(normal) local buttonBg = _G[name..i..'FloatingBG'] if (buttonBg) then buttonBg:ClearAllPoints() buttonBg:SetPoint('TOPRIGHT', button, 5, 5) buttonBg:SetPoint('BOTTOMLEFT', button, -5, -5) buttonBg:SetTexture(path..'textureShadow') buttonBg:SetVertexColor(0, 0, 0, 1) button.Shadow = true else button.Shadow = button:CreateTexture(nil, 'BACKGROUND') button.Shadow:SetParent(button) button.Shadow:SetPoint('TOPRIGHT', normal, 4, 4) button.Shadow:SetPoint('BOTTOMLEFT', normal, -4, -4) button.Shadow:SetTexture(path..'textureShadow') button.Shadow:SetVertexColor(0, 0, 0, 1) end local hotkey = _G[name..i..'HotKey'] if (cfg.button.showKeybinds) then hotkey:ClearAllPoints() hotkey:SetPoint('TOPRIGHT', button, 0, -3) hotkey:SetFont(cfg.button.hotkeyFont, cfg.button.petHotKeyFontsize, 'OUTLINE') hotkey:SetVertexColor(unpack(cfg.color.HotKeyText)) end end end end end end) -- Force an update for StanceButton for those who doesn't have pet bar securecall('PetActionBar_Update') hooksecurefunc('ActionButton_Update', function(self) -- Force an initial update because it isn't triggered on login (v6.0.2) ActionButton_UpdateHotkeys(self, self.buttonType) if (IsSpecificButton(self, 'MultiCast')) then for _, icon in pairs({ self:GetName(), 'MultiCastRecallSpellButton', 'MultiCastSummonSpellButton', }) do local button = _G[icon] -- XXX: Causes an error on 6.0.2 -- button:SetNormalTexture(nil) if (not button.Shadow) then local icon = _G[self:GetName()..'Icon'] icon:SetTexCoord(0.05, 0.95, 0.05, 0.95) button.Shadow = button:CreateTexture(nil, 'BACKGROUND') button.Shadow:SetParent(button) button.Shadow:SetPoint('TOPRIGHT', button, 4.5, 4.5) button.Shadow:SetPoint('BOTTOMLEFT', button, -4.5, -4.5) button.Shadow:SetTexture(path..'textureShadow') button.Shadow:SetVertexColor(0, 0, 0, 0.85) end end elseif (not IsSpecificButton(self, 'ExtraActionButton')) then local button = _G[self:GetName()] --[[ -- no 'macr...' local macroname = _G[self:GetName()..'Name'] if (macroname) then if (cfg.button.showMacronames) then if (macroname:GetText()) then macroname:SetText(macroname:GetText():sub(1, 6)) end end end --]] if (not button.Background) then local normal = _G[self:GetName()..'NormalTexture'] if (normal) then normal:ClearAllPoints() normal:SetPoint('TOPRIGHT', button, 1, 1) normal:SetPoint('BOTTOMLEFT', button, -1, -1) normal:SetVertexColor(unpack(cfg.color.Normal)) end button:SetNormalTexture(path..'textureNormal') button:SetCheckedTexture(path..'textureChecked') button:GetCheckedTexture():SetAllPoints(normal) button:SetPushedTexture(path..'texturePushed') button:GetPushedTexture():SetAllPoints(normal) button:SetHighlightTexture(path..'textureHighlight') button:GetHighlightTexture():SetAllPoints(normal) local icon = _G[self:GetName()..'Icon'] icon:SetTexCoord(0.05, 0.95, 0.05, 0.95) local count = _G[self:GetName()..'Count'] if (count) then count:SetPoint('BOTTOMRIGHT', button, 0, 1) count:SetFont(cfg.button.countFont, cfg.button.countFontsize, 'OUTLINE') count:SetVertexColor(unpack(cfg.color.CountText)) end local macroname = _G[self:GetName()..'Name'] if (macroname) then if (not cfg.button.showMacronames) then macroname:SetAlpha(0) else macroname:SetWidth(button:GetWidth() + 15) macroname:SetFont(cfg.button.macronameFont, cfg.button.macronameFontsize, 'OUTLINE') macroname:SetVertexColor(unpack(cfg.color.MacroText)) end end local buttonBg = _G[self:GetName()..'FloatingBG'] if (buttonBg) then buttonBg:ClearAllPoints() buttonBg:SetPoint('TOPRIGHT', button, 5, 5) buttonBg:SetPoint('BOTTOMLEFT', button, -5, -5) buttonBg:SetTexture(path..'textureShadow') buttonBg:SetVertexColor(0, 0, 0, 1) end button.Background = button:CreateTexture(nil, 'BACKGROUND', nil, -8) button.Background:SetTexture(path..'textureBackground') button.Background:SetPoint('TOPRIGHT', button, 14, 12) button.Background:SetPoint('BOTTOMLEFT', button, -14, -16) end if (not InCombatLockdown()) then local cooldown = _G[self:GetName()..'Cooldown'] cooldown:ClearAllPoints() cooldown:SetPoint('TOPRIGHT', button, -2, -2.5) cooldown:SetPoint('BOTTOMLEFT', button, 2, 2) end local border = _G[self:GetName()..'Border'] if (border) then if (IsEquippedAction(self.action)) then _G[self:GetName()..'Border']:SetAlpha(1) _G[self:GetName()..'Border']:SetVertexColor(unpack(cfg.color.IsEquipped)) else _G[self:GetName()..'Border']:SetAlpha(0) end end end end) hooksecurefunc('ActionButton_ShowGrid', function(self) local normal = _G[self:GetName()..'NormalTexture'] if (normal) then normal:SetVertexColor(unpack(cfg.color.Normal)) end end) hooksecurefunc('ActionButton_UpdateUsable', function(self) if (IsAddOnLoaded('RedRange') or IsAddOnLoaded('GreenRange') or IsAddOnLoaded('tullaRange') or IsAddOnLoaded('RangeColors')) then return end local normal = _G[self:GetName()..'NormalTexture'] if (normal) then normal:SetVertexColor(unpack(cfg.color.Normal)) end local isUsable, notEnoughMana = IsUsableAction(self.action) if (isUsable) then _G[self:GetName()..'Icon']:SetVertexColor(1, 1, 1) elseif (notEnoughMana) then _G[self:GetName()..'Icon']:SetVertexColor(unpack(cfg.color.OutOfMana)) else _G[self:GetName()..'Icon']:SetVertexColor(unpack(cfg.color.NotUsable)) end end) hooksecurefunc('ActionButton_UpdateHotkeys', function(self, actionButtonType) local hotkey = _G[self:GetName()..'HotKey'] if (not IsSpecificButton(self, 'OverrideActionBarButton')) then if (cfg.button.showKeybinds) then hotkey:ClearAllPoints() hotkey:SetPoint('TOPRIGHT', self, 0, -3) hotkey:SetFont(cfg.button.hotkeyFont, cfg.button.hotkeyFontsize, 'OUTLINE') hotkey:SetVertexColor(unpack(cfg.color.HotKeyText)) else hotkey:Hide() end else UpdateVehicleButton() end end) hooksecurefunc('ActionButton_OnUpdate', function(self, elapsed) if (IsAddOnLoaded('tullaRange') or IsAddOnLoaded('RangeColors')) then return end if (self.rangeTimer == TOOLTIP_UPDATE_TIME) then local hotkey = _G[self:GetName()..'HotKey'] local valid = IsActionInRange(self.action) if ( hotkey:GetText() == RANGE_INDICATOR ) then if ( valid == false ) then hotkey:Show() if ( cfg.button.buttonOutOfRange ) then _G[self:GetName()..'Icon']:SetVertexColor(unpack(cfg.color.OutOfRange)) hotkey:SetVertexColor(unpack(cfg.color.OutOfRange)) else hotkey:SetVertexColor(unpack(cfg.color.OutOfRange)) end elseif ( valid ) then hotkey:Show() hotkey:SetVertexColor(unpack(cfg.color.HotKeyText)) ActionButton_UpdateUsable(self) else hotkey:Hide() end else if ( valid == false ) then if ( cfg.button.buttonOutOfRange ) then _G[self:GetName()..'Icon']:SetVertexColor(unpack(cfg.color.OutOfRange)) hotkey:SetVertexColor(unpack(cfg.color.OutOfRange)) else hotkey:SetVertexColor(unpack(cfg.color.OutOfRange)) end else hotkey:SetVertexColor(unpack(cfg.color.HotKeyText)) ActionButton_UpdateUsable(self) end end end end)
Registry = {} function Registry:name_to_id(type, name) if not self._NAME_TO_IDS[type] then self._NAME_TO_IDS[type] = {} end return self._NAME_TO_IDS[type][name] or name end function Registry:id_to_name(type, id) if not self._ID_TO_NAMES[type] then self._ID_TO_NAMES[type] = {} end return self._ID_TO_NAMES[type][id] or id end function Registry:register(type, name, id) if not self._NAME_TO_IDS[type] then self._NAME_TO_IDS[type] = {} end if not self._ID_TO_NAMES[type] then self._ID_TO_NAMES[type] = {} end self._NAME_TO_IDS[type][name] = id self._ID_TO_NAMES[type][id] = name end local function init() Registry._NAME_TO_IDS = {} Registry._ID_TO_NAMES = {} end init()
data:extend ( { { type = "item-subgroup", name = "RW_bridges", group = "logistics", order = "i", } } )
vim.api.nvim_set_var( "knobs_levels", { fugitive = 3, eunuch = 5 } ) vim.api.nvim_set_var( "knobs_layers", { foo = vim.env.VIM_KNOBS_FOO == "1" and 1 or 0 } ) vim.api.nvim_set_var( "knobs_layers_map", { foo = { compactcmd = 1 } } ) require("packer").startup { function(_use) use = require("knobs").use(_use) use "wbthomason/packer.nvim" use {"ianhomer/knobs.vim", lock = true} use {"tpope/vim-fugitive", cmd = {"G", "Git"}} use "tpope/vim-eunuch" use "tpope/vim-dispatch" use "tweekmonster/startuptime.vim" end } vim.o.cmdheight = vim.g.knob_compactcmd and 1 or 2
-- -- ConfirmSetAsPlayedAllView.lua -- require "Common" if language() == "fr" then confirmSetAsPlayedAllStr="Mettre comme jouées toutes les séquences?\n\nCette opération ne peut être défaite." cancelStr = "Annuler" else confirmSetAsPlayedAllStr="Set as played all the sequences?\n\nThis operation cannot be undone." cancelStr = "Cancel" end ------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------ topView = getTopView() boxView = BoxView.new("boxView") boxView:setCornerRadius(5) messageLabelView = LabelView.new("messageLabelView", confirmSetAsPlayedAllStr) okButton = Button.new("okButton", "OK") cancelButton = Button.new("cancelButton", cancelStr) topView:addSubview(boxView) topView:addSubview(messageLabelView) topView:addSubview(okButton) topView:addSubview(cancelButton) topView:setLayoutFn(layoutConfirmationView) setContentSize(makeSize(500, 200))
-- thanks topbar plus! local icon = require(game.ReplicatedStorage:WaitForChild("modules").vendor.Icon) local iconFolder = game.ReplicatedStorage:WaitForChild("modules").vendor.Icon local IconController = require(iconFolder.IconController) local Themes = require(iconFolder.Themes) local showStatPointAlerts = game.ReplicatedStorage:WaitForChild("events"):WaitForChild("showStatPointAlerts") IconController.setGameTheme(Themes["BlueGradient"]) local stats = icon.new() stats:setImage(7230252017) stats:setLabel("Stat Book") -- network events showStatPointAlerts.OnClientEvent:Connect(function(statPoints) local tick = 1 while true do if tick == statPoints then print("alerted user of statpoints!") break end stats:notify() task.wait(0.1) tick += 1 end stats:notify() end) stats:bindEvent("selected", function () game.ReplicatedStorage:WaitForChild("events").openStatBook:Fire() end) stats:bindEvent("deselected", function() local statsGui = game.Players.LocalPlayer.PlayerGui:FindFirstChild("statBook") if statsGui ~= nil then statsGui:Destroy() end end) local book = icon.new() book:setImage(7230254493) book:setLabel("Ability Book") book:bindEvent("selected", function () print("bob") end) local backpack = icon.new() backpack:setImage(7230246878) backpack:setLabel("Backpack") backpack:bindEvent("selected", function () -- wait for the event to be created by backpackManager game.ReplicatedStorage.events:WaitForChild("openUserBackpack"):Fire() end) backpack:bindEvent("deselected", function() local backpackUi = game.Players.LocalPlayer.PlayerGui:FindFirstChild("backpackView") if backpackUi ~= nil then backpackUi:Destroy() end end)
mhf = require("schema_processor") unistd = require("posix.unistd"); local xml_string = [=[<?xml version="1.0" encoding="UTF-8"?> <ns1:simple_choice_struct xmlns:ns1="http://test_example.com"> <author>asdf</author> <title>adfas</title> <genre>as</genre> </ns1:simple_choice_struct>]=] mhf = require("schema_processor") simple_choice_struct = mhf:get_message_handler("simple_choice_struct", "http://test_example.com"); local content, msg = simple_choice_struct:from_xml(xml_string) if (type(content) == 'table') then require 'pl.pretty'.dump(content); else print(content, msg) end
--[[ -- -- This is a port of a generic rules engine framework -- @see https://github.com/bobthecow/Ruler -- --]] Ruler = {} Ruler.Rule = {} Ruler.Rule.__index = Ruler.Rule --[[ -- @param table condition -- @return Rule --]] function Ruler.Rule.New(condition) local self = setmetatable({['condition'] = condition}, Ruler.Rule) return self end --[[ -- @param table context -- @return boolean --]] function Ruler.Rule:Evaluate(context) return self.condition:Evaluate(context) end Ruler.Value = {} Ruler.Value.__index = Ruler.Value --[[ -- @param mixed value -- @return Value --]] function Ruler.Value.New(value) local self = setmetatable({['value'] = value}, Ruler.Value) return self end --[[ -- @return mixed --]] function Ruler.Value:GetValue() return self.value end --[[ -- @param Value value -- @return boolean --]] function Ruler.Value:EqualTo(value) return (self.value == value:GetValue()) end --[[ -- @param Value value -- @return boolean --]] function Ruler.Value:Contains(value) end --[[ -- @param Value value -- @return boolean --]] function Ruler.Value:GreaterThan(value) return (self.value > value:GetValue()) end --[[ -- @param Value value -- @return boolean --]] function Ruler.Value:LessThan(value) return (self.value < value:GetValue()) end Ruler.Variable = Ruler.Variable or {} Ruler.Variable.__index = Ruler.Variable --[[ -- @param string name -- @param mixed value -- @return Variable --]] function Ruler.Variable.New(name, value) local self = setmetatable({['name'] = name, ['value'] = value}, Ruler.Variable) return self end --[[ -- @return string --]] function Ruler.Variable:GetName() return self.name end --[[ -- @return mixed --]] function Ruler.Variable:GetValue() return self.value end --[[ -- @param table context -- @return Value --]] function Ruler.Variable:PrepareValue(context) if nil ~= self.name and nil ~= context[self.name] then value = context[self.name] else value = self.value end return Ruler.Value.New(value) end Ruler.Operator = {} Ruler.Operator.ComparisonOperator = {} Ruler.Operator.ComparisonOperator.__index = Ruler.Operator.ComparisonOperator --[[ -- @param Variable -- @param Variable -- @return ComparisonOperator --]] function Ruler.Operator.ComparisonOperator.New(left, right) local self = setmetatable({['left'] = left, ['right'] = right}, Ruler.Operator.ComparisonOperator) return self end Ruler.Operator.EqualTo = {} Ruler.Operator.EqualTo.__index = Ruler.Operator.EqualTo function Ruler.Operator.EqualTo.New(left, right) local self = setmetatable({['left'] = left, ['right'] = right}, Ruler.Operator.EqualTo) return self end --[[ -- @param table context -- @return boolean --]] function Ruler.Operator.EqualTo:Evaluate(context) return (self.left:PrepareValue(context):EqualTo(self.right:PrepareValue(context))) end
return Def.Quad{ InitCommand=function(self) self:Center():FullScreen() end; };
-- gaming -- https://github.com/ukgamer/gmod-arcademachines -- Made by Jule if not FONT:Exists( "Snake32" ) then surface.CreateFont( "Snake32", { font = "Trebuchet MS", size = 32, weight = 500, antialias = 1, additive = 1 } ) end if not FONT:Exists( "SnakeTitle" ) then surface.CreateFont( "SnakeTitle", { font = "Trebuchet MS", size = 70, italic = true, weight = 500, antialias = 1, additive = 1 } ) end local function PlayLoaded( loaded ) if IsValid( SOUND.Sounds[loaded].sound ) then SOUND.Sounds[loaded].sound:SetTime( 0 ) SOUND.Sounds[loaded].sound:Play() end end local function StopLoaded( loaded ) if IsValid( SOUND.Sounds[loaded].sound ) then SOUND.Sounds[loaded].sound:Pause() end end local GAME = { Name = "Snake", Author = "Jule", Description = "Get a score as high as possible by eating apples!\nMove the snake with WASD.", CabinetArtURL = "https://raw.githubusercontent.com/ukgamer/gmod-arcademachines-assets/master/snake/images/ms_acabinet_artwork.png", Bodygroup = BG_GENERIC_RECESSED_JOYSTICK } local STATE_ATTRACT = 0 local STATE_AWAITING = 1 local STATE_PLAYING = 2 local BORDER_X = 20 local BORDER_Y = 60 local BORDER_WIDTH = 470 local BORDER_HEIGHT = 400 local SNAKESIZE = 10 local SNAKE_UP = Vector(0, -SNAKESIZE) local SNAKE_DOWN = Vector(0, SNAKESIZE) local SNAKE_RIGHT = Vector(SNAKESIZE, 0) local SNAKE_LEFT = Vector(-SNAKESIZE, 0) local GOAL = 10 local COLOR_SNAKE = Color(25, 255, 25) local COLOR_APPLE_N = Color(255, 25, 25) local COLOR_APPLE_B = Color(25, 25, 255) local COLOR_APPLE_G = Color(255, 223, 127) local state local pelaaja local score local delay local snakebod local snakecol local boosted_at local golds_eaten local queue local apples function GAME:Init() -- Called when MACHINE:Set(Current)Game( game ) is called. state = STATE_ATTRACT end function GAME:Start() queue = {SNAKE_DOWN} snakecol = COLOR_SNAKE boosted_at = RealTime() - 11 state = STATE_PLAYING delay = 0.1 golds_eaten = 0 score = 0 snakebod = {} apples = {} for i = 1, 3 do snakebod[i] = Vector(BORDER_X + 100, BORDER_Y + 100 - SNAKESIZE * i) end StopLoaded("intromusic") end function GAME:Stop() COINS:TakeCoins(1) state = STATE_AWAITING end -- There is still a 0.025s zone where input isn't taken because -- KeyPressed runs like 5 times over the course of something a bit less than 0.025s -- Before it was 0.1s so its still wayy better local queue_o local last_input = RealTime() function GAME:Input() if last_input + 0.025 > RealTime() then return end if pelaaja:KeyPressed(IN_FORWARD) and queue_o.x ~= 0 then table.insert(queue, SNAKE_UP) last_input = RealTime() elseif pelaaja:KeyPressed(IN_BACK) and queue_o.x ~= 0 then table.insert(queue, SNAKE_DOWN) last_input = RealTime() elseif pelaaja:KeyPressed(IN_MOVERIGHT) and queue_o.y ~= 0 then table.insert(queue, SNAKE_RIGHT) last_input = RealTime() elseif pelaaja:KeyPressed(IN_MOVELEFT) and queue_o.y ~= 0 then table.insert(queue, SNAKE_LEFT) last_input = RealTime() end end function GAME:SnakeMove(head) if not queue[1] then queue[1] = queue_o end local newp = Vector(head.x, head.y) for key, part in ipairs(snakebod) do if key == 1 then for _, queued in ipairs(queue) do head.x, head.y = head.x + queued.x, head.y + queued.y end else local x, y = part.x, part.y part.x, part.y = newp.x, newp.y newp.x, newp.y = x, y end end queue_o = queue[#queue] queue = {} SOUND:EmitSound("garrysmod/ui_hover.wav") end function GAME:CheckForDeath(head) local dead dead = head.x > BORDER_X + BORDER_WIDTH - SNAKESIZE and true or head.y > BORDER_Y + BORDER_HEIGHT - SNAKESIZE and true or head.x < BORDER_X and true or head.y < BORDER_Y and true or false for key, part in ipairs(snakebod) do dead = dead == true and true or key == 1 and 0 or part.x ~= head.x and 0 or part.y ~= head.y and 0 or true end return dead end function GAME:CreateApple() local x = math.Round(math.random(BORDER_X + 30, BORDER_WIDTH - 30), -1) local y = math.Round(math.random(BORDER_Y + 30, BORDER_HEIGHT - 30), -1) -- Prevent spawning on top of other apples or the snake for _, part in ipairs(snakebod) do if part.x == x and part.y == y then return end end for _, apple in ipairs(apples) do if apple[1].x == x and apple[1].y == y then return end end local a_type = math.random(0, 15) a_type = a_type > 2 and 0 or a_type local a_color = a_type == 0 and COLOR_APPLE_N or a_type == 1 and COLOR_APPLE_B or a_type == 2 and COLOR_APPLE_G table.insert(apples, {Vector(x, y), a_color, a_type}) end function GAME:EatApple(apple) local head = snakebod[1] local apple_type = apple[3] table.RemoveByValue(apples, apple) table.insert(snakebod, Vector(head.x, head.y)) if apple_type == 0 then PlayLoaded("eatnormal") elseif apple_type == 1 then PlayLoaded("eatboost") boosted_at = RealTime() elseif apple_type == 2 then SOUND:EmitSound("garrysmod/save_load3.wav") golds_eaten = golds_eaten + 1 score = score + 50 if golds_eaten == GOAL then PlayLoaded("goalreached") end return end score = score + 20 end local last_move = RealTime() function GAME:Update() if state < STATE_PLAYING or not IsValid(pelaaja) then return end GAME:Input() -- Snake tick if last_move + delay < RealTime() then last_move = RealTime() if #apples < 8 then self:CreateApple() end local head = snakebod[1] for _, apple in ipairs(apples) do if head.x == apple[1].x and head.y == apple[1].y then self:EatApple(apple) end end self:SnakeMove(head) -- Effects for eating boost apples and reaching 10 gold apples snakecol = boosted_at + 10 < RealTime() and (golds_eaten >= GOAL and COLOR_APPLE_G or COLOR_SNAKE) or COLOR_APPLE_B delay = boosted_at + 10 < RealTime() and 0.1 or 0.05 local dead = self:CheckForDeath(head) if tobool(dead) then PlayLoaded("death") PlayLoaded("gameover") self:Stop() return end end end function GAME:Draw() draw.SimpleText(COINS:GetCoins() .. " COIN(S)", "Trebuchet18", 25, 25, color_white) if state < STATE_PLAYING then draw.SimpleText( "INSERT COINS", "Snake32", SCREEN_WIDTH / 2, SCREEN_HEIGHT - 100, Color(255, 255, 255, RealTime() % 1 > .5 and 255 or 0), TEXT_ALIGN_CENTER ) surface.SetDrawColor(COLOR_SNAKE) if RealTime() % .45 > .225 then surface.DrawRect(SCREEN_WIDTH / 2 - 45, SCREEN_HEIGHT / 2, 90, 10) else surface.DrawRect(SCREEN_WIDTH / 2 - 45, SCREEN_HEIGHT / 2, 30, 10) surface.DrawRect(SCREEN_WIDTH / 2 - 15, SCREEN_HEIGHT / 2, 30, 10) surface.DrawRect(SCREEN_WIDTH / 2 - 30, SCREEN_HEIGHT / 2 - 7, 30, 10) end surface.SetDrawColor(COLOR_APPLE_N) surface.DrawRect(SCREEN_WIDTH / 2 - 120, SCREEN_HEIGHT / 2, 10, 10) return end draw.SimpleText("Score: " .. score, "Snake32", SCREEN_WIDTH / 2, 25, color_white, TEXT_ALIGN_CENTER) -- Either display x/10 of golden apples eaten or the amount of time left for a boost in seconds draw.SimpleText(boosted_at + 10 < RealTime() and math.min(golds_eaten, GOAL) .. "/" .. tostring(GOAL) or "0:" .. ((10 - math.Round(RealTime() - boosted_at) < 10) and "0" .. 10 - math.Round(RealTime() - boosted_at) or 10 - math.Round(RealTime() - boosted_at)), "Trebuchet24", SCREEN_WIDTH - 75, 25, color_white) -- Draw an apple beside the counter with gold/blue color surface.SetDrawColor(boosted_at + 10 < RealTime() and COLOR_APPLE_G or COLOR_APPLE_B) surface.DrawRect(SCREEN_WIDTH - 90, 30, SNAKESIZE, SNAKESIZE) -- Apples, borders and snake for _, apple in ipairs(apples) do surface.SetDrawColor(apple[2]) surface.DrawRect(apple[1].x, apple[1].y, SNAKESIZE, SNAKESIZE) end surface.SetDrawColor(snakecol) surface.DrawOutlinedRect(BORDER_X, BORDER_Y, BORDER_WIDTH, BORDER_HEIGHT) for key, part in ipairs(snakebod) do local col = Color(snakecol.r, snakecol.g, snakecol.b) col.a = math.max(col.a - key * 10, 20) surface.SetDrawColor(col) surface.DrawRect(part.x, part.y, SNAKESIZE, SNAKESIZE) end end function GAME:OnStartPlaying(ply) -- Called when the arcade machine is entered if ply == LocalPlayer() then SOUND:LoadFromURL( "https://raw.githubusercontent.com/ukgamer/gmod-arcademachines-assets/master/snake/sounds/song.ogg", "intromusic", function(snd) snd:EnableLooping(true) if state ~= STATE_PLAYING then PlayLoaded("intromusic") end end ) SOUND:LoadFromURL("https://raw.githubusercontent.com/ukgamer/gmod-arcademachines-assets/master/snake/sounds/eat_normal.ogg","eatnormal") SOUND:LoadFromURL("https://raw.githubusercontent.com/ukgamer/gmod-arcademachines-assets/master/snake/sounds/eat_boost.ogg","eatboost") -- Golden apples use a GMod sound when eaten. SOUND:LoadFromURL("https://raw.githubusercontent.com/ukgamer/gmod-arcademachines-assets/master/snake/sounds/goalreached.ogg", "goalreached") SOUND:LoadFromURL("https://raw.githubusercontent.com/ukgamer/gmod-arcademachines-assets/master/snake/sounds/death.ogg", "death") SOUND:LoadFromURL("https://raw.githubusercontent.com/ukgamer/gmod-arcademachines-assets/master/snake/sounds/gameover.ogg", "gameover") pelaaja = ply else return end state = STATE_AWAITING end function GAME:OnStopPlaying(ply) -- ^^ upon exit. if ply == pelaaja and ply == LocalPlayer() then pelaaja = nil else return end self:Stop() state = STATE_ATTRACT StopLoaded("intromusic") end function GAME:OnCoinsInserted(ply, old, new) if ply ~= LocalPlayer() then return end if new > 0 and state == STATE_AWAITING then self:Start() end end function GAME:OnCoinsLost(ply, old, new) if ply ~= LocalPlayer() then return end if new <= 0 then self:Stop() elseif new > 0 then self:Start() end end function GAME:DrawMarquee() -- Title text draw.SimpleText("SNAKE", "SnakeTitle", MARQUEE_WIDTH / 2 - 140, MARQUEE_HEIGHT / 2 - 25, color_white) -- Snake surface.SetDrawColor(COLOR_SNAKE) surface.DrawRect(MARQUEE_WIDTH / 2 + 20, 40, 120, 20) surface.DrawRect(MARQUEE_WIDTH / 2 + 140, 40, 20, 40) -- Apple surface.SetDrawColor(COLOR_APPLE_N) surface.DrawRect(MARQUEE_WIDTH / 2 + 140, 100, 20, 20) end return GAME
AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") util.AddNetworkString("XYZArmoryOpenUI") util.AddNetworkString("XYZArmoryCollectWeapon") -- Used to limit the amount of weapons a user can have per life XYZWeaponCap = {} function ENT:Initialize() self:SetModel("models/humans/nypd1940/male_03.mdl") self:SetHullType(HULL_HUMAN); self:SetHullSizeNormal(); self:SetNPCState(NPC_STATE_SCRIPT) self:SetSolid(SOLID_BBOX) self:SetUseType(SIMPLE_USE) self:DropToFloor() end function ENT:OnTakeDamage() return 0 end function ENT:Use(ply) if not XYZWeaponCap[ply:SteamID64()] then XYZWeaponCap[ply:SteamID64()] = 0 end if XYZWeaponCap[ply:SteamID64()] >= (XYZArmoryCap[ply:Team()] or 1) then XYZShit.Msg("Armory", Color(40, 160, 40), "You have already reached your weapon limit for this life", ply) return end net.Start("XYZArmoryOpenUI") net.WriteEntity(self) net.Send(ply) end net.Receive("XYZArmoryCollectWeapon", function(_, ply) if not XYZWeaponCap[ply:SteamID64()] then XYZWeaponCap[ply:SteamID64()] = 0 end if XYZWeaponCap[ply:SteamID64()] >= (XYZArmoryCap[ply:Team()] or 1) then XYZShit.Msg("Armory", Color(40, 160, 40), "You have already reached your weapon limit for this life", ply) return end local npc = net.ReadEntity() local key = net.ReadInt(32) if not (npc:GetClass() == "xyz_weapon_armory") then return end if npc:GetPos():Distance(ply:GetPos()) > 500 then return end local weaponTbl = XYZArmoryItems[key] if not weaponTbl then return end if not weaponTbl.check(ply) then return end ply:Give(weaponTbl.class).armory = true XYZWeaponCap[ply:SteamID64()] = XYZWeaponCap[ply:SteamID64()] + 1 end) hook.Add("PlayerSpawn", "XYZArmoryResetCap", function(ply) XYZWeaponCap[ply:SteamID64()] = 0 end) hook.Add("canDropWeapon", "XYZArmoryDropWep", function(ply, wep) if wep.armory then return false end end)
co = coroutine.create(function() for i = 1, 10 do print("co", i) coroutine.yield() end end) print(coroutine.status(co)) coroutine.resume(co) print(coroutine.status(co)) coroutine.resume(co) coroutine.resume(co) co = coroutine.create(function(a, b, c) print("co", a, b, c + 2) coroutine.yield(a + b, a - b) end) print(coroutine.resume(co, 20, 10, 14))
-------------------------------- -- @module AnimationState -- @extend BaseObject -- @parent_module db -------------------------------- -- -- @function [parent=#AnimationState] setCurrentTime -- @param self -- @param #float value -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- @private -- @function [parent=#AnimationState] _updateTimelineStates -- @param self -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- -- @function [parent=#AnimationState] removeBoneMask -- @param self -- @param #string name -- @param #bool recursive -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- -- @function [parent=#AnimationState] getGroup -- @param self -- @return string#string ret (return value: string) -------------------------------- -- -- @function [parent=#AnimationState] getCurrentPlayTimes -- @param self -- @return unsigned int#unsigned int ret (return value: unsigned int) -------------------------------- -- -- @function [parent=#AnimationState] getName -- @param self -- @return string#string ret (return value: string) -------------------------------- -- -- @function [parent=#AnimationState] getAnimationData -- @param self -- @return AnimationData#AnimationData ret (return value: db.AnimationData) -------------------------------- -- -- @function [parent=#AnimationState] getCurrentTime -- @param self -- @return float#float ret (return value: float) -------------------------------- -- @private -- @function [parent=#AnimationState] _fadeIn -- @param self -- @param #db.Armature armature -- @param #db.AnimationData clip -- @param #string animationName -- @param #unsigned int playTimes -- @param #float position -- @param #float duration -- @param #float time -- @param #float timeScale -- @param #float fadeInTime -- @param #bool pausePlayhead -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- -- @function [parent=#AnimationState] getTotalTime -- @param self -- @return float#float ret (return value: float) -------------------------------- -- -- @function [parent=#AnimationState] removeAllBoneMask -- @param self -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- -- @function [parent=#AnimationState] getLayer -- @param self -- @return int#int ret (return value: int) -------------------------------- -- -- @function [parent=#AnimationState] isCompleted -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- -- @function [parent=#AnimationState] play -- @param self -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- -- @function [parent=#AnimationState] fadeOut -- @param self -- @param #float fadeOutTime -- @param #bool pausePlayhead -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- -- @function [parent=#AnimationState] stop -- @param self -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- -- @function [parent=#AnimationState] isPlaying -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- @private -- @function [parent=#AnimationState] _advanceTime -- @param self -- @param #float passedTime -- @param #float weightLeft -- @param #int index -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- @private -- @function [parent=#AnimationState] _updateFFDTimelineStates -- @param self -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- -- @function [parent=#AnimationState] addBoneMask -- @param self -- @param #string name -- @param #bool recursive -- @return AnimationState#AnimationState self (return value: db.AnimationState) -------------------------------- -- -- @function [parent=#AnimationState] containsBoneMask -- @param self -- @param #string name -- @return bool#bool ret (return value: bool) -------------------------------- -- -- @function [parent=#AnimationState] getTypeIndex -- @param self -- @return unsigned int#unsigned int ret (return value: unsigned int) -------------------------------- -- -- @function [parent=#AnimationState] getClassTypeIndex -- @param self -- @return unsigned int#unsigned int ret (return value: unsigned int) -------------------------------- -- -- @function [parent=#AnimationState] AnimationState -- @param self -- @return AnimationState#AnimationState self (return value: db.AnimationState) return nil
--[[ plugindef = { regex = "^/foo/bar/.*", description = "My Awesome Plugin", ^ Can contain links load_page = func(entry, player), ^ Must return text, allow_save save_page = func(entry, player), ^ Must return bool } ]] local plugin_defs = { } function wikilib.register_plugin(def) plugin_defs[#plugin_defs + 1] = def end local function do_handle(what, entry, player, text) for _,pi in ipairs(plugin_defs) do if entry:match(pi.regex) then return pi[what](entry, player, text) end end end function wikilib.plugin_handle_load(entry, player) return do_handle("load_page", entry, player) end function wikilib.plugin_handle_save(entry, player, text) return do_handle("save_page", entry, player, text) end wikilib.registered_plugins = plugin_defs
--- Repeat the last sort mode. local A, L = unpack(select(2, ...)) local P = A.sortModes local M = P:NewModule("last", "AceEvent-3.0") P.last = M local format = format function M:OnEnable() A.sortModes:Register({ key = "last", name = L["sorter.mode.last"], aliases = {"again", "repeat", "^", "\"", "previous", "prev"}, desc = function(t) local last = A.sorter:GetLastSortModeName() if last then last = format("%s: %s.", L["sorter.print.last"], A.util:Highlight(last)) else last = L["sorter.print.last"].."." end t:AddLine(last, 1,1,0, true) end, onBeforeStart = function() A.console:Errorf(M, "this func should never be called - the fgCommand module should be handling this sort mode") return true end, }) end
local oxd = require "gluu.oxdweb" local kong_auth_pep_common = require "gluu.kong-common" -- @return introspect_response, status, err -- upon success returns only introspect_response, -- otherwise return nil, status, err local function introspect_token(self, conf, token) local ptoken = kong_auth_pep_common.get_protection_token(conf) local response = oxd.introspect_access_token(conf.oxd_url, { oxd_id = conf.oxd_id, access_token = token, }, ptoken) local status = response.status if status == 403 then kong.log.err("Invalid access token provided in Authorization header"); return nil, 502, "An unexpected error ocurred" end if status ~= 200 then kong.log.err("introspect-access-token error, status: ", status) return nil, 502, "An unexpected error ocurred" end local body = response.body if not body.active then -- TODO should we cache negative resposes? https://github.com/GluuFederation/gluu-gateway/issues/213 return nil, 401, "Invalid access token provided in Authorization header" end return body end return function(self, conf) kong_auth_pep_common.access_auth_handler(self, conf, introspect_token) end
require('lovestates') function build_validate_state() state = lovestate() local msg = "" local acc = 0 state.init = function() love.graphics.setBackgroundColor( 50, 50, 50 ) end state.draw = function() love.graphics.setColor(255, 255, 255, 255) love.graphics.print(msg, 10, 10) end state.update = function( dt ) acc = acc + dt if acc < 1 then return else acc = 0 end if not love.filesystem.exists( IMAGE_PATH ) then msg = [[ I will animate if you obey: Source image path: "]] .. IMAGE_PATH .. [[" Height is multiple of 2 Width is mulitiple of height ]] return end function loadImage() image = love.graphics.newImage(IMAGE_PATH) end if not pcall(loadImage) then msg = "Could not load image." return end w, h = image:getWidth(), image:getHeight() function powerOfTwo(n) x = 1 while x < 4096 do if n == x then return true end x = x * 2 end return false end function widthMultipleOfHeight(w, h) n = h while n < w * 2 do if n == w then return true end n = n + h end return false end if not powerOfTwo(h) then msg = "Height of image is not power of two!" return end if not widthMultipleOfHeight(w, h) then msg = "Width is not a multiple of height!" return end -- build keyframes = quads quads = {} keyframeCount = w/h msg = '' for i = 0, keyframeCount - 1 do local x = i * h quads[i] = love.graphics.newQuad(x, 0, h, h, w, h) print(i) end switch_state('anim_state') -- msg = "all validation tests passed" -- switch_state('animate_state') end return state end
libtommath = { source = path.join(dependencies.basePath, "libtommath"), } function libtommath.import() links { "libtommath" } libtommath.includes() end function libtommath.includes() includedirs { libtommath.source } defines { "LTM_DESC", "__STDC_IEC_559__", "MP_NO_DEV_URANDOM", } end function libtommath.project() project "libtommath" language "C" libtommath.includes() files { path.join(libtommath.source, "*.c"), } defines { "_LIB" } removedefines { "_DLL", "_USRDLL" } linkoptions { "-IGNORE:4221" } warnings "Off" kind "StaticLib" end table.insert(dependencies, libtommath)
vim.g.rooter_patterns = { ".git" } vim.g.rooter_change_directory_for_non_project_files = "current"
local version = 1.0 -- Prefix: sm.body. -- Commands: --sm.body.getCOM(body) -- Returns the center of mass of the body --sm.body.getCreationCOM(body) -- Returns the center of mass of the creation --sm.body.getMOI(body, axis) -- Returns the moment of inertia of the body on the axis --sm.body.getCreationMOI(body, axis) -- Returns the moment of inertia of the creation on the axis -- Improved: --body:getCOM() --body:getCreationCOM() --body:getMOI(axis) --body:getCreationMOI(axis) --[[ Copyright (c) 2019 Scrap Essentials Team ]]-- -- Version check if sm.__SE_Version.body and version <= sm.__SE_Version.body then return end local COM = {} local MOI = {} -- Body's center of mass function sm.body.getCOM(body) assert(type(body) == "Body", "getCOM: argument 1, Body expected! got: "..type(body)) if (not COM[body.id]) then COM[body.id] = {} end -- First iteration or change detected if ((not COM[body.id].tick)or((COM[body.id].tick < sm.game.getCurrentTick())and(sm.body.hasChanged(body, COM[body.id].tick)))or(not sm.exists(COM[body.id].shape))) then if (not COM[body.id].body) then COM[body.id].body = body end -- AUTO DELETE local shapes = body:getShapes() COM[body.id].shape = shapes[1] local mass = 0 local center = sm.vec3.new(0, 0, 0) for i, shape in pairs(shapes) do center = center + shape:getWorldPosition() * shape:getMass() mass = mass + shape:getMass() end center = center * (1 / mass) --VectorBug local displacement = center - COM[body.id].shape:getWorldPosition() COM[body.id].vector = displacement:localize(COM[body.id].shape) COM[body.id].tick = sm.game.getCurrentTick() return center end return COM[body.id].shape:getWorldPosition() + COM[body.id].vector:delocalize(COM[body.id].shape) end -- Vehicle's center of mass function sm.body.getCreationCOM(in_body) assert(type(in_body) == "Body", "getCreationCOM: argument 1, Body expected! got: "..type(in_body)) local bodies = in_body:getCreationBodies() local mass = 0 local center = sm.vec3.new(0, 0, 0) for i, body in pairs(bodies) do center = center + body:getCOM() * body.mass mass = mass + body.mass end center = center * (1 / mass) --VectorBug return center end -- Creation's moment of inertia function sm.body.getMOI(body, in_axis) assert(type(body) == "Body", "getMOI: argument 1, Body expected! got: "..type(body)) assert(type(in_axis) == "Vec3", "getMOI: argument 2, Vec3 expected! got: "..type(in_axis)) if (not MOI[body.id]) then MOI[body.id] = {} end if (not MOI[body.id].inertia) then MOI[body.id].inertia = {} end if (not MOI[body.id].tick) then MOI[body.id].tick = 0 end if (not MOI[body.id].body) then MOI[body.id].body = body end -- AUTO DELETE local shapes = body:getShapes() MOI[body.id].shape = shapes[1] in_axis = in_axis:localize(MOI[body.id].shape) in_axis = in_axis:normalize() if ((not MOI[body.id].tick)or(sm.body.hasChanged(body, MOI[body.id].tick))) then MOI[body.id].inertia.xx = 0 MOI[body.id].inertia.yy = 0 MOI[body.id].inertia.zz = 0 MOI[body.id].inertia.xy = 0 MOI[body.id].inertia.yz = 0 MOI[body.id].inertia.xz = 0 for i, shape in pairs(shapes) do local center = body:getCOM() local box = shape:getBoundingBox() local mass = shape.mass / (box.x * 4 * box.y * 4 * box.z * 4) local pos = shape:getWorldPosition() for x = box.x * 2, box.x * -2 + 1, -1 do local position = pos + shape:getRight() * (x / 4 - 0.125) for y = box.y * 2, box.y * -2 + 1, -1 do position = position + shape:getAt() * (y / 4 - 0.125) for z = box.z * 2, box.z * -2 + 1, -1 do position = position + shape:getUp() * (z / 4 - 0.125) local dif = position - center dif = dif:localize(MOI[body.id].shape) MOI[body.id].inertia.xx = MOI[body.id].inertia.xx + mass * (dif.y * dif.y + dif.z * dif.z) MOI[body.id].inertia.yy = MOI[body.id].inertia.yy + mass * (dif.x * dif.x + dif.z * dif.z) MOI[body.id].inertia.zz = MOI[body.id].inertia.zz + mass * (dif.x * dif.x + dif.y * dif.y) MOI[body.id].inertia.xy = MOI[body.id].inertia.xy - mass * dif.x * dif.y MOI[body.id].inertia.yz = MOI[body.id].inertia.yz - mass * dif.y * dif.z MOI[body.id].inertia.xz = MOI[body.id].inertia.xz - mass * dif.x * dif.z end end end end MOI[body.id].tick = sm.game.getCurrentTick() end return in_axis.x * (in_axis.x * MOI[body.id].inertia.xx + in_axis.y * MOI[body.id].inertia.xy + in_axis.z * MOI[body.id].inertia.xz) + in_axis.y * (in_axis.x * MOI[body.id].inertia.xy + in_axis.y * MOI[body.id].inertia.yy + in_axis.z * MOI[body.id].inertia.yz) + in_axis.z * (in_axis.x * MOI[body.id].inertia.xz + in_axis.y * MOI[body.id].inertia.yz + in_axis.z * MOI[body.id].inertia.zz) end -- Creation's moment of inertia --WHY WOULD ANYONE EVER NEED THIS --YOU CAN'T APPLY TORQUE TO A WHOLE VEHICLE AT ONE TIME ANYWAYS --ALSO !RESOURCE INTENSIVE! function sm.body.getCreationMOI(in_body, in_axis) assert(type(in_body) == "Body", "getMOI: argument 1, Body expected! got: "..type(in_body)) assert(type(in_axis) == "Vec3", "getMOI: argument 2, Vec3 expected! got: "..type(in_axis)) local inertia = {} local shapes = in_body:getShapes() in_axis = in_axis:localize(shapes[1]) in_axis = in_axis:normalize() inertia.xx = 0 inertia.yy = 0 inertia.zz = 0 inertia.xy = 0 inertia.yz = 0 inertia.xz = 0 for i, body in pairs(in_body:getCreationBodies()) do local shapes = body:getShapes() for n, shape in pairs(shapes) do local center = body:getCOM() local box = shape:getBoundingBox() local mass = shape.mass / (box.x * 4 * box.y * 4 * box.z * 4) local pos = shape:getWorldPosition() for x = box.x * 2, box.x * -2 + 1, -1 do local position = pos + shape:getRight() * (x / 4 - 0.125) for y = box.y * 2, box.y * -2 + 1, -1 do position = position + shape:getAt() * (y / 4 - 0.125) for z = box.z * 2, box.z * -2 + 1, -1 do position = position + shape:getUp() * (z / 4 - 0.125) local dif = position - center dif = dif:localize(shapes[1]) inertia.xx = inertia.xx + mass * (dif.y * dif.y + dif.z * dif.z) inertia.yy = inertia.yy + mass * (dif.x * dif.x + dif.z * dif.z) inertia.zz = inertia.zz + mass * (dif.x * dif.x + dif.y * dif.y) inertia.xy = inertia.xy - mass * dif.x * dif.y inertia.yz = inertia.yz - mass * dif.y * dif.z inertia.xz = inertia.xz - mass * dif.x * dif.z end end end end end return in_axis.x * (in_axis.x * inertia.xx + in_axis.y * inertia.xy + in_axis.z * inertia.xz) + in_axis.y * (in_axis.x * inertia.xy + in_axis.y * inertia.yy + in_axis.z * inertia.yz) + in_axis.z * (in_axis.x * inertia.xz + in_axis.y * inertia.yz + in_axis.z * inertia.zz) end table.insert(sm.__SE_UserDataImprovements_Server, function(self) self.shape.body.getCOM = function(body) return sm.body.getCOM(body) end self.shape.body.getCreationCOM = function(body) return sm.body.getCreationCOM(body) end self.shape.body.getMOI = function(body, _1) return sm.body.getMOI(body, _1) end self.shape.body.getCreationMOI = function(body, _1) return sm.body.getCreationMOI(body, _1) end end) sm.__SE_Version.body = version print("'body' library version "..tostring(version).." successfully loaded.")
old = {} old.require = require old.print = print local stack = {} local top = 1 local loaded = {} require = function(s) if loaded[s] then return end loaded[s] = true old.print("loading[" .. s .. "]") top = top + 1 stack[top] = s local returns = {old.require(s)} old.print("finish [" .. stack[top] .. "]") top = top - 1 return unpack(returns) end jass_ext.EnableConsole() local suc, runtime = pcall(require, 'jass.runtime') if not suc then jass_ext.EnableConsole() --打开Lua引擎控制台 luaVersion = 0 else jass_ext = {} jass_ext.runtime = runtime jass_ext.hook = require 'jass.hook' jass_ext.runtime.console = true --打开Lua引擎控制台 jass = require 'jass.common' japi = require 'jass.japi' slk = require 'jass.slk' luaVersion = jass_ext.runtime.version end require "AnsiWord.lua" if luaVersion > 0 then runtime.error_handle = function(msg) --调用栈 old.print("---------------------------------------") old.print(" LUA ERROR ") old.print("---------------------------------------") old.print(tostring(msg) .. "\n") old.print(debug.traceback()) old.print("---------------------------------------") Debug(tostring(msg)) end runtime.handle_level = 2 --0:handle直接使用number --1:handle使用lightuserdata,0可以隐转为nil,不影响引用计数 --2:handle使用userdata,lua持有handle时增加引用计数 runtime.sleep = false --关闭掉等待功能以提升效率 end if luaVersion > 1 then loadstring = load unpack = table.unpack end setmetatable(_ENV, { __index = getmetatable(jass).__index})
local pwd = debug.getinfo(1).source:match("^@?(.*[/\\])") package.path = package.path .. ";" .. pwd .. "../?.lua" local pandoc = require("pandoc") local function Span(el) local id = el.attr.identifier if id then return { pandoc.RawInline("context", "\\textreference[" .. id .. "]{"), pandoc.Str(el.content), pandoc.RawInline("context", "}"), el } end end if FORMAT == "context" then return { {Span = Span} } else return {} end
local HAS_DEVICONS = pcall(require, "nvim-web-devicons") local HAS_LSPKIND, lspkind = pcall(require, "lspkind") local default_options = { -- Priority list of preferred backends for aerial. -- This can be a filetype map (see :help aerial-filetype-map) backends = { "lsp", "treesitter", "markdown" }, -- Enum: persist, close, auto, global -- persist - aerial window will stay open until closed -- close - aerial window will close when original file is no longer visible -- auto - aerial window will stay open as long as there is a visible -- buffer to attach to -- global - same as 'persist', and will always show symbols for the current buffer close_behavior = "auto", -- Set to false to remove the default keybindings for the aerial buffer default_bindings = true, -- Enum: prefer_right, prefer_left, right, left, float -- Determines the default direction to open the aerial window. The 'prefer' -- options will open the window in the other direction *if* there is a -- different buffer in the way of the preferred direction default_direction = "prefer_right", -- Disable aerial on files with this many lines disable_max_lines = 10000, -- A list of all symbols to display. Set to false to display all symbols. -- This can be a filetype map (see :help aerial-filetype-map) -- To see all available values, see :help SymbolKind filter_kind = { "Class", "Constructor", "Enum", "Function", "Interface", "Module", "Method", "Struct", }, -- Enum: split_width, full_width, last, none -- Determines line highlighting mode when multiple splits are visible -- split_width Each open window will have its cursor location marked in the -- aerial buffer. Each line will only be partially highlighted -- to indicate which window is at that location. -- full_width Each open window will have its cursor location marked as a -- full-width highlight in the aerial buffer. -- last Only the most-recently focused window will have its location -- marked in the aerial buffer. -- none Do not show the cursor locations in the aerial window. highlight_mode = "split_width", -- When jumping to a symbol, highlight the line for this many ms. -- Set to false to disable highlight_on_jump = 300, -- Define symbol icons. You can also specify "<Symbol>Collapsed" to change the -- icon when the tree is collapsed at that symbol, or "Collapsed" to specify a -- default collapsed icon. The default icon set is determined by the -- "nerd_font" option below. -- If you have lspkind-nvim installed, aerial will use it for icons. icons = {}, -- When you fold code with za, zo, or zc, update the aerial tree as well. -- Only works when manage_folds = true link_folds_to_tree = false, -- Fold code when you open/collapse symbols in the tree. -- Only works when manage_folds = true link_tree_to_folds = true, -- Use symbol tree for folding. Set to true or false to enable/disable -- 'auto' will manage folds if your previous foldmethod was 'manual' manage_folds = false, -- The maximum width of the aerial window max_width = 40, -- The minimum width of the aerial window. -- To disable dynamic resizing, set this to be equal to max_width min_width = 10, -- Set default symbol icons to use patched font icons (see https://www.nerdfonts.com/) -- "auto" will set it to true if nvim-web-devicons or lspkind-nvim is installed. nerd_font = "auto", -- Call this function when aerial attaches to a buffer. -- Useful for setting keymaps. Takes a single `bufnr` argument. on_attach = nil, -- Automatically open aerial when entering supported buffers. -- This can be a function (see :help aerial-open-automatic) open_automatic = false, -- Set to true to only open aerial at the far right/left of the editor -- Default behavior opens aerial relative to current window placement_editor_edge = false, -- Run this command after jumping to a symbol (false will disable) post_jump_cmd = "normal! zz", -- When true, aerial will automatically close after jumping to a symbol close_on_select = false, -- Show box drawing characters for the tree hierarchy show_guides = false, -- Options for opening aerial in a floating win float = { -- Controls border appearance. Passed to nvim_open_win border = "rounded", -- Controls row offset from cursor. Passed to nvim_open_win row = 1, -- Controls col offset from cursor. Passed to nvim_open_win col = 0, -- The maximum height of the floating aerial window max_height = 100, -- The minimum height of the floating aerial window -- To disable dynamic resizing, set this to be equal to max_height min_height = 4, }, lsp = { -- Fetch document symbols when LSP diagnostics change. -- If you set this to false, you will need to manually fetch symbols diagnostics_trigger_update = true, -- Set to false to not update the symbols when there are LSP errors update_when_errors = true, }, treesitter = { -- How long to wait (in ms) after a buffer change before updating update_delay = 300, }, markdown = { -- How long to wait (in ms) after a buffer change before updating update_delay = 300, }, } -- stylua: ignore local plain_icons = { Array = "[a]", Boolean = "[b]", Class = "[C]", Constant = "[const]", Constructor = "[Co]", Enum = "[E]", EnumMember = "[em]", Event = "[Ev]", Field = "[Fld]", File = "[File]", Function = "[F]", Interface = "[I]", Key = "[K]", Method = "[M]", Module = "[Mod]", Namespace = "[NS]", Null = "[-]", Number = "[n]", Object = "[o]", Operator = "[+]", Package = "[Pkg]", Property = "[P]", String = "[str]", Struct = "[S]", TypeParameter = "[T]", Variable = "[V]", Collapsed = "▶", } -- stylua: ignore local nerd_icons = { Class = " ", Color = " ", Constant = " ", Constructor = " ", Enum = " ", EnumMember = " ", Event = " ", Field = " ", File = " ", Folder = " ", Function = " ", Interface = " ", Keyword = " ", Method = " ", Module = " ", Operator = " ", Package = " ", Property = " ", Reference = " ", Snippet = " ", String = "s]", Struct = " ", Text = " ", Unit = "塞", Value = " ", Variable = " ", Collapsed = " ", } local M = {} local function split(string, pattern) local ret = {} for token in string.gmatch(string, "[^" .. pattern .. "]+") do table.insert(ret, token) end return ret end M.get_filetypes = function(bufnr) local ft = vim.api.nvim_buf_get_option(bufnr or 0, "filetype") return split(ft, "\\.") end local function create_filetype_opt_getter(option, default) if type(option) ~= "table" or vim.tbl_islist(option) then return function() return option end else return function(bufnr) for _, ft in ipairs(M.get_filetypes(bufnr)) do if option[ft] ~= nil then return option[ft] end end return option["_"] and option["_"] or default end end end M.setup = function(opts) local newconf = vim.tbl_deep_extend("force", default_options, opts or {}) if newconf.nerd_font == "auto" then newconf.nerd_font = HAS_DEVICONS or HAS_LSPKIND end -- TODO for backwards compatibility for k, _ in pairs(default_options.lsp) do if newconf[k] ~= nil then newconf.lsp[k] = newconf[k] newconf[k] = nil end end newconf.icons = vim.tbl_deep_extend( "keep", newconf.icons or {}, newconf.nerd_font and nerd_icons or plain_icons ) -- Much of this logic is for backwards compatibility and can be removed in the -- future local open_automatic_min_symbols = newconf.open_automatic_min_symbols or 0 local open_automatic_min_lines = newconf.open_automatic_min_lines or 0 if newconf.open_automatic_min_lines or newconf.open_automatic_min_symbols or type(newconf.open_automatic) == "table" then vim.notify( "Deprecated: open_automatic should be a boolean or function. See :help aerial-open-automatic", vim.log.levels.WARN ) newconf.open_automatic_min_symbols = nil newconf.open_automatic_min_lines = nil end if type(newconf.open_automatic) == "boolean" then local open_automatic = newconf.open_automatic newconf.open_automatic = function() return open_automatic end elseif type(newconf.open_automatic) ~= "function" then local open_automatic_fn = create_filetype_opt_getter(newconf.open_automatic, false) newconf.open_automatic = function(bufnr) if vim.api.nvim_buf_line_count(bufnr) < open_automatic_min_lines or require("aerial").num_symbols(bufnr) < open_automatic_min_symbols then return false end return open_automatic_fn(bufnr) end end for k, v in pairs(newconf) do M[k] = v end M.backends = create_filetype_opt_getter(M.backends, default_options.backends) local get_filter_kind_list = create_filetype_opt_getter( M.filter_kind, default_options.filter_kind ) M.get_filter_kind_map = function(bufnr) local fk = get_filter_kind_list(bufnr) if fk == false or fk == 0 then return setmetatable({}, { __index = function() return true end, __tostring = function() return "all symbols" end, }) else local ret = {} for _, kind in ipairs(fk) do ret[kind] = true end return setmetatable(ret, { __tostring = function() return table.concat(fk, ", ") end, }) end end -- Clear the metatable that looks up the vim.g.aerial values setmetatable(M, {}) end local bool_opts = { close_on_select = true, default_bindings = true, diagnostics_trigger_update = true, highlight_mode = true, highlight_on_jump = true, link_folds_to_tree = true, link_tree_to_folds = true, manage_folds = true, nerd_font = true, open_automatic = true, placement_editor_edge = true, post_jump_cmd = true, update_when_errors = true, } local function calculate_opts() local opts local found_var = false if vim.g.aerial then opts = vim.g.aerial found_var = true else opts = vim.deepcopy(default_options) end local function walk(prefix, obj) for k, v in pairs(obj) do local found, var = pcall(vim.api.nvim_get_var, prefix .. k) -- This is for backwards compatibility with lsp options that used to be in the -- global namespace if not found and prefix == "aerial_lsp_" then found, var = pcall(vim.api.nvim_get_var, "aerial_" .. k) end if found then found_var = true -- Convert 0/1 to true/false for backwards compatibility if bool_opts[k] and type(var) ~= "boolean" then vim.notify( string.format( "Deprecated: aerial expects a boolean for option '%s'", k, vim.log.levels.WARN ) ) var = var ~= 0 end obj[k] = var elseif type(v) == "table" and not vim.tbl_islist(v) then walk(prefix .. k .. "_", v) end end end walk("aerial_", opts) if found_var then vim.notify( "Deprecated: aerial should no longer be configured with g:aerial, you should use require('aerial').setup(). See :help aerial for more details", vim.log.levels.WARN ) end return opts end -- For backwards compatibility: if we search for config values and we haven't -- yet called setup(), call setup with the config values pulled from global vars setmetatable(M, { __index = function(t, key) M.setup(calculate_opts()) return rawget(M, key) end, }) -- Exposed for tests M._get_icon = function(kind, collapsed) if collapsed then kind = kind .. "Collapsed" end local ret = M.icons[kind] if ret ~= nil then return ret end if collapsed then ret = M.icons["Collapsed"] end return ret or " " end M.get_icon = function(kind, collapsed) if HAS_LSPKIND and not collapsed then local icon = lspkind.symbolic(kind, { with_text = false }) if icon then return icon end end return M._get_icon(kind, collapsed) end return M
object_draft_schematic_chemistry_medpack_enhance_health_triad_c = object_draft_schematic_chemistry_shared_medpack_enhance_health_triad_c:new { } ObjectTemplates:addTemplate(object_draft_schematic_chemistry_medpack_enhance_health_triad_c, "object/draft_schematic/chemistry/medpack_enhance_health_triad_c.iff")
require "scenemanager" require "easing" require "reactphysics3d" scenemanager = SceneManager.new( { ["levelX"] = LevelX } ) scenemanager:changeScene("levelX") stage:addChild(scenemanager) transitions = { SceneManager.moveFromRight, -- 1 SceneManager.moveFromLeft, -- 2 SceneManager.moveFromBottom, -- 3 SceneManager.moveFromTop, -- 4 SceneManager.moveFromRightWithFade, -- 5 SceneManager.moveFromLeftWithFade, -- 6 SceneManager.moveFromBottomWithFade, -- 7 SceneManager.moveFromTopWithFade, -- 8 SceneManager.overFromRight, -- 9 SceneManager.overFromLeft, -- 10 SceneManager.overFromBottom, -- 11 SceneManager.overFromTop, -- 12 SceneManager.overFromRightWithFade, -- 13 SceneManager.overFromLeftWithFade, -- 14 SceneManager.overFromBottomWithFade, -- 15 SceneManager.overFromTopWithFade, -- 16 SceneManager.fade, -- 17 SceneManager.crossFade, -- 18 SceneManager.flip, -- 19 SceneManager.flipWithFade, -- 20 SceneManager.flipWithShade, -- 21 } easings = { easing.inBack, -- 1 easing.outBack, -- 2 easing.inOutBack, -- 3 easing.inBounce, -- 4 easing.outBounce, -- 5 easing.inOutBounce, -- 6 easing.inCircular, -- 7 easing.outCircular, -- 8 easing.inOutCircular, -- 9 easing.inCubic, -- 10 easing.outCubic, -- 11 easing.inOutCubic, -- 12 easing.inElastic, -- 13 easing.outElastic, -- 14 easing.inOutElastic, -- 15 easing.inExponential, -- 16 easing.outExponential, -- 17 easing.inOutExponential, -- 18 easing.linear, -- 19 easing.inQuadratic, -- 20 easing.outQuadratic, -- 21 easing.inOutQuadratic, -- 22 easing.inQuartic, -- 23 easing.outQuartic, -- 24 easing.inOutQuartic, -- 25 easing.inQuintic, -- 26 easing.outQuintic, -- 27 easing.inOutQuintic, -- 28 easing.inSine, -- 29 easing.outSine, -- 30 easing.inOutSine, -- 31 }
require "KuruNodeKit/KuruNodeKit.lua" require "TapTriggerKit/TapTriggerKit.lua" g_gyroCameraNode = nil g_particles = {} g_emitters = {} g_deviceOrientation = -1 A_PARTICLE_POSITION = {x = -10, y = 100, z = -50} A_PARTICLE_POSITION_VAR = {x = 30, y = 300, z = 10} A_PARTICLE_VELOCITY = {x = 3, y = -3, z = 5} function initialize(scene) local originSnap = KuruNodeKit.createSnapshotNode() scene:addNodeAndRelease(originSnap) g_gyroCameraNode = KuruCameraNode.create(45, 10, 10000) scene:addNodeAndRelease(g_gyroCameraNode) initParticleNode(scene) TapTriggerKit.init(true, 4, updateTap) -- param #1 persistent 여부, param #2 total touchCount, param #3 update callback -- scene:addNodeAndRelease(KuruNodeKit.createHeadshotNode("facemask.png", originSnap:getSampler())) scene:addNodeAndRelease(KuruNodeKit.createSegmentationNode(originSnap:getSampler())) setParticleTexture(TapTriggerKit.getCurrentTouchIndex()) end function frameReady(scene, elapsedTime) local curOri = KuruEngine.getInstance():getCameraConfig().deviceOrientation if g_deviceOrientation ~= curOri then g_deviceOrientation = curOri changeParticleOrientation() end end function finalize(scene) TapTriggerKit.finalize() end function updateTap(index, event) setParticleTexture(index) end function changeParticleOrientation() for i = 1, #g_particles do local pos = calculateOrientation(A_PARTICLE_POSITION, false) local posVar = calculateOrientation(A_PARTICLE_POSITION_VAR, true) local velocity = calculateOrientation(A_PARTICLE_VELOCITY, false) g_particles[i]:setAngle((g_deviceOrientation + 180) * math.pi / 180) g_emitters[i]:setPosition(pos, posVar) g_emitters[i]:setVelocity(velocity, g_emitters[i]:getVelocityVariance()) end end function initParticleNode(scene) g_particles[1] = KuruParticleNode.create(getFilePath("a.particle")) g_particles[1]:setAngle(math.pi) g_particles[1]:start() g_gyroCameraNode:addChild(g_particles[1]) g_particles[1]:release() g_emitters[1] = ParticleEmitter.cast(g_particles[1]:getParticleEmitter()) g_emitters[1]:setSize(5, 5, 5, 5) g_emitters[1]:setEmissionRate(9) g_particles[2] = KuruParticleNode.create(getFilePath("a.particle")) g_particles[2]:setAngle(math.pi) g_particles[2]:start() g_gyroCameraNode:addChild(g_particles[2]) g_particles[2]:release() g_emitters[2] = ParticleEmitter.cast(g_particles[2]:getParticleEmitter()) g_emitters[2]:setSize(4, 4, 4, 4) g_emitters[2]:setEmissionRate(9) g_particles[3] = KuruParticleNode.create(getFilePath("a.particle")) g_particles[3]:setAngle(math.pi) g_particles[3]:start() g_gyroCameraNode:addChild(g_particles[3]) g_particles[3]:release() g_emitters[3] = ParticleEmitter.cast(g_particles[3]:getParticleEmitter()) g_emitters[3]:setSize(3, 3, 3, 3) g_emitters[3]:setEmissionRate(11) end function setParticleTexture(index) local texture = Texture.create(BASE_DIRECTORY .. "emoji_source/" .. index .. ".png", false, false) if texture ~= nil then for i, v in pairs(g_emitters) do v:setTexture(texture, v:getBlendMode()) end texture:release() end end function calculateOrientation(vec, isVar) local retVec = Vector3.create(0.0, 0.0, vec.z) if g_deviceOrientation == 0 then retVec.x = vec.x retVec.y = vec.y elseif g_deviceOrientation == 270 then retVec.x = vec.y retVec.y = isVar and vec.x or - vec.x elseif g_deviceOrientation == 180 then retVec.x = vec.x retVec.y = isVar and vec.y or - vec.y else retVec.x = isVar and vec.y or - vec.y retVec.y = isVar and vec.x or - vec.x end return retVec end function getFilePath(fileName) return BASE_DIRECTORY .. fileName end
--[[ Purpose: A library to set up player flags that can be used to control things such as access to spawning props or tool trust. --]] nut.flag = nut.flag or {} nut.flag.buffer = nut.flag.buffer or {} --[[ Purpose: Registers a flag based off the character given as the desired flag and a structure for the flag, data. The structure should include onReceived, onTaken, and onSpawn. These three functions have a player passed. --]] function nut.flag.Create(flag, data) nut.flag.buffer[flag] = data end if (SERVER) then --[[ Purpose: Used in the PlayerSpawn hook, it gathers all of the flags the player has and calls onSpawn, passing the player for the flags. This is needed for flags that allow weapons, such as the tool trust flag. --]] function nut.flag.OnSpawn(client) for k, v in pairs(client:GetFlags()) do local flagTable = nut.flag.buffer[v] if (flagTable and flagTable.onSpawn) then flagTable.onSpawn(client) end end end else AdvNut.hook.Add("BuildHelpOptions", "nut_FlagHelp", function(data) data:AddHelp("플레그", function() local html = "" for k, v in SortedPairs(nut.flag.buffer) do local color = "<font color=\"red\">&#10008;" if (LocalPlayer():HasFlag(k)) then color = "<font color=\"green\">&#10004;" end html = html.."<p><b>"..color.."&nbsp;</font>"..k.."</b><br /><hi><i>설명:</i> "..v.desc or nut.lang.Get("no_desc").."</p>" end return html end, "icon16/flag_blue.png") end) end do local playerMeta = FindMetaTable("Player") -- Player flag functions. if (SERVER) then --[[ Purpose: Validates that the flag exists within the system and inserts the flag into the flags character data, then calls onReceived for the flag, passing the player. --]] function playerMeta:GiveFlag(flag) if (self.character) then if (#flag > 1) then for k, v in pairs(string.Explode("", flag)) do self:GiveFlag(v) end return end local flagTable = nut.flag.buffer[flag] if (flagTable and flagTable.onReceived) then flagTable.onReceived(self) end self.character:SetData("flags", self:GetFlagString()..flag) end end --[[ Purpose: Does the opposite of GiveFLag, removes any matches of the flag from the flags character data and calls onTaken from the flag's table, passing the player. --]] function playerMeta:TakeFlag(flag) if (self.character) then if (#flag > 1) then for k, v in pairs(string.Explode("", flag)) do self:TakeFlag(v) end return end local flagTable = nut.flag.buffer[flag] if (flagTable and flagTable.onTaken) then flagTable.onTaken(self) end self.character:SetData("flags", string.gsub(self:GetFlagString(), flag, "")) end end end --[[ Purpose: Returns the raw flags character data. --]] function playerMeta:GetFlagString() if (self.character) then return self.character:GetData("flags", "") end return "" end --[[ Purpose: Returns the flags as a table by exploding the player's flag string into seperate characters, since flags are only one character each. By a default, an empty table will be returned if nothing else was. --]] function playerMeta:GetFlags() if (self.character) then return string.Explode("", self:GetFlagString()) end return {} end --[[ Purpose: Checks to see if the flag string contains the flag specified and returns true if it does or false if it does not. --]] function playerMeta:HasFlag(flag) if (self.character) then return string.find(self:GetFlagString(), flag) != nil end return false end end -- Default flags that all schemas use. nut.flag.Create("p", { desc = "게리건을 사용할수 있게 해줍니다.", onReceived = function(client) client:Give("weapon_physgun") client:SelectWeapon("weapon_physgun") end, onTaken = function(client) client:StripWeapon("weapon_physgun") end, onSpawn = function(client) client:Give("weapon_physgun") end }) nut.flag.Create("t", { desc = "툴건을 사용할수 있게 해줍니다.", onReceived = function(client) client:Give("gmod_tool") client:SelectWeapon("gmod_tool") end, onTaken = function(client) client:StripWeapon("gmod_tool") end, onSpawn = function(client) client:Give("gmod_tool") end }) nut.flag.Create("e", { desc = "오브젝트의 소환 권한 입니다." }) nut.flag.Create("n", { desc = "NPC의 소환 권한 입니다." }) nut.flag.Create("r", { desc = "레그돌의 소환 권한 입니다." }) nut.flag.Create("c", { desc = "탑승물의 소환 권한 입니다." })
local Application = dofile(_G.spoonPath.."/application.lua") local actions = { previousSong = Application.createMenuItemEvent("Previous", { focusAfter = true }), nextSong = Application.createMenuItemEvent("Next", { focusAfter = true }), stop = Application.createMenuItemEvent("Stop", { focusAfter = true }), goToCurrentSong = Application.createMenuItemEvent("Go to Current Song", { focusAfter = true }), toggleSong = Application.createMenuItemEvent({ "Play", "Pause" }, { isToggleable = true }), } local shortcuts = { { nil, "space", actions.toggleSong, { "Controls", "Play" } }, { nil, "p", actions.previousSong, { "Controls", "Previous" } }, { nil, "n", actions.nextSong, { "Controls", "Next" } }, { nil, "s", actions.stop, { "Controls", "Stop" } }, { nil, "l", actions.goToCurrentSong, { "Controls", "Go to Current Song" } }, } return Application:new("iTunes", shortcuts), shortcuts, actions
cprogram { name = "objectify", srcs = { "./objectify.c" } } definerule("objectify", { srcs = { type="targets" }, }, function (e) return normalrule { name = e.name, ins = { "utils+objectify", e.srcs, }, outleaves = { e.name..".inc" }, commands = { "%{ins[1]} < %{ins[2]} > %{outs}" } } end ) cprogram { name = "objectifyc", srcs = { "./objectifyc.c" } } definerule("objectifyc", { srcs = { type="targets" }, }, function (e) return normalrule { name = e.name, ins = { "utils+objectifyc", e.srcs, }, outleaves = { e.name..".h" }, commands = { "%{ins[1]} < %{ins[2]} > %{outs}" } } end ) cprogram { name = "unix2cpm", srcs = { "./unix2cpm.c" } } definerule("unix2cpm", { srcs = { type="targets" }, }, function (e) return normalrule { name = e.name, ins = { "utils+unix2cpm", e.srcs, }, outleaves = { e.name..".txt" }, commands = { "%{ins[1]} < %{ins[2]} > %{outs}" } } end ) clibrary { name = "libbdf", srcs = { "./libbdf.c" }, hdrs = { "./libbdf.h" } }
exports.http = { port = 1744 } exports.ws = { host = "1734.biz", port = 1745 } exports.users = { root = "1234" } exports.commands = { "cat", "cd", "help", "ls", "systeminfo" }
--[[ Maintenance by Cpone (Cpone#8463 on Discord). Don't spam Luffy or whatever about this shite, this is all mine. ]] PlayerStyleVariantModule = PlayerStyleVariantModule or BeardLib:ModuleClass("PlayerStyleVariant", ItemModuleBase) PlayerStyleVariantModule.SetupMaterialVariant = PlayerStyleModule.SetupMaterialVariant function PlayerStyleVariantModule:RegisterHook() if not self._config.id then self:Err("Cannot add a Player Style Variant, no ID specified.") return end if not self._config.player_style_id then self:Err("Cannot add a Player Style Variant '%s', no Player Style ID specified.", self._config.id) return end -- Super simple, just takes XML and shoves it into the player style stuff. Hooks:Add("BeardLibCreateCustomPlayerStyleVariants", self._config.id .. self._config.player_style_id .. "AddPlayerStyleVariantTweakData", function(bm_self) local ps_self = bm_self.player_styles local config = self._config if not ps_self[config.player_style_id] then self:Err("Player Style with id '%s' doesn't exist when trying to create variant '%s'!", config.player_style_id, config.id) return end local outfit_data = ps_self[config.player_style_id] self:SetupMaterialVariant(config.player_style_id, outfit_data, self._config.id, self._config) end) end
local getopt = require("getopt") if #({...}) == 0 then io.write("Riko4\n") return end getopt({...}, "-so", { ["kernel-name"] = {hasArg = getopt.noArgument, val = "s"}, ["operating-system"] = {hasArg = getopt.noArgument, val = "o"} }) { s = function() io.write("Riko4 ") end, o = function() io.write("rikoOS ") end } io.write("\n")
vim.opt_local.shiftwidth = 4 vim.opt_local.tabstop = 4 vim.opt_local.softtabstop = 4 vim.opt_local.expandtab = true -- Vim ftplugin sets `o` ... why? I dont want! vim.opt_local.formatoptions:remove("o")
local util = require("util") local ast = require("ast_util") local nodes = require("nodes") local error_code_util = require("error_code_util") ---a fake value to prevent assertions from failing during node creation ---since there are cases where not all required information is available yet, ---but a reference to the incomplete node is already needed. Like for scopes.\ ---or just because it's easier to set a field later\ ---**assigned in `parse`** local prevent_assert -- (outdated) -- these locals are kind of like registers in a register-machine if you are familiar with that concept -- otherwise, just think of them as a way to carry information from a called function to the calling -- function without actually returning said value. That way this value can be used by utility functions -- to read the current value being "operated". -- this saves a lot of passing around of values through returns, parameters and locals -- without actually modifying the value at all local source local error_code_insts local invalid_token_invalid_node_lut ---used to carry the position token over from `new_error_code_inst` to `syntax_error` local err_pos_token ---only used by labels, it's simply just an extra node that's going to be added ---for 1 statement parse call. In other words: this is for when a statement has to ---add 2 nodes to the statement list instead of 1\ ---this really just for special nodes like invalid nodes local extra_node local token_iter_state local token ---@type Token ---set by test_next() and therefore also assert_next() and assert_match() local prev_token ---@type Token -- end of these kinds of locals local next_token local peek_token ---------------------------------------------------------------------- local statement, expr -- local function copy_iter_state() -- return { -- line = token_iter_state.line, -- line_offset = token_iter_state.line_offset, -- } -- end -- local function paste_iter_state(copy) -- token_iter_state.line = copy.line -- token_iter_state.line_offset = copy.line_offset -- end local function is_invalid(node) return node.node_type == "invalid" end ---@param use_prev? boolean @ should this node be created using `prev_token`? ---@param value? string @ Default: `(use_prev and prev_token.token_type or token.token_type)` ---@return AstTokenNode local function new_token_node(use_prev, value) local node = nodes.new_token(use_prev and prev_token or token) if value ~= nil then node.value = value end return node end local function new_error_code_inst(params) err_pos_token = params.position or token return error_code_util.new_error_code{ error_code = params.error_code, message_args = params.message_args, -- TODO: somehow figure out the stop_position of the token -- if I ever do that, remember that there are some errors ranging across multiple tokens position = err_pos_token, } end local function add_consumed_node(invalid, consumed_node) if not (consumed_node.node_type == "token" and consumed_node.token_type == "eof") then invalid.consumed_nodes[#invalid.consumed_nodes+1] = consumed_node end end local function get_error_code_insts_count() return #error_code_insts end ---TODO: make the correct object in the error message the focus, the thing that is actually wrong. ---for example when an assertion of some token failed, it's most likely not that token that ---is missing (like a closing }), but rather the actual token that was encountered that was unexpected ---Throw a Syntax Error at the current location ---@param error_code_inst ErrorCodeInstance local function syntax_error( error_code_inst, location_descriptor, error_code_insts_insertion_index, current_invalid_token ) if location_descriptor then location_descriptor = location_descriptor == "" and "" or " "..location_descriptor else location_descriptor = " near" end local location if err_pos_token.token_type == "blank" then -- this should never happen, blank tokens are all in `leading` location = location_descriptor.." <blank>" elseif err_pos_token.token_type == "comment" then -- same here location = location_descriptor.." <comment>" elseif err_pos_token.token_type == "string" then local str if err_pos_token.src_is_block_str then if err_pos_token.src_has_leading_newline or err_pos_token.value:find("\n") then location = location_descriptor.." <string>" else str = "["..err_pos_token.src_pad.."["..err_pos_token.value.."]"..err_pos_token.src_pad.."]" end else -- regular string if err_pos_token.src_value:find("\n") then location = location_descriptor.." <string>" else str = err_pos_token.src_quote..err_pos_token.src_value..err_pos_token.src_quote end end if str then if #str > 32 then -- this message is pretty long and descriptive, but honestly it'll be shown so -- rarely that i don't consider this to be problematic location = location_descriptor.." "..str:sub(1, 16).."..."..str:sub(-16, -1) .." (showing 32 of "..#str.." characters)" else location = location_descriptor.." "..str end end elseif err_pos_token.token_type == "number" then location = location_descriptor.." '"..err_pos_token.src_value.."'" elseif err_pos_token.token_type == "ident" then location = location_descriptor.." "..err_pos_token.value elseif err_pos_token.token_type == "invalid" then location = "" elseif err_pos_token.token_type == "eof" then location = location_descriptor.." <eof>" else location = location_descriptor.." '"..err_pos_token.token_type.."'" end location = location..( err_pos_token.token_type ~= "eof" and (" at "..err_pos_token.line..":"..err_pos_token.column) or "" ) error_code_inst.location_str = location error_code_inst.source = source local invalid = nodes.new_invalid{error_code_inst = error_code_inst} if error_code_insts_insertion_index then table.insert(error_code_insts, error_code_insts_insertion_index, error_code_inst) else error_code_insts[#error_code_insts+1] = error_code_inst end if current_invalid_token then invalid_token_invalid_node_lut[current_invalid_token] = invalid end return invalid end --- Check that the current token is an "ident" token, and if so consume and return it. ---@return Token|AstInvalidNode ident_token local function assert_ident() if token.token_type ~= "ident" then return syntax_error(new_error_code_inst{ error_code = error_code_util.codes.expected_ident, }) end local ident = token next_token() return ident end --- Check if the next token is a `tok` token, and if so consume it. Returns the result of the test. ---@param tok TokenType ---@return boolean local function test_next(tok) if token.token_type == tok then prev_token = token next_token() return true end return false end ---Check if the next token is a `tok` token, and if so consume it. ---Throws a syntax error if token does not match. ---@param tok string local function assert_next(tok) if not test_next(tok) then return syntax_error(new_error_code_inst{ error_code = error_code_util.codes.expected_token, message_args = {tok}, }) end end --- Check for the matching `close` token to a given `open` token ---@param open_token AstTokenNode ---@param close string local function assert_match(open_token, close) if not test_next(close) then return syntax_error(new_error_code_inst{ error_code = error_code_util.codes.expected_closing_match, message_args = {close, open_token.token_type, open_token.line..":"..open_token.column}, }) end end local block_ends = util.invert{"else", "elseif", "until", "end", "eof"} --- Test if the next token closes a block.\ --- In regular lua's parser `until` can be excluded to be considered ending a block --- because it does not actually end the current scope, since the condition is also --- inside the scope. This is important for jump linking, but since jump linking is --- kept separate in phobos (at least at the moment) that logic is not needed here ---@return boolean local function next_token_ends_block() return block_ends[token.token_type] end --- Read a list of Statements and append them to `scope.body`\ --- `stat_list -> { stat [';'] }` ---@param scope AstScope local function stat_list(scope) local stop while not next_token_ends_block() do if token.token_type == "eof" then break elseif token.token_type == "return" then stop = true end ast.append_stat(scope, statement(scope)) if extra_node then ast.append_stat(scope, extra_node) extra_node = nil end if stop then break end end end --- `index -> '[' expr ']'` ---@param scope AstScope ---@return AstExpression ---@return AstTokenNode open_token @ `[` token ---@return AstTokenNode close_token @ `]` token local function index_expr(scope) local open_token = new_token_node() next_token() local e = expr(scope) local close_token = assert_match(open_token, "]") or new_token_node(true) return e, open_token, close_token end --- Table Constructor record field ---@param scope AstScope ---@return AstRecordField local function rec_field(scope) local field = {type = "rec"} if token.token_type == "ident" then field.key = nodes.new_string{ position = token, value = token.value, src_is_ident = true, } next_token() else field.key, field.key_open_token, field.key_close_token = index_expr(scope) end field.eq_token = assert_next("=") or new_token_node(true) if is_invalid(field.eq_token) then -- value should never be nil field.value = prevent_assert else field.value = expr(scope) end return field end --- Table Constructor list field ---@param scope AstScope ---@return AstListField local function list_field(scope) return {type = "list", value = expr(scope)} end --- Table Constructor field --- `field -> list_field | rec_field` ---@param scope AstScope ---@return AstField local function field(scope) return (({ ["ident"] = function() local peek_tok = peek_token() if peek_tok.token_type ~= "=" then return list_field(scope) else return rec_field(scope) end end, ["["] = rec_field, })[token.token_type] or list_field)(scope) end --- Table Constructor --- `constructor -> '{' [ field { sep field } [sep] ] '}'` --- `sep -> ',' | ';'` ---@param scope AstScope ---@return AstConstructor local function constructor(scope) local node = nodes.new_constructor{ open_token = new_token_node(), comma_tokens = {}, } assert(assert_next("{") == nil, "Do not call 'constructor' if the current token is not '{'.") while token.token_type ~= "}" do node.fields[#node.fields+1] = field(scope) if test_next(",") or test_next(";") then node.comma_tokens[#node.comma_tokens+1] = new_token_node(true) else break end end node.close_token = assert_match(node.open_token, "}") or new_token_node(true) return node end --- Function Definition Parameter List ---@param scope AstFunctionDef ---@return AstLocalReference[] local function par_list(scope) -- param_list -> [ param { ',' param } ] local params = {} if token.token_type == ")" then return params end while true do if test_next("ident") then local param_def param_def, params[#params+1] = ast.create_local(prev_token, scope) param_def.whole_block = true scope.locals[#scope.locals+1] = param_def elseif token.token_type == "..." then scope.is_vararg = true scope.vararg_token = new_token_node() next_token() return params else params[#params+1] = syntax_error(new_error_code_inst{ error_code = error_code_util.codes.expected_ident_or_vararg, }) return params end if test_next(",") then scope.param_comma_tokens[#scope.param_comma_tokens+1] = new_token_node(true) else break end end return params end --- Function Definition ---@param function_token AstTokenNode ---@param scope AstScope|AstFunctionDef ---@param is_method boolean Insert the extra first parameter `self` ---@return AstFunctionDef local function functiondef(function_token, scope, is_method) -- body -> `(` param_list `)` block END local parent_functiondef = scope -- ---@narrow scope AstScope|AstFunctionDef while parent_functiondef.node_type ~= "functiondef" do parent_functiondef = parent_functiondef.parent_scope end -- ---@narrow scope AstFunctionDef local node = nodes.new_functiondef{ parent_scope = scope, source = source, is_method = is_method, param_comma_tokens = {}, } -- add to parent before potential early returns parent_functiondef.func_protos[#parent_functiondef.func_protos+1] = node if is_method then local self_local = ast.new_local_def("self", node) self_local.whole_block = true self_local.src_is_method_self = true node.locals[1] = self_local end node.function_token = function_token node.open_paren_token = assert_next("(") or new_token_node(true) if is_invalid(node.open_paren_token) then return node end node.params = par_list(node) -- if par list was invalid but the current token is `")"` then just continue -- because there is a good chance there merely was a trailing comma in the par list if node.params[1] and is_invalid(node.params[#node.params]) and token.token_type ~= ")" then return node end node.close_paren_token = assert_next(")") or new_token_node(true) if is_invalid(node.close_paren_token) then return node end stat_list(node) node.end_token = assert_match(function_token, "end") or new_token_node(true) return node end --- Expression List ---@param scope AstScope ---@return AstExpression[] expression_list ---@return AstTokenNode[] comma_tokens @ length is `#expression_list - 1` local function exp_list(scope) local el = {expr(scope)} local comma_tokens = {} while test_next(",") do comma_tokens[#comma_tokens+1] = new_token_node(true) el[#el+1] = expr(scope) end return el, comma_tokens end --- Function Arguments ---@param node AstCall ---@param scope AstScope ---@return AstExpression[] local function func_args(node, scope) return (({ ["("] = function() node.open_paren_token = new_token_node() next_token() if token.token_type == ")" then node.close_paren_token = new_token_node() next_token() return {} end local el, comma_tokens = exp_list(scope) node.close_paren_token = assert_match(node.open_paren_token, ")") or new_token_node(true) return el, comma_tokens end, ["string"] = function() local string_node = nodes.new_string{ position = token, value = token.value, src_is_block_str = token.src_is_block_str, src_quote = token.src_quote, src_value = token.src_value, src_has_leading_newline = token.src_has_leading_newline, src_pad = token.src_pad, } next_token() return {string_node}, {} end, ["{"] = function() return {(constructor(scope))}, {} end, })[token.token_type] or function() return {syntax_error(new_error_code_inst{ error_code = error_code_util.codes.expected_func_args, })} end)() end local function init_concat_src_paren_wrappers(node) node.concat_src_paren_wrappers = node.concat_src_paren_wrappers or {} for i = 1, #node.exp_list - 1 do node.concat_src_paren_wrappers[i] = node.concat_src_paren_wrappers[i] or {} end end --- Primary Expression ---@param scope AstScope ---@return AstExpression local function primary_exp(scope) if test_next("(") then local open_paren_token = new_token_node(true) --TODO: compact lambda here: -- token_type is ')', empty args expect `'=>' expr` next -- token_type is 'ident' -- followed by `,` is multiple args, finish list then `=> expr` -- followed by `)` `=>` is single arg, expect `expr_list` -- followed by `)` or anything else is expr of inner, current behavior local ex = expr(scope) local close_paren_token = assert_match(open_paren_token, ")") or new_token_node(true) ex.force_single_result = true local wrapper = { open_paren_token = open_paren_token, close_paren_token = close_paren_token, } if ex.node_type == "concat" then init_concat_src_paren_wrappers(ex) ex.concat_src_paren_wrappers[1][#ex.concat_src_paren_wrappers[1]+1] = wrapper else ex.src_paren_wrappers = ex.src_paren_wrappers or {} ex.src_paren_wrappers[#ex.src_paren_wrappers+1] = wrapper end return ex elseif token.token_type == "ident" then local ident = assert_ident() -- can't be invalid return ast.resolve_ref_at_end(scope, ident.value, ident) else if token.token_type == "invalid" then local invalid = invalid_token_invalid_node_lut[token] add_consumed_node(invalid, new_token_node()) next_token() return invalid else local invalid = syntax_error(new_error_code_inst{ error_code = error_code_util.codes.unexpected_token, }, "") -- consume the invalid token, it would infinitely loop otherwise add_consumed_node(invalid, new_token_node()) next_token() return invalid end end end local function new_regular_call(ex, scope) local node = nodes.new_call{ ex = ex, } node.args, node.args_comma_tokens = func_args(node, scope) return node end local suffixed_lut = { ["."] = function(ex, scope) local node = nodes.new_index{ ex = ex, dot_token = new_token_node(), suffix = prevent_assert, } next_token() -- skip '.' local ident = assert_ident() if is_invalid(ident) then node.suffix = ident else node.suffix = nodes.new_string{ position = ident, value = ident.value, src_is_ident = true, } end return node end, ["["] = function(ex, scope) local node = nodes.new_index{ ex = ex, suffix = prevent_assert, } node.suffix, node.suffix_open_token, node.suffix_close_token = index_expr(scope) return node end, [":"] = function(ex, scope) local node = nodes.new_call{ is_selfcall = true, ex = ex, colon_token = new_token_node(), suffix = prevent_assert, } next_token() -- skip ':' local ident = assert_ident() if is_invalid(ident) then node.suffix = ident if token.token_type ~= "(" and token.token_type ~= "string" and token.token_type ~= "{" then -- return early to prevent the additional syntax error return node end else node.suffix = nodes.new_string{ position = ident, value = ident.value, src_is_ident = true, } end node.args, node.args_comma_tokens = func_args(node, scope) return node end, ["("] = new_regular_call, ["string"] = new_regular_call, ["{"] = new_regular_call, } --- Suffixed Expression ---@param scope AstScope ---@return AstExpression local function suffixed_exp(scope) -- suffixed_exp -> -- primary_exp { '.' NAME | '[' exp ']' | ':' NAME func_args | func_args } --TODO: safe chaining adds optional '?' in front of each suffix local ex = primary_exp(scope) local should_break = false while ex.node_type ~= "invalid" do ex = ((suffixed_lut)[token.token_type] or function(ex) should_break = true return ex end)(ex, scope) if should_break then break end end return ex end ---value is set outside, for all of them local simple_lut = { ["number"] = function(scope) return nodes.new_number{ position = token, value = token.value, src_value = token.src_value, } end, ["string"] = function(scope) return nodes.new_string{ position = token, value = token.value, src_is_block_str = token.src_is_block_str, src_quote = token.src_quote, src_value = token.src_value, src_has_leading_newline = token.src_has_leading_newline, src_pad = token.src_pad, } end, ["nil"] = function(scope) return nodes.new_nil{ position = token, } end, ["true"] = function(scope) return nodes.new_boolean{ position = token, value = true, } end, ["false"] = function(scope) return nodes.new_boolean{ position = token, value = false, } end, ["..."] = function(scope) while scope.node_type ~= "functiondef" do scope = scope.parent_scope end if not scope.is_vararg then local invalid = syntax_error(new_error_code_inst{ error_code = error_code_util.codes.vararg_outside_vararg_func, }, "at") add_consumed_node(invalid, new_token_node()) return invalid end return nodes.new_vararg{ position = token, } end, } ---Simple Expression\ ---can result in invalid nodes ---@param scope AstScope ---@return AstExpression local function simple_exp(scope) -- simple_exp -> NUMBER | STRING | NIL | TRUE | FALSE | ... | -- constructor | FUNCTION body | suffixed_exp if simple_lut[token.token_type] then local node = simple_lut[token.token_type](scope) next_token() --consume it return node end if token.token_type == "{" then return constructor(scope) elseif test_next("function") then return nodes.new_func_proto{ func_def = functiondef(new_token_node(true), scope, false), } else return suffixed_exp(scope) end end local unop_prio = { ["not"] = 8, ["-"] = 8, ["#"] = 8, } -- the way to think about this, at least in my opinion is: -- if the left priority of the next operator is higher than -- the right priority of the previous operator then the current -- operator will evaluate first. -- evaluating first means creating a node first, which will then -- be the right side of the previous operator -- -- and the way the unop prio plays into this is that it is basically -- like the right priority of binops. -- -- examples: -- ((foo + bar) + baz) -- ((foo or (bar and baz)) or hi) -- (foo ^ (bar ^ baz)) -- (-(foo ^ bar)) -- -- another way to think about this: -- looking at an expression "affected" by 2 operators, look at both their -- priorities. For example: -- foo + bar * baz -- <6-6> <7-7> -- the expression bar has both priority 6 and 7 "applied" to it. -- 7 is greater than 6, so that side will evaluate first; It will be the inner node -- another example: -- -foo ^ bar -- 8><10-9> -- 10 beats 8, so foo will be part of the inner node on the right local binop_prio = { ["^"] = {left=10,right=9}, -- right associative ["*"] = {left=7 ,right=7}, ["/"] = {left=7,right=7}, ["%"] = {left=7 ,right=7}, ["+"] = {left=6 ,right=6}, ["-"] = {left=6,right=6}, [".."] = {left=5 ,right=4}, -- right associative ["=="] = {left=3 ,right=3}, ["<"] = {left=3 ,right=3}, ["<="] = {left=3,right=3}, ["~="] = {left=3 ,right=3}, [">"] = {left=3 ,right=3}, [">="] = {left=3,right=3}, ["and"] = {left=2 ,right=2}, ["or"] = {left=1 ,right=1}, } -- right associative doesn't affect the order in which the expressions -- get evaluated, but it affects the order the operators get evaluated -- in the case of ^ this is obvious since the right one ends up being the inner node: -- foo ^ bar ^ baz => (foo ^ (bar ^ baz)) -- in the case of a concat --- sub_expression --- `sub_expr -> (simple_exp | unop sub_expr) { binop sub_expr }` --- where `binop' is any binary operator with a priority higher than `limit' ---@param limit number ---@param scope AstScope ---@return AstExpression completed ---@return string next_op local function sub_expr(limit, scope) local node do local prio = unop_prio[token.token_type] if prio then node = nodes.new_unop{ op = token.token_type, op_token = new_token_node(), ex = prevent_assert, } next_token() -- consume unop node.ex = sub_expr(prio, scope) else node = simple_exp(scope) end end local binop = token.token_type local prio = binop_prio[binop] while prio and prio.left > limit do local op_token = new_token_node() next_token() -- consume `binop` ---@type AstExpression|AstConcat local right_node, next_op = sub_expr(prio.right, scope) if binop == ".." then if right_node.node_type == "concat" then -- needs to init before adding the node to the exp_list so that the -- insert of another concat_src_paren_wrappers doesn't make the list too long init_concat_src_paren_wrappers(right_node) table.insert(right_node.exp_list, 1, node) node = right_node table.insert(node.op_tokens, 1, op_token) table.insert(node.concat_src_paren_wrappers, 1, {}) elseif node.node_type == "concat" and not node.force_single_result then error("Impossible -- TODO: explain why it's impossible. Note to jog my memory: \z concat is right associative, so the right ones are going to be parsed first. \z the only way for the current `node` to be a concat node is if the simple expression \z at the very beginning parsed a concat node wrapped in parenthesis, however those are \z excluded by the if condition." ) else local left_node = node node = nodes.new_concat{ exp_list = {left_node, right_node}, op_tokens = {op_token}, } end else local left_node = node node = nodes.new_binop{ left = left_node, op = binop, right = right_node, op_token = op_token, } end binop = next_op prio = binop_prio[binop] end return node, binop end --- Expression ---@param scope AstScope ---@return AstExpression completed function expr(scope) return (sub_expr(0, scope)) end --- Assignment Statement ---@param lhs AstExpression[] ---@param lhs_comma_tokens AstTokenNode[] ---@param scope AstScope ---@return AstAssignment local function assignment(lhs, lhs_comma_tokens, state_for_unexpected_expressions, scope) if lhs[#lhs].force_single_result or lhs[#lhs].node_type == "call" then -- insert the syntax error at the correct location -- (so the order of syntax errors is in the same order as they appeared in the file) local invalid = syntax_error(new_error_code_inst{ error_code = error_code_util.codes.unexpected_expression, position = state_for_unexpected_expressions.position, }, nil, state_for_unexpected_expressions.error_code_insts_count + 1) add_consumed_node(invalid, lhs[#lhs]) lhs[#lhs] = invalid end if test_next(",") then lhs_comma_tokens[#lhs_comma_tokens+1] = new_token_node(true) local first_token = token local initial_error_code_insts_count = get_error_code_insts_count() lhs[#lhs+1] = suffixed_exp(scope) -- TODO: disallow `(exp)` (so force single result expressions) and `exp()` (call expressions) return assignment( lhs, lhs_comma_tokens, {position = first_token, error_code_insts_count = initial_error_code_insts_count}, scope ) else local invalid = assert_next("=") local node = nodes.new_assignment{ eq_token = invalid or new_token_node(true), lhs = lhs, lhs_comma_tokens = lhs_comma_tokens, } if not invalid then node.rhs, node.rhs_comma_tokens = exp_list(scope) end return node end end --- Label Statement ---@param scope AstScope ---@return AstLabel local function label_stat(scope) local open_token = new_token_node() next_token() -- skip "::" local name_token = new_token_node() local ident = assert_ident() if is_invalid(ident) then add_consumed_node(ident, open_token) return ident end local prev_label = scope.labels[ident.value] if prev_label then local invalid = syntax_error(new_error_code_inst{ error_code = error_code_util.codes.duplicate_label, message_args = {ident.value, prev_label.name_token.line..":"..prev_label.name_token.column}, position = ident, }) add_consumed_node(invalid, open_token) add_consumed_node(invalid, name_token) -- order is important, assert for :: after creating the previous syntax error local close_token = assert_next("::") or new_token_node(true) if is_invalid(close_token) then -- add another node to the stat list which is the invalid node -- because there wasn't a '::' token extra_node = close_token else add_consumed_node(invalid, close_token) end return invalid else -- storing the value both in `name` and `name_token.value` local node = nodes.new_label{ name = ident.value, open_token = open_token, name_token = name_token, close_token = assert_next("::") or new_token_node(true), } scope.labels[node.name] = node return node end end --- While Statement --- `whilestat -> WHILE condition DO block END` ---@param scope AstScope ---@return AstWhileStat local function while_stat(scope) local node = nodes.new_whilestat{ parent_scope = scope, while_token = new_token_node(), condition = prevent_assert, } next_token() -- skip WHILE node.condition = expr(node) local invalid = assert_next("do") node.do_token = invalid or new_token_node(true) if invalid then return node end stat_list(node) node.end_token = assert_match(node.while_token, "end") or new_token_node(true) return node end --- Repeat Statement --- `repeatstat -> REPEAT block UNTIL condition` ---@param scope AstScope ---@return AstRepeatStat local function repeat_stat(scope) local node = nodes.new_repeatstat{ parent_scope = scope, repeat_token = new_token_node(), condition = prevent_assert, } next_token() -- skip REPEAT stat_list(node) local invalid = assert_match(node.repeat_token, "until") node.until_token = invalid or new_token_node(true) if not invalid then node.condition = expr(node) end return node end --- Numeric For Statement --- `fornum -> NAME = exp1,exp1[,exp1] DO block` ---@param first_name AstTokenNode ---@param scope AstScope ---@return AstForNum local function for_num(first_name, scope) -- currently the only place calling for_num is for_stat which will only call -- this function if the current token is '=', but we're handling invalid anyway local invalid = assert_next("=") local node = nodes.new_fornum{ parent_scope = scope, var = prevent_assert, locals = {prevent_assert}, eq_token = invalid or new_token_node(true), start = prevent_assert, stop = prevent_assert, } local var_local, var_ref = ast.create_local(first_name, node) var_local.whole_block = true node.locals[1] = var_local node.var = var_ref if invalid then return node, true end node.start = expr(scope) invalid = assert_next(",") node.first_comma_token = invalid or new_token_node(true) if invalid then return node, true end node.stop = expr(scope) node.step = nil if test_next(",") then node.second_comma_token = new_token_node(true) node.step = expr(scope) end invalid = assert_next("do") node.do_token = invalid or new_token_node(true) if invalid then return node, true end stat_list(node) return node, false end --- Generic For Statement --- `forlist -> NAME {,NAME} IN exp_list DO block` ---@param first_name AstTokenNode ---@param scope AstScope ---@return AstForList local function for_list(first_name, scope) local name_local, name_ref = ast.create_local(first_name, scope) name_local.whole_block = true local name_list = {name_ref} local node = nodes.new_forlist{ parent_scope = scope, name_list = name_list, locals = {name_local}, exp_list = {prevent_assert}, comma_tokens = {}, } while test_next(",") do node.comma_tokens[#node.comma_tokens+1] = new_token_node(true) local ident = assert_ident() if is_invalid(ident) then name_list[#name_list+1] = ident -- if it's an 'in' then basically just ignore the extra comma and continue with this node if token.token_type ~= "in" then return node, true end else node.locals[#node.locals+1], name_list[#name_list+1] = ast.create_local(ident, scope) node.locals[#node.locals].whole_block = true end end local invalid = assert_next("in") node.in_token = invalid or new_token_node(true) if invalid then return node, true end node.exp_list, node.exp_list_comma_tokens = exp_list(scope) invalid = assert_next("do") node.do_token = invalid or new_token_node(true) if invalid then return node, true end stat_list(node) return node, false end --- For Statement --- `for_stat -> FOR (fornum | forlist) END` ---@param scope AstScope ---@return Token local function for_stat(scope) local for_token = new_token_node() next_token() -- skip FOR local first_ident = assert_ident() if is_invalid(first_ident) then add_consumed_node(first_ident, for_token) return first_ident end local t = token.token_type local node local is_partially_invalid if t == "=" then node, is_partially_invalid = for_num(first_ident, scope) elseif t == "," or t == "in" then node, is_partially_invalid = for_list(first_ident, scope) else local invalid = syntax_error(new_error_code_inst{ error_code = error_code_util.codes.expected_eq_comma_or_in, }) add_consumed_node(invalid, for_token) add_consumed_node(invalid, nodes.new_token(first_ident)) return invalid end node.for_token = for_token if not is_partially_invalid then node.end_token = assert_match(for_token, "end") or new_token_node(true) end return node end local function test_then_block(scope) -- test_then_block -> [IF | ELSEIF] condition THEN block -- NOTE: [IF | ELSEIF] ( condition | name_list '=' exp_list [';' condition] ) THEN block -- if first token is ident, and second is ',' or '=', use if-init, else original parse -- if no condition in if-init, first name/expr is used local node = nodes.new_testblock{ parent_scope = scope, if_token = new_token_node(), condition = prevent_assert, } next_token() -- skip IF or ELSEIF node.condition = expr(node) local invalid = assert_next("then") node.then_token = invalid or new_token_node(true) if invalid then return node, true end stat_list(node) return node end local function if_stat(scope) -- ifstat -> IF condition THEN block {ELSEIF condition THEN block} [ELSE block] END local ifs = {} local invalid = false repeat ifs[#ifs+1], invalid = test_then_block(scope) until token.token_type ~= "elseif" or invalid local elseblock if not invalid and test_next("else") then elseblock = nodes.new_elseblock{ parent_scope = scope, else_token = new_token_node(true), } stat_list(elseblock) end local node = nodes.new_ifstat{ ifs = ifs, elseblock = elseblock, } if not invalid then node.end_token = assert_match(ifs[1].if_token, "end") or new_token_node(true) end return node end local function local_func(local_token, function_token, scope) local ident = assert_ident() local name_local, name_ref if is_invalid(ident) then name_ref = ident else name_local, name_ref = ast.create_local(ident, scope) scope.locals[#scope.locals+1] = name_local end local node = nodes.new_localfunc{ name = name_ref, func_def = prevent_assert, local_token = local_token, } node.func_def = functiondef(function_token, scope, false) if name_local then -- set this right before returning to tell the ast_util that this local definition -- doesn't have a start_at node yet when trying to resolve references to it within -- the function body name_local.start_at = node name_local.start_offset = 0 end return node end local function local_stat(local_token, scope) -- stat -> LOCAL NAME {',' NAME} ['=' exp_list] local node = nodes.new_localstat{ local_token = local_token, lhs_comma_tokens = {}, } local function test_comma() if test_next(",") then node.lhs_comma_tokens[#node.lhs_comma_tokens+1] = new_token_node(true) return true end return false end local local_defs = {} repeat local ident = assert_ident() if is_invalid(ident) then node.lhs[#node.lhs+1] = ident break else local_defs[#local_defs+1], node.lhs[#node.lhs+1] = ast.create_local(ident, scope) local_defs[#local_defs].start_at = node local_defs[#local_defs].start_offset = 1 end until not test_comma() -- just continue even if it was invalid, because an '=' token would just be another syntax error if test_next("=") then node.eq_token = new_token_node(true) node.rhs, node.rhs_comma_tokens = exp_list(scope) end -- add the locals after the expression list has been parsed for _, name_local in ipairs(local_defs) do scope.locals[#scope.locals+1] = name_local end return node end ---@param scope AstScope ---@return boolean ---@return AstExpression|AstInvalidNode name local function func_name(scope) -- func_name -> NAME {'.' NAME} [':' NAME] local ident = assert_ident() if is_invalid(ident) then return false, ident end local name = ast.resolve_ref_at_end(scope, ident.value, ident) while token.token_type == "." do name = suffixed_lut["."](name, scope) end if token.token_type == ":" then name = suffixed_lut["."](name, scope) return true, name end return false, name end local function func_stat(scope) -- funcstat -> FUNCTION func_name body local function_token = new_token_node() next_token() -- skip FUNCTION local is_method, name = func_name(scope) if is_invalid(name) then -- using table.insert?! disgusting!! but we have to put the token first table.insert(name.consumed_nodes, 1, function_token) return name end return nodes.new_funcstat{ name = name, func_def = functiondef(function_token, scope, is_method), } end local function expr_stat(scope) -- stat -> func | assignment local first_token = token local initial_error_code_insts_count = get_error_code_insts_count() local first_exp = suffixed_exp(scope) if token.token_type == "=" or token.token_type == "," then -- stat -> assignment return assignment( {first_exp}, {}, {position = first_token, error_code_insts_count = initial_error_code_insts_count}, scope ) else -- stat -> func if first_exp.node_type == "call" and not first_exp.force_single_result then return first_exp elseif first_exp.node_type == "invalid" then -- wherever this invalid node came from is responsible for consuming the -- current token, or not consuming it. If it isn't, it has to make sure -- that whichever token it is leaving unconsumed will not lead down the -- same branches again, sine that would be an infinite loop return first_exp else -- insert the syntax error at the correct location -- (so the order of syntax errors is in the same order as they appeared in the file) local invalid = syntax_error(new_error_code_inst{ error_code = error_code_util.codes.unexpected_expression, position = first_token, }, nil, initial_error_code_insts_count + 1) add_consumed_node(invalid, first_exp) return invalid end end end local function retstat(scope) -- stat -> RETURN [exp_list] [';'] local this_node = nodes.new_retstat{ return_token = new_token_node(), } next_token() -- skip "return" if next_token_ends_block() then -- return no values elseif token.token_type == ";" then -- also return no values else this_node.exp_list, this_node.exp_list_comma_tokens = exp_list(scope) end if test_next(";") then this_node.semi_colon_token = new_token_node(true) end return this_node end local statement_lut = { [";"] = function(scope) -- stat -> ';' (empty statement) local node = nodes.new_empty{ semi_colon_token = new_token_node(), } next_token() -- skip return node end, ["if"] = function(scope) -- stat -> ifstat return if_stat(scope) end, ["while"] = function(scope) -- stat -> whilestat return while_stat(scope) end, ["do"] = function(scope) -- stat -> DO block END local node = nodes.new_dostat{ parent_scope = scope, do_token = new_token_node(), } next_token() -- skip "do" stat_list(node) node.end_token = assert_match(node.do_token, "end") or new_token_node(true) return node end, ["for"] = function(scope) -- stat -> for_stat return for_stat(scope) end, ["repeat"] = function(scope) -- stat -> repeatstat return repeat_stat(scope) end, ["function"] = function(scope) -- stat -> funcstat return func_stat(scope) end, ["local"] = function(scope) -- stat -> localstat local local_token_node = new_token_node() next_token() -- skip "local" if test_next("function") then return local_func(local_token_node, new_token_node(true), scope) else return local_stat(local_token_node, scope) end end, ["::"] = function(scope) -- stat -> label return label_stat(scope) end, ["return"] = function(scope) -- stat -> retstat return retstat(scope) end, ["break"] = function(scope) -- stat -> breakstat local this_tok = nodes.new_breakstat{ break_token = new_token_node(), } next_token() -- skip BREAK return this_tok end, ["goto"] = function(scope) -- stat -> 'goto' NAME local goto_token = new_token_node() next_token() -- skip GOTO local name_token = new_token_node() local target_ident = assert_ident() if is_invalid(target_ident) then add_consumed_node(target_ident, goto_token) return target_ident else -- storing the value both in `target_name` and `target_token.value` return nodes.new_gotostat{ goto_token = goto_token, target_name = target_ident.value, target_token = name_token, } end end, } function statement(scope) return (statement_lut[token.token_type] or expr_stat)(scope) end local function main_func() local main = ast.new_main(source) stat_list(main) -- this will only fail either if there previously were syntax errors or an early return local invalid = assert_next("eof") if invalid then ast.append_stat(main, invalid) -- continue parsing the rest of the file as if it's part of the main body -- because the main body is the highest scope we got while not test_next("eof") do ast.append_stat(main, statement(main)) end end main.eof_token = new_token_node() return main end local tokenize = require("tokenize") local function parse(text,source_name) source = source_name prevent_assert = nodes.new_invalid{ error_code_inst = error_code_util.new_error_code{ error_code = error_code_util.codes.incomplete_node, source = source_name, position = {line = 0, column = 0}, } } error_code_insts = {} invalid_token_invalid_node_lut = {} local token_iter, index token_iter,token_iter_state,index = tokenize(text) function next_token() if token and token.token_type == "eof" then return end local leading = {} while true do index,token = token_iter(token_iter_state,index) if not token then token = {token_type="eof", leading = leading} break end if token.token_type == "comment" then leading[#leading+1] = token -- parse doc comments, accumulate them for the next token that wants them --[[ these patterns match all of the following: --- Description text, three dashes, a space, and any text ---@tag three dashes, at-tag, and any text -- @tag two dashes, a space, at-tag, and any text ]] -- if token.value:match("^%- ") or token.value:match("^[- ]@") then -- print("found doc comment " .. token.value) -- end elseif token.token_type == "blank" then leading[#leading+1] = token else token.leading = leading if token.token_type == "invalid" then err_pos_token = token for _, error_code_inst in ipairs(token.error_code_insts) do syntax_error(error_code_inst, nil, nil, token) end end break end end end function peek_token(start_at) local line, line_offset = token_iter_state.line, token_iter_state.line_offset start_at = start_at or index local peek_tok repeat start_at,peek_tok = token_iter(token_iter_state,start_at) until peek_tok.token_type ~= "blank" and peek_tok.token_type ~= "comment" token_iter_state.line, token_iter_state.line_offset = line, line_offset return peek_tok, start_at end -- have to reset token because if the previous `parse` call was interrupted by an error -- which was caught by pcall the current token might still be eof which would cause -- this parse call to do literally nothing -- errors should be impossible in the parse function, but there can always be bugs token = nil next_token() local main = main_func() -- have to reset token, otherwise the next parse call will think its already reached the end token = nil -- clear these references to not hold on to memory local result_error_code_insts = error_code_insts error_code_insts = nil invalid_token_invalid_node_lut = nil source = nil prevent_assert = nil prev_token = nil token_iter_state = nil -- with token_iter_state cleared, next_token and peek_token -- don't really have any other big upvals, so no need to clear them return main, result_error_code_insts end return parse
local ReplicatedStorage = game:GetService('ReplicatedStorage') local Modules = ReplicatedStorage:WaitForChild('Modules') local Players = game:GetService('Players') local logger = require(Modules.src.utils.Logger) local GameDatastore = require(Modules.src.GameDatastore) local MarketplaceService = game:GetService('MarketplaceService') local COINS_1 = 966181357 local COINS_2 = 1086783078 local COINS_3 = 1086783194 local COINS_4 = 1086783346 local DeveloperProducts = { COINS_1 = COINS_1, COINS_2 = COINS_2, COINS_3 = COINS_3, COINS_4 = COINS_4, } local rewards = { [COINS_1] = 1000, [COINS_2] = 10000, [COINS_3] = 100000, [COINS_4] = 1000000, } local productFunctions = {} productFunctions[COINS_1] = function(receipt, player) GameDatastore:incrementCoins(player, rewards[COINS_1]) return true end productFunctions[COINS_2] = function(receipt, player) GameDatastore:incrementCoins(player, rewards[COINS_2]) return true end productFunctions[COINS_3] = function(receipt, player) GameDatastore:incrementCoins(player, rewards[COINS_3]) return true end productFunctions[COINS_4] = function(receipt, player) GameDatastore:incrementCoins(player, rewards[COINS_4]) return true end function DeveloperProducts:promptPurchase(productId) local player = Players.LocalPlayer MarketplaceService:PromptProductPurchase(player, productId) end function DeveloperProducts:getProduct(productId) local product = MarketplaceService:GetProductInfo(productId, Enum.InfoType.Product) return { name = product.Name, description = product.Description, price = product.PriceInRobux, isDeveloperProduct = true, } end function DeveloperProducts.processReceipt(receiptInfo) -- Find the player who made the purchase in the server local player = Players:GetPlayerByUserId(receiptInfo.PlayerId) if not player then -- The player probably left the game -- If they come back, the callback will be called again return Enum.ProductPurchaseDecision.NotProcessedYet end -- Determine if the product was already granted by checking the data store local purchased = GameDatastore:hasProductPurchased(player, receiptInfo.PurchaseId) if purchased then logger:d('Already purchased product ' .. tostring(receiptInfo.PurchaseId)) return Enum.ProductPurchaseDecision.PurchaseGranted end local applyProductHandler = productFunctions[receiptInfo.ProductId] if not applyProductHandler then logger:e('No product handler for ' .. tostring(receiptInfo.ProductId)) return Enum.ProductPurchaseDecision.NotProcessedYet end -- Call the handler function and catch any errors local success, result = pcall(applyProductHandler, receiptInfo, player) if not success or not result then logger:w( 'Error occurred while processing a product purchase. ProductId:' .. tostring( receiptInfo.ProductId ) .. '. Player:' .. tostring(player.UserId), result ) return Enum.ProductPurchaseDecision.NotProcessedYet end -- Record transaction in data store so it isn't granted again GameDatastore:setProductPurchased(player, receiptInfo.PurchaseId) return Enum.ProductPurchaseDecision.PurchaseGranted end return DeveloperProducts
-- various convenience functions related to the weapon local reg = debug.getregistry() local GetVelocity = reg.Entity.GetVelocity local Length = reg.Vector.Length local GetAimVector = reg.Player.GetAimVector -- no reason to get it over and over again, since if it's singleplayer, it's singleplayer local SP = game.SinglePlayer() --[[attachment inter-dependency logic: requires a table, ie SWEP.AttachmentPosDependency first index a string containing attachments that it depends on second index is a string which contains the vector position ]]-- function LerpCW20(val, min, max) -- basically a wrapper that limits 'val' (aka progress) to a max of 1 val = val > 1 and 1 or val return Lerp(val, min, max) end function SWEP:canCustomize() if not self.CanCustomize then return false end if self.ReloadDelay then return false end if self.NoCustomizeStates[self.dt.State] then return false end if not self.Owner:OnGround() then return false end return true end function SWEP:isLowOnMagAmmo() if self:Clip1() <= self.Primary.ClipSize * 0.25 or self:getReloadProgress() then return true end end function SWEP:isLowOnAmmo() if self.Owner:GetAmmoCount(self.Primary.Ammo) <= self.Primary.ClipSize then return true end return false end function SWEP:isLowOnTotalAmmo() if self.Owner:GetAmmoCount(self.Primary.Ammo) + self:Clip1() <= self.Primary.ClipSize * 2 then return true end return false end function SWEP:setM203Chamber(state) self.M203Chamber = state self:networkM203Chamber() end function SWEP:networkM203Chamber() umsg.Start("CW20_M203CHAMBER", self.Owner) umsg.Entity(self) umsg.Bool(self.M203Chamber) umsg.End() end function SWEP:resetAimBreathingState() self.AimBreathingEnabled = self.AimBreathingEnabled_Orig end function SWEP:maxOutWeaponAmmo(desiredAmmo) self:SetClip1(desiredAmmo + (self.Chamberable and 1 or 0)) end function SWEP:isAiming() return self.dt.State == CW_AIMING end function SWEP:setupSuppressorPositions() self.SuppressorPositions = self.SuppressorPositions or {} if self.AttachmentModelsVM then for k, v in pairs(self.AttachmentModelsVM) do -- easy way to find all suppressor attachments, 'silencer' is there in case someone is gun-illiterate enough and calls them incorrectly if k:find("suppress") or k:find("silencer") then self.SuppressorPositions[k] = v.pos v.origPos = v.pos end end end end function SWEP:updateAttachmentPositions() if not self.AttachmentPosDependency and not self.AttachmentAngDependency then return end if not self.AttachmentModelsVM then return end -- loop through the VM attachment table for k, v in pairs(self.AttachmentModelsVM) do -- iterate through active attachments only if v.active then -- check for inter-dependencies of this attachment if self.AttachmentPosDependency then local inter = self.AttachmentPosDependency[k] if inter then -- loop through the attachment table, find active attachments local found = false for k2, v2 in pairs(inter) do if self.ActiveAttachments[k2] then v.pos = inter[k2] found = true end end -- reset the position in case none are active if not found then v.pos = v.origPos end end end if self.AttachmentAngDependency then local inter = self.AttachmentAngDependency[k] if inter then -- loop through the attachment table, find active attachments local found = false for k2, v2 in pairs(inter) do if self.ActiveAttachments[k2] then v.angle = inter[k2] found = true end end -- reset the position in case none are active if not found then v.angle = v.origAng end end end end end end function SWEP:updateSuppressorPosition(suppressor) if not self.SuppressorPositions then return end if not self.AttachmentModelsVM then return end local found = false -- loop through the table for k, v in pairs(self.Attachments) do if v.last then -- check active attachments -- if there is one and it is in the SuppressorPositions table local suppressorPos = self.SuppressorPositions[v.atts[v.last]] if suppressorPos then --find every single VM element with part of the name "suppress" or "silencer" and update it's pos to what it is for k2, v2 in pairs(self.AttachmentModelsVM) do if CustomizableWeaponry.suppressors[k2] then --if k2:find("suppress") or k2:find("silencer") then v2.pos = suppressorPos found = true break end end end end end -- if nothing is found, revert the position back to origPos if not found then for k, v in pairs(self.AttachmentModelsVM) do if CustomizableWeaponry.suppressors[k] then v.pos = v.origPos end end end end function SWEP:canSeeThroughTelescopics(aimPosName) if self.dt.State == CW_AIMING and not self.Peeking and self.AimPos == self[aimPosName] then local canUseSights = CustomizableWeaponry.grenadeTypes:canUseProperSights(self.Grenade40MM) if self.dt.M203Active then if self.M203Chamber then if canUseSights then return true end else return true end else return true end end return false end function SWEP:hasExcludedAttachment(tbl, targetTable) targetTable = targetTable or self.ActiveAttachments for k, v in pairs(tbl) do if targetTable[v] then return true, targetTable[v] end end return false end function SWEP:isCategoryEligible(depend, exclude, activeAttachments) local state = false activeAttachments = activeAttachments or self.ActiveAttachments -- if there are dependencies, make sure we have at least one of them for this category if depend then for k, v in pairs(depend) do if activeAttachments[k] then return true end end else state = true -- if there are none, assume no exclusions end -- if there are exclusions, loop through, if there are any attachments that exclude the current category, don't allow us to attach it if exclude then for k, v in pairs(exclude) do if activeAttachments[k] then return false, -1, k -- active attachment that excludes this category end end end -- otherwise, return the final verdict return state, -2, depend -- either true or false, in case of false - attachment(s) we depend on is (are) not active end -- this function checks whether a certain attachment can be attached -- it's different from the 'dependencies' and 'exclusions' tables in the Attachments table in the way that it checks eligibility on a per-attachment basis -- keep in mind that the 'dependencies' and 'exclusions' you specify in the Attachments table are on a category basis function SWEP:isAttachmentEligible(name, activeAttachments) local found = nil activeAttachments = activeAttachments or self.ActiveAttachments if self.AttachmentDependencies then local depend = self.AttachmentDependencies[name] -- loop through the active attachments, see if any of them are active if depend then found = false for k, v in pairs(depend) do -- if they are, that means we can proceed if activeAttachments[v] then found = true break end end end end if self.AttachmentExclusions then -- loop through the exclusions for this particular attachment, if there are any, let us know that we can't proceed local excl = self.AttachmentExclusions[name] if excl then for k, v in pairs(excl) do if activeAttachments[v] then return false, self.AttachmentEligibilityEnum.ACTIVE_ATTACHMENT_EXCLUSION, activeAttachments[v] -- active attachment excludes end end end end -- nil indicates that we can attach if found == nil then return true end -- or just return the result return found, self.AttachmentEligibilityEnum.NEED_ATTACHMENTS, self.AttachmentDependencies[name] -- in case of false - attachment we depend on is not attached end -- this function is ran every time an attachment is detached (or swapped, which is basically the same thing) -- what it does is it checks every attachment for dependencies, and detaches everything that can't be on the weapon without a 'parent' attachment function SWEP:checkAttachmentDependency() for k, v in ipairs(self.Attachments) do if v.last then local curAtt = v.atts[v.last] local foundAtt = CustomizableWeaponry.registeredAttachmentsSKey[curAtt] -- we've found an attachment that's currently on the weapon, check if it depends on anything if foundAtt then -- check if the category and the attachment are eligible if not self:isAttachmentEligible(foundAtt.name) or not self:isCategoryEligible(v.dependencies, v.exclusions) then -- they aren't eligible, time to detach them self:_detach(k, v.last) end end end end end -- restores the current firing sounds back to their original variants function SWEP:restoreSound() self.FireSound = self.FireSound_Orig self.FireSoundSuppressed = self.FireSoundSuppressed_Orig end function SWEP:updateSoundTo(snd, var) if not snd then return end var = var or 0 -- var 0 is the unsuppressed fire sound, var 1 is the suppressed if var == 0 then self.FireSound = Sound(snd) return self.FireSound elseif var == 1 then self.FireSoundSuppressed = Sound(snd) return self.FireSoundSuppressed end end function SWEP:setupCurrentIronsights(pos, ang) if SERVER then return end self.CurIronsightPos = pos self.CurIronsightAng = ang end function SWEP:resetSuppressorStatus() if self.SuppressedOnEquip ~= nil then self.dt.Suppressed = self.SuppressedOnEquip else -- default to false self.dt.Suppressed = false end end function SWEP:resetAimToIronsights() if SERVER then return end self.AimPos = self.CurIronsightPos self.AimAng = self.CurIronsightAng self.ActualSightPos = nil self.ActualSightAng = nil self.SightBackUpPos = nil self.SightBackUpAng = nil end function SWEP:revertToOriginalIronsights() if SERVER then return end self.CurIronsightPos = self.AimPos_Orig self.CurIronsightAng = self.AimAng_Orig if not self:isAttachmentActive("sights") then self.AimPos = self.CurIronsightPos self.AimAng = self.CurIronsightAng end end function SWEP:updateIronsights(index) if SERVER then return end self.AimPos = self[index .. "Pos"] self.AimAng = self[index .. "Ang"] end function SWEP:isAttachmentActive(category) if not category then return false end if not CustomizableWeaponry[category] then return false end for k, v in ipairs(self.Attachments) do if v.last then local curAtt = v.atts[v.last] if CustomizableWeaponry[category][curAtt] then return true end end end return false end local mins, maxs = Vector(-8, -8, -1), Vector(8, 8, 1) local td = {} td.mins = mins td.maxs = maxs function SWEP:CanRestWeapon(height) height = height or -1 local vel = Length(GetVelocity(self.Owner)) local pitch = self.Owner:EyeAngles().p if vel == 0 and pitch <= 60 and pitch >= -20 then local sp = self.Owner:GetShootPos() local aim = self.Owner:GetAimVector() td.start = sp td.endpos = td.start + aim * 35 td.filter = self.Owner local tr = util.TraceHull(td) -- fire first trace to check whether there is anything IN FRONT OF US if tr.Hit then -- if there is, don't allow us to deploy return false end aim.z = height td.start = sp td.endpos = td.start + aim * 25 td.filter = self.Owner tr = util.TraceHull(td) if tr.Hit then local ent = tr.Entity -- if the second trace passes, we can deploy if not ent:IsPlayer() and not ent:IsNPC() then return true end end return false end return false end function SWEP:getSpreadModifiers() local mul = 1 local mulMax = 1 -- decrease spread increase when aiming if self.Owner:Crouching() then mul = mul * 0.75 end -- and when a bipod is deployed if self.dt.BipodDeployed then mul = mul * 0.5 mulMax = 0.5 -- decrease maximum spread increase end return mul, mulMax end function SWEP:getFinalSpread(vel, maxMultiplier) maxMultiplier = maxMultiplier or 1 local final = self.BaseCone local aiming = self.dt.State == CW_AIMING -- take the continuous fire spread into account final = final + self.AddSpread -- and the player's velocity * mobility factor if aiming then -- irl the accuracy of your weapon goes to shit when you start moving even if you aim down the sights, so when aiming, player movement will impact the spread even more than it does during hip fire -- but we're gonna clamp it to a maximum of the weapon's hip fire spread, so that even if you aim down the sights and move, your accuracy won't be worse than your hip fire spread final = math.min(final + (vel / 10000 * self.VelocitySensitivity) * self.AimMobilitySpreadMod, self.HipSpread) else final = final + (vel / 10000 * self.VelocitySensitivity) end if self.ShootWhileProne and self:isPlayerProne() then final = final + vel / 1000 end -- as well as the spread caused by rapid mouse movement final = final + self.Owner.ViewAff -- lastly, return the final clamped value return math.Clamp(final, 0, 0.09 + self:getMaxSpreadIncrease(maxMultiplier)) end function SWEP:isNearWall() if not self.NearWallEnabled then return false end td.start = self.Owner:GetShootPos() td.endpos = td.start + self.Owner:EyeAngles():Forward() * 30 td.filter = self.Owner local tr = util.TraceLine(td) if tr.Hit or (IsValid(tr.Entity) and not tr.Entity:IsPlayer()) then return true end return false end function SWEP:performBipodDelay(time) time = time or self.BipodDeployTime local CT = CurTime() self.BipodDelay = CT + time self:SetNextPrimaryFire(CT + time) self:SetNextSecondaryFire(CT + time) self.ReloadWait = CT + time end function SWEP:delayEverything(time) time = time or 0.15 local CT = CurTime() self.BipodDelay = CT + time self:SetNextPrimaryFire(CT + time) self:SetNextSecondaryFire(CT + time) self.ReloadWait = CT + time self.HolsterWait = CT + time end function SWEP:isBipodIdle() if self.dt.BipodDeployed and self.DeployAngle and self.dt.State == CW_IDLE then return true end return false end function SWEP:isBipodDeployed() if self.dt.BipodDeployed then return true end return false end function SWEP:isReloading() if self.ReloadDelay then return true end if (SP and CLIENT) then if self.IsReloading then if self.Cycle < 0.98 then return true end end end return false end function SWEP:canOpenInteractionMenu() if self.dt.State == CW_CUSTOMIZE then return true end if CustomizableWeaponry.callbacks.processCategory(self, "disableInteractionMenu") then return false end if table.Count(self.Attachments) == 0 then return false end if self.ReloadDelay then return false end local CT = CurTime() if CT < self.ReloadWait or CT < self.BipodDelay or self.dt.BipodDeployed then return false end if Length(GetVelocity(self.Owner)) >= self.Owner:GetWalkSpeed() * self.RunStateVelocity then return false end if not self.Owner:OnGround() then return false end return true end function SWEP:setupBipodVars() -- network/predict bipod angles if SP and SERVER then umsg.Start("CW20_DEPLOYANGLE", self.Owner) umsg.Angle(self.Owner:EyeAngles()) umsg.End() else self.DeployAngle = self.Owner:EyeAngles() end -- delay all actions self:performBipodDelay() end function SWEP:canUseComplexTelescopics() if SERVER then return true end if CustomizableWeaponry.callbacks.processCategory(self, "forceComplexTelescopics") then return true end if self:GetClass() == "cw_sci-fi_scout_xbow" then return false end return GetConVarNumber("cw_simple_telescopics") <= 0 end function SWEP:canUseSimpleTelescopics() if not self:canUseComplexTelescopics() and self.SimpleTelescopicsFOV then return true end return false end function SWEP:setGlobalDelay(delay, forceNetwork, forceState, forceTime) if SERVER then if (SP or forceNetwork) then umsg.Start("CW20_GLOBALDELAY", self.Owner) umsg.Float(delay) umsg.End() end if forceState and forceTime then self:forceState(forceState, forceTime, true) end end self.GlobalDelay = CurTime() + delay end function SWEP:forceState(state, time, network) self.forcedState = state self.ForcedStateTime = CurTime() + time if SERVER and network then umsg.Start("CW20_FORCESTATE", self.Owner) umsg.Short(state) umsg.Float(time) umsg.End() end end function SWEP:setupBallisticsInformation() local info = CustomizableWeaponry.ammoTypes[self.Primary.Ammo] if not info then return end self.BulletDiameter = info.bulletDiameter self.CaseLength = info.caseLength end function SWEP:seekPresetPosition(offset) offset = offset or 0 local count = #self.PresetResults if offset > 0 and self.PresetPosition + 10 > count then return end self.PresetPosition = math.Clamp(self.PresetPosition + offset, 1, count) end function SWEP:setPresetPosition(offset, force) offset = offset or 0 if force then self.PresetPosition = math.max(self.PresetPosition, 1) return end local count = #self.PresetResults -- clamp the maximum and minimum position self.PresetPosition = math.Clamp(offset, 1, count) end function SWEP:getDesiredPreset(bind) local desired = bind == "slot0" and 10 or tonumber(string.Right(bind, 1)) local pos = self.PresetPosition + desired return pos end function SWEP:attemptPresetLoad(entry) if not self.PresetResults then return false end entry = entry - 1 local result = self.PresetResults[entry] if not result then return false end CustomizableWeaponry.preset.load(self, result.displayName) return true end function SWEP:getActiveAttachmentInCategory(cat) local category = self.Attachments[cat] if category then if category.last then return category.atts[category.last] end end return nil end function SWEP:getSightColor(data) -- why are you passing nil :( if not data then -- assume it's a sight we're trying to get the color for return CustomizableWeaponry.defaultColors[CustomizableWeaponry.COLOR_TYPE_SIGHT] end local found = self.SightColors[data] if found then return found.color end end -- this function sets up reticle and laser beam colors for all sights/laser sights function SWEP:setupReticleColors() self.SightColors = {} for k, v in ipairs(self.Attachments) do for k2, v2 in ipairs(v.atts) do local foundAtt = CustomizableWeaponry.registeredAttachmentsSKey[v2] if foundAtt then -- if the found attachment has a color type enum, that means it is colorable (wow!) -- therefore, we need to add it to the color table if foundAtt.colorType then local def = CustomizableWeaponry.colorableParts.defaultColors[foundAtt.colorType] self.SightColors[foundAtt.name] = {type = foundAtt.colorType, color = def.color, last = 1, display = CustomizableWeaponry.colorableParts:makeColorDisplayText(def.display)} end end end end end function SWEP:isReloadingM203() if not self.AttachmentModelsVM then return false end local m203 = self.AttachmentModelsVM.md_m203 if m203 and m203.active then if self.curM203Anim == self.M203Anims.reload then if m203.ent:GetCycle() <= 0.9 then return true end end end return false end function SWEP:filterPrediction() if (SP and SERVER) or not SP then return true end return false end function SWEP:getMagCapacity() local mag = self:Clip1() if mag > self.Primary.ClipSize_Orig then return self.Primary.ClipSize_Orig .. " + " .. mag - self.Primary.ClipSize_Orig end return mag end function SWEP:getReloadProgress() if self.IsReloading and self.Cycle <= 0.98 then if self.ShotgunReload then return math.Clamp(math.ceil(self:getAnimSeek() / self.InsertShellTime * 100), 0, 100) else if self.wasEmpty then return math.Clamp(math.ceil(self:getAnimSeek() / self.ReloadHalt_Empty * 100), 0, 100) else return math.Clamp(math.ceil(self:getAnimSeek() / self.ReloadHalt * 100), 0, 100) end end end return nil end function SWEP:isReticleActive() if self.reticleInactivity and UnPredictedCurTime() < self.reticleInactivity then return false end return true end if CLIENT then function SWEP:getReticleAngles() if self.freeAimOn then local ang = self.CW_VM:GetAngles() ang.p = ang.p + self.AimAng.x ang.y = ang.y - self.AimAng.y ang.r = ang.r - self.AimAng.z return ang end return self.Owner:EyeAngles() + self.Owner:GetPunchAngle() end function SWEP:getTelescopeAngles() if self.freeAimOn then return self.Owner:EyeAngles() end return self:getMuzzlePosition().Ang end function SWEP:getLaserAngles(model) --if self.freeAimOn then -- return self.Owner:EyeAngles() --end return model:GetAngles() end end local trans = {["MOUSE1"] = "LEFT MOUSE BUTTON", ["MOUSE2"] = "RIGHT MOUSE BUTTON"} local b, e function SWEP:getKeyBind(bind) b = input.LookupBinding(bind) e = trans[b] return b and ("[" .. (e and e or string.upper(b)) .. "]") or "[NOT BOUND, " .. bind .. "]" end -- GENERAL MATH FUNCS function math.ApproachVector(startValue, endValue, amount) startValue.x = math.Approach(startValue.x, endValue.x, amount) startValue.y = math.Approach(startValue.y, endValue.y, amount) startValue.z = math.Approach(startValue.z, endValue.z, amount) return startValue end function math.NormalizeAngles(ang) ang.p = math.NormalizeAngle(ang.p) ang.y = math.NormalizeAngle(ang.y) ang.r = math.NormalizeAngle(ang.r) return ang end
local subzero = require('subzero') local pgmoon = require("pgmoon") local db_channel = os.getenv('PGRST_DB_CHANNEL') local db_conection_info = { host = os.getenv('DB_HOST'), port = os.getenv('DB_PORT'), database = os.getenv('DB_NAME'), password = os.getenv('DB_PASS'), user = os.getenv('DB_USER'), ssl = true } auto_ssl:init_worker() local function listen_db_schema_change() local db = pgmoon.new(db_conection_info) db:settimeout(1000 * 3600 * 24) -- 1 day while not db:connect() do ngx.sleep(1) end db:query('LISTEN '..db_channel) print('listening on '..db_channel) local message = nil while true do message = db:wait_for_notification() if message then if message.payload == '' then subzero.clear_cache() print('cleared schema cache') end else -- probably a connection timeout subzero.clear_cache() local ok, err = ngx.timer.at(10, listen_db_schema_change) break; end end end local ok, err = ngx.timer.at(0, listen_db_schema_change)
local tiny = require("lib.tiny") local Sand = require "class.Sand" local sandTimer = tiny.processingSystem() sandTimer.filter = tiny.requireAll("sand") function sandTimer:process(e, dt) local absVX = math.abs(e.vx) local absVY = math.abs(e.vy) if absVX > 0 then e.sand = e.sand - dt*(absVX/e.maxSpeed)*0.05 if e.sand < 0 then e.sand = 0 end end -- control the entity spawner if e.entitySpawnEntity then if math.abs(e.vx) == 0 or e.sand == 0 then e.entitySpawnEntity = nil e:refreshECS() end else if math.abs(e.vx) > 0 and e.sand > 0 then e.entitySpawnEntity = Sand e:refreshECS() end end end return sandTimer
local cfg = {} -- illegal items (seize) -- specify list of "idname" or "*idname" to seize all parametric items cfg.seizable_items = { "dirty_money", "weed", "*wbody", "*wammo" } -- fines -- map of name -> money cfg.fines = { ["Insult"] = 100, ["Speeding"] = 250, ["Stealing"] = 1000, ["Organized crime (low)"] = 10000, ["Organized crime (medium)"] = 25000, ["Organized crime (high)"] = 50000 } return cfg
local merge = require('mapx.util').merge local log = require 'mapx.log' local dbgi = log.dbgi local Mapper = { mapopts = { buffer = { buffer = 0 }, nowait = { nowait = true }, silent = { silent = true }, script = { script = true }, expr = { expr = true }, unique = { unique = true }, }, } -- Expands string-based options like "buffer", "silent", "expr" to their -- table-based representation. Also supports <wrapped> strings "<buffer>" -- Returns a new opts table with this expansion applied. local function expandStringOpts(opts) local res = {} for k, v in pairs(opts) do if type(k) == 'number' then if Mapper.mapopts[v] then res[v] = true goto continue end local vsub = type(v) == 'string' and vim.fn.substitute(v, [[^<\|>$]], '', 'g') if vsub and Mapper.mapopts[vsub] ~= nil then res[vsub] = true goto continue end table.insert(res, v) else res[k] = v end ::continue:: end return res end local function extractLabel(opts) local _opts = merge({}, opts) local label if _opts.label ~= nil then label = _opts.label _opts.label = nil return label, _opts end if _opts[#_opts] ~= nil and Mapper.mapopts[_opts[#_opts]] == nil then label = _opts[#_opts] table.remove(_opts, #_opts) return label, _opts end return nil, _opts end function Mapper.new() local self = { config = {}, luaFuncs = {}, filetypeMaps = {}, groupOpts = {}, whichkey = nil, } vim.cmd [[ augroup mapx_mapper autocmd! autocmd FileType * lua require'mapx'.mapper:filetype(vim.fn.expand('<amatch>'), vim.fn.expand('<abuf>')) augroup END ]] return setmetatable(self, { __index = Mapper }) end function Mapper:setup(config) self.config = merge(self.config, config) if self.config.whichkey then local ok, wk = pcall(require, 'which-key') if not ok then error 'mapx.Map:setup: config.whichkey == true but module "which-key" not found' end self.whichkey = wk end dbgi('mapx.Map:setup', self) return self end function Mapper:filetypeMap(fts, fn) dbgi('Map.filetype', { fts = fts, fn = fn }) if type(fts) ~= 'table' then fts = { fts } end for _, ft in ipairs(fts) do if self.filetypeMaps[ft] == nil then self.filetypeMaps[ft] = {} end table.insert(self.filetypeMaps[ft], fn) end dbgi('mapx.Map.filetypeMaps insert', self.filetypeMaps) end function Mapper:filetype(ft, buf, ...) local filetypeMaps = self.filetypeMaps[ft] dbgi('mapx.Map:handleFiletype', { ft = ft, ftMaps = filetypeMaps, rest = { ... } }) if filetypeMaps == nil then return end for _, fn in ipairs(filetypeMaps) do fn(buf, ...) end end function Mapper:func(id, ...) local fn = self.luaFuncs[id] if fn == nil then return end return fn(...) end function Mapper:registerMap(mode, lhs, rhs, opts, wkopts, label) if label then if self.whichkey then local regval = { [lhs] = { rhs, label } } local regopts = merge({ mode = mode ~= '' and mode or nil, }, wkopts) regopts.silent = regopts.silent ~= nil and regopts.silent or false dbgi('Mapper:registerMap (whichkey)', { mode = mode, regval = regval, regopts = regopts }) self.whichkey.register(regval, regopts) end elseif opts.buffer then local bopts = merge({}, opts) bopts.buffer = nil dbgi('Mapper:registerMap (buffer)', { mode = mode, lhs = lhs, rhs = rhs, opts = opts, bopts = bopts }) vim.api.nvim_buf_set_keymap(opts.buffer, mode, lhs, rhs, bopts) else dbgi('Mapper:registerMap', { mode = mode, lhs = lhs, rhs = rhs, opts = opts }) vim.api.nvim_set_keymap(mode, lhs, rhs, opts) end end function Mapper:registerName(mode, lhs, opts) if opts.name == nil then error 'mapx.name: missing name' end if self.whichkey then local reg = { [lhs] = { name = opts.name, }, } local regopts = merge { buffer = opts.buffer or nil, mode = mode ~= '' and mode or nil, } dbgi('Mapper:registerName', { mode = mode, reg = reg, regopts = regopts }) self.whichkey.register(reg, regopts) end end function Mapper:register(config, lhss, rhs, ...) if type(config) ~= 'table' then config = { mode = config, type = 'map' } end local opts = merge(self.groupOpts, ...) local ft = opts.filetype or opts.ft if ft ~= nil then opts.ft = nil opts.filetype = nil self:filetypeMap(ft, function(buf) opts.buffer = opts.buffer or buf self:register(config, lhss, rhs, opts) end) return end opts = expandStringOpts(opts) local label local wkopts if opts.buffer == true then opts.buffer = 0 end if self.whichkey ~= nil then label, wkopts = extractLabel(opts) end if type(lhss) ~= 'table' then lhss = { lhss } end if type(rhs) == 'function' then -- TODO: rhs gets inserted multiple times if a filetype mapping is -- triggered multiple times table.insert(self.luaFuncs, rhs) dbgi('state.funcs insert', { luaFuncs = self.luaFuncs }) local luaexpr = "require'mapx'.mapper:func(" .. #self.luaFuncs .. ', vim.v.count)' if opts.expr then rhs = 'luaeval("' .. luaexpr .. '")' else rhs = '<Cmd>lua ' .. luaexpr .. '<Cr>' end end for _, lhs in ipairs(lhss) do if config.type == 'map' then self:registerMap(config.mode, lhs, rhs, opts, wkopts, label) elseif config.type == 'name' then self:registerName(config.mode, lhs, opts) end end end function Mapper:group(...) local prevOpts = self.groupOpts local fn local args = { ... } for i, v in ipairs(args) do if i < #args then self.groupOpts = merge(self.groupOpts, v) else fn = v end end self.groupOpts = expandStringOpts(self.groupOpts) dbgi('group', self.groupOpts) local label = extractLabel(self.groupOpts) if label ~= nil then error('mapx.group: cannot set label on group: ' .. tostring(label)) end fn() self.groupOpts = prevOpts end return Mapper
ardour { ["type"] = "EditorAction", name = "Trim end at mouse", license = "MIT", author = "David Healey", description = [[Trims the end of the region under the mouse]] } function factory () return function () Editor:access_action ("Editor", "set-playhead") -- move cursor Editor:access_action ("Region", "trim-back") -- trim region end end end
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' client_script "driftcounter_c.lua" server_script "driftcounter_s.lua" files { 'stats.xml' } data_file 'MP_STATS_DISPLAY_LIST_FILE' 'stats.xml' dependency 'es_extended'
-------------------------------------------------------------------------- -- This module controls the pager. There are two ways to use the pager. -- If stderr is connected to a term and it is configured for it, stderr -- will be run through the pager. If not bypassPager is used which just -- writes all strings to the stream "f". -- @module pager require("strict") -------------------------------------------------------------------------- -- Lmod License -------------------------------------------------------------------------- -- -- Lmod is licensed under the terms of the MIT license reproduced below. -- This means that Lmod is free software and can be used for both academic -- and commercial purposes at absolutely no cost. -- -- ---------------------------------------------------------------------- -- -- Copyright (C) 2008-2018 Robert McLay -- -- 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. -- -------------------------------------------------------------------------- require("myGlobals") require("haveTermSupport") local dbg = require("Dbg"):dbg() local concatTbl = table.concat local cosmic = require("Cosmic"):singleton() local function argsPack(...) local argA = { n = select("#", ...), ...} return argA end local pack = (_VERSION == "Lua 5.1") and argsPack or table.pack -- luacheck: compat s_pager = false -------------------------------------------------------------------------- -- All input arguments to stream f -- @param f A stream object. function bypassPager(f, ...) local argA = pack(...) for i = 1, argA.n do f:write(argA[i]) end end -------------------------------------------------------------------------- -- Use pager to present input arguments to user via whatever -- pager has been chosen. -- @param f A stream object. function usePager(f, ...) dbg.start{"usePager()"} s_pager = "LESS="..cosmic:value("LMOD_PAGER_OPTS").." "..s_pager local p = io.popen(s_pager .. " 1>&2" ,"w") local s = concatTbl({...},"") p:write(s) p:close() dbg.fini() end -------------------------------------------------------------------------- -- Return usePager if PAGER exists otherwise, return bypassPager function buildPager() local func = bypassPager local pager = cosmic:value("LMOD_PAGER") s_pager = find_exec_path(pager) if (s_pager) then func = usePager end return func end pager = bypassPager if (connected2Term()) then pager = buildPager() end
workspace "Lemon-Engine" architecture "x64" configurations { "Debug", "Release", "Dist" } filter "system:windows" startproject "Sandbox" outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" IncludeDir = {} IncludeDir["GLFW"] = "Lemon/vendor/glfw/include" IncludeDir["Glad"] = "Lemon/vendor/glad/include" IncludeDir["glm"] = "Lemon/vendor/glm" IncludeDir["stb_image"] = "Lemon/vendor/stb/include" IncludeDir["spdlog"] = "Lemon/vendor/spdlog/include" IncludeDir["debugbreak"] = "Lemon/vendor/debug" group "Dependencies" include "Lemon/vendor/glfw" include "Lemon/vendor/glad" group "" project "Lemon" location "Lemon" kind "StaticLib" language "C++" cppdialect "C++17" staticruntime "on" targetdir ("bin/" .. outputdir .. "/%{prj.name}") objdir ("bin-int/" .. outputdir .. "/%{prj.name}") pchheader "lmpch.h" pchsource "Lemon/src/lmpch.cpp" files { "%{prj.name}/src/**.h", "%{prj.name}/src/**.cpp", "%{prj.name}/vendor/stb/include/**.h", "%{prj.name}/vendor/stb/include/**.cpp", "%{prj.name}/vendor/glm/glm/**.hpp", "%{prj.name}/vendor/glm/glm/**.inl", } includedirs { "%{prj.name}/src", "%{IncludeDir.GLFW}", "%{IncludeDir.Glad}", "%{IncludeDir.glm}", "%{IncludeDir.stb_image}", "%{IncludeDir.spdlog}", "%{IncludeDir.debugbreak}" } filter "system:windows" systemversion "latest" defines { "LM_BUILD_DLL", "LM_PLATFORM_WINDOWS" } --postbuildcommands --{ -- ("{COPY} ./Resources ../bin/" .. outputdir .. "/%{prj.name}/") --} links { "GLFW", "Glad", "opengl32.lib" } filter "system:linux" systemversion "latest" defines { "LM_BUILD_DLL", "LM_PLATFORM_LINUX" } links { "GLFW", "Glad", "GL", "X11", "pthread", "Xrandr", "Xi", "dl" } --postbuildcommands --{ -- ("{COPY} ./Resources ../bin/" .. outputdir .. "/%{prj.name}/") --} filter "configurations:Debug" defines { "LM_DEBUG", "LM_ENABLE_ASSERTS" } symbols "On" filter "configurations:Release" defines "LM_RELEASE" optimize "On" filter "configurations:Dist" defines "LM_DIST" optimize "On" project "Sandbox" location "Sandbox" kind "ConsoleApp" language "C++" cppdialect "C++17" staticruntime "on" targetdir ("bin/" .. outputdir .. "/%{prj.name}") objdir ("bin-int/" .. outputdir .. "/%{prj.name}") pchheader "lmpch.h" pchsource "Lemon/src/lmpch.cpp" files { "%{prj.name}/src/**.h", "%{prj.name}/src/**.cpp" } includedirs { "%{prj.name}/src", "%{IncludeDir.GLFW}", "%{IncludeDir.Glad}", "%{IncludeDir.glm}", "%{IncludeDir.stb_image}", "%{IncludeDir.spdlog}", "Lemon/src", "%{IncludeDir.debugbreak}" } links { "Lemon" } filter "system:windows" systemversion "latest" defines { "LM_PLATFORM_WINDOWS" } --postbuildcommands --{ -- ("{COPY} ./Resources ../bin/" .. outputdir .. "/%{prj.name}/") --} links { "GLFW", "Glad", "opengl32.lib" } filter "system:linux" systemversion "latest" defines { "LM_PLATFORM_LINUX" } links { "GLFW", "Glad", "GL", "X11", "pthread", "Xrandr", "Xi", "dl" } --postbuildcommands --{ -- ("{COPY} ./Resources ../bin/" .. outputdir .. "/%{prj.name}/") --} filter "configurations:Debug" defines { "LM_DEBUG", "LM_ENABLE_ASSERTS" } symbols "On" filter "configurations:Release" defines "LM_RELEASE" optimize "On" filter "configurations:Dist" defines "LM_DIST" optimize "On"
-- File: Test.lua function onInit() --print("Hello world") end function onDeviceStateChanged(device, state, stateValue) local timestamp = os.date("%Y-%m-%d %H:%M:%S") if stateValue == nil or stateValue=="" then print('{"type":"device","time":"'..timestamp..'","event":"state","id":'..device:id()..',"state":'..state..',"name":"'..device:name()..'"}') else print('{"type":"device","time":"'..timestamp..'","event":"state","id":'..device:id()..',"state":'..state..',"stateValue":"'..stateValue..',"name":"'..device:name()..'"}') end end function onSensorValueUpdated(device, valueType, value, scale) local timestamp = os.date("%Y-%m-%d %H:%M:%S") print('{"type":"sensor","time":"'..timestamp..'","event":"value","id":'..device:id()..',"valueType":'..valueType..',"value":'..value..',"scale":'..scale..',"name":"'..device:name()..'"}') end
local cached = require "meiru.db.cached" local config = require "config" local exports = {} local kMSeparator = '^_^@T_T' local function makePerDayLimiter(identityName, identityFn) return function(name, limitCount, options) return function(req, res) local identity = identityFn(req) local dkey = os.date("%Y%m%d") local key = dkey ..kMSeparator ..identityName ..kMSeparator ..name ..kMSeparator ..identity local count = tonumber(cached.get(key)) or 0 if count < limitCount then count = count+1 cached.set(key, count, 60 * 60 * 24) res.set('X-RateLimit-Limit', limitCount) res.set('X-RateLimit-Remaining', limitCount - count) else res.status(403) if options.showJson then res.send({success = false, error_msg = '频率限制:当前操作每天可以进行 '..limitCount..' 次'}) return true else res.render('notify/notify', {the_error = '频率限制:当前操作每天可以进行 '..limitCount..' 次'}) return true end end end end end exports.peruserperday = makePerDayLimiter('peruserperday', function(req) if not req.session or not req.session.user then error('should provide `x-real-ip` header') end return req.session.user.loginname end) exports.peripperday = makePerDayLimiter('peripperday', function(req) local realIP = req.ip if not realIP and not config.debug then error('should provide `x-real-ip` header') end return realIP end) return exports
require('lsp.null_ls') local map_opts = { noremap = true, silent = true } local icons = require('lsp.icons') local lsp_capabilities = vim.lsp.protocol.make_client_capabilities() local completion_capabilities = require('cmp_nvim_lsp').update_capabilities(lsp_capabilities) vim.api.nvim_set_keymap('n',']g','<cmd>lua vim.diagnostic.goto_next()<CR>',map_opts) vim.api.nvim_set_keymap('n','[g','<cmd>lua vim.diagnostic.goto_prev()<CR>',map_opts) vim.api.nvim_set_keymap('n','<leader>da','<cmd>lua vim.diagnostic.setqflist()<CR>',map_opts) vim.api.nvim_set_keymap('n','<leader>db','<cmd>lua vim.diagnostic.setloclist()<CR>',map_opts) -- Set up LSP configurations local shared_config = { capabilities = completion_capabilities, on_attach = (function(_, buffer_num) local function map(...) vim.api.nvim_buf_set_keymap(buffer_num, ...) end map('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', map_opts) map('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', map_opts) map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', map_opts) map('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', map_opts) map('n', '<leader>kk>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', map_opts) -- clashes with line move up and down map('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', map_opts) map('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', map_opts) map('n', '<leader>aa', '<cmd>lua vim.lsp.buf.code_action()<CR>', map_opts) map('n', '<leader>R', '<cmd>lua vim.lsp.buf.references()<CR>', map_opts) map('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', map_opts) for i, kind in ipairs(vim.lsp.protocol.CompletionItemKind) do vim.lsp.protocol.CompletionItemKind[i] = icons[kind] or kind end end), flags = { debounce_text_changes = 250, }, } local lspconfig = require('lspconfig') local servers = { 'sumneko_lua', 'rnix', 'ccls', 'texlab', 'bashls', 'pyright', 'sqls' , 'hls','tsserver'} -- Apply server-specific config from lsp dir for _, server in ipairs(servers) do local ok, module = pcall(require, 'lsp.servers.' .. server) if not ok then module = {} end local updated_module = {} if module.on_attach then updated_module.on_attach = function (client,bufnr) shared_config.on_attach(client,bufnr) module.on_attach(client,bufnr) end else updated_module = module end lspconfig[server].setup(vim.tbl_deep_extend('force', shared_config, updated_module)) end -- Show LSP diagnostics in virtual lines require('lsp_lines').register_lsp_virtual_lines() vim.diagnostic.config({ virtual_lines = false, virtual_text = true, signs = true, underline = true, update_in_insert = false, severity_sort = true }) -- Highlight line number instead of having icons in sign columns vim.fn.sign_define("DiagnosticSignError", { text = "", numhl = "DiagnosticSignError" }) vim.fn.sign_define("DiagnosticSignWarning", { text = "", numhl = "DiagnosticSignWarning" }) vim.fn.sign_define("DiagnosticSignInformation", { text = "", numhl = "DiagnosticSignInformation" }) vim.fn.sign_define("DiagnosticSignHint", { text = "", numhl = "DiagnosticSignHint" })
function start() if component.invoke(computer.getBootAddress(), "isReadOnly") or (kernel.modules.special and kernel.modules.special.roroot) then local cow = kernel.modules.cowfs.new(computer.getBootAddress(), computer.tmpAddress()) kernel.modules.vfs.mount(cow, "/") else kernel.modules.vfs.mount(computer.getBootAddress(), "/") end kernel.modules.vfs.mount(computer.tmpAddress(), "/tmp") end
monsterpedia = {} function monsterpedia:enter(previous,selectMonster) self.previous = previous monsterpedia.list = {} monsterpedia.positions = {} monsterpedia.scroll = 0 self.rightScroll=0 self.rightYmax=0 self.cursorY = 2 self.maxSeen=0 totalstats.creature_kills = totalstats.creature_kills or {} for i=0,10,1 do monsterpedia.list[i] = {} end for monster,m in pairs(possibleMonsters) do if totalstats.creature_kills[monster] then local creat = possibleMonsters[monster] if creat then monsterpedia.list[creat.level] = (monsterpedia.list[creat.level] or {}) if monsterpedia.list[creat.level] then monsterpedia.list[creat.level][#monsterpedia.list[creat.level]+1] = monster end end end end --end monsters for for i,v in pairs(monsterpedia.list) do --remove empty level labels if count(v) == 0 then monsterpedia.list[i] = nil end end --Store a second table of positions, for when the player is browsing local lineSize = math.max(output:get_tile_size(),prefs['fontSize'],prefs['asciiSize']) local printY = lineSize*2 for level, monsters in pairs (monsterpedia.list) do --loop through levels monsterpedia.positions[#monsterpedia.positions+1] = {id=-1,startY=printY,endY=printY+lineSize,level=level} printY=printY+lineSize for _, id in pairs (monsters) do --loop through monsters within levels local _, tlines = fonts.textFont:getWrap(possibleMonsters[id].name,322) monsterpedia.positions[#monsterpedia.positions+1] = {id=id,startY=printY,endY=printY+#tlines*lineSize} printY=printY+#tlines*lineSize if selectMonster == id then self.cursorY = #monsterpedia.positions self.forceScroll = true end end --end monster level list pair for end --end monsterpedia.list for self.yModPerc = 100 tween(0.2,self,{yModPerc=0}) output:sound('stoneslideshort',2) end function monsterpedia:leave() output:setCursor(0,0) end function monsterpedia:draw() local width, height = love.graphics:getWidth(),love.graphics:getHeight() self.previous:draw() love.graphics.push() love.graphics.translate(0,height*(self.yModPerc/100)) --Draw the actual Monsterpedia: local tileSize = output:get_tile_size() love.graphics.setFont(fonts.textFont) if (prefs['noImages'] ~= true) then --Borders for select: for x=32,388,32 do love.graphics.draw(images.borders.borderImg,images.borders.u,x,0) love.graphics.draw(images.borders.borderImg,images.borders.d,x,height-32) end for y=32,height-36,32 do love.graphics.draw(images.borders.borderImg,images.borders.l,0,y) love.graphics.draw(images.borders.borderImg,images.borders.r,400,y) end love.graphics.draw(images.borders.borderImg,images.borders.ul,0,0) love.graphics.draw(images.borders.borderImg,images.borders.ur,400,0) love.graphics.draw(images.borders.borderImg,images.borders.ll,0,height-32) love.graphics.draw(images.borders.borderImg,images.borders.lr,400,height-32) --Borders for info panel: for x=452,width-36,32 do love.graphics.draw(images.borders.borderImg,images.borders.u,x,0) love.graphics.draw(images.borders.borderImg,images.borders.d,x,height-32) end for y=32,height-36,32 do love.graphics.draw(images.borders.borderImg,images.borders.l,432,y) love.graphics.draw(images.borders.borderImg,images.borders.r,width-32,y) end love.graphics.draw(images.borders.borderImg,images.borders.ul,432,0) love.graphics.draw(images.borders.borderImg,images.borders.ur,width-32,0) love.graphics.draw(images.borders.borderImg,images.borders.ll,432,height-32) love.graphics.draw(images.borders.borderImg,images.borders.lr,width-32,height-32) --Draw inner coloring: setColor(44,44,44,225) love.graphics.rectangle("fill",18,18,396,height-36) love.graphics.rectangle("fill",450,18,width-468,height-36) setColor(255,255,255,255) else --no images setColor(20,20,20,225) love.graphics.rectangle("fill",18,18,396,height-36) love.graphics.rectangle("fill",450,18,width-468,height-36) setColor(255,255,255,255) love.graphics.rectangle("line",14,14,400,height-30) love.graphics.rectangle("line",450,14,width-465,height-30) end love.graphics.printf("Monsterpedia",14,24,400,"center") local lineSize = math.max(tileSize,prefs['fontSize'],prefs['asciiSize']) local seenCount = 0 for pid, monster in pairs(monsterpedia.positions) do local printY = monster.startY-monsterpedia.scroll*lineSize if printY+lineSize < height-32 and printY > 32 then --don't display if you'll go off the screen if monster.id == -1 then love.graphics.printf("Level " .. monster.level,14,printY,400,"center") --only display if it hasn't been upscrolled else seenCount = seenCount+1 local id = monster.id local creat = possibleMonsters[id] creat.image_frame = 1 if creat then if printY+lineSize > height-30 then break end if creat.id == nil then creat.id = id end creat.baseType = 'creature' if id == monsterpedia.positions[self.cursorY].id then --if it's the selected creature local rectPad = math.ceil(tileSize/3) setColor(100,100,100,255) if prefs['noImages'] == true then love.graphics.rectangle("fill",15,printY+rectPad,373,monster.endY-monster.startY) else love.graphics.rectangle("fill",18,printY+rectPad,364,monster.endY-monster.startY) end setColor(255,255,255,255) end output.display_entity(creat,20,printY+10,"force") setColor(255,255,255,255) if prefs['noImages'] == true then love.graphics.printf(ucfirst(creat.name),36,2+printY,322,"left") else love.graphics.printf(ucfirst(creat.name),56,printY+8,322,"left") end end --end if creat if end --end if -1 end --end printing on screen if end --end levelgroup for local totalMonsters = count(monsterpedia.positions) self.maxSeen = seenCount if totalMonsters > self.maxSeen then self.maxScroll = totalMonsters-math.ceil(self.maxSeen/2) local scrollAmt = monsterpedia.scroll/self.maxScroll if prefs['noImages'] then monsterpedia.scrollPositions = output:scrollbar(388,16,height-34,scrollAmt) else monsterpedia.scrollPositions = output:scrollbar(388,16,height-16,scrollAmt) end end -- Display the selected monster: love.graphics.push() --Right side scrollbar: if self.rightYmax > 0 then local scrollAmt = self.rightScroll/self.rightYmax if scrollAmt > 1 then scrollAmt = 1 end self.rightScrollPositions = output:scrollbar(math.floor(width)-48,16,math.floor(height)-(prefs['noImages'] and 24 or 16),scrollAmt,true) end --Create a "stencil" that stops local function stencilFunc() love.graphics.rectangle("fill",416,16,width-432,height-32) end love.graphics.stencil(stencilFunc,"replace",1) love.graphics.setStencilTest("greater",0) love.graphics.translate(0,-self.rightScroll) local pos = monsterpedia.positions[self.cursorY] and monsterpedia.positions[self.cursorY].id if (pos ~= nil and pos ~= -1) then local scrollPad = (self.rightScrollPositions and 24 or 0) local id = pos local creat = possibleMonsters[id] local fontSize = prefs['fontSize'] local start = 24 setColor(255,255,255,255) love.graphics.printf(ucfirst(creat.name),450,start,(width-460-scrollPad),"center") love.graphics.printf("Level " .. creat.level,450,start+fontSize,(width-460-scrollPad),"center") local types = "" for _,ctype in pairs((creat.types or {})) do if types ~= "" then types = types .. ", " .. ucfirst(ctype) else types = ucfirst(ctype) end end love.graphics.printf(types,450,start+fontSize*2,(width-460-scrollPad),"center") local _,tlines = fonts.textFont:getWrap(types,(width-460-scrollPad)) start = start + #tlines*fontSize love.graphics.printf(creat.description,455,start+fontSize*2,(width-475-scrollPad),"left") _,tlines = fonts.textFont:getWrap(creat.description,(width-475-scrollPad)) local statStart = (start+fontSize*2)+((#tlines+2)*fontSize) local text = "Max HP: " .. creat.max_hp if creat.max_mp then text = text .. "\nMax MP: " .. creat.max_mp end text = text .. "\nDamage: " .. creat.strength .. " (" .. (creat.critical_damage and (creat.strength+creat.critical_damage) or math.ceil(creat.strength * 1.5)) .. " damage on critical hit, " .. (creat.critical_chance or 1) .. "% chance)" text = text .. "\nMelee Skill: " .. creat.melee .. " (" .. math.ceil(math.min(math.max(70 + (creat.melee - creat.level*5-5),25),95)) .. "% chance to hit average level " .. creat.level .. " creature)" if creat.ranged then text = text .. "\nRanged Skill: " .. creat.ranged end if creat.magic then text = text .. "\nMagic Skill: " .. creat.magic end text = text .. "\nDodge Skill: " .. creat.dodging .. " (" .. math.ceil(math.min(math.max(70 + (5+creat.level*5 - creat.dodging),25),95)) .. "% chance to be hit by average level " .. creat.level .. " creature)" if creat.armor then text = text .. "\nDamage Absorption: " .. creat.armor end text = text .. "\nSight Radius: " .. creat.perception if creat.ranged_attack then text = text .. "\nRanged Attack: " .. rangedAttacks[creat.ranged_attack].name end if creat.weaknesses then local weakstring = "\nWeaknesses: " local first = true for dtype,amt in pairs(creat.weaknesses) do weakstring = weakstring .. (not first and ", " or "") .. ucfirst(dtype) .. " " .. amt .. "%" first = false end text = text .. weakstring end --end weaknesses if creat.resistances then local resiststring = "\nResistances: " local first = true for dtype,amt in pairs(creat.resistances) do resiststring = resiststring .. (not first and ", " or "") .. ucfirst(dtype) .. " " .. amt .. "%" first = false end text = text .. resiststring end --end weaknesses love.graphics.printf(text,455,statStart,(width-475-scrollPad),"left") _,tlines = fonts.textFont:getWrap(text,(width-475-scrollPad)) local printY = statStart+(#tlines+1)*fontSize printY=math.max(350,printY+fontSize*2) love.graphics.printf("Special Abilities:",450,printY,(width-460-scrollPad),"center") printY=printY+fontSize local abilities = "" if (creat.spells) then local i = 1 for id, ability in pairs(creat.spells) do if (i > 1) then abilities = abilities .. "\n" end abilities = abilities .. possibleSpells[ability].name .. (possibleSpells[ability].target_type == "passive" and " (Passive)" or "") .. " - " .. possibleSpells[ability].description i = i + 1 end love.graphics.printf(abilities,455,printY,(width-475-scrollPad),"left") printY = printY+fontSize*i else abilities = "None" love.graphics.printf(abilities,450,printY,(width-460-scrollPad),"center") end _,tlines = fonts.textFont:getWrap(abilities,(width-475-scrollPad)) printY = printY+(#tlines)*fontSize if creat.hit_conditions then printY=printY+fontSize love.graphics.printf("Hit Conditions:",450,printY,(width-460-scrollPad),"center") printY=printY+fontSize local context = "" local i = 1 if creat.hit_conditions then for _, condition in pairs(creat.hit_conditions) do if (i > 1) then context = context .. "; " end context = context .. conditions[condition.condition].name .. ": " if condition.chance then context = context .. condition.chance .. "% Chance" .. (condition.crit_chance and ", " or "") end if condition.crit_chance then context = context .. condition.crit_chance .. "% Chance on a Critical Hit" end i = i + 1 end end love.graphics.printf(context,450,printY,(width-460-scrollPad),"center") printY=printY+fontSize*2 end local statText = "" if totalstats.creature_possessions and totalstats.creature_possessions[id] then statText = statText .. ucfirst(creat.name) .. " possessions: " .. totalstats.creature_possessions[id] .. "\n" end if totalstats.exploded_creatures and totalstats.exploded_creatures[id] then statText = statText .. ucfirst(creat.name) .. " explosions: " .. totalstats.exploded_creatures[id] .. "\n" end if totalstats.creature_kills and totalstats.creature_kills[id] then statText = statText .. ucfirst(creat.name) .. "s killed: " .. totalstats.creature_kills[id] .. "\n" end if totalstats.creature_kills_by_ally and totalstats.creature_kills_by_ally[id] then statText = statText .. ucfirst(creat.name) .. "s killed by allies: " .. totalstats.creature_kills_by_ally[id] .. "\n" end if totalstats.turns_as_creature and totalstats.turns_as_creature[id] then statText = statText .. "Turns as " .. creat.name .. ": " .. totalstats.turns_as_creature[id] .. "\n" end if totalstats.kills_as_creature and totalstats.kills_as_creature[id] then statText = statText .. "Kills as " .. creat.name .. ": " .. totalstats.kills_as_creature[id] .. "\n" end if totalstats.deaths_as_creature and totalstats.deaths_as_creature[id] then statText = statText .. "Deaths as " .. creat.name .. ": " .. totalstats.deaths_as_creature[id] .. "\n" end if totalstats.ally_kills_as_creature and totalstats.ally_kills_as_creature[id] then statText = statText .. "Kills made by allies as " .. creat.name .. ": " .. totalstats.ally_kills_as_creature[id] .. "\n" end if totalstats.allied_creature_kills and totalstats.allied_creature_kills[id] then statText = statText .. "Kills made by allied " .. creat.name .. "s: " .. totalstats.allied_creature_kills[id] .. "\n" end if totalstats.creature_ally_deaths and totalstats.creature_ally_deaths[id] then statText = statText .. 'Allied ' .. creat.name .. " deaths: " .. totalstats.creature_ally_deaths[id] .. "\n" end if totalstats.ally_deaths_as_creature and totalstats.ally_deaths_as_creature[id] then statText = statText .. 'Ally deaths as ' .. creat.name .. ": " .. totalstats.ally_deaths_as_creature[id] .. "\n" end love.graphics.printf(statText,455,printY,(width-475-scrollPad),"left") _,tlines = fonts.textFont:getWrap(statText,(width-475-scrollPad)) printY = printY+(#tlines+1)*fontSize self.rightYmax = printY+fontSize-love.graphics:getHeight() love.graphics.setStencilTest() love.graphics.pop() end self.closebutton = output:closebutton(24,24) love.graphics.pop() end function monsterpedia:keypressed(key) local lineSize = math.max(output:get_tile_size(),prefs['fontSize'],prefs['asciiSize']) key = input:parse_key(key) if (key == "north") then self.cursorY = self.cursorY - 1 self.rightScroll = 0 if monsterpedia.positions[self.cursorY].id == -1 then --if you're on a label self.cursorY = math.max(1,self.cursorY - 1) --just go to the next place end while self.positions[self.cursorY].startY-monsterpedia.scroll*lineSize < lineSize*2 and monsterpedia.scroll>0 do --if you select past the top of the screen and have scrolled down, scroll back up monsterpedia:scrollUp() end if self.cursorY < 1 then self.cursorY = 1 end --if, after all that, the cursor is offscreen, move it back down elseif (key == "south") then if monsterpedia.positions[self.cursorY+1] and monsterpedia.positions[self.cursorY+1].id then self.cursorY = self.cursorY + 1 self.rightScroll = 0 end if monsterpedia.positions[self.cursorY].id == -1 then --if you're on a label self.cursorY = math.min(self.cursorY + 1,#self.positions) --just go to the next place end while self.positions[self.cursorY].endY-monsterpedia.scroll*lineSize > love.graphics.getHeight()-32 do monsterpedia:scrollDown() end elseif (key == "escape") then self:switchBack() return end end function monsterpedia:update(dt) if self.switchNow == true then self.switchNow = nil Gamestate.switch(self.previous) Gamestate.update(dt) return end local x,y = love.mouse.getPosition() local tileSize = output:get_tile_size() local lineSize = math.max(tileSize,prefs['fontSize'],prefs['asciiSize']) if x~=output.mouseX or y~=output.mouseY then output.mouseX = x output.mouseY = y y = y+monsterpedia.scroll*lineSize local listY = 0 if (prefs['noImages'] ~= true and x>32 and x<388) or (prefs['noImages'] and x < 435 and x > 14) then for id,pos in ipairs(monsterpedia.positions) do if y > pos.startY and y < pos.endY then listY = id end end end --end images if if listY ~= 0 then if math.floor(listY) ~= self.cursorY and monsterpedia.positions[listY].id ~= -1 then self.rightScroll = 0 self.cursorY=math.floor(listY) end end end --Handle scrolling: if (love.mouse.isDown(1) and monsterpedia.scrollPositions) then local upArrow = monsterpedia.scrollPositions.upArrow local downArrow = monsterpedia.scrollPositions.downArrow local elevator = monsterpedia.scrollPositions.elevator if x>upArrow.startX and x<upArrow.endX and y>upArrow.startY and y<upArrow.endY then monsterpedia:scrollUp() elseif x>downArrow.startX and x<downArrow.endX and y>downArrow.startY and y<downArrow.endY then monsterpedia:scrollDown() elseif x>elevator.startX and x<elevator.endX and y>upArrow.endY and y<downArrow.startY then if y<elevator.startY then monsterpedia:scrollUp() elseif y>elevator.endY then monsterpedia:scrollDown() end end --end clicking on arrow end if (love.mouse.isDown(1) and monsterpedia.rightScrollPositions) then local upArrow = monsterpedia.rightScrollPositions.upArrow local downArrow = monsterpedia.rightScrollPositions.downArrow local elevator = monsterpedia.rightScrollPositions.elevator if x>upArrow.startX and x<upArrow.endX and y>upArrow.startY and y<upArrow.endY then monsterpedia:scrollUp(true) elseif x>downArrow.startX and x<downArrow.endX and y>downArrow.startY and y<downArrow.endY then monsterpedia:scrollDown(true) elseif x>elevator.startX and x<elevator.endX and y>upArrow.endY and y<downArrow.startY then if y<elevator.startY then monsterpedia:scrollUp(true) elseif y>elevator.endY then monsterpedia:scrollDown(true) end end --end clicking on arrow end --Put the cursor back where it belongs: if #monsterpedia.positions ~= 0 then while self.cursorY > #monsterpedia.positions do --if you're scrolled too far, scroll up self.cursorY = self.cursorY-1 end if self.cursorY == 1 and monsterpedia.scroll == 0 then self.cursorY = 2 end if self.cursorY < 1 then self.cursorY = self.cursorY+1 if monsterpedia.positions[self.cursorY].id == -1 then --if you're on a label self.cursorY = self.cursorY + 1 --just go to the next place end end if monsterpedia.positions[self.cursorY].endY-monsterpedia.scroll*lineSize > love.graphics.getHeight()-32 then if self.forceScroll then if self.maxScroll then --just skip it the first frame while max scroll hasn't been created yet while monsterpedia.positions[self.cursorY].endY-monsterpedia.scroll*lineSize > love.graphics.getHeight()-32 do self:scrollDown() end self.forceScroll = nil end else self.cursorY = self.cursorY-1 if monsterpedia.positions[self.cursorY].id == -1 then --if you're on a label self.cursorY = self.cursorY - 1 --just go to the next place end end elseif monsterpedia.positions[self.cursorY].startY-monsterpedia.scroll*lineSize < lineSize*2 then self.cursorY = self.cursorY+1 if monsterpedia.positions[self.cursorY].id == -1 then --if you're on a label self.cursorY = self.cursorY + 1 --just go to the next place end end end end function monsterpedia:wheelmoved(x,y) local right = false local mouseX = love.mouse.getX() if mouseX > 432 then right = true end if y > 0 then monsterpedia:scrollUp(right) elseif y < 0 then monsterpedia:scrollDown(right) end end function monsterpedia:scrollUp(right) if not right and monsterpedia.scroll > 0 then monsterpedia.scroll = monsterpedia.scroll - 1 elseif right and self.rightScroll > 0 then monsterpedia.rightScroll = monsterpedia.rightScroll - prefs['fontSize'] end end function monsterpedia:scrollDown(right) if not right and #monsterpedia.positions ~= 0 and monsterpedia.scroll < self.maxScroll then monsterpedia.scroll = monsterpedia.scroll + 1 elseif right and self.rightScroll < self.rightYmax then monsterpedia.rightScroll = monsterpedia.rightScroll + prefs['fontSize'] end end function monsterpedia:mousepressed(x,y,button) if button == 2 or (x > self.closebutton.minX and x < self.closebutton.maxX and y > self.closebutton.minY and y < self.closebutton.maxY) then self:switchBack() end end function monsterpedia:switchBack() tween(0.2,self,{yModPerc=100}) output:sound('stoneslideshortbackwards',2) Timer.after(0.2,function() self.switchNow=true end) end
local event = {} local HANDLER_PREFIX = 'on' local DEFAULT_HANDLER = 'onEvent' function event.getHandlerFor(eventName) return HANDLER_PREFIX..eventName end function event.isListener(listener) -- Tests if the value provided is a table with one or more -- listener functions if type(listener) == 'table' then for k, v in pairs(listener) do if type(k) == 'string' and type(v) == 'function' then local is_general = k == DEFAULT_HANDLER local is_specific = #k > #HANDLER_PREFIX and k:sub(1, #HANDLER_PREFIX) == HANDLER_PREFIX if is_general or is_specific then return true end end end return false else return false end end function event.dispatch(listener, name, ...) local direct = event.getHandlerFor(name) if type(listener) == 'table' then if type(listener[direct]) == 'function' then return listener[direct](listener, ...) elseif type(listener[DEFAULT_HANDLER]) == 'function' then return listener[DEFAULT_HANDLER](listener, name, ...) end elseif type(listener) == 'function' then listener(name, ...) end end return event
local id = ID("maketoolbar.makemenu") local tool return { name = "Add `make` toolbar button", description = "Adds a menu item and toolbar button that run `make`.", author = "Paul Kulchenko", version = 0.31, dependencies = "1.0", onRegister = function(self) local menu = ide:FindTopMenu("&Project") menu:Append(id, "Make") ide:GetMainFrame():Connect(id, wx.wxEVT_COMMAND_MENU_SELECTED, function() ide:ExecuteCommand('make', ide:GetProject(), function(s) ide:GetOutput():Write(s) end) end) local tb = ide:GetToolBar() tool = tb:AddTool(id, "Make"..KSC(id), wx.wxBitmap({ -- columns rows colors chars-per-pixel -- "16 16 87 1", " c None", ". c #6D6E6E", "X c #766F67", "o c #7A7162", "O c #6C6E70", "+ c #717171", "@ c #747473", "# c #757676", "$ c #797673", "% c #9D754F", "& c #9C7550", "* c #AB7745", "= c #AB7845", "- c #AB7846", "; c #AC7845", ": c #AC7846", "> c #AC7947", ", c #AD7B46", "< c #A7794A", "1 c #817F7C", "2 c #CB9827", "3 c #C2942F", "4 c #CB962B", "5 c #C29434", "6 c #CB983C", "7 c #DFBB3A", "8 c #BF9041", "9 c #BB9049", "0 c #BD9249", "q c #BC9154", "w c #87826C", "e c #CA9643", "r c #C79943", "t c #C6914D", "y c #E5C84E", "u c #EAC955", "i c #F2DD73", "p c #F6DD77", "a c #3F99DC", "s c #3E9ADE", "d c #4F99C3", "f c #519ED0", "g c #4BA0DC", "h c #4CA1DF", "j c #52A6E2", "k c #55A7E4", "l c #5EAAE2", "z c #5CACE4", "x c #6BAFE2", "c c #6BB0E3", "v c #6AB1EA", "b c #6CB7E8", "n c #76B5E4", "m c #70B5EA", "M c #70B9E8", "N c #828383", "B c #848585", "V c #858686", "C c #868787", "Z c #878787", "A c #8F8F8F", "S c #949595", "D c #B7B8B8", "F c #81BAE3", "G c #81BAE4", "H c #81BBE5", "J c #B3D1D7", "K c #A0D3E8", "L c #BCD6E6", "P c #B0D7F0", "I c #BDDEF1", "U c #BAE5F6", "Y c #C0C0C0", "T c #CDCDCD", "R c #D4D4D4", "E c #D9D9D9", "W c #DCDCDC", "Q c #CADEED", "! c #C2DFF8", "~ c #C9E2FA", "^ c #CEE4FA", "/ c #CEEFFE", "( c #CEF2FF", ") c #E1E1E1", "_ c #E2E2E2", "` c #E4E4E4", "' c #EBEBEB", -- pixels -- " ", " &w.C# ss ", " %1D_'BO vl ", " $E_`Z1 Hs s ", " .YWRBo H~bkbs ", " +ETSwr=HQ!/Hk ", " .NAX9i6,IUh ", " O@ <8y2;h ", " f;574; ", " xLJ,5ue; ", " HH^PKd;0pt; ", " snsv(s ;que, ", " s sH *0pt* ", " zM ,q; ", " ss , ", " " })) tb:Realize() end, onUnRegister = function(self) local tb = ide:GetToolBar() tb:DeleteTool(tool) tb:Realize() ide:RemoveMenuItem(id) end, }