content
stringlengths
5
1.05M
require('nis.utils') require('nis.message_window') local graphic = require('nis.graphic') local function helper(suggestions, window) local toshow = "" if not window.subwindows.notifier then window.subwindows.notifier = MessageWindow.new() end for _, suggestion in pairs(suggestions) do toshow = toshow.."\\e[syntax]"..suggestion.fullname..": "..suggestion.type.. "\\e[reset]\n\n"..tostring(suggestion.comment) end stylized_print(window.subwindows.notifier, toshow) end local function extractArgs(line) local start, finish = matchBrace(line) if not start then return end return line:sub(start, finish-1) end local function arghelper(suggestions, window) local oldselection = window.selection.pos local curline = window.selection.line local backwarding = window.selection.col - 1 local calltip = "" if #suggestions == 1 then calltip = extractArgs(suggestions[1].type) if calltip then vis:info(calltip) end else local variants = "" local empty = {start = 0, finish = 0} for i, suggestion in pairs(suggestions) do local arg = extractArgs(suggestion.type) if arg then variants = arg.."\n"..variants end end local state, result, _ = vis:pipe(window.file, empty, "echo -e '".. variants.."' | vis-menu -l 10") if state == 0 then if not variants:find(result) then vis:insert(result:match("^[^\n]+")) return else calltip = result end end end vis:insert(")") window.selection.pos = oldselection if calltip then local roi = {start=oldselection-backwarding, finish=oldselection} local func = window.file:content(roi) window.triggers.calltip = function(win) local curpos = win.selection.pos if win.selection.line == curline and curpos >= oldselection and win.file:content(roi) == func then local line = win.file.lines[curline] local astart, aend = matchBrace(line, backwarding) if aend and oldselection + aend - backwarding > curpos then vis:info(calltip) end end end end end local function suggest(suggestions, window) local file = window.file local pos = window.selection.pos local wordobject = file:text_object_word(pos-1 < 1 and 1 or pos-1) local pattern = file:content(wordobject) or "" if type(pattern) ~= "string" then pattern = "" elseif pattern:match("([a-zA-Z0-9])") == nil then pattern = "" end local dotpattern = pattern:match("^.*%.([^%.]*)$") if type(dotpattern) == "string" then pattern = dotpattern end local variants = "" for _, suggestion in pairs(suggestions) do variants = variants..(#variants>0 and "\n" or "").. (graphic.associations[suggestion.skind] or "").."|".. (graphic.glyphs[suggestion.skind] or " U ").."|".. graphic.colors.White:encode().." "..suggestion.name..": ".. suggestion.type end local empty = {start = 0, finish = 0} local state, result, _ = vis:pipe(file, empty, "echo -e '"..variants.. "' | vis-menu -l 10 '"..pattern.."'") if state == 0 then local stripped, forhelper = result:match("^.*%|[^|]+%|[^(]*m%s([^:]+):(.*)") if stripped == nil then stripped = result:match("^%s*([^%s]+)%s*$") end if stripped == nil then return end if stripped:match("[%$%%%=%<%>%[%]%!%^]") then stripped = '`'..stripped..'`' end local head = stripped:sub(1, #pattern) if head ~= pattern then vis:info(head.." ~= "..pattern) window.selection.pos = wordobject.start vis:replace(head) local todel = #pattern - #head if todel > 0 then local after = vis.win.selection.pos file:delete({start = after, finish = after + todel}) end end window.selection.pos = wordobject.finish local residue = stripped:sub(#pattern+1) if type(residue) == "string" and #residue > 0 then vis:insert(residue) end if forhelper and forhelper:match("%(") then vis:insert("(") arghelper({[1] = {type = forhelper}}, window) end vis.events.emit(vis.events.WIN_HIGHLIGHT, window) end end local function deffinder(suggestions, window) local suggestion = suggestions[1] if suggestion.file ~= window.file.path then --open the file vis:command("open "..suggestion.file) end vis.win.selection:to(suggestion.line, suggestion.column) end local function highlight_errors(suggestions, window) local errors = {} local error_style = graphic.error_style local lexer, existent = register_colors(window) if not window.subwindows.errormessage then window.subwindows.errormessage = MessageWindow.new() end window.file.converter = {} local i = 1 local pos = 0 for line in window.file:lines_iterator() do local length = #line window.file.converter[i] = { start = pos, length = length } i = i + 1 pos = pos + length + 1 end local todo = function () end for i = 1, #suggestions do local suggestion = suggestions[i] todo(suggestion) if suggestion.file == window.file.path then local style = existent[error_style[suggestion.type].description] if not (suggestion.line and window.file.converter[suggestion.line]) then return end local pos = window.file.converter[suggestion.line].start + suggestion.column local selection = window.file:text_object_word(pos) table.insert(errors, {style = style, comment = suggestion.comment, start = selection.start, finish = selection.finish}) if suggestion.comment == "template/generic instantiation from here" then local last = #errors local lasttodo = todo todo = function(sug) if lasttodo then lasttodo(sug) end errors[last].comment = errors[last].comment.."\n"..sug.file.."(".. tostring(sug.line)..",".. tostring(sug.column)..") "..sug.comment end else todo = function () end end else todo = function () end end end window.triggers.error_highlighter = function(win) if win.file.modified then return end local content = win.viewport local selection = win.selection.pos local message for _, err in pairs(errors) do if (err.finish > content.start and err.finish < content.finish) or (err.start > content.start and err.start < content.finish) then win:style(err.style, err.start, err.finish) --silent_print("Got you!"..tostring(err.start)) if selection < err.finish and selection > err.start then message = err.comment end end end local multiline = message and (message:find("\n") or #message >= win.width) if multiline then stylized_print(window.subwindows.errormessage, message) elseif message then window.subwindows.errormessage:hide() vis:info(message) else window.subwindows.errormessage:hide() end end end local responces = { -- a table with functions which should be called on certain suggestion type -- encounter suggest = suggest, help = helper, context = arghelper, gotodef = deffinder, check = highlight_errors, } function dispatch(filepath, request, suggestions) -- Generic NISGOTANSWER event handler, which searches for the window related -- to the suggestion and calls particular suggestion handler if suggestions == nil then return end local window = vis.win if window.file.path ~= filepath then -- Search for related windows end local handler = responces[request] if handler then handler(suggestions, window) end end
--[[ Drt-Utilities v1.1.0.1 A collection of common tools MIT License Copyright (c) 2019 Down Right Technical Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --]] if Drt == nil then Drt = {} end -- **************************************************************** -- Drt.split(string, string) : table -- **************************************************************** function Drt.split(input, seperator) local ErrorString = "Drt.split(string:input[, string:seperator]) " assert(type(input) == "string" or input == nil, ErrorString .. "- Input Must be a string") assert(type(seperator) == "string" or seperator == nil, ErrorString .. "- seperator must be a string or nil (nil == '%s')") if input == nil then return nil end if seperator == nil then seperator = "%s" end local t = {} for str in string.gmatch(input, "([^" .. seperator .. "]+)") do table.insert(t, str) end return t end -- **************************************************************** -- Drt.clamp(number, number, number) : number -- **************************************************************** function Drt.clamp(input, min, max) local ErrorString = "Drt.clamp(number:input, number:min, number:max) " assert(type(input) == "number", ErrorString .. "- input, must be a number") assert(type(min) == "number", ErrorString .. "- min, must be a number") assert(type(max) == "number", ErrorString .. "- max, must be a number") assert(min <= max, ErrorString .. "- min must be less or equal to max") local i = input if i < min then i = min end if i > max then i = max end return i end -- **************************************************************** -- Drt.toRGB(number, number, number) : (number, number, number, string) -- **************************************************************** function Drt.toRGB (h, s, v) local ErrorString = "Drt.toRGB([number:Hue] [, number:Saturation] [, number:Value]) " assert(type(h) == "number" or h == nil, ErrorString .. " - Hue must be a number or nil") assert(type(s) == "number" or s == nil, ErrorString .. " - Saturation must be a number or nil") assert(type(v) == "number" or v == nil, ErrorString .. " - Value must be a number or nil") --assert(h >= 0 or s <= 1, ErrorString .. " - Hue must be between 0 and 1") -- I don't remember if this is true assert(s >= 0 or s <= 1, ErrorString .. " - Saturation must be between 0 and 1") assert(v >= 0 or v <= 1, ErrorString .. " - Value must be between 0 and 1") -- stuff of magic https://stackoverflow.com/questions/17242144/javascript-convert-hsb-hsv-color-to-rgb-accurately if h == nil then h = 0 end if s == nil then s = 1.0 end if v == nil then v = 1.0 end local r = 0 local g = 0 local b = 0 local name = nil local i = math.floor(h * 6) local f = h * 6 - i local p = v * (1.0 - s) local q = v * (1.0 - f * s) local t = v * (1.0 - (1.0 - f) * s) if (i % 6) == 0 then r = v g = t b = p elseif (i % 6) == 1 then r = q g = v b = p elseif (i % 6) == 2 then r = p g = v b = t elseif (i % 6) == 3 then r = p g = q b = v elseif (i % 6) == 4 then r = t g = p b = v elseif (i % 6) == 5 then r = v g = p b = q end -- need to round and clamp this! name = Drt.getColorName(r,g,b) return r, g, b, name end -- **************************************************************** -- Drt.getColorName(number, number, number, number) : string -- **************************************************************** function Drt.getColorName (r, g, b, threshold) -- http://chir.ag/projects/ntc/ntc.js -- not fully implimented, needs to also check HSV values, but works for now. -- safty first r = r or 0 g = g or 0 b = b or 0 threshold = threshold or 1500 r = Drt.clamp(math.floor(r * 255), 0, 255) g = Drt.clamp(math.floor(g * 255), 0, 255) b = Drt.clamp(math.floor(b * 255), 0, 255) local bestScore = -1 local bestIndex for k, v in pairs(Drt.colorNames) do local cR = v[1][1]; local cG = v[1][2]; local cB = v[1][3]; local score = ((r - cR)*(r - cR)) + ((g - cG)*(g - cG)) + ((b - cB)*(b - cB)) if bestScore < 0 or bestScore > score then bestScore = score bestIndex = k end end --Echo("%s (%d)", names[bestIndex][2], bestScore) local result = nil if (bestScore < threshold) then result = Drt.colorNames[bestIndex][2] end return result end -- **************************************************************** -- Drt.colorNames -- Enter Names for colors, Add your own in the following format -- {{r, g, b,"NAME"}} -- r, g and b are between 0 and 255 -- **************************************************************** Drt.colorNames = { {{0 , 0, 0},"Black"}, {{255, 0, 0},"Red"}, {{0 ,255, 0},"Green"}, {{0 , 0,255},"Blue"}, {{0 ,255,255},"Cyan"}, {{255,255, 0},"Yellow"}, {{255, 0,255},"Magenta"}, {{255,127, 0},"Orange"}, {{127,255, 0},"Lime"}, {{ 0,255,127},"Sea Foam"}, {{ 0,127,255},"Lt Blue"}, {{127, 0,255},"Purple"}, {{255, 0,127},"Hot Pink"}, {{255,255,255},"White"} } -- **************************************************************** -- Drt.selectionToArray(boolean) : table -- Thanks MA, this is really helpful. I added a random option. -- **************************************************************** function Drt.SelectionToArray(random) random = random or false assert(type(random) == "boolean") local selectedFixtures = {}; local sfIdx = SelectionFirst (); while (sfIdx ~= nil) do if random == true then local key = tostring(math.random()) selectedFixtures[key] = sfIdx; else selectedFixtures[#selectedFixtures + 1] = sfIdx; end sfIdx = SelectionNext(sfIdx, true); end -- if we are in random mode we would like to short the keys to the result is random. if random == true then math.randomseed(os.time()) math.random() -- chuck the fist one away just in case. local keys = {} -- grab our random keys for k in pairs(selectedFixtures) do table.insert(keys, k) end -- sort them table.sort(keys) -- make a new selection table with our sorted randomness local sortedSelection = {} for i, k in ipairs(keys) do table.insert(sortedSelection, selectedFixtures[k]) end return sortedSelection -- return our random selection end return selectedFixtures -- return our default selection end -- **************************************************************** -- Drt.calculateSFID(number) : string -- Sub Fixtures (not child fixtures), don't contain an FID. returns the aparent Sub fixture ID based on the root fixture -- **************************************************************** function Drt.calculateSFID(fixture) assert(type(fixture) == "number", "Drt.calculateSFID(int:fixture)") local result = GetSubfixture(fixture).FID if (result ~= nil) then return result end result = "" while (GetSubfixture(fixture):GetClass() == "SubFixture") do local parent = GetSubfixture(fixture):Parent(); result = "." .. fixture - parent.SubfixtureIndex .. result fixture = parent.SubfixtureIndex end result = GetSubfixture(fixture).FID .. result return result end -- **************************************************************** -- Drt.calculateRange(string) : table, string -- **************************************************************** function Drt.calculateRange(input) assert(type(input) == "string", "Drt.calculateRange(string) : table, string") -- first split on "," local seqSplit = Drt.split(input, ",") local returnList = {} local returnString = "" if #seqSplit == 0 then Printf("No Sequences Found, Exiting") return nil elseif #seqSplit > 0 then for k, v in pairs(seqSplit) do if string.find(v, "-") ~= nil then local inputRange = Drt.split(v, "-") -- if inputRange[1] == null or inputRange[2] == null then -- goto continue -- end if tonumber(inputRange[1]) == nil or tonumber(inputRange[2]) == nil then goto continue end -- found a range local inputStart = math.floor(tonumber(inputRange[1])) local inputEnd = math.floor(tonumber(inputRange[2])) if inputStart < inputEnd then --input the range into the table for i = inputStart, inputEnd do table.insert (returnList, i) end returnString = returnString .. v .. "," else --range is invalid, skip it. end else -- just a value if tonumber(v) == nil then goto continue end local item = math.floor(tonumber(v)) if item ~= nil then table.insert (returnList, item) returnString = returnString .. v .. "," end end ::continue:: end end if #returnList == 0 then return nil else returnString = returnString:sub(1, -2) return returnList, returnString end end function Drt.table2String(input) if type(input) == "boolean" then if input == true then return "true" else return "false" end elseif type(input) == "table" then local result = "" for k, v in pairs(input) do k = Drt.table2String(k) v = Drt.table2String(v) result = result .. string.format("[%s] %s", k, v) Echo(string.format("[%s] %s", k, v)) end return result else return tostring(input) end end
-- Copyright 2022 philh30 -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. local caps = require("st.capabilities") local map = { ['main'] = { [caps.switch.ID] = { [caps.switch.switch.ID] = { cmd = 'POWR', on = '0000000000000001', off = '0000000000000000', }, }, [caps.audioMute.ID] = { [caps.audioMute.mute.ID] = { cmd = 'AMUT', muted = '0000000000000001', unmuted = '0000000000000000', }, }, [caps.audioVolume.ID] = { [caps.audioVolume.volume.ID] = { cmd = 'VOLU', }, }, } } return map
------------------------------------------------------------------------#################### PetAutoCraft = {}-- ##Global Variables## ------------------------------------------------------------------------#################### PetAutoCraft.Events = {} --Table that will contain all the event functions ------------------------------------------------------------------------################### -- ##Local Variables## ------------------------------------------------------------------------################### local Version = "v1.4.1" --Version of Pet Auto Craft local SkillLvl = {} --Table of Pet Craft skills. Server updates numbers only after a full % point increase SkillLvl.MINING = 1 ----Mining Skill (1.2345 counts as skill lvl 1 with 23.45% to lvl 2) SkillLvl.WOOD = 1 ----Woodcutting Skill (same) SkillLvl.HERB = 1 ----Herbalism Skill (same) local Type = nil --Current type of craft ("MINING", "WOOD", "HERB", nil) local Index = 0 --Current Craft Option index local Products = {} --Table of current products local Repeats = {} --Table of all the repeat info for i,v in pairs(SkillLvl) do ----info per type Repeats[i] = {Completed = nil, TilLvl = nil, SLvl = nil, CLvl = nil} end----Completed = #completed to calc xp, TilLvl = how many repeats til level, SLvl = Skill Level, CLvl = Craft Level local ToolTimer = {Timer = nil, Completed = 0, Timestamp = nil} --Use to determine how long each craft takes local CastTimer = nil --Timer of the cast bar local Delay = nil --Timer that sets a delay between (buying tools) --> (equipping tools) --> (starting to craft) local Refine = nil --Timer that handles the auto refine local Store = false --StoreFrame:IsVisible() local EquipAttempts = 0 --Equip Attempts that failed due to an item alrady being on the cursor local CraftOptions = {} --Table all the craft option for i, v in pairs(SkillLvl) do CraftOptions[i] = {} end ----Sub tables of all the craft types, used for selecting best craft and filling in dropdown menus local DBfile = "Interface/AddOns/PetAutoCraft/Data.lua" --Location of DB file local PetVendors, Tools, Mats = dofile(DBfile) --Tables for Pet Vendor locations, all the tools, all the mats and their itemIDs local MatNameToID = {} --Table for finding a Mats ID number via the name for i,v in pairs(Mats) do for j,k in pairs(v) do ----Take apart our master Mat table to.. MatNameToID[k.Name] = k.ID end end ----..make our simple table ------------------------------------------------------------------------####################################### local GlobalDefaults = {}-- ##Defaults for Global Saved Variables## ------------------------------------------------------------------------####################################### GlobalDefaults.PosX = false --X Position of the PetAutoCraft_Frame GlobalDefaults.PosY = false --Y Position of the PetAutoCraft_Frame GlobalDefaults.CraftOptions = CraftOptions --Saved copy of CraftOptions GlobalDefaults.xpPerCraft = {} --Saved table of the xp per craft per skill level per craft level ------------------------------------------------------------------------########################################## local CharDefaults = {}-- ##Defaults for Character Saved Variables## ------------------------------------------------------------------------########################################## PetAutoCraftCSave = nil --Wipe out variable from other toons to prevent errors CharDefaults.Pet = 0 --Which pet will do the crafting. 1-6 CharDefaults.Running = false --Continues crafting between sessions CharDefaults.HarvestAt = 100 --Harvest when common mat is at for i, v in pairs(SkillLvl) do CharDefaults[i] = "▲" end --Index of the craft level to do. (1 - 14, 0 = auto) for i, v in pairs(Tools) do CharDefaults["Use"..v.ID] = true end --A dropdown list to pick which tools to use and which to ignore, use all tools by default for i, v in pairs(MatNameToID) do CharDefaults["Sell"..v] = false end --A dropdown list to pick which mats to autosell to the vendor CharDefaults["Sell204790"] = true ----Mysterious Item defaults to true for i, v in pairs(Tools) do if v.Vendor then --Auto buy stacks of tools at the vendor when out of tools and crafting CharDefaults["Buy"..v.ID] = 0 end end ----default 0 stacks ------------------------------------------------------------------------########################################## function PetAutoCraft.OnLoad(this) this:RegisterEvent("VARIABLES_LOADED") this:RegisterEvent("PET_SWAPITEM_SUCESS") --Equiped/Unequiped tools this:RegisterEvent("PET_CRAFT_START") --Start of a set of cycles this:RegisterEvent("PET_CRAFTING_START") --Start of a cycle this:RegisterEvent("PET_CRAFTING_FAILED") --Cycle interrupted this:RegisterEvent("PET_CRAFTING_END") --End of a cycle this:RegisterEvent("PET_CRAFT_END") --End of a set of cycles this:RegisterEvent("STORE_OPEN") --Store Frame Opens SLASH_PetAutoCraft1 = "/pac" SLASH_PetAutoCraft2 = "/petautocraft" SlashCmdList.PetAutoCraft = PetAutoCraft.ToggleFrame for i = 1, 3 do getglobal("PetAutoCraft_ProductButton"..i.."Count"):Show() end PetAutoCraft_ToolButtonCount:Show() end function PetAutoCraft.OnUpdate(update, elapsedTime) if Delay then Delay = Delay - elapsedTime if Delay <= 0 then Delay = nil PetAutoCraft.EquipTool() end end if ToolTimer.Timer then ToolTimer.Timer = ToolTimer.Timer - elapsedTime PetAutoCraft_OutOfToolValue:SetText(PetAutoCraft.SecondsToTime(ToolTimer.Timer)) else PetAutoCraft_OutOfToolValue:SetText("Stopped") end if CastTimer then CastTimer = CastTimer - elapsedTime if CastTimer >= 0 then PetAutoCraft_CastValue:SetText(string.format("%.1f", CastTimer).." sec") else PetAutoCraft_CastValue:SetText("Processing") end else PetAutoCraft_CastValue:SetText("Stopped") end if Refine then Refine = Refine - elapsedTime if Refine <= 0 then if CraftQueueFrame.creating == 0 then for i = 1, CraftQueueFrame.list.count do CraftQueueFrame.list[i].number = 9999 end CraftQueueFrame_OnShow(CraftQueueFrame) Lua_CreateQueueItem() end Refine = 60 end end end function PetAutoCraft.Events.VARIABLES_LOADED() PetAutoCraft.UpdateSavedVariables() PET_CURRENT_ITEM = PetAutoCraftCSave.Pet PetAutoCraft.Hooks() if PetAutoCraftGSave.PosX then local scale = GetUIScale() PetAutoCraft_Frame:ClearAllAnchors() PetAutoCraft_Frame:SetAnchor("TOPLEFT", "TOPLEFT", "UIParent", PetAutoCraftGSave.PosX / scale, PetAutoCraftGSave.PosY / scale) end if AddonManager then local addon = { name = "Pet Auto Craft", version = Version, author = "Mavoc", description = "Automates the pet craft feature", icon = "Interface/petframe/icons/trainicon", category = "Economy", --AM needs a crafting category slashCommands = "/pac", onClickScript = PetAutoCraft.ToggleFrame, configFrame = nil, miniButton = nil, } AddonManager.RegisterAddonTable(addon) end if KeyBinder then KeyBinder.RegisterBinding("PetAutoCraft", "Pet Auto Craft", "PetAutoCraft.ToggleFrame()") end CraftOptions = PetAutoCraftGSave.CraftOptions if PetAutoCraftCSave.Pet > 0 then for i, v in pairs(SkillLvl) do PetAutoCraft.UpdateSkillLvl(i) end PetAutoCraft.UpdateTools() for i = 1, 3 do Products[i] = GetPetEquipmentItem(PetAutoCraftCSave.Pet, "product"..i) end if PetAutoCraftCSave.Running then Delay = 0.5 end end end function PetAutoCraft.Events.STORE_OPEN() local id for i = 1, GetStoreSellItems() do id = PetAutoCraft.LinkToID(GetStoreSellItemLink(i)) if id and PetAutoCraftCSave["Buy"..id] then PetAutoCraft_StoreButton:Show() return end end PetAutoCraft_StoreButton:Hide() end function PetAutoCraft.Events.PET_SWAPITEM_SUCESS() PetAutoCraft.UpdateTools() PetAutoCraft.GetCraftOptions() end function PetAutoCraft.Events.PET_CRAFT_START() PetAutoCraft_MiniMapFlash:SetColor(0, 1, 0) PetAutoCraft_SelectPetButton:Disable() PetAutoCraft_StartButton:Hide() PetAutoCraft_StopButton:Show() local name, icon, count for i = 1, 3 do name, icon, count = GetPetPossibleProductItemDetail(PetAutoCraftCSave.Pet, Index, i) Products[i] = name getglobal("PetAutoCraft_ProductButton"..i.."Icon"):SetFile(icon) end end function PetAutoCraft.Events.PET_CRAFTING_START() if Repeats[Type].Clvl ~= CraftOptions[Type][Index]["Level"] or Repeats[Type].Slvl ~= math.floor(SkillLvl[Type]) then Repeats[Type].Clvl = CraftOptions[Type][Index]["Level"] Repeats[Type].Slvl = math.floor(SkillLvl[Type]) Repeats[Type].TilLvl = nil Repeats[Type].Completed = nil end if PetAutoCraftCSave[Type] == "▲" then--switch crafting option if needed. Stop doesn't work on PET_CRAFTING_END for i = #(CraftOptions[Type]), 1, -1 do if CraftOptions[Type][i]["Level"] <= SkillLvl[Type] then if i ~= Index then PetCraftingStop(PetAutoCraftCSave.Pet) return end break end end elseif PetAutoCraftCSave[Type] ~= CraftOptions[Type][Index]["Level"] then PetCraftingStop(PetAutoCraftCSave.Pet) return end if ToolTimer.TimeStamp then PetAutoCraft.InitTimer((GetTime() - ToolTimer.TimeStamp) / ToolTimer.Completed) else PetAutoCraft.InitTimer(11) ToolTimer.TimeStamp = GetTime() ToolTimer.Completed = 0 end CastTimer = arg2 end function PetAutoCraft.Events.PET_CRAFTING_FAILED() if Repeats[Type].Completed then Repeats[Type].Completed = Repeats[Type].Completed - 1 end if Repeats[Type].TilLvl then Repeats[Type].TilLvl = Repeats[Type].TilLvl + 1 getglobal("PetAutoCraft_"..Type.."ToLvlValue"):SetText(Repeats[Type].TilLvl) else getglobal("PetAutoCraft_"..Type.."ToLvlValue"):SetText("Waiting") end end function PetAutoCraft.Events.PET_CRAFTING_END() local level, name, icon, count PetAutoCraft.UpdateTools() level = GetPetLifeSkillInfo(PetAutoCraftCSave.Pet, Type) if SkillLvl[Type] < level then if math.floor(SkillLvl[Type]) == math.floor(level) and Repeats[Type].Completed then PetAutoCraftGSave.xpPerCraft[Repeats[Type].Clvl][Repeats[Type].Slvl] = (level - SkillLvl[Type]) / Repeats[Type].Completed end if PetAutoCraftGSave.xpPerCraft[Repeats[Type].Clvl][math.floor(level)] then Repeats[Type].TilLvl = math.ceil((math.ceil(level) - level) / PetAutoCraftGSave.xpPerCraft[Repeats[Type].Clvl][math.floor(level)]) getglobal("PetAutoCraft_"..Type.."ToLvlValue"):SetText(Repeats[Type].TilLvl) else getglobal("PetAutoCraft_"..Type.."ToLvlValue"):SetText("Calculating") end Repeats[Type].Completed = 0 PetAutoCraft.UpdateSkillLvl(Type, level) else if Repeats[Type].Completed then Repeats[Type].Completed = Repeats[Type].Completed + 1 end if Repeats[Type].TilLvl then Repeats[Type].TilLvl = Repeats[Type].TilLvl - 1 getglobal("PetAutoCraft_"..Type.."ToLvlValue"):SetText(Repeats[Type].TilLvl) else getglobal("PetAutoCraft_"..Type.."ToLvlValue"):SetText("Waiting") end end local harvest = false for i = 1, 3 do name, icon, count = GetPetEquipmentItem(PetAutoCraftCSave.Pet, "product"..i) if count then for v = 1, 3 do if name == CraftOptions[Type][Index]["Product"..v] then if (v == 1 and count >= 999) or (v == 2 and count >= PetAutoCraftCSave.HarvestAt) then harvest = true end getglobal("PetAutoCraft_ProductButton"..v.."Count"):SetText(count) break end end end end if harvest then PetAutoCraft.HarvestItems() end ToolTimer.Completed = ToolTimer.Completed + 1 end function PetAutoCraft.Events.PET_CRAFT_END() PetAutoCraft_MiniMapFlash:SetColor(1, 0, 0) PetAutoCraft_SelectPetButton:Enable() PetAutoCraft_StopButton:Hide() PetAutoCraft_StartButton:Show() Index = 0 ToolTimer.TimeStamp = nil ToolTimer.Completed = 0 ToolTimer.Timer = nil CastTimer = nil if PetAutoCraftCSave.Running then Delay = 0.5 end end function PetAutoCraft.HarvestItems() if not PET_CURRENT_ITEM then --prevents the default interface from erroring PET_CURRENT_ITEM = PetAutoCraftCSave.Pet end if PetAutoCraftCSave.Pet and GetPetEquipmentItem(PetAutoCraftCSave.Pet, "product1") then PetCraftHarvest(PetAutoCraftCSave.Pet) end for i = 1, 3 do getglobal("PetAutoCraft_ProductButton"..i.."Count"):SetText("0") end end function PetAutoCraft.EquipTool() if not CursorHasItem() then EquipAttempts = 0 Store = StoreFrame:IsVisible() if not GetPetEquipmentItem(PetAutoCraftCSave.Pet, "tools") then local id for i = 1, 240 do id = PetAutoCraft.LinkToID(GetBagItemLink(i)) if id and PetAutoCraftCSave["Use"..id] then PickupBagItem(i) ClickPetCraftItem(PetAutoCraftCSave.Pet) Delay = 0.5 return elseif Store and id and PetAutoCraftCSave["Sell"..id] then UseBagItem(i) end end if Store then if PetAutoCraft.BuyTools() then Delay = 3 else PetAutoCraftCSave.Running = false SendWarningMsg("Not enough gold to buy pet crafting tools") end else PetAutoCraftCSave.Running = false SendWarningMsg("Out of pet crafting tools") end else PetAutoCraft.StartCraft() end else EquipAttempts = EquipAttempts + 1 if EquipAttempts < 100 then Delay = 0.1 else ClickPetCraftItem(PetAutoCraftCSave.Pet) Delay = 0.5 end end end function PetAutoCraft.BuyTools() local cost, currency, stacksize local buy = false local gold = GetPlayerMoney("copper") for i = 1, GetStoreSellItems() do id = PetAutoCraft.LinkToID(GetStoreSellItemLink(i)) if id and PetAutoCraftCSave["Use"..id] and PetAutoCraftCSave["Buy"..id] then _, _, cost, currency, _, _, stacksize, _, _ = GetStoreSellItemInfo(i) if currency == 0 and gold >= cost * stacksize then for j = 1, PetAutoCraftCSave["Buy"..id] do buy = true StoreBuyItem(i, stacksize) end else warning = "Not enough gold to buy pet crafting tools" end end end return buy end function PetAutoCraft.StartCraft() PetAutoCraft.GetCraftOptions() PetAutoCraft.UpdateSkillLvl(Type) for i = #(CraftOptions[Type]), 1, -1 do if (PetAutoCraftCSave[Type] == "▲" and CraftOptions[Type][i]["Level"] <= SkillLvl[Type]) or PetAutoCraftCSave[Type] == CraftOptions[Type][i]["Level"] then Index = i break end end local found = 0 for i = 1, 3 do if Products[i] then for v = 1, 3 do if Products[i] == CraftOptions[Type][Index]["Product"..v] then found = found + 1 end end end end if found < 3 then PetAutoCraft.HarvestItems() end if PET_CURRENT_ITEM == PetAutoCraftCSave.Pet then UIDropDownMenu_SetSelectedID(PetCraftTypeDropDown, Index) end PET_CRAFT_CHOOSE[PetAutoCraftCSave.Pet] = Index PetCraftingStart(PetAutoCraftCSave.Pet, Index) end function PetAutoCraft.SelectPetMenu() local info = {} info.text = "Select Pet" info.notCheckable = true info.isTitle = true UIDropDownMenu_AddButton(info) for i = 1, PET_FRAME_NUM_ITEMS do if HasPetItem(i) then info = {} info.text = i..": "..GetPetItemName(i) info.value = i info.notCheckable = true info.func = function(button) PetAutoCraftCSave.Pet = button.value PetAutoCraft_SelectPetButton:SetText(button.value) for i, v in pairs(SkillLvl) do PetAutoCraft.UpdateSkillLvl(i) getglobal("PetAutoCraft_"..i.."ToLvlValue"):SetText("Unknown") end PetAutoCraft.UpdateTools() PetAutoCraft.GetCraftOptions() end UIDropDownMenu_AddButton(info) end end end function PetAutoCraft.SelectToolsMenu() local info = {} info.text = "Select Tools to Use" info.isTitle = true UIDropDownMenu_AddButton(info) for i, v in pairs(Tools) do info = {} info.text = v.Name info.value = "Use"..v.ID info.checked = PetAutoCraftCSave["Use"..v.ID] info.keepShownOnClick = true info.func = function(button) PetAutoCraftCSave[button.value] = not PetAutoCraftCSave[button.value] PetAutoCraft_SelectToolsButton:SetText(PetAutoCraft.CountCheckBoxes("Use")) end UIDropDownMenu_AddButton(info) end end function PetAutoCraft.BuyToolsMenu() local info = {} if UIDROPDOWNMENU_MENU_LEVEL == 1 then info.text = "Select Tools to Buy from Vendor" info.isTitle = true UIDropDownMenu_AddButton(info, 1) for i, v in pairs(Tools) do if v.Vendor then info = {} info.text = v.Name info.value = "Buy"..v.ID info.hasArrow = 1 info.checked = PetAutoCraftCSave["Buy"..v.ID] > 0 info.keepShownOnClick = true info.func = function(button) if PetAutoCraftCSave[button.value] == 0 then PetAutoCraftCSave[button.value] = 1 else PetAutoCraftCSave[button.value] = 0 end PetAutoCraft_BuyToolsButton:SetText(PetAutoCraft.CountCheckBoxes("Buy")) DropDownList2.numButtons = 0 UIDROPDOWNMENU_MENU_LEVEL = 2 PetAutoCraft.BuyToolsMenu() end UIDropDownMenu_AddButton(info, 1) end end elseif UIDROPDOWNMENU_MENU_LEVEL == 2 then for i, v in pairs(Tools) do if UIDROPDOWNMENU_MENU_VALUE == "Buy"..v.ID then info.text = "# Stacks" info.isTitle = true UIDropDownMenu_AddButton(info, 2) for j = 0, 6 do info = {} info.text = j info.value = j info.arg1 = "Buy"..v.ID info.checked = PetAutoCraftCSave["Buy"..v.ID] == j info.isRadioButton = true info.func = function(button) PetAutoCraftCSave[button.arg1] = button.value PetAutoCraft_BuyToolsButton:SetText(PetAutoCraft.CountCheckBoxes("Buy")) DropDownList1.numButtons = 0 UIDROPDOWNMENU_MENU_LEVEL = 1 PetAutoCraft.BuyToolsMenu() end UIDropDownMenu_AddButton(info, 2) end end end end end function PetAutoCraft.SellMatsMenu() local info = {} if UIDROPDOWNMENU_MENU_LEVEL == 1 then info.text = "Select Mats to be Vendored" info.isTitle = true info.notCheckable = true UIDropDownMenu_AddButton(info, 1) info = {} info.text = "Trash" info.value = "TRASH" info.notCheckable = true info.hasArrow = 1 UIDropDownMenu_AddButton(info, 1) info = {} info.text = "Herbs" info.value = "HERB" info.notCheckable = true info.hasArrow = 1 UIDropDownMenu_AddButton(info, 1) info = {} info.text = "Wood" info.value = "WOOD" info.notCheckable = true info.hasArrow = 1 UIDropDownMenu_AddButton(info, 1) info = {} info.text = "Ore" info.value = "MINING" info.notCheckable = true info.hasArrow = 1 UIDropDownMenu_AddButton(info, 1) elseif UIDROPDOWNMENU_MENU_LEVEL == 2 then for i, v in ipairs(Mats[UIDROPDOWNMENU_MENU_VALUE]) do info = {} info.text = v.Lvl..": "..v.Name info.value = "Sell"..v.ID info.checked = PetAutoCraftCSave["Sell"..v.ID] info.keepShownOnClick = true info.func = function(button) PetAutoCraftCSave[button.value] = not PetAutoCraftCSave[button.value] PetAutoCraft_SellMatsButton:SetText(PetAutoCraft.CountCheckBoxes("Sell")) end UIDropDownMenu_AddButton(info, 2) end end end function PetAutoCraft.MiningOptionsMenu() PetAutoCraft.CraftLevelOptionsMenu("MINING", LIFESKILL_MINE) end function PetAutoCraft.WoodOptionsMenu() PetAutoCraft.CraftLevelOptionsMenu("WOOD", LIFESKILL_WOOD) end function PetAutoCraft.HerbOptionsMenu() PetAutoCraft.CraftLevelOptionsMenu("HERB", LIFESKILL_HERB) end function PetAutoCraft.CraftLevelOptionsMenu(crafttype, craftname) local highest = 1 local info = {} if #(CraftOptions[crafttype]) > 0 then info.text = "Select "..craftname.." Crafting Level" info.notCheckable = true info.isTitle = true UIDropDownMenu_AddButton(info) for i = 1, #(CraftOptions[crafttype]) do info = {} info.text = CraftOptions[crafttype][i]["Level"]..": "..CraftOptions[crafttype][i]["Name"] info.value = CraftOptions[crafttype][i]["Level"] info.arg1 = crafttype info.tooltipText = "50% "..CraftOptions[crafttype][i]["Product1"].."\n45% "..CraftOptions[crafttype][i]["Product2"].."\n5% "..CraftOptions[crafttype][i]["Product3"] info.notCheckable = true if CraftOptions[crafttype][i]["Level"] > SkillLvl[crafttype] then info.disabled = true end info.func = function(button) PetAutoCraftCSave[button.arg1] = button.value getglobal("PetAutoCraft_"..button.arg1.."OptionsButton"):SetText(button.value) end UIDropDownMenu_AddButton(info) end info = {} info.text = "▲: Highest Level" info.value = "▲" info.arg1 = crafttype info.notCheckable = true info.func = function(button) PetAutoCraftCSave[button.arg1] = button.value getglobal("PetAutoCraft_"..button.arg1.."OptionsButton"):SetText(button.value) end UIDropDownMenu_AddButton(info) else info.text = "Please Equip "..craftname.." Tool to Populate List" info.notCheckable = true info.isTitle = true UIDropDownMenu_AddButton(info) end end function PetAutoCraft.ProductButton_OnEnter(this) GameTooltip:SetOwner(PetAutoCraft_Frame, "ANCHOR_LEFT", 0, 0) GameTooltip:SetPetProductItem(PetAutoCraftCSave.Pet, Index, this:GetID()) if AdvancedAuctionHouse then local id local name = GetPetPossibleProductItemDetail(PetAutoCraftCSave.Pet, Index, this:GetID()) if name and MatNameToID[name] then id = MatNameToID[name] end if id and IsAltKeyDown() == not AAH_SavedSettings.PriceHistoryAutoshow then HistoryForGameTooltipHyperLink = false HistoryForGameTooltip = true AAHFunc.ToolsShowPriceHistoryTooltip(GameTooltip, id) end end end function PetAutoCraft.ToolButton_OnClick() if not HasPetItem(PetAutoCraftCSave.Pet) then SendWarningMsg("Current selected pet does not exist.") elseif PetAutoCraftCSave.Running then SendWarningMsg(TEXT("PET_IN_CREATING")) elseif HasPetCraftHarvest(PetAutoCraftCSave.Pet) then SendWarningMsg(TEXT("PET_HAS_HARVEST")) else ClickPetCraftItem(PetAutoCraftCSave.Pet) end end function PetAutoCraft.UpdateTools() local name, icon, count = GetPetEquipmentItem(PetAutoCraftCSave.Pet, "tools") if name then PetAutoCraft_ToolButtonIcon:SetFile(icon) PetAutoCraft_ToolButtonCount:SetText(count) else PetAutoCraft_ToolButtonIcon:SetFile("Interface\\CharacterFrame\\Equipment-UtensilSlot") PetAutoCraft_ToolButtonCount:SetText("") end end function PetAutoCraft.GetCraftOptions() local name, crafttype, craftlvl local numOptions = GetPetNumCraftItems(PetAutoCraftCSave.Pet) for i = 1, numOptions do name, crafttype, craftlvl = GetPetCraftItemInfo(PetAutoCraftCSave.Pet, i) CraftOptions[crafttype][i] = {} CraftOptions[crafttype][i]["Level"] = craftlvl CraftOptions[crafttype][i]["Name"] = name if not PetAutoCraftGSave.xpPerCraft[craftlvl] then PetAutoCraftGSave.xpPerCraft[craftlvl] = {} end for v = 1, 3 do CraftOptions[crafttype][i]["Product"..v] = GetPetPossibleProductItemDetail(PetAutoCraftCSave.Pet, i, v) end end PetAutoCraftGSave.CraftOptions = CraftOptions Type = crafttype end function PetAutoCraft.InitTimer(diff) local count local total = 0 _, _, count = GetPetEquipmentItem(PetAutoCraftCSave.Pet, "tools") if count then total = count end for i, v in pairs(Tools) do if PetAutoCraftCSave["Use"..v.ID] then total = total + GetBagItemCount(v.ID) end end ToolTimer.Timer = total * diff end function PetAutoCraft.AutoRefine_OnClick(value) Refine = value end function PetAutoCraft.CountCheckBoxes(str) local count = 0 if str == "Use" then for i, v in pairs(Tools) do if PetAutoCraftCSave[str..v.ID] then count = count + 1 end end elseif str == "Buy" then for i, v in pairs(Tools) do if v.Vendor and PetAutoCraftCSave[str..v.ID] > 0 then count = count + 1 end end elseif str == "Sell" then for i, v in pairs(MatNameToID) do if PetAutoCraftCSave[str..v] then count = count + 1 end end end return count end function PetAutoCraft.UpdateSkillLvl(skill, level) if not level then level = GetPetLifeSkillInfo(PetAutoCraftCSave.Pet, skill) end SkillLvl[skill] = level getglobal("PetAutoCraft_"..skill.."LevelValue"):SetText(math.floor(level)..": "..string.format("%.2f", math.floor((level - math.floor(level)) * 10000) / 100).."%") end function PetAutoCraft.LinkToID(link) local data if link and link ~= "" then _, data, _ = ParseHyperlink(link) if data then return tonumber(string.sub(data, 1, 5), 16) end end return nil end function PetAutoCraft.SecondsToTime(temptime) local hours, minutes, seconds temptime = math.floor(temptime) hours = math.floor(temptime / 3600) temptime = temptime - (hours * 3600) minutes = string.format("%02s", math.floor(temptime / 60)) seconds = string.format("%02s", temptime - (tonumber(minutes) * 60)) return hours..":"..minutes..":"..seconds end function PetAutoCraft.ToggleFrame() if PetAutoCraft_Frame:IsVisible() then PetAutoCraft_Frame:Hide() else if PetAutoCraftCSave.Pet == 0 or not HasPetItem(PetAutoCraftCSave.Pet) then for i = 1, PET_FRAME_NUM_ITEMS do if HasPetItem(i) then PetAutoCraftCSave.Pet = i end end end if PetAutoCraftCSave.Pet > 0 then PetAutoCraft_Frame:Show() PetAutoCraft_SelectPetButton:SetText(PetAutoCraftCSave.Pet) PetAutoCraft_SelectToolsButton:SetText(PetAutoCraft.CountCheckBoxes("Use")) PetAutoCraft_BuyToolsButton:SetText(PetAutoCraft.CountCheckBoxes("Buy")) PetAutoCraft_SellMatsButton:SetText(PetAutoCraft.CountCheckBoxes("Sell")) PetAutoCraft_HarvestAtButton:SetText(PetAutoCraftCSave.HarvestAt) for i, v in pairs(SkillLvl) do getglobal("PetAutoCraft_"..i.."OptionsButton"):SetText(PetAutoCraftCSave[i]) end for i, v in pairs(SkillLvl) do PetAutoCraft.UpdateSkillLvl(i) end PetAutoCraft.UpdateTools() PetAutoCraft.GetCraftOptions() else SendWarningMsg("No Pet Eggs Found") end end end function OnMouseDown_PlayerFramePetButton(this, key)--Replacing the Original Function if key == "LBUTTON" then ToggleUIFrame(PetFrame) elseif key == "RBUTTON" then if IsShiftKeyDown() then UIPanelAnchorFrame_StartMoving(this) else PetAutoCraft.ToggleFrame() end end end function OnEnter_PlayerFramePetButton(this)--Replacing the Original Function GameTooltip:SetOwner(this, "ANCHOR_RIGHT", 4, 0) GameTooltip:SetText(PET_FRAME_BUTTON, 1, 1, 1) GameTooltip:AddLine(PB_OPEN_TIPS, 0, 0.75, 0.95) GameTooltip:AddLine("Right-click to open PetAutoCraft", 0, 0.75, 0.95) GameTooltip:AddLine(UIPANELANCHORFRAME_TOOLTIP, 0, 0.75, 0.95) GameTooltip:Show() end function PetCraftHarvestButton_OnClick(this)--Replacing the Original Function PetCraftHarvest(PET_CURRENT_ITEM) end function PetAutoCraft.Hooks()--Place for all the hooks to load on VARIABLES_LOADED local WorldMapFrame_SetWorldMapID_orig = WorldMapFrame_SetWorldMapID function WorldMapFrame_SetWorldMapID(ID) if PetVendors[ID] then local width = WorldMapViewFrame:GetWidth() local height = WorldMapViewFrame:GetHeight() PetAutoCraft_VendorMapLocation:ClearAllAnchors() PetAutoCraft_VendorMapLocation:SetAnchor("CENTER", "TOPLEFT", "WorldMapViewFrame", PetVendors[ID].X * width, PetVendors[ID].Y * height) PetAutoCraft_VendorMapLocation:Show() else PetAutoCraft_VendorMapLocation:Hide() end WorldMapFrame_SetWorldMapID_orig(ID) end local PetCraftStartButton_OnClick_orig = PetCraftStartButton_OnClick function PetCraftStartButton_OnClick(this) PetAutoCraft.HarvestItems() if not PetAutoCraftCSave.Running and PET_CRAFT_CHOOSE[PET_CURRENT_ITEM] then PetAutoCraftCSave.Pet = PET_CURRENT_ITEM PetAutoCraft_SelectPetButton:SetText(PET_CURRENT_ITEM) PetAutoCraft.GetCraftOptions() PetAutoCraftCSave.Running = true end PetCraftStartButton_OnClick_orig(this) end local PetCraftStopButton_OnClick_orig = PetCraftStopButton_OnClick function PetCraftStopButton_OnClick(this) PetAutoCraftCSave.Running = false PetCraftStopButton_OnClick_orig(this) end local ReloadUI_orig = ReloadUI function ReloadUI() if PetAutoCraftCSave.Running then PetCraftingStop(PetAutoCraftCSave.Pet) end ReloadUI_orig() end end function PetAutoCraft.UpdateSavedVariables()--Update the saved variables for changes in usage if PetAutoCraftGSave then --Global Variables Housecleaning for i, v in pairs(GlobalDefaults) do --Add new options if PetAutoCraftGSave[i] == nil then PetAutoCraftGSave[i] = v end end for i, v in pairs(PetAutoCraftGSave) do --Remove old options if GlobalDefaults[i] == nil then PetAutoCraftGSave[i] = nil end end else PetAutoCraftGSave = GlobalDefaults --Apply Defaults end if PetAutoCraftCSave then --Per Character Variables Housecleaning for i, v in pairs(CharDefaults) do --Add new options if PetAutoCraftCSave[i] == nil then PetAutoCraftCSave[i] = v end end for i, v in pairs(PetAutoCraftCSave) do --Remove old options if CharDefaults[i] == nil then PetAutoCraftCSave[i] = nil end end else PetAutoCraftCSave = CharDefaults --Apply Defaults end for i, v in pairs(SkillLvl) do --v1.1.0 if PetAutoCraftCSave[i] == "Auto" then PetAutoCraftCSave[i] = "^^" end end for i, v in pairs(Tools) do --v1.1.0 if v.Vendor then if PetAutoCraftCSave["Buy"..v.ID] == true then PetAutoCraftCSave["Buy"..v.ID] = 1 elseif PetAutoCraftCSave["Buy"..v.ID] == false then PetAutoCraftCSave["Buy"..v.ID] = 0 end end end for i, v in pairs(SkillLvl) do --v1.4.0 if PetAutoCraftCSave[i] == "^^" then PetAutoCraftCSave[i] = "▲" end end SaveVariables("PetAutoCraftGSave") SaveVariablesPerCharacter("PetAutoCraftCSave") end --[[ Code snippets for later ]]
--[[ © 2018 Thriving Ventures AB do not share, re-distribute or modify without permission of its author (gustaf@thrivingventures.com). _______ _ _ _ _____ |__ __(_) | | | |_ _| | | _ __ _ ___ _ __ | | | | | | | | | |/ _` |/ _ \ '__| | | | | | | | | | | (_| | __/ | | |__| |_| |_ |_| |_|\__, |\___|_| \____/|_____| __/ | |___/ ]] surface.CreateFont("tiger.textentry.label", { font = "Istok", weight = 300, size = 12 }) local panel = {} AccessorFunc(panel, "m_sLabelText", "LabelText", FORCE_STRING) function panel:Init() self:SetSkin("serverguard") self:SetLabelText("") self:SetHistoryEnabled(false) self.History = {} self.HistoryPos = 0 self:SetPaintBorderEnabled(false) self:SetPaintBackgroundEnabled(false) self:SetDrawBorder(true) self:SetDrawBackground(true) self:SetEnterAllowed(true) self:SetUpdateOnType(false) self:SetNumeric(false) self:SetAllowNonAsciiCharacters(true) self:SetTall(30) self:SetCursor("beam") self.m_bLoseFocusOnClickAway = true end function panel:Paint(width, height) local theme = serverguard.themes.GetCurrent() if (vgui.GetKeyboardFocus() == self) then derma.SkinHook("Paint", "TextEntry", self, width, height) else if (self.hovered) then draw.SimpleRect(0, 0, width, height, theme.tiger_list_panel_list_hover) surface.SetTextColor(theme.tiger_list_panel_label_hover) surface.SetFont("tiger.textentry.label") surface.SetTextPos(8, 4) surface.DrawText(self:GetLabelText()) else surface.SetTextColor(theme.tiger_list_panel_list_hover) surface.SetFont("tiger.textentry.label") surface.SetTextPos(8, 4) surface.DrawText(self:GetLabelText()) surface.SetTextColor(theme.tiger_list_panel_label) end surface.SetFont(self:GetFont()) local textWidth, textHeight = surface.GetTextSize(self:GetText()) surface.SetTextPos(8, height - textHeight - 2) surface.DrawText(self:GetText()) end return false end function panel:OnCursorEntered() self:SetCursor("beam") self.hovered = true end function panel:OnCursorExited() self:SetCursor("arrow") self.hovered = nil end vgui.Register("tiger.textentry", panel, "DTextEntry")
-- Base16 Byss Dark color -- Author: Billie Thompson (http://github.com/PurpleBooth) -- to be use in your theme.lua -- symlink or copy to config folder `local color = require('color')` local M = {} M.base00 = "#010114" -- ---- M.base01 = "#022C64" -- --- M.base02 = "#006AA3" -- -- M.base03 = "#0096C7" -- - M.base04 = "#48CAE4" -- + M.base05 = "#BDECF5" -- ++ M.base06 = "#DAF5FA" -- +++ M.base07 = "#F7FDFE" -- ++++ M.base08 = "#FF00A0" -- red M.base09 = "#1BE7FF" -- orange M.base0A = "#F9A03F" -- yellow M.base0B = "#28F6C9" -- green M.base0C = "#40F99B" -- aqua/cyan M.base0D = "#BA0AFF" -- blue M.base0E = "#3B60E4" -- purple M.base0F = "#DDE0E3" -- brown return M
return {'valentijnsdag','val','valabel','valappel','valavond','valbeveiliging','valbijl','valblok','valbrug','valdeur','vale','valentie','valentijnskaart','valeriaan','valeriaanwortel','valeur','valeurs','valgordijn','valhek','valhelm','valhoed','valhoek','valhoogte','validatie','valide','valideren','validering','validiteit','valies','valig','valium','valk','valkachtig','valkenblik','valkenhuis','valkenier','valkenierschap','valkeniershandschoen','valkenjacht','valkenkap','valkennest','valkenoog','valkenvlucht','valkerij','valkhof','valklep','valkruid','valkuil','vallei','vallen','valletje','vallicht','valling','valluik','valmachine','valnet','valoefening','valorisatie','valoriseren','valpartij','valpijp','valreep','valreepsknoop','vals','valsaard','valscherm','valschermjager','valschermspringen','valschermspringer','valschermtroepen','valselijk','valsemunter','valsemunterij','valserik','valshartig','valsheid','valslot','valsmunter','valsmunterij','valsnelheid','valsspeler','valsteiger','valstrik','valstrikken','valtijd','valuatie','valuta','valutabeurs','valutacrisis','valutadekking','valutafonds','valutagebied','valutahandel','valutahandelaar','valutair','valutakoers','valutamarkt','valutaoptie','valutarisico','valutaschommeling','valutaspeculatie','valutateken','valutatransactie','valutaverkeer','valutaverlies','valutaverschil','valutawinst','valuteren','valutering','valversnelling','valwet','valwind','valbeweging','valutaoorlog','valutaspeculant','valgewicht','valutawijziging','valutamarktinterventie','valentijn','valkparkiet','valkenkop','valleigebied','valutadag','valutadatum','valutacode','valeriaanfamilie','valburg','valburger','valburgs','valerie','valkenburg','valkenburger','valkenburgs','valkenisse','valkenswaard','valkenswaarder','valkenswaards','valletta','valpoort','valencia','valentijn','valentin','valentina','valentine','valentino','valeria','valerio','valery','valesca','valerie','valery','valstar','valckx','valster','valent','valkenaars','valks','vallinga','vale','valkering','valke','valkema','valpoort','valkeneer','valente','valappelen','valappels','valbijlen','valblokken','valbruggen','valdeuren','valenties','valer','valere','valerianen','valgordijnen','valhekken','valhelmen','valhoogten','valhoogtes','valideer','valideerde','valideerden','valideert','validen','valiezen','valige','valiger','valkachtige','valken','valkenhuizen','valkeniers','valkenjachten','valkennesten','valkenogen','valkleppen','valkuilen','valleien','valleitje','valleitjes','vallend','vallende','valletjes','vallichten','vallingen','valluiken','valnetten','valorisaties','valoriseer','valoriseerde','valoriseert','valpartijen','valpoorten','valreepsgasten','valrepen','valsaards','valschermen','valschermjagers','valschermlichten','valschermspringers','valse','valsemunterijen','valsemunters','valser','valseriken','valsmunters','valst','valste','valt','valtijden','valuaties','valutas','valutadagen','valutakoersen','valutamarkten','valutaproblemen','valutarisicos','valutaschommelingen','valutaverschillen','valuteerde','valuteert','valuteringspraktijken','valwetten','valwinden','valentijnskaarten','valhoeken','valkenblikken','valkenkappen','valkerijen','valkhoven','valsere','valshartige','valsloten','valsmunterijen','valsnelheden','valsspelers','valsteigers','valutabeurzen','valutaopties','valutatekens','valutatransacties','valutaverliezen','valutawinsten','valabele','valutacrises','valutaire','valutamarktinterventies','valutawijzigingen','valutaspeculanten','valbewegingen','valutaspeculaties','valiesje','valencias','valentijns','valentins','valentinas','valentines','valentinos','valerias','valeries','valerios','valerys','valescas','valeries','valerys','valiesjes','valkparkieten','valleigebieden','valutadata','valkenburgse','valkenswaardse'}
return { version = "1.5", luaversion = "5.1", tiledversion = "1.6.0", orientation = "orthogonal", renderorder = "right-down", width = 40, height = 22, tilewidth = 16, tileheight = 16, nextlayerid = 6, nextobjectid = 1, properties = {}, tilesets = { { name = "0x72_16x16DungeonTileset.v1", firstgid = 1, tilewidth = 16, tileheight = 16, spacing = 0, margin = 0, columns = 16, image = "../Assets/0x72_16x16DungeonTileset.v1.png", imagewidth = 256, imageheight = 160, objectalignment = "unspecified", tileoffset = { x = 0, y = 0 }, grid = { orientation = "orthogonal", width = 16, height = 16 }, properties = {}, wangsets = {}, tilecount = 160, tiles = {} }, { name = "0x72_16x16DungeonTileset_walls.v1", firstgid = 161, tilewidth = 16, tileheight = 16, spacing = 0, margin = 0, columns = 16, image = "../Assets/0x72_16x16DungeonTileset_walls.v1.png", imagewidth = 256, imageheight = 256, objectalignment = "unspecified", tileoffset = { x = 0, y = 0 }, grid = { orientation = "orthogonal", width = 16, height = 16 }, properties = {}, wangsets = {}, tilecount = 256, tiles = {} }, { name = "0x72_16x16DungeonTileset.v4", firstgid = 417, tilewidth = 16, tileheight = 16, spacing = 0, margin = 0, columns = 16, image = "../Assets/0x72_16x16DungeonTileset.v4.png", imagewidth = 256, imageheight = 256, objectalignment = "unspecified", tileoffset = { x = 0, y = 0 }, grid = { orientation = "orthogonal", width = 16, height = 16 }, properties = {}, wangsets = {}, tilecount = 256, tiles = {} } }, layers = { { type = "tilelayer", x = 0, y = 0, width = 40, height = 22, id = 1, name = "Tile Layer 1", visible = true, opacity = 1, offsetx = 0, offsety = 0, parallaxx = 1, parallaxy = 1, properties = {}, encoding = "lua", data = { 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 606, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 606, 117, 117, 622, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 622, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117 } }, { type = "tilelayer", x = 0, y = 0, width = 40, height = 22, id = 2, name = "Tile Layer 2", visible = true, opacity = 1, offsetx = 0, offsety = 0, parallaxx = 1, parallaxy = 1, properties = {}, encoding = "lua", data = { 161, 162, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 162, 163, 177, 178, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 178, 179, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 193, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 195, 209, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { type = "tilelayer", x = 0, y = 0, width = 40, height = 22, id = 5, name = "Tile Layer 3", visible = true, opacity = 1, offsetx = 0, offsety = 0, parallaxx = 1, parallaxy = 1, properties = {}, encoding = "lua", data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 606, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 606, 0, 0, 622, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 622, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } }
function MenuSceneManager:_setup_lobby_characters() local num_player_slots = BigLobbyGlobals:num_player_slots() -- Original Code -- if self._lobby_characters then for _, unit in ipairs(self._lobby_characters) do self:_delete_character_mask(unit) World:delete_unit(unit) end end self._lobby_characters = {} self._characters_offset = Vector3(0, -200, -130) -- End Original Code -- -- Code changed was: -- Replacing hardcoded 4 with variable num_player_slots -- Replacing the local masks variable from hardcoded table to dynamically generated via loop -- Replacing self._characters_rotation from hardcoded table to dynamically generated via loop self._characters_rotation = {} -- Dynamically building a range of rotations, used below and by MenuSceneManager:set_lobby_character_out_fit local min = -130 local max = -56 local range = min - max local steps = range / (num_player_slots-1) -- The first half of rotations is for all peers except local peer: for i = 1, num_player_slots do self._characters_rotation[i] = (((i-1) * steps) + max) end -- The second half of rotations is what the local peer uses based on their peer id: for i = 1, num_player_slots do self._characters_rotation[i+num_player_slots] = (((i-1) * steps) + max) end -- Dummy string filled with "dallas" because that's what it was originally local masks = {} for i = 1, num_player_slots do masks[i] = "dallas" end -- This added logic should alter positioning of players to start at the center -- and expand outwards as the player count grows. local offset = 0 -- Starting offset local peer_rotations = #self._characters_rotation/2 -- eg 4/2->2, 5/2->2.5->3, 6/2->3, 7/2->3.5->4 local center_index = math.ceil(peer_rotations/2) local function get_new_index(index) local is_even = index%2==0 local new_index = is_even and center_index + offset or center_index - offset -- After adding one to the left and one to the right, increase the offset -- Unless starting index is odd, then increase straight after(no left/right) if not is_even then offset = offset + 1 end return new_index end -- Only code changed here was replacing a hardcoded value of 4 with the variable -- num_player_slots and adding the local function above for set_yaw_pitch_roll local mvec = Vector3() local math_up = math.UP local pos = Vector3() local rot = Rotation() for i = 1, num_player_slots do mrotation.set_yaw_pitch_roll(rot, self._characters_rotation[get_new_index(i)], 0, 0) mvector3.set(pos, self._characters_offset) mvector3.rotate_with(pos, rot) mvector3.set(mvec, pos) mvector3.negate(mvec) mvector3.set_z(mvec, 0) mrotation.set_look_at(rot, mvec, math_up) local unit_name = tweak_data.blackmarket.characters.locked.menu_unit local unit = World:spawn_unit(Idstring(unit_name), pos, rot) self:_init_character(unit, i) self:set_character_mask(tweak_data.blackmarket.masks[ masks[i] ].unit, unit, nil, masks[i]) table.insert(self._lobby_characters, unit) self:set_lobby_character_visible(i, false, true) end end function MenuSceneManager:_select_lobby_character_pose(peer_id, unit, weapon_info) -- Original Code -- local state = unit:play_redirect(Idstring("idle_menu")) local weapon_id = managers.weapon_factory:get_weapon_id_by_factory_id(weapon_info.factory_id) local category = tweak_data.weapon[weapon_id].category local lobby_poses = self._lobby_poses[weapon_id] lobby_poses = lobby_poses or self._lobby_poses[category] lobby_poses = lobby_poses or self._lobby_poses.generic if type(lobby_poses[1]) == "string" then local pose = lobby_poses[math.random(#lobby_poses)] unit:anim_state_machine():set_parameter(state, pose, 1) else -- End Original Code -- -- Only modification is to use modulus to make sure our lobby peer is given a pose local pose = lobby_poses[(peer_id % #lobby_poses) + 1][math.random(#lobby_poses[(peer_id % #lobby_poses) + 1])] -- Original Code -- unit:anim_state_machine():set_parameter(state, pose, 1) end -- End Original Code -- end -- TODO: This shouldn't be relevant to gameplay, should be safe to delete. -- Not required for this mod to work, just updates the test function to work with more players -- Only for testing (literally no relevance to the game) -- function MenuSceneManager:test_show_all_lobby_characters(enable_card, pose) -- local num_player_slots = 15--BigLobbyGlobals:num_player_slots() -- pose = pose or "lobby_generic_idle1" -- -- local mvec = Vector3() -- local math_up = math.UP -- local pos = Vector3() -- local rot = Rotation() -- -- Forcing all `self._ti` to be static 1, this was for a predictable outcome -- -- since each call of this function was to test the feature with the client -- -- player in each of the different player slots? -- self._ti = 1--(self._ti or 0) + 1 -- --self._ti = (self._ti - 1) % num_player_slots + 1 -- for i = 1, num_player_slots do -- local is_me = i == self._ti -- log("TEST LOBBY, is_me = " .. tostring(is_me) .. ", i: " .. tostring(i)) -- local unit = self._lobby_characters[i] -- if unit and alive(unit) then -- if enable_card then -- self:set_character_card(i, math.random(25), unit) -- else -- -- Was forcing the pose for some reason instead of fix below? -- self:_set_character_unit_pose(pose, unit) -- -- local state = unit:play_redirect(Idstring("idle_menu")) -- -- Only 4 variations of lobby_generic_idle? 4%4=0 though, might want to + 1 if 0? -- -- unit:anim_state_machine():set_parameter(state, "lobby_generic_idle" .. i%4, 1) -- end -- -- Uses 0+i for rotation index unless it's your player unit then 4+i for some reason? -- -- I guess this explains the 8 values in `self._characters_rotation`, the last half are specific to the client player -- -- TODO: Therefore 4 should really be half of the table size? -- -- will break if not enough rotation indices use a modulus? (or you know, just make the table dynamically built) -- mrotation.set_yaw_pitch_roll(rot, self._characters_rotation[(is_me and 4 or 0) + i], 0, 0) -- mvector3.set(pos, self._characters_offset) -- if is_me then -- mvector3.set_y(pos, mvector3.y(pos) + 100) -- end -- mvector3.rotate_with(pos, rot) -- mvector3.set(mvec, pos) -- mvector3.negate(mvec) -- mvector3.set_z(mvec, 0) -- mrotation.set_look_at(rot, mvec, math_up) -- unit:set_position(pos) -- unit:set_rotation(rot) -- local character = managers.blackmarket:equipped_character() -- local mask_blueprint = managers.blackmarket:equipped_mask().blueprint -- self:change_lobby_character(i, character) -- unit = self._lobby_characters[i] -- self:set_character_mask_by_id(managers.blackmarket:equipped_mask().mask_id, mask_blueprint, unit, i) -- self:set_character_armor(managers.blackmarket:equipped_armor(), unit) -- self:set_lobby_character_visible(i, true) -- end -- end -- -- I seem to have added this, I guess it was for replacing all the dallas with my own unit? and thus weapons. -- managers.menu_scene:_set_character_equipment() -- end -- Modified to hide additional peers. function MenuSceneManager:hide_all_lobby_characters() local num_player_slots = BigLobbyGlobals:num_player_slots() for i = 1, num_player_slots do self:set_lobby_character_visible(i, false, true) end end -- Affects the x or y position by an offset for a player model in lobby? -- TODO: needs to support additional players? -- function MenuSceneManager:character_screen_position(peer_id) -- local unit = self._lobby_characters[peer_id] -- if unit and alive(unit) then -- local is_me = peer_id == managers.network:session():local_peer():id() -- local peer_3_x_offset = 0 -- if peer_id == 3 then -- peer_3_x_offset = is_me and -20 or -40 -- end -- local peer_y_offset = 0 -- if peer_id == 2 then -- peer_y_offset = is_me and -3 or 0 -- elseif peer_id == 3 then -- peer_y_offset = is_me and -7 or 0 -- elseif peer_id == 4 then -- peer_y_offset = is_me and 5 or 0 -- end -- local spine_pos = unit:get_object(Idstring("Spine")):position() + Vector3(peer_3_x_offset, 0, -5 + 15 * (peer_id % 4) + peer_y_offset) -- return self._workspace:world_to_screen(self._camera_object, spine_pos) -- end -- end -- TODO: Probably safe to delete? -- TODO: Instances of 4 might benefit from being increased to additional player value? I don't think they're related.. -- function MenuSceneManager:mouse_moved(o, x, y) -- if managers.menu_component:input_focus() == true or managers.menu_component:input_focus() == 1 then -- return false, "arrow" -- end -- if self._character_grabbed then -- self._character_yaw = self._character_yaw + (x - self._character_grabbed_current_x) / 4 -- if self._use_character_pan and self._character_values and self._scene_templates and self._scene_templates[self._current_scene_template] then -- local new_z = mvector3.z(self._character_values.pos_target) - (y - self._character_grabbed_current_y) / 12 -- local default_z = mvector3.z(self._scene_templates and self._scene_templates[self._current_scene_template].character_pos or self._character_values.pos_current) -- new_z = math.clamp(new_z, default_z - 20, default_z + 10) -- mvector3.set_z(self._character_values.pos_target, new_z) -- end -- self._character_unit:set_rotation(Rotation(self._character_yaw, self._character_pitch)) -- self._character_grabbed_current_x = x -- self._character_grabbed_current_y = y -- return true, "grab" -- end -- if self._item_grabbed then -- if self._item_unit and alive(self._item_unit.unit) then -- local diff = (y - self._item_grabbed_current_y) / 4 -- self._item_yaw = (self._item_yaw + (x - self._item_grabbed_current_x) / 4) % 360 -- local yaw_sin = math.sin(self._item_yaw) -- local yaw_cos = math.cos(self._item_yaw) -- local treshhold = math.sin(45) -- if yaw_cos > -treshhold and yaw_cos < treshhold then -- else -- self._item_pitch = math.clamp(self._item_pitch + diff * yaw_cos, -30, 30) -- end -- if yaw_sin > -treshhold and yaw_sin < treshhold then -- else -- self._item_roll = math.clamp(self._item_roll - diff * yaw_sin, -30, 30) -- end -- mrotation.set_yaw_pitch_roll(self._item_rot_temp, self._item_yaw, self._item_pitch, self._item_roll) -- mrotation.set_zero(self._item_rot) -- mrotation.multiply(self._item_rot, self._camera_object:rotation()) -- mrotation.multiply(self._item_rot, self._item_rot_temp) -- mrotation.multiply(self._item_rot, self._item_rot_mod) -- self._item_unit.unit:set_rotation(self._item_rot) -- local new_pos = self._item_rot_pos + self._item_offset:rotate_with(self._item_rot) -- self._item_unit.unit:set_position(new_pos) -- self._item_unit.unit:set_moving(2) -- end -- self._item_grabbed_current_x = x -- self._item_grabbed_current_y = y -- return true, "grab" -- elseif self._item_move_grabbed and self._item_unit and alive(self._item_unit.unit) then -- local diff_x = (x - self._item_move_grabbed_current_x) / 4 -- local diff_y = (y - self._item_move_grabbed_current_y) / 4 -- local move_v = Vector3(diff_x, 0, -diff_y):rotate_with(self._camera_object:rotation()) -- mvector3.add(self._item_rot_pos, move_v) -- local new_pos = self._item_rot_pos + self._item_offset:rotate_with(self._item_rot) -- self._item_unit.unit:set_position(new_pos) -- self._item_unit.unit:set_moving(2) -- self._item_move_grabbed_current_x = x -- self._item_move_grabbed_current_y = y -- return true, "grab" -- end -- if self._use_item_grab and self._item_grab:inside(x, y) then -- return true, "hand" -- end -- if self._use_character_grab and self._character_grab:inside(x, y) then -- return true, "hand" -- end -- if self._use_character_grab2 and self._character_grab2:inside(x, y) then -- return true, "hand" -- end -- end -- I run the original method, but then need to correct a hardcoded 4 which requires running a bunch -- of logic again. Should be safe. local orig__MenuSceneManager = {} orig__MenuSceneManager.set_lobby_character_out_fit = MenuSceneManager.set_lobby_character_out_fit function MenuSceneManager:set_lobby_character_out_fit(i, outfit_string, rank) local num_player_slots = BigLobbyGlobals:num_player_slots() orig__MenuSceneManager.set_lobby_character_out_fit(self, i, outfit_string, rank) -- Original Code -- as far as flow and relevance is concerned at least. local unit = self._lobby_characters[i] local is_me = i == managers.network:session():local_peer():id() local mvec = Vector3() local math_up = math.UP local pos = Vector3() local rot = Rotation() -- End Original Code -- -- Only the hardcoded 4 here is changed to a variable -- The 4 refers to halfway point of the rotation table, not player count. mrotation.set_yaw_pitch_roll(rot, self._characters_rotation[(is_me and num_player_slots or 0) + i], 0, 0) -- Original Code -- mvector3.set(pos, self._characters_offset) if is_me then mvector3.set_y(pos, mvector3.y(pos) + 100) end mvector3.rotate_with(pos, rot) mvector3.set(mvec, pos) mvector3.negate(mvec) mvector3.set_z(mvec, 0) mrotation.set_look_at(rot, mvec, math_up) unit:set_position(pos) unit:set_rotation(rot) self:set_lobby_character_visible(i, true) -- End Original Code -- end
--[[ Swaggy Jenkins Jenkins API clients generated from Swagger / Open API specification The version of the OpenAPI document: 1.1.2-pre.0 Contact: blah@cliffano.com Generated by: https://openapi-generator.tech ]] -- github_repositorieslinks class local github_repositorieslinks = {} local github_repositorieslinks_mt = { __name = "github_repositorieslinks"; __index = github_repositorieslinks; } local function cast_github_repositorieslinks(t) return setmetatable(t, github_repositorieslinks_mt) end local function new_github_repositorieslinks(self, _class) return cast_github_repositorieslinks({ ["self"] = self; ["_class"] = _class; }) end return { cast = cast_github_repositorieslinks; new = new_github_repositorieslinks; }
local skyla = require "skyla" local C = require "skyla_panel" local parent = require "skyla.game_object.node" local panel = { init = C.init, } setmetatable(panel, {__index = parent}) function panel.new(...) local obj = { __cobj = C.new(...), __children = {}, } setmetatable(obj, {__index = panel}) return obj end return panel
-- This file is generated by proto-gen-lua. DO NOT EDIT. -- The protoc version is 'v3.19.2' -- The proto-gen-lua version is 'Develop' local protobuf = require "protobuf.protobuf" local registry = require "protobuf.registry" local proto3_fields_pb_desc = require "proto3.fields_pb_desc" local proto3_fields_pb = {} ---@alias proto3_fields_pb.FieldTestMessage.Enum ---| 'proto3_fields_pb.FieldTestMessage.Enum.ZERO' # = 0 ---@class proto3_fields_pb.FieldTestMessage.MapInt32Int64Entry : protobuf.Message ---@field key number ---@field value number ---@class proto3_fields_pb.FieldTestMessage.MapStringMessageEntry : protobuf.Message ---@field key string ---@field value proto3_fields_pb.FieldTestMessage.Message ---@class proto3_fields_pb.FieldTestMessage.MapFixed64EnumEntry : protobuf.Message ---@field key number ---@field value proto3_fields_pb.FieldTestMessage.Enum ---@class proto3_fields_pb.FieldTestMessage.Message : protobuf.Message ---@class proto3_fields_pb.FieldTestMessage : protobuf.Message ---@field optional_bool string ---@field optional_enum proto3_fields_pb.FieldTestMessage.Enum ---@field optional_int32 number ---@field optional_sint32 number ---@field optional_uint32 number ---@field optional_int64 number ---@field optional_sint64 number ---@field optional_uint64 number ---@field optional_sfixed32 number ---@field optional_fixed32 number ---@field optional_float number ---@field optional_sfixed64 number ---@field optional_fixed64 number ---@field optional_double number ---@field optional_string string ---@field optional_bytes string ---@field optional_Message proto3_fields_pb.FieldTestMessage.Message ---@field repeated_bool boolean[] ---@field repeated_enum proto3_fields_pb.FieldTestMessage.Enum[] ---@field repeated_int32 number[] ---@field repeated_sint32 number[] ---@field repeated_uint32 number[] ---@field repeated_int64 number[] ---@field repeated_sint64 number[] ---@field repeated_uint64 number[] ---@field repeated_sfixed32 number[] ---@field repeated_fixed32 number[] ---@field repeated_float number[] ---@field repeated_sfixed64 number[] ---@field repeated_fixed64 number[] ---@field repeated_double number[] ---@field repeated_string string[] ---@field repeated_bytes string[] ---@field repeated_Message proto3_fields_pb.FieldTestMessage.Message[] ---@field map_int32_int64 dict<number, number> ---@field map_string_message dict<string, proto3_fields_pb.FieldTestMessage.Message> ---@field map_fixed64_enum dict<number, proto3_fields_pb.FieldTestMessage.Enum> proto3_fields_pb.FieldTestMessage.Enum = {} proto3_fields_pb.FieldTestMessage.Enum._FullName = ".goproto.protoc.proto3.FieldTestMessage.Enum" proto3_fields_pb.FieldTestMessage.Enum._Descriptor = "proto3_fields_pb_desc.message_type[1].enum_type[1]" proto3_fields_pb.FieldTestMessage.Enum.ZERO = 0 proto3_fields_pb.FieldTestMessage.Enum[0] = ".goproto.protoc.proto3.FieldTestMessage.Enum.ZERO" registry.RegistEnum(proto3_fields_pb.FieldTestMessage.Enum) ---@type fun():proto3_fields_pb.FieldTestMessage.MapInt32Int64Entry proto3_fields_pb.FieldTestMessage.MapInt32Int64Entry = protobuf.Message(proto3_fields_pb_desc.message_type[1].nested_type[1]) proto3_fields_pb.FieldTestMessage.MapInt32Int64Entry._FullName = ".goproto.protoc.proto3.FieldTestMessage.MapInt32Int64Entry" proto3_fields_pb.FieldTestMessage.MapInt32Int64Entry._Descriptor = "proto3_fields_pb_desc.message_type[1].nested_type[1]" registry.RegistMessage(proto3_fields_pb.FieldTestMessage.MapInt32Int64Entry) ---@type fun():proto3_fields_pb.FieldTestMessage.MapStringMessageEntry proto3_fields_pb.FieldTestMessage.MapStringMessageEntry = protobuf.Message(proto3_fields_pb_desc.message_type[1].nested_type[2]) proto3_fields_pb.FieldTestMessage.MapStringMessageEntry._FullName = ".goproto.protoc.proto3.FieldTestMessage.MapStringMessageEntry" proto3_fields_pb.FieldTestMessage.MapStringMessageEntry._Descriptor = "proto3_fields_pb_desc.message_type[1].nested_type[2]" registry.RegistMessage(proto3_fields_pb.FieldTestMessage.MapStringMessageEntry) ---@type fun():proto3_fields_pb.FieldTestMessage.MapFixed64EnumEntry proto3_fields_pb.FieldTestMessage.MapFixed64EnumEntry = protobuf.Message(proto3_fields_pb_desc.message_type[1].nested_type[3]) proto3_fields_pb.FieldTestMessage.MapFixed64EnumEntry._FullName = ".goproto.protoc.proto3.FieldTestMessage.MapFixed64EnumEntry" proto3_fields_pb.FieldTestMessage.MapFixed64EnumEntry._Descriptor = "proto3_fields_pb_desc.message_type[1].nested_type[3]" registry.RegistMessage(proto3_fields_pb.FieldTestMessage.MapFixed64EnumEntry) ---@type fun():proto3_fields_pb.FieldTestMessage.Message proto3_fields_pb.FieldTestMessage.Message = protobuf.Message(proto3_fields_pb_desc.message_type[1].nested_type[4]) proto3_fields_pb.FieldTestMessage.Message._FullName = ".goproto.protoc.proto3.FieldTestMessage.Message" proto3_fields_pb.FieldTestMessage.Message._Descriptor = "proto3_fields_pb_desc.message_type[1].nested_type[4]" registry.RegistMessage(proto3_fields_pb.FieldTestMessage.Message) ---@type fun():proto3_fields_pb.FieldTestMessage proto3_fields_pb.FieldTestMessage = protobuf.Message(proto3_fields_pb_desc.message_type[1]) proto3_fields_pb.FieldTestMessage._FullName = ".goproto.protoc.proto3.FieldTestMessage" proto3_fields_pb.FieldTestMessage._Descriptor = "proto3_fields_pb_desc.message_type[1]" registry.RegistMessage(proto3_fields_pb.FieldTestMessage) return proto3_fields_pb
solution "freeglut" configurations {"Debug", "Release"} defines {"_CRT_SECURE_NO_WARNINGS", "_SCL_SECURE_NO_WARNINGS"} dofile("freeglut.lua"); local dirs = os.matchdirs("progs/demos/*") for i, dir in ipairs(dirs) do local baseDir = path.getname(dir); if(baseDir ~= "bin" and baseDir ~= "obj") then project(baseDir) kind "ConsoleApp" language "c" includedirs {"include"} targetdir(dir) objdir(dir .. "/obj") files {dir .. "/*.c"}; defines {"FREEGLUT_STATIC", "_LIB", "FREEGLUT_LIB_PRAGMAS=0"} links {"freeglut"} configuration "windows" defines "WIN32" links {"glu32", "opengl32", "gdi32", "winmm", "user32"} configuration "linux" links {"GL"} configuration "Debug" targetsuffix "D" defines "_DEBUG" flags "Symbols" configuration "Release" defines "NDEBUG" flags {"OptimizeSpeed", "NoFramePointer", "ExtraWarnings", "NoEditAndContinue"}; end end
--[[-------------------------- FILE: sprite.lua AUTH: Ibrahim Sardar DATE: 11 / 11 / 2016 --]]-------------------------- -- dependencies require("SECL") --| Sprite Class --| Sprite = class() -- -\ -- --> --- PROPERTIES ----------------------------------------< -- -/ -- pic Sprite.pic = nil Sprite.pic_lord = "" -- size Sprite.scale_x = 1 Sprite.scale_y = 1 -- pos Sprite.x = 0 Sprite.y = 0 -- vel Sprite.speed = 0 Sprite.dx = 0 Sprite.dy = 0 -- acc Sprite.accel = 0 -- ang Sprite.dir = 0 Sprite.rot = 0 Sprite.dr = 0 Sprite.max_rot = 0 -- time Sprite.elapsed = 0 -- memberships Sprite.group = nil -- debug Sprite.is_debug = false Sprite.d_delay = 0 Sprite.d_timer = 0 -- other Sprite.dead = false Sprite.layer = 0 --> default layer -- -\ -- --> --- ESSENTIAL methods ---------------------------------< -- -/ function Sprite:load( img, x, y ) --| constructor --| self.pic_lord = img self.pic = love.graphics.newImage( img ) self.x = x self.y = y end function Sprite:update(dt) --| Called every frame. Updates changing --| parameters. --| -- skip if marked for deletion if self.dead == true then return end -- update clock self.elapsed = self.elapsed + dt -- update all movement self:move() -- bounds the sprite appropriately self:bound(); -- user custom event handler self:interact(); -- user custom update self:update_more(); end function Sprite:draw(dt) --| Called every frame. Processes graphics --| based on current parameters. --| -- skip if marked for deletion if self.dead == true then return end -- degs to radians local rot = self.dir * math.pi / 180 rot = rot * -1 -- draw love.graphics.draw ( self.pic, self.x, self.y, rot, self.scale_x, self.scale_y, self:get_w_orig()/2, self:get_h_orig()/2 ) end function Sprite:destroy() --| Marks current instance for deletion --| self.dead = true self = nil end -- -\ -- --> --- SUB-ESSENTIAL methods -----------------------------< -- -/ function Sprite:move() --| Called in update. Updates position and --| rotation. --| -- acceleration: -- -- linear self.speed = self.speed + self.accel -- angular self.rot = self.rot + self.dr self.dir = self.dir + self.dr -- speed: -- -- get radians local theta = self.dir * math.pi / 180 theta = theta * -1 -- speed vector self.dx = math.cos(theta) * self.speed self.dy = math.sin(theta) * self.speed -- update difference in x and y position self.x = self.x + self.dx self.y = self.y + self.dy end function Sprite:bound() --| Called in update. Default destroy --| on leave screen +/- 50. --| Meant to be over-ridden. --| local offset = 50 local w = love.graphics.getWidth() local h = love.graphics.getHeight() local r = self:get_right() + offset local t = self:get_top() - offset local l = self:get_left() - offset local b = self:get_bottom() + offset if r < 0 or t > h or l > w or b < 0 then self:destroy() end end function Sprite:update_more() --| Called in update. Meant to be over-ridden. --| return end function Sprite:interact() --| Called in update. Meant to be over-ridden. --| Meant to be used as an event-handler. --| return end -- -\ -- --> --- GET methods ---------------------------------------< -- -/ --### --###> visual: function Sprite:get_w() --| Returns width of sprite. --| return self.pic:getWidth() * self.scale_x end function Sprite:get_h() --| Returns height of sprite. --| return self.pic:getHeight() * self.scale_y end function Sprite:get_w_orig() --| Returns original width of sprite. --| return self.pic:getWidth() end function Sprite:get_h_orig() --| Returns original height of sprite. --| return self.pic:getHeight() end function Sprite:get_pic() --| Returns the image link of sprite. --| return self.pic_lord end function Sprite:get_scalex() --| Returns image scale in the x direction --| return self.scale_x end function Sprite:get_scaley() --| Returns image scale in the y direction --| return self.scale_y end --### --###> positional: function Sprite:get_x() --| Returns the accurate x position. --| ( left ) --| return self.x end function Sprite:get_y() --| Returns the accurate y position. --| ( top ) --| return self.y end function Sprite:get_pos() --| Returns the accurate position. --| ( top left ) --| return {self.x, self.y} end function Sprite:get_cx() --| Returns the accurate center x position. --| return self.x + ( self:get_w()/2 ) end function Sprite:get_cy() --| Returns the accurate center y position. --| return self.y + ( self:get_h()/2 ) end function Sprite:get_center() --| Returns the accurate center position. --| return { self:get_cx(), self:get_cy() } end function Sprite:get_right() --| Returns the accurate right x position. --| return self.x + self:get_w() end function Sprite:get_top() --| Returns the accurate top y position. --| return self.y end function Sprite:get_left() --| Returns the accurate left x position. --| return self.x end function Sprite:get_bottom() --| Returns the accurate bottom y position. --| return self.y + self:get_h() end --### --###> speed-related: function Sprite:get_speedx() --| Returns the accurate speed in --| the x direction. --| local rads = self.dir * math.pi / 180 return math.cos(rads) * self.speed end function Sprite:get_speedy() --| Returns the accurate speed in --| the y direction. --| local rads = self.dir * math.pi / 180 return math.sin(rads) * self.speed * -1 end function Sprite:get_speed() --| Returns the accurate speed. --| return self.speed end --### --###> acceleration-related: function Sprite:get_accelx() --| Returns the accurate acceleration --| in the x direction. --| local rads = self.dir * math.pi / 180 return math.cos(rads) * self.accel end function Sprite:get_accely() --| Returns the accurate acceleration --| in the y direction. --| local rads = self.dir * math.pi / 180 return math.sin(rads) * self.accel * -1 end function Sprite:get_accel() --| Returns the accurate acceleration. --| return self.accel end --### --###> angular: function Sprite:get_dir() --| Returns the accurate direction. (deg) --| return self.dir end function Sprite:get_ang_speed() --| Returns the accurate angular speed. --| (deg per update) --| return self.rot end function Sprite:get_ang_accel() --| Returns the accurate angular acceleration. --| (angular speed per update) --| return self.dr end --### --###> other: function Sprite:is_destroyed() --| Returns true if sprite is dead/destroyed --| return self.dead end function Sprite:get_elapsed() --| Returns elapsed time since last updated --| return self.elapsed end function Sprite:get_layer() --| Returns sprite's layer. --| (used for collision, not visuals) --| return self.layer end function Sprite:get_population() --| Returns group of sprites self is aware of --| return self.group end -- -\ -- --> --- SET methods ---------------------------------------< -- -/ --### --###> visual: function Sprite:set_pic( img ) --| Initializes sprite graphics. "img" is --| the image file link. self.pic_lord = img self.pic = love.graphics.newImage( img ) end function Sprite:scale( n ) --| Scale sprite by n in all directions. --| self.scale_x = n self.scale_y = n end function Sprite:scale_width( n ) --| Scale sprite by n in the x axis. --| self.scale_x = n end function Sprite:scale_height( n ) --| Scale sprite by n in the y axis. --| self.scale_y = n end --### --###> positional: function Sprite:set_x( x ) --| Sets x position. (left) --| self.x = x end function Sprite:set_y( y ) --| Sets y position. (top) --| self.y = y end function Sprite:set_pos( x,y ) --| Sets position. (top left) --| self.x = x self.y = y end function Sprite:set_cx( cx ) --| Sets center x position. --| self.x = cx - ( self:get_w()/2 ) end function Sprite:set_cy( cy ) --| Sets center y position. --| self.y = cy - ( self:get_h()/2 ) end function Sprite:set_center( cx,cy ) --| Sets center position. --| self:set_cx( cx ) self:set_cy( cy ) end function Sprite:set_right( a ) --| Sets right x position. --| self.x = a + ( self:get_w()/2 ) end function Sprite:set_top( a ) --| Sets top y position. --| self.y = a end function Sprite:set_left( a ) --| Sets left x position. --| self.x = a end function Sprite:set_bottom( a ) --| Sets bottom y position. --| self.y = a + ( self:get_h()/2 ) end --### --###> speed-related: function Sprite:set_speed( spd ) --| Sets the accurate speed. --| self.speed = spd end --### --###> acceleration-related: function Sprite:set_accel( acl ) --| Sets the accurate acceleration. --| self.accel = acl end --### --###> angular: function Sprite:set_dir( ang ) --| Sets the accurate direction --| self.dir = ang end function Sprite:set_turn( ang ) --| Sets the accurate direction and --| rotation --| self.dir = ang self.rot = ang end function Sprite:set_ang_accel( angaccel ) --| Sets the accurate angular acceleration --| self.dr = -angaccel end --### --###> other: function Sprite:set_layer( level ) --| Sets sprite's layer. --| (used for collision, not visuals) --| self.layer = level end function Sprite:set_population( pop ) --| Sets group of sprites self is aware of --| self.group = pop end -- -\ -- --> --- OTHER methods -------------------------------------< -- -/ function Sprite:colliding( spr ) --| if input sprite is colliding and is in --| the same layer as self, return true --| -- you local urr = spr:get_right() local urt = spr:get_top() local url = spr:get_left() local urb = spr:get_bottom() -- me local myr = self:get_right() local myt = self:get_top() local myl = self:get_left() local myb = self:get_bottom() -- check layer if spr.layer == self.layer then -- check collision if myr > url and myt < urb and myl < urr and myb > urt then return true end end return false end function Sprite:reset_time() --| Resets elapsed time to 0 --| self.elapsed = 0 end function Sprite:__debug( delay ) --| Print all of self's info every 'delay' frames. --| (stops printing if delay is < 1) --| -- ... return end function Sprite:__trace() --| Print all of self's info if debug --| interval reached. --| -- ... return end
server_scripts { 'server.lua' }
redis = require 'redis-async.redis_conn' return redis
local utils = require "kong.tools.utils" local cjson = require "cjson" local pl_pretty = require "pl.pretty" local tablex = require "pl.tablex" local app_helpers = require "lapis.application" local arguments = require "kong.api.arguments" local Errors = require "kong.db.errors" local singletons = require "kong.singletons" local ngx = ngx local sub = string.sub local find = string.find local type = type local pairs = pairs local ipairs = ipairs local _M = {} local NO_ARRAY_INDEX_MARK = {} -- Parses a form value, handling multipart/data values -- @param `v` The value object -- @return The parsed value local function parse_value(v) return type(v) == "table" and v.content or v -- Handle multipart end -- given a string like "x[1].y", return an array of indices like {"x", 1, "y"} -- the path parameter is an output-only param. the keys are added to it in order local function key_to_path(key, path) -- try to match an array access like x[1]. -- the left side of the [] is mandatory -- the array index can be omitted (the key will look like x[]). -- if that's the case we mark the path entry with a special key local left, array_index = key:match("^(.+)%[(%d*)]$") if left then key_to_path(left, path) path[#path + 1] = tonumber(array_index) or NO_ARRAY_INDEX_MARK return path end -- if no match, try a hash access like x.y (both x and y are mandatory) -- the left side of the dot is called left and the other side is right local left, right = key:match("^(.+)%.(.+)$") if left then key_to_path(left, path) key_to_path(right, path) return path end -- if no match found, append the whole key to the path as a single string path[#path + 1] = key return path end -- when NO_ARRAY_INDEX is encountered, replace it with the length of the node being parsed local function transform_no_array_index_mark(path_entry, node) if path_entry == NO_ARRAY_INDEX_MARK then return #node + 1 end return path_entry end -- Put nested keys in objects: -- Normalize dotted keys in objects. -- Example: {["key.value.sub"]=1234} becomes {key = {value = {sub=1234}} -- @param `obj` Object to normalize -- @return `normalized_object` function _M.normalize_nested_params(obj) local new_obj = {} local is_array for k, v in pairs(obj) do is_array = false if type(v) == "table" then -- normalize arrays since Lapis parses ?key[1]=foo as {["1"]="foo"} instead of {"foo"} if utils.is_array(v) then is_array = true local arr = {} for _, arr_v in pairs(v) do arr[#arr+1] = arr_v end v = arr else v = _M.normalize_nested_params(v) -- recursive call on other table values end end v = parse_value(v) -- normalize sub-keys with hash or array accesses if type(k) == "string" then local path = key_to_path(k, {}) local path_len = #path local node = new_obj local prev = new_obj local path_entry -- create any missing tables when dealing with x.foo[1].y = "bar" for i = 1, path_len - 1 do path_entry = transform_no_array_index_mark(path[i], node) node[path_entry] = node[path_entry] or {} prev = node node = node[path_entry] end -- on the last item of the path (the "y" in the example above) if path[path_len] == NO_ARRAY_INDEX_MARK and is_array then -- edge case: we are assigning an array to a no-array index mark: x[] = {1,2,3} -- on this case we backtrack one element (we use `prev` instead of `node`) -- and we set it to the array (v) -- this edge case is needed because Lapis builds params like that (flatten_params function) prev[path_entry or k] = v else -- regular case: the last element is similar to the loop iteration. -- instead of a table, we set the value (v) on the last element node[transform_no_array_index_mark(path[path_len], node)] = v end else new_obj[k] = v -- nothing special with that key, simply attaching the value end end return new_obj end -- Remove functions from a schema definition so that -- cjson can encode the schema. local schema_to_jsonable do local insert = table.insert local ipairs = ipairs local next = next local fdata_to_jsonable local function fields_to_jsonable(fields) local out = {} for _, field in ipairs(fields) do local fname = next(field) local fdata = field[fname] insert(out, { [fname] = fdata_to_jsonable(fdata, "no") }) end setmetatable(out, cjson.array_mt) return out end -- Convert field data from schemas into something that can be -- passed to a JSON encoder. -- @tparam table fdata A Lua table with field data -- @tparam string is_array A three-state enum: "yes", "no" or "maybe" -- @treturn table A JSON-convertible Lua table fdata_to_jsonable = function(fdata, is_array) local out = {} local iter = is_array == "yes" and ipairs or pairs for k, v in iter(fdata) do if is_array == "maybe" and type(k) ~= "number" then is_array = "no" end if k == "schema" then out[k] = schema_to_jsonable(v) elseif type(v) == "table" then if k == "fields" and fdata.type == "record" then out[k] = fields_to_jsonable(v) elseif k == "default" and fdata.type == "array" then out[k] = fdata_to_jsonable(v, "yes") else out[k] = fdata_to_jsonable(v, "maybe") end elseif type(v) == "number" then if v ~= v then out[k] = "nan" elseif v == math.huge then out[k] = "inf" elseif v == -math.huge then out[k] = "-inf" else out[k] = v end elseif type(v) ~= "function" then out[k] = v end end if is_array == "yes" or is_array == "maybe" then setmetatable(out, cjson.array_mt) end return out end schema_to_jsonable = function(schema) local fields = fields_to_jsonable(schema.fields) return { fields = fields } end _M.schema_to_jsonable = schema_to_jsonable end local NEEDS_BODY = tablex.readonly({ PUT = 1, POST = 2, PATCH = 3 }) function _M.before_filter(self) if not NEEDS_BODY[ngx.req.get_method()] then return end local content_type = self.req.headers["content-type"] if not content_type then local content_length = self.req.headers["content-length"] if content_length == "0" then return end if not content_length then local _, err = ngx.req.socket() if err == "no body" then return end end elseif sub(content_type, 1, 16) == "application/json" or sub(content_type, 1, 19) == "multipart/form-data" or sub(content_type, 1, 33) == "application/x-www-form-urlencoded" then return end return kong.response.exit(415) end local function parse_params(fn) return app_helpers.json_params(function(self, ...) if NEEDS_BODY[ngx.req.get_method()] then local content_type = self.req.headers["content-type"] if content_type then content_type = content_type:lower() if find(content_type, "application/json", 1, true) and not self.json then return kong.response.exit(400, { message = "Cannot parse JSON body" }) elseif find(content_type, "application/x-www-form-urlencode", 1, true) then self.params = utils.decode_args(self.params) end end end self.params = _M.normalize_nested_params(self.params) local res, err = fn(self, ...) if err then kong.log.err(err) return ngx.exit(500) end if res == nil and ngx.status >= 200 then return ngx.exit(0) end return res end) end -- new DB local function new_db_on_error(self) local err = self.errors[1] if type(err) ~= "table" then kong.log.err(err) return kong.response.exit(500, { message = "An unexpected error occurred" }) end if err.strategy then err.strategy = nil end if err.code == Errors.codes.SCHEMA_VIOLATION or err.code == Errors.codes.INVALID_PRIMARY_KEY or err.code == Errors.codes.FOREIGN_KEY_VIOLATION or err.code == Errors.codes.INVALID_OFFSET or err.code == Errors.codes.FOREIGN_KEYS_UNRESOLVED then return kong.response.exit(400, err) end if err.code == Errors.codes.NOT_FOUND then return kong.response.exit(404, err) end if err.code == Errors.codes.OPERATION_UNSUPPORTED then kong.log.err(err) return kong.response.exit(405, err) end if err.code == Errors.codes.PRIMARY_KEY_VIOLATION or err.code == Errors.codes.UNIQUE_VIOLATION then return kong.response.exit(409, err) end kong.log.err(err) return kong.response.exit(500, { message = "An unexpected error occurred" }) end -- old DAO local function on_error(self) local err = self.errors[1] if type(err) ~= "table" then kong.log.err(err) return kong.response.exit(500, { message = "An unexpected error occurred" }) end if err.name then return new_db_on_error(self) end if err.db then kong.log.err(err.message) return kong.response.exit(500, { message = "An unexpected error occurred" }) end if err.unique then return kong.response.exit(409, err.tbl) end if err.foreign then return kong.response.exit(404, err.tbl or { message = "Not found" }) end return kong.response.exit(400, err.tbl or err.message) end local handler_helpers = { yield_error = app_helpers.yield_error } function _M.attach_routes(app, routes) for route_path, methods in pairs(routes) do methods.on_error = methods.on_error or on_error for method_name, method_handler in pairs(methods) do local wrapped_handler = function(self) return method_handler(self, {}, handler_helpers) end methods[method_name] = parse_params(wrapped_handler) end app:match(route_path, route_path, app_helpers.respond_to(methods)) end end function _M.attach_new_db_routes(app, routes) for route_path, definition in pairs(routes) do local schema = definition.schema local methods = definition.methods methods.on_error = methods.on_error or new_db_on_error for method_name, method_handler in pairs(methods) do local wrapped_handler = function(self) self.args = arguments.load({ schema = schema, request = self.req, }) return method_handler(self, singletons.db, handler_helpers) end methods[method_name] = parse_params(wrapped_handler) end app:match(route_path, route_path, app_helpers.respond_to(methods)) end end function _M.default_route(self) local path = self.req.parsed_url.path:match("^(.*)/$") if path and self.app.router:resolve(path, self) then return elseif self.app.router:resolve(self.req.parsed_url.path .. "/", self) then return end return self.app.handle_404(self) end function _M.handle_404(self) return kong.response.exit(404, { message = "Not found" }) end function _M.handle_error(self, err, trace) if err then if type(err) ~= "string" then err = pl_pretty.write(err) end if find(err, "don't know how to respond to", nil, true) then return kong.response.exit(405, { message = "Method not allowed" }) end end ngx.log(ngx.ERR, err, "\n", trace) -- We just logged the error so no need to give it to responses and log it -- twice return kong.response.exit(500, { message = "An unexpected error occurred" }) end return _M
if not modules then modules = { } end modules ['toks-map'] = { version = 1.001, author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -- Even more experimental ... this used to be part of toks-ini but as -- this kind of remapping has not much use it is not loaded in the -- core. We just keep it here for old times sake. -- local remapper = { } -- namespace -- collectors.remapper = remapper -- -- local remapperdata = { } -- user mappings -- remapper.data = remapperdata -- -- function remapper.store(tag,class,key) -- local s = remapperdata[class] -- if not s then -- s = { } -- remapperdata[class] = s -- end -- s[key] = collectordata[tag] -- collectordata[tag] = nil -- end -- -- function remapper.convert(tag,toks) -- local data = remapperdata[tag] -- local leftbracket = utfbyte('[') -- local rightbracket = utfbyte(']') -- local skipping = 0 -- -- todo: math -- if data then -- local t, n = { }, 0 -- for s=1,#toks do -- local tok = toks[s] -- local one, two = tok[1], tok[2] -- if one == 11 or one == 12 then -- if two == leftbracket then -- skipping = skipping + 1 -- n = n + 1 ; t[n] = tok -- elseif two == rightbracket then -- skipping = skipping - 1 -- n = n + 1 ; t[n] = tok -- elseif skipping == 0 then -- local new = data[two] -- if new then -- if #new > 1 then -- for n=1,#new do -- n = n + 1 ; t[n] = new[n] -- end -- else -- n = n + 1 ; t[n] = new[1] -- end -- else -- n = n + 1 ; t[n] = tok -- end -- else -- n = n + 1 ; t[n] = tok -- end -- else -- n = n + 1 ; t[n] = tok -- end -- end -- return t -- else -- return toks -- end -- end
--!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 utils.lua -- -- load modules local io = require("base/io") local os = require("base/os") local utils = require("base/utils") local colors = require("base/colors") local option = require("base/option") local log = require("base/log") local try = require("sandbox/modules/try") local catch = require("sandbox/modules/catch") local vformat = require("sandbox/modules/vformat") -- define module local sandbox_utils = sandbox_utils or {} -- inherit the public interfaces of utils for k, v in pairs(utils) do if not k:startswith("_") and type(v) == "function" then sandbox_utils[k] = v end end -- print each arguments function sandbox_utils._print(...) -- format each arguments local args = {} for _, arg in ipairs({...}) do if type(arg) == "string" then table.insert(args, vformat(arg)) else table.insert(args, arg) end end -- print multi-variables with raw lua action utils._print(unpack(args)) -- write to the log file log:printv(unpack(args)) end -- print format string with newline -- print builtin-variables with $(var) -- print multi-variables with raw lua action -- function sandbox_utils.print(format, ...) -- print format string if type(format) == "string" and format:find("%", 1, true) then local args = {...} try { function () -- attempt to format message local message = vformat(format, unpack(args)) -- trace utils._print(message) -- write to the log file log:printv(message) end, catch { function (errors) -- print multi-variables with raw lua action sandbox_utils._print(format, unpack(args)) end } } else -- print multi-variables with raw lua action sandbox_utils._print(format, ...) end end -- print format string and the builtin variables without newline function sandbox_utils.printf(format, ...) -- init message local message = vformat(format, ...) -- trace utils._iowrite(message) -- write log to the log file log:write(message) end -- print format string, the builtin variables and colors with newline function sandbox_utils.cprint(format, ...) -- init message local message = vformat(format, ...) -- trace utils._print(colors.translate(message)) -- write log to the log file if log:file() then log:printv(colors.ignore(message)) end end -- print format string, the builtin variables and colors without newline function sandbox_utils.cprintf(format, ...) -- init message local message = vformat(format, ...) -- trace utils._iowrite(colors.translate(message)) -- write log to the log file if log:file() then log:write(colors.ignore(message)) end end -- print the verbose information function sandbox_utils.vprint(format, ...) if option.get("verbose") then sandbox_utils.print(format, ...) end end -- print the verbose information without newline function sandbox_utils.vprintf(format, ...) if option.get("verbose") then sandbox_utils.printf(format, ...) end end -- print the diagnosis information function sandbox_utils.dprint(format, ...) if option.get("diagnosis") then sandbox_utils.print(format, ...) end end -- print the diagnosis information without newline function sandbox_utils.dprintf(format, ...) if option.get("diagnosis") then sandbox_utils.printf(format, ...) end end -- assert function sandbox_utils.assert(value, format, ...) -- check if not value then if format ~= nil then os.raiselevel(2, format, ...) else os.raiselevel(2, "assertion failed!") end end -- return it return value end -- get user confirm function sandbox_utils.confirm(opt) return utils.confirm(opt) end -- dump value -- do not change to a function call to utils.dump since debug.getinfo is called in utils.dump to get caller info sandbox_utils.dump = utils.dump -- return module return sandbox_utils
--[[-------------------------------------------------------------------------- -- -- File: UIScrollBar.lua -- Copyright (c) Ubisoft Entertainment. All rights reserved. -- -- Project: Ubitoys.Tag -- Date: Novermber 09, 2010 -- ------------------------------------------------------------------------------ -- -- Description: ... -- ----------------------------------------------------------------------------]] --[[ Dependencies ----------------------------------------------------------]] require "UI/UIMultiComponent" require "UI/UIButton" --[[ Class -----------------------------------------------------------------]] UTClass.UIScrollBar(UIMultiComponent) -- default UIScrollBar.defaultOffset = 24 -- __ctor ------------------------------------------------------------------- function UIScrollBar:__ctor(location, height) self.location = location or { 0, 0 } self.height = height or 100 -- up button self.uiButtonUp = self:AddComponent(UIButton:New(), "uiButtonUp") self.uiButtonUp.OnAction = function () if (self.OnActionUp) then quartz.framework.audio.loadsound("base:audio/ui/validation.wav") quartz.framework.audio.loadvolume(game.settings.audio["volume:sfx"]) quartz.framework.audio.playsound() -- lift self.currentIndex = math.max(0, self.currentIndex - 1) self:SetLift(24 + self.currentIndex * self.offset) if (self.OnActionUp) then self:OnActionUp() end end end self.uiButtonUp.states = { [ST_DISABLED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowUp_Disabled.tga" }, [ST_DISABLED + ST_FOCUSED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowUp_Disabled.tga" }, [ST_ENABLED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowUp.tga" }, [ST_ENABLED + ST_FOCUSED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowUp_Focused.tga" }, [ST_ENABLED + ST_CLICKED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowUp_Focused.tga" }, [ST_ENABLED + ST_FOCUSED + ST_CLICKED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowUp__Entered.tga" }, } self.uiButtonUp.rectangle = { self.location[1], self.location[2], self.location[1] + 24, self.location[2] + 24 } self.uiButtonUp.opaque = true self.uiButtonUp.sensitive = true -- down button self.uiButtonDown = self:AddComponent(UIButton:New(), "uiButtonDown") self.uiButtonDown.OnAction = function () if (self.OnActionDown) then quartz.framework.audio.loadsound("base:audio/ui/validation.wav") quartz.framework.audio.loadvolume(game.settings.audio["volume:sfx"]) quartz.framework.audio.playsound() -- lift self.currentIndex = math.min(self.maxIndex, self.currentIndex + 1) self:SetLift(24 + self.currentIndex * self.offset) if (self.OnActionDown) then self:OnActionDown() end end end self.uiButtonDown.states = { [ST_DISABLED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowDown_Disabled.tga" }, [ST_DISABLED + ST_FOCUSED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowDown_Disabled.tga" }, [ST_ENABLED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowDown.tga" }, [ST_ENABLED + ST_FOCUSED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowDown_Focused.tga" }, [ST_ENABLED + ST_CLICKED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowDown_Focused.tga" }, [ST_ENABLED + ST_FOCUSED + ST_CLICKED] = { texture = "base:texture/ui/components/UIButton_ScrollArrowDown_Entered.tga" }, } self.uiButtonDown.rectangle = { self.location[1], self.location[2] + self.height, self.location[1] + 24, self.location[2] + self.height + 24 } self.uiButtonDown.opaque = true self.uiButtonDown.sensitive = true -- lift button self.height = self.height - 24 self.uiButtonLift = self:AddComponent(UIButton:New(), "uiButtonLift") self.uiButtonLift.OnAction = function () end self.uiButtonLift.states = { --[[ [ST_DISABLED] = { texture = "base:texture/ui/components/UIButton_ScrollBar_Focused.tga" }, [ST_DISABLED + ST_FOCUSED] = { texture = "base:texture/ui/components/UIButton_ScrollBar_Focused.tga" }, [ST_ENABLED] = { texture = "base:texture/ui/components/UIButton_ScrollBar_Focused.tga" }, [ST_ENABLED + ST_FOCUSED] = { texture = "base:texture/ui/components/UIButton_ScrollBar_Focused.tga" }, [ST_ENABLED + ST_CLICKED] = { texture = "base:texture/ui/components/UIButton_ScrollBar.tga" }, [ST_ENABLED + ST_FOCUSED + ST_CLICKED] = { texture = "base:texture/ui/components/UIButton_ScrollBar.tga" }, --]] [ST_DISABLED] = { texture = "base:texture/ui/components/UIButton_ScrollBar.tga" }, [ST_DISABLED + ST_FOCUSED] = { texture = "base:texture/ui/components/UIButton_ScrollBar.tga" }, [ST_ENABLED] = { texture = "base:texture/ui/components/UIButton_ScrollBar.tga" }, [ST_ENABLED + ST_FOCUSED] = { texture = "base:texture/ui/components/UIButton_ScrollBar.tga" }, [ST_ENABLED + ST_CLICKED] = { texture = "base:texture/ui/components/UIButton_ScrollBar.tga" }, [ST_ENABLED + ST_FOCUSED + ST_CLICKED] = { texture = "base:texture/ui/components/UIButton_ScrollBar_Focused.tga" }, } self.refY = nil self.offset = self.defaultOffset self.currentIndex = 0 self.maxIndex = 0 self.liftSize = 64 self:SetLift(24) self.uiButtonLift.opaque = true self.uiButtonLift.sensitive = true self.uiButtonLift.direction = DIR_VERTICAL end -- __dtor ------------------------------------------------------------------- function UIScrollBar:__dtor() end -- Draw ---------------------------------------------------------------------- function UIScrollBar:Draw() if (self.visible) then -- draw background -- quartz.system.drawing.pushcontext() -- quartz.system.drawing.loadtranslation(self.rectangle[1], self.rectangle[2]) -- quartz.system.drawing.loadtranslation(unpack(self.uiContents.clientRectangle)) -- quartz.system.drawing.loadtranslation(0, UITitledPanel.headerSize) quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/components/UIButton_ScrollBg.tga") quartz.system.drawing.drawtexture(self.location[1] + 3, self.location[2] + 12, self.location[1] + 3 + 18, self.location[2] + 36 + self.height) --quartz.system.drawing.pop() end -- base UIMultiComponent.Draw(self) end -- SetLift ------------------------------------------------------------------- function UIScrollBar:SetLift(pos) self.uiButtonLift.posY = pos self.uiButtonLift.rectangle = { self.location[1], self.location[2] + self.uiButtonLift.posY, self.location[1] + 24, self.location[2] + self.uiButtonLift.posY + self.liftSize } end -- SetSize ------------------------------------------------------------------- function UIScrollBar:SetSize(number, max) self.maxIndex = math.max(0, number - max) --self.offset = self.height * 0.1 self.offset = self.height * (1/(number - max + 6)) self.liftSize = math.max(48 + (self.height * 0.05), self.height - self.maxIndex * self.offset) self.uiButtonLift.rectangle = { self.location[1], self.location[2] + self.uiButtonLift.posY, self.location[1] + 24, self.location[2] + self.uiButtonLift.posY + self.liftSize } if (number <= max) then self.visible = false self.uiButtonUp.visible = false self.uiButtonDown.visible = false self.uiButtonLift.visible = false else self.visible = true self.uiButtonUp.visible = true self.uiButtonDown.visible = true self.uiButtonLift.visible = true end end -- update -------------------------------------------------------------------- function UIScrollBar:Update() if (self.uiButtonLift and self.uiButtonLift.clicked) then local mouse = UIManager.stack.mouse.cursor if (self.refY) then local pos = mouse.y - self.location[2] - self.refY pos = math.max(24, pos) pos = math.min(self.height + 24 - self.liftSize, pos) -- action local index = math.floor((self.uiButtonLift.posY - 24) / (self.offset - 0.5)) if (index > self.currentIndex) then if (self.OnActionDown) then self:OnActionDown() end elseif (index < self.currentIndex) then if (self.OnActionUp) then self:OnActionUp() end end self.currentIndex = index -- set new pos self:SetLift(pos) else self.refY = mouse.y - self.location[2] - self.uiButtonLift.posY end else self.refY = nil end end
--- Notes --- We need to document not just how this works internally --- but _also_ what events this catches --- what autocommands we rely on --- what autocommands we fire off --- what we interact with --- Basically everything local utils = require('netman.utils') local netman_options = require('netman.options') local log = utils.log local notify = utils.notify local protocol_pattern_sanitizer_glob = '[%%^]?([%w-.]+)[:/]?' local protocol_from_path_glob = '^([%w-.]+)://' -- TODO(Mike): Potentially implement auto deprecation/enforcement here? local _provider_required_attributes = { 'name' ,'protocol_patterns' ,'version' ,'read' ,'write' ,'delete' ,'get_metadata' } local _explorer_required_attributes = { 'version' ,'protocol_patterns' ,'explore' } local M = {} M.version = 1.0 M.explorer = nil M._augroup_defined = false M._initialized = false M._setup_commands = false M._buffer_provider_cache = { -- Tables that are added to this table should contain the following -- key,value pairs -- key: Buffer Index (as string) -- value: Table with the following key, value pairs -- key: protocol -- value: Table with the following key, value pairs -- provider: required provider from pcall -- origin_path: original uri used to create this connection -- protocol: set this to your global (required) name value -- buffer: set this to nil, it will be set later -- provider_cache: empty table object } M._providers = { -- Contains key, value pairs as follows -- key: Protocol (pre glob) -- value: imported provider } M._unitialized_providers = { -- Contains key, value pairs as follows -- key: provider name -- value: reason it is unitilized } M._unintialized_explorers = { -- Contains key, value pairs as follows -- key: explorer name -- value: reason it is unitilized } M._unclaimed_provider_details = { } M._unclaimed_id_table = { } local _get_provider_for_path = function(path) local provider = nil local protocol = path:match(protocol_from_path_glob) provider = M._providers[protocol] if provider == nil then notify.error("Error parsing path: " .. path .. " -- Unable to establish provider") return nil, nil end log.info("Selecting provider: " .. provider._provider_path .. ':' .. provider.version .. ' for path: ' .. path) return provider, protocol end local _read_as_stream = function(stream) -- TODO(Mike): Allow for providing the file type local command = "0append! " .. table.concat(stream, '\n') log.debug("Generated read stream command: " .. command:sub(1, 30)) return command end local _read_as_file = function(file) -- TODO(Mike): Allow for providing the file type local origin_path = file.origin_path local local_path = file.local_path local unclaimed_id = M._unclaimed_id_table[origin_path] local claim_command = '' if unclaimed_id then claim_command = ' | lua require("netman.api"):_claim_buf_details(vim.fn.bufnr(), "' .. M._unclaimed_id_table[origin_path] .. '")' end log.debug("Processing details: ", {origin_path=origin_path, local_path=local_path, unclaimed_id=unclaimed_id}) local command = 'read ++edit ' .. local_path .. ' | set nomodified | filetype detect' .. claim_command log.debug("Generated read file command: " .. command) return command end local _read_as_explore = function(explore_details) local sanitized_explore_details = {} for _, details in ipairs(explore_details.remote_files) do for _, field in ipairs(netman_options.explorer.FIELDS) do if details[field] == nil then log.warn("Explore Details Missing Required Field: " .. field) end end for key, _ in ipairs(details) do if netman_options.explorer.FIELDS[key] == nil and netman_options.explorer.METADATA[key] == nil then log.info("Stripping out " .. key .. " from explore details as it does not conform with netman.options.explorer.FIELDS or netman.options.explorer.METADATA") details[key] = nil end end table.insert(sanitized_explore_details, details) end return { parent=explore_details.parent, details=explore_details.remote_files } end local _cache_provider = function(provider, protocol, path) if M._unclaimed_id_table[path] then return M._unclaimed_id_table[path], M._unclaimed_provider_details[M._unclaimed_id_table[path]] end log.debug("Reaching out to provider: " .. provider._provider_path .. ":" .. provider.version .. " to initialize connection for path: " .. path) local id = utils.generate_string(10) local bp_cache_object = { provider = provider ,protocol = protocol ,local_path = nil ,origin_path = path ,unique_name = '' ,buffer = nil ,provider_cache = {} } M._unclaimed_provider_details[id] = bp_cache_object M._unclaimed_id_table[path] = id log.debug("Cached provider: " .. provider._provider_path .. ":" .. provider.version .. " for id: " .. id) return id, M._unclaimed_provider_details[id] end --- TODO(Mike): Document me function M:_get_buffer_cache_object(buffer_index, path) if buffer_index then buffer_index = "" .. buffer_index end if path == nil then log.error("No path was provided with index: " .. buffer_index .. '!') return nil end local protocol = path:match(protocol_from_path_glob) if protocol == nil then log.error("Unable to parse path: " .. path .. " to get protocol!") return nil end if buffer_index == nil then local _, provider = _cache_provider(_get_provider_for_path(path), protocol, path) return provider end if M._buffer_provider_cache[buffer_index] == nil then log.info('No cache table found for index: ' .. buffer_index .. '. Creating one now') M._buffer_provider_cache[buffer_index] = {} end if M._buffer_provider_cache[buffer_index][protocol] == nil then log.debug("No cache object associated with protocol: " .. protocol .. " for index: " .. buffer_index .. ". Attempting to claim one") local id = _cache_provider(_get_provider_for_path(path), protocol, path) return M:_claim_buf_details(buffer_index, id) else return M._buffer_provider_cache[buffer_index][protocol] end end function M:_claim_buf_details(buffer_index, details_id) local unclaimed_object = M._unclaimed_provider_details[details_id] log.debug("Claiming " .. details_id .. " and associating it with index: " .. buffer_index) if unclaimed_object == nil then log.info("Attempted to claim: " .. details_id .. " which doesn't exist...") return end unclaimed_object.buffer = buffer_index local bp_cache_object = M._buffer_provider_cache["" .. buffer_index] if bp_cache_object == nil then M._buffer_provider_cache["" .. buffer_index] = {} bp_cache_object = M._buffer_provider_cache["" .. buffer_index] end local existing_provider = M._buffer_provider_cache["" .. buffer_index][unclaimed_object.protocol] if existing_provider then log.info( "Overriding previous provider: " .. existing_provider._provider_path .. ":" .. existing_provider.version .. " with " .. unclaimed_object.provider.name .. ":" .. unclaimed_object.provider.version .. " for index: " .. buffer_index ) end M._buffer_provider_cache["" .. buffer_index][unclaimed_object.protocol] = unclaimed_object log.debug("Claimed " .. details_id .. " and associated it with " .. buffer_index) M._unclaimed_provider_details[details_id] = nil M._unclaimed_id_table[unclaimed_object.origin_path] = nil log.debug("Removed unclaimed details for " .. details_id) return M._buffer_provider_cache["" .. buffer_index][unclaimed_object.protocol] end --- Write is the only entry to writing a buffers contents to a uri --- Write reaches out to the appropriate provider associated with --- the write_path. If the buffer does not have a matching --- provider for the write_path, Write will auto initialize the --- provider. --- NOTE: Write is an asynchronous function and will return immediately --- @param buffer_index integer --- The index associated with the buffer being saved --- @param write_path string --- The string path to save to --- @return nil function M:write(buffer_index, write_path) log.debug("Saving contents of index: " .. buffer_index .. " to " .. write_path) local provider_details = M:_get_buffer_cache_object(buffer_index, write_path) log.debug("Pulled details object ", provider_details) log.info("Calling provider: " .. provider_details.provider._provider_path .. ":" .. provider_details.provider.version .. " to handle write") -- This should be done asynchronously provider_details.provider:write(buffer_index, write_path, provider_details.provider_cache) end --- Delete will reach out to the relevant provider for the delete_path --- and call the providers `delete` function --- @param delete_path string --- The path to delete --- @return nil function M:delete(delete_path) local provider = _get_provider_for_path(delete_path) if provider == nil then notify.error("Unable to delete: " .. delete_path .. ". No provider was found to handle the delete!") return end log.info("Calling provider: " .. provider._provider_path .. ":" .. provider.version .. " to delete " .. delete_path) provider:delete(delete_path) end --- Get Metadata is the function an explorer will call (via the shim) for fetching --- metadata associated with a URI. --- @param uri string --- String path representation to resolve for metadata gathering location --- @param metadata table --- An table (as an array) with _valid netman.options.METADATA_ entries --- @return table --- A table will be returned. The table will consist of the metadata input table contents --- as the keys and the metadata associated with the key as the value function M:get_metadata(uri, metadata) if not metadata then metadata = {} for key, _ in pairs(require('netman.options').explorer.METADATA) do table.insert(metadata, key) end end if not uri then notify.error("No uri provided!") return nil end local provider_details = M:_get_buffer_cache_object(nil, uri) if not provider_details then log.warn("No provider details returned for " .. uri) return nil end log.debug("Reaching out for metadata ", metadata) local return_metadata = provider_details.provider:get_metadata(uri, metadata) log.debug("Removing lingering Cache data for metadata request") M._unclaimed_provider_details[M._unclaimed_id_table[uri]] = nil M._unclaimed_id_table[uri] = nil if not return_metadata then log.warn("No metadata returned for " .. uri .. '!') return nil end local sanitized_metadata = {} for metadata_key, metadata_value in pairs(return_metadata) do if not netman_options.explorer.METADATA[metadata_key] then log.warn("Metadata Key" .. metadata_key .. ' is not valid. Removing...') else sanitized_metadata[metadata_key] = metadata_value end end return sanitized_metadata end --- Read is the main entry to resolving a uri and getting the contents --- asso --- Read is the main entry to resolving a uri and getting the contents --- associated with it. Read reaches out to the appropriate provider --- and retrieves valid contents. --- Read does _not_ modify any vim buffers, nor does it modify anything --- underneath the buffer. Modification/Displaying of data is --- for the calling method to handle based on the return of Read ---@param buffer_index integer: --- Vim associated integer pointing to the buffer to --- load to. Useful for retrieving the relevant read cache ---@param path string: --- The string path to load to resolve and load contents --- into the buffer at the buffer_index provided ---@return string: the command to run to load the resolved contents from --- the provided path into the buffer found at the provided buffer_index -- TODO(Mike): Consider integration with "_claim_buf_details" function M:read(buffer_index, path) if not path then notify.error('No path provided!') return nil end local provider_details = M:_get_buffer_cache_object(buffer_index, path) local read_data, read_type = provider_details.provider:read(path, provider_details.provider_cache) if read_type == nil then log.info("Setting read type to api.READ_TYPE.STREAM") log.debug("back in my day we didn't have optional return values...") read_type = netman_options.api.READ_TYPE.STREAM end if netman_options.api.READ_TYPE[read_type] == nil then notify.error("Unable to figure out how to display: " .. path .. '!') log.warn("Received invalid read type: " .. read_type .. ". This should be either api.READ_TYPE.STREAM or api.READ_TYPE.FILE!") return nil end if read_data == nil then log.info("Received nothing to display to the user, this seems wrong but I just do what I'm told...") return end if type(read_data) ~= 'table' then log.warn("Data returned is not in a table. Attempting to make it a table") log.debug("grumble grumble, kids these days not following spec...") read_data = {read_data} end provider_details.type = read_type if read_type == netman_options.api.READ_TYPE.STREAM then log.debug("Getting stream command for path: " .. path) return _read_as_stream(read_data) elseif read_type == netman_options.api.READ_TYPE.FILE then provider_details.unique_name = read_data.unique_name or read_data.local_path provider_details.local_path = read_data.local_path log.debug("Setting unique name for path: " .. path .. " to " .. provider_details.unique_name) log.debug("Getting file command for path: " .. path) return _read_as_file(read_data) elseif read_type == netman_options.api.READ_TYPE.EXPLORE then if not M.explorer then log.error("No tree explorer loaded!") return end log.debug("Calling explorer to handle path: " .. path) return M.explorer:explore(_read_as_explore(read_data)) end log.warn("Mismatched read_type. How on earth did you end up here???") log.debug("Ya I don't know what you want me to do here chief...") return nil end --- Load Explorer is used to set the current remote explorer to whatever package --- is associated with `explorer_path`. --- @param explorer_path string --- The string path to the explorer to use --- @param force boolean --- A boolean to tell us if we should force the use of this explorer or not --- NOTE: Only respected if the explorer passes validation --- @return nil function M:load_explorer(explorer_path, force) force = force or false local explorer = require(explorer_path) log.debug("Validating explorer " .. explorer_path) local missing_attrs = nil for _, required_attr in ipairs(_explorer_required_attributes) do if not explorer[required_attr] then if missing_attrs then missing_attrs = missing_attrs .. ', ' .. required_attr else missing_attrs = required_attr end end end if missing_attrs then log.error("Failed to initialize explorer: " .. explorer_path .. ". Missing the following required attributes (" .. missing_attrs .. ")") M._unintialized_explorers[explorer_path] = { reason = "Validation Failure" ,name = explorer_path ,version = "Unknown" } return end if M.explorer then log.info("Received new explorer " .. explorer_path .. '. Attempting to override existing explorer ' .. M.explorer._explorer_path) if explorer_path:find('^netman%.providers') and not force then log.debug( "Core explorer: " .. explorer_path .. ':' .. explorer.version .. ' attempted to overwrite third party' .. ' ' .. M.explorer._explorer_path .. '. Refusing...') goto continue end M._unintialized_explorers[explorer_path] = { reason = "Overriden by " .. explorer_path .. ":" .. explorer.version ,name = M.explorer._explorer_path ,version = M.explorer.version } end M.explorer = explorer if M.explorer['init'] then M.explorer:init() end M.explorer._explorer_path = explorer_path ::continue:: end --- Unoad Provider is a function that is provided to allow a user (developer) --- to remove a provider from Netman. This is most useful when changes have been --- made to the provider and you wish to reflect those changes without --- restarting Neovim --- @param provider_path string --- The string path to the provider --- EG: "netman.provider.ssh" --- @return nil function M:unload_provider(provider_path) log.info("Attempting to unload provider: " .. provider_path) local status, provider = pcall(require, provider_path) package.loaded[provider_path] = nil if not status or provider == true or provider == false then log.warn("Failed to fetch provider " .. provider_path .. " for unload!") return end if provider.protocol_patterns then log.info("Disassociating Protocol Patterns and Autocommands with provider: " .. provider_path) for _, pattern in ipairs(provider.protocol_patterns) do local _, _, new_pattern = pattern:find(protocol_pattern_sanitizer_glob) if M._providers[new_pattern] then log.debug("Removing associated autocommands with " .. new_pattern .. " for provider " .. provider_path) if not M._unitialized_providers[provider_path] then M._unitialized_providers[provider_path] = { reason = "Provider Unloaded" ,name = provider_path ,protocol = table.concat(provider.protocol_patterns, ', ') ,version = provider.version } end M._providers[new_pattern] = nil vim.api.nvim_command('autocmd! Netman FileReadCmd ' .. new_pattern .. '://*') vim.api.nvim_command('autocmd! Netman BufReadCmd ' .. new_pattern .. '://*') vim.api.nvim_command('autocmd! Netman FileWriteCmd ' .. new_pattern .. '://*') vim.api.nvim_command('autocmd! Netman BufWriteCmd ' .. new_pattern .. '://*') vim.api.nvim_command('autocmd! Netman BufUnload ' .. new_pattern .. '://*') end end end local provider_map = {} for id, provider_details in pairs(M._unclaimed_provider_details) do if provider_details.provider._provider_path == provider_path then provider_map[provider_details.origin_path] = id end end if next(provider_map) == nil then log.info("Removing Provider " .. provider_path .. " from associated buffers") for uri, id in pairs(provider_map) do M._unclaimed_id_table[uri] = nil M._unclaimed_id_table[id] = nil end end return true end --- Reload Provider is a developer helper function that is provided for a developer --- to quickly reload their provider into Netman without having to restart Neovim --- @param provider_path string --- The string path to the provider --- EG: "netman.provider.ssh" --- @return nil function M:reload_provider(provider_path) M:unload_provider(provider_path) M:load_provider(provider_path) end --- Load Provider is what a provider should call --- (via require('netman.api').load_provider) to load yourself --- into netman and be utilized for uri resolution in other --- netman functions. --- @param provider_path string --- The string path to the provider --- EG: "netman.provider.ssh" --- @return nil function M:load_provider(provider_path) local status, provider = pcall(require, provider_path) log.debug("Attempting to import provider: " .. provider_path, {status=status}) if not status or provider == true or provider == false then notify.error("Failed to initialize provider: " .. tostring(provider_path) .. ". This is likely due to it not being loaded into neovim correctly. Please ensure you have installed this plugin/provider") return end if provider.protocol_patterns and provider.protocol_patterns == netman_options.protocol.EXPLORE then log.info("Found explorer " .. provider_path .. ". Attempting load now") return M:load_explorer(provider_path) end provider._provider_path = provider_path log.info("Validating Provider: " .. provider_path) local missing_attrs = nil for _, required_attr in ipairs(_provider_required_attributes) do if not provider[required_attr] then if missing_attrs then missing_attrs = missing_attrs .. ', ' .. required_attr else missing_attrs = required_attr end end end log.info("Validation finished") if missing_attrs then log.error("Failed to initialize provider: " .. provider_path .. ". Missing the following required attributes (" .. missing_attrs .. ")") M._unitialized_providers[provider_path] = { reason = "Validation Failure" ,name = provider_path ,protocol = "Unknown" ,version = "Unknown" } return end log.debug("Initializing " .. provider._provider_path .. ":" .. provider.version) if provider.init then log.debug("Found init function for provider!") -- TODO(Mike): Figure out how to load configuration options for providers local provider_config = {} local status, valid = pcall(provider.init, provider, provider_config) if not status or valid ~= true then log.warn(provider._provider_path .. ":" .. provider.version .. " refused to initialize. Discarding") M._unitialized_providers[provider_path] = { reason = "Initialization Failed" ,name = provider_path ,protocol = table.concat(provider.protocol_patterns, ', ') ,version = provider.version } return end end for _, pattern in ipairs(provider.protocol_patterns) do local _, _, new_pattern = pattern:find(protocol_pattern_sanitizer_glob) log.debug("Reducing " .. pattern .. " down to " .. new_pattern) if M._providers[new_pattern] then if pattern:find('^netman%.providers') then log.debug( "Core provider: " .. provider.name .. ":" .. provider.version .. " attempted to overwrite third party provider: " .. M._providers[new_pattern].name .. ":" .. M._providers[new_pattern].version .. " for protocol pattern " .. new_pattern .. ". Refusing...") M._unitialized_providers[provider._provider_path] = { reason = "Overriden by " .. M._providers[new_pattern]._provider_path .. ":" .. M._providers[new_pattern].version ,name = provider._provider_path ,protocol = table.concat(provider.protocol_patterns, ', ') ,version = provider.version } goto continue end log.info("Provider " .. M._providers[new_pattern]._provider_path .. " is being overriden by " .. provider_path) M._unitialized_providers[M._providers[new_pattern]._provider_path] = { reason = "Overriden by " .. provider._provider_path .. ":" .. provider.version ,name = provider._provider_path ,protocol = table.concat(provider.protocol_patterns, ', ') ,version = provider.version } M._providers[new_pattern] = provider goto continue end M._providers[new_pattern] = provider local au_commands = { 'autocmd Netman FileReadCmd ' .. new_pattern .. '://* lua require("netman"):read(vim.fn.expand("<amatch>"))' ,'autocmd Netman BufReadCmd ' .. new_pattern .. '://* lua require("netman"):read(vim.fn.expand("<amatch>"))' ,'autocmd Netman FileWriteCmd ' .. new_pattern .. '://* lua require("netman"):write()' ,'autocmd Netman BufWriteCmd ' .. new_pattern .. '://* lua require("netman"):write()' ,'autocmd Netman BufUnload ' .. new_pattern .. '://* lua require("netman.api"):unload(vim.fn.expand("<abuf>"))' } if not M._augroup_defined then vim.api.nvim_command('augroup Netman') vim.api.nvim_command('autocmd!') vim.api.nvim_command('augroup END') M._augroup_defined = true else log.debug("Augroup Netman already exists, not recreating augroup") end for _, command in ipairs(au_commands) do log.debug("Setting Autocommand: " .. command) vim.api.nvim_command(command) end ::continue:: end M._unitialized_providers[provider_path] = nil log.info("Initialized " .. provider_path .. " successfully!") end --- Unload will inform relevant providers that a buffer is being --- closed by the user. This will give the providers a chance --- to close out any cache information it has associated with the --- buffer. Additionally, Unload will clear out any cache information --- associated with the buffer. --- Note: this will expect the provider to handle whatever it needs --- asynchronously (IE in the background) --- Unload is called automatically by an autocommand --- @param buffer_index string --- The index of the buffer being closed --- @return nil function M:unload(buffer_index) log.info("Unload for index: " .. buffer_index .. " triggered") local bp_cache_object = M._buffer_provider_cache["" .. buffer_index] if bp_cache_object == nil then return end local called_providers = {} local provider for _, provider_details in pairs(bp_cache_object) do provider = provider_details.provider if called_providers[provider.name] ~= nil then goto continue end called_providers[provider.name] = provider if provider_details.type == netman_options.api.READ_TYPE.FILE and provider_details.local_path then utils.run_shell_command('rm ' .. provider_details.local_path) end log.info("Processing unload of " .. provider._provider_path .. ":" .. provider.version) if provider.close_connection ~= nil then log.debug("Closing connection with " .. provider._provider_path .. ":" .. provider.version) provider:close_connection(buffer_index, provider_details, bp_cache_object.provider_cache) end ::continue:: end M._buffer_provider_cache["" .. buffer_index] = nil end function M:dump_info(output_path) if output_path ~= 'memory' then ---@diagnostic disable-next-line: ambiguity-1 output_path = output_path or "$HOME/" .. utils.generate_string(10) end local neovim_details = vim.version() local headers = { '----------------------------------------------------' ,"Neovim Version: " .. neovim_details.major .. "." .. neovim_details.minor ,"System: " .. vim.loop.os_uname().sysname ,"Netman Version: " .. M.version ,"" ,"Api Contents: " .. vim.inspect(M, {newline="\\n", indent="\\t"}) ,">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" } if M.explorer then table.insert(headers, 'Registered Explorer Details') table.insert(headers, " " .. M.explorer._explorer_path .. " --version " .. M.explorer.version) table.insert(headers, '') end table.insert(headers, 'Not Registered Explorer Details') for _, explorer_info in pairs(M._unintialized_explorers) do table.insert(headers, " " .. explorer_info.name .. " --version " .. tostring(explorer_info.version) .. " --reason " .. explorer_info.reason ) end table.insert(headers, '') table.insert(headers, 'Running Provider Details') for pattern, provider in pairs(M._providers) do table.insert(headers, " " .. tostring(provider._provider_path) .. " --pattern " .. pattern .. " --protocol " .. tostring(provider.name) .. " --version " .. tostring(provider.version)) end table.insert(headers, "") table.insert(headers, "Not Running Provider Details") for provider, provider_info in pairs(M._unitialized_providers) do table.insert(headers, " " .. provider .. " --protocol " .. tostring(provider_info.name) .. " --version " .. tostring(provider_info.version) .. " --reason " .. tostring(provider_info.reason) ) end table.insert(headers, '----------------------------------------------------') table.insert(headers, 'Logs:') table.insert(headers, '') local log_buffer = nil for _, buffer in ipairs(vim.api.nvim_list_bufs()) do if vim.api.nvim_buf_get_option(buffer, 'filetype') ~= 'NetmanLogs' then goto continue else log_buffer = buffer break end ::continue:: end if not log_buffer then log_buffer = vim.api.nvim_create_buf(true, true) vim.api.nvim_buf_set_option(log_buffer, 'filetype', 'NetmanLogs') end vim.api.nvim_buf_set_option(log_buffer, 'modifiable', true) vim.api.nvim_set_current_buf(log_buffer) local logs = utils.generate_session_log(output_path, headers) vim.api.nvim_buf_set_lines(log_buffer, 0, -1, false, logs) vim.api.nvim_command('%s%\\\\n%\r%g') vim.api.nvim_command('%s%\\\\t%\t%g') vim.api.nvim_buf_set_option(log_buffer, 'modifiable', false) vim.api.nvim_buf_set_option(log_buffer, 'modified', false) vim.api.nvim_command('0') end function M:init(core_providers) if M._initialized then return end local _core_providers = require('netman.providers') core_providers = core_providers or _core_providers log.info("Initializing Netman API") for _, provider in ipairs(core_providers) do M:load_provider(provider) end M._initialized = true vim.g.netman_api_initialized = true end -- I am not super fond of this, but it is how the busted framework -- says to handle unit testing of internal methods -- http://olivinelabs.com/busted/#private ---@diagnostic disable-next-line: undefined-global if _UNIT_TESTING then M._read_as_stream = _read_as_stream M._read_as_file = _read_as_file M._read_as_explore = _read_as_explore M._get_provider_for_path = _get_provider_for_path end M:init() return M
-- import local EventDispatcherEntity = require 'candy.common.EventDispatcherEntity' ---@class DisplayObject : EventDispatcherEntity local DisplayObject = CLASS: DisplayObject ( EventDispatcherEntity ) :MODEL {} function DisplayObject:__init () self.prop = self:_createRenderProp () self.touchEnabled = true end function DisplayObject:_createRenderProp () return MOAIGraphicsProp.new () end function DisplayObject:onLoad () self:_attachProp ( self:getProp ( 'render' ), '' ) end --- -- Returns the size. -- If there is a function that returns a negative getDims. -- getSize function always returns the size of the positive. ---@return width, height, depth function DisplayObject:getSize () local w, h, d = self:getProp ( 'render' ):getDims () w = w or 0 h = h or 0 d = d or 0 return math.abs ( w ), math.abs ( h ), math.abs ( d ) end --- -- Returns the width. ---@return width function DisplayObject:getWidth () local w, h, d = self:getSize () return w end --- -- Returns the height. ---@return height function DisplayObject:getHeight () local w, h, d = self:getSize () return h end --- -- Sets the position. -- Without depending on the Pivot, move the top left corner as the origin. ---@param left Left position ---@param top Top position function DisplayObject:setPos ( left, top ) local xMin, yMin, zMin, xMax, yMax, zMax = self:getProp ( 'render' ):getBounds () xMin = math.min ( xMin or 0, xMax or 0 ) yMin = math.min ( yMin or 0, yMax or 0 ) local pivX, pivY, pivZ = self:getPiv () local locX, locY, locZ = self:getLoc () self:getProp ( 'render' ):setLoc ( left + pivX - xMin, top + pivY - yMin, locZ ) end --- -- Returns the position. ---@return Left ---@return Top function DisplayObject:getPos () local xMin, yMin, zMin, xMax, yMax, zMax = self:getProp ( 'render' ):getBounds () xMin = math.min ( xMin or 0, xMax or 0 ) yMin = math.min ( yMin or 0, yMax or 0 ) local pivX, pivY, pivZ = self:getProp ( 'render' ):getPiv () local locX, locY, locZ = self:getProp ( 'render' ):getLoc () return locX - pivX + xMin, locY - pivY + yMin end --- -- Returns the left position. ---@return left function DisplayObject:getLeft () local left, top = self:getPos () return left end --- -- Set the left position. ---@param value left position. function DisplayObject:setLeft ( value ) local left, top = self:getPos () self:setPos ( value, top ) end --- -- Returns the top position. ---@return top function DisplayObject:getTop () local left, top = self:getPos () return top end --- -- Set the top position. ---@param value top position. function DisplayObject:setTop ( value ) local left, top = self:getPos () self:setPos ( left, value ) end --- -- Returns the right position. ---@return right function DisplayObject:getRight () local left, top = self:getPos () local width, height = self:getSize () return left + width end --- -- Set the right position. ---@param value right position. function DisplayObject:setRight ( value ) local left, top = self:getPos () self:setPos ( value - self:getWidth (), top ) end --- -- Returns the bottom position. ---@return bottom function DisplayObject:getBottom () local left, top = self:getPos () local width, height = self:getSize () return top + height end --- -- Set the bottom position. ---@param value bottom position. function DisplayObject:setBottom ( value ) local left, top = self:getPos () self:setPos ( left, value - self:getHeight () ) end --- -- Returns the color. ---@return red, green, blue, alpha function DisplayObject:getColor () local r = self:getProp ( 'render' ):getAttr ( MOAIColor.ATTR_R_COL ) local g = self:getProp ( 'render' ):getAttr ( MOAIColor.ATTR_G_COL ) local b = self:getProp ( 'render' ):getAttr ( MOAIColor.ATTR_B_COL ) local a = self:getProp ( 'render' ):getAttr ( MOAIColor.ATTR_A_COL ) return r, g, b, a end --- -- Sets the piv (the anchor around which the object can 'pivot') to the object's center. function DisplayObject:setPivToCenter () local w, h, d = self:getSize () local left, top = self:getPos () self:getProp ( 'render' ):setPiv ( w / 2, h / 2, 0 ) self:setPos ( left, top ) end --- -- Returns whether or not the object is currently visible or invisible. ---@return visible function DisplayObject:getVisible () -- return self:getMoaiProp ():getAttr ( MOAIGraphicsProp.ATTR_VISIBLE ) > 0 -- return DisplayObject.__super.isVisible ( self ) return self:getProp ( 'render' ):isVisible ( self ) end --- -- Sets the visibility. -- TODO:I avoid the bug of display settings MOAIProp.(2013/05/20 last build) ---@param visible visible function DisplayObject:setVisible ( visible ) -- DisplayObject.__super.setVisible ( self, visible ) self:getProp ( 'render' ):setVisible ( visible ) self:forceUpdate () end --- -- Sets the object's parent, inheriting its color and transform. ---@param parent Entity | nil parent function DisplayObject:setParent ( parent ) if self.scene then self.reparent ( parent ) else if parent then if not self.parent then parent:addChild ( self ) else self.parent:_detachChildEntity ( self ) parent:addChild ( self ) end else local parent0 = self.parent if parent0 then parent0.children[ self ] = nil parent0:_detachChildEntity ( self ) end end end -- if self.parent then -- self.parent:_detachChildEntity ( self ) -- end -- self:getMoaiProp ():clearAttrLink ( MOAIColor.INHERIT_COLOR ) -- self:getMoaiProp ():clearAttrLink ( MOAITransform.INHERIT_TRANSFORM ) -- -- Conditions compatibility -- if MOAIGraphicsProp.INHERIT_VISIBLE then -- self:getMoaiProp ():clearAttrLink ( MOAIGraphicsProp.INHERIT_VISIBLE ) -- end -- if parent then -- parent:addChild ( self ) -- local parentProp = parent:getMoaiProp () -- self:getMoaiProp ():setAttrLink ( MOAIColor.INHERIT_COLOR, parentProp, MOAIColor.COLOR_TRAIT ) -- self:getMoaiProp ():setAttrLink ( MOAITransform.INHERIT_TRANSFORM, parentProp, MOAITransform.TRANSFORM_TRAIT ) -- -- Conditions compatibility -- if MOAIGraphicsProp.INHERIT_VISIBLE then -- self:getMoaiProp ():setAttrLink ( MOAIGraphicsProp.INHERIT_VISIBLE, parentProp, MOAIGraphicsProp.ATTR_VISIBLE ) -- end -- end end --- -- Set the scissor rect. ---@param scissorRect scissorRect function DisplayObject:setScissorRect ( scissorRect ) self:getProp ( 'render' ):setScissorRect ( scissorRect ) self.scissorRect = scissorRect end function DisplayObject:getProp ( role ) if role == 'render' then return self.prop end return DisplayObject.__super.getProp ( self ) end return DisplayObject
t = {} local key, value = "index", "value" t[key] = value function test() return t[key] end jit("compile", test) local res = test() assert(res == value) --[[ function <../tests/7_OP_GETTABLE.lua:4,6> (5 instructions at 0x83d770) 0 params, 2 slots, 2 upvalues, 0 locals, 1 constant, 0 functions 1 [5] GETTABUP 0 0 -1 ; _ENV "t" 2 [5] GETUPVAL 1 1 ; key 3 [5] GETTABLE 0 0 1 4 [5] RETURN 0 2 5 [6] RETURN 0 1 constants (1) for 0x83d770: 1 "t" locals (0) for 0x83d770: upvalues (2) for 0x83d770: 0 _ENV 0 0 1 key 1 0 ]] --[[ ra = R(0); rb = R(0); rc = R(1); ci->u.l.savedpc = &cl->p->code[3]; Y_luaV_gettable(L, rb, rc, ra); base = ci->u.l.base; ]]
RegisterClientScript() local scale = 0.75 local weapon = ScriptedWeapon({ Cooldown = 0.5, Scale = scale, Sprite = "placeholder/baguette.png", SpriteOrigin = Vec2(40, 20) * scale, WeaponOffset = Vec2(20, -60) -- This should not be here }) RegisterClientAssets(weapon.Sprite) local maxDist = 1000 if (SERVER) then weapon:OnAsync("attack", function (self) if (self.GrapplePull or self.GrappleSprite) then self:Release() else self:Launch() end end) weapon:On("switchoff", function (self) self:Release() end) function weapon:Launch() local startOffset = Vec2(85 * self.Scale, 0) local startPos = self:ToGlobalPosition(startOffset) local endPos = startPos + self:GetDirection() * maxDist local nearestFraction = math.huge local nearestResult physics.TraceMultiple(self:GetLayerIndex(), startPos, endPos, function (result) if (result.fraction < nearestFraction) then if (result.hitEntity) then -- Ignore player if (result.hitEntity == self:GetOwnerEntity()) then return end -- Ignore entities with Passthrough flag if (result.hitEntity.Passthrough) then return end end nearestResult = result nearestFraction = result.fraction end end) if (nearestFraction <= 0.001) then return end local targetEntity local targetOffset local duration = 0.5 if (nearestResult) then targetEntity = nearestResult.hitEntity targetOffset = targetEntity:ToLocalPosition(nearestResult.hitPos) duration = duration * nearestResult.fraction else targetOffset = endPos end self.GrappleSprite = match.CreateEntity({ Type = "entity_grapple_sprite", LayerIndex = self:GetLayerIndex(), LifeOwner = self, Properties = { duration = duration, source_entity = self, source_offset = startOffset, target_entity = targetEntity or NoEntity, target_offset = targetOffset } }) timer.Sleep(math.floor(duration * 1000)) if (targetEntity and targetEntity:IsValid()) then self.GrapplePull = match.CreateEntity({ Type = "entity_grapple_pull", LayerIndex = self:GetLayerIndex(), LifeOwner = self, Properties = { source_entity = self:GetOwnerEntity(), source_offset = startOffset, target_entity = targetEntity or NoEntity, target_offset = targetOffset } }) self:SetNextTriggerTime(match.GetMilliseconds()) else self:Release() end end function weapon:Release() if (self.GrapplePull and self.GrapplePull:IsValid()) then self.GrapplePull:Remove() end self.GrapplePull = nil if (self.GrappleSprite and self.GrappleSprite:IsValid()) then self.GrappleSprite:Retract() end self.GrappleSprite = nil end end
PLoop(function() namespace "KittyBox.Layout" -- A time interpolator defines the rate of change of an animation. This allows animations to have non-linear motion, such as acceleration and deceleration. interface "Interpolator"(function() -- Maps a value representing the elapsed fraction of an animation to a value that represents the interpolated fraction. This interpolated value is then multiplied by the change in value of an animation to derive the animated value at the current elapsed animation time. -- Params:input – A value between 0 and 1.0 indicating our current point in the animation where 0 represents the start and 1.0 represents the end -- Returns:The interpolation value. This value can be more than 1.0 for interpolators which overshoot their targets, or less than 0 for interpolators that undershoot their targets. __Arguments__{ Number } function GetInterpolation(self, input) end end) -- An interpolator where the rate of change starts out slowly and and then accelerates. class "AccelerateInterpolator"(function() extend "Interpolator" -- Constructor -- Params:factor – Degree to which the animation should be eased. Seting factor to 1.0f produces a y=x^2 parabola. Increasing factor above 1.0f exaggerates the ease-in effect (i.e., it starts even slower and ends evens faster) __Arguments__{ Number/1 } function __ctor(self, factor) self.__factor = factor self.__doubleFactor = 2 * factor end function GetInterpolation(self, input) if self.__factor == 1 then return input * input else return input ^ self.__doubleFactor end end end) -- An interpolator where the rate of change starts and ends slowly but accelerates through the middle class "AccelerateDecelerateInterpolator"(function() extend "Interpolator" function GetInterpolation(self, input) return cos(((input + 1) * math.pi) / 2) + 0.5 end end) -- An interpolator where the rate of change starts out quickly and and then decelerates. class "DecelerateInterpolator"(function() extend "Interpolator" -- Params:factor – Degree to which the animation should be eased. Setting factor to 1.0f produces an upside-down y=x^2 parabola. Increasing factor above 1.0f exaggerates the ease-out effect (i.e., it starts even faster and ends evens slower). __Arguments__{ Number/1 } function __ctor(self, factor) self.__factor = factor end function GetInterpolation(self, input) if self.__factor == 1 then return 1 - (1 - input) * (1 - input) else return 1 - (1 - input) ^ (2 * self.__factor) end end end) end)
-- This code is under copyright, and is bound to the agreement stated in the EULA. -- Any 3rd party content has been used as either public domain or with permission. -- © Copyright 2014-2018 Aritz Beobide-Cardinal All rights reserved. ARCBank = ARCBank or {} function ARCBank.Msg(msg) if ARCBank.Settings && ARCBank.Settings.name then Msg(ARCBank.Settings.name..": "..tostring(msg).."\n") else Msg("ARCBank: "..tostring(msg).."\n") end if ARCBank.LogFileWritten then file.Append(ARCBank.LogFile, os.date("%Y-%m-%d %H:%M:%S").." > "..tostring(msg).."\r\n") end end ARCBank.Msg("Running...\n ____ ____ _ ___ ___ ____ ____ ____ ____ _ _ ____ ____ ___ ____ _ _ _ _ _ _ _ ____ \n |__| |__/ | | / | |__/ |__| | |_/ |___ |__/ |__] |__| |\\ | |_/ | |\\ | | __ \n | | | \\ | | /__ |___ | \\ | | |___ | \\_ |___ | \\ |__] | | | \\| | \\_ | | \\| |__] \n") ARCBank.Msg(table.Random({"I'm going to run out of letters in the alphabet if I keep these patches up!","Product of BlueStone Technological Enterprises Inc. (Even before that company existed)","Sometimes I wonder when this chapter of my life is going to end.","I am embarrassed to say that there was a bug from v1.0 to v1.3 that made arguably one of the most important settings useless...","Eh, ARCLoad was a paranoid idiot's dream anyway...","Super fukin' Sexy edition!","The most realistic ATM system you'll ever see!","Wohoo! Manual Updates!","...I can never get a vacation...","I love you.","Isn't this amazing?","That's one fiiiine addon you got there!","Update, Update, Update!","You can ACTUALLY use an ATM!","Fixin' Bugs!"})) ARCBank.Msg("© Copyright 2014-2018 Aritz Beobide-Cardinal (ARitz Cracker) All rights reserved.") ARCBank.Features = {} ARCBank.Features["hackapi"] = true ARCBank.Update = "May 15th 2018" ARCBank.Version = "1.4.3h" ARCBank.About = [[ *** ARitz Cracker Bank *** © Copyright Aritz Beobide-Cardinal 2014-2018 All rights reserved. If you're having any trouble, please visit: www.aritzcracker.ca Coding, Models, and Custom textures by: * Aritz Beobide-Cardinal (ARitz Cracker) (STEAM_0:0:18610144) ATM Model by: * [Whatever his name is this week] (STEAM_0:1:34654275) Translations: * Go to github.com/ARitz-Cracker/aritzcracker-addon-translations * You can see everyone who helped out with translations by pressing the "contributors" tab! ALPHA Testers: * Noddy (Senior Crayfish) * Dr Fetus * Quinn50 * Toogit * Pookie * Shadow * HomelessGoomba * Foohy * Teh Neon * Gm Matsilagi * Ryuken Ishida * Drew dawg 2000 * Slashll * UTNerd24 Guinea Pigs * Ventz - Thanks for letting me test future ARCBank updates on your Civil Gamers community. Special Thanks: * Everyone who participated in the public BETA by buying ARCBank before March 31st 2014. * All my great customers, and my future customers. * Noddy (Senior Crayfish) - For inspiring me to create this and place this on CoderHire. * My family - For supporting me. * Snow Lou - I wouldn't be who I am without you. * You - For supporting me by using this addon Originally made for: Vortex Gaming ]] -- TRANSACTION TYPES ARCBANK_TRANSACTION_WITHDRAW_OR_DEPOSIT = 1 -- Withdraw/deposit ARCBANK_TRANSACTION_TRANSFER = 2 -- Transfer ARCBANK_TRANSACTION_INTEREST = 4 -- Interest ARCBANK_TRANSACTION_UPGRADE = 8 -- Upgrade ARCBANK_TRANSACTION_DOWNGRADE = 16 -- Downgrade ARCBANK_TRANSACTION_GROUP_ADD = 32 -- Add member ARCBANK_TRANSACTION_GROUP_REMOVE = 64 -- Remove member ARCBANK_TRANSACTION_CREATE = 128 -- Create ARCBANK_TRANSACTION_DELETE = 256 -- Delete ARCBANK_TRANSACTION_SALARY = 512 ARCBANK_TRANSACTION_OTHER = 32768 ARCBANK_TRANSACTION_EVERYTHING = 65535 -- everything -- PERMISSIONS ARCBANK_PERMISSIONS_READ = 1 ARCBANK_PERMISSIONS_READ_LOG = 2 ARCBANK_PERMISSIONS_DEPOSIT = 4 ARCBANK_PERMISSIONS_WITHDRAW = 8 ARCBANK_PERMISSIONS_TRANSFER = 16 ARCBANK_PERMISSIONS_RANK = 32 ARCBANK_PERMISSIONS_MEMBERS = 64 ARCBANK_PERMISSIONS_CREATE = 128 ARCBANK_PERMISSIONS_OTHER = 32768 ARCBANK_PERMISSIONS_EVERYTHING = 65535 -- everything --TRANSACTION ERRORS ARCBANK_ERRORSTRINGS = {} ARCBANK_ERROR_DOWNLOADING = -2 ARCBANK_ERROR_ABORTED = -1 ARCBANK_ERROR_NONE = 0 ARCBANK_NO_ERROR = 0 ARCBANK_ERROR_NIL_ACCOUNT = 1 ARCBANK_ERROR_NO_ACCESS = 2 ARCBANK_ERROR_NO_CASH = 3 ARCBANK_ERROR_NO_CASH_PLAYER = 4 ARCBANK_ERROR_PLAYER_FOREVER_ALONE = 5 ARCBANK_ERROR_NIL_PLAYER = 6 ARCBANK_ERROR_DUPE_PLAYER = 7 ARCBANK_ERROR_TOO_MUCH_CASH = 8 ARCBANK_ERROR_DEBT = 9 ARCBANK_ERROR_BUSY = 10 ARCBANK_ERROR_TIMEOUT = 11 ARCBANK_ERROR_READ_FAILURE = 12 ARCBANK_ERROR_INVALID_PIN = 13 ARCBANK_ERROR_CHUNK_MISMATCH = 14 ARCBANK_ERROR_CHUNK_TIMEOUT = 15 ARCBANK_ERROR_WRITE_FAILURE = 16 ARCBANK_ERROR_EXPLOIT = 17 ARCBANK_ERROR_DOWNLOAD_FAILED = 18 ARCBANK_ERROR_CORRUPT_ACCOUNT = 19 ARCBANK_ERROR_DEADLOCK = 20 ARCBANK_ERROR_ENTITY_NO_ACCESS = 21 ARCBANK_ERROR_LOG_EMPTY = 22 --CREATION ERRORS ARCBANK_ERROR_NAME_DUPE = 32 ARCBANK_ERROR_NAME_TOO_LONG = 33 ARCBANK_ERROR_INVALID_NAME = 34 ARCBANK_ERROR_UNDERLING = 35 ARCBANK_ERROR_INVALID_RANK = 36 ARCBANK_ERROR_TOO_MANY_ACCOUNTS = 37 ARCBANK_ERROR_TOO_MANY_PLAYERS = 38 ARCBANK_ERROR_DELETE_REFUSED = 39 --OTHER ERRORS ARCBANK_ERROR_NOT_LOADED = -127 ARCBANK_ERROR_UNKNOWN = -128 ARCBANK_ERRORBITRATE = 8 --ACCOUNTS ARCBANK_ACCOUNTSTRINGS = {} ARCBANK_PERSONALACCOUNTS_ = 0 ARCBANK_ACCOUNTSTRINGS[0] = "invalid" --These are internally handled by the ARCBank system, do not edit these. ARCBANK_PERSONALACCOUNTS_STANDARD = 1 ARCBANK_ACCOUNTSTRINGS[1] = "standard" ARCBANK_PERSONALACCOUNTS_BRONZE = 2 ARCBANK_ACCOUNTSTRINGS[2] = "bronze" ARCBANK_PERSONALACCOUNTS_SILVER = 3 ARCBANK_ACCOUNTSTRINGS[3] = "silver" ARCBANK_PERSONALACCOUNTS_GOLD = 4 ARCBANK_ACCOUNTSTRINGS[4] = "gold" ARCBANK_GROUPACCOUNTS_ = 5 ARCBANK_ACCOUNTSTRINGS[5] = "group_invalid" ARCBANK_GROUPACCOUNTS_STANDARD = 6 ARCBANK_ACCOUNTSTRINGS[6] = "group_standard" ARCBANK_GROUPACCOUNTS_PREMIUM = 7 ARCBANK_ACCOUNTSTRINGS[7] = "group_premium" ARCBANK_ACCOUNTBITRATE = 4 ARCBank.Msg("Version: "..ARCBank.Version) ARCBank.Msg("Updated on: "..ARCBank.Update) if SERVER then resource.AddWorkshop( "200318235" ) function ARCBank.MsgCL(ply,msg) --net.Start( "ARCBank_Msg" ) --net.WriteString( msg ) if !IsValid(ply) || !ply:IsPlayer() then ARCBank.Msg(tostring(msg)) else if ARCBank.Settings && ARCBank.Settings.name then ply:PrintMessage( HUD_PRINTTALK, ARCBank.Settings.name..": "..tostring(msg)) else ply:PrintMessage( HUD_PRINTTALK, "ARCBank: "..tostring(msg)) end --net.Send(ply) end end --hook.Add( "ARCLoad_OnLoaded", "ARCBank Load", function(loaded) ARCBank.Load() end ) end return "ARCBank","ARCBank",{"arclib"}
setProperty('timeBarBG.visible', false); setProperty('timeBar.visible', false); For Source: In PlayState (1.5.2) on line 898: timeBarBG.visible = false; And in line 910: timeBar.visible = showTime;
for i = 1,2000 do NodeAdd("Item", "item"..i, "{\"name\":".."\"item"..i.."\"}") end for i = 1,100000 do NodeAdd("Person", "person"..i, "{\"username\":".."\"person"..i.."\"}") for j = 1,100 do RelationshipAdd("LIKES", "Person", "person"..i, "Item", "item"..math.random(2000), "{\"weight\":"..10 * math.random().."}") end end NodeTypesGetCountByType("Item"), NodeGet("Item", "item1"), NodeTypesGetCountByType("Person"), NodeGet("Person", "person1"), RelationshipTypesGetCountByType("LIKES")
require 'nn' require 'torch' require 'optim' require 'cutorch' require 'cunn' require 'hdf5' require 'misc.OuterProd' cjson=require('cjson') ------------------------------------------------------------------------------- -- Input arguments and options ------------------------------------------------------------------------------- cmd = torch.CmdLine() cmd:text() cmd:text('Evaluate the Answer Predictor (AP) module in GVQA') cmd:text() cmd:text('Options') -- Data input settings cmd:option('-input_data_folder','processed_inputs/','path to the data folder') cmd:option('-input_question_classifier_output','predictions/question_classifier_results.h5', 'path to file containing yes no output') cmd:option('-input_h5','processed_question_for_vv_and_ap.h5','path to the h5file containing the image feature for train') cmd:option('-input_json','input_json_for_vcc.json','path to json file containing information about alignment between acp and vcc clusters') cmd:option('-input_h5_acp_test', 'predictions/acp_results.h5', 'path to the h5file containing the acp predictions for test') cmd:option('-input_h5_vcc_test', 'predictions/vcc_results.h5', 'path to the h5file containing the vcc predictions for test') cmd:option('-input_json_orig','input_json_for_vv_and_ap.json','path to the json file containing additional info and vocab') cmd:option('-model_path', 'models/', 'path to folder containing different models') cmd:option('-model_name', 'model_ap.t7', 'name of the model checkpoint to initialize model weights from. Empty = don\'t') cmd:option('-out_path', 'predictions/', 'path to save output json file') cmd:option('-num_visual_concepts', 1958, 'size of fc1') -- change this depending on which VCC is being used -- Model parameter settings cmd:option('-batch_size', 1024,'batch_size for each iterations') cmd:option('-num_answer_clusters', 50, 'size of fc1') cmd:option('-combine_acp_vcc', 'pointwise', 'how to combine acp and vcc features. concat, pointwise, outerprod, concat_pointwise') cmd:option('-reduce_vcc', 0, 'whether to reduce vcc (1) or not (0) before performing outerprod') cmd:option('-reduced_vcc_size', 100, 'size of the reduced vcc for outer product with acp') cmd:option('-num_last_fc_outerprod', 2, 'number of fc after outerprod') cmd:option('-outerprod_fc1_size', 2000, 'size of the first hidden layer after outerprod') cmd:option('-num_last_fc_concat', 2, 'number of fc after concatenation') cmd:option('-concat_fc1_size', 1500, 'size of the first hidden layer after concatenation') cmd:option('-concat_fc2_size', 1000, 'size of the second hidden layer after concatenation') cmd:option('-num_acp_embed_fc', 2, 'number of fc for embedding acp') cmd:option('-acp_embed_fc1_size', 512, 'size of fc1 for embedding acp') cmd:option('-acp_embed_fc2_size', 1024, 'size of fc1 for embedding acp') cmd:option('-num_last_fc', 3, 'number of fc after pointwise multiplication') cmd:option('-fc1_non_yes_no_ans_size', 1000, 'size of fc1 for answering module for non yes no') cmd:option('-fc2_non_yes_no_ans_size', 1000, 'size of fc1 for answering module for non yes no') cmd:option('-num_output_non_yes_no', 998, 'number of output answers for non yes no') -- Miscellaneous cmd:option('-backend', 'cudnn', 'nn|cudnn') cmd:option('-gpuid', 0, 'which gpu to use. -1 = use CPU') cmd:option('-seed', 123, 'random number generator seed to use') cmd:option('-num_ques', -1, 'number of questions to use') opt = cmd:parse(arg) print(opt) torch.manualSeed(opt.seed) torch.setdefaulttensortype('torch.FloatTensor') -- for CPU require 'misc.RNNUtils' if opt.gpuid >= 0 then require 'cutorch' require 'cunn' if opt.backend == 'cudnn' then require 'cudnn' end cutorch.manualSeed(opt.seed) cutorch.setDevice(opt.gpuid + 1) end ---------------------------------------------------------------------- -- Loading Dataset ---------------------------------------------------------------------- local map = {} local file = io.open(opt.input_data_folder .. opt.input_json_orig, 'r') local text = file:read() file:close() json_file_orig = cjson.decode(text) map['new_to_old_ans_label_non_yes_no'] = json_file_orig['new_to_old_ans_label_non_yes_no'] map['ix_to_ans'] = json_file_orig['ix_to_ans'] json_file_orig = nil local file = io.open(opt.input_data_folder .. opt.input_json, 'r') local text = file:read() file:close() input_json_file = cjson.decode(text) print('DataLoader loading h5 file: ', opt.input_h5) local dataset = {} print('DataLoader loading yes no classifier output') local h5_file = hdf5.open(opt.input_question_classifier_output, 'r') local yes_no_out_qids = h5_file:read('/qids'):all() local yes_no_out_pred = h5_file:read('/pred'):all() h5_file:close() local h5_file = hdf5.open(opt.input_data_folder .. opt.input_h5, 'r') local y_test_non_yes_no = h5_file:read('/answers_test_non_yes_no'):all() local qids_test_non_yes_no = h5_file:read('/question_id_test_non_yes_no'):all() local y_test_yes_no = h5_file:read('/answers_test_yes_no'):all() local qids_test_yes_no = h5_file:read('/question_id_test_yes_no'):all() for i = 1, y_test_yes_no:size(1) do y_test_yes_no[i] = opt.num_output_non_yes_no + 1 end local num_yes_no = y_test_yes_no:size(1) local num_non_yes_no = y_test_non_yes_no:size(1) local num_total = num_non_yes_no + num_yes_no dataset['y_test'] = torch.IntTensor(num_total) dataset['qids_test'] = torch.IntTensor(num_total) for i = 1, num_total do if i > num_yes_no then dataset['y_test'][i] = y_test_non_yes_no[i - num_yes_no] dataset['qids_test'][i] = qids_test_non_yes_no[i - num_yes_no] else dataset['y_test'][i] = y_test_yes_no[i] dataset['qids_test'][i] = qids_test_yes_no[i] end end h5_file:close() local h5_file = hdf5.open(opt.input_h5_acp_test, 'r') dataset['x_acp_test'] = h5_file:read('/cluster_ids'):all() local qids_acp_test = h5_file:read('/qids'):all() h5_file:close() local h5_file = hdf5.open(opt.input_h5_vcc_test, 'r') dataset['x_vcc_test'] = h5_file:read('/visual_concept_scores'):all() local qids_vcc_test = h5_file:read('/qids'):all() h5_file:close() --------- print('fetching non yes-no data') function align_data(data, data_qids, ref, ref_qids) local qids_to_idx = {} for i = 1, data_qids:size(1) do qids_to_idx[data_qids[i]] = i end local des_inds = {} local num_data_points = ref_qids:size(1) local count = 0 for i = 1, num_data_points do if ref[i] == 0 then count = count + 1 des_inds[count] = qids_to_idx[ref_qids[i]] end end des_inds = torch.LongTensor(des_inds) aligned_data = data:index(1, des_inds) return aligned_data end dataset['x_acp_test'] = align_data(dataset['x_acp_test'], qids_acp_test, yes_no_out_pred, yes_no_out_qids) dataset['x_vcc_test'] = align_data(dataset['x_vcc_test'], qids_vcc_test, yes_no_out_pred, yes_no_out_qids) dataset['y_test'] = align_data(dataset['y_test'], dataset['qids_test'], yes_no_out_pred, yes_no_out_qids) dataset['qids_test'] = align_data(dataset['qids_test'], dataset['qids_test'], yes_no_out_pred, yes_no_out_qids) ------ print('passing x_acp through softmax') dataset['x_acp_test'] = nn.SoftMax():forward(dataset['x_acp_test']) local num_test = dataset['qids_test']:size(1) function align_acp(acp_features, visual_concept_to_cluster_label, num_visual_concepts) aligned_acp_features = torch.Tensor(acp_features:size(1), num_visual_concepts) for i = 1, acp_features:size(1) do for j = 1, num_visual_concepts do aligned_acp_features[i][j] = acp_features[i][visual_concept_to_cluster_label[j]] end end return aligned_acp_features end print("aligning acp feature vector as per vcc") local num_visual_concepts = opt.num_visual_concepts print("creating mapping") local visual_concept_to_cluster_label = {} for j = 1, num_visual_concepts do local visual_concept = input_json_file['ix_to_visual_concepts'][tostring(j)] local cluster_label = input_json_file['visual_concept_to_cluster_labels'][visual_concept] + 1 -- because in the json file, clusters are 0-indexed visual_concept_to_cluster_label[j] = cluster_label end print("aligning") dataset['x_acp_test'] = align_acp(dataset['x_acp_test'], visual_concept_to_cluster_label, num_visual_concepts) collectgarbage() ------------------------------------------------------------------------ -- Design Parameters and Network Definitions ------------------------------------------------------------------------ print('Building the model...') -- answering module for non yes/no if opt.combine_acp_vcc == 'pointwise' then if opt.num_last_fc == 1 then model = nn.Sequential() :add(nn.CMulTable()) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.num_visual_concepts, opt.num_output_non_yes_no)) elseif opt.num_last_fc == 2 then model = nn.Sequential() :add(nn.CMulTable()) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.num_visual_concepts, opt.fc1_non_yes_no_ans_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.fc1_non_yes_no_ans_size, opt.num_output_non_yes_no)) elseif opt.num_last_fc == 3 then model = nn.Sequential() :add(nn.CMulTable()) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.num_visual_concepts, opt.fc1_non_yes_no_ans_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.fc1_non_yes_no_ans_size, opt.fc2_non_yes_no_ans_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.fc2_non_yes_no_ans_size, opt.num_output_non_yes_no)) end elseif opt.combine_acp_vcc == 'concat' then if opt.num_last_fc == 2 then model = nn.Sequential() :add(nn.JoinTable(1,1)) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.num_visual_concepts+opt.num_answer_clusters, opt.concat_fc2_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.concat_fc2_size, opt.num_output_non_yes_no)) elseif opt.num_last_fc == 3 then model = nn.Sequential() :add(nn.JoinTable(1,1)) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.num_visual_concepts+opt.num_answer_clusters, opt.concat_fc1_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.concat_fc1_size, opt.concat_fc2_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.concat_fc2_size, opt.num_output_non_yes_no)) end elseif opt.combine_acp_vcc == 'concat_pointwise' then if opt.num_acp_embed_fc == 2 then non_yes_no_embed_acp = nn.Sequential() :add(nn.Linear(opt.num_answer_clusters, opt.acp_embed_fc2_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.acp_embed_fc2_size, opt.num_visual_concepts)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) elseif opt.num_acp_embed_fc == 3 then non_yes_no_embed_acp = nn.Sequential() :add(nn.Linear(opt.num_answer_clusters, opt.acp_embed_fc1_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.acp_embed_fc1_size, opt.acp_embed_fc2_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.acp_embed_fc2_size, opt.num_visual_concepts)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) end non_yes_no_embed_vcc = nn.Sequential() :add(nn.Identity()) non_yes_no_embed_combined = nn.ParallelTable() :add(non_yes_no_embed_acp) :add(non_yes_no_embed_vcc) pointwise_net = nn.Sequential() :add(non_yes_no_embed_combined) :add(nn.CMulTable()) :add(nn.Dropout(0.5)) concat_net = nn.ConcatTable() :add(nn.SelectTable(1)) :add(pointwise_net) :add(nn.SelectTable(2)) model = nn.Sequential() :add(concat_net) if opt.num_last_fc == 2 then model:add(nn.JoinTable(1,1)) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.num_visual_concepts+opt.num_answer_clusters+opt.num_visual_concepts, opt.concat_fc2_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.concat_fc2_size, opt.num_output_non_yes_no)) elseif opt.num_last_fc == 3 then model:add(nn.JoinTable(1,1)) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.num_visual_concepts+opt.num_answer_clusters+opt.num_visual_concepts, opt.concat_fc1_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.concat_fc1_size, opt.concat_fc2_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.concat_fc2_size, opt.num_output_non_yes_no)) end elseif opt.combine_acp_vcc == 'outerprod' then embed_acp = nn.Sequential() :add(nn.Identity()) if opt.reduce_vcc == 1 then embed_vcc = nn.Sequential() :add(nn.Linear(opt.num_visual_concepts, opt.reduced_vcc_size)) :add(nn.Tanh()) :add(nn.Dropout(0.5)) else embed_vcc = nn.Sequential() :add(nn.Identity()) end embed_combined = nn.ParallelTable() :add(embed_acp) :add(embed_vcc) model = nn.Sequential() :add(embed_combined) :add(nn.OuterProd()) :add(nn.View(-1):setNumInputDims(2)) -- convert the outerproduct matrix to vector :add(nn.Dropout(0.5)) if opt.num_last_fc_outerprod == 1 then if opt.reduce_vcc == 1 then model:add(nn.Linear(opt.num_answer_clusters*opt.reduced_vcc_size, opt.num_output_non_yes_no)) else model:add(nn.Linear(opt.num_answer_clusters*opt.num_visual_concepts, opt.num_output_non_yes_no)) end elseif opt.num_last_fc_outerprod == 2 then if opt.reduce_vcc == 1 then model:add(nn.Linear(opt.num_answer_clusters*opt.reduced_vcc_size, opt.outerprod_fc1_size)) else model:add(nn.Linear(opt.num_answer_clusters*opt.num_visual_concepts, opt.outerprod_fc1_size)) end model:add(nn.Tanh()) :add(nn.Dropout(0.5)) :add(nn.Linear(opt.outerprod_fc1_size, opt.num_output_non_yes_no)) end end if opt.gpuid >= 0 then print('shipped data function to cuda...') model = model:cuda() end -- setting to evaluation model:evaluate() model_w, model_dw = model:getParameters() -- loading the model model_param = torch.load(opt.model_path .. opt.model_name) model_w:copy(model_param['model_w']) function dataset:next_batch_test(s, e) local batch_size = e - s + 1 local qinds = torch.LongTensor(batch_size):fill(0) for i = 1, batch_size do qinds[i] = s+i-1 end fv_acp_test = dataset['x_acp_test']:index(1,qinds) fv_vcc_test = dataset['x_vcc_test']:index(1,qinds) -- ship to gpu if opt.gpuid >= 0 then fv_acp_test = fv_acp_test:cuda() fv_vcc_test = fv_vcc_test:cuda() end return fv_acp_test, fv_vcc_test end function forward(s, e) -- get a batch local fv_acp, fv_vcc = dataset:next_batch_test(s, e) -- model forward pass local scores = model:forward({fv_acp, fv_vcc}) return scores:double() end function writeAll(file,data) local f = io.open(file, "w") f:write(data) f:close() end function saveJson(fname,t) return writeAll(fname,cjson.encode(t)) end ----------------------------------------------------------------------- -- Do Prediction ----------------------------------------------------------------------- num_testing_points = dataset['x_acp_test']:size(1) gt_ind = dataset['y_test'] qids = dataset['qids_test'] pred_scores = torch.Tensor(num_testing_points, opt.num_output_non_yes_no) for i = 1, num_testing_points, opt.batch_size do xlua.progress(i, num_testing_points) r = math.min(i + opt.batch_size - 1, num_testing_points) pred_scores[{{i, r},{}}] = forward(i, r) end _, pred_ind = pred_scores:max(2) paths.mkdir(opt.out_path) myFile = hdf5.open(opt.out_path .. 'ap_results.h5', 'w') myFile:write('/pred_scores', pred_scores) myFile:close() acc = 100*torch.sum(torch.eq(pred_ind:int(), gt_ind))/num_testing_points response = {} print(qids:size()) for i = 1, num_testing_points do local old_ans_label = map['new_to_old_ans_label_non_yes_no'][tostring(pred_ind[{i, 1}])] table.insert(response, {question_id = qids[i], answer = map['ix_to_ans'][tostring(old_ans_label)]}) end saveJson(opt.out_path .. 'ap_results.json', response) print("1/0 accuracy is " .. acc)
local K, C = unpack(select(2, ...)) if not (C["Skins"].DBM and K.CheckAddOnState("DBM-Core") and K.CheckAddOnState("DBM-StatusBarTimers") and K.CheckAddOnState("DBM-DefaultSkin")) then return end --local DBMFont = K.GetFont(C["Skins"].Font) --local DBMTexture = K.GetTexture(C["Skins"].Texture) local _G = _G local CreateFrame = _G.CreateFrame local hooksecurefunc = _G.hooksecurefunc local DBM_Skin = CreateFrame("Frame") DBM_Skin:RegisterEvent("ADDON_LOADED") DBM_Skin:RegisterEvent("PLAYER_ENTERING_WORLD") DBM_Skin:SetScript("OnEvent", function(_, event) if event == "PLAYER_ENTERING_WORLD" then local function SkinBars(self) for bar in self:GetBarIterator() do if not bar.injected then hooksecurefunc(bar, "Update", function() local sparkEnabled = bar.owner.options.Style ~= "BigWigs" and bar.owner.options.Spark if not sparkEnabled then return end local spark = _G[bar.frame:GetName().."BarSpark"] spark:SetSize(12, bar.owner.options.Height * 3/2 - 2) local a, b, c, d = spark:GetPoint() spark:SetPoint(a, b, c, d, 0) end) hooksecurefunc(bar, "ApplyStyle", function() local frame = bar.frame local tbar = _G[frame:GetName().."Bar"] local icon1 = _G[frame:GetName().."BarIcon1"] local icon2 = _G[frame:GetName().."BarIcon2"] local name = _G[frame:GetName().."BarName"] local timer = _G[frame:GetName().."BarTimer"] if not icon1.overlay then icon1.overlay = CreateFrame("Frame", "$parentIcon1Overlay", tbar) icon1.overlay:CreateShadow() icon1.overlay:SetFrameLevel(0) icon1.overlay:SetPoint("BOTTOMRIGHT", frame, "BOTTOMLEFT", -4, 0) icon1.overlay.background = icon1.overlay:CreateTexture(nil, "BORDER") icon1.overlay.background:SetAllPoints() icon1.overlay.background:SetColorTexture(C["Media"].BackdropColor[1], C["Media"].BackdropColor[2], C["Media"].BackdropColor[3], C["Media"].BackdropColor[4]) end if not icon2.overlay then icon2.overlay = CreateFrame("Frame", "$parentIcon2Overlay", tbar) icon2.overlay:CreateShadow() icon2.overlay:SetFrameLevel(0) icon2.overlay:SetPoint("BOTTOMLEFT", frame, "BOTTOMRIGHT", 4, 0) icon2.overlay.background = icon2.overlay:CreateTexture(nil, "BORDER") icon2.overlay.background:SetAllPoints() icon2.overlay.background:SetColorTexture(C["Media"].BackdropColor[1], C["Media"].BackdropColor[2], C["Media"].BackdropColor[3], C["Media"].BackdropColor[4]) end icon1:SetTexCoord(0.1, 0.9, 0.1, 0.9) icon1:ClearAllPoints() icon1:SetAllPoints(icon1.overlay) icon2:SetTexCoord(0.1, 0.9, 0.1, 0.9) icon2:ClearAllPoints() icon2:SetAllPoints(icon2.overlay) icon1.overlay:SetSize(bar.owner.options.Height, bar.owner.options.Height) icon2.overlay:SetSize(bar.owner.options.Height, bar.owner.options.Height) tbar:SetAllPoints(frame) frame:CreateShadow(true) name:ClearAllPoints() name:SetWidth(165) name:SetHeight(8) name:SetJustifyH("LEFT") name:SetShadowColor(0, 0, 0, 0) timer:ClearAllPoints() timer:SetJustifyH("RIGHT") timer:SetShadowColor(0, 0, 0, 0) frame:SetHeight(bar.owner.options.Height) name:SetPoint("LEFT", frame, "LEFT", 4, 0) timer:SetPoint("RIGHT", frame, "RIGHT", -4, 0) timer:SetFont(C["Media"].Font, C["Media"].FontSize, C["Media"].FontStyle) name:SetFont(C["Media"].Font, C["Media"].FontSize, C["Media"].FontStyle) if bar.owner.options.IconLeft then icon1.overlay:Show() else icon1.overlay:Hide() end if bar.owner.options.IconRight then icon2.overlay:Show() else icon2.overlay:Hide() end bar.injected = true end) bar:ApplyStyle() end end end local function SkinRange(_, _, _, forceshow) if DBM.Options.DontShowRangeFrame and not forceshow then return end if DBMRangeCheck then DBMRangeCheck:StripTextures() DBMRangeCheck:CreateShadow(true) DBMRangeCheckRadar:StripTextures() DBMRangeCheckRadar:CreateShadow(true) end end local function SkinInfo() if DBM.Options.DontShowInfoFrame and (event or 0) ~= "test" then return end if DBMInfoFrame then DBMInfoFrame:StripTextures() DBMInfoFrame:CreateShadow(true) end end hooksecurefunc(DBT, "CreateBar", SkinBars) hooksecurefunc(DBM.RangeCheck, "Show", SkinRange) hooksecurefunc(DBM.InfoFrame, "Show", SkinInfo) end end)
-- -- Elemental drives are used to store magical energy (Elegens, hence the 'ele') -- minetest.register_craftitem("yatm_dscs:ele_drive_t1", { basename = "yatm_dscs:ele_drive", base_description = "Elemental Drive", description = "Elemental Drive (Tier 1)", groups = {inventory_drive = 1, ele_drive = 1}, inventory_image = "yatm_inventory_drives_ele_tier1.png", drive_capacity = 32, stack_max = 1, }) minetest.register_craftitem("yatm_dscs:ele_drive_t2", { basename = "yatm_dscs:ele_drive", base_description = "Elemental Drive", description = "Elemental Drive (Tier 2)", groups = {inventory_drive = 2, ele_drive = 2}, inventory_image = "yatm_inventory_drives_ele_tier2.png", drive_capacity = 128, stack_max = 1, }) minetest.register_craftitem("yatm_dscs:ele_drive_t3", { basename = "yatm_dscs:ele_drive", base_description = "Elemental Drive", description = "Elemental Drive (Tier 3)", groups = {inventory_drive = 3, ele_drive = 3}, inventory_image = "yatm_inventory_drives_ele_tier3.png", drive_capacity = 512, stack_max = 1, })
local Shortcut = R 'nvim.newutil.keymap' R'nvim-comment-frame'.setup({ disable_default_keymap = true }) Shortcut:mode('n'):options():noremap():next():keymap( ',C', ':lua require(\'nvim-comment-frame\').add_comment()<CR>')
--------------------------------------------- -- Aqua Breath -- -- Description: Deals Water damage to enemies within a fan-shaped area. -- Type: Breath -- Utsusemi/Blink absorb: Ignores shadows -- Range: Unknown cone -- Notes: --------------------------------------------- require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/monstertpmoves") --------------------------------------------- function onMobSkillCheck(target,mob,skill) return 0 end function onMobWeaponSkill(target, mob, skill) local dmgmod = MobBreathMove(mob, target, 0.25, 1.5, tpz.magic.ele.WATER, 400) local dmg = MobFinalAdjustments(dmgmod,mob,skill,target,tpz.attackType.BREATH,tpz.damageType.WATER,MOBPARAM_IGNORE_SHADOWS) target:takeDamage(dmg, mob, tpz.attackType.BREATH, tpz.damageType.WATER) return dmg end
-- Script de bootstrap, en appuyant sur le bouton ça démarre start_boot, -- autrement en attendant 8 secondes cela démarre start_boot print("\n init.lua zf200717.1625\n") zswitch=3 --switch flash gpio.mode(zswitch, gpio.INT, gpio.PULLUP) initalarme=tmr.create() function hvbouton() gpio.trig(zswitch, "none") initalarme:unregister() dofile("start_boot.lua") end gpio.trig(zswitch, "both", hvbouton) initalarme:alarm(8000, tmr.ALARM_SINGLE, function() print("\nStart\n") dofile("start_boot.lua") end)
--[[ This program runs scripts that demonstrate what you can do with spirograph graphics. To execute this program [click here](macro:run), press `F6` on the keyboard, or click on `Project | Run` menu at the top of this window. After you explore the demos you can open each of the files to study and tweak them. ]] require "spirograph" local demos = [[ astroid.lua bud.lua cardioid.lua circles.lua donut.lua double.lua earth.lua galaxy.lua flower.lua pearls.lua resolution.lua rose.lua spiral.lua square.lua star.lua sunflower.lua ]] local x,y = size() local waitorg = wait wait(1) for file in demos:gmatch("([%w%p]+)") do wait = function(seconds) if seconds then return waitorg(seconds) end local x, y = size() posn(-x/2+10, -y/2+10) hide() -- hide the turtles (if any are shown) text("Done with '"..file.."'; pause for 2s...") updt() -- refresh the screen waitorg(2) end dofile('spirograph-samples/'..file) size(x,y) end
return { Codecs = require(script.Codecs), CFrame = require(script.CFrameUtils), Color = require(script.ColorUtils), JSON = require(script.JSONUtils), Math = require(script.MathUtils), Part = require(script.PartUtils), Raycast = require(script.RaycastUtils), Screen = require(script.ScreenUtils), Table = require(script.TableUtils), Terrain = require(script.TerrainUtils), Vector3 = require(script.Vector3Utils), }
if os.target() == "windows" then dofile("premake5-cuda-vs.lua") end if os.target() == "linux" then dofile("premake5-cuda-linux.lua") end
-- Copyright (C) by Hiroaki Nakamura (hnakamur) local resty_cookie = require "resty.cookie" local setmetatable = setmetatable local _M = { _VERSION = '0.1.0' } local mt = { __index = _M } function _M.new(self, config) local cookie_manager, err = resty_cookie:new() if not cookie_manager then return nil, string.format("error to create resty.cookie instance for session cookie, err=%s", err) end return setmetatable({ cookie_manager = cookie_manager, name = config.name, secure = config.secure, path = config.path }, mt) end function _M.get(self) local value, err = self.cookie_manager:get(self.name) if err == "no cookie found in the current request" then return nil, nil end if err ~= nil then return nil, string.format("error to get session cookie, key=%s", self.name) end return value end function _M.set(self, session_id) local ok, err = self.cookie_manager:set{ key = self.name, value = session_id, path = self.path, secure = self.secure, httponly = true } if not ok then return false, string.format("error to set session cookie, key=%s, value=%s, path=%s, secure=%s, err=%s", self.name, session_id, self.path, self.secure, err) end return true end function _M.delete(self) local ok, err = self.cookie_manager:set{ key = self.name, value = "", path = self.path, secure = self.secure, httponly = true, expires = "Thu Jan 01 1970 00:00:00 GMT" } if not ok then return false, string.format("error to delete session cookie, key=%s, path=%s, secure=%s, err=%s", self.name, session_id, self.path, self.secure, err) end return true end return _M
roomboxesLayer= { name="roomboxesLayer",type=0,typeName="View",time=0,report=0,x=0,y=0,width=1280,height=800,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignTopLeft, { name="t_bg",type=1,typeName="Image",time=59810693,report=0,x=0,y=0,width=1280,height=720,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignTopLeft,file="isolater/bg_shiled.png" } } return roomboxesLayer;
--[[ lang.lua Copyright (C) 2016 Kano Computing Ltd. License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPLv2 English language ]]-- return { ------ HEADERS AND OPTIONS ---------------------------------------------------------- enter = "Press Enter", loading = "Loading", play = "Play", letsHack = "Let's hack!", letsMake = "Let's make!", letsGo = "Let's go! [ENTER]", checkMap = "Check Map", maybeLater = "Maybe later", wasFun = "That was fun!", maps = "Where am I?", challenges = "What's Pong?", Yes = "Yes", No = "No", rabbit = "Where is the rabbit?", who = "Who are you?", what = "What is this?", how = "How does it work?", interested = "I'm interested", why = "Why?", bye = "See you later", you = "you", coming = "Coming Soon...", tellMe = "Tell me more", sine = "Sine", triangle = "Triangle", square = "Square", noise = "Noise", playPong = "Play Pong", makePong = "Make Pong", flappyJudoka = "Play Flappy Judoka", minecraft = "Hack the game", makeArt = "Make Art", makeMusic = "Launch Sonic Pi", createArt = "Make a creation", playSnake = "Play Snake", playterminalquest = "Go to Folderton", mehTemp = "No thanks", ok = "Ok", blank = " ", firstLoadingText = "Preloading Data...", secondLoadingText = "Entering the computer...", temp = 'Waiting for copy..', complete = "Quest Complete", tempNoInternetCopy = "Internet connection not found. Connect now?", tempLaunchWifiConfig = "Launch Settings", tempNoUpdatesCopy = "Awesome! You're fully up to date. Come back to check for updates soon.", tempUpdatesAvailableCopy = 'Updates found! Install them now?', tempLaunchUpdater = "Launch Updater", painting1 = "Launch the creation in Kano World?", launchShareTemp = "Launch", --- Menu --- close = "Close", map = "Map", quests = "Quests", codex = "Codex", completed = "completed", discovered = "Discovered", exit = "Back to Dashboard?", underConstruction = "Under construction", undiscovered = "Undiscovered", activeQuests = "Active Quests", completedQuests = "Completed Quests", questsCompleted = "Quests Completed", codexDiscovered = "Codex Items Discovered", backCodex = "Back to Codex", search = "search", codexEmpty = "No Codex Items Found", --- Pop ups --- stepComplete = "Step $1/$2 complete", questComplete = "Quest Complete", newQuest = "NEW QUEST:", newArea = "NEW AREA:", codexDiscovery = "CODEX DISCOVERY:", --- Area Name Keys --- backToDashboard = "Back to Dashboard", binaryborderArea = "Binary Border", beachArea = "SD Beach", lakeArea = "Logic Lake", lakeSchoolArea = "Logic Gate School", coveArea = "Power Path", plainsArea = "Fiberglass Plains", portetherArea = "Port Ether", etherstationArea = "Ether St Station", villageArea = "Vector Village", jungleArea = "Python Jungle", minesentranceArea = "Block Mines Entrance", minesArea = "Block Mines", momaArea = "Museum of Make Art", powerArea = "Power Port", hdmiArea = "HD Hill", --- People's Names --- mrPong = "Allan", mrInfo = "Mr. Info", LogicLakeNerd = "Curious Student", LogicLakeMaster = "Mosfet", Radu = "Radu", rivalKid = "Rival", portetherMayorName = "Mayor of Port Ether", Caroline = "Caroline", Asterix = "Asterix", Tilde = "Tilde", antlerBoy = "Semicolon", Alex = "Alex", Vertex = "Curator", DevOps = "DevOps", chilledBoy = "Chilled Boy", chilledGirl = "Chilled Girl", Gregory = "Gregory", cafeTextCode = "Text Code Fan", cafeBlocksCode = "Blocks Code Fan", cafeHostess = "Coffee Script Fan", Twin1 = "Pix", Twin2 = "El", pixelHacker = "Pixel Hacker", MissWatts = "Miss Watts", powerGuardName = "Power Guard", HDMasterName = "HD Cameraman", newsReporter = "HD News Reporter", Jack = "Jack", --- Tech Questions --- logic = "What are Logic Gates?", ------ SPEECH BUBBLES --------------------------------------------------------------- level = "You are in level $1, and have completed $2 challenges", ------ DIALOGUES -------------------------------------------------------------------- -- Overworld - Beach -- mrPongDiag1 = "Pong. Pong. Pong. I love Pong. Fancy a game? Or even better, make your own?", mrPongDiag2 = "Boo! Maybe you should go and find the Art Museum instead.", mrInfoDiag1 = "Did you know SD Beach is built on a micro SD card? Below are" .. " teeny tiny electronic chips that remember your masterpieces, even when your" .. " computer is turned off. Check the map to see other parts of the computer.", chilledgirlDiag0 = "Woah! Where'd you just come from? Was that strange rabbit with you?", chilledgirlDiag = "Done all the Pong challenges yet? I hear you unlock a badge if you do.", sunburntDiag0 = "It's my first time at SD Beach too. Under our feet are all the computer's" .. " memories.", sunburntDiag = "I've just come from the Block Mines, where I learnt new super powers" .. " that control Minecraft!", beachSignPost = "Exit to Power Path", gregory1 = "Pong may seem simple, but master its code and there's no stopping you." .. " Talk to Allan in the orange hut to try Make Pong.", gregory2 = "Hmm you've not finished Make Pong? It's a great way to level up and earn" .. " more coding powers! You'll need them.", gregory3 = "Wow you're level $1! Have you tried sharing a creation?", --- Newsboard for updates --- newsboard = "- - - LATEST NEWS - - -\nThe Power Port has been built! Follow the" .. " Power Path down south and view the LED. \nHD Hill has now opened. Go to the east of Logic" .. " Lake and follow the cables to see the sights. \n\nPort Ether has also opened its Sound Port." .. " Check out the disco and join the party.", -- Beach -- Quests -- -- Mr Info Quest --- mrInfoQuestTitle = "Explore the world", mrInfoQuestComplete = "Learned to use the world map.", mrInfoQuest1 = "Hello $1. Welcome to your computer. The more you explore and make," .. " the more powerful you'll become. Open your map to see the world.", mrInfoQuest2 = "To defeat the White Rabbit you'll have to level-up. Uncover the" .. " computer's secrets and conquer coding challenges to become a Kano Master." .. " I saw the white rabbit bouncing off to the right, towards the Power" .. " Port. It might be wise to follow it and see what it's up to.", mrInfoQuest3 = "Keep exploring this world. Come back and find me when you've discovered" .. " more than half of the island.", mrInfoQuest4 = "High-five! If you want to discover more about the world, you should" .. " head over to the Logic Gate School.", mrInfoQuestHelp1 = "Talk to the Info Center on SD Beach.", mrInfoQuestHelp2 = "See what else Mr. Info has to say.", mrInfoQuestHelp3 = "Explore at least 50% of the world.", mrInfoQuestHelp4 = "Go back to Mr. Info on SD Beach.", --- Pong Quest --- pongQuestTitle = "Intro to Make Pong", pongQuestComplete = "Completed Make Pong basics.", pongQuestHelp1 = "Talk to Gregory on the beach.", pongQuestHelp2 = "Complete challenge 2 in Pong.", pongQuestHelp3 = "Listen to Gregory's Pong advice.", pongQuest1 = "Hey there! You can make your own Pong game y'know.", pongQuest2 = "How about making the most awesome game of Pong ever? Talk to Allan in" .. " the orange hut and try to beat 2 challenges.", pongQuest3 = "Nice job. You're on your way to becoming a Kano Master. Have you tried" .. " sharing your amazing Pong creation?", -- Overworld -- Power Lighthouse --- powerOutside = "Have you come to visit the Power Port too? Did you know the whole" .. " computer is powered by energy brought in through the red cable?", powerOutside2 = "I hear you should never pull the power cable out without shutting" .. " the computer down first.", powerOutside3 = "Because the data can get corrupted and cause the computer to lose its" .. " memories. Definitely worth shutting down properly!", powerGuard = "Is that rabbit yours?", powerGuard2 = "Oh really? Well its been running around the lighthouse. This is where" .. " we receive electrical energy to power the computer.", powerGuard3 = "Oh ok, well welcome to Power Port. If you climb up to the top of the" .. " lighthouse you can see if the LED is working.", powerPerson1 = "Energy is the ability to do work and can take many forms. In the Power Port" .. " the energy is transformed into electricity and light.", powerPerson2 = "I don't have much energy. I'm on standby... Zzzzzz...", powerPerson3 = "Yo. Power is the rate at which electrical energy is transferred. The" .. " power port here transfers energy to all the components on the computer.", powerMissWatts = "I'm in CHARGE of monitoring the power levels. When" .. " the red light is on, we know that there is energy flowing into the computer." .. " Check out the light!", powerVoltage = "This computer needs 5 Volts, or 5V to operate. The energy flows in through" .. " this Power Port.", powerCurrent = "You see drawings of the flow of electricity through the computer, and" .. " a note saying: Current is the rate at which electrical charge is transferred.", powerLED = "You see a shining bright red light with the letters PWR underneath.", --- Power Quest --- powerQuestTitle = "The Power Port", powerQuestComplete = "Discovered how the computer is powered.", powerQuest = "POW you made it! I'm in CHARGE of monitoring the power levels. When" .. " the red light is on, we know that there is energy flowing into the computer.", powerQuest2 = "Why don't you check out the LED over there?", powerQuest3 = "Pretty bright isn't it? By the way, there was an energetic rabbit" .. " bouncing around. I don't think it did anything, but it does seem mischievous." .. " I think it headed towards the HDMI port.", powerQuestHelp = "Follow the white rabbit down the Power Path.", powerQuestHelp2 = "Investigate the LED in the lighthouse.", powerQuestHelp3 = "Find out more from Miss Watts.", -- Overworld - Cove -- hdmicuriousDiag = "Have you seen the yellow HDMI cables? They take the 2,073,600 pixels" .. " from the computer's brain and brings them to life on screen.", -- Overworld - Logic Lake -- mrFlappy1 = "Great games are based on simple logic. Flap up, or else fall down." .. " Your high score is $1. Let's see how far you fly!", mrFlappy2 = "Come back any time.", llFarmer = "These yellow HDMI cables are 'High-Definition'. They send 'Media' - sound" .. " and pictures. That makes them an 'Interface.'", llMaster = "I'm Mosfet, Logic Master. What are logic gates? Only the building blocks" .. " of digital computers!", llMaster2 = "Logic gates take 1s and 0s in and output a single 1 or 0. Connect many" .. " logic gates together and you have a series of instructions for anything.", llMaster3 = "Good luck on your journey. Keep exploring and leveling up.", llPupil = "You can use coding languages to change the rules of the computer.", llNerd = "Can you help me? I'm studying to become a Kano Master, but there are some secret" .. " scrolls I need to level up.", llNerd2 = "I hear some twins in Vector Village may have what I need. Can you find it" .. " and let me know what you learn?", llNerd3 = "You found it! So code turns humans words into binary. Computers think in" .. " binary. I must know more!", llNerd4 = "Can you try to find out how programs work? Apparently there's" .. " a book in Port Ether library that has this info.", llNerd5 = "Incredible! So I tell computers what to do using code. Thanks so much for" .. " your help.", llNerdDiag = "I'm a student here. My favorite Logic Gate is the NOT gate. Have" .. " you spoken to the Logic Master yet?", llSignpost = "Logic Lake - Home of the Logicians", llCheerfulGirl = "These HDMI cables send millions of tiny blocks of color called" .. " pixels to a screen. Have you ever tried to plug one in?", llScaredSon = "If you get lost exploring you can fast travel to places you've" .. " discovered! Open the map with [ESC] and click where you want to go.", llRunnerGirl = "Logic is cool. You can use it to make some great games!", llComputer = "LOGIC GATES:\nA logic gate is a building block of a digital circuit. Most" .. " logic gates have 2 inputs and 1 output. At any given moment, every terminal" .. " is in one of the 2 binary conditions low (0) or high (1).", LakeExitSign = "Exit to Fiberglass Plains", --- Flappy Kid Decision dialogue --- rivalKidDiag = "Hey! I'm a pro at flying in Flappy Judoka. Let's see your skills...", rivalKidDiag2 = "Your current high score is $1. I'm sure you" .. " can do better.", rivalKidDiag3 = "Oh! Your current high score is $1. That's pretty impressive.", rivalKidDiag4 = "WOW! Your current high score is $1. You've got the cool, calm," .. " logical flying nailed.", -- Logic Lake Quests -- -- Rival Kid Quest -- rivalKidQuestTitle = "No one flies better than me", rivalKidQuestComplete = "Scored 30 or above on Flappy Judoka.", rivalKidQuest1 = "Hey! Have you tried out Flappy Judoka? No one flies better than me.", rivalKidQuest2 = "Can you get 20 points in Flappy Judoka? You can play" .. " by talking to the guy by the fence.", rivalKidQuest3 = "Wow! Well done. What about getting a score of 30? That's my high score.", rivalKidQuest4 = "Are you going to try to get 30 points in Flappy Judoka?", rivalKidQuest5 = "Woah that's amazing! You're definitely good at simple up and down logic." .. " Talk to the Logic School Master to learn more.", rivalKidHelp1 = "Talk to the Rival in Logic Lake.", rivalKidHelp2 = "Get a score of 20 or more in Flappy Judoka.", rivalKidHelp3 = "Talk to the Rival in Logic Lake.", rivalKidHelp4 = "Get a score of 30 or more in Flappy Judoka.", rivalKidHelp5 = "Talk to the Rival in Logic Lake.", -- Top Student Quest --- LogicLakeNerdQuestTitle = "How do computers think?", LogicLakeNerdQuestComplete = "Discovered that step-by-step instructions called algorithms command" .. " computers.", LogicLakeNerdQuest1 = "You find a secret scroll on code: It reads: A program turns" .. " human words into 1s and 0s. This is called code.", LogicLakeNerdQuest2 = "You find a book on Algorithms. It reads: We use code to give" .. " computers step-by-step instructions.", LogicLakeNerdHelp1 = "Talk to the student in Logic Gate School.", LogicLakeNerdHelp2 = "Find a book in the twins' house in Vector Village.", LogicLakeNerdHelp3 = "Report back to the student in Logic Gate School.", LogicLakeNerdHelp4 = "Go to Port Ether library to investigate algorithms.", LogicLakeNerdHelp5 = "Report back to the student in Logic Gate School.", -- Overworld - Cove -- plains01Sign = "HD Hill Ahead", -- HD Hill -- newsWatcher = "Shhh, I'm such a fan of the HD News Crew.", HDMIgirl = "Wow, the HDMI port is amazing. Did you know it can transfer 162,000,000" .. " pixels per second?", HDMIreporter = "I love filming at the HDMI port. Watching the pictures, video and" .. " sound go from here to the screen.", HDsoundguy = "Echo... echo... echo...", HDmaster = "1080p. A weird name? But also the number of pixels high the screen image is." .. " More coming up next, on HD news.", -- HDMI Quest -- hdmiQuestTitle = "Explore the HDMI", hdmiQuestComplete = "Learned about HDMI and its workings.", hdmiQuestHelp = "Find the news reporter on HD Hill.", hdmiQuestHelp2 = "Complete an interview with the HD news crew.", hdmiQuestHelp3 = "Talk with the news reporter.", hdmiQuest = "Heya. We were making a film about the yellow cable transferring pictures," .. " video and sound from the computer to the screen, when that strange White Rabbit" .. " ran past.", hdmiQuest2 = "Can you do an interview with our reporter?", hdmiQuest3 = "Nice one. This report will blow the White Rabbit story wide open!" .. "\nNow we just need to follow up on the sightings at the Port of Sound.", --- HD News Interview --- hdmiInterviewWelcome = "Hello, would you be willing to have an interview about recent events?", hdmiInterview1 = "And... ACTION! You're watching HD News! We're reporting live" .. " from HDMI port on the recent White Rabbit sightings. We're speaking with $1," .. " what brings you here today?", hdmiInterview1a = "Exploring computer", hdmiInterview1b = "Chasing the rabbit", hdmiInterview2 = "Great! Judoka travel far and wide to visit the HDMI port. To glimpse" .. " the 18 billion bits of data travel from the computer's brain to the screen!" .. " \nBut it was also the last reported location of the mysterious White Rabbit." .. " \nHave you seen it?", hdmiInterview21 = "You're investigating it too? We're still trying" .. " to figure out what's going on, so any information you have could be valuable" .. " to our viewers. \nDo you know where it comes from?", hdmiInterview2a = "Binary Border", hdmiInterview2b = "No", hdmiInterview3 = "It came from Binary Border?!" .. " That means it may have the coding powers to reshape" .. " the world around us. \nThere's no telling what it may do!" .. " The only way to stop it would be to uncover the secrets of the computer and" .. " master code powers. \nCan you help?", hdmiInterview31 = "We've heard mysterious reports from Folderton and Port Ether," .. " we think the rabbit may have coding powers. \nCan you help?", hdmiInterview3a = "I have coding powers", hdmiInterview3b = "Kano Master", hdmiInterview4 = "Amazing! Lots of Judoka have mastered one type of coding, but few" .. " have mastered them all, it would take a true Kano Master to tackle the rabbit" .. " head on.", hdmiInterview41 = "You're training to be a Kano Master? Wow! But you'll have to" .. " discover more about computers and learn different coding powers to level up," .. " become a true Kano Master and get that rabbit under control.", hdmiInterviewFinal = "OK! Thanks for your time $1. Next up: How data travels down" .. " the yellow cable at near the speed of light! Stay tuned.", -- Overworld - Vector Village -- villageSummercampBoy = "The waterfalls are warm because the processor to the north" .. " gets very hot when its thinking!", villageSummercampGirl = "Do you know what this village is named after?", villageSummercampGirl2 = "Vectors! A vector tells us how far away one point is away" .. " from another. That's how programs like Make Art can draw their shapes with code!", villageSummercampBoy2 = "I love the Museum of Make Art. I really hope one of my" .. " creations is Staff Picked and framed on the walls.", makeArtTerminal1 = "Create a masterpiece with Make Art?", makeArtTerminal2 = "Come back soon...", pixelHackerDiag1 = "Check the computer to do more Make Art! I see you are" .. " level $1 on the Basic challenges.", -- Houses -- House01Boy = "Heya! Feel free to check out our bookshelf. We have a pretty good collection.", House01Girl = "Did you know that pixels are the basic unit of color on a computer display?" .. " Every pixel is made up of three colors: Red Green and Blue.", House02Boy = "My sister is chilling on SD beach. I keep telling" .. " her that Make Art is way better than Pong, but she won't listen. Have you" .. " ever drawn something with code before?", house03PotNote = "Oh! There's a note in the pot. It reads: 'Rabbit was here. Why you" .. " talking to a plant, huh?'", village02DoorSign = "Museum of Make Art - CLOSED - Waiting for further Make Art creations", village_house02Computer = "There are some terminal commands on the screen.", --- Make Art Quiz --- makeArtQuizWelcome = "Try out the Make Art quiz?", makeArtQuizIncorrect = "Incorrect. Try Make Art to find the right answer.", makeArtQuiz1 = "How do you code an object to be yellow?", makeArtQuiz1a = "yellow color", makeArtQuiz1b = "color yellow", makeArtQuiz2 = "Nice one! How do you code a rectangle of width 20 and height 40?", makeArtQuiz2a = "rectangle 20, 40", makeArtQuiz2b = "rectangle 40, 20", makeArtQuiz3 = "Great work! Final question: I want to move an object relative to" .. " another object. Which command should I use?", makeArtQuiz3a = "move", makeArtQuiz3b = "moveTo", makeArtQuizEnd = "Congratulations! You really know your stuff. You should try sharing" .. " your creations online!", -- MoMa -- momaArtAdmirer1 = "I love these creations so much! I hope that one of my Staff Picks" .. " displays here some day.", momaArtAdmirer2 = "Wow check out those pixels!", momaReception = "Welcome to the Museum of Make Art. Take a look at the latest" .. " staff picks on display.", momaArtCritic = "Hmmm... I wonder how functions can draw a teapot?", momaArtCritic2 = "Ah... This piece is called Perlin Noise. It's made from an algorithm." .. " The same one used to create patterns in Minecraft blocks.", momaProgrammer = "Did you know that make art uses the programming language CoffeeScript?" .. " It's really amazing.", momaFloorSign0 = "Pixel Hacker Lab", momaFloorSign1 = "MOMA Staff Picks Collection,\nThe Latest and Greatest from Kano World", momaFloorSign2 = "MOMA Permanent Collection,\nHistorical Code Based Artworks and Algorithms", momaUpstairsPlaque1 = "Perlin Noise (1983),\nKen Perlin", momaUpstairsPlaque2 = "Mandelbrot Set (1980),\nBenoit Mandelbrot", momaUpstairsPlaque3 = "Utah Teapot, (1975),\nMartin Newell", momaUpstairsPlaque4 = "MOUVNT Sculpture Programme (1972),\nJose Luis Alexanco", momaUpstairsPlaque5 = "AARON Artificial Intelligence (1990),\nHarold Cohen", momaUpstairsFan1 = "The Mandlebrot Set is a fractal, which is an example of something" .. " called recursion. Shapes are drawn using rules that draw themselves upon themselves," .. " this creates beautiful images that look like plants or galaxies.", momaUpstairsFan2 = "This teapot is a famous object from early 3D graphics, at the time" .. " rendering the curves of a teapot was a challenge so this particular teapot was often" .. " used to test 3D rendering code. Some 3D software include the teapot as a basic object" .. " next to cubes and spheres, causing it to often appear as a joke in 3D films.", momaUpstairsFan3 = "AARON was the first Artificial Intelligence artist, using complex" .. " algorithms built up from simple commands like the ones we use in Make Art it was" .. " able to create convincing artworks that could be mistaken for the work of a human" .. " artist. Although its styles had to be hand coded by Cohen, it was able to create" .. " an infinite number of artworks in these styles.", vertex1 = "Check the computer to do more Make Art! I see you are" .. " level $1 on the medium challenges.", -- Shares Fanatic Decision Dialogue --- momaSharesFanatic = "The servers in that room contain all the creations shared on Kano" .. " World. Let me check how much you've shared...", momaSharesFanatic2 = "Oh dear... an artist of your skill and you've not shared a thing." .. " Why not share a masterpiece now?", momaSharesFanatic3 = "Good going. You've shared 1 creation online. Keep on making!", momaSharesFanatic4 = "Wow you've made $1 creations. Nice work - keep up the coding!", momaSharesFanatic5 = "Woah! $1 creations made total. Awesome work, keep it up!", momaSharesFanatic6 = "WOW. $1 creations shared! That's incredible! You're well on" .. " way to being a Make Art guru.", -- Vector Village -- Quests -- --- Make Art Quest 1 - Complete Basic Challenge 3 ---- makeArtQuestTitle = "Make Art with code", makeArtQuestComplete = "Completed first 3 basic challenges in Make Art.", makeArtQuestHelp1 = "Go to Vector Village and talk to the Pixel Hacker.", makeArtQuestHelp2 = "Complete first 3 basic challenges in Make Art.", makeArtQuestHelp3 = "Talk to the Pixel Hacker in Vector Village.", pixelHacker1 = "Hi there, welcome to Vector Village! This is home to the famous" .. " Museum of Make Art. If you've come to learn how to make art with code you've" .. " come to the right place.", pixelHacker2 = "Why don't you use the computer beside me and complete the first" .. " 3 challenges of Make Art?", pixelHacker3 = "Nice one! Why not visit the Make Art Museum to the west? The Curator" .. " is in the basement there. She knows a lot about Make Art.", pixelHackerHelp1 = "Talk to the Pixel Hacker in Vector Village.", pixelHackerHelp2 = "Beat first 2 Basic Levels in Make Art.", pixelHackerHelp3 = "Talk to the Pixel Hacker in Vector Village.", --- Make Art Quest 2 --- Complete Basic + Medium ---- makeArtQuestTitle2 = "Intermediate Make Art", makeArtQuestComplete2 = "Completed basic and medium challenges in Make Art.", chiefPixelHackerQuest1 = "Hello welcome to MoMA. I am the Curator. I guess" .. " you have come to learn some more Make Art? Try out our Make Art Quiz!", chiefPixelHackerQuest2 = "How about you start by taking our Make Art Quiz? You can" .. " launch it from the computer next to me.", chiefPixelHackerQuest3 = "Nice one! It looks like you've mastered those commands," .. " let's finish off the rest of the basic challenges.", chiefPixelHackerQuest4 = "Are you going to complete the basic Make Art challenges?" .. " You can do it from the computer in the corner.", chiefPixelHackerQuest5 = "You're getting the hang of this, the real fun with using" .. " code to Make Art is that you can create artworks in minutes that would take hours" .. " to create by hand as long as you know the right functions to use. Why don't you try" .. " your hand at the Medium Make Art challenges? You'll learn how to create starry" .. " nights and rainbows with just a few lines of code.", chiefPixelHackerQuest6 = "How about you try completing the Medium challenges in Make Art?", chiefPixelHackerQuest7 = "Well done you're well on your way to becoming an expert" .. " Pixel Hacker. You can get some sweet rewards if you make it all the way to the end" .. " of the Pixel Hack or Summer Camp challenges.", chiefPixelHackerHelp1 = "Talk to Curator in the Museum of Make Art.", chiefPixelHackerHelp2 = "Complete the Make Art Quiz.", chiefPixelHackerHelp3 = "Talk to Curator in the Museum of Make Art.", chiefPixelHackerHelp4 = "Complete the basic challenges in Make Art.", chiefPixelHackerHelp5 = "Talk to Curator in the Museum of Make Art.", chiefPixelHackerHelp6 = "Complete the medium challenges in Make Art.", chiefPixelHackerHelp7 = "Talk to Curator in the Museum of Make Art.", --- Creations on Servers Quest --- sharesQuestTitle = "How does Vector Village store data?", sharesQuestComplete = "Discovered that creations in Make Art are saved on servers.", sharesQuest1 = "Heya! So you want to find out about how Vector Villages stores data?" .. " How about you try sharing a Make Art creation online?", sharesQuest2 = "Have you tried sharing a Make Art creation?", sharesQuest3 = "Nice one! Now I think you should learn about where we keep all of our" .. " creations. Take a look at one of those machines in the room.", sharesQuest4 = "We store our data on other computers.", sharesQuest5 = "What do you think?", sharesHelp1 = "Find DevOps in the Make Art Museum.", sharesHelp2 = "Check out the servers in the basement in Make Art.", sharesHelp3 = "Talk to DevOps.", sharesHelp4 = "Share 3 Make Art Creations.", sharesHelp5 = "Talk to DevOps.", sharesQuestServer4 = "The server is flashing.", -- Overworld - Plains -- plainsFarmer = "Y'know, your computer can do incredible things, but it is just a big" .. " pile of switches.", plainsProfessor = "Oh, hello. I'm on an expedition to research the circuit board." .. " I'm planning to dig through the fiberglass to find the copper core!", plainsRAMProfessor = "Software updates add new features and open new areas, like" .. " Memory Mines. Be sure to check your dashboard and update when you can!", plainsBuilder = "Phew, I'm exhausted after working so hard on the update. The depths" .. " of the RAM will be open to the public soon!", plainsAdventureGirl = "This path leads to Python Jungle, a dark shady place." .. " They say that only those who know terminal commands get respected there.", -- Overworld - Jungle -- jungleMakeSnake1 = "Play Make Snake?", jungleAsterix = "In this realm we use magic words to speak to the computer and control" .. " snakes. Try it out - I can see you're on challenge $1.", jungleWildGirl = "How many apples can you eat? I bet you can't get over 100.", jungleDaringBoy = "I speak dozens of languages. I control Minecraft with Python." .. " And create websites with Javascript.", jungleScaredGirl = "Eeeek that snake! I was on my way to the Block Mines but I'm too" .. " scared to move.", jungleWildBoy = "The Block Mines are to the right. Explore them to find the Minecraft" .. " Master.", jungleTildeDiag1 = "We like to play with snakes and parameters. Let's see how good you" .. " are at those... Hmmm challenge $1.", jungleTildeDiag2 = "You still have a ways to go before you are as good as us. Talk" .. " to the chief to play some Snake.", jungleTildeDiag3 = "Oh! Not half bad - you are level $1. Nice one.", jungleTilde2 = "Go to the right to find the quiz.", -- Jungle Quiz --- jungleWildAntlerBoy = "We don't usually get people brave enough to come here." .. " Do you know what LS means in terminal?", jungleWildAntlerBoy2 = "Hmm... a fancy answer but that ain't right for the terminal.", jungleWildAntlerBoy3 = "Nice one! What about the 'CD' command?", jungleWildAntlerBoy4 = "Good going. And what does 'MV' mean?", jungleWildAntlerBoy5 = "Haha you're right! Final question: What does 'RM' mean?", jungleWildAntlerBoy6 = "Ooooh congratulations, you really do know your terminal" .. " commands. Well done.", jungleQuizOption1a = "List files", jungleQuizOption1b = "Linux Operating System", jungleQuizOption2a = "Change Directory", jungleQuizOption2b = "Compact Disc", jungleQuizOption3a = "Motion Video", jungleQuizOption3b = "Move", jungleQuizOption4a = "Random Memory", jungleQuizOption4b = "Remove", -- Jungle Quests -- -- snakeQuestTitle = "Intro to Make Snake.", -- snakeQuestComplete = "Completed level 2 in Make Snake.", -- snakeQuestHelp1 = "Talk to the chief in the jungle.", -- snakeQuestHelp2 = "Complete 2 levels in snake.", -- snakeQuestHelp3 = "Talk to the chief in the jungle.", --- Asterix --- Uncovering the Terminal --- jungleAsterixQuestTitle = "Uncovering the Terminal with Snake", jungleAsterixQuestComplete = "Discovered terminal parameters in Make Snake.", jungleAsterix1 = "I can see you came from a dark place." .. " I can teach you more commands in the computer's shell, where a terrifying" .. " snake dwells.", jungleAsterix2 = "Are you brave enough to get past level 2 in Make Snake?", jungleAsterix3 = "Well done for getting this far in Make Snake. Why not visit the" .. " Block Mines next?", jungleAsterixHelp1 = "Talk to Asterix in Python Jungle.", jungleAsterixHelp2 = "Complete challenge 2 in Make Snake.", jungleAsterixHelp3 = "Report back to Asterix in Python Jungle.", --- Tilde ---- Challenge Terminal Quests ---- jungleTildeQuestTitle = "Spells in Python Jungle", jungleTildeQuestComplete = "Learned terminal spells LS, CD, MV and RM through the Python Jungle" .. " Quiz.", jungleTildeQuest1a = "Hello. So... you've come here to learn about terminal commands? See if" .. " you can beat the challenge from my friend Semicolon.", jungleTildeQuest1b = "Have you spoken to Semicolon? He's a bit further down" .. " the jungle and has a challenge for you.", jungleTildeQuest1c = "Nicely done! So now you know a few more terminal commands. I" .. " recommend going to Vector Village if you want to investigate more.", jungleTildeHelp1a = "Talk to Tilde in Python Jungle.", jungleTildeHelp1b = "Complete the terminal quiz in Python Jungle.", jungleTildeHelp1c = "Tell Tilde in Python Jungle you completed the Quiz.", -- Overworld - Mines -- mines01Sign = "Block Mines - for master builders only", minesSleepingGirl = "Zzzzzz just taking a quick break... I've been coding all day. Zzzzzz...", minesProfessor = "Our research group is working here. We're digging deep into the USB." .. " Please return once there's an update.", minesExplorer = "Ahead, enter a new dimension - a place of blocks and powers", minesFrightenedBoy = "Wow, did you know you can create a shelter with the tap of a key" .. " in Minecraft?", minesDojoWoman = "My favorite power in Hack Minecraft is Holey Moley." .. " I love digging holes super quick!", minecraftAlexDiag = "Check the computer next to me to code your own super powers" .. " in Minecraft.", makeMinecraft = "Ready to Hack Minecraft?", -- Mines -- Quests -- -- Alex Quest Dialogue -- minecraftAlex1 = "You've come far. Most can only play Minecraft. Here, you can make your own powers" .. " and reshape the world. Ready?", minecraftAlex2 = "Can you get past challenge 5 in Hack Minecraft?", minecraftAlex3 = "Nice! The more challenges you do, the more powerful you'll become.", minecraftQuestTitle = "Discover new powers", minecraftQuestComplete = "Completed challenge 5 in Hack Minecraft.", minecraftQuestHelp1 = "Talk to Alex from the Block Mines.", minecraftQuestHelp2 = "Complete challenge 5 of Hack Minecraft.", minecraftQuestHelp3 = "Talk to Alex in the Block Mines.", -- Overworld - Port Ether -- portetherSeriousGirl = "The Internet connects your computer to billions of" .. " other computers around the world!", portetherBuilder1 = "Wanna take a look inside the Sound Port? This is where" .. " the speaker gets plugged in!", portetherBuilder2 = "The Town Hall is closed as the mayor is worried about that" .. " strange rabbit. Best thing to do is level up learn more spells.", portetherBuilder3 = "You know what the best type of sound is? Surround sound! You can" .. " get that with Stereo, where sound is directed through two or more speakers.", portetherWiseGuy = "That girl is running in an infinite loop around the fountain.", portetherProfessorNet = "WiFi and Ethernet are two ways to connect to the internet." .. " WiFi sends information through the air. While Ethernet is a cable that plugs" .. " into your computer.", portetherScaredGirl = "Do you know terminal commands? Something is using the terminal" .. " to take over the town of Folderton!", portetherTourist = "My favorite waves are sound waves! All sounds are mixed together and" .. " routed through a single speaker. This is called Mono.", portetherCheekyGirl = "My dream is to travel on a pulse train.", portetherSleepingGirl = "Zzzzzz I'm not leaving here until I know that Edith, Edward" .. " and Eleanor are ok. Zzzzzz.", portetherRunningGirl = "I love running loops.", portether03houseTetra = "I'm looking for information on Memory Mines. Apparently it" .. " has 1GB RAM - that's a total of 8,589,934,592 bits of data. Crazy huh?", portether03houseCurious = "The Logic Master said the more I practice at code the more" .. " powerful I'll become.", portether03houseLazyBoy = "If binary is used to make pictures and sound, surely you" .. " can make food with it, I'm starving. What? You can't? Oh.", portether03houseNote = "You find a note. It has a scribble that says: Folderton" .. " Library > Port Ether Library", portetherLibrarian1 = "Welcome to Port Ether Library. We have an excellent data" .. " collection. How may I help you?", portetherLibrarian2 = "We have data on the legendary caves of RAM, USB, NET and more." .. " Feel free to look around!", portetherLibrarian3 = "I've heard rumors about an animal leaving notes with pawprints" .. " in Folderton. You can travel there from Ether St Station.", portetherLockedDoor = "404 - Not found", portetherDoor3 = "404 - Not found", portetherLargeDoor = "404 - Mayor Not Found", portetherSignLibrary = "Port Ether Library", -- Ether St Station ---- terminalquest1 = "Welcome to Ether St Station Terminal. Play Terminal Quest?", terminalquest2 = "Shutting down...", caroline1 = "Hello I'm Caroline, the Terminal Master. Can you please investigate what's" .. " happening in Folderton? Get to Terminal Quest through that computer! You" .. " are currently on challenge $1.", caroline2 = "Please investigate what's happening in Folderton. You can enter by sshing" .. " from that computer there.", caroline3 = "Thank you. Somehow you look more... powerful. Did you learn some spells?", etherstationPatientBoy = "There are two trains that leave from Ether St Station. The TCP goes back" .. " and forth picking up lost travelers. The UDP only travels one way though, so" .. " don't miss it!", etherstationWorriedBoy = "You can send packets on the UDP train. I'm sending one to my" .. " friend Eleanor. I hope she gets it...", -- Audio Jack Area --- makeMusicTerminal1 = "Code a song with Sonic Pi?", audioJack = "Yo, welcome to the Sound Port. What do you want to talk about?", audioJack2 = "The Mayor is old school. I" .. " say we rename this town to Port of Sound and party all day long!", audioJack3 = "Your ears hear by detecting vibrations from sound waves.", discoRunner = "I can feel the speaker vibrating. What do you want to know?", discoRunner2 = "The speaker turns energy into vibrations. These are sound waves," .. " like the pattern on the wall. I hope that helps.", discoGirl = "Wooo! I love how the speed of the vibration affects how high or low a note is.", discoSlo = "When computers generate audio from scratch they mostly use combinations " .. "of four different sound waves.", discoSloSine = "The sine wave makes a smooth humming noise and is made of a rounded " .. "wave that looks like a spring that has been stretched out. It sounds like blowing " .. "air across an empty bottle.", discoSloTriangle = "The triangle wave looks like a mountain range with sharp peaks and" .. " straight slopes. It has a deeper bass sound compared to the sine wave.", discoSloSquare = "The square wave can be too harsh if you listen to it unfiltered, " .. "sounding like an angry loud beep.", discoSloNoise = "The noise wave is made from completely random noise, it sounds like " .. "TV static and looks like a sharp pointy wall. If you play it just a very sort amount" .. " of time it sounds like percussion instruments like drums and cymbals.", --- Audio Quest --- audioQuestTitle = "Investigate audio", audioQuestComplete = "Learned about the speaker, sound waves and music.", audioQuestHelp = "Find Jack in Port Ether.", audioQuestHelp2 = "Speak to the disco dancers.", audioQuestHelp3 = "Launch Sonic Pi and write a song.", audioQuestHelp4 = "Hear what Jack has to say.", audioQuest = "You're chasing a rabbit? Well, one just" .. " deleted our song collection! Can you code us a song?", audioQuest2 = "To make the best song you need to know more about sound. Speak to some" .. " of the dancers.", audioQuest3 = "Now, open Sonic Pi from the computer next to me. You can use it" .. " to write songs with code.", audioQuest4 = "Awesome! Thanks for your help. Keep exploring the world and" .. " I'm sure you'll catch that cheeky rabbit.", --- Cafe --- portetherCafeHost = "Hey there, welcome to .Coffee, a hangout for coders.", portetherCafeText = "Text is better than Blocks for coding. It allows me to edit numbers" .. " much faster.", portetherCafeBlocks = "Blocks is better than text for coding. It's so much faster as I" .. " don't have to spend much time typing.", portetherCafeBoy = "I wonder if Coffee Script is going to replace Javascript...", portetherCafeGirl = "I think that Python is the best programming language. Wanna hear" .. " more about Python?", portetherCafeGirl2 = "Python is a programming language. It is very popular!" .. " Try out Make Snake to see some Python in action.", portetherCafeGirl3 = "Oh ok, that's a shame.", -- Town Hall -- portetherDancer = "Did you see a rabbit bouncing around?", portetherDancer2 = "I hear something is deleting files around here. What do you think?", portetherDemonBoy = "There was a time when the Mayor used to hold parties up here. Not anymore...", portetherReceptionist = "Hey there, welcome to Port Ether Town Hall. The Mayor's office is" .. " just past me.", -- Default Mayor Dialogue --- portetherMayorDiag = "Welcome. I'm the Mayor of Port Ether. Here we specialise in" .. " Ethernet and Audio ports. They bring the internet in, and send sounds out.", portetherMayorDiag2 = "I see you have visited Folderton. Come back to me if you uncover" .. " anything interesting that's happening there. There have been strange rumours in" .. " the news.", portetherMayorDiag3 = "Thanks for your help. Do let me know if there's anything else you" .. " find out about Folderton.", portetherMayorDiag4 = "Thanks for your help. It looks like you are training to become" .. " a powerful Kano Master.", --- Terminal Quest Chapter 1 --- terminalQuestTitle = "Uncover Folderton mystery", terminalQuestComplete = "Uncovered mysterious disappearances of people in Folderton." .. " Learned the spells LS, CAT and CD.", terminalQuestHelp1 = "Talk to Caroline in Ether St Station.", terminalQuestHelp2 = "Complete challenge 8 in Terminal Quest.", terminalQuestHelp3 = "Talk to Caroline in Ether St Station.", carolineTerminalQuest1 = "Hello! Have you heard what's going on in Folderton? Please use" .. " the computer next to me to travel there.", carolineTerminalQuest2 = "Please visit Folderton, and make sure you learn some useful spells.", carolineTerminalQuest3 = "Wow, a bunch of people from Folderton have disappeared? That's" .. " crazy! Maybe you should tell the Mayor in Port Ether?", --- Mayor of Port Ether's Concern Quest ---- portetherMayorQuestTitle = "Data corruption", portetherMayorQuestComplete = "Discovered two houses that had data corruption. Found" .. " notes that had the commands MV and RM.", portetherMayor = "Like Folderton, there seem to be some strange things happening around" .. " here. Can you investigate what's going on?", portetherMayor1 = "A strange rabbit was seen coming out of a house near the Audio Jack" .. " building.", portetherQuest1a = "You see part of the house has disappeared. Almost as if it's been" .. " moved. And a note with the letters MV ~/.", portetherQuest1b = "What? Part of it was moved? Does that pesky rabbit know magical" .. " commands? I've also heard rumours in Vector Village, can you take a look?", portetherMayor2 = "I think I saw that rabbit head to Vector Village.", portetherQuest1c = "You see a section of the world has been removed. And a note with" .. " the letters RM.", portetherQuest1d = "Deleted? RM? This is bad. That rabbit must be using Terminal" .. " Commands to alter things. Speak to the tribe in Python Jungle, they are wise" .. " in the ways of Terminal. But be careful.", portetherHelp = "Find the Mayor of Port Ether.", portetherHelp1a = "Look for a house with data loss in Port Ether.", portetherHelp1b = "Go back to the Mayor in Port Ether Town Hall.", portetherHelp1c = "Investigate houses in Vector Village.", portetherHelp1d = "Go back to the Mayor in Port Ether Town Hall.", -- Codex Elements -- cBinaryTitle = "Binary", cBinary = "A numbering system with only two possible values for each digit: 0 and 1.", cHexTitle = "Hexadecimal", cHex = "A numbering system of base 16.", cBitTitle = "Bit", cBit = "The smallest unit of data in a computer. It has a single binary value, a 0 or 1.", cKilobyteTitle = "KiloByte", cKilobyte = "A unit of data that is 8,192 bits.", cPowerTitle = "Power", cPower = "Power is the rate at which energy is converted to another form, such" .. " as motion, heat, or electrical. It is measured in Watts.", cEnergyTitle = "Energy", cEnergy = "The ability to do work. It comes in many different forms. eg: electrical," .. " heat, light.", cLEDTitle = "LED", cLED = "An electronic device that emits a light when a voltage is applied.", cVoltageTitle = "Voltage", cVoltage = "Voltage, also called electromotive force, is a quantitative expression of" .. " the potential difference in charge between two points in an electrical field.", cCurrentTitle = "Current", cCurrent = "An electric current is a flow of electric charge. In electric circuits" .. " this charge is often carried by moving electrons in a wire.", cPixelsTitle = "Pixels", cPixels = "The basic unit of color on a computer display. The colors are made up of" .. " different values of red, green and blue.", cHDMITitle = "HDMI", cHDMI = "A standard for connecting high-definition video devices. eg: computer monitor, television.", cResolutionTitle = "Resolution", cResolution = "The number of pixels on the horizontal and vertical axis that can be" .. " displayed on a screen.", cSpeakerTitle = "Speaker", cSpeaker = "A device connected to a computer that outputs sound waves.", cSoundWaveTitle = "Sound Wave", cSoundWave = "A sound wave is produced by a vibration, eg: an electromagnetic field" .. " stimulated by voltage.", cStereoTitle = "Stereo", cStereo = "Sound that is directed through two or more speakers. This gives a more natural" .. " effect as it sounds as though it's coming from more than one direction.", cMonoTitle = "Mono", cMono = "All sounds are mixed together and routed through a single speaker.", cFrequencyTitle = "Frequency", cFrequency = "A measure of the number of waves that pass a fixed point in a given" .. " amount of time.", cVectorTitle = "Vector", cVector = "The use of polygons to represent images in computer graphics.", cTerminalTitle = "Terminal", cTerminal = "An interface for typing commands directly to a computer.", cCodeTitle = "Code", cCode = "The low-level software that supports the computer to schedule the" .. " instructions and control peripherals.", cSDCardTitle = "SD Card", cSDCard = "A flash memory card that can store lots of data in a small size. It is" .. " popularly used in digital cameras, mobile phones and the Kano Computer Kit.", cOSTitle = "OS (Operating System)", cOS = "The low-level software that supports the computer to carry out instructions" .. " and control other devices.", cIfStatementTitle = "If Statement", cIfStatement = "Tells the computer to run a block of code if a certain condition is met.", cCoordinatesTitle = "Coordinates", cCoordinates = "A 3D grid has an x-axis, a y-axis and a z-axis. A point in 3D space" .. " uses 3 numbers from each axis to identify its position. These numbers are the" .. " point's coordinates.", cLogicGateTitle = "Logic Gate", cLogicGate = "A logic gate is an elementary building block of a digital circuit. Most" .. " logic gates have two inputs and one output. At any given moment, every terminal" .. " is in one of the two binary conditions low (0) or high (1), represented by" .. " different voltage levels.", cInputTitle = "Input", cInput = "Information or data that is sent to a computer for processing from a device." .. " Eg: user pressing a key on a keyboard.", cOutputTitle = "Output", cOutput = "Information that has been processed and sent out from a computer." .. " Eg: viewing something on your screen.", cPythonTitle = "Python", cPython = "Python is a high-level programming language. It is easy to learn due to" .. " its simple syntax and very readable due to its white space.", cCoffeeScriptTitle = "CoffeeScript", cCoffeeScript = "CoffeeScript is a language that compiles into JavaScript. It was" .. " designed to use the good parts of JavaScript in a simple way so that is is" .. " easier to use.", -- Dev -- devAlej = "I am the Chief Software Architect, a veteran here. This is the core team who" .. " built Kano OS.", devAlexB = "I'm the Principal Software Engineer that knows how to get the best performance on" .. " the Raspberry Pi.", devEmily = "I'm Kano's database that is obsessed with making characters. I also ship many things.", devJames = "So many pixels... so sleepy...", devTom = "I'm a mathmatician turned programmer with a passion for python and a craving" .. " for C. Oh my!", devRadu = "The world you are in is held together by code I wrote. You can imagine the" .. " code as a city with tall and small buildings, each having its own responsibility," .. " and being connected to others. For example, one of these buildings is drawing" .. " this dialogue box and my words within it. And this word too.. and this one, and" .. " that one.. and all future words in here..", devMegan = "I'm a mountain climber and photographer who assures that" .. " the software we ship is of high quality. I also know what is Mog.", devAlbert = "Hola! I'm a big fan of Linux, embedded computing, and arranging bits in" .. " the correct order.", -- Termsition -- Terminal termsitionTerminal1 = "You made it! Here, binary gets turned into pixels. Then" .. " we can create a character, with a pixel form.", termsitionSign1 = "01010111 01100101 01101100 01100011 01101111 01101101" .. " 01100101 00100001", termsitionSign2 = "Welcome!", }
-- math functions function ceil_log2(x) local n = 0 while x > 1 do x = x >> 1 n = n + 1 end return n end -- overflow-safe L2 distance -- from FReDs72 function l2_dist(dx, dy) dx = abs(dx) dy = abs(dy) local d = max(dx, dy) local n = min(dx, dy) / d return d * sqrt(n ^ 2 + 1) end
-- **Big thing that contains all sorts of fun stuff related to ms based scoring and adapting existing systems to it** -- probably need to reorganize large parts of this -- global here ms = {} -- *Values and stuff* -- Make the distinction between ms timed and non-timed judgments -- Radar values people on earth actually care about ms.RelevantRadarsShort = { "Notes:", "Jumps:", "Hands:", "Holds:", "Mines:", "TotalTaps:", "Rolls:", "Lifts:", "Fakes:" } ms.RelevantRadars = { "RadarCategory_Notes", "RadarCategory_Jumps", "RadarCategory_Hands", "RadarCategory_Holds", "RadarCategory_Mines", "RadarCategory_TapsAndHolds", "RadarCategory_Rolls", "RadarCategory_Lifts", "RadarCategory_Fakes" } -- lists just for displayed judgment counts ms.JudgeCount = { "TapNoteScore_W1", "TapNoteScore_W2", "TapNoteScore_W3", "TapNoteScore_W4", "TapNoteScore_W5", "TapNoteScore_Miss", "HoldNoteScore_Held", "HoldNoteScore_LetGo" } ms.JudgeCountInverse = { TapNoteScore_W1 = 1, TapNoteScore_W2 = 2, TapNoteScore_W3 = 3, TapNoteScore_W4 = 4, TapNoteScore_W5 = 5, TapNoteScore_Miss = 6, HoldNoteScore_Held = 7, HoldNoteScore_LetGo = 8 } ms.SkillSets = { "Overall", "Stream", "Jumpstream", "Handstream", "Stamina", "JackSpeed", "Chordjack", "Technical" } ms.SkillSetsShort = { "Overall", "Stream", "JS", "HS", "Stam", "Jack Speed", "Chordjack", "Tech" } ms.JudgeScalers = {1.50, 1.33, 1.16, 1.00, 0.84, 0.66, 0.50, 0.33, 0.20} -- **Functions** function ms.ok(m) if not m then SCREENMAN:SystemMessage("nahbro") else SCREENMAN:SystemMessage(m) end end --[[ Print a thing to the error console (F3+F6+8 to enable, F3+F6+9 to make it persist) str: anything that can be used with tostring() ]] function ms.p(str) MESSAGEMAN:Broadcast("ScriptError", {message = tostring(str)}) end function ms.type(m) SCREENMAN:SystemMessage(type(m)) end --- Table sum designed for ms tables (optional starting position, default to 0, and absolute value flag) function ms.tableSum(t, n, abs) local o = 0 for i = n or 0, #t do if abs then o = o + math.abs(t[i]) else o = o + t[i] end end return o end function wifeMean(t) local c = #t local m = 0 if c == 0 then return 0 end local o = 0 for i = 1, c do if t[i] ~= 1000 then o = o + t[i] else m = m + 1 end end return o / (c - m) end function wifeAbsMean(t) local c = #t local m = 0 if c == 0 then return 0 end local o = 0 for i = 1, c do if t[i] ~= 1000 then o = o + math.abs(t[i]) else m = m + 1 end end return o / (c - m) end function wifeSd(t) local u = wifeMean(t) local u2 = 0 local m = 0 for i = 1, #t do if t[i] ~= 1000 then u2 = u2 + (t[i] - u) ^ 2 else m = m + 1 end end return math.sqrt(u2 / (#t - 1 - m)) end function wifeRange(t) local x, y = 10000, 0 for i = 1, #t do if t[i] ~= 1000 then if math.abs(t[i]) < math.abs(x) then x = t[i] end if math.abs(t[i]) > math.abs(y) then y = t[i] end end end return x, y end function IndexOf(t, x) for k, v in pairs(t) do if v == x then return k end end return nil end -- **Very slight efficiency rewrites** notShit = {} function notShit.floor(x, y) y = 10 ^ (y or 0) return math.floor(x * y) / y end function notShit.ceil(x, y) y = 10 ^ (y or 0) return math.ceil(x * y) / y end -- seriously what is math and how does it work function notShit.round(x, y) y = 10 ^ (y or 0) return math.floor(x * y + 0.5) / y end -- Grabs the currently selected rate as a string in the form of "r.rrx" while dropping trailing 0s function getCurRateString() return string.format("%.2f", getCurRateValue()):gsub("%.?0+$", "") .. "x" end function getCurRateDisplayString() return getRateDisplayString(getCurRateString()) end function getRateDisplayString(x) if x == "1x" then x = "1.0x" elseif x == "2x" then x = "2.0x" end return x .. "Music" end function getCurRateValue() return notShit.round(GAMESTATE:GetSongOptionsObject("ModsLevel_Current"):MusicRate(), 3) end function getCurKey() return GAMESTATE:GetCurrentSteps(PLAYER_1):GetChartKey() end -- returns a string of keys for a table function showKeys(t) local o = {} for k, v in pairs(t) do o[#o + 1] = k end return table.concat(o, ",") -- apparently theres an alias for this in this game who knew end -- same but returns a table (array) function tableKeys(t) local o = {} for k, v in pairs(t) do o[#o + 1] = k end return o end function formLink(x, y) x[y] = x[y] or {} return x[y] end function GetPlayableTime() local td = GAMESTATE:GetCurrentSteps(PLAYER_1):GetTimingData() local song = GAMESTATE:GetCurrentSong() return (td:GetElapsedTimeFromBeat(song:GetLastBeat()) - td:GetElapsedTimeFromBeat(song:GetFirstBeat())) / getCurRateValue() end function ChangeMusicRate(rate, params) if params.Name == "PrevScore" and rate < 2.95 and (getTabIndex() == 0 or getTabIndex() == 1) then GAMESTATE:GetSongOptionsObject("ModsLevel_Preferred"):MusicRate(rate + 0.1) GAMESTATE:GetSongOptionsObject("ModsLevel_Song"):MusicRate(rate + 0.1) GAMESTATE:GetSongOptionsObject("ModsLevel_Current"):MusicRate(rate + 0.1) MESSAGEMAN:Broadcast("CurrentRateChanged") elseif params.Name == "NextScore" and rate > 0.55 and (getTabIndex() == 0 or getTabIndex() == 1) then GAMESTATE:GetSongOptionsObject("ModsLevel_Preferred"):MusicRate(rate - 0.1) GAMESTATE:GetSongOptionsObject("ModsLevel_Song"):MusicRate(rate - 0.1) GAMESTATE:GetSongOptionsObject("ModsLevel_Current"):MusicRate(rate - 0.1) MESSAGEMAN:Broadcast("CurrentRateChanged") end if params.Name == "PrevRate" and rate < 3 and (getTabIndex() == 0 or getTabIndex() == 1) then GAMESTATE:GetSongOptionsObject("ModsLevel_Preferred"):MusicRate(rate + 0.05) GAMESTATE:GetSongOptionsObject("ModsLevel_Song"):MusicRate(rate + 0.05) GAMESTATE:GetSongOptionsObject("ModsLevel_Current"):MusicRate(rate + 0.05) MESSAGEMAN:Broadcast("CurrentRateChanged") elseif params.Name == "NextRate" and rate > 0.5 and (getTabIndex() == 0 or getTabIndex() == 1) then GAMESTATE:GetSongOptionsObject("ModsLevel_Preferred"):MusicRate(rate - 0.05) GAMESTATE:GetSongOptionsObject("ModsLevel_Song"):MusicRate(rate - 0.05) GAMESTATE:GetSongOptionsObject("ModsLevel_Current"):MusicRate(rate - 0.05) MESSAGEMAN:Broadcast("CurrentRateChanged") end end
--自己实现的功用函数 local skynet = require "skynet" local log = require "log" local comfun = {} --number取整 function comfun.get_int_part(x) if x < 0 then return math.ceil(x) end if math.ceil(x) == x then x = math.ceil(x) else x = math.ceil(x) - 1 end return x end --外部请求处理 function comfun.sock_handle(CMD, srv_name, cmd, fd, ...) local f = CMD[cmd] if f then local ret, msg_rsp_name, msg_rsp = f(fd, ...) skynet.send("watchdog", "lua", "socket", "send", fd, ret, msg_rsp_name, msg_rsp) else log.log("server_%s invalid_sock_cmd %s", srv_name, cmd) end end --内部请求处理 function comfun.inner_handle(CMD, srv_name, cmd, ...) local f = CMD[cmd] if f then --内部接口调用全部返回 skynet.ret(skynet.pack(f(...))) else log.log("service_%s invalid_inner_cmd %s", srv_name, cmd) end end --消息处理 function comfun.dispatch(CMD, srv_name, cmd, subcom, ...) if cmd == "socket" then comfun.sock_handle(CMD, srv_name, subcom, ...) else comfun.inner_handle(CMD, srv_name, cmd, subcom, ...) end end --公用启动函数 function comfun.srv_start(CMD, srv_name) skynet.start(function() skynet.dispatch("lua", function(_, _, cmd, subcom, ...) comfun.dispatch(CMD, srv_name, cmd, subcom, ...) end) if srv_name then skynet.register(srv_name) end end) end return comfun
class("ActiveWorldBossCommand", pm.SimpleCommand).execute = function (slot0, slot1) slot2 = slot1:getBody() if not getProxy(ActivityProxy):getActivityByType(ActivityConst.ACTIVITY_TYPE_WORLD_WORLDBOSS) or slot4:isEnd() then return end print("active boss : ", slot2.arg1) pg.ConnectionMgr.GetInstance():Send(11202, { activity_id = slot2.activity_id, cmd = slot2.cmd, arg1 = slot2.arg1, arg2 = slot2.arg2 }, 11203, function (slot0) if slot0.result == 0 then if slot0.cmd == 1 then slot1.data1 = 0 if slot1.data3 > 0 then slot1.data3 = slot1.data3 - 1 else slot1.data2 = slot1.data2 + 1 end print(slot1, "activity boss", slot1.data3, "data 2:", slot1.data2) end slot2:updateActivity(slot2.updateActivity) else pg.TipsMgr.GetInstance():ShowTips(ERROR_MESSAGE[slot0.result] .. slot0.result) end end) end return class("ActiveWorldBossCommand", pm.SimpleCommand)
local resty_md5 = require "resty.md5" local openssl = require "openssl" local CIPHER_ENC_ENCRYPTION = 1 local CIPHER_ENC_DECRYPTION = 0 local METHOD_INFO_KEY_LEN = 1 local METHOD_INFO_IV_LEN = 2 local METHOD_INFO_CRYPTO = 3 local method_supported = openssl.ciphers local cached_keys = {} local _M = { _VERSION = '0.10' } local mt = { __index = _M } local function random_string(length) local buffer = {} for i = 1, length do buffer[i] = math.random(0, 255) end return string.char(unpack(buffer)) end local function evp_bytestokey(password, key_len, iv_len) local cached_key = string.format("%s-%d-%d", password, key_len, iv_len) local r = cached_keys[cached_key] if r then return r[1], r[2] end local m, i = {}, 0 while #(table.concat(m)) < (key_len + iv_len) do local md5 = resty_md5:new() local data = password if i > 0 then data = m[i] .. password end md5:update(data) m[#m + 1], i = md5:final(), i + 1 end local ms = table.concat(m) local key = ms:sub(1, key_len) local iv = ms:sub(key_len + 1, iv_len) cached_keys[cached_key] = {key, iv} return key, iv end function _M.check_cipher_method(cipher_name) local method = string.lower(cipher_name) local method_info = method_supported[method] if method_info then return true else return false end end function _M:new(password, method) local o = { password = password, method = method, iv_sent = false } setmetatable(o, mt) o._method_info = self.get_method_info(method) if o._method_info then o.cipher = o:get_cipher( password, method, CIPHER_ENC_ENCRYPTION, random_string(o._method_info[METHOD_INFO_IV_LEN])) if not o.cipher then return nil end end return o end function _M.get_method_info(method) local method = string.lower(method) return method_supported[method] end function _M:get_cipher(password, method, op, iv) local key local m = self._method_info if m[METHOD_INFO_KEY_LEN] > 0 then key, _ = evp_bytestokey(password, m[METHOD_INFO_KEY_LEN], m[METHOD_INFO_IV_LEN]) else key, iv = password, '' end iv = iv:sub(1, m[METHOD_INFO_IV_LEN]) if op == CIPHER_ENC_ENCRYPTION then self.cipher_iv = iv end return m[METHOD_INFO_CRYPTO](method, key, iv, op) end function _M:encrypt(buf) if #buf == 0 then return buf end if self.iv_sent then return self.cipher:encrypt(buf) else self.iv_sent = true return self.cipher_iv .. self.cipher:encrypt(buf) end end function _M:decrypt(buf) if #buf == 0 then return buf end if self.decipher == nil then local decipher_iv_len = self._method_info[METHOD_INFO_IV_LEN] local decipher_iv = buf:sub(1, decipher_iv_len) self.decipher_iv = decipher_iv self.decipher = self:get_cipher( self.password, self.method, CIPHER_ENC_DECRYPTION, decipher_iv ) buf = buf:sub(decipher_iv_len+1) if #buf == 0 then return buf end end return self.decipher:decrypt(buf) end return _M
-- Workers (or the Executor processes they manage) could fail at any moment. In order to -- recover from this, we need to 1. discover that it has occurred, and 2. ensure that -- any pending tasks (either read from the queue and not executed or failed -- mid-execution) are processed by another worker. -- -- To achieve this we publish periodic heartbeats from every Executor. If they are -- missing for longer than `threshold` seconds, we consider them to have died. Redis -- Streams keeps track of a pending entry list (PEL) for every consumer: read, but -- unacknowledged messsages. We simply delete them and add them back to the queue. -- -- In the worst case scenario, where Executors are not in fact dead, this will lead to -- duplicate execution. local stream = KEYS[1] local beats = KEYS[2] local group = ARGV[1] local now = tonumber(ARGV[2]) local threshold = tonumber(ARGV[3]) local heartbeats = redis.call('HGETALL', beats) local count = redis.call('XINFO', 'GROUPS', stream)[1][6] local pending = redis.call('XPENDING', stream, group, '-', '+', count or 0) local consumers = redis.call('XINFO', 'CONSUMERS', stream, group) local dead_executors, dead_consumers, result = {}, {}, {} -- Find the dead executors. for i=1, #heartbeats, 2 do local executor_id, last_heartbeat = heartbeats[i], tonumber(heartbeats[i + 1]) if now - last_heartbeat > threshold then dead_executors[executor_id] = true redis.call('HDEL', beats, executor_id) end end -- Find the dead consumers. for i, v in ipairs(consumers) do local consumer_id, executor_id = v[2], string.sub(v[2], 1, 22) if dead_executors[executor_id] then dead_consumers[consumer_id] = true table.insert(result, consumer_id) end end -- Put the dead consumers' pending messages back in the stream. for _, v in ipairs(pending) do local id, consumer_id = v[1], v[2] if dead_consumers[consumer_id] then for _, msg in ipairs(redis.call('XRANGE', stream, id, id)) do redis.call('XADD', stream, '*', unpack(msg[2])) redis.call('XDEL', stream, id) end end end -- Delete the dead consumers. This will also delete the consumer's PEL. for consumer_id in pairs(dead_consumers) do redis.call('XGROUP', 'DELCONSUMER', stream, group, consumer_id) end return result
function bulletinit() bullets, actions = {}, {} end -- Function to spawn bullet, overload to spawnbullet to not include a default speed function spawnbullet(spawnx, spawny, isgoingleft, isforplayers) spawnbulletoverload(spawnx, spawny, 1, isgoingleft, isforplayers) end -- Function to play the bullet fx function bulletfx(bullet) sfx(4) if bullet.hitframes <= 0 then bullet.sprite, bullet.hitframes = 19, 1 end end function spawnbulletoverload(spawnx, spawny, speed, isgoingleft, isforplayers) local bullet = { sprite = 18, x = spawnx, y = spawny, width = 1, height = 1, box = { xleft = 1, xright = 2, yup = -1, ydown = 2 }, flipx = isgoingleft, speed = 6.5 * speed, dy = rnd(35) / 50, aliveframes = 0, hitframes = 0, isforplayer = isforplayers } -- Apply the velocity and spacing -- depending on facing direction if isgoingleft then bullet.dx = bullet.speed * -1 bullet.x -= bullet.speed else bullet.dx = bullet.speed bullet.x += bullet.speed end if bullet.isforplayer then bullet.dy = 0 elseif rnd(2) == 0 then bullet.dy = bullet.dy * -1 end add(bullets, bullet) -- Play shooting sound sfx(1) end function bulletupdate() -- Update any coroutines -- http://www.lexaloffle.com/bbs/?tid=3458 for c in all(actions) do if costatus(c) then coresume(c) else del(actions,c) end end for bullet in all(bullets) do -- Apply our motions if bullet.aliveframes > 1 then if bullet.flipx then bullet.dx -= .34 else bullet.dx += .34 end -- Apply our vectors, dependent on slow time if slowtime > 0 and bullet.isforplayer then bullet.x += (bullet.dx / 3) else bullet.x += bullet.dx end bullet.y += bullet.dy end -- Check if we should delete the bullet off the screen if bullet.x < 0 or bullet.x > 128 or bullet.y < 0 or bullet.y > 128 then del(bullets, bullet) end -- flip our sprite, if we are not in hit frames, and we have been alive a while if bullet.hitframes < 1 and bullet.aliveframes > 1 then if gametime % 2 < 1 then bullet.sprite = 2 else bullet.sprite = 3 end end -- Check for enemy collisions for enemy in all(enemies) do if not bullet.isforplayer and iscollision(bullet, enemy) and enemy.isdead <= 0 and enemy.immunity < 1 then -- Spawn ALOT of cash cashdrop(enemy.x, enemy.y, flr(getcurrentlevel() / 2) + 1, 1) -- will start death animation enemy.isdead += 1 enemiesonscreen -= 1 enemiesdefeated += 1 sfx(51) bulletfx(bullet) end end -- Check for Boss collisions for boss in all(bosses) do if not bullet.isforplayer and iscollision(bullet, boss) and boss.health > 0 and boss.immunity < 1 then -- Subtract health and reset immunity boss.health -= 1 boss.immunity = boss.maximmunitty -- Check if we killed the boss if boss.health < 1 then -- Spawn some health (2nd has a slight chance for full health) spawnhealth((boss.x / 2) + 10, 95, 1) spawnhealth((boss.x / 3) + 21, 99, flr(rnd(2)) + 1) spawnhealth((boss.x / 2) + 34, 91, 1) -- Delete the boss, and go to the next level if isfinalboss() then -- Spawn ALOT MORE of cash since it's the final boss cashdrop(boss.x, boss.y, getcurrentlevel(), 30) gamestate__finalbossend = true music(-1) boss.dy -= 8 boss.y += boss.dy else -- Spawn ALOT of cash cashdrop(boss.x, boss.y, getcurrentlevel(), 15) del(bosses, boss) delaygotonextlevel(150) end end -- Play the bullet effects sfx(51) bulletfx(bullet) end end -- Check for player collisions for player in all(players) do if bullet.isforplayer and iscollision(bullet, player) and player.currentinvincible <= 0 then -- subtract player health player.health -= 1 player.currentinvincible = player.invicibleframes -- Play the bullet effects bulletfx(bullet) end end -- Check for wall collisions if iswallleft(bullet) or iswallright(bullet) then if bullet.hitframes <= 0 then bulletfx(bullet) end end -- Check if the bullet hit, and should be deleted if bullet.hitframes > 0 then bullet.hitframes += 1 end if bullet.hitframes > 5 then del(bullets, bullet) end -- increase the frames the bullet has been alive bullet.aliveframes += 1 end end -- Coroutine to spawn cash over multiple frames function cashdrop(basex, basey, baseamount, spawnmultiplier) local c = cocreate(function() local cashtospawn = flr((getcurrentlevel() / 6) * spawnmultiplier) if cashtospawn < 1 then cashtospawn = 1 end for i = cashtospawn, 1, -1 do local cashx = flr(rnd(20)) + basex -- Make sure not to spawn on edges if cashx > 90 then cashx = cashx * -1 end if cashx < 30 then cashx = cashx + 10 end local cashy = flr(rnd(3)) + basey - 2 spawncash(cashx, cashy, flr(rnd(getcurrentlevel() * 2)) + baseamount) -- Wait 3 frames yield() yield() yield() end end) add(actions, c) end function bulletdraw() for bullet in all(bullets) do spr(bullet.sprite, bullet.x, bullet.y, 1, 1, bullet.flipx) end end
-- ======= Copyright (c) 2003-2011, Unknown Worlds Entertainment, Inc. All rights reserved. ======= -- -- lua\OrdersMixin.lua -- -- Created by: Brian Cronin (brianc@unknownworlds.com) -- -- ========= For more information, visit us at http://www.unknownworlds.com ===================== Script.Load("lua/TechTreeConstants.lua") Script.Load("lua/PhysicsGroups.lua") OrdersMixin = CreateMixin(OrdersMixin) OrdersMixin.type = "Orders" OrdersMixin.expectedCallbacks = { -- GetExtents() is required by GetGroundAt(). GetExtents = "Returns a Vector describing the extents of this Entity." } OrdersMixin.expectedConstants = { kMoveOrderCompleteDistance = "How close to the move location we must be until the order is complete." } local kTimeSinceDamageDefendComplete = 10 local kDefendCompleteDistance = 5 OrdersMixin.kMaxOrdersPerUnit = 10 OrdersMixin.kOrderDelay = 0.2 OrdersMixin.networkVars = { -- The currentOrderId is needed on the Client for displaying -- to other players such as the Commander. currentOrderId = "entityid" } local function UpdateOrderIndizes(self) for i = 1, #self.orders do local order = Shared.GetEntity(self.orders[i]) if order then order:SetIndex(i) end end end function OrdersMixin:__initmixin() self.ignoreOrders = false self.currentOrderId = Entity.invalidId -- Current orders. List of order entity ids. self.orders = { } end local function OrderChanged(self) if self:GetHasOrder() then self.currentOrderId = self.orders[1] local order = Shared.GetEntity(self.currentOrderId) if order then order:SetOrigin(self:GetOrigin()) end else self.currentOrderId = Entity.invalidId end UpdateOrderIndizes(self) if self.OnOrderChanged then self:OnOrderChanged() end end function OrdersMixin:TransferOrders(dest) table.copy(self.orders, dest.orders) OrderChanged(dest) table.clear(self.orders) OrderChanged(self) end function OrdersMixin:CopyOrdersTo(dest) for index, orderId in ipairs(self.orders) do local orderCopy = GetCopyFromOrder(Shared.GetEntity(orderId)) orderCopy:SetOwner(dest) table.insert(dest.orders, orderCopy:GetId()) end OrderChanged(dest) end function OrdersMixin:GetHasOrder() return self:GetNumOrders() > 0 end function OrdersMixin:GetNumOrders() return table.count(self.orders) end function OrdersMixin:SetIgnoreOrders(setIgnoreOrders) self.ignoreOrders = setIgnoreOrders end function OrdersMixin:GetIgnoreOrders() return self.ignoreOrders end local function SetOrder(self, order, clearExisting, insertFirst, giver) if self.ignoreOrders or order:GetType() == kTechId.Default then return false end if clearExisting then self:ClearOrders() end -- Always snap the location of the order to the ground. local location = order:GetLocation() if location then location = GetGroundAt(self, location, PhysicsMask.AIMovement) order:SetLocation(location) end order:SetOwner(self) if insertFirst then table.insert(self.orders, 1, order:GetId()) else table.insert(self.orders, order:GetId()) end self.timeLastOrder = Shared.GetTime() OrderChanged(self) return true end -- -- Children can provide a OnOverrideOrder function to issue build, construct, etc. orders on right-click. -- local function OverrideOrder(self, order) if self.OnOverrideOrder then self:OnOverrideOrder(order) elseif order:GetType() == kTechId.Default then order:SetType(kTechId.Move) end end local function OrderTargetInvalid(self, targetId) local invalid = false if targetId and targetId ~= Entity.invalidId then local target = Shared.GetEntity(targetId) invalid = not target or (target:isa("PowerPoint") and target:GetPowerState() == PowerPoint.kPowerState.unsocketed) or target:isa("ResourcePoint") or target:isa("TechPoint") end return invalid end function OrdersMixin:GiveOrder(orderType, targetId, targetOrigin, orientation, clearExisting, insertFirst, giver) ASSERT(type(orderType) == "number") if self.ignoreOrders or OrderTargetInvalid(self, targetId) or ( #self.orders > OrdersMixin.kMaxOrdersPerUnit or (self.timeLastOrder and self.timeLastOrder + OrdersMixin.kOrderDelay > Shared.GetTime()) ) then return kTechId.None end -- prevent AI units from attack friendly players if orderType == kTechId.Attack then local target = Shared.GetEntity(targetId) if target and target:isa("Player") and not GetAreEnemies(target, self) and not GetGamerules():GetFriendlyFire() then return end end if clearExisting == nil then clearExisting = true end if insertFirst == nil then insertFirst = true end local order = nil order = CreateOrder(orderType, targetId, targetOrigin, orientation) order:SetOrigin(self:GetOrigin()) OverrideOrder(self, order) local success = SetOrder(self, order, clearExisting, insertFirst, giver) if success and self.OnOrderGiven then self:OnOrderGiven(order) end return ConditionalValue(success, order:GetType(), kTechId.None) end local function DestroyOrders(self) -- Allow ents to hook destruction of current order. local first = true -- Delete all order entities. for index, orderEntId in ipairs(self.orders) do local orderEnt = Shared.GetEntity(orderEntId) ASSERT(orderEnt ~= nil) if first then if self.OnDestroyCurrentOrder and orderEnt ~= nil then self:OnDestroyCurrentOrder(orderEnt) end first = false end if orderEnt then if orderEnt:isa("SharedOrder") then orderEnt:Unregister(self) else DestroyEntity(orderEnt) end end end table.clear(self.orders) end function OrdersMixin:ClearOrders() if table.count(self.orders) > 0 then DestroyOrders(self) OrderChanged(self) end end function OrdersMixin:Reset() self:ClearOrders() end function OrdersMixin:OnKill() self:ClearOrders() end function OrdersMixin:GetHasSpecifiedOrder(orderEnt) ASSERT(orderEnt ~= nil and orderEnt.GetId ~= nil) for index, orderEntId in ipairs(self.orders) do if orderEntId == orderEnt:GetId() then return true end end return false end function OrdersMixin:GetCurrentOrder() if self.currentOrderId ~= Entity.invalidId then return Shared.GetEntity(self.currentOrderId) end return nil end function OrdersMixin:GetLastOrder() return Shared.GetEntity(self.orders[#self.orders]) end function OrdersMixin:ClearCurrentOrder() --Print("%s:ClearCurrentOrder", self:GetClassName()) local currentOrder = self:GetCurrentOrder() if currentOrder then if currentOrder:isa("SharedOrder") then currentOrder:Unregister(self) else DestroyEntity(currentOrder) end table.remove(self.orders, 1) end OrderChanged(self) end function OrdersMixin:CompletedCurrentOrder() --Print("%s:CompletedCurrentOrder", self:GetClassName()) local currentOrder = self:GetCurrentOrder() if currentOrder then if self.OnOrderComplete then self:OnOrderComplete(currentOrder) end self:ClearCurrentOrder() end end -- Convert rally orders to move and we're done. function OrdersMixin:ProcessRallyOrder(originatingEntity) if self.ignoreOrders then return end originatingEntity:CopyOrdersTo(self) for index, orderId in ipairs(self.orders) do local order = Shared.GetEntity(orderId) ASSERT(order ~= nil) if order:GetType() == kTechId.SetRally then order:SetType(kTechId.Move) end end end if Server then local function TriggerOrderCompletedAlert(self) if HasMixin(self, "Team") then local teamType = self:GetTeam():GetTeamType() if teamType == kMarineTeamType then self:GetTeam():TriggerAlert(kTechId.MarineAlertOrderComplete, self) else self:GetTeam():TriggerAlert(kTechId.AlienAlertOrderComplete, self) end end end local function SharedUpdate(self) local currentOrder = self:GetCurrentOrder() if currentOrder ~= nil then local orderType = currentOrder:GetType() if orderType == kTechId.Move then if (currentOrder:GetLocation() - self:GetOrigin()):GetLength() < self:GetMixinConstants().kMoveOrderCompleteDistance then TriggerOrderCompletedAlert(self) self:CompletedCurrentOrder() end elseif orderType == kTechId.Patrol then if (currentOrder:GetLocation() - self:GetOrigin()):GetLength() < self:GetMixinConstants().kMoveOrderCompleteDistance then local prevTarget = currentOrder:GetLocation() local prevOrigin = currentOrder:GetOrigin() currentOrder:SetLocation(prevOrigin) currentOrder:SetOrigin(prevTarget) end elseif orderType == kTechId.Construct or orderType == kTechId.AutoConstruct then local orderTarget = Shared.GetEntity(currentOrder:GetParam()) if orderTarget == nil or (not orderTarget:GetIsAlive() and not orderTarget:isa("PowerPoint")) or orderTarget.GetIsBuilt == nil then self:ClearOrders() elseif orderTarget:GetIsBuilt() or ( orderTarget:isa("PowerPoint") and not orderTarget:GetCanConstruct( self ) ) then self:CompletedCurrentOrder() TriggerOrderCompletedAlert(self) end elseif orderType == kTechId.Weld or orderType == kTechId.Heal or orderType == kTechId.AutoWeld or orderType == kTechId.AutoHeal then local orderTarget = Shared.GetEntity(currentOrder:GetParam()) if orderTarget then currentOrder:SetLocation(orderTarget:GetOrigin()) end -- clear weld targets which are too far away for players local tooFarAway = (orderType == kTechId.AutoWeld or orderType == kTechId.AutoHeal) and orderTarget and self:isa("Player") and (orderTarget:GetOrigin() - self:GetOrigin()):GetLength() > 20 if orderTarget == nil or (not orderTarget:isa("PowerPoint") and not orderTarget:GetIsAlive()) or tooFarAway then self:ClearOrders() elseif orderTarget:GetHealthScalar() >= 1 or (orderTarget:isa("Marine") and orderTarget:GetArmor() / orderTarget:GetMaxArmor() >= 1) then self:CompletedCurrentOrder() TriggerOrderCompletedAlert(self) end elseif orderType == kTechId.Attack then local orderTarget = Shared.GetEntity(currentOrder:GetParam()) if orderTarget and (HasMixin(orderTarget, "LOS") and orderTarget:GetIsSighted()) then currentOrder:SetLocation(orderTarget:GetOrigin()) end if not orderTarget or orderTarget:GetId() == Entity.invalidId then -- AI units needs to be able to attack locations if not currentOrder.allowLocationAttack or not currentOrder:GetLocation() then self:ClearOrders() end -- If given an order to a Live entity, clear the order when that entity is dead. -- Do not clear the order for non-live entities as there are cases we need to -- attack non-live entities. elseif HasMixin(orderTarget, "Live") and not orderTarget:GetIsAlive() then TriggerOrderCompletedAlert(self) self:CompletedCurrentOrder() end elseif orderType == kTechId.Defend then local orderTarget = Shared.GetEntity(currentOrder:GetParam()) local orderTargetIsLive = orderTarget ~= nil and HasMixin(orderTarget, "Live") -- If the orderTarget hasn't taken damage yet, GetTimeOfLastDamage() will return nil. -- In this case, just use the time the order was issued to decide when to destroy it below. local lastDamageTime = (orderTargetIsLive and orderTarget:GetTimeOfLastDamage()) or 0 if lastDamageTime < currentOrder:GetOrderTime() then lastDamageTime = currentOrder:GetOrderTime() end if not orderTarget or orderTarget:GetId() == Entity.invalidId or not orderTargetIsLive or not orderTarget:GetIsAlive() then self:ClearOrders() elseif orderTargetIsLive and (Shared.GetTime() - lastDamageTime) > kTimeSinceDamageDefendComplete then -- Only complete if self is close enough to the target. if (self:GetOrigin() - orderTarget:GetOrigin()):GetLengthSquared() < (kDefendCompleteDistance * kDefendCompleteDistance) then TriggerOrderCompletedAlert(self) self:CompletedCurrentOrder() else self:ClearOrders() end end end end end function OrdersMixin:OnUpdate(deltaTime) PROFILE("OrdersMixin:OnUpdate") SharedUpdate(self) end function OrdersMixin:OnProcessMove(input) PROFILE("OrdersMixin:OnProcessMove") SharedUpdate(self) end end -- Note: This needs to be tested. -- Get target of attack order, if any. function OrdersMixin:GetTarget() local target = nil local order = self:GetCurrentOrder() if order ~= nil and (order:GetType() == kTechId.Attack or order:GetType() == kTechId.SetTarget) then target = Shared.GetEntity(order:GetParam()) end return target end -- Note: This needs to be tested. function OrdersMixin:PerformAction(techNode, position) self:OnPerformAction(techNode, position) end -- -- Other mixins can implement this function to handle more specific actions. -- Called when tech tree action is performed on the entity. -- Return true if legal and action handled. Position passed if applicable. -- function OrdersMixin:OnPerformAction(techNode, position) if not self.ignoreOrders and techNode:GetTechId() == kTechId.Stop then self:ClearOrders() end end function OrdersMixin:CopyPlayerDataFrom(player) if HasMixin(player, "Orders") then player:TransferOrders(self) end end if Client then function ResetOrders(self) if self.lastClientOrderUpdate ~= Shared.GetTime() then self.ordersClient = {} self.lastClientOrderUpdate = Shared.GetTime() end end function OrdersMixin:AddClientOrder(order) ResetOrders(self) self.ordersClient[order:GetIndex()] = order end local gLastOrdersUpdate = nil local function UpdateOrdersClient() -- update all orders for all entities once per frame if gLastOrdersUpdate ~= Shared.GetTime() then for _, order in ientitylist(Shared.GetEntitiesWithClassname("Order")) do if not order:GetIsDestroyed() then local orderOwner = order:GetOwner() if orderOwner and orderOwner.AddClientOrder then orderOwner:AddClientOrder(order) end end end gLastOrdersUpdate = Shared.GetTime() end end function OrdersMixin:GetOrdersClient() ResetOrders(self) UpdateOrdersClient() local orders = {} for i, order in pairs(self.ordersClient) do table.insert(orders, order) end return orders end end
local skynet = require "skynet" local bewater = require "bw.bewater" local log = require "bw.log" local rank_cls = require "sys.rank.rank" local trace = log.trace("rank.server") local ranks = {} local CMD = {} function CMD.update(rank_name, k, v) local rank = ranks[rank_name] rank:update(k, v) return bewater.NORET end local server = {} function server.start(handler, start_func) handler = handler or {} skynet.start(function() trace("start") skynet.dispatch("lua", function(_, _, cmd, ...) local func = assert(handler[cmd] or CMD[cmd], cmd) bewater.ret(func(...)) end) if start_func then return start_func() end end) end function server.load_rank(rank_name, rank_type, max_count, asc) assert(not ranks[rank_name], rank_name) local rank = rank_cls.new(rank_name, rank_type, max_count, asc) ranks[rank_name] = rank end function server.get_rank(rank_name) return ranks[rank_name] end function server.update(...) CMD.update(...) end return server
local _, ns = ... local B, C, L, DB, P = unpack(ns) local BUTTON = "OverrideActionBarButton%d" ----------------------- -- Rare: Escaped Wilderling ----------------------- local RARE = "Escaped Wilderling" local MESSAGE = "Spam <SpaceBar> to complete!" local locale = GetLocale() if locale == "zhCN" or locale == "zhTW" then RARE = "逃跑的荒蚺" MESSAGE = "狂按 <空格> 完成!" end local Handler = CreateFrame("Frame") Handler:RegisterEvent("ZONE_CHANGED_NEW_AREA") Handler:RegisterEvent("PLAYER_ENTERING_WORLD") Handler:SetScript("OnEvent", function(self, event, ...) if not NDuiPlusDB["Misc"]["QuestHelper"] then return end if event == "ZONE_CHANGED_NEW_AREA" or event == "PLAYER_ENTERING_WORLD" then local mapID = C_Map.GetBestMapForUnit("player") if mapID and mapID == 1961 then self:Watch() else self:Unwatch() end elseif event == "UNIT_ENTERED_VEHICLE" then if GetPlayerAuraBySpellID(356137) then self:Control() else self:Uncontrol() end elseif event == "UNIT_EXITED_VEHICLE" then self:Uncontrol() elseif event == "CHAT_MSG_RAID_BOSS_EMOTE" then local msg = ... if strfind(msg, RARE) then ClearOverrideBindings(self) SetOverrideBindingClick(self, true, "SPACE", BUTTON:format(1)) end elseif event == "UNIT_SPELLCAST_SUCCEEDED" then local _, _, spellID = ... if spellID == 356151 then ClearOverrideBindings(self) SetOverrideBindingClick(self, true, "SPACE", BUTTON:format(12)) end elseif event == "PLAYER_REGEN_ENABLED" then ClearOverrideBindings(self) self:UnregisterEvent(event) end end) function Handler:Watch() self:RegisterEvent("UNIT_ENTERED_VEHICLE") end function Handler:Unwatch() self:UnregisterEvent("UNIT_ENTERED_VEHICLE") end function Handler:Control() self:Message() self:RegisterEvent("UNIT_EXITED_VEHICLE") self:RegisterEvent("CHAT_MSG_RAID_BOSS_EMOTE") self:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player") end function Handler:Uncontrol() self:UnregisterEvent("UNIT_EXITED_VEHICLE") self:UnregisterEvent("CHAT_MSG_RAID_BOSS_EMOTE") self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED") if InCombatLockdown() then self:RegisterEvent("PLAYER_REGEN_ENABLED") else ClearOverrideBindings(self) end end function Handler:Message() for i = 1, 2 do RaidNotice_AddMessage(RaidWarningFrame, MESSAGE, P.InfoColors) end end
function param1(str) chainhelper:log("param1 test. str:"..str) end function param2(str, flag) if (flag) then chainhelper:log("param2 test. flag true. str:"..str) else chainhelper:log("param2 test. flag false. str:"..str) end end function param3(in_str, in_bool, in_num) chainhelper:log("test param3, in_str: " .. tostring(in_str) .. ", type: " .. type(in_str)) chainhelper:log("test param3, in_bool: " .. tostring(in_bool) .. ", type: " .. type(in_bool)) chainhelper:log("test param3, in_num: " .. tostring(in_num) .. ", type: " .. type(in_num)) end function test_luatype_function(func) chainhelper:log("test luatype_function, func: " .. tostring(func) .. ", type: " .. type(func)) end function test_luatype(obj) chainhelper:log("test luatype, object: " .. tostring(obj) .. ", type: " .. type(obj)) end
UpdateTeamCommand = Command:extends{} UpdateTeamCommand.className = "UpdateTeamCommand" function UpdateTeamCommand:init(team) self.team = team end function UpdateTeamCommand:execute() if not self.old then self.old = SB.model.teamManager:getTeam(self.team.id) end SB.model.teamManager:setTeam(self.team.id, self.team) end function UpdateTeamCommand:unexecute() SB.model.teamManager:setTeam(self.team.id, self.old) end
local Packages = script.Parent.Parent.Parent.Parent.Parent.Parent local Roact = require(Packages.Roact) local LoadingSpinner = require(Packages.UIBlox.App.Loading.LoadingSpinner) return { stories = { DefaultRate = Roact.createElement(LoadingSpinner, { position = UDim2.fromScale(0.5, 0.5), anchorPoint = Vector2.new(0.5, 0.5), }), HalfRate = Roact.createElement(LoadingSpinner, { position = UDim2.fromScale(0.5, 0.5), anchorPoint = Vector2.new(0.5, 0.5), rotationRate = 180, }) } }
file.CreateDir('ppm2') file.CreateDir('ppm2/backups') file.CreateDir('ppm2/thumbnails') for _, ffind in ipairs(file.Find('ppm2/*.txt', 'DATA')) do local fTarget = ffind:sub(1, -5) if not file.Exists('ppm2/' .. fTarget .. '.dat', 'DATA') then local fRead = file.Read('ppm2/' .. ffind, 'DATA') local json = util.JSONToTable(fRead) if json then local TagCompound = DLib.NBT.TagCompound() for key, value in pairs(json) do local _exp_0 = luatype(value) if 'string' == _exp_0 then TagCompound:AddString(key, value) elseif 'number' == _exp_0 then TagCompound:AddFloat(key, value) elseif 'boolean' == _exp_0 then TagCompound:AddByte(key, value and 1 or 0) elseif 'table' == _exp_0 then if value.r and value.g and value.b and value.a then TagCompound:AddByteArray(key, { value.r - 128, value.g - 128, value.b - 128, value.a - 128 }) end else error(luatype(value)) end end local buf = DLib.BytesBuffer() TagCompound:WriteFile(buf) local stream = file.Open('ppm2/' .. fTarget .. '.dat', 'wb', 'DATA') buf:ToFileStream(stream) stream:Flush() stream:Close() end end file.Delete('ppm2/' .. ffind) end local PonyDataInstance do local _class_0 local _base_0 = { WriteNetworkData = function(self) for _, _des_0 in ipairs(PPM2.NetworkedPonyData.NW_Vars) do local strName, writeFunc, getName, defValue strName, writeFunc, getName, defValue = _des_0.strName, _des_0.writeFunc, _des_0.getName, _des_0.defValue if self["Get" .. tostring(getName)] then writeFunc(self["Get" .. tostring(getName)](self)) else writeFunc(defValue) end end end, Copy = function(self, fileName) if fileName == nil then fileName = self.filename end local copyOfData = { } for key, val in pairs(self.dataTable) do local _exp_0 = luatype(val) if 'number' == _exp_0 or 'string' == _exp_0 or 'boolean' == _exp_0 then copyOfData[key] = val elseif 'table' == _exp_0 or 'Color' == _exp_0 then if IsColor(val) then copyOfData[key] = Color(val) else copyOfData[key] = Color(255, 255, 255) end end end local newData = self.__class(fileName, copyOfData, false) return newData end, CreateCustomNetworkObject = function(self, goingToNetwork, ply, ...) if goingToNetwork == nil then goingToNetwork = false end if ply == nil then ply = LocalPlayer() end local newData = PPM2.NetworkedPonyData(nil, ply) newData:SetIsGoingToNetwork(goingToNetwork) self:ApplyDataToObject(newData, ...) return newData end, CreateNetworkObject = function(self, goingToNetwork, ...) if goingToNetwork == nil then goingToNetwork = true end local newData = PPM2.NetworkedPonyData(nil, LocalPlayer()) newData:SetIsGoingToNetwork(goingToNetwork) self:ApplyDataToObject(newData, ...) return newData end, ApplyDataToObject = function(self, target, ...) for key, value in pairs(self:GetAsNetworked()) do if not target["Set" .. tostring(key)] then error("Attempt to apply data to object " .. tostring(target) .. " at unknown index " .. tostring(key) .. "!") end target["Set" .. tostring(key)](target, value, ...) end end, UpdateController = function(self, ...) return self:ApplyDataToObject(self.nwObj, ...) end, CreateController = function(self, ...) return self:CreateNetworkObject(false, ...) end, CreateCustomController = function(self, ...) return self:CreateCustomNetworkObject(false, ...) end, Reset = function(self) for k, _des_0 in pairs(self.__class.PONY_DATA) do local getFunc getFunc = _des_0.getFunc self['Reset' .. getFunc](self) end end, GetSaveOnChange = function(self) return self.saveOnChange end, SaveOnChange = function(self) return self.saveOnChange end, SetSaveOnChange = function(self, val) if val == nil then val = true end self.saveOnChange = val end, GetValueFromNBT = function(self, mapData, value) if mapData.enum and type(value) == 'string' then return mapData.fix(mapData.enumMappingBackward[value:upper()]) elseif mapData.type == 'COLOR' then if IsColor(value) then return mapData.fix(Color(value)) else return mapData.fix(Color(value[1] + 128, value[2] + 128, value[3] + 128, value[4] + 128)) end elseif mapData.type == 'BOOLEAN' then if type(value) == 'boolean' then return mapData.fix(value) else return mapData.fix(value == 1) end else return mapData.fix(value) end end, GetExtraBackupPath = function(self) return tostring(self.__class.DATA_DIR_BACKUP) .. tostring(self.filename) .. "_bak_" .. tostring(os.date('%S_%M_%H-%d_%m_%Y', os.time())) .. ".dat" end, SetupData = function(self, data, force, doBackup) if data == nil then data = self.NBTTagCompound end if force == nil then force = false end if doBackup == nil then doBackup = false end if luatype(data) == 'NBTCompound' then data = data:GetValue() end if doBackup or not force then local makeBackup = false for key, value2 in pairs(data) do key = key:lower() local map = self.__class.PONY_DATA_MAPPING[key] if map then local mapData = self.__class.PONY_DATA[map] local value = self:GetValueFromNBT(mapData, value2) if mapData.enum then if luatype(value) == 'string' and not mapData.enumMappingBackward[value:upper()] or luatype(value) == 'number' and not mapData.enumMapping[value] then if not force then return self.__class.ERR_MISSING_CONTENT end makeBackup = true break end end end end if doBackup and makeBackup and self.exists then local fRead = file.Read(self.fpath, 'DATA') file.Write(self:GetExtraBackupPath(), fRead) end end for key, value2 in pairs(data) do local _continue_0 = false repeat key = key:lower() local map = self.__class.PONY_DATA_MAPPING[key] if not (map) then _continue_0 = true break end local mapData = self.__class.PONY_DATA[map] self.dataTable[key] = self:GetValueFromNBT(mapData, value2) _continue_0 = true until true if not _continue_0 then break end end end, ValueChanges = function(self, key, oldVal, newVal, saveNow) if saveNow == nil then saveNow = self.exists and self.saveOnChange end if self.nwObj and self.updateNWObject then local getFunc getFunc = self.__class.PONY_DATA[key].getFunc self.nwObj["Set" .. tostring(getFunc)](self.nwObj, newVal, self.networkNWObject) end if saveNow then return self:Save() end end, SetFilename = function(self, filename) self.filename = filename self.filenameFull = tostring(filename) .. ".dat" self.fpath = tostring(self.__class.DATA_DIR) .. tostring(filename) .. ".dat" self.preview = tostring(self.__class.DATA_DIR) .. "thumbnails/" .. tostring(filename) .. ".png" self.fpathFull = "data/" .. tostring(self.__class.DATA_DIR) .. tostring(filename) .. ".dat" self.isOpen = self.filename ~= nil self.exists = file.Exists(self.fpath, 'DATA') return self.exists end, SetNetworkData = function(self, nwObj) self.nwObj = nwObj end, SetPonyData = function(self, nwObj) self.nwObj = nwObj end, SetPonyDataController = function(self, nwObj) self.nwObj = nwObj end, SetPonyController = function(self, nwObj) self.nwObj = nwObj end, SetController = function(self, nwObj) self.nwObj = nwObj end, SetDataController = function(self, nwObj) self.nwObj = nwObj end, SetNetworkOnChange = function(self, newVal) if newVal == nil then newVal = true end self.networkNWObject = newVal end, SetUpdateOnChange = function(self, newVal) if newVal == nil then newVal = true end self.updateNWObject = newVal end, GetNetworkOnChange = function(self) return self.networkNWObject end, GetUpdateOnChange = function(self) return self.updateNWObject end, GetNetworkData = function(self) return self.nwObj end, GetPonyData = function(self) return self.nwObj end, GetPonyDataController = function(self) return self.nwObj end, GetPonyController = function(self) return self.nwObj end, GetController = function(self) return self.nwObj end, GetDataController = function(self) return self.nwObj end, IsValid = function(self) return self.valid end, Exists = function(self) return self.exists end, FileExists = function(self) return self.exists end, IsExists = function(self) return self.exists end, GetFileName = function(self) return self.filename end, GetFilename = function(self) return self.filename end, GetFileNameFull = function(self) return self.filenameFull end, GetFilenameFull = function(self) return self.filenameFull end, GetFilePath = function(self) return self.fpath end, GetFullFilePath = function(self) return self.fpathFull end, SerealizeValue = function(self, valID) if valID == nil then valID = '' end local map = self.__class.PONY_DATA[valID] if not (map) then return end local val = self.dataTable[valID] if map.enum then return DLib.NBT.TagString(map.enumMapping[val] or map.enumMapping[map.default()]) elseif map.serealize then return map.serealize(val) else local _exp_0 = map.type if 'INT' == _exp_0 then return DLib.NBT.TagInt(val) elseif 'FLOAT' == _exp_0 then return DLib.NBT.TagFloat(val) elseif 'URL' == _exp_0 then return DLib.NBT.TagString(val) elseif 'BOOLEAN' == _exp_0 then return DLib.NBT.TagByte(val and 1 or 0) elseif 'COLOR' == _exp_0 then return DLib.NBT.TagByteArray({ val.r - 128, val.g - 128, val.b - 128, val.a - 128 }) end end end, GetAsNetworked = function(self) local _tbl_0 = { } for k, _des_0 in pairs(self.__class.PONY_DATA) do local getFunc getFunc = _des_0.getFunc _tbl_0[getFunc] = self.dataTable[k] end return _tbl_0 end, ReadFromDisk = function(self, force, doBackup) if force == nil then force = false end if doBackup == nil then doBackup = true end if not (self.exists) then return self.__class.ERR_FILE_NOT_EXISTS end local fRead = file.Read(self.fpath, 'DATA') if not fRead or fRead == '' then return self.__class.ERR_FILE_EMPTY end self.NBTTagCompound:ReadFile(DLib.BytesBuffer(fRead)) return self:SetupData(self.NBTTagCompound, force, doBackup) or self.__class.READ_SUCCESS end, SaveAs = function(self, path) if path == nil then path = self.fpath end for key, val in pairs(self.dataTable) do self.NBTTagCompound:AddTag(key, self:SerealizeValue(key)) end local buf = DLib.BytesBuffer() self.NBTTagCompound:WriteFile(buf) local stream = file.Open(path, 'wb', 'DATA') buf:ToFileStream(stream) stream:Flush() stream:Close() return buf end, SavePreview = function(self, path) if path == nil then path = self.preview end local buildingModel = ClientsideModel('models/ppm/ppm2_stage.mdl', RENDERGROUP_OTHER) buildingModel:SetNoDraw(true) buildingModel:SetModelScale(0.9) local model = ClientsideModel('models/ppm/player_default_base_new_nj.mdl') do model:SetNoDraw(true) local data = self:CreateCustomController(model) model.__PPM2_PonyData = data local ctrl = data:GetRenderController() do local bg = data:GetBodygroupController() if bg then bg:ApplyBodygroups() end end do local _with_0 = model:PPMBonesModifier() _with_0:ResetBones() hook.Call('PPM2.SetupBones', nil, model, data) _with_0:Think(true) end model:SetSequence(22) model:FrameAdvance(0) end return timer.Simple(0.5, function() local renderTarget = GetRenderTarget('ppm2_save_preview_generate2', 1024, 1024, false) renderTarget:Download() render.PushRenderTarget(renderTarget) render.Clear(0, 0, 0, 255, true, true) cam.Start3D(Vector(49.373046875, -35.021484375, 58.332901000977), Angle(0, 141, 0), 90, 0, 0, 1024, 1024) buildingModel:DrawModel() do local data = model.__PPM2_PonyData local ctrl = data:GetRenderController() do local bg = data:GetBodygroupController() if bg then bg:ApplyBodygroups() end end do local _with_0 = model:PPMBonesModifier() _with_0:ResetBones() hook.Call('PPM2.SetupBones', nil, model, data) _with_0:Think(true) end do ctrl:DrawModels() ctrl:HideModels(true) ctrl:PreDraw(model, true) end model:DrawModel() ctrl:PostDraw(model, true) end cam.End3D() local data = render.Capture({ format = 'png', x = 0, y = 0, w = 1024, h = 1024, alpha = false }) model:Remove() buildingModel:Remove() file.Write(path, data) return render.PopRenderTarget() end) end, Save = function(self, doBackup, preview) if doBackup == nil then doBackup = true end if preview == nil then preview = true end if doBackup and self.exists then file.Write(self:GetExtraBackupPath(), file.Read(self.fpath, 'DATA')) end local buf = self:SaveAs(self.fpath) if preview then self:SavePreview(self.preview) end self.exists = true return buf end } _base_0.__index = _base_0 _class_0 = setmetatable({ __init = function(self, filename, data, readIfExists, force, doBackup) if readIfExists == nil then readIfExists = true end if force == nil then force = false end if doBackup == nil then doBackup = true end self:SetFilename(filename) self.NBTTagCompound = DLib.NBT.TagCompound() self.updateNWObject = true self.networkNWObject = true self.valid = self.isOpen self.rawData = data do local _tbl_0 = { } for k, _des_0 in pairs(self.__class.PONY_DATA) do local default default = _des_0.default _tbl_0[k] = default() end self.dataTable = _tbl_0 end self.saveOnChange = true if data then return self:SetupData(data, true) elseif self.exists and readIfExists then return self:ReadFromDisk(force, doBackup) end end, __base = _base_0, __name = "PonyDataInstance" }, { __index = _base_0, __call = function(cls, ...) local _self_0 = setmetatable({}, _base_0) cls.__init(_self_0, ...) return _self_0 end }) _base_0.__class = _class_0 local self = _class_0 self.DATA_DIR = "ppm2/" self.DATA_DIR_BACKUP = "ppm2/backups/" self.FindFiles = function(self) local output do local _accum_0 = { } local _len_0 = 1 for _, str in ipairs(file.Find(self.DATA_DIR .. '*', 'DATA')) do if not str:find('.bak.dat') then _accum_0[_len_0] = str:sub(1, #str - 4) _len_0 = _len_0 + 1 end end output = _accum_0 end return output end self.FindInstances = function(self) local output do local _accum_0 = { } local _len_0 = 1 for _, str in ipairs(file.Find(self.DATA_DIR .. '*', 'DATA')) do if not str:find('.bak.dat') then _accum_0[_len_0] = self(str:sub(1, #str - 4)) _len_0 = _len_0 + 1 end end output = _accum_0 end return output end self.PONY_DATA = PPM2.PonyDataRegistry do local _tbl_0 = { } for key, _des_0 in pairs(self.PONY_DATA) do local getFunc getFunc = _des_0.getFunc _tbl_0[getFunc:lower()] = key end self.PONY_DATA_MAPPING = _tbl_0 end for key, value in pairs(self.PONY_DATA) do self.PONY_DATA_MAPPING[key] = key end for key, data in pairs(self.PONY_DATA) do local _continue_0 = false repeat if not (data.enum) then _continue_0 = true break end do local _accum_0 = { } local _len_0 = 1 for _, arg in ipairs(data.enum) do _accum_0[_len_0] = arg:upper() _len_0 = _len_0 + 1 end data.enum = _accum_0 end data.enumMapping = { } data.enumMappingBackward = { } local i = -1 for _, enumVal in ipairs(data.enum) do i = i + 1 data.enumMapping[i] = enumVal data.enumMappingBackward[enumVal] = i end _continue_0 = true until true if not _continue_0 then break end end for key, _des_0 in pairs(self.PONY_DATA) do local getFunc, fix, enumMappingBackward, enumMapping, enum, min, max, default getFunc, fix, enumMappingBackward, enumMapping, enum, min, max, default = _des_0.getFunc, _des_0.fix, _des_0.enumMappingBackward, _des_0.enumMapping, _des_0.enum, _des_0.min, _des_0.max, _des_0.default self.__base["Get" .. tostring(getFunc)] = function(self) return self.dataTable[key] end self.__base["GetMin" .. tostring(getFunc)] = function(self) if min then return min end end self.__base["GetMax" .. tostring(getFunc)] = function(self) if max then return max end end self.__base["Enum" .. tostring(getFunc)] = function(self) if enum then return enum end end self.__base["Get" .. tostring(getFunc) .. "Types"] = function(self) if enum then return enum end end self["GetMin" .. tostring(getFunc)] = function(self) if min then return min end end self["GetMax" .. tostring(getFunc)] = function(self) if max then return max end end self["GetDefault" .. tostring(getFunc)] = default self["GetEnum" .. tostring(getFunc)] = function(self) if enum then return enum end end self["Enum" .. tostring(getFunc)] = function(self) if enum then return enum end end if enumMapping then self.__base["Get" .. tostring(getFunc) .. "Enum"] = function(self) return enumMapping[self.dataTable[key]] or enumMapping[0] or self.dataTable[key] end self.__base["GetEnum" .. tostring(getFunc)] = self.__base["Get" .. tostring(getFunc) .. "Enum"] end self.__base["Reset" .. tostring(getFunc)] = function(self) return self["Set" .. tostring(getFunc)](self, default()) end self.__base["Set" .. tostring(getFunc)] = function(self, val, ...) if val == nil then val = defValue end if luatype(val) == 'string' and enumMappingBackward then local newVal = enumMappingBackward[val:upper()] if newVal then val = newVal end end local newVal = fix(val) local oldVal = self.dataTable[key] self.dataTable[key] = newVal return self:ValueChanges(key, oldVal, newVal, ...) end end self.ERR_MISSING_PARAMETER = 4 self.ERR_MISSING_CONTENT = 5 self.READ_SUCCESS = 0 self.ERR_FILE_NOT_EXISTS = 1 self.ERR_FILE_EMPTY = 2 self.ERR_FILE_CORRUPT = 3 PonyDataInstance = _class_0 end PPM2.PonyDataInstance = PonyDataInstance PPM2.MainDataInstance = nil PPM2.GetMainData = function() if not PPM2.MainDataInstance then PPM2.MainDataInstance = PonyDataInstance('_current', nil, true, true) if not PPM2.MainDataInstance:FileExists() then PPM2.MainDataInstance:Save() end end return PPM2.MainDataInstance end
function CommandStation:GetTechButtons() return { kTechId.NanoShieldTech, kTechId.CatPackTech, kTechId.PowerSurgeTech, kTechId.MedTech1, kTechId.MedTech2 } end
local dPressed = false local aPressed = false local wPressed = false local spacePressed = false local physics = require("physics") local options = { frames = { { -- frame 1 main x = 0, y = 0, width = 207, height = 294 }, { -- frame 2 x = 216, y = 0, width = 207, height = 294 }, { -- frame 3 x = 429, y = 0, width = 207, height = 294 }, { -- frame 4 x = 642, y = 0, width = 207, height = 294 }, { -- frame 5 x = 855, y = 0, width = 207, height = 294 }, { -- frame 6 x = 1068, y = 0, width = 207, height = 294 }, { -- frame 7 x = 1281, y = 0, width = 207, height = 294 }, { -- frame 8 movement end x = 1494, y = 0, width = 207, height = 294 }, { -- frame 9 p1 x = 1707, y = 0, width = 294, height = 294 }, { -- frame 10 p2 x = 2001, y = 0, width = 294, height = 294 }, { -- frame 11 hurt x = 2295, y = 0, width = 294, height = 294 }, { -- frame 12 minigun x = 2589, y = 0, width = 294, height = 294 }, { -- frame 13 hurley 1 x = 2883, y = 0, width = 261, height = 294 }, { -- frame 14 x = 3150, y = 0, width = 261, height = 294 }, { -- frame 15 x = 3417, y = 0, width = 261, height = 294 }, { -- frame 16 x = 3684, y = 0, width = 261, height = 294 }, { -- frame 17 x = 3951, y = 0, width = 261, height = 294 }, { -- frame 18 x = 4218, y = 0, width = 261, height = 294 }, { -- frame 19 x = 4485, y = 0, width = 261, height = 294 }, { -- frame 20 x = 4752, y = 0, width = 261, height = 294 }, } } local buffsheet = graphics.newImageSheet( "img/experiment.png" , options ) local buffseq = { { name = "walk", start = 1, count = 8, time = 1100, loopCount = 0, loopDirection = "forward" }, { name = "punch", frames = { 1,9,10 }, time = 250, loopCount = 1, loopDirection = "bounce" }, { name = "pickupHurley", start = 13, count = 2, time = 300, loopCount = 2, loopDirection = "forward" }, { name = "walkHurley", start = 15, count = 4, time = 1100, loopCount = 1, loopDirection = "forward" }, { name = "hurt", frames = {1,11}, time = 300, loopCount = 1, loopDirection = "bounce" }, } local buff = display.newSprite( buffsheet, buffseq ) buff.x = display.contentCenterX buff.y = 900 buff:setSequence("walk") buff.mass = 999 local canJump = true function key(event) if (event.phase == "down") then if (event.keyName == "space") then spacePressed = true elseif (event.keyName == "w") then wPressed = true elseif (event.keyName == "a") then aPressed = true elseif (event.keyName == "d") then dPressed = true end elseif (event.phase == "up") then if (event.keyName == "space") then spacePressed = false elseif (event.keyName == "w") then wPressed = false elseif (event.keyName == "a") then aPressed = false elseif (event.keyName == "d") then dPressed = false end end end function walkBuff( event ) if (aPressed) then buff:play("walk") buff.x = buff.x - 10 buff.xScale = -1 end if (dPressed) then buff:play("walk") buff.x = buff.x + 10 buff.xScale = 1 end end function buffJump(event) if (wPressed and canJump) then canJump = false buff:setLinearVelocity(0,-1.5*buff.mass) end end function buffPunch(event) if(spacePressed)then buff:setSequence("punch") buff:play("punch") end if not (spacePressed) then buff:setSequence("walk") end end function on_hit(event) if(event.phase == "began") then canJump = true end end buff:addEventListener("collision",on_hit) Runtime:addEventListener("enterFrame",walkBuff) Runtime:addEventListener("enterFrame",buffJump) Runtime:addEventListener("key",key) Runtime:addEventListener("key",buffPunch) return buff
local mvector = metavector_mod.require("metavectors") benchmark.register("metavectors:metavectors",{ warmup = 5000, loops = 2000, before = function() local x = math.ceil(math.random()*100) local y = math.ceil(math.random()*100) local z = math.ceil(math.random()*100) return {x,y,z} end, run = function(data) local v = mvector.new(data[1],data[2],data[3]) assert(v + v - v == v) assert(v.." test" == tostring(v).." test") assert(v*2 == v+v) assert(v*v/2) assert(mvector.parse(tostring(v)) == v) end, }) benchmark.register("metavectors:standardvectors",{ warmup = 5000, loops = 2000, before = function() local x = math.ceil(math.random()*100) local y = math.ceil(math.random()*100) local z = math.ceil(math.random()*100) return {x,y,z} end, run = function(data) local v = vector.new(data[1],data[2],data[3]) assert(vector.equals(vector.subtract(vector.add(v,v),v),v)) assert(minetest.pos_to_string(v).." test") assert(vector.equals(vector.multiply(v,2),vector.add(v,v))) assert(vector.divide(vector.multiply(v,v),2)) assert(vector.equals(minetest.string_to_pos(minetest.pos_to_string(v)),v)) end, })
ChatSystemLib.PostOnChannel(ChatSystemLib.ChatChannel_System, "[WSRP Housing Directory] Entity: Dominion Directory Loaded.") return { { title = "Valiantheart Coliseum", owner = "Erallia Valiantheart", hours = "Refer to Owner for hours", staff = "Erallia Valiantheart", description = "The Valiantheart Coliseum and Tavern owned by Erallia Valiantheart, a place labeled as 'Spar-and-Bar', you can come to spectate or even be a part of the many fights that take place here. We hold various different fights and we're always looking for new ways to make sparring here, a memory that'll last a lifetime. We also host an event every so often called the \"Dominion's Finest Fighter\" tournament up in the main Coliseum. We're open to requests by RPers or the Valiantheart crew on opening at any time.", }, { title = "Noriack's Cafe", owner = "Chef Noriack", hours = "Friday 10pm est - Whenever ", staff = "Chef Noriack, Lala Sasazy, Prietess Helmina, Neffelo Clamp", description = "Noriack's cafe serves a wide variety of tea, coffee, lattes, cassianos, and a small beer and wine selection. The popular Necrohive Mead is a regular here to many guests. The food selection can be just as varied with dishes like the ultra cheesy Artemis Pizza, the sweet and spicy Honey glazed Ravenok, or get your desert on with some delicious Caramel and Chocolate topped Cheesecake. Many other items are available and the menu changes from week to week. \nNoriack's cafe is a whirlwind of activity on Friday evenings from 10pm est until it quiets down (Well after midnight.) Though everyone is always welcome to come use the Lopp staff that exist to get meals and drinks in the off hours. \nThe grounds of the cafe are always open to the public and are composed of lovely gardens and a glass skyway that puts you above the troubles of the world. There is a sky garden, lounge, and even a dance floor to get ones groove on. \nWe are happy to cater events and provide off hour services, or even home delivery, just please contact Chef Noriack with any requests you might have. Wedding coming up? Rent out the cafe, or let us come to you! Wedding booth construction available upon request.", }, { title = "The Shock Collar Bar & Casino", owner = "Neffelo Clamp", hours = "Wednesdays 10pm est - 1am", staff = "Neffelo Clamp, Chef Noriack, Vannyx Xanniton, Priestess Helmina", description = "The premier Club Casino and Bar! It hosts beverages from Bezgelore and a wide assortment of safe for all to consume beverages as well. Come try your hand at the slot machines or some cards or roulette while you're there. Meet some new friends and get immersed in chua culture! \n\nCome and marvel at the technology displayed! Admired the scientific beauty! Make new contacts for business! All at the Shock Collar Bar and Casino! \n\nThis club is run by the Red Tail Collective headed by Neffelo Clamp and is open to all. A small section that is a chua only private bar inside the main building exists for those chua needing to get to a place that feels more like home.\n\n\n\n", }, { title = "The Eldan Fried Cubig Protobar", owner = "Grumlen Dangerpants", hours = "24/7", staff = "Grumlen Dangerpants", description = "The Eldan-Fried Cubig (EFC) protobar was originally conceived by the Protostar Corporation as a means of assuring fast food services to almost anywhere in the known galaxy, utilizing a delivery system of advanced teleportation-based transit and housed in small, communal sit-in \“dining ships\”. The only constructed prototype was scrapped and left for ruin atop an asteroid in the Halon Ring of Nexus, where chua scrapper Grumlen \"Dangerpants\" stumbled upon it years later and took it upon himself to refurbish the small business to that of his own design. \n\nClaiming to definitely still be a licensed Protostar franchise, and boasting a menu of only 2 different questionably-specific fried meals... it’s safe to say EFC's food probably tastes as good as the place in which it’s presented is maintained.", }, { title = "Our Lady Eldan", owner = "Opeth Mistreaver", hours = "24/7", staff = "Priestess Helmina, Opeth Mistreaver, Furgun Darkstorm", description = "This plot is a Vigilant Church, fully dedicated to the religious beliefs of the Dominion religion. There is a shrine to the Six Scions, a full church with pipe organ, confessional and prayer candles, a church rectory, mausoleum w/cemetery, a conference/meeting hall, cleansing water spring and expansive garden. \n\nIt is open to all religious events. Please contact our staff to set up events or for use of the plot, it is open for viewing, but would like to keep the peace so to speak. Regular Vigils (sermons) are held on Sundays at 7:00 PM EST.", }, { title = "Evindra Imeperial Park", owner = "Xerune Novimae", hours = "24/7", staff = "Xerune Novimae, Isabella Sinclair, Perseus Ford, Vyzura Razorcloak, Atun Nol (xerune is IC, all others can change things)", description = "The Imperial Park is a place for all Dominion citizens to enjoy the flora wonders of Nexus at any time and within the safety of the Empire. Several exhibits exist to show off certain areas such as Ellevar, Deardune, and Wilderrun. The Emperor Myrcalus Botany Conservatory holds some exhibits in contested territories such as Farside, Celestion, Algoroc, Galeras, and another unknown. There's also picnic area with food vendors and a ferris wheel. It is truly a park for anyone.\n\nThere is also a game! A scavenger hunt for 8 carrots and a vind all hidden throughout the park. Can you find them all? \n\nHowever there is also a secret, underground the ICI conducts meetings and other details. To the general public no one knows of it's location. But for those of the ICI know it is a place for their needs be it from holding suspicious people, interrogations, medical needs to even socializing among themselves and a place to rest. ", }, { title = "The Jabbit Hole", owner = "Jabbit Tooth", hours = "24/7", staff = "Jabbit Tooth", description = "Though not an advertised or even desirable locale, the mysterious city—nicknamed by the knowing few as the \"Jabbit Hole\"—has become home to a handful of lost vagrants and those of ill repute. Its origins are unknown, as is its location. The only method of travel seems to be through a bypassed teleportation pad nestled within the corner of the city's only currently accessible alleyway.\nThe city itself had gradually fallen further into a state of disrepair following whatever cataclysm flung it into its present realm of existence. A smoggy, starless sky envelops the urban landscape with a framework of decayed architecture keeping the area contained.\nMost visitors of the Jabbit Hole gain access through the numerous faulty teleportation pads courtesy of Protostar's Nexus colonization project. Regardless of the amount of work it takes to get in, travelers will find the real challenge is their inevitable escape. Unless they were never meant to leave at all.", }, { title = "Curiosity", owner = "Vagabond Croix", hours = "Every other Saturday 10 PM-?", staff = "Vagabond Croix", description = "Curiosity is the Dominion's premiere night club, offering the finest in finger foods, such as the now famous pulled cupork sliders, along with a massive assortment of liquors, spirits, and exciting cocktails to keep you curious for more.\n\nCuriosity hosts a variety of events, including trivia night, murder mysteries, truth or dare, scavenger hunts, and a banquet of other delightful challenges to keep the brain guessing and the mind wanting more.", }, { title = "The Beacon of the Scions", owner = "Inquisitor Garack", hours = "Unscheduled", staff = "Inquisitor Garack, Daisy Xay", description = "The Beacon of the Scions is a Dominion space station near Nexus. It has a market, lodging, and a bar/restaurant, with more features on the way. It's also connected to the Protostar Housing Network.", }, { title = "ICI Operative Retreat", owner = "Desai Septaphex", hours = "24/7", staff = "Desai Septaphex", description = "The retreat offers a calm environs for agents off duty and any of their friends to unwind, enjoy a drink, conversation, pray, spar, or enjoy a sauna or acid bath (mechari only) Just please.. do avoid the basement....", }, { title = "Horizon", owner = "Victoria Hemming", hours = "Sunday 8:30 - 11:30 PM (EST)", staff = "Victoria Hemming", description = "Horizon is an open-air dance club that is in low orbit around Nexus. Yes, you read correctly! Equipped with the latest Protostar™ Skyplot mobility technologies, Horizon is always moving towards the horizon, countering the motion of Nexus’ rotation. The end result is a perpetual sunset for our patrons to enjoy.\n\nThe warm sunlight is not all that Horizon has to offer. Far from Cassus, Horizon aims to bring the long absent summer Cassian club culture to Nexus. Gone are the days of being crammed in a dimly lit underground bunker with a jukebox violating your ear drums (or audio receptors). Horizon sports a specially made sound system, named \“The Endless Summer Sound System™\”, which incorporates one of Nexus’ most powerful setup of speakers working in tandem with the latest in acoustic design to bring loud, thumping dance music to you without the fear of going deaf. Coupled with the sunny, laid-back atmosphere and tailored selection of music, Horizon brings a clubbing experience like none other.\n\nRead more at: http://www.tinyurl.com/horizonadvert", }, { title = "The Vigilant Sanctuary", owner = "Dajia Nano", hours = "24/7", staff = "Dajia Nano, Afterburn Unicron", description = "A haven for those seeking refuge, or quiet meditation away from the bustle of Illium. The Sanctuary is a place for those devout to the Scions to come and pray within the sanctuary itself or wander the gardens while basking in the glory of the Scions. The Vigilant Sanctuary is open to host sermons for the Vigilant Church along with offering a place to stay for those loyal to the Dominion. Deeper within the Sanctuary, there is a rehabilitation facility for those of the Dominion in need of some..re-education.", }, }
--[[ Based on a plugin by topkecleon. Licensed under GNU AGPLv3 https://github.com/topkecleon/otouto/blob/master/LICENSE. Copyright 2020 Matthew Hesketh <matthew@matthewhesketh.com> This code is licensed under the MIT. See LICENSE for details. ]] local lastfm = {} local mattata = require('mattata') local http = require('socket.http') local url = require('socket.url') local json = require('dkjson') local redis = require('libs.redis') function lastfm:init(configuration) assert(configuration.keys.lastfm, 'lastfm.lua requires an API key, and you haven\'t got one configured!') lastfm.commands = mattata.commands(self.info.username):command('lastfm'):command('np'):command('fmset').table lastfm.help = '/np <username> - Returns what you are or were last listening to. If you specify a username, info will be returned for that username. /fmset <username> - Sets your last.fm username. Use /fmset -del to delete your current username.' lastfm.url = 'http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&format=json&limit=1&api_key=' end function lastfm.set_username(user_object, name, language) redis:hset('user:' .. user_object.id .. ':info', 'lastfm', name) return string.format(language['lastfm']['1'], user_object.first_name, name) end function lastfm.del_username(user_id, language) if redis:hget('user:' .. user_id .. ':info', 'lastfm') then redis:hdel('user:' .. user_id .. ':info', 'lastfm') return language['lastfm']['2'] end return language['lastfm']['3'] end function lastfm.get_username(user_id) return redis:hget('user:' .. user_id .. ':info', 'lastfm') end function lastfm:on_message(message, configuration, language) local input = mattata.input(message.text) if message.text:match('^[/!#]lastfm') then return mattata.send_reply(message, lastfm.help) elseif message.text:match('^[/!#]fmset') then input = input or message.from.username if not input then return mattata.send_reply(message, lastfm.help) elseif input == '-del' then local output = lastfm.del_username(message.from.id, language) return mattata.send_reply(message, output) end local output = lastfm.set_username(message.from, input, language) return mattata.send_reply(message, output) end local username, output if input then username = input elseif lastfm.get_username(message.from.id, language) then username = lastfm.get_username(message.from.id) else return mattata.send_reply(message, language['lastfm']['4']) end local jstr, res = http.request(lastfm.url .. configuration.keys.lastfm .. '&user=' .. url.escape(username)) if res ~= 200 then return mattata.send_reply(message, language['errors']['connection']) end local jdat = json.decode(jstr) if jdat.error then return mattata.send_reply(message, language['lastfm']['4']) end if not jdat or not jdat.recenttracks then return mattata.send_reply(message.chat.id, language['lastfm']['5']) end jdat = jdat.recenttracks.track[1] or jdat.recenttracks.track output = input and mattata.escape_html(input) or string.format('<a href="%s">%s</a>', 'https://last.fm/user/' .. url.escape(username), mattata.escape_html(message.from.first_name)) output = (jdat['@attr'] and jdat['@attr'].nowplaying) and string.format(language['lastfm']['6'], output) or string.format(language['lastfm']['7'], output) local title = jdat.name or language['lastfm']['8'] local artist = jdat.artist and jdat.artist['#text'] or language['lastfm']['8'] if artist and title ~= jdat.name then mattata.send_chat_action(message.chat.id) return mattata.send_message(message.chat.id, output .. artist .. ' - ' .. title) elseif jdat.image and jdat.image[1]['#text'] == '' then return mattata.send_message(message.chat.id, output .. artist .. ' - ' .. title) end mattata.send_chat_action(message.chat.id, 'upload_photo') output = output .. string.format('<a href="%s">%s</a>', jdat.url, artist .. ' - ' .. title) return mattata.send_photo(message.chat.id, jdat.image[4]['#text'], output, 'html') end return lastfm
if #arg ~= 2 then print("usage: lua sort_hiscore.lua hiscore.dat mame.lst") return end local datfile = io.open(arg[1]) if not datfile then return end local entries = {{}} local namelist = false local comment = false local entry = entries[1] for line in datfile:lines() do local function next_entry() entries[#entries + 1] = {} comment = false namelist = false return entries[#entries] end local function additem(table, item) if not entry[table] then entry[table] = {} end entry[table][#entry[table] + 1 ] = item end local function clean(data) return data:match("^([^%s;]+)"):lower() end if line:match("^%w") then if not comment and not namelist then entry = next_entry() end namelist = true else namelist = false end if line:match("^%s*$") then entry = next_entry() end line = line:match("^%s*.-%s*$") local char = line:sub(1,1) if char == ";" then additem("comment", line) comment = true else comment = false end if char:match("%w") then additem("name", clean(line):sub(1, -2)) end if char == "@" then additem("data", clean(line)) end end datfile:close() local lstfile = io.open(arg[2]) local list = {} local src = "error" for line in lstfile:lines() do if not line:match("^[%s/*]") then if line:sub(1,1) == "@" then src = line:match("^@source:(.*)") else local set = line:match("^([^%s/]*)") if set and set ~= "" then list[set] = src end end end end lstfile:close() local sorted = {} local comments = 0 for num, entry in ipairs(entries) do if not entry.name then if entry.comment then if entry.comment[1]:sub(2,4) ~= "@s:" then comments = comments + 1 table.insert(sorted, comments, entry) end end else table.sort(entry.name) entry.src = "source not found" for num, name in ipairs(entry.name) do name = name:match("[^,]*") if not list[name] then entry.name[num] = entry.name[num] .. ": ; missing" else entry.name[num] = entry.name[num] .. ":" entry.src = list[name] end end sorted[#sorted + 1] = entry end end for num1, entry in ipairs(sorted) do if entry.name then for num2, name in ipairs(entry.name) do local curname = name:match("[^:]*") for num3, entry2 in ipairs(sorted) do if entry2.name and entry.src == entry2.src and entry ~= entry2 then for num4, name2 in ipairs(entry2.name) do if curname == name2:match("[^:]*") then print(name, "duplicate name") end end end end end end end for num1, entry in ipairs(sorted) do if entry.data then for num2, entry2 in ipairs(sorted) do if entry2.data and entry.src == entry2.src and entry ~= entry2 and #entry.data == #entry2.data then for i = 1, #entry2.data do if entry.data[i] ~= entry2.data[i] then break end if i == #entry2.data then for num3, name in ipairs(entry2.name) do entry.name[#entry.name + 1] = name end if entry2.comment then for num3, comment in ipairs(entry2.comment) do if not entry.comment then entry.comment = {} end entry.comment[#entry.comment + 1] = comment end end sorted[num2] = {} end end end end end end -- copyright 2010 Uli Schlachter GPLv2 function stable_sort(list, comp) -- A table could contain non-integer keys which we have to ignore. local num = 0 for k, v in ipairs(list) do num = num + 1 end if num <= 1 then -- Nothing to do return end -- Sort until everything is sorted :) local sorted = false local n = num while not sorted do sorted = true for i = 1, n - 1 do -- Two equal elements won't be swapped -> we are stable if comp(list[i+1], list[i]) then local tmp = list[i] list[i] = list[i+1] list[i+1] = tmp sorted = false end end -- The last element is now guaranteed to be in the right spot n = n - 1 end end stable_sort(sorted, function(a,b) if a.src and b.src then return a.src < b.src elseif not a.src then return true else return false end end) src = "error"; for num, entry in ipairs(sorted) do local function printall(table) for num, str in ipairs(table) do print(str) end end if entry.src and entry.src ~= src then print(";@s:" .. entry.src .. "\n") src = entry.src end if entry.comment then printall(entry.comment) end if entry.name then printall(entry.name) printall(entry.data) end print("\n") end
g_SplitTimes = {} g_DrawList = {} g_Rank = nil --[[ g_DrawList ={ {rank = 1, name = "#FF0000SDK1"}, {rank = 2, name = "8888888888888888888888"}, {rank = 3, name = "SD#FFF000K3", line = true}, {rank = 8, name = "SDK8"}, {rank = 9, name = "SDK9"}, {rank = 10, name = "SDK10", player = getLocalPlayer()}, {rank = 11, name = "SDK#66666111"}, {rank = 12, name = "SDK12"} }--]] localPlayer = getLocalPlayer() screenFadedOut = false raceState = "" enableBoard = false gamemodeAllowed = false allowedGM = { ["Never the same"] = true, ["Sprint"] = true, ["Reach the flag"] = true, } lines = 8 ranksBefore = 2 ranksBehind = 2 splitsTop = 1 splitsBefore = 1 splitsBehind = 1 function gameModeHandler(gm) if allowedGM[gm] then gamemodeAllowed = true else gamemodeAllowed = false end end addEvent("serverSendGM",true) addEventHandler("serverSendGM",root,gameModeHandler) function updateWhiteList() for k,v in pairs(g_DrawList) do g_DrawList[k] = nil end g_Rank = tonumber(getElementData(localPlayer, 'race rank')) if not isBoardAllowed() or not g_Rank then return end local players = getElementsByType('player') table.sort ( players, function ( a, b ) a = tonumber(getElementData(a, 'race rank')) b = tonumber(getElementData(b, 'race rank')) if not a then return false elseif not b then return true else return a < b end end ) local ranksTop = math.clamp ( 1, lines - (1 + ranksBefore + ranksBehind), #players) local ranksBefore = math.clamp ( 1, g_Rank - math.abs( ranksBefore ), g_Rank) local ranksBehind = math.clamp ( g_Rank, g_Rank + math.abs( ranksBehind ), #players) for rank, player in ipairs (players) do if rank <= ranksTop and rank <= g_Rank --top ranks or ranksBefore <= rank and #g_DrawList < lines --front and back ranks or #players - rank < lines - #g_DrawList then g_DrawList[#g_DrawList + 1] = { rank = rank, player = player, name = getPlayerName(player) } if g_DrawList[#g_DrawList].rank > 1 and g_DrawList[#g_DrawList].rank - g_DrawList[#g_DrawList - 1].rank ~= 1 then g_DrawList[#g_DrawList - 1].line = true elseif rank <= splitsTop or (g_Rank - splitsBefore <= rank and rank <= g_Rank + splitsBehind) then g_DrawList[#g_DrawList].split = true end end end end setTimer(updateWhiteList, 450, 0) addEventHandler("onClientPlayerQuit", root, updateWhiteList) local screenx,screeny = guiGetScreenSize() x = screenx - 210 y = 200 w = 200 lineheight = 15 rank_w = 27 space_w = 10 margin = 5 font = "default" timewidth = 65 drawSplitTimeTime = 5000 addEventHandler("onClientScreenFadedOut",getRootElement(),function() screenFadedOut = true end) addEventHandler("onClientScreenFadedIn",getRootElement(),function() screenFadedOut = false end) addCommandHandler('board', function(cmd, args) enableBoard = not enableBoard outputChatBox((enableBoard and'Showing' or 'Hiding') .. ' ranking board' ) end) addEventHandler('onClientRender', getRootElement(), function() if not isBoardAllowed() then return end drawBackground(x,y,w,lines * lineheight) drawRank() drawSplits() end) function isBoardAllowed() return not screenFadedOut and enableBoard and gamemodeAllowed end function drawBackground (x,y,w,d) dxDrawRectangle(x-1,y-1,rank_w+2,d+2,tocolor(255,255,255)) dxDrawRectangle(x,y,rank_w,d,tocolor(0,0,0)) dxDrawRectangle(x-1+rank_w+space_w,y-1,w+2-rank_w-space_w,d+2,tocolor(255,255,255)) dxDrawRectangle(x+rank_w+space_w,y,w-rank_w-space_w,d,tocolor(0,0,0)) -- for i=1,lines-1 do -- dxDrawLine(x,y + i* lineheight, x+w, y + i * lineheight, tocolor(255,255,255)) -- end end function drawRank() for k,r in ipairs(g_DrawList) do if r.line == true then local text = "-" local width = dxGetTextWidth(text,1,font) text = string.rep ( text, math.ceil(w-(rank_w+space_w) / width) + 1 ) dxDrawText(text, x,y+(k-1)*lineheight, x+rank_w, y+k*lineheight,tocolor(255,0,0),1,font,"center", "center",true) dxDrawText(text, x+rank_w+space_w,y+(k-1)*lineheight, x+w, y+k*lineheight,tocolor(255,0,0),1,font,"center", "center",true) else if r.player == localPlayer then dxDrawRectangle(x,y+(k-1)*lineheight, rank_w, lineheight,tocolor(100, 100, 100)) dxDrawRectangle(x+rank_w+space_w,y+(k-1)*lineheight, w-(rank_w+space_w), lineheight,tocolor(100, 100, 100)) end -- dxDrawBorderedText(1,tocolor(255,255,255),r.rank .. ".",x,y+(k-1)*lineheight, x+rank_w, y+k*lineheight,tocolor(255,255,255),1,font,"center", "center",true) -- dxDrawBorderedText(1,tocolor(255,255,255),r.name ,x+rank_w+space_w + margin,y+(k-1)*lineheight, x+w-margin, y+k*lineheight,tocolor(255,255,255),1,font,"left", "center",true) dxDrawColorText(r.rank .. ".",x+margin,y+(k-1)*lineheight, x+rank_w, y+k*lineheight,tocolor(255,255,255),1,font,"left", "center",true) dxDrawColorText(r.name ,x+rank_w+space_w + margin,y+(k-1)*lineheight, x+w-margin, y+k*lineheight,tocolor(255,255,255),1,font,"left", "center",true) local state = isElement(r.player) and getElementType(r.player) == "player" and getElementData(r.player, 'state', false) if state and getElementData(r.player, 'race.finished', false) then dxDrawRectangle(x,y+(k-1)*lineheight, rank_w, lineheight,tocolor(0, 255, 0,60)) dxDrawRectangle(x+rank_w+space_w,y+(k-1)*lineheight, w-(rank_w+space_w), lineheight,tocolor(0, 255, 0,60)) elseif state == "dead" then local text = "-" local width = dxGetTextWidth(text,1,font) text = string.rep ( text, math.ceil(w-(rank_w+space_w) / width) + 1 ) dxDrawText(text, x,y+(k-1)*lineheight, x+rank_w, y+k*lineheight,tocolor(255,255,255),1,font,"center", "center",true) dxDrawText(text, x+rank_w+space_w,y+(k-1)*lineheight, x+w, y+k*lineheight,tocolor(255,255,255),1,font,"center", "center",true) end end end end function drawSplits() local localTimes = g_SplitTimes[localPlayer] local localCP = localTimes and localTimes.current and localTimes.current.checkpoint if not tonumber(localCP) then return end for line, data in ipairs ( g_DrawList ) do local player, playerRank, playerShowSplitTime, playerTimes = data.player, data.rank, data.split, g_SplitTimes[data.player] if player ~= localPlayer and isElement(player) and playerTimes and playerShowSplitTime then local playerCP = playerTimes.current and playerTimes.current.checkpoint or false if playerTimes[localCP] then -- when reaching a checkpoint behind someone if getTickCount() - localTimes[localCP].tick <= drawSplitTimeTime and playerRank < g_Rank then drawSplitTime(line, localTimes.current.time - playerTimes[localCP].time) end elseif localTimes[playerCP] then -- when someone reaches a cp behind you if getTickCount() - playerTimes[playerCP].tick <= drawSplitTimeTime and playerRank > g_Rank then drawSplitTime(line, localTimes[playerCP].time - playerTimes[playerCP].time) end end end end end function drawSplitTime(line,splittime) local x = x - margin - timewidth local y = y + (line-1) * lineheight + 1 local w = timewidth local h = lineheight -2 local color = splittime<0 and tocolor(255,0,0) or tocolor(0,255,0) dxDrawRectangle(x,y,w,h,color) dxDrawRectangle(x+1,y+1,w-2,h-2,tocolor(0, 0, 0)) dxDrawText(timeMsToTimeText(splittime), x+margin/2,y,x+w-margin/2,y+h,color,1,font, "right", "center", true) end --[[ addEventHandler("onClientRender", root, function() -- drawSplitTime(5,-1500) -- drawSplitTime(6,-1565489) -- drawSplitTime(7,1500) -- drawSplitTime(8,59880+60000*88) end) --]] addEvent('onClientMapStarting', true) addEventHandler('onClientMapStarting', getRootElement(), function(mapinfo) g_SplitTimes = {} end ) addEvent('onClientPlayerReachCheckpoint', true) addEventHandler('onClientPlayerReachCheckpoint', getRootElement(), function(checkpoint, time) if not g_SplitTimes[source] then g_SplitTimes[source] = {} end g_SplitTimes[source].current = { checkpoint = checkpoint, time = time, tick = getTickCount() } g_SplitTimes[source][checkpoint] = { time = time, tick = getTickCount() } -- for i,v in ipairs ( g_SplitTimes[source] ) do -- if g_SplitTimes[source].current.checkpoint < i then -- g_SplitTimes[source][i] = nil -- end -- end end ) function showsplits(c, a) local t = g_SplitTimes[getPlayerFromName(a)] -- outputDebugString('Current: ' .. t.current.checkpoint .. ' ' .. t.current.time .. ' ' .. t.current.tick .. ' ') for k,v in pairs(t) do outputDebugString(k .. ': ' .. v.time .. ' ' .. v.tick .. ' ') end end -- addCommandHandler('showsplits',showsplits) function timeMsToTimeText( timeMs ) local pre = (timeMs > 0 and '+') or '-' timeMs = math.abs ( timeMs ) local minutes = math.floor( timeMs / 60000 ) timeMs = timeMs - minutes * 60000; -- local seconds = math.floor( timeMs / 1000 ) local seconds = timeMs / 1000 -- local ms = timeMs - seconds * 1000; return string.format( '%s%d:%05.2f', pre, minutes, seconds ) end function timeMsToTimeText2( timeMs ) local pre = (timeMs > 0 and '+') or '-' timeMs = math.abs ( timeMs ) local minutes = math.floor( timeMs / 60000 ) timeMs = timeMs - minutes * 60000; local seconds = math.floor( timeMs / 1000 ) local ms = timeMs - seconds * 1000; return pre .. string.format( '%01d:%02d:%03d', minutes, seconds, ms ); end function math.clamp(lowClamp, val, highClamp) return math.max(math.min(val, highClamp), lowClamp) end function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, alignX, alignY) if alignX then if alignX == "center" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = ax + (bx-ax)/2 - w/2 elseif alignX == "right" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = bx - w end end if alignY then if alignY == "center" then local h = dxGetFontHeight(scale, font) ay = ay + (by-ay)/2 - h/2 elseif alignY == "bottom" then local h = dxGetFontHeight(scale, font) ay = by - h end end local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) end end function dxDrawBorderedText(outlineSize, outlineColor, text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) if not outlineSize or not outlineColor or not text or not left or not top then return end if not right then right = left end if not bottom then bottom = top end if not color then color = 0xFFFFFFFF end if not scale then scale = 1 end if not font then font = font end if not alignX then alignX = "left" end if not alignY then alignY = "right" end if clip == nil then clip = false end if wordBreak == nil then wordBreak = false end if postGUI == nil then postGUI = false end for oX = -1*outlineSize, outlineSize do for oY = -1*outlineSize, outlineSize do dxDrawText(text, left + oX, top + oY, right + oX, bottom + oY, outlineColor, scale, font, alignX, alignY, clip, wordBreak, postGUI) end end dxDrawText(text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) end -- Exported function for settings menu, KaliBwoy function showBoard() enableBoard = true local xml = xmlLoadFile("board_settings.xml") if not xml then xml = xmlCreateFile("board_settings.xml", "main") end local child = xmlFindChild(xml, "option", 0) if not child then child = xmlCreateChild(xml, "option") end xmlNodeSetValue(child, tostring(true)) xmlSaveFile(xml) xmlUnloadFile(xml) end function hideBoard() enableBoard = false local xml = xmlLoadFile("board_settings.xml") if not xml then xml = xmlCreateFile("board_settings.xml", "main") end local child = xmlFindChild(xml, "option", 0) if not child then child = xmlCreateChild(xml, "option") end xmlNodeSetValue(child, tostring(false)) xmlSaveFile(xml) xmlUnloadFile(xml) end
local set = {1, 2, 3} local set2 = {2, 3, 4} local union = function(self, set) local result = {} local temp = {} for i, v in ipairs(self) do temp[v] = true end for i, v in ipairs(set) do temp[v] = true end for k, v in pairs(temp) do table.insert(result, k) --result[#result + 1] = k end return result end setmetatable(set, { __add = union}) local set3 = set + set2 for i, v in ipairs(set3) do print(i, v) end print(getmetatable(set)) local user = require('user') me = user:new('silence') print(me:get_name()) me:set_name('kk') print(me:get_name())
-- Copyright (c) 2020 Trevor Redfern -- -- This software is released under the MIT License. -- https://opensource.org/licenses/MIT local callback = require "moonpie.callback" local logger = require "moonpie.logger" local EventSystem = {} local events = {} function EventSystem.subscribe(event_name, handler) if not events[event_name] then events[event_name] = callback:new() end events[event_name]:add(handler) end function EventSystem.unsubscribe(event_name, handler) events[event_name]:remove(handler) end function EventSystem.dispatch(event) logger.debug("Event System Dispatch: %s", event.type) if events[event.type] then events[event.type]:trigger(event) end end function EventSystem.clear() events = {} end return EventSystem
--[[ $Id$ Copyright © 2011 the VideoLAN team Authors: Konstantin Pavlov (thresh@videolan.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. --]] -- Probe function. function probe() local path = vlc.path:gsub("^www%.", "") return vlc.access == "http" and ( string.match( vlc.path, "^zapiks%.fr/(.*)%.html" ) or string.match( vlc.path, "^zapiks%.fr/view/.+" ) or string.match( vlc.path, "^26in%.fr/videos/.+" ) ) end -- Parse function. function parse() if string.match ( vlc.path, "zapiks.fr/(.+).html" ) or string.match( vlc.path, "26in.fr/videos/" ) then while true do line = vlc.readline() if not line then break end -- Try to find video id number if string.match( line, "video_src(.+)file=(%d+)\"" ) then _,_,id = string.find( line, "file=(%d+)") end -- Try to find title if string.match( line, "(.*)</title>" ) then _,_,name = string.find( line, "(.*)</title>" ) end end return { { path = "http://www.zapiks.fr/view/index.php?file=" .. id, name = name } } end if string.match ( vlc.path, "zapiks.fr/view/." ) then prefres = vlc.var.inherit(nil, "preferred-resolution") while true do line = vlc.readline() if not line then break end -- Try to find URL of video if string.match( line, "<file>(.*)</file>" ) then _,_,path = string.find ( line, "<file>(.*)</file>" ) end -- Try to find image for arturl if string.match( line, "<image>(.*)</image>" ) then _,_,arturl = string.find( line, "<image>(.*)</image>" ) end if string.match( line, "title=\"(.*)\"" ) then _,_,name = string.find( line, "title=\"(.*)\"" ) end -- Try to find whether video is HD actually if( prefres <0 or prefres >= 720 ) then if string.match( line, "<hd.file>(.*)</hd.file>" ) then _,_,path = string.find( line, "<hd.file>(.*)</hd.file>" ) end end end return { { path = path; name = name; arturl = arturl } } end vlc.msg.err( "Could not extract the video URL from zapiks.fr" ) return {} end
data:extend({ { type = "explosion", name = "ntc-cannot-build", flags = {"not-on-map"}, animations = { { filename = "__StrictEngagements__/graphics/null.png", priority = "low", width = 32, height = 32, frame_count = 1, line_length = 1, animation_speed = 1 }, }, light = {intensity = 0, size = 0}, sound = { { filename = "__StrictEngagements__/sounds/cannot-build.ogg", volume = 0.99 }, }, } })
CLGAMEMODESUBMENU.base = "base_gamemodesubmenu" CLGAMEMODESUBMENU.priority = 0 CLGAMEMODESUBMENU.title = "submenu_addons_heroes_title" function CLGAMEMODESUBMENU:Populate(parent) local form = vgui.CreateTTT2Form(parent, "header_addons_heroes") form:MakeCheckBox({ label = "label_heroes_auto_place_enable", convar = "ttt_crystal_auto" }) end function CLGAMEMODESUBMENU:ShouldShow() return GetGlobalBool("ttt2_classes") and GetGlobalBool("ttt2_heroes") end
local TREE = {} --Name of the skill tree TREE.Name = "Sorcier" --Description of the skill tree TREE.Description = "Visitez les recoins les plus sombres de la Force" --Icon for the skill tree ( Appears in category menu and above the skills ) TREE.TreeIcon = "wos/forceicons/lightstream.png" --What is the color for the background of skill icons TREE.BackgroundColor = Color( 255, 0, 0 ) --How many tiers of skills are there? TREE.MaxTiers = 3 --Add user groups that are allowed to use this tree. If anyone is allowed, set this to FALSE ( TREE.UserGroups = false ) TREE.JobRestricted = { "TEAM_SORCIER" } TREE.Tier[1] = {} TREE.Tier[1][1] = { Name = "Canalisation", Description = "Canalisez votre haine", Icon = "wos/skilltrees/ravager/channel.png", PointsRequired = 1, Requirements = {}, LockOuts = {}, OnPlayerSpawn = function( ply ) end, OnPlayerDeath = function( ply ) end, OnSaberDeploy = function( wep ) wep:AddForcePower( "Canalisation" ) end, } TREE.Tier[1][2] = { Name = "Saut de Force", Description = "Canalisez la Force dans vos jambes pour sauter plus haut et plus loin", Icon = "wos/forceicons/leap.png", PointsRequired = 1, Requirements = {}, LockOuts = {}, OnPlayerSpawn = function( ply ) end, OnPlayerDeath = function( ply ) end, OnSaberDeploy = function( wep ) wep:AddForcePower( "Saut De Force" ) end, } TREE.Tier[2][1] = { Name = "Attraction de Force", Description = "Ramenez l'ennemis vers vous grâce à la Force", Icon = "wos/forceicons/pull.png", PointsRequired = 2, Requirements = { [1] = { 1 , 2 } }, LockOuts = {}, OnPlayerSpawn = function( ply ) end, OnPlayerDeath = function( ply ) end, OnSaberDeploy = function( wep ) wep:AddForcePower( "Attraction De Force" ) end, } TREE.Tier[2][2] = { Name = "Pousée de Force", Description = "Poussez l'ennemis grâce à la Force", Icon = "wos/forceicons/push.png", PointsRequired = 2, Requirements = { [1] = { 1 , 2 } }, LockOuts = {}, OnPlayerSpawn = function( ply ) end, OnPlayerDeath = function( ply ) end, OnSaberDeploy = function( wep ) wep:AddForcePower( "Pousée De Force" ) end, } TREE.Tier[2][3] = { Name = "Répulsion de Force", Description = "Pousse les ennemis autour de vous grâce à la Force", Icon = "wos/forceicons/repulse.png", PointsRequired = 2, Requirements = { [1] = { 1 , 2 } }, LockOuts = {}, OnPlayerSpawn = function( ply ) end, OnPlayerDeath = function( ply ) end, OnSaberDeploy = function( wep ) wep:AddForcePower( "Répulsion De Force" ) end, } TREE.Tier[3][1] = { Name = "Éclair de Force", Description = "Torture les personnes et monstres à volonté.", Icon = "wos/forceicons/lightning.png", PointsRequired = 3, Requirements = { [2] = { 1 , 2 , 3 } }, LockOuts = {}, OnPlayerSpawn = function( ply ) end, OnPlayerDeath = function( ply ) end, OnSaberDeploy = function( wep ) wep:AddForcePower( "Éclair De Force" ) end, }
function onCreate() makeLuaSprite('chica1', 'chica1', -550, -500); setLuaSpriteScrollFactor('chica1', 1, 1); scaleObject('chica1', 1.5, 1.5); addLuaSprite('chica1', false); close(true); end
local lines = {} for line in (s .. "\n"):gmatch("(.-)\n") do local this = {} for word in line:gmatch("%S+") do table.insert(this, 1, word) end lines[#lines + 1] = table.concat(this, " ") end print(table.concat(lines, "\n"))
local _, private = ... if private.isClassic then return end --[[ Lua Globals ]] -- luacheck: globals --[[ Core ]] local Aurora = private.Aurora local Base, Skin = Aurora.Base, Aurora.Skin --do --[[ AddOns\Blizzard_Contribution.lua ]] --end --do --[[ AddOns\Blizzard_Contribution.xml ]] --end function private.AddOns.Blizzard_Contribution() if not private.disabled.tooltips then Skin.GameTooltipTemplate(_G.ContributionTooltip) Skin.InternalEmbeddedItemTooltipTemplate(_G.ContributionTooltip.ItemTooltip) Skin.TooltipBorderedFrameTemplate(_G.ContributionBuffTooltip) Base.CropIcon(_G.ContributionBuffTooltip.Icon, _G.ContributionBuffTooltip) _G.ContributionBuffTooltip.Border:Hide() end end
local json = require("cjson") local pg = require("resty.postgres") -------------------------------- -- LIBRARIES -------------------------------- function exit_now(status, msg) if status ~= ngx.HTTP_OK then ngx.status = status end if msg then ngx.say(json.encode(msg)) end local request_time = (ngx.now() - ngx.req.start_time()) ngx.log(ngx.INFO, "request time: " .. tostring(request_time)) ngx.exit(ngx.HTTP_OK) end function exit(status, msg) if status then exit_now(status, msg) end exit_now(ngx.HTTP_OK, msg) end ------------- -- MAIN ------------- ngx.header.content_type = 'application/json'; local db = pg:new() db:set_timeout(3000) local ok, err = db:connect({host="127.0.0.1",port=5432, database=ngx.var.db_database, user=ngx.var.db_user,password=ngx.var.db_pass,compact=false}) if not ok then ngx.say(err) end local res, err = db:query("SELECT loc_id, loc_name, ST_AsGeoJSON(geog)::json as loc_json FROM locations;") db:set_keepalive(0, 10) local r = {} if not err then for i,v in ipairs(res) do r[v.loc_id] = { [v.loc_name] = v.loc_json } end ngx.say(json.encode(r)) exit() end ngx.say(err) exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
-- options require('options') -- packages require('pack') -- mappings require('mappings') -- plugins require('plugins.setups') require('plugins.compe') require('plugins.emmet') require('plugins.gitblame') require('plugins.gitsigns') require('plugins.hardline') require('plugins.lspconfig') require('plugins.nord') require('plugins.prettier') require('plugins.rust') require('plugins.telescope') require('plugins.toggleterm') require('plugins.treesitter') require('plugins.vimwiki') require('plugins.vsnip')
size = {64, 64} addSearchPath(sasl.getXPlanePath ().."/Resources/bitmaps/interface") local bg = sasl.gl.loadImage("KLNpopup.dds", 0, 0, 64, 64) --defineProperty("KLN90popupvisible", globalPropertyi("sim/custom/xap/KLN90pop/visible")) --defineProperty("MD41visible", globalPropertyi("sim/custom/xap/MD41/visible")) --defineProperty("KLN90visible", globalPropertyi("sim/custom/xap/KLN90/visible")) components = { texture { position = {0, 0, size[1], size[2]}, image = get(bg), }, clickable { position = {0, 28, 64, 26 }, cursor = { x = -15.5, y = -16.5, width = 31, height = 33, shape = sasl.gl.loadImage("mc_button.png"), hideOSCursor = true }, onMouseDown = function() KLN90B:setIsVisible(not KLN90B:isVisible ()) return false end, }, clickable { position = {0, 0, 64, 26 }, cursor = { x = -15.5, y = -16.5, width = 31, height = 33, shape = sasl.gl.loadImage("mc_button.png"), hideOSCursor = true }, onMouseDown = function() MD41:setIsVisible(not MD41:isVisible ()) return false end, } }
--[=[ Represents a cooldown state with a time limit. See [CooldownBase] for more API. @server @class Cooldown ]=] local require = require(script.Parent.loader).load(script) local CooldownBase = require("CooldownBase") local TimeSyncService = require("TimeSyncService") local CooldownConstants = require("CooldownConstants") local AttributeUtils = require("AttributeUtils") local Cooldown = setmetatable({}, CooldownBase) Cooldown.ClassName = "Cooldown" Cooldown.__index = Cooldown --[=[ Constructs a new cooldown. Should be done via [CooldownBindersServer]. To create an instance of this in Roblox, see [CooldownUtils.create]. @param obj NumberValue @param serviceBag ServiceBag @return Cooldown ]=] function Cooldown.new(obj, serviceBag) local self = setmetatable(CooldownBase.new(obj, serviceBag), Cooldown) self._serviceBag = assert(serviceBag, "No serviceBag") local now = self._serviceBag:GetService(TimeSyncService):GetSyncedClock():GetTime() local startTime = AttributeUtils.initAttribute(self._obj, CooldownConstants.COOLDOWN_START_TIME_ATTRIBUTE, now) -- Delay for cooldown time -- TODO: Handle start tme changing task.delay(self._obj.Value + startTime - now, function() if self.Destroy then self._obj:Destroy() end end) return self end return Cooldown
local I18N = require("core.I18N") I18N.add_data_text( "core.buff", { holy_shield = { name = "Holy Shield", apply = "{name($1)} begin{s($1)} to shine.", description = "Increases PV by {$1} /RES+ fear", }, mist_of_silence = { name = "Mist of Silence", apply = "{name($1)} get{s($1)} surrounded by hazy mist.", description = "Inhibits casting", }, regeneration = { name = "Regeneration", apply = "{name($1)} start{s($1)} to regenerate.", description = "Enhances regeneration", }, elemental_shield = { name = "Elemental Shield", apply = "{name($1)} obtain{s($1)} resistance to element.", description = "RES+ fire,cold,lightning", }, speed = { name = "Speed", apply = "{name($1)} speed{s($1)} up.", description = "Increases speed by {$1}", }, slow = { name = "Slow", apply = "{name($1)} slow{s($1)} down.", description = "Decreases speed by {$1}", }, hero = { name = "Hero", apply = "{name($1)} feel{s($1)} heroic.", description = "Increases STR,DEX by {$1} /RES+ fear,confusion", }, mist_of_frailness = { name = "Mist of Frailness", apply = "{name($1)} feel{s($1)} weak.", description = "Halves DV and PV", }, element_scar = { name = "Element Scar", apply = "{name($1)} lose{s($1)} resistance to element.", description = "RES- fire,cold,lightning", }, holy_veil = { name = "Holy Veil", apply = "{name($1)} receive{s($1)} holy protection.", description = "Grants hex protection(power:{$1})", }, nightmare = { name = "Nightmare", apply = "{name($1)} start{s($1)} to suffer.", description = "RES- mind,nerve", }, divine_wisdom = { name = "Divine Wisdom", apply = "{name($1)} start{s($1)} to think clearly.", description = "Increases LER,MAG by {$1}, literacy skill by {$2}", }, punishment = { name = "Punishment", apply = "{name($1)} incur{s($1)} the wrath of God.", description = "Decreases speed by {$1}, PV by {$2}%", }, lulwys_trick = { name = "Lulwy's Trick", apply = "{name($1)} repeat{s($1)} the name of Lulwy.", description = "Increases speed by {$1}", }, incognito = { name = "Incognito", apply = "{name($1)} start{s($1)} to disguise.", description = "Grants new identity", }, death_word = { name = "Death Word", apply = "{name($1)} receive{s($1)} death verdict.", description = "Guaranteed death when the hex ends", }, boost = { name = "Boost", apply = "{name($1)} gain{s($1)} massive power.", description = "Increases speed by {$1}/Boosts physical attributes", }, contingency = { name = "Contingency", apply = "{name($1)} set{s($1)} up contracts with the Reaper.", description = "{$1}% chances taking a lethal damage heals you instead", }, luck = { name = "Luck", apply = "{name($1)} feel{s($1)} very lucky today!", description = "Increases luck by {$1}.", }, grow_strength = { name = "Grow Strength", apply = "{name($1)} feel{s($1)} rapid STR growth.", description = "Increases the growth rate Strength by {$1}", }, grow_constitution = { name = "Grow Constitution", apply = "{name($1)} feel{s($1)} rapid CON growth.", description = "Increases the growth rate Constitution by {$1}", }, grow_dexterity = { name = "Grow Dexterity", apply = "{name($1)} feel{s($1)} rapid DEX growth.", description = "Increases the growth rate Dexterity by {$1}", }, grow_perception = { name = "Grow Perception", apply = "{name($1)} feel{s($1)} rapid PER growth.", description = "Increases the growth rate Perception by {$1}", }, grow_learning = { name = "Grow Learning", apply = "{name($1)} feel{s($1)} rapid LER growth.", description = "Increases the growth rate Learning by {$1}", }, grow_will = { name = "Grow Will", apply = "{name($1)} feel{s($1)} rapid WIL growth.", description = "Increases the growth rate Will by {$1}", }, grow_magic = { name = "Grow Magic", apply = "{name($1)} feel{s($1)} rapid MAG growth.", description = "Increases the growth rate Magic by {$1}", }, grow_charisma = { name = "Grow Charisma", apply = "{name($1)} feel{s($1)} rapid CHR growth.", description = "Increases the growth rate Charisma by {$1}", }, grow_speed = { name = "Grow Speed", apply = "{name($1)} feel{s($1)} rapid SPD growth.", description = "Increases the growth rate Speed by {$1}", }, grow_luck = { name = "Grow Luck", apply = "{name($1)} feel{s($1)} rapid LCK growth.", description = "Increases the growth rate Luck by {$1}", }, } )
local base_app = require 'app.base' local event = require 'app.event' local app = base_app:subclass("FREEIOE_DATA_SIM_APP") app.static.API_VER = 4 function app:initialize(name, sys, conf) base_app.initialize(self, name, sys, conf) end function app:on_start() local inputs = { { name = 'count', desc = 'Event count', vt = 'int' } } local commands = { { name = 'trigger', desc = 'Trigger an event now' } } local meta = self._api:default_meta() meta.name = "Event Simulation" meta.description = "Event Simulation device" meta.series = "X" local dev_sn = self._sys:id()..'.'..self._name self._dev = self._api:add_device(dev_sn, meta, inputs, nil, commands) self._count = 0 self._dev:set_input_prop('count', 'value', self._count) return true end function app:on_command(app_src, sn, command, param, priv) if command ~= 'trigger' then return nil, "Command not supported!" end self._count = self._count + 1 self._dev:set_input_prop('count', 'value', self._count) local data = { gateway = self._sys:id(), count = self._count, time=os.date() } self._dev:fire_event(event.LEVEL_INFO, event.EVENT_APP, 'Triggered Event', data) return true end return app
local function gen_trigger_menu(event) local res = { { name = "add", hidden = true, label = "Add", description = "Add a new trigger event", kind = "value", validator = function(val) if #val == 0 or not string.find(val, "=") then return; end end, handler = function(val) local wnd = active_display().selected; wnd:add_handler(event, function(wnd) dispatch_symbol_wnd(wnd, val); end); wnd.trigger_log = wnd.trigger_log and wnd.trigger_log or {}; table.insert(wnd.trigger_log, {#wnd.trigger_log, event, path}); end }, { name = "bind", label = "Bind", description = "Bind a path to the " .. event .. " trigger", kind = "action", interactive = true, handler = function() dispatch_symbol_bind( function(path) if (not path or #path == 0) then return; end local wnd = active_display().selected; wnd:add_handler(event, function(wnd) dispatch_symbol_wnd(wnd, path); end); wnd.trigger_log = wnd.trigger_log and wnd.trigger_log or {}; table.insert(wnd.trigger_log, {#wnd.trigger_log, event, path}); end); end, } }; local wnd = active_display().selected; if (not wnd.trigger_log) then return res; end for i, v in ipairs(wnd.trigger_log) do table.insert(res, { name = "remove_" .. tostring(i), label = tostring(i), description = "Remove " .. v[3], kind = "action", handler = function() wnd:drop_handler(v[2], v[3]); table.remove(wnd.trigger_log, i); end, }); end return res; end return { { name = "select", kind = "action", label = "Select", submenu = true, description = "Triggered when the window is selected/focused", handler = function() return gen_trigger_menu("select"); end }, { name = "deselect", kind = "action", label = "Deselect", submenu = true, description = "Triggered when the window is deselected/defocused", handler = function() return gen_trigger_menu("deselect"); end }, { name = "destroy", kind = "action", label = "Destroy", submenu = true, description = "Triggered just before the window is destroyed", handler = function() return gen_trigger_menu("destroy"); end } };
-- Copyright (C) 2011 - 2013 David Reid. See included LICENCE file. function GTGUI.Element:TextEditor(_internalPtr) self:SubEditor(_internalPtr); self.TextBox = GTGUI.Server.CreateElement(self, "text-editor-textbox"); self.TextBox:MultiLineTextBox(); self.Panel = GTGUI.Server.CreateElement(self, "text-editor-panel"); self.Panel:TextEditorPanel(self); function self:OnErrorSelected(lineNumber, message) self.TextBox:GoToLine(lineNumber); end return self; end
if not nyagos then print("This is a script for nyagos not lua.exe") os.exit() end nyagos.on_command_not_found = function(args) nyagos.writerr(args[0]..": コマンドではない。\n") return true end local cd = nyagos.alias.cd nyagos.alias.cd = function(args) local success=true for i=1,#args do local dir=args[i] if dir:sub(1,1) ~= "-" and not dir:match("%.[lL][nN][kK]$") and not dir:match("^[a-zA-Z]:[/\\]$") and not dir:match("^[/\\]$") and dir ~= ".." and dir ~= "." then local stat = nyagos.stat(dir) if not stat or not stat.isdir then nyagos.writerr(dir..": ディレクトリではない。\n") success = false end end end if success then if cd then cd(args) else args[0] = "__cd__" nyagos.exec(args) end end end -- vim:set fenc=utf8 --
local CONFIG = require(script.Parent:WaitForChild("Configuration")) local MouseRay = {} do local Ray = Ray.new local CFrame = CFrame.new local Camera = workspace.CurrentCamera local cache = {nil, CFrame()} MouseRay.new = function(position, targetFilter) local newRay = Camera:ScreenPointToRay(position.X, position.Y) do newRay = Ray(newRay.Origin, newRay.Direction * CONFIG.RaycastDistance) end cache = {workspace:FindPartOnRayWithIgnoreList(newRay, targetFilter)} cache[3] = newRay.Unit.Direction end MouseRay.getCFrame = function() return CFrame(cache[2], cache[3]) end MouseRay.getTarget = function() return cache[1] end end return MouseRay
return { enchantment = { it = function(desc) return ("それは%s"):format(desc) end, item_ego = { major = { elona = { silence = function(_1) return ("静寂の%s"):format(_1) end, res_blind = function(_1) return ("耐盲目の%s"):format(_1) end, res_confuse = function(_1) return ("耐混乱の%s"):format(_1) end, fire = function(_1) return ("烈火の%s"):format(_1) end, cold = function(_1) return ("氷結の%s"):format(_1) end, lightning = function(_1) return ("稲妻の%s"):format(_1) end, healer = function(_1) return ("癒し手の%s"):format(_1) end, res_paralyze = function(_1) return ("耐麻痺の%s"):format(_1) end, res_fear = function(_1) return ("耐恐怖の%s"):format(_1) end, res_sleep = function(_1) return ("睡眠防止の%s"):format(_1) end, defender = function(_1) return ("防衛者の%s"):format(_1) end, } }, minor = { elona = { singing = function(_1) return ("唄う%s"):format(_1) end, servants = function(_1) return ("召使の%s"):format(_1) end, followers = function(_1) return ("従者の%s"):format(_1) end, howling = function(_1) return ("呻く%s"):format(_1) end, glowing = function(_1) return ("輝く%s"):format(_1) end, conspicuous = function(_1) return ("異彩の%s"):format(_1) end, magical = function(_1) return ("魔力を帯びた%s"):format(_1) end, enchanted = function(_1) return ("闇を砕く%s"):format(_1) end, mighty = function(_1) return ("強力な%s"):format(_1) end, trustworthy = function(_1) return ("頼れる%s"):format(_1) end, } } }, level = "*", with_parameters = { ammo = { max = function(_1) return ("[最大%s発]") :format(_1) end, text = function(_1) return ("%sを装填できる") :format(_1) end }, attribute = { in_food = { decreases = function(_1) return ("%sを減衰させる毒素を含んでいる") :format(_1) end, increases = function(_1) return ("%sを増強させる栄養をもっている") :format(_1) end }, other = { decreases = function(_1, _2) return ("%sを%s下げる") :format(_1, _2) end, increases = function(_1, _2) return ("%sを%s上げる") :format(_1, _2) end } }, extra_damage = function(_1) return ("%s属性の追加ダメージを与える") :format(_1) end, invokes = function(_1) return ("%sを発動する") :format(_1) end, resistance = { decreases = function(_1) return ("%sへの耐性を弱化する") :format(_1) end, increases = function(_1) return ("%sへの耐性を授ける") :format(_1) end }, skill = { decreases = function(_1) return ("%sの技能を下げる") :format(_1) end, increases = function(_1) return ("%sの技能を上げる") :format(_1) end }, skill_maintenance = { in_food = function(_1) return ("%sの成長を助ける栄養をもっている") :format(_1) end, other = function(_1) return ("%sを維持する") :format(_1) end } } } }
local util = require("tokyonight.util") local M = {} ---@param config Config ---@return ColorScheme function M.setup(config) config = config or require("tokyonight.config") -- Color Palette ---@class ColorScheme local colors = {} colors = { none = "NONE", white = "#eeeeee", bg_dark = "#1f2335", bg = "#24283b", bg_highlight = "#292e42", terminal_black = "#414868", fg = "#c0caf5", fg_dark = "#a9b1d6", fg_gutter = "#3b4261", dark3 = "#545c7e", comment = "#565f89", dark5 = "#737aa2", blue = "#7aa2f7", blue0 = "#3d59a1", cyan = "#7dcfff", blue1 = "#2ac3de", blue2 = "#0db9d7", blue5 = "#89ddff", blue6 = "#B4F9F8", blue7 = "#394b70", magenta = "#bb9af7", purple = "#9d7cd8", orange = "#ff9e64", yellow = "#e0af68", rblue0 = "#000087", rblue1 = "#005fff", rblue2 = "#87d7ff", rblue3 = "#87ffff", rpurple0 = "#800080", rpurple1 = "#5f00af ", rpurple2 = "#8787d7", -- ryellow0 = "" -- ryellow1 = "" -- ryellow2 = "" -- ryellow3 = "" green = "#9ece6a", green1 = "#73daca", green2 = "#41a6b5", teal = "#1abc9c", --blue = "#0000ac", --blue1 = "#0000bd", --blue2 = "#0000cf", --indigo = "#0000dd", red = "#f7768e", red1 = "#db4b4b", git = { change = "#6183bb", add = "#449dab", delete = "#914c54", conflict = "#bb7a61" }, gitSigns = { add = "#164846", change = "#394b70", delete = "#823c41" }, } if config.style == "night" or config.style == "day" or vim.o.background == "light" then colors.bg = "#1a1b26" end util.bg = colors.bg util.day_brightness = config.dayBrightness colors.diff = { add = util.darken(colors.green2, 0.15), delete = util.darken(colors.red1, 0.15), change = util.darken(colors.blue7, 0.15), text = colors.blue7, } colors.gitSigns = { add = util.brighten(colors.gitSigns.add, 0.2), change = util.brighten(colors.gitSigns.change, 0.2), delete = util.brighten(colors.gitSigns.delete, 0.2), } colors.git.ignore = colors.dark3 colors.black = util.darken(colors.bg, 0.8, "#000000") colors.border_highlight = colors.blue0 colors.border = colors.black -- Popups and statusline always get a dark background colors.bg_popup = colors.bg_dark colors.bg_statusline = colors.bg_dark -- Sidebar and Floats are configurable colors.fg_sidebar = colors.fg_dark colors.bg_sidebar = config.darkSidebar and colors.bg_dark or colors.bg colors.bg_float = config.darkFloat and colors.bg_dark or colors.bg colors.bg_visual = util.darken(colors.blue0, 0.7) colors.search = colors.orange colors.bg_search = colors.blue0 colors.todo = colors.yellow colors.error = colors.red1 colors.warning = colors.yellow colors.info = colors.blue2 colors.hint = colors.teal colors.directory = colors.blue colors.folded = colors.blue colors.substitute = colors.red colors.cursorlinenr = colors.dark5 colors.moremsg = colors.blue colors.question = colors.blue colors.string = colors.white colors.character = colors.green colors.keyword = colors.red colors.nontext = colors.dark3 colors.specialkey = colors.dark3 colors.preproc = colors.blue colors.title = colors.blue colors.func = colors.rblue2 colors.type = colors.blue1 colors.special = colors.blue1 colors.operator = colors.blue5 colors.statement = colors.magenta colors.identifier = colors.magenta colors.matchparen = colors.orange colors.constant = colors.yellow colors.tsparameter = colors.rblue3 colors.tsoperator = colors.tsoperator colors.tsconstructor = colors.magenta colors.tsfield = colors.green1 colors.tskeyword = colors.purple colors.tskeywordfunction = colors.magenta colors.tslabel = colors.blue colors.tsproperty = colors.green1 colors.tspunctdelimiter = colors.blue5 colors.tspunctbracket = colors.fg_dark colors.tspunctspecial = colors.blue5 colors.tsstringregex = colors.blue6 colors.tsstringescape = colors.magenta colors.tsvariablebuiltin = colors.red colors.tstextreference = colors.red util.color_overrides(colors, config) if config.transform_colors and (config.style == "day" or vim.o.background == "light") then return util.light_colors(colors) end return colors end return M
Menu = Class("Menu") function Menu:init() self.state = 'home' self.music = love.audio.newSource("music/menu.wav", "stream") self.music:setLooping(true) self.dress = suit.new() self.dress.theme.color = { normal = {bg = rgb{54, 194, 244}, fg = rgb{255, 255, 255}}, hovered = {bg = rgb{64, 204, 254}, fg = rgb{255, 255, 255}}, active = {bg = rgb{89, 225, 270}, fg = rgb{233, 247, 252}} } self.dress.theme.cornerRadius = 10 self.width = 386 self.height = 100 -- y positioning of credits for animation self.creditsY = WINDOW_HEIGHT self.creditsTween = tween.new(10, self, {creditsY=-500}) self.menuX = WINDOW_WIDTH / 2 - 80 self.menuTY = WINDOW_HEIGHT / 4 self.vsync_checkbox = {checked = appdata.vsync == 1 and true or false} end function Menu:resize(w, h) self.creditsY = h self.menuX = w / 2 - 80 self.menuTY = h / 4 end function Menu:setPrevious(func) self.toPrevious = func end function Menu:getChildPath() local segments = split(self.state, '/') if #segments <= 1 then return 'home' else table.remove(segments, #segments) return table.concat(segments, '/') end end function Menu:gotoPrevious() if self.toPrevious then self.toPrevious() else self.state = self:getChildPath() end end function Menu:isState(state, type) type = type or 'home' local segments = split(state, '/') if segments[1] ~= type then table.insert(segments, 1, type) end local path = table.concat(segments, '/') return path == self.state end function Menu:pushState(child) self.state = self.state .. '/' .. child end function Menu:popState() self:gotoPrevious() end function Menu:create_widgets(options, widget, dress) -- lots of stuff in here dress = dress or self.dress options = options or {} options.tx = options.tx or options.x or 0 options.ty = options.ty or options.y or 0 options.width = options.width or self.width options.height = options.height or self.height options.params = options.params or options.labels or {''} options.options = options.options or {} options.ex = options.ex or WINDOW_WIDTH options.ey = options.ey or WINDOW_HEIGHT -- distancing the widgets between each other for padding options.px = options.px or (options.ex - options.tx) / #options.params options.py = options.py or (options.ey - options.ty) / #options.params -- offset distance for widgets if specified options.ox = options.ox or options.xOffset or 0 options.oy = options.oy or options.yOffset or 0 local widgets = {} options.align = options.align or options.alignment local align = split(options.align, ' ') local haligns = {'left', 'center', 'right'} local valigns = {'top', 'center', 'bottom'} if table.find(haligns, align[1]) then options.halign = align[1] if table.find(valigns, align[2]) then options.valign = align[2] end elseif table.find(haligns, align[2]) then options.halign = align[2] if table.find(valigns, align[1]) then options.valign = align[1] end end options.halign = options.halign or align[1] options.valign = options.valign or align[2] if options.align == "center" then options.valign = "center" end -- alignment on x and y axes if options.halign == "center" then options.tx = options.ex / 2 - options.width / 2 + options.px elseif options.halign == "left" then options.tx = 0 elseif options.halign == "right" then options.tx = options.ex - ((options.width + options.px / 2) * #options.params) + options.px / 2 end if options.valign == "center" then options.ty = options.ey / 2 - ((options.height + options.py / 2) * #options.params) / 2 + options.py elseif options.valign == "top" then options.ty = 0 elseif options.valign == "bottom" then options.ty = options.ey - ((options.height + options.py / 2) * #options.params) + options.py / 2 end options.tx = math.min(options.tx, options.ex) options.ty = math.min(options.ty, options.ey) -- reset layout with values dress.layout:reset(options.tx, options.ty, options.px / 2, options.py / 2) local row = 0 local x, y, w, h --local maxHorizontal = #options.params // ((options.height + options.py) * #options.params) if type(widget) == "string" then if string.lower(widget) == "button" then widget = dress.Button elseif string.lower(widget) == "label" then widget = dress.Label end elseif type(widget) == "table" then if getmetatable(widget) then widget = widget end end if not widget then error("Invalid widget: " .. widget) return end for i, v in ipairs(options.params) do x, y, w, h = dress.layout:row(options.width, options.height) if y >= options.ey then row = 1 else row = row + 1 end widgets[v] = widget(dress, v, table.copy(options.options), x + options.ox * i, y + options.oy * i, w, h) end return widgets end function Menu:create_buttons(options, dress) dress = dress or self.dress return self:create_widgets(options, dress.Button) end function Menu:create_labels(options, dress) dress = dress or self.dress return self:create_widgets(options, dress.Label) end function Menu:display_credits() if (self.creditsTween == nil) and self:isState('credits') then self.creditsTween = tween.new(10, self, {creditsY=-500}) end applyFont(mediumFont) local scale = 1.25 love.graphics.printf(CREDITS, self.menuX, self.creditsY, WINDOW_WIDTH - self.menuX, "center", 0, scale, scale) removeFont() end function Menu:display(dt) applyFont(coolFont) self.music:setVolume(appdata.MASTER_VOLUME * appdata.MENU_VOLUME) if self:isState('home') then buttons = self:create_buttons{ x = self.menuX, y = self.menuTY, params = { "Play", "Options", "Credits", "Quit" }, width = self.width, height = self.height, align='center', py = 50 } if buttons["Play"].hit then self:pushState('play') end if buttons["Options"].hit then self:pushState('options') end if buttons["Credits"].hit then self:pushState('credits') end if buttons["Quit"].hit then love.event.quit() end elseif self:isState('home/credits') then -- updates the credits tween and resets when done if self.creditsTween then if self.creditsTween:update(dt) then self.creditsTween = nil self.creditsY = WINDOW_HEIGHT end end local text = "Back" local x = self.menuX + (WINDOW_WIDTH - self.menuX) / 2 - (coolFont:getWidth(text) / 2) local back_button = self.dress:Button(text, x, self.menuTY + 450, 300, 75) if back_button.hit then self:popState() end elseif self:isState('home/options') then buttons = self:create_buttons{ x = self.menuX, y = self.menuTY, params = { "Audio", "Video", "Controls", "Back" }, width = self.width, height = self.height, align='center', py = 50 } if buttons["Audio"].hit then self:pushState('audio') end if buttons["Video"].hit then self:pushState('video') end if buttons["Controls"].hit then self:pushState('controls') end if buttons["Back"].hit then self:popState() end elseif self:isState('home/options/audio') then local px, py, tx, ty local ex = WINDOW_WIDTH local ey = WINDOW_HEIGHT px = (ex - self.menuX) / 8 py = (ey - self.menuTY) / 5 tx = ex / 2 - self.width / 2 + px * 2 ty = ey / 2 - ((self.height + py / 2) * 6) / 2 + py * 2 tx = math.min(tx, ex) ty = math.min(ty, ey) -- audio settigns self.dress.layout:reset(tx, ty, px / 4, py / 8) -- label with slider beneath for master volume print("the appdata mv is", appdata.MASTER_VOLUME) master_label = self.dress:Label("Master", self.dress.layout:row(self.width, 30)) master_slider = {min=0, max=1, step=0.1, value=appdata.MASTER_VOLUME} self.dress:Slider(master_slider, self.dress.layout:row()) appdata.MASTER_VOLUME = round(master_slider.value, 1) -- adding a new blank row self.dress.layout:down() -- new label and slider for menu volume on a new row menu_label = self.dress:Label("Menu", self.dress.layout:row()) menu_slider = {min=0, max=1, step=0.1, value=appdata.MENU_VOLUME} self.dress:Slider(menu_slider, self.dress.layout:row()) appdata.MENU_VOLUME = round(menu_slider.value, 1) -- another blank row self.dress.layout:down() -- another label and slider for game volume on the next row game_label = self.dress:Label("Game", self.dress.layout:row()) game_slider = {min=0, max=1, step=0.1, value=appdata.GAME_VOLUME} self.dress:Slider(game_slider, self.dress.layout:row()) appdata.GAME_VOLUME = round(game_slider.value, 1) -- ANOTHER blank row self.dress.layout:down() back_button = self.dress:Button("Back", self.dress.layout:row(self.width, self.height)) -- back button that goes to previous menu state if back_button.hit then self:popState() end elseif self:isState('home/options/video') then local px, py, tx, ty local ex = WINDOW_WIDTH local ey = WINDOW_HEIGHT px = (ex - self.menuX) / 10 py = (ey - self.menuTY) / 5 tx = ex / 2 - self.width / 2 + px * 2 ty = ey / 2 - ((self.height + py / 2) * 6) / 2 + py * 2 tx = math.min(tx, ex) ty = math.min(ty, ey) -- audio settigns -- video settings self.dress.layout:reset(self.menuX + 50, self.menuTY) self.dress.layout:reset(tx, ty, px / 4, py / 8) -- vsync self.dress:Label("Enable Vsync", self.dress.layout:row(250, 50)) self.dress:Checkbox(self.vsync_checkbox, self.dress.layout:col()) -- set the window vsync to the value of the checkbox appdata.vsync = self.vsync_checkbox.checked and 1 or 0 self.dress.layout:left() -- Window mode self.dress:Label("Window Mode", self.dress.layout:row()) local windowmode_label = self.dress:Button(appdata.windowmode, {font=largeFont, valign="top"}, self.dress.layout:col(225, string.len(appdata.windowmode) > 10 and 90 or 40)) local wm = table.find(windowmodes, appdata.windowmode, true) -- search case-insensitively --[[ in the event of the window mode not being found, set it to the first window mode]] if not wm then wm = 1 end if windowmode_label.hit then -- if hit then increase the window mode index wm = wm + 1 --[[if it has reached past the amount of windowmodes then it needs to cycle back]] if wm > #windowmodes then wm = 1 elseif wm < 1 then wm = #windowmodes end appdata.windowmode = windowmodes[wm] end local apply_button = self.dress:Button("Apply", tx + 250, self.menuTY + 400, 100, 35) if apply_button.hit then love.window.setVSync(appdata.vsync) update_window() end -- and another back button local back_button = self.dress:Button("Back", tx + 75, self.menuTY + 450, 300, 75) if back_button.hit then self:popState() end elseif self:isState('home/options/controls') then controls_display:display( self.menuX, self.menuTY, 175, 40, 150, self.menuTY + 420 ) end removeFont() end function Menu:render() if self:isState('credits') then self:display_credits() end self.dress:draw() local x = WINDOW_WIDTH / 2 - 140 love.graphics.setColor(rgb{213, 217, 222, 112}) love.graphics.line(x, 0, x, WINDOW_HEIGHT) love.graphics.setColor(1, 1, 1, 1) love.graphics.line(self.menuX - 10, self.menuTY, self.menuX + 10, self.menuTY) love.graphics.line(self.menuX, self.menuTY - 10, self.menuX, self.menuTY + 10) love.graphics.print("(x, ty)", self.menuX - 52, self.menuTY - 32, 0, 2, 2) end function Menu:update(dt) self:display(dt) end
print "HTTP/1.1 200 OK" print "Cache-Control: private, no-store, no-cache, must-revalidate" print "" fa.control("fioset", 0) print("WiFi turned off. Remove card and reinsert to restore.")
if select(2, UnitClass("player")) ~= "WARLOCK" then return end local mod = DBM:NewMod("d594", "DBM-Scenario-MoP") local L = mod:GetLocalizedStrings() mod:SetRevision(("$Revision: 2 $"):sub(12, -3)) mod:SetZone() mod:RegisterCombat("scenario", 1112) mod:RegisterEventsInCombat( "SPELL_CAST_START", "SPELL_CAST_SUCCESS", "SPELL_AURA_APPLIED", "SPELL_AURA_REMOVED", "SPELL_PERIODIC_DAMAGE", "CHAT_MSG_MONSTER_YELL", "UNIT_DIED" ) mod.onlyNormal = true --Essence of Order local warnSpellFlame = mod:NewSpellAnnounce(134234, 3) local warnHellfire = mod:NewSpellAnnounce(134225, 3) --Kanrethad Ebonlocke local warnSummonPitLord = mod:NewCastAnnounce(138789, 4, 10) local warnSummonImpSwarm = mod:NewCastAnnounce(138685, 3, 10) local warnSummonDoomlord = mod:NewCastAnnounce(138755, 3, 10) local warnSummonFelhunter = mod:NewCastAnnounce(138751, 3, 10) --Essence of Order local specWarnSpellFlame = mod:NewSpecialWarningMove(134234) local specWarnHellfire = mod:NewSpecialWarningInterrupt(134225) local specWarnLostSouls = mod:NewSpecialWarning("specWarnLostSouls", nil, nil, nil, 2) --Kanrethad Ebonlocke local specWarnEnslavePitLord = mod:NewSpecialWarning("specWarnEnslavePitLord") local specWarnCataclysm = mod:NewSpecialWarningInterrupt(138564) local specWarnRainOfFire = mod:NewSpecialWarningMove(138561) local specWarnChaosBolt = mod:NewSpecialWarningInterrupt(138559, nil, nil, nil, 3) --Essence of Order --Todo, maybe register COMBAT_REGEN_DISABLED and check warlocks target (basically what dbm core normally does) for combat start timers? local timerSpellFlameCD = mod:NewNextTimer(11, 134234)--(6 seconds after engage) local timerHellfireCD = mod:NewNextTimer(33, 134225)--(15 after engage) local timerLostSoulsCD = mod:NewTimer(43, "timerLostSoulsCD", 51788)--43-50 second variation. (engage is same as cd, 43) --Kanrethad Ebonlocke local timerCombatStarts = mod:NewCombatTimer(33)--Honestly i'm tired of localizing this, but last time i tried to add a generic "NewCombatTimer" it didn't work, at all. Maybe someone else can do this, since we have about 20 mods that could use it local timerPitLordCast = mod:NewCastTimer(10, 138789) local timerSummonImpSwarmCast = mod:NewCastTimer(10, 138685) local timerSummonFelhunterCast = mod:NewCastTimer(9, 138751) local timerSummonDoomlordCast = mod:NewCastTimer(10, 138755) local timerEnslaveDemon = mod:NewTargetTimer(300, 1098) local timerDoom = mod:NewBuffFadesTimer(419, 138558) local countdownDoom = mod:NewCountdownFades(419, 138558, nil, nil, 10) mod:RemoveOption("HealthFrame") local kanrathadAlive = true--So we don't warn to enslave pit lord when he dies and enslave fades. function mod:SPELL_CAST_START(args) if args.spellId == 134234 then warnSpellFlame:Show() specWarnSpellFlame:Show() timerSpellFlameCD:Start() elseif args.spellId == 134225 then warnHellfire:Show() specWarnHellfire:Show(args.sourceName) timerHellfireCD:Start() elseif args.spellId == 138559 then specWarnChaosBolt:Show() end end function mod:SPELL_CAST_SUCCESS(args) if args.spellId == 138680 then timerCombatStarts:Start() kanrathadAlive = true--Reset this here elseif args.spellId == 138789 then warnSummonPitLord:Show() timerPitLordCast:Start() specWarnEnslavePitLord:Schedule(10) elseif args.spellId == 138685 then warnSummonImpSwarm:Show() timerSummonImpSwarmCast:Start() elseif args.spellId == 138755 then warnSummonDoomlord:Show() timerSummonDoomlordCast:Start() elseif args.spellId == 138751 then warnSummonFelhunter:Show() timerSummonFelhunterCast:Start() elseif args.spellId == 138564 then specWarnCataclysm:Show(args.sourceName) end end function mod:SPELL_AURA_APPLIED(args) if args.spellId == 1098 and args:GetDestCreatureID() == 70075 then timerEnslaveDemon:Start(args.destName) elseif args.spellId == 138558 then timerDoom:Start() countdownDoom:Start() end end function mod:SPELL_AURA_REMOVED(args) if args.spellId == 1098 and args:GetDestCreatureID() == 70075 and kanrathadAlive then timerEnslaveDemon:Cancel(args.destName) specWarnEnslavePitLord:Show() elseif args.spellId == 138558 then timerDoom:Cancel() countdownDoom:Cancel() end end function mod:SPELL_PERIODIC_DAMAGE(_, _, _, _, destGUID, _, _, _, spellId) if spellId == 138561 and destGUID == UnitGUID("player") and self:AntiSpam() then specWarnRainOfFire:Show() end end function mod:CHAT_MSG_MONSTER_YELL(msg) if msg == L.LostSouls then specWarnLostSouls:Show() timerLostSoulsCD:Start() end end function mod:UNIT_DIED(args) if args.destGUID == UnitGUID("player") then--Solo scenario, a player death is a wipe timerSpellFlameCD:Cancel() timerHellfireCD:Cancel() timerLostSoulsCD:Cancel() timerEnslaveDemon:Cancel() timerPitLordCast:Cancel() timerSummonImpSwarmCast:Cancel() timerSummonFelhunterCast:Cancel() timerSummonDoomlordCast:Cancel() end local cid = self:GetCIDFromGUID(args.destGUID) if cid == 68151 then--Essence of Order timerSpellFlameCD:Cancel() timerHellfireCD:Cancel() timerLostSoulsCD:Cancel() elseif cid == 69964 then--Kanrethad Ebonlocke timerEnslaveDemon:Cancel() kanrathadAlive = false end end
--- --- __init__.lua --- --- Copyright (C) 2018-2019 Xrysnow. All rights reserved. --- Include('core_x/import.lua') for _, n in ipairs({ 'std', 'table', 'util', 'ext' }) do require('core_x.' .. n) end require('math.__init__') lstg.eventDispatcher = require('core_x.EventDispatcher').create() lstg.fs = require('core_x.fs') require('core_x.symbol')
local ACF = ACF local Classes = ACF.Classes local AmmoTypes = Classes.AmmoTypes local BoxSize = Vector() local Ammo, BulletData local CrateText = [[ Crate Armor: %s mm Crate Mass : %s Crate Capacity : %s round(s)]] local function CopySettings(Settings) local Copy = {} if Settings then for K, V in pairs(Settings) do Copy[K] = V end end return Copy end local function GetAmmoList(Class) local Result = {} for K, V in pairs(AmmoTypes) do if V.Unlistable then continue end if V.Blacklist[Class] then continue end Result[K] = V end return Result end local function GetWeaponData(ToolData) local Destiny = Classes[ToolData.Destiny or "Weapons"] local Class = ACF.GetClassGroup(Destiny, ToolData.Weapon) return Class.Lookup[ToolData.Weapon] end local function GetEmptyMass() local Armor = ACF.AmmoArmor * 0.039 -- Millimeters to inches local ExteriorVolume = BoxSize.x * BoxSize.y * BoxSize.z local InteriorVolume = (BoxSize.x - Armor) * (BoxSize.y - Armor) * (BoxSize.z - Armor) return math.Round((ExteriorVolume - InteriorVolume) * 0.13, 2) end local function AddPreview(Base, Settings, ToolData) if Settings.SuppressPreview then return end local Preview = Base:AddModelPreview() Preview:SetCamPos(Vector(45, 45, 30)) Preview:SetHeight(120) Preview:SetFOV(50) if Ammo.AddAmmoPreview then Ammo:AddAmmoPreview(Preview, ToolData, BulletData) end hook.Run("ACF_AddAmmoPreview", Preview, ToolData, Ammo, BulletData) end local function AddControls(Base, Settings, ToolData) if Settings.SuppressControls then return end local RoundLength = Base:AddLabel() RoundLength:TrackClientData("Projectile", "SetText", "GetText") RoundLength:TrackClientData("Propellant") RoundLength:TrackClientData("Tracer") RoundLength:DefineSetter(function() local Text = "Round Length: %s / %s cm" local CurLength = BulletData.ProjLength + BulletData.PropLength + BulletData.Tracer local MaxLength = BulletData.MaxRoundLength return Text:format(CurLength, MaxLength) end) local Projectile = Base:AddSlider("Projectile Length", 0, BulletData.MaxRoundLength, 2) Projectile:SetClientData("Projectile", "OnValueChanged") Projectile:DefineSetter(function(Panel, _, _, Value, IsTracked) ToolData.Projectile = Value if not IsTracked then BulletData.Priority = "Projectile" end Ammo:UpdateRoundData(ToolData, BulletData) ACF.SetClientData("Propellant", BulletData.PropLength) Panel:SetValue(BulletData.ProjLength) return BulletData.ProjLength end) local Propellant = Base:AddSlider("Propellant Length", 0, BulletData.MaxRoundLength, 2) Propellant:SetClientData("Propellant", "OnValueChanged") Propellant:DefineSetter(function(Panel, _, _, Value, IsTracked) ToolData.Propellant = Value if not IsTracked then BulletData.Priority = "Propellant" end Ammo:UpdateRoundData(ToolData, BulletData) ACF.SetClientData("Projectile", BulletData.ProjLength) Panel:SetValue(BulletData.PropLength) return BulletData.PropLength end) if Ammo.AddAmmoControls then Ammo:AddAmmoControls(Base, ToolData, BulletData) end hook.Run("ACF_AddAmmoControls", Base, ToolData, Ammo, BulletData) -- We'll create the tracer checkbox after all the other controls if not Settings.SuppressTracer then local Tracer = Base:AddCheckBox("Tracer") Tracer:SetClientData("Tracer", "OnChange") Tracer:DefineSetter(function(Panel, _, _, Value) ToolData.Tracer = Value Ammo:UpdateRoundData(ToolData, BulletData) ACF.SetClientData("Projectile", BulletData.ProjLength) ACF.SetClientData("Propellant", BulletData.PropLength) Panel:SetText("Tracer : " .. BulletData.Tracer .. " cm") Panel:SetValue(ToolData.Tracer) return ToolData.Tracer end) else ACF.SetClientData("Tracer", false) -- Disabling the tracer, as it takes up spaces on ammo. end end local function AddInformation(Base, Settings, ToolData) if Settings.SuppressInformation then return end if not Settings.SuppressCrateInformation then local Trackers = {} local Crate = Base:AddLabel() Crate:TrackClientData("Weapon", "SetText") Crate:TrackClientData("CrateSizeX") Crate:TrackClientData("CrateSizeY") Crate:TrackClientData("CrateSizeZ") Crate:DefineSetter(function() local Weapon = GetWeaponData(ToolData) local Spacing = Weapon.Caliber * 0.0039 local Rounds = ACF.GetAmmoCrateCapacity(BoxSize, Weapon, BulletData, Spacing, ACF.AmmoArmor) local Empty = GetEmptyMass() local Load = math.floor(BulletData.CartMass * Rounds) local Mass = ACF.GetProperMass(math.floor(Empty + Load)) return CrateText:format(ACF.AmmoArmor, Mass, Rounds) end) if Ammo.AddCrateDataTrackers then Ammo:AddCrateDataTrackers(Trackers, ToolData, BulletData) end hook.Run("ACF_AddCrateDataTrackers", Trackers, ToolData, Ammo, BulletData) for Tracker in pairs(Trackers) do Crate:TrackClientData(Tracker) end end if Ammo.AddAmmoInformation then Ammo:AddAmmoInformation(Base, ToolData, BulletData) end hook.Run("ACF_AddAmmoInformation", Base, ToolData, Ammo, BulletData) end function ACF.GetCurrentAmmoData() return BulletData end function ACF.UpdateAmmoMenu(Menu, Settings) if not Ammo then return end local ToolData = ACF.GetAllClientData() local Base = Menu.AmmoBase BulletData = Ammo:ClientConvert(ToolData) Settings = CopySettings(Settings) if Ammo.SetupAmmoMenuSettings then Ammo:SetupAmmoMenuSettings(Settings, ToolData, BulletData) end hook.Run("ACF_SetupAmmoMenuSettings", Settings, ToolData, Ammo, BulletData) Menu:ClearTemporal(Base) Menu:StartTemporal(Base) if not Settings.SuppressMenu then AddPreview(Base, Settings, ToolData) AddControls(Base, Settings, ToolData) AddInformation(Base, Settings, ToolData) end Base:AddLabel("This entity can be fully parented.") Menu:EndTemporal(Base) end function ACF.CreateAmmoMenu(Menu, Settings) Menu:AddTitle("Ammo Settings") local List = Menu:AddComboBox() local SizeX = Menu:AddSlider("Crate Width", 6, 96, 2) SizeX:SetClientData("CrateSizeX", "OnValueChanged") SizeX:DefineSetter(function(Panel, _, _, Value) local X = math.Round(Value, 2) Panel:SetValue(X) BoxSize.x = X return X end) local SizeY = Menu:AddSlider("Crate Height", 6, 96, 2) SizeY:SetClientData("CrateSizeY", "OnValueChanged") SizeY:DefineSetter(function(Panel, _, _, Value) local Y = math.Round(Value, 2) Panel:SetValue(Y) BoxSize.y = Y return Y end) local SizeZ = Menu:AddSlider("Crate Depth", 6, 96, 2) SizeZ:SetClientData("CrateSizeZ", "OnValueChanged") SizeZ:DefineSetter(function(Panel, _, _, Value) local Z = math.Round(Value, 2) Panel:SetValue(Z) BoxSize.z = Z return Z end) local Base = Menu:AddCollapsible("Ammo Information") local Desc = Base:AddLabel() function List:LoadEntries(Class) ACF.LoadSortedList(self, GetAmmoList(Class), "Name") end function List:OnSelect(Index, _, Data) if self.Selected == Data then return end self.ListData.Index = Index self.Selected = Data Ammo = Data ACF.SetClientData("AmmoType", Data.ID) Desc:SetText(Data.Description) ACF.UpdateAmmoMenu(Menu, Settings) end Menu.AmmoBase = Base return List end
dofile(minetest.get_modpath("better_caves_mushroom") .. "/nodes.lua") dofile(minetest.get_modpath("better_caves_mushroom") .. "/node_ids.lua") dofile(minetest.get_modpath("better_caves_mushroom") .. "/schematics.lua") dofile(minetest.get_modpath("better_caves_mushroom") .. "/biomes.lua")
slot0 = class("WSPortTask", import("...BaseEntity")) slot0.Fields = { btnOnGoing = "userdata", txDesc = "userdata", onDrop = "function", transform = "userdata", task = "table", rtType = "userdata", progress = "userdata", onButton = "function", rtRarity = "userdata", timer = "number", rtName = "userdata", txProgress = "userdata", btnFinished = "userdata", btnInactive = "userdata", rfAwardPanle = "userdata", rfItemTpl = "userdata" } slot0.Listeners = { onTaskUpdate = "OnTaskUpdate" } slot0.Setup = function (slot0, slot1) slot0.task = slot1 pg.DelegateInfo.New(slot0) slot0:Init() end slot0.Dispose = function (slot0) pg.DelegateInfo.Dispose(slot0) slot0:Clear() end slot0.Init = function (slot0) slot0.rtType = slot0.transform.Find(slot1, "type") slot0.rtRarity = slot0.transform.Find(slot1, "rarity") slot0.rtName = slot0.transform.Find(slot1, "name") slot0.txDesc = slot0.transform.Find(slot1, "desc") slot0.btnInactive = slot0.transform.Find(slot1, "button/inactive") slot0.btnOnGoing = slot0.transform.Find(slot1, "button/ongoing") slot0.btnFinished = slot0.transform.Find(slot1, "button/finished") slot0.progress = slot0.transform.Find(slot1, "name/slider") slot0.txProgress = slot0.transform.Find(slot1, "name/slider_progress") slot0.rfAwardPanle = slot0.transform.Find(slot1, "award_panel/content") slot0.rfItemTpl = slot0.transform.Find(slot1, "item_tpl") slot0:OnTaskUpdate() end slot0.OnTaskUpdate = function (slot0) setImageColor(slot0.rtName, (slot0.task.config.type == 5 and Color(0.058823529411764705, 0.0784313725490196, 0.10980392156862745, 0.3)) or Color(0.5450980392156862, 0.596078431372549, 0.8196078431372549, 0.3)) setText(slot0.rtName:Find("Text"), slot0.task.config.name) setText(slot0.txDesc, slot0.task.config.description) GetImageSpriteFromAtlasAsync("ui/worldportui_atlas", pg.WorldToastMgr.Type2PictrueName[slot0.task.config.type], slot0.rtType, true) GetImageSpriteFromAtlasAsync("ui/worldportui_atlas", "rarity_" .. slot0.task.config.rank, slot0.rtRarity, true) removeAllChildren(slot0.rfAwardPanle) for slot5, slot6 in ipairs(slot1) do updateDrop(slot7, slot8) onButton(slot0, slot7, function () slot0.onDrop(slot1) end, SFX_PANEL) setActive(slot7, true) end setActive(slot0.rfItemTpl, false) setActive(slot0.btnInactive, slot0.task:getState() == WorldTask.STATE_INACTIVE) setActive(slot0.btnOnGoing, slot2 == WorldTask.STATE_ONGOING) setActive(slot0.btnFinished, slot2 == WorldTask.STATE_FINISHED) setActive(slot0.txProgress, false) setActive(slot0.progress, false) end return slot0
---------------------------------------------------- -- Hax Racing 2019 / Haxardous & Marcel ---------------------------------------------------- local showColorCodes = true; -- Shows player's names colorcoded if set to true, and if set to false it doesn't local defaultHexCode = "#FFFFFF"; -- Hex code for what color to output messages in (only used if showColorCodes is true) countryName = { ["AF"] = "Afghanistan", ["AX"] = "Aland Islands", ["AL"] = "Albania", ["DZ"] = "Algeria", ["AS"] = "American Samoa", ["AD"] = "Andorra", ["AO"] = "Angola", ["AI"] = "Anguilla", ["AQ"] = "Antarctica", ["AG"] = "Antigua And Barbuda", ["AR"] = "Argentina", ["AM"] = "Armenia", ["AW"] = "Aruba", ["AU"] = "Australia", ["AT"] = "Austria", ["AZ"] = "Azerbaijan", ["BS"] = "Bahamas", ["BH"] = "Bahrain", ["BD"] = "Bangladesh", ["BB"] = "Barbados", ["BY"] = "Belarus", ["BE"] = "Belgium", ["BZ"] = "Belize", ["BJ"] = "Benin", ["BM"] = "Bermuda", ["BT"] = "Bhutan", ["BO"] = "Bolivia", ["BA"] = "Bosnia And Herzegovina", ["BW"] = "Botswana", ["BV"] = "Bouvet Island", ["BR"] = "Brazil", ["IO"] = "British Indian Ocean Territory", ["BN"] = "Brunei Darussalam", ["BG"] = "Bulgaria", ["BF"] = "Burkina Faso", ["BI"] = "Burundi", ["KH"] = "Cambodia", ["CM"] = "Cameroon", ["CA"] = "Canada", ["CV"] = "Cape Verde", ["KY"] = "Cayman Islands", ["CF"] = "Central African Republic", ["TD"] = "Chad", ["CL"] = "Chile", ["CN"] = "China", ["CX"] = "Christmas Island", ["CC"] = "Cocos (Keeling) Islands", ["CO"] = "Colombia", ["KM"] = "Comoros", ["CG"] = "Congo", ["CD"] = "Congo, Democratic Republic", ["CK"] = "Cook Islands", ["CR"] = "Costa Rica", ["CI"] = "Cote D'Ivoire", ["HR"] = "Croatia", ["CU"] = "Cuba", ["CY"] = "Cyprus", ["CZ"] = "Czech Republic", ["DK"] = "Denmark", ["DJ"] = "Djibouti", ["DM"] = "Dominica", ["DO"] = "Dominican Republic", ["EC"] = "Ecuador", ["EG"] = "Egypt", ["SV"] = "El Salvador", ["GQ"] = "Equatorial Guinea", ["ER"] = "Eritrea", ["EE"] = "Estonia", ["ET"] = "Ethiopia", ["FK"] = "Falkland Islands (Malvinas)", ["FO"] = "Faroe Islands", ["FJ"] = "Fiji", ["FI"] = "Finland", ["FR"] = "France", ["GF"] = "French Guiana", ["PF"] = "French Polynesia", ["TF"] = "French Southern Territories", ["GA"] = "Gabon", ["GM"] = "Gambia", ["GE"] = "Georgia", ["DE"] = "Germany", ["GH"] = "Ghana", ["GI"] = "Gibraltar", ["GR"] = "Greece", ["GL"] = "Greenland", ["GD"] = "Grenada", ["GP"] = "Guadeloupe", ["GU"] = "Guam", ["GT"] = "Guatemala", ["GG"] = "Guernsey", ["GN"] = "Guinea", ["GW"] = "Guinea-Bissau", ["GY"] = "Guyana", ["HT"] = "Haiti", ["HM"] = "Heard Island & Mcdonald Islands", ["VA"] = "Holy See (Vatican City State)", ["HN"] = "Honduras", ["HK"] = "Hong Kong", ["HU"] = "Hungary", ["IS"] = "Iceland", ["IN"] = "India", ["ID"] = "Indonesia", ["IR"] = "Iran, Islamic Republic Of", ["IQ"] = "Iraq", ["IE"] = "Ireland", ["IM"] = "Isle Of Man", ["IL"] = "Israel", ["IT"] = "Italy", ["JM"] = "Jamaica", ["JP"] = "Japan", ["JE"] = "Jersey", ["JO"] = "Jordan", ["KZ"] = "Kazakhstan", ["KE"] = "Kenya", ["KI"] = "Kiribati", ["KR"] = "Korea", ["KW"] = "Kuwait", ["KG"] = "Kyrgyzstan", ["LA"] = "Lao People's Democratic Republic", ["LV"] = "Latvia", ["LB"] = "Lebanon", ["LS"] = "Lesotho", ["LR"] = "Liberia", ["LY"] = "Libyan Arab Jamahiriya", ["LI"] = "Liechtenstein", ["LT"] = "Lithuania", ["LU"] = "Luxembourg", ["MO"] = "Macao", ["MK"] = "Macedonia", ["MG"] = "Madagascar", ["MW"] = "Malawi", ["MY"] = "Malaysia", ["MV"] = "Maldives", ["ML"] = "Mali", ["MT"] = "Malta", ["MH"] = "Marshall Islands", ["MQ"] = "Martinique", ["MR"] = "Mauritania", ["MU"] = "Mauritius", ["YT"] = "Mayotte", ["MX"] = "Mexico", ["FM"] = "Micronesia, Federated States Of", ["MD"] = "Moldova", ["MC"] = "Monaco", ["MN"] = "Mongolia", ["ME"] = "Montenegro", ["MS"] = "Montserrat", ["MA"] = "Morocco", ["MZ"] = "Mozambique", ["MM"] = "Myanmar", ["NA"] = "Namibia", ["NR"] = "Nauru", ["NP"] = "Nepal", ["NL"] = "Netherlands", ["AN"] = "Netherlands Antilles", ["NC"] = "New Caledonia", ["NZ"] = "New Zealand", ["NI"] = "Nicaragua", ["NE"] = "Niger", ["NG"] = "Nigeria", ["NU"] = "Niue", ["NF"] = "Norfolk Island", ["MP"] = "Northern Mariana Islands", ["NO"] = "Norway", ["OM"] = "Oman", ["PK"] = "Pakistan", ["PW"] = "Palau", ["PS"] = "Palestinian Territory, Occupied", ["PA"] = "Panama", ["PG"] = "Papua New Guinea", ["PY"] = "Paraguay", ["PE"] = "Peru", ["PH"] = "Philippines", ["PN"] = "Pitcairn", ["PL"] = "Poland", ["PT"] = "Portugal", ["PR"] = "Puerto Rico", ["QA"] = "Qatar", ["RE"] = "Reunion", ["RO"] = "Romania", ["RU"] = "Russian Federation", ["RW"] = "Rwanda", ["BL"] = "Saint Barthelemy", ["SH"] = "Saint Helena", ["KN"] = "Saint Kitts And Nevis", ["LC"] = "Saint Lucia", ["MF"] = "Saint Martin", ["PM"] = "Saint Pierre And Miquelon", ["VC"] = "Saint Vincent And Grenadines", ["WS"] = "Samoa", ["SM"] = "San Marino", ["ST"] = "Sao Tome And Principe", ["SA"] = "Saudi Arabia", ["SN"] = "Senegal", ["RS"] = "Serbia", ["SC"] = "Seychelles", ["SL"] = "Sierra Leone", ["SG"] = "Singapore", ["SK"] = "Slovakia", ["SI"] = "Slovenia", ["SB"] = "Solomon Islands", ["SO"] = "Somalia", ["ZA"] = "South Africa", ["GS"] = "South Georgia And Sandwich Isl.", ["ES"] = "Spain", ["LK"] = "Sri Lanka", ["SD"] = "Sudan", ["SR"] = "Suriname", ["SJ"] = "Svalbard And Jan Mayen", ["SZ"] = "Swaziland", ["SE"] = "Sweden", ["CH"] = "Switzerland", ["SY"] = "Syrian Arab Republic", ["TW"] = "Taiwan", ["TJ"] = "Tajikistan", ["TZ"] = "Tanzania", ["TH"] = "Thailand", ["TL"] = "Timor-Leste", ["TG"] = "Togo", ["TK"] = "Tokelau", ["TO"] = "Tonga", ["TT"] = "Trinidad And Tobago", ["TN"] = "Tunisia", ["TR"] = "Turkey", ["TM"] = "Turkmenistan", ["TC"] = "Turks And Caicos Islands", ["TV"] = "Tuvalu", ["UG"] = "Uganda", ["UA"] = "Ukraine", ["AE"] = "United Arab Emirates", ["GB"] = "United Kingdom", ["US"] = "United States", ["UM"] = "United States Outlying Islands", ["UY"] = "Uruguay", ["UZ"] = "Uzbekistan", ["VU"] = "Vanuatu", ["VE"] = "Venezuela", ["VN"] = "Viet Nam", ["VG"] = "Virgin Islands, British", ["VI"] = "Virgin Islands, U.S.", ["WF"] = "Wallis And Futuna", ["EH"] = "Western Sahara", ["YE"] = "Yemen", ["ZM"] = "Zambia", ["ZW"] = "Zimbabwe", } function getCountry() local country = exports.admin:getPlayerCountry(source) if type(country) == 'string' then return countryName[country] or 'N/A' end return 'N/A' end -- This function converts RGB colors to colorcodes like #ffffff function RGBToHex(red, green, blue, alpha) -- Make sure RGB values passed to this function are correct if( ( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ) ) ) then return nil end -- Alpha check if alpha then return string.format("#%.2X%.2X%.2X%.2X", red, green, blue, alpha) else return string.format("#%.2X%.2X%.2X", red, green, blue) end end addEventHandler('onPlayerJoin', root, function() local getCountry = getCountry() if showColorCodes then outputChatBox(defaultHexCode .. '#FA8072* ' .. RGBToHex(getPlayerNametagColor(source)) .. getPlayerName(source) .. defaultHexCode .. ' #FA8072has joined the game. (#FFFFFF'..getCountry..'#FA8072)', root, 255, 100, 100, true) else outputChatBox('* ' .. getPlayerName(source) .. ' has joined the game', 255, 100, 100) end end ) addEventHandler('onPlayerChangeNick', root, function(oldNick, newNick, countryName) if showColorCodes then outputChatBox(defaultHexCode .. '#FA8072* ' .. RGBToHex(getPlayerNametagColor(source)) .. oldNick .. defaultHexCode .. '#FA8072 is now known as (' .. RGBToHex(getPlayerNametagColor(source)) .. newNick .."#FA8072)", root, 255, 100, 100, true) else outputChatBox('* ' .. oldNick .. ' is now known as ' .. newNick, root, 255, 100, 100) end end ) addEventHandler('onPlayerQuit', root, function(reason) local getCountry = getCountry() if showColorCodes then outputChatBox(defaultHexCode .. '#FA8072* ' .. RGBToHex(getPlayerNametagColor(source)) .. getPlayerName(source) .. defaultHexCode .. '#FA8072 has left the game [#FFFFFF' .. reason .. '#FA8072]', root, 255, 100, 100, true) else outputChatBox('* ' .. getPlayerName(source) .. ' has left the game [' .. reason .. ']', root, 255, 100, 100) end end )
local userInput = Engine.GameWindow.UserInput local controller = { Bindings = { ForwardsKey = userInput:GetInput(Enum.InputCode.W), BackwardsKey = userInput:GetInput(Enum.InputCode.A), LeftKey = userInput:GetInput(Enum.InputCode.S), RightKey = userInput:GetInput(Enum.InputCode.D), UpKey = userInput:GetInput(Enum.InputCode.E), DownKey = userInput:GetInput(Enum.InputCode.Q), FastKey = userInput:GetInput(Enum.InputCode.Space), TurnKey = userInput:GetInput(Enum.InputCode.MouseRight), MovementInput = userInput:GetInput(Enum.InputCode.MousePosition) }, Settings = { DefaultSpeed = 20, FastSpeed = 100 }, Camera = { AspectRatio = GameObject.FrameBuffer.WindowSize.Width / GameObject.FrameBuffer.WindowSize.Height, Size = 5 / 3, DefaultWidth = 0, DefaultHeight = 0, DefaultProjection = 1, DefaultNear = 0.1, DefaultFar = 10000 } } controller.Camera.DefaultWidth = controller.Camera.AspectRatio * controller.Camera.Size controller.Camera.DefaultHeight = controller.Camera.Size local bindings = controller.Bindings local settings = controller.Settings local speed = controller.Settings.DefaultSpeed local pitch = 0 local yaw = 0 local previousPosition = bindings.MovementInput:GetPosition() coroutine.wrap(function() while true do local delta = wait(1 / 60) local camera = This:GetComponent("Camera") --print(delta, camera, This) if camera then local x = 0 local y = 0 local z = 0 if bindings.FastKey:GetState() then speed = settings.FastSpeed else speed = settings.DefaultSpeed end if bindings.ForwardsKey:GetState() then z = -delta * speed end if bindings.BackwardsKey:GetState() then z = delta * speed end if bindings.LeftKey:GetState() then x = -delta * speed end if bindings.RightKey:GetState() then x = delta * speed end if bindings.DownKey:GetState() then y = -delta * speed end if bindings.UpKey:GetState() then y = delta * speed end if bindings.TurnKey:GetState() then local currentPosition = bindings.MovementInput:GetPosition() local mouseDelta = currentPosition - previousPosition yaw = (yaw - mouseDelta.X * delta * 0.1 + 2 * math.pi) % (2 * math.pi) pitch = math.min(math.max(pitch - mouseDelta.Y * delta * 0.1, -math.pi / 2), math.pi / 2) Engine.GameWindow:SetMousePosition(previousPosition) else previousPosition = mousePosition:GetPosition() end local transform = camera:GetTransformation() * Matrix3(x, y, z) local rotation = (Matrix3.YawRotation(yaw) * Matrix3.PitchRotation(pitch)):TransformedAround(transform:Translation()) camera:SetTransformation(rotation * Matrix3(transform:Translation())) end end end)() return controller
local Festival_Sign_Base = { [1] = {ID = 1, TeamId = 1, Count = 1, BOUNS = "1,2,0,1,5000", }, [2] = {ID = 2, TeamId = 1, Count = 2, BOUNS = "2,2,0,70000005,5", }, [3] = {ID = 3, TeamId = 1, Count = 3, BOUNS = "3,2,0,10000001,1", }, [4] = {ID = 4, TeamId = 1, Count = 4, BOUNS = "4,2,0,2,50", }, [5] = {ID = 5, TeamId = 1, Count = 5, BOUNS = "5,2,0,10000004,5", }, [6] = {ID = 6, TeamId = 1, Count = 6, BOUNS = "6,2,0,91000002,2", }, [7] = {ID = 7, TeamId = 1, Count = 7, BOUNS = "0,0,0,1000,5", }, [8] = {ID = 8, TeamId = 1, Count = 8, BOUNS = "7,2,0,1,10000", }, [9] = {ID = 9, TeamId = 1, Count = 9, BOUNS = "8,2,0,70000005,10", }, [10] = {ID = 10, TeamId = 1, Count = 10, BOUNS = "9,2,0,10000001,2", }, [11] = {ID = 11, TeamId = 1, Count = 11, BOUNS = "10,2,0,2,100", }, [12] = {ID = 12, TeamId = 1, Count = 12, BOUNS = "11,2,0,10000004,8", }, [13] = {ID = 13, TeamId = 1, Count = 13, BOUNS = "12,2,0,91000002,4", }, [14] = {ID = 14, TeamId = 1, Count = 14, BOUNS = "0,0,0,2000,1", }, [15] = {ID = 15, TeamId = 1, Count = 15, BOUNS = "1,2,0,1,15000", }, [16] = {ID = 16, TeamId = 1, Count = 16, BOUNS = "2,2,0,70000005,15", }, [17] = {ID = 17, TeamId = 1, Count = 17, BOUNS = "3,2,0,10000001,3", }, [18] = {ID = 18, TeamId = 1, Count = 18, BOUNS = "4,2,0,2,150", }, [19] = {ID = 19, TeamId = 1, Count = 19, BOUNS = "5,2,0,10000004,10", }, [20] = {ID = 20, TeamId = 1, Count = 20, BOUNS = "6,2,0,91000002,6", }, [21] = {ID = 21, TeamId = 1, Count = 21, BOUNS = "0,0,0,2000,2", }, [22] = {ID = 22, TeamId = 1, Count = 22, BOUNS = "7,2,0,1,20000", }, [23] = {ID = 23, TeamId = 1, Count = 23, BOUNS = "8,2,0,70000005,20", }, [24] = {ID = 24, TeamId = 1, Count = 24, BOUNS = "9,2,0,10000001,4", }, [25] = {ID = 25, TeamId = 1, Count = 25, BOUNS = "10,2,0,2,200", }, [26] = {ID = 26, TeamId = 1, Count = 26, BOUNS = "11,2,0,10000004,15", }, [27] = {ID = 27, TeamId = 1, Count = 27, BOUNS = "12,2,0,91000002,8", }, [28] = {ID = 28, TeamId = 1, Count = 28, BOUNS = "0,0,1,51006,1", }, [29] = {ID = 29, TeamId = 2, Count = 1, BOUNS = "1,2,0,1,5000", }, [30] = {ID = 30, TeamId = 2, Count = 2, BOUNS = "2,2,0,70000005,5", }, [31] = {ID = 31, TeamId = 2, Count = 3, BOUNS = "3,2,0,10000001,1", }, [32] = {ID = 32, TeamId = 2, Count = 4, BOUNS = "4,2,0,2,50", }, [33] = {ID = 33, TeamId = 2, Count = 5, BOUNS = "5,2,0,10000004,5", }, [34] = {ID = 34, TeamId = 2, Count = 6, BOUNS = "6,2,0,91000002,2", }, [35] = {ID = 35, TeamId = 2, Count = 7, BOUNS = "0,0,0,1000,5", }, [36] = {ID = 36, TeamId = 2, Count = 8, BOUNS = "7,2,0,1,10000", }, [37] = {ID = 37, TeamId = 2, Count = 9, BOUNS = "8,2,0,70000005,10", }, [38] = {ID = 38, TeamId = 2, Count = 10, BOUNS = "9,2,0,10000001,2", }, [39] = {ID = 39, TeamId = 2, Count = 11, BOUNS = "10,2,0,2,100", }, [40] = {ID = 40, TeamId = 2, Count = 12, BOUNS = "11,2,0,10000004,8", }, [41] = {ID = 41, TeamId = 2, Count = 13, BOUNS = "12,2,0,91000002,4", }, [42] = {ID = 42, TeamId = 2, Count = 14, BOUNS = "0,0,0,2000,1", }, [43] = {ID = 43, TeamId = 2, Count = 15, BOUNS = "1,2,0,1,15000", }, [44] = {ID = 44, TeamId = 2, Count = 16, BOUNS = "2,2,0,70000005,15", }, [45] = {ID = 45, TeamId = 2, Count = 17, BOUNS = "3,2,0,10000001,3", }, [46] = {ID = 46, TeamId = 2, Count = 18, BOUNS = "4,2,0,2,150", }, [47] = {ID = 47, TeamId = 2, Count = 19, BOUNS = "5,2,0,10000004,10", }, [48] = {ID = 48, TeamId = 2, Count = 20, BOUNS = "6,2,0,91000002,6", }, [49] = {ID = 49, TeamId = 2, Count = 21, BOUNS = "0,0,0,2000,2", }, [50] = {ID = 50, TeamId = 2, Count = 22, BOUNS = "7,2,0,1,20000", }, [51] = {ID = 51, TeamId = 2, Count = 23, BOUNS = "8,2,0,70000005,20", }, [52] = {ID = 52, TeamId = 2, Count = 24, BOUNS = "9,2,0,10000001,4", }, [53] = {ID = 53, TeamId = 2, Count = 25, BOUNS = "10,2,0,2,200", }, [54] = {ID = 54, TeamId = 2, Count = 26, BOUNS = "11,2,0,10000004,15", }, [55] = {ID = 55, TeamId = 2, Count = 27, BOUNS = "12,2,0,91000002,8", }, [56] = {ID = 56, TeamId = 2, Count = 28, BOUNS = "0,0,0,2000,5", }, [57] = {ID = 57, TeamId = 3, Count = 1, BOUNS = "1,2,0,1,5000", }, [58] = {ID = 58, TeamId = 3, Count = 2, BOUNS = "2,2,0,70000005,5", }, [59] = {ID = 59, TeamId = 3, Count = 3, BOUNS = "3,2,0,10000001,1", }, [60] = {ID = 60, TeamId = 3, Count = 4, BOUNS = "4,2,0,2,50", }, [61] = {ID = 61, TeamId = 3, Count = 5, BOUNS = "5,2,0,10000004,5", }, [62] = {ID = 62, TeamId = 3, Count = 6, BOUNS = "6,2,0,91000002,2", }, [63] = {ID = 63, TeamId = 3, Count = 7, BOUNS = "0,0,0,1000,5", }, [64] = {ID = 64, TeamId = 3, Count = 8, BOUNS = "7,2,0,1,10000", }, [65] = {ID = 65, TeamId = 3, Count = 9, BOUNS = "8,2,0,70000005,10", }, [66] = {ID = 66, TeamId = 3, Count = 10, BOUNS = "9,2,0,10000001,2", }, [67] = {ID = 67, TeamId = 3, Count = 11, BOUNS = "10,2,0,2,100", }, [68] = {ID = 68, TeamId = 3, Count = 12, BOUNS = "11,2,0,10000004,8", }, [69] = {ID = 69, TeamId = 3, Count = 13, BOUNS = "12,2,0,91000002,4", }, [70] = {ID = 70, TeamId = 3, Count = 14, BOUNS = "0,0,0,2000,1", }, [71] = {ID = 71, TeamId = 3, Count = 15, BOUNS = "1,2,0,1,15000", }, [72] = {ID = 72, TeamId = 3, Count = 16, BOUNS = "2,2,0,70000005,15", }, [73] = {ID = 73, TeamId = 3, Count = 17, BOUNS = "3,2,0,10000001,3", }, [74] = {ID = 74, TeamId = 3, Count = 18, BOUNS = "4,2,0,2,150", }, [75] = {ID = 75, TeamId = 3, Count = 19, BOUNS = "5,2,0,10000004,10", }, [76] = {ID = 76, TeamId = 3, Count = 20, BOUNS = "6,2,0,91000002,6", }, [77] = {ID = 77, TeamId = 3, Count = 21, BOUNS = "0,0,0,2000,2", }, [78] = {ID = 78, TeamId = 3, Count = 22, BOUNS = "7,2,0,1,20000", }, [79] = {ID = 79, TeamId = 3, Count = 23, BOUNS = "8,2,0,70000005,20", }, [80] = {ID = 80, TeamId = 3, Count = 24, BOUNS = "9,2,0,10000001,4", }, [81] = {ID = 81, TeamId = 3, Count = 25, BOUNS = "10,2,0,2,200", }, [82] = {ID = 82, TeamId = 3, Count = 26, BOUNS = "11,2,0,10000004,15", }, [83] = {ID = 83, TeamId = 3, Count = 27, BOUNS = "12,2,0,91000002,8", }, [84] = {ID = 84, TeamId = 3, Count = 28, BOUNS = "0,0,0,2000,5", }, [85] = {ID = 85, TeamId = 4, Count = 1, BOUNS = "1,2,0,1,5000", }, [86] = {ID = 86, TeamId = 4, Count = 2, BOUNS = "2,2,0,70000005,5", }, [87] = {ID = 87, TeamId = 4, Count = 3, BOUNS = "3,2,0,10000001,1", }, [88] = {ID = 88, TeamId = 4, Count = 4, BOUNS = "4,2,0,2,50", }, [89] = {ID = 89, TeamId = 4, Count = 5, BOUNS = "5,2,0,10000004,5", }, [90] = {ID = 90, TeamId = 4, Count = 6, BOUNS = "6,2,0,91000002,2", }, [91] = {ID = 91, TeamId = 4, Count = 7, BOUNS = "0,0,0,1000,5", }, [92] = {ID = 92, TeamId = 4, Count = 8, BOUNS = "7,2,0,1,10000", }, [93] = {ID = 93, TeamId = 4, Count = 9, BOUNS = "8,2,0,70000005,10", }, [94] = {ID = 94, TeamId = 4, Count = 10, BOUNS = "9,2,0,10000001,2", }, [95] = {ID = 95, TeamId = 4, Count = 11, BOUNS = "10,2,0,2,100", }, [96] = {ID = 96, TeamId = 4, Count = 12, BOUNS = "11,2,0,10000004,8", }, [97] = {ID = 97, TeamId = 4, Count = 13, BOUNS = "12,2,0,91000002,4", }, [98] = {ID = 98, TeamId = 4, Count = 14, BOUNS = "0,0,0,2000,1", }, [99] = {ID = 99, TeamId = 4, Count = 15, BOUNS = "1,2,0,1,15000", }, [100] = {ID = 100, TeamId = 4, Count = 16, BOUNS = "2,2,0,70000005,15", }, [101] = {ID = 101, TeamId = 4, Count = 17, BOUNS = "3,2,0,10000001,3", }, [102] = {ID = 102, TeamId = 4, Count = 18, BOUNS = "4,2,0,2,150", }, [103] = {ID = 103, TeamId = 4, Count = 19, BOUNS = "5,2,0,10000004,10", }, [104] = {ID = 104, TeamId = 4, Count = 20, BOUNS = "6,2,0,91000002,6", }, [105] = {ID = 105, TeamId = 4, Count = 21, BOUNS = "0,0,0,2000,2", }, [106] = {ID = 106, TeamId = 4, Count = 22, BOUNS = "7,2,0,1,20000", }, [107] = {ID = 107, TeamId = 4, Count = 23, BOUNS = "8,2,0,70000005,20", }, [108] = {ID = 108, TeamId = 4, Count = 24, BOUNS = "9,2,0,10000001,4", }, [109] = {ID = 109, TeamId = 4, Count = 25, BOUNS = "10,2,0,2,200", }, [110] = {ID = 110, TeamId = 4, Count = 26, BOUNS = "11,2,0,10000004,15", }, [111] = {ID = 111, TeamId = 4, Count = 27, BOUNS = "12,2,0,91000002,8", }, [112] = {ID = 112, TeamId = 4, Count = 28, BOUNS = "0,0,0,2000,5", }, [113] = {ID = 113, TeamId = 5, Count = 1, BOUNS = "1,2,0,1,5000", }, [114] = {ID = 114, TeamId = 5, Count = 2, BOUNS = "2,2,0,70000005,5", }, [115] = {ID = 115, TeamId = 5, Count = 3, BOUNS = "3,2,0,10000001,1", }, [116] = {ID = 116, TeamId = 5, Count = 4, BOUNS = "4,2,0,2,50", }, [117] = {ID = 117, TeamId = 5, Count = 5, BOUNS = "5,2,0,10000004,5", }, [118] = {ID = 118, TeamId = 5, Count = 6, BOUNS = "6,2,0,91000002,2", }, [119] = {ID = 119, TeamId = 5, Count = 7, BOUNS = "0,0,0,1000,5", }, [120] = {ID = 120, TeamId = 5, Count = 8, BOUNS = "7,2,0,1,10000", }, [121] = {ID = 121, TeamId = 5, Count = 9, BOUNS = "8,2,0,70000005,10", }, [122] = {ID = 122, TeamId = 5, Count = 10, BOUNS = "9,2,0,10000001,2", }, [123] = {ID = 123, TeamId = 5, Count = 11, BOUNS = "10,2,0,2,100", }, [124] = {ID = 124, TeamId = 5, Count = 12, BOUNS = "11,2,0,10000004,8", }, [125] = {ID = 125, TeamId = 5, Count = 13, BOUNS = "12,2,0,91000002,4", }, [126] = {ID = 126, TeamId = 5, Count = 14, BOUNS = "0,0,0,2000,1", }, [127] = {ID = 127, TeamId = 5, Count = 15, BOUNS = "1,2,0,1,15000", }, [128] = {ID = 128, TeamId = 5, Count = 16, BOUNS = "2,2,0,70000005,15", }, [129] = {ID = 129, TeamId = 5, Count = 17, BOUNS = "3,2,0,10000001,3", }, [130] = {ID = 130, TeamId = 5, Count = 18, BOUNS = "4,2,0,2,150", }, [131] = {ID = 131, TeamId = 5, Count = 19, BOUNS = "5,2,0,10000004,10", }, [132] = {ID = 132, TeamId = 5, Count = 20, BOUNS = "6,2,0,91000002,6", }, [133] = {ID = 133, TeamId = 5, Count = 21, BOUNS = "0,0,0,2000,2", }, [134] = {ID = 134, TeamId = 5, Count = 22, BOUNS = "7,2,0,1,20000", }, [135] = {ID = 135, TeamId = 5, Count = 23, BOUNS = "8,2,0,70000005,20", }, [136] = {ID = 136, TeamId = 5, Count = 24, BOUNS = "9,2,0,10000001,4", }, [137] = {ID = 137, TeamId = 5, Count = 25, BOUNS = "10,2,0,2,200", }, [138] = {ID = 138, TeamId = 5, Count = 26, BOUNS = "11,2,0,10000004,15", }, [139] = {ID = 139, TeamId = 5, Count = 27, BOUNS = "12,2,0,91000002,8", }, [140] = {ID = 140, TeamId = 5, Count = 28, BOUNS = "0,0,0,2000,5", }, [141] = {ID = 141, TeamId = 6, Count = 1, BOUNS = "1,2,0,1,5000", }, [142] = {ID = 142, TeamId = 6, Count = 2, BOUNS = "2,2,0,70000005,5", }, [143] = {ID = 143, TeamId = 6, Count = 3, BOUNS = "3,2,0,10000001,1", }, [144] = {ID = 144, TeamId = 6, Count = 4, BOUNS = "4,2,0,2,50", }, [145] = {ID = 145, TeamId = 6, Count = 5, BOUNS = "5,2,0,10000004,5", }, [146] = {ID = 146, TeamId = 6, Count = 6, BOUNS = "6,2,0,91000002,2", }, [147] = {ID = 147, TeamId = 6, Count = 7, BOUNS = "0,0,0,1000,5", }, [148] = {ID = 148, TeamId = 6, Count = 8, BOUNS = "7,2,0,1,10000", }, [149] = {ID = 149, TeamId = 6, Count = 9, BOUNS = "8,2,0,70000005,10", }, [150] = {ID = 150, TeamId = 6, Count = 10, BOUNS = "9,2,0,10000001,2", }, [151] = {ID = 151, TeamId = 6, Count = 11, BOUNS = "10,2,0,2,100", }, [152] = {ID = 152, TeamId = 6, Count = 12, BOUNS = "11,2,0,10000004,8", }, [153] = {ID = 153, TeamId = 6, Count = 13, BOUNS = "12,2,0,91000002,4", }, [154] = {ID = 154, TeamId = 6, Count = 14, BOUNS = "0,0,0,2000,1", }, [155] = {ID = 155, TeamId = 6, Count = 15, BOUNS = "1,2,0,1,15000", }, [156] = {ID = 156, TeamId = 6, Count = 16, BOUNS = "2,2,0,70000005,15", }, [157] = {ID = 157, TeamId = 6, Count = 17, BOUNS = "3,2,0,10000001,3", }, [158] = {ID = 158, TeamId = 6, Count = 18, BOUNS = "4,2,0,2,150", }, [159] = {ID = 159, TeamId = 6, Count = 19, BOUNS = "5,2,0,10000004,10", }, [160] = {ID = 160, TeamId = 6, Count = 20, BOUNS = "6,2,0,91000002,6", }, [161] = {ID = 161, TeamId = 6, Count = 21, BOUNS = "0,0,0,2000,2", }, [162] = {ID = 162, TeamId = 6, Count = 22, BOUNS = "7,2,0,1,20000", }, [163] = {ID = 163, TeamId = 6, Count = 23, BOUNS = "8,2,0,70000005,20", }, [164] = {ID = 164, TeamId = 6, Count = 24, BOUNS = "9,2,0,10000001,4", }, [165] = {ID = 165, TeamId = 6, Count = 25, BOUNS = "10,2,0,2,200", }, [166] = {ID = 166, TeamId = 6, Count = 26, BOUNS = "11,2,0,10000004,15", }, [167] = {ID = 167, TeamId = 6, Count = 27, BOUNS = "12,2,0,91000002,8", }, [168] = {ID = 168, TeamId = 6, Count = 28, BOUNS = "0,0,0,2000,5", }, [169] = {ID = 169, TeamId = 7, Count = 1, BOUNS = "1,2,0,1,5000", }, [170] = {ID = 170, TeamId = 7, Count = 2, BOUNS = "2,2,0,70000005,5", }, [171] = {ID = 171, TeamId = 7, Count = 3, BOUNS = "3,2,0,10000001,1", }, [172] = {ID = 172, TeamId = 7, Count = 4, BOUNS = "4,2,0,2,50", }, [173] = {ID = 173, TeamId = 7, Count = 5, BOUNS = "5,2,0,10000004,5", }, [174] = {ID = 174, TeamId = 7, Count = 6, BOUNS = "6,2,0,91000002,2", }, [175] = {ID = 175, TeamId = 7, Count = 7, BOUNS = "0,0,0,1000,5", }, [176] = {ID = 176, TeamId = 7, Count = 8, BOUNS = "7,2,0,1,10000", }, [177] = {ID = 177, TeamId = 7, Count = 9, BOUNS = "8,2,0,70000005,10", }, [178] = {ID = 178, TeamId = 7, Count = 10, BOUNS = "9,2,0,10000001,2", }, [179] = {ID = 179, TeamId = 7, Count = 11, BOUNS = "10,2,0,2,100", }, [180] = {ID = 180, TeamId = 7, Count = 12, BOUNS = "11,2,0,10000004,8", }, [181] = {ID = 181, TeamId = 7, Count = 13, BOUNS = "12,2,0,91000002,4", }, [182] = {ID = 182, TeamId = 7, Count = 14, BOUNS = "0,0,0,2000,1", }, [183] = {ID = 183, TeamId = 7, Count = 15, BOUNS = "1,2,0,1,15000", }, [184] = {ID = 184, TeamId = 7, Count = 16, BOUNS = "2,2,0,70000005,15", }, [185] = {ID = 185, TeamId = 7, Count = 17, BOUNS = "3,2,0,10000001,3", }, [186] = {ID = 186, TeamId = 7, Count = 18, BOUNS = "4,2,0,2,150", }, [187] = {ID = 187, TeamId = 7, Count = 19, BOUNS = "5,2,0,10000004,10", }, [188] = {ID = 188, TeamId = 7, Count = 20, BOUNS = "6,2,0,91000002,6", }, [189] = {ID = 189, TeamId = 7, Count = 21, BOUNS = "0,0,0,2000,2", }, [190] = {ID = 190, TeamId = 7, Count = 22, BOUNS = "7,2,0,1,20000", }, [191] = {ID = 191, TeamId = 7, Count = 23, BOUNS = "8,2,0,70000005,20", }, [192] = {ID = 192, TeamId = 7, Count = 24, BOUNS = "9,2,0,10000001,4", }, [193] = {ID = 193, TeamId = 7, Count = 25, BOUNS = "10,2,0,2,200", }, [194] = {ID = 194, TeamId = 7, Count = 26, BOUNS = "11,2,0,10000004,15", }, [195] = {ID = 195, TeamId = 7, Count = 27, BOUNS = "12,2,0,91000002,8", }, [196] = {ID = 196, TeamId = 7, Count = 28, BOUNS = "0,0,0,2000,5", }, [197] = {ID = 197, TeamId = 8, Count = 1, BOUNS = "1,2,0,1,5000", }, [198] = {ID = 198, TeamId = 8, Count = 2, BOUNS = "2,2,0,70000005,5", }, [199] = {ID = 199, TeamId = 8, Count = 3, BOUNS = "3,2,0,10000001,1", }, [200] = {ID = 200, TeamId = 8, Count = 4, BOUNS = "4,2,0,2,50", }, [201] = {ID = 201, TeamId = 8, Count = 5, BOUNS = "5,2,0,10000004,5", }, [202] = {ID = 202, TeamId = 8, Count = 6, BOUNS = "6,2,0,91000002,2", }, [203] = {ID = 203, TeamId = 8, Count = 7, BOUNS = "0,0,0,1000,5", }, [204] = {ID = 204, TeamId = 8, Count = 8, BOUNS = "7,2,0,1,10000", }, [205] = {ID = 205, TeamId = 8, Count = 9, BOUNS = "8,2,0,70000005,10", }, [206] = {ID = 206, TeamId = 8, Count = 10, BOUNS = "9,2,0,10000001,2", }, [207] = {ID = 207, TeamId = 8, Count = 11, BOUNS = "10,2,0,2,100", }, [208] = {ID = 208, TeamId = 8, Count = 12, BOUNS = "11,2,0,10000004,8", }, [209] = {ID = 209, TeamId = 8, Count = 13, BOUNS = "12,2,0,91000002,4", }, [210] = {ID = 210, TeamId = 8, Count = 14, BOUNS = "0,0,0,2000,1", }, [211] = {ID = 211, TeamId = 8, Count = 15, BOUNS = "1,2,0,1,15000", }, [212] = {ID = 212, TeamId = 8, Count = 16, BOUNS = "2,2,0,70000005,15", }, [213] = {ID = 213, TeamId = 8, Count = 17, BOUNS = "3,2,0,10000001,3", }, [214] = {ID = 214, TeamId = 8, Count = 18, BOUNS = "4,2,0,2,150", }, [215] = {ID = 215, TeamId = 8, Count = 19, BOUNS = "5,2,0,10000004,10", }, [216] = {ID = 216, TeamId = 8, Count = 20, BOUNS = "6,2,0,91000002,6", }, [217] = {ID = 217, TeamId = 8, Count = 21, BOUNS = "0,0,0,2000,2", }, [218] = {ID = 218, TeamId = 8, Count = 22, BOUNS = "7,2,0,1,20000", }, [219] = {ID = 219, TeamId = 8, Count = 23, BOUNS = "8,2,0,70000005,20", }, [220] = {ID = 220, TeamId = 8, Count = 24, BOUNS = "9,2,0,10000001,4", }, [221] = {ID = 221, TeamId = 8, Count = 25, BOUNS = "10,2,0,2,200", }, [222] = {ID = 222, TeamId = 8, Count = 26, BOUNS = "11,2,0,10000004,15", }, [223] = {ID = 223, TeamId = 8, Count = 27, BOUNS = "12,2,0,91000002,8", }, [224] = {ID = 224, TeamId = 8, Count = 28, BOUNS = "0,0,0,2000,5", }, [225] = {ID = 225, TeamId = 9, Count = 1, BOUNS = "1,2,0,1,5000", }, [226] = {ID = 226, TeamId = 9, Count = 2, BOUNS = "2,2,0,70000005,5", }, [227] = {ID = 227, TeamId = 9, Count = 3, BOUNS = "3,2,0,10000001,1", }, [228] = {ID = 228, TeamId = 9, Count = 4, BOUNS = "4,2,0,2,50", }, [229] = {ID = 229, TeamId = 9, Count = 5, BOUNS = "5,2,0,10000004,5", }, [230] = {ID = 230, TeamId = 9, Count = 6, BOUNS = "6,2,0,91000002,2", }, [231] = {ID = 231, TeamId = 9, Count = 7, BOUNS = "0,0,0,1000,5", }, [232] = {ID = 232, TeamId = 9, Count = 8, BOUNS = "7,2,0,1,10000", }, [233] = {ID = 233, TeamId = 9, Count = 9, BOUNS = "8,2,0,70000005,10", }, [234] = {ID = 234, TeamId = 9, Count = 10, BOUNS = "9,2,0,10000001,2", }, [235] = {ID = 235, TeamId = 9, Count = 11, BOUNS = "10,2,0,2,100", }, [236] = {ID = 236, TeamId = 9, Count = 12, BOUNS = "11,2,0,10000004,8", }, [237] = {ID = 237, TeamId = 9, Count = 13, BOUNS = "12,2,0,91000002,4", }, [238] = {ID = 238, TeamId = 9, Count = 14, BOUNS = "0,0,0,2000,1", }, [239] = {ID = 239, TeamId = 9, Count = 15, BOUNS = "1,2,0,1,15000", }, [240] = {ID = 240, TeamId = 9, Count = 16, BOUNS = "2,2,0,70000005,15", }, [241] = {ID = 241, TeamId = 9, Count = 17, BOUNS = "3,2,0,10000001,3", }, [242] = {ID = 242, TeamId = 9, Count = 18, BOUNS = "4,2,0,2,150", }, [243] = {ID = 243, TeamId = 9, Count = 19, BOUNS = "5,2,0,10000004,10", }, [244] = {ID = 244, TeamId = 9, Count = 20, BOUNS = "6,2,0,91000002,6", }, [245] = {ID = 245, TeamId = 9, Count = 21, BOUNS = "0,0,0,2000,2", }, [246] = {ID = 246, TeamId = 9, Count = 22, BOUNS = "7,2,0,1,20000", }, [247] = {ID = 247, TeamId = 9, Count = 23, BOUNS = "8,2,0,70000005,20", }, [248] = {ID = 248, TeamId = 9, Count = 24, BOUNS = "9,2,0,10000001,4", }, [249] = {ID = 249, TeamId = 9, Count = 25, BOUNS = "10,2,0,2,200", }, [250] = {ID = 250, TeamId = 9, Count = 26, BOUNS = "11,2,0,10000004,15", }, [251] = {ID = 251, TeamId = 9, Count = 27, BOUNS = "12,2,0,91000002,8", }, [252] = {ID = 252, TeamId = 9, Count = 28, BOUNS = "0,0,0,2000,5", }, [253] = {ID = 253, TeamId = 10, Count = 1, BOUNS = "1,2,0,1,5000", }, [254] = {ID = 254, TeamId = 10, Count = 2, BOUNS = "2,2,0,70000005,5", }, [255] = {ID = 255, TeamId = 10, Count = 3, BOUNS = "3,2,0,10000001,1", }, [256] = {ID = 256, TeamId = 10, Count = 4, BOUNS = "4,2,0,2,50", }, [257] = {ID = 257, TeamId = 10, Count = 5, BOUNS = "5,2,0,10000004,5", }, [258] = {ID = 258, TeamId = 10, Count = 6, BOUNS = "6,2,0,91000002,2", }, [259] = {ID = 259, TeamId = 10, Count = 7, BOUNS = "0,0,0,1000,5", }, [260] = {ID = 260, TeamId = 10, Count = 8, BOUNS = "7,2,0,1,10000", }, [261] = {ID = 261, TeamId = 10, Count = 9, BOUNS = "8,2,0,70000005,10", }, [262] = {ID = 262, TeamId = 10, Count = 10, BOUNS = "9,2,0,10000001,2", }, [263] = {ID = 263, TeamId = 10, Count = 11, BOUNS = "10,2,0,2,100", }, [264] = {ID = 264, TeamId = 10, Count = 12, BOUNS = "11,2,0,10000004,8", }, [265] = {ID = 265, TeamId = 10, Count = 13, BOUNS = "12,2,0,91000002,4", }, [266] = {ID = 266, TeamId = 10, Count = 14, BOUNS = "0,0,0,2000,1", }, [267] = {ID = 267, TeamId = 10, Count = 15, BOUNS = "1,2,0,1,15000", }, [268] = {ID = 268, TeamId = 10, Count = 16, BOUNS = "2,2,0,70000005,15", }, [269] = {ID = 269, TeamId = 10, Count = 17, BOUNS = "3,2,0,10000001,3", }, [270] = {ID = 270, TeamId = 10, Count = 18, BOUNS = "4,2,0,2,150", }, [271] = {ID = 271, TeamId = 10, Count = 19, BOUNS = "5,2,0,10000004,10", }, [272] = {ID = 272, TeamId = 10, Count = 20, BOUNS = "6,2,0,91000002,6", }, [273] = {ID = 273, TeamId = 10, Count = 21, BOUNS = "0,0,0,2000,2", }, [274] = {ID = 274, TeamId = 10, Count = 22, BOUNS = "7,2,0,1,20000", }, [275] = {ID = 275, TeamId = 10, Count = 23, BOUNS = "8,2,0,70000005,20", }, [276] = {ID = 276, TeamId = 10, Count = 24, BOUNS = "9,2,0,10000001,4", }, [277] = {ID = 277, TeamId = 10, Count = 25, BOUNS = "10,2,0,2,200", }, [278] = {ID = 278, TeamId = 10, Count = 26, BOUNS = "11,2,0,10000004,15", }, [279] = {ID = 279, TeamId = 10, Count = 27, BOUNS = "12,2,0,91000002,8", }, [280] = {ID = 280, TeamId = 10, Count = 28, BOUNS = "0,0,0,2000,5", }, [281] = {ID = 281, TeamId = 11, Count = 1, BOUNS = "1,2,0,1,5000", }, [282] = {ID = 282, TeamId = 11, Count = 2, BOUNS = "2,2,0,70000005,5", }, [283] = {ID = 283, TeamId = 11, Count = 3, BOUNS = "3,2,0,10000001,1", }, [284] = {ID = 284, TeamId = 11, Count = 4, BOUNS = "4,2,0,2,50", }, [285] = {ID = 285, TeamId = 11, Count = 5, BOUNS = "5,2,0,10000004,5", }, [286] = {ID = 286, TeamId = 11, Count = 6, BOUNS = "6,2,0,91000002,2", }, [287] = {ID = 287, TeamId = 11, Count = 7, BOUNS = "0,0,0,1000,5", }, [288] = {ID = 288, TeamId = 11, Count = 8, BOUNS = "7,2,0,1,10000", }, [289] = {ID = 289, TeamId = 11, Count = 9, BOUNS = "8,2,0,70000005,10", }, [290] = {ID = 290, TeamId = 11, Count = 10, BOUNS = "9,2,0,10000001,2", }, [291] = {ID = 291, TeamId = 11, Count = 11, BOUNS = "10,2,0,2,100", }, [292] = {ID = 292, TeamId = 11, Count = 12, BOUNS = "11,2,0,10000004,8", }, [293] = {ID = 293, TeamId = 11, Count = 13, BOUNS = "12,2,0,91000002,4", }, [294] = {ID = 294, TeamId = 11, Count = 14, BOUNS = "0,0,0,2000,1", }, [295] = {ID = 295, TeamId = 11, Count = 15, BOUNS = "1,2,0,1,15000", }, [296] = {ID = 296, TeamId = 11, Count = 16, BOUNS = "2,2,0,70000005,15", }, [297] = {ID = 297, TeamId = 11, Count = 17, BOUNS = "3,2,0,10000001,3", }, [298] = {ID = 298, TeamId = 11, Count = 18, BOUNS = "4,2,0,2,150", }, [299] = {ID = 299, TeamId = 11, Count = 19, BOUNS = "5,2,0,10000004,10", }, [300] = {ID = 300, TeamId = 11, Count = 20, BOUNS = "6,2,0,91000002,6", }, [301] = {ID = 301, TeamId = 11, Count = 21, BOUNS = "0,0,0,2000,2", }, [302] = {ID = 302, TeamId = 11, Count = 22, BOUNS = "7,2,0,1,20000", }, [303] = {ID = 303, TeamId = 11, Count = 23, BOUNS = "8,2,0,70000005,20", }, [304] = {ID = 304, TeamId = 11, Count = 24, BOUNS = "9,2,0,10000001,4", }, [305] = {ID = 305, TeamId = 11, Count = 25, BOUNS = "10,2,0,2,200", }, [306] = {ID = 306, TeamId = 11, Count = 26, BOUNS = "11,2,0,10000004,15", }, [307] = {ID = 307, TeamId = 11, Count = 27, BOUNS = "12,2,0,91000002,8", }, [308] = {ID = 308, TeamId = 11, Count = 28, BOUNS = "0,0,0,2000,5", }, [309] = {ID = 309, TeamId = 12, Count = 1, BOUNS = "1,2,0,1,5000", }, [310] = {ID = 310, TeamId = 12, Count = 2, BOUNS = "2,2,0,70000005,5", }, [311] = {ID = 311, TeamId = 12, Count = 3, BOUNS = "3,2,0,10000001,1", }, [312] = {ID = 312, TeamId = 12, Count = 4, BOUNS = "4,2,0,2,50", }, [313] = {ID = 313, TeamId = 12, Count = 5, BOUNS = "5,2,0,10000004,5", }, [314] = {ID = 314, TeamId = 12, Count = 6, BOUNS = "6,2,0,91000002,2", }, [315] = {ID = 315, TeamId = 12, Count = 7, BOUNS = "0,0,0,1000,5", }, [316] = {ID = 316, TeamId = 12, Count = 8, BOUNS = "7,2,0,1,10000", }, [317] = {ID = 317, TeamId = 12, Count = 9, BOUNS = "8,2,0,70000005,10", }, [318] = {ID = 318, TeamId = 12, Count = 10, BOUNS = "9,2,0,10000001,2", }, [319] = {ID = 319, TeamId = 12, Count = 11, BOUNS = "10,2,0,2,100", }, [320] = {ID = 320, TeamId = 12, Count = 12, BOUNS = "11,2,0,10000004,8", }, [321] = {ID = 321, TeamId = 12, Count = 13, BOUNS = "12,2,0,91000002,4", }, [322] = {ID = 322, TeamId = 12, Count = 14, BOUNS = "0,0,0,2000,1", }, [323] = {ID = 323, TeamId = 12, Count = 15, BOUNS = "1,2,0,1,15000", }, [324] = {ID = 324, TeamId = 12, Count = 16, BOUNS = "2,2,0,70000005,15", }, [325] = {ID = 325, TeamId = 12, Count = 17, BOUNS = "3,2,0,10000001,3", }, [326] = {ID = 326, TeamId = 12, Count = 18, BOUNS = "4,2,0,2,150", }, [327] = {ID = 327, TeamId = 12, Count = 19, BOUNS = "5,2,0,10000004,10", }, [328] = {ID = 328, TeamId = 12, Count = 20, BOUNS = "6,2,0,91000002,6", }, [329] = {ID = 329, TeamId = 12, Count = 21, BOUNS = "0,0,0,2000,2", }, [330] = {ID = 330, TeamId = 12, Count = 22, BOUNS = "7,2,0,1,20000", }, [331] = {ID = 331, TeamId = 12, Count = 23, BOUNS = "8,2,0,70000005,20", }, [332] = {ID = 332, TeamId = 12, Count = 24, BOUNS = "9,2,0,10000001,4", }, [333] = {ID = 333, TeamId = 12, Count = 25, BOUNS = "10,2,0,2,200", }, [334] = {ID = 334, TeamId = 12, Count = 26, BOUNS = "11,2,0,10000004,15", }, [335] = {ID = 335, TeamId = 12, Count = 27, BOUNS = "12,2,0,91000002,8", }, [336] = {ID = 336, TeamId = 12, Count = 28, BOUNS = "0,0,0,2000,5", }, [337] = {ID = 337, TeamId = 13, Count = 1, BOUNS = "1,2,0,1,5000", }, [338] = {ID = 338, TeamId = 13, Count = 2, BOUNS = "2,2,0,70000005,5", }, [339] = {ID = 339, TeamId = 13, Count = 3, BOUNS = "3,2,0,10000001,1", }, [340] = {ID = 340, TeamId = 13, Count = 4, BOUNS = "4,2,0,2,50", }, [341] = {ID = 341, TeamId = 13, Count = 5, BOUNS = "5,2,0,10000004,5", }, [342] = {ID = 342, TeamId = 13, Count = 6, BOUNS = "6,2,0,91000002,2", }, [343] = {ID = 343, TeamId = 13, Count = 7, BOUNS = "0,0,0,1000,5", }, [344] = {ID = 344, TeamId = 13, Count = 8, BOUNS = "7,2,0,1,10000", }, [345] = {ID = 345, TeamId = 13, Count = 9, BOUNS = "8,2,0,70000005,10", }, [346] = {ID = 346, TeamId = 13, Count = 10, BOUNS = "9,2,0,10000001,2", }, [347] = {ID = 347, TeamId = 13, Count = 11, BOUNS = "10,2,0,2,100", }, [348] = {ID = 348, TeamId = 13, Count = 12, BOUNS = "11,2,0,10000004,8", }, [349] = {ID = 349, TeamId = 13, Count = 13, BOUNS = "12,2,0,91000002,4", }, [350] = {ID = 350, TeamId = 13, Count = 14, BOUNS = "0,0,0,2000,1", }, [351] = {ID = 351, TeamId = 13, Count = 15, BOUNS = "1,2,0,1,15000", }, [352] = {ID = 352, TeamId = 13, Count = 16, BOUNS = "2,2,0,70000005,15", }, [353] = {ID = 353, TeamId = 13, Count = 17, BOUNS = "3,2,0,10000001,3", }, [354] = {ID = 354, TeamId = 13, Count = 18, BOUNS = "4,2,0,2,150", }, [355] = {ID = 355, TeamId = 13, Count = 19, BOUNS = "5,2,0,10000004,10", }, [356] = {ID = 356, TeamId = 13, Count = 20, BOUNS = "6,2,0,91000002,6", }, [357] = {ID = 357, TeamId = 13, Count = 21, BOUNS = "0,0,0,2000,2", }, [358] = {ID = 358, TeamId = 13, Count = 22, BOUNS = "7,2,0,1,20000", }, [359] = {ID = 359, TeamId = 13, Count = 23, BOUNS = "8,2,0,70000005,20", }, [360] = {ID = 360, TeamId = 13, Count = 24, BOUNS = "9,2,0,10000001,4", }, [361] = {ID = 361, TeamId = 13, Count = 25, BOUNS = "10,2,0,2,200", }, [362] = {ID = 362, TeamId = 13, Count = 26, BOUNS = "11,2,0,10000004,15", }, [363] = {ID = 363, TeamId = 13, Count = 27, BOUNS = "12,2,0,91000002,8", }, [364] = {ID = 364, TeamId = 13, Count = 28, BOUNS = "0,0,0,2000,5", }, [365] = {ID = 365, TeamId = 14, Count = 1, BOUNS = "1,2,0,1,5000", }, [366] = {ID = 366, TeamId = 14, Count = 2, BOUNS = "2,2,0,70000005,5", }, [367] = {ID = 367, TeamId = 14, Count = 3, BOUNS = "3,2,0,10000001,1", }, [368] = {ID = 368, TeamId = 14, Count = 4, BOUNS = "4,2,0,2,50", }, [369] = {ID = 369, TeamId = 14, Count = 5, BOUNS = "5,2,0,10000004,5", }, [370] = {ID = 370, TeamId = 14, Count = 6, BOUNS = "6,2,0,91000002,2", }, [371] = {ID = 371, TeamId = 14, Count = 7, BOUNS = "0,0,0,1000,5", }, [372] = {ID = 372, TeamId = 14, Count = 8, BOUNS = "7,2,0,1,10000", }, [373] = {ID = 373, TeamId = 14, Count = 9, BOUNS = "8,2,0,70000005,10", }, [374] = {ID = 374, TeamId = 14, Count = 10, BOUNS = "9,2,0,10000001,2", }, [375] = {ID = 375, TeamId = 14, Count = 11, BOUNS = "10,2,0,2,100", }, [376] = {ID = 376, TeamId = 14, Count = 12, BOUNS = "11,2,0,10000004,8", }, [377] = {ID = 377, TeamId = 14, Count = 13, BOUNS = "12,2,0,91000002,4", }, [378] = {ID = 378, TeamId = 14, Count = 14, BOUNS = "0,0,0,2000,1", }, [379] = {ID = 379, TeamId = 14, Count = 15, BOUNS = "1,2,0,1,15000", }, [380] = {ID = 380, TeamId = 14, Count = 16, BOUNS = "2,2,0,70000005,15", }, [381] = {ID = 381, TeamId = 14, Count = 17, BOUNS = "3,2,0,10000001,3", }, [382] = {ID = 382, TeamId = 14, Count = 18, BOUNS = "4,2,0,2,150", }, [383] = {ID = 383, TeamId = 14, Count = 19, BOUNS = "5,2,0,10000004,10", }, [384] = {ID = 384, TeamId = 14, Count = 20, BOUNS = "6,2,0,91000002,6", }, [385] = {ID = 385, TeamId = 14, Count = 21, BOUNS = "0,0,0,2000,2", }, [386] = {ID = 386, TeamId = 14, Count = 22, BOUNS = "7,2,0,1,20000", }, [387] = {ID = 387, TeamId = 14, Count = 23, BOUNS = "8,2,0,70000005,20", }, [388] = {ID = 388, TeamId = 14, Count = 24, BOUNS = "9,2,0,10000001,4", }, [389] = {ID = 389, TeamId = 14, Count = 25, BOUNS = "10,2,0,2,200", }, [390] = {ID = 390, TeamId = 14, Count = 26, BOUNS = "11,2,0,10000004,15", }, [391] = {ID = 391, TeamId = 14, Count = 27, BOUNS = "12,2,0,91000002,8", }, [392] = {ID = 392, TeamId = 14, Count = 28, BOUNS = "0,0,0,2000,5", }, [393] = {ID = 393, TeamId = 15, Count = 1, BOUNS = "1,2,0,1,5000", }, [394] = {ID = 394, TeamId = 15, Count = 2, BOUNS = "2,2,0,70000005,5", }, [395] = {ID = 395, TeamId = 15, Count = 3, BOUNS = "3,2,0,10000001,1", }, [396] = {ID = 396, TeamId = 15, Count = 4, BOUNS = "4,2,0,2,50", }, [397] = {ID = 397, TeamId = 15, Count = 5, BOUNS = "5,2,0,10000004,5", }, [398] = {ID = 398, TeamId = 15, Count = 6, BOUNS = "6,2,0,91000002,2", }, [399] = {ID = 399, TeamId = 15, Count = 7, BOUNS = "0,0,0,1000,5", }, [400] = {ID = 400, TeamId = 15, Count = 8, BOUNS = "7,2,0,1,10000", }, [401] = {ID = 401, TeamId = 15, Count = 9, BOUNS = "8,2,0,70000005,10", }, [402] = {ID = 402, TeamId = 15, Count = 10, BOUNS = "9,2,0,10000001,2", }, [403] = {ID = 403, TeamId = 15, Count = 11, BOUNS = "10,2,0,2,100", }, [404] = {ID = 404, TeamId = 15, Count = 12, BOUNS = "11,2,0,10000004,8", }, [405] = {ID = 405, TeamId = 15, Count = 13, BOUNS = "12,2,0,91000002,4", }, [406] = {ID = 406, TeamId = 15, Count = 14, BOUNS = "0,0,0,2000,1", }, [407] = {ID = 407, TeamId = 15, Count = 15, BOUNS = "1,2,0,1,15000", }, [408] = {ID = 408, TeamId = 15, Count = 16, BOUNS = "2,2,0,70000005,15", }, [409] = {ID = 409, TeamId = 15, Count = 17, BOUNS = "3,2,0,10000001,3", }, [410] = {ID = 410, TeamId = 15, Count = 18, BOUNS = "4,2,0,2,150", }, [411] = {ID = 411, TeamId = 15, Count = 19, BOUNS = "5,2,0,10000004,10", }, [412] = {ID = 412, TeamId = 15, Count = 20, BOUNS = "6,2,0,91000002,6", }, [413] = {ID = 413, TeamId = 15, Count = 21, BOUNS = "0,0,0,2000,2", }, [414] = {ID = 414, TeamId = 15, Count = 22, BOUNS = "7,2,0,1,20000", }, [415] = {ID = 415, TeamId = 15, Count = 23, BOUNS = "8,2,0,70000005,20", }, [416] = {ID = 416, TeamId = 15, Count = 24, BOUNS = "9,2,0,10000001,4", }, [417] = {ID = 417, TeamId = 15, Count = 25, BOUNS = "10,2,0,2,200", }, [418] = {ID = 418, TeamId = 15, Count = 26, BOUNS = "11,2,0,10000004,15", }, [419] = {ID = 419, TeamId = 15, Count = 27, BOUNS = "12,2,0,91000002,8", }, [420] = {ID = 420, TeamId = 15, Count = 28, BOUNS = "0,0,0,2000,5", }, [421] = {ID = 421, TeamId = 16, Count = 1, BOUNS = "1,2,0,1,5000", }, [422] = {ID = 422, TeamId = 16, Count = 2, BOUNS = "2,2,0,70000005,5", }, [423] = {ID = 423, TeamId = 16, Count = 3, BOUNS = "3,2,0,10000001,1", }, [424] = {ID = 424, TeamId = 16, Count = 4, BOUNS = "4,2,0,2,50", }, [425] = {ID = 425, TeamId = 16, Count = 5, BOUNS = "5,2,0,10000004,5", }, [426] = {ID = 426, TeamId = 16, Count = 6, BOUNS = "6,2,0,91000002,2", }, [427] = {ID = 427, TeamId = 16, Count = 7, BOUNS = "0,0,0,1000,5", }, [428] = {ID = 428, TeamId = 16, Count = 8, BOUNS = "7,2,0,1,10000", }, [429] = {ID = 429, TeamId = 16, Count = 9, BOUNS = "8,2,0,70000005,10", }, [430] = {ID = 430, TeamId = 16, Count = 10, BOUNS = "9,2,0,10000001,2", }, [431] = {ID = 431, TeamId = 16, Count = 11, BOUNS = "10,2,0,2,100", }, [432] = {ID = 432, TeamId = 16, Count = 12, BOUNS = "11,2,0,10000004,8", }, [433] = {ID = 433, TeamId = 16, Count = 13, BOUNS = "12,2,0,91000002,4", }, [434] = {ID = 434, TeamId = 16, Count = 14, BOUNS = "0,0,0,2000,1", }, [435] = {ID = 435, TeamId = 16, Count = 15, BOUNS = "1,2,0,1,15000", }, [436] = {ID = 436, TeamId = 16, Count = 16, BOUNS = "2,2,0,70000005,15", }, [437] = {ID = 437, TeamId = 16, Count = 17, BOUNS = "3,2,0,10000001,3", }, [438] = {ID = 438, TeamId = 16, Count = 18, BOUNS = "4,2,0,2,150", }, [439] = {ID = 439, TeamId = 16, Count = 19, BOUNS = "5,2,0,10000004,10", }, [440] = {ID = 440, TeamId = 16, Count = 20, BOUNS = "6,2,0,91000002,6", }, [441] = {ID = 441, TeamId = 16, Count = 21, BOUNS = "0,0,0,2000,2", }, [442] = {ID = 442, TeamId = 16, Count = 22, BOUNS = "7,2,0,1,20000", }, [443] = {ID = 443, TeamId = 16, Count = 23, BOUNS = "8,2,0,70000005,20", }, [444] = {ID = 444, TeamId = 16, Count = 24, BOUNS = "9,2,0,10000001,4", }, [445] = {ID = 445, TeamId = 16, Count = 25, BOUNS = "10,2,0,2,200", }, [446] = {ID = 446, TeamId = 16, Count = 26, BOUNS = "11,2,0,10000004,15", }, [447] = {ID = 447, TeamId = 16, Count = 27, BOUNS = "12,2,0,91000002,8", }, [448] = {ID = 448, TeamId = 16, Count = 28, BOUNS = "0,0,0,2000,5", }, [449] = {ID = 449, TeamId = 17, Count = 1, BOUNS = "1,2,0,1,5000", }, [450] = {ID = 450, TeamId = 17, Count = 2, BOUNS = "2,2,0,70000005,5", }, [451] = {ID = 451, TeamId = 17, Count = 3, BOUNS = "3,2,0,10000001,1", }, [452] = {ID = 452, TeamId = 17, Count = 4, BOUNS = "4,2,0,2,50", }, [453] = {ID = 453, TeamId = 17, Count = 5, BOUNS = "5,2,0,10000004,5", }, [454] = {ID = 454, TeamId = 17, Count = 6, BOUNS = "6,2,0,91000002,2", }, [455] = {ID = 455, TeamId = 17, Count = 7, BOUNS = "0,0,0,1000,5", }, [456] = {ID = 456, TeamId = 17, Count = 8, BOUNS = "7,2,0,1,10000", }, [457] = {ID = 457, TeamId = 17, Count = 9, BOUNS = "8,2,0,70000005,10", }, [458] = {ID = 458, TeamId = 17, Count = 10, BOUNS = "9,2,0,10000001,2", }, [459] = {ID = 459, TeamId = 17, Count = 11, BOUNS = "10,2,0,2,100", }, [460] = {ID = 460, TeamId = 17, Count = 12, BOUNS = "11,2,0,10000004,8", }, [461] = {ID = 461, TeamId = 17, Count = 13, BOUNS = "12,2,0,91000002,4", }, [462] = {ID = 462, TeamId = 17, Count = 14, BOUNS = "0,0,0,2000,1", }, [463] = {ID = 463, TeamId = 17, Count = 15, BOUNS = "1,2,0,1,15000", }, [464] = {ID = 464, TeamId = 17, Count = 16, BOUNS = "2,2,0,70000005,15", }, [465] = {ID = 465, TeamId = 17, Count = 17, BOUNS = "3,2,0,10000001,3", }, [466] = {ID = 466, TeamId = 17, Count = 18, BOUNS = "4,2,0,2,150", }, [467] = {ID = 467, TeamId = 17, Count = 19, BOUNS = "5,2,0,10000004,10", }, [468] = {ID = 468, TeamId = 17, Count = 20, BOUNS = "6,2,0,91000002,6", }, [469] = {ID = 469, TeamId = 17, Count = 21, BOUNS = "0,0,0,2000,2", }, [470] = {ID = 470, TeamId = 17, Count = 22, BOUNS = "7,2,0,1,20000", }, [471] = {ID = 471, TeamId = 17, Count = 23, BOUNS = "8,2,0,70000005,20", }, [472] = {ID = 472, TeamId = 17, Count = 24, BOUNS = "9,2,0,10000001,4", }, [473] = {ID = 473, TeamId = 17, Count = 25, BOUNS = "10,2,0,2,200", }, [474] = {ID = 474, TeamId = 17, Count = 26, BOUNS = "11,2,0,10000004,15", }, [475] = {ID = 475, TeamId = 17, Count = 27, BOUNS = "12,2,0,91000002,8", }, [476] = {ID = 476, TeamId = 17, Count = 28, BOUNS = "0,0,0,2000,5", }, [477] = {ID = 477, TeamId = 18, Count = 1, BOUNS = "1,2,0,1,5000", }, [478] = {ID = 478, TeamId = 18, Count = 2, BOUNS = "2,2,0,70000005,5", }, [479] = {ID = 479, TeamId = 18, Count = 3, BOUNS = "3,2,0,10000001,1", }, [480] = {ID = 480, TeamId = 18, Count = 4, BOUNS = "4,2,0,2,50", }, [481] = {ID = 481, TeamId = 18, Count = 5, BOUNS = "5,2,0,10000004,5", }, [482] = {ID = 482, TeamId = 18, Count = 6, BOUNS = "6,2,0,91000002,2", }, [483] = {ID = 483, TeamId = 18, Count = 7, BOUNS = "0,0,0,1000,5", }, [484] = {ID = 484, TeamId = 18, Count = 8, BOUNS = "7,2,0,1,10000", }, [485] = {ID = 485, TeamId = 18, Count = 9, BOUNS = "8,2,0,70000005,10", }, [486] = {ID = 486, TeamId = 18, Count = 10, BOUNS = "9,2,0,10000001,2", }, [487] = {ID = 487, TeamId = 18, Count = 11, BOUNS = "10,2,0,2,100", }, [488] = {ID = 488, TeamId = 18, Count = 12, BOUNS = "11,2,0,10000004,8", }, [489] = {ID = 489, TeamId = 18, Count = 13, BOUNS = "12,2,0,91000002,4", }, [490] = {ID = 490, TeamId = 18, Count = 14, BOUNS = "0,0,0,2000,1", }, [491] = {ID = 491, TeamId = 18, Count = 15, BOUNS = "1,2,0,1,15000", }, [492] = {ID = 492, TeamId = 18, Count = 16, BOUNS = "2,2,0,70000005,15", }, [493] = {ID = 493, TeamId = 18, Count = 17, BOUNS = "3,2,0,10000001,3", }, [494] = {ID = 494, TeamId = 18, Count = 18, BOUNS = "4,2,0,2,150", }, [495] = {ID = 495, TeamId = 18, Count = 19, BOUNS = "5,2,0,10000004,10", }, [496] = {ID = 496, TeamId = 18, Count = 20, BOUNS = "6,2,0,91000002,6", }, [497] = {ID = 497, TeamId = 18, Count = 21, BOUNS = "0,0,0,2000,2", }, [498] = {ID = 498, TeamId = 18, Count = 22, BOUNS = "7,2,0,1,20000", }, [499] = {ID = 499, TeamId = 18, Count = 23, BOUNS = "8,2,0,70000005,20", }, [500] = {ID = 500, TeamId = 18, Count = 24, BOUNS = "9,2,0,10000001,4", }, [501] = {ID = 501, TeamId = 18, Count = 25, BOUNS = "10,2,0,2,200", }, [502] = {ID = 502, TeamId = 18, Count = 26, BOUNS = "11,2,0,10000004,15", }, [503] = {ID = 503, TeamId = 18, Count = 27, BOUNS = "12,2,0,91000002,8", }, [504] = {ID = 504, TeamId = 18, Count = 28, BOUNS = "0,0,0,2000,5", }, [505] = {ID = 505, TeamId = 19, Count = 1, BOUNS = "1,2,0,1,5000", }, [506] = {ID = 506, TeamId = 19, Count = 2, BOUNS = "2,2,0,70000005,5", }, [507] = {ID = 507, TeamId = 19, Count = 3, BOUNS = "3,2,0,10000001,1", }, [508] = {ID = 508, TeamId = 19, Count = 4, BOUNS = "4,2,0,2,50", }, [509] = {ID = 509, TeamId = 19, Count = 5, BOUNS = "5,2,0,10000004,5", }, [510] = {ID = 510, TeamId = 19, Count = 6, BOUNS = "6,2,0,91000002,2", }, [511] = {ID = 511, TeamId = 19, Count = 7, BOUNS = "0,0,0,1000,5", }, [512] = {ID = 512, TeamId = 19, Count = 8, BOUNS = "7,2,0,1,10000", }, [513] = {ID = 513, TeamId = 19, Count = 9, BOUNS = "8,2,0,70000005,10", }, [514] = {ID = 514, TeamId = 19, Count = 10, BOUNS = "9,2,0,10000001,2", }, [515] = {ID = 515, TeamId = 19, Count = 11, BOUNS = "10,2,0,2,100", }, [516] = {ID = 516, TeamId = 19, Count = 12, BOUNS = "11,2,0,10000004,8", }, [517] = {ID = 517, TeamId = 19, Count = 13, BOUNS = "12,2,0,91000002,4", }, [518] = {ID = 518, TeamId = 19, Count = 14, BOUNS = "0,0,0,2000,1", }, [519] = {ID = 519, TeamId = 19, Count = 15, BOUNS = "1,2,0,1,15000", }, [520] = {ID = 520, TeamId = 19, Count = 16, BOUNS = "2,2,0,70000005,15", }, [521] = {ID = 521, TeamId = 19, Count = 17, BOUNS = "3,2,0,10000001,3", }, [522] = {ID = 522, TeamId = 19, Count = 18, BOUNS = "4,2,0,2,150", }, [523] = {ID = 523, TeamId = 19, Count = 19, BOUNS = "5,2,0,10000004,10", }, [524] = {ID = 524, TeamId = 19, Count = 20, BOUNS = "6,2,0,91000002,6", }, [525] = {ID = 525, TeamId = 19, Count = 21, BOUNS = "0,0,0,2000,2", }, [526] = {ID = 526, TeamId = 19, Count = 22, BOUNS = "7,2,0,1,20000", }, [527] = {ID = 527, TeamId = 19, Count = 23, BOUNS = "8,2,0,70000005,20", }, [528] = {ID = 528, TeamId = 19, Count = 24, BOUNS = "9,2,0,10000001,4", }, [529] = {ID = 529, TeamId = 19, Count = 25, BOUNS = "10,2,0,2,200", }, [530] = {ID = 530, TeamId = 19, Count = 26, BOUNS = "11,2,0,10000004,15", }, [531] = {ID = 531, TeamId = 19, Count = 27, BOUNS = "12,2,0,91000002,8", }, [532] = {ID = 532, TeamId = 19, Count = 28, BOUNS = "0,0,0,2000,5", }, [533] = {ID = 533, TeamId = 20, Count = 1, BOUNS = "1,2,0,1,5000", }, [534] = {ID = 534, TeamId = 20, Count = 2, BOUNS = "2,2,0,70000005,5", }, [535] = {ID = 535, TeamId = 20, Count = 3, BOUNS = "3,2,0,10000001,1", }, [536] = {ID = 536, TeamId = 20, Count = 4, BOUNS = "4,2,0,2,50", }, [537] = {ID = 537, TeamId = 20, Count = 5, BOUNS = "5,2,0,10000004,5", }, [538] = {ID = 538, TeamId = 20, Count = 6, BOUNS = "6,2,0,91000002,2", }, [539] = {ID = 539, TeamId = 20, Count = 7, BOUNS = "0,0,0,1000,5", }, [540] = {ID = 540, TeamId = 20, Count = 8, BOUNS = "7,2,0,1,10000", }, [541] = {ID = 541, TeamId = 20, Count = 9, BOUNS = "8,2,0,70000005,10", }, [542] = {ID = 542, TeamId = 20, Count = 10, BOUNS = "9,2,0,10000001,2", }, [543] = {ID = 543, TeamId = 20, Count = 11, BOUNS = "10,2,0,2,100", }, [544] = {ID = 544, TeamId = 20, Count = 12, BOUNS = "11,2,0,10000004,8", }, [545] = {ID = 545, TeamId = 20, Count = 13, BOUNS = "12,2,0,91000002,4", }, [546] = {ID = 546, TeamId = 20, Count = 14, BOUNS = "0,0,0,2000,1", }, [547] = {ID = 547, TeamId = 20, Count = 15, BOUNS = "1,2,0,1,15000", }, [548] = {ID = 548, TeamId = 20, Count = 16, BOUNS = "2,2,0,70000005,15", }, [549] = {ID = 549, TeamId = 20, Count = 17, BOUNS = "3,2,0,10000001,3", }, [550] = {ID = 550, TeamId = 20, Count = 18, BOUNS = "4,2,0,2,150", }, [551] = {ID = 551, TeamId = 20, Count = 19, BOUNS = "5,2,0,10000004,10", }, [552] = {ID = 552, TeamId = 20, Count = 20, BOUNS = "6,2,0,91000002,6", }, [553] = {ID = 553, TeamId = 20, Count = 21, BOUNS = "0,0,0,2000,2", }, [554] = {ID = 554, TeamId = 20, Count = 22, BOUNS = "7,2,0,1,20000", }, [555] = {ID = 555, TeamId = 20, Count = 23, BOUNS = "8,2,0,70000005,20", }, [556] = {ID = 556, TeamId = 20, Count = 24, BOUNS = "9,2,0,10000001,4", }, [557] = {ID = 557, TeamId = 20, Count = 25, BOUNS = "10,2,0,2,200", }, [558] = {ID = 558, TeamId = 20, Count = 26, BOUNS = "11,2,0,10000004,15", }, [559] = {ID = 559, TeamId = 20, Count = 27, BOUNS = "12,2,0,91000002,8", }, [560] = {ID = 560, TeamId = 20, Count = 28, BOUNS = "0,0,0,2000,5", } } return Festival_Sign_Base
local path = (...):gsub('%.[^%.]+$', '') -- back it up, back it up, back it up... path = path:sub(1,path:match("^.*()%.")) local Class = require(path.."thirdparty.hump.class") local cpml = require(path.."thirdparty.cpml") local lume = require(path.."thirdparty.lume") local patchy = require(path.."thirdparty.patchy") local Initial = require(path.."properties.initial") local Element = Class {} local function get_opacity(element, opacity) if not element then return opacity end local opacity = (opacity or 1) * element.properties.opacity return get_opacity(element.parent, opacity) end local function set_properties(new_properties, properties) if not new_properties then return properties end local properties = properties or {} for k in pairs(new_properties) do properties[k] = new_properties[k] end return properties end function Element:init(element, parent, gui) self.gui = gui self.focus = false self.hover = false self.entered = false self.enabled = true self.type = element[1] self.value = "" self.parent = parent or false self.position = cpml.vec2(0, 0) self.scroll_position = cpml.vec2(0, 0) -- dp scrolled self.element_position = {} self.border_position = {} self.content_position = {} self.offset = {} self.scissor = {} self.stencil = {} self.children = {} self.styles = {} self.default_properties = { display = "inline", visible = true, position = "default", overflow = "visible", opacity = 1, -- TOP, RIGHT, BOTTOM, LEFT margin = 0, border = 0, padding = 0, -- Flex Container flex_direction = "row", flex_wrap = "none", justify_content = "start", align_items = "stretch", align_content = "stretch", -- Flex Item order = 1, flex_grow = 0, flex_shrink = 0, flex_basis = "auto", align_self = "auto", -- Font font_path = "default", font_size = 12, line_height = 1, text_align = "left", text_shadow = false, -- Color border_color = { 255, 255, 255, 255 }, text_color = { 255, 255, 255, 255 }, text_shadow_color = { 0, 0, 0, 255 }, } self.custom_properties = {} self.properties = {} for k, v in pairs(element) do if type(k) == "string" then self[k] = v end end if self.value == "" and type(element[2]) ~= "table" then self.value = element[2] end if type(element.class) ~= "table" then self.class = { element.class } else self.class = element.class end self.update = self.default_update self.draw = self.default_draw self.on_focus = self.default_on_focus self.on_focus_leave = self.default_on_focus_leave end function Element:default_update(dt) local ep = self.properties self:_set_position() -- Position start & end of element local x, y, w, h, ox, oy = self:_get_position("element") -- Border start & end of element local bx, by, bw, bh = self:_get_position("border") -- Content start & end of element local cx, cy, cw, ch = self:_get_position("content") local sw, sh = cw, ch if overflow_x == "visible" then sw = self.gui.width - cx end if overflow_y == "visible" then sh = self.gui.height - cy end local opacity = get_opacity(self) -- If we have a border radius, set this to true local stencil_set = false -- Set clip space to element bounds self:_set_scissor("element", self.parent, x, y, w, h, ox, oy) self:_set_scissor("border", self.parent, bx, by, bw, bh, ox, oy) self:_set_scissor("content", self.parent, cx, cy, sw, sh, ox, oy) -- Set Border Radius stencil if ep.border_top_left_radius or ep.border_top_right_radius or ep.border_bottom_right_radius or ep.border_bottom_left_radius then local tl = ep.border_top_left_radius or 0 local tr = ep.border_top_right_radius or 0 local br = ep.border_bottom_right_radius or 0 local bl = ep.border_bottom_left_radius or 0 self:_set_stencil(x, y, w, h, 25, tl, tr, br, bl) end end function Element:default_draw() --[[ ~~ BOX MODEL ~~ { WIDTH } +---------------------------------------+ | MARGIN | | +-------------------------------+ | ~~~ | |/////////// BORDER ////////////| | | |///+-----------------------+///| | | |///| PADDING |///| | H | |///| +---------------+ |///| | E | |///| | | |///| | I | |///| | CONTENT | |///| | G | |///| | | |///| | H | |///| +---------------+ |///| | T | |///| PADDING |///| | | |///+-----------------------+///| | | |/////////// BORDER ////////////| | | +-------------------------------+ | ~~~ | MARGIN | +---------------------------------------+ { WIDTH } --]] local cc = self.gui.srgb and love.math.gammaToLinear or function(...) return ... end local ep = self.properties -- Position start & end of element local x, y, w, h, ox, oy = self:_get_position("element") -- Border start & end of element local bx, by, bw, bh = self:_get_position("border") -- Content start & end of element local cx, cy, cw, ch = self:_get_position("content") local opacity = get_opacity(self) -- If we have a border radius, set this to true local stencil_set = false -- Set clip space to element bounds love.graphics.setScissor(self:_get_scissor("element")) -- Set Border Radius stencil if ep.border_top_left_radius or ep.border_top_right_radius or ep.border_bottom_right_radius or ep.border_bottom_left_radius then love.graphics.setStencil(self:_get_stencil()) stencil_set = true end -- Draw Background if ep.background_color then local lr, lg, lb = cc(ep.background_color) love.graphics.setColor(lr, lg, lb, (ep.background_color[4] or 255)*opacity) love.graphics.rectangle("fill", bx, by, bw, bh) love.graphics.setColor(cc(255, 255, 255, 255*opacity)) end -- Draw Background Image if ep.background_image then local bix, biy = x, y local biw, bih -- If 9patch image if ep.background_image.type == "9patch" then biw, bih = w, h else biw, bih = ep.background_image:getDimensions() end -- Set Background Offset if ep.background_position then bix = bix + ep.background_position[1] biy = biy + ep.background_position[2] end -- Set Background Size if ep.background_size then if ep.background_size[1] < biw then bw = ep.background_size[1] end if ep.background_size[2] < bih then bh = ep.background_size[2] end end if ep.background_image_color then local lr, lg, lb = cc(ep.background_image_color) love.graphics.setColor(lr, lg, lb, (ep.background_image_color[4] or 255)*opacity) end -- If 9patch image if ep.background_image.type == "9patch" then ep.background_image:draw(bix, biy, biw, bih) else love.graphics.draw(ep.background_image, bix, biy) end end -- Draw Border (Top) if ep.border_top > 0 then local y = y + ep.border_top / 2 local lr, lg, lb = cc(ep.border_top_color) love.graphics.setColor(lr, lg, lb, (ep.border_top_color[4] or 255)*opacity) love.graphics.setLineWidth(ep.border_top) love.graphics.line(x, y, x+w, y) end -- Draw Border (Right) if ep.border_right > 0 then local x = x - ep.border_right / 2 local lr, lg, lb = cc(ep.border_right_color) love.graphics.setColor(lr, lg, lb, (ep.border_right_color[4] or 255)*opacity) love.graphics.setLineWidth(ep.border_right) love.graphics.line(x+w, y, x+w, y+h) end -- Draw Border (Bottom) if ep.border_bottom > 0 then local y = y - ep.border_bottom / 2 local lr, lg, lb = cc(ep.border_bottom_color) love.graphics.setColor(lr, lg, lb, (ep.border_bottom_color[4] or 255)*opacity) love.graphics.setLineWidth(ep.border_bottom) love.graphics.line(x+w, y+h, x, y+h) end -- Draw Border (Left) if ep.border_left > 0 then local x = x + ep.border_left / 2 local lr, lg, lb = cc(ep.border_left_color) love.graphics.setColor(lr, lg, lb, (ep.border_left_color[4] or 255)*opacity) love.graphics.setLineWidth(ep.border_left) love.graphics.line(x, y+h, x, y) end -- Draw Image if ep.image then -- Set clip space to border bounds love.graphics.setScissor(self:_get_scissor("border")) love.graphics.setColor(cc(255, 255, 255, 255*opacity)) love.graphics.draw(ep.image, x, y) end -- Set clip space to content bounds local overflow_x, overflow_y, parent = self:_get_overflow() -- Draw Text if self.value then -- Set clip space to content bounds love.graphics.setScissor(self:_get_scissor("content")) -- Set Manipulatable Text local value = tostring(self.value) -- Set Font if ep.font then love.graphics.setFont(ep.font) end -- Set Line Height local line_height = ep.font:getLineHeight() ep.font:setLineHeight(ep.line_height) -- Set Text Offset local text_offset = cy + (ep.font:getHeight() * ep.font:getLineHeight() - ep.font:getHeight()) / 2 -- Set Text Transform if ep.text_transform == "uppercase" then value = value:upper() elseif ep.text_transform == "lowercase" then value = value:lower() elseif ep.text_transform == "capitalize" then value = value:lower():gsub("(%a)([%w_']*)", function(a,b) return a:upper()..b:lower() end) end -- Overflow Text local overflow = cw if ep.overflow_y == "hidden" or ep.overflow_y == "scroll" then overflow = ep.font:getWidth(self.value) end local scrollx = cx + self.scroll_position.x --local scrolly = cy + self.scroll_position.y -- Set Text Shadow if ep.text_shadow then local lr, lg, lb = cc(ep.text_shadow_color) love.graphics.setColor(lr, lg, lb, (ep.text_shadow_color[4] or 255)*opacity) love.graphics.printf(value, scrollx + ep.text_shadow[1], text_offset + ep.text_shadow[2], (overflow >= 0 and overflow or 0), ep.text_align) end -- Set Text Color if ep.text_color then local lr, lg, lb = cc(ep.text_color) love.graphics.setColor(lr, lg, lb, (ep.text_color[4] or 255)*opacity) end -- Print text love.graphics.printf(value, scrollx, text_offset, (overflow >= 0 and overflow or 0), ep.text_align) ep.font:setLineHeight(line_height) end -- Reset Stencil if stencil_set then love.graphics.setStencil() end -- DEBUG if self.gui._debug then love.graphics.setScissor() love.graphics.setColor(cc(255, 0, 0, 191)) love.graphics.rectangle("line", x-ep.margin_left, y-ep.margin_top, w+ep.margin_left+ep.margin_right, h+ep.margin_top+ep.margin_bottom) love.graphics.setColor(cc(0, 0, 255, 191)) love.graphics.rectangle("line", cx, cy, cw, ch) love.graphics.setColor(cc(255, 255, 255, 255)) end -- DEBUG love.graphics.setColor(255, 255, 255, 255) end function Element:default_on_focus() self.focus = true end function Element:default_on_focus_leave() self.focus = false end function Element:default_on_mouse_scrolled(button) local overflow_x, overflow_y, parent = self:_get_overflow() if overflow_y ~= "scroll" then return end local ep = self.properties local cx, cy, cw, ch = self:_get_content_position() local csw, csh = self:_get_content_size() local scroll_size_y = -csh + ch if ch >= csh then return end if button == "wd" then self.scroll_position.y = self.scroll_position.y - 30 if self.scroll_position.y < scroll_size_y then self.scroll_position.y = scroll_size_y end end if button == "wu" then self.scroll_position.y = self.scroll_position.y + 30 if self.scroll_position.y > 0 then self.scroll_position.y = 0 end end end function Element:is_enabled() return self.enabled end function Element:enable() self.enabled = true end function Element:disable() self.enabled = false end function Element:has_class(class) for _, c in ipairs(self.class) do if c == class then return true end end return false end function Element:add_class(class) if type(class) == "string" then table.insert(self.class, class) end end function Element:remove_class(class) if type(class) == "string" then for k, v in ipairs(self.class) do if class == v then table.remove(self.class, k) end end end end function Element:has_property(property) return self.properties[property] ~= nil end function Element:get_property(property) return self.properties[property] end function Element:set_property(property, value) self.properties[property] = value self.custom_properties[property] = value end function Element:remove_property(property) self.properties[property] = nil end function Element:has_children() return #self.children > 0 end function Element:prepend_child(element) return self:add_child(element, 1) end function Element:append_child(element) return self:add_child(element) end function Element:add_child(element, position) -- Detatch from current parent if element.parent and element.parent ~= self then element:detatch() end element.parent = self -- If we inserted the element into a specific slot, then we put it there -- If there is no specified position, we append it at the end if type(position) == "number" then if position > #self.children then position = #self.children + 1 end if position < 1 then position = 1 end table.insert(self.children, position, element) else table.insert(self.children, element) end return self end function Element:remove_child(element) return self:replace_child(element) end function Element:replace_child(old, new) local child -- If we want to replace a child via position, verify position is within bounds if type(old) == "number" then if #self.children == 0 or old < 1 or old > #self.children then error("Invalid position: "..old..".") end child = self.children[old] child:destroy() if new then table.insert(self.children, old, new) end else if old.parent ~= self then error("Element does not belong to this parent.") end local position = old:_get_sibling_position() child = old child:destroy() if new then table.insert(self.children, position, new) end end return self end function Element:insert_before(element) if not element.parent then error("Element does not have a parent.") end local position = element:_get_sibling_position() if position < 1 then position = 1 end element.parent:add_child(self, position) return self end function Element:insert_after(element) if not element.parent then error("Element does not have a parent.") end -- If element has a sibling after it, simply call insert_before() on that sibling! -- Otherwise just append to element's parent if element:next_sibling() then self:insert_before(element:next_sibling()) else element.parent:append_child(self) end return self end function Element:attach(element, position) element:add_child(self, position) -- Remove self from draw stack for k, e in ipairs(self.gui.draw_order) do if self == e then table.remove(self.gui.draw_order, k) break end end end function Element:detach() if not self.parent then error("No parent to detatch from.") end table.insert(self.gui.draw_order, self) table.remove(self.parent.children, self:_get_sibling_position()) self.parent = false return self end -- We cannot use ipairs here because destroying -- an element in order will mess up the ipairs -- and not give the best results. Instead we -- use Lume's r[everse]ipairs function to solve -- this problem. function Element:destroy() -- Loop recursively through all children for _, child in lume.ripairs(self.children) do child:destroy() end if self.parent then -- Remove self from parent table.remove(self.parent.children, self:_get_sibling_position()) self.parent = false else -- Remove self from draw stack for k, e in ipairs(self.gui.draw_order) do if self == e then table.remove(self.gui.draw_order, k) break end end end -- Goodbye, cruel world. -- I'm leaving you today. -- Goodbye... -- Goodbye... -- Goodbye. end function Element:destroy_children() for _, child in lume.ripairs(self.children) do child:destroy() end end function Element:clone(deep, parent) local clone = self.gui:new_element(self.type) clone.value = self.value -- Clone classes for _, class in ipairs(self.class) do table.insert(clone.class, class) end -- Clone properties for k, property in pairs(self.properties) do -- Some properties such as margin and padding are tables if type(property) == "table" then clone.properties[k] = {} for i, p in pairs(property) do clone.properties[k][i] = p end else clone.properties[k] = property end end -- Deep clone all children if deep then for _, child in ipairs(self.children) do child:clone(deep, clone) end end if parent then -- Add self to parent parent:add_child(clone) else -- Add self to draw stack table.insert(self.gui.draw_order, clone) end return clone end function Element:first_child() if #self.children > 0 then return self.children[1] end return false end function Element:last_child() if #self.children > 0 then return self.children[#self.children] end return false end function Element:previous_sibling() local position = self:_get_sibling_position() if position then local prev = position - 1 if prev > 0 then return self.parent.children[prev] end end return false end function Element:next_sibling() local position = self:_get_sibling_position() if position then local nxt = position + 1 if nxt <= #self.parent.children then return self.parent.children[nxt] end end return false end function Element:is_descendant(element) if self.parent then if self.parent == element then return true else return Element.is_descendant(self.parent, element) end else return false end end function Element:bring_to_front() if not self.parent then for k, element in ipairs(self.gui.draw_order) do if self == element then table.remove(self.gui.draw_order, k) table.insert(self.gui.draw_order, self) break end end else self.parent:bring_to_front() end end function Element:send_to_back() if not self.parent then for k, element in ipairs(self.gui.draw_order) do if self == element then table.remove(self.gui.draw_order, k) table.insert(self.gui.draw_order, self, 1) break end end else self.parent:send_to_back() end end function Element:set_index(index) if not self.parent then for k, element in ipairs(self.gui.draw_order) do if self == element then table.remove(self.gui.draw_order, k) table.insert(self.gui.draw_order, self, index) break end end else self.parent:set_index(index) end end function Element:exchange_with(index) if not self.parent then for k, element in ipairs(self.gui.draw_order) do if self == element then local exchange = self.gui.draw_order[index] table.remove(self.gui.draw_order, k) table.insert(self.gui.draw_order, exchange, k) table.remove(self.gui.draw_order, index) table.insert(self.gui.draw_order, self, index) break end end else self.parent:exchange_with(index) end end function Element:is_binding(x, y) if not self.visible then return end local ex, ey, ew, eh = self:_get_position("element") -- Delay for 1 frame if not ex or not ey or not ew or not eh then return false end if ex <= x and ex + ew >= x and ey <= y and ey + eh >= y then return true end return false end function Element:is_content_binding(x, y) if not self.visible then return end local cx, cy, cw, ch = self:_get_position("content") -- Delay for 1 frame if not cx or not cy or not cw or not ch then return false end if cx <= x and cx + cw >= x and cy <= y and cy + ch >= y then return true end return false end function Element:scroll_into_view() -- If parent is scrollable, scroll it so that self is visible -- Self should be wholy visible or if too large, the top should match parent's top end function Element:_get_sibling_position() if self.parent then for k, child in ipairs(self.parent.children) do if child == self then return k end end end return false end function Element._get_relative_position(element, ox, oy) if not element then return ox, oy end local ep = element.properties ox = ox or 0 oy = oy or 0 if ep.position == "relative" then ox = ox + (ep.left or 0) - (ep.right or 0) oy = oy + (ep.top or 0) - (ep.bottom or 0) end return Element._get_relative_position(element.parent, ox, oy) end function Element:_set_position() local ep = self.properties self.offset.x, self.offset.y = self:_get_relative_position() self.element_position.x = self.position.x + self.offset.x self.element_position.y = self.position.y + self.offset.y self.element_position.w = ep.width self.element_position.h = ep.height self.border_position.x = self.element_position.x + ep.border_left + (self.offset.x or 0) self.border_position.y = self.element_position.y + ep.border_top + (self.offset.y or 0) self.border_position.w = self.element_position.w - ep.border_left - ep.border_right self.border_position.h = self.element_position.h - ep.border_top - ep.border_bottom self.content_position.x = self.border_position.x + ep.padding_left self.content_position.y = self.border_position.y + ep.padding_top self.content_position.w = self.border_position.w - ep.padding_left - ep.padding_right self.content_position.h = self.border_position.h - ep.padding_top - ep.padding_bottom end function Element:_get_position(layer) layer = layer .. "_position" return self[layer].x, self[layer].y, self[layer].w, self[layer].h, self.offset.x, self.offset.y end function Element:_get_content_size() local w, h = 0, 0 for _, element in ipairs(self.children) do local ep = element.properties if ep.position == "default" or ep.position == "relative" then local ew = ep.width + ep.margin_left + ep.margin_right if w < ew then w = ew end h = h + ep.height + ep.margin_top + ep.margin_bottom end end return w, h end function Element._get_overflow(self) if not self then return "visible", "visible" end if self.properties.overflow_x ~= "visible" or self.properties.overflow_y ~= "visible" then return self.properties.overflow_x, self.properties.overflow_y, self end return Element._get_overflow(self.parent) end function Element:_get_scissor(layer) assert(self.scissor[layer], "Scissor layer \"" .. layer .. "\" hasn't been set yet.") return self.scissor[layer].x, self.scissor[layer].y, self.scissor[layer].w, self.scissor[layer].h end function Element:_set_scissor(layer, parent, x, y, w, h, ox, oy) local sx, sy, sw, sh = x, y, w, h if parent then local pp = parent.properties local cx, cy, cw, ch = parent:_get_position("content") if sx < cx then sx = cx end if sy < cy then sy = cy end if sx + sw - cx > cw then sw = sw - ((sx + sw) - (cx + cw)) end if sy + sh - cy > ch then sh = sh - ((sy + sh) - (cy + ch)) end end if sw < 0 then sw = 0 end if sh < 0 then sh = 0 end if not self.scissor[layer] then self.scissor[layer] = {} end self.scissor[layer].x = sx self.scissor[layer].y = sy self.scissor[layer].w = sw self.scissor[layer].h = sh end function Element:_get_stencil() return function() love.graphics.polygon("fill", self.stencil) end end -- https://gist.github.com/gvx/9072860 -- memoize caches results from a function given a specific set of args -- get_stencil_clip does a bunch of heavy math to gather a list of vertices -- and benefits significantly from caching Element._set_stencil = lume.memoize(function (self, x, y, w, h, precision, tl, tr, br, bl) local corners = { tl, tr, br, bl } local polygon = {} -- true if on x/y, false if on w/h; TL, TR, BR, BL local xs = { true, false, false, true } local ys = { true, true, false, false } -- Loop through each corner and calculate points based on [r]adius! for i, r in ipairs(corners) do if r == 0 then table.insert(polygon, xs[i] and x or x+w) table.insert(polygon, ys[i] and y or y+h) else for j = 0, precision do local angle = (j / precision + (i - 3)) * math.pi / 2 table.insert(polygon, (xs[i] and x+r or x+w-r) + r * math.cos(angle)) table.insert(polygon, (ys[i] and y+r or y+h-r) + r * math.sin(angle)) end end end self.stencil = polygon end) function Element:apply_styles() local ep = self.properties local function check_percent(value, axis) if type(value) == "string" and value:sub(-1) == "%" then value = tonumber(value:sub(1, -2)) / 100 if value then local px = 0 local py = 0 local pw = self.width local ph = self.height if element.parent then px, py, pw, ph = self.parent:_get_content_position() end if axis == "x" then value = value * pw elseif axis == "y" then value = value * ph end end end return value end local function check_property(property, value, axis) ep[property] = check_percent(value, axis) end local function check_vec2(property, value) ep[property] = { check_percent(value[1], "x"), check_percent(value[2], "y"), } end -- Expand margin/border/padding to longform local function expand_box(property, value) local top = string.format("%s_top", property) local right = string.format("%s_right", property) local bottom = string.format("%s_bottom", property) local left = string.format("%s_left", property) if type(value) == "number" or type(value) == "string" then ep[top] = check_percent(value, "y") ep[right] = check_percent(value, "x") ep[bottom] = check_percent(value, "y") ep[left] = check_percent(value, "x") elseif #value == 1 then ep[top] = check_percent(value[1], "y") ep[right] = check_percent(value[1], "x") ep[bottom] = check_percent(value[1], "y") ep[left] = check_percent(value[1], "x") elseif #value == 2 then ep[top] = check_percent(value[1], "y") ep[right] = check_percent(value[2], "x") ep[bottom] = check_percent(value[1], "y") ep[left] = check_percent(value[2], "x") else ep[top] = check_percent(value[1], "y") ep[right] = check_percent(value[2], "x") ep[bottom] = check_percent(value[3], "y") ep[left] = check_percent(value[4], "x") end end -- Expand border_color to longform local function expand_border_color(value) local top = "border_top_color" local right = "border_right_color" local bottom = "border_bottom_color" local left = "border_left_color" if type(value[1]) == "number" then ep[top] = value ep[right] = value ep[bottom] = value ep[left] = value elseif #value == 1 then ep[top] = value[1] ep[right] = value[1] ep[bottom] = value[1] ep[left] = value[1] elseif #value == 2 then ep[top] = value[1] ep[right] = value[2] ep[bottom] = value[1] ep[left] = value[2] else ep[top] = value[1] ep[right] = value[2] ep[bottom] = value[3] ep[left] = value[4] end end -- Expand border_radius to longform local function expand_border_radius(element, value) local top = "border_top_left_radius" local right = "border_top_right_radius" local bottom = "border_bottom_right_radius" local left = "border_bottom_left_radius" if type(value) == "number" then ep[top] = value ep[right] = value ep[bottom] = value ep[left] = value elseif #value == 1 then ep[top] = value[1] ep[right] = value[1] ep[bottom] = value[1] ep[left] = value[1] elseif #value == 2 then ep[top] = value[1] ep[right] = value[2] ep[bottom] = value[1] ep[left] = value[2] else ep[top] = value[1] ep[right] = value[2] ep[bottom] = value[3] ep[left] = value[4] end end -- Check all properties for special cases local function set_property(property, value) ep[property] = value if property == "margin" or property == "border" or property == "padding" then expand_box(property, value) elseif property == "border_color" then expand_border_color(value) elseif property == "border_radius" then expand_border_radius(value) elseif property == "top" or property == "bottom" or property == "margin_top" or property == "margin_bottom" or property == "border_top" or property == "border_bottom" or property == "padding_top" or property == "padding_bottom" or property == "height" or property == "min_height" or property == "max_height" then check_property(property, value, "y") elseif property == "right" or property == "left" or property == "margin_right" or property == "margin_left" or property == "border_right" or property == "border_left" or property == "padding_right" or property == "padding_left" or property == "width" or property == "min_width" or property == "max_width" then check_property(property, value, "x") elseif property == "background_position" or property == "background_size" then check_vec2(property, value) elseif property == "background_path" then if not self.gui:get_cache(value) then if value:sub(-5) == "9.png" then self.gui:set_cache(value, patchy.load(value)) else self.gui:set_cache(value, love.graphics.newImage(value, {srgb=self.gui.srgb})) end end ep.background_image = self.gui:get_cache(value) elseif property == "font_path" then local font_size = (self.custom_properties.font_size ~= "inherit" and self.custom_properties.font_size) or (ep.font_size ~= "inherit" and ep.font_size) or (self.default_properties.font_size ~= "inherit" and self.default_properties.font_size) or Initial.font_size if not self.gui:get_cache(value..font_size) then if value == "default" then self.gui:set_cache(value..font_size, love.graphics.newFont(font_size)) else self.gui:set_cache(value..font_size, love.graphics.newFont(value, font_size)) end end ep.font = self.gui:get_cache(value..font_size) elseif property == "font_size" then local font_path = (self.custom_properties.font_path ~= "inherit" and self.custom_properties.font_path) or (ep.font_path ~= "inherit" and ep.font_path) or (self.default_properties.font_path ~= "inherit" and self.default_properties.font_path) or "default" if not self.gui:get_cache(font_path..value) then if font_path == "default" then self.gui:set_cache(font_path..value, love.graphics.newFont(value)) else self.gui:set_cache(font_path..value, love.graphics.newFont(font_path, value)) end end ep.font = self.gui:get_cache(font_path..value) elseif property == "cursor" then ep.cursor = love.mouse.getSystemCursor(value) elseif property == "nav_up" or property == "nav_right" or property == "nav_down" or property == "nav_left" then ep[property] = self.gui:get_element_by_id(value) elseif property == "overflow" then ep.overflow_x = value ep.overflow_y = value if value == "scroll" then self.on_mouse_scrolled = self.default_on_mouse_scrolled end end end local function check_value(property, value) if value == "initial" then return Initial[property] end if value == "inherit" then if self.parent then return check_value(property, self.parent.properties[property]) else return Initial[property] end end if value == "none" then return end return value end for k in pairs(self.properties) do self.properties[k] = nil end -- We need to gather up all the styles and order them local function priority_styles(styles) local list = { "width", "height", "margin", "margin_top", "margin_right", "margin_bottom", "margin_left", "border", "border_top", "border_right", "border_bottom", "border_left", "padding", "padding_top", "padding_right", "padding_bottom", "padding_left", } for k = #list, 1, -1 do if styles[list[k]] then local value = check_value(list[k], styles[list[k]]) set_property(list[k], value) else table.remove(list, k) end end for property, value in pairs(styles) do local found = false for k, style in ipairs(list) do if property == style then found = true break end end if not found then value = check_value(property, value) set_property(property, value) end end end -- Apply default properties priority_styles(self.default_properties) -- Apply query properties for _, style in ipairs(self.styles) do priority_styles(style) end -- Apply custom properties priority_styles(self.custom_properties) end return Element
-- Tests for derivative.lua local drv = require 'derivative' local total, pass = 0, 0 local function dec(str, len) return #str < len and str .. (('.'):rep(len-#str)) or str:sub(1,len) end local function run(message, f) total = total + 1 local ok, err = pcall(f) if ok then pass = pass + 1 end local status = ok and 'PASSED' or 'FAILED' print(('%02d. %68s: %s'):format(total, dec(message,68), status)) end local function fuzzyEqual(a, b, eps) local eps = eps or 1e-4 return (math.abs(a - b) < eps) end run('Testing left derivative', function() local f = function(x) return x * x end assert(fuzzyEqual(drv.left(f, 5), 2 * 5)) local f = function(x) return x * x * x end assert(fuzzyEqual(drv.left(f, 5), 3 * 5 * 5)) end) run('Testing right derivative', function() local f = function(x) return x * x end assert(fuzzyEqual(drv.right(f, 5), 2 * 5)) local f = function(x) return x * x * x end assert(fuzzyEqual(drv.right(f, 5), 3 * 5 * 5)) end) run('Testing mid derivative', function() local f = function(x) return x * x end assert(fuzzyEqual(drv.mid(f, 5), 2 * 5)) local f = function(x) return x * x * x end assert(fuzzyEqual(drv.mid(f, 5), 3 * 5 * 5)) end) print(('-'):rep(80)) print(('Total : %02d: Pass: %02d - Failed : %02d - Success: %.2f %%') :format(total, pass, total-pass, (pass*100/total)))
function love.load() text = "" enet = require "enet" host = enet.host_create("*:1051") end function love.draw() love.graphics.print(text) end function love.update(dt) local event = host:service(100) while event do if event.type == "connect" then text = text .. tostring(event.peer) .. " is connected.\n" elseif event.type == "receive" then text = text .. tostring(event.peer) .. ": " .. event.data .. "\n" host:broadcast(event.data) elseif event.type == "disconnect" then text = text .. tostring(event.peer) .. " has disconnected.\n" end event = host:service() end end
--[[ This Roact component represents our entire game. In most cases, you'll only use Roact for constructing your UI, but in this project, I elected to try to manage the game world partially with Roact as well for fun. The traditional top-level component name in React is "App," we generally use that for Roact too, but I have a hunch that there's a better name. ]] local ReplicatedStorage = game:GetService("ReplicatedStorage") local Workspace = game:GetService("Workspace") local Roact = require(ReplicatedStorage.Modules.Roact) local e = Roact.createElement local InventoryMenu = require(script.Parent.InventoryMenu) local World = require(script.Parent.World) local function Game(props) return e("ScreenGui", { ZIndexBehavior = Enum.ZIndexBehavior.Sibling, ResetOnSpawn = false, }, { InventoryContainer = e("Frame", { Size = UDim2.new(0, 400, 0, 400), Position = UDim2.new(0.5, 0, 0.5, 0), AnchorPoint = Vector2.new(0.5, 0.5), BackgroundTransparency = 1, }, { Inventory = e(InventoryMenu), }), -- Even through our UI is being rendered inside a PlayerGui, we can -- always take advantage of a feature called portals to put instances -- elsewhere. -- Portals are a feature that makes having a virtual tree worthwhile, -- since implementing them without having formalized destructors is -- bug-prone! World = e(Roact.Portal, { target = Workspace, }, { World = e(World), }) }) end return Game
--------------------------------------------- -- Tempest Wing -- Family: Bahamut -- Description: Turbulence deals Wind damage to enemies within a very wide area of effect. Additional effect: Knockback -- Type: Magical -- Utsusemi/Blink absorb: Wipes shadows -- Range: Cone -- Notes: --------------------------------------------- require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/monstertpmoves") --------------------------------------------- function onMobSkillCheck(target, mob, skill) if (target:isBehind(mob, 55) == true) then return 1 else return 0 end end function onMobWeaponSkill(target, mob, skill) local dmgmod = 1 local info = MobMagicalMove(mob, target, skill, mob:getWeaponDmg()*4, tpz.magic.ele.WIND, dmgmod, TP_NO_EFFECT) local dmg = MobFinalAdjustments(info.dmg, mob, skill, target, tpz.attackType.MAGICAL, tpz.damageType.WIND, MOBPARAM_WIPE_SHADOWS) target:takeDamage(dmg, mob, tpz.attackType.MAGICAL, tpz.damageType.WIND) return dmg end
--[[ This file is part of BlauLock, a ComputerCraft program that adds password protection on startup. Author: Daniel 'xBlau' Mosquera <daniel+github@blaudev.es> Repository: https://github.com/xblau/blaulock THIS FILE IS DISTRIBUTED UNDER THE TERMS OF THE MIT LICENSE ]] local oldPullEvent = os.pullEvent os.pullEvent = os.pullEventRaw local oldShutdown = os.shutdown local oldReboot = os.reboot dofile( '/.BlauLock/functions.lua' ) local Config = ploadtable( '/.BlauLock/config.dat' ) local BlauLock = dofile( '/.BlauLock/BlauLock.API.lua' ) local function poweroff( action ) if fs.exists( '/.BlauLock/BlauLock.Main.lua' ) then if fs.exists( '/startup' ) then BlauLock.inject( '/startup', '/.BlauLock/BlauLock.Main.lua' ) else local file = fs.open( '/startup', 'w' ) file.write( "shell.run('/.BlauLock/BlauLock.Main.lua')" ) file.close() end end if settings and type( settings.set ) == 'function' then settings.set( 'shell.allow_disk_startup', false ) settings.save( '.settings' ) end if action == 'shutdown' then oldShutdown() elseif action == 'reboot' then oldReboot() end end if( Config['Enabled'] ) then local Locked = true local theme = { window = colors.gray, error = colors.white, success = colors.white, osver = colors.white, text = colors.white, backg = colors.black } if( term.isColor() ) then if Config['Theme'] ~= nil and type( Config['Theme'] ) == 'table' then theme = Config['Theme'] else theme = { window = colors.blue, error = colors.red, success = colors.green, osver = colors.yellow, text = colors.white, backg = colors.black } end end paintutils.drawFilledBox( 1, 1, 51, 19, theme.backg ) paintutils.drawFilledBox( 14, 6, 38, 12, theme.window ) pprint( '+', 13, 5, theme.text, theme.window ) pprint( '+', 13, 13, theme.text, theme.window ) pprint( '+', 39, 5, theme.text, theme.window ) pprint( '+', 39, 13, theme.text, theme.window ) for i = 1, 25 do pprint( '=', 13 + i, 5, theme.text, theme.window ) end for i = 1, 25 do pprint( '=', 13 + i, 13, theme.text, theme.window ) end for i = 1, 7 do pprint( '|', 13, 5 + i, theme.text, theme.window ) end for i = 1, 7 do pprint( '|', 39, 5 + i, theme.text, theme.window ) end pprint( '.:: BlauLock ::.', 'centrated', 7, theme.text, theme.window ) pprint( 'Pass: ', 16, 10, theme.text, theme.window ) while Locked do local password = pread( 22, 10, 37, theme.text, theme.window, '*' ) pprint( 'Verifying...', 22, 10, theme.text, theme.window ) if Config.Eraser ~= nil and type( Config.Eraser ) == 'table' then if Config.Eraser.Enabled and BlauLock.VerifyHash( password, Config.Eraser.Hash ) then local tFiles = fs.list( '/' ) for i = 1, #tFiles do if tFiles[i] ~= '.BlauLock' and tFiles[i] ~= 'rom' then fs.delete( tFiles[i] ) end end local file = fs.open( '/startup', 'w' ) file.write( "shell.run('/.BlauLock/BlauLock.Main.lua')" ) file.close() Config['Hash'] = Config.Eraser.Hash Config.Eraser = nil psavetable( Config, '/.BlauLock/config.dat' ) -- If the old startup file expects any old file -- to be present, its going to crash because we -- just deleted everything except BlauLock. -- To avoid displaying any error, we are going -- to launch a new shell. This is probably not -- the best way to do it. paintutils.drawLine( 22, 10, 37, 10, theme.window ) pprint( 'Access granted!', 22, 10, theme.success, theme.window ) sleep( 2 ) os.shutdown = function() poweroff( 'shutdown' ) end os.reboot = function() poweroff( 'reboot' ) end shell.setAlias( 'blaulock-cmd', '/.BlauLock/BlauLock.CMD.lua' ) os.pullEvent = oldPullEvent sShell = nil if term.isColour() then sShell = "rom/programs/advanced/multishell" else sShell = "rom/programs/shell" end shell.run( sShell ) poweroff( 'shutdown' ) end end if BlauLock.VerifyHash( password, Config['Hash'] ) then Locked = false paintutils.drawLine( 22, 10, 37, 10, theme.window ) pprint( 'Access granted!', 22, 10, theme.success, theme.window ) sleep( 2 ) term.setTextColor( theme.osver ) term.setBackgroundColor( colors.black ) term.clear() term.setCursorPos( 1, 1 ) print( os.version() ) term.setTextColor( colors.white ) else paintutils.drawLine( 22, 10, 37, 10, theme.window ) pprint( 'Access denied!', 22, 10, theme.error, theme.window ) sleep( 3 ) end end end os.shutdown = function() poweroff( 'shutdown' ) end os.reboot = function() poweroff( 'reboot' ) end shell.setAlias( 'blaulock-cmd', '/.BlauLock/BlauLock.CMD.lua' ) os.pullEvent = oldPullEvent
local energyrequired = 1 local steamamount1 = 25 local steamamount2 = 21 if settings.startup['seablock-evil-mode-steam-recipe-mode'].value == "0_0_5" then energyrequired = 1.75 steamamount1 = 49 steamamount2 = 42 end data:extend({ -- 1 steam(165 degree) == 30kJ -- 1 h2 needed 30kJ with electrolysis I { type = "recipe", name = "sbem-steam-from-h2-o2-1", category = "chemistry", subgroup = "petrochem-basics", energy_required = energyrequired, -- 1/1.75 sec. for 8 elecs on plant mk1 enabled = true, ingredients = { {type = "fluid", name = "gas-oxygen", amount = 60}, {type = "fluid", name = "gas-hydrogen", amount = 80} }, results = { {type = "fluid", name = "steam", amount = steamamount1, temperature = 165}, -- plant consumes 258.3333 kW in 1 sec. }, always_show_products = true, icons = angelsmods.functions.create_liquid_recipe_icon( { "steam" }, "www" ), order = "a[sbem-steam-from-h2-o2-1]", crafting_machine_tint = { primary = {r = 1, g = 1, b = 1, a = 0}, secondary = {r = 0.7, g = 0.7, b = 1, a = 0}, tertiary = {r = 167 / 255, g = 75 / 255, b = 5 / 255, a = 0 / 255} } }, { type = "recipe", name = "sbem-steam-from-h2-o2-2", category = "chemistry", subgroup = "petrochem-basics", energy_required = energyrequired, -- 1/1.75 sec. for 8 elecs on plant mk1 enabled = true, ingredients = { {type = "fluid", name = "gas-oxygen", amount = 40}, {type = "fluid", name = "gas-hydrogen", amount = 80} }, results = { {type = "fluid", name = "steam", amount = steamamount2, temperature = 165}, -- plant consumes 258.3333 kW in 1 sec. }, always_show_products = true, icons = angelsmods.functions.create_liquid_recipe_icon( { "steam" }, "www" ), order = "a[sbem-steam-from-h2-o2-2]", crafting_machine_tint = { primary = {r = 1, g = 1, b = 1, a = 0}, secondary = {r = 0.7, g = 0.7, b = 1, a = 0}, tertiary = {r = 167 / 255, g = 75 / 255, b = 5 / 255, a = 0 / 255} } }, })
--[[ Copyright (c) 2016 Calvin Rose <calsrose@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] local concat = table.concat local sub = string.sub local match = string.match local format = string.format local gmatch = string.gmatch local byte = string.byte local find = string.find local lower = string.lower local tonumber = tonumber -- luacheck: no unused local type = type local pcall = pcall -------------------------------------------------------------------------------- -- Stream Utils -------------------------------------------------------------------------------- local function stringLineStream(str) return gmatch(str, "([^\n\r]*)\r?\n?") end local function tableLineStream(t) local index = 0 return function() index = index + 1 return t[index] end end local function bufferStream(linestream) local bufferedLine = linestream() return function() bufferedLine = linestream() return bufferedLine end, function() return bufferedLine end end -------------------------------------------------------------------------------- -- Line Level Operations -------------------------------------------------------------------------------- local lineDelimiters = {'`', '__', '**', '_', '*', '~~'} local function findDelim(str, start, max) local delim = nil local min = 1/0 local finish = 1/0 max = max or #str for i = 1, #lineDelimiters do local pos, fin = find(str, lineDelimiters[i], start, true) if pos and pos < min and pos <= max then min = pos finish = fin delim = lineDelimiters[i] end end return delim, min, finish end local function externalLinkEscape(str, t) local nomatches = true for m1, m2, m3 in gmatch(str, '(.*)%[(.*)%](.*)') do if nomatches then t[#t + 1] = match(m1, '^(.-)!?$'); nomatches = false end if byte(m1, #m1) == byte '!' then t[#t + 1] = {type = 'img', attributes = {alt = m2}} else t[#t + 1] = {m2, type = 'a'} end t[#t + 1] = m3 end if nomatches then t[#t + 1] = str end end local function linkEscape(str, t) local nomatches = true for m1, m2, m3, m4 in gmatch(str, '(.*)%[(.*)%]%((.*)%)(.*)') do if nomatches then externalLinkEscape(match(m1, '^(.-)!?$'), t); nomatches = false end if byte(m1, #m1) == byte '!' then t[#t + 1] = {type = 'img', attributes = { src = m3, alt = m2 }, noclose = true} else t[#t + 1] = {m2, type = 'a', attributes = {href = m3}} end externalLinkEscape(m4, t) end if nomatches then externalLinkEscape(str, t) end end local lineDeimiterNames = {['`'] = 'code', ['__'] = 'strong', ['**'] = 'strong', ['_'] = 'em', ['*'] = 'em', ['~~'] = 'strike' } local function lineRead(str, start, finish) start, finish = start or 1, finish or #str local searchIndex = start local tree = {} while true do local delim, dstart, dfinish = findDelim(str, searchIndex, finish) if not delim then linkEscape(sub(str, searchIndex, finish), tree) break end if dstart > searchIndex then linkEscape(sub(str, searchIndex, dstart - 1), tree) end local nextdstart, nextdfinish = find(str, delim, dfinish + 1, true) if nextdstart then if delim == '`' then tree[#tree + 1] = { sub(str, dfinish + 1, nextdstart - 1), type = 'code' } else local subtree = lineRead(str, dfinish + 1, nextdstart - 1) subtree.type = lineDeimiterNames[delim] tree[#tree + 1] = subtree end searchIndex = nextdfinish + 1 else tree[#tree + 1] = { delim, } searchIndex = dfinish + 1 end end return tree end local function getIndentLevel(line) local level = 0 for i = 1, #line do local b = byte(line, i) if b == byte(' ') or b == byte('>') then level = level + 1 elseif b == byte('\t') then level = level + 4 else break end end return level end local function stripIndent(line, level, ignorepattern) -- luacheck: no unused args local currentLevel = -1 for i = 1, #line do if byte(line, i) == byte("\t") then currentLevel = currentLevel + 4 elseif byte(line, i) == byte(" ") or byte(line, i) == byte(">") then currentLevel = currentLevel + 1 else return sub(line, i, -1) end if currentLevel == level then return sub(line, i, -1) elseif currentLevel > level then local front = "" for j = 1, currentLevel - level do front = front .. " " end -- luacheck: no unused args return front .. sub(line, i, -1) end end end -------------------------------------------------------------------------------- -- Useful variables -------------------------------------------------------------------------------- local NEWLINE = '\n' -------------------------------------------------------------------------------- -- Patterns -------------------------------------------------------------------------------- local PATTERN_EMPTY = "^%s*$" local PATTERN_COMMENT = "^%s*<>" local PATTERN_HEADER = "^%s*(%#+)%s*(.*)%#*$" local PATTERN_RULE1 = "^%s?%s?%s?(-%s*-%s*-[%s-]*)$" local PATTERN_RULE2 = "^%s?%s?%s?(*%s**%s**[%s*]*)$" local PATTERN_RULE3 = "^%s?%s?%s?(_%s*_%s*_[%s_]*)$" local PATTERN_CODEBLOCK = "^%s*%`%`%`(.*)" local PATTERN_BLOCKQUOTE = "^%s*> (.*)$" local PATTERN_ULIST = "^%s*[%*%-] (.+)$" local PATTERN_OLIST = "^%s*%d+%. (.+)$" local PATTERN_LINKDEF = "^%s*%[(.*)%]%s*%:%s*(.*)" -- List of patterns local PATTERNS = { PATTERN_EMPTY, PATTERN_COMMENT, PATTERN_HEADER, PATTERN_RULE1, PATTERN_RULE2, PATTERN_RULE3, PATTERN_CODEBLOCK, PATTERN_BLOCKQUOTE, PATTERN_ULIST, PATTERN_OLIST, PATTERN_LINKDEF } local function isSpecialLine(line) for i = 1, #PATTERNS do if match(line, PATTERNS[i]) then return PATTERNS[i] end end end -------------------------------------------------------------------------------- -- Simple Reading - Non Recursive -------------------------------------------------------------------------------- local function readSimple(pop, peek, tree, links) local line = peek() if not line then return end -- Test for Empty or Comment if match(line, PATTERN_EMPTY) or match(line, PATTERN_COMMENT) then return pop() end -- Test for Header local m, rest = match(line, PATTERN_HEADER) if m then tree[#tree + 1] = { lineRead(rest), type = "h" .. #m } tree[#tree + 1] = NEWLINE return pop() end -- Test for Horizontal Rule if match(line, PATTERN_RULE1) or match(line, PATTERN_RULE2) or match(line, PATTERN_RULE3) then tree[#tree + 1] = { type = "hr", noclose = true } tree[#tree + 1] = NEWLINE return pop() end -- Test for Code Block local syntax = match(line, PATTERN_CODEBLOCK) if syntax then local indent = getIndentLevel(line) local code = { type = "code" } if #syntax > 0 then code.attributes = { class = format('language-%s', lower(syntax)) } end local pre = { type = "pre", [1] = code } tree[#tree + 1] = pre while not (match(pop(), PATTERN_CODEBLOCK) and getIndentLevel(peek()) == indent) do code[#code + 1] = peek() code[#code + 1] = '\r\n' end return pop() end -- Test for link definition local linkname, location = match(line, PATTERN_LINKDEF) if linkname then links[lower(linkname)] = location return pop() end -- Test for header type two local nextLine = pop() if nextLine and match(nextLine, "^%s*%=+$") then tree[#tree + 1] = { lineRead(line), type = "h1" } return pop() elseif nextLine and match(nextLine, "^%s*%-+$") then tree[#tree + 1] = { lineRead(line), type = "h2" } return pop() end -- Do Paragraph local p = { lineRead(line), NEWLINE, type = "p" } tree[#tree + 1] = p while nextLine and not isSpecialLine(nextLine) do p[#p + 1] = lineRead(nextLine) p[#p + 1] = NEWLINE nextLine = pop() end p[#p] = nil tree[#tree + 1] = NEWLINE return peek() end -------------------------------------------------------------------------------- -- Main Reading - Potentially Recursive -------------------------------------------------------------------------------- local readLineStream local function readFragment(pop, peek, links, stop, ...) local accum2 = {} local line = peek() local indent = getIndentLevel(line) while true do accum2[#accum2 + 1] = stripIndent(line, indent) line = pop() if not line then break end if stop(line, ...) then break end end local tree = {} readLineStream(tableLineStream(accum2), tree, links) return tree end local function readBlockQuote(pop, peek, tree, links) local line = peek() if match(line, PATTERN_BLOCKQUOTE) then local bq = readFragment(pop, peek, links, function(l) local tp = isSpecialLine(l) return tp and tp ~= PATTERN_BLOCKQUOTE end) bq.type = 'blockquote' tree[#tree + 1] = bq return peek() end end local function readList(pop, peek, tree, links, expectedIndent) if not peek() then return end if expectedIndent and getIndentLevel(peek()) ~= expectedIndent then return end local listPattern = (match(peek(), PATTERN_ULIST) and PATTERN_ULIST) or (match(peek(), PATTERN_OLIST) and PATTERN_OLIST) if not listPattern then return end local lineType = listPattern local line = peek() local indent = getIndentLevel(line) local list = { type = (listPattern == PATTERN_ULIST and "ul" or "ol") } tree[#tree + 1] = list list[1] = NEWLINE while lineType == listPattern do list[#list + 1] = { lineRead(match(line, lineType)), type = "li" } line = pop() if not line then break end lineType = isSpecialLine(line) if lineType ~= PATTERN_EMPTY then list[#list + 1] = NEWLINE local i = getIndentLevel(line) if i < indent then break end if i > indent then local subtree = readFragment(pop, peek, links, function(l) if not l then return true end local tp = isSpecialLine(l) return tp ~= PATTERN_EMPTY and getIndentLevel(l) < i end) list[#list + 1] = subtree line = peek() if not line then break end lineType = isSpecialLine(line) end end end list[#list + 1] = NEWLINE tree[#tree + 1] = NEWLINE return peek() end function readLineStream(stream, tree, links) local pop, peek = bufferStream(stream) tree = tree or {} links = links or {} while peek() do if not readBlockQuote(pop, peek, tree, links) then if not readList(pop, peek, tree, links) then readSimple(pop, peek, tree, links) end end end return tree, links end local function read(str) -- luacheck: no unused return readLineStream(stringLineStream(str)) end -------------------------------------------------------------------------------- -- Rendering -------------------------------------------------------------------------------- local function renderAttributes(attributes) local accum = {} for k, v in pairs(attributes) do accum[#accum + 1] = format("%s=\"%s\"", k, v) end return concat(accum, ' ') end local function renderTree(tree, links, accum) if tree.type then local attribs = tree.attributes or {} if tree.type == 'a' and not attribs.href then attribs.href = links[lower(tree[1] or '')] or '' end if tree.type == 'img' and not attribs.src then attribs.src = links[lower(attribs.alt or '')] or '' end local attribstr = renderAttributes(attribs) if #attribstr > 0 then accum[#accum + 1] = format("<%s %s>", tree.type, attribstr) else accum[#accum + 1] = format("<%s>", tree.type) end end for i = 1, #tree do local line = tree[i] if type(line) == "string" then accum[#accum + 1] = line elseif type(line) == "table" then renderTree(line, links, accum) else error "Unexpected node while rendering tree." end end if not tree.noclose and tree.type then accum[#accum + 1] = format("</%s>", tree.type) end end local function renderLinesRaw(stream, options) local tree, links = readLineStream(stream) local accum = {} local head, tail, insertHead, insertTail, prependHead, appendTail = nil, nil, nil, nil, nil, nil if options then assert(type(options) == 'table', "Options argument should be a table.") if options.tag then tail = format('</%s>', options.tag) if options.attributes then head = format('<%s %s>', options.tag, renderAttributes(options.attributes)) else head = format('<%s>', options.tag) end end insertHead = options.insertHead insertTail = options.insertTail prependHead = options.prependHead appendTail = options.appendTail end accum[#accum + 1] = prependHead accum[#accum + 1] = head accum[#accum + 1] = insertHead renderTree(tree, links, accum) if accum[#accum] == NEWLINE then accum[#accum] = nil end accum[#accum + 1] = insertTail accum[#accum + 1] = tail accum[#accum + 1] = appendTail return concat(accum) end -------------------------------------------------------------------------------- -- Module -------------------------------------------------------------------------------- local function pwrap(...) local status, value = pcall(...) if status then return value else return nil, value end end local function renderLineIterator(stream, options) return pwrap(renderLinesRaw, stream, options) end local function renderTable(t, options) return pwrap(renderLinesRaw, tableLineStream(t), options) end local function renderString(str, options) return pwrap(renderLinesRaw, stringLineStream(str), options) end local renderers = { ['string'] = renderString, ['table'] = renderTable, ['function'] = renderLineIterator } local function render(source, options) local renderer = renderers[type(source)] if not renderer then return nil, "Source must be a string, table, or function." end return renderer(source, options) end return setmetatable({ render = render, renderString = renderString, renderLineIterator = renderLineIterator, renderTable = renderTable }, { __call = function(self, ...) -- luacheck: no unused args return render(...) end })