repo_name
stringlengths
6
69
path
stringlengths
6
178
copies
stringclasses
278 values
size
stringlengths
4
7
content
stringlengths
671
917k
license
stringclasses
15 values
RyMarq/Zero-K
LuaRules/Configs/StartBoxes/Claymore_v2.lua
8
6410
local supported_teamcounts = {2, 5, 6, 10, 11, 15, 16} local L5 = { { {3479, 4688}, {3560, 4599}, {3712, 4559}, {3936, 4486}, {4159, 4434}, {4433, 4457}, {4606, 4586}, {4717, 4755}, {4792, 4941}, {4813, 5085}, {4751, 5208}, {4547, 5376}, {4386, 5554}, {4231, 5659}, {3974, 5669}, {3739, 5532}, {3599, 5347}, {3470, 5058}, {3418, 4834}, {3434, 4762}, }, { {6776, 3476}, {7100, 3490}, {7285, 3644}, {7444, 3906}, {7541, 4211}, {7484, 4430}, {7362, 4583}, {7123, 4712}, {6826, 4747}, {6548, 4637}, {6291, 4357}, {6186, 4051}, {6216, 3761}, {6389, 3582}, {6605, 3503}, }, { {9363, 5951}, {9334, 6050}, {9359, 6189}, {9443, 6325}, {9301, 6432}, {9183, 6588}, {8960, 6684}, {8704, 6720}, {8503, 6728}, {8279, 6578}, {8126, 6376}, {8121, 6144}, {8160, 5921}, {8309, 5832}, {8582, 5707}, {8821, 5673}, {9161, 5736}, {9271, 5846}, }, { {7177, 9124}, {7296, 9059}, {7480, 9039}, {7575, 8925}, {7615, 8673}, {7625, 8328}, {7568, 8041}, {7360, 7916}, {7114, 7861}, {6889, 7831}, {6669, 7950}, {6488, 8134}, {6449, 8353}, {6461, 8617}, {6614, 8850}, {6889, 9041}, }, { {3774, 8159}, {3900, 8159}, {4053, 8302}, {4081, 8454}, {4349, 8447}, {4718, 8339}, {4943, 8145}, {5051, 7956}, {5019, 7696}, {4814, 7436}, {4496, 7238}, {4241, 7219}, {3983, 7337}, {3754, 7579}, {3731, 7825}, {3757, 8030}, }, } local L10 = { { {1450, 4569}, {1639, 4838}, {1638, 5048}, {1615, 5380}, {1551, 5495}, {1377, 5528}, {1271, 5650}, {1002, 5584}, {654, 5504}, {466, 5311}, {348, 4971}, {450, 4735}, {784, 4460}, {1059, 4403}, {1264, 4481}, }, { {2870, 2129}, {2808, 2274}, {2825, 2431}, {2896, 2563}, {2799, 2725}, {2538, 2909}, {2445, 2836}, {2334, 2836}, {2253, 2960}, {1930, 2765}, {1719, 2545}, {1632, 2360}, {1677, 2184}, {1824, 1946}, {1966, 1731}, {2172, 1642}, {2432, 1657}, {2708, 1810}, {2783, 1998}, }, { {5107, 1496}, {5252, 1483}, {5366, 1535}, {5381, 1672}, {5682, 1648}, {5860, 1603}, {6024, 1522}, {6004, 1432}, {6047, 1242}, {6146, 1195}, {6103, 789}, {5968, 563}, {5748, 474}, {5460, 446}, {5188, 599}, {5017, 771}, {4991, 1047}, {5019, 1278}, }, { {8245, 1569}, {8324, 1618}, {8356, 1730}, {8308, 1878}, {8433, 1987}, {8744, 2165}, {8962, 2265}, {9071, 2229}, {9329, 2105}, {9594, 1786}, {9578, 1484}, {9404, 1139}, {9083, 924}, {8814, 908}, {8629, 1022}, {8413, 1213}, {8291, 1430}, }, { {10293, 3925}, {10334, 4004}, {10319, 4119}, {10207, 4207}, {10278, 4452}, {10410, 4653}, {10513, 4766}, {10631, 4851}, {10785, 4850}, {10948, 4921}, {11168, 4898}, {11394, 4711}, {11513, 4529}, {11564, 4242}, {11474, 3996}, {11383, 3822}, {11176, 3662}, {11039, 3618}, {10924, 3642}, {10597, 3740}, {10397, 3829}, }, { {11213, 7150}, {11175, 7242}, {11025, 7351}, {10872, 7361}, {10803, 7617}, {10766, 7854}, {10885, 7955}, {10830, 8103}, {10994, 8256}, {11210, 8336}, {11512, 8385}, {11687, 8255}, {11873, 7929}, {12004, 7646}, {11913, 7384}, {11741, 7230}, {11434, 7125}, }, { {8849, 9848}, {8724, 10101}, {8753, 10288}, {8972, 10564}, {9249, 10754}, {9484, 10775}, {9714, 10684}, {9968, 10486}, {10053, 10270}, {10050, 9975}, {9830, 9680}, {9546, 9534}, {9450, 9600}, {9276, 9584}, {9073, 9666}, {8950, 9738}, }, { {6456, 10774}, {6289, 10861}, {6235, 10963}, {6083, 11001}, {6027, 11229}, {6033, 11509}, {6135, 11700}, {6358, 11872}, {6734, 11943}, {7031, 11843}, {7226, 11635}, {7189, 11246}, {7111, 10938}, {7029, 10713}, {6877, 10650}, {6653, 10684}, }, { {3454, 10273}, {3342, 10362}, {3183, 10370}, {3018, 10557}, {2875, 10822}, {2896, 11085}, {3023, 11353}, {3300, 11541}, {3626, 11587}, {3872, 11456}, {4008, 11226}, {4101, 10983}, {4170, 10780}, {4127, 10629}, {3815, 10395}, }, { {1365, 7844}, {1415, 7926}, {1522, 7957}, {1604, 7953}, {1727, 8083}, {1859, 8332}, {1904, 8540}, {1815, 8582}, {1775, 8700}, {1792, 8797}, {1602, 8923}, {1372, 8975}, {975, 8952}, {728, 8870}, {583, 8658}, {508, 8350}, {558, 8143}, {730, 8040}, {1070, 7907}, {1255, 7876}, }, } local L1 = { { {6099, 5545}, {6245, 5573}, {6430, 5618}, {6521, 5668}, {6580, 5718}, {6563, 5796}, {6577, 5848}, {6624, 5879}, {6747, 5894}, {6824, 5885}, {6820, 5974}, {6817, 6089}, {6856, 6295}, {6878, 6423}, {6879, 6483}, {6822, 6500}, {6747, 6569}, {6669, 6683}, {6668, 6739}, {6698, 6772}, {6738, 6804}, {6676, 6874}, {6604, 6947}, {6489, 6994}, {6370, 7070}, {6201, 7105}, {6159, 7027}, {6063, 6953}, {5930, 6944}, {5853, 6948}, {5795, 6975}, {5612, 6803}, {5474, 6588}, {5413, 6477}, {5492, 6418}, {5546, 6333}, {5545, 6255}, {5507, 6207}, {5466, 6172}, {5601, 6046}, {5687, 5962}, {5764, 5902}, {5835, 5870}, {5873, 5866}, {5896, 5897}, {5981, 5921}, {6112, 5790}, {6144, 5711}, {6134, 5616}, }, } local S5 = { {4318, 5231}, {6925, 4269}, {8630, 6269}, {7021, 8432}, {4538, 7734}, } local S10 = { {946, 5015}, {2211, 2237}, {5512, 926}, {9144, 1367}, {11253, 4194}, {11626, 7812}, {9625, 10440}, {6737, 11610}, {3546, 11249}, {1120, 8528}, } local S1 = { {6171, 6304}, } local function combineTables(boxesArray, startpointsArray) local ret = {} local id = 0 for i = 1, #boxesArray do for j = 1, #boxesArray[i] do ret[id] = { boxes = { boxesArray[i][j] }, startpoints = { startpointsArray[i][j] }, } id = id + 1 end end return ret end local teams = Spring.Utilities.GetTeamCount() if (teams == 1) then return combineTables({L1}, {S1}), supported_teamcounts elseif (teams < 6) then return combineTables({L5}, {S5}), supported_teamcounts elseif (teams == 6) then return combineTables({L5,L1}, {S5,S1}), supported_teamcounts elseif (teams < 11) then return combineTables({L10}, {S10}), supported_teamcounts elseif (teams == 11) then return combineTables({L10,L1}, {S10,S1}), supported_teamcounts elseif (teams < 16) then return combineTables({L10,L5}, {S10,S5}), supported_teamcounts else return combineTables({L10,L5,L1}, {S10,S5,S1}), supported_teamcounts end
gpl-2.0
8devices/carambola2-new-packages
net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/memberconfig.lua
110
1317
-- ------ extra functions ------ -- function cbi_add_interface(field) uci.cursor():foreach("mwan3", "interface", function (section) field:value(section[".name"]) end ) end -- ------ member configuration ------ -- dsp = require "luci.dispatcher" arg[1] = arg[1] or "" m5 = Map("mwan3", translate("MWAN Member Configuration - ") .. arg[1]) m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "member") mwan_member = m5:section(NamedSection, arg[1], "member", "") mwan_member.addremove = false mwan_member.dynamic = false interface = mwan_member:option(Value, "interface", translate("Interface")) cbi_add_interface(interface) metric = mwan_member:option(Value, "metric", translate("Metric"), translate("Acceptable values: 1-1000. Defaults to 1 if not set")) metric.datatype = "range(1, 1000)" weight = mwan_member:option(Value, "weight", translate("Weight"), translate("Acceptable values: 1-1000. Defaults to 1 if not set")) weight.datatype = "range(1, 1000)" -- ------ currently configured interfaces ------ -- mwan_interface = m5:section(TypedSection, "interface", translate("Currently Configured Interfaces")) mwan_interface.addremove = false mwan_interface.dynamic = false mwan_interface.sortable = false mwan_interface.template = "cbi/tblsection" return m5
gpl-2.0
zhutaorun/2DPlatformer-SLua
Assets/StreamingAssets/Lua/Base/YwCodeTemplate_Helper.lua
1
1287
-- -- $(Class) class. -- -- @filename $(Class).lua -- @copyright Copyright (c) 2015 Yaukey/yaukeywang/WangYaoqi (yaukeywang@gmail.com) all rights reserved. -- @license The MIT License (MIT) -- @author $(Author) @(AuthorName)@$(Mail).com -- @date 2015-xx-xx -- local YwRegisterObject = require "Base/YwRegisterObject" local YwDeclare = YwDeclare local YwClass = YwClass local DLog = YwDebug.Log local DLogWarn = YwDebug.LogWarning local DLogError = YwDebug.LogError -- Register new class $(Class). local strClassName = "$(Class)" local $(Class) = YwDeclare(strClassName, YwClass(strClassName, YwRegisterObject)) -- Member variables. -- Constructor. function $(Class):Constructor(cRegister) --print("$(Class):Constructor") end -- Destructor. function $(Class):Destructor() --print("$(Class):Destructor") end -- Virtual. -- Init. function $(Class):Init() --print("$(Class):Init") end -- Virtual. -- Release. function $(Class):Release() --print("$(Class):Release") end -- Virtual. -- Update. function $(Class):Update() --print("$(Class):Update") -- Super class. $(Class).super.Update(self) end -- Static. -- The static method. function $(Class).StaticMethod() --print("$(Class):StaticMethod") end -- Return this class. return $(Class)
mit
Har1eyquinn/Watch_Dog
plugins/help.lua
337
5009
do function pairsByKeys(t, f) local a = {} for n in pairs(t) do table.insert(a, n) end table.sort(a, f) local i = 0 -- iterator variable local iter = function () -- iterator function i = i + 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end return iter end -- Returns true if is not empty local function has_usage_data(dict) if (dict.usage == nil or dict.usage == '') then return false end return true end -- Get commands for that plugin local function plugin_help(name,number,requester) local plugin = "" if number then local i = 0 for name in pairsByKeys(plugins) do if plugins[name].hidden then name = nil else i = i + 1 if i == tonumber(number) then plugin = plugins[name] end end end else plugin = plugins[name] if not plugin then return nil end end local text = "" if (type(plugin.usage) == "table") then for ku,usage in pairs(plugin.usage) do if ku == 'user' then -- usage for user if (type(plugin.usage.user) == "table") then for k,v in pairs(plugin.usage.user) do text = text..v..'\n' end elseif has_usage_data(plugin) then -- Is not empty text = text..plugin.usage.user..'\n' end elseif ku == 'moderator' then -- usage for moderator if requester == 'moderator' or requester == 'admin' or requester == 'sudo' then if (type(plugin.usage.moderator) == "table") then for k,v in pairs(plugin.usage.moderator) do text = text..v..'\n' end elseif has_usage_data(plugin) then -- Is not empty text = text..plugin.usage.moderator..'\n' end end elseif ku == 'admin' then -- usage for admin if requester == 'admin' or requester == 'sudo' then if (type(plugin.usage.admin) == "table") then for k,v in pairs(plugin.usage.admin) do text = text..v..'\n' end elseif has_usage_data(plugin) then -- Is not empty text = text..plugin.usage.admin..'\n' end end elseif ku == 'sudo' then -- usage for sudo if requester == 'sudo' then if (type(plugin.usage.sudo) == "table") then for k,v in pairs(plugin.usage.sudo) do text = text..v..'\n' end elseif has_usage_data(plugin) then -- Is not empty text = text..plugin.usage.sudo..'\n' end end else text = text..usage..'\n' end end text = text..'======================\n' elseif has_usage_data(plugin) then -- Is not empty text = text..plugin.usage..'\n======================\n' end return text end -- !help command local function telegram_help() local i = 0 local text = "Plugins list:\n\n" -- Plugins names for name in pairsByKeys(plugins) do if plugins[name].hidden then name = nil else i = i + 1 text = text..i..'. '..name..'\n' end end text = text..'\n'..'There are '..i..' plugins help available.' text = text..'\n'..'Write "!help [plugin name]" or "!help [plugin number]" for more info.' text = text..'\n'..'Or "!help all" to show all info.' return text end -- !help all command local function help_all(requester) local ret = "" for name in pairsByKeys(plugins) do if plugins[name].hidden then name = nil else ret = ret .. plugin_help(name, nil, requester) end end return ret end local function run(msg, matches) if is_sudo(msg) then requester = "sudo" elseif is_admin(msg) then requester = "admin" elseif is_momod(msg) then requester = "moderator" else requester = "user" end if matches[1] == "!help" then return telegram_help() elseif matches[1] == "!help all" then return help_all(requester) else local text = "" if tonumber(matches[1]) then text = plugin_help(nil, matches[1], requester) else text = plugin_help(matches[1], nil, requester) end if not text then text = telegram_help() end return text end end return { description = "Help plugin. Get info from other plugins. ", usage = { "!help: Show list of plugins.", "!help all: Show all commands for every plugin.", "!help [plugin name]: Commands for that plugin.", "!help [number]: Commands for that plugin. Type !help to get the plugin number." }, patterns = { "^!help$", "^!help all", "^!help (.+)" }, run = run } end
gpl-2.0
pakoito/ToME---t-engine4
game/modules/tome/data/zones/demon-plane/npcs.lua
3
2973
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org load("/data/general/npcs/ghost.lua", rarity(5)) load("/data/general/npcs/major-demon.lua", rarity(2)) load("/data/general/npcs/minor-demon.lua", rarity(0)) local Talents = require("engine.interface.ActorTalents") newEntity{ define_as = "DRAEBOR", allow_infinite_dungeon = true, type = "demon", subtype = "minor", unique = true, name = "Draebor, the Imp", display = "u", color=colors.VIOLET, desc = [[An intensely irritating git of a monster.]], faction = "fearscape", level_range = {35, nil}, exp_worth = 3, max_life = 300, life_rating = 22, fixed_rating = true, rank = 4, size_category = 5, infravision = 30, mana_regen = 100, life_regen = 10, stats = { str=20, dex=15, cun=35, mag=25, con=20 }, poison_immune = 1, stun_immune = 1, instakill_immune = 1, no_breath = 1, move_others=true, demon = 1, on_melee_hit = { [DamageType.FIRE] = 15, }, resists = { [DamageType.FIRE] = 50, [DamageType.DARKNESS] = 50, }, body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 }, resolvers.drops{chance=100, nb=4, {tome_drops="boss"} }, resolvers.drops{chance=100, nb=1, {defined="BOOTS_OF_PHASING"} }, summon = { {type="demon", number=1, hasxp=false}, }, talent_cd_reduction={[Talents.T_FLAME]=2, [Talents.T_BLOOD_GRASP]=4, [Talents.T_PHASE_DOOR]=3, [Talents.T_SUMMON]=-10, }, resolvers.talents{ [Talents.T_SUMMON]=1, [Talents.T_FLAME]={base=5, every=5, max=8}, [Talents.T_BLOOD_GRASP]={base=5, every=5, max=8}, [Talents.T_WILDFIRE]={base=5, every=5, max=8}, [Talents.T_PHASE_DOOR]=2, [Talents.T_CURSE_OF_VULNERABILITY]={base=5, every=5, max=8}, [Talents.T_BONE_SHIELD]={base=3, every=10, max=5}, }, resolvers.sustains_at_birth(), autolevel = "caster", ai = "tactical", ai_state = { talent_in=1, ai_move="move_astar", }, ai_tactic = resolvers.tactic"ranged", resolvers.inscriptions(2, "rune"), resolvers.inscriptions(1, {"manasurge rune"}), on_die = function(self, who) require("engine.ui.Dialog"):simplePopup("Back and there again", "As the annoying imp falls a portal appears under its corpse.") local g = game.zone:makeEntityByName(game.level, "terrain", "PORTAL_BACK") game.zone:addEntity(game.level, g, "terrain", self.x, self.y) end, }
gpl-3.0
pakoito/ToME---t-engine4
game/modules/tome/data/gfx/particles/demon_teleport.lua
3
1741
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org base_size = 32 return { generator = function() local ad = rng.float(0, 360) local dir = math.rad(ad) if rng.chance(2) then return { x = math.cos(dir) * 2, y = math.sin(dir) * 2, dir = dir, vel = rng.float(2, 5), life = rng.range(20, 30), size = rng.range(3, 7), sizev = 0, sizea = 0, r = rng.range(200, 255)/255, rv = 0, ra = 0, g = rng.range(120, 170)/255, gv = 0, ga = 0, b = rng.range(0, 100)/255, bv = 0, ba = 0, a = 1, av = 0, aa = 0, } else return { x = math.cos(dir) * 5, y = math.sin(dir) * 5, dir = dir, vel = rng.float(2, 5), life = rng.range(20, 30), size = rng.range(3, 7), sizev = 0, sizea = 0, r = rng.range(0, 40)/255, rv = 0, ra = 0, g = rng.range(0, 40)/255, gv = 0.005, ga = 0.0005, b = rng.range(0, 40)/255, bv = 0, ba = 0, a = 1, av = 0, aa = 0.005, } end end, }, function(self) self.nb = (self.nb or 0) + 1 if self.nb < 6 then self.ps:emit(100) end end, 600
gpl-3.0
madpilot78/ntopng
scripts/locales/cz.lua
1
237713
local lang = { ["abort"] = "Přerušit", ["actions"] = "Akce", ["activities"] = "Aktivity", ["activity"] = "Aktivita", ["advanced"] = "Pokročilé", ["aggregation"] = "Agregace", ["alias"] = "Alias", ["all"] = "Vše", ["allowed"] = "Povoleno", ["any"] = "Jakýkoliv", ["app_name"] = "Název Aplikace", ["application"] = "Aplikace", ["applications"] = "Aplikace", ["apply"] = "Použít", ["arp"] = "ARP", ["arp_top_talkers"] = "ARP Matrix Talkers", ["as"] = "AS", ["as_number"] = "AS number", ["asn"] = "ASN", ["available"] = "Dostupný", ["backup"] = "Záloha", ["begin"] = "Začít", ["breakdown"] = "Breakdown", ["bridge"] = "Most", ["broadcast_domain"] = "Broadcast Domain", ["broadcast_traffic"] = "Broadcast Traffic", ["bytes"] = "Bytů", ["cancel"] = "Zrušit", ["categories"] = "Kategorie", ["category"] = "Kategorie", ["change_number_of_rows"] = "Změň počet řádků na stránku", ["chart"] = "Chart", ["client"] = "Klient", ["clone"] = "Klonovat", ["close"] = "Zavřít", ["countries"] = "Země / Státy", ["date_from"] = "Začít Od Datum/Čas:", ["date_to"] = "Skončit Od Datum/Čas:", ["day"] = "Den", ["define"] = "Definuj", ["delete"] = "Smaž", ["destination"] = "Cíl", ["device_protocols_description"] = "Na této stránce je možné nakonfigurovat seznam přijatelných aplikací podle typu a směru zařízení (zařízení jako klient nebo server s ohledem na aplikaci). Povolením výstrah zařízení aplikace na konfigurační stránce výstrah v části Předvolby se výstrahy generují, když je detekována anomální aplikace.", ["devices"] = "Zařízení", ["difference"] = "Rozdíl", ["disabled"] = "Vypnutý", ["discarded"] = "Smazaný", ["dns"] = "DNS", ["domain"] = "Doména", ["download"] = "Stáhnout", ["download_x"] = "%{what} stáhnout", ["downloaders"] = "Download Volume", ["drilldown"] = "Drilldown", ["duplexstatus"] = "Duplex Status", ["duration"] = "Doba trvání", ["egress"] = "Odchozí", ["empty"] = "Prázdný", ["end"] = "Konec", ["enterpriseOnly"] = "Tato funkce je k dispozici pouze v edici ntopng Enterprise", ["error"] = "Chyba", ["error_no_search_results"] = "Nebyly nalezeny žádné výsledky. Upravte prosím kritéria vyhledávání.", ["error_not_granted"] = "Žádosti nebylo vyhověno", ["error_rrd_cannot_complete_dump"] = "Nelze dokončit výpis místních časů hostitelů. Disk je pomalý nebo příliš mnoho místních hostitelů?", ["error_rrd_low_resolution"] = "Žádáte o načtení dat s nižším rozlišením, než jaké je k dispozici na RRD, což povede k neplatným datům. <br> Pokud stále chcete data s takovou podrobností, vylaďte prosím <a href=\"%{prefs}\">Časový rozvrh aplikací / sítí</a> preference", ["errors"] = "Chyby", ["expired_csrf"] = "Požadovanou akci nelze provést, protože platnost stránky vypršela. Proveďte akci znovu.", ["fingerprint_note"] = "Název aplikace je nastaven, pouze pokud je ntopng nakonfigurován pro příjem zdroje eBPF prostřednictvím ZMQ", ["flow"] = "Tok", ["flow_search_criteria"] = "Kritéria vyhledávání toku", ["flow_search_from_aggregated"] = "(Agregován)", ["flow_search_results"] = "Výsledky hledání toku", ["flows"] = "Toky", ["forbidden"] = "Zakázáno", ["free"] = "Volný", ["from"] = "z", ["gateway"] = "Brány", ["hassh_fingerprint"] = "HASSH Fingerprint", ["host"] = "Host %{host}", ["host_address"] = "Host Address", ["hosts"] = "Hosts", ["hour"] = "Hodina", ["http"] = "HTTP", ["icmp"] = "ICMP", ["iface_download"] = "%{iface} download", ["iface_upload"] = "%{iface} upload", ["incomingflows"] = "Aktivní příchozí toky", ["info"] = "Info", ["ingress"] = "Vstup", ["interface"] = "Rozhraní", ["interface_ifname"] = "Rozhraní %{ifname}", ["interfaces"] = "Rozhraní", ["ip_address"] = "IP Adresa", ["ipv4"] = "IPv4", ["ipv6"] = "IPv6", ["ja3_fingerprint"] = "JA3 Fingerprint", ["key"] = "Klíč", ["language"] = "Jazyk", ["layer_2"] = "Mac Addresses", ["legenda"] = "Legenda", ["local_traffic"] = "Lokální Provoz", ["mac_address"] = "Mac Address", ["max_rate"] = "Max Rate", ["memory"] = "Paměť", ["model"] = "Model", ["month"] = "Měsíc", ["mtu"] = "MTU", ["name"] = "Název", ["netmask"] = "Netmask", ["networks"] = "Sítě", ["next"] = "Další", ["no"] = "Ne", ["noTraffic"] = "Pro zadaný výběr data a času nebyl hlášen žádný provoz", ["no_data_available"] = "Nejsou k dispozici žádná data", ["no_ports"] = "Žádné Porty", ["no_results_found"] = "Nebyly nalezeny žádné výsledky", ["no_talkers_for_the_host"] = "Pro aktuálního hostitele nejsou žádní talkers", ["note_flow_search_allowed_networks"] = "Aktuální uživatel smí procházet pouze následující sítě: %{nets}.", ["note_flow_search_allowed_networks_applications"] = "Hostitelé, kteří nepatří k žádné z povolených sítí, budou před aplikačními talkers skryti.", ["note_flow_search_allowed_networks_counter"] = "Čítače ve výsledcích hledání toku jsou totální, ale budou zobrazeny pouze toky s klientem a serverem v povolených sítích.", ["note_flow_search_allowed_networks_ipv6"] = "Neprázdné povolené sítě IPv6 způsobí zobrazení všech toků IPv6.", ["note_flow_search_allowed_networks_talkers"] = "Hostitelé, kteří nepatří k žádné z povolených sítí, budou skryti před Top Talkers.", ["notes"] = "POZNÁMKY:", ["num_different_ports"] = "%{num} ports. None doing %{threshold}%%+ of the traffic.", ["num_uses"] = "Počet Užití", ["operating_systems"] = "Operační Systémy", ["os"] = "OS", ["other"] = "Ostatní", ["outgoingflows"] = "Aktivní Odchozí Toky", ["overview"] = "Přehled", ["packets"] = "Pakety", ["peers"] = "peers", ["percentage"] = "Procenta", ["pkts"] = "Pkts", ["port"] = "Port", ["ports"] = "Porty", ["previous"] = "Předchozí", ["protocol"] = "Protokol", ["protocol_categories"] = "Kategorie Protokolu", ["protocols"] = "Protokoly", ["purged_error_message"] = "Je velmi pravděpodobné, že platnost vypršela a %{product} ji vymazal z paměti. Nastavení časového limitu vyprázdnění můžete nastavit z <a href=\"%{url}\"><i class=\"fas fa-flask\"></i> Preference</a>.", ["quotas"] = "Kvóty", ["reason"] = "Důvod", ["received"] = "Přijato", ["refresh"] = "Obnovit", ["remote_hosts"] = "Vzdálení Hosté", ["remote_networks"] = "Vzdálené Sítě", ["remove"] = "Odstranit", ["reset"] = "Reset", ["restore"] = "Obnovit", ["retry"] = "Znova", ["running"] = "Běžící", ["save"] = "Ulož", ["save_configuration"] = "Ulož Konfiguraci", ["save_settings"] = "Ulož Nastavení", ["score"] = "Skóre", ["search_host"] = "Vyhledávání", ["seen_since"] = "Viděn od", ["sent"] = "Posláno", ["server"] = "Server", ["showing_x_to_y_rows"] = "Ukazuji %{x} do %{y} z %{tot} řádků", ["similarity"] = "Podobnost", ["speed"] = "Rychlost", ["ssh"] = "SSH", ["start"] = "Start", ["status"] = "Status", ["stop"] = "Stop", ["summary"] = "Souhrn", ["system"] = "System", ["system_status"] = "Stav systému", ["talkers"] = "Talkers", ["tcp_flags"] = "TCP Flags", ["tcp_stats"] = "TCP Statistics", ["telemetry"] = "Telemetrie", ["throughput"] = "Propustnost", ["time"] = "Čas", ["timeframe"] = "Časové okno", ["tls"] = "TLS", ["tls_certificate"] = "TLS Certifikát", ["today"] = "Dnes", ["total"] = "Celkem", ["total_incoming_misbehaving_flows"] = "Celkový počet chybných toků jako Server", ["total_incoming_unreachable_flows"] = "Celkový počet nedosažitelných toků jako Server", ["total_outgoing_misbehaving_flows"] = "Celkem chybné toky jako klient", ["total_outgoing_unreachable_flows"] = "Total Port Unreachable Flows As Client", ["traffic"] = "Provoz", ["traffic_policy"] = "Politika Provozu", ["undo"] = "Zpět", ["unknowers"] = "Unknown Traffic Volume", ["unknown"] = "Neznámý", ["unlimited"] = "&infin;", ["uploaders"] = "Upload Volume", ["version"] = "Vaše verze je %{vers}.", ["via"] = "Skrz", ["vlan"] = "VLAN", ["volume"] = "Volume", ["volume_size"] = "Volume Size", ["warning"] = "Varování", ["week"] = "Týden", ["welcome"] = "Vítejte", ["welcome_to"] = "Vítejte do %{product}", ["yes"] = "Ano", ["about"] = { ["about_ntopng"] = "O ntopng", ["about_x"] = "O %{product}", ["built_on"] = "Postaveno na", ["callback_directories"] = "Adresáře uživatelských skriptů", ["copyright"] = "Copyright", ["cpu_load"] = "CPU load", ["data_directory"] = "Data", ["datadir_warning"] = "Oznámení o migraci datového adresáře", ["defs_directories"] = "Definice adresářů", ["dhcp_range_missing_warning"] = "<a href='%{url}'>%{name}</a> preference je neúčinná. Prosím nakonfigurujte <a href='%{dhcp_url}'>Rozsah DHCP</a> vhodně.", ["directories"] = "Adresáře", ["flow_checks_directory"] = "Tok", ["host_checks_directory"] = "Host", ["host_identifier_warning"] = "Toto rozhraní monitoruje hostitele DHCP. Zvažte prosím změnu <a href='%{url}'>%{name}</a> preference \"Mac adresy\".", ["influxdb_migration_msg"] = "Máte spoustu místních hostitelů. Prosím zvažte <a href='%{url}'>přesun z RRD do InfluxDB</a> pro ukládání časových řad pro zlepšení výkonu.", ["interface_callbacks_directory"] = "Rozhraní", ["last_log"] = "Poslední záznam trace", ["licence"] = "Licence", ["licence_expires_in"] = "Licence vyprší za %{time}", ["licence_generation"] = "Kliknutím na výše uvedenou adresu URL vygenerujete licenci pro profesionální verzi nebo <br>zakupte licenci na<a href=\"%{purchase_url}\">e-shop</a>. Pokud jste nezisková, výzkumová či vzdělávací <br>instituce, prosím, přečtěte <a href=\"%{universities_url}\">toto</a>.", ["maintenance"] = "Údržba: Do doby %{_until} [%{days_left} zbývající dny]", ["maintenance_expired"] = "%{product} údržba vypršela", ["maxmind"] = "Tento produkt obsahuje data GeoDB vytvořená <a class='ntopng-external-link' href=\"%{maxmind_url}\">MaxMind <i class=\"fas fa-external-link-alt\"></i></a> / <a class='ntopng-external-link' href='https://db-ip.com'>DB-IP <i class=\"fas fa-external-link-alt\"></i></a>.", ["network_callbacks_directory"] = "Síť", ["ntop_blog"] = "ntop Blog", ["platform"] = "Platforma", ["ram_memory"] = "RAM", ["readme_and_manual"] = "Uživatelská příručka", ["report_issue"] = "Nahlásit Problém", ["runtime_status"] = "Runtime Status", ["save_licence"] = "Uložit licenci", ["scripts_directory"] = "Skripty", ["specify_licence"] = "Zde zadejte svou licenci ntopng", ["startup_line"] = "Startup Line", ["system"] = "Systém", ["system_id"] = "ID systému", ["telegram"] = "Pomoc A Novinky", ["telemetry_data_opt_out_msg"] = "Přispějte do projektu zasláním šifrovaného, <a href=\"%{tel_url}\">anonymních telemetrických dat</a> do <a href=\"%{ntop_org}\">ntop.org</a>: navštivte <a href=\"%{url}\"><i class=\"fas fa-flask\"></i> předvolby</a> stránky a vyjádřete své preference.", ["upgrade_to_professional"] = "Upgradujte na profesionální verzi", ["uptime"] = "Uptime", ["version"] = "Verze", ["you_have_too_many_flows"] = "Máte příliš mnoho hostitelů / toků %{product} konfigurace a to povede k poklesu paketů a vysokému zatížení CPU. Prosím restartujte %{product} zvýšením -x a -X", }, ["activities_page"] = { ["host_activity"] = "Hostitelská aktivita", }, ["alert_messages"] = { ["a_new_device_has_connected"] = "Nové zařízení <a href=\"%{url}\">%{device}</a> se připojilo do sítě.", ["anomalous_tcp_flags"] = "%{entity} has %{sent_or_rcvd} too many TCP RST flags vs SYN [Ratio: %{ratio}%%]", ["broadcast_domain_too_large"] = "Provoz ARP z <a href=\"%{src_mac_url}\">%{src_mac}</a>/<a href=\"%{spa_url}\">%{spa}</a> do <a href=\"%{dst_mac_url}\">%{dst_mac}</a>/<a href=\"%{tpa_url}\">%{tpa}</a> detekováno. Je nepravděpodobné, že by mezi těmito IPs viděl přenos ARP, protože patrně patří do různých vysílacích domén. Zkontrolujte konfigurace hostitelů a sítí.", ["device_has_connected"] = "Zařízení <a href=\"%{url}\">%{device}</a> se připojilo do sítě.", ["device_has_disconnected"] = "Zařízení <a href=\"%{url}\">%{device}</a> se odpojilo ze sítě.", ["flow_flood_attacker"] = "%{entity} is a flow flooder [%{value} &gt; %{threshold} flows sent]", ["flow_flood_victim"] = "%{entity} is under flow flood attack [%{value} &gt; %{threshold} flows received]", ["host_entity"] = "host %{entity_value}", ["host_pool_has_connected"] = "Hostitelský fond <a href=\"%{url}\">%{pool}</a> se připojil do sítě", ["host_pool_has_disconnected"] = "Hostitelský fond <a href=\"%{url}\">%{pool}</a> se odpojil od sítě.", ["host_remote_to_remote"] = "Vzdálený host <a href=\"%{url}\">%{ip}</a> %{mac} kontaktoval vzdáleného hosta. Vzdálené dálkové toky dostupné z <a href=\"%{flow_alerts_url}\">stránky s upozorněním na toky</a>.", ["influxdb_dropped_points"] = "Points dropped. Nelze je odeslat do \"%{influxdb}\".", ["influxdb_partial_write"] = "To lze opravit nastavením \"max-values-per-tag = 0\" v konfiguraci serveru InfluxDB.", ["influxdb_write_error"] = "Při odesílání dat časových adres do došlo k chybě \"%{influxdb}\": %{err}", ["interface_entity"] = "rozhraní %{entity_value}", ["ip_outside_dhcp_range_router_ip"] = "[Router: <a href=\"%{router_url}\">%{router_ip}</a>]", ["ip_outsite_dhcp_range"] = "Zařízení <a href=\"%{client_url}\">%{client_mac}</a> v <a href=\"%{client_ip_url}\">%{client_ip}</a> ,které je mimo <a href=\"%{dhcp_url}\">nakonfigurovaného rozsahu DHCP</a>. [Sender: <a href=\"%{sender_url}\">%{sender_mac}</a>]", ["mac_ip_association_change"] = "IP %{ip} změněno přidružení z <a href=\"%{old_mac_url}\">%{old_mac}</a> do <a href=\"%{new_mac_url}\">%{new_mac}</a>", ["misbehaving_flows_ratio"] = "%{entity} má %{sent_or_rcvd} příliš mnoho chybných toků vs celkové toky [Poměr: %{ratio}%%]", ["network_entity"] = "Síť %{entity_value}", ["nfq_flushed"] = "Rozhraní <a href=\"%{url}\">%{name}</a> fronty paketů propláchnuta. Fronta %{pct}%% plná s %{tot} pakety a %{dropped} drops.", ["ntopng_anomalous_termination"] = "Zahájeno po anomálním ukončení (<a href=\"%{url}\">hlášení o chybě</a>)", ["ntopng_start"] = "Začal", ["ntopng_stop"] = "Přestal", ["open_files_limit_too_small"] = "Ntopng zjistil, že maximální počet souborů, které MySQL může otevřít, je potenciálně příliš malý. To může mít za následek ztrátu dat toku v důsledku chyb, například [Nedostatek zdrojů při otevírání souboru './ntopng/flowsv6#P#p22.MYD' (Errcode: 24 - Too many open files)][23]. Nezapomeňte zvýšit hodnotu open_files_limit nebo, pokud chcete toto varování ignorovat, deaktivujte kontrolu z předvoleb.", ["ping_host_unreachable"] = "Host %{ip_label} %{numeric_ip} je nedosažitelný.", ["ping_rtt_too_slow"] = "RTT příliš vysoko pro hostitele %{ip_label} %{numeric_ip}. Měřené RTT%{rtt_value} ms, maximální očekávané RTT%{maximum_rtt} ms.", ["potentially_dangerous_protocol_description"] = "Tento tok může být pro síť škodlivý, protože se používá zastaralý nebo zranitelný protokol.", ["proto_bytes_quotas"] = "%{proto} bajty", ["proto_time_quotas"] = "%{proto} čas", ["slow_periodic_activity"] = "Periodická činnost \"%{script}\" trvala příliš mnoho na dokončení [%{duration} &gt; %{max_duration}]", ["subject_quota_exceeded"] = "Hostitelský fond <a href=\"%{url}\">%{pool}</a> překročena %{subject} kvóta[%{value} &gt; %{quota}]", ["syn_flood_attacker"] = "%{entity} is a SYN flooder [%{value} &gt; %{threshold} SYN sent]", ["syn_flood_victim"] = "%{entity} is under SYN flood attack [%{value} &gt; %{threshold} SYN received]", ["syn_scan_attacker"] = "%{entity} is a SYN Scan attacker [%{value} &gt; %{threshold} SYN sent]", ["syn_scan_victim"] = "%{entity} is under SYN Scan [%{value} &gt; %{threshold} SYN received]", ["test_failed"] = "Test selhal", ["threshold_crossed"] = "%{granularity} <b>%{metric}</b> crossed by %{entity} [%{value} %{op} %{threshold}]", ["too_many_drops"] = "%{iface}má příliš mnoho vynechaných paketů [&gt %{max_drops}%%]", ["too_many_flows"] = "%{iface} má příliš mnoho toků. Prosím rozšířte %{option} možnost příkazového řádku", ["too_many_hosts"] = "%{iface} má příliš mnoho hostitelů. Prosím rozšířte %{option} možnost příkazového řádku", ["x_alerts"] = "%{num} upozornění", }, ["alerts_dashboard"] = { ["active_flows_anomaly"] = "Anomálie aktivních toků.", ["alert_counts"] = "Počítá", ["alert_duration"] = "Doba trvání", ["alert_severity"] = "Vážnost", ["alert_type"] = "Typ", ["alerts_dashboard"] = "Informační panel upozornění", ["all_hosts"] = "Všichni hostitelé", ["anomalous_tcp_flags"] = "Anomalous TCP Flags", ["blacklisted_flow"] = "Tok na černé listině", ["blocked_flow"] = "Blokovaný Tok", ["broadcast_domain_too_large"] = "Vysílací doména", ["connection_issues"] = "Problémy S Připojením", ["custom_period"] = "Vlastní období", ["device_connection"] = "Připojení zařízení", ["device_disconnection"] = "Odpojení zařízení", ["dns_anomaly"] = "DNS Anomaly", ["engaged_for_longest"] = "Past Alerts Engaged for Longest", ["error"] = "Chyba", ["experimental_checks"] = "Experimentální", ["experimental_checks_description"] = "Povolit experimentální kontroly výstrah: TCP flags, poměr anomálních toků", ["external_alert"] = "Externí upozornění", ["five_mins"] = "Trvá 5 minut", ["flow_alert_origins"] = "Původy výstrah toku", ["flow_alert_targets"] = "Cíle upozornění toku", ["flow_misbehaviour"] = "Špatné chování Toku", ["flows_flood"] = "Flows Flood", ["ghost_network_detected"] = "Byla Detekována Ghost Network", ["ghost_network_detected_description"] = "Subnet %{network} nepatří do <a href='%{url}'>%{entity} sítě </a>.", ["host_pool_connection"] = "Hostitelský fond Připojen", ["host_pool_disconnection"] = "Hostitelský fond Odpojení", ["icmp_anomaly"] = "ICMP Anomaly", ["inactivity"] = "Nečinnost", ["influxdb_dropped_points"] = "InfluxDB Dropped Points", ["influxdb_export_failure"] = "InfluxDB Export selhal", ["info"] = "Info", ["involving_msg"] = "Zapojení výstrah toku", ["last_day"] = "Poslední Den", ["last_hour"] = "Poslední Hodina", ["last_minute"] = "Poslední Minuta", ["list_download_failed"] = "Stažení seznamu se nezdařilo", ["local_only"] = "Jen lokální hostitelé", ["local_origin_remote_target"] = "Místní původ - vzdálený cíl", ["login_failed"] = "Přihlášení Se Nezdařilo", ["mac_ip_association_change"] = "IP/MAC Změna", ["malicious_signature_detected"] = "Možný škodlivý Signature", ["many_replies"] = "%{count} %{what} odpovědi", ["many_requests"] = "%{count} %{what} požadavky", ["misbehaving_flows_ratio"] = "Příliš mnoho špatnéhých toků", ["misconfigured_app"] = "Nesprávně nakonfigurovaná aplikace", ["misconfigured_dhcp_range"] = "Chybně nakonfigurovaný rozsah DHCP", ["new_device"] = "Nové Zařízení", ["nfq_flushed"] = "Fronta paketů propláchnuta", ["no_alert"] = "Žádné Upozornění", ["no_alerts"] = "Žádné Upozornění", ["none"] = "Žádný", ["not_engaged"] = "Není zapojen", ["one_day"] = "Poslední Den", ["one_hour"] = "Poslední Hodina", ["one_min"] = "Poslední Minuta", ["one_reply"] = "%{count} %{what} odpověď", ["one_request"] = "%{count} %{what} požadavek", ["ping_issues"] = "Ping", ["potentially_dangerous_protocol"] = "Potenciálně nebezpečný protokol", ["process"] = "Proces", ["quota_exceeded"] = "Kvóta překročena", ["remote_only"] = "Pouze vzdálení hostitelé", ["remote_origin_local_target"] = "Vzdálený původ - místní cíl", ["remote_to_remote"] = "Remote to Remote", ["search_criteria"] = "Nastavení řídicího panelu", ["slow_periodic_activity"] = "Pomalá periodická aktivita", ["snmp_device_is_unresponsive"] = "SNMP zařízení a href=\"%{url}\">%{device}</a> neodpovídá", ["snmp_port_changed_duplex_status"] = "Rozhrání <a href=\"%{port_url}\">%{port}</a> na SNMP zařízení <a href=\"%{url}\">%{device}</a> změnilo svůj duplexní stav na %{new_op}", ["snmp_port_changed_operational_status"] = "Rozhrání <a href=\"%{port_url}\">%{port}</a> na SNMP zařízení <a href=\"%{url}\">%{device}</a> změnilo svůj stav na %{new_op}", ["snmp_port_duplexstatus_change"] = "Změna stavu duplexu rozhraní", ["snmp_port_errors"] = "Chyby rozhraní", ["snmp_port_errors_increased"] = "Počítadla smazaných / chyb zvýšené na rozhraní <a href=\"%{port_url}\">%{port}</a> na zařízení SNMP <a href=\"%{url}\">%{device}</a>", ["snmp_port_load_threshold_exceeded"] = "na zařízení SNMP", ["snmp_port_load_threshold_exceeded_message"] = "%{direction} zatížení je %{port_load}%% na rozhraní <a href=\"%{port_url}\">%{port}</a> na zařízení SNMP <a href=\"%{url}\">%{device}</a>", ["snmp_port_status_change"] = "Změna stavu rozhraní", ["starting_on"] = "Začínající na", ["submit"] = "Aktualizujte řídicí panel", ["suspicious_activity"] = "Podezřelá Aktivita", ["suspicious_device_protocol"] = "Podezřelý Protokol Zařízení", ["tcp_syn_flood"] = "TCP SYN Flood", ["tcp_syn_scan"] = "TCP SYN Scan", ["threashold_cross"] = "Threshold Cross", ["too_low_replies_received"] = "%{entity} odeslal %{requests} ale přijal %{replies} [%{granularity} poměr: %{ratio}%%]", ["too_low_replies_sent"] = "%{entity} přijal %{requests} ale odeslal %{replies} [%{granularity} poměr: %{ratio}%%]", ["too_many_drops"] = "Packet Drops", ["total_alerts"] = "Celkem upozornění", ["trailing_msg"] = "Time Window", ["unresponsive_device"] = "Zařízení neodpovídá", ["user_activity"] = "Uživatelská aktivita", ["warning"] = "Varování", ["web_mining"] = "Web Mining", }, ["alerts_thresholds_config"] = { ["active_local_hosts"] = "Upozornění místních hostitelů", ["active_local_hosts_threshold_descr"] = "Spustí upozornění, když počet aktivních místních hostitelů překročí prahovou hodnotu", ["activity_time"] = "Výstraha času aktivity", ["alert_active_description"] = "Spustí výstrahu, když delta času aktivity překročí prahovou hodnotu", ["alert_bytes_description"] = "Spustí výstrahu, když delta vrstvy 2 bajtů (odeslaná + přijatá) překročí prahovou hodnotu", ["alert_bytes_title"] = "Provozní upozornění", ["alert_dns_description"] = "Spustí výstrahu, když delta 2 bajtů (odeslaná + přijatá) pro přenos DNS překročí prahovou hodnotu", ["alert_flows_description"] = "Spustí výstrahu, když delta toky (jako klient + jako server) překročí prahovou hodnotu", ["alert_flows_title"] = "Opozornění toků", ["alert_idle_description"] = "Spustí výstrahu, když doba nečinnosti (doba od posledního viděného paketu) překročí prahovou hodnotu", ["alert_network_egress_description"] = "Spustí výstrahu, když delta odchozích bajtů překročí prahovou hodnotu", ["alert_network_ingress_description"] = "Spustí výstrahu, když delta vstupních bajtů překročí prahovou hodnotu", ["alert_network_inner_description"] = "Spustí výstrahu, když delta vnitřních bajtů překročí prahovou hodnotu", ["alert_p2p_description"] = "Spustí výstrahu, když delta vrstvy 2 bajtů (odeslaná + přijatá) pro přenos P2P překročí prahovou hodnotu", ["alert_packets_description"] = "Spustí výstrahu, když delta paketů (odeslaná + přijatá) překročí prahovou hodnotu", ["alert_packets_title"] = "Upozornění na pakety", ["alert_throughput_description"] = "Spustí výstrahu, když průměrná propustnost (odeslaná + přijatá) překročí prahovou hodnotu", ["common_thresholds_local_sources"] = "%{source} Obvyklá Konfigurace", ["daily"] = "Denně", ["dns_traffic"] = "DNS Traffic Alert", ["egress_traffic"] = "odchozí provozní upozornění", ["every_5_minutes"] = "Každých 5 minut", ["every_minute"] = "Každou Minutu", ["hourly"] = "Hodinově", ["idle_time"] = "Upozornění na nečinnost", ["ingress_traffic"] = "Vstupní provozní upozornění", ["inner_traffic"] = "vnitřní provozní upozornění", ["note_add_custom_scripts"] = "%{product} hledá v nich vlastní skripty <a href=\"%{url}\"> <i class=\"fas fa-folder\"></i> adresáře</a>.", ["note_checks_on_active_hosts"] = "Kontroly se provádějí pouze u aktivních hostitelů.", ["note_consecutive_checks"] = "Následné kontroly nejsou nutně prováděny v po sobě jdoucích obdobích. Pokud je například hostitel nečinný, jeho prahové hodnoty nebudou kontrolovány, dokud nebude znovu aktivní.", ["note_control_threshold_checks_periods"] = "Zpětná volání uvedená na těchto kartách jsou prováděna pravidelně.", ["note_create_custom_scripts"] = "Dokumentace k vytvoření vlastních skriptů pro provádění zpětných volání je k dispozici zde <a class='ntopng-external-link' href=\"%{url}\">link <i class=\"fas fa-external-link-alt\"></i></a>.", ["note_thresholds_expressed_as_delta"] = "Některá zpětná volání počítají deltu. Delta je rozdíl stejného množství mezi dvěma po sobě jdoucími executions.", ["notes"] = "POZNÁMKY", ["p2p_traffic"] = "P2P Traffic Alert", ["threshold_type"] = "Zpětné volání", ["thresholds_single_source"] = "%{source} %{alt_name} konfigurace", ["throughput"] = "Výstraha průchodnosti", }, ["arp_page"] = { ["arp_type"] = "ARP Type", }, ["as_details"] = { ["as"] = "Autonomous System", ["as_parameter_missing_message"] = "Chybí parametr autonomního systému (interní chyba?)", ["as_timeseries_enable_message"] = "AS Timeseries lze povolit z <A HREF=\"%{url}\">%{icon_flask} Preference</A>. K zobrazení prvních datových bodů je třeba jen pár minut.", ["no_available_data_for_as"] = "Nejsou k dispozici žádná data pro AS %{asn}.", }, ["as_stats"] = { ["autonomous_systems"] = "Autonomní systémy", }, ["categories_page"] = { ["search_application"] = "Vyhledávací aplikace", ["target"] = "Cíl", }, ["category_lists"] = { ["category_lists"] = "Seznamy kategorií", ["connection_time_out"] = "Časový limit připojení serveru vypršel po %{duration} sekundách", ["disable_some_list"] = "Chcete-li to vyřešit, zakažte některé seznamy.", ["edit_list"] = "Upravit seznam kategorií", ["enabled"] = "Povoleno", ["error_occurred"] = "Při stahování seznamu došlo k chybě '%{name}': %{err}", ["http_code"] = "[HTTP Code: %{err_code}]", ["last_update"] = "Poslední aktualizace", ["list_will_be_updated"] = "Seznam '%{name}'bude aktualizován do 30 sekund.", ["loading_stats"] = "Poslední načtení(na %{when}): načten %{num_hosts} domény, %{num_ips} IP adresy, %{num_ja3} JA3 signatures v %{duration} .", ["ready_for_update"] = "Připraveno na aktualizaci", ["server_returned_error"] = "Server vrátil chybu", ["too_many_hosts_loaded"] = "Bylo dosaženo limit (%{limit} názvů domén)", ["too_many_ips_loaded"] = "Bylo dosaženo limitu (%{limit} IP adres )", ["too_many_ja3_loaded"] = "Bylo dosaženo limitu (%{limit} Signatures JA3)", ["update_frequency"] = "Frekvence aktualizace", ["update_now"] = "Aktualizovat teď", }, ["conf_backup"] = { ["conf_backup"] = "Konfigurace zálohy", ["conf_restore"] = "Obnovte konfiguraci", }, ["contacts_page"] = { ["client_address"] = "Adresa klienta", ["client_contacts_initiator"] = "Kontakty klienta (Iniciátor)", ["contacts"] = "Kontakty", ["no_client_contacts_so_far"] = "Dosud žádné klientské kontakty", ["no_contacts_message"] = "Pro tohoto hostitele nejsou dostupné žádné kontakty", ["no_server_contacts_so_far"] = "Zatím žádné kontakty na serveru.", ["server_address"] = "Adresa serveru", ["server_contacts_receiver"] = "Kontakty serveru (Přijímač)", }, ["containers_stats"] = { ["all_containers"] = "All Containers", ["all_pods"] = "All Pods", ["avg_rtt"] = "Avg RTT", ["avg_rtt_as_client"] = "Avg RTT Jako Klient", ["avg_rtt_as_server"] = "Avg RTT Jako Server", ["avg_rtt_variance"] = "Avg RTT Odchylka", ["avg_rtt_variance_as_client"] = "Avg RTT Varianta jako klient", ["avg_rtt_variance_as_server"] = "Avg RTT Varianta jako server", ["client_container"] = "Client Container", ["client_pod"] = "Client Pod", ["client_rtt"] = "Client RTT", ["container"] = "Container", ["containers"] = "Containers", ["containers_list"] = "Containers Seznam", ["containers_of_pod"] = "Containers of Pod '%{pod}'", ["pod"] = "Pod", ["pods"] = "Pods", ["pods_list"] = "Pods Seznam", ["server_container"] = "Server Container", ["server_pod"] = "Server Pod", ["server_rtt"] = "Server RTT", }, ["country_details"] = { ["country"] = "Stát / Země", ["country_parameter_missing_message"] = "Chybí parametr země (interní chyba?)", ["no_available_stats_for_country"] = "Žádné dostupné statistiky pro zemi %{country}", }, ["custom_categories"] = { ["add"] = "Add", ["add_application"] = "Přidat aplikaci", ["add_custom_app"] = "Přidat vlastní aplikaci", ["add_to_categories"] = "Přidat pravidlo hostitele", ["application_exists"] = "Aplikace \"%{app}\" již existuje!", ["application_name"] = "Název Aplikace", ["application_not_exists"] = "Aplikace \"%{app}\" neexistuje!", ["apps_and_categories"] = "Aplikace a kategorie", ["custom_host_category"] = "Vlastní pravidlo hostitele", ["custom_hosts"] = "Vlastní pravidla", ["delete_note"] = "Vlastní aplikace budou po restartu odstraněny, pokud je zadána prázdná sada pravidel.", ["domain_names_substrings"] = "Názvy domén jsou interpretovány jako podřetězce, které mají být přiřazeny.'<br>např. \"%{s1}\" bude odpovídat \"%{s2}\" a \"%{s3}\"", ["each_host_separate_line"] = "Každé pravidlo musí být umístěno na samostatném řádku", ["edit_custom_rules"] = "Upravit vlastní pravidla", ["edit_hosts"] = "Upravit Pravidla", ["example_port_range"] = "Příklady rozsahu portů: \"%{example1}\", \"%{example2}\"", ["host_domain_or_cidr"] = "Pravidla mohou být názvy domén nebo IPv4 addresses/CIDR síťové adresy", ["host_domain_or_port"] = "Pravidla mohou být názvy domén, adresy IPv4 nebo rozsahy portů TCP / UDP", ["invalid_rule"] = "Neplatné pravidlo bylo ignorováno: %{rule}", ["new_app_added"] = "Aplikace \"%{app}\" byla nakonfigurována. Prosím restartujte %{product} aby jste ji mohli začít používat.", ["option_needed"] = "Vlastní konfigurace aplikací je v současné době zakázána jako <i>%{option}</i> parametr chybí v konfiguraci. Překontrolujte <a href=\"%{url}\">dokumentaci</a> pro více detailů.", ["protos_reboot_necessary"] = "Pravidla aplikace byla napsána. Prosím restartujte %{product} aby jste je aplikovali.", ["protos_unexpected_error"] = "Neočekávaná chyba při aktualizaci pravidel aplikace. Další podrobnosti najdete v protokolu %{product}.", ["select_url_category"] = "Prosím vyberte, kam bude doména přidána:", ["similar_host_found"] = "Pravidlo podobné \"%{host}\" je již obsaženo v %{category} kategorii", ["the_following_is_a_list_of_hosts"] = "Následuje seznam vlastních pravidel pro %{category} kategorii", ["the_following_is_a_list_of_hosts_app"] = "Následuje seznam vlastních pravidel pro %{application} aplikaci", ["the_following_url_will_be_added"] = "Přidá se následující doména:", }, ["dashboard"] = { ["actual_traffic"] = "Skutečný provoz", ["lastday_app_traffic"] = "Top provoz aplikace za poslední den", ["lastday_traffic"] = "Síťová rozhraní: Zobrazení za poslední den", ["realtime_app_traffic"] = "Top přenos aplikací v reálném čase", ["realtime_traffic"] = "Síťová rozhraní: Provoz v reálném čase", ["slow_dashboard_message"] = "Příliš velká latence v %{product} odezvě. Zvažte nastavení vyšší <a href='%{url}'>obnovovací frekvence statistik v reálném čase</a>.", ["top_local_talkers"] = "Top lokální Talkers", ["top_remote_destinations"] = "Top vzdálené cíle", ["traffic_dashboard"] = "Provozní řídicí panel", }, ["db_explorer"] = { ["abort"] = "Přerušit", ["all"] = "Vše", ["app_between_talkers_pairs"] = "Aplikace mezi páry Talkers", ["app_flows_between"] = "%{app} aplikační toky mezi %{peer1} a %{peer2}", ["app_talkers"] = "%{app} talkers", ["app_talkers_with"] = "%{app} talkers s %{peer}", ["application_flows"] = "Aplikační toky", ["applications_between"] = "Aplikace mezi %{peer1} a %{peer2}", ["average_throughput"] = "Avg Thpt", ["client_server_breakdown"] = "Rozdělení provozu mezi klientem a serverem", ["client_server_host"] = "Host serveru / hostitele", ["dns_query"] = "DNS Query", ["download_flows"] = "Toky stahování", ["download_flows_limit"] = "Maximálně 1000 záznamů.", ["empty_query_response"] = "Prázdná odpověď na dotaz (database down or query killed/timed out?)", ["extract_pcap"] = "Rozbalit pcap", ["filter_bpf"] = "Filtrovat (BPF)", ["first_last_seen"] = "Prvně / Posledně Viděn", ["flow_peers"] = "Flow Peers", ["get_proto_talkers"] = "Získejte Talkers pomocí této aplikace", ["historical_data_explorer"] = "Prohlížeč historických dat", ["host_name"] = "Název hostitele", ["host_talkers"] = "%{host} talkers", ["hosts_talking_proto_with"] = "Hostitelé mluvící %{proto} s {host}", ["http_host"] = "HTTP Host", ["http_method"] = "HTTP Method", ["interface_name"] = "Název instance", ["last_hour_flows"] = "Toky viděné za poslední hodinu", ["ms_client"] = "%{client} ms (client)", ["ms_server"] = "%{server} ms (server)", ["network_latency_breakdown"] = "Rozdělení latence sítě", ["observation_period"] = "Období pozorování", ["ok_request_sent"] = "OK, žádost byla odeslána", ["packet_rate"] = "Průměrná rychlost paketu", ["pcap_requests_and_status"] = "Pcap Žádosti a statusy", ["pcaps"] = "Pcaps", ["protocol_flows_between"] = "%{proto} aplikační toky mezi %{peer1} a %{peer2}", ["protocol_id"] = "ID aplikace", ["query_in_progress"] = "Probíhá databázový dotaz, čeká se na obdržení výsledků ...", ["request_failed"] = "Požadavek selhal", ["response_code"] = "Kód odezvy", ["search_flows"] = "Vyhledat Toky", ["selected_saved"] = "Vyberte uložené", ["server_name"] = "Název serveru", ["summary"] = "Souhrn", ["talkers_with_this_host"] = "Talkers s tímto hostitelem", ["task_id"] = "Id úkolu", ["this_flow_has_been_reset"] = "Tento tok byl resetován a pravděpodobně došlo k výpadku serverové aplikace", ["this_flow_is_active"] = "Tento tok je aktivní", ["this_flow_is_completed"] = "Tento tok je dokončen a brzy vyprší", ["top_flows_ipv4"] = "Top IPv4 Flows [%{date_from} - %{date_to}]", ["top_flows_ipv6"] = "Top IPv6 Flows [%{date_from} - %{date_to}]", ["top_proto_ipv4_flows"] = "Top %{proto} IPv4 toky", ["top_proto_ipv6_flows"] = "Top %{proto} IPv6 toky", ["total_flows"] = "Celkový počet toků", ["total_packets"] = "Celkový počet paketů", ["total_traffic"] = "Celkový Počet bajtů", ["traffic_rate"] = "Průměrná míra provozu", ["traffic_received"] = "Bajty byly přijaty", ["traffic_sent"] = "Bajty byly odeslány", ["traffic_sent_to_cli"] = "Bajty odeslané klientům", ["traffic_sent_to_srv"] = "Bajty odeslané na servery", ["traffic_volume"] = "Traffic Volume", ["unable_to_find_flow"] = "Zadaný tok nelze najít", ["unsave"] = "Odstranit", ["vlan_id"] = "VLAN Id", }, ["delete_data"] = { ["delete_active_interface_confirmation"] = "Opravdu chcete odstranit všechna trvalá data spojená s %{ifname}?<br><br><b><b></b>:</b> Mazání dat bude provedeno %{product} za restart. Restartujte %{product} aby bylo vymazání účinné.", ["delete_active_interface_data_failed"] = "Nelze smazat aktivní data rozhraní.", ["delete_active_interface_data_ok"] = "Data pro %{ifname} byly úspěšně označeny k odstranění. Restartujte %{product} aby bylo vymazání účinné.", ["delete_confirmation"] = "Opravdu chcete odstranit všechna trvalá data pro %{host}?", ["delete_failed"] = "Nelze odstranit data pro %{host}.", ["delete_inactive_interfaces_confirmation"] = "Následující rozhraní jsou neaktivní: %{interfaces_list}Opravdu chcete odstranit všechna jejich trvalá data?", ["delete_inactive_interfaces_data_failed"] = "Nelze smazat neaktivní data rozhraní.", ["delete_inactive_interfaces_data_ok"] = "Data pro neaktivní rozhraní byla úspěšně smazána.", ["delete_ok"] = "Data pro %{host} byly úspěšně smazány.", ["msg_err_invalid_host"] = "Formát zadaného hostitele není rozpoznán.", ["msg_err_no_fs_data"] = "Pro zadaného hostitele nebyly nalezeny žádné trvalé údaje.", ["msg_err_unable_to_delete_dir"] = "Nelze smazat datový adresář.", ["msg_err_unable_to_delete_ts_data"] = "Data časové řady nelze smazat.", ["msg_err_unknown"] = "Nastala neznámá chyba.", ["node_nindex_flows"] = "VAROVÁNÍ: nIndex je povolen pro výpis toků, informace o historických tokech nebudou smazány.", ["note_persistent_data"] = "Všechna trvalá data jsou vymazána. Data zahrnují čítače provozu, časové úseky, toky, upozornění a Redis caches", }, ["details"] = { ["additional_mac_address"] = "Additional MAC Address", ["address_resolution_protocol"] = "Protokol pro rozlišení adres", ["ago"] = "před", ["alerts"] = "Upozornění", ["arp_replies"] = "ARP Replies", ["arp_requests"] = "ARP Requests", ["as_client"] = "Jako Klient", ["as_server"] = "Jako Server", ["device_port"] = "Port zařízení", ["device_type"] = "Typ Zařízené", ["first_last_seen"] = "Prvně / Posledně Viděn", ["first_observed_on"] = "Prvně pozorováno na", ["flow_snmp_localization"] = "Flow SNMP Localization", ["flows_dropped_by_bridge"] = "Toky blokovány z důvodu provozní politiky", ["flows_non_packet_iface"] = "Nedávno aktivní toky / Celkem / Celkem Anomální", ["flows_packet_iface"] = "Toky: Aktivní / Celkový / Low Goodput / Anomalus / Port Unreach", ["fragments"] = "Fragmenty", ["further_host_names_information"] = "Další názvy hostitele", ["goodput"] = "Goodput", ["host_pool"] = "Hostitelský fond", ["host_purged"] = "Tento host již není aktivní a měl by být vyčištěn z paměti", ["host_snmp_localization"] = "SNMP Localization", ["input_device_port"] = "Vstupní port zařízení", ["keep_alive"] = "KeepAlive", ["label_blacklisted_host"] = "Na černé listině", ["label_local_host"] = "Lokální", ["label_private_ip"] = "Soukromý", ["label_remote"] = "Vzdálený", ["label_system_ip"] = "IP Systému", ["lost"] = "Ztracen", ["misbehaving_flows_reasons"] = "Důvody neobvyklých toků", ["note"] = "POZNÁMKA", ["note_hosts_located_snmp_device"] = "Hostitelé se nacházejí v zařízeních SNMP pomocí <A HREF=%{url}>Bridge MIB</A>.", ["out_of_order"] = "Mimo provoz", ["output_device_port"] = "Výstupní port zařízení", ["peers"] = "Peers: Aktivní", ["rcvd"] = "Rcvd", ["retransmissions"] = "Retransmissions", ["router_access_point_mac_address"] = "(Směrovač / AccessPoint) MAC adresa", ["sent_vs_received_traffic_breakdown"] = "Odesláné vs Přijaté rozdělení provozu", ["show_hosts"] = "Zobrazit hostitelé", ["source"] = "Zdroj", ["source_id"] = "ID Zdroje", ["tcp_packets_sent_analysis"] = "Analýza odeslaných paketů TCP", ["total_traffic"] = "Celkový provoz", ["traffic_sent_received"] = "Provoz odeslán / přijat", ["vlan_id"] = "VLAN ID", ["whois_lookup"] = "Whois Lookup", }, ["device_protocols"] = { ["alert"] = "Spustit upozornění", ["alerts_disabled_msg"] = "Konfigurované aplikace zařízení se používají pouze ke generování výstrah aplikací zařízení, když zařízení provozuje určité aplikace, které nemá používat. Nezapomeňte povolit tato upozornění z <A HREF=\"%{url}\"><i class=\"fas fa-flask\"></i> Preferencí</A>.", ["device_protocol_policy"] = "Politika aplikace zařízení", ["device_protocols"] = "Aplikace zařízení", ["devtype_as_proto_client"] = "%{devtype} jako <i>%{proto}</i> klient", ["devtype_as_proto_server"] = "%{devtype} jako <i>%{proto}</i> server", ["filter_device_protocols"] = "%{filter} Aplikace zařízení", ["ok"] = "Přijatelný", }, ["device_types"] = { ["iot"] = "IoT", ["laptop"] = "Laptop", ["multimedia"] = "Multimédia", ["nas"] = "NAS", ["networking"] = "Router/Switch", ["phone"] = "Mobil", ["printer"] = "Tiskárna", ["tablet"] = "Tablet", ["tv"] = "TV", ["unknown"] = "Neznámý", ["video"] = "Video", ["wifi"] = "Bezdrátová Síť", ["workstation"] = "Počítač", }, ["dhcp"] = { ["delete_range"] = "Odstranit rozsah DHCP", ["delete_range_confirm"] = "Opravdu chcete smazat nakonfigurovaný rozsah DHCP %{range} ?", ["dhcp_alert_note"] = "Upozornění bude generováno, pokud je IP adresa přiřazena mimo nakonfigurované rozsahy DHCP.", ["dhcp_configuration_note"] = "Na této stránce jsou uvedeny konfigurované rozsahy DHCP pro toto rozhraní. Ty by se měly shodovat se skutečnou používanou konfigurací serveru DHCP", ["invalid_ip_address"] = "Neplatná adresa IP", ["no_dhcp_ranges"] = "Nejsou nakonfigurovány žádné rozsahy DHCP.", }, ["discover"] = { ["device"] = "Zařízení", ["discovered_devices"] = "Objevil %{manuf} %{sys} %{dev} zařízení", ["err_unable_to_arp_discovery"] = "Nelze spustit vyhledávání sítě ARPN", ["error_no_discovery_cached"] = "Zatím nebyla uložena žádná data zjišťování.", ["error_unable_to_decode_json"] = "Nelze dekódovat mezipaměť JSON discovery data.", ["ghost_icon_descr"] = "%{ghost_icon}ikona upozorňuje na Ghost Hosts (tj. nepatří do sítě IP adres rozhraní)", ["network_discovery"] = "Vyhledávání Sítě", ["network_discovery_datetime"] = "Poslední Vyhlédávání Sítě", ["network_discovery_not_enabled"] = "Probíhá vyhledávání sítě", }, ["dns_page"] = { ["dns_breakdown"] = "DNS Breakdown", ["dns_query_sent_distribution"] = "DNS Query Sent Distribution", ["error_replies"] = "Odpovědi na chyby", ["note"] = "POZNÁMKA", ["note_dns_ratio"] = "V ideálním případě by poměr DNS mezi žádostí a odpovědí měl být 1 (jedna odpověď na žádost). Pokud jsou mnohem nižší, pak stojí za to prozkoumat problémy, protože to znamená, že počet obdržených odpovědí je mnohem nižší, než se očekávalo, a to může znamenat, že používáme neodpovídající DNS překládače nebo že jsou nesprávně nakonfigurováni (např. Byly přesunuty do další IP).", ["positive_replies"] = "Pozitivní odpovědi", ["queries"] = "Dotazy", ["ratio"] = "Poměr", ["rcvd"] = "Rcvd", ["replies"] = "Odpovědi", ["reply_breakdown"] = "Reply Breakdown", ["request_vs_reply"] = "Žádost vs Odpověď Pom", }, ["entity_thresholds"] = { ["flow_attacker_description"] = "Spustit upozornění, když nový klient překročí prahovou hodnotu toků/s prahovou hodnotu", ["flow_attacker_title"] = "Flow Flood Attacker Alert", ["flow_victim_description"] = "Spustit upozornění, když nový server překročí prahovou hodnotu toků/s překročí", ["flow_victim_title"] = "Flow Flood Victim Alert", ["request_reply_ratio_description"] = "Spustit výstrahu, když počet odpovědí vs. požadavků (v různých aplikacích) překročí prahovou hodnotu", ["request_reply_ratio_title"] = "Poměr odpovědí / požadavků", ["syn_attacker_description"] = "Spustit výstrahu, když počet odeslaných SYN/s překročí prahovou hodnotu", ["syn_attacker_title"] = "SYN Flood Attacker Alert", ["syn_scan_attacker_description"] = "Spustit upozornění, když počet odeslaných SYN/min (bez odpovědi) překročí prahovou hodnotu", ["syn_scan_attacker_title"] = "SYN Scan Attacker Alert", ["syn_scan_victim_description"] = "Spustit upozornění, když počet přijatých SYN/min (bez odpovědi) překročí prahovou hodnotu", ["syn_scan_victim_title"] = "SYN Scan Victim Alert", ["syn_victim_description"] = "Spustit upozornění, když počet přijatých SYN / s překročí prahovou hodnotu", ["syn_victim_title"] = "SYN Flood Victim Alert", }, ["event_probes"] = { ["event_device_x"] = "Event Probe %{device}", ["event_probe_ip"] = "Event Probe IP", ["event_probes"] = "Event Probes", }, ["export_data"] = { ["export_json_data"] = "Export JSON Data", ["note_active_hosts"] = "Vrací se pouze aktivní hostitel=.", ["note_maximum_number"] = "Maximální počet hostitelů ke stažení je 32 768.", }, ["external_stats"] = { ["capture_drops"] = "Dropped Packets", ["capture_packets"] = "Captured Packets", ["signatures_failed"] = "Signatures Failed", ["signatures_loaded"] = "Signatures Loaded", ["suricata_statistics"] = "Statistiky Suricata", ["title"] = "Externí statistika", }, ["field_units"] = { ["bytes"] = "Bajty", ["flow_sec"] = "Toků/s", ["flows"] = "Toků", ["hosts"] = "hostitelé", ["mbits"] = "Mbps", ["packets"] = "pakety", ["percentage"] = "%%", ["seconds"] = "sekundy", ["syn_min"] = "SYNs/min", ["syn_sec"] = "SYNs/s", }, ["flow_alerts_explorer"] = { ["by_target_port"] = "Podle cílového portu", ["flow_alert_origin"] = "Původ upozorněné", ["flow_alert_target"] = "Cíl upozornění", ["label"] = "Průzkumník upozornění toku", ["origins"] = "Původy", ["search"] = "Vyhledávání výstrahy toku", ["summary_cli2srv"] = "Celkový původ do cílového provozu", ["summary_n_origins"] = "Celkový původ", ["summary_n_targets"] = "Celkové cíle", ["summary_srv2cli"] = "Celkový cíl na původní provoz", ["summary_total"] = "Upozornění na celkový průtok", ["targets"] = "Cíle", ["type_alerts_by_type"] = "Upozornění toku podle typu", ["type_explorer"] = "Zadejte Průzkumník", ["visual_explorer"] = "Visual Explorer", }, ["flow_checks"] = { ["application_detected"] = "Aplikace byla detekována", ["callback"] = "Flow Callback", ["callback_config"] = "Konfigurace", ["callback_elapsed_time"] = "Execution Time", ["callback_elapsed_time_avg"] = "Průtok/s", ["callback_enabled"] = "Povoleno", ["callback_function"] = "Funkce", ["callback_function_duration"] = "Doba trvání", ["callback_function_duration_fmt_long"] = "%{num_calls} volá %{time} [%{speed} Hovorů/s]", ["callback_function_duration_fmt_short"] = "%{time}", ["callback_function_duration_simple_view"] = "Latest Run", ["callback_function_num_flows"] = "Toky", ["callback_function_throughput"] = "Rychlost zpracování", ["callback_latest_run"] = "Latest Run", ["idle"] = "Nečinný", ["no_callbacks_defined"] = "Nebyla nalezena žádná zpětná volání", ["note_add_custom_scripts"] = "%{product} hledá v nich vlastní skripty <a href=\"%{url}\"> <i class=\"fas fa-folder\"></i> adresáře</a>.", ["note_create_custom_scripts"] = "Dokumentace k vytvoření vlastních skriptů pro provádění zpětných volání je k dispozici zde <a class='ntopng-external-link' href=\"%{url}\">link <i class=\"fas fa-external-link-alt\"></i></a>.", ["note_flow_application_detected"] = "\"Application Detected\" zpětná volání jsou prováděna ihned po detekci aplikace. K tomu dochází v prvních 12 paketech toku pro rozhraní paketů nebo bezprostředně po přijetí toku pro rozhraní ZMQ.", ["note_flow_idle"] = "\"Nečinnný\" zpětná volání jsou prováděna, když tok ukončil svou činnost a je nečinný.", ["note_flow_lifecycle"] = "Zpětná volání jsou prováděna v určitých okamžicích životního cyklu toku.", ["note_flow_periodic_update"] = "\"Periodická aktualizace\" zpětná volání jsou prováděna pravidelně poté, co byl tok aktivní déle než pět minut.", ["note_flow_staus_changed"] = "\"Stav změněn\" zpětná volání jsou prováděna pokaždé, když dojde ke změně stavu v toku. Například když se objeví problémy s připojením, jako jsou opakované přenosy.", ["notes"] = "POZNÁMKY", ["periodic_update"] = "Pravidelná aktualizace", ["status_changed"] = "Stav změněn", }, ["flow_checks_config"] = { ["blacklisted"] = "Tok na černé listině", ["blacklisted_description"] = "Pokud je na seznamu zakázaných alespoň jeden mezi klientem a serverem, aktivujte upozornění", ["no_input"] = "Není nutná žádná konfigurace", ["score"] = "Skóre toku", ["suspicious_countries"] = "Podezřelé země / Státy", ["suspicious_countries_description"] = "Spustit upozornění, když alespoň jeden z klientů a serverů je z podezřelé země", ["udp_unidirectional"] = "Jednosměrný tok UDP", ["udp_unidirectional_description"] = "Spustit výstrahu, když je detekován jednosměrný tok UDP", }, ["flow_details"] = { ["acceptable_label"] = "Přijatelný", ["actual_peak_throughput"] = "Skutečná / maximální propustnost", ["additional_alert_type"] = "Další stav toku", ["additional_flow_elements"] = "Další prvky toku", ["alert_type"] = "Stav toku", ["application_latency"] = "Latence aplikace", ["average_cpu_load"] = "Průměrné zatížení CPU", ["bittorrent_hash"] = "BitTorrent hash", ["blacklisted_flow"] = "Klient, server nebo doména jsou na černé listině", ["blacklisted_flow_detailed"] = "Černá listina %{who}", ["c_ip_addresses"] = "C IP Addresses", ["call_canceled"] = "Hovor byl zrušen", ["call_completed"] = "Hovor byl dokončen", ["call_error"] = "Chyba volání", ["call_id"] = "Call-ID", ["call_initiator"] = "Zavolejte Iniciátor", ["call_quality_indicators"] = "Indikátory kvality hovorů", ["call_started"] = "Hovor byl zahájen", ["call_state"] = "Call State", ["called_party"] = "Called Party", ["cancel_bye_failure_reason_cause"] = "Cancel/Bye/Failure Reason Cause", ["certificates_not_match"] = "Certifikáty se neshodují", ["client_container_information"] = "Client Container Information", ["client_process_information"] = "Informace o procesu klienta", ["client_requested"] = "Vyžádán klient", ["computed_as_tcp_window_size_rtt"] = "Computed as TCP Window Size / RTT", ["container_id"] = "Container ID", ["could_not_add_host_to_category"] = "Nepodařilo se přidat hostitele \"%{host}\" do \"%{category}\".", ["data_exfiltration"] = "Exfiltrace dat", ["desirable_label"] = "Žádoucí", ["dns_invalid_query"] = "Neplatný dotaz DNS", ["dns_query"] = "Dotaz DNS", ["docker"] = "Dotaz DNS", ["docker_name"] = "Název", ["drop_flow_traffic_btn"] = "Drop Flow Traffic", ["dropped_packets"] = "Dropped Packets", ["dtmf_tones_sent"] = "Tóny DTMF odeslané během hovoru", ["dump_flow_traffic"] = "Dump Flow Traffic", ["elephant_exceeded"] = "Překračuje %{vol}", ["elephant_flow"] = "Elephant Flow", ["elephant_flow_descr"] = "Elephant toky, které přenášejí více než určité nakonfigurované množství dat. Správci mohou nakonfigurovat toky Elephant z předvoleb.", ["elephant_flow_l2r"] = "Elephant Flow (Lokální do vzdálených)", ["elephant_flow_r2l"] = "Elephant Flow (Vzdálené do lokálních)", ["existing_rules_note"] = "Stávající pravidla lze nalézt na <a href=\"%{url}\">%{name}</a> stránce.", ["external_alert"] = "Detekováno %{scope} upozornění: %{msg} [%{maker}]", ["first_last_flow_sequence"] = "První / poslední sekvence toku", ["flow_active_msg"] = "Tok je aktivní.", ["flow_alerted"] = "Tok byl upozorněn", ["flow_blocked_by_bridge"] = "Tok byl blokován kvůli nakonfigurovaným politikám", ["flow_cannot_be_found_message"] = "Tento tok nelze nalézt.", ["flow_completed_msg"] = "Tok je uzavřen.", ["flow_connecting_msg"] = "Tok se připojuje.", ["flow_details"] = "Podrobnosti o toku", ["flow_emitted"] = "Tok byl emitován, když bylo upozorněno síťové rozhraní", ["flow_marker"] = "Značka toku", ["flow_peer_roles_inaccurate_msg"] = "Tok je aktivní, ale začátek toku nebyl viděn a peer roles (klient / server) mohou být nepřesné.", ["flow_peers_client_server"] = "Flow Peers [Klient / Server]", ["flow_quota"] = "Kvóta toku", ["flow_reset_by_resetter_msg"] = "Resetování toku pomocí %{resetter}.", ["flow_reset_msg"] = "Tento tok byl resetován", ["flow_score"] = "Skóre toku", ["flow_shapers"] = "Flow Shapers", ["flow_traffic_is_dropped"] = "Tok provozu je přerušen", ["forward"] = "Vpřed", ["gsm_cell_identifier"] = "GSM Cell Identifier", ["gsm_cell_lac"] = "GSM Cell LAC (Location Area Code)", ["host_successfully_added_to_category"] = "Host \"%{host}\" úspěšně přidán do <a href=\"%{url}\">%{category}</a> kategorie. Pravidlo bude mít vliv pouze na nové toky.", ["http_method"] = "HTTP Method", ["icmp_info"] = "ICMP Info", ["ids_alert"] = "Detekováno %{scope} upozornění: %{msg} [%{maker}]", ["imsi"] = "IMSI (International mobile Subscriber Identity)", ["io_wait_time_percentage"] = "Procento čekací doby I / O", ["ip_packet_analysis"] = "Analýza paketů IP", ["jitter"] = "Jitter", ["k8s"] = "Kubernetes", ["k8s_name"] = "Název", ["k8s_ns"] = "Namespace", ["k8s_pod"] = "Pod", ["longlived_exceeded"] = "Překračuje %{amount}", ["longlived_flow"] = "Dlouhoživotní tok", ["longlived_flow_descr"] = "Dlouhoživvotné toky jsou takové, které vydrží více než určité nakonfigurované množství času. Správci mohou nakonfigurovat toky Elephant z předvoleb.", ["looks_like_idle_flow_message"] = "Vypadá to jako<font color=red>nečinný tok</font> s periodickými přenosy, jen aby to zůstalo naživu.", ["lost_packets"] = "Ztracené pakety", ["low_goodput"] = "\9Low Goodput", ["malicious_ja3_signature"] = "Možná škodlivé %{cli_or_srv} Signature [JA3: <a href=\"%{url}\">%{signature}</a> %{icon}]", ["max_estimated_tcp_throughput"] = "Maximální (odhadovaná) propustnost TCP", ["max_packet_interarrival_time"] = "Maximální doba vzájemného příjmu paketů", ["memory_actual_peak"] = "Aktuální paměť / vrchol", ["mibehaving_flows"] = "Nesprávné toky", ["normal"] = "Normalní", ["not_recommended_label"] = "Nedoporučeno", ["now_purged"] = "Tento tok již není aktivní a měl by být vyčištěn z paměti.", ["nsapi"] = "NSAPI", ["ongoing_call"] = "Probíhající hovor", ["packet_inter_arrival_time"] = "Čas mezi příletem paketu <br>[ Minimum / Průměr / Maximální ]", ["payload_type"] = "Typ užitečného zatížení", ["potentially_dangerous_protocol"] = "Potenciálně nebezpečný protokol", ["process_information_report_warning"] = "Zpráva s informacemi o procesu je omezená, pokud nepoužíváte ntopng <A HREF='%{url}'>nProbe</A> a sprobe plugin", ["process_pid_name"] = "Process PID/Name", ["profile_name"] = "Jméno profilu", ["pseudo_mos"] = "(Pseudo) MOS", ["r_factor"] = "R-Factor", ["reach_connection_label"] = "Dosah připojení", ["remote_to_remote"] = "Vzdálený klient a vzdálený server", ["response_code"] = "Kód odezvy", ["reverse"] = "Obrátit", ["round_trip_time"] = "Doba zpáteční cesty", ["rtp_codecs"] = "RTP Codecs", ["rtp_flow"] = "RTP Flow", ["rtp_protocol_information"] = "RTP Protocol Information", ["rtp_stream_peers"] = "RTP Stream Peers", ["rtp_transit_in_out"] = "RTP Transit IN / OUT", ["rtt_breakdown"] = "Rozpis doby zpáteční cesty", ["rtt_distance"] = "Odhadovaná vzdálenost klient / server", ["rule_type"] = "Typ pravidla", ["sac_service_area_code"] = "SAC (Service Area Code)", ["server_certificate"] = "Cetifikát serveru", ["server_container_information"] = "Informace o Container serveru", ["server_name"] = "Název serveru", ["server_process_information"] = "Informace o procesu serveru", ["sip_call_id"] = "SIP Call-ID", ["sip_protocol_information"] = "Informace o protokolu SIP", ["slow_application_header"] = "Slow Application Header", ["slow_data_exchange"] = "Pomalá výměna dat", ["slow_tcp_connection"] = "Pomalé připojení TCP", ["son_of_father_process"] = "syn od <a href ='%{url}'>%{proc_father_name} [pid: %{proc_father_pid}]</a>", ["ssh_signature"] = "SSH Signature", ["suspicious_client_device_protocol"] = "Klientská aplikace \"%{proto}\" není konfigurovaným povolena <a href=\"%{url}\">%{devtype} aplikační politikou</a>", ["suspicious_device_protocol"] = "Protokol podezřelého zařízení", ["suspicious_server_device_protocol"] = "Serverová aplikace \"%{proto}\"není konfigurovaným povolena <a href=\"%{url}\">%{devtype} aplikační politiku</a>", ["suspicious_tcp_probing"] = "Podezřelá sonda TCP", ["suspicious_tcp_syn_probing"] = "Podezřelá sonda TCP SYN", ["sync_source_id"] = "Sync Source ID", ["tcp_connection_issues"] = "Problémy s připojením TCP (Opakovaný přenos, OOO, Ztraceno)", ["tcp_connection_refused"] = "TCP spojení odmítnuto", ["tcp_packet_analysis"] = "Analýza paketů TCP", ["tcp_severe_connection_issues"] = "Závažné problémy s připojením TCP (Opakovaný přenos, OOO, Ztraceno)", ["throughput_trend"] = "Trend propustnosti", ["tls_certificate"] = "TLS Certificate", ["tls_certificate_mismatch"] = "Neshoda certifikátu TLS", ["tls_client_certificate"] = "Klientský certifikát", ["tls_old_protocol_version"] = "Zastaralá verze protokolu TLS", ["tls_server_certificate"] = "Certifikát serveru", ["tls_unsafe_ciphers"] = "Nebezpečné šifrovače TLS", ["udp_unidirectional"] = "Jednosměrný provoz UDP", ["unknown_status"] = "Neznámý stav (%{status})", ["url"] = "URL", ["user_name"] = "Uživatelské jméno", ["vm_page_faults"] = "VM Page Faults", ["web_mining_detected"] = "Web je známý pro těžbu kryptoměn na klientských zařízeních", }, ["flow_devices"] = { ["active_sflow"] = "Aktivní sFlow zařízení", ["all_device_ports"] = "Všechny %{device} porty", ["all_flow_devices"] = "Všechna toková zařízení", ["all_sflow_devices"] = "Všechna zařízení sFlow", ["duplex"] = "Duplex", ["probe_ip"] = "Probe IP", ["probes"] = "Probes", ["flow_device_x"] = "Tokové zařízení %{device}", ["probe_devices"] = "Zařízení pro exportér toku", ["full_duplex"] = "Full-Duplex", ["half_duplex"] = "Half-Duplex", ["in_errors"] = "V chybách", ["note_condition_1"] = "Zařízení %{device} musí podporovat SNMP a musí být nakonfigurováno v <a href=\"%{url}\">SNMP</a> stránce zařízení", ["note_condition_2"] = "Časové časy SNMP a tokových zařízení musí být povoleny od <A HREF=\"%{url}\"><i class=\"fas fa-flask\"></i> Preferences</A> (Expert View)", ["note_zmq_fields1"] = "Toková zařízení jsou určena pomocí ZMQ polí %%EXPORTER_IPV4_ADDRESS and %%NPROBE_IPV4_ADDRESS. Pokud jsou k dispozici obě pole, první má přednost před druhým.", ["note_zmq_fields2"] = "Rozhraní průtokových zařízení jsou určena pomocí ZMQ polí %%INPUT_SNMP and %%OUTPUT_SNMP", ["note_zmq_fields3"] = "sFlow zařízení jsou určena pomocí sFlow field deviceIP přijatých přes ZMQ (téma 'counter')", ["note_zmq_fields4"] = "Rozhraní zařízení sFlow jsou určena pomocí pole ifIndex přijatého přes ZMQ (téma 'counter')", ["out_errors"] = "Chyby", ["promisc"] = "Promisc", ["sflow_device_x"] = "sFlow Probe %{device}", ["sflow_snmp_ratio"] = "Počítadla / poměr SNMP", ["sflow_snmp_ratio_descr"] = "Poměr čítačů / SNMP se vypočítá vydělením celkového provozu rozhraní získaného pomocí vzorků čítačů sFlow a celkového provozu stejného rozhraní načteného prostřednictvím SNMP.", ["snmp_description"] = "SNMP Description", ["snmp_devmodel"] = "SNMP Device Model", ["snmp_devname"] = "SNMP Device Name", ["snmp_location"] = "SNMP Location", ["snmp_ratio"] = "Flow/SNMP Ratio", ["snmp_ratio_descr"] = "Poměr toku / SNMP se vypočítá dělením celkového provozu rozhraní získaného pomocí toků celkovým provozem stejného rozhraní načteného prostřednictvím SNMP. Protože v analýze založené na průtoku nejsou účtovány záhlaví non-IP a vrstvy 2, <br> typické hodnoty poměrů jsou v rozsahu 0,8, 0,0,9 (tj. 0,9 znamená, že bylo hlášeno 90 %% přijatého provozu pozorovaného prostřednictvím protokolu SNMP) v tokech). <br> Poměr se počítá každou hodinu, pouze pokud jsou splněny následující podmínky", ["this_page_contains_couters"] = "Tato stránka obsahuje čítače rozhraní, které byly získány pomocí sFlow. Pokud je nakonfigurován SNMP, můžete také vidět <A HREF=\"%{url}\">zobrazení SNMP</A> tohoto zařízení", ["timeseries_descr"] = "Časové toky zařízení toku lze aktivovat z <a href=\"%{url}\"><i class=\"fas fa-flask\"></i> Preference</a>.K zobrazení prvních datových bodů je třeba jen pár minut", }, ["flow_fields_description"] = { ["appl_latency_ms"] = "Latence aplikace (msec), a.k.a. doba odezvy serveru", ["application_id"] = "ID shromážděné aplikace (Cisco nebo IXIA)", ["application_name"] = "Palo Alto App-Id", ["biflow_direction"] = "1=initiator, 2=reverseInitiator", ["bittorrent_hash"] = "BITTORRENT hash", ["client_nw_latency_ms"] = "Network RTT/2 client <-> nprobe (msec)", ["community_id"] = "ID komunity", ["cumulative_icmp_type"] = "Kumulativní NEBO paketů typu ICMP", ["dhcp_client_ip"] = "Adresa IPv4 klienta DHCP", ["dhcp_client_mac"] = "MAC klienta DHCP", ["dhcp_client_name"] = "Název klienta DHCP", ["dhcp_message_type"] = "Typ zprávy DHCP", ["dhcp_remote_id"] = "ID vzdáleného agenta DHCP", ["dhcp_subscriber_id"] = "ID předplatitele DHCP", ["diameter_clr_cancel_type"] = "DIAMETER Cancellation Type", ["diameter_clr_flags"] = "DIAMETER CLR Flags", ["diameter_exp_res_result_code"] = "DIAMETER Response Experimental Result Code", ["diameter_exp_res_vendor_id"] = "Kód experimentu výsledku experimentu DIAMETER", ["diameter_hop_by_hop_id"] = "DIAMETER Hop by Hop Identifier", ["diameter_req_msg_type"] = "DIAMETER Typ požadavku Msg", ["diameter_req_origin_host"] = "DIAMETER Žádost o host původu", ["diameter_req_user_name"] = "DIAMETER Vyžádat uživatelské jméno", ["diameter_rsp_msg_type"] = "Typ odpovědi na zprávu DIAMETER", ["diameter_rsp_origin_host"] = "DIAMETER Původ Host odpověď", ["diameter_rsp_result_code"] = "Kód výsledku odpovědi DIAMETER", ["direction"] = "Směr toku [0=src->dst, 1=dst->src]", ["dns_num_answers"] = "DNS#počet vrácených odpovědí", ["dns_query"] = "DNS dotaz", ["dns_query_id"] = "ID transakce dotazů DNS", ["dns_query_type"] = "Typ dotazu DNS (např. 1 = A, 2 = NS ..)", ["dns_response"] = "Odpovědi (s) DNS “", ["dns_ret_code"] = "Návratový kód DNS (např. 0 = žádná chyba)", ["dns_ttl_answer"] = "TTL prvního záznamu A (pokud existuje)", ["dns_tx_id"] = "DNS Transaction ID", ["dot1q_dst_vlan"] = "Cílová VLAN (vnější VLAN v QinQ)", ["dot1q_src_vlan"] = "Zdroj VLAN (vnější VLAN v QinQ)", ["downstream_session_id"] = "Identifikátor následné relace (např. L2TP) nebo 0, pokud není znám", ["downstream_tunnel_id"] = "Identifikátor downstream tunelu (např. GTP TEID, VXLAN VNI) nebo 0, pokud není znám", ["dst_as"] = "Cílová BGP AS", ["dst_as_map"] = "Název organizace pro DST_AS", ["dst_as_path_1"] = "Dest AS path position 1", ["dst_as_path_10"] = "Dest AS path position 10", ["dst_as_path_2"] = "Dest AS path position 2", ["dst_as_path_3"] = "Dest AS path position 3", ["dst_as_path_4"] = "Dest AS path position 4", ["dst_as_path_5"] = "Dest AS path position 5", ["dst_as_path_6"] = "Dest AS path position 6", ["dst_as_path_7"] = "Dest AS path position 7", ["dst_as_path_8"] = "Dest AS path position 8", ["dst_as_path_9"] = "Dest AS path position 9", ["dst_father_proc_name"] = "Dst father process name", ["dst_father_proc_pid"] = "Dst father process PID", ["dst_fragments"] = "Num fragmentované pakety dst-> src", ["dst_ip_city"] = "Město, kde se nachází IP adresa dst", ["dst_ip_country"] = "Země / Stát, kde se nachází IP adresa dst", ["dst_ip_lat"] = "Zeměpisná šířka, kde se nachází IP adresa dst", ["dst_ip_long"] = "Zeměpisná délka, kde se nachází IP adresa dst", ["dst_proc_actual_memory"] = "Dst zpracovává skutečnou paměť (bajty)", ["dst_proc_average_cpu_load"] = "Průměrné zatížení procesu Dst (%% * 100)", ["dst_proc_name"] = "Název procesu DST", ["dst_proc_num_page_faults"] = "Dst process num pagefaults", ["dst_proc_pctg_iowait"] = "Src process iowait time %% (%% * 100)", ["dst_proc_peak_memory"] = "Top paměť procesu Dst (bajty)", ["dst_proc_pid"] = "Dst process PID", ["dst_proc_uid"] = "Dst process UID", ["dst_proc_user_name"] = "Uživatelské jméno procesu DST", ["dst_to_src_avg_throughput"] = "Dst to src average thpt (bps)", ["dst_to_src_max_throughput"] = "Dst to src max thpt (bps)", ["dst_to_src_min_throughput"] = "Dst to src min thpt (bps)", ["dst_tos"] = "TOS/DSCP (dst->src)", ["dst_vlan"] = "Cílová VLAN (vnitřní VLAN v QinQ)", ["duration_in"] = "Trvání proudu mezi klientem a serverem (msec)", ["duration_out"] = "Trvání proudu mezi klientem a serverem (msec)", ["engine_id"] = "Id engine s přepínáním průtoku", ["engine_type"] = "Proudový spínací engine", ["probe_ipv4_address"] = "Probe IPv4 Address", ["probe_ipv6_address"] = "Probe IPv6 Address", ["file_gaps"] = "Mezery v souborech", ["file_name"] = "Název souboru", ["file_size"] = "Velikost souboru", ["file_state"] = "Stav souboru", ["file_stored"] = "Soubor byl uložen", ["firewall_event"] = "Firewall Event 0 = ignorovat, 1 = vytvořený tok, 2 = tok vymazán, 3 = tok odmítnut, 4 = upozornění na tok, 5 = aktualizace toku", ["first_switched"] = "SysUptime (msec) prvního toku pkt", ["flow_active_timeout"] = "Časový limit aktivity položek vyrovnávací paměti toku", ["flow_duration_microseconds"] = "Trvání toku (usec)", ["flow_duration_milliseconds"] = "Trvání toku (msec)", ["flow_end_microseconds"] = "uSec (epocha) prvního toku paketu", ["flow_end_milliseconds"] = "Msec (epocha) posledního toku paketu", ["flow_end_reason"] = "Důvod ukončení toku", ["flow_end_sec"] = "Sekundy (epocha) posledního toku paketu", ["flow_id"] = "Identifikátor sériového toku", ["flow_inactive_timeout"] = "Časový limit nečinnosti položek mezipaměti toku", ["flow_proto_port"] = "Port L7, který identifikuje aplikaci toku, nebo 0, pokud není znám", ["flow_server_name"] = "Název serveru toku (pokud je znám)", ["flow_start_microseconds"] = "uSec (epocha) prvního toku paketu", ["flow_start_milliseconds"] = "Msec (epocha) prvního toku paketu", ["flow_start_sec"] = "Sekundy (epocha) prvního toku paketu", ["flow_user_name"] = "Uživatelské jméno toku tunelu (pokud je znám)", ["frame_length"] = "Původní délka framu L2", ["ftp_command"] = "Příkaz FTP klienta", ["ftp_command_ret_code"] = "Návratový kód příkazu FTP klienta", ["ftp_login"] = "Přihlášení klienta FTP", ["ftp_password"] = "Heslo klienta FTP", ["gtpv0_apn_name"] = "GTPv0 APN Name", ["gtpv0_end_user_ip"] = "IP adresa koncového uživatele GTPv0", ["gtpv0_end_user_msisdn"] = "Koncový uživatel GTPv0 MSISDN", ["gtpv0_rai_cell_lac"] = "GTPv0 Kód umístění buňky", ["gtpv0_rai_cell_rac"] = "Kód oblasti směrování buněk GTPv0", ["gtpv0_rai_mcc"] = "Mobilní kód země GTPv0", ["gtpv0_rai_mnc"] = "GTPv0 kód mobilní sítě", ["gtpv0_req_msg_type"] = "Typ požadavku zprávy GTPv0", ["gtpv0_response_cause"] = "GTPv0 Příčina operace", ["gtpv0_rsp_msg_type"] = "Typ zprávy GTPv0 s odpovědí", ["gtpv0_tid"] = "Identifikátor tunelu GTPv0", ["gtpv1_apn_name"] = "GTPv1 APN Name", ["gtpv1_c2s_teid_ctrl"] = "Klient GTPv1-> Řízení serveru TunnelId", ["gtpv1_c2s_teid_data"] = "Klient GTPv1-> Data serveru TunnelId", ["gtpv1_end_user_imei"] = "IMEI koncového uživatele GTPv1", ["gtpv1_end_user_imsi"] = "IMSI koncového uživatele GTPv1", ["gtpv1_end_user_ip"] = "IP adresa koncového uživatele GTPv1", ["gtpv1_end_user_msisdn"] = "Koncový uživatel GTPv1 MSISDN", ["gtpv1_rai_lac"] = "Kód oblasti umístění GTPv1 RAI", ["gtpv1_rai_mcc"] = "Mobilní kód země GTPv1 RAI", ["gtpv1_rai_mnc"] = "Kód mobilní sítě GTPv1 RAI", ["gtpv1_rai_rac"] = "Směrovací oblast GTPv1 RAI", ["gtpv1_rat_type"] = "Typ GTPv1 RAT", ["gtpv1_req_msg_type"] = "Typ požadavku GTPv1", ["gtpv1_response_cause"] = "GTPv1 Příčina operace", ["gtpv1_rsp_msg_type"] = "Typ požadavku GTPv1", ["gtpv1_s2c_teid_ctrl"] = "GTPv1 Server-> Řízení klientských tunelů", ["gtpv1_s2c_teid_data"] = "GTPv1 Server-> Data klienta TunnelId", ["gtpv1_uli_cell_ci"] = "GTPv1 ULI Cell CI", ["gtpv1_uli_cell_lac"] = "Kód oblasti umístění buňky ULI GTPv1", ["gtpv1_uli_mcc"] = "GTPv1 ULI mobilní kód země", ["gtpv1_uli_mnc"] = "Kód mobilní sítě ULI GTPv1", ["gtpv1_uli_sac"] = "GTPv1 ULI SAC", ["gtpv2_apn_name"] = "GTPv2 APN Name", ["gtpv2_c2s_s1u_gtpu_ip"] = "Klient GTPv2-> Svr S1U GTPU IP", ["gtpv2_c2s_s1u_gtpu_teid"] = "Klient GTPv2-> Svr S1U GTPU TEID", ["gtpv2_c2s_s5_s8_gtpc_ip"] = "Klient GTPv2-> Svr S5 / S8 GTPC IP", ["gtpv2_c2s_s5_s8_gtpu_ip"] = "Klient GTPv2-> Srv S5 / S8 PGW GTPU IP", ["gtpv2_c2s_s5_s8_gtpu_teid"] = "Klient GTPv2-> Srv S5 / S8 PGW GTPU TEID", ["gtpv2_c2s_s5_s8_sgw_gtpu_ip"] = "Klient GTPv2-> Srv S5 / S8 SGW GTPU IP", ["gtpv2_c2s_s5_s8_sgw_gtpu_teid"] = "Klient GTPv2-> Srv S5 / S8 SGW GTPU TEID", ["gtpv2_end_user_imei"] = "IMEI koncového uživatele GTPv2", ["gtpv2_end_user_imsi"] = "IMSI koncového uživatele GTPv2", ["gtpv2_end_user_msisdn"] = "Koncový uživatel GTPv2 MSISDN", ["gtpv2_pdn_ip"] = "IP adresa GTPV2 PDN", ["gtpv2_rat_type"] = "GTPv2 RAT Type", ["gtpv2_req_msg_type"] = "Typ zprávy GTPv2", ["gtpv2_response_cause"] = "Příčina operace GTPv2", ["gtpv2_rsp_msg_type"] = "Typ požadavku GTPv2", ["gtpv2_s2c_s1u_gtpu_ip"] = "GTPv2 Srv-> Klient S1U GTPU IP", ["gtpv2_s2c_s1u_gtpu_teid"] = "GTPv2 Srv-> Klient S1U GTPU TEID", ["gtpv2_s2c_s5_s8_gtpc_ip"] = "GTPv2 Svr-> Klient S5 / S8 GTPC IP", ["gtpv2_s2c_s5_s8_gtpu_ip"] = "GTPv2 Srv-> Klient S5 / S8 PGW GTPU IP", ["gtpv2_s2c_s5_s8_gtpu_teid"] = "GTPv2 Srv-> Klient S5 / S8 PGW GTPU TEID", ["gtpv2_s2c_s5_s8_sgw_gtpu_ip"] = "GTPv2 Srv-> Klient S5 / S8 SGW GTPU IP", ["gtpv2_s2c_s5_s8_sgw_gtpu_teid"] = "GTPv2 Srv-> Klient S5 / S8 SGW GTPU TEID", ["gtpv2_s5_s8_gtpc_teid"] = "GTPv2 S5/S8 SGW GTPC TEIDs", ["gtpv2_uli_cell_id"] = "Identifikátor buňky GTPv2", ["gtpv2_uli_cell_tac"] = "Kód oblasti sledování GTPv2", ["gtpv2_uli_mcc"] = "Mobilní kód země GTPv2", ["gtpv2_uli_mnc"] = "Kód mobilní sítě GTPv2", ["http_host"] = "Název hostitele HTTP (název hostitele IXIA)", ["http_length"] = "Délka obsahu HTTP", ["http_method"] = "METODA HTTP", ["http_mime"] = "HTTP Mime Type", ["http_protocol"] = "Protokol HTTP", ["http_referer"] = "HTTP Referer", ["http_ret_code"] = "Návratový kód HTTP (např. 200, 304 ...)", ["http_site"] = "HTTP server bez názvu hostitele", ["http_ua"] = "HTTP User Agent", ["http_url"] = "HTTP URL (IXIA URI)", ["http_via"] = "HTTP přes", ["http_x_forwarded_for"] = "HTTP X-Forwarded-For", ["icmp_ipv4_code"] = "Kód ICMP", ["icmp_ipv4_type"] = "Typ ICMP", ["icmp_type"] = "Typ ICMP * 256 + kód ICMP", ["imap_login"] = "Odesílatel pošty", ["in_bytes"] = "Příchozí tokové bajty (src-> dst)", ["in_dst_mac"] = "Cílová adresa MAC", ["in_pkts"] = "Pakety příchozího toku (src-> dst)", ["in_src_mac"] = "Zdrojová adresa MAC", ["in_src_osi_sap"] = "Zdroj OSI SAP (pouze provoz OSI)", ["ingress_vrfid"] = "Ingress VRF ID", ["input_snmp"] = "Vstupní rozhraní SNMP idx", ["ip_protocol_version"] = "[4=IPv4][6=IPv6]", ["ipfix_sampling_algorithm"] = "Algoritmus vzorkování", ["ipv4_dst_addr"] = "Cílová adresa IPv4", ["ipv4_dst_mask"] = "Maska podsítě IPv4 dest (/ <bits>)", ["ipv4_next_hop"] = "IPv4 next hop address", ["ipv4_src_addr"] = "Zdrojová Adresa IPv4", ["ipv4_src_mask"] = "Maska podsítě zdroje IPv4 (/ <bits>)", ["ipv6_dst_addr"] = "Cílová adresa IPv6", ["ipv6_dst_mask"] = "Cílová maska IPv6", ["ipv6_next_hop"] = "IPv6 next hop address", ["ipv6_src_addr"] = "Zdrojová adresa IPv6", ["ipv6_src_mask"] = "Maska zdroje IPv6", ["l4_dst_port"] = "Cílový port vrstvy 4", ["l4_dst_port_map"] = "Symbolický název cílového portu vrstvy 4", ["l4_src_port"] = "Port zdroje IPv4", ["l4_src_port_map"] = "Symbolické jméno zdrojového portu vrstvy 4", ["l4_srv_port"] = "Port serveru vrstvy 4", ["l4_srv_port_map"] = "Symbolické jméno portu serveru vrstvy 4", ["l7_proto"] = "Aplikace vrstvy 7 (numerická)", ["l7_proto_name"] = "Název aplikace vrstvy 7", ["last_switched"] = "SysUptime (msec) posledního toku pkt", ["longest_flow_pkt"] = "Nejdelší paket (bajtů) toku", ["max_ttl"] = "Maximální tok TTL", ["min_ttl"] = "Minimální tok TTL", ["mpls_label_1"] = "Štítek MPLS na pozici 1", ["mpls_label_10"] = "Štítek MPLS na pozici 10", ["mpls_label_2"] = "Štítek MPLS na pozici 2", ["mpls_label_3"] = "Štítek MPLS na pozici 3", ["mpls_label_4"] = "Štítek MPLS na pozici 4", ["mpls_label_5"] = "Štítek MPLS na pozici 5", ["mpls_label_6"] = "Štítek MPLS na pozici 6", ["mpls_label_7"] = "Štítek MPLS na pozici 7", ["mpls_label_8"] = "Štítek MPLS na pozici 8", ["mpls_label_9"] = "Štítek MPLS na pozici 9", ["mysql_appl_latency_usec"] = "Žádost MySQL -> zpoždění odpovědi (usec)", ["mysql_db"] = "Používaná databáze MySQL", ["mysql_query"] = "MySQL Query", ["mysql_response"] = "Odpověď serveru mySQL", ["mysql_server_version"] = "Verze serveru MySQL", ["mysql_username"] = "Uživatelské jméno MySQL", ["netbios_query_name"] = "Název dotazu NETBIOS", ["netbios_query_os"] = "NETBIOS Query OS", ["netbios_query_type"] = "Typ dotazu NETBIOS", ["netbios_response"] = "Odpověď na dotaz NETBIOS", ["nprobe_ipv4_address"] = "IPv4 adresa hostitele byla spuštěna nProbe", ["num_pkts_1024_to_1514_bytes"] = "# pakety, jejichž velikost IP> 1024 a <= 1514", ["num_pkts_128_to_256_bytes"] = "# pakety, jejichž velikost IP> 128 a <= 256", ["num_pkts_256_to_512_bytes"] = "# pakety, jejichž velikost IP> 256 a <512", ["num_pkts_512_to_1024_bytes"] = "# pakety, jejichž velikost IP> 512 a <1024", ["num_pkts_over_1514_bytes"] = "# pakety, jejichž velikost IP> 1514", ["num_pkts_ttl_128_160"] = "# pakety s TTL> 128 a <= 160", ["num_pkts_ttl_160_192"] = "# pakety s TTL> 160 a <= 192", ["num_pkts_ttl_192_224"] = "# pakety s TTL> 192 a <= 224", ["num_pkts_ttl_224_255"] = "# pakety s TTL> 224 a <= 255", ["num_pkts_ttl_2_5"] = "# pakety s TTL> 1 a TTL <= 5", ["num_pkts_ttl_32_64"] = "# pakety s TTL> 32 a <= 64", ["num_pkts_ttl_5_32"] = "# pakety s TTL> 5 a TTL <= 32", ["num_pkts_ttl_64_96"] = "# pakety s TTL> 64 a <= 96", ["num_pkts_ttl_96_128"] = "# pakety s TTL> 96 a <= 128", ["num_pkts_ttl_eq_1"] = "# pakety s TTL = 1", ["num_pkts_up_to_128_bytes"] = "# pakety, jejichž velikost IP <= 128", ["observation_point_id"] = "ID bodu pozorování", ["observation_point_type"] = "Typ pozorovacího bodu", ["ooorder_in_pkts"] = "Počet tokových paketů TCP mimo provoz (dst-> src)", ["ooorder_out_pkts"] = "Počet tokových paketů TCP mimo řádek (src-> dst)", ["oracle_query"] = "Oracle Query", ["oracle_query_duration"] = "Trvání Oracle Query (msec)", ["oracle_rsp_code"] = "Kód odezvy Oracle", ["oracle_rsp_string"] = "Řetězec odezvy Oracle", ["oracle_username"] = "Uživatelské jméno Oracle", ["out_bytes"] = "Odchozí tokové bajty (dst-> src) [Aliased to %%DST_TO_SRC_BYTES]", ["out_dst_mac"] = "Cílová adresa MAC, potenciálně upravená funkcí middlebox za bodem pozorování", ["out_dst_osi_sap"] = "Cíl OSI SAP(Pouze provoz OSI)", ["out_pkts"] = "Odchozí tokové pakety(dst->src) [Aliased to %%DST_TO_SRC_PKTS]", ["out_src_mac"] = "Zdrojová adresa MAC, potenciálně upravená funkcí middlebox za bodem pozorován", ["output_snmp"] = "Výstupní rozhraní SNMP idx", ["packet_section_offset"] = "Posunutí části paketu", ["packets_observed"] = "Celkový počet viděných paketů", ["packets_selected"] = "Počet pkts vybraných pro odběr vzorků", ["payload_hash"] = "Počáteční hash užitečného toku toku", ["plugin_name"] = "Název pluginu použitý v tomto toku (pokud existuje)", ["pop_user"] = "Přihlášení uživatele POP3", ["post_napt_dst_transport_port"] = "Post NAPT Destination Transport Port", ["post_napt_src_transport_port"] = "Post NAPT Source Transport Port", ["post_nat_dst_ipv4_addr"] = "Post NAT Destination IPv4 Address", ["post_nat_src_ipv4_addr"] = "Post NAT Source IPv4 Address", ["protocol"] = "IP protokol bajtů", ["protocol_map"] = "Název protokolu IP", ["radius_acct_in_octets"] = "RADIUS vstupní oktety", ["radius_acct_in_pkts"] = "Vstupní pakety účetního RADIUS", ["radius_acct_out_octets"] = "Octects s účetním výstupem RADIUS", ["radius_acct_out_pkts"] = "Pakety účetního výstupu RADIUS", ["radius_acct_session_id"] = "Název účetní relace RADIUS", ["radius_acct_status_type"] = "Typ stavu účetnictví RADIUS", ["radius_called_station_id"] = "ID volané stanice RADIUS", ["radius_calling_station_id"] = "Id volací stanice RADIUS", ["radius_framed_ip_addr"] = "RADIUS Framed IP", ["radius_nas_identifier"] = "RADIUS NAS Identifier", ["radius_nas_ip_addr"] = "RADIUS NAS IP Address", ["radius_req_msg_type"] = "Typ požadavku RADIUS", ["radius_rsp_msg_type"] = "Typ odpovědi RADIUS", ["radius_user_imei"] = "RADIUS uživatel MSISDN (rozšíření)", ["radius_user_imsi"] = "RADIUS Uživatel IMSI (rozšíření)", ["radius_user_name"] = "Uživatelské jméno RADIUS (pouze přístup)", ["retransmitted_in_bytes"] = "Počet opakovaných přenosových tokových bajtů TCP (src-> dst)", ["retransmitted_in_pkts"] = "Počet opakovaných přenosových tokových paketů TCP (src-> dst)", ["retransmitted_out_bytes"] = "Počet opakovaných přenosových bajtů TCP (dst-> src)", ["retransmitted_out_pkts"] = "Počet opakovaných přenosových paketů TCP (dst-> src)", ["rtp_dtmf_tones"] = "DTMF Tones odeslané (pokud existují) během hovoru", ["rtp_first_seq"] = "Sekvenční číslo RTP prvního toku", ["rtp_first_ts"] = "Časové razítko prvního toku RTP", ["rtp_in_jitter"] = "RTP jitter (ms * 1000)", ["rtp_in_max_delta"] = "Max delta (ms * 100) mezi po sobě jdoucími pkts (src-> dst)", ["rtp_in_mos"] = "RTP pseudo-MOS (hodnota * 100) (src-> dst)", ["rtp_in_payload_type"] = "Typ užitečného zatížení RTP", ["rtp_in_pkt_drop"] = "Paket zahozený od Jitter Buffer (src-> dst)", ["rtp_in_pkt_lost"] = "Paket ztracen ve streamu (src-> dst)", ["rtp_in_r_factor"] = "RTP pseudo-R_FACTOR (hodnota * 100) (src-> dst)", ["rtp_in_transit"] = "Transit RTP (hodnota * 100) (src-> dst)", ["rtp_last_seq"] = "Sekvenční číslo RTP posledního toku", ["rtp_last_ts"] = "Časové razítko RTP posledního toku", ["rtp_mos"] = "RTP pseudo-MOS (hodnota * 100) (průměr oběma směry)", ["rtp_out_jitter"] = "RTP jitter (ms * 1000)", ["rtp_out_max_delta"] = "Max delta (ms * 100) mezi po sobě jdoucími pkts (dst-> src)", ["rtp_out_mos"] = "RTP pseudo-MOS (hodnota * 100) (dst-> src)", ["rtp_out_payload_type"] = "Typ užitečného zatížení RTP", ["rtp_out_pkt_drop"] = "Paket zahozený od Jitter Buffer (dst-> src)", ["rtp_out_pkt_lost"] = "Paket ztracen ve streamu (dst-> src)", ["rtp_out_r_factor"] = "RTP pseudo-R_FACTOR (hodnota * 100) (dst-> src)", ["rtp_out_transit"] = "Transit RTP (hodnota * 100) (dst-> src)", ["rtp_r_factor"] = "RTP pseudo-R_FACTOR (hodnota * 100) (průměr oběma směry)", ["rtp_rtt"] = "RTP zpáteční doba (ms)", ["rtp_sip_call_id"] = "SIP call-id odpovídající tomuto RTP proudu", ["rtp_ssrc"] = "ID zdroje synchronizace RTP", ["s1ap_cause_enb_to_mme"] = "S1AP Příčina od ENB do MME", ["s1ap_detailed_cause_enb_to_mme"] = "Podrobná příčina S1AP od ENB do MME", ["s1ap_enb_ue_s1ap_id"] = "S1AP ENB Identifier", ["s1ap_mme_ue_s1ap_id"] = "S1AP MME Identifier", ["s1ap_msg_emm_type_enb_to_mme"] = "Typ zprávy S1AP EMM od ENB do MME", ["s1ap_msg_emm_type_mme_to_enb"] = "Typ zprávy S1AP EMM z MME do ENB", ["s1ap_msg_esm_type_enb_to_mme"] = "Typ zprávy S1AP ESM od ENB do MME", ["s1ap_msg_esm_type_mme_to_enb"] = "Typ zprávy S1AP ESM z MME do ENB", ["sampled_packet_id"] = "ID vzorkovaného paketu", ["sampled_packet_size"] = "Velikost vzorkovaného paketu", ["sampling_algorithm"] = "Typ vzorkování (deterministický / náhodný)", ["sampling_interval"] = "Vzorkovací frekvence", ["sampling_population"] = "Výběr vzorku", ["sampling_size"] = "Počet paketů k vzorkování", ["selector_id"] = "Selector id", ["selector_name"] = "Sampler name", ["server_nw_latency_ms"] = "Síť RTT / 2 nprobe <-> server (msec)", ["shortest_flow_pkt"] = "Nejkratší paket (bajty) toku", ["sip_bye_ok_time"] = "SIP čas (epocha) BYE OK", ["sip_bye_time"] = "SIP čas (epocha) BYE", ["sip_c_ip"] = "IP adresy SIP C", ["sip_call_id"] = "SIP call-id", ["sip_call_state"] = "Stav volání SIP", ["sip_called_party"] = "SIP Called party", ["sip_calling_party"] = "Iniciátor SIP volání", ["sip_cancel_ok_time"] = "SIP čas (epocha) ZRUŠIT OK", ["sip_cancel_time"] = "SIP čas (epocha) ZRUŠIT", ["sip_invite_failure_time"] = "SIP čas (epocha) INVITE FAILURE", ["sip_invite_ok_time"] = "SIP čas (epocha) POZVAT OK", ["sip_invite_time"] = "Čas SIP (epocha) POZVAT", ["sip_reason_cause"] = "SIP Zrušení / Bye / Příčina selhání", ["sip_response_code"] = "Kód odpovědi na selhání SIP", ["sip_ringing_time"] = "SIP čas (epocha) zvonění", ["sip_rtp_codecs"] = "SIP RTP codecs", ["sip_rtp_ipv4_dst_addr"] = "SIP RTP stream přes IP", ["sip_rtp_ipv4_src_addr"] = "SIP RTP stream source IP", ["sip_rtp_l4_dst_port"] = "Cílový port toku SIP RTP", ["sip_rtp_l4_src_port"] = "Port zdroje proudu SIP RTP", ["sip_trying_time"] = "Čas SIP (epocha) pokusu", ["smtp_mail_from"] = "Odesílatel pošty", ["smtp_rcpt_to"] = "Příjemce pošty", ["src_as"] = "Source BGP AS", ["src_as_map"] = "Název organizace pro SRC_AS", ["src_as_path_1"] = "Src AS poloha pozice 1", ["src_as_path_10"] = "Src AS poloha pozice 10", ["src_as_path_2"] = "Src AS poloha pozice 2", ["src_as_path_3"] = "Src AS poloha pozice 3", ["src_as_path_4"] = "Src AS poloha pozice 4", ["src_as_path_5"] = "Src AS poloha pozice 5", ["src_as_path_6"] = "Src AS poloha pozice 6", ["src_as_path_7"] = "Src AS poloha pozice 7", ["src_as_path_8"] = "Src AS poloha pozice 8", ["src_as_path_9"] = "Src AS poloha pozice 9", ["src_father_proc_name"] = "Název procesu Father Src", ["src_father_proc_pid"] = "Src Father proces PID", ["src_fragments"] = "Počet fragmentovaných paketů src-> dst", ["src_ip_city"] = "Město, kde se nachází IP src", ["src_ip_country"] = "Země, kde se nachází IP src", ["src_ip_lat"] = "Zeměpisná šířka, kde se nachází adresa IP src", ["src_ip_long"] = "Zeměpisná délka, kde se nachází IP adresa src", ["src_proc_actual_memory"] = "Src zpracovává skutečnou paměť (bajty)", ["src_proc_average_cpu_load"] = "zatížení procesu vg src (%% * 100)", ["src_proc_name"] = "Název procesu Src", ["src_proc_num_page_faults"] = "Src process num pagefaults", ["src_proc_pctg_iowait"] = "Proces Src iowait time %% (%% * 100)", ["src_proc_peak_memory"] = "Src zpracovává vrcholnou paměť (bajty)", ["src_proc_pid"] = "Src proces PID", ["src_proc_uid"] = "Src proces UID", ["src_proc_user_name"] = "Uživatelské jméno procesu Src", ["src_to_dst_avg_throughput"] = "Src do dst průměrný thpt (bps)", ["src_to_dst_max_throughput"] = "Src do dst max thpt (bps)", ["src_to_dst_min_throughput"] = "Src do dst min thpt (bps)", ["src_tos"] = "TOS/DSCP (src->dst)", ["src_vlan"] = "Zdroj VLAN (vnitřní VLAN v QinQ)", ["ssdp_host"] = "SSDP Host", ["ssdp_method"] = "SSDP Metoda", ["ssdp_server"] = "SSDP Server", ["ssdp_type"] = "SSDP Typ", ["ssdp_usn"] = "SSDP USN", ["suricata_app_proto"] = "Protokol aplikace Suricata", ["suricata_flow_id"] = "ID toku Suricata", ["tcp_flags"] = "Souhrn všech příznaků TCP všech toků", ["tcp_win_max_in"] = "Max TCP Window (src-> dst)", ["tcp_win_max_out"] = "Max TCP Window (dst->src)", ["tcp_win_min_in"] = "Min TCP Window (src->dst)", ["tcp_win_min_out"] = "Min TCP Window (dst->src)", ["tcp_win_mss_in"] = "Maximální velikost segmentu TCP(src->dst)", ["tcp_win_mss_out"] = "Maximální velikost segmentu TCP (dst-> src)", ["tcp_win_scale_in"] = "TCP Window Scale (src-> dst)", ["tcp_win_scale_out"] = "TCP Window Scale (dst-> src)", ["tls_cert_after"] = "TLS Certificate After", ["tls_cert_dn"] = "TLS Certificate DN", ["tls_cert_not_before"] = "Certifikát TLS ne dříve", ["tls_cert_sha1"] = "TLS Certificate Fingerprint", ["tls_cert_sn"] = "TLS certifikát S / N", ["tls_cert_subject"] = "Předmět certifikátu TLS", ["tls_server_name"] = "Název serveru TLS", ["tls_version"] = "TLS Verze", ["total_bytes_exp"] = "Celkový počet exportovaných bytů", ["total_flows_exp"] = "Celkový počet exportovaných toků", ["total_pkts_exp"] = "Celkový počet exportovaných toků “,", ["untunneled_ipv4_dst_addr"] = "Cílová adresa untunneled IPv4", ["untunneled_ipv4_src_addr"] = "Zdrojová adresa untunneled IPv4", ["untunneled_ipv6_dst_addr"] = "Cílová adresa untunneled IPv6", ["untunneled_ipv6_src_addr"] = "Zdrojová adresa untunneled IPv6", ["untunneled_l4_dst_port"] = "Cílový Port Untunneled IPv4 ", ["untunneled_l4_src_port"] = "Zdrojový Port Untunneled IPv4", ["untunneled_protocol"] = "Bajt untunneled IP Protokol", ["upstream_session_id"] = "Identifikátor relace proti proudu (např. L2TP) nebo 0, pokud není znám", ["upstream_tunnel_id"] = "Identifikátor předřazeného tunelu (např. GTP TEID, VXLAN VNI) nebo 0, pokud není znám", ["user_name"] = "Uživatelské jméno", }, ["flows_page"] = { ["active_flows"] = "Aktivní %{filter} toky", ["actual_throughput"] = "Skutečné Thpt", ["alerted"] = "Upozornění", ["all_alerted"] = "Vše upozorněno", ["all_ases"] = "Všechny ASes", ["all_categories"] = "Všechny kategorie", ["all_devices"] = "Všichni exporteři toku", ["all_flows"] = "Všechny toky", ["all_hosts"] = "Všichni hostitelé", ["all_inIfIdx"] = "Všechna vstupní rozhraní", ["all_ip_versions"] = "Všechny verze", ["all_l4_protocols"] = "Všechny protokoly", ["all_misbehaving"] = "Všechno chovající se špatně", ["all_outIfIdx"] = "Všechna výstupní rozhraní", ["all_proto"] = "Všechny aplikace", ["all_vlan_ids"] = "Všechny sítě VLAN", ["applications"] = "Aplikace", ["blocked"] = "Blokováno", ["client_as"] = "Klient AS", ["device_ip"] = "Probe Toku", ["direction"] = "Směr", ["probes"] = "Exporteři Toku", ["flows"] = "%{filter} Toky", ["flows_as_client"] = "Toky jako klient", ["flows_as_server"] = "Toky jako server", ["hosts"] = "Hosts", ["icmp_only"] = "Pouze ICMP", ["idle_flows_not_listed"] = "Neaktivní toky nejsou uvedeny.", ["inIfIdx"] = "Vstupní rozhraní", ["ip_version"] = "Verze IP", ["ipv4_only"] = "Pouze IPv4", ["ipv6_only"] = "Pouze IPv6", ["l4_protocol"] = "Protokol", ["local_cli_remote_srv"] = "Místní klient - vzdálený server", ["local_only"] = "Pouze místní", ["local_srv_remote_cli"] = "Lokální Server - Vzdálený Klient", ["misbehaving"] = "Chovajicí se spatně", ["multicast"] = "vysílání", ["network"] = " [ Síť %{network} ]", ["non_multicast"] = "Nevysílá", ["normal"] = "Normalní", ["one_way_multicast"] = "Jednosměrné vysílán", ["one_way_non_multicast"] = "One-Way Non-Multicast/Non-Broadcast", ["outIfIdx"] = "Výstupní rozhraní", ["recently_active_flows"] = "Nedávno aktivní %{filter} toky", ["remote_only"] = "Pouze Vzdálené", ["server_as"] = "Server AS", ["sflow_devices"] = "Zařízení sFlow", ["source_id"] = "ID zdroje", ["tcp_only"] = "Pouze TCP", ["tcp_state"] = "Stav TCP", ["tcp_state_closed"] = "Uzavřeno / Zavřeno", ["tcp_state_connecting"] = "Připojování", ["tcp_state_established"] = "stanovený", ["tcp_state_reset"] = " Resetovat", ["tcp_state_unknown"] = "Neznámý", ["total_bytes"] = "Celkem bajtů", ["total_bytes_rcvd"] = "Celkový počet přijatých bajtů", ["total_bytes_sent"] = "Celkový počet odeslaných bajtů", ["total_bytes_unknown"] = "Celkový počet neznámých bajtů aplikací", ["udp_only"] = "Pouze UDP", ["vlan"] = "VLAN", }, ["geo_map"] = { ["browser_reported_home_map"] = "Poloha domovského chartu nahlášená prohlížečem", ["geo_map"] = "Geo Mapa", ["geolocation_error"] = "Chyba geolokace", ["hosts_geomap"] = "Hosts GeoMap", ["latitude"] = "Zeměpisná šířka", ["longitude"] = "Zeměpisná délka", ["note"] = "POZNÁMKA", ["note_active_flows"] = "Mají aktivní toky mezi vrstevníky s veřejnými IP adresami. “,„ Délka", ["note_compiled_ntopng_with_geolocation"] = "Zkompilovali software s geolokací a začali s ním.", ["note_google_maps_browser_api_key"] = "Je vyžadován klíč Google Maps API Key, který můžete vygenerovat <a href='%{url_google}'>Konzolí platformy Google Cloud Platform</a>:<br> vytvořte, prosím, nový projekt a vyberte Maps JavaScript API ->Vytvořit pověření -> klíč API. <br> Po vygenerování, klíč lze zadat prostřednictvím <a href='%{url_prefs}'><i class=\"fas fa-flask\"></i> Preference</a>.", ["note_html_browser_geolocation"] = "HTML <A HREF=%{url}>browser geolocation</A> se používá k umístění na hostitele mapy na základě neznámých míst.", ["note_requirements_visualize_maps"] = "Aby bylo možné vizualizovat mapy, musíte", ["note_working_internet_connection"] = "Mít funkční připojení k internetu.", ["unavailable_geolocation"] = "Geolokace nepodporuje váš prohlížeč ani není deaktivována.", ["using_default_location"] = "Používá výchozí umístění.", }, ["graphs"] = { ["95_perc"] = "95. Perc", ["active_devices"] = "Aktivní zařízení", ["active_flows"] = "Aktivní toky", ["active_host_contacts"] = "Kontakty aktivního hostitele", ["active_hosts"] = "Aktivní hostitelé", ["active_http_servers"] = "Aktivní HTTP servery", ["actual_memory"] = "Skutečná paměť", ["arp_replies"] = "ARP odpovědi", ["arp_requests"] = "ARP požadavky", ["arp_rqst_sent_rcvd_rpls"] = "ARP odeslané žádosti / odpovědi Rcvd", ["average"] = "Průměrný", ["average_traffic"] = "Průměrný provoz / s", ["avg"] = "Avg", ["binary_operators_note"] = "Další informace o indikátorech EMA, SMA a RSI najdete na <a href=\"%{url}\">online dokumentacích</a>.", ["blocked_flows"] = "Blokované toky", ["bytes_sent_non_unicast"] = "Bajty odeslány bez unicastu", ["bytes_sent_unicast"] = "Bajty odeslané Unicast", ["custom"] = "Vlastní", ["dns_qry_rcvd_rsp_sent"] = "DNS Rcvd Dotazy / \9odeslané odpovědi", ["dns_qry_sent_rsp_rcvd"] = "Odeslané dotazy DNS / přojaté odpovedi", ["download_chart_data"] = "Stáhnout aktuální data chartu", ["echo_reply_packets"] = "Echo Reply Packets", ["echo_request_packets"] = "Echo Request Packets", ["export_flows_as_txt"] = "Exportovat toky jako soubor TXT", ["flows_status_overview"] = "%{protocol} Přehled stavu toků", ["flows_vs_local_hosts"] = "Aktivní toky vs. místní hositelé", ["flows_vs_traffic"] = "Aktivní toky vs. provoz", ["get_permanent_link"] = "Získejte trvalý odkaz", ["graph_info"] = "Informace o grafu", ["host_unreachable_flows"] = "Celkový počet nepřijatelných toků hostitele", ["max"] = "Max", ["memory_vs_hosts_flows"] = "Procesní paměť vs Hostitelé / Toky", ["minute_interface_top_stats"] = "Statistiky nejvyššího provozu na minutu", ["note_ases_rcvd"] = "Provoz přijímal provoz přijímaný autonomním systémem.", ["note_ases_sent"] = "Odeslaný provoz je přenos odeslaný autonomním systémem.", ["note_ases_traffic"] = "Zobrazený provoz je odesílán a přijímán autonomním systémem.", ["note_chart_zoom"] = "Klepnutím a přetažením v chartu přiblížíte, dvojitým kliknutím oddálíte.", ["note_protocols_shown"] = "Aplikace neviděné ve vybraném časovém rámci nejsou v rozevíracím seznamu uvedeny.", ["num_ms_rtt"] = "Doba zpáteční cesty ms", ["num_nfq_drops"] = "Spadlé Pakety", ["num_nfq_pct"] = "Vyplnit frontu %%", ["packet_drops"] = "Packet Drops", ["peak_memory"] = "Vrcholná Paměť", ["percentile"] = "95. <a href=\"%{url}\">procent</a>", ["permanent_link"] = "Trvalý odkaz", ["pkt_drops"] = "Pkt Drops", ["process_memory"] = "Paměť Procesu", ["query_too_much_time"] = "Dokončení dotazu trvá příliš dlouho", ["query_too_slow"] = "Dokončení dotazu trvalo příliš dlouho", ["query_was_aborted"] = "Dotaz byl přerušen", ["raw_flows"] = "Raw Flows", ["raw_proto_flows"] = "Raw %{proto} Toky", ["reset_zoom"] = "Reset Zoom", ["right_axis_note"] = "(right axis)", ["rtt"] = "RTT", ["tcp_finack_packets"] = "Pakety TCP FIN + ACK", ["tcp_packets"] = "Pakety TCP", ["tcp_packets_keep_alive"] = "TCP Packets KeepAlive", ["tcp_packets_lost"] = "Ztracené pakety TC", ["tcp_packets_ooo"] = "TCP Pakety jsou mimo provoz", ["tcp_packets_retr"] = "Přenosové pakety TCP", ["tcp_retr_ooo_lost"] = "Opakovaný přenos TCP je mimo provoz a ztracený", ["tcp_rst_packets"] = "TCP RST pakety", ["tcp_rx_stats"] = "Statistiky TCP RX", ["tcp_syn_packets"] = "TCP SYN Packety", ["tcp_syn_vs_tcp_synack"] = "TCP SYN vs SYN+ACK Pakety", ["tcp_synack_packets"] = "TCP SYN + ACK pakety", ["tcp_tx_stats"] = " Statistiky TCP TX", ["the_select_timeframe_too_small_top_talkers"] = "Zvolený časový frame je příliš malý na to, aby bylo možné určit Top Talkers. Vyberte prosím alespoň 1 minutový frame.", ["top_clients"] = "Top %{protocol} Klienti", ["top_interfaces"] = "Top rozhraní", ["top_l7_contacts"] = "Top %{protocol} L7 Kontakty", ["top_ndpi_categories"] = "Top kategorie", ["top_ndpi_protocols"] = "Top aplikace", ["top_profiles"] = "Top profily", ["top_receivers"] = "Top přijímače", ["top_senders"] = "Top Odesílatelé", ["top_servers"] = "Top %{protocol} Servery", ["total_misbehaving_flows"] = "Celkový počet chybných toků", ["total_unreachable_flows"] = "Celkový počet Portů nedostuných toků", ["traffic_rxtx"] = "Provoz RX / TX", ["traffic_vs_errors"] = "Provoz vs Chyby", ["trend"] = "Trend", ["udp_packets"] = "UDP Pakety", ["udp_sent_unicast_vs_non_unicast"] = "UDP poslal Unicast vs Non Unicast", ["zmq_flow_coll_drops"] = "Spadla kolekce toku", ["zmq_flow_coll_udp_drops"] = "Spadla kolekce soketů", ["zmq_msg_rcvd_vs_drops"] = "Shromážděné vs Dropped ZMQ zprávy", ["zmq_received_flows"] = "Shromážděné ZMQ Toky", ["metrics_prefixes"] = { ["broadcast_bytes"] = "Vysílání bajtů", ["drops"] = "Padá", ["num_devices"] = "Počet zařízení", ["num_flows"] = "Počet toků", ["num_hosts"] = "Počet hostitelů", ["num_http_hosts"] = "Počet HTTP hostitelů", ["num_ms_rtt"] = "RTT ms", ["packets"] = "Pakety", }, ["metrics_suffixes"] = { ["by_as"] = "%{metric} by AS", ["egress"] = "Opouštějící", ["ingress"] = "Přicházející", ["inner"] = "Vnitřní", ["rcvd"] = "rcvd", ["sent"] = "poslat", }, }, ["host_config"] = { ["drop_all_host_traffic"] = "Přerušte veškerý provoz hostitele", ["hide_from_top"] = "Skrýt před Top Talkers", ["hide_host_from_top_descr"] = "Nepočítejte hostitele %{host} do top talkers výpočtu", ["host_alias"] = "Host Alias", ["host_pool"] = "Hostitelský Fond", ["host_traffic_policy"] = "Hostitelská politika provozu", ["modify_host_pool_policy_btn"] = "Upravit politiku fondu pro hostitele", ["trigger_alerts_for_host"] = "Spustit upozornění pro hostitele %{host}", ["trigger_host_alerts"] = "Spouštěcí upozornění hostitele", ["unblock_host_traffic"] = "Odblokovat provoz hostitele", }, ["host_details"] = { ["active_alerted_flows"] = "Aktivní výstražné toky", ["blocked_traffic"] = "\9Blokovaný provoz", ["disabled_alert_type_help"] = "Vypnout generování výstrah toku na základě stavu toku", ["host"] = "Hostitel / Host", ["host_cannot_be_found_message"] = "Host %{host} nemůže být nalezen.", ["host_parameter_missing_message"] = "Chybí parametr hostitele (interní chyba?)", ["host_traffic_blocked_quota"] = "Některý provoz hostitele byl blokován překročenou kvótou", ["host_traffic_blocked_quota_and_shaper"] = "Některý provoz hostitele byl blokován překročenou kvótou a blokovacím blokem", ["host_traffic_blocked_shaper"] = "Některý provoz hostitele byl blokován blokovacím blokem", ["multiple_selection"] = "Stisknutím tlačítka CTRL lze vybrat více prvků", ["reset_host_stats"] = "Reset hostitelské statistiky", ["reset_host_stats_confirm"] = "Opravdu chcete resetovat \"%{host}\" statistiku runtime?", ["reset_host_stats_note"] = "<b>POZNÁMKA</b>: historické grafy pro tohoto hostitele mohou po resetování obsahovat mezeru.", ["reset_stats_in_progress"] = "Statistiky hostitele budou resetovány do 5 sekund", ["restore_from_cache_message"] = "Klikněte <a href=%{js_code}> zde</a> pro obnovení z mezipaměti.", ["rtt"] = "RTT", ["snmp"] = "SNMP", ["status_ignore"] = "Upozornění na stav toku zakázána", ["trace_debug_host_info"] = "Host:%{hostinfo}, Vlan: %{vlan}", ["trace_debug_host_ip"] = "Host:%{hostip}, Vlan: %{vlan}", ["trace_debug_restored_host_info"] = "Obnovené informace o hostiteli", ["unknown_device_type"] = "Neznámý typ zařízení", }, ["host_pools"] = { ["active_pool_members"] = "Aktivní členové fondu", ["alias_or_manufacturer"] = "Alias / Výrobce", ["and_associated_members"] = "Jjeho historické údaje a případně přidružených členů", ["cannot_delete_cp"] = "Fond nelze odstranit, pokud je k němu přidružen jakýkoli uživatel Captive Portal", ["change_member_pool"] = "Změnit fond členů", ["change_pool"] = "Změnit Fond", ["children_safe"] = "Vhodné pro děti", ["confirm_delete_pool"] = "Opravdu chcete smazat hostitelský fond", ["confirm_empty_pool"] = "Opravdu chcete odebrat všechny členy z hostitelského fondu", ["confirm_remove_member"] = "Opravdu chcete člena odebrat?", ["confirm_reset_pool_quotas"] = "Opravdu chcete resetovat \"%{pool}\" počítače fondu?", ["confirm_reset_quotas"] = "Opravdu chcete resetovat všechny čítače kvót?", ["create_new_quotas_here"] = "Zde můžete vytvořit nové kvóty <a href=\"%{url}\">zde</a>.", ["create_pool_hint"] = "Na kartě Spravovat fondy můžete vytvořit nové fondy.", ["create_pools"] = "Spravovat Fondy", ["delete_pool"] = "Smazat fond", ["duplicate_member"] = "Duplicitní adresa člena", ["duplicate_pool"] = "Duplicitní název fondu", ["edit_host_pools"] = "Upravit hostitelské fondy", ["empty_pool"] = "Prázdný Fond", ["enforce_quotas_per_pool_member"] = "Kvóty na člena", ["enforce_shapers_per_pool_member"] = "Shapers na člena", ["from_pool"] = "z hostitelského fondu", ["host_pools"] = "Hostitelské Fondy", ["invalid_member"] = "Neplatný formát adresy člena", ["manage_pools"] = "Spravovat Fond Členství", ["manufacturer_filter"] = "Výrobce: %{manufacturer}", ["max_members_message"] = "S touto verzí ntopng můžete přiřadit pouze %{maxnum} členů na hostitelský fond. Chcete-li tento limit odstranit, upgradujte na verzi Enterprise.", ["max_pools_message"] = "S touto verzí ntopng můžete vytvářet pouze %{maxnum} hostiteslkých fondů. Chcete-li tento limit odstranit, upgradujte na verzi Enterprise.", ["member_address"] = "Adresa člena", ["member_exists"] = "Člen \"%{member_name}\" nepřidán. Je již přiřazen k fondu \"%{member_pool}\".", ["member_filter"] = "Člen: %{member}", ["members_limit_reached"] = "Bylo dosaženo limitu členů", ["network_normalized"] = "Síť \"%{network}\"má nenulový identifikátor hostitele. Použitím \"%{network_normalized}\".", ["new_pool"] = "Nové Fondy", ["no_pools_defined"] = "Nejsou definovány žádné hostitelské fondy.", ["per_member_quotas"] = "Když je nastavena možnost kvóty na člena, každý hostitel bude mít samostatný počet kvót. Pokud nebude nastaven, bude veškerý provoz hostitelů počítat jako celek do limitu kvóty", ["per_member_shapers"] = "Když je nastavena možnost Shapers pro jednotlivé členy, každý host bude mít své vlastní Shapers. Pokud nebude nastaven, budou všichni host patřící do stejné skupiny sdílet stejné Shapers.", ["pool"] = "Název Fondu", ["pool_name"] = "Název Fondu", ["pool_name_pattern_error"] = "Zadejte pouze malá písmena, čísla nebo podtržítka", ["remove_member"] = "Odebrat člena", ["reset_quotas"] = "Obnovit kvóty", ["search_member"] = "Vyhledat člena", ["select_new_pool"] = "Vyberte nový fond z rozevíracího seznamu níže a přiřaďte člena \"%{member}\" do:", ["specify_member_address"] = "Zadejte prosím IPv4 / IPv6 adresu nebo síť nebo MAC adresu", ["specify_pool_name"] = "Zadejte název fondu", ["view"] = "Pohled", }, ["hosts_comparison"] = { ["hosts_parameter_missing_message"] = "Chybí parametr hostitelů (interní chyba?)", }, ["hosts_stats"] = { ["all"] = "Vše", ["all_hosts"] = "Všichni hostitelé", ["as_geolocation"] = "AS Geolocation", ["as_info"] = "AS Info", ["as_path"] = "AS Cesta", ["as_prefixes"] = "AS Předpony", ["asn_title"] = "Pro AS %{asn}", ["bgp_updates"] = "BGP aktualizace", ["blacklisted"] = "Černá listina", ["blacklisted_hosts_only"] = "Pouze hostitelé na černé listině", ["blocking_traffic_policy_popup_msg"] = "Provoz hostitele je ovlivňován blokováním politiky provozu", ["broadcast_domain_hosts_only"] = "Vysílat pouze hostitelské domény", ["country_title"] = "Pro zemi %{country}", ["filter_hosts"] = "Filtrovat hostitelé", ["filtered"] = "Filtrovaný", ["filtered_hosts_only"] = "Hostitelé s blokovaným provozem", ["host_pool"] = " Hostitelský fond %{pool_name}", ["hosts"] = "Hostitelé", ["hosts_list"] = "Hostitelský Seznam", ["hosts_page_title"] = "%{all} %{traffic_type} %{local_remote} %{protocol} %{network_cidr} %{network} %{ip_version} %{os} Hosts %{country_asn_or_mac} %{vlan}", ["idle_hosts_not_listed"] = "Neaktivní hostitelé nejsou uvedení.", ["in_network"] = "%{network}", ["ipver_title"] = "IPv%{version_num}", ["label_blacklisted_host"] = "Černá listina", ["label_broadcast_domain_host"] = "Vysílací doména", ["label_local_host"] = "Lokální", ["label_remote_host"] = "Vzdálený", ["local"] = "Lokalní", ["local_hosts_only"] = "Pouze lokální hostitelé", ["location"] = "Umístění", ["mac_title"] = "S Mac %{mac}", ["more_info_about_as_popup_msg"] = "Více informací o AS", ["pool_title"] = "Pro fond %{poolname}", ["remote"] = "Vzdálený", ["remote_hosts_only"] = "Pouze vzdálení Hosts", ["source_id"] = "ID zdroje", ["traffic_type_all"] = "Všichni hostitelé", ["traffic_type_one_way"] = "Jednosměrný provoz", ["traffic_type_two_ways"] = "Obousměrný provoz", ["user"] = "Uživatel %{pool_name}", ["user_title"] = "Pro uživatele %{poolname}", ["vlan_title"] = "VLAN %{vlan}", }, ["http_page"] = { ["distribution"] = "Distribuce", ["http_queries"] = "HTTP dotazy odeslány", ["http_responses"] = "Přijaté odpovědi HTTP", ["method"] = "Metoda", ["other_method"] = "Jiná Metoda", ["requests"] = "Žádosti", ["requests_served"] = "Vyřízené žádosti", ["response_code"] = "Kód odpovědi", ["response_code_1xx"] = "1xx (Informační)", ["response_code_2xx"] = "2xx (Úspěch)", ["response_code_3xx"] = "3xx (přesměrování)", ["response_code_4xx"] = "4xx (chyba klienta)", ["response_code_5xx"] = "5xx (chyba serveru)", ["responses"] = "Odpovědi", ["traffic_received"] = "Provoz přijat", ["traffic_sent"] = "Provoz odeslán", ["virtual_hosts"] = "Virtuální hostitelé", }, ["http_servers_stats"] = { ["actual_requests"] = "Skutečné žádosti", ["bytes_received"] = "Bajty byly přijaty", ["bytes_sent"] = "Bajty byly odeslány", ["http_server_ip"] = "IP adresa HTTP serveru", ["http_servers"] = "HTTP server", ["http_virtual_host"] = "HTTP Virtual Host", ["local_http_servers"] = "Lokální servery HTTP", ["total_requests"] = "Celkový počet žádostí", }, ["icmp_page"] = { ["icmp_message"] = "Zpráva ICMP", ["icmp_port_unreachable_extra"] = "%{unreach_protocol} port %{unreach_port} nedostupný na %{unreach_host}", ["last_rcvd_peer"] = "Naposledy přijatý Peer", ["last_sent_peer"] = "Posledně odeslaný Peer", ["packets_received"] = "Přijaté pakety", ["packets_sent"] = "Odeslané pakety", }, ["icmp_v6_types"] = { ["type_0_reserved"] = "Rezervováno", ["type_100_private_experimentation"] = "Soukromé experimentování", ["type_101_private_experimentation"] = "Soukromé experimentování", ["type_127_reserved_for_expansion_of_icmpv6_error_messages"] = "Vyhrazeno pro rozšíření chybových zpráv ICMPv6", ["type_128_echo_request"] = "Echo Žádost", ["type_129_echo_reply"] = "Echo Odpověď", ["type_130_multicast_listener_query"] = "Dotaz posluchače vícesměrového vysílání", ["type_131_multicast_listener_report"] = "Zpráva vícesměrového vysílání", ["type_132_multicast_listener_done"] = "Posluchač vícesměrového vysílání je hotový", ["type_133_router_solicitation"] = "Router Solicitation", ["type_134_router_advertisement"] = "Router Advertisement", ["type_135_neighbor_solicitation"] = "Neighbor Solicitation", ["type_136_neighbor_advertisement"] = "Neighbor Advertisement", ["type_137_redirect_message"] = "Přesměrování zprávy", ["type_138_router_renumbering"] = "Přečíslování směrovače", ["type_139_icmp_node_information_query"] = "Informační dotaz na uzel ICMP", ["type_140_icmp_node_information_response"] = "Informační odpověď uzlu ICMP", ["type_141_inverse_neighbor_discovery_solicitation_message"] = "Inverzní zpráva o Neighbour Discovery", ["type_142_inverse_neighbor_discovery_advertisement_message"] = "Reklamní zpráva o inverzním Neighbour Discovery", ["type_143_version_2_multicast_listener_report"] = "Zpráva Multicast posluchače verze 2", ["type_144_home_agent_address_discovery_request_message"] = "Zpráva s žádostí o nalezení adresy domovského agenta", ["type_145_home_agent_address_discovery_reply_message"] = "Home Agent Address Discovery Reply Message", ["type_146_mobile_prefix_solicitation"] = "Mobile Prefix Solicitation", ["type_147_mobile_prefix_advertisement"] = "Mobile Prefix Advertisement", ["type_148_certification_path_solicitation_message"] = "Zpráva o žádosti o certifikační cestu", ["type_149_certification_path_advertisement_message"] = "Reklamní zpráva o certifikační cestě", ["type_150_icmp_messages_utilized_by_experimental_mobility_protocols"] = "Zprávy ICMP využívané experimentálními protokoly mobility", ["type_151_multicast_router_advertisement"] = "Multicast Router Advertisement", ["type_152_multicast_router_solicitation"] = "Multicast Router Solicitation", ["type_153_multicast_router_termination"] = "Multicast Router Termination", ["type_154_fmipv6_messages"] = "FMIPv6 Zprávy", ["type_155_rpl_control_message"] = "Řídicí zpráva RPL", ["type_156_ilnpv6_locator_update_message"] = "Zpráva o aktualizaci lokátoru ILNPv6", ["type_157_duplicate_address_request"] = "Žádost o duplicitní adresu", ["type_158_duplicate_address_confirmation"] = "Potvrzení duplicitní adresy", ["type_159_mpl_control_message"] = "Řídicí zpráva MPL", ["type_1_destination_unreachable"] = "Cíl nedosažitelný", ["type_200_private_experimentation"] = "Soukromé experimentování", ["type_201_private_experimentation"] = "Soukromé experimentování", ["type_255_reserved_for_expansion_of_icmpv6_informational_messages"] = "Vyhrazeno pro rozšíření informačních zpráv ICMPv6", ["type_2_packet_too_big"] = "Paket je příliš velký", ["type_3_time_exceeded"] = "Čas byl překročen", ["type_4_parameter_problem"] = "Problém s parametrem", }, ["if_stats_config"] = { ["companion_interface"] = "Doprovodné rozhraní", ["custom_name"] = "Vlastní jméno", ["custom_name_popup_msg"] = "Zadejte alias rozhraní", ["dump_flows_to_database"] = "Výpis toků do databáze", ["hide_from_top_networks"] = "Skrýt před top sítěmi", ["hide_from_top_networks_descr"] = "např. %{example}", ["interface_network_discovery"] = "Pravidelné zjišťování síťového rozhraní", ["interface_one_way_hosts_rrd_creation"] = "Vytvářejte Timeseries jednosměrného provozu", ["interface_rrd_creation"] = "Vytvoření časových rozhraní rozhraní", ["interface_speed"] = "Rychlost rozhraní (Mbit / s)", ["interface_speed_popup_msg"] = "Určete maximální rychlost rozhraní", ["interface_top_talkers_creation"] = "Vytvořit rozhraní Top Talkers", ["is_mirrored_traffic"] = "Zrcadlový provoz", ["refresh_rate"] = "Obnovovací frekvence statistik v reálném čase (s)", ["refresh_rate_popup_msg"] = "Určete rychlost aktualizace statistik rozhraní", ["scaling_factor"] = "Míra vzorkování vstupních paketů", ["scaling_factor_popup_msg"] = "To by mělo odpovídat vzorkovací frekvenci snímacího rozhraní", ["show_dyn_iface_traffic"] = "Duplicitní disagregovaný provoz", ["show_dyn_iface_traffic_note"] = "Povolením této možnosti bude v hlavním rozhraní stále zobrazen provoz směrovaný na dynamická nebo vlastní dílčí rozhraní", ["trigger_interface_alerts"] = "Spouštěcí výstrahy rozhraní", }, ["if_stats_networks"] = { ["note_ghost_bcast_domains"] = " %{ghost_icon} zdůrazňuje ghosts vysílací domény (tj. nepatří k žádné ze sítí IP adres rozhraní).", ["note_iface_addresses"] = "IP adresy se načítají z konfigurace rozhraní.", ["note_iface_bcast_domains"] = "Vysílací domény jsou odvozeny inspekcí ARP provozu.", }, ["if_stats_overview"] = { ["active"] = "Aktivní", ["all_counters"] = "Všechny čítače", ["blocked_flows"] = "Blokované toky", ["bridged_traffic"] = "Mostový provoz", ["buffer_full"] = "Buffer Full", ["collected_flows"] = "Shromážděné toky", ["dropped_flows"] = "Přerušené toky", ["dropped_packets"] = "Vypuštěné pakety", ["drops_only"] = "Pouze vypuštěné", ["dumped_files"] = "Zahozené soubory", ["dumped_packets"] = "Zahozené pakety", ["egress_packets"] = " Odchozí pakety", ["exported_flows"] = "Exportované toky", ["family"] = "Rodina", ["flows_export_statistics"] = "Statistiky exportu toků", ["has_traffic_directions"] = "S pokyny RX / TX", ["id"] = "Id", ["iface_switch_active_msg"] = "Vybrané rozhraní <b>%{interface}</b> [ifid: %{ifid}] je nyní aktivní", ["iface_switch_empty_session_msg"] = "Prázdná relace", ["iface_switch_error_msg"] = "Chyba při přepínání rozhraní", ["in_path_interface"] = "Rozhraní In-Path (Náraz do drátu)", ["ingress_packets"] = "Vstupní pakety", ["ingress_traffic"] = "Vstupní provoz", ["interface_ip"] = "Rozhraní IP", ["interface_name"] = "Rozhraní", ["interface_rx_updates"] = "Aktualizace rozhraní", ["nf"] = "Netfilter", ["nf_enobufs"] = "Žádná vyrovnávací paměť", ["nf_handle_packet_failed"] = "Selhání zpracování paketů ve frontě", ["nf_queue_dropped"] = "Vypuštěné pakety (fronta plná)", ["nf_queue_pct"] = "Úroveň naplnění fronty", ["nf_queue_total"] = "Pakety ve frontě", ["nf_queue_user_dropped"] = "Vypuštěné pakety (nelze je odeslat do uživatelského prostoru)", ["note"] = "POZNÁMKA", ["note_drop_ifstats_dynamic"] = "Spadlé soubory jsou k dispozici v hlavním rozhraní", ["note_drops_sflow"] = "Spadlé soubory jsou zobrazeny pouze pro sFlow, protože je NetFlow nehlásí.<br><A HREF=https://www.ietf.org/rfc/rfc3176.txt>sFlow</A> spadlé soubory počítají, kolikrát agent sFlow zjistil, že je paket označený jako vzorek, tak byl vyřazen kvůli nedostatku zdrojů. Počítadlo spadlých souborů hlásí celkový počet detekovaných selháných souborů od posledního resetu agenta. Vysoká míra poklesu znamená, že agent správy není schopen zpracovat vzorky tak rychle, jak jsou generovány hardwarem. Zvýšení vzorkovací frekvence sFlow sníží rychlost klesání. Poznámka: Agent, který nedokáže detekovat spadlé soubory, bude vždy hlásit nulu.", ["note_packets"] = "V ethernetových sítích má každý paket <A HREF=\"https://en.wikipedia.org/wiki/Ethernet_frame\"> režii 24 bytů</A> [preamble (7 bytes), začátek framu (1 byte), CRC (4 bytes), a <A HREF=\"http://en.wikipedia.org/wiki/Interframe_gap\">IFG</A> (12 bytes)]. Takovou režii je třeba započítat do provozu na rozhraní, ale nepřidává se k provozu, který se vyměňuje mezi IP adresami. Je tomu tak proto, že taková data přispívají k zatížení rozhraní, ale nemohou být započítána do provozu, který si vyměňují hostitelé, a proto očekávají malé rozdíly mezi hodnotami provozu mezi hostitelem a rozhraním.", ["note_probe_zmq_drops_export_queue_full"] = "Vzdálená sonda tyto toky úspěšně zpracovala, ale nemohla je zařadit do fronty pro export, protože exportní fronta byla plná.", ["note_probe_zmq_drops_flow_collection_drops"] = "Pakety s přerušeným tokem (NetFlow v9) nebo přerušené toky (NetFlow v5/IPFIX)", ["note_probe_zmq_drops_flow_collection_udp_socket_drops"] = "Vypuštěné tokové pakety na soketu kolekce nProbe", ["paused"] = "Pozastaveno", ["probe_ip"] = "Sonda IP", ["probe_timeout_idle"] = "Časový limit nečinnosti", ["probe_timeout_lifetime"] = "Životní časový limit", ["probe_zmq_drops_export_queue_full"] = "Plné přerušené toky ve frontě", ["probe_zmq_drops_flow_collection_drops"] = "Flow Collection Drops", ["probe_zmq_drops_flow_collection_udp_socket_drops"] = "Collection Socket Drops", ["probe_zmq_num_endpoints"] = "Koncové body aktivní sondy ZMQ", ["probe_zmq_num_flow_exports"] = "Exportované toky", ["public_probe_ip"] = "IP veřejné sondy", ["received_traffic"] = "Přijatý provoz", ["remote_probe"] = "Vzdálená sonda", ["remote_probe_collector_mode"] = "Sběratelský režim", ["reset_counters"] = "Reset čítačů", ["rrd_timeseries"] = "RRD Timeseries", ["send_error"] = "Chyba při odesílání", ["sflow_counter_updates"] = "Aktualizace čítačů", ["shaped_filtered_packets"] = "Shaped / filtrované pakety", ["snmp"] = "SNMP", ["state"] = "Země / Stát", ["traffic_breakdown"] = "Porucha provozu", ["traffic_statistics"] = "Statistiky provozu", ["zmq_avg_msg_flows"] = "Průměrné toky na zprávu", ["zmq_message_drops"] = "Zrušené zprávy ZMQ", ["zmq_message_rcvd"] = "Shromážděné zprávy ZMQ", ["zmq_rx_statistics"] = "Statistiky ZMQ", }, ["index_page"] = { ["applications"] = "Aplikace", ["asns"] = "ASNs", ["dashboard"] = "Přístrojová deska", ["hosts"] = "Hosts / Hostitelé", ["live_update"] = "Live update", ["minute"] = "Minuta", ["never"] = "Nikdy", ["no_packet_warning"] = "Na rozhraní zatím nebyl přijat žádný paket %{ifname}.<p> prosím čekejte %{countdown} sekund, než se tato stránka znovu načte.", ["refresh"] = "Obnovit", ["refresh_frequency"] = "Obnovovací frekvence", ["refresh_graph_popup_msg"] = "Aktualizovat graf", ["seconds"] = "Sekund", ["senders"] = "Odesílatelé", ["top_flow_talkers"] = "Top Flow Talkers", }, ["internals"] = { ["hash_entries"] = "Hash Entries", ["hash_table"] = "Hash Table", ["state_idle"] = "Položky ve stavu nečinnosti", ["state_ready_to_be_purged"] = "Záznamy ve státě připravené k očištění", }, ["live_capture"] = { ["active_live_captures"] = "Živý provoz", ["note"] = "Zachyťte živý provoz hostitele %{hostinfo}. Stream se automaticky zastaví po 1 minutě nebo 100 000 paketech.", }, ["live_traffic"] = { ["error_generic"] = "Obecná chyba", ["error_not_found"] = "Nenalezeno", ["error_not_granted"] = "Žádosti nebylo vyhověno", ["modal_vlan_tagged_with_bpf_confirmation"] = "Tento hostitel je označen VLAN. Filtr BPF odeslaný, aby správně odpovídal paketům, musí obsahovat VLAN 51. VLAN lze ve filtru zadat jako <br> <pre>vlan %{vlan} and <i>...rest of the filter...</i></pre>", ["modal_vlan_tagged_with_bpf_continue"] = "Pokračovat", ["modal_vlan_tagged_with_bpf_title"] = "Host pcap Download", }, ["local_flow_matrix"] = { ["error_no_local_hosts"] = "Nebyli nalezeni žádní místní hostitelé", ["local_flow_matrix"] = "Matice lokálního toku", ["local_hosts_active_flows_matrix"] = "Local hosts active flows matrix", }, ["local_hosts_stats"] = { ["criteria"] = "Kritéria", ["looking_glass"] = "Looking Glass", }, ["locales"] = { ["de"] = "Německý", ["en"] = "Anglický", ["it"] = "Italský", ["jp"] = "Japonský", ["pt"] = "Portugalský", }, ["login"] = { ["add_captive_portal_user"] = "Přidat uživatele zajatého portálu", ["add_web_user"] = "Přidat webového uživatele", ["auth_success"] = "Ověření úspěšné", ["blacklisted_ip_notice"] = "Příliš mnoho neúspěšných pokusů o ověření. Zkuste to prosím znovu po 5 minutách.", ["change_password"] = "Změnit heslo", ["confirm_password"] = "Potvrďte heslo", ["device_label"] = "Štítek zařízení", ["donation"] = "Pokud si myslíte, že je %{product} užitečný, prosím, podpořte nás zde <A href=\"%{donation_url}\">donation</A>. Vaše financování pomůže řídit a podporovat rozvoj tohoto projektu. Děkuji.", ["enter_credentials"] = "Zadejte prosím své přihlašovací údaje pro přístup k této síti.", ["informative_captive_join"] = "Přístup na internet", ["informative_captive_portal_tos"] = "Přečetl jsem a souhlasil s <a target='_blank' href='%{url}'>podmínky služby</a>.", ["internet_redirecting"] = "Přesměrujeme vás na internet...", ["license"] = "%{product} je propuštěn pod <a href=\"%{license_url}\">%{license}</a>.", ["logging_out"] = "Odhlášování...", ["login"] = "Přihlásit se", ["logout"] = "Odhlásit se", ["logout_user_x"] = "Odhlásit %{user}", ["must_change_password"] = "Výchozí heslo správce musí být změněno. Níže zadejte nové heslo.", ["password"] = "Heslo", ["password_mismatch"] = "Hesla se neshodují", ["password_not_valid"] = "Zadejte jiné heslo", ["password_pattern_error"] = "Zadejte alespoň 5 platných znaků.", ["password_ph"] = "Heslo (výchozí správce)", ["passwords_dont_match"] = "Hesla se neshodují.", ["unsupported_browser"] = "Váš prohlížeč není podporován. <br> Zvažte použití nedávného prohlížeče Firefox nebo Chrome.", ["username"] = "Uživatelské jméno", ["username_ph"] = "Uživatelské jméno (výchozí správce)", ["web_users"] = "Uživatelé webu", ["welcome_to"] = "Vítejte v %{product}", }, ["mac_details"] = { ["json_error_inactive"] = "Chyba JSON: neaktivní host očištěn nebo %{product} ukončen?", ["mac"] = "Mac", ["mac_cannot_be_found_message"] = "Mac %{mac} nemůže být nalezen.", ["mac_parameter_missing_message"] = "Chybí parametr Mac (interní chyba?)", ["reset_mac_stats"] = "Resetování statistik Mac", ["reset_mac_stats_note"] = "<b>POZNÁMKA</b>: historické charts pro tuto mac adresu mohou mít po resetu mezeru.", ["reset_stats_in_progress"] = "Statistiky Mac budou resetovány do 5 sekund", }, ["mac_stats"] = { ["all_devices"] = "Vše", ["all_layer_2_devices"] = "Všechna zařízení", ["all_manufacturers"] = "Všichni výrobci", ["arp_total"] = "ARP", ["dev_layer_2_devices"] = "%{device_type} zařízení", ["dhcp_only"] = "Jen DHCP", ["filter_macs"] = "Filtrujte Mac", ["idle_devices_not_listed"] = "Nečinná zařízení nejsou uvedena.", ["layer_2_dev_devices"] = "%{device_type} uařízení", ["layer_2_devices_with_manufacturer"] = "%{manufacturer} %{title}", ["layer_2_source_devices"] = "%{device_type} zařízení", ["manufacturer"] = "Výrobce", ["source_macs"] = "Pouze zdroj", }, ["manage_data"] = { ["all_hosts"] = "Vše", ["delete"] = "Odstranit data hostitele", ["delete_active_interface"] = "Odstranit data rozhraní", ["delete_inactive_interfaces"] = "Odstranit neaktivní data rozhraní", ["delete_system_interface_data"] = "Odstraňte data systémového rozhraní", ["delete_tab"] = "Odstranit", ["export"] = "Export dat hostitele", ["export_tab"] = "Export", ["hosts"] = "Hosts / Hostitelé", ["ip_or_mac_address"] = "IP nebo MAC adresa nebo / 24", ["local_hosts"] = "Lokální", ["mac_or_ip_required"] = "Vložte prosím platnou adresu IP nebo MAC", ["manage_data"] = "Správa dat", ["remote_hosts"] = "Vzdálený", ["single"] = "Singl", ["system_interface_note"] = "Data rozhraní systému zahrnují všechna data umístěná v položce nabídky System, například data CPU, InfluxDB a SNMP.", }, ["manage_users"] = { ["add_new_user"] = "Přidat nového uživatele", ["administrator"] = "Správce", ["allowed_interface"] = "Povolené rozhraní", ["allowed_networks"] = "Povolené sítě", ["allowed_networks_descr"] = "Seznam sítí oddělených čárkami, které může tento uživatel zobrazit. Například:", ["allowed_passwd_charset"] = "Povolené znaky jsou velká a malá písmena, čísla a speciální symboly ISO 8859-1 (latin1)", ["any_interface"] = "Jakékoli rozhraní", ["authentication_lifetime"] = "Životnost autentizace", ["change_user_password"] = "Změnit heslo uživatele", ["change_user_preferences"] = "Změnit předvolby uživatele", ["confirm_delete_user"] = "Jste si jistí, že chcete smazat %{user}?", ["enable_captive_portal"] = "<a href=\"%{url}\">Aktivace zajatého portálu</a> umožňuje definovat uživatele portálu v zajetí", ["expires_after"] = "Platnost končí", ["group"] = "Skupina", ["host_pool_id"] = "ID hostitelského fondu", ["manage"] = "Spravovat", ["manage_user_x"] = "Spravovat uživatele %{user}", ["manage_users"] = "Spravovat uživatele", ["new_password"] = "Nové Heslo", ["new_password_confirm"] = "Potvrďte nové heslo", ["no_host_pools"] = "Nejsou definovány žádné hostitelské fondy. Vytvořte je prosím zde <a href='%{url}'>zde</a>", ["non_privileged_user"] = "Uživatel bez oprávnění", ["old_password"] = "Staré heslo", ["the_auth_can_be_perpetual"] = "Ověřování může být trvalé nebo může vypršet po stanovené době", ["the_host_pool_associated"] = "Fond hostitelů, který bude při úspěšném ověření přidružen k uživateli", ["unlimited"] = "Neomezený", ["user_role"] = "Uživatelská role", ["web_captive_users"] = "Uživatelé portálu Web / Captive Portal", }, ["metrics"] = { ["days"] = "Dny", ["hours"] = "Hodiny", ["mins"] = "Minuty", ["secs"] = "Sekundy", }, ["ndpi_page"] = { ["custom_applications"] = "Vlastní aplikace", ["live_flows_count"] = "Počet živých toků", ["note"] = "POZNÁMKA", ["note_historical_per_protocol_traffic"] = "Historická %{what} provozní data lze povolit prostřednictvím <a href='%{url}'>%{flask_icon} Preference</a>.", ["note_live_flows_chart"] = "Tento chart zobrazuje pouze připojení TCP", ["note_possible_probing_alert"] = "Ikona jako %{icon} označuje možnou výstrahu sondování (nebo výpadku aplikačního serveru), protože hostitel přijal provoz pro konkrétní aplikaci, aniž by poslal zpět jakákoli data. Můžete použít <A HREF='%{url}'>historické zprávy</A> aby jste podrobněji rozebrali tento problém.", ["note_protocol_usage_time"] = "Doba využití aplikace se počítá v diskrétních intervalech slotů.", ["overview"] = "%{what} přehled", ["rcvd"] = "Rcvd", ["received_only"] = "Pouze přijato", ["sent"] = "Odesláno", ["sent_only"] = "Pouze odesláno", ["total_since_startup"] = "Celkem (od spuštění)", ["unable_to_find_host"] = "Neschopen najít %{host_ip} (data vypršela?)", }, ["nedge"] = { ["a_member_address_is"] = "Členská adresa je pravidlo pro přiřazení zařízení uživateli. Platí následující pořadí:", ["a_zero_quota_is_unlimited"] = "Nulová kvóta znamená neomezený provoz.", ["active_user"] = "Aktivní uživatel", ["add_gateway"] = "Přidat bránu", ["add_member"] = "Přidat člena", ["add_port_forwarding_rule"] = "Přidat pravidlo předávání portů", ["add_routing_policy"] = "Přidat politiku směrování", ["add_some_gateways_first"] = "Nejsou definovány žádné brány. Určete některé brány zde <a href=\"%{url}\">zde</a>.", ["add_static_lease"] = "Přidat statický pronájem", ["add_static_route"] = "Přidat statickou trasu", ["add_system_user"] = "Přidat uživatele systému", ["add_user_member"] = "Přidat uživatele", ["applied_policy"] = "Aplikovaná politika", ["apply_and_reboot"] = "Použít a restartovat", ["apply_and_restart_self"] = "Použít a restartovat", ["apply_configuration"] = "Použít konfiguraci", ["apply_configuration_and_reboot"] = "Chystáte se použít novou konfiguraci. Síťová rozhraní budou překonfigurována podle zadaných nastavení a systém bude restartován. Špatné nastavení může způsobit, že systém ztratí připojení IP. Pokračujte pouze v případě, že jste si velmi jistí, že jsou nastavení správná.", ["apply_configuration_and_restart_self"] = "Chystáte se použít novou konfiguraci. To způsobí %{product} restartování a může způsobit, že toto webové GUI přestane reagovat na několik sekund.", ["apply_the_initial_device_configuration"] = "Použijte počáteční konfiguraci zařízení.", ["authentication_gui_and_captive_portal"] = "Metody ověřování platí pro %{product} gui a <a href=\"%{url}\">Captive Portal</a> přístup", ["bandwidth_allocation"] = "Přidělení šířky pásma", ["bind_to_any"] = "Jakékoli rozhraní", ["bind_to_lan"] = "Rozhraní LAN", ["cannot_rename_gateway"] = "Nelze přejmenovat bránu.", ["cannot_rename_policy"] = "Nelze přejmenovat politiku.", ["cannot_rename_static_route"] = "Statickou trasu nelze přejmenovat.", ["captive_portal_other_methods"] = "Portál Captive Portal používá metody ověřování definované v <a href=\"%{url}\">Předvolbě ověřování</a> (např. poloměr).", ["categories_policies"] = "Politiky kategorií", ["configure_routing_policies"] = "Konfigurace politiky směrování", ["configured_members"] = "Konfigurovaní členové", ["confirm_delete_gateway"] = "Opravdu chcete smazat bránu \"%{gw}\" ?", ["confirm_delete_policy"] = "Opravdu chcete politiku odstranit \"%{policy}\" ?", ["confirm_delete_port_forwarding_rule"] = "Opravdu chcete odstranit zadané pravidlo?", ["confirm_delete_static_lease"] = "Opravdu chcete smazat \"%{hostname}\" statický pronájem?", ["confirm_delete_static_route"] = "Opravdu chcete smazat statickou trasu \"%{sr}\" ?", ["confirm_remove_member_from_user"] = "Opravdu chcete člena odebrat %{member} od uživatele %{user}?", ["could_not_add_port_forwarding"] = "Nelze přidat pravidlo předávání portů", ["custom"] = "Vlastní", ["custom_datetime"] = "Aktuální čas", ["custom_datetime_descr"] = "Ručně nastavuje datum a čas systému.", ["custom_policy"] = "Vlastní politika", ["data_reset"] = "Reset dat", ["data_reset_msg"] = "Opravdu chcete resetovat všechna data zařízení? Data zahrnují uložené časové úseky, toky, upozornění, Redis cache a čítače hostitele. Reset zařízení nebude mít vliv na konfiguraci zařízení a nastavení systému. <br> To způsobí restartování%{product} a to může způsobit, že toto webové GUI přestane reagovat na několik sekund.", ["date_time"] = "Datum a čas", ["default_categories"] = "Výchozí politiky kategorií", ["default_categories_with_a_defined_policy"] = "Výchozí politika vlastní kategorie", ["default_categories_with_a_defined_quota"] = "Výchozí politika kategorií kvót", ["default_categories_with_policy_x"] = "Výchozí%{x} politika kategorií", ["default_gateway"] = "Výchozí brána", ["default_policy"] = "Výchozí politika", ["default_protocols"] = "Výchozí politika aplikace", ["default_protocols_with_a_defined_policy"] = "Výchozí politika vlastní aplikace", ["default_protocols_with_a_defined_quota"] = "Výchozí politika aplikace kvót", ["default_protocols_with_policy_x"] = "Výchozí%{x} aplikační politika", ["default_shaper"] = "Pass", ["default_shaper_descr"] = "Výchozí procento šířky pásma rychlosti rozhraní.", ["delete_gateway"] = "Smazat bránu", ["delete_policy"] = "Smazat politiku", ["delete_port_forwarding_rule"] = "Odstranit pravidlo předávání portů", ["delete_static_lease"] = "Odstranit statický lease", ["delete_static_route"] = "Smazat statickou trasu", ["device_protocol_policy_has_higher_priority"] = "Politika zařízení má vyšší prioritu než politika aplikace.", ["device_protocols_blocked_warning"] = "Provoz bude <b>nebude</b> blokován, protože %{device_protocols_policies} jsou zakázány", ["device_protocols_policies"] = "Politika zařízení", ["dhcp_disabled_warning"] = "Pokud ve vaší síti není k dispozici žádný jiný DHCP server, vaši klienti se nebudou moci automaticky připojit.", ["dhcp_first_ip"] = "První IP adresa", ["dhcp_first_ip_descr"] = "První adresa IP fondu adres DHCP", ["dhcp_last_ip"] = "Poslední IP adresa", ["dhcp_last_ip_descr"] = "Poslední adresa IP fondu adres DHCP", ["dhcp_server"] = "DHCP Server", ["dhcp_server_description"] = "Povolte server DHCP.", ["dhcp_server_not_enabled"] = "Server DHCP není povolen. Můžete ho povolit zde <a href=\"%{url}\">zde</a>.", ["dns_configuration"] = "Konfigurace DNS", ["dns_server_preset"] = "Předvolba serveru DNS", ["dns_server_preset_descr"] = "Ze seznamu můžete vybrat vybrané servery DNS nebo určit vlastní servery DNS.", ["download_description"] = "Maximální rychlost stahování rozhraní.", ["download_speed"] = "Rychlost stahování", ["edit_gateway"] = "Upravit bránu", ["edit_quotas"] = "Upravit kvóty", ["edit_routing_policy"] = "Upravit směrování politiky", ["edit_static_route"] = "Upravit statickou trasu", ["edit_user"] = "Upravit uživatele", ["edit_users"] = "Upravit uživatelé", ["enable_device_protocols_policies"] = "Politika aplikací zařízení", ["enable_interface"] = "Povolit rozhraní", ["enable_interface_descr"] = "Povolení nebo zakázání síťového rozhraní.", ["enable_nat"] = "Povolit NAT", ["enable_nat_descr"] = "Pokud je povolena, budou IP adresy klientů maqueraded s IP adresou rozhraní WAN.", ["enforce_global_dns"] = "Vynutit globální DNS", ["enforce_global_dns_description"] = "Povolte Forging DNS, aby zařízení donutila používat zadaný globální DNS.", ["enternal_port_overlap"] = "Externí port se překrývá s portem %{port} přiřazen k %{ip}", ["external_port"] = "Externí port (WAN)", ["external_port_or_range"] = "Externí port nebo rozsah portů", ["factory_reset"] = "Obnovení do továrního nastavení", ["factory_reset_msg"] = "Opravdu chcete zařízení resetovat do tovární konfigurace? Veškerá konfigurace a data budou ztracena.", ["filter_policies"] = "Politika filtrování", ["gateway"] = "Brána", ["gateway_exists"] = "Brána %{gw} již existuje.", ["gateway_interface_descr"] = "Určete síťové rozhraní, které se použije k určení IP adresy brány", ["gateway_name"] = "Název brány", ["gateway_type"] = "Režim", ["gateway_type_address_descr"] = "Zadejte IP adresu brány.", ["gateway_x"] = "Brána %{gw}", ["gateways"] = "Brány", ["gateways_status"] = "Stav brán", ["global_dns"] = "Globální DNS", ["global_shapers_rates"] = "Globální kontrola šířky pásma", ["high_priority"] = "Vysoká priorita", ["higher_priority"] = "Vyšší priorita", ["hostname"] = "Název hostitele", ["hostname_lease_exists"] = "Statický lease s názvem hostitele \"%{hostname}\" již existuje.", ["interfaces_configuration"] = "Konfigurace rozhraní", ["internal_ip"] = "Interní IP (LAN)", ["internal_port"] = "Interní port (LAN)", ["internal_port_number"] = "Vnitřní číslo portu", ["internal_port_overlap"] = "Interní port se překrývá s %{internal_port} již mapováno na externí port %{external_port}", ["invalid_dhcp_range"] = "Neplatný rozsah DHCP. Ujistěte se, že IP adresy DHCP jsou uvnitř rozsahu sítě LAN, jinak vaše zařízení nebude moci procházet web.", ["invalid_port_range"] = "Neplatný rozsah portů", ["ip_address_takes_preced"] = "IP adresa má přednost před síťovou adresou", ["ip_lease_exists"] = "Statický lease s IP \"%{ip}\" již existuje", ["lan"] = "LAN", ["lan_ip_addr"] = "IP adresa LAN", ["lan_ip_addr_descr"] = "Zadejte IP adresu rozhraní LAN.", ["lan_recovery_ip"] = "LAN Recovery IP", ["lan_recovery_ip_descr"] = "Další adresa IP k dosažení zařízení%{product} v rozhraní LAN.", ["lan_recovery_warning"] = "Ujistěte se, že to nekoliduje s žádnou jinou definovanou sítí.", ["link_not_ready"] = "Odkaz není připraven", ["linkdown"] = "Link Down", ["low_priority"] = "Nízká priorita", ["lower_priority"] = "Nižší priorita", ["mac_address_takes_preced"] = "Mac adresa má přednost před IP adresou", ["mac_lease_exists"] = "Statický lease pro Mac \"%{mac}\" již existuje.", ["max_bps_per_host"] = "Max %{bps} na hostitele", ["max_perc"] = "Max %{perc}%%", ["max_rrt"] = "Max RTT", ["max_rrt_description"] = "Maximální doba zpáteční cesty směrem k adrese monitoru. Pokud naměřená RTT překročí tuto hodnotu, brána se považuje za spadlou.", ["maximum_enforced"] = "Maximální vynucení", ["maximum_enforced_descr"] = "Pokud je nastaveno na maximální vynucení, bude maximální přidělování šířky pásma vynuceno bez ohledu na dostupnou šířku pásma.", ["member_address"] = "Adresa člena", ["member_exists"] = "Člen %{member} nepřidán, protože je již přiřazen k uživateli %{existing_user}", ["members"] = "Členové", ["members_for_user_x"] = "Členové uživatele %{user}", ["min_perc"] = "Min %{perc}%%", ["minimum_guaranteed"] = "Minimální zaručená", ["minimum_guaranteed_descr"] = "Pokud je nastavena na minimální zaručené, bude zaručeno pouze minimální přidělení šířky pásma.", ["mode"] = "Režim", ["nedge"] = "nEdge", ["network_conf_dhcp"] = "DHCP", ["network_conf_iface_descr"] = "Určete režim adresy IP rozhraní.", ["network_conf_iface_gw"] = "IP adresa výchozí brány rozhraní (např. 192.168.1.1).", ["network_conf_iface_ip"] = "IP adresa rozhraní (např. 192.168.1.10).", ["network_conf_iface_nmask"] = "Maska sítě rozhraní (např. 255.255.255.0).", ["network_conf_iface_title"] = "%{ifrole} Rozhraní %{ifname}", ["network_conf_static"] = "Statický", ["network_conf_vlan_trunk"] = "VLAN Trunk", ["no_gateways_defined"] = "Nejsou definovány žádné brány.", ["no_interfaces_available"] = "Nejsou k dispozici žádná rozhraní.", ["no_routing_policies_defined"] = "Nejsou definovány žádné politiky směrování", ["no_rules"] = "Bez pravidel", ["no_static_leases"] = "Žádné statické leases", ["no_static_routes_defined"] = "Není definována žádná statická trasa.", ["ntp_sync"] = "NTP Synchronizace", ["ntp_sync_descr"] = "Přepněte synchronizaci se serverem NTP.", ["per_ip_rates"] = "Řízení šířky pásma na hostitele", ["ping_address"] = "Sledovat adresu", ["ping_address_description"] = "Adresa, kterou chcete sledovat a ověřit stav brány.", ["please_fill_out_this_field"] = "Prosím, vyplňte toto pole.", ["policy_due_to_source"] = "%{policy} kvůli %{source}", ["policy_name"] = "Název politiky", ["port_forwarding"] = "Port Forwarding", ["power_off"] = "Vypnout", ["power_off_confirm"] = "Opravdu chcete zařízení vypnout?", ["priority_x"] = "Přednost %{x}", ["protocol_policy_has_higher_priority"] = "Politika aplikace má vyšší prioritu než politika kategorie.", ["protocols_policies"] = "Politika aplikace", ["reboot"] = "Restartujte", ["reboot_corfirm"] = "Chcete zařízení restartovat?", ["remove_all_members"] = "Odebrat všechny členy", ["remove_all_members_confirm"] = "Opravdu chcete odstranit všechny členy uživatele %{user}?", ["reset_and_reboot"] = "Reset a restartování", ["reset_and_restart_self"] = "Reset a restartartování", ["restrict_weg_gui_access_description"] = "Omezte přístup k tomuto webovému rozhraní pro správu, aby bylo přístupné pouze z rozhraní LAN (bezpečnější) nebo z jakéhokoli rozhraní systému (méně zabezpečené).", ["restrict_weg_gui_access_title"] = "Správa přístupu k webovému GUI", ["router"] = "Router", ["router_mode_requires_enterprise"] = "Režim směrovače je k dispozici pouze v edici nedge Enterprise.", ["routing"] = "Směrování", ["routing_policies"] = "Politiky směrování", ["routing_policy"] = "Politika směrování", ["routing_policy_exists"] = "Politika směrování \"%{policy}\" již existuje.", ["safe_search_description"] = "Nevhodný obsah blokujte pomocí DNS bezpečného pro děti.", ["search_categories"] = "Hledat kategorie", ["search_protocols"] = "Prohledat aplikace", ["security"] = "Zabezpečení", ["set_the_device_mode"] = "Nastavte provozní režim zařízení.", ["setup_apply"] = "Aplikovat", ["setup_config_edited_descr"] = "Použijte změny, aby byla nová konfigurace účinná, nebo je zahoďte, abyste ji nadále používali.", ["setup_config_edited_title"] = "Konfigurace systému byla upravena!", ["setup_discard"] = "Zahodit", ["setup_mode"] = "Pracovní režim", ["setup_network"] = "Síť", ["shapers"] = "Řízení šířky pásma", ["single_port_router"] = "Single Port Router", ["slow_pass_shaper_descr"] = "Procento šířky pásma pomalého průchodu rychlosti rozhraní.", ["slower_pass_shaper_descr"] = "Procento pomalejší propustnosti rychlosti rozhraní.", ["specify_a_protocol"] = "Určete aplikaci", ["static_dhcp_leases"] = "Statické leases serveru DHCP", ["static_route_address_descr"] = "Určete cíl pro statickou trasu.", ["static_route_exists"] = "Statická trasa %{sr} již existuje.", ["static_route_is_local_descr"] = "Určete, zda se jedná o statickou cestu do místní sítě. Všichni hostitelé na statické cestě do místní sítě jsou považováni za místní hostitele.", ["static_route_is_local_title"] = "Statická trasa místní sítě", ["static_route_name"] = "Statický název trasy", ["static_route_netmask_descr"] = "Určete masku sítě, která se použije pro cíl statické trasy.", ["static_route_via_descr"] = "Zadejte adresu IP, která se použije jako další směrování pro statickou trasu.", ["static_route_x"] = "Statická trasa %{sr}", ["static_routes"] = "Statické trasy", ["static_routes_in_policies"] = "Statické cesty jsou aplikovány na (a mají přednost před) některou z definovaných <a href=\"%{url}\"> politik směrování</a>.", ["status_activate"] = "Aktivovat", ["status_connected"] = "Připojeno", ["status_connecting"] = "Připojování", ["status_deactivate"] = "Deaktivovat", ["status_disabled"] = "Vypnuto", ["status_disconnected"] = "Odpojeno", ["status_down"] = "Down", ["status_failed"] = "Selhalo", ["status_inactive"] = "Neaktivní", ["status_unreachable"] = "Nedostupné", ["status_up"] = "Up", ["system_setup"] = "Nastavení systému", ["system_users"] = "Uživatelé systému", ["test_policies"] = "Politika testování", ["test_policies_page_description"] = "Tato stránka může být použita k ověření, jaké budou politiky použité na internetu %{user} zařízení na základě aktuální konfigurace.", ["the_fallback_policy"] = " <a href=\"%{url}\">Záložní politika</a> se použije, když je nastavena jako uživatel, tak globální politika pro danou aplikaci a její odpovídající kategorii \"Výchozí\".", ["the_not_assigned_user_contains"] = " \"Nepřiřazené\" uživatele lze použít k definování politiky pro zařízení, která nejsou přiřazena žádnému uživateli.", ["the_primary_dns_server"] = "Primární server DNS", ["the_secondary_dns_server"] = "Sekundární server DNS", ["timezone"] = "Časové pásmo", ["timezone_descr"] = "Nastavuje časové pásmo systému.", ["upload_description"] = "Maximální rychlost odesílání rozhraní.", ["upload_speed"] = "Rychlost nahrávání", ["user"] = "Uživatel", ["user_categories"] = "Politika kategorií pro uživatele %{user}", ["user_categories_with_a_defined_policy"] = "Politika vlastní kategorie pro uživatele %{user}", ["user_categories_with_a_defined_quota"] = "Politika kategorií kvót pro uživatele %{user}", ["user_categories_with_policy_x"] = "%{x} Politika kategorií pro uživatele %{user}", ["user_category_policies"] = "Politika kategorií uživatele", ["user_device_protocols"] = "Politika aplikace pro aplikační politiky pro %{user} zařízení", ["user_protocols"] = "Politika aplikace pro uživatele %{user}", ["user_protocols_with_a_defined_policy"] = "Vlastní aplikační politiky pro uživatele %{user}", ["user_protocols_with_a_defined_quota"] = "Politika aplikace kvót pro uživatele %{user}", ["user_protocols_with_policy_x"] = "%{x} Politika aplikace pro uživatele %{user}", ["users_list"] = "Seznam uživatelů", ["view_quotas"] = "Zobrazit kvóty", ["wan"] = "WAN", ["wan_interface"] = "WAN Rozhrání", ["with_quota"] = "S kvótou", ["x_shaper_per_host_descr"] = " %{shaper} maximální přidělení šířky pásma na hostitele. 0 je pro neomezené.", ["you_can_assign_routing_policy"] = "Můžete přiřadit politiky směrování <a href=\"%{url}\">uživatelům </a>.", ["you_can_assign_shapers_to_users_protocols"] = "Můžete přiřadit politiku šířky pásma <a href=\"%{url}\">uživatelům</a> konkrétní aplikace nebo je nastavit globálně jako <a href=\"%{url2}\">Záložní politika</a>.", ["you_can_set_static_dhcp_lease_here"] = "Můžete nakonfigurovat statické leases DHCP zde <a href=\"%{url}\">zde</a>.", ["you_can_use_gateways_in_policies"] = "Priority bran můžete určit v <a href=\"%{url}\">politikách směrování</a>.", ["policy_source_labels"] = { ["policy_source_category"] = "Politika kategorií", ["policy_source_default"] = "Neznámý", ["policy_source_device_protocol"] = "Politika aplikace zařízení", ["policy_source_pool"] = "Výchozí politika", ["policy_source_protocol"] = "Politika aplikace", }, }, ["network_alert_config"] = { ["trigger_alerts_for_network"] = "Spusťte výstrahy pro síť %{network}", ["trigger_network_alerts"] = "Spusťte výstrahy sítě", }, ["network_details"] = { ["network"] = "Síť", ["network_alias"] = "Alias sítě", ["network_parameter_missing_message"] = "Chybí parametr sítě (interní chyba?)", ["no_available_stats_for_network"] = "Žádné dostupné statistiky pro síť %{network}", }, ["network_stats"] = { ["network_list"] = "Seznam sítí", ["network_name"] = "Jméno sítě", ["networks"] = "Sítě", ["networks_traffic_with_ipver"] = "%{networks} s IPv%{ipver} provozem", ["note_broader_network"] = "Širší síť nebude zahrnovat hostitelé definované v menších sítích.", ["note_overlapping_networks"] = "<b>POZNÁMKA</b>:V případě, že jste definovali překrývající se sítě:", ["note_see_both_network_entries"] = "Ve výše uvedené tabulce uvidíte obě síťové položky.", }, ["os_stats"] = { ["hosts_by_operating_system"] = "Hostitelé podle operačního systému", }, ["packets_page"] = { ["arp_distribution"] = "Distribuce ARP", ["ip_version_distribution"] = "Distribuce verze IP", ["lost"] = "Ztracený", ["out_of_order"] = "Mimo provoz", ["received_distribution"] = "Přijatá distribuce", ["retransmissions"] = "Opakované přenosy", ["sent_distribution"] = "Odeslána distribuce", ["sent_vs_rcvd_distribution"] = "Sent / Rcvd Distribuce", ["size_distribution"] = "Distribuce velikosti", ["tcp_flags_distribution"] = "Distribuce příznaků TCP", ["tcp_flags_vs_arp_distribution"] = "TCP Flags / ARP Distribuce", ["tcp_packets_analysis"] = "Analýza paketů TCP", ["version_vs_flags_distribution"] = "IP version / TCP Flags Distribuce", }, ["peers_page"] = { ["host"] = "Host", ["no_active_flows_message"] = "Pro zadaného hostitele nebyly zpozorovány žádné aktivní toky", ["top_peer_protocol"] = "Top aplikace Peer", ["top_peers_for_host"] = "Top %{hostkey} Peers", ["traffic_volume"] = "Traffic Volume", }, ["please_wait_page"] = { ["command"] = "Příkaz", ["database"] = "Databáze", ["host"] = "Host / Hostitel", ["id"] = "Id", ["info"] = "Info", ["operations_on_database_msg"] = "Aktuálně prováděné operace v databázi jsou následující:", ["state"] = "Stav", ["time"] = "Čas", ["user"] = "Uživatel", ["waiting_for_db_msg"] = "Probíhá migrace schématu databáze, čekání na databázi <b>%{dbname}</b> aby byla funkční. Jakmile bude databáze připravena, budete přesměrováni. V závislosti na velikosti existující databáze může tato operace trvat dlouho. Migrace se provádí pouze jednou a pouze během hlavních upgradů verzí. Pokud máte pochybnosti, kontaktujte vývojáře na adrese <a href='mailto:info@ntop.org'>info@ntop.org</a>.", }, ["policy_presets"] = { ["business"] = "Podnikání", ["business_description"] = "Předvolba pro zaměstnance obchodní společnosti", ["child"] = "Dítě", ["child_description"] = "Předvolba pro děti. Blokuje sociální sítě a omezuje herní čas", ["default"] = "Výchozí", ["guests"] = "Hosté", ["guests_description"] = "Předvolba pro hosty. Povolena je pouze základní navigace", ["no_obfuscation"] = "Žádné zmatení", ["no_obfuscation_description"] = "Předvolba, která zabrání zmatení provozu", ["walled_garden"] = "Walled Garden", ["walled_garden_description"] = "Blokuje VPN a sociální sítě", }, ["pool_details"] = { ["host_pool"] = "Hostitelský fond", ["host_pool_timeseries_enable_message"] = "Časový rozvrh hostitelského fondu lze povolit z <A HREF=\"%{url}\">%{icon_flask} Preference</A>. K zobrazení prvních datových bodů je třeba jen pár minut.", ["no_available_data_for_host_pool_message"] = "Pro hostitelský fond nejsou k dispozici žádná data '%{pool_name}'.", ["pool_parameter_missing_message"] = "Chybí parametr (interní chyba?)", }, ["pool_stats"] = { ["host_pool_list"] = "Seznam hostitelských fondů", }, ["port_details"] = { ["active_flows_for_host_and_port"] = "Aktivní toky pro %{host}:%{port}", ["active_flows_on_port"] = "Aktivní toky na portu %{port}", ["active_flows_on_port_symbolic"] = "Aktivní toky na portu %{port} [%{symbolic_port}]", ["l4_port"] = "L4 Port", }, ["ports_page"] = { ["client_ports"] = "Klientské porty", ["server_ports"] = "Porty serveru", }, ["prefs"] = { ["active_local_host_cache_interval_description"] = "Interval mezi po sobě jdoucími výpisy z mezipaměti aktivníhi místního hostitele. Výchozí: 1 hodina.", ["active_local_host_cache_interval_title"] = "Interval mezipaměti místního hostitele", ["admin_group_description"] = "Název skupiny, do které se musí uživatel patřit, aby se mohl autentizovat jako správce.", ["admin_group_title"] = "LDAP Admin Group", ["alert_entity"] = "Varovná entita", ["alerts_notifications"] = "Koncové body výstrah", ["alerts_retention"] = "Uchovávání výstrah", ["alerts_settings"] = "Nastavení výstrah", ["all"] = "Vše", ["auth_methods_order"] = "Pořadí ověření metod ověření je stejné jako výše uvedené pořadí výpisu, např. pokud jsou povoleny jako LDAP, tak i místní autorizace, LDAP bude nejprve zkontrolována a pokud selže autentizace, bude dále zkontrolována lokální autorizace.", ["authentication"] = "Ověřování", ["authentication_duration"] = "Doba autentizace", ["authentication_duration_descr"] = "Doba, po které je relace ověřeného uživatele ukončena a je nutné znovu autentizovat. Změny ovlivní pouze nově vytvořené relace.", ["authentication_duration_title"] = "Trvání ověřené relace", ["authentication_midnight_expiration_descr"] = "Přepíná ukončení relací o půlnoci a nutí všechny autentizované uživatele, aby se znovu autentizovali po půlnoci.", ["authentication_midnight_expiration_title"] = "Ověřené ukončení relace o půlnoci", ["bind_dn_description"] = "Vázat rozlišující název serveru LDAP. Příklad:", ["bind_dn_title"] = "LDAP Bind DN", ["bind_pwd_description"] = "Bind heslo používané k ověření pomocí serveru LDAP.", ["bind_pwd_title"] = "LDAP Bind ověřovací heslo", ["both"] = "Oba", ["cache_settings"] = "Nastavení mezipaměti", ["captive_portal_disabled_message"] = "Toto tlačítko je <b>vypnuté</b> ,protože webové GUI ntopng NENÍ spuštěno na portu 80, který je vyžadován portálem v zajetí (parametr příkazového řádku -w, např. -w 80,3000).", ["captive_portal_url_description"] = "Adresa URL, na kterou budou vaši klienti přesměrováni po úspěšné autentizaci portálu", ["captive_portal_url_title"] = "Adresa URL přesměrování", ["client_x509_auth"] = "Ověření klienta HTTPS", ["client_x509_auth_descr"] = "Přepněte ověřování klientů na základě jejich certifikátu X.509. Pokud se klient X.509 Common Name (CN) rovná jednomu z uživatelů ntopng, je klient autentizován jako uživatel ntopng. Změny tohoto nastavení vyžadují restartování ntopng.", ["client_x509_auth_title"] = "Ověření certifikátu klienta X.509", ["could_not_contact_influxdb"] = "Nelze kontaktovat databázi InfluxDB: %{msg}", ["data_retention"] = "Uchovávání dat", ["data_retention_descr"] = "Počet dní, po které se budou uchovávat dumpingové toky, historické časy a Top Talkers. Výchozí: 30 dní.", ["default_snmp_community_description"] = "Výchozí komunita SNMP se používá při pokusu o procházení SNMP MIB vybraného lokálního hostitele, který nebyl nakonfigurován na stránce zařízení SNMP..", ["default_snmp_community_title"] = "Výchozí komunita SNMP", ["default_snmp_proto_version_description"] = "Výchozí verze protokolu SNMP.", ["default_snmp_proto_version_title"] = "Výchozí verze SNMP", ["device_identifier"] = "Identifikátor zařízení", ["device_identifier_descr"] = "Obvykle jsou zařízení identifikována pomocí MAC adresy. Pokud jsou však zařízení za routerem, je místo toho identifikovatelná IP adresa.", ["disable_alerts_generation_description"] = "Přepněte celkové generování výstrah.", ["disable_alerts_generation_title"] = "Povolit upozornění", ["dns"] = "DNS", ["dns_service"] = "Servis", ["dump_settings"] = "Výpis databáze toku", ["dynamic_interfaces_creation_description"] = "Aktivovat Alertsntopng může pomocí kritéria rozdělit příchozí provoz. Když je vybráno kritérium rozdělování, ntopng použije hodnotu kritéria k přesměrování příchozího provozu na dynamicky vytvořená rozhraní. Například při výběru kritéria „VLAN Id“ bude pro každé pozorované ID VLAN vytvořeno dynamické rozhraní a příchozí provoz bude přesměrován na jedno dynamické rozhraní v závislosti na hodnotě ID VLAN.", ["dynamic_interfaces_creation_note_0"] = "Rozdělení VLAN Id je podporováno jak pro fyzická rozhraní, tak pro toky přijaté přes ZMQ. Ostatní kritéria pro rozdělování jsou podporována pouze pro toky ZMQ a pro fyzická rozhraní nebudou účinná.", ["dynamic_interfaces_creation_note_1"] = "Změny kritérií neovlivní stávající rozhraní. <b>A Aby se změna projevila, je nutné restartovat ntopng</b>.", ["dynamic_interfaces_creation_note_2"] = "Při použití kritéria „Ingress Interface“ na zařízeních bez proudu, %%INPUT_SNMP se musí objevit v nprobe šabloně.", ["dynamic_interfaces_creation_note_3"] = "'Rozdělovací kritérium rozhraní přidává jakýkoli tok do dvou dynamických rozhraní. Hodnota %%INPUT_SNMP se používá k výběru prvního dynamického rozhraní, zatímco hodnota %% OUTPUT_SNMP se používá k výběru druhého.", ["dynamic_interfaces_creation_note_4"] = "Vlastní disagregace provozu pomocí filtrů typu BPF je k dispozici také deaktivací dynamického disagregace provozu (nastaveno na „Žádná“) na kartě Vlastní disagregace provozu.", ["dynamic_interfaces_creation_title"] = "Dynamická disagregace provozu", ["dynamic_network_interfaces"] = "Dynamická síťová rozhraní", ["elephant_flow_local_to_remote_bytes_description"] = "Množství dat, které může tok nahrát, než se považuje za Elephant Tok", ["elephant_flow_local_to_remote_bytes_title"] = "Prahová hodnota Elephant Toků (místní až vzdálené)", ["elephant_flow_remote_to_local_bytes_description"] = "Množství dat, které může tok stáhnout, než se považuje za Elephant Tok", ["elephant_flow_remote_to_local_bytes_title"] = "Práhová hodnota Elephant Toků (místní až vzdálené)", ["email_notification"] = "Email upozornění", ["email_notification_recipient_description"] = "E-mailová adresa příjemce.", ["email_notification_recipient_title"] = "Příjemce", ["email_notification_sender_description"] = "E-mailová adresa odesílatele.", ["email_notification_sender_title"] = "Odesílatel", ["email_notification_server_description"] = "Server SMTP k doručení e-mailu.", ["email_notification_server_title"] = "SMTP Server", ["email_send_error"] = "Chyba při odesílání e-mailu. Podívejte se prosím na <a href='%{url}'>online dokumentaci</a> pro více podrobností.", ["email_sent_successfully"] = "Email úspěšně odeslán", ["errors"] = "Chyby", ["errors_and_warnings"] = "Chyby a varování", ["ewma_alpha_percent_description"] = "Exponentially Weighted Moving Average (EWMA) alpha coefficient,vyjádřeno v procentech. Používá se k odhadu doby zpoždění autonomních systémů.", ["ewma_alpha_percent_title"] = "EWMA alfas koeficient (v procentech)", ["expert_view"] = "Expert View", ["featured_dns_description"] = "Následuje seznam zabezpečených serverů DNS. Můžete je použít jako globální servery DNS nebo jako poskytovatele bezpečí pro dítě", ["featured_dns_title"] = "Doporučené servery DNS", ["flow_interface"] = "Rozhrání", ["flow_max_idle_description"] = "Čas nečinnosti, po kterém je tok považován za nečinný. Účinné pouze pro rozhraní paketů. U rozhraní ZMQ je časový limit stanoven automaticky. Výchozí: 1 min.", ["flow_max_idle_title"] = "Flow Idle Timeout", ["flows_dump_limited_days"] = "Výpis toku je omezen na %{days} dnů v této verzi ntopng. Chcete-li tento limit odstranit, upgradujte na podnikovou verzi.", ["global_dns_description"] = "Server DNS pro přesměrování požadavků klientů DNS na hostitelské fondy, které nejsou bezpečné pro děti. Pokud je prázdné, přesměrování je zakázáno a použije se výchozí DNS.", ["global_dns_title"] = "Global Primary DNS", ["google_apis_browser_key_description"] = "Geomapy grafických hostitelů jsou založeny na rozhraní API Map Google. Google nedávno změnil politiku přístupu k rozhraní Maps API a nyní vyžaduje, aby byl pro každou žádost odeslán klíč API prohlížeče. Podrobné informace o tom, jak získat klíč API, lze nalézt zde <a href=\"%{url}\">zde</a>. Jakmile je klíč API získán, lze jej vložit do tohoto pole.", ["google_apis_browser_key_title"] = "Klíč prohlížeče Google APIs Browser Key", ["host_mask"] = "IP adresy hostitele masky", ["housekeeping_frequency_description"] = "Některé statistiky hostitele, jako je propustnost, jsou pravidelně aktualizovány. Tento časový limit reguluje, jak často%{product} tyto statistiky aktualizuje. Větší hodnoty jsou méně výpočetně náročné a mají tendenci průměrovat menší odchylky. Menší hodnoty jsou výpočetně náročnější a mají tendenci zdůrazňovat menší variace. Hodnoty v řádu několika sekund jsou bezpečné. Účinné pouze pro rozhraní paketů. U rozhraní ZMQ je časový limit stanoven automaticky. Výchozí: 5 sekund.", ["housekeeping_frequency_title"] = "Frekvence aktualizace statistik hostitelů", ["http_auth"] = "Ověřování HTTP", ["http_auth_server_description"] = "URL serveru HTTP, který se použije k ověření uživatelů.", ["http_auth_server_title"] = "HTTP Server", ["idle_timeout_settings"] = "Nastavení časového limitu nečinnosti", ["ignored_interfaces_description"] = "Pokud je jako kritérium rozčlenění vybráno „Ingress Interface“, nepřidávejte do dynamického rozhraní žádný tok, který má jeho %%INPUT_SNMP v tomto seznamu. Pokud je vybrána „Rozdělení rozhraní“, nepřidávejte do prvního (druhého) dynamického rozhraní žádný tok, který má jeho %%INPUT_SNMP (%%OUTPUT_SNMP) v tomto seznamu. Určete jeden nebo více ID čárek rozhraní SNMP oddělených čárkami. Změny vyžadují restartování%{product}.", ["ignored_interfaces_title"] = "Ignorovaná rozhraní", ["incompatible_influxdb_version_found"] = "Nekompatibilní verze InfluxDB: povinné \"%{required}\", found \"%{found}\". Nainstalujte prosím aktualizovanou verzi z <a href='%{url}'> oficiální stránky</a>.", ["influxdb_auth_description"] = "Povolit ověřování InfluxDB.", ["influxdb_auth_title"] = "Ověřování InfluxDB", ["influxdb_create_error"] = "Nelze vytvořit \"%{db}\" databáze: %{msg}", ["influxdb_dbname_description"] = "Databáze, která se použije pro ukládání časových řad. Stávající data nebudou migrována.", ["influxdb_dbname_title"] = "InfluxDB Databáze", ["influxdb_password_description"] = "Heslo k ověření pomocí databáze InfluxDB.", ["influxdb_retention_error"] = "Nelze nastavit politiku uchování databáze \"%{db}\": %{msg}", ["influxdb_storage_note"] = "<b>POZNÁMKA</b>: data budou vymazána v intervalech %{interval}, což odpovídá InfluxDB <a href='%{url}'>době Shard</a>.", ["influxdb_url_description"] = "URL směřující na běžící instanci InfluxDB.", ["influxdb_url_title"] = "InfluxDB URL", ["influxdb_username_description"] = "Uživatelské jméno pro ověření pomocí databáze InfluxDB.", ["ingress_flow_interface"] = "Vstupní rozhraní", ["ingress_vrf_id"] = "Vstupní VRF Id", ["interfaces_timeseries"] = "Rozhraní Timeseries", ["internal_log"] = "Interní protokol", ["is_influxdb_running"] = "Je InfluxDB spuštěn?", ["l2_devices_timeseries"] = "Zařízení Timeseries", ["ldap_authentication"] = "Ověřování LDAP", ["ldap_server_address_description"] = "IP adresa a port serveru LDAP (např. Ldaps: // localhost: 636). Výchozí: \"ldap://localhost:389\".", ["ldap_server_address_title"] = "Adresa serveru LDAP", ["license"] = "Licence", ["local_auth"] = "Místní ověřování", ["local_host_cache_duration_description"] = "Čas, po kterém je lokální hostitel z meipaměti. Výchozí: 1 hodina.", ["local_host_cache_duration_title"] = "Trvání mezipaměti místního hostitel", ["local_host_mask"] = "Mask Local Hosts", ["local_host_max_idle_description"] = "Čas nečinnosti, po kterém je místní hostitel považován za nečinného (s). Nečinní místní hostitelé jsou uloženi do mezipaměti, takže jejich čítače mohou být obnoveny v případě, že se znovu aktivují. Čítače zahrnují, ale nejsou omezeny na pakety a bajty celkem a na aplikaci Layer-7. Výchozí: 5 min.", ["local_host_max_idle_title"] = "Časový limit místního nečinného hostitele", ["local_hosts_cache_settings"] = "Nastavení mezipaměti místních hostitelů", ["local_hosts_timeseries"] = "Timeseries místních hostitelů", ["logging"] = "Přihlašování", ["longlived_flow_duration_description"] = "Minimální doba trvání toku, která má být považována za dlouhodobý tok.", ["longlived_flow_duration_title"] = "Doba trvání dlouhodobých toků", ["max_num_alerts_per_entity_description"] = "Maximální počet výstrah na poplachovou entitu. Alarmovatelnými entitami jsou hostitelé, sítě, rozhraní. Výstrahy jsou pravidelně kontrolovány a v případě, že skutečný počet výstrah překročí maximální počet pro danou entitu, nejstarší výstrahy budou vymazány, aby se zachoval počet výstrah rovnajících se 80 %% maximálního nakonfigurovaného počtu. Výchozí: 1024.", ["max_num_alerts_per_entity_title"] = "Maximální počet upozornění na entitu", ["max_num_bytes_per_tiny_flow_description"] = "Maximální počet bajtů, aby tok byl považován za malý tok. Výchozí: 64.", ["max_num_bytes_per_tiny_flow_title"] = "Maximální počet bajtů na malý tok", ["max_num_flow_alerts_description"] = "Maximální počet výstrah toku. Výstrahy jsou pravidelně kontrolovány a v případě, že skutečný počet výstrah toku překročí nakonfigurovaný maximální počet, nejstarší výstrahy budou odstraněny, aby se zachoval počet výstrah rovnajících se 80 %% maximálního nakonfigurovaného počtu. Výchozí: 16384.", ["max_num_flow_alerts_title"] = "Maximální počet výstrah toku", ["max_num_packets_per_tiny_flow_description"] = "Maximální počet paketů, aby byl tok považován za malý tok. Výchozí: 3.", ["max_num_packets_per_tiny_flow_title"] = "Maximální počet paketů na malý tok", ["max_ui_strlen_description"] = "Zkraťte řetězce aby jich bylo míň než je zadaný maximální počet znaků.", ["max_ui_strlen_title"] = "Maximální zobrazená délka řetězce", ["mgmt_acl_title"] = "Seznam řízení přístupu", ["misc"] = "Různé", ["multiple_ldap_account_type_description"] = "Vyberte typ účtu", ["multiple_ldap_account_type_title"] = "Typ účtů LDAP", ["multiple_timeseries_database_description"] = "Ovladač se používá pro ukládání a načítání dat časové řady.", ["multiple_timeseries_database_title"] = "Ovladač Timeseries", ["mysql"] = "MySQL", ["n2disk_license_description"] = "Průběžné zaznamenávání provozu vyžaduje licenci n2disk, jednu si zakupte na adrese <a href=\"%{purchase_url}\">e-shop</a>. Pokud jste nezisková, výzkumná nebo vzdělávací instituce, přečtěte si prosím <a href=\"%{universities_url}\">toto</a>.", ["n2disk_license_systemid"] = "SystemID: %{systemid}", ["n2disk_license_title"] = "Licenční klíč n2disk", ["n2disk_license_version"] = "n2disk verze: %{version}", ["n2n_supernode_description"] = "Adresa <a class='ntopng-external-link' href=\"%{url}\">n2n <i class=\"fas fa-external-link-alt\"></i></a> supernode. Nastavte si vlastní supernod, abyste měli plně soukromý vzdálený přístup.<br><b>POZNÁMKA</b>: tato změna se projeví až po restartování služby vzdálená asistance.", ["n2n_supernode_title"] = "Supernode", ["network_discovery"] = "Objevy sítí", ["network_discovery_interval_description"] = "Interval mezi po sobě jdoucími objevy sítí. Výchozí: 15 min.", ["network_discovery_interval_title"] = "Interval zjišťování sítě", ["network_interfaces"] = "Síťová rozhraní", ["no_host_mask"] = "Nemaskuj hostitele", ["non_local_host_max_idle_description"] = "Čas nečinnosti, po kterém je vzdálený hostitel považován za nečinného. Výchozí: 1 min.", ["non_local_host_max_idle_title"] = "Vzdálená doba nečinnosti hostitele", ["none"] = "Žádný", ["note_timeseries_resolution_disabled"] = "<b>POZNÁMA</b>: to je zakázáno, protože \"%{pref}\" není nastavena na výchozí hodnotu.", ["note_update_frequency_disabled"] = "<b>POZNÁMKA</b>: toto je zakázáno kvůli \"%{pref}\" požadavku.", ["other_timeseries"] = "Other Timeseries", ["per_category"] = "Na kategorie", ["per_protocol"] = "Na aplikace", ["policy_target_type"] = "Typ cíle politiky", ["policy_target_type_description"] = "Určete, jaký druh cíle politiky chcete použít.", ["posix"] = "Posix", ["preferences"] = "Preference", ["primary_dns"] = "Primary DNS", ["probe_ip_address"] = "Sonda IP", ["protocols"] = "Aplikace", ["radius_admin_group_description"] = "Uživatel je autentizován jako administrátor, když hodnota párů Filtr-ID atribut-hodnota vrácená RADIUS odpovídá hodnotě uvedené v tomto poli. Pokud neexistuje shoda, je uživatel ověřen jako neprivilegovaný.", ["radius_admin_group_title"] = "ID správce filtru RADIUS", ["radius_auth"] = "RADIUS Authentication", ["radius_secret_descroption"] = "Sdílené tajemství pro ověření se serverem RADIUS.", ["radius_secret_title"] = "RADIUS tajemství", ["radius_server_description"] = "Hostitel a port serveru RADIUS (např.%{Example}).", ["radius_server_title"] = "Adresa serveru RADIUS", ["recording"] = "Záznam provozu", ["remote_host_mask"] = "Mask Remote Hosts", ["report"] = "Nahlásit", ["restart_needed"] = "Prosím restartujte %{product} za účelem provedení změn", ["runtime_prefs"] = "Předvolby procesu", ["safe_search_dns_description"] = "Server DNS, který se má použít k provedení <a href='%{url}'>Child Safe</a> dotazu.<br>Child Safe lze povolit pro jednotlivé host fondy z konfigurační stránky hostitelských fondů. Výchozí: 208.67.222.123.", ["safe_search_dns_title"] = "DNS bezpečné pro děti", ["samaccount"] = "sAMAccount", ["search_path_description"] = "Kořenová cesta používaná k vyhledávání uživatelů.", ["search_path_title"] = "Vyhledávací cesta LDAP", ["search_preferences"] = "Předvolby vyhledávání", ["secondary_dns"] = "Sekundární DNS", ["secondary_dns_description"] = "Záložní server DNS, který se použije, když globální primární server DNS není k dispozici.", ["secondary_dns_title"] = "Globální sekundární DNS", ["security_alerts"] = "Bezpečnostní upozornění", ["send_test_mail"] = "Odeslat zkušební e-mail", ["send_test_slack"] = "Odeslat testovací zprávu", ["send_test_webhook"] = "Odeslat testovací zprávu", ["sender_username_description"] = "Nastavení uživatelského jména odesílatele nevybavených oznámení", ["sender_username_title"] = "Uživatelské jméno odesílatele oznámení", ["simple_view"] = "Jednoduché zobrazení", ["slack_channel"] = "Slack Channel", ["slack_channel_names"] = "Názvy kanálů", ["slack_channel_names_descr"] = "Nakonfigurujte Slack kanály, na které budou zasílány jednotlivé výstrahy. Aby bylo možné výstrahu správně zobrazit, musí existovat kanály.", ["slack_integration"] = "Slack Integration", ["slack_notification_severity_preference_description"] = "Chyby (pouze chyby), Chyby a varování (chyby a varování, žádné informace), Vše (budou upozorňovány všechny druhy upozornění).", ["slack_notification_severity_preference_title"] = "Závažnost oznámení", ["slack_send_error"] = "Chyba při odesílání zprávy Slack.", ["slack_sent_successfully"] = " Slack zpráva byla odeslána do #%{channel} kanálu.", ["slack_webhook_description"] = "Zašlete své oznámení na tuto Slack adresu URL", ["slack_webhook_title"] = "Oznámení Webhook", ["snmp"] = "SNMP", ["snmp_port_load_threshold_description"] = "Nastavte práhovou hodnotu (jako procento rychlosti portu), aby se spouštěla upozornění, když zatížení portu překročí zadaný limit (v průměru 5 minut).", ["snmp_port_load_threshold_title"] = "Varování prahové hodnoty zatížení rozhraní", ["stats_reset"] = "Reset statistik", ["status_alerts"] = "Stavová upozornění", ["successfully_connected_influxdb"] = "Úspěšně inicializovaná databáze \"%{db}\" na InfluxDB(%{version})", ["syslog_alert_format_description"] = "Vyberte výstupní formát výstrah syslog.", ["syslog_alert_format_json"] = "JSON", ["syslog_alert_format_plaintext"] = "Prostý text", ["syslog_alert_format_title"] = "Formát upozornění na Syslog", ["syslog_notification"] = "Syslog Notification", ["telemetry"] = "Telemetrie", ["telemetry_contribute"] = "Přispět", ["telemetry_do_not_contribute"] = "Nepřispívat", ["telemetry_email_description"] = "Uveďte e-mailovou adresu, pokud chcete být kontaktováni týmem ntop v případě zjištění anomálií v telemetrii. ntop vás nebude moci identifikovat, pokud tuto informaci nezadáte.", ["telemetry_email_title"] = "Kontakt", ["timeseries"] = "Timeseries", ["timeseries_database"] = "Databáze Timeseries", ["timeseries_resolution_resolution_description"] = "Interval mezi datovými body po sobě jdoucích časů pro místní hostitele. Účinné pouze pro rozhraní paketů.<br><b>POZNÁMKA</b>:<ul><li>Lze nastavit retenční časy Timeseries <A HREF=\"prefs.lua?tab=retention\">zde</a></li></ul>", ["timeseries_resolution_resolution_title"] = "Rozlišení Timeseries", ["toggle_access_log_description"] = "Přepnout vytvoření protokolu přístupu HTTP v adresáři výpisu dat. Nastavení se projeví po příštím %{product} spuštění.", ["toggle_access_log_title"] = "Povolit protokol přístupu HTTP", ["toggle_active_local_host_cache_enabled_description"] = "Přepnout vytváření položek mezipaměti pro aktivní místní hostitele. Pravidelné ukládání do mezipaměti aktivních místních hostitelů může být užitečné pro ochranu čítačů hostitele před poruchami (např. Ztrátami energie). To je zvláště důležité pro místní hostitele, kteří jsou jen zřídka nečinní, protože zaručuje, že jejich čítače budou uloženy v mezipaměti po zadaném časovém intervalu.", ["toggle_active_local_host_cache_enabled_title"] = "Vyrovnávací paměť aktivních místních hostitelů", ["toggle_alert_probing_description"] = "Přepnout upozornění generovaná při detekci pokusů o sondování.", ["toggle_alert_probing_title"] = "Upozornění na sondy", ["toggle_alert_syslog_description"] = "Přepnout protokolování výstrah do systémového syslogu.", ["toggle_alert_syslog_title"] = "Přepíná protokolování výstrah do systému syslog. Přepnout upozornění na Syslog", ["toggle_alerts_notifications_description"] = "Přepněte hlášení výstrah do koncových bodů třetích stran.", ["toggle_alerts_notifications_title"] = "Upozornění na koncové body třetích stran", ["toggle_asn_rrds_description"] = "Přepněte vytváření bajtů a aplikačních časů pro autonomní systémy.", ["toggle_asn_rrds_title"] = "Autonomní systémy", ["toggle_autologout_description"] = "Přepněte automatické odhlášení uživatelů webového rozhraní s vypršenými relacemi.", ["toggle_autologout_title"] = "Automatické odhlášení", ["toggle_captive_portal_description"] = "Povolte webový zajatý portál pro ověření uživatelů sítě.", ["toggle_captive_portal_title"] = "Captive Portal", ["toggle_country_rrds_description"] = "Přepněte vytváření bajtových časových adres pro země.", ["toggle_country_rrds_title"] = "Země / Státy", ["toggle_data_exfiltration_description"] = "Přepněte heuristiku pro detekci exfiltrace dat a generování výstrah.", ["toggle_data_exfiltration_title"] = "Záznamy o filtraci dat", ["toggle_device_activation_alert_description"] = "Přepnout upozornění generovaná při připojení nebo odpojení zařízení od sítě.", ["toggle_device_activation_alert_title"] = "Upozornění na připojení / odpojení zařízení", ["toggle_device_first_seen_alert_description"] = "Přepnout upozornění generovaná, když se v síti objeví nová neviditelná zařízení.", ["toggle_device_first_seen_alert_title"] = "Připojení nových zařízení", ["toggle_device_protocols_description"] = "Přepnout upozornění generovaná, když je anomální aplikace detekována podle nakonfigurovaných <a href=\"%{url}\">politik aplikací zařízení</a>.", ["toggle_device_protocols_description_nedge"] = "Přepnout upozornění generovaná při anomálním protokolu. <i>Nepřiřazená</i> zařízení jsou detekována podle nakonfigurovaných <a href=\"%{url}\">politik aplikací zařízení</a>.", ["toggle_device_protocols_title"] = "Upozornění na aplikace zařízení", ["toggle_dns_alerts_description"] = "Přepnout upozornění generovaná v případě, že je dotaz DNS neplatný", ["toggle_dns_alerts_title"] = "Upozornění DNS", ["toggle_dropped_flows_alerts_description"] = "Povolit informativní výstrahy generované při blocích toků kvůli nakonfigurované politice", ["toggle_dropped_flows_alerts_title"] = "Povolit upozornění na zablokované toky", ["toggle_dst_with_post_nat_dst_description"] = "Vyměňte cílové adresy IPv4 (%%IPV4_DST_ADDR) a porty (%%L4_DST_PORT) s jejich post-nat hodnotami (%%POST_NAT_DST_IPV4_ADDR and %%POST_NAPT_DST_TRANSPORT_PORT).", ["toggle_dst_with_post_nat_dst_title"] = "Použijte cílové IPv4 adresy a porty", ["toggle_elephant_flows_alerts_description"] = "Přepnout výstrahy generované po zjištění Elephant toků. To je užitečné pro detekci nežádoucího chování (např. Exfiltrace dat).", ["toggle_elephant_flows_alerts_title"] = "Elephant Flows Alerts", ["toggle_email_notification_description"] = "Přepínání upozornění prostřednictvím e-mailu.", ["toggle_email_notification_title"] = "Přepnout oznámení e-mailem", ["toggle_external_alert_description"] = "Přepnout upozornění generovaná externími systémy (např. Suricata)", ["toggle_external_alert_title"] = "Externí upozornění", ["toggle_flow_alerts_iface_description"] = "Povolit generování výstrah toku, když je upozorněno síťové rozhraní.", ["toggle_flow_alerts_iface_title"] = "Povolit výstrahy toku", ["toggle_flow_rrds_description"] = "Přepněte vytváření bajtových časových adres pro každý port vzdáleného zařízení, jak bylo přijato prostřednictvím ZMQ (např. SFlow / NetFlow / SNMP). <br> Pro zařízení, která nejsou sFlow, %%INPUT_SNMP and %%OUTPUT_SNMP se musí objevit v nprobe šabloně.", ["toggle_flow_rrds_title"] = "Průtoková zařízení", ["toggle_host_mask_description"] = "Z důvodů ochrany soukromí může být nutné maskovat adresy IP hosts. Například pokud jste poskytovatelem internetových služeb, neměli byste vědět, které místní adresy přistupují ke vzdáleným hosts.", ["toggle_host_mask_title"] = "Mask Host IP Addresses", ["toggle_host_pools_log_description"] = "Přepnout vytváření protokolů souvisejících s host fondy. Protokoly zahrnují přidružení a disociace hosts do jejich hostitelských fondů.", ["toggle_host_pools_log_title"] = "Povolit protokol událostí host fondu", ["toggle_host_tskey_description"] = "Klíč, který se má použít pro výpis dat a časových výpisů pro hostitele v místní doméně vysílání. V síti DHCP je obvykle vhodné vybrat 'Mac Address'.", ["toggle_host_tskey_title"] = "Identifikátor hostitelského lokálního vysílání domény", ["toggle_http_auth"] = "Přepnout ověřování HTTP", ["toggle_http_auth_descr"] = "Přepnout ověřování gui pomocí autentizátoru HTTP.", ["toggle_ids_alert_description"] = "Přepnout upozornění generovaná systémy detekce narušení. Podívejte se na integraci Suricata prostřednictvím syslogu.", ["toggle_ids_alert_title"] = "Upozornění IDS", ["toggle_informative_captive_portal_description"] = "Neověřujte uživatele. Než uživatelům povolíte přístup na internet, zobrazte pouze informativní stránku.", ["toggle_informative_captive_portal_title"] = "Informativní", ["toggle_ip_reassignment_description"] = "Přepnout upozornění generovaná, když je IP adresa, dříve viděná s MAC adresou, nyní vidět s jinou MAC adresou. Toto upozornění může znamenat pokus o spoof ARP.", ["toggle_ip_reassignment_title"] = "Upozornění na změnu přiřazení IP", ["toggle_ldap_anonymous_bind_description"] = "Povolit anonymní vazbu.", ["toggle_ldap_anonymous_bind_title"] = "LDAP anonymní vazba", ["toggle_ldap_auth"] = "Přepnout ověření LDAP", ["toggle_ldap_auth_descr"] = "Přepnout ověřování gui pomocí protokolu LDAP.", ["toggle_ldap_referrals_description"] = "Určuje, zda má klient automaticky sledovat doporučení vrácená servery LDAP.", ["toggle_ldap_referrals_title"] = "Postupujte podle doporučení", ["toggle_local_auth"] = "Přepnout místní ověřování", ["toggle_local_auth_descr"] = "Přepnout ověřování gui podle %{product} definovaných uživatelů.", ["toggle_local_host_cache_enabled_description"] = "Přepnout vytváření položek mezipaměti pro nečinné místní počítače. Čítače lokálních hosts s mezipamětí se po detekci dalšího provozu host automaticky obnoví na své předchozí hodnoty.", ["toggle_local_host_cache_enabled_title"] = "Cache lokálního hostitele nečinnosti", ["toggle_log_to_file_description"] = "Namísto použití syslogu přepněte vytváření ntopng.log v adresáři výpisu dat. Nastavení se projeví při příštím %{product} spuštění.", ["toggle_log_to_file_title"] = "Povolit záznam trasování.", ["toggle_logging_level_description"] = "Vyberte úroveň protokolování runtime.", ["toggle_logging_level_title"] = "Úroveň protokolu", ["toggle_longlived_flows_alerts_description"] = "Přepnout upozornění generovaná, když byl detekován tok s dlouhou životností. To je užitečné pro detekci nežádoucího chování (např. Exfiltrace dat).", ["toggle_longlived_flows_alerts_title"] = "Upozornění na dlouhodobé toky", ["toggle_malware_probing_description"] = "Přepínání upozornění generovaných provozem odeslaným / přijatým hostitelem označeným malwarem. Seznamy škodlivého softwaru lze konfigurovat pomocí <a href=\"%{url}\">Stránka Seznamy kategorií</a>.", ["toggle_malware_probing_title"] = "Upozornění na malware", ["toggle_midnight_stats_reset_description"] = "Přepněte automatické resetování statistik o půlnoci. To zahrnuje statistiky počítačů a hostitelů", ["toggle_midnight_stats_reset_title"] = "Reset Statistik o Půlnoci", ["toggle_mining_alerts_description"] = "Přepnout upozornění generovaná, když je detekován provoz z / do hostitelů, o kterých je známo, že provádějí těžbu kryptoměn", ["toggle_mining_alerts_title"] = "Upozornění na těžbu", ["toggle_mysql_check_open_files_limit_description"] = "Povolit generování výstrah MySQL kvůli pravidelným kontrolám MySQL open_files_limit.<br>The open_files_limit , kontrola je užitečná při zjišťování, kdy je počet otevřených souborů MySQL vysoký, což by mohlo vést k chybám vložení databáze.", ["toggle_mysql_check_open_files_limit_title"] = "Povolit upozornění MySQL", ["toggle_ndpi_flows_rrds_description"] = "Přepněte vytváření Timeseries pro celkový počet toků na aplikaci Layer-7.", ["toggle_ndpi_flows_rrds_title"] = "Celkové toky vrstvy 7", ["toggle_ndpi_timeseries_creation_description"] = "Přepněte vytváření aplikačních Timeseries vrstvy 7. Vytváření časových úložišť pro jednu aplikaci vyžaduje více místa na disku a další I / O a obecně to není nutné.", ["toggle_ndpi_timeseries_creation_title"] = "Aplikace vrstvy 7", ["toggle_network_discovery_description"] = "Přepínejte periodický objev síťových zařízení pomocí více technik, které zahrnují skenování ARP, MDNS a SSDP. Přepínejte periodický objev síťových zařízení pomocí více technik, které zahrnují skenování ARP, MDNS a SSDP.<p><b><b>POZNÁMKA</b>:</b> zjišťování lze povolit pouze <u> </u> na fyzických rozhraních (tj. bez ZMQ), kde můžeme odesílat / přijímat provoz do sítě (tj. rozhraní pouze pro čtení, jako jsou rozhraní připojená k Mirror Ports, nebudou fungovat).", ["toggle_network_discovery_title"] = "Aktivní vyhledávání sítí", ["toggle_pool_activation_alert_description"] = "Přepnout upozornění generovaná při připojení prvního hostitele nebo odpojení posledního hostitele od některého fondu.", ["toggle_pool_activation_alert_title"] = "Upozornění na připojení / odpojení hostitelských fondů", ["toggle_pools_rrds_description"] = "Přepněte vytváření Timeseries bajtů a aplikací pro definované hostitelské fondy.", ["toggle_pools_rrds_title"] = "Hostistelské Fondy", ["toggle_potentially_dangerous_protocols_description"] = "Přepnout výstrahy generované při detekci potenciálně nebezpečného protokolu v toku.", ["toggle_potentially_dangerous_protocols_title"] = "Potenciálně nebezpečné protokoly", ["toggle_quota_exceed_alert_description"] = "Povolit generování výstrah vždy, když hostitelský fond překročí nakonfigurovanou kvótu.", ["toggle_quota_exceed_alert_title"] = "Povolit upozornění na překročení kvóty", ["toggle_radius_auth"] = "Přepnout ověření RADIUS", ["toggle_radius_auth_descr"] = "Přepněte ověřování gui prostřednictvím serveru RADIUS.", ["toggle_remote_to_remote_alerts_description"] = "Přepnout výstrahy generované, když jsou klient a server toku vzdáleni.", ["toggle_remote_to_remote_alerts_title"] = "Remote to Remote Alerts", ["toggle_send_telemetry_data_description"] = "Přispějte do projektu zasláním šifrovaného, <a href=\"%{url}\">anonymních telemetrických dat</a> to <a href=\"%{ntop_org}\">ntop.org</a>. Údaje se týkají pouze stavu %{product} (např. dostupnost, stav, zprávy o selhání). Nic ohledně sledovaného provozu nebude nikdy zasláno.", ["toggle_send_telemetry_data_title"] = "Telemetrická data", ["toggle_shaping_directions_description"] = "Povolte tuto možnost, abyste mohli nastavit různé politiky Shaping pro vstup a výstup.", ["toggle_shaping_directions_title"] = "Split Shaping Directions", ["toggle_slack_notification_description"] = "Přepnout upozornění na upozornění pomocí Slack. Viz integrační pokyny zde <a href='%{url}'>zde</a>.", ["toggle_slack_notification_title"] = "Přepnout <a href=\"%{url}\">Slack</a> Oznámení", ["toggle_snmp_alerts_port_duplexstatus_change_description"] = "Přepnout upozornění generovaná při změně stavu duplexu rozhraní", ["toggle_snmp_alerts_port_duplexstatus_change_title"] = "Upozornění na změnu stavu duplexu rozhraní", ["toggle_snmp_alerts_port_errors_description"] = "Přepnout výstrahy generované při zvýšení počtů výmětů nebo chyb na rozhraní", ["toggle_snmp_alerts_port_errors_title"] = "Varování o výmazech / chybách rozhraní", ["toggle_snmp_alerts_port_status_change_description"] = "Přepnout upozornění generovaná při změně stavu rozhraní", ["toggle_snmp_alerts_port_status_change_title"] = "Upozornění na změnu stavu rozhraní", ["toggle_snmp_rrds_description"] = "Přepněte vytváření bajtových Timeseries pro každý port zařízení SNMP. Pro každé zařízení bude vytvořen port timeseries s vstupními / výstupními bajty.", ["toggle_snmp_rrds_title"] = "SNMP Devices Timeseries", ["toggle_src_and_dst_using_ports_description"] = "Určete zdroj a cíl přijatých toků pomocí čísel portů. Dolní číslo portu se považuje za cílový port. Vyšší číslo portu je považováno za zdrojový port. Důvodem je, že zdroje obecně využívají pomíjivé porty pro připojení ke známým cílovým portům a pomíjivé porty jsou obecně větší než známé. Pokud je tato možnost povolena, zdroj a cíl budou zaměněny, pokud se zjistí, že cílový port je větší než zdrojový port.", ["toggle_src_and_dst_using_ports_title"] = "Pomocí čísel portů určete zdroj a cíl", ["toggle_src_with_post_nat_src_description"] = "Vyměňte zdrojové adresy IPv4 (%%IPV4_SRC_ADDR) a portů (%%L4_SRC_PORT) s jejich post-nat hodnotami (%%POST_NAT_SRC_IPV4_ADDR and %%POST_NAPT_SRC_TRANSPORT_PORT).", ["toggle_src_with_post_nat_src_title"] = "Použijte adresy a porty IPv4 po zdroji", ["toggle_tcp_flags_rrds_description"] = "Přepnout vytváření příznaků TCP SYN, SYN + ACK, FIN + ACK a RST pro síťová rozhraní.", ["toggle_tcp_flags_rrds_title"] = "TCP Flags", ["toggle_tcp_retr_ooo_lost_rrds_description"] = "Přepněte vytváření Timeseries pro segmenty TCP mimo pořadí, ztracené a znovu odeslané. Časy budou vytvořeny pro síťová rozhraní, autonomní systémy, místní sítě a vlans.", ["toggle_tcp_retr_ooo_lost_rrds_title"] = "Segmenty TCP mimo provoz, ztracené a opakované přenosy", ["toggle_thpt_content_description"] = "Vyberte průchodnou jednotku, která se má zobrazit v provozních zprávách.", ["toggle_thpt_content_title"] = "Průchozí jednotka", ["toggle_tiny_flows_dump_description"] = "Přepněte export malých toků, které jsou toky s několika pakety nebo bajty. Snižuje kardinálnost toku v databázích, urychluje vkládání a vyhledávání. Vyladění malých toků může pomoci omezit kardinálnost toku, aniž by se snížila viditelnost dumpingových informací.", ["toggle_tiny_flows_dump_title"] = "Export malých toků", ["toggle_tls_alerts_description"] = "Přepnout upozornění generovaná v případě, že certifikát TLS poskytovaný serverem neodpovídá certifikátu Common Name.", ["toggle_tls_alerts_title"] = "TLS Alerts", ["toggle_top_sites_description"] = "Přepněte vytváření nejvíce navštěvovaných webových stránek pro místní hostitele. Top weby jsou vytvářeny pomocí <a href=\"%{url}\">heuristic</a> které udržují ne více než 20 webů na místního hostitele. Heuristika plně pracuje v paměti a nevyžaduje žádnou interakci s diskem. Top stránky jsou vymazány každých 5 minut. Historický archiv nejnavštěvovanějších webových stránek lze pro každého lokálního hostitele vytvořit periodickým dotazováním na JSON <i class=\"fas fa-download fa-sm\"></i> odkaz ke stažení přístupný ze stránky podrobností hostitele.", ["toggle_top_sites_title"] = "Top HTTP servery", ["toggle_traffic_rrd_creation_description"] = "Přepněte vytváření Timeseries bajtů a paketů.", ["toggle_traffic_rrd_creation_title"] = "Provoz", ["toggle_users_rrds_description"] = "Přepnout vytváření bajtů a Timeseries aplikací pro definované uživatele.", ["toggle_users_rrds_title"] = "Uživatelé", ["toggle_vlan_rrds_description"] = "Přepnout vytváření Timeseries bajtů a aplikací pro VLAN.", ["toggle_vlan_rrds_title"] = "VLANs", ["toggle_webhook_notification_description"] = "Přepnout upozornění na upozornění pomocí webhook (HTTP).", ["toggle_webhook_notification_title"] = "Přepnout oznámení Webhook", ["topk_heuristic_precision_description"] = "Při sestavování provozních hlášení použijte heuristiku při agregaci historických top hostitelů, zemí atd. Užitečné při sestavování zpráv po dlouhou dobu.", ["topk_heuristic_precision_title"] = "Top-K Heuristic", ["traffic_bridging"] = "Provozní Bridging", ["traffic_shaping"] = "Provozní Shaping", ["user_authentication"] = "Ověření uživatele", ["user_group_description"] = "Název skupiny, do které musí uživatel patřit, aby se mohl autentizovat jako uživatel bez oprávnění.", ["user_group_title"] = "Skupina uživatelů LDAP", ["vlan"] = "VLAN Id", ["web_user_interface"] = "Webové uživatelské rozhraní", ["webhook_notification"] = "Webhook Oznámení", ["webhook_notification_severity_preference_description"] = "Chyby (pouze chyby), Chyby a varování (chyby a varování, žádné informace), Vše (budou upozorňovány všechny druhy upozornění).", ["webhook_notification_severity_preference_title"] = "Závažnost oznámení", ["webhook_password_description"] = "Heslo, které se použije v případě ověření HTTP (volitelné).", ["webhook_send_error"] = "Chyba při odesílání zprávy na webhook.", ["webhook_sent_successfully"] = "Na webhook byla odeslána zpráva", ["webhook_sharedsecret_description"] = "Nastavit (definované uživatelem) tajemství, které má být ověřeno příjemcem (volitelné).", ["webhook_sharedsecret_title"] = "Sdílené tajemství", ["webhook_url_description"] = "Odeslat oznámení na tuto adresu URL ve formátu JSON.", ["webhook_url_title"] = "Adresa URL oznámení", ["webhook_username_description"] = "Uživatelské jméno, které se má použít v případě ověření HTTP (volitelné).", ["zmq_interfaces"] = "Rozhraní ZMQ", }, ["processes_stats"] = { ["active_processes_title"] = "Aktivní procesy: Zobrazení v reálném čase", ["active_since"] = "Aktivní od", ["flows_count"] = "Počet toků", ["legend"] = "Legenda", ["lines"] = "Lines", ["missing_pid_name_message"] = "Chybí jméno pid", ["no_traffic_detected"] = "U tohoto procesu nebyl detekován žádný provoz, proces toku vypršel nebo proces byl ukončen.", ["processes_timeline_title"] = "Časová osa procesů", ["stack"] = "Stack", ["timeline"] = "Časová osa", ["top_hosts"] = "Top hostitelé", ["top_hosts_traffic"] = "Provoz top hostitelů", ["traffic_rcvd"] = "Provoz Rcvd", ["traffic_sent"] = "Provoz odeslán", ["type"] = "Typ", }, ["report"] = { ["application_breakdown"] = "Aplikační Breakdown", ["applications"] = "Aplikace", ["begin_date_time"] = "Počáteční datum / čas", ["date"] = "%{month}-%{day}-%{year}", ["end_date_time"] = "Datum a čas ukončení", ["filter_report"] = "Filtrovat zprávu", ["generate"] = "generovat", ["invalid_begin"] = "Neplatný začátek", ["invalid_begin_date"] = "Neplatné datum zahájení", ["invalid_begin_end"] = "Neplatný začátek / konec", ["invalid_to"] = "Neplatné do", ["local_networks"] = "Lokální sítě", ["local_remote"] = "Localní/Vzdálený", ["network_interface"] = "Síťové rozhraní", ["period"] = "Interval", ["please_check_format"] = "zkontrolujte jeho formát", ["please_choose_valid"] = "Vyberte prosím platné datum a čas zahájení / ukončení", ["please_choose_valid_date_and_time"] = "Vyberte prosím platné datum a čas", ["receivers"] = "Přijímače", ["remote_local"] = "vzdálené / lokální", ["report_for_subject"] = "Zpráva - %{num_min} - pro %{subject} začínající %{dt}", ["reports_professional_only"] = "Zprávy jsou k dispozici pouze ve verzi Professional", ["senders"] = "Odesílatelé", ["starting"] = "Začínající", ["submit_filter"] = "Předložit filtr", ["symbolic_host_name_at_visualization"] = "Symbolické názvy hostitelů jsou rozlišeny během vizualizace\9.", ["toggle_all"] = "Přepnout vše", ["top_asn"] = "Top ASN", ["top_countries"] = "Top země / Státy", ["top_local_hosts"] = "Top lokalní hostilelé", ["top_local_os"] = "Top Localní OS", ["top_networks"] = "Top Sítě", ["top_non_local_os"] = "Top nelokální OS", ["top_remote_hosts"] = "Top vzdálení hostitelé", ["top_talkers"] = "Top Talkers", ["total_traffic"] = "Celkový provoz", ["traffic_report"] = "Zpráva o Provozu", ["use_server_timezone"] = "Použijte časové pásmo serveru", }, ["sflows_stats"] = { ["active_flows"] = "Aktivní toky", ["client_peer"] = "Klient Peer", ["client_process"] = "Klientský proces", ["server_peer"] = "Server Peer", ["server_process"] = "Proces serveru", ["total_bytes"] = "Bajty celkem", }, ["shaping"] = { ["applied_to"] = "Aplikován na", ["bandwidth_manager"] = "Správce šířky pásma", ["confirm_delete_all_policies"] = "Opravdu chcete odstranit všechny \"%{pool_name}\" politiky fondu", ["confirm_delete_policy"] = "Opravdu chcete odstranit", ["confirm_delete_shaper"] = "Opravdu chcete odstranit shaper", ["daily_time"] = "Denní čas (aktuální / kvóta))", ["daily_time_quota"] = "Denní časová kvóta", ["daily_traffic"] = "Denní provoz (aktuální / kvóta)", ["daily_traffic_quota"] = "Denní provozní kvóta", ["delete_all_policies"] = "Odstraňte všechny politiky", ["delete_policy"] = "Odstranit politiku", ["delete_shaper"] = "Odtranit Shaper", ["for_dropping_all_traffic"] = "za upuštění veškerého provozu", ["for_no_shaping"] = "for no shaping", ["initial_clone_protocols"] = "Počáteční pravidla aplikace budou klonována", ["initial_empty_protocols"] = "Počáteční pravidla aplikace budou prázdná", ["manage_policies"] = "Spravovat politiky", ["no_quota_applied"] = "Žádná kvóta", ["no_quota_data"] = "Není stanovena žádná kvóta", ["no_quota_traffic"] = "Dosud žádný provoz související s kvótami", ["no_shapers_available"] = "K dispozici nejsou žádné Shapers", ["note_default_pool_config"] = "Politiky a kvóty se vztahují pouze na uživatelem definované hostitelské fondy. Vyberte jiný fond nebo vytvořte nový zde <a href='%{url}'>zde</a>.", ["note_drop_core"] = "Vypuštění některých základních protokolů může mít vedlejší účinky na jiné protokoly. Například pokud blokujete DNS,<br> symbolická jména hostitelů již nejsou vyřešena, a proto funguje pouze komunikace s numerickými IP.", ["note_quota_unlimited"] = "Pro neomezený provoz nastavte provoz a časovou kvótu na 0.", ["note_target_type"] = "Co můžete zobrazit do sloupce Cíl, můžete změnit pomocí pole Typ cíle politiky v poli <a href=\"%{url}\">Předvolby překlenutí provozu</a> expertního pohledu..", ["note_traffic_categories"] = "Kategorie můžete konfigurovat z <a href=\"%{url}\">stránky aplikací</a>.", ["notes"] = "POZNÁMKY", ["policy_from_pool"] = "Politika z fondu", ["protocol_families"] = "Application Families", ["protocol_policy"] = "politika provozu", ["protocols"] = "Aplikace", ["protocols_policies"] = "pPolitika aplikací", ["see_quotas_here"] = "Navštivte hostitelský fond <a href='%{url}'>stránky s kvótami</a> pro úplný přehled kvót aktivního hostitelského fondu.", ["select_to_clone"] = "Vyberte existující síť, ze které chcete klonovat pravidla aplikace", ["set_max_rate_to"] = "Nastavte maximální rychlost na", ["shaper0_message"] = "Shaper 0 je výchozí shaper používaný pro místní hostitele, kteří ještě nemají definován Shaper", ["shaper_id"] = "Shaper Id", ["shapers_in_use_message"] = "Shapers lze odstranit pouze v případě, že nejsou použity v žádné síti", ["traffic_from"] = "Provoz z", ["traffic_to"] = "Provoz do", }, ["show_alerts"] = { ["1_day"] = "1 den", ["1_hour"] = "1 hodina", ["1_month"] = "1 měsíc", ["1_week"] = "1 týden", ["1_year"] = "1 rok", ["30_min"] = "30 minut", ["5_min"] = "5 minut", ["6_months"] = "6 měsíců", ["alarmable"] = "Alarmující", ["alert_actions"] = "Akce", ["alert_count"] = "Spočítat", ["alert_counts"] = "Počítá", ["alert_datetime"] = "Datum / Čas", ["alert_description"] = "Popis", ["alert_duration"] = "Doba trvání", ["alert_severity"] = "Vážnost", ["alert_type"] = "Typ upozornění", ["alerts"] = "Upozornění", ["alerts_are_disabled_message"] = "Upozornění jsou deaktivována. Zkontrolujte prosím stránku předvoleb a aktivujte je.", ["alerts_to_purge"] = "Upozornění na očištění", ["confirm_delete_alert"] = "Opravdu chcete uvedené upozornění smazat?", ["confirm_release_alert"] = "Opravdu chcete uvedené upozornění vydat?", ["daily"] = "Denně", ["delete_alert"] = "Odstrani upozornění", ["delete_alerts_configuration"] = "Smazat konfiguraci", ["delete_all"] = "Smazat vše", ["delete_config_btn"] = "Odstranit %{conf} běžnou konfiguraci", ["delete_config_message"] = "Opravdu chcete smazat společné %{granularity} konfigurace %{conf}s", ["detected_alerts"] = "Zjištěná upozornění", ["disable_alerts"] = "Zakázat", ["disable_alerts_message"] = "Opravdu chcete zakázat \"%{type}\" upozornění na %{entity_value}?", ["disable_alerts_title"] = "Zakázat upozornění", ["disabled_alerts"] = "Zakázané upozornění", ["dropped_alerts"] = "Vynechaná upozornění", ["enable_alerts"] = "Povolit", ["enable_alerts_message"] = "Opravdu chcete povolit \"%{type}\" upozornění na %{entity_value}?", ["enable_alerts_title"] = "Povolit upozornění", ["engaged"] = "Engaged", ["engaged_alerts"] = "Engaged Alerts", ["explorer"] = "Prozkoumat", ["five_minutes"] = "Pět minut", ["flow_alerts"] = "Výstrahy toku", ["flush_data"] = "Vyplachovací data", ["host_delete_config_btn"] = "Odstranit hostitelskou %{host} konfiguraci", ["host_delete_config_confirm"] = "Opravdu chcete odstranit %{granularity} konfigurace pro hostitele", ["hourly"] = "Hodinově", ["iface_delete_config_btn"] = "Odstranit rozhraní %{iface} konfigurace", ["iface_delete_config_confirm"] = "Opravdu chcete odstranit %{granularity} konfiguraci rozhraní", ["in_the_selected_time_frame"] = "ve vybraném časovém období", ["interface_drops_threshold"] = "Rozhraní Packets Drops Alert", ["interface_drops_threshold_descr"] = "Maximální procento vyřazených paketů z celkového počtu pozorovaných paketů rozhraní\9", ["last_day"] = "Poslední den", ["last_hour"] = "Poslední hodina", ["last_minute"] = "Poslední minuta", ["minute"] = "Minuta", ["network_delete_config_btn"] = "Odtsranit síťovou %{network} konfiguraci", ["network_delete_config_confirm"] = "Opravdu chcete odstranit %{granularity} konfiguraci pro síť", ["no_recorded_alerts_message"] = "Žádná zaznamenaná upozornění pro rozhraní %{ifname}", ["num_ignored_alerts"] = "Ignorovaná upozornění", ["older_1_day_ago"] = " starší než 1 den", ["older_1_hour_ago"] = "starší než 1 hodina", ["older_1_month_ago"] = "starší než před 1 měsícem", ["older_1_week_ago"] = "starší než 1 týden", ["older_1_year_ago"] = "starší než před 1 rokem", ["older_30_minutes_ago"] = "starší než 30 minut", ["older_5_minutes_ago"] = "starší než 5 minut", ["older_6_months_ago"] = "starší než 6 měsíců", ["older_than"] = "starší než", ["past"] = "Minulost", ["past_alerts"] = "Minulá upozornění", ["past_flow"] = "Minulý tok", ["purge_num_alerts"] = "Pročistit [%{num_alerts} upozornění]", ["purge_subj_alerts"] = "Pročistit %{subj} upozornění", ["purge_subj_alerts_confirm"] = "Opravdu chcete pročistit všechny %{subj} upozornění?", ["release_alert"] = "Vydání upozornění", ["release_alert_action"] = "Vydat", ["reset_alert_database"] = "Flush Alerts Data", ["reset_alert_database_message"] = "Tato akce odstraní veškerá data související s upozenění včetněg<ul><li> Runtime alerts status </li> <li>Alerts configuration </li> <li> Persistent alerts SQLite storage</li></ul><br>Opravdu chcete pokračovat?", ["rtt"] = "RTT", ["startup"] = "Spuštění", ["trigger_alert_descr"] = "Povolit upozornění na tuto alarmující událost", }, ["sites_page"] = { ["contacts"] = "Kontakty", ["current_sites"] = "Aktuální stránky", ["last_5_minutes_sites"] = "Stránky za posledních 5 minut", ["sites"] = "Stránky", ["top_sites_not_enabled_message"] = "Chcete-li sledovat navštívené weby, povolte vytváření top navštěvovaných webových stránek pro místní hostitele z <a href=\"%{url}\"><i class=\"fas fa-flask\"></i> Preference</a>.", ["top_sites_not_seen"] = "Aktuální místní hostitel dosud nenavštívil žádný web.", ["top_visited_sites"] = "Top navštěvované stránky", }, ["snmp"] = { ["AlertDescription"] = "Popis výstrahy", ["ConsoleDisplayBufferText"] = "Zobrazit text", ["GeneralSerialNumber"] = "Sériové číslo", ["InputCurrentLevel"] = "Současná úroveň", ["InputDimUnit"] = "Dim Unit", ["InputMaxCapacity"] = "Maximální kapacita", ["InputMediaDimFeedDirDeclared"] = "InputMediaDimFeedDirDeclared", ["InputMediaDimXFeedDirDeclared"] = "InputMediaDimXFeedDirDeclared", ["InputName"] = "InputName", ["MarkerColorantValue"] = "Marker Colorant", ["MarkerLifeCount"] = "Životnost markeru", ["MarkerSuppliesDescription"] = "Marker Supplies Description", ["MarkerSuppliesLevel"] = "Marker Supplies Level", ["MarkerSuppliesMaxCapacity"] = "Marker Supplies Max Capacity", ["PrinterCurrentStatus"] = "Aktuální stav", ["PrinterOperationalStatus"] = "Provozní stav", ["absolute_errors"] = "Chyby od spuštění", ["actual_errors"] = "Errors Since Last Poll", ["add_device"] = "Přidat nové zařízení", ["add_snmp_devices"] = "Přidat zařízení SNMP", ["alerted_interfaces"] = "Rozhraní s chybami", ["all_interfaces"] = "Všechna rozhraní", ["all_snmp_interface_types"] = "Všechny typy", ["all_snmp_statuses"] = "Všechny stavy", ["and_one_more_interface"] = "a <a href='%{url}'>1 další rozhraní</a>", ["bound_interface_description"] = "Vazba síťového rozhraní na rozhraní SNMP je užitečná pro porovnání síťového provozu monitorovaného pomocí ntopng s tím, který hlásí SNMP", ["caching_in_progress"] = "Probíhá procházení zařízení SNMP. To může trvat až 5 minut. Stránka se bude pravidelně aktualizovat.", ["contact"] = "Kontakt", ["delete_all_devices"] = "Odstraňte všechna zařízení", ["device_example"] = "Příklad: %{example}", ["device_ip"] = "IP zařízení", ["device_model"] = "Model zařízení", ["device_polling"] = "Device Polling", ["device_polling_desc"] = "Provádějte periodické walk SNMP pro sběr dat zařízení, včetně provozu a stavu rozhraní zařízení.", ["device_status"] = "Stav zařízení", ["disable_port_monitor"] = "Zakázat sledování portu", ["discover_devices"] = "Objevte zařízení", ["enable_port_monitor"] = "Povolit sledování portu", ["errors_filter"] = "Filtr chyb", ["errors_since"] = "Chyby od", ["ifName"] = "Název rozhraní", ["ifindex"] = "Index", ["in_bytes"] = "V bajtech", ["in_discards"] = "Ve vyřazených", ["in_errors"] = "V chybách", ["interface_device"] = "Rozhraní %{interface} [ %{device} ]", ["interfaces_with_discards"] = "Rozhraní s vyřazení", ["interfaces_with_errors"] = "Rozhraní s chybami", ["interfaces_with_errors_or_discards"] = "Rozhraní s chybami / vyřazení", ["last_change"] = "Poslední změna", ["low_port_speed"] = "Nízká rychlost portu", ["multiple_macs_non_trunk"] = "Multiple MACs on non-trunk port", ["no_answer"] = "Žádná odpověď od hostitele %{host}: prosím zkontrolujte, zda je SNMP nastaven a komunita je nastavena na správnou hodnotu", ["no_host_discovered"] = "Nebyl nalezen žádný hostitel %{host}/%{cidr}", ["note"] = "POZNÁMKA", ["object_id"] = "ObjectID", ["out_bytes"] = "Z bajtů", ["per_interface_settings"] = "Toto nastavení ovlivňuje pouze rozhraní \"%{iface}\". Navštivte <a href=\"%{url}\">%{global}</a> pro globální konfiguraci.", ["port_macs"] = "Mac adresy", ["port_macs_short"] = "MACs", ["remove_all_snmp_devices"] = "Odebrat všechna zařízení SNMP", ["remove_all_snmp_devices_confirm"] = "Opravdu chcete odebrat všechna zařízení SNMP?", ["remove_snmp_device"] = "Odebrat zařízení SNMP", ["remove_snmp_device_confirm"] = "Opravdu chcete odebrat zařízení SNMP %{device}?", ["snmp_all_interfaces"] = "Všechna rozhraní", ["snmp_also_seen_on"] = "Také vidět na", ["snmp_and_n_more_interfaces"] = "a <a href='%{url}'>%{count} více rozhraní</a>", ["snmp_community"] = "Komunita SNMP", ["snmp_device"] = "Zařízení SNMP", ["snmp_device_does_not_respond"] = "Zařízení SNMP neodpovídá.", ["snmp_device_last_poll"] = "4as od posledního Poll", ["snmp_device_polling_disabled"] = "Periodické Polling zařízení je zakázáno. Zobrazené informace mohou chybět nebo mohou být neaktuální. Polling lze povolit pomocí <a href=\"%{url}\"><i class=\"fas fa-flask\"></i> Preference</a>.", ["snmp_device_x"] = "%{device}", ["snmp_devices"] = "Zařízení SNMP", ["snmp_interface"] = "Rozhraní SNMP", ["snmp_interface_type"] = "Typ rozhraní", ["snmp_interface_x"] = "Rozhraní: %{interface}", ["snmp_interfaces"] = "Rozhraní", ["snmp_monitor_disable_confirm"] = "Opravdu chcete zakázat monitorování stavu portu na zařízení SNMP %{device}?", ["snmp_monitor_enable_confirm"] = "Opravdu chcete povolit monitorování stavu portu na zařízení SNMP %{device}? Upozornění budou generována vždy, když port změní stav.", ["snmp_note_bridge_mib"] = "Periodic SNMP walks on the Bridge MIB are performed to populate the table.", ["snmp_note_bridge_mib_status"] = "Zobrazený stav je stav MIB dot1qTpFdbStatus Bridge spojený s adresou mac.", ["snmp_note_periodic_interfaces_polling"] = "Pravidelné SNMP walks se provádějí pro aktualizaci rozhraní v pravidelných 5 minutových intervalech.", ["snmp_note_thpt_calc"] = "Propustnost odpovídá celkovému provozu (in + out) během dvou posledních po sobě jdoucích SNMP walks.", ["snmp_note_thpt_span"] = "Na dvou posledních po sobě jdoucích SNMP walks došlo k narušení %{last} a %{prev}.", ["snmp_port_monitor"] = "Monitorování portu SNMP", ["snmp_printer"] = "Tiskárna", ["snmp_timeseries_descr"] = "Timeseries zařízení SNMP lze povolit z <a href=\"%{url}\"><i class=\"fas fa-flask\"></i> Preference</a>. K zobrazení prvních datových bodů je třeba jen pár minut.", ["snmp_version"] = "Verze SNMP", ["status_down"] = "Dolů", ["status_up"] = "Nahoru", ["testing"] = "Testování", ["tp_fbd_status_invalid"] = "neplatný", ["tp_fbd_status_learned"] = "naučený", ["tp_fbd_status_mgmt"] = "mgmt", ["tp_fbd_status_other"] = "jiný", ["tp_fbd_status_self"] = "sám", ["trunk"] = "trunk", ["unable_to_delete_snmp_device"] = "Zařízení SNMP nelze smazat %{device}", ["unresponsive_device"] = "SNMP walks jsou příliš pomalá. Zobrazené údaje mohou být zastaralé nebo chybějící. Zkontrolujte připojení k síti a odezvu zařízení. Nový pokus o skenování bude proveden za 15 minut.", ["view_device"] = "Zobrazit zařízení", }, ["snmp_page"] = { ["guide_snmp_page_message"] = "Navštivte stránku <a href='%{url}'> SNMP</a> k přidání tohoto hostitele do seznamu nakonfigurovaných zařízení SNMP.", ["not_configured_as_snmp_device_message"] = "Hostitel %{host_ip} nebyl nakonfigurován jako zařízení SNMP.", ["showing_snmp_mib_info_default_community_message"] = "Zobrazuje informace SNMP MIB načtené pomocí výchozí komunity '%{community}'", ["trying_to_retrive_message"] = "Pokus o načtení hostitele SNMP MIB pomocí výchozí komunity '%{community}'", ["unable_to_retrive_snmp_default_community_message"] = "Nelze načíst hostitele SNMP MIB pomocí výchozí komunity '%{community}'.", }, ["sprobe_page"] = { ["active_memory"] = "Aktivní paměť", ["latency"] = "Latence", ["processes"] = "Procesy", ["processes_traffic_tree"] = "Zpracovává se Traffic Tree", ["show_more_info"] = "Přejetím myší zobrazíte informace o procesu nebo dvojitým kliknutím zobrazíte další informace.", ["system_interactions"] = "Systémové interakce", ["top_processes"] = "Top procesy", ["top_users"] = "Top uživatelé", ["tree"] = "Tree", ["users"] = "Uživatelé", }, ["sub_interfaces"] = { ["add_sub_if"] = "Přidat podrozhraní", ["add_sub_if_success"] = "Podřízené rozhraní bylo úspěšně vytvořeno. <b> Aby se změna projevila, je nutné restartovat ntopng</b>.", ["confirm_delete"] = "Jste si jistí, že chcete odstranit %{name}?", ["delete"] = "Odstranit podrozhraní", ["disaggregation"] = "Vlastní rozdělení provozu", ["filter_description"] = "Je podporován rozšířený formát nBPF: kromě standardní syntaxe BPF lze použít také pole NetFlow, včetně INPUT_SNMP, OUTPUT_SNMP, SRC_VLAN, DST_VLAN.", ["filter_examples"] = "Příklady filtrů", ["invalid_xnbpf"] = "Neplatný filtr nBPF", ["note"] = "ntopng může použít filtry podobné BPF k rozčlenění příchozího provozu a přesměrování na logická dílčí rozhraní. Stejný provoz lze přesměrovat na více rozhraní v případě překrývání filtrů.", ["sub_if_name"] = "Název podřízeného rozhraní", ["traffic_filter_nbpf"] = "Filtr provozu (formát nBPF)", ["traffic_filter_xnbpf"] = "Filtr provozu (rozšířený formát nBPF)", }, ["system_stats"] = { ["delete_rtt_confirm"] = "Opravdu chcete odstranit hostitele \"%{host}\" ?", ["delete_rtt_host"] = "Odstranit RTT hostitele", ["descr_influxdb_cardinality"] = "<a href='%{car_url}'>Series cardinality %{car_fa}</a> poskytuje informaci o tom, jak náročné je pro InfluxDB zpracovat písemné body. Vysoká řadová mohutnost je primárním ovladačem využití vysoké paměti pro mnoho pracovních zátěží databáze. <a href='%{sizing_url}'>Pokyny pro dimenzování hardwaru %{sizing_fa}</a> pro sérii doporučení mohutnosti jsou k dispozici na základě hardwaru.", ["descr_influxdb_dropped_points"] = "Celkový počet bodů ntopng klesl, protože je nemohl zapsat do InfluxDB. <a href='%{drop_url}'>Důvody %{drop_fa}</a> můžou být nedostupný, spadlý, přetížený nebo výrazně narušený InfluxDB.", ["descr_influxdb_exported_points"] = "Celkový počet bodů ntopng úspěšně zapsán do InfluxDB. <a target='_blank' href='%{point_url}'>Bod %{point_fa}</a> je hodnota měření v daném čase. Body se používají k vytváření časových grafů. Příkladem bodů je počet TLS bytů odeslaných daným hostitelem v poledne a celkový počet bytů přijatých v určitém rozhraní jednu minutu po poledni.", ["descr_influxdb_exports"] = "Celkový počet, kolikrát ntopng úspěšně zapsal do InfluxDB body <a href='%{exp_url}'>odesílání POST požadavků %{exp_fa}</a> do koncového bodu / write.", ["descr_influxdb_ram_memory"] = " <a href='%{mem_url}'>celkovou paměť %{mem_fa}</a> InfluxDB získal od operačního systému k fungování.", ["descr_influxdb_storage_utilization"] = "Celkové místo na disku, které používá InfluxDB k uložení všech bodů. Použité místo na disku také zahrnuje body automaticky agregované pomocí <a target='_blank' href='%{cq_url}'>nepřetržitých dotazů %{cq_fa}</a>.", ["dropped_points"] = "Spadlé body", ["export_failures"] = "Nevydařené exporty", ["export_retries"] = "Opakované exporty", ["exported_points"] = "Celkový počet bodů", ["exported_vs_dropped_points"] = "Celkový počet vs spadlé body", ["exports"] = "Celkový počet exportů", ["exports_label"] = "Exporty", ["health"] = "Zdraví", ["high_series_cardinality"] = "Vysoká mohutnost může způsobit zpomalení databáze", ["infludb_retried_vs_failed_exports"] = "Opakované / neúspěšné exporty", ["influxdb_health_green"] = "OK", ["influxdb_health_green_descr"] = "Export do InfluxDB funguje dobře.", ["influxdb_health_red"] = "Nepodařilo se exportovat", ["influxdb_health_red_descr"] = "InfluxDB je nedosažitelný nebo příliš pomalý, neschopný držet krok s ním. Vynechání bodů.", ["influxdb_health_yellow"] = "Dočasně nelze exportovat", ["influxdb_health_yellow_descr"] = "Momentálně nelze exportovat do InfluxDB. Probíhá opakování.", ["influxdb_note_docs"] = "Dokumentace s podrobným popisem všech zobrazených polí je k dispozici v ntopngDokumentace s podrobným popisem všech zobrazených polí je k dispozici v ntopng <a target='_blank' href='%{url}'>Uživatelské příručce</a>.", ["influxdb_storage"] = "Uložiště (%{dbname})", ["last_ip"] = "Poslední IP", ["last_rtt"] = "Poslední RTT", ["max_rtt"] = "Max RTT (ms)", ["max_rtt_no_ms"] = "Max RTT", ["metric"] = "Metrický", ["no_hosts_configured"] = "Nebyli nakonfigurováni žádní hostitelé", ["no_rtt_configured_for_host"] = "Žádné RTT nakonfigurováno pro %{host}", ["probe"] = "Sonda", ["probe_config"] = "Konfigurace", ["probes"] = "Sondy", ["series_cardinality"] = "Series Cardinality", ["short_desc_influxdb_cardinality"] = "Indikace toho, jak náročné je pro InfluxDB zpracovat písemné body.", ["short_desc_influxdb_dropped_points"] = "Celkový počet bodů klesl kvůli selhání zápisu InfluxDB.", ["short_desc_influxdb_exported_points"] = "Celkový počet bodů úspěšně zapsaných do InfluxDB.", ["short_desc_influxdb_exports"] = "Celkový počet úspěšných zápisů do InfluxDB.", ["short_desc_influxdb_health"] = "Aktuální zdraví exportu InfluxDB.", ["short_desc_influxdb_ram_memory"] = "Celková paměť, kterou InfluxDB získal z operačního systému.", ["short_desc_influxdb_storage_utilization"] = "Celkové místo na disku, které používá InfluxDB.", ["value"] = "Hodnota", ["write_througput"] = "Napište propustnost", ["redis"] = { ["redis_health_green"] = "OK", ["redis_health_green_descr"] = "Redis pracuje OK.", ["redis_health_red"] = "Problémy s perzistencí", ["redis_health_red_descr"] = "Redis nemůže data přetrvávat. Očekávejte %{product} k poruše.", ["redis_keys"] = "Databázové klíče", ["short_desc_redis_health"] = "Aktuální zdraví Redis.", ["short_desc_redis_keys"] = "Celkem klíčů v databázi Redis.", ["short_desc_redis_ram_memory"] = "Celková paměť, kterou Redis získala z operačního systému.", }, }, ["telemetry_page"] = { ["crash_report"] = "Zpráva o selhání", ["crash_report_descr"] = "Zpráva o selhání je odeslána %{product} neobvyklé ukončení. Zpráva o selhání obsahuje %{product} informace, jako je verze, architektura sestavení, operační systém a možnosti spuštění. Nic ohledně sledovaného provozu není nikdy zasláno. Následuje příklad zprávy o selhání:", ["last_data_sent"] = "Poslední data byla odeslána", ["send_telemetry_data"] = "Přispějte zasláním telemetrických dat", ["telemetry_data"] = "Telemetrická data", ["telemetry_data_change_preference"] = "<a href='%{url}'>změna</a>", ["telemetry_data_no_consent"] = "Nebyla vyjádřena žádná preference", }, ["top_hosts"] = { ["top_hosts_local"] = "Top Hostitelé (Lokální)", }, ["topk_heuristic"] = { ["precision"] = { ["aggressive"] = "Agresivní", ["disabled"] = "Zakázáno", ["less_accurate"] = "Méně přesné", ["more_accurate"] = "Přesnější", }, }, ["traffic_page"] = { ["l4_proto_overview"] = "Přehled protokolu", ["no_traffic_observed_message"] = "U zadaného hostitele nebyl pozorován žádný provoz", ["rcvd"] = "Rcvd", }, ["traffic_profiles"] = { ["advanced_filter_examples"] = "Příklady pokročilých filtrů", ["all_profiles"] = "Všechny profily", ["confirm_delete_profile"] = "Opravdu chcete profil odstranit?", ["delete_profile"] = "Odstranit profil", ["destination_network"] = "Cílová síť", ["duplicate_profile"] = "Duplikovat název profilu", ["edit_traffic_profiles"] = "Profily provozu", ["enter_profile_filter"] = "Zadejte filtr profilu", ["enter_profile_name"] = "Zadejte název profilu", ["facebook_traffic"] = "Facebook", ["host_http_https"] = "Hostujte HTTP / HTTPS", ["host_traffic"] = "Host / Hostitel", ["http_traffic"] = "HTTP", ["invalid_bpf"] = "Neplatný filtr BPF", ["max_profiles_num"] = "S touto verzí ntopng můžete vytvářet pouze %{maxnum} profilů. Chcete-li tento limit odstranit, upgradujte na verzi Enterprise", ["no_profiles"] = "Nejsou nastaveny žádné profily", ["note"] = "Poznámka", ["note_0"] = "Názvy profilů provozu umožňují alfanumerické znaky, mezery a podtržítka", ["note_1"] = "Profily provozu se používají na toky. Každý tok může mít až jeden profil, takže v případě více shod profilů je vybrán pouze první", ["profile_name"] = "Jméno profilu", ["see_ndpi_protos"] = "(použíjte %{option} pro tisk všech protokolů podporovaných nDPI)", ["simple_filter_examples"] = "Příklady jednoduchých filtrů", ["source_ethernet"] = "Zdrojová adresa MAC", ["traffic_between"] = "Provoz mezi hostiteli", ["traffic_filter_bpf"] = "Filtr provozu (formát nBPF)", ["traffic_from_to"] = "Provoz z hostitele na druhého", ["traffic_profiles"] = "Profily provozu", }, ["traffic_recording"] = { ["about_to_extract"] = "Extrahování provozu z <b>%{date_begin}</b> to <b>%{date_end}</b>", ["active_since"] = "Aktivní od", ["archive"] = "Archiv", ["completed"] = "Dokončeno", ["continuous_recording"] = "Nepřetržité sledování provozu", ["continuous_recording_and_flows"] = "Nepřetržité sledování provozu a viditelnost toku", ["delete_all_jobs"] = "Odstranit všechny úlohy", ["delete_all_jobs_confirm"] = "Opravdu chcete odstranit všechny extrakční úlohy? Aktivní úlohy budou zastaveny.", ["delete_job"] = "Smazat úlohu", ["delete_job_confirm"] = "Opravdu chcete odstranit úlohu %{job_id} a související soubory Pcap?", ["disabled"] = "Zakázáno", ["disk_space"] = "Maximální místo na disku", ["disk_space_note"] = "Maximum disk space used for recorded traffic on disk.", ["disk_space_note_in_use"] = "%{in_use} GB se v této instanci již používají.", ["download"] = "Stažení", ["download_nth_pcap"] = "Stahování Pcap #{0}", ["dump_window"] = "Dump Window", ["edit_filter"] = "Upravit filtr", ["err_alloc"] = "chyba přidělení paměti", ["err_filter"] = "nepodporovaný filtr", ["err_open"] = "nelze otevřít výpis", ["err_stuck"] = "seklý nebo přerušen", ["err_unknown"] = "neočekávaná chyba", ["ext_interface"] = "Externí rozhraní", ["extract_action"] = "Extrahovat", ["extract_now"] = "Extrahujte nyní", ["extracted_bytes"] = "Extrahované bajty", ["extracted_packets"] = "Extrahované pakety", ["extraction_scheduled"] = "Byla naplánována extrakce úlohy, zkontrolujte prosím %{page} stránku ke stažení pcap, jakmile je soubor připraven. ID úlohy pro tuto extrakci je", ["failed"] = "Selhalo", ["failure"] = "Selhání", ["failure_note"] = "Zkontrolujte trasování protokolu a zkuste restartovat službu.", ["filter_bpf"] = "Filtr (formát nBPF)", ["filter_examples"] = "Příklady filtrů", ["global_settings_note"] = "Globální nastavení (např. Licenční klíč) lze konfigurovat z <a href=\"%{url}\">Předvoleb záznamu provozu</a>.", ["invalid_bpf"] = "Neplatný filtr", ["job_date_time"] = "Datum / čas vytvoření úlohy", ["job_id"] = "ID úlohy", ["jobs"] = "Úlohy", ["logs"] = "Záznamy provozu", ["max_extracted_pcap_bytes_description"] = "Maximální velikost souborů pcap extrahovaných ze zaznamenaných dat. V případě extrakcí přesahujících tuto velikost bude výstup rozdělen do několika souborů.", ["max_extracted_pcap_bytes_title"] = "Maximální velikost extrahovaného souboru", ["missing_data_msg"] = "Záznam provozu byl zastaven nebo restartován. Některá data mohou chybět.", ["missing_parameters"] = "Chybí povinné parametry", ["msg_err_missing_timeline"] = "Nelze určit časovou osu aktuálně spuštěného n2disk. Extrakce lze provést pouze tehdy, když je n2disk aktuální a spuštěn s volbou --timeline-dir.", ["msg_err_timeline_path_not_existing"] = "Cesta Timeline nebyla v systému nalezena.", ["msg_err_unable_to_access_timeline"] = "Nelze číst zaznamenaná data. Nedostatečná oprávnění. Ujistěte se, že uživatel provozující ntopng je ve stejné skupině jako uživatel n2disk.", ["msg_err_unknown"] = "Neznámý stav.", ["msg_external_providers_detected"] = "Zjištěni externí poskytovatelé záznamu provozu Program ntopng může automaticky propojit toto rozhraní s externím poskytovatelem. Můžete nechat ntopng postarat se o nahrávání pomocí této stránky, nebo můžete <a href=\"%{url}\"><i class=\"fas fa-cog\"></i> konfigurovat</a> externí poskytovatele záznamu provozu.", ["msg_ok"] = "Připraven k extrakci", ["multiple_extracted_files"] = "Extrakce provozu generovala více souborů pcap systému %{mb} MB, je možné tento limit změnit z Předvoleb. Kliknutím na odkazy níže stáhněte soubory pcap.", ["no_data_in_interval"] = "Na vybraném časovém intervalu nejsou na disku žádná (nebo částečná) data pcap. Vezměte prosím na vědomí, že data pcap jsou ukládána každou minutu (poslední minuta není k dispozici) a stará data jsou vymazána (zkontrolujte aktuální okno výpisu v <A HREF=\"%{page}\">stavové stránce</A>). Zkuste prosím zvolit jiný časový interval.", ["no_file"] = "Zatím žádné vysypané soubory", ["no_recorded_data"] = "V zadaném časovém frame nejsou zaznamenána žádná data. Provozový záznamník potřebuje nějaký čas k zápisu posledních dat.", ["not_found"] = "Soubor nenalezen", ["not_granted"] = "Žádosti nebylo vyhověno", ["note_dump"] = "V ethernetových sítích má každý paket <A HREF=\"https://en.wikipedia.org/wiki/Ethernet_frame\">režii 24 bajtů </A> [preambule, začátek rámce, CRC, IFG]. Taková režie se účtuje do provozu rozhraní, ale nepřidává se k provozu, který je ukládán na disk. Z tohoto důvodu se může počet bytů na této stránce lišit od těch, které jsou uvedeny v grafu rozhraní.", ["packet_dumps"] = "Výpisy paketů", ["pcap_download"] = "Extrahovat pcap", ["pcap_download_message"] = "Zahajte extrakci a zkontrolujte %{page} stránku ke stažení pcap, jakmile je soubor připraven.", ["processing"] = "zpracovává se", ["queue_as_job"] = "Queue as a Job", ["recording"] = "Záznam", ["restart"] = "Restart", ["restart_service"] = "Restartujte službu", ["settings"] = "Nastavení", ["start_extraction"] = "Zahajte extrakci", ["stop_job"] = "Zastavit úlohu", ["stop_job_confirm"] = "Opravdu chcete úlohu zastavit %{job_id}?", ["stopped"] = "Zastavilo", ["storage"] = "Úložiště", ["storage_dir"] = "Adresář úložiště", ["storage_directory_config"] = "Cesta úložného adresáře lze změnit zadáním <i>%{option}</i> možnosti do %{product} konfiguračního souboru.", ["storage_utilization"] = "Využití úložiště", ["storage_utilization_pcap"] = "Využití úložiště PCAP", ["traffic_extraction_jobs"] = "Traffic Extraction Jobs", ["traffic_extractions"] = "Extrakce", ["traffic_on_disk"] = "Provoz na disku", ["traffic_recording"] = "Záznam provozu", ["traffic_recording_provider"] = "Poskytovatel provozního záznamu", ["traffic_recording_settings"] = "Nastavení záznamu provozu", ["traffic_recording_status"] = "Stav záznamu provozu", ["unsupported_fields"] = "Vybraný chart poskytuje pohled na provoz, který násrtoj pro extrakci plně nepodporuje, extrahovaný provoz bude obsahovat větší provoz, než se očekávalo.", ["waiting"] = "Čekání", ["waiting_nospace"] = "Čekání (na disku není místo)", }, ["traffic_report"] = { ["current_day"] = "Aktuální den", ["current_month"] = "Aktuální měsíc", ["current_week"] = "Tento týden", ["daily"] = "Denně", ["header_daily"] = "Denní zpráva", ["header_monthly"] = "Měsíční zpráva", ["header_weekly"] = "Týdenní zpráva", ["monthly"] = "Měsičně", ["previous_day"] = "Předchozí den", ["previous_month"] = "Předchozí měsíc", ["previous_week"] = "Předchozí týden", ["weekly"] = "Týdně", }, ["tree_map"] = { ["hosts_treemap"] = "Hosts Tree Map", }, ["unknown_devices"] = { ["active_only"] = "Pouze aktivní", ["all_devices"] = "Všechna zařízení", ["assign_device_pool"] = "Přiřadit zařízení fondu", ["assign_pool"] = "Přiřadit k fondu", ["device_name"] = "Název zařízení", ["devices_only_note"] = "Zařízení není považováno za nepřiřazené, pokud pro tuto adresu MAC nejsou definováni žádné členy fondu. Členské adresy založené na IP zde neplatí.", ["filter_devices"] = "Filtrovat zařízení", ["first_seen"] = "Prvně viděn", ["inactive_only"] = "Pouze neaktivní", ["last_seen"] = "Posledně viděn", ["no_pools"] = "Aby bylo možné přiřadit neznámá zařízení, musí být vytvořen hostitelský fond.", ["select_pool"] = "Vyberte z rozevíracího seznamu hostitelský fond, který chcete přiřadit '%{mac}' to:", ["unassigned_devices"] = "Nepřiřazená zařízení", }, ["user_activity"] = { ["alerts_deleted"] = "Uživatel '%{user}' vyčištil '%{status}' upozornění.", ["changed_preference"] = "Uživatel '%{user}' změněnil nastavení pro %{pref}.", ["deleted_all_interfaces_data"] = "Uživatel '%{user}' smazal data pro všechna rozhraní.", ["deleted_host_data"] = "Uživatel '%{user}' smazal data pro hostitele %{host} na rozhraní %{ifname}.", ["deleted_inactive_interfaces_data"] = "Uživatel '%{user}' smazal data pro všechna neaktivní rozhraní.", ["deleted_interface_data"] = "Uživatel '%{user}' smazal data pro rozhraní %{ifname}.", ["deleted_network_data"] = "Uživatel '%{user}' smazal data pro síť %{network} na rozhraní %{ifname}.", ["disabled_preference"] = "Uživatel '%{user}' zakázal preference %{pref}.", ["enabled_preference"] = "Uživatel '%{user}' povolil preference %{pref}.", ["exported_data"] = "Uživatel '%{user}' exportoval data JSON pro '%{mode}' hostitelé.", ["exported_data_host"] = "Uživatel '%{user}' exportoval data JSON pro '%{mode}' hostitele %{host}.", ["file_downloaded"] = "Uživatel '%{user}' stáhnul soubor '%{file}'.", ["flows_downloaded"] = "Uživatel '%{user}' stáhnul toky dat z %{from} na %{to}.", ["host_json_downloaded"] = "Uživatel '%{user}' stáhnul data JSON pro hostitele %{host}.", ["live_capture"] = "Uživatel '%{user}' zachytil živý provoz na rozhraní %{ifname}.", ["live_capture_host"] = "Uživatel '%{user}' zachytil živý provoz pro hostitele %{host} na rozhraní %{ifname}.", ["live_capture_with_filter"] = "Uživatel '%{user}' zachytil filtr pro porovnávání živých přenosů '%{filter}' na rozhraní %{ifname}.", ["live_extraction"] = "UživatelUživatel '%{user}' stáhnul provoz z rozhraní %{ifname} z %{from} na %{to}.", ["live_extraction_with_filter"] = "Uživatel '%{user}' stáhl provoz z rozhraní %{ifname} z %{from} na %{to} odpovídající filtr '%{filter}'.", ["login_not_authorized"] = "Bylo odepřeno přihlášení uživateli'%{user}'.", ["login_successful"] = "Uživatel '%{user}' přihlášen.", ["password_changed"] = "Heslo pro uživatele '%{pwd_user}' změněno uživatelem '%{user}' s ip '%{ip}'.", ["recording_disabled"] = "Uživatel '%{user}' zakázal sledování provozu na rozhraní %{ifname}.", ["recording_enabled"] = "Uživatel '%{user}' povolil sledování provozu na rozhraní %{ifname}.", ["snmp_device_added"] = "Uživatel '%{user}' přidal zařízení SNMP %{ip}.", ["snmp_device_deleted"] = "Uživatel '%{user}' odebral zařízení SNMP %{ip}.", ["unknown_activity"] = "Uživatel '%{user}' dělal nějakou neznámou aktivitu (%{scope}), nahlaste to prosím.", ["unknown_activity_function"] = "Uživatel '%{user}' dělal nějakou neznámou aktivitu (%{name}), nahlaste to prosím.", ["user_added"] = "Uživatel '%{add_user}' přidán uživatelem '%{user}'.", ["user_deleted"] = "Uživatel '%{del_user}' odebrán uživatelem '%{user}'.", }, ["user_info"] = { ["missing_user_name_message"] = "Chybí uživatelské jméno", ["processes"] = "Procesy", ["processes_overview"] = "Přehled procesů", ["top_l4_protocols"] = "Top protokoly", ["top_l7_protocols"] = "Top aplikace", }, ["users"] = { ["add_new_user"] = "Přidat nového uživatele", ["add_user"] = "Přidat uživatele", ["assigned_devices"] = "Přiřazená zařízení", ["cat_protocols"] = "%{cat} Aplikace", ["categories"] = "Kategorie", ["client_policy"] = "Zařízení jako klient", ["confirm_delete_user"] = "Opravdu chcete smazat uživatele \"%{user}\"?", ["delete_user"] = "Smazat uživatele", ["devices"] = "Zařízení", ["edit"] = "Upravit", ["edit_global_policies"] = "Upravit globální politiky", ["fallback_policy"] = "Záložní politika", ["full_name"] = "Celé jméno", ["global"] = "Globalní", ["global_policies"] = "Výchozí politika", ["no_users"] = "Žádní uživatelé", ["num_protocols"] = "Počet aplikací", ["policy"] = "Politika", ["protocols"] = "Aplikace", ["reset_to_defaults"] = "Obnovit na výchozí hodnoty", ["reset_to_defaults_confirm"] = "Opravdu chcete resetovat typ zařízení \"%{devtype}\" politiky k výchozím hodnotám?", ["server_policy"] = "Zařízení jako server", ["settings"] = "Nastavení", ["total_daily_time_quota"] = "Celková denní kvóta", ["total_daily_traffic_quota"] = "Celková denní provozní kvóta", ["unchanged"] = "Beze změny", ["user_exists"] = "Uživetel \"%{user}\" již existuje", ["user_x"] = "Uživatel: %{user}", ["shapers"] = { ["default"] = "Výchozí", ["drop"] = "Spadnout", ["pass"] = "Přejít", ["slow"] = "Pomalý průchod", ["slower"] = "Pomalejší průchod", }, }, ["vlan_details"] = { ["no_available_stats_for_vlan_message"] = "Žádné dostupné statistiky pro VLAN %{vlan_id}. Počkejte prosím několik minut, než povolíte %{product} sbírat nové statistiky.", ["vlan_id_parameter_missing_or_invalid_message"] = "Parametr Vlan_Id chybí nebo není platný", }, ["vlan_stats"] = { ["vlan_id"] = "VLAN ID", ["vlans"] = "VLANs", }, } return lang
gpl-3.0
TerminalShell/zombiesurvival
gamemode/cl_targetid.lua
1
2224
local trace = {mask = MASK_SHOT, mins = Vector(-2, -2, -2), maxs = Vector(2, 2, 2), filter = {}} local entitylist = {} local colTemp = Color(255, 255, 255) function GM:DrawTargetID(ent, fade) fade = fade or 1 local ts = ent:GetPos():ToScreen() local x, y = ts.x, math.Clamp(ts.y, 0, ScrH() * 0.95) colTemp.a = fade * 255 util.ColorCopy(team.GetColor(LocalPlayer():Team()), colTemp) local name = ent:Name() draw.SimpleTextBlur(name, "ZSHUDFontSmaller", x, y, colTemp, TEXT_ALIGN_CENTER) surface.SetFont("ZSHUDFontSmaller") local texw, texh = surface.GetTextSize(name) y = y + texh + 4 local healthfraction = math.max(ent:Health() / (ent:Team() == TEAM_UNDEAD and ent:GetMaxZombieHealth() or ent:GetMaxHealth()), 0) if healthfraction ~= 1 then util.ColorCopy(0.75 <= healthfraction and COLOR_HEALTHY or 0.5 <= healthfraction and COLOR_SCRATCHED or 0.25 <= healthfraction and COLOR_HURT or COLOR_CRITICAL, colTemp) local healthdisplay = math.ceil(healthfraction * 100).."%" surface.SetFont("ZSHUDFont") draw.SimpleTextBlur(healthdisplay, "ZSHUDFont", x, y, colTemp, TEXT_ALIGN_CENTER) local texw, texh = surface.GetTextSize(healthdisplay) y = y + texh + 4 end util.ColorCopy(color_white, colTemp) if ent:Team() == TEAM_UNDEAD then local classname = ent:GetZombieClassTable().Name if classname then draw.SimpleTextBlur(classname, "ZSHUDFontTiny", x, y, colTemp, TEXT_ALIGN_CENTER) end else local wep = ent:GetActiveWeapon() if wep:IsValid() then draw.SimpleTextBlur(wep:GetPrintName(), "ZSHUDFontTiny", x, y, colTemp, TEXT_ALIGN_CENTER) end end end function GM:HUDDrawTargetID(teamid) local start = EyePos() trace.start = start trace.endpos = start + EyeAngles():Forward() * 2048 trace.filter[1] = MySelf trace.filter[2] = MySelf:GetObserverTarget() local entity = util.TraceHull(trace).Entity if entity:IsValid() and entity:IsPlayer() and entity:Team() == teamid then entitylist[entity] = CurTime() end for ent, time in pairs(entitylist) do if ent:IsValid() and not (ent:IsPlayer() and ent:Team() ~= teamid) and CurTime() < time + 2 then self:DrawTargetID(ent, 1 - math.Clamp((CurTime() - time) / 2, 0, 1)) else entitylist[ent] = nil end end end
gpl-3.0
pakoito/ToME---t-engine4
game/modules/tome/data/general/objects/boss-artifacts-far-east.lua
2
18668
-- ToME - Tales of Middle-Earth -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org local Stats = require "engine.interface.ActorStats" local Talents = require "engine.interface.ActorTalents" -- This file describes artifacts associated with a boss of the game, they have a high chance of dropping their respective ones, but they can still be found elsewhere newEntity{ base = "BASE_KNIFE", define_as = "LIFE_DRINKER", power_source = {arcane=true}, unique = true, name = "Life Drinker", image = "object/artifact/dagger_life_drinker.png", unided_name = "blood coated dagger", desc = [[Black blood for foul deeds. This dagger serves evil.]], level_range = {40, 50}, rarity = 300, require = { stat = { mag=44 }, }, cost = 450, material_level = 5, combat = { dam = 42, apr = 11, physcrit = 18, dammod = {mag=0.55,str=0.35}, }, wielder = { inc_damage={ [DamageType.BLIGHT] = 15, [DamageType.DARKNESS] = 15, [DamageType.ACID] = 15, }, combat_spellpower = 12, combat_spellcrit = 10, inc_stats = { [Stats.STAT_MAG] = 6, [Stats.STAT_CUN] = 6, }, infravision = 2, }, max_power = 50, power_regen = 1, use_talent = { id = Talents.T_WORM_ROT, level = 2, power = 40 }, talent_on_spell = { {chance=15, talent=Talents.T_BLOOD_GRASP, level=2}, }, } newEntity{ base = "BASE_TRIDENT", power_source = {nature=true}, define_as = "TRIDENT_TIDES", unided_name = "ever-dripping trident", name = "Trident of the Tides", unique=true, image = "object/artifact/trident_of_the_tides.png", desc = [[The power of the tides rush through this trident. Tridents require the exotic weapons mastery talent to use correctly.]], require = { stat = { str=35 }, }, level_range = {30, 40}, rarity = 230, cost = 300, material_level = 4, combat = { dam = 80, apr = 20, physcrit = 15, dammod = {str=1.4}, damrange = 1.4, melee_project={ [DamageType.COLD] = 15, [DamageType.NATURE] = 20, }, talent_on_hit = { T_WATER_BOLT = {level=3, chance=40} } }, wielder = { combat_atk = 10, combat_spellresist = 18, see_invisible = 2, resists={[DamageType.COLD] = 25}, inc_damage = { [DamageType.COLD] = 20 }, }, talent_on_spell = { {chance=20, talent="T_WATER_BOLT", level=3} }, max_power = 150, power_regen = 1, use_talent = { id = Talents.T_FREEZE, level=3, power = 60 }, } newEntity{ base = "BASE_AMULET", power_source = {arcane=true}, define_as = "FIERY_CHOKER", unided_name = "flame-wrought amulet", name = "Fiery Choker", unique=true, image="object/artifact/fiery_choker.png", desc = [[A choker made of pure flame, casting forever shifting patterns around the neck of its wearer. Its fire seems to not harm the wearer.]], level_range = {32, 42}, rarity = 220, cost = 190, material_level = 3, wielder = { inc_stats = { [Stats.STAT_MAG] = 5, [Stats.STAT_WIL] = 4, [Stats.STAT_CUN] = 3 }, combat_spellpower = 7, combat_spellcrit = 8, resists = { [DamageType.FIRE] = 20, [DamageType.COLD] = -20, }, inc_damage={ [DamageType.FIRE] = 10, [DamageType.COLD] = -5, }, damage_affinity={ [DamageType.FIRE] = 30, }, blind_immune = 0.4, }, talent_on_spell = { {chance=10, talent=Talents.T_VOLCANO, level=3} }, } newEntity{ base = "BASE_HEAVY_ARMOR", power_source = {nature=true}, define_as = "CHROMATIC_HARNESS", image = "object/artifact/armor_chromatic_harness.png", name = "Chromatic Harness", unique=true, unided_name = "multi-hued scale-mail armour", color=colors.VIOLET, desc = [[This dragon scale harness shines with multiple colors, quickly shifting through them in a seemingly chaotic manner.]], level_range = {40, 50}, rarity = 280, cost = 500, material_level = 5, wielder = { talent_cd_reduction={[Talents.T_ICE_BREATH]=3, [Talents.T_FIRE_BREATH]=3, [Talents.T_SAND_BREATH]=3, [Talents.T_LIGHTNING_BREATH]=3, [Talents.T_CORROSIVE_BREATH]=3,}, inc_stats = { [Stats.STAT_WIL] = 6, [Stats.STAT_CUN] = 4, [Stats.STAT_STR] = 6, [Stats.STAT_LCK] = 10, }, blind_immune = 0.5, stun_immune = 0.25, knockback_immune = 0.5, esp = { dragon = 1 }, combat_def = 10, combat_armor = 14, fatigue = 16, resists = { [DamageType.COLD] = 20, [DamageType.LIGHTNING] = 20, [DamageType.FIRE] = 20, [DamageType.ACID] = 20, [DamageType.PHYSICAL] = 20, }, }, } -- Randart rings are REALLY good, these need to be brought up to par newEntity{ base = "BASE_RING", power_source = {technique=true}, define_as = "PRIDE_GLORY", name = "Glory of the Pride", unique=true, image="object/artifact/glory_of_the_pride.png", desc = [[The most prized treasure of the Battlemaster of the Pride, Grushnak. This gold ring is inscribed in the now lost orc tongue.]], unided_name = "deep black ring", level_range = {40, 50}, rarity = 280, cost = 500, material_level = 5, wielder = { max_mana = -40, max_stamina = 40, combat_physresist = 45, confusion_immune = 0.5, combat_atk = 10, combat_dam = 10, combat_def = 5, combat_armor = 10, combat_armor_hardiness = 20, fatigue = -15, talent_cd_reduction={ [Talents.T_RUSH]=6, }, inc_damage={ [DamageType.PHYSICAL] = 8, }, }, } newEntity{ base = "BASE_CLOTH_ARMOR", power_source = {arcane=true}, define_as = "BLACK_ROBE", name = "Black Robe", unique=true, unided_name = "black robe", color=colors.DARK_GREY, image = "object/artifact/robe_black_robe.png", desc = [[A silk robe, darker than the darkest night sky, it radiates power.]], level_range = {40, 50}, rarity = 280, cost = 500, material_level = 5, wielder = { inc_stats = { [Stats.STAT_MAG] = 5, [Stats.STAT_WIL] = 4, [Stats.STAT_CUN] = 3 }, see_invisible = 10, blind_immune = 0.5, combat_spellpower = 30, combat_spellresist = 25, combat_dam = 10, combat_def = 6, }, talent_on_spell = { {chance=5, talent=Talents.T_SOUL_ROT, level=3}, {chance=5, talent=Talents.T_BLOOD_GRASP, level=3}, {chance=5, talent=Talents.T_BONE_SPEAR, level=3}, }, } newEntity{ base = "BASE_LEATHER_CAP", power_source = {arcane=true}, define_as = "CROWN_ELEMENTS", name = "Crown of the Elements", unique=true, image = "object/artifact/crown_of_the_elements.png", unided_name = "jeweled crown", color=colors.DARK_GREY, desc = [[This jeweled crown shimmers with colors.]], level_range = {40, 50}, rarity = 280, cost = 500, material_level = 5, wielder = { inc_stats = { [Stats.STAT_CON] = 5, [Stats.STAT_WIL] = 3, }, resists={ [DamageType.FIRE] = 15, [DamageType.COLD] = 15, [DamageType.ACID] = 15, [DamageType.LIGHTNING] = 15, }, melee_project={ [DamageType.FIRE] = 10, [DamageType.COLD] = 10, [DamageType.ACID] = 10, [DamageType.LIGHTNING] = 10, }, inc_damage = { [DamageType.FIRE] = 8, [DamageType.COLD] = 8, [DamageType.ACID] = 8, [DamageType.LIGHTNING] = 8, }, see_invisible = 15, combat_armor = 5, fatigue = 5, }, } newEntity{ base = "BASE_GREATSWORD", power_source = {technique=true}, define_as = "MURDERBLADE", name = "Warmaster Gnarg's Murderblade", unique=true, image="object/artifact/warmaster_gnargs_murderblade.png", unided_name = "blood-etched greatsword", color=colors.CRIMSON, desc = [[A blood-etched greatsword, it has seen many foes. From the inside.]], require = { stat = { str=35 }, }, level_range = {32, 45}, rarity = 230, cost = 300, material_level = 4, combat = { dam = 60, apr = 19, physcrit = 10, dammod = {str=1.2}, special_on_hit = {desc="10% chance to send the wielder into a killing frenzy", on_kill=1, fct=function(combat, who) if not rng.percent(10) then return end who:setEffect(who.EFF_FRENZY, 3, {crit=12, power=0.3, dieat=0.25}) end}, inc_damage_type = {living=20}, }, wielder = { inc_stats = { [Stats.STAT_CON] = 15, [Stats.STAT_STR] = 15, [Stats.STAT_DEX] = 5, }, talents_types_mastery = { ["technique/2hweapon-cripple"] = 0.2, ["technique/2hweapon-offense"] = 0.2, ["technique/2hweapon-assault"] = 0.2, }, resists_actor_type = {living=20}, }, } newEntity{ base = "BASE_WHIP", power_source = {arcane=true}, define_as = "WHIP_URH_ROK", unided_name = "fiery whip", name = "Whip of Urh'Rok", color=colors.PURPLE, unique = true, image = "object/artifact/whip_of_urh_rok.png", desc = [[With this unbearably bright whip of flame, the demon master Urh'Rok has become known for never having lost in combat.]], require = { stat = { dex=48 }, }, level_range = {40, 50}, rarity = 390, cost = 250, material_level = 5, combat = { dam = 55, apr = 0, physcrit = 9, dammod = {dex=1}, damtype = DamageType.FIREKNOCKBACK, talent_on_hit = { [Talents.T_BONE_NOVA] = {level=4, chance=20}, [Talents.T_BLOOD_BOIL] = {level=3, chance=15} }, }, wielder = { esp = {["demon/minor"]=1, ["demon/major"]=1}, see_invisible = 2, combat_spellpower = 15, inc_damage={ [DamageType.FIRE] = 20, [DamageType.BLIGHT] = 20, }, }, carrier = { inc_damage={ [DamageType.BLIGHT] = 8, }, }, } --Storm fury, lightning infused bow that automatically attacks nearby enemies with bolts of lightning. newEntity{ base = "BASE_LONGBOW", power_source = {arcane=true}, define_as = "STORM_FURY", name = "Storm Fury", unique=true, unided_name = "crackling longbow", color=colors.BLUE, desc = [[This dragonbone longbow is enhanced with bands of steel, which arc with intense lightning. Bolts travel up and down the string, ignorant of you.]], require = { stat = { dex=30, mag=30 }, }, level_range = {40, 50}, rarity = 250, cost = 300, material_level = 5, sentient = true, special_desc = function(self) return "Automatically fires lightning bolts at nearby enemies, with a chance to inflict Daze." end, combat = { range=10, physspeed = 0.7, }, wielder = { combat_spellpower=20, inc_stats = { [Stats.STAT_MAG] = 7, [Stats.STAT_DEX] = 5}, combat_def_ranged = 15, ranged_project = {[DamageType.LIGHTNING] = 75}, talents_types_mastery = { ["spell/air"] = 0.2, ["spell/storm"] = 0.1, }, inc_damage={ [DamageType.LIGHTNING] = 20, }, resists={ [DamageType.LIGHTNING] = 20, }, talent_on_hit = { T_CHAIN_LIGHTNING = {level=3, chance=12},}, movement_speed=0.1, }, act = function(self) self:useEnergy() if not self.worn_by then return end if game.level and not game.level:hasEntity(self.worn_by) then self.worn_by = nil return end if self.worn_by:attr("dead") then return end self.zap = self.zap + 5 if not rng.percent(self.zap) then return end local who = self.worn_by local Map = require "engine.Map" --local project = require "engine.DamageType" local tgts = {} local DamageType = require "engine.DamageType" --local project = "engine.ActorProject" local grids = core.fov.circle_grids(who.x, who.y, 5, true) for x, yy in pairs(grids) do for y, _ in pairs(grids[x]) do local a = game.level.map(x, y, Map.ACTOR) if a and who:reactionToward(a) < 0 then tgts[#tgts+1] = a end end end local tg = {type="hit", range=5,} for i = 1, 1 do if #tgts <= 0 then break end local a, id = rng.table(tgts) table.remove(tgts, id) self.zap = 0 who:project(tg, a.x, a.y, engine.DamageType.LIGHTNING_DAZE, {daze=40, dam = rng.avg(1,3) * (40+ who:getMag() * 1.5)} ) game.level.map:particleEmitter(who.x, who.y, math.max(math.abs(a.x-who.x), math.abs(a.y-who.y)), "lightning", {tx=a.x-who.x, ty=a.y-who.y}) game:playSoundNear(self, "talents/lightning") who:logCombat(a, "#GOLD#A bolt of lightning fires from #Source#'s bow, striking #Target#!") end end, on_wear = function(self, who) self.worn_by = who self.zap = 0 end, on_takeoff = function(self) self.worn_by = nil end, } --Ice Cloak that can release massive freezing AOE, dropped by Glacial Legion. newEntity{ base = "BASE_CLOAK", define_as="GLACIAL_CLOAK", power_source = {arcane=true}, unique = true, name = "Frozen Shroud", unided_name = "chilling cloak", image = "object/artifact/frozen_shroud.png", desc = [[All that remains of the Glacial Legion. This cloak seems to exude an icy cold vapor that freezes all it touches.]], level_range = {40, 50}, rarity = 250, cost = 300, material_level = 5, wielder = { resists= {[DamageType.FIRE] = -15,[DamageType.COLD] = 25, all=8}, inc_stats = { [Stats.STAT_MAG] = 7,}, combat_def = 12, on_melee_hit = {[DamageType.ICE]=60}, }, max_power = 30, power_regen = 1, use_power = { name = "release a blast of ice", power = 30, use = function(self, who) local duration = 10 local radius = 4 local dam = (25 + who:getMag()) local blast = {type="ball", range=0, radius=radius, selffire=false, display={particle="bolt_ice", trail="icetrail"}} who:project(blast, who.x, who.y, engine.DamageType.COLD, dam*3) who:project(blast, who.x, who.y, engine.DamageType.FREEZE, {dur=6, hp=80+dam}) game.level.map:particleEmitter(who.x, who.y, blast.radius, "iceflash", {radius=blast.radius}) -- Add a lasting map effect game.level.map:addEffect(who, who.x, who.y, duration, engine.DamageType.ICE, dam, radius, 5, nil, engine.MapEffect.new{color_br=255, color_bg=255, color_bb=255, effect_shader="shader_images/ice_effect.png"}, function(e) e.radius = e.radius return true end, false ) game.logSeen(who, "%s releases a burst of freezing cold from within their cloak!", who.name:capitalize(), self:getName()) return {id=true, used=true} end }, } --Blight+Phys Greatmaul that inflicts disease, dropped by Rotting Titan. newEntity{ base = "BASE_GREATMAUL", define_as="ROTTING_MAUL", power_source = {arcane=true}, unique = true, name = "Blighted Maul", color = colors.LIGHT_RED, image = "object/artifact/blighted_maul.png", unided_name = "rotten stone limb", desc = [[The massive stone limb of the Rotting Titan, a mass of stone and rotting flesh. You think you can lift it, but it is very heavy.]], level_range = {40, 50}, rarity = 250, require = { stat = { str=60 }, }, cost = 300, metallic = false, encumber = 12, material_level = 5, combat = { dam = 96, apr = 22, physcrit = 10, physspeed=1.2, dammod = {str=1.4}, convert_damage = {[DamageType.BLIGHT] = 20}, melee_project={[DamageType.ITEM_BLIGHT_DISEASE] = 50}, special_on_hit = {desc="Damages enemies in radius 1 around your target (based on Strength).", on_kill=1, fct=function(combat, who, target) local o, item, inven_id = who:findInAllInventoriesBy("define_as", "ROTTING_MAUL") local dam = rng.avg(1,3) * (70+ who:getStr()) game.logSeen(who, "The ground shakes as the %s hits!", o:getName()) local tg = {type="ball", range=10, selffire=false, force_target=target, radius=1, no_restrict=true} who:project(tg, target.x, target.y, engine.DamageType.PHYSICAL, dam) end}, }, wielder = { inc_damage={[DamageType.PHYSICAL] = 12,}, knockback_immune=0.3, combat_critical_power = 40, }, max_power = 50, power_regen = 1, use_power = { name = "knock away nearby foes", power = 50, use = function(self, who) local dam = rng.avg(1,2) * (125+ who:getStr() * 3) local tg = {type="ball", range=0, selffire=false, radius=4, no_restrict=true} who:project(tg, who.x, who.y, engine.DamageType.PHYSKNOCKBACK, {dam=dam, dist=4}) game.logSeen(who, "%s slams their %s into the ground, sending out a shockwave!", who.name:capitalize(), self:getName()) return {id=true, used=true} end }, } --Molten Skin, dropped by Heavy Sentinel. newEntity{ base = "BASE_LIGHT_ARMOR", power_source = {arcane=true}, define_as = "ARMOR_MOLTEN", unided_name = "melting bony armour", name = "Molten Skin", unique=true, image = "object/artifact/molten_skin.png", desc = [[This mass of fused molten bone from the Heavy Sentinel radiates intense power. It still glows red with the heat of the Sentinel's core, and yet seems to do you no harm.]], level_range = {40, 50}, rarity = 250, cost = 300, material_level=5, moddable_tile = "special/molten_skin", moddable_tile_big = true, wielder = { combat_spellpower = 15, combat_spellcrit = 10, combat_physcrit = 8, combat_damage = 10, combat_critical_power = 20, combat_def = 15, combat_armor = 12, inc_stats = { [Stats.STAT_MAG] = 6,[Stats.STAT_CUN] = 6,}, melee_project={[DamageType.FIRE] = 30,[DamageType.LIGHT] = 15,}, ranged_project={[DamageType.FIRE] = 30,[DamageType.LIGHT] = 15,}, on_melee_hit = {[DamageType.FIRE]=30}, inc_damage={ [DamageType.FIRE] = 20, [DamageType.LIGHT] = 5, all=10, }, resists={ [DamageType.FIRE] = 20, [DamageType.LIGHT] = 12, [DamageType.COLD] = -5, }, resists_pen={ [DamageType.FIRE] = 15, [DamageType.LIGHT] = 10, }, talents_types_mastery = { ["spell/fire"] = 0.1, ["spell/wildfire"] = 0.1, ["celestial/sun"] = 0.1, ["celestial/sunlight"] = 0.1, }, }, max_power = 16, power_regen = 1, use_talent = { id = Talents.T_BLASTWAVE, level = 4, power = 12 }, } newEntity{ base = "BASE_RING", power_source = {arcane=true}, define_as = "AETHER_RING", name = "Void Orb", unique=true, image = "object/artifact/void_orbs.png", desc = [[This thin grey ring is adorned with a deep black orb. Tiny white dots swirl slowly within it, and a faint purple light glows from its core.]], unided_name = "ethereal ring", level_range = {40, 50}, rarity = 250, cost = 300, material_level = 5, wielder = { max_mana = 35, combat_spellresist = 10, combat_spellpower = 10, combat_spellcrit=5, silence_immune = 0.3, talent_cd_reduction={ [Talents.T_AETHER_AVATAR]=4, }, inc_damage={ [DamageType.ARCANE] = 15, [DamageType.PHYSICAL] = 4, [DamageType.FIRE] = 4, [DamageType.COLD] = 4, [DamageType.LIGHTNING] = 4, all=5}, resists={ [DamageType.ARCANE] = 15,}, resists_pen={ [DamageType.ARCANE] = 10,}, melee_project={ [DamageType.ARCANE] = 15,}, talents_types_mastery = { ["spell/arcane"] = 0.1, ["spell/aether"] = 0.1, }, }, talent_on_spell = { {chance=10, talent="T_ARCANE_VORTEX", level = 2} }, max_power = 6, power_regen = 1, use_talent = { id = Talents.T_MANATHRUST, level = 4, power = 6 }, }
gpl-3.0
kk580kk/docker-kk
kong/Postgres/nginx_kong.lua
1
6136
return [[ charset UTF-8; > if anonymous_reports then ${{SYSLOG_REPORTS}} > end error_log ${{PROXY_ERROR_LOG}} ${{LOG_LEVEL}}; > if nginx_optimizations then >-- send_timeout 60s; # default value >-- keepalive_timeout 75s; # default value >-- client_body_timeout 60s; # default value >-- client_header_timeout 60s; # default value >-- tcp_nopush on; # disabled until benchmarked >-- proxy_buffer_size 128k; # disabled until benchmarked >-- proxy_buffers 4 256k; # disabled until benchmarked >-- proxy_busy_buffers_size 256k; # disabled until benchmarked >-- reset_timedout_connection on; # disabled until benchmarked > end client_max_body_size ${{CLIENT_MAX_BODY_SIZE}}; proxy_ssl_server_name on; underscores_in_headers on; lua_package_path '${{LUA_PACKAGE_PATH}};;'; lua_package_cpath '${{LUA_PACKAGE_CPATH}};;'; lua_socket_pool_size ${{LUA_SOCKET_POOL_SIZE}}; lua_max_running_timers 4096; lua_max_pending_timers 16384; lua_shared_dict kong 5m; lua_shared_dict kong_cache ${{MEM_CACHE_SIZE}}; lua_shared_dict kong_db_cache_miss 12m; lua_shared_dict kong_process_events 5m; lua_shared_dict kong_cluster_events 5m; lua_shared_dict kong_healthchecks 5m; lua_shared_dict kong_rate_limiting_counters 12m; > if database == "cassandra" then lua_shared_dict kong_cassandra 5m; > end lua_socket_log_errors off; > if lua_ssl_trusted_certificate then lua_ssl_trusted_certificate '${{LUA_SSL_TRUSTED_CERTIFICATE}}'; lua_ssl_verify_depth ${{LUA_SSL_VERIFY_DEPTH}}; > end init_by_lua_block { kong = require 'kong' kong.init() } init_worker_by_lua_block { kong.init_worker() } > if #proxy_listeners > 0 then upstream kong_upstream { server 0.0.0.1; balancer_by_lua_block { kong.balancer() } keepalive ${{UPSTREAM_KEEPALIVE}}; } #修改点 http://platform.baosight.com:8090/pages/viewpage.action?pageId=25988298 log_format tracelog '$remote_addr - $remote_user [$time_local] "$request" ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" ' '"$gzip_ratio" $request_time $bytes_sent $request_length' ' "$http_traceid" "$http_spanid"'; server { server_name kong; > for i = 1, #proxy_listeners do listen $(proxy_listeners[i].listener); > end error_page 400 404 408 411 412 413 414 417 494 /kong_error_handler; error_page 500 502 503 504 /kong_error_handler; access_log ${{PROXY_ACCESS_LOG}} tracelog;#修改点 http://platform.baosight.com:8090/pages/viewpage.action?pageId=25988298 error_log ${{PROXY_ERROR_LOG}} ${{LOG_LEVEL}}; client_body_buffer_size ${{CLIENT_BODY_BUFFER_SIZE}}; > if proxy_ssl_enabled then ssl_certificate ${{SSL_CERT}}; ssl_certificate_key ${{SSL_CERT_KEY}}; ssl_protocols TLSv1.1 TLSv1.2; ssl_certificate_by_lua_block { kong.ssl_certificate() } ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; ssl_prefer_server_ciphers on; ssl_ciphers ${{SSL_CIPHERS}}; > end > if client_ssl then proxy_ssl_certificate ${{CLIENT_SSL_CERT}}; proxy_ssl_certificate_key ${{CLIENT_SSL_CERT_KEY}}; > end real_ip_header ${{REAL_IP_HEADER}}; real_ip_recursive ${{REAL_IP_RECURSIVE}}; > for i = 1, #trusted_ips do set_real_ip_from $(trusted_ips[i]); > end location / { set $upstream_host ''; set $upstream_upgrade ''; set $upstream_connection ''; set $upstream_scheme ''; set $upstream_uri ''; set $upstream_x_forwarded_for ''; set $upstream_x_forwarded_proto ''; set $upstream_x_forwarded_host ''; set $upstream_x_forwarded_port ''; proxy_redirect ~^(http://[^:]+):\d+(/.+)$ $2; #修改点 http://platform.baosight.com:8090/pages/viewpage.action?pageId=24286150 rewrite_by_lua_block { kong.rewrite() } access_by_lua_block { kong.access() } proxy_http_version 1.1; proxy_set_header Host $upstream_host; proxy_set_header Upgrade $upstream_upgrade; proxy_set_header Connection $upstream_connection; proxy_set_header X-Forwarded-For $upstream_x_forwarded_for; proxy_set_header X-Forwarded-Proto $upstream_x_forwarded_proto; proxy_set_header X-Forwarded-Host $upstream_x_forwarded_host; proxy_set_header X-Forwarded-Port $upstream_x_forwarded_port; proxy_set_header X-Real-IP $remote_addr; proxy_pass_header Server; proxy_pass_header Date; proxy_ssl_name $upstream_host; proxy_pass $upstream_scheme://kong_upstream$upstream_uri; header_filter_by_lua_block { kong.header_filter() } body_filter_by_lua_block { kong.body_filter() } log_by_lua_block { kong.log() } } location = /kong_error_handler { internal; content_by_lua_block { kong.handle_error() } } } > end > if #admin_listeners > 0 then server { server_name kong_admin; > for i = 1, #admin_listeners do listen $(admin_listeners[i].listener); > end access_log ${{ADMIN_ACCESS_LOG}}; error_log ${{ADMIN_ERROR_LOG}} ${{LOG_LEVEL}}; client_max_body_size 10m; client_body_buffer_size 10m; > if admin_ssl_enabled then ssl_certificate ${{ADMIN_SSL_CERT}}; ssl_certificate_key ${{ADMIN_SSL_CERT_KEY}}; ssl_protocols TLSv1.1 TLSv1.2; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; ssl_prefer_server_ciphers on; ssl_ciphers ${{SSL_CIPHERS}}; > end location / { default_type application/json; content_by_lua_block { kong.serve_admin_api() } } location /nginx_status { internal; access_log off; stub_status; } location /robots.txt { return 200 'User-agent: *\nDisallow: /'; } } > end ]]
lgpl-3.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Tasks/VisualScene/SceneNode.lua
1
7022
--[[ Title: SceneNode Author(s): leio Date: 2021/1/7 Desc: use the lib: ------------------------------------------------------------ local SceneNode = NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/VisualScene/SceneNode.lua"); ------------------------------------------------------------ --]] local VisualSceneLogic = NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/VisualScene/VisualSceneLogic.lua"); NPL.load("(gl)script/ide/System/Core/ToolBase.lua"); local SceneNode = commonlib.inherit(commonlib.gettable("System.Core.ToolBase"), NPL.export()); SceneNode:Property({"Uid", "", auto = true, camelCase = true, }); SceneNode:Property({"Name", "", auto = true, camelCase = true, }); SceneNode:Property({"IsRoot", false, auto = true, camelCase = true, }); SceneNode:Property({"Scene", auto = true, type = "Scene", camelCase = true, }); SceneNode:Property({"Parent", auto = true, type = "SceneNode", camelCase = true, }); function SceneNode:ctor() self.components = {}; self.Uid = ParaGlobal.GenerateUniqueID(); self.Nodes = {}; self.index = 0; self.Level = 0; end -- get first component by name function SceneNode:getComponentByName(name) if(not name)then return end for k, v in ipairs(self.components) do if(v.Name == name)then return v; end end end function SceneNode:addComponent(component, index) if(not component)then return end if(type(component) == "string")then component = VisualSceneLogic.getComponent(component); if(not component)then return end component = component:new(); end if(not component.Uid or component.Uid == "")then component.Uid = ParaGlobal.GenerateUniqueID(); end component.Root = self; if(component.onAddedToNode)then component:onAddedToNode(self); end if(self.Scene)then if(component.onAddedToScene)then component:onAddedToScene(self.Scene); end end if(index == nil)then table.insert(self.components, component); else table.insert(self.components, index, component); end return component; end function SceneNode:removeComponent(component) if(not component)then return end if(type(component) == "string")then component = VisualSceneLogic.getComponent(component); if(not component)then return end end if(component.onRemovedFromNode)then component:onRemovedFromNode(self); end if(self.Scene)then if(component.onRemovedFromScene)then component:onRemovedFromScene(self.Scene); end end for k,v in ipairs(self.components) do if(v == component)then table.remove(self.components,k); break; end end end -- Get child count function SceneNode:getChildCount() return table.getn(self.Nodes); end -- get child by index. index is 1 based. function SceneNode:getChild(index) return self.Nodes[index]; end -- Clear all child nodes function SceneNode:clearAllChildren() self.Nodes = {} end -- Add a new child node, the child node is returned -- @param o: it can be a tree node object -- @param index: nil or index at which to insert the object. if nil, it will inserted to the last element. if 1, it will inserted to the first element. function SceneNode:addChild(o, index) if(type(o) == "table") then local nodes = self.Nodes; local nSize = table.getn(nodes); if(index == nil or index>nSize or index<=0) then -- add to the end nodes[nSize+1] = o; o.index = nSize+1; else -- insert to the mid local i=nSize+1; while (i>index) do nodes[i] = nodes[i-1]; nodes[i].index = i; i = i - 1; end nodes[index] = o; o.index = index; end -- for Parent o.Parent = self; o.Scene = self.Scene; o.Level = self.Level+1; --log(o.index.." added as "..tostring(o.Text).."\n") return o; end end -- added by Andy 2008/12/21 -- remove all occurance of first level child node whose index is index function SceneNode:removeChildByIndex(index) local nodes = self.Nodes; local nSize = table.getn(nodes); local i, node; if(nSize == 1) then nodes[1] = nil; return; end if(index < nSize) then local k; for k = index + 1, nSize do node = nodes[k]; nodes[k-1] = node; if(node ~= nil) then node.index = k - 1; nodes[k] = nil; end end else nodes[index] = nil; end end -- remove all occurance of first level child node whose name is name function SceneNode:removeChildByName(name) local nodes = self.Nodes; local nSize = table.getn(nodes); local i, node; if(nSize == 1) then nodes[1] = nil; return; end for i=1, nSize do node = nodes[i]; if(node~=nil and name == node.Name) then if(i<nSize) then local k; for k=i+1, nSize do node = nodes[k]; nodes[k-1] = node; if(node~=nil) then node.index = k-1; nodes[k] = nil; end end else nodes[i] = nil; end end end end -- detach this node from its Parent node. function SceneNode:detach() local parentNode = self.Parent if(parentNode == nil) then return end local nSize = table.getn(parentNode.Nodes); local i, node; if(nSize == 1) then parentNode.Nodes[1] = nil; return; end local i = self.index; local node; if(i<nSize) then local k; for k=i+1, nSize do node = parentNode.Nodes[k]; parentNode.Nodes[k-1] = node; if(node~=nil) then node.index = k-1; parentNode.Nodes[k] = nil; end end else parentNode.Nodes[i] = nil; end end -- get the first occurance of first level child node whose name is name function SceneNode:getChildByName(name) local nodes = self.Nodes; local nSize = table.getn(nodes); local i, node; for i=1, nSize do node = nodes[i]; if(node~=nil and name == node.Name) then return node; end end end function SceneNode:toJson() local object = {}; object.Uid = self.Uid; object.Name = self.Name; object.IsRoot = self.IsRoot; -- components object.components = {}; for k,v in ipairs(self.components) do table.insert(object.components,v:toJson()); end -- Nodes object.Nodes = {}; for k,v in ipairs(self.Nodes) do table.insert(object.Nodes,v:toJson()); end return object; end function SceneNode:run() -- for creating entity self:runNode(self,"reload"); self:runNode(self,"run"); end function SceneNode:stop() self:runNode(self,"stop"); end function SceneNode:reload() self:runNode(self,"reload"); end function SceneNode:runNode(parent, action) if(not parent)then return end if(parent.components)then for kk,vv in ipairs(parent.components) do if(vv[action])then vv[action](vv); end end end local len = parent:getChildCount(); for k = 1, len do local child = parent:getChild(k); self:runNode(child,action); end end
gpl-2.0
TeamHypersomnia/Hypersomnia
hypersomnia/content/gfx/resistance_torso_heavy_gtm_5.meta.lua
2
2789
return { extra_loadables = { enabled_generate_neon_map = { alpha_multiplier = 0.40000000596046448, amplification = 100, light_colors = { "223 113 38 255" }, radius = { x = 80, y = 80 }, standard_deviation = 6 }, generate_desaturation = false }, offsets = { gun = { bullet_spawn = { x = 0, y = 0 }, chamber = { pos = { x = 0, y = 0 }, rotation = 0 }, chamber_magazine = { pos = { x = 0, y = 0 }, rotation = 0 }, detachable_magazine = { pos = { x = 0, y = 0 }, rotation = 0 }, shell_spawn = { pos = { x = 0, y = 0 }, rotation = 0 } }, item = { attachment_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, back_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, beep_offset = { pos = { x = 0, y = 0 }, rotation = 0 }, hand_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, head_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, shoulder_anchor = { pos = { x = 0, y = 0 }, rotation = 0 } }, legs = { foot = { x = 0, y = 0 } }, non_standard_shape = { convex_partition = {}, original_poly = {} }, torso = { back = { pos = { x = -6, y = -10 }, rotation = 45 }, head = { pos = { x = 2, y = -1 }, rotation = 17.198541641235352 }, legs = { pos = { x = 0, y = 0 }, rotation = 0 }, primary_hand = { pos = { x = 10, y = 28 }, rotation = -33.690067291259766 }, secondary_hand = { pos = { x = 39, y = 7 }, rotation = 82.234832763671875 }, secondary_shoulder = { pos = { x = -1, y = 18 }, rotation = -166 }, shoulder = { pos = { x = 20, y = -11 }, rotation = -122 }, strafe_facing_offset = 0 } }, usage_as_button = { bbox_expander = { x = 0, y = 0 }, flip = { horizontally = false, vertically = false } } }
agpl-3.0
lubyk/dub
test/lua_memory_test.lua
4
6072
--[[------------------------------------------------------ dub.LuaBinder ------------- Test binding with the 'memory' group of classes: * no gc optimization --]]------------------------------------------------------ local lub = require 'lub' local lut = require 'lut' local dub = require 'dub' local should = lut.Test('dub.LuaBinder - memory', {coverage = false}) local binder = dub.LuaBinder() local elapsed = function() return 0 end local ins_opts = { INPUT = lub.path '|fixtures/memory', doc_dir = lub.path '|tmp', PREDEFINED = { 'SOME_FUNCTION_MACRO(x)=', 'OTHER_FUNCTION_MACRO(x)=', } } local ins = dub.Inspector(ins_opts) local mem --=============================================== Nogc bindings function should.bindClass() local Nogc = ins:find('Nogc') local res = binder:bindClass(Nogc) assertMatch('luaopen_Nogc', res) end function should.notBindDestructor() local Nogc = ins:find('Nogc') local res = binder:bindClass(Nogc) assertNotMatch('__gc', res) end function should.pushFullUserdataInRetval() local Nogc = ins:find('Nogc') local met = Nogc:method('operator+') local res = binder:functionBody(Nogc, met) assertMatch('dub::pushfulldata<Nogc>%(L, self%->operator%+%(%*v%), "Nogc"%);', res) end function should.useCustomPush() local Pen = ins:find('Pen') local met = Pen:method('Pen') local res = binder:functionBody(Pen, met) assertMatch('retval__%->dub_pushobject%(L, retval__, "Pen", true%);', res) end function should.bindDestructor() local Withgc = ins:find('Withgc') local res = binder:bindClass(Withgc) assertMatch('__gc', res) end --=============================================== Build function should.bindCompileAndLoad() -- create tmp directory local tmp_path = lub.path '|tmp' lub.rmTree(tmp_path, true) os.execute("mkdir -p "..tmp_path) local ins = dub.Inspector(ins_opts) binder:bind(ins, { output_directory = tmp_path, single_lib = 'mem', attr_name_filter = function(elem) return elem.name:match('(.*)_$') or elem.name end, }) local cpath_bak = package.cpath assertPass(function() -- Build mem.so binder:build { output = lub.path '|tmp/mem.so', inputs = { lub.path '|tmp/dub/dub.cpp', lub.path '|tmp/mem_Nogc.cpp', lub.path '|tmp/mem_Withgc.cpp', lub.path '|tmp/mem_Union.cpp', lub.path '|tmp/mem_Pen.cpp', lub.path '|tmp/mem_Owner.cpp', lub.path '|tmp/mem_PrivateDtor.cpp', lub.path '|tmp/mem_CustomDtor.cpp', lub.path '|tmp/mem_NoDtor.cpp', lub.path '|tmp/mem_NoDtorCleaner.cpp', lub.path '|fixtures/memory/owner.cpp', lub.path '|tmp/mem.cpp', }, includes = { lub.path '|tmp', -- This is for lua.h lub.path '|tmp/dub', lub.path '|fixtures/memory', }, } package.cpath = tmp_path .. '/?.so' --require 'Box' mem = require 'mem' assertType('table', mem) end, function() -- teardown package.cpath = cpath_bak if not mem then lut.Test.abort = true end end) --lub.rmTree(tmp_path, true) end --=============================================== Nogc local function createAndDestroyMany(ctor) local t = {} local start = elapsed() for i = 1,100000 do table.insert(t, ctor(1,3)) end t = nil collectgarbage() collectgarbage() return elapsed() - start end local function runGcTest(ctor, fmt) -- warmup createAndDestroyMany(ctor) local vm_size = collectgarbage('count') if fmt then local t = createAndDestroyMany(ctor) printf(fmt, t) else createAndDestroyMany(ctor) end assertEqual(vm_size, collectgarbage('count'), 1.5) end function should.createAndDestroy() if test_speed then local lens = require 'lens' elapsed = lens.elapsed runGcTest(mem.Nogc.new, "__gc optimization: create and destroy 100'000 elements: %.2f ms.") runGcTest(mem.Withgc.new, "Normal __gc: create and destroy 100'000 elements: %.2f ms.") runGcTest(mem.Withgc, "Normal __gc and __call: create and destroy 100'000 elements: %.2f ms.") else runGcTest(mem.Nogc.new) runGcTest(mem.Withgc.new) end end --=============================================== UNION function should.destroyFromLua() local p = mem.Pen('Arty') local o = mem.Owner() p:setOwner(o) p = nil collectgarbage() collectgarbage() -- Destructor called in C++ assertEqual("Pen 'Arty' is dying...", o.message) end function should.destroyFromCpp() local p = mem.Pen('Arty') local o = mem.Owner(p) o:destroyPen() -- Destructor called in C++ assertEqual("Pen 'Arty' is dying...", o.message) -- Object is dead in Lua assertError('lua_memory_test.lua:[0-9]+: name: using deleted mem.Pen', function() p:name() end) assertTrue(p:deleted()) end function should.considerAnonUnionAsMembers() local u = mem.Union(10, 15, 4, 100) assertEqual(10, u.h) assertEqual(15, u.s) assertEqual(4, u.v) assertEqual(100, u.a) local c = 10 + (15 * 2^8) + (4 * 2^16) + (100 * 2^24) assertEqual(c, u.c) u.a = 11 local c = 10 + (15 * 2^8) + (4 * 2^16) + (11 * 2^24) assertEqual(c, u.c) end --=============================================== Custom dtor function should.useCustomDtor() local d = mem.CustomDtor() local t function d:callback() t = true end assertNil(t) d = nil collectgarbage('collect') collectgarbage('collect') assertTrue(t) end --=============================================== No dtor function should.notUseDtor() local d = mem.NoDtor('Hulk') local cleaner = mem.NoDtorCleaner(d) local t -- When d is deleted, it calls cleaner->deleted which -- calls this callback. function cleaner:callback(s) t = s end assertNil(t) d = nil collectgarbage('collect') collectgarbage('collect') -- Callback not called: d is not deleted assertNil(t) -- Explicitely delete attached NoDtor. cleaner:cleanup() -- Callback called: d is deleted assertEqual('Hulk', t) end should:test()
mit
pixeljetstream/luajit_gfx_sandbox
runtime/lua/csvfile.lua
2
6417
-- copyright 2009-2016 Christoph Kubisch -- Released under MIT license local csv = {} local CSVFile = {} csv.CSVFile = CSVFile function CSVFile.new(class) local self = {} setmetatable(self,{ __index = class, }) return self end function CSVFile:read(filePath) local handle = io.open(filePath, "rb") if not handle then return end for line in FileLines(handle) do if (not self.descr) then self.descr = {} self.data = {} self.lookup = {} local n = 1 for word in string.gmatch(line,'(%b""),*') do word = string.sub(word,2,-2) table.insert(self.descr, word) table.insert(self.data, {}) self.lookup[word] = n n = n + 1 end else local n = 1 for word in string.gmatch(line,'(%b""),*') do word = string.sub(word,2,-2) word = string.gsub(word,",",".") table.insert(self.data[n], tonumber(word) or word) n = n + 1 end end end handle:close() return self end function CSVFile:rename(from,to) local idx = self.lookup[from] self.lookup[to] = idx self.descr[idx] = to self.lookup[from] = nil end function CSVFile:getDescriptor() return self.descr end function CSVFile:merge(a,b) local output = self local inputs = b and {a,b} or {a} local checka = b and a or self local checkb = b or a if (b) then self.descr = {} self.lookup = {} self.data = {} local n = 1 for i,v in ipairs(checka.descr) do if checka.lookup[v] then table.insert(self.descr,v) self.lookup[v] = n n = n + 1 end end if (#self.descr < 1) then return nil end for i,v in ipairs(self.descr) do table.insert(self.data,{}) end else for i,v in ipairs(checka.descr) do if checkb.descr[i] ~= v then print("MisMatch:",checkb.descr[i],v) return nil end end end for n,from in ipairs(inputs) do for i,v in ipairs(self.descr) do local merge = from.data[from.lookup[v]] local to = self.data[i] for n,elem in ipairs(merge) do table.insert(to,elem) end end end return self end function CSVFile:getData(what) return self.data[self.lookup[what]] end function CSVFile:setData(what,data) self.data[self.lookup[what]] = data end function CSVFile:appendData(what,data) self.descr = self.descr or {} self.data = self.data or {} self.lookup = self.lookup or {} table.insert(self.descr,what) self.lookup[what] = #self.descr self.data[#self.descr] = data end function CSVFile:sort(what,comp) assert(self.data) local ordered = {} local data = self.data[self.lookup[what]] local count = #data for i=1,count do local key = {i,data[i]} table.insert(ordered,key) end table.sort(ordered,function(a,b) return comp(a[2],b[2]) end) for n,v in ipairs(self.data) do local newdata = {} for i=1,count do local key = ordered[i][1] table.insert(newdata, v[key]) end self.data[n] = newdata end end function CSVFile:write(filePath, elems) assert(self.data) local handle = io.open(filePath, "wb") if not handle then return end local cnt = #self.descr for i,v in ipairs(self.descr) do handle:write('"'..v..'"'..((i < cnt) and "," or "")) end handle:write("\n") elems = elems or #self.data[1] for n=1,elems do for i=1,cnt do local data = self.data[i][n] handle:write('"'..tostring(data)..'"'..((i < cnt) and "," or "")) end handle:write("\n") end handle:close() end function csv.CSVReadWideTable(filePath) local handle = io.open(filePath, "rb") if not handle then return end local descr local out = {} for line in FileLines(handle) do if (not descr) then descr = {} local n = 1 for word in string.gmatch(line,'(%b""),*') do word = string.sub(word,2,-2) table.insert(descr, word) n = n + 1 end else local n = 1 local item = {} for word in string.gmatch(line,'(%b""),*') do word = string.sub(word,2,-2) word = string.gsub(word,",",".") item[descr[n]] = tonumber(word) or word n = n + 1 end table.insert(out,item) end end handle:close() return out end function csv.CSVIterateWideTable(filePath,it) local handle = io.open(filePath, "rb") if not handle then return end local descr for line in FileLines(handle) do if (not descr) then descr = {} local n = 1 for word in string.gmatch(line,'(%b""),*') do word = string.sub(word,2,-2) table.insert(descr, word) n = n + 1 end else local n = 1 local item = {} for word in string.gmatch(line,'(%b""),*') do word = string.sub(word,2,-2) word = string.gsub(word,",",".") item[descr[n]] = tonumber(word) or word n = n + 1 end it(item) end end handle:close() end function csv.CSVWriteWideTable(tab,filePath, descr, dontwritedescr, header) if (not tab[1]) then print("table has no content") return end local handle = io.open(filePath, "wt") if not handle then print("cannot open file:", filePath) return end if (header) then handle:write(header) handle:write("\n") end if (not descr) then descr = {} for i,v in pairs(tab[1]) do table.insert(descr,i) end table.sort(descr) else local lk = {} local ndescr = {} for i,v in ipairs(descr) do lk[v] = true ndescr[i] = v end local ndescrrest = {} for i,v in pairs(tab[1]) do if (not lk[i]) then table.insert(ndescrrest,i) end end table.sort(ndescrrest) for i,v in ipairs(ndescrrest) do table.insert(ndescr,v) end descr = ndescr end local cnt = #descr if (not dontwritedescr) then for i,v in ipairs(descr) do handle:write('"'..v..'"'..((i < cnt) and ", " or "")) end handle:write("\n") end for i,v in ipairs(tab) do for n=1,cnt do local data = v[descr[n]] local notnumber = tonumber(data) == nil local wrap = notnumber and '"' or "" handle:write(wrap..(data and tostring(data) or "")..wrap..((n < cnt) and ", " or "")) end handle:write("\n") end handle:close() end return csv
mit
RyMarq/Zero-K
LuaRules/Gadgets/unit_priority.lua
1
26257
-- $Id$ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- -- Copyright (C) 2009. -- Licensed under the terms of the GNU GPL, v2 or later. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- if (not gadgetHandler:IsSyncedCode()) then return end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:GetInfo() return { name = "UnitPriority", desc = "Adds controls to change spending priority on constructions/repairs etc", author = "Licho", date = "19.4.2009", --24.2.2013 license = "GNU GPL, v2 or later", -- Must start before unit_morph.lua gadget to register GG.AddMiscPriority() first. -- Must be before mex_overdrive layer = -5, enabled = true } end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- include("LuaRules/Configs/customcmds.h.lua") include("LuaRules/Configs/constants.lua") local TooltipsA = { ' Low.', ' Normal.', ' High.', } local TooltipsB = { [CMD_PRIORITY] = 'Construction Priority', [CMD_MISC_PRIORITY] = 'Morph&Stock Priority', } local DefaultState = 1 local CommandOrder = 123456 local CommandDesc = { id = CMD_PRIORITY, type = CMDTYPE.ICON_MODE, name = 'Construction Priority', action = 'priority', tooltip = 'Construction Priority' .. TooltipsA[DefaultState + 1], params = {DefaultState, 'Low','Normal','High'} } local MiscCommandOrder = 123457 local MiscCommandDesc = { id = CMD_MISC_PRIORITY, type = CMDTYPE.ICON_MODE, name = 'Morph&Stock Priority', action = 'miscpriority', tooltip = 'Morph&Stock Priority' .. TooltipsA[DefaultState + 1], params = {DefaultState, 'Low','Normal','High'} } local StateCount = #CommandDesc.params-1 local UnitPriority = {} -- UnitPriority[unitID] = 0,1,2 priority of the unit local UnitMiscPriority = {} -- UnitMiscPriority[unitID] = 0,1,2 priority of the unit local TeamPriorityUnits = {} -- TeamPriorityUnits[TeamID][UnitID] = 0,2 which units are low/high priority builders local teamMiscPriorityUnits = {} -- teamMiscPriorityUnits[TeamID][UnitID] = 0,2 which units are low/high priority builders local TeamScale = {} -- TeamScale[TeamID] = {0, 0.4, 1} how much to scale resourcing at different incomes local TeamScaleEnergy = {} -- TeamScaleEnergy[TeamID] = {0, 0.4, 1} how much to scale energy only resourcing local TeamMetalReserved = {} -- how much metal is reserved for high priority in each team local TeamEnergyReserved = {} -- ditto for energy local effectiveTeamMetalReserved = {} -- Takes max storage into account local effectiveTeamEnergyReserved = {} -- ditto for energy local LastUnitFromFactory = {} -- LastUnitFromFactory[FactoryUnitID] = lastUnitID local UnitOnlyEnergy = {} -- Whether a unit is only using energy for engine-default behaviour local buildSpeedMod = {} -- Derandomization of resource allocation. Remembers the portion of resources allocated to the unit and gives access -- when they have a full chunk. local UnitConPortion = {} local UnitMiscPortion = {} local miscResourceDrain = {} -- metal drain for custom unit added thru GG. function local miscTeamPriorityUnits = {} --unit that need priority handling local MiscUnitOnlyEnergy = {} -- MiscUnitOnlyEnergy[unitID] for misc drain local priorityTypes = { [CMD_PRIORITY] = {id = CMD_PRIORITY, param = "buildpriority", unitTable = UnitPriority}, [CMD_MISC_PRIORITY] = {id = CMD_MISC_PRIORITY, param = "miscpriority", unitTable = UnitMiscPriority}, } local ALLY_ACCESS = {allied = true} local debugTeam = false local debugOnUnits = false local debugBuildUnit GG.REPAIR_COSTS_METAL = false -- Configurable GG.REPAIR_RESOURCE_MULT = 1 local REPAIR_METAL_COST_FACTOR = Game.repairEnergyCostFactor -------------------------------------------------------------------------------- -- COMMON -------------------------------------------------------------------------------- local function isFactory(UnitDefID) return UnitDefs[UnitDefID].isFactory or false end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local max = math.max local spGetTeamList = Spring.GetTeamList local spGetTeamResources = Spring.GetTeamResources local spGetPlayerInfo = Spring.GetPlayerInfo local spGetUnitDefID = Spring.GetUnitDefID local spGetUnitHealth = Spring.GetUnitHealth local spFindUnitCmdDesc = Spring.FindUnitCmdDesc local spEditUnitCmdDesc = Spring.EditUnitCmdDesc local spInsertUnitCmdDesc = Spring.InsertUnitCmdDesc local spRemoveUnitCmdDesc = Spring.RemoveUnitCmdDesc local spSetUnitRulesParam = Spring.SetUnitRulesParam local spGetUnitRulesParam = Spring.GetUnitRulesParam local spSetTeamRulesParam = Spring.SetTeamRulesParam local spGetUnitIsStunned = Spring.GetUnitIsStunned local spGetTeamRulesParam = Spring.GetTeamRulesParam local spUseUnitResource = Spring.UseUnitResource local GetUnitCost = Spring.Utilities.GetUnitCost local alliedTable = {allied = true} local resourceTable = {e = 0, m = 0} local function SetMetalReserved(teamID, value) TeamMetalReserved[teamID] = value or 0 Spring.SetTeamRulesParam(teamID, "metalReserve", value or 0, alliedTable) end local function SetEnergyReserved(teamID, value) TeamEnergyReserved[teamID] = value or 0 Spring.SetTeamRulesParam(teamID, "energyReserve", value or 0, alliedTable) end local function SetPriorityState(unitID, state, prioID) local cmdDescID = spFindUnitCmdDesc(unitID, prioID) if (cmdDescID) then CommandDesc.params[1] = state spEditUnitCmdDesc(unitID, cmdDescID, { params = CommandDesc.params, tooltip = TooltipsB[prioID] .. TooltipsA[1 + state%StateCount]}) spSetUnitRulesParam(unitID, priorityTypes[prioID].param, state, ALLY_ACCESS) end priorityTypes[prioID].unitTable[unitID] = state end function PriorityCommand(unitID, cmdID, cmdParams, cmdOptions) local state = cmdParams[1] or 1 if cmdOptions and (cmdOptions.right) then state = state - 2 end state = state % StateCount SetPriorityState(unitID, state, cmdID) local lastUnitID = LastUnitFromFactory[unitID] if lastUnitID ~= nil then local _, _, _, _, progress = spGetUnitHealth(lastUnitID) if (progress ~= nil and progress < 1) then -- we are building some unit ,set its priority too SetPriorityState(lastUnitID, state, cmdID) end end end function gadget:AllowCommand_GetWantedCommand() return {[CMD_PRIORITY] = true, [CMD_MISC_PRIORITY] = true} end function gadget:AllowCommand_GetWantedUnitDefID() return true end function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) if (cmdID == CMD_PRIORITY or cmdID == CMD_MISC_PRIORITY) then PriorityCommand(unitID, cmdID, cmdParams, cmdOptions) return false -- command was used end return true -- command was not used end function gadget:CommandFallback(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) if (cmdID ~= CMD_PRIORITY) then return false -- command was not used end PriorityCommand(unitID, cmdParams, cmdOptions) return true, true -- command was used, remove it end -- Misc Priority tasks can get their reduced build rate directly. -- The external gadget is then trusted to obey the proportion which -- they are allocated. local function GetMiscPrioritySpendScale(unitID, teamID, onlyEnergy) if (teamMiscPriorityUnits[teamID] == nil) then teamMiscPriorityUnits[teamID] = {} end local scale if onlyEnergy then scale = TeamScaleEnergy[teamID] else scale = TeamScale[teamID] end local priorityLevel = (UnitMiscPriority[unitID] or 1) + 1 teamMiscPriorityUnits[teamID][unitID] = priorityLevel if scale and scale[priorityLevel] then return scale[priorityLevel] end return 1 -- Units have full spending if they do not know otherwise. end local function CheckReserveResourceUse(teamID, onlyEnergy, resTable) local energyReserve = effectiveTeamEnergyReserved[teamID] or 0 if energyReserve ~= 0 then local eCurr = spGetTeamResources(teamID, "energy") if eCurr <= energyReserve - ((resTable and resTable.e) or 0) then return false end end if onlyEnergy then return true end local metalReserve = effectiveTeamMetalReserved[teamID] or 0 if metalReserve ~= 0 then local mCurr = spGetTeamResources(teamID, "metal") if mCurr <= metalReserve - ((resTable and resTable.m) or 0) then return false end end return true end -- This is the other way that Misc Priority tasks can build at the correct rate. -- It is quite like AllowUnitBuildStep. local function AllowMiscPriorityBuildStep(unitID, teamID, onlyEnergy, resTable) local conAmount = UnitMiscPortion[unitID] or math.random() if (teamMiscPriorityUnits[teamID] == nil) then teamMiscPriorityUnits[teamID] = {} end local scale if onlyEnergy then scale = TeamScaleEnergy[teamID] else scale = TeamScale[teamID] end local priorityLevel = (UnitMiscPriority[unitID] or 1) + 1 teamMiscPriorityUnits[teamID][unitID] = priorityLevel if scale and scale[priorityLevel] then conAmount = conAmount + scale[priorityLevel] if conAmount >= 1 then UnitMiscPortion[unitID] = conAmount - 1 return priorityLevel == 3 or CheckReserveResourceUse(teamID, onlyEnergy, resTable) else UnitMiscPortion[unitID] = conAmount return false end end return true end function gadget:AllowUnitBuildStep(builderID, teamID, unitID, unitDefID, step) if debugBuildUnit and debugBuildUnit[unitID] then Spring.Echo("AUBS", builderID, teamID, unitID, unitDefID, step, Spring.GetUnitHealth(unitID)) end if (step <= 0) then --// Reclaiming and null buildpower (waited cons) aren't prioritized return true end local conAmount = UnitConPortion[builderID] or math.random() if (TeamPriorityUnits[teamID] == nil) then TeamPriorityUnits[teamID] = {} end local scale buildSpeedMod[builderID] = GG.unitRepairRate[unitID] if GG.unitRepairRate[unitID] then buildSpeedMod[builderID] = buildSpeedMod[builderID]*GG.REPAIR_RESOURCE_MULT end if GG.REPAIR_COSTS_METAL then scale = TeamScale[teamID] else if GG.unitRepairRate[unitID] then UnitOnlyEnergy[builderID] = true scale = TeamScaleEnergy[teamID] else UnitOnlyEnergy[builderID] = false scale = TeamScale[teamID] end end local priorityLevel if (UnitPriority[unitID] == 0 or (UnitPriority[builderID] == 0 and (UnitPriority[unitID] or 1) == 1 )) then priorityLevel = 1 elseif (UnitPriority[unitID] == 2 or (UnitPriority[builderID] == 2 and (UnitPriority[unitID] or 1) == 1)) then priorityLevel = 3 else priorityLevel = 2 end TeamPriorityUnits[teamID][builderID] = priorityLevel if scale and scale[priorityLevel] then -- scale is a ratio between available-resource and desired-spending. conAmount = conAmount + scale[priorityLevel] if conAmount >= 1 then UnitConPortion[builderID] = conAmount - 1 if not (priorityLevel == 3 or CheckReserveResourceUse(teamID)) then return false end else UnitConPortion[builderID] = conAmount return false end end -- Add metal cost to repairing if GG.REPAIR_COSTS_METAL and GG.unitRepairRate[unitID] then resourceTable.m = step*GetUnitCost(unitID, unitDefID)*REPAIR_METAL_COST_FACTOR if not spUseUnitResource(builderID, resourceTable) then return false end end return true end function gadget:GameFrame(n) if n % TEAM_SLOWUPDATE_RATE == 1 then local prioUnits, miscPrioUnits local debugMode local teams = spGetTeamList() for i=1,#teams do local teamID = teams[i] debugMode = debugTeam and debugTeam[teamID] prioUnits = TeamPriorityUnits[teamID] or {} miscPrioUnits = teamMiscPriorityUnits[teamID] or {} local spending = {0,0,0} local energySpending = {0,0,0} local realEnergyOnlyPull = 0 local scaleEnergy = TeamScaleEnergy[teamID] if debugMode then Spring.Echo("====== Frame " .. n .. " ======") if scaleEnergy then Spring.Echo("team " .. i .. " Initial energy only scale", "High", scaleEnergy[3], "Med", scaleEnergy[2], "Low", scaleEnergy[1] ) end end for unitID, pri in pairs(prioUnits) do --add construction priority spending local unitDefID = spGetUnitDefID(unitID) if unitDefID ~= nil then if UnitOnlyEnergy[unitID] then local buildSpeed = spGetUnitRulesParam(unitID, "buildSpeed") or UnitDefs[unitDefID].buildSpeed energySpending[pri] = energySpending[pri] + buildSpeed*(buildSpeedMod[unitID] or 1) if scaleEnergy and scaleEnergy[pri] then realEnergyOnlyPull = realEnergyOnlyPull + buildSpeed*(buildSpeedMod[unitID] or 1)*scaleEnergy[pri] if debugMode and debugOnUnits then GG.UnitEcho(unitID, "Energy Priority: " .. pri .. ", BP: " .. buildSpeed .. ", Pull: " .. buildSpeed*(buildSpeedMod[unitID] or 1)*scaleEnergy[pri] ) end end else local buildSpeed = spGetUnitRulesParam(unitID, "buildSpeed") or UnitDefs[unitDefID].buildSpeed spending[pri] = spending[pri] + buildSpeed*(buildSpeedMod[unitID] or 1) if debugMode and debugOnUnits then GG.UnitEcho(unitID, "Priority: " .. pri .. ", BP: " .. buildSpeed*(buildSpeedMod[unitID] or 1) ) end end end end for unitID, miscData in pairs(miscResourceDrain) do --add misc priority spending local unitDefID = spGetUnitDefID(unitID) local pri = miscPrioUnits[unitID] if unitDefID ~= nil and pri then for index, drain in pairs(miscData) do if MiscUnitOnlyEnergy[unitID][index] then energySpending[pri] = energySpending[pri] + drain if scaleEnergy and scaleEnergy[pri] then realEnergyOnlyPull = realEnergyOnlyPull + drain*scaleEnergy[pri] if debugMode and debugOnUnits then GG.UnitEcho(unitID, "Misc Energy Priority " .. index .. ": " .. pri .. ", BP: " .. drain .. ", Pull: " .. realEnergyOnlyPull + drain*scaleEnergy[pri] ) end end else spending[pri] = spending[pri] + drain if debugMode and debugOnUnits then GG.UnitEcho(unitID, "Misc Priority " .. index .. ": " .. pri .. ", BP: " .. drain ) end end end end end --SendToUnsynced("PriorityStats", teamID, prioSpending, lowPrioSpending, n) local level, mStor, fakeMetalPull, income, expense, _, _, recieved = spGetTeamResources(teamID, "metal", true) local elevel, eStor, fakeEnergyPull, eincome, eexpense, _, _, erecieved = spGetTeamResources(teamID, "energy", true) eincome = eincome + (spGetTeamRulesParam(teamID, "OD_energyIncome") or 0) effectiveTeamMetalReserved[teamID] = math.min(mStor - HIDDEN_STORAGE, TeamMetalReserved[teamID] or 0) effectiveTeamEnergyReserved[teamID] = math.min(eStor - HIDDEN_STORAGE, TeamEnergyReserved[teamID] or 0) -- Take away the constant income which was gained this frame (innate, reclaim) -- This is to ensure that level + total income is exactly what will be gained in the next second (if nothing is spent). local lumpIncome = (spGetTeamRulesParam(teamID, "OD_metalBase") or 0) + (spGetTeamRulesParam(teamID, "OD_metalOverdrive") or 0) + (spGetTeamRulesParam(teamID, "OD_metalMisc") or 0) level = level - (income - lumpIncome)/30 -- Make sure the misc resoucing is constantly pulling the same value regardless of whether resources are spent -- If AllowUnitBuildStep returns false the constructor does not add the attempt to pull. This makes pull incorrect. -- The following calculations get the useful type of pull. local metalPull = spending[1] + spending[2] + spending[3] local energyPull = fakeEnergyPull + metalPull - fakeMetalPull + energySpending[1] + energySpending[2] + energySpending[3] - realEnergyOnlyPull spSetTeamRulesParam(teamID, "extraMetalPull", metalPull - fakeMetalPull, ALLY_ACCESS) spSetTeamRulesParam(teamID, "extraEnergyPull", energyPull - fakeEnergyPull, ALLY_ACCESS) if debugMode then if spending then Spring.Echo("team " .. i .. " Pull", "High", spending[3], "Med", spending[2], "Low", spending[1] ) end end if debugMode then if energySpending then Spring.Echo("team " .. i .. " Energy Only Pull", "High", energySpending[3], "Med", energySpending[2], "Low", energySpending[1] ) end end if debugMode then Spring.Echo("team " .. i .. " old resource levels:") if scaleEnergy then Spring.Echo("nextMetalLevel: " .. (level or "nil")) Spring.Echo("nextEnergyLevel: " .. (elevel or "nil")) end end -- How much of each resource there is to spend in the next second. local nextMetalLevel = (income + recieved + level) local nextEnergyLevel = (eincome + erecieved + elevel) if debugMode then Spring.Echo("team " .. i .. " new resource levels:") if scaleEnergy then Spring.Echo("nextMetalLevel: " .. (nextMetalLevel or "nil")) Spring.Echo("nextEnergyLevel: " .. (nextEnergyLevel or "nil")) end end TeamScale[teamID] = {} TeamScaleEnergy[teamID] = {} for pri = 3, 1, -1 do local metalDrain = spending[pri] local energyDrain = spending[pri] + energySpending[pri] --if i == 1 then -- Spring.Echo(pri .. " energyDrain " .. energyDrain) -- Spring.Echo(pri .. " nextEnergyLevel " .. nextEnergyLevel) --end if metalDrain > 0 and energyDrain > 0 and (nextMetalLevel <= metalDrain or nextEnergyLevel <= energyDrain) then -- both these values are positive and at least one is less than 1 local mRatio = max(0,nextMetalLevel)/metalDrain local eRatio = max(0,nextEnergyLevel)/energyDrain local spare if mRatio < eRatio then -- mRatio is lower so we are stalling metal harder. -- Set construction scale limited by metal. TeamScale[teamID][pri] = mRatio nextEnergyLevel = nextEnergyLevel - nextMetalLevel nextMetalLevel = 0 -- Use leftover energy for energy-only tasks. energyDrain = energySpending[pri] if energyDrain > 0 and nextEnergyLevel <= energyDrain then eRatio = nextEnergyLevel/energyDrain TeamScaleEnergy[teamID][pri] = eRatio nextEnergyLevel = 0 else TeamScaleEnergy[teamID][pri] = 1 nextEnergyLevel = nextEnergyLevel - energyDrain end else -- eRatio is lower so we are stalling energy harder. -- Set scale for build and repair equally and limit by energy. TeamScale[teamID][pri] = eRatio TeamScaleEnergy[teamID][pri] = eRatio nextMetalLevel = nextMetalLevel - nextEnergyLevel nextEnergyLevel = 0 end elseif energyDrain > 0 and nextEnergyLevel <= energyDrain then local eRatio = max(0,nextEnergyLevel)/energyDrain -- Set scale for build and repair equally and limit by energy. TeamScale[teamID][pri] = eRatio TeamScaleEnergy[teamID][pri] = eRatio nextMetalLevel = nextMetalLevel - nextEnergyLevel nextEnergyLevel = 0 else TeamScale[teamID][pri] = 1 TeamScaleEnergy[teamID][pri] = 1 nextMetalLevel = nextMetalLevel - metalDrain nextEnergyLevel = nextEnergyLevel - energyDrain end if pri == 3 then nextMetalLevel = nextMetalLevel - effectiveTeamMetalReserved[teamID] nextEnergyLevel = nextEnergyLevel - effectiveTeamEnergyReserved[teamID] end end if debugMode then if TeamScale[teamID] then Spring.Echo("team " .. i .. " Scale", "High", TeamScale[teamID][3], "Med", TeamScale[teamID][2], "Low", TeamScale[teamID][1] ) end end if debugMode then if TeamScaleEnergy[teamID] then Spring.Echo("team " .. i .. " Energy Only Scale", "High", TeamScaleEnergy[teamID][3], "Med", TeamScaleEnergy[teamID][2], "Low", TeamScaleEnergy[teamID][1] ) end end end teamMiscPriorityUnits = {} --reset priority list TeamPriorityUnits = {} --reset builder priority list (will be checked every n%32==15 th frame) end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Misc priority unit handling function AddMiscPriorityUnit(unitID) --remotely add a priority command. if not UnitMiscPriority[unitID] then local unitDefID = Spring.GetUnitDefID(unitID) local ud = UnitDefs[unitDefID] spInsertUnitCmdDesc(unitID, MiscCommandOrder, MiscCommandDesc) SetPriorityState(unitID, DefaultState, CMD_MISC_PRIORITY) end end function StartMiscPriorityResourcing(unitID, drain, energyOnly, key) --remotely add a priority command. if not UnitMiscPriority[unitID] then AddMiscPriorityUnit(unitID) end if not miscResourceDrain[unitID] then miscResourceDrain[unitID] = {} MiscUnitOnlyEnergy[unitID] = {} end key = key or 1 miscResourceDrain[unitID][key] = drain MiscUnitOnlyEnergy[unitID][key] = energyOnly end function StopMiscPriorityResourcing(unitID, key) --remotely remove a forced priority command. if miscResourceDrain[unitID] then key = key or 1 miscResourceDrain[unitID][key] = nil MiscUnitOnlyEnergy[unitID][key] = nil end end function RemoveMiscPriorityUnit(unitID) --remotely remove a forced priority command. if UnitMiscPriority[unitID] then if miscResourceDrain[unitID] then miscResourceDrain[unitID] = nil MiscUnitOnlyEnergy[unitID] = nil end local unitDefID = Spring.GetUnitDefID(unitID) local ud = UnitDefs[unitDefID] local cmdDescID = spFindUnitCmdDesc(unitID, CMD_MISC_PRIORITY) if (cmdDescID) then spRemoveUnitCmdDesc(unitID, cmdDescID) spSetUnitRulesParam(unitID, "miscpriority", 1) --reset to normal priority so that overhead icon doesn't show wrench end end end function gadget:UnitTaken(unitID, unitDefID, oldTeamID, teamID) if miscResourceDrain[unitID] then StopMiscPriorityResourcing(unitID) end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Debug local function toggleDebug(cmd, line, words, player) if not Spring.IsCheatingEnabled() then return end local teamID = tonumber(words[1]) Spring.Echo("Debug priority for team " .. (teamID or "nil")) if teamID then if not debugTeam then debugTeam = {} end if debugTeam[teamID] then debugTeam[teamID] = nil if #debugTeam == 0 then debugTeam = {} end Spring.Echo("Disabled") else debugTeam[teamID] = true Spring.Echo("Enabled") end end end local function toggleDebugBuild(cmd, line, words, player) if not Spring.IsCheatingEnabled() then return end local unitID = tonumber(words[1]) Spring.Echo("Debug build") if not unitID then Spring.Echo("Disabled") debugBuildUnit = nil return end Spring.Echo("unitID", unitID) debugBuildUnit = debugBuildUnit or {} debugBuildUnit[unitID] = true end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Unit Handling function gadget:Initialize() GG.AllowMiscPriorityBuildStep = AllowMiscPriorityBuildStep GG.GetMiscPrioritySpendScale = GetMiscPrioritySpendScale GG.AddMiscPriorityUnit = AddMiscPriorityUnit GG.StartMiscPriorityResourcing = StartMiscPriorityResourcing GG.StopMiscPriorityResourcing = StopMiscPriorityResourcing GG.RemoveMiscPriorityUnit = RemoveMiscPriorityUnit gadgetHandler:RegisterCMDID(CMD_PRIORITY) gadgetHandler:RegisterCMDID(CMD_MISC_PRIORITY) for _, unitID in ipairs(Spring.GetAllUnits()) do local teamID = Spring.GetUnitTeam(unitID) spInsertUnitCmdDesc(unitID, CommandOrder, CommandDesc) end --toggleDebug(nil, nil, {"0"}, nil) gadgetHandler:AddChatAction("debugpri", toggleDebug, "Debugs priority.") gadgetHandler:AddChatAction("debugbuild", toggleDebugBuild, "Debugs build step.") end function gadget:RecvLuaMsg(msg, playerID) if msg:find("mreserve:",1,true) then local _,_,spec,teamID = spGetPlayerInfo(playerID, false) local amount = tonumber(msg:sub(10)) if spec or (not teamID) or (not amount) then return end SetMetalReserved(teamID, amount) end if msg:find("ereserve:",1,true) then local _,_,spec,teamID = spGetPlayerInfo(playerID, false) local amount = tonumber(msg:sub(10)) if spec or (not teamID) or (not amount) then return end SetEnergyReserved(teamID, amount) end end function gadget:UnitCreated(UnitID, UnitDefID, TeamID, builderID) local prio = DefaultState if (builderID ~= nil) then local unitDefID = spGetUnitDefID(builderID) if (unitDefID ~= nil and UnitDefs[unitDefID].isFactory) then prio = UnitPriority[builderID] or DefaultState -- inherit priorty from factory LastUnitFromFactory[builderID] = UnitID end end UnitPriority[UnitID] = prio CommandDesc.params[1] = prio spInsertUnitCmdDesc(UnitID, CommandOrder, CommandDesc) end function gadget:UnitFinished(unitID, unitDefID, teamID) local ud = UnitDefs[unitDefID] if ((ud.isFactory or ud.isBuilder) and (ud.buildSpeed > 0 and not ud.customParams.nobuildpower)) then SetPriorityState(unitID, DefaultState, CMD_PRIORITY) else -- not a builder priority makes no sense now UnitPriority[unitID] = nil local cmdDescID = spFindUnitCmdDesc(unitID, CMD_PRIORITY) if (cmdDescID) then spRemoveUnitCmdDesc(unitID, cmdDescID) end end end function gadget:UnitDestroyed(unitID, unitDefID, teamID) UnitPriority[unitID] = nil LastUnitFromFactory[unitID] = nil if UnitMiscPriority[unitID] then RemoveMiscPriorityUnit(unitID) end end
gpl-2.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/GameMarket/GameShop.lua
1
4017
--[[ Title: Game Market Place Author(s): LiXizhi Date: 2013/7/14 Desc: the game portal page. Use Lib: ------------------------------------------------------- NPL.load("(gl)script/apps/Aries/Creator/Game/GameMarket/GameShopPage.lua"); local GameShopPage = commonlib.gettable("MyCompany.Aries.Creator.Game.Desktop.GameShopPage"); GameShopPage.ShowPage(true) ------------------------------------------------------- ]] NPL.load("(gl)script/apps/Aries/Creator/Game/main.lua"); local Desktop = commonlib.gettable("MyCompany.Aries.Creator.Game.Desktop"); local GameShopPage = commonlib.gettable("MyCompany.Aries.Creator.Game.Desktop.GameShopPage"); local ItemManager = commonlib.gettable("Map3DSystem.Item.ItemManager"); local pkg_install_path = "worlds/DesignHouse/"; function GameShopPage.OnInit() end function GameShopPage.IsSecretKeyPressed() if(ParaUI.IsKeyPressed(DIK_SCANCODE.DIK_LCONTROL) and ParaUI.IsKeyPressed(DIK_SCANCODE.DIK_LSHIFT)) then return true; end end function GameShopPage.ShowPage(bShow) local width, height = 512, 480; System.App.Commands.Call("File.MCMLWindowFrame", { url = "script/apps/Aries/Creator/Game/GameMarket/GameShopPage.html", name = "GameShopPage.ShowPage", isShowTitleBar = false, DestroyOnClose = true, style = CommonCtrl.WindowFrame.ContainerStyle, allowDrag = true, bShow = bShow, directPosition = true, align = "_ct", x = -width/2, y = -height/2, width = width, height = height, }); end function GameShopPage.OnOpenPkgFile(filename) local file_name = filename:match("[^/\\]*$"); local dest_path = pkg_install_path..file_name; _guihelper.MessageBox(format(L"确定要安装创意空间文件:%s?", commonlib.Encoding.DefaultToUtf8(filename)), function() local function CopyFile_() if(ParaIO.CopyFile(filename, dest_path, true)) then _guihelper.MessageBox(format(L"世界[%s]安装成功!您可以从创意空间中加载这个世界了", file_name)); else _guihelper.MessageBox(format(L"无法复制文件到%s", dest_path)); end end if(ParaIO.DoesFileExist(dest_path, true)) then _guihelper.MessageBox(format(L"世界[%s]已经安装过, 是否覆盖之前的世界?", file_name), function() CopyFile_(); end); else CopyFile_(); end end); end -- force enter block world edition, only set to true when visit_url is not empty when loading the world. GameShopPage.ForceEnterBlockWorld = nil; -- VIP item GameShopPage.vip_item_gsid = 17394; -- VIP trial item: valid for 7 days -- GameShopPage.vip_trial_item_gsid = 17394; -- whether the user has the right to do something function GameShopPage.HaveRight(name) if(name == "entergame" or name=="cmd_create" or name=="savegame" or name=="minimap") then if(System.options.version == "teen" and (MyCompany.Aries.Player.GetLevel() >= 40)) then -- only for player whose level is bigger than 40. return true; end if(GameShopPage.ForceEnterBlockWorld and name == "entergame") then return true; end if(not System.User.nid or System.User.nid == 0 or System.options.mc) then -- offline mode return true; end local bHas = ItemManager.IfOwnGSItem(GameShopPage.vip_item_gsid); if(not bHas and GameShopPage.vip_trial_item_gsid) then bHas = ItemManager.IfOwnGSItem(GameShopPage.vip_trial_item_gsid); end return bHas; end end -- whether the user has the right to do something, if not it will display the proper error message to the user function GameShopPage.CheckRight(name) local bHasRight = GameShopPage.HaveRight(name) if(not bHasRight) then _guihelper.MessageBox("你不是创意空间会员, 不能使用这个功能. 是否要立即成为会员?", function(res) if(res and res == _guihelper.DialogResult.Yes) then -- pressed YES local command = System.App.Commands.GetCommand("Profile.Aries.PurchaseItemWnd"); if(command) then command:Call({gsid = GameShopPage.vip_item_gsid}); end end end, _guihelper.MessageBoxButtons.YesNo); end return bHasRight; end
gpl-2.0
TeamHypersomnia/Hypersomnia
hypersomnia/content/gfx/elon_hrl.meta.lua
2
3696
return { extra_loadables = { enabled_generate_neon_map = { alpha_multiplier = 1, amplification = 120, light_colors = { "66 228 207 255", "228 20 206 255", "250 0 0 255" }, radius = { x = 80, y = 80 }, standard_deviation = 6 }, generate_desaturation = false }, offsets = { gun = { bullet_spawn = { x = -24, y = -2 }, chamber = { pos = { x = 21, y = 0 }, rotation = 0 }, chamber_magazine = { pos = { x = 11, y = 0 }, rotation = 0 }, detachable_magazine = { pos = { x = 0, y = 0 }, rotation = 0 }, shell_spawn = { pos = { x = -13, y = 0 }, rotation = 90 } }, item = { attachment_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, back_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, beep_offset = { pos = { x = 0, y = 0 }, rotation = 0 }, hand_anchor = { pos = { x = -41, y = -1 }, rotation = 0 }, head_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, shoulder_anchor = { pos = { x = 0, y = 0 }, rotation = 0 } }, legs = { foot = { x = 0, y = 0 } }, non_standard_shape = { convex_partition = { 1, 2, 3, 9, 1, 3, 4, 5, 6, 8, 9, 3, 6, 7, 8, 6, 0, 1, 9, 10, 11, 0 }, original_poly = { { x = -45, y = -6 }, { x = -28, y = -6 }, { x = -26, y = -16 }, { x = -16, y = -9 }, { x = -14, y = -15 }, { x = 46, y = -16 }, { x = 43, y = 0 }, { x = 46, y = 16 }, { x = -14, y = 15 }, { x = -18, y = 9 }, { x = -38, y = 9 }, { x = -45, y = 4 } } }, torso = { back = { pos = { x = 0, y = 0 }, rotation = 0 }, head = { pos = { x = 0, y = 0 }, rotation = 0 }, legs = { pos = { x = 0, y = 0 }, rotation = 0 }, primary_hand = { pos = { x = 0, y = 0 }, rotation = 0 }, secondary_hand = { pos = { x = 0, y = 0 }, rotation = 0 }, secondary_shoulder = { pos = { x = 0, y = 0 }, rotation = 0 }, shoulder = { pos = { x = 0, y = 0 }, rotation = 0 }, strafe_facing_offset = 0 } }, usage_as_button = { bbox_expander = { x = 0, y = 0 }, flip = { horizontally = false, vertically = false } } }
agpl-3.0
eXhausted/Ovale
WoWMock.lua
1
30363
--[[-------------------------------------------------------------------- Copyright (c) 2013, 2014 Johnny C. Lam. 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. --]]-------------------------------------------------------------------- --[[-------------------------------------------------------------------- This file implements parts of the WoW API for development and unit-testing. This file is not meant to be loaded into the addon. It should be used only outside of the WoW environment, such as when loaded by a standalone Lua 5.1 interpreter. --]]-------------------------------------------------------------------- -- Globally-accessible module table. -- GLOBALS: WoWMock WoWMock = {} --<private-static-properties> local _G = _G local getmetatable = getmetatable local io = io local ipairs = ipairs local loadstring = loadstring local next = next local pairs = pairs local print = print local rawget = rawget local rawset = rawset local select = select local setfenv = setfenv local setmetatable = setmetatable local string = string local table = table local tostring = tostring local type = type local unpack = unpack -- Metatable to provide __index method to tables so that if the requested key -- is missing from the table, then a new key is inserted with the value being -- the same as the missing key. local KeysAreMissingValuesMetatable = { __index = function(t, k) rawset(t, k, k) return k end, } --</private-static-properties> --<private-static-methods> local function DeepCopy(orig) local orig_type = type(orig) local copy if orig_type == 'table' then copy = {} for orig_key, orig_value in next, orig, nil do copy[DeepCopy(orig_key)] = DeepCopy(orig_value) end setmetatable(copy, DeepCopy(getmetatable(orig))) else -- number, string, boolean, etc copy = orig end return copy end local function DoNothing() -- No op. end local function ZeroFunction() return 0 end --</private-static-methods> --<private-static-properties> --[[-------------------------------- Fake library implementations. --]]-------------------------------- -- Forward declaration of LibStub. local LibStub = nil -- AceAddon-3.0 local AceAddon = nil do local lib = {} AceAddon = lib lib.initializationQueue = {} local prototype = {} prototype.GetModule = function(addon, name) addon.modules = addon.modules or {} return addon.modules[name] end prototype.GetName = function(addon) return addon.moduleName or addon.name end prototype.IterateModules = function(addon) return pairs(addon.modules) end prototype.NewModule = function(addon, name, ...) local args = { ... } local mod = lib:NewAddon(string.format("%s_%s", addon.name, name)) mod.moduleName = name -- Mix in default module prototype if addon.modulePrototype then for k, v in pairs(addon.modulePrototype) do mod[k] = v end end -- Embed methods from named libraries. for _, libName in ipairs(args) do local library = LibStub(libName) if library then for k, v in pairs(library) do mod[k] = v end end end addon.modules = addon.modules or {} addon.modules[name] = mod return mod end prototype.SetDefaultModulePrototype = function(addon, proto) addon.modulePrototype = proto end lib.GetAddon = function(library, name) library.addons = library.addons or {} return library.addons[name] end lib.Fire = function(event, ...) for _, addon in ipairs(lib.initializationQueue) do if event == "ADDON_LOADED" and addon.OnInitialize then --print("Firing", event, addon.name) addon:OnInitialize() elseif event == "PLAYER_LOGIN" and addon.OnEnable then --print("Firing", event, addon.name) addon:OnEnable() elseif addon.SendMessage then addon:SendMessage(event, ...) end end end lib.IterateAddons = function(library) return pairs(library.addons) end lib.NewAddon = function(library, name, ...) local addon local args if type(name) == "nil" then addon = {} name = ... args = { select(2, ...) } elseif type(name) == "table" then addon = name name = ... args = { select(2, ...) } else addon = {} args = { ... } end -- Copy addon prototype. for k, v in pairs(prototype) do addon[k] = v end -- Embed methods from named libraries. for _, libName in ipairs(args) do local library = LibStub(libName) if library then for k, v in pairs(library) do addon[k] = v end end end addon.name = name library.addons = library.addons or {} library.addons[name] = addon lib.initializationQueue[#lib.initializationQueue + 1] = addon return addon end end -- AceComm-3.0-9A-Fa-f local AceComm = nil do local lib = {} AceComm = lib lib.RegisterComm = DoNothing end -- AceConfig-3.0 local AceConfig = nil do local lib = {} AceConfig = lib lib.RegisterOptionsTable = DoNothing end -- AceConfigDialog-3.0 local AceConfigDialog = nil do local lib = {} AceConfigDialog = lib lib.AddToBlizOptions = DoNothing end -- AceConsole-3.0 local AceConsole = nil do local lib = {} AceConsole = lib lib.Print = function(library, ...) print(...) end lib.Printf = function(library, ...) print(string.format(...)) end end -- AceDB-3.0 local AceDB = nil do local lib = {} AceDB = lib lib.New = function(library, name, template) template = template or {} local db = DeepCopy(template) db.RegisterCallback = DoNothing db.RegisterDefaults = DoNothing return db end end -- AceDBOptions-3.0 local AceDBOptions = nil do local lib = {} AceDBOptions = lib lib.GetOptionsTable = DoNothing end -- AceEvent-3.0 local AceEvent = nil do local lib = {} AceEvent = lib local eventHandler = {} lib.RegisterEvent = function(library, event, handler, arg) eventHandler[library] = eventHandler[library] or {} eventHandler[library][event] = { handler, arg } end lib.RegisterMessage = lib.RegisterEvent lib.SendMessage = function(library, event, ...) local handler, arg local tbl = eventHandler[library] and eventHandler[library][event] if tbl then handler, arg = tbl[1], tbl[2] if type(handler) == "string" then handler = library[handler] arg = library end else handler = library[event] arg = library end if handler then --print("Firing", event, library.name) if arg then handler(arg, event, ...) else handler(event, ...) end end end end -- AceGUI-3.0 local AceGUI = nil do local lib = {} AceGUI = lib local widgetFactory = {} local container = {} lib.Create = function(library, widgetType) local constructor = widgetFactory[widgetType] if constructor then return constructor() end end lib.RegisterAsContainer = function(library, widget) container[widget] = true widget.AddChild = DoNothing widget.ReleaseChildren = DoNothing end lib.RegisterWidgetType = function(library, name, constructor, version) widgetFactory[name] = constructor end end -- AceLocale-3.0 local AceLocale = nil do local lib = {} AceLocale = lib lib.GetLocale = function(library, name) local L if library.locale and library.locale[name] then L = library.locale[name] else L = library:NewLocale(name, nil) end return L end lib.NewLocale = function(library, name, locale) local L = setmetatable({}, KeysAreMissingValuesMetatable) library.locale = library.locale or {} library.locale[name] = L return L end end -- AceTimer-3.0 local AceTimer = nil do local lib = {} AceTimer = lib lib.ScheduleRepeatingTimer = DoNothing end -- CallbackHandler-1.0 local CallbackHandler = nil do local lib = {} CallbackHandler = lib lib.New = function(library, obj) obj.Fire = library.Fire return obj end lib.Fire = function(library, ...) end end -- LibBabble-CreatureType-3.0 local LibBabbleCreatureType = nil do local lib = {} LibBabbleCreatureType = lib lib.GetLookupTable = function(library) local tbl = library.lookupTable or setmetatable({}, KeysAreMissingValuesMetatable) library.lookupTable = tbl return tbl end end -- LibTextDump-1.0 local LibTextDump = nil do local lib = {} LibTextDump = lib lib.New = DoNothing end -- LibStub do local lib = {} LibStub = lib lib.libs = {} lib.minors = {} lib.minor = 1 lib.libs = { ["AceAddon-3.0"] = AceAddon, ["AceComm-3.0"] = AceComm, ["AceConfig-3.0"] = AceConfig, ["AceConfigDialog-3.0"] = AceConfigDialog, ["AceConsole-3.0"] = AceConsole, ["AceDB-3.0"] = AceDB, ["AceDBOptions-3.0"] = AceDBOptions, ["AceEvent-3.0"] = AceEvent, ["AceGUI-3.0"] = AceGUI, ["AceLocale-3.0"] = AceLocale, ["AceTimer-3.0"] = AceTimer, ["CallbackHandler-1.0"] = CallbackHandler, ["LibBabble-CreatureType-3.0"] = LibBabbleCreatureType, ["LibTextDump-1.0"] = LibTextDump, } local mt = { __call = function(library, name, flag) return library:GetLibrary(name, flag) end, } lib.GetLibrary = function(library, name, flag) return library.library[name] end lib.NewLibrary = function(library, name, major, minor) local newLib = {} library.library[name] = newLib return newLib end setmetatable(lib, mt) end --</private-static-properties> --<public-static-properties> --[[---------------------- FrameXML/ChatFrame --]]---------------------- WoWMock.DEFAULT_CHAT_FRAME = { AddMessage = function(frame, text, red, green, blue, alpha) -- Strip out color UI escape sequences. text = string.gsub(text, "|c[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]", "") text = string.gsub(text, "|r", "") print(text) end } --[[---------------------- FrameXML/Constants --]]---------------------- -- Inventory slots WoWMock.INVSLOT_AMMO = 0 WoWMock.INVSLOT_HEAD = 1 WoWMock.INVSLOT_NECK = 2 WoWMock.INVSLOT_SHOULDER = 3 WoWMock.INVSLOT_BODY = 4 WoWMock.INVSLOT_CHEST = 5 WoWMock.INVSLOT_WAIST = 6 WoWMock.INVSLOT_LEGS = 7 WoWMock.INVSLOT_FEET = 8 WoWMock.INVSLOT_WRIST = 9 WoWMock.INVSLOT_HAND = 10 WoWMock.INVSLOT_FINGER1 = 11 WoWMock.INVSLOT_FINGER2 = 12 WoWMock.INVSLOT_TRINKET1 = 13 WoWMock.INVSLOT_TRINKET2 = 14 WoWMock.INVSLOT_BACK = 15 WoWMock.INVSLOT_MAINHAND = 16 WoWMock.INVSLOT_OFFHAND = 17 WoWMock.INVSLOT_RANGED = 18 WoWMock.INVSLOT_TABARD = 19 WoWMock.INVSLOT_FIRST_EQUIPPED = WoWMock.INVSLOT_HEAD WoWMock.INVSLOT_LAST_EQUIPPED = WoWMock.INVSLOT_TABARD -- Power Types WoWMock.SPELL_POWER_MANA = 0 WoWMock.SPELL_POWER_RAGE = 1 WoWMock.SPELL_POWER_FOCUS = 2 WoWMock.SPELL_POWER_ENERGY = 3 WoWMock.SPELL_POWER_COMBO_POINTS = 4 WoWMock.SPELL_POWER_RUNES = 5 WoWMock.SPELL_POWER_RUNIC_POWER = 6 WoWMock.SPELL_POWER_SOUL_SHARDS = 7 WoWMock.SPELL_POWER_LUNAR_POWER = 8 WoWMock.SPELL_POWER_HOLY_POWER = 9 WoWMock.SPELL_POWER_ALTERNATE_POWER = 10 WoWMock.SPELL_POWER_MAELSTROM = 11 WoWMock.SPELL_POWER_CHI = 12 WoWMock.SPELL_POWER_INSANITY = 13 WoWMock.SPELL_POWER_BURNING_EMBERS = 14 WoWMock.SPELL_POWER_DEMONIC_FURY = 15 WoWMock.RAID_CLASS_COLORS = { ["HUNTER"] = { r = 0.67, g = 0.83, b = 0.45, colorStr = "ffabd473" }, ["WARLOCK"] = { r = 0.58, g = 0.51, b = 0.79, colorStr = "ff9482c9" }, ["PRIEST"] = { r = 1.0, g = 1.0, b = 1.0, colorStr = "ffffffff" }, ["PALADIN"] = { r = 0.96, g = 0.55, b = 0.73, colorStr = "fff58cba" }, ["MAGE"] = { r = 0.41, g = 0.8, b = 0.94, colorStr = "ff69ccf0" }, ["ROGUE"] = { r = 1.0, g = 0.96, b = 0.41, colorStr = "fffff569" }, ["DRUID"] = { r = 1.0, g = 0.49, b = 0.04, colorStr = "ffff7d0a" }, ["SHAMAN"] = { r = 0.0, g = 0.44, b = 0.87, colorStr = "ff0070de" }, ["WARRIOR"] = { r = 0.78, g = 0.61, b = 0.43, colorStr = "ffc79c6e" }, ["DEATHKNIGHT"] = { r = 0.77, g = 0.12 , b = 0.23, colorStr = "ffc41f3b" }, ["MONK"] = { r = 0.0, g = 1.00 , b = 0.59, colorStr = "ff00ff96" }, } --[[-------------------------- FrameXML/GlobalStrings --]]-------------------------- WoWMock.ITEM_LEVEL = "Item Level %d" --[[--------------------------- FrameXML/SpellBookFrame --]]--------------------------- WoWMock.BOOKTYPE_SPELL = "spell" WoWMock.BOOKTYPE_PET = "pet" --[[---------------------------- FrameXML/TalentFrameBase --]]---------------------------- WoWMock.MAX_TALENT_TIERS = 7 WoWMock.NUM_TALENT_COLUMNS = 3 --[[-------------------------------------------------------------------- debugprofilestop() is a non-standard Lua function that returns the current time in milliseconds. This is a trivial implementation to just get the Profiler module working. --]]-------------------------------------------------------------------- WoWMock.debugprofilestop = ZeroFunction WoWMock.hooksecurefunc = function(table, functionName, hookFunc) end --[[-------------------------------------------------------------------- strjoin() is a non-standard Lua function that joins a list of strings together using the given separator. --]]-------------------------------------------------------------------- WoWMock.strjoin = function(sep, ...) local t = { ... } return table.concat(t, sep) end WoWMock.strmatch = string.match --[[-------------------------------------------------------------------- strsplit() is a non-standard Lua function that splits a string and returns multiple return values for each substring delimited by the named delimiter character. This implementation is taken verbatim from: http://lua-users.org/wiki/SplitJoin --]]-------------------------------------------------------------------- WoWMock.strsplit = function(delim, str, maxNb) -- Fix up '.' character class. delim = string.gsub(delim, "%.", "%%.") -- Eliminate bad cases... if string.find(str, delim) == nil then return str end if maxNb == nil or maxNb < 1 then maxNb = 0 -- No limit end local result = {} local pat = "(.-)" .. delim .. "()" local nb = 0 local lastPos for part, pos in string.gfind(str, pat) do nb = nb + 1 result[nb] = part lastPos = pos if nb == maxNb then break end end -- Handle the last field if nb ~= maxNb then result[nb + 1] = string.sub(str, lastPos) end return unpack(result) end --[[-------------------------------------------------------------------- tostringall() is a non-standard Lua function that returns a list of each argument converted to a string. --]]-------------------------------------------------------------------- WoWMock.tostringall = function(...) local array = { ... } local N = select("#", ...) for i = 1, N do array[N] = tostring(array[N]) end return unpack(array) end --[[-------------------------------------------------------------------- wipe() is a non-standard Lua function that clears the contents of a table and leaves the table pointer intact. --]]-------------------------------------------------------------------- WoWMock.wipe = function(t) for k in pairs(t) do t[k] = nil end end WoWMock.C_Timer = { After = function(duration, callback) end } --[[------------------------------------------------- Fake Blizzard API functions for unit testing. --]]------------------------------------------------- WoWMock.mock = {} WoWMock.mock["CreateFrame"] = [[ do local function DoNothing() end local function ZeroFunction() return 0 end function CreateFrame(...) local frame = { ClearAllPoints = DoNothing, CreateFontString = function(...) return CreateFrame() end, CreateTexture = function(...) return CreateFrame() end, EnableMouse = DoNothing, GetScript = function(event) return nil end, Hide = DoNothing, IsVisible = DoNothing, NumLines = ZeroFunction, SetAllPoints = DoNothing, SetAlpha = DoNothing, SetFrameStrata = DoNothing, SetHeight = DoNothing, SetInventoryItem = DoNothing, SetJustifyH = DoNothing, SetJustifyV = DoNothing, SetMovable = DoNothing, SetOwner = DoNothing, SetPoint = DoNothing, SetScript = DoNothing, SetText = DoNothing, SetTexture = DoNothing, SetWidth = DoNothing, RegisterEvent = DoNothing, UnregisterAllEvents = DoNothing } return frame end end ]] WoWMock.mock["GetActiveSpecGroup"] = [[ function GetActiveSpecGroup() -- Always in the primary specialization. return 1 end ]] WoWMock.mock["GetActionInfo"] = [[ function GetActionInfo(slot) -- Action bar is always empty. return nil end ]] WoWMock.mock["GetAuctionItemSubClasses"] = [[ function GetAuctionItemSubClasses(classIndex) return "One-Handed Axes", "Two-Handed Axes", "Bows", "Guns", "One-Handed Maces", "Two-Handed Maces", "Polearms", "One-Handed Swords", "Two-Handed Swords", "Staves", "Fist Weapons", "Miscellaneous", "Daggers", "Thrown", "Crossbows", "Wands", "Fishing Poles" end ]] WoWMock.mock["GetBindingKey"] = [[ function GetBindingKey(name) -- No keybinds are assigned. return nil end ]] WoWMock.mock["GetBonusBarIndex"] = [[ function GetBonusBarIndex() return 8 end ]] WoWMock.mock["GetBuildInfo"] = [[ function GetBuildInfo() return "7.0.0", "12345", "Oct 25 2020", 70000 end ]] WoWMock.mock["GetCurrentRegion"] = [[ function GetCurrentRegion() return 3 end ]] WoWMock.mock["GetGlyphSocketInfo"] = [[ function GetGlyphSocketInfo(socket, talentGroup) -- No glyphs. return nil end ]] WoWMock.mock["GetInventoryItemGems"] = [[ function GetInventoryItemGems(slot) -- Player is always completely un-gemmed. return nil end ]] WoWMock.mock["GetInventoryItemID"] = [[ function GetInventoryItemID(unitId, slot) -- All units are naked. return nil end ]] WoWMock.mock["GetItemInfo"] = [[ function GetItemInfo(item) if type(item) == "number" then item = string.format("Item Name Of %d", item) end return item end ]] WoWMock.mock["GetLocale"] = [[ function GetLocale() return "enUS" end ]] WoWMock.mock["GetNumGlyphSockets"] = [[ function GetNumGlyphSockets() -- 3 x Major + 3 x Minor return 6 end ]] WoWMock.mock["GetNumShapeshiftForms"] = ZeroFunction WoWMock.mock["GetPowerRegen"] = [[ function GetPowerRegen() return 0, 0 end ]] WoWMock.mock["GetRealmName"] = [[ function GetRealmName() return "Elune" end ]] WoWMock.mock["GetRuneCooldown"] = [[ function GetRuneCooldown(slot) -- The rune is always ready. return 0, 10, true end ]] WoWMock.mock["GetRuneType"] = [[ function GetRuneType(slot) -- Everything is a death rune. return 4 end ]] WoWMock.mock["GetShapeshiftForm"] = [[ function GetShapeshiftForm() -- Always in humanoid form. return 0 end ]] WoWMock.mock["GetSpecialization"] = [[ local WOWMOCK_CLASS_SPECIALIZATION = { DEATHKNIGHT = { blood = 1, frost = 2, unholy = 3 }, DRUID = { balance = 1, feral = 2, guardian = 3, restoration = 4 }, HUNTER = { beast_mastery = 1, marksmanship = 2, survival = 3 }, MAGE = { arcane = 1, fire = 2, frost = 3 }, MONK = { brewmaster = 1, mistweaver = 2, windwalker = 3 }, PALADIN = { holy = 1, protection = 2, retribution = 3 }, PRIEST = { discipline = 1, holy = 2, shadow = 3 }, ROGUE = { assassination = 1, combat = 2, subtlety = 3 }, SHAMAN = { elemental = 1, enhancement = 2, restoration = 3 }, WARLOCK = { affliction = 1, demonology = 2, destruction = 3 }, WARRIOR = { arms = 1, fury = 2, protection = 3 }, } function GetSpecialization() local specialization local class = UnitClass() local wowMockSpec = WOWMOCK_CONFIG.specialization if wowMockSpec then if type(wowMockSpec) == "number" then specialization = wowMockSpec else specialization = WOWMOCK_CLASS_SPECIALIZATION[class][WOWMOCK_CONFIG.specialization] end end specialization = specialization or 1 return specialization end ]] WoWMock.mock["GetSpellInfo"] = [[ function GetSpellInfo(spell) if type(spell) == "number" then spell = string.format("Spell Name of %d", spell) end return spell end ]] WoWMock.mock["GetSpellTabInfo"] = [[ function GetSpellTabInfo(index) -- No spells in the spellbook. return nil end ]] WoWMock.mock["GetTalentInfo"] = [[ function GetTalentInfo(row, column, activeTalentGroup) -- No talents. return 123, "A Talent", nil, 0, nil end ]] WoWMock.mock["GetTime"] = [[ function GetTime() return 1234 end ]] WoWMock.mock["HasPetSpells"] = [[ function HasPetSpells() -- No pet spells. return false end ]] WoWMock.mock["InterfaceOptions_AddCategory"] = [[ function InterfaceOptions_AddCategory(category) end ]] WoWMock.mock["RegisterAddonMessagePrefix"] = DoNothing WoWMock.mock["RegisterStateDriver"] = DoNothing WoWMock.UnitAura = function(unitId) -- No auras on any unit. return nil end WoWMock.mock["SlashCmdList"] = [[ SlashCmdList = {} ]] WoWMock.mock["UnitClass"] = [[ function UnitClass() local class = WOWMOCK_CONFIG.class or "DEATHKNIGHT" return class, class end ]] WoWMock.mock["UnitFactionGroup"] = [[ function UnitFactionGroup(unitId) return "Horde", "Horde" end ]] WoWMock.mock["UnitGUID"] = [[ function UnitGUID(unitId) local guid = WOWMOCK_CONFIG.guid or 0 return guid end ]] WoWMock.mock["UnitLevel"] = [[ function UnitLevel() local level = WOWMOCK_CONFIG.level or 100 return level end ]] WoWMock.mock["UnitName"] = [[ function UnitName() local name = WOWMOCK_CONFIG.name or "AwesomePlayer" return name end ]] WoWMock.mock["UnitRace"] = [[ function UnitRace() return "Night Elf", "NightElf" end ]] WoWMock.mock["UnitPower"] = [[ function UnitPower(unitId, powerType) -- Always no resources on any unit. return 0 end ]] WoWMock.mock["UnitPowerMax"] = [[ function UnitPowerMax(unitId, powerType) -- Resources are from 0 to 100. return 100 end ]] WoWMock.mock["UnitPowerType"] = [[ function UnitPowerType(unitId) -- Every unit is a mana user. return WoWMock.SPELL_POWER_MANA, "MANA" end ]] -- Unit stat functions for a naked toon. WoWMock.GetCombatRating = ZeroFunction WoWMock.GetCritChance = ZeroFunction WoWMock.GetMastery = ZeroFunction WoWMock.GetMasteryEffect = ZeroFunction WoWMock.GetMeleeHaste = ZeroFunction WoWMock.GetRangedCritChance = ZeroFunction WoWMock.GetRangedHaste = ZeroFunction WoWMock.GetSpellBonusDamage = ZeroFunction WoWMock.GetSpellBonusHealing = ZeroFunction WoWMock.GetSpellCritChance = ZeroFunction WoWMock.UnitAttackPower = function(unitId) return 0, 0, 0 end WoWMock.UnitAttackSpeed = function(unitId) return 0, 0 end WoWMock.UnitDamage = function(unitId) return 0, 0, 0, 0, 0, 0, 0 end WoWMock.UnitRangedAttackPower = WoWMock.UnitAttackPower WoWMock.UnitSpellHaste = ZeroFunction WoWMock.UnitStat = ZeroFunction WoWMock.bit = { band = DoNothing, bor = DoNothing, } WoWMock.LibStub = LibStub --</public-static-properties> --<private-static-methods> local function FileExists(filename, directory, verbose) if directory then filename = directory .. filename end local fh = io.open(filename, "r") if fh then fh:close() return true else if verbose then print(string.format("Warning: '%s' not found.", filename)) end return false end end --</private-static-methods> --<public-static-methods> -- Create a new sandbox environment. function WoWMock:NewSandbox(config, mock) mock = mock or {} local sandbox = DeepCopy(mock) -- Save configuration to sandbox as "WOWMOCK_CONFIG" property. config = config or {} local WOWMOCK_CONFIG = DeepCopy(config) sandbox.WOWMOCK_CONFIG = WOWMOCK_CONFIG -- Redirect all direct references into _G into the sandbox instead. sandbox._G = sandbox -- Any missing symbols in the sandbox are inherited from the global environment. setmetatable(sandbox, { __index = _G }) -- Export all of the WoWMock symbols into the sandbox, taking care not to -- overwrite explicitly defined mocks. for key, value in pairs(self) do if key == "NewSandbox" then -- skip elseif key == "mock" then for k, v in pairs(value) do if not rawget(sandbox, k) then if type(v) == "string" then --print("Loading symbol (loadstring)", k) local func = loadstring(v) setfenv(func, sandbox) func() elseif type(v) == "function" then --print("Loading symbol (function)", k) sandbox[k] = v end end end else --print("Loading symbol (direct)", key) if not rawget(sandbox, key) then sandbox[key] = DeepCopy(value) end end end -- Sandbox configuration defaults. if not WOWMOCK_CONFIG.addonName then sandbox:SetAddonName("Addon Name") end return sandbox end -- Set the name of the addon for all files. function WoWMock:SetAddonName(name) self.WOWMOCK_CONFIG.addonName = name end -- Execute the given function within the sandbox environment. function WoWMock:Execute(func) setfenv(func, self) return func() end -- Fire an event in the sandbox. function WoWMock:Fire(event) local lib = self.LibStub("AceAddon-3.0") if lib then lib.Fire(event) end end --[[-------------------------------------------------------------------- LoadAddOnFile() dispatches to the proper method to load the file based on the file extension. --]]-------------------------------------------------------------------- function WoWMock:LoadAddonFile(filename, directory, verbose) local s = directory and (directory .. filename) or filename directory, filename = string.match(s, "^(.+/)([^/]+[.][%w]+)$") if not directory then filename = s end if string.find(filename, "[.]lua$") then return self:LoadLua(filename, directory, verbose) elseif string.find(filename, "[.]toc$") then return self:LoadTOC(filename, directory, verbose) elseif string.find(filename, "[.]xml$") then return self:LoadXML(filename, directory, verbose) end end --[[-------------------------------------------------------------------- LoadAddonFile() does the equivalent of dofile(), but munges the WoW addon file line that uses ... to get the file arguments. --]]-------------------------------------------------------------------- function WoWMock:LoadLua(filename, directory, verbose) local f = filename if directory then filename = directory .. filename end if verbose then print(string.format("Loading Lua: %s", filename)) end local ok = FileExists(filename, nil, verbose) if ok then local list = { } for line in io.lines(filename) do local varName = string.match(line, "^local%s+([%w_]+)%s*,[%w%s_,]*=%s*[.][.][.]%s*$") if varName then line = string.format("local %s = %q", varName, self.WOWMOCK_CONFIG.addonName) end if (#list == 0) then line = '--[[' .. filename .. ']]' .. line end table.insert(list, line) end local fileString = table.concat(list, "\n") local func = loadstring(fileString) if func then setfenv(func, self) func() else print(string.format("Error loading '%s'.", filename)) ok = false end end return ok end --[[-------------------------------------------------------------------- LoadTOC() loads all of the addon's files listed in the TOC file. --]]-------------------------------------------------------------------- function WoWMock:LoadTOC(filename, directory, verbose) local addonName = string.sub(filename, 1, -5) if directory then filename = directory .. filename end if verbose then print(string.format("Loading TOC: %s", filename)) end local ok = FileExists(filename, nil, verbose) if ok then -- Set the addon name from the name of the TOC file. self:SetAddonName(addonName) local list = {} for line in io.lines(filename) do line = string.gsub(line, "\\", "/") local t = {} t.directory, t.file = string.match(line, "^([^#]+/)([^/]+[.][%w]+)$") if t.directory then if directory then t.directory = directory .. t.directory end else t.directory = directory t.file = string.match(line, "^[%w_]+[.][%w]+$") end if t.file then table.insert(list, t) end end for _, t in ipairs(list) do if string.find(t.file, "[.]lua$") then ok = ok and self:LoadLua(t.file, t.directory, verbose) elseif string.find(t.file, "[.]xml$") then ok = ok and self:LoadXML(t.file, t.directory, verbose) end if not ok then break end end end return ok end --[[-------------------------------------------------------------------- LoadXML() loads all of the addon's Lua files listed in the XML file. --]]-------------------------------------------------------------------- function WoWMock:LoadXML(filename, directory, verbose) if directory then filename = directory .. filename end if verbose then print(string.format("Loading XML: %s", filename)) end local ok = FileExists(filename, nil, verbose) if ok then local list = {} for line in io.lines(filename) do local s = string.match(line, '<Script[%s]+file="([^"]+)"') if not s then s = string.match(line, '<Include[%s]+file="([^"]+)"') end if s then s = string.gsub(s, "\\", "/") local t = {} t.directory, t.file = string.match(s, "^(.+/)([^/]+[.][%w]+)$") if t.directory then if directory then t.directory = directory .. t.directory end else t.directory = directory t.file = s end if t.file then table.insert(list, t) end end end for _, t in ipairs(list) do if FileExists(t.file, t.directory, verbose) then if string.find(t.file, "[.]lua$") then ok = ok and self:LoadLua(t.file, t.directory, verbose) elseif string.find(t.file, "[.]xml$") then ok = ok and self:LoadXML(t.file, t.directory, verbose) end if not ok then break end end end end return ok end --</public-static-methods>
mit
RyMarq/Zero-K
scripts/bomberstrike.lua
2
3484
include "constants.lua" include "bombers.lua" local fuselage = piece 'fuselage' local wingl = piece 'wingl' local wingr = piece 'wingr' local enginel = piece 'enginel' local enginer = piece 'enginer' local head = piece 'head' local turretbase = piece 'turretbase' local turret = piece 'turret' local sleevel = piece 'sleevel' local sleever = piece 'sleever' local barrell = piece 'barrell' local barrelr = piece 'barrelr' local flarel = piece 'flarel' local flarer = piece 'flarer' local bombl = piece 'bombl' local bombr = piece 'bombr' local bFirepoint1 = false local bFirepoint2 = false -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function script.Create() Turn(turret, y_axis, math.pi) StartThread(GG.Script.SmokeUnit, unitID, smokePiece) Move(wingl, x_axis, -5, 7) Move(wingr, x_axis, 5, 7) Hide(turretbase) Hide(turret) Hide(sleevel) Hide(barrell) Hide(sleever) Hide(barrelr) end function script.Activate() Move(wingl, x_axis, 0, 7) Move(wingr, x_axis, 0, 7) end function script.Deactivate() Move(wingl, x_axis, -5, 7) Move(wingr, x_axis, 5, 7) end local function RestoreAfterDelay() Sleep(Static_Var_1) Turn(turret, y_axis, math.rad(180), math.rad(90)) Turn(sleevel, x_axis, 0, math.rad(50)) Turn(sleever, x_axis, 0, math.rad(50)) end function script.AimWeapon(num, heading, pitch) return true end function script.QueryWeapon(num) if num == 1 then return bFirepoint1 and bombl or bombr elseif num == 2 then return bFirepoint2 and flarel or flarer end end function script.AimFromWeapon(num) if num == 1 then return bFirepoint1 and bombl or bombr elseif num == 2 then return bFirepoint2 and flarel or flarer end end function script.AimWeapon(num, heading, pitch) if num == 1 then return (Spring.GetUnitRulesParam(unitID, "noammo") ~= 1) elseif num == 2 then Signal(SIG_AIM_2) SetSignalMask(SIG_AIM_2) Turn(turret, y_axis, math.rad(heading), math.rad(390)) Turn(sleevel, x_axis, 0, math.rad(350)) Turn(sleever, x_axis, 0, math.rad(350)) WaitForTurn(turret, y_axis) WaitForTurn(sleevel, x_axis) WaitForTurn(sleever, x_axis) StartThread(RestoreAfterDelay) return true end end function script.Shot(num) if num == 1 then bFirepoint1 = not bFirepoint1 elseif num == 2 then EmitSfx(turret, 1025) if bFirepoint2 then EmitSfx(flarel, 1024) else EmitSfx(flarer, 1024) end bFirepoint2 = not bFirepoint2 end end function script.FireWeapon(num) if num == 1 then Sleep(66) Reload() end end function script.AimFromWeapon(num) return bFirepoint2 and flarel or flarer end function script.Killed(recentDamage, maxHealth) local severity = recentDamage/maxHealth if severity <= .5 then Explode(fuselage, SFX.NONE) Explode(head, SFX.NONE) Explode(wingl, SFX.NONE) Explode(wingr, SFX.NONE) Explode(enginel, SFX.NONE) Explode(enginer, SFX.NONE) Explode(turret, SFX.NONE) Explode(sleevel, SFX.NONE) Explode(sleever, SFX.NONE) return 1 else Explode(fuselage, SFX.FALL + SFX.SMOKE) Explode(head, SFX.FALL + SFX.SMOKE + SFX.FIRE) Explode(wingl, SFX.FALL + SFX.SMOKE) Explode(wingr, SFX.FALL + SFX.SMOKE) Explode(enginel, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE) Explode(enginer, SFX.FALL + SFX.SMOKE + SFX.FIRE + SFX.EXPLODE) Explode(turret, SFX.FALL + SFX.SMOKE + SFX.FIRE) Explode(sleevel, SFX.FALL + SFX.SMOKE) Explode(sleever, SFX.FALL + SFX.SMOKE) return 2 end end
gpl-2.0
pakoito/ToME---t-engine4
game/modules/tome/data/maps/vaults/spider-den.lua
3
1935
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org setStatusAll{no_teleport=true, vault_only_door_open=true} rotates = {"default", "90", "180", "270", "flipx", "flipy"} startx = 7 starty = 0 defineTile('.', "FLOOR") defineTile('X', "HARDWALL") defineTile('#', "DOOR_VAULT", nil, nil, nil, {room_map={special=false, room=false, can_open=true}}) defineTile('s', "FLOOR", nil , {random_filter={add_levels=5,type="spiderkin",subtype="spider"}}) defineTile('S', "FLOOR", {random_filter={add_levels=10, tome_mod=vault}}, {random_filter={add_levels=10, type="spiderkin",subtype="spider"}}) defineTile('g', "FLOOR", {random_filter={add_levels=15, tome_mod=gvault}}, {random_filter={add_levels=15, type="spiderkin",subtype="spider"}}) defineTile('B', "FLOOR", {random_filter={add_levels=20, tome_mod=gvault}}, {random_filter={add_levels=20, type="spiderkin",subtype="spider"}}) defineTile('^', "FLOOR", nil, nil, {random_filter = {name="poison blast trap", add_levels=20}}) return { [[...XXXX#XXXX...]], [[..XXSs^.^ssXX..]], [[.XXS^XXXXX^SXX.]], [[XX.sS^s^s^Ss.XX]], [[Xs.S.s.ggg..ssX]], [[XS.s^S.gBgS^SSX]], [[Xss..ssggg.ss.X]], [[XXsSsS^s^.SsSXX]], [[.XX^Ss.Ss.s.XX.]], [[..XXsS.s^SsXX..]], [[...XXXXXXXXX...]], }
gpl-3.0
TerminalShell/zombiesurvival
entities/effects/floatingscore.lua
1
1377
EFFECT.LifeTime = 3 function EFFECT:Init(data) self:SetRenderBounds(Vector(-64, -64, -64), Vector(64, 64, 64)) self.Seed = math.Rand(0, 10) local pos = data:GetOrigin() local amount = math.Round(data:GetMagnitude()) self.Pos = pos local flag = math.Round(data:GetScale()) or 0 if flag == FM_LOCALKILLOTHERASSIST then self.Amount = amount.." (assisted)" elseif flag == FM_LOCALASSISTOTHERKILL then self.Amount = amount.." (assist)" else self.Amount = amount end self.ColID = flag self.DeathTime = CurTime() + self.LifeTime end function EFFECT:Think() self.Pos.z = self.Pos.z + FrameTime() * 32 return CurTime() < self.DeathTime end local cols = {} cols[0] = Color(190, 190, 220, 255) cols[1] = Color(255, 255, 10, 255) cols[2] = Color(255, 10, 10, 255) local col2 = Color(0, 0, 0, 255) function EFFECT:Render() local delta = math.Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime local col = cols[self.ColID] or cols[0] col.a = delta * 240 col2.a = col.a local ang = EyeAngles() local right = ang:Right() ang:RotateAroundAxis(ang:Up(), 270) ang:RotateAroundAxis(ang:Forward(), 90) cam.IgnoreZ(true) cam.Start3D2D(self.Pos + math.sin(CurTime() + self.Seed) * 30 * delta * right, ang, delta * 0.24 + 0.09) draw.SimpleText(self.Amount, "ZS3D2DFontBig", 0, -21, col, TEXT_ALIGN_CENTER) cam.End3D2D() cam.IgnoreZ(false) end
gpl-3.0
madpilot78/ntopng
scripts/lua/rest/v1/delete/ntopng/user.lua
1
1238
-- -- (C) 2013-21 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path package.path = dirs.installdir .. "/scripts/lua/modules/pools/?.lua;" .. package.path require "lua_utils" local json = require ("dkjson") local rest_utils = require("rest_utils") local tracker = require("tracker") -- -- Remove a ntopng user -- Example: curl -u admin:admin -H "Content-Type: application/json" -d '{"username": "mario"}' http://localhost:3000/lua/rest/v1/delete/ntopng/user.lua -- -- NOTE: in case of invalid login, no error is returned but redirected to login -- local rc = rest_utils.consts.success.ok local res = {} if not isAdministratorOrPrintErr() then rest_utils.answer(rest_utils.consts.err.not_granted, res) return end local username = _POST["username"] if username == nil then rest_utils.answer(rest_utils.consts.err.invalid_args, res) return end username = string.lower(username) if not ntop.deleteUser(username) then rest_utils.answer(rest_utils.consts.err.delete_user_failed, res) return end rest_utils.answer(rc, res) -- TRACKER HOOK -- Note: already tracked by ntop.deleteUser -- tracker.log('delete_ntopng_user', { username = username })
gpl-3.0
Laterus/Darkstar-Linux-Fork
scripts/zones/Bastok_Mines/npcs/Ranpi-Pappi.lua
5
1048
----------------------------------- -- Area: Bastok Mines -- NPC: Ranpi-Pappi -- Type: Standard NPC -- @zone: 234 -- @pos: -4.535 -1.044 49.881 -- -- Auto-Script: Requires Verification (Verified by Brando) ----------------------------------- package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil; require("scripts/zones/Bastok_Mines/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x004d); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
madpilot78/ntopng
scripts/lua/modules/alert_definitions/other/alert_attack_mitigation_via_snmp.lua
1
3580
-- -- (C) 2019-21 - ntop.org -- -- ############################################## local other_alert_keys = require "other_alert_keys" -- Import the classes library. local classes = require "classes" -- Make sure to import the Superclass! local alert = require "alert" local alert_entities = require "alert_entities" -- ############################################## local alert_attack_mitigation_via_snmp = classes.class(alert) -- ############################################## alert_attack_mitigation_via_snmp.meta = { alert_key = other_alert_keys.alert_attack_mitigation_via_snmp, i18n_title = "alerts_dashboard.attack_mitigation_snmp_title", icon = "fa fa-stop-circle", entities = { alert_entities.snmp_device }, } -- ############################################## -- @brief Prepare an alert table used to generate the alert -- @param metric Same as `alert_subtype` -- @param value A number indicating the measure which crossed the threshold -- @param operator A string indicating the operator used when evaluating the threshold, one of "gt", ">", "<" -- @param threshold A number indicating the threshold compared with `value` using operator -- @param access_port A table containing access port details with keys: name, trunk, id, and snmp_device_ip -- @param success Whether the admin status of the port has been successfully toggled to down -- @return A table with the alert built function alert_attack_mitigation_via_snmp:init(metric, value, operator, threshold, access_port, success) -- Call the parent constructor self.super:init() self.alert_type_params = { metric = metric, value = value, operator = operator, threshold = threshold, access_port = access_port, success = success } end -- ####################################################### -- @brief Format an alert into a human-readable string -- @param ifid The integer interface id of the generated alert -- @param alert The alert description table, including alert data such as the generating entity, timestamp, granularity, type -- @param alert_type_params Table `alert_type_params` as built in the `:init` method -- @return A human-readable string function alert_attack_mitigation_via_snmp.format(ifid, alert, alert_type_params) local alert_consts = require("alert_consts") local snmp_consts = require "snmp_consts" local entity = alert_consts.formatAlertEntity(ifid, alert_consts.alertEntityRaw(alert["entity_id"]), alert["entity_val"]) local engine_label = alert_consts.alertEngineLabel(alert_consts.alertEngine(alert_consts.sec2granularity(alert["alert_granularity"]))) local i18n_k = "alert_messages.attack_mitigation_via_snmp_success" if not alert_type_params.success then i18n_k = "alert_messages.attack_mitigation_via_snmp_failure" end return i18n(i18n_k, { granularity = engine_label:lower(), metric = alert_type_params.metric, entity = entity, value = string.format("%u", math.ceil(alert_type_params.value)), op = "&".. (alert_type_params.operator or "gt") ..";", threshold = alert_type_params.threshold, device = alert_type_params.access_port.snmp_device_ip, url = snmpDeviceUrl(alert_type_params.access_port.snmp_device_ip), port = alert_type_params.access_port.id, port_url = snmpIfaceUrl(alert_type_params.access_port.snmp_device_ip, alert_type_params.access_port.id), admin_down = snmp_consts.snmp_ifstatus("2" --[[ down --]]) }) end -- ####################################################### return alert_attack_mitigation_via_snmp
gpl-3.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Items/ItemTimeSeriesLight.lua
1
2060
--[[ Title: ItemTimeSeriesLight Author(s): LiXizhi Date: 2016/1/3 Desc: use the lib: ------------------------------------------------------------ NPL.load("(gl)script/apps/Aries/Creator/Game/Items/ItemTimeSeriesLight.lua"); local ItemTimeSeriesLight = commonlib.gettable("MyCompany.Aries.Game.Items.ItemTimeSeriesLight"); local item_ = ItemTimeSeriesLight:new({}); ------------------------------------------------------- ]] NPL.load("(gl)script/ide/math/vector.lua"); NPL.load("(gl)script/apps/Aries/Creator/Game/Movie/ActorLight.lua"); local ActorLight = commonlib.gettable("MyCompany.Aries.Game.Movie.ActorLight"); local EntityManager = commonlib.gettable("MyCompany.Aries.Game.EntityManager"); local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local TaskManager = commonlib.gettable("MyCompany.Aries.Game.TaskManager") local block_types = commonlib.gettable("MyCompany.Aries.Game.block_types") local GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic") local ItemTimeSeriesLight = commonlib.inherit(commonlib.gettable("MyCompany.Aries.Game.Items.ItemTimeSeries"), commonlib.gettable("MyCompany.Aries.Game.Items.ItemTimeSeriesLight")); block_types.RegisterItemClass("ItemTimeSeriesLight", ItemTimeSeriesLight); -- @param template: icon -- @param radius: the half radius of the object. function ItemTimeSeriesLight:ctor() end -- create actor from item stack. -- @param isReuseActor: whether we will reuse actor in the scene with the same name instead of creating a new entity. default to false. -- @param name: if not provided, it will use the name in itemStack function ItemTimeSeriesLight:CreateActorFromItemStack(itemStack, movieclipEntity, isReuseActor, name, movieclip) local actor = ActorLight:new():Init(itemStack, movieclipEntity, isReuseActor, name, movieclip); return actor; end function ItemTimeSeriesLight:GetTooltipFromItemStack(itemStack) local name = itemStack:GetDisplayName(); if(not name and name~="") then return self:GetTooltip(); else return format(L"%s:右键编辑", name); end end
gpl-2.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/APISandbox/CreatorAPISandbox.lua
1
7970
--[[ Title: sandbox api environment for the creator Author(s): LiXizhi Date: 2013/8/19 Desc: moved from NeuronAPISandbox.lua to here for easy file location and extension management. use the lib: ------------------------------------------------------------ NPL.load("(gl)script/apps/Aries/Creator/Game/APISandbox/CreatorAPISandbox.lua"); local CreatorAPISandbox = commonlib.gettable("MyCompany.Aries.Game.APISandbox.CreatorAPISandbox"); CreatorAPISandbox.Cleanup(); local sandbox = CreatorAPISandbox.CreateGetSandbox(); ------------------------------------------------------- ]] NPL.load("(gl)script/apps/Aries/Creator/Game/Neuron/NeuronManager.lua"); NPL.load("(gl)script/ide/AudioEngine/AudioEngine.lua"); NPL.load("(gl)script/ide/timer.lua"); local AudioEngine = commonlib.gettable("AudioEngine"); local NeuronManager = commonlib.gettable("MyCompany.Aries.Game.Neuron.NeuronManager"); local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local TaskManager = commonlib.gettable("MyCompany.Aries.Game.TaskManager") local block_types = commonlib.gettable("MyCompany.Aries.Game.block_types") local block = commonlib.gettable("MyCompany.Aries.Game.block") local GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic") local CommandManager = commonlib.gettable("MyCompany.Aries.Game.CommandManager"); local CreatorAPISandbox = commonlib.gettable("MyCompany.Aries.Game.APISandbox.CreatorAPISandbox"); local env; -- called when first loading the world function CreatorAPISandbox.Cleanup() LOG.std(nil, "info", "APISandbox", "cleaned up sandbox scripting environment") env = nil; end -- create get sandbox function CreatorAPISandbox.CreateGetSandbox() if(not env) then env = CreatorAPISandbox.CreateSandbox() end return env; end function CreatorAPISandbox.CreateSandbox() local env = { ipairs = ipairs, next = next, pairs = pairs, pcall = pcall, tonumber = tonumber, tostring = tostring, type = type, unpack = unpack, coroutine = { create = coroutine.create, resume = coroutine.resume, running = coroutine.running, status = coroutine.status, wrap = coroutine.wrap }, string = { byte = string.byte, char = string.char, find = string.find, format = string.format, gmatch = string.gmatch, gsub = string.gsub, len = string.len, lower = string.lower, match = string.match, rep = string.rep, reverse = string.reverse, sub = string.sub, upper = string.upper }, table = { insert = table.insert, maxn = table.maxn, remove = table.remove, sort = table.sort }, math = { abs = math.abs, acos = math.acos, asin = math.asin, atan = math.atan, atan2 = math.atan2, ceil = math.ceil, cos = math.cos, cosh = math.cosh, deg = math.deg, exp = math.exp, floor = math.floor, fmod = math.fmod, frexp = math.frexp, huge = math.huge, ldexp = math.ldexp, log = math.log, log10 = math.log10, max = math.max, min = math.min, modf = math.modf, pi = math.pi, pow = math.pow, rad = math.rad, random = math.random, sin = math.sin, sinh = math.sinh, sqrt = math.sqrt, tan = math.tan, tanh = math.tanh }, os = { clock = os.clock, difftime = os.difftime, time = os.time }, }; local meta = getmetatable (env) if not meta then meta = {} setmetatable (env, meta) end -- Note: do not expose the _G -- SECURITY NOTE: -- expose global environment to the inline script via meta table -- meta.__index = _G; LOG.std(nil, "info", "CreatorAPISandbox", "new sandbox env is created"); CreatorAPISandbox.InstallCommon(env); CreatorAPISandbox.InstallBlock(env); CreatorAPISandbox.InstallAudio(env); CreatorAPISandbox.InstallMovie(env); CreatorAPISandbox.InstallRawAPI(env); CreatorAPISandbox.InstallClasses(env); env.__index = env; return env; end function CreatorAPISandbox.InstallRawAPI(env) env.ParaCamera = ParaCamera; end -- common functions function CreatorAPISandbox.InstallCommon(env) env.echo = echo; env.LOG = LOG; env.alert = function(content, ...) -- disable mcml in content for security reasons content = commonlib.Encoding.EncodeStr(content); _guihelper.MessageBox(content, ...) end; -- load file in current directory env.load = function(filename) -- TODO: how to handle cross reference. end; -- activate a given neuron env.activate = function(filename) -- TODO: how to handle cross reference. end; -- load a mod outside sandbox env env.mod = function(mod_name) return NeuronManager.LoadMod(mod_name); end; -- run a command env.cmd = function(cmd_name, cmd_text, ...) return CommandManager:RunCommand(cmd_name, cmd_text, ...) end -- conver to real position env.real = function(bx,by,bz) return BlockEngine:real(bx,by,bz); end -- conver to block position env.block = function(x,y,z) return BlockEngine:block(x,y,z); end -- take a given block in right hand env.select = function(block_id) GameLogic.SetBlockInRightHand(block_id) end -- commonlib env.commonlib = { Timer = commonlib.Timer, TimerManager = commonlib.TimerManager, }; end -- blocks related functions function CreatorAPISandbox.InstallBlock(env) env.blocks = { -- set(bx,by,bz,block_id) set = function(...) return BlockEngine:SetBlock(...); end, -- get(bx,by,bz) get = ParaTerrain.GetBlockTemplateByIdx, -- get script environment of a given neuron . may return nil. -- @param bCreateIfNotExist: default to true getscript = function(x,y,z, bCreateIfNotExist) local neuron = NeuronManager.GetNeuron(x,y,z, bCreateIfNotExist~=false) if(neuron) then return neuron:GetScriptScope(); end end, }; end function CreatorAPISandbox.InstallAudio(env) env.audio = { -- play audio file. either 2d or 3d. -- @param filename: predefined audio name such ash "portal" in "CreatorSound.bank.xml" or any file relative to current world directory. play = function(filename, x, y, z, loop) local audio_src = AudioEngine.Get(filename); if(not audio_src) then filename = GameLogic.BuildResourceFilepath(filename); if(filename) then audio_src = AudioEngine.CreateGet(filename); audio_src.file = filename; end end if(loop) then audio_src.loop = true; end if(not x) then audio_src:play(); else audio_src:play3d(x,y,z, loop); end end, stop = function(filename) local audio_src = AudioEngine.Get(filename) or AudioEngine.Get(GameLogic.BuildResourceFilepath(filename)); if(audio_src) then audio_src:stop(); end end, }; end function CreatorAPISandbox.InstallMovie(env) env.movie = { -- show a movie sub script text = function(content, callbackFunc) NPL.load("(gl)script/apps/Aries/Creator/Game/Neuron/Mod/MovieText.lua"); local MovieText = commonlib.gettable("MyCompany.Aries.Game.Mod.MovieText"); MovieText.ShowPage(content, callbackFunc) end, }; end -- exposing some oftenly used classes to sandbox environment function CreatorAPISandbox.InstallClasses(env) env.Direction = commonlib.gettable("MyCompany.Aries.Game.Common.Direction"); env.ItemClient = commonlib.gettable("MyCompany.Aries.Game.Items.ItemClient"); env.BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine"); env.block_types = commonlib.gettable("MyCompany.Aries.Game.block_types"); env.GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic"); env.EntityManager = commonlib.gettable("MyCompany.Aries.Game.EntityManager"); env.WorldSim = commonlib.gettable("MyCompany.Aries.Game.WorldSim"); env.CmdParser = commonlib.gettable("MyCompany.Aries.Game.CmdParser"); env.CommandManager = commonlib.gettable("MyCompany.Aries.Game.CommandManager"); env.Game = commonlib.gettable("MyCompany.Aries.Game"); env.Event = commonlib.gettable("System.Core.Event"); env.System = commonlib.gettable("System"); local additionalEnv = {}; GameLogic.GetFilters():apply_filters("register_classes_into_sandbox_api", additionalEnv); for k,v in pairs(additionalEnv) do if not env[k] then env[k]=v; end end end
gpl-2.0
pakoito/ToME---t-engine4
game/modules/tome/data/general/objects/egos/heavy-armor.lua
3
3363
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org local Talents = require("engine.interface.ActorTalents") local Stats = require "engine.interface.ActorStats" local DamageType = require "engine.DamageType" load("/data/general/objects/egos/armor.lua") newEntity{ power_source = {technique=true}, name = "impenetrable ", prefix=true, instant_resolve=true, keywords = {impenetrable=true}, level_range = {10, 50}, rarity = 8, cost = 7, wielder = { combat_armor = resolvers.mbonus_material(15, 5), }, } newEntity{ power_source = {technique=true}, name = "hardened ", prefix=true, instant_resolve=true, keywords = {hardened=true}, level_range = {40, 50}, greater_ego = 1, rarity = 29, cost = 47, wielder = { resists={ [DamageType.ACID] = resolvers.mbonus_material(8, 5), [DamageType.LIGHTNING] = resolvers.mbonus_material(8, 5), [DamageType.FIRE] = resolvers.mbonus_material(8, 5), [DamageType.COLD] = resolvers.mbonus_material(8, 5), [DamageType.PHYSICAL] = resolvers.mbonus_material(8, 5), }, combat_armor = resolvers.mbonus_material(5, 5), }, } newEntity{ power_source = {arcane=true}, name = "fearforged ", prefix=true, instant_resolve=true, keywords = {fearforged=true}, level_range = {40, 50}, greater_ego = 1, rarity = 30, cost = 80, wielder = { resists={ [DamageType.FIRE] = resolvers.mbonus_material(10, 5), [DamageType.LIGHT] = resolvers.mbonus_material(10, 10, function(e, v) return 0, -v end), [DamageType.DARKNESS] = resolvers.mbonus_material(10, 5), }, inc_stats = { [Stats.STAT_CON] = resolvers.mbonus_material(5, 5), }, combat_mentalresist = resolvers.mbonus_material(5, 5), combat_physresist = resolvers.mbonus_material(5, 5), combat_spellresist = resolvers.mbonus_material(5, 5), fatigue = resolvers.mbonus_material(10, 5), }, } newEntity{ power_source = {technique=true}, name = " of implacability", suffix=true, instant_resolve=true, keywords = {['implac.']=true}, level_range = {20, 50}, greater_ego = 1, rarity = 16, cost = 30, wielder = { combat_physresist = resolvers.mbonus_material(10, 5), combat_armor = resolvers.mbonus_material(6, 4), fatigue = resolvers.mbonus_material(6, 4, function(e, v) return 0, -v end), }, } newEntity{ power_source = {technique=true}, name = "fortifying ", prefix=true, instant_resolve=true, keywords = {['fortif.']=true}, level_range = {30, 50}, greater_ego = 1, rarity = 18, cost = 35, wielder = { inc_stats = { [Stats.STAT_CON] = resolvers.mbonus_material(5, 2), [Stats.STAT_STR] = resolvers.mbonus_material(5, 2), }, max_life=resolvers.mbonus_material(70, 30), }, }
gpl-3.0
tempbottle/openlua
src/testset.lua
2
4440
--[[---------------------------------------------- Õë¶Ôset.luaµÄ²âÊÔ´úÂë --]]---------------------------------------------- dofile("set.lua") local empty = Set{} assert(empty:Count() == 0) assert(empty:Empty()) local number1 = Set{1979} assert(number1:Count() == 1) assert(number1:Contains(1979)) local string1 = Set{"djf"} assert(string1:Count() == 1) assert(string1:Contains("djf")) local bool2 = Set{true,false,true,false} assert(bool2:Count() == 2) assert(bool2:Contains(true) and bool2:Contains(false)) local set2 = Set{1,1,1979,1979,"soloist","soloist"} assert(set2:Count() == 3) local set3 = Set{Set{3,5},Set{5,3}} assert(set3:Count() == 1) assert(set3:Contains(Set{3,5})) local set4 = Set{1,1,"temp","temp",Set{3,5},Set{5,3,"djf"},Set{3,5,"djf"}} assert(set4:Count() == 4) assert(set4:Contains(1)) assert(set4:Contains("temp")) assert(set4:Contains(Set{3,5})) assert(set4:Contains(Set{3,5,"djf"})) local other = Set{1979,{4,5},{4,5}} assert(other:Count() == 3) -- test relational operations local function TestLess(set1,set2) assert(set1 ~= set2) assert(set2 ~= set1) assert(set1 <= set2) assert(set2 >= set1) assert(set1 < set2) assert(set2 > set1) assert(not (set1 >= set2)) assert(not (set1 > set2)) assert(not (set2 <= set1)) assert(not (set2 < set1)) end local function TestLessOrEqual(set1,set2) assert(set1 <= set2) assert(set2 >= set1) assert(not (set1 > set2)) assert(not (set2 < set1)) end local function TestEqual(set1,set2) assert(set1 == set2) assert(set2 == set1) assert(set1 <= set2) assert(set1 >= set2) assert(set2 <= set1) assert(set2 >= set1) assert(not (set1 > set2)) assert(not (set1 < set2)) assert(not (set2 > set1)) assert(not (set2 < set1)) end local function TestNotEqual(set1,set2) assert(set1 ~= set2) assert(set2 ~= set1) assert(not (set1 == set2)) assert(not (set2 == set1)) end TestEqual(empty,Set{}) TestEqual(empty,empty) TestLess(empty,number1) TestLess(empty,string1) TestLess(empty,bool2) TestNotEqual(number1,string1) TestNotEqual(string1,bool2) TestNotEqual(number1,bool2) local set4 = Set{1,1,"temp","temp",Set{3,5},Set{5,3,"djf"},Set{3,5,"djf"}} TestEqual(set4,set4) local set5 = Set{1,"temp",Set{5,3},Set{5,3,"djf"}} TestEqual(set5,set5) TestEqual(set5,set4) local set6 = Set{1,"temp","temp",1,Set{5,3,3,3,3,5}} TestEqual(set6,set6) TestLess(set6,set5) -- test set arithmatic operations local function TestCommutative(set1,set2) TestEqual(set1 + set2,set2 + set1) TestEqual(set1 * set2,set2 * set1) end local function TestIdentity(set) local empty = Set{} TestCommutative(empty,set) TestEqual(set,set + empty) TestEqual(empty,set * empty) TestEqual(set,set + set) TestEqual(set,set * set) TestEqual(set,set - empty) TestEqual(empty,empty - set) TestEqual(empty, set - set) end TestIdentity(empty) TestIdentity(number1) TestIdentity(string1) TestIdentity(bool2) local a1 = Set{56,78,"you"} local a2 = Set{78,33,"we","you"} local a3 = Set{56,78,33,"you","we"} TestIdentity(a1) TestIdentity(a2) TestIdentity(a3) TestCommutative(a1,a2) TestEqual(a1 + a2,a3) TestEqual(a1 * a2,Set{78,"you"}) TestEqual(a1 - a2,Set{56}) TestEqual(a2 - a1,Set{33,"we"}) local b1 = Set{"soloist","soloist","game",1979,1979,Set{5,7,9,"temp"}} local b2 = Set{"game","game",33,Set{5,7,9,"temp"},Set{"another"}} local b3 = Set{"soloist","game",1979,33,Set{5,7,9,"temp"},Set{"another"}} local b4 = Set{Set{5,7,9,"temp"},"game"} local b2_b1 = Set{33,Set{"another"}} TestIdentity(b1) TestIdentity(b2) TestIdentity(b3) TestIdentity(b4) TestCommutative(b1,b2) TestEqual(b1 + b2, b3) TestEqual(b1 * b2,b4) TestEqual(b1 - b2,Set{"soloist",1979}) TestEqual(b2 - b1 ,b2_b1) --------------------- local a1 = Set{5,7,9,Set{1979}} assert(a1:Add(5) == false) assert(a1 == Set{5,7,9,Set{1979}}) assert(a1:Add(11) == true) assert(a1 == Set{5,7,9,11,Set{1979}}) assert(a1:Add(Set{1979}) == false) assert(a1:Add(Set{"temp"}) == true) assert(a1:Remove(Set{55,66}) == false) assert(a1:Remove(Set{1979}) == true) assert(a1 == Set{5,7,9,11,Set{"temp"}}) local b1 = Set{5,"temp",Set{1979,"who"}} local b2 = Set{Set{1979,"who"}} assert(b1:Union(b2) == false) assert(b1 == Set{5,"temp",Set{1979,"who"}}) local b3 = Set{1979,"chang"} assert(b1:Union(b3) == true) Set.Print(b1) assert(b1 == Set{5,"temp",Set{1979,"who"},1979,"chang"}) local c = 0 for e in b1:Traverse() do c = c + 1 end assert(c == 5)
mit
TeamHypersomnia/Hypersomnia
hypersomnia/content/gfx/flower_pink_4.meta.lua
18
2002
return { extra_loadables = { enabled_generate_neon_map = { alpha_multiplier = 1, amplification = 80, light_colors = { "140 57 181 255", "255 74 231 255", "148 33 132 255", "123 49 156 255", "140 57 181 255" }, radius = { x = 80, y = 80 }, standard_deviation = 6 }, generate_desaturation = false }, offsets = { gun = { bullet_spawn = { x = 0, y = 0 }, detachable_magazine = { pos = { x = 0, y = 0 }, rotation = 0 } }, item = { attachment_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, back_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, beep_offset = { pos = { x = 0, y = 0 }, rotation = 0 }, hand_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, head_anchor = { pos = { x = 0, y = 0 }, rotation = 0 } }, legs = { foot = { x = 0, y = 0 } }, torso = { back = { pos = { x = 0, y = 0 }, rotation = 0 }, head = { pos = { x = 0, y = 0 }, rotation = 0 }, legs = { pos = { x = 0, y = 0 }, rotation = 0 }, primary_hand = { pos = { x = 0, y = 0 }, rotation = 0 }, secondary_hand = { pos = { x = 0, y = 0 }, rotation = 0 } } }, usage_as_button = { bbox_expander = { x = 0, y = 0 }, flip = { horizontally = false, vertically = false } } }
agpl-3.0
TeamHypersomnia/Hypersomnia
hypersomnia/content/gfx/flower_pink_5.meta.lua
18
2002
return { extra_loadables = { enabled_generate_neon_map = { alpha_multiplier = 1, amplification = 80, light_colors = { "140 57 181 255", "255 74 231 255", "148 33 132 255", "123 49 156 255", "140 57 181 255" }, radius = { x = 80, y = 80 }, standard_deviation = 6 }, generate_desaturation = false }, offsets = { gun = { bullet_spawn = { x = 0, y = 0 }, detachable_magazine = { pos = { x = 0, y = 0 }, rotation = 0 } }, item = { attachment_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, back_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, beep_offset = { pos = { x = 0, y = 0 }, rotation = 0 }, hand_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, head_anchor = { pos = { x = 0, y = 0 }, rotation = 0 } }, legs = { foot = { x = 0, y = 0 } }, torso = { back = { pos = { x = 0, y = 0 }, rotation = 0 }, head = { pos = { x = 0, y = 0 }, rotation = 0 }, legs = { pos = { x = 0, y = 0 }, rotation = 0 }, primary_hand = { pos = { x = 0, y = 0 }, rotation = 0 }, secondary_hand = { pos = { x = 0, y = 0 }, rotation = 0 } } }, usage_as_button = { bbox_expander = { x = 0, y = 0 }, flip = { horizontally = false, vertically = false } } }
agpl-3.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Neuron/Templates/example_movie.lua
1
1101
-- 示例文件: NPL script file local count = 0; -- 触发函数 function main(msg) count = (count + 1); if(count > 3) then count = 1 end -- 轮流播放3个音乐 if(count == 1) then -- 积木坐标转到实数坐标 local x, y, z = real(this.x, this.y, this.z); -- 官方定义过的声音 audio.play("portal", x, y, z); audio.stop("fire"); movie.text("带上你的耳机, 可以听到声音, 再次激活可以听见不同的音乐") elseif(count == 2) then audio.stop("portal"); -- 支持 map3, ogg, wav 等文件, 文件放在当前世界目录下 -- 不传位置代表2D声音, 否则是3D声音 audio.play("audio/test.mp3", nil, nil, nil, true); movie.text("Playing 'audio/test.mp3' 支持 map3, ogg, wav 等文件, 文件放在当前世界目录下") elseif(count == 3) then local x, y, z = real(this.x, this.y, this.z); audio.stop("audio/test.mp3"); -- 最后一个参数true是循环播放 audio.play("fire", x, y, z, true); movie.text("立体3D音效,WASD键转动摄影机可以听见声音的位置") end -- 休息5秒 this:Sleep(5); end
gpl-2.0
mysql/mysql-proxy
examples/tutorial-union.lua
6
1614
--[[ $%BEGINLICENSE%$ Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA $%ENDLICENSE%$ --]] res = { } function read_query(packet) if packet:byte() ~= proxy.COM_QUERY then return end local q = packet:sub(2) res = { } if q:sub(1, 6):upper() == "SELECT" then proxy.queries:append(1, packet, { resultset_is_needed = true }) proxy.queries:append(2, packet, { resultset_is_needed = true }) return proxy.PROXY_SEND_QUERY end end function read_query_result(inj) for row in inj.resultset.rows do res[#res + 1] = row end if inj.id ~= 2 then return proxy.PROXY_IGNORE_RESULT end proxy.response = { type = proxy.MYSQLD_PACKET_OK, resultset = { rows = res } } local fields = {} for n = 1, #inj.resultset.fields do fields[#fields + 1] = { type = inj.resultset.fields[n].type, name = inj.resultset.fields[n].name, } end proxy.response.resultset.fields = fields return proxy.PROXY_SEND_RESULT end
gpl-2.0
BinChengfei/openwrt-3.10.14
package/ramips/ui/luci-mtk/src/contrib/luasrcdiet/lua/llex.lua
122
12449
--[[-------------------------------------------------------------------- llex.lua: Lua 5.1 lexical analyzer in Lua This file is part of LuaSrcDiet, based on Yueliang material. Copyright (c) 2008 Kein-Hong Man <khman@users.sf.net> The COPYRIGHT file describes the conditions under which this software may be distributed. See the ChangeLog for more information. ----------------------------------------------------------------------]] --[[-------------------------------------------------------------------- -- NOTES: -- * This is a version of the native 5.1.x lexer from Yueliang 0.4.0, -- with significant modifications to handle LuaSrcDiet's needs: -- (1) llex.error is an optional error function handler -- (2) seminfo for strings include their delimiters and no -- translation operations are performed on them -- * ADDED shbang handling has been added to support executable scripts -- * NO localized decimal point replacement magic -- * NO limit to number of lines -- * NO support for compatible long strings (LUA_COMPAT_LSTR) -- * Please read technotes.txt for more technical details. ----------------------------------------------------------------------]] local base = _G local string = require "string" module "llex" local find = string.find local match = string.match local sub = string.sub ---------------------------------------------------------------------- -- initialize keyword list, variables ---------------------------------------------------------------------- local kw = {} for v in string.gmatch([[ and break do else elseif end false for function if in local nil not or repeat return then true until while]], "%S+") do kw[v] = true end -- NOTE: see init() for module variables (externally visible): -- tok, seminfo, tokln local z, -- source stream sourceid, -- name of source I, -- position of lexer buff, -- buffer for strings ln -- line number ---------------------------------------------------------------------- -- add information to token listing ---------------------------------------------------------------------- local function addtoken(token, info) local i = #tok + 1 tok[i] = token seminfo[i] = info tokln[i] = ln end ---------------------------------------------------------------------- -- handles line number incrementation and end-of-line characters ---------------------------------------------------------------------- local function inclinenumber(i, is_tok) local sub = sub local old = sub(z, i, i) i = i + 1 -- skip '\n' or '\r' local c = sub(z, i, i) if (c == "\n" or c == "\r") and (c ~= old) then i = i + 1 -- skip '\n\r' or '\r\n' old = old..c end if is_tok then addtoken("TK_EOL", old) end ln = ln + 1 I = i return i end ---------------------------------------------------------------------- -- initialize lexer for given source _z and source name _sourceid ---------------------------------------------------------------------- function init(_z, _sourceid) z = _z -- source sourceid = _sourceid -- name of source I = 1 -- lexer's position in source ln = 1 -- line number tok = {} -- lexed token list* seminfo = {} -- lexed semantic information list* tokln = {} -- line numbers for messages* -- (*) externally visible thru' module -------------------------------------------------------------------- -- initial processing (shbang handling) -------------------------------------------------------------------- local p, _, q, r = find(z, "^(#[^\r\n]*)(\r?\n?)") if p then -- skip first line I = I + #q addtoken("TK_COMMENT", q) if #r > 0 then inclinenumber(I, true) end end end ---------------------------------------------------------------------- -- returns a chunk name or id, no truncation for long names ---------------------------------------------------------------------- function chunkid() if sourceid and match(sourceid, "^[=@]") then return sub(sourceid, 2) -- remove first char end return "[string]" end ---------------------------------------------------------------------- -- formats error message and throws error -- * a simplified version, does not report what token was responsible ---------------------------------------------------------------------- function errorline(s, line) local e = error or base.error e(string.format("%s:%d: %s", chunkid(), line or ln, s)) end local errorline = errorline ------------------------------------------------------------------------ -- count separators ("=") in a long string delimiter ------------------------------------------------------------------------ local function skip_sep(i) local sub = sub local s = sub(z, i, i) i = i + 1 local count = #match(z, "=*", i) -- note, take the length i = i + count I = i return (sub(z, i, i) == s) and count or (-count) - 1 end ---------------------------------------------------------------------- -- reads a long string or long comment ---------------------------------------------------------------------- local function read_long_string(is_str, sep) local i = I + 1 -- skip 2nd '[' local sub = sub local c = sub(z, i, i) if c == "\r" or c == "\n" then -- string starts with a newline? i = inclinenumber(i) -- skip it end local j = i while true do local p, q, r = find(z, "([\r\n%]])", i) -- (long range) if not p then errorline(is_str and "unfinished long string" or "unfinished long comment") end i = p if r == "]" then -- delimiter test if skip_sep(i) == sep then buff = sub(z, buff, I) I = I + 1 -- skip 2nd ']' return buff end i = I else -- newline buff = buff.."\n" i = inclinenumber(i) end end--while end ---------------------------------------------------------------------- -- reads a string ---------------------------------------------------------------------- local function read_string(del) local i = I local find = find local sub = sub while true do local p, q, r = find(z, "([\n\r\\\"\'])", i) -- (long range) if p then if r == "\n" or r == "\r" then errorline("unfinished string") end i = p if r == "\\" then -- handle escapes i = i + 1 r = sub(z, i, i) if r == "" then break end -- (EOZ error) p = find("abfnrtv\n\r", r, 1, true) ------------------------------------------------------ if p then -- special escapes if p > 7 then i = inclinenumber(i) else i = i + 1 end ------------------------------------------------------ elseif find(r, "%D") then -- other non-digits i = i + 1 ------------------------------------------------------ else -- \xxx sequence local p, q, s = find(z, "^(%d%d?%d?)", i) i = q + 1 if s + 1 > 256 then -- UCHAR_MAX errorline("escape sequence too large") end ------------------------------------------------------ end--if p else i = i + 1 if r == del then -- ending delimiter I = i return sub(z, buff, i - 1) -- return string end end--if r else break -- (error) end--if p end--while errorline("unfinished string") end ------------------------------------------------------------------------ -- main lexer function ------------------------------------------------------------------------ function llex() local find = find local match = match while true do--outer local i = I -- inner loop allows break to be used to nicely section tests while true do--inner ---------------------------------------------------------------- local p, _, r = find(z, "^([_%a][_%w]*)", i) if p then I = i + #r if kw[r] then addtoken("TK_KEYWORD", r) -- reserved word (keyword) else addtoken("TK_NAME", r) -- identifier end break -- (continue) end ---------------------------------------------------------------- local p, _, r = find(z, "^(%.?)%d", i) if p then -- numeral if r == "." then i = i + 1 end local _, q, r = find(z, "^%d*[%.%d]*([eE]?)", i) i = q + 1 if #r == 1 then -- optional exponent if match(z, "^[%+%-]", i) then -- optional sign i = i + 1 end end local _, q = find(z, "^[_%w]*", i) I = q + 1 local v = sub(z, p, q) -- string equivalent if not base.tonumber(v) then -- handles hex test also errorline("malformed number") end addtoken("TK_NUMBER", v) break -- (continue) end ---------------------------------------------------------------- local p, q, r, t = find(z, "^((%s)[ \t\v\f]*)", i) if p then if t == "\n" or t == "\r" then -- newline inclinenumber(i, true) else I = q + 1 -- whitespace addtoken("TK_SPACE", r) end break -- (continue) end ---------------------------------------------------------------- local r = match(z, "^%p", i) if r then buff = i local p = find("-[\"\'.=<>~", r, 1, true) if p then -- two-level if block for punctuation/symbols -------------------------------------------------------- if p <= 2 then if p == 1 then -- minus local c = match(z, "^%-%-(%[?)", i) if c then i = i + 2 local sep = -1 if c == "[" then sep = skip_sep(i) end if sep >= 0 then -- long comment addtoken("TK_LCOMMENT", read_long_string(false, sep)) else -- short comment I = find(z, "[\n\r]", i) or (#z + 1) addtoken("TK_COMMENT", sub(z, buff, I - 1)) end break -- (continue) end -- (fall through for "-") else -- [ or long string local sep = skip_sep(i) if sep >= 0 then addtoken("TK_LSTRING", read_long_string(true, sep)) elseif sep == -1 then addtoken("TK_OP", "[") else errorline("invalid long string delimiter") end break -- (continue) end -------------------------------------------------------- elseif p <= 5 then if p < 5 then -- strings I = i + 1 addtoken("TK_STRING", read_string(r)) break -- (continue) end r = match(z, "^%.%.?%.?", i) -- .|..|... dots -- (fall through) -------------------------------------------------------- else -- relational r = match(z, "^%p=?", i) -- (fall through) end end I = i + #r addtoken("TK_OP", r) -- for other symbols, fall through break -- (continue) end ---------------------------------------------------------------- local r = sub(z, i, i) if r ~= "" then I = i + 1 addtoken("TK_OP", r) -- other single-char tokens break end addtoken("TK_EOS", "") -- end of stream, return -- exit here ---------------------------------------------------------------- end--while inner end--while outer end return base.getfenv()
gpl-2.0
Laterus/Darkstar-Linux-Fork
scripts/zones/Rabao/npcs/Nomad_Moogle.lua
37
1063
----------------------------------- -- -- Nomad Moogle -- ----------------------------------- require("scripts/globals/settings"); package.loaded["scripts/zones/Rabao/TextIDs"] = nil; require("scripts/zones/Rabao/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,NOMAD_MOOGLE_DIALOG); player:sendMenu(1); end; ----------------------------------- -- onEventUpdate Action ----------------------------------- function onEventUpdate(player,csid,option) --print("onEventUpdate"); --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) --print("onEventFinish"); --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
Laterus/Darkstar-Linux-Fork
scripts/zones/Attohwa_Chasm/Zone.lua
1
1120
----------------------------------- -- -- Zone: Attohwa_Chasm -- ----------------------------------- require("scripts/globals/settings"); package.loaded["scripts/zones/Attohwa_Chasm/TextIDs"] = nil; require("scripts/zones/Attohwa_Chasm/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) cs = -1; return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,menuchoice) --print("CSID: ",csid); --print("RESULT: ",menuchoice); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,menuchoice) --print("CSID: ",csid); --print("RESULT: ",menuchoice); end;
gpl-3.0
pakoito/ToME---t-engine4
game/modules/tome/data/texts/unlock-mage_necromancer.lua
3
2170
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org return "New Class: #LIGHT_GREEN#Necromancer", [[ Necromancy, the forbidden art. Necromancy, the black art. During the Age of Dusk and the Age of Pyre the world went through a tortured era. Kingdoms were shattered, whole races suppressed, and diseases ran wild, killing millions. It was a dark time and amidst the chaos came the bringers of terror: the necromancers. Though they always existed, and will always exist whilst our souls are open to temptation, this was their true age of glory. The so-called 'noble' archmages regard necromancers as fallen brothers that must be corrected... or removed. But necromancers consider themselves misunderstood practitioners of an art that others are too scared or too feeble to touch. And oh, what great powers those arts do bring.... You have learnt the basics of necromancy, killed a real one, and can now create new characters with the #LIGHT_GREEN#Necromancer class#WHITE#. Necromancers are dark spellcasters, attuned to death itself. Their ultimate goal is their own eternal life, often as a Lich. Class features:#YELLOW# - Cast darkness and ice infused spells to destroy your foes - Summon an army of undead minions to do your bidding - Use your minions as pawns, sacrificing them in various cruel and unusual ways - Embark on the quest of your life: Lichdom#WHITE# All mages use mana to cast their spells. It slowly replenishes over time. ]]
gpl-3.0
8devices/carambola2-new-packages
net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/member.lua
111
1535
-- ------ member configuration ------ -- ds = require "luci.dispatcher" m5 = Map("mwan3", translate("MWAN Member Configuration")) m5:append(Template("mwan/config_css")) mwan_member = m5:section(TypedSection, "member", translate("Members"), translate("Members are profiles attaching a metric and weight to an MWAN interface<br />" .. "Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" .. "Members may not share the same name as configured interfaces, policies or rules")) mwan_member.addremove = true mwan_member.dynamic = false mwan_member.sectionhead = "Member" mwan_member.sortable = true mwan_member.template = "cbi/tblsection" mwan_member.extedit = ds.build_url("admin", "network", "mwan", "configuration", "member", "%s") function mwan_member.create(self, section) TypedSection.create(self, section) m5.uci:save("mwan3") luci.http.redirect(ds.build_url("admin", "network", "mwan", "configuration", "member", section)) end interface = mwan_member:option(DummyValue, "interface", translate("Interface")) interface.rawhtml = true function interface.cfgvalue(self, s) return self.map:get(s, "interface") or "&#8212;" end metric = mwan_member:option(DummyValue, "metric", translate("Metric")) metric.rawhtml = true function metric.cfgvalue(self, s) return self.map:get(s, "metric") or "1" end weight = mwan_member:option(DummyValue, "weight", translate("Weight")) weight.rawhtml = true function weight.cfgvalue(self, s) return self.map:get(s, "weight") or "1" end return m5
gpl-2.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Code/NplMicrobit/NplMicrobitDef/NplMicrobitDef_Operators.lua
1
9721
--[[ Title: NplMicrobitDef_Operators Author(s): leio Date: 2019/11/29 Desc: use the lib: ------------------------------------------------------- NPL.load("(gl)script/apps/Aries/Creator/Game/Code/NplMicrobit/NplMicrobitDef/NplMicrobitDef_Operators.lua"); ------------------------------------------------------- ]] NPL.export({ { type = "math_op", message0 = L"%1 %2 %3", arg0 = { { name = "left", type = "input_value", shadow = { type = "math_number", }, }, { name = "op", type = "field_dropdown", options = { { "+", "+" },{ "-", "-" },{ "*", "*" },{ "/", "/" },{ "^", "^" }, }, }, { name = "right", type = "input_value", shadow = { type = "math_number", }, }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, func_description = '((%s) %s (%s))', ToPython = function(self) local op = self:getFieldAsString('op') if op == '^' then op = '**' end return string.format('(%s) %s (%s)', self:getFieldAsString('left'), op, self:getFieldAsString('right')); end, ToNPL = function(self) return string.format('(%s) %s (%s)', self:getFieldAsString('left'), self:getFieldAsString('op'), self:getFieldAsString('right')); end, examples = {{desc = L"数字的加减乘除", canRun = true, code = [[ say("1+1=?") wait(1) say(1+1) ]]}}, }, { type = "math_op_compare_number", message0 = L"%1 %2 %3", arg0 = { { name = "left", type = "input_value", shadow = { type = "math_number", }, }, { name = "op", type = "field_dropdown", options = { { ">", ">" },{ "<", "<" },{ ">=", ">=" },{ "<=", "<=" },{ "==", "==" },{ "~=", "~=" }, }, }, { name = "right", type = "input_value", shadow = { type = "math_number", }, }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, func_description = '((%s) %s (%s))', ToPython = function(self) local op = self:getFieldAsString('op') if op == '~=' then op = '!=' end return string.format('(%s) %s (%s)', self:getFieldAsString('left'), op, self:getFieldAsString('right')); end, ToNPL = function(self) return string.format('(%s) %s (%s)', self:getFieldAsString('left'), self:getFieldAsString('op'), self:getFieldAsString('right')); end, examples = {{desc = "", canRun = true, code = [[ if(3>1) then say("3>1 == true") end ]]}}, }, { type = "math_op_compare", message0 = L"%1 %2 %3", arg0 = { { name = "left", type = "input_value", --shadow = { type = "text", value = "",}, shadow = { type = "functionParams", value = "1",}, }, { name = "op", type = "field_dropdown", options = { { "==", "==" },{ "~=", "~=" }, }, }, { name = "right", type = "input_value", -- shadow = { type = "text", value = "",}, shadow = { type = "functionParams", value = "1",}, }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, func_description = '((%s) %s (%s))', ToPython = function(self) local op = self:getFieldAsString('op') if op == '~=' then op = '!=' end return string.format('(%s) %s (%s)', self:getFieldAsString('left'), op, self:getFieldAsString('right')); end, ToNPL = function(self) return string.format('(%s) %s (%s)', self:getFieldAsString('left'), self:getFieldAsString('op'), self:getFieldAsString('right')); end, examples = {{desc = "", canRun = true, code = [[ if("1" == "1") then say("equal") end ]]}}, }, { type = "random", message0 = L"随机选择从%1到%2", arg0 = { { name = "from", type = "input_value", shadow = { type = "math_number", value = 1,}, text = "1", }, { name = "to", type = "input_value", shadow = { type = "math_number", value = 10,}, text = "10", }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, funcName = "random", func_description = 'math.random(%s,%s)', ToNPL = function(self) return string.format('math.random(%s,%s)', self:getFieldAsString('from'), self:getFieldAsString('to')); end, examples = {{desc = "", canRun = true, code = [[ while(true) do say(math.random(1,100)) wait(0.5) end ]]}}, }, { type = "math_compared", message0 = L"%1 %2 %3", arg0 = { { name = "left", type = "input_value", }, { name = "op", type = "field_dropdown", options = { { L"并且", "and" },{ L"或", "or" }, }, }, { name = "right", type = "input_value", }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, func_description = '((%s) %s (%s))', ToNPL = function(self) return string.format('(%s) %s (%s)', self:getFieldAsString('left'), self:getFieldAsString('op'),self:getFieldAsString('right')); end, examples = {{desc = L"同时满足条件", canRun = true, code = [[ while(true) do a = math.random(0,10) if(3<a and a<=6) then say("3<"..a.."<=6") else say(a) end wait(2) end ]]}}, }, { type = "not", message0 = L"不满足%1", arg0 = { { name = "left", type = "input_value", }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, funcName = "not", func_description = '(not %s)', ToNPL = function(self) return string.format('(not %s)', self:getFieldAsString('left')); end, examples = {{desc = L"是否不为真", canRun = true, code = [[ while(true) do a = math.random(0,10) if((not (3<=a)) or (not (a>6))) then say("3<"..a.."<=6") else say(a) end wait(2) end ]]}}, }, { type = "join", message0 = L"连接%1和%2", arg0 = { { name = "left", type = "input_value", shadow = { type = "text", value = "hello",}, text = "hello", }, { name = "right", type = "input_value", shadow = { type = "text", value = "world",}, text = "world", }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, func_description = '(%s..%s)', ToPython = function(self) return string.format('("%s" + "%s")', self:getFieldAsString('left'), self:getFieldAsString('right')); end, ToNPL = function(self) return string.format('("%s".."%s")', self:getFieldAsString('left'), self:getFieldAsString('right')); end, examples = {{desc = "", canRun = true, code = [[ say("hello ".."world".."!!!") ]]}}, }, { type = "lengthOf", message0 = L"字符串%1的长度", arg0 = { { name = "left", type = "input_value", shadow = { type = "text", value = "hello",}, text = "hello", }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, func_description = '(#%s)', ToPython = function(self) return string.format('len("%s")', self:getFieldAsString('left')); end, ToNPL = function(self) return string.format('(#"%s")', self:getFieldAsString('left')); end, examples = {{desc = "", canRun = true, code = [[ say("length of hello is "..(#"hello")); ]]}}, }, { type = "mod", message0 = L"%1除以%2的余数", arg0 = { { name = "left", type = "input_value", shadow = { type = "math_number", value = 66,}, text = "66", }, { name = "right", type = "input_value", shadow = { type = "math_number", value = 10,}, text = "10", }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, func_description = '(%s%%s)', ToNPL = function(self) return string.format('(%s%%%s)', self:getFieldAsString('left'), self:getFieldAsString('right')); end, examples = {{desc = "", canRun = true, code = [[ say("66%10=="..(66%10)) ]]}}, }, { type = "round", message0 = L"四舍五入取整%1", arg0 = { { name = "left", type = "input_value", shadow = { type = "math_number", value = 5.5,}, text = 5.5, }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, funcName = "floor", func_description = 'math.floor(%s+0.5)', ToPython = function(self) return string.format('round(%s)', self:getFieldAsString('left')); end, ToNPL = function(self) return string.format('math.floor(%s+0.5)', self:getFieldAsString('left')); end, examples = {{desc = "", canRun = true, code = [[ while(true) do a = math.random(0,10) / 10 b = math.floor(a+0.5) say(a.."=>"..b) wait(2) end ]]}}, }, { type = "math_oneop", message0 = L"%1%2", arg0 = { { name = "name", type = "field_dropdown", options = { { L"开根号", "sqrt" }, { "sin", "sin"}, { "cos", "cos"}, { L"绝对值", "abs"}, { "asin", "asin"}, { "acos", "acos"}, { L"向上取整", "ceil"}, { L"向下取整", "floor"}, { "tab", "tan"}, { "atan", "atan"}, { "sin", "exp"}, { "log10", "log10"}, { "exp", "exp"}, { L"转成数字", "tonumber"}, { L"转成字符串", "tostring"}, }, }, { name = "left", type = "input_value", shadow = { type = "math_number", value = 9,}, text = 9, }, }, output = {type = "field_number",}, category = "NplMicrobit.Operators", helpUrl = "", canRun = false, func_description = 'math.%s(%s)', ToNPL = function(self) return string.format('math.%s(%s)', self:getFieldAsString('name'), self:getFieldAsString('left')); end, examples = {{desc = "", canRun = true, code = [[ say("math.sqrt(9)=="..math.sqrt(9), 1) say("math.cos(1)=="..math.cos(1), 1) say("math.abs(-1)=="..math.abs(1), 1) ]]}}, }, })
gpl-2.0
tarantool/luarocks
src/luarocks/cmd/make.lua
1
5211
--- Module implementing the LuaRocks "make" command. -- Builds sources in the current directory, but unlike "build", -- it does not fetch sources, etc., assuming everything is -- available in the current directory. local make = {} local build = require("luarocks.build") local fs = require("luarocks.fs") local util = require("luarocks.util") local cfg = require("luarocks.core.cfg") local fetch = require("luarocks.fetch") local pack = require("luarocks.pack") local remove = require("luarocks.remove") local deps = require("luarocks.deps") local writer = require("luarocks.manif.writer") local cmd = require("luarocks.cmd") make.help_summary = "Compile package in current directory using a rockspec." make.help_arguments = "[--pack-binary-rock] [<rockspec>]" make.help = [[ Builds sources in the current directory, but unlike "build", it does not fetch sources, etc., assuming everything is available in the current directory. If no argument is given, it looks for a rockspec in the current directory and in "rockspec/" and "rockspecs/" subdirectories, picking the rockspec with newest version or without version name. If rockspecs for different rocks are found or there are several rockspecs without version, you must specify which to use, through the command-line. This command is useful as a tool for debugging rockspecs. To install rocks, you'll normally want to use the "install" and "build" commands. See the help on those for details. NB: Use `luarocks install` with the `--only-deps` flag if you want to install only dependencies of the rockspec (see `luarocks help install`). --pack-binary-rock Do not install rock. Instead, produce a .rock file with the contents of compilation in the current directory. --keep Do not remove previously installed versions of the rock after installing a new one. This behavior can be made permanent by setting keep_other_versions=true in the configuration file. --branch=<name> Override the `source.branch` field in the loaded rockspec. Allows to specify a different branch to fetch. Particularly for "dev" rocks. --verify Verify signature of the rockspec or src.rock being built. If the rockspec or src.rock is being downloaded, LuaRocks will attempt to download the signature as well. Otherwise, the signature file should be already available locally in the same directory. You need the signer’s public key in your local keyring for this option to work properly. --sign To be used with --pack-binary-rock. Also produce a signature file for the generated .rock file. --chdir=<path> Specify a source directory of the rock. ]] --- Driver function for "make" command. -- @param name string: A local rockspec. -- @return boolean or (nil, string, exitcode): True if build was successful; nil and an -- error message otherwise. exitcode is optionally returned. function make.command(flags, rockspec_filename) assert(type(rockspec_filename) == "string" or not rockspec_filename) if flags["chdir"] then local ok, err = fs.change_dir(flags["chdir"]) if not ok then return nil, err end end if not rockspec_filename then local err rockspec_filename, err = util.get_default_rockspec() if not rockspec_filename then return nil, err end end if not rockspec_filename:match("rockspec$") then return nil, "Invalid argument: 'make' takes a rockspec as a parameter. "..util.see_help("make") end local rockspec, err, errcode = fetch.load_rockspec(rockspec_filename) if not rockspec then return nil, err end local name = util.adjust_name_and_namespace(rockspec.name, flags) local opts = build.opts({ need_to_fetch = false, minimal_mode = true, deps_mode = deps.get_deps_mode(flags), build_only_deps = false, namespace = flags["namespace"], branch = not not flags["branch"], verify = not not flags["verify"], }) if flags["sign"] and not flags["pack-binary-rock"] then return nil, "In the make command, --sign is meant to be used only with --pack-binary-rock" end if flags["pack-binary-rock"] then return pack.pack_binary_rock(name, rockspec.version, flags["sign"], function() return build.build_rockspec(rockspec, opts) end) else local ok, err = fs.check_command_permissions(flags) if not ok then return nil, err, cmd.errorcodes.PERMISSIONDENIED end ok, err = build.build_rockspec(rockspec, opts) if not ok then return nil, err end local name, version = ok, err if (not flags["keep"]) and not cfg.keep_other_versions then local ok, err = remove.remove_other_versions(name, version, flags["force"], flags["force-fast"]) if not ok then util.printerr(err) end end writer.check_dependencies(nil, deps.get_deps_mode(flags)) return name, version end end return make
mit
RyMarq/Zero-K
LuaUI/Configs/zk_keys.lua
2
5918
return { -- yyyymmdd -- if newer than user's, overwrite ALL zir zk_keys -- else just add any that are missing from local config ["date"] = 20130630, -- all default ZK keybinds. ["keybinds"] = { { "togglecammode", "Ctrl+backspace",}, { "togglecammode", "Shift+backspace",}, { "edit_backspace", "Any+backspace",}, { "toggleoverview", "Ctrl+tab",}, { "edit_complete", "Any+tab",}, { "chatally", {"Alt+enter", "Alt+numpad_enter"}, }, { "chatswitchally", {"Alt+enter", "Alt+numpad_enter"}, }, { "chatall", {"Ctrl+enter", "Ctrl+numpad_enter"}, }, { "chatswitchall", {"Ctrl+enter", "Ctrl+numpad_enter"}, }, { "chatspec", "None"}, { "chatswitchspec", "None"}, { "chat", {"Any+enter", "Any+numpad_enter"}, }, { "edit_return", {"Any+enter", "Any+numpad_enter"}, }, { "pause", "pause",}, { "crudemenu", "esc",}, { "exitwindow", "shift+esc",}, { "quitforce", "Ctrl+Shift+esc",}, { "edit_escape", "Any+escape",}, { "speedup", { "Any++","Any+=","Any+numpad+"}, }, { "prevmenu", ",",}, { "decguiopacity", "Shift+,",}, { "slowdown", {"Any+-","Any+numpad-",}, }, { "nextmenu", ".",}, { "incguiopacity", "Shift+.",}, { "specteam 9", "0",}, { "specteam 19", "Ctrl+0",}, { "group0", "Any+0",}, { "specteam 0", "1",}, { "specteam 10", "Ctrl+1",}, { "group1", "Any+1",}, { "specteam 1", "2",}, { "specteam 11", "Ctrl+2",}, { "group2", "Any+2",}, { "specteam 2", "3",}, { "specteam 12", "Ctrl+3",}, { "group3", "Any+3",}, { "specteam 3", "4",}, { "specteam 13", "Ctrl+4",}, { "group4", "Any+4",}, { "specteam 4", "5",}, { "specteam 14", "Ctrl+5",}, { "group5", "Any+5",}, { "specteam 5", "6",}, { "specteam 15", "Ctrl+6",}, { "group6", "Any+6",}, { "specteam 6", "7",}, { "specteam 16", "Ctrl+7",}, { "group7", "Any+7",}, { "specteam 7", "8",}, { "specteam 17", "Ctrl+8",}, { "group8", "Any+8",}, { "specteam 8", "9",}, { "specteam 18", "Ctrl+9",}, { "group9", "Any+9",}, { "buildfacing inc", {"Any+insert", "[", "Shift+[",}, }, { "drawinmap", { "Any+\\", "Any+`", "Any+0xa7", "Any+^", }, }, { "clearmapmarks", "Alt+`"}, { "buildfacing dec", {"Any+delete", "]","Shift+]",}, }, { "attack", "f",}, { "areaattack", "Alt+a",}, { "debug", "Ctrl+Alt+n",}, { "debugcolvol", "Ctrl+Alt+b",}, { "repeat", "ctrl+r"}, { "priority", "ctrl+q"}, { "selfd", "C+d",}, { "selectcomm", "ctrl+c",}, { "manualfire", "d",}, { "oneclickwep", "d",}, { "placebeacon", "d",}, { "selectmissiles", "Any+d"}, { "reclaim", "e",}, { "fight", "a",}, { "forcestart", "Alt+f",}, --{ "guard", "g",}, { "areaguard", "g",}, { "gameinfo", "Ctrl+Alt+i",}, { "wantcloak", "k",}, { "togglelos", "Ctrl+l",}, { "loadunits", "l",}, { "loadselected", "l",}, { "rawmove", "m",}, { "singlestep", "Alt+o",}, { "patrol", "p",}, { "groupclear", "Shift+q",}, { "repair", "r",}, { "stop", "s",}, { "stopproduction", "ctrl+s",}, { "globalbuildcancel", "alt+s",}, { "unloadunits", "u",}, { "pastetext", "Ctrl+v",}, { "wait", "ctrl+w",}, { "areamex", "w",}, { "wantonoff", "o",}, { "pushpull", "o",}, { "buildspacing dec", "Any+x",}, { "buildspacing inc", "Any+z",}, { "edit_delete", "Any+delete",}, { "edit_prev_line", "Any+up",}, { "moveforward", "Any+up",}, { "edit_next_line", "Any+down",}, { "moveback", "Any+down",}, { "edit_end", "Alt+right",}, { "edit_next_word", "Ctrl+right",}, { "edit_next_char", "Any+right",}, { "moveright", "Any+right",}, { "edit_home", "Alt+left",}, { "edit_prev_word", "Ctrl+left",}, { "edit_prev_char", "Any+left",}, { "moveleft", "Any+left",}, { "increaseviewradius", "home",}, { "edit_home", "Any+home",}, { "decreaseviewradius", "end",}, { "edit_end", "Any+end",}, { "moveup", "Any+pageup",}, { "movedown", "Any+pagedown",}, { "showelevation", "f1",}, { "togglestatsgraph", "A+f1"}, { "showpathtraversability", "f2",}, { "lastmsgpos", "f3",}, { "showeco", "f4",}, { "showmetalmap", "None"}, { "HideInterface", "None",}, { "hideinterfaceandcursor", "ctrl+f5",}, { "NoSound", "Any+f6",}, { "DynamicSky", "Any+f7",}, { "savegame", "Ctrl+Shift+f8",}, { "luaui showhealthbars", "alt+f9",}, { "showhealthbars", "alt+f9",}, { "createvideo", "Ctrl+Shift+f10",}, { "viewlobby", "f11",}, { "luaui tweakgui", "C+f11",}, { "movefast", "None"}, { "moveslow", "None"}, { "epic_chili_widget_selector_widgetlist_2", "alt+f11",}, { "screenshot png", "f12",}, { "screenshot jpg", "ctrl+f12"}, { "settargetcircle", "t",}, { "resurrect", "t",}, { "jump", "j",}, { "select AllMap++_ClearSelection_SelectAll+", "ctrl+a",}, { "selectidlecon_all", "ctrl+b",}, { "select PrevSelection+_Not_RelativeHealth_30+_ClearSelection_SelectAll+", "ctrl+e",}, { "select AllMap+_Not_Builder_Not_Building+_ClearSelection_SelectAll+", "ctrl+f",}, { "select AllMap+_NameContain_Raptor+_ClearSelection_SelectAll+", "ctrl+g",}, { "select PrevSelection+_Idle+_ClearSelection_SelectAll+", "ctrl+i",}, { "select AllMap+_Not_Builder_Not_Building_Not_Transport_Aircraft_Radar+_ClearSelection_SelectAll+", "ctrl+s",}, { "select AllMap+_Not_Builder_Not_Building_Transport_Aircraft+_ClearSelection_SelectAll+", "ctrl+t",}, { "selectidlecon", "z",}, { "select Visible+_InPrevSel+_ClearSelection_SelectAll+", "ctrl+x",}, { "select AllMap+_InPrevSel+_ClearSelection_SelectAll+", "ctrl+z",}, { "epic_chili_integral_menu_tab_economy", "any+x",}, { "epic_chili_integral_menu_tab_defence", "any+c",}, { "epic_chili_integral_menu_tab_special", "any+v",}, { "epic_chili_integral_menu_tab_factory", "any+b",}, { "epic_chili_integral_menu_tab_units", "any+n",}, { "exitwindow", "s+escape",}, { "crudesubmenu", "f10"}, { "epic_chili_pro_console_enableconsole", "f8"}, { "epic_chili_share_menu_v1.22_sharemenu", "tab"}, }, }
gpl-2.0
soheil22222222/mm
plugins/msg_checks.lua
2
11174
--Begin msg_checks.lua --Begin pre_process function local function pre_process(msg) -- Begin 'RondoMsgChecks' text checks by @rondoozle if is_chat_msg(msg) or is_super_group(msg) then if msg and not is_momod(msg) and not is_whitelisted(msg.from.id) then --if regular user local data = load_data(_config.moderation.data) local print_name = user_print_name(msg.from):gsub("‮", "") -- get rid of rtl in names local name_log = print_name:gsub("_", " ") -- name for log local to_chat = msg.to.type == 'chat' if data[tostring(msg.to.id)] and data[tostring(msg.to.id)]['settings'] then settings = data[tostring(msg.to.id)]['settings'] else return end if settings.lock_arabic then lock_arabic = settings.lock_arabic else lock_arabic = 'no' end if settings.lock_rtl then lock_rtl = settings.lock_rtl else lock_rtl = 'no' end if settings.lock_tgservice then lock_tgservice = settings.lock_tgservice else lock_tgservice = 'no' end if settings.lock_link then lock_link = settings.lock_link else lock_link = 'no' end if settings.lock_member then lock_member = settings.lock_member else lock_member = 'no' end if settings.lock_spam then lock_spam = settings.lock_spam else lock_spam = 'no' end if settings.lock_sticker then lock_sticker = settings.lock_sticker else lock_sticker = 'no' end if settings.lock_contacts then lock_contacts = settings.lock_contacts else lock_contacts = 'no' end if settings.strict then strict = settings.strict else strict = 'no' end if msg and not msg.service and is_muted(msg.to.id, 'All: yes') or is_muted_user(msg.to.id, msg.from.id) and not msg.service then delete_msg(msg.id, ok_cb, false) if to_chat then -- kick_user(msg.from.id, msg.to.id) end end if msg.text then -- msg.text checks local _nl, ctrl_chars = string.gsub(msg.text, '%c', '') local _nl, real_digits = string.gsub(msg.text, '%d', '') if lock_spam == "yes" and string.len(msg.text) > 2049 or ctrl_chars > 40 or real_digits > 2000 then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then delete_msg(msg.id, ok_cb, false) kick_user(msg.from.id, msg.to.id) end end local is_link_msg = msg.text:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/") or msg.text:match("[Tt][Ll][Gg][Rr][Mm].[Mm][Ee]/") local is_bot = msg.text:match("?[Ss][Tt][Aa][Rr][Tt]=") if is_link_msg and lock_link == "yes" and not is_bot then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end if msg.service then if lock_tgservice == "yes" then delete_msg(msg.id, ok_cb, false) if to_chat then return end end end local is_squig_msg = msg.text:match("[\216-\219][\128-\191]") if is_squig_msg and lock_arabic == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end local print_name = msg.from.print_name local is_rtl = print_name:match("‮") or msg.text:match("‮") if is_rtl and lock_rtl == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end if is_muted(msg.to.id, "Text: yes") and msg.text and not msg.media and not msg.service then delete_msg(msg.id, ok_cb, false) if to_chat then kick_user(msg.from.id, msg.to.id) end end end if msg.media then -- msg.media checks if msg.media.title then local is_link_title = msg.media.title:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/") or msg.media.title:match("[Tt][Ll][Gg][Rr][Mm].[Mm][Ee]/") if is_link_title and lock_link == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end local is_squig_title = msg.media.title:match("[\216-\219][\128-\191]") if is_squig_title and lock_arabic == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end end if msg.media.description then local is_link_desc = msg.media.description:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/") or msg.media.description:match("[Tt][Ll][Gg][Rr][Mm].[Mm][Ee]/") if is_link_desc and lock_link == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end local is_squig_desc = msg.media.description:match("[\216-\219][\128-\191]") if is_squig_desc and lock_arabic == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end end if msg.media.caption then -- msg.media.caption checks local is_link_caption = msg.media.caption:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/") or msg.media.caption:match("[Tt][Ll][Gg][Rr][Mm].[Mm][Ee]/") if is_link_caption and lock_link == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end local is_squig_caption = msg.media.caption:match("[\216-\219][\128-\191]") if is_squig_caption and lock_arabic == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end local is_username_caption = msg.media.caption:match("^@[%a%d]") if is_username_caption and lock_link == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end if lock_sticker == "yes" and msg.media.caption:match("sticker.webp") then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end end if msg.media.type:match("contact") and lock_contacts == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end local is_photo_caption = msg.media.caption and msg.media.caption:match("photo")--".jpg", if is_muted(msg.to.id, 'Photo: yes') and msg.media.type:match("photo") or is_photo_caption and not msg.service then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then -- kick_user(msg.from.id, msg.to.id) end end local is_gif_caption = msg.media.caption and msg.media.caption:match(".mp4") if is_muted(msg.to.id, 'Gifs: yes') and is_gif_caption and msg.media.type:match("document") and not msg.service then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then -- kick_user(msg.from.id, msg.to.id) end end if is_muted(msg.to.id, 'Audio: yes') and msg.media.type:match("audio") and not msg.service then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end local is_video_caption = msg.media.caption and msg.media.caption:lower(".mp4","video") if is_muted(msg.to.id, 'Video: yes') and msg.media.type:match("video") and not msg.service then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end if is_muted(msg.to.id, 'Documents: yes') and msg.media.type:match("document") and not msg.service then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end end if msg.fwd_from then if msg.fwd_from.title then local is_link_title = msg.fwd_from.title:match("[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/") or msg.fwd_from.title:match("[Tt][Ll][Gg][Rr][Mm].[Mm][Ee]/") if is_link_title and lock_link == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end local is_squig_title = msg.fwd_from.title:match("[\216-\219][\128-\191]") if is_squig_title and lock_arabic == "yes" then delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then kick_user(msg.from.id, msg.to.id) end end end if is_muted_user(msg.to.id, msg.fwd_from.peer_id) then delete_msg(msg.id, ok_cb, false) end end if msg.service then -- msg.service checks local action = msg.action.type if action == 'chat_add_user_link' then local user_id = msg.from.id local _nl, ctrl_chars = string.gsub(msg.text, '%c', '') if string.len(msg.from.print_name) > 70 or ctrl_chars > 40 and lock_group_spam == 'yes' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] joined and Service Msg deleted (#spam name)") delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then savelog(msg.to.id, name_log.." ["..msg.from.id.."] joined and kicked (#spam name)") kick_user(msg.from.id, msg.to.id) end end local print_name = msg.from.print_name local is_rtl_name = print_name:match("‮") if is_rtl_name and lock_rtl == "yes" then savelog(msg.to.id, name_log.." User ["..msg.from.id.."] joined and kicked (#RTL char in name)") kick_user(user_id, msg.to.id) end if lock_member == 'yes' then savelog(msg.to.id, name_log.." User ["..msg.from.id.."] joined and kicked (#lockmember)") kick_user(user_id, msg.to.id) delete_msg(msg.id, ok_cb, false) end end if action == 'chat_add_user' and not is_momod2(msg.from.id, msg.to.id) then local user_id = msg.action.user.id if string.len(msg.action.user.print_name) > 70 and lock_group_spam == 'yes' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] added ["..user_id.."]: Service Msg deleted (#spam name)") delete_msg(msg.id, ok_cb, false) if strict == "yes" or to_chat then savelog(msg.to.id, name_log.." ["..msg.from.id.."] added ["..user_id.."]: added user kicked (#spam name) ") delete_msg(msg.id, ok_cb, false) kick_user(msg.from.id, msg.to.id) end end local print_name = msg.action.user.print_name local is_rtl_name = print_name:match("‮") if is_rtl_name and lock_rtl == "yes" then savelog(msg.to.id, name_log.." User ["..msg.from.id.."] added ["..user_id.."]: added user kicked (#RTL char in name)") kick_user(user_id, msg.to.id) end if msg.to.type == 'channel' and lock_member == 'yes' then savelog(msg.to.id, name_log.." User ["..msg.from.id.."] added ["..user_id.."]: added user kicked (#lockmember)") kick_user(user_id, msg.to.id) delete_msg(msg.id, ok_cb, false) end end end end end -- End 'RondoMsgChecks' text checks return msg end --End pre_process function return { patterns = {}, pre_process = pre_process } --End msg_checks.lua
gpl-2.0
purebn/ShadowBot
plugins/Google.lua
46
1048
local function googlethat(query) local api = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&" local parameters = "q=".. (URL.escape(query) or "") -- Do the request local res, code = https.request(api..parameters) if code ~=200 then return nil end local data = json:decode(res) local results = {} for key,result in ipairs(data.responseData.results) do table.insert(results, { result.titleNoFormatting, result.unescapedUrl or result.url }) end return results end local function stringlinks(results) local stringresults="Search in Google:\n______________________________\n" for key,val in ipairs(results) do stringresults=stringresults..val[1].." - "..val[2].."\n" end return stringresults end local function run(msg, matches) local results = googlethat(matches[1]) return stringlinks(results) end return { description = "Searche in Google", usage = "/src (item) : google search", patterns = { "^[!/]src (.*)$", "^%.[s|S]rc (.*)$" }, run = run }
gpl-2.0
gleachkr/luakit
lib/lousy/widget/common.lua
4
1167
--- Common functions for implementing widgets. -- -- @module lousy.widget.common -- @copyright 2017 Aidan Holm <aidanholm@gmail.com> local window = require("window") local lousy = require("lousy") local _M = {} --- Add `widget` to `widgets`, and automatically remove it when `widget` is -- destroyed. -- @tparam table widgets A table of widgets -- @tparam widget widget A newly-created widget -- @return Returns `widget`, to allow easy chaining. _M.add_widget = function (widgets, widget) assert(type(widgets) == "table") table.insert(widgets, widget) widget:add_signal("destroy", function (wi) table.remove(widgets, lousy.util.table.hasitem(widgets, wi)) end) return widget end --- Update all widgets in `widgets` on the given window. -- @tparam table widgets A table of widgets -- @tparam table w A window table _M.update_widgets_on_w = function (widgets, w, ...) assert(type(widgets) == "table") assert(w.win.type == "window") for _, widget in ipairs(widgets) do if window.ancestor(widget) == w then widgets.update(w, widget, ...) end end end return _M -- vim: et:sw=4:ts=8:sts=4:tw=80
gpl-3.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Entity/EntitySnowEffect.lua
1
2442
--[[ Title: Snow Drop Effect Author(s): LiPeng, LiXizhi Date: 2014/5/12 Desc: use the lib: ------------------------------------------------------------ NPL.load("(gl)script/apps/Aries/Creator/Game/Entity/EntitySnowEffect.lua"); local EntitySnowEffect = commonlib.gettable("MyCompany.Aries.Game.EntityManager.EntitySnowEffect") local entity = EntitySnowEffect:new({x,y,z}); EntityManager.AddObject(entity) ------------------------------------------------------- ]] local WeatherEffect = commonlib.gettable("MyCompany.Aries.Game.Effects.WeatherEffect"); local PhysicsWorld = commonlib.gettable("MyCompany.Aries.Game.PhysicsWorld"); local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local TaskManager = commonlib.gettable("MyCompany.Aries.Game.TaskManager") local block_types = commonlib.gettable("MyCompany.Aries.Game.block_types") local GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic") local EntityManager = commonlib.gettable("MyCompany.Aries.Game.EntityManager"); local Materials = commonlib.gettable("MyCompany.Aries.Game.Materials"); local math_abs = math.abs; local Entity = commonlib.inherit(commonlib.gettable("MyCompany.Aries.Game.EntityManager.EntityWeatherEffect"), commonlib.gettable("MyCompany.Aries.Game.EntityManager.EntitySnowEffect")); Entity.class_name = "EntitySnowEffect"; Entity.is_dynamic = true; Entity.miniSceneName = "snow_effect"; Entity.assetfile = "character/CC/05effect/snow/snow.x"; local math_random = math.random; Entity.effect_textures = { "Texture/blocks/snow1.png", "Texture/blocks/snow2.png", "Texture/blocks/snow3.png", "Texture/blocks/snow4.png", } function Entity:ctor() -- echo("111111111: "..tostring(self.entityId)); end function Entity:init(x,y,z) local r = WeatherEffect:GetSpeedRand(); self.isFloating = if_else(r:randomDouble()>0.1,true,false); self.float_speed = (r:randomDouble()-r:randomDouble())*0.5; self.gravity = 9.81*0.03; return Entity._super.init(self, x,y,z); end function Entity:SetEffectTextureByIndex(nIndex) if(nIndex ~= 2) then self.scaling = (self.scaling or 0.1)*0.7; else self.scaling = (self.scaling or 0.1)*1.2; end Entity._super.SetEffectTextureByIndex(self,nIndex); end -- called every frame function Entity:FrameMove(deltaTime) if(self.isFloating) then self.x = self.x + self.float_speed*deltaTime; self.z = self.z + self.float_speed*deltaTime; end Entity._super.FrameMove(self, deltaTime); end
gpl-2.0
BinChengfei/openwrt-3.10.14
package/ramips/ui/luci-mtk/src/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/processes.lua
78
2188
--[[ Luci statistics - processes plugin diagram definition (c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> 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 $Id$ ]]-- module("luci.statistics.rrdtool.definitions.processes", package.seeall) function rrdargs( graph, plugin, plugin_instance, dtype ) return { { title = "%H: Processes", vlabel = "Processes/s", data = { instances = { ps_state = { "sleeping", "running", "paging", "blocked", "stopped", "zombies" } }, options = { ps_state_sleeping = { color = "0000ff" }, ps_state_running = { color = "008000" }, ps_state_paging = { color = "ffff00" }, ps_state_blocked = { color = "ff5000" }, ps_state_stopped = { color = "555555" }, ps_state_zombies = { color = "ff0000" } } } }, { title = "%H: CPU time used by %pi", vlabel = "Jiffies", data = { sources = { ps_cputime = { "syst", "user" } }, options = { ps_cputime__user = { color = "0000ff", overlay = true }, ps_cputime__syst = { color = "ff0000", overlay = true } } } }, { title = "%H: Threads and processes belonging to %pi", vlabel = "Count", detail = true, data = { sources = { ps_count = { "threads", "processes" } }, options = { ps_count__threads = { color = "00ff00" }, ps_count__processes = { color = "0000bb" } } } }, { title = "%H: Page faults in %pi", vlabel = "Pagefaults", detail = true, data = { sources = { ps_pagefaults = { "minflt", "majflt" } }, options = { ps_pagefaults__minflt = { color = "ff0000" }, ps_pagefaults__majflt = { color = "ff5500" } } } }, { title = "%H: Virtual memory size of %pi", vlabel = "Bytes", detail = true, number_format = "%5.1lf%sB", data = { types = { "ps_rss" }, options = { ps_rss = { color = "0000ff" } } } } } end
gpl-2.0
madpilot78/ntopng
scripts/lua/rest/v1/acknowledge/network/alerts.lua
1
1088
-- -- (C) 2013-21 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path package.path = dirs.installdir .. "/scripts/lua/modules/alert_store/?.lua;" .. package.path local alert_utils = require "alert_utils" local alert_consts = require "alert_consts" local alert_entities = require "alert_entities" local rest_utils = require("rest_utils") local network_alert_store = require "network_alert_store".new() -- -- Read alerts data -- Example: curl -u admin:admin -H "Content-Type: application/json" -d '{"ifid": "1"}' http://localhost:3000/lua/rest/v1/acknowledge/network/alerts.lua -- -- NOTE: in case of invalid login, no error is returned but redirected to login -- local rc = rest_utils.consts.success.ok local res = {} local ifid = _GET["ifid"] if isEmptyString(ifid) then rc = rest_utils.consts.err.invalid_interface rest_utils.answer(rc) return end interface.select(ifid) -- Add filters network_alert_store:add_request_filters() network_alert_store:acknowledge(_GET["label"]) rest_utils.answer(rc)
gpl-3.0
h4mu/bstone
com.github.h4mu.bstone/jni/SDL/premake/projects/testshape.lua
4
1153
-- Copyright (C) 1997-2015 Sam Lantinga <slouken@libsdl.org> -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely. -- -- Meta-build system using premake created and maintained by -- Benjamin Henning <b.henning@digipen.edu> --[[ testshape.lua This file defines the testshape test project. It depends on the SDL2main and SDL2 projects. It will not build on iOS or Cygwin. This project has a unique SDL_copy directive, since it copies from a subdirectory and it copies all the files of a specific type. ]] SDL_project "testshape" SDL_kind "ConsoleApp" SDL_notos "ios|cygwin" SDL_language "C" SDL_sourcedir "../test" SDL_projectLocation "tests" -- a list of items to copy from the sourcedir to the destination SDL_copy { "shapes/*.bmp" } SDL_projectDependencies { "SDL2main", "SDL2" } SDL_files { "/testshape.*" }
gpl-2.0
gleachkr/luakit
lib/select.lua
3
4828
--- Select a page element with a visual interface. -- -- This module allows you to change the style of hints used to hint elements for -- selection in `follow` mode, as well as other modes that use the visual hint -- overlay. -- -- # Using a custom character set for hint labels -- -- To customize the characters used in hint labels, you can -- specify a _label maker function_ by assigning a function to the -- @ref{label_maker} property. This label maker function composes -- several _label composer functions_ into a chain, which it returns. -- Then, when a hinting mode (such as @ref{follow} mode) is entered, -- this chain of functions is called to construct the labels. The label -- maker function itself is only called once. -- -- ## Default label maker -- -- To see how this works in practice, let's examine the default label maker -- function. `trim()`, `sort()`, `reverse()`, and `charset()` are all label -- composer functions, and all the label maker function does is chain them -- together and return the result. -- -- select.label_maker = function () -- return trim(sort(reverse(numbers()))) -- end -- -- Conceptually, `numbers()` produces produces an array of numerical hints: -- -- { "01", "02", "03", "04", "05", ... , "10", "11", "12", ... } -- -- Next, `reverse()` reverses each individual hint. This makes typing to -- match hints quicker: by moving the variation in hints from the last -- character to the first character, which is the first character typed -- when matching, we make the first character typed filter many more hints: -- -- { "10", "20", "30", "40", "50", ... , "01", "11", "21", ... } -- -- Next, `sort()` sorts the hints. This step doesn't affect matching speed, but -- makes the hints shown on a page appear more orderly: -- -- { "01", "10", "11", "20", "21", "30", "31", "40", "41", ... } -- -- Last, `trim()` will remove any unnecessary hint suffixes. For -- example, `"01"` is the only hint beginning with `0`; therefore, once -- the user has typed `0`, this is the only matchable hint, and the `1` -- contributes nothing: -- -- { "0", "10", "11", "20", "21", "30", "31", "40", "41", ... } -- -- This is the final list of hint labels that will be used for selection. -- -- # Label composer functions -- -- All label composer functions return a function that takes a single -- argument `n` and produces an array of `n` hints. The nature of the -- hints will vary based on the arguments provided to the composer -- function. For example, the function returned by `charset()` will -- use the provided set of characters to generate its hints, while the -- function returned by `sort()` will first call the label composer -- function passed to `sort()` to obtain a set of hints to sort. -- -- ## Available functions -- -- These label composer functions produce an initial generator function. -- -- - `charset(str)`: Generates hints using the characters in `str`. Non-latin -- characters are supported. -- - `numbers()`: Generates hints using numbers. This is equivalent to -- calling `charset()` with the parameter `"0123456789"`. -- - `interleave(left, right)`: Similar to `charset()`, this generates -- hints that alternate between letters of the `left` and `right` strings. It is -- mostly useful for alternating between letters on the left and right sides of -- one's keyboard, as this makes hints easier to type quickly. -- -- These label composer functions accept a single generator function, and -- return another function. This allows them to be chained. -- -- - `reverse(func)`: Reverses the letters of each hint generated by `func()`. -- - `sort(func)`: Sorts the hints generated by `func()`. -- - `trim(func)`: Trims extra letters off the hints generated by -- `func()`. Specifically, if a prefix of any hint is not a prefix of any other -- hint, then the hint is shortened to that prefix. -- -- @module select -- @copyright 2017 Aidan Holm <aidanholm@gmail.com> local _M = {} local wrapped = { label_maker = nil } --- @property label_maker -- Function that specifies how to generate hint labels. -- -- This function is executed on the web process, with a custom environment that -- provides access to the label composer functions. -- @readwrite -- @type function local wm = require_web_module("select_wm") luakit.add_signal("web-extension-created", function (view) if wrapped.label_maker then wm:emit_signal(view, "set_label_maker", wrapped.label_maker) end end) local mt = { __index = wrapped, __newindex = function (_, k, v) assert(type(v) == "function", "property 'label_maker' must be a function") if k == "label_maker" then wrapped.label_maker = v wm:emit_signal("set_label_maker", v) end end, } return setmetatable(_M, mt) -- vim: et:sw=4:ts=8:sts=4:tw=80
gpl-3.0
pakoito/ToME---t-engine4
game/modules/tome/data/talents/misc/inscriptions.lua
2
45059
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org newInscription = function(t) -- Warning, up that if more than 5 inscriptions are ever allowed for i = 1, 6 do local tt = table.clone(t) tt.short_name = tt.name:upper():gsub("[ ]", "_").."_"..i tt.display_name = function(self, t) local data = self:getInscriptionData(t.short_name) if data.item_name then local n = tstring{t.name, " ["} n:merge(data.item_name) n:add("]") return n else return t.name end end if tt.type[1] == "inscriptions/infusions" then tt.auto_use_check = function(self, t) return not self:hasEffect(self.EFF_INFUSION_COOLDOWN) end elseif tt.type[1] == "inscriptions/runes" then tt.auto_use_check = function(self, t) return not self:hasEffect(self.EFF_RUNE_COOLDOWN) end elseif tt.type[1] == "inscriptions/taints" then tt.auto_use_check = function(self, t) return not self:hasEffect(self.EFF_TAINT_COOLDOWN) end end tt.auto_use_warning = "- will only auto use when no saturation effect exists" tt.cooldown = function(self, t) local data = self:getInscriptionData(t.short_name) return data.cooldown end tt.old_info = tt.info tt.info = function(self, t) local ret = t.old_info(self, t) local data = self:getInscriptionData(t.short_name) if data.use_stat and data.use_stat_mod then ret = ret..("\nIts effects scale with your %s stat."):format(self.stats_def[data.use_stat].name) end return ret end if not tt.image then tt.image = "talents/"..(t.short_name or t.name):lower():gsub("[^a-z0-9_]", "_")..".png" end tt.no_unlearn_last = true tt.is_inscription = true newTalent(tt) end end ----------------------------------------------------------------------- -- Infusions ----------------------------------------------------------------------- newInscription{ name = "Infusion: Regeneration", type = {"inscriptions/infusions", 1}, points = 1, tactical = { HEAL = 2 }, on_pre_use = function(self, t) return not self:hasEffect(self.EFF_REGENERATION) end, action = function(self, t) local data = self:getInscriptionData(t.short_name) self:setEffect(self.EFF_REGENERATION, data.dur, {power=(data.heal + data.inc_stat) / data.dur}) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the infusion to heal yourself for %d life over %d turns.]]):format(data.heal + data.inc_stat, data.dur) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[heal %d over %d turns]]):format(data.heal + data.inc_stat, data.dur) end, } newInscription{ name = "Infusion: Healing", type = {"inscriptions/infusions", 1}, points = 1, tactical = { HEAL = 2 }, is_heal = true, no_energy = true, action = function(self, t) local data = self:getInscriptionData(t.short_name) self:attr("allow_on_heal", 1) self:attr("disable_ancestral_life", 1) self:heal(data.heal + data.inc_stat, t) self:attr("disable_ancestral_life", -1) self:attr("allow_on_heal", -1) self:removeEffectsFilter(function(e) return e.subtype.wound end, 1) self:removeEffectsFilter(function(e) return e.subtype.poison end, 1) if core.shader.active(4) then self:addParticles(Particles.new("shader_shield_temp", 1, {toback=true , size_factor=1.5, y=-0.3, img="healgreen", life=25}, {type="healing", time_factor=2000, beamsCount=20, noup=2.0})) self:addParticles(Particles.new("shader_shield_temp", 1, {toback=false, size_factor=1.5, y=-0.3, img="healgreen", life=25}, {type="healing", time_factor=2000, beamsCount=20, noup=1.0})) end return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the infusion to instantly heal yourself for %d and cleanse 1 wound and poison effect.]]):format(data.heal + data.inc_stat) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[heal %d]]):format(data.heal + data.inc_stat) end, } newInscription{ name = "Infusion: Wild", type = {"inscriptions/infusions", 1}, points = 1, no_energy = true, tactical = { DEFEND = 3, CURE = function(self, t, target) local nb = 0 local data = self:getInscriptionData(t.short_name) for eff_id, p in pairs(self.tmp) do local e = self.tempeffect_def[eff_id] if data.what[e.type] and e.status == "detrimental" then nb = nb + 1 end end return nb end }, action = function(self, t) local data = self:getInscriptionData(t.short_name) local target = self local effs = {} local force = {} local known = false -- Go through all temporary effects for eff_id, p in pairs(target.tmp) do local e = target.tempeffect_def[eff_id] if data.what[e.type] and e.status == "detrimental" and e.subtype["cross tier"] then force[#force+1] = {"effect", eff_id} elseif data.what[e.type] and e.status == "detrimental" then effs[#effs+1] = {"effect", eff_id} end end -- Cross tier effects are always removed and not part of the random game, otherwise it is a huge nerf to wild infusion for i = 1, #force do local eff = force[i] if eff[1] == "effect" then target:removeEffect(eff[2]) known = true end end for i = 1, 1 do if #effs == 0 then break end local eff = rng.tableRemove(effs) if eff[1] == "effect" then target:removeEffect(eff[2]) known = true end end if known then game.logSeen(self, "%s is cured!", self.name:capitalize()) end self:setEffect(self.EFF_PAIN_SUPPRESSION, data.dur, {power=data.power + data.inc_stat}) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) local what = table.concatNice(table.keys(data.what), ", ", " or ") return ([[Activate the infusion to cure yourself of one random %s effect and reduce all damage taken by %d%% for %d turns. Also removes cross-tier effects of the affected types for free.]]):format(what, data.power+data.inc_stat, data.dur) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) local what = table.concat(table.keys(data.what), ", ") return ([[resist %d%%; cure %s]]):format(data.power + data.inc_stat, what) end, } -- fixedart wild variant newInscription{ name = "Infusion: Primal", image = "talents/infusion__wild.png", type = {"inscriptions/infusions", 1}, points = 1, no_energy = true, tactical = { DEFEND = 3, CURE = function(self, t, target) local nb = 0 local data = self:getInscriptionData(t.short_name) for eff_id, p in pairs(self.tmp) do local e = self.tempeffect_def[eff_id] if data.what[e.type] and e.status == "detrimental" then nb = nb + 1 end end return nb end }, action = function(self, t) local data = self:getInscriptionData(t.short_name) local target = self local effs = {} local force = {} local known = false -- Go through all temporary effects for eff_id, p in pairs(target.tmp) do local e = target.tempeffect_def[eff_id] if data.what[e.type] and e.status == "detrimental" and e.subtype["cross tier"] then force[#force+1] = {"effect", eff_id} elseif data.what[e.type] and e.status == "detrimental" then effs[#effs+1] = {"effect", eff_id} end end -- Cross tier effects are always removed and not part of the random game, otherwise it is a huge nerf to wild infusion for i = 1, #force do local eff = force[i] if eff[1] == "effect" then target:removeEffect(eff[2]) known = true end end for i = 1, 1 do if #effs == 0 then break end local eff = rng.tableRemove(effs) if eff[1] == "effect" then target:removeEffect(eff[2]) known = true end end if known then game.logSeen(self, "%s is cured!", self.name:capitalize()) end self:setEffect(self.EFF_PRIMAL_ATTUNEMENT, data.dur, {power=data.power + data.inc_stat}) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) local what = table.concatNice(table.keys(data.what), ", ", " or ") return ([[Activate the infusion to cure yourself of one random %s effect and increase affinity for all damage by %d%% for %d turns. Also removes cross-tier effects of the affected types for free.]]):format(what, data.power+data.inc_stat, data.dur) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) local what = table.concat(table.keys(data.what), ", ") return ([[affinity %d%%; cure %s]]):format(data.power + data.inc_stat, what) end, } newInscription{ name = "Infusion: Movement", type = {"inscriptions/infusions", 1}, points = 1, no_energy = true, tactical = { DEFEND = 1 }, on_pre_use = function(self, t) return not self:attr("never_move") end, action = function(self, t) local data = self:getInscriptionData(t.short_name) self:setEffect(self.EFF_FREE_ACTION, data.dur, {power=1}) game:onTickEnd(function() self:setEffect(self.EFF_WILD_SPEED, 1, {power=data.speed + data.inc_stat}) end) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the infusion to increase movement speed by %d%% for 1 game turn. Any actions other than movement will cancel the effect. Also prevent stuns, dazes and pinning effects for %d turns. Note: since you will be moving very fast, game turns will pass very slowly.]]):format(data.speed + data.inc_stat, data.dur) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[%d%% speed; %d turns]]):format(data.speed + data.inc_stat, data.dur) end, } newInscription{ name = "Infusion: Sun", type = {"inscriptions/infusions", 1}, points = 1, tactical = { ATTACKAREA = 1, DISABLE = { blind = 2 } }, range = 0, radius = function(self, t) local data = self:getInscriptionData(t.short_name) return data.range end, target = function(self, t) return {type="ball", range=self:getTalentRange(t), selffire=false, radius=self:getTalentRadius(t), talent=t} end, action = function(self, t) local data = self:getInscriptionData(t.short_name) local tg = self:getTalentTarget(t) self:project(tg, self.x, self.y, engine.DamageType.BLINDCUSTOMMIND, {power=data.power + data.inc_stat, turns=data.turns}) self:project(tg, self.x, self.y, engine.DamageType.BREAK_STEALTH, {power=(data.power + data.inc_stat)/2, turns=data.turns}) tg.selffire = true self:project(tg, self.x, self.y, engine.DamageType.LITE, data.power >= 19 and 100 or 1) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the infusion to brighten the area in a radius of %d and illuminate stealthy creatures, possibly revealing them (reduces stealth power by %d).%s It will also blind any creatures caught inside (power %d) for %d turns.]]): format(data.range, (data.power + data.inc_stat)/2, data.power >= 19 and "\nThe light is so powerful it will also banish magical darkness" or "", data.power + data.inc_stat, data.turns) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[rad %d; power %d; turns %d%s]]):format(data.range, data.power + data.inc_stat, data.turns, data.power >= 19 and "; dispells darkness" or "") end, } newInscription{ name = "Infusion: Heroism", type = {"inscriptions/infusions", 1}, points = 1, no_energy = true, tactical = { BUFF = 2 }, action = function(self, t) local data = self:getInscriptionData(t.short_name) self:setEffect(self.EFF_HEROISM, data.dur, {power=data.power + data.inc_stat, die_at=data.die_at + data.inc_stat * 30}) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the infusion to increase three of your primary stats by %d for %d turns. While Heroism is active, you will only die when reaching -%d life. However, when below 0 you cannot see how much life you have left. It will always increase your three highest stats. If your life is below 0 when this effect wears off it will be set to 1.]]):format(data.power + data.inc_stat, data.dur, data.die_at + data.inc_stat * 30) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[+%d for %d turns, die at -%d]]):format(data.power + data.inc_stat, data.dur, data.die_at + data.inc_stat * 30) end, } newInscription{ name = "Infusion: Insidious Poison", type = {"inscriptions/infusions", 1}, points = 1, tactical = { ATTACK = { NATURE = 1 }, DISABLE=1, CURE = function(self, t, target) local nb = 0 local data = self:getInscriptionData(t.short_name) for eff_id, p in pairs(self.tmp) do local e = self.tempeffect_def[eff_id] if e.type == "magical" and e.status == "detrimental" then nb = nb + 1 end end return nb end }, requires_target = true, range = function(self, t) local data = self:getInscriptionData(t.short_name) return data.range end, action = function(self, t) local data = self:getInscriptionData(t.short_name) local tg = {type="bolt", range=self:getTalentRange(t), talent=t, display={particle="bolt_slime", trail="slimetrail"}} local x, y = self:getTarget(tg) if not x or not y then return nil end self:projectile(tg, x, y, DamageType.INSIDIOUS_POISON, {dam=data.power + data.inc_stat, dur=7, heal_factor=data.heal_factor}, {type="slime"}) self:removeEffectsFilter({status="detrimental", type="magical", ignore_crosstier=true}, 1) game:playSoundNear(self, "talents/slime") return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the infusion to spit a bolt of poison doing %0.2f nature damage per turn for 7 turns, and reducing the target's healing received by %d%%. The sudden stream of natural forces also strips you of one random detrimental magical effect.]]):format(damDesc(self, DamageType.NATURE, data.power + data.inc_stat) / 7, data.heal_factor) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[%d nature damage, %d%% healing reduction]]):format(damDesc(self, DamageType.NATURE, data.power + data.inc_stat) / 7, data.heal_factor) end, } -- Opportunity cost for this is HUGE, it should not hit friendly, also buffed duration newInscription{ name = "Infusion: Wild Growth", type = {"inscriptions/infusions", 1}, points = 1, tactical = { ATTACKAREA = { PHYSICAL = 1, NATURE = 1 }, DISABLE = 3 }, range = 0, radius = 5, direct_hit = true, target = function(self, t) return {type="ball", range=self:getTalentRange(t), radius=self:getTalentRadius(t), selffire=false, friendlyfire = false, talent=t} end, getDamage = function(self, t) return 10 + self:combatMindpower() * 3.6 end, action = function(self, t) local data = self:getInscriptionData(t.short_name) local dam = t.getDamage(self, t) local tg = self:getTalentTarget(t) self:project(tg, self.x, self.y, function(tx, ty) DamageType:get(DamageType.ENTANGLE).projector(self, tx, ty, DamageType.ENTANGLE, dam) end) self:setEffect(self.EFF_THORNY_SKIN, data.dur, {hard=data.hard or 30, ac=data.armor or 50}) game:playSoundNear(self, "talents/earth") return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) local damage = t.getDamage(self, t) return ([[Causes thick vines to spring from the ground and entangle all targets within %d squares for %d turns, pinning them in place and dealing %0.2f physical damage and %0.2f nature damage. The vines also grow all around you, increasing your armour by %d and armour hardiness by %d.]]): format(self:getTalentRadius(t), data.dur, damDesc(self, DamageType.PHYSICAL, damage)/3, damDesc(self, DamageType.NATURE, 2*damage)/3, data.armor or 50, data.hard or 30) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Rad %d for %d turns]]):format(self:getTalentRadius(t), data.dur) end, } ----------------------------------------------------------------------- -- Runes ----------------------------------------------------------------------- newInscription{ name = "Rune: Phase Door", type = {"inscriptions/runes", 1}, points = 1, is_spell = true, is_teleport = true, tactical = { ESCAPE = 2 }, action = function(self, t) local data = self:getInscriptionData(t.short_name) game.level.map:particleEmitter(self.x, self.y, 1, "teleport") self:teleportRandom(self.x, self.y, data.range + data.inc_stat) game.level.map:particleEmitter(self.x, self.y, 1, "teleport") self:setEffect(self.EFF_OUT_OF_PHASE, data.dur or 3, { defense=(data.power or data.range) + data.inc_stat * 3, resists=(data.power or data.range) + data.inc_stat * 3, effect_reduction=(data.power or data.range) + data.inc_stat * 3, }) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) local power = (data.power or data.range) + data.inc_stat * 3 return ([[Activate the rune to teleport randomly in a range of %d. Afterwards you stay out of phase for %d turns. In this state all new negative status effects duration is reduced by %d%%, your defense is increased by %d and all your resistances by %d%%.]]): format(data.range + data.inc_stat, data.dur or 3, power, power, power) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) local power = (data.power or data.range) + data.inc_stat * 3 return ([[range %d; power %d; dur %d]]):format(data.range + data.inc_stat, power, data.dur or 3) end, } newInscription{ name = "Rune: Controlled Phase Door", type = {"inscriptions/runes", 1}, points = 1, is_spell = true, is_teleport = true, tactical = { CLOSEIN = 2 }, action = function(self, t) local data = self:getInscriptionData(t.short_name) local tg = {type="ball", nolock=true, pass_terrain=true, nowarning=true, range=data.range + data.inc_stat, radius=3, requires_knowledge=false} local x, y = self:getTarget(tg) if not x then return nil end -- Target code does not restrict the target coordinates to the range, it lets the project function do it -- but we cant ... local _ _, x, y = self:canProject(tg, x, y) -- Check LOS local rad = 3 if not self:hasLOS(x, y) and rng.percent(35 + (game.level.map.attrs(self.x, self.y, "control_teleport_fizzle") or 0)) then game.logPlayer(self, "The targetted phase door fizzles and works randomly!") x, y = self.x, self.y rad = tg.range end game.level.map:particleEmitter(self.x, self.y, 1, "teleport") self:teleportRandom(x, y, rad) game.level.map:particleEmitter(self.x, self.y, 1, "teleport") return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the rune to teleport in a range of %d.]]):format(data.range + data.inc_stat) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[range %d]]):format(data.range + data.inc_stat) end, } newInscription{ name = "Rune: Teleportation", type = {"inscriptions/runes", 1}, points = 1, is_spell = true, is_teleport = true, tactical = { ESCAPE = 3 }, action = function(self, t) local data = self:getInscriptionData(t.short_name) game.level.map:particleEmitter(self.x, self.y, 1, "teleport") self:teleportRandom(self.x, self.y, data.range + data.inc_stat, 15) game.level.map:particleEmitter(self.x, self.y, 1, "teleport") return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the rune to teleport randomly in a range of %d with a minimum range of 15.]]):format(data.range + data.inc_stat) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[range %d]]):format(data.range + data.inc_stat) end, } newInscription{ name = "Rune: Shielding", type = {"inscriptions/runes", 1}, points = 1, is_spell = true, allow_autocast = true, no_energy = true, tactical = { DEFEND = 2 }, on_pre_use = function(self, t) return not self:hasEffect(self.EFF_DAMAGE_SHIELD) end, action = function(self, t) local data = self:getInscriptionData(t.short_name) self:setEffect(self.EFF_DAMAGE_SHIELD, data.dur, {power=data.power + data.inc_stat}) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the rune to create a protective shield absorbing at most %d damage for %d turns.]]):format(data.power + data.inc_stat, data.dur) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[absorb %d for %d turns]]):format(data.power + data.inc_stat, data.dur) end, } newInscription{ name = "Rune: Reflection Shield", type = {"inscriptions/runes", 1}, points = 1, is_spell = true, allow_autocast = true, no_energy = true, tactical = { DEFEND = 2 }, on_pre_use = function(self, t) return not self:hasEffect(self.EFF_DAMAGE_SHIELD) end, action = function(self, t) local data = self:getInscriptionData(t.short_name) self:setEffect(self.EFF_DAMAGE_SHIELD, 5, {power=100+5*self:getMag(), reflect=100}) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the rune to create a protective shield absorbing and reflecting at most %d damage for %d turns. The effect will scale with your magic stat.]]):format(100+5*self:getMag(), 5) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[absorb and reflect %d for %d turns]]):format(100+5*self:getMag(), 5) end, } newInscription{ name = "Rune: Invisibility", type = {"inscriptions/runes", 1}, points = 1, is_spell = true, tactical = { DEFEND = 3, ESCAPE = 2 }, action = function(self, t) local data = self:getInscriptionData(t.short_name) self:setEffect(self.EFF_INVISIBILITY, data.dur, {power=data.power + data.inc_stat, penalty=0.4}) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the rune to become invisible (power %d) for %d turns. As you become invisible you fade out of phase with reality, all your damage is reduced by 40%%. ]]):format(data.power + data.inc_stat, data.dur) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[power %d for %d turns]]):format(data.power + data.inc_stat, data.dur) end, } newInscription{ name = "Rune: Speed", type = {"inscriptions/runes", 1}, points = 1, is_spell = true, no_energy = true, tactical = { BUFF = 4 }, action = function(self, t) local data = self:getInscriptionData(t.short_name) self:setEffect(self.EFF_SPEED, data.dur, {power=(data.power + data.inc_stat) / 100}) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the rune to increase your global speed by %d%% for %d turns.]]):format(data.power + data.inc_stat, data.dur) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[speed %d%% for %d turns]]):format(data.power + data.inc_stat, data.dur) end, } newInscription{ name = "Rune: Vision", type = {"inscriptions/runes", 1}, points = 1, is_spell = true, no_npc_use = true, action = function(self, t) local data = self:getInscriptionData(t.short_name) self:magicMap(data.range, self.x, self.y, function(x, y) local g = game.level.map(x, y, Map.TERRAIN) if g and (g.always_remember or g:check("block_move")) then for _, coord in pairs(util.adjacentCoords(x, y)) do local g2 = game.level.map(coord[1], coord[2], Map.TERRAIN) if g2 and not g2:check("block_move") then return true end end end end) self:setEffect(self.EFF_SENSE_HIDDEN, data.dur, {power=data.power + data.inc_stat}) self:setEffect(self.EFF_RECEPTIVE_MIND, data.dur, {what=data.esp or "humanoid"}) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the rune to get a vision of the area surrounding you (%d radius) and to allow you to see invisible and stealthed creatures (power %d) for %d turns. Your mind will become more receptive for %d turns, allowing you to sense any %s around.]]): format(data.range, data.power + data.inc_stat, data.dur, data.dur, data.esp or "humanoid") end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[radius %d; dur %d; see %s]]):format(data.range, data.dur, data.esp or "humanoid") end, } local function attack_rune(self, btid) for tid, lev in pairs(self.talents) do if tid ~= btid and self.talents_def[tid].is_attack_rune and not self.talents_cd[tid] then self.talents_cd[tid] = 1 end end end newInscription{ name = "Rune: Heat Beam", type = {"inscriptions/runes", 1}, points = 1, is_attack_rune = true, no_energy = true, is_spell = true, tactical = { ATTACK = { FIRE = 1 }, CURE = function(self, t, target) local nb = 0 local data = self:getInscriptionData(t.short_name) for eff_id, p in pairs(self.tmp) do local e = self.tempeffect_def[eff_id] if e.type == "physical" and e.status == "detrimental" then nb = nb + 1 end end return nb end }, requires_target = true, direct_hit = true, range = function(self, t) local data = self:getInscriptionData(t.short_name) return data.range end, target = function(self, t) return {type="beam", range=self:getTalentRange(t), talent=t} end, action = function(self, t) local data = self:getInscriptionData(t.short_name) local tg = self:getTalentTarget(t) local x, y = self:getTarget(tg) if not x or not y then return nil end self:project(tg, x, y, DamageType.FIREBURN, {dur=5, initial=0, dam=data.power + data.inc_stat}) local _ _, x, y = self:canProject(tg, x, y) game.level.map:particleEmitter(self.x, self.y, tg.radius, "flamebeam", {tx=x-self.x, ty=y-self.y}) self:removeEffectsFilter({status="detrimental", type="physical", ignore_crosstier=true}, 1) game:playSoundNear(self, "talents/fire") attack_rune(self, t.id) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the rune to fire a beam of heat, doing %0.2f fire damage over 5 turns The intensity of the heat will also remove one random detrimental physical effect from you.]]):format(damDesc(self, DamageType.FIRE, data.power + data.inc_stat)) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[%d fire damage]]):format(damDesc(self, DamageType.FIRE, data.power + data.inc_stat)) end, } newInscription{ name = "Rune: Biting Gale", type = {"inscriptions/runes", 1}, points = 1, is_attack_rune = true, no_energy = true, is_spell = true, tactical = { ATTACK = { COLD = 1 }, DISABLE = { stun = 1 }, CURE = function(self, t, target) local nb = 0 local data = self:getInscriptionData(t.short_name) for eff_id, p in pairs(self.tmp) do local e = self.tempeffect_def[eff_id] if e.type == "mental" and e.status == "detrimental" then nb = nb + 1 end end return nb end }, requires_target = true, range = 0, target = function(self, t) return {type="cone", cone_angle=25, radius = 6, range=self:getTalentRange(t), talent=t, display={particle="bolt_ice", trail="icetrail"}} end, action = function(self, t) local data = self:getInscriptionData(t.short_name) local tg = self:getTalentTarget(t) local x, y = self:getTarget(tg) if not x or not y then return nil end local damage = data.power + data.inc_stat -- Cut by ~2/3rds or so local apply = self:rescaleCombatStats((data.apply + data.inc_stat)) -- local apply = data.apply + data.inc_stat -- Same calculation as Sun Infusion, goes above what PCs can get on power stats pretty easily self:project(tg, x, y, function(tx, ty) local target = game.level.map(tx, ty, Map.ACTOR) if not target or target == self then return end -- Minor damage, apply stun resist reduction, freeze DamageType:get(DamageType.COLD).projector(target, tx, ty, DamageType.COLD, damage) target:setEffect(target.EFF_WET, 5, {apply_power=data.inc_stat}) if target:canBe("stun") then target:setEffect(target.EFF_FROZEN, 2, {hp=damage*1.5, apply_power=apply}) end end, data.power + data.inc_stat, {type="freeze"}) self:removeEffectsFilter({status="detrimental", type="mental", ignore_crosstier=true}, 1) game:playSoundNear(self, "talents/ice") attack_rune(self, t.id) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) local apply = self:rescaleCombatStats((data.apply + data.inc_stat)) return ([[Activate the rune to direct a cone of chilling stormwind doing %0.2f cold damage. The storm will soak enemies hit reducing their resistance to stuns by 50%% then attempt to freeze them for 3 turns with an apply power of %d. The deep cold also crystalizes your mind, removing one random detrimental mental effect from you.]]): format(damDesc(self, DamageType.COLD, data.power + data.inc_stat), apply) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) local apply = self:rescaleCombatStats((data.apply + data.inc_stat)) return ([[%d cold damage; %d apply power]]):format(damDesc(self, DamageType.COLD, data.power + data.inc_stat), apply) end, } newInscription{ name = "Rune: Acid Wave", type = {"inscriptions/runes", 1}, points = 1, is_attack_rune = true, no_energy = true, is_spell = true, tactical = { ATTACKAREA = { ACID = 1 }, CURE = function(self, t, target) local nb = 0 local data = self:getInscriptionData(t.short_name) for eff_id, p in pairs(self.tmp) do local e = self.tempeffect_def[eff_id] if e.type == "magical" and e.status == "detrimental" then nb = nb + 1 end end return nb end }, requires_target = true, direct_hit = true, range = 0, radius = function(self, t) local data = self:getInscriptionData(t.short_name) return data.radius end, target = function(self, t) return {type="cone", radius=self:getTalentRadius(t), range = 0, selffire=false, cone_angle=5, talent=t} end, action = function(self, t) local data = self:getInscriptionData(t.short_name) local tg = self:getTalentTarget(t) local x, y = self:getTarget(tg) if not x or not y then return nil end local apply = self:rescaleCombatStats((data.apply + data.inc_stat)) self:removeEffectsFilter({status="detrimental", type="magical", ignore_crosstier=true}, 1) self:project(tg, x, y, function(tx, ty) local target = game.level.map(tx, ty, Map.ACTOR) if not target or target == self then return end if target:canBe("disarm") then target:setEffect(target.EFF_DISARMED, data.dur, {apply_power=apply}) end DamageType:get(DamageType.ACID).projector(self, tx, ty, DamageType.ACID, data.power + data.inc_stat) end) game.level.map:particleEmitter(self.x, self.y, tg.radius, "breath_acid", {radius=tg.radius, tx=x-self.x, ty=y-self.y}) game:playSoundNear(self, "talents/slime") attack_rune(self, t.id) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) local pow = data.apply + data.inc_stat local apply = self:rescaleCombatStats((data.apply + data.inc_stat)) return ([[Activate the rune to unleash a wave of acid in a cone of radius %d, doing %0.2f acid damage. The corrosive acid will also disarm enemies struck for %d turns with an apply power of %d. The surge of natural acids will remove one detrimental magical effect from you.]]): format(self:getTalentRadius(t), damDesc(self, DamageType.ACID, data.power + data.inc_stat), data.dur or 3, apply) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) local pow = data.power local apply = self:rescaleCombatStats((data.apply + data.inc_stat)) return ([[%d acid damage; dur %d; apply %d]]):format(damDesc(self, DamageType.ACID, data.power + data.inc_stat), data.dur or 3, apply) end, } newInscription{ name = "Rune: Lightning", type = {"inscriptions/runes", 1}, points = 1, is_attack_rune = true, no_energy = true, is_spell = true, tactical = { ATTACK = { LIGHTNING = 1 } }, requires_target = true, direct_hit = true, range = function(self, t) local data = self:getInscriptionData(t.short_name) return data.range end, target = function(self, t) return {type="beam", range=self:getTalentRange(t), talent=t} end, action = function(self, t) local data = self:getInscriptionData(t.short_name) local tg = self:getTalentTarget(t) local x, y = self:getTarget(tg) if not x or not y then return nil end local dam = data.power + data.inc_stat self:project(tg, x, y, DamageType.LIGHTNING, rng.avg(dam / 3, dam, 3)) local _ _, x, y = self:canProject(tg, x, y) game.level.map:particleEmitter(self.x, self.y, math.max(math.abs(x-self.x), math.abs(y-self.y)), "lightning", {tx=x-self.x, ty=y-self.y}) self:setEffect(self.EFF_ELEMENTAL_SURGE_LIGHTNING, 2, {}) game:playSoundNear(self, "talents/lightning") attack_rune(self, t.id) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) local dam = damDesc(self, DamageType.LIGHTNING, data.power + data.inc_stat) return ([[Activate the rune to fire a beam of lightning, doing %0.2f to %0.2f lightning damage. Also transform you into pure lightning for %d turns; any damage will teleport you to an adjacent tile and ignore the damage (can only happen once per turn)]]): format(dam / 3, dam, 2) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[%d lightning damage]]):format(damDesc(self, DamageType.LIGHTNING, data.power + data.inc_stat)) end, } newInscription{ name = "Rune: Manasurge", type = {"inscriptions/runes", 1}, points = 1, is_spell = true, tactical = { MANA = 1 }, on_pre_use = function(self, t) return self:knowTalent(self.T_MANA_POOL) and not self:hasEffect(self.EFF_MANASURGE) end, on_learn = function(self, t) self.mana_regen_on_rest = (self.mana_regen_on_rest or 0) + 0.5 end, on_unlearn = function(self, t) self.mana_regen_on_rest = (self.mana_regen_on_rest or 0) - 0.5 end, action = function(self, t) local data = self:getInscriptionData(t.short_name) self:incMana((data.mana + data.inc_stat) / 20) if self.mana_regen > 0 then self:setEffect(self.EFF_MANASURGE, data.dur, {power=self.mana_regen * (data.mana + data.inc_stat) / 100}) else if self.mana_regen < 0 then game.logPlayer(self, "Your negative mana regeneration rate is unaffected by the rune.") else game.logPlayer(self, "Your nonexistant mana regeneration rate is unaffected by the rune.") end end return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the rune to unleash a manasurge upon yourself, increasing mana regeneration by %d%% over %d turns and instantly restoring %d mana. Also when resting your mana will regenerate at 0.5 per turn.]]):format(data.mana + data.inc_stat, data.dur, (data.mana + data.inc_stat) / 20) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[%d%% regen over %d turns; %d instant mana]]):format(data.mana + data.inc_stat, data.dur, (data.mana + data.inc_stat) / 20) end, } newInscription{ name = "Rune: Frozen Spear", type = {"inscriptions/runes", 1}, points = 1, is_attack_rune = true, no_energy = true, is_spell = true, tactical = { ATTACK = { COLD = 1 }, DISABLE = { stun = 1 }, CURE = function(self, t, target) local nb = 0 local data = self:getInscriptionData(t.short_name) for eff_id, p in pairs(self.tmp) do local e = self.tempeffect_def[eff_id] if e.type == "mental" and e.status == "detrimental" then nb = nb + 1 end end return nb end }, requires_target = true, range = function(self, t) local data = self:getInscriptionData(t.short_name) return data.range end, target = function(self, t) return {type="bolt", range=self:getTalentRange(t), talent=t, display={particle="bolt_ice", trail="icetrail"}} end, action = function(self, t) local data = self:getInscriptionData(t.short_name) local tg = self:getTalentTarget(t) local x, y = self:getTarget(tg) if not x or not y then return nil end self:project(tg, x, y, DamageType.ICE, data.power + data.inc_stat, {type="freeze"}) self:removeEffectsFilter({status="detrimental", type="mental", ignore_crosstier=true}, 1) game:playSoundNear(self, "talents/ice") attack_rune(self, t.id) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the rune to fire a bolt of ice, doing %0.2f cold damage with a chance to freeze the target. The deep cold also crystalizes your mind, removing one random detrimental mental effect from you.]]):format(damDesc(self, DamageType.COLD, data.power + data.inc_stat)) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[%d cold damage]]):format(damDesc(self, DamageType.COLD, data.power + data.inc_stat)) end, } -- This is mostly a copy of Time Skip :P newInscription{ name = "Rune of the Rift", type = {"inscriptions/runes", 1}, points = 1, is_spell = true, tactical = { DISABLE = 2, ATTACK = { TEMPORAL = 1 } }, direct_hit = true, reflectable = true, requires_target = true, range = 4, target = function(self, t) return {type="hit", range=self:getTalentRange(t), talent=t} end, getDamage = function(self, t) return 150 + self:getWil() * 4 end, getDuration = function(self, t) return 4 end, action = function(self, t) local tg = self:getTalentTarget(t) local x, y = self:getTarget(tg) if not x or not y then return nil end local _ _, x, y = self:canProject(tg, x, y) local target = game.level.map(x, y, Map.ACTOR) if not target then return end if target:attr("timetravel_immune") then game.logSeen(target, "%s is immune!", target.name:capitalize()) return end local hit = self:checkHit(self:combatSpellpower(), target:combatSpellResist() + (target:attr("continuum_destabilization") or 0)) if not hit then game.logSeen(target, "%s resists!", target.name:capitalize()) return true end self:project(tg, x, y, DamageType.TEMPORAL, self:spellCrit(t.getDamage(self, t))) game.level.map:particleEmitter(x, y, 1, "temporal_thrust") game:playSoundNear(self, "talents/arcane") if target.dead or target.player then return true end target:setEffect(target.EFF_CONTINUUM_DESTABILIZATION, 100, {power=self:combatSpellpower(0.3)}) -- Replace the target with a temporal instability for a few turns local oe = game.level.map(target.x, target.y, engine.Map.TERRAIN) if not oe or oe:attr("temporary") then return true end local e = mod.class.Object.new{ old_feat = oe, type = oe.type, subtype = oe.subtype, name = "temporal instability", image = oe.image, add_mos = {{image="object/temporal_instability.png"}}, display = '&', color=colors.LIGHT_BLUE, temporary = t.getDuration(self, t), canAct = false, target = target, act = function(self) self:useEnergy() self.temporary = self.temporary - 1 -- return the rifted actor if self.temporary <= 0 then game.level.map(self.target.x, self.target.y, engine.Map.TERRAIN, self.old_feat) game.level:removeEntity(self, true) game.nicer_tiles:updateAround(game.level, self.target.x, self.target.y) local mx, my = util.findFreeGrid(self.target.x, self.target.y, 20, true, {[engine.Map.ACTOR]=true}) local old_levelup = self.target.forceLevelup self.target.forceLevelup = function() end game.zone:addEntity(game.level, self.target, "actor", mx, my) self.target.forceLevelup = old_levelup end end, summoner_gain_exp = true, summoner = self, } game.logSeen(target, "%s has moved forward in time!", target.name:capitalize()) game.level:removeEntity(target, true) game.level:addEntity(e) game.level.map(x, y, Map.TERRAIN, e) game.nicer_tiles:updateAround(game.level, x, y) game.level.map:updateMap(x, y) return true end, info = function(self, t) local damage = t.getDamage(self, t) local duration = t.getDuration(self, t) return ([[Inflicts %0.2f temporal damage. If your target survives, it will be sent %d turns into the future. Note that messing with the spacetime continuum may have unforeseen consequences.]]):format(damDesc(self, DamageType.TEMPORAL, damage), duration) end, short_info = function(self, t) return ("%0.2f temporal damage, removed from time %d turns"):format(t.getDamage(self, t), t.getDuration(self, t)) end, } ----------------------------------------------------------------------- -- Taints ----------------------------------------------------------------------- newInscription{ name = "Taint: Devourer", type = {"inscriptions/taints", 1}, points = 1, is_spell = true, tactical = { ATTACK = 1, HEAL=1 }, requires_target = true, direct_hit = true, no_energy = true, range = 5, action = function(self, t) local data = self:getInscriptionData(t.short_name) local tg = {type="hit", range=self:getTalentRange(t), talent=t} local x, y = self:getTarget(tg) if not x or not y then return nil end self:project(tg, x, y, function(px, py) local target = game.level.map(px, py, Map.ACTOR) if not target then return end local effs = {} -- Go through all spell effects for eff_id, p in pairs(target.tmp) do local e = target.tempeffect_def[eff_id] if e.type == "magical" or e.type == "physical" then effs[#effs+1] = {"effect", eff_id} end end -- Go through all sustained spells for tid, act in pairs(target.sustain_talents) do if act then effs[#effs+1] = {"talent", tid} end end local nb = data.effects for i = 1, nb do if #effs == 0 then break end local eff = rng.tableRemove(effs) if eff[1] == "effect" then target:removeEffect(eff[2]) else target:forceUseTalent(eff[2], {ignore_energy=true}) end self:attr("allow_on_heal", 1) self:heal(data.heal + data.inc_stat, t) self:attr("allow_on_heal", -1) if core.shader.active(4) then self:addParticles(Particles.new("shader_shield_temp", 1, {size_factor=1.5, y=-0.3, img="healdark", life=25}, {type="healing", time_factor=6000, beamsCount=15, noup=2.0, beamColor1={0xcb/255, 0xcb/255, 0xcb/255, 1}, beamColor2={0x35/255, 0x35/255, 0x35/255, 1}})) self:addParticles(Particles.new("shader_shield_temp", 1, {size_factor=1.5, y=-0.3, img="healdark", life=25}, {type="healing", time_factor=6000, beamsCount=15, noup=1.0, beamColor1={0xcb/255, 0xcb/255, 0xcb/255, 1}, beamColor2={0x35/255, 0x35/255, 0x35/255, 1}})) end end game.level.map:particleEmitter(px, py, 1, "shadow_zone") end) game:playSoundNear(self, "talents/fire") return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Activate the taint on a foe, removing %d effects from it and healing you for %d for each effect.]]):format(data.effects, data.heal + data.inc_stat) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[%d effects / %d heal]]):format(data.effects, data.heal + data.inc_stat) end, } newInscription{ name = "Taint: Telepathy", type = {"inscriptions/taints", 1}, points = 1, is_spell = true, range = 10, action = function(self, t) local rad = self:getTalentRange(t) self:setEffect(self.EFF_SENSE, 5, { range = rad, actor = 1, }) self:setEffect(self.EFF_WEAKENED_MIND, 10, {save=10, power=35}) return true end, info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Strip the protective barriers from your mind for %d turns, allowing in the thoughts all creatures within %d squares but reducing mind save by %d and increasing your mindpower by %d for 10 turns.]]):format(data.dur, self:getTalentRange(t), 10, 35) end, short_info = function(self, t) local data = self:getInscriptionData(t.short_name) return ([[Range %d telepathy for %d turns]]):format(self:getTalentRange(t), data.dur) end, }
gpl-3.0
llX8Xll/DEVKEEPER1
plugins/help.lua
1
1078
do function run(msg, matches) return [[ سہؤرسہ كہيہبہر_نہيہؤ KEEPER_NEW قہنہآهہ آلسہؤرسہ @DEV_KEEPER_NEW """""""""""""""""""""""""""" آلآؤآمہر ثہلآثہ🏰 ؤهہيہ كہآلتہآليہ:-👇🏾 ___________________________________ 🏧حہمہآيہهہ📍لآضہهہآر آؤآمہر آلحہمآيهہ فہيہ آلمہجہمہؤعہهہ 🏧آدآرهہ📍لآضہهہآر آؤآمہر آلآدآرهہ فہيہ آلمہجہمہؤعہهہ 🏧مہسہآعہدهہ📍آلآضہهہآر آؤآمہر خہآصہهہ بہآلمہطہؤر """"""""""""""""""""""""""""" تہمہ صہنہعہ آلسہؤرسہ بہؤآسہطہهہ آلمہطہؤريہنہ {كہرآر+ؤغہيہثہ} ♥️➖ @llX8Xll ♥️➖ @llllll_lllll بہؤتہ تہؤآصہل آلمہحہظہؤريہن ♥️➖ @llX8Xllbot قہنہآهہ آلسہؤرسہ ♥️➖ @DEV_KEEPER_NEW ]] end return { description = "Help list", usage = "Help list", patterns = { "^(الاوامر)$", "^(الاوامر)$", }, run = run } end
gpl-2.0
madpilot78/ntopng
scripts/callbacks/system/discover.lua
1
1691
-- -- (C) 2013-21 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path require "lua_utils" local discover_utils = require "discover_utils" local callback_utils = require "callback_utils" local ifnames = interface.getIfNames() local periodic_discovery_condition = function(ifId) return discover_utils.interfaceNetworkDiscoveryEnabled(ifId) end local oneshot_discovery_condition = function(ifId) return discover_utils.networkDiscoveryRequested(ifId) end local discovery_function = function(ifname, ifstats) if interface.isDiscoverableInterface() then traceError(TRACE_INFO,TRACE_CONSOLE, "[Discover] Started periodic discovery on interface "..ifname) local res = discover_utils.discover2table(ifname, true --[[ recache --]]) traceError(TRACE_INFO,TRACE_CONSOLE, "[Discover] Completed periodic discovery on interface "..ifname) discover_utils.clearNetworkDiscovery(ifstats.id) end end -- periodic discovery enabled local discovery_enabled = (ntop.getPref("ntopng.prefs.is_periodic_network_discovery_enabled") == "1") if discovery_enabled then local discovery_interval = ntop.getPref("ntopng.prefs.network_discovery_interval") if isEmptyString(discovery_interval) then discovery_interval = 15 * 60 --[[ 15 minutes --]] end local now = os.time() local diff = now % tonumber(discovery_interval) if diff < 5 then callback_utils.foreachInterface(ifnames, periodic_discovery_condition, discovery_function) end end -- discovery requests performed by the user from the GUI callback_utils.foreachInterface(ifnames, oneshot_discovery_condition, discovery_function)
gpl-3.0
flyzjhz/witi-openwrt
package/ramips/ui/luci-mtk/src/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua
38
17398
--[[ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth <steven@midlink.org> Copyright 2010 Jo-Philipp Wich <xm@subsignal.org> 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 $Id$ ]]-- require("luci.tools.webadmin") local fs = require "nixio.fs" local util = require "luci.util" local ip = require "luci.ip" local has_ipip = fs.glob("/etc/modules.d/[0-9]*-ipip")() m = Map("olsrd", translate("OLSR Daemon"), translate("The OLSR daemon is an implementation of the Optimized Link State Routing protocol. ".. "As such it allows mesh routing for any network equipment. ".. "It runs on any wifi card that supports ad-hoc mode and of course on any ethernet device. ".. "Visit <a href='http://www.olsr.org'>olsrd.org</a> for help and documentation.")) function m.on_parse() local has_defaults = false m.uci:foreach("olsrd", "InterfaceDefaults", function(s) has_defaults = true return false end) if not has_defaults then m.uci:section("olsrd", "InterfaceDefaults") end end function write_float(self, section, value) local n = tonumber(value) if n ~= nil then return Value.write(self, section, "%.1f" % n) end end s = m:section(TypedSection, "olsrd", translate("General settings")) s.anonymous = true s:tab("general", translate("General Settings")) s:tab("lquality", translate("Link Quality Settings")) s:tab("smartgw", translate("SmartGW"), not has_ipip and translate("Warning: kmod-ipip is not installed. Without kmod-ipip SmartGateway will not work, please install it.")) s:tab("advanced", translate("Advanced Settings")) ipv = s:taboption("general", ListValue, "IpVersion", translate("Internet protocol"), translate("IP-version to use. If 6and4 is selected then one olsrd instance is started for each protocol.")) ipv:value("4", "IPv4") ipv:value("6and4", "6and4") poll = s:taboption("advanced", Value, "Pollrate", translate("Pollrate"), translate("Polling rate for OLSR sockets in seconds. Default is 0.05.")) poll.optional = true poll.datatype = "ufloat" poll.placeholder = "0.05" nicc = s:taboption("advanced", Value, "NicChgsPollInt", translate("Nic changes poll interval"), translate("Interval to poll network interfaces for configuration changes (in seconds). Default is \"2.5\".")) nicc.optional = true nicc.datatype = "ufloat" nicc.placeholder = "2.5" tos = s:taboption("advanced", Value, "TosValue", translate("TOS value"), translate("Type of service value for the IP header of control traffic. Default is \"16\".")) tos.optional = true tos.datatype = "uinteger" tos.placeholder = "16" fib = s:taboption("general", ListValue, "FIBMetric", translate("FIB metric"), translate ("FIBMetric controls the metric value of the host-routes OLSRd sets. ".. "\"flat\" means that the metric value is always 2. This is the preferred value ".. "because it helps the linux kernel routing to clean up older routes. ".. "\"correct\" uses the hopcount as the metric value. ".. "\"approx\" use the hopcount as the metric value too, but does only update the hopcount if the nexthop changes too. ".. "Default is \"flat\".")) fib:value("flat") fib:value("correct") fib:value("approx") lql = s:taboption("lquality", ListValue, "LinkQualityLevel", translate("LQ level"), translate("Link quality level switch between hopcount and cost-based (mostly ETX) routing.<br />".. "<b>0</b> = do not use link quality<br />".. "<b>2</b> = use link quality for MPR selection and routing<br />".. "Default is \"2\"")) lql:value("2") lql:value("0") lqage = s:taboption("lquality", Value, "LinkQualityAging", translate("LQ aging"), translate("Link quality aging factor (only for lq level 2). Tuning parameter for etx_float and etx_fpm, smaller values ".. "mean slower changes of ETX value. (allowed values are between 0.01 and 1.0)")) lqage.optional = true lqage:depends("LinkQualityLevel", "2") lqa = s:taboption("lquality", ListValue, "LinkQualityAlgorithm", translate("LQ algorithm"), translate("Link quality algorithm (only for lq level 2).<br />".. "<b>etx_float</b>: floating point ETX with exponential aging<br />".. "<b>etx_fpm</b> : same as etx_float, but with integer arithmetic<br />".. "<b>etx_ff</b> : ETX freifunk, an etx variant which use all OLSR traffic (instead of only hellos) for ETX calculation<br />".. "<b>etx_ffeth</b>: incompatible variant of etx_ff that allows ethernet links with ETX 0.1.<br />".. "Defaults to \"etx_ff\"")) lqa.optional = true lqa:value("etx_ff") lqa:value("etx_fpm") lqa:value("etx_float") lqa:value("etx_ffeth") lqa:depends("LinkQualityLevel", "2") lqa.optional = true lqfish = s:taboption("lquality", Flag, "LinkQualityFishEye", translate("LQ fisheye"), translate("Fisheye mechanism for TCs (checked means on). Default is \"on\"")) lqfish.default = "1" lqfish.optional = true hyst = s:taboption("lquality", Flag, "UseHysteresis", translate("Use hysteresis"), translate("Hysteresis for link sensing (only for hopcount metric). Hysteresis adds more robustness to the link sensing ".. "but delays neighbor registration. Defaults is \"yes\"")) hyst.default = "yes" hyst.enabled = "yes" hyst.disabled = "no" hyst:depends("LinkQualityLevel", "0") hyst.optional = true hyst.rmempty = true port = s:taboption("general", Value, "OlsrPort", translate("Port"), translate("The port OLSR uses. This should usually stay at the IANA assigned port 698. It can have a value between 1 and 65535.")) port.optional = true port.default = "698" port.rmempty = true mainip = s:taboption("general", Value, "MainIp", translate("Main IP"), translate("Sets the main IP (originator ip) of the router. This IP will NEVER change during the uptime of olsrd. ".. "Default is 0.0.0.0, which triggers usage of the IP of the first interface.")) mainip.optional = true mainip.rmempty = true mainip.datatype = "ipaddr" mainip.placeholder = "0.0.0.0" sgw = s:taboption("smartgw", Flag, "SmartGateway", translate("Enable"), translate("Enable SmartGateway. If it is disabled, then " .. "all other SmartGateway parameters are ignored. Default is \"no\".")) sgw.default="no" sgw.enabled="yes" sgw.disabled="no" sgw.rmempty = true sgwnat = s:taboption("smartgw", Flag, "SmartGatewayAllowNAT", translate("Allow gateways with NAT"), translate("Allow the selection of an outgoing ipv4 gateway with NAT")) sgwnat:depends("SmartGateway", "yes") sgwnat.default="yes" sgwnat.enabled="yes" sgwnat.disabled="no" sgwnat.optional = true sgwnat.rmempty = true sgwuplink = s:taboption("smartgw", ListValue, "SmartGatewayUplink", translate("Announce uplink"), translate("Which kind of uplink is exported to the other mesh nodes. " .. "An uplink is detected by looking for a local HNA of 0.0.0.0/0, ::ffff:0:0/96 or 2000::/3. Default setting is \"both\".")) sgwuplink:value("none") sgwuplink:value("ipv4") sgwuplink:value("ipv6") sgwuplink:value("both") sgwuplink:depends("SmartGateway", "yes") sgwuplink.default="both" sgwuplink.optional = true sgwuplink.rmempty = true sgwulnat = s:taboption("smartgw", Flag, "SmartGatewayUplinkNAT", translate("Uplink uses NAT"), translate("If this Node uses NAT for connections to the internet. " .. "Default is \"yes\".")) sgwulnat:depends("SmartGatewayUplink", "ipv4") sgwulnat:depends("SmartGatewayUplink", "both") sgwulnat.default="yes" sgwulnat.enabled="yes" sgwulnat.disabled="no" sgwnat.optional = true sgwnat.rmempty = true sgwspeed = s:taboption("smartgw", Value, "SmartGatewaySpeed", translate("Speed of the uplink"), translate("Specifies the speed of ".. "the uplink in kilobits/s. First parameter is upstream, second parameter is downstream. Default is \"128 1024\".")) sgwspeed:depends("SmartGatewayUplink", "ipv4") sgwspeed:depends("SmartGatewayUplink", "ipv6") sgwspeed:depends("SmartGatewayUplink", "both") sgwspeed.optional = true sgwspeed.rmempty = true sgwprefix = s:taboption("smartgw", Value, "SmartGatewayPrefix", translate("IPv6-Prefix of the uplink"), translate("This can be used " .. "to signal the external IPv6 prefix of the uplink to the clients. This might allow a client to change it's local IPv6 address to " .. "use the IPv6 gateway without any kind of address translation. The maximum prefix length is 64 bits. " .. "Default is \"::/0\" (no prefix).")) sgwprefix:depends("SmartGatewayUplink", "ipv6") sgwprefix:depends("SmartGatewayUplink", "both") sgwprefix.optional = true sgwprefix.rmempty = true willingness = s:taboption("advanced", ListValue, "Willingness", translate("Willingness"), translate("The fixed willingness to use. If not set willingness will be calculated dynamically based on battery/power status. Default is \"3\".")) for i=0,7 do willingness:value(i) end willingness.optional = true willingness.default = "3" natthr = s:taboption("advanced", Value, "NatThreshold", translate("NAT threshold"), translate("If the route to the current gateway is to be changed, the ETX value of this gateway is ".. "multiplied with this value before it is compared to the new one. ".. "The parameter can be a value between 0.1 and 1.0, but should be close to 1.0 if changed.<br />".. "<b>WARNING:</b> This parameter should not be used together with the etx_ffeth metric!<br />".. "Defaults to \"1.0\".")) for i=1,0.1,-0.1 do natthr:value(i) end natthr:depends("LinkQualityAlgorithm", "etx_ff") natthr:depends("LinkQualityAlgorithm", "etx_float") natthr:depends("LinkQualityAlgorithm", "etx_fpm") natthr.default = "1.0" natthr.optional = true natthr.write = write_float i = m:section(TypedSection, "InterfaceDefaults", translate("Interfaces Defaults")) i.anonymous = true i.addremove = false i:tab("general", translate("General Settings")) i:tab("addrs", translate("IP Addresses")) i:tab("timing", translate("Timing and Validity")) mode = i:taboption("general", ListValue, "Mode", translate("Mode"), translate("Interface Mode is used to prevent unnecessary packet forwarding on switched ethernet interfaces. ".. "valid Modes are \"mesh\" and \"ether\". Default is \"mesh\".")) mode:value("mesh") mode:value("ether") mode.optional = true mode.rmempty = true weight = i:taboption("general", Value, "Weight", translate("Weight"), translate("When multiple links exist between hosts the weight of interface is used to determine the link to use. ".. "Normally the weight is automatically calculated by olsrd based on the characteristics of the interface, ".. "but here you can specify a fixed value. Olsrd will choose links with the lowest value.<br />".. "<b>Note:</b> Interface weight is used only when LinkQualityLevel is set to 0. ".. "For any other value of LinkQualityLevel, the interface ETX value is used instead.")) weight.optional = true weight.datatype = "uinteger" weight.placeholder = "0" lqmult = i:taboption("general", DynamicList, "LinkQualityMult", translate("LinkQuality Multiplicator"), translate("Multiply routes with the factor given here. Allowed values are between 0.01 and 1.0. ".. "It is only used when LQ-Level is greater than 0. Examples:<br />".. "reduce LQ to 192.168.0.1 by half: 192.168.0.1 0.5<br />".. "reduce LQ to all nodes on this interface by 20%: default 0.8")) lqmult.optional = true lqmult.rmempty = true lqmult.cast = "table" lqmult.placeholder = "default 1.0" function lqmult.validate(self, value) for _, v in pairs(value) do if v ~= "" then local val = util.split(v, " ") local host = val[1] local mult = val[2] if not host or not mult then return nil, translate("LQMult requires two values (IP address or 'default' and multiplicator) seperated by space.") end if not (host == "default" or ip.IPv4(host) or ip.IPv6(host)) then return nil, translate("Can only be a valid IPv4 or IPv6 address or 'default'") end if not tonumber(mult) or tonumber(mult) > 1 or tonumber(mult) < 0.01 then return nil, translate("Invalid Value for LQMult-Value. Must be between 0.01 and 1.0.") end if not mult:match("[0-1]%.[0-9]+") then return nil, translate("Invalid Value for LQMult-Value. You must use a decimal number between 0.01 and 1.0 here.") end end end return value end ip4b = i:taboption("addrs", Value, "Ip4Broadcast", translate("IPv4 broadcast"), translate("IPv4 broadcast address for outgoing OLSR packets. One useful example would be 255.255.255.255. ".. "Default is \"0.0.0.0\", which triggers the usage of the interface broadcast IP.")) ip4b.optional = true ip4b.datatype = "ip4addr" ip4b.placeholder = "0.0.0.0" ip6m = i:taboption("addrs", Value, "IPv6Multicast", translate("IPv6 multicast"), translate("IPv6 multicast address. Default is \"FF02::6D\", the manet-router linklocal multicast.")) ip6m.optional = true ip6m.datatype = "ip6addr" ip6m.placeholder = "FF02::6D" ip4s = i:taboption("addrs", Value, "IPv4Src", translate("IPv4 source"), translate("IPv4 src address for outgoing OLSR packages. Default is \"0.0.0.0\", which triggers usage of the interface IP.")) ip4s.optional = true ip4s.datatype = "ip4addr" ip4s.placeholder = "0.0.0.0" ip6s = i:taboption("addrs", Value, "IPv6Src", translate("IPv6 source"), translate("IPv6 src prefix. OLSRd will choose one of the interface IPs which matches the prefix of this parameter. ".. "Default is \"0::/0\", which triggers the usage of a not-linklocal interface IP.")) ip6s.optional = true ip6s.datatype = "ip6addr" ip6s.placeholder = "0::/0" hi = i:taboption("timing", Value, "HelloInterval", translate("Hello interval")) hi.optional = true hi.datatype = "ufloat" hi.placeholder = "5.0" hi.write = write_float hv = i:taboption("timing", Value, "HelloValidityTime", translate("Hello validity time")) hv.optional = true hv.datatype = "ufloat" hv.placeholder = "40.0" hv.write = write_float ti = i:taboption("timing", Value, "TcInterval", translate("TC interval")) ti.optional = true ti.datatype = "ufloat" ti.placeholder = "2.0" ti.write = write_float tv = i:taboption("timing", Value, "TcValidityTime", translate("TC validity time")) tv.optional = true tv.datatype = "ufloat" tv.placeholder = "256.0" tv.write = write_float mi = i:taboption("timing", Value, "MidInterval", translate("MID interval")) mi.optional = true mi.datatype = "ufloat" mi.placeholder = "18.0" mi.write = write_float mv = i:taboption("timing", Value, "MidValidityTime", translate("MID validity time")) mv.optional = true mv.datatype = "ufloat" mv.placeholder = "324.0" mv.write = write_float ai = i:taboption("timing", Value, "HnaInterval", translate("HNA interval")) ai.optional = true ai.datatype = "ufloat" ai.placeholder = "18.0" ai.write = write_float av = i:taboption("timing", Value, "HnaValidityTime", translate("HNA validity time")) av.optional = true av.datatype = "ufloat" av.placeholder = "108.0" av.write = write_float ifs = m:section(TypedSection, "Interface", translate("Interfaces")) ifs.addremove = true ifs.anonymous = true ifs.extedit = luci.dispatcher.build_url("admin/services/olsrd/iface/%s") ifs.template = "cbi/tblsection" function ifs.create(...) local sid = TypedSection.create(...) luci.http.redirect(ifs.extedit % sid) end ign = ifs:option(Flag, "ignore", translate("Enable")) ign.enabled = "0" ign.disabled = "1" ign.rmempty = false function ign.cfgvalue(self, section) return Flag.cfgvalue(self, section) or "0" end network = ifs:option(DummyValue, "interface", translate("Network")) network.template = "cbi/network_netinfo" mode = ifs:option(DummyValue, "Mode", translate("Mode")) function mode.cfgvalue(...) return Value.cfgvalue(...) or m.uci:get_first("olsrd", "InterfaceDefaults", "Mode", "mesh") end hello = ifs:option(DummyValue, "_hello", translate("Hello")) function hello.cfgvalue(self, section) local i = tonumber(m.uci:get("olsrd", section, "HelloInterval")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "HelloInterval", 5)) local v = tonumber(m.uci:get("olsrd", section, "HelloValidityTime")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "HelloValidityTime", 40)) return "%.01fs / %.01fs" %{ i, v } end tc = ifs:option(DummyValue, "_tc", translate("TC")) function tc.cfgvalue(self, section) local i = tonumber(m.uci:get("olsrd", section, "TcInterval")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "TcInterval", 2)) local v = tonumber(m.uci:get("olsrd", section, "TcValidityTime")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "TcValidityTime", 256)) return "%.01fs / %.01fs" %{ i, v } end mid = ifs:option(DummyValue, "_mid", translate("MID")) function mid.cfgvalue(self, section) local i = tonumber(m.uci:get("olsrd", section, "MidInterval")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "MidInterval", 18)) local v = tonumber(m.uci:get("olsrd", section, "MidValidityTime")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "MidValidityTime", 324)) return "%.01fs / %.01fs" %{ i, v } end hna = ifs:option(DummyValue, "_hna", translate("HNA")) function hna.cfgvalue(self, section) local i = tonumber(m.uci:get("olsrd", section, "HnaInterval")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "HnaInterval", 18)) local v = tonumber(m.uci:get("olsrd", section, "HnaValidityTime")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "HnaValidityTime", 108)) return "%.01fs / %.01fs" %{ i, v } end return m
gpl-2.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Tasks/TransformBlocksTask.lua
1
18886
--[[ Title: Transform a given block set Author(s): LiXizhi Date: 2013/2/11 Desc: Current translation, rotation and scaling are supported. use the lib: ------------------------------------------------------------ NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/TransformBlocksTask.lua"); -- translation local task = MyCompany.Aries.Game.Tasks.TransformBlocks:new({dx = 1, dy=0, dz=0, blocks={},}) local task = MyCompany.Aries.Game.Tasks.TransformBlocks:new({x = 20000, y=0, z=20000, blocks={},operation="add", liveEntities={}}) -- absolute position. -- rotation local task = MyCompany.Aries.Game.Tasks.TransformBlocks:new({rot_y = 1, aabb=aabb, blocks={},}) local task = MyCompany.Aries.Game.Tasks.TransformBlocks:new({rot_axis = "y", rot_angle=1.57, aabb=aabb, blocks={},}) -- scaling local task = MyCompany.Aries.Game.Tasks.TransformBlocks:new({scaling = 1.2, scalingY=2, aabb=aabb, blocks={},}) task:Run(); ------------------------------------------------------- ]] NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/UndoManager.lua"); local UndoManager = commonlib.gettable("MyCompany.Aries.Game.UndoManager"); local GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic") local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local TaskManager = commonlib.gettable("MyCompany.Aries.Game.TaskManager") local block_types = commonlib.gettable("MyCompany.Aries.Game.block_types") local EntityManager = commonlib.gettable("MyCompany.Aries.Game.EntityManager"); local math_floor = math.floor; local math_abs = math.abs; local TransformBlocks = commonlib.inherit(commonlib.gettable("MyCompany.Aries.Game.Task"), commonlib.gettable("MyCompany.Aries.Game.Tasks.TransformBlocks")); TransformBlocks.max_radius = 30; -- this can be "move" or "add" TransformBlocks.operation = "move"; function TransformBlocks:ctor() self.history = {}; self.history_entity = {}; end function TransformBlocks:Run() if(self.blocks and #(self.blocks) > 0 ) then self.finished = true; GameLogic.PlayAnimation({animationName = "Create",}); local final_blocks = {}; local dx, dy, dz = self:GetDeltaPosition(self.x, self.y, self.z, self.aabb) -- for translation self:DoTranslation(dx,dy,dz, self.blocks, final_blocks); if(self.rot_axis == "x") then self.rot_x = self.rot_angle or self.rot_x; elseif(self.rot_axis == "y") then self.rot_y = self.rot_angle or self.rot_y; elseif(self.rot_axis == "z") then self.rot_z = self.rot_angle or self.rot_z; end -- for rotation an axis if(self.rot_y and self.rot_y~=0) then self:DoRotation(self.rot_y, "y", self.blocks, final_blocks); elseif(self.rot_x and self.rot_x~=0) then self:DoRotation(self.rot_x, "x", self.blocks, final_blocks); elseif(self.rot_z and self.rot_z~=0) then self:DoRotation(self.rot_z, "z", self.blocks, final_blocks); end -- for scaling self:DoScaling(self.scalingX or self.scaling, self.scalingY or self.scaling, self.scalingZ or self.scaling, self.blocks, final_blocks); -- perform translation to final_blocks, by first removing all old blocks and then creating the new ones. local bRemoveSourceBlocks = (self.operation == "move" or self.operation == "no_clone"); self:DoTransform(self.blocks, final_blocks, bRemoveSourceBlocks) self.final_blocks = final_blocks; end if(self.liveEntities and #(self.liveEntities) > 0 ) then self.finished = true; local dx, dy, dz = self:GetDeltaPosition(self.x, self.y, self.z, self.aabb) local final_entities = {}; -- for translation self:DoEntityTranslation(dx,dy,dz, self.liveEntities, final_entities); local bRemoveSourceEntities = (self.operation == "move" or self.operation == "no_clone"); self:DoEntityTransform(self.liveEntities, final_entities, bRemoveSourceEntities) end if(GameLogic.GameMode:CanAddToHistory()) then if(#(self.history) > 0) then UndoManager.PushCommand(self); end end end function TransformBlocks:FrameMove() self.finished = true; end function TransformBlocks:DoEntityTransform(entities, final_entities, bRemoveSourceEntities) if (#final_entities > 0) then for i, xmlNode in ipairs(final_entities) do local attr = xmlNode.attr; if(not bRemoveSourceEntities) then attr.name = nil; local entityClass; if(attr.class) then entityClass = EntityManager.GetEntityClass(attr.class) end entityClass = entityClass or EntityManager.EntityLiveModel local entity = entityClass:Create({x=attr.x,y=attr.y,z=attr.z}, xmlNode); entity:Attach(); attr.name = entity.name else local fromEntity = EntityManager.GetEntity(attr.name) if(fromEntity) then fromEntity:SetPosition(xmlNode.attr.x, xmlNode.attr.y, xmlNode.attr.z); end end self.history_entity[#(self.history_entity)+1] = {from=entities[i], to=xmlNode} end end end -- perform translation to final_blocks, by first removing all old blocks and then creating the new ones. function TransformBlocks:DoTransform(blocks, final_blocks, bRemoveSourceBlocks) if (#final_blocks > 0) then BlockEngine:BeginUpdate() if(bRemoveSourceBlocks) then for i = 1, #(blocks) do local b = blocks[i]; local last_id, last_data, last_entity_data = BlockEngine:GetBlockFull(b[1],b[2],b[3]); if(last_id > 0) then BlockEngine:SetBlockToAir(b[1],b[2],b[3], 3); self.history[#(self.history)+1] = {b[1],b[2],b[3], 0, last_id,last_data, b[5],b[6],last_entity_data}; end end end for i = 1, #(final_blocks) do local b = final_blocks[i]; local last_id, last_data, last_entity_data = BlockEngine:GetBlockFull(b[1],b[2],b[3]); local block_template = block_types.get(b[4]); if(block_template) then BlockEngine:SetBlock(b[1],b[2],b[3], b[4], b[5], 3, b[6]); self.history[#(self.history)+1] = {b[1],b[2],b[3], b[4], last_id, last_data, b[5],b[6],last_entity_data}; end end BlockEngine:EndUpdate() end end -- this function can also be used as static function. -- @param x,y,z: new bottom center position -- @param aabb: old source aabb -- @return dx,dy,dz: may all be zero function TransformBlocks:GetDeltaPosition(x,y,z, aabb) local dx = self.dx or 0; local dy = self.dy or 0; local dz = self.dz or 0; if(x and y and z and aabb) then local mExtents = aabb.mExtents; local center = aabb:GetCenter(); dx = math_floor(x - center[1]+0.1); dy = math_floor(y - (center[2]-mExtents[2])+0.1); dz = math_floor(z - center[3]+0.1); end return dx, dy, dz; end -- @param scaling factor: scaling factor -- @param blocks: source block -- @param aabb: aabb of source block. -- @param final_blocks: the transformed block output. function TransformBlocks:DoScaling(scalingX, scalingY, scalingZ, blocks, final_blocks) scalingX = scalingX or 1; scalingY = scalingY or 1; scalingZ = scalingZ or 1; local scaling = math.min(scalingX, scalingY, scalingZ); if((scalingX~=1 or scalingY~=1 or scalingZ~=1) and self.aabb) then -- scaling is at the min of the aabb. local pivot_x, pivot_y, pivot_z = self.aabb:GetMinValues(); local extend_x, extend_y, entend_z = self.aabb:GetExtendValues(); pivot_x, pivot_y, pivot_z = math_floor(pivot_x+0.5), math_floor(pivot_y+0.5), math_floor(pivot_z+0.5) -- offseting the final center, so that it is repostioned to the bottom center. local bottomCenter_x, bottomCenter_y, bottomCenter_z = self.aabb:GetBottomPosition(); local offset_x = pivot_x - math.floor((bottomCenter_x-pivot_x)*scalingX+0.5 - extend_x); local offset_y = pivot_y - 0; local offset_z = pivot_z - math.floor((bottomCenter_z-pivot_z)*scalingZ+0.5 - entend_z); local k = 0; for i = 1, #(blocks) do local b = blocks[i]; local dx, dy, dz = b[1] - pivot_x, b[2] - pivot_y, b[3] - pivot_z; if(scaling<1) then -- min-point-filtering k = k + 1; final_blocks[k] = { math_floor(dx*scalingX + 0.499) + offset_x, math_floor(dy*scalingY + 0.499) + offset_y, math_floor(dz*scalingZ + 0.499) + offset_z, b[4],b[5],b[6], }; else -- max-point-filtering for x = if_else(dx==0, 0, math_floor((dx)*scalingX)), math_floor((dx+1)*scalingX)-1 do for y = if_else(dy==0, 0, math_floor((dy)*scalingY)), math_floor((dy+1)*scalingY)-1 do for z = if_else(dz==0, 0, math_floor((dz)*scalingZ)), math_floor((dz+1)*scalingZ)-1 do k = k + 1; final_blocks[k] = { x + offset_x, y + offset_y, z + offset_z, b[4],b[5],b[6], }; end end end end end end end -- @param dx,dy,dz: translation -- @param blocks: source block -- @param aabb: aabb of source block. -- @param final_blocks: the transformed block output. function TransformBlocks:DoTranslation(dx,dy,dz, blocks, final_blocks) if(dx~=0 or dy~=0 or dz~=0) then for i = 1, #(blocks) do local b = blocks[i]; final_blocks[i] = {b[1]+dx, b[2]+dy, b[3]+dz, b[4], b[5], b[6]}; end end end function TransformBlocks:DoEntityTranslation(dx,dy,dz, entities, final_entities) if(dx~=0 or dy~=0 or dz~=0) then dx = (dx or 0) * BlockEngine.blocksize; dy = (dy or 0) * BlockEngine.blocksize; dz = (dz or 0) * BlockEngine.blocksize; for i = 1, #(entities) do local entity = commonlib.copy(entities[i]); entity.attr.x = entity.attr.x + dx; entity.attr.y = entity.attr.y + dy; entity.attr.z = entity.attr.z + dz; final_entities[i] = entity; end end end -- rotating blocks with arbitrary angle will result in gaps. -- This algorithm will first scale the original blocks 2 times (8 times in volume) -- and then rotate and shrink to orignal size. This will effectively remove all gaps. function TransformBlocks:RotateBlocksWithFillingGap(blocks, final_blocks, rot_angle, axis, cx, cy, cz) local blocks_origin = {}; local blocks_scaled = {}; local sin_t, cos_t = math.sin(rot_angle), math.cos(rot_angle); -- taking negative value into account function GetSparseIndex(x, y, z) return (y+256)*30000*30000+(x+10000)*30000+(z+10000); end -- convert from sparse index to block x,y,z -- @return x,y,z function FromSparseIndex(index) local x, y, z; y = math.floor(index / (30000*30000)); index = index - y*30000*30000; x = math.floor(index / (30000)); z = index - x*30000; return x-10000,y-256,z-10000; end local function RotateBlock(x,y,z) if(axis== "x") then return x, math.floor(y*cos_t - z*sin_t+0.5), math.floor(y*sin_t + z*cos_t + 0.5); elseif(axis== "z") then return math.floor(x*cos_t - y*sin_t + 0.5), math.floor(x*sin_t + y*cos_t + 0.5), z; else return math.floor(x*cos_t - z*sin_t + 0.5), y, math.floor(x*sin_t + z*cos_t + 0.5); end end for i = 1, #(blocks) do local b = blocks[i]; local bn = {b[1]-cx, b[2]-cy, b[3]-cz}; blocks_origin[i] = bn; local k = (i-1)*8; local bn2 = {bn[1]*2, bn[2]*2, bn[3]*2, b}; blocks_scaled[k+1] = bn2; blocks_scaled[k+2] = {bn2[1], bn2[2], bn2[3]+1, b}; blocks_scaled[k+3] = {bn2[1], bn2[2]+1, bn2[3], b}; blocks_scaled[k+4] = {bn2[1], bn2[2]+1, bn2[3]+1, b}; blocks_scaled[k+5] = {bn2[1]+1, bn2[2], bn2[3], b}; blocks_scaled[k+6] = {bn2[1]+1, bn2[2], bn2[3]+1, b}; blocks_scaled[k+7] = {bn2[1]+1, bn2[2]+1, bn2[3], b}; blocks_scaled[k+8] = {bn2[1]+1, bn2[2]+1, bn2[3]+1, b}; end local block_scaled_map = {}; for i = 1, #(blocks_scaled) do local b = blocks_scaled[i]; local x, y, z = RotateBlock(b[1], b[2], b[3]); block_scaled_map[GetSparseIndex(x, y, z)] = b[4]; end local count=0; local bmap = {{}, {}, {}, {}, {}, {},{}, {},}; local function CountBlock_reset() count = 0; for i=1, 8 do if(bmap[i].block) then bmap[i].block=false; bmap[i].count=0; else break; end end end local function CountBlock(b2) if(b2) then count = count + 1; for i=1, 8 do if(not bmap[i].block) then bmap[i].block = b2; bmap[i].count = 1; elseif(bmap[i].block == b2) then bmap[i].count = bmap[i].count + 1; if(i>1) then for j=i, 2, -1 do if(bmap[j-1].count < bmap[j].count) then bmap[j-1], bmap[j] = bmap[j], bmap[j-1]; end end end end end end end local function GetCountAndBlock() return count, bmap[1].block; end local block_map = {}; for index, b in pairs(block_scaled_map) do local x, y, z = FromSparseIndex(index); local x0, y0, z0 = math.floor(x/2), math.floor(y/2), math.floor(z/2); local sparse_index = GetSparseIndex(x0, y0, z0); if(not block_map[sparse_index]) then block_map[sparse_index] = true; local x2, y2, z2 = x0*2, y0*2, z0*2; CountBlock_reset(); CountBlock(block_scaled_map[GetSparseIndex(x2, y2, z2)]) CountBlock(block_scaled_map[GetSparseIndex(x2, y2, z2+1)]); CountBlock(block_scaled_map[GetSparseIndex(x2, y2+1, z2)]); CountBlock(block_scaled_map[GetSparseIndex(x2, y2+1, z2+1)]); CountBlock(block_scaled_map[GetSparseIndex(x2+1, y2, z2)]); CountBlock(block_scaled_map[GetSparseIndex(x2+1, y2, z2+1)]); CountBlock(block_scaled_map[GetSparseIndex(x2+1, y2+1, z2)]); CountBlock(block_scaled_map[GetSparseIndex(x2+1, y2+1, z2+1)]); local count; count, b = GetCountAndBlock(); if(count >= 4 and b) then local blockTemplate = block_types.get(b[4]); local blockData = b[5]; local entityData = b[6]; if(blockTemplate) then if(blockData) then blockData = blockTemplate:RotateBlockData(blockData, -rot_angle, axis); end if(entityData) then entityData = blockTemplate:RotateBlockEntityData(entityData, -rot_angle, axis); end end final_blocks[#final_blocks+1] = {x0+cx, y0+cy, z0+cz, b[4], blockData, entityData,} end end end end -- right angle transform. -- @param rot_angle: always snap to -1.57, 1.57, 3.14 function TransformBlocks:RotateBlocksRightAngle(blocks, final_blocks, rot_angle, axis, cx, cy, cz) local sin_t, cos_t = math.sin(rot_angle), math.cos(rot_angle); -- snap to right angle sin_t, cos_t = math_floor(sin_t+0.5), math_floor(cos_t+0.5); for i = 1, #(blocks) do local b = blocks[i]; local blockTemplate = block_types.get(b[4]); local blockData = b[5]; local entityData = b[6]; if(blockTemplate) then if(blockData) then blockData = blockTemplate:RotateBlockData(blockData, -rot_angle, axis); end if(entityData) then entityData = blockTemplate:RotateBlockEntityData(entityData, -rot_angle, axis); end end if(axis== "x") then local x, y = b[2] - cy, b[3] - cz; final_blocks[i] = { b[1], x*cos_t - y*sin_t + cy, x*sin_t + y*cos_t + cz, b[4], blockData, entityData, }; elseif(axis== "z") then local x, y = b[1] - cx, b[2] - cy; final_blocks[i] = { x*cos_t - y*sin_t + cx, x*sin_t + y*cos_t + cy, b[3], b[4], blockData, entityData, }; else -- if(axis== "y") then local x, y = b[1] - cx, b[3] - cz; final_blocks[i] = { x*cos_t - y*sin_t + cx, b[2], x*sin_t + y*cos_t + cz, b[4], blockData, entityData, }; end end end -- @param rot_y: angle in radian -- @param blocks: source block -- @param aabb: aabb of source block. -- @param final_blocks: the transformed block output. function TransformBlocks:DoRotation(rot_angle, axis, blocks, final_blocks) if(rot_angle and rot_angle~=0 and self.aabb) then local center = self.aabb:GetCenter(); local cx, cy, cz; if(self.pivot and not self.pivot_x) then cx, cy, cz = self.pivot[1], self.pivot[2], self.pivot[3] elseif(self.pivot_x and self.pivot_y and self.pivot_z) then cx, cy, cz = self.pivot_x, self.pivot_y, self.pivot_z; else cx, cy, cz = math_floor(center[1]), math_floor(center[2]), math_floor(center[3]); end local bIsRightAngle = math.floor(rot_angle*180/3.14+0.5) % 90 == 0; if(bIsRightAngle) then self:RotateBlocksRightAngle(blocks, final_blocks, rot_angle, axis, cx, cy, cz); else self:RotateBlocksWithFillingGap(blocks, final_blocks, rot_angle, axis, cx, cy, cz); end end end function TransformBlocks:Redo() if((#self.history)>0) then BlockEngine:BeginUpdate() for _, b in ipairs(self.history) do BlockEngine:SetBlock(b[1],b[2],b[3], b[4] or 0, b[7], nil, b[8]); end BlockEngine:EndUpdate() end if((#self.history_entity) > 0) then for _, item in ipairs(self.history_entity) do if(item.from.attr.name == item.to.attr.name) then local xmlNode = item.to; local entity = EntityManager.GetEntity(xmlNode.attr.name); if(entity) then entity:SetPosition(xmlNode.attr.x, xmlNode.attr.y, xmlNode.attr.z) end elseif(item.from.attr.name and item.to.attr.name) then local entity = EntityManager.GetEntity(item.from.attr.name); if(entity) then entity:SetPosition(item.from.attr.x, item.from.attr.y, item.from.attr.z) else xmlNode = item.from; local attr = xmlNode.attr; local entityClass; if(attr.class) then entityClass = EntityManager.GetEntityClass(attr.class) end entityClass = entityClass or EntityManager.EntityLiveModel local entity = entityClass:Create({x=attr.x,y=attr.y,z=attr.z}, xmlNode); entity:Attach(); end local entity = EntityManager.GetEntity(item.to.attr.name); if(entity) then entity:SetPosition(item.to.attr.x, item.to.attr.y, item.to.attr.z) else xmlNode = item.to; local attr = xmlNode.attr; local entityClass; if(attr.class) then entityClass = EntityManager.GetEntityClass(attr.class) end entityClass = entityClass or EntityManager.EntityLiveModel local entity = entityClass:Create({x=attr.x,y=attr.y,z=attr.z}, xmlNode); entity:Attach(); end end end end end function TransformBlocks:Undo() if((#self.history)>0) then BlockEngine:BeginUpdate() for i = #(self.history), 1, -1 do local b = self.history[i]; BlockEngine:SetBlock(b[1],b[2],b[3], b[5] or 0, b[6], nil, b[9]); end BlockEngine:EndUpdate() end if((#self.history_entity) > 0) then for _, item in ipairs(self.history_entity) do if(item.from.attr.name == item.to.attr.name) then local xmlNode = item.from; local entity = EntityManager.GetEntity(xmlNode.attr.name); if(entity) then entity:SetPosition(xmlNode.attr.x, xmlNode.attr.y, xmlNode.attr.z) end elseif(item.from.attr.name and item.to.attr.name) then local entity = EntityManager.GetEntity(item.to.attr.name); if(entity) then entity:Destroy() end local entity = EntityManager.GetEntity(item.from.attr.name); if(entity) then entity:SetPosition(item.from.attr.x, item.from.attr.y, item.from.attr.z) else xmlNode = item.from; local attr = xmlNode.attr; local entityClass; if(attr.class) then entityClass = EntityManager.GetEntityClass(attr.class) end entityClass = entityClass or EntityManager.EntityLiveModel local entity = entityClass:Create({x=attr.x,y=attr.y,z=attr.z}, xmlNode); entity:Attach(); end end end end end
gpl-2.0
kellabyte/snabbswitch
src/lib/hardware/pci.lua
6
4660
module(...,package.seeall) local ffi = require("ffi") local C = ffi.C local lib = require("core.lib") require("lib.hardware.pci_h") --- ### Hardware device information devices = {} --- Array of all supported hardware devices. --- --- Each entry is a "device info" table with these attributes: --- --- * `pciaddress` e.g. `"0000:83:00.1"` --- * `vendor` id hex string e.g. `"0x8086"` for Intel. --- * `device` id hex string e.g. `"0x10fb"` for 82599 chip. --- * `interface` name of Linux interface using this device e.g. `"eth0"`. --- * `status` string Linux operational status, or `nil` if not known. --- * `driver` Lua module that supports this hardware e.g. `"intel10g"`. --- * `usable` device was suitable to use when scanned? `yes` or `no` --- Initialize (or re-initialize) the `devices` table. function scan_devices () for _,device in ipairs(lib.files_in_directory("/sys/bus/pci/devices")) do local info = device_info(device) if info.driver then table.insert(devices, info) end end end function device_info (pciaddress) local info = {} local p = path(pciaddress) info.pciaddress = pciaddress info.vendor = lib.firstline(p.."/vendor") info.device = lib.firstline(p.."/device") info.driver = which_driver(info.vendor, info.device) if info.driver then info.interface = lib.firstfile(p.."/net") if info.interface then info.status = lib.firstline(p.."/net/"..info.interface.."/operstate") end end info.usable = lib.yesno(is_usable(info)) return info end --- Return the path to the sysfs directory for `pcidev`. function path(pcidev) return "/sys/bus/pci/devices/"..pcidev end -- Return the name of the Lua module that implements support for this device. function which_driver (vendor, device) if vendor == '0x8086' then if device == '0x10fb' then return 'apps.intel.intel_app' end -- Intel 82599 if device == '0x10d3' then return 'apps.intel.intel_app' end -- Intel 82574L if device == '0x105e' then return 'apps.intel.intel_app' end -- Intel 82571 elseif vendor == '0x1924' then if device == '0x0903' then return 'apps.solarflare.solarflare' end -- if device == '0x0803' then return 'apps.solarflare.solarflare' end end end --- ### Device manipulation. --- Return true if `device` is safely available for use, or false if --- the operating systems to be using it. function is_usable (info) return info.driver and (info.interface == nil or info.status == 'down') end --- Force Linux to release the device with `pciaddress`. --- The corresponding network interface (e.g. `eth0`) will disappear. function unbind_device_from_linux (pciaddress) root_check() local p = path(pciaddress).."/driver/unbind" if lib.can_write(p) then lib.writefile(path(pciaddress).."/driver/unbind", pciaddress) end end -- Memory map PCI device configuration space. -- Return two values: -- Pointer for memory-mapped access. -- File descriptor for the open sysfs resource file. function map_pci_memory (device, n) root_check() local filepath = path(device).."/resource"..n local fd = C.open_pci_resource(filepath) assert(fd >= 0) local addr = C.map_pci_resource(fd) assert( addr ~= 0 ) return addr, fd end -- Close a file descriptor opened by map_pci_memory(). function close_pci_resource (fd, base) C.close_pci_resource(fd, base) end --- Enable or disable PCI bus mastering. DMA only works when bus --- mastering is enabled. function set_bus_master (device, enable) root_check() local fd = C.open_pcie_config(path(device).."/config") local value = ffi.new("uint16_t[1]") assert(C.pread(fd, value, 2, 0x4) == 2) if enable then value[0] = bit.bor(value[0], lib.bits({Master=2})) else value[0] = bit.band(value[0], bit.bnot(lib.bits({Master=2}))) end assert(C.pwrite(fd, value, 2, 0x4) == 2) C.close(fd) end function root_check () lib.root_check("error: must run as root to access PCI devices") end --- ### Selftest --- --- PCI selftest scans for available devices and performs our driver's --- self-test on each of them. function selftest () print("selftest: pci") scan_devices() print_device_summary() end function print_device_summary () local attrs = {"pciaddress", "vendor", "device", "interface", "status", "driver", "usable"} local fmt = "%-13s %-7s %-7s %-10s %-9s %-11s %s" print(fmt:format(unpack(attrs))) for _,info in ipairs(devices) do local values = {} for _,attr in ipairs(attrs) do table.insert(values, info[attr] or "-") end print(fmt:format(unpack(values))) end end
apache-2.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Commands/CommandTemplate.lua
1
19269
--[[ Title: CommandTemplate Author(s): LiXizhi Date: 2014/2/23 Desc: template related command use the lib: ------------------------------------------------------- NPL.load("(gl)script/apps/Aries/Creator/Game/Commands/CommandTime.lua"); ------------------------------------------------------- ]] NPL.load("(gl)script/ide/STL.lua"); NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/UndoManager.lua"); NPL.load("(gl)script/apps/Aries/Creator/Game/GameMarket/EnterGamePage.lua"); NPL.load("(gl)script/apps/Aries/Scene/WorldManager.lua"); NPL.load("(gl)script/apps/Aries/SlashCommand/SlashCommand.lua"); local SlashCommand = commonlib.gettable("MyCompany.Aries.SlashCommand.SlashCommand"); local CmdParser = commonlib.gettable("MyCompany.Aries.Game.CmdParser"); local WorldManager = commonlib.gettable("MyCompany.Aries.WorldManager"); local UndoManager = commonlib.gettable("MyCompany.Aries.Game.UndoManager"); local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local block_types = commonlib.gettable("MyCompany.Aries.Game.block_types") local block = commonlib.gettable("MyCompany.Aries.Game.block") local GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic") local BroadcastHelper = commonlib.gettable("CommonCtrl.BroadcastHelper"); local EntityManager = commonlib.gettable("MyCompany.Aries.Game.EntityManager"); local Commands = commonlib.gettable("MyCompany.Aries.Game.Commands"); local CommandManager = commonlib.gettable("MyCompany.Aries.Game.CommandManager"); Commands["loadtemplate"] = { name="loadtemplate", quick_ref="/loadtemplate [-r] [-history] [-abspos] [-tp] [-a seconds] [x y z] [-rename bool][templatename]", desc=[[load template to the given position @param -a seconds: animate building progress. the followed number is the number of seconds (duration) of the animation. @param -l seconds: according to the tier to load. the followed number is the number of seconds (duration) of the animation. @param -r: remove blocks @param -abspos: whether load using absolute position. @param -tp: whether teleport player to template player's location. @param -opaque: replace air block to black color block. @param x,y,z: absolute or relative position, default to current player position @param templatename: filename relative to current world or blocktemplates/. If no file extension is specified, [name].blocks.xml is used. default name is "default" /loadtemplate ~0 ~2 ~ test /loadtemplate -a 3 test /loadtemplate -l 3 test /loadtemplate -r test /loadtemplate -history test allow ctrl+z to undo /loadtemplate ~/test in writable global temp directory ]], handler = function(cmd_name, cmd_text, cmd_params, fromEntity) NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/BlockTemplateTask.lua"); local BlockTemplate = commonlib.gettable("MyCompany.Aries.Game.Tasks.BlockTemplate"); local option; local load_anim_duration; local operation = BlockTemplate.Operations.Load; local UseAbsolutePos, TeleportPlayer; local opaque; local nohistory = fromEntity ~= EntityManager.GetPlayer(); local rename; while(cmd_text) do option, cmd_text = CmdParser.ParseOption(cmd_text); if(option) then if (option == "a") then load_anim_duration, cmd_text = CmdParser.ParseInt(cmd_text); if (load_anim_duration ~= 0) then operation = BlockTemplate.Operations.AnimLoad; end elseif (option == "r") then operation = BlockTemplate.Operations.Remove; elseif (option == "abspos") then UseAbsolutePos = true; elseif (option == "history") then nohistory = nil; elseif (option == "tp") then TeleportPlayer = true; elseif (option == "opaque") then opaque = true; elseif (option == "rename") then option, cmd_text = CmdParser.ParseBool(cmd_text); rename = option; elseif (option == "l") then load_anim_duration, cmd_text = CmdParser.ParseInt(cmd_text); if (load_anim_duration ~= 0) then operation = BlockTemplate.Operations.TierLoad; end end else break; end end load_anim_duration = load_anim_duration or 0; local x, y, z, cmd_text = CmdParser.ParsePos(cmd_text, fromEntity); if (not x) then fromEntity = fromEntity or EntityManager.GetPlayer(); if (fromEntity) then x,y,z = fromEntity:GetBlockPos(); end end if (x) then local Files = commonlib.gettable("MyCompany.Aries.Game.Common.Files"); local filename = cmd_text; if (filename == "") then templatename = "default"; end if(filename:match("^~")) then filename = ParaIO.GetWritablePath().."temp"..filename:sub(2, -1) end if(not filename:match("%.xml$") and not filename:match("%.bmax$")) then filename = filename .. ".blocks.xml"; end if filename and filename:match("^onlinestore/") then if(not ParaIO.DoesFileExist(Files.WorldPathToFullPath(commonlib.Encoding.Utf8ToDefault(filename)), true)) then ParaIO.CopyFile(Files.GetTempPath()..commonlib.Encoding.Utf8ToDefault(filename), Files.WorldPathToFullPath(commonlib.Encoding.Utf8ToDefault(filename)), true) end end local fullpath; if(commonlib.Files.IsAbsolutePath(filename)) then fullpath = filename; else fullpath = Files.GetWorldFilePath(filename) or (not filename:match("[/\\]") and Files.GetWorldFilePath("blocktemplates/"..filename)) or Files.WorldPathToFullPath(commonlib.Encoding.Utf8ToDefault(filename)); end if(not fullpath and ParaIO.DoesFileExist(filename, true)) then fullpath = filename; end if(fullpath) then local task = BlockTemplate:new( { operation = operation, filename = fullpath, blockX = x, blockY = y, blockZ = z, bSelect = nil, load_anim_duration = load_anim_duration, UseAbsolutePos = UseAbsolutePos, TeleportPlayer = TeleportPlayer, nohistory = nohistory, opaque = opaque, rename = rename } ); task:Run(); else LOG.std(nil, "info", "loadtemplate", "file %s not found", filename); end end end, }; Commands["savetemplate"] = { name="savetemplate", quick_ref="/savetemplate [-auto_pivot] [-relative_motion] [-hollow] [-ref] [-withentity] [templatename]", desc=[[save template with current selection @param templatename: if no name is provided, it will be default @param auto_pivot: if true, use the bottom center of all blocks as pivot @param -hollow: if true, model will be hollow @param -relative_motion: if true, movie block will use relative motion @param -ref: if true, we will export external referenced files @param -withentity: if true, we will export live entities in the aabb /savetemplate test /savetemplate -hollow test /savetemplate -auto_pivot test /savetemplate -relative_motion test /savetemplate ~/test in writable global temp directory ]], handler = function(cmd_name, cmd_text, cmd_params, fromEntity) local options; options, cmd_text = CmdParser.ParseOptions(cmd_text); local templatename = cmd_text:match("(%S*)$"); if(not templatename or templatename == "") then templatename = "default"; end if(templatename:match("^~")) then templatename = ParaIO.GetWritablePath().."temp"..templatename:sub(2, -1) end templatename = templatename:gsub("^blocktemplates/", ""):gsub("%.blocks%.xml$", ""); local filename; if(commonlib.Files.IsAbsolutePath(templatename)) then filename = format("%s.blocks.xml", templatename); else filename = format("%sblocktemplates/%s.blocks.xml", GameLogic.current_worlddir, templatename); end NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/BlockTemplateTask.lua"); local BlockTemplate = commonlib.gettable("MyCompany.Aries.Game.Tasks.BlockTemplate"); local task = BlockTemplate:new({operation = BlockTemplate.Operations.Save, filename = filename, auto_pivot = options.auto_pivot, relative_motion = options.relative_motion, hollow = options.hollow, exportReferencedFiles = options.ref, withentity = options.withentity, bSelect=nil}) if(task:Run()) then BroadcastHelper.PushLabel({id="savetemplate", label = format(L"模板成功保存到:%s", commonlib.Encoding.DefaultToUtf8(filename)), max_duration=4000, color = "0 255 0", scaling=1.1, bold=true, shadow=true,}); end end, }; Commands["savemodel"] = { name="savemodel", quick_ref="/savemodel [-auto_scale false] [-f] [-interactive|i] [modelname]", desc=[[save bmax model with current selection. @param -auto_scale: whether or not scale model to one block size. default value is true @param modelname: if no name is provided, it will be "default" @param -interactive or -i: we will ask the user if file already exists @param -f: force overwrite existing file @return true, filename /savemodel test /savemodel -auto_scale false test /savemodel -interactive test /savemodel -interactive "file name" /savemodel ~/test in writable global temp directory ]], handler = function(cmd_name, cmd_text, cmd_params, fromEntity) local option; local auto_scale; local options = {}; while(cmd_text) do option, cmd_text = CmdParser.ParseOption(cmd_text); if(option) then if(option == "auto_scale") then auto_scale, cmd_text = CmdParser.ParseBool(cmd_text); else options[option] = true; end else break; end end local templatename; templatename, cmd_text = CmdParser.ParseFilename(cmd_text); if(not templatename or templatename == "") then templatename = "default"; end local relative_path if(templatename:match("^~")) then templatename = ParaIO.GetWritablePath().."temp"..templatename:sub(2, -1) end local filename; if(commonlib.Files.IsAbsolutePath(templatename)) then templatename = templatename:gsub("%.bmax$", ""); relative_path = format("%s.bmax", templatename); filename = relative_path; else templatename = templatename:gsub("^blocktemplates/", ""):gsub("%.bmax$", ""); templatename = commonlib.Encoding.Utf8ToDefault(templatename); relative_path = format("blocktemplates/%s.bmax", templatename); filename = GameLogic.GetWorldDirectoryAt()..relative_path; end local function saveModel_() NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/BlockTemplateTask.lua"); local BlockTemplate = commonlib.gettable("MyCompany.Aries.Game.Tasks.BlockTemplate"); local task = BlockTemplate:new({operation = BlockTemplate.Operations.Save, filename = filename, auto_scale = auto_scale, bSelect=nil, }) if(task:Run()) then BroadcastHelper.PushLabel({id="savemodel", label = format(L"BMax模型成功保存到:%s", commonlib.Encoding.DefaultToUtf8(relative_path)), max_duration=4000, color = "0 255 0", scaling=1.1, bold=true, shadow=true,}); if(options.interactive or options.i) then GameLogic.GetFilters():apply_filters("file_exported", "bmax", filename); GameLogic.GetFilters():apply_filters("user_event_stat", "model", "export.bmax", 10, nil); end return true, relative_path; end end if(options.interactive or options.i) then if(not options.f and ParaIO.DoesFileExist(filename)) then _guihelper.MessageBox(format(L"文件 %s 已经存在, 是否覆盖?", commonlib.Encoding.DefaultToUtf8(filename)), function(res) if(res and res == _guihelper.DialogResult.Yes) then saveModel_() end end, _guihelper.MessageBoxButtons.YesNo); return end end return saveModel_(); end, }; Commands["export"] = { name="export", quick_ref="/export [-silent] [filename]", desc=[[export current selection as certain file @param silent: true to suppress any UI popups @param filename: file name to save as. Example: /export :show the GUI to export selection to a given file type. /export -silent :close any exporter gui ]], handler = function(cmd_name, cmd_text, cmd_params, fromEntity) NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/ExportTask.lua"); local Export = commonlib.gettable("MyCompany.Aries.Game.Tasks.Export"); local task = MyCompany.Aries.Game.Tasks.Export:new({}) local bSilentMode; local option = true; while(cmd_text and option) do option, cmd_text = CmdParser.ParseOption(cmd_text); if(option == "silent") then bSilentMode = true; end end if(cmd_text and cmd_text~="") then cmd_text = commonlib.Encoding.Utf8ToDefault(cmd_text); task:SetFileName(cmd_text); end task:SetSilentMode(bSilentMode); task:Run(); end, }; Commands["generatemodel"] = { name="generatemodel", quick_ref="/generatemodel [modelpath]", desc=[[generate x model with current selection /generatemodel test ]], handler = function(cmd_name, cmd_text, cmd_params, fromEntity) local modelname = cmd_text:match("(%S*)$"); if(not modelname or modelname == "") then modelname = "model/default.x"; end --modelname = templatename:gsub("^blocktemplates/", ""):gsub("%.blocks%.xml$", ""); local filename = modelname; filename = commonlib.Encoding.Utf8ToDefault(filename); NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/GenerateModelTask.lua"); local task = MyCompany.Aries.Game.Tasks.GenerateModel:new({filename = filename}); task:Run() end, }; Commands["exportgltf"] = { name="exportgltf", quick_ref="/exportgltf [-region] [parax] [output]", desc=[[--export all blocks in the given regions to gltf(glb) files, save to current world dictionary /exportgltf -region 37_37|37_38 -- export all selected blocks to gltf(glb) file, save as the output file in current world dictionary /exportgltf selected1.gltf(glb) -- export all blocks in the given chunks in (x y z) radius around player /exportgltf 32 32 32 -- export the given parax file to gltf(glb) file /exportgltf given.x output.gltf(glb) ]], handler = function(cmd_name, cmd_text, cmd_params, fromEntity) local function ParaXToGltf(parax, gltf) NPL.load("(gl)script/ide/System/Scene/Assets/ParaXModelAttr.lua"); local ParaXModelAttr = commonlib.gettable("System.Scene.Assets.ParaXModelAttr"); local attr = ParaXModelAttr:new():initFromAssetFile(parax, function(attr) if (attr:SaveToGltf(gltf)) then local Files = commonlib.gettable("MyCompany.Aries.Game.Common.Files"); _guihelper.MessageBox(string.format(L"成功导出:%s, 是否打开所在目录", commonlib.Encoding.DefaultToUtf8(gltf)), function(res) if(res and res == _guihelper.DialogResult.Yes) then local info = Files.ResolveFilePath(gltf) if(info and info.relativeToRootPath) then local absPath = ParaIO.GetWritablePath()..info.relativeToRootPath; local absPathFolder = absPath:gsub("[^/\\]+$", "") ParaGlobal.ShellExecute("open", absPathFolder, "", "", 1); end end end, _guihelper.MessageBoxButtons.YesNo); else _guihelper.MessageBox(L"parax模型中的纹理加载失败,请稍后重试!"); end end) end local options; options, cmd_text = CmdParser.ParseOptions(cmd_text); if (options.region) then local data = {}; CmdParser.ParseStringList(cmd_text, data); local regions = {}; for i = 1, #data do local r = {}; CmdParser.ParseNumberList(data[i], r, "_"); if (#r > 1) then if (i == 1) then table.insert(regions, {r[1], r[2]}); else for j = 1, #regions-1 do if (r[1] ~= regions[j][1] or r[2] ~= regions[j][2]) then table.insert(regions, {r[1], r[2]}); end end end end end options = {} options.command = "region"; options.regions = regions; if (#regions > 1) then local min_x, min_z, max_x, max_z = 255, 255, 0, 0 for i =1, #regions do if (min_x > regions[i][1]) then min_x = regions[i][1] end if (min_z > regions[i][2]) then min_z = regions[i][2] end if (max_x < regions[i][1]) then max_x = regions[i][1] end if (max_z < regions[i][2]) then max_z = regions[i][2] end end if ((max_x - min_x + 1) * (max_z - min_z + 1) > #regions) then _guihelper.MessageBox(L"导出失败,所输入的 regions 不相连"); return; end end else local x1, y1, z1, cmd_text = CmdParser.ParsePos(cmd_text, fromEntity); if (x1 and y1 and z1) then local x2, y2, z2 = CmdParser.ParsePos(cmd_text, fromEntity); if (x2 and y2 and z2) then options.command = "range"; options.from = {x1, y1, z1}; options.to = {x2, y2, z2}; else options.command = "radius"; options.x = x1; options.y = y1; options.z = z1; end else local filename; filename, cmd_text = CmdParser.ParseFilename(cmd_text); local ext = ParaIO.GetFileExtension(filename); if (ext == "x") then -- export parax to gltf(glb) local gltf = cmd_text; if (not gltf) then gltf = ParaIO.ChangeFileExtension(filename, "glb"); end if(ParaIO.DoesFileExist(gltf)) then _guihelper.MessageBox(format(L"文件 %s 已经存在, 是否覆盖?", commonlib.Encoding.DefaultToUtf8(gltf)), function(res) if(res and res == _guihelper.DialogResult.Yes) then ParaXToGltf(filename, gltf); end end, _guihelper.MessageBoxButtons.YesNo); else ParaXToGltf(filename, gltf); end return; else -- export selected blocks to gltf(glb) if (not filename) then return end local selected_blocks = Game.SelectionManager:GetSelectedBlocks(); if (selected_blocks) then options.blocks_string = commonlib.serialize_compact(selected_blocks, true); else _guihelper.MessageBox(L"请先选择物体, Ctrl+左键多次点击场景可选择"); return; end filename = GameLogic.current_worlddir.."blocktemplates/"..filename options.filename = filename; options.command = "selected"; end end end NPL.load("(gl)script/apps/Aries/Creator/Game/World/Exporter/BlocksExport.lua"); local BlocksExport = commonlib.gettable("MyCompany.Aries.Creator.Game.Exporter.BlocksExport"); BlocksExport.Run(options); end, }; Commands["copy"] = { name="copy", quick_ref="/copy", desc=[[copy the current selection to clipboad, as if Ctrl+C is pressed. e.g. /copy ]], handler = function(cmd_name, cmd_text, cmd_params, fromEntity) NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/SelectBlocksTask.lua"); local SelectBlocks = commonlib.gettable("MyCompany.Aries.Game.Tasks.SelectBlocks"); if(SelectBlocks.GetCurrentInstance()) then SelectBlocks.GetCurrentInstance():CopyBlocks(); end end, }; Commands["paste"] = { name="paste", quick_ref="/paste [-offset] x y z", desc=[[paste the current selection to destination, as if Ctrl+V is pressed but at given precise location. e.g. /paste -offset 512 0 512 /paste /paste 19200 5 19200 /paste ~2 ~ ~ ]], handler = function(cmd_name, cmd_text, cmd_params, fromEntity) local options; options, cmd_text = CmdParser.ParseOptions(cmd_text, true); local x, y, z, cmd_text = CmdParser.ParsePos(cmd_text, fromEntity); NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/SelectBlocksTask.lua"); local SelectBlocks = commonlib.gettable("MyCompany.Aries.Game.Tasks.SelectBlocks"); if(options.offset and x) then local pivot = SelectBlocks:GetPivotInClipboard() if(pivot[1]) then x = x + pivot[1] y = y + pivot[2] z = z + pivot[3] else return end end SelectBlocks.PasteFromClipboard(x, y, z); end, };
gpl-2.0
DuFF14/OSVR-Unity
unity-generate.lua
4
1258
template = [[ public void RegisterCallback($WrappedCallback callback) { Start(); // make sure the interface is initialized. if (null == $WrappedList) { $WrappedList = callback; raw$WrappedCallback = new OSVR.ClientKit.$RawCallbackType($RawCallback); iface.registerCallback (raw$WrappedCallback, System.IntPtr.Zero); } else { $WrappedList += callback; } } private OSVR.ClientKit.$RawCallbackType raw$WrappedCallback; private $WrappedCallback $WrappedList; ]] function generate(data) s = string.gsub(template, "$(%w+)", function (n) return data[n] end) return s end print "/* BEGIN GENERATED CODE - unity-generate.lua */" print(generate{ WrappedCallback = "PoseMatrixCallback"; WrappedList = "poseMatrixCallbacks"; RawCallback = "PoseMatrixCb"; RawCallbackType = "PoseCallback"; }) for _, v in ipairs{"Pose", "Position", "Orientation", "Button", "Analog"} do local CapsName = v local nocapsName = v:sub(1, 1):lower() .. v:sub(2) local vals = { WrappedCallback = CapsName .. "Callback"; WrappedList = nocapsName .. "Callbacks"; RawCallback = CapsName .. "Cb"; RawCallbackType = CapsName .. "Callback"; } print(generate(vals)) end print "/* END GENERATED CODE - unity-generate.lua */"
apache-2.0
polymonster/pmtech
core/pen/project.lua
1
2830
local function setup_win32() if renderer_dir == "vulkan" then includedirs { "$(VK_SDK_PATH)/Include" } elseif renderer_dir == "opengl" then includedirs { "../../third_party/glew/include", "../../third_party/glew/src" } end systemversion(windows_sdk_version()) disablewarnings { "4800", "4305", "4018", "4244", "4267", "4996" } end local function setup_ios() files { "source/posix/**.cpp", "source/mach/**.cpp" } end local function setup_osx() files { "source/posix/**.cpp", "source/mach/**.cpp" } end local function setup_linux() files { "source/posix/**.cpp" } end local function setup_web() files { "source/posix/**.cpp", "source/linux/timer.cpp", "source/single_threaded/**.cpp" } excludes { "source/posix/threads.cpp" } end local function setup_android() files { "source/posix/**.cpp" } end local function setup_platform() if platform_dir == "win32" then setup_win32() elseif platform_dir == "osx" then setup_osx() elseif platform_dir == "linux" then setup_linux() elseif platform_dir == "android" then setup_android() elseif platform_dir == "ios" then setup_ios() elseif platform_dir == "web" then setup_web() end end -- Project project "pen" setup_env() setup_platform_defines() setup_platform() location ("build/" .. platform_dir) kind "StaticLib" language "C++" files { "include/*.h", "source/*.cpp", "include/" .. platform_dir .. "/**.h", "source/" .. platform_dir .. "/**.cpp", "source/" .. platform_dir .. "/**.mm", "../../third_party/str/*.cpp", } includedirs { "include", "include/" .. platform_dir, "../../third_party", "../../third_party/libstem_gamepad/source" } -- rendere selection, and allow for no renderer if string.len(renderer_dir) > 0 then files { "include/" .. renderer_dir .. "/**.h", "source/" .. renderer_dir .. "/**.cpp", "source/" .. renderer_dir .. "/**.mm", } includedirs { "include/" .. renderer_dir, } end configuration "Release" defines { "NDEBUG" } entrypoint "WinMainCRTStartup" optimize "Speed" targetdir ("lib/" .. platform_dir .. "/release") targetname "pen" configuration "Debug" defines { "DEBUG" } entrypoint "WinMainCRTStartup" symbols "On" targetdir ("lib/" .. platform_dir .. "/debug") targetname "pen"
mit
Lleafll/sws-lleaf
libs/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua
42
3995
--[[----------------------------------------------------------------------------- Icon Widget -------------------------------------------------------------------------------]] local Type, Version = "Icon", 21 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end -- Lua APIs local select, pairs, print = select, pairs, print -- WoW APIs local CreateFrame, UIParent, GetBuildInfo = CreateFrame, UIParent, GetBuildInfo --[[----------------------------------------------------------------------------- Scripts -------------------------------------------------------------------------------]] local function Control_OnEnter(frame) frame.obj:Fire("OnEnter") end local function Control_OnLeave(frame) frame.obj:Fire("OnLeave") end local function Button_OnClick(frame, button) frame.obj:Fire("OnClick", button) AceGUI:ClearFocus() end --[[----------------------------------------------------------------------------- Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) self:SetHeight(110) self:SetWidth(110) self:SetLabel() self:SetImage(nil) self:SetImageSize(64, 64) self:SetDisabled(false) end, -- ["OnRelease"] = nil, ["SetLabel"] = function(self, text) if text and text ~= "" then self.label:Show() self.label:SetText(text) self:SetHeight(self.image:GetHeight() + 25) else self.label:Hide() self:SetHeight(self.image:GetHeight() + 10) end end, ["SetImage"] = function(self, path, ...) local image = self.image image:SetTexture(path) if image:GetTexture() then local n = select("#", ...) if n == 4 or n == 8 then image:SetTexCoord(...) else image:SetTexCoord(0, 1, 0, 1) end end end, ["SetImageSize"] = function(self, width, height) self.image:SetWidth(width) self.image:SetHeight(height) --self.frame:SetWidth(width + 30) if self.label:IsShown() then self:SetHeight(height + 25) else self:SetHeight(height + 10) end end, ["SetDisabled"] = function(self, disabled) self.disabled = disabled if disabled then self.frame:Disable() self.label:SetTextColor(0.5, 0.5, 0.5) self.image:SetVertexColor(0.5, 0.5, 0.5, 0.5) else self.frame:Enable() self.label:SetTextColor(1, 1, 1) self.image:SetVertexColor(1, 1, 1, 1) end end } --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] local function Constructor() local frame = CreateFrame("Button", nil, UIParent) frame:Hide() frame:EnableMouse(true) frame:SetScript("OnEnter", Control_OnEnter) frame:SetScript("OnLeave", Control_OnLeave) frame:SetScript("OnClick", Button_OnClick) local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlight") label:SetPoint("BOTTOMLEFT") label:SetPoint("BOTTOMRIGHT") label:SetJustifyH("CENTER") label:SetJustifyV("TOP") label:SetHeight(18) local image = frame:CreateTexture(nil, "BACKGROUND") image:SetWidth(64) image:SetHeight(64) image:SetPoint("TOP", 0, -5) local highlight = frame:CreateTexture(nil, "HIGHLIGHT") highlight:SetAllPoints(image) highlight:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight") highlight:SetTexCoord(0, 1, 0.23, 0.77) highlight:SetBlendMode("ADD") local widget = { label = label, image = image, frame = frame, type = Type } for method, func in pairs(methods) do widget[method] = func end -- SetText is deprecated, but keep it around for a while. (say, to WoW 4.0) if (select(4, GetBuildInfo()) < 40000) then widget.SetText = widget.SetLabel else widget.SetText = function(self, ...) print("AceGUI-3.0-Icon: SetText is deprecated! Use SetLabel instead!"); self:SetLabel(...) end end return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version)
mit
flyzjhz/witi-openwrt
package/ramips/ui/luci-mtk/src/applications/luci-asterisk/luasrc/model/cbi/asterisk/phones.lua
80
2946
--[[ LuCI - Lua Configuration Interface Copyright 2008 Jo-Philipp Wich <xm@subsignal.org> 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 $Id$ ]]-- local ast = require("luci.asterisk") cbimap = Map("asterisk", "Registered Phones") cbimap.pageaction = false local sip_peers = { } cbimap.uci:foreach("asterisk", "sip", function(s) if s.type ~= "peer" then s.name = s['.name'] s.info = ast.sip.peer(s.name) sip_peers[s.name] = s end end) sip_table = cbimap:section(TypedSection, "sip", "SIP Phones") sip_table.template = "cbi/tblsection" sip_table.extedit = luci.dispatcher.build_url("admin", "asterisk", "phones", "sip", "%s") sip_table.addremove = true function sip_table.filter(self, s) return s and not cbimap.uci:get_bool("asterisk", s, "provider") end function sip_table.create(self, section) if TypedSection.create(self, section) then created = section cbimap.uci:tset("asterisk", section, { type = "friend", qualify = "yes", provider = "no", host = "dynamic", nat = "no", canreinvite = "no", extension = section:match("^%d+$") and section or "", username = section:match("^%d+$") and section or "" }) else self.invalid_cts = true end end function sip_table.parse(self, ...) TypedSection.parse(self, ...) if created then cbimap.uci:save("asterisk") luci.http.redirect(luci.dispatcher.build_url( "admin", "asterisk", "phones", "sip", created )) end end user = sip_table:option(DummyValue, "username", "Username") function user.cfgvalue(self, s) return sip_peers[s] and sip_peers[s].callerid or AbstractValue.cfgvalue(self, s) end host = sip_table:option(DummyValue, "host", "Hostname") function host.cfgvalue(self, s) if sip_peers[s] and sip_peers[s].info.address then return "%s:%i" %{ sip_peers[s].info.address, sip_peers[s].info.port } else return "n/a" end end context = sip_table:option(DummyValue, "context", "Dialplan") context.href = luci.dispatcher.build_url("admin", "asterisk", "dialplan") online = sip_table:option(DummyValue, "online", "Registered") function online.cfgvalue(self, s) if sip_peers[s] and sip_peers[s].info.online == nil then return "n/a" else return sip_peers[s] and sip_peers[s].info.online and "yes" or "no (%s)" % { sip_peers[s] and sip_peers[s].info.Status:lower() or "unknown" } end end delay = sip_table:option(DummyValue, "delay", "Delay") function delay.cfgvalue(self, s) if sip_peers[s] and sip_peers[s].info.online then return "%i ms" % sip_peers[s].info.delay else return "n/a" end end info = sip_table:option(Button, "_info", "Info") function info.write(self, s) luci.http.redirect(luci.dispatcher.build_url( "admin", "asterisk", "phones", "sip", s, "info" )) end return cbimap
gpl-2.0
Guard13007/LuaFuck
old/spec.lua
1
1656
-- NOTE: This file is kept for historical reasons of I like looking at my -- original design. No other reason for its existence here. --[[ Brainfuck spec: > move pointer right < move pointer left + increment memory at pointer - decrement memory at pointer . output character of memory at pointer , input character to memory at pointer [ jump to matching ] if memory at pointer == 0 ] jump to matching [ if memory at pointer ~= 0 --]] -- Bootstrap code to make translating to Lua easy: local cell = 0 local memory = {} local toCharacter = string.char -- converts ## to char local writeOut = io.write -- to default out local toInteger = string.byte -- converts char to ## -- readIn is implemented with a buffer -- because using io.read() directly doesn't work local readBuffer = "" local function readIn() if readBuffer:len() == 0 then readBuffer = io.read() end local out = readBuffer:sub(1,1) readBuffer = readBuffer:sub(2) return out end -- Make sure cells are "initially" zero: setmetatable(memory, {__index = function(Table, key) return 0 end}) -- Brainfuck to Lua translations: --Instruction ">" cell = cell + 1 --Instruction "<" cell = cell - 1 --Instruction "+" memory[cell] = memory[cell] + 1 if memory[cell] > 255 then memory[cell] = 0 end --Instruction "-" memory[cell] = memory[cell] - 1 if memory[cell] < 0 then memory[cell] = 255 end --Instruction "." writeOut(toCharacter(memory[cell])) --Instruction "," memory[cell] = toInteger(readIn()) --Instruction "[" while memory[cell] ~= 0 do --Instruction "]" end
mit
james2doyle/lit
main.lua
2
1921
--[[ Copyright 2014-2015 The Luvit Authors. 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 bundle = require('luvi').bundle loadstring(bundle.readfile("luvit-loader.lua"), "bundle:luvit-loader.lua")() local uv = require('uv') require('snapshot') local aliases = { ["-v"] = "version", ["-h"] = "help", } _G.p = require('pretty-print').prettyPrint local version = require('./package').version coroutine.wrap(function () local log = require('log').log local command = args[1] or "help" if command:sub(1, 2) == "--" then command = command:sub(3) end command = aliases[command] or command local invalid = false local success, err = xpcall(function () log("lit version", version) log("luvi version", require('luvi').version) if command == "version" then os.exit(0) end local path = "./commands/" .. command .. ".lua" if bundle.stat(path:sub(3)) then log("command", table.concat(args, " "), "highlight") else invalid = command log("invalid command", command, "failure") command = "help" path = "./commands/" .. command .. ".lua" end require(path)() end, debug.traceback) if invalid then success = false err = "Invalid Command: " .. invalid end if success then log("done", "success", "success") print() os.exit(0) else log("fail", err, "failure") print() os.exit(-1) end end)() uv.run()
apache-2.0
RyMarq/Zero-K
scripts/pw_wormhole.lua
8
1862
include "constants.lua" local base = piece('base') local panel1, panel2 = piece('pannel1', 'pannel2') local slider1, slider2, focal1, focal2 = piece('slider1', 'slider2', 'focal1', 'focal2') local wheel1, wheel2 = piece('wheel1', 'wheel2') local turret, cylinder, cannon, cannonbase = piece('turret', 'cylinder', 'canon', 'canonbase') local drone = piece('drone') local spin = math.rad(60) local function SliderAnim(piece, reverse) local dist = 9 * (reverse and -1 or 1) while true do Move(piece, z_axis, dist, 4) WaitForMove(piece, z_axis) Move(piece, z_axis, -dist, 4) WaitForMove(piece, z_axis) end end function script.Create() if Spring.GetUnitRulesParam(unitID, "planetwarsDisable") == 1 or GG.applyPlanetwarsDisable then return end Spin(wheel1, x_axis, spin) Spin(wheel2, x_axis, spin) --StartThread(SliderAnim, slider1) --StartThread(SliderAnim, slider2) Spin(focal1, y_axis, spin) Spin(focal2, y_axis, -spin) end function script.AimFromWeapon(num) return drone end -- fake weapon, do not fire function script.AimWeapon(num) return false end function script.QueryWeapon(num) return drone end function script.Killed(recentDamage, maxHealth) local severity = recentDamage/maxHealth if severity < .5 then Explode(base, SFX.NONE) Explode(wheel1, SFX.NONE) Explode(wheel2, SFX.NONE) Explode(slider1, SFX.NONE) Explode(slider2, SFX.NONE) --Explode(focal1, SFX.FALL) --Explode(focal2, SFX.FALL) --Explode(panel1, SFX.FALL) --Explode(panel2, SFX.FALL) return 1 else Explode(base, SFX.SHATTER) Explode(wheel1, SFX.SHATTER) Explode(wheel2, SFX.SHATTER) Explode(slider1, SFX.FALL + SFX.SMOKE + SFX.FIRE) Explode(slider2, SFX.FALL + SFX.SMOKE + SFX.FIRE) Explode(panel1, SFX.FALL + SFX.SMOKE + SFX.FIRE) Explode(panel2, SFX.FALL + SFX.SMOKE + SFX.FIRE) return 2 end end
gpl-2.0
ghostry/openwrt-gmod
luci/luci-app-v2ray/luasrc/model/cbi/v2ray/policy-level-detail.lua
1
1426
-- Copyright 2019-2020 Xingwang Liao <kuoruan@gmail.com> -- Licensed to the public under the MIT License. local dsp = require "luci.dispatcher" local m, s, o local sid = arg[1] m = Map("v2ray", "%s - %s" % { translate("V2Ray"), translate("Edit Policy Level") }, translatef("Details: %s", "<a href=\"https://www.v2ray.com/en/configuration/policy.html#levelpolicyobject\" target=\"_blank\">LevelPolicyObject</a>")) m.redirect = dsp.build_url("admin/services/v2ray/policy") if m.uci:get("v2ray", sid) ~= "policy_level" then luci.http.redirect(m.redirect) return end s = m:section(NamedSection, sid, "policy_level") s.anonymous = true s.addremove = false o = s:option(Value, "level", translate("Level")) o.rmempty = false o.datatype = "uinteger" o = s:option(Value, "handshake", translate("Handshake")) o.datatype = "uinteger" o.placeholder = "4" o = s:option(Value, "conn_idle", translate("Connection idle")) o.datatype = "uinteger" o.placeholder = "300" o = s:option(Value, "uplink_only", translate("Uplink only")) o.datatype = "uinteger" o.placeholder = "2" o = s:option(Value, "downlink_only", translate("Downlink only")) o.datatype = "uinteger" o.placeholder = "5" o = s:option(Flag, "stats_user_uplink", translate("Stats user uplink")) o = s:option(Flag, "stats_user_downlink", translate("Stats user downlink")) o = s:option(Value, "buffer_size", translate("Buffer size")) o.datatype = "uinteger" return m
apache-2.0
LuaDist2/zee
zee/emacs_bindings.lua
1
2803
-- Emacs key bindings -- Command execution key_bind ("Alt-x", "execute-command") key_bind ("Alt-!", "edit-shell-command") -- Navigation. Mostly arrows and things. -- Character/line key_bind ("Left", "move-previous-character") key_bind ("Ctrl-b", "move-previous-character") key_bind ("Right", "move-next-character") key_bind ("Ctrl-f", "move-next-character") key_bind ("Up", "move-previous-line") key_bind ("Ctrl-p", "move-previous-line") key_bind ("Down", "move-next-line") key_bind ("Ctrl-n", "move-next-line") -- Word/paragraph key_bind ("Ctrl-Left", "move-previous-word") key_bind ("Alt-Left", "move-previous-word") key_bind ("Alt-b", "move-previous-word") key_bind ("Ctrl-Right", "move-next-word") key_bind ("Alt-Right", "move-next-word") key_bind ("Alt-f", "move-next-word") key_bind ("Alt-{", "move-previous-paragraph") key_bind ("Alt-}", "move-next-paragraph") -- Line/page key_bind ("Home", "move-start-line") key_bind ("Ctrl-a", "move-start-line") key_bind ("End", "move-end-line") key_bind ("Ctrl-e", "move-end-line") key_bind ("PageUp", "move-previous-page") key_bind ("Alt-v", "move-previous-page") key_bind ("PageDown", "move-next-page") key_bind ("Ctrl-v", "move-next-page") -- Whole buffer key_bind ("Ctrl-Home", "move-start-file") key_bind ("Alt-<", "move-start-file") key_bind ("Ctrl-End", "move-end-file") key_bind ("Alt->,", "move-end-file") -- Window key_bind ("Ctrl-l", "view-refresh") -- Absolute navigation. These are like navigation commands but they -- don't become selection commands when combined with SHIFT. key_bind ("Ctrl-Alt-g", "move-goto-column") key_bind ("Alt-g", "move-goto-line") -- Selection -- select-other-end key_bind ("Ctrl-@", "edit-select-toggle") -- Save key_bind ("Alt-s", "file-save") -- Suspend key_bind ("Ctrl-z", "file-suspend") -- Quit key_bind ("Ctrl-Alt-q", "file-quit") -- Undo key_bind ("Ctrl-_", "edit-undo") -- Cut selection to clipboard key_bind ("Ctrl-w", "edit-cut") key_bind ("Alt-d", "edit-delete-word") -- Copy selection to clipboard key_bind ("Alt-w", "edit-copy") -- Delete without modifying clipboard key_bind ("Backspace", "edit-delete-previous-character") key_bind ("Ctrl-d", "edit-delete-next-character") key_bind ("Delete", "edit-delete-next-character") key_bind ("Alt-\\", "edit-delete-horizontal-space") -- Paste key_bind ("Ctrl-y", "edit-paste") -- Search key_bind ("Ctrl-s", "edit-find") key_bind ("Ctrl-r", "edit-find-backward") key_bind ("Alt-%", "edit-replace") -- Insert special characters key_bind ("Ctrl-j", "edit-insert-newline") key_bind ("Return", "edit-insert-newline-and-indent") key_bind ("Tab", "edit-indent-relative") key_bind ("Ctrl-q", "edit-insert-quoted") key_bind ("Alt-i", "edit-indent") -- Macros key_bind ("Alt-(", "macro-record") key_bind ("Alt-)", "macro-stop") key_bind ("Alt-e", "macro-play")
gpl-3.0
Laterus/Darkstar-Linux-Fork
scripts/zones/Port_Windurst/npcs/Papo-Hopo.lua
1
2912
----------------------------------- -- Area: Port Windurst -- NPC: Papo-Hopo ----------------------------------- package.loaded["scripts/globals/quests"] = nil; require("scripts/globals/quests"); require("scripts/globals/settings"); package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil; require("scripts/zones/Port_Windurst/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) TruthJusticeOnionWay = player:getQuestStatus(WINDURST,TRUTH_JUSTICE_AND_THE_ONION_WAY); KnowOnesOnions = player:getQuestStatus(WINDURST,KNOW_ONE_S_ONIONS); InspectorsGadget = player:getQuestStatus(WINDURST,INSPECTOR_S_GADGET); OnionRings = player:getQuestStatus(WINDURST,ONION_RINGS); CryingOverOnions = player:getQuestStatus(WINDURST,CRYING_OVER_ONIONS); ThePromise = player:getQuestStatus(WINDURST,THE_PROMISE); if (ThePromise == QUEST_COMPLETED) then Message = math.random(0,1) if (Message == 1) then player:startEvent(0x0219); else player:startEvent(0x020d); end elseif (ThePromise == QUEST_ACCEPTED) then player:startEvent(0x0203); elseif (CryingOverOnions == QUEST_COMPLETED) then player:startEvent(0x01fd); elseif (CryingOverOnions == QUEST_ACCEPTED) then CryingOverOnionsVar = player:getVar("CryingOverOnions"); if (CryingOverOnionsVar >= 1) then player:startEvent(0x01fc); else player:startEvent(0x01f5); end elseif (OnionRings == QUEST_COMPLETED) then player:startEvent(0x01b9); elseif (OnionRings == QUEST_ACCEPTED ) then player:startEvent(0x01b2); elseif (InspectorsGadget == QUEST_COMPLETED) then player:startEvent(0x01a8); elseif (InspectorsGadget == QUEST_ACCEPTED) then player:startEvent(0x01a0); elseif (KnowOnesOnions == QUEST_COMPLETED) then player:startEvent(0x0193); elseif (KnowOnesOnions == QUEST_ACCEPTED) then KnowOnesOnionsVar = player:getVar("KnowOnesOnions"); if (KnowOnesOnionsVar == 2) then player:startEvent(0x0192); else player:startEvent(0x0189); end elseif (TruthJusticeOnionWay == QUEST_COMPLETED) then player:startEvent(0x017c); elseif (TruthJusticeOnionWay == QUEST_ACCEPTED) then player:startEvent(0x0174); else player:startEvent(0x016a); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID2: %u",csid); --printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
hfjgjfg/eli25
plugins/xkcd.lua
628
1374
do function get_last_id() local res,code = https.request("http://xkcd.com/info.0.json") if code ~= 200 then return "HTTP ERROR" end local data = json:decode(res) return data.num end function get_xkcd(id) local res,code = http.request("http://xkcd.com/"..id.."/info.0.json") if code ~= 200 then return "HTTP ERROR" end local data = json:decode(res) local link_image = data.img if link_image:sub(0,2) == '//' then link_image = msg.text:sub(3,-1) end return link_image, data.title, data.alt end function get_xkcd_random() local last = get_last_id() local i = math.random(1, last) return get_xkcd(i) end function send_title(cb_extra, success, result) if success then local message = cb_extra[2] .. "\n" .. cb_extra[3] send_msg(cb_extra[1], message, ok_cb, false) end end function run(msg, matches) local receiver = get_receiver(msg) if matches[1] == "!xkcd" then url, title, alt = get_xkcd_random() else url, title, alt = get_xkcd(matches[1]) end file_path = download_to_file(url) send_photo(receiver, file_path, send_title, {receiver, title, alt}) return false end return { description = "Send comic images from xkcd", usage = {"!xkcd (id): Send an xkcd image and title. If not id, send a random one"}, patterns = { "^!xkcd$", "^!xkcd (%d+)", "xkcd.com/(%d+)" }, run = run } end
gpl-2.0
madpilot78/ntopng
scripts/lua/admin/host_pools.lua
1
39385
-- -- (C) 2019-21 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path require "lua_utils" local host_pools_utils = require "host_pools_utils" local discover = require "discover_utils" local template = require "template_utils" local graph_utils = require "graph_utils" local page_utils = require "page_utils" sendHTTPContentTypeHeader('text/html') if not isAdministratorOrPrintErr() then return end page_utils.set_active_menu_entry(page_utils.menu_entries.pools_host) -- append the menu above the page dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua") page_utils.print_page_title(i18n("host_pools.host_pools")) -- ************************************* ------ local pool_add_warnings = {} if _POST["edit_pools"] ~= nil then local config = paramsPairsDecode(_POST, true) for pool_id, pool_name in pairs(config) do -- Filter pool ids only if tonumber(pool_id) ~= nil then host_pools_utils.createPool(pool_id, pool_name, nil --[[ children_safe ]], nil --[[ enforce_quotas_per_pool_member ]], nil --[[ enforce_shapers_per_pool_member ]], true --[[ create or rename ]]) end end -- Reload is required here to load the new metadata ntop.reloadHostPools() elseif _POST["pool_to_delete"] ~= nil then local pool_id = _POST["pool_to_delete"] host_pools_utils.deletePool(pool_id) -- Note: this will also reload the shaping rules ntop.reloadHostPools() elseif (_POST["edit_members"] ~= nil) then local pool_to_edit = _POST["pool"] local config = paramsPairsDecode(_POST, true) local sanitized = {} -- Sanitize parameters for new_member, value in pairs(config) do if not isValidPoolMember(new_member) then http_lint.validationError(_POST, "new_member", new_member, "Invalid pool member") end local parts = split(value, "|") if #parts ~= 3 then http_lint.validationError(_POST, "member_values", parts, "Invalid member values") end local assembled = { old_member = parts[1], alias = parts[2], icon = parts[3], } -- Convention: use uppercase letters for mac, lowercase for ip if isMacAddress(new_member) then new_member = string.upper(new_member) else new_member = string.lower(new_member) end if (not isEmptyString(old_member)) and (not isValidPoolMember(assembled.old_member)) then http_lint.validationError(_POST, "old_member", new_member, "Invalid pool member") end if not http_lint.validateUnchecked(assembled.alias) then http_lint.validationError(_POST, "alias", assembled.alias, "Invalid member alias") end if not http_lint.validateSingleWord(assembled.icon) then http_lint.validationError(_POST, "icon", assembled.icon, "Invalid member icon") end local hostinfo = hostkey2hostinfo(new_member) local network, prefix = splitNetworkPrefix(hostinfo.host) local already_added = false if prefix ~= nil then local masked = ntop.networkPrefix(network, prefix) if masked ~= network then -- Normalize new networks (extract their prefix) local new_key = host2member(masked, hostinfo.vlan, prefix) pool_add_warnings[#pool_add_warnings + 1] = i18n("host_pools.network_normalized", { network = hostinfo2hostkey(hostkey2hostinfo(new_member)), network_normalized = hostinfo2hostkey(hostkey2hostinfo(new_key)) }) sanitized[new_key] = assembled already_added = true end end if not already_added then sanitized[new_member] = assembled end end config = sanitized -- This code handles member address changes -- delete old addresses for k,value in pairs(table.clone(config) --[[ Work on a copy to modify the original while iterating ]]) do local old_member = value.old_member if((not isEmptyString(old_member)) and (k ~= old_member)) then if config[old_member] then -- Do not delete and re-add members which have only changed their list key config[old_member].old_member = old_member else host_pools_utils.deletePoolMember(pool_to_edit, old_member) end end end -- add new addresses for new_member,value in pairs(config) do local k = value.old_member local is_new_member = (k ~= new_member) if is_new_member then local res, info = host_pools_utils.addPoolMember(pool_to_edit, new_member) if (res == false) and (info.existing_member_pool ~= nil) then -- remove @0 local member_to_print = hostinfo2hostkey(hostkey2hostinfo(new_member)) pool_add_warnings[#pool_add_warnings + 1] = i18n("host_pools.member_exists", { member_name = member_to_print, member_pool = host_pools_utils.getPoolName(info.existing_member_pool) }) end end local host_key, is_network = host_pools_utils.getMemberKey(new_member) if not is_network then local alias = value.alias local skip_alias = false if isMacAddress(new_member) then local manuf = ntop.getMacManufacturer(new_member) if (manuf ~= nil) and (manuf.extended == alias) then -- this is not the alias, it is the manufacturer skip_alias = true end end if(((not is_new_member) or (not isEmptyString(alias))) and (not skip_alias)) then setHostAltName(host_key, alias) end local icon = tonumber(value.icon) if (not isEmptyString(icon)) and ((not is_new_member) or (icon ~= 0)) and isMacAddress(new_member) and new_member ~= "00:00:00:00:00:00" then setCustomDeviceType(new_member, icon) ntop.setMacDeviceType(new_member, icon, true --[[ overwrite ]]) end end end ntop.reloadHostPools() elseif _POST["member_to_delete"] ~= nil then local pool_to_edit = _POST["pool"] host_pools_utils.deletePoolMember(pool_to_edit, _POST["member_to_delete"]) ntop.reloadHostPools() elseif _POST["empty_pool"] ~= nil then host_pools_utils.emptyPool(_POST["empty_pool"]) ntop.reloadHostPools() elseif (_POST["member"] ~= nil) and (_POST["pool"] ~= nil) then -- change member pool host_pools_utils.changeMemberPool(_POST["member"], _POST["pool"], nil, true --[[do not consider host MAC]]) ntop.reloadHostPools() end function printPoolNameField(pool_id_str) print[[<div class="form-group mb-3 has-feedback" style="margin-bottom:0;">]] print[[<input name="pool_' + ]] print(pool_id_str) print[[ + '" class="form-control" spellcheck="false" data-unique="unique" placeholder="]] print(i18n("host_pools.specify_pool_name")) print[[" required/>]] print[[<div class="help-block with-errors" style="margin-bottom:0;"></div>]] print[[</div>]] end function printMemberAddressField(member_str, origin_value_str) print[[<div class="form-group mb-3 has-feedback" style="margin-bottom:0;">]] print[[<input name="member_' + ]] print(member_str) print[[ + '" class="form-control" spellcheck="false" data-address="address" data-member="member" placeholder="]] print(i18n("host_pools.specify_member_address")) print[["]] if not isEmptyString(origin_value_str) then print[[ data-origin-value="' + ]] print(origin_value_str) print[[ + '"]] end print[[ required/>]] print[[<div class="help-block with-errors" style="margin-bottom:0;"></div>]] print[[</div>]] end function printMemberVlanField(member_str) print[[<div class="form-group mb-3 has-feedback" style="margin-bottom:0;">]] print[[<input name="member_' + ]] print(member_str) print[[ + '_vlan" class="form-control text-end" data-member="member" style="width:5em; padding-right:1em; margin: 0 auto;" type="number" min="0" value="0" required/>]] print[[<div class="help-block with-errors" style="margin-bottom:0;"></div>]] print[[</div>]] end function printIconField(member_str) discover.printDeviceTypeSelector("", "icon_member_' + " .. member_str .. " + '") end function printAliasField(member_str) print[[<input name="alias_member_' + ]] print(member_str) print[[ + '" class="form-control" />]] end -------------------------------------------------------------------------------- local selected_pool_id = _GET["pool"] local selected_pool = nil local available_pools = host_pools_utils.getPoolsList() for _, pool in ipairs(available_pools) do if pool.id == selected_pool_id then selected_pool = pool end end if selected_pool == nil then if #available_pools == 1 then -- only the default pool is available selected_pool = available_pools[1] else selected_pool = available_pools[2] end end -- We are passing too much _POST data, no more than 5 members allowed local perPageMembers = "5" local perPagePools = "10" local members_filtering = _GET["members_filter"] local manage_url = "?ifid="..ifId.."&page=pools&pool="..selected_pool.id.."#manage" local ifstats = interface.getStats() -------------------------------------------------------------------------------- print [[ <ul id="hostPoolsNav" class="nav nav-tabs" role="tablist"> <li class="nav-item"><a class="nav-link" data-bs-toggle="tab" role="tab" href="#manage">]] print(i18n("host_pools.manage_pools")) print[[</a></li> <li class="nav-item"><a class="nav-link" data-bs-toggle="tab" role="tab" href="#create">]] print(i18n("host_pools.create_pools")) print[[</a></li> </ul> <div class="tab-content"> <div id="manage" class="tab-pane"> <br/><table><tbody><tr> ]] print('<td style="white-space:nowrap; padding-right:1em;">') print(i18n("host_pools.pool")) print(': <select id="pool_selector" class="form-select pool-selector" style="display:inline; width:14em;" onchange="document.location.href=\'?ifid=') print(ifId.."") print('&page=pools&pool=\' + $(this).val() + \'#manage\';">') print(graph_utils.poolDropdown(ifId, selected_pool.id, {[host_pools_utils.DEFAULT_POOL_ID]=true})) print('</select>') local no_pools = (#available_pools <= 1) if selected_pool.id ~= host_pools_utils.DEFAULT_POOL_ID then if areHostPoolsTimeseriesEnabled(ifid) then print("&nbsp; <a href='"..ntop.getHttpPrefix().."/lua/pool_details.lua?pool="..selected_pool.id.."&page=historical' title='Chart'><i class='fas fa-chart-area'></i></a>") end end print('</td>\n') local function formatMemberFilter() if starts(members_filtering, "manuf:") then return i18n("host_pools.manufacturer_filter", {manufacturer=string.sub(members_filtering, string.len("manuf:")+1)}) else return i18n("host_pools.member_filter", {member=split(members_filtering, "/")[1]}) end end if members_filtering ~= nil then print[[ <td> <form action="#manage"> <input type="hidden" name="ifid" value="]] print(ifId.."") print[[" /> <input type="hidden" name="page" value="pools" /> <input type="hidden" name="pool" value="]] print(selected_pool.id) print[[" /> <button type="button" class="btn btn-secondary btn-sm" onclick="$(this).closest('form').submit();"> <i class="fas fa-times fa-lg" aria-hidden="true" data-original-title="" title=""></i> ]] print(formatMemberFilter()) print[[ </button> </form> </td> ]] end print('<td style="width:100%"></td><td>') print( template.gen("typeahead_input.html", { typeahead={ base_id = "t_member", action = ntop.getHttpPrefix() .. "/lua/if_stats.lua#manage", parameters = { pool = selected_pool.id, ifid = tostring(ifId), page = "pools", }, json_key = "key", query_field = "members_filter", query_url = ntop.getHttpPrefix() .. "/lua/find_member.lua", query_title = i18n("host_pools.search_member"), style = "margin-left:1em; width:25em;", } }) ) print('</td>') print('</tr></tbody></table>') if no_pools then print[[<script>$("#pool_selector").attr("disabled", "disabled");</script>]] end for _, msg in ipairs(pool_add_warnings) do print([[ <div class="alert alert-warning alert-dismissible" style="margin-top:2em; margin-bottom:0em;"> <b>]]..i18n("warning")..[[</b>: ]]..msg..[[ <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div>]]) end print[[ <form id="table-manage-form"> <br/><div id="table-manage"></div> <button class="btn btn-primary" style="float:right; margin-right:1em;" disabled="disabled" type="submit">]] print(i18n("save_settings")) print[[</button> </form> ]] if not ntop.isEnterpriseM() and not ntop.isnEdgeEnterprise() then print[[<span style="float:left;">]] print(i18n("notes")) print[[<ul> <li>]] print(i18n("host_pools.max_members_message", {maxnum = host_pools_utils.LIMITED_NUMBER_POOL_MEMBERS})) print[[</li> </ul> </span>]] end print[[ <button id="emptyPoolButton" class="btn btn-secondary" onclick="$('#empty_pool_dialog').modal('show');" style="float:right; margin-right:1em;"><i class="fas fa-trash" aria-hidden="true"></i> ]] print(i18n("host_pools.empty_pool")) print[[</button> ]] print[[ <br/><br/> </div> <div id="create" class="tab-pane"> <form id="table-create-form"> <br/><div id="table-create"></div> <button class="btn btn-primary" style="float:right; margin-right:1em;" disabled="disabled" type="submit">]] print(i18n("save_settings")) print[[</button> </form> <div style="float:left"> <form action="/lua/rest/v2/get/pool/config.lua" class="form-inline" method="GET" data-ays-ignore="true"> <input type="hidden" name="ifid" value="]] print(tostring(ifId)) print[[" /> <input type="hidden" name="download" value="true" /> <button type="submit" class="btn btn-secondary"><span>]] print(i18n("host_pools.config_export")) print[[</span></button> </form> <button id="import-modal-btn" data-bs-toggle="modal" data-target="#import-modal" class="btn btn-secondary"><span>]] print(i18n("host_pools.config_import")) print[[</span></button> </div> <br/><br/>]] local notes = {} if ntop.isnEdge() then notes[#notes + 1] = "<li>"..i18n("host_pools.cannot_delete_cp")..".</li>" end if not ntop.isEnterpriseM() and not ntop.isnEdgeEnterprise() then notes[#notes + 1] = "<li>"..i18n("host_pools.max_pools_message", {maxnum=host_pools_utils.LIMITED_NUMBER_USER_HOST_POOLS}).."</li>" end if #notes > 0 then print(i18n("notes")) print[[<ul>]] for _, note in ipairs(notes) do print(note) end print[[</ul>]] end print[[ </div> </div> ]] -- Create delete dialogs print( template.gen("modal_confirm_dialog.html", { dialog={ id = "delete_pool_dialog", action = "deletePool(delete_pool_id)", title = i18n("host_pools.delete_pool"), message = i18n("host_pools.confirm_delete_pool") .. ' "<span id=\"delete_pool_dialog_pool\"></span>", ' .. i18n("host_pools.and_associated_members").."?", confirm = i18n("delete"), } }) ) print( template.gen("modal_confirm_dialog.html", { dialog={ id = "delete_member_dialog", action = "deletePoolMember(delete_member_id)", title = i18n("host_pools.remove_member"), message = i18n("host_pools.confirm_remove_member") .. ' "<span id=\"delete_member_dialog_member\"></span>" ' .. i18n("host_pools.from_pool") .. ' "' .. selected_pool.name .. '"?', confirm = i18n("remove"), } }) ) print( template.gen("modal_confirm_dialog.html", { dialog={ id = "empty_pool_dialog", action = "emptyCurrentPool()", title = i18n("host_pools.empty_pool"), message = i18n("host_pools.confirm_empty_pool") .. " " .. selected_pool.name.."?", confirm = i18n("host_pools.empty_pool"), } }) ) print( template.gen("modal_confirm_dialog.html", { dialog={ id = "change_member_pool_dialog", action = "changeMemberPool(change_member_id)", title = i18n("host_pools.change_member_pool"), message = i18n("host_pools.select_new_pool", {member='<span id="change_member_pool_dialog_member"></span>'}) .. '<br><br><select class="form-select" id="changed_host_pool" style="width:15em;">'.. graph_utils.poolDropdown(ifId, "", {[selected_pool.id]=true, [host_pools_utils.DEFAULT_POOL_ID]=true}).. '</select>', custom_alert_class = "", confirm = i18n("host_pools.change_pool"), } }) ) -- Create import dialog print( template.gen("import_modal.html", { dialog={ title = i18n("host_pools.config_import"), label = "", message = i18n("host_pools.config_import_message"), cancel = i18n("cancel"), apply = i18n("apply"), } }) ) print[[ <script> const import_csrf = ']] print(ntop.getRandomCSRFValue()) print[['; $('#import-modal-btn').on("click", function(e) { // hide previous errors $("#import-error").hide(); $("#import-modal form").off("submit"); $('#btn-confirm-import').off('click').click(function(e) { const $button = $(this); let applied_value = null; $button.attr("disabled", ""); // Read configuration file file var file = $('#import-input')[0].files[0]; if (!file) { $("#import-error").text(`${i18n.no_file}`).show(); // re-enable button $button.removeAttr("disabled"); } else { var reader = new FileReader(); reader.onload = function () { // Client-side configuration file format check let json_conf = null try { json_conf = JSON.parse(reader.result); } catch (e) {} if (!json_conf || !json_conf['0']) { $("#import-error").text(`${i18n.invalid_file}`).show(); // re-enable button $button.removeAttr("disabled"); } else { // Submit configuration file $.post(`${http_prefix}/lua/rest/v2/set/pool/config.lua`, { csrf: import_csrf, JSON: JSON.stringify(json_conf) }) .done((d, status, xhr) => { if(xhr.status != 200) { $("#import-error").text("]] print(i18n("request_failed_message")) print [[" + xhr.statusText).show(); } else if(d["rc_str"] != "OK") { $("#import-error").text(d.rc_str).show(); } else { location.reload(); } }) .fail(({ status, statusText }) => { $("#import-error").text(status + ": " + statusText).show(); // re-enable button $button.removeAttr("disabled"); }); }; } reader.readAsText(file, "UTF-8"); } }); $("#import-modal").on("submit", "form", function (e) { e.preventDefault(); $("#btn-import").trigger("click"); }); }); </script> ]] -------------------------------------------------------------------------------- print[[ <script> function recheckFields(input) { var member = input.val(); var tr = input.closest("tr"); var vlan_field = tr.find("td:nth-child(2) input"); var icon_field = tr.find("td:nth-child(3) input"); var select_field = tr.find("td:nth-child(4) select"); var vlanicon_disabled = null; if (NtopUtils.is_mac_address(member)) { vlan_field.attr("disabled", true); vlanicon_disabled = false; select_field.attr("disabled", false); } else { var cidr = NtopUtils.is_network_mask(member, true); select_field.attr("disabled", true); if (cidr) { vlan_field.removeAttr("disabled"); if((cidr.type == "ipv6" && cidr.mask == 128) || (cidr.type == "ipv4" && cidr.mask == 32)) { /* Custom alias only allowed for IP addresses */ vlanicon_disabled = false; } else { vlanicon_disabled = true; } } } if (vlanicon_disabled != null) { icon_field.attr("disabled", vlanicon_disabled); } if (]] print(ternary(ifstats.has_macs, "false", "true")) print[[) select_field.attr("disabled", true); } /* Make the pair address,vlan unique */ function addressValidator(input) { var member = input.val(); /* this will be checked separately */ if (! member) return true; recheckFields(input); return memberValueValidator(input); } function memberValidator(input) { var member = input.val(); /* this will be checked separately */ if (! member) return true; var is_mac = NtopUtils.is_mac_address(member); var identifier; if(is_mac) { identifier = member; } else { var address_value; var vlan_value; if (input.attr("name").endsWith("_vlan")) { var name = input.attr("name").split("_vlan")[0]; address_value = $("input[name='" + name + "']", $("#table-manage-form")).val(); vlan_value = member; } else { var name = input.attr("name") + "_vlan"; address_value = member; vlan_value = $("input[name='" + name + "']", $("#table-manage-form")).val(); } is_cidr = NtopUtils.is_network_mask(address_value, true); if (! is_cidr) /* this will be handled by addressValidator */ return true; identifier = is_cidr.address + "/" + is_cidr.mask + "@" + vlan_value; } identifier = identifier.toLowerCase(); var count = 0; $('input[name^="member_"]:not([name$="_vlan"])', $("#table-manage-form")).each(function() { var address_value = $(this).val(); var is_cidr = NtopUtils.is_network_mask(address_value, true); var aggregated; if (! is_cidr) { aggregated = address_value; } else { var name = $(this).attr("name") + "_vlan"; vlan_value = $("input[name='" + name + "']", $("#table-manage-form")).val(); aggregated = is_cidr.address + "/" + is_cidr.mask + "@" + vlan_value; } aggregated = aggregated.toLowerCase() if (aggregated === identifier) count++; }); return count == 1; } function poolNameUnique(input) { /* First update the host_pools names */ datatableForEachRow("#table-create", function() { var pool_id = $("td:nth-child(1)", $(this)).html(); var pool_name = $("td:nth-child(2) input", $(this)).val(); for (var i=0; i<host_pools.length; i++) if (host_pools[i].id == pool_id) host_pools[i].name = pool_name; }); var name = input.val(); var count = 0; for (i=0; i<host_pools.length; i++) { if (host_pools[i].name === name) count++; } return count == 1; } ]] if members_filtering ~= nil then print[[$("#pool_selector").attr("disabled", true);]] end print[[ </script> ]] -- ==== Manage tab ==== print [[ <script> var addedMemberCtr = 0; var curDisplayedMembers = 0; var numPoolMembers = 0; var validator_options = { disable: true, custom: { member: memberValidator, address: addressValidator, unique: poolNameUnique, }, errors: { member: "]] print(i18n("host_pools.duplicate_member")) print[[.", address: "]] print(i18n("host_pools.invalid_member")) print[[.", unique: "]] print(i18n("host_pools.duplicate_pool")) print[[.", } } function decPoolMembers() { curDisplayedMembers--; numPoolMembers--; } function addPoolMember() { if($("#addPoolMemberBtn").attr("disabled")) return; if (datatableIsEmpty("#table-manage")) datatableRemoveEmptyRow("#table-manage"); var member_id = addedMemberCtr++; var newid = "member_" + member_id; numPoolMembers++; var tr = $('<tr id=' + newid + '><td>]] printMemberAddressField('member_id') print[[</td><td class="text-center">]] printMemberVlanField('member_id') print[[</td><td>]] printAliasField('member_id') print[[</td><td>]] printIconField('member_id') print[[</td><td class="text-center"></td></tr>'); datatableAddDeleteButtonCallback.bind(tr)(5, "datatableUndoAddRow('#" + newid + "', ']] print(i18n("host_pools.empty_pool")) print[[', '#addPoolMemberBtn', 'decPoolMembers')", "]] print(i18n('undo')) print[["); $("#table-manage table").append(tr); $("input", tr).first().focus(); var icon = $("td:nth-child(4)", tr); var icon_input = $("select", icon).first(); curDisplayedMembers++; var is_disabled = ((curDisplayedMembers > ]] print(perPageMembers) print[[) || (numPoolMembers >= ]] print(host_pools_utils.LIMITED_NUMBER_POOL_MEMBERS.."") print[[)); if(is_disabled) $("#addPoolMemberBtn").addClass("disabled").attr("disabled", "disabled"); else $("#addPoolMemberBtn").removeClass("disabled").removeAttr("disabled"); aysRecheckForm("#table-manage-form"); } function deletePoolMember(member_id) { var form = $("#table-manage-form"); var field = form.find("input[name='member_" + member_id + "']"); if (field.attr("data-origin-value")) { var params = {}; params.pool = ]] print(selected_pool.id) print[[; params.member_to_delete = field.attr("data-origin-value"); params.csrf = "]] print(ntop.getRandomCSRFValue()) print[["; NtopUtils.paramsToForm('<form method="post" action="]] print(manage_url) print[["></form>', params).appendTo('body').submit(); } } function emptyCurrentPool() { var params = {}; params.empty_pool = ]] print(selected_pool.id) print[[; params.csrf = "]] print(ntop.getRandomCSRFValue()) print[["; NtopUtils.paramsToForm('<form method="post"></form>', params).appendTo('body').submit(); } function changeMemberPool(member_id) { var form = $("#table-manage-form"); var field = form.find("input[name='member_" + member_id + "']"); if (field.attr("data-origin-value")) { var params = {}; params.pool = $("#changed_host_pool").val(); params.member = field.attr("data-origin-value"); params.csrf = "]] print(ntop.getRandomCSRFValue()) print[["; NtopUtils.paramsToForm('<form method="post" action="]] print(manage_url) print[["></form>', params).appendTo('body').submit(); } } $("#table-manage").datatable({ url: "]] print (ntop.getHttpPrefix()) print [[/lua/get_host_pools.lua?ifid=]] print(ifId.."") print[[&pool=]] print(selected_pool.id) print[[&members_filter=]] print(members_filtering or "") print[[", title: "", perPage: ]] print(perPageMembers) print[[, forceTable: true, hidePerPage: true, buttons: [ '<a id="addPoolMemberBtn" onclick="addPoolMember()" role="button" class="add-on btn" data-bs-toggle="modal"><i class="fas fa-plus" aria-hidden="true"></i></a>' ], columns: [ { title: "]] print(i18n("host_pools.member_address")) print[[", field: "column_member", css: { textAlign: 'left', } }, { title: "VLAN", field: "column_vlan", css: { width: '1%', textAlign: 'center', } }, { title: "]] print(i18n("host_pools.alias_or_manufacturer")) print[[", field: "column_alias", css: { width: '25%', textAlign: 'center', whiteSpace: 'nowrap', } }, { title: "Device Type", field: "column_icon", css: { width: '12%', textAlign: 'center', whiteSpace: 'nowrap', } }, { title: "]] print(i18n("actions")) print[[", css : { width: '20%', textAlign: 'center', } }, { field: "column_link", hidden: true, }, { field: "column_editable", hidden: true, } ], tableCallback: function() { var no_pools = false; curDisplayedMembers = 0; if (]] print(selected_pool.id) print[[ == ]] print(host_pools_utils.DEFAULT_POOL_ID) print[[) { datatableAddEmptyRow("#table-manage", "]] print(i18n("host_pools.no_pools_defined") .. " " .. i18n("host_pools.create_pool_hint")) print[["); no_pools = true; } else if(datatableIsEmpty("#table-manage")) { datatableAddEmptyRow("#table-manage", "]] print(i18n("host_pools.empty_pool")) print[["); $("#emptyPoolButton").attr("disabled", "disabled"); } else { datatableForEachRow("#table-manage", function() { var member_address = $("td:nth-child(1)", $(this)); var vlan = $("td:nth-child(2)", $(this)); var alias = $("td:nth-child(3)", $(this)); var icon = $("td:nth-child(4)", $(this)); var link_value = $("td:nth-child(6)", $(this)).html().replace(/&nbsp;/gi,''); var editable = $("td:nth-child(7)", $(this)).html() == "true"; var member_id = addedMemberCtr++; curDisplayedMembers++; /* Make member name editable */ var value = member_address.html(); var is_cidr = NtopUtils.is_network_mask(value); if (is_cidr) { old_value = member_address.html() + '@' + vlan.html(); if (((is_cidr.type == "ipv4" && is_cidr.mask == 32)) || ((is_cidr.type == "ipv6" && is_cidr.mask == 128))) value = is_cidr.address; } else { old_value = member_address.html(); } var input = $(']] printMemberAddressField('member_id', 'old_value') print[['); var address_input = $("input", input).first(); address_input.val(value); member_address.html(input); /* Alias field */ var input = $(']] printAliasField('member_id') print[['); input.val(alias.html().replace(/&nbsp;/gi,'')); alias.html(input); /* Icon field */ var div = $(']] printIconField('member_id') print[['); input = $("select", div); input.val(icon.html().replace(/&nbsp;/gi,'')); icon.html(div); /* Make vlan editable */ var input = $(']] printMemberVlanField('member_id') print[['); var vlan_value = parseInt(vlan.html()); var vlan_input = $("input", input).first() vlan_input.val(vlan_value); vlan.html(input); recheckFields(address_input); if (! editable) { address_input.attr("disabled", "disabled"); vlan_input.attr("disabled", "disabled"); } if ((vlan_value > 0) && (is_cidr)) value = value + " [VLAN " + vlan_value + "]"; ]] if #available_pools > 2 then print[[ datatableAddActionButtonCallback.bind(this)(5, "change_member_id ='" + member_id + "'; $('#change_member_pool_dialog_member').html('" + value +"'); $('#change_member_pool_dialog').modal('show');", "]] print(i18n("host_pools.change_pool")) print[[");]] end print[[ datatableAddLinkButtonCallback.bind(this)(5, link_value, "]] print(i18n("host_pools.view")) print[["); if (!link_value) $("td:nth(5) a:nth(1)", this).css("visibility", "hidden"); datatableAddDeleteButtonCallback.bind(this)(5, "delete_member_id ='" + member_id + "'; $('#delete_member_dialog_member').html('" + value +"'); $('#delete_member_dialog').modal('show');", "]] print(i18n('delete')) print[["); }); if(numPoolMembers === 0) numPoolMembers = $("#table-manage").data("datatable").resultset.num_pool_members || 0; aysResetForm('#table-manage-form'); } var is_disabled = (((! datatableIsLastPage("#table-manage-form")) || (no_pools)) || (]] if members_filtering ~= nil then print("true") else print("false") end print[[) || (curDisplayedMembers > ]] print(perPageMembers) print[[) || (numPoolMembers >= ]] print(host_pools_utils.LIMITED_NUMBER_POOL_MEMBERS.."") print[[)); if(is_disabled) $("#addPoolMemberBtn").addClass("disabled").attr("disabled", "disabled"); else $("#addPoolMemberBtn").removeClass("disabled").removeAttr("disabled"); $("#table-manage-form") .validator(validator_options) .on('submit', checkManagePoolForm); } }); function checkManagePoolForm(event) { if (event.isDefaultPrevented()) return false; var form = $("#table-manage-form"); // build the settings object var settings = {}; $('input[name^="member_"]:not([name$="_vlan"])', form).each(function() { var address = null; if((member = NtopUtils.is_network_mask($(this).val(), true))) { /* this is a network */ var vlan_name = $(this).attr("name") + "_vlan"; var vlan_field = $("input[name=" + vlan_name + "]", form); if (vlan_field.length == 1) address = member.address + "/" + member.mask + "@" + vlan_field.val(); } else { /* this is a mac */ address = $(this).val(); } var original; if($(this).attr("data-origin-value")) original = $(this).attr("data-origin-value"); else original = ""; if (address !== null) { var alias_name = "alias_" + $(this).attr("name"); var alias_field = $("input[name=" + alias_name + "]", form); var alias = alias_field.val(); var icon_name = "icon_" + $(this).attr("name"); var icon_field = $("select[name=" + icon_name + "]", form); var icon = icon_field.val(); settings[address] = [original, alias, icon].join("|"); } }); // reset ays so that we can submit a custom form aysResetForm(form); // create a form with key-values encoded var params = NtopUtils.paramsPairsEncode(settings); params.edit_members = ""; params.pool = ]] print(selected_pool.id) print[[; params.csrf = "]] print(ntop.getRandomCSRFValue()) print[["; NtopUtils.paramsToForm('<form method="post" action="]] print(manage_url) print[["></form>', params).appendTo('body').submit(); return false; } </script> ]] -- ==== Create tab ==== print [[ <script> /* Assumption: this is sorted by pool id with possible gaps */ var host_pools = ]] print(tableToJsObject(available_pools)) print[[; var maxPoolsNum = ]] print(tostring(host_pools_utils.LIMITED_NUMBER_TOTAL_HOST_POOLS)) print[[; function nextPoolId() { for (var i=0; i<host_pools.length-1; i++) if (parseInt(host_pools[i].id) + 1 < parseInt(host_pools[i+1].id)) return parseInt(host_pools[i].id) + 1; return parseInt(host_pools[host_pools.length-1].id) + 1; } function deletePool(pool_id) { var params = {}; params.pool_to_delete = pool_id; params.csrf = "]] print(ntop.getRandomCSRFValue()) print[["; var form = NtopUtils.paramsToForm('<form method="post"></form>', params); if (pool_id == ]] print(selected_pool.id) print[[) form.attr("action", "?ifid=]] print(tostring(ifId)) print[[&page=pools#create"); form.appendTo('body').submit(); } function onPoolAddUndo(newid) { var pool_id = newid.split("added_pool_")[1]; if (pool_id) { for (var i=0; i<host_pools.length; i++) { if (parseInt(host_pools[i].id) == pool_id) { /* Remove the element at index i */ host_pools.splice(i, 1); break; } } } } function addPool() { if($("#addNewPoolBtn").attr("disabled")) return; var pool_id = nextPoolId(); if (pool_id < maxPoolsNum) { if (datatableIsEmpty("#table-create")) datatableRemoveEmptyRow("#table-create"); var newid = "added_pool_" + pool_id; /* Add at 'pool_id' position */ host_pools.splice(pool_id, 0, {id:pool_id}); var tr = $('<tr id=' + newid + '><td class="text-center" style="display:none;">' + pool_id + '</td><td>]] printPoolNameField('pool_id') print[[</td><td align="center"></td></tr>'); datatableAddDeleteButtonCallback.bind(tr)(3, "datatableUndoAddRow('#" + newid + "', ']] print(i18n("host_pools.no_pools_defined")) print[[', '#addNewPoolBtn', 'onPoolAddUndo')", "]] print(i18n('undo')) print[["); $("#table-create table").append(tr); $("input", tr).focus(); aysRecheckForm("#table-create-form"); } recheckPoolAddButton(); } function recheckPoolAddButton() { /* TODO use array size and perPage */ var displayed_items = datatableGetNumDisplayedItems("#table-create"); var numPools = host_pools.length; if ((numPools >= maxPoolsNum) || (displayed_items > ]] print(perPagePools) print[[) || (! datatableIsLastPage("#table-create-form"))) $("#addNewPoolBtn").attr("disabled", "disabled").addClass("disabled"); else $("#addNewPoolBtn").removeAttr("disabled").removeClass("disabled"); } $("#table-create").datatable({ url: "]] print (ntop.getHttpPrefix()) print [[/lua/get_host_pools.lua?ifid=]] print(ifId.."") print[[", title: "", showPagination: true, forceTable: true, hidePerPage: true, perPage: ]] print(perPagePools) print[[, buttons: [ '<a id="addNewPoolBtn" onclick="addPool()" role="button" class="add-on btn" data-bs-toggle="modal"><i class="fas fa-plus" aria-hidden="true"></i></a>' ], columns: [ { field: "column_pool_id", hidden: true, }, { title: "]] print(i18n("host_pools.pool_name")) print[[", field: "column_pool_name", css: { textAlign: 'left', width: '50%', } }, { field: "column_pool_undeletable", hidden: true, }, { title: "]] print(i18n("actions")) print[[", css : { width: '15%', textAlign: 'center', } }, { field: "column_pool_link", hidden: true, } ], tableCallback: function() { var pools_ctr = 0; if(datatableIsEmpty("#table-create")) { datatableAddEmptyRow("#table-create", "]] print(i18n("host_pools.no_pools_defined")) print[["); } else { datatableForEachRow("#table-create", function() { var pool_id = $("td:nth-child(1)", $(this)).html(); var pool_name = $("td:nth-child(2)", $(this)); var pool_undeletable = $("td:nth-child(3)", $(this)).html() === "true"; var pool_link = $("td:nth-child(5)", $(this)).html(); /* Make pool name editable */ var input = $(']] printPoolNameField('pool_id') print[['); var value = pool_name.html(); $("input", input).first().val(value); pool_name.html(input); if (pool_id == ]] print(host_pools_utils.DEFAULT_POOL_ID) print[[) { $("input", input).first().attr("disabled", "disabled"); } else { datatableAddLinkButtonCallback.bind(this)(4, pool_link, "View"); value = value.replace("'", "\\'"); datatableAddDeleteButtonCallback.bind(this)(4, "delete_pool_id ='" + pool_id + "'; $('#delete_pool_dialog_pool').html('" + value + "'); $('#delete_pool_dialog').modal('show');", "]] print(i18n('delete')) print[["); if (pool_undeletable) $("td:nth-child(4) a", $(this)).last().attr("disabled", "disabled"); } pools_ctr++; }); aysResetForm('#table-create-form'); } recheckPoolAddButton(); $("#table-create-form") .validator(validator_options) .on('submit', checkCreatePoolForm); } }); function checkCreatePoolForm(event) { if (event.isDefaultPrevented()) return false; var form = $("#table-create-form"); // build the settings object var settings = {}; $("input[name^='pool_']", form).each(function() { var pool_id = $(this).attr("name").split("pool_")[1]; settings[pool_id] = $(this).val(); }); // reset ays so that we can submit a custom form aysResetForm(form); // create a form with key-values encoded var params = NtopUtils.paramsPairsEncode(settings); params.edit_pools = ""; params.csrf = "]] print(ntop.getRandomCSRFValue()) print[["; NtopUtils.paramsToForm('<form method="post"></form>', params).appendTo('body').submit(); return false; } </script> ]] print[[ <script> NtopUtils.handle_tab_state($("#hostPoolsNav"), "manage"); aysHandleForm("form", { handle_datatable: true, handle_tabs: true, ays_options: {addRemoveFieldsMarksDirty: true} }); /* Retrigger the validation every second to clear outdated errors */ setInterval(function() { $("form:data(bs.validator)").each(function(){ $(this).data("bs.validator").validate(); }); }, 1000); </script> ]] -- ************************************* ------ -- append the menu below the page dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
gpl-3.0
Laterus/Darkstar-Linux-Fork
scripts/zones/Port_San_dOria/npcs/Solgierte.lua
1
1398
----------------------------------- -- Area: Port San d'Oria -- NPC: Solgierte -- Standard Info NPC ----------------------------------- package.loaded["scripts/globals/quests"] = nil; require("scripts/globals/quests"); package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil; require("scripts/zones/Port_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then count = trade:getItemCount(); MagicFlyer = trade:hasItemQty(MagicmartFlyer,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x237); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
RyMarq/Zero-K
effects/vindicator.lua
7
7720
-- vindimuzzle -- vindiback -- uw_vindiback -- uw_amphlift return { ["vindimuzzle"] = { fluffy = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.6, useairlos = false, colormap = [[1 1 1 1 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 15, emitvector = [[dir]], gravity = [[0, 0, 0]], numparticles = 1, particlelife = 3, particlelifespread = 5, particlesize = 10, particlesizespread = 0, particlespeed = 8, particlespeedspread = 0, pos = [[0, 0, 0]], sizegrowth = 0.2, sizemod = 1.0, texture = [[smokesmall]], }, }, }, ["vindiback"] = { fire = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.6, useairlos = false, colormap = [[1 1 0 0.9 1 0.8 0.3 08 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 15, emitvector = [[dir]], gravity = [[0, 0, 0]], numparticles = 2, particlelife = 6, particlelifespread = 0, particlesize = 5, particlesizespread = 0, particlespeed = 2, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0.5, sizemod = 1.0, texture = [[orangesmoke2]], }, }, fluffy = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.6, useairlos = false, colormap = [[1 1 1 1 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 30, emitvector = [[dir]], gravity = [[0, 0, 0]], numparticles = 3, particlelife = 3, particlelifespread = 5, particlesize = 10, particlesizespread = 0, particlespeed = 7, particlespeedspread = 6, pos = [[0, 0, 0]], sizegrowth = 0.2, sizemod = 1.0, texture = [[smokesmall]], }, }, takeoff1 = { air = false, useairlos = false, class = [[CSimpleParticleSystem]], count = 1, ground = true, underwater = 0, water = false, properties = { airdrag = 0.95, colormap = [[0 0 0 0.001 0.04 0.04 0.04 0.2 0 0 0 0.001]], emitrot = 90, emitrotspread = 0, emitvector = [[0, 1, 0]], gravity = [[0, -0.1, 0]], numparticles = 15, particlelife = 40, particlelifespread = 0, particlesize = 4, particlesizespread = 1, particlespeed = 5, particlespeedspread = 0, pos = [[15, 1, 0]], sizegrowth = 0.3, sizemod = 1.0, texture = [[kfoam]], }, }, }, ["uw_vindiback"] = { fire = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, underwater = true, properties = { airdrag = 0.6, useairlos = false, colormap = [[1 1 0 0.9 1 0.8 0.3 08 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 15, emitvector = [[dir]], gravity = [[0, 0, 0]], numparticles = 2, particlelife = 12, particlelifespread = 0, particlesize = 5, particlesizespread = 0, particlespeed = 1, particlespeedspread = 1, pos = [[0, 0, 0]], sizegrowth = 0.5, sizemod = 1.0, texture = [[orangesmoke2]], }, }, fluffy = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, underwater = true, properties = { airdrag = 0.6, useairlos = false, colormap = [[1 1 1 1 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 30, emitvector = [[dir]], gravity = [[0, 0, 0]], numparticles = 3, particlelife = 6, particlelifespread = 10, particlesize = 10, particlesizespread = 0, particlespeed = 3.5, particlespeedspread = 3, pos = [[0, 0, 0]], sizegrowth = 0.2, sizemod = 1.0, texture = [[smokesmall]], }, }, takeoff1 = { air = false, useairlos = false, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = false, underwater = true, properties = { airdrag = 0.95, colormap = [[0 0 0 0.001 0.04 0.04 0.04 0.2 0 0 0 0.001]], emitrot = 90, emitrotspread = 0, emitvector = [[0, 1, 0]], gravity = [[0, 0.005, 0]], numparticles = 15, particlelife = 80, particlelifespread = 0, particlesize = 4, particlesizespread = 1, particlespeed = 2.5, particlespeedspread = 0, pos = [[0, 0, 0]], sizegrowth = 0.3, sizemod = 1.0, texture = [[kfoam]], }, }, }, ["uw_amphlift"] = { takeoff1 = { air = false, useairlos = false, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = false, underwater = true, properties = { airdrag = 0.95, colormap = [[0 0 0 0.001 0.04 0.04 0.04 0.2 0 0 0 0.001]], emitrot = 90, emitrotspread = 0, emitvector = [[0, 1, 0]], gravity = [[0, 0.005, 0]], numparticles = 15, particlelife = 80, particlelifespread = 0, particlesize = 4, particlesizespread = 1, particlespeed = 2.5, particlespeedspread = 0, pos = [[0, 0, 0]], sizegrowth = 0.3, sizemod = 1.0, texture = [[kfoam]], }, }, }, }
gpl-2.0
pakoito/ToME---t-engine4
game/engines/default/engine/UserChat.lua
2
28883
-- TE4 - T-Engine 4 -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org require "engine.class" local Shader = require "engine.Shader" local KeyBind = require "engine.KeyBind" local Mouse = require "engine.Mouse" local Dialog = require "engine.ui.Dialog" local Slider = require "engine.ui.Slider" local Base = require "engine.ui.Base" --- Module that handles multiplayer chats module(..., package.seeall, class.inherit(Base)) local channel_colors = { } --- Creates the log zone function _M:init() self.changed = true self.channels_changed = true self.cur_channel = "global" self.channels = {} self.channel_codes = {} self.channel_codes_rev = {} self.max = 500 self.do_display_chans = true self.on_event = {} self.full_log = {} self.last_whispers = {} self.friends = {} end --- Hook up in the current running game function _M:setupOnGame() KeyBind:load("chat") _G.game.key:bindKeys() -- Make sure it updates _G.game.key:addBinds{ USERCHAT_TALK = function() self:talkBox() end, USERCHAT_SWITCH_CHANNEL = function() if not self.display_chans then return end for i = 1, #self.display_chans do if self.display_chans[i].name == self.cur_channel then self:selectChannel(self.display_chans[util.boundWrap(i + 1, 1, #self.display_chans)].name) if game.logChat then game.logChat("Talking in channel: %s", self.cur_channel) end break end end end, } local ok, UC = pcall(require, "mod.class.UserChatExtension") if ok and UC then self.uc_ext = UC.new(self) end end function _M:getChannelCode(chan) if not game then return "0" end if not self.channel_codes[chan] then local chans = table.keys(self.channels) table.sort(chans, function(a, b) if a == game.__mod_info.short_name then return 1 elseif b == game.__mod_info.short_name then return nil elseif a == game.__mod_info.short_name.."-spoiler" then return 1 elseif b == game.__mod_info.short_name.."-spoiler" then return nil else return a < b end end) self.channel_codes_rev = chans self.channel_codes = table.keys_to_values(chans) end return tostring(self.channel_codes[chan]) end --- Filter messages function _M:filterMessage(item) if config.settings.chat.filter[item.kind] then return true end if config.settings.chat.ignores[item.login] then return true end end function _M:ignoreUser(login) config.settings.chat.ignores[login] = true if game.log then game.log("Ignoring all new messages from %s.", login) end self:saveIgnores() end function _M:saveIgnores() local l = {} for k, v in pairs(config.settings.chat.ignores) do if v then l[#l+1] = "chat.ignores["..("%q"):format(k).."]=true" end end game:saveSettings("chat.ignores", table.concat(l, "\n")) end local urlfind = (lpeg.P"http://" + lpeg.P"https://") * (1-lpeg.P" ")^0 local urlmatch = lpeg.anywhere(lpeg.C(urlfind)) function _M:addMessage(kind, channel, login, name, msg, extra_data, no_change) if not self.channels[channel] then return end local color_name = colors.WHITE if type(name) == "table" then name, color_name = name[1], name[2] end local url = urlmatch:match(msg) if url then pcall(function() msg = msg:lpegSub(urlfind, "#LIGHT_BLUE##{italic}#"..url.."#{normal}##LAST#") end) end local item = {channel=channel, kind=kind, login=login, name=name, color_name=color_name, msg=msg, url=url, extra_data=extra_data, timestamp=core.game.getTime()} if self:filterMessage(item) then return end if self.uc_ext and self.uc_ext.filterMessage then if self.uc_ext:filterMessage(item) then return end end local log = self.channels[channel].log table.insert(log, 1, item) while #log > self.max do table.remove(log) end self.changed = true if not no_change and channel ~= self.cur_channel then self.channels[channel].changed = true self.channels_changed = true end local log = self.full_log table.insert(log, 1, item) while #log > self.max do table.remove(log) end if kind == "whisper" then local found = nil for i, l in ipairs(self.last_whispers) do if l == login then found = i break end end if not found then table.insert(self.last_whispers, 1, login) else table.remove(self.last_whispers, found) table.insert(self.last_whispers, 1, login) end end end --- Register to receive events function _M:registerTalkEvents(fct) self.on_event[fct] = true end --- Register to not receive events function _M:unregisterTalkEvents(fct) self.on_event[fct] = nil end function _M:event(e) if not profile.auth then return end if e.se == "Talk" then e.msg = e.msg:removeColorCodes() local color = colors.WHITE if e.status == 'dev' then color = colors.CRIMSON elseif e.status == 'mod' then color = colors.GOLD elseif e.donator == "oneshot" then color = colors.LIGHT_GREEN elseif e.donator == "recurring" then color = colors.ROYAL_BLUE end self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}} if profile and profile.auth and profile.auth.name then local ni, nj = e.msg:lower():find(profile.auth.name:lower(), 1, true) if ni and nj then e.msg = e.msg:sub(1, ni - 1).."#YELLOW##{underline}#"..profile.auth.name.."#{normal}##LAST#"..e.msg:sub(nj + 1) end end self:addMessage("talk", e.channel, e.login, {e.name, color}, e.msg) if type(game) == "table" and game.logChat and self.cur_channel == e.channel then game.logChat("#YELLOW#<%s> %s", e.name, e.msg) end elseif e.se == "Whisper" then e.msg = e.msg:removeColorCodes() local color = colors.WHITE if e.status == 'dev' then color = colors.CRIMSON elseif e.status == 'mod' then color = colors.GOLD elseif e.donator == "oneshot" then color = colors.LIGHT_GREEN elseif e.donator == "recurring" then color = colors.ROYAL_BLUE end self.channels[self.cur_channel] = self.channels[self.cur_channel] or {users={}, log={}} self:addMessage("whisper", self.cur_channel, e.login, e.name, e.msg) if type(game) == "table" and game.logChat then game.logChat("#GOLD#<Whisper from %s> %s", e.name, e.msg) end e.channel = self.cur_channel elseif e.se == "Achievement" then e.msg = e.msg:removeColorCodes() local color = colors.WHITE if e.status == 'dev' then color = colors.CRIMSON elseif e.status == 'mod' then color = colors.GOLD elseif e.donator == "oneshot" then color = colors.LIGHT_GREEN elseif e.donator == "recurring" then color = colors.ROYAL_BLUE end local kind = "achievement_other" if e.first then kind = "achievement_first" elseif e.huge then kind = "achievement_huge" end local acolor = "LIGHT_BLUE" if e.huge then acolor = "GOLD" end local first = "" if e.first then first = " for the #FIREBRICK#first time!" end self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}} self:addMessage(kind, e.channel, e.login, {e.name, color}, "#{italic}##"..acolor.."#has earned the achievement <"..e.msg..">"..first.."#{normal}#", nil, true) if type(game) == "table" and game.logChat and self.cur_channel == e.channel then game.logChat("#"..acolor.."#%s has earned the achievement <%s>%s", e.name, e.msg, first) end elseif e.se == "SerialData" then local color = colors.WHITE if e.status == 'dev' then color = colors.CRIMSON elseif e.status == 'mod' then color = colors.GOLD elseif e.donator == "oneshot" then color = colors.LIGHT_GREEN elseif e.donator == "recurring" then color = colors.ROYAL_BLUE end e.color_name = color local data = zlib.decompress(e.msg) if not data then return end data = data:unserialize() if not data then return end self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}} if data.kind == "donator-update" and data.donated > 0 then if world then pcall(function() if data.donated <= 5 then world:gainAchievement({id="BRONZE_DONATOR", no_difficulties=true}, game:getPlayer(true)) elseif data.donated <= 15 then world:gainAchievement({id="SILVER_DONATOR", no_difficulties=true}, game:getPlayer(true)) elseif data.donated <= 30 then world:gainAchievement({id="GOLD_DONATOR", no_difficulties=true}, game:getPlayer(true)) elseif data.donated <= 60 then world:gainAchievement({id="STRALITE_DONATOR", no_difficulties=true}, game:getPlayer(true)) else world:gainAchievement({id="VORATUN_DONATOR", no_difficulties=true}, game:getPlayer(true)) end end) end local text = ([[#{bold}#Thank you#{normal}# for you donation, your support means a lot for the continued survival of this game. Your current donation total is #LIGHT_GREEN#%0.2f euro#WHITE# which equals to #ROYAL_BLUE#%d voratun coins#WHITE# to use on te4.org. Your Item's Vault has #TEAL#%d slots#WHITE#. Again, thank you, and enjoy Eyal! #{italic}#Your malevolent local god of darkness, #GOLD#DarkGod#{normal}#]]):format(data.donated, data.donated * 10, data.items_vault_slots) Dialog:simpleLongPopup("Thank you!", text, 600) elseif self.uc_ext then self.uc_ext:event(e) end elseif e.se == "SelfJoin" then self:addMessage("join", e.channel, profile.auth.login, e.channel, "#{italic}#Joined channel#{normal}#", nil, true) self:updateChanList() self:saveChannels() elseif e.se == "SelfPart" then self:addMessage("join", e.channel, profile.auth.login, e.channel, "#{italic}#Left channel#{normal}#", nil, true) self.channels[e.channel] = nil self:updateChanList() self:saveChannels() elseif e.se == "Join" then local color = colors.WHITE if e.status == 'dev' then color = colors.CRIMSON elseif e.status == 'mod' then color = colors.GOLD elseif e.donator == "oneshot" then color = colors.LIGHT_GREEN elseif e.donator == "recurring" then color = colors.ROYAL_BLUE end self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}} self.channels[e.channel].users[e.login] = {name=e.name, donator=e.donator, status=e.status, login=e.login} self.channels_changed = true self:addMessage("join", e.channel, e.login, {e.name, color}, "#{italic}##FIREBRICK#has joined the channel#{normal}#", nil, true) if type(game) == "table" and game.logChat and e.channel == self.cur_channel then game.logChat("#{italic}##FIREBRICK#%s has joined channel %s (press space to talk).#{normal}#", e.login, e.channel) end self:updateChanList() elseif e.se == "Part" then local color = colors.WHITE if e.status == 'dev' then color = colors.CRIMSON elseif e.status == 'mod' then color = colors.GOLD elseif e.donator == "oneshot" then color = colors.LIGHT_GREEN elseif e.donator == "recurring" then color = colors.ROYAL_BLUE end self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}} self.channels[e.channel].users[e.login] = nil self.channels_changed = true self:addMessage("join", e.channel, e.login, {e.name, color}, "#{italic}##FIREBRICK#has left the channel#{normal}#", nil, true) if type(game) == "table" and game.logChat and e.channel == self.cur_channel then game.logChat("#{italic}##FIREBRICK#%s has left channel %s.#{normal}#", e.login, e.channel) end self:updateChanList() elseif e.se == "FriendJoin" then local color = colors.WHITE if e.status == 'dev' then color = colors.CRIMSON elseif e.status == 'mod' then color = colors.GOLD elseif e.donator == "oneshot" then color = colors.LIGHT_GREEN elseif e.donator == "recurring" then color = colors.ROYAL_BLUE end self.friends[e.login] = {name=e.name, donator=e.donator, status=e.status, login=e.login} if not e.silent then self:addMessage("friendjoin", self.cur_channel, e.login, {e.name, color}, "#{italic}##YELLOW_GREEN#has logged in#{normal}#", nil, true) if type(game) == "table" and game.logChat then game.logChat("#{italic}##YELLOW_GREEN#%s has logged in (press space to talk).#{normal}#", e.login, e.channel) end end elseif e.se == "FriendPart" then local color = colors.WHITE if e.status == 'dev' then color = colors.CRIMSON elseif e.status == 'mod' then color = colors.GOLD elseif e.donator == "oneshot" then color = colors.LIGHT_GREEN elseif e.donator == "recurring" then color = colors.ROYAL_BLUE end self.friends[e.login] = nil self:addMessage("friendpart", self.cur_channel, e.login, {e.name, color}, "#{italic}##CRIMSON#has logged off#{normal}#", nil, true) if type(game) == "table" and game.logChat then game.logChat("#{italic}##CRIMSON#%s has logged off.#{normal}#", e.login, e.channel) end elseif e.se == "UserInfo" then local info = e.data:unserialize() if not info then return end elseif e.se == "ChannelList" then local info = zlib.decompress(e.data):unserialize() if not info then return end if not e.channel or not self.channels[e.channel] then return end self.channels[e.channel].users = {} for _, user in ipairs(info.users) do self.channels[e.channel].users[user.login] = { id=user.id, login=user.login, name=user.name, donator=user.donator, status=user.status, current_char_data=user.current_char, current_char=user.current_char and user.current_char.title or "unknown", module=user.current_char and user.current_char.module or "unknown", valid=user.current_char and user.current_char.valid and "validate" or "not validated", } end self.channels_changed = true end for fct, _ in pairs(self.on_event) do fct(e) end end function _M:isFriend(login) return self.friends[login] end function _M:addFriend(login, id) core.profile.pushOrder(table.serialize{o="AddFriend", id=id}) end function _M:removeFriend(login, id) self.friends[login] = nil core.profile.pushOrder(table.serialize{o="RemoveFriend", id=id}) end function _M:join(channel) if not profile.auth then return end core.profile.pushOrder(string.format("o='ChatJoin' channel=%q", channel)) self.cur_channel = channel self.channels[channel] = self.channels[channel] or {users={}, log={}} self.channels_changed = true self.changed = true self:updateChanList(true) end function _M:part(channel) if not profile.auth then return end core.profile.pushOrder(string.format("o='ChatPart' channel=%q", channel)) self:setCurrentTarget(true, game.__mod_info.short_name) end function _M:saveChannels() local l = { "chat.channels = chat.channels or {}", "chat.channels["..string.format("%q", game.__mod_info.short_name).."]={}" } for k, v in pairs(profile.chat.channels) do if v then l[#l+1] = "chat.channels["..string.format("%q", game.__mod_info.short_name).."]["..string.format("%q", k).."]=true" end end game:saveSettings("chat.channels."..game.__mod_info.short_name, table.concat(l, "\n")) end function _M:selectChannel(channel, no_recurs) if not self.channels[channel] then return end self.channels[channel].changed = false self.cur_channel = channel self.channels_changed = true self.changed = true self.scroll = 0 self:updateChanList(true) if not no_recurs then self:setCurrentTarget(true, channel, true) end end function _M:talk(msg) if not profile.auth then return end if not msg or msg == "" then return end msg = msg:removeColorCodes() core.profile.pushOrder(string.format("o='ChatTalk' channel=%q msg=%q", self.cur_channel, msg)) end function _M:whisper(to, msg) if not profile.auth then return end if not to or not msg or msg == "" then return end msg = msg:removeColorCodes() core.profile.pushOrder(string.format("o='ChatWhisper' target=%q msg=%q", to, msg)) self:addMessage("whisper", self.cur_channel, to, ":"..to, msg) if type(game) == "table" and game.logChat then game.logChat("%s", msg) end for fct, _ in pairs(self.on_event) do fct{channel=self.cur_channel, se="JustUpdate"} end end function _M:reportUser(to, msg) if not profile.auth then return end if not to or not msg or msg == "" then return end msg = msg:removeColorCodes() core.profile.pushOrder(string.format("o='ReportUser' target=%q msg=%q", to, msg)) self:addMessage("report", self.cur_channel, to, to, "#VIOLET#Report for "..to.." sent.#LAST#") if type(game) == "table" and game.logChat then game.logChat("#VIOLET#Report for %s sent.#LAST#", to) end end function _M:achievement(name, huge, first) if not profile.auth then return end core.profile.pushOrder(string.format("o='ChatAchievement' channel=%q msg=%q huge=%s first=%s", self.cur_channel, name, tostring(huge), tostring(first))) end --- Request a line to send function _M:talkBox(on_end, only_friends) if not profile.auth then return end local Talkbox = require "engine.dialogs.Talkbox" local d = Talkbox.new(self, on_end, only_friends) if not d.nobody then game:registerDialog(d) end self:updateChanList() end --- Sets the current talk target, channel or whisper function _M:setCurrentTarget(channel, name, no_switch) if channel and not self.channels[name] then return end self.cur_target = {channel and "channel" or "whisper", name} if channel and not no_switch then self:selectChannel(name) end end --- Gets the current talk target, channel or whisper function _M:getCurrentTarget() if not self.cur_target then return "channel", self.cur_channel end return self.cur_target[1], self.cur_target[2] end function _M:findChannel(name) for cname, data in pairs(self.channels) do if cname:lower() == name:lower() then return cname end end end function _M:findUser(name) for login, data in pairs(self.friends) do print("===friendtest", data.name:lower(), name:lower()) if data.name:lower() == name:lower() then return data.name end end if not self.channels[self.cur_channel] then return end for login, data in pairs(self.channels[self.cur_channel].users) do if data.name:lower() == name:lower() then return data.name end end end function _M:updateChanList(force) local time = os.time() if force or not self.last_chan_update or self.last_chan_update + 60 < time then self.last_chan_update = time core.profile.pushOrder(string.format("o='ChatChannelList' channel=%q", self.cur_channel)) end end --- Display user infos function _M:showUserInfo(login) if not profile.auth then return end local popup = Dialog:simpleWaiter("Requesting...", "Requesting user info...") core.display.forceRedraw() core.profile.pushOrder(string.format("o='ChatUserInfo' login=%q", login)) local data = nil profile:waitEvent("UserInfo", function(e) data=e.data end, 5000) popup:done() if not data then Dialog:simplePopup("Error", "The server does not know about this player.") return end data = zlib.decompress(data):unserialize() local UserInfo = require "engine.dialogs.UserInfo" game:registerDialog(UserInfo.new(data)) end --- Get user infos function _M:getUserInfo(login) if not profile.auth then return end local popup = Dialog:simpleWaiter("Requesting...", "Requesting user info...") core.display.forceRedraw() core.profile.pushOrder(string.format("o='ChatUserInfo' login=%q", login)) local data = nil profile:waitEvent("UserInfo", function(e) data=e.data end, 5000) popup:done() if not data then return end data = zlib.decompress(data):unserialize() return data end ---------------------------------------------------------------- -- UI Section ---------------------------------------------------------------- --- Returns the full log function _M:getLog(channel, extra) channel = channel or self.cur_channel local log = {} if self.channels[channel] then for _, i in ipairs(self.channels[channel].log) do local tstr if i.kind == "whisper" then tstr = tstring{{"color", 0xcb,0x87,0xd2}, "<", i.name, "> "} elseif i.kind == "join" then tstr = tstring{{"color", "FIREBRICK"}, "[", i.name, "]" } else tstr = tstring{"<", {"color",unpack(colors.simple(i.color_name or colors.WHITE))}, i.name, {"color", "LAST"}, "> "} end tstr:merge(i.msg:toTString()) if extra then log[#log+1] = {str=tstr:toString(), src=i} else log[#log+1] = tstr:toString() end end end return log end function _M:getLogLast(channel) channel = channel or self.cur_channel if self.channels[channel] then if not self.channels[channel].log[1] then return 0 end return self.channels[channel].log[1].timestamp else return 0 end end --- Make a dialog popup with the full log function _M:showLogDialog(title, shadow) local log = self:getLog(self.cur_channel) local d = require_first("mod.dialogs.ShowLog", "engine.dialogs.ShowLog").new(title or "Chat Log", shadow, {log=log}) game:registerDialog(d) end --- Resize the display area function _M:resize(x, y, w, h, fontname, fontsize, color, bgcolor) self.color = color or {255,255,255} if type(bgcolor) ~= "string" then self.bgcolor = bgcolor or {0,0,0} else self.bgcolor = {0,0,0} self.bg_image = bgcolor end self.font = core.display.newFont(fontname or "/data/font/DroidSans.ttf", fontsize or 12) self.font_h = self.font:lineSkip() self.scroll = 0 self.changed = true self.frame_sel = self:makeFrame("ui/selector-sel", 1, 5 + self.font_h) self.frame = self:makeFrame("ui/selector", 1, 5 + self.font_h) self.display_x, self.display_y = math.floor(x), math.floor(y) self.w, self.h = math.floor(w), math.floor(h) self.fw, self.fh = self.w - 4, self.font:lineSkip() self.max_display = math.floor(self.h / self.fh) if self.bg_image then local fill = core.display.loadImage(self.bg_image) local fw, fh = fill:getSize() self.bg_surface = core.display.newSurface(w, h) self.bg_surface:erase(0, 0, 0) for i = 0, w, fw do for j = 0, h, fh do self.bg_surface:merge(fill, i, j) end end self.bg_texture, self.bg_texture_w, self.bg_texture_h = self.bg_surface:glTexture() end self.scrollbar = Slider.new{size=self.h - 20, max=1, inverse=true} self.mouse = Mouse.new() self.mouse.delegate_offset_x = self.display_x self.mouse.delegate_offset_y = self.display_y self.mouse:registerZone(0, 0, self.w, self.h, function(button, x, y, xrel, yrel, bx, by, event) self:mouseEvent(button, x, y, xrel, yrel, bx, by, event) end) self.last_chan_update = 0 end function _M:mouseEvent(button, x, y, xrel, yrel, bx, by, event) if button == "wheelup" then self:scrollUp(1) elseif button == "wheeldown" then self:scrollUp(-1) elseif event == "button" and button == "left" and y <= self.frame.h and self.do_display_chans then local w = 0 local last_ok = nil for i = 1, #self.display_chans do local item = self.display_chans[i] last_ok = item w = w + item.w + 4 if w > x then break end end if last_ok then local old = self.cur_channel self:selectChannel(last_ok.name) if old == self.cur_channel then self:showLogDialog(nil, self.shadow) end end else if not self.on_mouse or not self.dlist then return end local citem = nil local ci for i = 1, #self.dlist do local item = self.dlist[i] if item.dh and by >= item.dh - self.mouse.delegate_offset_y then citem = self.dlist[i].src ci=i break end end if citem and citem.url and button == "left" and event == "button" then util.browserOpenUrl(citem.url) else self.on_mouse(citem and citem.login and self.channels[self.cur_channel] and self.channels[self.cur_channel].users and self.channels[self.cur_channel].users[citem.login], citem and citem.login and citem, button, event, x, y, xrel, yrel, bx, by) end end end function _M:enableShadow(v) self.shadow = v end function _M:enableFading(v) self.fading = v end function _M:enableDisplayChans(v) self.do_display_chans = v end function _M:onMouse(fct) self.on_mouse = fct end function _M:display() -- Changed channels list if self.channels_changed then self.display_chans = {} local list = {} for name, data in pairs(self.channels) do list[#list+1] = name end table.sort(list, function(a,b) if a == "global" then return 1 elseif b == "global" then return nil else return a < b end end) for i, name in ipairs(list) do local oname = name local nb_users = 0 for _, _ in pairs(self.channels[name].users) do nb_users = nb_users + 1 end name = "["..name:capitalize().." ("..nb_users..")]" local len, lenh = self.font_mono:size(name) local s = core.display.newSurface(len + self.frame.b4.w + self.frame.b6.w, self.frame.h) s:drawColorStringBlended(self.font_mono, name, self.frame.b4.w, (self.frame.h - self.font_h) / 2, 0xFF, 0xFF, 0xFF, true, len) local item = {name=oname, w=len + self.frame.b4.w + self.frame.b6.w, h=self.frame.h, sel=oname == self.cur_channel} item._tex, item._tex_w, item._tex_h = s:glTexture() self.display_chans[#self.display_chans+1] = item end self.channels_changed = false end -- If nothing changed, return the same surface as before if not self.changed then return end self.changed = false -- Erase and the display self.dlist = {} local h = 0 local log = {} if self.full_log then log = self.full_log end local old_style = self.font:getStyle() for z = 1 + self.scroll, #log do local stop = false local tstr if log[z].kind == "whisper" then tstr = tstring{{"color", 0xcb,0x87,0xd2}, "<", log[z].name, ">" } elseif log[z].kind == "join" then tstr = tstring{{"color", "FIREBRICK"}, "[", self:getChannelCode(log[z].channel), "-", log[z].name, "]" } else tstr = tstring{"[", self:getChannelCode(log[z].channel), "-", log[z].channel, "] <", {"color",unpack(colors.simple(log[z].color_name))}, log[z].name, {"color", "LAST"}, "> "} end tstr:merge(log[z].msg:toTString()) local gen = tstring.makeLineTextures(tstr, self.w, self.font_mono) for i = #gen, 1, -1 do gen[i].login = log[z].login gen[i].extra_data = log[z].extra_data self.dlist[#self.dlist+1] = {item=gen[i], date=log[z].timestamp, src=log[z]} h = h + self.fh if h > self.h - self.fh - (self.do_display_chans and self.fh or 0) then stop=true break end end if stop then break end end self.font:setStyle(old_style) return end function _M:toScreen() self:display() local shader = Shader.default.textoutline and Shader.default.textoutline.shad if self.bg_texture then self.bg_texture:toScreenFull(self.display_x, self.display_y, self.w, self.h, self.bg_texture_w, self.bg_texture_h) end local h = self.display_y + self.h - self.fh local now = core.game.getTime() for i = 1, #self.dlist do local item = self.dlist[i].item local fade = 1 if self.fading and self.fading > 0 then fade = now - self.dlist[i].date if fade < self.fading * 1000 then fade = 1 elseif fade < self.fading * 2000 then fade = (self.fading * 2000 - fade) / (self.fading * 1000) else fade = 0 end self.dlist[i].src.faded = fade end self.dlist[i].dh = h if self.shadow then if shader then shader:use(true) shader:uniOutlineSize(0.7, 0.7) shader:uniTextSize(item._tex_w, item._tex_h) else item._tex:toScreenFull(self.display_x+2, h+2, item.w, item.h, item._tex_w, item._tex_h, 0,0,0, self.shadow * fade) end end item._tex:toScreenFull(self.display_x, h, item.w, item.h, item._tex_w, item._tex_h, 1, 1, 1, fade) if self.shadow and shader then shader:use(false) end h = h - self.fh end if self.do_display_chans then local w = 0 for i = 1, #self.display_chans do local item = self.display_chans[i] local f = item.sel and self.frame_sel or self.frame f.w = item.w Base:drawFrame(f, self.display_x + w, self.display_y) if self.channels[item.name].changed then local glow = (1+math.sin(core.game.getTime() / 500)) / 2 * 100 + 120 Base:drawFrame(f, self.display_x + w, self.display_y, 139/255, 210/255, 77/255, glow / 255) end item._tex:toScreenFull(self.display_x + w, self.display_y, item.w, item.h, item._tex_w, item._tex_h) w = w + item.w + 4 end end if not self.fading then self.scrollbar.pos = self.scroll self.scrollbar.max = self.max - self.max_display + 1 self.scrollbar:display(self.display_x + self.w - self.scrollbar.w, self.display_y) end end --- Scroll the zone -- @param i number representing how many lines to scroll function _M:scrollUp(i) local log = {} if self.channels[self.cur_channel] then log = self.channels[self.cur_channel].log end self.scroll = self.scroll + i if self.scroll > #log - 1 then self.scroll = #log - 1 end if self.scroll < 0 then self.scroll = 0 end self.changed = true self:resetFade() end function _M:resetFade() local log = {} if self.channels[self.cur_channel] then log = self.channels[self.cur_channel].log end -- Reset fade local time = core.game.getTime() for _, item in ipairs(log) do item.timestamp = time end end
gpl-3.0
Laterus/Darkstar-Linux-Fork
scripts/zones/Southern_San_dOria/npcs/Miogique.lua
1
2145
----------------------------------- -- Area: Southern San d'Oria -- NPC: Miogique -- Standard Merchant NPC ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then count = trade:getItemCount(); MagicFlyer = trade:hasItemQty(MagicmartFlyer,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,MIOGIQUE_SHOP_DIALOG); stock = {0x3108,14256,1, -- Chainmail 0x3188,7783,1, -- Chain Mittens 0x3180,23846,1, -- Gauntlets 0x3088,9439,1, -- Iron Mask 0x309a,13179,2, -- Studded Bandana 0x319a,11012,2, -- Studded Gloves 0x311a,20976,2, -- Studded Vest 0x30a1,1504,3, -- Brass Cap 0x3121,2286,3, -- Brass Harness 0x31a1,1255,3, -- Brass Mittens 0x30a0,154,3, -- Bronze Cap 0x3120,576,3, -- Bronze Harness 0x31a0,128,3, -- Bronze Mittens 0x3098,396,3, -- Leather Bandana 0x3198,331,3, -- Leather Gloves 0x3118,618,3} -- Leather Vest showNationShop(player, SANDORIA, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
mojab/.files
.config/awesome/vicious/contrib/rss.lua
5
1725
--------------------------------------------------- -- Licensed under the GNU General Public License v2 -- * (c) 2009, olcc -- -- This is now a standalone RSS reader for awesome: -- * http://github.com/olcc/aware --------------------------------------------------- -- {{{ Grab environment local pairs = pairs local io = { popen = io.popen } local setmetatable = setmetatable -- }}} -- RSS: provides latest world news module("vicious.contrib.rss") -- {{{ RSS widget type local function worker(format, input) -- input: * feed - feed url -- * object - entity to look for (typically: 'item') -- * fields - fields to read (example: 'link', 'title', 'description') -- output: * count - number of entities found -- * one table for each field, containing wanted values local feed = input.feed local object = input.object local fields = input.fields -- Initialise tables local out = {} for _, v in pairs(fields) do out[v] = {} end -- Initialise variables local ob = nil local i,j,k = 1, 1, 0 local curl = "curl -A 'Mozilla/4.0' -fsm 5 --connect-timeout 3 " -- Get the feed local f = io.popen(curl .. '"' .. feed .. '"') local feed = f:read("*all") f:close() while true do i, j, ob = feed.find(feed, "<" .. object .. ">(.-)</" .. object .. ">", i) if not ob then break end for _, v in pairs(fields) do out[v][k] = ob:match("<" .. v .. ">(.*)</" .. v .. ">") end k = k+1 i = j+1 end -- Update the entity count out.count = k return out end -- }}} setmetatable(_M, { __call = function(_, ...) return worker(...) end })
gpl-3.0
kellabyte/snabbswitch
src/program/snabbnfv/neutron2snabb/neutron2snabb_schema.lua
15
1953
-- neutron2snabb_schema: Scan mysqldump SQL files for schema informaion module(..., package.seeall) local lib = require("core.lib") function read (directory, tables) local schema = {} for _, t in ipairs(tables) do schema[t] = columns(("%s/%s.sql"):format(directory, t)) end return schema end -- Scan the order of keys from a table definition. -- Return the columns of the named file in an array. -- -- The array may containing extraneous trailing items but must give -- the actual columns in order. function columns (filename) -- Array of columns. local columns = {} local sql = lib.readfile(filename, '*a') local definition = sql:match("CREATE TABLE `[^`]*` (%b())") assert(definition, "failed to find CREATE TABLE definition") -- The expected table definition format is: -- -- CREATE TABLE `ml2_port_bindings` ( -- `port_id` varchar(36) NOT NULL, -- `host` varchar(255) NOT NULL, -- ... -- ) ... -- -- We scan this and pick up the `identifiers`. definition:gsub("`([^`]*)`", function (id) table.insert(columns, id) end) return columns end function selftest () print("selftest: neutron2snabb_schema") local neutron2snabb = require("program.snabbnfv.neutron2snabb.neutron2snabb") -- Check that the schema we extract from the test database is -- compaible with the default schema. (That is expected for this -- particular data set.) local dir = "program/snabbnfv/test_fixtures/neutron_csv" local schema = read(dir, neutron2snabb.schema_tables) for tab, cols in pairs(neutron2snabb.default_schemas) do assert(schema[tab], "missing schema table: " .. tab) for i, col in ipairs(cols) do if schema[tab][i] ~= col then error(("Column mismatch: %s[%d] is %s (expected %s)"):format( tab, i, schema[tab][i], col)) end end end print("selftest: ok") end
apache-2.0
madpilot78/ntopng
scripts/lua/modules/plugins_utils.lua
1
36003
-- -- (C) 2019-21 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/notifications/?.lua;" .. package.path local plugins_utils = {} local os_utils = require("os_utils") local persistence = require("persistence") local file_utils = require("file_utils") local template_utils = require("template_utils") local lua_path_utils = require("lua_path_utils") require "lua_trace" local dirs = ntop.getDirs() -- enable debug tracing local do_trace = false -- How deep the recursive plugins search should go into subdirectories local MAX_RECURSION = 2 plugins_utils.COMMUNITY_SOURCE_DIR = os_utils.fixPath(dirs.scriptdir .. "/plugins") plugins_utils.PRO_SOURCE_DIR = os_utils.fixPath(dirs.installdir .. "/pro/scripts/pro_plugins") plugins_utils.ENTERPRISE_M_SOURCE_DIR = os_utils.fixPath(dirs.installdir .. "/pro/scripts/enterprise_m_plugins") plugins_utils.ENTERPRISE_L_SOURCE_DIR = os_utils.fixPath(dirs.installdir .. "/pro/scripts/enterprise_l_plugins") local PLUGIN_RELATIVE_PATHS = { menu_items = "menu_items", metadata = "plugins_metadata", modules = "modules", } local RUNTIME_PATHS = {} local METADATA = nil -- ############################################## -- The runtime path can change when the user reloads the plugins. -- We need to cache this into the same vm to ensure that all the lua -- scripts into this vm use the same directory. local cached_runtime_dir = nil function plugins_utils.getRuntimePath() if(not cached_runtime_dir) then cached_runtime_dir = ntop.getCurrentPluginsDir() end return(cached_runtime_dir) end local function getMetadataPath() return(os_utils.fixPath(plugins_utils.getRuntimePath() .. "/"..PLUGIN_RELATIVE_PATHS.metadata..".lua")) end -- ############################################## local function clearInternalState() RUNTIME_PATHS = {} METADATA = nil cached_runtime_dir = nil -- Tell lua to forget about require-d metadata. This is necessary as plugins may have been swapped betwenn plugins0/ and plugins1/. -- However, as PLUGIN_RELATIVE_PATHS.metadata is the same, lua would not reload it unless it's entry in package.loaded is reset. package.loaded[PLUGIN_RELATIVE_PATHS.metadata] = nil end -- ############################################## -- @brief Recursively search for plugins starting from `source_dir` -- @param edition A string indicating the plugin edition. One of `community`, `pro`, `enterprise_m` or `enterprise_l` -- @param source_dir The path of the directory to start the plugin search from -- @param max_recursion Maximum number of recursive calls to this function -- @param plugins A lua table with all the plugins found -- @param plugins_with_deps A lua table with all the plugins found which have other plugins as dependencies local function recursivePluginsSearch(edition, source_dir, max_recursion, plugins, plugins_with_deps) -- Prepend the current `source_dir` to the Lua path - this is necessary for doing the require lua_path_utils.package_path_prepend(source_dir) local source_dir_contents = ntop.readdir(source_dir) for plugin_name in pairs(source_dir_contents) do local plugin_dir = os_utils.fixPath(source_dir .. "/" .. plugin_name) local plugin_info = os_utils.fixPath(plugin_dir .. "/manifest.lua") if ntop.exists(plugin_info) then -- If there's a manifest, we are in a plugin directory local req_name = string.format("%s.manifest", plugin_name) local metadata = require(req_name) local mandatory_fields = {"title", "description", "author"} if not metadata then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Could not load manifest.lua in '%s'", plugin_name)) goto continue end for _, field in pairs(mandatory_fields) do if not metadata[field] then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Missing mandatory field '%s' in manifest.lua of '%s'", field, plugin_name)) goto continue end end if metadata.disabled then -- The plugin is disabled, skip it goto continue end -- Augument information metadata.path = plugin_dir metadata.key = plugin_name metadata.edition = edition if not table.empty(metadata.dependencies) then plugins_with_deps[plugin_name] = metadata else plugins[plugin_name] = metadata end elseif ntop.isdir(plugin_dir) then if max_recursion > 0 then -- Recursively see if this is a directory containing other plugins recursivePluginsSearch(edition, plugin_dir, max_recursion - 1, plugins, plugins_with_deps) else -- Maximum recursion hit. must stop traceError(TRACE_INFO, TRACE_CONSOLE, string.format("Unable to load '%s'. Too many recursion levels.", plugin_dir)) end end ::continue:: end end -- ############################################## -- @brief Lists the all available plugins -- @returns a sorted table with plugins as values. -- @notes Plugins must be loaded based according to the sort order to honor dependencies local function listPlugins(community_plugins_only) local plugins = {} local plugins_with_deps = {} local rv = {} local source_dirs = {{"community", plugins_utils.COMMUNITY_SOURCE_DIR}} if not community_plugins_only and ntop.isPro() then source_dirs[#source_dirs + 1] = {"pro", plugins_utils.PRO_SOURCE_DIR} if ntop.isEnterpriseM() then source_dirs[#source_dirs + 1] = {"enterprise_m", plugins_utils.ENTERPRISE_M_SOURCE_DIR} end if ntop.isEnterpriseL() then source_dirs[#source_dirs + 1] = {"enterprise_l", plugins_utils.ENTERPRISE_L_SOURCE_DIR} end end for _, source_conf in ipairs(source_dirs) do local edition = source_conf[1] local source_dir = source_conf[2] recursivePluginsSearch(edition, source_dir, MAX_RECURSION, plugins, plugins_with_deps) end -- Add plugins without dependencies to the result for _, plugin_metadata in pairs(plugins) do rv[#rv + 1] = plugin_metadata end -- Check basic dependencies. -- No recursion is supported (e.g. dependency on a plugin which has dependencies itself) for plugin_name, metadata in pairs(plugins_with_deps) do local satisfied = true for _, dep_name in pairs(metadata.dependencies) do if not plugins[dep_name] then satisfied = false if do_trace then io.write(string.format("Skipping plugin '%s' with unmet depedendency ('%s')\n", plugin_name, dep_name)) end break end end if satisfied then plugins[plugin_name] = metadata rv[#rv + 1] = metadata end end return(rv) end -- ############################################## local function init_runtime_paths() local runtime_path = plugins_utils.getRuntimePath() RUNTIME_PATHS = { -- Definitions alert_definitions = os_utils.fixPath(runtime_path .. "/alert_definitions"), status_definitions = os_utils.fixPath(runtime_path .. "/status_definitions"), pro_status_definitions = os_utils.fixPath(runtime_path .. "/status_definitions/pro"), -- Locales locales = os_utils.fixPath(runtime_path .. "/locales"), -- Timeseries ts_schemas = os_utils.fixPath(runtime_path .. "/ts_schemas"), -- Web Gui web_gui = os_utils.fixPath(runtime_path) .. "/scripts", menu_items = os_utils.fixPath(runtime_path.."/"..PLUGIN_RELATIVE_PATHS.menu_items), -- Alert endpoints alert_endpoints = os_utils.fixPath(runtime_path) .. "/alert_endpoints", -- HTTP lint http_lint = os_utils.fixPath(runtime_path) .. "/http_lint", -- Plugins Data Directories plugins_data = os_utils.fixPath(runtime_path) .. "/plugins_data", -- Other templates = os_utils.fixPath(runtime_path) .. "/templates", modules = os_utils.fixPath(runtime_path) .. "/modules", httpdocs = os_utils.fixPath(runtime_path) .. "/httpdocs", -- Checks interface_scripts = os_utils.fixPath(runtime_path .. "/callbacks/interface/interface"), host_scripts = os_utils.fixPath(runtime_path .. "/callbacks/interface/host"), network_scripts = os_utils.fixPath(runtime_path .. "/callbacks/interface/network"), flow_scripts = os_utils.fixPath(runtime_path .. "/callbacks/interface/flow"), syslog = os_utils.fixPath(runtime_path .. "/callbacks/system/syslog"), snmp_scripts = os_utils.fixPath(runtime_path .. "/callbacks/system/snmp_device"), system_scripts = os_utils.fixPath(runtime_path .. "/callbacks/system/system"), } end -- ############################################## --@brief Load a plugin file and possibly executes an onLoad method --@return The loaded plugin file local function load_plugin_file(full_path) local res = dofile(full_path) return res end -- ############################################## -- NOTE: cannot save the definitions to a single file via the persistance -- module because they may contain functions (e.g. in the i18n_description) local function load_definitions(defs_dir, runtime_path) for fname in pairs(ntop.readdir(defs_dir) or {}) do if fname:ends(".lua") then local mod_fname = string.sub(fname, 1, string.len(fname) - 4) local full_path = os_utils.fixPath(defs_dir .. "/" .. fname) local def_script = load_plugin_file(full_path) -- Verify the definitions if(type(def_script) ~= "table") then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Error loading definition from %s", full_path)) return(false) end local ntopng_alert_definition = os_utils.fixPath(dirs.installdir .. "/scripts/lua/modules/alert_definitions/"..fname) if ntop.exists(ntopng_alert_definition) then -- Prevent plugin alert definitions from overwriting alert definitions under modules traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Cannot copy plugin alert definition from %s (alert already defined in %s)", full_path, ntopng_alert_definition)) else -- tprint({"copying", fname, defs_dir, runtime_path}) file_utils.copy_file(fname, defs_dir, runtime_path) end end end return(true) end -- ############################################## local function load_plugin_alert_definitions(plugin) -- Reset all the possibly existing (and loaded) definitions -- as new alert definitions are being loaded local alert_consts = require "alert_consts" alert_consts.resetDefinitions() -- Now that existing alert definitions are clean, new alert definitions -- can safely be loaded local alert_definitions = RUNTIME_PATHS.alert_definitions return load_definitions(os_utils.fixPath(plugin.path .. "/alert_definitions"), alert_definitions) end -- ############################################## local function load_plugin_ts_schemas(plugin) local src_path = os_utils.fixPath(plugin.path .. "/ts_schemas") local ts_path = os_utils.fixPath(RUNTIME_PATHS.ts_schemas .. "/" .. plugin.key) if ntop.exists(src_path) then ntop.mkdir(ts_path) return( file_utils.recursive_copy(src_path, ts_path) ) end return(true) end -- ############################################## local function load_plugin_i18n(locales, default_locale, plugin) local locales_dir = os_utils.fixPath(plugin.path .. "/locales") local locales_path = ntop.readdir(locales_dir) if table.empty(locales_path) then return(true) end -- Ensure that the plugin localization will not override any existing -- key if default_locale[plugin.key] then traceError(TRACE_WARNING, TRACE_CONSOLE, string.format( "Plugin name %s overlaps with an existing i18n key. Please rename the plugin.", plugin.key)) return(false) end for fname in pairs(locales_path) do if string.ends(fname, ".lua") then local full_path = os_utils.fixPath(locales_dir .. "/" .. fname) local locale = persistence.load(full_path) if locale then locales[fname] = locales[fname] or {} locales[fname][plugin.key] = locale if do_trace then io.write("\ti18n: " .. fname .. "\n") end else return(false) end end end return(true) end -- ############################################## local function load_plugin_lint(plugin) local lint_path = os_utils.fixPath(plugin.path .. "/http_lint.lua") if(ntop.exists(lint_path)) then if(not file_utils.copy_file(nil, lint_path, os_utils.fixPath(RUNTIME_PATHS.http_lint .. "/" .. plugin.key .. ".lua"))) then return(false) end end return(true) end -- ############################################## local function load_plugin_checks(paths_to_plugin, plugin) local scripts_path = os_utils.fixPath(plugin.path .. "/checks") local paths_map = {} local extn = ".lua" local rv = ( file_utils.recursive_copy(os_utils.fixPath(scripts_path .. "/interface"), RUNTIME_PATHS.interface_scripts, paths_map, extn) and file_utils.recursive_copy(os_utils.fixPath(scripts_path .. "/host"), RUNTIME_PATHS.host_scripts, paths_map, extn) and file_utils.recursive_copy(os_utils.fixPath(scripts_path .. "/network"), RUNTIME_PATHS.network_scripts, paths_map, extn) and file_utils.recursive_copy(os_utils.fixPath(scripts_path .. "/flow"), RUNTIME_PATHS.flow_scripts, paths_map, extn) and file_utils.recursive_copy(os_utils.fixPath(scripts_path .. "/syslog"), RUNTIME_PATHS.syslog, paths_map, extn) and file_utils.recursive_copy(os_utils.fixPath(scripts_path .. "/snmp_device"), RUNTIME_PATHS.snmp_scripts, paths_map, extn) and file_utils.recursive_copy(os_utils.fixPath(scripts_path .. "/system"), RUNTIME_PATHS.system_scripts, paths_map, extn) ) for runtime_path, source_path in pairs(paths_map) do -- Ensure that the script does not have errors local res = load_plugin_file(runtime_path) if(res == nil) then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Skipping bad user script '%s' in plugin '%s'", source_path, plugin.key)) os.remove(runtime_path) else paths_to_plugin[runtime_path] = { source_path = source_path, plugin = plugin, } end end return(rv) end -- ############################################## local function load_plugin_alert_endpoints(plugin) local endpoints_path = os_utils.fixPath(plugin.path .. "/alert_endpoints") local endpoints_template_path = os_utils.fixPath(plugin.path .. "/templates") if not ntop.exists(endpoints_path) then -- No alert endpoints for this plugin return true end for fname in pairs(ntop.readdir(endpoints_path)) do if fname:ends(".lua") then -- Execute the alert endpoint and call its method onLoad, if present local fname_path = os_utils.fixPath(endpoints_path .. "/" .. fname) local endpoint = load_plugin_file(fname_path) if not endpoint then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Unable to load endpoint '%s'", fname)) return false end -- Check for configuration templates existence if endpoint.endpoint_template and endpoint.endpoint_template.template_name then -- Stop if the template doesn't exist if not ntop.exists(os_utils.fixPath(endpoints_template_path.."/"..endpoint.endpoint_template.template_name)) then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Missing conf template '%s' in '%s' for endpoint '%s'", endpoint.endpoint_template.template_name, endpoints_template_path, fname)) return false end end -- Check for recipient templates existence if endpoint.recipient_template and endpoint.recipient_template.template_name then -- Return if the recipient template doesn't exist if not ntop.exists(os_utils.fixPath(endpoints_template_path.."/"..endpoint.recipient_template.template_name)) then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Missing recipient template '%s' in '%s' for endpoint '%s'", endpoint.recipient_template.template_name, endpoints_template_path, fname)) return false end end if not file_utils.copy_file(fname, endpoints_path, RUNTIME_PATHS.alert_endpoints) then return false end if endpoint and endpoint.onLoad then endpoint.onLoad() end end end return true end -- ############################################## local function load_plugin_web_gui(plugin) local gui_dir = os_utils.fixPath(plugin.path .. "/web_gui") for fname in pairs(ntop.readdir(gui_dir)) do if(fname == "menu.lua") then local full_path = os_utils.fixPath(gui_dir .. "/" .. fname) local menu_entry = load_plugin_file(full_path) if(menu_entry) then if(menu_entry.label == nil) then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Missing menu entry 'label' in %s (menu.lua)", plugin.key)) return(false) elseif(menu_entry.script == nil) then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Missing menu entry 'script' in %s (menu.lua)", plugin.key)) return(false) else -- Check that the menu entry exists local script_path = os_utils.fixPath(gui_dir .. "/" .. menu_entry.script) if(not ntop.exists(script_path)) then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Menu entry script path '%s' does not exists in %s", script_path, plugin.key)) return(false) end if(not file_utils.copy_file(nil, full_path, os_utils.fixPath(RUNTIME_PATHS.menu_items .. "/" .. plugin.key .. ".lua"))) then return(false) end end end else if not file_utils.copy_file(fname, gui_dir, RUNTIME_PATHS.web_gui) then return(false) end end end return(true) end -- ############################################## -- A plugin can specify additional directories to load with the "data_dirs" -- field in its manifest.lua . The plugin can then retrieve the runtime path -- by using the plugins_utils.getPluginDataDir() api local function load_plugin_data_dirs(plugin) for _, dir in pairs(plugin.data_dirs or {}) do local data_dir = os_utils.fixPath(plugin.path .. "/" .. dir) if ntop.exists(data_dir) then local dest_path = os_utils.fixPath(RUNTIME_PATHS.plugins_data .. "/" .. plugin.key .. "/" .. dir) ntop.mkdir(dest_path) file_utils.recursive_copy(data_dir, dest_path) end end return(true) end -- ############################################## local function load_plugin_other(plugin) local templates_dir = os_utils.fixPath(plugin.path .. "/templates") local modules_dir = os_utils.fixPath(plugin.path .. "/modules") local httpdocs_dir = os_utils.fixPath(plugin.path .. "/httpdocs") local rv = true if ntop.exists(templates_dir) then local path = plugins_utils.getPluginTemplatesDir(plugin.key) ntop.mkdir(path) rv = rv and file_utils.recursive_copy(templates_dir, path) end if ntop.exists(modules_dir) then local path = os_utils.fixPath(RUNTIME_PATHS.modules.. "/" ..plugin.key) ntop.mkdir(path) rv = rv and file_utils.recursive_copy(modules_dir, path) end if ntop.exists(httpdocs_dir) then local path = os_utils.fixPath(RUNTIME_PATHS.httpdocs.. "/" ..plugin.key) ntop.mkdir(path) rv = rv and file_utils.recursive_copy(httpdocs_dir, path) end return(rv) end -- ############################################## -- @brief Loads the ntopng plugins into a single directory tree. -- @notes This should be called at startup. It clears and populates the -- shadow_dir first, then swaps it with the current_dir. This prevents -- other threads to see intermediate states and half-populated directories. function plugins_utils.loadPlugins(community_plugins_only) local locales_utils = require("locales_utils") local plugins = listPlugins(community_plugins_only) local loaded_plugins = {} local locales = {} local path_map = {} local en_locale = locales_utils.readDefaultLocale() local current_dir = ntop.getCurrentPluginsDir() local shadow_dir = ntop.getShadowPluginsDir() -- Clean up the shadow directory ntop.rmdir(shadow_dir) -- Use the shadow directory as the new base clearInternalState() cached_runtime_dir = shadow_dir init_runtime_paths() -- Ensure that the directory is writable ntop.mkdir(shadow_dir) local test_file = os_utils.fixPath(shadow_dir .. "/test") local outfile, err = io.open(test_file, "w") if(outfile) then outfile:close() end if(outfile == nil) then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Cannot write to the plugins directory: %s. Plugins will not be loaded!", err or shadow_dir)) clearInternalState() return(false) end os.remove(test_file) for _, path in pairs(RUNTIME_PATHS) do ntop.mkdir(path) end -- Load plugin alert definitions, i.e., definitions found under <plugin_name>/alert_definitions -- alert definitions MUST be loaded before flow status definitions as, flow status definitions, -- may depend on alert definitions for _, plugin in ipairs(plugins) do load_plugin_alert_definitions(plugin) end -- Make sure to invalidate the (possibly) already required alert_consts which depends on alert definitions. -- By invalidating the module, we make sure all the newly loaded alert definitions will be picked up by any -- subsequent `require "alert_consts"` package.loaded["alert_consts"] = nil -- Load the plugins following the dependecies order for _, plugin in ipairs(plugins) do if community_plugins_only and plugin.edition ~= "community" then goto continue end -- Ensure that the depencies has been loaded as well for _, dep in pairs(plugin.dependencies or {}) do if not loaded_plugins[dep] then traceError(TRACE_WARNING, TRACE_CONSOLE, string.format("Skipping plugin %s due to missing dependency '%s'", plugin.key, dep)) goto continue end end if do_trace then io.write(string.format("Loading plugin %s [edition: %s]\n", plugin.key, plugin.edition)) end if load_plugin_i18n(locales, en_locale, plugin) and load_plugin_lint(plugin) and load_plugin_ts_schemas(plugin) and load_plugin_web_gui(plugin) and load_plugin_data_dirs(plugin) and load_plugin_other(plugin) and load_plugin_checks(path_map, plugin) and load_plugin_alert_endpoints(plugin) then loaded_plugins[plugin.key] = plugin else traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Errors occurred while processing plugin '%s'", plugin.key)) end ::continue:: end -- Save the locales for fname, plugins_locales in pairs(locales) do local locale_path = os_utils.fixPath(RUNTIME_PATHS.locales .. "/" .. fname) persistence.store(locale_path, plugins_locales) ntop.setDefaultFilePermissions(locale_path) end -- Save loaded plugins metadata -- See load_metadata() local plugins_metadata = { plugins = loaded_plugins, path_map = path_map, } persistence.store(getMetadataPath(), plugins_metadata) ntop.setDefaultFilePermissions(getMetadataPath()) -- Swap the active plugins directory with the shadow clearInternalState() ntop.swapPluginsDir() deleteCachePattern("ntonpng.cache.checks.available_system_modules.*") -- Reload the periodic scripts to load the new plugins ntop.reloadPeriodicScripts() -- Reload checks with their configurations local checks = require "checks" checks.initDefaultConfig() checks.loadUnloadUserScripts(true --[[ load --]]) return(true) end -- ############################################## function plugins_utils.loadSchemas(granularity) init_runtime_paths() lua_path_utils.package_path_prepend(RUNTIME_PATHS.ts_schemas) for plugin_name in pairs(ntop.readdir(RUNTIME_PATHS.ts_schemas)) do local ts_dir = os_utils.fixPath(RUNTIME_PATHS.ts_schemas .. "/" .. plugin_name) local files_to_load = {} if(granularity ~= nil) then -- Only load schemas for the specified granularity local fgran = granularity..".lua" local fgran_path = os_utils.fixPath(ts_dir.."/"..fgran) if ntop.exists(fgran_path) then files_to_load = {fgran} else -- Schema doesn't exist for `plugin_name` at the requested granularity. -- This is normal, it's not mandatory for a plugin to define schemas or to -- define a schema for any granularity end else -- load all files_to_load = ntop.readdir(ts_dir) end for _, fname in pairs(files_to_load) do if fname:ends(".lua") then local fgran = string.sub(fname, 1, string.len(fname) - 4) -- Plugin ts schemas are require-d using the dot-notation in the -- require string name. Dots are used to navigate the base directory, RUNTIME_PATHS.ts_schemas, -- which has been prepended to the path. -- Examples: -- require(active_monitoring.hour) -- require(active_monitoring.5mins) -- require(active_monitoring.min) -- require(score.min) -- require(influxdb_monitor.5mins) local req_name = string.format("%s.%s", plugin_name, fgran) require(req_name) end end end end -- ############################################## function plugins_utils.checkReloadPlugins(when) local demo_ends_at = ntop.getInfo()["pro.demo_ends_at"] local time_delta = demo_ends_at - when local plugins_reloaded = false -- tprint({time_delta = time_delta, demo_ends_at = demo_ends_at, when = when, is_pro = ntop.isPro()}) if ntop.getCache('ntopng.cache.force_reload_plugins') == '1' then -- Check and possibly reload plugins after a user has changed (e.g., applied or removed) a license -- from the web user interface (page about.lua) plugins_utils.loadPlugins(not ntop.isPro() --[[ reload only community if license is not pro --]]) ntop.delCache('ntopng.cache.force_reload_plugins') plugins_reloaded = true elseif demo_ends_at and demo_ends_at > 0 and time_delta <= 10 and ntop.isPro() and not ntop.hasPluginsReloaded() then -- Checks and possibly reload plugins for demo licenses. In case of demo licenses, -- if within 10 seconds from the license expirations, a plugin reload is executed only for the community plugins plugins_utils.loadPlugins(true --[[ reload only community plugins --]]) plugins_reloaded = true end if plugins_reloaded then ntop.reloadPlugins() end end -- ############################################## function plugins_utils.getMenuEntries() init_runtime_paths() local menu = {} local entries_data = {} lua_path_utils.package_path_prepend(plugins_utils.getRuntimePath()) for fname in pairs(ntop.readdir(RUNTIME_PATHS.menu_items)) do local full_path = os_utils.fixPath(RUNTIME_PATHS.menu_items .. "/" .. fname) local plugin_key = string.sub(fname, 1, string.len(fname)-4) local req_name = string.format("%s.%s", PLUGIN_RELATIVE_PATHS.menu_items, plugin_key) local menu_entry = require(req_name) if(menu_entry and ((not menu_entry.is_shown) or menu_entry.is_shown())) then -- Don't add any getHttpPrefix to the url here, it's the caller that -- can potentially add it menu_entry.url = "/plugins/" .. menu_entry.script menu[plugin_key] = menu_entry if menu_entry.menu_entry then entries_data[menu_entry.menu_entry.key] = menu_entry.menu_entry end end end return menu, entries_data end -- ############################################## function plugins_utils.getUrl(script) return(ntop.getHttpPrefix() .. "/plugins/" .. script) end -- ############################################## function plugins_utils.timeseriesCreationEnabled() return areSystemTimeseriesEnabled() end -- ############################################## local function load_metadata() if not METADATA then local runtime_path = plugins_utils.getRuntimePath() lua_path_utils.package_path_prepend(runtime_path) -- Do the require via pcall to avoid Lua generating an exception. -- Print an error and a stacktrace when the require fails. local status status, METADATA = pcall(require, PLUGIN_RELATIVE_PATHS.metadata) if not status then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Could not load plugins metadata file '%s'", PLUGIN_RELATIVE_PATHS.metadata)) tprint(debug.traceback()) end end end -- ############################################## -- @brief Retrieve the original source path of a user script -- @param script_path the runtime path of the user script -- @return the user script source path function plugins_utils.getUserScriptSourcePath(script_path) load_metadata() if(not METADATA) then return(nil) end local info = METADATA.path_map[script_path] if info then return(info.source_path) end end -- ############################################## -- @brief Retrieve the runtime data directory of the plugin, which is specified in the "data_dirs" directive of the plugin manifest.lua -- @param plugin_key the plugin name -- @param subdir an optional subdirectory of the datadir -- @return the runtime directory path function plugins_utils.getPluginDataDir(plugin_key, subdir) init_runtime_paths() local path = RUNTIME_PATHS.plugins_data .. "/" .. plugin_key if subdir then path = path .. "/" .. subdir end return os_utils.fixPath(path) end -- ############################################## -- @brief Get the httpdocs directory of the plugin. This can be used to access -- javascript, css and similar files function plugins_utils.getHttpdocsDir(plugin_name) local dir = ternary(ntop.isPlugins0Dir(), "plugins0_httpdocs", "plugins1_httpdocs") -- See url_rewrite_patterns in HTTPserver.cpp return(os_utils.fixPath(ntop.getHttpPrefix() .. "/".. dir .."/" .. plugin_name)) end -- ############################################## -- @brief Retrieve the runtime templates directory of the plugin -- @param plugin_name the plugin name -- @return the runtime directory path function plugins_utils.getPluginTemplatesDir(plugin_name) init_runtime_paths() local path = RUNTIME_PATHS.templates .. "/" .. plugin_name return os_utils.fixPath(path) end -- ############################################## -- @brief Retrieve the plugin associated with the user script -- @param script_path the runtime path of the user script -- @return the associated plugin function plugins_utils.getUserScriptPlugin(script_path) load_metadata() if(not METADATA) then return(nil) end local info = METADATA.path_map[script_path] if info then return(info.plugin) end end -- ############################################## -- @brief Retrieve metadata of the loaded plugins -- @return the loaded plugins metadata function plugins_utils.getLoadedPlugins() load_metadata() if(not METADATA) then return({}) end return(METADATA.plugins) end -- ############################################## -- Descending sort by priority local function endpoint_sorter(a, b) if((a.prio ~= nil) and (b.prio == nil)) then return(true) elseif((a.prio == nil) and (b.prio ~= nil)) then return(false) elseif(a.prio ~= b.prio) then return(a.prio > b.prio) end -- Use the endpoint key to fix a defined sort order return(a.key > b.key) end -- ############################################## -- @brief Get the available alert endpoints -- @return a sorted table, in order of priority, for the alert endpoints function plugins_utils.getLoadedAlertEndpoints() init_runtime_paths() local rv = {} lua_path_utils.package_path_prepend(RUNTIME_PATHS.alert_endpoints) for fname in pairs(ntop.readdir(RUNTIME_PATHS.alert_endpoints) or {}) do if fname:ends(".lua") then local full_path = os_utils.fixPath(RUNTIME_PATHS.alert_endpoints .. "/" .. fname) local key = string.sub(fname, 1, string.len(fname) - 4) local endpoint = require(key) if(endpoint) then if((type(endpoint.isAvailable) ~= "function") or endpoint.isAvailable()) then endpoint.full_path = full_path endpoint.key = key rv[#rv + 1] = endpoint end else traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Could not load alert endpoint '%s'", full_path)) end end end -- Sort by priority (higher priority first) table.sort(rv, endpoint_sorter) return(rv) end -- ############################################## function plugins_utils.extendLintParams(http_lint, params) init_runtime_paths() lua_path_utils.package_path_prepend(RUNTIME_PATHS.http_lint) for fname in pairs(ntop.readdir(RUNTIME_PATHS.http_lint)) do local key = string.sub(fname, 1, string.len(fname) - 4) local lint = require(key) if(lint == nil) then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Could not load lint for '%s'", key)) goto continue end if(lint.getAdditionalParameters == nil) then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("Missing mandatory function 'getAdditionalParameters' in '%s'", key)) goto continue end local rv = lint.getAdditionalParameters(http_lint) if(type(rv) ~= "table") then traceError(TRACE_ERROR, TRACE_CONSOLE, string.format("function 'getAdditionalParameters' in '%s' returned a non-table value", key)) goto continue end for k, v in pairs(rv) do params[k] = v end ::continue:: end end -- ############################################## -- @brief Render an html template located into the plugin templates directory function plugins_utils.renderTemplate(plugin_name, template_file, context) init_runtime_paths() -- Locate the template file under the plugin directory local full_path = os_utils.fixPath(plugins_utils.getPluginTemplatesDir(plugin_name) .. "/" .. template_file) -- If no template is found... if not ntop.exists(full_path) then -- Attempt at locating the template class under modules (global to ntopng) full_path = os_utils.fixPath(dirs.installdir .. "/scripts/lua/modules/check_templates/"..template_file) end return template_utils.gen(full_path, context, true --[[ using full path ]]) end -- ############################################## -- @brief Load a plugin Lua template, e.g., those used for plugin checks function plugins_utils.loadTemplate(plugin_name, template_file) -- Attempt at locating the template class under the plugin templates directory -- Locate the template directory of the plugin containing this user script local plugin_template_path = plugins_utils.getPluginTemplatesDir(plugin_name) -- Get the actual template path, using the template name local template_path = os_utils.fixPath(plugin_template_path.."/"..template_file..".lua") -- If the plugin file exists.. if ntop.exists(template_path) then -- Do the necessary require init_runtime_paths() lua_path_utils.package_path_prepend(RUNTIME_PATHS.templates) local req_name = string.format("%s.%s", plugin_name, template_file) local req = require(req_name) return req end -- No template found return nil end -- ############################################## -- @brief Load a module located inside a plugin. This is equivalent to the -- lua "require ..." of the builting ntopng modules function plugins_utils.loadModule(plugin_name, module_name) init_runtime_paths() lua_path_utils.package_path_prepend(RUNTIME_PATHS.modules) local req_name = string.format("%s.%s", plugin_name, module_name) local req = require(req_name) return req end -- ############################################## -- @brief Deletes the plugins runtime directories. This is usually called -- in boot.lua to start fresh. function plugins_utils.cleanup() ntop.rmdir(os_utils.fixPath(dirs.workingdir .. "/plugins")) ntop.rmdir(ntop.getCurrentPluginsDir()) ntop.rmdir(ntop.getShadowPluginsDir()) clearInternalState() end -- ############################################## return(plugins_utils)
gpl-3.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Tasks/MacroCodeCamp/MacroCodeCampAward.lua
1
3492
--[[ author:pbb date:2021/02/04 Desc:冬令营第一名学校活动 use lib: local MacroCodeCampAward = NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/MacroCodeCamp/MacroCodeCampAward.lua"); MacroCodeCampAward.ShowView() ]] local QREncode = commonlib.gettable("MyCompany.Aries.Game.Movie.QREncode") local KeepWorkItemManager = NPL.load("(gl)script/apps/Aries/Creator/HttpAPI/KeepWorkItemManager.lua"); local MacroCodeCampActIntro = NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/MacroCodeCamp/MacroCodeCampActIntro.lua"); local MacroCodeCampAward = NPL.export() local page = nil function MacroCodeCampAward.OnInit() page = document:GetPageCtrl(); end function MacroCodeCampAward.CheckCanShow() -- if not System.options.isDevMode then -- return false -- end -- local school = KeepWorkItemManager.GetSchool() -- if (string.find(name, "柴桑小学") and string.find(name, "柴桑小学") > 0) or school.id == 133053 then -- return true -- end return false end function MacroCodeCampAward.ShowView() if not MacroCodeCampAward.CheckCanShow() then LOG.std(nil, "debug", "MacroCodeCampAward", "不是柴桑小学的学生"); return end local view_width = 780 local view_height = 512 local params = { url = "script/apps/Aries/Creator/Game/Tasks/MacroCodeCamp/MacroCodeCampAward.html", name = "MacroCodeCampAward.ShowView", isShowTitleBar = false, DestroyOnClose = true, style = CommonCtrl.WindowFrame.ContainerStyle, allowDrag = true, enable_esc_key = true, zorder = 4, app_key = MyCompany.Aries.Creator.Game.Desktop.App.app_key, directPosition = true, align = "_ct", x = -view_width/2, y = -view_height/2, width = view_width, height = view_height, }; System.App.Commands.Call("File.MCMLWindowFrame", params); MacroCodeCampAward.InitQRCode() end function MacroCodeCampAward.GetQRCodeUrl() local urlbase = GameLogic.GetFilters():apply_filters("get_keepwork_url"); local uerid = GameLogic.GetFilters():apply_filters("store_get",'user/userId'); local url = string.format("%s/p/qr/vipDouble?userId=%s&from=%s",urlbase, uerid, "chaisang"); return url end function MacroCodeCampAward.InitQRCode() local parent = page:GetParentUIObject() local qrcode_width = 92 local qrcode_height = 92 local _,qrcodedata = QREncode.qrcode(MacroCodeCampAward.GetQRCodeUrl()) local block_size = qrcode_width / #qrcodedata local qrcode = ParaUI.CreateUIObject("container", "qrcode", "_lt", 340, 378, qrcode_width, qrcode_height); qrcode:SetField("OwnerDraw", true); -- enable owner draw paint event qrcode:SetField("SelfPaint", true); qrcode:SetScript("ondraw", function(test) for i = 1, #(qrcodedata) do for j = 1, #(qrcodedata[i]) do local code = qrcodedata[i][j]; if (code < 0) then ParaPainter.SetPen("#000000ff"); ParaPainter.DrawRect((i-1) * block_size, (j-1) * block_size, block_size, block_size); end end end end); parent:AddChild(qrcode); end function MacroCodeCampAward.CloseView() if page then page:CloseWindow() page = nil end if MacroCodeCampAward.CheckCanShow() then MacroCodeCampActIntro.ShowView() end end
gpl-2.0
jsj2008/ValyriaTear
dat/effects/particles/wave_spell.lua
3
7267
--Wave particle effect -- Author: Bertram systems = {} systems[0] = { enabled = true, emitter = { x = 0, y = -64, x2 = 0, --useless when using a circle shape y2 = 0, --useless when using a circle shape center_x = 0, --useless when using a circle shape center_y = 0, --useless when using a circle shape x_variation = 0, y_variation = 0, radius = 80, shape = 'circle', omnidirectional = false, orientation = -1.6, --up outer_cone = 0.0, inner_cone = 0, initial_speed = 10, initial_speed_variation = 15, emission_rate = 3, start_time = 0, emitter_mode = 'burst', spin = 'counter clockwise' }, keyframes = { { -- keyframe 1 size_x = 0.6, size_y = 0.6, color={0.0, 0.0, 1.0, 0.6}, rotation_speed = -10.0, size_variation_x = 0.2, size_variation_y = 0.2, rotation_speed_variation = 0.0, color_variation = {0.0, 0.0, 0.0, 0.0}, time = 0.0 }, { -- keyframe 2 size_x = 0.3, size_y = 0.3, color = {0.5, 0.5, 1.0, 0.4}, rotation_speed = -10.0, size_variation_x = 0.2, size_variation_y = 0.2, rotation_speed_variation = 0.0, color_variation = {0.0, 0.0, 0.0, 0.0}, time = 1.0 } }, animation_frames = { --'img/effects/outlined_circle_small.png' 'img/effects/wave.png' }, animation_frame_times = { 16 }, blend_mode = 13, system_lifetime = 0.3, particle_lifetime = 0.5, particle_lifetime_variation = 0.0, max_particles = 15, damping = 1, damping_variation = 0, acceleration_x = 0, acceleration_y = 0, acceleration_variation_x = 0, acceleration_variation_y = 0, wind_velocity_x = 0, wind_velocity_y = 0, wind_velocity_variation_x = 0, wind_velocity_variation_y = 0, tangential_acceleration = 300, tangential_acceleration_variation = 0, radial_acceleration = 0, radial_acceleration_variation = 0, user_defined_attractor = false, attractor_falloff = 0.0, smooth_animation = true, modify_stencil = false, stencil_op = 'INCR', use_stencil = false, random_initial_angle = true } systems[1] = { enabled = true, emitter = { x = 0, y = -32, x2 = 0, --useless when using a circle shape y2 = 0, --useless when using a circle shape center_x = 0, --useless when using a circle shape center_y = 0, --useless when using a circle shape x_variation = 0, y_variation = 0, radius = 80, shape = 'circle', omnidirectional = false, orientation = -1.6, --up outer_cone = 0.0, inner_cone = 0, initial_speed = 10, initial_speed_variation = 15, emission_rate = 3, start_time = 0.3, emitter_mode = 'burst', spin = 'counter clockwise' }, keyframes = { { -- keyframe 1 size_x = 0.6, size_y = 0.6, color={0.0, 0.0, 1.0, 0.6}, rotation_speed = -10.0, size_variation_x = 0.2, size_variation_y = 0.2, rotation_speed_variation = 0.0, color_variation = {0.0, 0.0, 0.0, 0.0}, time = 0.0 }, { -- keyframe 2 size_x = 0.3, size_y = 0.3, color = {0.5, 0.5, 1.0, 0.4}, rotation_speed = -10.0, size_variation_x = 0.2, size_variation_y = 0.2, rotation_speed_variation = 0.0, color_variation = {0.0, 0.0, 0.0, 0.0}, time = 1.0 } }, animation_frames = { --'img/effects/outlined_circle_small.png' 'img/effects/wave.png' }, animation_frame_times = { 16 }, blend_mode = 13, system_lifetime = 0.3, particle_lifetime = 0.5, particle_lifetime_variation = 0.0, max_particles = 15, damping = 1, damping_variation = 0, acceleration_x = 0, acceleration_y = 0, acceleration_variation_x = 0, acceleration_variation_y = 0, wind_velocity_x = 0, wind_velocity_y = 0, wind_velocity_variation_x = 0, wind_velocity_variation_y = 0, tangential_acceleration = 300, tangential_acceleration_variation = 0, radial_acceleration = 0, radial_acceleration_variation = 0, user_defined_attractor = false, attractor_falloff = 0.0, smooth_animation = true, modify_stencil = false, stencil_op = 'INCR', use_stencil = false, random_initial_angle = true } systems[2] = { enabled = true, emitter = { x = 0, y = 0, x2 = 0, --useless when using a circle shape y2 = 0, --useless when using a circle shape center_x = 0, --useless when using a circle shape center_y = 0, --useless when using a circle shape x_variation = 0, y_variation = 0, radius = 80, shape = 'circle', omnidirectional = false, orientation = -1.6, --up outer_cone = 0.0, inner_cone = 0, initial_speed = 10, initial_speed_variation = 15, emission_rate = 3, start_time = 0.6, emitter_mode = 'burst', spin = 'counter clockwise' }, keyframes = { { -- keyframe 1 size_x = 0.6, size_y = 0.6, color={0.0, 0.0, 1.0, 0.6}, rotation_speed = -10.0, size_variation_x = 0.2, size_variation_y = 0.2, rotation_speed_variation = 0.0, color_variation = {0.0, 0.0, 0.0, 0.0}, time = 0.0 }, { -- keyframe 2 size_x = 0.3, size_y = 0.3, color = {0.5, 0.5, 1.0, 0.4}, rotation_speed = -10.0, size_variation_x = 0.2, size_variation_y = 0.2, rotation_speed_variation = 0.0, color_variation = {0.0, 0.0, 0.0, 0.0}, time = 1.0 } }, animation_frames = { --'img/effects/outlined_circle_small.png' 'img/effects/wave.png' }, animation_frame_times = { 16 }, blend_mode = 13, system_lifetime = 0.3, particle_lifetime = 0.5, particle_lifetime_variation = 0.0, max_particles = 15, damping = 1, damping_variation = 0, acceleration_x = 0, acceleration_y = 0, acceleration_variation_x = 0, acceleration_variation_y = 0, wind_velocity_x = 0, wind_velocity_y = 0, wind_velocity_variation_x = 0, wind_velocity_variation_y = 0, tangential_acceleration = 300, tangential_acceleration_variation = 0, radial_acceleration = 0, radial_acceleration_variation = 0, user_defined_attractor = false, attractor_falloff = 0.0, smooth_animation = true, modify_stencil = false, stencil_op = 'INCR', use_stencil = false, random_initial_angle = true }
gpl-2.0
TerminalShell/zombiesurvival
entities/weapons/weapon_zs_headcrab/shared.lua
1
6068
SWEP.ZombieOnly = true SWEP.IsMelee = true SWEP.ViewModel = "models/weapons/v_crowbar.mdl" SWEP.WorldModel = "models/weapons/w_crowbar.mdl" SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "none" SWEP.Primary.Delay = 0.4 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.Delay = 0.22 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" SWEP.PounceDamage = 8 SWEP.PounceDamageType = DMG_SLASH SWEP.NoHitRecovery = 1.90 SWEP.HitRecovery = 2.25 SWEP.BurrowTime = 1.5 function SWEP:Initialize() self:HideViewAndWorldModel() end if SERVER then SWEP.NextHeal = 0 end function SWEP:Think() local curtime = CurTime() local owner = self.Owner if self:GetBurrowTime() > 0 and curtime >= self:GetBurrowTime() then if not self:CanBurrow() then self:SetBurrowTime(-(curtime + self.BurrowTime)) else owner:DrawShadow(false) if SERVER and curtime >= self.NextHeal then self.NextHeal = curtime + 0.333 if owner:Health() < owner:GetMaxHealth() then owner:SetHealth(owner:Health() + 1) end end end elseif self:GetBurrowTime() < 0 and curtime >= -self:GetBurrowTime() then self:SetBurrowTime(0) elseif self:GetPouncing() then if owner:IsOnGround() or 1 < owner:WaterLevel() then self:SetPouncing(false) self:SetNextPrimaryFire(curtime + self.NoHitRecovery) else owner:LagCompensation(true) local shootpos = owner:GetShootPos() local trace = util.TraceHull({start = shootpos, endpos = shootpos + owner:GetForward() * 8, mins = owner:OBBMins() * 0.8, maxs = owner:OBBMaxs() * 0.8, filter = owner:GetMeleeFilter()}) local ent = trace.Entity if trace.Hit then self:SetPouncing(false) self:SetNextPrimaryFire(curtime + self.HitRecovery) end if ent:IsValid() then self:SetPouncing(false) if SERVER then self:EmitBiteSound() end local damage = self.PounceDamage local phys = ent:GetPhysicsObject() if ent:IsPlayer() then ent:MeleeViewPunch(damage) if SERVER then local nearest = ent:NearestPoint(shootpos) util.Blood(nearest, math.Rand(damage * 0.5, damage * 0.75), (nearest - shootpos):GetNormalized(), math.Rand(damage * 5, damage * 10), true) end owner:AirBrake() elseif phys:IsValid() and phys:IsMoveable() then phys:ApplyForceOffset(damage * 600 * owner:EyeAngles():Forward(), (ent:NearestPoint(shootpos) + ent:GetPos() * 2) / 3) ent:SetPhysicsAttacker(owner) end ent:TakeSpecialDamage(damage, self.PounceDamageType, owner, self, trace.HitPos) owner:ViewPunch(Angle(math.Rand(-20, 20), math.Rand(-20, 20), math.Rand(-20, 20))) elseif trace.HitWorld then if SERVER then self:EmitHitSound() end end owner:LagCompensation(false) end end self:NextThink(curtime) return true end function SWEP:PrimaryAttack() local owner = self.Owner if self:GetPouncing() or CurTime() < self:GetNextPrimaryFire() or not owner:IsOnGround() or self:IsBurrowing() then return end local vel = owner:GetAimVector() vel.z = math.max(0.45, vel.z) vel:Normalize() owner:SetGroundEntity(NULL) owner:SetLocalVelocity(vel * 450) owner:DoAnimationEvent(ACT_RANGE_ATTACK1) if SERVER then self:EmitAttackSound() end self.m_ViewAngles = owner:EyeAngles() self:SetPouncing(true) end function SWEP:SecondaryAttack() if CurTime() < self:GetNextSecondaryFire() then return end self:SetNextSecondaryFire(CurTime() + 2) if SERVER then self:EmitIdleSound() end end function SWEP:Reload() local owner = self.Owner if self:GetPouncing() or CurTime() < self:GetNextPrimaryFire() or not owner:IsOnGround() then return end if self:GetBurrowTime() == 0 then if self:CanBurrow() then self:SetBurrowTime(CurTime() + self.BurrowTime) if SERVER then owner:EmitSound("npc/antlion/digdown1.wav", 60, 100) end end elseif self:GetBurrowTime() > 0 and CurTime() >= self:GetBurrowTime() then self:SetBurrowTime(-(CurTime() + self.BurrowTime)) if SERVER then owner:EmitSound("npc/antlion/digup1.wav", 60, 100) end owner:DrawShadow(true) end end function SWEP:CanBurrow() local owner = self.Owner local tr = util.TraceLine({start = owner:GetPos(), endpos = owner:GetPos() - owner:GetUp() * 8, mask = MASK_SOLID_BRUSHONLY}) return tr.HitWorld and (tr.MatType == MAT_DIRT or tr.MatType == MAT_SAND or tr.MatType == MAT_SLOSH or tr.MatType == MAT_FOILAGE or tr.MatType == 88) end function SWEP:Move(mv) if self:IsPouncing() then mv:SetSideSpeed(0) mv:SetForwardSpeed(0) elseif self:IsBurrowed() then mv:SetMaxSpeed(80) mv:SetMaxClientSpeed(80) elseif self:IsBurrowing() then mv:SetSideSpeed(0) mv:SetForwardSpeed(0) mv:SetVelocity(vector_origin) return true end end function SWEP:EmitHitSound() self.Owner:EmitSound("npc/headcrab_poison/ph_wallhit"..math.random(1, 2)..".wav") end function SWEP:EmitBiteSound() self.Owner:EmitSound("NPC_HeadCrab.Bite") end function SWEP:EmitIdleSound() local ent = self.Owner:MeleeTrace(4096, 24, self.Owner:GetMeleeFilter()).Entity if ent:IsValid() and ent:IsPlayer() then self.Owner:EmitSound("NPC_HeadCrab.Alert") else self.Owner:EmitSound("NPC_HeadCrab.Idle") end end function SWEP:EmitAttackSound() self.Owner:EmitSound("NPC_HeadCrab.Attack") end function SWEP:SetPouncing(pouncing) if not pouncing then self.m_ViewAngles = nil end self:SetDTBool(1, pouncing) end function SWEP:GetPouncing() return self:GetDTBool(1) end SWEP.IsPouncing = SWEP.GetPouncing function SWEP:SetBurrowTime(time) self:SetDTFloat(1, time) if SERVER then if time == 0 then self.Owner:TemporaryNoCollide(true) else self.Owner:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) end end end function SWEP:GetBurrowTime() return self:GetDTFloat(1) end function SWEP:IsBurrowing() return self:GetBurrowTime() ~= 0 end function SWEP:IsBurrowed() return self:GetBurrowTime() > 0 and CurTime() >= self:GetBurrowTime() end util.PrecacheSound("npc/antlion/digdown1.wav") util.PrecacheSound("npc/antlion/digup1.wav")
gpl-3.0
purebn/ShadowBot
plugins/antilink.1.lua
1
1474
-- By mohamed_devt { @MH_IQ19 } -- only enable one of them local Kick = true; local Warn = false; do local function run(msg, matches) if ( kick == true ) then Warn = false; elseif ( Warn == true ) then Kick = false; end -- check if the user is owner if ( is_realm(msg) and is_admin(msg)or is_sudo(msg) or is_momod(msg) ) then -- if he is a owner then exit out of the code return end -- load the data local data = load_data(_config.moderation.data) -- get the receiver and set the variable chat to it local chat = get_receiver(msg) -- get the sender id and set the variable user to it local user = "user#id"..msg.from.id -- check if the data 'LockLinks' from the table 'settings' is "yes" if ( data[tostring(msg.to.id)]['settings']['LockLinks'] == "yes" ) then -- send a message send_large_msg(chat, "لاترسل اي اعلانات هنا كان عليك الالتزام بالقوانين ✋🏿😈") -- kick the user who sent the message if ( Kick == true ) then chat_del_user(chat, user, ok_cb, true) elseif ( Warn == true ) then send_large_msg( get_receiver(msg), "Don't send links here @" .. msg.from.username ) end end end return { patterns = { "telegram.me/joinchat/", "https://", "www.", ".com", ".org", ".io" }, run = run } end
gpl-2.0
Laterus/Darkstar-Linux-Fork
scripts/zones/Port_Bastok/npcs/Brita.lua
5
1029
----------------------------------- -- Area: Port Bastok -- NPC: Brita -- Type: Standard NPC -- @zone: 236 -- @pos: 58.161 -3.101 -6.695 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x015a); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
devFRIND/M.F.I_BOT
plugins/ingroup.lua
156
60323
do -- Check Member local function check_member_autorealm(cb_extra, success, result) local receiver = cb_extra.receiver local data = cb_extra.data local msg = cb_extra.msg for k,v in pairs(result.members) do local member_id = v.peer_id if member_id ~= our_id then -- Group configuration data[tostring(msg.to.id)] = { group_type = 'Realm', settings = { set_name = string.gsub(msg.to.print_name, '_', ' '), lock_name = 'yes', lock_photo = 'no', lock_member = 'no', flood = 'yes' } } save_data(_config.moderation.data, data) local realms = 'realms' if not data[tostring(realms)] then data[tostring(realms)] = {} save_data(_config.moderation.data, data) end data[tostring(realms)][tostring(msg.to.id)] = msg.to.id save_data(_config.moderation.data, data) return send_large_msg(receiver, 'Welcome to your new realm !') end end end local function check_member_realm_add(cb_extra, success, result) local receiver = cb_extra.receiver local data = cb_extra.data local msg = cb_extra.msg for k,v in pairs(result.members) do local member_id = v.peer_id if member_id ~= our_id then -- Group configuration data[tostring(msg.to.id)] = { group_type = 'Realm', settings = { set_name = string.gsub(msg.to.print_name, '_', ' '), lock_name = 'yes', lock_photo = 'no', lock_member = 'no', flood = 'yes' } } save_data(_config.moderation.data, data) local realms = 'realms' if not data[tostring(realms)] then data[tostring(realms)] = {} save_data(_config.moderation.data, data) end data[tostring(realms)][tostring(msg.to.id)] = msg.to.id save_data(_config.moderation.data, data) return send_large_msg(receiver, 'Realm has been added!') end end end function check_member_group(cb_extra, success, result) local receiver = cb_extra.receiver local data = cb_extra.data local msg = cb_extra.msg for k,v in pairs(result.members) do local member_id = v.peer_id if member_id ~= our_id then -- Group configuration data[tostring(msg.to.id)] = { group_type = 'Group', moderators = {}, set_owner = member_id , settings = { set_name = string.gsub(msg.to.print_name, '_', ' '), lock_name = 'yes', lock_photo = 'no', lock_member = 'no', flood = 'yes', } } save_data(_config.moderation.data, data) local groups = 'groups' if not data[tostring(groups)] then data[tostring(groups)] = {} save_data(_config.moderation.data, data) end data[tostring(groups)][tostring(msg.to.id)] = msg.to.id save_data(_config.moderation.data, data) return send_large_msg(receiver, 'You have been promoted as the owner.') end end end local function check_member_modadd(cb_extra, success, result) local receiver = cb_extra.receiver local data = cb_extra.data local msg = cb_extra.msg for k,v in pairs(result.members) do local member_id = v.peer_id if member_id ~= our_id then -- Group configuration data[tostring(msg.to.id)] = { group_type = 'Group', long_id = msg.to.peer_id, moderators = {}, set_owner = member_id , settings = { set_name = string.gsub(msg.to.print_name, '_', ' '), lock_name = 'yes', lock_photo = 'no', lock_member = 'no', flood = 'yes', } } save_data(_config.moderation.data, data) local groups = 'groups' if not data[tostring(groups)] then data[tostring(groups)] = {} save_data(_config.moderation.data, data) end data[tostring(groups)][tostring(msg.to.id)] = msg.to.id save_data(_config.moderation.data, data) return send_large_msg(receiver, 'Group is added and you have been promoted as the owner ') end end end local function automodadd(msg) local data = load_data(_config.moderation.data) if msg.action.type == 'chat_created' then receiver = get_receiver(msg) chat_info(receiver, check_member_group,{receiver=receiver, data=data, msg = msg}) end end local function autorealmadd(msg) local data = load_data(_config.moderation.data) if msg.action.type == 'chat_created' then receiver = get_receiver(msg) chat_info(receiver, check_member_autorealm,{receiver=receiver, data=data, msg = msg}) end end local function check_member_realmrem(cb_extra, success, result) local receiver = cb_extra.receiver local data = cb_extra.data local msg = cb_extra.msg for k,v in pairs(result.members) do local member_id = v.id if member_id ~= our_id then -- Realm configuration removal data[tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) local realms = 'realms' if not data[tostring(realms)] then data[tostring(realms)] = nil save_data(_config.moderation.data, data) end data[tostring(realms)][tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) return send_large_msg(receiver, 'Realm has been removed!') end end end local function check_member_modrem(cb_extra, success, result) local receiver = cb_extra.receiver local data = cb_extra.data local msg = cb_extra.msg for k,v in pairs(result.members) do local member_id = v.peer_id if member_id ~= our_id then -- Group configuration removal data[tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) local groups = 'groups' if not data[tostring(groups)] then data[tostring(groups)] = nil save_data(_config.moderation.data, data) end data[tostring(groups)][tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) return send_large_msg(receiver, 'Group has been removed') end end end --End Check Member function show_group_settingsmod(msg, target) if not is_momod(msg) then return "For moderators only!" end local data = load_data(_config.moderation.data) if data[tostring(target)] then if data[tostring(target)]['settings']['flood_msg_max'] then NUM_MSG_MAX = tonumber(data[tostring(target)]['settings']['flood_msg_max']) print('custom'..NUM_MSG_MAX) else NUM_MSG_MAX = 5 end end local bots_protection = "Yes" if data[tostring(target)]['settings']['lock_bots'] then bots_protection = data[tostring(target)]['settings']['lock_bots'] end local leave_ban = "no" if data[tostring(target)]['settings']['leave_ban'] then leave_ban = data[tostring(target)]['settings']['leave_ban'] end if data[tostring(target)]['settings'] then if not data[tostring(target)]['settings']['lock_link'] then data[tostring(target)]['settings']['lock_link'] = 'no' end end if data[tostring(target)]['settings'] then if not data[tostring(target)]['settings']['lock_sticker'] then data[tostring(target)]['settings']['lock_sticker'] = 'no' end end if data[tostring(target)]['settings'] then if not data[tostring(target)]['settings']['public'] then data[tostring(target)]['settings']['public'] = 'no' end end if data[tostring(target)]['settings'] then if not data[tostring(target)]['settings']['lock_rtl'] then data[tostring(target)]['settings']['lock_rtl'] = 'no' end end local settings = data[tostring(target)]['settings'] local text = "Group settings:\nLock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nLock group leave : "..leave_ban.."\nflood sensitivity : "..NUM_MSG_MAX.."\nBot protection : "..bots_protection.."\nLock links : "..settings.lock_link.."\nLock RTL: "..settings.lock_rtl.."\nLock sticker: "..settings.lock_sticker.."\nPublic: "..settings.public return text end local function set_descriptionmod(msg, data, target, about) if not is_momod(msg) then return end local data_cat = 'description' data[tostring(target)][data_cat] = about save_data(_config.moderation.data, data) return 'Set group description to:\n'..about end local function get_description(msg, data) local data_cat = 'description' if not data[tostring(msg.to.id)][data_cat] then return 'No description available.' end local about = data[tostring(msg.to.id)][data_cat] local about = string.gsub(msg.to.print_name, "_", " ")..':\n\n'..about return 'About '..about end local function lock_group_arabic(msg, data, target) if not is_momod(msg) then return end local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic'] if group_arabic_lock == 'yes' then return 'Arabic is already locked' else data[tostring(target)]['settings']['lock_arabic'] = 'yes' save_data(_config.moderation.data, data) return 'Arabic has been locked' end end local function unlock_group_arabic(msg, data, target) if not is_momod(msg) then return end local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic'] if group_arabic_lock == 'no' then return 'Arabic is already unlocked' else data[tostring(target)]['settings']['lock_arabic'] = 'no' save_data(_config.moderation.data, data) return 'Arabic has been unlocked' end end local function lock_group_bots(msg, data, target) if not is_momod(msg) then return end local group_bots_lock = data[tostring(target)]['settings']['lock_bots'] if group_bots_lock == 'yes' then return 'Bots protection is already enabled' else data[tostring(target)]['settings']['lock_bots'] = 'yes' save_data(_config.moderation.data, data) return 'Bots protection has been enabled' end end local function unlock_group_bots(msg, data, target) if not is_momod(msg) then return end local group_bots_lock = data[tostring(target)]['settings']['lock_bots'] if group_bots_lock == 'no' then return 'Bots protection is already disabled' else data[tostring(target)]['settings']['lock_bots'] = 'no' save_data(_config.moderation.data, data) return 'Bots protection has been disabled' end end local function lock_group_namemod(msg, data, target) if not is_momod(msg) then return end local group_name_set = data[tostring(target)]['settings']['set_name'] local group_name_lock = data[tostring(target)]['settings']['lock_name'] if group_name_lock == 'yes' then return 'Group name is already locked' else data[tostring(target)]['settings']['lock_name'] = 'yes' save_data(_config.moderation.data, data) rename_chat('chat#id'..target, group_name_set, ok_cb, false) return 'Group name has been locked' end end local function unlock_group_namemod(msg, data, target) if not is_momod(msg) then return end local group_name_set = data[tostring(target)]['settings']['set_name'] local group_name_lock = data[tostring(target)]['settings']['lock_name'] if group_name_lock == 'no' then return 'Group name is already unlocked' else data[tostring(target)]['settings']['lock_name'] = 'no' save_data(_config.moderation.data, data) return 'Group name has been unlocked' end end local function lock_group_floodmod(msg, data, target) if not is_momod(msg) then return end local group_flood_lock = data[tostring(target)]['settings']['flood'] if group_flood_lock == 'yes' then return 'Group flood is locked' else data[tostring(target)]['settings']['flood'] = 'yes' save_data(_config.moderation.data, data) return 'Group flood has been locked' end end local function unlock_group_floodmod(msg, data, target) if not is_momod(msg) then return end if not is_owner(msg) then return "Only owners can unlock flood" end local group_flood_lock = data[tostring(target)]['settings']['flood'] if group_flood_lock == 'no' then return 'Group flood is not locked' else data[tostring(target)]['settings']['flood'] = 'no' save_data(_config.moderation.data, data) return 'Group flood has been unlocked' end end local function lock_group_membermod(msg, data, target) if not is_momod(msg) then return end local group_member_lock = data[tostring(target)]['settings']['lock_member'] if group_member_lock == 'yes' then return 'Group members are already locked' else data[tostring(target)]['settings']['lock_member'] = 'yes' save_data(_config.moderation.data, data) end return 'Group members has been locked' end local function unlock_group_membermod(msg, data, target) if not is_momod(msg) then return end local group_member_lock = data[tostring(target)]['settings']['lock_member'] if group_member_lock == 'no' then return 'Group members are not locked' else data[tostring(target)]['settings']['lock_member'] = 'no' save_data(_config.moderation.data, data) return 'Group members has been unlocked' end end local function set_public_membermod(msg, data, target) if not is_momod(msg) then return end local group_member_lock = data[tostring(target)]['settings']['public'] local long_id = data[tostring(target)]['long_id'] if not long_id then data[tostring(target)]['long_id'] = msg.to.peer_id save_data(_config.moderation.data, data) end if group_member_lock == 'yes' then return 'Group is already public' else data[tostring(target)]['settings']['public'] = 'yes' save_data(_config.moderation.data, data) end return 'Group is now: public' end local function unset_public_membermod(msg, data, target) if not is_momod(msg) then return end local group_member_lock = data[tostring(target)]['settings']['public'] local long_id = data[tostring(target)]['long_id'] if not long_id then data[tostring(target)]['long_id'] = msg.to.peer_id save_data(_config.moderation.data, data) end if group_member_lock == 'no' then return 'Group is not public' else data[tostring(target)]['settings']['public'] = 'no' save_data(_config.moderation.data, data) return 'Group is now: not public' end end local function lock_group_leave(msg, data, target) if not is_momod(msg) then return end local leave_ban = data[tostring(target)]['settings']['leave_ban'] if leave_ban == 'yes' then return 'Leaving users will be banned' else data[tostring(target)]['settings']['leave_ban'] = 'yes' save_data(_config.moderation.data, data) end return 'Leaving users will be banned' end local function unlock_group_leave(msg, data, target) if not is_momod(msg) then return end local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban'] if leave_ban == 'no' then return 'Leaving users will not be banned' else data[tostring(target)]['settings']['leave_ban'] = 'no' save_data(_config.moderation.data, data) return 'Leaving users will not be banned' end end local function unlock_group_photomod(msg, data, target) if not is_momod(msg) then return end local group_photo_lock = data[tostring(target)]['settings']['lock_photo'] if group_photo_lock == 'no' then return 'Group photo is not locked' else data[tostring(target)]['settings']['lock_photo'] = 'no' save_data(_config.moderation.data, data) return 'Group photo has been unlocked' end end local function lock_group_links(msg, data, target) if not is_momod(msg) then return end local group_link_lock = data[tostring(target)]['settings']['lock_link'] if group_link_lock == 'yes' then return 'Link posting is already locked' else data[tostring(target)]['settings']['lock_link'] = 'yes' save_data(_config.moderation.data, data) return 'Link posting has been locked' end end local function unlock_group_links(msg, data, target) if not is_momod(msg) then return end local group_link_lock = data[tostring(target)]['settings']['lock_link'] if group_link_lock == 'no' then return 'Link posting is not locked' else data[tostring(target)]['settings']['lock_link'] = 'no' save_data(_config.moderation.data, data) return 'Link posting has been unlocked' end end local function lock_group_rtl(msg, data, target) if not is_momod(msg) then return end local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl'] if group_rtl_lock == 'yes' then return 'RTL is already locked' else data[tostring(target)]['settings']['lock_rtl'] = 'yes' save_data(_config.moderation.data, data) return 'RTL has been locked' end end local function unlock_group_rtl(msg, data, target) if not is_momod(msg) then return end local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl'] if group_rtl_lock == 'no' then return 'RTL is already unlocked' else data[tostring(target)]['settings']['lock_rtl'] = 'no' save_data(_config.moderation.data, data) return 'RTL has been unlocked' end end local function lock_group_sticker(msg, data, target) if not is_momod(msg) then return end local group_sticker_lock = data[tostring(target)]['settings']['lock_sticker'] if group_sticker_lock == 'yes' then return 'Sticker posting is already locked' else data[tostring(target)]['settings']['lock_sticker'] = 'yes' save_data(_config.moderation.data, data) return 'Sticker posting has been locked' end end local function unlock_group_sticker(msg, data, target) if not is_momod(msg) then return end local group_sticker_lock = data[tostring(target)]['settings']['lock_sticker'] if group_sticker_lock == 'no' then return 'Sticker posting is already unlocked' else data[tostring(target)]['settings']['lock_sticker'] = 'no' save_data(_config.moderation.data, data) return 'Sticker posting has been unlocked' end end local function lock_group_contacts(msg, data, target) if not is_momod(msg) then return end local group_rtl_lock = data[tostring(target)]['settings']['lock_contacts'] if group_contacts_lock == 'yes' then return 'Contact posting is already locked' else data[tostring(target)]['settings']['lock_contacts'] = 'yes' save_data(_config.moderation.data, data) return 'Contact posting has been locked' end end local function unlock_group_contacts(msg, data, target) if not is_momod(msg) then return end local group_contacts_lock = data[tostring(target)]['settings']['lock_contacts'] if group_contacts_lock == 'no' then return 'Contact posting is already unlocked' else data[tostring(target)]['settings']['lock_contacts'] = 'no' save_data(_config.moderation.data, data) return 'Contact posting has been unlocked' end end local function enable_strict_rules(msg, data, target) if not is_momod(msg) then return end local group_rtl_lock = data[tostring(target)]['settings']['strict'] if strict == 'yes' then return 'Settings are already strictly enforced' else data[tostring(target)]['settings']['strict'] = 'yes' save_data(_config.moderation.data, data) return 'Settings will be strictly enforced' end end local function disable_strict_rules(msg, data, target) if not is_momod(msg) then return end local group_contacts_lock = data[tostring(target)]['settings']['strict'] if strict == 'no' then return 'Settings are not strictly enforced' else data[tostring(target)]['settings']['strict'] = 'no' save_data(_config.moderation.data, data) return 'Settings will not be strictly enforced' end end local function set_rulesmod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local data_cat = 'rules' data[tostring(target)][data_cat] = rules save_data(_config.moderation.data, data) return 'Set group rules to:\n\n'..rules end local function modadd(msg) -- superuser and admins only (because sudo are always has privilege) if not is_momod(msg) then return end if not is_admin1(msg) then return "You're not admin" end local data = load_data(_config.moderation.data) if is_group(msg) then return 'Group is already added.' end receiver = get_receiver(msg) chat_info(receiver, check_member_modadd,{receiver=receiver, data=data, msg = msg}) end local function realmadd(msg) -- superuser and admins only (because sudo are always has privilege) if not is_momod(msg) then return end if not is_admin1(msg) then return "You're not admin" end local data = load_data(_config.moderation.data) if is_realm(msg) then return 'Realm is already added.' end receiver = get_receiver(msg) chat_info(receiver, check_member_realm_add,{receiver=receiver, data=data, msg = msg}) end -- Global functions function modrem(msg) -- superuser and admins only (because sudo are always has privilege) if not is_admin1(msg) then return "You're not admin" end local data = load_data(_config.moderation.data) if not is_group(msg) then return 'Group is not added.' end receiver = get_receiver(msg) chat_info(receiver, check_member_modrem,{receiver=receiver, data=data, msg = msg}) end function realmrem(msg) -- superuser and admins only (because sudo are always has privilege) if not is_admin1(msg) then return "You're not admin" end local data = load_data(_config.moderation.data) if not is_realm(msg) then return 'Realm is not added.' end receiver = get_receiver(msg) chat_info(receiver, check_member_realmrem,{receiver=receiver, data=data, msg = msg}) end local function get_rules(msg, data) local data_cat = 'rules' if not data[tostring(msg.to.id)][data_cat] then return 'No rules available.' end local rules = data[tostring(msg.to.id)][data_cat] local rules = 'Chat rules:\n\n'..rules return rules end local function set_group_photo(msg, success, result) local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) if success then local file = 'data/photos/chat_photo_'..msg.to.id..'.jpg' print('File downloaded to:', result) os.rename(result, file) print('File moved to:', file) chat_set_photo (receiver, file, ok_cb, false) data[tostring(msg.to.id)]['settings']['set_photo'] = file save_data(_config.moderation.data, data) data[tostring(msg.to.id)]['settings']['lock_photo'] = 'yes' save_data(_config.moderation.data, data) send_large_msg(receiver, 'Photo saved!', ok_cb, false) else print('Error downloading: '..msg.id) send_large_msg(receiver, 'Failed, please try again!', ok_cb, false) end end local function promote(receiver, member_username, member_id) local data = load_data(_config.moderation.data) local group = string.gsub(receiver, 'chat#id', '') if not data[group] then return send_large_msg(receiver, 'Group is not added.') end if data[group]['moderators'][tostring(member_id)] then return send_large_msg(receiver, member_username..' is already a moderator.') end data[group]['moderators'][tostring(member_id)] = member_username save_data(_config.moderation.data, data) return send_large_msg(receiver, member_username..' has been promoted.') end local function promote_by_reply(extra, success, result) local msg = result local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '') if msg.from.username then member_username = '@'.. msg.from.username else member_username = full_name end local member_id = msg.from.peer_id if msg.to.peer_type == 'chat' then return promote(get_receiver(msg), member_username, member_id) end end local function demote(receiver, member_username, member_id) local data = load_data(_config.moderation.data) local group = string.gsub(receiver, 'chat#id', '') if not data[group] then return send_large_msg(receiver, 'Group is not added.') end if not data[group]['moderators'][tostring(member_id)] then return send_large_msg(receiver, member_username..' is not a moderator.') end data[group]['moderators'][tostring(member_id)] = nil save_data(_config.moderation.data, data) return send_large_msg(receiver, member_username..' has been demoted.') end local function demote_by_reply(extra, success, result) local msg = result local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '') if msg.from.username then member_username = '@'..msg.from.username else member_username = full_name end local member_id = msg.from.peer_id if msg.to.peer_type == 'chat' then return demote(get_receiver(msg), member_username, member_id) end end local function setowner_by_reply(extra, success, result) local msg = result local receiver = get_receiver(msg) local data = load_data(_config.moderation.data) local name_log = msg.from.print_name:gsub("_", " ") data[tostring(msg.to.id)]['set_owner'] = tostring(msg.from.id) save_data(_config.moderation.data, data) savelog(msg.to.id, name_log.." ["..msg.from.id.."] set ["..msg.from.id.."] as owner") local text = msg.from.print_name:gsub("_", " ").." is the owner now" return send_large_msg(receiver, text) end local function promote_demote_res(extra, success, result) --vardump(result) --vardump(extra) local member_id = result.peer_id local member_username = "@"..result.username local chat_id = extra.chat_id local mod_cmd = extra.mod_cmd local receiver = "chat#id"..chat_id if mod_cmd == 'promote' then return promote(receiver, member_username, member_id) elseif mod_cmd == 'demote' then return demote(receiver, member_username, member_id) end end local function mute_user_callback(extra, success, result) if result.service then local action = result.action.type if action == 'chat_add_user' or action == 'chat_del_user' or action == 'chat_rename' or action == 'chat_change_photo' then if result.action.user then user_id = result.action.user.peer_id end end else user_id = result.from.peer_id end local receiver = extra.receiver local chat_id = string.gsub(receiver, 'channel#id', '') if is_muted_user(chat_id, user_id) then mute_user(chat_id, user_id) send_large_msg(receiver, "["..user_id.."] removed from the muted user list") else unmute_user(chat_id, user_id) send_large_msg(receiver, " ["..user_id.."] added to the muted user list") end end local function modlist(msg) local data = load_data(_config.moderation.data) local groups = "groups" if not data[tostring(groups)][tostring(msg.to.id)] then return 'Group is not added.' end -- determine if table is empty if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way return 'No moderator in this group.' end local i = 1 local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n' for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do message = message ..i..' - '..v..' [' ..k.. '] \n' i = i + 1 end return message end local function callbackres(extra, success, result) local user = result.peer_id local name = string.gsub(result.print_name, "_", " ") local chat = 'chat#id'..extra.chatid send_large_msg(chat, user..'\n'..name) return user end local function callback_mute_res(extra, success, result) local user_id = result.peer_id local receiver = extra.receiver local chat_id = string.gsub(receiver, 'chat#id', '') if is_muted_user(chat_id, user_id) then unmute_user(chat_id, user_id) send_large_msg(receiver, " ["..user_id.."] removed from muted user list") else mute_user(chat_id, user_id) send_large_msg(receiver, " ["..user_id.."] added to muted user list") end end local function help() local help_text = tostring(_config.help_text) return help_text end local function cleanmember(cb_extra, success, result) local receiver = cb_extra.receiver local chat_id = "chat#id"..result.id local chatname = result.print_name for k,v in pairs(result.members) do kick_user(v.id, result.peer_id) end end local function killchat(cb_extra, success, result) local receiver = cb_extra.receiver local chat_id = "chat#id"..result.id local chatname = result.print_name for k,v in pairs(result.members) do kick_user_any(v.id, result.peer_id) end end local function killrealm(cb_extra, success, result) local receiver = cb_extra.receiver local chat_id = "chat#id"..result.id local chatname = result.print_name for k,v in pairs(result.members) do kick_user_any(v.id, result.peer_id) end end --[[local function user_msgs(user_id, chat_id) local user_info local uhash = 'user:'..user_id local user = redis:hgetall(uhash) local um_hash = 'msgs:'..user_id..':'..chat_id user_info = tonumber(redis:get(um_hash) or 0) return user_info end local function kick_zero(cb_extra, success, result) local chat_id = cb_extra.chat_id local chat = "chat#id"..chat_id local ci_user local re_user for k,v in pairs(result.members) do local si = false ci_user = v.peer_id local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) for i = 1, #users do re_user = users[i] if tonumber(ci_user) == tonumber(re_user) then si = true end end if not si then if ci_user ~= our_id then if not is_momod2(ci_user, chat_id) then chat_del_user(chat, 'user#id'..ci_user, ok_cb, true) end end end end end local function kick_inactive(chat_id, num, receiver) local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) -- Get user info for i = 1, #users do local user_id = users[i] local user_info = user_msgs(user_id, chat_id) local nmsg = user_info if tonumber(nmsg) < tonumber(num) then if not is_momod2(user_id, chat_id) then chat_del_user('chat#id'..chat_id, 'user#id'..user_id, ok_cb, true) end end end return chat_info(receiver, kick_zero, {chat_id = chat_id}) end]] local function run(msg, matches) local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) local name_log = user_print_name(msg.from) local group = msg.to.id if msg.media then if msg.media.type == 'photo' and data[tostring(msg.to.id)] and data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' and is_chat_msg(msg) and is_momod(msg) then load_photo(msg.id, set_group_photo, msg) end end if msg.to.type == 'chat' then if is_admin1(msg) or not is_support(msg.from.id) then-- Admin only if matches[1] == 'add' and not matches[2] then if not is_admin1(msg) and not is_support(msg.from.id) then-- Admin only savelog(msg.to.id, name_log.." ["..msg.from.id.."] attempted to add group [ "..msg.to.id.." ]") return end if is_realm(msg) then return 'Error: Already a realm.' end savelog(msg.to.id, name_log.." ["..msg.from.id.."] added group [ "..msg.to.id.." ]") print("group "..msg.to.print_name.."("..msg.to.id..") added") return modadd(msg) end if matches[1] == 'add' and matches[2] == 'realm' then if not is_sudo(msg) then-- Admin only savelog(msg.to.id, name_log.." ["..msg.from.id.."] attempted to add realm [ "..msg.to.id.." ]") return end if is_group(msg) then return 'Error: Already a group.' end savelog(msg.to.id, name_log.." ["..msg.from.id.."] added realm [ "..msg.to.id.." ]") print("group "..msg.to.print_name.."("..msg.to.id..") added as a realm") return realmadd(msg) end if matches[1] == 'rem' and not matches[2] then if not is_admin1(msg) and not is_support(msg.from.id) then-- Admin only savelog(msg.to.id, name_log.." ["..msg.from.id.."] attempted to remove group [ "..msg.to.id.." ]") return end if not is_group(msg) then return 'Error: Not a group.' end savelog(msg.to.id, name_log.." ["..msg.from.id.."] removed group [ "..msg.to.id.." ]") print("group "..msg.to.print_name.."("..msg.to.id..") removed") return modrem(msg) end if matches[1] == 'rem' and matches[2] == 'realm' then if not is_sudo(msg) then-- Sudo only savelog(msg.to.id, name_log.." ["..msg.from.id.."] attempted to remove realm [ "..msg.to.id.." ]") return end if not is_realm(msg) then return 'Error: Not a realm.' end savelog(msg.to.id, name_log.." ["..msg.from.id.."] removed realm [ "..msg.to.id.." ]") print("group "..msg.to.print_name.."("..msg.to.id..") removed as a realm") return realmrem(msg) end end if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "group" then return automodadd(msg) end --[[Experimental if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "super_group" then local chat_id = get_receiver(msg) users = {[1]="user#id167472799",[2]="user#id170131770"} for k,v in pairs(users) do chat_add_user(chat_id, v, ok_cb, false) end --chat_upgrade(chat_id, ok_cb, false) end ]] if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "realm" then return autorealmadd(msg) end if msg.to.id and data[tostring(msg.to.id)] then local settings = data[tostring(msg.to.id)]['settings'] if matches[1] == 'chat_add_user' then if not msg.service then return end local group_member_lock = settings.lock_member local user = 'user#id'..msg.action.user.id local chat = 'chat#id'..msg.to.id if group_member_lock == 'yes' and not is_owner2(msg.action.user.id, msg.to.id) then chat_del_user(chat, user, ok_cb, true) elseif group_member_lock == 'yes' and tonumber(msg.from.id) == tonumber(our_id) then return nil elseif group_member_lock == 'no' then return nil end end if matches[1] == 'chat_del_user' then if not msg.service then -- return "Are you trying to troll me?" end local user = 'user#id'..msg.action.user.id local chat = 'chat#id'..msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted user "..user) end if matches[1] == 'chat_delete_photo' then if not msg.service then return end local group_photo_lock = settings.lock_photo if group_photo_lock == 'yes' then local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id redis:incr(picturehash) --- local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id local picprotectionredis = redis:get(picturehash) if picprotectionredis then if tonumber(picprotectionredis) == 4 and not is_owner(msg) then kick_user(msg.from.id, msg.to.id) end if tonumber(picprotectionredis) == 8 and not is_owner(msg) then ban_user(msg.from.id, msg.to.id) local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id redis:set(picturehash, 0) end end savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to deleted picture but failed ") chat_set_photo(receiver, settings.set_photo, ok_cb, false) elseif group_photo_lock == 'no' then return nil end end if matches[1] == 'chat_change_photo' and msg.from.id ~= 0 then if not msg.service then return end local group_photo_lock = settings.lock_photo if group_photo_lock == 'yes' then local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id redis:incr(picturehash) --- local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id local picprotectionredis = redis:get(picturehash) if picprotectionredis then if tonumber(picprotectionredis) == 4 and not is_owner(msg) then kick_user(msg.from.id, msg.to.id) end if tonumber(picprotectionredis) == 8 and not is_owner(msg) then ban_user(msg.from.id, msg.to.id) local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id redis:set(picturehash, 0) end end savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change picture but failed ") chat_set_photo(receiver, settings.set_photo, ok_cb, false) elseif group_photo_lock == 'no' then return nil end end if matches[1] == 'chat_rename' then if not msg.service then return end local group_name_set = settings.set_name local group_name_lock = settings.lock_name local to_rename = 'chat#id'..msg.to.id if group_name_lock == 'yes' then if group_name_set ~= tostring(msg.to.print_name) then local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id redis:incr(namehash) local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id local nameprotectionredis = redis:get(namehash) if nameprotectionredis then if tonumber(nameprotectionredis) == 4 and not is_owner(msg) then kick_user(msg.from.id, msg.to.id) end if tonumber(nameprotectionredis) == 8 and not is_owner(msg) then ban_user(msg.from.id, msg.to.id) local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id redis:set(namehash, 0) end end savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change name but failed ") rename_chat(to_rename, group_name_set, ok_cb, false) end elseif group_name_lock == 'no' then return nil end end if matches[1] == 'setname' and is_momod(msg) then local new_name = string.gsub(matches[2], '_', ' ') data[tostring(msg.to.id)]['settings']['set_name'] = new_name save_data(_config.moderation.data, data) local group_name_set = data[tostring(msg.to.id)]['settings']['set_name'] local to_rename = 'chat#id'..msg.to.id rename_chat(to_rename, group_name_set, ok_cb, false) savelog(msg.to.id, "Group { "..msg.to.print_name.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]") end if matches[1] == 'setphoto' and is_momod(msg) then data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting' save_data(_config.moderation.data, data) return 'Please send me new group photo now' end if matches[1] == 'promote' and not matches[2] then if not is_momod(msg) then return end if not is_owner(msg) then return "Only the owner can prmote new moderators" end if type(msg.reply_id)~="nil" then msgr = get_message(msg.reply_id, promote_by_reply, false) end end if matches[1] == 'promote' and matches[2] then if not is_momod(msg) then return end if not is_owner(msg) then return "Only owner can promote" end local member = matches[2] savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted @".. member) local cbres_extra = { chat_id = msg.to.id, mod_cmd = 'promote', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') return resolve_username(username, promote_demote_res, cbres_extra) end if matches[1] == 'demote' and not matches[2] then if not is_momod(msg) then return end if not is_owner(msg) then return "Only the owner can demote moderators" end if type(msg.reply_id)~="nil" then msgr = get_message(msg.reply_id, demote_by_reply, false) end end if matches[1] == 'demote' and matches[2] then if not is_momod(msg) then return end if not is_owner(msg) then return "Only owner can demote" end if string.gsub(matches[2], "@", "") == msg.from.username and not is_owner(msg) then return "You can't demote yourself" end local member = matches[2] savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted @".. member) local cbres_extra = { chat_id = msg.to.id, mod_cmd = 'demote', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') return resolve_username(username, promote_demote_res, cbres_extra) end if matches[1] == 'modlist' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group modlist") return modlist(msg) end if matches[1] == 'about' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group description") return get_description(msg, data) end if matches[1] == 'rules' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group rules") return get_rules(msg, data) end if matches[1] == 'set' then if matches[2] == 'rules' then rules = matches[3] local target = msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group rules to ["..matches[3].."]") return set_rulesmod(msg, data, target) end if matches[2] == 'about' then local data = load_data(_config.moderation.data) local target = msg.to.id local about = matches[3] savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group description to ["..matches[3].."]") return set_descriptionmod(msg, data, target, about) end end end --Begin chat settings if matches[1] == 'lock' then local target = msg.to.id if matches[2] == 'name' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked name ") return lock_group_namemod(msg, data, target) end if matches[2] == 'member' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked member ") return lock_group_membermod(msg, data, target) end if matches[2] == 'flood' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked flood ") return lock_group_floodmod(msg, data, target) end if matches[2] == 'arabic' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked arabic ") return lock_group_arabic(msg, data, target) end if matches[2] == 'bots' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked bots ") return lock_group_bots(msg, data, target) end if matches[2] == 'leave' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked leaving ") return lock_group_leave(msg, data, target) end if matches[2] == 'links' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked link posting ") return lock_group_links(msg, data, target) end if matches[2]:lower() == 'rtl' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked rtl chars. in names") return lock_group_rtl(msg, data, target) end if matches[2] == 'sticker' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked sticker posting") return lock_group_sticker(msg, data, target) end if matches[2] == 'contacts' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked contact posting") return lock_group_contacts(msg, data, target) end end if matches[1] == 'unlock' then local target = msg.to.id if matches[2] == 'name' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked name ") return unlock_group_namemod(msg, data, target) end if matches[2] == 'member' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked member ") return unlock_group_membermod(msg, data, target) end if matches[2] == 'photo' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked photo ") return unlock_group_photomod(msg, data, target) end if matches[2] == 'flood' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked flood ") return unlock_group_floodmod(msg, data, target) end if matches[2] == 'arabic' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked arabic ") return unlock_group_arabic(msg, data, target) end if matches[2] == 'bots' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked bots ") return unlock_group_bots(msg, data, target) end if matches[2] == 'leave' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked leaving ") return unlock_group_leave(msg, data, target) end if matches[2] == 'links' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked link posting") return unlock_group_links(msg, data, target) end if matches[2]:lower() == 'rtl' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked RTL chars. in names") return unlock_group_rtl(msg, data, target) end if matches[2] == 'sticker' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked sticker posting") return unlock_group_sticker(msg, data, target) end if matches[2] == 'contacts' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked contact posting") return unlock_group_contacts(msg, data, target) end end --End chat settings --Begin Chat mutes if matches[1] == 'mute' and is_owner(msg) then local chat_id = msg.to.id if matches[2] == 'audio' then local msg_type = 'Audio' if not is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: mute "..msg_type) mute(chat_id, msg_type) return "Group "..matches[2].." has been muted" else return "Group mute "..matches[2].." is already on" end end if matches[2] == 'photo' then local msg_type = 'Photo' if not is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: mute "..msg_type) mute(chat_id, msg_type) return "Group "..matches[2].." has been muted" else return "Group mute "..matches[2].." is already on" end end if matches[2] == 'video' then local msg_type = 'Video' if not is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: mute "..msg_type) mute(chat_id, msg_type) return "Group "..matches[2].." has been muted" else return "Group mute "..matches[2].." is already on" end end if matches[2] == 'gifs' then local msg_type = 'Gifs' if not is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: mute "..msg_type) mute(chat_id, msg_type) return msg_type.." have been muted" else return "Group mute "..msg_type.." is already on" end end if matches[2] == 'documents' then local msg_type = 'Documents' if not is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: mute "..msg_type) mute(chat_id, msg_type) return msg_type.." have been muted" else return "Group mute "..msg_type.." is already on" end end if matches[2] == 'text' then local msg_type = 'Text' if not is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: mute "..msg_type) mute(chat_id, msg_type) return "Group text has been muted" else return "Group mute text is already on" end end if matches[2] == 'all' then local msg_type = 'All' if not is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: mute "..msg_type) mute(chat_id, msg_type) return "Mute "..msg_type.." has been enabled" else return "Mute "..msg_type.." is already on" end end end if matches[1] == 'unmute' and is_owner(msg) then local chat_id = msg.to.id if matches[2] == 'audio' then local msg_type = 'Audio' if is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: unmute "..msg_type) unmute(chat_id, msg_type) return "Group "..msg_type.." has been unmuted" else return "Group mute "..msg_type.." is already off" end end if matches[2] == 'photo' then local msg_type = 'Photo' if is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: unmute "..msg_type) unmute(chat_id, msg_type) return "Group "..msg_type.." has been unmuted" else return "Group mute "..msg_type.." is already off" end end if matches[2] == 'Video' then local msg_type = 'Video' if is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: unmute "..msg_type) unmute(chat_id, msg_type) return "Group "..msg_type.." has been unmuted" else return "Group mute "..msg_type.." is already off" end end if matches[2] == 'gifs' then local msg_type = 'Gifs' if is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: unmute "..msg_type) unmute(chat_id, msg_type) return msg_type.." have been unmuted" else return "Mute "..msg_type.." is already off" end end if matches[2] == 'documents' then local msg_type = 'Documents' if is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: unmute "..msg_type) unmute(chat_id, msg_type) return msg_type.." have been unmuted" else return "Mute "..msg_type.." is already off" end end if matches[2] == 'text' then local msg_type = 'Text' if is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: unmute message") unmute(chat_id, msg_type) return "Group text has been unmuted" else return "Group mute text is already off" end end if matches[2] == 'all' then local msg_type = 'All' if is_muted(chat_id, msg_type..': yes') then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: unmute "..msg_type) unmute(chat_id, msg_type) return "Mute "..msg_type.." has been disabled" else return "Mute "..msg_type.." is already disabled" end end end --Begin chat muteuser if matches[1] == "muteuser" and is_momod(msg) then local chat_id = msg.to.id local hash = "mute_user"..chat_id local user_id = "" if type(msg.reply_id) ~= "nil" then local receiver = get_receiver(msg) local get_cmd = "mute_user" get_message(msg.reply_id, mute_user_callback, {receiver = receiver, get_cmd = get_cmd}) elseif matches[1] == "muteuser" and string.match(matches[2], '^%d+$') then local user_id = matches[2] if is_muted_user(chat_id, user_id) then mute_user(chat_id, user_id) return "["..user_id.."] removed from the muted users list" else unmute_user(chat_id, user_id) return "["..user_id.."] added to the muted user list" end elseif matches[1] == "muteuser" and not string.match(matches[2], '^%d+$') then local receiver = get_receiver(msg) local get_cmd = "mute_user" local username = matches[2] local username = string.gsub(matches[2], '@', '') resolve_username(username, callback_mute_res, {receiver = receiver, get_cmd = get_cmd}) end end --End Chat muteuser if matches[1] == "muteslist" and is_momod(msg) then local chat_id = msg.to.id if not has_mutes(chat_id) then set_mutes(chat_id) return mutes_list(chat_id) end savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup muteslist") return mutes_list(chat_id) end if matches[1] == "mutelist" and is_momod(msg) then local chat_id = msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup mutelist") return muted_user_list(chat_id) end if matches[1] == 'settings' and is_momod(msg) then local target = msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group settings ") return show_group_settingsmod(msg, target) end if matches[1] == 'public' and is_momod(msg) then local target = msg.to.id if matches[2] == 'yes' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: public") return set_public_membermod(msg, data, target) end if matches[2] == 'no' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: not public") return unset_public_membermod(msg, data, target) end end if msg.to.type == 'chat' then if matches[1] == 'newlink' and not is_realm(msg) then if not is_momod(msg) then return "For moderators only!" end local function callback (extra , success, result) local receiver = 'chat#'..msg.to.id if success == 0 then return send_large_msg(receiver, '*Error: Invite link failed* \nReason: Not creator.') end send_large_msg(receiver, "Created a new link") data[tostring(msg.to.id)]['settings']['set_link'] = result save_data(_config.moderation.data, data) end local receiver = 'chat#'..msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] revoked group link ") return export_chat_link(receiver, callback, true) end if matches[1] == 'link' then if not is_momod(msg) then return "For moderators only!" end local group_link = data[tostring(msg.to.id)]['settings']['set_link'] if not group_link then return "Create a link using /newlink first !" end savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group link ["..group_link.."]") return "Group link:\n"..group_link end if matches[1] == 'setowner' and matches[2] then if not is_owner(msg) then return "For owner only!" end data[tostring(msg.to.id)]['set_owner'] = matches[2] save_data(_config.moderation.data, data) savelog(msg.to.id, name_log.." ["..msg.from.id.."] set ["..matches[2].."] as owner") local text = matches[2].." added as owner" return text end if matches[1] == 'setowner' and not matches[2] then if not is_owner(msg) then return "only for the owner!" end if type(msg.reply_id)~="nil" then msgr = get_message(msg.reply_id, setowner_by_reply, false) end end end if matches[1] == 'owner' then local group_owner = data[tostring(msg.to.id)]['set_owner'] if not group_owner then return "no owner,ask admins in support groups to set owner for your group" end savelog(msg.to.id, name_log.." ["..msg.from.id.."] used /owner") return "Group owner is ["..group_owner..']' end if matches[1] == 'setgpowner' then local receiver = "chat#id"..matches[2] if not is_admin1(msg) then return "For admins only!" end data[tostring(matches[2])]['set_owner'] = matches[3] save_data(_config.moderation.data, data) local text = matches[3].." added as owner" send_large_msg(receiver, text) return end if matches[1] == 'setflood' then if not is_momod(msg) then return "For moderators only!" end if tonumber(matches[2]) < 5 or tonumber(matches[2]) > 20 then return "Wrong number,range is [5-20]" end local flood_max = matches[2] data[tostring(msg.to.id)]['settings']['flood_msg_max'] = flood_max save_data(_config.moderation.data, data) savelog(msg.to.id, name_log.." ["..msg.from.id.."] set flood to ["..matches[2].."]") return 'Group flood has been set to '..matches[2] end if msg.to.type == 'chat' then if matches[1] == 'clean' then if not is_owner(msg) then return "Only owner can clean" end if matches[2] == 'member' then if not is_owner(msg) then return "Only admins can clean members" end local receiver = get_receiver(msg) chat_info(receiver, cleanmember, {receiver=receiver}) end end if matches[2] == 'modlist' then if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way return 'No moderator in this group.' end local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n' for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do data[tostring(msg.to.id)]['moderators'][tostring(k)] = nil save_data(_config.moderation.data, data) end savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned modlist") end if matches[2] == 'rules' then local data_cat = 'rules' data[tostring(msg.to.id)][data_cat] = nil save_data(_config.moderation.data, data) savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned rules") end if matches[2] == 'about' then local data_cat = 'description' data[tostring(msg.to.id)][data_cat] = nil save_data(_config.moderation.data, data) savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned about") end end if msg.to.type == 'chat' then if matches[1] == 'kill' and matches[2] == 'chat' then if not is_admin1(msg) then return nil end if not is_realm(msg) then local receiver = get_receiver(msg) return modrem(msg), print("Closing Group..."), chat_info(receiver, killchat, {receiver=receiver}) else return 'This is a realm' end end if matches[1] == 'kill' and matches[2] == 'realm' then if not is_admin1(msg) then return nil end if not is_group(msg) then local receiver = get_receiver(msg) return realmrem(msg), print("Closing Realm..."), chat_info(receiver, killrealm, {receiver=receiver}) else return 'This is a group' end end if matches[1] == 'help' then if not is_momod(msg) or is_realm(msg) then return end savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /help") return help() end if matches[1] == 'res' then local cbres_extra = { chatid = msg.to.id } local username = matches[2] local username = username:gsub("@","") resolve_username(username, callbackres, cbres_extra) return end if matches[1] == 'kickinactive' then --send_large_msg('chat#id'..msg.to.id, 'I\'m in matches[1]') if not is_momod(msg) then return 'Only a moderator can kick inactive users' end local num = 1 if matches[2] then num = matches[2] end local chat_id = msg.to.id local receiver = get_receiver(msg) return kick_inactive(chat_id, num, receiver) end end end end local function pre_process(msg) if not msg.text and msg.media then msg.text = '['..msg.media.type..']' end return msg end return { patterns = { "^[#!/](add)$", "^[#!/](add) (realm)$", "^[#!/](rem)$", "^[#!/](rem) (realm)$", "^[#!/](rules)$", "^[#!/](about)$", "^[#!/](setname) (.*)$", "^[#!/](setphoto)$", "^[#!/](promote) (.*)$", "^[#!/](promote)", "^[#!/](help)$", "^[#!/](clean) (.*)$", "^[#!/](kill) (chat)$", "^[#!/](kill) (realm)$", "^[#!/](demote) (.*)$", "^[#!/](demote)", "^[#!/](set) ([^%s]+) (.*)$", "^[#!/](lock) (.*)$", "^[#!/](setowner) (%d+)$", "^[#!/](setowner)", "^[#!/](owner)$", "^[#!/](res) (.*)$", "^[#!/](setgpowner) (%d+) (%d+)$",-- (group id) (owner id) "^[#!/](unlock) (.*)$", "^[#!/](setflood) (%d+)$", "^[#!/](settings)$", "^[#!/](public) (.*)$", "^[#!/](modlist)$", "^[#!/](newlink)$", "^[#!/](link)$", "^[#!/]([Mm]ute) ([^%s]+)$", "^[#!/]([Uu]nmute) ([^%s]+)$", "^[#!/]([Mm]uteuser)$", "^[#!/]([Mm]uteuser) (.*)$", "^[#!/]([Mm]uteslist)$", "^[#!/]([Mm]utelist)$", "^[#!/](kickinactive)$", "^[#!/](kickinactive) (%d+)$", "%[(document)%]", "%[(photo)%]", "%[(video)%]", "%[(audio)%]", "^!!tgservice (.+)$", }, run = run, pre_process = pre_process } end
gpl-2.0
NPLPackages/paracraft
script/apps/Aries/Partners/keepwork/KeepWorkLogin.lua
1
12232
--[[ Title: keepwork login page Author(s): leio Date: 2017/7/20 Desc: Use Lib: ------------------------------------------------------- NPL.load("(gl)script/apps/Aries/Partners/keepwork/KeepWorkLogin.lua"); local KeepWorkLogin = commonlib.gettable("MyCompany.Aries.Partners.keepwork.KeepWorkLogin"); KeepWorkLogin.ShowPage(url) ------------------------------------------------------- ]] NPL.load("(gl)script/apps/Aries/Partners/PartnerPlatforms.lua"); NPL.load("(gl)script/apps/Aries/Login/MainLogin.lua"); local Platforms = commonlib.gettable("MyCompany.Aries.Partners.Platforms"); local MainLogin = commonlib.gettable("MyCompany.Aries.MainLogin"); local KeepWorkRealname = NPL.load("(gl)script/apps/Aries/Partners/keepwork/KeepWorkRealname.lua"); local KeepWorkLogin = commonlib.gettable("MyCompany.Aries.Partners.keepwork.KeepWorkLogin"); KeepWorkLogin.client_id = "1000003"; function KeepWorkLogin.OnInit() KeepWorkLogin.page = document:GetPageCtrl(); end function KeepWorkLogin.LoadLocalData() local local_data = MyCompany.Aries.Player.LoadLocalData("KeepWork_Local_UserInfo_Data", {}); if local_data and local_data.username then KeepWorkRealname.LoadGameTime() end return local_data.username,local_data.password; end function KeepWorkLogin.SaveLocalData(username,password) local local_data = MyCompany.Aries.Player.LoadLocalData("KeepWork_Local_UserInfo_Data", {}); if(username)then local_data.username = username; local_data.password = password; else local_data.username = nil; local_data.password = nil; end MyCompany.Aries.Player.SaveLocalData("KeepWork_Local_UserInfo_Data", local_data) end function KeepWorkLogin.ClosePage() if(KeepWorkLogin.page)then KeepWorkLogin.page:CloseWindow(); end end function KeepWorkLogin.ShowPage() NPL.load("(gl)script/apps/Aries/Creator/Game/Login/ParaWorldLoginDocker.lua"); local ParaWorldLoginDocker = commonlib.gettable("MyCompany.Aries.Game.MainLogin.ParaWorldLoginDocker") ParaWorldLoginDocker.InitParaWorldClient(); if(System.User and System.User.keepworktoken) then if(System.User.keepworktoken == "waiting") then KeepWorkLogin.mytimer = KeepWorkLogin.mytimer or commonlib.Timer:new({callbackFunc = function(timer) if(System.User.keepworktoken == "error") then timer:Change(); elseif(System.User.keepworktoken ~= "waiting") then KeepWorkLogin.LoginWithToken(System.User.keepworktoken) timer:Change(); end end}) KeepWorkLogin.mytimer:Change(300, 300); elseif(System.User.keepworktoken == "error") then return else KeepWorkLogin.LoginWithToken(System.User.keepworktoken) end else KeepWorkLogin.ShowLoginPage() end end function KeepWorkLogin.site() return "https://keepwork.com"; end function KeepWorkLogin.LoginWithToken(token) local url = format("%s/api/wiki/models/user/getProfile", KeepWorkLogin.site()) System.os.GetUrl({ url = url, json = true, headers = { ["Authorization"] = " Bearer " .. token, }, }, function(err, msg, data) if(err == 200) then local userInfo = data.data; if(userInfo and userInfo.username) then local username = userInfo.username; LOG.std(nil, "debug", "keepwork login username", username); LOG.std(nil, "debug", "keepwork login token", token); KeepWorkLogin.agreeOauth(username, KeepWorkLogin.client_id, token); end else System.User.keepworktoken = nil; _guihelper.MessageBox("登陆凭证过期,请重新登陆!") KeepWorkLogin.ShowLoginPage() end end) end function KeepWorkLogin.ShowLoginPage() local width, height = 960, 560; local params = { url = "script/apps/Aries/Partners/keepwork/KeepWorkLogin.html", name = "keepwork.KeepWorkLogin", isShowTitleBar = false, DestroyOnClose = true, -- prevent many ViewProfile pages staying in memory style = CommonCtrl.WindowFrame.ContainerStyle, zorder = 1, directPosition = true, align = "_fi", x = 0, y = 0, width = 0, height = 0, }; System.App.Commands.Call("File.MCMLWindowFrame", params); end -- return true if we can login function KeepWorkLogin.CheckLoginTime() -- cold down time KeepWorkLogin.last_send_time = KeepWorkLogin.last_send_time or 0; local curTime = ParaGlobal.timeGetTime(); if((curTime-KeepWorkLogin.last_send_time) < 3000) then _guihelper.MessageBox("正在登陆,请等待。。。"); return; end KeepWorkLogin.last_send_time = curTime; return true end function KeepWorkLogin.OnClickLogin(btnName, forms) if(not KeepWorkLogin.CheckLoginTime()) then return end local username = string.gsub(forms.user_name or "", "^%s*(.-)%s*$", "%1"); local password = string.gsub(forms.password or "", "^%s*(.-)%s*$", "%1"); NPL.load("(gl)script/apps/Aries/Login/ExternalUserModule.lua"); local ExternalUserModule = commonlib.gettable("MyCompany.Aries.ExternalUserModule"); local region_config = ExternalUserModule:GetConfig(); forms = forms or {}; if(not forms.checkbox_remember_username) then forms.checkbox_remember_password = false; end if(not username or string.len(username) == 0)then local s = string.format([[%s不能为空!]],MyCompany.Aries.ExternalUserModule:GetConfig().account_name); _guihelper.MessageBox(s) return end if(not password or string.len(password) == 0)then local s = string.format([[%s不能为空!]],MyCompany.Aries.ExternalUserModule:GetConfig().account_name); _guihelper.MessageBox("密码不能为空!") return end if(string.len(username)>50) then local s = string.format([[请输入正确的%s或Email]],MyCompany.Aries.ExternalUserModule:GetConfig().account_name); _guihelper.MessageBox(s) return end KeepWorkLogin.forms = { username = username, password = password, checkbox_remember_username = forms.checkbox_remember_username, checkbox_remember_password = forms.checkbox_remember_password, } local url = "https://keepwork.com/api/wiki/models/user/login"; System.os.GetUrl({ url = url, json = true, form = { username = username, password = password, } }, function(err, msg, data) LOG.std(nil, "debug", "keepwork login err", err); LOG.std(nil, "debug", "keepwork login msg", msg); LOG.std(nil, "debug", "keepwork login data", data); if(err and err == 503)then _guihelper.MessageBox("keepwork正在维护中,我们马上回来"); return end if(data and data.data and data.data.token)then _guihelper.MessageBox(nil); --实名认证 local idcardAuth = data.data.userinfo.idcardAuth if not idcardAuth or idcardAuth.status ~= 0 then _guihelper.MessageBox("你的账号未实名,是否进行实名认证",function () KeepWorkLogin.RealNameAuth(data.data.token) end) return end --正常流程 KeepWorkRealname.SetUserAge(idcardAuth) KeepWorkLogin.GetOrCreateSessionId() if(data.data.userinfo and data.data.userinfo.username)then username = data.data.userinfo.username; -- use username in the callback info end local token = data.data.token; LOG.std(nil, "debug", "keepwork login username", username); LOG.std(nil, "debug", "keepwork login token", token); KeepWorkLogin.agreeOauth(username,KeepWorkLogin.client_id,token) return end if(data and data.error)then _guihelper.MessageBox(data.error.message); return end end); end function KeepWorkLogin.LoginAction(type) if not type then return end if type == 0 then KeepWorkRealname.ExitGame() else KeepWorkRealname.StartGame() end local url = "https://keepwork.com/api/wiki/models/users/idcard/behavior/loginout"; System.os.GetUrl({ url = url, json = true, form = { sessionId = KeepWorkLogin.GetOrCreateSessionId(), type = type, }, headers = { ["Authorization"] = " Bearer " .. System.User.keepworktoken or "", }, }, function(err, msg, data) LOG.std(nil, "debug", "keepwork LoginAction err", err); LOG.std(nil, "debug", "keepwork LoginAction msg", msg); LOG.std(nil, "debug", "keepwork LoginAction data", data); if(err and err == 503)then _guihelper.MessageBox("keepwork正在维护中,我们马上回来"); return end if(data and data.error)then _guihelper.MessageBox(data.error.message); end end); end function KeepWorkLogin.GetOrCreateSessionId() if not KeepWorkLogin.sessionId then KeepWorkLogin.sessionId = os.time() return KeepWorkLogin.sessionId end return KeepWorkLogin.sessionId end function KeepWorkLogin.RealNameAuth(token) local url = "https://keepwork.com/haqi/rr/realname?uid="..token; ParaGlobal.ShellExecute("open", url, "", "", 1) end function KeepWorkLogin.agreeOauth(username,client_id,token) local url = "https://keepwork.com/api/wiki/models/oauth_app/agreeOauth"; System.os.GetUrl({ url = url, json = true, form = { username = username, client_id = client_id, }, headers = { ["Authorization"] = " Bearer " .. token, }, }, function(err, msg, data) LOG.std(nil, "debug", "keepwork agreeOauth err", err); LOG.std(nil, "debug", "keepwork agreeOauth msg", msg); LOG.std(nil, "debug", "keepwork agreeOauth data", data); if(err and err == 503)then _guihelper.MessageBox("keepwork正在维护中,我们马上回来"); return end if(data and data.data and data.data.code)then local code = data.data.code; LOG.std(nil, "debug", "keepwork agreeOauth code", code); KeepWorkLogin.ClosePage() if(not System.User.keepworktoken) then System.User.keepworktoken = token; -- save token if(KeepWorkLogin.forms.checkbox_remember_username)then if(KeepWorkLogin.forms.checkbox_remember_password)then KeepWorkLogin.SaveLocalData(KeepWorkLogin.forms.username,KeepWorkLogin.forms.password) else KeepWorkLogin.SaveLocalData(KeepWorkLogin.forms.username,nil) end else KeepWorkLogin.SaveLocalData(nil); end end MainLogin:next_step({IsLoginStarted=true, auth_user = { username = username, plat = Platforms.PLATS.KEEPWORK, token = code, oid = string.lower(username), from = Platforms.PLATS.KEEPWORK, loginplat = 1, rememberusername = true } }); return; end if(data and data.error)then _guihelper.MessageBox(data.error.message); end end); end function KeepWorkLogin.OnClickChangePassword() NPL.load("(gl)script/apps/Aries/Login/ExternalUserModule.lua"); local ExternalUserModule = commonlib.gettable("MyCompany.Aries.ExternalUserModule"); local cfg = ExternalUserModule:GetConfig(); local url_changepasswd= cfg.account_change_url; ParaGlobal.ShellExecute("open", url_changepasswd, "", "", 1); end function KeepWorkLogin.OnClickForgetPassword() NPL.load("(gl)script/apps/Aries/Login/ExternalUserModule.lua"); local ExternalUserModule = commonlib.gettable("MyCompany.Aries.ExternalUserModule"); local cfg = ExternalUserModule:GetConfig(); local url_forgetpasswd= cfg.account_forget_url; ParaGlobal.ShellExecute("open", url_forgetpasswd, "", "", 1); end -- uncheck remember password if remember username is unchecked. function KeepWorkLogin.OnCheckRememberUsername(bChecked) if(not bChecked) then KeepWorkLogin.page:SetValue("checkbox_remember_password", false); end end -- notify the user if the password checkbox is checked function KeepWorkLogin.OnCheckRememberPassword(bChecked) if(bChecked == true) then local s = string.format([[只有在自己家里上网才能选择“记住密码”;<br/> 并且要牢记自己的%s和密码哦! ]],MyCompany.Aries.ExternalUserModule:GetConfig().account_name); _guihelper.MessageBox(s); end end
gpl-2.0
pakoito/ToME---t-engine4
game/modules/tome/data/zones/eidolon-plane/npcs.lua
3
1330
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org newEntity{ define_as = "EIDOLON", type = "unknown", subtype = "unknown", name = "The Eidolon", display = "@", color=colors.GREY, resolvers.nice_tile{image="invis.png", add_mos = {{image="npc/unknown_unknown_the_eidolon.png", display_h=2, display_y=-1}}}, desc = [[A ripple in the void that somehow seems... alive, this creature stares at you with interest.]], faction = "neutral", blood_color = colors.DARK, level_range = {200, nil}, exp_worth = 0, rank = 5, never_move = 1, invulnerable = 1, never_anger = 1, can_talk = "eidolon-plane", }
gpl-3.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Network/LobbyService/LobbyMessageType.lua
1
1062
--[[ Title: LobbyServer Author(s): LanZhihong Date: 2018/12/19 Desc: all LobbyServer use the lib: ------------------------------------------------------- NPL.load("(gl)script/apps/Aries/Creator/Game/Network/LobbyService/LobbyMessageType.lua"); local LobbyMessageType = commonlib.gettable("MyCompany.Aries.Game.Network.LobbyMessageType"); ------------------------------------------------------- ]] local LobbyMessageType = commonlib.gettable("MyCompany.Aries.Game.Network.LobbyMessageType"); --[[ udp {name = keepworkUsername, projectId = 900, version = 1001, editMode = true/false} --]] LobbyMessageType.REQUEST_ECHO = 1; --[[ udp {port = 8099, name = keepworkUsername} ]] LobbyMessageType.RESPONSE_ECHO = 2; --[[ tcp {name = keepworkUsername, nickname = nickname} ]] LobbyMessageType.REQUEST_CONNECT = 3; --[[ tcp {name = keepworkUsername, nickname = nickname} ]] LobbyMessageType.RESPONSE_CONNECT = 4; --[[ tcp {title = "custom title", data = anytype} ]] LobbyMessageType.USER_DATA = 5; --[[ udp ]] LobbyMessageType.CUSTOM = 6;
gpl-2.0
TeamHypersomnia/Hypersomnia
hypersomnia/content/gfx/metropolis_torso_rifle_shot_5.meta.lua
2
2790
return { extra_loadables = { enabled_generate_neon_map = { alpha_multiplier = 0.43000000715255737, amplification = 140, light_colors = { "89 31 168 255", "48 42 88 255", "61 16 123 0" }, radius = { x = 80, y = 80 }, standard_deviation = 6 }, generate_desaturation = false }, offsets = { gun = { bullet_spawn = { x = 0, y = 0 }, chamber = { pos = { x = 0, y = 0 }, rotation = 0 }, chamber_magazine = { pos = { x = 0, y = 0 }, rotation = 0 }, detachable_magazine = { pos = { x = 0, y = 0 }, rotation = 0 }, shell_spawn = { pos = { x = 0, y = 0 }, rotation = 0 } }, item = { attachment_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, back_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, beep_offset = { pos = { x = 0, y = 0 }, rotation = 0 }, hand_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, head_anchor = { pos = { x = 0, y = 0 }, rotation = 0 }, shoulder_anchor = { pos = { x = 0, y = 0 }, rotation = 0 } }, legs = { foot = { x = 0, y = 0 } }, non_standard_shape = { convex_partition = {}, original_poly = {} }, torso = { back = { pos = { x = -16, y = -12 }, rotation = 39 }, head = { pos = { x = -4, y = -2 }, rotation = 3 }, legs = { pos = { x = -6, y = -1 }, rotation = 0 }, primary_hand = { pos = { x = -4, y = 18 }, rotation = -3.5 }, secondary_hand = { pos = { x = 0, y = 0 }, rotation = 0 }, secondary_shoulder = { pos = { x = -14, y = 16 }, rotation = -142 }, shoulder = { pos = { x = 12, y = -15 }, rotation = -142 }, strafe_facing_offset = 0 } }, usage_as_button = { bbox_expander = { x = 0, y = 0 }, flip = { horizontally = false, vertically = false } } }
agpl-3.0
mysql/mysql-proxy
lib/auditing.lua
6
1694
--[[ $%BEGINLICENSE%$ Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA $%ENDLICENSE%$ --]] local user = "" function read_handshake( ) local con = proxy.connection print("<-- let's send him some information about us") print(" server-addr : " .. con.server.dst.name) print(" client-addr : " .. con.client.src.name) end function read_auth( ) local con = proxy.connection print("--> there, look, the client is responding to the server auth packet") print(" username : " .. con.client.username) user = con.client.username end function read_auth_result( auth ) local state = auth.packet:byte() if state == proxy.MYSQLD_PACKET_OK then print("<-- auth ok"); elseif state == proxy.MYSQLD_PACKET_ERR then print("<-- auth failed"); else print("<-- auth ... don't know: " .. string.format("%q", auth.packet)); end end function read_query( packet ) print("--> '".. user .."' sent us a query") if packet:byte() == proxy.COM_QUERY then print(" query: " .. packet:sub(2)) end end
gpl-2.0
dwindow/dwindow
oem-3dvstar/dwindow/dwindow_UI/dwindow.lua
1
9966
local rect = {0,0,99999,99999,0,0} local rects = {} local bitmapcache = {} -- helper functions function GetPath(pathname) if pathname == nil then return end local t = string.reverse(pathname) t = string.sub(t, string.find(t, "\\") or string.find(t, "/") or 1) return string.reverse(t) end function GetName(pathname) if pathname == nil then return end local t = string.reverse(pathname) t = string.sub(t, 1, ((string.find(t, "\\") or string.find(t, "/") or t:len())-1)) return string.reverse(t) end local lua_file = core.loading_file local lua_path = GetPath(lua_file) function debug_print(...) --print("--DEBUG", ...) end function info(...) --print("--INFO", ...) end function error(...) print("--ERROR:", ...) end function BeginChild(left, top, right, bottom, alpha) local left_unclip, top_unclip = left, top left = math.max(rect[1], left) top = math.max(rect[2], top) right = math.min(rect[3], right) bottom = math.min(rect[4], bottom) local new_rect = {left, top, right, bottom, left_unclip, top_unclip, alpha} table.insert(rects, rect) rect = new_rect dx9.set_clip_rect_core(left, top, right, bottom) end function EndChild(left, top, right, bottom) rect = table.remove(rects) dx9.set_clip_rect_core(rects[1], rects[2], rects[3], rects[4]) end function IsCurrentDrawingVisible() return rect[3]>rect[1] and rect[4]>rect[2] end -- global window or dshow or etc callback function OnDirectshowEvents(event_code, param1, param2) print("OnDirectshowEvents", event_code, param1, param2) local EC_COMPLETE = 1 if event_code == EC_COMPLETE then if playlist:current_pos() >= playlist:count() then player.stop() player.seek(0) else playlist:next() end end end function OnMove() end function OnSize() end -- pre render local last_pre_render_time = 0 function PreRender(view) local delta_time = 0; if last_pre_render_time > 0 then delta_time = core.GetTickCount() - last_pre_render_time end last_pre_render_time = core.GetTickCount(); if view ==0 then root:BroadCastEvent("PreRender", last_pre_render_time, delta_time) end end -- the Main Render function local last_render_time = 0 function RenderUI(view) local delta_time = 0; if last_render_time > 0 then delta_time = core.GetTickCount() - last_render_time end last_render_time = core.GetTickCount(); local t = core.GetTickCount() if view == 0 then root:BroadCastEvent("PreRenderUI", last_render_time, delta_time) end local dt = core.GetTickCount() -t t = core.GetTickCount() root:render(view) local dt2 = core.GetTickCount() -t if dt > 0 or dt2 > 0 then info(string.format("slow RenderUI() : PreRender() cost %dms, render() cost %dms", dt, dt2)) end end local last_update_time = 0 function UpdateUI() local delta_time = 0; if last_render_time > 0 then delta_time = core.GetTickCount() - last_render_time end root:BroadCastEvent("OnUpdate", last_update_time, delta_time) last_update_time = core.GetTickCount() end -- resource base class local resource_base ={} function resource_base:create(handle, width, height) local o = {handle = handle, width = width, height = height} setmetatable(o, self) self.__index = self return o end function resource_base:commit() return dx9.commit_resource_core(self.handle) end function resource_base:decommit() return dx9.decommit_resource_core(self.handle) end function resource_base:release() return dx9.release_resource_core(self.handle) end -- GPU resource management function OnInitCPU() debug_print("OnInitCPU") root:BroadCastEvent("OnInitCPU", last_render_time, delta_time) -- load resources here (optional) end function OnInitGPU() debug_print("OnInitGPU") root:BroadCastEvent("OnInitGPU", last_render_time, delta_time) root:BroadCastEvent("OnLayoutChange") -- commit them to GPU (optional) -- handle resize changes here (must) end function OnReleaseGPU() -- decommit all GPU resources (must) debug_print("OnReleaseGPU") root:BroadCastEvent("OnReleaseGPU", last_render_time, delta_time) releaseCache(true) end function OnReleaseCPU() -- release all resources (must) debug_print("OnReleaseCPU") root:BroadCastEvent("OnReleaseCPU", last_render_time, delta_time) releaseCache(false) end function releaseCache(is_decommit) if is_decommit then for _,v in pairs(bitmapcache) do dx9.decommit_resource_core(v.handle) end else for _,v in pairs(bitmapcache) do dx9.release_resource_core(v.handle) end bitmapcache = {} end end function test_get_text_bitmap(...) local res, width, height = dx9.draw_font_core(...) -- width is also used as error msg output. if not res then error(width, filename) return end return resource_base:create(res, width, height) end DrawText = test_get_text_bitmap function get_bitmap(filename, reload) if reload then unload_bitmap(filename) end if bitmapcache[filename] == nil then local res, width, height = dx9.load_bitmap_core(filename) -- width is also used as error msg output. bitmapcache[filename] = resource_base:create(res, width, height) bitmapcache[filename].filename = filename if not res then error(width, filename) bitmapcache[filename].width = nil bitmapcache[filename].error_msg = width end --print("loaded", filename, width, height) end -- reset ROI local rtn = bitmapcache[filename] rtn.left = 0 rtn.right = 0 rtn.top = 0 rtn.bottom = 0 return rtn end function unload_bitmap(filename, is_decommit) local tbl = bitmapcache[filename] if not tbl or type(tbl)~="table" then return end if is_decommit then dx9.decommit_resource_core(bitmapcache[filename].handle) else dx9.release_resource_core(bitmapcache[filename].handle) bitmapcache[filename] = nil end end -- set region of interest function set_bitmap_rect(bitmap, left, top, right, bottom) if not bitmap or "table" ~= type(bitmap) then return end bitmap.left = left bitmap.right = right bitmap.top = top bitmap.bottom = bottom end -- paint bilinear_mipmap_minus_one = 0 lanczos = 1 bilinear_no_mipmap = 2 lanczos_onepass = 3 bilinear_mipmap = 4 function paint(left, top, right, bottom, bitmap, alpha, resampling_method) if not bitmap or not bitmap.handle then return end local x,y = rect[5], rect[6] local a = alpha or 1.0 return dx9.paint_core(left+x, top+y, right+x, bottom+y, bitmap.handle, bitmap.left, bitmap.top, bitmap.right, bitmap.bottom, a, resampling_method or bilinear_no_mipmap) end -- native threading support Thread = {} function Thread:Create(func, ...) local o = {} setmetatable(o, self) self.__index = self self.handle = core.CreateThread(func, ...) return o end -- these two native method is not usable because it will keep root state machine locked and thus deadlock whole lua state machine function Thread:Resume() return core.ResumeThread(self.handle) end function Thread:Suspend() return core:SuspendThread(self.handle) end --function Thread:Terminate(exitcode) -- return core.TerminateThread(self.handle, exitcode or 0) --end function Thread:Wait(timeout) return core.WaitForSingleObject(self.handle, timeout) end function Thread:Sleep(timeout) -- direct use of core.Sleep() is recommended return core.Sleep(timeout) end -- helper functions and settings function merge_table(op, tomerge) for k,v in pairs(tomerge) do if type(v) == "table" and type(op[k]) == "table" then merge_table(op[k], v) else op[k] = v end end end function ReloadUI(legacy) print("ReloadUI()", legacy, root) OnReleaseGPU() OnReleaseCPU() root = BaseFrame:Create() if legacy then return end print(core.execute_luafile(lua_path .. (core.v and "3dvplayer" or "DWindow2" ).. "\\render.lua")) --print(core.execute_luafile(lua_path .. "Tetris\\Tetris.lua")) --v3dplayer_add_button() end function set_setting(name, value) setting[name] = value core.ApplySetting(name) end function apply_adv_settings() player.set_output_channel(setting.AudioChannel) player.set_normalize_audio(setting.NormalizeAudio > 1) player.set_input_layout(setting.InputLayout) player.set_mask_mode(setting.MaskMode) player.set_output_mode(setting.OutputMode) player.set_topmost(setting.Topmost) end function format_table(t, level) level = level or 1 leveld1 = level > 1 and level -1 or 0 local o = {} local lead = "" for i=1,level do lead = "\t" .. lead end local leadd1 = "" for i=1,leveld1 do leadd1 = "\t" .. leadd1 end table.insert(o, leadd1 .. "{") for k,v in pairs(t) do local vv if type(v) == "table" then vv = format_table(v, (level or 0) + 1) elseif type(v) == "string" then v = string.gsub(v, "\\", "\\\\") v = string.gsub(v, "\r", "\\r") v = string.gsub(v, "\n", "\\n") vv = "\"" .. v .."\"" else vv = tostring(v) end if type(k) == "string" then k = string.gsub(k, "\\", "\\\\") k = string.gsub(k, "\r", "\\r") k = string.gsub(k, "\n", "\\n") k = "[\"" .. k .."\"]" table.insert(o, string.format("%s = %s,", k, vv)) else table.insert(o, string.format("%s,", vv)) end end return "\r\n" .. table.concat(o, "\r\n"..lead) .."\r\n".. leadd1 .. "}" end function core.save_settings() print("SAVING SETTINGS") return core.WriteConfigFile("tmpsetting = " .. format_table(setting) .. "\r\nmerge_table(setting, tmpsetting)\r\n") end function core.load_settings() print("LOADING SETTINGS") return core.execute_luafile(core.GetConfigFile()) end function core.set_setting(key, value) setting[key] = value core.ApplySetting(key) end function core.get_setting(key) return setting[key] end -- load base_frame if core and core.execute_luafile then print(core.execute_luafile(lua_path .. "base_frame.lua")) print(core.execute_luafile(lua_path .. "3dvplayer.lua")) print(core.execute_luafile(lua_path .. "Container.lua")) print(core.execute_luafile(lua_path .. "playlist.lua")) print(core.execute_luafile(lua_path .. "menu.lua")) print(core.execute_luafile(lua_path .. "default_setting.lua")) core.load_settings(); print(core.execute_luafile(lua_path .. "language.lua")) end
gpl-3.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/blocks/BlockVine.lua
1
2710
--[[ Title: Vine and half vine Author(s): LiXizhi Date: 2015/7/18 Desc: use the lib: ------------------------------------------------------------ NPL.load("(gl)script/apps/Aries/Creator/Game/blocks/BlockVine.lua"); local block = commonlib.gettable("MyCompany.Aries.Game.blocks.BlockVine"); ------------------------------------------------------- ]] local ItemClient = commonlib.gettable("MyCompany.Aries.Game.Items.ItemClient"); local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local TaskManager = commonlib.gettable("MyCompany.Aries.Game.TaskManager") local block_types = commonlib.gettable("MyCompany.Aries.Game.block_types") local GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic") local EntityManager = commonlib.gettable("MyCompany.Aries.Game.EntityManager"); local Direction = commonlib.gettable("MyCompany.Aries.Game.Common.Direction"); local block = commonlib.inherit(commonlib.gettable("MyCompany.Aries.Game.block"), commonlib.gettable("MyCompany.Aries.Game.blocks.BlockVine")); -- register block_types.RegisterBlockClass("BlockVine", block); local side_to_data = {[0] = 4, [1] = 3, [2] = 5, [3] = 1, [4] = 0, [5] = 2, } local data_to_side = {[0] = 4, [1] = 3, [2] = 5, [3] = 1, [4] = 0, [5] = 2, } function block:ctor() end function block:GetMetaDataFromEnv(blockX, blockY, blockZ, side, side_region, camx,camy,camz, lookat_x,lookat_y,lookat_z) local data = 0; if(side) then data = side_to_data[side]; if(side == 4) then local block_id = ParaTerrain.GetBlockTemplateByIdx(blockX, blockY+1, blockZ); if(block_id == self.id) then data = ParaTerrain.GetBlockUserDataByIdx(blockX, blockY+1, blockZ); end elseif(side == 5) then local block_id = ParaTerrain.GetBlockTemplateByIdx(blockX, blockY-1, blockZ); if(block_id == self.id) then data = ParaTerrain.GetBlockUserDataByIdx(blockX, blockY-1, blockZ); end end end return data; end -- rotate the block data by the given angle and axis. This is mosted reimplemented in blocks with orientations stored in block data, such as stairs, bones, etc. -- @param blockData: current block data -- @param angle: usually 1.57, -1.57, 3.14, -3.14, 0. if 0 it means mirror along the given axis. -- @param axis: "x|y|z", if nil, it should default to "y" axis -- @return the rotated block data. function block:RotateBlockData(blockData, angle, axis) axis = axis or "y" -- rotation around axis if(axis == "y") then local side = data_to_side[blockData or 0]; if(side < 4) then local facing = Direction.directionTo3DFacing[side]; blockData = side_to_data[Direction.GetDirectionFromFacing(facing + angle)]; end else -- TODO: for other axis; end return blockData; end
gpl-2.0
vince06fr/prosody-modules
mod_adhoc_account_management/mod_adhoc_account_management.lua
32
3961
local dataforms_new = require "util.dataforms".new; local usermanager_set_password = require "core.usermanager".set_password; local usermanager_test_password = require "core.usermanager".test_password; local jid_split = require"util.jid".split; local close_others = module:get_option_boolean("close_sessions_on_password_change", true) local require_confirm = module:get_option_boolean("require_confirm_password", true) local require_current = module:get_option_boolean("require_current_password", true) local change_password_layout = { title = "Changing Your Password"; instructions = "Fill out this form to change a your password."; { -- This is meta name = "FORM_TYPE", type = "hidden", -- Reuses form type from XEP 77 value = "jabber:iq:register:changepassword", }; { name = "password", type = "text-private", required = true, label = "New Password", }; }; if require_confirm then table.insert(change_password_layout, { name = "password-confirm", type = "text-private", required = true, label = "Confirm new password", }); end if require_current then table.insert(change_password_layout, 2, { name = "password-current", type = "text-private", required = true, label = "Current password", }); end change_password_layout = dataforms_new(change_password_layout); function change_password_command_handler(self, data, state) if not state then -- New session, send the form return { status = "executing", actions = { "complete" }, form = change_password_layout }, true; else if data.action == "cancel" then return { status = "canceled" }; end -- Who are we talking to? local username, hostname = jid_split(data.from); if not username or hostname ~= module.host then return { status = "error", error = { type = "cancel", condition = "forbidden", message = "Invalid user or hostname." } }; end -- Extract data from the form local fields = change_password_layout:data(data.form); -- Validate if require_current then if not fields["password-current"] or #fields["password-current"] == 0 then return { status = "error", error = { type = "modify", condition = "bad-request", message = "Please enter your current password" } }; elseif not usermanager_test_password(username, hostname, fields["password-current"]) then return { status = "error", error = { type = "modify", condition = "bad-request", message = "Your current password was incorrect" } }; end end if require_confirm and fields["password-confirm"] ~= fields["password"] then return { status = "error", error = { type = "modify", condition = "bad-request", message = "New password didn't match the confirmation" } }; end if not fields.password or #fields.password == 0 then return { status = "error", error = { type = "modify", condition = "bad-request", message = "Please enter a new password" } }; end -- All is good, so change password. module:log("debug", "About to usermanager.set_password(%q, password, %q)", username, hostname); local ok, err = usermanager_set_password(username, fields.password, hostname); if ok then if close_others then for _, sess in pairs(hosts[hostname].sessions[username].sessions) do if sess.full_jid ~= data.from then sess:close{ condition = "reset", text = "Password changed" } end end end return { status = "completed", info = "Password successfully changed" }; else module:log("warn", "%s@%s could not change password: %s", username, hostname, tostring(err)); return { status = "error", error = { type = "cancel", condition = "internal-server-error", message = "Could not save new password: "..tostring(err) } }; end end end -- Feature requests? What could fit under account management? local adhoc_new = module:require "adhoc".new; local adhoc_passwd = adhoc_new("Change Password", "passwd", change_password_command_handler, "user"); module:add_item ("adhoc", adhoc_passwd);
mit
Lawmuse/apeonsburden
tekKonfig/LibStub.lua
17
1362
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info -- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! local LibStub = _G[LIBSTUB_MAJOR] if not LibStub or LibStub.minor < LIBSTUB_MINOR then LibStub = LibStub or {libs = {}, minors = {} } _G[LIBSTUB_MAJOR] = LibStub LibStub.minor = LIBSTUB_MINOR function LibStub:NewLibrary(major, minor) assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") local oldminor = self.minors[major] if oldminor and oldminor >= minor then return nil end self.minors[major], self.libs[major] = minor, self.libs[major] or {} return self.libs[major], oldminor end function LibStub:GetLibrary(major, silent) if not self.libs[major] and not silent then error(("Cannot find a library instance of %q."):format(tostring(major)), 2) end return self.libs[major], self.minors[major] end function LibStub:IterateLibraries() return pairs(self.libs) end setmetatable(LibStub, { __call = LibStub.GetLibrary }) end
mit
RyMarq/Zero-K
units/turretaafar.lua
1
4406
return { turretaafar = { unitname = [[turretaafar]], name = [[Chainsaw]], description = [[Long-Range Anti-Air Missile Battery]], acceleration = 0, brakeRate = 0, buildCostMetal = 900, builder = false, buildingGroundDecalDecaySpeed = 30, buildingGroundDecalSizeX = 3.6, buildingGroundDecalSizeY = 3.6, buildingGroundDecalType = [[turretaafar_aoplane.dds]], buildPic = [[turretaafar.png]], category = [[FLOAT]], collisionVolumeOffsets = [[0 12 0]], collisionVolumeScales = [[58 76 58]], collisionVolumeType = [[CylY]], corpse = [[DEAD]], customParams = { aimposoffset = [[0 10 0]], modelradius = [[19]], }, explodeAs = [[LARGE_BUILDINGEX]], floater = true, footprintX = 4, footprintZ = 4, iconType = [[staticskirmaa]], idleAutoHeal = 5, idleTime = 1800, losEmitHeight = 40, maxDamage = 2500, maxSlope = 18, maxVelocity = 0, maxWaterDepth = 5000, minCloakDistance = 150, noAutoFire = false, noChaseCategory = [[FIXEDWING LAND SINK TURRET SHIP SATELLITE SWIM GUNSHIP FLOAT SUB HOVER]], objectName = [[armcir.s3o]], script = [[turretaafar.lua]], selfDestructAs = [[LARGE_BUILDINGEX]], sightDistance = 702, turnRate = 0, useBuildingGroundDecal = true, workerTime = 0, yardMap = [[oooooooooooooooo]], sfxtypes = { explosiongenerators = { [[custom:light_red_short]], [[custom:light_green_short]], [[custom:light_blue_short]], }, }, weapons = { { def = [[MISSILE]], --badTargetCategory = [[GUNSHIP]], onlyTargetCategory = [[FIXEDWING GUNSHIP]], }, }, weaponDefs = { MISSILE = { name = [[Long-Range SAM]], areaOfEffect = 24, canattackground = false, cegTag = [[chainsawtrail]], craterBoost = 0, craterMult = 0, cylinderTargeting = 1, customParams = { isaa = [[1]], light_color = [[0.6 0.7 0.7]], light_radius = 420, }, damage = { default = 22.51, planes = 225.1, subs = 12.5, }, explosionGenerator = [[custom:MISSILE_HIT_PIKES_160]], fireStarter = 20, flightTime = 4, impactOnly = true, impulseBoost = 0.123, impulseFactor = 0.0492, interceptedByShieldType = 2, model = [[wep_m_phoenix.s3o]], noSelfDamage = true, range = 1800, reloadtime = 1, smokeTrail = true, soundHit = [[weapon/missile/med_aa_hit]], soundStart = [[weapon/missile/med_aa_fire]], soundTrigger = true, startVelocity = 550, texture2 = [[AAsmoketrail]], tolerance = 16000, tracks = true, turnRate = 55000, turret = true, waterweapon = true, weaponAcceleration = 550, weaponType = [[MissileLauncher]], weaponVelocity = 800, }, }, featureDefs = { DEAD = { blocking = true, featureDead = [[HEAP]], footprintX = 4, footprintZ = 4, object = [[chainsaw_d.dae]], }, HEAP = { blocking = false, footprintX = 3, footprintZ = 3, object = [[debris3x3a.s3o]], }, }, } }
gpl-2.0
TerminalShell/zombiesurvival
entities/entities/status_human_holding/init.lua
1
5941
AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") local oldRenderMode = nil local oldColor = nil function ENT:Initialize() self:DrawShadow(false) self:SetModel("models/weapons/v_hands.mdl") local owner = self:GetOwner() if owner:IsValid() then owner.status_human_holding = self owner:DrawWorldModel(false) owner:DrawViewModel(false) local wep = owner:GetActiveWeapon() if wep:IsValid() then wep:SendWeaponAnim(ACT_VM_HOLSTER) if wep.SetIronsights then wep:SetIronsights(false) end end end local object = self:GetObject() if object:IsValid() then for _, ent in pairs(ents.FindByClass("logic_pickupdrop")) do if ent.EntityToWatch == object:GetName() and ent:IsValid() then ent:Input("onpickedup", owner, object, "") end end oldRenderMode = RENDERMODE_NORMAL oldColor = Color(255,255,255,255) oldRenderMode = object:GetRenderMode() object:SetRenderMode(RENDERMODE_TRANSALPHA) oldColor = object:GetColor() object:SetColor(Color(oldColor.r, oldColor.g, oldColor.b, 160)) local objectphys = object:GetPhysicsObject() if objectphys:IsValid() then objectphys:AddGameFlag(FVPHYSICS_NO_IMPACT_DMG) objectphys:AddGameFlag(FVPHYSICS_NO_NPC_IMPACT_DMG) if objectphys:GetMass() < CARRY_DRAG_MASS and (object:OBBMins():Length() + object:OBBMaxs():Length() < CARRY_DRAG_VOLUME or object.NoVolumeCarryCheck) then objectphys:AddGameFlag(FVPHYSICS_PLAYER_HELD) object._OriginalMass = objectphys:GetMass() objectphys:EnableGravity(false) objectphys:SetMass(2) else self:SetIsHeavy(true) self:SetHingePos(object:NearestPoint(self:GetPullPos())) end object:CollisionRulesChanged() if owner:IsValid() then owner:SetSpeed(math.max(CARRY_SPEEDLOSS_MINSPEED, 190 - objectphys:GetMass() * CARRY_SPEEDLOSS_PERKG)) end end end end function ENT:OnRemove() local owner = self:GetOwner() if owner:IsValid() then owner.status_human_holding = nil owner:DrawWorldModel(true) owner:DrawViewModel(true) if owner:Alive() and owner:Team() ~= TEAM_UNDEAD then owner:ResetSpeed() local wep = owner:GetActiveWeapon() if wep:IsValid() then wep:SendWeaponAnim(ACT_VM_DRAW) end end end local object = self:GetObject() if object:IsValid() then object:SetRenderMode(oldRenderMode) object:SetColor(oldColor) local objectphys = object:GetPhysicsObject() if objectphys:IsValid() then objectphys:ClearGameFlag(FVPHYSICS_PLAYER_HELD) objectphys:ClearGameFlag(FVPHYSICS_NO_IMPACT_DMG) objectphys:ClearGameFlag(FVPHYSICS_NO_NPC_IMPACT_DMG) objectphys:EnableGravity(true) if object._OriginalMass then objectphys:SetMass(object._OriginalMass) object._OriginalMass = nil end object:CollisionRulesChanged() if not self:GetIsHeavy() then object:GhostAllPlayersInMe(2.5, true) end end for _, ent in pairs(ents.FindByClass("logic_pickupdrop")) do if ent.EntityToWatch == object:GetName() and ent:IsValid() then ent:Input("ondropped", owner, object, "") end end end end concommand.Add("_zs_rotateang", function(sender, command, arguments) local x = tonumber(arguments[1]) local y = tonumber(arguments[2]) if x and y then sender.InputMouseX = math.Clamp(x * 0.2, -180, 180) sender.InputMouseY = math.Clamp(y * 0.2, -180, 180) end end) local ShadowParams = {secondstoarrive = 0.01, maxangular = 1000, maxangulardamp = 10000, maxspeed = 500, maxspeeddamp = 1000, dampfactor = 0.65, teleportdistance = 0} function ENT:Think() local ct = CurTime() local frametime = ct - (self.LastThink or ct) self.LastThink = ct local object = self:GetObject() local owner = self:GetOwner() if not object:IsValid() or object:IsNailed() or not owner:IsValid() or not owner:Alive() then self:Remove() return end local shootpos = owner:GetShootPos() local nearestpoint = object:NearestPoint(shootpos) local objectphys = object:GetPhysicsObject() if object:GetMoveType() ~= MOVETYPE_VPHYSICS or not objectphys:IsValid() or owner:GetGroundEntity() == object then self:Remove() return end if self:GetIsHeavy() then if 64 < self:GetHingePos():Distance(self:GetPullPos()) then self:Remove() return end elseif 64 < nearestpoint:Distance(shootpos) then self:Remove() return end objectphys:Wake() if owner:KeyPressed(IN_ATTACK) then object:SetPhysicsAttacker(owner) self:Remove() return elseif self:GetIsHeavy() then local pullpos = self:GetPullPos() local hingepos = self:GetHingePos() objectphys:ApplyForceOffset(objectphys:GetMass() * frametime * 450 * (pullpos - hingepos):GetNormalized(), hingepos) elseif owner:KeyDown(IN_ATTACK2) and not owner:GetActiveWeapon().NoPropThrowing then owner:ConCommand("-attack2") objectphys:ApplyForceCenter(objectphys:GetMass() * math.Clamp(1.25 - math.min(1, (object:OBBMins():Length() + object:OBBMaxs():Length()) / CARRY_DRAG_VOLUME), 0.25, 1) * 500 * owner:GetAimVector()) object:SetPhysicsAttacker(owner) self:Remove() return else if not self.ObjectPosition or not owner:KeyDown(IN_SPEED) then local obbcenter = object:OBBCenter() local objectpos = shootpos + owner:GetAimVector() * 48 objectpos = objectpos - obbcenter.z * object:GetUp() objectpos = objectpos - obbcenter.y * object:GetRight() objectpos = objectpos - obbcenter.x * object:GetForward() self.ObjectPosition = objectpos self.ObjectAngles = object:GetAngles() end if owner:KeyDown(IN_WALK) and not owner:KeyDown(IN_SPEED) then self.ObjectAngles:RotateAroundAxis(owner:EyeAngles():Up(), owner.InputMouseX or 0) self.ObjectAngles:RotateAroundAxis(owner:EyeAngles():Right(), owner.InputMouseY or 0) end ShadowParams.pos = self.ObjectPosition ShadowParams.angle = self.ObjectAngles ShadowParams.deltatime = frametime objectphys:ComputeShadowControl(ShadowParams) end object:SetPhysicsAttacker(owner) self:NextThink(ct) return true end
gpl-3.0
pixeljetstream/luajit_gfx_sandbox
runtime/lua/devil.lua
2
17979
-- Original Author: Dimiter "malkia" Stanev -- https://github.com/malkia/luajit-opencl local ffi = require( "ffi" ) ffi.cdef[[ // devil il | DevIL Image Library enum { IL_FALSE = 0 , IL_TRUE = 1 // Matches OpenGL's right now. //! Data formats \link Formats Formats\endlink , IL_COLOUR_INDEX = 0x1900 , IL_COLOR_INDEX = 0x1900 , IL_ALPHA = 0x1906 , IL_RGB = 0x1907 , IL_RGBA = 0x1908 , IL_BGR = 0x80E0 , IL_BGRA = 0x80E1 , IL_LUMINANCE = 0x1909 , IL_LUMINANCE_ALPHA = 0x190A //! Data types \link Types Types\endlink , IL_BYTE = 0x1400 , IL_UNSIGNED_BYTE = 0x1401 , IL_SHORT = 0x1402 , IL_UNSIGNED_SHORT = 0x1403 , IL_INT = 0x1404 , IL_UNSIGNED_INT = 0x1405 , IL_FLOAT = 0x1406 , IL_DOUBLE = 0x140A , IL_HALF = 0x140B , IL_VENDOR = 0x1F00 , IL_LOAD_EXT = 0x1F01 , IL_SAVE_EXT = 0x1F02 // // IL-specific ,'s // , IL_VERSION_1_7_8 = 1 , IL_VERSION = 178 // Attribute Bits , IL_ORIGIN_BIT = 0x00000001 , IL_FILE_BIT = 0x00000002 , IL_PAL_BIT = 0x00000004 , IL_FORMAT_BIT = 0x00000008 , IL_TYPE_BIT = 0x00000010 , IL_COMPRESS_BIT = 0x00000020 , IL_LOADFAIL_BIT = 0x00000040 , IL_FORMAT_SPECIFIC_BIT = 0x00000080 , IL_ALL_ATTRIB_BITS = 0x000FFFFF // Palette types , IL_PAL_NONE = 0x0400 , IL_PAL_RGB24 = 0x0401 , IL_PAL_RGB32 = 0x0402 , IL_PAL_RGBA32 = 0x0403 , IL_PAL_BGR24 = 0x0404 , IL_PAL_BGR32 = 0x0405 , IL_PAL_BGRA32 = 0x0406 // Image types , IL_TYPE_UNKNOWN = 0x0000 , IL_BMP = 0x0420 //!< Microsoft Windows Bitmap - .bmp extension , IL_CUT = 0x0421 //!< Dr. Halo - .cut extension , IL_DOOM = 0x0422 //!< DooM walls - no specific extension , IL_DOOM_FLAT = 0x0423 //!< DooM flats - no specific extension , IL_ICO = 0x0424 //!< Microsoft Windows Icons and Cursors - .ico and .cur extensions , IL_JPG = 0x0425 //!< JPEG - .jpg, .jpe and .jpeg extensions , IL_JFIF = 0x0425 //!< , IL_ILBM = 0x0426 //!< Amiga IFF (FORM ILBM) - .iff, .ilbm, .lbm extensions , IL_PCD = 0x0427 //!< Kodak PhotoCD - .pcd extension , IL_PCX = 0x0428 //!< ZSoft PCX - .pcx extension , IL_PIC = 0x0429 //!< PIC - .pic extension , IL_PNG = 0x042A //!< Portable Network Graphics - .png extension , IL_PNM = 0x042B //!< Portable Any Map - .pbm, .pgm, .ppm and .pnm extensions , IL_SGI = 0x042C //!< Silicon Graphics - .sgi, .bw, .rgb and .rgba extensions , IL_TGA = 0x042D //!< TrueVision Targa File - .tga, .vda, .icb and .vst extensions , IL_TIF = 0x042E //!< Tagged Image File Format - .tif and .tiff extensions , IL_CHEAD = 0x042F //!< C-Style Header - .h extension , IL_RAW = 0x0430 //!< Raw Image Data - any extension , IL_MDL = 0x0431 //!< Half-Life Model Texture - .mdl extension , IL_WAL = 0x0432 //!< Quake 2 Texture - .wal extension , IL_LIF = 0x0434 //!< Homeworld Texture - .lif extension , IL_MNG = 0x0435 //!< Multiple-image Network Graphics - .mng extension , IL_JNG = 0x0435 //!< , IL_GIF = 0x0436 //!< Graphics Interchange Format - .gif extension , IL_DDS = 0x0437 //!< DirectDraw Surface - .dds extension , IL_DCX = 0x0438 //!< ZSoft Multi-PCX - .dcx extension , IL_PSD = 0x0439 //!< Adobe PhotoShop - .psd extension , IL_EXIF = 0x043A //!< , IL_PSP = 0x043B //!< PaintShop Pro - .psp extension , IL_PIX = 0x043C //!< PIX - .pix extension , IL_PXR = 0x043D //!< Pixar - .pxr extension , IL_XPM = 0x043E //!< X Pixel Map - .xpm extension , IL_HDR = 0x043F //!< Radiance High Dynamic Range - .hdr extension , IL_ICNS = 0x0440 //!< Macintosh Icon - .icns extension , IL_JP2 = 0x0441 //!< Jpeg 2000 - .jp2 extension , IL_EXR = 0x0442 //!< OpenEXR - .exr extension , IL_WDP = 0x0443 //!< Microsoft HD Photo - .wdp and .hdp extension , IL_VTF = 0x0444 //!< Valve Texture Format - .vtf extension , IL_WBMP = 0x0445 //!< Wireless Bitmap - .wbmp extension , IL_SUN = 0x0446 //!< Sun Raster - .sun, .ras, .rs, .im1, .im8, .im24 and .im32 extensions , IL_IFF = 0x0447 //!< Interchange File Format - .iff extension , IL_TPL = 0x0448 //!< Gamecube Texture - .tpl extension , IL_FITS = 0x0449 //!< Flexible Image Transport System - .fit and .fits extensions , IL_DICOM = 0x044A //!< Digital Imaging and Communications in Medicine (DICOM) - .dcm and .dicom extensions , IL_IWI = 0x044B //!< Call of Duty Infinity Ward Image - .iwi extension , IL_BLP = 0x044C //!< Blizzard Texture Format - .blp extension , IL_FTX = 0x044D //!< Heavy Metal: FAKK2 Texture - .ftx extension , IL_ROT = 0x044E //!< Homeworld 2 - Relic Texture - .rot extension , IL_TEXTURE = 0x044F //!< Medieval II: Total War Texture - .texture extension , IL_DPX = 0x0450 //!< Digital Picture Exchange - .dpx extension , IL_UTX = 0x0451 //!< Unreal (and Unreal Tournament) Texture - .utx extension , IL_MP3 = 0x0452 //!< MPEG-1 Audio Layer 3 - .mp3 extension , IL_JASC_PAL = 0x0475 //!< PaintShop Pro Palette // Error Types , IL_NO_ERROR = 0x0000 , IL_INVALID_ENUM = 0x0501 , IL_OUT_OF_MEMORY = 0x0502 , IL_FORMAT_NOT_SUPPORTED = 0x0503 , IL_INTERNAL_ERROR = 0x0504 , IL_INVALID_VALUE = 0x0505 , IL_ILLEGAL_OPERATION = 0x0506 , IL_ILLEGAL_FILE_VALUE = 0x0507 , IL_INVALID_FILE_HEADER = 0x0508 , IL_INVALID_PARAM = 0x0509 , IL_COULD_NOT_OPEN_FILE = 0x050A , IL_INVALID_EXTENSION = 0x050B , IL_FILE_ALREADY_EXISTS = 0x050C , IL_OUT_FORMAT_SAME = 0x050D , IL_STACK_OVERFLOW = 0x050E , IL_STACK_UNDERFLOW = 0x050F , IL_INVALID_CONVERSION = 0x0510 , IL_BAD_DIMENSIONS = 0x0511 , IL_FILE_READ_ERROR = 0x0512 // 05/12/2002: Addition by Sam. , IL_FILE_WRITE_ERROR = 0x0512 , IL_LIB_GIF_ERROR = 0x05E1 , IL_LIB_JPEG_ERROR = 0x05E2 , IL_LIB_PNG_ERROR = 0x05E3 , IL_LIB_TIFF_ERROR = 0x05E4 , IL_LIB_MNG_ERROR = 0x05E5 , IL_LIB_JP2_ERROR = 0x05E6 , IL_LIB_EXR_ERROR = 0x05E7 , IL_UNKNOWN_ERROR = 0x05FF // Origin Definitions , IL_ORIGIN_SET = 0x0600 , IL_ORIGIN_LOWER_LEFT = 0x0601 , IL_ORIGIN_UPPER_LEFT = 0x0602 , IL_ORIGIN_MODE = 0x0603 // Format and Type Mode Definitions , IL_FORMAT_SET = 0x0610 , IL_FORMAT_MODE = 0x0611 , IL_TYPE_SET = 0x0612 , IL_TYPE_MODE = 0x0613 // File definitions , IL_FILE_OVERWRITE = 0x0620 , IL_FILE_MODE = 0x0621 // Palette definitions , IL_CONV_PAL = 0x0630 // Load fail definitions , IL_DEFAULT_ON_FAIL = 0x0632 // Key colour and alpha definitions , IL_USE_KEY_COLOUR = 0x0635 , IL_USE_KEY_COLOR = 0x0635 , IL_BLIT_BLEND = 0x0636 // Interlace definitions , IL_SAVE_INTERLACED = 0x0639 , IL_INTERLACE_MODE = 0x063A // Quantization definitions , IL_QUANTIZATION_MODE = 0x0640 , IL_WU_QUANT = 0x0641 , IL_NEU_QUANT = 0x0642 , IL_NEU_QUANT_SAMPLE = 0x0643 , IL_MAX_QUANT_INDEXS = 0x0644 //XIX : ILint : Maximum number of colors to reduce to, default of 256. and has a range of 2-256 , IL_MAX_QUANT_INDICES = 0x0644 // Redefined, since the above , is misspelled // Hints , IL_FASTEST = 0x0660 , IL_LESS_MEM = 0x0661 , IL_DONT_CARE = 0x0662 , IL_MEM_SPEED_HINT = 0x0665 , IL_USE_COMPRESSION = 0x0666 , IL_NO_COMPRESSION = 0x0667 , IL_COMPRESSION_HINT = 0x0668 // Compression , IL_NVIDIA_COMPRESS = 0x0670 , IL_SQUISH_COMPRESS = 0x0671 // Subimage types , IL_SUB_NEXT = 0x0680 , IL_SUB_MIPMAP = 0x0681 , IL_SUB_LAYER = 0x0682 // Compression definitions , IL_COMPRESS_MODE = 0x0700 , IL_COMPRESS_NONE = 0x0701 , IL_COMPRESS_RLE = 0x0702 , IL_COMPRESS_LZO = 0x0703 , IL_COMPRESS_ZLIB = 0x0704 // File format-specific values , IL_TGA_CREATE_STAMP = 0x0710 , IL_JPG_QUALITY = 0x0711 , IL_PNG_INTERLACE = 0x0712 , IL_TGA_RLE = 0x0713 , IL_BMP_RLE = 0x0714 , IL_SGI_RLE = 0x0715 , IL_TGA_ID_STRING = 0x0717 , IL_TGA_AUTHNAME_STRING = 0x0718 , IL_TGA_AUTHCOMMENT_STRING = 0x0719 , IL_PNG_AUTHNAME_STRING = 0x071A , IL_PNG_TITLE_STRING = 0x071B , IL_PNG_DESCRIPTION_STRING = 0x071C , IL_TIF_DESCRIPTION_STRING = 0x071D , IL_TIF_HOSTCOMPUTER_STRING = 0x071E , IL_TIF_DOCUMENTNAME_STRING = 0x071F , IL_TIF_AUTHNAME_STRING = 0x0720 , IL_JPG_SAVE_FORMAT = 0x0721 , IL_CHEAD_HEADER_STRING = 0x0722 , IL_PCD_PICNUM = 0x0723 , IL_PNG_ALPHA_INDEX = 0x0724 //XIX : ILint : the color in the palette at this index value (0-255) is considered transparent, -1 for no trasparent color , IL_JPG_PROGRESSIVE = 0x0725 , IL_VTF_COMP = 0x0726 // DXTC definitions , IL_DXTC_FORMAT = 0x0705 , IL_DXT1 = 0x0706 , IL_DXT2 = 0x0707 , IL_DXT3 = 0x0708 , IL_DXT4 = 0x0709 , IL_DXT5 = 0x070A , IL_DXT_NO_COMP = 0x070B , IL_KEEP_DXTC_DATA = 0x070C , IL_DXTC_DATA_FORMAT = 0x070D , IL_3DC = 0x070E , IL_RXGB = 0x070F , IL_ATI1N = 0x0710 , IL_DXT1A = 0x0711 // Normally the same as IL_DXT1, except for nVidia Texture Tools. // Environment map definitions , IL_CUBEMAP_POSITIVEX = 0x00000400 , IL_CUBEMAP_NEGATIVEX = 0x00000800 , IL_CUBEMAP_POSITIVEY = 0x00001000 , IL_CUBEMAP_NEGATIVEY = 0x00002000 , IL_CUBEMAP_POSITIVEZ = 0x00004000 , IL_CUBEMAP_NEGATIVEZ = 0x00008000 , IL_SPHEREMAP = 0x00010000 // Values , IL_VERSION_NUM = 0x0DE2 , IL_IMAGE_WIDTH = 0x0DE4 , IL_IMAGE_HEIGHT = 0x0DE5 , IL_IMAGE_DEPTH = 0x0DE6 , IL_IMAGE_SIZE_OF_DATA = 0x0DE7 , IL_IMAGE_BPP = 0x0DE8 , IL_IMAGE_BYTES_PER_PIXEL = 0x0DE8 , IL_IMAGE_BITS_PER_PIXEL = 0x0DE9 , IL_IMAGE_FORMAT = 0x0DEA , IL_IMAGE_TYPE = 0x0DEB , IL_PALETTE_TYPE = 0x0DEC , IL_PALETTE_SIZE = 0x0DED , IL_PALETTE_BPP = 0x0DEE , IL_PALETTE_NUM_COLS = 0x0DEF , IL_PALETTE_BASE_TYPE = 0x0DF0 , IL_NUM_FACES = 0x0DE1 , IL_NUM_IMAGES = 0x0DF1 , IL_NUM_MIPMAPS = 0x0DF2 , IL_NUM_LAYERS = 0x0DF3 , IL_ACTIVE_IMAGE = 0x0DF4 , IL_ACTIVE_MIPMAP = 0x0DF5 , IL_ACTIVE_LAYER = 0x0DF6 , IL_ACTIVE_FACE = 0x0E00 , IL_CUR_IMAGE = 0x0DF7 , IL_IMAGE_DURATION = 0x0DF8 , IL_IMAGE_PLANESIZE = 0x0DF9 , IL_IMAGE_BPC = 0x0DFA , IL_IMAGE_OFFX = 0x0DFB , IL_IMAGE_OFFY = 0x0DFC , IL_IMAGE_CUBEFLAGS = 0x0DFD , IL_IMAGE_ORIGIN = 0x0DFE , IL_IMAGE_CHANNELS = 0x0DFF }; typedef unsigned int ILenum; typedef unsigned char ILboolean; typedef unsigned int ILbitfield; typedef signed char ILbyte; typedef signed short ILshort; typedef int ILint; typedef size_t ILsizei; typedef unsigned char ILubyte; typedef unsigned short ILushort; typedef unsigned int ILuint; typedef float ILfloat; typedef float ILclampf; typedef double ILdouble; typedef double ILclampd; typedef __int64 ILint64; typedef unsigned __int64 ILuint64; typedef char ILchar; typedef char* ILstring; typedef char const * ILconst_string; typedef void* ILHANDLE; typedef void ( *fCloseRProc)(ILHANDLE); typedef ILboolean ( *fEofProc) (ILHANDLE); typedef ILint ( *fGetcProc) (ILHANDLE); typedef ILHANDLE ( *fOpenRProc) (ILconst_string); typedef ILint ( *fReadProc) (void*, ILuint, ILuint, ILHANDLE); typedef ILint ( *fSeekRProc) (ILHANDLE, ILint, ILint); typedef ILint ( *fTellRProc) (ILHANDLE); // Callback functions for file writing typedef void ( *fCloseWProc)(ILHANDLE); typedef ILHANDLE ( *fOpenWProc) (ILconst_string); typedef ILint ( *fPutcProc) (ILubyte, ILHANDLE); typedef ILint ( *fSeekWProc) (ILHANDLE, ILint, ILint); typedef ILint ( *fTellWProc) (ILHANDLE); typedef ILint ( *fWriteProc) (const void*, ILuint, ILuint, ILHANDLE); // Callback functions for allocation and deallocation typedef void* ( *mAlloc)(const ILsizei); typedef void ( *mFree) (const void* CONST_RESTRICT); // Registered format procedures typedef ILenum ( *IL_LOADPROC)(ILconst_string); typedef ILenum ( *IL_SAVEPROC)(ILconst_string); // ImageLib Functions ILboolean ilActiveFace(ILuint Number); ILboolean ilActiveImage(ILuint Number); ILboolean ilActiveLayer(ILuint Number); ILboolean ilActiveMipmap(ILuint Number); ILboolean ilApplyPal(ILconst_string FileName); ILboolean ilApplyProfile(ILstring InProfile, ILstring OutProfile); void ilBindImage(ILuint Image); ILboolean ilBlit(ILuint Source, ILint DestX, ILint DestY, ILint DestZ, ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width, ILuint Height, ILuint Depth); ILboolean ilClampNTSC(); void ilClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha); ILboolean ilClearImage(); ILuint ilCloneCurImage(); ILubyte* ilCompressDXT(ILubyte *Data, ILuint Width, ILuint Height, ILuint Depth, ILenum DXTCFormat, ILuint *DXTCSize); ILboolean ilCompressFunc(ILenum Mode); ILboolean ilConvertImage(ILenum DestFormat, ILenum DestType); ILboolean ilConvertPal(ILenum DestFormat); ILboolean ilCopyImage(ILuint Src); ILuint ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data); ILuint ilCreateSubImage(ILenum Type, ILuint Num); ILboolean ilDefaultImage(); void ilDeleteImage(const ILuint Num); void ilDeleteImages(ILsizei Num, const ILuint *Images); ILenum ilDetermineType(ILconst_string FileName); ILenum ilDetermineTypeF(ILHANDLE File); ILenum ilDetermineTypeL(const void *Lump, ILuint Size); ILboolean ilDisable(ILenum Mode); ILboolean ilDxtcDataToImage(); ILboolean ilDxtcDataToSurface(); ILboolean ilEnable(ILenum Mode); void ilFlipSurfaceDxtcData(); ILboolean ilFormatFunc(ILenum Mode); void ilGenImages(ILsizei Num, ILuint *Images); ILuint ilGenImage(); ILubyte* ilGetAlpha(ILenum Type); ILboolean ilGetBoolean(ILenum Mode); void ilGetBooleanv(ILenum Mode, ILboolean *Param); ILubyte* ilGetData(); ILuint ilGetDXTCData(void *Buffer, ILuint BufferSize, ILenum DXTCFormat); ILenum ilGetError(); ILint ilGetInteger(ILenum Mode); void ilGetIntegerv(ILenum Mode, ILint *Param); ILuint ilGetLumpPos(); ILubyte* ilGetPalette(); ILconst_string ilGetString(ILenum StringName); void ilHint(ILenum Target, ILenum Mode); ILboolean ilInvertSurfaceDxtcDataAlpha(); void ilInit(); ILboolean ilImageToDxtcData(ILenum Format); ILboolean ilIsDisabled(ILenum Mode); ILboolean ilIsEnabled(ILenum Mode); ILboolean ilIsImage(ILuint Image); ILboolean ilIsValid(ILenum Type, ILconst_string FileName); ILboolean ilIsValidF(ILenum Type, ILHANDLE File); ILboolean ilIsValidL(ILenum Type, void *Lump, ILuint Size); void ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha); ILboolean ilLoad(ILenum Type, ILconst_string FileName); ILboolean ilLoadF(ILenum Type, ILHANDLE File); ILboolean ilLoadImage(ILconst_string FileName); ILboolean ilLoadL(ILenum Type, const void *Lump, ILuint Size); ILboolean ilLoadPal(ILconst_string FileName); void ilModAlpha(ILdouble AlphaValue); ILboolean ilOriginFunc(ILenum Mode); ILboolean ilOverlayImage(ILuint Source, ILint XCoord, ILint YCoord, ILint ZCoord); void ilPopAttrib(); void ilPushAttrib(ILuint Bits); void ilRegisterFormat(ILenum Format); ILboolean ilRegisterLoad(ILconst_string Ext, IL_LOADPROC Load); ILboolean ilRegisterMipNum(ILuint Num); ILboolean ilRegisterNumFaces(ILuint Num); ILboolean ilRegisterNumImages(ILuint Num); void ilRegisterOrigin(ILenum Origin); void ilRegisterPal(void *Pal, ILuint Size, ILenum Type); ILboolean ilRegisterSave(ILconst_string Ext, IL_SAVEPROC Save); void ilRegisterType(ILenum Type); ILboolean ilRemoveLoad(ILconst_string Ext); ILboolean ilRemoveSave(ILconst_string Ext); void ilResetMemory(); // Deprecated void ilResetRead(); void ilResetWrite(); ILboolean ilSave(ILenum Type, ILconst_string FileName); ILuint ilSaveF(ILenum Type, ILHANDLE File); ILboolean ilSaveImage(ILconst_string FileName); ILuint ilSaveL(ILenum Type, void *Lump, ILuint Size); ILboolean ilSavePal(ILconst_string FileName); ILboolean ilSetAlpha(ILdouble AlphaValue); ILboolean ilSetData(void *Data); ILboolean ilSetDuration(ILuint Duration); void ilSetInteger(ILenum Mode, ILint Param); void ilSetMemory(mAlloc, mFree); void ilSetPixels(ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data); void ilSetRead(fOpenRProc, fCloseRProc, fEofProc, fGetcProc, fReadProc, fSeekRProc, fTellRProc); void ilSetString(ILenum Mode, const char *String); void ilSetWrite(fOpenWProc, fCloseWProc, fPutcProc, fSeekWProc, fTellWProc, fWriteProc); void ilShutDown(); ILboolean ilSurfaceToDxtcData(ILenum Format); ILboolean ilTexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte NumChannels, ILenum Format, ILenum Type, void *Data); ILboolean ilTexImageDxtc(ILint w, ILint h, ILint d, ILenum DxtFormat, const ILubyte* data); ILenum ilTypeFromExt(ILconst_string FileName); ILboolean ilTypeFunc(ILenum Mode); ILboolean ilLoadData(ILconst_string FileName, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); ILboolean ilLoadDataF(ILHANDLE File, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); ILboolean ilLoadDataL(void *Lump, ILuint Size, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); ILboolean ilSaveData(ILconst_string FileName); ]] return ffi.load( "DevIL" )
mit
lgeek/koreader
frontend/ui/widget/container/underlinecontainer.lua
2
1386
--[[-- An UnderlineContainer is a WidgetContainer that is able to paint a line under its child node. --]] local Blitbuffer = require("ffi/blitbuffer") local Geom = require("ui/geometry") local Size = require("ui/size") local WidgetContainer = require("ui/widget/container/widgetcontainer") local UnderlineContainer = WidgetContainer:new{ linesize = Size.line.thick, padding = Size.padding.tiny, -- TODO: shouldn't this default to black instead? color = Blitbuffer.COLOR_WHITE, vertical_align = "top", } function UnderlineContainer:getSize() local contentSize = self[1]:getSize() return Geom:new{ w = contentSize.w, h = contentSize.h + self.linesize + 2*self.padding } end function UnderlineContainer:paintTo(bb, x, y) local container_size = self:getSize() self.dimen = Geom:new{ x = x, y = y, w = container_size.w, h = container_size.h } local content_size = self[1]:getSize() local p_y = y if self.vertical_align == "center" then p_y = math.floor((container_size.h - content_size.h) / 2) + y elseif self.vertical_align == "bottom" then p_y = (container_size.h - content_size.h) + y end self[1]:paintTo(bb, x, p_y) bb:paintRect(x, y + container_size.h - self.linesize, container_size.w, self.linesize, self.color) end return UnderlineContainer
agpl-3.0
nyczducky/darkstar
scripts/zones/Abyssea-La_Theine/mobs/Lusion.lua
17
1817
----------------------------------- -- Area: Abyssea - La Theine -- MOB: Luison ----------------------------------- ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) setLocalVar("transformTime", os.time()) end; ----------------------------------- -- onMobRoam Action ----------------------------------- function onMobRoam(mob) local spawnTime = mob:getLocalVar("transformTime"); local roamChance = math.random(1,100); local roamMoonPhase = VanadielMoonPhase(); if (roamChance > 100-roamMoonPhase) then if (mob:AnimationSub() == 0 and os.time() - transformTime > 300) then mob:AnimationSub(1); mob:setLocalVar("transformTime", os.time()); elseif (mob:AnimationSub() == 1 and os.time() - transformTime > 300) then mob:AnimationSub(0); mob:setLocalVar("transformTime", os.time()); end end end; ----------------------------------- -- onMobEngaged -- Change forms every 60 seconds ----------------------------------- function onMobEngaged(mob,target) local changeTime = mob:getLocalVar("changeTime"); local chance = math.random(1,100); local moonPhase = VanadielMoonPhase(); if (chance > 100-moonPhase) then if (mob:AnimationSub() == 0 and mob:getBattleTime() - changeTime > 45) then mob:AnimationSub(1); mob:setLocalVar("changeTime", mob:getBattleTime()); elseif (mob:AnimationSub() == 1 and mob:getBattleTime() - changeTime > 45) then mob:AnimationSub(0); mob:setLocalVar("changeTime", mob:getBattleTime()); end end end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,player,isKiller) end;
gpl-3.0
Tanmoytkd/vlc
share/lua/playlist/mpora.lua
97
2565
--[[ $Id$ Copyright © 2009 the VideoLAN team Authors: Konstantin Pavlov (thresh@videolan.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. --]] -- Probe function. function probe() return vlc.access == "http" and string.match( vlc.path, "video%.mpora%.com/watch/" ) end -- Parse function. function parse() p = {} while true do -- Try to find the video's title line = vlc.readline() if not line then break end if string.match( line, "meta name=\"title\"" ) then _,_,name = string.find( line, "content=\"(.*)\" />" ) end if string.match( line, "image_src" ) then _,_,arturl = string.find( line, "image_src\" href=\"(.*)\" />" ) end if string.match( line, "video_src" ) then _,_,video = string.find( line, 'href="http://video%.mpora%.com/ep/(.*)%.swf" />' ) end end if not name or not arturl or not video then return nil end -- Try and get URL for SD video. sd = vlc.stream("http://api.mpora.com/tv/player/playlist/vid/"..video.."/") if not sd then return nil end page = sd:read( 65653 ) sdurl = string.match( page, "url=\"(.*)\" />") page = nil table.insert( p, { path = sdurl; name = name; arturl = arturl; } ) -- Try and check if HD video is available. checkhd = vlc.stream("http://api.mpora.com/tv/player/load/vid/"..video.."/platform/video/domain/video.mpora.com/" ) if not checkhd then return nil end page = checkhd:read( 65653 ) hashd = tonumber( string.match( page, "<has_hd>(%d)</has_hd>" ) ) page = nil if hashd then hd = vlc.stream("http://api.mpora.com/tv/player/playlist/vid/"..video.."/hd/true/") page = hd:read( 65653 ) hdurl = string.match( page, "url=\"(.*)\" />") table.insert( p, { path = hdurl; name = name.." (HD)"; arturl = arturl; } ) end return p end
gpl-2.0
nyczducky/darkstar
scripts/zones/GM_Home/npcs/Trader.lua
32
1090
----------------------------------- -- Area: GM Home -- NPC: Trader -- Type: Debug NPC for testing trades. ----------------------------------- package.loaded["scripts/zones/GM_Home/TextIDs"] = nil; ----------------------------------- require("scripts/zones/GM_Home/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:hasItemQty(4096,1) and trade:getItemCount() == 1) then player:startEvent(126); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(127); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
cornernote/minetest-skyblock
skyblock_levels/skyblock.craft_guide.lua
1
5685
--[[ Skyblock for Minetest Copyright (c) 2015 cornernote, Brett O'Donnell <cornernote@gmail.com> Source Code: https://github.com/cornernote/minetest-skyblock License: GPLv3 ]]-- skyblock.craft_guide = {} -- some common groups local group_placeholder = {} group_placeholder['group:wood'] = 'default:wood' group_placeholder['group:tree'] = 'default:tree' group_placeholder['group:flora'] = 'flowers:tulip' group_placeholder['group:stick'] = 'default:stick' group_placeholder['group:stone'] = 'default:cobble' -- 'default:stone' point people to the cheaper cobble group_placeholder['group:sand'] = 'default:sand' group_placeholder['group:leaves'] = 'default:leaves' group_placeholder['group:wood_slab'] = 'stairs:slab_wood' group_placeholder['group:wool'] = 'wool:white' -- handle the standard dye color groups minetest.after(0.5, function() for index, entry in pairs(minetest.registered_items) do if index:find("dye:") then for k,v in pairs(entry.groups) do if( k ~= 'dye' ) then group_placeholder['group:dye,'..k ] = index end end end end end) -- render an image button for a formspec skyblock.craft_guide.image_button_link = function(stack_string) local group = '' if group_placeholder[stack_string] then stack_string = group_placeholder[stack_string] group = 'G' end local stack = ItemStack(stack_string) local new_node_name = stack_string if( stack and stack:get_name()) then new_node_name = stack:get_name() end return tostring(stack_string)..';skyblock_craft_guide_'..tostring(new_node_name)..';'..group end -- get_formspec skyblock.craft_guide.get_formspec = function(node_name, fields) node_name = node_name:gsub('skyblock_craft_guide_', '') local receipe_nr = 1 if fields.node_name then node_name = fields.node_name receipe_nr = tonumber(fields.receipe_nr) end -- the player may ask for recipe for ingredients to the current receipe if fields then for k,v in pairs(fields) do k = k:gsub('skyblock_craft_guide_', '') if (v and (minetest.registered_items[k] or minetest.registered_nodes[k] or minetest.registered_craftitems[k] or minetest.registered_tools[k] )) then node_name = k receipe_nr = 1 end end end local res = minetest.get_all_craft_recipes(node_name) or {} -- offer all alternate crafting receipes through prev/next buttons if fields and fields.skyblock_craft_guide_prev_receipe and receipe_nr > 1 then receipe_nr = receipe_nr - 1 elseif fields and fields.skyblock_craft_guide_next_receipe and receipe_nr < #res then receipe_nr = receipe_nr + 1 end local formspec = 'size[5,6]' ..'label[4,2;Output]' ..'background[-0.1,0.9;5.2,3.8;craft.png]' ..'button_exit[3,0;2,0.5;close;Close]' --..'button[0,0;2,0.5;main;Back]' ..'field[20,20;0.1,0.1;node_name;node_name;'..node_name..']' -- invisible field for passing on information ..'field[21,21;0.1,0.1;receipe_nr;receipe_nr;'..tostring(receipe_nr)..']' -- another invisible field ..'item_image_button[4,2.5;1.0,1.0;'..tostring(node_name)..';normal;]' if not res or receipe_nr > #res or receipe_nr < 1 then receipe_nr = 1 end if res and receipe_nr > 1 then formspec = formspec..'button[3.0,5.5;1,0.5;skyblock_craft_guide_prev_receipe;prev]' end if( res and receipe_nr < #res ) then formspec = formspec..'button[4.0,5.5;1,0.5;skyblock_craft_guide_next_receipe;next]' end if( not( res ) or #res<1) then formspec = formspec..'label[3,1.5;No receipes.]' if(minetest.registered_nodes[ node_name ] and minetest.registered_nodes[ node_name ].drop ) then local drop = minetest.registered_nodes[ node_name ].drop if( drop and type( drop )=='string' and drop ~= node_name ) then formspec = formspec ..'label[1,1.6;Drops on dig:]' ..'item_image_button[1,2.5;1.0,1.0;'..skyblock.craft_guide.image_button_link( drop )..']' end end else formspec = formspec..'label[1,5.5;Alternate '..tostring( receipe_nr )..'/'..tostring( #res )..']' -- reverse order; default receipes (and thus the most interesting ones) are usually the oldest local receipe = res[ #res+1-receipe_nr ] if (receipe.type=='normal' and receipe.items) then for i=1,9 do if (receipe.items[i]) then formspec = formspec ..'item_image_button['..((i-1)%receipe.width)..','..(math.floor((i-1)/receipe.width)+1.5)..';1.0,1.0;' ..skyblock.craft_guide.image_button_link( receipe.items[i] )..']' end end elseif (receipe.type=='cooking' and receipe.items and #receipe.items==1) then formspec = formspec ..'item_image_button[1,3;1,1;'..skyblock.craft_guide.image_button_link('default:furnace')..']' --default_furnace_front.png]' ..'item_image_button[1,2;1,1;'..skyblock.craft_guide.image_button_link( receipe.items[1] )..']' else formspec = formspec..'label[0,1.5;Error: Unkown receipe.]' end -- show how many of the items the receipe will yield local outstack = ItemStack(receipe.output) if outstack and outstack:get_count() and outstack:get_count()>1 then formspec = formspec..'label[4.5,3;'..tostring(outstack:get_count())..']' end if receipe.type=='normal' then receipe.type = 'craft' elseif receipe.type=='cooking' then receipe.type = 'furnace' end formspec = formspec..'label[0,1; '..receipe.type..' recipe for '..tostring(node_name)..']' end return formspec end -- register_on_player_receive_fields minetest.register_on_player_receive_fields(function(player, formname, fields) for k,v in pairs(fields) do if string.match(k, 'skyblock_craft_guide_') then minetest.show_formspec(player:get_player_name(),'skyblock_craft_guide',skyblock.craft_guide.get_formspec(k, fields)) return end end end)
gpl-3.0
nyczducky/darkstar
scripts/globals/items/ear_of_grilled_corn.lua
12
1288
----------------------------------------- -- ID: 4334 -- Item: ear_of_grilled_corn -- Food Effect: 60Min, All Races ----------------------------------------- -- Health 10 -- Vitality 4 -- Health Regen While Healing 1 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,3600,4334); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 10); target:addMod(MOD_VIT, 4); target:addMod(MOD_HPHEAL, 1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 10); target:delMod(MOD_VIT, 4); target:delMod(MOD_HPHEAL, 1); end;
gpl-3.0
AquariaOSE/Aquaria
files/scripts/entities/creatorform1.lua
5
14063
-- Copyright (C) 2007, 2010 - Bit-Blot -- -- This file is part of Aquaria. -- -- Aquaria is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- as published by the Free Software Foundation; either version 2 -- of the License, or (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if not v then v = {} end if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end v.n = 0 v.delay = 0 local STATE_ATTACK1 = 1000 local STATE_ATTACK2 = 1003 local STATE_ATTACK2LOOP = 1004 v.bone_head = 0 v.bone_spawn = 0 v.bone_hand = 0 v.bone_mask = 0 v.hits = 64 * 1.5 v.fireDelay = 0 v.takeDamage = true v.suck = false v.pat = 0 v.node_creatorcutscene = 0 function init(me) setupEntity(me) entity_setEntityType(me, ET_ENEMY) entity_initSkeletal(me, "CreatorForm1") --entity_setAllDamageTargets(me, false) entity_generateCollisionMask(me) entity_setState(me, STATE_WAITFORCUTSCENE) v.bone_head = entity_getBoneByName(me, "Head") v.bone_spawn = entity_getBoneByName(me, "Spawn") v.bone_hand = entity_getBoneByName(me, "Hand") v.bone_mask = entity_getBoneByName(me, "Mask") bone_alpha(v.bone_spawn, 0.01) entity_setCullRadius(me, 600) entity_setDamageTarget(me, DT_AVATAR_PET, false) loadSound("hellbeast-suck") loadSound("mia-appear") --entity_setHealth(me, 60) end function postInit(me) v.n = getNaija() entity_setTarget(me, v.n) v.node_creatorcutscene = getNode("CREATORCUTSCENE") end local function getDelayTime() if v.hits > 48 then return 6 elseif v.hits > 32 then return 3 else return 0 end end function update(me, dt) if not entity_isState(me, STATE_CUTSCENE) and not entity_isState(me, STATE_WAITFORCUTSCENE) then overrideZoom(0.5, 1) end if entity_isState(me, STATE_TRANSITION) and v.suck then local bx, by = bone_getWorldPosition(v.bone_head) entity_pullEntities(me, bx, by, 1000, 1700, dt) entity_clearVel(getLi()) end if entity_isState(me, STATE_WAITFORCUTSCENE) then if node_isEntityIn(v.node_creatorcutscene, v.n) then entity_setState(me, STATE_CUTSCENE) end end if not entity_isState(me, STATE_WAITFORCUTSCENE) then entity_handleShotCollisionsSkeletal(me) local bone = entity_collideSkeletalVsCircle(me, v.n) --[[ if avatar_isBursting() and bone ~= 0 and entity_setBoneLock(v.n, me, bone) then else if bone ~= 0 and entity_getBoneLockEntity(v.n) ~= me then entity_push(v.n, -500, 0, 1) entity_damage(v.n, me, 1) end end ]]-- if bone ~= 0 then entity_push(v.n, -500, 0, 1) entity_damage(v.n, me, 0.5) end end local hx, hy = bone_getWorldPosition(v.bone_head) entity_setLookAtPoint(me, hx, hy) if entity_isState(me, STATE_IDLE) then v.delay = v.delay + dt if v.delay > getDelayTime() then if v.pat < 3 then entity_setState(me, STATE_ATTACK1) else entity_setState(me, STATE_ATTACK2) v.pat = -1 end end end if entity_isState(me, STATE_ATTACK2LOOP) then v.fireDelay = v.fireDelay + dt if v.fireDelay > 0.05 then local bx, by = bone_getWorldPosition(v.bone_spawn) local s = createShot("CreatorForm1", me, v.n, bx, by) local x = -1000 local y = math.random(2000)-1000 if chance(10) then x = entity_x(v.n) - bx y = entity_y(v.n) - by end shot_setAimVector(s, x, y) v.fireDelay = 0 end end entity_clearTargetPoints(me) if not entity_isState(me, STATE_WAITFORCUTSCENE) then entity_addTargetPoint(me, hx, hy) end --entity_addTargetPoint(me, bone_getWorldPosition(bone_hand)) end local function doIntroEnd(me) shakeCamera(2, 1) voiceInterupt("CreatorLast12") --Creator: “Then you must die.” watch(1) fade2(1,0,1,1,1) fade2(0,1,1,1,1) entity_animate(me, "all", 0, 1) watchForVoice() playMusic("Worship1") watch(1) cam_toEntity(v.n) setOverrideVoiceFader(-1) entity_setState(me, STATE_IDLE, -1, 1) entity_setDamageTarget(me, DT_AVATAR_LIZAP, true) setCutscene(0) end local function qws(me, t) local c = 0 if t == -1 then --debugLog("WATCH FOR VOICE!!!") while isStreamingVoice() do watch(FRAME_TIME) -- old skip method --[[ watch(FRAME_TIME, WATCH_QUIT) if isQuitFlag() then doIntroEnd(me) return true end ]]-- end else watch(t) --[[ watch(t, WATCH_QUIT) if isQuitFlag() then doIntroEnd(me) return true end ]]-- end return false end v.intrans2 = false function enterState(me) if entity_isState(me, STATE_IDLE) then v.delay = 0 entity_animate(me, "idle", -1) elseif entity_isState(me, STATE_ATTACK1) then entity_setStateTime(me, entity_animate(me, "spawn")) elseif entity_isState(me, STATE_ATTACK2) then voice("Laugh3") entity_setStateTime(me, entity_animate(me, "attack2")) elseif entity_isState(me, STATE_TRANSITION) then local nd = getNode("fallback") if not entity_isfh(v.n) then entity_fh(v.n) end local li = getLi() entity_setPosition(v.n, node_x(nd), node_y(nd), 1) entity_setPosition(li, node_x(nd), node_y(nd), 1) fadeOutMusic(6) --entity_setStateTime(me, entity_animate(me, "die")) local node = getNode("CREATORFORM1") entity_animate(me, "die") entity_setAllDamageTargets(me, false) if not(getForm() == FORM_NORMAL) then changeForm(FORM_NORMAL) end entity_idle(v.n) disableInput() entity_setInvincible(v.n, true) cam_toEntity(me) entity_setStateTime(me, 5) elseif entity_isState(me, STATE_TRANSITION2) then if not v.intrans2 then v.intrans2 = true v.n = getNaija() local nd = getNode("fallback") if not entity_isfh(v.n) then entity_fh(v.n) end playSfx("naijali1") local li = getLi() entity_setPosition(v.n, node_x(nd), node_y(nd)) entity_setPosition(li, node_x(nd), node_y(nd)) cam_toEntity(li) local bx, by = bone_getWorldPosition(v.bone_head) entity_setState(li, STATE_CLOSE, -1, 1) local ent = getFirstEntity() while ent ~= 0 do if (entity_getEntityType(ent) == ET_ENEMY) and ent ~= me then entity_damage(ent, me, 9999, DT_AVATAR_ENERGYBLAST) end ent = getNextEntity() end entity_setPosition(li, bx, by, 1) entity_scale(li, 0.5, 0.5, 4) entity_rotate(li, -8) entity_rotate(li, 8, 3, 0, 0, 1) watch(1) playSfx("mia-appear") spawnParticleEffect("tinyblueexplode", entity_x(li), entity_y(li)) entity_delete(li) setLi(0) cam_toEntity(0) watch(1) cam_toEntity(getNaija()) watch(1) playSfx("naijalow1") setFlag(FLAG_LI, 200) v.intrans2 = false end elseif entity_isState(me, STATE_ATTACK2LOOP) then entity_animate(me, "attack2loop", -1) entity_setStateTime(me, 8) shakeCamera(4, 8) elseif entity_isState(me, STATE_WAITFORCUTSCENE) then entity_animate(me, "idle", -1) entity_setDamageTarget(me, DT_AVATAR_LIZAP, false) elseif entity_isState(me, STATE_CUTSCENE) then if isNested() then return end setCutscene(1,1) if not (getForm()==FORM_NORMAL) then changeForm(FORM_NORMAL) end entity_swimToNode(v.n, v.node_creatorcutscene) while entity_isFollowingPath(v.n) do watch(FRAME_TIME) end setOverrideVoiceFader(1) fadeOutMusic(2) --overrideZoom(0.5, 0) overrideZoom(0.7, 10) local li = getLi() local lucienVol = 0.7 local jennaVol = 0 entity_flipToEntity(li, me) watch(1) voice("CreatorLast1") --He spoke, and his voice was forever burned into my memory… --…in perfect detail… if qws(me, -1) then return end entity_flipToEntity(li, me) cam_toNode(getNode("CONFRONT")) voice ("CreatorLast2", lucienVol) --Creator: “Your darkness is mine, little one. Your life is mine. I created all that you have witnessed, and though you have struggled and fought, it is all for nothing. --This world is my canvas. I will paint upon it whatever I see fit, until I have completed my masterpiece. --You, little Naija, are flawed. But you come from one who is… perfection. You will be my companion, for the rest of eternity. You will have the honor of witnessing my final masterpiece.” entity_animate(me, "point", 0, 1) if qws(me, 7) then return end entity_animate(me, "all", 0, 1) if qws(me, 5) then return end entity_animate(me, "slam", 0, 1) shakeCamera(2, 2) if qws(me, 5) then return end entity_animate(me, "all", 0, 1) if qws(me, 11) then return end --27 "you little naija are flawed" entity_animate(me, "point", 0, 1) if qws(me, 7) then return end --35 "perfection" entity_animate(me, "all", 0, 1) if qws(me, 3) then return end entity_animate(me, "point", 0, 1) --44 final masterpiece if qws(me, 7) then return end entity_animate(me, "all", 0, 1) if qws(me, -1) then return end voice("CreatorLast3") --Naija: “But I am a conscious being, with my own hopes and desires. I do not belong to you!” if qws(me, -1) then return end voice("CreatorLast4", lucienVol) entity_animate(me, "slam", 0, 1) shakeCamera(2, 2) if qws(me, 3) then return end entity_animate(me, "slam", 0, 1) shakeCamera(2, 2) if qws(me, 4) then return end entity_animate(me, "all", 0, 1) --Creator: “Yet it all sprang from MY mind. MY efforts, ungrateful one! Bow before me and worship your Creator.” if qws(me, -1) then return end voice("CreatorLast5") --Naija: “No! I will not. I have lived free. I have explored beyond–“ if qws(me, -1) then return end voice("CreatorLast6", jennaVol) --Creator: “You have been allowed to play in my world. Now your turn is over. You will love me, and nothing else.” entity_animate(me, "all", 0, 1) if qws(me, -1) then return end voice("CreatorLast7") --Naija: “But have you ever truly loved? Has anyone ever willfully loved you?” if qws(me, -1) then return end voice("CreatorLast8", lucienVol) --Creator: “You love an aberration – a foul symbol of chaos!” entity_animate(me, "slam", 0, 1) shakeCamera(2, 2) watch(2) entity_animate(me, "point", 0, 1) if qws(me, -1) then return end voice("CreatorLast9") --Naija: “Why does such a small creature frighten you so? Perhaps you are not as powerful as you claim… perhaps… you can only control what lies in the waters.” if qws(me, -1) then return end voice("CreatorLast10") --Creator: “Fool! I am a GOD.” entity_animate(me, "anger", -1, 1) shakeCamera(2, 3.5) watch(3.27) fade2(1,0,1,1,1) fade2(0,1,1,1,1) --entity_animate(me, "slam", 0, 1) shakeCamera(10, 2) if qws(me, -1) then return end entity_animate(me, "down", -1, 1) voice("CreatorLast11") --Naija: “Perhaps you dream to be… but I will never worship you.” if qws(me, -1) then return end watch(1) doIntroEnd(me) end end function exitState(me) if entity_isState(me, STATE_ATTACK1) then v.pat = v.pat + 1 entity_setState(me, STATE_IDLE) elseif entity_isState(me, STATE_ATTACK2) then entity_setState(me, STATE_ATTACK2LOOP) elseif entity_isState(me, STATE_ATTACK2LOOP) then v.pat = v.pat + 1 entity_setState(me, STATE_IDLE) elseif entity_isState(me, STATE_TRANSITION) then entity_setState(me, STATE_TRANSITION2, 3) elseif entity_isState(me, STATE_TRANSITION2) then local ent = createEntity("CreatorForm2", "", entity_getPosition(me)) entity_alpha(me, 0, 0.5) entity_alpha(ent, 0) entity_alpha(ent, 1, 0.5) entity_setState(me, STATE_WAIT, 2) elseif entity_isState(me, STATE_WAIT) then enableInput() entity_setInvincible(v.n, false) cam_toEntity(v.n) entity_delete(me) end end function damage(me, attacker, bone, damageType, dmg) if entity_isState(me, STATE_TRANSITION) or v.takeDamage == false or entity_isState(me, STATE_TRANSITION2) or entity_isState(me, STATE_WAIT) then return false end if entity_isState(me, STATE_CUTSCENE) or entity_isState(me, STATE_WAITFORCUTSCENE) then return false end if damageType == DT_AVATAR_DUALFORMNAIJA then v.hits = v.hits - dmg bone_damageFlash(v.bone_head) bone_damageFlash(v.bone_mask) return false end if bone == v.bone_mask or bone == v.bone_head then v.hits = v.hits - dmg bone_damageFlash(bone) --return true if v.hits <= 0 then entity_setState(me, STATE_TRANSITION) end end return false end function animationKey(me, key) if entity_isState(me, STATE_ATTACK1) and key == 3 then local sx, sy = bone_getWorldPosition(v.bone_spawn) --[[ local r = math.random(6) local ent if r == 1 then ent = createEntity("Mutilus", "", sx, sy) elseif r == 2 then for i=1,3,1 do ent = createEntity("EvilJelly", "", sx, sy) end elseif r == 3 then ent = createEntity("AbyssOctopus", "", sx, sy) elseif r == 4 then ent = createEntity("AnglerFish", "", sx, sy) elseif r == 5 then ent = createEntity("SpiderCrab", "", sx, sy) else for i=1,3,1 do ent = createEntity("Moneye", "", sx, sy) end end ]]-- local r = math.random(2) local ent if r == 1 then ent = createEntity("Mutilus", "", sx, sy) elseif r == 2 then for i=1,3,1 do ent = createEntity("EvilJelly", "", sx, sy) end end local sx, sy = entity_getScale(ent) entity_scale(ent, 0, 0) entity_scale(ent, sx, sy, 0.5) elseif entity_isState(me, STATE_TRANSITION) and key == 7 then v.suck = true playSfx("hellbeast-suck") local nd = getNode("fallback") entity_setPosition(v.n, node_x(nd), node_y(nd), 1) end end function hitSurface(me) end function songNote(me, note) end function songNoteDone(me, note) end function song(me, song) end function activate(me) end
gpl-2.0
abcdefg30/OpenRA
mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi-AI.lua
7
3093
--[[ Copyright 2007-2022 The OpenRA Developers (see AUTHORS) This file is part of OpenRA, which is free software. It is made available to you under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. For more information, see COPYING. ]] AlliedInfantryTypes = { "e1", "e3" } if Difficulty == "easy" then AlliedArmorTypes = { "1tnk", "1tnk" } else AlliedArmorTypes = { "1tnk", "2tnk" } end if Difficulty == "hard" then AlliedNavyGuard = { "ca", "ca" } else AlliedNavyGuard = { "ca" } end ArmorAttackNumbers = { easy = 2, normal = 5, hard = 8 } ArmorAttackDelays = { easy = DateTime.Seconds(45), normal = DateTime.Seconds(30), hard = DateTime.Seconds(10) } AlliedWarFactRally = { waypoint2, waypoint9, waypoint10, waypoint11 } InfAttack = { } ArmorAttack = { } SendAttackToBase = function(units) Utils.Do(units, function(unit) if not unit.IsDead and unit.HasProperty("Hunt") then unit.AttackMove(waypoint77.Location, 2) Trigger.OnIdle(unit, unit.Hunt) end end) end UnitsJustHunt = function(units) Utils.Do(units, function(unit) if not unit.IsDead and unit.HasProperty("Hunt") then Trigger.OnIdle(unit, unit.Hunt) end end) end ProduceInfantry = function() if AlliedBarracks01.IsDead then return elseif (OreRefinery01.IsDead and OreRefinery02.IsDead or GreeceHarvestersAreDead) and greece.Resources <= 299 then return end local delay = Utils.RandomInteger(DateTime.Seconds(1), DateTime.Seconds(2)) local toBuild = { Utils.Random(AlliedInfantryTypes) } greece.Build(toBuild, function(unit) InfAttack[#InfAttack + 1] = unit[1] if #InfAttack >= 5 then UnitsJustHunt(InfAttack) InfAttack = { } Trigger.AfterDelay(DateTime.Seconds(1), ProduceInfantry) else Trigger.AfterDelay(delay, ProduceInfantry) end end) end ProduceArmor = function() if AlliedWarFact01.IsDead and AlliedWarFact02.IsDead then return elseif (OreRefinery01.IsDead and OreRefinery02.IsDead or GreeceHarvestersAreDead) and greece.Resources <= 699 then return end local delay = Utils.RandomInteger(DateTime.Seconds(7), DateTime.Seconds(10)) local toBuild = { Utils.Random(AlliedArmorTypes) } local Rally = Utils.Random(AlliedWarFactRally) Utils.Do(AlliedWarFact, function(fact) fact.RallyPoint = Rally.Location end) greece.Build(toBuild, function(unit) ArmorAttack[#ArmorAttack + 1] = unit[1] if #ArmorAttack >= ArmorAttackNumbers[Difficulty] then SendAttackToBase(ArmorAttack) ArmorAttack = { } Trigger.AfterDelay(ArmorAttackDelays[Difficulty], ProduceArmor) else Trigger.AfterDelay(delay, ProduceArmor) end end) end ProduceNavyGuard = function() if NavalYard01.IsDead then return elseif (OreRefinery01.IsDead and OreRefinery02.IsDead or GreeceHarvestersAreDead) and greece.Resources <= 2399 then return end NavalYard01.RallyPoint = waypoint26.Location greece.Build(AlliedNavyGuard, function(nvgrd) Utils.Do(nvgrd, function(unit) Trigger.OnKilled(unit, ProduceNavyGuard) end) end) end
gpl-3.0