content
stringlengths
5
1.05M
-- Manually converted to Lua from: -- https://github.com/w3c/web-platform-tests/blob/83adac74b20a51d6cb83946830907c95d505ed1a/dom/nodes/Element-childElementCount.html local gumbo = require "gumbo" local input = [[ <!DOCTYPE HTML> <meta charset=utf-8> <title>childElementCount</title> <h1>Test of childElementCount</h1> <div id="log"></div> <p id="parentEl">The result of <span id="first_element_child"><span>this</span> <span>test</span></span> is <span id="middle_element_child" style="font-weight:bold;">given above.</span> <span id="last_element_child" style="display:none;">fnord</span> </p> ]] local document = assert(gumbo.parse(input)) local parentEl = assert(document:getElementById("parentEl")) assert(parentEl.childElementCount == 3)
--[[---------------------------------------------------------------------------- --- @file create.lua --- @brief fácil's create command. ----------------------------------------------------------------------------]]-- local Core = require "facil.core" local _M = {} --- Creates new card -- @param name Short descriptive name of card. -- @retval true, string - on success, where string is the uuid of new card. -- @retval nil, string - on error, where string contains detailed description. function _M.create(name) if not name or "string" ~= type(name) then return nil, "Invalid argument." end if not Core.getRootPath() then return nil, "Can't get fácil's root directory." end local card = {} card.name = name card.id = Core.uuid.new() if not card.id then return nil, "Can't generate uuid for card." end local templateErr, template = Core.getTemplate("md.lua") if not templateErr then return nil, "Can't read none of template files for task." end template.value = template.value:gsub("${NAME}", name) card.time = os.time() local prefix, body = Core.splitId(card.id) local markdown, markdownErr = Core.createCardFile("cards", prefix, body, ".md", template.value) if not markdown then return nil, markdownErr end --- @warning Platform (linux specific) dependent code. --- @todo Either replace with something more cross platform --- or check OS before. os.execute("$EDITOR " .. markdown.name) local meta, metaErr = Core.createCardFile("meta", prefix, body, nil, Core.serializeMeta(card)) if not meta then return nil, metaErr end local marker, markerErr = Core.createCardFile("boards", "backlog", card.id, nil, tostring(card.time)) if not marker then return nil, markerErr end return true, card.id end return _M
-- NOTE: temporary _G.Utils = {} _G.Commands = {} -- ===== SETTINGS ================================ _G.Settings = { colorscheme = 'ayu', -- 'ayu'|'xresources' background = 'dark', -- 'dark'|'light' ayu_ver = 'nvim', -- 'luxed'|'nvim', dependent on plugin mapleader = ' ', } -- before plugins so if they are setting keymaps they know the mapleader, in keys it's too late vim.g.mapleader = _G.Settings.mapleader require('plugins') require('keys') require('options') require('stylish') require('commands')
width = 960 height = 640
function init() setName("Directional Warp") setDesc("Warps texture in a direction") setSize(140, 24+64+8+8+18+18+7+4) addOutput(24+32) addInput("Texture", 24+64+8+8) addInputParameter("Direction", "Blur direction", 24+64+8+8+18, 0, -1, -1) addInputParameter("Intensity", "Blur intensity", 24+64+8+8+18+18, 10, 0, 100, true) end function normalize(x, y, z) l = math.sqrt(x*x+y*y+z*z) return x/l, y/l, z/l end function apply() tileSize = getTileSize() for i=0, tileSize*tileSize-1 do x = i%tileSize y = math.floor(i/tileSize) intensity = getValue(2, x, y, 100.0) dist = tileSize*intensity direction = getValue(1, x, y, 360.0)*360.0*math.pi/180.0 dx, dy = normalize(math.sin(direction), -math.cos(direction), 0.0) cr, cg, cb = getValue(0, x+dx*dist, y+dy*dist, 1.0) fr = cr fg = cg fb = cb setPixel(0, x, y, fr, fg, fb) end end
local mod = DBM:NewMod("d511", "DBM-Scenario-MoP") local L = mod:GetLocalizedStrings() mod:SetRevision(("$Revision: 2 $"):sub(12, -3)) mod:SetZone() mod:RegisterCombat("scenario", 1031) mod:RegisterEventsInCombat( "SPELL_CAST_START" -- "SPELL_AURA_REMOVED" ) mod.onlyNormal = true local warnFlameWall = mod:NewSpellAnnounce(123966, 4) local specWarnFlameWall = mod:NewSpecialWarningSpell(123966, nil, nil, nil, true) mod:RemoveOption("HealthFrame") --[[ --Needs more data, i'm not sure if it has a CD or is just health based atm so no CD timer just yet. "<378.3> [CHAT_MSG_MONSTER_YELL] CHAT_MSG_MONSTER_YELL#She's here to make new friends... and then set them on fire! It's Pandaria's prettiest little playful pyromaniac, Liuyang! "<426.1> [CLEU] SPELL_CAST_START#false#0xF130F75100000965#Little Liuyang#68168#0#0x0000000000000000#nil#-2147483648#-2147483648#123966#Flame Wall#4", -- [5522] "<473.5> [CLEU] SPELL_AURA_REMOVED#false#0xF130F75100000965#Little Liuyang#68168#0#0xF130F75100000965#Little Liuyang#68168#0#123966#Flame Wall#4#BUFF", -- [6368] "<509.4> [CLEU] SPELL_CAST_START#false#0xF130F75100000965#Little Liuyang#68168#0#0x0000000000000000#nil#-2147483648#-2147483648#123966#Flame Wall#4", -- [6965] "<544.3> [CLEU] SPELL_AURA_REMOVED#false#0xF130F75100000965#Little Liuyang#2632#0#0xF130F75100000965#Little Liuyang#2632#0#123966#Flame Wall#4#BUFF", -- [7546] --]] function mod:SPELL_CAST_START(args) if args.spellId == 123966 then warnFlameWall:Show() specWarnFlameWall:Show() end end --[[ function mod:SPELL_AURA_REMOVED(args) if args.spellId == 123966 then end end --]]
-- This file is auto-generated by shipwright.nvim local common_fg = "#4B4B4B" local inactive_bg = "#D4D4D4" local inactive_fg = "#818181" return { normal = { a = { bg = "#A6A6A6", fg = common_fg, gui = "bold" }, b = { bg = "#B9B9B9", fg = common_fg }, c = { bg = "#CCCCCC", fg = "#555555" }, }, insert = { a = { bg = "#99B5C3", fg = common_fg, gui = "bold" }, }, command = { a = { bg = "#CBB1CA", fg = common_fg, gui = "bold" }, }, visual = { a = { bg = "#CCCCCC", fg = common_fg, gui = "bold" }, }, replace = { a = { bg = "#E5CBD1", fg = common_fg, gui = "bold" }, }, inactive = { a = { bg = inactive_bg, fg = inactive_fg, gui = "bold" }, b = { bg = inactive_bg, fg = inactive_fg }, c = { bg = inactive_bg, fg = inactive_fg }, }, }
-- Touch sensor for 8 pads -- Set threshold to 30% of untouched state -- Print padNum list per callback -- To use: -- tpad = require("touch_8pads_showlist") -- tpad.init({isDebug=false}) -- tpad.config() local m = {} m.pad = {2,3,4,5,6,7,8,9} -- 2=GPIO2, 3=GPIO15, 4=GPIO13, 5=GPIO12, 6=GPIO14, 7=GPIO27, 8=GPIO33, 9=GPIO32 m._tp = nil -- will hold the touchpad obj m._isDebug = true -- We will get a callback every 8ms or so when touched function m.onTouch(pads) print(m.pconcat(pads)) end function m.pconcat(tab) local ctab = {} local n = 1 for k, v in pairs(tab) do ctab[n] = k n = n + 1 end return table.concat(ctab, ",") end function m.init(tbl) if (tbl ~= nil) then if (tbl.isDebug ~= nil) then m._isDebug = tbl.isDebug end end m._tp = touch.create({ pad = m.pad, -- pad = 0 || {0,1,2,3,4,5,6,7,8,9} 0=GPIO4, 1=GPIO0, 2=GPIO2, 3=GPIO15, 4=GPIO13, 5=GPIO12, 6=GPIO14, 7=GPIO27, 8=GPIO33, 9=GPIO32 cb = m.onTouch, -- Callback will get Lua table of pads/bool(true) that were touched. intrInitAtStart = false, -- Turn on interrupt at start. Default to true. Set to false to config first. Turn on later with tp:intrEnable() thresTrigger = touch.TOUCH_TRIGGER_BELOW, -- TOUCH_TRIGGER_BELOW or TOUCH_TRIGGER_ABOVE. Touch interrupt happens if counter is below or above. lvolt = touch.TOUCH_LVOLT_0V5, -- Low ref voltage TOUCH_LVOLT_0V4, TOUCH_LVOLT_0V5, TOUCH_LVOLT_0V6, TOUCH_LVOLT_0V7 hvolt = touch.TOUCH_HVOLT_2V7, -- High ref voltage TOUCH_HVOLT_2V4, TOUCH_HVOLT_2V5, TOUCH_HVOLT_2V6, TOUCH_HVOLT_2V7 atten = touch.TOUCH_HVOLT_ATTEN_1V, -- TOUCH_HVOLT_ATTEN_0V, TOUCH_HVOLT_ATTEN_0V5, TOUCH_HVOLT_ATTEN_1V, TOUCH_HVOLT_ATTEN_1V5 isDebug = m._isDebug }) end function m.read() local raw = m._tp:read() print("Pad", "Val") for key,value in pairs(raw) do print(key,value) end end function m.config() local raw = m._tp:read() if (m._isDebug) then print("Configuring...") print("Pad", "Base", "Thres") end for key,value in pairs(raw) do if key ~= nil then -- reduce by 30% local thres = raw[key] - math.floor(raw[key] * 0.3) m._tp:setThres(key, thres) if (m._isDebug) then print(key, value, thres) end end end m._tp:intrEnable() if (m._isDebug) then print("You can now touch the sensors") end end -- m.init() -- m.read() -- m.config() return m
--[[ AdiBags - Shadowlands item filter by PsyKzz version: v1.0 Adds a new filter for Anima and Conduit items ]] local addonName, addon = ... local AdiBags = LibStub("AceAddon-3.0"):GetAddon("AdiBags") local L = addon.L local covenantFilter = AdiBags:RegisterFilter("Shadowlands - Covenant Items", 100, "ABEvent-1.0") covenantFilter.uiName = "Shadowlands - Covenant Items" covenantFilter.uiDesc = "Separate out different Shadowlands items, like Anima and Conduits." function covenantFilter:OnInitialize() self.db = AdiBags.db:RegisterNamespace("Covenant Items", { profile = { anima = true, conduits = true, covenantCrafting = true, } }) end function covenantFilter:Update() self:SendMessage("AdiBags_FiltersChanged") end function covenantFilter:OnEnable() AdiBags:UpdateFilters() end function covenantFilter:OnDisable() AdiBags:UpdateFilters() end function covenantFilter:Filter(slotData) local itemLoc = ItemLocation:CreateFromBagAndSlot(slotData.bag, slotData.slot) if self.db.profile.conduits and C_Item.IsItemConduit(itemLoc) then return "Conduit" end local item = GetContainerItemLink(slotData.bag, slotData.slot) if self.db.profile.anima and C_Item.IsAnimaItemByID(item) then return "Anima" end local KyrianCraftingItems = { [180477] = true, -- feathers [180595] = true, -- steel [180594] = true, -- bone [180478] = true, -- pelt [178995] = true, -- shard } local NecrolordCraftingItems = { [178061] = true, -- mallable flesh [183744] = true, -- superior parts } local NightFaeCraftingItems = { [178879] = true, -- divine dutiful spirit [178880] = true, -- greater dutiful spirit [178881] = true, -- dutiful spirit [178874] = true, -- martial spirit [178877] = true, -- greater martial spirit [178878] = true, -- divine martial spirit [177698] = true, -- untamed spirit [177699] = true, -- greater untamed spirit [177700] = true, -- divine untamed spirit [178882] = true, -- prideful spirit [178883] = true, -- greater prideful spirit [178884] = true, -- divine prideful spirit [176832] = true, -- wildseed root grain [176922] = true, -- temporal leaves [176922] = true, -- wild nightbloom } local item = GetContainerItemLink(slotData.bag, slotData.slot) if self.db.profile.covenantCrafting and (KyrianCraftingItems[slotData.itemId] or NecrolordCraftingItems[slotData.itemId] or NightFaeCraftingItems[slotData.itemId]) then return "Covenant Crafting" end end function covenantFilter:GetOptions() return { anima = { name = "Anima", desc = "Items redeemmed at the sanctum upgrade for Reserved Anima", type = "toggle", order = 10 }, conduits = { name = "Conduits", desc = "Items used at the Soul Forge.", type = "toggle", order = 20 }, covenantCrafting = { name = "Covenant Crafting items", desc = "Items used at for specific convenant.", type = "toggle", order = 30 } }, AdiBags:GetOptionHandler(self, false, function () return self:Update() end) end
local options = { { key = "StartingResources", name = "Starting Resources", desc = "Sets storage and amount of resources that players will start with", type = "section", }, { key = "ta_exp", name = "Tech Annihilation - Experimental Options", desc = "Tech Annihilation - Experimental Options", type = "section", }, { key = "ta_modes", name = "Tech Annihilation - Game Modes", desc = "Tech Annihilation - Game Modes", type = "section", }, { key = "ta_options", name = "Tech Annihilation - Options", desc = "Tech Annihilation - Options", type = "section", }, { key = "ta_wall_options", name = "Tech Annihilation - Wall Options", desc = "Tech Annihilation - Wall Options", type = "section", }, { key = "startenergy", name = "Starting energy", desc = "Determines amount of energy and energy storage that each player will start with\nAutoHost Usage :- startenergy", type = "number", section = "StartingResources", def = 1000, min = 0, --max = 1000000, step = 1, }, { key = "startmetal", name = "Starting metal", desc = "Determines amount of metal and metal storage that each player will start with\nAutoHost Usage :- startmetal", type = "number", section = "StartingResources", def = 1000, min = 0, --max = 1000000, step = 1, }, { key = "deathmode", name = "Game End Mode", desc = "What it takes to eliminate a team\nAutoHost Usage :- deathmode", type = "list", def = "com", section = "ta_modes", items = { { key = "neverend", name = "None", desc = "Teams are never eliminated" }, { key = "com", name = "Kill all enemy Commanders", desc = "When a team has no Commanders left, it loses" }, { key = "killall", name = "Kill everything", desc = "Every last unit must be eliminated, no exceptions!" }, } }, { key = "mo_coop", name = "Cooperative Mode", desc = "Adds an extra commander for comsharing teams\nAutoHost Usage :- mo_coop", type = "bool", def = false, section = "ta_modes", }, { key = "mo_greenfields", name = "No Metal Extraction", desc = "No metal extraction on any map\nAutoHost Usage :- mo_greenfields", type = "bool", def = false, section = "ta_modes", }, { key = "mo_noowner", name = "FFA Mode", desc = "Units with no player control are instantly removed/destroyed\nAutoHost Usage :- mo_noowner", type = "bool", def = false, section = "ta_modes", }, { key = "mo_preventcombomb", name = "Prevent Combombs", desc = "Commanders survive DGuns and other commanders explosions\nAutoHost Usage :- mo_preventcombomb", type = "list", section = "ta_modes", def = "off", items = { { key = "hp", name = "Health", desc = "Commander with greatest hp survives comblast" }, { key = "1v1", name = "1v1", desc = "Default Setting for 1v1 games" }, { key = "off", name = "Off", desc = "Default engine Control" }, } }, { key = "mo_progmines", name = "Progressive Mining", desc = "New mines take some time to become fully established, death resets progress\nAutoHost Usage :- mo_progmines", type = "bool", def = false, section = "ta_modes", }, { key = "shareddynamicalliancevictory", name = "Dynamic Ally Victory", desc = "Ingame alliance should count for game over condition\nAutoHost Usage :- shareddynamicalliancevictory", type = "bool", def = false, section = "ta_modes", }, { key = "mo_comgate", name = "Commander Teleport Effect", desc = "Commanders warp in at gamestart with a shiny teleport effect\nAutoHost Usage :- mo_comgate", type = "bool", def = false, section = "ta_options", }, { key = "mo_dynamic", name = "Dynamic Lighting", desc = "Toggles Dynamic lighing on or off\nAutoHost Usage :- mo_dynamic", type = "bool", def = true, section = "ta_options", }, { key = "mo_enemywrecks", name = "Show Enemy Wrecks", desc = "Gives you LOS of enemy wreckage\nAutoHost Usage :- mo_enemywrecks", type = "bool", def = true, section = "ta_options", }, { key = "mo_nanoframedecay", name = "Disable nana frame decay", desc = "Stop nanoframe decaying over time\nAutoHost Usage :- mo_nanoframedecay", type = "bool", def = false, section = "ta_options", }, { key = "mo_no_close_spawns", name = "No close spawns", desc = "Prevents players startpoints being placed close together (on large enough maps)\nAutoHost Usage :- mo_no_close_spawns", type = "bool", def = true, section = "ta_options", }, { key = "mo_nowrecks", name = "No Unit Wrecks", desc = "Removes all unit wrecks from the game\nAutoHost Usage :- mo_nowrecks", type = "bool", def = false, section = "ta_options", }, { key = "mo_preventdraw", name = "Commander Ends No Draw", desc = "Last Com alive is immune to comblast, D-gunning the last enemy Com with your last Com disqualifies you\nAutoHost Usage :- mo_preventdraw", type = "bool", def = false, section = "ta_options", }, { key = "mo_startpoint_assist", name = "Startpoint Assist", desc = "Chooses sensible starting places for players/AIs who forgot to choose a startpoint for themselves\nAutoHost Usage :- mo_startpoint_assist", type = "bool", def = false, section = "ta_options", }, { key = "mo_terraforming", name = "Terrain Terraform", desc = "Enable Terraforming map surface\nAutoHost Usage :- mo_terraforming", type = "bool", def = false, section = "ta_options", }, { key = "mo_comtranslock", name = "Locktime for Commanders in Transport's", desc = "Sets time lock for Transport of own Commanders\nAutoHost Usage :- comtranslock", section = "ta_options", type = "number", def = 0, min = 0, max = 25, step = 1, }, { key = "mo_storageowner", name = "Team Storage Owner", desc = "What owns the starting resource storage\nAutoHost Usage :- mo_storageowner", type = "list", def = "team", section = "ta_options", items = { { key = "com", name = "Commander", desc = "Starting resource storage belongs to commander, is lost when commander dies" }, { key = "team", name = "Team", desc = "Starting resource storage belongs to the team, cannot be lost" }, } }, } return options
-- myauth-test-nginx.lua -- nginx wrapper for tests local _M = {} _M.module_name = "myauth-test-nginx" _M.debug_mode = true _M.debug_rbac_info = nil function _M.set_debug_rbac_header(info) _M.debug_rbac_info = info if _M.debug_mode then print(info) end end function _M.set_auth_header(value) if _M.debug_mode then print("Set Authorization header: " .. value) end end function _M.set_claim_header(name, value) if _M.debug_mode then print("Set claim header 'X-Claim-" .. name .. "': " .. value) end end function _M.exit_unauthorized(msg) _M.debug_rbac_info = nil error("Set UNAUTHORIZED: " .. msg); end function _M.exit_forbidden(msg) _M.debug_rbac_info = nil if msg ~=nil then error("Set FORBIDDEN: " .. msg); else error("Set FORBIDDEN: Access denied"); end end function _M.exit_internal_error(code) _M.debug_rbac_info = nil error("Set HTTP_INTERNAL_SERVER_ERROR: " .. code); end return _M;
local e = require "nixio.fs" local e = require "luci.sys" m = Map("passwall") -- [[ Rule Settings ]]-- s = m:section(TypedSection, "global_rules", translate("Rule status")) s.anonymous = true s:append(Template("passwall/rule/rule_version")) --[[ o = s:option(Flag, "adblock", translate("Enable adblock")) o.rmempty = false ]]-- ---- Auto Update o = s:option(Flag, "auto_update", translate("Enable auto update rules")) o.default = 0 o.rmempty = false ---- Week Update o = s:option(ListValue, "week_update", translate("Week update rules")) o:value(7, translate("Every day")) for e = 1, 6 do o:value(e, translate("Week") .. e) end o:value(0, translate("Week") .. translate("day")) o.default = 0 o:depends("auto_update", 1) ---- Time Update o = s:option(ListValue, "time_update", translate("Day update rules")) for e = 0, 23 do o:value(e, e .. translate("oclock")) end o.default = 0 o:depends("auto_update", 1) -- [[ App Settings ]]-- s = m:section(TypedSection, "global_app", translate("App Update"), "<font color='red'>" .. translate("Please confirm that your firmware supports FPU.") .. "</font>") s.anonymous = true s:append(Template("passwall/rule/passwall_version")) s:append(Template("passwall/rule/v2ray_version")) s:append(Template("passwall/rule/kcptun_version")) s:append(Template("passwall/rule/brook_version")) ---- V2ray Path o = s:option(Value, "v2ray_file", translate("V2ray Path"), translate( "if you want to run from memory, change the path, such as /tmp/v2ray/, Then save the application and update it manually.")) o.default = "/usr/bin/v2ray/" o.rmempty = false ---- Kcptun client Path o = s:option(Value, "kcptun_client_file", translate("Kcptun Client Path"), translate( "if you want to run from memory, change the path, such as /tmp/kcptun-client, Then save the application and update it manually.")) o.default = "/usr/bin/kcptun-client" o.rmempty = false --[[ o = s:option(Button, "_check_kcptun", translate("Manually update"), translate("Make sure there is enough space to install Kcptun")) o.template = "passwall/kcptun" o.inputstyle = "apply" o.btnclick = "onBtnClick_kcptun(this);" o.id = "_kcptun-check_btn"]] -- ---- Brook Path o = s:option(Value, "brook_file", translate("Brook Path"), translate( "if you want to run from memory, change the path, such as /tmp/brook, Then save the application and update it manually.")) o.default = "/usr/bin/brook" o.rmempty = false return m
local ffi = require('ffi') local bit = require('bit') local C = ffi.C ffi.cdef [[ // from go.h struct go_state { uint8_t board[24][32]; uint64_t hash; uint8_t size; // max 21, to limit valid positions to 512 uint8_t turn; uint8_t passed; uint8_t scored; int16_t score; // raw score before komi uint16_t bcaps; // black stones captured, not stones captured _by_ black uint16_t wcaps; // ditto }; void go_setup(struct go_state *state, size_t size, size_t hcap, uint16_t *hcaps); bool go_play(struct go_state *state, uint16_t move); bool go_legal(struct go_state *state, uint16_t move); void go_moves(struct go_state *state, uint16_t *moves, size_t *count); void go_moves_loose(struct go_state *state, uint16_t *moves, size_t *count); void go_print(struct go_state *state, void *stream); // from record.h struct game_record { // metadata char *name; char *date; char *black_name; char *black_rank; char *white_name; char *white_rank; char *copyright; // setup parameters char *ruleset; size_t size; size_t handicap; uint16_t *handicaps; float komi; // results char *result; float score; // move sequence size_t num_moves; uint16_t *moves; }; void game_record_free(struct game_record *record); struct game_replay { const struct game_record *record; size_t move_num; struct go_state state; }; void replay_start(struct game_replay *replay, const struct game_record *record); bool replay_step(struct game_replay *replay); // from sgf.h bool sgf_load(struct game_record *record, void *stream, bool verbose); void sgf_dump(struct game_record *record, void *stream); // from features/octant.h uint16_t octant_from_matrix(uint16_t mat_pos, size_t size); uint16_t octant_to_matrix(uint16_t oct_pos, size_t size); ]] kerplunk = {} function kerplunk.go_print(state, ...) local args = {...} local stream if args[0] then stream = args[0] else stream = io.stdout end C.go_print(state, stream) end function kerplunk.new_replay(record) local replay = ffi.new('struct game_replay') C.replay_start(replay, record) return replay end function kerplunk.replay_step(replay) return C.replay_step(replay) end function kerplunk.sgf_load(stream) local record = ffi.new('struct game_record') ffi.gc(record, C.game_record_free) if not C.sgf_load(record, stream, true) then return nil end return record end function kerplunk.sgf_dump(record, stream) C.sgf_dump(record, stream) end function kerplunk.octant_from_matrix(row, col, size) local oct = C.octant_from_matrix(bit.bor(bit.lshift(row, 8), col), size) local octant = bit.band(bit.rshift(oct, 8), 0x7) local height = bit.band(bit.rshift(oct, 4), 0xF) local diaoff = bit.band(oct, 0xF) return octant, height, diaoff end return kerplunk
function onEvent(name, value1, value2) if name == 'Phantom Puppet' then if value1 == '0' then doTweenY('ppoooooppppp', 'poop', -20, 1, 'linear') elseif value1 == '1' then doTweenY('ppoooooppp', 'poop', -220, 1, 'linear') end end end --MatPat event but lol --Scott Cawthon my fav person :> (yes real lol im not lying) --bruh --LUA coding --Is --HURTINF --MY --BRAIN --i thought it was going to be easy --idk --random --shirt --poopet? -- u found this nice one ༼;´༎ຶ ۝ ༎ຶ༽ --ok
return Def.ActorFrame{ OffCommand=function(s) if ddrgame == "max_" then s:stopeffect():sleep(0.2):linear(0.4):zoom(0) end end, Def.Sprite{ Condition=ddrgame == "max_", Texture=THEME:GetPathG("_difficulty","cursor/"..ddrgame.."cursor P1"), InitCommand=function(s) s:diffuse(Alpha(Color.Black,0.5)) end, }; Def.ActorFrame{ InitCommand=function(s) if ddrgame=="max_" then s:xy(-8,-8) end end, ChooseCommand=function(s) if ddrgame=="max_" then s:stopeffect():sleep(0.24):linear(0.2):addx(8):addy(8) end end, LoadActor(THEME:GetPathG("_difficulty","cursor/"..ddrgame.."cursor P1"))..{ OnCommand=cmd(sleep,1.5;queuecommand,"Glow"); GlowCommand=function(s) if ddrgame=="max2_" then s:glowshift():effectcolor1(color("1,1,1,0")):effectcolor2(color("1,1,1,0.75")):effectperiod(0.5) else s:diffuseshift():effectcolor1(color("0.5,0.5,0.5,1")):effectcolor2(color("1,1,1,1")):effectperiod(0.5) end end, OffCommand=function(s) if ddrgame=="max2_" then s:stopeffect():diffusealpha(0) end end, ChooseCommand=function(s) if ddrgame=="max2_" then s:stopeffect():linear(0.166):rotationy(90) end end, }; LoadActor(THEME:GetPathG("_difficulty","cursor/"..ddrgame.."ok P1"))..{ OnCommand=cmd(draworder,20;diffusealpha,0;); OffCommand=function(s) if ddrgame=="max2_" then s:sleep(0.65):decelerate(0.4):addx(609) end end, ChooseCommand=function(s) if ddrgame=="max2_" then s:linear(0):diffusealpha(1):rotationy(90):sleep(0.166):linear(0.166):rotationy(0) else s:zoom(2):linear(0.2):diffusealpha(1):zoom(1) end end, }; }; };
Config = { GridSize = 4, MaxTrains = 12, MinDistance = 500.0, -- Between trains. MaxRetries = 8, Models = { `freight`, `freightcar`, `freightcar2`, `freightcont1`, `freightcont2`, `freightgrain`, `freighttrailer`, `metrotrain`, `tankercar`, }, Fronts = { [`metrotrain`] = true, [`freight`] = true, }, }
-- | capitalize | Makes the first character uppercase, and the rest lowercase return function(text) return text:sub(1, 1):upper() .. text:sub(2):lower() end
-- Tiny JSON Encoder in Pure Lua -- -- @copyright 2020 LiosK -- @license Apache-2.0 local json = { _VERSION = "1.0.1" } function json.encode(value) local encoder = json["encode_" .. type(value)] or json.encode_other return encoder(value) end function json.encode_nil(value) return "null" end function json.encode_boolean(value) return tostring(value) end function json.encode_number(value) if value ~= value or math.abs(value) >= math.huge then error("unsupported number value: " .. tostring(value)) end return tostring(value) end local memo, special_chars = {}, {} for c = 0, 0x1f do special_chars[string.char(c)] = string.format("\\u%04x", c) end special_chars["\b"] = "\\b" special_chars["\f"] = "\\f" special_chars["\n"] = "\\n" special_chars["\r"] = "\\r" special_chars["\t"] = "\\t" special_chars["\""] = "\\\"" special_chars["\\"] = "\\\\" function json.encode_string(value) if memo[value] == nil then memo[value] = '"' .. value:gsub("[\x00-\x1f\"\\]", special_chars) .. '"' end return memo[value] end function json.encode_table(value) if next(value) == nil then return json.encode_empty_table(value) end local i = 1 for _ in pairs(value) do if value[i] == nil then return json.encode_object(value) end i = i + 1 end return json.encode_array(value) end function json.encode_empty_table(value) return "[]" end function json.encode_array(value) local result = {} for k, v in ipairs(value) do table.insert(result, json.encode(v)) end return "[" .. table.concat(result, ",") .. "]" end function json.encode_object(value) local result = {} for k, v in pairs(value) do local str_key = json.encode_string(tostring(k)) table.insert(result, str_key .. ":" .. json.encode(v)) end return "{" .. table.concat(result, ",") .. "}" end function json.encode_other(value) error("unsupported type: " .. type(value)) end return json
data:extend({ { type = "recipe-category", name = "hw-brewery" }, { type = "assembling-machine", name = "hw-brewery", icon = "__homeworld-reloaded__/graphics/icons/brewery.png", icon_size = 32, flags = { "player-creation", "placeable-player" }, minable = { mining_time = 0.3, result = "hw-brewery" }, max_health = 300, corpse = "big-remnants", dying_explosion = "medium-explosion", collision_box = {{-1.4, -1.4}, {1.4, 1.4}}, selection_box = {{-1.5, -1.5}, {1.5, 1.5}}, module_slots = 2, energy_usage = "20kW", crafting_speed = 1, crafting_categories = { "hw-brewery" }, module_specification = { module_slots = 3, }, allowed_effects = {"consumption", "speed", "productivity", "pollution"}, fluid_boxes = { { production_type = "input", pipe_covers = pipecoverspictures(), base_area = 10, base_level = -1, pipe_connections = {{ type="input", position = {-1, -2} }} }, { production_type = "input", pipe_covers = pipecoverspictures(), base_area = 10, base_level = -1, pipe_connections = {{ type="input", position = {1, -2} }} }, { production_type = "output", pipe_covers = pipecoverspictures(), base_level = 1, pipe_connections = {{ position = {-1, 2} }} }, { production_type = "output", pipe_covers = pipecoverspictures(), base_level = 1, pipe_connections = {{ position = {1, 2} }} } }, animation = { north = { filename = "__homeworld-reloaded__/graphics/entity/distillery/distillery.png", width = 156, height = 141, frame_count = 1, shift = {0.5, -0.078125} }, west = { filename = "__homeworld-reloaded__/graphics/entity/distillery/distillery.png", x = 156, width = 156, height = 141, frame_count = 1, shift = {0.5, -0.078125} }, south = { filename = "__homeworld-reloaded__/graphics/entity/distillery/distillery.png", x = 312, width = 156, height = 141, frame_count = 1, shift = {0.5, -0.078125} }, east = { filename = "__homeworld-reloaded__/graphics/entity/distillery/distillery.png", x = 468, width = 156, height = 141, frame_count = 1, shift = {0.5, -0.078125} } }, working_visualisations = { { north_position = {0.94, -0.73}, west_position = {-0.3, 0.02}, south_position = {-0.97, -1.47}, east_position = {0.05, -1.46}, animation = { filename = "__homeworld-reloaded__/graphics/entity/distillery/boiling-green-patch.png", frame_count = 35, width = 17, height = 12, animation_speed = 0.15 } }, { north_position = {1.4, -0.23}, west_position = {-0.3, 0.55}, south_position = {-1, -1}, east_position = {0.05, -0.96}, north_animation = { filename = "__homeworld-reloaded__/graphics/entity/distillery/boiling-window-green-patch.png", frame_count = 1, width = 21, height = 10 }, west_animation = { filename = "__homeworld-reloaded__/graphics/entity/distillery/boiling-window-green-patch.png", x = 21, frame_count = 1, width = 21, height = 10 }, south_animation = { filename = "__homeworld-reloaded__/graphics/entity/distillery/boiling-window-green-patch.png", x = 42, frame_count = 1, width = 21, height = 10 } } }, working_sound = { sound = { { filename = "__base__/sound/chemical-plant.ogg", volume = 0.8 } }, idle_sound = { filename = "__base__/sound/idle1.ogg", volume = 0.6 }, apparent_volume = 1.5, }, energy_source = { type = "electric", usage_priority = "secondary-input", emissions = 0.03 / 3.5 }, }, { type = "item", name = "hw-brewery", icon = "__homeworld-reloaded__/graphics/icons/brewery.png", icon_size = 32, subgroup = "production-machine", place_result = "hw-brewery", order = "c[hw]-z[brewery]", stack_size = 20, }, { type = "recipe", name = "hw-brewery", enabled = false, ingredients = { { "steel-plate", 5 }, { "iron-gear-wheel", 5 }, { "electronic-circuit", 2 }, { "pipe", 5 } }, result = "hw-brewery" }, { type = "item", name = "hw-barrel", icon = "__homeworld-reloaded__/graphics/icons/wood-barrel.png", icon_size = 32, subgroup = "hw-intermediate", order = "hw-c[barrel]", stack_size = 200, }, { type = "recipe", name = "hw-barrel", enabled = false, ingredients = { { "iron-plate", 1 }, { "wood", 2 }, }, result = "hw-barrel" }, { type = "item", name = "hw-beer-barrel", icon = "__homeworld-reloaded__/graphics/icons/beer.png", icon_size = 32, subgroup = "hw-intermediate", order = "hw-d[beer]", stack_size = 200, }, { type = "recipe", name = "hw-beer-barrel", enabled = false, always_show_made_in = true, ingredients = { { type = "fluid", name = "water", amount = 500 }, { "hw-wheat", 10 }, { "hw-hops", 10 }, { "hw-barrel", 1 }, }, energy_required = 10, category = "hw-brewery", result = "hw-beer-barrel" }, { type = "item", name = "hw-wine-barrel", icon = "__homeworld-reloaded__/graphics/icons/wine.png", icon_size = 32, subgroup = "hw-intermediate", order = "hw-g[wine]", stack_size = 200, }, { type = "recipe", name = "hw-wine-barrel", enabled = false, always_show_made_in = true, ingredients = { { type = "fluid", name = "water", amount = 500 }, { "hw-grapes", 20 }, { "hw-barrel", 1 }, }, energy_required = 20, category = "hw-brewery", result = "hw-wine-barrel" }, })
slot2 = "BaseModuleCcsCheckBox" BaseModuleCcsCheckBox = class(slot1) BaseModuleCcsCheckBox.onCreationComplete = function (slot0) slot4 = AbstractSelectedComponent ClassUtil.extends(slot2, slot0) slot0._modelPropertySetter = nil slot0._modelPropertyGetter = nil slot0._modelPropertySignal = nil end BaseModuleCcsCheckBox.bindModelBoolProperty = function (slot0, slot1) slot4 = slot0 slot0.unbindModelBoolProperty(slot3) if slot1 then slot0._modelPropertySignal = slot0.model[slot1 .. "ChangedSignal"] slot6 = slot1 slot0._modelPropertySetter = slot0.model["set" .. StringUtil.upperFirstChar("ChangedSignal")] slot0._modelPropertyGetter = slot0.model["get" .. StringUtil.upperFirstChar(slot1)] if slot0._modelPropertySignal then slot8 = slot0 slot0._modelPropertySignal.add(slot5, slot0._modelPropertySignal, slot0.onModelPropertyChanged) slot6 = slot0 slot0.onModelPropertyChanged(slot5) end end end BaseModuleCcsCheckBox.onClick = function (slot0) if slot0._modelPropertyGetter then slot6 = slot0.model slot4 = not slot0._modelPropertyGetter(slot5) slot0._modelPropertySetter(slot2, slot0.model) end end BaseModuleCcsCheckBox.unbindModelBoolProperty = function (slot0) if slot0._modelPropertySignal then slot5 = slot0 slot0._modelPropertySignal.remove(slot2, slot0._modelPropertySignal, slot0.onModelPropertyChanged) slot0._modelPropertySetter = nil slot0._modelPropertyGetter = nil slot0._modelPropertySignal = nil end end BaseModuleCcsCheckBox.onModelPropertyChanged = function (slot0) slot3 = slot0 slot6 = slot0.model slot0.setIsSelected(slot2, slot0._modelPropertyGetter(slot5)) end BaseModuleCcsCheckBox.onCanTouchChanged = function (slot0) if slot0._canTouch then slot3 = slot0.bgCheckBox ShaderUtil.resetShader(slot2) else slot4 = "GRAY" ShaderUtil.setShaderByName(slot2, slot0.bgCheckBox) end slot3 = slot0 AbstractSelectedComponent.onCanTouchChanged(slot2) end BaseModuleCcsCheckBox.onIsSelectedChanged = function (slot0) slot5 = { autoAlpha = (slot0._isSelected and 1) or 0 } TweenLite.to(slot2, slot0.bgCheckBox.spGou, 0.05) slot3 = slot0 AbstractSelectedComponent.onIsSelectedChanged(slot2) end BaseModuleCcsCheckBox.destroy = function (slot0) slot3 = slot0 slot0.unbindModelBoolProperty(slot2) slot3 = slot0.bgCheckBox.spGou TweenLite.killTweensOf(slot2) slot3 = slot0 AbstractSelectedComponent.destroy(slot2) end return
--- -- @author wesen -- @copyright 2019 wesen <wesen-ac@web.de> -- @release 0.1 -- @license MIT local BaseClientOutput = require("AC-ClientOutput/ClientOutput/BaseClientOutput") local ClientOutputTableRenderer = require("AC-ClientOutput/ClientOutput/ClientOutputTable/ClientOutputTableRenderer") --- -- Represents a output table for the console in the players games. -- -- @type ClientOutputTable -- local ClientOutputTable = {} --- -- The rows inside this table that were parsed from a lua table -- -- @tfield table[] rows -- ClientOutputTable.rows = nil --- -- The renderer for this ClientOutputTable -- -- @tfield ClientOutputTableRenderer renderer -- ClientOutputTable.renderer = nil --- -- The output configuration for specific groups of the table (rows, columns and fields) -- -- @tfield mixed[][] groupConfigurations -- ClientOutputTable.groupConfigurations = nil -- Metamethods --- -- ClientOutputTable constructor. -- This is the __call metamethod. -- -- @tparam SymbolWidthLoader _symbolWidthLoader The symbol width loader -- @tparam TabStopCalculator _tabStopCalculator The tab stop calculator -- @tparam int _maximumLineWidth The maximum line width -- -- @treturn ClientOutputTable The ClientOutputTable instance -- function ClientOutputTable:__construct(_symbolWidthLoader, _tabStopCalculator, _maximumLineWidth) local instance = BaseClientOutput(_symbolWidthLoader, _tabStopCalculator, _maximumLineWidth) setmetatable(instance, {__index = ClientOutputTable}) instance.renderer = ClientOutputTableRenderer(instance) return instance end -- Getters and Setters --- -- Returns the rows of this ClientOutputTable. -- -- @treturn table[] The rows -- function ClientOutputTable:getRows() return self.rows end -- Public Methods --- -- Configures this ClientOutputTable. -- -- @tparam table _configuration The configuration -- function ClientOutputTable:configure(_configuration) BaseClientOutput.configure(self, _configuration) -- Parse the column, row and field configs self.groupConfigurations = {} if (_configuration["rows"]) then self.groupConfigurations["rows"] = _configuration["rows"] end if (_configuration["columns"]) then self.groupConfigurations["columns"] = _configuration["columns"] end if (_configuration["fields"]) then self.groupConfigurations["fields"] = _configuration["fields"] end end --- -- Parses a table. -- The table must be in the format { [y] = { rowFields } }, while a row field may contain a sub table. -- Every row must have the same number of columns. -- -- @tparam table _table The table to parse -- function ClientOutputTable:parse(_table) local ClientOutputFactory = require("AC-ClientOutput/ClientOutputFactory") self.rows = {} for y, row in ipairs(_table) do self.rows[y] = {} if (type(row) ~= "table") then self.rows[y][1] = ClientOutputFactory.getInstance():getClientOutputString(row) self.rows[y][1]:configure(self:getConfigurationForField(y, 1)) else for x, field in ipairs(row) do if (type(field) == "table") then self.rows[y][x] = ClientOutputFactory.getInstance():getClientOutputTable(field) else self.rows[y][x] = ClientOutputFactory.getInstance():getClientOutputString(tostring(field)) end self.rows[y][x]:configure(self:getConfigurationForField(y, x)) end end end end --- -- Returns the number of tabs that this client output's content requires. -- -- @treturn int The number of required tabs -- function ClientOutputTable:getNumberOfRequiredTabs() local numberOfRequiredTabs = 0 for x = 1, self:getNumberOfColumns(), 1 do numberOfRequiredTabs = numberOfRequiredTabs + self:getNumberOfRequiredTabsForColumn(x) end return numberOfRequiredTabs end --- -- Returns the minimum number of tabs that this client output's content requires. -- -- @treturn int The minimum number of required tabs -- function ClientOutputTable:getMinimumNumberOfRequiredTabs() local minimumNumberOfRequiredTabs = 0 for x = 1, self:getNumberOfColumns(), 1 do minimumNumberOfRequiredTabs = minimumNumberOfRequiredTabs + self:getMinimumNumberOfRequiredTabsForColumn(x) end return minimumNumberOfRequiredTabs end --- -- Returns the output rows to display this client output's contents. -- -- @treturn string[] The output rows -- function ClientOutputTable:getOutputRows() return self.renderer:getOutputRows() end --- -- Returns the output rows padded with tabs until a specified tab number. -- -- @tparam int _tabNumber The tab number -- -- @treturn string[] The output rows padded with tabs -- function ClientOutputTable:getOutputRowsPaddedWithTabs(_tabNumber) return self.renderer:getOutputRows(_tabNumber) end --- -- Returns the required number of tabs for a specific column. -- -- @tparam int _columnNumber The column number -- -- @treturn int The required number of tabs for the column -- function ClientOutputTable:getNumberOfRequiredTabsForColumn(_columnNumber) if (_columnNumber > self:getNumberOfColumns()) then return 0 end local numberOfRequiredTabs = 0 for _, row in ipairs(self.rows) do local numberOfRequiredTabsForField = row[_columnNumber]:getNumberOfRequiredTabs() if (numberOfRequiredTabsForField > numberOfRequiredTabs) then numberOfRequiredTabs = numberOfRequiredTabsForField end end return numberOfRequiredTabs end --- -- Returns the minimun required number tabs for a specific column. -- -- @tparam int _columnNumber The column number -- -- @treturn int The minimum required number of tabs for the column -- function ClientOutputTable:getMinimumNumberOfRequiredTabsForColumn(_columnNumber) if (_columnNumber > self:getNumberOfColumns()) then return 0 end local minimumNumberOfRequiredTabs = 0 for _, row in ipairs(self.rows) do local minimumNumberOfRequiredTabsForField = row[_columnNumber]:getMinimumNumberOfRequiredTabs() if (minimumNumberOfRequiredTabsForField > minimumNumberOfRequiredTabs) then minimumNumberOfRequiredTabs = minimumNumberOfRequiredTabsForField end end return minimumNumberOfRequiredTabs end --- -- Returns the number of columns in this table. -- -- @treturn int The number of columns in this table -- function ClientOutputTable:getNumberOfColumns() if (#self.rows == 0) then return 0 else return #self.rows[1] end end -- Private Methods --- -- Returns the client output configuration for a specific table field. -- -- @tparam int _y The y coordinate of the field -- @tparam int _x The x coordinate of the field -- -- @treturn table The client output configuration for the field -- function ClientOutputTable:getConfigurationForField(_y, _x) -- Create a configuration with this ClientOutputTable's own configuration local configuration = { newLineIndent = self.newLineIndent, lineSplitCharacters = self.lineSplitCharacters } -- Check group configurations local allowedGroupValueNames = { "newLineIndent", "lineSplitCharacters" } if (self.groupConfigurations["rows"] and self.groupConfigurations["rows"][_y]) then self:addGroupConfiguration( configuration, self.groupConfigurations["rows"][_y], allowedGroupValueNames ) end if (self.groupConfigurations["columns"] and self.groupConfigurations["columns"][_x]) then self:addGroupConfiguration( configuration, self.groupConfigurations["columns"][_x], allowedGroupValueNames ) end if (self.groupConfigurations["fields"] and self.groupConfigurations["fields"][_y] and self.groupConfigurations["fields"][_y][_x] ) then self:addGroupConfiguration( configuration, self.groupConfigurations["fields"][_y][_x], allowedGroupValueNames ) end return configuration end --- -- Adds the values of a group configuration to a configuration object. -- -- @tparam table _configuration The configuration object -- @tparam table _groupConfiguration The group configuration -- @tparam string[] _valueNames The names of the values to copy into the configuration object -- function ClientOutputTable:addGroupConfiguration(_configuration, _groupConfiguration, _valueNames) for _, valueName in ipairs(_valueNames) do if (_groupConfiguration[valueName] ~= nil) then _configuration[valueName] = _groupConfiguration[valueName] end end end setmetatable( ClientOutputTable, { -- ClientOutputTable inherits methods and attributes from BaseClientOutput __index = BaseClientOutput, -- When ClientOutputTable() is called, call the __construct method __call = ClientOutputTable.__construct } ) return ClientOutputTable
--[[ The MIT License (MIT) Copyright (c) 2019 Loïc Fejoz 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. ]] -- emit the inside of the involute of the circle of radius r for the first two quadrants local r = 10 local h = 3 involute_of_circle = implicit_distance_field(v(-6*r,0,0), v(2*r,4*r,h), [[ uniform float r = 5; float distance(vec3 p) { float l = length(p.xy) - r; float num = p.y + sqrt(p.x * p.x + p.y * p.y - r * r); float denom = r + p.x; float theta = 2 * atan(num, denom); vec2 c = vec2(r * cos(theta), r * sin(theta)); float s = r * theta; float sp = length(p.xy - c); return min(l, sp - s); } ]]) set_uniform_scalar(involute_of_circle, 'r', r) emit(involute_of_circle,2) emit(cylinder(r,h),1)
-- bullet -- created on 2021/8/24 -- author @zoloypzuo local WidgetSimple = require("ui.widget_simple") return WidgetSimple("Bullet")
function gameoverscreeninit() gameovertime = 30 end function gameoverscreenshow() --Flip state booleans gamestate__playstate = false gamestate__gameoverstate = true -- Play the gameover sound if not gamestate__gameoverstategood then sfx(7) end -- reset the player playerpowerreset() --Stop all music playmusic(-1) -- Reset the gameovertime gameovertime = 32 -- save the game saverun() end function gameoverscreenupdate() if gameovertime < 0 then if btn(4) or btn(5) then gamestate__playstate, gamestate__gameoverstate, gamestate__gameoverstategood, gamestate__cash, gamestate__rollingcash, gamestate__runframes, gameovertime = true, false, false, 0, 0, 0, 45 -- init play state, and the map resetplaystate() elseif btn(3) then -- Return to the start screen stateinit() camerainit() mapinit() startscreeninit() storyscreendraw() gameoverscreeninit() playerinit() levelcarinit() end else gameovertime -= 1 -- Play the game over music if gameover time it zero if gameovertime <= 0 and not gamestate__gameoverstategood then playmusic(12) end end end function gameoverscreendraw() rectfill(10, 25, 115, 90, 0 ) if gamestate__gameoverstategood then print("\x87 thanks for playing! \x87", 15, 30, 14) else print("game over", 50, 30, 8) end print("cash collected: $" .. gamestate__rollingcash, 25, 40, 11) if loops <= 0 then if not gamestate__gameoverstategood then print("last level: " .. (getcurrentlevel() - (loops * 12)), 38, 50, 7) end else print("loop " .. loops .. ", level " .. (getcurrentlevel() - (loops * 12)), 34, 50, 7) end print("press \x8E to get dis money", 15, 70, 7); print("press \x83 to go to start", 19, 80, 7); end
Event.on_init(function(event) global.xiuxian = global.xiuxian or {} global.xiuxian.Level = global.xiuxian.Level or {} global.xiuxian.usedAge = global.xiuxian.usedAge or {} global.xiuxian.chenghao = global.xiuxian.chenghao or {} end) --Event.on_load(function(event) -- global.xiuxian = global.xiuxian or {} -- global.xiuxian.Level = global.xiuxian.Level or {} -- global.xiuxian.usedAge = global.xiuxian.usedAge or {} -- -- global.xiuxian.chenghao = global.xiuxian.chenghao or {} -- --end)
----------------------------------- -- Area: Southern San d'Oria -- NPC: Kueh Igunahmori -- Guild Merchant NPC: Leathercrafting Guild -- !pos -194.791 -8.800 13.130 230 ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/conquest"); local ID = require("scripts/zones/Southern_San_dOria/IDs"); ----------------------------------- function onTrade(player,npc,trade) end; function onTrigger(player,npc) if (player:sendGuild(529,3,18,4)) then player:showText(npc,ID.text.KUEH_IGUNAHMORI_DIALOG); end end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) end;
--[[ Vultaic::Addon::PM --]] local function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end local function getPlayerFromID(id) id = tonumber(id) if type(id) ~= "number" then return nil end for _, player in ipairs(getElementsByType("player")) do if getElementData(player, "id") == id then return player end end return nil end addEventHandler("onResourceStart", resourceRoot, function() for _, player in ipairs(getElementsByType("player")) do setElementData(player, "LastPM", nil) end end) function CMD_PM(player, command, givenPlr, ... ) if isPlayerMuted(player) then return outputChatBox("* You can't PM while you are muted", player, 255, 0, 0) end local plr = getPlayerFromID(givenPlr) or getPlayerFromPartialName(tostring(givenPlr)) local text = table.concat({...}, " ") if not plr then return outputChatBox( "#ff0000ERROR :: #ffffffPlayer not found!", player, 255, 255, 255, true ) end if plr == player then return outputChatBox( "#ff0000ERROR :: #ffffffYou can't PM yourself", player, 255, 255, 255, true ) end if exports.v_chat:isPlayerIgnoring(plr, player) then return outputChatBox( "#ff0000ERROR :: #ffffffThe player is ignoring you", player, 255, 255, 255, true ) end if exports.v_chat:isPlayerIgnoring(player, plr) then return outputChatBox( "#ff0000ERROR :: #ffffffYou are ignoring the player", player, 255, 255, 255, true ) end if getElementData(player, "private_messages") == "Off" then return outputChatBox( "#ff0000ERROR :: #ffffffYou have private messages off", player, 255, 255, 255, true ) end if getElementData(plr, "private_messages") == "Off" then return outputChatBox( "#ff0000ERROR :: #ffffffThe player has private messages turned off", player, 255, 255, 255, true ) end if not text or text == "" then return outputChatBox( "#ff0000ERROR :: #ffffffSyntax /PM [player] [message]", player, 255, 255, 255, true ) end outputChatBox("#19846dPM :: #ffffffTo "..getPlayerName(plr).."#ffffff: "..text, player, 255, 255, 255, true) outputChatBox("#19846dPM :: #ffffffFrom "..getPlayerName(player).."#ffffff: "..text, plr, 255, 255, 255, true) outputServerLog("[PM LOGS] :: "..(getPlayerName(player):gsub("#%x%x%x%x%x%x", "")).." PM >> "..(getPlayerName(plr):gsub("#%x%x%x%x%x%x", ""))..": "..text) setElementData(plr, "LastPM", player, false) triggerClientEvent(plr, "PM:notify", plr) end function CMD_Reply(player, command, ...) if isPlayerMuted(player) then return outputChatBox("* You can't PM while you are muted", player, 255, 0, 0) end local lastPM = getElementData(player, "LastPM") if not isElement(lastPM) then return end if exports.v_chat:isPlayerIgnoring(lastPM, player) then return outputChatBox( "#ff0000ERROR :: #ffffffThe player is ignoring you", player, 255, 255, 255, true ) end if exports.v_chat:isPlayerIgnoring(player, lastPM) then return outputChatBox( "#ff0000ERROR :: #ffffffYou are ignoring the player", player, 255, 255, 255, true ) end if getElementData(player, "private_messages") == "Off" then return outputChatBox( "#ff0000ERROR :: #ffffffYou have private messages off", player, 255, 255, 255, true ) end if getElementData(lastPM, "private_messages") == "Off" then return outputChatBox( "#ff0000ERROR :: #ffffffThe player has private messages turned off", player, 255, 255, 255, true ) end local text = table.concat({...}, " ") if not text or text == "" then return end outputChatBox("#19846dPM :: #ffffffTo "..getPlayerName(lastPM).."#ffffff: "..text, player, 255, 255, 255, true) outputChatBox("#19846dPM :: #ffffffFrom "..getPlayerName(player).."#ffffff: "..text, lastPM, 255, 255, 255, true) outputServerLog("[PM LOGS] :: "..(getPlayerName(player):gsub("#%x%x%x%x%x%x", "")).." PM >> "..(getPlayerName(lastPM):gsub("#%x%x%x%x%x%x", ""))..": "..text) setElementData(lastPM, "LastPM", player, false) triggerClientEvent(lastPM, "PM:notify", lastPM) end addCommandHandler("pm", CMD_PM) addCommandHandler("r", CMD_Reply) addCommandHandler("re", CMD_Reply)
local seeker = {} seeker.name = "seeker" seeker.depth = -199 seeker.nodeLineRenderType = "line" seeker.texture = "characters/monsters/predator73" seeker.nodeLimits = {1, -1} seeker.placements = { name = "seeker" } return seeker
Weapon.PrettyName = "FN FAL" Weapon.WeaponID = "m9k_fal" Weapon.DamageMultiplier = 0.8 Weapon.WeaponType = WEAPON_PRIMARY
dofile("common.inc"); dofile("settings.inc"); local stoneCoords = { {0, -20}, {15, -20}, {-15, -20}, {0, -35}, {30, -20}, {-30, -20}, {45, -20}, {-45, -20}, {15, -35}, {-15, -35}, {0, -50}, {30, -35}, {-30, -35}, {45, -35}, {-45, -35}, {15, -50}, {-15, -50}, {30, -50}, {-30, -50}, {45, -50}, {-45, -50}, }; function isStoneAtPixel(x, y) local rgb = pixelRGB(x, y); return math.abs(rgb[1] - rgb[2]) < 4 and math.abs(rgb[1] - rgb[3]) < 4; end function faceNorth() local xyWindowSize = srGetWindowSize(); safeClick(xyWindowSize[0] / 2 - 10, xyWindowSize[1] / 2 + 170); lsSleep(500); safeClick(xyWindowSize[0] / 2 - 10, xyWindowSize[1] / 2 - 100); lsSleep(500); end function drop() srReadScreen(); clickAllImages("veg_janitor/dead.png"); srReadScreen(); clickAllText("Stone ("); srReadScreen(); local windows = findAllText("Stone (", nil, REGION); while not windows do if not lsPrompOkay("Please pin up the windows for all the stones you want to smash, or pickup some more stones to smash if they are all empty.") then error "Macro Cancelled"; end srReadScreen(); clickAllImages("veg_janitor/dead.png"); srReadScreen(); windows = findAllText("Stone (", nil, REGION); end for windowIndex = 1, #windows do local title = findText("Stone (", windows[windowIndex]); if not title then error "Couldn't read title"; end local count = tonumber(string.match(title[2], "(%d+)")); if not count then error "Couldn't read stone count"; end for _ = 1, count do local drop = findText("Drop", windows[windowIndex]); if drop then clickText(drop); local ok = waitForImage("ok2.png", 250, "Waiting for OK button"); if ok then srKeyEvent("1"); lsSleep(100); safeClick(ok[0], ok[1]); waitForNoImage("ok2.png", 250, "Waiting for OK button to hide"); end end end end return #windows > 0 end function findStones() local xyWindowSize = srGetWindowSize(); local centerX = xyWindowSize[0] / 2; local centerY = xyWindowSize[1] / 2 - 35; srReadScreen(); for i = 1, #stoneCoords do local x = centerX + stoneCoords[i][1]; local y = centerY + stoneCoords[i][2]; if isStoneAtPixel(x, y) then return x, y; end end return nil; end function smash() local stoneX, stoneY = findStones(); while stoneX ~= nil do checkBreak(); srSetMousePos(stoneX, stoneY); lsSleep(10); srKeyEvent("s"); sleepWithStatus(4000, "Waiting for animation"); stoneX, stoneY = findStones(); end end function doit() askForWindow([[ Hulk Smash! PICK UP YOUR CATS! They play with dropped stones. This macro will drop all stones you have pinned one at a time, then smash them all! Gravel left behind under the stone pile will also be scooped up, but nothing that moved. Try gather.lua to pickup the resulting mess if you don't have big hands. Hover over the ATITD window and press shift. ]]); setCameraView(CARTOGRAPHER2CAM); lsSleep(1000); faceNorth(); while true do if not drop() then return; end smash(); end end
--- -- @section shop util.AddNetworkString("TTT2CreditTransferUpdate") local function RerollShop(ply) if GetGlobalBool("ttt2_random_team_shops") then ResetRandomShopsForRole(ply:GetSubRole(), GetGlobalInt("ttt2_random_shop_items"), true) else UpdateRandomShops({ply}, GetGlobalInt("ttt2_random_shop_items"), false) end end local function HasPendingOrder(ply) return timer.Exists("give_equipment" .. ply:UniqueID()) end --- -- Called whenever a @{Player} tries to order an @{ITEM} or @{Weapon} -- @param Player ply -- @param string id id of the @{ITEM} or @{Weapon}, old id for @{ITEM} and class for @{Weapon} -- @param boolean is_item is id an @{ITEM} or @{Weapon} -- @return[default=true] boolean return true to allow buying of an equipment item, false to disallow -- @hook -- @realm server function GM:TTTCanOrderEquipment(ply, id, is_item) return true end local function IsPartOfShop(ply, cls) if not GetGlobalBool("ttt2_random_shops") or not RANDOMSHOP[ply] or #RANDOMSHOP[ply] == 0 then return true end for i = 1, #RANDOMSHOP[ply] do if RANDOMSHOP[ply][i].id ~= cls then continue end return true end print(ply, "tried to buy a prohibited item/weapon!") return false end -- Equipment buying local function OrderEquipment(ply, cls) if not IsValid(ply) or not cls or not ply:IsActive() then return end -- if we have a pending order because we are in a confined space, don't -- start a new one if HasPendingOrder(ply) then LANG.Msg(ply, "buy_pending", nil, MSG_MSTACK_ROLE) return end local subrole = GetShopFallback(ply:GetSubRole()) local rd = roles.GetByIndex(subrole) local shopFallback = GetGlobalString("ttt_" .. rd.abbr .. "_shop_fallback") if shopFallback == SHOP_DISABLED then return end local is_item = items.IsItem(cls) -- The item/weapon might not even be part of the current shop if not IsPartOfShop(ply, cls) then return end -- we use weapons.GetStored to save time on an unnecessary copy, we will not be modifying it local equip_table = not is_item and weapons.GetStored(cls) or items.GetStored(cls) if not equip_table then print(ply, "tried to buy equip that doesn't exists", cls) return end -- Check for minimum players, global limit, team limit and player limit local buyable, _, reason = EquipmentIsBuyable(equip_table, ply) if not buyable then if reason then LANG.Msg(ply, reason, nil, MSG_MSTACK_ROLE) end return end -- still support old items local idOrCls = (is_item and equip_table.oldId or nil) or cls local credits = equip_table.credits or 1 if credits > ply:GetCredits() then print(ply, "tried to buy item/weapon, but didn't have enough credits") return end --- -- @note Keep compatibility with old addons -- @realm server if not hook.Run("TTTCanOrderEquipment", ply, idOrCls, is_item) then return end --- -- @note Add our own hook with more consistent class parameter and some more information -- @realm server local allow, ignoreCost, message = hook.Run("TTT2CanOrderEquipment", ply, cls, is_item, credits) if message then LANG.Msg(ply, message, nil, MSG_MSTACK_ROLE) end if allow == false then return end if not ignoreCost then ply:SubtractCredits(credits) end ply:AddBought(cls) -- no longer restricted to only WEAPON_EQUIP weapons, just anything that -- is whitelisted and carryable if is_item then local item = ply:GiveEquipmentItem(cls) if isfunction(item.Bought) then item:Bought(ply) end else ply:GiveEquipmentWeapon(cls, function(p, c, w) if isfunction(w.WasBought) then -- some weapons give extra ammo after being bought, etc w:WasBought(p) end end) end LANG.Msg(ply, "buy_received", nil, MSG_MSTACK_ROLE) timer.Simple(0.5, function() if not IsValid(ply) then return end net.Start("TTT_BoughtItem") net.WriteString(cls) net.Send(ply) end) if GetGlobalBool("ttt2_random_shop_reroll_per_buy") then RerollShop(ply) end --- -- @note Keep compatibility with old addons -- @realm server hook.Run("TTTOrderedEquipment", ply, idOrCls, is_item) --- -- @note Add our own hook with more consistent class parameter -- @realm server hook.Run("TTT2OrderedEquipment", ply, cls, is_item, credits, ignoreCost or false) end local function NetOrderEquipment(len, ply) local cls = net.ReadString() OrderEquipment(ply, cls) end net.Receive("TTT2OrderEquipment", NetOrderEquipment) local function ConCommandOrderEquipment(ply, cmd, args) if #args ~= 1 then return end OrderEquipment(ply, args[1]) end concommand.Add("ttt_order_equipment", ConCommandOrderEquipment) --- -- Called whenever a @{Player} toggles the disguiser state -- @note Can be used to prevent players from using this button. -- @param Player ply -- @param boolean state -- @return boolean return true to prevent using this button. -- @hook -- @realm server function GM:TTTToggleDisguiser(ply, state) end local function CheatCredits(ply) if not IsValid(ply) then return end ply:AddCredits(10) end concommand.Add("ttt_cheat_credits", CheatCredits, nil, nil, FCVAR_CHEAT) --- -- Called to check if a transaction between two players is allowed. -- @param Player sender that wants to send credits -- @param Player recipient that would receive the credits -- @param number credits_per_xfer that would be transferred -- @return[default=nil] boolean which disallows a transaction when false -- @return[default=nil] string for the client which offers info related to the transaction -- @hook -- @realm server function GM:TTT2CanTransferCredits(sender, recipient, credits_per_xfer) end local function TransferCredits(ply, cmd, args) if not IsValid(ply) then return end if #args ~= 2 then return end local sid64 = tostring(args[1]) local credits = tonumber(args[2]) if sid64 == nil or not credits then return end local target = player.GetBySteamID64(sid64) if not IsValid(target) or target == ply then LANG.Msg(ply, "xfer_no_recip", nil, MSG_MSTACK_ROLE) return end if ply:GetCredits() < credits then LANG.Msg(ply, "xfer_no_credits", nil, MSG_MSTACK_ROLE) return end credits = math.Clamp(credits, 0, ply:GetCredits()) if credits == 0 then return end --- -- @realm server local allow, _ = hook.Run("TTT2CanTransferCredits", ply, target, credits) if allow == false then return end ply:SubtractCredits(credits) if target:IsTerror() and target:Alive() then target:AddCredits(credits) else -- The would be recipient is dead, which the sender may not know. -- Instead attempt to send the credits to the target's corpse, where they can be picked up. local rag = target:FindCorpse() if IsValid(rag) then CORPSE.SetCredits(rag, CORPSE.GetCredits(rag, 0) + credits) end end net.Start("TTT2CreditTransferUpdate") net.Send(ply) LANG.Msg(ply, "xfer_success", {player = target:Nick()}, MSG_MSTACK_ROLE) LANG.Msg(target, "xfer_received", {player = ply:Nick(), num = credits}, MSG_MSTACK_ROLE) end concommand.Add("ttt_transfer_credits", TransferCredits) local function RerollShopForCredit(ply, cmd, args) if not IsValid(ply) or not ply:IsActiveShopper() or ply:GetCredits() < GetGlobalInt("ttt2_random_shop_reroll_cost") or not GetGlobalBool("ttt2_random_shop_reroll") then return end ply:SubtractCredits(GetGlobalInt("ttt2_random_shop_reroll_cost")) RerollShop(ply) end concommand.Add("ttt2_reroll_shop", RerollShopForCredit)
function arrayContains(array, value) for _, entry in ipairs(array) do if entry == value then return true end end return false end function arrayMax(array) max = nil for _, entry in ipairs(array) do if not (entry == "none") then if max == nil or entry > max then max = entry; end end end return max end function arrayMin(array) min = nil for _, entry in ipairs(array) do if not (entry == "none") then if min == nil or entry < min then min = entry; end end end return min end function arrayAvg(array) sum = 0 for _, entry in ipairs(array) do if (entry == "none") then sum = sum + entry end end return (sum / #array) end
#!/usr/bin/env tarantool local test = require("sqltester") test:plan(3) -- gh-3231: make sure that there is no redundant OP_Goto at the -- start of VDBE program. In other words OP_Init jumps exactly to -- the next opcode (i.e. opcode with address 1). -- test:do_execsql_test( "explain-1.0", [[ CREATE TABLE t1(id INTEGER PRIMARY KEY, a INT); INSERT INTO t1 VALUES(1, 2), (3, 4), (5, 6); SELECT * FROM t1; ]], { -- <explain-1.0> 1, 2, 3, 4, 5, 6 -- </explain-1.0> }) test:do_test( "explain-1.1", function() local opcodes = test:execsql("EXPLAIN SELECT * FROM t1;") return opcodes[1] end, -- <explain-1.1> 0, 'Init', 0, 1, 0, '', '00', 'Start at 1' -- </explain-1.1> ) test:do_test( "explain-1.2", function() local opcodes = test:execsql("EXPLAIN SELECT a + 1 FROM t1 WHERE id = 4 OR id = 5;") return opcodes[1] end, -- <explain-1.2> 0, 'Init', 0, 1, 0, '', '00', 'Start at 1' -- </explain-1.2> ) test:finish_test()
--------------------------------- -- GLOBAL VARIABLES --------------------------------- local WIDGET_START_X = 0 local WIDGET_START_Y = 0 local WIDGET_START_GAUGEX = WIDGET_START_X + 8 local WIDGET_START_GAUGEY = WIDGET_START_Y + 12 local WIDGET_WIDTH = 34 local WIDGET_HEIGHT = 27 local OFFSET = (WIDGET_WIDTH - 4) / 5 -- one spacing between each bar + 2px offset on each side local BAR_WIDTH = OFFSET - 1 local function layout() lcd.drawFilledRectangle(WIDGET_START_X, WIDGET_START_Y, WIDGET_WIDTH, WIDGET_HEIGHT, ERASE) lcd.drawRectangle(WIDGET_START_X, WIDGET_START_Y, WIDGET_WIDTH, WIDGET_HEIGHT) end local function redraw(rssi, rssiPercent) lcd.drawNumber(WIDGET_START_GAUGEX, WIDGET_START_Y + 3, rssi, SMLSIZE) lcd.drawText(WIDGET_START_GAUGEX + 10, WIDGET_START_Y + 3, "db", SMLSIZE) for i = 0,4 do if (rssiPercent >= 20 * i and rssiPercent > 10) then lcd.drawFilledRectangle(WIDGET_START_X + 2 + OFFSET * i, WIDGET_START_Y + 10 + 15 * (4 - i) / 5, BAR_WIDTH, 15 * (i + 1) / 5) else lcd.drawRectangle(WIDGET_START_X + 2 + OFFSET * i, WIDGET_START_Y + 10 + 15 * (4 - i) / 5, BAR_WIDTH, 15 * (i + 1) / 5) end end if rssiPercent < 20 then lcd.drawText(WIDGET_START_X + WIDGET_WIDTH / 2 + 2, WIDGET_START_Y + 19, "low", SMLSIZE + INVERS) end end return { layout = layout, redraw = redraw }
local vector = require 'vector' local luaunit = require('luaunit') TestConstruct = {} function TestConstruct:testEmptyVector() luaunit.assertEquals(tostring(vector:new()), "{nil}") end function TestConstruct:test1LengthVector() luaunit.assertEquals(tostring(vector:new(1)), "{1}") end function TestConstruct:test2LengthVector() luaunit.assertEquals(tostring(vector:new(1, 2)), "{1,2}") end function TestConstruct:test3LengthVector() luaunit.assertEquals(tostring(vector:new(1, 2, 3)), "{1,2,3}") end function TestConstruct:test4LengthVector() luaunit.assertEquals(tostring(vector:new(1, 2, 3, 4)), "{1,2,3,4}") end TestAdd = {} function TestAdd:testNil() luaunit.assertEquals(tostring(vector:new() + vector:new()), "{nil}") end function TestAdd:testFull() luaunit.assertEquals(tostring(vector:new(1,1,1,1) + vector:new(1,2,3,4)), tostring(vector:new(2,3,4,5))) end function TestAdd:testMixed() luaunit.assertEquals(tostring(vector:new(1,1) + vector:new(1,2,3,4)), tostring(vector:new(2,3,3,4))) end function TestAdd:testShort() luaunit.assertEquals(tostring(vector:new(1,1) + vector:new(1)), tostring(vector:new(2,1))) end TestSub = {} function TestSub:testNil() luaunit.assertEquals(tostring(vector:new() - vector:new()), "{nil}") end function TestSub:testFull() luaunit.assertEquals(tostring(vector:new(1,1,1,1) - vector:new(1,2,3,4)), tostring(vector:new(0,-1,-2,-3))) end function TestSub:testMixed() luaunit.assertEquals(tostring(vector:new(1,1) - vector:new(1,2,3,4)), tostring(vector:new(0,-1,3,4))) end function TestSub:testShort() luaunit.assertEquals(tostring(vector:new(1,1) - vector:new(1)), tostring(vector:new(0,1))) end TestMult = {} function TestMult:testNil() luaunit.assertEquals(tostring(vector:new() * 7), "{nil}") end function TestMult:testFull() luaunit.assertEquals(tostring(2 * vector:new(1,2,3,4)), tostring(vector:new(2,4,6,8))) end os.exit( luaunit.LuaUnit.run() )
--[[ Copyright 2019 Manticore Games, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --]] --[[ Named locations enable a map to feature volumes with set names, and other components to know the name of the location where the player is (usually just to display it on screen). Locations are described by the following properties: { string name The name of the location Color textColor Color UI text should be Color backgroundColor Color UI background should be } Named locations are a purely client-side concept. Locations must broadcast the following events: LocationEntered(Player player, table locationProperties) LocationExited(Player player, table locationProperties) --]] local API = {} -- nil RegisterLocation(table, Trigger) [Client] -- Called once by each location at startup to register itself function API.RegisterLocation(properties, triggerVolume) -- Generate the table if it doesn't exist if not _G.APIRegisteredLocations then _G.APIRegisteredLocations = {} end _G.APIRegisteredLocations[triggerVolume] = properties end -- string GetPlayerLocation(Player) [Client] -- Returns the properties of the location where the player is or nil function API.GetPlayerLocation(player) if not _G.APIRegisteredLocations then return nil end for triggerVolume, properties in pairs(_G.APIRegisteredLocations) do if triggerVolume:IsOverlapping(player) then return properties end end return nil end return API
AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent. include('shared.lua') function ENT:UpdateTransmitState() return TRANSMIT_ALWAYS end
-- Copyright 2021 SmartThings -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. local capabilities = require "st.capabilities" --- @type st.zwave.defaults local defaults = require "st.zwave.defaults" --- @type st.zwave.Driver local ZwaveDriver = require "st.zwave.driver" local update_preferences = require "update_preferences" --- Map component to end_points(channels) --- --- @param device st.zwave.Device --- @param component_id string ID --- @return table dst_channels destination channels e.g. {2} for Z-Wave channel 2 or {} for unencapsulated local function component_to_endpoint(device, component_id) local ep_num = component_id:match("switch(%d)") return { ep_num and tonumber(ep_num) } end --- Map end_point(channel) to Z-Wave endpoint 9 channel) --- --- @param device st.zwave.Device --- @param ep number the endpoint(Z-Wave channel) ID to find the component for --- @return string the component ID the endpoint matches to local function endpoint_to_component(device, ep) local switch_comp = string.format("switch%d", ep) if device.profile.components[switch_comp] ~= nil then return switch_comp else return "main" end end --- Initialize device --- --- @param self st.zwave.Driver --- @param device st.zwave.Device local device_init = function(self, device) device:set_component_to_endpoint_fn(component_to_endpoint) device:set_endpoint_to_component_fn(endpoint_to_component) end --- @param driver st.zwave.Driver --- @param device st.zwave.Device local function info_changed(driver, device, event, args) update_preferences(driver, device, args) end local function device_added(driver, device) device:refresh() end ------------------------------------------------------------------------------------------- -- Register message handlers and run driver ------------------------------------------------------------------------------------------- local driver_template = { supported_capabilities = { capabilities.switch, capabilities.button, capabilities.refresh, }, capability_handlers = { --[[ [capabilities.refresh.ID] = { [capabilities.refresh.commands.refresh.NAME] = refresh_handler, }, --]] }, sub_drivers = { require("zen51-dry-contact-relay") }, lifecycle_handlers = { init = device_init, infoChanged = info_changed, added = device_added } } defaults.register_for_default_handlers(driver_template, driver_template.supported_capabilities) --- @type st.zwave.Driver local switch = ZwaveDriver("zwave_switch", driver_template) switch:run()
client_script { 'blips.lua' }
--------------------------------------------------------------------------- -- -- This file is part of the Corona game engine. -- For overview and more information on licensing please refer to README.md -- Home page: https://github.com/coronalabs/corona -- Contact: support@coronalabs.com -- ------------------------------------------------------------------------------ local pluginCollector = require "CoronaBuilderPluginCollector" processExecute = processExecute or os.execute local lfs = require("lfs") local json = require("json") local http = require("socket.http") local ltn12 = require("ltn12") debugBuildProcess = 0 local dirSeparator = package.config:sub(1,1) local buildSettings = nil local sFormat = string.format local linuxBuilderPrefx = "Linux Builder:" local windows = (dirSeparator == '\\') -- check if /usr/bin/tar exists, it is in Mac but not in Linux local tar = "/usr/bin/tar" if (isFile(tar) == false) then tar = "tar" -- for linux end local function printf(msg, ...) luaPrint(msg:format(...)) end local function log(...) luaPrint(...) end local function log3(...) if (debugBuildProcess >= 3) then luaPrint(...) end end local function quoteString(str) str = str:gsub('\\', '\\\\') str = str:gsub('"', '\\"') return sFormat("\"%s\"", str) end local function pathJoin(p1, p2, ... ) local res local p1s = p1:sub(-1) == dirSeparator local p2s = p2:sub(1, 1) == dirSeparator if (p1s and p2s) then res = p1:sub(1,-2) .. p2 elseif (p1s or p2s) then res = p1 .. p2 else res = p1 .. dirSeparator .. p2 end if ... then return pathJoin(res, ...) else return res end end local function extractTar(archive, dst) mkdirs(dst) local cmd = tar .. ' -xzf ' .. quoteString(archive) .. ' -C ' .. quoteString(dst .. dirSeparator) -- printf("extract tar cmd: %s", cmd) return os.execute(cmd) end local function gzip( path, appname, ext, destFile ) local dst = pathJoin(path, destFile) if windows then local src = '' for i = 1, #ext do src = src .. '"' .. pathJoin(path, appname .. ext[i]) .. '"' src = src .. ' ' end local cmd = '""%CORONA_PATH%\\7za.exe" a -tzip "' .. dst .. '" ' .. src processExecute(cmd); else local src = '' for i = 1, #ext do src = src .. appname .. ext[i] src = src .. ' ' end local cmd = 'cd '.. quoteString(path) .. ' && /usr/bin/zip "' .. dst .. '" ' .. src os.execute(cmd) end -- delete source files for i = 1, #ext do os.remove(pathJoin(path, appname .. ext[i])) end end local function zip( folder, zipfile ) if windows then local cmd = '""%CORONA_PATH%\\7za.exe" a ' .. zipfile .. ' ' .. folder .. '/*"' return processExecute(cmd) else local cmd = 'cd '.. folder .. ' && /usr/bin/zip -r -X ' .. zipfile .. ' ' .. '*' return os.execute(cmd) end end local function unzip( archive, dst ) if windows then local cmd = '""%CORONA_PATH%\\7za.exe" x -aoa "' .. archive .. '" -o"' .. dst .. '"' return processExecute(cmd) else return os.execute('/usr/bin/unzip -o -q ' .. quoteString(archive) .. ' -d ' .. quoteString(dst)) end end local function createTarGZ(srcDir, tarFile, tarGZFile) log('crerating', tarGZFile) local cmd = 'cd '.. quoteString(srcDir) .. ' && ' .. tar .. ' --exclude=' .. tarGZFile .. ' -czf ' .. tarGZFile .. ' .' log3('createTarGZ:', cmd) return os.execute(cmd) end local function setControlParams(args, localTmpDir) local path = pathJoin(localTmpDir, 'DEBIAN', 'control') local f = io.open(path, "rb") if (f) then local s = f:read("*a") io.close(f) local count s, count = s:gsub('@package', args.applicationName, 1) s, count = s:gsub('@version', args.versionName, 1) s, count = s:gsub('@size', '10000', 1) -- fixme s, count = s:gsub('@maintainer', 'Corona Labs corp. <support@coronalabs.com>', 1) s, count = s:gsub('@description', 'This is my app', 1) s = s .. ' ' .. 'description1\n' s = s .. ' ' .. 'description2\n' s = s .. ' ' .. 'description3\n' f = io.open(path, "wb") if (f) then f:write(s) io.close(f) end end end -- create deb file local function createDebArchive(debFile, srcDir) local fi = io.open(pathJoin(srcDir, debFile), "wb") if (fi) then fi:write('!<arch>\n') fi:write('debian-binary 1410122664 0 0 100644 4 `\n') fi:write('2.0\n') -- add control.tar.gz local path = pathJoin(srcDir, 'DEBIAN', 'control.tar.gz') local f = io.open(path, "rb") if (f) then local filesize = f:seek("end") local s = sFormat('%d', filesize) while s:len() < 10 do s = s .. ' ' end fi:write('control.tar.gz 1410122664 0 0 100644 ' .. s .. '`\n') f:seek("set", 0) local buf = f:read("*a") fi:write(buf) if ((filesize % 2) ~= 0) then fi:write('\n') end f:close() end -- add data.tar.gz local path = pathJoin(srcDir, 'CONTENTS', 'data.tar.gz') local f = io.open(path, "rb") if (f) then local filesize = f:seek("end") local s = sFormat('%d', filesize) while s:len() < 10 do s = s .. ' ' end fi:write('data.tar.gz 1410122664 0 0 100644 ' .. s .. '`\n') f:seek("set", 0) local buf = f:read("*a") fi:write(buf) if (filesize % 2) ~= 0 then fi:write('\n') end f:close() end fi:close() end end local function copyFile(src, dst) local fi = io.open(src, "rb") if (fi) then local buf = fi:read("*a") fi:close() fi = io.open(dst, "wb") if (fi) then fi:write(buf) fi:close() return true end log3('copyFile failed to write: ', src, dst) return false end log3('copyFile failed to read: ', src, dst) return false; end local function copyFiles(srcFolder, dstFolder) for file in lfs.dir(srcFolder) do if (file ~= "." and file ~= "..") then fullPath = pathJoin(srcFolder, file) attributes = lfs.attributes(fullPath) if (attributes) then if (attributes.mode == "file") then copyFile(fullPath, pathJoin(dstFolder, file)) end end end end end local function copyDir( src, dst ) if windows then local cmd = 'robocopy "' .. src .. '" ' .. '"' .. dst.. '" /e 2> nul' return processExecute(cmd)>7 and 1 or 0 else local cmd = 'cp -R ' .. quoteString(src) .. '/. ' .. quoteString(dst) return os.execute(cmd) end end local function removeDir( dir ) if windows then local cmd = 'rmdir /s/q "' .. dir .. '"' return processExecute(cmd) else os.execute("rm -f -r " .. quoteString(dir)) end end local function loadTable(path) local loc = location if not location then loc = defaultLocation end local file, errorString = io.open(path, "r") if not file then return {} else local contents = file:read("*a") local t = json.decode(contents) io.close(file) return t end end local function saveTable(t, path) local loc = location if not location then loc = defaultLocation end local file, errorString = io.open(path, "w") if not file then print("File error: " .. errorString) return false else file:write(json.encode(t)) io.close(file) return true end end local function linuxDownloadPlugins(buildRevision, tmpDir, pluginDstDir, platform) if type(buildSettings) ~= 'table' then -- no build.settings file, so no plugins to download return nil end local collectorParams = { pluginPlatform = 'linux', plugins = buildSettings.plugins or {}, destinationDirectory = tmpDir, build = buildRevision, extractLocation = pluginDstDir, pluginStorage = pathJoin(os.getenv("HOME"), ".Solar2D") } return pluginCollector.collect(collectorParams) end local function getExcludePredecate() local excludes = { ".@(!(.|))", -- hidden files/folders "(.lu)$", -- lu files "(.lua)$", -- lua files "build.settings", -- build.settings "**.storyboardc", -- storyboard assets "**.xcassets", -- xcode assets "**AndroidResources", -- android resources "(.icns)$", -- ico files "(.ico)$", -- icns files "Icon.png", -- project icon "Icon-xxxhdpi.png", -- android icons "Icon-xxhdpi.png", -- android icons "Icon-xhdpi.png", -- android icons "Icon-hdpi.png", -- android icons "Icon-mdpi.png", -- android icons "Icon-ldpi.png", -- android icons "Banner-xhdpi.png", -- android tv banner } -- append 'all:' and 'linux:' if (buildSettings and buildSettings.excludeFiles) then if (buildSettings.excludeFiles.all) then -- append excludes from 'all:' local excl = buildSettings.excludeFiles.all for i = 1, #excl do excludes[#excludes + 1] = excl[i] end end if (buildSettings.excludeFiles.linux) then -- append excludes from 'linux:' local excl = buildSettings.excludeFiles.linux for i = 1, #excl do excludes[#excludes + 1] = excl[i] end end end return function(fileName) for i = 1, #excludes do local rc = fileName:match(excludes[i]) if (rc ~= nil) then return true end end return false end end local function deleteUnusedFiles(srcDir, excludePredicate) local paths = {srcDir} local count = 0 local dirCount = 0 local fileList = {} local directoryList = {} local function scanFoldersRecursively(event) if (#paths == 0) then paths = nil for i = 1, #fileList do local file = fileList[i] if (excludePredicate(file)) then local result, reason = os.remove(file) if (result) then --printf("removed file at %s", file) else printf("! couldn't remove file at %s", file) end end end for i = 1, #directoryList do local dir = directoryList[i] if (excludePredicate(dir)) then --printf("removing directory: %s", dir) removeDir(dir) end end fileList = nil directoryList = nil return end local fullPath = nil local attributes = nil for file in lfs.dir(paths[1]) do if (file ~= "." and file ~= "..") then fullPath = sFormat("%s/%s", paths[1], file) attributes = lfs.attributes(fullPath) if (attributes) then if (attributes.mode == "directory") then --print("file: " .. file .. " is directory") table.insert(paths, fullPath) dirCount = dirCount + 1 directoryList[dirCount] = fullPath elseif (attributes.mode == "file") then count = count + 1 fileList[count] = fullPath end end end end table.remove(paths, 1) scanFoldersRecursively() end scanFoldersRecursively() end local function getPathFromString(str) local pathIndexes = {} for i = 1, #str do if (str:sub(i, i) == dirSeparator) then pathIndexes[#pathIndexes + 1] = i end end return string.sub(str, 1, pathIndexes[#pathIndexes]) end local function getLastPathComponent(str) local pathIndexes = {} for i = 1, #str do if (str:sub(i, i) == dirSeparator) then pathIndexes[#pathIndexes + 1] = i end end return string.sub(str, pathIndexes[#pathIndexes] + 1) end local function makeApp(arch, linuxAppFolder, template, args, templateName) -- sanity check local archivesize = lfs.attributes(template, "size") local templatePath = getPathFromString(template) if (archivesize == nil or archivesize == 0) then return sFormat('%s failed to open template: %s', linuxBuilderPrefx, template) end local ret = extractTar(template, linuxAppFolder) if (ret ~= 0) then return sFormat('%s failed to unpack template %s to %s - error: %s', linuxBuilderPrefx, template, linuxAppFolder, ret) end printf('%s extractTar %s to %s', linuxBuilderPrefx, template, linuxAppFolder) -- copy binary local binaryPath = pathJoin(linuxAppFolder, "Solar2D") printf("%s Renaming binary to %s", linuxBuilderPrefx, args.applicationName) os.rename(binaryPath, sFormat("%s/%s", linuxAppFolder , args.applicationName)) -- gather files into appFolder/Resources local resourcesFolder = pathJoin(linuxAppFolder, "Resources") mkdirs(resourcesFolder) local pluginDownloadDir = pathJoin(args.tmpDir, "pluginDownloadDir") local pluginExtractDir = pathJoin(args.tmpDir, "Plugins") local binPlugnDir = pathJoin(pluginExtractDir, arch) local luaPluginDir = pathJoin(pluginExtractDir, 'lua', 'lua_51') if (isDir(luaPluginDir)) then copyDir(luaPluginDir, resourcesFolder) end if (isDir(binPlugnDir)) then copyDir(binPlugnDir, linuxAppFolder) end ret = copyDir(args.srcDir, resourcesFolder) if (ret ~= 0) then return sFormat("%s Failed to copy %s to %s", linuxBuilderPrefx, args.srcDir, resourcesFolder) end printf(sFormat("%s Copied app files from %s to %s", linuxBuilderPrefx, args.srcDir, resourcesFolder)) -- compile .lua local rc = compileScriptsAndMakeCAR(args.linuxParams, resourcesFolder, resourcesFolder, resourcesFolder) if (not rc) then return sFormat("%s failed to create resource.car file", linuxBuilderPrefx) end printf("%s created resource.car", linuxBuilderPrefx) -- copy default font local defaultFontPath = sFormat("%s/%s", templatePath, "FreeSans.ttf") copyFile(defaultFontPath, pathJoin(resourcesFolder, "FreeSans.ttf")) -- copy standard resources if (args.useWidgetResources) then for file in lfs.dir(templatePath) do if (file ~= "." and file ~= "..") then if (file:find("widget_")) then copyFile(pathJoin(templatePath, file), pathJoin(resourcesFolder, file)) end end end printf("%s copied widget resources", linuxBuilderPrefx) end -- delete unused files deleteUnusedFiles(resourcesFolder, getExcludePredecate()) -- remove plugin dirs removeDir(pluginDownloadDir) removeDir(pluginExtractDir) -- remove empty folders --fixme os.execute(sFormat('find "%s" -type d -empty -delete', linuxAppFolder)) end -- global script to call from C++ function linuxPackageApp(args) debugBuildProcess = tonumber(args.debugBuildProcess) or 0 log('Linux builder started') log3(json.prettify(args)) local template = args.templateLocation if template == nil and args.onlyGetPlugins == false then return 'No templateLocation' end -- read settings local buildSettingsFile = pathJoin(args.srcDir, 'build.settings') local oldSettings = _G['settings'] _G['settings'] = nil pcall( function() dofile(buildSettingsFile) end ) buildSettings = _G['settings'] _G['settings'] = oldSettings local success = false; -- dowmload plugins local pluginsFolder = pathJoin(args.tmpDir, "Plugins") mkdirs(pluginsFolder) local pluginDownloadDir = pathJoin(args.tmpDir, "pluginDownloadDir") mkdirs(pluginDownloadDir) local msg = linuxDownloadPlugins(args.buildRevision, pluginDownloadDir, pluginsFolder) if type(msg) == 'string' then return msg end if (args.onlyGetPlugins) then local simulatorPluginsFolder = pathJoin(os.getenv("HOME"), ".Solar2D", "Plugins") local binPlugnDir = pathJoin(pluginsFolder, 'x86-64') local luaPluginDir = pathJoin(pluginsFolder, 'lua', 'lua_51') if (isDir(binPlugnDir)) then copyDir(binPlugnDir, simulatorPluginsFolder) end if (isDir(luaPluginDir)) then copyDir(luaPluginDir, simulatorPluginsFolder) end return msg else local startTime = os.time() -- create app folder local linuxAppFolder = pathJoin(args.dstDir, args.applicationName) .. '.Linux' if isDir(linuxAppFolder) then removeDir(linuxAppFolder) log("Deleting existing directory " .. linuxAppFolder) end mkdirs(linuxAppFolder) printf("%s App folder %s", linuxBuilderPrefx, linuxAppFolder) local templateFilename = getLastPathComponent(template); log3('templateFilename: ' .. templateFilename) local rc = makeApp('x86-64', linuxAppFolder, template, args, templateFilename:sub(1, templateFilename:len() - 4)) if (rc ~= nil) then return rc end printf("%s build finished in %s seconds", linuxBuilderPrefx, os.difftime(os.time(), startTime)) end log('Linux builder ended') return nil end
-- for backwards compatibility return require "openssl.pkey"
--Copyright © 2020, Lili --All rights reserved. --Redistribution and use in source and binary forms, with or without --modification, are permitted provided that the following conditions are met: -- * Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of position_manager nor the -- names of its contributors may be used to endorse or promote products -- derived from this software without specific prior written permission. --THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND --ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED --WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE --DISCLAIMED. IN NO EVENT SHALL Lili BE LIABLE FOR ANY --DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES --(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; --LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND --ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. _addon.name = 'position_manager' _addon.author = 'Lili' _addon.version = '1.1.2' _addon.command = 'pm' if not windower.file_exists(windower.windower_path .. '\\plugins\\WinControl.dll') then print('position_manager: error - Please install the WinControl plugin in the launcher.') windower.send_command('lua u position_manager') return else print('position_manager: loading WinControl...') windower.send_command('load wincontrol') end config = require('config') default = { x = 0, y = 0, delay = 0, } settings = config.load(default) function move(settings) if settings.delay > 0 then coroutine.sleep(settings.delay) end windower.send_command('wincontrol move %s %s':format(settings.x, settings.y)) end function show_help() windower.add_to_chat(207, 'position_manager: Commands:') windower.add_to_chat(207, ' //pm set <x> <y> [name]') windower.add_to_chat(207, ' //pm set delay <seconds> [name]') windower.add_to_chat(207, 'position_manager: See the readme for details.') end function handle_commands(cmd, ...) cmd = cmd or cmd:lower() if cmd == 'r' then windower.send_command('lua r position_manager') return elseif cmd == 'set' then local arg = {...} local name = arg[3] local err = false if name ~= nil and name:find('[%A]') then err = 'invalid name provided' elseif not name then name = windower.ffxi.get_player().name elseif name == ':all' then name = 'all' end if arg[1] == 'delay' then settings.delay = tonumber(arg[2]) if settings.delay > 0 then config.save(settings, name) windower.add_to_chat(207, 'position_manager: Delay set to %s for %s.':format(settings.delay, name)) return -- don't move window if we just set delay. else err = 'invalid delay provided' end elseif arg[1] and arg[2] then settings.x = tonumber(arg[1]) settings.y = tonumber(arg[2]) if settings.x and settings.y then config.save(settings, name) windower.add_to_chat(207, 'position_manager: Position set to %s, %s for %s.':format(settings.x, settings.y, name)) else err = 'invalid position provided.' end else err = 'invalid arguments provided.' end if err then windower.add_to_chat(207, 'position_manager: ERROR - %s.':format(err)) show_help() else if windower.ffxi.get_info().logged_in then player_name = windower.ffxi.get_player().name if name:lower() == player_name:lower() then move(settings) end end end -- TODO: possibly add IPC return elseif cmd ~= 'help' then windower.add_to_chat(207, 'position_manager: %s command not found.':format(cmd)) end show_help() end config.register(settings, move) windower.register_event('addon command', handle_commands)
require('stdlib.handle.__all') require('abilities') require('stdlib.hookutils') require('unitevents.generic') --- Returns the difference between two points. function math.distance(x0, y0, x, y) local deltaX,deltaY = x-x0,y-y0 return math.sqrt(deltaX*deltaX + deltaY*deltaY) end stdlib = {} function stdlib.DO_NOTHING() end
--- Microexpansion network -- @type network -- @field #table controller_pos the position of the controller -- @field #number power_load the power currently provided to the network -- @field #number power_storage the power that can be stored for the next tick local network = { power_load = 0, power_storage = 0 } microexpansion.network = network --- construct a new network -- @function [parent=#network] new -- @param #table o the object to become a network or nil function network:new(o) local n = setmetatable(o or {}, {__index = self}) o.machines = {} return o end --- check if a node can be connected -- @function [parent=#network] can_connect -- @param #table pos the position of the node to be checked -- @return #boolean whether this node has the group me_connect function network.can_connect(pos) local node = me.get_node(pos) return minetest.get_item_group(node.name, "me_connect") > 0 end --- get all adjacent connected nodes -- @function [parent=#network] adjacent_connected_nodes -- @param #table pos the position of the base node -- @param #boolean include_ctrl whether to check for the controller -- @return #table all nodes that have the group me_connect function network.adjacent_connected_nodes(pos, include_ctrl) local adjacent = { {x=pos.x+1, y=pos.y, z=pos.z}, {x=pos.x-1, y=pos.y, z=pos.z}, {x=pos.x, y=pos.y+1, z=pos.z}, {x=pos.x, y=pos.y-1, z=pos.z}, {x=pos.x, y=pos.y, z=pos.z+1}, {x=pos.x, y=pos.y, z=pos.z-1}, } local nodes = {} for _,pos in pairs(adjacent) do if network.can_connect(pos) then if include_ctrl == false then if not me.get_node(pos).name == "microexpansion:ctrl" then table.insert(nodes, pos) end else table.insert(nodes, pos) end end end return nodes end --- provide power to the network -- @function [parent=#network] provide -- @param #number power the amount of power provided function network:provide(power) self.power_load = self.power_load + power end --- demand power from the network -- @function [parent=#network] demand -- @param #number power the amount of power demanded -- @return #boolean whether the power was provided function network:demand(power) if self.power_load - power < 0 then return false end self.power_load = self.power_load - power return true end --- add power capacity to the network -- @function [parent=#network] add_power_capacity -- @param #number power the amount of power that can be stored function network:add_power_capacity(power) self.power_storage = self.power_storage + power end --- add power capacity to the network -- @function [parent=#network] add_power_capacity -- @param #number power the amount of power that can't be stored anymore function network:remove_power_capacity(power) self.power_storage = self.power_storage - power if self.power_storage < 0 then minetest.log("warning","[Microexpansion] power storage of network "..self.." dropped below zero") end end --- remove overload -- to be called by the controller every turn -- @function [parent=#network] remove_overload function network:remove_overload() self.power_load = math.min(self.power_load, self.power_storage) end
----------------------------------- -- Area: Port San d'Oria -- NPC: Cherlodeau -- Involved in Quest: Lure of the Wildcat (San d'Oria) -- !pos -20 -4 -69 232 ----------------------------------- require("scripts/globals/quests") ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) local WildcatSandy = player:getCharVar("WildcatSandy") if (player:getQuestStatus(SANDORIA, tpz.quest.id.sandoria.LURE_OF_THE_WILDCAT) == QUEST_ACCEPTED and player:getMaskBit(WildcatSandy, 12) == false) then player:startEvent(748) else player:startEvent(590) end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) if (csid == 748) then player:setMaskBit(player:getCharVar("WildcatSandy"), "WildcatSandy", 12, true) end end
ESX = nil TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) TriggerEvent('es:addGroupCommand', 'blip', 'admin', function(source, args, user) TriggerClientEvent('esx_jb_radars:ShowRadarBlip', source) end) TriggerEvent('es:addGroupCommand', 'rmblip', 'admin', function(source, args, user) TriggerClientEvent('esx_jb_radars:RemoveRadarBlip', source) end) TriggerEvent('es:addGroupCommand', 'radar', 'admin', function(source, args, user) TriggerClientEvent('esx_jb_radars:ShowRadarProp', -1) end) ESX.RegisterServerCallback('jb_radars:checkvehicle',function(source,cb, vehicleProps) local isFound = false local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local vehicules = getPlayerVehicles(xPlayer.getIdentifier()) local plate = vehicleProps.plate for _,v in pairs(vehicules) do if(plate == v.plate)then isFound = true break end end cb(isFound) end) RegisterServerEvent('esx_jb_radars:PayFine') AddEventHandler('esx_jb_radars:PayFine', function (source, plate, kmhspeed, maxspeed, amount) local shortplate = string.sub(plate, 0,4) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) MySQL.Async.fetchAll( 'SELECT * FROM owned_vehicles', {}, function (result) for i=1, #result, 1 do local vehicleProps = json.decode(result[i].vehicle) if vehicleProps.plate == plate then identifier = result[i].owner MySQL.Async.execute( 'INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (@identifier, @sender, @target_type, @target, @label, @amount)', { ['@identifier'] = identifier, ['@sender'] = "Radar fixe", ['@target_type'] = 'society', ['@target'] = 'society_police', --['@label'] = "plaque "..plate..", "..kmhspeed.."km/h a la place de "..maxspeed, ['@amount'] = amount }, function(rowsChanged) TriggerClientEvent('esx:showNotification', _source, "Votre voiture a été flashée.") end ) break elseif shortplate == "TAXI" or shortplate == "AMBU" or shortplate == "FISH" or shortplate == "POLI" or shortplate == "MECA" or shortplate == "FUEL" or shortplate == "BUCH" or shortplate == "MINE" or shortplate == "JOUR" or shortplate == "ABAT" or shortplate == "COUT" or shortplate == "BIKE" or shortplate == "BREW" or shortplate == "BRIN" or shortplate == "BAHA" or shortplate == "FOOD" or shortplate == "FTNE" or shortplate == "GANG" or shortplate == "JOAL" or shortplate == "STAT" or shortplate == "UNIC" or shortplate == "BANK" or shortplate == "TRUC" or shortplate == "PIZZ" or shortplate == "PROP" or shortplate == "WORK" or shortplate == "COFF" then xPlayer.removeMoney(amount) TriggerClientEvent('esx:showNotification', _source, "Votre voiture de société a été flashé.") MySQL.Async.execute( 'INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (@identifier, @sender, @target_type, @target, @label, @amount)', { ['@identifier'] = xPlayer.identifier, ['@sender'] = "Radar fixe", ['@target_type'] = 'society', ['@target'] = 'society_police', --['@label'] = "📸:plaque société "..plate..", "..kmhspeed.."km/h a la place de "..maxspeed, ['@amount'] = amount }, function(rowsChanged) TriggerClientEvent('esx:showNotification', _source, "Votre voiture de société a été flashée.") end ) break end end end ) end) local IsEnnabled = false ESX.RegisterUsableItem('coyotte', function(source) local xPlayer = ESX.GetPlayerFromId(source) if not IsEnnabled then IsEnnabled = true TriggerClientEvent('esx_jb_radars:ShowRadarBlip', source) TriggerClientEvent('esx:ShowNotification',source, "Tu as activé ton coyotte.") else TriggerClientEvent('esx_jb_radars:RemoveRadarBlip', source) IsEnnabled = false end end) RegisterServerEvent('esx:onRemoveInventoryItem') AddEventHandler('esx:onRemoveInventoryItem', function(source, item, count) if item.name ~= nil and item.name == 'coyotte' and item.count == 0 then IsEnnabled = false TriggerClientEvent('esx_jb_radars:RemoveRadarBlip', source) TriggerClientEvent('esx:showNotification', source, "Ton coyotte est désactivé.") end end) function dump(o, nb) if nb == nil then nb = 0 end if type(o) == 'table' then local s = '' for i = 1, nb + 1, 1 do s = s .. " " end s = '{\n' for k,v in pairs(o) do if type(k) ~= 'number' then k = '"'..k..'"' end for i = 1, nb, 1 do s = s .. " " end s = s .. '['..k..'] = ' .. dump(v, nb + 1) .. ',\n' end for i = 1, nb, 1 do s = s .. " " end return s .. '}' else return tostring(o) end end
local K, C, L = unpack(select(2, ...)) local Module = K:GetModule("Announcements") local _G = _G local string_format = _G.string.format local GetTime = _G.GetTime local lastTimePet = 0 local lastTimePlayer = 0 local healthPercent = 35 function Module:SetupHealthAnnounce() if (UnitAffectingCombat("pet") and (UnitHealth("pet") / UnitHealthMax("pet") * 100) <= healthPercent) and lastTimePet ~= GetTime() then PlaySound(23404, "master") UIErrorsFrame:AddMessage(K.InfoColor..string_format(L["The health for %s is low!"], UnitName("pet"))) lastTimePet = GetTime() end if (UnitAffectingCombat("player") and (UnitHealth("player") / UnitHealthMax("player") * 100) <= healthPercent) and lastTimePlayer ~= GetTime() then PlaySound(23404, "master") UIErrorsFrame:AddMessage(K.InfoColor..string_format(L["The health for %s is low!"], UnitName("player"))) lastTimePlayer = GetTime() end end function Module:CreateHealthAnnounce() if not C["Announcements"].HealthAlert then return end K:RegisterEvent("UNIT_HEALTH", Module.SetupHealthAnnounce) end
-- Setup lspconfig. local cmplsp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") if not cmplsp_ok then return end local illu_ok, illuminate = pcall(require, "illuminate") if not illu_ok then return end local status_ok, lspstatus = pcall(require, "lsp-status") if not status_ok then return end local inst_ok, installer = pcall(require, "nvim-lsp-installer") if not inst_ok then return end local ok, signature = pcall(require, "lsp_signature") if not ok then return end local lspkind_ok, lspkind = pcall(require, "lspkind") if not lspkind_ok then return end signature.setup({ floating_window = false, hint_prefix = "", bind = true, handler_opts = { border = "rounded", }, }) lspstatus.config({ -- status_symbol = "𝓵", status_symbol = "⬤ ", current_function = true, diagnostics = false, kind_labels = lspkind.presets["default"], }) lspstatus.register_progress() local capabilities = vim.tbl_extend( "keep", cmp_nvim_lsp.update_capabilities(vim.lsp.protocol.make_client_capabilities()) or {}, lspstatus.capabilities ) capabilities.textDocument.completion.completionItem = { documentationFormat = { "markdown", "plaintext" }, snippetSupport = true, preselectSupport = true, insertReplaceSupport = true, labelDetailsSupport = true, deprecatedSupport = true, commitCharactersSupport = true, tagSupport = { valueSet = { 1 } }, resolveSupport = { properties = { "documentation", "detail", "additionalTextEdits", }, }, } -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end illuminate.on_attach(client, bufnr) lspstatus.on_attach(client, bufnr) -- Mappings. local opts = { noremap = true, silent = true } -- See `:help vim.lsp.*` for documentation on any of the below functions -- leaving only what I actually use... buf_set_keymap("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts) buf_set_keymap("n", "gr", "<cmd>Telescope lsp_references<CR>", opts) buf_set_keymap("n", "<C-j>", "<cmd>Telescope lsp_document_symbols<CR>", opts) buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) buf_set_keymap("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts) buf_set_keymap("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) buf_set_keymap("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) buf_set_keymap("n", "<leader>D", "<cmd>Telescope lsp_type_definitions<CR>", opts) buf_set_keymap("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) buf_set_keymap("n", "<leader>ca", "<cmd>Telescope lsp_code_actions<CR>", opts) -- buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) -- buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) -- buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) -- buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) -- buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) -- buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) -- buf_set_keymap('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) -- buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) -- buf_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts) -- buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) -- buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) -- buf_set_keymap('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts) -- buf_set_keymap("n", "<leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) if client.resolved_capabilities.document_formatting then vim.cmd([[ augroup formatting autocmd! * <buffer> autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync() autocmd BufWritePre <buffer> lua OrganizeImports(1000) augroup END ]]) end -- Set autocommands conditional on server_capabilities if client.resolved_capabilities.document_highlight then vim.cmd([[ augroup lsp_document_highlight autocmd! * <buffer> autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight() autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references() augroup END ]]) end end local lsp_opts = {} lsp_opts["gopls"] = { capabilities = capabilities, on_attach = on_attach, settings = { gopls = { gofumpt = true, }, }, flags = { debounce_text_changes = 150, }, } local schemas = {} schemas["https://goreleaser.com/static/schema-pro.json"] = ".goreleaser.yaml" lsp_opts["yamlls"] = { capabilities = capabilities, on_attach = on_attach, settings = { yaml = { schemaStore = { url = "https://www.schemastore.org/api/json/catalog.json", enable = true, }, schemas = schemas, }, }, } lsp_opts["bashls"] = { capabilities = capabilities, on_attach = on_attach, } lsp_opts["terraformls"] = { capabilities = capabilities, on_attach = on_attach, } lsp_opts["tflint"] = { capabilities = capabilities, on_attach = on_attach, } lsp_opts["dockerls"] = { capabilities = capabilities, on_attach = on_attach, } lsp_opts["sumneko_lua"] = { capabilities = capabilities, on_attach = on_attach, -- fixes for lsp-status so it shows the function in its status bar select_symbol = function(cursor_pos, symbol) if symbol.valueRange then local value_range = { ["start"] = { character = 0, line = vim.fn.byte2line(symbol.valueRange[1]), }, ["end"] = { character = 0, line = vim.fn.byte2line(symbol.valueRange[2]), }, } return require("lsp-status.util").in_range(cursor_pos, value_range) end end, settings = { Lua = { diagnostics = { globals = { "vim" }, }, }, }, } lsp_opts["rust_analyzer"] = { capabilities = capabilities, on_attach = on_attach, } -- installer.setup({ -- automatic_installation = true, -- ui = { -- icons = { -- server_installed = "", -- server_pending = "", -- server_uninstalled = "ﮊ", -- }, -- keymaps = { -- toggle_server_expand = "<CR>", -- install_server = "i", -- update_server = "u", -- check_server_version = "c", -- update_all_servers = "U", -- check_outdated_servers = "C", -- uninstall_server = "X", -- }, -- }, -- }) installer.on_server_ready(function(server) server:setup(lsp_opts[server.name] or {}) end) -- organize imports -- https://github.com/neovim/nvim-lspconfig/issues/115#issuecomment-902680058 function OrganizeImports(timeoutms) local params = vim.lsp.util.make_range_params() params.context = { only = { "source.organizeImports" } } local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, timeoutms) for _, res in pairs(result or {}) do for _, r in pairs(res.result or {}) do if r.edit then vim.lsp.util.apply_workspace_edit(r.edit, "UTF-8") else vim.lsp.buf.execute_command(r.command) end end end end
bright_night = {} -- engine const local SUNLIGHT = 15 -- mod config local night_light = math.max(math.min(tonumber(minetest.settings:get("bright_night_light")) or 4, 15), 3) local auto = minetest.settings:get_bool("bright_night_auto", true) local dawn = ({0.1979, 0.2049, 0.2118, 0.2170, 0.2216, 0.2259, 0.2299, 0.2339, 0.2374, 0.2409, 0.2443, 0.2497, 0.25})[night_light-2] local dusk = ({0.7952, 0.7882, 0.7831, 0.7784, 0.7741, 0.7702, 0.7662, 0.7626, 0.7592, 0.7557, 0.7503, 0.7402, 0.74})[night_light-2] -- mod active values local night_mode = false local function set_night(player) player:override_day_night_ratio(night_light / SUNLIGHT) end local function unset_night(player) player:override_day_night_ratio(nil) end if auto then minetest.register_on_joinplayer(function(player) bright_night.apply(player) end) end function bright_night.apply(object) if night_mode then set_night(object) else unset_night(object) end end minetest.register_globalstep(function() local time = minetest.get_timeofday() if time < dawn or time > dusk then if not night_mode then night_mode = true end elseif night_mode then night_mode = false end if auto then for _, player in ipairs(minetest.get_connected_players()) do bright_night.apply(player) end end end)
--[[ KahLua KonferPUG - an open roll loot distribution helper for PUGs. WWW: http://kahluamod.com/kpug SVN: http://kahluamod.com/svn/konferpug IRC: #KahLua on irc.freenode.net E-mail: cruciformer@gmail.com Please refer to the file LICENSE.txt for the Apache License, Version 2.0. Copyright 2008-2017 James Kean Johnston. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ]] local K = LibStub:GetLibrary("KKore") local H = LibStub:GetLibrary("KKoreHash") local DB = LibStub:GetLibrary("KKoreDB") local KUIBase = LibStub:GetLibrary("KKoreUI") if (not K) then error ("KahLua KonferPUG: could not find KahLua Kore.", 2) end if (not H) then error ("KahLua KonferPUG: could not find KahLua Kore Hash library.", 2) end local kpg = K:GetAddon ("KKonferPUG") local L = kpg.L local KUI = kpg.KUI local MakeFrame = KUI.MakeFrame -- Local aliases for global or Lua library functions local _G = _G local tinsert = table.insert local tremove = table.remove local setmetatable = setmetatable local tconcat = table.concat local tsort = table.sort local tostring = tostring local GetTime = GetTime local min = math.min local max = math.max local strfmt = string.format local strsub = string.sub local strlen = string.len local strfind = string.find local strlower = string.lower local gsub = string.gsub local gmatch = string.gmatch local xpcall, pcall = xpcall, pcall local pairs, next, type = pairs, next, type local select, assert, loadstring = select, assert, loadstring local printf = K.printf local strsplit = string.split local bxor = bit.bxor local ucolor = K.ucolor local ecolor = K.ecolor local icolor = K.icolor local debug = kpg.debug local info = kpg.info local err = kpg.err local white = kpg.white local class = kpg.class --[[ This file contains all of the functions for dealing with sending and receiving of inter-mod communications. It is where the KonferPUG "protocol" is implemented. ]] local function getbool (str) if (str and str == "Y") then return true end return false end local ehandlers = {} local function send_addon_msg (cmd, prio, dist, target, ...) local prio = prio or "BULK" local fs = strfmt ("%d:%s:", kpg.protocol, cmd) local crc = H:CRC32 (fs, nil, false) local ndata = K.Serialise (...) crc = H:CRC32 (ndata, crc, true) fs = fs .. K.hexstr (crc) .. ":" .. ndata debug (9, "sending: fs=%q dist=%q target=%q prio=%q", tostring(fs:gsub("\124", "\124\124")), tostring(dist), tostring(target), tostring(prio)) K.comm.SendCommMessage (kpg.CHAT_MSG_PREFIX, fs, dist, target, prio) end function kpg.SendAM (cmd, prio, ...) if (not kpg.inraid) then return end send_addon_msg (cmd, prio, "RAID", nil, ...) end function kpg.SendWhisperAM (target, cmd, prio, ...) send_addon_msg (cmd, prio, "WHISPER", target, ...) end -- -- Main message receipt function. Checks the protocol, checksum and other -- sundry stuff before invoking the handler function. -- local oldwarn = true local function old_warning_dialog () if (not oldwarn) then return end oldwarn = false local arg = { name = "KPGOldProtoDialog", x = "CENTER", y = "MIDDLE", border = true, blackbg = true, okbutton = { text = K.OK_STR }, canmove = false, canresize = false, escclose = false, width = 450, height = 100, title = L["MODTITLE"], } local dlg = KUI:CreateDialogFrame (arg) dlg.OnAccept = function (this) this:Hide () end dlg.OnCancel = function (this) this:Hide () end arg = { x = 8, y = -10, width = 410, height = 64, autosize = false, color = { r = 1, g = 0, b = 0, a = 1}, text = L["MODTITLE"] .. ": " .. strfmt (L["your version of %s is out of date. Please update it."], L["MODTITLE"]), font = "GameFontNormal", justifyv = "TOP", } dlg.str1 = KUI:CreateStringLabel (arg, dlg) if (kpg.mainwin and kpg.mainwin:IsShown ()) then kpg.mainwin:Hide () end dlg:Show () end local function commdispatch (sender, proto, cmd, res, ...) if (res) then if (not ehandlers[cmd]) then old_warning_dialog () debug (1, "unknown command %q from %q (p=%d)", cmd, sender, proto) return else debug (8, "COMM(%s) received from %q (proto=%d)", cmd, sender, proto) -- -- If we are not the master looter we ignore all incoming events, -- as KPUG only sends events from the ML to users, never the other -- way around. The sole exception to this is the VCACK reply to the -- version check. -- if (not kpg.inraid or (kpg.isml and cmd ~= "VCACK")) then debug (8, "ignoring incoming event - not in raid or ML") return end ehandlers[cmd] (sender, proto, cmd, ...) end else debug (1, "failed to deserialise %q from %q (p=%d)", sender, cmd, proto) end end local userwarn = userwarn or {} function kpg:OnCommReceived (prefix, msg, dist, sender) if (sender == K.player.player) then return -- Ignore our own messages end if (dist == "UNKNOWN" and (sender ~= nil and sender ~= "")) then return end debug (9, "received: prefix=%q msg=%q dist=%q sender=%q", tostring(prefix), tostring(msg), tostring(dist), tostring(sender)) local iter = gmatch (msg, "([^:]+)()") local ps = iter() if (not ps) then debug (1, "bad msg %q received from %q", msg, sender) return end local proto = tonumber (ps, 16) if (proto > kpg.protocol) then old_warning_dialog () return end local cmd = iter () if (not cmd) then debug (1, "malformed msg %q received from %q", msg, sender) return end local msum, pos = iter () if (not msum) then debug (1, "malformed msg %q received from %q", msg, sender) return end local data = string.sub (msg, pos+1) if (not data) then debug (1, "malformed msg %q received from %q", msg, sender) return end local crc = H:CRC32 (ps, nil, false) crc = H:CRC32 (":", crc, false) crc = H:CRC32 (cmd, crc, false) crc = H:CRC32 (":", crc, false) crc = H:CRC32 (data, crc, true) local mf = K.hexstr (crc) if (mf ~= msum) then if (not userwarn[sender]) then printf (ecolor, "WARNING: addon message from %q was fake!", sender) userwarn[sender] = true end end commdispatch (sender, proto, cmd, K.Deserialise (data)) end -- -- Command: VCHEK -- Purpose: Respond to sender with a version check -- ehandlers.VCHEK = function (sender, proto, cmd, ...) if (sender ~= kpg.mlname or kpg.isml) then return end kpg.SendWhisperAM (sender, "VCACK", nil, kpg.version) end -- -- Command: VCACK version -- Purpose: Sent back to us in response to a VCHEK command -- ehandlers.VCACK = function (sender, proto, cmd, ver) if (not kpg.vcreplies[sender]) then kpg.vcreplies[sender] = true info (L["%s using version %s"], white (sender), white (ver)) end end -- -- Command: CONFIG msmin msmax osmin osmax osrolls decay msval mscnt osval oscnt decaytbl -- Purpose: Sent to the raid to let users know what the current config -- parameters are. This is always sent prior to an OLOOT event. -- ehandlers.CONFIG = function (sender, proto, cmd, ...) local msmin, msmax, osmin, osmax, osrolls, decay, msval, mscnt, osval, oscnt, decaytbl = ... if (sender ~= kpg.mlname or kpg.isml) then return end kpg.remcfg = { main_spec_min = msmin, main_spec_max = msmax, off_spec_min = osmin, off_spec_max = osmax, offspec_rolls = osrolls, enable_decay = decay, main_decay = msval, main_max = mscnt, off_decay = osval, off_max = oscnt, decayed = decaytbl, } kpg:RefreshDecayedUsers () end -- -- Command: OLOOT uname uguid realguid lootidtable -- Purpose: Sent when the master looter loots a corpse or chest. This is sent -- each time they do so, whether its for the same mob/chest or not. -- So, if the ML clicks away from a mob or closes loot due to combat -- or whatever, a loot close event will be sent, and when they -- reloot the mob/chest, this event will be sent again. It is always -- a table with the full list of unresolved loot. Each element in the -- table is the itemlink and quantity for the item in question. -- The uname parameter is the name of the mob being looted, and the -- uguid is the GUID of the unit being looted. This is set to the name -- of the chest or container being opened if its not a real mob with -- a GUID. In this case, realguid will be false, for real mobs with -- GUID's it will be true. -- local we_opened = nil ehandlers.OLOOT = function (sender, proto, cmd, ...) local uname, uguid, realguid, loottbl = ... if (sender ~= kpg.mlname or kpg.isml) then return end kpg:ResetBossLoot () kpg.bossloot = {} for k,v in ipairs (loottbl) do local ilink, quant = unpack(v) local itemid = string.match (ilink, "item:(%d+)") local ti = { itemid = itemid, ilink = ilink, slot = 0, quant = quant } tinsert (kpg.bossloot, ti) end kpg.qf.lootlist.itemcount = #kpg.bossloot kpg.qf.lootlist:UpdateList () kpg.autolooted = kpg.autolooted or {} if (kpg.autolooted[uguid] == true) then return end if (uguid ~= "0") then kpg.autolooted[uguid] = true end if (kpg.suspended or not kpg.frdb.auto_open) then return end if (not kpg.mainwin:IsShown ()) then kpg.mainwin:Show () kpg.mainwin:SetTab (kpg.LOOT_TAB, 0) we_opened = true end end -- -- Command: CLOOT -- Purpose: Sent when the master looter stops looting a corpse or chest. -- Close the main window when we receive this if we opened it during -- OLOOT processing. -- ehandlers.CLOOT = function (sender, proto, cmd, ...) if (sender ~= kpg.mlname or kpg.isml) then return end kpg:ResetBossLoot () if (we_opened) then we_opened = nil kpg.mainwin:Hide () end end -- -- Command: ALOOT itemlink -- Purpose: Sent when the master looter adds an item to the loot list -- manually. ITEMLINK is the item link of the item being added -- ehandlers.ALOOT = function (sender, proto, cmd, ilink) if (sender ~= kpg.mlname or kpg.isml) then return end kpg:AddLoot (ilink, true) end -- -- Command: LISEL idx itemid -- Purpose: Select loot item at index position IDX. The item should have -- item id of ITEMID. -- ehandlers.LISEL = function (sender, proto, cmd, ...) local idx, itemid = ... if (not kpg.bossloot) then return end if (sender ~= kpg.mlname or kpg.isml) then return end kpg:SelectLootItem (idx, itemid) end -- -- Command: BIREM itemidx -- Purpose: Used to remove an item from the list of items. This is -- sent out to the raid only so that people in the raid tracking the -- loot process see when an item is manually removed from the list -- by the ML pressing the "Remove" button. This is also sent whenever -- an item is awarded to a user and removed off the corpse. -- ehandlers.BIREM = function (sender, proto, cmd, ...) local itemidx = ... if (not kpg.bossloot) then return end if (sender ~= kpg.mlname or kpg.isml) then return end kpg:RemoveItemByIdx (itemidx) end -- -- Command: BICAN -- Purpose: Used to signal a roll was cancelled. -- ehandlers.BICAN = function (sender, proto, cmd, ...) if (sender ~= kpg.mlname or kpg.isml) then return end kpg:ResetRollers () end -- -- Command: BIDOP idx -- Purpose: Opens rolling on the currently selected item. Recipients of this -- message merely need to activate their "Roll" button in case the -- user is interested in rolling on the item. This is always preceeded -- by a BICAN message to clear the roll list just to be sure. -- Gets passed the index number of the item being bid on, which is -- currently ignored as the item will have been set by LISEL. We could -- do an integrity check though. Also currently unused (for future -- use) is a timeout which will start a bid timeout countdown on the -- user's end. -- ehandlers.BIDOP = function (sender, proto, cmd, ...) local idx = ... if (not kpg.bossloot) then return end if (sender ~= kpg.mlname or kpg.isml) then return end kpg.qf.mymainroll:SetEnabled (true) kpg.qf.mymainroll:SetShown (true) if (kpg.remcfg.offspec_rolls) then kpg.qf.myoffroll:SetEnabled (true) kpg.qf.myoffroll:SetShown (true) end end -- -- Command: BIDND -- Purpose: Closes bidding on the current item. The recipients simply need to -- disable the roll buttons. -- ehandlers.BIDND = function (sender, proto, cmd, ...) if (not kpg.bossloot) then return end if (sender ~= kpg.mlname or kpg.isml) then return end kpg.qf.mymainroll:SetEnabled (false) kpg.qf.myoffroll:SetEnabled (false) kpg.qf.mymainroll:SetShown (false) kpg.qf.myoffroll:SetShown (false) end -- Set a user's decay values ehandlers.SETDC = function (sender, proto, cmd, ...) local who, whoclass, mc, oc = ... if (sender ~= kpg.mlname or kpg.isml) then return end if (not kpg.remcfg) then return end if (mc == 0 and oc == 0) then kpg.remcfg.decayed[who] = nil else kpg.remcfg.decayed = kpg.remcfg.decayed or {} kpg.remcfg.decayed[who] = { class = whoclass, count = { mc, oc } } end kpg:RefreshDecayedUsers () end -- Reset decay ehandlers.RESTD = function (sender, proto, cmd, ...) if (sender ~= kpg.mlname or kpg.isml) then return end if (not kpg.remcfg) then return end kpg.remcfg.decayed = nil kpg:RefreshDecayedUsers () end -- New roller ehandlers.NEWRL = function (sender, proto, cmd, ...) local name, class, roll, minr, maxr, pct, rit = ... if (sender ~= kpg.mlname or kpg.isml) then return end kpg.rollers = kpg.rollers or {} kpg.rollers[name] = { class = class, roll = roll, minr = minr, maxr = maxr, omin = minr, omax = maxr, oroll = roll, pct = pct, rit = rit, } kpg:RefreshRollers () end -- Update roller ehandlers.UPDRL = function (sender, proto, cmd, ...) local name, minr, maxr, roll, rit = ... if (sender ~= kpg.mlname or kpg.isml) then return end if (kpg.rollers and kpg.rollers[name]) then local rp = kpg.rollers[name] rp.minr = minr rp.maxr = maxr rp.roll = roll rp.rit = rit kpg:RefreshRollers () end end -- Add loot award history item ehandlers.AHIST = function (sender, proto, cmd, ...) local when, what, who, class, how = ... kpg:AddLootHistory (when, what, who, class, how, true) end
function clone_many_times(net, T) local clones = {} local params, gradParams if net.parameters then params, gradParams = net:parameters() if params == nil then params = {} end end local paramsNoGrad if net.parametersNoGrad then paramsNoGrad = net:parametersNoGrad() end local mem = torch.MemoryFile("w"):binary() mem:writeObject(net) for t = 1, T do -- We need to use a new reader for each clone. -- We don't want to use the pointers to already read objects. local reader = torch.MemoryFile(mem:storage(), "r"):binary() local clone = reader:readObject() reader:close() if net.parameters then local cloneParams, cloneGradParams = clone:parameters() local cloneParamsNoGrad for i = 1, #params do cloneParams[i]:set(params[i]) cloneGradParams[i]:set(gradParams[i]) end if paramsNoGrad then cloneParamsNoGrad = clone:parametersNoGrad() for i =1,#paramsNoGrad do cloneParamsNoGrad[i]:set(paramsNoGrad[i]) end end end clones[t] = clone collectgarbage() end mem:close() return clones end function adagrad_step(x, dfdx, lr, state) if not state.var then state.var = torch.Tensor():typeAs(x):resizeAs(x):zero():add(0.1) state.std = torch.Tensor():typeAs(x):resizeAs(x) end state.var:addcmul(1, dfdx, dfdx) state.std:sqrt(state.var) x:addcdiv(-lr, dfdx, state.std) end function adam_step(x, dfdx, lr, state) local beta1 = state.beta1 or 0.9 local beta2 = state.beta2 or 0.999 local eps = state.eps or 1e-8 state.t = state.t or 0 state.m = state.m or x.new(dfdx:size()):zero() state.v = state.v or x.new(dfdx:size()):zero() state.denom = state.denom or x.new(dfdx:size()):zero() state.t = state.t + 1 state.m:mul(beta1):add(1-beta1, dfdx) state.v:mul(beta2):addcmul(1-beta2, dfdx, dfdx) state.denom:copy(state.v):sqrt():add(eps) local bias1 = 1-beta1^state.t local bias2 = 1-beta2^state.t local stepSize = lr * math.sqrt(bias2)/bias1 x:addcdiv(-stepSize, state.m, state.denom) end function adadelta_step(x, dfdx, lr, state) local rho = state.rho or 0.9 local eps = state.eps or 1e-6 state.var = state.var or x.new(dfdx:size()):zero() state.std = state.std or x.new(dfdx:size()):zero() state.delta = state.delta or x.new(dfdx:size()):zero() state.accDelta = state.accDelta or x.new(dfdx:size()):zero() state.var:mul(rho):addcmul(1-rho, dfdx, dfdx) state.std:copy(state.var):add(eps):sqrt() state.delta:copy(state.accDelta):add(eps):sqrt():cdiv(state.std):cmul(dfdx) x:add(-lr, state.delta) state.accDelta:mul(rho):addcmul(1-rho, state.delta, state.delta) end
--====================================================================-- -- corovel/luacrypto.lua -- -- create Corona-esque crypto interface -- -- Documentation: http://docs.davidmccuskey.com/ --====================================================================-- --[[ The MIT License (MIT) Copyright (c) 2014-2015 David McCuskey 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. --]] --====================================================================-- --== Corovel : JSON shim --====================================================================-- -- Semantic Versioning Specification: http://semver.org/ local VERSION = "0.1.0" --====================================================================-- --== Setup, Constants local has_crypto, crypto = pcall( require, 'crypto' ) local __crypto = crypto local ICrypto = {} package.loaded["crypto"] = ICrypto ICrypto.__crypto = __crypto -- original crypto --== Constants ICrypto.sha256 = 'sha256' --== Functions function ICrypto.hmac( ... ) return __crypto.hmac.digest( ... ) end return ICrypto
--[[ Filename: MySQLHandlerS.lua Author: Multi, Sam@ke --]] MySQLHandlerS = {} function MySQLHandlerS:constructor(parent) mainOutput("MySQLHandlerS was loaded.") self.coreClass = parent self.queryAttemps = -1 self.typ = "mysql" self.database = getDBName() self.host = getDBHost() self.username = getDBUsername() self.password = getDBPassword() self.datachar = "share=1" self:establishConnection() if (self.dbConnection) then outputServerLog("New MySQL-Connection was created successfully!") else outputServerLog("MySQL-Connection failed!") end end function MySQLHandlerS:establishConnection() if (not self.dbConnection) then self.dbConnection = dbConnect(self.typ or "mysql", "dbname=".. self.database ..";host=".. self.host, self.username, self.password, self.datachar) end end function MySQLHandlerS:getAllMapVotes() self:establishConnection() if (self.dbConnection) then local tempQuery = self.dbConnection:query("SELECT * FROM mapvotes") local poll = tempQuery:poll(self.queryAttemps) return poll end return nil end function MySQLHandlerS:getMapVotes(mapName) if (mapName) and (self.dbConnection) then self:establishConnection() local tempQuery = self.dbConnection:query("SELECT * FROM mapvotes WHERE mapname = ?", mapname) local poll = tempQuery:poll(self.queryAttemps) return poll end return nil end function MySQLHandlerS:getAllMapStats() self:establishConnection() if (self.dbConnection) then local tempQuery = self.dbConnection:query("SELECT * FROM toptimes") local poll = tempQuery:poll(self.queryAttemps) return poll end return nil end function MySQLHandlerS:getMapStats(mapName) if (mapName) and (self.dbConnection) then self:establishConnection() local tempQuery = self.dbConnection:query("SELECT * FROM toptimes WHERE mapname = ?", mapname) local poll = tempQuery:poll(self.queryAttemps) return poll end return nil end function MySQLHandlerS:saveMapStats(mapName, mapStats) if (mapName) and (mapStats) then self:establishConnection() if (self.dbConnection) then self.dbConnection:exec("START TRANSACTION;") local tempQuery = self.dbConnection:query("SELECT * FROM toptimes WHERE mapname = ?", mapname) local poll = tempQuery:poll(self.queryAttemps) if (#poll < 1) then local result = self.dbConnection:exec("INSERT toptimes SET mapname = '".. mapName .."'") --result = self.dbConnection:exec("INSERT `toptimes` SET `mapname` = `?`", mapname) end if (result ~= false) then for key, value in pairs(mapStats) do result = self.dbConnection:exec("UPDATE toptimes SET " .. key .. " = '" .. value .. "' WHERE mapname = '" .. mapName .. "'") --result = self.dbConnection:exec("UPDATE `toptimes` SET `?` = `?` WHERE `mapname` = `?`", key, value, mapname) if (result == false) then self.dbConnection:exec("ROLLBACK;") return false end end end self.dbConnection:exec("COMMIT;") return true end return false end end function MySQLHandlerS:saveMapVotes(mapVotesTable) if (mapVotesTable) then self:establishConnection() if (self.dbConnection) then self.dbConnection:exec("START TRANSACTION;") for index, mapVote in pairs(mapVotesTable) do if (mapVote) then if (mapVote.map) and (mapVote.player) and (mapVote.value) then if (mapVote.map:len() > 0) and (mapVote.player:len() > 0) and (mapVote.value > 0) then local tempQuery = self.dbConnection:query("SELECT `mapname` FROM mapvotes WHERE mapname = ? AND player = ?", mapVote.map, mapVote.player) local poll = tempQuery:poll(self.queryAttemps) local result = false if (#poll > 0) then result = self.dbConnection:exec("UPDATE mapvotes SET vote = ? WHERE mapname = ? AND player = ?", mapVote.value, mapVote.map, mapVote.player) else result = self.dbConnection:exec("INSERT INTO mapvotes (mapname, player, vote) VALUES (?,?,?)", mapVote.map, mapVote.player, mapVote.value) end if (result == false) then self.dbConnection:exec("ROLLBACK;") break end end end end end self.dbConnection:exec("COMMIT;") return true end return false end end function MySQLHandlerS:destructor() if (self.dbConnection) then self.dbConnection:destroy() self.dbConnection = nil end mainOutput("MySQLHandlerS was deleted.") end
-- grabbed from the rojo plugin: https://github.com/rojo-rbx/rojo/blob/master/plugin/src/Components/FitText.lua local ReplicatedStorage = game:GetService("ReplicatedStorage") local TextService = game:GetService("TextService") local common = ReplicatedStorage.common local util = common.util local lib = ReplicatedStorage.lib local Dictionary = require(util.Dictionary) local Roact = require(lib.Roact) local e = Roact.createElement local FitText = Roact.PureComponent:extend("FitText") function FitText:init() self.ref = Roact.createRef() self.sizeBinding, self.setSize = Roact.createBinding(UDim2.new()) end function FitText:render() local kind = self.props.kind or "TextLabel" local props = Dictionary.merge({ Font = Enum.Font.Gotham, TextSize = 18, BackgroundTransparency = 1, }, self.props) local containerProps = Dictionary.merge(props, { fitAxis = Dictionary.None, kind = Dictionary.None, padding = Dictionary.None, minSize = Dictionary.None, scale = Dictionary.None, Size = self.sizeBinding, [Roact.Ref] = self.ref, [Roact.Change.AbsoluteSize] = function() self:updateTextMeasurements() end }) return e(kind, containerProps) end function FitText:didMount() self:updateTextMeasurements() end function FitText:didUpdate() self:updateTextMeasurements() end function FitText:updateTextMeasurements() local minSize = self.props.minSize or Vector2.new(0, 0) local padding = self.props.padding or Vector2.new(0, 0) local fitAxis = self.props.fitAxis or "XY" local baseSize = self.props.Size local sizeUpdated = self.props.sizeUpdated local text = self.props.Text or "" local font = self.props.Font or Enum.Font.Gotham local textSize = self.props.TextSize or 18 local containerSize = self.ref.current.AbsoluteSize local textBounds if fitAxis == "XY" then textBounds = Vector2.new(9e6, 9e6) elseif fitAxis == "X" then textBounds = Vector2.new(9e6, containerSize.Y - padding.Y * 2) elseif fitAxis == "Y" then textBounds = Vector2.new(containerSize.X - padding.X * 2, 9e6) end local measuredText = TextService:GetTextSize(text, textSize, font, textBounds) local computedX = math.max(minSize.X, padding.X * 2 + measuredText.X) local computedY = math.max(minSize.Y, padding.Y * 2 + measuredText.Y) local totalSize if fitAxis == "XY" then totalSize = UDim2.new( 0, computedX, 0, computedY) elseif fitAxis == "X" then totalSize = UDim2.new( 0, computedX, baseSize.Y.Scale, baseSize.Y.Offset) elseif fitAxis == "Y" then totalSize = UDim2.new( baseSize.X.Scale, baseSize.X.Offset, 0, computedY) end self.setSize(totalSize) if typeof(sizeUpdated) == "function" then sizeUpdated(combinedSize) end end return FitText
list.Set("DesktopWindows","Advanced Calculator", { title = "Calculator", icon = "icon64/advcalc.png", init = function( icon, providedwindow ) BuildAdvCMenu() providedwindow:Close() end }) local disttop = 23 local dispy = 50 AdvCalc = AdvCalc or { Ans = 0, M = 0, A = 0, B = 0, C = 0, D = 0, E = 0, F = 0, G = 0, H = 0, I = 0, J = 0, K = 0, L = 0, M = 0, N = 0, O = 0, P = 0, Q = 0, R = 0, S = 0, T = 0, U = 0, V = 0, W = 0, X = 0, Y = 0, Z = 0, func = "", AnsDisp = "0", typed = {}, Posttyped = "", Alt = false, Alpha = false, AngleMode = "degrees", ForceInsert = true, DigitMode = 10, inspos = 1, History = {}, Colors = { [1]=Color(0,0,0), [2]=Color(191,191,191), [3]=Color(127,127,127), [4]=Color(255,255,255), [5]=Color(255,255,0), [6]=Color(0,255,0), [7]=Color(0,255,255), [8]=Color(127,0,255), [9]=Color(0,127,255), [10]=Color(255,0,0), [11]=Color(31,31,31), [12]=Color(127,0,0), [13]=Color(255,255,191), [14]=Color(127,63,0), [15]=Color(0,0,0), [16]=Color(0,0,0), [17]=Color(255,255,255), [18]=Color(63,63,63), [19]=Color(255,255,255), [20]=Color(0,0,0), [21]=Color(255,255,255), [22]=Color(255,255,255), [23]=Color(255,0,0), [24]=Color(0,255,0) }, Translations = { [1]="Functions", [2]="Numbers", [3]="Operations", [4]="Equators/Solvants", [5]="Shift/Alpha Toggler", [6]="Anglizer", [7]="Autocorrection Toggler", [8]="Arrows", [9]="Memory Operators", [10]="Clearing Operators", [11]="Alternate Functions", [12]="Variables", [13]="Toggled Shift and Alpha", [14]="Alternate Alpha Functions", [15]="Backspace", [16]="Black Text", [17]="White Text", [18]="Non-rainbow Options", [19]="Screen", [20]="Screen Text", [21]="Graph Line", [22]="Graph Debug Text", [23]="Graph X-Axis", [24]="Graph Y-Axis" }, Historyi = 1 } hook.Add("Initialize", "LoadDataForAdvCalc", function() if file.Exists('advcalccolors.txt', 'DATA') then table.Merge(AdvCalc.Colors,util.JSONToTable(file.Read('advcalccolors.txt','DATA')) or {}) end if file.Exists('advcalcvarvals.txt', 'DATA') then table.Merge(AdvCalc,util.JSONToTable(file.Read('advcalcvarvals.txt','DATA')) or {}) end end) include("buttons+functions.lua") local ConX = CreateClientConVar("advcalc_button_sizex","40") local ConY = CreateClientConVar("advcalc_button_sizey","40") local ConR = CreateClientConVar("advcalc_button_roundness","4") local ConS = CreateClientConVar("advcalc_button_spacing","2") local ConO = CreateClientConVar("advcalc_button_clicky","1") local ConB = CreateClientConVar("advcalc_button_optionrainbow","1") local ConP = CreateClientConVar("advcalc_color_cyclespeed","1") local ConH = CreateClientConVar("advcalc_color_addhue","0") local ConV = CreateClientConVar("advcalc_color_darkness","0.5") local ConT = CreateClientConVar("advcalc_color_saturation","1") local ConA = CreateClientConVar("advcalc_button_autorelease","1") concommand.Add("advcalc",function() if SERVER then return end BuildAdvCMenu() end) function CheckAdvCSyntax(key) local tab = AdvCalc.typed if key then local sp, _1, _2 = string.find(tab[AdvCalc.inspos-1] and string.Right(tab[AdvCalc.inspos-1],1) or "",key) return tobool(sp) else return tab[AdvCalc.inspos-1] == nil end end function BuildAdvCMenu() if SERVER then return end local xelements = 11 local yelements = 6 local buttonx = ConX:GetInt() local buttony = ConY:GetInt() local spacing = ConS:GetFloat() local Main = vgui.Create("DFrame") Main:SetSize(buttonx*xelements+spacing*(xelements+1), buttony*yelements+spacing*(yelements+2)+dispy+disttop) Main:Center() Main:MakePopup() Main:SetTitle("Basic Advanced Calculator by RandomTNT") Main:ShowCloseButton(false) Main.Paint = function(panel,w,h) draw.RoundedBox(4,0,0,w,h,HSVToColor((SysTime()*ConP:GetFloat()*10+ConH:GetInt())%360,ConT:GetFloat(),1-ConV:GetFloat())) end local Disp = vgui.Create("DPanel", Main) Disp:SetSize(buttonx*xelements+spacing*(xelements-1),dispy) Disp:SetPos(spacing,spacing+disttop) function Disp:Paint(w,h) draw.RoundedBox(4,0,0,w,h,AdvCalc.Colors[19]) draw.SimpleText(string.Comma(AdvCalc.AnsDisp),"DermaLarge",w,h,AdvCalc.Colors[20],TEXT_ALIGN_RIGHT,TEXT_ALIGN_BOTTOM) draw.SimpleText(AdvCalc.func,"DermaDefault",2,2,AdvCalc.Colors[20],TEXT_ALIGN_LEFT,TEXT_ALIGN_TOP) if #AdvCalc.typed + 1 ~= AdvCalc.inspos then surface.SetFont("DermaDefault") local indicator = table.concat(AdvCalc.typed,"",1,AdvCalc.inspos-1) local w2, h2 = surface.GetTextSize(indicator) surface.SetDrawColor(AdvCalc.Colors[20]) surface.DrawRect(1+w2,2,1,h2) end end local XButton = vgui.Create("DButton",Main) XButton:SetPos(buttonx*xelements+spacing*(xelements+1)-disttop,0) XButton:SetSize(disttop,disttop) XButton:SetFont("Marlett") XButton:SetText("r") XButton:SetTextColor(Color(255,255,255)) XButton.DoClick = function() Main:Close() end XButton.Paint = function(panel,w,h) --draw.SimpleText("r","Marlett",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) end local Buttons = vgui.Create("DIconLayout", Main) Buttons:SetSize(buttonx*xelements+spacing*(xelements-1),buttony*yelements+spacing*(yelements-1)) Buttons:SetPos(spacing,spacing*2+disttop+dispy) Buttons:SetSpaceX(spacing) Buttons:SetSpaceY(spacing) function Main:PerformLayout(w,h) XButton:SetPos(w-disttop,0) Disp:SetSize(buttonx*xelements+spacing*(xelements-1),dispy) Disp:SetPos(spacing,spacing+disttop) Buttons:SetSize(buttonx*xelements+spacing*(xelements-1),buttony*yelements+spacing*(yelements-1)) Buttons:SetPos(spacing,spacing*2+disttop+dispy) Buttons:SetSpaceX(spacing) Buttons:SetSpaceY(spacing) end for i=1,(xelements*yelements) do if CButtonTable[i] ~= nil then local Button = Buttons:Add("DButton") local text = CButtonTable[i].Text or "" local functext = CButtonTable[i].FuncText or text local alttext = CButtonTable[i].AltText or text local altfunctext = CButtonTable[i].FuncAltText or CButtonTable[i].AltText or functext local alphatext = CButtonTable[i].AlphaText or text local alphafunctext = CButtonTable[i].FuncAlphaText or CButtonTable[i].AlphaText or functext local altalphatext = CButtonTable[i].AltAlphaText or CButtonTable[i].AlphaText or CButtonTable[i].AltText or text local altalphafunctext = CButtonTable[i].FuncAltAlphaText or CButtonTable[i].AltAlphaText or CButtonTable[i].FuncAlphaText or CButtonTable[i].AlphaText or CButtonTable[i].FuncAltText or CButtonTable[i].AltText or functext --local tcol = AdvCalc.Colors[CButtonTable[i].TextColor] or AdvCalc.Colors[17] local typenorm = CButtonTable[i].ButtonType or "func" local typealt = CButtonTable[i].ButtonTypeAlt or typenorm local typealpha = CButtonTable[i].ButtonTypeAlpha or typenorm local typealtalpha = CButtonTable[i].ButtonTypeAltAlpha or CButtonTable[i].ButtonTypeAlpha or typealt -- local col = AdvCalc.Colors[CButtonTable[i].DispColor] or AdvCalc.Colors[1] -- local altcol = AdvCalc.Colors[CButtonTable[i].AltDispColor] or col -- local alphacol = AdvCalc.Colors[CButtonTable[i].AlphaDispColor] or col -- local altalphacol = AdvCalc.Colors[CButtonTable[i].AltAlphaDispColor] or AdvCalc.Colors[CButtonTable[i].AlphaDispColor] or AdvCalc.Colors[CButtonTable[i].AltDispColor] or col Button:SetSize(buttonx, buttony) --Button:SetTextColor(tcol) Button.DoClick = function() if ConO:GetBool() then surface.PlaySound("doors/handle_pushbar_locked1.wav") end local reqins = AdvCalc.Alt and AdvCalc.Alpha and altalphafunctext or AdvCalc.Alpha and alphafunctext or AdvCalc.Alt and altfunctext or functext local ftype = AdvCalc.Alt and AdvCalc.Alpha and typealtalpha or AdvCalc.Alpha and typealpha or AdvCalc.Alt and typealt or typenorm if isfunction(CButtonTable[i].RunAltAlphaFunction) and AdvCalc.Alpha and AdvCalc.Alt then CButtonTable[i]:RunAltAlphaFunction() elseif isfunction(CButtonTable[i].RunAlphaFunction) and AdvCalc.Alpha then CButtonTable[i]:RunAlphaFunction() elseif isfunction(CButtonTable[i].RunAltFunction) and AdvCalc.Alt then CButtonTable[i]:RunAltFunction() elseif isfunction(CButtonTable[i].RunFunction) then CButtonTable[i]:RunFunction() elseif reqins ~= "" then if AdvCalc.ForceInsert then if ftype == "number" then if CheckAdvCSyntax("[%a)]") then table.insert(AdvCalc.typed,AdvCalc.inspos,"*"..reqins) else table.insert(AdvCalc.typed,AdvCalc.inspos,reqins) end elseif ftype == "func" or ftype == "var" then if CheckAdvCSyntax("[%w)]") then table.insert(AdvCalc.typed,AdvCalc.inspos,"*"..reqins) else table.insert(AdvCalc.typed,AdvCalc.inspos,reqins) end elseif ftype == "pad if null" then if CheckAdvCSyntax("[%(,]") or CheckAdvCSyntax(nil) then table.insert(AdvCalc.typed,AdvCalc.inspos,"1"..reqins) else table.insert(AdvCalc.typed,AdvCalc.inspos,reqins) end elseif ftype == "operand" then if CheckAdvCSyntax("[^%w%)]") or CheckAdvCSyntax(nil) then table.insert(AdvCalc.typed,AdvCalc.inspos,"0"..reqins) else table.insert(AdvCalc.typed,AdvCalc.inspos,reqins) end elseif ftype == "negate" then if CheckAdvCSyntax("[%+%-]") and not CheckAdvCSyntax(nil) then table.insert(AdvCalc.typed,AdvCalc.inspos,"0"..reqins) else table.insert(AdvCalc.typed,AdvCalc.inspos,reqins) end elseif ftype == "space if num" then if CheckAdvCSyntax("%d") then table.insert(AdvCalc.typed,AdvCalc.inspos," "..reqins) elseif CheckAdvCSyntax(nil) then table.insert(AdvCalc.typed,AdvCalc.inspos,"\"\""..reqins) else table.insert(AdvCalc.typed,AdvCalc.inspos,reqins) end elseif ftype == "raw" then table.insert(AdvCalc.typed,AdvCalc.inspos,reqins) end else table.insert(AdvCalc.typed,AdvCalc.inspos,reqins) end AdvCalc.inspos = AdvCalc.inspos + 1 AdvCalc.func = table.concat(AdvCalc.typed) end if ConA:GetBool() and not CButtonTable[i].DisableAutoRelease then AdvCalc.Alt = false AdvCalc.Alpha = false end end Button.Paint = function(panel,w,h) draw.RoundedBox(ConR:GetInt(),0,0,w,h,Button:IsDown() and Color(255,255,255) or ConB:GetBool() and CButtonTable[i].RainbowColors and HSVToColor((SysTime()*ConP:GetFloat()*10+ConH:GetInt())%360,ConT:GetFloat(),math.min(2-ConV:GetFloat()*2,1)) or AdvCalc.Alpha and AdvCalc.Alt and AdvCalc.Colors[CButtonTable[i].AltAlphaDispColor] or AdvCalc.Alpha and AdvCalc.Colors[CButtonTable[i].AlphaDispColor] or AdvCalc.Alt and AdvCalc.Colors[CButtonTable[i].AltDispColor] or AdvCalc.Colors[CButtonTable[i].DispColor] or AdvCalc.Colors[1]) if CButtonTable[i].Anglizer and Button.OldAngleMode ~= AdvCalc.AngleMode then Button.OldAlt = AdvCalc.Alt Button.OldAlpha = AdvCalc.Alpha Button.OldAngleMode = AdvCalc.AngleMode Button:SetText(string.Left(string.upper(AdvCalc.AngleMode),3)) elseif not CButtonTable[i].Anglizer and (Button.OldAlpha ~= AdvCalc.Alpha or Button.OldAlt ~= AdvCalc.Alt) then Button.OldAlt = AdvCalc.Alt Button.OldAlpha = AdvCalc.Alpha Button:SetText(AdvCalc.Alpha and AdvCalc.Alt and altalphatext or AdvCalc.Alpha and alphatext or AdvCalc.Alt and alttext or text) end Button:SetTextColor(AdvCalc.Colors[CButtonTable[i].TextColor] or AdvCalc.Colors[17]) --[[local newcol = AdvCalc.Colors[CButtonTable[i].TextColor] or AdvCalc.Colors[17] if tcol ~= newcol then tcol = newcol Button:SetTextColor(tcol) end]] local newx,newy,news = ConX:GetInt(),ConY:GetInt(),ConS:GetFloat() if w ~= newx or h ~= newy or spacing ~= news then buttonx = newx buttony = newy spacing = news Button:SetSize(buttonx, buttony) Main:SetSize(buttonx*xelements+spacing*(xelements+1), buttony*yelements+spacing*(yelements+2)+dispy+disttop) Main:InvalidateLayout() end end else local Button = Buttons:Add("DPanel") Button:SetSize(buttonx,buttony) Button:SetPaintBackground(false) end end end function ShowAdvCColorMenu() local panelx = 400 local panely = 400 if SERVER then return end local Main = vgui.Create("DFrame") Main:SetSize(panelx,panely) Main:Center() Main:MakePopup() Main:SetSizable(true) Main:SetTitle("Color Menu") local Panel = vgui.Create("DScrollPanel",Main) Panel:Dock(FILL) --[[local Warn = vgui.Create("DLabel",Panel) Warn:SetFont("DermaDefaultBold") Warn:SetText("NOTE: Text colors require a calculator restart to take effect!") Warn:SetTextColor(Color(255,255,0)) Warn:SizeToContents() Warn:Dock(TOP)]] for i=1,#AdvCalc.Colors do local Cat = vgui.Create("DCollapsibleCategory",Panel) Cat:Dock(TOP) Cat:SetLabel(AdvCalc.Translations[i] or "Color "..i) local Mixer = vgui.Create("DColorMixer", Cat) Mixer:SetPos(0,disttop) Mixer:SetColor(AdvCalc.Colors[i]) function Mixer:ValueChanged() AdvCalc.Colors[i] = Mixer:GetColor() end Cat:Toggle() end local Reset = vgui.Create("DButton",Panel) Reset:Dock(TOP) Reset:SetText("SAVE") Reset:SetTextColor(Color(0,127,0)) Reset.DoClick = function() local current = SysTime() chat.AddText(Color(255,255,0),"Saving...") file.Write('advcalccolors.txt', util.TableToJSON(AdvCalc.Colors)) chat.AddText(Color(0,255,0),"Finished in "..math.Round(SysTime()-current,6).."s!") end local Reset = vgui.Create("DButton",Panel) Reset:Dock(TOP) Reset:SetText("Reset All Colors") Reset:SetTextColor(Color(255,0,0)) Reset.DoClick = function() Derma_Query("Are you sure?","Confirm Color Reset","Yes",function() Main:Close() AdvCalc.Colors = { [1]=Color(0,0,0), [2]=Color(191,191,191), [3]=Color(127,127,127), [4]=Color(255,255,255), [5]=Color(255,255,0), [6]=Color(0,255,0), [7]=Color(0,255,255), [8]=Color(127,0,255), [9]=Color(0,127,255), [10]=Color(255,0,0), [11]=Color(31,31,31), [12]=Color(127,0,0), [13]=Color(255,255,191), [14]=Color(127,63,0), [15]=Color(0,0,0), [16]=Color(0,0,0), [17]=Color(255,255,255), [18]=Color(63,63,63), [19]=Color(255,255,255), [20]=Color(0,0,0), [21]=Color(255,255,255), [22]=Color(255,255,255), [23]=Color(255,0,0), [24]=Color(0,255,0) } end,"No") end end function ShowAdvCOptionMenu() local panelx = 400 local panely = 400 if SERVER then return end local Main = vgui.Create("DFrame") Main:SetSize(panelx,panely) Main:Center() Main:MakePopup() Main:SetSizable(true) Main:SetTitle("Option Menu") local Panel = vgui.Create("DScrollPanel",Main) Panel:Dock(FILL) --[[local Warn = vgui.Create("DLabel",Panel) Warn:SetFont("DermaDefaultBold") Warn:SetText("NOTE: Resizing options require a\ncalculator restart to take effect!") Warn:SetTextColor(Color(255,0,0)) Warn:SizeToContents() Warn:Dock(TOP) Warn:SetContentAlignment(8)]] --[[local Background = vgui.Create("DPanel",Panel) Background:Dock(FILL)]] local Form = vgui.Create("DForm",Panel) Form:Dock(TOP) Form:SetName("Options") Form:NumSlider("Button Length","advcalc_button_sizex",20,80,0) Form:NumSlider("Button Width","advcalc_button_sizey",20,80,0) Form:NumberWang("Roundness","advcalc_button_roundness",0,64,0) Form:NumberWang("Spacing","advcalc_button_spacing",0,80,0) Form:CheckBox("Button Sounds","advcalc_button_clicky") Form:CheckBox("Rainbow Option Buttons","advcalc_button_optionrainbow") Form:NumSlider("BG Speed","advcalc_color_cyclespeed",0,36,2) Form:NumSlider("BG Add Hue","advcalc_color_addhue",0,360,0) Form:NumSlider("BG Darkness","advcalc_color_darkness",0,1,2) Form:NumSlider("BG Saturation","advcalc_color_saturation",0,1,2) Form:CheckBox("Automatic Shift/Alpha Release","advcalc_button_autorelease") local Reset = vgui.Create("DButton",Panel) Reset:Dock(TOP) Reset:SetText("Reset All Options") Reset:SetTextColor(Color(255,0,0)) Reset.DoClick = function() Derma_Query("Are you sure?","Confirm Reset","Yes",function() Main:Close() ConX:SetInt(40) ConY:SetInt(40) ConR:SetInt(4) ConS:SetInt(2) ConO:SetBool(true) ConB:SetBool(true) ConP:SetInt(1) ConH:SetInt(0) ConV:SetFloat(0.5) ConT:SetInt(1) end,"No") end end function AdvCalcDrawGraph(minx,maxx,func,str) local panelx = 400 local panely = 400 local maximized = false local vcenter = maxx > 0 and minx < 0 local x_render,y_render,xval,yval if SERVER then return end local Main = vgui.Create("DFrame") Main:SetSize(panelx,panely) Main:Center() Main:MakePopup() Main:SetSizable(true) Main:SetTitle("Graph for "..str) Main:ShowCloseButton(false) Main.Paint = function(panel,w,h) draw.RoundedBox(4,0,0,w,h,HSVToColor((SysTime()*ConP:GetFloat()*10+ConH:GetInt())%360,ConT:GetFloat(),1-ConV:GetFloat())) end local XButton = vgui.Create("DButton",Main) XButton:SetPos(panelx-disttop,0) XButton:SetSize(disttop,disttop) XButton:SetFont("Marlett") XButton:SetText("r") XButton:SetTextColor(Color(255,255,255)) XButton.DoClick = function() Main:Close() end XButton.Paint = function(panel,w,h) --draw.SimpleText("r","Marlett",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) end local SButton = vgui.Create("DButton",Main) SButton:SetPos(panelx-disttop*2,0) SButton:SetSize(disttop,disttop) SButton:SetFont("Marlett") SButton:SetText("1") SButton:SetTextColor(Color(255,255,255)) SButton.DoClick = function() if maximized then Main:SetDraggable(true) Main:SetSizable(true) Main:SetSize(panelx,panely) Main:Center() maximized = false SButton:SetText("1") else Main:SetSize(ScrW(),ScrH()) Main:Center() Main:SetDraggable(false) Main:SetSizable(false) maximized = true SButton:SetText("2") end end SButton.Paint = function(panel,w,h) --draw.SimpleText(maximized and "2" or "1","Marlett",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) end function Main:PerformLayout(w,h) XButton:SetPos(w-disttop,0) SButton:SetPos(w-disttop*2,0) end local Background = vgui.Create("DButton",Main) Background:Dock(FILL) Background:SetCursor("crosshair") Background:SetText("") local results = results or {} local maxval = 0 local minval = 0 function Background:PerformLayout(w,h) results = {} for i=minx,maxx,(maxx-minx)/w do if tostring(func(i)) ~= "nan" then results[#results+1] = func(i) else results[#results+1] = "nan" end end for k,v in ipairs(results) do if v ~= "nan" then maxval = math.max(maxval,v) minval = math.min(minval,v) end end if maxval == minval then maxval = maxval + 0.0000001 minval = minval - 0.0000001 end if x_render then xval = (x_render/w)*(maxx-minx)+minx yval = func(xval) if tostring(yval) ~= "nan" then y_render = h-(yval-minval)*h/(maxval-minval) else y_render = "nan" end end end local inbuffer = 0 local Input = vgui.Create("DTextEntry",Main) Input:Dock(BOTTOM) Input:SetNumeric(true) Input.OnChange = function(self) inbuffer = tonumber(self:GetValue()) or 0 end local InputButton = vgui.Create("DButton",Main) InputButton:Dock(BOTTOM) InputButton:SetText("Set X-coordinate For Selected Point") InputButton.DoClick = function() local dx,dy = Background:GetSize() x_render = math.Clamp(((inbuffer-minx)/(maxx-minx))*dx,0,dx) Background:InvalidateLayout(true) end --Input:SetSize(funclen, 20) --Input:CenterHorizontal() --Input:SetText(modelname) --Background:InvalidateLayout(true) Background.Paint = function(panel,w,h) local xcenter = minval < 0 and maxval > 0 local halfw = vcenter and w*(-minx/(maxx-minx)) or w/2 local halfh = xcenter and h*(maxval/(maxval-minval)) or h/2 draw.NoTexture() surface.SetDrawColor(0,0,0) surface.DrawRect(0,0,w,h) draw.SimpleText("Currently rendering "..w.." points","HudHintTextSmall",0,0,AdvCalc.Colors[22]) surface.SetDrawColor(AdvCalc.Colors[24]) surface.DrawLine(halfw,0,halfw,h) draw.SimpleText(tostring(maxval),"DermaDefault",halfw,0,AdvCalc.Colors[24],TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP) draw.SimpleText(tostring(minval),"DermaDefault",halfw,h,AdvCalc.Colors[24],TEXT_ALIGN_RIGHT,TEXT_ALIGN_BOTTOM) surface.SetDrawColor(AdvCalc.Colors[23]) surface.DrawLine(0,halfh,w,halfh) draw.SimpleText(tostring(minx),"DermaDefault",0,halfh,AdvCalc.Colors[23],TEXT_ALIGN_LEFT,TEXT_ALIGN_TOP) draw.SimpleText(tostring(maxx),"DermaDefault",w,halfh,AdvCalc.Colors[23],TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP) if xcenter and vcenter then draw.SimpleText("0","DermaDefault",halfw,halfh,AdvCalc.Colors[24],TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP) draw.SimpleText("0","DermaDefault",halfw,halfh,AdvCalc.Colors[23],TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP) else local wx,hx = draw.SimpleText(vcenter and "0" or tostring((maxx+minx)/2),"DermaDefault",halfw,halfh,AdvCalc.Colors[23],TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP) draw.SimpleText(xcenter and "0" or tostring((maxval+minval)/2),"DermaDefault",halfw,halfh+hx,AdvCalc.Colors[24],TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP) end surface.SetDrawColor(AdvCalc.Colors[21]) for i=1,w-1 do if results[i] ~= "nan" and results[i+1] ~= "nan" then local xp = w/(w-1)*(i-1) local xp2 = w/(w-1)*(i) local yp = h-(results[i]-minval)*h/(maxval-minval) local yp2 = h-(results[i+1]-minval)*h/(maxval-minval) surface.DrawLine(xp,yp,xp2,yp2) end end if Background:IsDown() then local tx,ty = Background:CursorPos() x_render = math.Clamp(tx,0,w) xval = (x_render/w)*(maxx-minx)+minx yval = func(xval) if tostring(yval) ~= "nan" then y_render = h-(yval-minval)*h/(maxval-minval) else y_render = "nan" end end if x_render and y_render ~= "nan" then surface.DrawCircle(x_render,y_render,5,AdvCalc.Colors[21]) draw.SimpleText("("..xval..", "..yval..")","DermaDefault",x_render,y_render,AdvCalc.Colors[21],x_render > w/2 and TEXT_ALIGN_RIGHT or TEXT_ALIGN_LEFT,y_render < h/2 and TEXT_ALIGN_TOP or TEXT_ALIGN_BOTTOM) end end --[[Background.DoClick = function() local tx,ty = Background:CursorPos() local dx,dy = Background:GetSize() x_render = math.Clamp(tx,0,dx) Background:InvalidateLayout() end]] end
ENT.Type = "anim" ENT.Base = "gmod_wire_ramcard_proxybase" ENT.PrintName = "Proxy (24 Values / 100U)" ENT.Author = "Free Fall" ENT.Contact = "" ENT.Information = "A Proxy RAM-Card" ENT.Category = "RAM-Cards (Wire)" ENT.Spawnable = true ENT.AdminSpawnable = true
PayConfig = {}; --商品列表id PayConfig.eGoodsListId = { MarketGold = 1; --商城银币商品信息 MarketVip = 2; --商城VIP商品信息 MarketProp = 3; --商城道具商品信息 MarketHot = 4; --商城促销商品信息 (2.0没用了) MarketCrystal = 12; --商城金条商品信息 Broken = 5; --破产商品 HallPlus = 6; --快捷支付大厅加号 RoomPay = 7; --快捷支付房间内 (这个列表会根据gameid 和 level而变化) VipCharge = 8, --VIP支付 FirstRecharge = 9; --首冲 SecondePay = 10; --二次付费 Degrade = 11; --快捷支付入场 降级、入场 (这个列表会根据gameid 和 level而变化) AgentCard = 999; --代理年卡 } --枚举存储类型 PayConfig.eCacheType = { DictCache = 1; --需要保存到手机内, 下次启动先根据缓存加载数据 MemoryCache = 2; --保存到内存中, 游戏中只需拉取一次 NoCache = 3; --不需要进行缓存 } --商品列表存储类型映射表 PayConfig.GoodsListCacheMap = { [PayConfig.eCacheType.DictCache] = { PayConfig.eGoodsListId.MarketGold, PayConfig.eGoodsListId.MarketVip, PayConfig.eGoodsListId.MarketProp, PayConfig.eGoodsListId.MarketHot, PayConfig.eGoodsListId.MarketCrystal, }, [PayConfig.eCacheType.MemoryCache] = { PayConfig.eGoodsListId.Broken, PayConfig.eGoodsListId.AgentCard; } } --枚举支付场景 PayConfig.ePayScene = { Market = 1; --商城 Broken = 2; --破产 ChooseGoodsLayer = 3; --多个商品(如首冲) SingleGoodsLayer = 4, --快捷购买(如大厅加号) } --商品列表支付场景映射表 PayConfig.paySceneGoodsListMap = { [PayConfig.ePayScene.Market] = { PayConfig.eGoodsListId.MarketHot, PayConfig.eGoodsListId.MarketProp, PayConfig.eGoodsListId.MarketVip, PayConfig.eGoodsListId.MarketGold, PayConfig.eGoodsListId.MarketCrystal, }; [PayConfig.ePayScene.Broken] = { PayConfig.eGoodsListId.Broken; }; [PayConfig.ePayScene.ChooseGoodsLayer] = { PayConfig.eGoodsListId.FirstRecharge, PayConfig.eGoodsListId.SecondePay, }; [PayConfig.ePayScene.SingleGoodsLayer] = { PayConfig.eGoodsListId.HallPlus, PayConfig.eGoodsListId.Degrade, PayConfig.eGoodsListId.VipCharge, PayConfig.eGoodsListId.RoomPay, } } PayConfig.ALIPAY_NOTIFY_URL = "http://paycn.boyaa.com/pay_order_alipay_notify.php";--支付宝通知地址 --枚举支付渠道 PayConfig.ePayMode = { --本地定义 LOCAL_CRYSTAL_PMODE = "-123456789"; --本地定义的金条购买支付方式 --短信统称 SMS_PMODE = "0"; --短信支付(一个统称) --移动 MOBILE_PMODE = "31"; --移动基地 MMBILLING_WEAKONLINE_PMODE = "218"; --移动mm支付(弱联网) HUAFUBAOPAY_PMODE = "35"; --话付宝支付 SIKAI_WEAK_MM_PMODE = "341"; --斯凯弱网mm WORDS_FUBAO_PMODE = "349"; --话付宝 WORDS_FUBAO_BARE_PMODE = "644"; --话付宝裸码 MIGU_MUSIC_PMODE = "630"; --咪咕音乐支付 --联通 WO_PMODE = "109"; --WO支付 UNICOM_BARECARDBACK_PMODE = "308"; --联通裸码备用支付 UNICOM_FOURTHBAREBACK_PMODE = "462"; --联通第四套裸码 --电信 TELECOM_PMODE = "117"; --电信天翼支付 EGAME_PMODE = "34"; --爱游戏支付 EDONGMAN_PMODE = "282"; --电信爱动漫裸码 --other ALIPAY_PMODE = "244"; --支付宝极简版专业版 ALIPAY_STANDARD_PMODE = "265"; --支付宝极简版标准版 WEIXIN_V3_PMODE = "431"; --微信支付3.0 UNION_V2_PMODE = "198"; --银联支付2.0 TENTPAY_PMODE = "33"; --财付通; --其他联运支付 QI_HU_360_PMODE = "136"; --IOS LIAN_DONG_WEB_PMODE = "36"; --联动WEB(移动短信)-->IOS ALIPAY_WEB_PMODE = "26"; --支付宝(WEB版) WEIXIN_IOS_V3_PMODE = "463"; --微信IOS支付3.0 (SDK) APPLE_PMODE = "99"; --苹果支付 ALIPAY_STANDARD_PMODE_IOS = "265"; --支付宝极简版标准版(SDK) ALIPAY_STANDARD_PMODE_IOS_2 = "620"; --支付宝极简版标准版(SDK2) UNION_V2_PMODE_IOS = "198"; --银联支付 UNION_V2_PMODE_IOS_NEW = "728"; --新银联支付 } local payChannelIcons_pin_map = require("qnFiles/qnPlist/hall/payChannelIcons_pin"); PayConfig.ePayModeIconMap = { { icon = payChannelIcons_pin_map["pmode_4.png"], --支付宝 pmodeList = { PayConfig.ePayMode.ALIPAY_PMODE, PayConfig.ePayMode.ALIPAY_STANDARD_PMODE, PayConfig.ePayMode.ALIPAY_WEB_PMODE, PayConfig.ePayMode.ALIPAY_STANDARD_PMODE_IOS, PayConfig.ePayMode.ALIPAY_STANDARD_PMODE_IOS_2, }, }; { icon = payChannelIcons_pin_map["pmode_33.png"], --财付通 pmodeList = { PayConfig.ePayMode.TENTPAY_PMODE, }, }; { icon = payChannelIcons_pin_map["pmode_99.png"], --苹果 pmodeList = { PayConfig.ePayMode.APPLE_PMODE, }, }; { icon = payChannelIcons_pin_map["pmode_171.png"], --微信 pmodeList = { PayConfig.ePayMode.WEIXIN_V3_PMODE, PayConfig.ePayMode.WEIXIN_IOS_V3_PMODE, }, }; { icon = payChannelIcons_pin_map["pmode_198.png"], --银联 pmodeList = { PayConfig.ePayMode.UNION_V2_PMODE, PayConfig.ePayMode.UNION_V2_PMODE_IOS, PayConfig.ePayMode.UNION_V2_PMODE_IOS_NEW, }, }; { icon = payChannelIcons_pin_map["pmode_crystal.png"], --金条 pmodeList = { PayConfig.ePayMode.LOCAL_CRYSTAL_PMODE, }, }; { icon = payChannelIcons_pin_map["pmode_136.png"], --360联运 pmodeList = { PayConfig.ePayMode.QI_HU_360_PMODE, }, } }
-- Copyright 2015 Daniel Dickinson <openwrt@daniel.thecshore.com> -- Licensed to the public under the Apache License 2.0. local m, s, o local nixio = require "nixio" require "luci.util" m = Map("nut_server", translate("Network UPS Tools (Server)"), translate("Network UPS Tools Server Configuration")) s = m:section(TypedSection, "user", translate("NUT Users")) s.addremove = true s.anonymous = true o = s:option(Value, "username", translate("Username")) o.optional = false o = s:option(Value, "password", translate("Password")) o.password = true o.optional = false o = s:option(MultiValue, "actions", translate("Allowed actions")) o.widget = "select" o:value("set", translate("Set variables")) o:value("fsd", translate("Forced Shutdown")) o.optional = true o = s:option(DynamicList, "instcmd", translate("Instant commands"), translate("Use upscmd -l to see full list which the commands your UPS supports (requires upscmd package)")) o.optional = true o = s:option(ListValue, "upsmon", translate("Role")) o:value("slave", translate("Slave")) o:value("master", translate("Master")) o.optional = false s = m:section(TypedSection, "listen_address", translate("Addresses on which to listen")) s.addremove = true s.anonymous = true o = s:option(Value, "address", translate("IP Address")) o.optional = false o.datatype = "ipaddr" o.placeholder = "127.0.0.1" o = s:option(Value, "port", translate("Port")) o.optional = true o.datatype = "port" o.placeholder = "3493" s = m:section(NamedSection, "upsd", "upsd", translate("Global Settings")) s.addremove = true o = s:option(Value, "maxage", translate("Maximum Age of Data"), translate("Period after which data is considered stale")) o.datatype = "uinteger" o.optional = true o.placeholder = 15 o = s:option(Value, "runas", translate("RunAs User"), translate("Drop privileges to this user")) o.optional = true o.placeholder = "nut" o = s:option(Value, "statepath", translate("Path to state file")) o.optional = true o.placeholder = "/var/run/nut" o = s:option(Value, "maxconn", translate("Maximum connections")) o.optional = true o.datatype = "uinteger" o.placeholder = 24 if luci.util.checklib("/usr/sbin/upsd", "libssl.so") then o = s:option(Value, "certfile", translate("Certificate file (SSL)")) o.optional = true end s = m:section(TypedSection, "driver", translate("Driver Configuration"), translate("The name of this section will be used as UPS name elsewhere")) s.addremove = true s.anonymous = false driverlist = nixio.fs.dir("/lib/nut") o = s:option(ListValue, "driver", translate("Driver")) for driver in driverlist do o:value(driver) end o.optional = false o = s:option(Value, "port", translate("Port")) o.optional = false o.default = "auto" o = s:option(Value, "mfr", translate("Manufacturer (Display)")) o.optional = true o = s:option(Value, "model", translate("Model (Display)")) o.optional = true o = s:option(Value, "serial", translate("Serial Number")) o.optional = true o = s:option(Value, "sdtime", translate("Additional Shutdown Time(s)")) o.optional = true o = s:option(Value, "offdelay", translate("Off Delay(s)"), translate("Delay for kill power command")) o.optional = true o.placeholder = 20 n = s:option(Value, "ondelay", translate("On Delay(s)"), translate("Delay to power on UPS if power returns after kill power")) n.optional = true n.placeholder = 30 function o.validate(self, cfg, value) if n:cfgvalue(cfg) <= value then return nil end end function n.validate(self, cfg, value) if o:cfgvalue(cfg) >= value then return nil end end o = s:option(Value, "pollfreq", translate("Polling Frequency(s)")) o.optional = true o.datatype = "integer" o.placeholder = 30 o = s:option(Value, "vendor", translate("Vendor (regex)")) o.optional = true o = s:option(Value, "product", translate("Product (regex)")) o.optional = true o = s:option(Value, "bus", translate("USB Bus(es) (regex)")) o.optional = true o.datatype = "uinteger" o = s:option(Flag, "interruptonly", translate("Interrupt Only")) o.optional = true o.default = false o = s:option(Value, "interruptsize", translate("Interrupt Size"), translate("Bytes to read from interrupt pipe")) o.optional = true o.datatype = "integer" o = s:option(Value, "maxreport", translate("Max USB HID Length Reported"), translate("Workaround for buggy firmware")) o.optional = true o.datatype = "integer" o.default = nil o = s:option(Value, "vendorid", translate("USB Vendor Id")) o.optional = true o = s:option(Value, "productid", translate("USB Product Id")) o.optional = true o = s:option(Value, "runas", translate("RunAs User"), translate("User as which to execute driver; requires device file accessed by driver be read-write for that user.")) o.optional = true o.placeholder = "nut" o = s:option(Value, "community", translate("SNMP Community")) o.optional = true o.placeholder = "private" o = s:option(ListValue, "snmp_version", translate("SNMP version")) o.optional = true o:value("v1", translate("SNMPv1")) o:value("v2c", translate("SNMPv2c")) o:value("v3", translate("SNMPv3")) o:value("", "") o.default = "" o = s:option(Value, "snmp_retries", translate("SNMP retries")) o.optional = true o.datatype = "uinteger" o = s:option(Value, "snmp_timeout", translate("SNMP timeout(s)")) o.optional = true o.datatype = "uinteger" o = s:option(Flag, "notransferoids", translate("No low/high voltage transfer OIDs")) o.optional = true o.default = false o = s:option(Value, "other", translate("Additional Parameters")) o.optional = true return m
--[[ A library providing advanced list support and better optimizations for list-based operations. ]] _libs = _libs or {} _libs.lists = true _libs.tablehelper = _libs.tablehelper or require 'tablehelper' _raw = _raw or {} _raw.table = _raw.table or {} list = {} _meta = _meta or {} _meta.L = {} _meta.L.__index = function(l, k) if list[k] ~= nil then return list[k] else return T(l)[k] end end _meta.L.__class = 'List' function L(t) local l if class(t) == 'Set' then l = L{} for el in pairs(t) do l:append(el) end else l = t or {} end l.n = #l return setmetatable(l, _meta.L) end function list.empty(l) return l.n == 0 end function list.length(l) return l.n end _meta.L.__len = list.length function list.append(l, el) l.n = l.n + 1 l[l.n] = el end function list.last(l, i) return l[l.n - (i and i - 1 or 0)] end function list.insert(l, i, el) l.n = l.n + 1 table.insert(l, i, el) end function list.remove(l, i) i = i or l.n local res = l[i] for key = i, l.n do l[key] = l[key + 1] end l.n = l.n - 1 return res end function list.extend(l1, l2) local n1 = l1.n local n2 = l2.n for k = 1, n2 do l1[n1 + k] = l2[k] end l1.n = n1 + n2 return l1 end function list.contains(l, el) for _, val in ipairs(l) do if val == el then return true end end return false end function list.count(l, fn) local count = 0 if type(fn) ~= 'function' then for _, val in ipairs(l) do if val == fn then count = count + 1 end end else for _, val in ipairs(l) do if fn(val) then count = count + 1 end end end return count end function list.concat(l, str, from, to) str = str or '' from = from or 1 to = to or l.n local res = '' for key = from, to do res = res..tostring(rawget(l, key)) if key < l.n then res = res..str end end return res end function list.clear(l) for key in ipairs(l) do l[key] = nil end l.n = 0 return l end function list.with(l, attr, val) for _, el in ipairs(l) do if type(el) == 'table' and rawget(el, attr) == val then return el end end end function list.iwith(l, attr, val) local cel val = val:lower() for _, el in ipairs(l) do if type(el) == 'table' then cel = rawget(el, attr) if type(cel) == 'string' and cel:lower() == val then return el end end end end function list.map(l, fn) local res = {} for key, val in ipairs(l) do res[key] = fn(val) end res.n = l.n return setmetatable(res, _meta.L) end function list.filter(l, fn) local res = {} local key = 0 local val for okey = 1, l.n do val = rawget(l, okey) if fn(val) == true then key = key + 1 res[key] = val end end res.n = key return setmetatable(res, _meta.L) end function list.reduce(l, fn, init) local acc = init for _, val in ipairs(l) do if acc == nil then acc = val else acc = fn(acc, val) end end return acc end function list.flatten(l, rec) rec = true and (rec ~= false) local res = {} local key = 1 local val local flat local n2 for k1 = 1, l.n do val = l[key] if type(val) == 'table' then if rec then flat = list.flatten(val, rec) n2 = flat.n for k2 = 1, n2 do res[key + k2] = flat[k2] end key = key + n2 else n2 = #val for k2 = 1, n2 do res[key + k2] = val[k2] end end key = key + n2 else res[key] = val key = key + 1 end end res.n = key return setmetatable(res, _meta.L) end function list.it(l) local key = 0 return function() key = key + 1 return l[key], key end end function list.equals(l1, l2) if l1.n ~= l2.n then return false end for key, val in ipairs(l1) do if val ~= l2[key] then return false end end return true end function list.slice(l, from, to) local n = l.n from = from or 1 if from < 0 then from = (from % n) + 1 end to = to or n if to < 0 then to = (to % n) + 1 end local res = {} local key = 0 for i = from, to do key = key + 1 res[key] = l[i] end res.n = key return setmetatable(res, _meta.L) end function list.splice(l1, from, to, l2) -- TODO end _raw.table.sort = _raw.table.sort or table.sort function list.sort(l, ...) _raw.table.sort(l, ...) return l end function list.reverse(l) local res = {} local n = l.n local rkey = n for key = 1, n do res[key] = l[rkey] rkey = rkey - 1 end res.n = n return setmetatable(res, _meta.L) end function list.range(n) local res = {} for key = 1, n do res[key] = key end res.n = n return setmetatable(res, _meta.L) end function list.any(l, fn) for _, val in ipairs(l) do if fn(val) == true then return true end end return false end function list.all(l, fn) for _, val in ipairs(l) do if fn(val) ~= true then return false end end return true end function list.tostring(l) local str = '[' for key, val in ipairs(l) do if key > 1 then str = str..', ' end str = str..tostring(val) end return str..']' end _meta.L.__tostring = list.tostring
local lib = {} local function get_settings_path() return emu.subst_env(manager.machine.options.entries.homepath:value():match('([^;]+)')) .. '/autofire' end local function get_settings_filename() return emu.romname() .. '.cfg' end local function initialize_button(settings) if settings.port and settings.mask and settings.type and settings.key and settings.on_frames and settings.off_frames then local ioport = manager.machine.ioport local new_button = { port = settings.port, mask = settings.mask, type = ioport:token_to_input_type(settings.type), key = manager.machine.input:seq_from_tokens(settings.key), key_cfg = settings.key, on_frames = settings.on_frames, off_frames = settings.off_frames, counter = 0 } local port = ioport.ports[settings.port] if port then local field = port:field(settings.mask) if field and (field.type == new_button.type) then new_button.button = field end end return new_button end return nil end local function serialize_settings(button_list) local settings = {} for index, button in ipairs(button_list) do local setting = { port = button.port, mask = button.mask, type = manager.machine.ioport:input_type_to_token(button.type), key = button.key_cfg, on_frames = button.on_frames, off_frames = button.off_frames } table.insert(settings, setting) end return settings end function lib:load_settings() local buttons = {} local json = require('json') local filename = get_settings_path() .. '/' .. get_settings_filename() local file = io.open(filename, 'r') if not file then return buttons end local loaded_settings = json.parse(file:read('a')) file:close() if not loaded_settings then emu.print_error(string.format('Error loading autofire settings: error parsing file "%s" as JSON', filename)) return buttons end for index, button_settings in ipairs(loaded_settings) do local new_button = initialize_button(button_settings) if new_button then buttons[#buttons + 1] = new_button end end return buttons end function lib:save_settings(buttons) local path = get_settings_path() local attr = lfs.attributes(path) if not attr then lfs.mkdir(path) elseif attr.mode ~= 'directory' then emu.print_error(string.format('Error saving autofire settings: "%s" is not a directory', path)) return end local filename = path .. '/' .. get_settings_filename() if #buttons == 0 then os.remove(filename) return end local json = require('json') local settings = serialize_settings(buttons) local data = json.stringify(settings, {indent = true}) local file = io.open(filename, 'w') if not file then emu.print_error(string.format('Error saving autofire settings: error opening file "%s" for writing', filename)) return end file:write(data) file:close() end return lib
function onCreate() -- background shit makeLuaSprite('sky3', 'sky3', -600, -300); setScrollFactor('sky3', 0.9, 0.9); makeLuaSprite('ground', 'ground', -650, 600); setScrollFactor('ground', 0.9, 0.9); scaleObject('ground', 1.1, 1.1); makeLuaSprite('trees', 'trees', -500, -300); setScrollFactor('trees', 1.3, 1.3); scaleObject('trees', 0.9, 0.9); addLuaSprite('sky3', false); addLuaSprite('ground', false); addLuaSprite('trees', false); close(true); --For performance reasons, close this script once the stage is fully loaded, as this script won't be used anymore after loading the stage end
id = 'V-38460' severity = 'low' weight = 10.0 title = 'The NFS server must not have the all_squash option enabled.' description = 'The "all_squash" option maps all client requests to a single anonymous uid/gid on the NFS server, negating the ability to track file access by user ID.' fixtext = [=[Remove any instances of the "all_squash" option from the file "/etc/exports". Restart the NFS daemon for the changes to take effect. # service nfs restart]=] checktext = [=[If the NFS server is read-only, in support of unrestricted access to organizational content, this is not applicable. The related "root_squash" option provides protection against remote administrator-level access to NFS server content. Its use is not a finding. To verify the "all_squash" option has been disabled, run the following command: # grep all_squash /etc/exports If there is output, this is a finding.]=] function test() end function fix() end
local mt = FindMetaTable("Player") // Overwrite default IsAdmin to return whether the player meets the hierarchial requirement for at least one rank local isadmin = mt.IsAdmin function mt:IsAdmin() local ourHeir = self:getHierarchy() // Find the admin rank and determine if its set hierarchy is lte for rankid, info in ndoc.pairs(ndoc.table.am.permissions) do if (info.name == am.config.admin_rank) then if (ourHeir > info.hierarchy) then return true end end end return isadmin(self) end // Determines if a user has the correct hierarchy to be considered a superadmin local issa = mt.IsSuperAdmin function mt:IsSuperAdmin() local ourHeir = self:getHierarchy() // Find the superadmin rank and determine if its set hierarchy is lte for rankid, info in ndoc.pairs(ndoc.table.am.permissions) do if (info.name == am.config.superadmin_rank) then if (ourHeir > info.hierarchy) then return true end end end return issa(self) end // Returns a list of the rank ids for a user function mt:getRankIds() return ndoc.table.am.users[ self:SteamID() ] end // Determines whether a user is a user group local isug = mt.IsUserGroup function mt:IsUserGroup(str) if (self:getRankIds() == nil) then return false end for rankid,serverIds in ndoc.pairs(self:getRankIds()) do if (!serverIds[am.config.server_id] && !serverIds[0]) then continue end if (ndoc.table.am.permissions[rankid].name == str) then return true end end return false end // Returns the highest user group of a user local gug = mt.GetUserGroup function mt:GetUserGroup() local _, rankid = self:getHierarchy() return ndoc.table.am.permissions[rankid].name end // Determines whether a player has the correct rank to execute a permission function mt:hasPerm(perm) local rankids = self:getRankIds() for rankid, _ in ndoc.pairs(rankids) do for _, p in ndoc.pairs(ndoc.table.am.permissions[rankid].perm) do if (p == perm || p == "*") then return true end end end return false end // Returns whether the player is in admin mode function mt:inAdminMode() return SERVER && self.adminmode || self:GetNWBool("inAdminMode") end // Return the largest hierarchial value and the corresponding rankid for a user function mt:getHierarchy() local ourLargestHeirarchy = 0 local ourLargestRank // We don't have any data for the user if (!ndoc.table.am.users[ self:SteamID() ]) then return 0, 0 end // Loop through the user's ranks for rankId,serverIds in ndoc.pairs(ndoc.table.am.users[ self:SteamID() ]) do if (!serverIds[am.config.server_id] && !serverIds[0]) then continue end local curHeirarchy = ndoc.table.am.permissions[ rankId ].hierarchy if (curHeirarchy > ourLargestHeirarchy) then ourLargestHeirarchy = curHeirarchy ourLargestRank = rankId end end return ourLargestHeirarchy, ourLargestRank end // Returns the number in seconds that a player has been on the server function mt:getPlayTime() local pastTime = ndoc.table.am.play_times[self:SteamID()] if (!pastTime) then pastTime = 0 end return CurTime() - self._joinTime + pastTime end hook.Add('PlayerNoClip', 'cannoclip', function(ply) return ply:hasPerm("noclip") and ply:inAdminMode() end) // Returns a table of all online admin players function am.getAdmins() local temp = {} // Find admins for k,v in pairs(player.GetAll()) do if (!v:IsAdmin()) then continue end table.insert(temp, v) end return temp end
require 'torch' require 'optim' require 'nn' -- {corn, fertilizer, insecticide} data = torch.Tensor{ {40, 6, 4}, {44, 10, 4}, {46, 12, 5}, {48, 14, 7}, {52, 16, 9}, {58, 18, 12}, {60, 22, 14}, {68, 24, 20}, {74, 26, 21}, {80, 32, 24} } ninputs = 2; noutputs = 1; model = nn.Sequential() model:add(nn.Linear(ninputs, noutputs)) loss_criterion = nn.MSECriterion() x, dl_dx = model:getParameters() feval = function(x_new) if x ~= x_new then x:copy(x_new) end _nidx_ = (_nidx_ or 0) + 1 if _nidx_ > (#data)[1] then _nidx_ = 1 end local sample = data[_nidx_] local inputs = sample[{{2, 3}}] local target = sample[{{1}}] dl_dz.zero() local loss_x = loss_criterion:forward(model:forward(inputs), target) model:backwards(inputs, loss_criterion:backward(model.output, target)) end
local discordia = require("discordia") local Date, Time = discordia.Date, discordia.Time local function isOwnerAuthored(msg) return msg.author == msg.client.owner end local function isBotAuthored(msg) return msg.author == msg.client.user end local function canBulkDelete(msg) return msg.id > (Date() - Time.fromWeeks(2)):toSnowflake() end local function isOnline(member) return member.status ~= "offline" end return { isBotAuthored = isBotAuthored, isOwnerAuthored = isOwnerAuthored, canBulkDelete = canBulkDelete, isOnline = isOnline }
-- This file is subject to copyright - contact swampservers@gmail.com for more information. net.Receive("PonyCfg", function(len) local ply = net.ReadEntity() local cfg = net.ReadTable() if IsValid(ply) then PPM_SetPonyCfg(ply, cfg) end end) net.Receive("PonyInvalidate", function(len) local ply = net.ReadEntity() if IsValid(ply) then ply.UpdatedPony = nil end end) function PPM_Load(filename) local str = file.Read("data/ppm/" .. filename, "GAME") local lines = string.Split(str, "\n") local ponydata = {} for k, v in pairs(lines) do local args = string.Split(string.Trim(v), " ") local name = string.Replace(args[1], "pny_", "") if (table.Count(args) == 2) then ponydata[name] = tonumber(args[2]) elseif (table.Count(args) == 4) then ponydata[name] = Vector(tonumber(args[2]), tonumber(args[3]), tonumber(args[4])) elseif (table.Count(args) == 3) then if args[2] == "b" then ponydata[name] = tobool(args[3]) elseif args[2] == "s" then ponydata[name] = args[3] end end end PPM_SetPonyCfg(LocalPlayer(), SanitizePonyCfg(ponydata)) end function PPM_Randomize() local ponydata = {} ponydata.kind = math.Round(math.Rand(1, 4)) ponydata.gender = math.Round(math.Rand(1, 2)) ponydata.body_type = 1 ponydata.mane = math.Round(math.Rand(1, 15)) ponydata.manel = math.Round(math.Rand(1, 12)) ponydata.tail = math.Round(math.Rand(1, 14)) ponydata.tailsize = math.Rand(0.8, 1) ponydata.eye = math.Round(math.Rand(1, PPM.EYES_COUNT)) ponydata.eyelash = math.Round(math.Rand(1, 5)) ponydata.coatcolor = Vector(math.Rand(0, 1), math.Rand(0, 1), math.Rand(0, 1)) for I = 1, 6 do ponydata["haircolor" .. I] = Vector(math.Rand(0, 1), math.Rand(0, 1), math.Rand(0, 1)) end for I = 1, 8 do ponydata["bodydetail" .. I] = 1 ponydata["bodydetail" .. I .. "_c"] = Vector(0, 0, 0) end ponydata.cmark = math.Round(math.Rand(1, PPM.MARK_COUNT)) ponydata.bodyweight = math.Rand(0.8, 1.2) ponydata.bodyt0 = 1 --math.Round(math.Rand(1,4)) ponydata.bodyt1_color = Vector(math.Rand(0, 1), math.Rand(0, 1), math.Rand(0, 1)) local iriscolor = Vector(math.Rand(0, 1), math.Rand(0, 1), math.Rand(0, 1)) * 2 ponydata.eyecolor_bg = Vector(1, 1, 1) ponydata.eyeirissize = 0.7 + math.Rand(-0.1, 0.1) ponydata.eyecolor_iris = iriscolor ponydata.eyecolor_grad = iriscolor / 3 ponydata.eyecolor_line1 = iriscolor * 0.9 ponydata.eyecolor_line2 = iriscolor * 0.8 ponydata.eyeholesize = 0.7 + math.Rand(-0.1, 0.1) ponydata.eyecolor_hole = Vector(0, 0, 0) -- TODO assert(ponydata == SanitizePonyCfg(ponydata)) PPM_SetPonyCfg(LocalPlayer(), SanitizePonyCfg(ponydata)) end function PPM_Save(filename) local saveframe = {} for k, v in SortedPairs(LocalPlayer().ponydata) do if type(v) == "number" then table.insert(saveframe, "\n " .. k .. " " .. tostring(v)) elseif type(v) == "Vector" then table.insert(saveframe, "\n " .. k .. " " .. tostring(v)) elseif type(v) == "boolean" then table.insert(saveframe, "\n " .. k .. " b " .. tostring(v)) elseif type(v) == "string" then table.insert(saveframe, "\n " .. k .. " s " .. string.Replace(v, " ", "")) end end saveframe = table.concat(saveframe) if not string.EndsWith(filename, ".txt") then filename = filename .. ".txt" end if not file.Exists("ppm", "DATA") then file.CreateDir("ppm") end MsgN("saving .... " .. "ppm/" .. filename) file.Write("ppm/" .. filename, saveframe) end function ReloadCurrentPony() if (file.Exists("ppm/_current.txt", "DATA")) then PPM_Load("_current.txt") else PPM_Randomize() end SendLocalPonyCfg() end hook.Add("Think", "PPM_Loader", function() -- and LocalPlayer():IsPPMPony() then --disabled so it appears in shop if IsValid(LocalPlayer()) then ReloadCurrentPony() hook.Remove("Think", "PPM_Loader") end end) function SendLocalPonyCfg() local tab = LocalPlayer().ponydata assert(istable(tab)) -- if not istable(tbl) then return end -- if (delays > CurTime()) then return end -- delays = CurTime() + 3 -- local json = util.TableToJSON(tbl) -- local comp = util.Compress(json) -- PPM.SentPonyData = comp -- local length = #comp net.Start("PonyCfg") -- net.WriteData(comp, length) net.WriteTable(tab) net.SendToServer() end
local childprocess = require('childprocess') local core = require('core') local stream = require('stream') local Process = core.Emitter:extend() function Process:initialize() self._uv_process = nil self.stdin = stream.Writable:new() self.stdout = stream.Readable:new() self.stderr = stream.Readable:new() end function wrap_readable(uv_readable, readable) readable:wrap(uv_readable) end function wrap_writable(uv_writable, writable) writable._write = function(self, data, encoding, callback) uv_writable:write(data, callback) end writable:once('finish', function() uv_writable:close() end) end function relay_events(proc, events) for k,v in pairs(events) do proc._uv_process:on(v, function(...) proc:emit(v, ...) end) end end return function(command, args, options) local proc = Process:new() proc._uv_process = childprocess.spawn(command, args, options) wrap_writable(proc._uv_process.stdin, proc.stdin) wrap_readable(proc._uv_process.stdout, proc.stdout) wrap_readable(proc._uv_process.stderr, proc.stderr) relay_events(proc, {'exit'}) return proc end
local o = vim.o local gl = require('galaxyline') local condition = require('galaxyline.condition') local gls = gl.section gl.short_line_list = {'LuaTree','vista','dbui'} o.showmode = false -- Hide mode as it's provided by the plugin o.laststatus = 2 -- Show status line o.showtabline = 2 -- Show tabline local colors = { bg = '#151718', line_bg = '#151718', line_fg = '#4f5560', sep = '#0f1112', fg = '#abb2bf', black = '#1d1f21', yellow = '#e5c07b', cyan = '#56b6c2', darkblue = '#081633', green = '#98c379', orange = '#d19a66', purple = '#5d4d7a', magenta = '#c678dd', grey = '#abb2bf', blue = '#61afef', red = '#e06c75' } local get_lsp_client = function (msg) msg = msg or 'No Active Lsp' local buf_ft = vim.api.nvim_buf_get_option(0,'filetype') local buf_clients = vim.lsp.buf_get_clients() if next(buf_clients) == nil then return msg end for _,client in ipairs(buf_clients) do local filetypes = client.config.filetypes if filetypes and vim.fn.index(filetypes,buf_ft) ~= -1 and client.name ~= 'null-ls' then return client.name end end return msg end gls.left[1] = { FirstElement = { provider = function() return ' ' end, highlight = { colors.line_fg, colors.line_bg } }, } gls.left[2] = { ViMode = { provider = function() local alias = { n = { color = colors.line_fg, name = 'NORMAL' }, i = { color = colors.green, name = 'INSERT' }, v = { color = colors.blue, name = 'VISUAL' }, [''] = { color = colors.blue, name = 'VISUAL' }, V = { color = colors.blue, name = 'VISUAL' }, c = { color = colors.red, name = 'COMMAND' }, no = { color = colors.magenta, name = 'NORMAL' }, s = { color = colors.orange, name = 'NORMAL' }, S = { color = colors.orange, name = 'NORMAL' }, [''] = { color = colors.orange, name = 'NORMAL' }, ic = { color = colors.yellow, name = 'NORMAL' }, R = { color = colors.purple, name = 'NORMAL' }, Rv = { color = colors.purple, name = 'NORMAL' }, cv = { color = colors.red, name = 'NORMAL' }, ce = { color = colors.red, name = 'NORMAL' }, r = { color = colors.cyan, name = 'NORMAL' }, rm = { color = colors.cyan, name = 'NORMAL' }, ['r?'] = { color = colors.cyan, name = 'NORMAL' }, ['!'] = { color = colors.red, name = 'NORMAL' }, t = { color = colors.green, name = 'TERMINAL' }, } vim.api.nvim_command('hi GalaxyViMode guifg='..alias[vim.fn.mode()].color) return alias[vim.fn.mode()].name end, separator = '▕', separator_highlight = { colors.sep, colors.line_bg }, highlight = {colors.line_fg, colors.line_bg, 'bold'}, }, } gls.left[3] = { GitIcon = { provider = function() return '  ' end, condition = condition.check_git_workspace, highlight = { colors.orange, colors.line_bg}, } } gls.left[4] = { GitBranch = { provider = 'GitBranch', condition = condition.check_git_workspace, separator = '▕ ', separator_highlight = { colors.sep, colors.line_bg }, highlight = { colors.line_fg, colors.line_bg }, } } gls.left[5] ={ FileIcon = { provider = 'FileIcon', condition = condition.buffer_not_empty, highlight = { require('galaxyline.providers.fileinfo').get_file_icon_color, colors.line_bg }, }, } gls.left[6] = { FileName = { provider = {'FileName','FileSize'}, condition = condition.buffer_not_empty, separator = '▕', separator_highlight = { colors.sep, colors.line_bg }, highlight = { colors.line_fg, colors.line_bg } } } gls.left[7] = { LspClient = { provider = get_lsp_client, icon = ' ﮧ ', separator = ' ', separator_highlight = { colors.sep, colors.line_bg }, condition = condition.check_active_lsp, highlight = { colors.line_fg, colors.line_bg }, } } gls.left[8] = { DiagnosticWarn = { provider = 'DiagnosticWarn', icon = '  ', separator = ' ', separator_highlight = { colors.sep, colors.line_bg }, highlight = { colors.yellow, colors.line_bg }, } } gls.left[9] = { DiagnosticError = { provider = 'DiagnosticError', icon = '  ', separator = ' ', separator_highlight = { colors.sep, colors.line_bg }, highlight = { colors.red, colors.line_bg }, } } gls.right[1] = { DiffAdd = { provider = 'DiffAdd', condition = condition.hide_in_width, icon = '  ', highlight = { colors.green, colors.line_bg }, } } gls.right[2] = { DiffModified = { provider = 'DiffModified', condition = condition.hide_in_width, icon = '  ', highlight = { colors.orange, colors.line_bg }, } } gls.right[3] = { DiffRemove = { provider = 'DiffRemove', condition = condition.hide_in_width, icon = '  ', highlight = { colors.red, colors.line_bg }, } } gls.right[4] = { Space = { provider = function () return ' ' end, condition = condition.hide_in_width, separator = '▕', separator_highlight = { colors.sep, colors.line_bg }, highlight = { colors.line_fg, colors.line_bg }, } } gls.right[5]= { FileFormat = { provider = 'FileFormat', highlight = { colors.line_fg, colors.line_bg } } } gls.right[6] = { LineInfo = { provider = 'LineColumn', separator = '▕ ', separator_highlight = { colors.sep, colors.line_bg }, highlight = { colors.line_fg, colors.line_bg } }, } gls.right[7] = { PerCent = { provider = 'LinePercent', separator = '▕', separator_highlight = { colors.sep, colors.line_bg }, highlight = { colors.line_fg, colors.line_bg } } } gls.short_line_left[1] ={ FileIcon = { provider = 'FileIcon', condition = condition.buffer_not_empty, highlight = { require('galaxyline.providers.fileinfo').get_file_icon_color, colors.line_bg }, }, } gls.short_line_left[2] = { FileName = { provider = 'SFileName', condition = condition.buffer_not_empty, highlight = { colors.line_fg, colors.line_bg } } } gls.short_line_right[1] = { LineInfo = { provider = 'LineColumn', highlight = { colors.line_fg, colors.line_bg } }, } gls.short_line_right[2] = { BufferIcon = { provider= 'BufferIcon', highlight = { colors.line_fg, colors.line_bg }, }, }
require 'cairo' rex = require 'rex_pcre' utf8 = require 'utf8' w_width, w_height = 120, 100 -- Widget path path = '/home/yonigger/.config/conky/weather' -- Font f = {'Noto Sans', 13} f_err = {'lemon', 10} -- Colors text_rgba = {0.4, 0.35, 0.36, 1} sun_rgba = {0.8, 0.3, 0.2, 1} -- {1.00, 0.87, 0.50, 1} clouds_rgba = {0.4, 0.35, 0.36, 1} -- {0.7, 0.7, 0.7, 1} snow_rgba = {0.4, 0.35, 0.36, 1} -- {1, 1, 1, 1} rain_rgba = {0.4, 0.35, 0.36, 1} -- {0.56, 0.76, 0.89, 1} storm_rgba = {0.4, 0.35, 0.36, 1} function conky_main() if conky_window == nil then return end -- init local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height) local cr = cairo_create(cs) cairo_push_group(cr) -- TODO http://w3.impa.br/~diego/software/luasocket & http://luaxpath.luaforge.net -- local weather = 'Mon -3 s3c2\nTue 21 \nWed 0 c4r2st' local weather = conky_parse('${exec python ' .. path .. '/src/parse-gismeteo.py}') if not handle_error(cr, weather) then cairo_select_font_face(cr, f[1], CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL) cairo_set_font_size(cr, f[2]) local ext = cairo_text_extents_t:create() tolua.takeownership(ext) local max_width = { total = 0 } cairo_text_extents(cr, '–', ext) max_width.n = ext.width cairo_text_extents(cr, '+', ext) max_width.p = ext.width local data = {} for d, t, w in rex.gmatch(weather, '(\\w+)\\s(-?\\d+)\\s([0-9rsct]*)') do table.insert(data, {day = d, temp = t, weather = parse_weather(w)}) -- max_width.total calculated excluding numerical value of temp, only 'Wed–<sign>' cairo_text_extents(cr, text_dt(d, t), ext) max_width.total = math.max(max_width.total, ext.width) end ext = nil for i, fc in ipairs(data) do draw_weather(cr, 15, 2*37 - 37 * (i - 1), fc, max_width) end end cairo_pop_group_to_source(cr) cairo_paint(cr) cairo_destroy(cr) cairo_surface_destroy(cs) end function parse_weather(weather) res = {} for i, v in rex.gmatch(weather, '(st|[rsc])(\\d|)') do res[i] = v or true end return res end function handle_error(cr, weather) if weather:sub(1, 4) ~= 'ERR:' then return false end draw_img(cr, -12, 0, 'st', sun_rgba) cairo_select_font_face(cr, f_err[1], CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL) cairo_set_font_size(cr, f_err[2]) set_rgba(cr, text_rgba) ml_text(cr, weather, 13, 0, w_width - 13, 1.5) return true end function ml_text(cr, txt, x, y, w, lr) local ext = cairo_text_extents_t:create() tolua.takeownership(ext) cairo_text_extents(cr, 'X', ext) local line = 1 local t -- line text local lh = ext.height * lr -- line height for word in utf8.gmatch(txt, '%S+') do local i repeat i = 0 local tt repeat i = i + 1 tt = (t and (t .. ' ') or '') .. utf8.sub(word, 1, -i) .. (i > 1 and '-' or '') cairo_text_extents(cr, tt, ext) until t and utf8.len(tt) - utf8.len(t) <= 3 or ext.width <= w if ext.width > w or i > 1 then cairo_move_to(cr, x, y + line * lh) line = line + 1 if i > 1 and (not t or utf8.len(tt) - utf8.len(t) > 3) then cairo_show_text(cr, tt) word = utf8.sub(word, -i + 1, -1) else cairo_show_text(cr, t) end t = nil i = -1 else t = tt end until i == 1 end -- residues cairo_move_to(cr, x, y + line * lh) cairo_show_text(cr, t) end function text_dt(d, t) t = tonumber(t) local c = t < 0 and '–' or t > 0 and '+' or '' return string.format('%s–%s', d, c) end function text_t(t) return string.format('%+d', t):gsub('-', '–'):gsub('+0', '0') end function sign_w(w, temp) local t = tonumber(temp) return t < 0 and w.n or t > 0 and w.p or 0 end i2color = { r = rain_rgba, s = snow_rgba, c = clouds_rgba, st = storm_rgba } function draw_weather(cr, x, y, fc, mw) local day = fc.day local temp = fc.temp local w = fc.weather local ext = cairo_text_extents_t:create() tolua.takeownership(ext) set_rgba(cr, text_rgba) -- day cairo_text_extents(cr, day, ext) local yt = y + 16 + ext.height / 2 cairo_move_to(cr, x + 40, yt) cairo_show_text(cr, day) -- temp cairo_move_to(cr, x + 40 + mw.total - sign_w(mw, temp), yt) cairo_show_text(cr, text_t(temp)) -- construct icon cairo_push_group(cr) if w.r and w.s then if w.s > w.r then w.r = nil else w.s = nil end end local off = (w.r or w.s) and 0 or 4 -- sun draw_img(cr, x, y + off, 'sun', sun_rgba) -- precipitation for i, v in pairs(w) do if i == 'r' or i == 's' then local xx = x + 15 + (w.r and 1 or 0) - v * 4 local yy = y + 23 for j = 0, v-1 do draw_img(cr, xx + j * 8, yy, i, i2color[i]) end end end -- clouds if w.c then local i = 'c' .. tonumber(w.c) local yy = y + off draw_img(cr, x, yy, i .. '-b', nil) draw_img(cr, x, yy, i, clouds_rgba) end -- storm if w.st then local xx = x - 1 local yy = y + off - 2 draw_img(cr, xx, yy, 'st' .. '-b', nil) draw_img(cr, xx, yy, 'st', storm_rgba) end cairo_pop_group_to_source(cr) cairo_set_operator(cr, CAIRO_OPERATOR_OVER) cairo_paint(cr) end function draw_img(cr, x, y, img, rgba) if rgba then cairo_push_group(cr) set_rgba(cr, rgba) cairo_set_operator(cr, CAIRO_OPERATOR_OVER) cairo_paint(cr) cairo_set_operator(cr, CAIRO_OPERATOR_DEST_IN) else -- use '*-b.png' image variant to clear items on bottom cairo_set_operator(cr, CAIRO_OPERATOR_DEST_OUT) end local s = cairo_image_surface_create_from_png( path .. '/img/' .. img .. '.png') cairo_set_source_surface(cr, s, x, y) cairo_paint(cr) cairo_surface_destroy(s) -- colorize if rgba then cairo_pop_group_to_source(cr) cairo_set_operator(cr, CAIRO_OPERATOR_OVER) cairo_paint(cr) end end function set_rgba(cr, c) cairo_set_source_rgba(cr, c[1], c[2], c[3], c[4]) end
local utils = {} -- a < b local function subset_of(a, b) for name, value in pairs(a) do if b[name] ~= value then return false end end return true end -- a = b local function equal_sets(a, b) return subset_of(a, b) and subset_of(b, a) end function utils.find_obs(metric_name, label_pairs, observations) for _, obs in pairs(observations) do local same_label_pairs = equal_sets(obs.label_pairs, label_pairs) if obs.metric_name == metric_name and same_label_pairs then return obs end end assert(false, 'haven\'t found observation') end return utils
--[[ Copyright (c) 2012 Matthias Richter 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. Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]]-- local BASE = (...):match("(.-)[^%.]+$") local group = require(BASE .. 'group') local mouse = require(BASE .. 'mouse') local keyboard = require(BASE .. 'keyboard') -- -- Helper functions -- -- evaluates all arguments local function strictAnd(...) local n = select("#", ...) local ret = true for i = 1,n do ret = select(i, ...) and ret end return ret end local function strictOr(...) local n = select("#", ...) local ret = false for i = 1,n do ret = select(i, ...) or ret end return ret end -- -- Widget ID -- local maxid, uids = 0, {} setmetatable(uids, {__index = function(t, i) t[i] = {} return t[i] end}) local function generateID() maxid = maxid + 1 return uids[maxid] end -- -- Drawing / Frame update -- local draw_items = {n = 0} local function registerDraw(id, f, ...) assert(type(f) == 'function' or (getmetatable(f) or {}).__call, 'Drawing function is not a callable type!') local font = love.graphics.getFont() local state = 'normal' if mouse.isHot(id) or keyboard.hasFocus(id) then state = mouse.isActive(id) and 'active' or 'hot' end local rest = {n = select('#', ...), ...} draw_items.n = draw_items.n + 1 draw_items[draw_items.n] = function() if font then love.graphics.setFont(font) end f(state, unpack(rest, 1, rest.n)) end end -- actually update-and-draw local function draw() keyboard.endFrame() mouse.endFrame() group.endFrame() -- save graphics state local c = {love.graphics.getColor()} local f = love.graphics.getFont() local lw = love.graphics.getLineWidth() local ls = love.graphics.getLineStyle() for i = 1,draw_items.n do draw_items[i]() end -- restore graphics state love.graphics.setLineWidth(lw) love.graphics.setLineStyle(ls) if f then love.graphics.setFont(f) end love.graphics.setColor(c) draw_items.n = 0 maxid = 0 group.beginFrame() mouse.beginFrame() keyboard.beginFrame() end -- -- The Module -- return { generateID = generateID, style = require((...):match("(.-)[^%.]+$") .. 'style-default'), registerDraw = registerDraw, draw = draw, strictAnd = strictAnd, strictOr = strictOr, }
local ShadowRocket = class("ShadowRocket", State) local bid = "com.liguangming.Shadowrocket" local pingHost = "https://www.google.com" local shadowRocketDataBase = appDataPath(bid).."/Documents/Shadowrocket.sqlite*" local ssResultFile = "/private/var/mobile/Library/Preferences/shadowrocket_result.json" local ssConfigFile = gc.tsResPath.."ss.conf" function ShadowRocket:enteredState() if not gc.enableSS then return gc.ok end self.connectFailedCount = 1 return self.fetchSSConfig, 0 end function ShadowRocket:fetchSSConfig() local rsp = postJSON(gc.url.getVPS, {}) if rsp.status == gc.httpCode.ok and rsp.json.code == 0 then self.ssConfig = rsp.json if not isFileExist(ssConfigFile) then return self.clear, 0 end local localConfig = readJsonAtPath(ssConfigFile) if localConfig.sType ~= self.ssConfig.sType or localConfig.sHost ~= self.ssConfig.sHost or localConfig.sPassword ~= self.ssConfig.sPassword or localConfig.sMethod ~= self.ssConfig.sMethod or localConfig.sPort ~= self.ssConfig.sPort then return self.clear, 0 end setVPNEnable(true) return self.waitConnection end return self.fetchSSConfig, 3000 end function ShadowRocket:clear() setVPNEnable(false) os.execute("rm "..ssResultFile) os.execute("killall -9 Shadowrocket") os.execute("rm "..shadowRocketDataBase) return self.switch, 0 end function ShadowRocket:switch() local currentServer = self.ssConfig ilog(string.format("switch %s: %s", currentServer.sType, currentServer.sHost)) local config = nil if currentServer.sType == "ss" then config = currentServer.sMethod..":"..currentServer.sPassword.."@"..currentServer.sHost..":"..currentServer.sPort elseif currentServer.sType == "socks" then config = currentServer.sUser..":"..currentServer.sPassword.."@"..currentServer.sHost..":"..currentServer.sPort end local schema = currentServer.sType.."://"..config:base64_encode() openURL(schema) return self.waitCreated, 1000 end function ShadowRocket:waitCreated() if self:isStateUnitTimeout(1000 * 10) then return self.clear end if not isFileExist(ssResultFile) then return self.waitCreated end local resStr = readFileString(ssResultFile) ilog(resStr) mSleep(1000) local result = json.decode(resStr) if result.status == "success" then setVPNEnable(true) return self.waitConnection else return self.clear end end function ShadowRocket:waitConnection() if self:isStateUnitTimeout(1000 * 10) then return self.clear end local vpnStatus = getVPNStatus() toast("ss status:"..vpnStatus.status) if vpnStatus.status == "已连接" then return self.waitNetworkAvailable end return self.waitConnection end function ShadowRocket:waitNetworkAvailable() if self:isStateUnitTimeout(1000 * 20) then if self.connectFailedCount > 3 then setVPNEnable(false) ilog("无网络连接") mSleep(2000) return self.fetchSSConfig end self.connectFailedCount = self.connectFailedCount + 1 return self.clear end local http = sz.i82.http local status, headers, body = http.get(pingHost) if status == gc.httpCode.ok then ilog("network available") writeJsonAtPath(ssConfigFile, self.ssConfig) return gc.ok end ilog(pingHost..", status: "..status) mSleep(2000) return self.waitNetworkAvailable end return ShadowRocket
-- insert space = box.schema.space.create('test', { engine = 'sophia' }) index = space:create_index('primary', { type = 'tree', parts = {1, 'num'} }) sophia_dir()[1] for key = 1, 132 do space:insert({key}) end t = {} for key = 1, 132 do table.insert(t, space:get({key})) end t -- replace/get for key = 1, 132 do space:replace({key, key}) end t = {} for key = 1, 132 do table.insert(t, space:get({key})) end t -- update/get for key = 1, 132 do space:update({key}, {{'+', 2, key}}) end t = {} for key = 1, 132 do table.insert(t, space:get({key})) end t -- delete/get for key = 1, 132 do space:delete({key}) end for key = 1, 132 do assert(space:get({key}) == nil) end -- delete nonexistent space:delete({1234}) -- select for key = 1, 96 do space:insert({key}) end index = space.index[0] index:select({}, {iterator = box.index.ALL}) index:select({}, {iterator = box.index.GE}) index:select(4, {iterator = box.index.GE}) index:select({}, {iterator = box.index.GT}) index:select(4, {iterator = box.index.GT}) index:select({}, {iterator = box.index.LE}) index:select(7, {iterator = box.index.LE}) index:select({}, {iterator = box.index.LT}) index:select(7, {iterator = box.index.LT}) space:drop() sophia_schedule() sophia_dir()[1]
local skynet = require "skynet" local util = require "bw.util" local conf = require "conf" local opcode = require "def.opcode" local errcode = require "def.errcode" local def = require "def" local export = {} function export.js_module(str) return string.format("module.exports = %s;", str) end local function format_number(num, hex) return string.format(hex and "0x%.4x" or "%s", num) end local tab = "\t" local header = "//此配置文件由服务器导出,请勿手动修改\n" function export.js_obj(obj, depth, hex) depth = depth or 0 local list = {} for k, v in pairs(obj) do list[#list+1] = k end table.sort(list, function(a, b) if type(a) == type(b) then return a < b else return type(a) == "number" end end) local str = "" str = str .. "{\n" for i, k in ipairs(list) do str = str .. string.rep(tab, depth + 1) if type(k) == "number" then str = str .. '[' .. format_number(k, hex) .. ']:' else str = str .. k .. ':' end local v = obj[k] if type(v) == "table" then str = str .. export.js_obj(v, depth + 1, hex) elseif type(v) == "number" then str = str .. format_number(v, hex) else str = str .. string.format('"%s"', v) end if i < #list then str = str .. ",\n" end end str = str .. "\n" str = str .. string.rep(tab, depth) str = str .. "}" return str end function export.opcode(path) local code2name = opcode.get_code2name() local map = {CODE = {}} for code, fullname in pairs(code2name) do local module = string.match(fullname, "^[^.]+") local name = string.match(fullname, "[^.]+$") map[module] = map[module] or {} map[module][name] = code map.CODE[code] = fullname end local str = export.js_obj(map, 0, true) local file = io.open(path or conf.workspace.."/data/opcode.js", "w+") file:write(header..export.js_module(str)) file:close() end function export.errcode(path) local name2errcode = errcode.get_name2errcode() local map = {DESC = {}} for name, code in pairs(name2errcode) do map[name] = code map.DESC[code] = errcode.describe(code) end local str = export.js_obj(map, 0, true) local file = io.open(path or conf.workspace.."/data/errcode.js", "w+") file:write(header..export.js_module(str)) file:close() end function export.def(path) skynet.error("export_def") local str = export.js_obj(def, 0) local file = io.open(path or conf.workspace.."/data/def.js", "w+") file:write(header..export.js_module(str)) file:close() end return export
local ModeSelectScene = Scene:extend() ModeSelectScene.title = "Game Start" --time for a very hacky fix regarding this... --ModeSelectScene.title = "Normal Mode" current_mode = 1 current_ruleset = 1 function ModeSelectScene:new() self.menu_state = { mode = current_mode, ruleset = current_ruleset, select = "mode", } self.secret_inputs = { rotate_left = false, rotate_left2 = false, rotate_right = false, rotate_right2 = false, rotate_180 = false, hold = false, } DiscordRPC:update({ details = "In menus", state = "Choosing a mode", }) end function ModeSelectScene:update() switchBGM(nil) -- experimental end function ModeSelectScene:render() love.graphics.draw( backgrounds["game_config"], 0, 0, 0, 1, 1 ) if self.menu_state.select == "mode" then love.graphics.setColor(1, 1, 1, 0.5) elseif self.menu_state.select == "ruleset" then love.graphics.setColor(1, 1, 1, 0.25) end love.graphics.rectangle("fill", 20, 358, 600, 72) if self.menu_state.select == "mode" then love.graphics.setColor(1, 1, 1, 0.25) elseif self.menu_state.select == "ruleset" then love.graphics.setColor(1, 1, 1, 0.5) end love.graphics.rectangle("fill", 660, 358, 600, 72) love.graphics.setColor(1, 1, 1, 1) love.graphics.setFont(font_New_Big) for idx, mode in pairs(game_modes) do if(idx >= self.menu_state.mode-9 and idx <= self.menu_state.mode+9) then love.graphics.setColor(0, 0, 0, 0.5) love.graphics.printf(mode.name, 40, 360 - (80*(self.menu_state.mode)) + 80 * idx, 800, "left") love.graphics.setColor(1, 1, 1, 1) love.graphics.printf(mode.name, 38, (360 - (80*(self.menu_state.mode)) + 80 * idx) - 2, 800, "left") end end for idx, ruleset in pairs(rulesets) do if(idx >= self.menu_state.ruleset-9 and idx <= self.menu_state.ruleset+9) then love.graphics.setColor(0, 0, 0, 0.5) love.graphics.printf(ruleset.name, 680, (360 - 80*(self.menu_state.ruleset)) + 80 * idx, 960, "left") love.graphics.setColor(1, 1, 1, 1) love.graphics.printf(ruleset.name, 678, ((360 - 80*(self.menu_state.ruleset)) + 80 * idx) - 2, 960, "left") end end love.graphics.draw(misc_graphics["modeshadow"], 0, 0) love.graphics.setFont(font_New_Big) love.graphics.setColor(0, 0, 0, 0.5) love.graphics.printf("Select your mode", 250, 40, 800, "center") if config.gamesettings.hyper then love.graphics.setColor(1, 0, 0, 1) else love.graphics.setColor(1, 1, 1, 1) end love.graphics.printf("Select your mode", 248, 38, 800, "center") love.audio.stop(sounds.powermode) --in case someone quits out of Powerstack with Power Mode active love.audio.stop(sounds.topout) -- in case someone quits out of game overing early end function ModeSelectScene:onInputPress(e) if e.input == "rotate_left" or e.scancode == "return" then current_mode = self.menu_state.mode current_ruleset = self.menu_state.ruleset config.current_mode = current_mode config.current_ruleset = current_ruleset --playSE("mode_decide") - i'll find a better sound for this at some point! saveConfig() scene = GameScene(game_modes[self.menu_state.mode], rulesets[self.menu_state.ruleset], self.secret_inputs) elseif e.input == "up" or e.scancode == "up" then self:changeOption(-1) playSE("cursor") elseif e.input == "down" or e.scancode == "down" then self:changeOption(1) playSE("cursor") elseif e.input == "left" or e.input == "right" or e.scancode == "left" or e.scancode == "right" then self:switchSelect() playSE("cursor_lr") elseif e.input == "rotate_right" or e.scancode == "delete" or e.scancode == "backspace" or e.scancode == "escape" then playSE("menu_back") scene = TitleScene() elseif e.input then self.secret_inputs[e.input] = true end end function ModeSelectScene:onInputRelease(e) if e.input == "hold" or (e.input and string.sub(e.input, 1, 7) == "rotate_") then self.secret_inputs[e.input] = false end end function ModeSelectScene:changeOption(rel) if self.menu_state.select == "mode" then self:changeMode(rel) elseif self.menu_state.select == "ruleset" then self:changeRuleset(rel) end end function ModeSelectScene:switchSelect(rel) if self.menu_state.select == "mode" then self.menu_state.select = "ruleset" elseif self.menu_state.select == "ruleset" then self.menu_state.select = "mode" end end function ModeSelectScene:changeMode(rel) local len = table.getn(game_modes) self.menu_state.mode = (self.menu_state.mode + len + rel - 1) % len + 1 end function ModeSelectScene:changeRuleset(rel) local len = table.getn(rulesets) self.menu_state.ruleset = (self.menu_state.ruleset + len + rel - 1) % len + 1 end return ModeSelectScene
-- This file sets up autocompletion for neovim's native lsp local lspconfig = require('lspconfig') -- This enables all the language servers I want on my system -- Change these to whatever languages you use lspconfig.rnix.setup{} lspconfig.sumneko_lua.setup{} vim.o.completeopt = "menuone,noselect" -- Autocompletion setup require'compe'.setup { enabled = true; autocomplete = true; debug = false; min_length = 1; preselect = 'enable'; throttle_time = 80; source_timeout = 200; incomplete_delay = 400; max_abbr_width = 100; max_kind_width = 100; max_menu_width = 100; documentation = false; source = { path = true; buffer = true; nvim_lsp = true; nvim_lua = true; tags = true; treesitter = true; }; } -- Set tab to accept the autocompletion local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end _G.tab_complete = function() if vim.fn.pumvisible() == 1 then return t "<C-n>" else return t "<S-Tab>" end end vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true}) vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true}) -- set the path to the sumneko installation; if you previously installed via the now deprecated :LspInstall, use local sumneko_root_path = vim.fn.stdpath('cache')..'/lspconfig/sumneko_lua/lua-language-server' local sumneko_binary = "lua-language-server" local runtime_path = vim.split(package.path, ';') table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") lspconfig.sumneko_lua.setup { cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}; settings = { Lua = { runtime = { version = 'LuaJIT', path = runtime_path, }, diagnostics = { globals = {'vim'}, }, workspace = { library = vim.api.nvim_get_runtime_file("", true), preloadFileSize = 120 }, telemetry = { enable = false, }, }, }, } -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end --Enable completion triggered by <c-x><c-o> buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. local opts = { noremap=true, silent=true } -- See `:help vim.lsp.*` for documentation on any of the below functions buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts) buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts) buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) end local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true lspconfig.hls.setup { on_attach = on_attach, capabilities = capabilities, root_dir = lspconfig.util.root_pattern('BUILD.bazel', '*.cabal', 'stack.yaml', 'cabal.project', 'package.yaml', 'hie.yaml'), filetypes = { 'hs', 'lhs', 'haskell', 'lhaskell' }, formattingProvider = "ormolu", settings = { languageServerHaskell = { hlintOn = false, } } } local trouble = require("trouble") trouble.setup { } vim.api.nvim_set_keymap("n", "<leader>e", "<cmd>Trouble workspace_diagnostics<cr>", {silent = true, noremap = true}) vim.api.nvim_set_keymap("n", "<leader>r", "<cmd>Trouble lsp_references<cr>", {silent = true, noremap = true})
--[[--ldoc desc @module TestViewC @author ShuaiYang Date 2018-10-15 14:37:47 Last Modified by ShuaiYang Last Modified time 2018-10-30 16:07:43 ]] local appPath = "app.demo.yangshuai" local TestViewC = class("TestViewC",cc.load("boyaa").mvc.BoyaaCtr); local TestView = require(appPath..".testView.TestView") local TestViewBehavior = require(appPath..".testView.TestViewBehavior") local TestObserverBehavior = require(appPath..".testView.TestObserverBehavior") local EvenConfig = { TestEven = "myTest", } function TestViewC:ctor() -- body print("TestViewC"); self.con = 0; end function TestViewC:initView(isBehavior) -- body local testView = TestView.new(); if isBehavior == 1 then testView:bindBehavior(TestViewBehavior); elseif isBehavior == 2 then testView:bindBehavior(TestObserverBehavior); end testView:bindCtr(self); testView:addBtn(); testView:move(display.center); end function TestViewC:registeredTest() -- body self:bindEventListener(EvenConfig.TestEven,function (event) -- body self:getView():showDiyView(event._usedata.str); end) end function TestViewC:schedulerTest() -- body self.sd = self:scheduler(function () -- body self:getView():showSchedulerTestView(self.con); self.con = self.con +1; end,0.5,false); end function TestViewC:unSchedulerTest() -- body print("====unSchedulerTest======") self:unScheduler(self.sd); end function TestViewC:sendEven() -- body self:sendEvenData(EvenConfig.TestEven,{str = "我是自定义事件"}); end return TestViewC;
local gl = require 'gl' local function glCallOrRun(list, callback, ...) assert(type(list) == 'table', "expected first parameter to be a table to store the list id") if list.id then gl.glCallList(list.id) else list.id = gl.glGenLists(1) gl.glNewList(list.id, gl.GL_COMPILE_AND_EXECUTE) callback(...) gl.glEndList() end end return glCallOrRun
local ffi = require("ffi") local Application = require("Application") local windns_ffi = require("windns_ffi") local NativeSocket = require("NativeSocket") local ws2_32 = require("ws2_32") local Stopwatch = require("StopWatch") local clock = Stopwatch(); -- DNS UDP port local IPPORT_DNS = 53; local DNSNameServer = {} setmetatable(DNSNameServer, { __call = function(self, ...) return self:create(...) end, }) local DNSNameServer_mt = { __index = DNSNameServer, } function DNSNameServer.init(self, serveraddress) local socket, err = NativeSocket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); if not socket then return nil, err end local obj = { Socket = socket, ServerAddress = serveraddress, } setmetatable(obj, DNSNameServer_mt) return obj; end function DNSNameServer.create(self, servername) local remoteAddr = sockaddr_in(IPPORT_DNS, AF_INET); remoteAddr.sin_addr.S_addr = ws2_32.inet_addr( servername ); return self:init(remoteAddr) end -- Construct DNS_TYPE_A request, send it to the specified DNS server, wait for the reply. function DNSNameServer.Query(self, strToQuery, wType, msTimeout) wType = wType or ffi.C.DNS_TYPE_A msTimeout = msTimeout or 60 * 1000 -- 1 minute -- Prepare the DNS request local dwBuffSize = ffi.new("DWORD[1]", 2048); local buff = ffi.new("uint8_t[2048]") local wID = clock:GetCurrentTicks() % 65536; local res = windns_ffi.DnsWriteQuestionToBuffer_UTF8( ffi.cast("DNS_MESSAGE_BUFFER*",buff), dwBuffSize, ffi.cast("char *",strToQuery), wType, wID, true ) if res == 0 then return false, "DnsWriteQuestionToBuffer_UTF8 failed." end -- Send the request. local iRes, err = self.Socket:sendTo(self.ServerAddress, ffi.sizeof(self.ServerAddress), buff, dwBuffSize[0]); if (not iRes) then print("Error sending data: ", err) return false, err end -- Try to receive the results local RecvFromAddr = sockaddr_in(); local RecvFromAddrSize = ffi.sizeof(RecvFromAddr); local cbReceived, err = self.Socket:receiveFrom(RecvFromAddr, RecvFromAddrSize, buff, 2048); if not cbReceived then print("Error Receiving Data: ", err) return false, err; end if( 0 == cbReceived ) then return false, "Nothing received" end -- Parse the DNS response received with DNS API local pDnsResponseBuff = ffi.cast("DNS_MESSAGE_BUFFER*", buff); windns_ffi.DNS_BYTE_FLIP_HEADER_COUNTS ( pDnsResponseBuff.MessageHead ); if pDnsResponseBuff.MessageHead.Xid ~= wID then return false, "wrong transaction ID" end local pRecord = ffi.new("DNS_RECORD *[1]",nil); iRes = windns_ffi.DnsExtractRecordsFromMessage_W( pDnsResponseBuff, cbReceived, pRecord ); pRecord = pRecord[0]; local pRecordA = ffi.cast("DNS_RECORD *", pRecord); local function closure() if pRecordA == nil then return nil; end if pRecordA.wType == wType then local retVal = pRecordA pRecordA = pRecordA.pNext return retVal; end -- Find the next record of the specified type repeat pRecordA = pRecordA.pNext; until pRecordA == nil or pRecordA.wType == wType if pRecordA ~= nil then local retVal = pRecordA pRecordA = pRecordA.pNext return retVal; end -- Free the resources if pRecord ~= nil then windns_ffi.DnsRecordListFree( pRecord, ffi.C.DnsFreeRecordList ); end return nil end return closure end function DNSNameServer.A(self, domainToQuery) return self:Query(domainToQuery, ffi.C.DNS_TYPE_A) end function DNSNameServer.MX(self, domainToQuery) return self:Query(domainToQuery, ffi.C.DNS_TYPE_MX) end function DNSNameServer.CNAME(self, domainToQuery) return self:Query(domainToQuery, ffi.C.DNS_TYPE_CNAME) end function DNSNameServer.PTR(self, domainToQuery) return self:Query(domainToQuery, ffi.C.DNS_TYPE_PTR) end function DNSNameServer.SRV(self, domainToQuery) return self:Query(domainToQuery, ffi.C.DNS_TYPE_SRV) end return DNSNameServer
require "src/core/arrays" local feature = {} feature.__index = feature function feature.new(name) local self = setmetatable({}, feature) self.id = math.random(0, 1e10) self.name = name self.cases = {} return self end local case = {} case.__index = case function case.new(feature, name, from, to) local self = setmetatable({}, case) self.id = math.random(0, 1e10) self.feature = feature self.name = name self.from = from self.to = to return self end function case.distance(self, value) if value >= self.from and value <= self.to then return 0 else return math.min(math.abs(value - self.from), math.abs(value - self.to)) end end function feature.add(self, x, from, to) if nil == to then to = from end if nil ~= from then x = case.new(self, x, from, to) end assert(nil == self.cases[x.id]) self.cases[x.id] = x return x end return feature
local CreateReducer = require(script.Parent.Parent.Lib.Rodux).createReducer local Immutable = require(script.Parent.Parent.Lib.Immutable) local ui = CreateReducer({ areMessagesVisible = true, }, { ToggleMessagesVisibility = function(state) return Immutable.join(state, { areMessagesVisible = not state.areMessagesVisible }) end }) return ui
include ("ordertypes") MapCommands.registerModdedMapCommand(OrderType.AutoTrader, { tooltip = "Auto Trader", icon = "data/textures/icons/autotrader.png", callback = "onAutoTraderPressed", }) function MapCommands.onAutoTraderPressed() MapCommands.clearOrdersIfNecessary() MapCommands.enqueueOrder("addAutoTraderOrder") end
local npairs = require("nvim-autopairs") npairs.setup()
local skills={ {name="猴抓",info="猴子挠人",hard=1.0,tiaohe=0,type=0,suit=0,basepower=1,step=0.3,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,6",lv=10,},{name="powerup_quanzhang",argvs="3",lv=20,},{name="",argvs="",lv=0,}, },icon="anyingjuehunzhang",audio="音效.飙血",animation="zhua",}, {name="雕啄",info="大雕啄人",hard=1.0,tiaohe=0,type=0,suit=0,basepower=6,step=0.4,cd=0,buff="重伤", trigger={ {name="attribute",argvs="搏击格斗,6",lv=10,},{name="powerup_quanzhang",argvs="3",lv=20,},{name="",argvs="",lv=0,}, },icon="anzhihen",audio="音效.鸟啄",animation="biaoxue",}, {name="松风剑法",info="入门剑法",hard=1,tiaohe=0,type=1,suit=0,basepower=3,step=0.55,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,6",lv=10,},{name="powerup_skill",argvs="摧心掌,50",lv=15,},{name="powerup_internalskill",argvs="青城心法,80",lv=20,},{name="",argvs="",lv=0,}, },icon="aoyijue",audio="音效.剑",animation="baozha_cheng",}, {name="罗汉拳",info="少林派入门拳法",hard=1,tiaohe=0,type=0,suit=0.2,basepower=2,step=0.3,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,7",lv=10,},{name="attribute",argvs="定力,7",lv=10,},{name="powerup_internalskill",argvs="易筋经,8",lv=18,},{name="powerup_quanzhang",argvs="12",lv=20,},{name="",argvs="",lv=0,}, },icon="baililuoxuesi",audio="音效.拳2",animation="dabiaoxue",}, {name="太祖长拳",info="丐帮入门拳法",hard=1,tiaohe=0,type=0,suit=0.2,basepower=3,step=0.25,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,7",lv=10,},{name="powerup_quanzhang",argvs="10",lv=20,},{name="",argvs="",lv=0,}, },icon="canmangjian",audio="音效.拳2",animation="kongmingquan",}, {name="南山刀法",info="水水的刀法",hard=1,tiaohe=0,type=2,suit=0,basepower=1,step=0.2,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,7",lv=10,},{name="attribute",argvs="臂力,7",lv=16,},{name="powerup_daofa",argvs="10",lv=20,},{name="",argvs="",lv=0,}, },icon="chihuangdaofa",audio="音效.剑",animation="baozha_cheng",}, {name="万劫刀法",info="万劫谷的水货刀法",hard=1,tiaohe=0,type=2,suit=0,basepower=1.5,step=0.3,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,6",lv=10,},{name="attribute",argvs="臂力,7",lv=16,},{name="powerup_daofa",argvs="10",lv=20,},{name="",argvs="",lv=0,}, },icon="chongzhuang",audio="音效.剑",animation="baozha_cheng",}, {name="疯魔杖法",info="丐帮入门杖法",hard=1,tiaohe=0,type=3,suit=0.2,basepower=3,step=0.25,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,7",lv=10,},{name="attribute",argvs="臂力,7",lv=15,},{name="powerup_qimen",argvs="10",lv=20,},{name="talent",argvs="神经病",lv=20,},{name="",argvs="",lv=0,}, },icon="chuanyunjian",audio="音效.钝器3",animation="baozha5",}, {name="柴山十八路",info="十两买来的刀法",hard=1,tiaohe=0,type=2,suit=0,basepower=1,step=0.4,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,8",lv=10,},{name="powerup_daofa",argvs="10",lv=20,},{name="",argvs="",lv=0,}, },icon="cjjfjf",audio="音效.利器3",animation="baozha_cheng",}, {name="青蟒剑法",info="青蟒剑法",hard=2.0,tiaohe=0,type=1,suit=-0.1,basepower=2.5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,7",lv=10,},{name="powerup_skill",argvs="金蛇剑法,12",lv=15,},{name="powerup_skill",argvs="金蛇剑法,12",lv=20,},{name="",argvs="",lv=0,}, },icon="cjmenghanquan",audio="音效.钝器4",animation="jinshejianfa",}, {name="三分剑法",info="每一招只使出三分之一,故此称为三分剑法",hard=2.0,tiaohe=0,type=1,suit=-0.1,basepower=2.5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,7",lv=10,},{name="powerup_jianfa",argvs="10",lv=20,},{name="",argvs="",lv=0,}, },icon="cjmenghanxinfa",audio="音效.威猛利器",animation="yuanquan",}, {name="草原刀法",info="游牧民族的刀法精髓",hard=2.0,tiaohe=0,type=2,suit=0,basepower=4,step=0.3,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,7",lv=10,},{name="sp",argvs="0.1",lv=14,},{name="critical",argvs="12.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="dafengche",audio="音效.威猛利器3",animation="heixue",}, {name="天山掌法",info="灵鹫宫的入门掌法",hard=2.0,tiaohe=0,type=0,suit=0.2,basepower=2,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,6",lv=10,},{name="powerup_aoyi",argvs="灵鹫宫绝学.逍遥游,15,5",lv=10,},{name="powerup_aoyi",argvs="灵鹫宫绝学.北冥神掌,15,5",lv=12,},{name="powerup_aoyi",argvs="逍遥绝学.生死符,20,5",lv=20,},{name="",argvs="",lv=0,}, },icon="dalangquan",audio="音效.闷拳",animation="zhang",}, {name="飘雪穿云掌",info="峨眉派轻灵飘逸的掌法",hard=3.0,tiaohe=0,type=0,suit=0.2,basepower=2,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,8",lv=10,},{name="powerup_quanzhang",argvs="2",lv=20,},{name="",argvs="",lv=0,}, },icon="dizihua",audio="音效.拳1",animation="xiayu",}, {name="天罗地网掌",info="古墓派轻灵飘逸的掌法",hard=3.0,tiaohe=0,type=0,suit=-0.2,basepower=2,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,8",lv=10,},{name="talent",argvs="飘然",lv=20,},{name="",argvs="",lv=0,}, },icon="dulequan",audio="音效.拳1",animation="guanghuan_bianfu",}, {name="华山剑法",info="华山派剑法",hard=3.0,tiaohe=0,type=1,suit=0.1,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,7",lv=10,},{name="powerup_aoyi",argvs="华山绝学.独孤九剑奥义,10,3",lv=15,},{name="powerup_skill",argvs="独孤九剑,10",lv=17,},{name="powerup_aoyi",argvs="华山绝学.独孤九剑奥义,10,5",lv=20,},{name="",argvs="",lv=0,}, },icon="erhupuyang",audio="音效.飙血",animation="baozha_lan",}, {name="恒山剑法",info="恒山派剑法",hard=3.0,tiaohe=0,type=1,suit=0.1,basepower=2,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,6",lv=10,},{name="talent",argvs="救死扶伤",lv=20,},{name="",argvs="",lv=0,}, },icon="anyingjuehunzhang",audio="音效.飙血",animation="biaoxue",}, {name="袖箭",info="出其不意的袖箭",hard=3.0,tiaohe=0,type=3,suit=0.1,basepower=2,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="身法,6",lv=7,},{name="attribute",argvs="奇门兵器,5",lv=10,},{name="attribute",argvs="奇门兵器,15",lv=20,},{name="",argvs="",lv=0,}, },icon="anzhihen",audio="音效.暗器1",animation="anqi",}, {name="拂尘",info="拂尘也可以是武器!",hard=3.0,tiaohe=0,type=3,suit=-0.1,basepower=2,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,7",lv=10,},{name="attribute",argvs="奇门兵器,10",lv=20,},{name="",argvs="",lv=0,}, },icon="aoyijue",audio="音效.暗器1",animation="baozha_cheng",}, {name="蛇鹤八打",info="云中鹤的诡异武功",hard=3.0,tiaohe=0,type=3,suit=-0.1,basepower=2,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,8",lv=10,},{name="talent",argvs="轻功高超",lv=12,},{name="attribute",argvs="身法,25",lv=20,},{name="",argvs="",lv=0,}, },icon="baililuoxuesi",audio="音效.暗器1",animation="biaoxue",}, {name="雷震剑法",info="雷震剑法",hard=3.0,tiaohe=0,type=1,suit=-0.2,basepower=2.5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,7",lv=10,},{name="powerup_jianfa",argvs="10",lv=15,},{name="powerup_skill",argvs="金蛇剑法,12",lv=20,},{name="",argvs="",lv=0,}, },icon="canmangjian",audio="音效.剑",animation="baozha_lan",}, {name="大嵩阳手",info="嵩山派武功",hard=3.0,tiaohe=0,type=0,suit=0.4,basepower=3,step=0.5,cd=0,buff="缓速.2#攻击弱化.3", trigger={ {name="attribute",argvs="搏击格斗,11",lv=10,},{name="attribute",argvs="搏击格斗,11",lv=20,},{name="",argvs="",lv=0,}, },icon="chihuangdaofa",audio="音效.钝器4",animation="bagua",}, {name="百花错拳",info="百花错拳",hard=3.0,tiaohe=0,type=0,suit=0.3,basepower=4.5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="搏击格斗,12",lv=18,},{name="attribute",argvs="搏击格斗,11",lv=20,},{name="",argvs="",lv=0,}, },icon="chongzhuang",audio="音效.拳2",animation="flower2",}, {name="嵩山剑法",info="嵩山派武功",hard=3.0,tiaohe=0,type=1,suit=-0.4,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,10",lv=10,},{name="attribute",argvs="定力,10",lv=12,},{name="attribute",argvs="根骨,10",lv=14,},{name="critical",argvs="8.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="chuanyunjian",audio="音效.威猛利器",animation="bingpo",}, {name="玄虚刀法",info="武当派刀法",hard=3.0,tiaohe=0,type=2,suit=-0.4,basepower=4,step=0.5,cd=0,buff="缓速.2", trigger={ {name="attribute",argvs="耍刀技巧,9",lv=10,},{name="attribute",argvs="定力,10",lv=14,},{name="powerup_daofa",argvs="12",lv=20,},{name="",argvs="",lv=0,}, },icon="cjjfjf",audio="音效.威猛利器2",animation="taiji",}, {name="毒龙鞭法",info="毒龙鞭法",hard=3.0,tiaohe=0,type=3,suit=-0.4,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,7",lv=10,},{name="sp",argvs="0.1",lv=14,},{name="attribute",argvs="奇门兵器,7",lv=20,},{name="",argvs="",lv=0,}, },icon="cjmenghanquan",audio="音效.钝器3",animation="heixue",}, {name="流星锤",info="流星锤",hard=3.0,tiaohe=0,type=3,suit=-0.3,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,7",lv=10,},{name="sp",argvs="0.1",lv=14,},{name="attribute",argvs="奇门兵器,7",lv=20,},{name="",argvs="",lv=0,}, },icon="cjmenghanxinfa",audio="音效.暗器1",animation="yuanquan",}, {name="伏虎掌",info="华山派粗浅的拳掌功夫",hard=3.0,tiaohe=0,type=0,suit=0.3,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,7",lv=10,},{name="powerup_skill",argvs="混元掌,12",lv=15,},{name="powerup_internalskill",argvs="混元功,12",lv=17,},{name="critical",argvs="5.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="dafengche",audio="音效.拳2",animation="taiji_blue",}, {name="韦陀棍",info="少林十三棍,威震天下",hard=3.0,tiaohe=0,type=3,suit=0.4,basepower=3,step=0.45,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,9",lv=10,},{name="attribute",argvs="臂力,9",lv=10,},{name="attribute",argvs="臂力,9",lv=15,},{name="attribute",argvs="臂力,9",lv=20,},{name="powerup_skill",argvs="伏魔棍,12",lv=20,},{name="",argvs="",lv=0,}, },icon="dalangquan",audio="音效.破空钝器",animation="guanghuan_orange",}, {name="小洪拳",info="南少林武功和洪熙官有什么关系?",hard=3.0,tiaohe=0,type=0,suit=0.3,basepower=3,step=0.5,cd=0,buff="缓速.2#攻击弱化.3", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="臂力,12",lv=14,},{name="powerup_skill",argvs="如来神掌,12",lv=20,},{name="critical",argvs="8.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="dizihua",audio="音效.拳3",animation="baozha5",}, {name="绵掌",info="武当派扎实的基本武功,柔中带刚",hard=3.0,tiaohe=0,type=0,suit=0.3,basepower=3,step=0.5,cd=0,buff="缓速.1#防御强化.2", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="powerup_skill",argvs="绝户虎爪手,15",lv=12,},{name="powerup_skill",argvs="太极拳,15",lv=15,},{name="attribute",argvs="臂力,12",lv=16,},{name="powerup_internalskill",argvs="太极神功,10",lv=18,},{name="powerup_internalskill",argvs="纯阳无极功,10",lv=20,},{name="",argvs="",lv=0,}, },icon="dulequan",audio="音效.拳3",animation="taiji_blue",}, {name="参合指",info="姑苏慕容氏的指法",hard=3.0,tiaohe=0,type=0,suit=-0.6,basepower=3.5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="powerup_aoyi",argvs="慕容绝学.离合参商,35,5",lv=18,},{name="attribute",argvs="悟性,12",lv=20,},{name="",argvs="",lv=0,}, },icon="erhupuyang",audio="音效.拳2",animation="baozha",}, {name="八卦游身掌",info="八卦门的掌系绝学。",hard=4.0,tiaohe=0,type=0,suit=0.35,basepower=3.5,step=0.4,cd=0,buff="缓速.1", trigger={ {name="attribute",argvs="搏击格斗,7",lv=10,},{name="powerup_skill",argvs="八卦刀法,30",lv=10,},{name="powerup_aoyi",argvs="绝学.八卦无双,40,5",lv=14,},{name="powerup_aoyi",argvs="绝学.八卦无双,40,5",lv=20,},{name="critical",argvs="8.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="cjmenghanxinfa",audio="音效.拳2",animation="taiji",}, {name="八卦刀法",info="特别八卦的刀法,怪不得不是很厉害。但貌似装上紫金八卦刀就变了态了。",hard=4.0,tiaohe=0,type=2,suit=0.35,basepower=4,step=0.3,cd=0,buff="缓速.1", trigger={ {name="attribute",argvs="耍刀技巧,7",lv=10,},{name="powerup_aoyi",argvs="绝学.八卦无双,50,5",lv=14,},{name="powerup_daofa",argvs="7",lv=20,},{name="",argvs="",lv=0,}, },icon="dafengche",audio="音效.利器7",animation="taiji3",}, {name="大剪刀",info="岳老三的野蛮武功",hard=4.0,tiaohe=0,type=3,suit=0.3,basepower=2.5,step=0.5,cd=0,buff="定身", trigger={ {name="attribute",argvs="奇门兵器,7",lv=10,},{name="attribute",argvs="奇门兵器,12",lv=20,},{name="attribute",argvs="臂力,12",lv=20,},{name="",argvs="",lv=0,}, },icon="dalangquan",audio="音效.暗器1",animation="dabiaoxue",}, {name="无上大力杵",info="密宗的轰雷一杵,用大力,出奇迹",hard=4.0,tiaohe=0,type=3,suit=0.3,basepower=5.5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,7",lv=10,},{name="powerup_internalskill",argvs="龙象般若功,10",lv=15,},{name="attribute",argvs="臂力,12",lv=20,},{name="attribute",argvs="根骨,12",lv=20,},{name="",argvs="",lv=0,}, },icon="dizihua",audio="音效.钝器1",animation="fo",}, {name="漫天花雨",info="一手同时撒出七颗棋子,要颗颗打中敌人穴道",hard=4.0,tiaohe=0,type=3,suit=0.3,basepower=4.5,step=0.5,cd=0,buff="致盲.2", trigger={ {name="attribute",argvs="奇门兵器,10",lv=10,},{name="attribute",argvs="身法,12",lv=13,},{name="attribute",argvs="定力,12",lv=15,},{name="attribute",argvs="悟性,12",lv=20,},{name="",argvs="",lv=0,}, },icon="dulequan",audio="音效.暗器1",animation="flower",}, {name="盾术",info="游氏双雄的圆盾之术",hard=4.0,tiaohe=0,type=3,suit=0.4,basepower=3,step=0.5,cd=0,buff="防御强化", trigger={ {name="attribute",argvs="奇门兵器,7",lv=10,},{name="sp",argvs="0.1",lv=14,},{name="attribute",argvs="奇门兵器,7",lv=20,},{name="",argvs="",lv=0,}, },icon="erhupuyang",audio="音效.拳2",animation="baozha",}, {name="冰魄银针",info="李莫愁的暗器绝技",hard=4.0,tiaohe=0,type=3,suit=-0.4,basepower=3,step=0.5,cd=0,buff="中毒.2.2.100", trigger={ {name="attribute",argvs="奇门兵器,7",lv=10,},{name="powerup_skill",argvs="五毒神掌,25",lv=15,},{name="attribute",argvs="奇门兵器,12",lv=20,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.暗器1",animation="heixue",}, {name="抽髓掌",info="星宿派的阴毒掌法。",hard=4.0,tiaohe=0,type=0,suit=-1,basepower=4,step=0.45,cd=0,buff="中毒.2.2.100", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="powerup_internalskill",argvs="化功大法,10",lv=12,},{name="powerup_skill",argvs="三阴蜈蚣爪,30",lv=15,},{name="critical",argvs="8.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.拳1",animation="kulou_green",}, {name="海叟钓法",info="谭公谭婆的神奇武功",hard=4.0,tiaohe=0,type=3,suit=-0.6,basepower=4,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,9",lv=10,},{name="powerup_qimen",argvs="3",lv=20,},{name="critical",argvs="10.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.利器6",animation="ball_purple",}, {name="灵蛇拳",info="白驼山诡异的拳法",hard=4.0,tiaohe=0,type=0,suit=-0.6,basepower=3.5,step=0.5,cd=0,buff="中毒.2", trigger={ {name="attribute",argvs="搏击格斗,8",lv=10,},{name="powerup_internalskill",argvs="蛤蟆功,15",lv=10,},{name="powerup_internalskill",argvs="蛤蟆功,25",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.拳2",animation="bingpao",}, {name="神驼雪山掌",info="白驼山高阶诡异的拳法",hard=4.0,tiaohe=0,type=0,suit=-0.8,basepower=4.0,step=0.55,cd=0,buff="定身", trigger={ {name="attribute",argvs="搏击格斗,8",lv=10,},{name="powerup_internalskill",argvs="蛤蟆功,15",lv=10,},{name="powerup_internalskill",argvs="蛤蟆功,25",lv=20,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.拳2",animation="duyao",}, {name="灵蛇杖法",info="欧阳锋的看家武学",hard=6.0,tiaohe=0,type=0,suit=-1.0,basepower=5.0,step=0.6,cd=0,buff="中毒.3.2.100", trigger={ {name="attribute",argvs="奇门兵器,9",lv=10,},{name="powerup_internalskill",argvs="蛤蟆功,15",lv=15.0,},{name="powerup_internalskill",argvs="蛤蟆功,25",lv=20,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.拳2",animation="ball_purple",}, {name="摧心掌",info="青城派掌门余沧海的绝学掌法",hard=5.0,tiaohe=0,type=0,suit=-1,basepower=4,step=0.4,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,8",lv=10,},{name="powerup_skill",argvs="松风剑法,50",lv=15,},{name="powerup_internalskill",argvs="青城心法,80",lv=20,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.拳3",animation="guanghuan_bianfu",}, {name="四象掌",info="峨眉派掌法,圆中有方,阴阳相成,灭绝师太自负为天下绝学。",hard=5.0,tiaohe=0,type=0,suit=-0.4,basepower=3,step=0.5,cd=0,buff="防御强化.3.3.100", trigger={ {name="attribute",argvs="搏击格斗,10",lv=10,},{name="defence",argvs="100,15",lv=16,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.拳击",animation="taiji_blue",}, {name="昊天掌",info="全真教入门掌法。",hard=5.0,tiaohe=0,type=0,suit=0.4,basepower=3,step=0.5,cd=0,buff="防御强化.1.3.50", trigger={ {name="attribute",argvs="搏击格斗,6",lv=10,},{name="powerup_aoyi",argvs="全真绝学.三花聚顶,25,8",lv=12,},{name="powerup_skill",argvs="三花聚顶掌,15",lv=14,},{name="powerup_skill",argvs="三花聚顶掌,15",lv=16,},{name="powerup_aoyi",argvs="全真绝学.三花聚顶,12,3",lv=18,},{name="powerup_aoyi",argvs="全真绝学.三花聚顶.炼神返虚,12,3",lv=20,},{name="attribute",argvs="搏击格斗,5",lv=20,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.拳击",animation="taiji_blue",}, {name="寒冰绵掌",info="青翼蝠王韦一笑平生绝学。",hard=5.0,tiaohe=0,type=0,suit=-0.4,basepower=4.5,step=0.5,cd=0,buff="定身.3.3.60", trigger={ {name="attribute",argvs="搏击格斗,7",lv=10,},{name="attribute",argvs="身法,7",lv=10,},{name="xi",argvs="5",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.拳击",animation="bingdong2",}, {name="落英神剑掌",info="桃花影落飞神剑,碧海潮声按玉箫。",hard=5.0,tiaohe=0,type=0,suit=-0.4,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,7",lv=10,},{name="powerup_skill",argvs="弹指神通,12",lv=12,},{name="powerup_skill",argvs="弹指神通,12",lv=16,},{name="attribute",argvs="搏击格斗,5",lv=20,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.利器4",animation="flower_jian",}, {name="五毒神掌",info="赤练仙子李莫愁的看家本领。",hard=5.0,tiaohe=0,type=0,suit=-0.4,basepower=3,step=0.5,cd=0,buff="中毒.2", trigger={ {name="attribute",argvs="搏击格斗,7",lv=10,},{name="attribute",argvs="搏击格斗,5",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.拳2",animation="duyao",}, {name="密宗大手印",info="大轮寺密宗掌法",hard=5.0,tiaohe=0,type=0,suit=0.4,basepower=3.5,step=0.5,cd=0,buff="防御强化.1.3.50", trigger={ {name="attribute",argvs="搏击格斗,6",lv=10,},{name="defence",argvs="100,6",lv=15,},{name="powerup_internalskill",argvs="龙象般若功,10",lv=20,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.闷拳",animation="foxiang",}, {name="绕指柔剑",info="武当派入门剑法,飘忽不定的奇幻剑术",hard=5.0,tiaohe=0,type=1,suit=-0.4,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,6",lv=10,},{name="powerup_skill",argvs="柔云剑法,20",lv=14,},{name="powerup_skill",argvs="神门十三剑,20",lv=16,},{name="powerup_skill",argvs="太极剑,20",lv=18,},{name="attribute",argvs="使剑技巧,6",lv=20,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.利器2",animation="flower2",}, {name="峨眉剑法",info="风陵渡口,一世情伤",hard=5.0,tiaohe=0,type=1,suit=0,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,6",lv=10,},{name="attribute",argvs="使剑技巧,6",lv=20,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.利器2",animation="flower",}, {name="无量剑法",info="无量玉璧上的神奇剑法",hard=5.0,tiaohe=0,type=1,suit=-0.3,basepower=3.5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,6",lv=10,},{name="attribute",argvs="使剑技巧,6",lv=20,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.利器1",animation="baozha_cheng",}, {name="天龙剑法",info="天龙门的入门剑法",hard=5.0,tiaohe=0,type=1,suit=0.2,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,6",lv=10,},{name="attribute",argvs="使剑技巧,6",lv=20,},{name="",argvs="",lv=0,}, },icon="quyuefenghuaxueyue",audio="音效.利器1",animation="baozha_cheng",}, {name="玉箫剑法",info="桃花影落飞神剑,碧海潮声按玉箫。",hard=5.0,tiaohe=0,type=1,suit=-0.4,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,6",lv=10,},{name="powerup_skill",argvs="弹指神通,12",lv=12,},{name="powerup_skill",argvs="弹指神通,12",lv=16,},{name="powerup_skill",argvs="弹指神通,12",lv=20,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.利器4",animation="yuxiaojianfa",}, {name="全真剑法",info="全真教入门剑法",hard=5.0,tiaohe=0,type=1,suit=0.4,basepower=3,step=0.5,cd=0,buff="攻击弱化", trigger={ {name="attribute",argvs="使剑技巧,6",lv=10,},{name="powerup_aoyi",argvs="全真绝学.太乙剑诀,25,5",lv=14,},{name="powerup_aoyi",argvs="全真绝学.重阳剑法,25,5",lv=18,},{name="powerup_jianfa",argvs="5",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.利器2",animation="baozha_green",}, {name="玉女剑法",info="古墓派玉女剑法",hard=5.0,tiaohe=0,type=1,suit=-0.4,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,6",lv=10,},{name="powerup_internalskill",argvs="玉女心经,25",lv=10,},{name="powerup_aoyi",argvs="古墓绝学.双剑合璧,25,5",lv=15,},{name="powerup_skill",argvs="玉女素心剑,12",lv=20,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.利器3",animation="hua",}, {name="古墓剑法",info="古墓派入门剑法",hard=5.0,tiaohe=0,type=1,suit=-0.4,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,6",lv=10,},{name="powerup_internalskill",argvs="玉女心经,25",lv=10,},{name="powerup_aoyi",argvs="古墓绝学.双剑合璧,25,5",lv=15,},{name="powerup_skill",argvs="玉女素心剑,12",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.利器3",animation="baozha_blue",}, {name="狂风刀法",info="沙尘暴来啦!",hard=5.0,tiaohe=0,type=2,suit=-0.4,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,7",lv=10,},{name="attribute",argvs="身法,10",lv=15,},{name="powerup_daofa",argvs="7",lv=20,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.利器2",animation="baozha",}, {name="玉蜂针",info="古墓派的暗器手法",hard=5.0,tiaohe=0,type=3,suit=-0.4,basepower=3,step=0.5,cd=0,buff="中毒.2.2.100", trigger={ {name="attribute",argvs="奇门兵器,7",lv=10,},{name="powerup_aoyi",argvs="玉蜂群,20,5",lv=15,},{name="attribute",argvs="奇门兵器,12",lv=20,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.暗器2",animation="anqi",}, {name="佛光普照",info="以峨眉九阳功为基础,掌力笼罩全身,挡无可挡,是为峨眉绝学。",hard=5.0,tiaohe=0,type=0,suit=0.6,basepower=4,step=0.5,cd=0,buff="恢复.2#防御强化.2", trigger={ {name="attribute",argvs="搏击格斗,10",lv=10,},{name="powerup_internalskill",argvs="峨眉九阳功,50",lv=10,},{name="powerup_internalskill",argvs="九阳神功,10",lv=20,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.拳击",animation="foxiang",}, {name="阴阳倒乱刃",info="胡天胡地,随心所欲",hard=5.0,tiaohe=0,type=3,suit=-0.9,basepower=4,step=0.4,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,14",lv=10,},{name="attribute",argvs="奇门兵器,14",lv=12,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.利器6",animation="jinshejianfa",}, {name="铁剑剑法",info="铁剑门的剑法",hard=6,tiaohe=0,type=1,suit=0.4,basepower=3,step=0.5,cd=0,buff="轻身.0", trigger={ {name="attribute",argvs="使剑技巧,7",lv=10,},{name="powerup_internalskill",argvs="铁血大旗功,10",lv=15,},{name="",argvs="",lv=0,}, },icon="shuiyuechenghua",audio="音效.利器3",animation="dabiaoxue",}, {name="雪山剑法",info="雪山派入门剑法",hard=6,tiaohe=0,type=1,suit=-0.4,basepower=3,step=0.5,cd=0,buff="定身.0.1.10", trigger={ {name="attribute",argvs="使剑技巧,7",lv=10,},{name="attribute",argvs="定力,7",lv=15,},{name="attribute",argvs="使剑技巧,7",lv=20,},{name="",argvs="",lv=0,}, },icon="quyuefenghuaxueyue",audio="音效.利器3",animation="baozha_blue",}, {name="一剑化三清",info="全真教的高阶剑术",hard=6,tiaohe=0,type=1,suit=0.4,basepower=4.5,step=0.5,cd=0,buff="轻身.0", trigger={ {name="attribute",argvs="使剑技巧,10",lv=10,},{name="powerup_aoyi",argvs="全真绝学.太乙剑诀,25,5",lv=14,},{name="powerup_aoyi",argvs="全真绝学.重阳剑法,25,5",lv=18,},{name="critical",argvs="8.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.飙血",animation="flower2",}, {name="如来千手法",info="少林七十二绝技之一",hard=6,tiaohe=0,type=0,suit=-0.4,basepower=2.5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,10",lv=10,},{name="attribute",argvs="福缘,10",lv=10,},{name="sp",argvs="0.05",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.拳击",animation="baozha4",}, {name="化骨绵掌",info="阴毒的化骨绵掌",hard=6,tiaohe=0,type=0,suit=-0.3,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,11",lv=10,},{name="attribute",argvs="搏击格斗,11",lv=20,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.拳击",animation="longjuanfeng_green",}, {name="百变千幻云雾十三式",info="衡山派莫大绝学",hard=6,tiaohe=0,type=1,suit=-0.5,basepower=4,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,10",lv=10,},{name="attribute",argvs="身法,30",lv=14,},{name="critical",argvs="8",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.剑",animation="yuxiaojianfa",}, {name="须弥山掌",info="须弥芥子,一叶一菩提",hard=6,tiaohe=0,type=3,suit=0.7,basepower=6,step=0.5,cd=0,buff="防御强化.1.3.50#重伤", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="定力,9",lv=15,},{name="attribute",argvs="臂力,9",lv=20,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.拳击",animation="taiji_blue",}, {name="大洪拳",info="方世玉改进的大洪拳是南派武学的代表",hard=6,tiaohe=0,type=0,suit=0.4,basepower=3.2,step=0.6,cd=0,buff="攻击强化.3#攻击弱化.3", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="臂力,12",lv=14,},{name="powerup_skill",argvs="如来神掌,12",lv=20,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.奥义5",animation="baozha5",}, {name="五大夫剑法",info="泰山派镇派剑法",hard=6,tiaohe=0,type=1,suit=0.4,basepower=5,step=0.6,cd=0,buff="攻击弱化", trigger={ {name="attribute",argvs="使剑技巧,10",lv=10,},{name="attribute",argvs="使剑技巧,10",lv=20,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.利器2",animation="baozha_green",}, {name="忘情剑",info="记载在紫阳剑经上的武当绝学剑法",hard=6,tiaohe=0,type=1,suit=0.4,basepower=5,step=0.7,cd=0,buff="攻击弱化", trigger={ {name="attribute",argvs="使剑技巧,12",lv=10,},{name="attribute",argvs="使剑技巧,15",lv=10,},{name="defence",argvs="20,8",lv=14,},{name="powerup_jianfa",argvs="6",lv=18,},{name="critical",argvs="8.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.利器2",animation="taiji4",}, {name="雁行刀",info="征蓬出汉塞,归雁落胡边",hard=6,tiaohe=0,type=2,suit=-0.3,basepower=2,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,8",lv=10,},{name="powerup_daofa",argvs="6",lv=20,},{name="",argvs="",lv=0,}, },icon="shuiyuechenghua",audio="音效.利器6",animation="baozha",}, {name="夫妻刀法",info="女貌郎才珠万斛,天教艳质为眷属。",hard=6,tiaohe=0,type=2,suit=-0.5,basepower=6.5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,12",lv=10,},{name="attribute",argvs="耍刀技巧,12",lv=15,},{name="powerup_skill",argvs="鸳鸯刀法,30",lv=20,},{name="",argvs="",lv=0,}, },icon="quyuefenghuaxueyue",audio="音效.利器7",animation="baozha",}, {name="七弦无形剑",info="黄钟公自创的绝技,在琴音中灌注上乘内力扰敌心神",hard=6,tiaohe=0,type=3,suit=-0.5,basepower=5,step=0.45,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,9",lv=10,},{name="attribute",argvs="奇门兵器,5",lv=14,},{name="attribute",argvs="奇门兵器,5",lv=18,},{name="attribute",argvs="悟性,15",lv=20,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.破空钝器",animation="guanghuan_orange",}, {name="伏魔棍",info="少林伏魔棍,韦陀棍的进阶版",hard=6,tiaohe=0,type=3,suit=0.7,basepower=5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,10",lv=10,},{name="attribute",argvs="奇门兵器,5",lv=14,},{name="attribute",argvs="奇门兵器,5",lv=18,},{name="attribute",argvs="定力,15",lv=20,},{name="powerup_internalskill",argvs="易筋经,10",lv=20,},{name="powerup_skill",argvs="伏魔棍,12",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.钝器2",animation="guanghuan_orange",}, {name="碧针清掌",info="谢烟客的拿手绝学掌法",hard=6.0,tiaohe=0,type=0,suit=-0.5,basepower=5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,15",lv=10,},{name="attribute",argvs="定力,15",lv=15,},{name="attribute",argvs="搏击格斗,10",lv=20,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.拳3",animation="yuxiaojianfa",}, {name="达摩剑法",info="少林七十二绝技",hard=6.0,tiaohe=0,type=1,suit=1,basepower=4,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,12",lv=10,},{name="attribute",argvs="臂力,12",lv=10,},{name="attribute",argvs="臂力,12",lv=15,},{name="powerup_jianfa",argvs="5",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.利器4",animation="fo",}, {name="太白剑法",info="传说李白用的剑法",hard=6.0,tiaohe=1,type=1,suit=0,basepower=4,step=0.6,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,16",lv=10,},{name="powerup_internalskill",argvs="太玄神功,10",lv=15,},{name="critical",argvs="8.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.利器4",animation="guanghuan_shengji",}, {name="上清剑法",info="玄素庄高深剑法",hard=6.0,tiaohe=1,type=1,suit=0,basepower=4,step=0.6,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,14",lv=10,},{name="powerup_internalskill",argvs="太玄神功,10",lv=15,},{name="critical",argvs="8.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.利器4",animation="guanghuan_shengji",}, {name="归藏剑",info="灵鹫宫的高深剑法",hard=6.0,tiaohe=1,type=1,suit=0,basepower=3,step=0.6,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,10",lv=10,},{name="attribute",argvs="使剑技巧,10",lv=20,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.利器4",animation="guanghuan_shengji",}, {name="金乌刀法",info="史婆婆为了对付自大的丈夫白自在所创刀法",hard=6.0,tiaohe=0,type=2,suit=1,basepower=4,step=0.7,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,13",lv=10,},{name="powerup_internalskill",argvs="太玄神功,10",lv=15,},{name="critical",argvs="8.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.利器6",animation="miaojiajianfa",}, {name="般若掌",info="少林寺七十二绝技,波若波罗密",hard=6.0,tiaohe=0,type=0,suit=0.7,basepower=4.5,step=0.5,cd=0,buff="攻击弱化.1.3.100#晕眩.0.1", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="defence",argvs="30,5",lv=16,},{name="defence",argvs="30,5",lv=20,},{name="",argvs="",lv=0,}, },icon="shuiyuechenghua",audio="音效.打破罐子",animation="baozha",}, {name="日月鞭法",info="日月神教的鞭法",hard=6.0,tiaohe=0,type=3,suit=-0.8,basepower=4.5,step=0.5,cd=0,buff="缓速.2", trigger={ {name="attribute",argvs="奇门兵器,9",lv=10,},{name="attribute",argvs="奇门兵器,6",lv=15,},{name="powerup_qimen",argvs="3",lv=20,},{name="",argvs="",lv=0,}, },icon="quyuefenghuaxueyue",audio="音效.钝器3",animation="heixue",}, {name="金蛇游身掌",info="金蛇秘籍中所记载的掌法,尽是奇巧招数",hard=6.0,tiaohe=0,type=0,suit=-0.8,basepower=5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="powerup_skill",argvs="金蛇剑法,7",lv=15,},{name="powerup_skill",argvs="金蛇剑法,10",lv=20,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.拳3",animation="zhang",}, {name="金蛇锥",info="金蛇秘籍中所记载的暗器手法,极尽奇巧之能事",hard=6.0,tiaohe=0,type=3,suit=-0.9,basepower=5.5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,12",lv=10,},{name="powerup_skill",argvs="金蛇剑法,7",lv=15,},{name="powerup_skill",argvs="金蛇剑法,10",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.利器5",animation="kulou_green",}, {name="七星七绝剑",info="全真教根据北斗七星位置参悟的高阶剑法",hard=7.0,tiaohe=1.0,type=1,suit=0.0,basepower=4,step=0.6,cd=0,buff="致盲.3", trigger={ {name="attribute",argvs="使剑技巧,15",lv=10,},{name="mingzhong",argvs="25",lv=14,},{name="powerup_aoyi",argvs="全真绝学.太乙剑诀,25,5",lv=16,},{name="powerup_aoyi",argvs="全真绝学.重阳剑法,25,5",lv=20,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.长剑",animation="maichong_blue",}, {name="寒冰神掌",info="左冷禅的寒冰绝学",hard=7,tiaohe=0,type=0,suit=-0.8,basepower=5,step=0.5,cd=0,buff="中毒.3", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="根骨,20",lv=10,},{name="attribute",argvs="根骨,20",lv=15,},{name="powerup_internalskill",argvs="寒冰真气,20",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.奥义1",animation="bingkuai",}, {name="龙爪手",info="少林寺七十二绝技",hard=7,tiaohe=0,type=0,suit=0.6,basepower=4,step=0.5,cd=0,buff="攻击弱化.3", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="critical",argvs="15",lv=15,},{name="mingzhong",argvs="15",lv=18,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.利器7",animation="long",}, {name="鹰爪功",info="白眉鹰王殷天正的成名绝技",hard=7,tiaohe=0,type=0,suit=-0.6,basepower=4,step=0.5,cd=0,buff="攻击强化.3", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attack",argvs="30,2",lv=16,},{name="critical",argvs="10.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.鸟啄",animation="long",}, {name="大金刚掌",info="少林寺七十二绝技,威力澎湃",hard=7,tiaohe=0,type=0,suit=0.7,basepower=4,step=0.5,cd=0,buff="内伤.3#晕眩.0.1", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="臂力,12",lv=14,},{name="attribute",argvs="臂力,12",lv=20,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.拳3",animation="foxiang",}, {name="袖里乾坤",info="少林寺七十二绝技",hard=7,tiaohe=0,type=0,suit=-0.6,basepower=4,step=0.5,cd=0,buff="中毒.3", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="定力,12",lv=14,},{name="attribute",argvs="定力,12",lv=20,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.拳2",animation="guanghuan_orange",}, {name="天竺佛指",info="少林寺七十二绝技",hard=7,tiaohe=0,type=0,suit=-0.6,basepower=4,step=0.5,cd=0,buff="缓速.3", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="福缘,12",lv=14,},{name="attribute",argvs="福缘,12",lv=20,},{name="",argvs="",lv=0,}, },icon="shuiyuechenghua",audio="音效.拳2",animation="guanghuan_blue",}, {name="天山六阳掌",info="逍遥派绝学,据说能够轻易发动生死符。",hard=7,tiaohe=0,type=0,suit=0.8,basepower=5,step=0.5,cd=0,buff="内伤.3", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="powerup_internalskill",argvs="八荒六合唯我独尊功,7",lv=13,},{name="powerup_aoyi",argvs="逍遥绝学.生死符,10,3",lv=15,},{name="powerup_internalskill",argvs="八荒六合唯我独尊功,7",lv=18,},{name="powerup_aoyi",argvs="逍遥绝学.生死符,10,3",lv=20,},{name="",argvs="",lv=0,}, },icon="quyuefenghuaxueyue",audio="音效.拳3",animation="guanghuan_yellow",}, {name="岳家枪法",info="岳飞戎马一生的总结",hard=7,tiaohe=0,type=3,suit=0.8,basepower=5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,12",lv=10,},{name="critical",argvs="10",lv=18,},{name="powerup_qimen",argvs="10",lv=20,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.猛兽3",animation="baozha5",}, {name="黑血神针",info="阴险狠毒的暗器",hard=7,tiaohe=0,type=3,suit=-0.7,basepower=5.5,step=0.5,cd=0,buff="中毒.3", trigger={ {name="attribute",argvs="奇门兵器,9",lv=10,},{name="powerup_qimen",argvs="3",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.利器5",animation="kulou",}, {name="伏魔杖法",info="少林七十二绝技",hard=7,tiaohe=0,type=3,suit=0.7,basepower=5,step=0.5,cd=0,buff="重伤", trigger={ {name="attribute",argvs="奇门兵器,10",lv=10,},{name="attribute",argvs="臂力,10",lv=14,},{name="attribute",argvs="臂力,10",lv=16,},{name="powerup_qimen",argvs="5",lv=20,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.钝器3",animation="fo",}, {name="玉女素心剑",info="君子淑女,双剑合璧",hard=7.0,tiaohe=0,type=1,suit=-1.1,basepower=4,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,15",lv=10,},{name="powerup_aoyi",argvs="古墓绝学.双剑合璧,15,8",lv=13,},{name="powerup_aoyi",argvs="古墓绝学.双剑合璧,10,3",lv=18,},{name="powerup_jianfa",argvs="8",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.利器6",animation="luoxing_purple",}, {name="绝户虎爪手",info="武当俞莲舟自创武学,招式狠毒,招招拿人下阴",hard=7.0,tiaohe=0,type=0,suit=-1.3,basepower=6.5,step=0.5,cd=0,buff="定身.2.2.80", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="搏击格斗,12",lv=15,},{name="attribute",argvs="定力,5",lv=18,},{name="powerup_aoyi",argvs="绝户虎爪手.断子绝孙爪,30,15",lv=20,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.利器4",animation="kulou_green",}, {name="夺命连环三仙剑",info="华山剑宗绝技,一连三剑,一剑快过一剑",hard=7.0,tiaohe=0,type=1,suit=-0.5,basepower=7.0,step=0.6,cd=0,buff="神速攻击.2", trigger={ {name="attribute",argvs="使剑技巧,10",lv=10,},{name="powerup_aoyi",argvs="华山一剑,15,5",lv=15,},{name="critical",argvs="12",lv=20,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.利器6",animation="pilihuo",}, {name="柔云剑法",info="武当派剑法",hard=7.0,tiaohe=0,type=1,suit=-0.8,basepower=4,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,10",lv=10,},{name="powerup_skill",argvs="太极剑,10",lv=15,},{name="critical",argvs="8",lv=20,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.利器6",animation="ball_purple",}, {name="七伤摧魂针",info="阴狠毒辣的高深武学,江湖中人人为之色变",hard=7.0,tiaohe=0,type=3,suit=-1,basepower=5.0,step=0.6,cd=0,buff="", trigger={ {name="attribute",argvs="奇门兵器,12",lv=10,},{name="powerup_internalskill",argvs="九阴神功,12",lv=18,},{name="powerup_skill",argvs="九阴白骨爪,40",lv=20.0,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.暗器1",animation="zhua",}, {name="拈花指",info="源自于迦叶尊者割肉喂鹰的故事",hard=7.0,tiaohe=1,type=0,suit=0.6,basepower=5,step=0.55,cd=0,buff="麻痹", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="根骨,12",lv=14,},{name="attribute",argvs="臂力,12",lv=16,},{name="powerup_internalskill",argvs="易筋经,10",lv=20,},{name="",argvs="",lv=0,}, },icon="shuiyuechenghua",audio="音效.指法",animation="hua",}, {name="铁掌",info="这可不是金钟罩铁砂掌之流的武功",hard=7.0,tiaohe=0,type=0,suit=0.8,basepower=5,step=0.5,cd=0,buff="内伤.2", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="搏击格斗,12",lv=20,},{name="",argvs="",lv=0,}, },icon="quyuefenghuaxueyue",audio="音效.奥义3",animation="baozha5",}, {name="庖丁解牛",info="自《庄子》中领悟之绝学",hard=7.0,tiaohe=1,type=0,suit=0,basepower=4.5,step=0.5,cd=0,buff="攻击弱化", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="搏击格斗,5",lv=14,},{name="attribute",argvs="搏击格斗,5",lv=16,},{name="attribute",argvs="搏击格斗,5",lv=18,},{name="attribute",argvs="定力,8",lv=20,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.拳2",animation="dabiaoxue",}, {name="擒龙功",info="擒龙功",hard=7.0,tiaohe=0,type=0,suit=0.8,basepower=5,step=0.5,cd=0,buff="定身", trigger={ {name="attribute",argvs="搏击格斗,10",lv=10,},{name="powerup_skill",argvs="降龙十八掌,8",lv=15,},{name="powerup_skill",argvs="降龙十八掌,8",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.龙吼",animation="long_jin",}, {name="两仪剑法",info="两仪剑法",hard=7.0,tiaohe=0,type=1,suit=-0.8,basepower=4,step=0.5,cd=0,buff="缓速.3", trigger={ {name="attribute",argvs="使剑技巧,10",lv=10,},{name="critical",argvs="12",lv=20,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.剑",animation="bagua",}, {name="反两仪刀法",info="反两仪刀法",hard=7.0,tiaohe=0,type=2,suit=-0.8,basepower=4,step=0.5,cd=0,buff="缓速.3", trigger={ {name="attribute",argvs="耍刀技巧,10",lv=10,},{name="critical",argvs="10",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.拳2",animation="taiji_blue",}, {name="青莲掌法",info="传说是李白用的掌法",hard=7.0,tiaohe=0,type=0,suit=-0.7,basepower=5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,15",lv=10,},{name="attribute",argvs="身法,15",lv=15,},{name="attribute",argvs="搏击格斗,10",lv=20,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.拳3",animation="hua",}, {name="太极拳",info="武当派张三丰发明的阴柔相济拳法",hard=8,tiaohe=1,type=0,suit=0,basepower=3.5,step=0.65,cd=0,buff="防御强化", trigger={ {name="attribute",argvs="搏击格斗,10",lv=10,},{name="defence",argvs="40,5",lv=10,},{name="powerup_quanzhang",argvs="6",lv=15,},{name="powerup_aoyi",argvs="武当绝学.太极拳奥义,30,6",lv=18,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.拳3",animation="taiji4",}, {name="九阴白骨爪",info="九阴真经中的武功",hard=8,tiaohe=0,type=0,suit=-1,basepower=5,step=0.45,cd=0,buff="缓速", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="powerup_internalskill",argvs="九阴神功,12",lv=18,},{name="powerup_uniqueskill",argvs="九阴神功.九阴神爪,50",lv=20.0,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.暗器1",animation="zhua",}, {name="狂风快剑",info="华山剑宗快到极限的剑法",hard=8,tiaohe=0,type=1,suit=-0.8,basepower=5,step=0.6,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,10",lv=10,},{name="attribute",argvs="使剑技巧,15",lv=15,},{name="sp",argvs="0.1",lv=20,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.剑",animation="light",}, {name="血刀大法",info="极其邪恶的刀法",hard=8,tiaohe=1,type=2,suit=0,basepower=5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,10",lv=10,},{name="powerup_internalskill",argvs="血刀心法,15",lv=10,},{name="xi",argvs="7",lv=12,},{name="xi",argvs="7",lv=15,},{name="powerup_internalskill",argvs="血海魔功,25",lv=20,},{name="",argvs="",lv=0,}, },icon="shuiyuechenghua",audio="音效.利器6",animation="dabiaoxue",}, {name="日月神鞭",info="少林寺派绝技,金刚伏魔圈必须修炼的鞭法",hard=8.0,tiaohe=0,type=3,suit=1,basepower=7,step=0.45,cd=0,buff="麻痹", trigger={ {name="attribute",argvs="奇门兵器,8",lv=10,},{name="powerup_aoyi",argvs="少林阵法.金刚伏魔圈,35,10",lv=10,},{name="attribute",argvs="奇门兵器,8",lv=15,},{name="powerup_aoyi",argvs="少林阵法.金刚伏魔圈,35,5",lv=20,},{name="",argvs="",lv=0,}, },icon="quyuefenghuaxueyue",audio="音效.钝器3",animation="guanghuan_orange",}, {name="三阴蜈蚣爪",info="星宿派的高阶毒功。",hard=8.0,tiaohe=0,type=0,suit=-1,basepower=5.0,step=0.55,cd=0,buff="中毒.4.3.100#重伤.3", trigger={ {name="attribute",argvs="搏击格斗,15",lv=10,},{name="powerup_internalskill",argvs="化功大法,40",lv=16,},{name="critical",argvs="8.0",lv=20.0,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.暗器3",animation="longjuanfeng_green",}, {name="空明拳",info="会得了空明拳,也不见得能学会左右互搏",hard=8.0,tiaohe=1.0,type=0,suit=1.0,basepower=6,step=0.55,cd=0,buff="麻痹.2.2.100", trigger={ {name="attribute",argvs="搏击格斗,14",lv=10,},{name="talent",argvs="左右互搏",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.拳2",animation="jian_zhan",}, {name="燃木刀法",info="少林寺七十二绝技之一",hard=8.0,tiaohe=1,type=2,suit=0,basepower=5.0,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,10",lv=10,},{name="attribute",argvs="根骨,10",lv=12,},{name="critical",argvs="10",lv=20,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.威猛利器3",animation="huozhu_hong",}, {name="日月神掌",info="日月神教教主独步江湖的掌法",hard=8.0,tiaohe=0,type=0,suit=-0.8,basepower=6,step=0.5,cd=0,buff="内伤.2", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="defence",argvs="50,5",lv=15,},{name="anti_debuff",argvs="20",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.拳2",animation="baozha5",}, {name="一阳指",info="大理段氏绝技,以内力凝聚的一指。",hard=8.0,tiaohe=0,type=0,suit=1.0,basepower=6.0,step=0.5,cd=0,buff="恢复.5.3.100#攻击弱化", trigger={ {name="attribute",argvs="搏击格斗,10",lv=10,},{name="powerup_skill",argvs="六脉神剑,8",lv=14,},{name="talent",argvs="救死扶伤",lv=18,},{name="powerup_skill",argvs="六脉神剑,12",lv=20,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.内功攻击6",animation="guanghuan_yellow2",}, {name="倚天屠龙笔法",info="张翠山自张三丰书法中所领悟的神奇武学",hard=9.0,tiaohe=1,type=3,suit=0,basepower=6,step=0.6,cd=0,buff="封穴", trigger={ {name="attribute",argvs="奇门兵器,12",lv=10,},{name="powerup_qimen",argvs="5",lv=14,},{name="sp",argvs="0.15",lv=16,},{name="talent",argvs="倚天屠龙",lv=20,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.利器5",animation="flower2",}, {name="幻阴指",info="混元霹雳手成昆的邪恶武功。",hard=9,tiaohe=0,type=0,suit=-0.6,basepower=5.0,step=0.65,cd=0,buff="中毒.2.2.100#缓速.2.2.100", trigger={ {name="attribute",argvs="搏击格斗,10",lv=10,},{name="powerup_aoyi",argvs="阴阳双指,40,15",lv=15,},{name="powerup_aoyi",argvs="阴阳双指,40,15",lv=20,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.钝器5",animation="kulou_green",}, {name="弹指神通",info="桃花岛黄药师的弹指绝技",hard=9,tiaohe=0,type=0,suit=-0.6,basepower=4.5,step=0.65,cd=0,buff="封穴", trigger={ {name="attribute",argvs="搏击格斗,14",lv=10,},{name="powerup_aoyi",argvs="碧海潮生,30,10",lv=20,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.指2",animation="baozha2",}, {name="混元掌",info="自外而内修练「混元功」之用的掌式",hard=9,tiaohe=1,type=0,suit=0,basepower=5,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,10",lv=10,},{name="defence",argvs="45,10",lv=10,},{name="powerup_internalskill",argvs="混元功,50",lv=15,},{name="powerup_skill",argvs="混元掌奥义.劈石破玉拳,15,10",lv=20,},{name="",argvs="",lv=0,}, },icon="shuiyuechenghua",audio="音效.拳3",animation="hit",}, {name="三花聚顶掌",info="全真教名震天下的掌法绝学",hard=9,tiaohe=1,type=0,suit=0,basepower=7.0,step=0.6,cd=0,buff="内伤", trigger={ {name="attribute",argvs="搏击格斗,15",lv=10,},{name="attribute",argvs="臂力,15",lv=10,},{name="attribute",argvs="臂力,15",lv=15,},{name="powerup_skill",argvs="三花聚顶掌,15",lv=18,},{name="powerup_aoyi",argvs="全真绝学.三花聚顶,30,20",lv=20,},{name="attribute",argvs="定力,10",lv=20,},{name="",argvs="",lv=0,}, },icon="quyuefenghuaxueyue",audio="音效.钝器5",animation="hua",}, {name="神门十三剑",info="武当派张松溪自创剑法,一共十三招,专刺神门穴",hard=9,tiaohe=1,type=1,suit=0,basepower=5.6,step=0.6,cd=0,buff="致盲.4", trigger={ {name="attribute",argvs="使剑技巧,15",lv=10,},{name="powerup_skill",argvs="太极剑,12",lv=15,},{name="mingzhong",argvs="100",lv=20,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.长剑",animation="baozha3",}, {name="火焰刀法",info="虽名为刀,实际是掌法。会了这个,就不用带打火机了",hard=9,tiaohe=0,type=0,suit=0.5,basepower=5.0,step=0.6,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="powerup_aoyi",argvs="大轮绝学.般若火舞,25,5",lv=14,},{name="powerup_aoyi",argvs="大轮绝学.般若火舞,25,5",lv=17,},{name="powerup_internalskill",argvs="龙象般若功,15",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.拳1",animation="fire",}, {name="破玉拳",info="华山成名技,大拙若巧,化繁为简,有破玉之威力",hard=9,tiaohe=0,type=0,suit=0.8,basepower=6,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="powerup_skill",argvs="混元掌,25",lv=15,},{name="powerup_internalskill",argvs="混元功,25",lv=17,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.拳1",animation="zhang",}, {name="碧落苍穹",info="铁剑门失传剑法,碧落苍穹九重天",hard=9.0,tiaohe=1,type=1,suit=0,basepower=6,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,12",lv=10,},{name="powerup_jianfa",argvs="5",lv=15,},{name="powerup_skill",argvs="碧落苍穹,15",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.威猛利器2",animation="huozhu_hong",}, {name="天外飞龙",info="华山剑法顶级剑法绝学",hard=9.0,tiaohe=1,type=1,suit=0,basepower=6,step=0.6,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,14",lv=10,},{name="attribute",argvs="使剑技巧,15",lv=15,},{name="powerup_skill",argvs="天外飞龙,15",lv=20,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.威猛利器3",animation="long3",}, {name="大力金刚指",info="火工头陀受了几年打,练成的绝技",hard=9.0,tiaohe=0,type=0,suit=1.0,basepower=6,step=0.5,cd=0,buff="重伤#封穴", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attack",argvs="80,5",lv=12,},{name="attribute",argvs="臂力,15",lv=14,},{name="powerup_aoyi",argvs="西域少林绝学.大力金刚指,20,10",lv=15,},{name="powerup_aoyi",argvs="西域少林绝学.大力金刚指,20,10",lv=18,},{name="powerup_skill",argvs="大力金刚指,30",lv=20,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.奥义4",animation="fo",}, {name="太极剑",info="武当派张三丰发明的阴柔相济剑法",hard=9.0,tiaohe=1,type=1,suit=0,basepower=4,step=0.65,cd=0,buff="麻痹", trigger={ {name="attribute",argvs="使剑技巧,15",lv=10,},{name="defence",argvs="30,8",lv=10,},{name="powerup_aoyi",argvs="武当绝学.太极剑奥义,15,3",lv=10,},{name="powerup_jianfa",argvs="6",lv=15,},{name="powerup_aoyi",argvs="武当绝学.太极剑奥义,30,6",lv=18,},{name="powerup_uniqueskill",argvs="太极剑.无我无剑,30",lv=20.0,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.利器7",animation="taiji3",}, {name="苗家剑法",info="金面佛苗人凤的家传剑法",hard=9.0,tiaohe=0,type=1,suit=1.1,basepower=5,step=0.5,cd=0,buff="内伤.2#缓速.2", trigger={ {name="attribute",argvs="使剑技巧,16",lv=10,},{name="powerup_aoyi",argvs="绝学.刀剑归真,10,2",lv=10,},{name="powerup_jianfa",argvs="5",lv=14,},{name="powerup_aoyi",argvs="绝学.刀剑归真,20,5",lv=20,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.利器5",animation="miaojiajianfa",}, {name="连城剑法",info="铁骨墨萼梅念笙大侠所创剑法,又称唐诗剑法",hard=10,tiaohe=1,type=1,suit=0,basepower=5,step=0.6,cd=0,buff="定身", trigger={ {name="attribute",argvs="使剑技巧,16",lv=10,},{name="critical",argvs="25",lv=15,},{name="powerup_aoyi",argvs="绝学.唐诗剑法,15,8",lv=20,},{name="",argvs="",lv=0,}, },icon="shuiyuechenghua",audio="音效.利器4",animation="guanghuan_shengji",}, {name="药王神掌",info="毒手药王的武功",hard=10.0,tiaohe=0,type=0,suit=-1,basepower=5,step=0.4,cd=0,buff="内伤.3#中毒.6.5.100", trigger={ {name="attribute",argvs="搏击格斗,8",lv=10,},{name="talent",argvs="毒系精通",lv=10,},{name="talent",argvs="毒圣",lv=20.0,},{name="",argvs="",lv=0,}, },icon="quyuefenghuaxueyue",audio="音效.拳2",animation="duyao2",}, {name="玄冥神掌",info="连张三丰都怕的毒功",hard=10,tiaohe=0,type=0,suit=-1.1,basepower=6,step=0.4,cd=0,buff="内伤.3#中毒.6.5.100", trigger={ {name="attribute",argvs="搏击格斗,12",lv=10,},{name="attribute",argvs="搏击格斗,8",lv=20,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.猛兽2",animation="duyao2",}, {name="六脉神剑",info="源于一阳指的大理段氏绝学,以气御指,化为剑气",hard=10,tiaohe=1,type=0,suit=0.0,basepower=6,step=0.6,cd=0,buff="内伤.5#封穴", trigger={ {name="attribute",argvs="搏击格斗,16",lv=10,},{name="mingzhong",argvs="35",lv=14,},{name="critical",argvs="20",lv=18,},{name="talent",argvs="无形剑气",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.内功攻击4",animation="ball_purple",}, {name="黯然销魂掌",info="问世间情为何物",hard=10,tiaohe=0,type=0,suit=-1.3,basepower=7,step=0.5,cd=0,buff="重伤.3", trigger={ {name="attribute",argvs="搏击格斗,16",lv=10,},{name="attribute",argvs="臂力,16",lv=14,},{name="powerup_aoyi",argvs="黯然销魂.左手帝,15,5",lv=15,},{name="powerup_aoyi",argvs="黯然销魂.左手帝,15,5",lv=20,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.奥义2",animation="ball_purple",}, {name="胡家刀法",info="辽东大侠胡一刀的家传刀法",hard=10,tiaohe=1.0,type=2,suit=0.0,basepower=7.0,step=0.6,cd=0,buff="内伤.2", trigger={ {name="attribute",argvs="耍刀技巧,16",lv=10,},{name="powerup_aoyi",argvs="胡家刀法奥义.穿手藏刀,10,10",lv=12,},{name="powerup_aoyi",argvs="胡家刀法奥义.鹞子翻身刀,10,10",lv=14,},{name="powerup_aoyi",argvs="胡家刀法奥义.怀中抱月,10,10",lv=16,},{name="powerup_aoyi",argvs="绝学.刀剑归真,10,10",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.威猛利器3",animation="hujiadaofa",}, {name="金蛇剑法",info="金蛇郎君驰骋江湖的武功",hard=10,tiaohe=1,type=1,suit=0,basepower=6,step=0.6,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,15",lv=10,},{name="mingzhong",argvs="15",lv=13,},{name="powerup_skill",argvs="金蛇剑法,10",lv=15,},{name="powerup_aoyi",argvs="金蛇郎君.金蛇剑法奥义,20,5",lv=16,},{name="powerup_aoyi",argvs="金蛇郎君.金蛇剑法奥义,20,7",lv=20,},{name="",argvs="",lv=0,}, },icon="qiannianshengong",audio="音效.利器6",animation="jinshejianfa",}, {name="七伤拳",info="崆峒派镇派绝学,伤人伤己",hard=10,tiaohe=1,type=0,suit=0,basepower=8,step=0.45,cd=0,buff="缓速#定身#麻痹#重伤#晕眩#致盲#内伤", trigger={ {name="attribute",argvs="搏击格斗,14",lv=10,},{name="attribute",argvs="搏击格斗,14",lv=15,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.拳3",animation="qiege_blue",}, {name="天山折梅手",info="逍遥派的至高绝学",hard=10,tiaohe=0,type=0,suit=-1,basepower=7,step=0.5,cd=0,buff="内伤.3", trigger={ {name="attribute",argvs="搏击格斗,16",lv=10,},{name="powerup_internalskill",argvs="北冥神功,25",lv=12,},{name="powerup_internalskill",argvs="八荒六合唯我独尊功,25",lv=14,},{name="mingzhong",argvs="25",lv=16,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.拳2",animation="flower_jian",}, {name="辟邪剑法",info="邪恶阴毒至极的剑法",hard=10,tiaohe=0,type=1,suit=-1,basepower=7.0,step=0.6,cd=0,buff="致盲.2.2.100", trigger={ {name="attribute",argvs="使剑技巧,16",lv=10,},{name="attribute",argvs="身法,25",lv=13,},{name="powerup_internalskill",argvs="葵花宝典,15",lv=16,},{name="attribute",argvs="身法,30",lv=18,},{name="powerup_internalskill",argvs="葵花宝典,15",lv=20.0,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.利器6",animation="longjuanfeng_green",}, {name="鸳鸯刀法",info="一个仁者无敌的传说!",hard=10,tiaohe=1,type=2,suit=0,basepower=6,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="耍刀技巧,14",lv=10,},{name="mingzhong",argvs="100",lv=20,},{name="",argvs="",lv=0,}, },icon="shuiyuechenghua",audio="音效.利器2",animation="hua",}, {name="打狗棒法",info="丐帮镇帮之宝",hard=10,tiaohe=1,type=3,suit=0.0,basepower=6.5,step=0.5,cd=0,buff="定身", trigger={ {name="attribute",argvs="奇门兵器,15",lv=10,},{name="talent",argvs="寸长寸强",lv=16,},{name="powerup_qimen",argvs="15",lv=20,},{name="sp",argvs="0.1",lv=20,},{name="",argvs="",lv=0,}, },icon="quyuefenghuaxueyue",audio="音效.利器6",animation="gunzi",}, {name="斗转星移",info="姑苏慕容氏的家传绝技",hard=10.0,tiaohe=1,type=3,suit=0,basepower=6.0,step=0.5,cd=0,buff="防御强化.3.3.100", trigger={ {name="attribute",argvs="奇门兵器,20",lv=10,},{name="powerup_qimen",argvs="8",lv=16,},{name="",argvs="",lv=0,}, },icon="paiji",audio="音效.拳2",animation="luoxing_purple",}, {name="如来神掌",info="世间真的有真佛么",hard=10,tiaohe=0,type=0,suit=1,basepower=6,step=0.8,cd=0,buff="重伤.3", trigger={ {name="attribute",argvs="搏击格斗,16",lv=10,},{name="attribute",argvs="臂力,16",lv=14,},{name="powerup_skill",argvs="如来神掌,15",lv=20,},{name="",argvs="",lv=0,}, },icon="pllhd",audio="音效.拳2",animation="aoyi_zhangblue",}, {name="天山剑法",info="天山大侠所传下的神奇武功",hard=10,tiaohe=0,type=1,suit=0,basepower=3,step=0.5,cd=0,buff="", trigger={ {name="attribute",argvs="使剑技巧,10",lv=8,},{name="talent",argvs="御剑",lv=12,},{name="talent",argvs="百穴归一",lv=20,},{name="attribute",argvs="使剑技巧,10",lv=10,},{name="",argvs="",lv=0,}, },icon="polangjue",audio="音效.剑",animation="baozha_cheng",}, {name="玄铁剑法",info="重剑无锋,大巧不工",hard=10.0,tiaohe=1,type=1,suit=0,basepower=6.0,step=0.6,cd=0,buff="内伤", trigger={ {name="attribute",argvs="使剑技巧,15",lv=10,},{name="attribute",argvs="臂力,12",lv=10,},{name="powerup_aoyi",argvs="绝学.无招胜有招,15,5",lv=14,},{name="attribute",argvs="臂力,12",lv=18,},{name="talent",argvs="孤独求败",lv=20,},{name="",argvs="",lv=0,}, },icon="qianlizhongyunsi",audio="音效.破空钝器",animation="fire",}, {name="降龙十八掌",info="丐帮镇派绝学,至刚至烈的掌法",hard=11.0,tiaohe=0,type=0,suit=1.4,basepower=7.5,step=0.6,cd=0,buff="集气.2.2.100#重伤", trigger={ {name="attribute",argvs="搏击格斗,16",lv=10,},{name="mingzhong",argvs="12",lv=12,},{name="powerup_quanzhang",argvs="10",lv=14,},{name="talent",argvs="铁拳无双",lv=18,},{name="powerup_aoyi",argvs="降龙十八掌奥义式,15,15",lv=20,},{name="powerup_aoyi",argvs="降龙十八掌.履霜冰至,15,4",lv=20,},{name="powerup_aoyi",argvs="降龙十八掌.震惊百里,15,4",lv=20,},{name="powerup_aoyi",argvs="降龙十八掌.密云不雨,15,4",lv=20,}, },icon="qiannianshengong",audio="音效.破空钝器",animation="long3",}, {name="独孤九剑",info="独孤求败纵横天下的无敌剑法",hard=11,tiaohe=1,type=1,suit=0,basepower=6,step=0.7,cd=0,buff="集气.2", trigger={ {name="attribute",argvs="使剑技巧,14",lv=10,},{name="powerup_jianfa",argvs="4",lv=18,},{name="talent",argvs="孤独求败",lv=20,},{name="attribute",argvs="使剑技巧,15",lv=20,},{name="",argvs="",lv=0,}, },icon="qingfengzhang",audio="音效.威猛利器2",animation="jianqi",}, {name="烈焰黑枪",info="神秘的黑暗武学",hard=12.0,tiaohe=1,type=3,suit=1,basepower=10,step=1,cd=0,buff="中毒.3#缓速.3#内伤.3", trigger={ {name="attribute",argvs="奇门兵器,20",lv=10,},{name="",argvs="",lv=0,}, },icon="qmscd",audio="音效.利器5",animation="heixue",}, {name="烈焰黑剑",info="神秘的黑暗武学",hard=12.0,tiaohe=1,type=1,suit=1,basepower=10,step=1,cd=0,buff="中毒.3#缓速.3#内伤.3", trigger={ {name="attribute",argvs="使剑技巧,20",lv=10,},{name="",argvs="",lv=0,}, },icon="quyueburugui",audio="音效.利器5",animation="heixue",}, {name="野球拳",info="江湖混混与人胡搅蛮缠的拳法",hard=12,tiaohe=1,type=0,suit=0,basepower=2,step=0.1,cd=0,buff="", trigger={ {name="attribute",argvs="搏击格斗,18",lv=5,},{name="powerup_quanzhang",argvs="3",lv=10,},{name="powerup_aoyi",argvs="草头百姓的逆袭.这下子逆天了,15,5",lv=15,},{name="talent",argvs="神拳无敌",lv=20,},{name="",argvs="",lv=0,}, },icon="shuiyuechenghua",audio="音效.拳2",animation="kongmingquan",}, {name="越女剑法",info="无法琢磨的神奇剑法",hard=12,tiaohe=1,type=1,suit=0,basepower=6,step=0.8,cd=0,buff="集气.2", trigger={ {name="attribute",argvs="使剑技巧,18",lv=10,},{name="powerup_jianfa",argvs="5",lv=15,},{name="talent",argvs="越女剑",lv=20,},{name="",argvs="",lv=0,}, },icon="silijinleisi",audio="音效.飙血",animation="jianhuan",}, {name="墨拳",info="传自战国墨家的古老拳法",hard=12.0,tiaohe=1.0,type=0.0,suit=0.0,basepower=6.0,step=1.0,cd=0.0,buff="重伤.3", trigger={ {name="talent",argvs="哀歌",lv=3.0,},{name="talent",argvs="斗魂",lv=5.0,},{name="talent",argvs="追魂",lv=10.0,},{name="",argvs="",lv=0,}, },icon="shuifengdaofa",audio="音效.拳3",animation="aoyi_zhangblue",}, {name="墨剑",info="传自战国墨家的古老剑法",hard=12.0,tiaohe=1.0,type=1.0,suit=0.0,basepower=6.0,step=0.8,cd=0.0,buff="神速攻击.3", trigger={ {name="talent",argvs="破甲",lv=5.0,},{name="talent",argvs="琴胆剑心",lv=10.0,},{name="",argvs="",lv=0,}, },icon="shuilongduankong",audio="音效.飙血",animation="jianhuan",}, {name="缚星锁",info="传自战国的古老武功,相传可缚住天上日月星辰",hard=12.0,tiaohe=1.0,type=3.0,suit=0.0,basepower=6.0,step=1.0,cd=0.0,buff="定身.10.10.100", trigger={ {name="attribute",argvs="奇门兵器,10",lv=10,},{name="",argvs="",lv=0,}, },icon="shenfengjian",audio="音效.钝器3",animation="guanghuan_orange",}, } return skills
elite_royal_guardian_icy_cleave = class({}) LinkLuaModifier( 'elite_royal_guardian_icy_cleave_modifier', 'encounters/elite_royal_guardian/elite_royal_guardian_icy_cleave_modifier', LUA_MODIFIER_MOTION_NONE ) function elite_royal_guardian_icy_cleave:OnSpellStart() --- Get Caster, Victim, Player, Point --- local caster = self:GetCaster() local caster_loc = caster:GetAbsOrigin() local playerID = caster:GetPlayerOwnerID() local player = PlayerResource:GetPlayer(playerID) local team = caster:GetTeamNumber() local victim = GetNearestHeroEntity(caster) if not victim then return end local victim_loc = victim:GetAbsOrigin() --- Get Special Values --- local AoERadius = self:GetSpecialValueFor("AoERadius") local duration = self:GetSpecialValueFor("duration") local delay = self:GetSpecialValueFor("delay") local attack_speed_constant = self:GetSpecialValueFor("attack_speed_constant") local move_speed_percentage = self:GetSpecialValueFor("move_speed_percentage") local damage_max_hp_percentage = self:GetSpecialValueFor("damage_max_hp_percentage") local damage_min_hp_percentage = self:GetSpecialValueFor("damage_min_hp_percentage") local cooldown_max_hp = self:GetSpecialValueFor("cooldown_max_hp") local cooldown_min_hp = self:GetSpecialValueFor("cooldown_min_hp") local damage_range = damage_max_hp_percentage - damage_min_hp_percentage local damage = damage_min_hp_percentage + ( damage_range * ( caster:GetHealthPercent() / 100 ) ) caster:AddNewModifier(caster, self, "casting_rooted_modifier", {duration=delay}) DisableMotionControllers(caster, delay) TurnToLoc(caster, victim_loc, delay) -- Sound -- local sound = {"sven_sven_attack_01", "sven_sven_attack_05", "sven_sven_attack_03", "sven_sven_attack_09"} EmitAnnouncerSound( sound[RandomInt(1, #sound)] ) local location local turn_delay = 0.5 local timer = Timers:CreateTimer(turn_delay, function() -- Location -- location = caster_loc + ( caster:GetForwardVector() * ( AoERadius/1.5 ) ) location = GetGroundPosition(location, caster) + Vector(0,0,25) EncounterGroundAOEWarningSticky(location, AoERadius, delay+0.1) end) PersistentTimer_Add(timer) local timer = Timers:CreateTimer(delay-0.45, function() -- Animation -- StartAnimation(caster, {duration=2, activity=ACT_DOTA_ATTACK, rate=1, translate="fear"}) end) PersistentTimer_Add(timer) local timer = Timers:CreateTimer(delay, function() -- Sound -- caster:EmitSound("Hero_Centaur.DoubleEdge") local locationParticle = caster_loc + ( caster:GetForwardVector() * ( AoERadius/2.0 ) ) -- Particle -- local particle = ParticleManager:CreateParticle("particles/econ/items/sven/sven_ti7_sword/sven_ti7_sword_spell_great_cleave.vpcf", PATTACH_CUSTOMORIGIN, nil) ParticleManager:SetParticleControlOrientation( particle, 0, caster:GetForwardVector(), caster:GetRightVector(), caster:GetUpVector() ) ParticleManager:SetParticleControl( particle, 0, locationParticle ) ParticleManager:SetParticleControl( particle, 1, locationParticle ) ParticleManager:SetParticleControl( particle, 2, locationParticle ) ParticleManager:SetParticleControl( particle, 3, locationParticle ) ParticleManager:SetParticleControl( particle, 4, locationParticle ) ParticleManager:SetParticleControl( particle, 5, locationParticle ) ParticleManager:SetParticleControl( particle, 6, locationParticle ) ParticleManager:SetParticleControl( particle, 7, locationParticle ) ParticleManager:SetParticleControl( particle, 8, locationParticle ) ParticleManager:SetParticleControl( particle, 9, locationParticle ) ParticleManager:SetParticleControl( particle, 10, locationParticle ) ParticleManager:SetParticleControl( particle, 11, locationParticle ) ParticleManager:SetParticleControl( particle, 12, locationParticle ) ParticleManager:SetParticleControl( particle, 13, locationParticle ) ParticleManager:SetParticleControl( particle, 14, locationParticle ) ParticleManager:SetParticleControl( particle, 15, locationParticle ) ParticleManager:SetParticleControl( particle, 16, locationParticle ) ParticleManager:ReleaseParticleIndex( particle ) particle = nil -- DOTA_UNIT_TARGET_TEAM_FRIENDLY; DOTA_UNIT_TARGET_TEAM_ENEMY; DOTA_UNIT_TARGET_TEAM_BOTH local units = FindUnitsInRadius(team, location, nil, AoERadius, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_FLAG_NONE, FIND_ANY_ORDER, false) for _,victim in pairs(units) do -- Modifier -- local modifier = victim:AddNewModifier(caster, self, "elite_royal_guardian_icy_cleave_modifier", {duration = duration}) PersistentModifier_Add(modifier) -- Apply Damage -- EncounterApplyDamage(victim, caster, self, damage, DAMAGE_TYPE_PHYSICAL, DOTA_DAMAGE_FLAG_NONE) end end) PersistentTimer_Add(timer) end function elite_royal_guardian_icy_cleave:OnAbilityPhaseStart() local caster = self:GetCaster() local playerID = caster:GetPlayerOwnerID() local player = PlayerResource:GetPlayer(playerID) return true end function elite_royal_guardian_icy_cleave:GetManaCost(abilitylevel) return self.BaseClass.GetManaCost(self, abilitylevel) end function elite_royal_guardian_icy_cleave:GetCooldown(abilitylevel) local caster = self:GetCaster() local cooldown_max_hp = self:GetSpecialValueFor("cooldown_max_hp") local cooldown_min_hp = self:GetSpecialValueFor("cooldown_min_hp") local cooldown_range = cooldown_max_hp - cooldown_min_hp local cooldown = cooldown_min_hp + ( cooldown_range * ( caster:GetHealthPercent() / 100 ) ) return cooldown--self.BaseClass.GetCooldown(self, abilitylevel) end
-- -- THIS FILE HAS BEEN GENERATED AUTOMATICALLY -- DO NOT CHANGE IT MANUALLY UNLESS YOU KNOW WHAT YOU'RE DOING -- -- GENERATED USING @colyseus/schema 1.0.0-alpha.58 -- local schema = require 'colyseus.serialization.schema.schema' local IAmAChild = require 'test.schema.ArraySchemaTypes.IAmAChild' local ArraySchemaTypes = schema.define({ ["arrayOfSchemas"] = { array = IAmAChild }, ["arrayOfNumbers"] = { array = "number" }, ["arrayOfStrings"] = { array = "string" }, ["arrayOfInt32"] = { array = "int32" }, ["_fields_by_index"] = { "arrayOfSchemas", "arrayOfNumbers", "arrayOfStrings", "arrayOfInt32" }, }) return ArraySchemaTypes
local F, C = unpack(select(2, ...)) tinsert(C.themes["FreeUI"], function() if C.isClassic then return end ScenarioFinderFrameInset:DisableDrawLayer("BORDER") ScenarioQueueFrame.Bg:Hide() ScenarioFinderFrameInset:GetRegions():Hide() ScenarioQueueFrameRandomScrollFrame:SetWidth(304) F.Reskin(ScenarioQueueFrameFindGroupButton) F.Reskin(ScenarioQueueFrameRandomScrollFrameChildFrame.bonusRepFrame.ChooseButton) F.ReskinDropDown(ScenarioQueueFrameTypeDropDown) F.ReskinScroll(ScenarioQueueFrameRandomScrollFrameScrollBar) F.ReskinScroll(ScenarioQueueFrameSpecificScrollFrameScrollBar) end)
local prefix = "LLM.Sv.Detection.Lags.Anti_Multiple_Collisions."; hook.Add( "EntityTakeDamage", prefix .. "Critical_Collisions", function( ent, dmginfo ) if ( GetConVar( "llm_critical_collision_detector" ):GetInt() <= 0 ) then return; end; if ( not IsValid(ent) ) then return; end; if ( ent:IsPlayer() ) then return; end; if ( ent:IsNPC() ) then return; end; if ( ent:IsVehicle() ) then return; end; if ( ent:GetClass() == 'prop_physics' and dmginfo:GetDamageType() == DMG_CRUSH ) then local constrs = constraint.GetAllConstrainedEntities( ent ); if ( table.HasValue( constrs, dmginfo:GetAttacker() ) and not llm.sv.FrameRateLags and not llm.sv.PingLags ) then return; end; ent.LLM_SearchCritColl_Infringement = ent.LLM_SearchCritColl_Infringement or 0; ent.LLM_SearchCritColl_CoolDown = ent.LLM_SearchCritColl_CoolDown or 0; if ( ent.LLM_SearchCritColl_CoolDown + 1 < CurTime() ) then ent.LLM_SearchCritColl_Infringement = 0; end if ( ent.LLM_SearchCritColl_Infringement == 5 ) then local phy = ent:GetPhysicsObject(); MsgN( "[LLM]: An endless collision of props has been prevented." ); if ( IsValid( phy ) ) then if ( DPP ~= nil ) then DPP.SetGhosted( ent, true ); local owner = DPP.GetOwner( ent ); if ( IsValid( owner ) and owner:IsPlayer() ) then DPP.Notify( owner, "Your props are blocked due to countless clashes." ); end; elseif ( FPP ~= nil ) then FPP.AntiSpam.GhostFreeze( ent, phy ); if ( IsValid( ent.FPPOwner ) ) then FPP.Notify( ent.FPPOwner, "Your props are blocked due to countless clashes.", true ); end; else phy:EnableMotion( false ); end; end; ent.LLM_SearchCritColl_Infringement = 0; else ent.LLM_SearchCritColl_Infringement = ent.LLM_SearchCritColl_Infringement + 1; ent.LLM_SearchCritColl_CoolDown = CurTime(); end; end; end );
local require = require local grammar = require "cosmo.grammar" local interpreter = require "cosmo.fill" local loadstring = loadstring module(..., package.seeall) yield = coroutine.yield local preamble = [[ local is_callable, insert, concat, setmetatable, getmetatable, type, wrap, tostring, check_selector = ... local function prepare_env(env, parent) local __index = function (t, k) local v = env[k] if not v then v = parent[k] end return v end local __newindex = function (t, k, v) env[k] = v end return setmetatable({ self = env }, { __index = __index, __newindex = __newindex }) end local id = function () end local template_func = %s return function (env, opts) opts = opts or {} local out = opts.out or {} template_func(out, env) return concat(out, opts.delim) end ]] local compiled_template = [[ function (out, env) if type(env) == "string" then env = { it = env } end $parts[=[ insert(out, $quoted_text) ]=], [=[ local selector_name = "$selector" local selector = $parsed_selector $if_subtemplate[==[ local subtemplates = {} $subtemplates[===[ subtemplates[$i] = $subtemplate ]===] $if_args[===[ check_selector(selector_name, selector) for e, literal in wrap(selector), $args, true do if literal then insert(out, tostring(e)) else if type(e) ~= "table" then e = prepare_env({ it = tostring(e) }, env) else e = prepare_env(e, env) end (subtemplates[e.self._template or 1] or id)(out, e) end end ]===], [===[ if type(selector) == 'table' then for _, e in ipairs(selector) do if type(e) ~= "table" then e = prepare_env({ it = tostring(e) }, env) else e = prepare_env(e, env) end (subtemplates[e.self._template or 1] or id)(out, e) end else check_selector(selector_name, selector) for e, literal in wrap(selector), nil, true do if literal then insert(out, tostring(e)) else if type(e) ~= "table" then e = prepare_env({ it = tostring(e) }, env) else e = prepare_env(e, env) end (subtemplates[e.self._template or 1] or id)(out, e) end end end ]===] ]==], [==[ $if_args[===[ check_selector(selector_name, selector) selector = selector($args, false) insert(out, tostring(selector)) ]===], [===[ if is_callable(selector) then insert(out, tostring(selector())) else insert(out, tostring(selector or "")) end ]===] ]==] ]=] end ]] local function is_callable(f) if type(f) == "function" then return true end local meta = getmetatable(f) if meta and meta.__call then return true end return false end local function check_selector(name, selector) if not is_callable(selector) then error("selector " .. name .. " is not callable but is " .. type(selector)) end end local function compile_template(chunkname, template_code) local template_func, err = loadstring(string.format(preamble, template_code), chunkname) if not template_func then error("syntax error when compiling template: " .. err) else return template_func(is_callable, table.insert, table.concat, setmetatable, getmetatable, type, coroutine.wrap, tostring, check_selector) end end local compiler = {} function compiler.template(template) assert(template.tag == "template") local parts = {} for _, part in ipairs(template.parts) do parts[#parts+1] = compiler[part.tag](part) end return interpreter.fill(compiled_template, { parts = parts }) end function compiler.text(text) assert(text.tag == "text") return { _template = 1, quoted_text = string.format("%q", text.text) } end function compiler.appl(appl) assert(appl.tag == "appl") local selector, args, subtemplates = appl.selector, appl.args, appl.subtemplates local ta = { _template = 2, selector = selector, parsed_selector = selector } local do_subtemplates = function () for i, subtemplate in ipairs(subtemplates) do yield{ i = i, subtemplate = compiler.template(subtemplate) } end end if #subtemplates == 0 then if args and args ~= "" and args ~= "{}" then ta.if_subtemplate = { { _template = 2, if_args = { { _template = 1, args = args } } } } else ta.if_subtemplate = { { _template = 2, if_args = { { _template = 2 } } } } end else if args and args ~= "" and args ~= "{}" then ta.if_subtemplate = { { _template = 1, subtemplates = do_subtemplates, if_args = { { _template = 1, args = args } } } } else ta.if_subtemplate = { { _template = 1, subtemplates = do_subtemplates, if_args = { { _template = 2 } } } } end end return ta end local cache = {} setmetatable(cache, { __index = function (tab, key) local new = {} tab[key] = new return new end, __mode = "v" }) function compile(template, chunkname) template = template or "" chunkname = chunkname or template local compiled_template = cache[template][chunkname] if not compiled_template then compiled_template = compile_template(chunkname, compiler.template(grammar.ast:match(template))) cache[template][chunkname] = compiled_template end return compiled_template end local filled_templates = {} function fill(template, env) template = template or "" local start = template:match("^(%[=*%[)") if start then template = template:sub(#start + 1, #template - #start) end if filled_templates[template] then return compile(template)(env) else filled_templates[template] = true return interpreter.fill(template, env) end end local nop = function () end function cond(bool, table) if bool then return function () yield(table) end else return nop end end f = compile function c(bool) if bool then return function (table) return function () yield(table) end end else return function (table) return nop end end end function map(arg, has_block) if has_block then for _, item in ipairs(arg) do cosmo.yield(item) end else return table.concat(arg) end end function inject(arg) cosmo.yield(arg) end function cif(arg, has_block) if not has_block then error("this selector needs a block") end if arg[1] then arg._template = 1 else arg._template = 2 end cosmo.yield(arg) end function concat(arg) local list, sep = arg[1], arg[2] or ", " local size = #list for i, e in ipairs(list) do if type(e) == "table" then if i ~= size then cosmo.yield(e) cosmo.yield(sep, true) else cosmo.yield(e) end else if i ~= size then cosmo.yield{ it = e } cosmo.yield(sep, true) else cosmo.yield{ it = e } end end end end function make_concat(list) return function (arg) local sep = (arg and arg[1]) or ", " local size = #list for i, e in ipairs(list) do if type(e) == "table" then if i ~= size then cosmo.yield(e) cosmo.yield(sep, true) else cosmo.yield(e) end else if i ~= size then cosmo.yield{ it = e } cosmo.yield(sep, true) else cosmo.yield{ it = e } end end end end end function cfor(args) local name, list, args = args[1], args[2], args[3] if type(list) == "table" then for i, item in ipairs(list) do cosmo.yield({ [name] = item, i = i }) end else for item, literal in coroutine.wrap(list), args, true do if literal then cosmo.yield(item, true) else cosmo.yield({ [name] = item }) end end end end
local ctx = require"luaossl.des" return ctx
test_run = require('test_run').new() REPLICASET_1 = { 'box_1_a', 'box_1_b' } REPLICASET_2 = { 'box_2_a', 'box_2_b' } REPLICASET_3 = { 'box_3_a', 'box_3_b' } test_run:create_cluster(REPLICASET_1, 'rebalancer') test_run:create_cluster(REPLICASET_2, 'rebalancer') util = require('util') util.wait_master(test_run, REPLICASET_1, 'box_1_a') util.wait_master(test_run, REPLICASET_2, 'box_2_a') util.map_evals(test_run, {REPLICASET_1, REPLICASET_2}, 'bootstrap_storage(\'memtx\')') -- -- A replicaset can be locked. Locked replicaset can neither -- receive new buckets nor send own ones during rebalancing. -- test_run:switch('box_2_a') vshard.storage.bucket_force_create(101, 100) test_run:switch('box_1_a') vshard.storage.bucket_force_create(1, 100) wait_rebalancer_state('The cluster is balanced ok', test_run) -- -- Check that a weight = 0 will not do anything with a locked -- replicaset. Moreover, this cluster is considered to be balanced -- ok. -- test_run:switch('box_2_a') rs1_cfg = cfg.sharding[util.replicasets[1]] rs1_cfg.lock = true rs1_cfg.weight = 0 vshard.storage.cfg(cfg, util.name_to_uuid.box_2_a) test_run:switch('box_1_a') rs1_cfg = cfg.sharding[util.replicasets[1]] rs1_cfg.lock = true rs1_cfg.weight = 0 vshard.storage.cfg(cfg, util.name_to_uuid.box_1_a) wait_rebalancer_state('The cluster is balanced ok', test_run) vshard.storage.is_locked() info = vshard.storage.info().bucket info.active info.lock -- -- Check that a locked replicaset not only blocks bucket sending, -- but blocks receiving as well. -- test_run:switch('box_2_a') rs1_cfg.weight = 2 vshard.storage.cfg(cfg, util.name_to_uuid.box_2_a) test_run:switch('box_1_a') rs1_cfg.weight = 2 vshard.storage.cfg(cfg, util.name_to_uuid.box_1_a) wait_rebalancer_state('The cluster is balanced ok', test_run) info = vshard.storage.info().bucket info.active info.lock -- -- gh-189: locked replicaset does not allow to send buckets even -- explicitly. -- vshard.storage.bucket_send(1, util.replicasets[2]) -- -- Vshard ensures that if a replicaset is locked, then it will not -- allow to change its bucket set even if a rebalancer does not -- know about a lock yet. For example, a locked replicaset could -- be reconfigured a bit earlier. -- test_run:switch('box_2_a') rs1_cfg.lock = false rs2_cfg = cfg.sharding[util.replicasets[2]] rs2_cfg.lock = true vshard.storage.cfg(cfg, util.name_to_uuid.box_2_a) test_run:switch('box_1_a') rs1_cfg.lock = false vshard.storage.cfg(cfg, util.name_to_uuid.box_1_a) wait_rebalancer_state('Replicaset is locked', test_run) rs2_cfg = cfg.sharding[util.replicasets[2]] rs2_cfg.lock = true vshard.storage.cfg(cfg, util.name_to_uuid.box_1_a) wait_rebalancer_state('The cluster is balanced ok', test_run) -- -- Check that when a new replicaset is added, buckets are spreaded -- on non-locked replicasets as if locked replicasets and buckets -- do not exist. -- test_run:switch('default') test_run:create_cluster(REPLICASET_3, 'rebalancer') util.wait_master(test_run, REPLICASET_3, 'box_3_a') util.map_evals(test_run, {REPLICASET_3}, 'bootstrap_storage(\'memtx\')') test_run:switch('box_2_a') rs1_cfg.lock = true rs1_cfg.weight = 1 -- Return default configuration. rs2_cfg.lock = false rs2_cfg.weight = 0.5 add_replicaset() vshard.storage.cfg(cfg, util.name_to_uuid.box_2_a) test_run:switch('box_3_a') rs1_cfg = cfg.sharding[util.replicasets[1]] rs1_cfg.lock = true rs1_cfg.weight = 1 rs2_cfg = cfg.sharding[util.replicasets[2]] rs2_cfg.weight = 0.5 vshard.storage.cfg(cfg, util.name_to_uuid.box_3_a) test_run:switch('box_1_a') rs1_cfg.lock = true rs1_cfg.weight = 1 rs2_cfg.lock = false rs2_cfg.weight = 0.5 add_replicaset() vshard.storage.cfg(cfg, util.name_to_uuid.box_1_a) wait_rebalancer_state('The cluster is balanced ok', test_run) info = vshard.storage.info().bucket info.active info.lock test_run:switch('box_2_a') vshard.storage.info().bucket.active test_run:switch('box_3_a') vshard.storage.info().bucket.active -- -- Test bucket pinning. At first, return to the default -- configuration. -- test_run:switch('box_2_a') rs1_cfg.lock = false rs1_cfg.weight = 1 rs2_cfg.lock = false rs2_cfg.weight = 1 vshard.storage.cfg(cfg, util.name_to_uuid.box_2_a) test_run:switch('box_3_a') rs1_cfg.lock = false rs1_cfg.weight = 1 rs2_cfg.lock = false rs2_cfg.weight = 1 vshard.storage.cfg(cfg, util.name_to_uuid.box_3_a) test_run:switch('box_1_a') rs1_cfg.lock = false rs1_cfg.weight = 1 rs2_cfg.lock = false rs2_cfg.weight = 1 vshard.storage.cfg(cfg, util.name_to_uuid.box_1_a) wait_rebalancer_state('The cluster is balanced ok', test_run) vshard.storage.info().bucket.active status = box.space._bucket.index.status first_id = status:select(vshard.consts.BUCKET.ACTIVE, {limit = 1})[1].id -- Test that double pin is ok. vshard.storage.bucket_pin(first_id) box.space._bucket:get{first_id}.status vshard.storage.bucket_pin(first_id) box.space._bucket:get{first_id}.status -- Test that double unpin after pin is ok. vshard.storage.bucket_unpin(first_id) box.space._bucket:get{first_id}.status vshard.storage.bucket_unpin(first_id) box.space._bucket:get{first_id}.status -- Test that can not pin other buckets. test_run:cmd("setopt delimiter ';'") box.begin() box.space._bucket:update({first_id}, {{'=', 2, vshard.consts.BUCKET.SENDING}}) ok, err = vshard.storage.bucket_pin(first_id) assert(not ok and err) ok, err = vshard.storage.bucket_unpin(first_id) assert(not ok and err) box.space._bucket:update({first_id}, {{'=', 2, vshard.consts.BUCKET.RECEIVING}}) ok, err = vshard.storage.bucket_pin(first_id) assert(not ok and err) ok, err = vshard.storage.bucket_unpin(first_id) assert(not ok and err) box.space._bucket:update({first_id}, {{'=', 2, vshard.consts.BUCKET.SENT}}) ok, err = vshard.storage.bucket_pin(first_id) assert(not ok and err) ok, err = vshard.storage.bucket_unpin(first_id) assert(not ok and err) box.space._bucket:update({first_id}, {{'=', 2, vshard.consts.BUCKET.GARBAGE}}) ok, err = vshard.storage.bucket_pin(first_id) assert(not ok and err) ok, err = vshard.storage.bucket_unpin(first_id) assert(not ok and err) box.rollback() test_run:cmd("setopt delimiter ''"); -- -- gh-189: a pinned bucket can't be sent. Unpin is required -- beforehand. -- vshard.storage.bucket_pin(first_id) vshard.storage.bucket_send(first_id, util.replicasets[2]) vshard.storage.bucket_unpin(first_id) -- -- Now pin some buckets and create such disbalance, that the -- rebalancer will face with unreachability of the perfect -- balance. -- for i = 1, 60 do local ok, err = vshard.storage.bucket_pin(first_id - 1 + i) assert(ok) end status:count({vshard.consts.BUCKET.PINNED}) rs1_cfg.weight = 0.5 vshard.storage.cfg(cfg, util.name_to_uuid.box_1_a) wait_rebalancer_state('The cluster is balanced ok', test_run) -- The perfect balance is now 40-80-80, but on the replicaset 1 -- 60 buckets are pinned, so the actual balance is 60-70-70. info = vshard.storage.info().bucket info.active info.pinned test_run:switch('box_2_a') vshard.storage.info().bucket.active test_run:switch('box_3_a') vshard.storage.info().bucket.active test_run:cmd("switch default") test_run:drop_cluster(REPLICASET_3) test_run:drop_cluster(REPLICASET_2) test_run:drop_cluster(REPLICASET_1)
------------- -- Imports -- ------------- local tostring = tostring local createFrame = function(index) local stringIndex = tostring(index) frame = CreateFrame("Button", "AssiduityArena" .. stringIndex, UIParent, "SecureUnitButtonTemplate") frame:SetAttribute("unit", "arena" .. stringIndex) frame:SetAttribute("type1", "target") frame.changeEvent = "ARENA_OPPONENT_UPDATE" frame.sizing = "SMALL" --frame:SetAttribute("unit", "target") --frame.changeEvent = "PLAYER_TARGET_CHANGED" AssiduityRegisterFrame(frame) return frame end local arena1 = createFrame(1) local arena2 = createFrame(2) local arena3 = createFrame(3) local arena4 = createFrame(4) local arena5 = createFrame(5) arena1:SetPoint("BOTTOMLEFT", UIParent, "CENTER", 250, 0) arena2:SetPoint("BOTTOM", arena1, "TOP", 0, 60) arena3:SetPoint("BOTTOM", arena2, "TOP", 0, 60) arena4:SetPoint("BOTTOM", arena3, "TOP", 0, 60) arena5:SetPoint("BOTTOM", arena4, "TOP", 0, 60)
local system = require "coutil.system" print(string.format([[ System Kernel : %s Version : %s Release : %s Platform : %s Network name : %s Temporary dir. : %s Physical memory: %12d bytes Free memory : %12d bytes Uptime : %12.4f seconds Load : %12.4f (last 1 minute) %12.4f (last 5 minutes) %12.4f (last 10 minutes) User Login: %s (UID=%d, GID=%d) Home: %s Shell: %s Process Executable path : %s Process identifier : %20d Parent process identifier : %20d Available virtual memory : %20d bytes Resident memory : %20d bytes Maximum resident memory : %20d bytes Integral shared memory : %20d bytes Integral unshared data : %20d bytes Integral unshared stack : %20d bytes User CPU time : %20.4f seconds System CPU time : %20.4f seconds Page reclaims : %20d Page faults : %20d Swaps : %20d Block input operations : %20d Block output operations : %20d IPC messages sent : %20d IPC messages received : %20d Signals received : %20d Voluntary context switches : %20d Involuntary context switches: %20d ]], system.procinfo("kVvhnTbft1lLUugH$e#^MrRmd=cspPwio><SxX"))) print("CPU") print(" # | Speed | User | Nice | System | Idle | IRQ | Name") local rowfmt = " %2d | %8d MHz | "..string.rep("%8d ms | ", 5).."%s" for i, clk, usr, nice, sys, idle, irq, model in system.cpuinfo("cunsidm") do print(string.format(rowfmt, i, clk, usr, nice, sys, idle, irq, model)) end print() print("Network interface addresses") print(" # | Name | MAC | Internal | Domain | Address") local rowfmt = " %2d | %-12s | %17s | %-3s | %-4s | %s/%d" for i, name, mac, isint, dom, addr, masklen in system.netinfo("all", "nTidtl") do print(string.format(rowfmt, i, name, mac, isint and "yes" or "", dom, addr, masklen)) end print()
--- This is a debugger command; it runs the thing into the inspect function -- @classmod InspectCommand -- region imports local class = require('classes/class') local prototype = require('prototypes/prototype') local inspect = require('functional/inspect').inspect local arg_parser = require('functional/arg_parser') require('prototypes/command') local TalkEvent = require('classes/events/talk') -- endregion local InspectCommand = {} local function print_help(text) print('\27[K\r' .. text) print('/inspect') print(' <code literal> [--serialize]') print(' passes the code as a string literal to the inspect function') print(' if --serialize is added then it also serializes serializables') return true, {} end local function safish_inspect(game_ctx, local_ctx, text, code, serialize) print('\27[K\r' .. text) xpcall(function() loadstring('return function(game_ctx, local_ctx) require(\'functional/inspect\').inspect(' .. code .. ', ' .. tostring(serialize) .. ') end')()(game_ctx, local_ctx) end, function(err) print(err) print(debug.traceback()) end) return true, {} end function InspectCommand.priority() return 'explicit' end function InspectCommand:parse(game_ctx, local_ctx, text) if text:sub(1, 8) == '/inspect' then local args, err = arg_parser.parse_allow_quotes(text) if not args then print('\27[K\r' .. text) print(' Error parsing arguments: ' .. err) return true, {} end if #args < 2 or #args > 3 then return print_help(text) end local serialize = false if #args == 3 then if args[3] == '--serialize' then serialize = true else print_help(text) end end return safish_inspect(game_ctx, local_ctx, text, args[2], serialize) end return false, nil end prototype.support(InspectCommand, 'command') return class.create('InspectCommand', InspectCommand)
print("hello") os.exit(0)
local bin2c = require "shmuz.bin2c" local linit = [[ /* This is a generated file. */ /* ** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ ** Initialization of libraries for lua.c ** See Copyright Notice in lua.h */ #define linit_c #define LUA_LIB #include "lua.h" #include "lualib.h" #include "lauxlib.h" <$declarations> static const luaL_Reg lualibs[] = { <$binmodules> <$modules> <$scripts> {NULL, NULL} }; /* 1. Makefile: add -DFUNC_OPENLIBS=luafar_openlibs to compilation flags 2. Plugin (GetGlobalInfoW): call LF_InitLuaState1(L,FUNC_OPENLIBS) 3. LuaFAR (LF_InitLuaState1): call FUNC_OPENLIBS unless it is NULL */ LUALIB_API int <$luaopen> (lua_State *L) { const luaL_Reg *lib = lualibs; for (; lib->func; lib++) { lua_pushcfunction(L, lib->func); lua_pushstring(L, lib->name); lua_call(L, 1, 0); } return 0; } /* This loader is shared by all added scripts and modules. Particular script is selected by upvalues. */ static int loader (lua_State *L) { void *arr = lua_touserdata(L, lua_upvalueindex(1)); size_t arrsize = lua_tointeger(L, lua_upvalueindex(2)); const char *name = lua_tostring(L,1); if (0 == luaL_loadbuffer(L, arr, arrsize, name)) { if (*name != '<') { /* it's a module */ lua_pushvalue(L,1); lua_call(L,1,1); } return 1; } return 0; } /* Place a loader for given script or module into package.preload */ static int preload (lua_State *L, char *arr, size_t arrsize) { lua_getglobal(L, "package"); lua_getfield(L, -1, "preload"); lua_pushlightuserdata(L, arr); lua_pushinteger(L, arrsize); lua_pushcclosure(L, loader, 2); lua_setfield(L, -2, lua_tostring(L,1)); lua_pop(L,2); return 0; } ]] local function remove_ext(s) return (s:gsub("%.[^\\/.]+$", "")) end local function readfile (filename, mode) local fp = assert(io.open(filename, mode)) local s = fp:read("*all") fp:close() return s end local function addfiles(target, files, method, compiler) local diet, diet_arg if method == "strip" or method == "luasrcdiet" then diet = require "luasrcdiet" diet_arg = { "-o", "luac.out", "--noopt-emptylines", "--quiet" } table.insert(diet_arg, method=="strip" and "--noopt-locals" or "--opt-locals") table.insert(diet_arg, jit and "--noopt-binequiv" or "--opt-binequiv") end for _, f in ipairs(files) do local s if method == "strip" or method == "luasrcdiet" then diet(f.fullname, unpack(diet_arg)) s = readfile("luac.out", "rb") elseif method == "luac" then assert(0==os.execute((compiler or "luac").." -o luac.out -s "..f.fullname)) s = readfile("luac.out", "rb") elseif method == "luajit" then assert(0==os.execute((compiler or "luajit").." -b -t raw -s "..f.fullname.." luajitc.out")) s = readfile("luajitc.out", "rb") else -- "plain" s = readfile(f.fullname) end target:write("static ", bin2c(s, f.arrayname), "\n") end end local function create_linit (aLuaopen, aScripts, aModules, aBinlibs) local tinsert = table.insert local result = linit:gsub("<%$([^>]+)>", function(tag) local ret = {} -------------------------------------------------------------------------- if tag == "luaopen" then return aLuaopen elseif tag == "declarations" then tinsert(ret, "/*---- forward declarations ----*/") for _,libname in ipairs(aBinlibs) do tinsert(ret, "int luaopen_" .. libname .. " (lua_State*);") end for _,v in ipairs(aScripts) do tinsert(ret, "static int preload_" .. v.arrayname .. " (lua_State*);") end for _,v in ipairs(aModules) do tinsert(ret, "static int preload_" .. v.arrayname .. " (lua_State*);") end -------------------------------------------------------------------------- elseif tag == "binmodules" and #aBinlibs > 0 then tinsert(ret, " /*------ bin.modules ------*/") for _,libname in ipairs(aBinlibs) do tinsert(ret, (' {"%s", luaopen_%s},'):format(libname, libname)) end -------------------------------------------------------------------------- elseif tag == "modules" then tinsert(ret, " /*-------- modules --------*/") for _,v in ipairs(aModules) do tinsert(ret, " {\"" .. v.requirename .. "\", preload_" .. v.arrayname .. "},") end -------------------------------------------------------------------------- elseif tag == "scripts" then tinsert(ret, " /*-------- scripts --------*/") for _,v in ipairs(aScripts) do tinsert(ret, " {\"<" .. v.requirename .. "\", preload_" .. v.arrayname .. "},") end end -------------------------------------------------------------------------- tinsert(ret, "") return table.concat(ret, "\n") end) return result end local function add_preloads (target, files) local template = [[ static int preload_%s (lua_State *L) { return preload(L, %s, sizeof(%s)); } ]] for _,v in ipairs(files) do local name = v.arrayname target:write(template:format(name, name, name)) end end --- Preprocess a file specification. -- @target: Output array (table). -- @src: File name containing path (string). -- The function splits it into path and name. -- If it should be split at a point other than the last (back)slash, use an asterisk -- to specify where. -- @boot: Whether `src` is the boot script (boolean). local function preprocess(target, src, boot) local path, name = src:match("(.+)%*(.+)") if path == nil then path, name = src:match("(.+)[/\\](.+)") end if path == nil then error("Bad argument: "..src) end table.insert(target, { fullname = path.."\\"..name, arrayname = boot and "boot" or remove_ext(name):gsub("[\\/.]", "_"), requirename = boot and "boot" or remove_ext(name):gsub("[\\/]", ".") }) end -- This function should go to some library. local function CollectValues (...) local T = {} local arg = {...} local state for i,v in ipairs(arg) do local prefix = v:sub(1,1) if prefix == "-" then state = v:sub(2) T[state] = T[state] or {} elseif prefix == "@" then local key,equal,val = v:match("^@([^=]+)(=?)(.*)") if not key then error ("invalid argument #"..i) end T[key] = equal=="=" and val or true state = nil elseif state then table.insert(T[state], v) else error("misplaced argument #"..i) end end return T end -------------------------------------------------------------------------------- --- Embed Lua scripts into a C-file. -- MANDATORY: -- @target: Name of the output file -- @method: Either of "plain" (default), "strip", "luasrcdiet", "luac", "luajit" -- @compiler: Compiler file name (used with "luac" and "luajit" methods) -- @bootscript: Boot script name -- @luaopen: Name of the library function -- OPTIONAL: -- @scripts: Array of scripts names -- @modules: Array of modules names -- @binlibs: Array of binary libraries names -------------------------------------------------------------------------------- local function embed (...) local T = CollectValues(...) assert(type(T.target) =="string", "incorrect or missing parameter 'target'") assert(type(T.method) =="string", "incorrect or missing parameter 'method'") assert(type(T.compiler) =="string", "incorrect or missing parameter 'compiler'") assert(type(T.bootscript) =="string", "incorrect or missing parameter 'bootscript'") assert(type(T.luaopen) =="string", "incorrect or missing parameter 'luaopen'") assert(T.scripts==nil or type(T.scripts)=="table") assert(T.modules==nil or type(T.modules)=="table") assert(T.binlibs==nil or type(T.binlibs)=="table") local scripts, modules = {}, {} preprocess(scripts, T.bootscript, true) if T.scripts then for _, src in ipairs(T.scripts) do preprocess(scripts, src, false) end end if T.modules then for _, src in ipairs(T.modules) do preprocess(modules, src, false) end end local fp = assert(io.open(T.target, "w")) fp:write(create_linit(T.luaopen, scripts, modules, T.binlibs or {})) addfiles(fp, scripts, T.method, T.compiler) addfiles(fp, modules, T.method, T.compiler) add_preloads(fp, scripts) add_preloads(fp, modules) fp:close() end local function openlibs (...) local T = CollectValues(...) assert(type(T.target) =="string", "incorrect or missing parameter 'target'") assert(type(T.luaopen) =="string", "incorrect or missing parameter 'luaopen'") assert(T.funclist==nil or type(T.funclist)=="table") T.funclist = T.funclist or {} local fp = assert(io.open(T.target, "w")) fp:write("#include <lua.h>\n\n") for _,v in ipairs(T.funclist) do fp:write("int "..v.."(lua_State *L);\n") end fp:write("\n") fp:write("int ", T.luaopen, "(lua_State *L) {\n") for _,v in ipairs(T.funclist) do fp:write(" lua_pushcfunction(L, ", v, ");\n") fp:write(" lua_call(L, 0, 0);\n") end fp:write(" return 0;\n") fp:write("}\n") fp:close() end if select(1,...)=="embed" then embed(select(2,...)) elseif select(1,...)=="openlibs" then openlibs(select(2,...)) else error("command line: invalid operation") end
ModUtil.RegisterMod("ModConfigMenu") ModConfigMenu.Menus = {} ModConfigMenu.CurrentMenuIdx = 1 function ModConfigMenu.Register(config) table.insert(ModConfigMenu.Menus, config) end ModUtil.LoadOnce(function() -- this table is intentionally not excluded from saves, so -- that mod config settings can be persisted in the save file if not ModConfigMenuSavedSettings then ModConfigMenuSavedSettings = { Version = "1.0", Menus = {} } end if ModConfigMenuSavedSettings.Version == "1.0" then for i, config in pairs(ModConfigMenu.Menus) do local savedMenu = ModConfigMenuSavedSettings[config.ModName] if savedMenu then for k,v in pairs(savedMenu) do if config[k] ~= nil then config[k] = v end end end ModConfigMenuSavedSettings[config.ModName] = config end end end) local function PrettifyName( name ) local first = true local prettyName = name:gsub("%u", function(c) if first then first = false return c else return ' ' .. c end end) return prettyName end local function UpdateCheckBox( button, value ) local radioButtonValue = "RadioButton_Unselected" if value then radioButtonValue = "RadioButton_Selected" end SetThingProperty({ DestinationId = button.Id, Property = "Graphic", Value = radioButtonValue }) end local function ShowCurrentMenu( screen ) local rowStartX = 350 local columnSpacingX = 600 local itemLocationX = rowStartX local itemLocationY = 250 local itemSpacingX = 250 local itemSpacingY = 50 local itemsPerRow = 3 local parentComponents = screen.Components -- clear previous menu local ids = {} for name, component in pairs(screen.MenuComponents) do parentComponents[name] = nil table.insert(ids, component.Id) end CloseScreen( ids ) screen.MenuComponents = {} local components = screen.MenuComponents local currentMenu = ModConfigMenu.Menus[ModConfigMenu.CurrentMenuIdx] if not currentMenu then return end ModifyTextBox({ Id = parentComponents["SelectedMenu"].Id, Text = currentMenu.ModName or "Unknown Mod" }) local itemsInRow = 0 for name, value in orderedPairs( currentMenu ) do local previousItemLocationX = itemLocationX if value == true or value == false or type(value) == "number" then itemsInRow = itemsInRow + 1 if itemsInRow > itemsPerRow then itemLocationX = rowStartX previousItemLocationX = itemLocationX itemLocationY = itemLocationY + itemSpacingY itemsInRow = itemsInRow - itemsPerRow end components[name .. "TextBox"] = CreateScreenComponent({ Name = "BlankObstacle", Scale = 1, X = itemLocationX, Y = itemLocationY, Group = "Combat_Menu" }) CreateTextBox({ Id = components[name .. "TextBox"].Id, Text = PrettifyName(name), Color = Color.BoonPatchCommon, FontSize = 16, OffsetX = 0, OffsetY = 0, Font = "AlegrayaSansSCRegular", ShadowBlur = 0, ShadowColor = { 0, 0, 0, 1 }, ShadowOffset = { 0, 2 }, Justification = "Center" }) itemLocationX = itemLocationX + itemSpacingX end if value == true or value == false then components[name .. "CheckBox"] = CreateScreenComponent({ Name = "RadioButton", Scale = 1, X = itemLocationX, Y = itemLocationY, Group = "CombatMenu" }) UpdateCheckBox(components[name .. "CheckBox"], value) components[name .. "CheckBox"].MenuItemName = name components[name .. "CheckBox"].OnPressedFunctionName = "ModConfigMenu__ToggleBoolean" itemLocationX = previousItemLocationX + columnSpacingX elseif type(value) == "number" then components[name .. "ButtonPlus"] = CreateScreenComponent({ Name = "LevelUpArrowRight", Scale = 1, X = itemLocationX - 40, Y = itemLocationY, Group = "CombatMenu" }) components[name .. "ButtonPlus"].MenuItemName = name components[name .. "ButtonPlus"].OnPressedFunctionName = "ModConfigMenu__ButtonPlus" components[name .. "ButtonMinus"] = CreateScreenComponent({ Name = "LevelUpArrowLeft", Scale = 1, X = itemLocationX, Y = itemLocationY, Group = "CombatMenu" }) components[name .. "ButtonMinus"].MenuItemName = name components[name .. "ButtonMinus"].OnPressedFunctionName = "ModConfigMenu__ButtonMinus" components[name .. "NumberText"] = CreateScreenComponent({ Name = "BlankObstacle", Scale = 1, X = itemLocationX + 40, Y = itemLocationY, Group = "Combat_Menu" }) CreateTextBox({ Id = components[name .. "NumberText"].Id, Text = tostring(value), FontSize = 16, OffsetX = 0, OffsetY = 0, Font = "AlegrayaSansSCRegular", Justification = "Center" }) itemLocationX = previousItemLocationX + columnSpacingX end end for k, v in pairs(components) do parentComponents[k] = v end end function ModConfigMenu__MenuLeft( screen, button ) ModConfigMenu.CurrentMenuIdx = ModConfigMenu.CurrentMenuIdx - 1 if ModConfigMenu.CurrentMenuIdx < 1 then ModConfigMenu.CurrentMenuIdx = #ModConfigMenu.Menus end ShowCurrentMenu( screen ) end function ModConfigMenu__MenuRight( screen, button ) ModConfigMenu.CurrentMenuIdx = ModConfigMenu.CurrentMenuIdx + 1 if ModConfigMenu.CurrentMenuIdx > #ModConfigMenu.Menus then ModConfigMenu.CurrentMenuIdx = 1 end ShowCurrentMenu( screen ) end function ModConfigMenu__ToggleBoolean(screen, button) local menu = ModConfigMenu.Menus[ModConfigMenu.CurrentMenuIdx] local name = button.MenuItemName menu[name] = not menu[name] UpdateCheckBox(button, menu[name]) end function ModConfigMenu__ButtonPlus(screen, button) local menu = ModConfigMenu.Menus[ModConfigMenu.CurrentMenuIdx] local name = button.MenuItemName print(name, menu[name]) menu[name] = menu[name] + 1 ModifyTextBox({ Id = screen.Components[name .. "NumberText"].Id, Text = tostring(menu[name]) }) end function ModConfigMenu__ButtonMinus(screen, button) local menu = ModConfigMenu.Menus[ModConfigMenu.CurrentMenuIdx] local name = button.MenuItemName menu[name] = menu[name] - 1 ModifyTextBox({ Id = screen.Components[name .. "NumberText"].Id, Text = tostring(menu[name]) }) end function ModConfigMenu__Open() CloseAdvancedTooltipScreen() local components = {} local screen = { Components = components, MenuComponents = {}, CloseAnimation = "QuestLogBackground_Out" } OnScreenOpened({ Flag = screen.Name, PersistCombatUI = true}) FreezePlayerUnit() EnableShopGamepadCursor() SetConfigOption({ Name = "FreeFormSelectWrapY", Value = false }) SetConfigOption({ Name = "FreeFormSelectStepDistance", Value = 8 }) components.ShopBackgroundDim = CreateScreenComponent({ Name = "rectangle01", Group = "Combat_Menu"}) components.ShopBackgroundSplatter = CreateScreenComponent({ Name = "LevelUpBackground", Group = "Combat_Menu"}) components.ShopBackground = CreateScreenComponent({ Name = "rectangle01", Group = "Combat_Menu"}) SetAnimation({ DestinationId = components.ShopBackground.Id, Name = "QuestLogBackgroun_In", OffsetY = 30 }) SetScale({ Id = components.ShopBackgroundDim.Id, Fraction = 4}) SetColor({ Id = components.ShopBackgroundDim.Id, Color = { 0.090, 0.055, 0.157, 0.8 } }) PlaySound({ Name = "/SFX/Menu Sounds/FatedListOpen" }) wait(0.2) -- Title CreateTextBox({ Id = components.ShopBackground.Id, Text = "Configure your Mods", FontSize = 34, OffsetX = 0, OffsetY = -460, Color = Color.White, Font = "SpectralSCLightTitling", ShadowBlur = 0, ShadowColor = { 0, 0, 0, 1 }, ShadowOffset = { 0, 2 }, Justification = "Center" }) -- Close Button components.CloseButton = CreateScreenComponent({ Name = "ButtonClose", Scale = 0.7, Group = "Combat_Menu"}) Attach({ Id = components.CloseButton.Id, DestinationId = components.ShopBackground.Id, OffsetX = -6, OffsetY = 456 }) components.CloseButton.OnPressedFunctionName = "ModConfigMenu__Close" components.CloseButton.ControlHotkey = "Cancel" components["MenuLeft"] = CreateScreenComponent({ Name = "ButtonCodexLeft", X = 650, Y = 175, Scale = 1.0, Group = "Combat_Menu" }) components["MenuLeft"].OnPressedFunctionName = "ModConfigMenu__MenuLeft" components["MenuRight"] = CreateScreenComponent({ Name = "ButtonCodexRight", X = 1300, Y = 175, Scale = 1.0, Group = "Combat_Menu" }) components["MenuRight"].OnPressedFunctionName = "ModConfigMenu__MenuRight" components["SelectedMenu"] = CreateScreenComponent({ Name = "BlankObstacle", X = 975, Y = 175, Scale = 0.5, Group = "Combat_Menu" }) components["MenuRight"].OnPressedFunctionName = "ModConfigMenu__MenuRight" CreateTextBox({ Id = components["SelectedMenu"].Id, Text = "No Mods To Configure", OffsetX = 0, OffsetY = 0, Color = Color.White, Font = "AlegreyaSansSCRegular", ShadowBlur = 0, ShadowColor = { 0, 0, 0, 1 }, ShadowOffset = { 0, 2 }, Justification = "Center" }) ShowCurrentMenu( screen ) screen.KeepOpen = true thread( HandleWASDInput, screen ) HandleScreenInput( screen ) end function ModConfigMenu__Close( screen, button ) DisableShopGamepadCursor() SetConfigOption({ Name = "FreeFormSelectWrapY", Value = false }) SetConfigOption({ Name = "FreeFormSelectStepDistance", Value = 16 }) SetConfigOption({ Name = "FreeFormSelectSuccessDistanceStep", Value = 8}) SetAnimation({ DestinationId = screen.Components.ShopBackground.Id, Name = screen.CloseAnimation }) PlaySound({ Name = "/SFX/Menu Sounds/FatedListClose" }) CloseScreen( GetAllIds( screen.Components ), 0.1) UnfreezePlayerUnit() screen.KeepOpen = false OnScreenClosed({ Flag = screen.Name }) end ModUtil.WrapBaseFunction("CreatePrimaryBacking", function ( baseFunc ) local components = ScreenAnchors.TraitTrayScreen.Components components.ModConfigButton = CreateScreenComponent({ Name = "ButtonDefault", Scale = 0.8, Group = "Combat_Menu_TraitTray", X = CombatUI.TraitUIStart + 135, Y = 185 }) components.ModConfigButton.OnPressedFunctionName = "ModConfigMenu__Open" CreateTextBox({ Id = components.ModConfigButton.Id, Text = "Configure Mods", OffsetX = 0, OffsetY = 0, FontSize = 22, Color = Color.White, Font = "AlegreyaSansSCRegular", ShadowBlur = 0, ShadowColor = {0,0,0,1}, ShadowOffset={0, 2}, Justification = "Center", DataProperties = { OpacityWithOwner = true, }, }) Attach({ Id = components.ModConfigButton.Id, DestinationId = components.ModConfigButton, OffsetX = 500, OffsetY = 500 }) baseFunc() end, ModConfigMenu)
local config = require('symbols-outline.config') local M = {} M.kinds = { "File", "Module", "Namespace", "Package", "Class", "Method", "Property", "Field", "Constructor", "Enum", "Interface", "Function", "Variable", "Constant", "String", "Number", "Boolean", "Array", "Object", "Key", "Null", "EnumMember", "Struct", "Event", "Operator", "TypeParameter" } function M.icon_from_kind(kind) local symbols = config.options.symbols -- If the kind is higher than the available ones then default to 'Object' if kind > #M.kinds then kind = 19 end return symbols[M.kinds[kind]].icon end return M
local function load_words(filename) local words = {} for w in io.lines(filename) do w = w:match("^%s*(%S+)") if w and #w > 0 then words[#words + 1] = w:lower() end end return words end local function reshape(mkv_chain) for ngram, transitions in pairs(mkv_chain) do local new_transitions = {} local transition_count = 0 for transition, frequency in pairs(transitions) do new_transitions[#new_transitions + 1] = { transition, frequency } transition_count = transition_count + frequency end table.sort(new_transitions, function(a, b) return a[2] > b[2] end) new_transitions.__count = transition_count mkv_chain[ngram] = new_transitions end end local function build_markv_chain(words, order) local mkv_chain = setmetatable({}, { __index = function(t, k) t[k] = {} return t[k] end }) local prefix = ('_'):rep(order) local function process_word(word) if order > 0 then word = prefix .. word end word = word .. '_' local n = word:len() for i = 1, n - order do local ngram = word:sub(i, i + order - 1) local transition = word:sub(i + order, i + order) local transitions = mkv_chain[ngram] transitions[transition] = (transitions[transition] or 0) + 1 end end for _, w in ipairs(words) do if #w >=order then process_word(w) end end setmetatable(mkv_chain, nil) reshape(mkv_chain) return mkv_chain end local function write_markov_chain(filename, mkv_chain) local lines = {} for ngram, transitions in pairs(mkv_chain) do local line = { ngram } for _, transition in ipairs(transitions) do line[#line + 1] = transition[1] line[#line + 1] = transition[2] end lines[#lines + 1] = line end table.sort(lines, function(a, b) return a[1] < b[1] end) local file = io.open(filename, 'w') for _, line in pairs(lines) do file:write(table.concat(line, ',')) file:write('\n') end io.close() end local input_filename = arg[1] local basename = input_filename:match('^(%S+)%.txt$') local words = load_words(input_filename) for order = 1, 4 do local output_filename = string.format("%s-%d.mkvc", basename, order) local chain = build_markv_chain(words, order) write_markov_chain(output_filename, chain) end
local A = require('utils.autogroup') A.augroups({ highlight_yank = { 'TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=300}' }, set_cursor_shape = { 'VimEnter,VimResume * set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50' .. ',a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor' .. ',sm:block-blinkwait175-blinkoff150-blinkon175' }, restore_cursor_shape = { 'VimLeave,VimSuspend * set guicursor=a:ver90-blinkwait300-blinkon200-blinkoff150' } })