content
stringlengths
5
1.05M
return { { effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64651 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64661 } } } }, { effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64652 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64662 } } } }, { effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64653 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64663 } } } }, { effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64654 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64664 } } } }, { effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64655 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64665 } } } }, { effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64656 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64666 } } } }, { effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64657 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64667 } } } }, { effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64658 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64668 } } } }, { effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64659 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64669 } } } }, { effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64660 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64670 } } } }, uiEffect = "", name = "", cd = 0, painting = 1, id = 14762, picture = "1", castCV = "skill", desc = "", aniEffect = { effect = "jineng", offset = { 0, -2, 0 } }, effect_list = { { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64651 } }, { type = "BattleSkillFire", casterAniEffect = "", target_choise = "TargetHarmRandom", targetAniEffect = "", arg_list = { weapon_id = 64661 } } } }
-- -- Register fallback node handler (wildcard node) for sharetool -- -- Default radius for operation, area is cube and side length is RADIUS * 2 + 1 local RADIUS = 5 local ns = metatool.ns("sharetool") local get_meta = minetest.get_meta local get_node = minetest.get_node local definition = { name = '*', nodes = '*', group = '*', } local function is_area_protected(pos, radius, player) -- Check middle point (pointless?) and corners local checkpos = { pos, vector.add(pos, {x= radius,y= radius,z= radius}), vector.add(pos, {x= radius,y= radius,z=-radius}), vector.add(pos, {x= radius,y=-radius,z= radius}), vector.add(pos, {x= radius,y=-radius,z=-radius}), vector.add(pos, {x=-radius,y= radius,z= radius}), vector.add(pos, {x=-radius,y= radius,z=-radius}), vector.add(pos, {x=-radius,y=-radius,z= radius}), vector.add(pos, {x=-radius,y=-radius,z=-radius}), } for _,cpos in ipairs(checkpos) do if not definition:before_info(cpos, player) then return true end end return false end local travelnet_nodes = { ['travelnet:travelnet'] = 1, ['travelnet:travelnet_red'] = 1, ['travelnet:travelnet_blue'] = 1, ['travelnet:travelnet_green'] = 1, ['travelnet:travelnet_black'] = 1, ['travelnet:travelnet_white'] = 1, ['locked_travelnet:travelnet'] = 1, ['travelnet:travelnet_private'] = 1, ['travelnet:elevator'] = 1, } local function transfer_nodes(pos1, pos2, owner, player) local newplayer = { get_player_name = function() return owner end } for _,pos in ipairs(minetest.find_nodes_with_meta(pos1, pos2)) do local meta = get_meta(pos) if meta:get("owner") then local nodename = get_node(pos).name local nodedef = minetest.registered_nodes[nodename] if nodedef and nodedef.groups and nodedef.groups.technic_chest then pcall(function()nodedef.after_place_node(pos, newplayer)end) elseif travelnet_nodes[nodename] then ns:set_travelnet_owner(pos, player, owner) else meta:set_string("owner", owner) end end end end local function get_areas(minpos, maxpos) local results = {} if areas then for id,area in pairs(areas:getAreasIntersectingArea(minpos, maxpos)) do if metatool.util.area_in_area(area, {pos1 = minpos, pos2 = maxpos}) then table.insert(results, {id, area.owner, area.name}) end end end return results end local function get_owners(minpos, maxpos) local results = {} for _,pos in ipairs(minetest.find_nodes_with_meta(minpos, maxpos)) do local name = get_node(pos).name local owner = get_meta(pos):get("owner") if owner then table.insert(results, {name, ("%d,%d,%d"):format(pos.x, pos.y, pos.z), owner}) end end return results end local function get_operation_radius(radius) radius = tonumber(radius) if not radius then return RADIUS, false end local max_radius = metatool.settings("sharetool", "max_radius") or RADIUS return math.min(math.max(0, math.floor(radius)), max_radius), ((radius >= 0) and (radius <= max_radius)) end metatool.form.register_form("sharetool:transfer-ownership", { on_create = function(player, data) local max_radius = metatool.settings("sharetool", "max_radius") or RADIUS local radius = data.radius or RADIUS local msg = data.msg or "" local form = metatool.form.Form({ width = 10, height = 11, }):raw( ("label[0.2,0.5;Transfer node/area ownership %d,%d,%d radius %d]") :format(data.pos.x, data.pos.y, data.pos.z, radius) ):field({ name = "owner", label = "New owner: " .. msg, default = data.new_owner or ns.shared_account, y = 1, h = 0.8, xidx = 1, xcount = 2 }):field({ name = "radius", label = "Radius: (max " .. max_radius .. ")" .. radius, default = radius, y = 1, h = 0.8, xidx = 2, xcount = 2 }):table({ name = "owners", label = "Node owners:", y = 2, h = 4, yidx = 1, ycount = 2, columns = {"node", "pos", "owner"}, values = data.owners }):table({ name = "areas", label = "Protection areas:", y = 2, h = 4, yidx = 2, ycount = 2, columns = {"id", "owner", "name"}, values = data.areas }):button({ label = "Transfer", name = "transfer", y = 10.2, h = 0.8, xidx = 1, xcount = 3, }):button({ label = "Reload", name = "reload", y = 10.2, h = 0.8, xidx = 2, xcount = 3, }):button({ label = "Close", name = "cancel", exit = true, y = 10.2, h = 0.8, xidx = 3, xcount = 3, }) return form end, on_receive = function(player, fields, data) data.msg = nil if fields.reload or fields.transfer then data.new_owner = fields.owner local radius, valid_radius = get_operation_radius(fields.radius) local minpos = vector.subtract(data.pos, radius) local maxpos = vector.add(data.pos, radius) local name = player:get_player_name() if not ns.player_exists(fields.owner) then data.msg = "Player not found!" elseif not valid_radius then minetest.chat_send_player(name, "Invalid or too large radius, transfer failed") elseif is_area_protected(data.pos, radius, player) then minetest.chat_send_player(name, "Area is protected, transfer failed") elseif fields.transfer then -- All checks passed, transfer ownership transfer_nodes(minpos, maxpos, fields.owner, player) for id,area in pairs(areas and areas:getAreasIntersectingArea(minpos, maxpos)) do if metatool.util.area_in_area(area, {pos1 = minpos, pos2 = maxpos}) then -- Do not care about possible failures here, let it finish also in case of problems -- Problems with area transfer will be reported through chat messages ns:set_area_owner(id, fields.owner, player) end end -- Confirmation, update form table data minetest.chat_send_player(name, ("Ownership transfer completed, area is now owned by %s"):format(fields.owner) ) end data.radius = radius data.owners = get_owners(minpos, maxpos) data.areas = get_areas(minpos, maxpos) return false end end, }) function definition:before_read() return false end function definition:before_write() return false end -- Use default protection check --function definition:before_info(pos, player) return true end function definition:copy() end function definition:paste() end function definition:info(node, pos, player, itemstack) local minpos = vector.subtract(pos, RADIUS) local maxpos = vector.add(pos, RADIUS) metatool.form.show(player, "sharetool:transfer-ownership", { pos = pos, owners = get_owners(minpos, maxpos), areas = get_areas(minpos, maxpos), }) end return definition
function momoTweak.require.Sci30Recipe() local ele = momoTweak.ele if data.raw["tool"]["more-science-pack-1"] then momoTweak.replace_with_ingredient("more-science-pack-2", "burner-mining-drill", {"building-pack", 1}) bobmods.lib.recipe.replace_ingredient("more-science-pack-3", "light-armor", "stone-wall") bobmods.lib.recipe.add_ingredient("more-science-pack-4", {"building-pack", 2}) bobmods.lib.recipe.add_ingredient("more-science-pack-5", {ele.circuit[1], 2}) bobmods.lib.recipe.add_ingredient("more-science-pack-6", {"angels-solder-mixture", 9}) bobmods.lib.recipe.add_ingredient("more-science-pack-7", {"plate-pack-1", 1}) bobmods.lib.recipe.remove_ingredient("more-science-pack-8", "electronic-circuit") bobmods.lib.recipe.add_ingredient("more-science-pack-8", {"plate-pack-1", 1}) bobmods.lib.recipe.add_ingredient("more-science-pack-9", {"brass-alloy", 3}) bobmods.lib.recipe.add_ingredient("more-science-pack-10", {"chemical-boiler", 1}) bobmods.lib.recipe.replace_ingredient("chemical-boiler", "pipe", "copper-pipe") bobmods.lib.recipe.add_ingredient("more-science-pack-10", {"solid-carbon", 2}) if data.raw.item["clay-brick"] then bobmods.lib.recipe.add_ingredient("more-science-pack-11", {"clay-brick", 12}) bobmods.lib.recipe.add_ingredient("more-science-pack-14", {"clay-brick", 5}) bobmods.lib.recipe.add_ingredient("more-science-pack-19", {"clay-brick", 40}) end bobmods.lib.recipe.add_ingredient("more-science-pack-12", {"stone-mixing-furnace", 1}) bobmods.lib.recipe.add_ingredient("more-science-pack-13", {"zinc-plate", 12}) bobmods.lib.recipe.add_ingredient("more-science-pack-14", {"zinc-plate", 5}) bobmods.lib.recipe.add_ingredient("more-science-pack-15", {"glass", 12}) bobmods.lib.recipe.add_ingredient("more-science-pack-16", {"flying-robot-frame", 2}) bobmods.lib.recipe.add_ingredient("more-science-pack-16", {"silver-plate", 8}) bobmods.lib.recipe.add_ingredient("more-science-pack-21", {"silver-plate", 8}) bobmods.lib.recipe.add_ingredient("more-science-pack-25", {"silver-plate", 4}) bobmods.lib.recipe.replace_ingredient("more-science-pack-17", "medium-electric-pole", "medium-electric-pole-3") bobmods.lib.recipe.replace_ingredient("more-science-pack-17", "big-electric-pole", "big-electric-pole-3") bobmods.lib.recipe.add_ingredient("more-science-pack-17", {momoTweak.ele.unit[2], 3}) bobmods.lib.recipe.add_ingredient("more-science-pack-18", {ele.board[3], 20}) momoTweak.set_amount_ingredient("more-science-pack-20", {"red-stack-inserter", 7}) bobmods.lib.recipe.add_ingredient("more-science-pack-20", {"electric-chemical-mixing-furnace", 1}) bobmods.lib.recipe.add_ingredient("more-science-pack-21", {"shot", 18}) momoTweak.set_amount_ingredient("more-science-pack-22", {"express-transport-belt", 6}) momoTweak.set_amount_ingredient("more-science-pack-22", {"express-underground-belt", 2}) bobmods.lib.recipe.add_ingredient("more-science-pack-23", {ele.comp[3], 7}) bobmods.lib.recipe.add_ingredient("more-science-pack-23", {momoTweak.module.board.b, 8}) bobmods.lib.recipe.add_ingredient("more-science-pack-24", {"robot-brain-construction-3", 1}) bobmods.lib.recipe.add_ingredient("more-science-pack-24", {"robot-brain-logistic-3", 1}) bobmods.lib.recipe.add_ingredient("more-science-pack-25", {"silicon", 8}) -- nitinol for sci 24 25 26 27 28 for i=26,28 do bobmods.lib.recipe.add_ingredient("more-science-pack-"..i, {"nitinol-gear-wheel", 3}) end bobmods.lib.recipe.add_ingredient("more-science-pack-26", {"advanced-plastics", 5}) momoTweak.replace_with_ingredient("more-science-pack-26", "battery", {"silver-zinc-battery", 3}) bobmods.lib.recipe.add_ingredient("more-science-pack-27", {"nitinol-alloy", 4}) bobmods.lib.recipe.add_ingredient("more-science-pack-28", {momoTweak.ele.unit[4], 3}) bobmods.lib.recipe.add_ingredient("more-science-pack-28", {"advanced-plastics", 10}) bobmods.lib.recipe.add_ingredient("more-science-pack-29", {"silver-zinc-battery", 30}) bobmods.lib.recipe.add_ingredient("more-science-pack-29", {"bob-construction-robot-4", 3}) bobmods.lib.recipe.add_ingredient("more-science-pack-29", {"bob-logistic-robot-5", 1}) if (data.raw.recipe["more-science-pack-30"]) then local items = {} for i, ing in pairs(momoTweak.get_ingredients("more-science-pack-30")) do local item = bobmods.lib.item.basic_item(ing) if item ~= nil then table.insert(items, {item.name, item.amount * 5}) end end data.raw.recipe["more-science-pack-30"].ingredients = items bobmods.lib.recipe.add_ingredient("more-science-pack-30", {"heat-shield-tile", 5}) bobmods.lib.recipe.add_ingredient("more-science-pack-30", {ele.unit[4], 25}) end end end
--[[ MTA Role Play (mta-rp.pl) Autorzy poniższego kodu: - Patryk Adamowicz <patrykadam.dev@gmail.com> Discord: PatrykAdam#1293 Link do githuba: https://github.com/PatrykAdam/mtarp --]] local cmd = {} function cmd.plac(playerid, cmd, playerid2, money) if not exports.sarp_main:isPlayerLogged(playerid) then return end playerid2, money = exports.sarp_main:getPlayerFromID(playerid2), math.floor((tonumber(money))) if getDistanceToElement(playerid, playerid2) > 3.0 then return exports.sarp_notify:addNotify(playerid, "Znajdujesz się zbyt daleko gracza.") end if not money or not playerid2 then return exports.sarp_notify:addNotify(playerid, "Użyj: /plac [id gracza] [ilość]") end if money > getElementData(playerid, "player:money") or money <= 0 then return exports.sarp_notify:addNotify(playerid, "Nie posiadasz takiej ilości gotówki.") end local name = exports.sarp_main:getPlayerRealName(playerid2) triggerEvent( "main:me", playerid, string.format("przekazuje gotówkę dla %s.", name)) exports.sarp_main:givePlayerCash(playerid, -money) exports.sarp_main:givePlayerCash(playerid2, money) exports.sarp_notify:addNotify(playerid, string.format("Przekazałeś %d$ dla %s.", money, name) ) exports.sarp_notify:addNotify(playerid2, string.format("Otrzymałeś %d$ od %s.", money, exports.sarp_main:getPlayerRealName(playerid)) ) exports.sarp_logs:createLog('CASH', string.format("[UID:%d] %s przekazał %d$ dla [UID:%d] %s.", getElementData(playerid, "player:id"), getElementData(playerid, "player:username"), money, getElementData(playerid2, "player:id"), getElementData(playerid2, "player:username"))) end addCommandHandler( "plac", cmd.plac ) function cmd.kup(playerid, cmd, ...) if not exports.sarp_main:isPlayerLogged(playerid) then return end local doorid = getElementData(playerid, "player:door") if not doorid then return false end local groupid = getElementData(doorid, "doors:ownerID") local sklep, odziezowy = exports.sarp_doors:isDoorGroupType(doorid, 19), exports.sarp_doors:isDoorGroupType(doorid, 21) if not doorid or not groupid or not sklep and not odziezowy then return exports.sarp_notify:addNotify(playerid, "Nie możesz użyć tej komendy w tym miejscu.") end if sklep then local productList = exports.sarp_mysql:mysql_result("SELECT * FROM `sarp_magazine` WHERE `groupid` = ?", groupid) if #productList == 0 then return exports.sarp_notify:addNotify(playerid, "Brak produktów w sklepie.") end triggerClientEvent(playerid, "buyList", playerid, productList) end if odziezowy then setElementData(playerid, "player:lastskin", getElementModel( playerid )) triggerClientEvent(playerid, "buySkin", playerid ) end end addCommandHandler( "kup", cmd.kup ) function cmd.opis(playerid, cmd, ...) if not exports.sarp_main:isPlayerLogged(playerid) then return end local params = {...} if params[1] == 'usun' then local vehicle = getPedOccupiedVehicle( playerid ) if vehicle and getVehicleOccupant( vehicle ) == playerid and exports.sarp_vehicles:isVehicleOwner(playerid, getElementData(vehicle, "vehicle:id")) then setElementData(vehicle, "vehicle:desc", '') triggerClientEvent( "changeDescription", vehicle ) exports.sarp_notify:addNotify(playerid, "Opis pojazdu został usunięty.") else setElementData(playerid, "player:desc", '') triggerClientEvent( "changeDescription", playerid ) exports.sarp_notify:addNotify(playerid, "Opis postaci został usunięty.") end else local query = exports.sarp_mysql:mysql_result("SELECT * FROM `sarp_desc` WHERE `char_id` = ?", getElementData( playerid, "player:id" )) triggerClientEvent( 'showDescription', playerid, query ) end end addCommandHandler( "opis", cmd.opis ) function cmd.stats(playerid, cmd, playerid2) if not exports.sarp_main:isPlayerLogged(playerid) then return end playerid2 = exports.sarp_main:getPlayerFromID(playerid2) if exports.sarp_admin:getPlayerPermission(playerid, 512) and isElement(playerid2) then triggerClientEvent( 'stats:show', playerid, playerid2 ) else triggerClientEvent( 'stats:show', playerid, playerid ) end end addCommandHandler( "stats", cmd.stats ) function cmd.w(playerid, cmd, playerid2, ...) if not exports.sarp_main:isPlayerLogged(playerid) then return end local message, playerid2 = {...}, exports.sarp_main:getPlayerFromID(playerid2) message = table.concat( message, " ", 1, #message ) if message == '' or not playerid2 then return exports.sarp_notify:addNotify(playerid, "Użyj: /w [playerid] [wiadomość]") end if getElementData(playerid2, "blockPW") then return exports.sarp_notify:addNotify(playerid, "Gracz o podanym id zablokował otrzymywanie wiadomości.") end local text text = string.format("(( %s (%d): %s ))", exports.sarp_main:getPlayerRealName(playerid2), getElementData(playerid2, "player:mtaID"), message) triggerClientEvent( "addPlayerOOCMessage", playerid, text, 241, 206, 150 ) text = string.format("(( %s (%d): %s ))", exports.sarp_main:getPlayerRealName(playerid), getElementData(playerid, "player:mtaID"), message) triggerClientEvent( "addPlayerOOCMessage", playerid2, text, 255, 188, 93 ) exports.sarp_logs:createLog('PW', string.format('[UID: %d] %s wysyła wiadomość do [UID: %d] %s: %s', getElementData(playerid, "player:id"), getElementData(playerid, "player:username"), getElementData(playerid2, "player:id"), getElementData(playerid2, "player:username"), message)) setElementData(playerid, "lastPlayerMSG", playerid2) setElementData(playerid2, "lastPlayerMSG", playerid) end addCommandHandler( "w", cmd.w ) function cmd.re(playerid, cmd, ...) if not exports.sarp_main:isPlayerLogged(playerid) then return end local message = table.concat( {...}, " ", 1, #{...} ) local playerid2 = getElementData(playerid, "lastPlayerMSG") if not isElement(playerid2) then return exports.sarp_notify:addNotify(playerid, "Nie pisałeś ostatnio z żadną osobą.") end if message == '' then return exports.sarp_notify:addNotify(playerid, "Użyj: /re [wiadomość]") end if playerid == playerid2 then return exports.sarp_notify:addNotify(playerid, "Nie możesz wysłać wiadomości do siebie.") end if getElementData(playerid2, "blockPW") then return exports.sarp_notify:addNotify(playerid, "Gracz o podanym id zablokował otrzymywanie wiadomości.") end local text text = string.format("(( %s (%d): %s ))", exports.sarp_main:getPlayerRealName(playerid2), getElementData(playerid2, "player:mtaID"), message) triggerClientEvent( "addPlayerOOCMessage", playerid, text, 241, 206, 150 ) text = string.format("(( %s (%d): %s ))", exports.sarp_main:getPlayerRealName(playerid), getElementData(playerid, "player:mtaID"), message) triggerClientEvent( "addPlayerOOCMessage", playerid2, text, 255, 188, 93 ) exports.sarp_logs:createLog('PW', string.format('[UID: %d] %s wysyła wiadomość do [UID: %d] %s: %s', getElementData(playerid, "player:id"), getElementData(playerid, "player:username"), getElementData(playerid2, "player:id"), getElementData(playerid2, "player:username"), message)) setElementData(playerid, "lastPlayerMSG", playerid2) setElementData(playerid2, "lastPlayerMSG", playerid) end addCommandHandler( "re", cmd.re ) function cmd.sprobuj(playerid, cmd, ...) if not exports.sarp_main:isPlayerLogged(playerid) then return end local message = table.concat({...}, " ") if string.len(message) == 0 then return exports.sarp_notify:addNotify(playerid, "Użyj: /sprobuj [akcja]") end local random = math.random(1, 2) if getElementData(playerid, "player:sex") == 1 then if random == 1 then triggerEvent( "main:me", playerid, string.format("zawiódł próbując %s.", message) ) else triggerEvent( "main:me", playerid, string.format("odniósł sukces próbując %s.", message) ) end else if random == 1 then triggerEvent( "main:me", playerid, string.format("zawiódła próbując %s.", message) ) else triggerEvent( "main:me", playerid, string.format("odniósła sukces próbując %s.", message) ) end end end addCommandHandler( "sprobuj", cmd.sprobuj ) function cmd.pokaz(playerid, cmd, document, id) if not exports.sarp_main:isPlayerLogged(playerid) then return end if document == 'prawko' then local playerid2 = exports.sarp_main:getPlayerFromID(id) local haveDocument = exports.sarp_main:havePlayerDocument(playerid, 2) if not haveDocument then return exports.sarp_notify:addNotify(playerid, "Nie posiadasz prawo jazdy.") end if not playerid2 then return exports.sarp_notify:addNotify(playerid, "Użyj: /pokaz prawko [ID gracza]") end if playerid == playerid2 then return exports.sarp_notify:addNotify(playerid, "Nie możesz pokazać sobie dokumentu.") end triggerEvent( "main:me", playerid, string.format("pokazuje prawo jazdy dla %s.", exports.sarp_main:getPlayerRealName(playerid2)) ) outputChatBox( string.format("** Gracz %s pokazał tobie swoje prawo jazdy. (Imie i nazwisko: %s, Punkty karne: %d/24) **", exports.sarp_main:getPlayerRealName(playerid), getElementData(playerid, "player:username"), 0), playerid2, 150, 150, 200) elseif document == 'dowod' then local playerid2 = exports.sarp_main:getPlayerFromID(id) local haveDocument = exports.sarp_main:havePlayerDocument(playerid, 1) if not haveDocument then return exports.sarp_notify:addNotify(playerid, "Nie posiadasz dowodu osobistego.") end if not playerid2 then return exports.sarp_notify:addNotify(playerid, "Użyj: /pokaz dowod [ID gracza]") end if playerid == playerid2 then return exports.sarp_notify:addNotify(playerid, "Nie możesz pokazać sobie dokumentu.") end triggerEvent( "main:me", playerid, string.format("pokazuje dowód osobisty dla %s.", exports.sarp_main:getPlayerRealName(playerid2)) ) outputChatBox( string.format("** Gracz %s pokazał tobie swój dowód osobisty. (Imie i nazwisko: %s, Wiek: %d lat) **", exports.sarp_main:getPlayerRealName(playerid), getElementData(playerid, "player:username"), getElementData(playerid, "player:age")), playerid2, 150, 150, 200) else return exports.sarp_notify:addNotify(playerid, "Użyj: /pokaz [dowod, prawko]") end end addCommandHandler( "pokaz", cmd.pokaz ) function cmd.akceptujsmierc(playerid, cmd) if not exports.sarp_main:isPlayerLogged(playerid) then return end local bwTime = getElementData(playerid, "player:bw") if not bwTime or bwTime <= 0 then return exports.sarp_notify:addNotify(playerid, "Aby użyć tej komendy musisz być nieprzytomny.") end if getElementData(playerid, "player:hours") < 3 then return exports.sarp_notify:addNotify(playerid, "Aby użyć tej komendy musisz mieć przegrane przynajmniej 3 godziny na postaci.") end triggerClientEvent(playerid, "acceptDeath", playerid ) end addCommandHandler( "akceptujsmierc", cmd.akceptujsmierc ) function cmd.silownia(playerid, cmd) if not exports.sarp_main:isPlayerLogged(playerid) then return end local doorid = getElementData(playerid, "player:door") if getElementData(playerid, "player:earnStrength") then triggerClientEvent( "stopEarnStrength", playerid ) setElementData( playerid, "player:earnStrength", false ) return end if not doorid or not exports.sarp_doors:isDoorGroupType(doorid, 11) then return exports.sarp_notify:addNotify(playerid, "Nie możesz użyć tutaj tej komendy.") end local query = exports.sarp_mysql:mysql_result("SELECT *, SUM(`earnPoints`) AS points FROM `sarp_gym` WHERE `player_id` = ? AND `date` > ? AND `type` = 1", getElementData(playerid, "player:id"), getRealTime().timestamp - 84600) local group = exports.sarp_doors:getDoorData(doorid, "ownerID") local haveTicket = false for i, v in ipairs(query) do if v.group_id == group then haveTicket = true end end if not haveTicket then return exports.sarp_notify:addNotify(playerid, "Nie posiadasz zakupionego karnetu w tej siłowni.") end if query[1] and tonumber(query[1].points) > 6 then return exports.sarp_notify:addNotify(playerid, "Limit ćwiczeń z karnetu został wykorzystany.") end setElementData(playerid, "player:earnStrength", true) triggerClientEvent(playerid, "earnStrength", playerid ) end addCommandHandler( "silownia", cmd.silownia ) function cmd.spawn(playerid, cmd) if not exports.sarp_main:isPlayerLogged(playerid) then return end local spawnList = {} table.insert(spawnList, {id = 1, type = 0, name = "Centrum handlowe"}) local query = exports.sarp_mysql:mysql_result("SELECT * FROM `sarp_hotel` WHERE `player_id` = ? AND `date` > ?", getElementData(playerid, "player:id"), getRealTime().timestamp) for i, v in ipairs(query) do table.insert(spawnList, {id = v.door_id, type = 1, name = exports.sarp_doors:getDoorData(v.door_id, "name")}) end local playerDoor = exports.sarp_doors:getPlayerDoors(playerid) for i, v in ipairs(playerDoor) do table.insert(spawnList, {id = v.id, type = 2, name = v.name}) end local query = exports.sarp_mysql:mysql_result("SELECT `doorid` FROM `sarp_doors_members` WHERE `player_id` = ?", getElementData(playerid, "player:id")) for i, v in ipairs(query) do if v.doorid then table.insert(spawnList, {id = v.id, type = 2, name = exports.sarp_doors:getDoorData(v.doorid, "name")}) end end triggerClientEvent(playerid, "spawnGUI", playerid, spawnList) end addCommandHandler( "spawn", cmd.spawn ) addEvent('playerSpawn', true) addEventHandler( 'playerSpawn', root, cmd.spawn ) function cmd.subtype(playerid, cmd) local vehicle = getPedOccupiedVehicle( playerid ) if vehicle and getElementData(vehicle, "vehicle:subType") then exports.sarp_notify:addNotify(playerid, getElementData(vehicle, "vehicle:subType")) else exports.sarp_notify:addNotify(playerid, 'Brak') end end addCommandHandler( "subtype", cmd.subtype )
--[[ LuCI - Lua Configuration Interface Copyright (C) 2014-2015 MATTHEW728960 This is free software, licensed under the GNU General Public License v2. See /LICENSE for more information. $Id$ ]]-- local fs = require "nixio.fs" local util = require "nixio.util" local running=(luci.sys.call("pidof dnsforwarder > /dev/null") == 0) if running then m = Map("dnsforwarder", translate("dnsforwarder"), translate("A DNS Cache Server with TCP ,UDP & GfwList. Use 'dnsforwarder -P' to find fake IP. dnsforwarder is running(Refresh the page!)")) else m = Map("dnsforwarder", translate("dnsforwarder"), translate("A DNS Cache Server with TCP ,UDP & GfwList. Use 'dnsforwarder -P' to find fake IP. dnsforwarder is not running(Refresh the page!)")) end b = m:section(TypedSection, "dnsforwarder", "Basic") b.addremove = false b.anonymous = true en = b:option(Flag, "enabled", translate("Enable")) en.rmempty = false function en.cfgvalue(self, section) return luci.sys.init.enabled("dnsforwarder") and self.enabled or self.disabled end function en.write(self, section, value) if value == "1" then luci.sys.call("/etc/init.d/dnsforwarder enable >/dev/null") luci.sys.call("/etc/init.d/dnsforwarder start >/dev/null") else luci.sys.call("/etc/init.d/dnsforwarder stop >/dev/null") luci.sys.call("/etc/init.d/dnsforwarder disable >/dev/null") end Flag.write(self, section, value) end path = b:option(Value, "path", translate("Path")) path.default = "/tmp/dnsforwarder.config" path.optional = false s = m:section(TypedSection, "dnsforwarder", translate("Configuration")) s.anonymous = true conf = s:tab("editconf_file", translate("File")) editconf_file = s:taboption("editconf_file", Value, "_editconf_file", "", translate("Comment by #")) editconf_file.template = "cbi/tvalue" editconf_file.rows = 20 editconf_file.wrap = "off" function editconf_file.cfgvalue(self, section) return fs.readfile("/etc/dnsforwarder.config") or "" end function editconf_file.write(self, section, value) if value then value = value:gsub("\r\n?", "\n") fs.writefile("/tmp/dnsforwarder.config", value) if (luci.sys.call("cmp -s /tmp/dnsforwarder.config /etc/dnsforwarder.config") == 1) then fs.writefile("/etc/dnsforwarder.config", value) end fs.remove("/tmp/dnsforwarder.config") end end return m
EditorSpawnGageAssignment = EditorSpawnGageAssignment or class(MissionScriptEditor) EditorSpawnGageAssignment.USES_POINT_ORIENTATION = true function EditorSpawnGageAssignment:create_element() self.super.create_element(self) self._element.class = "ElementSpawnGageAssignment" end
local _M = {} local timer_mt = { __index = {} } local timer = timer_mt.__index -- create new event list function _M.new () return setmetatable ({jobs={}}, timer_mt) end -- add event -- f() is called no sooner than time t function timer:add (t, f) local job={time=t, func=f} local ins = -1 for i,v in ipairs (self.jobs) do if v.time > t then ins = i break end end if ins > 0 then table.insert (self.jobs, ins, job) else table.insert (self.jobs, job) end end -- add relatike event -- f() is called no sooner than time now+t -- (t is seconds in most systems) function timer:add_rel (t, f) return self:add (os.time() + t, f) end -- add repeatig event -- f() is called no more often than once each t -- (seconds in most systems) function timer:add_rep (t, f) local function w () f () return self:add_rel (t, w) end return self:add_rel (t, w) end -- called periodically function timer:tick () while self.jobs[1] and os.time() >= self.jobs[1].time do local job = table.remove (self.jobs, 1) job.func() end end return _M
CMD.name = 'GiveItem' CMD.description = 'command.giveitem.description' CMD.syntax = 'command.giveitem.syntax' CMD.permission = 'moderator' CMD.category = 'permission.categories.character_management' CMD.arguments = 2 CMD.player_arg = 1 CMD.aliases = { 'chargiveitem', 'plygiveitem' } function CMD:on_run(player, targets, item_name, amount) local item_obj = Item.find(item_name) amount = tonumber(amount) or 1 if item_obj then for k, v in ipairs(targets) do local success, error_text = v:give_item(item_obj.id, amount) if success then v:notify('notification.item_given', { amount = amount, item = item_obj.name }) else player:notify(error_text) end end self:notify_staff('command.giveitem.message', { player = get_player_name(player), target = util.player_list_to_string(targets), amount = amount, item = item_obj.name }) else player:notify('error.invalid_item', { item = item_name }) end end
AddCSLuaFile() AddCSLuaFile("ammo.lua") AddCSLuaFile("cl_init.lua") include("ammo.lua") -- Base info SWEP.Base = "weapon_base" -- Spawnmenu info SWEP.Category = "Roleplay Weapons" SWEP.Spawnable = true SWEP.AdminOnly = true SWEP.DisableDuplicator = true -- Weapon selection menu info SWEP.AutoSwitchFrom = false SWEP.AutoSwitchTo = false -- Print info SWEP.PrintName = "Roleplay Weapons Base" SWEP.Author = "Arkten" -- Viewport info SWEP.ViewModel = "models/weapons/c_pistol.mdl" SWEP.WorldModel = "models/weapons/w_pistol.mdl" SWEP.UseHands = true SWEP.HoldType = "pistol" SWEP.CSMuzzleFlashes = true SWEP.CSMuzzleX = false -- Primary info SWEP.Primary.Ammo = "Test Ammo" SWEP.Primary.ClipSize = 12 SWEP.Primary.DefaultClip = 0 SWEP.Primary.Automatic = false SWEP.Primary.RPM = 600 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0 SWEP.Primary.SpreadIncrease = 0.02 -- Secondary info SWEP.Secondary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true -- Sound info SWEP.Sound_Single = Sound("Weapon_Pistol.Single") SWEP.Sound_Empty = Sound("Weapon_Pistol.Empty") SWEP.Sound_Suppressed = Sound("Weapon_USP.SilencedShot") SWEP.Sound_Toggle = Sound("Weapon_Glock.Sliderelease") -- Lowering info SWEP.LowerPosition = Vector(0, 0, 5) SWEP.LowerAngle = Angle(25, 0, 0) SWEP.LowerTime = 0.18 -- Misc info SWEP.IsHeavyWeapon = false SWEP.HasSuppressor = false -- Table for holding all single-handed hold types SWEP.SingleHandHoldTypes = {} SWEP.SingleHandHoldTypes["pistol"] = true SWEP.SingleHandHoldTypes["grenade"] = true SWEP.SingleHandHoldTypes["melee"] = true SWEP.SingleHandHoldTypes["fist"] = true SWEP.SingleHandHoldTypes["melee2"] = true SWEP.SingleHandHoldTypes["knife"] = true SWEP.SingleHandHoldTypes["camera"] = true SWEP.SingleHandHoldTypes["magic"] = true SWEP.SingleHandHoldTypes["revolver"] = true SWEP.SingleHandHoldTypes["duel"] = true -- Set up network variables function SWEP:SetupDataTables() -- Whether or not the weapon is currently suppressedby an attachable suppressor self:NetworkVar("Bool", 0, "Suppressed") -- Whether or not the weapon is lowered self:NetworkVar("Bool", 1, "Lowered") -- Indicates the time we are able to play our next animation so we do not interrupt self:NetworkVar("Float", 0, "AnimationDelay") end -- Called when the weapon is initializing function SWEP:Initialize() -- Initialize network variables self:SetSuppressed(false) self:SetLowered(true) self:SetAnimationDelay(0) -- Override SWEP.GetLowered in Initialize after the data table has been set up function self:GetLowered() -- Check if the weapon is lowered return not self:GetOwner():KeyDown(IN_ATTACK2) or self:GetOwner():IsSprinting() end -- Set the weapon's holdtype self:SetHoldType(self.HoldType) -- Register if the weapon is automatic self.HasAutoMode = self.Primary.Automatic end -- Get your gun out function SWEP:Deploy() -- Check if we have a suppressor on us if self:GetSuppressed() then -- Play suppressed idle animation so that the draw animation does not play self:SendWeaponAnim(ACT_VM_IDLE_SILENCED) else -- Play default idle animation so that the draw animation does not play self:SendWeaponAnim(ACT_VM_IDLE) end -- Return true to allow switching away from this weapon using lastinv command return true end -- Disable switching weapons while doing an animation function SWEP:Holster() return self:GetAnimationDelay() < CurTime() end -- Called whenever +reload is pressed function SWEP:Reload() -- Return if we are doing an animation if self:GetAnimationDelay() >= CurTime() then return end -- Check if we have ammo left if self:GetOwner():GetAmmoCount(self.Primary.Ammo) > 0 then -- Check if we have a suppressor on us if self:GetSuppressed() then -- Play the suppressed reload animation self:SendWeaponAnim(ACT_VM_RELOAD_SILENCED) else -- Play the default reload animation self:SendWeaponAnim(ACT_VM_RELOAD) end -- Reset holdtype so the animation can play self:SetHoldType(self.HoldType) -- Play the worldmodel animation self:GetOwner():SetAnimation(PLAYER_RELOAD) -- Set the cooldowns self:SetNextPrimaryFire(CurTime() + self:GetOwner():GetViewModel():SequenceDuration()) self:SetNextSecondaryFire(CurTime() + self:GetOwner():GetViewModel():SequenceDuration()) self:SetAnimationDelay(CurTime() + self:GetOwner():GetViewModel():SequenceDuration()) -- Wait for the reload to finish timer.Simple(self:GetOwner():GetViewModel():SequenceDuration(), function() -- Safety check if IsValid(self) and IsValid(self:GetOwner()) then -- Do not throw away full magazines if self:Clip1() != self.Primary.ClipSize then -- Subtract a full magazine from the ammo we have left self:GetOwner():SetAmmo(self:GetOwner():GetAmmoCount(self:GetPrimaryAmmoType()) - self.Primary.ClipSize, self:GetPrimaryAmmoType()) end -- Make the magazine full self:SetClip1(self.Primary.ClipSize) end end) end end -- Called every frame after the think function SWEP:PostThink() end -- Called every frame function SWEP:Think() -- Reduce Spread over time self.Primary.Cone = math.Clamp(self.Primary.Cone - (self.Primary.SpreadIncrease / 20), 0, 1) -- Return if we are doing an animation if self:GetAnimationDelay() >= CurTime() then -- Call post think self:PostThink() -- Return so that we don't interrupt the animations return end -- Check if we have our weapon lowered if self:GetLowered() then -- Check if it is a single-handed weapon or if we are ducking or if we are under water if self.SingleHandHoldTypes[self.HoldType] or self:GetOwner():KeyDown(IN_DUCK) or self:GetOwner():WaterLevel() == 3 then -- Set the holdtype to be normal self:SetHoldType("normal") else -- Set the holdtype to be passive self:SetHoldType("passive") end else -- Reset our holdtype as we are just aiming normally self:SetHoldType(self.HoldType) end -- Call post think self:PostThink() end -- Called before animation events are fired function SWEP:FireAnimationEvent(pos, ang, event, options) -- Disables animation based muzzle event when weapon is suppressed if event == 21 and self:GetSuppressed() then return true end -- Disable thirdperson muzzle flash when weapon is suppressed if event == 5003 and self:GetSuppressed() then return true end -- Check if the animation is a muzzle flash event if event == 5001 or event == 5011 or event == 5021 or event == 5031 then -- Disable muzzle flash when we have a suppresoor on us if self:GetSuppressed() then return true end -- Check if we use CS-like muzzle flashes if self.CSMuzzleFlashes then -- Create the effect data local data = EffectData() data:SetFlags(0) data:SetEntity(self:GetOwner():GetViewModel()) data:SetAttachment(math.floor((event - 4991) / 10)) data:SetScale(1) -- Check if we use the X-shaped CS-like muzzle flashes if self.CSMuzzleX then -- Fire the X-shaped CS-like muzzle flash util.Effect("CS_MuzzleFlash_X", data) else -- Fire the default CS-like muzzle flash util.Effect("CS_MuzzleFlash", data) end -- Return true to override the current animation event return true end end end -- Check if we can use primary attack function SWEP:CanPrimaryAttack() -- Check if we are under water or the weapon is lowered if self:GetOwner():WaterLevel() == 3 or self:GetLowered() then return false elseif self:Clip1() <= 0 then -- Emit the empty clip sound as we have no ammo self:EmitSound(self.Sound_Empty) -- Return false as we have nothing to shoot return false end -- Return true to allow primary attack return true end -- Check if we can use secondary attack function SWEP:CanSecondaryAttack() -- Return whether we have a suppressor return self.HasSuppressor end -- Called when a player presses +attack1 function SWEP:PrimaryAttack() -- Switch fire modes with +use and +attack1 if self:GetOwner():KeyDown(IN_USE) and self.HasAutoMode then -- Set the cooldowns self:SetNextPrimaryFire(CurTime() + 2 * self.LowerTime) self:SetNextSecondaryFire(CurTime() + 2 * self.LowerTime) -- Toggle fire modes self.Primary.Automatic = not self.Primary.Automatic -- Play the toggle sound self:EmitSound(self.Sound_Toggle) -- Return as we do not want to shoot return end -- Set the shoot cooldown using the weapon's RPM self:SetNextPrimaryFire(CurTime() + (60 / self.Primary.RPM)) -- Check if we can shoot if not self:CanPrimaryAttack() then return end -- Check if we have a suppressor on us if self:GetSuppressed() then -- Play the suppressed sound self:EmitSound(self.Sound_Suppressed) else -- Play the default sound self:EmitSound(self.Sound_Single) end -- Take one bullet self:TakePrimaryAmmo(1) -- Shoot the bullet self:ShootBullet() end -- Called when a player presses +attack2 function SWEP:SecondaryAttack() -- Check if we can attach or detach a suppressor if not self:CanSecondaryAttack() then return end -- Use a suppressor with +use and +attack2 if self:GetOwner():KeyDown(IN_USE) then -- Get the suppress bool local ShouldSuppress = not self:GetSuppressed() -- Toggle suppressing self:SetSuppressed(ShouldSuppress) -- Check if this weapon should be suppressed if ShouldSuppress then -- Play the attach animation self:SendWeaponAnim(ACT_VM_ATTACH_SILENCER) else -- Play the detach animation self:SendWeaponAnim(ACT_VM_DETACH_SILENCER) end -- Set the cooldowns self:SetNextPrimaryFire(CurTime() + self:GetOwner():GetViewModel():SequenceDuration()) self:SetNextSecondaryFire(CurTime() + self:GetOwner():GetViewModel():SequenceDuration()) self:SetAnimationDelay(CurTime() + self:GetOwner():GetViewModel():SequenceDuration()) -- Return as we do not want to shoot return end end -- Called to create the shoot effects function SWEP:ShootEffects() -- Check if we have a suppressor on us if self:GetSuppressed() then -- Play the suppressed attack animation self:SendWeaponAnim(ACT_VM_PRIMARYATTACK_SILENCED) else -- Play the default attack animation self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) end -- Draw the muzzle flash self:GetOwner():MuzzleFlash() -- Do the worldmodel animation self:GetOwner():SetAnimation(PLAYER_ATTACK1) end -- Called whenever this weapon shoots a bullet function SWEP:ShootBullet() -- Add spread self.Primary.Cone = math.Clamp(self.Primary.Cone + self.Primary.SpreadIncrease, 0, 1) -- Get the force specified by the ammo type local force = game.GetAmmoForce(self:GetPrimaryAmmoType()) -- Create bullet data local bullet = { Num = self.Primary.NumShots, Src = self:GetOwner():GetShootPos(), Dir = self:GetOwner():GetAimVector(), AmmoType = self.Primary.Ammo, Spread = Vector(self.Primary.Cone * self.Primary.NumShots, self.Primary.Cone * self.Primary.NumShots, 0), Tracer = 0, Force = force, Damage = force } -- Fire the bullet self:GetOwner():FireBullets(bullet) -- Do the effects self:ShootEffects() -- Get the player's eye angles local eyeang = self:GetOwner():EyeAngles() -- Shift the pitch depending on the force eyeang.pitch = eyeang.pitch - force / 50 -- Apply new angles self:GetOwner():SetEyeAngles(eyeang) -- Viewpunch the player self:GetOwner():ViewPunch(Angle(-1, 0, 0)) end
-- statusline.lua -- source https://icyphox.sh/blog/nvim-lua/ local mode_map = { ['n'] = 'normal ', ['no'] = 'n·operator pending ', ['v'] = 'visual ', ['V'] = 'v·line ', [''] = 'v·block ', ['s'] = 'select ', ['S'] = 's·line ', [''] = 's·block ', ['i'] = 'insert ', ['R'] = 'replace ', ['Rv'] = 'v·replace ', ['c'] = 'command ', ['cv'] = 'vim ex ', ['ce'] = 'ex ', ['r'] = 'prompt ', ['rm'] = 'more ', ['r?'] = 'confirm ', ['!'] = 'shell ', ['t'] = 'terminal ' } --[[ The idea is to get the current mode from vim.api.nvim_get_mode() and map it to our desired text. Let’s wrap that around in a small mode() function ]]-- local function mode() local m = vim.api.nvim_get_mode().mode if mode_map[m] == nil then return m end return mode_map[m] end --[[ Now, set up your highlights. Again, there isn’t any interface for highlights yet, so whip out that vim.api.nvim_exec() ]]-- vim.api.nvim_exec( [[ hi PrimaryBlock ctermfg=06 ctermbg=00 hi SecondaryBlock ctermfg=08 ctermbg=00 hi Blanks ctermfg=07 ctermbg=00 ]], false) --[[ Create a new table to represent the entire statusline itself. You can add any other functions you want (like one that returns the current git branch, for instance). Read :h 'statusline' if you don’t understand what’s going on here. ]]-- local stl = { '%#PrimaryBlock#', mode(), '%#SecondaryBlock#', '%#Blanks#', '%f', '%m', '%=', '%#SecondaryBlock#', '%l,%c ', '%#PrimaryBlock#', '%{&filetype}', } --[[ Finally, with the power of table.concat(), set your statusline. This is akin to doing a series of string concatenations, but way faster. ]]-- vim.o.statusline = table.concat(stl)
theme_park_marauder_pirate_leader = Creature:new { objectName = "@mob/creature_names:marooned_pirate_captain", socialGroup = "pirate", faction = "pirate", level = 24, chanceHit = 0.35, damageMin = 210, damageMax = 220, baseXp = 2543, baseHAM = 3800, baseHAMmax = 4200, armor = 0, resists = {20,20,10,40,-1,40,10,-1,-1}, meatType = "", meatAmount = 0, hideType = "", hideAmount = 0, boneType = "", boneAmount = 0, milk = 0, tamingChance = 0, ferocity = 0, pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY, creatureBitmask = PACK + KILLER, optionsBitmask = AIENABLED, diet = HERBIVORE, templates = {"object/mobile/dressed_scarab_pirate_general_twilek_male_01.iff"}, lootGroups = { { groups = { {group = "theme_park_loot_marauder_pirate_rifle", chance = 10000000} }, lootChance = 10000000 } }, weapons = {"pirate_weapons_heavy"}, conversationTemplate = "", attacks = merge(brawlermaster,marksmanmaster) } CreatureTemplates:addCreatureTemplate(theme_park_marauder_pirate_leader, "theme_park_marauder_pirate_leader")
local DATA = {} DATA.Name = "defansif" DATA.HoldType = "defansif" DATA.BaseHoldType = "normal" DATA.Translations = {} DATA.Translations[ ACT_LAND ] = { { Sequence = "ryoku_a_s2_land", Weight = 1 }, } DATA.Translations[ ACT_MP_STAND_IDLE ] = { { Sequence = "phalanx_h_idle", Weight = 1 }, } DATA.Translations[ ACT_MP_ATTACK_STAND_PRIMARYFIRE ] = { { Sequence = "vanguard_r_right_t3", Weight = 1, Time = 0.5, Rate = nil }, { Sequence = "vanguard_r_s1_t2", Weight = 1, Time = 0.6, Rate = nil }, { Sequence = "vanguard_b_s2_t2", Weight = 1}, } DATA.Translations[ ACT_MP_RUN ] = { { Sequence = "b_run", Weight = 1 }, } DATA.Translations[ ACT_MP_WALK ] = { { Sequence = "walk_grenade", Weight = 1 }, } DATA.Translations[ ACT_MP_JUMP ] = { { Sequence = "h_jump", Weight = 1 }, } DATA.Translations[ ACT_MP_CROUCH_IDLE ] = { { Sequence = "crouchidle_knife", Weight = 1 }, } wOS.AnimExtension:RegisterHoldtype( DATA )
local Ui = require 'neogit.lib.ui' local Component = require 'neogit.lib.ui.component' local util = require 'neogit.lib.util' local col = Ui.col local row = Ui.row local text = Ui.text local map = util.map local M = {} -- * commit e0a6cd38f783a6028cf1f18a72fdbb761ad2fd62 (HEAD -> commit-inspection, origin/commit-inspection) -- | Author: TimUntersberger <timuntersberger2@gmail.com> -- | AuthorDate: Sat May 29 19:31:30 2021 +0200 -- | Commit: TimUntersberger <timuntersberger2@gmail.com> -- | CommitDate: Sat May 29 19:31:30 2021 +0200 -- | -- | feat: improve commit view and ui lib -- | M.Commit = Component.new(function(commit, show_graph) return col { row { text(show_graph and ("* "):rep(commit.level + 1) or "* ", { highlight = "Character" }), text(commit.oid:sub(1, 7), { highlight = "Number" }), text " ", text(commit.description[1]) }, col.hidden(true).padding_left((commit.level + 1) * 2) { row { text "Author: ", text(commit.author_name), text " <", text(commit.author_date), text ">" }, row { text "AuthorDate: ", text(commit.author_date) }, row { text "Commit: ", text(commit.committer_name), text " <", text(commit.committer_date), text ">" }, row { text "CommitDate: ", text(commit.committer_date) }, text " ", col(map(commit.description, text), { padding_left = 4 }) } } end) function M.LogView(data, show_graph) return map(data, function(row) return M.Commit(row, show_graph) end) end return M
-- digicompute/init.lua digicompute = {} digicompute.VERSION = 0.5 digicompute.RELEASE_TYPE = "beta" digicompute.path = minetest.get_worldpath().."/digicompute/" -- digicompute directory digicompute.modpath = minetest.get_modpath("digicompute") -- modpath local modpath = digicompute.modpath -- modpath pointer -- Load builtin dofile(modpath.."/builtin.lua") -- Logger function digicompute.log(content, log_type) assert(content, "digicompute.log content nil") if log_type == nil then log_type = "action" end minetest.log(log_type, "[digicompute] "..content) end -- Create mod directory inside world directory digicompute.builtin.mkdir(digicompute.path) -- Load environment utilities dofile(modpath.."/env.lua") ------------------- ----- MODULES ----- ------------------- local loaded_modules = {} local settings = Settings(modpath.."/modules.conf"):to_table() -- [function] Get module path function digicompute.get_module_path(name) local module_path = modpath.."/modules/"..name if digicompute.builtin.exists(module_path.."/init.lua") then return module_path end end -- [function] Load module (overrides modules.conf) function digicompute.load_module(name) if loaded_modules[name] ~= false then local module_init = digicompute.get_module_path(name).."/init.lua" if module_init then dofile(module_init) loaded_modules[name] = true return true else digicompute.log("Invalid module \""..name.."\". The module either does not exist ".. "or is missing an init.lua file.", "error") end else return true end end -- [function] Require module (does not override modules.conf) function digicompute.require_module(name) if settings[name] and settings[name] ~= false then return digicompute.load_module(name) end end for name,enabled in pairs(settings) do if enabled ~= false then digicompute.load_module(name) end end
local yatm_network = { kind = "hub", groups = { hub = 1, energy_consumer = 1, }, default_state = "off", states = { error = "yatm_device_hubs:hub_bus_error", conflict = "yatm_device_hubs:hub_bus_error", off = "yatm_device_hubs:hub_bus_off", on = "yatm_device_hubs:hub_bus_on", }, energy = { capacity = 200, passive_lost = 1, network_charge_bandwidth = 10, startup_threshold = 20, } } yatm.devices.register_stateful_network_device({ basename = "yatm_device_hubs:hub_bus", description = "Hub (bus)", groups = {cracky = 1}, drop = yatm_network.states.off, use_texture_alpha = "clip", tiles = { "yatm_hub_top.off.png", "yatm_hub_bottom.png", "yatm_hub_side.off.png", "yatm_hub_side.off.png^[transformFX", "yatm_hub_side.off.png", "yatm_hub_side.off.png", }, drawtype = "nodebox", node_box = yatm_device_hubs.HUB_NODEBOX, paramtype = "light", paramtype2 = "facedir", after_place_node = yatm_device_hubs.hub_after_place_node, yatm_network = yatm_network, refresh_infotext = yatm_device_hubs.hub_refresh_infotext, }, { error = { tiles = { "yatm_hub_top.error.png", "yatm_hub_bottom.png", "yatm_hub_side.error.png", "yatm_hub_side.error.png^[transformFX", "yatm_hub_side.error.png", "yatm_hub_side.error.png", }, }, on = { tiles = { "yatm_hub_top.on.png", "yatm_hub_bottom.png", "yatm_hub_side.on.png", "yatm_hub_side.on.png^[transformFX", "yatm_hub_side.on.png", "yatm_hub_side.on.png", }, }, })
require 'setup/setup' local dummy = { dummy = "dummy" } -- we fulfill or reject with this when we don't intend to test against it describe("2.2.4: `onFulfilled` or `onRejected` must not be called until the execution context stack contains only platform code.", function() describe("`then` returns before the promise becomes fulfilled or rejected", function() testFulfilled(dummy, function(promise, done) local thenHasReturned = false promise:Then(function() assert.equal(thenHasReturned, true) done() end) thenHasReturned = true end) testRejected(dummy, function(promise, done) local thenHasReturned = false promise:Then(nil, function() assert.equal(thenHasReturned, true) done() end) thenHasReturned = true end) end) describe("Clean-stack execution ordering tests (fulfillment case)", function() specify("when `onFulfilled` is added immediately before the promise is fulfilled", function(done) local d = deferred() local onFulfilledCalled = false d.promise:Then(function() onFulfilledCalled = true done() end) d.resolve(dummy) assert.equal(onFulfilledCalled, false) end) specify("when `onFulfilled` is added immediately after the promise is fulfilled", function(done) local d = deferred() local onFulfilledCalled = false d.resolve(dummy) d.promise:Then(function() onFulfilledCalled = true done() end) assert.equal(onFulfilledCalled, false) end) specify("when one `onFulfilled` is added inside another `onFulfilled`", function(done) local promise = resolved() local firstOnFulfilledFinished = false promise:Then(function() promise:Then(function() assert.equal(firstOnFulfilledFinished, true) done() end) firstOnFulfilledFinished = true end) end) specify("when `onFulfilled` is added inside an `onRejected`", function(done) local promise = rejected() local promise2 = resolved() local firstOnRejectedFinished = false promise:Then(nil, function() promise2:Then(function() assert.equal(firstOnRejectedFinished, true) done() end) firstOnRejectedFinished = true end) end) specify("when the promise is fulfilled asynchronously", function(done) local d = deferred() local firstStackFinished = false setTimeout(function() d.resolve(dummy) firstStackFinished = true end, 0) d.promise:Then(function() assert.equal(firstStackFinished, true) done() end) end) end) describe("Clean-stack execution ordering tests (rejection case)", function() specify("when `onRejected` is added immediately before the promise is rejected", function(done) local d = deferred() local onRejectedCalled = false d.promise:Then(nil, function() onRejectedCalled = true done() end) d.reject(dummy) assert.equal(onRejectedCalled, false) end) specify("when `onRejected` is added immediately after the promise is rejected", function(done) local d = deferred() local onRejectedCalled = false d.reject(dummy) d.promise:Then(nil, function() onRejectedCalled = true done() end) assert.equal(onRejectedCalled, false) end) specify("when `onRejected` is added inside an `onFulfilled`", function(done) local promise = resolved() local promise2 = rejected() local firstOnFulfilledFinished = false promise:Then(function() promise2:Then(nil, function() assert.equal(firstOnFulfilledFinished, true) done() end) firstOnFulfilledFinished = true end) end) specify("when one `onRejected` is added inside another `onRejected`", function(done) local promise = rejected() local firstOnRejectedFinished = false promise:Then(nil, function() promise:Then(nil, function() assert.equal(firstOnRejectedFinished, true) done() end) firstOnRejectedFinished = true end) end) specify("when the promise is rejected asynchronously", function(done) local d = deferred() local firstStackFinished = false setTimeout(function() d.reject(dummy) firstStackFinished = true end, 0) d.promise:Then(nil, function() assert.equal(firstStackFinished, true) done() end) end) end) end)
bgNPC:SetStateAction('disappearance', 'calm', { start = function(actor, state, data) local npc = actor:GetNPC() if not IsValid(npc) then return end npc:slibFadeRemove(1.5) end, not_stop = function(actor, state, data) return actor:EnemiesCount() == 0 end })
local AddonName, AddonTable = ... -- Castle Nathria AddonTable.castlenathria = { -- Shriekwing 183034, -- Cowled Batwing Cloak 182976, -- Double-Chained Utility Belt 182993, -- Chiropteran Leggings 183027, -- Errant Crusader's Greaves 182979, -- Slippers of the Forgotten Heretic -- Huntsman Altimor 183258, -- A Memory of Eagletalon's True Focus 183361, -- A Memory of Spiritwalker's Tidal Totem 183235, -- A Memory of The Natural Order's Will 183892, -- Mystic Anima Spherule 183040, -- Charm of Eternal Winter 182988, -- Master Huntsman's Bandolier 182996, -- Grim Pursuant's Maille 183018, -- Hellhound Cuffs 182995, -- Spell-Woven Tourniquet -- Sun King's Salvation 183304, -- A Memory of Shadowbreaker, Dawn of the Sun 183277, -- A Memory of Sun King's Blessing 183893, -- Abominable Anima Spherule 183033, -- Mantle of Manifest Sins 182986, -- High Torturer's Smock 182977, -- Bangles of Errant Pride 183007, -- Bleakwing Assassin's Grips 183025, -- Stoic Guardsman's Belt -- Artificer Xy'mox 183370, -- A Memory of Balespider's Burning Core 183296, -- A Memory of Last Emporer's Capacitor 183888, -- Apogee Anima Bead 183960, -- Portable Pocket Dimension [Bag] 182987, -- Breastplate of Cautious Calculation 183019, -- Precisely Calibrated Chronometer 183004, -- Shadewarped Sash 183012, -- Greaves of Enigmatic Energies 183038, -- Hyperlight Band -- Hungering Destroyer 182630, -- A Memory of Gorefiend's Domination 183391, -- A Memory of The Wall 183891, -- Venerated Anima Spherule 183001, -- Helm of Insatiable Appetite 182994, -- Epaulettes of Overwhelming Force 183000, -- Consumptive Chainmail Carapace 183009, -- Miasma-lacquered Jerkin 183028, -- Cinch of Infinite Tightness 182992, -- Endlessly Gluttonous Greaves 183024, -- Volatile Shadestitch Legguards -- Lady Inerva Darkvein 183218, -- A Memory of Cloak of Fel Flames 183240, -- A Memory of Memory of the Mother Tree 183889, -- Thaumaturgic Anima Bead 183021, -- Confidant's Favored Cap 183026, -- Gloves of Phantom Shadows 183015, -- Binding of Warped Desires 182985, -- Memento-Laden Cuisses 183037, -- Ritulist's Treasured Ring -- The Council of Blood 183328, -- A Memory of Talbadar's Stratagem 183334, -- A Memory of the Dashing Scoundrel 183890, -- Zenith Anima Spherule 183039, -- Noble's Birthstone Pendant 182989, -- Corset of the Deft Duelist 183014, -- Castellan's Chainlink Grips 183011, -- Courtier's Costume Trousers 183030, -- Enchanted Toe-Tappers 183023, -- Sparkling Glass Slippers 182983, -- Stoneguard Attendant's Boots -- Sludgefist 183374, -- A Memory of Cinders of the Azj'Aqir 183318, -- A Memory of Clarity of Mind 183233, -- A Memory of Frenzyband 183340, -- A Memory of Greenskin's Wickers 182635, -- A Memory of Koltira's Favor 183356, -- A Memory of Primal Lava Actuators 183264, -- A Memory of Rylakstalker's Confounding Strikes 183272, -- A Memory of Siphon Storm 183293, -- A Memory of Tear of Morning 183309, -- A Memory of Ardent Protector's Sanctum 183389, -- A Memory of Will of the Berserker 182999, -- Rampaging Giant's Chestplate 182984, -- Colossal Plate Gauntlets 183022, -- Impossibly Oversized Mitts 183005, -- Heedless Pugilist's Harness 183016, -- Load-Bearing Belt 182981, -- Leggings of Lethal Reverberations 183006, -- Stoneclas Stompers -- Stone Legion Generals 183346, -- A Memory of Ancestral Reminder 183250, -- A Memory of Call of the Wild 183223, -- A Memory of Circle of Life and Death 183330, -- A Memory of Essence of Bloodfang 183267, -- A Memory of Expanded Potential 183283, -- A Memory of Invoker's Delight 183367, -- A Memory of Mark of Borrowed Power 183299, -- A Memory of Of Dust and Dawn 183213, -- A Memory of Sigil of the Illidari 183381, -- A Memory of Signet of Tormented Kings 182627, -- A Memory of Superstrain 183316, -- A Memory of Twins of the Sun Priestess 183895, -- Apogee Anima Bead 183894, -- Thaumaturgic Anima Bead 183029, -- Wicked Flanker's Gorget 183032, -- Crest of the Legionnaire General 182998, -- Robes of the Cursed Commando 182991, -- Oathsworn Soldier's Gauntlets 183002, -- Ceremonial Parade Legguards -- Sire Denathrius 183288, -- A Memory of Celestial Infusion 183214, -- A Memory of Chaos Theory 182636, -- A Memory of Deadliest Coil 183384, -- A Memory of Exploiter 183344, -- A Memory of Finality 183279, -- A Memory of Freezing Winds 183324, -- A Memory of Harmonious Apparatus 183362, -- A Memory of Malefic Wrath 183227, -- A Memory of Oneth's Clear Vision 183256, -- A Memory of Qa'pla, Eredun War Order 183352, -- A Memory of Skybreaker's Fiery Demise 183310, -- A Memory of Vanguard's Momentum 183896, -- Abominable Anima Spherule 183897, -- Mystic Anima Spherule 183898, -- Venerated Anima Spherule 183899, -- Zenith Anima Spherule 182997, -- Diadem of Imperious Desire 182980, -- Sadist's Sinister Mask 183003, -- Pauldrons of Fatal Finality 183020, -- Shawl of the Penitent 183036, -- Most Regal Signet of Sire Denathrius }
object_tangible_component_weapon_blaster_pistol_barrel_exceptional = object_tangible_component_weapon_shared_blaster_pistol_barrel_exceptional:new { } ObjectTemplates:addTemplate(object_tangible_component_weapon_blaster_pistol_barrel_exceptional, "object/tangible/component/weapon/blaster_pistol_barrel_exceptional.iff")
------------------------------------------------ -- Entity with physical properties. local BaseEntity = reload("entities.baseentity") local Entity = class("PhysEntity", BaseEntity) Entity.phystype = "dynamic" Entity.density = 1 Entity.mass = 0.1 Entity.w = 40 Entity.h = 40 function Entity:initialize(...) self.super:initialize(...) self.contacts = {} self.shape = love.physics.newRectangleShape(Entity.w-0.1, Entity.h-0.1) end function Entity:initPhysics() if not self.shape then error("No shape defined for entity!") end self.body = love.physics.newBody(world:getPhysWorld(), self.x, self.y, self.phystype) self.fixture = love.physics.newFixture(self.body, self.shape, self.density) self.fixture:setUserData(self) self.body:setMass(self.mass) end function Entity:spawn() self.super:spawn() self:initPhysics() end function Entity:setPos(x, y) self.x = x self.y = y if self.body then return self.body:setPosition(x, y) end end function Entity:getPos() if not self.body then return self.x, self.y end return self.body:getPosition() end function Entity:setAngle(ang) self.ang = ang if self.body then return self.body:setAngle(ang) end end function Entity:getAngle() if not self.body then return self.ang end return self.body:getAngle() end function Entity:setMass(mass) self.mass = mass if self.body then self.body:setMass(mass) end end function Entity:getMass() if self.body then return self.mass end return self.body:getMass() end function Entity:setVelocity(vx, vy) if self.body then self.body:setLinearVelocity(vx, vy) end end function Entity:getVelocity() if self.body then return self.body:getLinearVelocity() end error("Physics used before initiated!") end function Entity:setTorque(ta) if self.body then self.body:setAngularVelocity(ta) end end function Entity:getTorque() if self.body then return self.body:getAngularVelocity() end error("Physics used before initiated!") end function Entity:setFixedRotation(bool) if self.body then self.body:setFixedRotation(bool) end end function Entity:isFixedRotation() if self.body then return self.body:isFixedRotation() end error("Physics used before initiated!") end function Entity:setFriction(friction) if self.fixture then self.fixture:setFriction(friction) end end function Entity:getFriction() if self.fixture then return self.fixture:getFriction() end error("Physics used before initiated!") end function Entity:setGravityScale(scale) if self.body then self.body:setGravityScale(scale) end end function Entity:getGravityScale() if self.body then return self.body:getGravityScale() end error("Physics used before initiated!") end function Entity:applyForce(fx, fy) if self.body then self.body:applyForce(fx, fy) end end function Entity:applyLinearImpulse(ix, iy) if self.body then self.body:applyLinearImpulse(ix, iy) end end function Entity:beginContact(other, contact, isother) self.contacts[contact] = isother end function Entity:endContact(other, contact, isother) self.contacts[contact] = nil end function Entity:preSolve(other, contact, isother) end function Entity:postSolve(other, contact, normal, tangent, isother) end function Entity:postDraw() if self.shape and arguments["debug"] then love.graphics.pop() -- hack love.graphics.setColor(0, 255, 0, 100) if self.shape:typeOf("PolygonShape") then love.graphics.polygon("line", self.body:getWorldPoints( self.shape:getPoints() )) elseif self.shape:typeOf("CircleShape") then local x, y = self:getPosition() love.graphics.circle("line", x, y, self.shape:getRadius()) end love.graphics.push() -- hack end end return Entity
-- ----------------------------------------------------------------------------------------------------------------------------------------- -- -- /REVISTAR -- ----------------------------------------------------------------------------------------------------------------------------------------- -- -- local identity = vRP.getUserIdentity(user_id) -- -- local weapons = vRPclient.getWeapons(nplayer) -- -- local money = vRP.getMoney(nuser_id) -- -- local data = vRP.getUserDataTable(nuser_id) -- -- TriggerClientEvent('chatMessage',source,"",{},"^4- -  ^5M O C H I L A^4  - - - - - - - - - - - - - - - - - - - - - - - - - - -  [  ^3"..string.format("%.2f",vRP.getInventoryWeight(nuser_id)).."kg^4  /  ^3"..string.format("%.2f",vRP.getInventoryMaxWeight(nuser_id)).."kg^4  ]  - -") -- -- if data and data.inventory then -- -- for k,v in pairs(data.inventory) do -- -- TriggerClientEvent('chatMessage',source,"",{},"     "..vRP.format(parseInt(v.amount)).."x "..itemlist[k].nome) -- -- end -- -- end -- -- TriggerClientEvent('chatMessage',source,"",{},"^4- -  ^5E Q U I P A D O^4  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -") -- -- for k,v in pairs(weapons) do -- -- if v.ammo < 1 then -- -- TriggerClientEvent('chatMessage',source,"",{},"     1x "..itemlist["wbody|"..k].nome) -- -- else -- -- TriggerClientEvent('chatMessage',source,"",{},"     1x "..itemlist["wbody|"..k].nome.." | "..vRP.format(parseInt(v.ammo)).."x Munições") -- -- end -- -- end -- -- TriggerClientEvent('chatMessage',source,"",{},"     $"..vRP.format(parseInt(money)).." Dólares") -- -- TriggerClientEvent("Notify",nplayer,"aviso","Revistado por <b>"..identity.name.." "..identity.firstname.."</b>.") -- ------------------------------------------------------------------------------------------------------------------------------------------------------ -- -- Funções -- ------------------------------------------------------------------------------------------------------------------------------------------------------ -- function vrpInv.getPlayerInventory(user_id) -- if user_id then -- local inv = vRP.getInventory(user_id) -- local data = {} -- for k, v in pairs(inv) do -- data[k] = {["count"] = parseInt(v.amount), ["label"] = vRP.getItemName(k), ["weight"] = vRP.getItemWeight(k)} -- end -- return data -- end -- end -- ------------------------------------------------------------------------------------------------------------------------------------------------------ -- -- Event Handlers -- ------------------------------------------------------------------------------------------------------------------------------------------------------ -- RegisterServerEvent("vrp.inventoryhud:tradeTakeItem") -- AddEventHandler("vrp.inventoryhud:tradeTakeItem", function(target, itemName, itemCount) -- local user_id = vRP.getUserId(source) -- local source = vRP.getUserSource(user_id) -- local nplayer = vRP.getUserSource(target) -- local identity = vRP.getUserIdentity(user_id) -- local max = vRP.getInventoryMaxWeight(user_id) -- local weight = vRP.getInventoryWeight(user_id) -- if (vRP.getItemWeight(itemName) * itemCount) + weight > max then -- TriggerClientEvent("Notify",source,"negado","Mochila cheia.") -- return -- end -- if vRP.tryGetInventoryItem(target, itemName, itemCount, true) then -- vRP.giveInventoryItem(user_id, itemName, itemCount, true) -- TriggerClientEvent("Notify",nplayer,"aviso","<b>("..user_id..") "..identity.name.." "..identity.firstname.."</b> removeu "..itemCount.."X "..vRP.getItemName(itemName)..".") -- end -- TriggerClientEvent("vrp.inventoryhud:refreshPlayer", target) -- end) -- RegisterServerEvent("vrp.inventoryhud:tradeGiveItem") -- AddEventHandler("vrp.inventoryhud:tradeGiveItem", function(target, itemName, itemCount) -- local user_id = vRP.getUserId(source) -- local source = vRP.getUserSource(user_id) -- local nplayer = vRP.getUserSource(target) -- local identity = vRP.getUserIdentity(user_id) -- local max = vRP.getInventoryMaxWeight(target) -- local weight = vRP.getInventoryWeight(target) -- if (vRP.getItemWeight(itemName) * itemCount) + weight > max then -- TriggerClientEvent("Notify",source,"negado","Mochila cheia.") -- return -- end -- if vRP.tryGetInventoryItem(user_id, itemName, itemCount, true) then -- vRP.giveInventoryItem(target, itemName, itemCount, true) -- TriggerClientEvent("Notify",nplayer,"aviso","<b>("..user_id..") "..identity.name.." "..identity.firstname.."</b> enviou "..itemCount.."X "..vRP.getItemName(itemName)..".") -- end -- TriggerClientEvent("vrp.inventoryhud:refreshPlayer", target) -- end) -- ----------------------------------------------------------------------------------------------------------------------------------------- -- -- Comandos -- ----------------------------------------------------------------------------------------------------------------------------------------- -- RegisterCommand("revistar", function(source) -- local user_id = vRP.getUserId(source) -- local nplayer = vRPclient.getNearestPlayer(source,2) -- local nuser_id = vRP.getUserId(nplayer) -- if nuser_id then -- local identity = vRP.getUserIdentity(nuser_id) -- local id = vRP.getUserIdentity(user_id) -- TriggerClientEvent("vrp.inventoryhud:openPlayer",source,nuser_id,identity.name.." "..identity.firstname) -- TriggerClientEvent("Notify",nplayer,"aviso","Revistado por <b>("..user_id..") "..id.name.." "..id.firstname.."</b>.") -- end -- end) RegisterNetEvent("b03461cc:pd-inventory:sendItem") AddEventHandler("b03461cc:pd-inventory:sendItem",function(itemName,itemCount) local source = source local user_id = vRP.getUserId(source) local nplayer = vRPclient.getNearestPlayer(source,1) local nuser_id = vRP.getUserId(nplayer) if nuser_id then if itemCount == 0 then itemCount = getItemAmount(user_id,itemName) end if checkWeightAmount(nuser_id, itemName, itemCount) then if getItemAmount(user_id, itemName) >= itemCount and itemCount > 0 then consumeItem(user_id, itemName, itemCount, true) vRPclient._playAnim(source,true,{"mp_common","givetake1_a"},false) giveItem(nuser_id, itemName, itemCount, true) vRPclient._playAnim(nplayer,true,{"mp_common","givetake1_a"},false) TriggerClientEvent("b03461cc:pd-inventory:updateInventory",nplayer) local identity = vRP.getUserIdentity(user_id) local identitynu = vRP.getUserIdentity(nuser_id) SendWebhookMessage(webhooksenditem,"```prolog\n[ID]: "..user_id.." "..identity.name.." "..identity.firstname.." \n[ENVIOU]: "..vRP.format(parseInt(itemCount)).." "..getItemName(itemName).." \n[PARA O ID]: "..nuser_id.." "..identitynu.name.." "..identitynu.firstname.." "..os.date("\n[Data]: %d/%m/%Y [Hora]: %H:%M:%S").." \r```") end else TriggerClientEvent("Notify",source,"negado","O inventário da pessoa está <b>Cheio</b>.",8000) end else TriggerClientEvent("Notify",source,"negado","A pessoa está muito longe.",8000) end end) RegisterCommand('revistar',function(source,args,rawCommand) local user_id = vRP.getUserId(source) if vRPclient.getHealth(source) <= 101 or vRPclient.isInVehicle(source) or vRPclient.isHandcuffed(source) then return end local nplayer = vRPclient.getNearestPlayer(source,2) if nplayer then local nuser_id = vRP.getUserId(nplayer) if nuser_id then local identity = vRP.getUserIdentity(user_id) local weapons = vRPclient.getWeapons(nplayer) local money = vRP.getMoney(nuser_id) local query = json.decode(vRP.query("pd-getInv", { user_id = nuser_id })[1].itemlist) if vRPclient.getHealth(nplayer) <= 101 then TriggerClientEvent('cancelando',source,true,true) vRPclient._playAnim(source,false,{"amb@medic@standing@tendtodead@idle_a","idle_a"},true) TriggerClientEvent("progress",source,5000,"revistando") SetTimeout(5000,function() TriggerClientEvent('chatMessage',source,"",{},"^4- - ^5M O C H I L A^4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -") if query then for k,v in pairs(query) do TriggerClientEvent('chatMessage',source,"",{}," "..vRP.format(parseInt(query[k].amount)).."x "..itemlist[k].name) end end TriggerClientEvent('chatMessage',source,"",{},"^4- - ^5E Q U I P A D O^4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -") for k,v in pairs(weapons) do if v.ammo < 1 then TriggerClientEvent('chatMessage',source,"",{}," 1x "..itemlist[string.sub(string.lower(k),8)].name) else TriggerClientEvent('chatMessage',source,"",{}," 1x "..itemlist[string.sub(string.lower(k),8)].name.." | "..vRP.format(parseInt(v.ammo)).."x Munições") end end vRPclient._stopAnim(source,false) TriggerClientEvent('cancelando',source,false,false) TriggerClientEvent('chatMessage',source,"",{}," $"..vRP.format(parseInt(money)).." Dólares") end) else TriggerClientEvent('cancelando',source,true,true) TriggerClientEvent('cancelando',nplayer,true,true) TriggerClientEvent('carregar',nplayer,source) vRPclient._playAnim(source,false,{"misscarsteal4@director_grip","end_loop_grip"},true) vRPclient._playAnim(nplayer,false,{"random@mugging3","handsup_standing_base"},true) TriggerClientEvent("progress",source,5000,"revistando") SetTimeout(5000,function() TriggerClientEvent('chatMessage',source,"",{},"^4- - ^5M O C H I L A^4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -") if #query then for k,v in pairs(query) do TriggerClientEvent('chatMessage',source,"",{}," "..vRP.format(parseInt(query[k].amount)).."x "..itemlist[k].name) end end TriggerClientEvent('chatMessage',source,"",{},"^4- - ^5E Q U I P A D O^4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -") for k,v in pairs(weapons) do if v.ammo < 1 then TriggerClientEvent('chatMessage',source,"",{}," 1x "..itemlist[string.sub(string.lower(k),8)].name) else TriggerClientEvent('chatMessage',source,"",{}," 1x "..itemlist[string.sub(string.lower(k),8)].name.." | "..vRP.format(parseInt(v.ammo)).."x Munições") end end vRPclient._stopAnim(source,false) vRPclient._stopAnim(nplayer,false) TriggerClientEvent('cancelando',source,false,false) TriggerClientEvent('cancelando',nplayer,false,false) TriggerClientEvent('carregar',nplayer,source) TriggerClientEvent('chatMessage',source,"",{}," $"..vRP.format(parseInt(money)).." Dólares") end) end end TriggerClientEvent("Notify",nplayer,"aviso","Você está sendo <b>Revistado</b>.") --TriggerClientEvent("Notify",nplayer,"aviso","Revistado por <b>"..identity.name.." "..identity.firstname.."</b>.",8000) end end)
--- vim: ts=2 tabstop=2 shiftwidth=2 expandtab -- @todo: как только явится Света, дописать handler в соответствии со спекой CMDBuild -- @todo: ВАЖНО! дописать описание методов и аргументов, пф, осталось чутка, а потом проверять и по новой до усеру -- -------------------------------------------------------------------------------- require 'luarocks.loader' require 'LuaXML' -------------------------------------------------------------------------------- local errors = { ['NOTFOUND_ERROR'] = 'Element not found', ['AUTH_MULTIPLE_GROUPS'] = 'The user is connected with multiple groups', ['AUTH_UNKNOWN_GROUP'] = 'Unknown group', ['AUTH_NOT_AUTHORIZED'] = 'The authorizations are not enough to perform the operation', ['ORM_GENERIC_ERROR'] = 'An error has occurred while reading/saving data', ['ORM_DUPLICATE_TABLE'] = 'There is already a class with this name', ['ORM_CAST_ERROR'] = 'Error in the type conversion', ['ORM_UNIQUE_VIOLATION'] = 'Not null constraint violated', ['ORM_CONTAINS_DATA'] = 'You can\'t delete classes or attributes of tables or domains containing data', ['ORM_TYPE_ERROR'] = 'Not corresponding type', ['ORM_ERROR_GETTING_PK'] = 'The main key can\'t be determined', ['ORM_ERROR_LOOKUP_CREATION'] = 'The lookup can\'t be created', ['ORM_ERROR_LOOKUP_MODIFY'] = 'The lookup can\'t be modified', ['ORM_ERROR_LOOKUP_DELETE'] = 'The lookup can\'t be deleted', ['ORM_ERROR_RELATION_CREATE'] = 'The relation can\'t be created', ['ORM_ERROR_RELATION_MODIFY'] = 'The relation can\'t be modified', ['ORM_CHANGE_LOOKUPTYPE_ERROR'] = 'The lookup type can\'t be changed', ['ORM_READ_ONLY_TABLE'] = 'Read-only table', ['ORM_READ_ONLY_RELATION'] = 'Read-only relation', ['ORM_DUPLICATE_ATTRIBUTE'] = 'There is already an attribute with this name', ['ORM_DOMAIN_HAS_REFERENCE'] = 'Domains with reference attributes can\'t be deleted', ['ORM_FILTER_CONFLICT'] = 'Conflict by defining the filter', ['ORM_AMBIGUOUS_DIRECTION'] = 'The direction relation can\'t be automatically determined' } local CMDBuild = { type = 'CMDBuild', webservices = 'http://__ip__/cmdbuild/services/soap/Webservices', ltn12 = require 'ltn12', client = { http = require 'socket.http', }, } CMDBuild.__index = CMDBuild -- get indices from the table CMDBuild.__metatable = CMDBuild -- protect the metatable --------------------------------------------------------------------- -- @param attr Table of object's attributes. -- @return String with the value of the namespace ("xmlns") field. --------------------------------------------------------------------- local function find_xmlns(attr) for a, v in pairs(attr) do if string.find(a, "xmlns", 1, 1) then return v end end end -- Iterates over the children of an object. -- It will ignore any text, so if you want all of the elements, use ipairs(obj). -- @param obj Table (LOM format) representing the XML object. -- @param tag String with the matching tag of the children -- or nil to match only structured children (single strings are skipped). -- @return Function to iterate over the children of the object -- which returns each matching child. local function list_children(obj, tag) local i = 0 return function() i = i + 1 local v = obj[i] while v do if type(v) == "table" and (not tag or v[v.TAG] == tag) then return v end i = i + 1 v = obj[i] end return nil end end ------------------------------------------------------------------------ -- CMDBuild:new -- Create new instance -- @param pid - pid string for log (string or number) -- @param logcolor - use color log print to stdout (boolean) -- @param verbose - verbose mode (boolean) -- @param _debug - debug mode (boolean) -- @return instance ------------------------------------------------------------------------ function CMDBuild:new(pid, logcolor, verbose, _debug) CMDBuild.Header = {} CMDBuild.username = nil CMDBuild.password = nil CMDBuild.url = nil CMDBuild.verbose = verbose or false CMDBuild._debug = _debug or false CMDBuild.Log = require 'Log' CMDBuild.Log.pid = pid or 'cmdbuild_soap_api' CMDBuild.Log.usecolor = logcolor or false CMDBuild.Utils = require 'Utils' CMDBuild.Card = require 'cmdbuild.card' CMDBuild.Relation = require 'cmdbuild.relation' CMDBuild.Attachment = require 'cmdbuild.attachment' CMDBuild.Lookup = require 'cmdbuild.lookup' CMDBuild.Workflow = require 'cmdbuild.workflow' setmetatable(CMDBuild.Attachment, { __index = CMDBuild }) setmetatable(CMDBuild.Card, { __index = CMDBuild }) setmetatable(CMDBuild.Lookup, { __index = CMDBuild }) setmetatable(CMDBuild.Relation, { __index = CMDBuild }) setmetatable(CMDBuild.Workflow, { __index = CMDBuild }) return CMDBuild end ------------------------------------------------------------------------ -- CMDBuild:set_credentials -- Set credentials for connected to CMDBuild -- @param `credentials` The value object -- @field username string -- @field password string -- @field url string -- @field ip string -- @return soap header ------------------------------------------------------------------------ function CMDBuild:set_credentials(credentials) if not self.username then if credentials.username then self.username = credentials.username self.Log.debug('Added user name', self.verbose) else self.Log.warn('`credentials.username\' can\'t be empty', self.verbose) os.exit(-1) end end if not self.password then if credentials.password then self.password = credentials.password self.Log.debug('Added a password for the user', self.verbose) else self.Log.warn('`credentials.password\' can\'t be empty', self.verbose) os.exit(-1) end end if not self.url then if credentials.url then self.url = credentials.url self.Log.debug('Added url CMDBuild', self.verbose) elseif credentials.ip then self.url = self.webservices:gsub('__ip__', credentials.ip) self.Log.debug('CMDBuild address is formed and added', self.verbose) else self.Log.warn('`credentials.ip\' can\'t be empty', self.verbose) os.exit(-1) end end self.Header.insertHeader = function() local oasisopen = 'http://docs.oasis-open.org/wss/2004/01/' local wsse = oasisopen .. "oasis-200401-wss-wssecurity-secext-1.0.xsd" local wssu = oasisopen .. "oasis-200401-wss-wssecurity-utility-1.0.xsd" local PassText = oasisopen .. "oasis-200401-wss-username-token-profile-1.0#PasswordText" if self.username and self.password then self.Header = { tag = "wsse:Security", attr = { ["xmlns:wsse"] = wsse }, { tag = "wsse:UsernameToken", attr = { ["xmlns:wssu"] = wssu }, { tag = "wsse:Username", self.username }, { tag = "wsse:Password", attr = { Type = PassText }, self.password } } } self.Log.info('The SOAP header is formed and added', self.verbose) else self.Log.warn('Failed to generate the SOAP header', self.verbose) os.exit(-1) end end return self.Header end ----- end of function CMDBuild:mt:set_credentials ----- --------------------------------------------------------------------- -- CMDBuild.call -- Call a remote method. -- @table args Table with the arguments which could be -- @field url String with the location of the server -- @field namespace String with the namespace of the elements -- @field method String with the method's name -- @field entries Table of SOAP elements (LuaExpat's format) -- @field header Table describing the header of the SOAP-ENV (optional) -- @field internal_namespace String with the optional namespace used as a prefix for the method name (default = "") -- @return String with namespace, String with method's name and Table with SOAP elements (LuaExpat's format) --------------------------------------------------------------------- function CMDBuild:call(args) local header_template = { tag = "soap:Header", } local xmlns_soap = "http://schemas.xmlsoap.org/soap/envelope/" local xmlns_soap12 = "http://www.w3.org/2003/05/soap-envelope" ------------------------------------------------------------------------ -- encode -- Converts a LuaXml table into a SOAP message -- @table args Table with the arguments, which could be (table) -- @field namespace String with the namespace of the elements. -- @field method String with the method's name -- @field entries Table of SOAP elements (LuaExpat's format) -- @field header Table describing the header of the SOAP envelope (optional) -- @field internal_namespace String with the optional namespace used as a prefix for the method name (default = "") -- @return String with SOAP envelope element ------------------------------------------------------------------------ self.encode = function(args) local serialize -- Template SOAP Table local envelope_templ = { tag = "soap:Envelope", attr = { "xmlns:soap", "xmlns:soap1", ["xmlns:soap1"] = "http://soap.services.cmdbuild.org", -- to be filled ["xmlns:soap"] = "http://schemas.xmlsoap.org/soap/encoding/", }, { tag = "soap:Body", [1] = { tag = "soap1", -- must be filled attr = {}, -- must be filled }, } } ------------------------------------------------------------------------ -- contents -- Serialize the children of an object -- @param obj - Table with the object to be serialized (table) -- @return String string.representation of the children ------------------------------------------------------------------------ local function contents(obj) if not obj[1] then return "" else local c = {} for i = 1, #obj do c[i] = serialize(obj[i]) end return table.concat(c) end end ------------------------------------------------------------------------ -- serialize -- Serialize an object -- @param obj - Table with the object to be serialized (table) -- @return String with string.representation of the object ------------------------------------------------------------------------ serialize = function(obj) ------------------------------------------------------------------------ -- attrs -- Serialize the table of attributes -- @param a - Table with the attributes of an element (table) -- @return String string.representation of the object ------------------------------------------------------------------------ local function attrs(a) if not a then return "" -- no attributes else local c = {} if a[1] then for i = 1, #a do local v = a[i] c[i] = string.format("%s=%q", v, a[v]) end else for i, v in pairs(a) do c[#c + 1] = string.format("%s=%q", i, v) end end if #c > 0 then return " " .. table.concat(c, " ") else return "" end end end local tt = type(obj) if tt then if tt == "string" then return self.Utils.escape(self.Utils.unescape(obj)) elseif tt == "number" then return obj elseif tt == "table" then local t = obj.tag if not t then return end assert(t, "Invalid table format (no `tag' field)") return string.format("<%s%s>%s</%s>", t, attrs(obj.attr), contents(obj), t) else return "" end end end ------------------------------------------------------------------------ -- insert_header -- Add header element (if it exists) to object -- Cleans old header element anywat -- @tparam obj - Object for insert new header (table) -- @tparam header - template header (table) -- @return header_template (table) ------------------------------------------------------------------------ self.insert_header = function(obj, header) -- removes old header if obj[2] then table.remove(obj, 1) end if header then header_template[1] = header table.insert(obj, 1, header_template) end end if tonumber(args.soapversion) == 1.2 then envelope_templ.attr["xmlns:soap"] = xmlns_soap12 else envelope_templ.attr["xmlns:soap"] = xmlns_soap end local xmlns = "xmlns" if args.internal_namespace then xmlns = xmlns .. ":" .. args.internal_namespace args.method = args.internal_namespace .. ":" .. args.method else xmlns = xmlns .. ":soap1" args.method = "soap1:" .. args.method end -- Cleans old header and insert a new one (if it exists). self.insert_header(envelope_templ, args.header or self.Header) -- Sets new body contents (and erase old content). local body = (envelope_templ[2] and envelope_templ[2][1]) or envelope_templ[1][1] for i = 1, math.max(#body, #args.entries) do body[i] = args.entries[i] end -- Sets method (actually, the table's tag) and namespace. body.tag = args.method body.attr[xmlns] = args.namespace return serialize(envelope_templ) end local soap_action, content_type_header if (not args.soapversion) or tonumber(args.soapversion) == 1.1 then content_type_header = "text/xml;charset=UTF-8" else content_type_header = "application/soap+xml" end local xml_header_template = '<?xml version="1.0"?>' local xml_header = xml_header_template if args.encoding then xml_header = xml_header:gsub('"%?>', '" encoding="' .. args.encoding .. '"?>') end local request_body = xml_header .. self.encode(args) self.Log.debug('SOAP Request: ' .. tostring(xml.eval(request_body)), self._debug) local request_sink, tbody = self.ltn12.sink.table() local headers = { ["Content-Type"] = content_type_header, ["Content-Length"] = tostring(request_body:len()), ["SOAPAction"] = soap_action, } if args.headers then for h, v in pairs(args.headers) do headers[h] = v end end local mandatory_url = "Field `url' is mandatory" local url = { url = assert(args.url or self.url, mandatory_url), method = "POST", source = self.ltn12.source.string(request_body), sink = request_sink, headers = headers, } local suggested_layers = { http = "socket.http", https = "ssl.https", } local protocol = url.url:match "^(%a+)" -- protocol's name local mod = assert(self.client[protocol], '"' .. protocol .. '" protocol support unavailable. Try soap.CMDBuild.' .. protocol .. ' = require"' .. suggested_layers[protocol] .. '" to enable it.') local request = assert(mod.request, 'Could not find request function on module soap.CMDBuild.' .. protocol) request(url) ------------------------------------------------------------------------ -- retriveMessage -- The function truncates the additional information in the SOAP response -- @param response - SOAP response (table) -- @return resp - (string) ------------------------------------------------------------------------ local function retriveMessage(response) ------------------------------------------------------------------------ -- jtr -- Create lua table from SOAP response table -- @param text_array - SOAP (table) -- @return ret - (string) ------------------------------------------------------------------------ local function jtr(text_array) local ret = "" for i = 1, #text_array do if text_array[i] then ret = ret .. text_array[i]; end end return ret; end local resp = jtr(response) local istart, iend = resp:find('<soap:Envelope.*</soap:Envelope>'); if (istart and iend) then return resp:sub(istart, iend); else return nil end end local error_handler = function(response) local _response = xml.eval(response) if _response:find 'soap:Fault' then local fault = _response:find 'soap:Fault':find 'faultstring'[1] if fault then self.Log.error('SOAP Error: ' .. fault, self.verbose) os.exit(-1) end end return _response end local response = retriveMessage(tbody) if response then self.Log.debug('SOAP Response: ' .. tostring(xml.eval(response)), self._debug) else return end tbody.xml = function() return error_handler(response) end --------------------------------------------------------------------- -- Converts a SOAP message into Lua objects. -- @param ignoreFields -- @param onCardLoad -- @return String with namespace, String with method's name and -- Table with SOAP elements (LuaExpat's format). --------------------------------------------------------------------- tbody.decode = function(ignoreFields, onCardLoad) local obj = assert(error_handler(response)) local ns = obj[obj.TAG]:match("^(.-):") assert(obj[obj.TAG] == ns .. ":Envelope", "Not a SOAP Envelope: " .. tostring(obj[obj.TAG])) local lc = list_children(obj) local o = lc() -- Skip SOAP:Header while o and (o[o.TAG] == ns .. ":Header" or o.tag == "SOAP-ENV:Header") do o = lc() end if o and (o[o.TAG] == ns .. ":Body" or o.tag == "SOAP-ENV:Body") then obj = list_children(o)() else error("Couldn't find SOAP Body!") end local method = obj[obj.TAG]:match("%:([^:]*)$") or obj[obj.TAG] local response = { namespace = find_xmlns(obj), method = method, --obj[obj.TAG]:match("%:([^:]*)$") or obj[obj.TAG], entries = { Id = {} } } local ns = obj[obj.TAG]:match("^(.-):") obj = list_children(obj, ns .. ':return')() if not obj then return end if method ~= 'createCardResponse' and method ~= 'updateCardResponse' and method ~= 'deleteCardResponse' and obj[2] and obj[2][1]:find(ns .. ':attributeList') then for i = 1, #obj do local id = obj[i]:find(ns .. ":id") if id ~= nil then id = id[1] if obj[i][1]:find(ns .. ':attributeList') then for j = 1, #obj[i] do local attrList = obj[i][j]:find(ns .. ":attributeList") if attrList ~= nil then local key = attrList:find(ns .. ":name") local value = attrList:find(ns .. ":value") or "" local code = attrList:find(ns .. ":code") or "" if key ~= nil and not self.Utils.isin(ignoreFields, key[1]) then key = key[1] value = value[1] code = code[1] if response.entries.Id[tostring(id)] == nil then response.entries.Id[tostring(id)] = {} end if code == nil then response.entries.Id[tostring(id)][key] = value else response.entries.Id[tostring(id)][key] = { value = value, code = code } end end end end if onCardLoad ~= nil then onCardLoad(response.entries, tostring(id)) end end end end else if method == 'getCardListResponse' or method == 'getCardResponse' then local id if not id then if obj[1]:find(ns..':id') then id= obj[1]:find(ns..':id')[1] elseif obj:find(ns..':id') then id = obj:find(ns..':id')[1] else id = 0 end end if obj[1]:find(ns..':cards') then obj = obj[1]:find(ns..':cards') end for i = 1, #obj do if id then local attrList = obj[i]:find(ns .. ":attributeList") if attrList then local key = attrList:find(ns .. ":name") local value = attrList:find(ns .. ":value") or "" local code = attrList:find(ns .. ":code") or "" if key ~= nil and not self.Utils.isin(ignoreFields, key[1]) then key = key[1] value = value[1] code = code[1] if response.entries.Id[tostring(id)] == nil then response.entries.Id[tostring(id)] = {} end if code == nil then response.entries.Id[tostring(id)][key] = value else response.entries.Id[tostring(id)][key] = { value = value, code = code } end end end end end elseif method == 'createCardResponse' or method == 'updateCardResponse' then if response.entriesId == nil then response.entries.Id = {} end response.entries.Id['cardId'] = obj[1] elseif method == 'deleteCardResponse' then if response.entries.Id == nil then response.entries.Id = {} end response.entries.Id['status'] = obj[1] else for i=1, #obj do local key = obj[i][obj.TAG] local value = obj[i][1] if response.entries.Id == nil then response.entries.Id = {} end response.entries.Id[key] = value end end end ------------------------------------------------------------------------ -- response.tprint -- Recursively print arbitrary data -- @param l - Set limit (default 100000) to stanch infinite loops (number) -- @param i - Indents tables as [KEY] VALUE, nested tables as [KEY] [KEY]...[KEY] VALUE (string) -- Set indent ("") to prefix each line: Mytable [KEY] [KEY]...[KEY] VALUE -- @return ------------------------------------------------------------------------ response.tprint = function(l, i) -- recursive Print (structure, limit, indent) local function rPrint(s, l, i) l = (l) or 100000; i = i or ""; -- default item limit, indent string if (l < 1) then print "ERROR: Item limit reached."; return l - 1 end; local ts = type(s); if (ts ~= "table") then print(i, ts, s); return l - 1 end print(i, ts); -- print "table" for k, v in pairs(s) do -- print "[KEY] VALUE" if k ~= 'tprint' then l = rPrint(v, l, i .. "\t[" .. tostring(k) .. "]"); end if (l < 0) then break end end return l end return rPrint(response, l, i) end return response end return tbody end return CMDBuild
local function readLittleEndian(file, bytes) local string = file:read(2) local bytes = string:byte() -- print(string, type(bytes), bytes) return bytes end -- https://gist.github.com/fdeitylink/3fded36e9187fe838eb18a412c712800 -- -=~ PXM File Data ~=- -- maps must be minimum of 21x16 local function readPXM(filename) print('reading PXM: ' .. filename) local file = assert(io.open(filename, MODE_READ_BINARY)) -- First three bytes are PXM, then 0x10. assert(file:read(3) == "PXM") assert(file:read(1):byte() == 0x10) -- Then 0x_map_length - 2 bytes -- Then 0x_map_height - 2 bytes local length = readLittleEndian(file, 2) local height = readLittleEndian(file, 2) print('length:', length) print('height:', height) -- Then 0x_map_tile_from_tileset for the rest of the file (numbered from 0, and going left to right, top to bottom) - 1 byte local tiles = {} for x = 1, length do tiles[x] = {} end for y = 1, height do for x = 1, length do tiles[x][y] = file:read(1):byte() end end -- Print result local XXX = 3 for y = 1, height do local line = "" for x = 1, length do local tile = tiles[x][y] local len = string.len(tile) line = line .. string.rep(' ', XXX - len) .. tile end print(line) end end
AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") AddCSLuaFile("constants.lua") include("game_states.lua") include("shared.lua") include("state_updates.lua") include("util.lua") include("sql_interface.lua") -- nets util.AddNetworkString("game_state") util.AddNetworkString("cheers") util.AddNetworkString("boos") util.AddNetworkString("comedian") util.AddNetworkString("mining") util.AddNetworkString("coins") -- GM FUNCTIONS function GM:Initialize() self.BaseClass.Initialize(self) GAMEMODE.boos = 0 GAMEMODE.cheers = 0 GAMEMODE.comedian = nil GAMEMODE.comedianQuit = false GAMEMODE.stateTimestamp = nil GAMEMODE.previousState = -1 GAMEMODE.state = GAME_STATE.WAITING_FOR_PLAYERS GAMEMODE.lastCoinQuery = 0 MsgN("bbcc initializing...") end function GM:Tick() STATE_UPDATES.updateState() keepPlayersInCheck() updateCoins() end -- Cheers and boos activation function GM:PlayerButtonDown(ply, button) if button == 107 then -- mouseleft if ply == GAMEMODE.comedian then else if playNoise(ply, table.Random(CONSTANTS.SOUND_CHEERS)) then incCheers() end end elseif button == 108 then -- mouseright if ply == GAMEMODE.comedian then -- quitting GAMEMODE.comedianQuit = true else if playNoise(ply, table.Random(CONSTANTS.SOUND_BOOS)) then incBoos() end end end end function GM:PlayerCanSeePlayersChat(text, teamOnly, listener, speaker) return canHear(listener, speaker) end -- Default model function GM:PlayerSetModel(ply) ply:SetModel("models/player/Group01/Male_01.mdl") end -- Prevent player collision function GM:ShouldCollide( ent1, ent2 ) if ( IsValid( ent1 ) and IsValid( ent2 ) and ent1:IsPlayer() and ent2:IsPlayer() ) then return false end return true end -- Entrypoint for player mining function GM:PlayerSay(sender, text, teamChat) if string.match(text, "!mine") then net.Start("mining") net.Send(sender) end end -- Hooks hook.Add("PlayerCanHearPlayersVoice", "Game Logic", canHear) local function spawn(ply) ply:GodEnable() GAMEMODE:SetPlayerSpeed(ply, 70, 70) ply:SetCustomCollisionCheck( true ) ply:SetNoCollideWithTeammates( true ) ply.lastNoised = 0 SQL_INTERFACE.getPlayerCoins(ply) end hook.Add("PlayerInitialSpawn", "some_unique_name", spawn) -- Helpers -- CanHear: Can allow only comedian to talk for non-rowdy comedy function canHear(listener, talker) return true -- if GAMEMODE.state ~= GAME_STATE.TELLING_JOKES then -- return true -- else -- return listener == GAMEMODE.comedian or talker == GAMEMODE.comedian -- end end -- Laughing/booing function playNoise(ply, noise) local now = CurTime() if ply.lastNoised == nil then ply.lastNoised = -CONSTANTS.NOISE_DELAY_SECOND end if ply.lastNoised + CONSTANTS.NOISE_DELAY_SECOND < now then ply:EmitSound(noise) ply.lastNoised = now return true end return false end function incCheers() if GAMEMODE.state == GAME_STATE.TELLING_JOKES then GAMEMODE.cheers = GAMEMODE.cheers + 1 GAMEMODE.comedyTime = GAMEMODE.comedyTime + CONSTANTS.COMEDY_SECONDS * (1.0 / (player.GetCount()-1)) * (CONSTANTS.COMEDY_SECONDS * 1.0/ CONSTANTS.NOISE_DELAY_SECOND) net.Start("cheers") net.WriteInt(GAMEMODE.comedyTime, 32) net.Broadcast() end end function incBoos() if GAMEMODE.state == GAME_STATE.TELLING_JOKES then GAMEMODE.boos = GAMEMODE.boos + 1 net.Start("boos") net.WriteInt(GAMEMODE.boos, 32) net.Broadcast() end end function keepPlayersInCheck() local players = player.GetAll() for k, v in pairs(players) do if IsValid(v) and v ~= GAMEMODE.comedian then local ppos = v:GetPos() if ppos.y < CONSTANTS.COMEDIAN_BOX_Y then ppos.y = 0 v:SetPos(ppos) end end end end -- Query coin db function updateCoins() local nao = CurTime() if nao - GAMEMODE.lastCoinQuery > 60 then GAMEMODE.lastCoinQuery = nao UTIL.printAnnounce("Type !mine to mine coins! Values updated every minute.") local players = player.GetAll() for k, v in pairs(players) do if IsValid(v) then SQL_INTERFACE.getPlayerCoins(v) end end end end
function handler.get() end
if nil ~= require then require "fritomod/tests/Mixins-ArrayTests"; require "fritomod/tests/Mixins-TableTests"; end; local Suite=CreateTestSuite("fritomod.Iterators"); local arraySuite = ReflectiveTestSuite:New("Iterators (arrays)"); Mixins.ArrayTests(arraySuite, Iterators); function arraySuite:Array(...) return Iterators.IterateList({...}); end; local tableSuite = ReflectiveTestSuite:New("Iterators (tables)"); Mixins.TableTests(tableSuite, Iterators); function tableSuite:Table(t) if t == nil then return Functions.Clone(Noop); end; return Iterators.IterateMap(t); end; function Suite:TestVisibleFields() local foo = { a = 1, b = 2, c = 3 }; local copy = {}; for key, value in Iterators.IterateVisibleFields(foo) do copy[key] = value; end; Assert.Equals(foo, copy, "Simple visible fields"); end; function Suite:TestVisibleFieldsWhenNested() local foo = { a = 1, b = 2, c = 3 }; setmetatable(foo, { __index = { d = 4 } }); local copy = {}; for key, value in Iterators.IterateVisibleFields(foo) do copy[key] = value; end; foo.d = 4; Assert.Equals(foo, copy, "Field is iterated when contained in a metatable"); end; function Suite:TestVisibleFieldsWhenOverridden() local foo = { a = 1, b = 2, c = 3 }; setmetatable(foo, { __index = { c = 4, } }); local flag = Tests.Flag(); for key, value in Iterators.IterateVisibleFields(foo) do if key == "c" then assert(not flag:IsSet(), "C was already iterated"); flag:Raise(); assert(value == 3, "Iterated over an invalid c value. Value was: " .. tostring(value)); end; end; assert(flag:IsSet(), "C was never iterated"); end; function Suite:TestVisibleFieldsCombinedWithFilteredIterator() local obj = { a = true, bb = true, c = true, dd = true, e = false }; local iterator = Iterators.IterateVisibleFields(obj); iterator = Iterators.FilteredIterator(iterator, function(key, value) return #key % 2 == 0; end); local counter = Tests.Counter(); Iterators.Each(iterator, counter.Hit); counter.Assert(2); end; function Suite:TestConsumeEatsAValueIterator() local a; local function Feeder() return table.remove(a,1); end; a={5,6,7}; Assert.Equals({5,6,7}, Iterators.Consume(Feeder)); end; function Suite:TestConsumeEatsAPairIterator() local a={11,22,33}; local c = 0; local function PairFeeder() if #a > 0 then c = c + 1; return c, table.remove(a, 1); end; end; Assert.Equals({11,22,33}, Iterators.Consume(PairFeeder)); end; function Suite:TestCounter() Assert.Equals({1,2,3}, Iterators.Consume(Iterators.Counter(1,3))); Assert.Equals({3,2,1}, Iterators.Consume(Iterators.Counter(3,1))); Assert.Equals({1,2,3}, Iterators.Consume(Iterators.Counter(3))); Assert.Equals({1,3,5}, Iterators.Consume(Iterators.Counter(1,5,2))); local unbounded=Iterators.Counter(); Assert.Equals(1, unbounded()); Assert.Equals(2, unbounded()); Assert.Equals(3, unbounded()); end; function Suite:TestRepeat() local i=Iterators.Repeat("a", "b", "c"); Assert.Equals("a", i()); Assert.Equals("b", i()); Assert.Equals("c", i()); Assert.Equals("a", i()); local c=Iterators.Repeat(0,1,2); for i=0,6 do Assert.Equals(i%3,c()); end; end;
--- Solution ------------------------------- workspace "Pathfinding" configurations { "Debug", "Release" } platforms { "x86", "x64" } startproject "App" filter "platforms:x86" architecture "x86" filter "platforms:x64" architecture "x86_64" --- Variables ------------------------------ outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" includedir = {} includedir["SFML"] = "App/vendor/SFML/include" includedir["SEL"] = "Pathfinding/vendor/SEL/include" includedir["Pathfinding"] = "Pathfinding/include" --- Dependencies --------------------------- group "Dependencies" include "App/vendor/SFML" group "" --- Pathfinding -------------------------------- project "Pathfinding" kind "StaticLib" location "Pathfinding" language "C++" cppdialect "C++20" staticruntime "on" targetdir("bin/" .. outputdir .. "/%{prj.name}") objdir("obj/" .. outputdir .. "/%{prj.name}") files { "%{prj.name}/src/**.hpp", "%{prj.name}/src/**.cpp", "%{prj.name}/include/**.hpp" } includedirs { "%{includedir.SEL}", "Pathfinding/include/", "Pathfinding/src/" } filter "system:windows" systemversion "latest" filter "configurations:Debug" runtime "Debug" symbols "on" filter "configurations:Release" runtime "Release" optimize "on" --- App -------------------------------- project "App" location "App" language "C++" cppdialect "C++20" staticruntime "on" targetdir("bin/" .. outputdir .. "/%{prj.name}") objdir("obj/" .. outputdir .. "/%{prj.name}") files { "%{prj.name}/src/**.hpp", "%{prj.name}/src/**.cpp" } includedirs { "%{includedir.Pathfinding}", "%{includedir.SFML}", "%{includedir.SEL}", } defines { "SFML_STATIC" } filter "system:windows" entrypoint "mainCRTStartup" systemversion "latest" libdirs { "%{prj.name}/vendor/SFML/extlibs/libs-msvc-universal/%{cfg.platform}/" } filter {} links { "opengl32.lib", "freetype.lib", "winmm.lib", "gdi32.lib", "SFML", "Pathfinding" } filter "configurations:Debug" kind "ConsoleApp" runtime "Debug" symbols "on" filter "configurations:Release" kind "WindowedApp" runtime "Release" optimize "on"
--- === Shade === --- --- Creates a semitransparent overlay to reduce screen brightness. --- --- Download: https://github.com/Hammerspoon/Spoons/raw/master/Spoons/Shade.spoon.zip local obj = {} obj.__index = obj -- Metadata obj.name = "Shade" obj.version = "0.2" obj.author = "Leonardo Shibata" obj.homepage = "https://github.com/Hammerspoon/Spoons" obj.license = "MIT - https://opensource.org/licenses/MIT" --String containing an ASCII diagram to be rendered as a menu bar icon for when Shade is OFF. obj.iconOff = "ASCII:" .. ". . . . . . . . . . . . . . . . . . . . .\n" .. ". . . . . . . . . . . . . . . . . . . . .\n" .. ". . . . . . . . . . . . . . . . . . . . .\n" .. ". . . 1 # # # # # # # # # # # # # 1 . . .\n" .. ". . . 4 . . . . . . . . . . . . . 2 . . .\n" .. ". . . # 5 = = = = = = = = = = = 5 # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # 6 = = = = = = = = = = = 6 # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # 7 = = = = = = = = = = = 7 # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . 4 . . . . . . . . . . . . . # . . .\n" .. ". . . 3 # # # # # # # # # # # # 3 2 . . .\n" .. ". . . . . . . . . . . . . . . . . . . . .\n" .. ". . . . . . . . . . . . . . . . . . . . .\n" .. ". . . . . . . . . . . . . . . . . . . . ." --String containing an ASCII diagram to be rendered as a menu bar icon for when Shade is ON. obj.iconOn = "ASCII:" .. ". . . . . . . . . . . . . . . . . . . . .\n" .. ". . . . . . . . . . . . . . . . . . . . .\n" .. ". . . . . . . . . . . . . . . . . . . . .\n" .. ". . . 1 # # # # # # # # # # # # # 1 . . .\n" .. ". . . 4 . . . . . . . . . . . . . 2 . . .\n" .. ". . . # 5 = = = = = = = = = = = 5 # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # 6 = = = = = = = = = = = 6 # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # 7 = = = = = = = = = = = 7 # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # 8 = = = = = = = = = = = 8 # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # 9 = = = = = = = = = = = 9 # . . .\n" .. ". . . # . . . . . . . . . . . . . # . . .\n" .. ". . . # a = = = = = = = = = = = a # . . .\n" .. ". . . 4 . . . . . . . . . . . . . # . . .\n" .. ". . . 3 # # # # # # # # # # # # 3 2 . . .\n" .. ". . . . . . . . . . . . . . . . . . . . .\n" .. ". . . . . . . . . . . . . . . . . . . . .\n" .. ". . . . . . . . . . . . . . . . . . . . ." --Find out screen size. Currently using only the primary screen obj.screenSize = hs.screen.primaryScreen() --Returns a hs.geometry rect describing screen's frame in absolute coordinates, including the dock and menu. obj.shade = hs.drawing.rectangle(obj.screenSize:fullFrame()) --- Shade.shadeTransparency --- Variable --- Contains the alpha (transparency) of the overlay, from 0.0 (completely --- transparent to 1.0 (completely opaque). Default is 0.5. obj.shadeTransparency = 0.5 --shade characteristics --white - the ratio of white to black from 0.0 (completely black) to 1.0 (completely white); default = 0. --alpha - the color transparency from 0.0 (completely transparent) to 1.0 (completely opaque) obj.shade:setFillColor({["white"]=0, ["alpha"] = obj.shadeTransparency }) obj.shade:setStroke(false):setFill(true) --set to cover the whole screen, all spaces and expose obj.shade:bringToFront(true):setBehavior(17) --- Shade.shadeIsOn --- Variable --- Flag for Shade status, 'false' means shade off, 'true' means on. obj.shadeIsOn = nil --- Shade:init() --- Method --- Sets up the Spoon --- --- Parameters: --- * None --- --- Returns: --- * None function obj:init() --create icon on the menu bar and set flag to 'false' self.shadeMenuIcon = hs.menubar.new() self.shadeMenuIcon:setIcon(obj.iconOff) -- self.shadeMenuIcon:setClickCallback(obj.toggleShade) self.shadeMenuIcon:setTooltip('Shade') --when clicked show menu with different transparency options (25, 50 and 75%) menuTable = { { title = "25%", fn = function() obj.shadeTransparency = .25 obj.start() end }, { title = "50%", fn = function() obj.shadeTransparency = .5 obj.start() end }, { title = "75%", fn = function() obj.shadeTransparency = .75 obj.start() end }, { title = "off", fn = function() obj.stop() self.checked = true end }, } self.shadeMenuIcon:setMenu(menuTable) self.shadeIsOn = false end --- Shade:start() --- Method --- Turn the shade on, darkening the screen --- --- Parameters: --- * None --- --- Returns: --- * None function obj:start() --In case there is already a shade on the screen, first hide this one obj.shade:hide() --Find out screen size. Currently using only the primary screen obj.screenSize = hs.screen.primaryScreen() --Returns a hs.geometry rect describing screen's frame in absolute coordinates, including the dock and menu. obj.shade = hs.drawing.rectangle(obj.screenSize:fullFrame()) obj.shade:setFillColor({["alpha"] = obj.shadeTransparency }) obj.shade:show() obj.shadeIsOn = true obj.shadeMenuIcon:setIcon(obj.iconOn) end --- Shade:stop() --- Method --- Turn the shade off, brightening the screen --- --- Parameters: --- * None --- --- Returns: --- * None function obj:stop() obj.shade:hide() obj.shadeIsOn = false obj.shadeMenuIcon:setIcon(obj.iconOff) end --- Shade:toggleShade() --- Function --- Turns shade on/off --- --- Parameters: --- * None --- --- Returns: --- * None function obj:toggleShade() --Is Shade off? If so, turn it on darkening the screen if obj.shadeIsOn == false then obj.start() --If shade is on, turn it off brightening the screen elseif obj.shadeIsOn == true then obj.stop() else -- print('you shouldnt be here') --for debug purposes end end --- Shade:bindHotkeys(map) --- Method --- Binds hotkeys for Shade --- --- Parameters: --- * map - A table containing hotkey modifier/key details for the following item: --- * toggleShade - This will toggle the shade on/off, and update the menubar graphic --- E.g.: { toggleShade = {"cmd","alt","ctrl"},"s" } --- --- Returns: --- * None function obj:bindHotkeys(map) local def = { toggleShade = obj.toggleShade } hs.spoons.bindHotkeysToSpec(def, map) end --check if there was any change in screen resolution obj.screenWatcher = hs.screen.watcher.new(function() if obj.shadeIsOn == true then -- hs.alert.show("screen change") obj.shade:hide() obj.start() end end) obj.screenWatcher:start() --[[ Features being tested (start) hs.fnutils.each(allScreens, function(screen) print(screen:id()) end) hs.fnutils.each(allScreens, function(screen) print(screen:fullFrame()) end) hs.fnutils.each(allScreens, function(screen) print(hs.inspect(screen:fullFrame().table)) end) --]] --Features being tested (end) return obj
ccs = ccs or {} ---BatchNode object ---@class BatchNode : Node local BatchNode = {} ccs.BatchNode = BatchNode -------------------------------- -- ---@return BatchNode function BatchNode:create() end -------------------------------- ---@overload fun(Node, int, string):BatchNode ---@overload fun(Node, int, int):BatchNode ---@param pChild Node ---@param zOrder int ---@param tag int ---@return BatchNode function BatchNode:addChild(pChild, zOrder, tag) end -------------------------------- ---js NA ---@return bool function BatchNode:init() end -------------------------------- -- ---@param renderer Renderer ---@param transform mat4_table ---@param flags int ---@return BatchNode function BatchNode:draw(renderer, transform, flags) end -------------------------------- -- ---@param child Node ---@param cleanup bool ---@return BatchNode function BatchNode:removeChild(child, cleanup) end return BatchNode
levelsLoaded = false layoutsloaded = false function _filllevels() if not levelsLoaded then levels = getlevels() size = table.getn(levels) for i=1,size do commandstring = "scr.loadlevel('" .. levels[i] .. "')" addelement("_levellist","levellist","dummy","button",levels[i],commandstring) end levelsLoaded = true end end; function _filllayouts() if not layoutsloaded then layouts = getlayouts() size = table.getn(layouts) for i=1,size do commandstring = "scr.togglelayout('" .. layouts[i] .. "')" addelement("_layoutlist","levellist","dummy","button","Toggle " .. layouts[i],commandstring) end layoutsloaded = true end end;
-- All the code in this file is adapted from https://github.com/karthikncode/text-world-player -- Please see license (MIT) at: https://github.com/karthikncode/text-world-player/blob/main/LICENSE.txt local clock = os.clock function sleep(n) -- seconds local t0 = clock() while clock() - t0 <= n do end end function split(s, pattern) local parts = {} for i in string.gmatch(s, pattern) do table.insert(parts, i) end return parts end function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end function string.ends(String,End) return End=='' or string.sub(String,-string.len(End))==End end function string.trim(s) -- return (s:gsub("^%s*(.-)%s*$", "%1")) return s:match "^%W*(.-)%s*$" end function reverse_tensor(tensor) --make sure tensor is 1D local n = tensor:size(1) local tmp = torch.Tensor(n) for i=1, n do tmp[i] = tensor[n+1-i] end return tmp end -- function specific to make available_objects tensor function table_to_binary_tensor(t,N) local tensor if t then tensor = torch.zeros(N) for i,val in pairs(t) do tensor[val] = 1 end else tensor = torch.ones(N) end return tensor end function str_to_table(str) if type(str) == 'table' then return str end if not str or type(str) ~= 'string' then if type(str) == 'table' then return str end return {} end local ttr if str ~= '' then local ttx=tt loadstring('tt = {' .. str .. '}')() ttr = tt tt = ttx else ttr = {} end return ttr end -- IMP: very specific function - do not use for arbitrary tensors function tensor_to_table(tensor, state_dim, hist_len) batch_size = tensor:size(1) local NULL_INDEX = #symbols+1 -- convert 0 to NULL_INDEX (this happens when hist doesn't go back as far as hist_len in chain) for i=1, tensor:size(1) do for j=1, tensor:size(2) do if tensor[i][j] == 0 then tensor[i][j] = NULL_INDEX end end end local t2 = {} if tensor:size(1) == hist_len then -- hacky: this is testing case. They don't seem to have a consistent representation -- so this will have to do for now. -- print('testing' , tensor:size()) for j=1, tensor:size(1) do for k=1, tensor:size(2)/state_dim do t2_tmp = {} for i=(k-1)*state_dim+1, k*state_dim do t2_tmp[i%state_dim] = tensor[{{j}, {i}}]:reshape(1) end t2_tmp[state_dim] = t2_tmp[0] t2_tmp[0] = nil table.insert(t2, t2_tmp) end end else -- print('training' , tensor:size()) -- print(tensor[{{1}, {}}]) for j=1, tensor:size(2)/state_dim do t2_tmp = {} for i=(j-1)*state_dim+1,j*state_dim do t2_tmp[i%state_dim] = tensor[{{}, {i}}]:reshape(batch_size) end t2_tmp[state_dim] = t2_tmp[0] t2_tmp[0] = nil table.insert(t2, t2_tmp) end end -- for i=1, #t2 do -- for j=1, #t2[1] do -- for k=1, t2[i][j]:size(1) do -- assert(t2[i][j][k] ~= 0, "0 element at"..i..' '..j..' '..k) -- end -- end -- end return t2 end function table.copy(t) if t == nil then return nil end local nt = {} for k, v in pairs(t) do if type(v) == 'table' then nt[k] = table.copy(v) else nt[k] = v end end setmetatable(nt, table.copy(getmetatable(t))) return nt end function TableConcat(t1,t2) for i=1,#t2 do t1[#t1+1] = t2[i] end return t1 end function table.val_to_str ( v ) if "string" == type( v ) then v = string.gsub( v, "\n", "\\n" ) if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then return "'" .. v .. "'" end return '"' .. string.gsub(v,'"', '\\"' ) .. '"' else return "table" == type( v ) and table.tostring( v ) or tostring( v ) end end function table.key_to_str ( k ) if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then return k else return "[" .. table.val_to_str( k ) .. "]" end end function table.tostring( tbl ) local result, done = {}, {} for k, v in ipairs( tbl ) do table.insert( result, table.val_to_str( v ) ) done[ k ] = true end for k, v in pairs( tbl ) do if not done[ k ] then table.insert( result, table.key_to_str( k ) .. "=" .. table.val_to_str( v ) ) end end return "{" .. table.concat( result, "," ) .. "}" end
--[[ Copyright (c) 2010 Manuel "Roujin" Wolf 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. --]] --! A dialog for activating cheats class "UICheats" (UIResizable) ---@type UICheats local UICheats = _G["UICheats"] local col_bg = { red = 154, green = 146, blue = 198, } local col_caption = { red = 174, green = 166, blue = 218, } local col_border = { red = 134, green = 126, blue = 178, } local col_cheated_no = { red = 36, green = 154, blue = 36, } local col_cheated_yes = { red = 224, green = 36, blue = 36, } --[[ Constructs the cheat dialog. !param ui (UI) The active ui. ]] function UICheats:UICheats(ui) self.cheats = { {name = "money", func = self.cheatMoney}, {name = "all_research", func = self.cheatResearch}, {name = "emergency", func = self.cheatEmergency}, {name = "epidemic", func = self.cheatEpidemic}, {name = "toggle_infected", func = self.cheatToggleInfected}, {name = "vip", func = self.cheatVip}, {name = "earthquake", func = self.cheatEarthquake}, {name = "create_patient", func = self.cheatPatient}, {name = "end_month", func = self.cheatMonth}, {name = "end_year", func = self.cheatYear}, {name = "lose_level", func = self.cheatLose}, {name = "win_level", func = self.cheatWin}, {name = "increase_prices", func = self.cheatIncreasePrices}, {name = "decrease_prices", func = self.cheatDecreasePrices}, } self:UIResizable(ui, 300, 200, col_bg) self.default_button_sound = "selectx.wav" self.modal_class = "cheats" self.esc_closes = true self.resizable = false self:setDefaultPosition(0.2, 0.4) local y = 10 self:addBevelPanel(20, y, 260, 20, col_caption):setLabel(_S.cheats_window.caption) .lowered = true y = y + 30 self:addColourPanel(20, y, 260, 40, col_bg.red, col_bg.green, col_bg.blue):setLabel({_S.cheats_window.warning}) y = y + 40 self.cheated_panel = self:addBevelPanel(20, y, 260, 18, col_cheated_no, col_border, col_border) local function button_clicked(num) return --[[persistable:cheats_button]] function(window) window:buttonClicked(num) end end self.item_panels = {} self.item_buttons = {} y = y + 30 for num = 1, #self.cheats do self.item_panels[num] = self:addBevelPanel(20, y, 260, 20, col_bg) :setLabel(_S.cheats_window.cheats[self.cheats[num].name]) self.item_buttons[num] = self.item_panels[num]:makeButton(0, 0, 260, 20, nil, button_clicked(num)) :setTooltip(_S.tooltip.cheats_window.cheats[self.cheats[num].name]) y = y + 20 end y = y + 20 self:addBevelPanel(20, y, 260, 40, col_bg):setLabel(_S.cheats_window.close) :makeButton(0, 0, 260, 40, nil, self.buttonBack):setTooltip(_S.tooltip.cheats_window.close) y = y + 60 self:setSize(300, y) self:updateCheatedStatus() end function UICheats:updateCheatedStatus() local cheated = self.ui.hospital.cheated self.cheated_panel:setLabel(cheated and _S.cheats_window.cheated.yes or _S.cheats_window.cheated.no) self.cheated_panel:setColour(cheated and col_cheated_yes or col_cheated_no) end function UICheats:buttonClicked(num) -- Only the cheats that may fail return false in that case. All others return nothing. if self.cheats[num].func(self) ~= false then if self.cheats[num].name ~= "lose_level" then local announcements = self.ui.app.world.cheat_announcements if announcements then self.ui:playSound(announcements[math.random(1, #announcements)]) end self.ui.hospital.cheated = true self:updateCheatedStatus() end else -- It was not possible to use this cheat. self.ui:addWindow(UIInformation(self.ui, {_S.information.cheat_not_possible})) end end function UICheats:cheatMoney() self.ui.hospital:receiveMoney(10000, _S.transactions.cheat) end function UICheats:cheatResearch() local hosp = self.ui.hospital for _, cat in ipairs({"diagnosis", "cure"}) do while hosp.research.research_policy[cat].current do hosp.research:discoverObject(hosp.research.research_policy[cat].current) end end end function UICheats:cheatEmergency() if not self.ui.hospital:createEmergency() then self.ui:addWindow(UIInformation(self.ui, {_S.misc.no_heliport})) end end --[[ Creates a new contagious patient in the hospital - potentially an epidemic]] function UICheats:cheatEpidemic() self.ui.hospital:spawnContagiousPatient() end --[[ Before an epidemic has been revealed toggle the infected icons to easily distinguish the infected patients -- will toggle icons for ALL future epidemics you cannot distinguish between epidemics by disease ]] function UICheats:cheatToggleInfected() local hospital = self.ui.hospital if hospital.future_epidemics_pool and #hospital.future_epidemics_pool > 0 then for _, future_epidemic in ipairs(hospital.future_epidemics_pool) do local show_mood = future_epidemic.cheat_always_show_mood future_epidemic.cheat_always_show_mood = not show_mood local mood_action = show_mood and "deactivate" or "activate" for _, patient in ipairs(future_epidemic.infected_patients) do patient:setMood("epidemy4",mood_action) end end else print("Unable to toggle icons - no epidemics in progress that are not revealed") end end function UICheats:cheatVip() self.ui.hospital:createVip() end function UICheats:cheatEarthquake() return self.ui.app.world:createEarthquake() end function UICheats:cheatPatient() self.ui.app.world:spawnPatient() end function UICheats:cheatMonth() self.ui.app.world:setEndMonth() end function UICheats:cheatYear() self.ui.app.world:setEndYear() end function UICheats:cheatLose() self.ui.app.world:loseGame(1) -- TODO adjust for multiplayer end function UICheats:cheatWin() self.ui.app.world:winGame(1) -- TODO adjust for multiplayer end function UICheats:cheatIncreasePrices() local hosp = self.ui.app.world.hospitals[1] for _, casebook in pairs(hosp.disease_casebook) do local new_price = casebook.price + 0.5 if new_price > 2 then casebook.price = 2 else casebook.price = new_price end end end function UICheats:cheatDecreasePrices() local hosp = self.ui.app.world.hospitals[1] for _, casebook in pairs(hosp.disease_casebook) do local new_price = casebook.price - 0.5 if new_price < 0.5 then casebook.price = 0.5 else casebook.price = new_price end end end function UICheats:buttonBack() self:close() end
module(...,package.seeall) local debug = false local ffi = require("ffi") local C = ffi.C local buffer = require("core.buffer") local freelist = require("core.freelist") local lib = require("core.lib") local memory = require("core.memory") local freelist_add, freelist_remove = freelist.add, freelist.remove require("core.packet_h") local max_packets = 1e6 packets_fl = freelist.new("struct packet *", max_packets) local packet_size = ffi.sizeof("struct packet") function module_init () for i = 0, max_packets-1 do free(ffi.cast("struct packet *", memory.dma_alloc(packet_size))) end end -- Return a packet, or nil if none is available. function allocate () return freelist_remove(packets_fl) or error("out of packets") end -- Append data to a packet. function add_iovec (p, b, length, offset) if debug then assert(p.niovecs < C.PACKET_IOVEC_MAX, "packet iovec overflow") end offset = offset or 0 if debug then assert(length + offset <= b.size) end local iovec = p.iovecs[p.niovecs] iovec.buffer = b iovec.length = length iovec.offset = offset p.niovecs = p.niovecs + 1 p.length = p.length + length end -- Prepend data to a packet. function insert_iovec (idx, p, b, length, offset) if debug then assert(p.niovecs < C.PACKET_IOVEC_MAX, "packet iovec overflow") end offset = offset or 0 if debug then assert(length + offset <= b.size) end for i = p.niovecs, idx + 1, -1 do ffi.copy(p.iovecs[i], p.iovecs[i-1], ffi.sizeof("struct packet_iovec")) end local iovec = p.iovecs[idx] iovec.buffer = b iovec.length = length iovec.offset = offset p.niovecs = p.niovecs + 1 p.length = p.length + length end -- Prepend data to a packet. function prepend_iovec (p, b, length, offset) insert_iovec (0, p, b, length, offset) end function niovecs (p) return p.niovecs end function iovec (p, n) return p.iovecs[n] end -- Merge all buffers into one. Throws an exception if a single buffer -- cannot hold the entire packet. -- -- XXX Should work also with packets that are bigger than a single -- buffer, i.e. reduce the number of buffers to the minimal set -- required to hold the entire packet. function coalesce (p) if p.niovecs == 1 then return end local b = buffer.allocate() assert(p.length <= b.size, "packet too big to coalesce") local length = 0 for i = 0, p.niovecs-1, 1 do local iovec = p.iovecs[i] ffi.copy(b.pointer + length, iovec.buffer.pointer + iovec.offset, iovec.length) buffer.free(iovec.buffer) length = length + iovec.length end p.niovecs, p.length = 0, 0 add_iovec(p, b, length) end -- The same as coalesce(), but allocate new packet -- while leaving original packet unchanged function clone (p) local new_p = allocate() local b = buffer.allocate() assert(p.length <= b.size, "packet too big to clone") local length = 0 for i = 0, p.niovecs - 1 do local iovec = p.iovecs[i] ffi.copy(b.pointer + length, iovec.buffer.pointer + iovec.offset, iovec.length) length = length + iovec.length end add_iovec(new_p, b, length) return new_p end -- The opposite of coalesce -- Scatters the data through chunks function scatter (p, sg_list) assert(#sg_list + 1 <= C.PACKET_IOVEC_MAX) local cloned = clone(p) -- provide coalesced copy local result = allocate() local iovec = cloned.iovecs[0] local offset = 0 -- the offset in the cloned buffer -- always append one big chunk in the end, to cover the case -- where the supplied sgs are not sufficient to hold all the data -- also if we get an empty sg_list this will make a single iovec packet local pattern_list = lib.deepcopy(sg_list) pattern_list[#pattern_list + 1] = {4096} for _,sg in ipairs(pattern_list) do local sg_len = sg[1] local sg_offset = sg[2] or 0 local b = buffer.allocate() assert(sg_len + sg_offset <= b.size) local to_copy = math.min(sg_len, iovec.length - offset) ffi.copy(b.pointer + sg_offset, iovec.buffer.pointer + iovec.offset + offset, to_copy) add_iovec(result, b, to_copy, sg_offset) -- advance the offset in the source buffer offset = offset + to_copy assert(offset <= iovec.length) if offset == iovec.length then -- we don't have more data to copy break end end packet.deref(cloned) return result end -- use this function if you want to modify a packet received by an app -- you cannot modify a packet if it is owned more then one app -- it will create a copy for you as needed function want_modify (p) if p.refcount == 1 then return p end local new_p = clone(p) packet.deref(p) return new_p end -- fill's an allocated packet with data from a string function fill_data (p, d, offset) offset = offset or 0 local iovec = p.iovecs[0] assert (offset+#d <= iovec.length, "can't fit on first iovec") -- TODO: handle more iovecs ffi.copy (iovec.buffer.pointer + iovec.offset + offset, d, #d) end -- creates a packet from a given binary string function from_data (d) local p = allocate() local b = buffer.allocate() local size = math.min(#d, b.size) add_iovec(p, b, size) fill_data(p, d) return p end -- Increase the reference count for packet p by n (default n=1). function ref (p, n) if p.refcount > 0 then p.refcount = p.refcount + (n or 1) end return p end -- Decrease the reference count for packet p. -- The packet will be recycled if the reference count reaches 0. function deref (p, n) n = n or 1 if p.refcount > 0 then -- assert(p.refcount >= n) if n == p.refcount then free(p) else p.refcount = p.refcount - n end end end -- Tenured packets are not reused by defref(). function tenure (p) p.refcount = 0 end -- Free a packet and all of its buffers. local function free_aux(p, i) buffer.free(p.iovecs[i].buffer) end function free (p) local niovecs = p.niovecs if niovecs > 0 then free_aux(p, 0) end if niovecs > 1 then free_aux(p, 1) end if niovecs > 2 then for i = 2, p.niovecs-1 do free_aux(p, i) end end p.length = 0 p.niovecs = 0 p.refcount = 1 freelist_add(packets_fl, p) end function iovec_dump (iovec) local b = iovec.buffer local l = math.min(iovec.length, b.size-iovec.offset) if l < 1 then return '' end o={[-1]=string.format([[ offset: %d length: %d buffer.pointer: %s buffer.physical: %X buffer.size: %d ]], iovec.offset, iovec.length, b.pointer, tonumber(b.physical), b.size)} for i = 0, l-1 do o[i] = bit.tohex(b.pointer[i+iovec.offset], -2) end return table.concat(o, ' ', -1, l-1) end function report (p) local result = string.format([[ refcount: %d info.flags: %X info.gso_flags: %X info.hdr_len: %d info.gso_size: %d info.csum_start: %d info.csum_offset: %d niovecs: %d length: %d ]], p.refcount, p.info.flags, p.info.gso_flags, p.info.hdr_len, p.info.gso_size, p.info.csum_start, p.info.csum_offset, p.niovecs, p.length ) for i = 0, p.niovecs-1 do result = result .. string.format([[ iovec #%d: %s ]], i, iovec_dump(p.iovecs[i])) end return result end module_init()
local Path = {} function Path.Split(pathStr) local parts = {} for chunk in pathStr:gmatch("[^%.]+") do table.insert(parts, chunk) end return parts end function Path.IsValid(pathStr, start) start = start or game local parts = Path.Split(pathStr) for _, part in ipairs(parts) do -- skip redundant 'game' if it's the first part if start == game and part ~= "game" or start ~= game then start = start:FindFirstChild(part) if not start then return false end end end return true end function Path.CreateTree(pathStr, start, ignoreLast, instanceType) instanceType = instanceType or "Folder" start = start or game local parts = Path.Split(pathStr) for index, part in ipairs(parts) do -- skip redundant 'game' if it's the first part if start == game and part ~= "game" or start ~= game then local nextObj = start:FindFirstChild(part) if not nextObj and (ignoreLast and index ~= #parts or not ignoreLast) then nextObj = Instance.new(instanceType, start) nextObj.Name = part end if nextObj then start = nextObj end end end return start end function Path.GetObjectAt(pathStr, start) start = start or game local parts = Path.Split(pathStr) for _, part in ipairs(parts) do start = start:FindFirstChild(part) if not start then return nil end end return start end function Path.OSToROBLOXPath(ospath) local path = ospath:gsub("%.[%.%w]+$", "") -- remove extensions path = path:gsub("[\\/]", "%.") -- change separators to . return path end return Path
require("bufferline").setup({ options = { numbers = function(opts) return string.format("%s", opts.id) end, indicator_icon = "▎", buffer_close_icon = "", modified_icon = "●", close_icon = "", left_trunc_marker = "", right_trunc_marker = "", max_name_length = 20, max_prefix_length = 15, -- prefix used when a buffer is de-duplicated tab_size = 25, diagnostics = "nvim_lsp", diagnostics_indicator = function(_, _, diagnostics_dict, _) local s = " " for e, n in pairs(diagnostics_dict) do local sym = e == "error" and "  " or (e == "warning" and "  " or "  ") s = s .. n .. sym end return s end, -- NOTE: this will be called a lot so don't do any heavy processing here custom_filter = function(buf_number) if vim.bo[buf_number].filetype ~= "dashboard" then return true end end, offsets = { { filetype = "NvimTree", text = "File Explorer", text_align = "center", }, { filetype = "minimap", text = "Minimap", text_align = "center", }, { filetype = "Outline", text = "Symbols", text_align = "center", }, { filetype = "packer", text = "Plugins manager", text_align = "center", }, }, show_buffer_icons = true, show_buffer_close_icons = true, show_close_icon = false, show_tab_indicators = true, persist_buffer_sort = true, separator_style = "thick", enforce_regular_tabs = true, always_show_bufferline = false, sort_by = "directory", custom_areas = { right = function() local result = {} local error = vim.diagnostic.get(0, [[Error]]) local warning = vim.diagnostic.get(0, [[Warning]]) local info = vim.diagnostic.get(0, [[Information]]) local hint = vim.diagnostic.get(0, [[Hint]]) if error ~= 0 then result[1] = { text = "  " .. error, guifg = "#ff6c6b", } end if warning ~= 0 then result[2] = { text = "  " .. warning, guifg = "#ECBE7B", } end if hint ~= 0 then result[3] = { text = "  " .. hint, guifg = "#98be65", } end if info ~= 0 then result[4] = { text = "  " .. info, guifg = "#51afef", } end return result end, }, }, })
ang_g = {} ang_m = {} answ = {} ind = {} out = {} dat = "" sign = math.random(3) first_g = 90 +(2 - sign) * math.random(50) first_m = math.random(59) - 1 ang_g[1] = first_g ang_m[1] = first_m ang_g[2] = 179 - first_g ang_m[2] = 60 - first_m temp = math.floor(ang_m[2]/60) ang_g[2] = ang_g[2] + temp ang_m[2] = ang_m[2] - 60 * temp ang_g[3] = ang_g[1] ang_m[3] = ang_m[1] ang_g[4] = ang_g[2] ang_m[4] = ang_m[2] out = lib.math.random_shuffle(index) number = numb[out[1]] dat = ang_g[out[1]] .. meas[1] .. " " if (ang_m[out[1]] ~= 0) then dat = dat .. ang_m[out[1]] .. meas[2] .. " " end nr = 0 for i = 1,4 do if (numb[i] ~= number) then nr = nr + 1 ind[nr] = i answ[nr] = lib.check_number(ang_g[ind[nr]],30) .. meas[1] .. " " if (ang_m[ind[i]] ~= 0) then answ[nr] = answ[nr] .. lib.check_number(ang_m[ind[nr]],20) .. meas[2] .. " " end end end
object_tangible_loot_mustafar_old_republic_tech_analyzer = object_tangible_loot_mustafar_shared_old_republic_tech_analyzer:new { } ObjectTemplates:addTemplate(object_tangible_loot_mustafar_old_republic_tech_analyzer, "object/tangible/loot/mustafar/old_republic_tech_analyzer.iff")
module(..., package.seeall); -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >8 -- -- -- -- -- -- FlyWithLua graphics library V1.2 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- we can use these functions, to access to OpenGL: -- -- glBegin_POINTS() -- -- glBegin_LINES() -- -- glBegin_LINE_STRIP() -- -- glBegin_LINE_LOOP() -- -- glBegin_POLYGON() -- -- glBegin_TRIANGLES() -- -- glBegin_TRIANGLE_STRIP() -- -- glBegin_TRIANGLE_FAN() -- -- glBegin_QUADS() -- -- glBegin_QUAD_STRIP() -- -- glEnd() -- -- glVertex2f(x, y) -- -- glVertex3f(x, y, z) -- -- glLineWidth(width) -- -- glColor3f(red, green, blue) -- -- glColor4f(red, green, blue, alpha) -- -- glRectf(x1, y1, x2, y2) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- If you are not familiar with OpenGL, we create some nice functions to be used in 2D window mode: -- -- -- 8< -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- function draw_line(x1, y1, x2, y2) x1 = x1 or 0 y1 = y1 or 0 x2 = x2 or 0 y2 = y2 or 0 glBegin_LINES() glVertex2f(x1, y1) glVertex2f(x2, y2) glEnd() end function draw_rectangle(x1, y1, x2, y2) x1 = x1 or 0 y1 = y1 or 0 x2 = x2 or 0 y2 = y2 or 0 if x1 > x2 then x1, x2 = x2, x1 end if y1 > y2 then y1, y2 = y2, y1 end glBegin_POLYGON() glVertex2f(x1, y1) glVertex2f(x1, y2) glVertex2f(x2, y2) glVertex2f(x2, y1) glEnd() end function draw_triangle(x1, y1, x2, y2, x3, y3) x1 = x1 or 0 y1 = y1 or 0 x2 = x2 or 0 y2 = y2 or 0 x3 = x3 or 0 y3 = y3 or 0 glBegin_TRIANGLES() glVertex2f(x1, y1) glVertex2f(x2, y2) glVertex2f(x3, y3) glEnd() end function set_color(red, green, blue, alpha) red = red or 1.0 green = green or 1.0 blue = blue or 1.0 alpha = alpha or 1.0 glColor4f(red, green, blue, alpha) end function set_width(width) width = width or 1 glLineWidth(width) end -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >8 -- -- -- -- -- -- The following commands will use these type of arguments: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- x = horizontal screen coordinate (starts left) -- y = vertical screen coordinate (starts at bottom) -- a = an angle in degrees, 0 points towards top, clockwise (alpha) -- b = an angle in degrees, 0 points towards top, clockwise (beta) -- r = radius in screen pixel -- l = a lenght in screen pixel -- w = line width in screen pixel -- -- -- 8< -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- calculate a point, when a starting point plus angle and lenght are given -- usage: new_x, new_y = graphics.move( start_x, start_y, angle, lenght ) function move_angle(x,y,a,l) local tx local ty local arad arad = (-a+90)*math.pi/180 tx = x + l * math.cos(arad) ty = y + l * math.sin(arad) return tx, ty end function draw_angle_line(x, y, a, l, w) w = w or 1 local x2 local y2 glLineWidth(w) x2, y2 = move_angle(x, y, a, l) draw_line(x, y, x2, y2) end function draw_angle_arrow(x, y, a, r, l, w) l = l or 7.5 w = w or 1 local x1 local y1 local x2 local y2 local x3 local y3 glLineWidth(w) x1, y1 = move_angle(x, y, a, r - w) draw_line(x , y, x1, y1) x1, y1 = move_angle(x, y, a, r) x2, y2 = move_angle(x1, y1, a - 200, l) x3, y3 = move_angle(x1, y1, a - 160, l) draw_triangle(x1, y1, x2, y2, x3, y3) end function draw_circle(x, y, r, w) w = w or 1 local x1 local y1 local step glLineWidth(w) if r > 50 then step = 750 / r else step = 15 end glBegin_LINE_LOOP() for i = 0, 360, step do x1, y1 = move_angle(x, y, i, r) glVertex2f(x1, y1) end glEnd() end function draw_filled_circle(x, y, r) local x1 local y1 local step if r > 50 then step = 750 / r else step = 15 end glBegin_POLYGON() for i = 0, 360, step do x1, y1 = move_angle(x, y, i, r) glVertex2f(x1, y1) end glEnd() end function draw_arc(x, y, a1, a2, r, w) w = w or 1 local x1 local y1 local step glLineWidth(w) if r > 50 then step = 750 / r else step = 15 end glBegin_LINE_LOOP() glVertex2f(x, y) for i = a1, a2, step do x1, y1 = move_angle(x, y, i, r) glVertex2f(x1, y1) end x1, y1 = move_angle(x, y, a2, r) glVertex2f(x1, y1) glEnd() end function draw_filled_arc(x, y, a1, a2, r) local x1 local y1 local step if r > 50 then step = 750 / r else step = 15 end glBegin_POLYGON() glVertex2f(x, y) for i = a1, a2, step do x1, y1 = move_angle(x, y, i, r) glVertex2f(x1, y1) end x1, y1 = move_angle(x, y, a2, r) glVertex2f(x1, y1) glEnd() end function draw_tick_mark(x, y, a, r, l, w) l = l or 10 w = w or 1 local x1 local y1 local x2 local y2 x1, y1 = move_angle(x, y, a, r - l) x2, y2 = move_angle(x, y, a, r) glLineWidth(w) draw_line(x1, y1, x2, y2) end function draw_outer_tracer(x, y, a, r, l) l = l or 7.5 local x1 local y1 local x2 local y2 local x3 local y3 x1, y1 = move_angle(x, y, a, r) x2, y2 = move_angle(x1, y1, a - 30, l) x3, y3 = move_angle(x1, y1, a + 30, l) draw_triangle(x1, y1, x2, y2, x3, y3) end function draw_inner_tracer(x, y, a, r, l) l = l or 7.5 local x1 local y1 local x2 local y2 local x3 local y3 x1, y1 = move_angle(x, y, a, r) x2, y2 = move_angle(x1, y1, a - 210, l) x3, y3 = move_angle(x1, y1, a - 150, l) draw_triangle(x1, y1, x2, y2, x3, y3) end
----------------------------------- -- Area: East Sarutabaruta -- NPC: Pore-Ohre -- Involved In Mission: The Heart of the Matter -- !pos 261 -17 -458 116 ----------------------------------- require("scripts/globals/keyitems") require("scripts/globals/missions") local ID = require("scripts/zones/East_Sarutabaruta/IDs") ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) -- Check if we are on Windurst Mission 1-2 if (player:getCurrentMission(WINDURST) == tpz.mission.id.windurst.THE_HEART_OF_THE_MATTER) then MissionStatus = player:getCharVar("MissionStatus") if (MissionStatus == 1) then player:startEvent(46) elseif (MissionStatus == 2) then player:startEvent(47) end end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) if (csid == 46) then player:setCharVar("MissionStatus", 2) player:addKeyItem(tpz.ki.SOUTHEASTERN_STAR_CHARM) player:messageSpecial(ID.text.KEYITEM_OBTAINED, tpz.ki.SOUTHEASTERN_STAR_CHARM) end end
local Style = script.Parent local Core = Style.Parent local UIBlox = Core.Parent -- This was a vestigial part of a style refactor which encountered some issues, -- and was never properly enabled. To minimize import changes, we re-export the -- original StyleProvider implementation. return require(UIBlox.Style.StyleProvider)
function Color( r,g,b,a ) if( a ) then return {r,g,b,a} else return {r,g,b} end end
return {'atelier','atelierbezoek','ateliermeisje','atelierruimte','atelierwoning','aterling','atelierhouder','atelierroute','atechnisch','atenaar','ate','atema','aten','ateliermeisjes','atelierruimten','atelierruimtes','ateliers','aten','aterlingen','atelierwoningen','ateliertje','atelierhouders','ates','atelierbezoeken'}
momoTweak.fluid = {} momoTweak.fluid.ferric = "liquid-ferric-chloride-solution" momoTweak.fluid.plastic = "liquid-plastic" momoTweak.fluid.resin = "liquid-resin" momoTweak.fluid.rubber = "liquid-rubber" momoTweak.fluid.lube = "lubricant" momoTweak.fluid.crudeOil = "crude-oil" momoTweak.fluid.fuel = "liquid-fuel" momoTweak.fluid.sulfuricAcid = "sulfuric-acid" momoTweak.fluid.sodiumHydroxide = "liquid-aqueous-sodium-hydroxide" momoTweak.fluid.saline = "water-saline" momoTweak.fluid.water = "water" momoTweak.fluid.copper = "liquid-molten-copper" momoTweak.gas = {} momoTweak.gas.air = "gas-compressed-air" momoTweak.gas.o2 = "gas-oxygen" momoTweak.gas.co = "gas-carbon-monoxide" momoTweak.gas.co2 = "gas-carbon-dioxide" momoTweak.gas.h2 = "gas-hydrogen"
codeFolder = '../code/' require('torch') require(codeFolder..'rbm') conv = require(codeFolder..'conv-functions') include(codeFolder..'mnist.lua') require(codeFolder..'ProFi') require 'paths' torch.setdefaulttensortype('torch.FloatTensor') require 'nn' num_threads = 2 torch.setnumthreads(num_threads) -- W : vis - hid weights [ #hid x #vis ] -- U : label - hid weights [ #hid x #n_classes ] -- b : bias of visible layer [ #vis x 1] -- c : bias of hidden layer [ #hid x 1] -- d : bias of label layer [ #n_classes x 1] -- --n_input = 3 -- color channels -- filter_size = 2 -- -- n_input = 3 -- n_filters = 5 -- how many filters to use -- pool_size =2 -- how large the probabilistic maxpooling -- input_size = 5 -- the size of the input image -- n_classes = 4 -- -- create test data -- -- X is always a row vector when it is stored. -- x3d = torch.Tensor({ -- 0.0500, 0.1000, 0.3500, 0.0500, 0, -- 0.1500, 0.2000, 0.1500, 0.2000, 0.0500, -- 0.1000, 0.1500, 0.2000, 0.0500, 0.1000, -- 0.2500, 0.2000, 0.1500, 0.0500, 0.0500, -- 0.1500, 0.1500, 0.1000, 0.0500, 0.1000, -- 0.0400, 0.0800, 0.1200, 0.1200, 0.1200, -- 0.1200, 0.1600, 0.1200, 0.1600, 0.0400, -- 0.0800, 0.1200, 0.1600, 0.0400, 0.0800, -- 0.2000, 0.1600, 0.1200, 0.0400, 0.0400, -- 0.1200, 0.1200, 0.0800, 0.0400, 0.0800, -- 0.0500, -0.1000, 0.3500, 0.0500, 0, -- 0.1500, -0.2000, 0.1500, 0.2000, 0.0500, -- 0.1000, 0.1500, 0.2000, 0.0500, 0.1000, -- 0.2500, 0.2000, 0.1500, 0.0500, 0.0500, -- 0.1500, 0.4000, 0.1000, 0.0500, 0.1000}):resize(1,n_input,math.pow(input_size,2)) -- x2d = x3d:view(1,75) -- y = torch.Tensor({0,0,1, 0}):resize(1,n_classes) -- -- Rows are 1 filters for 3 color channels -- W = torch.Tensor({ 1,-2,-3,7, 1 ,2, 3,4, -2 ,4,5 ,-2, -- 2,1,-3,2 , -1,-4,2,1 , 2 ,3,-4,2, -- 2,1,-3,2 , -1,-4,2,1 , 2 ,3,-4,2, -- 2,1,-3,2 , -1,-4,2,1 , 2 ,3,-4,2, -- 2,1,-3,2 , -1,-4,2,1 , 2 ,3,-4,2}):resize(1,60) -- labels = torch.Tensor{4} -- train = {} -- train.data = x3d--:view(1,1,75) -- train.labels = labels -- sizes = conv.calcconvsizes(filter_size,n_filters,n_classes,input_size,pool_size,train) -- --opts.n_hidden = 10 -- opts = {} -- conv.setupsettings(opts,sizes) -- opts.W = W -- Testing weights -- opts.U = torch.zeros(opts.U:size()) -- otherwise tests fails -- opts.numepochs = 1 -- rbm = rbmsetup(opts,train) -- debug_1 = conv.setupfunctions(rbm,sizes) -- modofies RBM to use conv functions -- opts_2 = {} -- conv.setupsettings(opts_2,sizes) -- opts_2.W = W:clone() -- Testing weights -- opts_2.U = torch.zeros(opts.U:size()) -- otherwise tests fails -- opts.numepochs = 5 -- rbm_2 = rbmsetup(opts_2,train) -- debug_2 = conv.setupfunctions(rbm_2,sizes) -- --print(rbm) -- --- Clone original weighs -- W_org = rbm.W:clone() -- U_org = rbm.U:clone() -- b_org = rbm.b:clone() -- c_org = rbm.c:clone() -- d_org = rbm.d:clone() -- -- Setup a trainng session with a single epoch and generative training -- rbm.rand = function(m,n) return torch.Tensor(m,n):fill(1):mul(0.53)end -- for testing -- rbm.alpha = 1 -- generative training -- rbm.momentum = 0 -- -- Test the values grads.calculate grads produce -- grads.calculategrads(rbm,x2d,y) -- dc_cgrads = rbm.dc:clone() -- db_cgrads = rbm.db:clone() -- dW_cgrads = rbm.dW:clone() -- print("#######################---EVALAUTE---#######################") -- h0,h0_rnd,hk,vkx,vkx_rnd,vky_rnd = rbm.generativestatistics(rbm,x2d,y,tcwx) -- dW, dU, db, dc, dd= rbm.generativegrads(x2d,y,h0,hk,vkx_rnd,vky_rnd) -- rbm.generativegrads(x2d,y,h0,hk,vkx_rnd,vky_rnd) -- updategradsandmomentum(rbm) -- --print(">>>>updategradsandmomentum rbm.db: ",rbm.db) -- -- update vW, vU, vb, vc and vd, formulae: vx = vX*mom + dX -- --updateweights(rbm) -- print(">>>>>>RBMTRAIN") -- rbm = rbmtrain(rbm,train) -- print("<<<<<<<<<<<<<<<") -- print(">>>>>>RBMTRAIN MULTIPLE updates") -- rbm_2.numepochs = 5 -- rbm_2 = rbmtrain(rbm_2,train,train) -- print("<<<<<<<<<<<<<<<") -- print("OK\n\n") -- -- TESTING VALUES -- h0_test = torch.Tensor({ -- 0.2437, 0.0720, 0.4036, 0.1796, -- 0.0368, 0.6303, 0.2626, 0.1180, -- 0.3400, 0.2146, 0.2562, 0.2036, -- 0.1024, 0.3299, 0.2077, 0.2562, -- 0.0326, 0.7167, 0.4101, 0.0376, -- 0.0612, 0.0999, 0.1063, 0.3162, -- 0.1335, 0.1680, 0.1829, 0.2021, -- 0.4997, 0.0718, 0.2042, 0.2469, -- 0.0326, 0.7167, 0.4101, 0.0376, -- 0.0612, 0.0999, 0.1063, 0.3162, -- 0.1335, 0.1680, 0.1829, 0.2021, -- 0.4997, 0.0718, 0.2042, 0.2469, -- 0.0326, 0.7167, 0.4101, 0.0376, -- 0.0612, 0.0999, 0.1063, 0.3162, -- 0.1335, 0.1680, 0.1829, 0.2021, -- 0.4997, 0.0718, 0.2042, 0.2469, -- 0.0326, 0.7167, 0.4101, 0.0376, -- 0.0612, 0.0999, 0.1063, 0.3162, -- 0.1335, 0.1680, 0.1829, 0.2021, -- 0.4997, 0.0718, 0.2042, 0.2469 -- }):resize(1,5*4*4) -- h0_rnd_test = torch.Tensor({ -- 1 1 1 1 1 1 -- 1 1 1 1 1 0 -- 1 1 1 1 1 1 -- 1 0 0 1 1 0 -- 1 0 0 1 1 1 -- 1 0 1 0 0 0 -- 0 0 0 1 1 0 -- 1 0 0 1 1 0 -- 1 0 0 0 1 0 -- 0 1 1 1 0 0 -- 1 0 0 0 1 0 -- 1 0 0 1 0 0 -- 1 1 1 0 0 1 -- 0 0 0 0 0 0 -- 0 0 0 1 0 1 -- 1 1 0 0 0 1 -- 0 1 1 0 0 1 -- 1 0 1 1 1 1 -- 0 0 0 0 0 1 -- 1 1 1 1 1 1 -- 0 1 1 1 1 1 -- 1 1 0 0 1 1 -- 1 1 1 1 1 1 -- 1 0 0 1 0 0 -- 1 0 1 1 0 0 -- 0 0 0 0 0 1 -- 0 0 0 0 0 1 -- 0 1 1 1 0 1 -- 0 1 0 1 0 0 -- 0 1 1 0 1 1}):resize(1,5*6*6) -- vkx_rnd_test = torch.Tensor({ -- 0.5046, 5.4483, 6.4071, 1.3132, -0.2088, -- -0.5959, -5.2479, 0.3576, 7.6641, 2.5863, -- 0.5627, -0.9298, 5.1102, 0.5802, 3.7569, -- 1.4782, 3.4863, 1.3514, 2.8530, 3.5173, -- -6.3037, 2.8630, -0.1891, -0.6443, 3.7686, -- 0.1133, -2.8290, -12.5596, -5.7247, -0.2421, -- 0.7840, 6.3792, 7.1448, 1.7716, -3.9546, -- 0.4063, 1.1692, 1.8246, 1.3398, -1.0906, -- 0.1914, -3.8660, 2.6643, 0.4013, -1.8153, -- 4.3049, 3.9727, 3.8634, 4.3912, 2.0124, -- -0.2266, 6.9558, 11.3613, 6.4770, 1.1691, -- 1.1131, -10.9126, 5.0921, 7.3895, 4.2077, -- -0.4076, 5.8450, 2.9765, 0.2859, 5.5336, -- 3.3570, 5.0936, 2.6688, 3.4780, 5.1977, -- -7.4833, 4.2936, -2.3139, -1.4514, 1.4628 -- }):resize(1,n_input*5*5) -- vkx_sigm_rnd_test = torch.Tensor({ -- 1, 1, 1, 1, 0, -- 0, 0, 0, 1, 1, -- 1, 1, 1, 1, 1, -- 0, 1, 1, 1, 1, -- 0, 1, 0, 0, 1, -- 1, 0, 0, 0, 1, -- 1, 1, 1, 1, 0, -- 0, 0, 0, 0, 0, -- 1, 1, 1, 1, 0, -- 1, 1, 1, 1, 1, -- 0, 1, 1, 1, 1, -- 1, 0, 0, 1, 1, -- 1, 1, 1, 1, 1, -- 0, 1, 1, 1, 1, -- 0, 1, 0, 0, 1}):resize(1,n_input*5*5) -- vkx_sigm_test = torch.Tensor({ -- 0.7311, 0.9975, 1.0000, 0.9526, 0.1192, -- 0.0474, 0.0180, 0.0003, 1.0000, 1.0000, -- 0.9999, 0.9997, 1.0000, 0.9975, 1.0000, -- 0.0009, 0.9933, 0.9991, 1.0000, 1.0000, -- 0.0000, 0.9933, 0.0003, 0.5000, 1.0000, -- 0.7311, 0.1192, 0.0000, 0.0000, 0.8808, -- 0.9526, 1.0000, 1.0000, 0.9999, 0.0000, -- 0.0474, 0.0000, 0.0000, 0.0067, 0.0000, -- 0.9991, 0.9820, 1.0000, 0.8808, 0.0025, -- 0.9997, 0.9991, 1.0000, 1.0000, 0.9997, -- 0.1192, 1.0000, 1.0000, 1.0000, 0.9820, -- 0.9933, 0.0000, 0.2689, 1.0000, 1.0000, -- 0.9975, 1.0000, 1.0000, 0.9820, 1.0000, -- 0.0474, 0.9933, 0.9933, 1.0000, 1.0000, -- 0.0000, 1.0000, 0.0000, 0.0067, 0.9975}):resize(1,n_input*5*5) -- hk_sigm_test = torch.Tensor({ -- 0.7304, 0.5001, 0.5285, 0.6989, -- 0.5001, 0.5006, 0.5105, 0.5005, -- 0.5039, 0.5288, 0.6708, 0.5033, -- 0.7013, 0.5039, 0.5033, 0.5651, -- 0.5002, 0.7309, 0.7311, 0.5000, -- 0.5000, 0.5000, 0.5000, 0.5000, -- 0.7309, 0.5002, 0.5006, 0.5002, -- 0.5000, 0.5000, 0.5001, 0.7303, -- 0.5002, 0.7309, 0.7311, 0.5000, -- 0.5000, 0.5000, 0.5000, 0.5000, -- 0.7309, 0.5002, 0.5006, 0.5002, -- 0.5000, 0.5000, 0.5001, 0.7303, -- 0.5002, 0.7309, 0.7311, 0.5000, -- 0.5000, 0.5000, 0.5000, 0.5000, -- 0.7309, 0.5002, 0.5006, 0.5002, -- 0.5000, 0.5000, 0.5001, 0.7303, -- 0.5002, 0.7309, 0.7311, 0.5000, -- 0.5000, 0.5000, 0.5000, 0.5000, -- 0.7309, 0.5002, 0.5006, 0.5002, -- 0.5000, 0.5000, 0.5001, 0.7303}):resize(1,5*4*4) -- h0_filter_test = torch.Tensor({ -- 0.6303, 0.2626, -- 0.2146, 0.2562, -- 0.0999, 0.1063, -- 0.1680, 0.1829, -- 0.0999, 0.1063, -- 0.1680, 0.1829, -- 0.0999, 0.1063, -- 0.1680, 0.1829, -- 0.0999, 0.1063, -- 0.1680, 0.1829}):resize(n_filters,1,2,2) -- h0_filter_test = sigm(h0_filter_test) -- x_filter_test = torch.Tensor({ -- 0.2000, 0.1500, 0.2000, -- 0.1500, 0.2000, 0.0500, -- 0.2000, 0.1500, 0.0500, -- 0.1600, 0.1200, 0.1600, -- 0.1200, 0.1600, 0.0400, -- 0.1600, 0.1200, 0.0400, -- -0.2000, 0.1500, 0.2000, -- 0.1500, 0.2000, 0.0500, -- 0.2000, 0.1500, 0.0500}):resize(n_input,3,3) -- x_filter_test = sigm(x_filter_test) -- db_test = torch.Tensor({-0.5540,-0.4976,-0.6080}):resize(3,1) -- dc_test = torch.Tensor({ 0.0003,-0.0041,-0.0041,-0.0041,-0.0041}):resize(5,1) -- dW_test = torch.Tensor({ -- -0.1972, -0.3401, -- -0.4511, -0.4852, -- -0.1706, -0.1828, -- -0.2187, -0.2459, -- -0.2624, -0.3401, -- -0.4511, -0.4852, -- -0.1566, -0.2953, -- -0.4066, -0.4402, -- -0.1751, -0.1861, -- -0.1754, -0.2022, -- -0.2091, -0.2953, -- -0.4066, -0.4402, -- -0.1566, -0.2953, -- -0.4066, -0.4402, -- -0.1751, -0.1861, -- -0.1754, -0.2022, -- -0.2091, -0.2953, -- -0.4066, -0.4402, -- -0.1566, -0.2953, -- -0.4066, -0.4402, -- -0.1751, -0.1861, -- -0.1754, -0.2022, -- -0.2091, -0.2953, -- -0.4066, -0.4402, -- -0.1566, -0.2953, -- -0.4066, -0.4402, -- -0.1751, -0.1861, -- -0.1754, -0.2022, -- -0.2091, -0.2953, -- -0.4066, -0.4402, -- }):resize(1,60) -- -- Calculate expected values before update -- --print(W) -- W_train_test = W_org + dW_test * rbm.learningrate -- b_train_test = b_org + db_test * rbm.learningrate -- c_train_test = c_org + dc_test * rbm.learningrate -- -- Setup check after RBMtrain -- -- dd and dU are not tested -- print "################ TESTS ############################" -- -- The debug table has references to the up/down/unroll networks -- -- a) Assert that rbm.W and b and modelup.weights share memeory -- print('Test network memory sharing') -- checkequality(conv.toFlat(rbm.W),conv.toFlat(debug_1.modelup.modules[2].weight),-4,false) -- assert(rbm.W:storage() == debug_1.modelup.modules[2].weight:storage()) -- assert(rbm.c:storage() == debug_1.modelup.modules[2].bias:storage()) -- -- b) for modeldownx the bias should be shared -- assert(rbm.b:storage() == debug_1.modeldownx.modules[3].bias:storage()) -- -- ADD MORE TESTS WITH NETWORKS -- -- E.g. test conversion functions -- print("OK") -- print("Testing Statistics...") -- assert(checkequality(h0,h0_test,-4,false)) -- assert(checkequality(h0_rnd,h0_rnd_test,-4,false)) -- assert(checkequality(vkx,vkx_sigm_test,-4,false)) -- assert(checkequality(vkx_rnd,vkx_sigm_rnd_test,-4,false)) -- assert(checkequality(hk,hk_sigm_test,-4,false)) -- print("OK") -- print("Testing Gradients...") -- assert(checkequality(db,db_test,-4,false)) -- assert(checkequality(dc,dc_test,-4,false)) -- assert(checkequality(dW,dW_test,-4,false)) -- assert(checkequality(dc_cgrads,dc_test,-4,false)) -- assert(checkequality(db_cgrads,db_test,-4,false)) -- assert(checkequality(dW_cgrads,dW_test,-4,false)) -- assert(checkequality(rbm.c,c_train_test,-4,false)) -- assert(checkequality(rbm.b,b_train_test,-4,false)) -- assert(checkequality(rbm.W,W_train_test,-4,false)) -- print('OK') print("################--Check against MEDAL----###############") n_classes = 4 n_input = 1 input_size = 8 n_filters = 5 filter_size = 3 pool_size = 2 y = torch.Tensor({0,0,1, 0}):resize(1,n_classes) x3d = torch.Tensor({ 0.0118, 0.0706, 0.0706, 0.0706, 0.4941, 0.5333, 0.6863, 0.1020, 0.6667, 0.9922, 0.9922, 0.9922, 0.9922, 0.9922, 0.8824, 0.6745, 0.9922, 0.9922, 0.9922, 0.9922, 0.9922, 0.9843, 0.3647, 0.3216, 0.9922, 0.9922, 0.7765, 0.7137, 0.9686, 0.9451, 0, 0, 0.9922, 0.8039, 0.0431, 0, 0.1686, 0.6039, 0, 0, 0.9922, 0.3529, 0, 0, 0, 0, 0, 0, 0.9922, 0.7451, 0.0078, 0, 0, 0, 0, 0, 0.7451, 0.9922, 0.2745, 0, 0, 0, 0, 0 }):resize(1,n_input,input_size*input_size) x2d = x3d:view(1,input_size*input_size) W = torch.Tensor({ -0.0184, -0.0439, -0.0697, 0.0490, -0.0785, -0.0343, -0.1111, -0.0906, -0.0229, 0.0086, -0.0657, 0.0379, -0.0180, 0.0840, -0.0184, 0.0412, -0.1050, 0.0130, -0.0799, 0.1041, 0.0836, -0.0671, -0.0415, 0.0877, 0.0668, 0.0427, -0.0922, -0.1024, -0.0893, 0.0074, -0.0734, -0.0175, 0.0426, 0.0840, 0.1018, -0.0410, 0.0414, 0.0556, -0.0488, 0.0744, 0.1086, 0.0643, -0.1070, 0.0551, -0.0882 }):resize(1,45) labels_medal = torch.Tensor{4} train_medal = {} train_medal.data = x3d--:view(1,1,81) train_medal.labels = labels_medal sizes_medal = conv.calcconvsizes(filter_size,n_filters,n_classes,input_size,pool_size,train_medal) --opts.n_hidden = 10 opts_medal = {} conv.setupsettings(opts_medal,sizes_medal) opts_medal.W = W -- Testing weights opts_medal.U = torch.zeros(opts_medal.U:size()) -- otherwise tests fails opts_medal.numepochs = 1 rbm_medal = rbmsetup(opts_medal,train_medal) debug_3 = conv.setupfunctions(rbm_medal,sizes_medal) -- modofies RBM to use conv functions W_org = rbm_medal.W:clone() U_org = rbm_medal.U:clone() b_org = rbm_medal.b:clone() c_org = rbm_medal.c:clone() d_org = rbm_medal.d:clone() print("------> TEST MEDAL STATISTICS <-----------------") conv_rbmup_m,conv_rbmdownx_m,conv_pygivenx_m,conv_pygivenxdropout_m,debugupdown_m = conv.createupdownpygivenx(rbm_medal,sizes_medal) rbm_medal.rand = function(m,n) return torch.Tensor(m,n):fill(1):mul(0.2)end stat_gen = rbm_medal.generativestatistics(rbm_medal,x2d,y,tcwx) grads_gen= rbm_medal.generativegrads(rbm_medal,x2d,y,stat_gen) rbm_medal = rbmtrain(rbm_medal,train_medal,train_medal) h0_test = torch.Tensor({ 0.1919, 0.1948, 0.1899, 0.1859, 0.1761, 0.1960, 0.1744, 0.1770, 0.1820, 0.1793, 0.1744, 0.2041, 0.1675, 0.1869, 0.1893, 0.1815, 0.1775, 0.1981, 0.1845, 0.2184, 0.2039, 0.1961, 0.1939, 0.2166, 0.1824, 0.2079, 0.2010, 0.1939, 0.1957, 0.1994, 0.1807, 0.2032, 0.1977, 0.2037, 0.2016, 0.2016, 0.2015, 0.2005, 0.2038, 0.1985, 0.1974, 0.2028, 0.1959, 0.2007, 0.2010, 0.1952, 0.1952, 0.2045, 0.1960, 0.2070, 0.2022, 0.2040, 0.1943, 0.2025, 0.2032, 0.1958, 0.1982, 0.1959, 0.2004, 0.2011, 0.1897, 0.2087, 0.2002, 0.2012, 0.1938, 0.2023, 0.1951, 0.2035, 0.2010, 0.1988, 0.2013, 0.2013, 0.1937, 0.1886, 0.1961, 0.2057, 0.2087, 0.1941, 0.2181, 0.2118, 0.2040, 0.2057, 0.2108, 0.2008, 0.2174, 0.2094, 0.2022, 0.1934, 0.2045, 0.1997, 0.1987, 0.1900, 0.2038, 0.2172, 0.2041, 0.1845, 0.2082, 0.1965, 0.1983, 0.2099, 0.2100, 0.1904, 0.1890, 0.2031, 0.1996, 0.1961, 0.1999, 0.1999, 0.2208, 0.2143, 0.2219, 0.2138, 0.2162, 0.1975, 0.1886, 0.1789, 0.1784, 0.1822, 0.1950, 0.1799, 0.2079, 0.1899, 0.1849, 0.1840, 0.1879, 0.1974, 0.1931, 0.1845, 0.2008, 0.2012, 0.1865, 0.1991, 0.1890, 0.1976, 0.1991, 0.1975, 0.1912, 0.1930, 0.1942, 0.2117, 0.2042, 0.1996, 0.2053, 0.2053, 0.1955, 0.2008, 0.1954, 0.1998, 0.2090, 0.2057, 0.2111, 0.2126, 0.2106, 0.2154, 0.2164, 0.1927, 0.2193, 0.2096, 0.2222, 0.2216, 0.2321, 0.1868, 0.2028, 0.1911, 0.1842, 0.1948, 0.2106, 0.1931, 0.2156, 0.1860, 0.2008, 0.1982, 0.2055, 0.2024, 0.2236, 0.1855, 0.1965, 0.2022, 0.1974, 0.1974}):resize(1,5*6*6) h0_rnd_test = torch.Tensor({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0}):resize(1,5*6*6) vkx_test = torch.Tensor({ 0.4766, 0.4483, 0.4631, 0.4156, 0.4798, 0.5527, 0.5080, 0.4973, 0.4676, 0.5447, 0.5515, 0.5356, 0.5232, 0.5845, 0.6026, 0.5244, 0.4979, 0.5279, 0.6336, 0.6318, 0.5969, 0.5844, 0.4536, 0.4994, 0.4859, 0.5273, 0.4733, 0.4614, 0.5572, 0.5460, 0.4665, 0.4620, 0.5154, 0.6438, 0.4025, 0.3296, 0.4227, 0.6698, 0.4696, 0.4874, 0.4957, 0.4503, 0.4749, 0.5213, 0.4989, 0.3901, 0.4399, 0.5029, 0.5085, 0.5067, 0.3467, 0.5560, 0.4530, 0.4821, 0.4372, 0.4787, 0.4733, 0.5339, 0.4965, 0.4099, 0.4877, 0.4524, 0.4639, 0.4873 }):resize(1,1*8*8) hk_test = torch.Tensor({ 0.1916, 0.1905, 0.1891, 0.1881, 0.1878, 0.1912, 0.1906, 0.1893, 0.1926, 0.1911, 0.1893, 0.1931, 0.1866, 0.1887, 0.1931, 0.1909, 0.1892, 0.1890, 0.1912, 0.1974, 0.1926, 0.1882, 0.1897, 0.1969, 0.1905, 0.1939, 0.1941, 0.1889, 0.1919, 0.1902, 0.1910, 0.1911, 0.1890, 0.1944, 0.1922, 0.1925, 0.2004, 0.1977, 0.1991, 0.1990, 0.1985, 0.2022, 0.1986, 0.2016, 0.2012, 0.1991, 0.1996, 0.1982, 0.1973, 0.2009, 0.2009, 0.2011, 0.1944, 0.2014, 0.2023, 0.1980, 0.1979, 0.1980, 0.2039, 0.1988, 0.1963, 0.2034, 0.1981, 0.2025, 0.1955, 0.2009, 0.2002, 0.1978, 0.2019, 0.1965, 0.2017, 0.1999, 0.1989, 0.1989, 0.2012, 0.2059, 0.2059, 0.1990, 0.2066, 0.2042, 0.1995, 0.2015, 0.2027, 0.2020, 0.2069, 0.2094, 0.2023, 0.1958, 0.2027, 0.2030, 0.1984, 0.1943, 0.2015, 0.2108, 0.2028, 0.1977, 0.2069, 0.1946, 0.1989, 0.2053, 0.2068, 0.2002, 0.1984, 0.2077, 0.2038, 0.1995, 0.1987, 0.2024, 0.1988, 0.2004, 0.2031, 0.2032, 0.2026, 0.1970, 0.1988, 0.1960, 0.1925, 0.1950, 0.1974, 0.1950, 0.2029, 0.1977, 0.1918, 0.1909, 0.1980, 0.2010, 0.1966, 0.1945, 0.2028, 0.2054, 0.1970, 0.1945, 0.1971, 0.1947, 0.2013, 0.2011, 0.1963, 0.1960, 0.1984, 0.2023, 0.1971, 0.1944, 0.1997, 0.2007, 0.2001, 0.2022, 0.1993, 0.1991, 0.2047, 0.2032, 0.2045, 0.2069, 0.2076, 0.2073, 0.2038, 0.2023, 0.2047, 0.2013, 0.2062, 0.2059, 0.2087, 0.1968, 0.2053, 0.2012, 0.1969, 0.2027, 0.2042, 0.2046, 0.2073, 0.2013, 0.2064, 0.1971, 0.2046, 0.2026, 0.2024, 0.2008, 0.2012, 0.2071, 0.2021, 0.2016 }):resize(1,5*6*6) dW_test = torch.Tensor({ 0.6897, 0.1193, -0.4294, 0.7322, -0.1370, -0.7868, 0.1229, -0.8993, -1.6596, 0.7539, 0.2024, -0.3725, 0.8539, -0.0078, -0.7207, 0.2052, -0.8324, -1.6701, 0.7792, 0.2744, -0.3199, 0.8652, 0.0210, -0.7132, 0.2138, -0.8103, -1.6942, 0.6137, 0.0841, -0.4521, 0.8015, -0.0256, -0.7237, 0.2071, -0.7876, -1.6409, 0.8560, 0.3313, -0.3115, 0.9545, 0.1280, -0.6752, 0.2382, -0.7432, -1.6661 }):mul(1/( (6 - 2 * 3 + 2) * (6 - 2 * 3 + 2) )):resize(1,5*3*3) db_test = torch.Tensor({-2.9119}):mul(1/(input_size * input_size)):resize(1,1) dc_test = torch.Tensor({0.0317,0.0099,-0.0115,-0.0395,0.0304}):mul(1/(6*6)):resize(5,1) W_train_test = W_org + dW_test * rbm_medal.learningrate b_train_test = b_org + db_test * rbm_medal.learningrate c_train_test = c_org + dc_test * rbm_medal.learningrate assert(checkequality(stat_gen.h0,h0_test,-4,false)) assert(checkequality(stat_gen.h0_rnd,h0_rnd_test,-4,false)) assert(checkequality(stat_gen.vkx,vkx_test,-4,false)) assert(checkequality(stat_gen.hk,hk_test,-4,false)) assert(checkequality(grads_gen.dW,dW_test*rbm_medal.learningrate,-4,false)) assert(checkequality(grads_gen.db,db_test*rbm_medal.learningrate,-4,false)) assert(checkequality(grads_gen.dc,dc_test*rbm_medal.learningrate,-4,false)) assert(checkequality(rbm_medal.c,c_train_test,-3,false)) assert(checkequality(rbm_medal.b,b_train_test,-3,false)) assert(checkequality(rbm_medal.W,W_train_test,-3,false)) print("TODO") print("FIGURE OUT WHY THEY USE ") rbm_medal.numepochs = 5 rbm_medal = rbmtrain(rbm_medal,train_medal,train_medal) rbm_medal.toprbm = false rbm_medal.currentepoch = 1 rbm_medal.U = nil rbm_medal.dU = nil rbm_medal.d = nil rbm_medal.dd = nil rbm_medal.vd = nil rbm_medal.vU = nil rbm_medal = rbmtrain(rbm_medal,train_medal,train_medal) --uppass2 = rbmuppass(rbm_medal,train_medal) -- TEST UPPASS FUNCTION -- with usemaxpool uppass should be a factor of max_pool^2 smaller than the -- number of hidden units settings = {} settings.usemaxpool = true settings.vistype = 'binary' settings.filter_size = filter_size settings.n_filters = n_filters settings.n_classes = n_classes settings.input_size = input_size settings.pool_size = pool_size settings.toprbm = true rbm,opts,debug__ = setupconvrbm(settings,train_medal) rbm = rbmtrain(rbm,train_medal,train_medal) uppass1 = rbmuppass(rbm,train_medal) assert(uppass1:size(1) == train_medal.data:size(1)) assert(uppass1:size(3) == ( rbm.n_hidden / math.pow(pool_size,2)) ) settings.usemaxpool = false rbm,opts,debug__ = setupconvrbm(settings,train_medal) rbm = rbmtrain(rbm,train_medal,train_medal) uppass2 = rbmuppass(rbm,train_medal) assert(uppass2:size(1) == train_medal.data:size(1)) assert(uppass2:size(3) == rbm.n_hidden ) settings.toprbm = false settings.usemaxpool = true rbm,opts,debug__ = setupconvrbm(settings,train_medal) rbm = rbmtrain(rbm,train_medal,train_medal) uppass1 = rbmuppass(rbm,train_medal) assert(rbm.U == nil and rbm.dU == nil and rbm.vU == nil) assert(rbm.d == nil and rbm.dd == nil and rbm.vd == nil) assert(uppass1:size(1) == train_medal.data:size(1)) assert(uppass1:size(3) == ( rbm.n_hidden / math.pow(pool_size,2)) ) settings.toprbm = false settings.usemaxpool = false testopts = {} testopts.n_hidden = 1001231 rbm,opts,debug__ = setupconvrbm(settings,train_medal,testopts) rbm = rbmtrain(rbm,train_medal,train_medal) uppass2 = rbmuppass(rbm,train_medal) assert(rbm.U == nil and rbm.dU == nil and rbm.vU == nil) assert(rbm.d == nil and rbm.dd == nil and rbm.vd == nil) assert(uppass2:size(1) == train_medal.data:size(1)) assert(uppass2:size(3) == rbm.n_hidden ) print("TEST STACKING") trainstackconvtorbm(convsettings,convopts,toprbmopts,train,val) -- settings.usemaxpool = false -- rbm,opts,debug__ = setupconvrbm(settings,train_medal) -- rbm = rbmtrain(rbm,train_medal,train_medal) -- print("\n\n#########################TRAINING ON SMALL MNIST##############") -- torch.manualSeed(123) -- train_mnist,val_mnist,test_mnist = mnist.loadMnist(1000,false) -- print("TRAINING DATA:\n", train_mnist) -- filter_size =11 -- -- n_filters = 40 -- how many filters to use -- pool_size =2 -- how large the probabilistic maxpooling -- input_size = 28 -- the size of the input image -- n_classes = 10 -- n_input = 1 -- sizes_mnist = conv.calcconvsizes(filter_size,n_filters,n_classes,input_size,pool_size,train_mnist) -- print(sizes_mnist) -- --opts.n_hidden = 10 -- opts_mnist = {} -- conv.setupsettings(opts_mnist,sizes_mnist) -- --print(opts_mnist) -- --opts.W = W -- Testing weights -- --opts.U = torch.zeros(opts.U:size()) -- otherwise tests fails -- opts_mnist.numepochs = 100 -- rbm_mnist = rbmsetup(opts_mnist,train_mnist) -- vistype = 'binary' -- | 'gauss' -- debug_mnist = conv.setupfunctions(rbm_mnist,sizes_mnist,vistype) -- modofies RBM to use conv functions -- --gfx.image(train_mnist.data[{1,5,{}}]:resize(28,28), {zoom=2, legend=''}) -- rbm_mnist.learningrate = 0.001 -- rbm_mnist.L2 = 0.01 -- rbm_mnist.batchsize = 10 -- rbm_mnist.sparsity = 0.000 -- rbm_mnist.c:fill(-0.1) -- hidden bias as in honglak lee -- rbm_mnist.U:fill(0) -- print("#######->>>>>DATASETS COMPOSITIONS---<<<<<<<#########") -- print("train: ", torch.histc(train_mnist.labels,10):resize(1,10) ) -- print("val: ", torch.histc(val_mnist.labels,10):resize(1,10) ) -- print("test: ", torch.histc(test_mnist.labels,10):resize(1,10) ) -- print("######################################################") -- rbm_mnist = rbmtrain(rbm_mnist,train_mnist,val_mnist) --stat_gen = rbm_medal.generativestatistics(rbm_medal,x2d_mnist,y,tcwx)
local _M = {} -- 插件名称 _M.plugin_name = "api_router" -- 认证(auth)服务 域名 _M.auth_server_domain_name = "AUTH_SERVER_DOMAIN_NAME"; -- 认证(auth)服务给悟空配置的 app_id _M.auth_server_ngr_app_id = "AUTH_SERVER_NGR_APP_ID"; -- 认证(auth)服务给悟空配置的 app_key _M.auth_server_ngr_app_key = "AUTH_SERVER_NGR_APP_KEY"; -- group_context old all 缓存key _M.api_group_context_old_all_key = "API_GROUP_CONTEXT_AND_HOST_OLD_ALL"; -- group_context 缓存key _M.api_group_context_key = "API_GROUP_CONTEXT_AND_HOST"; _M.build_cache_group_context_key = function(append_key) return _M.api_group_context_key .. append_key end _M.auth_api={ login = "/app/login", -- 获取token get_login_info = "/app/getLoginInfo" -- 校验token ,目前就是获取用户信息 } -- error retries count _M.balance_retries_count_key = "BALANCE_RETRIES_COUNT" _M.balance_connection_timeout_key = "BALANCE_CONNECTION_TIMEOUT" _M.balance_send_timeout_key = "BALANCE_SEND_TIMEOUT" _M.balance_read_timeout_key = "BALANCE_READ_TIMEOUT" _M.small_error_types = { sys = { type_auth_conf_error = "api.auth_conf_error", type_auth_invoke_error = "api.auth_ivk_error", type_balancer_execute_error = "api.balancer_execute_error" }, biz = { type_service_not_found = "api.no_service", type_req_method_not_support = "api.med_not_support", type_token_error = "api.token_error", type_no_available_balancer = "api.no_available_balancer" } } return _M
--[[ desc: SearchMove, a Ai of search and move. author: Musoucrow since: 2018-5-14 alter: 2019-8-15 ]]-- local _ECSMGR = require("actor.ecsmgr") local _BATTLE = require("actor.service.battle") local _INPUT = require("actor.service.input") local _STATE = require("actor.service.state") local _Timer = require("util.gear.timer") local _Point = require("graphics.drawunit.point") local _Range = require("graphics.drawunit.range") local _Move = require("actor.ai.move") local _Base = require("actor.ai.base") local _list = _ECSMGR.NewComboList({ battle = true, transform = true }) ---@class Actor.Ai.SearchMove : Actor.Ai ---@field public searchRange Graphics.Drawunit.Range ---@field public moveRange Graphics.Drawunit.Range ---@field public intervalSection Graphics.Drawunit.Point ---@field public lockOn boolean ---@field public campType string ---@field public navigating boolean ---@field public camp int ---@field protected _target Graphics.Drawunit.Point ---@field protected _timer Util.Gear.Timer ---@field protected _moveAi Actor.Ai.Move ---@field protected _hasTarget boolean local _SearchMove = require("core.class")(_Base) ---@param entity Actor.Entity function _SearchMove.NewWithConfig(entity, data) return _SearchMove.New(entity, data.searchRange, data.moveRange, data.lockOn, data.interval, data.campType, data.camp) end ---@param entity Actor.Entity ---@param searchRange Graphics.Drawunit.Range ---@param moveRange Graphics.Drawunit.Range ---@param lockOn boolean ---@param intervalSection Graphics.Drawunit.Point ---@param campType string @all, same, enemy, else. default=enemy function _SearchMove:Ctor(entity, searchRange, moveRange, lockOn, intervalSection, campType, camp) _Base.Ctor(self, entity) self.searchRange = _Range.New(searchRange.xa, searchRange.xb, searchRange.ya, searchRange.yb) self.moveRange = _Range.New(moveRange.xa, moveRange.xb, moveRange.ya, moveRange.yb) self.intervalSection = _Point.New(true, intervalSection.x, intervalSection.y) self._timer = _Timer.New() self._target = _Point.New(true) self._moveAi = _Move.New(entity) self.lockOn = lockOn self.campType = campType or "enemy" self.camp = camp self._hasTarget = false self.navigating = false end function _SearchMove:Update(dt) if (not self:CanRun()) then return end self._timer:Update(dt) if (not self.navigating and not self._timer.isRunning) then self._timer:Enter(math.random(self.intervalSection.x, self.intervalSection.y)) local hasTarget, x, y = self:Select() self._hasTarget = hasTarget self._target:Set(x, y) local directionX = math.random(1, 2) == 1 and 1 or -1 local directionY = math.random(1, 2) == 1 and 1 or -1 x = x + math.random(self.moveRange.xa, self.moveRange.xb) * directionX y = y + math.random(self.moveRange.ya, self.moveRange.yb) * directionY self._moveAi:Tick(x, y) --return true end self:LockOn() self._moveAi:Update(dt) if (self.navigating and not self._moveAi:IsRunning()) then self.navigating = false end end function _SearchMove:LockOn() if (not self:CanRun() or not self._hasTarget or not self.lockOn) then return end local transform = self._entity.transform local direction = transform.position.x < self._target.x and 1 or -1 if (direction == transform.direction) then _INPUT.Press(self._entity.input, "lockOn") -- Press the key to lock direction, see also: actor/controlMove.lua end end function _SearchMove:Select() local camp = self.camp or self._entity.battle.camp local x, y = self._entity.transform.position:Get() if (self.campType ~= "") then for n=_list:GetLength(), 1, -1 do local e = _list:Get(n) ---@type Actor.Entity if (e.battle and self._entity ~= e and e.battle.banCountMap.hide == 0 and _BATTLE.CondCamp(camp, e.battle.camp, self.campType)) then local pos = e.transform.position if (self.searchRange:Collide(x, y, pos.x, pos.y)) then return true, pos:Get() end end end end return false, x, y end ---@param x int ---@param y int ---@param isOnly boolean ---@param lockOn boolean function _SearchMove:MoveTo(x, y, isOnly, lockOn) self._target:Set(x, y) self._moveAi:Tick(x, y) if (isOnly) then self._timer:Exit() self.navigating = true end self._hasTarget = lockOn or false end ---@return boolean function _SearchMove:IsMoving() return self._moveAi:IsRunning() end ---@param isReal boolean @moveAi's target ---@return int, int function _SearchMove:GetTarget(isReal) if (isReal) then return self._moveAi:GetTarget() end return self._target:Get() end ---@return boolean function _SearchMove:CanRun() local free = (self._entity.states and _STATE.HasTag(self._entity.states, "moveable")) or not self._entity.states return _Base.CanRun(self) and free end function _SearchMove:Reset() self.navigating = false self._timer:Exit() end return _SearchMove
#!/usr/bin/env tarantool test = require("sqltester") test:plan(3) --!./tcltestrunner.lua -- 2005 September 19 -- -- The author disclaims copyright to this source code. In place of -- a legal notice, here is a blessing: -- -- May you do good and not evil. -- May you find forgiveness for yourself and forgive others. -- May you share freely, never taking more than you give. -- ------------------------------------------------------------------------- -- This file implements regression tests for SQLite library. -- -- This file implements tests to verify that ticket #1449 has been -- fixed. -- -- ["set","testdir",[["file","dirname",["argv0"]]]] -- ["source",[["testdir"],"\/tester.tcl"]] -- Somewhere in tkt1449-1.1 is a VIEW definition that uses a subquery and -- a compound SELECT. So we cannot run this file if any of these features -- are not available. -- The following schema generated problems in ticket #1449. We've retained -- the original schema here because it is some unbelievably complex, it seemed -- like a good test case for SQLite. -- test:do_execsql_test( "tkt1449-1.1", [[ -- Tarantool: DDL is prohibited inside a transaction so far -- START TRANSACTION; CREATE TABLE ACLS(ISSUEID text(50) not null, OBJECTID text(50) not null, PARTICIPANTID text(50) not null, PERMISSIONBITS int not null, constraint PK_ACLS primary key (ISSUEID, OBJECTID, PARTICIPANTID)); CREATE TABLE ACTIONITEMSTATUSES(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, FRIENDLYNAME text(100) not null, REVISION int not null, SHORTNAME text(30) not null, LONGNAME text(200) not null, ATTACHMENTHANDLING int not null, RESULT int not null, NOTIFYCREATOR text(1) null, NOTIFYASSIGNEE text(1) null, NOTIFYFYI text(1) null, NOTIFYCLOSURETEAM text(1) null, NOTIFYCOORDINATORS text(1) null, COMMENTREQUIRED text(1) not null, constraint PK_ACTIONITEMSTATUSES primary key (ISSUEID, OBJECTID)); CREATE TABLE ACTIONITEMTYPES(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, REVISION int not null, LABEL text(200) not null, INSTRUCTIONS text not null, EMAILINSTRUCTIONS text null, ALLOWEDSTATUSES text not null, INITIALSTATUS text(100) not null, COMMENTREQUIRED text(1) not null, ATTACHMENTHANDLING int not null, constraint PK_ACTIONITEMTYPES primary key (ISSUEID, OBJECTID)); CREATE TABLE ATTACHMENTS(TQUNID text(36) not null, OBJECTID text(50) null, ISSUEID text(50) null, DATASTREAM blob not null, CONTENTENCODING text(50) null, CONTENTCHARSET text(50) null, CONTENTTYPE text(100) null, CONTENTID text(100) null, CONTENTLOCATION text(100) null, CONTENTNAME text(100) not null, constraint PK_ATTACHMENTS primary key (TQUNID)); CREATE TABLE COMPLIANCEPOLICIES(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, BODY text null, constraint PK_COMPLIANCEPOLICIES primary key (ISSUEID, OBJECTID)); CREATE TABLE DBHISTORY(id primary key, DATETIME text(25) not null, OPERATION text(20) not null, KUBIVERSION text(100) not null, FROMVERSION int null, TOVERSION int null); CREATE TABLE DBINFO(id primary key, FINGERPRINT text(32) not null, VERSION int not null); CREATE TABLE DETACHEDATTACHMENTS (TQUNID text(36) not null, ISSUEID text(50) not null, OBJECTID text(50) not null, PATH text(300) not null, DETACHEDFILELASTMODTIMESTAMP text(25) null, CONTENTID text(100) not null, constraint PK_DETACHEDATTACHMENTS primary key (TQUNID)); CREATE TABLE DOCREFERENCES(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, REFERENCEDOCUMENTID text(50) null, constraint PK_DOCREFERENCES primary key (ISSUEID, OBJECTID)); CREATE TABLE DQ (TQUNID text(36) not null, ISSUEID text(50) not null, DEPENDSID text(50) null, DEPENDSTYPE int null, DEPENDSCOMMANDSTREAM blob null, DEPENDSNODEIDSEQNOKEY text(100) null, DEPENDSACLVERSION int null, constraint PK_DQ primary key (TQUNID)); CREATE TABLE EMAILQ(id primary key, TIMEQUEUED int not null, NODEID text(50) not null, MIME blob not null, TQUNID text(36) not null); CREATE TABLE ENTERPRISEDATA(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, DATE1 text(25) null, DATE2 text(25) null, DATE3 text(25) null, DATE4 text(25) null, DATE5 text(25) null, DATE6 text(25) null, DATE7 text(25) null, DATE8 text(25) null, DATE9 text(25) null, DATE10 text(25) null, VALUE1 int null, VALUE2 int null, VALUE3 int null, VALUE4 int null, VALUE5 int null, VALUE6 int null, VALUE7 int null, VALUE8 int null, VALUE9 int null, VALUE10 int null, VALUE11 int null, VALUE12 int null, VALUE13 int null, VALUE14 int null, VALUE15 int null, VALUE16 int null, VALUE17 int null, VALUE18 int null, VALUE19 int null, VALUE20 int null, STRING1 text(300) null, STRING2 text(300) null, STRING3 text(300) null, STRING4 text(300) null, STRING5 text(300) null, STRING6 text(300) null, STRING7 text(300) null, STRING8 text(300) null, STRING9 text(300) null, STRING10 text(300) null, LONGSTRING1 text null, LONGSTRING2 text null, LONGSTRING3 text null, LONGSTRING4 text null, LONGSTRING5 text null, LONGSTRING6 text null, LONGSTRING7 text null, LONGSTRING8 text null, LONGSTRING9 text null, LONGSTRING10 text null, constraint PK_ENTERPRISEDATA primary key (ISSUEID, OBJECTID)); CREATE TABLE FILEMORGUE(TQUNID text(36) not null, PATH text(300) not null, DELETEFOLDERWHENEMPTY text(1) null, constraint PK_FILEMORGUE primary key (TQUNID)); CREATE TABLE FILES(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, PARENTENTITYID text(50) null, BODY text null, BODYCONTENTTYPE text(100) null, ISOBSOLETE text(1) null, FILENAME text(300) not null, VISIBLENAME text(300) not null, VERSIONSTRING text(300) not null, DOCUMENTHASH text(40) not null, ISFINAL text(1) null, DOCREFERENCEID text(50) not null, constraint PK_FILES primary key (ISSUEID, OBJECTID)); CREATE TABLE FOLDERS(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, CONTAINERNAME text(300) null, CONTAINERACLSETTINGS text null, constraint PK_FOLDERS primary key (ISSUEID, OBJECTID)); CREATE TABLE GLOBALSETTINGS(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, SINGULARPROJECTLABEL text(30) not null, PLURALPROJECTLABEL text(30) not null, PROJECTREQUIRED text(1) not null, CUSTOMPROJECTSALLOWED text(1) not null, ACTIONITEMSPECXML text null, PROJECTLISTXML text null, ENTERPRISEDATALABELS text null, ENTERPRISEDATATABXSL text null, constraint PK_GLOBALSETTINGS primary key (ISSUEID, OBJECTID)); CREATE TABLE GLOBALSTRINGPROPERTIES(ID int not null, VALUE text(300) not null, constraint PK_GLOBALSTRINGPROPERTIES primary key (ID)); CREATE TABLE IMQ(TQUNID text(36) not null, DATETIMEQUEUED text(25) not null, ISSUEID text(50) not null, KUBIBUILD text(30) not null, FAILCOUNT int not null, LASTRUN text(25) null, ENVELOPESTREAM blob not null, PAYLOADSTREAM blob not null, constraint PK_IMQ primary key (TQUNID)); CREATE TABLE INVITATIONNODES(INVITATIONID text(50) not null, RECIPIENTNODEID text(50) not null, DATECREATED text(25) not null, constraint PK_INVITATIONNODES primary key (INVITATIONID, RECIPIENTNODEID)); CREATE TABLE INVITATIONS (id primary key, INVITATIONID text(50) not null, SENDERNODEID text(50) not null, RECIPIENTEMAILADDR text(200) not null, RECIPIENTUSERID text(50) null, RECIPIENTNODES text null, ISSUEID text(50) not null, ENVELOPE text not null, MESSAGEBLOB blob not null, INVITATIONSTATE int not null, TQUNID text(36) not null, DATECREATED text(25) not null); CREATE TABLE ISSUES (CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, CONTAINERNAME text(300) null, CONTAINERACLSETTINGS text null, ISINITIALIZED text(1) null, BLINDINVITES text null, ISSYSTEMISSUE text(1) not null, ISSUETYPE int not null, ACTIVITYTYPEID text(50) null, ISINCOMPLETE text(1) not null, constraint PK_ISSUES primary key (ISSUEID, OBJECTID)); CREATE TABLE ISSUESETTINGS (CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, ISSUENAME text(300) not null, ISSUEACLSETTINGS text not null, ISSUEDUEDATE text(25) null, ISSUEPRIORITY int null, ISSUESTATUS int null, DESCRIPTION text null, PROJECTID text(100) null, PROJECTNAME text null, PROJECTNAMEISCUSTOM text(1) null, ISSYSTEMISSUE text(1) not null, ACTIONITEMREVNUM int not null, constraint PK_ISSUESETTINGS primary key (ISSUEID, OBJECTID)); CREATE TABLE KMTPMSG (MSGID integer not null, SENDERID text(50) null, RECIPIENTIDLIST text not null, ISSUEID text(50) null, MESSAGETYPE int not null, ENVELOPE text null, MESSAGEBLOB blob not null, RECEIVEDDATE text(25) not null, constraint PK_KMTPMSG primary key (MSGID)); CREATE TABLE KMTPNODEQ(id primary key, NODEID text(50) not null, MSGID int not null, RECEIVEDDATE text(25) not null, SENDCOUNT int not null); CREATE TABLE KMTPQ(MSGID integer not null, SENDERID text(50) null, RECIPIENTIDLIST text not null, ISSUEID text(50) null, MESSAGETYPE int not null, ENVELOPE text null, MESSAGEBLOB blob not null, constraint PK_KMTPQ primary key (MSGID)); CREATE TABLE LOGENTRIES(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, PARENTENTITYID text(50) null, BODY text null, BODYCONTENTTYPE text(100) null, ISOBSOLETE text(1) null, ACTIONTYPE int not null, ASSOCIATEDOBJECTIDS text null, OLDENTITIES text null, NEWENTITIES text null, OTHERENTITIES text null, constraint PK_LOGENTRIES primary key (ISSUEID, OBJECTID)); CREATE TABLE LSBI(TQUNID text(36) not null, ISSUEID text(50) not null, TABLEITEMID text(50) null, TABLENODEID text(50) null, TABLECMD int null, TABLECONTAINERID text(50) null, TABLESEQNO int null, DIRTYCONTENT text null, STUBBED text(1) null, ENTITYSTUBDATA text null, UPDATENUMBER int not null, constraint PK_LSBI primary key (TQUNID)); CREATE TABLE LSBN(TQUNID text(36) not null, ISSUEID text(50) not null, NODEID text(50) not null, STORESEQNO int not null, SYNCSEQNO int not null, LASTMSGDATE text(25) null, constraint PK_LSBN primary key (TQUNID)); CREATE TABLE MMQ(TQUNID text(36) not null, ISSUEID text(50) not null, TABLEREQUESTNODE text(50) null, MMQENTRYINDEX text(60) null, DIRECTION int null, NODEID text(50) null, TABLEFIRSTSEQNO int null, TABLELASTSEQNO int null, NEXTRESENDTIMEOUT text(25) null, TABLETIMEOUTMULTIPLIER int null, constraint PK_MMQ primary key (TQUNID)); CREATE TABLE NODEREG(id primary key, NODEID text(50) not null, USERID text(50) null, CREATETIME text(25) not null, TQUNID text(36) not null); CREATE TABLE NODES (id primary key, NODEID text(50) not null, USERID text(50) null, NODESTATE int not null, NODECERT text null, KUBIVERSION int not null, KUBIBUILD text(30) not null, TQUNID text(36) not null, LASTBINDDATE text(25) null, LASTUNBINDDATE text(25) null, LASTBINDIP text(15) null, NUMBINDS int not null, NUMSENDS int not null, NUMPOLLS int not null, NUMRECVS int not null); CREATE TABLE PARTICIPANTNODES(id primary key, ISSUEID text(50) not null, OBJECTID text(50) not null, NODEID text(50) not null, USERID text(50) null, NODESTATE int not null, NODECERT text null, KUBIVERSION int not null, KUBIBUILD text(30) not null, TQUNID text(36) not null); CREATE TABLE PARTICIPANTS(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, PARTICIPANTSTATE int not null, PARTICIPANTROLE int not null, PARTICIPANTTEAM int not null, ISREQUIREDMEMBER text(1) null, USERID text(50) null, ISAGENT text(1) null, NAME text(150) not null, EMAILADDRESS text(200) not null, ISEMAILONLY text(1) not null, INVITATION text null, ACCEPTRESENDCOUNT int null, ACCEPTRESENDTIMEOUT text(25) null, ACCEPTLASTSENTTONODEID text(50) null, constraint PK_PARTICIPANTS primary key (ISSUEID, OBJECTID)); CREATE TABLE PARTICIPANTSETTINGS(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, PARTICIPANTID text(50) not null, TASKPIMSYNC text(1) null, MOBILESUPPORT text(1) null, NOTIFYBYEMAIL text(1) null, MARKEDCRITICAL text(1) null, constraint PK_PARTICIPANTSETTINGS primary key (ISSUEID, OBJECTID)); CREATE TABLE PARTITIONS(id primary key, PARTITIONID text(50) not null, NAME text(100) not null, LDAPDN text(300) not null, SERVERNODEID text(50) not null, TQUNID text(36) not null); CREATE TABLE PROJECTS(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, NAME text(100) not null, ID text(100) null, constraint PK_PROJECTS primary key (ISSUEID, OBJECTID)); CREATE TABLE TASKCOMPLETIONS(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, PARENTENTITYID text(50) null, BODY text null, BODYCONTENTTYPE text(100) null, ISOBSOLETE text(1) null, TASKID text(50) not null, DISPOSITION int not null, STATUSID text(50) not null, SHORTNAME text(30) not null, LONGNAME text(200) not null, constraint PK_TASKCOMPLETIONS primary key (ISSUEID, OBJECTID)); CREATE TABLE TASKS(CLASSID int null, SEQNO int not null, LASTMODONNODEID text(50) not null, PREVMODONNODEID text(50) null, ISSUEID text(50) not null, OBJECTID text(50) not null, REVISIONNUM int not null, CONTAINERID text(50) not null, AUTHORID text(50) not null, CREATIONDATE text(25) null, LASTMODIFIEDDATE text(25) null, UPDATENUMBER int null, PREVREVISIONNUM int null, LASTCMD int null, LASTCMDACLVERSION int null, USERDEFINEDFIELD text(300) null, LASTMODIFIEDBYID text(50) null, PARENTENTITYID text(50) null, BODY text null, BODYCONTENTTYPE text(100) null, ISOBSOLETE text(1) null, DUETIME text(25) null, ASSIGNEDTO text(50) not null, TARGETOBJECTIDS text null, RESPONSEID text(50) not null, TYPEID text(50) not null, LABEL text(200) not null, INSTRUCTIONS text not null, ALLOWEDSTATUSES text not null, ISSERIALREVIEW text(1) null, DAYSTOREVIEW int null, REVIEWERIDS text(500) null, REVIEWTYPE int null, REVIEWGROUP text(300) null, constraint PK_TASKS primary key (ISSUEID, OBJECTID)); CREATE TABLE USERS (id primary key, USERID text(50) not null, USERSID text(100) not null, ENTERPRISEUSER text(1) not null, USEREMAILADDRESS text(200) null, EMAILVALIDATED text(1) null, VALIDATIONCOOKIE text(50) null, CREATETIME text(25) not null, TQUNID text(36) not null, PARTITIONID text(50) null); CREATE VIEW CRITICALISSUES as select USERID, ISSUEID, ISSUENAME, min(DATE1) DATE1 from ( select p.USERID USERID, p.ISSUEID ISSUEID, iset.ISSUENAME ISSUENAME, t.DUETIME DATE1 from PARTICIPANTS p join TASKS t on t.ASSIGNEDTO = p.OBJECTID join TASKCOMPLETIONS tc on tc.TASKID = t.OBJECTID join ISSUESETTINGS iset on iset.ISSUEID = p.ISSUEID where (t.ISOBSOLETE = 'n' or t.ISOBSOLETE is null) and tc.DISPOSITION = 1 and iset.ISSUESTATUS = 1 union select p.USERID USERID, p.ISSUEID ISSUEID, iset.ISSUENAME ISSUENAME, iset.ISSUEDUEDATE DATE1 from PARTICIPANTS p join PARTICIPANTSETTINGS ps on ps.PARTICIPANTID = p.OBJECTID join ISSUESETTINGS iset on iset.ISSUEID = p.ISSUEID where ps.MARKEDCRITICAL = 'y' and iset.ISSUESTATUS = 1 ) as CRITICALDATA group by USERID, ISSUEID, ISSUENAME; CREATE VIEW CURRENTFILES as select d.ISSUEID as ISSUEID, d.REFERENCEDOCUMENTID as OBJECTID, f.VISIBLENAME as VISIBLENAME from DOCREFERENCES d join FILES f on f.OBJECTID = d.REFERENCEDOCUMENTID; CREATE VIEW ISSUEDATA as select ISSUES.OBJECTID as ISSUEID, ISSUES.CREATIONDATE as CREATIONDATE, ISSUES.AUTHORID as AUTHORID, ISSUES.LASTMODIFIEDDATE as LASTMODIFIEDDATE, ISSUES.LASTMODIFIEDBYID as LASTMODIFIEDBYID, ISSUESETTINGS.ISSUENAME as ISSUENAME, ISSUES.ISINITIALIZED as ISINITIALIZED, ISSUES.ISSYSTEMISSUE as ISSYSTEMISSUE, ISSUES.ISSUETYPE as ISSUETYPE, ISSUES.ISINCOMPLETE as ISINCOMPLETE, ISSUESETTINGS.REVISIONNUM as ISSUESETTINGS_REVISIONNUM, ISSUESETTINGS.LASTMODIFIEDDATE as ISSUESETTINGS_LASTMODIFIEDDATE, ISSUESETTINGS.LASTMODIFIEDBYID as ISSUESETTINGS_LASTMODIFIEDBYID, ISSUESETTINGS.ISSUEDUEDATE as ISSUEDUEDATE, ISSUESETTINGS.ISSUEPRIORITY as ISSUEPRIORITY, ISSUESETTINGS.ISSUESTATUS as ISSUESTATUS, ISSUESETTINGS.DESCRIPTION as DESCRIPTION, ISSUESETTINGS.PROJECTID as PROJECTID, ISSUESETTINGS.PROJECTNAME as PROJECTNAME, ISSUESETTINGS.PROJECTNAMEISCUSTOM as PROJECTNAMEISCUSTOM, ENTERPRISEDATA.REVISIONNUM as ENTERPRISEDATA_REVISIONNUM, ENTERPRISEDATA.CREATIONDATE as ENTERPRISEDATA_CREATIONDATE, ENTERPRISEDATA.AUTHORID as ENTERPRISEDATA_AUTHORID, ENTERPRISEDATA.LASTMODIFIEDDATE as ENTERPRISEDATA_LASTMODIFIEDDATE, ENTERPRISEDATA.LASTMODIFIEDBYID as ENTERPRISEDATA_LASTMODIFIEDBYID, ENTERPRISEDATA.DATE1 as DATE1, ENTERPRISEDATA.DATE2 as DATE2, ENTERPRISEDATA.DATE3 as DATE3, ENTERPRISEDATA.DATE4 as DATE4, ENTERPRISEDATA.DATE5 as DATE5, ENTERPRISEDATA.DATE6 as DATE6, ENTERPRISEDATA.DATE7 as DATE7, ENTERPRISEDATA.DATE8 as DATE8, ENTERPRISEDATA.DATE9 as DATE9, ENTERPRISEDATA.DATE10 as DATE10, ENTERPRISEDATA.VALUE1 as VALUE1, ENTERPRISEDATA.VALUE2 as VALUE2, ENTERPRISEDATA.VALUE3 as VALUE3, ENTERPRISEDATA.VALUE4 as VALUE4, ENTERPRISEDATA.VALUE5 as VALUE5, ENTERPRISEDATA.VALUE6 as VALUE6, ENTERPRISEDATA.VALUE7 as VALUE7, ENTERPRISEDATA.VALUE8 as VALUE8, ENTERPRISEDATA.VALUE9 as VALUE9, ENTERPRISEDATA.VALUE10 as VALUE10, ENTERPRISEDATA.VALUE11 as VALUE11, ENTERPRISEDATA.VALUE12 as VALUE12, ENTERPRISEDATA.VALUE13 as VALUE13, ENTERPRISEDATA.VALUE14 as VALUE14, ENTERPRISEDATA.VALUE15 as VALUE15, ENTERPRISEDATA.VALUE16 as VALUE16, ENTERPRISEDATA.VALUE17 as VALUE17, ENTERPRISEDATA.VALUE18 as VALUE18, ENTERPRISEDATA.VALUE19 as VALUE19, ENTERPRISEDATA.VALUE20 as VALUE20, ENTERPRISEDATA.STRING1 as STRING1, ENTERPRISEDATA.STRING2 as STRING2, ENTERPRISEDATA.STRING3 as STRING3, ENTERPRISEDATA.STRING4 as STRING4, ENTERPRISEDATA.STRING5 as STRING5, ENTERPRISEDATA.STRING6 as STRING6, ENTERPRISEDATA.STRING7 as STRING7, ENTERPRISEDATA.STRING8 as STRING8, ENTERPRISEDATA.STRING9 as STRING9, ENTERPRISEDATA.STRING10 as STRING10, ENTERPRISEDATA.LONGSTRING1 as LONGSTRING1, ENTERPRISEDATA.LONGSTRING2 as LONGSTRING2, ENTERPRISEDATA.LONGSTRING3 as LONGSTRING3, ENTERPRISEDATA.LONGSTRING4 as LONGSTRING4, ENTERPRISEDATA.LONGSTRING5 as LONGSTRING5, ENTERPRISEDATA.LONGSTRING6 as LONGSTRING6, ENTERPRISEDATA.LONGSTRING7 as LONGSTRING7, ENTERPRISEDATA.LONGSTRING8 as LONGSTRING8, ENTERPRISEDATA.LONGSTRING9 as LONGSTRING9, ENTERPRISEDATA.LONGSTRING10 as LONGSTRING10 from ISSUES join ISSUESETTINGS on ISSUES.OBJECTID = ISSUESETTINGS.ISSUEID left outer join ENTERPRISEDATA on ISSUES.OBJECTID = ENTERPRISEDATA.ISSUEID; CREATE VIEW ITEMS as select 'FILES' as TABLENAME, CLASSID, SEQNO, LASTMODONNODEID, PREVMODONNODEID, ISSUEID, OBJECTID, REVISIONNUM, CONTAINERID, AUTHORID, CREATIONDATE, LASTMODIFIEDDATE, UPDATENUMBER, PREVREVISIONNUM, LASTCMD, LASTCMDACLVERSION, USERDEFINEDFIELD, LASTMODIFIEDBYID, PARENTENTITYID, BODY, BODYCONTENTTYPE, ISOBSOLETE, FILENAME, VISIBLENAME, VERSIONSTRING, DOCUMENTHASH, ISFINAL, DOCREFERENCEID, NULL as ACTIONTYPE, NULL as ASSOCIATEDOBJECTIDS, NULL as OLDENTITIES, NULL as NEWENTITIES, NULL as OTHERENTITIES, NULL as TQUNID, NULL as TABLEITEMID, NULL as TABLENODEID, NULL as TABLECMD, NULL as TABLECONTAINERID, NULL as TABLESEQNO, NULL as DIRTYCONTENT, NULL as STUBBED, NULL as ENTITYSTUBDATA, NULL as PARTICIPANTSTATE, NULL as PARTICIPANTROLE, NULL as PARTICIPANTTEAM, NULL as ISREQUIREDMEMBER, NULL as USERID, NULL as ISAGENT, NULL as NAME, NULL as EMAILADDRESS, NULL as ISEMAILONLY, NULL as INVITATION, NULL as ACCEPTRESENDCOUNT, NULL as ACCEPTRESENDTIMEOUT, NULL as ACCEPTLASTSENTTONODEID, NULL as TASKID, NULL as DISPOSITION, NULL as STATUSID, NULL as SHORTNAME, NULL as LONGNAME, NULL as DUETIME, NULL as ASSIGNEDTO, NULL as TARGETOBJECTIDS, NULL as RESPONSEID, NULL as TYPEID, NULL as LABEL, NULL as INSTRUCTIONS, NULL as ALLOWEDSTATUSES, NULL as ISSERIALREVIEW, NULL as DAYSTOREVIEW, NULL as REVIEWERIDS, NULL as REVIEWTYPE, NULL as REVIEWGROUP from FILES union all select 'LOGENTRIES' as TABLENAME, CLASSID, SEQNO, LASTMODONNODEID, PREVMODONNODEID, ISSUEID, OBJECTID, REVISIONNUM, CONTAINERID, AUTHORID, CREATIONDATE, LASTMODIFIEDDATE, UPDATENUMBER, PREVREVISIONNUM, LASTCMD, LASTCMDACLVERSION, USERDEFINEDFIELD, LASTMODIFIEDBYID, PARENTENTITYID, BODY, BODYCONTENTTYPE, ISOBSOLETE, NULL as FILENAME, NULL as VISIBLENAME, NULL as VERSIONSTRING, NULL as DOCUMENTHASH, NULL as ISFINAL, NULL as DOCREFERENCEID, ACTIONTYPE, ASSOCIATEDOBJECTIDS, OLDENTITIES, NEWENTITIES, OTHERENTITIES, NULL as TQUNID, NULL as TABLEITEMID, NULL as TABLENODEID, NULL as TABLECMD, NULL as TABLECONTAINERID, NULL as TABLESEQNO, NULL as DIRTYCONTENT, NULL as STUBBED, NULL as ENTITYSTUBDATA, NULL as PARTICIPANTSTATE, NULL as PARTICIPANTROLE, NULL as PARTICIPANTTEAM, NULL as ISREQUIREDMEMBER, NULL as USERID, NULL as ISAGENT, NULL as NAME, NULL as EMAILADDRESS, NULL as ISEMAILONLY, NULL as INVITATION, NULL as ACCEPTRESENDCOUNT, NULL as ACCEPTRESENDTIMEOUT, NULL as ACCEPTLASTSENTTONODEID, NULL as TASKID, NULL as DISPOSITION, NULL as STATUSID, NULL as SHORTNAME, NULL as LONGNAME, NULL as DUETIME, NULL as ASSIGNEDTO, NULL as TARGETOBJECTIDS, NULL as RESPONSEID, NULL as TYPEID, NULL as LABEL, NULL as INSTRUCTIONS, NULL as ALLOWEDSTATUSES, NULL as ISSERIALREVIEW, NULL as DAYSTOREVIEW, NULL as REVIEWERIDS, NULL as REVIEWTYPE, NULL as REVIEWGROUP from LOGENTRIES union all select 'LSBI' as TABLENAME, NULL as CLASSID, NULL as SEQNO, NULL as LASTMODONNODEID, NULL as PREVMODONNODEID, ISSUEID, NULL as OBJECTID, NULL as REVISIONNUM, NULL as CONTAINERID, NULL as AUTHORID, NULL as CREATIONDATE, NULL as LASTMODIFIEDDATE, UPDATENUMBER, NULL as PREVREVISIONNUM, NULL as LASTCMD, NULL as LASTCMDACLVERSION, NULL as USERDEFINEDFIELD, NULL as LASTMODIFIEDBYID, NULL as PARENTENTITYID, NULL as BODY, NULL as BODYCONTENTTYPE, NULL as ISOBSOLETE, NULL as FILENAME, NULL as VISIBLENAME, NULL as VERSIONSTRING, NULL as DOCUMENTHASH, NULL as ISFINAL, NULL as DOCREFERENCEID, NULL as ACTIONTYPE, NULL as ASSOCIATEDOBJECTIDS, NULL as OLDENTITIES, NULL as NEWENTITIES, NULL as OTHERENTITIES, TQUNID, TABLEITEMID, TABLENODEID, TABLECMD, TABLECONTAINERID, TABLESEQNO, DIRTYCONTENT, STUBBED, ENTITYSTUBDATA, NULL as PARTICIPANTSTATE, NULL as PARTICIPANTROLE, NULL as PARTICIPANTTEAM, NULL as ISREQUIREDMEMBER, NULL as USERID, NULL as ISAGENT, NULL as NAME, NULL as EMAILADDRESS, NULL as ISEMAILONLY, NULL as INVITATION, NULL as ACCEPTRESENDCOUNT, NULL as ACCEPTRESENDTIMEOUT, NULL as ACCEPTLASTSENTTONODEID, NULL as TASKID, NULL as DISPOSITION, NULL as STATUSID, NULL as SHORTNAME, NULL as LONGNAME, NULL as DUETIME, NULL as ASSIGNEDTO, NULL as TARGETOBJECTIDS, NULL as RESPONSEID, NULL as TYPEID, NULL as LABEL, NULL as INSTRUCTIONS, NULL as ALLOWEDSTATUSES, NULL as ISSERIALREVIEW, NULL as DAYSTOREVIEW, NULL as REVIEWERIDS, NULL as REVIEWTYPE, NULL as REVIEWGROUP from LSBI where TABLECMD=3 union all select 'PARTICIPANTS' as TABLENAME, CLASSID, SEQNO, LASTMODONNODEID, PREVMODONNODEID, ISSUEID, OBJECTID, REVISIONNUM, CONTAINERID, AUTHORID, CREATIONDATE, LASTMODIFIEDDATE, UPDATENUMBER, PREVREVISIONNUM, LASTCMD, LASTCMDACLVERSION, USERDEFINEDFIELD, LASTMODIFIEDBYID, NULL as PARENTENTITYID, NULL as BODY, NULL as BODYCONTENTTYPE, NULL as ISOBSOLETE, NULL as FILENAME, NULL as VISIBLENAME, NULL as VERSIONSTRING, NULL as DOCUMENTHASH, NULL as ISFINAL, NULL as DOCREFERENCEID, NULL as ACTIONTYPE, NULL as ASSOCIATEDOBJECTIDS, NULL as OLDENTITIES, NULL as NEWENTITIES, NULL as OTHERENTITIES, NULL as TQUNID, NULL as TABLEITEMID, NULL as TABLENODEID, NULL as TABLECMD, NULL as TABLECONTAINERID, NULL as TABLESEQNO, NULL as DIRTYCONTENT, NULL as STUBBED, NULL as ENTITYSTUBDATA, PARTICIPANTSTATE, PARTICIPANTROLE, PARTICIPANTTEAM, ISREQUIREDMEMBER, USERID, ISAGENT, NAME, EMAILADDRESS, ISEMAILONLY, INVITATION, ACCEPTRESENDCOUNT, ACCEPTRESENDTIMEOUT, ACCEPTLASTSENTTONODEID, NULL as TASKID, NULL as DISPOSITION, NULL as STATUSID, NULL as SHORTNAME, NULL as LONGNAME, NULL as DUETIME, NULL as ASSIGNEDTO, NULL as TARGETOBJECTIDS, NULL as RESPONSEID, NULL as TYPEID, NULL as LABEL, NULL as INSTRUCTIONS, NULL as ALLOWEDSTATUSES, NULL as ISSERIALREVIEW, NULL as DAYSTOREVIEW, NULL as REVIEWERIDS, NULL as REVIEWTYPE, NULL as REVIEWGROUP from PARTICIPANTS union all select 'TASKCOMPLETIONS' as TABLENAME, CLASSID, SEQNO, LASTMODONNODEID, PREVMODONNODEID, ISSUEID, OBJECTID, REVISIONNUM, CONTAINERID, AUTHORID, CREATIONDATE, LASTMODIFIEDDATE, UPDATENUMBER, PREVREVISIONNUM, LASTCMD, LASTCMDACLVERSION, USERDEFINEDFIELD, LASTMODIFIEDBYID, PARENTENTITYID, BODY, BODYCONTENTTYPE, ISOBSOLETE, NULL as FILENAME, NULL as VISIBLENAME, NULL as VERSIONSTRING, NULL as DOCUMENTHASH, NULL as ISFINAL, NULL as DOCREFERENCEID, NULL as ACTIONTYPE, NULL as ASSOCIATEDOBJECTIDS, NULL as OLDENTITIES, NULL as NEWENTITIES, NULL as OTHERENTITIES, NULL as TQUNID, NULL as TABLEITEMID, NULL as TABLENODEID, NULL as TABLECMD, NULL as TABLECONTAINERID, NULL as TABLESEQNO, NULL as DIRTYCONTENT, NULL as STUBBED, NULL as ENTITYSTUBDATA, NULL as PARTICIPANTSTATE, NULL as PARTICIPANTROLE, NULL as PARTICIPANTTEAM, NULL as ISREQUIREDMEMBER, NULL as USERID, NULL as ISAGENT, NULL as NAME, NULL as EMAILADDRESS, NULL as ISEMAILONLY, NULL as INVITATION, NULL as ACCEPTRESENDCOUNT, NULL as ACCEPTRESENDTIMEOUT, NULL as ACCEPTLASTSENTTONODEID, TASKID, DISPOSITION, STATUSID, SHORTNAME, LONGNAME, NULL as DUETIME, NULL as ASSIGNEDTO, NULL as TARGETOBJECTIDS, NULL as RESPONSEID, NULL as TYPEID, NULL as LABEL, NULL as INSTRUCTIONS, NULL as ALLOWEDSTATUSES, NULL as ISSERIALREVIEW, NULL as DAYSTOREVIEW, NULL as REVIEWERIDS, NULL as REVIEWTYPE, NULL as REVIEWGROUP from TASKCOMPLETIONS union all select 'TASKS' as TABLENAME, CLASSID, SEQNO, LASTMODONNODEID, PREVMODONNODEID, ISSUEID, OBJECTID, REVISIONNUM, CONTAINERID, AUTHORID, CREATIONDATE, LASTMODIFIEDDATE, UPDATENUMBER, PREVREVISIONNUM, LASTCMD, LASTCMDACLVERSION, USERDEFINEDFIELD, LASTMODIFIEDBYID, PARENTENTITYID, BODY, BODYCONTENTTYPE, ISOBSOLETE, NULL as FILENAME, NULL as VISIBLENAME, NULL as VERSIONSTRING, NULL as DOCUMENTHASH, NULL as ISFINAL, NULL as DOCREFERENCEID, NULL as ACTIONTYPE, NULL as ASSOCIATEDOBJECTIDS, NULL as OLDENTITIES, NULL as NEWENTITIES, NULL as OTHERENTITIES, NULL as TQUNID, NULL as TABLEITEMID, NULL as TABLENODEID, NULL as TABLECMD, NULL as TABLECONTAINERID, NULL as TABLESEQNO, NULL as DIRTYCONTENT, NULL as STUBBED, NULL as ENTITYSTUBDATA, NULL as PARTICIPANTSTATE, NULL as PARTICIPANTROLE, NULL as PARTICIPANTTEAM, NULL as ISREQUIREDMEMBER, NULL as USERID, NULL as ISAGENT, NULL as NAME, NULL as EMAILADDRESS, NULL as ISEMAILONLY, NULL as INVITATION, NULL as ACCEPTRESENDCOUNT, NULL as ACCEPTRESENDTIMEOUT, NULL as ACCEPTLASTSENTTONODEID, NULL as TASKID, NULL as DISPOSITION, NULL as STATUSID, NULL as SHORTNAME, NULL as LONGNAME, DUETIME, ASSIGNEDTO, TARGETOBJECTIDS, RESPONSEID, TYPEID, LABEL, INSTRUCTIONS, ALLOWEDSTATUSES, ISSERIALREVIEW, DAYSTOREVIEW, REVIEWERIDS, REVIEWTYPE, REVIEWGROUP from TASKS; CREATE VIEW TASKINFO as select t.ISSUEID as ISSUEID, t.OBJECTID as OBJECTID, t.ASSIGNEDTO as ASSIGNEDTO, t.TARGETOBJECTIDS as TARGETOBJECTIDS, t.DUETIME as DUETIME, t.ISOBSOLETE as ISOBSOLETE, tc.DISPOSITION as DISPOSITION from TASKS t join TASKCOMPLETIONS tc on tc.TASKID = t.OBJECTID; CREATE INDEX DQ_ISSUEID_DEPENDSID on DQ (ISSUEID, DEPENDSID); CREATE INDEX EMAILQ_TIMEQUEUED on EMAILQ (TIMEQUEUED); CREATE INDEX FOLDERS_CONTAINERID_ISSUEID on FOLDERS (CONTAINERID, ISSUEID); CREATE INDEX IMQ_DATETIMEQUEUED on IMQ (DATETIMEQUEUED); CREATE INDEX INVITATIONS_RECIPIENTUSERID_INVITATIONID on INVITATIONS (RECIPIENTUSERID, INVITATIONID); CREATE INDEX INVITATIONS_TQUNID on INVITATIONS (TQUNID); CREATE INDEX ISSUESETTINGS_CONTAINERID on ISSUESETTINGS (CONTAINERID); CREATE INDEX KMTPMSG_RECEIVEDDATE on KMTPMSG (RECEIVEDDATE desc); CREATE INDEX KMTPNODEQ_MSGID on KMTPNODEQ (MSGID); CREATE INDEX KMTPNODEQ_NODEID_MSGID on KMTPNODEQ (NODEID, MSGID); CREATE INDEX KMTPNODEQ_RECEIVEDDATE on KMTPNODEQ (RECEIVEDDATE desc); CREATE INDEX LSBI_ISSUEID_TABLEITEMID on LSBI (ISSUEID, TABLEITEMID); CREATE INDEX LSBN_ISSUEID_NODEID on LSBN (ISSUEID, NODEID); CREATE INDEX MMQ_ISSUEID_MMQENTRYINDEX on MMQ (ISSUEID, MMQENTRYINDEX); CREATE INDEX NODEREG_NODEID_USERID on NODEREG (NODEID, USERID); CREATE INDEX NODEREG_TQUNID on NODEREG (TQUNID); CREATE INDEX NODEREG_USERID_NODEID on NODEREG (USERID, NODEID); CREATE INDEX NODES_NODEID on NODES (NODEID); CREATE INDEX NODES_TQUNID on NODES (TQUNID); CREATE INDEX PARTICIPANTNODES_ISSUEID_OBJECTID_NODEID on PARTICIPANTNODES (ISSUEID, OBJECTID, NODEID); CREATE INDEX PARTICIPANTNODES_TQUNID on PARTICIPANTNODES (TQUNID); CREATE INDEX PARTICIPANTSETTINGS_PARTICIPANTID on PARTICIPANTSETTINGS (PARTICIPANTID); CREATE INDEX PARTITIONS_LDAPDN on PARTITIONS (LDAPDN); CREATE INDEX PARTITIONS_PARTITIONID_SERVERNODEID on PARTITIONS (PARTITIONID, SERVERNODEID); CREATE INDEX PARTITIONS_SERVERNODEID_PARTITIONID on PARTITIONS (SERVERNODEID, PARTITIONID); CREATE INDEX PARTITIONS_TQUNID on PARTITIONS (TQUNID); CREATE INDEX TASKCOMPLETIONS_TASKID on TASKCOMPLETIONS (TASKID); CREATE INDEX TASKS_ASSIGNEDTO on TASKS (ASSIGNEDTO); CREATE INDEX USERS_PARTITIONID_USERID on USERS (PARTITIONID, USERID); CREATE INDEX USERS_TQUNID on USERS (TQUNID); CREATE INDEX USERS_USERID_PARTITIONID on USERS (USERID, PARTITIONID); CREATE INDEX USERS_USERSID_USERID on USERS (USERSID, USERID); -- COMMIT; ]], { -- <tkt1449-1.1> -- </tkt1449-1.1> }) -- Given the schema above, the following query was cause an assertion fault -- do to an uninitialized field in a Select structure. -- test:do_execsql_test( "tkt1449-1.2", [[ select NEWENTITIES from ITEMS where ((ISSUEID = 'x') and (OBJECTID = 'y')) ]], { -- <tkt1449-1.2> -- </tkt1449-1.2> }) test:do_execsql_test( "tkt1449-1.3", [[ SELECT * FROM CRITICALISSUES; ]], { -- <tkt1449-1.3> -- </tkt1449-1.3> }) test:finish_test()
--utils:log("challengeLobby", "Loaded"); local challengePopup = require("challengeLobby.challengePopup"); local scene = composer.newScene(); scene.resMan = nil; -- The list of matches this player is involved in. scene.matchList = { }; scene.textNoMatches = nil; -- TableView that lists matches and how tall each row is. scene.matchListTableView = nil; scene.listRowHeight = 260; -- Functions for animating the tiles that beed attention. scene.grow = function(inSelf, inRow) transition.to(inRow, { xScale = 0.03, yScale = 0.03, x = -12, y = -12, delta = true, time = 250, onComplete = function(inObject) scene:shrink(inObject); end }); end scene.shrink = function(inSelf, inRow) transition.to(inRow, { xScale = -0.03, yScale = -0.03, x = 12, y = 12, delta = true, time = 250, onComplete = function(inObject) scene:grow(inObject); end }); end -- Refresh to the automatic list refresh timer. scene.refreshTimer = nil; -- Flag to tell us whether a request is in flight for refreshing the match list. scene.isRefreshRequestInFlight = false; -- Flag to tell us if a touch event has begun but not concluded. scene.isTouchEventHappening = false; -- How often (in milliseconds) we'll automatically refresh the match list. scene.refreshInterval = 30000; -- The frown graphic. scene.frown = nil; --- ==================================================================================================================== -- ==================================================================================================================== -- Scene lifecycle Event Handlers -- ==================================================================================================================== -- ==================================================================================================================== --- -- Handler for the create event. -- -- @param inEvent The event object. -- function scene:create(inEvent) --utils:log("challengeLobby", "create()"); self.resMan = utils:newResourceManager(); if gameState.username ~= nil then self.resMan:newTextCandy("textGreeting", { parentGroup = self.view, fontName = "fontInstructions", x = display.contentCenterX, y = 370, text = "Welcome back, " .. utils:trim(gameState.username) .. "!" }); end local frown = self.resMan:newImage("frown", self.view, "challengeLobby/frown.png", display.contentCenterX, display.contentCenterY - 100 ); frown.isVisible = false; frown.alpha = 0.25; local btnChallenge = self.resMan:newSprite("btnChallenge", self.view, uiImageSheet, { { name = "default", start = uiSheetInfo:getFrameIndex("btnChallengeSomeone"), count = 1, time = 9999 } }); btnChallenge.x = display.contentCenterX; btnChallenge.y = 1460; local btnBack = self.resMan:newSprite("btnBack", self.view, uiImageSheet, { { name = "default", start = uiSheetInfo:getFrameIndex("btnBack"), count = 1, time = 9999 } }); btnBack.x = display.contentCenterX; btnBack.y = display.contentHeight - 100; -- Construct TableView to list matches. local listTextYOffset = 34; local matchListTableView = self.resMan:newTableView("matchListTableView", { noLines = true, hideBackground = true, backgroundColor = { 0.9, 0.9, 0.9, 0.1 }, x = display.contentCenterX, y = display.contentCenterY - 60, width = 1040, height = 900, onRowRender = function(inEvent) local row = inEvent.row; local index = row.index; -- Background image. local bg = display.newSprite(row, uiImageSheet, { { name = "default", start = uiSheetInfo:getFrameIndex("matchRow"), count = 1, time = 9999 } }); bg.anchorX = 0; bg.anchorY = 0; bg.x = 20; -- Status title text. local statusText = display.newText(row, row.params.caption, 50, 42, globalNativeFont, 36); statusText.anchorX = 0; statusText.anchorY = 0; statusText:setFillColor(255, 255, 255); -- Rounds text. local roundsCaption = display.newText(row, "Rounds", 70, 110, globalNativeFont, 24); roundsCaption.anchorX = 0; roundsCaption.anchorY = 0; roundsCaption:setFillColor(0, 0, 0); local roundsNumber = display.newText(row, row.params.numRounds, 98, 136, globalNativeFont, 64); roundsNumber.anchorX = 0; roundsNumber.anchorY = 0; roundsNumber:setFillColor(0, 0, 0); -- Games per round text. local gamesPerRoundCaption = display.newText(row, "Games Per Round", 200, 110, globalNativeFont, 24); gamesPerRoundCaption.anchorX = 0; gamesPerRoundCaption.anchorY = 0; gamesPerRoundCaption:setFillColor(0, 0, 0); local gamesPerRoundNumber = display.newText(row, row.params.numGamesPerRound, 290, 136, globalNativeFont, 64); gamesPerRoundNumber.anchorX = 0; gamesPerRoundNumber.anchorY = 0; gamesPerRoundNumber:setFillColor(0, 0, 0); -- Current round text. local currentRoundCaption = display.newText(row, "Current Round", 446, 110, globalNativeFont, 24); currentRoundCaption.anchorX = 0; currentRoundCaption.anchorY = 0; currentRoundCaption:setFillColor(0, 0, 0); local currentRoundNumber = display.newText(row, row.params.currentRound, 514, 136, globalNativeFont, 64); currentRoundNumber.anchorX = 0; currentRoundNumber.anchorY = 0; currentRoundNumber:setFillColor(0, 0, 0); if row.params.outcome == "i" or row.params.oucome == "o" or row.params.outcome == "t" then currentRoundCaption.isVisible = false; currentRoundNumber.isVisible = false; end -- Scores text. local scoresStartX = 780; local yourScore = row.params.finalInitiatorScore; local theirScore = row.params.finalOpponentScore; -- Since these two variables will be nil until the match ends, we have to give them a value to avoid errors. if yourScore == nil then yourScore = "-"; end if theirScore == nil then theirScore = "-"; end -- Now, be sure we display "your" score and "their" score correctly according to who was the initiator. -- The above code assumes the current user was, but if they were the opponent then swap the scores. if row.params.opponent == gameState.username then yourScore, theirScore = theirScore, yourScore; end local yourScoreCaption = display.newText(row, "Your Final Score:", scoresStartX, 138, globalNativeFont, 24); yourScoreCaption:setFillColor(0, 0, 0); local yourScoreNumber = display.newText(row, yourScore, scoresStartX + 150, 140, globalNativeFont, 24); yourScoreNumber:setFillColor(0, 0, 0); local theirScoreCaption = display.newText(row, "Their Final Score:", scoresStartX, 175, globalNativeFont, 24); theirScoreCaption:setFillColor(0, 0, 0); local theirScoreNumber = display.newText(row, theirScore, scoresStartX + 150, 177, globalNativeFont, 24); theirScoreNumber:setFillColor(0, 0, 0); if row.params.shouldPulse == true then scene:grow(row); end -- All done. return true; end, onRowTouch = function(inEvent) if inEvent.phase == "press" then self.isTouchEventHappening = true; elseif inEvent.phase == "release" then self.isTouchEventHappening = false; if challengePopup.showing == false then self:matchSelectedHandler(inEvent.target.params); end end end }); self.view:insert(matchListTableView); local textNoMatches = self.resMan:newTextCandy("textNoMatches", { parentGroup = self.view, fontName = "fontInstructions", x = display.contentCenterX, y = display.contentCenterY - 100, originY = "TOP", text = "You are not currently involved in any matches.||||Why not challenge a friend?", wrapWidth = display.contentWidth - 300, originX = "CENTER", originY = "CENTER", textFlow = "CENTER" }); textNoMatches.isVisible = false; challengePopup:create(self); end -- End create(). --- -- Handler for the show event. -- -- @param inEvent The event object. -- function scene:show(inEvent) if inEvent.phase == "did" then --utils:log("challengeLobby", "show(): did"); if textTitle.isVisible == false then textTitle.isVisible = true; textTitle:startAnimation(); end -- Attach listeners to TextCandy objects. self.resMan:getSprite("btnChallenge"):addEventListener("touch", function(inEvent) self:btnChallengeTouchHandler(inEvent); return true; end ); self.resMan:getSprite("btnBack"):addEventListener("touch", function(inEvent) self:btnBackTouchHandler(inEvent); return true; end ); challengePopup:show() -- Attach listener for enterFrame event. Runtime:addEventListener("enterFrame", self); -- Get list of matches from server and show in list widget. self.isRefreshRequestInFlight = true; serverDelegate:getMatchStatus( function(inList) if inList == nil then composer.gotoScene("menu.main", SCENE_TRANSITION_EFFECT, SCENE_TRANSITION_TIME); else self:populateList(inList); self.refreshTimer = timer.performWithDelay(self.refreshInterval, self.refreshList, 0); self.isRefreshRequestInFlight = false; end end ); end textTitle.isVisible = true; end -- End show(). --- -- Handler for the hide event. -- -- @param inEvent The event object. -- function scene:hide(inEvent) if inEvent.phase == "did" then --utils:log("challengeLobby", "hide(): did"); if self.refreshTimer ~= nil then timer.cancel(self.refreshTimer); end -- Detach listener for enterFrame event. Runtime:removeEventListener("enterFrame", self); end end -- End hide(). --- -- Handler for the destroy event. -- -- @param inEvent The event object. -- function scene:destroy(inEvent) --utils:log("challengeLobby", "destroy()"); challengePopup:destroy(); self.resMan:destroyAll(); self.resMan = nil; end -- End destroy(). --- ==================================================================================================================== -- ==================================================================================================================== -- EnterFrame -- ==================================================================================================================== -- ==================================================================================================================== --- -- Handler for the enterFrame event. -- -- @param inEvent The event object. -- function scene:enterFrame(inEvent) end -- End enterFrame(). --- ==================================================================================================================== -- ==================================================================================================================== -- Touch Handlers -- ==================================================================================================================== -- ==================================================================================================================== --- -- Handler for touch events on the Challenge item. -- -- @param inEvent The event object. -- function scene:btnChallengeTouchHandler(inEvent) if inEvent.phase == "began" then self.isTouchEventHappening = true; inEvent.target.fill.effect = "filter.monotone"; inEvent.target.fill.effect.r = 1; display.getCurrentStage():setFocus(inEvent.target); elseif (inEvent.phase == "ended" or inEvent.phase == "cancelled") and challengePopup.showing == false then challengePopup.showing = true; self.isTouchEventHappening = false; inEvent.target.fill.effect = nil; display.getCurrentStage():setFocus(nil); audio.play(uiTap); -- Fade screen out and fade challenge popup in. transition.to(self.view, { alpha = 0, duration = 500 }); local cp = self.resMan:getDisplayGroup("cpChallengePopup"); cp.y = -(display.contentHeight * 2); cp.isVisible = true; transition.to(cp, { time = 500, y = display.contentCenterY - 1000, transition = easing.inOutBounce, onComplete = function() self.resMan:getTextField("cpTFUsername").isVisible = true; end }); end end -- End btnChallengeHandler(). --- -- Handler for touch events on the Back item. -- -- @param inEvent The event object. -- function scene:btnBackTouchHandler(inEvent) if inEvent.phase == "began" then self.isTouchEventHappening = true; inEvent.target.fill.effect = "filter.monotone"; inEvent.target.fill.effect.r = 1; display.getCurrentStage():setFocus(inEvent.target); elseif (inEvent.phase == "ended" or inEvent.phase == "cancelled") and challengePopup.showing == false then if self.refreshTimer ~= nil then timer.cancel(self.refreshTimer); end inEvent.target.fill.effect = nil; display.getCurrentStage():setFocus(nil); audio.play(uiTap); composer.gotoScene("menu.main", SCENE_TRANSITION_EFFECT, SCENE_TRANSITION_TIME); end end -- End btnBackHandler(). --- -- Called when the user taps on a match in the list. -- -- @param inMatch The match descriptor object. -- function scene:matchSelectedHandler(inMatch) local isOpponent = false; if inMatch.opponent == gameState.username then isOpponent = true; end -- Pending approval. if inMatch.status == "p" then -- Accept the invitation if the player is the opponent. if isOpponent == true then serverDelegate:acceptInvitation( inMatch.token, function(inResult) if inResult == true then currentMatch = inMatch; composer.gotoScene("matchGameSelection.main", SCENE_TRANSITION_EFFECT, SCENE_TRANSITION_TIME); end end ); else dialog:show({ text = "I'm sorry but " .. utils:trim(inMatch.opponent) .. " hasn't accepted this challenge yet.", callback = function(inButtonType) end }); end -- Declined. elseif inMatch.status == "d" then if isOpponent == true then dialog:show({ text = "I'm sorry but you already declined this challenge.", callback = function(inButtonType) end }); else dialog:show({ text = "I'm sorry but " .. utils:trim(inMatch.opponent) .. " declined this challenge.", callback = function(inButtonType) end }); end -- Ended. elseif inMatch.status == "e" then dialog:show({ text = "I'm sorry but this match has already ended.", callback = function(inButtonType) end }); -- Running. elseif inMatch.status == "r" then if isOpponent == true and inMatch.currentTurn == "o" then -- Need to select new games to play for this round. currentMatch = inMatch; composer.gotoScene("matchGameSelection.main", SCENE_TRANSITION_EFFECT, SCENE_TRANSITION_TIME); elseif isOpponent == false and inMatch.currentTurn == "i" then -- First, find the index into gameList for each game ID we were told to play in this round. currentMatch = inMatch; matchRoundGames = { }; for i = 1, #currentMatch.roundGamesArray, 1 do table.insert(matchRoundGames, globalFunctions:findGameIndexByID(currentMatch.roundGamesArray[i])); end -- Finally, start the round. At this point, it should work just like from the matchGameSelection scene. textTitle:stopAnimation(); textTitle.isVisible = false; matchRoundGamesIndex = 1; isPlayingMatchRound = true; matchRoundScore = 0; composer.gotoScene( "miniGames." .. gameList[matchRoundGames[matchRoundGamesIndex]].internalName .. ".main", SCENE_TRANSITION_EFFECT, SCENE_TRANSITION_TIME ); else -- Any other combination of isOpponent and inMatch.currentTurn means it's not this player's turn. dialog:show({ text = "I'm sorry but it isn't your turn yet.", callback = function(inButtonType) end }); end end end -- End matchSelectedHandler(). --- ================================================================================================================== -- ================================================================================================================== -- Utility Functions -- ================================================================================================================== -- ================================================================================================================== --- -- Populates the list of matches returned by the server. -- @param inList The list as returned by the server and parsed by serverDelegate. -- function scene:populateList(inList) self.matchList = inList; for i = 1, #self.matchList, 1 do local match = self.matchList[i]; match.shouldPulse = false; --utils:log("challengeLobby", "populateList() match object", match); -- Determine the name of the other player and trim/uppercase it. local otherPlayerName = match.initiator; if match.initiator == gameState.username then otherPlayerName = match.opponent; end local otherPlayerNameForDisplay = string.upper(utils:trim(otherPlayerName)); -- Determine the status to display, the caption of the match row box. -- Pending if match.status == "p" then if match.initiator == gameState.username then match.caption = "Waiting for " .. otherPlayerNameForDisplay .. " to accept this challenge"; else match.shouldPulse = true; match.caption = otherPlayerNameForDisplay .. " has challenged you!"; end -- Declined. elseif match.status == "d" then if match.initiator == gameState.username then match.caption = "Sorry, " .. otherPlayerNameForDisplay .. " declined this challenge"; else match.caption = "You declined this challenge from " .. otherPlayerNameForDisplay; end -- Ended. elseif match.status == "e" then if (match.outcome == "i" and match.initiator == gameState.username) or (match.outcome == "o" and match.opponent == gameState.username) then match.caption = "You defeated " .. otherPlayerNameForDisplay .. "!"; else if match.finalInitiatorScore == match.finalOpponentScore then match.caption = "Match ended in a tie"; else match.caption = "Sorry, " .. otherPlayerNameForDisplay .. " defeated you"; end end -- Running. elseif match.status == "r" then if (match.currentTurn == "i" and match.initiator == gameState.username) or (match.currentTurn == "o" and match.opponent == gameState.username)then match.shouldPulse = true; match.caption = "It's YOUR turn! (versus " .. otherPlayerNameForDisplay .. ")"; else match.caption = "It's " .. otherPlayerNameForDisplay .. "'s turn"; end end end -- Populate TableView. local tv = self.resMan:getTableView("matchListTableView"); tv:deleteAllRows(); for i = 1, #self.matchList do tv:insertRow({ rowHeight = self.listRowHeight, rowColor = { default = { 0, 0, 0, 0 }, over = { 255, 0, 0 } }; isCategory = false, params = self.matchList[i] }); end if #self.matchList == 0 then self.resMan:getTextCandy("textNoMatches").isVisible = true; self.resMan:getImage("frown").isVisible = true; else self.resMan:getTextCandy("textNoMatches").isVisible = false; self.resMan:getImage("frown").isVisible = false; end end -- End populateList(). --- -- Function called every 20 seconds to automatically refresh the list. Note that the reference to scene is required to -- get the proper scope here. There's probably a better way to do this but it was eluding me, so it is what it is. -- function scene:refreshList() -- Only fire off a request if there isn't already one in flight. if scene.isRefreshRequestInFlight == false and scene.isTouchEventHappening == false and challengePopup.showing == false then scene.isRefreshRequestInFlight = true; serverDelegate:getMatchStatus( function(inList) if inList == nil then composer.gotoScene("menu.main", SCENE_TRANSITION_EFFECT, SCENE_TRANSITION_TIME); else scene:populateList(inList); scene.isRefreshRequestInFlight = false; end end ); end end -- End refreshList(). -- ********************************************************************************************************************* -- ********************************************************************************************************************* --utils:log("challengeLobby", "Attaching lifecycle handlers"); scene:addEventListener("create", scene); scene:addEventListener("show", scene); scene:addEventListener("hide", scene); scene:addEventListener("destroy", scene); return scene;
local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') local feed, clear = helpers.feed, helpers.clear local wait = helpers.wait local iswin = helpers.iswin describe('terminal window', function() local screen before_each(function() clear() screen = thelpers.screen_setup() end) describe("with 'number'", function() it('wraps text', function() feed([[<C-\><C-N>]]) feed([[:set numberwidth=1 number<CR>i]]) screen:expect([[ {7:1 }tty ready | {7:2 }rows: 6, cols: 48 | {7:3 }{1: } | {7:4 } | {7:5 } | {7:6 } | {3:-- TERMINAL --} | ]]) thelpers.feed_data({'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) screen:expect([[ {7:1 }tty ready | {7:2 }rows: 6, cols: 48 | {7:3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV| {7:4 }WXYZ{1: } | {7:5 } | {7:6 } | {3:-- TERMINAL --} | ]]) if iswin() then return -- win: :terminal resize is unreliable #7007 end -- numberwidth=9 feed([[<C-\><C-N>]]) feed([[:set numberwidth=9 number<CR>i]]) screen:expect([[ {7: 1 }tty ready | {7: 2 }rows: 6, cols: 48 | {7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO| {7: 4 }WXYZrows: 6, cols: 41 | {7: 5 }{1: } | {7: 6 } | {3:-- TERMINAL --} | ]]) thelpers.feed_data({' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) screen:expect([[ {7: 1 }tty ready | {7: 2 }rows: 6, cols: 48 | {7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO| {7: 4 }WXYZrows: 6, cols: 41 | {7: 5 } abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN| {7: 6 }OPQRSTUVWXYZ{1: } | {3:-- TERMINAL --} | ]]) end) end) describe("with 'colorcolumn'", function() before_each(function() feed([[<C-\><C-N>]]) screen:expect([[ tty ready | {2:^ } | | | | | | ]]) feed(':set colorcolumn=20<CR>i') end) it('wont show the color column', function() screen:expect([[ tty ready | {1: } | | | | | {3:-- TERMINAL --} | ]]) end) end) describe('with fold set', function() before_each(function() feed([[<C-\><C-N>:set foldenable foldmethod=manual<CR>i]]) thelpers.feed_data({'line1', 'line2', 'line3', 'line4', ''}) screen:expect([[ tty ready | line1 | line2 | line3 | line4 | {1: } | {3:-- TERMINAL --} | ]]) end) it('wont show any folds', function() feed([[<C-\><C-N>ggvGzf]]) wait() screen:expect([[ ^tty ready | line1 | line2 | line3 | line4 | {2: } | | ]]) end) end) end)
local presets = require('tabby.presets') local config = {} ---@class TabbyConfig ---@field tabline? TabbyTablineOpt high-level api ---@field components? fun():TabbyComponent[] low-level api ---@field opt? TabbyOption ---@class TabbyOption ---@field show_at_least number show tabline when there are at least n tabs. ---@type TabbyConfig config.defaults = { tabline = presets.active_wins_at_tail, showtabline = 'always', opt = { show_at_least = 1, }, } return config
local summitGems = {} summitGems.name = "summitgem" summitGems.depth = 10100 function summitGems.texture(room, entity) local index = entity.gem or 0 return string.format("collectables/summitgems/%s/gem00", index) end return summitGems
local att = {} att.name = "bg_sb_m6x" att.displayName = "Insight M6X" att.displayNameShort = "M6X" att.isBG = true att.statModifiers = {DrawSpeedMult = 0.05, VelocitySensitivityMult = 0.05} --[[ 0.00 to 1.00 #- #+ "DamageMult", "Decreases damage", "Increases damage" "RecoilMult", "Decreases recoil", "Increases recoil" "FireDelayMult", "Decreases firerate", "Increases firerate" "HipSpreadMult", "Decreases hip spread", "Increases hip spread" "AimSpreadMult", "Decreases aim spread", "Increases aim spread" "ClumpSpreadMult", "Decreases clump spread", "Increases clump spread" "DrawSpeedMult", "Decreases deploy speed", "Increases deploy speed" "ReloadSpeedMult", "Decreases reload speed", "Increases reload speed" "OverallMouseSensMult", "Decreases handling", "Increases handling" "VelocitySensitivityMult", "Increases mobility", "Decreases mobility" "SpreadPerShotMult", "Decreases spread per shot", "Increases spread per shot" "MaxSpreadIncMult", "Decreases accumulative spread", "Increases accumulative spread" --]] if CLIENT then att.displayIcon = surface.GetTextureID("atts/att_sb_m6x") end function att:attachFunc() self:setBodygroup(2,2) --Change BodyGroup. #1 is a set, #2 is an option. Any $model or $body lines are counted as BodyGroups as well. Both numbers use 0 and up. So if you want to change the 1st bodygroup to the 2nd option, first try 1,1. if self.WMEnt then self.WMEnt:SetBodygroup(2,2) end end function att:detachFunc() self:setBodygroup(2,0) if self.WMEnt then self.WMEnt:SetBodygroup(2,0) end end CustomizableWeaponry:registerAttachment(att)
local ffi = require "ffi" local ffi_copy = ffi.copy local ffi_gc = ffi.gc local ffi_new = ffi.new local ffi_string = ffi.string local ffi_cast = ffi.cast local _C = ffi.C local _M = { _VERSION = "0.2.3" } local ngx = ngx local CONST = { SHA256_DIGEST = "SHA256", SHA512_DIGEST = "SHA512", -- ref : https://github.com/openssl/openssl/blob/master/include/openssl/rsa.h RSA_PKCS1_PADDING = 1, RSA_SSLV23_PADDING = 2, RSA_NO_PADDING = 3, RSA_PKCS1_OAEP_PADDING = 4, RSA_X931_PADDING = 5, RSA_PKCS1_PSS_PADDING = 6, -- ref : https://github.com/openssl/openssl/blob/master/include/openssl/evp.h NID_rsaEncryption = 6, EVP_PKEY_RSA = 6, EVP_PKEY_ALG_CTRL = 0x1000, EVP_PKEY_CTRL_RSA_PADDING = 0x1000 + 1, EVP_PKEY_OP_TYPE_CRYPT = 768, EVP_PKEY_CTRL_RSA_OAEP_MD = 0x1000 + 9 } _M.CONST = CONST -- Reference: https://wiki.openssl.org/index.php/EVP_Signing_and_Verifying ffi.cdef[[ // Error handling unsigned long ERR_get_error(void); const char * ERR_reason_error_string(unsigned long e); // Basic IO typedef struct bio_st BIO; typedef struct bio_method_st BIO_METHOD; BIO_METHOD *BIO_s_mem(void); BIO * BIO_new(BIO_METHOD *type); int BIO_puts(BIO *bp,const char *buf); void BIO_vfree(BIO *a); int BIO_write(BIO *b, const void *buf, int len); // RSA typedef struct rsa_st RSA; int RSA_size(const RSA *rsa); void RSA_free(RSA *rsa); typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); RSA * PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **rsa, pem_password_cb *cb, void *u); RSA * PEM_read_bio_RSAPublicKey(BIO *bp, RSA **rsa, pem_password_cb *cb, void *u); // EC_KEY typedef struct ec_key_st EC_KEY; void EC_KEY_free(EC_KEY *key); EC_KEY * PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **key, pem_password_cb *cb, void *u); EC_KEY * PEM_read_bio_ECPublicKey(BIO *bp, EC_KEY **key, pem_password_cb *cb, void *u); // EVP PKEY typedef struct evp_pkey_st EVP_PKEY; typedef struct engine_st ENGINE; EVP_PKEY *EVP_PKEY_new(void); int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,RSA *key); int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,EC_KEY *key); EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, const unsigned char *key, int keylen); void EVP_PKEY_free(EVP_PKEY *key); int i2d_RSA(RSA *a, unsigned char **out); // Additional typedef of ECC operations (DER/RAW sig conversion) typedef struct bignum_st BIGNUM; BIGNUM *BN_new(void); void BN_free(BIGNUM *a); int BN_num_bits(const BIGNUM *a); int BN_bn2bin(const BIGNUM *a, unsigned char *to); BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); char *BN_bn2hex(const BIGNUM *a); typedef struct ECDSA_SIG_st { BIGNUM *r; BIGNUM *s;} ECDSA_SIG; ECDSA_SIG* ECDSA_SIG_new(void); int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp); ECDSA_SIG* d2i_ECDSA_SIG(ECDSA_SIG **sig, unsigned char **pp, long len); void ECDSA_SIG_free(ECDSA_SIG *sig); typedef struct ecgroup_st EC_GROUP; EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, void *ctx); // PUBKEY EVP_PKEY *PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u); // X509 typedef struct x509_st X509; X509 *PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb, void *u); EVP_PKEY * X509_get_pubkey(X509 *x); void X509_free(X509 *a); void EVP_PKEY_free(EVP_PKEY *key); int i2d_X509(X509 *a, unsigned char **out); X509 *d2i_X509_bio(BIO *bp, X509 **x); // X509 store typedef struct x509_store_st X509_STORE; typedef struct X509_crl_st X509_CRL; X509_STORE *X509_STORE_new(void ); int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); // Use this if we want to load the certs directly from a variables int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); int X509_STORE_load_locations (X509_STORE *ctx, const char *file, const char *dir); void X509_STORE_free(X509_STORE *v); // X509 store context typedef struct x509_store_ctx_st X509_STORE_CTX; X509_STORE_CTX *X509_STORE_CTX_new(void); int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, void *chain); int X509_verify_cert(X509_STORE_CTX *ctx); void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); const char *X509_verify_cert_error_string(long n); void X509_STORE_CTX_free(X509_STORE_CTX *ctx); // EVP Sign/Verify typedef struct env_md_ctx_st EVP_MD_CTX; typedef struct env_md_st EVP_MD; typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; const EVP_MD *EVP_get_digestbyname(const char *name); //OpenSSL 1.0 EVP_MD_CTX *EVP_MD_CTX_create(void); void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); //OpenSSL 1.1 EVP_MD_CTX *EVP_MD_CTX_new(void); void EVP_MD_CTX_free(EVP_MD_CTX *ctx); int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d, size_t cnt); int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen); int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen); // Fingerprints int X509_digest(const X509 *data,const EVP_MD *type, unsigned char *md, unsigned int *len); //EVP encrypt decrypt EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, int cmd, int p1, void *p2); int EVP_PKEY_size(EVP_PKEY *pkey); int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen); int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen); ]] local function _err(ret) -- The openssl error queue can have multiple items, print them all separated by ': ' local errs = {} local code = _C.ERR_get_error() while code ~= 0 do table.insert(errs, 1, ffi_string(_C.ERR_reason_error_string(code))) code = _C.ERR_get_error() end if #errs == 0 then return ret, "Zero error code (null arguments?)" end return ret, table.concat(errs, ": ") end local ctx_new, ctx_free local openssl11, e = pcall(function () local ctx = _C.EVP_MD_CTX_new() _C.EVP_MD_CTX_free(ctx) end) ngx.log(ngx.DEBUG, "openssl11=", openssl11, " err=", e) if openssl11 then ctx_new = function () return _C.EVP_MD_CTX_new() end ctx_free = function (ctx) ffi_gc(ctx, _C.EVP_MD_CTX_free) end else ctx_new = function () local ctx = _C.EVP_MD_CTX_create() return ctx end ctx_free = function (ctx) ffi_gc(ctx, _C.EVP_MD_CTX_destroy) end end local function _new_key(self, opts) local bio = _C.BIO_new(_C.BIO_s_mem()) ffi_gc(bio, _C.BIO_vfree) if _C.BIO_puts(bio, opts.pem_private_key) < 0 then return _err() end local pass if opts.password then local plen = #opts.password pass = ffi_new("unsigned char[?]", plen + 1) ffi_copy(pass, opts.password, plen) end local key = nil if self.algo == "RSA" then key = _C.PEM_read_bio_RSAPrivateKey(bio, nil, nil, pass) ffi_gc(key, _C.RSA_free) elseif self.algo == "ECDSA" then key = _C.PEM_read_bio_ECPrivateKey(bio, nil, nil, pass) ffi_gc(key, _C.EC_KEY_free) end if not key then return _err() end local evp_pkey = _C.EVP_PKEY_new() if evp_pkey == nil then return _err() end ffi_gc(evp_pkey, _C.EVP_PKEY_free) if self.algo == "RSA" then if _C.EVP_PKEY_set1_RSA(evp_pkey, key) ~= 1 then return _err() end elseif self.algo == "ECDSA" then if _C.EVP_PKEY_set1_EC_KEY(evp_pkey, key) ~= 1 then return _err() end end self.evp_pkey = evp_pkey return self, nil end local function _create_evp_ctx(self, encrypt) self.ctx = _C.EVP_PKEY_CTX_new(self.evp_pkey, nil) if self.ctx == nil then return _err() end ffi_gc(self.ctx, _C.EVP_PKEY_CTX_free) local md = _C.EVP_get_digestbyname(self.digest_alg) if ffi_cast("void *", md) == nil then return nil, "Unknown message digest" end if encrypt then if _C.EVP_PKEY_encrypt_init(self.ctx) <= 0 then return _err() end else if _C.EVP_PKEY_decrypt_init(self.ctx) <= 0 then return _err() end end if _C.EVP_PKEY_CTX_ctrl(self.ctx, CONST.EVP_PKEY_RSA, -1, CONST.EVP_PKEY_CTRL_RSA_PADDING, self.padding, nil) <= 0 then return _err() end if self.padding == CONST.RSA_PKCS1_OAEP_PADDING then if _C.EVP_PKEY_CTX_ctrl(self.ctx, CONST.EVP_PKEY_RSA, CONST.EVP_PKEY_OP_TYPE_CRYPT, CONST.EVP_PKEY_CTRL_RSA_OAEP_MD, 0, ffi_cast("void *", md)) <= 0 then return _err() end end return self.ctx end local evp_pkey_ctx_ptr_ptr_ct = ffi.typeof('EVP_PKEY_CTX*[1]') local function _create_sign_verify_ctx(self, finit_ex, fint, md_alg) local pkey_ctx, ppkey_ctx if self.padding then pkey_ctx = _C.EVP_PKEY_CTX_new(self.evp_pkey, nil) if pkey_ctx == nil then return nil, "pkey:_create_sign_verify_ctx EVP_PKEY_CTX_new()" end ffi_gc(pkey_ctx, _C.EVP_PKEY_CTX_free) ppkey_ctx = evp_pkey_ctx_ptr_ptr_ct() ppkey_ctx[0] = pkey_ctx end local md_ctx = ctx_new() if md_ctx == nil then return nil, "pkey:_create_sign_verify_ctx: EVP_MD_CTX_new() failed" end ctx_free(md_ctx) if finit_ex(md_ctx, md_alg, nil) ~= 1 then return nil, "pkey:_create_sign_verify_ctx: Init_ex() failed" end if fint(md_ctx, ppkey_ctx, md_alg, nil, self.evp_pkey) ~= 1 then return nil, "pkey:_create_sign_verify_ctx: Init failed" end if ppkey_ctx and self.padding == CONST.RSA_PKCS1_PSS_PADDING then if _C.EVP_PKEY_CTX_ctrl(ppkey_ctx[0], CONST.EVP_PKEY_RSA, -1, CONST.EVP_PKEY_CTRL_RSA_PADDING, self.padding, nil) <= 0 then return nil, "pkey:_create_sign_verify_ctx: EVP_PKEY_CTX_ctrl() failed" end end return md_ctx end local RSASigner = {algo="RSA"} _M.RSASigner = RSASigner --- Create a new RSASigner -- @param pem_private_key A private key string in PEM format -- @param password password for the private key (if required) -- @returns RSASigner, err_string function RSASigner.new(self, pem_private_key, password, padding) self.padding = padding return _new_key ( self, { pem_private_key = pem_private_key, password = password } ) end --- Sign a message -- @param message The message to sign -- @param digest_name The digest format to use (e.g., "SHA256") -- @returns signature, error_string function RSASigner.sign(self, message, digest_name) local buf = ffi_new("unsigned char[?]", 1024) local len = ffi_new("size_t[1]", 1024) local md = _C.EVP_get_digestbyname(digest_name) if md == nil then return _err() end local md_ctx, err = _create_sign_verify_ctx(self, _C.EVP_DigestInit_ex, _C.EVP_DigestSignInit, md) if err then return _err() end if _C.EVP_DigestUpdate(md_ctx, message, #message) ~= 1 then return _err() end if _C.EVP_DigestSignFinal(md_ctx, buf, len) ~= 1 then return _err() end return ffi_string(buf, len[0]), nil end local ECSigner = {algo="ECDSA"} _M.ECSigner = ECSigner --- Create a new ECSigner -- @param pem_private_key A private key string in PEM format -- @param password password for the private key (if required) -- @returns ECSigner, err_string function ECSigner.new(self, pem_private_key, password) return RSASigner.new(self, pem_private_key, password) end --- Sign a message with ECDSA -- @param message The message to sign -- @param digest_name The digest format to use (e.g., "SHA256") -- @returns signature, error_string function ECSigner.sign(self, message, digest_name) return RSASigner.sign(self, message, digest_name) end --- Converts a ASN.1 DER signature to RAW r,s -- @param signature The ASN.1 DER signature -- @returns signature, error_string function ECSigner.get_raw_sig(self, signature) if not signature then return nil, "Must pass a signature to convert" end local sig_ptr = ffi_new("unsigned char *[1]") local sig_bin = ffi_new("unsigned char [?]", #signature) ffi_copy(sig_bin, signature, #signature) sig_ptr[0] = sig_bin local sig = _C.d2i_ECDSA_SIG(nil, sig_ptr, #signature) ffi_gc(sig, _C.ECDSA_SIG_free) local rbytes = math.floor((_C.BN_num_bits(sig.r)+7)/8) local sbytes = math.floor((_C.BN_num_bits(sig.s)+7)/8) -- Ensure we copy the BN in a padded form local ec = _C.EVP_PKEY_get0_EC_KEY(self.evp_pkey) local ecgroup = _C.EC_KEY_get0_group(ec) local order = _C.BN_new() ffi_gc(order, _C.BN_free) -- res is an int, if 0, curve not found local res = _C.EC_GROUP_get_order(ecgroup, order, nil) -- BN_num_bytes is a #define, so have to use BN_num_bits local order_size_bytes = math.floor((_C.BN_num_bits(order)+7)/8) local resbuf_len = order_size_bytes *2 local resbuf = ffi_new("unsigned char[?]", resbuf_len) -- Let's whilst preserving MSB _C.BN_bn2bin(sig.r, resbuf + order_size_bytes - rbytes) _C.BN_bn2bin(sig.s, resbuf + (order_size_bytes*2) - sbytes) local raw = ffi_string(resbuf, resbuf_len) return raw, nil end local RSAVerifier = {} _M.RSAVerifier = RSAVerifier --- Create a new RSAVerifier -- @param key_source An instance of Cert or PublicKey used for verification -- @returns RSAVerifier, error_string function RSAVerifier.new(self, key_source, padding) if not key_source then return nil, "You must pass in an key_source for a public key" end local evp_public_key = key_source.public_key self.evp_pkey = evp_public_key self.padding = padding return self, nil end --- Verify a message is properly signed -- @param message The original message -- @param the signature to verify -- @param digest_name The digest type that was used to sign -- @returns bool, error_string function RSAVerifier.verify(self, message, sig, digest_name) local md = _C.EVP_get_digestbyname(digest_name) if md == nil then return _err(false) end local md_ctx, err = _create_sign_verify_ctx(self, _C.EVP_DigestInit_ex, _C.EVP_DigestVerifyInit, md) if err then return _err(false) end if _C.EVP_DigestUpdate(md_ctx, message, #message) ~= 1 then return _err(false) end local sig_bin = ffi_new("unsigned char[?]", #sig) ffi_copy(sig_bin, sig, #sig) if _C.EVP_DigestVerifyFinal(md_ctx, sig_bin, #sig) == 1 then return true, nil else return false, "Verification failed" end end local ECVerifier = {} _M.ECVerifier = ECVerifier --- Create a new ECVerifier -- @param key_source An instance of Cert or PublicKey used for verification -- @returns ECVerifier, error_string function ECVerifier.new(self, key_source) return RSAVerifier.new(self, key_source) end --- Verify a message is properly signed -- @param message The original message -- @param the signature to verify -- @param digest_name The digest type that was used to sign -- @returns bool, error_string function ECVerifier.verify(self, message, sig, digest_name) -- We have to convert the signature back from RAW to ASN1 for verification local der_sig, err = self:get_der_sig(sig) if not der_sig then return nil, err end return RSAVerifier.verify(self, message, der_sig, digest_name) end --- Converts a RAW r,s signature to ASN.1 DER signature (ECDSA) -- @param signature The raw signature -- @returns signature, error_string function ECVerifier.get_der_sig(self, signature) if not signature then return nil, "Must pass a signature to convert" end -- inspired from https://bit.ly/2yZxzxJ local ec = _C.EVP_PKEY_get0_EC_KEY(self.evp_pkey) local ecgroup = _C.EC_KEY_get0_group(ec) local order = _C.BN_new() ffi_gc(order, _C.BN_free) -- res is an int, if 0, curve not found local res = _C.EC_GROUP_get_order(ecgroup, order, nil) -- BN_num_bytes is a #define, so have to use BN_num_bits local order_size_bytes = math.floor((_C.BN_num_bits(order)+7)/8) if #signature ~= 2 * order_size_bytes then return nil, "signature length != 2 * order length" end local sig_bytes = ffi_new("unsigned char [?]", #signature) ffi_copy(sig_bytes, signature, #signature) local ecdsa = _C.ECDSA_SIG_new() ffi_gc(ecdsa, _C.ECDSA_SIG_free) -- Those do not need to be GCed as they are cleared by the ECDSA_SIG_free() local r = _C.BN_bin2bn(sig_bytes, order_size_bytes, nil) local s = _C.BN_bin2bn(sig_bytes + order_size_bytes, order_size_bytes, nil) ecdsa.r = r ecdsa.s = s -- Gives us the buffer size to allocate local der_len = _C.i2d_ECDSA_SIG(ecdsa, nil) local der_sig_ptr = ffi_new("unsigned char *[1]") local der_sig_bin = ffi_new("unsigned char [?]", der_len) der_sig_ptr[0] = der_sig_bin der_len = _C.i2d_ECDSA_SIG(ecdsa, der_sig_ptr) local der_str = ffi_string(der_sig_bin, der_len) return der_str, nil end local Cert = {} _M.Cert = Cert --- Create a new Certificate object -- @param payload A PEM or DER format X509 certificate -- @returns Cert, error_string function Cert.new(self, payload) if not payload then return nil, "Must pass a PEM or binary DER cert" end local bio = _C.BIO_new(_C.BIO_s_mem()) ffi_gc(bio, _C.BIO_vfree) local x509 if payload:find('-----BEGIN') then if _C.BIO_puts(bio, payload) < 0 then return _err() end x509 = _C.PEM_read_bio_X509(bio, nil, nil, nil) else if _C.BIO_write(bio, payload, #payload) < 0 then return _err() end x509 = _C.d2i_X509_bio(bio, nil) end if x509 == nil then return _err() end ffi_gc(x509, _C.X509_free) self.x509 = x509 local public_key, err = self:get_public_key() if not public_key then return nil, err end ffi_gc(public_key, _C.EVP_PKEY_free) self.public_key = public_key return self, nil end --- Retrieve the DER format of the certificate -- @returns Binary DER format, error_string function Cert.get_der(self) local bufp = ffi_new("unsigned char *[1]") local len = _C.i2d_X509(self.x509, bufp) if len < 0 then return _err() end local der = ffi_string(bufp[0], len) return der, nil end --- Retrieve the cert fingerprint -- @param digest_name the Type of digest to use (e.g., "SHA256") -- @returns fingerprint_string, error_string function Cert.get_fingerprint(self, digest_name) local md = _C.EVP_get_digestbyname(digest_name) if md == nil then return _err() end local buf = ffi_new("unsigned char[?]", 32) local len = ffi_new("unsigned int[1]", 32) if _C.X509_digest(self.x509, md, buf, len) ~= 1 then return _err() end local raw = ffi_string(buf, len[0]) local t = {} raw:gsub('.', function (c) table.insert(t, string.format('%02X', string.byte(c))) end) return table.concat(t, ":"), nil end --- Retrieve the public key from the CERT -- @returns An OpenSSL EVP PKEY object representing the public key, error_string function Cert.get_public_key(self) local evp_pkey = _C.X509_get_pubkey(self.x509) if evp_pkey == nil then return _err() end return evp_pkey, nil end --- Verify the Certificate is trusted -- @param trusted_cert_file File path to a list of PEM encoded trusted certificates -- @return bool, error_string function Cert.verify_trust(self, trusted_cert_file) local store = _C.X509_STORE_new() if store == nil then return _err(false) end ffi_gc(store, _C.X509_STORE_free) if _C.X509_STORE_load_locations(store, trusted_cert_file, nil) ~=1 then return _err(false) end local ctx = _C.X509_STORE_CTX_new() if store == nil then return _err(false) end ffi_gc(ctx, _C.X509_STORE_CTX_free) if _C.X509_STORE_CTX_init(ctx, store, self.x509, nil) ~= 1 then return _err(false) end if _C.X509_verify_cert(ctx) ~= 1 then local code = _C.X509_STORE_CTX_get_error(ctx) local msg = ffi_string(_C.X509_verify_cert_error_string(code)) _C.X509_STORE_CTX_cleanup(ctx) return false, msg end _C.X509_STORE_CTX_cleanup(ctx) return true, nil end local PublicKey = {} _M.PublicKey = PublicKey --- Create a new PublicKey object -- -- If a PEM fornatted key is provided, the key must start with -- -- ----- BEGIN PUBLIC KEY ----- -- -- @param payload A PEM or DER format public key file -- @return PublicKey, error_string function PublicKey.new(self, payload) if not payload then return nil, "Must pass a PEM or binary DER public key" end local bio = _C.BIO_new(_C.BIO_s_mem()) ffi_gc(bio, _C.BIO_vfree) local pkey if payload:find('-----BEGIN') then if _C.BIO_puts(bio, payload) < 0 then return _err() end pkey = _C.PEM_read_bio_PUBKEY(bio, nil, nil, nil) else if _C.BIO_write(bio, payload, #payload) < 0 then return _err() end pkey = _C.d2i_PUBKEY_bio(bio, nil) end if pkey == nil then return _err() end ffi_gc(pkey, _C.EVP_PKEY_free) self.public_key = pkey return self, nil end local RSAEncryptor= {} _M.RSAEncryptor = RSAEncryptor --- Create a new RSAEncryptor -- @param key_source An instance of Cert or PublicKey used for verification -- @param padding padding type to use -- @param digest_alg digest algorithm to use -- @returns RSAEncryptor, err_string function RSAEncryptor.new(self, key_source, padding, digest_alg) if not key_source then return nil, "You must pass in an key_source for a public key" end local evp_public_key = key_source.public_key self.evp_pkey = evp_public_key self.padding = padding or CONST.RSA_PKCS1_OAEP_PADDING self.digest_alg = digest_alg or CONST.SHA256_DIGEST return self, nil end --- Encrypts the payload -- @param payload plain text payload -- @returns encrypted payload, error_string function RSAEncryptor.encrypt(self, payload) local ctx, err_str = _create_evp_ctx(self, true) if not ctx then return nil, err_str end local len = ffi_new("size_t [1]") if _C.EVP_PKEY_encrypt(ctx, nil, len, payload, #payload) <= 0 then return _err() end local buf = ffi_new("unsigned char[?]", len[0]) if _C.EVP_PKEY_encrypt(ctx, buf, len, payload, #payload) <= 0 then return _err() end return ffi_string(buf, len[0]) end local RSADecryptor= {algo="RSA"} _M.RSADecryptor = RSADecryptor --- Create a new RSADecryptor -- @param pem_private_key A private key string in PEM format -- @param password password for the private key (if required) -- @param padding padding type to use -- @param digest_alg digest algorithm to use -- @returns RSADecryptor, error_string function RSADecryptor.new(self, pem_private_key, password, padding, digest_alg) self.padding = padding or CONST.RSA_PKCS1_OAEP_PADDING self.digest_alg = digest_alg or CONST.SHA256_DIGEST return _new_key ( self, { pem_private_key = pem_private_key, password = password } ) end --- Decrypts the cypher text -- @param cypher_text encrypted payload -- @param padding rsa pading mode to use, Defaults to RSA_PKCS1_PADDING function RSADecryptor.decrypt(self, cypher_text) local ctx, err_code, err_str = _create_evp_ctx(self, false) if not ctx then return nil, err_code, err_str end local len = ffi_new("size_t [1]") if _C.EVP_PKEY_decrypt(ctx, nil, len, cypher_text, #cypher_text) <= 0 then return _err() end local buf = ffi_new("unsigned char[?]", len[0]) if _C.EVP_PKEY_decrypt(ctx, buf, len, cypher_text, #cypher_text) <= 0 then return _err() end return ffi_string(buf, len[0]) end return _M
#!/usr/bin/env lua -- (C) Copyright 2009 Hewlett-Packard Development Company, L.P. -- -- 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. -- -- $Id$ dofile(arg[0]:gsub("(.+)/.+","%1/defaults.lua")) function mysplit(inputstr, sep) if sep == nil then sep = "%s" end local t={} ; i=0 for str in string.gmatch(inputstr,"([^"..sep.."]+)") do t[i] = str i = i + 1 end return t end executed=false function execute(x) local tmpstrv={} tmpstrv=mysplit(x) l=location(tmpstrv[0]) check_exists(l,"user script '"..tmpstrv[0].."' does not exist") if (tmpstrv[1] ~= nil) then local tmps2=table.concat(tmpstrv, " ", 1); puts(l.." "..tmps2) else puts(l) end executed=true end if type(simnow)~='table' or type(simnow.commands)~='function' then error("no simnow.commands function") end if user_script==nil then simnow.commands() if executed==false then error("no execute call inside simnow.commands") end else execute(user_script) end
-- amoguSV v3.1 (21 Dec 2021) -- by kloi34 -- Many SV tool ideas were stolen from other plugins, so here is credit to those plugins and the -- creators behind them: --------------------------------------------------------------------------------------------------- -- Plugin Creator Link --------------------------------------------------------------------------------------------------- -- iceSV IceDynamix @ https://github.com/IceDynamix/iceSV -- KeepStill Illuminati-CRAZ @ https://github.com/Illuminati-CRAZ/KeepStill -- Vibrato Illuminati-CRAZ @ https://github.com/Illuminati-CRAZ/Vibrato -- Displacer Illuminati-CRAZ @ https://github.com/Illuminati-CRAZ/Displacer --------------------------------------------------------------------------------------------------- -- Plugin Info ------------------------------------------------------------------------------------ --------------------------------------------------------------------------------------------------- -- This is a plugin for Quaver, the ultimate community-driven and open-source competitive rhythm -- game. The plugin provides various tools to add and edit SVs (Scroll Velocities) quickly and -- efficiently when making maps. -- If you have any feature suggestions or issues with the plugin, please open an issue at -- https://github.com/kloi34/amoguSV/issues -- Last features planned for amoguSV v4.0: -- 1. Make amoguSV UI better and UX better, especially for first time users -- 2. Dedicated Vibrato+more SV tool --------------------------------------------------------------------------------------------------- -- Global Constants ------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- -- IMGUI / GUI DEFAULT_WIDGET_HEIGHT = 26 -- value determining the height of GUI widgets DEFAULT_WIDGET_WIDTH = 160 -- value determining the width of GUI widgets MENU_SIZE_LEFT = {265, 465} -- dimensions of the settings menu panel on the left MENU_SIZE_RIGHT = {260, 465} -- dimensions of the menu panel on the right PADDING_WIDTH = 8 -- value determining window and frame padding PLUGIN_WINDOW_SIZE = {560, 540} -- dimensions of the plugin window SAMELINE_SPACING = 5 -- value determining spacing between GUI items on the same row RADIO_BUTTON_SPACING = 7.5 -- value determining spacing between radio buttons ACTION_BUTTON_SIZE = { -- dimensions of the button that places/removes SVs 1.6 * DEFAULT_WIDGET_WIDTH, 1.6 * DEFAULT_WIDGET_HEIGHT } -- SV/Time restrictions MAX_DURATION = 10000 -- maximum millisecond duration allowed in general MAX_GENERAL_SV = 1000 -- maximum (absolute) value allowed for general SVs (ex. avg SV) MAX_MS_TIME = 7200000 -- ~ 2 hrs -- maximum song time allowed (milliseconds) MAX_TELEPORT_DURATION = 10 -- maximum millisecond teleport duration allowed MAX_TELEPORT_VALUE = 9999999 -- maximum (absolute) teleport SV value allowed MIN_DURATION = 0.016 -- ~ 1/64 -- minimum millisecond duration allowed in general -- Menu-related CONDITION_TESTS = { -- conditions/tests for numbers "= (equal to)", "> (greater than)", ">= (greater or equal to)", "< (less than)", "<= (less or equal to)" } EMOTICONS = { -- emoticons to visually clutter the plugin and confuse users "%( - _ - )", "%( e.e %)", "%(o_0%)", "%(*o*%)", "%(~_~%)", "%(>.<%)", "%(w.w)", "%(^w^%)", "%( c . p %)", "%( ; _ ; %)" } FINAL_SV_TYPES = { -- options for the last SV placed at the tail end of all SVs "Normal", "Skip", "1.00x" } SV_TOOLS = { -- list of the available tools for editing SVs "Linear", "Exponential", "Stutter", "Bezier", "Sinusoidal", "Single", "Random", "Still", "Copy", "Remove" } --------------------------------------------------------------------------------------------------- -- Plugin Menus (+ other higher level menu-related functions) ------------------------------------- --------------------------------------------------------------------------------------------------- -- Creates the plugin window function draw() setPluginAppearance() createMainMenu() end -- Configures GUI styles (colors and appearance) function setPluginAppearance() -- Plugin Styles local rounding = 5 -- determines how rounded corners are imgui.PushStyleVar( imgui_style_var.WindowPadding, { PADDING_WIDTH, 8 } ) imgui.PushStyleVar( imgui_style_var.FramePadding, { PADDING_WIDTH, 5 } ) imgui.PushStyleVar( imgui_style_var.ItemSpacing, { DEFAULT_WIDGET_HEIGHT / 2 - 1, 4 } ) imgui.PushStyleVar( imgui_style_var.ItemInnerSpacing, { SAMELINE_SPACING, 6 } ) imgui.PushStyleVar( imgui_style_var.WindowBorderSize, 0 ) imgui.PushStyleVar( imgui_style_var.WindowRounding, rounding ) imgui.PushStyleVar( imgui_style_var.ChildRounding, rounding ) imgui.PushStyleVar( imgui_style_var.FrameRounding, rounding ) imgui.PushStyleVar( imgui_style_var.GrabRounding, rounding ) -- Plugin Colors imgui.PushStyleColor( imgui_col.WindowBg, { 0.00, 0.00, 0.00, 1.00 } ) imgui.PushStyleColor( imgui_col.FrameBg, { 0.14, 0.24, 0.28, 1.00 } ) imgui.PushStyleColor( imgui_col.FrameBgHovered, { 0.24, 0.34, 0.38, 1.00 } ) imgui.PushStyleColor( imgui_col.FrameBgActive, { 0.29, 0.39, 0.43, 1.00 } ) imgui.PushStyleColor( imgui_col.TitleBg, { 0.41, 0.48, 0.65, 1.00 } ) imgui.PushStyleColor( imgui_col.TitleBgActive, { 0.51, 0.58, 0.75, 1.00 } ) imgui.PushStyleColor( imgui_col.TitleBgCollapsed, { 0.51, 0.58, 0.75, 0.50 } ) imgui.PushStyleColor( imgui_col.CheckMark, { 0.81, 0.88, 1.00, 1.00 } ) imgui.PushStyleColor( imgui_col.SliderGrab, { 0.56, 0.63, 0.75, 1.00 } ) imgui.PushStyleColor( imgui_col.SliderGrabActive, { 0.61, 0.68, 0.80, 1.00 } ) imgui.PushStyleColor( imgui_col.Button, { 0.31, 0.38, 0.50, 1.00 } ) imgui.PushStyleColor( imgui_col.ButtonHovered, { 0.41, 0.48, 0.60, 1.00 } ) imgui.PushStyleColor( imgui_col.ButtonActive, { 0.51, 0.58, 0.70, 1.00 } ) imgui.PushStyleColor( imgui_col.Header, { 0.81, 0.88, 1.00, 0.40 } ) imgui.PushStyleColor( imgui_col.HeaderHovered, { 0.81, 0.88, 1.00, 0.50 } ) imgui.PushStyleColor( imgui_col.HeaderActive, { 0.81, 0.88, 1.00, 0.54 } ) imgui.PushStyleColor( imgui_col.Separator, { 0.81, 0.88, 1.00, 0.30 } ) imgui.PushStyleColor( imgui_col.TextSelectedBg, { 0.81, 0.88, 1.00, 0.40 } ) end -- Creates the main menu function createMainMenu() imgui.SetNextWindowSize(PLUGIN_WINDOW_SIZE) imgui.Begin("amoguSV", imgui_window_flags.AlwaysAutoResize) local globalVars = { currentMenuNum = 1, placeSVsBetweenOffsets = false } retrieveStateVariables("Global", globalVars) local isNavHovered = createNavigationDropdown(globalVars) local menuName = SV_TOOLS[globalVars.currentMenuNum] local menuVars = declareMenuVariables(menuName) retrieveStateVariables(menuName, menuVars) imgui.Columns(2, "SV Menu Panels", false) local isLeftPanelHovered, svUpdateNeeded = createSettingsPanel(globalVars, menuVars, menuName) if svUpdateNeeded then updateMenuSVs(menuVars, menuName) end imgui.NextColumn() local isRightPanelHovered = createRightPanel(globalVars, menuVars, menuName) saveStateVariables(menuName, menuVars) saveStateVariables("Global", globalVars) state.IsWindowHovered = isNavHovered or isLeftPanelHovered or isRightPanelHovered imgui.End() end -- Creates the top navigation bar with the dropdown menu to select an SV tool -- Returns whether the navigation bar is hovered [Boolean] -- Parameters -- globalVars : list of global plugin variables used across all menus [Table] function createNavigationDropdown(globalVars) imgui.AlignTextToFramePadding() imgui.Text("Current SV Tool:") imgui.SameLine() imgui.PushItemWidth(2 * DEFAULT_WIDGET_WIDTH) local _, menuIndex = imgui.Combo(" ", globalVars.currentMenuNum - 1, SV_TOOLS, #SV_TOOLS) globalVars.currentMenuNum = menuIndex + 1 imgui.SameLine() imgui.Text(EMOTICONS[globalVars.currentMenuNum]) addPadding() return imgui.IsWindowHovered() end -- Creates the settings panel to adjust SV tool settings -- Returns 2 values -- 1. whether or not this left panel is hovered over [Boolean] -- 2. whether or not menu-specific SV information has changed and needs an update [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the current SV menu [Table] -- menuName : name of the current SV menu [String] function createSettingsPanel(globalVars, menuVars, menuName) imgui.BeginChild("Settings Panel", MENU_SIZE_LEFT, true) local isPanelHovered = imgui.IsWindowHovered() imgui.PushItemWidth(DEFAULT_WIDGET_WIDTH) local menuFunctionName = string.lower(menuName).."SettingsMenu" -- creates the settings menu for the current, specific SV tool local svUpdateNeeded = _G[menuFunctionName](globalVars, menuVars, menuName) imgui.EndChild() return isPanelHovered, svUpdateNeeded end -- Creates the settings menu for linear SV -- Returns whether or not SV information has changed and needs to be updated [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for this linear menu [Table] -- menuName : name of this menu [String] function linearSettingsMenu(globalVars, menuVars, menuName) local svUpdateNeeded = #menuVars.svValues == 0 svUpdateNeeded = chooseStartEndSVs(menuVars, true) or svUpdateNeeded svUpdateNeeded = chooseSVPoints(menuVars) or svUpdateNeeded svUpdateNeeded = chooseFinalSV(menuVars, false) or svUpdateNeeded svUpdateNeeded = chooseInterlace(menuVars, menuName, true) or svUpdateNeeded chooseTeleportSV(globalVars, menuVars, menuName) chooseDisplacement(globalVars, menuVars, menuName) return svUpdateNeeded end -- Creates the settings menu for exponential SV -- Returns whether or not SV information has changed and needs to be updated [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for this exponential menu [Table] -- menuName : name of this menu [String] function exponentialSettingsMenu(globalVars, menuVars, menuName) local svUpdateNeeded = #menuVars.svValues == 0 svUpdateNeeded = chooseExponentialBehavior(menuVars) or svUpdateNeeded svUpdateNeeded = chooseIntensity(menuVars) or svUpdateNeeded svUpdateNeeded = chooseAverageSV(menuVars, false) or svUpdateNeeded svUpdateNeeded = chooseSVPoints(menuVars) or svUpdateNeeded svUpdateNeeded = chooseFinalSV(menuVars, false) or svUpdateNeeded svUpdateNeeded = chooseInterlace(menuVars, menuName, false) or svUpdateNeeded chooseTeleportSV(globalVars, menuVars, menuName) chooseDisplacement(globalVars, menuVars, menuName) return svUpdateNeeded end -- Creates the settings menu for stutter/bump SV -- Returns whether or not SV information has changed and needs to be updated [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for this stutter menu [Table] -- menuName : name of this menu [String] function stutterSettingsMenu(globalVars, menuVars, menuName) local svUpdateNeeded = #menuVars.svValues == 0 imgui.Text("First SV:") svUpdateNeeded = chooseStartEndSVs(menuVars, menuVars.linearStutter) or svUpdateNeeded svUpdateNeeded = chooseStutterDuration(menuVars, menuVars.linearStutter) or svUpdateNeeded svUpdateNeeded = chooseAverageSV(menuVars, menuVars.linearStutter) or svUpdateNeeded svUpdateNeeded = chooseFinalSV(menuVars, true) or svUpdateNeeded svUpdateNeeded = chooseLinearStutter(menuVars) or svUpdateNeeded return svUpdateNeeded end -- Creates the settings menu for cubic bezier SV -- Returns whether or not SV information has changed and needs to be updated [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for this bezier menu [Table] -- menuName : name of this menu [String] function bezierSettingsMenu(globalVars, menuVars, menuName) local svUpdateNeeded = #menuVars.svValues == 0 provideLinkToBezierWebsite() svUpdateNeeded = chooseBezierPoints(menuVars) or svUpdateNeeded svUpdateNeeded = chooseAverageSV(menuVars, false) or svUpdateNeeded svUpdateNeeded = chooseSVPoints(menuVars) or svUpdateNeeded svUpdateNeeded = chooseFinalSV(menuVars, true) or svUpdateNeeded svUpdateNeeded = chooseInterlace(menuVars, menuName, false) or svUpdateNeeded chooseTeleportSV(globalVars, menuVars, menuName) chooseDisplacement(globalVars, menuVars, menuName) return svUpdateNeeded end -- Creates the settings menu for sinusoidal SV -- Returns whether or not SV information has changed and needs to be updated [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for this sinusoidal menu [Table] -- menuName : name of this menu [String] function sinusoidalSettingsMenu(globalVars, menuVars, menuName) local svUpdateNeeded = #menuVars.svValues == 0 imgui.Text("Amplitude:") svUpdateNeeded = chooseStartEndSVs(menuVars, true) or svUpdateNeeded svUpdateNeeded = chooseCurveSharpness(menuVars) or svUpdateNeeded svUpdateNeeded = chooseConstantShift(menuVars) or svUpdateNeeded svUpdateNeeded = chooseNumPeriods(menuVars) or svUpdateNeeded svUpdateNeeded = choosePeriodShift(menuVars) or svUpdateNeeded svUpdateNeeded = chooseSVPerQuarterPeriod(menuVars) or svUpdateNeeded svUpdateNeeded = chooseFinalSV(menuVars, true) or svUpdateNeeded chooseTeleportSV(globalVars, menuVars, menuName) chooseDisplacement(globalVars, menuVars, menuName) return svUpdateNeeded end -- Creates the settings menu for single SV -- Returns whether or not SV information has changed and needs to be updated [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for this single SV menu [Table] -- menuName : name of this menu [String] function singleSettingsMenu(globalVars, menuVars, menuName) if menuVars.svBefore then chooseSVBeforeNote(menuVars) end if (not menuVars.skipSVAtNote) then chooseSVAtNote(menuVars) end if menuVars.svAfter then chooseSVAfterNote(menuVars) end chooseSingleSVInputs(menuVars) return false end -- Creates the settings menu for random SV -- Returns whether or not SV information has changed and needs to be updated [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for this random SV menu [Table] -- menuName : name of this menu [String] function randomSettingsMenu(globalVars, menuVars, menuName) local svUpdateNeeded = #menuVars.svValues == 0 svUpdateNeeded = chooseRandomType(menuVars) or svUpdateNeeded svUpdateNeeded = chooseRandomScale(menuVars) or svUpdateNeeded svUpdateNeeded = chooseAverageSV(menuVars, false) or svUpdateNeeded svUpdateNeeded = chooseSVPoints(menuVars) or svUpdateNeeded svUpdateNeeded = chooseFinalSV(menuVars, true) or svUpdateNeeded chooseTeleportSV(globalVars, menuVars, menuName) chooseDisplacement(globalVars, menuVars, menuName) if (not globalVars.placeSVsBetweenOffsets) then addSeparator() end if imgui.Button("Generate New Random Set") then svUpdateNeeded = true end return svUpdateNeeded end -- Creates the settings menu for still SV -- Returns whether or not SV information has changed and needs to be updated [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for this still SV menu [Table] -- menuName : name of this menu [String] function stillSettingsMenu(globalVars, menuVars, menuName) local svUpdateNeeded = #menuVars.svValues == 0 svUpdateNeeded = chooseAverageSVStill(menuVars) or svUpdateNeeded svUpdateNeeded = chooseFinalSV(menuVars, false) or svUpdateNeeded svUpdateNeeded = chooseStillMotionType(menuVars) or svUpdateNeeded addSeparator() imgui.Text("Intermediate Motion Settings:") addPadding() local motionIsLinear = menuVars.stillIntermediateMotion == "Linear" local motionIsExponential = menuVars.stillIntermediateMotion == "Exponential" local motionIsBezier = menuVars.stillIntermediateMotion == "Bezier" local motionIsSinusoial = menuVars.stillIntermediateMotion == "Sinusoidal" if motionIsLinear then svUpdateNeeded = chooseStartEndSVs(menuVars, true) or svUpdateNeeded svUpdateNeeded = chooseSVPoints(menuVars) or svUpdateNeeded elseif motionIsExponential then svUpdateNeeded = chooseExponentialBehavior(menuVars) or svUpdateNeeded svUpdateNeeded = chooseIntensity(menuVars) or svUpdateNeeded svUpdateNeeded = chooseSVPoints(menuVars) or svUpdateNeeded elseif motionIsBezier then svUpdateNeeded = chooseBezierPoints(menuVars) or svUpdateNeeded svUpdateNeeded = chooseSVPoints(menuVars) or svUpdateNeeded elseif motionIsSinusoial then svUpdateNeeded = chooseStartEndSVs(menuVars, true) or svUpdateNeeded svUpdateNeeded = chooseCurveSharpness(menuVars) or svUpdateNeeded svUpdateNeeded = chooseConstantShift(menuVars) or svUpdateNeeded svUpdateNeeded = chooseNumPeriods(menuVars) or svUpdateNeeded svUpdateNeeded = choosePeriodShift(menuVars) or svUpdateNeeded svUpdateNeeded = chooseSVPerQuarterPeriod(menuVars) or svUpdateNeeded end if (not motionIsLinear) and (not motionIsSinusoial) then svUpdateNeeded = chooseAverageSV(menuVars, false) or svUpdateNeeded createHelpMarker("This is the average velocity of the notes following the intermediate ".. "motion") end chooseDisplacement(globalVars, menuVars, menuName) return svUpdateNeeded end -- Creates the settings menu for copy & paste SV -- Returns whether or not SV information has changed and needs to be updated [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for this copy & paste SV menu [Table] -- menuName : name of this menu [String] function copySettingsMenu(globalVars, menuVars, menuName) chooseCopySettings(menuVars) createCopyButton(menuVars) addSeparator() imgui.Text("("..#menuVars.svValues.." SVs copied currently)") return false end -- Creates the settings menu for remove SV -- Returns whether or not SV information has changed and needs to be updated [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for this remove SV menu [Table] -- menuName : name of this menu [String] function removeSettingsMenu(globalVars, menuVars, menuName) _, menuVars.addRemovalCondition = imgui.Checkbox("Add SV removal condition", menuVars.addRemovalCondition) if menuVars.addRemovalCondition then addSeparator() local _, svConditionIndex = imgui.Combo("SV Condition", menuVars.svCondition - 1, CONDITION_TESTS, #CONDITION_TESTS) menuVars.svCondition = svConditionIndex + 1 _, menuVars.svConditionValue = imgui.InputFloat("SV value", menuVars.svConditionValue, 0, 0, "%.2fx") menuVars.svConditionValue = clampToInterval(menuVars.svConditionValue, -999999, 999999) end return false end -- Creates the right-side panel for info and action buttons -- Returns whether or not this right panel is hovered over [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the current SV menu [Table] -- menuName : name of the current SV menu [String] function createRightPanel(globalVars, menuVars, menuName) imgui.BeginChild("Right Panel", MENU_SIZE_RIGHT) local isPanelHovered = imgui.IsWindowHovered() if menuName == "Still" then createStillSVPanel(globalVars, menuVars, menuName) elseif menuName == "Remove" then createRemoveSVPanel(globalVars, menuVars, menuName) elseif menuName == "Copy" then createPasteSVPanel(globalVars, menuVars, menuName) else createPlaceSVPanel(globalVars, menuVars, menuName) end imgui.EndChild() return isPanelHovered end -- Creates the right panel menu for still SVs -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the still SV menu [Table] -- menuName : name of the current SV menu [String] function createStillSVPanel(globalVars, menuVars, menuName) plotSVs(menuVars.svValuesPreview, "Intermediate Motion") displaySVStats(menuVars) addSeparator() imgui.Text("Select 3 or more notes:") addPadding() if imgui.Button("Apply Still SVs On Selected Notes", ACTION_BUTTON_SIZE) or utils.IsKeyPressed(keys.Y) then local SVs = generateStillSVs(menuVars) if #SVs > 0 then actions.PlaceScrollVelocityBatch(SVs) end end if utils.IsKeyPressed(keys.T) then local SVs = generateStillSVs(menuVars) if #SVs > 0 then removeSVs(menuVars, globalVars) actions.PlaceScrollVelocityBatch(SVs) end end end -- Creates the right panel menu for removing SVs -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the remove menu [Table] -- menuName : name of the current SV menu [String] function createRemoveSVPanel(globalVars, menuVars, menuName) chooseSVRangeType(globalVars, menuVars, menuName) if globalVars.placeSVsBetweenOffsets then addPadding() local startTime = convertToTime(menuVars.startOffset) local endTime = convertToTime(menuVars.endOffset) imgui.Text("(from "..startTime.." to "..endTime..")") end createActionSVButton(globalVars, menuVars, menuName) end -- Creates the right panel menu for pasting copied SVs -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the copy SV menu [Table] -- menuName : name of the current SV menu [String] function createPasteSVPanel(globalVars, menuVars, menuName) if imgui.Button("Place SVs at current song time", ACTION_BUTTON_SIZE) then local pasteOffsets = {math.floor(state.SongTime)} pasteSVs(menuVars.svValues, pasteOffsets) end if imgui.Button("Place SVs at selected notes", ACTION_BUTTON_SIZE) or utils.IsKeyPressed(keys.Y) then local pasteOffsets = uniqueSelectedNoteOffsets() pasteSVs(menuVars.svValues, pasteOffsets) end end -- Creates the right panel menu for displaying SV stats and placing SVs -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the current SV menu [Table] -- menuName : name of the current SV menu [String] function createPlaceSVPanel(globalVars, menuVars, menuName) if menuName == "Single" then createPlaceSingleSVButton(menuVars) return isPanelHovered end if menuVars.linearStutter then plotSVs(menuVars.svValuesPreview, "First Stutter") addSeparator() plotSVs(menuVars.svValuesSecondPreview, "Last Stutter") else plotSVMotion(menuVars.noteDistanceVsTime, not globalVars.placeSVsBetweenOffsets) addSeparator() plotSVs(menuVars.svValuesPreview, menuName) end displaySVStats(menuVars) addSeparator() chooseSVRangeType(globalVars, menuVars, menuName) createActionSVButton(globalVars, menuVars, menuName) end --------------------------------------------------------------------------------------------------- -- SV Generation/Editing/Removal Functions -------------------------------------------------------- --------------------------------------------------------------------------------------------------- -- Places SVs for the current SV menu -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the current SV menu [Table] function placeSVs(menuVars, globalVars) local offsets = {menuVars.startOffset, menuVars.endOffset} if (not globalVars.placeSVsBetweenOffsets) then offsets = uniqueSelectedNoteOffsets() end local SVs = generateSVs(offsets, menuVars.svValues, menuVars.addTeleport, menuVars.veryStartTeleport, menuVars.teleportValue, menuVars.teleportDuration, menuVars.finalSVOption, menuVars.displace, menuVars.displacement, menuVars.stutterDuration, menuVars.linearStutter, menuVars.endSV, menuVars.linearEndAvgSV, menuVars.avgSV, globalVars.placeSVsBetweenOffsets) if #SVs > 0 then actions.PlaceScrollVelocityBatch(SVs) end end -- Generates SVs to place -- Returns the generated SVs -- Parameters -- offsets : list of times to place SVs between/at [Table] -- svValues : ordered list of numerical values to turn into SVs [Table] -- addTeleport : whether or not to add a beginning teleport SV [Boolean] -- veryStartTeleport : whether or not the teleport SV is only at the very start [Boolean] -- teleportValue : SV value of the beginning teleport SV [Int/Float] -- teleportDuration : duration of the beginning teleport SV (milliseconds) [Int/Float] -- finalSVOption : option number for the type of SV placed at the very end [Int] -- displace : whether or not to displace notes [Boolean] -- displacement : displacement height of note/hitObject receptors (msx) [Int/Float] -- stutterDuration : duration % of first stutter SV (if applicable) [Int/Float] -- linearStutter : whether or not stutter linearly changes (if applicable) [Boolean] -- endSV : ending first SV of linear stutter SV (if applicable) [Int/Float] -- linearEndAvgSV : ending average SV of linear stutter SV (if applicable) [Int/Float] -- stutterAvgSV : average SV of stutter SV (if applicable) [Int/Float] -- placeSVsBetweenOffsets : whether or not SVs are placed between two offsets [Boolean] function generateSVs(offsets, svValues, addTeleport, veryStartTeleport, teleportValue, teleportDuration, finalSVOption, displace, displacement, stutterDuration, linearStutter, endSV, linearEndAvgSV, stutterAvgSV, placeSVsBetweenOffsets) local SVs = {} local startSVList = {} local avgSVList = {} local isAStutterSV = stutterDuration ~= nil if isAStutterSV and linearStutter then startSVList = generateLinearSet(svValues[1], endSV, #offsets - 1, false, 0, 0) avgSVList = generateLinearSet(stutterAvgSV, linearEndAvgSV, #offsets - 1, false, 0, 0) end for i = 1, #offsets - 1 do local startOffset = determineTeleport(offsets[i], addTeleport, veryStartTeleport, i == 1, teleportValue, teleportDuration, SVs) local endOffset = offsets[i + 1] startOffset = addDisplacementSV(SVs, placeSVsBetweenOffsets, displace, i ~= 1, addTeleport, veryStartTeleport, displacement, startOffset, endOffset) local svOffsets if isAStutterSV then local offsetInterval = endOffset - startOffset local stutterSecondOffset = startOffset + offsetInterval * stutterDuration / 100 svOffsets = {startOffset, stutterSecondOffset, endOffset} else svOffsets = generateLinearSet(startOffset, endOffset, #svValues, false, 0, 0) end if linearStutter then svValues = generateStutterSet(startSVList[i], stutterDuration, avgSVList[i]) end for j = 1, #svOffsets - 1 do table.insert(SVs, utils.CreateScrollVelocity(svOffsets[j], svValues[j])) end end addFinalSV(SVs, offsets[#offsets], svValues[#svValues], finalSVOption, displace, displacement) return SVs end -- Adds a teleport SV to the list of SVs to place if applicable -- Returns the start offset after accounting for the teleport SV [Int/Float] -- Parameters -- startOffset : starting time of note to add teleport at (milliseconds) [Int/Float] -- addTeleport : whether or not to add a teleport SV [Boolean] -- veryStartTeleport : whether or not the teleport SV is only at the very start [Boolean] -- veryFirstSet : whether or not the current SV set is the very first set [Boolean] -- teleportValue : SV value of the beginning teleport SV [Int/Float] -- teleportDuration : duration of the beginning teleport SV (milliseconds) [Int/Float] -- SVs : list of SVs to add the teleport SV to [Table] function determineTeleport(startOffset, addTeleport, veryStartTeleport, veryFirstSet, teleportValue, teleportDuration, SVs) if addTeleport then if veryFirstSet or (not veryStartTeleport) then table.insert(SVs, utils.CreateScrollVelocity(startOffset, teleportValue)) startOffset = startOffset + teleportDuration end end return startOffset end -- Adds displacement SVs to the list of SVs to place if applicable -- Returns the start offset after accounting for the displacement SV [Int/Float] -- Parameters -- SVs : list of SVs to add the displacement SV to [Table] -- placeSVsBetweenOffsets : whether or not SVs are placed between two offsets [Boolean] -- displace : whether or not to displace notes [Boolean] -- notFirstSet : whether or not the SVs are for the first set of multiple [Boolean] -- addTeleport : whether or not to add a beginning teleport SV [Boolean] -- veryStartTeleport : whether or not the teleport SV is only at the very start [Boolean] -- displacement : displacement height of note/hitObject receptors (msx) [Int/Float] -- startOffset : start time of first note to un-displace (milliseconds) [Int/Float] -- endOffset : ending time of second note to displace (milliseconds) [Int/Float] function addDisplacementSV(SVs, placeSVsBetweenOffsets, displace, notFirstSet, addTeleport, veryStartTeleport, displacement, startOffset, endOffset) if (not placeSVsBetweenOffsets) and displace then local middleTelportExists = (not addTeleport) or (addTeleport and veryStartTeleport) if notFirstSet and middleTelportExists then table.insert(SVs, utils.CreateScrollVelocity(startOffset, - displacement * 64)) startOffset = startOffset + MIN_DURATION end table.insert(SVs, utils.CreateScrollVelocity(endOffset - MIN_DURATION, displacement * 64)) end return startOffset end -- Adds the last tail-end SV to a set of SVs, also accounting for displacement -- Parameters -- SVs : list of SVs to add the displacement SV to [Table] -- endOffset : default/usual time to place the final SV at [Int/Float] -- velocity : default/usual SV value for the final SV [Int/Float] -- finalSVOption : option number for the type of SV placed at the very end [Int] -- displace : whether or not to displace notes [Boolean] -- displacement : displacement height of note/hitObject receptors (msx) [Int/Float] function addFinalSV(SVs, endOffset, velocity, finalSVOption, displace, displacement) if displace and finalSVOption ~= 2 then table.insert(SVs, utils.CreateScrollVelocity(endOffset, - displacement * 64)) endOffset = endOffset + MIN_DURATION end if finalSVOption == 1 then -- normal SV option table.insert(SVs, utils.CreateScrollVelocity(endOffset, velocity)) elseif finalSVOption == 3 then -- 1.00x SV option table.insert(SVs, utils.CreateScrollVelocity(endOffset, 1)) end end -- Generates SVs to place for the single SV tool/menu -- Returns the generated SVs -- Parameters -- skipSVAtNote : whether or not to skip placing an SV directly at the note time [Boolean] -- svBefore : whether or not to place an SV before the note [Boolean] -- svValueBefore : value of the SV to place before the note [Int/Float] -- incrementBefore : time before the note to place the before-SV (milliseconds) [Int/Float] -- svAfter : whether or not to place an SV after the note [Boolean] -- svValueAfter : value of the SV to place after the note [Int/Float] -- incrementAfter : time after the note to place the after-SV (milliseconds) [Int/Float] -- svValue : value of the SV to place directly at the note [Int/Float] -- scaleSVLinearly : whether or not to scale SV values linearly over time [Boolean] -- svValueBeforeEnd : linear end value of the SV to place before the note [Int/Float] -- svValueEnd : linear end value of the SV to place directly at the note [Int/Float] -- svValueAfterEnd : linear end value of the SV to place after the note [Int/Float] function generateSingleSVs(skipSVAtNote, svBefore, svValueBefore, incrementBefore, svAfter, svValueAfter, incrementAfter, svValue, scaleSVLinearly, svValueBeforeEnd, svValueEnd, svValueAfterEnd) local offsets = uniqueSelectedNoteOffsets() local SVs = {} local svValuesBefore = {} local svValuesAfter = {} local svValuesAt = {} if scaleSVLinearly then svValuesBefore = generateLinearSet(svValueBefore, svValueBeforeEnd, #offsets, false, 0, 0) svValuesAfter = generateLinearSet(svValueAfter, svValueAfterEnd, #offsets, false, 0, 0) svValuesAt = generateLinearSet(svValue, svValueEnd, #offsets, false, 0, 0) else svValuesBefore = generateLinearSet(svValueBefore, svValueBefore, #offsets, false, 0, 0) svValuesAfter = generateLinearSet(svValueAfter, svValueAfter, #offsets, false, 0, 0) svValuesAt = generateLinearSet(svValue, svValue, #offsets, false, 0, 0) end for i = 1, #offsets do if svBefore then table.insert(SVs, utils.CreateScrollVelocity(offsets[i] - incrementBefore, svValuesBefore[i])) end if (not skipSVAtNote) then table.insert(SVs, utils.CreateScrollVelocity(offsets[i], svValuesAt[i])) end if svAfter then table.insert(SVs, utils.CreateScrollVelocity(offsets[i] + incrementAfter, svValuesAfter[i])) end end return SVs end -- Generates Still SVs to place -- Returns the generated SVs -- Parameters -- menuVars : list of variables used for the still SV menu [Table] function generateStillSVs(menuVars) local SVs = {} local offsets = uniqueSelectedNoteOffsets() if #offsets < 3 then return SVs end local startOffset = offsets[1] local endOffset = offsets[#offsets] if menuVars.stillIntermediateMotion == "Constant" then startOffset = determineTeleport(startOffset, menuVars.displace, true, true, 64 * menuVars.displacement, MIN_DURATION, SVs) table.insert(SVs, utils.CreateScrollVelocity(startOffset, menuVars.avgSV)) for i = 2, #offsets do local timeFromStart = offsets[i] - startOffset local stillAverageDifference = menuVars.avgSVStill - menuVars.avgSV local teleportVelocity = stillAverageDifference * 64 * timeFromStart if menuVars.displace then teleportVelocity = teleportVelocity + 64 * menuVars.displacement end if i == #offsets then table.insert(SVs, utils.CreateScrollVelocity(offsets[i] - MIN_DURATION, teleportVelocity + menuVars.avgSV)) else table.insert(SVs, utils.CreateScrollVelocity(offsets[i] - MIN_DURATION, teleportVelocity + menuVars.avgSV)) table.insert(SVs, utils.CreateScrollVelocity(offsets[i], -teleportVelocity + menuVars.avgSV)) table.insert(SVs, utils.CreateScrollVelocity(offsets[i] + MIN_DURATION, menuVars.avgSV)) end end else local motionSVOffsets = generateLinearSet(startOffset, endOffset, #menuVars.svValues, false, 0, 0) startOffset = determineTeleport(startOffset, menuVars.displace, true, true, 64 * menuVars.displacement, MIN_DURATION, SVs) table.insert(SVs, utils.CreateScrollVelocity(startOffset, menuVars.svValues[1])) local svValueIndex = 1 local totalDistanceTraveled if menuVars.displace then totalDistanceTraveled = menuVars.displacement else totalDistanceTraveled = 0 end for i = 2, #offsets do local currentMotionOffset = motionSVOffsets[svValueIndex] local nextMotionOffset = motionSVOffsets[svValueIndex + 1] local noteOffset = offsets[i] while nextMotionOffset < (noteOffset - MIN_DURATION) do lastMotionSVValue = menuVars.svValues[svValueIndex] local lastMotionOffset = currentMotionOffset if math.abs(lastMotionOffset - offsets[i - 1]) > MIN_DURATION then table.insert(SVs, utils.CreateScrollVelocity(lastMotionOffset, lastMotionSVValue)) end svValueIndex = svValueIndex + 1 currentMotionOffset = motionSVOffsets[svValueIndex] nextMotionOffset = motionSVOffsets[svValueIndex + 1] local distanceTraveled = (currentMotionOffset - lastMotionOffset) * lastMotionSVValue totalDistanceTraveled = totalDistanceTraveled + distanceTraveled end if i == #offsets then while currentMotionOffset < noteOffset do lastMotionSVValue = menuVars.svValues[svValueIndex] local lastMotionOffset = currentMotionOffset table.insert(SVs, utils.CreateScrollVelocity(lastMotionOffset, lastMotionSVValue)) svValueIndex = svValueIndex + 1 currentMotionOffset = motionSVOffsets[svValueIndex] local distanceTraveled = (currentMotionOffset - lastMotionOffset) * lastMotionSVValue totalDistanceTraveled = totalDistanceTraveled + distanceTraveled end end local thisMotionSVValue = menuVars.svValues[svValueIndex] local regularNoteDistance = (noteOffset - startOffset) * menuVars.avgSVStill local totalDistanceTraveledToNote = totalDistanceTraveled + (noteOffset - currentMotionOffset) * thisMotionSVValue local teleportVelocity = (regularNoteDistance - totalDistanceTraveledToNote) * 64 if i == #offsets then table.insert(SVs, utils.CreateScrollVelocity(noteOffset - MIN_DURATION, teleportVelocity + thisMotionSVValue)) else table.insert(SVs, utils.CreateScrollVelocity(noteOffset - MIN_DURATION, teleportVelocity + thisMotionSVValue)) table.insert(SVs, utils.CreateScrollVelocity(noteOffset, -teleportVelocity + thisMotionSVValue)) if math.abs(motionSVOffsets[svValueIndex - 1] - offsets[i -1]) < MIN_DURATION then table.insert(SVs, utils.CreateScrollVelocity(noteOffset + MIN_DURATION, menuVars.svValues[svValueIndex + 1])) else table.insert(SVs, utils.CreateScrollVelocity(noteOffset + MIN_DURATION, thisMotionSVValue)) end end end end addFinalSV(SVs, endOffset, menuVars.avgSVStill, menuVars.finalSVOption, false, nil) return SVs end -- Removes SVs in the map between two points of time -- Parameters -- menuVars : list of variables used for the remove menu [Table] -- globalVars : list of global variables used across all menus [Table] function removeSVs(menuVars, globalVars) local offsets = {menuVars.startOffset, menuVars.endOffset} if (not globalVars.placeSVsBetweenOffsets) then local selectedNoteOffsets = uniqueSelectedNoteOffsets() offsets[1] = selectedNoteOffsets[1] offsets[2] = selectedNoteOffsets[#selectedNoteOffsets] end local svsToRemove = locateRemovableSVs(offsets, menuVars.addRemovalCondition, menuVars.svCondition, menuVars.svConditionValue) if #svsToRemove > 0 then actions.RemoveScrollVelocityBatch(svsToRemove) end end -- Locates SVs that are removable based on given parameters -- Returns the list of removable SVs [Table] -- Parameters -- offsets : list containing two times to remove SVs between [Table] -- addRemovalCondition : whether or not to add removal condition for SVs [Boolean] -- svCondition : number of the removal condition (of CONDITION_TESTS) [Int] -- svConditionValue : value to base the removal condition on [Int/Float] function locateRemovableSVs(offsets, addRemovalCondition, svCondition, svConditionValue) local startOffset = offsets[1] local endOffset = offsets[2] -- corrects start/end offsets if user inputted the reverse by switching them if startOffset > endOffset then startOffset = offsets[2] endOffset = offsets[1] end local roundedConditionValue = round(svConditionValue, 2) local svsToRemove = {} for i, sv in pairs(map.ScrollVelocities) do local roundedSV = round(sv.Multiplier, 2) local svIsInRange = sv.StartTime >= startOffset and sv.StartTime < endOffset if svIsInRange then if addRemovalCondition then if svCondition == 1 or svCondition == 3 or svCondition == 5 then if roundedSV == roundedConditionValue then table.insert(svsToRemove, sv) end end if svCondition == 2 or svCondition == 3 then if roundedSV > roundedConditionValue then table.insert(svsToRemove, sv) end end if svCondition == 4 or svCondition == 5 then if roundedSV < roundedConditionValue then table.insert(svsToRemove, sv) end end else table.insert(svsToRemove, sv) end end end return svsToRemove end -- Copies SVs between two times -- Returns a list of tables with values: 1. SV multiplier 2. relative offset to copy start [Table] -- Parameters -- startOffset : starting time to start copying SVs -- endOffset : ending time to stop copying SVs function copySVs(startOffset, endOffset) local SVs = {} for i, sv in pairs(map.ScrollVelocities) do if sv.StartTime >= startOffset and sv.StartTime < endOffset then local relativeTime = sv.StartTime - startOffset table.insert(SVs, {sv.Multiplier, relativeTime}) end end return SVs end -- Pastes copied SVs -- Parameters -- svValues : variable containing copied SV info (1. multiplier, 2. relative offset) [Table] -- pasteOffsets : offsets/times to paste copied SVs function pasteSVs(svValues, pasteOffsets) local svsToPaste = {} for i = 1, #pasteOffsets do local pasteOffset = pasteOffsets[i] for j = 1, #svValues do local svMultiplier = svValues[j][1] local relativeOffset = svValues[j][2] local timeToPasteSV = pasteOffset + relativeOffset table.insert(svsToPaste, utils.CreateScrollVelocity(timeToPasteSV, svMultiplier)) end end if #svsToPaste > 0 then actions.PlaceScrollVelocityBatch(svsToPaste) end end --------------------------------------------------------------------------------------------------- -- Numerical Value Generation for SVs ------------------------------------------------------------- --------------------------------------------------------------------------------------------------- -- Generates a single set of values (used for SV multipliers) -- Parameters -- menuVars : list of variables used for the current SV menu [Table] -- menuName : name of the current SV menu [String] function generateSetOfValues(menuVars, menuName) if menuName == "Linear" then return generateLinearSet(menuVars.startSV, menuVars.endSV, menuVars.svPoints + 1, menuVars.interlace, menuVars.secondStartSV, menuVars.secondEndSV) end if menuName == "Exponential" then return generateExponentialSet(menuVars.exponentialIncrease, menuVars.svPoints + 1, menuVars.avgSV, menuVars.intensity, menuVars.interlace, menuVars.interlaceMultiplier) end if menuName == "Stutter" then return generateStutterSet(menuVars.startSV, menuVars.stutterDuration, menuVars.avgSV) end if menuName == "Bezier" then return generateBezierSet(menuVars.x1, menuVars.y1, menuVars.x2, menuVars.y2, menuVars.avgSV, menuVars.svPoints + 1, menuVars.interlace, menuVars.interlaceMultiplier) end if menuName == "Sinusoidal" then return generateSinusoidalSet(menuVars.startSV, menuVars.endSV, menuVars.periods, menuVars.periodsShift, menuVars.svsPerQuarterPeriod, menuVars.verticalShift, menuVars.curveSharpness) end if menuName == "Random" then return generateRandomSet(menuVars.avgSV, menuVars.svPoints + 1, menuVars.randomType, menuVars.randomScale) end if menuName == "Constant" then return {menuVars.avgSV, menuVars.avgSV} end if menuName == "Still" then return generateSetOfValues(menuVars, menuVars.stillIntermediateMotion) end return nil end -- Generates a single set of linear values -- Returns the set of linear values [Table] -- Parameters -- startVal : starting value of the linear set [Int/Float] -- endVal : ending value of the linear set [Int/Float] -- numValues : total number of values in the linear set [Int] -- interlace : whether or not to interlace another linear set in between [Boolean] -- interStart : starting value of the linear interlace [Int/Float] -- interEnd : ending value of the linear interlace [Int/Float] function generateLinearSet(startVal, endVal, numValues, interlace, interStart, interEnd) local linearSet = {} if numValues > 1 then local increment = (endVal - startVal) / (numValues - 1) local interlaceIncrement = (interEnd - interStart) / (numValues - 1) for i = 0, numValues - 1 do table.insert(linearSet, startVal + i * increment) if interlace and (i ~= numValues - 1) then table.insert(linearSet, interStart + i * interlaceIncrement) end end elseif numValues == 1 then table.insert(linearSet, startVal) table.insert(linearSet, interStart) end return linearSet end -- Generates a single set of exponential values -- Returns the set of exponential values [Table] -- Parameters -- exponentialIncrease : whether or not the values will be exponentially increasing [Boolean] -- numValues : total number of values in the exponential set [Int] -- avgValue : average value of the set [Int/Float] -- intensity : value determining sharpness/rapidness of exponential change [Int/Float] -- interlace : whether or not to interlace another exponential set between [Boolean] -- interlaceMultiplier : multiplier of interlaced values relative to usual values [Int/Float] function generateExponentialSet(exponentialIncrease, numValues, avgValue, intensity, interlace, interlaceMultiplier) local exponentialSet = {} -- reduce intensity scaling to produce more useful/practical values intensity = intensity / 5 for i = 0, numValues - 1 do local x if exponentialIncrease then x = (i + 0.5) * intensity / numValues else x = (numValues - i - 0.5) * intensity / numValues end local velocity = (math.exp(x) / math.exp(1)) / intensity table.insert(exponentialSet, velocity) if interlace and (i ~= numValues - 1) then table.insert(exponentialSet, velocity * interlaceMultiplier) end end normalizeValues(exponentialSet, avgValue, false) return exponentialSet end -- Generates a single set of stutter values -- Returns the set of stutter values [Table] -- Parameters -- startSV : velocity of first SV in the stutter [Int/Float] -- stutterDuration : duration % of the first SV in the stutter [Float] -- avgSV : average SV of the stutter [Int/Float] function generateStutterSet(startSV, stutterDuration, avgSV) stutterSet = {startSV} table.insert(stutterSet, calculateSecondStutterValue(startSV, stutterDuration, avgSV)) return stutterSet end -- Generates a single set of cubic bezier values -- Returns the set of bezier values [Table] -- Parameters -- x1 : x-coordinate of the first (inputted) cubic bezier point [Int/Float] -- y1 : y-coordinate of the first (inputted) cubic bezier point [Int/Float] -- x2 : x-coordinate of the second (inputted) cubic bezier point [Int/Float] -- y2 : y-coordinate of the second (inputted) cubic bezier point [Int/Float] -- avgValue : average value of the set [Int/Float] -- numValues : total number of values in the bezier set [Int] -- interlace : whether or not to interlace another bezier set in between [Boolean] -- interlaceMultiplier : multiplier of interlaced values relative to usual values [Int/Float] function generateBezierSet(x1, y1, x2, y2, avgValue, numValues, interlace, interlaceMultiplier) local startingTimeGuess = 0.5 local timeGuesses = {} local targetXPositions = {} local iterations = 20 for i = 1, numValues do table.insert(timeGuesses, startingTimeGuess) table.insert(targetXPositions, i / numValues) end for i = 1, iterations do local timeIncrement = 0.5 ^ (i + 1) for j = 1, numValues do local xPositionGuess = simplifiedOneDimensionalBezier(x1, x2, timeGuesses[j]) if xPositionGuess < targetXPositions[j] then timeGuesses[j] = timeGuesses[j] + timeIncrement elseif xPositionGuess > targetXPositions[j] then timeGuesses[j] = timeGuesses[j] - timeIncrement end end end local yPositions = {} for i = 1, #timeGuesses do table.insert(yPositions, simplifiedOneDimensionalBezier(y1, y2, timeGuesses[i])) end table.insert(yPositions, 1, 0) local bezierSet = {} for i = 1, #yPositions - 1 do local velocity = (yPositions[i + 1] - yPositions[i]) * numValues table.insert(bezierSet, velocity) if interlace then table.insert(bezierSet, velocity * interlaceMultiplier) end end normalizeValues(bezierSet, avgValue, false) return bezierSet end -- Generates a single set of sinusoidal values -- Returns the set of sinusoidal values [Table] -- Parameters -- startAmplitude : starting amplitude of the sinusoidal wave [Int/Float] -- endAmplitude : ending amplitude of the sinusoidal wave [Int/Float] -- periods : number of periods/cycles of the sinusoidal wave [Int/Float] -- periodsShift : number of periods/cycles to shift the sinusoidal wave [Int/Float] -- valuesPerQuarterPeriod : number of values to calculate per quarter period/cycle [Int/Float] -- verticalShift : constant to add to each value in the set at very the end [Int/Float] -- curveSharpness : value determining the curviness of the sine curve [Int/Float] function generateSinusoidalSet(startAmplitude, endAmplitude, periods, periodsShift, valuesPerQuarterPeriod, verticalShift, curveSharpness) local sinusoidalSet = {} local quarterPeriods = 4 * periods local quarterPeriodsShift = 4 * periodsShift local totalSVs = valuesPerQuarterPeriod * quarterPeriods local amplitudes = generateLinearSet(startAmplitude, endAmplitude, totalSVs + 1, false, 0, 0) local normalizedSharpness if curveSharpness > 50 then normalizedSharpness = math.sqrt((curveSharpness - 50) * 2) else normalizedSharpness = (curveSharpness / 50) ^ 2 end for i = 0, totalSVs do local angle = (math.pi / 2) * ((i / valuesPerQuarterPeriod) + quarterPeriodsShift) local velocity = amplitudes[i + 1] * (math.abs(math.sin(angle))^(normalizedSharpness)) velocity = velocity * mathGetSignOfNum(math.sin(angle)) + verticalShift table.insert(sinusoidalSet, velocity) end return sinusoidalSet end -- Generates a single set of random values -- Returns the set of random values [Table] -- Parameters function generateRandomSet(avgValue, numValues, randomType, randomScale) local randomSet = {} for i = 1, numValues do if randomType == "Uniform" then local randomValue = avgValue + randomScale * 2 * (0.5 - math.random()) table.insert(randomSet, randomValue) end if randomType == "Normal" then -- Box-Muller transformation local u1 = math.random() local u2 = math.random() local randomIncrement = math.sqrt(-2 * math.log(u1)) * math.cos(2 * math.pi * u2) local randomValue = avgValue + randomScale * randomIncrement table.insert(randomSet, randomValue) end end normalizeValues(randomSet, avgValue, false) return randomSet end --------------------------------------------------------------------------------------------------- -- Menu Input Widgets, SORTED ALPHABETICALLY ------------------------------------------------------ --------------------------------------------------------------------------------------------------- -- Lets users choose the average SV -- Returns whether or not the average SV changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] -- chooseBothSVs : whether to choose both a start and end average or just 1 average [Boolean] function chooseAverageSV(menuVars, chooseBothSVs) local oldAvgValues = {menuVars.avgSV, menuVars.linearEndAvgSV} if chooseBothSVs then local _, newAvgValues = imgui.InputFloat2("Start/End Avg", oldAvgValues, "%.2fx") menuVars.avgSV, menuVars.linearEndAvgSV = table.unpack(newAvgValues) menuVars.avgSV = clampToInterval(menuVars.avgSV, -MAX_GENERAL_SV, MAX_GENERAL_SV) menuVars.linearEndAvgSV = clampToInterval(menuVars.linearEndAvgSV, -MAX_GENERAL_SV, MAX_GENERAL_SV) else _, menuVars.avgSV = imgui.InputFloat("Average SV", menuVars.avgSV, 0, 0, "%.2fx") menuVars.avgSV = clampToInterval(menuVars.avgSV, -MAX_GENERAL_SV, MAX_GENERAL_SV) end local startValueChanged = oldAvgValues[1] ~= menuVars.avgSV local endValueChanged = oldAvgValues[2] ~= menuVars.linearEndAvgSV return startValueChanged or endValueChanged end -- Lets users choose the average SV of a still -- Returns whether or not the average SV changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseAverageSVStill(menuVars) local oldAvg = menuVars.avgSVStill _, menuVars.avgSVStill = imgui.InputFloat("Note spacing", menuVars.avgSVStill, 0, 0, "%.2fx") menuVars.avgSVStill = clampToInterval(menuVars.avgSVStill, -MAX_GENERAL_SV, MAX_GENERAL_SV) return oldAvg ~= menuVars.avgSVStill end -- Lets users choose coordinates for two cubic bezier points -- Returns whether or not any coordinates changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseBezierPoints(menuVars) local oldFirstPoint = {menuVars.x1, menuVars.y1} local oldSecondPoint = {menuVars.x2, menuVars.y2} local _, newFirstPoint = imgui.DragFloat2("(x1, y1)", oldFirstPoint, 0.01, -1, 2, "%.2f") createHelpMarker("Coordinates of the first point of the cubic bezier") local _, newSecondPoint = imgui.DragFloat2("(x2, y2)", oldSecondPoint, 0.01, -1, 2, "%.2f") createHelpMarker("Coordinates of the second point of the cubic bezier") menuVars.x1, menuVars.y1 = table.unpack(newFirstPoint) menuVars.x2, menuVars.y2 = table.unpack(newSecondPoint) menuVars.x1 = clampToInterval(menuVars.x1, 0, 1) menuVars.y1 = clampToInterval(menuVars.y1, -1, 2) menuVars.x2 = clampToInterval(menuVars.x2, 0, 1) menuVars.y2 = clampToInterval(menuVars.y2, -1, 2) local firstXChanged = (oldFirstPoint[1] ~= menuVars.x1) local firstYChanged = (oldFirstPoint[2] ~= menuVars.y1) local secondXChanged = (oldSecondPoint[1] ~= menuVars.x2) local secondYChanged = (oldSecondPoint[2] ~= menuVars.y2) local firstPointChanged = firstXChanged or firstYChanged local secondPointChanged = secondXChanged or secondYChanged return firstPointChanged or secondPointChanged end -- Lets users choose a constant amount to shift SVs -- Returns whether or not the shift amount changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseConstantShift(menuVars) local oldShift = menuVars.verticalShift if imgui.Button("Reset ", {DEFAULT_WIDGET_WIDTH * 0.3, DEFAULT_WIDGET_HEIGHT}) then menuVars.verticalShift = 0 end imgui.SameLine(0, SAMELINE_SPACING) imgui.PushItemWidth(DEFAULT_WIDGET_WIDTH * 0.7 - SAMELINE_SPACING) _, menuVars.verticalShift = imgui.InputFloat("Vertical Shift", menuVars.verticalShift, 0, 0, "%.2fx") menuVars.verticalShift = clampToInterval(menuVars.verticalShift, -10, 10) imgui.PushItemWidth(DEFAULT_WIDGET_WIDTH) return oldShift ~= menuVars.verticalShift end -- Lets users choose how to select SVs to copy (between notes times) -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseCopySettings(menuVars) imgui.AlignTextToFramePadding() imgui.Text("Copy SVs Between:") imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Notes", not menuVars.copyBetweenOffsets) then menuVars.copyBetweenOffsets = false end imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Offsets", menuVars.copyBetweenOffsets) then menuVars.copyBetweenOffsets = true end addPadding() if menuVars.copyBetweenOffsets then local currentButtonSize = {DEFAULT_WIDGET_WIDTH * 0.4, DEFAULT_WIDGET_HEIGHT} if imgui.Button("Current", currentButtonSize) then menuVars.startOffsetCopy = state.SongTime end imgui.SameLine(0, SAMELINE_SPACING) imgui.PushItemWidth(DEFAULT_WIDGET_WIDTH * 0.75) _, menuVars.startOffsetCopy = imgui.InputInt("Start", menuVars.startOffsetCopy) menuVars.startOffsetCopy = clampToInterval(menuVars.startOffsetCopy, 0, MAX_MS_TIME) if imgui.Button(" Current ", currentButtonSize) then menuVars.endOffsetCopy = state.SongTime end imgui.SameLine(0, SAMELINE_SPACING) _, menuVars.endOffsetCopy = imgui.InputInt("End", menuVars.endOffsetCopy) menuVars.endOffsetCopy = clampToInterval(menuVars.endOffsetCopy, 0, MAX_MS_TIME) addPadding() end end -- Lets users choose SV curve sharpness -- Returns whether or not the curve sharpness changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseCurveSharpness(menuVars) local oldCurveSharpness = menuVars.curveSharpness if imgui.Button("Reset", {DEFAULT_WIDGET_WIDTH * 0.3, DEFAULT_WIDGET_HEIGHT}) then menuVars.curveSharpness = 50 end imgui.SameLine(0, SAMELINE_SPACING) imgui.PushItemWidth(DEFAULT_WIDGET_WIDTH * 0.7 - SAMELINE_SPACING) _, menuVars.curveSharpness = imgui.DragInt("Curve Sharpness", menuVars.curveSharpness, 1, 1, 100, "%d%%") menuVars.curveSharpness = clampToInterval(menuVars.curveSharpness, 1, 100) imgui.PushItemWidth(DEFAULT_WIDGET_WIDTH) return oldCurveSharpness ~= menuVars.curveSharpness end -- Lets users choose displacement SV options -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the current SV menu [Table] -- menuName : name of the current SV menu [String] function chooseDisplacement(globalVars, menuVars, menuName) addSeparator() if (globalVars.placeSVsBetweenOffsets and menuName ~= "Still") then return end if menuName == "Still" then _, menuVars.displace = imgui.Checkbox("Add initial displacement to still", menuVars.displace) else _, menuVars.displace = imgui.Checkbox("Displace ends notes", menuVars.displace) createHelpMarker("Shifts the note/hit-object receptor up or down, changing how high ".. "notes are hit on the screen") end if menuVars.displace then _, menuVars.displacement = imgui.InputFloat("Height", menuVars.displacement, 0, 0, "%.2f msx") menuVars.displacement = clampToInterval(menuVars.displacement, -MAX_GENERAL_SV, MAX_GENERAL_SV) createHelpMarker("("..round(64 * menuVars.displacement, 2).."x 1/64 ms SV)") end end -- Lets users choose the exponential behavior (speed up or slow down) -- Returns whether or not the exponential behavior changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseExponentialBehavior(menuVars) imgui.AlignTextToFramePadding() imgui.Text("Behavior:") local oldBehavior = menuVars.exponentialIncrease imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Slow down", not menuVars.exponentialIncrease) then menuVars.exponentialIncrease = false end imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Speed up", menuVars.exponentialIncrease) then menuVars.exponentialIncrease = true end return oldBehavior ~= menuVars.exponentialIncrease end -- Lets users choose the final SV to place at the end -- Returns whether or not the final SV type changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] -- noNormal : whether or not to include the "Normal" type option [Boolean] function chooseFinalSV(menuVars, noNormal) local oldOption = menuVars.finalSVOption local startIndex = 1 if noNormal then startIndex = 2 end addPadding() imgui.AlignTextToFramePadding() imgui.Text("Final SV:") createToolTip("This is the very last SV placed at the end of all SVs") imgui.SameLine(0, SAMELINE_SPACING) for i = startIndex, #FINAL_SV_TYPES do if i ~= startNum then imgui.SameLine(0, RADIO_BUTTON_SPACING) end _, menuVars.finalSVOption = imgui.RadioButton(FINAL_SV_TYPES[i], menuVars.finalSVOption, i) end return oldOption ~= menuVars.finalSVOption end -- Lets users choose the intensity of something (like SV curve) -- Returns whether or not the intensity changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseIntensity(menuVars) local oldIntensity = menuVars.intensity _, menuVars.intensity = imgui.SliderInt("Intensity", menuVars.intensity, 1, 100, menuVars.intensity.."%%") menuVars.intensity = clampToInterval(menuVars.intensity, 1, 100) return oldIntensity ~= menuVars.intensity end -- Lets users choose interlace SV options -- Returns whether or not interlace settings changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] -- menuName : name of the current menu [String] -- isLinear : whether or not the interlace is a linear set [Boolean] function chooseInterlace(menuVars, menuName, isLinear) menuName = string.lower(menuName) addSeparator() local oldInterlace = menuVars.interlace local oldMultiplier = menuVars.interlaceMultiplier local oldInterlaceValues = {menuVars.secondStartSV, menuVars.secondEndSV} _, menuVars.interlace = imgui.Checkbox("Interlace another "..menuName, menuVars.interlace) createHelpMarker("Adds another set of "..menuName.." SVs in-between the regular set of SVs") if menuVars.interlace then if isLinear then local _, newInterlaceValues = imgui.InputFloat2("Start/End SV ", oldInterlaceValues, "%.2fx") menuVars.secondStartSV, menuVars.secondEndSV = table.unpack(newInterlaceValues) menuVars.secondStartSV = clampToInterval(menuVars.secondStartSV, -MAX_GENERAL_SV, MAX_GENERAL_SV) menuVars.secondEndSV = clampToInterval(menuVars.secondEndSV, -MAX_GENERAL_SV, MAX_GENERAL_SV) else _, menuVars.interlaceMultiplier = imgui.InputFloat("Lace multiplier", menuVars.interlaceMultiplier, 0, 0, "%.2f") menuVars.interlaceMultiplier = clampToInterval(menuVars.interlaceMultiplier, -MAX_GENERAL_SV, MAX_GENERAL_SV) end end local interlaceChanged = oldInterlace ~= menuVars.interlace local multiplierChanged = oldMultiplier ~= menuVars.interlaceMultiplier local secondStartSVChanged = oldInterlaceValues[1] ~= menuVars.secondStartSV local secondEndSVChanged = oldInterlaceValues[2] ~= menuVars.secondEndSV return interlaceChanged or multiplierChanged or secondStartSVChanged or secondEndSVChanged end -- Lets users choose the linear stutter option -- Returns whether or not the chosen linear stutter option changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseLinearStutter(menuVars) addSeparator() local oldLinearStutter = menuVars.linearStutter _, menuVars.linearStutter = imgui.Checkbox("Change stutter values linearly over time", menuVars.linearStutter) return oldLinearStutter ~= menuVars.linearStutter end -- Lets users choose the number of periods (for a sinusoidal wave) -- Returns whether or not the number of periods changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseNumPeriods(menuVars) addSeparator() local oldPeriods = menuVars.periods _, menuVars.periods = imgui.InputFloat("Periods/Cycles", menuVars.periods, 0.25, 0.25, "%.2f") menuVars.periods = forceQuarter(menuVars.periods) menuVars.periods = clampToInterval(menuVars.periods, 0.25, 20) return oldPeriods ~= menuVars.periods end -- Lets users choose the number of periods to shift over (for a sinusoidal wave) -- Returns whether or not the period shift value changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function choosePeriodShift(menuVars) local oldPeriodsShift = menuVars.periodsShift _, menuVars.periodsShift = imgui.InputFloat("Phase Shift", menuVars.periodsShift, 0.25, 0.25, "%.2f") menuVars.periodsShift = forceQuarter(menuVars.periodsShift) menuVars.periodsShift = clampToInterval(menuVars.periodsShift, -0.75, 0.75) return oldPeriodsShift ~= menuVars.periodsShift end -- Lets users choose the variability of randomness -- Returns whether or not the variability value changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseRandomScale(menuVars) local oldScale = menuVars.randomScale _, menuVars.randomScale = imgui.InputFloat("Random Range", menuVars.randomScale, 0, 0, "%.2fx") menuVars.randomScale = clampToInterval(menuVars.randomScale, -MAX_GENERAL_SV, MAX_GENERAL_SV) return oldScale ~= menuVars.randomScale end -- Lets users choose the type of random generation -- Returns whether or not the type of random generation changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseRandomType(menuVars) local oldRandomType = menuVars.randomType imgui.AlignTextToFramePadding() imgui.Text("Random Distribution Type:") if imgui.RadioButton("Uniform", menuVars.randomType == "Uniform") then menuVars.randomType = "Uniform" end imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Normal", menuVars.randomType == "Normal") then menuVars.randomType = "Normal" end addSeparator() return oldRandomType ~= menuVars.randomType end -- Lets users choose SV input options for the single SV menu -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseSingleSVInputs(menuVars) local inputExists = menuVars.svBefore or (not menuVars.skipSVAtNote) or menuVars.svAfter if inputExists then addSeparator() end _, menuVars.svBefore = imgui.Checkbox("Add SV before note", menuVars.svBefore) _, menuVars.svAfter = imgui.Checkbox("Add SV after note", menuVars.svAfter) _, menuVars.skipSVAtNote = imgui.Checkbox("Skip SV at note", menuVars.skipSVAtNote) _, menuVars.scaleSVLinearly = imgui.Checkbox("Scale SV values linearly over time", menuVars.scaleSVLinearly) end -- Lets users choose a start and end SV value -- Returns whether or not the start and/or end SV value changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] -- chooseBothSVs : whether or not to choose both start an end or just start SV values [Boolean] function chooseStartEndSVs(menuVars, chooseBothSVs) local oldStartEndValues = {menuVars.startSV, menuVars.endSV} if chooseBothSVs then local _, newStartEndValues = imgui.InputFloat2("Start/End SV", oldStartEndValues, "%.2fx") menuVars.startSV, menuVars.endSV = table.unpack(newStartEndValues) menuVars.startSV = clampToInterval(menuVars.startSV, -MAX_GENERAL_SV, MAX_GENERAL_SV) menuVars.endSV = clampToInterval(menuVars.endSV, -MAX_GENERAL_SV, MAX_GENERAL_SV) else _, menuVars.startSV = imgui.InputFloat("Start SV", menuVars.startSV, 0, 0, "%.2fx") menuVars.startSV = clampToInterval(menuVars.startSV, -MAX_GENERAL_SV, MAX_GENERAL_SV) end local startValueChanged = oldStartEndValues[1] ~= menuVars.startSV local endValueChanged = oldStartEndValues[2] ~= menuVars.endSV return startValueChanged or endValueChanged end -- Lets users choose the still SV motion type -- Returns whether or not the motion type changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseStillMotionType(menuVars) addSeparator() local oldType = menuVars.stillIntermediateMotion imgui.Text("Intermediate Motion:") if imgui.RadioButton("Constant Velocity", menuVars.stillIntermediateMotion == "Constant") then menuVars.stillIntermediateMotion = "Constant" end imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Linear", menuVars.stillIntermediateMotion == "Linear") then menuVars.stillIntermediateMotion = "Linear" end if imgui.RadioButton("Exponential", menuVars.stillIntermediateMotion == "Exponential") then menuVars.stillIntermediateMotion = "Exponential" end imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Bezier", menuVars.stillIntermediateMotion == "Bezier") then menuVars.stillIntermediateMotion = "Bezier" end imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Sinusoidal", menuVars.stillIntermediateMotion == "Sinusoidal") then menuVars.stillIntermediateMotion = "Sinusoidal" end return oldType ~= menuVars.stillIntermediateMotion end -- Lets users choose the stutter duration -- Returns whether or not the stutter duration changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseStutterDuration(menuVars) local oldDuration = menuVars.stutterDuration _, menuVars.stutterDuration = imgui.SliderInt("Duration", menuVars.stutterDuration, 1, 99, menuVars.stutterDuration.."%%") menuVars.stutterDuration = clampToInterval(menuVars.stutterDuration, 1, 99) addSeparator() return oldDuration ~= menuVars.stutterDuration end -- Lets users choose the single SV to place after a note -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseSVAfterNote(menuVars) if menuVars.svBefore or (not menuVars.skipSVAtNote) then addPadding() end imgui.Text("After note:") if menuVars.scaleSVLinearly then local afterSVValues = {menuVars.svValueAfter, menuVars.svValueAfterEnd} _, afterSVValues = imgui.InputFloat2("Start/End SV ", afterSVValues, "%.2fx") menuVars.svValueAfter, menuVars.svValueAfterEnd = table.unpack(afterSVValues) menuVars.svValueAfterEnd = clampToInterval(menuVars.svValueAfterEnd, -MAX_TELEPORT_VALUE, MAX_TELEPORT_VALUE) else _, menuVars.svValueAfter = imgui.InputFloat("SV value ", menuVars.svValueAfter, 0, 0, "%.2fx") end menuVars.svValueAfter = clampToInterval(menuVars.svValueAfter, -MAX_TELEPORT_VALUE, MAX_TELEPORT_VALUE) _, menuVars.incrementAfter = imgui.InputFloat("Time After", menuVars.incrementAfter, 0, 0, "%.3f ms") menuVars.incrementAfter = clampToInterval(menuVars.incrementAfter, MIN_DURATION, MAX_DURATION) end -- Lets users choose the single SV to place at a note -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseSVAtNote(menuVars) if menuVars.svBefore then addPadding() end imgui.Text("At note:") if menuVars.scaleSVLinearly then local atNoteSVValues = {menuVars.svValue, menuVars.svValueEnd} _, atNoteSVValues = imgui.InputFloat2("Start/End SV ", atNoteSVValues, "%.2fx") menuVars.svValue, menuVars.svValueEnd = table.unpack(atNoteSVValues) menuVars.svValueEnd = clampToInterval(menuVars.svValueEnd, -MAX_TELEPORT_VALUE, MAX_TELEPORT_VALUE) else _, menuVars.svValue = imgui.InputFloat("SV value ", menuVars.svValue, 0, 0, "%.2fx") end menuVars.svValue = clampToInterval(menuVars.svValue, -MAX_TELEPORT_VALUE, MAX_TELEPORT_VALUE) end -- Lets users choose the single SV to place before a note -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseSVBeforeNote(menuVars) imgui.Text("Before note:") if menuVars.scaleSVLinearly then local beforeSVValues = {menuVars.svValueBefore, menuVars.svValueBeforeEnd} _, beforeSVValues = imgui.InputFloat2("Start/End SV", beforeSVValues, "%.2fx") menuVars.svValueBefore, menuVars.svValueBeforeEnd = table.unpack(beforeSVValues) menuVars.svValueBeforeEnd = clampToInterval(menuVars.svValueBeforeEnd, -MAX_TELEPORT_VALUE, MAX_TELEPORT_VALUE) else _, menuVars.svValueBefore = imgui.InputFloat("SV value", menuVars.svValueBefore, 0, 0, "%.2fx") end menuVars.svValueBefore = clampToInterval(menuVars.svValueBefore, -MAX_TELEPORT_VALUE, MAX_TELEPORT_VALUE) _, menuVars.incrementBefore = imgui.InputFloat("Time before", menuVars.incrementBefore, 0, 0, "%.3f ms") menuVars.incrementBefore = clampToInterval(menuVars.incrementBefore, MIN_DURATION, MAX_DURATION) end -- Lets users choose the number of SV points per quarter period (for sinusoidal wave) -- Returns whether or not the number of SVs changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseSVPerQuarterPeriod(menuVars) addPadding() imgui.Text("For every 0.25 period/cycle, place...") local oldPerQuarterPeriod = menuVars.svsPerQuarterPeriod _, menuVars.svsPerQuarterPeriod = imgui.InputInt("SV points", menuVars.svsPerQuarterPeriod) menuVars.svsPerQuarterPeriod = clampToInterval(menuVars.svsPerQuarterPeriod, 1, 128) return oldPerQuarterPeriod ~= menuVars.svsPerQuarterPeriod end -- Lets users choose the number of SVs points -- Returns whether or not the number of SVs points changed [Boolean] -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function chooseSVPoints(menuVars) local oldSVPoints = menuVars.svPoints _, menuVars.svPoints = imgui.InputInt("SV points", menuVars.svPoints, 1, 1) menuVars.svPoints = clampToInterval(menuVars.svPoints, 1, 128) return oldSVPoints ~= menuVars.svPoints end -- Lets users choose how to place SVs -- Returns whether or not the option for how to place SVs changed [Boolean] -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the current SV menu [Table] -- menuName : name of the current SV menu [String] function chooseSVRangeType(globalVars, menuVars, menuName) imgui.AlignTextToFramePadding() if menuName == "Remove" then imgui.Text("Remove SVs between:") else imgui.Text("Place SVs between:") end imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Notes", not globalVars.placeSVsBetweenOffsets) then globalVars.placeSVsBetweenOffsets = false end imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Offsets", globalVars.placeSVsBetweenOffsets) then globalVars.placeSVsBetweenOffsets = true menuVars.displace = false end addPadding() if globalVars.placeSVsBetweenOffsets then local currentButtonSize = {DEFAULT_WIDGET_WIDTH * 0.4, DEFAULT_WIDGET_HEIGHT} if imgui.Button("Current", currentButtonSize) then menuVars.startOffset = state.SongTime end imgui.SameLine(0, SAMELINE_SPACING) imgui.PushItemWidth(DEFAULT_WIDGET_WIDTH * 0.75) _, menuVars.startOffset = imgui.InputInt("Start Offset", menuVars.startOffset) menuVars.startOffset = clampToInterval(menuVars.startOffset, 0, MAX_MS_TIME) if imgui.Button(" Current ", currentButtonSize) then menuVars.endOffset = state.SongTime end imgui.SameLine(0, SAMELINE_SPACING) _, menuVars.endOffset = imgui.InputInt("End Offset", menuVars.endOffset) menuVars.endOffset = clampToInterval(menuVars.endOffset, 0, MAX_MS_TIME) addPadding() end end -- Lets users choose teleport SV options -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the current SV menu [Table] -- menuName : name of the current SV menu [String] function chooseTeleportSV(globalVars, menuVars, menuName) addSeparator() _, menuVars.addTeleport = imgui.Checkbox("Add teleport SV at beginning", menuVars.addTeleport) createHelpMarker("Adds a big (or small) SV at the beginning of the SV set that lasts for a ".. "short time") if menuVars.addTeleport then _, menuVars.teleportValue = imgui.InputFloat("Teleport SV", menuVars.teleportValue, 0, 0, "%.2fx") menuVars.teleportValue = clampToInterval(menuVars.teleportValue, -MAX_TELEPORT_VALUE, MAX_TELEPORT_VALUE) _, menuVars.teleportDuration = imgui.InputFloat("Duration", menuVars.teleportDuration, 0, 0, "%.3f ms") menuVars.teleportDuration = clampToInterval(menuVars.teleportDuration, MIN_DURATION, MAX_TELEPORT_DURATION) if (not globalVars.placeSVsBetweenOffsets) then addPadding() if imgui.RadioButton("Very start", menuVars.veryStartTeleport) then menuVars.veryStartTeleport = true end imgui.SameLine(0, RADIO_BUTTON_SPACING) if imgui.RadioButton("Every "..string.lower(menuName).." set", not menuVars.veryStartTeleport) then menuVars.veryStartTeleport = false end end end end --------------------------------------------------------------------------------------------------- -- Math/Calculation Functions --------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------- Graph/Plot Related -- Calculates distance vs time values of a note given a set of SV values -- Returns the list of distances [Table] -- Parameters -- svValues : set of SV values [Table] -- stutterDuration : duration of stutter SV (if applicable) [Int/Float] function calculateDistanceVsTime(svValues, stutterDuration) local distance = 0 local distancesBackwards = {distance} if stutterDuration ~= nil then -- stutter for i = 1, 100 do if i < (100 - stutterDuration) then distance = distance + svValues[2] else distance = distance + svValues[1] end table.insert(distancesBackwards, distance) end else -- non-stutter local svValuesBackwards = getReverseTable(svValues, true) for i = 1, #svValuesBackwards do distance = distance + svValuesBackwards[i] table.insert(distancesBackwards, distance) end end return getReverseTable(distancesBackwards, false) end -- Calculates the minimum and maximum scale of a plot -- Returns the minimum scale and maximum scale [Int/Float] -- Parameters -- values : set of numbers to calculate plot scale for [Table] function calculatePlotScale(values) local min = math.min(table.unpack(values)) local max = math.max(table.unpack(values)) local absMax = math.max(math.abs(min), math.abs(max)) -- as the default, set the plot range to +- the absolute max value local minScale = -absMax local maxScale = absMax -- restrict the plot range to non-positive values when all values are non-positive if max <= 0 then maxScale = 0 -- restrict the plot range to non-negative values when all values are non-negative elseif min >= 0 then minScale = 0 end return minScale, maxScale end -- Creates a distance vs time graph/plot of SV motion -- Parameters -- noteDistances : list of note distances [Table] -- forNotes : whether or SV motion is describing notes [Boolean] function plotSVMotion(noteDistances, forNotes) if forNotes then imgui.Text("Projected Note Motion (Distance vs Time):") else imgui.Text("Projected Motion (Distance vs Time):") end minScale, maxScale = calculatePlotScale(noteDistances) imgui.PlotLines(" ", noteDistances, #noteDistances, 0, "", minScale, maxScale, {ACTION_BUTTON_SIZE[1], 100}) end -- Creates a bar graph/plot of SVs -- Parameters -- svVals : list of numerical SV values [Table] -- svName : name of the SV type being plotted [String] function plotSVs(svVals, svName) imgui.Text("Projected "..svName.." SVs:") minScale, maxScale = calculatePlotScale(svVals) imgui.PlotHistogram(" ", svVals, #svVals, 0, "", minScale, maxScale, {ACTION_BUTTON_SIZE[1], 100}) end ------------------------------------------------------------ Non-Graph/Plot * SORTED ALPHABETICALLY -- Calculates the second SV value for a stutter SV -- Returns the second SV value for the stutter SV [Int/Float] -- Parameters -- startSV : velocity of first SV in the stutter [Int/Float] -- stutterDuration : duration (percentage) of the first SV in the stutter [Float] -- avgSV : average SV of the stutter [Int/Float] function calculateSecondStutterValue(startSV, stutterDuration, avgSV) local durationPercent = stutterDuration / 100 return (avgSV - startSV * durationPercent) / (1 - durationPercent) end -- Restricts a number to be within a closed interval -- Returns the result of the restriction [Int/Float] -- Parameters -- x : number to keep within the interval [Int/Float] -- lowerBound : lower bound of the interval [Int/Float] -- upperBound : upper bound of the interval [Int/Float] function clampToInterval(x, lowerBound, upperBound) if x < lowerBound then return lowerBound end if x > upperBound then return upperBound end return x end -- ** Note ** The built-in utils.MillisecondsToTime function already exists for Quaver, but doesn't -- display hours. A slightly more efficient way to code the function below is to concatenate the -- hours to the output of the utils.MillisecondsToTime function (if hours > 0). I already coded -- this function before knowing this fact though, so I'm leaving this function as is. -- -- Converts a given amount of time in milliseconds to hh:mm:ss format -- Returns the converted time as text [String] -- Parameters -- milliseconds : time in milliseconds to be converted [Int/Float] function convertToTime(milliseconds) -- if-statement below is needed or else the returned string is messed up when milliseconds is -- equal to negative zero if milliseconds == 0 then return "00:00.000" end local millisecondsLeft = milliseconds local hours = math.floor(millisecondsLeft / (1000 * 60 * 60)) millisecondsLeft = millisecondsLeft % (1000 * 60 * 60) local minutes = math.floor(millisecondsLeft / (1000 * 60)) millisecondsLeft = millisecondsLeft % (1000 * 60) local seconds = math.floor(millisecondsLeft / 1000) millisecondsLeft = millisecondsLeft % 1000 local time = "" if hours > 0 then time = hours..":" end if minutes < 10 then time = time.."0" end time = time..minutes..":" if seconds < 10 then time = time.."0" end time = time..seconds.."." if millisecondsLeft < 10 then time = time.."0" end if millisecondsLeft < 100 then time = time.."0" end -- have the time displayed down to the millisecond, no fractions of a millisecond time = time..(math.floor(millisecondsLeft)) return time end -- Forces a number to be a multiple of one quarter (0.25) -- Returns the result of the force [Int/Float] -- Parameters -- x : number to force to be a multiple of one quarter [Int/Float] function forceQuarter(x) return (math.floor(x * 4 + 0.5)) / 4 end -- Calculates the average value of a set of numbers -- Returns the average value of the set [Int/Float] -- Parameters -- values : set of numbers [Table] -- includeLastValueInAverage : whether or not to include the last value in the average [Boolean] function getAverage(values, includeLastValueInAverage) if #values == 0 or ((not includeLastValueInAverage) and #values == 1) then return nil end if includeLastValueInAverage then return totalSum(values, includeLastValueInAverage) / #values else return totalSum(values, includeLastValueInAverage) / (#values - 1) end end -- Returns the sign of a number: +1 if the number is non-negative and -1 if negative [Int] -- Parameters -- x : number to get the sign of function mathGetSignOfNum(x) if x < 0 then return -1 end return 1 end -- Normalizes a set of values to achieve a target average -- Parameters -- values : set of numbers [Table] -- targetAverage : average value that is aimed for [Int/Float] -- includeLastValueInAverage : whether or not to include the last value in the average [Boolean] function normalizeValues(values, targetAverage, includeLastValueInAverage) local valuesAverage = getAverage(values, includeLastValueInAverage) for i = 1, #values do values[i] = (values[i] * targetAverage) / valuesAverage end end -- Rounds a number to a given amount of decimal places -- Returns the rounded number [Int/Float] -- Parameters -- x : number to round [Table] -- decimalPlaces : number of decimal places to round the number to [Int] function round(x, decimalPlaces) local multiplier = 10 ^ decimalPlaces return math.floor(x * multiplier + 0.5) / multiplier end -- Evaluates a simplified one-dimensional cubic bezier expression for SV value generation purposes -- Returns the result of the bezier evaluation -- Parameters -- v1 : second coordinate of the actual cubic bezier, first for the SV plugin input [Int/Float] -- v2 : third coordinate of the actual cubic bezier, second for the SV plugin input [Int/Float] -- t : time to evaluate the cubic bezier at [Int/Float] function simplifiedOneDimensionalBezier(v1, v2, t) -- this simplified 1-D cubic bezier has points (0, v1, v2, 1) rather than (v1, v2, v3, v4) -- this plugin evaluates those points for both x and y: (0, x1, x2, 1), (0, y1, y2, 1) return 3*t*(1-t)^2*v1 + 3*t^2*(1-t)*v2 + t^3 end -- Calculates the total sum of a set of numbers -- Returns the total sum of the set [Int/Float] -- Parameters -- values : set of numbers [Table] -- includeLastValue : whether or not to include the last value in the sum [Boolean] function totalSum(values, includeLastValue) local sum = 0 local endIndex = #values if (not includeLastValue) then endIndex = endIndex - 1 end for i = 1, endIndex do sum = sum + values[i] end return sum end --------------------------------------------------------------------------------------------------- -- Variable Management ---------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- -- Declares/initiates a menu-specific list of variables -- Returns the list of variables for that menu [Table] -- Parameters -- menuName : name of the current SV menu [String] function declareMenuVariables(menuName) -- default/baseline template menu variables local menuVars = { startSV = 2, endSV = 0, curveSharpness = 50, verticalShift = 0, stutterDuration = nil, exponentialIncrease = false, intensity = 30, periods = 1, periodsShift = 0.25, avgSV = 1, svsPerQuarterPeriod = 8, svPoints = 16, finalSVOption = 1, linearStutter = false, linearEndAvgSV = 1, interlace = false, interlaceMultiplier = -0.5, secondStartSV = -1, secondEndSV = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 1, addTeleport = false, veryStartTeleport = false, teleportValue = 10000, teleportDuration = 1.000, displace = false, displacement = 150, svValues = {}, svValuesPreview = {}, svValuesSecondPreview = {}, noteDistanceVsTime = {}, skipSVAtNote = false, svBefore = false, svValueBefore = 0, incrementBefore = 0.125, svAfter = false, svValueAfter = 0, incrementAfter = 0.125, svValue = 1, scaleSVLinearly = false, svValueBeforeEnd = 0, svValueEnd = 1, svValueAfterEnd = 0, addRemovalCondition = false, svCondition = 1, svConditionValue = 0, startOffset = 0, endOffset = 0, copyBetweenOffsets = false, startOffsetCopy = 0, endOffsetCopy = 0, randomType = "Uniform", randomScale = 1, avgSVStill = 0.5, stillIntermediateMotion = "Constant" } if menuName == "Stutter" then menuVars.startSV = 1.5 menuVars.endSV = 2 menuVars.stutterDuration = 50 menuVars.finalSVOption = 2 elseif menuName == "Bezier" then menuVars.finalSVOption = 2 elseif menuName == "Sinusoidal" then menuVars.endSV = 2 menuVars.finalSVOption = 2 elseif menuName == "Random" then menuVars.finalSVOption = 2 elseif menuName == "Still" then menuVars.avgSV = 0 end return menuVars end -- Retrieves variables from the state -- Parameters -- menuName : name of the current SV menu [String] -- variables : list of variables for the current SV menu [Table] function retrieveStateVariables(menuName, variables) for key, value in pairs(variables) do variables[key] = state.GetValue(menuName..key) or value end end -- Saves variables to the state -- Parameters -- menuName : name of the current SV menu [String] -- variables : list of variables for the current SV menu [Table] function saveStateVariables(menuName, variables) for key, value in pairs(variables) do state.SetValue(menuName..key, value) end end --------------------------------------------------------------------------------------------------- -- Extra GUI elements ----------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- -- Adds vertical blank space/padding on the GUI function addPadding() imgui.Dummy({0, 0}) end -- Draws a horizontal line separator on the GUI function addSeparator() addPadding() imgui.Separator() addPadding() end -- Creates a tooltip box when an IMGUI item is hovered over -- Parameters -- text : text to appear in the tooltip box function createToolTip(text) if imgui.IsItemHovered() then imgui.BeginTooltip() imgui.PushTextWrapPos(imgui.GetFontSize() * 20) imgui.Text(text) imgui.PopTextWrapPos() imgui.EndTooltip() end end -- Creates an inline, grayed-out '(?)' symbol that shows a tooltip box when hovered over -- Parameters -- text : text to appear in the tooltip box function createHelpMarker(text) imgui.SameLine() imgui.TextDisabled("(?)") createToolTip(text) end --------------------------------------------------------------------------------------------------- -- All other calculator/helper functions, SORTED ALPHABETICALLY ----------------------------------- --------------------------------------------------------------------------------------------------- -- Creates the action button to do something with SVs -- Parameters -- globalVars : list of global variables used across all menus [Table] -- menuVars : list of variables used for the current SV menu [Table] -- menuName : name of the current SV menu [String] function createActionSVButton(globalVars, menuVars, menuName) local svButtonText = "SVs " if menuName == "Remove" then svButtonText = "Remove ".. svButtonText else svButtonText = "Place ".. svButtonText end if globalVars.placeSVsBetweenOffsets then svButtonText = svButtonText.."Between Start/End Offsets" else svButtonText = svButtonText.."Between Selected Notes" end if imgui.Button(svButtonText, ACTION_BUTTON_SIZE) or utils.IsKeyPressed(keys.Y) then if menuName == "Remove" then removeSVs(menuVars, globalVars) else placeSVs(menuVars, globalVars) end end createToolTip("Alternatively, press ' Y ' on your keyboard to place SVs and ' T ' to replace".. " (delete old and place new) SVs") if utils.IsKeyPressed(keys.T) then removeSVs(menuVars, globalVars) placeSVs(menuVars, globalVars) end end -- Creates the copy SV button -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function createCopyButton(menuVars) local buttonText = "Copy SVs Between " if menuVars.copyBetweenOffsets then buttonText = buttonText.."Offsets" else buttonText = buttonText.."Notes" end if imgui.Button(buttonText, {240, ACTION_BUTTON_SIZE[2]}) then if (not menuVars.copyBetweenOffsets) then local selectedNoteOffsets = uniqueSelectedNoteOffsets() local startOffset = selectedNoteOffsets[1] local endOffset = selectedNoteOffsets[#selectedNoteOffsets] menuVars.svValues = copySVs(startOffset, endOffset) else menuVars.svValues = copySVs(menuVars.startOffsetCopy, menuVars.endOffsetCopy) end end end -- Creates the place single SV button -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function createPlaceSingleSVButton(menuVars) if imgui.Button("Place SVs At Selected Notes", ACTION_BUTTON_SIZE) or utils.IsKeyPressed(keys.Y) then local SVs = generateSingleSVs(menuVars.skipSVAtNote, menuVars.svBefore, menuVars.svValueBefore, menuVars.incrementBefore, menuVars.svAfter, menuVars.svValueAfter, menuVars.incrementAfter, menuVars.svValue, menuVars.scaleSVLinearly, menuVars.svValueBeforeEnd, menuVars.svValueEnd, menuVars.svValueAfterEnd) if #SVs > 0 then actions.PlaceScrollVelocityBatch(SVs) end end end -- Calculates and displays info/stats about the current menu's projected SVs -- Parameters -- menuVars : list of variables used for the current SV menu [Table] function displaySVStats(menuVars) imgui.Columns(2, "SV Stats", false) if menuVars.stutterDuration == nil then -- non-stutter SV local svValuesAverage = round(getAverage(menuVars.svValues, false), 2) local tempLastValue = table.remove(menuVars.svValues, #menuVars.svValues) local maxSV = round(math.max(table.unpack(menuVars.svValues)), 2) local minSV = round(math.min(table.unpack(menuVars.svValues)), 2) table.insert(menuVars.svValues, tempLastValue) imgui.Text("Max SV:") imgui.Text("Min SV:") imgui.Text("Average SV:") imgui.NextColumn() imgui.Text(maxSV.."x") imgui.Text(minSV.."x") imgui.Text(svValuesAverage.."x") else -- stutter SV if menuVars.linearStutter then -- linearly varying stutter local firstSV = round(menuVars.svValues[1], 2) local secondSV = round(menuVars.svValues[2], 2) local endFirstSV = round(menuVars.svValuesSecondPreview[1], 2) local endSecondSV = round(menuVars.svValuesSecondPreview[2], 2) local roundedAvgSV = round(menuVars.avgSV, 2) local roundedEndAvgSV = round(menuVars.linearEndAvgSV, 2) imgui.Text("First SVs:") imgui.Text("Second SVs:") imgui.Text("Stutter Averages:") imgui.NextColumn() imgui.Text(firstSV.."x --> "..endFirstSV.."x") imgui.Text(secondSV.."x --> "..endSecondSV.."x") imgui.Text(roundedAvgSV.."x -->"..roundedEndAvgSV.."x") else -- non-linearly varying stutter local firstSV = round(menuVars.svValues[1], 2) local firstDurationPerc = menuVars.stutterDuration local secondDurationPerc = 100 - firstDurationPerc local secondSV = round(menuVars.svValues[2], 2) local roundedAvgSV = round(menuVars.avgSV, 2) imgui.Text("Stutter First SV:") imgui.Text("Stutter Second SV:") imgui.Text("Stutter Average SV:") imgui.NextColumn() imgui.Text(firstSV.."x ("..firstDurationPerc.."%% duration)") imgui.Text(secondSV.."x ("..secondDurationPerc.."%% duration)") imgui.Text(roundedAvgSV.."x") end end imgui.Columns(1) end -- Constructs a new table from an old table with the order reversed -- Returns the reversed table [Table] -- Parameters -- oldTable : table to be reversed [Table] -- skipLastValue : whether or not to leave out the last value of the original table [Boolean] function getReverseTable(oldTable, skipLastValue) local lastIndex = #oldTable if skipLastValue then lastIndex = lastIndex - 1 end local reverseTable = {} for i = 1, lastIndex do table.insert(reverseTable, oldTable[lastIndex + 1 - i]) end return reverseTable end -- Provides a copy-pastable link to a website that lets you play around with a cubic bezier curve function provideLinkToBezierWebsite() local url = "https://cubic-bezier.com/" imgui.InputText("Helpful site", url, #url, imgui_input_text_flags.AutoSelectAll) createHelpMarker("This site lets you play around with a cubic bezier whose graph represents ".. "the motion/path of notes. Play around with the points until you find a ".. "good shape for note motion and input those coordinates below") addSeparator() end -- Combs through a list and locates unique values -- Returns a list of only unique values (no duplicates) [Table] -- Parameters -- list : list of values [Table] function removeDuplicateValues(list) local hash = {} local newList = {} for _, value in ipairs(list) do -- if the value is not already in the new list if (not hash[value]) then -- add the value to the new list newList[#newList + 1] = value hash[value] = true end end return newList end -- Finds unique offsets of all notes currently selected in the Quaver map editor -- Returns a list of unique offsets (in increasing order) of selected notes [Table] function uniqueSelectedNoteOffsets() local offsets = {} for i, hitObject in pairs(state.SelectedHitObjects) do offsets[i] = hitObject.StartTime end offsets = removeDuplicateValues(offsets) offsets = table.sort(offsets, function(a, b) return a < b end) return offsets end -- Updates SVs that are pre-stored in menu variables -- Parameters -- menuVars : list of variables used for the current SV menu [Table] -- menuName : name of the current SV menu [String] function updateMenuSVs(menuVars, menuName) menuVars.svValues = generateSetOfValues(menuVars, menuName) menuVars.noteDistanceVsTime = calculateDistanceVsTime(menuVars.svValues, menuVars.stutterDuration) menuVars.svValuesPreview = {} for i = 1, #menuVars.svValues do table.insert(menuVars.svValuesPreview, menuVars.svValues[i]) end if menuVars.stutterDuration ~=nil then menuVars.svValuesSecondPreview = generateStutterSet(menuVars.endSV, menuVars.stutterDuration, menuVars.linearEndAvgSV) end if menuVars.finalSVOption ~= 1 and (menuVars.stutterDuration == nil) then table.remove(menuVars.svValuesPreview, #menuVars.svValuesPreview) end if menuVars.finalSVOption == 3 then if menuVars.linearStutter then table.insert(menuVars.svValuesSecondPreview, 1) else table.insert(menuVars.svValuesPreview, 1) end end end
--[[ This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:29' using the latest game version. NOTE: This file should only be used as IDE support; it should NOT be distributed with addons! **************************************************************************** CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC. **************************************************************************** ]] ZO_KEYBOARD_CURRENCY_OPTIONS = { showTooltips = true, font = "ZoFontGameLargeBold", iconSide = RIGHT, } local DONT_SET_TO_FULL_SIZE = false local DONT_USE_SHORT_FORMAT = false local TOOLTIP_LINE_WIDTH = 150 local INVENTORY_ICON = zo_iconFormat("EsoUI/Art/Tooltips/icon_bag.dds", 20, 20) local BANK_ICON = zo_iconFormat("EsoUI/Art/Tooltips/icon_bank.dds", 20, 20) local NO_BAG_ICON = nil do local function LayoutBankTooltip(currencyBankLocation, obfuscateFunction) local r, g, b = ZO_WHITE:UnpackRGB() for currencyType = CURT_ITERATION_BEGIN, CURT_ITERATION_END do if CanCurrencyBeStoredInLocation(currencyType, currencyBankLocation) then local carriedAmmount = ZO_CurrencyControl_FormatCurrency(GetCurrencyAmount(currencyType, CURRENCY_LOCATION_CHARACTER)) local currencyIconMarkup = ZO_Currency_GetKeyboardFormattedCurrencyIcon(currencyType) local carriedText = zo_strformat(SI_GENERIC_CURRENCY_TOOLTIP_FORMAT, carriedAmmount, currencyIconMarkup, INVENTORY_ICON) InformationTooltip:AddLine(carriedText, "", r, g, b, RIGHT, MODIFY_TEXT_TYPE_NONE, TEXT_ALIGN_RIGHT, DONT_SET_TO_FULL_SIZE, TOOLTIP_LINE_WIDTH) local obfuscateAmount = obfuscateFunction and obfuscateFunction(currencyType) local bankedAmmount = ZO_CurrencyControl_FormatCurrency(GetCurrencyAmount(currencyType, currencyBankLocation), DONT_USE_SHORT_FORMAT, obfuscateAmount) local bankedText = zo_strformat(SI_GENERIC_CURRENCY_TOOLTIP_FORMAT, bankedAmmount, currencyIconMarkup, BANK_ICON) InformationTooltip:SetVerticalPadding(0) InformationTooltip:AddLine(bankedText, "", r, g, b, RIGHT, MODIFY_TEXT_TYPE_NONE, TEXT_ALIGN_RIGHT, DONT_SET_TO_FULL_SIZE, TOOLTIP_LINE_WIDTH) end end end ZO_KEYBOARD_CURRENCY_BANK_TOOLTIP_OPTIONS = ZO_ShallowTableCopy(ZO_KEYBOARD_CURRENCY_OPTIONS) ZO_KEYBOARD_CURRENCY_BANK_TOOLTIP_OPTIONS.tooltipFunction = function(tooltip) LayoutBankTooltip(CURRENCY_LOCATION_BANK) end ZO_KEYBOARD_CURRENCY_GUILD_BANK_TOOLTIP_OPTIONS = ZO_ShallowTableCopy(ZO_KEYBOARD_CURRENCY_OPTIONS) ZO_KEYBOARD_CURRENCY_GUILD_BANK_TOOLTIP_OPTIONS.tooltipFunction = function(tooltip) local function ObfuscateFunction(currencyType) return currencyType == CURT_MONEY and not DoesPlayerHaveGuildPermission(GetSelectedGuildBankId(), GUILD_PERMISSION_BANK_VIEW_GOLD) end LayoutBankTooltip(CURRENCY_LOCATION_GUILD_BANK, ObfuscateFunction) end end
timers = {} local nextTimer = 1 local deadline = math.huge thread = nil function add(func, time) local timer = { func = func, time = time, thread = kernel.modules.threading.currentThread or "kernel", next = computer.uptime() + time } if deadline > timer.next then deadline = timer.next if thread.currentHandler == "yield" then thread.deadline = deadline end end local n = nextTimer if timers[n] then nextTimer = timers[n].next else nextTimer = nextTimer + 1 end timers[n] = timer return n end function remove(tid) --TODO: rights check timers[tid] = {next = nextTimer} nextTimer = tid end thread = kernel.modules.threading.spawn(function() while true do local now = computer.uptime() for n, timer in ipairs(timers) do if timer.thread then if timer.next <= now then if type(timer.thread) == "table" then kernel.modules.manageg.protect(timer.thread.sandbox) kernel.modules.threading.currentThread = timer.thread end local res, reason = pcall(timer.func, now) if type(timer.thread) == "table" then kernel.modules.threading.currentThread = thread kernel.modules.manageg.unprotect() end if res then timer.next = now + timer.time if deadline > timer.next then deadline = timer.next end else kernel.io.println("Timer " .. n .. " died: " .. tostring(reason)) remove(n) end else if deadline > timer.next then deadline = timer.next end end end end thread.deadline = deadline deadline = math.huge coroutine.yield("yield") end end, 0, "[timer]")
Script.ReloadScript( "Scripts/Entities/Boids/Birds.lua" ); Crows = { Properties = { Boid = { object_Model = "objects/characters/animals/birds/crow/crow.cdf", }, }, Audio = { "Play_idle_crow", -- idle "Play_scared_crow", -- scared }, } MakeDerivedEntityOverride( Crows,Birds ) function Crows:OnSpawn() self:SetFlags(ENTITY_FLAG_CLIENT_ONLY, 0); end
--[[ Editor ]]-- local drawing = require "nesdraw" local utf8 = require "utf8" local luatable = require "LuaTable" local listloader = require "listloader" local EditRoomState = 1 local EditWorldState = 2 local textInputText = "" local NamingActive = 1 local NamingCompeleted = 2 local NamingInactive = 3 local LayerBg = 1 local LayerFg = 2 local LayerTrigger = 3 local palette_imageData = nil local palette_image = nil local neseditor = { selected_image = 1, selected_sprite = 1, selected_room = 1, selected_world = 1, selected_layer = LayerBg, m1_released = false, m2_released = false, m1_dragging = false, mouse_scroll = 0, state = EditRoomState, write_pending = false, load_pending = false, naming_state = NamingInactive, } function neseditor.load() palette_imageData = love.image.newImageData("data/palette.png") palette_image = love.graphics.newImage(palette_imageData) end function neseditor.mb1click() local released = neseditor.m1_released neseditor.m1_released = false return released end function neseditor.mb2click() local released = neseditor.m2_released neseditor.m2_released = false return released end function neseditor.mousepressed(x, y, button) if button == 1 then neseditor.m1_dragging = true end end function neseditor.mousereleased(x, y, button) if button == 1 then neseditor.m1_released = true neseditor.m1_dragging = false end if button == 2 then neseditor.m2_released = true end end function neseditor.mousewheelmoved(x, y) neseditor.mouse_scroll = neseditor.mouse_scroll + 10.0 * y end local function reload_images_and_rooms(data) data.images = listloader.load_image_list() data.rooms = listloader.load_room_list() end function neseditor.keypressed(key) if key == "backspace" then local byteoffset = utf8.offset(textInputText, -1) if byteoffset then textInputText = string.sub(textInputText, 1, byteoffset - 1) end end end function neseditor.textinput(text) textInputText = textInputText .. text end function neseditor.keyreleased(key) if neseditor.naming_state == NamingActive then if key == "return" then print("Enter released") neseditor.naming_state = NamingCompleted love.keyboard.setKeyRepeat(false) end return end if key == "f3" then neseditor.state = EditWorldState elseif key == "f4" then neseditor.state = EditRoomState elseif key == "f5" then -- Save neseditor.write_pending = true elseif key == "f6" then -- Load images and rooms neseditor.load_pending = true elseif key == "f7" and neseditor.naming_state == NamingInactive then neseditor.naming_state = NamingActive love.keyboard.setKeyRepeat(true) -- Allow keeping backspace down elseif key == "n" then if neseditor.state == EditRoomState then local nextRoom = neseditor.selected_room + 1; if nextRoom < 255 then neseditor.selected_room = nextRoom; end elseif neseditor.state == EditWorldState then local nextWorld = neseditor.selected_world + 1; if nextWorld < 255 then neseditor.selected_world = nextWorld; end end elseif key == "p" then if neseditor.state == EditRoomState then local nextRoom = neseditor.selected_room - 1; if nextRoom > 0 then neseditor.selected_room = nextRoom; end elseif neseditor.state == EditWorldState then local nextWorld = neseditor.selected_world - 1; if nextWorld > 0 then neseditor.selected_world = nextWorld; end end elseif key == "f" then neseditor.selected_layer = LayerFg elseif key == "b" then neseditor.selected_layer = LayerBg elseif key == "t" then neseditor.selected_layer = LayerTrigger end end local function draw_sprites(data, x, y, scroll, editor_scale, font_height, mx, my) -- Draw all sprites local listX = x local imageX = x + 20 local imageY = y love.graphics.print("Sprites!", imageX, imageY - font_height) imageY = imageY + scroll for i, sprite in pairs(data.sprites) do local imageWidth = sprite.frame_width local imageHeight = sprite.frame_height imageWidth = imageWidth * editor_scale imageHeight = imageHeight * editor_scale -- Selecting an image if mx > imageX and mx < imageX + imageWidth and my > imageY and my < imageY + imageHeight then drawing.setColor(4) love.graphics.rectangle("fill", imageX-1, imageY-1, imageWidth+2, imageHeight+2) if neseditor.mb1click() then neseditor.selected_sprite = i end else drawing.setColor(3) end love.graphics.print("" .. i .. ":", listX, imageY) love.graphics.setColor(1,1,1) drawing.draw_sprite(data.sprites[i], imageX, imageY, editor_scale) imageY = imageY + imageHeight end end local function draw_images(data, x, y, scroll, editor_scale, font_height, mx, my) -- Draw all images local listX = x local imageX = x + 20 local imageY = y love.graphics.print("Images!", imageX, imageY - font_height) imageY = imageY + scroll for i, image in pairs(data.images) do local imageWidth, imageHeight = image:getPixelDimensions() imageWidth = imageWidth * editor_scale imageHeight = imageHeight * editor_scale -- Selecting an image if mx > imageX and mx < imageX + imageWidth and my > imageY and my < imageY + imageHeight then drawing.setColor(4) love.graphics.rectangle("fill", imageX-1, imageY-1, imageWidth+2, imageHeight+2) if neseditor.mb1click() then neseditor.selected_image = i end else drawing.setColor(3) end love.graphics.print("" .. i .. ":", listX, imageY) love.graphics.setColor(1,1,1) love.graphics.draw(image, imageX, imageY, 0, editor_scale, editor_scale) imageY = imageY + imageHeight end end local function draw_rooms(data, x, y, scroll, scale, font_height, mx, my) local listX = x local roomX = x + 20 local roomY = y love.graphics.print("Rooms!", roomX, roomY - font_height) roomY = roomY + scroll for i, room in pairs(data.rooms) do roomWidth = ROOM_SIZE.w * TILE_SIZE * scale roomHeight = ROOM_SIZE.h * TILE_SIZE * scale -- Selecting an room if mx > roomX and mx < roomX + roomWidth and my > roomY and my < roomY + roomHeight then drawing.setColor(4) love.graphics.rectangle("fill", roomX-1, roomY-1, roomWidth+2, roomHeight+2) if neseditor.mb1click() then neseditor.selected_room = i end else drawing.setColor(3) end love.graphics.print("" .. i .. ":", listX, roomY) love.graphics.setColor(1,1,1) drawing.draw_room(data, i, roomX, roomY, scale) roomY = roomY + roomHeight end end local function get_selected_tile(mx, my, gridX, gridY, gridWidth, gridHeight , tile_size , tile_dimensions , dimAdjust) if (mx > gridX and mx < gridX + gridWidth and my > gridY and my < gridY + gridHeight) then local mtx = ((mx - gridX) / gridWidth) * tile_dimensions.w / dimAdjust local mty = ((my - gridY ) / gridHeight) * tile_dimensions.h / dimAdjust mtx = math.floor(mtx) mty = math.floor(mty) return {gridX + mtx * tile_size.w, gridY + mty * tile_size.h}, {mtx * dimAdjust, mty * dimAdjust} else return nil end end local function modify_grid(grid, item_index, mt) local layer = grid local last = #layer if neseditor.mb1click() then -- Prevent duplicates local add = true for i, item in pairs(layer) do if item.x == mt[1] and item.y == mt[2] then if item.index == item_index then -- This item is already here add = false else -- Replace layer[i] = create_grid_item(item_index, mt[1], mt[2]) add = false end end end if add then layer[last + 1] = create_grid_item(item_index, mt[1], mt[2]) end end if neseditor.mb2click() then -- Remove by replacing the item with last item for i, item in ipairs(layer) do if item.x == mt[1] and item.y == mt[2] then if last > 1 then layer[i] = layer[last] layer[last] = nil else -- If only one item, remove it layer[i] = nil end end end end end function neseditor.update(data) if neseditor.write_pending then listloader.write_data(data) neseditor.write_pending = false end if neseditor.load_pending then reload_images_and_rooms(data) neseditor.load_pending = false end if not data.rooms[neseditor.selected_room] then data.rooms[neseditor.selected_room] = create_room() end if not data.worlds[neseditor.selected_world] then data.worlds[neseditor.selected_world] = create_world() end -- We have text input but naming is no longer active if string.len(textInputText) > 0 and neseditor.naming_state == NamingCompleted then print("Naming over: " .. textInputText) if neseditor.state == EditWorldState then data.worlds[neseditor.selected_world].name = textInputText elseif neseditor.state == EditRoomState then data.rooms[neseditor.selected_room].name = textInputText end textInputText = "" neseditor.naming_state = NamingInactive end end function neseditor.draw(data, font_height, grid_snap_size) love.graphics.setColor(1,1,1) local guide_x = 10 * gui_scale love.graphics.print("Editor!", guide_x, 0) love.graphics.print("F3 World - F4 Room - F5 Save - F6 Load", guide_x, font_height) local editTarget = "World" if neseditor.state == EditRoomState then editTarget = "Room" end love.graphics.print("F7 Rename " .. editTarget .. " - N/P Next/Prev " .. editTarget, guide_x, font_height * 2) love.graphics.print("(B)ackground, (F)oreground, (T)rigger" , guide_x, font_height * 3) love.graphics.print("Left mouse: Insert - Right mouse: Remove", guide_x, font_height * 4) local room_scale = editor_scale local world_scale = editor_scale / 10 local mx, my = love.mouse.getPosition() local room_size = get_room_pixel_size(room_scale) local world_size = get_world_pixel_size(world_scale) local room_tile_size = {w = grid_snap_size * room_scale, h = grid_snap_size * room_scale} local world_tile_size = get_world_tile_size(world_scale) local world_pos = {x = editor_x, y = editor_y} local room_pos = {x = editor_x + room_size.w * 1.5, y = editor_y} local imageListX = room_pos.x + room_size.w local roomListX = world_pos.x + world_size.w -- Careful not to edit rooms and worlds that do not exist yet if data.worlds[neseditor.selected_world] and data.rooms[neseditor.selected_room] then drawing.setColor(3); if neseditor.state == EditWorldState then drawing.setColor(4) if neseditor.naming_state == NamingActive then drawing.setColor(4) love.graphics.print("> " .. textInputText, world_pos.x, world_pos.y - font_height * 2) end end -- Draw world love.graphics.print("World " .. neseditor.selected_world .. " : " .. data.worlds[neseditor.selected_world].name , world_pos.x, world_pos.y - font_height) drawing.draw_world(data, neseditor.selected_world, world_pos.x, world_pos.y, world_scale) drawing.setColor(3); if neseditor.state == EditRoomState then drawing.setColor(4) if neseditor.naming_state == NamingActive then drawing.setColor(4) love.graphics.print("> " .. textInputText, room_pos.x, room_pos.y - font_height * 2) end end -- Rooms list draw_rooms(data, roomListX, world_pos.y, neseditor.mouse_scroll, editor_scale / 4, font_height, mx, my) -- Draw Room love.graphics.print("Room " .. neseditor.selected_room .. " : " .. data.rooms[neseditor.selected_room].name , room_pos.x, room_pos.y - font_height) drawing.draw_room(data, neseditor.selected_room, room_pos.x, room_pos.y, editor_scale) -- Layer selection local layer = "Background" if neseditor.selected_layer == LayerFg then layer = "Foregound" elseif neseditor.selected_layer == LayerTrigger then layer = "Triggers" end love.graphics.print("Layer :" .. layer, room_pos.x, room_pos.y + room_size.h) -- Select background color from palette local palette_x = room_pos.x local palette_y = room_pos.y + room_size.h + 40 * editor_scale local ppw = palette_imageData:getWidth() local pph = palette_imageData:getHeight() local palette_w = room_size.w local palette_h = pph * editor_scale local palette_scale = palette_w / ppw love.graphics.draw(palette_image, room_pos.x, palette_y, 0, palette_scale, palette_scale) if mx > palette_x and mx < palette_x + palette_w and my > palette_y and my < palette_y + palette_h then love.graphics.rectangle("line", palette_x, palette_y , palette_w, palette_h) local mipx = ((mx - palette_x) / palette_w) * ppw local mipy = (my - palette_y) * palette_scale if neseditor.mb1click() and mipx > 0 and mipx < ppw and mipy > 0 and mipy < pph then local br, bg, bb, ba = palette_imageData:getPixel(mipx, mipy) if data.rooms[neseditor.selected_room].bg_color == nil then data.rooms[neseditor.selected_room].bg_color = {0,0,0} end data.rooms[neseditor.selected_room].bg_color = {br, bg, bb} end end -- Images or sprites if neseditor.selected_layer == LayerBg then draw_images(data, imageListX, room_pos.y, neseditor.mouse_scroll, editor_scale, font_height, mx, my) elseif neseditor.selected_layer == LayerFg then draw_sprites(data, imageListX, room_pos.y, neseditor.mouse_scroll, editor_scale, font_height, mx, my) end -- Edit Room local dimAdjust = grid_snap_size / TILE_SIZE local st, mt = get_selected_tile(mx, my, room_pos.x, room_pos.y, room_size.w, room_size.h, room_tile_size, ROOM_SIZE, dimAdjust) if st then local room = data.rooms[neseditor.selected_room] local grid = room.bg local selected_item = neseditor.selected_image local valid_image = data.images[neseditor.selected_image] ~= nil local valid_sprite = data.sprites[neseditor.selected_sprite] ~= nil if neseditor.selected_layer == LayerBg and valid_image then -- Draw selected image love.graphics.draw(data.images[neseditor.selected_image], st[1], st[2], 0, room_scale, room_scale) elseif neseditor.selected_layer == LayerFg and valid_sprite then grid = room.fg selected_item = neseditor.selected_sprite -- Draw selected sprite drawing.draw_sprite(data.sprites[neseditor.selected_sprite], st[1], st[2], room_scale) elseif neseditor.selected_layer == LayerTrigger then grid = room.triggers end -- Draw borders around held tile love.graphics.rectangle("line", st[1]-1, st[2]-1, room_tile_size.w + 2, room_tile_size.h + 2) -- Draw guides for 16x16 tiles drawing.setColor(7) local guide_size = 16 * room_scale local guides_x = room_size.w / guide_size local guides_y = room_size.h / guide_size for guide_x = 0, guides_x do love.graphics.line(room_pos.x + guide_x * guide_size, room_pos.y , room_pos.x + guide_x * guide_size, room_pos.y + room_size.h) end for guide_y = 0, guides_y do love.graphics.line(room_pos.x, room_pos.y + guide_y * guide_size , room_pos.x + room_size.w, room_pos.y + guide_y * guide_size) end -- Draw guides for selected image or sprite drawing.setColor(6) local imagew = 0 local imageh = 0 if valid_image then imagew = data.images[neseditor.selected_image]:getWidth() * room_scale imageh = data.images[neseditor.selected_image]:getHeight() * room_scale elseif valid_sprite then imagew = data.sprites[neseditor.selected_sprite].frame_width * room_scale imageh = data.sprites[neseditor.selected_sprite].frame_height * room_scale end if valid_sprite or valid_image then love.graphics.line(room_pos.x, st[2], room_pos.x + room_size.w, st[2]) love.graphics.line(room_pos.x, st[2] + imageh, room_pos.x + room_size.w, st[2] + imageh) love.graphics.line(st[1], room_pos.y , st[1], room_pos.y + room_size.h) love.graphics.line(st[1] + imagew, room_pos.y , st[1] + imagew, room_pos.y + room_size.h) end -- Finally modify the room modify_grid(grid, selected_item, mt) end -- Edit World st, mt = get_selected_tile(mx, my , world_pos.x, world_pos.y , world_size.w, world_size.h , world_tile_size, WORLD_SIZE, 1) if st then -- Draw selected room drawing.draw_room(data, neseditor.selected_room, st[1], st[2], world_scale) love.graphics.rectangle("line" , st[1]-1, st[2]-1 , world_tile_size.w + 2, world_tile_size.h + 2) modify_grid(data.worlds[neseditor.selected_world].rooms , neseditor.selected_room , mt) end end -- Draw mouse cursor drawing.setColor(2) love.graphics.rectangle("fill", mx - 4, my - 1, 8, 2) love.graphics.rectangle("fill", mx - 1, my - 4, 2, 8) end return neseditor
local im = require "imlua" require "imlua_capture" local gl = require "luagl" local iup = require "iuplua" require "iupluagl" local vc = im.VideoCaptureCreate() if (not vc) then error("ERROR: No capture device found!") end if (vc:Connect(0) == 0) then error("ERROR: Fail to connect to capture device") end local capw, caph = vc:GetImageSize() local initimgsize = string.format("%ix%i", capw, caph) local frbuf = im.ImageCreate(capw, caph, im.RGB, im.BYTE) local gldata, glformat = frbuf:GetOpenGLData() cnv = iup.glcanvas{buffer="DOUBLE", rastersize = initimgsize} function cnv:resize_cb(width, height) iup.GLMakeCurrent(self) gl.Viewport(0, 0, width, height) end function cnv:action(x, y) iup.GLMakeCurrent(self) gl.PixelStore(gl.UNPACK_ALIGNMENT, 1) gldata, glformat = frbuf:GetOpenGLData() --update the data gl.DrawPixelsRaw (capw, caph, glformat, gl.UNSIGNED_BYTE, gldata) iup.GLSwapBuffers(self) end vc:Live(1) local dlg = iup.dialog{title = "Oh Snap!", cnv} local in_loop = true function dlg:close_cb() in_loop = false end function dlg:k_any(c) if c == iup.K_q or c == iup.K_ESC then return iup.CLOSE end if c == iup.K_F1 then if fullscreen then fullscreen = false dlg.fullscreen = "No" else fullscreen = true dlg.fullscreen = "Yes" end iup.SetFocus(cnv) end end dlg:show() iup.SetFocus(cnv) while in_loop do vc:Frame(frbuf,-1) iup.Update(cnv) local result = iup.LoopStep() if result == iup.CLOSE then in_loop = false end end vc:Live(0) vc:Disconnect() vc:Destroy()
local skynet = require "skynet" local mutexLock = require "skynet.queue" local CMD = {} local cs = mutexLock() local f local filename = "logClient" --require "functions" function init() end function CMD.exit() cs(function() if f then f:close() end end) end function CMD.log(errdata) cs(function() f = io.open(filename, "a+") if not f then return "clientErrorCollect: can't open " .. filename end local data = os.date() .. "\n" .. errdata .. "\n\n\n" f:write(data) f:close() end) end skynet.start(function() skynet.dispatch("lua", function(_,_, command, ...) --print("clientErrorCollect dispatch lua:", command) local f = CMD[command] f(...) end) init() end)
function plugindef() -- This function and the 'finaleplugin' namespace -- are both reserved for the plug-in definition. finaleplugin.Author = "Robert Patterson" finaleplugin.Copyright = "CC0 https://creativecommons.org/publicdomain/zero/1.0/" finaleplugin.Version = "1.0" finaleplugin.Date = "February 21, 2021" finaleplugin.CategoryTags = "Page" finaleplugin.Notes = [[ Finale makes it surprisingly difficult to remove text inserts from an existing Page Text. It requires extremely precise positioning of the cursor, and even then it frequently modifies the insert instead of the Page Text. This is especially true if the Page Text contains *only* one or more inserts. This script allows you to select a Page Text and remove the inserts with no fuss. ]] return "Remove Inserts From Page Text...", "Remove Inserts From Page Text", "Removes text inserts from selected Page Text." end --[[ $module Enigma String ]] -- local enigma_string = {} local starts_with_font_command = function(string) local text_cmds = {"^font", "^Font", "^fontMus", "^fontTxt", "^fontNum", "^size", "^nfx"} for i, text_cmd in ipairs(text_cmds) do if string:StartsWith(text_cmd) then return true end end return false end --[[ The following implements a hypothetical FCString.TrimFirstEnigmaFontTags() function that would preferably be in the PDK Framework. Trimming only first allows us to preserve style changes within the rest of the string, such as changes from plain to italic. Ultimately this seems more useful than trimming out all font tags. If the PDK Framework is ever changed, it might be even better to create replace font functions that can replace only font, only size, only style, or all three together. ]] --[[ % trim_first_enigma_font_tags Trims the first font tags and returns the result as an instance of FCFontInfo. @ string (FCString) this is both the input and the trimmed output result : (FCFontInfo | nil) the first font info that was stripped or `nil` if none ]] function enigma_string.trim_first_enigma_font_tags(string) local font_info = finale.FCFontInfo() local found_tag = false while true do if not starts_with_font_command(string) then break end local end_of_tag = string:FindFirst(")") if end_of_tag < 0 then break end local font_tag = finale.FCString() if string:SplitAt(end_of_tag, font_tag, nil, true) then font_info:ParseEnigmaCommand(font_tag) end string:DeleteCharactersAt(0, end_of_tag + 1) found_tag = true end if found_tag then return font_info end return nil end --[[ % change_first_string_font Replaces the first enigma font tags of the input enigma string. @ string (FCString) this is both the input and the modified output result @ font_info (FCFontInfo) replacement font info : (boolean) true if success ]] function enigma_string.change_first_string_font(string, font_info) local final_text = font_info:CreateEnigmaString(nil) local current_font_info = enigma_string.trim_first_enigma_font_tags(string) if (current_font_info == nil) or not font_info:IsIdenticalTo(current_font_info) then final_text:AppendString(string) string:SetString(final_text) return true end return false end --[[ % change_first_text_block_font Replaces the first enigma font tags of input text block. @ text_block (FCTextBlock) this is both the input and the modified output result @ font_info (FCFontInfo) replacement font info : (boolean) true if success ]] function enigma_string.change_first_text_block_font(text_block, font_info) local new_text = text_block:CreateRawTextString() if enigma_string.change_first_string_font(new_text, font_info) then text_block:SaveRawTextString(new_text) return true end return false end -- These implement a complete font replacement using the PDK Framework's -- built-in TrimEnigmaFontTags() function. --[[ % change_string_font Changes the entire enigma string to have the input font info. @ string (FCString) this is both the input and the modified output result @ font_info (FCFontInfo) replacement font info ]] function enigma_string.change_string_font(string, font_info) local final_text = font_info:CreateEnigmaString(nil) string:TrimEnigmaFontTags() final_text:AppendString(string) string:SetString(final_text) end --[[ % change_text_block_font Changes the entire text block to have the input font info. @ text_block (FCTextBlock) this is both the input and the modified output result @ font_info (FCFontInfo) replacement font info ]] function enigma_string.change_text_block_font(text_block, font_info) local new_text = text_block:CreateRawTextString() enigma_string.change_string_font(new_text, font_info) text_block:SaveRawTextString(new_text) end --[[ % remove_inserts Removes text inserts other than font commands and replaces them with @ fcstring (FCString) this is both the input and the modified output result @ replace_with_generic (boolean) if true, replace the insert with the text of the enigma command ]] function enigma_string.remove_inserts(fcstring, replace_with_generic) -- so far this just supports page-level inserts. if this ever needs to work with expressions, we'll need to -- add the last three items in the (Finale 26) text insert menu, which are playback inserts not available to page text local text_cmds = { "^arranger", "^composer", "^copyright", "^date", "^description", "^fdate", "^filename", "^lyricist", "^page", "^partname", "^perftime", "^subtitle", "^time", "^title", "^totpages", } local lua_string = fcstring.LuaString for i, text_cmd in ipairs(text_cmds) do local starts_at = string.find(lua_string, text_cmd, 1, true) -- true: do a plain search while nil ~= starts_at do local replace_with = "" if replace_with_generic then replace_with = string.sub(text_cmd, 2) end local after_text_at = starts_at + string.len(text_cmd) local next_at = string.find(lua_string, ")", after_text_at, true) if nil ~= next_at then next_at = next_at + 1 else next_at = starts_at end lua_string = string.sub(lua_string, 1, starts_at - 1) .. replace_with .. string.sub(lua_string, next_at) starts_at = string.find(lua_string, text_cmd, 1, true) end end fcstring.LuaString = lua_string end --[[ % expand_value_tag Expands the value tag to the input value_num. @ fcstring (FCString) this is both the input and the modified output result @ value_num (number) the value number to replace the tag with ]] function enigma_string.expand_value_tag(fcstring, value_num) value_num = math.floor(value_num + 0.5) -- in case value_num is not an integer fcstring.LuaString = fcstring.LuaString:gsub("%^value%(%)", tostring(value_num)) end --[[ % calc_text_advance_width Calculates the advance width of the input string taking into account all font and style changes within the string. @ inp_string (FCString) this is an input-only value and is not modified : (number) the width of the string ]] function enigma_string.calc_text_advance_width(inp_string) local accumulated_string = "" local accumulated_width = 0 local enigma_strings = inp_string:CreateEnigmaStrings(true) -- true: include non-commands for str in each(enigma_strings) do accumulated_string = accumulated_string .. str.LuaString if string.sub(str.LuaString, 1, 1) ~= "^" then -- if this string segment is not a command, calculate its width local fcstring = finale.FCString() local text_met = finale.FCTextMetrics() fcstring.LuaString = accumulated_string local font_info = fcstring:CreateLastFontInfo() fcstring.LuaString = str.LuaString fcstring:TrimEnigmaTags() text_met:LoadString(fcstring, font_info, 100) accumulated_width = accumulated_width + text_met:GetAdvanceWidthEVPUs() end end return accumulated_width end function do_dialog_box(clean_texts) local str = finale.FCString() local dialog = finale.FCCustomWindow() str.LuaString = "Select Page Text" dialog:SetTitle(str) local current_y = 0 local y_increment = 26 local x_increment = 65 -- page text static = dialog:CreateStatic(0, current_y+2) str.LuaString = "Page Text:" static:SetText(str) local page_text = dialog:CreatePopup(x_increment, current_y) for k, v in pairs(clean_texts) do str.LuaString = v page_text:AddString(str) end page_text:SetWidth(250) current_y = current_y + y_increment -- Replace Checkbox local do_replace = dialog:CreateCheckbox(0, current_y+2) str.LuaString = "Replace Inserts With Generic Text" do_replace:SetText(str) do_replace:SetWidth(250) do_replace:SetCheck(1) current_y = current_y + y_increment -- OK/Cxl dialog:CreateOkButton() dialog:CreateCancelButton() if finale.EXECMODAL_OK == dialog:ExecuteModal(nil) then return true, 1+page_text:GetSelectedItem(), (0 ~= do_replace:GetCheck()) end return false end function page_title_remove_inserts() local page_texts = finale.FCPageTexts() page_texts:LoadAll() local clean_texts = {} local page_texts_with_inserts = {} for page_text in each(page_texts) do local clean_text = page_text:CreateTextString() if clean_text:ContainsEnigmaTextInsert() then clean_text:TrimEnigmaFontTags() if nil ~= clean_text then table.insert(clean_texts, clean_text.LuaString) table.insert(page_texts_with_inserts, page_text) end end end local success, selected_text_index, do_replace = do_dialog_box(clean_texts) if success then local selected_page_text = page_texts_with_inserts[selected_text_index] local selected_text_string = selected_page_text:CreateTextString() enigma_string.remove_inserts(selected_text_string, do_replace) selected_page_text:SaveTextString(selected_text_string) selected_page_text:Save() end end page_title_remove_inserts()
project "FastNoise2" kind "StaticLib" language "C++" targetdir ("bin/" .. outputdir .. "/%{prj.name}") objdir ("bin-int/" .. outputdir .. "/%{prj.name}") includedirs { "include" } files { "include/FastSIMD/*.h", "src/FastSIMDD/Internal/*.h", "src/FastSIMD/*.cpp", "include/FastNoise/*.h", "include/FastNoise/Generators/*.h", "src/FastNoise/*.cpp" } defines { "FASTNOISE_STATIC_LIB", "FASTNOISE_EXPORT" } buildoptions { "/arch:AVX", "/arch:AVX512" } filter "system:windows" systemversion "latest" cppdialect "C++17" staticruntime "Off" runtime "Debug" filter { "system:windows", "configurations:Release" } staticruntime "Off" runtime "Release"
class "AntiSpam" function AntiSpam:__init() self.kickMessage = "был кикнут за флуд :(" self.kickReason = "\n\nВы были отключены системой Анти-Флуд.\n\n" .. "Кикнуло просто так? - Возможо у вас привязаны команды к клавишам. Ипользуйте /unbindall, чтобы отвязать их.\n\n" .. "Поддержка в ВК - vk.com/rusjc\nПоддержка в Steam - steamcommunity.com/groups/rusjc\nПоддержка в Дисководе - discord.gg/vzew9mDpYn" self.messageColor = Color( 255, 0, 0 ) self.maxWarnings = 2 self.messagesResetInterval = 5 self.messagesForWarning = 2 self.warningsResetInterval = 180 -- Don't touch below this: self.messagesSent = { } self.playerWarnings = { } self.resetTableTick = 0 self.resetWarningsTick = 0 Events:Subscribe( "PlayerChat", self, self.OnChat ) Events:Subscribe( "PostTick", self, self.ResetTable ) end function AntiSpam:OnChat( args ) if ( args.text:len() > 0 ) then local steamID = args.player:GetSteamId().id if ( not self.messagesSent [ steamID ] ) then self.messagesSent [ steamID ] = 1 elseif ( self.messagesSent [ steamID ] >= self.messagesForWarning ) then local warnings = tonumber ( self.playerWarnings [ steamID ] ) or 0 if ( warnings < self.maxWarnings ) then self.playerWarnings [ steamID ] = ( warnings + 1 ) if args.player:GetValue( "Lang" ) == "ENG" then args.player:SendChatMessage ( "[Anti-Flood] ", Color.White, "Please do not flood. Warnings: ".. tostring ( self.playerWarnings [ steamID ] ) .."/".. tostring ( self.maxWarnings ), Color.Yellow ) else args.player:SendChatMessage ( "[Анти-Флуд] ", Color.White, "Пожалуйста, не флудите. Предупреждений: ".. tostring ( self.playerWarnings [ steamID ] ) .."/".. tostring ( self.maxWarnings ), Color.Yellow ) end self.messagesSent [ steamID ] = 0 else args.player:Kick ( self.kickReason ) Chat:Broadcast ( tostring ( args.player:GetName() ) .." ".. tostring ( self.kickMessage ), self.messageColor ) self.messagesSent [ steamID ] = nil self.playerWarnings [ steamID ] = nil end else self.messagesSent [ steamID ] = ( self.messagesSent [ steamID ] + 1 ) end end end function AntiSpam:ResetTable() if ( Server:GetElapsedSeconds() - self.resetTableTick >= self.messagesResetInterval ) then self.messagesSent = {} self.resetTableTick = Server:GetElapsedSeconds() end if ( Server:GetElapsedSeconds() - self.resetWarningsTick >= self.warningsResetInterval ) then self.playerWarnings = {} self.resetWarningsTick = Server:GetElapsedSeconds() end end antispam = AntiSpam()
require'lspconfig'.clangd.setup { cmd = {DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd"}, on_attach = require'lsp'.common_on_attach, handlers = { ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = O.lang.clang.diagnostics.virtual_text, signs = O.lang.clang.diagnostics.signs, underline = O.lang.clang.diagnostics.underline, update_in_insert = true }) } }
local PANEL = {} local image1 = surface.GetTextureID("VGUI/minicrosshair") local image2 = surface.GetTextureID("VGUI/minishockwave") local image3 = surface.GetTextureID("VGUI/minigroupadd") local function ButtonPaint(self, w, h) draw.DrawSimpleRect(0, 0, w, h, Color(60, 0, 0, self.alpha)) surface.SetDrawColor(255, 255, 255, self.alpha) surface.SetTexture(self.Image) surface.DrawTexturedRect(2, 0, 32, 32) draw.DrawSimpleOutlined(0, 0, w, h -1, color_black) end function PANEL:Init() self.last = nil self:SetSize(128, 128) self:SetPos(ScrW() - 130, ScrH() - 130) self.list = vgui.Create("DIconLayout", self) self.list:SetSize(self:GetWide() - 4, self:GetTall() - 37) self.list:SetPos(2, 34) self.list:SetBorder(4) self.list:SetSpaceX(8) self.list:SetSpaceY(8) self.list.Paint = function() end self.button1 = vgui.Create("DPanel", self) self.button1:SetPos(1, 0) self.button1:SetSize(34, 34) self.button1.alpha = 100 self.button1.buttons = { {image = "VGUI/miniselectall", func = function() net.Start("zm_selectall_zombies") net.SendToServer() end, tooltip = translate.Get("tooltip_select_all")}, {image = "VGUI/minishield", func = function() net.Start("zm_switch_to_defense") net.SendToServer() end, tooltip = translate.Get("tooltip_defend")}, {image = "VGUI/minicrosshair", func = function() net.Start("zm_switch_to_offense") net.SendToServer() end, tooltip = translate.Get("tooltip_attack")}, {image = "VGUI/miniarrows", func = function() RunConsoleCommand("zm_power_ambushpoint") end, tooltip = translate.Get("tooltip_ambush")}, {image = "VGUI/miniceiling", func = function() net.Start("zm_cling_ceiling") net.SendToServer() end, tooltip = translate.Get("tooltip_ceiling")} } self.button1.Image = image1 self.button1.Paint = ButtonPaint self.button1.OnMousePressed = function(_self, code) if self.last then self.last.alpha = 100 end _self.alpha = 255 self.last = _self self.list:Clear() for k, v in ipairs(_self.buttons) do local button = vgui.Create("DImageButton") button:SetSize(32, 32) button:SetImage(v.image) button.DoClick = function() v.func() end button.OnCursorEntered = function(self) self.toolpan = vgui.Create("DPanel") self.toolpan:SetSize(ScrW() * 0.1, ScrH() * 0.03) self.toolpan:InvalidateLayout(true) self.toolpan:Center() self.toolpan:AlignBottom(10) self.toollab = vgui.Create("DLabel", self.toolpan) self.toollab:SetTextColor(color_white) self.toollab:SetText(v.tooltip) self.toollab:SetFont("OptionsHelpBig") self.toollab:SizeToContents() self.toolpan:InvalidateLayout(true) self.toolpan:SizeToChildren(true, false) self.toolpan:SetSize(self.toolpan:GetWide() + 15, self.toolpan:GetTall()) self.toollab:Center() self.toolpan:Center() self.toolpan:AlignBottom(10) GAMEMODE.ToolPan_Center_Tip = self.toolpan end button.OnCursorExited = function(self) if self.toolpan then self.toolpan:Remove() GAMEMODE.ToolPan_Center_Tip = nil end end self.list:Add(button) end if _self.GroupButton then local dropdown = vgui.Create("DComboBox", self.button3) dropdown:SetMouseInputEnabled(true) dropdown:SetPos(0, 10) dropdown:SetText("None") dropdown.OnSelect = function(me, index, value, data) net.Start("zm_setselectedgroup") net.WriteString(string.Replace(tostring(value), "Group ", "")) net.SendToServer() end dropdown.Think = function(self) self.BaseClass.Think(self) if GAMEMODE.bUpdateGroups then local groups = gamemode.Call("GetCurrentZombieGroups") if groups then for i, group in pairs(groups) do self:AddChoice("Group "..i) end end dropdown:SetText(groups and "Group "..gamemode.Call("GetCurrentZombieGroup") or "None") GAMEMODE.bUpdateGroups = false end end self.list:Add(dropdown) end end self.button1:OnMousePressed() self.button2 = vgui.Create("DPanel", self) self.button2:SetPos(self:GetWide() /2 - 17, 0) self.button2:SetSize(34, 34) self.button2.alpha = 100 self.button2.buttons = { {image = "VGUI/minieye", func = function() RunConsoleCommand("zm_power_nightvision") end, tooltip = translate.Get("tooltip_nightvision")}, {image = "VGUI/minishockwave", func = function() RunConsoleCommand("zm_power_physexplode") end, tooltip = translate.Format("tooltip_explosion_cost_x", GetConVar("zm_physexp_cost"):GetInt())}, {image = "VGUI/minideletezombies", func = function() RunConsoleCommand("zm_power_killzombies") end, tooltip = translate.Get("tooltip_expire_zombies")}, {image = "VGUI/minispotcreate", func = function() RunConsoleCommand("zm_power_spotcreate") end, tooltip = translate.Format("tooltip_hidden_zombie_cost_x", GetConVar("zm_spotcreate_cost"):GetInt())} } self.button2.Image = image2 self.button2.Paint = ButtonPaint self.button2.OnMousePressed = self.button1.OnMousePressed self.button3 = vgui.Create("DPanel", self) self.button3:SetPos(self:GetWide() - 35, 0) self.button3:SetSize(34, 34) self.button3.GroupButton = true self.button3.alpha = 100 self.button3.OnMousePressed = self.button1.OnMousePressed self.button3.buttons = { {image = "VGUI/minigroupadd", func = function() net.Start("zm_creategroup") net.SendToServer() end, tooltip = translate.Get("tooltip_create_squad")}, {image = "VGUI/minigroupselect", func = function() net.Start("zm_selectgroup") net.SendToServer() end, tooltip = translate.Get("tooltip_select_squad")} } self.button3.Image = image3 self.button3.Paint = ButtonPaint end function PANEL:Paint(w, h) draw.DrawSimpleRect(0, 32, w, h - 32, Color(60, 0, 0, 200)) draw.DrawSimpleOutlined(0, 32, w, h - 32, color_black) end function PANEL:PerformLayout(w, h) self:SetPos(ScrW() - 130, ScrH() - 130) end vgui.Register("zm_powerpanel", PANEL, "DPanel")
local Fabric = require(script.Parent) return function() describe("Fabric.new", function() it("should return a fabric", function() local fabric = Fabric.new("the namespace") expect(fabric.namespace).to.equal("the namespace") end) end) describe("Fabric:registerUnit", function() it("should register units", function() local unitDef = { name = "Test"; } local fabric = Fabric.new() local eventCount = 0 fabric:on("unitRegistered", function() eventCount += 1 end) fabric:registerUnit(unitDef) expect(fabric.Unit.Test).to.be.ok() expect(eventCount).to.equal(1) end) it("shouldn't register duplicate units", function() local unitDef = { name = "Test"; } local fabric = Fabric.new() fabric:registerUnit(unitDef) local unitDef2 = { name = "Test"; } local stat, err = pcall(function() fabric:registerUnit(unitDef2) end) expect(stat).to.equal(false) expect(err:match("A unit with this name is already registered!")).to.be.ok() end) end) describe("Fabric:registerUnitsIn", function() end) describe("Fabric:getUnitByRef and Fabric:getOrCreateUnitByRef", function() it("should create and get a unit on ref", function() local unitDef = { name = "Test"; } local fabric = Fabric.new() fabric:registerUnit(unitDef) local testRef = {} expect(fabric:getUnitByRef("Test", testRef)).to.never.be.ok() fabric:getOrCreateUnitByRef(unitDef, testRef) expect(fabric:getUnitByRef("Test", testRef)).to.be.ok() end) end) describe("Fabric:removeAllUnitsWithRef", function() it("should remove all units with a ref", function() local unitDef = { name = "Test"; } local unitDef2 = { name = "Test2"; } local fabric = Fabric.new() fabric:registerUnit(unitDef) fabric:registerUnit(unitDef2) local testRef = {} fabric:getOrCreateUnitByRef(unitDef, testRef) fabric:getOrCreateUnitByRef(unitDef2, testRef) expect(fabric:getUnitByRef("Test", testRef)).to.be.ok() expect(fabric:getUnitByRef("Test2", testRef)).to.be.ok() fabric:removeAllUnitsWithRef(testRef) expect(fabric:getUnitByRef("Test", testRef)).to.never.be.ok() expect(fabric:getUnitByRef("Test2", testRef)).to.never.be.ok() end) end) describe("Fabric:fire and Fabric:on", function() it("should fire events", function() local fabric = Fabric.new() local callCount = 0 fabric:on("testEvent", function() callCount += 1 end) expect(callCount).to.equal(0) fabric:fire("testEvent") expect(callCount).to.equal(1) fabric:fire("doesn't exist") expect(callCount).to.equal(1) end) end) end
return require('packer').startup(function() local use = require('packer').use -- Packer use 'wbthomason/packer.nvim' use 'lewis6991/impatient.nvim' -- Async building & commands -- use { 'tpope/vim-dispatch', cmd = { 'Dispatch', 'Make', 'Focus', 'Start' } } -- Utility Plugins use 'tpope/vim-surround' use 'sindrets/diffview.nvim' use 'jiangmiao/auto-pairs' -- use 'tomtom/tcomment_vim' use 'metakirby5/codi.vim' use 'github/copilot.vim' -- use {'neoclide/coc.nvim', branch = 'release' } use { 'numToStr/Comment.nvim', config = function() require('Comment').setup() end } -- Search use 'nvim-lua/popup.nvim' use { 'nvim-telescope/telescope.nvim', requires = { {'nvim-lua/plenary.nvim'} } } use 'nvim-telescope/telescope-fzy-native.nvim' -- Git use 'tpope/vim-fugitive' -- Async signs! use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' }, config = function() require('gitsigns').setup() end } -- Pretty symbols use { 'kyazdani42/nvim-web-devicons', config = function() require('nvim-web-devicons').setup { default = true } end } -- Completion and linting use { 'neovim/nvim-lspconfig', 'hrsh7th/nvim-cmp', -- 'L3MON4D3/LuaSnip', -- 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', 'hrsh7th/vim-vsnip', 'hrsh7th/vim-vsnip-integ', 'rafamadriz/friendly-snippets', } -- Plug 'folke/lsp-colors.nvim' -- Plug 'onsails/lspkind-nvim' -- Plug 'williamboman/nvim-lsp-installer' -- Highlights use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', config = function() require('nvim-treesitter.configs').setup { indent = { enable = true }, highlight = { enable = true }, incremental_selection = { enable = true }, textobjects = { enable = true }, } end } -- Documentation -- use { -- 'danymat/neogen', -- requires = 'nvim-treesitter', -- config = [[require('config.neogen')]], -- keys = { '<localleader>d', '<localleader>df', '<localleader>dc' }, -- } -- Navigation use 'christoomey/vim-tmux-navigator' use { 'karb94/neoscroll.nvim', config = function() require('neoscroll').setup {} end } -- Diagnostics use { "folke/trouble.nvim", requires = "kyazdani42/nvim-web-devicons", config = function() require("trouble").setup {} end } -- Formatting use 'godlygeek/tabular' use "onsails/lspkind-nvim" use({ "jose-elias-alvarez/null-ls.nvim", config = function() require("null-ls").setup({ sources = { require("null-ls").builtins.formatting.prettier, require("null-ls").builtins.diagnostics.eslint, }, }) end, requires = { "nvim-lua/plenary.nvim" }, }) -- Themes use 'dracula/vim' use 'EdenEast/nightfox.nvim' use 'folke/tokyonight.nvim' -- Statusline use { 'nvim-lualine/lualine.nvim', requires = {'kyazdani42/nvim-web-devicons', opt = true}, config = function() require('lualine').setup { options = { theme = 'nightfox', component_separators = '', section_separators = '', }, } end } -- Starting screen use { 'goolord/alpha-nvim', requires = { 'kyazdani42/nvim-web-devicons' }, config = function () -- require'alpha'.setup(require'psto.alpha.themes.startify'.opts) require'alpha'.setup(require'psto.alpha.themes.dashboard'.opts) end } -- Pretty colors use { "norcalli/nvim-colorizer.lua", config = function() require("colorizer").setup() end, } -- Writing mode use { "folke/zen-mode.nvim", config = function() require("zen-mode").setup { window = { options = { relativenumber = false, -- disable relative numbers number = false, -- disable number column cursorline = false, -- disable cursorline }, plugins = { twilight = { enabled = true }, -- start Twilight when zen mode opens }, } } end, } use { -- background issue fix https://github.com/folke/twilight.nvim/issues/15 "folke/twilight.nvim", config = function() require("twilight").setup { dimming = { alpha = 0.25, color = { "Normal", "#1F2430" }, } } end } end)
Omen3DB = { ["profileKeys"] = { ["黑暗主宰 - 森金"] = "黑暗主宰 - 森金", }, ["profiles"] = { ["黑暗主宰 - 森金"] = { ["PositionY"] = 459.000008282667, ["PositionX"] = 567.5000220757034, }, }, }
--[[ ########################################################## S V U I By: Munglunch ########################################################## LOCALIZED LUA FUNCTIONS ########################################################## ]]-- --[[ GLOBALS ]]-- local _G = _G; local unpack = _G.unpack; local select = _G.select; local pairs = _G.pairs; local ipairs = _G.ipairs; local print = _G.print; local tinsert = _G.tinsert; local table = _G.table; local match = string.match; --[[ TABLE METHODS ]]-- local tremove, tcopy, twipe, tsort, tcat = table.remove, table.copy, table.wipe, table.sort, table.concat; --BLIZZARD API local CreateFrame = _G.CreateFrame; local InCombatLockdown = _G.InCombatLockdown; local GameTooltip = _G.GameTooltip; local ReloadUI = _G.ReloadUI; local hooksecurefunc = _G.hooksecurefunc; local GetItemInfo = _G.GetItemInfo; local GetItemCount = _G.GetItemCount; local GetSpellInfo = _G.GetSpellInfo; local IsSpellKnown = _G.IsSpellKnown; local IsEquippableItem = _G.IsEquippableItem; local GetSpellBookItemInfo = _G.GetSpellBookItemInfo; local ERR_NOT_IN_COMBAT = _G.ERR_NOT_IN_COMBAT; local ITEM_MILLABLE = _G.ITEM_MILLABLE; local ITEM_PROSPECTABLE = _G.ITEM_PROSPECTABLE; local GetMouseFocus = _G.GetMouseFocus; local GetContainerItemLink = _G.GetContainerItemLink; local AutoCastShine_AutoCastStart = _G.AutoCastShine_AutoCastStart; local AutoCastShine_AutoCastStop = _G.AutoCastShine_AutoCastStop; --[[ ########################################################## GET ADDON DATA ########################################################## ]]-- local SV = select(2, ...) local L = SV.L; local MOD = SV.Dock; --[[ ########################################################## LOCAL VARS ########################################################## ]]-- local BreakStuff_Cache = {} local DE, PICK, SMITH, BreakStuffParser; local BreakStuffButton = CreateFrame("Button", "BreakStuffButton", UIParent); BreakStuffButton.icon = BreakStuffButton:CreateTexture(nil,"OVERLAY") BreakStuffButton.icon:InsetPoints(BreakStuffButton,2,2) BreakStuffButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) BreakStuffButton.ttText = "BreakStuff : OFF"; BreakStuffButton.subText = ""; local BreakStuffHandler = CreateFrame('Button', "BreakStuffHandler", UIParent, 'SecureActionButtonTemplate, AutoCastShineTemplate') BreakStuffHandler:SetScript('OnEvent', function(self, event, ...) self[event](self, ...) end) BreakStuffHandler:SetPoint("LEFT",UIParent,"RIGHT",500) BreakStuffHandler.TipLines = {} BreakStuffHandler.TTextLeft = "" BreakStuffHandler.TTextRight = "" BreakStuffHandler.ReadyToSmash = false; --[[ ########################################################## ITEM PARSING ########################################################## ]]-- do local SkellyKeys = { [GetSpellInfo(130100)] = true, -- Ghostly Skeleton Key [GetSpellInfo(94574)] = true, -- Obsidium Skeleton Key [GetSpellInfo(59403)] = true, -- Titanium Skeleton Key [GetSpellInfo(59404)] = true, -- Colbat Skeleton Key [GetSpellInfo(20709)] = true, -- Arcanite Skeleton Key [GetSpellInfo(19651)] = true, -- Truesilver Skeleton Key [GetSpellInfo(19649)] = true, -- Golden Skeleton Key [GetSpellInfo(19646)] = true, -- Silver Skeleton Key } local BreakableFilter = { ["Pickables"]={['68729']=true,['63349']=true,['45986']=true,['43624']=true,['43622']=true,['43575']=true,['31952']=true,['12033']=true,['29569']=true,['5760']=true,['13918']=true,['5759']=true,['16885']=true,['5758']=true,['13875']=true,['4638']=true,['16884']=true,['4637']=true,['4636']=true,['6355']=true,['16883']=true,['4634']=true,['4633']=true,['6354']=true,['16882']=true,['4632']=true,['88165']=true,['88567']=true},["SafeItems"]={['89392']=true,['89393']=true,['89394']=true,['89395']=true,['89396']=true,['89397']=true,['89398']=true,['89399']=true,['89400']=true,['83260']=true,['83261']=true,['83262']=true,['83263']=true,['83264']=true,['83265']=true,['83266']=true,['83267']=true,['83268']=true,['83269']=true,['83270']=true,['83271']=true,['83274']=true,['83275']=true,['82706']=true,['82707']=true,['82708']=true,['82709']=true,['82710']=true,['82711']=true,['82712']=true,['82713']=true,['82714']=true,['82715']=true,['82716']=true,['82717']=true,['82720']=true,['82721']=true,['81671']=true,['81672']=true,['81673']=true,['81674']=true,['81675']=true,['81676']=true,['81677']=true,['81678']=true,['81679']=true,['81680']=true,['81681']=true,['81682']=true,['81685']=true,['81686']=true,['64377']=true,['64489']=true,['64880']=true,['64885']=true,['62454']=true,['62455']=true,['62456']=true,['62457']=true,['62458']=true,['62459']=true,['62460']=true,['68740']=true,['49888']=true,['49497']=true,['49301']=true,['72980']=true,['72981']=true,['72989']=true,['72990']=true,['72991']=true,['72992']=true,['72993']=true,['72994']=true,['72995']=true,['72996']=true,['72997']=true,['72998']=true,['72999']=true,['73000']=true,['73001']=true,['73002']=true,['73003']=true,['73006']=true,['73007']=true,['73008']=true,['73009']=true,['73010']=true,['73011']=true,['73012']=true,['73325']=true,['73326']=true,['73336']=true,['88622']=true,['88648']=true,['88649']=true,['64460']=true,['44050']=true,['44173']=true,['44174']=true,['44192']=true,['44193']=true,['44199']=true,['44244']=true,['44245']=true,['44249']=true,['44250']=true,['44051']=true,['44052']=true,['44053']=true,['44108']=true,['44166']=true,['44187']=true,['44214']=true,['44241']=true,['38454']=true,['38455']=true,['38456']=true,['38457']=true,['38460']=true,['38461']=true,['38464']=true,['38465']=true,['29115']=true,['29130']=true,['29133']=true,['29137']=true,['29138']=true,['29166']=true,['29167']=true,['29185']=true,['34665']=true,['34666']=true,['34667']=true,['34670']=true,['34671']=true,['34672']=true,['34673']=true,['34674']=true,['29121']=true,['29124']=true,['29125']=true,['29151']=true,['29152']=true,['29153']=true,['29155']=true,['29156']=true,['29165']=true,['29171']=true,['29175']=true,['29182']=true,['30830']=true,['30832']=true,['29456']=true,['29457']=true,['25835']=true,['25836']=true,['25823']=true,['25825']=true,['77559']=true,['77570']=true,['77583']=true,['77586']=true,['77587']=true,['77588']=true,['21392']=true,['21395']=true,['21398']=true,['21401']=true,['21404']=true,['21407']=true,['21410']=true,['21413']=true,['21416']=true,['38632']=true,['38633']=true,['38707']=true,['34661']=true,['11290']=true,['11289']=true,['45858']=true,['84661']=true,['11288']=true,['28164']=true,['11287']=true,['44180']=true,['44202']=true,['44302']=true,['44200']=true,['44256']=true,['44104']=true,['44116']=true,['44196']=true,['44061']=true,['44062']=true,['29117']=true,['29129']=true,['29174']=true,['30836']=true,['35328']=true,['35329']=true,['35330']=true,['35331']=true,['35332']=true,['35333']=true,['35334']=true,['35335']=true,['35336']=true,['35337']=true,['35338']=true,['35339']=true,['35340']=true,['35341']=true,['35342']=true,['35343']=true,['35344']=true,['35345']=true,['35346']=true,['35347']=true,['35464']=true,['35465']=true,['35466']=true,['35467']=true,['30847']=true,['29122']=true,['29183']=true,['90079']=true,['90080']=true,['90081']=true,['90082']=true,['90083']=true,['90084']=true,['90085']=true,['90086']=true,['90110']=true,['90111']=true,['90112']=true,['90113']=true,['90114']=true,['90115']=true,['90116']=true,['90117']=true,['90136']=true,['90137']=true,['90138']=true,['90139']=true,['90140']=true,['90141']=true,['90142']=true,['90143']=true,['64643']=true,['77678']=true,['77679']=true,['77682']=true,['77692']=true,['77694']=true,['77695']=true,['77709']=true,['77710']=true,['77712']=true,['77886']=true,['77889']=true,['77890']=true,['77899']=true,['77900']=true,['77901']=true,['77917']=true,['77919']=true,['77920']=true,['77680']=true,['77681']=true,['77683']=true,['77690']=true,['77691']=true,['77693']=true,['77708']=true,['77711']=true,['77713']=true,['77887']=true,['77888']=true,['77891']=true,['77898']=true,['77902']=true,['77903']=true,['77916']=true,['77918']=true,['77921']=true,['77778']=true,['77779']=true,['77784']=true,['77795']=true,['77796']=true,['77800']=true,['77801']=true,['77844']=true,['77845']=true,['77846']=true,['77850']=true,['77777']=true,['77781']=true,['77782']=true,['77785']=true,['77797']=true,['77798']=true,['77799']=true,['77802']=true,['77847']=true,['77848']=true,['77851']=true,['77852']=true,['77724']=true,['77725']=true,['77728']=true,['77729']=true,['77732']=true,['77733']=true,['77773']=true,['77783']=true,['77803']=true,['77804']=true,['77843']=true,['77849']=true,['77614']=true,['77615']=true,['77616']=true,['77617']=true,['77618']=true,['77619']=true,['77620']=true,['77627']=true,['77628']=true,['77629']=true,['77630']=true,['77631']=true,['77632']=true,['77647']=true,['77648']=true,['77649']=true,['77650']=true,['77651']=true,['77652']=true,['77770']=true,['77771']=true,['77772']=true,['77774']=true,['77775']=true,['77776']=true,['77786']=true,['77789']=true,['77790']=true,['77791']=true,['77792']=true,['77793']=true,['77794']=true,['77837']=true,['77838']=true,['77839']=true,['77840']=true,['77841']=true,['77842']=true,['20406']=true,['20407']=true,['20408']=true,['77787']=true,['77788']=true,['28155']=true,['22986']=true,['22991']=true,['33292']=true,['86566']=true,['95517']=true,['95518']=true,['95523']=true,['95526']=true,['95527']=true,['95532']=true,['83158']=true,['83162']=true,['83167']=true,['83171']=true,['83176']=true,['83180']=true,['83185']=true,['83189']=true,['83194']=true,['83198']=true,['83203']=true,['83207']=true,['83212']=true,['83216']=true,['83221']=true,['83225']=true,['82614']=true,['82618']=true,['82623']=true,['82627']=true,['82632']=true,['82636']=true,['82641']=true,['82645']=true,['82650']=true,['82654']=true,['82659']=true,['82663']=true,['82668']=true,['82672']=true,['82677']=true,['82681']=true,['81579']=true,['81583']=true,['81588']=true,['81592']=true,['81597']=true,['81601']=true,['81606']=true,['81610']=true,['81615']=true,['81619']=true,['81624']=true,['81628']=true,['81633']=true,['81637']=true,['81642']=true,['81646']=true,['70118']=true,['62364']=true,['62386']=true,['62450']=true,['62441']=true,['62356']=true,['62406']=true,['62424']=true,['72621']=true,['72622']=true,['72623']=true,['72624']=true,['72625']=true,['72626']=true,['72627']=true,['72628']=true,['72638']=true,['72639']=true,['72640']=true,['72641']=true,['72642']=true,['72643']=true,['72644']=true,['72645']=true,['72646']=true,['72647']=true,['72648']=true,['72649']=true,['72650']=true,['72651']=true,['72652']=true,['72653']=true,['72655']=true,['72656']=true,['72657']=true,['72658']=true,['72659']=true,['72660']=true,['72661']=true,['72662']=true,['44180']=true,['44202']=true,['44302']=true,['44200']=true,['44256']=true,['44181']=true,['44203']=true,['44297']=true,['44303']=true,['44179']=true,['44194']=true,['44258']=true,['44106']=true,['44170']=true,['44190']=true,['44117']=true,['44054']=true,['44055']=true,['29116']=true,['29131']=true,['29141']=true,['29142']=true,['29147']=true,['29148']=true,['35356']=true,['35357']=true,['35358']=true,['35359']=true,['35360']=true,['35361']=true,['35362']=true,['35363']=true,['35364']=true,['35365']=true,['35366']=true,['35367']=true,['35368']=true,['35369']=true,['35370']=true,['35371']=true,['35372']=true,['35373']=true,['35374']=true,['35375']=true,['35468']=true,['35469']=true,['35470']=true,['35471']=true,['25838']=true,['90059']=true,['90060']=true,['90061']=true,['90062']=true,['90063']=true,['90064']=true,['90065']=true,['90066']=true,['90088']=true,['90089']=true,['90090']=true,['90091']=true,['90092']=true,['90093']=true,['90094']=true,['90095']=true,['90119']=true,['90120']=true,['90121']=true,['90122']=true,['90123']=true,['90124']=true,['90125']=true,['90126']=true,['77667']=true,['77670']=true,['77671']=true,['77697']=true,['77700']=true,['77701']=true,['77874']=true,['77876']=true,['77878']=true,['77907']=true,['77908']=true,['77909']=true,['77666']=true,['77668']=true,['77669']=true,['77696']=true,['77698']=true,['77699']=true,['77875']=true,['77877']=true,['77879']=true,['77904']=true,['77905']=true,['77906']=true,['77742']=true,['77746']=true,['77748']=true,['77752']=true,['77813']=true,['77815']=true,['77819']=true,['77820']=true,['77744']=true,['77745']=true,['77749']=true,['77811']=true,['77812']=true,['77818']=true,['77821']=true,['77720']=true,['77721']=true,['77730']=true,['77731']=true,['77747']=true,['77750']=true,['77816']=true,['77817']=true,['77598']=true,['77599']=true,['77600']=true,['77601']=true,['77602']=true,['77603']=true,['77604']=true,['77633']=true,['77634']=true,['77635']=true,['77636']=true,['77637']=true,['77638']=true,['77639']=true,['77736']=true,['77737']=true,['77738']=true,['77739']=true,['77740']=true,['77741']=true,['77743']=true,['77805']=true,['77806']=true,['77807']=true,['77808']=true,['77809']=true,['77810']=true,['77814']=true,['77605']=true,['77640']=true,['77753']=true,['77822']=true,['28158']=true,['22987']=true,['22992']=true,['95519']=true,['95521']=true,['95528']=true,['95530']=true,['83159']=true,['83163']=true,['83168']=true,['83172']=true,['83177']=true,['83181']=true,['83186']=true,['83190']=true,['83195']=true,['83199']=true,['83204']=true,['83208']=true,['83213']=true,['83217']=true,['83222']=true,['83226']=true,['82615']=true,['82619']=true,['82624']=true,['82628']=true,['82633']=true,['82637']=true,['82642']=true,['82646']=true,['82651']=true,['82655']=true,['82660']=true,['82664']=true,['82669']=true,['82673']=true,['82678']=true,['82682']=true,['81580']=true,['81584']=true,['81589']=true,['81593']=true,['81598']=true,['81602']=true,['81607']=true,['81611']=true,['81616']=true,['81620']=true,['81625']=true,['81629']=true,['81634']=true,['81638']=true,['81643']=true,['81647']=true,['70114']=true,['70122']=true,['62417']=true,['62420']=true,['62431']=true,['62433']=true,['62358']=true,['62381']=true,['62446']=true,['62374']=true,['62404']=true,['62405']=true,['62425']=true,['62426']=true,['72664']=true,['72665']=true,['72666']=true,['72667']=true,['72668']=true,['72669']=true,['72670']=true,['72671']=true,['72672']=true,['72673']=true,['72674']=true,['72675']=true,['72676']=true,['72677']=true,['72678']=true,['72679']=true,['72681']=true,['72682']=true,['72683']=true,['72684']=true,['72685']=true,['72686']=true,['72687']=true,['72688']=true,['72689']=true,['72690']=true,['72691']=true,['72692']=true,['72693']=true,['72694']=true,['72695']=true,['72696']=true,['88614']=true,['88615']=true,['88616']=true,['88617']=true,['88618']=true,['88619']=true,['88620']=true,['88621']=true,['88623']=true,['88624']=true,['88625']=true,['88626']=true,['88627']=true,['88628']=true,['88629']=true,['88630']=true,['44181']=true,['44203']=true,['44297']=true,['44303']=true,['44179']=true,['44194']=true,['44258']=true,['44182']=true,['44204']=true,['44295']=true,['44305']=true,['44248']=true,['44257']=true,['44109']=true,['44110']=true,['44122']=true,['44171']=true,['44189']=true,['44059']=true,['44060']=true,['29135']=true,['29136']=true,['29180']=true,['30835']=true,['35376']=true,['35377']=true,['35378']=true,['35379']=true,['35380']=true,['35381']=true,['35382']=true,['35383']=true,['35384']=true,['35385']=true,['35386']=true,['35387']=true,['35388']=true,['35389']=true,['35390']=true,['35391']=true,['35392']=true,['35393']=true,['35394']=true,['35395']=true,['35472']=true,['35473']=true,['35474']=true,['35475']=true,['64644']=true,['90068']=true,['90069']=true,['90070']=true,['90071']=true,['90072']=true,['90073']=true,['90074']=true,['90075']=true,['90127']=true,['90128']=true,['90129']=true,['90130']=true,['90131']=true,['90132']=true,['90133']=true,['90134']=true,['77673']=true,['77674']=true,['77676']=true,['77704']=true,['77705']=true,['77707']=true,['77880']=true,['77882']=true,['77883']=true,['77910']=true,['77913']=true,['77914']=true,['77672']=true,['77675']=true,['77677']=true,['77702']=true,['77703']=true,['77706']=true,['77881']=true,['77884']=true,['77885']=true,['77911']=true,['77912']=true,['77915']=true,['77642']=true,['77645']=true,['77762']=true,['77763']=true,['77765']=true,['77766']=true,['77831']=true,['77832']=true,['77641']=true,['77643']=true,['77760']=true,['77761']=true,['77768']=true,['77769']=true,['77829']=true,['77834']=true,['77644']=true,['77646']=true,['77722']=true,['77723']=true,['77764']=true,['77767']=true,['77830']=true,['77833']=true,['77606']=true,['77607']=true,['77608']=true,['77609']=true,['77610']=true,['77611']=true,['77612']=true,['77754']=true,['77755']=true,['77756']=true,['77757']=true,['77758']=true,['77759']=true,['77823']=true,['77824']=true,['77825']=true,['77826']=true,['77827']=true,['77828']=true,['77835']=true,['28162']=true,['22985']=true,['22993']=true,['95522']=true,['95525']=true,['95531']=true,['95534']=true,['83160']=true,['83164']=true,['83169']=true,['83173']=true,['83178']=true,['83182']=true,['83187']=true,['83191']=true,['83196']=true,['83200']=true,['83205']=true,['83209']=true,['83214']=true,['83218']=true,['83223']=true,['83227']=true,['82616']=true,['82620']=true,['82625']=true,['82629']=true,['82634']=true,['82638']=true,['82643']=true,['82647']=true,['82652']=true,['82656']=true,['82661']=true,['82665']=true,['82670']=true,['82674']=true,['82679']=true,['82683']=true,['81581']=true,['81585']=true,['81590']=true,['81594']=true,['81599']=true,['81603']=true,['81608']=true,['81612']=true,['81617']=true,['81621']=true,['81626']=true,['81630']=true,['81635']=true,['81639']=true,['81644']=true,['81648']=true,['70115']=true,['70123']=true,['62363']=true,['62385']=true,['62380']=true,['62409']=true,['62429']=true,['62445']=true,['62353']=true,['62407']=true,['62423']=true,['62439']=true,['72698']=true,['72699']=true,['72700']=true,['72701']=true,['72702']=true,['72703']=true,['72704']=true,['72705']=true,['72889']=true,['72890']=true,['72891']=true,['72892']=true,['72893']=true,['72894']=true,['72895']=true,['72896']=true,['72902']=true,['72903']=true,['72904']=true,['72905']=true,['72906']=true,['72907']=true,['72908']=true,['72909']=true,['72910']=true,['72911']=true,['72912']=true,['72913']=true,['72914']=true,['72915']=true,['72916']=true,['72917']=true,['44182']=true,['44204']=true,['44295']=true,['44305']=true,['44248']=true,['44257']=true,['44183']=true,['44205']=true,['44296']=true,['44306']=true,['44176']=true,['44195']=true,['44198']=true,['44201']=true,['44247']=true,['44111']=true,['44112']=true,['44120']=true,['44121']=true,['44123']=true,['44197']=true,['44239']=true,['44240']=true,['44243']=true,['44057']=true,['44058']=true,['40440']=true,['40441']=true,['40442']=true,['40443']=true,['40444']=true,['29127']=true,['29134']=true,['29184']=true,['35402']=true,['35403']=true,['35404']=true,['35405']=true,['35406']=true,['35407']=true,['35408']=true,['35409']=true,['35410']=true,['35411']=true,['35412']=true,['35413']=true,['35414']=true,['35415']=true,['35416']=true,['35476']=true,['35477']=true,['35478']=true,['90049']=true,['90050']=true,['90051']=true,['90052']=true,['90053']=true,['90054']=true,['90055']=true,['90056']=true,['90096']=true,['90097']=true,['90098']=true,['90099']=true,['90100']=true,['90101']=true,['90102']=true,['90103']=true,['90147']=true,['90148']=true,['90149']=true,['90150']=true,['90151']=true,['90152']=true,['90153']=true,['90154']=true,['77687']=true,['77688']=true,['77689']=true,['77714']=true,['77715']=true,['77718']=true,['77892']=true,['77894']=true,['77897']=true,['77923']=true,['77924']=true,['77927']=true,['77684']=true,['77685']=true,['77686']=true,['77716']=true,['77717']=true,['77719']=true,['77893']=true,['77895']=true,['77896']=true,['77922']=true,['77925']=true,['77926']=true,['77664']=true,['77665']=true,['77859']=true,['77867']=true,['77868']=true,['77869']=true,['77871']=true,['77872']=true,['38661']=true,['38663']=true,['38665']=true,['38666']=true,['38667']=true,['38668']=true,['38669']=true,['38670']=true,['77661']=true,['77662']=true,['77663']=true,['77858']=true,['77864']=true,['77865']=true,['77866']=true,['77873']=true,['77726']=true,['77727']=true,['77734']=true,['77735']=true,['77862']=true,['77863']=true,['77928']=true,['77929']=true,['77621']=true,['77622']=true,['77623']=true,['77624']=true,['77625']=true,['77626']=true,['77653']=true,['77654']=true,['77655']=true,['77656']=true,['77657']=true,['77658']=true,['77659']=true,['77853']=true,['77854']=true,['77855']=true,['77856']=true,['77857']=true,['77860']=true,['77861']=true,['34648']=true,['34649']=true,['34650']=true,['34651']=true,['34652']=true,['34653']=true,['34655']=true,['34656']=true,['77660']=true,['95520']=true,['95524']=true,['95529']=true,['95533']=true,['83161']=true,['83165']=true,['83166']=true,['83170']=true,['83174']=true,['83175']=true,['83179']=true,['83183']=true,['83184']=true,['83188']=true,['83192']=true,['83193']=true,['83197']=true,['83201']=true,['83202']=true,['83206']=true,['83210']=true,['83211']=true,['83215']=true,['83219']=true,['83220']=true,['83224']=true,['83228']=true,['83229']=true,['82617']=true,['82621']=true,['82622']=true,['82626']=true,['82630']=true,['82631']=true,['82635']=true,['82639']=true,['82640']=true,['82644']=true,['82648']=true,['82649']=true,['82653']=true,['82657']=true,['82658']=true,['82662']=true,['82666']=true,['82667']=true,['82671']=true,['82675']=true,['82676']=true,['82680']=true,['82684']=true,['82685']=true,['81582']=true,['81586']=true,['81587']=true,['81591']=true,['81595']=true,['81596']=true,['81600']=true,['81604']=true,['81605']=true,['81609']=true,['81613']=true,['81614']=true,['81618']=true,['81622']=true,['81623']=true,['81627']=true,['81631']=true,['81632']=true,['81636']=true,['81640']=true,['81641']=true,['81645']=true,['81649']=true,['81650']=true,['70108']=true,['70116']=true,['70117']=true,['70120']=true,['70121']=true,['62365']=true,['62384']=true,['62418']=true,['62432']=true,['62448']=true,['62449']=true,['62359']=true,['62382']=true,['62408']=true,['62410']=true,['62428']=true,['62430']=true,['62355']=true,['62438']=true,['72918']=true,['72919']=true,['72920']=true,['72921']=true,['72922']=true,['72923']=true,['72924']=true,['72925']=true,['72929']=true,['72930']=true,['72931']=true,['72932']=true,['72933']=true,['72934']=true,['72935']=true,['72936']=true,['72937']=true,['72938']=true,['72939']=true,['72940']=true,['72941']=true,['72942']=true,['72943']=true,['72944']=true,['72945']=true,['72946']=true,['72947']=true,['72948']=true,['72949']=true,['72950']=true,['72951']=true,['72952']=true,['72955']=true,['72956']=true,['72957']=true,['72958']=true,['72959']=true,['72960']=true,['72961']=true,['72962']=true,['72963']=true,['72964']=true,['72965']=true,['72966']=true,['72967']=true,['72968']=true,['72969']=true,['72970']=true,['72971']=true,['72972']=true,['72973']=true,['72974']=true,['72975']=true,['72976']=true,['72977']=true,['72978']=true,['44183']=true,['44205']=true,['44296']=true,['44306']=true,['44176']=true,['44195']=true,['44198']=true,['44201']=true,['44247']=true,['29278']=true,['29282']=true,['29286']=true,['29291']=true,['31113']=true,['34675']=true,['34676']=true,['34677']=true,['34678']=true,['34679']=true,['34680']=true,['29128']=true,['29132']=true,['29139']=true,['29140']=true,['29145']=true,['29146']=true,['29168']=true,['29169']=true,['29173']=true,['29179']=true,['29276']=true,['29280']=true,['29284']=true,['29288']=true,['30841']=true,['32538']=true,['32539']=true,['29277']=true,['29281']=true,['29285']=true,['29289']=true,['32864']=true,['31341']=true,['29119']=true,['29123']=true,['29126']=true,['29170']=true,['29172']=true,['29176']=true,['29177']=true,['29181']=true,['32770']=true,['32771']=true,['30834']=true,['25824']=true,['25826']=true,['21200']=true,['21205']=true,['21210']=true,['52252']=true,['21199']=true,['21204']=true,['21209']=true,['49052']=true,['49054']=true,['21198']=true,['21203']=true,['21208']=true,['32695']=true,['38662']=true,['38664']=true,['38671']=true,['38672']=true,['38674']=true,['38675']=true,['39320']=true,['39322']=true,['32694']=true,['21394']=true,['21397']=true,['21400']=true,['21403']=true,['21406']=true,['21409']=true,['21412']=true,['21415']=true,['21418']=true,['21197']=true,['21202']=true,['21207']=true,['21393']=true,['21396']=true,['21399']=true,['21402']=true,['21405']=true,['21408']=true,['21411']=true,['21414']=true,['21417']=true,['17904']=true,['17909']=true,['21196']=true,['21201']=true,['21206']=true,['65274']=true,['65360']=true,['17902']=true,['17903']=true,['17907']=true,['17908']=true,['40476']=true,['40477']=true,['17690']=true,['17691']=true,['17900']=true,['17901']=true,['17905']=true,['17906']=true,['34657']=true,['34658']=true,['34659']=true,['38147']=true,['21766']=true,['64886']=true,['64887']=true,['64888']=true,['64889']=true,['64890']=true,['64891']=true,['64892']=true,['64893']=true,['64894']=true,['64895']=true,['64896']=true,['64897']=true,['64898']=true,['64899']=true,['64900']=true,['64901']=true,['64902']=true,['64903']=true,['64905']=true,['64906']=true,['64907']=true,['64908']=true,['64909']=true,['64910']=true,['64911']=true,['64912']=true,['64913']=true,['64914']=true,['64915']=true,['64916']=true,['64917']=true,['64918']=true,['64919']=true,['64920']=true,['64921']=true,['64922']=true,['4614']=true,['22990']=true,['34484']=true,['34486']=true,['23705']=true,['23709']=true,['38309']=true,['38310']=true,['38311']=true,['38312']=true,['38313']=true,['38314']=true,['40643']=true,['43300']=true,['43348']=true,['43349']=true,['98162']=true,['35279']=true,['35280']=true,['40483']=true,['46874']=true,['89401']=true,['89784']=true,['89795']=true,['89796']=true,['89797']=true,['89798']=true,['89799']=true,['89800']=true,['95591']=true,['95592']=true,['97131']=true,['50384']=true,['50386']=true,['50387']=true,['50388']=true,['52570']=true,['50375']=true,['50376']=true,['50377']=true,['50378']=true,['52569']=true,['72982']=true,['72983']=true,['72984']=true,['73004']=true,['73005']=true,['73013']=true,['73014']=true,['73015']=true,['73016']=true,['73017']=true,['73018']=true,['73019']=true,['73020']=true,['73021']=true,['73022']=true,['73023']=true,['73024']=true,['73025']=true,['73026']=true,['73027']=true,['73042']=true,['73060']=true,['73061']=true,['73062']=true,['73063']=true,['73064']=true,['73065']=true,['73066']=true,['73067']=true,['73068']=true,['73101']=true,['73102']=true,['73103']=true,['73104']=true,['73105']=true,['73106']=true,['73107']=true,['73108']=true,['73109']=true,['73110']=true,['73111']=true,['73112']=true,['73113']=true,['73114']=true,['73115']=true,['73116']=true,['73117']=true,['73118']=true,['73119']=true,['73120']=true,['73121']=true,['73122']=true,['73123']=true,['73124']=true,['73125']=true,['73126']=true,['73127']=true,['73128']=true,['73129']=true,['73130']=true,['73131']=true,['73132']=true,['73133']=true,['73134']=true,['73135']=true,['73136']=true,['73137']=true,['73138']=true,['73139']=true,['73140']=true,['73141']=true,['73142']=true,['73143']=true,['73144']=true,['73145']=true,['73146']=true,['73147']=true,['73148']=true,['73149']=true,['73150']=true,['73151']=true,['73152']=true,['73153']=true,['73154']=true,['73155']=true,['73156']=true,['73157']=true,['73158']=true,['73159']=true,['73160']=true,['73161']=true,['73162']=true,['73163']=true,['73164']=true,['73165']=true,['73166']=true,['73167']=true,['73168']=true,['73169']=true,['73170']=true,['73306']=true,['73307']=true,['73308']=true,['73309']=true,['73310']=true,['73311']=true,['73312']=true,['73313']=true,['73314']=true,['73315']=true,['73316']=true,['73317']=true,['73318']=true,['73319']=true,['73320']=true,['73321']=true,['73322']=true,['73323']=true,['73324']=true,['88632']=true,['88633']=true,['88634']=true,['88635']=true,['88636']=true,['88637']=true,['88638']=true,['88639']=true,['88640']=true,['88641']=true,['88642']=true,['88643']=true,['88644']=true,['88645']=true,['88646']=true,['88647']=true,['88667']=true,['44073']=true,['44074']=true,['44283']=true,['44167']=true,['44188']=true,['44216']=true,['44242']=true,['38452']=true,['38453']=true,['38458']=true,['38459']=true,['38462']=true,['38463']=true,['29297']=true,['29301']=true,['29305']=true,['29309']=true,['29296']=true,['29308']=true,['32485']=true,['32486']=true,['32487']=true,['32488']=true,['32489']=true,['32490']=true,['32491']=true,['32492']=true,['32493']=true,['32649']=true,['32757']=true,['29295']=true,['29299']=true,['29303']=true,['29306']=true,['29300']=true,['29304']=true,['29279']=true,['29283']=true,['29287']=true,['29290']=true,['29294']=true,['29298']=true,['29302']=true,['29307']=true,['29278']=true,['29282']=true,['29286']=true,['29291']=true,['98146']=true,['98147']=true,['98148']=true,['98149']=true,['98150']=true,['98335']=true,['92782']=true,['92783']=true,['92784']=true,['92785']=true,['92786']=true,['92787']=true,['93391']=true,['93392']=true,['93393']=true,['93394']=true,['93395']=true,['95425']=true,['95427']=true,['95428']=true,['95429']=true,['95430']=true,['88166']=true,['88167']=true,['88168']=true,['88169']=true,['75274']=true,['83230']=true,['83231']=true,['83232']=true,['83233']=true,['83234']=true,['83235']=true,['83236']=true,['83237']=true,['83238']=true,['83239']=true,['83245']=true,['83246']=true,['83247']=true,['83248']=true,['83249']=true,['83255']=true,['83256']=true,['83257']=true,['83258']=true,['83259']=true,['83272']=true,['83273']=true,['86567']=true,['86570']=true,['86572']=true,['86576']=true,['86579']=true,['86585']=true,['86587']=true,['87780']=true,['82686']=true,['82687']=true,['82688']=true,['82689']=true,['82690']=true,['82691']=true,['82692']=true,['82693']=true,['82694']=true,['82695']=true,['82696']=true,['82697']=true,['82698']=true,['82699']=true,['82700']=true,['82701']=true,['82702']=true,['82703']=true,['82704']=true,['82705']=true,['82718']=true,['82719']=true,['81651']=true,['81652']=true,['81653']=true,['81654']=true,['81655']=true,['81656']=true,['81657']=true,['81658']=true,['81659']=true,['81660']=true,['81661']=true,['81662']=true,['81663']=true,['81664']=true,['81665']=true,['81666']=true,['81667']=true,['81668']=true,['81669']=true,['81670']=true,['81683']=true,['81684']=true,['70105']=true,['70106']=true,['70107']=true,['70110']=true,['70112']=true,['70113']=true,['70119']=true,['70124']=true,['70126']=true,['70127']=true,['70141']=true,['70142']=true,['70143']=true,['70144']=true,['58483']=true,['62362']=true,['62383']=true,['62416']=true,['62434']=true,['62447']=true,['62463']=true,['62464']=true,['62465']=true,['62466']=true,['62467']=true,['64645']=true,['64904']=true,['68775']=true,['68776']=true,['68777']=true,['69764']=true,['62348']=true,['62350']=true,['62351']=true,['62352']=true,['62357']=true,['62361']=true,['62378']=true,['62415']=true,['62427']=true,['62440']=true,['62354']=true,['62375']=true,['62376']=true,['62377']=true,['62436']=true,['62437']=true,['65175']=true,['65176']=true,['50398']=true,['50400']=true,['50402']=true,['50404']=true,['52572']=true,['50397']=true,['50399']=true,['50401']=true,['50403']=true,['52571']=true} } local AllowedItemIDs = { ['109129']='OVERRIDE_MILLABLE', ['109128']='OVERRIDE_MILLABLE', ['109127']='OVERRIDE_MILLABLE', ['109126']='OVERRIDE_MILLABLE', ['109125']='OVERRIDE_MILLABLE', ['109124']='OVERRIDE_MILLABLE', -- ['109119']='OVERRIDE_PROSPECTABLE', } local function IsThisBreakable(link) local _, _, quality = GetItemInfo(link) if(IsEquippableItem(link) and quality and quality > 1 and quality < 5) then return not BreakableFilter["SafeItems"][match(link, 'item:(%d+):')] end end local function IsThisOpenable(link) return BreakableFilter["Pickables"][match(link, 'item:(%d+)')] end local function ScanTooltip(self, itemLink) for index = 1, self:NumLines() do local info = BreakStuff_Cache[_G['GameTooltipTextLeft' .. index]:GetText()] if(info) then return unpack(info) end end local itemID = itemLink:match(":(%w+)") local override = AllowedItemIDs[itemID] if(override and BreakStuff_Cache[override]) then return unpack(BreakStuff_Cache[override]) end end local function CloneTooltip() twipe(BreakStuffHandler.TipLines) for index = 1, GameTooltip:NumLines() do local text = _G['GameTooltipTextLeft' .. index]:GetText() if(text) then BreakStuffHandler.TipLines[#BreakStuffHandler.TipLines+1] = text end end end local function DoIHaveAKey() for key in pairs(SkellyKeys) do if(GetItemCount(key) > 0) then return key end end end local function ApplyButton(itemLink, spell, r, g, b) local slot = GetMouseFocus() local bag = slot:GetParent():GetID() if(GetContainerItemLink(bag, slot:GetID()) == itemLink) then --CloneTooltip() BreakStuffHandler:SetAttribute('spell', spell) BreakStuffHandler:SetAttribute('target-bag', bag) BreakStuffHandler:SetAttribute('target-slot', slot:GetID()) BreakStuffHandler:SetAllPoints(slot) BreakStuffHandler:Show() AutoCastShine_AutoCastStart(BreakStuffHandler, r, g, b) end end function BreakStuffParser(self) local item, link = self:GetItem() if(item and not InCombatLockdown() and (BreakStuffHandler.ReadyToSmash == true)) then local spell, r, g, b = ScanTooltip(self, link) local rr, gg, bb = 1, 1, 1 if(spell) then ApplyButton(link, spell, r, g, b) else spell = "Open" if(DE and IsThisBreakable(link)) then rr, gg, bb = 0.5, 0.5, 1 ApplyButton(link, DE, rr, gg, bb) elseif(PICK and IsThisOpenable(link)) then rr, gg, bb = 0, 1, 1 ApplyButton(link, PICK, rr, gg, bb) elseif(SMITH and IsThisOpenable(link)) then rr, gg, bb = 0, 1, 1 local hasKey = DoIHaveAKey() ApplyButton(link, hasKey, rr, gg, bb) end end BreakStuffHandler.TTextLeft = spell BreakStuffHandler.TTextRight = item end end end --[[ ########################################################## BUILD FOR PACKAGE ########################################################## ]]-- local BreakStuff_OnModifier = function(self, arg) if(not self:IsShown() and not arg and (self.ReadyToSmash == false)) then return; end if(InCombatLockdown()) then self:SetAlpha(0) self:RegisterEvent('PLAYER_REGEN_ENABLED') else self:ClearAllPoints() self:SetAlpha(1) self:Hide() AutoCastShine_AutoCastStop(self) end end BreakStuffHandler.MODIFIER_STATE_CHANGED = BreakStuff_OnModifier; local BreakStuff_OnHide = function() BreakStuffHandler.ReadyToSmash = false BreakStuffButton.ttText = "BreakStuff : OFF"; end local BreakStuff_OnEnter = function(self) GameTooltip:SetOwner(self,"ANCHOR_TOP",0,4) GameTooltip:ClearLines() GameTooltip:AddLine(self.ttText) GameTooltip:AddLine(self.subText) if self.ttText2 then GameTooltip:AddLine(' ') GameTooltip:AddDoubleLine(self.ttText2,self.ttText2desc,1,1,1) end if BreakStuffHandler.ReadyToSmash ~= true then self:SetPanelColor("class") self.icon:SetGradient(unpack(SV.media.gradient.highlight)) end GameTooltip:Show() end local BreakStuff_OnLeave = function(self) if BreakStuffHandler.ReadyToSmash ~= true then self:SetPanelColor("default") self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) GameTooltip:Hide() end end local BreakStuff_OnClick = function(self) if InCombatLockdown() then print(ERR_NOT_IN_COMBAT) return end if BreakStuffHandler.ReadyToSmash == true then BreakStuffHandler:MODIFIER_STATE_CHANGED() BreakStuffHandler.ReadyToSmash = false self.ttText = "BreakStuff : OFF"; self:SetPanelColor("default") self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) else BreakStuffHandler.ReadyToSmash = true self.ttText = "BreakStuff : ON"; self:SetPanelColor("green") self.icon:SetGradient(unpack(SV.media.gradient.green)) if(SV.Inventory and SV.Inventory.BagFrame) then if(not SV.Inventory.BagFrame:IsShown()) then GameTooltip:Hide() SV.Inventory.BagFrame:Show() SV.Inventory.BagFrame:RefreshBags() if(SV.Tooltip) then SV.Tooltip.GameTooltip_SetDefaultAnchor(GameTooltip,self) end end end end GameTooltip:ClearLines() GameTooltip:AddLine(self.ttText) GameTooltip:AddLine(self.subText) end function BreakStuffHandler:PLAYER_REGEN_ENABLED() self:UnregisterEvent('PLAYER_REGEN_ENABLED') BreakStuff_OnModifier(self) end function MOD:PLAYER_REGEN_ENABLED() self:UnregisterEvent('PLAYER_REGEN_ENABLED') self:LoadBreakStuff() end local SetClonedTip = function(self) GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) GameTooltip:ClearLines() GameTooltip:AddDoubleLine(self.TTextLeft, self.TTextRight, 0,1,0,1,1,1) -- for index = 1, #self.TipLines do -- GameTooltip:AddLine(self.TipLines[index]) -- end GameTooltip:Show() end local function LoadToolBreakStuff() if(InCombatLockdown()) then MOD:RegisterEvent("PLAYER_REGEN_ENABLED"); return end local allowed, spellListing, spellName, _ = false, {}; if(IsSpellKnown(51005)) then --print("Milling") allowed = true spellName,_ = GetSpellInfo(51005) BreakStuff_Cache[ITEM_MILLABLE] = {spellName, 0.5, 1, 0.5} BreakStuff_Cache['OVERRIDE_MILLABLE'] = {spellName, 0.5, 1, 0.5} tinsert(spellListing, spellName) end if(IsSpellKnown(31252)) then --print("Prospecting") allowed = true spellName,_ = GetSpellInfo(31252) BreakStuff_Cache[ITEM_PROSPECTABLE] = {spellName, 1, 0.33, 0.33} -- BreakStuff_Cache['OVERRIDE_PROSPECTABLE'] = {spellName, 1, 0.33, 0.33} tinsert(spellListing, spellName) end if(IsSpellKnown(13262)) then --print("Enchanting") allowed = true DE,_ = GetSpellInfo(13262) tinsert(spellListing, DE) end if(IsSpellKnown(1804)) then --print("Lockpicking") allowed = true PICK,_ = GetSpellInfo(1804) tinsert(spellListing, PICK) end if(IsSpellKnown(2018)) then --print("Blacksmithing") allowed = true SMITH,_ = GetSpellBookItemInfo((GetSpellInfo(2018))) tinsert(spellListing, SMITH) end MOD.BreakStuffLoaded = true; if not allowed then return end BreakStuffButton:SetParent(MOD.BottomRight.Bar.ToolBar) local size = MOD.BottomRight.Bar.ToolBar:GetHeight() BreakStuffButton:SetSize(size, size) BreakStuffButton:SetPoint("RIGHT", MOD.BottomRight.Bar.ToolBar, "LEFT", -6, 0) BreakStuffButton.icon:SetTexture(SV.media.dock.breakStuffIcon) BreakStuffButton:Show(); BreakStuffButton:SetStyle("DockButton") BreakStuffButton:SetScript("OnEnter", BreakStuff_OnEnter); BreakStuffButton:SetScript("OnLeave", BreakStuff_OnLeave); BreakStuffButton:SetScript("OnClick", BreakStuff_OnClick); BreakStuffButton:SetScript("OnHide", BreakStuff_OnHide) BreakStuffButton.subText = tcat(spellListing,"\n"); BreakStuffHandler:RegisterForClicks('AnyUp') BreakStuffHandler:SetFrameStrata("TOOLTIP") BreakStuffHandler:SetAttribute("type1","spell") BreakStuffHandler:SetScript("OnEnter", SetClonedTip) BreakStuffHandler:SetScript("OnLeave", BreakStuff_OnModifier) BreakStuffHandler:RegisterEvent("MODIFIER_STATE_CHANGED") BreakStuffHandler:Hide() GameTooltip:HookScript('OnTooltipSetItem', BreakStuffParser) for _, sparks in pairs(BreakStuffHandler.sparkles) do sparks:SetHeight(sparks:GetHeight() * 3) sparks:SetWidth(sparks:GetWidth() * 3) end end function MOD:CloseBreakStuff() if((not SV.db.Dock.dockTools.breakstuff) or self.BreakStuffLoaded) then return end BreakStuffHandler:MODIFIER_STATE_CHANGED() BreakStuffHandler.ReadyToSmash = false BreakStuffButton.ttText = "BreakStuff : OFF"; BreakStuffButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) end function MOD:LoadBreakStuff() if((not SV.db.Dock.dockTools.breakstuff) or self.BreakStuffLoaded) then return end SV.Timers:ExecuteTimer(LoadToolBreakStuff, 5) end
--[[--------------------------------------------------------- Panel: windowsWeaponsItem -----------------------------------------------------------]] local PANEL = {} --[[--------------------------------------------------------- Function: canPurchase -----------------------------------------------------------]] function PANEL:canPurchase(ship) local ply = LocalPlayer() if GAMEMODE.Config.restrictbuypistol and not table.HasValue(ship.allowed, ply:Team()) then return false, true end if ship.customCheck and not ship.customCheck(ply) then return false, true end local canbuy, suppress, message, price = hook.Call("canBuyPistol", nil, ply, ship) local cost = price or ship.getPrice and ship.getPrice(ply, ship.pricesep) or ship.pricesep if not ply:canAfford(cost) then return false, false, cost end if canbuy == false then return false, suppress, cost end return true, nil, cost end --[[--------------------------------------------------------- Function: UpdateData -----------------------------------------------------------]] function PANEL:UpdateData(item, parentPanel) --> Self self.localItem = item --> Can local canGet, important = self:canPurchase(item) if important then self:Remove() elseif !canGet then self.purchase:SetScheme("Steel") end --> Model self.image:SetModel(item.model) --> Title self.title:SetText(item.name) self.title:SetFont("segoe_semibold_28") --> Description self.description:SetText("-") self.description:SetFont("segoe_22") self.description:SetContentAlignment(4) --> Salary self.price:SetText(DarkRP.formatMoney(item.pricesep)) --> Become self.purchase.DoClick = function() RunConsoleCommand("darkrp", "buy", item.name) parentPanel:SetVisible(false) parentPanel:Hide() end end --[[--------------------------------------------------------- Define: windowsWeaponsItem -----------------------------------------------------------]] derma.DefineControl("windowsWeaponsItem", "windowsWeaponsItem", PANEL, "windowsGenericItem") --[[--------------------------------------------------------- Panel: windowsWeapons -----------------------------------------------------------]] local PANEL = {} --[[--------------------------------------------------------- Function: ReloadData -----------------------------------------------------------]] function PANEL:ReloadData() --> Clear self.list:Clear() --> Close local parentPanel = self:GetParent():GetParent() --> Weapons local count = 0 local items = {} for _, weapon in pairs(fn.Filter(fn.Curry(fn.GetValue, 2)("separate"), CustomShipments)) do --> Item local item = vgui.Create("windowsWeaponsItem", self.list) item:Dock(TOP) item:UpdateData(weapon, parentPanel) --> Count if IsValid(item) then count = count+1 table.Add(items, {item}) end end --> Count if count == 0 then function self.list.Paint(pnl, w, h) draw.SimpleText("Nothing was found!", "segoe_semibold_38", w/2, h/2, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end else function self.list.Paint(pnl, w, h) end end if count <= 6 then for _, v in pairs(items) do v:DockMargin(0, 0, 0, 10) end end end --[[--------------------------------------------------------- Define: windowsWeapons -----------------------------------------------------------]] derma.DefineControl("windowsWeapons", "windowsWeapons", PANEL, "windowsGeneric")
local b = true local introBG = nil local introText = nil local introBGXform = nil local introBGMesh = nil local introTextXform = nil local introTextMesh = nil local introLayer = nil local BGFadedOut = false local TextFadeIn = true TextFadeInTimer = 10.0 TextFadeOutTimer = 4.0 BGFadeOutTimer = 14.0 BGTextureName = "transparency" TextTextureName = "WhereTheChineseGather" FadeOutSpeed = 1.0 function ChangeBackground() introBGMesh:SetDiffuseTexture(BGTextureName) end function ChangeIntro() introTextMesh:SetDiffuseTexture(TextTextureName) end function OnUpdate(dt) if(b) then introLayer = GetLayer("IntroLayer") if(introLayer == nil) then introLayer = CreateLayer("IntroLayer") end cam = introLayer:GetObject("MainCamera") camComp = cam:GetComponent("Camera") lookat = Vector3(0,0,-1) camComp:SetLookAt(lookat) camComp:SetUICam(true) introBG = introLayer:Create("BackGround") introText = introLayer:Create("StageName") introBGXform = introBG:AddComponent("Transform") introTextXform = introText:AddComponent("Transform") introTextMesh = introText:AddComponent("MeshRenderer") introBGMesh = introBG:AddComponent("MeshRenderer") rotation = Vector3(90, 0, 0) position = Vector3(0,0,-1) scale = Vector3(1.5, 1.00, 0.85) introTextXform:SetWorldRotation(rotation) introBGXform:SetWorldRotation(rotation) introTextXform:SetWorldPosition(position) position = Vector3(0,0,-1.0001) introBGXform:SetWorldPosition(position) introBGXform:SetWorldScale(scale) introTextXform:SetWorldScale(scale) introTextMesh:SetMesh("planeMesh") introBGMesh:SetMesh("planeMesh") introTextMesh:SetDiffuseTexture(TextTextureName) introBGMesh:SetDiffuseTexture(BGTextureName) color = introTextMesh:GetColor() color.a = 0 introTextMesh:SetColor(color) b = false write("IntroScreen.lua : Creation Complete") end if(BGFadeOutTimer > 0.0) then BGFadeOutTimer = BGFadeOutTimer - dt else color = introBGMesh:GetColor() if(color:a() > 0.0) then color.a = color:a() - (dt * FadeOutSpeed) introBGMesh:SetColor(color) else BGFadedOut = true end end if(BGFadedOut) then if(TextFadeOutTimer > 0.0) then TextFadeOutTimer = TextFadeOutTimer - dt else color = introTextMesh:GetColor() if(color:a() > 0.0) then color.a = color:a() - (dt * FadeOutSpeed) introTextMesh:SetColor(color) end end end if(TextFadeIn) then if(TextFadeInTimer > 0.0) then TextFadeInTimer = TextFadeInTimer - dt color = introTextMesh:GetColor() else color = introTextMesh:GetColor() if(color:a() < 1.0) then color.a = color:a() + (dt * FadeOutSpeed) introTextMesh:SetColor(color) else color.a = 1.0 introTextMesh:SetColor(color) TextFadeIn = false end end end end
return { invoker_quas = { ID = 5370, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IMMEDIATE", SpellDispellableType = "SPELL_DISPELLABLE_NO", MaxLevel = 7, AbilityCooldown = 0, AbilityManaCost = 0, AbilityCastAnimation = "ACT_INVALID", AbilitySpecial = { ["01"] = {var_type = "FIELD_FLOAT", health_regen_per_instance = "1 3 5 7 9 11 13"}, }, }, invoker_wex = { ID = 5371, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IMMEDIATE", SpellDispellableType = "SPELL_DISPELLABLE_NO", MaxLevel = 7, AbilityCooldown = 0, AbilityManaCost = 0, AbilityCastAnimation = "ACT_INVALID", AbilitySpecial = { ["01"] = {var_type = "FIELD_INTEGER", attack_speed_per_instance = "2 4 6 8 10 12 14"}, ["02"] = {var_type = "FIELD_INTEGER", move_speed_per_instance = "1 2 3 4 5 6 7"}, }, }, invoker_exort = { ID = 5372, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IMMEDIATE", SpellDispellableType = "SPELL_DISPELLABLE_NO", MaxLevel = 7, AbilityCooldown = 0, AbilityManaCost = 0, AbilityCastAnimation = "ACT_INVALID", AbilitySpecial = { ["01"] = {var_type = "FIELD_INTEGER", bonus_damage_per_instance = "2 6 10 14 18 22 26"}, }, }, invoker_empty1 = { ID = 5373, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE", MaxLevel = 0, AbilityCastAnimation = "ACT_INVALID", }, invoker_empty2 = { ID = 5374, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE", MaxLevel = 0, AbilityCastAnimation = "ACT_INVALID", }, invoker_invoke = { ID = 5375, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", AbilityType = "DOTA_ABILITY_TYPE_ULTIMATE", MaxLevel = 1, RequiredLevel = 1, AbilitySound = "Hero_Invoker.Invoke", HasScepterUpgrade = 1, AbilityCooldown = 6, AbilityManaCost = 0, AbilityCastAnimation = "ACT_INVALID", AbilitySpecial = { ["01"] = {var_type = "FIELD_INTEGER", max_invoked_spells = 2}, ["02"] = {var_type = "FIELD_FLOAT", cooldown_scepter = 2, RequiresScepter = 1}, ["03"] = {var_type = "FIELD_INTEGER", mana_cost_scepter = 0}, }, }, invoker_cold_snap = { ID = 5376, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_UNIT_TARGET | DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE | DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", SpellImmunityType = "SPELL_IMMUNITY_ENEMIES_NO", SpellDispellableType = "SPELL_DISPELLABLE_YES", MaxLevel = 1, HotKeyOverride = "Y", FightRecapLevel = 1, AbilitySound = "Hero_Invoker.ColdSnap", AbilityUnitTargetTeam = "DOTA_UNIT_TARGET_TEAM_ENEMY", AbilityUnitTargetType = "DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_BASIC", AbilityUnitDamageType = "DAMAGE_TYPE_MAGICAL", AbilityCastRange = 1000, AbilityCastPoint = 0.05, AbilityCastAnimation = "ACT_INVALID", AbilityCooldown = 20, AbilityManaCost = 100, AbilityModifierSupportValue = 0.15, AbilitySpecial = { ["01"] = { var_type = "FIELD_FLOAT", duration = "3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5", levelkey = "quaslevel", LinkedSpecialBonus = "special_bonus_unique_invoker_7", }, ["02"] = {var_type = "FIELD_FLOAT", freeze_duration = 0.4}, ["03"] = { var_type = "FIELD_FLOAT", freeze_cooldown = "0.77 0.74 0.71 0.69 0.66 0.63 0.60 0.57", levelkey = "quaslevel", }, ["04"] = { var_type = "FIELD_FLOAT", freeze_damage = "8 16 24 32 40 48 56 64", levelkey = "quaslevel", }, ["05"] = {var_type = "FIELD_FLOAT", damage_trigger = 10.0}, }, }, invoker_ghost_walk = { ID = 5381, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE | DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", SpellImmunityType = "SPELL_IMMUNITY_ENEMIES_NO", SpellDispellableType = "SPELL_DISPELLABLE_NO", MaxLevel = 1, HotKeyOverride = "V", AbilitySound = "Hero_Invoker.GhostWalk", AbilityCooldown = 45, AbilityManaCost = 200, AbilityCastPoint = 0.05, AbilityCastAnimation = "ACT_INVALID", AbilitySpecial = { ["01"] = {var_type = "FIELD_FLOAT", duration = 100.0}, ["02"] = {var_type = "FIELD_INTEGER", area_of_effect = 400}, ["03"] = { var_type = "FIELD_INTEGER", enemy_slow = "-20 -25 -30 -35 -40 -45 -50 -55", levelkey = "quaslevel", }, ["04"] = { var_type = "FIELD_INTEGER", self_slow = "-30 -20 -10 0 10 20 30 40", levelkey = "wexlevel", }, ["05"] = {var_type = "FIELD_FLOAT", aura_fade_time = 2.0}, }, }, invoker_tornado = { ID = 5382, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_POINT | DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE | DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", SpellImmunityType = "SPELL_IMMUNITY_ENEMIES_NO", SpellDispellableType = "SPELL_DISPELLABLE_YES", MaxLevel = 1, HotKeyOverride = "X", AbilityUnitDamageType = "DAMAGE_TYPE_MAGICAL", AbilitySound = "Hero_Invoker.Tornado", AbilityCastRange = 2000, AbilityCastPoint = 0.05, AbilityCastAnimation = "ACT_INVALID", AbilityCooldown = 30, AbilityManaCost = 150, AbilitySpecial = { ["01"] = { var_type = "FIELD_INTEGER", travel_distance = "800 1200 1600 2000 2400 2800 3200 3600", levelkey = "wexlevel", }, ["02"] = {var_type = "FIELD_INTEGER", travel_speed = 1000}, ["03"] = {var_type = "FIELD_INTEGER", area_of_effect = 200}, ["04"] = {var_type = "FIELD_INTEGER", vision_distance = 200}, ["05"] = {var_type = "FIELD_FLOAT", end_vision_duration = 1.75}, ["06"] = { var_type = "FIELD_FLOAT", lift_duration = "0.8 1.1 1.4 1.7 2.0 2.3 2.6 2.9", LinkedSpecialBonus = "special_bonus_unique_invoker_8", levelkey = "quaslevel", }, ["07"] = {var_type = "FIELD_FLOAT", base_damage = 70}, ["08"] = {var_type = "FIELD_FLOAT", quas_damage = "0 0 0 0 0 0 0", levelkey = "quaslevel"}, ["09"] = { var_type = "FIELD_FLOAT", wex_damage = "45 90 135 180 225 270 315 360", levelkey = "wexlevel", }, }, }, invoker_emp = { ID = 5383, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_POINT | DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE | DOTA_ABILITY_BEHAVIOR_AOE | DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", SpellImmunityType = "SPELL_IMMUNITY_ENEMIES_NO", MaxLevel = 1, HotKeyOverride = "C", AbilityUnitDamageType = "DAMAGE_TYPE_MAGICAL", AbilitySound = "Hero_Invoker.EMP.Charge", AbilityCastRange = 950, AbilityCastPoint = 0.05, AbilityCastAnimation = "ACT_INVALID", AbilityCooldown = 30, AbilityManaCost = 125, AbilitySpecial = { ["01"] = {var_type = "FIELD_FLOAT", delay = 2.9, levelkey = "wexlevel"}, ["02"] = {var_type = "FIELD_INTEGER", area_of_effect = 675}, ["03"] = { var_type = "FIELD_INTEGER", mana_burned = "100 175 250 325 400 475 550 625", levelkey = "wexlevel", }, ["04"] = {var_type = "FIELD_INTEGER", damage_per_mana_pct = 60}, }, }, invoker_alacrity = { ID = 5384, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_UNIT_TARGET | DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE | DOTA_ABILITY_BEHAVIOR_DONT_RESUME_ATTACK | DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", MaxLevel = 1, HotKeyOverride = "Z", AbilitySound = "Hero_Invoker.Alacrity", AbilityUnitTargetTeam = "DOTA_UNIT_TARGET_TEAM_FRIENDLY", AbilityUnitTargetType = "DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_CREEP", SpellImmunityType = "SPELL_IMMUNITY_ALLIES_YES", SpellDispellableType = "SPELL_DISPELLABLE_YES", AbilityCastRange = 650, AbilityCastPoint = 0.05, AbilityCastAnimation = "ACT_INVALID", AbilityCooldown = 17, AbilityManaCost = 60, AbilitySpecial = { ["01"] = { var_type = "FIELD_INTEGER", bonus_attack_speed = "10 25 40 55 70 85 100 115", levelkey = "wexlevel", LinkedSpecialBonus = "special_bonus_unique_invoker_5", }, ["02"] = { var_type = "FIELD_INTEGER", bonus_damage = "10 25 40 55 70 85 100 115", levelkey = "exortlevel", LinkedSpecialBonus = "special_bonus_unique_invoker_5", }, ["03"] = {var_type = "FIELD_FLOAT", duration = 9}, }, }, invoker_chaos_meteor = { ID = 5385, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_POINT | DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE | DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", MaxLevel = 1, HotKeyOverride = "D", AbilityUnitDamageType = "DAMAGE_TYPE_MAGICAL", SpellImmunityType = "SPELL_IMMUNITY_ENEMIES_NO", SpellDispellableType = "SPELL_DISPELLABLE_YES", FightRecapLevel = 1, AbilitySound = "Hero_Invoker.ChaosMeteor.Impact", AbilityCastRange = 700, AbilityCastPoint = 0.05, AbilityCastAnimation = "ACT_INVALID", AbilityCooldown = 55, AbilityManaCost = 200, AbilityModifierSupportValue = 0.0, AbilitySpecial = { ["01"] = {var_type = "FIELD_FLOAT", land_time = 1.3}, ["02"] = {var_type = "FIELD_INTEGER", area_of_effect = 275}, ["03"] = { var_type = "FIELD_INTEGER", travel_distance = "465 615 780 930 1095 1245 1410 1575", levelkey = "wexlevel", }, ["04"] = {var_type = "FIELD_INTEGER", travel_speed = 300}, ["05"] = {var_type = "FIELD_FLOAT", damage_interval = 0.5, CalculateSpellDamageTooltip = 0}, ["06"] = {var_type = "FIELD_INTEGER", vision_distance = 500}, ["07"] = {var_type = "FIELD_FLOAT", end_vision_duration = 3.0}, ["08"] = { var_type = "FIELD_FLOAT", main_damage = "57.5 75 92.5 110 127.5 145 162.5 180", LinkedSpecialBonus = "special_bonus_unique_invoker_6", levelkey = "exortlevel", }, ["09"] = {var_type = "FIELD_FLOAT", burn_duration = 3.0}, ["10"] = { var_type = "FIELD_FLOAT", burn_dps = "11.5 15 18.5 22 25.5 29 32.5 36", levelkey = "exortlevel", CalculateSpellDamageTooltip = 1, }, }, }, invoker_sun_strike = { ID = 5386, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_POINT | DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE | DOTA_ABILITY_BEHAVIOR_AOE | DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", MaxLevel = 1, HotKeyOverride = "T", AbilityUnitDamageType = "DAMAGE_TYPE_PURE", SpellImmunityType = "SPELL_IMMUNITY_ENEMIES_YES", FightRecapLevel = 1, AbilitySound = "Hero_Invoker.SunStrike.Charge", AbilityCastRange = 0, AbilityCastPoint = 0.05, AbilityCastAnimation = "ACT_INVALID", AbilityCooldown = 25, AbilityManaCost = 175, AbilitySpecial = { ["01"] = {var_type = "FIELD_FLOAT", delay = 1.7}, ["02"] = {var_type = "FIELD_INTEGER", area_of_effect = 175}, ["03"] = { var_type = "FIELD_FLOAT", damage = "100 162.5 225 287.5 350 412.5 475 537.5", levelkey = "exortlevel", }, ["04"] = {var_type = "FIELD_INTEGER", vision_distance = 400}, ["05"] = {var_type = "FIELD_FLOAT", vision_duration = 4.0}, }, }, invoker_forge_spirit = { ID = 5387, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE | DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", SpellImmunityType = "SPELL_IMMUNITY_ENEMIES_NO", MaxLevel = 1, HotKeyOverride = "F", AbilitySound = "Hero_Invoker.ForgeSpirit", AbilityCooldown = 30, AbilityManaCost = 75, AbilityCastPoint = 0.05, AbilityCastAnimation = "ACT_INVALID", AbilitySpecial = { ["01"] = { var_type = "FIELD_FLOAT", spirit_damage = "22 32 42 52 62 72 82 92", levelkey = "exortlevel", }, ["02"] = { var_type = "FIELD_INTEGER", spirit_mana = "100 150 200 250 300 350 400 450", levelkey = "exortlevel", }, ["03"] = { var_type = "FIELD_INTEGER", spirit_armor = "0 1 2 3 4 5 6 7", levelkey = "exortlevel", }, ["04"] = { var_type = "FIELD_FLOAT", spirit_attack_range = "300 365 430 495 560 625 690 755", levelkey = "quaslevel", }, ["05"] = { var_type = "FIELD_INTEGER", spirit_hp = "300 400 500 600 700 800 900 1000", levelkey = "quaslevel", }, ["06"] = { var_type = "FIELD_FLOAT", spirit_duration = "20 30 40 50 60 70 80 90", levelkey = "quaslevel", }, }, }, invoker_ice_wall = { ID = 5389, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE | DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", SpellImmunityType = "SPELL_IMMUNITY_ENEMIES_NO", SpellDispellableType = "SPELL_DISPELLABLE_NO", MaxLevel = 1, HotKeyOverride = "G", AbilityUnitDamageType = "DAMAGE_TYPE_MAGICAL", FightRecapLevel = 1, AbilitySound = "Hero_Invoker.IceWall.Cast", AbilityCooldown = 25, AbilityManaCost = 175, AbilityCastPoint = 0.05, AbilityCastAnimation = "ACT_INVALID", AbilitySpecial = { ["01"] = { var_type = "FIELD_FLOAT", duration = "3.0 4.5 6.0 7.5 9.0 10.5 12.0 13.5", levelkey = "quaslevel", }, ["02"] = { var_type = "FIELD_INTEGER", slow = "-20 -40 -60 -80 -100 -120 -140 -160", levelkey = "quaslevel", }, ["03"] = {var_type = "FIELD_FLOAT", slow_duration = 2.0}, ["04"] = { var_type = "FIELD_FLOAT", damage_per_second = "6 12 18 24 30 36 42 48", levelkey = "exortlevel", }, ["05"] = {var_type = "FIELD_INTEGER", wall_place_distance = 200}, ["06"] = {var_type = "FIELD_INTEGER", num_wall_elements = 15}, ["07"] = {var_type = "FIELD_INTEGER", wall_element_spacing = 80}, ["08"] = {var_type = "FIELD_INTEGER", wall_element_radius = 105}, }, }, invoker_deafening_blast = { ID = 5390, AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_POINT | DOTA_ABILITY_BEHAVIOR_HIDDEN | DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE | DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING | DOTA_ABILITY_BEHAVIOR_SHOW_IN_GUIDES", SpellImmunityType = "SPELL_IMMUNITY_ENEMIES_NO", SpellDispellableType = "SPELL_DISPELLABLE_NO", MaxLevel = 1, HotKeyOverride = "B", AbilityUnitDamageType = "DAMAGE_TYPE_MAGICAL", FightRecapLevel = 1, AbilitySound = "Hero_Invoker.DeafeningBlast", AbilityCastRange = 1000, AbilityCastPoint = 0.05, AbilityCastAnimation = "ACT_INVALID", AbilityCooldown = 40, AbilityManaCost = 300, AbilityModifierSupportValue = 0.5, AbilitySpecial = { ["01"] = {var_type = "FIELD_INTEGER", travel_distance = 1000}, ["02"] = {var_type = "FIELD_INTEGER", travel_speed = 1100}, ["03"] = {var_type = "FIELD_INTEGER", radius_start = 175}, ["04"] = {var_type = "FIELD_INTEGER", radius_end = 225}, ["05"] = {var_type = "FIELD_FLOAT", end_vision_duration = 1.75}, ["06"] = { var_type = "FIELD_FLOAT", damage = "40 80 120 160 200 240 280 320", levelkey = "exortlevel", }, ["07"] = { var_type = "FIELD_FLOAT", knockback_duration = "0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0", levelkey = "quaslevel", }, ["08"] = { var_type = "FIELD_FLOAT", disarm_duration = "1.25 2.0 2.75 3.5 4.25 5.0 5.75 6.5", levelkey = "wexlevel", }, }, }, special_bonus_unique_invoker_1 = { ID = 6097, AbilityType = "DOTA_ABILITY_TYPE_ATTRIBUTES", AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE", AbilitySpecial = {["01"] = {var_type = "FIELD_INTEGER", value = 2}}, }, special_bonus_unique_invoker_2 = { ID = 6098, AbilityType = "DOTA_ABILITY_TYPE_ATTRIBUTES", AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE", AbilitySpecial = {["01"] = {var_type = "FIELD_INTEGER", value = 0}}, }, special_bonus_unique_invoker_3 = { ID = 6099, AbilityType = "DOTA_ABILITY_TYPE_ATTRIBUTES", AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE", AbilitySpecial = {["01"] = {var_type = "FIELD_INTEGER", value = 16}}, }, special_bonus_unique_invoker_4 = { ID = 6656, AbilityType = "DOTA_ABILITY_TYPE_ATTRIBUTES", AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE", AbilitySpecial = { ["01"] = {var_type = "FIELD_INTEGER", value = 2}, ["02"] = {var_type = "FIELD_INTEGER", cooldown = 90}, ["03"] = {var_type = "FIELD_INTEGER", min_range = 160}, ["04"] = {var_type = "FIELD_INTEGER", max_range = 200}, }, }, special_bonus_unique_invoker_5 = { ID = 6657, AbilityType = "DOTA_ABILITY_TYPE_ATTRIBUTES", AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE", AbilitySpecial = {["01"] = {var_type = "FIELD_INTEGER", value = 50}}, }, special_bonus_unique_invoker_6 = { ID = 6811, AbilityType = "DOTA_ABILITY_TYPE_ATTRIBUTES", AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE", AbilitySpecial = {["01"] = {var_type = "FIELD_INTEGER", value = 40}}, }, special_bonus_unique_invoker_7 = { ID = 7016, AbilityType = "DOTA_ABILITY_TYPE_ATTRIBUTES", AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE", AbilitySpecial = {["01"] = {var_type = "FIELD_FLOAT", value = 2.5}}, }, special_bonus_unique_invoker_8 = { ID = 7017, AbilityType = "DOTA_ABILITY_TYPE_ATTRIBUTES", AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE", AbilitySpecial = {["01"] = {var_type = "FIELD_FLOAT", value = 1.25}}, }, special_bonus_unique_invoker_9 = { ID = 7148, AbilityType = "DOTA_ABILITY_TYPE_ATTRIBUTES", AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE", AbilitySpecial = {["01"] = {var_type = "FIELD_INTEGER", value = 15}}, }, special_bonus_unique_invoker_10 = { ID = 7390, AbilityType = "DOTA_ABILITY_TYPE_ATTRIBUTES", AbilityBehavior = "DOTA_ABILITY_BEHAVIOR_PASSIVE", AbilitySpecial = {["01"] = {var_type = "FIELD_INTEGER", value = 30}}, }, }
local function mode() local mode_map = { ['__'] = '------', ['n'] = 'NORMAL', ['i'] = 'INSERT', ['v'] = 'VISUAL', ['V'] = 'V-LINE', [''] = 'V-BLOCK', ['R'] = 'REPLACE', ['r'] = 'REPLACE', ['Rv'] = 'V-REPLACE', ['c'] = 'COMMAND', ['t'] = 'TERMINAL', ['s'] = 'SELECT', } local function get_mode() local mode_code = vim.api.nvim_get_mode().mode if mode_map[mode_code] == nil then return mode_code end return mode_map[mode_code] end return get_mode() end return mode
PageUtil = class("PageUtil") PageUtil.Ctor = function (slot0, slot1, slot2, slot3, slot4) pg.DelegateInfo.New(slot0) slot0._leftBtn = slot1 slot0._rightBtn = slot2 slot0._maxBtn = slot3 slot0._numTxt = slot4 onButton(slot0, slot0._leftBtn, function () if slot0._curNum - slot0._addNum <= 0 then slot0._curNum or slot0:setCurNum(slot0._curNum or slot0) return end end) onButton(slot0, slot0._rightBtn, function () if slot0._maxNum < 0 then slot0:setCurNum(slot0) elseif slot0._maxNum < slot0 then slot0._maxNum or slot0:setCurNum(slot0._maxNum or slot0) end end) onButton(slot0, slot0._maxBtn, function () if slot0._maxNum < 0 then else slot0:setCurNum(slot0._maxNum) end end) slot0.setAddNum(slot0, 1) slot0:setDefaultNum(1) slot0:setMaxNum(-1) end PageUtil.setAddNum = function (slot0, slot1) slot0._addNum = slot1 end PageUtil.setDefaultNum = function (slot0, slot1) slot0._defaultNum = slot1 slot0:setCurNum(slot0._defaultNum) end PageUtil.setMaxNum = function (slot0, slot1) slot0._maxNum = slot1 setActive(slot0._maxBtn, slot0._maxNum > 0) end PageUtil.setCurNum = function (slot0, slot1) slot0._curNum = slot1 setText(slot0._numTxt, slot0._curNum) if slot0._numUpdate ~= nil then slot0._numUpdate(slot0._curNum) end end PageUtil.setNumUpdate = function (slot0, slot1) slot0._numUpdate = slot1 end PageUtil.getCurNum = function (slot0) return slot0._curNum end return PageUtil
do local function run(msg, matches) if not is_sudo(msg) then return end local chat = msg.to.id local hash = 'ar:enable'..chat if matches[1] == 'ar' then redis:set(hash, true) return 'تم اختيار اللغة العربية في المجموعة' end if matches[1] == 'en' then redis:del(hash) return 'Group lang has been changed to english' end end return { patterns = { '^set lang (ar)$', '^set lang (en)$' }, run = run, } end
--!A cross-platform build utility based on Lua -- -- Licensed to the Apache Software Foundation (ASF) under one -- or more contributor license agreements. See the NOTICE file -- distributed with this work for additional information -- regarding copyright ownership. The ASF licenses this file -- to you 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 - 2018, TBOOX Open Source Group. -- -- @author ruki -- @file trybuild.lua -- -- imports import("core.base.option") import("core.platform.environment") import("lib.detect.find_file") -- try building for makefile function _build_for_makefile(buildfile) os.vrun("make -j4") end -- try building for configure function _build_for_configure(buildfile) if not os.isfile("configure") and os.isfile("configure.ac") then os.vrun("autoreconf --install --symlink") end os.vrun("./configure --prefix=%s", path.absolute("install")) os.vrun("make -j4") os.vrun("make install") end -- try building for cmakelist function _build_for_cmakelists(buildfile) os.mkdir("build") os.cd("build") os.vrun("cmake -a %s -DCMAKE_INSTALL_PREFIX=\"%s\" ..", os.arch(), path.absolute("install")) if is_host("windows") then local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!") os.vrun("msbuild \"%s\" -nologo -t:Rebuild -p:Configuration=Release -p:Platform=%s", slnfile, os.arch() == "x64" and "x64" or "Win32") local projfile = os.isfile("INSTALL.vcxproj") and "INSTALL.vcxproj" or "INSTALL.vcproj" os.vrun("msbuild \"%s\" /property:configuration=Release", projfile) else os.vrun("make -j4") os.vrun("make install") end end -- build for *.sln function _build_for_sln(buildfile) os.vrun("msbuild \"%s\" -nologo -t:Rebuild -p:Configuration=Release -p:Platform=%s", buildfile, os.arch() == "x64" and "x64" or "Win32") end -- build for *.xcworkspace or *.xcodeproj function _build_for_xcode(buildfile) os.vrun("xcodebuild clean build CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO") end -- the main entry function main(targetname) -- trace cprint("${yellow}xmake.lua not found, try building ..") -- enter toolchains environment environment.enter("toolchains") -- TODO *.vcproj, premake.lua, scons, autogen.sh, Makefile.am, ... -- init build scripts local buildscripts = {} if is_host("windows") then table.insert(buildscripts, {"*.sln", _build_for_sln}) elseif is_host("macosx") then table.insert(buildscripts, {"*.xcworkspace", _build_for_xcode}) table.insert(buildscripts, {"*.xcodeproj", _build_for_xcode}) end table.insert(buildscripts, {"CMakeLists.txt", _build_for_cmakelists}) table.insert(buildscripts, {"configure", _build_for_configure}) table.insert(buildscripts, {"configure.ac", _build_for_configure}) table.insert(buildscripts, {"[mM]akefile", _build_for_makefile}) -- attempt to build it local ok = false for _, buildscript in pairs(buildscripts) do -- save the current directory local oldir = os.curdir() -- try building ok = try { function () -- attempt to build it if file exists local files = os.filedirs(buildscript[1]) if #files > 0 then -- trace print("%s found", path.filename(files[1])) -- build it buildscript[2](files[1]) return true end end, catch { function (errors) -- trace verbose info if errors then vprint(errors) end end } } -- restore directory os.cd(oldir) -- ok? if ok then break end end -- leave toolchains environment environment.leave("toolchains") -- trace if ok then cprint("${bright}build ok!${clear}${ok_hand}") else raise("build failed!") end end
screenboundary = class:new() function screenboundary:init(x) self.x = x self.y = -1000 self.width = 0 self.height = 1020 self.static = true self.active = true self.category = 10 self.mask = {true} end
local inventories = { -- Armor must be before main or the sync will fail when the inventory -- bonus slots from the armor are in use. armor = defines.inventory.character_armor, main = defines.inventory.character_main, guns = defines.inventory.character_guns, ammo = defines.inventory.character_ammo, trash = defines.inventory.character_trash, } return inventories
--[[ AscendScripting Script - This software is provided as free and open source by the staff of The AscendScripting Team.This script was written and is protected by the GPL v2. The following script was released by a AscendScripting Staff Member. Please give credit where credit is due, if modifying, redistributing and/or using this software. Thank you. ~~End of License Agreement -- AscendScripting Staff, March 17, 2009. ]] function SyndicateMagus_OnSpawn(Unit,Event) Unit:CastSpell(12544) end function SyndicateMagus_OnEnterCombat(Unit,Event) Unit:RegisterEvent("Frostbolt", 11000, 0) end function Frostbolt(Unit,Event) local plr = Unit:GetMainTank() Unit:FullCastSpellOnTarget(9672,plr) end function SyndicateMagus_OnLeaveCombat(Unit,Event) Unit:RemoveEvents() end function SyndicateMagus_OnDied(Unit,Event) Unit:RemoveEvents() end RegisterUnitEvent(2591,18,"SyndicateMagus_OnSpawn") RegisterUnitEvent(2591,1,"SyndicateMagus_OnEnterCombat") RegisterUnitEvent(2591,2,"SyndicateMagus_OnLeaveCombat") RegisterUnitEvent(2591,4,"SyndicateMagus_OnDied")
#!/usr/bin/env tarantool -- Fix tests in out of source build local dirs = { "..", ".", os.getenv("BINARY_DIR") } package.path = "" package.cpath = "" for _, dir in pairs(dirs) do package.path = package.path .. dir .. "/?/init.lua;" .. dir .. "/?.lua;" package.cpath = package.cpath .. dir .. "/?.so;" .. dir .. "/?.dylib;" end local tap = require('tap') local http_lib = require('http.lib') local http_client = require('http.client') local http_server = require('http.server') local json = require('json') local yaml = require 'yaml' local urilib = require('uri') local test = tap.test("http") test:plan(8) test:test("split_uri", function(test) test:plan(65) local function check(uri, rhs) local lhs = urilib.parse(uri) local extra = { lhs = lhs, rhs = rhs } if lhs.query == '' then lhs.query = nil end test:is(lhs.scheme, rhs.scheme, uri.." scheme", extra) test:is(lhs.host, rhs.host, uri.." host", extra) test:is(lhs.service, rhs.service, uri.." service", extra) test:is(lhs.path, rhs.path, uri.." path", extra) test:is(lhs.query, rhs.query, uri.." query", extra) end check('http://abc', { scheme = 'http', host = 'abc'}) check('http://abc/', { scheme = 'http', host = 'abc', path ='/'}) check('http://abc?', { scheme = 'http', host = 'abc'}) check('http://abc/?', { scheme = 'http', host = 'abc', path ='/'}) check('http://abc/?', { scheme = 'http', host = 'abc', path ='/'}) check('http://abc:123', { scheme = 'http', host = 'abc', service = '123' }) check('http://abc:123?', { scheme = 'http', host = 'abc', service = '123'}) check('http://abc:123?query', { scheme = 'http', host = 'abc', service = '123', query = 'query'}) check('http://domain.subdomain.com:service?query', { scheme = 'http', host = 'domain.subdomain.com', service = 'service', query = 'query'}) check('google.com', { host = 'google.com'}) check('google.com?query', { host = 'google.com', query = 'query'}) check('google.com/abc?query', { host = 'google.com', path = '/abc', query = 'query'}) check('https://google.com:443/abc?query', { scheme = 'https', host = 'google.com', service = '443', path = '/abc', query = 'query'}) end) test:test("template", function(test) test:plan(5) test:is(http_lib.template("<% for i = 1, cnt do %> <%= abc %> <% end %>", {abc = '1 <3>&" ', cnt = 3}), ' 1 &lt;3&gt;&amp;&quot; 1 &lt;3&gt;&amp;&quot; 1 &lt;3&gt;&amp;&quot; ', "tmpl1") test:is(http_lib.template("<% for i = 1, cnt do %> <%= ab %> <% end %>", {abc = '1 <3>&" ', cnt = 3}), ' nil nil nil ', "tmpl2") local r, msg = pcall(http_lib.template, "<% ab() %>", {ab = '1'}) test:ok(r == false and msg:match("call local 'ab'") ~= nil, "bad template") -- gh-18: rendered tempate is truncated local template = [[ <html> <body> <table border="1"> % for i,v in pairs(t) do <tr> <td><%= i %></td> <td><%= v %></td> </tr> % end </table> </body> </html> ]] local t = {} for i=1,100 do key = i value = string.rep('#', i) t[key] = value end local rendered, code = http_lib.template(template, { t = t }) test:ok(#rendered > 10000, "rendered size") test:is(rendered:sub(#rendered - 7, #rendered - 1), "</html>", "rendered eof") end) test:test('parse_request', function(test) test:plan(6) test:is_deeply(http_lib._parse_request('abc'), { error = 'Broken request line', headers = {} }, 'broken request') test:is( http_lib._parse_request("GET / HTTP/1.1\nHost: s.com\r\n\r\n").path, '/', 'path' ) test:is_deeply( http_lib._parse_request("GET / HTTP/1.1\nHost: s.com\r\n\r\n").proto, {1,1}, 'proto' ) test:is_deeply( http_lib._parse_request("GET / HTTP/1.1\nHost: s.com\r\n\r\n").headers, {host = 's.com'}, 'host' ) test:is_deeply( http_lib._parse_request("GET / HTTP/1.1\nHost: s.com\r\n\r\n").method, 'GET', 'method' ) test:is_deeply( http_lib._parse_request("GET / HTTP/1.1\nHost: s.com\r\n\r\n").query, '', 'query' ) end) test:test("http request", function(test) test:plan(11) local r = http_client.get("http://tarantool.org/") test:is(r.status, 200, 'mail.ru 200') test:is(r.proto[1], 1, 'mail.ru http 1.1') test:is(r.proto[2], 1, 'mail.ru http 1.1') test:ok(r.body:match("<(html)") ~= nil, "mail.ru is html", r) test:ok(tonumber(r.headers["content-length"]) > 0, "mail.ru content-length > 0") test:is(http_client.get("http://localhost:88/").status, 595, 'timeout') local r = http_client.get("http://go.mail.ru/search?fr=main&q=tarantool") test:is(r.status, 200, 'go.mail.ru 200') test:is(r.proto[1], 1, 'go.mail.ru http 1.1') test:is(r.proto[2], 1, 'go.mail.ru http 1.1') test:ok(r.body:match("<(html)") ~= nil, "go.mail.ru is html", r) test:is(http_client.request("GET", "http://tarantool.org/").status, 200, 'alias') end) test:test('params', function(test) test:plan(6) test:is_deeply(http_lib.params(), {}, 'nil string') test:is_deeply(http_lib.params(''), {}, 'empty string') test:is_deeply(http_lib.params('a'), {a = ''}, 'separate literal') test:is_deeply(http_lib.params('a=b'), {a = 'b'}, 'one variable') test:is_deeply(http_lib.params('a=b&b=cde'), {a = 'b', b = 'cde'}, 'some') test:is_deeply(http_lib.params('a=b&b=cde&a=1'), {a = { 'b', '1' }, b = 'cde'}, 'array') end) local function cfgserv() local httpd = http_server.new('127.0.0.1', 12345, { app_dir = 'test', log_requests = false, log_errors = false }) :route({path = '/abc/:cde/:def', name = 'test'}, function() end) :route({path = '/abc'}, function() end) :route({path = '/ctxaction'}, 'module.controller#action') :route({path = '/absentaction'}, 'module.controller#absent') :route({path = '/absent'}, 'module.absent#action') :route({path = '/abc/:cde'}, function() end) :route({path = '/abc_:cde_def'}, function() end) :route({path = '/abc-:cde-def'}, function() end) :route({path = '/aba*def'}, function() end) :route({path = '/abb*def/cde', name = 'star'}, function() end) :route({path = '/banners/:token'}) :helper('helper_title', function(self, a) return 'Hello, ' .. a end) :route({path = '/helper', file = 'helper.html.el'}) :route({ path = '/test', file = 'test.html.el' }, function(cx) return cx:render({ title = 'title: 123' }) end) return httpd end test:test("server url match", function(test) test:plan(18) local httpd = cfgserv() test:istable(httpd, "httpd object") test:isnil(httpd:match('GET', '/')) test:is(httpd:match('GET', '/abc').endpoint.path, "/abc", "/abc") test:is(#httpd:match('GET', '/abc').stash, 0, "/abc") test:is(httpd:match('GET', '/abc/123').endpoint.path, "/abc/:cde", "/abc/123") test:is(httpd:match('GET', '/abc/123').stash.cde, "123", "/abc/123") test:is(httpd:match('GET', '/abc/123/122').endpoint.path, "/abc/:cde/:def", "/abc/123/122") test:is(httpd:match('GET', '/abc/123/122').stash.def, "122", "/abc/123/122") test:is(httpd:match('GET', '/abc/123/122').stash.cde, "123", "/abc/123/122") test:is(httpd:match('GET', '/abc_123-122').endpoint.path, "/abc_:cde_def", "/abc_123-122") test:is(httpd:match('GET', '/abc_123-122').stash.cde_def, "123-122", "/abc_123-122") test:is(httpd:match('GET', '/abc-123-def').endpoint.path, "/abc-:cde-def", "/abc-123-def") test:is(httpd:match('GET', '/abc-123-def').stash.cde, "123", "/abc-123-def") test:is(httpd:match('GET', '/aba-123-dea/1/2/3').endpoint.path, "/aba*def", '/aba-123-dea/1/2/3') test:is(httpd:match('GET', '/aba-123-dea/1/2/3').stash.def, "-123-dea/1/2/3", '/aba-123-dea/1/2/3') test:is(httpd:match('GET', '/abb-123-dea/1/2/3/cde').endpoint.path, "/abb*def/cde", '/abb-123-dea/1/2/3/cde') test:is(httpd:match('GET', '/abb-123-dea/1/2/3/cde').stash.def, "-123-dea/1/2/3", '/abb-123-dea/1/2/3/cde') test:is(httpd:match('GET', '/banners/1wulc.z8kiy.6p5e3').stash.token, '1wulc.z8kiy.6p5e3', "stash with dots") end) test:test("server url_for", function(test) test:plan(5) local httpd = cfgserv() test:is(httpd:url_for('abcdef'), '/abcdef', '/abcdef') test:is(httpd:url_for('test'), '/abc//', '/abc//') test:is(httpd:url_for('test', { cde = 'cde_v', def = 'def_v' }), '/abc/cde_v/def_v', '/abc/cde_v/def_v') test:is(httpd:url_for('star', { def = '/def_v' }), '/abb/def_v/cde', '/abb/def_v/cde') test:is(httpd:url_for('star', { def = '/def_v' }, { a = 'b', c = 'd' }), '/abb/def_v/cde?a=b&c=d', '/abb/def_v/cde?a=b&c=d') end) test:test("server requests", function(test) test:plan(47) local httpd = cfgserv() httpd:start() local r = http_client.get('http://127.0.0.1:12345/../') test:is(r.status, 400, 'invalid path') local r = http_client.get('http://127.0.0.1:12345/./') test:is(r.status, 400, 'invalid path') local r = http_client.get('http://127.0.0.1:12345/%2e%2f') test:is(r.status, 400, 'invalid path') local r = http_client.get('http://127.0.0.1:12345/%2e/') test:is(r.status, 400, 'invalid path') local r = http_client.get('http://127.0.0.1:12345/.%2f') test:is(r.status, 400, 'invalid path') local r = http_client.get('http://127.0.0.1:12345/test') test:is(r.status, 200, '/test code') test:is(r.proto[1], 1, '/test http 1.1') test:is(r.proto[2], 1, '/test http 1.1') test:is(r.reason, 'Ok', '/test reason') test:is(string.match(r.body, 'title: 123'), 'title: 123', '/test body') local r = http_client.get('http://127.0.0.1:12345/test404') test:is(r.status, 404, '/test404 code') test:is(r.reason, 'Not found', '/test404 reason') local r = http_client.get('http://127.0.0.1:12345/absent') test:is(r.status, 500, '/absent code') test:is(r.reason, 'Internal server error', '/absent reason') test:is(string.match(r.body, 'load module'), 'load module', '/absent body') local r = http_client.get('http://127.0.0.1:12345/ctxaction') test:is(r.status, 200, '/ctxaction code') test:is(r.reason, 'Ok', '/ctxaction reason') test:is(string.match(r.body, 'Hello, Tarantool'), 'Hello, Tarantool', '/ctxaction body') test:is(string.match(r.body, 'action: action'), 'action: action', '/ctxaction body action') test:is(string.match(r.body, 'controller: module[.]controller'), 'controller: module.controller', '/ctxaction body controller') local r = http_client.get('http://127.0.0.1:12345/ctxaction.invalid') test:is(r.status, 404, '/ctxaction.invalid code') -- WTF? test:is(r.reason, 'Not found', '/ctxaction.invalid reason') test:is(r.body, '', '/ctxaction.invalid body') local r = http_client.get('http://127.0.0.1:12345/hello.html') test:is(r.status, 200, '/hello.html code') test:is(r.reason, 'Ok', '/hello.html reason') test:is(string.match(r.body, 'static html'), 'static html', '/hello.html body') local r = http_client.get('http://127.0.0.1:12345/absentaction') test:is(r.status, 500, '/absentaction 500') test:is(r.reason, 'Internal server error', '/absentaction reason') test:is(string.match(r.body, 'contain function'), 'contain function', '/absentaction body') local r = http_client.get('http://127.0.0.1:12345/helper') test:is(r.status, 200, 'helper 200') test:is(r.reason, 'Ok', 'helper reason') test:is(string.match(r.body, 'Hello, world'), 'Hello, world', 'helper body') local r = http_client.get('http://127.0.0.1:12345/helper?abc') test:is(r.status, 200, 'helper?abc 200') test:is(r.reason, 'Ok', 'helper?abc reason') test:is(string.match(r.body, 'Hello, world'), 'Hello, world', 'helper body') httpd:route({path = '/die', file = 'helper.html.el'}, function() error(123) end ) local r = http_client.get('http://127.0.0.1:12345/die') test:is(r.status, 500, 'die 500') test:is(r.reason, 'Internal server error', 'die reason') httpd:route({ path = '/info' }, function(cx) return cx:render({ json = cx.peer }) end) local r = json.decode(http_client.get('http://127.0.0.1:12345/info').body) test:is(r.host, '127.0.0.1', 'peer.host') test:isnumber(r.port, 'peer.port') local r = httpd:route({method = 'POST', path = '/dit', file = 'helper.html.el'}, function(tx) return tx:render({text = 'POST = ' .. tx:read()}) end) test:istable(r, ':route') test:test('GET/POST at one route', function(test) test:plan(4) r = httpd:route({method = 'POST', path = '/dit', file = 'helper.html.el'}, function(tx) return tx:render({text = 'POST = ' .. tx:read()}) end) test:istable(r, 'add POST method') r = httpd:route({method = 'GET', path = '/dit', file = 'helper.html.el'}, function(tx) return tx:render({text = 'GET = ' .. tx:read()}) end ) test:istable(r, 'add GET method') r = http_client.request('POST', 'http://127.0.0.1:12345/dit', 'test') test:is(r.body, 'POST = test', 'POST reply') r = http_client.request('GET', 'http://127.0.0.1:12345/dit') test:is(r.body, 'GET = ', 'GET reply') end) httpd:route({path = '/chunked'}, function(self) return self:iterate(ipairs({'chunked', 'encoding', 't\r\nest'})) end) -- http client currently doesn't support chunked encoding local r = http_client.get('http://127.0.0.1:12345/chunked') test:is(r.status, 200, 'chunked 200') test:is(r.headers['transfer-encoding'], 'chunked', 'chunked headers') test:is(r.body, 'chunkedencodingt\r\nest', 'chunked body') test:test('cookie', function(test) test:plan(2) httpd:route({ path = '/cookie'}, function(req) local resp = req:render({text = ''}) resp:setcookie({ name = 'test', value = 'tost', expires = '+1y', path = '/abc' }) resp:setcookie({ name = 'xxx', value = 'yyy' }) return resp end) local r = http_client.get('http://127.0.0.1:12345/cookie') test:is(r.status, 200, 'status') test:ok(r.headers['set-cookie'] ~= nil, "header") end) test:test('redirect', function(test) test:plan(2) httpd:route({ path = '/redirect'}, function(req) return req:redirect_to('http://www.mail.ru/') end) local r = http_client.get('http://127.0.0.1:12345/redirect') test:is(r.status, 302, 'status') test:is(r.headers['location'], "http://www.mail.ru/", "header") end) test:test('post body', function(test) test:plan(2) httpd:route({ path = '/post', method = 'POST'}, function(req) local t = { #req:read("\n"); #req:read(10); #req:read({ size = 10, delimiter = "\n"}); #req:read("\n"); #req:read(); #req:read(); #req:read(); } return req:render({json = t}) end) local bodyf = io.open('./test/public/lorem.txt') local body = bodyf:read('*a') bodyf:close() local r = http_client.post('http://127.0.0.1:12345/post', body) test:is(r.status, 200, 'status') test:is_deeply(json.decode(r.body), { 541,10,10,458,1375,0,0 }, 'req:read() results') end) httpd:stop() end) test:check() os.exit(0)
DefineClass.CloningVats = { __parents = { "ElectricityConsumer", "Workplace" }, progress = false, } function CloningVats:Init() self.progress = 0 end function CloningVats:BuildingUpdate(dt, ...) if self.working then local points = MulDivRound(self.performance,g_Consts.cloning_points, 100) self.progress = self.progress + points if self.progress >= 1000 then local colonist_table = GenerateColonistData(self.city, "Child", "martianborn") colonist_table.dome = self.parent_dome colonist_table.traits["Clone"] = true if UICity.mystery and UICity.mystery:IsKindOf("DreamMystery") then colonist_table.traits["Dreamer"] = true end local colonist = Colonist:new(colonist_table) colonist:SetOutside(false) self:OnEnterUnit(colonist) Msg("ColonistBorn", colonist, "cloned") self.progress = 0 self.parent_dome.clones_created = self.parent_dome.clones_created + 1 end end end function CloningVats:GetCloningProgress() return MulDivRound(self.progress,100, 1000) end
local function map(func, collection) local results = {} for index, value in pairs(collection) do local newValue, newIndex = func(value, index) results[newIndex or index] = newValue end return results end local function optionalMap(func, collection) local results = {} for index, value in pairs(collection) do local newValue, newIndex = func(value, index) if newValue then results[newIndex or index] = newValue end end return results end local function reduce(func, accum, collection) for index, value in pairs(collection) do accum = func(value, index, accum) end return accum end local function filter(func, collection) local results = {} for index, value in pairs(collection) do if func(value, index) then results[index] = value end end return results end local function assignOne(targetCollection, sourceCollection) for index, value in pairs(sourceCollection) do targetCollection[index] = value end return targetCollection end local function assign(targetCollection, ...) local sourceCollections = {...} for _, sourceCollection in ipairs(sourceCollections) do targetCollection = assignOne(targetCollection, sourceCollection) end return targetCollection end local function first(collection) return collection[1] end local function last(collection) return collection[#collection] end local function rest(collection) if #collection < 2 then return nil end local results = {} for i = 2, #collection do results[i - 1] = collection[i] end return results end local function concat(...) local result = {} for _, tbl in ipairs{...} do for _, val in pairs(tbl) do result[#result + 1] = val end end return result end return { map = map, optionalMap = optionalMap, reduce = reduce, filter = filter, assign = assign, first = first, last = last, rest = rest, concat = concat }
print ("Access Virus TI Lua ext initialized") patch.requestAll ()
SingingMountainClanScreenPlay = ScreenPlay:new { numberOfActs = 1, screenplayName = "SingingMountainClanScreenPlay", } registerScreenPlay("SingingMountainClanScreenPlay", true) function SingingMountainClanScreenPlay:start() if (isZoneEnabled("dathomir")) then self:spawnMobiles() end end function SingingMountainClanScreenPlay:spawnMobiles() --Structure Entrance. 154, 4573 spawnMobile("dathomir", "singing_mountain_clan_sentry", 900, -1.5, 2.0, 5.6, 78, 2665879) spawnMobile("dathomir", "singing_mountain_clan_sentry", 900, -1.4, 2.0, 10.1, 81, 2665879) spawnMobile("dathomir", "singing_mountain_clan_huntress", 900, 4.7, 2.0, 13.3, -21, 2665879) spawnMobile("dathomir", "singing_mountain_clan_sentry", 900, 0.6, 2.0, 23.4, -108, 2665879) spawnMobile("dathomir", "singing_mountain_clan_guardian", 900, -12.0, 2.0, 14.7, 150, 2665880) spawnMobile("dathomir", "singing_mountain_clan_slave", 900, -12.78, 2.3, 4.47, 0, 2665880) spawnMobile("dathomir", "singing_mountain_clan_slave", 900, -11.3, 2.3, 5.38, 0, 2665880) spawnMobile("dathomir", "singing_mountain_clan_slave", 900, -12.7, 2.3, 6.3, 0, 2665880) spawnMobile("dathomir", "singing_mountain_clan_huntress", 900, -28.1, 2.0, 4.9, 63, 2665881) spawnMobile("dathomir", "singing_mountain_clan_huntress", 900, -27.3, 2.0, 9.0, 66, 2665881) spawnMobile("dathomir", "singing_mountain_clan_rancor_tamer", 900, -17.8, 2.0, -6.1, -97, 2665882) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 900, -25.9, 2.0, -7.4, -153, 2665882) spawnMobile("dathomir", "singing_mountain_clan_councilwoman", 1800, -1.7, 3.0, -5.2, 140, 2665884) spawnMobile("dathomir", "singing_mountain_clan_guardian", 900, 3.0, 2.0, -16.5, -138, 2665884) spawnMobile("dathomir", "singing_mountain_clan_sentry", 900, 8.5, 2.0, -26.4, -45, 2665884) spawnMobile("dathomir", "singing_mountain_clan_sentry", 900, 8.6, 2.0, -21.2, -150, 2665884) spawnMobile("dathomir", "singing_mountain_clan_sentry", 900, 16.4, 2.01, -10.8, -174, 2665885) spawnMobile("dathomir", "singing_mountain_clan_sentry", 900, 16.5, 2.0, -24.4, -82, 2665885) spawnMobile("dathomir", "singing_mountain_clan_slave", 900, 24.9, 2.0, -20.2, 49, 2665886) spawnMobile("dathomir", "singing_mountain_clan_slave", 900, 27.0, 2.0, -12.4, 89, 2665887) spawnMobile("dathomir", "singing_mountain_clan_slave", 900, 26.2, 2.0, -3.6, 86, 2665888) spawnMobile("dathomir", "singing_mountain_clan_slave", 900, 16.4, 2.0, 7.4, 0, 2665889) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 900, 16.8, 2.0, 9.7, -6, 2665889) spawnMobile("dathomir", "singing_mountain_clan_rancor_tamer", 600, 153.0, 430.0, 4544.3, 0, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor", 600, 147.5, 430.0, 4537.5, 0, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor", 600, 158.5, 430.0, 4537.5, 0, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 600, 141.0, 430.0, 4549.3, 90, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 600, 164.6, 430.0, 4554.5, -90, 0) spawnMobile("dathomir", "singing_mountain_clan_huntress", 600, 150.1, 430.0, 4525.8, 23, 0) spawnMobile("dathomir", "singing_mountain_clan_dragoon", 600, 162.3, 430.0, 4528.2, -70, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 195.3, 430.0, 4593.2, -145, 0) spawnMobile("dathomir", "singing_mountain_clan_huntress", 600, 199.9, 430.0, 4580.8, -83, 0) spawnMobile("dathomir", "singing_mountain_clan_scout", 600, 185.8, 430.0, 4571.3, -45, 0) spawnMobile("dathomir", "singing_mountain_clan_dragoon", 600, 162.2, 390.7, 4637.8, 10, 0) spawnMobile("dathomir", "singing_mountain_clan_dragoon", 600, 151.8, 429.2, 4581.1, 10, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 176.7, 375.6, 4668.3, 47, 0) spawnMobile("dathomir", "singing_mountain_clan_outcast", 450, 87.3, 312.1, 4684.6, -176, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor_tamer", 600, 210.6, 369.9, 4686.2, -11, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor", 600, 209.1, 371.6, 4691.2, 38, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 900, 253.9, 256.2, 4842.8, -66, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 900, 270.3, 275.9, 4813.3, -125, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 307.7, 334.1, 4753.5, 13, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 600, 388.2, 345.6, 4751.6, -112, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor", 600, 513.8, 275.1, 4739.1, 105, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor_tamer", 600, 512.4, 275.0, 4733.3, 105, 0) spawnMobile("dathomir", "singing_mountain_clan_guardian", 600, 502.6, 274.9, 4697.2, 33, 0) spawnMobile("dathomir", "singing_mountain_clan_councilwoman", 1800, 530.7, 275.0, 4690.4, -15, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 600, 521.2, 275.0, 4714.3, -16, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 600, 517.7, 275.0, 4718.5, 114, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 524.6, 275.0, 4720.3, -129, 0) spawnMobile("dathomir", "singing_mountain_clan_huntress", 600, 534.2, 274.4, 4737.5, -147, 0) spawnMobile("dathomir", "singing_mountain_clan_sentry", 450, 546.8, 275.0, 4702.1, 75, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 900, 677.5, 214.2, 4622.4, 64, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 900, 693.3, 214.1, 4590.3, -160, 0) spawnMobile("dathomir", "singing_mountain_clan_huntress", 600, 601.4, 247.5, 4612.1, 152, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 600, 626.7, 257.3, 4560.4, -20, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 600, 635.5, 256.1, 4485.3, -170, 0) spawnMobile("dathomir", "singing_mountain_clan_guardian", 1800, 614.8, 260.0, 4520.2, -90, 0) spawnMobile("dathomir", "singing_mountain_clan_dragoon", 900, 599.3, 260.0, 4521.5, 172, 0) spawnMobile("dathomir", "singing_mountain_clan_scout", 900, 591.5, 260.0, 4512.8, 51, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 600, 571.2, 260.0, 4520.3, 93, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 600, 571.4, 260.0, 4536.8, 117, 0) spawnMobile("dathomir", "singing_mountain_clan_sentry", 450, 581.5, 260.0, 4550.6, 149, 0) spawnMobile("dathomir", "singing_mountain_clan_sentry", 450, 601.4, 260.0, 4542.8, 84, 0) spawnMobile("dathomir", "singing_mountain_clan_scout", 300, 833.8, 190.3, 4328.9, -75, 0) spawnMobile("dathomir", "singing_mountain_clan_scout", 300, 797.7, 190.3, 4208.2, 175, 0) spawnMobile("dathomir", "singing_mountain_clan_scout", 300, 696.0, 186.7, 4070.5, 160, 0) spawnMobile("dathomir", "singing_mountain_clan_scout", 300, 528.1, 190.0, 4029.3, -75, 0) spawnMobile("dathomir", "singing_mountain_clan_scout", 300, 374.3, 176.1, 3979.4, -155, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 608.0, 272.3, 4325.7, -165, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 629.1, 251.6, 4281.8, 65, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor", 600, 625.6, 240.3, 4238.4, 135, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor_tamer", 600, 634.3, 238.9, 4240.2, 145, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 900, 602.4, 257.7, 4246.7, 137, 0) spawnMobile("dathomir", "singing_mountain_clan_councilwoman", 1800, 546.3, 229.5, 4244.3, 170, 0) spawnMobile("dathomir", "singing_mountain_clan_councilwoman", 1800, 513.3, 229.5, 4168.1, -3, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 566.1, 229.5, 4225.9, -105, 0) spawnMobile("dathomir", "singing_mountain_clan_guardian", 900, 543.7, 229.5, 4214.4, -7, 0) spawnMobile("dathomir", "singing_mountain_clan_dragoon", 600, 551.8, 229.5, 4204.4, -110, 0) spawnMobile("dathomir", "singing_mountain_clan_scout", 600, 538.3, 229.5, 4176.0, -175, 0) spawnMobile("dathomir", "singing_mountain_clan_scout", 600, 547.3, 229.5, 4178.5, -175, 0) spawnMobile("dathomir", "singing_mountain_clan_initiate", 600, 537.9, 229.5, 4230.9, 107, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor", 600, 535.2, 229.5, 4207.8, 145, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor_tamer", 600, 529.6, 229.5, 4202.9, 145, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 500.0, 229.5, 4219.1, 145, 0) spawnMobile("dathomir", "singing_mountain_clan_rancor", 600, 505.5, 229.5, 4202.6, 105, 0) spawnMobile("dathomir", "singing_mountain_clan_huntress", 600, 502.1, 229.5, 4187.4, 2, 0) spawnMobile("dathomir", "singing_mountain_clan_sentry", 450, 573.4, 229.5, 4162.6, -109, 0) spawnMobile("dathomir", "singing_mountain_clan_sentry", 450, 536.4, 229.5, 4146.8, 164, 0) spawnMobile("dathomir", "singing_mountain_clan_sentry", 450, 476.7, 230.2, 4125.6, -104, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 363.9, 220.5, 4109.9, -157, 0) spawnMobile("dathomir", "singing_mountain_clan_guardian", 900, 175.7, 149.7, 4032.9, -117, 0) spawnMobile("dathomir", "singing_mountain_clan_sentry", 450, 173.0, 150.0, 4041.6, -117, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 250.7, 385.2, 4338.3, 147, 0) spawnMobile("dathomir", "singing_mountain_clan_arch_witch", 600, 375.0, 367.0, 4321.0, -4, 0) spawnMobile("dathomir", "singing_mountain_clan_scout", 600, 432.6, 317.6, 4275.9, 135, 0) spawnMobile("dathomir", "singing_mountain_clan_outcast", 600, 268.7, 226.6, 4154.1, -151, 0) end
local createEnum = require(script.Parent.createEnum) local RequestType = createEnum("RequestType", { "None", "Asset", "Bundle", "GamePass", "Product", "Premium", "Subscription", }) return RequestType
package("libogg") set_homepage("https://www.xiph.org/ogg/") set_description("Ogg Bitstream Library") set_urls("https://downloads.xiph.org/releases/ogg/libogg-$(version).tar.gz", "https://gitlab.xiph.org/xiph/ogg.git") add_versions("1.3.4", "fe5670640bd49e828d64d2879c31cb4dde9758681bb664f9bdbf159a01b0c76e") on_install("macosx", "linux", "mingw", "iphoneos", "android", "cross", function (package) local configs = {"--disable-dependency-tracking"} if package:config("shared") then table.insert(configs, "--enable-shared=yes") else table.insert(configs, "--enable-shared=no") end import("package.tools.autoconf").install(package, configs) end) on_test(function (package) assert(package:has_cfuncs("ogg_sync_init", {includes = {"stdint.h", "ogg/ogg.h"}})) end)
local controller = {} controller.name = "MaxHelpingHand/SetFlagOnSpawnController" controller.depth = 0 controller.texture = "ahorn/MaxHelpingHand/set_flag_on_spawn" controller.placements = { name = "controller", data = { flag = "flag_name", enable = false, onlyOnRespawn = false, ifFlag = "" } } return controller
--[[---------------------------------------------------------------------------------------------------- <auto-generated> This file was generated by: ClientIntegration/Tools/LuaStringsGenerator/GenerateAllLocales.py Changes to this file should always follow: Building an Internationalized Feature - Engineer's Guide: https://confluence.roblox.com/display/IN/Building+an+Internationalized+Feature+-+Engineer%27s+Guide Sync up with newly-updated translations: https://confluence.roblox.com/display/MOBAPP/Sync+up+with+newly-updated+translations </auto-generated> --------------------------------------------------------------------------------------------------------]] return{ ["Feature.Catalog.Label.Premium"] = [[Premium]], ["Authentication.Login.Label.Username"] = [[Имя пользователя]], ["Authentication.Login.Response.IncorrectUsernamePassword"] = [[Неправильные имя пользователя или пароль.]], ["Authentication.Login.Label.Password"] = [[Пароль]], ["Authentication.Login.Action.LogInCapitalized"] = [[Вход]], ["Authentication.Login.Heading.Login"] = [[Вход]], ["Authentication.Login.Action.ForgotPasswordOrUsernameQuestionCapitalized"] = [[Забыли пароль или имя пользователя?]], ["Authentication.Login.Response.IncorrectEmailOrPassword"] = [[Некорректные эл. почта или пароль.]], ["Authentication.Login.Response.IncorrectPhoneOrPassword"] = [[Некорректные номер телефона или пароль.]], ["Authentication.Login.Response.UnverifiedEmailLoginWithUsername"] = [[Эта эл. почта не подтверждена. Пожалуйста, введите свое имя пользователя.]], ["Authentication.Login.Label.UsernameEmailPhone"] = [[Имя пользователя/эл. почта/номер телефона]], ["Authentication.Login.Action.WeChatLogin"] = [[Вход в WeChat]], ["Authentication.Login.Response.MoreThanOneUsername"] = [[Эта эл. почта привязана к нескольким пользователям. Пожалуйста, введите свое имя пользователя.]], ["Authentication.Login.Response.ServiceUnavailable"] = [[Служба недоступна. Повторите попытку позже.]], ["Authentication.Login.Response.LoginWithUsernameUnknownError"] = [[Возникли проблемы. Пожалуйста, введите свое имя пользователя.]], ["Authentication.Login.Response.SomethingWentWrong"] = [[Возникли проблемы. Повторите попытку позже.]], ["Authentication.SignUp.Label.Birthday"] = [[Дата рождения]], ["Authentication.SignUp.Label.Gender"] = [[Пол]], ["Authentication.SignUp.Label.SignUp"] = [[Регистрация]], ["Authentication.SignUp.Response.BadUsername"] = [[Имя пользователя не подходит для Roblox.]], ["Authentication.SignUp.Response.InvalidEmail"] = [[Недопустимый адрес эл. почты.]], ["Authentication.SignUp.Response.PasswordComplexity"] = [[Придумайте более сложный пароль.]], ["Authentication.SignUp.Response.PasswordMatchesUsername"] = [[Пароль должен отличаться от имени.]], ["Authentication.SignUp.Response.PasswordWrongShort"] = [[Пароль должен содержать не менее 8 знаков.]], ["Authentication.SignUp.Response.UsernameAlreadyInUse"] = [[Это имя пользователя уже занято.]], ["Authentication.SignUp.Response.UsernameInvalidCharacters"] = [[Допускаются только символы a–z, A–Z, 0-9 и _.]], ["Authentication.SignUp.Response.UsernameInvalidLength"] = [[Введите от 3 до 20 символов.]], ["Authentication.SignUp.Response.UsernameInvalidUnderscore"] = [[Имя не может начинаться/заканчиваться _.]], ["Authentication.SignUp.Response.UsernamePrivateInfo"] = [[Имя пользователя может содержать личные данные.]], ["Authentication.SignUp.Response.UsernameTooManyUnderscores"] = [[Имя может содержать не более одного _.]], ["Authentication.SignUp.Response.SignUpPasswordTooShortError"] = [[Пароль должен содержать не менее 8 знаков.]], ["Authentication.SignUp.Description.ByTappingSign"] = [[Нажав на кнопку «Регистрация», вы принимаете наши ]], ["Authentication.SignUp.Response.BirthdayMustBeSetFirst"] = [[Сначала требуется указать дату рождения.]], ["Authentication.SignUp.Label.Male"] = [[Мужской]], ["Authentication.SignUp.Label.Female"] = [[Женский]], ["Authentication.SignUp.Description.UsernameHint"] = [[Не указывайте свое настоящее имя.]], ["Authentication.SignUp.Description.PasswordMinLength"] = [[Не менее 8 символов]], ["Authentication.SignUp.Label.Continue"] = [[Продолжить]], ["Authentication.SignUp.Label.WhensYourBirthday"] = [[Когда у вас день рождения?]], ["Authentication.SignUp.Response.InvalidPhoneNumber"] = [[Недопустимый номер телефона.]], ["Authentication.SignUp.Response.PhoneNumberAlreadyLinked"] = [[Номер уже привязан к другой учетной записи.]], ["Authentication.SignUp.Response.InvalidCode"] = [[Недопустимый код.]], ["Authentication.SignUp.Label.PhoneNumber"] = [[Номер телефона]], ["Authentication.SignUp.Description.UsernamePage"] = [[Так вас будут звать в Roblox. Не указывайте свое настоящее имя.]], ["Authentication.SignUp.Label.UsernameError1"] = [[Содержит только буквы, цифры и знак _]], ["Authentication.SignUp.Label.UsernameError2"] = [[Содержит от 3 до 20 знаков]], ["Authentication.SignUp.Label.UsernameError3"] = [[Не используется другими пользователями]], ["Authentication.SignUp.Label.UsernameError4"] = [[Подходит для Roblox]], ["Authentication.SignUp.Label.UsernameError5"] = [[Не начинается и не оканчивается символом _]], ["Authentication.SignUp.Label.UsernameError6"] = [[Содержит не более одного символа _]], ["Authentication.SignUp.Label.UsernameError7"] = [[Не содержит личные данные]], ["Authentication.SignUp.Description.PasswordPage"] = [[Никому не говорите свой пароль.]], ["Authentication.SignUp.Label.PasswordError1"] = [[Не менее 8 знаков]], ["Authentication.SignUp.Label.PasswordError2"] = [[Не совпадает с именем пользователя]], ["Authentication.SignUp.Label.PasswordError3"] = [[Не является слишком простым]], ["Authentication.SignUp.Heading.UsernamePage"] = [[Выберите имя пользователя]], ["Authentication.SignUp.Heading.PasswordPage"] = [[Придумайте пароль]], ["Authentication.SignUp.Heading.SelectStartingAvatar"] = [[Выберите первоначальный персонаж]], ["Authentication.SignUp.Heading.VerificationPage"] = [[Подтвердить учетную запись]], ["Authentication.SignUp.Description.VerificationPage"] = [[Нажав кнопку «Продолжить», вы соглашаетесь с Условиями предоставления услуг и принимаете Политику конфиденциальности.]], ["Authentication.SignUp.Label.NoVerificationCode"] = [[Вы получили код?]], ["Authentication.SignUp.Label.Resend"] = [[Отправить заново]], ["Authentication.SignUp.Label.TooManyAttempts"] = [[Слишком много попыток. Повторите попытку позже.]], ["Authentication.SignUp.Label.EmailInUse"] = [[Эта эл. почта уже используется.]], ["Authentication.SignUp.Label.SMSFeeWarning"] = [[Вы получите СМС-сообщение для подтверждения вашего номера телефона. Возможно, будет удержана комиссия.]], ["Authentication.SignUp.Label.EnterVerificationCode"] = [[Введите отправленный шестизначный код]], ["Authentication.SignUp.Heading.CountryCodeSelector"] = [[Выберите страну]], ["Authentication.SignUp.Label.EmailAddress"] = [[Эл. почта]], ["Authentication.SignUp.Label.ErrorsWithUsername"] = [[В имени пользователя есть ошибки.]], ["Authentication.SignUp.Label.ErrorsWithPassword"] = [[В пароле есть ошибки.]], ["Authentication.SignUp.Label.ConfirmBirthday"] = [[Подтвердить дату рождения]], ["Authentication.TwoStepVerification.Label.EnterEmailCode"] = [[Введите код, отправленный вам по электронной почте]], ["Authentication.TwoStepVerification.Label.EnterTextCode"] = [[Введите код, отправленный вам в сообщении]], ["Authentication.TwoStepVerification.Label.InvalidCode"] = [[Недопустимый код]], ["Authentication.TwoStepVerification.Label.TwoStepVerification"] = [[Двухэтапная проверка]], ["Authentication.TwoStepVerification.Response.InvalidCode"] = [[Недопустимый код]], ["Authentication.TwoStepVerification.Response.TooManyAttempts"] = [[Слишком много попыток. Повторите попытку позже.]], ["Authentication.TwoStepVerification.Label.TrustThisDevice"] = [[Считать устройство проверенным 30 дней]], ["Authentication.TwoStepVerification.Label.SimpleNeedHelp"] = [[Требуется помощь?]], ["Authentication.TwoStepVerification.Action.ClickHere"] = [[Щелкните здесь]], ["Authentication.TwoStepVerification.Label.DidNotReceive"] = [[Не получили код?]], ["Authentication.TwoStepVerification.Label.Resend"] = [[Отправить заново]], ["CommonUI.Controls.Birthdaypicker.Label.Date"] = [[Дата]], ["CommonUI.Controls.Label.April"] = [[Апрель]], ["CommonUI.Controls.Label.August"] = [[Август]], ["CommonUI.Controls.Label.December"] = [[Декабрь]], ["CommonUI.Controls.Label.February"] = [[Февраль]], ["CommonUI.Controls.Label.January"] = [[Январь]], ["CommonUI.Controls.Label.July"] = [[Июль]], ["CommonUI.Controls.Label.June"] = [[Июнь]], ["CommonUI.Controls.Label.March"] = [[Март]], ["CommonUI.Controls.Label.May"] = [[Май]], ["CommonUI.Controls.Label.November"] = [[Ноябрь]], ["CommonUI.Controls.Label.October"] = [[Октябрь]], ["CommonUI.Controls.Label.September"] = [[Сентябрь]], ["CommonUI.Controls.Label.Day"] = [[День]], ["CommonUI.Controls.Label.Year"] = [[Год]], ["CommonUI.Controls.Action.Back"] = [[Назад]], ["CommonUI.Controls.Action.Confirm"] = [[Подтверждаю]], ["CommonUI.Controls.Label.AutoUpgradeIdle"] = [[Roblox нужно обновить! Если вы ничего не сделаете, Roblox автоматически перезапустится через: {time} {unit}.]], ["CommonUI.Controls.Label.AutoUpgradeForce"] = [[Roblox нужно обновить! Чтобы играть в эту игру, вам нужно установить обновление.]], ["CommonUI.Controls.Label.Seconds"] = [[сек.]], ["CommonUI.Controls.Label.Minutes"] = [[мин.]], ["CommonUI.Controls.Label.JanuaryAbbreviated"] = [[Янв]], ["CommonUI.Controls.Label.FebruaryAbbreviated"] = [[Фев]], ["CommonUI.Controls.Label.MarchAbbreviated"] = [[Мар]], ["CommonUI.Controls.Label.AprilAbbreviated"] = [[Апр]], ["CommonUI.Controls.Label.AugustAbbreviated"] = [[Авг]], ["CommonUI.Controls.Label.SeptemberAbbreviated"] = [[Сен]], ["CommonUI.Controls.Label.OctoberAbbreviated"] = [[Окт]], ["CommonUI.Controls.Label.NovemberAbbreviated"] = [[Ноя]], ["CommonUI.Controls.Label.DecemberAbbreviated"] = [[Дек]], ["CommonUI.Features.Label.Avatar"] = [[Аватар]], ["CommonUI.Features.Label.Blog"] = [[Блог]], ["CommonUI.Features.Label.BuildersClub"] = [[Участие]], ["CommonUI.Features.Label.Catalog"] = [[Каталог]], ["CommonUI.Features.Label.Chat"] = [[Чат]], ["CommonUI.Features.Label.Events"] = [[Акции]], ["CommonUI.Features.Label.Friends"] = [[Друзья]], ["CommonUI.Features.Label.Game"] = [[Игры]], ["CommonUI.Features.Label.Groups"] = [[Группы]], ["CommonUI.Features.Label.Help"] = [[Справка]], ["CommonUI.Features.Label.Home"] = [[Главная]], ["CommonUI.Features.Label.Inventory"] = [[Инвентарь]], ["CommonUI.Features.Label.Messages"] = [[Сообщения]], ["CommonUI.Features.Label.More"] = [[Больше]], ["CommonUI.Features.Label.Profile"] = [[Профиль]], ["CommonUI.Features.Label.Settings"] = [[Настройки]], ["CommonUI.Features.Label.TermsOfService"] = [[Условия предоставления услуг]], ["CommonUI.Features.Label.PrivacyPolicy"] = [[Политика конфиденциальности]], ["CommonUI.Features.Label.About"] = [[Сведения]], ["CommonUI.Features.Label.AboutUs"] = [[О нас]], ["CommonUI.Features.Label.Careers"] = [[Работа]], ["CommonUI.Features.Label.Parents"] = [[Родители]], ["CommonUI.Features.Label.Terms"] = [[Условия]], ["CommonUI.Features.Label.Privacy"] = [[Конфиденциальность]], ["CommonUI.Features.Label.Version"] = [[Версия]], ["CommonUI.Features.Label.MoreEvents"] = [[Новые события – уже скоро!]], ["CommonUI.Features.Heading.GameDetails"] = [[Сведения об игре]], ["CommonUI.Features.Label.Players"] = [[Игроки]], ["CommonUI.Features.Label.Create"] = [[Создать]], ["CommonUI.Features.Label.TermsOfUse"] = [[Условия использования]], ["CommonUI.Features.Label.Badges"] = [[Значки]], ["CommonUI.Features.Label.MyFeed"] = [[Лента]], ["CommonUI.Features.Label.CreateGames"] = [[Создать]], ["CommonUI.Features.Label.VersionWithNumber"] = [[Версия:{versionNumber}]], ["CommonUI.Features.Label.Challenge"] = [[Состязания]], ["CommonUI.Features.Heading.ItemDetails"] = [[Сведения о предмете]], ["CommonUI.Features.Label.Startup"] = [[Стартап]], ["CommonUI.Features.Label.Discussions"] = [[Обсуждения]], ["CommonUI.Features.Label.DevSubs"] = [[Подписки]], ["CommonUI.Features.Label.FMODCredits"] = [[Использует FMOD от Firelight Studios]], ["CommonUI.Features.Label.Discover"] = [[Исследовать]], ["CommonUI.Features.Label.Billing"] = [[Оплата]], ["CommonUI.Features.Label.Trades"] = [[Торговля]], ["CommonUI.Messages.Label.Password"] = [[Пароль]], ["CommonUI.Messages.Description.And"] = [[и]], ["CommonUI.Messages.Action.OK"] = [[OK]], ["CommonUI.Messages.Label.Alert"] = [[Тревога]], ["Feature.PremiumMigration.PopUp.Title"] = [[Клуб создателей теперь стал Roblox Премиум]], ["Feature.PremiumMigration.PopUp.Body"] = [[Чем дальше продвигается подписчик, тем больше возрастает его ежемесячное получение Robux вместо ежедневного. Сегодня мы переводим {robuxAmount} Robux на вашу учетную запись, чтобы пополнить ваш счет за текущий месяц. Проверьте вашу учетную запись Roblox.]], ["Feature.PremiumMigration.Feature.PremiumMigration.Description.Body"] = [[Чем дальше продвигается подписчик, тем больше возрастает его ежемесячное получение Robux вместо ежедневного. Сегодня мы переводим {robuxAmount} Robux на вашу учетную запись, чтобы пополнить ваш счет за текущий месяц. Проверьте вашу учетную запись Roblox.]], ["Feature.PremiumMigration.Feature.PremiumMigration.Heading.Title"] = [[Клуб создателей теперь стал Roblox Премиум]], ["Feature.PremiumMigration.Description.Body"] = [[Чем дальше вы продвигаетесь, тем больше вы получаете Robux в день за ваши обновления подписок. Сегодня вы получаете месячный вычет Robux, равный: R${robuxAmount}. Зайдите в свою учетную запись в Roblox, чтобы получить подробные сведения.]], ["Feature.PremiumMigration.Heading.Title"] = [[Клуб создателей теперь стал Roblox Премиум]], ["Feature.PremiumMigration.Heading.WebviewTitle"] = [[Roblox Премиум]], ["Feature.PremiumMigration.Description.BodyV2"] = [[Чем дальше вы продвигаетесь, тем больше получаете Robux в день обновления подписки. Сегодня вы получаете месячный вычет Robux, равный: {robuxAmount} Robux. Зайдите в свою учетную запись в Roblox, чтобы узнать подробности.]], ["InGame.InspectMenu.Label.NoResellers"] = [[Нет посредников]], }
-- Storage disks holostorage.disks = {} function holostorage.disks.register_disk(index, desc, capacity) local mod = minetest.get_current_modname() minetest.register_craftitem(mod..":storage_disk"..index, { description = desc.."\nStores "..capacity.." Stacks", inventory_image = "holostorage_disk"..index..".png", groups = {holostorage_disk = 1}, holostorage_capacity = capacity, holostorage_name = "disk"..index, stack_max = 1, on_secondary_use = function (itemstack, user, pointed_thing) return stack end }) end -- Make sure stack is disk function holostorage.disks.is_valid_disk(stack) local stack_name = stack:get_name() return minetest.get_item_group(stack_name, "holostorage_disk") > 0 end local capacities = {1000, 8000, 16000, 32000, 64000} local descriptions = {"1K Disk", "8K Disk", "16K Disk", "32K Disk", "64K Disk"} for i = 1, 5 do holostorage.disks.register_disk(i, descriptions[i], capacities[i]) end
local hyper = {"cmd", "ctrl"} local INCREASE_VOLUME, DECREASE_VOLUME = 1, -1 local lastTime = -1 local lastDirection = 0 local gap = 1 -- hs.hotkey.bind(hyper, "l", function() -- hs.caffeinate.systemSleep() -- end) function isRecentChange(args) local time = hs.timer.localTime() local res = time - lastTime < 8 lastTime = time return res end function isSameDirection(direction) local res = lastDirection == direction lastDirection = direction return res end function increaseGap() gap = math.min(gap + 1, 5) end function resetGap() gap = 1 end function changeVolume(direction) local recentChange = isRecentChange() local sameDirection = isSameDirection(direction) if recentChange and sameDirection then increaseGap() else resetGap() end setVolume(direction * gap) end function setVolume(n) output = hs.audiodevice.defaultOutputDevice() if output:muted() then setMuted(false) end volume = output:outputVolume() newVolume = volume + n output:setVolume(newVolume) hs.alert.closeAll(0.2) hs.alert.show("Volume: " .. math.floor(output:outputVolume())) end function setMuted(mute) output = hs.audiodevice.defaultOutputDevice() output:setMuted(mute) if mute then hs.alert.show("Mute") else hs.alert.show("Not Mute") end end function increaseVolume() changeVolume(INCREASE_VOLUME) end function decreaseVolume() changeVolume(DECREASE_VOLUME) end hs.hotkey.bind(hyper, "k", increaseVolume, nil, increaseVolume) hs.hotkey.bind(hyper, "j", decreaseVolume, nil, decreaseVolume) hs.hotkey.bind(hyper, "h", function() setMuted(true) end) hs.hotkey.bind(hyper, "g", function() setMuted(false) end) hs.hotkey.bind(hyper, "l", function() hs.caffeinate.startScreensaver() end)
--[[ Shine Custom Spawns plug-in. - Server ]] local Shine = Shine local SetupClassHook = Shine.Hook.SetupClassHook local Lower = string.lower local StringFormat = string.format local IsType = Shine.IsType local Plugin = Shine.Plugin( ... ) Plugin.Version = "1.1" Plugin.NS2Only = true Plugin.HasConfig = true Plugin.ConfigName = "customspawns/config.json" Plugin.DefaultConfig = { Maps = { [ "ns2_biodome" ] = true, [ "ns2_caged" ] = false, [ "ns2_derelict"] = false, [ "ns2_descent" ] = true, [ "ns2_docking" ] = true, [ "ns2_eclipse" ] = true, [ "ns2_kodiak" ] = false, [ "ns2_mineshaft" ] = true, [ "ns2_refinery" ] = false, [ "ns2_summit" ] = true, [ "ns2_tram" ] = false, [ "ns2_veil" ] = false, } } --list of default cross spawn map settings local MapConfigs = { [ "ns2_biodome" ] = { { name = "Reception", team = "marines", enemyspawns = { "Atmosphere Exchange" } }, { name = "Atmosphere Exchange", team = "aliens", enemyspawns = { "Reception" } } }, [ "ns2_caged" ] = { { name = "main hold", team = "marines", enemyspawns = { "ventilation system" } }, { name = "ventilation system", team = "aliens", enemyspawns = { "main hold" } } }, [ "ns2_derelict" ] = { { enemyspawns = { "geothermal" }, name = "western entrance", team = "marines" }, { enemyspawns = { "atmospheric seeding" }, name = "garage", team = "both" }, { enemyspawns = { "western entrance" }, name = "geothermal", team = "aliens" }, { enemyspawns = { "garage" }, name = "atmospheric seeding", team = "both" } }, [ "ns2_descent" ] = { { name = "Drone Bay", team = "both", enemyspawns = { "Fabrication" } }, { name = "Fabrication", team = "both", enemyspawns = { "Drone Bay" } }, { name = "Launch Control", team = "both", enemyspawns = { "Monorail" } }, { name = "Monorail", team = "both", enemyspawns = { "Launch Control" } } }, [ "ns2_docking" ] = { { name = "Terminal", team = "marines", enemyspawns = { "Generator" } }, { name = "Generator", team = "aliens" } }, [ "ns2_eclipse" ] = { { name = "Marine Start", team = "marines", enemyspawns = { "Computer Core" } }, { name = "Computer Core", team = "aliens" } }, [ "ns2_kodiak" ] = { { name = "Asteroid Tracking", team = "marines", enemyspawns = { "Command" } }, { name = "Command", team = "aliens" } }, [ "ns2_mineshaft" ] = { { name = "Operations", team = "marines", enemyspawns = { "Cave" } }, { name = "Repair", team = "marines", enemyspawns = { "Sorting" } }, { name = "Cave", team = "aliens" }, { name = "Sorting", team = "aliens" } }, [ "ns2_refinery" ] = { { enemyspawns = { "pipeworks" }, name = "smelting", team = "both" },{ enemyspawns = { "flow control" }, name = "containment", team = "both" },{ enemyspawns = { "turbine", "smelting" }, name = "pipeworks", team = "both" },{ enemyspawns = { "containment" }, name = "flow control", team = "both" },{ enemyspawns = { "pipeworks" }, name = "turbine", team = "both" } }, [ "ns2_summit" ] = { { name = "Sub Access", team = "both", enemyspawns = { "Atrium" } }, { name = "Data Core", team = "both", enemyspawns = { "Flight Control" } }, { name = "Flight Control", team = "both", enemyspawns = { "Data Core" } }, { name = "Atrium", team = "both", enemyspawns = { "Sub Access" } } }, [ "ns2_tram" ] = { { enemyspawns = { "shipping" }, name = "warehouse", team = "both" },{ enemyspawns = {}, name = "repair room", team = "none" },{ enemyspawns = { "shipping" }, name = "server room", team = "both" },{ enemyspawns = { "warehouse", "server room" }, name = "shipping", team = "both" },{ enemyspawns = {}, name = "elevator transfer", team = "none" } }, [ "ns2_veil" ] = { { name = "Control", team = "marines", enemyspawns = { "Cargo" } }, { name = "Cargo", team = "aliens" } }, } SetupClassHook( "NS2Gamerules", "ChooseTechPoint", "OverrideChooseTechPoint", function( OldFunc, NS2Gamerules, TechPoints, TeamNumber ) local Pre = Shine.Hook.Call( "PreChooseTechPoint", NS2Gamerules, TechPoints, TeamNumber) if Pre then return Pre end local TechPoint = OldFunc( NS2Gamerules, TechPoints, TeamNumber ) Shine.Hook.Call( "PostChooseTechPoint", NS2Gamerules, TechPoint, TeamNumber) return TechPoint end ) SetupClassHook( "NS2Gamerules", "ResetGame", "OnGameReset", "PassivePre") SetupClassHook( "TechPoint", "GetChooseWeight", "OnTechPointGetChooseWeight", "ActivePre") SetupClassHook( "TechPoint", "GetTeamNumberAllowed", "OnTechPointGetTeamNumberAllowed", "ActivePre") function Plugin:Initialise() self.Gamemode = Shine.GetGamemode() if self.Gamemode ~= "ns2" and self.Gamemode ~= "mvm" then return false, StringFormat( "The customspawns plugin does not work with %s.", self.Gamemode ) end self.Enabled = true return true end local function LoadMapConfig( Mapname, Gamemode ) local MapPath = StringFormat( "customspawns/%s.json" , Mapname ) local Path = Shine.Config.ExtensionDir .. MapPath local MapConfig = Shine.LoadJSONFile( Path ) --Look for gamemode specific config file. if not MapConfig and Gamemode ~= "ns2" then Path = StringFormat( "%s%s/%s", Shine.Config.ExtensionDir, Gamemode, MapPath ) MapConfig = Shine.LoadJSONFile( Path ) end if ( not MapConfig or not IsType( MapConfig, "table" ) ) and MapConfigs[ Mapname ] then Shine.SaveJSONFile( MapConfigs[ Mapname ], Path ) MapConfig = MapConfigs[ Mapname ] end return MapConfig end function Plugin:OnTechPointGetChooseWeight() return 1 end function Plugin:ParseMapConfig() local MapName = Lower( Shared.GetMapName() ) self.Spawns = GetEntities("TechPoint") -- convert list into a set for i = 1, #self.Spawns do local TechPoint = self.Spawns[i] local Name = Lower( TechPoint:GetLocationName() ) self.Spawns[Name] = TechPoint end if not self.Config.Maps[ MapName ] then self.Enabled = false --So the command might be used return end local Spawns = LoadMapConfig( MapName, self.Gamemode ) local NumAlienSpawns = 0 local NumMarineSpawns = 0 for i = 1, #Spawns do local Spawn = Spawns[i] local name = Lower( Spawn.name ) if not self.Spawns[ name ] then return StringFormat("%s in the given mapconfig is not a valid spawn!", Spawn.name ) end if not Spawn.team then return StringFormat("the spawn %s has no valid team in the given mapconfig!", Spawn.name ) end local team = 3 local teamname = Lower( Spawn.team ) if teamname == "both" then NumAlienSpawns = NumAlienSpawns + 1 NumMarineSpawns = NumMarineSpawns + 1 team = 0 elseif teamname == "aliens" then NumAlienSpawns = NumAlienSpawns + 1 team = 2 elseif teamname == "marines" then NumMarineSpawns = NumMarineSpawns + 1 team = 1 end self.Spawns[ name ].team = team if team < 2 and (not Spawn.enemyspawns or not type( Spawn.enemyspawns ) == "table" or #Spawn.enemyspawns < 1) then return StringFormat("the spawn %s has no valid enemyspawns in the given mapconfig!", Spawn.name ) end self.Spawns[ name ].enemyspawns = Spawn.enemyspawns end if NumAlienSpawns < 1 or NumMarineSpawns < 1 then return "there are not enought spawns for both teams in the given mapconfig!" end end function Plugin:OnTechPointGetTeamNumberAllowed( TechPoint ) local name = Lower( TechPoint:GetLocationName() ) return self.Spawns[ name ] and self.Spawns[ name ].team or 3 end --Called after a techpoint has been chosen. function Plugin:PostChooseTechPoint( _, TechPoint, TeamNumber) if TeamNumber == kTeam1Index then local name = Lower( TechPoint:GetLocationName() ) local enemyspawns = self.Spawns[ name ] and self.Spawns[ name ].enemyspawns if enemyspawns then local random = math.random( #enemyspawns ) self.ValidAlienSpawn = self.Spawns[ Lower( enemyspawns[ random ] ) ] end end end --Called before a techpoint has been chosen, if this returns soemthing it gets immediately returned by the hooked function function Plugin:PreChooseTechPoint( _, _, TeamNumber) if TeamNumber == kTeam2Index and self.ValidAlienSpawn then local TechPoint = self.ValidAlienSpawn self.ValidAlienSpawn = nil return TechPoint end end function Plugin:OnGameReset() if self.Spawns == nil then local error = self:ParseMapConfig() if error then Shared.Message(StringFormat("[CustomSpawns] Error, %s", error)) Shared.Message("[CustomSpawns] Unloading the plugin now ...") Shine:UnloadExtension( "customspawns" ) else --doing this here as map has been completly loaded at this point. self:CreateCommands() end end if not self.Enabled then return end Server.spawnSelectionOverrides = false Server.teamSpawnOverride = false end function Plugin:Notify( Player, String, Format, ... ) Shine:NotifyDualColour( Player, 0, 100, 255, "[CustomSpawns]", 255, 255, 255, String, Format, ... ) end function Plugin:CreateCommands() local function DumpSpawns( Client, DumpName) local SpawnsTable = {} local Spawns = { [0] = {}, [1] = {}, [2] = {}, [3] = {}, } local TeamNames = { [0] = "both", [1] = "marines", [2] = "aliens", [3] = "none", } local TechPoints = GetEntities("TechPoint") for i = 1, #TechPoints do local TechPoint = TechPoints[i] local Name = Lower( TechPoint:GetLocationName() ) table.insertunique(Spawns[TechPoint.allowedTeamNumber], Name ) end local function GetEnemySpawns( TeamNumber, TpName ) if TeamNumber > 2 then return {} end local function filter(t, v) for i = 1, #t do local e = t[i] if e == v then table.remove(t, i) break end end return t end local function merge( t1, t2 ) for i = 1, #t2 do local name = t2[i] t1[#t1 + 1] = name end return t1 end --noinspection ArrayElementZero local spawns = table.Copy(Spawns[0]) --localize, so we don't overriding the original table if TeamNumber < 2 then return filter(merge( spawns, Spawns[2] ), TpName) else return filter(merge( spawns, Spawns[1] ), TpName) end end for i = 1, #TechPoints do local TechPoint = TechPoints[i] local Name = Lower( TechPoint:GetLocationName() ) local SpawnEntry = {} SpawnEntry.name = Name SpawnEntry.team = TeamNames[ TechPoint.allowedTeamNumber ] SpawnEntry.enemyspawns = GetEnemySpawns( TechPoint.allowedTeamNumber, Name ) SpawnsTable[ #SpawnsTable + 1 ] = SpawnEntry end local filename = StringFormat( "%scustomspawns/%s.json", Shine.Config.ExtensionDir, DumpName ) Shine.SaveJSONFile( SpawnsTable, filename ) self:Notify( Client, "Spawn Dump has been saved to %s!", true, filename) end local DumpSpawnsCommand = self:BindCommand( "sh_dumpspawns", "dumpspawns", DumpSpawns ) DumpSpawnsCommand:AddParam{ Type = "string", Optional = true, Default = StringFormat("%s_dumped", Lower( Shared.GetMapName()))} DumpSpawnsCommand:Help( "<filename> Dumps the techpoints of this maps into a valid mapconfig file (with the given name)" ) end function Plugin:Cleanup() self.Spawns = nil self.ValidAlienSpawn = nil self.BaseClass.Cleanup( self ) self.Enabled = false end return Plugin
----------------------------------------- -- ID: 6054 -- Windstorm Schema -- Teaches the white magic Windstorm ----------------------------------------- function onItemCheck(target) return target:canLearnSpell(114) end function onItemUse(target) target:addSpell(114) end
----------------------------------- -- Area: Gusgen Mines -- NPC: _5ga (Lever C) -- !pos 44 -40.561 -54.199 196 ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) --local nID = npc:getID() -- printf("id: %u", nID) local Lever = npc:getID() npc:openDoor(2) -- Lever animation if (GetNPCByID(Lever-6):getAnimation() == 9) then GetNPCByID(Lever-6):setAnimation(8)--open door C (_5g0) GetNPCByID(Lever-5):setAnimation(9)--close door B (_5g1) GetNPCByID(Lever-4):setAnimation(9)--close door A (_5g2) end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) end
AddCSLuaFile() AddCSLuaFile("sh_sounds.lua") include("sh_sounds.lua") SWEP.magType = "arMag" SWEP.PrintName = "AEK-971" if CLIENT then SWEP.DrawCrosshair = false SWEP.CSMuzzleFlashes = true SWEP.IconLetter = "w" killicon.Add( "", "", Color(255, 80, 0, 150)) SWEP.MuzzleEffect = "muzzleflash_ak47" SWEP.PosBasedMuz = true SWEP.ShellScale = 0.3 SWEP.ShellDelay = .02 SWEP.ShellOffsetMul = 1 SWEP.ShellPosOffset = {x = -0, y = 0, z = 0} SWEP.ForeGripOffsetCycle_Draw = 0 SWEP.ForeGripOffsetCycle_Reload = .85 SWEP.ForeGripOffsetCycle_Reload_Empty = .85 SWEP.SightWithRail = true SWEP.DisableSprintViewSimulation = false SWEP.SnapToIdlePostReload = true SWEP.EffectiveRange_Orig = 80.3 * 39.37 SWEP.DamageFallOff_Orig = .33 SWEP.BoltBone = "slide" SWEP.BoltBonePositionRecoverySpeed = 50 SWEP.BoltShootOffset = Vector(-2, 0, 0) SWEP.IronsightPos = Vector(-2.66, -1.6667, 0.38) SWEP.IronsightAng = Vector(0.1, 0.6, 0) SWEP.CSGOACOGPos = Vector(-2.744, -2.5, -0.96) SWEP.CSGOACOGAng = Vector(0, 0, 0) SWEP.FAS2AimpointPos = Vector(-2.719, -2.5, -0.848) SWEP.FAS2AimpointAng = Vector(0, 0, 0) SWEP.EoTech553Pos = Vector(-2.725, -2.5, -1.056) SWEP.EoTech553Ang = Vector(0, 0, 0) SWEP.MicroT1Pos = Vector(-2.737, -2.5, -0.805) SWEP.MicroT1Ang = Vector(0, 0, 0) SWEP.KR_CMOREPos = Vector(-2.74, -2.5, -0.95) SWEP.KR_CMOREAng = Vector(0, 0, 0) SWEP.PSOPos = Vector(-2.5813, 0.5, -0.114) SWEP.PSOAng = Vector(0, 0, 0) SWEP.ShortDotPos = Vector(-2.7323, -2.5, -0.876) SWEP.ShortDotAng = Vector(0, 0, 0) SWEP.KobraPos = Vector(-2.695, -2.5, -0.15) SWEP.KobraAng = Vector(0, 0, 0) SWEP.AlternativePos = Vector(-0.5556, -0.4, -0.5556) SWEP.AlternativeAng = Vector(0, 0, 0) SWEP.SprintPos = Vector(0.5556, -0.5556, 0.5556) SWEP.SprintAng = Vector(-30, 34, -22) SWEP.BackupSights = {["md_acog"] = {[1] = Vector(-1.12, -1, -.73), [2] = Vector(0, 0, 0)}} SWEP.CustomizationMenuScale = 0.024 SWEP.ViewModelMovementScale = 1 SWEP.AttachmentModelsVM = { ["md_uecw_csgo_acog"] = { type = "Model", model = "models/gmod4phun/csgo/eq_optic_acog.mdl", bone = "Plane02", rel = "", pos = Vector(-5.7, 0.019, -0.47), angle = Angle(0, 0, 0), size = Vector(0.649, 0.649, 0.649), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["md_fas2_aimpoint"] = { type = "Model", model = "models/c_fas2_aimpoint.mdl", bone = "Plane02", rel = "", pos = Vector(1.557, 0.019, 1.85), angle = Angle(0, 0, 0), size = Vector(0.899, 0.899, 0.899), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["odec3d_cmore_kry"] = { type = "Model", model = "models/weapons/krycek/sights/odec3d_cmore_reddot.mdl", bone = "Plane02", rel = "", pos = Vector(-0.519, 0.109, 2.539), angle = Angle(0, 0, 0), size = Vector(0.209, 0.209, 0.209), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["md_pso1"] = { type = "Model", model = "models/cw2/attachments/pso.mdl", bone = "Plane02", rel = "", pos = Vector(-4.5, 0, -1), angle = Angle(0, -90, 0), size = Vector(0.649, 0.649, 0.649), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["md_pbs12"] = { type = "Model", model = "models/cw2/attachments/pbs1.mdl", bone = "Plane02", rel = "", pos = Vector(17, 0.239, -0.65), angle = Angle(0, -90, 0), size = Vector(0.699, 0.699, 0.699), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["md_microt1kh"] = { type = "Model", model = "models/cw2/attachments/microt1.mdl", bone = "Plane02", rel = "", pos = Vector(-0.801, 0.035, 2.569), angle = Angle(0, -90, 0), size = Vector(0.3, 0.3, 0.3), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["md_fas2_eotech"] = { type = "Model", model = "models/c_fas2_eotech.mdl", bone = "Plane02", rel = "", pos = Vector(1.957, 0.025, 2.059), angle = Angle(0, 0, 0), size = Vector(0.85, 0.85, 0.85), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["md_rail"] = { type = "Model", model = "models/wystan/attachments/akrailmount.mdl", bone = "Plane02", rel = "", pos = Vector(-0.601, 0.259, 0.8), angle = Angle(0, 90, 0), size = Vector(0.899, 0.899, 0.899), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["md_schmidt_shortdot"] = { type = "Model", model = "models/cw2/attachments/schmidt.mdl", bone = "Plane02", rel = "", pos = Vector(-4.676, 0.3, -1.53), angle = Angle(0, 0, 0), size = Vector(0.699, 0.699, 0.699), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["md_kobra"] = { type = "Model", model = "models/cw2/attachments/kobra.mdl", bone = "Plane02", rel = "", pos = Vector(-0.519, -0.371, -1.3), angle = Angle(0, -90, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["md_foregrip"] = { type = "Model", model = "models/wystan/attachments/foregrip1.mdl", bone = "Plane02", rel = "", pos = Vector(-1.9, 0.5, -2.3), angle = Angle(0, 90, 0), size = Vector(0.6, 0.6, 0.6), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } SWEP.ForeGripHoldPos = { ["Left_Hand"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-1.111, -18.889, -16.667) }, ["Left_L_Arm"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-16.667, 12.222, 72.222) }, ["Left_U_Arm"] = { scale = Vector(1, 1, 1), pos = Vector(-4.259, 1.296, 2.778), angle = Angle(-16.667, 5.556, 3.332) }} SWEP.ACOGAxisAlign = {right = 0, up = 0, forward = 0} SWEP.SchmidtShortDotAxisAlign = {right = 0, up = 0, forward = 0} SWEP.PSO1AxisAlign = {right = 0, up = 0, forward = 90} end SWEP.MuzzleVelocity = 850 -- in meter/s SWEP.LuaViewmodelRecoil = true SWEP.CanRestOnObjects = true SWEP.Attachments = {[3] = {header = "Sight", offset = {450, -400}, atts = {"md_microt1kh","md_kobra","odec3d_cmore_kry","md_fas2_eotech","md_fas2_aimpoint", "md_schmidt_shortdot", "md_uecw_csgo_acog", "md_pso1"}}, [2] = {header = "Barrel", offset = {-50, -450}, atts = {"md_pbs12"}}, [1] = {header = "Handguard", offset = {-400, -150}, atts = {"md_foregrip"}}, ["+reload"] = {header = "Ammo", offset = {-450, 250}, atts = {"am_magnum", "am_matchgrade"}}} SWEP.Animations = {fire = {"shoot3", "shoot2", "shoot1"}, reload = "reload", idle = "idle", draw = "draw"} SWEP.Sounds = { draw = {{time = .2, sound = "AEK.Draw"}}, reload = {[1] = {time = .6, sound = "AEK.Clipout"}, [2] = {time = 1, sound = "AEK.Clipin"}, [3] = {time = 2, sound = "AEK.Boltpull"}}} SWEP.HoldBoltWhileEmpty = false SWEP.DontHoldWhenReloading = true SWEP.LuaVMRecoilAxisMod = {vert = .75, hor = 1.25, roll = .35, forward = .25, pitch = 1.25} SWEP.SpeedDec = 35 SWEP.Slot = 3 SWEP.SlotPos = 0 SWEP.NormalHoldType = "ar2" SWEP.RunHoldType = "passive" SWEP.FireModes = {"auto", "3burst", "semi"} SWEP.Base = "cw_base" SWEP.Category = "CW 2.0 - Rifles" SWEP.Author = "Khris" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.FireMoveMod = 1 SWEP.OverallMouseSens = .85 SWEP.ViewModelFOV = 80 SWEP.AimViewModelFOV = 75 SWEP.ViewModelFlip = false SWEP.ViewModel = "models/khrcw2/v_rif_aek97.mdl" SWEP.WorldModel = "models/khrcw2/w_rif_aek97.mdl" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.Primary.ClipSize = 30 SWEP.Primary.DefaultClip = 30 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "5.45x39MM" SWEP.FireDelay = 60/800 SWEP.FireSound = "AEK.FIRE" SWEP.FireSoundSuppressed = "AEK.SUPFIRE" SWEP.Recoil = 1.15 SWEP.HipSpread = 0.050 SWEP.AimSpread = 0.0035 SWEP.VelocitySensitivity = 1.8 SWEP.MaxSpreadInc = 0.060 SWEP.SpreadPerShot = 0.007 SWEP.SpreadCooldown = 0.15 SWEP.Shots = 1 SWEP.Damage = 31 SWEP.DeployTime = 1 SWEP.RecoilToSpread = .8 SWEP.ReloadSpeed = 1 SWEP.ReloadTime = 2.7 SWEP.ReloadTime_Empty = 2.7 SWEP.ReloadHalt = 2.7 SWEP.Offset = { Pos = { Up = 1, Right = 0, Forward = 0, }, Ang = { Up = 0, Right = -10, Forward = 180, } } function SWEP:DrawWorldModel( ) local hand, offset, rotate local pl = self:GetOwner() if IsValid( pl ) then local boneIndex = pl:LookupBone( "ValveBiped.Bip01_R_Hand" ) if boneIndex then local pos, ang = pl:GetBonePosition( boneIndex ) pos = pos + ang:Forward() * self.Offset.Pos.Forward + ang:Right() * self.Offset.Pos.Right + ang:Up() * self.Offset.Pos.Up ang:RotateAroundAxis( ang:Up(), self.Offset.Ang.Up) ang:RotateAroundAxis( ang:Right(), self.Offset.Ang.Right ) ang:RotateAroundAxis( ang:Forward(), self.Offset.Ang.Forward ) self:SetRenderOrigin( pos ) self:SetRenderAngles( ang ) self:DrawModel() end else self:SetRenderOrigin( nil ) self:SetRenderAngles( nil ) self:DrawModel() end end SWEP.ReloadHalt_Empty = 2.7 function SWEP:IndividualThink() self.EffectiveRange = 80.3 * 39.37 self.DamageFallOff = .33 if self.ActiveAttachments.md_pbs12 then self.EffectiveRange = ((self.EffectiveRange - 20.075 * 39.37)) self.DamageFallOff = ((self.DamageFallOff + .0825)) end if self.ActiveAttachments.am_matchgrade then self.EffectiveRange = ((self.EffectiveRange + 12.045 * 39.37)) self.DamageFallOff = ((self.DamageFallOff - .0495)) end end
local core = require "sys.core" local json = require "sys.json" local zproto = require "zproto" local assert = assert local pairs = pairs local match = string.match local tonumber = tonumber local lprint = core.log local M = {} local role_count local role_rpc = {} function M.join(conns, count) if not role_count then role_count = count else assert(role_count == count) end for i = 1, count do local rpc = conns[i] if rpc then role_rpc[i] = rpc end end end function M.call(uid, cmd, req) local rpc = role_rpc[uid % role_count + 1] if not rpc then return nil, "not ready" end return rpc:call(cmd, req) end function M.online(uid, slot) local r = role_rpc[uid % role_count + 1] local ack, err = r:call("online_c", { uid = uid, slot = slot }) if not ack then lprint("[agent.role] online uid", uid, "err", err) return nil end return ack end function M.offline(uid, slot) local r = role_rpc[uid % role_count + 1] local ack, err = r:call("offline_c", { uid = uid, slot = slot }) if not ack then lprint("[agent.role] online_c uid", uid, "err", err) return false end return true end function M.isready() if not role_count then return false end for i = 1, role_count do if not role_rpc[i] then return false end end return true end function M.capacity() return role_count or 0 end return M
object_tangible_smuggler_contraband_contraband_5 = object_tangible_smuggler_contraband_shared_contraband_5:new { } ObjectTemplates:addTemplate(object_tangible_smuggler_contraband_contraband_5, "object/tangible/smuggler/contraband/contraband_5.iff")
require "dialog" require "character" local dialog = Dialog() --******************* -- Sprites --******************* local cop_Sprite = CharSprite() cop_Sprite.age = 45 cop_Sprite.imgPath = "res/characters/cop.png" cop_Sprite.spriteImg = love.graphics.newImage(cop_Sprite.imgPath) cop_Sprite.spritename = "BobbySmith" local cop_Character = Character() cop_Character.charsprite = cop_Sprite cop_Character.designation = "Mr." cop_Character.firstName = "Bobby" cop_Character.lastName = "Smith" --******************* -- BACKGROUND --******************* local imgFolder = "res/scenes/inside_bar/" dialog.spriteImg = love.graphics.newImage(imgFolder .. "bar01.png") --******************* -- TEXT & CHARACTER --******************* -- the textes and the character name are defined by in a DialogBit dialog.dialogBits = { DialogBit(0, nil, "\n11:35 PM\nIn some bar.[function:WAIT(2)][function:TEXTSPEED(50)] We picked film noir remember.[function:WAIT(1)][function:TEXTSPEED(30)]\nSo obviously our main character is a drunkar.", 5, "center"), DialogBit(0, nil, "\nThe gameplay itself isn't very deep so far, so instead we thought 'let's show them our dialog system, wow, much interest, very original, such good job guys'.", 30, "center"), DialogBit(2, nil, "[function:WAIT(2)]Detective:\nBarman... Another round.", 20, "left", "barAmbiance"), DialogBit(1, nil, "Barman:\nWe will be closing soon. You should go home now.", 20, "left"), DialogBit(2, nil, "Detective:\nOne last round, man. And off I go.", 20, "left"), DialogBit(2, nil, "Detective:\nI can't really afford more anyways...", 20, "left"), DialogBit(1, nil, "[function:SLAPSCREEN]Familiar voice:\nHey, come on detective, this is no time for alcoholic coma", 35, "left"), DialogBit(2, cop_Character, "[function:WAIT(1)]Detective:\nHmmf, Smith, you here...", 10, "left"), DialogBit(1, cop_Character, "Bobby Smith:\nI thought I'd keep an eye on you.", 35, "left"), DialogBit(1, cop_Character, "Bobby Smith:\nYou should go home, the case won't work on itself.", 35, "left"), DialogBit(2, cop_Character, "Detective:\nBobby, Bobby, sweet little Bobby", 10, "left"), DialogBit(2, cop_Character, "[function:HARDSLAPSCREEN]Detective:\nThey dropped the case! I'm done. We will never find the bastard who... who...", 50, "left"), DialogBit(1, cop_Character, "Bobby Smith:\nCalm down, Detective. We will figure that out. Tomorrow is another day", 35, "left") } return dialog
--[[ :Timestamp: 2015-09-09 03:15:49 +0000 UTC :Type: mysql.slow-query :Hostname: app1.gamesales3 :Pid: 0 :Uuid: 87303593-3a61-4a6f-ab87-675cae0b0533 :Logger: slow_input :Payload: SELECT * FROM seo WHERE url = '/app/acct/17/104' LIMIT 0, 1; :EnvVersion: :Severity: 7 :Fields: | name:"Rows_examined" type:double value:21 | name:"Query_time" type:double value:0.000146 representation:"s" | name:"Rows_sent" type:double value:1 | name:"Lock_time" type:double value:4.3e-05 representation:"s" ]]-- --require "math" --require "string" require "os" local INT = 2 local DOUBLE = 3 local startup = os.time() * 1e9 local ready = false local count = 0 local sum_query_time = 0.0 -- micro second function process_message () if not ready and read_message("Timestamp") < startup then return 0 else ready = true end local query = read_message("Fields[Query_time]") count = count + 1 sum_query_time = sum_query_time + (query * 1000) return 0 end function timer_event(ns) if not ready then return end local avg_query_time = 0 if count > 0 then avg_query_time = sum_query_time / count end local msg = { Type = "mysql.slow-query.stat", Payload = "", Fields = { {name="mysql_slow_count", value=count, value_type=INT, representation="ts"}, {name="mysql_slow_avg_query", value=avg_query_time, value_type=DOUBLE, representation="ms"} } } inject_message(msg) count = 0 sum_query_time = 0.0 end
local ParserContext = require('erde.ParserContext') local constants = require('erde.constants') local rules = require('erde.rules') -- ----------------------------------------------------------------------------- -- CompilerContext -- ----------------------------------------------------------------------------- local CompilerContext = {} local CompilerContextMT = { __index = CompilerContext } for ruleName, compiler in pairs(rules.compile) do CompilerContext[ruleName] = compiler end function CompilerContext:reset() self.tmpNameCounter = 1 end function CompilerContext:compile(node) if type(node) ~= 'table' or not rules.compile[node.ruleName] then -- TODO error('No node compiler for ' .. require('inspect')(node)) end return rules.compile[node.ruleName](self, node) end -- ----------------------------------------------------------------------------- -- Compile Helpers -- ----------------------------------------------------------------------------- function CompilerContext:newTmpName() self.tmpNameCounter = self.tmpNameCounter + 1 return ('__ERDE_TMP_%d__'):format(self.tmpNameCounter) end function CompilerContext:compileBinop(op, lhs, rhs) if op.tag == 'nc' then local ncTmpName = self:newTmpName() return table.concat({ '(function()', ('local %s = %s'):format(ncTmpName, lhs), 'if ' .. ncTmpName .. ' ~= nil then', 'return ' .. ncTmpName, 'else', 'return ' .. rhs, 'end', 'end)()', }, '\n') elseif op.tag == 'or' then return table.concat({ lhs, ' or ', rhs }) elseif op.tag == 'and' then return table.concat({ lhs, ' and ', rhs }) elseif op.tag == 'bor' then return _VERSION:find('5.[34]') and table.concat({ lhs, ' | ', rhs }) or ('require("bit").bor(%s, %s)'):format(lhs, rhs) elseif op.tag == 'bxor' then return _VERSION:find('5.[34]') and table.concat({ lhs, ' ~ ', rhs }) or ('require("bit").bxor(%s, %s)'):format(lhs, rhs) elseif op.tag == 'band' then return _VERSION:find('5.[34]') and table.concat({ lhs, ' & ', rhs }) or ('require("bit").band(%s, %s)'):format(lhs, rhs) elseif op.tag == 'lshift' then return _VERSION:find('5.[34]') and table.concat({ lhs, ' << ', rhs }) or ('require("bit").lshift(%s, %s)'):format(lhs, rhs) elseif op.tag == 'rshift' then return _VERSION:find('5.[34]') and table.concat({ lhs, ' >> ', rhs }) or ('require("bit").rshift(%s, %s)'):format(lhs, rhs) elseif op.tag == 'intdiv' then return _VERSION:find('5.[34]') and table.concat({ lhs, ' // ', rhs }) or ('math.floor(%s / %s)'):format(lhs, rhs) else return table.concat({ lhs, op.token, rhs }, ' ') end end function CompilerContext:compileOptChain(node) local chain = self:compile(node.base) local optSubChains = {} for i, chainNode in ipairs(node) do if chainNode.optional then optSubChains[#optSubChains + 1] = chain end local newSubChainFormat if chainNode.variant == 'dotIndex' then chain = ('%s.%s'):format(chain, chainNode.value) elseif chainNode.variant == 'bracketIndex' then -- Space around brackets to avoid long string expressions -- [ [=[some string]=] ] chain = ('%s[ %s ]'):format(chain, self:compile(chainNode.value)) elseif chainNode.variant == 'functionCall' then local hasSpread = false for i, arg in ipairs(chainNode.value) do if arg.ruleName == 'Spread' then hasSpread = true break end end if hasSpread then local spreadFields = {} for i, arg in ipairs(chainNode.value) do spreadFields[i] = arg.ruleName == 'Spread' and arg or { value = self:compile(expr) } end chain = ('%s(%s(%s))'):format( chain, _VERSION:find('5.1') and 'unpack' or 'table.unpack', self:Spread(spreadFields) ) else local args = {} for i, arg in ipairs(chainNode.value) do args[#args + 1] = self:compile(arg) end chain = chain .. '(' .. table.concat(args, ',') .. ')' end elseif chainNode.variant == 'method' then chain = chain .. ':' .. chainNode.value end end return { optSubChains = optSubChains, chain = chain } end -- ----------------------------------------------------------------------------- -- Return -- ----------------------------------------------------------------------------- return function() return setmetatable({ tmpNameCounter = 1, }, CompilerContextMT) end