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
javierojan/copia
bot/bot.lua
15
6562
package.path = package.path .. ';.luarocks/share/lua/5.2/?.lua' ..';.luarocks/share/lua/5.2/?/init.lua' package.cpath = package.cpath .. ';.luarocks/lib/lua/5.2/?.so' require("./bot/utils") VERSION = '0.13.1' -- This function is called when tg receive a msg function on_msg_receive (msg) if not started then return end local receiver = get_receiver(msg) -- vardump(msg) msg = pre_process_service_msg(msg) if msg_valid(msg) then msg = pre_process_msg(msg) if msg then match_plugins(msg) mark_read(receiver, ok_cb, false) end end end function ok_cb(extra, success, result) end function on_binlog_replay_end() started = true postpone (cron_plugins, false, 60*5.0) -- See plugins/isup.lua as an example for cron _config = load_config() -- load plugins plugins = {} load_plugins() end function msg_valid(msg) -- Don't process outgoing messages if msg.out then print('\27[36mNot valid: msg from us\27[39m') return false end -- Before bot was started if msg.date < now then print('\27[36mNot valid: old msg\27[39m') return false end if msg.unread == 0 then print('\27[36mNot valid: readed\27[39m') return false end if not msg.to.id then print('\27[36mNot valid: To id not provided\27[39m') return false end if not msg.from.id then print('\27[36mNot valid: From id not provided\27[39m') return false end if msg.from.id == our_id then print('\27[36mNot valid: Msg from our id\27[39m') return false end if msg.to.type == 'encr_chat' then print('\27[36mNot valid: Encrypted chat\27[39m') return false end if msg.from.id == 777000 then print('\27[36mNot valid: Telegram message\27[39m') return false end return true end -- function pre_process_service_msg(msg) if msg.service then local action = msg.action or {type=""} -- Double ! to discriminate of normal actions msg.text = "!!tgservice " .. action.type -- wipe the data to allow the bot to read service messages if msg.out then msg.out = false end if msg.from.id == our_id then msg.from.id = 0 end end return msg end -- Apply plugin.pre_process function function pre_process_msg(msg) for name,plugin in pairs(plugins) do if plugin.pre_process and msg then print('Preprocess', name) msg = plugin.pre_process(msg) end end return msg end -- Go over enabled plugins patterns. function match_plugins(msg) for name, plugin in pairs(plugins) do match_plugin(plugin, name, msg) end end -- Check if plugin is on _config.disabled_plugin_on_chat table local function is_plugin_disabled_on_chat(plugin_name, receiver) local disabled_chats = _config.disabled_plugin_on_chat -- Table exists and chat has disabled plugins if disabled_chats and disabled_chats[receiver] then -- Checks if plugin is disabled on this chat for disabled_plugin,disabled in pairs(disabled_chats[receiver]) do if disabled_plugin == plugin_name and disabled then local warning = 'Plugin '..disabled_plugin..' is disabled on this chat' print(warning) send_msg(receiver, warning, ok_cb, false) return true end end end return false end function match_plugin(plugin, plugin_name, msg) local receiver = get_receiver(msg) -- Go over patterns. If one matches it's enough. for k, pattern in pairs(plugin.patterns) do local matches = match_pattern(pattern, msg.text) if matches then print("msg matches: ", pattern) if is_plugin_disabled_on_chat(plugin_name, receiver) then return nil end -- Function exists if plugin.run then -- If plugin is for privileged users only if not warns_user_not_allowed(plugin, msg) then local result = plugin.run(msg, matches) if result then send_large_msg(receiver, result) end end end -- One patterns matches return end end end -- DEPRECATED, use send_large_msg(destination, text) function _send_msg(destination, text) send_large_msg(destination, text) end -- Save the content of _config to config.lua function save_config( ) serialize_to_file(_config, './data/config.lua') print ('saved config into ./data/config.lua') end -- Returns the config from config.lua file. -- If file doesn't exist, create it. function load_config( ) local f = io.open('./data/config.lua', "r") -- If config.lua doesn't exist if not f then print ("Created new config file: data/config.lua") create_config() else f:close() end local config = loadfile ("./data/config.lua")() for v,user in pairs(config.sudo_users) do print("Allowed user: " .. user) end return config end -- Create a basic config.json file and saves it. function create_config( ) -- A simple config with basic plugins and ourselves as privileged user config = { enabled_plugins = { "9gag", "eur", "echo", "btc", "get", "giphy", "google", "gps", "help", "id", "images", "img_google", "location", "media", "plugins", "channels", "set", "stats", "time", "version", "weather", "xkcd", "youtube" }, sudo_users = {our_id}, disabled_channels = {} } serialize_to_file(config, './data/config.lua') print ('saved config into ./data/config.lua') end function on_our_id (id) our_id = id end function on_user_update (user, what) --vardump (user) end function on_chat_update (chat, what) --vardump (chat) end function on_secret_chat_update (schat, what) --vardump (schat) end function on_get_difference_end () end -- Enable plugins in config.json function load_plugins() for k, v in pairs(_config.enabled_plugins) do print("Loading plugin", v) local ok, err = pcall(function() local t = loadfile("plugins/"..v..'.lua')() plugins[v] = t end) if not ok then print('\27[31mError loading plugin '..v..'\27[39m') print('\27[31m'..err..'\27[39m') end end end -- Call and postpone execution for cron plugins function cron_plugins() for name, plugin in pairs(plugins) do -- Only plugins with cron function if plugin.cron ~= nil then plugin.cron() end end -- Called again in 5 mins postpone (cron_plugins, false, 5*60.0) end -- Start and load values our_id = 0 now = os.time() math.randomseed(now) started = false
gpl-2.0
devilrap97/alirap97
libs/JSON.lua
3765
34843
-- -*- coding: utf-8 -*- -- -- Simple JSON encoding and decoding in pure Lua. -- -- Copyright 2010-2014 Jeffrey Friedl -- http://regex.info/blog/ -- -- Latest version: http://regex.info/blog/lua/json -- -- This code is released under a Creative Commons CC-BY "Attribution" License: -- http://creativecommons.org/licenses/by/3.0/deed.en_US -- -- It can be used for any purpose so long as the copyright notice above, -- the web-page links above, and the 'AUTHOR_NOTE' string below are -- maintained. Enjoy. -- local VERSION = 20141223.14 -- version history at end of file local AUTHOR_NOTE = "-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20141223.14 ]-" -- -- The 'AUTHOR_NOTE' variable exists so that information about the source -- of the package is maintained even in compiled versions. It's also -- included in OBJDEF below mostly to quiet warnings about unused variables. -- local OBJDEF = { VERSION = VERSION, AUTHOR_NOTE = AUTHOR_NOTE, } -- -- Simple JSON encoding and decoding in pure Lua. -- http://www.json.org/ -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- -- -- -- DECODING (from a JSON string to a Lua table) -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- If the JSON text is for an object or an array, e.g. -- { "what": "books", "count": 3 } -- or -- [ "Larry", "Curly", "Moe" ] -- -- the result is a Lua table, e.g. -- { what = "books", count = 3 } -- or -- { "Larry", "Curly", "Moe" } -- -- -- The encode and decode routines accept an optional second argument, -- "etc", which is not used during encoding or decoding, but upon error -- is passed along to error handlers. It can be of any type (including nil). -- -- -- -- ERROR HANDLING -- -- With most errors during decoding, this code calls -- -- JSON:onDecodeError(message, text, location, etc) -- -- with a message about the error, and if known, the JSON text being -- parsed and the byte count where the problem was discovered. You can -- replace the default JSON:onDecodeError() with your own function. -- -- The default onDecodeError() merely augments the message with data -- about the text and the location if known (and if a second 'etc' -- argument had been provided to decode(), its value is tacked onto the -- message as well), and then calls JSON.assert(), which itself defaults -- to Lua's built-in assert(), and can also be overridden. -- -- For example, in an Adobe Lightroom plugin, you might use something like -- -- function JSON:onDecodeError(message, text, location, etc) -- LrErrors.throwUserError("Internal Error: invalid JSON data") -- end -- -- or even just -- -- function JSON.assert(message) -- LrErrors.throwUserError("Internal Error: " .. message) -- end -- -- If JSON:decode() is passed a nil, this is called instead: -- -- JSON:onDecodeOfNilError(message, nil, nil, etc) -- -- and if JSON:decode() is passed HTML instead of JSON, this is called: -- -- JSON:onDecodeOfHTMLError(message, text, nil, etc) -- -- The use of the fourth 'etc' argument allows stronger coordination -- between decoding and error reporting, especially when you provide your -- own error-handling routines. Continuing with the the Adobe Lightroom -- plugin example: -- -- function JSON:onDecodeError(message, text, location, etc) -- local note = "Internal Error: invalid JSON data" -- if type(etc) = 'table' and etc.photo then -- note = note .. " while processing for " .. etc.photo:getFormattedMetadata('fileName') -- end -- LrErrors.throwUserError(note) -- end -- -- : -- : -- -- for i, photo in ipairs(photosToProcess) do -- : -- : -- local data = JSON:decode(someJsonText, { photo = photo }) -- : -- : -- end -- -- -- -- -- -- DECODING AND STRICT TYPES -- -- Because both JSON objects and JSON arrays are converted to Lua tables, -- it's not normally possible to tell which original JSON type a -- particular Lua table was derived from, or guarantee decode-encode -- round-trip equivalency. -- -- However, if you enable strictTypes, e.g. -- -- JSON = assert(loadfile "JSON.lua")() --load the routines -- JSON.strictTypes = true -- -- then the Lua table resulting from the decoding of a JSON object or -- JSON array is marked via Lua metatable, so that when re-encoded with -- JSON:encode() it ends up as the appropriate JSON type. -- -- (This is not the default because other routines may not work well with -- tables that have a metatable set, for example, Lightroom API calls.) -- -- -- ENCODING (from a lua table to a JSON string) -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- local custom_pretty = JSON:encode(lua_table_or_value, etc, { pretty = true, indent = "| ", align_keys = false }) -- -- On error during encoding, this code calls: -- -- JSON:onEncodeError(message, etc) -- -- which you can override in your local JSON object. -- -- The 'etc' in the error call is the second argument to encode() -- and encode_pretty(), or nil if it wasn't provided. -- -- -- PRETTY-PRINTING -- -- An optional third argument, a table of options, allows a bit of -- configuration about how the encoding takes place: -- -- pretty = JSON:encode(val, etc, { -- pretty = true, -- if false, no other options matter -- indent = " ", -- this provides for a three-space indent per nesting level -- align_keys = false, -- see below -- }) -- -- encode() and encode_pretty() are identical except that encode_pretty() -- provides a default options table if none given in the call: -- -- { pretty = true, align_keys = false, indent = " " } -- -- For example, if -- -- JSON:encode(data) -- -- produces: -- -- {"city":"Kyoto","climate":{"avg_temp":16,"humidity":"high","snowfall":"minimal"},"country":"Japan","wards":11} -- -- then -- -- JSON:encode_pretty(data) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- The following three lines return identical results: -- JSON:encode_pretty(data) -- JSON:encode_pretty(data, nil, { pretty = true, align_keys = false, indent = " " }) -- JSON:encode (data, nil, { pretty = true, align_keys = false, indent = " " }) -- -- An example of setting your own indent string: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = "| " }) -- -- produces: -- -- { -- | "city": "Kyoto", -- | "climate": { -- | | "avg_temp": 16, -- | | "humidity": "high", -- | | "snowfall": "minimal" -- | }, -- | "country": "Japan", -- | "wards": 11 -- } -- -- An example of setting align_keys to true: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = " ", align_keys = true }) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- which I must admit is kinda ugly, sorry. This was the default for -- encode_pretty() prior to version 20141223.14. -- -- -- AMBIGUOUS SITUATIONS DURING THE ENCODING -- -- During the encode, if a Lua table being encoded contains both string -- and numeric keys, it fits neither JSON's idea of an object, nor its -- idea of an array. To get around this, when any string key exists (or -- when non-positive numeric keys exist), numeric keys are converted to -- strings. -- -- For example, -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- produces the JSON object -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To prohibit this conversion and instead make it an error condition, set -- JSON.noKeyConversion = true -- -- -- SUMMARY OF METHODS YOU CAN OVERRIDE IN YOUR LOCAL LUA JSON OBJECT -- -- assert -- onDecodeError -- onDecodeOfNilError -- onDecodeOfHTMLError -- onEncodeError -- -- If you want to create a separate Lua JSON object with its own error handlers, -- you can reload JSON.lua or use the :new() method. -- --------------------------------------------------------------------------- local default_pretty_indent = " " local default_pretty_options = { pretty = true, align_keys = false, indent = default_pretty_indent } local isArray = { __tostring = function() return "JSON array" end } isArray.__index = isArray local isObject = { __tostring = function() return "JSON object" end } isObject.__index = isObject function OBJDEF:newArray(tbl) return setmetatable(tbl or {}, isArray) end function OBJDEF:newObject(tbl) return setmetatable(tbl or {}, isObject) end local function unicode_codepoint_as_utf8(codepoint) -- -- codepoint is a number -- if codepoint <= 127 then return string.char(codepoint) elseif codepoint <= 2047 then -- -- 110yyyxx 10xxxxxx <-- useful notation from http://en.wikipedia.org/wiki/Utf8 -- local highpart = math.floor(codepoint / 0x40) local lowpart = codepoint - (0x40 * highpart) return string.char(0xC0 + highpart, 0x80 + lowpart) elseif codepoint <= 65535 then -- -- 1110yyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x1000) local remainder = codepoint - 0x1000 * highpart local midpart = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midpart highpart = 0xE0 + highpart midpart = 0x80 + midpart lowpart = 0x80 + lowpart -- -- Check for an invalid character (thanks Andy R. at Adobe). -- See table 3.7, page 93, in http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#G28070 -- if ( highpart == 0xE0 and midpart < 0xA0 ) or ( highpart == 0xED and midpart > 0x9F ) or ( highpart == 0xF0 and midpart < 0x90 ) or ( highpart == 0xF4 and midpart > 0x8F ) then return "?" else return string.char(highpart, midpart, lowpart) end else -- -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x40000) local remainder = codepoint - 0x40000 * highpart local midA = math.floor(remainder / 0x1000) remainder = remainder - 0x1000 * midA local midB = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midB return string.char(0xF0 + highpart, 0x80 + midA, 0x80 + midB, 0x80 + lowpart) end end function OBJDEF:onDecodeError(message, text, location, etc) if text then if location then message = string.format("%s at char %d of: %s", message, location, text) else message = string.format("%s: %s", message, text) end end if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end OBJDEF.onDecodeOfNilError = OBJDEF.onDecodeError OBJDEF.onDecodeOfHTMLError = OBJDEF.onDecodeError function OBJDEF:onEncodeError(message, etc) if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end local function grok_number(self, text, start, etc) -- -- Grab the integer part -- local integer_part = text:match('^-?[1-9]%d*', start) or text:match("^-?0", start) if not integer_part then self:onDecodeError("expected number", text, start, etc) end local i = start + integer_part:len() -- -- Grab an optional decimal part -- local decimal_part = text:match('^%.%d+', i) or "" i = i + decimal_part:len() -- -- Grab an optional exponential part -- local exponent_part = text:match('^[eE][-+]?%d+', i) or "" i = i + exponent_part:len() local full_number_text = integer_part .. decimal_part .. exponent_part local as_number = tonumber(full_number_text) if not as_number then self:onDecodeError("bad number", text, start, etc) end return as_number, i end local function grok_string(self, text, start, etc) if text:sub(start,start) ~= '"' then self:onDecodeError("expected string's opening quote", text, start, etc) end local i = start + 1 -- +1 to bypass the initial quote local text_len = text:len() local VALUE = "" while i <= text_len do local c = text:sub(i,i) if c == '"' then return VALUE, i + 1 end if c ~= '\\' then VALUE = VALUE .. c i = i + 1 elseif text:match('^\\b', i) then VALUE = VALUE .. "\b" i = i + 2 elseif text:match('^\\f', i) then VALUE = VALUE .. "\f" i = i + 2 elseif text:match('^\\n', i) then VALUE = VALUE .. "\n" i = i + 2 elseif text:match('^\\r', i) then VALUE = VALUE .. "\r" i = i + 2 elseif text:match('^\\t', i) then VALUE = VALUE .. "\t" i = i + 2 else local hex = text:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if hex then i = i + 6 -- bypass what we just read -- We have a Unicode codepoint. It could be standalone, or if in the proper range and -- followed by another in a specific range, it'll be a two-code surrogate pair. local codepoint = tonumber(hex, 16) if codepoint >= 0xD800 and codepoint <= 0xDBFF then -- it's a hi surrogate... see whether we have a following low local lo_surrogate = text:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if lo_surrogate then i = i + 6 -- bypass the low surrogate we just read codepoint = 0x2400 + (codepoint - 0xD800) * 0x400 + tonumber(lo_surrogate, 16) else -- not a proper low, so we'll just leave the first codepoint as is and spit it out. end end VALUE = VALUE .. unicode_codepoint_as_utf8(codepoint) else -- just pass through what's escaped VALUE = VALUE .. text:match('^\\(.)', i) i = i + 2 end end end self:onDecodeError("unclosed string", text, start, etc) end local function skip_whitespace(text, start) local _, match_end = text:find("^[ \n\r\t]+", start) -- [http://www.ietf.org/rfc/rfc4627.txt] Section 2 if match_end then return match_end + 1 else return start end end local grok_one -- assigned later local function grok_object(self, text, start, etc) if text:sub(start,start) ~= '{' then self:onDecodeError("expected '{'", text, start, etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '{' local VALUE = self.strictTypes and self:newObject { } or { } if text:sub(i,i) == '}' then return VALUE, i + 1 end local text_len = text:len() while i <= text_len do local key, new_i = grok_string(self, text, i, etc) i = skip_whitespace(text, new_i) if text:sub(i, i) ~= ':' then self:onDecodeError("expected colon", text, i, etc) end i = skip_whitespace(text, i + 1) local new_val, new_i = grok_one(self, text, i) VALUE[key] = new_val -- -- Expect now either '}' to end things, or a ',' to allow us to continue. -- i = skip_whitespace(text, new_i) local c = text:sub(i,i) if c == '}' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '}'", text, i, etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '{'", text, start, etc) end local function grok_array(self, text, start, etc) if text:sub(start,start) ~= '[' then self:onDecodeError("expected '['", text, start, etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '[' local VALUE = self.strictTypes and self:newArray { } or { } if text:sub(i,i) == ']' then return VALUE, i + 1 end local VALUE_INDEX = 1 local text_len = text:len() while i <= text_len do local val, new_i = grok_one(self, text, i) -- can't table.insert(VALUE, val) here because it's a no-op if val is nil VALUE[VALUE_INDEX] = val VALUE_INDEX = VALUE_INDEX + 1 i = skip_whitespace(text, new_i) -- -- Expect now either ']' to end things, or a ',' to allow us to continue. -- local c = text:sub(i,i) if c == ']' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '['", text, i, etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '['", text, start, etc) end grok_one = function(self, text, start, etc) -- Skip any whitespace start = skip_whitespace(text, start) if start > text:len() then self:onDecodeError("unexpected end of string", text, nil, etc) end if text:find('^"', start) then return grok_string(self, text, start, etc) elseif text:find('^[-0123456789 ]', start) then return grok_number(self, text, start, etc) elseif text:find('^%{', start) then return grok_object(self, text, start, etc) elseif text:find('^%[', start) then return grok_array(self, text, start, etc) elseif text:find('^true', start) then return true, start + 4 elseif text:find('^false', start) then return false, start + 5 elseif text:find('^null', start) then return nil, start + 4 else self:onDecodeError("can't parse JSON", text, start, etc) end end function OBJDEF:decode(text, etc) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onDecodeError("JSON:decode must be called in method format", nil, nil, etc) end if text == nil then self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"), nil, nil, etc) elseif type(text) ~= 'string' then self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s", type(text)), nil, nil, etc) end if text:match('^%s*$') then return nil end if text:match('^%s*<') then -- Can't be JSON... we'll assume it's HTML self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"), text, nil, etc) end -- -- Ensure that it's not UTF-32 or UTF-16. -- Those are perfectly valid encodings for JSON (as per RFC 4627 section 3), -- but this package can't handle them. -- if text:sub(1,1):byte() == 0 or (text:len() >= 2 and text:sub(2,2):byte() == 0) then self:onDecodeError("JSON package groks only UTF-8, sorry", text, nil, etc) end local success, value = pcall(grok_one, self, text, 1, etc) if success then return value else -- if JSON:onDecodeError() didn't abort out of the pcall, we'll have received the error message here as "value", so pass it along as an assert. if self.assert then self.assert(false, value) else assert(false, value) end -- and if we're still here, return a nil and throw the error message on as a second arg return nil, value end end local function backslash_replacement_function(c) if c == "\n" then return "\\n" elseif c == "\r" then return "\\r" elseif c == "\t" then return "\\t" elseif c == "\b" then return "\\b" elseif c == "\f" then return "\\f" elseif c == '"' then return '\\"' elseif c == '\\' then return '\\\\' else return string.format("\\u%04x", c:byte()) end end local chars_to_be_escaped_in_JSON_string = '[' .. '"' -- class sub-pattern to match a double quote .. '%\\' -- class sub-pattern to match a backslash .. '%z' -- class sub-pattern to match a null .. '\001' .. '-' .. '\031' -- class sub-pattern to match control characters .. ']' local function json_string_literal(value) local newval = value:gsub(chars_to_be_escaped_in_JSON_string, backslash_replacement_function) return '"' .. newval .. '"' end local function object_or_array(self, T, etc) -- -- We need to inspect all the keys... if there are any strings, we'll convert to a JSON -- object. If there are only numbers, it's a JSON array. -- -- If we'll be converting to a JSON object, we'll want to sort the keys so that the -- end result is deterministic. -- local string_keys = { } local number_keys = { } local number_keys_must_be_strings = false local maximum_number_key for key in pairs(T) do if type(key) == 'string' then table.insert(string_keys, key) elseif type(key) == 'number' then table.insert(number_keys, key) if key <= 0 or key >= math.huge then number_keys_must_be_strings = true elseif not maximum_number_key or key > maximum_number_key then maximum_number_key = key end else self:onEncodeError("can't encode table with a key of type " .. type(key), etc) end end if #string_keys == 0 and not number_keys_must_be_strings then -- -- An empty table, or a numeric-only array -- if #number_keys > 0 then return nil, maximum_number_key -- an array elseif tostring(T) == "JSON array" then return nil elseif tostring(T) == "JSON object" then return { } else -- have to guess, so we'll pick array, since empty arrays are likely more common than empty objects return nil end end table.sort(string_keys) local map if #number_keys > 0 then -- -- If we're here then we have either mixed string/number keys, or numbers inappropriate for a JSON array -- It's not ideal, but we'll turn the numbers into strings so that we can at least create a JSON object. -- if self.noKeyConversion then self:onEncodeError("a table with both numeric and string keys could be an object or array; aborting", etc) end -- -- Have to make a shallow copy of the source table so we can remap the numeric keys to be strings -- map = { } for key, val in pairs(T) do map[key] = val end table.sort(number_keys) -- -- Throw numeric keys in there as strings -- for _, number_key in ipairs(number_keys) do local string_key = tostring(number_key) if map[string_key] == nil then table.insert(string_keys , string_key) map[string_key] = T[number_key] else self:onEncodeError("conflict converting table with mixed-type keys into a JSON object: key " .. number_key .. " exists both as a string and a number.", etc) end end end return string_keys, nil, map end -- -- Encode -- -- 'options' is nil, or a table with possible keys: -- pretty -- if true, return a pretty-printed version -- indent -- a string (usually of spaces) used to indent each nested level -- align_keys -- if true, align all the keys when formatting a table -- local encode_value -- must predeclare because it calls itself function encode_value(self, value, parents, etc, options, indent) if value == nil then return 'null' elseif type(value) == 'string' then return json_string_literal(value) elseif type(value) == 'number' then if value ~= value then -- -- NaN (Not a Number). -- JSON has no NaN, so we have to fudge the best we can. This should really be a package option. -- return "null" elseif value >= math.huge then -- -- Positive infinity. JSON has no INF, so we have to fudge the best we can. This should -- really be a package option. Note: at least with some implementations, positive infinity -- is both ">= math.huge" and "<= -math.huge", which makes no sense but that's how it is. -- Negative infinity is properly "<= -math.huge". So, we must be sure to check the ">=" -- case first. -- return "1e+9999" elseif value <= -math.huge then -- -- Negative infinity. -- JSON has no INF, so we have to fudge the best we can. This should really be a package option. -- return "-1e+9999" else return tostring(value) end elseif type(value) == 'boolean' then return tostring(value) elseif type(value) ~= 'table' then self:onEncodeError("can't convert " .. type(value) .. " to JSON", etc) else -- -- A table to be converted to either a JSON object or array. -- local T = value if type(options) ~= 'table' then options = {} end if type(indent) ~= 'string' then indent = "" end if parents[T] then self:onEncodeError("table " .. tostring(T) .. " is a child of itself", etc) else parents[T] = true end local result_value local object_keys, maximum_number_key, map = object_or_array(self, T, etc) if maximum_number_key then -- -- An array... -- local ITEMS = { } for i = 1, maximum_number_key do table.insert(ITEMS, encode_value(self, T[i], parents, etc, options, indent)) end if options.pretty then result_value = "[ " .. table.concat(ITEMS, ", ") .. " ]" else result_value = "[" .. table.concat(ITEMS, ",") .. "]" end elseif object_keys then -- -- An object -- local TT = map or T if options.pretty then local KEYS = { } local max_key_length = 0 for _, key in ipairs(object_keys) do local encoded = encode_value(self, tostring(key), parents, etc, options, indent) if options.align_keys then max_key_length = math.max(max_key_length, #encoded) end table.insert(KEYS, encoded) end local key_indent = indent .. tostring(options.indent or "") local subtable_indent = key_indent .. string.rep(" ", max_key_length) .. (options.align_keys and " " or "") local FORMAT = "%s%" .. string.format("%d", max_key_length) .. "s: %s" local COMBINED_PARTS = { } for i, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, subtable_indent) table.insert(COMBINED_PARTS, string.format(FORMAT, key_indent, KEYS[i], encoded_val)) end result_value = "{\n" .. table.concat(COMBINED_PARTS, ",\n") .. "\n" .. indent .. "}" else local PARTS = { } for _, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, indent) local encoded_key = encode_value(self, tostring(key), parents, etc, options, indent) table.insert(PARTS, string.format("%s:%s", encoded_key, encoded_val)) end result_value = "{" .. table.concat(PARTS, ",") .. "}" end else -- -- An empty array/object... we'll treat it as an array, though it should really be an option -- result_value = "[]" end parents[T] = false return result_value end end function OBJDEF:encode(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode must be called in method format", etc) end return encode_value(self, value, {}, etc, options or nil) end function OBJDEF:encode_pretty(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode_pretty must be called in method format", etc) end return encode_value(self, value, {}, etc, options or default_pretty_options) end function OBJDEF.__tostring() return "JSON encode/decode package" end OBJDEF.__index = OBJDEF function OBJDEF:new(args) local new = { } if args then for key, val in pairs(args) do new[key] = val end end return setmetatable(new, OBJDEF) end return OBJDEF:new() -- -- Version history: -- -- 20141223.14 The encode_pretty() routine produced fine results for small datasets, but isn't really -- appropriate for anything large, so with help from Alex Aulbach I've made the encode routines -- more flexible, and changed the default encode_pretty() to be more generally useful. -- -- Added a third 'options' argument to the encode() and encode_pretty() routines, to control -- how the encoding takes place. -- -- Updated docs to add assert() call to the loadfile() line, just as good practice so that -- if there is a problem loading JSON.lua, the appropriate error message will percolate up. -- -- 20140920.13 Put back (in a way that doesn't cause warnings about unused variables) the author string, -- so that the source of the package, and its version number, are visible in compiled copies. -- -- 20140911.12 Minor lua cleanup. -- Fixed internal reference to 'JSON.noKeyConversion' to reference 'self' instead of 'JSON'. -- (Thanks to SmugMug's David Parry for these.) -- -- 20140418.11 JSON nulls embedded within an array were being ignored, such that -- ["1",null,null,null,null,null,"seven"], -- would return -- {1,"seven"} -- It's now fixed to properly return -- {1, nil, nil, nil, nil, nil, "seven"} -- Thanks to "haddock" for catching the error. -- -- 20140116.10 The user's JSON.assert() wasn't always being used. Thanks to "blue" for the heads up. -- -- 20131118.9 Update for Lua 5.3... it seems that tostring(2/1) produces "2.0" instead of "2", -- and this caused some problems. -- -- 20131031.8 Unified the code for encode() and encode_pretty(); they had been stupidly separate, -- and had of course diverged (encode_pretty didn't get the fixes that encode got, so -- sometimes produced incorrect results; thanks to Mattie for the heads up). -- -- Handle encoding tables with non-positive numeric keys (unlikely, but possible). -- -- If a table has both numeric and string keys, or its numeric keys are inappropriate -- (such as being non-positive or infinite), the numeric keys are turned into -- string keys appropriate for a JSON object. So, as before, -- JSON:encode({ "one", "two", "three" }) -- produces the array -- ["one","two","three"] -- but now something with mixed key types like -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- instead of throwing an error produces an object: -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To maintain the prior throw-an-error semantics, set -- JSON.noKeyConversion = true -- -- 20131004.7 Release under a Creative Commons CC-BY license, which I should have done from day one, sorry. -- -- 20130120.6 Comment update: added a link to the specific page on my blog where this code can -- be found, so that folks who come across the code outside of my blog can find updates -- more easily. -- -- 20111207.5 Added support for the 'etc' arguments, for better error reporting. -- -- 20110731.4 More feedback from David Kolf on how to make the tests for Nan/Infinity system independent. -- -- 20110730.3 Incorporated feedback from David Kolf at http://lua-users.org/wiki/JsonModules: -- -- * When encoding lua for JSON, Sparse numeric arrays are now handled by -- spitting out full arrays, such that -- JSON:encode({"one", "two", [10] = "ten"}) -- returns -- ["one","two",null,null,null,null,null,null,null,"ten"] -- -- In 20100810.2 and earlier, only up to the first non-null value would have been retained. -- -- * When encoding lua for JSON, numeric value NaN gets spit out as null, and infinity as "1+e9999". -- Version 20100810.2 and earlier created invalid JSON in both cases. -- -- * Unicode surrogate pairs are now detected when decoding JSON. -- -- 20100810.2 added some checking to ensure that an invalid Unicode character couldn't leak in to the UTF-8 encoding -- -- 20100731.1 initial public release --
gpl-2.0
javierojan/copia
libs/JSON.lua
3765
34843
-- -*- coding: utf-8 -*- -- -- Simple JSON encoding and decoding in pure Lua. -- -- Copyright 2010-2014 Jeffrey Friedl -- http://regex.info/blog/ -- -- Latest version: http://regex.info/blog/lua/json -- -- This code is released under a Creative Commons CC-BY "Attribution" License: -- http://creativecommons.org/licenses/by/3.0/deed.en_US -- -- It can be used for any purpose so long as the copyright notice above, -- the web-page links above, and the 'AUTHOR_NOTE' string below are -- maintained. Enjoy. -- local VERSION = 20141223.14 -- version history at end of file local AUTHOR_NOTE = "-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20141223.14 ]-" -- -- The 'AUTHOR_NOTE' variable exists so that information about the source -- of the package is maintained even in compiled versions. It's also -- included in OBJDEF below mostly to quiet warnings about unused variables. -- local OBJDEF = { VERSION = VERSION, AUTHOR_NOTE = AUTHOR_NOTE, } -- -- Simple JSON encoding and decoding in pure Lua. -- http://www.json.org/ -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- -- -- -- DECODING (from a JSON string to a Lua table) -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- If the JSON text is for an object or an array, e.g. -- { "what": "books", "count": 3 } -- or -- [ "Larry", "Curly", "Moe" ] -- -- the result is a Lua table, e.g. -- { what = "books", count = 3 } -- or -- { "Larry", "Curly", "Moe" } -- -- -- The encode and decode routines accept an optional second argument, -- "etc", which is not used during encoding or decoding, but upon error -- is passed along to error handlers. It can be of any type (including nil). -- -- -- -- ERROR HANDLING -- -- With most errors during decoding, this code calls -- -- JSON:onDecodeError(message, text, location, etc) -- -- with a message about the error, and if known, the JSON text being -- parsed and the byte count where the problem was discovered. You can -- replace the default JSON:onDecodeError() with your own function. -- -- The default onDecodeError() merely augments the message with data -- about the text and the location if known (and if a second 'etc' -- argument had been provided to decode(), its value is tacked onto the -- message as well), and then calls JSON.assert(), which itself defaults -- to Lua's built-in assert(), and can also be overridden. -- -- For example, in an Adobe Lightroom plugin, you might use something like -- -- function JSON:onDecodeError(message, text, location, etc) -- LrErrors.throwUserError("Internal Error: invalid JSON data") -- end -- -- or even just -- -- function JSON.assert(message) -- LrErrors.throwUserError("Internal Error: " .. message) -- end -- -- If JSON:decode() is passed a nil, this is called instead: -- -- JSON:onDecodeOfNilError(message, nil, nil, etc) -- -- and if JSON:decode() is passed HTML instead of JSON, this is called: -- -- JSON:onDecodeOfHTMLError(message, text, nil, etc) -- -- The use of the fourth 'etc' argument allows stronger coordination -- between decoding and error reporting, especially when you provide your -- own error-handling routines. Continuing with the the Adobe Lightroom -- plugin example: -- -- function JSON:onDecodeError(message, text, location, etc) -- local note = "Internal Error: invalid JSON data" -- if type(etc) = 'table' and etc.photo then -- note = note .. " while processing for " .. etc.photo:getFormattedMetadata('fileName') -- end -- LrErrors.throwUserError(note) -- end -- -- : -- : -- -- for i, photo in ipairs(photosToProcess) do -- : -- : -- local data = JSON:decode(someJsonText, { photo = photo }) -- : -- : -- end -- -- -- -- -- -- DECODING AND STRICT TYPES -- -- Because both JSON objects and JSON arrays are converted to Lua tables, -- it's not normally possible to tell which original JSON type a -- particular Lua table was derived from, or guarantee decode-encode -- round-trip equivalency. -- -- However, if you enable strictTypes, e.g. -- -- JSON = assert(loadfile "JSON.lua")() --load the routines -- JSON.strictTypes = true -- -- then the Lua table resulting from the decoding of a JSON object or -- JSON array is marked via Lua metatable, so that when re-encoded with -- JSON:encode() it ends up as the appropriate JSON type. -- -- (This is not the default because other routines may not work well with -- tables that have a metatable set, for example, Lightroom API calls.) -- -- -- ENCODING (from a lua table to a JSON string) -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- local custom_pretty = JSON:encode(lua_table_or_value, etc, { pretty = true, indent = "| ", align_keys = false }) -- -- On error during encoding, this code calls: -- -- JSON:onEncodeError(message, etc) -- -- which you can override in your local JSON object. -- -- The 'etc' in the error call is the second argument to encode() -- and encode_pretty(), or nil if it wasn't provided. -- -- -- PRETTY-PRINTING -- -- An optional third argument, a table of options, allows a bit of -- configuration about how the encoding takes place: -- -- pretty = JSON:encode(val, etc, { -- pretty = true, -- if false, no other options matter -- indent = " ", -- this provides for a three-space indent per nesting level -- align_keys = false, -- see below -- }) -- -- encode() and encode_pretty() are identical except that encode_pretty() -- provides a default options table if none given in the call: -- -- { pretty = true, align_keys = false, indent = " " } -- -- For example, if -- -- JSON:encode(data) -- -- produces: -- -- {"city":"Kyoto","climate":{"avg_temp":16,"humidity":"high","snowfall":"minimal"},"country":"Japan","wards":11} -- -- then -- -- JSON:encode_pretty(data) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- The following three lines return identical results: -- JSON:encode_pretty(data) -- JSON:encode_pretty(data, nil, { pretty = true, align_keys = false, indent = " " }) -- JSON:encode (data, nil, { pretty = true, align_keys = false, indent = " " }) -- -- An example of setting your own indent string: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = "| " }) -- -- produces: -- -- { -- | "city": "Kyoto", -- | "climate": { -- | | "avg_temp": 16, -- | | "humidity": "high", -- | | "snowfall": "minimal" -- | }, -- | "country": "Japan", -- | "wards": 11 -- } -- -- An example of setting align_keys to true: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = " ", align_keys = true }) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- which I must admit is kinda ugly, sorry. This was the default for -- encode_pretty() prior to version 20141223.14. -- -- -- AMBIGUOUS SITUATIONS DURING THE ENCODING -- -- During the encode, if a Lua table being encoded contains both string -- and numeric keys, it fits neither JSON's idea of an object, nor its -- idea of an array. To get around this, when any string key exists (or -- when non-positive numeric keys exist), numeric keys are converted to -- strings. -- -- For example, -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- produces the JSON object -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To prohibit this conversion and instead make it an error condition, set -- JSON.noKeyConversion = true -- -- -- SUMMARY OF METHODS YOU CAN OVERRIDE IN YOUR LOCAL LUA JSON OBJECT -- -- assert -- onDecodeError -- onDecodeOfNilError -- onDecodeOfHTMLError -- onEncodeError -- -- If you want to create a separate Lua JSON object with its own error handlers, -- you can reload JSON.lua or use the :new() method. -- --------------------------------------------------------------------------- local default_pretty_indent = " " local default_pretty_options = { pretty = true, align_keys = false, indent = default_pretty_indent } local isArray = { __tostring = function() return "JSON array" end } isArray.__index = isArray local isObject = { __tostring = function() return "JSON object" end } isObject.__index = isObject function OBJDEF:newArray(tbl) return setmetatable(tbl or {}, isArray) end function OBJDEF:newObject(tbl) return setmetatable(tbl or {}, isObject) end local function unicode_codepoint_as_utf8(codepoint) -- -- codepoint is a number -- if codepoint <= 127 then return string.char(codepoint) elseif codepoint <= 2047 then -- -- 110yyyxx 10xxxxxx <-- useful notation from http://en.wikipedia.org/wiki/Utf8 -- local highpart = math.floor(codepoint / 0x40) local lowpart = codepoint - (0x40 * highpart) return string.char(0xC0 + highpart, 0x80 + lowpart) elseif codepoint <= 65535 then -- -- 1110yyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x1000) local remainder = codepoint - 0x1000 * highpart local midpart = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midpart highpart = 0xE0 + highpart midpart = 0x80 + midpart lowpart = 0x80 + lowpart -- -- Check for an invalid character (thanks Andy R. at Adobe). -- See table 3.7, page 93, in http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#G28070 -- if ( highpart == 0xE0 and midpart < 0xA0 ) or ( highpart == 0xED and midpart > 0x9F ) or ( highpart == 0xF0 and midpart < 0x90 ) or ( highpart == 0xF4 and midpart > 0x8F ) then return "?" else return string.char(highpart, midpart, lowpart) end else -- -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x40000) local remainder = codepoint - 0x40000 * highpart local midA = math.floor(remainder / 0x1000) remainder = remainder - 0x1000 * midA local midB = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midB return string.char(0xF0 + highpart, 0x80 + midA, 0x80 + midB, 0x80 + lowpart) end end function OBJDEF:onDecodeError(message, text, location, etc) if text then if location then message = string.format("%s at char %d of: %s", message, location, text) else message = string.format("%s: %s", message, text) end end if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end OBJDEF.onDecodeOfNilError = OBJDEF.onDecodeError OBJDEF.onDecodeOfHTMLError = OBJDEF.onDecodeError function OBJDEF:onEncodeError(message, etc) if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end local function grok_number(self, text, start, etc) -- -- Grab the integer part -- local integer_part = text:match('^-?[1-9]%d*', start) or text:match("^-?0", start) if not integer_part then self:onDecodeError("expected number", text, start, etc) end local i = start + integer_part:len() -- -- Grab an optional decimal part -- local decimal_part = text:match('^%.%d+', i) or "" i = i + decimal_part:len() -- -- Grab an optional exponential part -- local exponent_part = text:match('^[eE][-+]?%d+', i) or "" i = i + exponent_part:len() local full_number_text = integer_part .. decimal_part .. exponent_part local as_number = tonumber(full_number_text) if not as_number then self:onDecodeError("bad number", text, start, etc) end return as_number, i end local function grok_string(self, text, start, etc) if text:sub(start,start) ~= '"' then self:onDecodeError("expected string's opening quote", text, start, etc) end local i = start + 1 -- +1 to bypass the initial quote local text_len = text:len() local VALUE = "" while i <= text_len do local c = text:sub(i,i) if c == '"' then return VALUE, i + 1 end if c ~= '\\' then VALUE = VALUE .. c i = i + 1 elseif text:match('^\\b', i) then VALUE = VALUE .. "\b" i = i + 2 elseif text:match('^\\f', i) then VALUE = VALUE .. "\f" i = i + 2 elseif text:match('^\\n', i) then VALUE = VALUE .. "\n" i = i + 2 elseif text:match('^\\r', i) then VALUE = VALUE .. "\r" i = i + 2 elseif text:match('^\\t', i) then VALUE = VALUE .. "\t" i = i + 2 else local hex = text:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if hex then i = i + 6 -- bypass what we just read -- We have a Unicode codepoint. It could be standalone, or if in the proper range and -- followed by another in a specific range, it'll be a two-code surrogate pair. local codepoint = tonumber(hex, 16) if codepoint >= 0xD800 and codepoint <= 0xDBFF then -- it's a hi surrogate... see whether we have a following low local lo_surrogate = text:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if lo_surrogate then i = i + 6 -- bypass the low surrogate we just read codepoint = 0x2400 + (codepoint - 0xD800) * 0x400 + tonumber(lo_surrogate, 16) else -- not a proper low, so we'll just leave the first codepoint as is and spit it out. end end VALUE = VALUE .. unicode_codepoint_as_utf8(codepoint) else -- just pass through what's escaped VALUE = VALUE .. text:match('^\\(.)', i) i = i + 2 end end end self:onDecodeError("unclosed string", text, start, etc) end local function skip_whitespace(text, start) local _, match_end = text:find("^[ \n\r\t]+", start) -- [http://www.ietf.org/rfc/rfc4627.txt] Section 2 if match_end then return match_end + 1 else return start end end local grok_one -- assigned later local function grok_object(self, text, start, etc) if text:sub(start,start) ~= '{' then self:onDecodeError("expected '{'", text, start, etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '{' local VALUE = self.strictTypes and self:newObject { } or { } if text:sub(i,i) == '}' then return VALUE, i + 1 end local text_len = text:len() while i <= text_len do local key, new_i = grok_string(self, text, i, etc) i = skip_whitespace(text, new_i) if text:sub(i, i) ~= ':' then self:onDecodeError("expected colon", text, i, etc) end i = skip_whitespace(text, i + 1) local new_val, new_i = grok_one(self, text, i) VALUE[key] = new_val -- -- Expect now either '}' to end things, or a ',' to allow us to continue. -- i = skip_whitespace(text, new_i) local c = text:sub(i,i) if c == '}' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '}'", text, i, etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '{'", text, start, etc) end local function grok_array(self, text, start, etc) if text:sub(start,start) ~= '[' then self:onDecodeError("expected '['", text, start, etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '[' local VALUE = self.strictTypes and self:newArray { } or { } if text:sub(i,i) == ']' then return VALUE, i + 1 end local VALUE_INDEX = 1 local text_len = text:len() while i <= text_len do local val, new_i = grok_one(self, text, i) -- can't table.insert(VALUE, val) here because it's a no-op if val is nil VALUE[VALUE_INDEX] = val VALUE_INDEX = VALUE_INDEX + 1 i = skip_whitespace(text, new_i) -- -- Expect now either ']' to end things, or a ',' to allow us to continue. -- local c = text:sub(i,i) if c == ']' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '['", text, i, etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '['", text, start, etc) end grok_one = function(self, text, start, etc) -- Skip any whitespace start = skip_whitespace(text, start) if start > text:len() then self:onDecodeError("unexpected end of string", text, nil, etc) end if text:find('^"', start) then return grok_string(self, text, start, etc) elseif text:find('^[-0123456789 ]', start) then return grok_number(self, text, start, etc) elseif text:find('^%{', start) then return grok_object(self, text, start, etc) elseif text:find('^%[', start) then return grok_array(self, text, start, etc) elseif text:find('^true', start) then return true, start + 4 elseif text:find('^false', start) then return false, start + 5 elseif text:find('^null', start) then return nil, start + 4 else self:onDecodeError("can't parse JSON", text, start, etc) end end function OBJDEF:decode(text, etc) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onDecodeError("JSON:decode must be called in method format", nil, nil, etc) end if text == nil then self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"), nil, nil, etc) elseif type(text) ~= 'string' then self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s", type(text)), nil, nil, etc) end if text:match('^%s*$') then return nil end if text:match('^%s*<') then -- Can't be JSON... we'll assume it's HTML self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"), text, nil, etc) end -- -- Ensure that it's not UTF-32 or UTF-16. -- Those are perfectly valid encodings for JSON (as per RFC 4627 section 3), -- but this package can't handle them. -- if text:sub(1,1):byte() == 0 or (text:len() >= 2 and text:sub(2,2):byte() == 0) then self:onDecodeError("JSON package groks only UTF-8, sorry", text, nil, etc) end local success, value = pcall(grok_one, self, text, 1, etc) if success then return value else -- if JSON:onDecodeError() didn't abort out of the pcall, we'll have received the error message here as "value", so pass it along as an assert. if self.assert then self.assert(false, value) else assert(false, value) end -- and if we're still here, return a nil and throw the error message on as a second arg return nil, value end end local function backslash_replacement_function(c) if c == "\n" then return "\\n" elseif c == "\r" then return "\\r" elseif c == "\t" then return "\\t" elseif c == "\b" then return "\\b" elseif c == "\f" then return "\\f" elseif c == '"' then return '\\"' elseif c == '\\' then return '\\\\' else return string.format("\\u%04x", c:byte()) end end local chars_to_be_escaped_in_JSON_string = '[' .. '"' -- class sub-pattern to match a double quote .. '%\\' -- class sub-pattern to match a backslash .. '%z' -- class sub-pattern to match a null .. '\001' .. '-' .. '\031' -- class sub-pattern to match control characters .. ']' local function json_string_literal(value) local newval = value:gsub(chars_to_be_escaped_in_JSON_string, backslash_replacement_function) return '"' .. newval .. '"' end local function object_or_array(self, T, etc) -- -- We need to inspect all the keys... if there are any strings, we'll convert to a JSON -- object. If there are only numbers, it's a JSON array. -- -- If we'll be converting to a JSON object, we'll want to sort the keys so that the -- end result is deterministic. -- local string_keys = { } local number_keys = { } local number_keys_must_be_strings = false local maximum_number_key for key in pairs(T) do if type(key) == 'string' then table.insert(string_keys, key) elseif type(key) == 'number' then table.insert(number_keys, key) if key <= 0 or key >= math.huge then number_keys_must_be_strings = true elseif not maximum_number_key or key > maximum_number_key then maximum_number_key = key end else self:onEncodeError("can't encode table with a key of type " .. type(key), etc) end end if #string_keys == 0 and not number_keys_must_be_strings then -- -- An empty table, or a numeric-only array -- if #number_keys > 0 then return nil, maximum_number_key -- an array elseif tostring(T) == "JSON array" then return nil elseif tostring(T) == "JSON object" then return { } else -- have to guess, so we'll pick array, since empty arrays are likely more common than empty objects return nil end end table.sort(string_keys) local map if #number_keys > 0 then -- -- If we're here then we have either mixed string/number keys, or numbers inappropriate for a JSON array -- It's not ideal, but we'll turn the numbers into strings so that we can at least create a JSON object. -- if self.noKeyConversion then self:onEncodeError("a table with both numeric and string keys could be an object or array; aborting", etc) end -- -- Have to make a shallow copy of the source table so we can remap the numeric keys to be strings -- map = { } for key, val in pairs(T) do map[key] = val end table.sort(number_keys) -- -- Throw numeric keys in there as strings -- for _, number_key in ipairs(number_keys) do local string_key = tostring(number_key) if map[string_key] == nil then table.insert(string_keys , string_key) map[string_key] = T[number_key] else self:onEncodeError("conflict converting table with mixed-type keys into a JSON object: key " .. number_key .. " exists both as a string and a number.", etc) end end end return string_keys, nil, map end -- -- Encode -- -- 'options' is nil, or a table with possible keys: -- pretty -- if true, return a pretty-printed version -- indent -- a string (usually of spaces) used to indent each nested level -- align_keys -- if true, align all the keys when formatting a table -- local encode_value -- must predeclare because it calls itself function encode_value(self, value, parents, etc, options, indent) if value == nil then return 'null' elseif type(value) == 'string' then return json_string_literal(value) elseif type(value) == 'number' then if value ~= value then -- -- NaN (Not a Number). -- JSON has no NaN, so we have to fudge the best we can. This should really be a package option. -- return "null" elseif value >= math.huge then -- -- Positive infinity. JSON has no INF, so we have to fudge the best we can. This should -- really be a package option. Note: at least with some implementations, positive infinity -- is both ">= math.huge" and "<= -math.huge", which makes no sense but that's how it is. -- Negative infinity is properly "<= -math.huge". So, we must be sure to check the ">=" -- case first. -- return "1e+9999" elseif value <= -math.huge then -- -- Negative infinity. -- JSON has no INF, so we have to fudge the best we can. This should really be a package option. -- return "-1e+9999" else return tostring(value) end elseif type(value) == 'boolean' then return tostring(value) elseif type(value) ~= 'table' then self:onEncodeError("can't convert " .. type(value) .. " to JSON", etc) else -- -- A table to be converted to either a JSON object or array. -- local T = value if type(options) ~= 'table' then options = {} end if type(indent) ~= 'string' then indent = "" end if parents[T] then self:onEncodeError("table " .. tostring(T) .. " is a child of itself", etc) else parents[T] = true end local result_value local object_keys, maximum_number_key, map = object_or_array(self, T, etc) if maximum_number_key then -- -- An array... -- local ITEMS = { } for i = 1, maximum_number_key do table.insert(ITEMS, encode_value(self, T[i], parents, etc, options, indent)) end if options.pretty then result_value = "[ " .. table.concat(ITEMS, ", ") .. " ]" else result_value = "[" .. table.concat(ITEMS, ",") .. "]" end elseif object_keys then -- -- An object -- local TT = map or T if options.pretty then local KEYS = { } local max_key_length = 0 for _, key in ipairs(object_keys) do local encoded = encode_value(self, tostring(key), parents, etc, options, indent) if options.align_keys then max_key_length = math.max(max_key_length, #encoded) end table.insert(KEYS, encoded) end local key_indent = indent .. tostring(options.indent or "") local subtable_indent = key_indent .. string.rep(" ", max_key_length) .. (options.align_keys and " " or "") local FORMAT = "%s%" .. string.format("%d", max_key_length) .. "s: %s" local COMBINED_PARTS = { } for i, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, subtable_indent) table.insert(COMBINED_PARTS, string.format(FORMAT, key_indent, KEYS[i], encoded_val)) end result_value = "{\n" .. table.concat(COMBINED_PARTS, ",\n") .. "\n" .. indent .. "}" else local PARTS = { } for _, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, indent) local encoded_key = encode_value(self, tostring(key), parents, etc, options, indent) table.insert(PARTS, string.format("%s:%s", encoded_key, encoded_val)) end result_value = "{" .. table.concat(PARTS, ",") .. "}" end else -- -- An empty array/object... we'll treat it as an array, though it should really be an option -- result_value = "[]" end parents[T] = false return result_value end end function OBJDEF:encode(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode must be called in method format", etc) end return encode_value(self, value, {}, etc, options or nil) end function OBJDEF:encode_pretty(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode_pretty must be called in method format", etc) end return encode_value(self, value, {}, etc, options or default_pretty_options) end function OBJDEF.__tostring() return "JSON encode/decode package" end OBJDEF.__index = OBJDEF function OBJDEF:new(args) local new = { } if args then for key, val in pairs(args) do new[key] = val end end return setmetatable(new, OBJDEF) end return OBJDEF:new() -- -- Version history: -- -- 20141223.14 The encode_pretty() routine produced fine results for small datasets, but isn't really -- appropriate for anything large, so with help from Alex Aulbach I've made the encode routines -- more flexible, and changed the default encode_pretty() to be more generally useful. -- -- Added a third 'options' argument to the encode() and encode_pretty() routines, to control -- how the encoding takes place. -- -- Updated docs to add assert() call to the loadfile() line, just as good practice so that -- if there is a problem loading JSON.lua, the appropriate error message will percolate up. -- -- 20140920.13 Put back (in a way that doesn't cause warnings about unused variables) the author string, -- so that the source of the package, and its version number, are visible in compiled copies. -- -- 20140911.12 Minor lua cleanup. -- Fixed internal reference to 'JSON.noKeyConversion' to reference 'self' instead of 'JSON'. -- (Thanks to SmugMug's David Parry for these.) -- -- 20140418.11 JSON nulls embedded within an array were being ignored, such that -- ["1",null,null,null,null,null,"seven"], -- would return -- {1,"seven"} -- It's now fixed to properly return -- {1, nil, nil, nil, nil, nil, "seven"} -- Thanks to "haddock" for catching the error. -- -- 20140116.10 The user's JSON.assert() wasn't always being used. Thanks to "blue" for the heads up. -- -- 20131118.9 Update for Lua 5.3... it seems that tostring(2/1) produces "2.0" instead of "2", -- and this caused some problems. -- -- 20131031.8 Unified the code for encode() and encode_pretty(); they had been stupidly separate, -- and had of course diverged (encode_pretty didn't get the fixes that encode got, so -- sometimes produced incorrect results; thanks to Mattie for the heads up). -- -- Handle encoding tables with non-positive numeric keys (unlikely, but possible). -- -- If a table has both numeric and string keys, or its numeric keys are inappropriate -- (such as being non-positive or infinite), the numeric keys are turned into -- string keys appropriate for a JSON object. So, as before, -- JSON:encode({ "one", "two", "three" }) -- produces the array -- ["one","two","three"] -- but now something with mixed key types like -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- instead of throwing an error produces an object: -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To maintain the prior throw-an-error semantics, set -- JSON.noKeyConversion = true -- -- 20131004.7 Release under a Creative Commons CC-BY license, which I should have done from day one, sorry. -- -- 20130120.6 Comment update: added a link to the specific page on my blog where this code can -- be found, so that folks who come across the code outside of my blog can find updates -- more easily. -- -- 20111207.5 Added support for the 'etc' arguments, for better error reporting. -- -- 20110731.4 More feedback from David Kolf on how to make the tests for Nan/Infinity system independent. -- -- 20110730.3 Incorporated feedback from David Kolf at http://lua-users.org/wiki/JsonModules: -- -- * When encoding lua for JSON, Sparse numeric arrays are now handled by -- spitting out full arrays, such that -- JSON:encode({"one", "two", [10] = "ten"}) -- returns -- ["one","two",null,null,null,null,null,null,null,"ten"] -- -- In 20100810.2 and earlier, only up to the first non-null value would have been retained. -- -- * When encoding lua for JSON, numeric value NaN gets spit out as null, and infinity as "1+e9999". -- Version 20100810.2 and earlier created invalid JSON in both cases. -- -- * Unicode surrogate pairs are now detected when decoding JSON. -- -- 20100810.2 added some checking to ensure that an invalid Unicode character couldn't leak in to the UTF-8 encoding -- -- 20100731.1 initial public release --
gpl-2.0
TheAnswer/FirstTest
bin/scripts/object/tangible/lair/hermit_spider/objects.lua
1
6126
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_tangible_lair_hermit_spider_shared_lair_hermit_spider = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/poi_all_lair_antpile_light.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 25, clientDataFile = "clientdata/client_shared_lair_small.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@lair_d:hermit_spider", gameObjectType = 4, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 64, objectName = "@lair_n:hermit_spider", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_lair_hermit_spider_shared_lair_hermit_spider, 3720772749) object_tangible_lair_hermit_spider_shared_lair_hermit_spider_mountain = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/poi_all_lair_antpile_light.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 25, clientDataFile = "clientdata/client_shared_lair_small.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@lair_d:hermit_spider_mountain", gameObjectType = 4, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 64, objectName = "@lair_n:hermit_spider_mountain", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_lair_hermit_spider_shared_lair_hermit_spider_mountain, 202240792) object_tangible_lair_hermit_spider_shared_lair_hermit_spider_wasteland = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/poi_all_lair_antpile_light.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 25, clientDataFile = "clientdata/client_shared_lair_small.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@lair_d:hermit_spider_wasteland", gameObjectType = 4, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 64, objectName = "@lair_n:hermit_spider_wasteland", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_lair_hermit_spider_shared_lair_hermit_spider_wasteland, 1727414364)
lgpl-3.0
phibon/squeeze-web-gui-lua
squeeze-web-gui/Strings-EN.lua
1
18821
-- EN Strings return { ['languages'] = { EN = "English", DE = "German", NL = "Dutch", }, ['index'] = { title = "Web Configuration", language = "Language", }, ['system'] = { title = "System Configuration", hostname = "Hostname", location = "Location", timezone = "Time Zone", locale = "Locale", samba = "Samba", nb_name = "Samba Name", nb_group = "Samba Workgroup", hostname_tip = "Hostname for your device", timezone_tip = "Select the timezone appropriate to your location", locale_tip = "Select the locale appropriate for your location", nb_name_tip = "Netbios name for samba file sharing", nb_group_tip = "Workgroup for Samba file sharing", version = "Version", os_version = "OS Version", fedora_version = "Fedora Version", context = "<ul><li>Use this page to set the configurations for the linux operating system running within your device.</li>" .. "<li><i><b>Hostname</b></i> sets the name for your device. This may be different from the name given to the player instance running on the device. You are likely to see this name from other devices on your network if they show names of machines on your network.</li>" .. "<li><i><b>Location</b></i> settings enable the timezone and language settings of the device to be set to your country.</li>" .. "<li><i><b>Samba</b></i> settings enable you to specify the settings for the local Windows file sharing server (Samba) within the device. This is used so you can access disks which are mounted on device from other machines on your network. Disks are mounted on the device using the Storage menu.</li></ul>", }, ['network'] = { title_eth = "Ethernet Interface Configuration", title_wlan = "Wireless Interface Configuration", interface = "Interface", state = "State", ipv4 = "IP Address", static = "Static", name = "Name", type = "Type", wpa_state = "Wpa State", dhcp = "Use DHCP", on_boot = "On Boot", add_private = "User Specified (below):", ipaddr = "IP Address", netmask= "Netmask", gateway= "Gateway", dns1 = "DNS1", dns2 = "DNS2", dns3 = "DNS3", domain = "Domain", essid = "Network Name", wpa_psk = "WPA Password", regdomain = "Location", int_down = "Interface Down", int_up = "Interface Up", int_downup = "Interface Down / Interface Up", none = "(none)", ipaddr_tip = "Enter static IP address", netmask_tip = "Enter network mask", gateway_tip = "Enter router address", dns1_tip = "Enter 1st DNS server address", dns2_tip = "Enter 2nd DNS server address (optional)", dns3_tip = "Enter 3rd DNS server address (optional)", domain_tip = "Enter DNS domain (optional)", essid_tip = "Select network SSID", other_ssid_tip = "Enter SSID if not found", wpa_psk_tip = "Enter WPA Password", regdomain_tip = "Enter location to select wireless region", on_boot_tip = "Enable this inteface at boot time", dhcp_tip = "Use DHCP to obtain IP address information", error_ipaddr0 = "Error setting IP Address", error_gateway0 = "Error setting Gateway", error_netmask0 = "Error setting Netmask", error_dns1 = "Error setting DNS1", error_dns2 = "Error setting DNS2", error_dns3 = "Error setting DNS3", error_static = "Error setting static address - IP Address, Netmask and Gateway required", context = "<ul><li>The current status of the interface is shown at the top of the page. If no IP address is shown then the interface is not working correctly.</li>" .. "<li><i><b>On&nbsp;Boot</b></i> defines if the interface is activated when your device starts. Ensure at least one of the interfaces has this set.</li>" .. "<li><i><b>DHCP</b></i> is normally selected to obtain IP addresing from your network. Clear it if you prefer to define static IP address information.</li>" .. "<li><i>Save</i> conifiguration changes and select <i>Interface&nbsp;Down&nbsp;/&nbsp;Interface&nbsp;Up</i> to restart the interface with new parameters.</li></ul>", context_wifi = "<ul><li>For wireless networks you can select which network to use from the list of detected <i>Network&nbsp;Names</i> or define your own if it is hidden. You should also specify a WPA Password. Note that WPA/WPA2 with a pre-shared key is the only authentication option supported by the configuration page.</li></ul>", AT = "Austria", AU = "Australia", BE = "Belgium", CA = "Canada", CH = "Switzerland", CN = "China", DE = "Germany", DK = "Denmark", ES = "Spain", FI = "Finland", FR = "France", GB = "Great Britain", HK = "Hong Kong", HU = "Hungary", JP = "Japan", IE = "Ireland", IL = "Israel", IN = "India", IT = "Italy", NL = "Netherlands", NO = "Norway", NZ = "New Zealand", PL = "Poland", PT = "Portugal", RS = "Serbia", RU = "Russian Federation", SE = "Sweden", US = "USA", ZA = "South Africa", ['00'] = "Roaming", }, ['squeezelite'] = { title = "Squeezelite Player Configuration and Control", name = "Name", audio_output = "Audio Output", mac = "MAC Address", device = "Audio Device", rate = "Sample Rates", logfile = "Log File", loglevel = "Log Level", priority = "RT Thread Priority", buffer = "Buffer", codec = "Codecs", alsa = "Alsa Params", resample = "Resample", dop = "DoP", vis = "Visualiser", other = "Other Options", server = "Server IP Address", advanced = "Advanced", bit_16 = "16 bit", bit_24 = "24 bit", bit_24_3 = "24_3 bit", bit_32 = "32 bit", mmap_off = "No MMAP", mmap_on = "MMAP", dop_supported = "Device supports DoP", name_tip = "Player name (optional)", device_tip = "Select output device", alsa_buffer_tip = "Alsa buffer size in ms or bytes (optional)", alsa_period_tip = "Alsa period count or size in bytes (optional)", alsa_format_tip = "Alsa sample format (optional)", alsa_mmap_tip = "Alsa MMAP support (optional)", rate_tip = "Max sample rate supported or comma separated list of sample rates (optional)", rate_delay_tip = "Delay when switching between sample rates in ms (optional)", dop_tip = "Enable DSD over PCM (DoP)", dop_delay_tip = "Delay when switching between PCM and DoP in ms (optional)", advanced_tip = "Show advanced options", resample_tip = "Enable resampling", vis_tip= "Enable Visualiser display in Jivelite", resample_recipe = "Soxr Recipe", resample_options = "Soxr Options", very_high = "Very High", high = "High", medium = "Medium", low = "Low", quick = "Quick", linear = "Linear Phase", intermediate = "Intermediate Phase", minimum = "Minimum Phase", steep = "Steep Filter", resample_options = "Soxr Options", flags = "Flags", attenuation = "Attenuation", precision = "Precision", pass_end = "Passband End", stop_start = "Stopband Start", phase = "Phase", async = "Asynchronous", exception = "By Exception", resample_quality_tip = "Resampling Quality (higher quality uses more processing power)", resample_filter_tip = "Resampling Filter type", resample_steep_tip = "Use Steep filter", resample_flags_tip = "Resampling flags (hexadecimal integer), advanced use only", resample_attenuation_tip = "Attenuation in dB to apply to avoid clipping (defaults to 1dB if not set)", resample_precision_tip = "Bits of precision, (HQ = 20, VHQ = 28)", resample_end_tip = "Passband end as percentage (Nyquist = 100%)", resample_start_tip = "Stopband start as percentage (must be greater than passband end)", resample_phase_tip = "Phase response (0 = minimum, 50 = linear, 100 = maximum)", resample_async_tip = "Resample asynchronously to maximum sample rate (otherwise resamples to max synchronous rate)", resample_exception_tip = "Resample only when desired sample rate is not supported by ouput device", info = "Info", debug = "Debug", trace = "Trace", loglevel_slimproto_tip = "Slimproto control session logging level", loglevel_stream_tip = "Streaming logging level", loglevel_decode_tip = "Decode logging level", loglevel_output_tip = "Output logging level", logfile_tip = "Write debug output to specified file", buffer_stream_tip = "Stream buffer size in Kbytes (optional)", buffer_output_tip = "Output buffer size in Kbytes (optional)", codec_tip = "Comma separated list of codecs to load (optional - loads all codecs if not set)", priority_tip = "RT thread priority (1-99) (optional)", mac_tip = "Player mac address, format: ab:cd:ef:12:34:56 (optional)", server_tip = "Server IP address (optional)", other_tip = "Other optional configuration parameters", error_alsa_buffer = "Error setting Alsa buffer", error_alsa_period = "Error setting Alsa period", error_rate = "Error setting sample rate", error_rate_delay = "Error setting sample rate change delay", error_dop_delay = "Error setting DoP delay", error_resample_precision = "Error setting ressample precision", error_resample_attenuation = "Error setting ressample attenuation", error_resample_start = "Error setting resample stopband start", error_resample_end = "Error setting resample stopband", error_resample_endstart = "Error setting resampling parameters - passband end should not overlap stopband start", error_resample_phase = "Error setting resample phase response", error_buffer_stream = "Error setting stream buffer size", error_buffer_output = "Error setting output buffer size", error_codec = "Error setting Codecs", error_priority = "Error setting RT Thread Priority", error_mac = "Error setting MAC Address", error_server = "Error settting Server", context = "<ul><li>The <i><b>Status</b></i> area at the top of the page shows the current Squeezelite pPlayer status and may be refreshed by pressing the <i>Refresh</i> button. The player will be reported as <i>active / running</i> if it is running correctly. If it fails to show this then check the configuration options and restart the player.</li>" .. "<li>Configuration options are specified in the fields to the left. Update each field and click <i>Save</i> to store them or <i>Save&nbsp;and&nbsp;Restart</i> to store them and then restart the player using the new options.</li>" .. "<li><i><b>Name</b></i> allows you to specify the player name. If you leave it blank, you can set it from within Squeezebox Server.</i>" .. "<li><i><b>Audio Device</b></i> specifies which audio output device to use and should always be set. You should normally prefer devices with names starting <i>hw:</i> to directly drive the hardware output device. If multiple devices are listed, try each device in turn and restart the player each time to find the correct device for your DAC.</li>" .. "<li><i><b>Alsa&nbsp;Params</b></i> allows you to set detailed linux audio output (Alsa) parameters and is not normally needed for your device to work. Adjust these options if the player status shows it is not running or to optimise audio playback if you experience audio drop outs. There are four parameters:" .. "<ul>" .. "<li>Alsa <i>buffer time</i> in ms, or <i>buffer size</i> in bytes; (default 40), set to a higher value if you experience drop outs.</li>" .. "<li>Alsa <i>period count</i> or <i>period size</i> in bytes; (default 4).</li>" .. "<li>Alsa <i>sample format</i> number of bits of data sent to Alsa for each sample - try 16 if other values do not work.</li>" .. "<li>Alsa <i>MMAP</i> enables or disables Alsa MMAP mode which reduces cpu load, try disabling if the player fails to start.</li>" .. "</ul>" .. "<li><i><b>Sample&nbsp;Rates</b></i> allows you to specify the sample rates supported by the device so that it does not need to be present when Squeezelite is started. Ether specify a single <i>maximum</i> sample rate, or specify all supported rates separated by commas. You may also specify a delay in ms to add when changing sample rates if you DAC requires this.</li>" .. "<li><i><b>Dop</b></i> enables you to select that your DAC supports DSP over PCM (DoP) playback. You may also specify a delay in ms when switching between PCM and DoP modes.</li></ul>", context_resample = "<p><ul><li><i><b>Resample</b></i> enables software resampling (upsampling) using the high quality SoX Resampler library. By default audio is upsampled to the maximum synchronous sample rate supported by the output device.</li>" .. "<li>Selecting <i><b>Asychronous</b></i> will always resample to the maximum output sample rate. Selecting <i><b>By Exception</b></i> will only resample when the output device does not support the sample rate of the track being played.</li>" .. "<li><i><b>Soxr&nbsp;Recipe</b></i> specifies the base Soxr recipe to be used:" .. "<ul><li><i>Quality</i> selects the quality of resampling. It is recommended that only <i>High</i> quality (the default) or <i>Very High</i> quality is used. Note that higher quality requires more cpu processing power and this increases with sample rate.</li>" .. "<li><i>Filter</i> selects the filter phase response to use." .. "<li><i>Steep</i> selects the whether to use a steep cutoff filter.</li></ul>".. "<li><i><b>Soxr&nbsp;Options</b></i> specifies advanced options which provided fine grain adjustment:".. "<ul><li><i>Flags</i> specifies Soxr option flags in hexadecimal (advanced users only).</li>".. "<li><i>Attenuation</i> specifies attenuation in dB to apply to avoid audio clipping during resampling (defaults to 1dB).</li>".. "<li><i>Passband End</i> specifies where the passband ends as percentage; 100 is the Nyquist frequency.</li>".. "<li><i>Stopband Start</i> specifies where the stopband starts as percentage; 100 is the Nyquist frequency.</li>".. "<li><i>Phase Response</i> specifies the filter phase between 0 and 100; 0 = Minimum phase recipe, 25 = Intermediate phase recipe and 50 = Linear phase recipe.</li>" .. "</ul>", context_advanced = "<p><ul><li><i><b>Advanced</b></i> shows additional options which you will normally not need to adjust. These include logging which is used to help debug problems.</li>" .. "<li>Adjust <i><b>Log&nbsp;Level</b></i> for each of the four logging categories to adjust the level of logging information written to the logfile and shown in the log window at the bottom of this page. Click in the log window to start and stop update of the log window.</li></ul>", }, ['squeezeserver'] = { title = "Squeeze Server Control", web_interface = "SqueezeServer Web Interface", context = "<ul><li>The <i><b>Status</b></i> area at the top of the page shows the current status of the local Squeezebox Server which can run on your device. It may be refreshed by pressing the <i>Refresh</i> button. The server can be <i>Enable</i>d, <i>Disable</i>d and <i>Restart</i>ed using the respective buttons. The server will be reported as <i>active / running</i> if it is running correctly.</li>" .. "<li>If you have already have a Squeezebox server running on a different machine, you do not need to enable this server.</li>" .. "<li>Use the <i>SqueezeServer&nbsp;Web&nbsp;Interface</i> button to open a web session to the local Squeezebox Server if it is running.</li></ul>", }, ['storage'] = { title = "Storage", mounts = "File Systems", localfs = "Local Disk", remotefs = "Network Share", disk = "Disk", network = "Network Share", user = "User", pass = "Password", domain = "Domain", mountpoint = "Mountpoint", type = "Type", options = "Options", add = "Add", remove = "Remove", unmount = "Unmount", remount = "Remount", active = "active", inactive = "inactive", mountpoint_tip = "Location where mount appears on device filesystem", disk_tip = "Disk to mount", network_tip = "Network share to mount", type_tip = "Type of disk/share being mounted", user_tip = "Username for CIFS mount", pass_tip = "Password for CIFS mount", domain_tip = "Domain for CIFS mount (optional)", options_tip = "Additional mount options", context = "<ul><li>Use this menu to attach (mount) local and remote disks to your device for use with the internal Squeezebox Server.</li>" .. "<li>The <i><b>Local&nbsp;Disk</b></i> section is used to attach local disks. Select one of the mountpoint options. This is the path where it will appear on the device file system. Select one of the disk options. You will not normally need to select the type of the disk as this is detected automatically from its format. Click <i>Add</i> to attach the disk to the device. If this is sucessful then an entry will appear in the <i>Mounted&nbsp;File&nbsp;Systems</i> area at the top of the page otherwise an error will be shown. If your disk has multiple partitions you may need to try each disk option in turn to find the correct one for your files.</li>" .. "<li>The <i><b>Network&nbsp;Share</b></i> section is used to attach network shares. Select one of the mountpoint options. Then add the network share location and select the type of network share. For Windows (Cifs) shares you will also be asked for a username, password and domain. You may not need to include all of these details. Click <i>Add</i> to attach the disk to the device. If this is successful then an entry will appear in the <i>Mounted&nbsp;File&nbsp;Systems</i> area at the top of the page otherwise an error will be shown.</li>" .. "<li>Mounted file systems will be re-attached when the device restarts if they are available. To disconnect them click the <i>Remove</i> button alongside the mount entry in the <i>Mounted&nbsp;File&nbsp;Systems</i> area.</li></ul>", }, ['shutdown'] = { title = "Shutdown: Reboot or Halt the device", control = "Control", halt = "Halt", halt_desc = "To halt device. Wait 30 seconds before removing power.", reboot = "Reboot", reboot_desc = "To reboot the device.", context = "<ul><li>Use this menu to reboot or shutdown (halt) your device.</li>" .. "<li>Please wait 30 seconds after halting the device before removing the power.</li></ul>", }, ['reboothalt'] = { halting = "Device shutting down - please wait 30 seconds before removing power", rebooting = "Device rebooting", }, ['faq'] = { title = "FAQ", }, ['resample'] = { title = "Resample", }, ['header'] = { home = "Home", system = "System", ethernet = "Ethernet Interface", wireless = "Wireless Interface", storage = "Storage", shutdown = "Shutdown", faq = "FAQ", help = "Help", squeezelite = "Squeezelite Player", squeezeserver = "Squeeze Server", }, ['footer'] = { copyright = "Copyright", version = "Version", }, ['base'] = { -- these are shared between all pages status = "Status", active = "Active", service = "Service", refresh = "Refresh", enable = "Enable", disable = "Disable", restart = "Restart", reset = "Reset", save = "Save", save_restart = "Save and Restart", configuration = "Configuration", options = "Options", help = "Help", }, }
gpl-3.0
Lunovox/minetest_nibirus_game
mods/add/lib_savevars/commands.lua
1
6980
minetest.register_chatcommand("set_global_value", { params = "<variavel> <valor>", description = "Grava uma variavel no mapa (Necessita de privilegio 'modsavevars').", privs = {savevars=true}, func = function(player, param) -- Returns (pos, true) if found, otherwise (pos, false) --variavel, valor = string.match(param, "^([^ ]+) +([^ ]+)") local variavel, valor = string.match(param, "([%a%d_]+) (.+)") if variavel~=nil and variavel~="" and valor~=nil and valor~="" then modsavevars.setGlobalValue(variavel, valor) minetest.chat_send_player(player, variavel.."='"..valor.."'") else minetest.chat_send_player(player, "SINTAXE: /set_global_value <variavel> <valor>") end return end, }) minetest.register_chatcommand("del_global_value", { params = "<variavel>", description = "Apaga uma variavel no mapa (Necessita de privilegio 'modsavevars').", privs = {savevars=true}, func = function(player, param) local variavel = string.match(param, "([%a%d_]+)") if variavel~=nil and variavel~="" then modsavevars.setGlobalValue(variavel, nil) minetest.chat_send_player(player, "Variavel '"..variavel.."' apagada!") else minetest.chat_send_player(player, "SINTAXE: /del_global_value <variavel>") end return end, }) minetest.register_chatcommand("get_global_value", { params = "<variavel>", description = "Exibe o valor de uma variavel do mapa (Necessita de privilegio 'modsavevars').", privs = {savevars=true}, func = function(player, param) local variavel = string.match(param, "([%a%d_]+)") if variavel~=nil and variavel~="" then local valor = modsavevars.getGlobalValue(variavel) if valor~=nil then minetest.chat_send_player(player, variavel.."="..dump(valor)) else minetest.chat_send_player(player, "Variavel '"..variavel.."' nao foi definida.") end else minetest.chat_send_player(player, "SINTAXE: /get_global_value <variavel>") end return end, }) minetest.register_chatcommand("set_char_value", { params = "<jogador> <variavel> <valor>", description = "Grava uma variavel no jogador indicado. (Necessita de privilegio 'modsavevars').", privs = {savevars=true}, func = function(player, param) -- Returns (pos, true) if found, otherwise (pos, false) --variavel, valor = string.match(param, "^([^ ]+) +([^ ]+)") local charName, variavel, valor = string.match(param, "([%a%d_]+) ([%a%d_]+) (.+)") if charName~=nil and charName~="" and variavel~=nil and variavel~="" and valor~=nil and valor~="" then modsavevars.setCharValue(charName, variavel, valor) minetest.chat_send_player(player, charName.."."..variavel.."='"..valor.."'") else minetest.chat_send_player(player, "SINTAXE: /set_char_value <jogador> <variavel> <valor>") end return end, }) minetest.register_chatcommand("del_char_value", { params = "<jogador> <variavel>", description = "Apaga uma variavel no jogador indicado. (Necessita de privilegio 'modsavevars').", privs = {savevars=true}, func = function(player, param) local charName, variavel = string.match(param, "([%a%d_]+) ([%a%d_]+)") if charName~=nil and charName~="" and variavel~=nil and variavel~="" then modsavevars.setCharValue(charName, variavel, nil) minetest.chat_send_player(player, charName.."."..variavel.."=nil") else minetest.chat_send_player(player, "SINTAXE: /del_char_value <jogador> <variavel>") end return end, }) minetest.register_chatcommand("get_char_value", { params = "<jogador> <variavel>", description = "Exibe o valor de uma variavel no jogador indicado. (Necessita de privilegio 'modsavevars').", privs = {savevars=true}, func = function(player, param) local charName, variavel = string.match(param, "([%a%d_]+) ([%a%d_]+)") if charName~=nil and charName~="" and variavel~=nil and variavel~="" then local valor = modsavevars.getCharValue(charName, variavel) if valor~=nil then minetest.chat_send_player(player, charName.."."..variavel.."="..dump(valor)) else minetest.chat_send_player(player, "Variavel '"..charName.."."..variavel.."' nao foi definida.") end else minetest.chat_send_player(player, "SINTAXE: /get_char_value <jogador> <variavel>") end return end, }) minetest.register_chatcommand("lib_savevars", { params = "", description = "Exibe todos os comando deste mod", privs = {}, func = function(playername, param) minetest.chat_send_player(playername, " ", false) minetest.chat_send_player(playername, "############################################################################################", false) minetest.chat_send_player(playername, "### LIB_SAVEVARS (TELA DE AJUDA DESTE MODING) ###", false) minetest.chat_send_player(playername, "### Desenvolvedor:'Lunovox Heavenfinder'<rui.gravata@gmail.com> ###", false) minetest.chat_send_player(playername, "############################################################################################", false) minetest.chat_send_player(playername, "FUNCAO:", false) minetest.chat_send_player(playername, " * Habilita funcao de salvar e ler variaveis globais e pessoais em arquivo,", false) minetest.chat_send_player(playername, " que podem ser usadas diretamente pelo jogador administrador, ou por outros mods.", false) minetest.chat_send_player(playername, "SINTAXE:", false) minetest.chat_send_player(playername, " * /set_global_value <variavel> <valor>", false) minetest.chat_send_player(playername, " -> Grava uma variavel global no mapa (Necessita de privilegio 'server').", false) minetest.chat_send_player(playername, " * /get_global_value <variavel>", false) minetest.chat_send_player(playername, " -> Exibe uma variavel global na tela (Necessita de privilegio 'server').", false) minetest.chat_send_player(playername, " * /del_global_value <variavel>", false) minetest.chat_send_player(playername, " -> Apaga uma variavel global no mapa (Necessita de privilegio 'server').", false) minetest.chat_send_player(playername, " * /set_char_value <jogador> <variavel> <valor>", false) minetest.chat_send_player(playername, " -> Grava uma variavel de jogador no mapa (Necessita de privilegio 'server').", false) minetest.chat_send_player(playername, " * /get_char_value <jogador> <variavel>", false) minetest.chat_send_player(playername, " -> Exibe uma variavel de jogador na tela (Necessita de privilegio 'server').", false) minetest.chat_send_player(playername, " * /del_char_value <jogador> <variavel>", false) minetest.chat_send_player(playername, " -> Apaga uma variavel de jogador no mapa (Necessita de privilegio 'server').", false) minetest.chat_send_player(playername, "############################################################################################", false) minetest.chat_send_player(playername, playername..", precione F10 e use a rolagem do mouse para ler todo este tutorial!!!", false) end, })
agpl-3.0
TheAnswer/FirstTest
bin/scripts/object/tangible/fishing/bait/objects.lua
1
7122
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_tangible_fishing_bait_shared_bait_chum = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/edb_con_tato_jar_guts_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:fishing_bait", gameObjectType = 8215, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:fishing_bait_chum", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_fishing_bait_shared_bait_chum, 1907354318) object_tangible_fishing_bait_shared_bait_grub = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/edb_con_tato_jar_funk_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:fishing_bait", gameObjectType = 8215, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:fishing_bait_grub", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_fishing_bait_shared_bait_grub, 2852582475) object_tangible_fishing_bait_shared_bait_insect = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/edb_con_tato_jar_bugs_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:fishing_bait", gameObjectType = 8215, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:fishing_bait_insect", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_fishing_bait_shared_bait_insect, 574609963) object_tangible_fishing_bait_shared_bait_worm = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/edb_con_tato_jar_funk_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:fishing_bait", gameObjectType = 8215, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:fishing_bait_worm", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_fishing_bait_shared_bait_worm, 529269810)
lgpl-3.0
infernall/nevermind
plugins/banhammer.lua
1085
11557
local function pre_process(msg) -- SERVICE MESSAGE if msg.action and msg.action.type then local action = msg.action.type -- Check if banned user joins chat by link if action == 'chat_add_user_link' then local user_id = msg.from.id print('Checking invited user '..user_id) local banned = is_banned(user_id, msg.to.id) if banned or is_gbanned(user_id) then -- Check it with redis print('User is banned!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] is banned and kicked ! ")-- Save to logs kick_user(user_id, msg.to.id) end end -- Check if banned user joins chat if action == 'chat_add_user' then local user_id = msg.action.user.id print('Checking invited user '..user_id) local banned = is_banned(user_id, msg.to.id) if banned or is_gbanned(user_id) then -- Check it with redis print('User is banned!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] added a banned user >"..msg.action.user.id)-- Save to logs kick_user(user_id, msg.to.id) local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id redis:incr(banhash) local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id local banaddredis = redis:get(banhash) if banaddredis then if tonumber(banaddredis) == 4 and not is_owner(msg) then kick_user(msg.from.id, msg.to.id)-- Kick user who adds ban ppl more than 3 times end if tonumber(banaddredis) == 8 and not is_owner(msg) then ban_user(msg.from.id, msg.to.id)-- Kick user who adds ban ppl more than 7 times local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id redis:set(banhash, 0)-- Reset the Counter end end end if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['settings'] then if data[tostring(msg.to.id)]['settings']['lock_bots'] then bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots'] end end end if msg.action.user.username ~= nil then if string.sub(msg.action.user.username:lower(), -3) == 'bot' and not is_momod(msg) and bots_protection == "yes" then --- Will kick bots added by normal users local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] added a bot > @".. msg.action.user.username)-- Save to logs kick_user(msg.action.user.id, msg.to.id) end end end -- No further checks return msg end -- banned user is talking ! if msg.to.type == 'chat' then local data = load_data(_config.moderation.data) local group = msg.to.id local texttext = 'groups' --if not data[tostring(texttext)][tostring(msg.to.id)] and not is_realm(msg) then -- Check if this group is one of my groups or not --chat_del_user('chat#id'..msg.to.id,'user#id'..our_id,ok_cb,false) --return --end local user_id = msg.from.id local chat_id = msg.to.id local banned = is_banned(user_id, chat_id) if banned or is_gbanned(user_id) then -- Check it with redis print('Banned user talking!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] banned user is talking !")-- Save to logs kick_user(user_id, chat_id) msg.text = '' end end return msg end local function kick_ban_res(extra, success, result) --vardump(result) --vardump(extra) local member_id = result.id local user_id = member_id local member = result.username local chat_id = extra.chat_id local from_id = extra.from_id local get_cmd = extra.get_cmd local receiver = "chat#id"..chat_id if get_cmd == "kick" then if member_id == from_id then return send_large_msg(receiver, "You can't kick yourself") end if is_momod2(member_id, chat_id) and not is_admin2(sender) then return send_large_msg(receiver, "You can't kick mods/owner/admins") end return kick_user(member_id, chat_id) elseif get_cmd == 'ban' then if is_momod2(member_id, chat_id) and not is_admin2(sender) then return send_large_msg(receiver, "You can't ban mods/owner/admins") end send_large_msg(receiver, 'User @'..member..' ['..member_id..'] banned') return ban_user(member_id, chat_id) elseif get_cmd == 'unban' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] unbanned') local hash = 'banned:'..chat_id redis:srem(hash, member_id) return 'User '..user_id..' unbanned' elseif get_cmd == 'banall' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] globally banned') return banall_user(member_id, chat_id) elseif get_cmd == 'unbanall' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] un-globally banned') return unbanall_user(member_id, chat_id) end end local function run(msg, matches) if matches[1]:lower() == 'id' then if msg.to.type == "user" then return "Bot ID: "..msg.to.id.. "\n\nYour ID: "..msg.from.id end if type(msg.reply_id) ~= "nil" then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ") id = get_message(msg.reply_id,get_message_callback_id, false) elseif matches[1]:lower() == 'id' then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ") return "Group ID for " ..string.gsub(msg.to.print_name, "_", " ").. ":\n\n"..msg.to.id end end if matches[1]:lower() == 'kickme' then-- /kickme local receiver = get_receiver(msg) if msg.to.type == 'chat' then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] left using kickme ")-- Save to logs chat_del_user("chat#id"..msg.to.id, "user#id"..msg.from.id, ok_cb, false) end end if not is_momod(msg) then -- Ignore normal users return end if matches[1]:lower() == "banlist" then -- Ban list ! local chat_id = msg.to.id if matches[2] and is_admin(msg) then chat_id = matches[2] end return ban_list(chat_id) end if matches[1]:lower() == 'ban' then-- /ban if type(msg.reply_id)~="nil" and is_momod(msg) then if is_admin(msg) then local msgr = get_message(msg.reply_id,ban_by_reply_admins, false) else msgr = get_message(msg.reply_id,ban_by_reply, false) end end local user_id = matches[2] local chat_id = msg.to.id if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return end if not is_admin(msg) and is_momod2(matches[2], msg.to.id) then return "you can't ban mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't ban your self !" end local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] baned user ".. matches[2]) ban_user(user_id, chat_id) else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'ban', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == 'unban' then -- /unban if type(msg.reply_id)~="nil" and is_momod(msg) then local msgr = get_message(msg.reply_id,unban_by_reply, false) end local user_id = matches[2] local chat_id = msg.to.id local targetuser = matches[2] if string.match(targetuser, '^%d+$') then local user_id = targetuser local hash = 'banned:'..chat_id redis:srem(hash, user_id) local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] unbaned user ".. matches[2]) return 'User '..user_id..' unbanned' else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'unban', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == 'kick' then if type(msg.reply_id)~="nil" and is_momod(msg) then if is_admin(msg) then local msgr = get_message(msg.reply_id,Kick_by_reply_admins, false) else msgr = get_message(msg.reply_id,Kick_by_reply, false) end end if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return end if not is_admin(msg) and is_momod2(matches[2], msg.to.id) then return "you can't kick mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't kick your self !" end local user_id = matches[2] local chat_id = msg.to.id name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] kicked user ".. matches[2]) kick_user(user_id, chat_id) else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'kick', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if not is_admin(msg) then return end if matches[1]:lower() == 'banall' then -- Global ban if type(msg.reply_id) ~="nil" and is_admin(msg) then return get_message(msg.reply_id,banall_by_reply, false) end local user_id = matches[2] local chat_id = msg.to.id local targetuser = matches[2] if string.match(targetuser, '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return false end banall_user(targetuser) return 'User ['..user_id..' ] globally banned' else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'banall', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == 'unbanall' then -- Global unban local user_id = matches[2] local chat_id = msg.to.id if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return false end unbanall_user(user_id) return 'User ['..user_id..' ] removed from global ban list' else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'unbanall', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == "gbanlist" then -- Global ban list return banall_list() end end return { patterns = { "^[!/]([Bb]anall) (.*)$", "^[!/]([Bb]anall)$", "^[!/]([Bb]anlist) (.*)$", "^[!/]([Bb]anlist)$", "^[!/]([Gg]banlist)$", "^[!/]([Bb]an) (.*)$", "^[!/]([Kk]ick)$", "^[!/]([Uu]nban) (.*)$", "^[!/]([Uu]nbanall) (.*)$", "^[!/]([Uu]nbanall)$", "^[!/]([Kk]ick) (.*)$", "^[!/]([Kk]ickme)$", "^[!/]([Bb]an)$", "^[!/]([Uu]nban)$", "^[!/]([Ii]d)$", "^!!tgservice (.+)$" }, run = run, pre_process = pre_process }
gpl-2.0
Mohammadrezar/telediamond
plugins/lock_edit.lua
3
2157
do function promote(receiver, member_username, user_id) local data = load_data(_config.moderation.data) local group = string.gsub(receiver, 'channel#id', '') local member_tag_username = string.gsub(member_username, '@', '(at)') if not data[group] then return end if data[group]['moderators'][tostring(user_id)] then return end data[group]['moderators'][tostring(user_id)] = member_tag_username save_data(_config.moderation.data, data) end function lock_edit(msg) if not is_momod(msg) then return end if redis:get("lock:edit:"..msg.to.id) then return '》Edit is already locked\n》ویرایش پیام هم اکنون ممنوع است.' else promote(msg.to.id,"@edit_locker_bot",240486291) channel_invite(get_receiver(msg),"user#id240486291",ok_cb,false) redis:set("lock:edit:"..msg.to.id,true) return '》Edit locked\n》ویرایش پیام ممنوع شد.' end end function unlock_edit(msg) if not is_momod(msg) then return end if not redis:get("lock:edit:"..msg.to.id) then return '》Edit is not locked\n》ویرایش پیام مجاز بود .' else redis:del("lock:edit:"..msg.to.id) return '》Edit unlocked\n》ویرایش پیام مجاز شد.' end end function pre_process(msg) if msg.from.id == 240486291 then if redis:get("lock:edit:"..msg.to.id) then if is_momod2(tonumber(msg.text),msg.to.id) then delete_msg(msg.id,ok_cb,false) else delete_msg(msg.id,ok_cb,false) delete_msg(msg.reply_id,ok_cb,false) end else delete_msg(msg.id,ok_cb,false) end end return msg end function run(msg,matches) if matches[2] == "edit" and is_momod(msg) then if matches[1] == "lock" then if msg.to.type == "channel" then return lock_edit(msg) else return "Only in SuperGroups" end elseif matches[1] == "unlock" then if msg.to.type == "channel" then return unlock_edit(msg) else return "Only in SuperGroups" end end end end return { patterns = { "^[!/#](lock) (edit)$", "^[!/#](unlock) (edit)$" }, run = run, pre_process = pre_process } end
agpl-3.0
JarnoVgr/ZombieSurvival
gamemodes/zombiesurvival/entities/weapons/weapon_zs_megamasher.lua
1
3060
AddCSLuaFile() if CLIENT then SWEP.PrintName = "Mega Masher" SWEP.ViewModelFOV = 75 SWEP.VElements = { ["base2"] = { type = "Model", model = "models/props_wasteland/buoy01.mdl", bone = "ValveBiped.Bip01", rel = "base", pos = Vector(12, 0, 0), angle = Angle(0, 90, 270), size = Vector(0.2, 0.2, 0.2), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["base"] = { type = "Model", model = "models/props_junk/iBeam01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(12.706, 2.761, -22), angle = Angle(13, -12.5, 0), size = Vector(0.15, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["base3"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01", rel = "base", pos = Vector(-5, 0, 0), angle = Angle(0, 270, 90), size = Vector(0.4, 0.4, 0.4), color = Color(255, 0, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } SWEP.WElements = { ["base2"] = { type = "Model", model = "models/props_wasteland/buoy01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(12, 0, 0), angle = Angle(90, 0, 90), size = Vector(0.2, 0.2, 0.2), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["base"] = { type = "Model", model = "models/props_junk/iBeam01a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(10, 1, -35), angle = Angle(0, 0, 0), size = Vector(0.15, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["base3"] = { type = "Model", model = "models/props_borealis/bluebarrel001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "base", pos = Vector(-5, 0, 0), angle = Angle(90, 0, 90), size = Vector(0.4, 0.4, 0.4), color = Color(255, 0, 0, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } end SWEP.Base = "weapon_zs_basemelee" SWEP.HoldType = "melee2" SWEP.DamageType = DMG_CLUB SWEP.ViewModel = "models/weapons/v_sledgehammer/v_sledgehammer.mdl" SWEP.WorldModel = "models/weapons/w_sledgehammer.mdl" SWEP.MeleeDamage = 190 SWEP.MeleeRange = 75 SWEP.MeleeSize = 4 SWEP.MeleeKnockBack = SWEP.MeleeDamage * 2 SWEP.Primary.Delay = 2.25 SWEP.WalkSpeed = SPEED_SLOWEST * 0.7 SWEP.SwingRotation = Angle(60, 0, -80) SWEP.SwingOffset = Vector(0, -30, 0) SWEP.SwingTime = 1.33 SWEP.SwingHoldType = "melee" function SWEP:PlaySwingSound() self:EmitSound("weapons/iceaxe/iceaxe_swing1.wav", 75, math.random(20, 25)) end function SWEP:PlayHitSound() self:EmitSound("vehicles/v8/vehicle_impact_heavy"..math.random(4)..".wav", 80, math.Rand(95, 105)) end function SWEP:PlayHitFleshSound() self:EmitSound("physics/flesh/flesh_bloody_break.wav", 80, math.Rand(90, 100)) end function SWEP:OnMeleeHit(hitent, hitflesh, tr) local effectdata = EffectData() effectdata:SetOrigin(tr.HitPos) effectdata:SetNormal(tr.HitNormal) util.Effect("explosion", effectdata) end
gpl-2.0
TheAnswer/FirstTest
bin/scripts/skills/creatureSkills/endor/npcs/gundulaAttacks.lua
1
2838
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. gundulaAttack1 = { attackname = "gundulaAttack1", animation = "creature_attack_light", requiredWeaponType = NONE, range = 10, damageRatio = 1.2, speedRatio = 4, areaRange = 0, accuracyBonus = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(gundulaAttack1) ---------------------------------------------------------------------------------------
lgpl-3.0
chrisdugne/ludum-dare-36
src/components/Scroller.lua
1
9057
-------------------------------------------------------------------------------- -- DOC to desc -- vertical scroller -- can insert on the fly -- handle resize/visibility -- handle listening -- install src.component -- install assets -------------------------------------------------------------------------------- --- todo : -- remove child -- test button home to insert profile on the fly local Scroller = { children = {} } -------------------------------------------------------------------------------- local widget = widget or require( 'widget' ) local defaultGap = 0 local IDLE = 0 local RESET = 1 local THRESHOLD = 10 -------------------------------------------------------------------------------- -- API -------------------------------------------------------------------------------- function Scroller:new(options) self.options = options self:reset() self:prepareScrollView() self:scrollbarBase() self:scrollbarHandle() return self end -------------------------------------------------------------------------------- function Scroller:destroy() self:removeAll() display.remove(self.scrollView) display.remove(self.scrollbar) end -------------------------------------------------------------------------------- function Scroller:reset() self.handleWatcher = IDLE self.scrolling = false self.children = {} self.options.gap = self.options.gap or defaultGap end -------------------------------------------------------------------------------- function Scroller:insert(child) child.x = self.options.width/2 child.y = self:contentHeight() + child.height/2 + self.options.gap self.children[#self.children + 1] = child self.scrollView:insert(child) self:refreshHandle() self:refreshContentHeight() return child end function Scroller:remove(child) local index = 1 for k,c in pairs(self.children) do if(self.children[k] == child) then break end index = index + 1 end table.remove(self.children, index) self:refreshHandle() self:refreshContentHeight() display.remove(child) return child end function Scroller:removeAll() self.scrollView._view.y = 0 local n = #self.children for i=1, n do self:remove(self.children[1]) end end -------------------------------------------------------------------------------- function Scroller:hideScrollbar() self.scrollbar.base.alpha = 0 self.scrollbar.handle.alpha = 0 end function Scroller:showScrollbar() self.scrollbar.base.alpha = 1 self.scrollbar.handle.alpha = 1 end -------------------------------------------------------------------------------- -- Display elements -------------------------------------------------------------------------------- function Scroller:prepareScrollView() self.scrollView = widget.newScrollView({ top = self.options.top, left = self.options.left, width = self.options.width, height = self.options.height, scrollWidth = 0, scrollHeight = 0, horizontalScrollDisabled = self.options.horizontalScrollDisabled, hideBackground = self.options.hideBackground, hideScrollBar = true, listener = function(event) self:listen(event) end }) self.currentScrollHeight = 0 self.currentScrollWidth = 0 self.options.parent:insert(self.scrollView) end -------------------------------------------------------------------------------- function Scroller:scrollbarBase() self.scrollbar = display.newGroup() self.scrollbar.x = self.options.left + self.options.width self.scrollbar.y = self.options.top self.options.parent:insert(self.scrollbar) self.scrollbar.base = display.newImageRect( self.scrollbar, 'assets/images/gui/scroller/scroll.base.png', 20, self.options.height*0.8 ) self.scrollbar.base.x = 0 self.scrollbar.base.y = self.options.height*0.5 end -------------------------------------------------------------------------------- function Scroller:scrollbarHandle() self.scrollbar.handle = display.newImageRect( self.scrollbar, 'assets/images/gui/scroller/scroll.handle.png', 20, 0 ) self:refreshHandle() end function Scroller:refreshHandle() local totalHeight = self:contentHeight() local height = 0 if(totalHeight == 0) then self:hideScrollbar() return end -- the handle height may be fixed as option.handleHeight if(self.options.handleHeight) then height = self.options.handleHeight self:showScrollbar() else local ratio = self.options.height/totalHeight height = self.scrollbar.base.height * ratio if(ratio > 1) then self:hideScrollbar() else self:showScrollbar() end end self.scrollbar.handle.height = height self.scrollbar.handle.min = self.scrollbar.base.y - self.scrollbar.base.height*0.5 + height*0.5 self.scrollbar.handle.max = self.scrollbar.handle.min + self.scrollbar.base.height - height self.scrollbar.handle.x = 0 self.scrollbar.handle.y = self.scrollbar.handle.min end -------------------------------------------------------------------------------- -- Refreshing the scrollbar height depending on the content -------------------------------------------------------------------------------- function Scroller:refreshContentHeight() self.currentScrollHeight = self:contentHeight() self.scrollView:setScrollHeight(self.currentScrollHeight) self:setRatio() end function Scroller:contentHeight() local height = 0 for k,child in pairs(self.children) do height = height + child.height + self.options.gap end return height end -------------------------------------------------------------------------------- -- Handle positioning -------------------------------------------------------------------------------- function Scroller:setRatio() if(self.scrollbar.handle.max) then local scrollbarHeight = self.scrollbar.handle.max - self.scrollbar.handle.min local scrollableHeight = self.currentScrollHeight - self.options.height self.scrollableRatio = scrollbarHeight/scrollableHeight end end -------------------------------------------------------------------------------- function Scroller:syncHandlePosition() -- sync is cancelled if the scrollview was destroyed local destroyed = self.scrollView._view.y == nil if(destroyed) then self:unbind() self:reset() return end self.scrollbar.handle.y = - self.scrollView._view.y * self.scrollableRatio + self.scrollbar.handle.min if(self.scrollbar.handle.y > self.scrollbar.handle.max) then self.scrollbar.handle.y = self.scrollbar.handle.max end if(self.scrollbar.handle.y < self.scrollbar.handle.min) then self.scrollbar.handle.y = self.scrollbar.handle.min end end -------------------------------------------------------------------------------- function Scroller:bind(event) local alreadyBound = self.handleWatcher and (self.handleWatcher ~= IDLE) if(alreadyBound) then return end self.handleWatcher = RESET local watch = function(event) self:syncHandlePosition() local handleHasMoved = self.previousHandleY ~= self.scrollbar.handle.y self.previousHandleY = self.scrollbar.handle.y if( handleHasMoved ) then self.handleWatcher = RESET else if((not self.scrolling) and (self.handleWatcher > THRESHOLD) ) then self:unbind() else self.handleWatcher = self.handleWatcher + 1 end end end Runtime:addEventListener( 'enterFrame', watch ) return function () self.handleWatcher = IDLE Runtime:removeEventListener( 'enterFrame', watch ) end end function Scroller:unbind () self._unbind() end function Scroller:setUnbind (_unbind) self._unbind = _unbind end -------------------------------------------------------------------------------- function Scroller:listen(event) if ( event.phase == 'began' ) then self.scrolling = true local _unbind = self:bind() if(_unbind) then self:setUnbind(_unbind) end elseif ( event.phase == 'ended' ) then self.scrolling = false -- https://github.com/chrisdugne/phantoms/issues/37 -- if(self.onBottomReached) then -- self.onBottomReached() -- end end return true end -------------------------------------------------------------------------------- return Scroller
bsd-3-clause
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/tailor/casualWearIiSynthetics/tightJacket.lua
1
4343
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. tightJacket = Object:new { objectName = "Tight Jacket", stfName = "jacket_s19", stfFile = "wearables_name", objectCRC = 182134257, groupName = "craftClothingCasualGroupB", -- Group schematic is awarded in (See skills table) craftingToolTab = 8, -- (See DraftSchemticImplementation.h) complexity = 18, size = 3, xpType = "crafting_clothing_general", xp = 130, assemblySkill = "clothing_assembly", experimentingSkill = "clothing_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "binding_and_hardware, liner, shell", ingredientSlotType = "0, 0, 2", resourceTypes = "petrochem_inert, hide, object/tangible/component/clothing/shared_synthetic_cloth.iff", resourceQuantities = "30, 25, 1", combineTypes = "0, 0, 1", contribution = "100, 100, 100", numberExperimentalProperties = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalProperties = "XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX", experimentalWeights = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalGroupTitles = "null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null", experimentalSubGroupTitles = "null, null, sockets, hitpoints, mod_idx_one, mod_val_one, mod_idx_two, mod_val_two, mod_idx_three, mod_val_three, mod_idx_four, mod_val_four, mod_idx_five, mod_val_five, mod_idx_six, mod_val_six", experimentalMin = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", experimentalMax = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", experimentalPrecision = "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", tanoAttributes = "objecttype=16777227:objectcrc=3440438497:stfFile=wearables_name:stfName=jacket_s19:stfDetail=:itemmask=62975::", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "/private/index_color_1, /private/index_color_2", customizationDefaults = "73, 2", customizationSkill = "clothing_customization" } DraftSchematics:addDraftSchematic(tightJacket, 182134257)--- Add to global DraftSchematics table
lgpl-3.0
muhkuh-sys/org.muhkuh.tools-flasher
lua/erase_first_flash_sector.lua
1
1717
require("muhkuh_cli_init") require("flasher") tPlugin = tester.getCommonPlugin() if not tPlugin then error("No plugin selected, nothing to do!") end -- Download the binary. local aAttr = flasher.download(tPlugin, "netx/", tester.progress) -- Use SPI Flash CS0. local fOk = flasher.detect(tPlugin, aAttr, flasher.BUS_Spi, 0, 0) if not fOk then error("Failed to get a device description!") end -- Get the erase area for the range 0 .. 1. ulEraseStart, ulEraseEnd = flasher.getEraseArea(tPlugin, aAttr, 0, 1) if not ulEraseStart then error("Failed to get erase areas!") end print(string.format("The first erase area is: 0x%08x-0x%08x", ulEraseStart, ulEraseEnd)) -- Check if the erase area is already clear. local fIsErased print(string.format("Is area 0x%08x-0x%08x already erased?", ulEraseStart, ulEraseEnd)) fIsErased = flasher.isErased(tPlugin, aAttr, ulEraseStart, ulEraseEnd) if fIsErased==nil then error("failed to check the area!") end if fIsErased==true then print("The area is already erased.") else print("The area is not erased. Erasing it now...") local fIsOk = flasher.erase(tPlugin, aAttr, ulEraseStart, ulEraseEnd) if not fIsOk then error("Failed to erase the area!") end print("Erase finished!") fIsErased = flasher.isErased(tPlugin, aAttr, ulEraseStart, ulEraseEnd) if not fIsErased then error("No error reported, but the area is not erased!") end print("The first erase area is clear now!") end print("") print(" ####### ## ## ") print("## ## ## ## ") print("## ## ## ## ") print("## ## ##### ") print("## ## ## ## ") print("## ## ## ## ") print(" ####### ## ## ") print("") -- Disconnect the plugin. tester.closeCommonPlugin()
gpl-2.0
Xeltor/ovale
dist/scripts/ovale_mage.lua
1
152030
local __exports = LibStub:NewLibrary("ovale/scripts/ovale_mage", 80300) if not __exports then return end __exports.registerMage = function(OvaleScripts) do local name = "sc_t24_mage_arcane" local desc = "[8.3] Simulationcraft: T24_Mage_Arcane" local code = [[ # Based on SimulationCraft profile "T24_Mage_Arcane". # class=mage # spec=arcane # talents=2032021 Include(ovale_common) Include(ovale_trinkets_mop) Include(ovale_trinkets_wod) Include(ovale_mage_spells) AddFunction average_burn_length { { 0 * total_burns() - 0 + getstateduration() } / total_burns() } AddFunction total_burns { if not getstate(burn_phase) > 0 1 } AddFunction font_of_power_precombat_channel { if font_double_on_use() and 0 == 0 12 } AddFunction font_double_on_use { hasequippeditem(azsharas_font_of_power_item) and { hasequippeditem(gladiators_badge) or hasequippeditem(gladiators_medallion_item) or hasequippeditem(ignition_mages_fuse_item) or hasequippeditem(tzanes_barkspines_item) or hasequippeditem(azurethos_singed_plumage_item) or hasequippeditem(ancient_knot_of_wisdom_item) or hasequippeditem(shockbiters_fang_item) or hasequippeditem(neural_synapse_enhancer_item) or hasequippeditem(balefire_branch_item) } } AddFunction conserve_mana { 60 + 20 * hasazeritetrait(equipoise_trait) } AddCheckBox(opt_interrupt l(interrupt) default specialization=arcane) AddCheckBox(opt_use_consumables l(opt_use_consumables) default specialization=arcane) AddCheckBox(opt_arcane_mage_burn_phase l(arcane_mage_burn_phase) default specialization=arcane) AddCheckBox(opt_blink spellname(blink) specialization=arcane) AddFunction arcaneinterruptactions { if checkboxon(opt_interrupt) and not target.isfriend() and target.casting() { if target.inrange(counterspell) and target.isinterruptible() spell(counterspell) if target.inrange(quaking_palm) and not target.classification(worldboss) spell(quaking_palm) } } AddFunction arcaneuseitemactions { item(trinket0slot text=13 usable=1) item(trinket1slot text=14 usable=1) } ### actions.precombat AddFunction arcaneprecombatmainactions { #flask #food #augmentation #arcane_intellect spell(arcane_intellect) #arcane_familiar spell(arcane_familiar) #arcane_blast if mana() > manacost(arcane_blast) spell(arcane_blast) } AddFunction arcaneprecombatmainpostconditions { } AddFunction arcaneprecombatshortcdactions { } AddFunction arcaneprecombatshortcdpostconditions { spell(arcane_intellect) or spell(arcane_familiar) or mana() > manacost(arcane_blast) and spell(arcane_blast) } AddFunction arcaneprecombatcdactions { unless spell(arcane_intellect) or spell(arcane_familiar) { #variable,name=conserve_mana,op=set,value=60+20*azerite.equipoise.enabled #variable,name=font_double_on_use,op=set,value=equipped.azsharas_font_of_power&(equipped.gladiators_badge|equipped.gladiators_medallion|equipped.ignition_mages_fuse|equipped.tzanes_barkspines|equipped.azurethos_singed_plumage|equipped.ancient_knot_of_wisdom|equipped.shockbiters_fang|equipped.neural_synapse_enhancer|equipped.balefire_branch) #variable,name=font_of_power_precombat_channel,op=set,value=12,if=variable.font_double_on_use&variable.font_of_power_precombat_channel=0 #snapshot_stats #use_item,name=azsharas_font_of_power arcaneuseitemactions() #mirror_image spell(mirror_image) #potion if checkboxon(opt_use_consumables) and target.classification(worldboss) item(focused_resolve_item usable=1) } } AddFunction arcaneprecombatcdpostconditions { spell(arcane_intellect) or spell(arcane_familiar) or mana() > manacost(arcane_blast) and spell(arcane_blast) } ### actions.movement AddFunction arcanemovementmainactions { #arcane_missiles spell(arcane_missiles) #supernova spell(supernova) } AddFunction arcanemovementmainpostconditions { } AddFunction arcanemovementshortcdactions { #blink_any,if=movement.distance>=10 if target.distance() >= 10 and checkboxon(opt_blink) spell(blink) #presence_of_mind spell(presence_of_mind) unless spell(arcane_missiles) { #arcane_orb spell(arcane_orb) } } AddFunction arcanemovementshortcdpostconditions { spell(arcane_missiles) or spell(supernova) } AddFunction arcanemovementcdactions { } AddFunction arcanemovementcdpostconditions { target.distance() >= 10 and checkboxon(opt_blink) and spell(blink) or spell(presence_of_mind) or spell(arcane_missiles) or spell(arcane_orb) or spell(supernova) } ### actions.essences AddFunction arcaneessencesmainactions { #concentrated_flame,line_cd=6,if=buff.rune_of_power.down&buff.arcane_power.down&(!burn_phase|time_to_die<cooldown.arcane_power.remains)&mana.time_to_max>=execute_time if timesincepreviousspell(concentrated_flame_essence) > 6 and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and { not getstate(burn_phase) > 0 or target.timetodie() < spellcooldown(arcane_power) } and timetomaxmana() >= executetime(concentrated_flame_essence) spell(concentrated_flame_essence) } AddFunction arcaneessencesmainpostconditions { } AddFunction arcaneessencesshortcdactions { unless timesincepreviousspell(concentrated_flame_essence) > 6 and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and { not getstate(burn_phase) > 0 or target.timetodie() < spellcooldown(arcane_power) } and timetomaxmana() >= executetime(concentrated_flame_essence) and spell(concentrated_flame_essence) { #reaping_flames,if=buff.rune_of_power.down&buff.arcane_power.down&(!burn_phase|time_to_die<cooldown.arcane_power.remains)&mana.time_to_max>=execute_time if buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and { not getstate(burn_phase) > 0 or target.timetodie() < spellcooldown(arcane_power) } and timetomaxmana() >= executetime(reaping_flames) spell(reaping_flames) #purifying_blast,if=buff.rune_of_power.down&buff.arcane_power.down if buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) spell(purifying_blast) #ripple_in_space,if=buff.rune_of_power.down&buff.arcane_power.down if buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) spell(ripple_in_space_essence) #the_unbound_force,if=buff.rune_of_power.down&buff.arcane_power.down if buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) spell(the_unbound_force) #worldvein_resonance,if=burn_phase&buff.arcane_power.down&buff.rune_of_power.down&buff.arcane_charge.stack=buff.arcane_charge.max_stack|time_to_die<cooldown.arcane_power.remains if getstate(burn_phase) > 0 and buffexpires(arcane_power_buff) and buffexpires(rune_of_power_buff) and arcanecharges() == maxarcanecharges() or target.timetodie() < spellcooldown(arcane_power) spell(worldvein_resonance_essence) } } AddFunction arcaneessencesshortcdpostconditions { timesincepreviousspell(concentrated_flame_essence) > 6 and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and { not getstate(burn_phase) > 0 or target.timetodie() < spellcooldown(arcane_power) } and timetomaxmana() >= executetime(concentrated_flame_essence) and spell(concentrated_flame_essence) } AddFunction arcaneessencescdactions { #blood_of_the_enemy,if=burn_phase&buff.arcane_power.down&buff.rune_of_power.down&buff.arcane_charge.stack=buff.arcane_charge.max_stack|time_to_die<cooldown.arcane_power.remains if getstate(burn_phase) > 0 and buffexpires(arcane_power_buff) and buffexpires(rune_of_power_buff) and arcanecharges() == maxarcanecharges() or target.timetodie() < spellcooldown(arcane_power) spell(blood_of_the_enemy) unless timesincepreviousspell(concentrated_flame_essence) > 6 and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and { not getstate(burn_phase) > 0 or target.timetodie() < spellcooldown(arcane_power) } and timetomaxmana() >= executetime(concentrated_flame_essence) and spell(concentrated_flame_essence) or buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and { not getstate(burn_phase) > 0 or target.timetodie() < spellcooldown(arcane_power) } and timetomaxmana() >= executetime(reaping_flames) and spell(reaping_flames) { #focused_azerite_beam,if=buff.rune_of_power.down&buff.arcane_power.down if buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) spell(focused_azerite_beam) #guardian_of_azeroth,if=buff.rune_of_power.down&buff.arcane_power.down if buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) spell(guardian_of_azeroth) unless buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(purifying_blast) or buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(ripple_in_space_essence) or buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(the_unbound_force) { #memory_of_lucid_dreams,if=!burn_phase&buff.arcane_power.down&cooldown.arcane_power.remains&buff.arcane_charge.stack=buff.arcane_charge.max_stack&(!talent.rune_of_power.enabled|action.rune_of_power.charges)|time_to_die<cooldown.arcane_power.remains if not getstate(burn_phase) > 0 and buffexpires(arcane_power_buff) and spellcooldown(arcane_power) > 0 and arcanecharges() == maxarcanecharges() and { not hastalent(rune_of_power_talent) or charges(rune_of_power) } or target.timetodie() < spellcooldown(arcane_power) spell(memory_of_lucid_dreams_essence) } } } AddFunction arcaneessencescdpostconditions { timesincepreviousspell(concentrated_flame_essence) > 6 and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and { not getstate(burn_phase) > 0 or target.timetodie() < spellcooldown(arcane_power) } and timetomaxmana() >= executetime(concentrated_flame_essence) and spell(concentrated_flame_essence) or buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and { not getstate(burn_phase) > 0 or target.timetodie() < spellcooldown(arcane_power) } and timetomaxmana() >= executetime(reaping_flames) and spell(reaping_flames) or buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(purifying_blast) or buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(ripple_in_space_essence) or buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(the_unbound_force) or { getstate(burn_phase) > 0 and buffexpires(arcane_power_buff) and buffexpires(rune_of_power_buff) and arcanecharges() == maxarcanecharges() or target.timetodie() < spellcooldown(arcane_power) } and spell(worldvein_resonance_essence) } ### actions.conserve AddFunction arcaneconservemainactions { #charged_up,if=buff.arcane_charge.stack=0 if arcanecharges() == 0 spell(charged_up) #nether_tempest,if=(refreshable|!ticking)&buff.arcane_charge.stack=buff.arcane_charge.max_stack&buff.rune_of_power.down&buff.arcane_power.down if { target.refreshable(nether_tempest_debuff) or not target.debuffpresent(nether_tempest_debuff) } and arcanecharges() == maxarcanecharges() and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) spell(nether_tempest) #arcane_blast,if=buff.rule_of_threes.up&buff.arcane_charge.stack>3 if buffpresent(rule_of_threes) and arcanecharges() > 3 and mana() > manacost(arcane_blast) spell(arcane_blast) #arcane_missiles,if=mana.pct<=95&buff.clearcasting.react&active_enemies<3,chain=1 if manapercent() <= 95 and buffpresent(clearcasting_buff) and enemies() < 3 spell(arcane_missiles) #arcane_barrage,if=((buff.arcane_charge.stack=buff.arcane_charge.max_stack)&((mana.pct<=variable.conserve_mana)|(talent.rune_of_power.enabled&cooldown.arcane_power.remains>cooldown.rune_of_power.full_recharge_time&mana.pct<=variable.conserve_mana+25))|(talent.arcane_orb.enabled&cooldown.arcane_orb.remains<=gcd&cooldown.arcane_power.remains>10))|mana.pct<=(variable.conserve_mana-10) if arcanecharges() == maxarcanecharges() and { manapercent() <= conserve_mana() or hastalent(rune_of_power_talent) and spellcooldown(arcane_power) > spellcooldown(rune_of_power) and manapercent() <= conserve_mana() + 25 } or hastalent(arcane_orb_talent) and spellcooldown(arcane_orb) <= gcd() and spellcooldown(arcane_power) > 10 or manapercent() <= conserve_mana() - 10 spell(arcane_barrage) #supernova,if=mana.pct<=95 if manapercent() <= 95 spell(supernova) #arcane_explosion,if=active_enemies>=3&(mana.pct>=variable.conserve_mana|buff.arcane_charge.stack=3) if enemies() >= 3 and { manapercent() >= conserve_mana() or arcanecharges() == 3 } spell(arcane_explosion) #arcane_blast if mana() > manacost(arcane_blast) spell(arcane_blast) #arcane_barrage spell(arcane_barrage) } AddFunction arcaneconservemainpostconditions { } AddFunction arcaneconserveshortcdactions { unless arcanecharges() == 0 and spell(charged_up) or { target.refreshable(nether_tempest_debuff) or not target.debuffpresent(nether_tempest_debuff) } and arcanecharges() == maxarcanecharges() and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(nether_tempest) { #arcane_orb,if=buff.arcane_charge.stack<=2&(cooldown.arcane_power.remains>10|active_enemies<=2) if arcanecharges() <= 2 and { spellcooldown(arcane_power) > 10 or enemies() <= 2 } spell(arcane_orb) unless buffpresent(rule_of_threes) and arcanecharges() > 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) { #rune_of_power,if=buff.arcane_charge.stack=buff.arcane_charge.max_stack&(full_recharge_time<=execute_time|full_recharge_time<=cooldown.arcane_power.remains|target.time_to_die<=cooldown.arcane_power.remains) if arcanecharges() == maxarcanecharges() and { spellfullrecharge(rune_of_power) <= executetime(rune_of_power) or spellfullrecharge(rune_of_power) <= spellcooldown(arcane_power) or target.timetodie() <= spellcooldown(arcane_power) } spell(rune_of_power) } } } AddFunction arcaneconserveshortcdpostconditions { arcanecharges() == 0 and spell(charged_up) or { target.refreshable(nether_tempest_debuff) or not target.debuffpresent(nether_tempest_debuff) } and arcanecharges() == maxarcanecharges() and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(nether_tempest) or buffpresent(rule_of_threes) and arcanecharges() > 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) or manapercent() <= 95 and buffpresent(clearcasting_buff) and enemies() < 3 and spell(arcane_missiles) or { arcanecharges() == maxarcanecharges() and { manapercent() <= conserve_mana() or hastalent(rune_of_power_talent) and spellcooldown(arcane_power) > spellcooldown(rune_of_power) and manapercent() <= conserve_mana() + 25 } or hastalent(arcane_orb_talent) and spellcooldown(arcane_orb) <= gcd() and spellcooldown(arcane_power) > 10 or manapercent() <= conserve_mana() - 10 } and spell(arcane_barrage) or manapercent() <= 95 and spell(supernova) or enemies() >= 3 and { manapercent() >= conserve_mana() or arcanecharges() == 3 } and spell(arcane_explosion) or mana() > manacost(arcane_blast) and spell(arcane_blast) or spell(arcane_barrage) } AddFunction arcaneconservecdactions { #mirror_image spell(mirror_image) unless arcanecharges() == 0 and spell(charged_up) or { target.refreshable(nether_tempest_debuff) or not target.debuffpresent(nether_tempest_debuff) } and arcanecharges() == maxarcanecharges() and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(nether_tempest) or arcanecharges() <= 2 and { spellcooldown(arcane_power) > 10 or enemies() <= 2 } and spell(arcane_orb) or buffpresent(rule_of_threes) and arcanecharges() > 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) { #use_item,name=tidestorm_codex,if=buff.rune_of_power.down&!buff.arcane_power.react&cooldown.arcane_power.remains>20 if buffexpires(rune_of_power_buff) and not buffpresent(arcane_power_buff) and spellcooldown(arcane_power) > 20 arcaneuseitemactions() #use_item,effect_name=cyclotronic_blast,if=buff.rune_of_power.down&!buff.arcane_power.react&cooldown.arcane_power.remains>20 if buffexpires(rune_of_power_buff) and not buffpresent(arcane_power_buff) and spellcooldown(arcane_power) > 20 arcaneuseitemactions() } } AddFunction arcaneconservecdpostconditions { arcanecharges() == 0 and spell(charged_up) or { target.refreshable(nether_tempest_debuff) or not target.debuffpresent(nether_tempest_debuff) } and arcanecharges() == maxarcanecharges() and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(nether_tempest) or arcanecharges() <= 2 and { spellcooldown(arcane_power) > 10 or enemies() <= 2 } and spell(arcane_orb) or buffpresent(rule_of_threes) and arcanecharges() > 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) or arcanecharges() == maxarcanecharges() and { spellfullrecharge(rune_of_power) <= executetime(rune_of_power) or spellfullrecharge(rune_of_power) <= spellcooldown(arcane_power) or target.timetodie() <= spellcooldown(arcane_power) } and spell(rune_of_power) or manapercent() <= 95 and buffpresent(clearcasting_buff) and enemies() < 3 and spell(arcane_missiles) or { arcanecharges() == maxarcanecharges() and { manapercent() <= conserve_mana() or hastalent(rune_of_power_talent) and spellcooldown(arcane_power) > spellcooldown(rune_of_power) and manapercent() <= conserve_mana() + 25 } or hastalent(arcane_orb_talent) and spellcooldown(arcane_orb) <= gcd() and spellcooldown(arcane_power) > 10 or manapercent() <= conserve_mana() - 10 } and spell(arcane_barrage) or manapercent() <= 95 and spell(supernova) or enemies() >= 3 and { manapercent() >= conserve_mana() or arcanecharges() == 3 } and spell(arcane_explosion) or mana() > manacost(arcane_blast) and spell(arcane_blast) or spell(arcane_barrage) } ### actions.burn AddFunction arcaneburnmainactions { #variable,name=total_burns,op=add,value=1,if=!burn_phase #start_burn_phase,if=!burn_phase if not getstate(burn_phase) > 0 and not getstate(burn_phase) > 0 setstate(burn_phase 1) #stop_burn_phase,if=burn_phase&prev_gcd.1.evocation&target.time_to_die>variable.average_burn_length&burn_phase_duration>0 if getstate(burn_phase) > 0 and previousgcdspell(evocation) and target.timetodie() > average_burn_length() and getstateduration() > 0 and getstate(burn_phase) > 0 setstate(burn_phase 0) #charged_up,if=buff.arcane_charge.stack<=1 if arcanecharges() <= 1 spell(charged_up) #nether_tempest,if=(refreshable|!ticking)&buff.arcane_charge.stack=buff.arcane_charge.max_stack&buff.rune_of_power.down&buff.arcane_power.down if { target.refreshable(nether_tempest_debuff) or not target.debuffpresent(nether_tempest_debuff) } and arcanecharges() == maxarcanecharges() and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) spell(nether_tempest) #arcane_blast,if=buff.rule_of_threes.up&talent.overpowered.enabled&active_enemies<3 if buffpresent(rule_of_threes) and hastalent(overpowered_talent) and enemies() < 3 and mana() > manacost(arcane_blast) spell(arcane_blast) #arcane_barrage,if=active_enemies>=3&(buff.arcane_charge.stack=buff.arcane_charge.max_stack) if enemies() >= 3 and arcanecharges() == maxarcanecharges() spell(arcane_barrage) #arcane_explosion,if=active_enemies>=3 if enemies() >= 3 spell(arcane_explosion) #arcane_missiles,if=buff.clearcasting.react&active_enemies<3&(talent.amplification.enabled|(!talent.overpowered.enabled&azerite.arcane_pummeling.rank>=2)|buff.arcane_power.down),chain=1 if buffpresent(clearcasting_buff) and enemies() < 3 and { hastalent(amplification_talent) or not hastalent(overpowered_talent) and azeritetraitrank(arcane_pummeling_trait) >= 2 or buffexpires(arcane_power_buff) } spell(arcane_missiles) #arcane_blast,if=active_enemies<3 if enemies() < 3 and mana() > manacost(arcane_blast) spell(arcane_blast) #arcane_barrage spell(arcane_barrage) } AddFunction arcaneburnmainpostconditions { } AddFunction arcaneburnshortcdactions { #variable,name=total_burns,op=add,value=1,if=!burn_phase #start_burn_phase,if=!burn_phase if not getstate(burn_phase) > 0 and not getstate(burn_phase) > 0 setstate(burn_phase 1) #stop_burn_phase,if=burn_phase&prev_gcd.1.evocation&target.time_to_die>variable.average_burn_length&burn_phase_duration>0 if getstate(burn_phase) > 0 and previousgcdspell(evocation) and target.timetodie() > average_burn_length() and getstateduration() > 0 and getstate(burn_phase) > 0 setstate(burn_phase 0) unless arcanecharges() <= 1 and spell(charged_up) or { target.refreshable(nether_tempest_debuff) or not target.debuffpresent(nether_tempest_debuff) } and arcanecharges() == maxarcanecharges() and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(nether_tempest) or buffpresent(rule_of_threes) and hastalent(overpowered_talent) and enemies() < 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) { #bag_of_tricks,if=buff.arcane_power.down if buffexpires(arcane_power_buff) spell(bag_of_tricks) #rune_of_power,if=!buff.arcane_power.up&(mana.pct>=50|cooldown.arcane_power.remains=0)&(buff.arcane_charge.stack=buff.arcane_charge.max_stack) if not buffpresent(arcane_power_buff) and { manapercent() >= 50 or not spellcooldown(arcane_power) > 0 } and arcanecharges() == maxarcanecharges() spell(rune_of_power) #presence_of_mind,if=(talent.rune_of_power.enabled&buff.rune_of_power.remains<=buff.presence_of_mind.max_stack*action.arcane_blast.execute_time)|buff.arcane_power.remains<=buff.presence_of_mind.max_stack*action.arcane_blast.execute_time if hastalent(rune_of_power_talent) and totemremaining(rune_of_power) <= spelldata(presence_of_mind_buff max_stacks) * executetime(arcane_blast) or buffremaining(arcane_power_buff) <= spelldata(presence_of_mind_buff max_stacks) * executetime(arcane_blast) spell(presence_of_mind) #arcane_orb,if=buff.arcane_charge.stack=0|(active_enemies<3|(active_enemies<2&talent.resonance.enabled)) if arcanecharges() == 0 or enemies() < 3 or enemies() < 2 and hastalent(resonance_talent) spell(arcane_orb) } } AddFunction arcaneburnshortcdpostconditions { arcanecharges() <= 1 and spell(charged_up) or { target.refreshable(nether_tempest_debuff) or not target.debuffpresent(nether_tempest_debuff) } and arcanecharges() == maxarcanecharges() and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(nether_tempest) or buffpresent(rule_of_threes) and hastalent(overpowered_talent) and enemies() < 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) or enemies() >= 3 and arcanecharges() == maxarcanecharges() and spell(arcane_barrage) or enemies() >= 3 and spell(arcane_explosion) or buffpresent(clearcasting_buff) and enemies() < 3 and { hastalent(amplification_talent) or not hastalent(overpowered_talent) and azeritetraitrank(arcane_pummeling_trait) >= 2 or buffexpires(arcane_power_buff) } and spell(arcane_missiles) or enemies() < 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) or spell(arcane_barrage) } AddFunction arcaneburncdactions { #variable,name=total_burns,op=add,value=1,if=!burn_phase #start_burn_phase,if=!burn_phase if not getstate(burn_phase) > 0 and not getstate(burn_phase) > 0 setstate(burn_phase 1) #stop_burn_phase,if=burn_phase&prev_gcd.1.evocation&target.time_to_die>variable.average_burn_length&burn_phase_duration>0 if getstate(burn_phase) > 0 and previousgcdspell(evocation) and target.timetodie() > average_burn_length() and getstateduration() > 0 and getstate(burn_phase) > 0 setstate(burn_phase 0) unless arcanecharges() <= 1 and spell(charged_up) { #mirror_image spell(mirror_image) unless { target.refreshable(nether_tempest_debuff) or not target.debuffpresent(nether_tempest_debuff) } and arcanecharges() == maxarcanecharges() and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(nether_tempest) or buffpresent(rule_of_threes) and hastalent(overpowered_talent) and enemies() < 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) { #lights_judgment,if=buff.arcane_power.down if buffexpires(arcane_power_buff) spell(lights_judgment) unless buffexpires(arcane_power_buff) and spell(bag_of_tricks) or not buffpresent(arcane_power_buff) and { manapercent() >= 50 or not spellcooldown(arcane_power) > 0 } and arcanecharges() == maxarcanecharges() and spell(rune_of_power) { #berserking spell(berserking) #arcane_power spell(arcane_power) #use_items,if=buff.arcane_power.up|target.time_to_die<cooldown.arcane_power.remains if buffpresent(arcane_power_buff) or target.timetodie() < spellcooldown(arcane_power) arcaneuseitemactions() #blood_fury spell(blood_fury_sp) #fireblood spell(fireblood) #ancestral_call spell(ancestral_call) unless { hastalent(rune_of_power_talent) and totemremaining(rune_of_power) <= spelldata(presence_of_mind_buff max_stacks) * executetime(arcane_blast) or buffremaining(arcane_power_buff) <= spelldata(presence_of_mind_buff max_stacks) * executetime(arcane_blast) } and spell(presence_of_mind) { #potion,if=buff.arcane_power.up&((!essence.condensed_lifeforce.major|essence.condensed_lifeforce.rank<2)&(buff.berserking.up|buff.blood_fury.up|!(race.troll|race.orc))|buff.guardian_of_azeroth.up)|target.time_to_die<cooldown.arcane_power.remains if { buffpresent(arcane_power_buff) and { { not azeriteessenceismajor(condensed_life_force_essence_id) or azeriteessencerank(condensed_life_force_essence_id) < 2 } and { buffpresent(berserking_buff) or buffpresent(blood_fury_sp_buff) or not { race(troll) or race(orc) } } or buffpresent(guardian_of_azeroth_buff) } or target.timetodie() < spellcooldown(arcane_power) } and checkboxon(opt_use_consumables) and target.classification(worldboss) item(focused_resolve_item usable=1) unless { arcanecharges() == 0 or enemies() < 3 or enemies() < 2 and hastalent(resonance_talent) } and spell(arcane_orb) or enemies() >= 3 and arcanecharges() == maxarcanecharges() and spell(arcane_barrage) or enemies() >= 3 and spell(arcane_explosion) or buffpresent(clearcasting_buff) and enemies() < 3 and { hastalent(amplification_talent) or not hastalent(overpowered_talent) and azeritetraitrank(arcane_pummeling_trait) >= 2 or buffexpires(arcane_power_buff) } and spell(arcane_missiles) or enemies() < 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) { #variable,name=average_burn_length,op=set,value=(variable.average_burn_length*variable.total_burns-variable.average_burn_length+(burn_phase_duration))%variable.total_burns #evocation,interrupt_if=mana.pct>=85,interrupt_immediate=1 spell(evocation) } } } } } } AddFunction arcaneburncdpostconditions { arcanecharges() <= 1 and spell(charged_up) or { target.refreshable(nether_tempest_debuff) or not target.debuffpresent(nether_tempest_debuff) } and arcanecharges() == maxarcanecharges() and buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and spell(nether_tempest) or buffpresent(rule_of_threes) and hastalent(overpowered_talent) and enemies() < 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) or buffexpires(arcane_power_buff) and spell(bag_of_tricks) or not buffpresent(arcane_power_buff) and { manapercent() >= 50 or not spellcooldown(arcane_power) > 0 } and arcanecharges() == maxarcanecharges() and spell(rune_of_power) or { hastalent(rune_of_power_talent) and totemremaining(rune_of_power) <= spelldata(presence_of_mind_buff max_stacks) * executetime(arcane_blast) or buffremaining(arcane_power_buff) <= spelldata(presence_of_mind_buff max_stacks) * executetime(arcane_blast) } and spell(presence_of_mind) or { arcanecharges() == 0 or enemies() < 3 or enemies() < 2 and hastalent(resonance_talent) } and spell(arcane_orb) or enemies() >= 3 and arcanecharges() == maxarcanecharges() and spell(arcane_barrage) or enemies() >= 3 and spell(arcane_explosion) or buffpresent(clearcasting_buff) and enemies() < 3 and { hastalent(amplification_talent) or not hastalent(overpowered_talent) and azeritetraitrank(arcane_pummeling_trait) >= 2 or buffexpires(arcane_power_buff) } and spell(arcane_missiles) or enemies() < 3 and mana() > manacost(arcane_blast) and spell(arcane_blast) or spell(arcane_barrage) } ### actions.default AddFunction arcane_defaultmainactions { #call_action_list,name=essences arcaneessencesmainactions() unless arcaneessencesmainpostconditions() { #call_action_list,name=burn,if=burn_phase|target.time_to_die<variable.average_burn_length if { getstate(burn_phase) > 0 or target.timetodie() < average_burn_length() } and checkboxon(opt_arcane_mage_burn_phase) arcaneburnmainactions() unless { getstate(burn_phase) > 0 or target.timetodie() < average_burn_length() } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburnmainpostconditions() { #call_action_list,name=burn,if=(cooldown.arcane_power.remains=0&cooldown.evocation.remains<=variable.average_burn_length&(buff.arcane_charge.stack=buff.arcane_charge.max_stack|(talent.charged_up.enabled&cooldown.charged_up.remains=0&buff.arcane_charge.stack<=1))) if not spellcooldown(arcane_power) > 0 and spellcooldown(evocation) <= average_burn_length() and { arcanecharges() == maxarcanecharges() or hastalent(charged_up_talent) and not spellcooldown(charged_up) > 0 and arcanecharges() <= 1 } and checkboxon(opt_arcane_mage_burn_phase) arcaneburnmainactions() unless not spellcooldown(arcane_power) > 0 and spellcooldown(evocation) <= average_burn_length() and { arcanecharges() == maxarcanecharges() or hastalent(charged_up_talent) and not spellcooldown(charged_up) > 0 and arcanecharges() <= 1 } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburnmainpostconditions() { #call_action_list,name=conserve,if=!burn_phase if not getstate(burn_phase) > 0 arcaneconservemainactions() unless not getstate(burn_phase) > 0 and arcaneconservemainpostconditions() { #call_action_list,name=movement arcanemovementmainactions() } } } } } AddFunction arcane_defaultmainpostconditions { arcaneessencesmainpostconditions() or { getstate(burn_phase) > 0 or target.timetodie() < average_burn_length() } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburnmainpostconditions() or not spellcooldown(arcane_power) > 0 and spellcooldown(evocation) <= average_burn_length() and { arcanecharges() == maxarcanecharges() or hastalent(charged_up_talent) and not spellcooldown(charged_up) > 0 and arcanecharges() <= 1 } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburnmainpostconditions() or not getstate(burn_phase) > 0 and arcaneconservemainpostconditions() or arcanemovementmainpostconditions() } AddFunction arcane_defaultshortcdactions { #call_action_list,name=essences arcaneessencesshortcdactions() unless arcaneessencesshortcdpostconditions() { #call_action_list,name=burn,if=burn_phase|target.time_to_die<variable.average_burn_length if { getstate(burn_phase) > 0 or target.timetodie() < average_burn_length() } and checkboxon(opt_arcane_mage_burn_phase) arcaneburnshortcdactions() unless { getstate(burn_phase) > 0 or target.timetodie() < average_burn_length() } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburnshortcdpostconditions() { #call_action_list,name=burn,if=(cooldown.arcane_power.remains=0&cooldown.evocation.remains<=variable.average_burn_length&(buff.arcane_charge.stack=buff.arcane_charge.max_stack|(talent.charged_up.enabled&cooldown.charged_up.remains=0&buff.arcane_charge.stack<=1))) if not spellcooldown(arcane_power) > 0 and spellcooldown(evocation) <= average_burn_length() and { arcanecharges() == maxarcanecharges() or hastalent(charged_up_talent) and not spellcooldown(charged_up) > 0 and arcanecharges() <= 1 } and checkboxon(opt_arcane_mage_burn_phase) arcaneburnshortcdactions() unless not spellcooldown(arcane_power) > 0 and spellcooldown(evocation) <= average_burn_length() and { arcanecharges() == maxarcanecharges() or hastalent(charged_up_talent) and not spellcooldown(charged_up) > 0 and arcanecharges() <= 1 } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburnshortcdpostconditions() { #call_action_list,name=conserve,if=!burn_phase if not getstate(burn_phase) > 0 arcaneconserveshortcdactions() unless not getstate(burn_phase) > 0 and arcaneconserveshortcdpostconditions() { #call_action_list,name=movement arcanemovementshortcdactions() } } } } } AddFunction arcane_defaultshortcdpostconditions { arcaneessencesshortcdpostconditions() or { getstate(burn_phase) > 0 or target.timetodie() < average_burn_length() } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburnshortcdpostconditions() or not spellcooldown(arcane_power) > 0 and spellcooldown(evocation) <= average_burn_length() and { arcanecharges() == maxarcanecharges() or hastalent(charged_up_talent) and not spellcooldown(charged_up) > 0 and arcanecharges() <= 1 } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburnshortcdpostconditions() or not getstate(burn_phase) > 0 and arcaneconserveshortcdpostconditions() or arcanemovementshortcdpostconditions() } AddFunction arcane_defaultcdactions { #counterspell arcaneinterruptactions() #call_action_list,name=essences arcaneessencescdactions() unless arcaneessencescdpostconditions() { #use_item,name=azsharas_font_of_power,if=buff.rune_of_power.down&buff.arcane_power.down&(cooldown.arcane_power.remains<=4+10*variable.font_double_on_use&cooldown.evocation.remains<=variable.average_burn_length+4+10*variable.font_double_on_use|time_to_die<cooldown.arcane_power.remains) if buffexpires(rune_of_power_buff) and buffexpires(arcane_power_buff) and { spellcooldown(arcane_power) <= 4 + 10 * font_double_on_use() and spellcooldown(evocation) <= average_burn_length() + 4 + 10 * font_double_on_use() or target.timetodie() < spellcooldown(arcane_power) } arcaneuseitemactions() #call_action_list,name=burn,if=burn_phase|target.time_to_die<variable.average_burn_length if { getstate(burn_phase) > 0 or target.timetodie() < average_burn_length() } and checkboxon(opt_arcane_mage_burn_phase) arcaneburncdactions() unless { getstate(burn_phase) > 0 or target.timetodie() < average_burn_length() } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburncdpostconditions() { #call_action_list,name=burn,if=(cooldown.arcane_power.remains=0&cooldown.evocation.remains<=variable.average_burn_length&(buff.arcane_charge.stack=buff.arcane_charge.max_stack|(talent.charged_up.enabled&cooldown.charged_up.remains=0&buff.arcane_charge.stack<=1))) if not spellcooldown(arcane_power) > 0 and spellcooldown(evocation) <= average_burn_length() and { arcanecharges() == maxarcanecharges() or hastalent(charged_up_talent) and not spellcooldown(charged_up) > 0 and arcanecharges() <= 1 } and checkboxon(opt_arcane_mage_burn_phase) arcaneburncdactions() unless not spellcooldown(arcane_power) > 0 and spellcooldown(evocation) <= average_burn_length() and { arcanecharges() == maxarcanecharges() or hastalent(charged_up_talent) and not spellcooldown(charged_up) > 0 and arcanecharges() <= 1 } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburncdpostconditions() { #call_action_list,name=conserve,if=!burn_phase if not getstate(burn_phase) > 0 arcaneconservecdactions() unless not getstate(burn_phase) > 0 and arcaneconservecdpostconditions() { #call_action_list,name=movement arcanemovementcdactions() } } } } } AddFunction arcane_defaultcdpostconditions { arcaneessencescdpostconditions() or { getstate(burn_phase) > 0 or target.timetodie() < average_burn_length() } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburncdpostconditions() or not spellcooldown(arcane_power) > 0 and spellcooldown(evocation) <= average_burn_length() and { arcanecharges() == maxarcanecharges() or hastalent(charged_up_talent) and not spellcooldown(charged_up) > 0 and arcanecharges() <= 1 } and checkboxon(opt_arcane_mage_burn_phase) and arcaneburncdpostconditions() or not getstate(burn_phase) > 0 and arcaneconservecdpostconditions() or arcanemovementcdpostconditions() } ### Arcane icons. AddCheckBox(opt_mage_arcane_aoe l(aoe) default specialization=arcane) AddIcon checkbox=!opt_mage_arcane_aoe enemies=1 help=shortcd specialization=arcane { if not incombat() arcaneprecombatshortcdactions() arcane_defaultshortcdactions() } AddIcon checkbox=opt_mage_arcane_aoe help=shortcd specialization=arcane { if not incombat() arcaneprecombatshortcdactions() arcane_defaultshortcdactions() } AddIcon enemies=1 help=main specialization=arcane { if not incombat() arcaneprecombatmainactions() arcane_defaultmainactions() } AddIcon checkbox=opt_mage_arcane_aoe help=aoe specialization=arcane { if not incombat() arcaneprecombatmainactions() arcane_defaultmainactions() } AddIcon checkbox=!opt_mage_arcane_aoe enemies=1 help=cd specialization=arcane { if not incombat() arcaneprecombatcdactions() arcane_defaultcdactions() } AddIcon checkbox=opt_mage_arcane_aoe help=cd specialization=arcane { if not incombat() arcaneprecombatcdactions() arcane_defaultcdactions() } ### Required symbols # amplification_talent # ancestral_call # ancient_knot_of_wisdom_item # arcane_barrage # arcane_blast # arcane_explosion # arcane_familiar # arcane_intellect # arcane_missiles # arcane_orb # arcane_orb_talent # arcane_power # arcane_power_buff # arcane_pummeling_trait # azsharas_font_of_power_item # azurethos_singed_plumage_item # bag_of_tricks # balefire_branch_item # berserking # berserking_buff # blink # blood_fury_sp # blood_fury_sp_buff # blood_of_the_enemy # charged_up # charged_up_talent # clearcasting_buff # concentrated_flame_essence # condensed_life_force_essence_id # counterspell # equipoise_trait # evocation # fireblood # focused_azerite_beam # focused_resolve_item # gladiators_badge # gladiators_medallion_item # guardian_of_azeroth # guardian_of_azeroth_buff # ignition_mages_fuse_item # lights_judgment # memory_of_lucid_dreams_essence # mirror_image # nether_tempest # nether_tempest_debuff # neural_synapse_enhancer_item # overpowered_talent # presence_of_mind # presence_of_mind_buff # purifying_blast # quaking_palm # reaping_flames # resonance_talent # ripple_in_space_essence # rule_of_threes # rune_of_power # rune_of_power_buff # rune_of_power_talent # shockbiters_fang_item # supernova # the_unbound_force # tzanes_barkspines_item # worldvein_resonance_essence ]] OvaleScripts:RegisterScript("MAGE", "arcane", name, desc, code, "script") end do local name = "sc_t24_mage_fire" local desc = "[8.3] Simulationcraft: T24_Mage_Fire" local code = [[ # Based on SimulationCraft profile "T24_Mage_Fire". # class=mage # spec=fire # talents=3031022 Include(ovale_common) Include(ovale_trinkets_mop) Include(ovale_trinkets_wod) Include(ovale_mage_spells) AddFunction phoenix_pooling { hastalent(rune_of_power_talent) and spellcooldown(rune_of_power) < spellcooldown(phoenix_flames) and { spellcooldown(combustion) > combustion_rop_cutoff() or 0 } and { spellcooldown(rune_of_power) < target.timetodie() or charges(rune_of_power) > 0 } or not 0 and spellcooldown(combustion) < spellfullrecharge(phoenix_flames) and spellcooldown(combustion) < target.timetodie() } AddFunction fire_blast_pooling { hastalent(rune_of_power_talent) and spellcooldown(rune_of_power) < spellcooldown(fire_blast) and { spellcooldown(combustion) > combustion_rop_cutoff() or 0 or talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(rune_of_power) < target.timetodie() or charges(rune_of_power) > 0 } or not 0 and spellcooldown(combustion) < spellfullrecharge(fire_blast) + spellcooldownduration(fire_blast) * hasazeritetrait(blaster_master_trait) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and spellcooldown(combustion) < target.timetodie() or hastalent(firestarter_talent) and talent(firestarter_talent) and target.healthpercent() >= 90 and target.timetohealthpercent(90) < spellcooldown(fire_blast) + spellcooldownduration(fire_blast) * hasazeritetrait(blaster_master_trait) } AddFunction on_use_cutoff { 20 * combustion_on_use() and not font_double_on_use() + 40 * font_double_on_use() + 25 * hasequippeditem(azsharas_font_of_power_item) and not font_double_on_use() + 8 * hasequippeditem(manifesto_of_madness_item) and not font_double_on_use() } AddFunction font_of_power_precombat_channel { if font_double_on_use() and 0 == 0 18 } AddFunction font_double_on_use { hasequippeditem(azsharas_font_of_power_item) and combustion_on_use() } AddFunction combustion_on_use { hasequippeditem(manifesto_of_madness_item) or hasequippeditem(gladiators_badge) or hasequippeditem(gladiators_medallion_item) or hasequippeditem(ignition_mages_fuse_item) or hasequippeditem(tzanes_barkspines_item) or hasequippeditem(azurethos_singed_plumage_item) or hasequippeditem(ancient_knot_of_wisdom_item) or hasequippeditem(shockbiters_fang_item) or hasequippeditem(neural_synapse_enhancer_item) or hasequippeditem(balefire_branch_item) } AddFunction combustion_rop_cutoff { 60 } AddCheckBox(opt_interrupt l(interrupt) default specialization=fire) AddCheckBox(opt_use_consumables l(opt_use_consumables) default specialization=fire) AddFunction fireinterruptactions { if checkboxon(opt_interrupt) and not target.isfriend() and target.casting() { if target.inrange(counterspell) and target.isinterruptible() spell(counterspell) if target.inrange(quaking_palm) and not target.classification(worldboss) spell(quaking_palm) } } AddFunction fireuseitemactions { item(trinket0slot text=13 usable=1) item(trinket1slot text=14 usable=1) } ### actions.standard_rotation AddFunction firestandard_rotationmainactions { #flamestrike,if=((talent.flame_patch.enabled&active_enemies>1&!firestarter.active)|active_enemies>4)&buff.hot_streak.react if { hastalent(flame_patch_talent) and enemies() > 1 and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or enemies() > 4 } and buffpresent(hot_streak_buff) spell(flamestrike) #pyroblast,if=buff.hot_streak.react&buff.hot_streak.remains<action.fireball.execute_time if buffpresent(hot_streak_buff) and buffremaining(hot_streak_buff) < executetime(fireball) spell(pyroblast) #pyroblast,if=buff.hot_streak.react&(prev_gcd.1.fireball|firestarter.active|action.pyroblast.in_flight) if buffpresent(hot_streak_buff) and { previousgcdspell(fireball) or talent(firestarter_talent) and target.healthpercent() >= 90 or inflighttotarget(pyroblast) } spell(pyroblast) #phoenix_flames,if=charges>=3&active_enemies>2&!variable.phoenix_pooling if charges(phoenix_flames) >= 3 and enemies() > 2 and not phoenix_pooling() spell(phoenix_flames) #pyroblast,if=buff.hot_streak.react&target.health.pct<=30&talent.searing_touch.enabled if buffpresent(hot_streak_buff) and target.healthpercent() <= 30 and hastalent(searing_touch_talent) spell(pyroblast) #pyroblast,if=buff.pyroclasm.react&cast_time<buff.pyroclasm.remains if buffpresent(pyroclasm) and casttime(pyroblast) < buffremaining(pyroclasm) spell(pyroblast) #fire_blast,use_off_gcd=1,use_while_casting=1,if=((cooldown.combustion.remains>0|variable.disable_combustion)&buff.rune_of_power.down&!firestarter.active)&!talent.kindling.enabled&!variable.fire_blast_pooling&(((action.fireball.executing|action.pyroblast.executing)&(buff.heating_up.react))|(talent.searing_touch.enabled&target.health.pct<=30&(buff.heating_up.react&!action.scorch.executing|!buff.hot_streak.react&!buff.heating_up.react&action.scorch.executing&!action.pyroblast.in_flight&!action.fireball.in_flight))) if { spellcooldown(combustion) > 0 or 0 } and buffexpires(rune_of_power_buff) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and not hastalent(kindling_talent) and not fire_blast_pooling() and { { executetime(fireball) > 0 or executetime(pyroblast) > 0 } and buffpresent(heating_up_buff) or hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { buffpresent(heating_up_buff) and not executetime(scorch) > 0 or not buffpresent(hot_streak_buff) and not buffpresent(heating_up_buff) and executetime(scorch) > 0 and not inflighttotarget(pyroblast) and not inflighttotarget(fireball) } } spell(fire_blast) #fire_blast,if=talent.kindling.enabled&buff.heating_up.react&!firestarter.active&(cooldown.combustion.remains>full_recharge_time+2+talent.kindling.enabled|variable.disable_combustion|(!talent.rune_of_power.enabled|cooldown.rune_of_power.remains>target.time_to_die&action.rune_of_power.charges<1)&cooldown.combustion.remains>target.time_to_die) if hastalent(kindling_talent) and buffpresent(heating_up_buff) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > spellfullrecharge(fire_blast) + 2 + talentpoints(kindling_talent) or 0 or { not hastalent(rune_of_power_talent) or spellcooldown(rune_of_power) > target.timetodie() and charges(rune_of_power) < 1 } and spellcooldown(combustion) > target.timetodie() } spell(fire_blast) #pyroblast,if=prev_gcd.1.scorch&buff.heating_up.up&talent.searing_touch.enabled&target.health.pct<=30&((talent.flame_patch.enabled&active_enemies=1&!firestarter.active)|(active_enemies<4&!talent.flame_patch.enabled)) if previousgcdspell(scorch) and buffpresent(heating_up_buff) and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { hastalent(flame_patch_talent) and enemies() == 1 and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or enemies() < 4 and not hastalent(flame_patch_talent) } spell(pyroblast) #phoenix_flames,if=(buff.heating_up.react|(!buff.hot_streak.react&(action.fire_blast.charges>0|talent.searing_touch.enabled&target.health.pct<=30)))&!variable.phoenix_pooling if { buffpresent(heating_up_buff) or not buffpresent(hot_streak_buff) and { charges(fire_blast) > 0 or hastalent(searing_touch_talent) and target.healthpercent() <= 30 } } and not phoenix_pooling() spell(phoenix_flames) #call_action_list,name=active_talents fireactive_talentsmainactions() unless fireactive_talentsmainpostconditions() { #call_action_list,name=items_low_priority fireitems_low_prioritymainactions() unless fireitems_low_prioritymainpostconditions() { #scorch,if=target.health.pct<=30&talent.searing_touch.enabled if target.healthpercent() <= 30 and hastalent(searing_touch_talent) spell(scorch) #fire_blast,use_off_gcd=1,use_while_casting=1,if=!variable.fire_blast_pooling&(talent.flame_patch.enabled&active_enemies>2|active_enemies>9)&((cooldown.combustion.remains>0|variable.disable_combustion)&!firestarter.active)&buff.hot_streak.down&(!azerite.blaster_master.enabled|buff.blaster_master.remains<0.5) if not fire_blast_pooling() and { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 9 } and { spellcooldown(combustion) > 0 or 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and buffexpires(hot_streak_buff) and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } spell(fire_blast) #flamestrike,if=talent.flame_patch.enabled&active_enemies>2|active_enemies>9 if hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 9 spell(flamestrike) #fireball spell(fireball) #scorch spell(scorch) } } } AddFunction firestandard_rotationmainpostconditions { fireactive_talentsmainpostconditions() or fireitems_low_prioritymainpostconditions() } AddFunction firestandard_rotationshortcdactions { unless { hastalent(flame_patch_talent) and enemies() > 1 and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or enemies() > 4 } and buffpresent(hot_streak_buff) and spell(flamestrike) or buffpresent(hot_streak_buff) and buffremaining(hot_streak_buff) < executetime(fireball) and spell(pyroblast) or buffpresent(hot_streak_buff) and { previousgcdspell(fireball) or talent(firestarter_talent) and target.healthpercent() >= 90 or inflighttotarget(pyroblast) } and spell(pyroblast) or charges(phoenix_flames) >= 3 and enemies() > 2 and not phoenix_pooling() and spell(phoenix_flames) or buffpresent(hot_streak_buff) and target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(pyroblast) or buffpresent(pyroclasm) and casttime(pyroblast) < buffremaining(pyroclasm) and spell(pyroblast) or { spellcooldown(combustion) > 0 or 0 } and buffexpires(rune_of_power_buff) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and not hastalent(kindling_talent) and not fire_blast_pooling() and { { executetime(fireball) > 0 or executetime(pyroblast) > 0 } and buffpresent(heating_up_buff) or hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { buffpresent(heating_up_buff) and not executetime(scorch) > 0 or not buffpresent(hot_streak_buff) and not buffpresent(heating_up_buff) and executetime(scorch) > 0 and not inflighttotarget(pyroblast) and not inflighttotarget(fireball) } } and spell(fire_blast) or hastalent(kindling_talent) and buffpresent(heating_up_buff) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > spellfullrecharge(fire_blast) + 2 + talentpoints(kindling_talent) or 0 or { not hastalent(rune_of_power_talent) or spellcooldown(rune_of_power) > target.timetodie() and charges(rune_of_power) < 1 } and spellcooldown(combustion) > target.timetodie() } and spell(fire_blast) or previousgcdspell(scorch) and buffpresent(heating_up_buff) and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { hastalent(flame_patch_talent) and enemies() == 1 and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or enemies() < 4 and not hastalent(flame_patch_talent) } and spell(pyroblast) or { buffpresent(heating_up_buff) or not buffpresent(hot_streak_buff) and { charges(fire_blast) > 0 or hastalent(searing_touch_talent) and target.healthpercent() <= 30 } } and not phoenix_pooling() and spell(phoenix_flames) { #call_action_list,name=active_talents fireactive_talentsshortcdactions() unless fireactive_talentsshortcdpostconditions() { #dragons_breath,if=active_enemies>1 if enemies() > 1 and target.distance(less 12) spell(dragons_breath) #call_action_list,name=items_low_priority fireitems_low_priorityshortcdactions() } } } AddFunction firestandard_rotationshortcdpostconditions { { hastalent(flame_patch_talent) and enemies() > 1 and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or enemies() > 4 } and buffpresent(hot_streak_buff) and spell(flamestrike) or buffpresent(hot_streak_buff) and buffremaining(hot_streak_buff) < executetime(fireball) and spell(pyroblast) or buffpresent(hot_streak_buff) and { previousgcdspell(fireball) or talent(firestarter_talent) and target.healthpercent() >= 90 or inflighttotarget(pyroblast) } and spell(pyroblast) or charges(phoenix_flames) >= 3 and enemies() > 2 and not phoenix_pooling() and spell(phoenix_flames) or buffpresent(hot_streak_buff) and target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(pyroblast) or buffpresent(pyroclasm) and casttime(pyroblast) < buffremaining(pyroclasm) and spell(pyroblast) or { spellcooldown(combustion) > 0 or 0 } and buffexpires(rune_of_power_buff) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and not hastalent(kindling_talent) and not fire_blast_pooling() and { { executetime(fireball) > 0 or executetime(pyroblast) > 0 } and buffpresent(heating_up_buff) or hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { buffpresent(heating_up_buff) and not executetime(scorch) > 0 or not buffpresent(hot_streak_buff) and not buffpresent(heating_up_buff) and executetime(scorch) > 0 and not inflighttotarget(pyroblast) and not inflighttotarget(fireball) } } and spell(fire_blast) or hastalent(kindling_talent) and buffpresent(heating_up_buff) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > spellfullrecharge(fire_blast) + 2 + talentpoints(kindling_talent) or 0 or { not hastalent(rune_of_power_talent) or spellcooldown(rune_of_power) > target.timetodie() and charges(rune_of_power) < 1 } and spellcooldown(combustion) > target.timetodie() } and spell(fire_blast) or previousgcdspell(scorch) and buffpresent(heating_up_buff) and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { hastalent(flame_patch_talent) and enemies() == 1 and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or enemies() < 4 and not hastalent(flame_patch_talent) } and spell(pyroblast) or { buffpresent(heating_up_buff) or not buffpresent(hot_streak_buff) and { charges(fire_blast) > 0 or hastalent(searing_touch_talent) and target.healthpercent() <= 30 } } and not phoenix_pooling() and spell(phoenix_flames) or fireactive_talentsshortcdpostconditions() or fireitems_low_priorityshortcdpostconditions() or target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(scorch) or not fire_blast_pooling() and { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 9 } and { spellcooldown(combustion) > 0 or 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and buffexpires(hot_streak_buff) and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } and spell(fire_blast) or { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 9 } and spell(flamestrike) or spell(fireball) or spell(scorch) } AddFunction firestandard_rotationcdactions { unless { hastalent(flame_patch_talent) and enemies() > 1 and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or enemies() > 4 } and buffpresent(hot_streak_buff) and spell(flamestrike) or buffpresent(hot_streak_buff) and buffremaining(hot_streak_buff) < executetime(fireball) and spell(pyroblast) or buffpresent(hot_streak_buff) and { previousgcdspell(fireball) or talent(firestarter_talent) and target.healthpercent() >= 90 or inflighttotarget(pyroblast) } and spell(pyroblast) or charges(phoenix_flames) >= 3 and enemies() > 2 and not phoenix_pooling() and spell(phoenix_flames) or buffpresent(hot_streak_buff) and target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(pyroblast) or buffpresent(pyroclasm) and casttime(pyroblast) < buffremaining(pyroclasm) and spell(pyroblast) or { spellcooldown(combustion) > 0 or 0 } and buffexpires(rune_of_power_buff) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and not hastalent(kindling_talent) and not fire_blast_pooling() and { { executetime(fireball) > 0 or executetime(pyroblast) > 0 } and buffpresent(heating_up_buff) or hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { buffpresent(heating_up_buff) and not executetime(scorch) > 0 or not buffpresent(hot_streak_buff) and not buffpresent(heating_up_buff) and executetime(scorch) > 0 and not inflighttotarget(pyroblast) and not inflighttotarget(fireball) } } and spell(fire_blast) or hastalent(kindling_talent) and buffpresent(heating_up_buff) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > spellfullrecharge(fire_blast) + 2 + talentpoints(kindling_talent) or 0 or { not hastalent(rune_of_power_talent) or spellcooldown(rune_of_power) > target.timetodie() and charges(rune_of_power) < 1 } and spellcooldown(combustion) > target.timetodie() } and spell(fire_blast) or previousgcdspell(scorch) and buffpresent(heating_up_buff) and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { hastalent(flame_patch_talent) and enemies() == 1 and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or enemies() < 4 and not hastalent(flame_patch_talent) } and spell(pyroblast) or { buffpresent(heating_up_buff) or not buffpresent(hot_streak_buff) and { charges(fire_blast) > 0 or hastalent(searing_touch_talent) and target.healthpercent() <= 30 } } and not phoenix_pooling() and spell(phoenix_flames) { #call_action_list,name=active_talents fireactive_talentscdactions() unless fireactive_talentscdpostconditions() or enemies() > 1 and target.distance(less 12) and spell(dragons_breath) { #call_action_list,name=items_low_priority fireitems_low_prioritycdactions() } } } AddFunction firestandard_rotationcdpostconditions { { hastalent(flame_patch_talent) and enemies() > 1 and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or enemies() > 4 } and buffpresent(hot_streak_buff) and spell(flamestrike) or buffpresent(hot_streak_buff) and buffremaining(hot_streak_buff) < executetime(fireball) and spell(pyroblast) or buffpresent(hot_streak_buff) and { previousgcdspell(fireball) or talent(firestarter_talent) and target.healthpercent() >= 90 or inflighttotarget(pyroblast) } and spell(pyroblast) or charges(phoenix_flames) >= 3 and enemies() > 2 and not phoenix_pooling() and spell(phoenix_flames) or buffpresent(hot_streak_buff) and target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(pyroblast) or buffpresent(pyroclasm) and casttime(pyroblast) < buffremaining(pyroclasm) and spell(pyroblast) or { spellcooldown(combustion) > 0 or 0 } and buffexpires(rune_of_power_buff) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and not hastalent(kindling_talent) and not fire_blast_pooling() and { { executetime(fireball) > 0 or executetime(pyroblast) > 0 } and buffpresent(heating_up_buff) or hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { buffpresent(heating_up_buff) and not executetime(scorch) > 0 or not buffpresent(hot_streak_buff) and not buffpresent(heating_up_buff) and executetime(scorch) > 0 and not inflighttotarget(pyroblast) and not inflighttotarget(fireball) } } and spell(fire_blast) or hastalent(kindling_talent) and buffpresent(heating_up_buff) and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > spellfullrecharge(fire_blast) + 2 + talentpoints(kindling_talent) or 0 or { not hastalent(rune_of_power_talent) or spellcooldown(rune_of_power) > target.timetodie() and charges(rune_of_power) < 1 } and spellcooldown(combustion) > target.timetodie() } and spell(fire_blast) or previousgcdspell(scorch) and buffpresent(heating_up_buff) and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { hastalent(flame_patch_talent) and enemies() == 1 and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or enemies() < 4 and not hastalent(flame_patch_talent) } and spell(pyroblast) or { buffpresent(heating_up_buff) or not buffpresent(hot_streak_buff) and { charges(fire_blast) > 0 or hastalent(searing_touch_talent) and target.healthpercent() <= 30 } } and not phoenix_pooling() and spell(phoenix_flames) or fireactive_talentscdpostconditions() or enemies() > 1 and target.distance(less 12) and spell(dragons_breath) or fireitems_low_prioritycdpostconditions() or target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(scorch) or not fire_blast_pooling() and { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 9 } and { spellcooldown(combustion) > 0 or 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and buffexpires(hot_streak_buff) and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } and spell(fire_blast) or { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 9 } and spell(flamestrike) or spell(fireball) or spell(scorch) } ### actions.rop_phase AddFunction firerop_phasemainactions { #flamestrike,if=(talent.flame_patch.enabled&active_enemies>1|active_enemies>4)&buff.hot_streak.react if { hastalent(flame_patch_talent) and enemies() > 1 or enemies() > 4 } and buffpresent(hot_streak_buff) spell(flamestrike) #pyroblast,if=buff.hot_streak.react if buffpresent(hot_streak_buff) spell(pyroblast) #fire_blast,use_off_gcd=1,use_while_casting=1,if=!(talent.flame_patch.enabled&active_enemies>2|active_enemies>5)&(!firestarter.active&(cooldown.combustion.remains>0|variable.disable_combustion))&(!buff.heating_up.react&!buff.hot_streak.react&!prev_off_gcd.fire_blast&(action.fire_blast.charges>=2|(action.phoenix_flames.charges>=1&talent.phoenix_flames.enabled)|(talent.alexstraszas_fury.enabled&cooldown.dragons_breath.ready)|(talent.searing_touch.enabled&target.health.pct<=30))) if not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) and not previousoffgcdspell(fire_blast) and { charges(fire_blast) >= 2 or charges(phoenix_flames) >= 1 and hastalent(phoenix_flames_talent) or hastalent(alexstraszas_fury_talent) and spellcooldown(dragons_breath) == 0 or hastalent(searing_touch_talent) and target.healthpercent() <= 30 } spell(fire_blast) #call_action_list,name=active_talents fireactive_talentsmainactions() unless fireactive_talentsmainpostconditions() { #pyroblast,if=buff.pyroclasm.react&cast_time<buff.pyroclasm.remains&buff.rune_of_power.remains>cast_time if buffpresent(pyroclasm) and casttime(pyroblast) < buffremaining(pyroclasm) and totemremaining(rune_of_power) > casttime(pyroblast) spell(pyroblast) #fire_blast,use_off_gcd=1,use_while_casting=1,if=!(talent.flame_patch.enabled&active_enemies>2|active_enemies>5)&(!firestarter.active&(cooldown.combustion.remains>0|variable.disable_combustion))&(buff.heating_up.react&(target.health.pct>=30|!talent.searing_touch.enabled)) if not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and buffpresent(heating_up_buff) and { target.healthpercent() >= 30 or not hastalent(searing_touch_talent) } spell(fire_blast) #fire_blast,use_off_gcd=1,use_while_casting=1,if=!(talent.flame_patch.enabled&active_enemies>2|active_enemies>5)&(!firestarter.active&(cooldown.combustion.remains>0|variable.disable_combustion))&talent.searing_touch.enabled&target.health.pct<=30&(buff.heating_up.react&!action.scorch.executing|!buff.heating_up.react&!buff.hot_streak.react) if not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { buffpresent(heating_up_buff) and not executetime(scorch) > 0 or not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) } spell(fire_blast) #pyroblast,if=prev_gcd.1.scorch&buff.heating_up.up&talent.searing_touch.enabled&target.health.pct<=30&(!talent.flame_patch.enabled|active_enemies=1) if previousgcdspell(scorch) and buffpresent(heating_up_buff) and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { not hastalent(flame_patch_talent) or enemies() == 1 } spell(pyroblast) #phoenix_flames,if=!prev_gcd.1.phoenix_flames&buff.heating_up.react if not previousgcdspell(phoenix_flames) and buffpresent(heating_up_buff) spell(phoenix_flames) #scorch,if=target.health.pct<=30&talent.searing_touch.enabled if target.healthpercent() <= 30 and hastalent(searing_touch_talent) spell(scorch) #fire_blast,use_off_gcd=1,use_while_casting=1,if=(talent.flame_patch.enabled&active_enemies>2|active_enemies>5)&((cooldown.combustion.remains>0|variable.disable_combustion)&!firestarter.active)&buff.hot_streak.down&(!azerite.blaster_master.enabled|buff.blaster_master.remains<0.5) if { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and { spellcooldown(combustion) > 0 or 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and buffexpires(hot_streak_buff) and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } spell(fire_blast) #flamestrike,if=talent.flame_patch.enabled&active_enemies>2|active_enemies>5 if hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 spell(flamestrike) #fireball spell(fireball) } } AddFunction firerop_phasemainpostconditions { fireactive_talentsmainpostconditions() } AddFunction firerop_phaseshortcdactions { #rune_of_power spell(rune_of_power) unless { hastalent(flame_patch_talent) and enemies() > 1 or enemies() > 4 } and buffpresent(hot_streak_buff) and spell(flamestrike) or buffpresent(hot_streak_buff) and spell(pyroblast) or not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) and not previousoffgcdspell(fire_blast) and { charges(fire_blast) >= 2 or charges(phoenix_flames) >= 1 and hastalent(phoenix_flames_talent) or hastalent(alexstraszas_fury_talent) and spellcooldown(dragons_breath) == 0 or hastalent(searing_touch_talent) and target.healthpercent() <= 30 } and spell(fire_blast) { #call_action_list,name=active_talents fireactive_talentsshortcdactions() unless fireactive_talentsshortcdpostconditions() or buffpresent(pyroclasm) and casttime(pyroblast) < buffremaining(pyroclasm) and totemremaining(rune_of_power) > casttime(pyroblast) and spell(pyroblast) or not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and buffpresent(heating_up_buff) and { target.healthpercent() >= 30 or not hastalent(searing_touch_talent) } and spell(fire_blast) or not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { buffpresent(heating_up_buff) and not executetime(scorch) > 0 or not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) } and spell(fire_blast) or previousgcdspell(scorch) and buffpresent(heating_up_buff) and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { not hastalent(flame_patch_talent) or enemies() == 1 } and spell(pyroblast) or not previousgcdspell(phoenix_flames) and buffpresent(heating_up_buff) and spell(phoenix_flames) or target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(scorch) { #dragons_breath,if=active_enemies>2 if enemies() > 2 and target.distance(less 12) spell(dragons_breath) } } } AddFunction firerop_phaseshortcdpostconditions { { hastalent(flame_patch_talent) and enemies() > 1 or enemies() > 4 } and buffpresent(hot_streak_buff) and spell(flamestrike) or buffpresent(hot_streak_buff) and spell(pyroblast) or not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) and not previousoffgcdspell(fire_blast) and { charges(fire_blast) >= 2 or charges(phoenix_flames) >= 1 and hastalent(phoenix_flames_talent) or hastalent(alexstraszas_fury_talent) and spellcooldown(dragons_breath) == 0 or hastalent(searing_touch_talent) and target.healthpercent() <= 30 } and spell(fire_blast) or fireactive_talentsshortcdpostconditions() or buffpresent(pyroclasm) and casttime(pyroblast) < buffremaining(pyroclasm) and totemremaining(rune_of_power) > casttime(pyroblast) and spell(pyroblast) or not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and buffpresent(heating_up_buff) and { target.healthpercent() >= 30 or not hastalent(searing_touch_talent) } and spell(fire_blast) or not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { buffpresent(heating_up_buff) and not executetime(scorch) > 0 or not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) } and spell(fire_blast) or previousgcdspell(scorch) and buffpresent(heating_up_buff) and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { not hastalent(flame_patch_talent) or enemies() == 1 } and spell(pyroblast) or not previousgcdspell(phoenix_flames) and buffpresent(heating_up_buff) and spell(phoenix_flames) or target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(scorch) or { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and { spellcooldown(combustion) > 0 or 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and buffexpires(hot_streak_buff) and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } and spell(fire_blast) or { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and spell(flamestrike) or spell(fireball) } AddFunction firerop_phasecdactions { unless spell(rune_of_power) or { hastalent(flame_patch_talent) and enemies() > 1 or enemies() > 4 } and buffpresent(hot_streak_buff) and spell(flamestrike) or buffpresent(hot_streak_buff) and spell(pyroblast) or not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) and not previousoffgcdspell(fire_blast) and { charges(fire_blast) >= 2 or charges(phoenix_flames) >= 1 and hastalent(phoenix_flames_talent) or hastalent(alexstraszas_fury_talent) and spellcooldown(dragons_breath) == 0 or hastalent(searing_touch_talent) and target.healthpercent() <= 30 } and spell(fire_blast) { #call_action_list,name=active_talents fireactive_talentscdactions() } } AddFunction firerop_phasecdpostconditions { spell(rune_of_power) or { hastalent(flame_patch_talent) and enemies() > 1 or enemies() > 4 } and buffpresent(hot_streak_buff) and spell(flamestrike) or buffpresent(hot_streak_buff) and spell(pyroblast) or not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) and not previousoffgcdspell(fire_blast) and { charges(fire_blast) >= 2 or charges(phoenix_flames) >= 1 and hastalent(phoenix_flames_talent) or hastalent(alexstraszas_fury_talent) and spellcooldown(dragons_breath) == 0 or hastalent(searing_touch_talent) and target.healthpercent() <= 30 } and spell(fire_blast) or fireactive_talentscdpostconditions() or buffpresent(pyroclasm) and casttime(pyroblast) < buffremaining(pyroclasm) and totemremaining(rune_of_power) > casttime(pyroblast) and spell(pyroblast) or not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and buffpresent(heating_up_buff) and { target.healthpercent() >= 30 or not hastalent(searing_touch_talent) } and spell(fire_blast) or not { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and { spellcooldown(combustion) > 0 or 0 } and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { buffpresent(heating_up_buff) and not executetime(scorch) > 0 or not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) } and spell(fire_blast) or previousgcdspell(scorch) and buffpresent(heating_up_buff) and hastalent(searing_touch_talent) and target.healthpercent() <= 30 and { not hastalent(flame_patch_talent) or enemies() == 1 } and spell(pyroblast) or not previousgcdspell(phoenix_flames) and buffpresent(heating_up_buff) and spell(phoenix_flames) or target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(scorch) or enemies() > 2 and target.distance(less 12) and spell(dragons_breath) or { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and { spellcooldown(combustion) > 0 or 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } and buffexpires(hot_streak_buff) and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } and spell(fire_blast) or { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 5 } and spell(flamestrike) or spell(fireball) } ### actions.precombat AddFunction fireprecombatmainactions { #flask #food #augmentation #arcane_intellect spell(arcane_intellect) #pyroblast spell(pyroblast) } AddFunction fireprecombatmainpostconditions { } AddFunction fireprecombatshortcdactions { } AddFunction fireprecombatshortcdpostconditions { spell(arcane_intellect) or spell(pyroblast) } AddFunction fireprecombatcdactions { unless spell(arcane_intellect) { #variable,name=disable_combustion,op=reset #variable,name=combustion_rop_cutoff,op=set,value=60 #variable,name=combustion_on_use,op=set,value=equipped.manifesto_of_madness|equipped.gladiators_badge|equipped.gladiators_medallion|equipped.ignition_mages_fuse|equipped.tzanes_barkspines|equipped.azurethos_singed_plumage|equipped.ancient_knot_of_wisdom|equipped.shockbiters_fang|equipped.neural_synapse_enhancer|equipped.balefire_branch #variable,name=font_double_on_use,op=set,value=equipped.azsharas_font_of_power&variable.combustion_on_use #variable,name=font_of_power_precombat_channel,op=set,value=18,if=variable.font_double_on_use&variable.font_of_power_precombat_channel=0 #variable,name=on_use_cutoff,op=set,value=20*variable.combustion_on_use&!variable.font_double_on_use+40*variable.font_double_on_use+25*equipped.azsharas_font_of_power&!variable.font_double_on_use+8*equipped.manifesto_of_madness&!variable.font_double_on_use #snapshot_stats #use_item,name=azsharas_font_of_power,if=!variable.disable_combustion if not 0 fireuseitemactions() #mirror_image spell(mirror_image) #potion if checkboxon(opt_use_consumables) and target.classification(worldboss) item(unbridled_fury_item usable=1) } } AddFunction fireprecombatcdpostconditions { spell(arcane_intellect) or spell(pyroblast) } ### actions.items_low_priority AddFunction fireitems_low_prioritymainactions { } AddFunction fireitems_low_prioritymainpostconditions { } AddFunction fireitems_low_priorityshortcdactions { } AddFunction fireitems_low_priorityshortcdpostconditions { } AddFunction fireitems_low_prioritycdactions { #use_item,name=tidestorm_codex,if=cooldown.combustion.remains>variable.on_use_cutoff|variable.disable_combustion|talent.firestarter.enabled&firestarter.remains>variable.on_use_cutoff if spellcooldown(combustion) > on_use_cutoff() or 0 or hastalent(firestarter_talent) and target.timetohealthpercent(90) > on_use_cutoff() fireuseitemactions() #use_item,effect_name=cyclotronic_blast,if=cooldown.combustion.remains>variable.on_use_cutoff|variable.disable_combustion|talent.firestarter.enabled&firestarter.remains>variable.on_use_cutoff if spellcooldown(combustion) > on_use_cutoff() or 0 or hastalent(firestarter_talent) and target.timetohealthpercent(90) > on_use_cutoff() fireuseitemactions() } AddFunction fireitems_low_prioritycdpostconditions { } ### actions.items_high_priority AddFunction fireitems_high_prioritymainactions { #call_action_list,name=items_combustion,if=!variable.disable_combustion&(talent.rune_of_power.enabled&cooldown.combustion.remains<=action.rune_of_power.cast_time|cooldown.combustion.ready)&!firestarter.active|buff.combustion.up if not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) fireitems_combustionmainactions() } AddFunction fireitems_high_prioritymainpostconditions { { not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) } and fireitems_combustionmainpostconditions() } AddFunction fireitems_high_priorityshortcdactions { #call_action_list,name=items_combustion,if=!variable.disable_combustion&(talent.rune_of_power.enabled&cooldown.combustion.remains<=action.rune_of_power.cast_time|cooldown.combustion.ready)&!firestarter.active|buff.combustion.up if not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) fireitems_combustionshortcdactions() } AddFunction fireitems_high_priorityshortcdpostconditions { { not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) } and fireitems_combustionshortcdpostconditions() } AddFunction fireitems_high_prioritycdactions { #call_action_list,name=items_combustion,if=!variable.disable_combustion&(talent.rune_of_power.enabled&cooldown.combustion.remains<=action.rune_of_power.cast_time|cooldown.combustion.ready)&!firestarter.active|buff.combustion.up if not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) fireitems_combustioncdactions() unless { not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) } and fireitems_combustioncdpostconditions() { #use_items fireuseitemactions() #use_item,name=manifesto_of_madness,if=!equipped.azsharas_font_of_power&cooldown.combustion.remains<8 if not hasequippeditem(azsharas_font_of_power_item) and spellcooldown(combustion) < 8 fireuseitemactions() #use_item,name=azsharas_font_of_power,if=cooldown.combustion.remains<=5+15*variable.font_double_on_use&!variable.disable_combustion if spellcooldown(combustion) <= 5 + 15 * font_double_on_use() and not 0 fireuseitemactions() #use_item,name=rotcrusted_voodoo_doll,if=cooldown.combustion.remains>variable.on_use_cutoff|variable.disable_combustion if spellcooldown(combustion) > on_use_cutoff() or 0 fireuseitemactions() #use_item,name=aquipotent_nautilus,if=cooldown.combustion.remains>variable.on_use_cutoff|variable.disable_combustion if spellcooldown(combustion) > on_use_cutoff() or 0 fireuseitemactions() #use_item,name=shiver_venom_relic,if=cooldown.combustion.remains>variable.on_use_cutoff|variable.disable_combustion if spellcooldown(combustion) > on_use_cutoff() or 0 fireuseitemactions() #use_item,name=forbidden_obsidian_claw,if=cooldown.combustion.remains>variable.on_use_cutoff|variable.disable_combustion if spellcooldown(combustion) > on_use_cutoff() or 0 fireuseitemactions() #use_item,effect_name=harmonic_dematerializer fireuseitemactions() #use_item,name=malformed_heralds_legwraps,if=cooldown.combustion.remains>=55&buff.combustion.down&cooldown.combustion.remains>variable.on_use_cutoff|variable.disable_combustion if spellcooldown(combustion) >= 55 and buffexpires(combustion_buff) and spellcooldown(combustion) > on_use_cutoff() or 0 fireuseitemactions() #use_item,name=ancient_knot_of_wisdom,if=cooldown.combustion.remains>=55&buff.combustion.down&cooldown.combustion.remains>variable.on_use_cutoff|variable.disable_combustion if spellcooldown(combustion) >= 55 and buffexpires(combustion_buff) and spellcooldown(combustion) > on_use_cutoff() or 0 fireuseitemactions() #use_item,name=neural_synapse_enhancer,if=cooldown.combustion.remains>=45&buff.combustion.down&cooldown.combustion.remains>variable.on_use_cutoff|variable.disable_combustion if spellcooldown(combustion) >= 45 and buffexpires(combustion_buff) and spellcooldown(combustion) > on_use_cutoff() or 0 fireuseitemactions() } } AddFunction fireitems_high_prioritycdpostconditions { { not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) } and fireitems_combustioncdpostconditions() } ### actions.items_combustion AddFunction fireitems_combustionmainactions { } AddFunction fireitems_combustionmainpostconditions { } AddFunction fireitems_combustionshortcdactions { #cancel_buff,use_off_gcd=1,name=manifesto_of_madness_chapter_one,if=buff.combustion.up|action.meteor.in_flight&action.meteor.in_flight_remains<=0.5 if { buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 } and buffpresent(manifesto_of_madness_chapter_one) texture(manifesto_of_madness_chapter_one text=cancel) } AddFunction fireitems_combustionshortcdpostconditions { } AddFunction fireitems_combustioncdactions { #use_item,name=ignition_mages_fuse fireuseitemactions() #use_item,name=hyperthread_wristwraps,if=buff.combustion.up&action.fire_blast.charges=0&action.fire_blast.recharge_time>gcd.max if buffpresent(combustion_buff) and charges(fire_blast) == 0 and spellchargecooldown(fire_blast) > gcd() fireuseitemactions() #use_item,name=manifesto_of_madness fireuseitemactions() unless { buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 } and buffpresent(manifesto_of_madness_chapter_one) and texture(manifesto_of_madness_chapter_one text=cancel) { #use_item,use_off_gcd=1,name=azurethos_singed_plumage,if=buff.combustion.up|action.meteor.in_flight&action.meteor.in_flight_remains<=0.5 if buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 fireuseitemactions() #use_item,use_off_gcd=1,effect_name=gladiators_badge,if=buff.combustion.up|action.meteor.in_flight&action.meteor.in_flight_remains<=0.5 if buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 fireuseitemactions() #use_item,use_off_gcd=1,effect_name=gladiators_medallion,if=buff.combustion.up|action.meteor.in_flight&action.meteor.in_flight_remains<=0.5 if buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 fireuseitemactions() #use_item,use_off_gcd=1,name=balefire_branch,if=buff.combustion.up|action.meteor.in_flight&action.meteor.in_flight_remains<=0.5 if buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 fireuseitemactions() #use_item,use_off_gcd=1,name=shockbiters_fang,if=buff.combustion.up|action.meteor.in_flight&action.meteor.in_flight_remains<=0.5 if buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 fireuseitemactions() #use_item,use_off_gcd=1,name=tzanes_barkspines,if=buff.combustion.up|action.meteor.in_flight&action.meteor.in_flight_remains<=0.5 if buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 fireuseitemactions() #use_item,use_off_gcd=1,name=ancient_knot_of_wisdom,if=buff.combustion.up|action.meteor.in_flight&action.meteor.in_flight_remains<=0.5 if buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 fireuseitemactions() #use_item,use_off_gcd=1,name=neural_synapse_enhancer,if=buff.combustion.up|action.meteor.in_flight&action.meteor.in_flight_remains<=0.5 if buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 fireuseitemactions() #use_item,use_off_gcd=1,name=malformed_heralds_legwraps,if=buff.combustion.up|action.meteor.in_flight&action.meteor.in_flight_remains<=0.5 if buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 fireuseitemactions() } } AddFunction fireitems_combustioncdpostconditions { { buffpresent(combustion_buff) or inflighttotarget(meteor) and 0 <= 0.5 } and buffpresent(manifesto_of_madness_chapter_one) and texture(manifesto_of_madness_chapter_one text=cancel) } ### actions.combustion_phase AddFunction firecombustion_phasemainactions { #living_bomb,if=active_enemies>1&buff.combustion.down if enemies() > 1 and buffexpires(combustion_buff) spell(living_bomb) #fire_blast,use_while_casting=1,use_off_gcd=1,if=charges>=1&((action.fire_blast.charges_fractional+(buff.combustion.remains-buff.blaster_master.duration)%cooldown.fire_blast.duration-(buff.combustion.remains)%(buff.blaster_master.duration-0.5))>=0|!azerite.blaster_master.enabled|!talent.flame_on.enabled|buff.combustion.remains<=buff.blaster_master.duration|buff.blaster_master.remains<0.5|equipped.hyperthread_wristwraps&cooldown.hyperthread_wristwraps_300142.remains<5)&buff.combustion.up&(!action.scorch.executing&!action.pyroblast.in_flight&buff.heating_up.up|action.scorch.executing&buff.hot_streak.down&(buff.heating_up.down|azerite.blaster_master.enabled)|azerite.blaster_master.enabled&talent.flame_on.enabled&action.pyroblast.in_flight&buff.heating_up.down&buff.hot_streak.down) if charges(fire_blast) >= 1 and { charges(fire_blast count=0) + { buffremaining(combustion_buff) - baseduration(blaster_master_buff) } / spellcooldownduration(fire_blast) - buffremaining(combustion_buff) / { baseduration(blaster_master_buff) - 0.5 } >= 0 or not hasazeritetrait(blaster_master_trait) or not hastalent(flame_on_talent) or buffremaining(combustion_buff) <= baseduration(blaster_master_buff) or buffremaining(blaster_master_buff) < 0.5 or hasequippeditem(hyperthread_wristwraps_item) and spellcooldown(hyperthread_wristwraps_300142) < 5 } and buffpresent(combustion_buff) and { not executetime(scorch) > 0 and not inflighttotarget(pyroblast) and buffpresent(heating_up_buff) or executetime(scorch) > 0 and buffexpires(hot_streak_buff) and { buffexpires(heating_up_buff) or hasazeritetrait(blaster_master_trait) } or hasazeritetrait(blaster_master_trait) and hastalent(flame_on_talent) and inflighttotarget(pyroblast) and buffexpires(heating_up_buff) and buffexpires(hot_streak_buff) } spell(fire_blast) #fire_blast,use_while_casting=1,if=azerite.blaster_master.enabled&(essence.memory_of_lucid_dreams.major|!essence.memory_of_lucid_dreams.minor)&talent.meteor.enabled&talent.flame_on.enabled&buff.blaster_master.down&(talent.rune_of_power.enabled&action.rune_of_power.executing&action.rune_of_power.execute_remains<0.6|(cooldown.combustion.ready|buff.combustion.up)&!talent.rune_of_power.enabled&!action.pyroblast.in_flight&!action.fireball.in_flight) if hasazeritetrait(blaster_master_trait) and { azeriteessenceismajor(memory_of_lucid_dreams_essence_id) or not azeriteessenceisminor(memory_of_lucid_dreams_essence_id) } and hastalent(meteor_talent) and hastalent(flame_on_talent) and buffexpires(blaster_master_buff) and { hastalent(rune_of_power_talent) and executetime(rune_of_power) > 0 and executetime(rune_of_power) < 0.6 or { spellcooldown(combustion) == 0 or buffpresent(combustion_buff) } and not hastalent(rune_of_power_talent) and not inflighttotarget(pyroblast) and not inflighttotarget(fireball) } spell(fire_blast) #call_action_list,name=active_talents fireactive_talentsmainactions() unless fireactive_talentsmainpostconditions() { #flamestrike,if=((talent.flame_patch.enabled&active_enemies>2)|active_enemies>6)&buff.hot_streak.react&!azerite.blaster_master.enabled if { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 6 } and buffpresent(hot_streak_buff) and not hasazeritetrait(blaster_master_trait) spell(flamestrike) #pyroblast,if=buff.pyroclasm.react&buff.combustion.remains>cast_time if buffpresent(pyroclasm) and buffremaining(combustion_buff) > casttime(pyroblast) spell(pyroblast) #pyroblast,if=buff.hot_streak.react if buffpresent(hot_streak_buff) spell(pyroblast) #pyroblast,if=prev_gcd.1.scorch&buff.heating_up.up if previousgcdspell(scorch) and buffpresent(heating_up_buff) spell(pyroblast) #phoenix_flames spell(phoenix_flames) #scorch,if=buff.combustion.remains>cast_time&buff.combustion.up|buff.combustion.down if buffremaining(combustion_buff) > casttime(scorch) and buffpresent(combustion_buff) or buffexpires(combustion_buff) spell(scorch) #living_bomb,if=buff.combustion.remains<gcd.max&active_enemies>1 if buffremaining(combustion_buff) < gcd() and enemies() > 1 spell(living_bomb) #scorch,if=target.health.pct<=30&talent.searing_touch.enabled if target.healthpercent() <= 30 and hastalent(searing_touch_talent) spell(scorch) } } AddFunction firecombustion_phasemainpostconditions { fireactive_talentsmainpostconditions() } AddFunction firecombustion_phaseshortcdactions { #bag_of_tricks,if=buff.combustion.down if buffexpires(combustion_buff) spell(bag_of_tricks) unless enemies() > 1 and buffexpires(combustion_buff) and spell(living_bomb) or charges(fire_blast) >= 1 and { charges(fire_blast count=0) + { buffremaining(combustion_buff) - baseduration(blaster_master_buff) } / spellcooldownduration(fire_blast) - buffremaining(combustion_buff) / { baseduration(blaster_master_buff) - 0.5 } >= 0 or not hasazeritetrait(blaster_master_trait) or not hastalent(flame_on_talent) or buffremaining(combustion_buff) <= baseduration(blaster_master_buff) or buffremaining(blaster_master_buff) < 0.5 or hasequippeditem(hyperthread_wristwraps_item) and spellcooldown(hyperthread_wristwraps_300142) < 5 } and buffpresent(combustion_buff) and { not executetime(scorch) > 0 and not inflighttotarget(pyroblast) and buffpresent(heating_up_buff) or executetime(scorch) > 0 and buffexpires(hot_streak_buff) and { buffexpires(heating_up_buff) or hasazeritetrait(blaster_master_trait) } or hasazeritetrait(blaster_master_trait) and hastalent(flame_on_talent) and inflighttotarget(pyroblast) and buffexpires(heating_up_buff) and buffexpires(hot_streak_buff) } and spell(fire_blast) { #rune_of_power,if=buff.combustion.down if buffexpires(combustion_buff) spell(rune_of_power) unless hasazeritetrait(blaster_master_trait) and { azeriteessenceismajor(memory_of_lucid_dreams_essence_id) or not azeriteessenceisminor(memory_of_lucid_dreams_essence_id) } and hastalent(meteor_talent) and hastalent(flame_on_talent) and buffexpires(blaster_master_buff) and { hastalent(rune_of_power_talent) and executetime(rune_of_power) > 0 and executetime(rune_of_power) < 0.6 or { spellcooldown(combustion) == 0 or buffpresent(combustion_buff) } and not hastalent(rune_of_power_talent) and not inflighttotarget(pyroblast) and not inflighttotarget(fireball) } and spell(fire_blast) { #call_action_list,name=active_talents fireactive_talentsshortcdactions() unless fireactive_talentsshortcdpostconditions() or { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 6 } and buffpresent(hot_streak_buff) and not hasazeritetrait(blaster_master_trait) and spell(flamestrike) or buffpresent(pyroclasm) and buffremaining(combustion_buff) > casttime(pyroblast) and spell(pyroblast) or buffpresent(hot_streak_buff) and spell(pyroblast) or previousgcdspell(scorch) and buffpresent(heating_up_buff) and spell(pyroblast) or spell(phoenix_flames) or { buffremaining(combustion_buff) > casttime(scorch) and buffpresent(combustion_buff) or buffexpires(combustion_buff) } and spell(scorch) or buffremaining(combustion_buff) < gcd() and enemies() > 1 and spell(living_bomb) { #dragons_breath,if=buff.combustion.remains<gcd.max&buff.combustion.up if buffremaining(combustion_buff) < gcd() and buffpresent(combustion_buff) and target.distance(less 12) spell(dragons_breath) } } } } AddFunction firecombustion_phaseshortcdpostconditions { enemies() > 1 and buffexpires(combustion_buff) and spell(living_bomb) or charges(fire_blast) >= 1 and { charges(fire_blast count=0) + { buffremaining(combustion_buff) - baseduration(blaster_master_buff) } / spellcooldownduration(fire_blast) - buffremaining(combustion_buff) / { baseduration(blaster_master_buff) - 0.5 } >= 0 or not hasazeritetrait(blaster_master_trait) or not hastalent(flame_on_talent) or buffremaining(combustion_buff) <= baseduration(blaster_master_buff) or buffremaining(blaster_master_buff) < 0.5 or hasequippeditem(hyperthread_wristwraps_item) and spellcooldown(hyperthread_wristwraps_300142) < 5 } and buffpresent(combustion_buff) and { not executetime(scorch) > 0 and not inflighttotarget(pyroblast) and buffpresent(heating_up_buff) or executetime(scorch) > 0 and buffexpires(hot_streak_buff) and { buffexpires(heating_up_buff) or hasazeritetrait(blaster_master_trait) } or hasazeritetrait(blaster_master_trait) and hastalent(flame_on_talent) and inflighttotarget(pyroblast) and buffexpires(heating_up_buff) and buffexpires(hot_streak_buff) } and spell(fire_blast) or hasazeritetrait(blaster_master_trait) and { azeriteessenceismajor(memory_of_lucid_dreams_essence_id) or not azeriteessenceisminor(memory_of_lucid_dreams_essence_id) } and hastalent(meteor_talent) and hastalent(flame_on_talent) and buffexpires(blaster_master_buff) and { hastalent(rune_of_power_talent) and executetime(rune_of_power) > 0 and executetime(rune_of_power) < 0.6 or { spellcooldown(combustion) == 0 or buffpresent(combustion_buff) } and not hastalent(rune_of_power_talent) and not inflighttotarget(pyroblast) and not inflighttotarget(fireball) } and spell(fire_blast) or fireactive_talentsshortcdpostconditions() or { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 6 } and buffpresent(hot_streak_buff) and not hasazeritetrait(blaster_master_trait) and spell(flamestrike) or buffpresent(pyroclasm) and buffremaining(combustion_buff) > casttime(pyroblast) and spell(pyroblast) or buffpresent(hot_streak_buff) and spell(pyroblast) or previousgcdspell(scorch) and buffpresent(heating_up_buff) and spell(pyroblast) or spell(phoenix_flames) or { buffremaining(combustion_buff) > casttime(scorch) and buffpresent(combustion_buff) or buffexpires(combustion_buff) } and spell(scorch) or buffremaining(combustion_buff) < gcd() and enemies() > 1 and spell(living_bomb) or target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(scorch) } AddFunction firecombustion_phasecdactions { #lights_judgment,if=buff.combustion.down if buffexpires(combustion_buff) spell(lights_judgment) unless buffexpires(combustion_buff) and spell(bag_of_tricks) or enemies() > 1 and buffexpires(combustion_buff) and spell(living_bomb) { #blood_of_the_enemy spell(blood_of_the_enemy) #memory_of_lucid_dreams spell(memory_of_lucid_dreams_essence) unless charges(fire_blast) >= 1 and { charges(fire_blast count=0) + { buffremaining(combustion_buff) - baseduration(blaster_master_buff) } / spellcooldownduration(fire_blast) - buffremaining(combustion_buff) / { baseduration(blaster_master_buff) - 0.5 } >= 0 or not hasazeritetrait(blaster_master_trait) or not hastalent(flame_on_talent) or buffremaining(combustion_buff) <= baseduration(blaster_master_buff) or buffremaining(blaster_master_buff) < 0.5 or hasequippeditem(hyperthread_wristwraps_item) and spellcooldown(hyperthread_wristwraps_300142) < 5 } and buffpresent(combustion_buff) and { not executetime(scorch) > 0 and not inflighttotarget(pyroblast) and buffpresent(heating_up_buff) or executetime(scorch) > 0 and buffexpires(hot_streak_buff) and { buffexpires(heating_up_buff) or hasazeritetrait(blaster_master_trait) } or hasazeritetrait(blaster_master_trait) and hastalent(flame_on_talent) and inflighttotarget(pyroblast) and buffexpires(heating_up_buff) and buffexpires(hot_streak_buff) } and spell(fire_blast) or buffexpires(combustion_buff) and spell(rune_of_power) or hasazeritetrait(blaster_master_trait) and { azeriteessenceismajor(memory_of_lucid_dreams_essence_id) or not azeriteessenceisminor(memory_of_lucid_dreams_essence_id) } and hastalent(meteor_talent) and hastalent(flame_on_talent) and buffexpires(blaster_master_buff) and { hastalent(rune_of_power_talent) and executetime(rune_of_power) > 0 and executetime(rune_of_power) < 0.6 or { spellcooldown(combustion) == 0 or buffpresent(combustion_buff) } and not hastalent(rune_of_power_talent) and not inflighttotarget(pyroblast) and not inflighttotarget(fireball) } and spell(fire_blast) { #call_action_list,name=active_talents fireactive_talentscdactions() unless fireactive_talentscdpostconditions() { #combustion,use_off_gcd=1,use_while_casting=1,if=((action.meteor.in_flight&action.meteor.in_flight_remains<=0.5)|!talent.meteor.enabled)&(buff.rune_of_power.up|!talent.rune_of_power.enabled) if { inflighttotarget(meteor) and 0 <= 0.5 or not hastalent(meteor_talent) } and { buffpresent(rune_of_power_buff) or not hastalent(rune_of_power_talent) } spell(combustion) #potion if checkboxon(opt_use_consumables) and target.classification(worldboss) item(unbridled_fury_item usable=1) #blood_fury spell(blood_fury_sp) #berserking spell(berserking) #fireblood spell(fireblood) #ancestral_call spell(ancestral_call) } } } } AddFunction firecombustion_phasecdpostconditions { buffexpires(combustion_buff) and spell(bag_of_tricks) or enemies() > 1 and buffexpires(combustion_buff) and spell(living_bomb) or charges(fire_blast) >= 1 and { charges(fire_blast count=0) + { buffremaining(combustion_buff) - baseduration(blaster_master_buff) } / spellcooldownduration(fire_blast) - buffremaining(combustion_buff) / { baseduration(blaster_master_buff) - 0.5 } >= 0 or not hasazeritetrait(blaster_master_trait) or not hastalent(flame_on_talent) or buffremaining(combustion_buff) <= baseduration(blaster_master_buff) or buffremaining(blaster_master_buff) < 0.5 or hasequippeditem(hyperthread_wristwraps_item) and spellcooldown(hyperthread_wristwraps_300142) < 5 } and buffpresent(combustion_buff) and { not executetime(scorch) > 0 and not inflighttotarget(pyroblast) and buffpresent(heating_up_buff) or executetime(scorch) > 0 and buffexpires(hot_streak_buff) and { buffexpires(heating_up_buff) or hasazeritetrait(blaster_master_trait) } or hasazeritetrait(blaster_master_trait) and hastalent(flame_on_talent) and inflighttotarget(pyroblast) and buffexpires(heating_up_buff) and buffexpires(hot_streak_buff) } and spell(fire_blast) or buffexpires(combustion_buff) and spell(rune_of_power) or hasazeritetrait(blaster_master_trait) and { azeriteessenceismajor(memory_of_lucid_dreams_essence_id) or not azeriteessenceisminor(memory_of_lucid_dreams_essence_id) } and hastalent(meteor_talent) and hastalent(flame_on_talent) and buffexpires(blaster_master_buff) and { hastalent(rune_of_power_talent) and executetime(rune_of_power) > 0 and executetime(rune_of_power) < 0.6 or { spellcooldown(combustion) == 0 or buffpresent(combustion_buff) } and not hastalent(rune_of_power_talent) and not inflighttotarget(pyroblast) and not inflighttotarget(fireball) } and spell(fire_blast) or fireactive_talentscdpostconditions() or { hastalent(flame_patch_talent) and enemies() > 2 or enemies() > 6 } and buffpresent(hot_streak_buff) and not hasazeritetrait(blaster_master_trait) and spell(flamestrike) or buffpresent(pyroclasm) and buffremaining(combustion_buff) > casttime(pyroblast) and spell(pyroblast) or buffpresent(hot_streak_buff) and spell(pyroblast) or previousgcdspell(scorch) and buffpresent(heating_up_buff) and spell(pyroblast) or spell(phoenix_flames) or { buffremaining(combustion_buff) > casttime(scorch) and buffpresent(combustion_buff) or buffexpires(combustion_buff) } and spell(scorch) or buffremaining(combustion_buff) < gcd() and enemies() > 1 and spell(living_bomb) or buffremaining(combustion_buff) < gcd() and buffpresent(combustion_buff) and target.distance(less 12) and spell(dragons_breath) or target.healthpercent() <= 30 and hastalent(searing_touch_talent) and spell(scorch) } ### actions.active_talents AddFunction fireactive_talentsmainactions { #living_bomb,if=active_enemies>1&buff.combustion.down&(cooldown.combustion.remains>cooldown.living_bomb.duration|cooldown.combustion.ready|variable.disable_combustion) if enemies() > 1 and buffexpires(combustion_buff) and { spellcooldown(combustion) > spellcooldownduration(living_bomb) or spellcooldown(combustion) == 0 or 0 } spell(living_bomb) } AddFunction fireactive_talentsmainpostconditions { } AddFunction fireactive_talentsshortcdactions { unless enemies() > 1 and buffexpires(combustion_buff) and { spellcooldown(combustion) > spellcooldownduration(living_bomb) or spellcooldown(combustion) == 0 or 0 } and spell(living_bomb) { #meteor,if=buff.rune_of_power.up&(firestarter.remains>cooldown.meteor.duration|!firestarter.active)|cooldown.rune_of_power.remains>target.time_to_die&action.rune_of_power.charges<1|(cooldown.meteor.duration<cooldown.combustion.remains|cooldown.combustion.ready|variable.disable_combustion)&!talent.rune_of_power.enabled&(cooldown.meteor.duration<firestarter.remains|!talent.firestarter.enabled|!firestarter.active) if buffpresent(rune_of_power_buff) and { target.timetohealthpercent(90) > spellcooldownduration(meteor) or not { talent(firestarter_talent) and target.healthpercent() >= 90 } } or spellcooldown(rune_of_power) > target.timetodie() and charges(rune_of_power) < 1 or { spellcooldownduration(meteor) < spellcooldown(combustion) or spellcooldown(combustion) == 0 or 0 } and not hastalent(rune_of_power_talent) and { spellcooldownduration(meteor) < target.timetohealthpercent(90) or not hastalent(firestarter_talent) or not { talent(firestarter_talent) and target.healthpercent() >= 90 } } spell(meteor) } } AddFunction fireactive_talentsshortcdpostconditions { enemies() > 1 and buffexpires(combustion_buff) and { spellcooldown(combustion) > spellcooldownduration(living_bomb) or spellcooldown(combustion) == 0 or 0 } and spell(living_bomb) } AddFunction fireactive_talentscdactions { } AddFunction fireactive_talentscdpostconditions { enemies() > 1 and buffexpires(combustion_buff) and { spellcooldown(combustion) > spellcooldownduration(living_bomb) or spellcooldown(combustion) == 0 or 0 } and spell(living_bomb) or { buffpresent(rune_of_power_buff) and { target.timetohealthpercent(90) > spellcooldownduration(meteor) or not { talent(firestarter_talent) and target.healthpercent() >= 90 } } or spellcooldown(rune_of_power) > target.timetodie() and charges(rune_of_power) < 1 or { spellcooldownduration(meteor) < spellcooldown(combustion) or spellcooldown(combustion) == 0 or 0 } and not hastalent(rune_of_power_talent) and { spellcooldownduration(meteor) < target.timetohealthpercent(90) or not hastalent(firestarter_talent) or not { talent(firestarter_talent) and target.healthpercent() >= 90 } } } and spell(meteor) } ### actions.default AddFunction fire_defaultmainactions { #call_action_list,name=items_high_priority fireitems_high_prioritymainactions() unless fireitems_high_prioritymainpostconditions() { #concentrated_flame spell(concentrated_flame_essence) #call_action_list,name=combustion_phase,if=!variable.disable_combustion&(talent.rune_of_power.enabled&cooldown.combustion.remains<=action.rune_of_power.cast_time|cooldown.combustion.ready)&!firestarter.active|buff.combustion.up if not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) firecombustion_phasemainactions() unless { not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) } and firecombustion_phasemainpostconditions() { #fire_blast,use_while_casting=1,use_off_gcd=1,if=(essence.memory_of_lucid_dreams.major|essence.memory_of_lucid_dreams.minor&azerite.blaster_master.enabled)&charges=max_charges&!buff.hot_streak.react&!(buff.heating_up.react&(buff.combustion.up&(action.fireball.in_flight|action.pyroblast.in_flight|action.scorch.executing)|target.health.pct<=30&action.scorch.executing))&!(!buff.heating_up.react&!buff.hot_streak.react&buff.combustion.down&(action.fireball.in_flight|action.pyroblast.in_flight)) if { azeriteessenceismajor(memory_of_lucid_dreams_essence_id) or azeriteessenceisminor(memory_of_lucid_dreams_essence_id) and hasazeritetrait(blaster_master_trait) } and charges(fire_blast) == spellmaxcharges(fire_blast) and not buffpresent(hot_streak_buff) and not { buffpresent(heating_up_buff) and { buffpresent(combustion_buff) and { inflighttotarget(fireball) or inflighttotarget(pyroblast) or executetime(scorch) > 0 } or target.healthpercent() <= 30 and executetime(scorch) > 0 } } and not { not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) and buffexpires(combustion_buff) and { inflighttotarget(fireball) or inflighttotarget(pyroblast) } } spell(fire_blast) #fire_blast,use_while_casting=1,use_off_gcd=1,if=firestarter.active&charges>=1&(!variable.fire_blast_pooling|buff.rune_of_power.up)&(!azerite.blaster_master.enabled|buff.blaster_master.remains<0.5)&(!action.fireball.executing&!action.pyroblast.in_flight&buff.heating_up.up|action.fireball.executing&buff.hot_streak.down|action.pyroblast.in_flight&buff.heating_up.down&buff.hot_streak.down) if talent(firestarter_talent) and target.healthpercent() >= 90 and charges(fire_blast) >= 1 and { not fire_blast_pooling() or buffpresent(rune_of_power_buff) } and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } and { not executetime(fireball) > 0 and not inflighttotarget(pyroblast) and buffpresent(heating_up_buff) or executetime(fireball) > 0 and buffexpires(hot_streak_buff) or inflighttotarget(pyroblast) and buffexpires(heating_up_buff) and buffexpires(hot_streak_buff) } spell(fire_blast) #call_action_list,name=rop_phase,if=buff.rune_of_power.up&buff.combustion.down if buffpresent(rune_of_power_buff) and buffexpires(combustion_buff) firerop_phasemainactions() unless buffpresent(rune_of_power_buff) and buffexpires(combustion_buff) and firerop_phasemainpostconditions() { #variable,name=fire_blast_pooling,value=talent.rune_of_power.enabled&cooldown.rune_of_power.remains<cooldown.fire_blast.full_recharge_time&(cooldown.combustion.remains>variable.combustion_rop_cutoff|variable.disable_combustion|firestarter.active)&(cooldown.rune_of_power.remains<target.time_to_die|action.rune_of_power.charges>0)|!variable.disable_combustion&cooldown.combustion.remains<action.fire_blast.full_recharge_time+cooldown.fire_blast.duration*azerite.blaster_master.enabled&!firestarter.active&cooldown.combustion.remains<target.time_to_die|talent.firestarter.enabled&firestarter.active&firestarter.remains<cooldown.fire_blast.full_recharge_time+cooldown.fire_blast.duration*azerite.blaster_master.enabled #variable,name=phoenix_pooling,value=talent.rune_of_power.enabled&cooldown.rune_of_power.remains<cooldown.phoenix_flames.full_recharge_time&(cooldown.combustion.remains>variable.combustion_rop_cutoff|variable.disable_combustion)&(cooldown.rune_of_power.remains<target.time_to_die|action.rune_of_power.charges>0)|!variable.disable_combustion&cooldown.combustion.remains<action.phoenix_flames.full_recharge_time&cooldown.combustion.remains<target.time_to_die #call_action_list,name=standard_rotation firestandard_rotationmainactions() } } } } AddFunction fire_defaultmainpostconditions { fireitems_high_prioritymainpostconditions() or { not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) } and firecombustion_phasemainpostconditions() or buffpresent(rune_of_power_buff) and buffexpires(combustion_buff) and firerop_phasemainpostconditions() or firestandard_rotationmainpostconditions() } AddFunction fire_defaultshortcdactions { #call_action_list,name=items_high_priority fireitems_high_priorityshortcdactions() unless fireitems_high_priorityshortcdpostconditions() or spell(concentrated_flame_essence) { #reaping_flames spell(reaping_flames) #purifying_blast spell(purifying_blast) #ripple_in_space spell(ripple_in_space_essence) #the_unbound_force spell(the_unbound_force) #worldvein_resonance spell(worldvein_resonance_essence) #rune_of_power,if=talent.firestarter.enabled&firestarter.remains>full_recharge_time|cooldown.combustion.remains>variable.combustion_rop_cutoff&buff.combustion.down|target.time_to_die<cooldown.combustion.remains&buff.combustion.down|variable.disable_combustion if hastalent(firestarter_talent) and target.timetohealthpercent(90) > spellfullrecharge(rune_of_power) or spellcooldown(combustion) > combustion_rop_cutoff() and buffexpires(combustion_buff) or target.timetodie() < spellcooldown(combustion) and buffexpires(combustion_buff) or 0 spell(rune_of_power) #call_action_list,name=combustion_phase,if=!variable.disable_combustion&(talent.rune_of_power.enabled&cooldown.combustion.remains<=action.rune_of_power.cast_time|cooldown.combustion.ready)&!firestarter.active|buff.combustion.up if not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) firecombustion_phaseshortcdactions() unless { not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) } and firecombustion_phaseshortcdpostconditions() or { azeriteessenceismajor(memory_of_lucid_dreams_essence_id) or azeriteessenceisminor(memory_of_lucid_dreams_essence_id) and hasazeritetrait(blaster_master_trait) } and charges(fire_blast) == spellmaxcharges(fire_blast) and not buffpresent(hot_streak_buff) and not { buffpresent(heating_up_buff) and { buffpresent(combustion_buff) and { inflighttotarget(fireball) or inflighttotarget(pyroblast) or executetime(scorch) > 0 } or target.healthpercent() <= 30 and executetime(scorch) > 0 } } and not { not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) and buffexpires(combustion_buff) and { inflighttotarget(fireball) or inflighttotarget(pyroblast) } } and spell(fire_blast) or talent(firestarter_talent) and target.healthpercent() >= 90 and charges(fire_blast) >= 1 and { not fire_blast_pooling() or buffpresent(rune_of_power_buff) } and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } and { not executetime(fireball) > 0 and not inflighttotarget(pyroblast) and buffpresent(heating_up_buff) or executetime(fireball) > 0 and buffexpires(hot_streak_buff) or inflighttotarget(pyroblast) and buffexpires(heating_up_buff) and buffexpires(hot_streak_buff) } and spell(fire_blast) { #call_action_list,name=rop_phase,if=buff.rune_of_power.up&buff.combustion.down if buffpresent(rune_of_power_buff) and buffexpires(combustion_buff) firerop_phaseshortcdactions() unless buffpresent(rune_of_power_buff) and buffexpires(combustion_buff) and firerop_phaseshortcdpostconditions() { #variable,name=fire_blast_pooling,value=talent.rune_of_power.enabled&cooldown.rune_of_power.remains<cooldown.fire_blast.full_recharge_time&(cooldown.combustion.remains>variable.combustion_rop_cutoff|variable.disable_combustion|firestarter.active)&(cooldown.rune_of_power.remains<target.time_to_die|action.rune_of_power.charges>0)|!variable.disable_combustion&cooldown.combustion.remains<action.fire_blast.full_recharge_time+cooldown.fire_blast.duration*azerite.blaster_master.enabled&!firestarter.active&cooldown.combustion.remains<target.time_to_die|talent.firestarter.enabled&firestarter.active&firestarter.remains<cooldown.fire_blast.full_recharge_time+cooldown.fire_blast.duration*azerite.blaster_master.enabled #variable,name=phoenix_pooling,value=talent.rune_of_power.enabled&cooldown.rune_of_power.remains<cooldown.phoenix_flames.full_recharge_time&(cooldown.combustion.remains>variable.combustion_rop_cutoff|variable.disable_combustion)&(cooldown.rune_of_power.remains<target.time_to_die|action.rune_of_power.charges>0)|!variable.disable_combustion&cooldown.combustion.remains<action.phoenix_flames.full_recharge_time&cooldown.combustion.remains<target.time_to_die #call_action_list,name=standard_rotation firestandard_rotationshortcdactions() } } } } AddFunction fire_defaultshortcdpostconditions { fireitems_high_priorityshortcdpostconditions() or spell(concentrated_flame_essence) or { not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) } and firecombustion_phaseshortcdpostconditions() or { azeriteessenceismajor(memory_of_lucid_dreams_essence_id) or azeriteessenceisminor(memory_of_lucid_dreams_essence_id) and hasazeritetrait(blaster_master_trait) } and charges(fire_blast) == spellmaxcharges(fire_blast) and not buffpresent(hot_streak_buff) and not { buffpresent(heating_up_buff) and { buffpresent(combustion_buff) and { inflighttotarget(fireball) or inflighttotarget(pyroblast) or executetime(scorch) > 0 } or target.healthpercent() <= 30 and executetime(scorch) > 0 } } and not { not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) and buffexpires(combustion_buff) and { inflighttotarget(fireball) or inflighttotarget(pyroblast) } } and spell(fire_blast) or talent(firestarter_talent) and target.healthpercent() >= 90 and charges(fire_blast) >= 1 and { not fire_blast_pooling() or buffpresent(rune_of_power_buff) } and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } and { not executetime(fireball) > 0 and not inflighttotarget(pyroblast) and buffpresent(heating_up_buff) or executetime(fireball) > 0 and buffexpires(hot_streak_buff) or inflighttotarget(pyroblast) and buffexpires(heating_up_buff) and buffexpires(hot_streak_buff) } and spell(fire_blast) or buffpresent(rune_of_power_buff) and buffexpires(combustion_buff) and firerop_phaseshortcdpostconditions() or firestandard_rotationshortcdpostconditions() } AddFunction fire_defaultcdactions { #counterspell fireinterruptactions() #call_action_list,name=items_high_priority fireitems_high_prioritycdactions() unless fireitems_high_prioritycdpostconditions() { #mirror_image,if=buff.combustion.down if buffexpires(combustion_buff) spell(mirror_image) #guardian_of_azeroth,if=(cooldown.combustion.remains<10|target.time_to_die<cooldown.combustion.remains)&!variable.disable_combustion if { spellcooldown(combustion) < 10 or target.timetodie() < spellcooldown(combustion) } and not 0 spell(guardian_of_azeroth) unless spell(concentrated_flame_essence) or spell(reaping_flames) { #focused_azerite_beam spell(focused_azerite_beam) unless spell(purifying_blast) or spell(ripple_in_space_essence) or spell(the_unbound_force) or spell(worldvein_resonance_essence) or { hastalent(firestarter_talent) and target.timetohealthpercent(90) > spellfullrecharge(rune_of_power) or spellcooldown(combustion) > combustion_rop_cutoff() and buffexpires(combustion_buff) or target.timetodie() < spellcooldown(combustion) and buffexpires(combustion_buff) or 0 } and spell(rune_of_power) { #call_action_list,name=combustion_phase,if=!variable.disable_combustion&(talent.rune_of_power.enabled&cooldown.combustion.remains<=action.rune_of_power.cast_time|cooldown.combustion.ready)&!firestarter.active|buff.combustion.up if not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) firecombustion_phasecdactions() unless { not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) } and firecombustion_phasecdpostconditions() or { azeriteessenceismajor(memory_of_lucid_dreams_essence_id) or azeriteessenceisminor(memory_of_lucid_dreams_essence_id) and hasazeritetrait(blaster_master_trait) } and charges(fire_blast) == spellmaxcharges(fire_blast) and not buffpresent(hot_streak_buff) and not { buffpresent(heating_up_buff) and { buffpresent(combustion_buff) and { inflighttotarget(fireball) or inflighttotarget(pyroblast) or executetime(scorch) > 0 } or target.healthpercent() <= 30 and executetime(scorch) > 0 } } and not { not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) and buffexpires(combustion_buff) and { inflighttotarget(fireball) or inflighttotarget(pyroblast) } } and spell(fire_blast) or talent(firestarter_talent) and target.healthpercent() >= 90 and charges(fire_blast) >= 1 and { not fire_blast_pooling() or buffpresent(rune_of_power_buff) } and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } and { not executetime(fireball) > 0 and not inflighttotarget(pyroblast) and buffpresent(heating_up_buff) or executetime(fireball) > 0 and buffexpires(hot_streak_buff) or inflighttotarget(pyroblast) and buffexpires(heating_up_buff) and buffexpires(hot_streak_buff) } and spell(fire_blast) { #call_action_list,name=rop_phase,if=buff.rune_of_power.up&buff.combustion.down if buffpresent(rune_of_power_buff) and buffexpires(combustion_buff) firerop_phasecdactions() unless buffpresent(rune_of_power_buff) and buffexpires(combustion_buff) and firerop_phasecdpostconditions() { #variable,name=fire_blast_pooling,value=talent.rune_of_power.enabled&cooldown.rune_of_power.remains<cooldown.fire_blast.full_recharge_time&(cooldown.combustion.remains>variable.combustion_rop_cutoff|variable.disable_combustion|firestarter.active)&(cooldown.rune_of_power.remains<target.time_to_die|action.rune_of_power.charges>0)|!variable.disable_combustion&cooldown.combustion.remains<action.fire_blast.full_recharge_time+cooldown.fire_blast.duration*azerite.blaster_master.enabled&!firestarter.active&cooldown.combustion.remains<target.time_to_die|talent.firestarter.enabled&firestarter.active&firestarter.remains<cooldown.fire_blast.full_recharge_time+cooldown.fire_blast.duration*azerite.blaster_master.enabled #variable,name=phoenix_pooling,value=talent.rune_of_power.enabled&cooldown.rune_of_power.remains<cooldown.phoenix_flames.full_recharge_time&(cooldown.combustion.remains>variable.combustion_rop_cutoff|variable.disable_combustion)&(cooldown.rune_of_power.remains<target.time_to_die|action.rune_of_power.charges>0)|!variable.disable_combustion&cooldown.combustion.remains<action.phoenix_flames.full_recharge_time&cooldown.combustion.remains<target.time_to_die #call_action_list,name=standard_rotation firestandard_rotationcdactions() } } } } } } AddFunction fire_defaultcdpostconditions { fireitems_high_prioritycdpostconditions() or spell(concentrated_flame_essence) or spell(reaping_flames) or spell(purifying_blast) or spell(ripple_in_space_essence) or spell(the_unbound_force) or spell(worldvein_resonance_essence) or { hastalent(firestarter_talent) and target.timetohealthpercent(90) > spellfullrecharge(rune_of_power) or spellcooldown(combustion) > combustion_rop_cutoff() and buffexpires(combustion_buff) or target.timetodie() < spellcooldown(combustion) and buffexpires(combustion_buff) or 0 } and spell(rune_of_power) or { not 0 and { hastalent(rune_of_power_talent) and spellcooldown(combustion) <= casttime(rune_of_power) or spellcooldown(combustion) == 0 } and not { talent(firestarter_talent) and target.healthpercent() >= 90 } or buffpresent(combustion_buff) } and firecombustion_phasecdpostconditions() or { azeriteessenceismajor(memory_of_lucid_dreams_essence_id) or azeriteessenceisminor(memory_of_lucid_dreams_essence_id) and hasazeritetrait(blaster_master_trait) } and charges(fire_blast) == spellmaxcharges(fire_blast) and not buffpresent(hot_streak_buff) and not { buffpresent(heating_up_buff) and { buffpresent(combustion_buff) and { inflighttotarget(fireball) or inflighttotarget(pyroblast) or executetime(scorch) > 0 } or target.healthpercent() <= 30 and executetime(scorch) > 0 } } and not { not buffpresent(heating_up_buff) and not buffpresent(hot_streak_buff) and buffexpires(combustion_buff) and { inflighttotarget(fireball) or inflighttotarget(pyroblast) } } and spell(fire_blast) or talent(firestarter_talent) and target.healthpercent() >= 90 and charges(fire_blast) >= 1 and { not fire_blast_pooling() or buffpresent(rune_of_power_buff) } and { not hasazeritetrait(blaster_master_trait) or buffremaining(blaster_master_buff) < 0.5 } and { not executetime(fireball) > 0 and not inflighttotarget(pyroblast) and buffpresent(heating_up_buff) or executetime(fireball) > 0 and buffexpires(hot_streak_buff) or inflighttotarget(pyroblast) and buffexpires(heating_up_buff) and buffexpires(hot_streak_buff) } and spell(fire_blast) or buffpresent(rune_of_power_buff) and buffexpires(combustion_buff) and firerop_phasecdpostconditions() or firestandard_rotationcdpostconditions() } ### Fire icons. AddCheckBox(opt_mage_fire_aoe l(aoe) default specialization=fire) AddIcon checkbox=!opt_mage_fire_aoe enemies=1 help=shortcd specialization=fire { if not incombat() fireprecombatshortcdactions() fire_defaultshortcdactions() } AddIcon checkbox=opt_mage_fire_aoe help=shortcd specialization=fire { if not incombat() fireprecombatshortcdactions() fire_defaultshortcdactions() } AddIcon enemies=1 help=main specialization=fire { if not incombat() fireprecombatmainactions() fire_defaultmainactions() } AddIcon checkbox=opt_mage_fire_aoe help=aoe specialization=fire { if not incombat() fireprecombatmainactions() fire_defaultmainactions() } AddIcon checkbox=!opt_mage_fire_aoe enemies=1 help=cd specialization=fire { if not incombat() fireprecombatcdactions() fire_defaultcdactions() } AddIcon checkbox=opt_mage_fire_aoe help=cd specialization=fire { if not incombat() fireprecombatcdactions() fire_defaultcdactions() } ### Required symbols # alexstraszas_fury_talent # ancestral_call # ancient_knot_of_wisdom_item # arcane_intellect # azsharas_font_of_power_item # azurethos_singed_plumage_item # bag_of_tricks # balefire_branch_item # berserking # blaster_master_buff # blaster_master_trait # blood_fury_sp # blood_of_the_enemy # combustion # combustion_buff # concentrated_flame_essence # counterspell # dragons_breath # fire_blast # fireball # fireblood # firestarter_talent # flame_on_talent # flame_patch_talent # flamestrike # focused_azerite_beam # gladiators_badge # gladiators_medallion_item # guardian_of_azeroth # heating_up_buff # hot_streak_buff # hyperthread_wristwraps_300142 # hyperthread_wristwraps_item # ignition_mages_fuse_item # kindling_talent # lights_judgment # living_bomb # manifesto_of_madness_chapter_one # manifesto_of_madness_item # memory_of_lucid_dreams_essence # memory_of_lucid_dreams_essence_id # meteor # meteor_talent # mirror_image # neural_synapse_enhancer_item # phoenix_flames # phoenix_flames_talent # purifying_blast # pyroblast # pyroclasm # quaking_palm # reaping_flames # ripple_in_space_essence # rune_of_power # rune_of_power_buff # rune_of_power_talent # scorch # searing_touch_talent # shockbiters_fang_item # the_unbound_force # tzanes_barkspines_item # unbridled_fury_item # worldvein_resonance_essence ]] OvaleScripts:RegisterScript("MAGE", "fire", name, desc, code, "script") end do local name = "sc_t24_mage_frost" local desc = "[8.3] Simulationcraft: T24_Mage_Frost" local code = [[ # Based on SimulationCraft profile "T24_Mage_Frost". # class=mage # spec=frost # talents=1013023 Include(ovale_common) Include(ovale_trinkets_mop) Include(ovale_trinkets_wod) Include(ovale_mage_spells) AddCheckBox(opt_interrupt l(interrupt) default specialization=frost) AddCheckBox(opt_use_consumables l(opt_use_consumables) default specialization=frost) AddCheckBox(opt_blink spellname(blink) specialization=frost) AddFunction frostinterruptactions { if checkboxon(opt_interrupt) and not target.isfriend() and target.casting() { if target.inrange(counterspell) and target.isinterruptible() spell(counterspell) if target.inrange(quaking_palm) and not target.classification(worldboss) spell(quaking_palm) } } AddFunction frostuseitemactions { item(trinket0slot text=13 usable=1) item(trinket1slot text=14 usable=1) } ### actions.talent_rop AddFunction frosttalent_ropmainactions { } AddFunction frosttalent_ropmainpostconditions { } AddFunction frosttalent_ropshortcdactions { #rune_of_power,if=talent.glacial_spike.enabled&buff.icicles.stack=5&(buff.brain_freeze.react|talent.ebonbolt.enabled&cooldown.ebonbolt.remains<cast_time) if hastalent(glacial_spike_talent) and buffstacks(icicles_buff) == 5 and { buffpresent(brain_freeze_buff) or hastalent(ebonbolt_talent) and spellcooldown(ebonbolt) < casttime(rune_of_power) } spell(rune_of_power) #rune_of_power,if=!talent.glacial_spike.enabled&(talent.ebonbolt.enabled&cooldown.ebonbolt.remains<cast_time|talent.comet_storm.enabled&cooldown.comet_storm.remains<cast_time|talent.ray_of_frost.enabled&cooldown.ray_of_frost.remains<cast_time|charges_fractional>1.9) if not hastalent(glacial_spike_talent) and { hastalent(ebonbolt_talent) and spellcooldown(ebonbolt) < casttime(rune_of_power) or hastalent(comet_storm_talent) and spellcooldown(comet_storm) < casttime(rune_of_power) or hastalent(ray_of_frost_talent) and spellcooldown(ray_of_frost) < casttime(rune_of_power) or charges(rune_of_power count=0) > 1.9 } spell(rune_of_power) } AddFunction frosttalent_ropshortcdpostconditions { } AddFunction frosttalent_ropcdactions { } AddFunction frosttalent_ropcdpostconditions { hastalent(glacial_spike_talent) and buffstacks(icicles_buff) == 5 and { buffpresent(brain_freeze_buff) or hastalent(ebonbolt_talent) and spellcooldown(ebonbolt) < casttime(rune_of_power) } and spell(rune_of_power) or not hastalent(glacial_spike_talent) and { hastalent(ebonbolt_talent) and spellcooldown(ebonbolt) < casttime(rune_of_power) or hastalent(comet_storm_talent) and spellcooldown(comet_storm) < casttime(rune_of_power) or hastalent(ray_of_frost_talent) and spellcooldown(ray_of_frost) < casttime(rune_of_power) or charges(rune_of_power count=0) > 1.9 } and spell(rune_of_power) } ### actions.single AddFunction frostsinglemainactions { #ice_nova,if=cooldown.ice_nova.ready&debuff.winters_chill.up if spellcooldown(ice_nova) == 0 and target.debuffpresent(winters_chill_debuff) spell(ice_nova) #flurry,if=talent.ebonbolt.enabled&prev_gcd.1.ebonbolt&buff.brain_freeze.react if hastalent(ebonbolt_talent) and previousgcdspell(ebonbolt) and buffpresent(brain_freeze_buff) spell(flurry) #flurry,if=prev_gcd.1.glacial_spike&buff.brain_freeze.react if previousgcdspell(glacial_spike) and buffpresent(brain_freeze_buff) spell(flurry) #call_action_list,name=essences frostessencesmainactions() unless frostessencesmainpostconditions() { #blizzard,if=active_enemies>2|active_enemies>1&!talent.splitting_ice.enabled if enemies() > 2 or enemies() > 1 and not hastalent(splitting_ice_talent) spell(blizzard) #ebonbolt,if=buff.icicles.stack=5&!buff.brain_freeze.react if buffstacks(icicles_buff) == 5 and not buffpresent(brain_freeze_buff) spell(ebonbolt) #ice_lance,if=buff.brain_freeze.react&(buff.fingers_of_frost.react|prev_gcd.1.flurry)&(buff.icicles.max_stack-buff.icicles.stack)*action.frostbolt.execute_time+action.glacial_spike.cast_time+action.glacial_spike.travel_time<incanters_flow_time_to.5.any if buffpresent(brain_freeze_buff) and { buffpresent(fingers_of_frost_buff) or previousgcdspell(flurry) } and { spelldata(icicles_buff max_stacks) - buffstacks(icicles_buff) } * executetime(frostbolt) + casttime(glacial_spike) + traveltime(glacial_spike) < stacktimeto(incanters_flow_buff 5 any) spell(ice_lance) #glacial_spike,if=buff.brain_freeze.react|prev_gcd.1.ebonbolt|talent.incanters_flow.enabled&cast_time+travel_time>incanters_flow_time_to.5.up&cast_time+travel_time<incanters_flow_time_to.4.down if buffpresent(brain_freeze_buff) or previousgcdspell(ebonbolt) or hastalent(incanters_flow_talent) and casttime(glacial_spike) + traveltime(glacial_spike) > stacktimeto(incanters_flow_buff 5 up) and casttime(glacial_spike) + traveltime(glacial_spike) < stacktimeto(incanters_flow_buff 4 down) spell(glacial_spike) #ice_nova spell(ice_nova) #frostbolt spell(frostbolt) #call_action_list,name=movement frostmovementmainactions() unless frostmovementmainpostconditions() { #ice_lance spell(ice_lance) } } } AddFunction frostsinglemainpostconditions { frostessencesmainpostconditions() or frostmovementmainpostconditions() } AddFunction frostsingleshortcdactions { unless spellcooldown(ice_nova) == 0 and target.debuffpresent(winters_chill_debuff) and spell(ice_nova) or hastalent(ebonbolt_talent) and previousgcdspell(ebonbolt) and buffpresent(brain_freeze_buff) and spell(flurry) or previousgcdspell(glacial_spike) and buffpresent(brain_freeze_buff) and spell(flurry) { #call_action_list,name=essences frostessencesshortcdactions() unless frostessencesshortcdpostconditions() { #frozen_orb spell(frozen_orb) unless { enemies() > 2 or enemies() > 1 and not hastalent(splitting_ice_talent) } and spell(blizzard) { #comet_storm spell(comet_storm) unless buffstacks(icicles_buff) == 5 and not buffpresent(brain_freeze_buff) and spell(ebonbolt) or buffpresent(brain_freeze_buff) and { buffpresent(fingers_of_frost_buff) or previousgcdspell(flurry) } and { spelldata(icicles_buff max_stacks) - buffstacks(icicles_buff) } * executetime(frostbolt) + casttime(glacial_spike) + traveltime(glacial_spike) < stacktimeto(incanters_flow_buff 5 any) and spell(ice_lance) or { buffpresent(brain_freeze_buff) or previousgcdspell(ebonbolt) or hastalent(incanters_flow_talent) and casttime(glacial_spike) + traveltime(glacial_spike) > stacktimeto(incanters_flow_buff 5 up) and casttime(glacial_spike) + traveltime(glacial_spike) < stacktimeto(incanters_flow_buff 4 down) } and spell(glacial_spike) or spell(ice_nova) or spell(frostbolt) { #call_action_list,name=movement frostmovementshortcdactions() } } } } } AddFunction frostsingleshortcdpostconditions { spellcooldown(ice_nova) == 0 and target.debuffpresent(winters_chill_debuff) and spell(ice_nova) or hastalent(ebonbolt_talent) and previousgcdspell(ebonbolt) and buffpresent(brain_freeze_buff) and spell(flurry) or previousgcdspell(glacial_spike) and buffpresent(brain_freeze_buff) and spell(flurry) or frostessencesshortcdpostconditions() or { enemies() > 2 or enemies() > 1 and not hastalent(splitting_ice_talent) } and spell(blizzard) or buffstacks(icicles_buff) == 5 and not buffpresent(brain_freeze_buff) and spell(ebonbolt) or buffpresent(brain_freeze_buff) and { buffpresent(fingers_of_frost_buff) or previousgcdspell(flurry) } and { spelldata(icicles_buff max_stacks) - buffstacks(icicles_buff) } * executetime(frostbolt) + casttime(glacial_spike) + traveltime(glacial_spike) < stacktimeto(incanters_flow_buff 5 any) and spell(ice_lance) or { buffpresent(brain_freeze_buff) or previousgcdspell(ebonbolt) or hastalent(incanters_flow_talent) and casttime(glacial_spike) + traveltime(glacial_spike) > stacktimeto(incanters_flow_buff 5 up) and casttime(glacial_spike) + traveltime(glacial_spike) < stacktimeto(incanters_flow_buff 4 down) } and spell(glacial_spike) or spell(ice_nova) or spell(frostbolt) or frostmovementshortcdpostconditions() or spell(ice_lance) } AddFunction frostsinglecdactions { unless spellcooldown(ice_nova) == 0 and target.debuffpresent(winters_chill_debuff) and spell(ice_nova) or hastalent(ebonbolt_talent) and previousgcdspell(ebonbolt) and buffpresent(brain_freeze_buff) and spell(flurry) or previousgcdspell(glacial_spike) and buffpresent(brain_freeze_buff) and spell(flurry) { #call_action_list,name=essences frostessencescdactions() unless frostessencescdpostconditions() or spell(frozen_orb) or { enemies() > 2 or enemies() > 1 and not hastalent(splitting_ice_talent) } and spell(blizzard) or spell(comet_storm) or buffstacks(icicles_buff) == 5 and not buffpresent(brain_freeze_buff) and spell(ebonbolt) or buffpresent(brain_freeze_buff) and { buffpresent(fingers_of_frost_buff) or previousgcdspell(flurry) } and { spelldata(icicles_buff max_stacks) - buffstacks(icicles_buff) } * executetime(frostbolt) + casttime(glacial_spike) + traveltime(glacial_spike) < stacktimeto(incanters_flow_buff 5 any) and spell(ice_lance) or { buffpresent(brain_freeze_buff) or previousgcdspell(ebonbolt) or hastalent(incanters_flow_talent) and casttime(glacial_spike) + traveltime(glacial_spike) > stacktimeto(incanters_flow_buff 5 up) and casttime(glacial_spike) + traveltime(glacial_spike) < stacktimeto(incanters_flow_buff 4 down) } and spell(glacial_spike) or spell(ice_nova) { #use_item,name=tidestorm_codex,if=buff.icy_veins.down&buff.rune_of_power.down if buffexpires(icy_veins_buff) and buffexpires(rune_of_power_buff) frostuseitemactions() #use_item,effect_name=cyclotronic_blast,if=buff.icy_veins.down&buff.rune_of_power.down if buffexpires(icy_veins_buff) and buffexpires(rune_of_power_buff) frostuseitemactions() unless spell(frostbolt) { #call_action_list,name=movement frostmovementcdactions() } } } } AddFunction frostsinglecdpostconditions { spellcooldown(ice_nova) == 0 and target.debuffpresent(winters_chill_debuff) and spell(ice_nova) or hastalent(ebonbolt_talent) and previousgcdspell(ebonbolt) and buffpresent(brain_freeze_buff) and spell(flurry) or previousgcdspell(glacial_spike) and buffpresent(brain_freeze_buff) and spell(flurry) or frostessencescdpostconditions() or spell(frozen_orb) or { enemies() > 2 or enemies() > 1 and not hastalent(splitting_ice_talent) } and spell(blizzard) or spell(comet_storm) or buffstacks(icicles_buff) == 5 and not buffpresent(brain_freeze_buff) and spell(ebonbolt) or buffpresent(brain_freeze_buff) and { buffpresent(fingers_of_frost_buff) or previousgcdspell(flurry) } and { spelldata(icicles_buff max_stacks) - buffstacks(icicles_buff) } * executetime(frostbolt) + casttime(glacial_spike) + traveltime(glacial_spike) < stacktimeto(incanters_flow_buff 5 any) and spell(ice_lance) or { buffpresent(brain_freeze_buff) or previousgcdspell(ebonbolt) or hastalent(incanters_flow_talent) and casttime(glacial_spike) + traveltime(glacial_spike) > stacktimeto(incanters_flow_buff 5 up) and casttime(glacial_spike) + traveltime(glacial_spike) < stacktimeto(incanters_flow_buff 4 down) } and spell(glacial_spike) or spell(ice_nova) or spell(frostbolt) or frostmovementcdpostconditions() or spell(ice_lance) } ### actions.precombat AddFunction frostprecombatmainactions { #flask #food #augmentation #arcane_intellect spell(arcane_intellect) #frostbolt spell(frostbolt) } AddFunction frostprecombatmainpostconditions { } AddFunction frostprecombatshortcdactions { unless spell(arcane_intellect) { #summon_water_elemental if not pet.present() spell(summon_water_elemental) } } AddFunction frostprecombatshortcdpostconditions { spell(arcane_intellect) or spell(frostbolt) } AddFunction frostprecombatcdactions { unless spell(arcane_intellect) or not pet.present() and spell(summon_water_elemental) { #snapshot_stats #use_item,name=azsharas_font_of_power frostuseitemactions() #mirror_image spell(mirror_image) #potion if checkboxon(opt_use_consumables) and target.classification(worldboss) item(unbridled_fury_item usable=1) } } AddFunction frostprecombatcdpostconditions { spell(arcane_intellect) or not pet.present() and spell(summon_water_elemental) or spell(frostbolt) } ### actions.movement AddFunction frostmovementmainactions { } AddFunction frostmovementmainpostconditions { } AddFunction frostmovementshortcdactions { #blink_any,if=movement.distance>10 if target.distance() > 10 and checkboxon(opt_blink) spell(blink) #ice_floes,if=buff.ice_floes.down if buffexpires(ice_floes_buff) and speed() > 0 spell(ice_floes) } AddFunction frostmovementshortcdpostconditions { } AddFunction frostmovementcdactions { } AddFunction frostmovementcdpostconditions { target.distance() > 10 and checkboxon(opt_blink) and spell(blink) or buffexpires(ice_floes_buff) and speed() > 0 and spell(ice_floes) } ### actions.essences AddFunction frostessencesmainactions { #concentrated_flame,line_cd=6,if=buff.rune_of_power.down if timesincepreviousspell(concentrated_flame_essence) > 6 and buffexpires(rune_of_power_buff) spell(concentrated_flame_essence) } AddFunction frostessencesmainpostconditions { } AddFunction frostessencesshortcdactions { #purifying_blast,if=buff.rune_of_power.down|active_enemies>3 if buffexpires(rune_of_power_buff) or enemies() > 3 spell(purifying_blast) #ripple_in_space,if=buff.rune_of_power.down|active_enemies>3 if buffexpires(rune_of_power_buff) or enemies() > 3 spell(ripple_in_space_essence) unless timesincepreviousspell(concentrated_flame_essence) > 6 and buffexpires(rune_of_power_buff) and spell(concentrated_flame_essence) { #reaping_flames,if=buff.rune_of_power.down if buffexpires(rune_of_power_buff) spell(reaping_flames) #the_unbound_force,if=buff.reckless_force.up if buffpresent(reckless_force_buff) spell(the_unbound_force) #worldvein_resonance,if=buff.rune_of_power.down|active_enemies>3 if buffexpires(rune_of_power_buff) or enemies() > 3 spell(worldvein_resonance_essence) } } AddFunction frostessencesshortcdpostconditions { timesincepreviousspell(concentrated_flame_essence) > 6 and buffexpires(rune_of_power_buff) and spell(concentrated_flame_essence) } AddFunction frostessencescdactions { #focused_azerite_beam,if=buff.rune_of_power.down|active_enemies>3 if buffexpires(rune_of_power_buff) or enemies() > 3 spell(focused_azerite_beam) #memory_of_lucid_dreams,if=active_enemies<5&(buff.icicles.stack<=1|!talent.glacial_spike.enabled)&cooldown.frozen_orb.remains>10 if enemies() < 5 and { buffstacks(icicles_buff) <= 1 or not hastalent(glacial_spike_talent) } and spellcooldown(frozen_orb) > 10 spell(memory_of_lucid_dreams_essence) #blood_of_the_enemy,if=(talent.glacial_spike.enabled&buff.icicles.stack=5&(buff.brain_freeze.react|prev_gcd.1.ebonbolt))|((active_enemies>3|!talent.glacial_spike.enabled)&(prev_gcd.1.frozen_orb|ground_aoe.frozen_orb.remains>5)) if hastalent(glacial_spike_talent) and buffstacks(icicles_buff) == 5 and { buffpresent(brain_freeze_buff) or previousgcdspell(ebonbolt) } or { enemies() > 3 or not hastalent(glacial_spike_talent) } and { previousgcdspell(frozen_orb) or target.debuffremaining(frozen_orb_debuff) > 5 } spell(blood_of_the_enemy) } AddFunction frostessencescdpostconditions { { buffexpires(rune_of_power_buff) or enemies() > 3 } and spell(purifying_blast) or { buffexpires(rune_of_power_buff) or enemies() > 3 } and spell(ripple_in_space_essence) or timesincepreviousspell(concentrated_flame_essence) > 6 and buffexpires(rune_of_power_buff) and spell(concentrated_flame_essence) or buffexpires(rune_of_power_buff) and spell(reaping_flames) or buffpresent(reckless_force_buff) and spell(the_unbound_force) or { buffexpires(rune_of_power_buff) or enemies() > 3 } and spell(worldvein_resonance_essence) } ### actions.cooldowns AddFunction frostcooldownsmainactions { #call_action_list,name=talent_rop,if=talent.rune_of_power.enabled&active_enemies=1&cooldown.rune_of_power.full_recharge_time<cooldown.frozen_orb.remains if hastalent(rune_of_power_talent) and enemies() == 1 and spellcooldown(rune_of_power) < spellcooldown(frozen_orb) frosttalent_ropmainactions() } AddFunction frostcooldownsmainpostconditions { hastalent(rune_of_power_talent) and enemies() == 1 and spellcooldown(rune_of_power) < spellcooldown(frozen_orb) and frosttalent_ropmainpostconditions() } AddFunction frostcooldownsshortcdactions { #rune_of_power,if=prev_gcd.1.frozen_orb|target.time_to_die>10+cast_time&target.time_to_die<20 if previousgcdspell(frozen_orb) or target.timetodie() > 10 + casttime(rune_of_power) and target.timetodie() < 20 spell(rune_of_power) #call_action_list,name=talent_rop,if=talent.rune_of_power.enabled&active_enemies=1&cooldown.rune_of_power.full_recharge_time<cooldown.frozen_orb.remains if hastalent(rune_of_power_talent) and enemies() == 1 and spellcooldown(rune_of_power) < spellcooldown(frozen_orb) frosttalent_ropshortcdactions() unless hastalent(rune_of_power_talent) and enemies() == 1 and spellcooldown(rune_of_power) < spellcooldown(frozen_orb) and frosttalent_ropshortcdpostconditions() { #bag_of_tricks spell(bag_of_tricks) } } AddFunction frostcooldownsshortcdpostconditions { hastalent(rune_of_power_talent) and enemies() == 1 and spellcooldown(rune_of_power) < spellcooldown(frozen_orb) and frosttalent_ropshortcdpostconditions() } AddFunction frostcooldownscdactions { #guardian_of_azeroth spell(guardian_of_azeroth) #icy_veins spell(icy_veins) #mirror_image spell(mirror_image) unless { previousgcdspell(frozen_orb) or target.timetodie() > 10 + casttime(rune_of_power) and target.timetodie() < 20 } and spell(rune_of_power) { #call_action_list,name=talent_rop,if=talent.rune_of_power.enabled&active_enemies=1&cooldown.rune_of_power.full_recharge_time<cooldown.frozen_orb.remains if hastalent(rune_of_power_talent) and enemies() == 1 and spellcooldown(rune_of_power) < spellcooldown(frozen_orb) frosttalent_ropcdactions() unless hastalent(rune_of_power_talent) and enemies() == 1 and spellcooldown(rune_of_power) < spellcooldown(frozen_orb) and frosttalent_ropcdpostconditions() { #potion,if=prev_gcd.1.icy_veins|target.time_to_die<30 if { previousgcdspell(icy_veins) or target.timetodie() < 30 } and checkboxon(opt_use_consumables) and target.classification(worldboss) item(unbridled_fury_item usable=1) #use_item,name=balefire_branch,if=!talent.glacial_spike.enabled|buff.brain_freeze.react&prev_gcd.1.glacial_spike if not hastalent(glacial_spike_talent) or buffpresent(brain_freeze_buff) and previousgcdspell(glacial_spike) frostuseitemactions() #use_items frostuseitemactions() #blood_fury spell(blood_fury_sp) #berserking spell(berserking) #lights_judgment spell(lights_judgment) #fireblood spell(fireblood) #ancestral_call spell(ancestral_call) } } } AddFunction frostcooldownscdpostconditions { { previousgcdspell(frozen_orb) or target.timetodie() > 10 + casttime(rune_of_power) and target.timetodie() < 20 } and spell(rune_of_power) or hastalent(rune_of_power_talent) and enemies() == 1 and spellcooldown(rune_of_power) < spellcooldown(frozen_orb) and frosttalent_ropcdpostconditions() or spell(bag_of_tricks) } ### actions.aoe AddFunction frostaoemainactions { #blizzard spell(blizzard) #call_action_list,name=essences frostessencesmainactions() unless frostessencesmainpostconditions() { #ice_nova spell(ice_nova) #flurry,if=prev_gcd.1.ebonbolt|buff.brain_freeze.react&(prev_gcd.1.frostbolt&(buff.icicles.stack<4|!talent.glacial_spike.enabled)|prev_gcd.1.glacial_spike) if previousgcdspell(ebonbolt) or buffpresent(brain_freeze_buff) and { previousgcdspell(frostbolt) and { buffstacks(icicles_buff) < 4 or not hastalent(glacial_spike_talent) } or previousgcdspell(glacial_spike) } spell(flurry) #ice_lance,if=buff.fingers_of_frost.react if buffpresent(fingers_of_frost_buff) spell(ice_lance) #ray_of_frost spell(ray_of_frost) #ebonbolt spell(ebonbolt) #glacial_spike spell(glacial_spike) #frostbolt spell(frostbolt) #call_action_list,name=movement frostmovementmainactions() unless frostmovementmainpostconditions() { #ice_lance spell(ice_lance) } } } AddFunction frostaoemainpostconditions { frostessencesmainpostconditions() or frostmovementmainpostconditions() } AddFunction frostaoeshortcdactions { #frozen_orb spell(frozen_orb) unless spell(blizzard) { #call_action_list,name=essences frostessencesshortcdactions() unless frostessencesshortcdpostconditions() { #comet_storm spell(comet_storm) unless spell(ice_nova) or { previousgcdspell(ebonbolt) or buffpresent(brain_freeze_buff) and { previousgcdspell(frostbolt) and { buffstacks(icicles_buff) < 4 or not hastalent(glacial_spike_talent) } or previousgcdspell(glacial_spike) } } and spell(flurry) or buffpresent(fingers_of_frost_buff) and spell(ice_lance) or spell(ray_of_frost) or spell(ebonbolt) or spell(glacial_spike) { #cone_of_cold if target.distance() < 12 spell(cone_of_cold) unless spell(frostbolt) { #call_action_list,name=movement frostmovementshortcdactions() } } } } } AddFunction frostaoeshortcdpostconditions { spell(blizzard) or frostessencesshortcdpostconditions() or spell(ice_nova) or { previousgcdspell(ebonbolt) or buffpresent(brain_freeze_buff) and { previousgcdspell(frostbolt) and { buffstacks(icicles_buff) < 4 or not hastalent(glacial_spike_talent) } or previousgcdspell(glacial_spike) } } and spell(flurry) or buffpresent(fingers_of_frost_buff) and spell(ice_lance) or spell(ray_of_frost) or spell(ebonbolt) or spell(glacial_spike) or spell(frostbolt) or frostmovementshortcdpostconditions() or spell(ice_lance) } AddFunction frostaoecdactions { unless spell(frozen_orb) or spell(blizzard) { #call_action_list,name=essences frostessencescdactions() unless frostessencescdpostconditions() or spell(comet_storm) or spell(ice_nova) or { previousgcdspell(ebonbolt) or buffpresent(brain_freeze_buff) and { previousgcdspell(frostbolt) and { buffstacks(icicles_buff) < 4 or not hastalent(glacial_spike_talent) } or previousgcdspell(glacial_spike) } } and spell(flurry) or buffpresent(fingers_of_frost_buff) and spell(ice_lance) or spell(ray_of_frost) or spell(ebonbolt) or spell(glacial_spike) or target.distance() < 12 and spell(cone_of_cold) { #use_item,name=tidestorm_codex,if=buff.icy_veins.down&buff.rune_of_power.down if buffexpires(icy_veins_buff) and buffexpires(rune_of_power_buff) frostuseitemactions() #use_item,effect_name=cyclotronic_blast,if=buff.icy_veins.down&buff.rune_of_power.down if buffexpires(icy_veins_buff) and buffexpires(rune_of_power_buff) frostuseitemactions() unless spell(frostbolt) { #call_action_list,name=movement frostmovementcdactions() } } } } AddFunction frostaoecdpostconditions { spell(frozen_orb) or spell(blizzard) or frostessencescdpostconditions() or spell(comet_storm) or spell(ice_nova) or { previousgcdspell(ebonbolt) or buffpresent(brain_freeze_buff) and { previousgcdspell(frostbolt) and { buffstacks(icicles_buff) < 4 or not hastalent(glacial_spike_talent) } or previousgcdspell(glacial_spike) } } and spell(flurry) or buffpresent(fingers_of_frost_buff) and spell(ice_lance) or spell(ray_of_frost) or spell(ebonbolt) or spell(glacial_spike) or target.distance() < 12 and spell(cone_of_cold) or spell(frostbolt) or frostmovementcdpostconditions() or spell(ice_lance) } ### actions.default AddFunction frost_defaultmainactions { #call_action_list,name=cooldowns frostcooldownsmainactions() unless frostcooldownsmainpostconditions() { #call_action_list,name=aoe,if=active_enemies>3&talent.freezing_rain.enabled|active_enemies>4 if enemies() > 3 and hastalent(freezing_rain_talent) or enemies() > 4 frostaoemainactions() unless { enemies() > 3 and hastalent(freezing_rain_talent) or enemies() > 4 } and frostaoemainpostconditions() { #call_action_list,name=single frostsinglemainactions() } } } AddFunction frost_defaultmainpostconditions { frostcooldownsmainpostconditions() or { enemies() > 3 and hastalent(freezing_rain_talent) or enemies() > 4 } and frostaoemainpostconditions() or frostsinglemainpostconditions() } AddFunction frost_defaultshortcdactions { #call_action_list,name=cooldowns frostcooldownsshortcdactions() unless frostcooldownsshortcdpostconditions() { #call_action_list,name=aoe,if=active_enemies>3&talent.freezing_rain.enabled|active_enemies>4 if enemies() > 3 and hastalent(freezing_rain_talent) or enemies() > 4 frostaoeshortcdactions() unless { enemies() > 3 and hastalent(freezing_rain_talent) or enemies() > 4 } and frostaoeshortcdpostconditions() { #call_action_list,name=single frostsingleshortcdactions() } } } AddFunction frost_defaultshortcdpostconditions { frostcooldownsshortcdpostconditions() or { enemies() > 3 and hastalent(freezing_rain_talent) or enemies() > 4 } and frostaoeshortcdpostconditions() or frostsingleshortcdpostconditions() } AddFunction frost_defaultcdactions { #counterspell frostinterruptactions() #call_action_list,name=cooldowns frostcooldownscdactions() unless frostcooldownscdpostconditions() { #call_action_list,name=aoe,if=active_enemies>3&talent.freezing_rain.enabled|active_enemies>4 if enemies() > 3 and hastalent(freezing_rain_talent) or enemies() > 4 frostaoecdactions() unless { enemies() > 3 and hastalent(freezing_rain_talent) or enemies() > 4 } and frostaoecdpostconditions() { #call_action_list,name=single frostsinglecdactions() } } } AddFunction frost_defaultcdpostconditions { frostcooldownscdpostconditions() or { enemies() > 3 and hastalent(freezing_rain_talent) or enemies() > 4 } and frostaoecdpostconditions() or frostsinglecdpostconditions() } ### Frost icons. AddCheckBox(opt_mage_frost_aoe l(aoe) default specialization=frost) AddIcon checkbox=!opt_mage_frost_aoe enemies=1 help=shortcd specialization=frost { if not incombat() frostprecombatshortcdactions() frost_defaultshortcdactions() } AddIcon checkbox=opt_mage_frost_aoe help=shortcd specialization=frost { if not incombat() frostprecombatshortcdactions() frost_defaultshortcdactions() } AddIcon enemies=1 help=main specialization=frost { if not incombat() frostprecombatmainactions() frost_defaultmainactions() } AddIcon checkbox=opt_mage_frost_aoe help=aoe specialization=frost { if not incombat() frostprecombatmainactions() frost_defaultmainactions() } AddIcon checkbox=!opt_mage_frost_aoe enemies=1 help=cd specialization=frost { if not incombat() frostprecombatcdactions() frost_defaultcdactions() } AddIcon checkbox=opt_mage_frost_aoe help=cd specialization=frost { if not incombat() frostprecombatcdactions() frost_defaultcdactions() } ### Required symbols # ancestral_call # arcane_intellect # bag_of_tricks # berserking # blink # blizzard # blood_fury_sp # blood_of_the_enemy # brain_freeze_buff # comet_storm # comet_storm_talent # concentrated_flame_essence # cone_of_cold # counterspell # ebonbolt # ebonbolt_talent # fingers_of_frost_buff # fireblood # flurry # focused_azerite_beam # freezing_rain_talent # frostbolt # frozen_orb # frozen_orb_debuff # glacial_spike # glacial_spike_talent # guardian_of_azeroth # ice_floes # ice_floes_buff # ice_lance # ice_nova # icicles_buff # icy_veins # icy_veins_buff # incanters_flow_talent # lights_judgment # memory_of_lucid_dreams_essence # mirror_image # purifying_blast # quaking_palm # ray_of_frost # ray_of_frost_talent # reaping_flames # reckless_force_buff # ripple_in_space_essence # rune_of_power # rune_of_power_buff # rune_of_power_talent # splitting_ice_talent # summon_water_elemental # the_unbound_force # unbridled_fury_item # winters_chill_debuff # worldvein_resonance_essence ]] OvaleScripts:RegisterScript("MAGE", "frost", name, desc, code, "script") end end
mit
TheAnswer/FirstTest
bin/scripts/creatures/objects/npcs/corsec/corsecComissioner.lua
1
4650
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. corsecComissioner = Creature:new { objectName = "corsecComissioner", -- Lua Object Name creatureType = "NPC", faction = "corsec", factionPoints = 20, gender = "", speciesName = "corsec_comissioner", stfName = "mob/creature_names", objectCRC = 16556953, socialGroup = "corsec", level = 30, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 10200, healthMin = 8400, strength = 500, constitution = 500, actionMax = 10200, actionMin = 8400, quickness = 500, stamina = 500, mindMax = 10200, mindMin = 8400, focus = 500, willpower = 500, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = 0, stun = -1, blast = 0, heat = 0, cold = 0, acid = -1, lightsaber = 0, accuracy = 300, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/ranged/pistol/shared_pistol_cdef_corsec.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Corsec CDEF Pistol", -- Name ex. 'a Vibrolance' weaponTemp = "pistol_cdef_corsec", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "PistolRangedWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 1, weaponMinDamage = 1270, weaponMaxDamage = 2250, weaponAttackSpeed = 2, weaponDamageType = "ENERGY", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateweaponAttackSpeed = 2, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateweaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0,11,15,19,33,39,40", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "corsecAttack1" }, respawnTimer = 300, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(corsecComissioner, 16556953) -- Add to Global Table
lgpl-3.0
bartvm/Penlight
tests/test-url.lua
9
1564
local url = require 'pl.url' local asserteq = require 'pl.test' . asserteq asserteq(url.quote(''), '') asserteq(url.quote('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') asserteq(url.quote('abcdefghijklmnopqrstuvwxyz'), 'abcdefghijklmnopqrstuvwxyz') asserteq(url.quote('0123456789'), '0123456789') asserteq(url.quote(' -_./'), '%20-_./') asserteq(url.quote('`~!@#$%^&*()'), '%60%7E%21%40%23%24%25%5E%26%2A%28%29') asserteq(url.quote('%2'), '%252') asserteq(url.quote('2R%1%%'), '2R%251%25%25') asserteq(url.quote('', true), '') asserteq(url.quote('ABCDEFGHIJKLMNOPQRSTUVWXYZ', true), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') asserteq(url.quote('abcdefghijklmnopqrstuvwxyz', true), 'abcdefghijklmnopqrstuvwxyz') asserteq(url.quote('0123456789'), '0123456789', true) asserteq(url.quote(' -_./', true), '+-_.%2F') asserteq(url.quote('`~!@#$%^&*()', true), '%60%7E%21%40%23%24%25%5E%26%2A%28%29') asserteq(url.quote('%2', true), '%252') asserteq(url.quote('2R%1%%', true), '2R%251%25%25') asserteq(url.unquote(''), '') asserteq(url.unquote('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') asserteq(url.unquote('abcdefghijklmnopqrstuvwxyz'), 'abcdefghijklmnopqrstuvwxyz') asserteq(url.unquote('0123456789'), '0123456789') asserteq(url.unquote(' -_./'), ' -_./') asserteq(url.unquote('+-_.%2F'), ' -_./') asserteq(url.unquote('%20-_./'), ' -_./') asserteq(url.unquote('%60%7E%21%40%23%24%25%5E%26%2A%28%29'), '`~!@#$%^&*()') asserteq(url.unquote('%252'), '%2') asserteq(url.unquote('2%52%1%%'), '2R%1%%') asserteq(url.unquote('2R%251%25%25'), '2R%1%%')
mit
TheAnswer/FirstTest
bin/scripts/skills/creatureSkills/corellia/creatures/gulginawAttacks.lua
1
4223
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. gulginawAttack1 = { attackname = "gulginawAttack1", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 2, arearange = 7, accuracyBonus = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 50, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(gulginawAttack1) ----------------------------------------------- gulginawAttack2 = { attackname = "gulginawAttack2", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 2, arearange = 7, accuracyBonus = 0, knockdownChance = 50, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(gulginawAttack2) ----------------------------------------------- gulginawAttack3 = { attackname = "gulginawAttack3", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 2, arearange = 7, accuracyBonus = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 50, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(gulginawAttack3) -----------------------------------------------
lgpl-3.0
RockySeven3161/Unknown
plugins/steam.lua
645
2117
-- See https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI do local BASE_URL = 'http://store.steampowered.com/api/appdetails/' local DESC_LENTH = 200 local function unescape(str) str = string.gsub( str, '&lt;', '<' ) str = string.gsub( str, '&gt;', '>' ) str = string.gsub( str, '&quot;', '"' ) str = string.gsub( str, '&apos;', "'" ) str = string.gsub( str, '&#(%d+);', function(n) return string.char(n) end ) str = string.gsub( str, '&#x(%d+);', function(n) return string.char(tonumber(n,16)) end ) str = string.gsub( str, '&amp;', '&' ) -- Be sure to do this after all others return str end local function get_steam_data (appid) local url = BASE_URL url = url..'?appids='..appid url = url..'&cc=us' local res,code = http.request(url) if code ~= 200 then return nil end local data = json:decode(res)[appid].data return data end local function price_info (data) local price = '' -- If no data is empty if data then local initial = data.initial local final = data.final or data.initial local min = math.min(data.initial, data.final) price = tostring(min/100) if data.discount_percent and initial ~= final then price = price..data.currency..' ('..data.discount_percent..'% OFF)' end price = price..' (US)' end return price end local function send_steam_data(data, receiver) local description = string.sub(unescape(data.about_the_game:gsub("%b<>", "")), 1, DESC_LENTH) .. '...' local title = data.name local price = price_info(data.price_overview) local text = title..' '..price..'\n'..description local image_url = data.header_image local cb_extra = { receiver = receiver, url = image_url } send_msg(receiver, text, send_photo_from_url_callback, cb_extra) end local function run(msg, matches) local appid = matches[1] local data = get_steam_data(appid) local receiver = get_receiver(msg) send_steam_data(data, receiver) end return { description = "Grabs Steam info for Steam links.", usage = "", patterns = { "http://store.steampowered.com/app/([0-9]+)", }, run = run } end
gpl-2.0
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/artisan/noviceArtisan/floraSurveyTool.lua
1
3849
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. floraSurveyTool = Object:new { objectName = "Flora Survey Tool", stfName = "survey_tool_lumber", stfFile = "item_n", objectCRC = 1375088999, groupName = "craftArtisanSurveyGroupA", -- Group schematic is awarded in (See skills table) craftingToolTab = 524288, -- (See DraftSchemticImplementation.h) complexity = 7, size = 1, xpType = "crafting_general", xp = 55, assemblySkill = "general_assembly", experimentingSkill = "general_experimentation", ingredientTemplateNames = "craft_item_ingredients_n, craft_item_ingredients_n, craft_item_ingredients_n, craft_item_ingredients_n", ingredientTitleNames = "assembly_enclosure, controller, scanner_assembly, storage_unit", ingredientSlotType = "0, 0, 0, 0", resourceTypes = "metal, metal, metal, mineral", resourceQuantities = "8, 8, 3, 8", combineTypes = "0, 0, 0, 0", contribution = "100, 100, 100, 100", numberExperimentalProperties = "1, 1, 1, 1", experimentalProperties = "XX, XX, XX, CD", experimentalWeights = "1, 1, 1, 1", experimentalGroupTitles = "null, null, null, exp_effectiveness", experimentalSubGroupTitles = "null, null, hitpoints, usemodifier", experimentalMin = "0, 0, 1000, -15", experimentalMax = "0, 0, 1000, 15", experimentalPrecision = "0, 0, 0, 0", tanoAttributes = "objecttype=32770:objectcrc=1329114448:stfFile=item_n:stfName=survey_tool_lumber:stfDetail=:itemmask=65535::", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "", customizationDefaults = "", customizationSkill = "clothing_customization" } DraftSchematics:addDraftSchematic(floraSurveyTool, 1375088999)--- Add to global DraftSchematics table
lgpl-3.0
PAPAGENO-devels/papageno
test/benchmarks/Lua/lua-regression-test/WoW/classops.lua
1
3413
-- -- classops.lua - Copyright (c) 2006, the WoWBench developer community. All rights reserved. See LICENSE.TXT. -- -- Basic object class operations: constructing, inheriting... -- Also defines WBClass_Base -- ----------------------------------------------------------- -- function WOWB_RunObjConstructors(o, objtype) -- -- Run __constructor in all base classes and the object -- itself. This is a misnomer really. It's not so much a -- "constructor" as a "deal with parameters from xml". -- -- We should have both, really. An opportunity to set -- nice default values wouldn't hurt. -- (Though mind that InheritType refuses to copy over values -- that are already filled out ... hrm...) -- ----------------------------------------------------------- function WOWB_RunObjConstructors(o, objtype) for _,inheritedtype in objtype.__inheritstypes do WOWB_RunObjConstructors(o, inheritedtype); end objtype.__constructor(o); end --------------------------------------------------------------------- -- function WOWB_InheritType(dest,...) -- -- Used when creating new types, e.g. -- WBClass_Something = {} -- WBClass_InheritType(WBClass_Something, WBClass_Base) -- Also does multiple inheritance. --------------------------------------------------------------------- function WOWB_InheritType(dest,...) local function WOWB_InheritType_Fly(dest,classes) for _,src in ipairs(classes) do for k,v in src do if(not dest[k]) then dest[k] = v; end end WOWB_InheritType_Fly(dest,src.__inheritstypes); end end assert(not dest.__inheritstypes); dest.__inheritstypes = {} if(table.getn(arg)<2) then -- single inheritance: yay, we can just point __index to our base class src = arg[1]; table.insert(dest.__inheritstypes, src); setmetatable(dest, {__index=src}); else -- multiple inheritance, copy in all methods from all classes (and their children... sigh) for _,src in ipairs(arg) do table.insert(dest.__inheritstypes, src); end WOWB_InheritType_Fly(dest,dest.__inheritstypes); end end --------------------------------------------------------------------- -- function WOWB_DescribeObject(o) -- -- Return e.g. "Frame MyFrame" or "Button myxmlfile:123" --------------------------------------------------------------------- function WOWB_DescribeObject(o) if(not o) then return "(nil)"; end if(o[0].name) then return o[0].xmltag..' '..o[0].name; end if(o[0].xmlfile) then return o[0].xmltag..' '..WOWB_SimpleFilename(o[0].xmlfile)..':'..o[0].xmlfilelinenum; end return o[0].xmltag..' (unnamed)'; end ------------------------------------------------- -- Base class; inherit everything from this WBClass_Base = { __inheritstypes={} } local function __Base_IsObjectType_Fly(oType, str) for k,v in oType.__inheritstypes do if(string.lower(v:GetObjectType())==str) then return true; end if(__Base_IsObjectType_Fly(v,str)) then return true; end end return false; end function WBClass_Base:IsObjectType(str) return __Base_IsObjectType_Fly(self, string.lower(str)); end function WBClass_Base:GetObjectType(str) return "WBClass_Base"; end function WBClass_Base:__constructor() end function WBClass_Base:GetName() return self[0].name or ""; end WOWB_Debug_AddClassInfo(WBClass_Base, WBClass_Base:GetObjectType());
gpl-2.0
TheAnswer/FirstTest
bin/scripts/items/objects/weapons/carbines/dxr6Carbine.lua
1
2449
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. dxr6Carbine = Weapon:new{ objectName = "DXR6 Carbine", templateName = "object/weapon/ranged/carbine/shared_carbine_dxr6.iff", objectCRC = 2050793147, objectType = CARBINE, damageType = WEAPON_ACID, armorPiercing = WEAPON_LIGHT, certification = "cert_carbine_dxr6", attackSpeed = 4.6, minDamage = 90, maxDamage = 110 }
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/slashcommands/skills/forceThrow.lua
1
2560
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 ForceThrowSlashCommand = { name = "forcethrow", alternativeNames = "", animation = "", invalidStateMask = 3894805544, --aiming, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,9,10,11,13,14,", target = 1, targeType = 2, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 1, } AddForceThrowSlashCommand(ForceThrowSlashCommand)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/tatooine/npcs/jawa/jawaProtector.lua
1
4829
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. jawaProtector = Creature:new { objectName = "jawaProtector", -- Lua Object Name creatureType = "NPC", faction = "jawa", factionPoints = 20, gender = "", speciesName = "jawa_protector", stfName = "mob/creature_names", objectCRC = 3444186231, socialGroup = "jawa", level = 17, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 3500, healthMin = 2900, strength = 0, constitution = 0, actionMax = 3500, actionMin = 2900, quickness = 0, stamina = 0, mindMax = 3500, mindMin = 2900, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 1, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 15, energy = 10, electricity = -1, stun = -1, blast = -1, heat = 0, cold = 0, acid = 0, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 1, killer = 1, ferocity = 0, aggressive = 0, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/ranged/rifle/shared_rifle_jawa_ion.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "a Jawa Ion Rifle", -- Name ex. 'a Vibrolance' weaponTemp = "rifle_jawa_ion", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "RifleRangedWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 1, weaponMinDamage = 170, weaponMaxDamage = 180, weaponAttackSpeed = 2, weaponDamageType = "ELECTRICITY", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "LIGHT", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "jawaRangedAttack1", "jawaRangedAttack2", "jawaRangedAttack3", "jawaRangedAttack4", "jawaRangedAttack5", "jawaRangedAttack6", "jawaRangedAttack7", "jawaRangedAttack8", "jawaRangedAttack9", "jawaRangedAttack10", "jawaRangedAttack11", "jawaRangedAttack12" }, -- respawnTimer = 180, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(jawaProtector, 3444186231) -- Add to Global Table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/armorsmith/personalArmorIChitin/chitinArmorLeggings.lua
1
5220
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. chitinArmorLeggings = Object:new { objectName = "Chitin Armor Leggings", stfName = "armor_chitin_s01_leggings", stfFile = "wearables_name", objectCRC = 729528974, groupName = "craftArmorPersonalGroupB", -- Group schematic is awarded in (See skills table) craftingToolTab = 2, -- (See DraftSchemticImplementation.h) complexity = 25, size = 3, xpType = "crafting_clothing_armor", xp = 270, assemblySkill = "armor_assembly", experimentingSkill = "armor_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "auxilary_coverage, body, liner, hardware_and_attachments, binding_and_reinforcement, padding, armor, load_bearing_harness, reinforcement", ingredientSlotType = "0, 0, 0, 0, 0, 0, 2, 2, 2", resourceTypes = "bone, hide_leathery, hide_scaley, metal_ferrous, petrochem_inert_polymer, hide_wooly, object/tangible/component/armor/shared_armor_segment_chitin.iff, object/tangible/component/clothing/shared_fiberplast_panel.iff, object/tangible/component/clothing/shared_reinforced_fiber_panels.iff", resourceQuantities = "30, 30, 30, 15, 15, 15, 3, 1, 1", combineTypes = "0, 0, 0, 0, 0, 0, 1, 1, 1", contribution = "100, 100, 100, 100, 100, 100, 100, 100, 100", numberExperimentalProperties = "1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1", experimentalProperties = "XX, XX, XX, OQ, SR, OQ, SR, OQ, UT, MA, OQ, MA, OQ, MA, OQ, XX, XX, OQ, SR, XX", experimentalWeights = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalGroupTitles = "null, null, null, null, exp_quality, exp_durability, exp_durability, exp_durability, exp_durability, null, null, exp_resistance, null", experimentalSubGroupTitles = "null, null, sockets, hit_points, armor_effectiveness, armor_integrity, armor_health_encumbrance, armor_action_encumbrance, armor_mind_encumbrance, armor_rating, armor_special_type, armor_special_effectiveness, armor_special_integrity", experimentalMin = "0, 0, 0, 1000, 5, 15000, 39, 100, 16, 1, 1, 5, 15000", experimentalMax = "0, 0, 0, 1000, 30, 25000, 23, 60, 9, 1, 1, 40, 25000", experimentalPrecision = "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", tanoAttributes = "objecttype=260:objectcrc=1149232129:stfFile=wearables_name:stfName=armor_chitin_s01_leggings:stfDetail=:itemmask=62975:customattributes=specialprotection=kineticeffectiveness;vunerability=stuneffectiveness,heateffectiveness,coldeffectiveness,restraineffectiveness;armorPiece=260;armorStyle=4102;:", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "/private/index_color_0, /private/index_color_1", customizationDefaults = "0, 6", customizationSkill = "armor_customization" } DraftSchematics:addDraftSchematic(chitinArmorLeggings, 729528974)--- Add to global DraftSchematics table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/skills/playerSkills/combat/brawler.lua
1
32268
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. -------------------------------NOVICE---------------------------------- CmbtEnhaceSkill = { skillname = "intimidate1", animation = "intimidate", range = 15, duration = 10.0, speedRatio = 1.0, meleeDamagePenalty = 0, rangedDamagePenalty = 0, meleeAccuracyPenalty = 0, rangedAccuracyPenalty = 0, defensePenalty = 0, speedPenalty = 0, nextAttackDelay = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 25, selfEffect = "clienteffect/combat_special_attacker_intimidate.cef", FlyText = "", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddDeBuffAttackTargetSkill(CmbtEnhaceSkill) ----------------------------------------------------------------------- --AddEnhanceSelfSkill(HealEnhaceSkill) ----------------------------------------------------------------------- CobSkill = { skillname = "centerofbeing", effect = "", StartFlyText = "", FinishFlyText = "", invalidStateMask = 3760587824, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,12,13,14,4,", instant = 0 } AddCenterOfBeingSkill(CobSkill) ----------------------------------------------------------------------- CmbtEnhaceSkill = { skillname = "warcry1", animation = "warcry", range = 15, duration = 30.0, speedRatio = 1.0, meleeDamagePenalty = 0, rangedDamagePenalty = 0, meleeAccuracyPenalty = 0, rangedAccuracyPenalty = 0, defensePenalty = 0, speedPenalty = 0, nextAttackDelay = 10, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, selfEffect = "clienteffect/combat_special_attacker_warcry.cef", FlyText = "", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddDeBuffAttackTargetSkill(CmbtEnhaceSkill) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "melee1hlunge1", animation = "lower_posture_1hmelee_1", requiredWeaponType = ONEHANDED, range = 15, damageRatio = 1.0, speedRatio = 1.25, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 10, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "sword1_sweep_block", CbtSpamCounter = "sword1_sweep_counter", CbtSpamEvade = "sword1_sweep_evade", CbtSpamHit = "sword1_sweep_hit", CbtSpamMiss = "sword1_sweep_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "polearmlunge1", animation = "attack_high_center_light_2", requiredWeaponType = POLEARM, range = 15, damageRatio = 1.0, speedRatio = 1.5, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 10, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "polearm_sweep_block", CbtSpamCounter = "polearm_sweep_counter", CbtSpamEvade = "polearm_sweep_evade", CbtSpamHit = "polearm_sweep_hit", CbtSpamMiss = "polearm_sweep_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "melee2hlunge1", animation = "lower_posture_2hmelee_1", requiredWeaponType = TWOHANDED, range = 15, damageRatio = 1.0, speedRatio = 1.5, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 10, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "sword2_sweep_block", CbtSpamCounter = "sword2_sweep_counter", CbtSpamEvade = "sword2_sweep_evade", CbtSpamHit = "sword2_sweep_hit", CbtSpamMiss = "sword2_sweep_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "unarmedlunge1", animation = "counter_mid_center_light", requiredWeaponType = UNARMED, range = 15, damageRatio = 1.0, speedRatio = 1.5, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 10, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "unarmed_sweep_block", CbtSpamCounter = "unarmed_sweep_counter", CbtSpamEvade = "unarmed_sweep_evade", CbtSpamHit = "unarmed_sweep_hit", CbtSpamMiss = "unarmed_sweep_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) -------------------------------UNARMED------------------------------- RandPoolAtt = { attackname = "unarmedhit1", animation = "combo_2d_light", requiredWeaponType = UNARMED, range = 0, damageRatio = 2.0, speedRatio = 1.5, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "unarmed_dam1_block", CbtSpamCounter = "unarmed_dam1_counter", CbtSpamEvade = "unarmed_dam1_evade", CbtSpamHit = "unarmed_dam1_hit", CbtSpamMiss = "unarmed_dam1_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "unarmedstun1", animation = "combo_4c_light", requiredWeaponType = UNARMED, range = 0, damageRatio = 1.25, speedRatio = 2.0, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 20, intimidateChance = 0, CbtSpamBlock = "unarmed_stun_block", CbtSpamCounter = "unarmed_stun_counter", CbtSpamEvade = "unarmed_stun_evade", CbtSpamHit = "unarmed_stun_hit", CbtSpamMiss = "unarmed_stun_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "unarmedblind1", animation = "attack_high_center_light_1", requiredWeaponType = UNARMED, range = 0, damageRatio = 1.5, speedRatio = 2.0, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 10, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "aryxslash_block", CbtSpamCounter = "aryxslash_counter", CbtSpamEvade = "aryxslash_evade", CbtSpamHit = "aryxslash_hit", CbtSpamMiss = "aryxslash_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "unarmedspinattack1", animation = "combo_3c_light", requiredWeaponType = UNARMED, range = 0, damageRatio = 2.0, speedRatio = 2.0, areaRange = 7, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "spinningsmash_block", CbtSpamCounter = "spinningsmash_counter", CbtSpamEvade = "spinningsmash_evade", CbtSpamHit = "spinningsmash_hit", CbtSpamMiss = "spinningsmash_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) -----------------------1HANDED---------------------------------------- RandPoolAtt = { attackname = "melee1hhit1", animation = "counter_high_center_light", requiredWeaponType = ONEHANDED, range = 0, damageRatio = 2.5, speedRatio = 1.45, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "chomai_block", CbtSpamCounter = "chomai_counter", CbtSpamEvade = "chomai_evade", CbtSpamHit = "chomai_hit", CbtSpamMiss = "chomai_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- DirectPoolAtt = { attackname = "melee1hbodyhit1", animation = "counter_high_right_light", requiredWeaponType = ONEHANDED, range = 0, damageRatio = 1.5, speedRatio = 1.45, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, healthAttackChance = 100, strengthAttackChance = 0, constitutionAttackChance = 0, actionAttackChance = 0, quicknessAttackChance = 0, staminaAttackChance = 0, mindAttackChance = 0, focusAttackChance = 0, willpowerAttackChance = 0, knockdownChance = 0, postureDownChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "saimai_block", CbtSpamCounter = "saimai_counter", CbtSpamEvade = "saimai_evade", CbtSpamHit = "saimai_hit", CbtSpamMiss = "saimai_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddDirectPoolAttackTargetSkill(DirectPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "melee1hdizzyhit1", animation = "combo_2b_medium", requiredWeaponType = ONEHANDED, range = 0, damageRatio = 2.0, speedRatio = 1.45, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 10, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "sword1_dizzy_block", CbtSpamCounter = "sword1_dizzy_counter", CbtSpamEvade = "sword1_dizzy_evade", CbtSpamHit = "sword1_dizzy_hit", CbtSpamMiss = "sword1_dizzy_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "melee1hspinattack1", animation = "attack_high_right_medium_2", requiredWeaponType = ONEHANDED, range = 0, damageRatio = 2.0, speedRatio = 1.45, areaRange = 7, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "slashspin_block", CbtSpamCounter = "slashspin_counter", CbtSpamEvade = "slashspin_evade", CbtSpamHit = "slashspin_hit", CbtSpamMiss = "slashspin_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) -----------------------------2HANDED-------------------------------------- RandPoolAtt = { attackname = "melee2hhit1", animation = "combo_2c_medium", requiredWeaponType = TWOHANDED, range = 0, damageRatio = 2.0, speedRatio = 1.5, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "sword2_dam1_block", CbtSpamCounter = "sword2_dam1_counter", CbtSpamEvade = "sword2_dam1_evade", CbtSpamHit = "sword2_dam1_hit", CbtSpamMiss = "sword2_dam1_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- DirectPoolAtt = { attackname = "melee2hheadhit1", animation = "combo_2d_medium", requiredWeaponType = TWOHANDED, range = 0, damageRatio = 1.5, speedRatio = 1.6, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, healthAttackChance = 0, strengthAttackChance = 0, constitutionAttackChance = 0, actionAttackChance = 0, quicknessAttackChance = 0, staminaAttackChance = 0, mindAttackChance = 100, focusAttackChance = 0, willpowerAttackChance = 0, knockdownChance = 0, postureDownChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "sword2_head_block", CbtSpamCounter = "sword2_head_counter", CbtSpamEvade = "sword2_head_evade", CbtSpamHit = "sword2_head_hit", CbtSpamMiss = "sword2_head_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddDirectPoolAttackTargetSkill(DirectPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "melee2hsweep1", animation = "lower_posture_2hmelee_3", requiredWeaponType = TWOHANDED, range = 0, damageRatio = 1.5, speedRatio = 1.7, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 10, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "melee2hsweep1_block", CbtSpamCounter = "melee2hsweep1_counter", CbtSpamEvade = "melee2hsweep1_evade", CbtSpamHit = "melee2hsweep1_hit", CbtSpamMiss = "melee2hsweep1_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "melee2hspinattack1", animation = "attack_high_right_light_2", requiredWeaponType = TWOHANDED, range = 0, damageRatio = 2.0, speedRatio = 1.8, areaRange = 7, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "melee_block", CbtSpamCounter = "melee_counter", CbtSpamEvade = "melee_evade", CbtSpamHit = "melee_hit", CbtSpamMiss = "melee_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ------------------------------POLEARMS--------------------------------- RandPoolAtt = { attackname = "polearmhit1", animation = "combo_2b_light", requiredWeaponType = POLEARM, range = 0, damageRatio = 2.0, speedRatio = 1.5, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "polearm_dam1_block", CbtSpamCounter = "polearm_dam1_counter", CbtSpamEvade = "polearm_dam1_evade", CbtSpamHit = "polearm_dam1_hit", CbtSpamMiss = "polearm_dam1_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- DirectPoolAtt = { attackname = "polearmleghit1", animation = "attack_low_left_medium_0", requiredWeaponType = POLEARM, range = 0, damageRatio = 1.5, speedRatio = 1.5, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, healthAttackChance = 0, strengthAttackChance = 0, constitutionAttackChance = 0, actionAttackChance = 100, quicknessAttackChance = 0, staminaAttackChance = 0, mindAttackChance = 0, focusAttackChance = 0, willpowerAttackChance = 0, knockdownChance = 0, postureDownChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "polearm_limbs_block", CbtSpamCounter = "polearm_limbs_counter", CbtSpamEvade = "polearm_limbs_evade", CbtSpamHit = "polearm_limbs_hit", CbtSpamMiss = "polearm_limbs_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddDirectPoolAttackTargetSkill(DirectPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "polearmstun1", animation = "combo_4a_light", requiredWeaponType = POLEARM, range = 0, damageRatio = 1.5, speedRatio = 1.6, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 20, intimidateChance = 0, CbtSpamBlock = "breathstealer_block", CbtSpamCounter = "breathstealer_counter", CbtSpamEvade = "breathstealer_evade", CbtSpamHit = "breathstealer_hit", CbtSpamMiss = "breathstealer_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "polearmspinattack1", animation = "attack_high_left_light_2", requiredWeaponType = POLEARM, range = 0, damageRatio = 1.5, speedRatio = 1.5, areaRange = 7, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "melee_block", CbtSpamCounter = "melee_counter", CbtSpamEvade = "melee_evade", CbtSpamHit = "melee_hit", CbtSpamMiss = "melee_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) --------------------------------MASTER---------------------------------- RandPoolAtt = { attackname = "melee1hlunge2", animation = "lower_posture_1hmelee_1", requiredWeaponType = ONEHANDED, range = 20, damageRatio = 2.0, speedRatio = 1.5, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 40, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "sword1_knockdown_block", CbtSpamCounter = "sword1_knockdown_counter", CbtSpamEvade = "sword1_knockdown_evade", CbtSpamHit = "sword1_knockdown_hit", CbtSpamMiss = "sword1_knockdown_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "melee2hlunge2", animation = "lower_posture_2hmelee_1", requiredWeaponType = TWOHANDED, range = 20, damageRatio = 2.0, speedRatio = 1.5, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 40, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "sword2_knockdown_block", CbtSpamCounter = "sword2_knockdown_counter", CbtSpamEvade = "sword2_knockdown_evade", CbtSpamHit = "sword2_knockdown_hit", CbtSpamMiss = "sword2_knockdown_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "polearmlunge2", animation = "lower_posture_polearm_2", requiredWeaponType = POLEARM, range = 20, damageRatio = 2.0, speedRatio = 1.5, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 40, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "polearm_knockdown_block", CbtSpamCounter = "polearm_knockdown_counter", CbtSpamEvade = "polerarm_knockdown_evade", CbtSpamHit = "polearm_knockdown_hit", CbtSpamMiss = "polearm_knockdown_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- RandPoolAtt = { attackname = "unarmedlunge2", animation = "counter_mid_center_light", requiredWeaponType = UNARMED, range = 20, damageRatio = 3.0, speedRatio = 2.0, areaRange = 0, accuracyBonus = 0, healthCostMultiplier = 1, actionCostMultiplier = 1, mindCostMultiplier = 1, forceCostMultiplier = 0, knockdownChance = 40, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "unarmed_knockdown_block", CbtSpamCounter = "unarmed_knockdown_counter", CbtSpamEvade = "unarmed_knockdown_evade", CbtSpamHit = "unarmed_knockdown_hit", CbtSpamMiss = "unarmed_knockdown_miss", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddRandomPoolAttackTargetSkill(RandPoolAtt) ----------------------------------------------------------------------- CmbtEnhaceSkill = { skillname = "intimidate2", animation = "intimidate", range = 15, duration = 120.0, speedRatio = 1.0, meleeDamagePenalty = 0, rangedDamagePenalty = 0, meleeAccuracyPenalty = 0, rangedAccuracyPenalty = 0, defensePenalty = 0, speedPenalty = 0, nextAttackDelay = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 40, selfEffect = "clienteffect/combat_special_attacker_intimidate.cef", FlyText = "", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddDeBuffAttackTargetSkill(CmbtEnhaceSkill) ----------------------------------------------------------------------- CmbtEnhaceSkill = { skillname = "warcry2", animation = "warcry", range = 15, areaRange = 10, duration = 30.0, speedRatio = 1.0, meleeDamagePenalty = 0, rangedDamagePenalty = 0, meleeAccuracyPenalty = 0, rangedAccuracyPenalty = 0, defensePenalty = 0, speedPenalty = 0, nextAttackDelay = 20.0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, selfEffect = "clienteffect/combat_special_attacker_warcry.cef", FlyText = "", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddDeBuffAttackTargetSkill(CmbtEnhaceSkill) Berserk = { skillname = "berserk1", duration = 20, damage = 25, requiredWeaponType = MELEE, invalidStateMask = 3894805520, --alert, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddBerserkSelfSkill(Berserk) Berserk = { skillname = "berserk2", duration = 40, damage = 75, requiredWeaponType = MELEE, invalidStateMask = 3894805520, --alert, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", instant = 0 } AddBerserkSelfSkill(Berserk)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/naboo/creatures/mottBull.lua
1
4672
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. mottBull = Creature:new { objectName = "mottBull", -- Lua Object Name creatureType = "ANIMAL", gender = "", speciesName = "mott_bull", stfName = "mob/creature_names", objectCRC = 1601195957, socialGroup = "Mott", level = 11, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 990, healthMin = 810, strength = 0, constitution = 0, actionMax = 990, actionMin = 810, quickness = 0, stamina = 0, mindMax = 990, mindMin = 810, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = 0, stun = -1, blast = 0, heat = 0, cold = 0, acid = 0, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 130, weaponMaxDamage = 140, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0.25, -- Likely hood to be tamed datapadItemCRC = 604608091, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "bone_mammal_naboo", boneMax = 40, hideType = "hide_leathery_naboo", hideMax = 65, meatType = "meat_herbivore_naboo", meatMax = 100, --skills = { " Intimidation attack", "", "" } skills = { "mottAttack3" }, respawnTimer = 60, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(mottBull, 1601195957) -- Add to Global Table
lgpl-3.0
rmmh/kubernetes-contrib
ingress/controllers/nginx/lua/vendor/lua-resty-http/lib/resty/http.lua
45
21496
local http_headers = require "resty.http_headers" local ngx_socket_tcp = ngx.socket.tcp local ngx_req = ngx.req local ngx_req_socket = ngx_req.socket local ngx_req_get_headers = ngx_req.get_headers local ngx_req_get_method = ngx_req.get_method local str_gmatch = string.gmatch local str_lower = string.lower local str_upper = string.upper local str_find = string.find local str_sub = string.sub local str_gsub = string.gsub local tbl_concat = table.concat local tbl_insert = table.insert local ngx_encode_args = ngx.encode_args local ngx_re_match = ngx.re.match local ngx_re_gsub = ngx.re.gsub local ngx_log = ngx.log local ngx_DEBUG = ngx.DEBUG local ngx_ERR = ngx.ERR local ngx_NOTICE = ngx.NOTICE local ngx_var = ngx.var local co_yield = coroutine.yield local co_create = coroutine.create local co_status = coroutine.status local co_resume = coroutine.resume -- http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1 local HOP_BY_HOP_HEADERS = { ["connection"] = true, ["keep-alive"] = true, ["proxy-authenticate"] = true, ["proxy-authorization"] = true, ["te"] = true, ["trailers"] = true, ["transfer-encoding"] = true, ["upgrade"] = true, ["content-length"] = true, -- Not strictly hop-by-hop, but Nginx will deal -- with this (may send chunked for example). } -- Reimplemented coroutine.wrap, returning "nil, err" if the coroutine cannot -- be resumed. This protects user code from inifite loops when doing things like -- repeat -- local chunk, err = res.body_reader() -- if chunk then -- <-- This could be a string msg in the core wrap function. -- ... -- end -- until not chunk local co_wrap = function(func) local co = co_create(func) if not co then return nil, "could not create coroutine" else return function(...) if co_status(co) == "suspended" then return select(2, co_resume(co, ...)) else return nil, "can't resume a " .. co_status(co) .. " coroutine" end end end end local _M = { _VERSION = '0.07', } _M._USER_AGENT = "lua-resty-http/" .. _M._VERSION .. " (Lua) ngx_lua/" .. ngx.config.ngx_lua_version local mt = { __index = _M } local HTTP = { [1.0] = " HTTP/1.0\r\n", [1.1] = " HTTP/1.1\r\n", } local DEFAULT_PARAMS = { method = "GET", path = "/", version = 1.1, } function _M.new(self) local sock, err = ngx_socket_tcp() if not sock then return nil, err end return setmetatable({ sock = sock, keepalive = true }, mt) end function _M.set_timeout(self, timeout) local sock = self.sock if not sock then return nil, "not initialized" end return sock:settimeout(timeout) end function _M.ssl_handshake(self, ...) local sock = self.sock if not sock then return nil, "not initialized" end return sock:sslhandshake(...) end function _M.connect(self, ...) local sock = self.sock if not sock then return nil, "not initialized" end self.host = select(1, ...) self.keepalive = true return sock:connect(...) end function _M.set_keepalive(self, ...) local sock = self.sock if not sock then return nil, "not initialized" end if self.keepalive == true then return sock:setkeepalive(...) else -- The server said we must close the connection, so we cannot setkeepalive. -- If close() succeeds we return 2 instead of 1, to differentiate between -- a normal setkeepalive() failure and an intentional close(). local res, err = sock:close() if res then return 2, "connection must be closed" else return res, err end end end function _M.get_reused_times(self) local sock = self.sock if not sock then return nil, "not initialized" end return sock:getreusedtimes() end function _M.close(self) local sock = self.sock if not sock then return nil, "not initialized" end return sock:close() end local function _should_receive_body(method, code) if method == "HEAD" then return nil end if code == 204 or code == 304 then return nil end if code >= 100 and code < 200 then return nil end return true end function _M.parse_uri(self, uri) local m, err = ngx_re_match(uri, [[^(http[s]*)://([^:/]+)(?::(\d+))?(.*)]], "jo") if not m then if err then return nil, "failed to match the uri: " .. err end return nil, "bad uri" else if not m[3] then if m[1] == "https" then m[3] = 443 else m[3] = 80 end end if not m[4] or "" == m[4] then m[4] = "/" end return m, nil end end local function _format_request(params) local version = params.version local headers = params.headers or {} local query = params.query or "" if query then if type(query) == "table" then query = "?" .. ngx_encode_args(query) end end -- Initialize request local req = { str_upper(params.method), " ", params.path, query, HTTP[version], -- Pre-allocate slots for minimum headers and carriage return. true, true, true, } local c = 6 -- req table index it's faster to do this inline vs table.insert -- Append headers for key, values in pairs(headers) do if type(values) ~= "table" then values = {values} end key = tostring(key) for _, value in pairs(values) do req[c] = key .. ": " .. tostring(value) .. "\r\n" c = c + 1 end end -- Close headers req[c] = "\r\n" return tbl_concat(req) end local function _receive_status(sock) local line, err = sock:receive("*l") if not line then return nil, nil, err end return tonumber(str_sub(line, 10, 12)), tonumber(str_sub(line, 6, 8)) end local function _receive_headers(sock) local headers = http_headers.new() repeat local line, err = sock:receive("*l") if not line then return nil, err end for key, val in str_gmatch(line, "([^:%s]+):%s*(.+)") do if headers[key] then if type(headers[key]) ~= "table" then headers[key] = { headers[key] } end tbl_insert(headers[key], tostring(val)) else headers[key] = tostring(val) end end until str_find(line, "^%s*$") return headers, nil end local function _chunked_body_reader(sock, default_chunk_size) return co_wrap(function(max_chunk_size) local max_chunk_size = max_chunk_size or default_chunk_size local remaining = 0 local length repeat -- If we still have data on this chunk if max_chunk_size and remaining > 0 then if remaining > max_chunk_size then -- Consume up to max_chunk_size length = max_chunk_size remaining = remaining - max_chunk_size else -- Consume all remaining length = remaining remaining = 0 end else -- This is a fresh chunk -- Receive the chunk size local str, err = sock:receive("*l") if not str then co_yield(nil, err) end length = tonumber(str, 16) if not length then co_yield(nil, "unable to read chunksize") end if max_chunk_size and length > max_chunk_size then -- Consume up to max_chunk_size remaining = length - max_chunk_size length = max_chunk_size end end if length > 0 then local str, err = sock:receive(length) if not str then co_yield(nil, err) end max_chunk_size = co_yield(str) or default_chunk_size -- If we're finished with this chunk, read the carriage return. if remaining == 0 then sock:receive(2) -- read \r\n end else -- Read the last (zero length) chunk's carriage return sock:receive(2) -- read \r\n end until length == 0 end) end local function _body_reader(sock, content_length, default_chunk_size) return co_wrap(function(max_chunk_size) local max_chunk_size = max_chunk_size or default_chunk_size if not content_length and max_chunk_size then -- We have no length, but wish to stream. -- HTTP 1.0 with no length will close connection, so read chunks to the end. repeat local str, err, partial = sock:receive(max_chunk_size) if not str and err == "closed" then max_chunk_size = tonumber(co_yield(partial, err) or default_chunk_size) end max_chunk_size = tonumber(co_yield(str) or default_chunk_size) if max_chunk_size and max_chunk_size < 0 then max_chunk_size = nil end if not max_chunk_size then ngx_log(ngx_ERR, "Buffer size not specified, bailing") break end until not str elseif not content_length then -- We have no length but don't wish to stream. -- HTTP 1.0 with no length will close connection, so read to the end. co_yield(sock:receive("*a")) elseif not max_chunk_size then -- We have a length and potentially keep-alive, but want everything. co_yield(sock:receive(content_length)) else -- We have a length and potentially a keep-alive, and wish to stream -- the response. local received = 0 repeat local length = max_chunk_size if received + length > content_length then length = content_length - received end if length > 0 then local str, err = sock:receive(length) if not str then max_chunk_size = tonumber(co_yield(nil, err) or default_chunk_size) end received = received + length max_chunk_size = tonumber(co_yield(str) or default_chunk_size) if max_chunk_size and max_chunk_size < 0 then max_chunk_size = nil end if not max_chunk_size then ngx_log(ngx_ERR, "Buffer size not specified, bailing") break end end until length == 0 end end) end local function _no_body_reader() return nil end local function _read_body(res) local reader = res.body_reader if not reader then -- Most likely HEAD or 304 etc. return nil, "no body to be read" end local chunks = {} local c = 1 local chunk, err repeat chunk, err = reader() if err then return nil, err, tbl_concat(chunks) -- Return any data so far. end if chunk then chunks[c] = chunk c = c + 1 end until not chunk return tbl_concat(chunks) end local function _trailer_reader(sock) return co_wrap(function() co_yield(_receive_headers(sock)) end) end local function _read_trailers(res) local reader = res.trailer_reader if not reader then return nil, "no trailers" end local trailers = reader() setmetatable(res.headers, { __index = trailers }) end local function _send_body(sock, body) if type(body) == 'function' then repeat local chunk, err, partial = body() if chunk then local ok,err = sock:send(chunk) if not ok then return nil, err end elseif err ~= nil then return nil, err, partial end until chunk == nil elseif body ~= nil then local bytes, err = sock:send(body) if not bytes then return nil, err end end return true, nil end local function _handle_continue(sock, body) local status, version, err = _receive_status(sock) if not status then return nil, err end -- Only send body if we receive a 100 Continue if status == 100 then local ok, err = sock:receive("*l") -- Read carriage return if not ok then return nil, err end _send_body(sock, body) end return status, version, err end function _M.send_request(self, params) -- Apply defaults setmetatable(params, { __index = DEFAULT_PARAMS }) local sock = self.sock local body = params.body local headers = http_headers.new() local params_headers = params.headers if params_headers then -- We assign one by one so that the metatable can handle case insensitivity -- for us. You can blame the spec for this inefficiency. for k,v in pairs(params_headers) do headers[k] = v end end -- Ensure minimal headers are set if type(body) == 'string' and not headers["Content-Length"] then headers["Content-Length"] = #body end if not headers["Host"] then headers["Host"] = self.host end if not headers["User-Agent"] then headers["User-Agent"] = _M._USER_AGENT end if params.version == 1.0 and not headers["Connection"] then headers["Connection"] = "Keep-Alive" end params.headers = headers -- Format and send request local req = _format_request(params) ngx_log(ngx_DEBUG, "\n", req) local bytes, err = sock:send(req) if not bytes then return nil, err end -- Send the request body, unless we expect: continue, in which case -- we handle this as part of reading the response. if headers["Expect"] ~= "100-continue" then local ok, err, partial = _send_body(sock, body) if not ok then return nil, err, partial end end return true end function _M.read_response(self, params) local sock = self.sock local status, version, err -- If we expect: continue, we need to handle this, sending the body if allowed. -- If we don't get 100 back, then status is the actual status. if params.headers["Expect"] == "100-continue" then local _status, _version, _err = _handle_continue(sock, params.body) if not _status then return nil, _err elseif _status ~= 100 then status, version, err = _status, _version, _err end end -- Just read the status as normal. if not status then status, version, err = _receive_status(sock) if not status then return nil, err end end local res_headers, err = _receive_headers(sock) if not res_headers then return nil, err end -- Determine if we should keepalive or not. local ok, connection = pcall(str_lower, res_headers["Connection"]) if ok then if (version == 1.1 and connection == "close") or (version == 1.0 and connection ~= "keep-alive") then self.keepalive = false end end local body_reader = _no_body_reader local trailer_reader, err = nil, nil local has_body = false -- Receive the body_reader if _should_receive_body(params.method, status) then local ok, encoding = pcall(str_lower, res_headers["Transfer-Encoding"]) if ok and version == 1.1 and encoding == "chunked" then body_reader, err = _chunked_body_reader(sock) has_body = true else local ok, length = pcall(tonumber, res_headers["Content-Length"]) if ok then body_reader, err = _body_reader(sock, length) has_body = true end end end if res_headers["Trailer"] then trailer_reader, err = _trailer_reader(sock) end if err then return nil, err else return { status = status, headers = res_headers, has_body = has_body, body_reader = body_reader, read_body = _read_body, trailer_reader = trailer_reader, read_trailers = _read_trailers, } end end function _M.request(self, params) local res, err = self:send_request(params) if not res then return res, err else return self:read_response(params) end end function _M.request_pipeline(self, requests) for i, params in ipairs(requests) do if params.headers and params.headers["Expect"] == "100-continue" then return nil, "Cannot pipeline request specifying Expect: 100-continue" end local res, err = self:send_request(params) if not res then return res, err end end local responses = {} for i, params in ipairs(requests) do responses[i] = setmetatable({ params = params, response_read = false, }, { -- Read each actual response lazily, at the point the user tries -- to access any of the fields. __index = function(t, k) local res, err if t.response_read == false then res, err = _M.read_response(self, t.params) t.response_read = true if not res then ngx_log(ngx_ERR, err) else for rk, rv in pairs(res) do t[rk] = rv end end end return rawget(t, k) end, }) end return responses end function _M.request_uri(self, uri, params) if not params then params = {} end local parsed_uri, err = self:parse_uri(uri) if not parsed_uri then return nil, err end local scheme, host, port, path = unpack(parsed_uri) if not params.path then params.path = path end local c, err = self:connect(host, port) if not c then return nil, err end if scheme == "https" then local verify = true if params.ssl_verify == false then verify = false end local ok, err = self:ssl_handshake(nil, host, verify) if not ok then return nil, err end end local res, err = self:request(params) if not res then return nil, err end local body, err = res:read_body() if not body then return nil, err end res.body = body local ok, err = self:set_keepalive() if not ok then ngx_log(ngx_ERR, err) end return res, nil end function _M.get_client_body_reader(self, chunksize, sock) local chunksize = chunksize or 65536 if not sock then local ok, err ok, sock, err = pcall(ngx_req_socket) if not ok then return nil, sock -- pcall err end if not sock then if err == "no body" then return nil else return nil, err end end end local headers = ngx_req_get_headers() local length = headers.content_length local encoding = headers.transfer_encoding if length then return _body_reader(sock, tonumber(length), chunksize) elseif encoding and str_lower(encoding) == 'chunked' then -- Not yet supported by ngx_lua but should just work... return _chunked_body_reader(sock, chunksize) else return nil end end function _M.proxy_request(self, chunksize) return self:request{ method = ngx_req_get_method(), path = ngx_re_gsub(ngx_var.uri, "\\s", "%20", "jo") .. ngx_var.is_args .. (ngx_var.query_string or ""), body = self:get_client_body_reader(chunksize), headers = ngx_req_get_headers(), } end function _M.proxy_response(self, response, chunksize) if not response then ngx_log(ngx_ERR, "no response provided") return end ngx.status = response.status -- Filter out hop-by-hop headeres for k,v in pairs(response.headers) do if not HOP_BY_HOP_HEADERS[str_lower(k)] then ngx.header[k] = v end end local reader = response.body_reader repeat local chunk, err = reader(chunksize) if err then ngx_log(ngx_ERR, err) break end if chunk then local res, err = ngx.print(chunk) if not res then ngx_log(ngx_ERR, err) break end end until not chunk end return _M
apache-2.0
danushkaf/contrib
ingress/controllers/nginx/lua/vendor/lua-resty-http/lib/resty/http.lua
45
21496
local http_headers = require "resty.http_headers" local ngx_socket_tcp = ngx.socket.tcp local ngx_req = ngx.req local ngx_req_socket = ngx_req.socket local ngx_req_get_headers = ngx_req.get_headers local ngx_req_get_method = ngx_req.get_method local str_gmatch = string.gmatch local str_lower = string.lower local str_upper = string.upper local str_find = string.find local str_sub = string.sub local str_gsub = string.gsub local tbl_concat = table.concat local tbl_insert = table.insert local ngx_encode_args = ngx.encode_args local ngx_re_match = ngx.re.match local ngx_re_gsub = ngx.re.gsub local ngx_log = ngx.log local ngx_DEBUG = ngx.DEBUG local ngx_ERR = ngx.ERR local ngx_NOTICE = ngx.NOTICE local ngx_var = ngx.var local co_yield = coroutine.yield local co_create = coroutine.create local co_status = coroutine.status local co_resume = coroutine.resume -- http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1 local HOP_BY_HOP_HEADERS = { ["connection"] = true, ["keep-alive"] = true, ["proxy-authenticate"] = true, ["proxy-authorization"] = true, ["te"] = true, ["trailers"] = true, ["transfer-encoding"] = true, ["upgrade"] = true, ["content-length"] = true, -- Not strictly hop-by-hop, but Nginx will deal -- with this (may send chunked for example). } -- Reimplemented coroutine.wrap, returning "nil, err" if the coroutine cannot -- be resumed. This protects user code from inifite loops when doing things like -- repeat -- local chunk, err = res.body_reader() -- if chunk then -- <-- This could be a string msg in the core wrap function. -- ... -- end -- until not chunk local co_wrap = function(func) local co = co_create(func) if not co then return nil, "could not create coroutine" else return function(...) if co_status(co) == "suspended" then return select(2, co_resume(co, ...)) else return nil, "can't resume a " .. co_status(co) .. " coroutine" end end end end local _M = { _VERSION = '0.07', } _M._USER_AGENT = "lua-resty-http/" .. _M._VERSION .. " (Lua) ngx_lua/" .. ngx.config.ngx_lua_version local mt = { __index = _M } local HTTP = { [1.0] = " HTTP/1.0\r\n", [1.1] = " HTTP/1.1\r\n", } local DEFAULT_PARAMS = { method = "GET", path = "/", version = 1.1, } function _M.new(self) local sock, err = ngx_socket_tcp() if not sock then return nil, err end return setmetatable({ sock = sock, keepalive = true }, mt) end function _M.set_timeout(self, timeout) local sock = self.sock if not sock then return nil, "not initialized" end return sock:settimeout(timeout) end function _M.ssl_handshake(self, ...) local sock = self.sock if not sock then return nil, "not initialized" end return sock:sslhandshake(...) end function _M.connect(self, ...) local sock = self.sock if not sock then return nil, "not initialized" end self.host = select(1, ...) self.keepalive = true return sock:connect(...) end function _M.set_keepalive(self, ...) local sock = self.sock if not sock then return nil, "not initialized" end if self.keepalive == true then return sock:setkeepalive(...) else -- The server said we must close the connection, so we cannot setkeepalive. -- If close() succeeds we return 2 instead of 1, to differentiate between -- a normal setkeepalive() failure and an intentional close(). local res, err = sock:close() if res then return 2, "connection must be closed" else return res, err end end end function _M.get_reused_times(self) local sock = self.sock if not sock then return nil, "not initialized" end return sock:getreusedtimes() end function _M.close(self) local sock = self.sock if not sock then return nil, "not initialized" end return sock:close() end local function _should_receive_body(method, code) if method == "HEAD" then return nil end if code == 204 or code == 304 then return nil end if code >= 100 and code < 200 then return nil end return true end function _M.parse_uri(self, uri) local m, err = ngx_re_match(uri, [[^(http[s]*)://([^:/]+)(?::(\d+))?(.*)]], "jo") if not m then if err then return nil, "failed to match the uri: " .. err end return nil, "bad uri" else if not m[3] then if m[1] == "https" then m[3] = 443 else m[3] = 80 end end if not m[4] or "" == m[4] then m[4] = "/" end return m, nil end end local function _format_request(params) local version = params.version local headers = params.headers or {} local query = params.query or "" if query then if type(query) == "table" then query = "?" .. ngx_encode_args(query) end end -- Initialize request local req = { str_upper(params.method), " ", params.path, query, HTTP[version], -- Pre-allocate slots for minimum headers and carriage return. true, true, true, } local c = 6 -- req table index it's faster to do this inline vs table.insert -- Append headers for key, values in pairs(headers) do if type(values) ~= "table" then values = {values} end key = tostring(key) for _, value in pairs(values) do req[c] = key .. ": " .. tostring(value) .. "\r\n" c = c + 1 end end -- Close headers req[c] = "\r\n" return tbl_concat(req) end local function _receive_status(sock) local line, err = sock:receive("*l") if not line then return nil, nil, err end return tonumber(str_sub(line, 10, 12)), tonumber(str_sub(line, 6, 8)) end local function _receive_headers(sock) local headers = http_headers.new() repeat local line, err = sock:receive("*l") if not line then return nil, err end for key, val in str_gmatch(line, "([^:%s]+):%s*(.+)") do if headers[key] then if type(headers[key]) ~= "table" then headers[key] = { headers[key] } end tbl_insert(headers[key], tostring(val)) else headers[key] = tostring(val) end end until str_find(line, "^%s*$") return headers, nil end local function _chunked_body_reader(sock, default_chunk_size) return co_wrap(function(max_chunk_size) local max_chunk_size = max_chunk_size or default_chunk_size local remaining = 0 local length repeat -- If we still have data on this chunk if max_chunk_size and remaining > 0 then if remaining > max_chunk_size then -- Consume up to max_chunk_size length = max_chunk_size remaining = remaining - max_chunk_size else -- Consume all remaining length = remaining remaining = 0 end else -- This is a fresh chunk -- Receive the chunk size local str, err = sock:receive("*l") if not str then co_yield(nil, err) end length = tonumber(str, 16) if not length then co_yield(nil, "unable to read chunksize") end if max_chunk_size and length > max_chunk_size then -- Consume up to max_chunk_size remaining = length - max_chunk_size length = max_chunk_size end end if length > 0 then local str, err = sock:receive(length) if not str then co_yield(nil, err) end max_chunk_size = co_yield(str) or default_chunk_size -- If we're finished with this chunk, read the carriage return. if remaining == 0 then sock:receive(2) -- read \r\n end else -- Read the last (zero length) chunk's carriage return sock:receive(2) -- read \r\n end until length == 0 end) end local function _body_reader(sock, content_length, default_chunk_size) return co_wrap(function(max_chunk_size) local max_chunk_size = max_chunk_size or default_chunk_size if not content_length and max_chunk_size then -- We have no length, but wish to stream. -- HTTP 1.0 with no length will close connection, so read chunks to the end. repeat local str, err, partial = sock:receive(max_chunk_size) if not str and err == "closed" then max_chunk_size = tonumber(co_yield(partial, err) or default_chunk_size) end max_chunk_size = tonumber(co_yield(str) or default_chunk_size) if max_chunk_size and max_chunk_size < 0 then max_chunk_size = nil end if not max_chunk_size then ngx_log(ngx_ERR, "Buffer size not specified, bailing") break end until not str elseif not content_length then -- We have no length but don't wish to stream. -- HTTP 1.0 with no length will close connection, so read to the end. co_yield(sock:receive("*a")) elseif not max_chunk_size then -- We have a length and potentially keep-alive, but want everything. co_yield(sock:receive(content_length)) else -- We have a length and potentially a keep-alive, and wish to stream -- the response. local received = 0 repeat local length = max_chunk_size if received + length > content_length then length = content_length - received end if length > 0 then local str, err = sock:receive(length) if not str then max_chunk_size = tonumber(co_yield(nil, err) or default_chunk_size) end received = received + length max_chunk_size = tonumber(co_yield(str) or default_chunk_size) if max_chunk_size and max_chunk_size < 0 then max_chunk_size = nil end if not max_chunk_size then ngx_log(ngx_ERR, "Buffer size not specified, bailing") break end end until length == 0 end end) end local function _no_body_reader() return nil end local function _read_body(res) local reader = res.body_reader if not reader then -- Most likely HEAD or 304 etc. return nil, "no body to be read" end local chunks = {} local c = 1 local chunk, err repeat chunk, err = reader() if err then return nil, err, tbl_concat(chunks) -- Return any data so far. end if chunk then chunks[c] = chunk c = c + 1 end until not chunk return tbl_concat(chunks) end local function _trailer_reader(sock) return co_wrap(function() co_yield(_receive_headers(sock)) end) end local function _read_trailers(res) local reader = res.trailer_reader if not reader then return nil, "no trailers" end local trailers = reader() setmetatable(res.headers, { __index = trailers }) end local function _send_body(sock, body) if type(body) == 'function' then repeat local chunk, err, partial = body() if chunk then local ok,err = sock:send(chunk) if not ok then return nil, err end elseif err ~= nil then return nil, err, partial end until chunk == nil elseif body ~= nil then local bytes, err = sock:send(body) if not bytes then return nil, err end end return true, nil end local function _handle_continue(sock, body) local status, version, err = _receive_status(sock) if not status then return nil, err end -- Only send body if we receive a 100 Continue if status == 100 then local ok, err = sock:receive("*l") -- Read carriage return if not ok then return nil, err end _send_body(sock, body) end return status, version, err end function _M.send_request(self, params) -- Apply defaults setmetatable(params, { __index = DEFAULT_PARAMS }) local sock = self.sock local body = params.body local headers = http_headers.new() local params_headers = params.headers if params_headers then -- We assign one by one so that the metatable can handle case insensitivity -- for us. You can blame the spec for this inefficiency. for k,v in pairs(params_headers) do headers[k] = v end end -- Ensure minimal headers are set if type(body) == 'string' and not headers["Content-Length"] then headers["Content-Length"] = #body end if not headers["Host"] then headers["Host"] = self.host end if not headers["User-Agent"] then headers["User-Agent"] = _M._USER_AGENT end if params.version == 1.0 and not headers["Connection"] then headers["Connection"] = "Keep-Alive" end params.headers = headers -- Format and send request local req = _format_request(params) ngx_log(ngx_DEBUG, "\n", req) local bytes, err = sock:send(req) if not bytes then return nil, err end -- Send the request body, unless we expect: continue, in which case -- we handle this as part of reading the response. if headers["Expect"] ~= "100-continue" then local ok, err, partial = _send_body(sock, body) if not ok then return nil, err, partial end end return true end function _M.read_response(self, params) local sock = self.sock local status, version, err -- If we expect: continue, we need to handle this, sending the body if allowed. -- If we don't get 100 back, then status is the actual status. if params.headers["Expect"] == "100-continue" then local _status, _version, _err = _handle_continue(sock, params.body) if not _status then return nil, _err elseif _status ~= 100 then status, version, err = _status, _version, _err end end -- Just read the status as normal. if not status then status, version, err = _receive_status(sock) if not status then return nil, err end end local res_headers, err = _receive_headers(sock) if not res_headers then return nil, err end -- Determine if we should keepalive or not. local ok, connection = pcall(str_lower, res_headers["Connection"]) if ok then if (version == 1.1 and connection == "close") or (version == 1.0 and connection ~= "keep-alive") then self.keepalive = false end end local body_reader = _no_body_reader local trailer_reader, err = nil, nil local has_body = false -- Receive the body_reader if _should_receive_body(params.method, status) then local ok, encoding = pcall(str_lower, res_headers["Transfer-Encoding"]) if ok and version == 1.1 and encoding == "chunked" then body_reader, err = _chunked_body_reader(sock) has_body = true else local ok, length = pcall(tonumber, res_headers["Content-Length"]) if ok then body_reader, err = _body_reader(sock, length) has_body = true end end end if res_headers["Trailer"] then trailer_reader, err = _trailer_reader(sock) end if err then return nil, err else return { status = status, headers = res_headers, has_body = has_body, body_reader = body_reader, read_body = _read_body, trailer_reader = trailer_reader, read_trailers = _read_trailers, } end end function _M.request(self, params) local res, err = self:send_request(params) if not res then return res, err else return self:read_response(params) end end function _M.request_pipeline(self, requests) for i, params in ipairs(requests) do if params.headers and params.headers["Expect"] == "100-continue" then return nil, "Cannot pipeline request specifying Expect: 100-continue" end local res, err = self:send_request(params) if not res then return res, err end end local responses = {} for i, params in ipairs(requests) do responses[i] = setmetatable({ params = params, response_read = false, }, { -- Read each actual response lazily, at the point the user tries -- to access any of the fields. __index = function(t, k) local res, err if t.response_read == false then res, err = _M.read_response(self, t.params) t.response_read = true if not res then ngx_log(ngx_ERR, err) else for rk, rv in pairs(res) do t[rk] = rv end end end return rawget(t, k) end, }) end return responses end function _M.request_uri(self, uri, params) if not params then params = {} end local parsed_uri, err = self:parse_uri(uri) if not parsed_uri then return nil, err end local scheme, host, port, path = unpack(parsed_uri) if not params.path then params.path = path end local c, err = self:connect(host, port) if not c then return nil, err end if scheme == "https" then local verify = true if params.ssl_verify == false then verify = false end local ok, err = self:ssl_handshake(nil, host, verify) if not ok then return nil, err end end local res, err = self:request(params) if not res then return nil, err end local body, err = res:read_body() if not body then return nil, err end res.body = body local ok, err = self:set_keepalive() if not ok then ngx_log(ngx_ERR, err) end return res, nil end function _M.get_client_body_reader(self, chunksize, sock) local chunksize = chunksize or 65536 if not sock then local ok, err ok, sock, err = pcall(ngx_req_socket) if not ok then return nil, sock -- pcall err end if not sock then if err == "no body" then return nil else return nil, err end end end local headers = ngx_req_get_headers() local length = headers.content_length local encoding = headers.transfer_encoding if length then return _body_reader(sock, tonumber(length), chunksize) elseif encoding and str_lower(encoding) == 'chunked' then -- Not yet supported by ngx_lua but should just work... return _chunked_body_reader(sock, chunksize) else return nil end end function _M.proxy_request(self, chunksize) return self:request{ method = ngx_req_get_method(), path = ngx_re_gsub(ngx_var.uri, "\\s", "%20", "jo") .. ngx_var.is_args .. (ngx_var.query_string or ""), body = self:get_client_body_reader(chunksize), headers = ngx_req_get_headers(), } end function _M.proxy_response(self, response, chunksize) if not response then ngx_log(ngx_ERR, "no response provided") return end ngx.status = response.status -- Filter out hop-by-hop headeres for k,v in pairs(response.headers) do if not HOP_BY_HOP_HEADERS[str_lower(k)] then ngx.header[k] = v end end local reader = response.body_reader repeat local chunk, err = reader(chunksize) if err then ngx_log(ngx_ERR, err) break end if chunk then local res, err = ngx.print(chunk) if not res then ngx_log(ngx_ERR, err) break end end until not chunk end return _M
apache-2.0
mramir8274/goldnbot
plugin.lua
62
5964
do -- Returns the key (index) in the config.enabled_plugins table local function plugin_enabled( name ) for k,v in pairs(_config.enabled_plugins) do if name == v then return k end end -- If not found return false end -- Returns true if file exists in plugins folder local function plugin_exists( name ) for k,v in pairs(plugins_names()) do if name..'.lua' == v then return true end end return false end local function list_all_plugins(only_enabled) local text = '' local nsum = 0 for k, v in pairs( plugins_names( )) do -- ✔ enabled, ❌ disabled local status = '❌' nsum = nsum+1 nact = 0 -- Check if is enabled for k2, v2 in pairs(_config.enabled_plugins) do if v == v2..'.lua' then status = '✔' end nact = nact+1 end if not only_enabled or status == '✔' then -- get the name v = string.match (v, "(.*)%.lua") text = text..nsum..'> '..status..' '..v..'\n' end end local text = text..'\n______________________________\nNumber of all tools: '..nsum..'\nEnable tools= '..nact..' and Disables= '..nsum-nact return text end local function list_plugins(only_enabled) local text = '' local nsum = 0 for k, v in pairs( plugins_names( )) do -- ✔ enabled, ❌ disabled local status = '❌' nsum = nsum+1 nact = 0 -- Check if is enabled for k2, v2 in pairs(_config.enabled_plugins) do if v == v2..'.lua' then status = '✔' end nact = nact+1 end if not only_enabled or status == '✔' then -- get the name v = string.match (v, "(.*)%.lua") text = text..status..' '..v..'\n' end end local text = text..'\n___________________________\nAll tools= '..nsum..' ,Enable items= '..nact return text end local function reload_plugins( ) plugins = {} load_plugins() return list_plugins(true) end local function enable_plugin( plugin_name ) print('checking if '..plugin_name..' exists') -- Check if plugin is enabled if plugin_enabled(plugin_name) then return plugin_name..' is enabled' end -- Checks if plugin exists if plugin_exists(plugin_name) then -- Add to the config table table.insert(_config.enabled_plugins, plugin_name) print(plugin_name..' added to _config table') save_config() -- Reload the plugins return reload_plugins( ) else return plugin_name..' does not exists' end end local function disable_plugin( name, chat ) -- Check if plugins exists if not plugin_exists(name) then return name..' does not exists' end local k = plugin_enabled(name) -- Check if plugin is enabled if not k then return name..' not enabled' end -- Disable and reload table.remove(_config.enabled_plugins, k) save_config( ) return reload_plugins(true) end local function disable_plugin_on_chat(receiver, plugin) if not plugin_exists(plugin) then return "Plugin doesn't exists" end if not _config.disabled_plugin_on_chat then _config.disabled_plugin_on_chat = {} end if not _config.disabled_plugin_on_chat[receiver] then _config.disabled_plugin_on_chat[receiver] = {} end _config.disabled_plugin_on_chat[receiver][plugin] = true save_config() return plugin..' disabled in group' end local function reenable_plugin_on_chat(receiver, plugin) if not _config.disabled_plugin_on_chat then return 'There aren\'t any disabled plugins' end if not _config.disabled_plugin_on_chat[receiver] then return 'There aren\'t any disabled plugins for this chat' end if not _config.disabled_plugin_on_chat[receiver][plugin] then return 'This plugin is not disabled' end _config.disabled_plugin_on_chat[receiver][plugin] = false save_config() return plugin..' enabled again' end local function run(msg, matches) -- Show the available plugins if matches[1] == '[!/]plugins' and is_sudo(msg) then --after changed to moderator mode, set only sudo return list_all_plugins() end -- Re-enable a plugin for this chat if matches[1] == '+' and matches[3] == 'gp' then local receiver = get_receiver(msg) local plugin = matches[2] print(""..plugin..' enabled in group') return reenable_plugin_on_chat(receiver, plugin) end -- Enable a plugin if matches[1] == '+' and is_sudo(msg) then --after changed to moderator mode, set only sudo local plugin_name = matches[2] print("enable: "..matches[2]) return enable_plugin(plugin_name) end -- Disable a plugin on a chat if matches[1] == '-' and matches[3] == 'gp' then local plugin = matches[2] local receiver = get_receiver(msg) print(""..plugin..' disabled in group') return disable_plugin_on_chat(receiver, plugin) end -- Disable a plugin if matches[1] == '-' and is_sudo(msg) then --after changed to moderator mode, set only sudo if matches[2] == 'plugins' then return 'This plugin can\'t be disabled' end print("disable: "..matches[2]) return disable_plugin(matches[2]) end -- Reload all the plugins! if matches[1] == '@' and is_sudo(msg) then --after changed to moderator mode, set only sudo return reload_plugins(true) end end return { description = "Plugin Manager", usage = { moderator = { "/plugins - (name) gp : disable item in group", "/plugins + (name) gp : enable item in group", }, sudo = { "/plugins : plugins list", "/plugins + (name) : enable bot item", "/plugins - (name) : disable bot item", "/plugins @ : reloads plugins" }, }, patterns = { "^[!/]plugins$", "^[!/]plugins? (+) ([%w_%.%-]+)$", "^[!/]plugins? (-) ([%w_%.%-]+)$", "^[!/]plugins? (+) ([%w_%.%-]+) (gp)", "^[!/]plugins? (-) ([%w_%.%-]+) (gp)", "^[!/]plugins? (@)$" }, run = run, moderated = true, -- set to moderator mode --privileged = true } end
gpl-2.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/endor/npcs/marauder/bloodCrazedPlainsMarauder.lua
1
4638
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. bloodCrazedPlainsMarauder = Creature:new { objectName = "bloodCrazedPlainsMarauder", -- Lua Object Name creatureType = "NPC", faction = "marauder", factionPoints = 20, gender = "", speciesName = "blood_crazed_plains_marauder", stfName = "mob/creature_names", objectCRC = 332227579, socialGroup = "marauder", level = 56, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG + AGGRESSIVE_FLAG, healthMax = 15000, healthMin = 12000, strength = 0, constitution = 0, actionMax = 15000, actionMin = 12000, quickness = 0, stamina = 0, mindMax = 15000, mindMin = 12000, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = -1, stun = -1, blast = 0, heat = -1, cold = -1, acid = -1, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 1, killer = 1, ferocity = 0, aggressive = 1, invincible = 0, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 445, weaponMaxDamage = 600, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 2, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "marauderAttack40" }, respawnTimer = 180, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(bloodCrazedPlainsMarauder, 332227579) -- Add to Global Table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/spawns/corellia/dungeons/imperialStronghold.lua
1
4718
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. -- Imperial Stronghold 4660 -5785 spawnCreature(imperialStormTrooper, 0, 4679.67, -5825.53) spawnCreature(imperialStormTrooper, 0, 4683.05, -5817.91) spawnCreature(imperialStormTrooper, 0, 4671.5, -5825.07) spawnCreature(imperialStormTrooper, 0, 4685.94, -5814.65) spawnCreature(imperialStormTrooper, 0, 4688.05, -5815.13) spawnCreature(imperialStormTrooperSquadLeader, 0, 4671.87, -5813.91) spawnCreature(imperialLieutenantColonel, 0, 4634.26, -5799.64) spawnCreature(imperialDarkTrooper, 0, 4695.42, -5806.59) spawnCreature(imperialDarkTrooper, 0, 4694.86, -5799.92) spawnCreature(imperialDarkTrooper, 0, 4700.39, -5800.08) spawnCreature(imperialDarkTrooper, 0, 4695, -5806.51) spawnCreature(imperialDarkTrooper, 0, 4695.46, -5807.79) spawnCreature(imperialFirstLieutenant, 0, 4635.52, -5773.92) spawnCreature(imperialFirstLieutenant, 0, 4641.08, -5783.65) spawnCreature(imperialStormTrooperSquadLeader, 0, 4692.93, -5765.18) spawnCreature(imperialStormTrooper, 0, 4684.86, -5756.71) spawnCreature(imperialStormTrooper, 0, 4689.45, -5757.47) spawnCreature(imperialStormTrooper, 0, 4694.15, -5767.79) spawnCreature(imperialStormTrooper, 0, 4694.57, -5762.37) spawnCreature(imperialStormTrooper, 0, 4691.71, -5762.57) spawnCreature(imperialMajor, 0, 4624.33, -5777.45) spawnCreature(imperialDarkTrooper, 0, 4677.37, -5746.04) spawnCreature(imperialDarkTrooper, 0, 4677.03, -5759.58) spawnCreature(imperialDarkTrooper, 0, 4672.21, -5745.12) spawnCreature(imperialDarkTrooper, 0, 4675.69, -5743.78) spawnCreature(imperialDarkTrooper, 0, 4683.4, -5742.15) spawnCreature(imperialAtSt, 0, 4581.42, -5771.01) spawnCreatureInCell(imperialSergeant, 0, -0.270963, 0.125265, -0.966894, 2715881) spawnCreatureInCell(imperialTrooper, 0, 0.967033, 0.125264, -2.30098, 2715959) spawnCreatureInCell(imperialTrooper, 0, 1.49, 0.125264, -1.76992, 2715959) spawnCreatureInCell(strong34, 0, 0.653544, 0.125264, -3.43094, 2715916) spawnCreatureInCell(strong35, 0, 0.270573, 0.125265, -2.43859, 2715916) spawnCreatureInCell(imperialStormTrooperMedic, 0, -0.908103, 0.125265, -0.261074, 2716032) spawnCreatureInCell(imperialStormTrooperCommando, 0, -2.81023, 0.125266, -4.08048, 2716035) spawnCreatureInCell(imperialFirstLieutenant, 0, 0.00836489, 0.125265, -0.74699, 2716039) spawnCreatureInCell(imperialStormTrooper, 0, -0.537195, 0.125265, -1.44629, 2715952) spawnCreatureInCell(imperialStormTrooper, 0, -1.74, 0.125266, -3.44346, 2715952) spawnCreatureInCell(imperialStormTrooper, 0, -1.02819, 0.125265, 0.987271, 2715909) spawnCreatureInCell(imperialStormTrooper, 0, -1.49, 0.125265, 0.047892, 2715909)
lgpl-3.0
amir1213/am
libs/JSON.lua
3765
34843
-- -*- coding: utf-8 -*- -- -- Simple JSON encoding and decoding in pure Lua. -- -- Copyright 2010-2014 Jeffrey Friedl -- http://regex.info/blog/ -- -- Latest version: http://regex.info/blog/lua/json -- -- This code is released under a Creative Commons CC-BY "Attribution" License: -- http://creativecommons.org/licenses/by/3.0/deed.en_US -- -- It can be used for any purpose so long as the copyright notice above, -- the web-page links above, and the 'AUTHOR_NOTE' string below are -- maintained. Enjoy. -- local VERSION = 20141223.14 -- version history at end of file local AUTHOR_NOTE = "-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20141223.14 ]-" -- -- The 'AUTHOR_NOTE' variable exists so that information about the source -- of the package is maintained even in compiled versions. It's also -- included in OBJDEF below mostly to quiet warnings about unused variables. -- local OBJDEF = { VERSION = VERSION, AUTHOR_NOTE = AUTHOR_NOTE, } -- -- Simple JSON encoding and decoding in pure Lua. -- http://www.json.org/ -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- -- -- -- DECODING (from a JSON string to a Lua table) -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- If the JSON text is for an object or an array, e.g. -- { "what": "books", "count": 3 } -- or -- [ "Larry", "Curly", "Moe" ] -- -- the result is a Lua table, e.g. -- { what = "books", count = 3 } -- or -- { "Larry", "Curly", "Moe" } -- -- -- The encode and decode routines accept an optional second argument, -- "etc", which is not used during encoding or decoding, but upon error -- is passed along to error handlers. It can be of any type (including nil). -- -- -- -- ERROR HANDLING -- -- With most errors during decoding, this code calls -- -- JSON:onDecodeError(message, text, location, etc) -- -- with a message about the error, and if known, the JSON text being -- parsed and the byte count where the problem was discovered. You can -- replace the default JSON:onDecodeError() with your own function. -- -- The default onDecodeError() merely augments the message with data -- about the text and the location if known (and if a second 'etc' -- argument had been provided to decode(), its value is tacked onto the -- message as well), and then calls JSON.assert(), which itself defaults -- to Lua's built-in assert(), and can also be overridden. -- -- For example, in an Adobe Lightroom plugin, you might use something like -- -- function JSON:onDecodeError(message, text, location, etc) -- LrErrors.throwUserError("Internal Error: invalid JSON data") -- end -- -- or even just -- -- function JSON.assert(message) -- LrErrors.throwUserError("Internal Error: " .. message) -- end -- -- If JSON:decode() is passed a nil, this is called instead: -- -- JSON:onDecodeOfNilError(message, nil, nil, etc) -- -- and if JSON:decode() is passed HTML instead of JSON, this is called: -- -- JSON:onDecodeOfHTMLError(message, text, nil, etc) -- -- The use of the fourth 'etc' argument allows stronger coordination -- between decoding and error reporting, especially when you provide your -- own error-handling routines. Continuing with the the Adobe Lightroom -- plugin example: -- -- function JSON:onDecodeError(message, text, location, etc) -- local note = "Internal Error: invalid JSON data" -- if type(etc) = 'table' and etc.photo then -- note = note .. " while processing for " .. etc.photo:getFormattedMetadata('fileName') -- end -- LrErrors.throwUserError(note) -- end -- -- : -- : -- -- for i, photo in ipairs(photosToProcess) do -- : -- : -- local data = JSON:decode(someJsonText, { photo = photo }) -- : -- : -- end -- -- -- -- -- -- DECODING AND STRICT TYPES -- -- Because both JSON objects and JSON arrays are converted to Lua tables, -- it's not normally possible to tell which original JSON type a -- particular Lua table was derived from, or guarantee decode-encode -- round-trip equivalency. -- -- However, if you enable strictTypes, e.g. -- -- JSON = assert(loadfile "JSON.lua")() --load the routines -- JSON.strictTypes = true -- -- then the Lua table resulting from the decoding of a JSON object or -- JSON array is marked via Lua metatable, so that when re-encoded with -- JSON:encode() it ends up as the appropriate JSON type. -- -- (This is not the default because other routines may not work well with -- tables that have a metatable set, for example, Lightroom API calls.) -- -- -- ENCODING (from a lua table to a JSON string) -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- local custom_pretty = JSON:encode(lua_table_or_value, etc, { pretty = true, indent = "| ", align_keys = false }) -- -- On error during encoding, this code calls: -- -- JSON:onEncodeError(message, etc) -- -- which you can override in your local JSON object. -- -- The 'etc' in the error call is the second argument to encode() -- and encode_pretty(), or nil if it wasn't provided. -- -- -- PRETTY-PRINTING -- -- An optional third argument, a table of options, allows a bit of -- configuration about how the encoding takes place: -- -- pretty = JSON:encode(val, etc, { -- pretty = true, -- if false, no other options matter -- indent = " ", -- this provides for a three-space indent per nesting level -- align_keys = false, -- see below -- }) -- -- encode() and encode_pretty() are identical except that encode_pretty() -- provides a default options table if none given in the call: -- -- { pretty = true, align_keys = false, indent = " " } -- -- For example, if -- -- JSON:encode(data) -- -- produces: -- -- {"city":"Kyoto","climate":{"avg_temp":16,"humidity":"high","snowfall":"minimal"},"country":"Japan","wards":11} -- -- then -- -- JSON:encode_pretty(data) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- The following three lines return identical results: -- JSON:encode_pretty(data) -- JSON:encode_pretty(data, nil, { pretty = true, align_keys = false, indent = " " }) -- JSON:encode (data, nil, { pretty = true, align_keys = false, indent = " " }) -- -- An example of setting your own indent string: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = "| " }) -- -- produces: -- -- { -- | "city": "Kyoto", -- | "climate": { -- | | "avg_temp": 16, -- | | "humidity": "high", -- | | "snowfall": "minimal" -- | }, -- | "country": "Japan", -- | "wards": 11 -- } -- -- An example of setting align_keys to true: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = " ", align_keys = true }) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- which I must admit is kinda ugly, sorry. This was the default for -- encode_pretty() prior to version 20141223.14. -- -- -- AMBIGUOUS SITUATIONS DURING THE ENCODING -- -- During the encode, if a Lua table being encoded contains both string -- and numeric keys, it fits neither JSON's idea of an object, nor its -- idea of an array. To get around this, when any string key exists (or -- when non-positive numeric keys exist), numeric keys are converted to -- strings. -- -- For example, -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- produces the JSON object -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To prohibit this conversion and instead make it an error condition, set -- JSON.noKeyConversion = true -- -- -- SUMMARY OF METHODS YOU CAN OVERRIDE IN YOUR LOCAL LUA JSON OBJECT -- -- assert -- onDecodeError -- onDecodeOfNilError -- onDecodeOfHTMLError -- onEncodeError -- -- If you want to create a separate Lua JSON object with its own error handlers, -- you can reload JSON.lua or use the :new() method. -- --------------------------------------------------------------------------- local default_pretty_indent = " " local default_pretty_options = { pretty = true, align_keys = false, indent = default_pretty_indent } local isArray = { __tostring = function() return "JSON array" end } isArray.__index = isArray local isObject = { __tostring = function() return "JSON object" end } isObject.__index = isObject function OBJDEF:newArray(tbl) return setmetatable(tbl or {}, isArray) end function OBJDEF:newObject(tbl) return setmetatable(tbl or {}, isObject) end local function unicode_codepoint_as_utf8(codepoint) -- -- codepoint is a number -- if codepoint <= 127 then return string.char(codepoint) elseif codepoint <= 2047 then -- -- 110yyyxx 10xxxxxx <-- useful notation from http://en.wikipedia.org/wiki/Utf8 -- local highpart = math.floor(codepoint / 0x40) local lowpart = codepoint - (0x40 * highpart) return string.char(0xC0 + highpart, 0x80 + lowpart) elseif codepoint <= 65535 then -- -- 1110yyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x1000) local remainder = codepoint - 0x1000 * highpart local midpart = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midpart highpart = 0xE0 + highpart midpart = 0x80 + midpart lowpart = 0x80 + lowpart -- -- Check for an invalid character (thanks Andy R. at Adobe). -- See table 3.7, page 93, in http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#G28070 -- if ( highpart == 0xE0 and midpart < 0xA0 ) or ( highpart == 0xED and midpart > 0x9F ) or ( highpart == 0xF0 and midpart < 0x90 ) or ( highpart == 0xF4 and midpart > 0x8F ) then return "?" else return string.char(highpart, midpart, lowpart) end else -- -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x40000) local remainder = codepoint - 0x40000 * highpart local midA = math.floor(remainder / 0x1000) remainder = remainder - 0x1000 * midA local midB = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midB return string.char(0xF0 + highpart, 0x80 + midA, 0x80 + midB, 0x80 + lowpart) end end function OBJDEF:onDecodeError(message, text, location, etc) if text then if location then message = string.format("%s at char %d of: %s", message, location, text) else message = string.format("%s: %s", message, text) end end if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end OBJDEF.onDecodeOfNilError = OBJDEF.onDecodeError OBJDEF.onDecodeOfHTMLError = OBJDEF.onDecodeError function OBJDEF:onEncodeError(message, etc) if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end local function grok_number(self, text, start, etc) -- -- Grab the integer part -- local integer_part = text:match('^-?[1-9]%d*', start) or text:match("^-?0", start) if not integer_part then self:onDecodeError("expected number", text, start, etc) end local i = start + integer_part:len() -- -- Grab an optional decimal part -- local decimal_part = text:match('^%.%d+', i) or "" i = i + decimal_part:len() -- -- Grab an optional exponential part -- local exponent_part = text:match('^[eE][-+]?%d+', i) or "" i = i + exponent_part:len() local full_number_text = integer_part .. decimal_part .. exponent_part local as_number = tonumber(full_number_text) if not as_number then self:onDecodeError("bad number", text, start, etc) end return as_number, i end local function grok_string(self, text, start, etc) if text:sub(start,start) ~= '"' then self:onDecodeError("expected string's opening quote", text, start, etc) end local i = start + 1 -- +1 to bypass the initial quote local text_len = text:len() local VALUE = "" while i <= text_len do local c = text:sub(i,i) if c == '"' then return VALUE, i + 1 end if c ~= '\\' then VALUE = VALUE .. c i = i + 1 elseif text:match('^\\b', i) then VALUE = VALUE .. "\b" i = i + 2 elseif text:match('^\\f', i) then VALUE = VALUE .. "\f" i = i + 2 elseif text:match('^\\n', i) then VALUE = VALUE .. "\n" i = i + 2 elseif text:match('^\\r', i) then VALUE = VALUE .. "\r" i = i + 2 elseif text:match('^\\t', i) then VALUE = VALUE .. "\t" i = i + 2 else local hex = text:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if hex then i = i + 6 -- bypass what we just read -- We have a Unicode codepoint. It could be standalone, or if in the proper range and -- followed by another in a specific range, it'll be a two-code surrogate pair. local codepoint = tonumber(hex, 16) if codepoint >= 0xD800 and codepoint <= 0xDBFF then -- it's a hi surrogate... see whether we have a following low local lo_surrogate = text:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if lo_surrogate then i = i + 6 -- bypass the low surrogate we just read codepoint = 0x2400 + (codepoint - 0xD800) * 0x400 + tonumber(lo_surrogate, 16) else -- not a proper low, so we'll just leave the first codepoint as is and spit it out. end end VALUE = VALUE .. unicode_codepoint_as_utf8(codepoint) else -- just pass through what's escaped VALUE = VALUE .. text:match('^\\(.)', i) i = i + 2 end end end self:onDecodeError("unclosed string", text, start, etc) end local function skip_whitespace(text, start) local _, match_end = text:find("^[ \n\r\t]+", start) -- [http://www.ietf.org/rfc/rfc4627.txt] Section 2 if match_end then return match_end + 1 else return start end end local grok_one -- assigned later local function grok_object(self, text, start, etc) if text:sub(start,start) ~= '{' then self:onDecodeError("expected '{'", text, start, etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '{' local VALUE = self.strictTypes and self:newObject { } or { } if text:sub(i,i) == '}' then return VALUE, i + 1 end local text_len = text:len() while i <= text_len do local key, new_i = grok_string(self, text, i, etc) i = skip_whitespace(text, new_i) if text:sub(i, i) ~= ':' then self:onDecodeError("expected colon", text, i, etc) end i = skip_whitespace(text, i + 1) local new_val, new_i = grok_one(self, text, i) VALUE[key] = new_val -- -- Expect now either '}' to end things, or a ',' to allow us to continue. -- i = skip_whitespace(text, new_i) local c = text:sub(i,i) if c == '}' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '}'", text, i, etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '{'", text, start, etc) end local function grok_array(self, text, start, etc) if text:sub(start,start) ~= '[' then self:onDecodeError("expected '['", text, start, etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '[' local VALUE = self.strictTypes and self:newArray { } or { } if text:sub(i,i) == ']' then return VALUE, i + 1 end local VALUE_INDEX = 1 local text_len = text:len() while i <= text_len do local val, new_i = grok_one(self, text, i) -- can't table.insert(VALUE, val) here because it's a no-op if val is nil VALUE[VALUE_INDEX] = val VALUE_INDEX = VALUE_INDEX + 1 i = skip_whitespace(text, new_i) -- -- Expect now either ']' to end things, or a ',' to allow us to continue. -- local c = text:sub(i,i) if c == ']' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '['", text, i, etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '['", text, start, etc) end grok_one = function(self, text, start, etc) -- Skip any whitespace start = skip_whitespace(text, start) if start > text:len() then self:onDecodeError("unexpected end of string", text, nil, etc) end if text:find('^"', start) then return grok_string(self, text, start, etc) elseif text:find('^[-0123456789 ]', start) then return grok_number(self, text, start, etc) elseif text:find('^%{', start) then return grok_object(self, text, start, etc) elseif text:find('^%[', start) then return grok_array(self, text, start, etc) elseif text:find('^true', start) then return true, start + 4 elseif text:find('^false', start) then return false, start + 5 elseif text:find('^null', start) then return nil, start + 4 else self:onDecodeError("can't parse JSON", text, start, etc) end end function OBJDEF:decode(text, etc) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onDecodeError("JSON:decode must be called in method format", nil, nil, etc) end if text == nil then self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"), nil, nil, etc) elseif type(text) ~= 'string' then self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s", type(text)), nil, nil, etc) end if text:match('^%s*$') then return nil end if text:match('^%s*<') then -- Can't be JSON... we'll assume it's HTML self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"), text, nil, etc) end -- -- Ensure that it's not UTF-32 or UTF-16. -- Those are perfectly valid encodings for JSON (as per RFC 4627 section 3), -- but this package can't handle them. -- if text:sub(1,1):byte() == 0 or (text:len() >= 2 and text:sub(2,2):byte() == 0) then self:onDecodeError("JSON package groks only UTF-8, sorry", text, nil, etc) end local success, value = pcall(grok_one, self, text, 1, etc) if success then return value else -- if JSON:onDecodeError() didn't abort out of the pcall, we'll have received the error message here as "value", so pass it along as an assert. if self.assert then self.assert(false, value) else assert(false, value) end -- and if we're still here, return a nil and throw the error message on as a second arg return nil, value end end local function backslash_replacement_function(c) if c == "\n" then return "\\n" elseif c == "\r" then return "\\r" elseif c == "\t" then return "\\t" elseif c == "\b" then return "\\b" elseif c == "\f" then return "\\f" elseif c == '"' then return '\\"' elseif c == '\\' then return '\\\\' else return string.format("\\u%04x", c:byte()) end end local chars_to_be_escaped_in_JSON_string = '[' .. '"' -- class sub-pattern to match a double quote .. '%\\' -- class sub-pattern to match a backslash .. '%z' -- class sub-pattern to match a null .. '\001' .. '-' .. '\031' -- class sub-pattern to match control characters .. ']' local function json_string_literal(value) local newval = value:gsub(chars_to_be_escaped_in_JSON_string, backslash_replacement_function) return '"' .. newval .. '"' end local function object_or_array(self, T, etc) -- -- We need to inspect all the keys... if there are any strings, we'll convert to a JSON -- object. If there are only numbers, it's a JSON array. -- -- If we'll be converting to a JSON object, we'll want to sort the keys so that the -- end result is deterministic. -- local string_keys = { } local number_keys = { } local number_keys_must_be_strings = false local maximum_number_key for key in pairs(T) do if type(key) == 'string' then table.insert(string_keys, key) elseif type(key) == 'number' then table.insert(number_keys, key) if key <= 0 or key >= math.huge then number_keys_must_be_strings = true elseif not maximum_number_key or key > maximum_number_key then maximum_number_key = key end else self:onEncodeError("can't encode table with a key of type " .. type(key), etc) end end if #string_keys == 0 and not number_keys_must_be_strings then -- -- An empty table, or a numeric-only array -- if #number_keys > 0 then return nil, maximum_number_key -- an array elseif tostring(T) == "JSON array" then return nil elseif tostring(T) == "JSON object" then return { } else -- have to guess, so we'll pick array, since empty arrays are likely more common than empty objects return nil end end table.sort(string_keys) local map if #number_keys > 0 then -- -- If we're here then we have either mixed string/number keys, or numbers inappropriate for a JSON array -- It's not ideal, but we'll turn the numbers into strings so that we can at least create a JSON object. -- if self.noKeyConversion then self:onEncodeError("a table with both numeric and string keys could be an object or array; aborting", etc) end -- -- Have to make a shallow copy of the source table so we can remap the numeric keys to be strings -- map = { } for key, val in pairs(T) do map[key] = val end table.sort(number_keys) -- -- Throw numeric keys in there as strings -- for _, number_key in ipairs(number_keys) do local string_key = tostring(number_key) if map[string_key] == nil then table.insert(string_keys , string_key) map[string_key] = T[number_key] else self:onEncodeError("conflict converting table with mixed-type keys into a JSON object: key " .. number_key .. " exists both as a string and a number.", etc) end end end return string_keys, nil, map end -- -- Encode -- -- 'options' is nil, or a table with possible keys: -- pretty -- if true, return a pretty-printed version -- indent -- a string (usually of spaces) used to indent each nested level -- align_keys -- if true, align all the keys when formatting a table -- local encode_value -- must predeclare because it calls itself function encode_value(self, value, parents, etc, options, indent) if value == nil then return 'null' elseif type(value) == 'string' then return json_string_literal(value) elseif type(value) == 'number' then if value ~= value then -- -- NaN (Not a Number). -- JSON has no NaN, so we have to fudge the best we can. This should really be a package option. -- return "null" elseif value >= math.huge then -- -- Positive infinity. JSON has no INF, so we have to fudge the best we can. This should -- really be a package option. Note: at least with some implementations, positive infinity -- is both ">= math.huge" and "<= -math.huge", which makes no sense but that's how it is. -- Negative infinity is properly "<= -math.huge". So, we must be sure to check the ">=" -- case first. -- return "1e+9999" elseif value <= -math.huge then -- -- Negative infinity. -- JSON has no INF, so we have to fudge the best we can. This should really be a package option. -- return "-1e+9999" else return tostring(value) end elseif type(value) == 'boolean' then return tostring(value) elseif type(value) ~= 'table' then self:onEncodeError("can't convert " .. type(value) .. " to JSON", etc) else -- -- A table to be converted to either a JSON object or array. -- local T = value if type(options) ~= 'table' then options = {} end if type(indent) ~= 'string' then indent = "" end if parents[T] then self:onEncodeError("table " .. tostring(T) .. " is a child of itself", etc) else parents[T] = true end local result_value local object_keys, maximum_number_key, map = object_or_array(self, T, etc) if maximum_number_key then -- -- An array... -- local ITEMS = { } for i = 1, maximum_number_key do table.insert(ITEMS, encode_value(self, T[i], parents, etc, options, indent)) end if options.pretty then result_value = "[ " .. table.concat(ITEMS, ", ") .. " ]" else result_value = "[" .. table.concat(ITEMS, ",") .. "]" end elseif object_keys then -- -- An object -- local TT = map or T if options.pretty then local KEYS = { } local max_key_length = 0 for _, key in ipairs(object_keys) do local encoded = encode_value(self, tostring(key), parents, etc, options, indent) if options.align_keys then max_key_length = math.max(max_key_length, #encoded) end table.insert(KEYS, encoded) end local key_indent = indent .. tostring(options.indent or "") local subtable_indent = key_indent .. string.rep(" ", max_key_length) .. (options.align_keys and " " or "") local FORMAT = "%s%" .. string.format("%d", max_key_length) .. "s: %s" local COMBINED_PARTS = { } for i, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, subtable_indent) table.insert(COMBINED_PARTS, string.format(FORMAT, key_indent, KEYS[i], encoded_val)) end result_value = "{\n" .. table.concat(COMBINED_PARTS, ",\n") .. "\n" .. indent .. "}" else local PARTS = { } for _, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, indent) local encoded_key = encode_value(self, tostring(key), parents, etc, options, indent) table.insert(PARTS, string.format("%s:%s", encoded_key, encoded_val)) end result_value = "{" .. table.concat(PARTS, ",") .. "}" end else -- -- An empty array/object... we'll treat it as an array, though it should really be an option -- result_value = "[]" end parents[T] = false return result_value end end function OBJDEF:encode(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode must be called in method format", etc) end return encode_value(self, value, {}, etc, options or nil) end function OBJDEF:encode_pretty(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode_pretty must be called in method format", etc) end return encode_value(self, value, {}, etc, options or default_pretty_options) end function OBJDEF.__tostring() return "JSON encode/decode package" end OBJDEF.__index = OBJDEF function OBJDEF:new(args) local new = { } if args then for key, val in pairs(args) do new[key] = val end end return setmetatable(new, OBJDEF) end return OBJDEF:new() -- -- Version history: -- -- 20141223.14 The encode_pretty() routine produced fine results for small datasets, but isn't really -- appropriate for anything large, so with help from Alex Aulbach I've made the encode routines -- more flexible, and changed the default encode_pretty() to be more generally useful. -- -- Added a third 'options' argument to the encode() and encode_pretty() routines, to control -- how the encoding takes place. -- -- Updated docs to add assert() call to the loadfile() line, just as good practice so that -- if there is a problem loading JSON.lua, the appropriate error message will percolate up. -- -- 20140920.13 Put back (in a way that doesn't cause warnings about unused variables) the author string, -- so that the source of the package, and its version number, are visible in compiled copies. -- -- 20140911.12 Minor lua cleanup. -- Fixed internal reference to 'JSON.noKeyConversion' to reference 'self' instead of 'JSON'. -- (Thanks to SmugMug's David Parry for these.) -- -- 20140418.11 JSON nulls embedded within an array were being ignored, such that -- ["1",null,null,null,null,null,"seven"], -- would return -- {1,"seven"} -- It's now fixed to properly return -- {1, nil, nil, nil, nil, nil, "seven"} -- Thanks to "haddock" for catching the error. -- -- 20140116.10 The user's JSON.assert() wasn't always being used. Thanks to "blue" for the heads up. -- -- 20131118.9 Update for Lua 5.3... it seems that tostring(2/1) produces "2.0" instead of "2", -- and this caused some problems. -- -- 20131031.8 Unified the code for encode() and encode_pretty(); they had been stupidly separate, -- and had of course diverged (encode_pretty didn't get the fixes that encode got, so -- sometimes produced incorrect results; thanks to Mattie for the heads up). -- -- Handle encoding tables with non-positive numeric keys (unlikely, but possible). -- -- If a table has both numeric and string keys, or its numeric keys are inappropriate -- (such as being non-positive or infinite), the numeric keys are turned into -- string keys appropriate for a JSON object. So, as before, -- JSON:encode({ "one", "two", "three" }) -- produces the array -- ["one","two","three"] -- but now something with mixed key types like -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- instead of throwing an error produces an object: -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To maintain the prior throw-an-error semantics, set -- JSON.noKeyConversion = true -- -- 20131004.7 Release under a Creative Commons CC-BY license, which I should have done from day one, sorry. -- -- 20130120.6 Comment update: added a link to the specific page on my blog where this code can -- be found, so that folks who come across the code outside of my blog can find updates -- more easily. -- -- 20111207.5 Added support for the 'etc' arguments, for better error reporting. -- -- 20110731.4 More feedback from David Kolf on how to make the tests for Nan/Infinity system independent. -- -- 20110730.3 Incorporated feedback from David Kolf at http://lua-users.org/wiki/JsonModules: -- -- * When encoding lua for JSON, Sparse numeric arrays are now handled by -- spitting out full arrays, such that -- JSON:encode({"one", "two", [10] = "ten"}) -- returns -- ["one","two",null,null,null,null,null,null,null,"ten"] -- -- In 20100810.2 and earlier, only up to the first non-null value would have been retained. -- -- * When encoding lua for JSON, numeric value NaN gets spit out as null, and infinity as "1+e9999". -- Version 20100810.2 and earlier created invalid JSON in both cases. -- -- * Unicode surrogate pairs are now detected when decoding JSON. -- -- 20100810.2 added some checking to ensure that an invalid Unicode character couldn't leak in to the UTF-8 encoding -- -- 20100731.1 initial public release --
gpl-2.0
Mohammadrezar/telediamond
libs/JSON.lua
3765
34843
-- -*- coding: utf-8 -*- -- -- Simple JSON encoding and decoding in pure Lua. -- -- Copyright 2010-2014 Jeffrey Friedl -- http://regex.info/blog/ -- -- Latest version: http://regex.info/blog/lua/json -- -- This code is released under a Creative Commons CC-BY "Attribution" License: -- http://creativecommons.org/licenses/by/3.0/deed.en_US -- -- It can be used for any purpose so long as the copyright notice above, -- the web-page links above, and the 'AUTHOR_NOTE' string below are -- maintained. Enjoy. -- local VERSION = 20141223.14 -- version history at end of file local AUTHOR_NOTE = "-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20141223.14 ]-" -- -- The 'AUTHOR_NOTE' variable exists so that information about the source -- of the package is maintained even in compiled versions. It's also -- included in OBJDEF below mostly to quiet warnings about unused variables. -- local OBJDEF = { VERSION = VERSION, AUTHOR_NOTE = AUTHOR_NOTE, } -- -- Simple JSON encoding and decoding in pure Lua. -- http://www.json.org/ -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- -- -- -- DECODING (from a JSON string to a Lua table) -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- If the JSON text is for an object or an array, e.g. -- { "what": "books", "count": 3 } -- or -- [ "Larry", "Curly", "Moe" ] -- -- the result is a Lua table, e.g. -- { what = "books", count = 3 } -- or -- { "Larry", "Curly", "Moe" } -- -- -- The encode and decode routines accept an optional second argument, -- "etc", which is not used during encoding or decoding, but upon error -- is passed along to error handlers. It can be of any type (including nil). -- -- -- -- ERROR HANDLING -- -- With most errors during decoding, this code calls -- -- JSON:onDecodeError(message, text, location, etc) -- -- with a message about the error, and if known, the JSON text being -- parsed and the byte count where the problem was discovered. You can -- replace the default JSON:onDecodeError() with your own function. -- -- The default onDecodeError() merely augments the message with data -- about the text and the location if known (and if a second 'etc' -- argument had been provided to decode(), its value is tacked onto the -- message as well), and then calls JSON.assert(), which itself defaults -- to Lua's built-in assert(), and can also be overridden. -- -- For example, in an Adobe Lightroom plugin, you might use something like -- -- function JSON:onDecodeError(message, text, location, etc) -- LrErrors.throwUserError("Internal Error: invalid JSON data") -- end -- -- or even just -- -- function JSON.assert(message) -- LrErrors.throwUserError("Internal Error: " .. message) -- end -- -- If JSON:decode() is passed a nil, this is called instead: -- -- JSON:onDecodeOfNilError(message, nil, nil, etc) -- -- and if JSON:decode() is passed HTML instead of JSON, this is called: -- -- JSON:onDecodeOfHTMLError(message, text, nil, etc) -- -- The use of the fourth 'etc' argument allows stronger coordination -- between decoding and error reporting, especially when you provide your -- own error-handling routines. Continuing with the the Adobe Lightroom -- plugin example: -- -- function JSON:onDecodeError(message, text, location, etc) -- local note = "Internal Error: invalid JSON data" -- if type(etc) = 'table' and etc.photo then -- note = note .. " while processing for " .. etc.photo:getFormattedMetadata('fileName') -- end -- LrErrors.throwUserError(note) -- end -- -- : -- : -- -- for i, photo in ipairs(photosToProcess) do -- : -- : -- local data = JSON:decode(someJsonText, { photo = photo }) -- : -- : -- end -- -- -- -- -- -- DECODING AND STRICT TYPES -- -- Because both JSON objects and JSON arrays are converted to Lua tables, -- it's not normally possible to tell which original JSON type a -- particular Lua table was derived from, or guarantee decode-encode -- round-trip equivalency. -- -- However, if you enable strictTypes, e.g. -- -- JSON = assert(loadfile "JSON.lua")() --load the routines -- JSON.strictTypes = true -- -- then the Lua table resulting from the decoding of a JSON object or -- JSON array is marked via Lua metatable, so that when re-encoded with -- JSON:encode() it ends up as the appropriate JSON type. -- -- (This is not the default because other routines may not work well with -- tables that have a metatable set, for example, Lightroom API calls.) -- -- -- ENCODING (from a lua table to a JSON string) -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- local custom_pretty = JSON:encode(lua_table_or_value, etc, { pretty = true, indent = "| ", align_keys = false }) -- -- On error during encoding, this code calls: -- -- JSON:onEncodeError(message, etc) -- -- which you can override in your local JSON object. -- -- The 'etc' in the error call is the second argument to encode() -- and encode_pretty(), or nil if it wasn't provided. -- -- -- PRETTY-PRINTING -- -- An optional third argument, a table of options, allows a bit of -- configuration about how the encoding takes place: -- -- pretty = JSON:encode(val, etc, { -- pretty = true, -- if false, no other options matter -- indent = " ", -- this provides for a three-space indent per nesting level -- align_keys = false, -- see below -- }) -- -- encode() and encode_pretty() are identical except that encode_pretty() -- provides a default options table if none given in the call: -- -- { pretty = true, align_keys = false, indent = " " } -- -- For example, if -- -- JSON:encode(data) -- -- produces: -- -- {"city":"Kyoto","climate":{"avg_temp":16,"humidity":"high","snowfall":"minimal"},"country":"Japan","wards":11} -- -- then -- -- JSON:encode_pretty(data) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- The following three lines return identical results: -- JSON:encode_pretty(data) -- JSON:encode_pretty(data, nil, { pretty = true, align_keys = false, indent = " " }) -- JSON:encode (data, nil, { pretty = true, align_keys = false, indent = " " }) -- -- An example of setting your own indent string: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = "| " }) -- -- produces: -- -- { -- | "city": "Kyoto", -- | "climate": { -- | | "avg_temp": 16, -- | | "humidity": "high", -- | | "snowfall": "minimal" -- | }, -- | "country": "Japan", -- | "wards": 11 -- } -- -- An example of setting align_keys to true: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = " ", align_keys = true }) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- which I must admit is kinda ugly, sorry. This was the default for -- encode_pretty() prior to version 20141223.14. -- -- -- AMBIGUOUS SITUATIONS DURING THE ENCODING -- -- During the encode, if a Lua table being encoded contains both string -- and numeric keys, it fits neither JSON's idea of an object, nor its -- idea of an array. To get around this, when any string key exists (or -- when non-positive numeric keys exist), numeric keys are converted to -- strings. -- -- For example, -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- produces the JSON object -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To prohibit this conversion and instead make it an error condition, set -- JSON.noKeyConversion = true -- -- -- SUMMARY OF METHODS YOU CAN OVERRIDE IN YOUR LOCAL LUA JSON OBJECT -- -- assert -- onDecodeError -- onDecodeOfNilError -- onDecodeOfHTMLError -- onEncodeError -- -- If you want to create a separate Lua JSON object with its own error handlers, -- you can reload JSON.lua or use the :new() method. -- --------------------------------------------------------------------------- local default_pretty_indent = " " local default_pretty_options = { pretty = true, align_keys = false, indent = default_pretty_indent } local isArray = { __tostring = function() return "JSON array" end } isArray.__index = isArray local isObject = { __tostring = function() return "JSON object" end } isObject.__index = isObject function OBJDEF:newArray(tbl) return setmetatable(tbl or {}, isArray) end function OBJDEF:newObject(tbl) return setmetatable(tbl or {}, isObject) end local function unicode_codepoint_as_utf8(codepoint) -- -- codepoint is a number -- if codepoint <= 127 then return string.char(codepoint) elseif codepoint <= 2047 then -- -- 110yyyxx 10xxxxxx <-- useful notation from http://en.wikipedia.org/wiki/Utf8 -- local highpart = math.floor(codepoint / 0x40) local lowpart = codepoint - (0x40 * highpart) return string.char(0xC0 + highpart, 0x80 + lowpart) elseif codepoint <= 65535 then -- -- 1110yyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x1000) local remainder = codepoint - 0x1000 * highpart local midpart = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midpart highpart = 0xE0 + highpart midpart = 0x80 + midpart lowpart = 0x80 + lowpart -- -- Check for an invalid character (thanks Andy R. at Adobe). -- See table 3.7, page 93, in http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#G28070 -- if ( highpart == 0xE0 and midpart < 0xA0 ) or ( highpart == 0xED and midpart > 0x9F ) or ( highpart == 0xF0 and midpart < 0x90 ) or ( highpart == 0xF4 and midpart > 0x8F ) then return "?" else return string.char(highpart, midpart, lowpart) end else -- -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x40000) local remainder = codepoint - 0x40000 * highpart local midA = math.floor(remainder / 0x1000) remainder = remainder - 0x1000 * midA local midB = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midB return string.char(0xF0 + highpart, 0x80 + midA, 0x80 + midB, 0x80 + lowpart) end end function OBJDEF:onDecodeError(message, text, location, etc) if text then if location then message = string.format("%s at char %d of: %s", message, location, text) else message = string.format("%s: %s", message, text) end end if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end OBJDEF.onDecodeOfNilError = OBJDEF.onDecodeError OBJDEF.onDecodeOfHTMLError = OBJDEF.onDecodeError function OBJDEF:onEncodeError(message, etc) if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end local function grok_number(self, text, start, etc) -- -- Grab the integer part -- local integer_part = text:match('^-?[1-9]%d*', start) or text:match("^-?0", start) if not integer_part then self:onDecodeError("expected number", text, start, etc) end local i = start + integer_part:len() -- -- Grab an optional decimal part -- local decimal_part = text:match('^%.%d+', i) or "" i = i + decimal_part:len() -- -- Grab an optional exponential part -- local exponent_part = text:match('^[eE][-+]?%d+', i) or "" i = i + exponent_part:len() local full_number_text = integer_part .. decimal_part .. exponent_part local as_number = tonumber(full_number_text) if not as_number then self:onDecodeError("bad number", text, start, etc) end return as_number, i end local function grok_string(self, text, start, etc) if text:sub(start,start) ~= '"' then self:onDecodeError("expected string's opening quote", text, start, etc) end local i = start + 1 -- +1 to bypass the initial quote local text_len = text:len() local VALUE = "" while i <= text_len do local c = text:sub(i,i) if c == '"' then return VALUE, i + 1 end if c ~= '\\' then VALUE = VALUE .. c i = i + 1 elseif text:match('^\\b', i) then VALUE = VALUE .. "\b" i = i + 2 elseif text:match('^\\f', i) then VALUE = VALUE .. "\f" i = i + 2 elseif text:match('^\\n', i) then VALUE = VALUE .. "\n" i = i + 2 elseif text:match('^\\r', i) then VALUE = VALUE .. "\r" i = i + 2 elseif text:match('^\\t', i) then VALUE = VALUE .. "\t" i = i + 2 else local hex = text:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if hex then i = i + 6 -- bypass what we just read -- We have a Unicode codepoint. It could be standalone, or if in the proper range and -- followed by another in a specific range, it'll be a two-code surrogate pair. local codepoint = tonumber(hex, 16) if codepoint >= 0xD800 and codepoint <= 0xDBFF then -- it's a hi surrogate... see whether we have a following low local lo_surrogate = text:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if lo_surrogate then i = i + 6 -- bypass the low surrogate we just read codepoint = 0x2400 + (codepoint - 0xD800) * 0x400 + tonumber(lo_surrogate, 16) else -- not a proper low, so we'll just leave the first codepoint as is and spit it out. end end VALUE = VALUE .. unicode_codepoint_as_utf8(codepoint) else -- just pass through what's escaped VALUE = VALUE .. text:match('^\\(.)', i) i = i + 2 end end end self:onDecodeError("unclosed string", text, start, etc) end local function skip_whitespace(text, start) local _, match_end = text:find("^[ \n\r\t]+", start) -- [http://www.ietf.org/rfc/rfc4627.txt] Section 2 if match_end then return match_end + 1 else return start end end local grok_one -- assigned later local function grok_object(self, text, start, etc) if text:sub(start,start) ~= '{' then self:onDecodeError("expected '{'", text, start, etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '{' local VALUE = self.strictTypes and self:newObject { } or { } if text:sub(i,i) == '}' then return VALUE, i + 1 end local text_len = text:len() while i <= text_len do local key, new_i = grok_string(self, text, i, etc) i = skip_whitespace(text, new_i) if text:sub(i, i) ~= ':' then self:onDecodeError("expected colon", text, i, etc) end i = skip_whitespace(text, i + 1) local new_val, new_i = grok_one(self, text, i) VALUE[key] = new_val -- -- Expect now either '}' to end things, or a ',' to allow us to continue. -- i = skip_whitespace(text, new_i) local c = text:sub(i,i) if c == '}' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '}'", text, i, etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '{'", text, start, etc) end local function grok_array(self, text, start, etc) if text:sub(start,start) ~= '[' then self:onDecodeError("expected '['", text, start, etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '[' local VALUE = self.strictTypes and self:newArray { } or { } if text:sub(i,i) == ']' then return VALUE, i + 1 end local VALUE_INDEX = 1 local text_len = text:len() while i <= text_len do local val, new_i = grok_one(self, text, i) -- can't table.insert(VALUE, val) here because it's a no-op if val is nil VALUE[VALUE_INDEX] = val VALUE_INDEX = VALUE_INDEX + 1 i = skip_whitespace(text, new_i) -- -- Expect now either ']' to end things, or a ',' to allow us to continue. -- local c = text:sub(i,i) if c == ']' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '['", text, i, etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '['", text, start, etc) end grok_one = function(self, text, start, etc) -- Skip any whitespace start = skip_whitespace(text, start) if start > text:len() then self:onDecodeError("unexpected end of string", text, nil, etc) end if text:find('^"', start) then return grok_string(self, text, start, etc) elseif text:find('^[-0123456789 ]', start) then return grok_number(self, text, start, etc) elseif text:find('^%{', start) then return grok_object(self, text, start, etc) elseif text:find('^%[', start) then return grok_array(self, text, start, etc) elseif text:find('^true', start) then return true, start + 4 elseif text:find('^false', start) then return false, start + 5 elseif text:find('^null', start) then return nil, start + 4 else self:onDecodeError("can't parse JSON", text, start, etc) end end function OBJDEF:decode(text, etc) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onDecodeError("JSON:decode must be called in method format", nil, nil, etc) end if text == nil then self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"), nil, nil, etc) elseif type(text) ~= 'string' then self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s", type(text)), nil, nil, etc) end if text:match('^%s*$') then return nil end if text:match('^%s*<') then -- Can't be JSON... we'll assume it's HTML self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"), text, nil, etc) end -- -- Ensure that it's not UTF-32 or UTF-16. -- Those are perfectly valid encodings for JSON (as per RFC 4627 section 3), -- but this package can't handle them. -- if text:sub(1,1):byte() == 0 or (text:len() >= 2 and text:sub(2,2):byte() == 0) then self:onDecodeError("JSON package groks only UTF-8, sorry", text, nil, etc) end local success, value = pcall(grok_one, self, text, 1, etc) if success then return value else -- if JSON:onDecodeError() didn't abort out of the pcall, we'll have received the error message here as "value", so pass it along as an assert. if self.assert then self.assert(false, value) else assert(false, value) end -- and if we're still here, return a nil and throw the error message on as a second arg return nil, value end end local function backslash_replacement_function(c) if c == "\n" then return "\\n" elseif c == "\r" then return "\\r" elseif c == "\t" then return "\\t" elseif c == "\b" then return "\\b" elseif c == "\f" then return "\\f" elseif c == '"' then return '\\"' elseif c == '\\' then return '\\\\' else return string.format("\\u%04x", c:byte()) end end local chars_to_be_escaped_in_JSON_string = '[' .. '"' -- class sub-pattern to match a double quote .. '%\\' -- class sub-pattern to match a backslash .. '%z' -- class sub-pattern to match a null .. '\001' .. '-' .. '\031' -- class sub-pattern to match control characters .. ']' local function json_string_literal(value) local newval = value:gsub(chars_to_be_escaped_in_JSON_string, backslash_replacement_function) return '"' .. newval .. '"' end local function object_or_array(self, T, etc) -- -- We need to inspect all the keys... if there are any strings, we'll convert to a JSON -- object. If there are only numbers, it's a JSON array. -- -- If we'll be converting to a JSON object, we'll want to sort the keys so that the -- end result is deterministic. -- local string_keys = { } local number_keys = { } local number_keys_must_be_strings = false local maximum_number_key for key in pairs(T) do if type(key) == 'string' then table.insert(string_keys, key) elseif type(key) == 'number' then table.insert(number_keys, key) if key <= 0 or key >= math.huge then number_keys_must_be_strings = true elseif not maximum_number_key or key > maximum_number_key then maximum_number_key = key end else self:onEncodeError("can't encode table with a key of type " .. type(key), etc) end end if #string_keys == 0 and not number_keys_must_be_strings then -- -- An empty table, or a numeric-only array -- if #number_keys > 0 then return nil, maximum_number_key -- an array elseif tostring(T) == "JSON array" then return nil elseif tostring(T) == "JSON object" then return { } else -- have to guess, so we'll pick array, since empty arrays are likely more common than empty objects return nil end end table.sort(string_keys) local map if #number_keys > 0 then -- -- If we're here then we have either mixed string/number keys, or numbers inappropriate for a JSON array -- It's not ideal, but we'll turn the numbers into strings so that we can at least create a JSON object. -- if self.noKeyConversion then self:onEncodeError("a table with both numeric and string keys could be an object or array; aborting", etc) end -- -- Have to make a shallow copy of the source table so we can remap the numeric keys to be strings -- map = { } for key, val in pairs(T) do map[key] = val end table.sort(number_keys) -- -- Throw numeric keys in there as strings -- for _, number_key in ipairs(number_keys) do local string_key = tostring(number_key) if map[string_key] == nil then table.insert(string_keys , string_key) map[string_key] = T[number_key] else self:onEncodeError("conflict converting table with mixed-type keys into a JSON object: key " .. number_key .. " exists both as a string and a number.", etc) end end end return string_keys, nil, map end -- -- Encode -- -- 'options' is nil, or a table with possible keys: -- pretty -- if true, return a pretty-printed version -- indent -- a string (usually of spaces) used to indent each nested level -- align_keys -- if true, align all the keys when formatting a table -- local encode_value -- must predeclare because it calls itself function encode_value(self, value, parents, etc, options, indent) if value == nil then return 'null' elseif type(value) == 'string' then return json_string_literal(value) elseif type(value) == 'number' then if value ~= value then -- -- NaN (Not a Number). -- JSON has no NaN, so we have to fudge the best we can. This should really be a package option. -- return "null" elseif value >= math.huge then -- -- Positive infinity. JSON has no INF, so we have to fudge the best we can. This should -- really be a package option. Note: at least with some implementations, positive infinity -- is both ">= math.huge" and "<= -math.huge", which makes no sense but that's how it is. -- Negative infinity is properly "<= -math.huge". So, we must be sure to check the ">=" -- case first. -- return "1e+9999" elseif value <= -math.huge then -- -- Negative infinity. -- JSON has no INF, so we have to fudge the best we can. This should really be a package option. -- return "-1e+9999" else return tostring(value) end elseif type(value) == 'boolean' then return tostring(value) elseif type(value) ~= 'table' then self:onEncodeError("can't convert " .. type(value) .. " to JSON", etc) else -- -- A table to be converted to either a JSON object or array. -- local T = value if type(options) ~= 'table' then options = {} end if type(indent) ~= 'string' then indent = "" end if parents[T] then self:onEncodeError("table " .. tostring(T) .. " is a child of itself", etc) else parents[T] = true end local result_value local object_keys, maximum_number_key, map = object_or_array(self, T, etc) if maximum_number_key then -- -- An array... -- local ITEMS = { } for i = 1, maximum_number_key do table.insert(ITEMS, encode_value(self, T[i], parents, etc, options, indent)) end if options.pretty then result_value = "[ " .. table.concat(ITEMS, ", ") .. " ]" else result_value = "[" .. table.concat(ITEMS, ",") .. "]" end elseif object_keys then -- -- An object -- local TT = map or T if options.pretty then local KEYS = { } local max_key_length = 0 for _, key in ipairs(object_keys) do local encoded = encode_value(self, tostring(key), parents, etc, options, indent) if options.align_keys then max_key_length = math.max(max_key_length, #encoded) end table.insert(KEYS, encoded) end local key_indent = indent .. tostring(options.indent or "") local subtable_indent = key_indent .. string.rep(" ", max_key_length) .. (options.align_keys and " " or "") local FORMAT = "%s%" .. string.format("%d", max_key_length) .. "s: %s" local COMBINED_PARTS = { } for i, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, subtable_indent) table.insert(COMBINED_PARTS, string.format(FORMAT, key_indent, KEYS[i], encoded_val)) end result_value = "{\n" .. table.concat(COMBINED_PARTS, ",\n") .. "\n" .. indent .. "}" else local PARTS = { } for _, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, indent) local encoded_key = encode_value(self, tostring(key), parents, etc, options, indent) table.insert(PARTS, string.format("%s:%s", encoded_key, encoded_val)) end result_value = "{" .. table.concat(PARTS, ",") .. "}" end else -- -- An empty array/object... we'll treat it as an array, though it should really be an option -- result_value = "[]" end parents[T] = false return result_value end end function OBJDEF:encode(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode must be called in method format", etc) end return encode_value(self, value, {}, etc, options or nil) end function OBJDEF:encode_pretty(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode_pretty must be called in method format", etc) end return encode_value(self, value, {}, etc, options or default_pretty_options) end function OBJDEF.__tostring() return "JSON encode/decode package" end OBJDEF.__index = OBJDEF function OBJDEF:new(args) local new = { } if args then for key, val in pairs(args) do new[key] = val end end return setmetatable(new, OBJDEF) end return OBJDEF:new() -- -- Version history: -- -- 20141223.14 The encode_pretty() routine produced fine results for small datasets, but isn't really -- appropriate for anything large, so with help from Alex Aulbach I've made the encode routines -- more flexible, and changed the default encode_pretty() to be more generally useful. -- -- Added a third 'options' argument to the encode() and encode_pretty() routines, to control -- how the encoding takes place. -- -- Updated docs to add assert() call to the loadfile() line, just as good practice so that -- if there is a problem loading JSON.lua, the appropriate error message will percolate up. -- -- 20140920.13 Put back (in a way that doesn't cause warnings about unused variables) the author string, -- so that the source of the package, and its version number, are visible in compiled copies. -- -- 20140911.12 Minor lua cleanup. -- Fixed internal reference to 'JSON.noKeyConversion' to reference 'self' instead of 'JSON'. -- (Thanks to SmugMug's David Parry for these.) -- -- 20140418.11 JSON nulls embedded within an array were being ignored, such that -- ["1",null,null,null,null,null,"seven"], -- would return -- {1,"seven"} -- It's now fixed to properly return -- {1, nil, nil, nil, nil, nil, "seven"} -- Thanks to "haddock" for catching the error. -- -- 20140116.10 The user's JSON.assert() wasn't always being used. Thanks to "blue" for the heads up. -- -- 20131118.9 Update for Lua 5.3... it seems that tostring(2/1) produces "2.0" instead of "2", -- and this caused some problems. -- -- 20131031.8 Unified the code for encode() and encode_pretty(); they had been stupidly separate, -- and had of course diverged (encode_pretty didn't get the fixes that encode got, so -- sometimes produced incorrect results; thanks to Mattie for the heads up). -- -- Handle encoding tables with non-positive numeric keys (unlikely, but possible). -- -- If a table has both numeric and string keys, or its numeric keys are inappropriate -- (such as being non-positive or infinite), the numeric keys are turned into -- string keys appropriate for a JSON object. So, as before, -- JSON:encode({ "one", "two", "three" }) -- produces the array -- ["one","two","three"] -- but now something with mixed key types like -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- instead of throwing an error produces an object: -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To maintain the prior throw-an-error semantics, set -- JSON.noKeyConversion = true -- -- 20131004.7 Release under a Creative Commons CC-BY license, which I should have done from day one, sorry. -- -- 20130120.6 Comment update: added a link to the specific page on my blog where this code can -- be found, so that folks who come across the code outside of my blog can find updates -- more easily. -- -- 20111207.5 Added support for the 'etc' arguments, for better error reporting. -- -- 20110731.4 More feedback from David Kolf on how to make the tests for Nan/Infinity system independent. -- -- 20110730.3 Incorporated feedback from David Kolf at http://lua-users.org/wiki/JsonModules: -- -- * When encoding lua for JSON, Sparse numeric arrays are now handled by -- spitting out full arrays, such that -- JSON:encode({"one", "two", [10] = "ten"}) -- returns -- ["one","two",null,null,null,null,null,null,null,"ten"] -- -- In 20100810.2 and earlier, only up to the first non-null value would have been retained. -- -- * When encoding lua for JSON, numeric value NaN gets spit out as null, and infinity as "1+e9999". -- Version 20100810.2 and earlier created invalid JSON in both cases. -- -- * Unicode surrogate pairs are now detected when decoding JSON. -- -- 20100810.2 added some checking to ensure that an invalid Unicode character couldn't leak in to the UTF-8 encoding -- -- 20100731.1 initial public release --
agpl-3.0
weiDDD/WSSParticleSystem
cocos2d/cocos/scripting/lua-bindings/auto/api/PositionFrame.lua
1
2024
-------------------------------- -- @module PositionFrame -- @extend Frame -- @parent_module ccs -------------------------------- -- -- @function [parent=#PositionFrame] getX -- @param self -- @return float#float ret (return value: float) -------------------------------- -- -- @function [parent=#PositionFrame] getY -- @param self -- @return float#float ret (return value: float) -------------------------------- -- -- @function [parent=#PositionFrame] setPosition -- @param self -- @param #vec2_table position -- @return PositionFrame#PositionFrame self (return value: ccs.PositionFrame) -------------------------------- -- -- @function [parent=#PositionFrame] setX -- @param self -- @param #float x -- @return PositionFrame#PositionFrame self (return value: ccs.PositionFrame) -------------------------------- -- -- @function [parent=#PositionFrame] setY -- @param self -- @param #float y -- @return PositionFrame#PositionFrame self (return value: ccs.PositionFrame) -------------------------------- -- -- @function [parent=#PositionFrame] getPosition -- @param self -- @return vec2_table#vec2_table ret (return value: vec2_table) -------------------------------- -- -- @function [parent=#PositionFrame] create -- @param self -- @return PositionFrame#PositionFrame ret (return value: ccs.PositionFrame) -------------------------------- -- -- @function [parent=#PositionFrame] apply -- @param self -- @param #float percent -- @return PositionFrame#PositionFrame self (return value: ccs.PositionFrame) -------------------------------- -- -- @function [parent=#PositionFrame] clone -- @param self -- @return Frame#Frame ret (return value: ccs.Frame) -------------------------------- -- -- @function [parent=#PositionFrame] PositionFrame -- @param self -- @return PositionFrame#PositionFrame self (return value: ccs.PositionFrame) return nil
apache-2.0
Andrettin/Wyrmsun
scripts/civilizations/anglo_saxon/works.lua
1
61131
-- _________ __ __ -- / _____// |_____________ _/ |______ ____ __ __ ______ -- \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ -- / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ -- /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > -- \/ \/ \//_____/ \/ -- ______________________ ______________________ -- T H E W A R B E G I N S -- Stratagus - A free fantasy real time strategy game engine -- -- (c) Copyright 2016-2022 by Andrettin -- -- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- DefineUpgrade("upgrade-work-aecer-bot", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 172-175. Name = "Land-Remedy", -- "Æcer-Bōt" Work = "scroll", Quote = "\"All hail, Earth, mother of men!\nBe fruitful in God's embracing arm,\nFilled with food for the needs of men.\"" }) DefineUpgrade("upgrade-work-be-galdorstafum", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 202-203. Name = "Concerning Magic Writings", -- "Be Galdorstafum" Work = "scroll" }) DefineUpgrade("upgrade-work-blodseten", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 200-203. Name = "For Stanching Blood", -- "Blōdseten" Work = "scroll", -- Quote = "\"For stanching blood in horse or man.\"" }) DefineUpgrade("upgrade-work-feld-bot", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 204-205. Name = "A Field Remedy", -- "Feld-Bōt" Work = "scroll", Quote = "\"Cont apes ut salui sint and in corda eorum.\"" }) DefineUpgrade("upgrade-work-gagates-craeftas", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 200-201. Name = "The Virtues of Jet", -- "Gagātes Cræftas" Work = "scroll" }) DefineUpgrade("upgrade-work-historia-ecclesiastica-venerabilis-bedae", { -- Source: Snorri Sturlson, "Heimskringla", 1844, vol. 1, p. 34. Name = "Historia Ecclesiastica Venerabilis Bedae", Work = "book", Year = 731 }) DefineUpgrade("upgrade-work-nigon-wyrta-galdor", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 190-195. Name = "Nine Herbs Charm", -- "Nigon Wyrta Galdor" Work = "scroll", Quote = "\"Now these nine herbs avail against nine accursed spirits\"" }) DefineUpgrade("upgrade-work-sidgaldor", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 176-179. Name = "A Journey Spell", -- "Sīðgaldor" Work = "scroll", Quote = "\"Forth I wander, friends I shall find,\nAll the encouragement of angels through the teaching of the blessed.\"" }) DefineUpgrade("upgrade-work-wid-aelfadle", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 190-191, 226. Name = "For Elf-Disease", -- "Wið Ælfadle" Work = "scroll", -- Quote = "\"Then go in silence, and, though something of a fearful kind or a man should come upon you, say not a single word to it until you reach the herb you marked the night before.\"" -- original Quote = "\"Then go in silence, and, though something of a fearful kind or a person should come upon you, say not a single word to it until you reach the herb you marked the night before.\"" -- "Elf-Disease" = bewitchment by elves }) DefineUpgrade("upgrade-work-wid-aelfcynne", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 210-211. Name = "Against the Elfin Race", -- Wið Ælfcynne Work = "scroll", Quote = "\"Make a salve against the elfin race\"" }) DefineUpgrade("upgrade-work-wid-aelfe-and-wid-sidsan", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 212-213. Name = "Against an Elf and Against Charm-Magic", -- "Wið Ælfe and Wið Sidsan" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-aelfsogothan", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 186-189. Name = "For Elf Hiccup", -- "Wið Ælfsogoþan" Work = "scroll", Quote = "\"If a person has elf hiccup, their eyes will be yellow where they should be red.\"" }) DefineUpgrade("upgrade-work-wid-aswollenum-eagum", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 198-199. Name = "For Swollen Eyes", -- "Wið Āswollenum Ēagum" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-blaece", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 196-197. Name = "For Scabies", -- "Wið Blæce" Work = "scroll", Quote = "\"Take this evil, and move away with it.\"" }) DefineUpgrade("upgrade-work-wid-blodrene-of-nosu", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 210-211. Name = "For Nose-Bleed", -- "Wið Blōdrene of Nosu" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-ceapes-lyre", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 184-187. Name = "For Loss of Cattle", -- "Wið Cēapes Lyre" Work = "scroll", Quote = "\"So may this act among men grow famed\nThrough the Holy Rood of Christ. Amen.\"" }) DefineUpgrade("upgrade-work-wid-ceapes-theofende", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 184-185. Name = "For Theft of Cattle", -- "Wið Cēapes Þēofende" Work = "scroll", Quote = "\"So may this act among men become well-known, per crucem Christi.\"" }) DefineUpgrade("upgrade-work-wid-corn", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 170-171. Name = "For Corns", -- "Wið Corn" Work = "scroll", Quote = "\"Geneon genetron genitul\ncatalon care trist pabist\"" }) DefineUpgrade("upgrade-work-wid-cyrnel", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 170-171. Name = "For a Kernel", -- "Wið Cyrnel" Work = "scroll", Quote = "\"And the two to one\nAnd the one to nothing\"" }) DefineUpgrade("upgrade-work-wid-cyrnla", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 194-197. Name = "For Kernels", -- "Wið Cyrnla" Work = "scroll", Quote = "\"Ecce dolgula medit dudum\"" }) DefineUpgrade("upgrade-work-wid-da-blacan-blegene", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 182-183. Name = "For Black Ulcers", -- "Wið Ða Blacan Blēgene" Work = "scroll", Quote = "\"Tigad tigad tigad\ncalicet aclu\"" }) DefineUpgrade("upgrade-work-wid-deofolseocnesse", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 188-189. Name = "Against Demoniacal Possession", -- "Wið Dēofolsēocnesse" Work = "scroll", Quote = "\"I pray you, vinca pervinca - to be had for your many advantages - that you come to me joyously, blooming with your virtues, that you endow me with such qualities that I shall be shielded and ever prosperous and unharmed by poisons and by rage.\"" }) DefineUpgrade("upgrade-work-wid-dweorg", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 212-213. Name = "Against a Dwarf III", -- "Wið Dweorg" Work = "scroll", Quote = "\"To drive away a dwarf\"" }) DefineUpgrade("upgrade-work-wid-dweorh", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 166-167. Name = "Against a Dwarf", -- "Wið Dweorh" Work = "scroll", Quote = "\"That this should never scathe the sick,\nNor him who might this charm acquire,\nNor him who could this charm intone.\"" -- Quote = "\"As soon as from the land they came,\nThey then began to cool.\"" }) DefineUpgrade("upgrade-work-wid-dweorh-2", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 210-211. Name = "Against a Dwarf II", -- "Wið Dweorh" Work = "scroll", Quote = "\"Against a dwarf, write this along the arms\"" }) DefineUpgrade("upgrade-work-wid-faerstice", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 164-167. Name = "For a Sudden Stitch", -- "Wið Fǣrstice" Work = "scroll", Quote = "\"If herein be aught of iron,\nWork of witches, it shall melt!\"" }) DefineUpgrade("upgrade-work-wid-feondes-costunge", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 200-201. Name = "Against the Assaults of the Fiend", -- "Wið Fēondes Costunge" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-feos-lyre", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 178-181. Name = "For Loss of Cattle", -- "Wið Fēos Lyre" Work = "scroll", Quote = "\"Act as I admonish: stay with yours\nAnd leave me with mine; nothing of yours do I desire\"" }) DefineUpgrade("upgrade-work-wid-feos-nimunge", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 180-183. Name = "For Theft of Cattle", -- "Wið Fēos Nimunge" Work = "scroll", Quote = "\"Garmund, servitor of God,\nFind those kine, and fetch those kine\"" }) DefineUpgrade("upgrade-work-wid-fleogendan-attre", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 198-199. Name = "Against Infectious Disease", -- "Wið Flēogendan Āttre" Work = "scroll", Quote = "\"Contriue deus omnem malum et nequitiam, per uirtutem patris et filii et spiritus sancti.\"" }) DefineUpgrade("upgrade-work-wid-fleogendum-attre", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 196-197. Name = "For Infectious Disease", -- "Wið Flēogendum Āttre" Work = "scroll", Quote = "\"Sing over it nine times a litany, and nine times the Paternoster, and nine times this charm\"" }) DefineUpgrade("upgrade-work-wid-heafodece", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 200-201. Name = "For Headache", -- "Wið Hēafodece" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-hors-oman", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 172-173. Name = "For Erysipelas", -- "Wið Hors Ōman" Work = "scroll", Quote = "\"Crux mihi uita et tibi mors inimico; alfa et o, initium et finis, dicit dominus.\"" }) DefineUpgrade("upgrade-work-wid-hors-wreccunge", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 184-185. Name = "For a Horse's Sprain", -- "Wið Hors-Wreccunge" Work = "scroll", Quote = "\"Naborrede, unde uenisti\"" }) DefineUpgrade("upgrade-work-wid-huntan-bite", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 198-199. Name = "For a Spider-Bite", -- "Wið Huntan Bite" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-laetbyrde", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 206-209. Name = "For Delayed Birth", -- "Wið Lætbyrde" Work = "scroll", Quote = "\"Always have I carried with me this great strong hero\"" }) DefineUpgrade("upgrade-work-wid-lenctenadle", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 182-185. Name = "Against Ague", -- "Wið Lenctenādle" Work = "scroll", Quote = "\"In nomine domini summi sit benedictum.\"" }) DefineUpgrade("upgrade-work-wid-lenctenadle-2", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 202-203. Name = "For Ague", -- "Wið Lenctenādle" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-leodrunan", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 202-203. Name = "Against a Sorceress", -- "Wið Lēodrūnan" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-lidwaerce", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 184-185. Name = "For Pain in the Limbs", -- "Wið Liðwærce" Work = "scroll", Quote = "\"Malignus obligavit, angelus curavit, dominus saluavit.\"" }) DefineUpgrade("upgrade-work-wid-maran", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 198-199. Name = "Against an Incubus", -- "Wið Maran" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-miclum-gonge", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 190-191. Name = "For Much Travelling", -- "Wið Miclum Gonge" Work = "scroll", Quote = "\"Tollam te artemesia, ne lassus sim in via.\"" }) DefineUpgrade("upgrade-work-wid-monadseocnesse", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 208-209. Name = "For Lunacy", -- "Wið Mōnaðsēocnesse" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-naedran-bite", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 212-213. Name = "Against Snake-Bite", -- "Wið Nǣdran Bite" Work = "scroll", Quote = "\"Against snake-bite, some advise us to pronounce one word\"" }) DefineUpgrade("upgrade-work-wid-oman", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 172-173. Name = "For Erysipelas", -- "Wið Ōman" Work = "scroll", Quote = "\"O pars et o rillia pars et pars iniopia est alfa et o initium.\"" }) DefineUpgrade("upgrade-work-wid-onfealle", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 200-201. Name = "For a Swelling", -- "Wið Onfealle" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-swina-faer-steorfan", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 208-209. Name = "For Sudden Pestilence Among Swine", -- "Wið Swīna Fǣr-Steorfan" Work = "scroll" }) DefineUpgrade("upgrade-work-wid-theofende", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 206-207. Name = "Against Theft", -- "Wið Þēofende" Work = "scroll", -- Quote = "\"When a man steals anything from you, write this silently\"" -- original Quote = "\"When a person steals anything from you, write this silently\"" }) DefineUpgrade("upgrade-work-wid-theofentum", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 168-169. Name = "Against Thefts", -- "Wið Þēofentum" Work = "scroll", Quote = "\"Giug farig fidig\ndelou delupih\"" }) DefineUpgrade("upgrade-work-wid-todece", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 170-171. Name = "For Toothache", -- "Wið Tōðece" Work = "scroll", Quote = "\"Lilumenne, it aches beyond telling when he lies down; it cools when on earth it burns most fiercely; finit, amen.\"" }) DefineUpgrade("upgrade-work-wid-uncudum-swyle", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 186-187. Name = "For a Strange Swelling", -- "Wið Uncūðum Swyle" Work = "scroll", Quote = "\"Quando natus est Christus, fugit dolor.\"" }) DefineUpgrade("upgrade-work-wid-utsiht", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 170-171. Name = "Ecce Dolgola", -- "Wið Ūtsiht" ("For Diarrhea") Work = "scroll", Quote = "\"Ecce dolgola nedit dudum\nbethecunda braethecunda\"" }) DefineUpgrade("upgrade-work-wid-utsihte", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 204-205. Name = "Ranmigan Adonai", -- "Wið Ūtsihte" ("For Diarrhea") Work = "scroll", Quote = "\"Ranmigan adonai eltheos mur.\"" }) DefineUpgrade("upgrade-work-wid-waeteraelfadle", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 194-195. Name = "For the Water-Elf Disease", -- "Wið Wæterælfādle" Work = "scroll", Quote = "\"Round the wounds I have wreathed the best of healing amulets,\nThat the wounds may neither burn nor burst\"" }) DefineUpgrade("upgrade-work-wid-wambewaerce", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 198-199. Name = "For Bowel-Pain", -- "Wið Wambewærce" Work = "scroll", Quote = "\"Remedium facio ad ventris dolorem.\"" }) DefineUpgrade("upgrade-work-wid-wennum", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 166-167. Name = "Against Wens", -- "Wið Wennum" Work = "scroll", Quote = "\"Wen, wen, little wen,\nHere you shall not build, nor any dwelling have\"" }) DefineUpgrade("upgrade-work-wid-wennum-2", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 212-213. Name = "For Wens", -- "Wið Wennum" Work = "scroll", Quote = "\"Do this so for nine days: he will soon be well.\"" }) DefineUpgrade("upgrade-work-wid-wifgemaedlan", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 212-213. Name = "Against a Witch's Spell", -- "Wið Wīfgemædlan" Work = "scroll", Quote = "\"On that day the spell will not have the power to harm you.\"" }) DefineUpgrade("upgrade-work-wid-wyrme", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 168-169. Name = "For a Worm", -- "Wið Wyrme" Work = "scroll", Quote = "\"Gonomil orgomil marbumil,\nmarbsairamum tofed tengo\"" }) DefineUpgrade("upgrade-work-wid-wyrt-forbore", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 212-213. Name = "Wid Wyrt-Forbore", -- "Wið Wyrt-Forbore" ("For Sexual Constriction") Work = "scroll" }) DefineUpgrade("upgrade-work-wid-ylfa-gescotum", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 208-209. Name = "For Elf-Shot", -- "Wið Ylfa Gescotum" Work = "scroll", Quote = "\"Be the elf who he may, this will suffice as a cure\"" }) DefineUpgrade("upgrade-work-wid-ymbe", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 168-169. Name = "Against a Swarm of Bees", -- "Wið Ymbe" Work = "scroll", Quote = "\"Alight, victory-dames, sink to the ground!\nNever fly to the woodland!\"" }) DefineUpgrade("upgrade-work-with-tha-stithestan-feferas", { -- Source: Felix Grendon, "The Anglo-Saxon Charms", 1909, pp. 210-211. Name = "For the Stubbornest Fevers", -- "Wiþ Þā Stīþestan Fēferas" Work = "scroll" }) DefineModifier("upgrade-work-aecer-bot", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-be-galdorstafum", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-blodseten", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-feld-bot", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-gagates-craeftas", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-historia-ecclesiastica-venerabilis-bedae", {"KnowledgeMagic", 5} ) DefineModifier("upgrade-work-nigon-wyrta-galdor", {"KnowledgeMagic", 1} -- could also be herbology ) DefineModifier("upgrade-work-sidgaldor", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-aelfadle", {"KnowledgeMagic", 1} -- could also be herbology ) DefineModifier("upgrade-work-wid-aelfcynne", {"KnowledgeMagic", 1} -- could also be herbology ) DefineModifier("upgrade-work-wid-aelfe-and-wid-sidsan", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-aelfsogothan", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-aswollenum-eagum", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-blaece", {"KnowledgeMagic", 1} -- could also be herbology ) DefineModifier("upgrade-work-wid-blodrene-of-nosu", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-ceapes-lyre", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-ceapes-theofende", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-corn", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-cyrnel", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-cyrnla", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-da-blacan-blegene", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-deofolseocnesse", {"KnowledgeMagic", 1} -- could also be herbology ) DefineModifier("upgrade-work-wid-dweorg", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-dweorh", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-dweorh-2", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-faerstice", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-feondes-costunge", {"KnowledgeMagic", 1} -- could also be herbology ) DefineModifier("upgrade-work-wid-feos-lyre", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-feos-nimunge", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-fleogendan-attre", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-fleogendum-attre", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-heafodece", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-hors-oman", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-hors-wreccunge", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-huntan-bite", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-laetbyrde", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-lenctenadle", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-lenctenadle-2", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-leodrunan", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-lidwaerce", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-maran", {"KnowledgeMagic", 1} -- could also be herbology ) DefineModifier("upgrade-work-wid-miclum-gonge", {"KnowledgeMagic", 1} -- could also be herbology ) DefineModifier("upgrade-work-wid-monadseocnesse", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-naedran-bite", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-oman", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-onfealle", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-swina-faer-steorfan", {"KnowledgeMagic", 1} -- could also be herbology ) DefineModifier("upgrade-work-wid-theofende", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-theofentum", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-todece", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-uncudum-swyle", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-utsiht", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-utsihte", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-waeteraelfadle", {"KnowledgeMagic", 1} -- could also be herbology ) DefineModifier("upgrade-work-wid-wambewaerce", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-wennum", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-wennum-2", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-wifgemaedlan", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-wyrme", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-wyrt-forbore", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-ylfa-gescotum", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-wid-ymbe", {"KnowledgeMagic", 1} ) DefineModifier("upgrade-work-with-tha-stithestan-feferas", {"KnowledgeMagic", 1} -- could also be herbology ) -- the Anglo-Saxon charms should be available for any Germanic civilization (since we lack literary works for the others) or for fictional civilizations as appropriate; since these are charms, they should all require temples DefineDependency("upgrade-work-aecer-bot", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-english-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple", "unit-dwarven-mushroom-farm"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple", "unit-gnomish-farm"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple", "unit_goblin_farm"} ) DefineDependency("upgrade-work-be-galdorstafum", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-blodseten", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-feld-bot", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-english-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple", "unit-dwarven-mushroom-farm"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple", "unit-gnomish-farm"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple", "unit_goblin_farm"} ) DefineDependency("upgrade-work-gagates-craeftas", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-nigon-wyrta-galdor", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-historia-ecclesiastica-venerabilis-bedae", {"upgrade_deity_christian_god", "upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade-english-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-sidgaldor", {"upgrade_deity_christian_god", "upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-aelfadle", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-aelfcynne", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-aelfe-and-wid-sidsan", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-aelfsogothan", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-aswollenum-eagum", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-blaece", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-blodrene-of-nosu", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-ceapes-lyre", -- not available for fictional civilizations, since their worlds don't have cattle; requires a farm because the charm would only have reason to be available if livestock is kept {"upgrade-anglo-saxon-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-english-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-frankish-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-suebi-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade_teutonic_civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-gothic-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"} ) DefineDependency("upgrade-work-wid-ceapes-theofende", -- not available for fictional civilizations, since their worlds don't have cattle; requires a farm because the charm would only have reason to be available if livestock is kept {"upgrade-anglo-saxon-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-english-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-frankish-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-suebi-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade_teutonic_civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-gothic-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"} ) DefineDependency("upgrade-work-wid-corn", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-cyrnel", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-cyrnla", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-da-blacan-blegene", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-deofolseocnesse", {"upgrade_deity_christian_god", "upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade_deity_christian_god", "upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-dweorg", -- not available for dwarves, since it is an anti-dwarven spell which implies dwarves to be another sort of being {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-dweorh", -- not available for dwarves, since it is an anti-dwarven spell which implies dwarves to be another sort of being {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-dweorh-2", -- not available for dwarves, since it is an anti-dwarven spell which implies dwarves to be another sort of being {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-faerstice", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-feondes-costunge", {"upgrade-anglo-saxon-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-feos-lyre", -- not available for fictional civilizations, since their worlds don't have cattle; requires a farm because the charm would only have reason to be available if livestock is kept {"upgrade-anglo-saxon-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-english-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple", "unit-teuton-farm"} ) DefineDependency("upgrade-work-wid-feos-nimunge", -- not available for fictional civilizations, since their worlds don't have ; requires a farm because the charm would only have reason to be available if livestock is kept {"upgrade-anglo-saxon-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-english-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-frankish-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-suebi-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade_teutonic_civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-gothic-civilization", "upgrade_deity_christian_god", "unit-teuton-temple", "unit-teuton-farm"} ) DefineDependency("upgrade-work-wid-fleogendan-attre", -- has a Latin passage mentioning God {"upgrade-anglo-saxon-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-fleogendum-attre", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-heafodece", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-hors-oman", {"upgrade-anglo-saxon-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "upgrade_deity_christian_god", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "upgrade_deity_christian_god", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-hors-wreccunge", -- not available for fictional civilizations, since their worlds don't have horses; requires a stables because the charm would only have reason to be available if stables are kept {"upgrade-anglo-saxon-civilization", "unit-teuton-temple", "unit-teuton-stables"}, "or", {"upgrade-english-civilization", "unit-teuton-temple", "unit-teuton-stables"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple", "unit-teuton-stables"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple", "unit-teuton-stables"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple", "unit-teuton-stables"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple", "unit-teuton-stables"} ) DefineDependency("upgrade-work-wid-huntan-bite", -- mentions spiders, but fictional civilizations may have their own exotic species of spider in their worlds {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-laetbyrde", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-lenctenadle", -- contains a passage in Latin mentioning God {"upgrade_deity_christian_god", "unit-teuton-temple", "upgrade-anglo-saxon-civilization"}, "or", {"upgrade_deity_christian_god", "unit-teuton-temple", "upgrade-english-civilization"}, "or", {"upgrade_deity_christian_god", "unit-teuton-temple", "upgrade-frankish-civilization"}, "or", {"upgrade_deity_christian_god", "unit-teuton-temple", "upgrade-suebi-civilization"}, "or", {"upgrade_deity_christian_god", "unit-teuton-temple", "upgrade_teutonic_civilization"}, "or", {"upgrade_deity_christian_god", "unit-teuton-temple", "upgrade-gothic-civilization"} ) DefineDependency("upgrade-work-wid-lenctenadle-2", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-leodrunan", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-lidwaerce", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple", "upgrade_deity_christian_god"}, "or", {"upgrade-english-civilization", "unit-teuton-temple", "upgrade_deity_christian_god"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple", "upgrade_deity_christian_god"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple", "upgrade_deity_christian_god"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple", "upgrade_deity_christian_god"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple", "upgrade_deity_christian_god"} ) DefineDependency("upgrade-work-wid-maran", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-miclum-gonge", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-monadseocnesse", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-naedran-bite", -- mentions snakes {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-oman", -- contains Latin passages {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-onfealle", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-swina-faer-steorfan", -- mentions swines {"upgrade-anglo-saxon-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-english-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple", "unit-teuton-farm"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple", "unit-teuton-farm"} ) DefineDependency("upgrade-work-wid-theofende", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-theofentum", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-todece", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-uncudum-swyle", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple", "upgrade_deity_christian_god"}, "or", {"upgrade-english-civilization", "unit-teuton-temple", "upgrade_deity_christian_god"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple", "upgrade_deity_christian_god"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple", "upgrade_deity_christian_god"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple", "upgrade_deity_christian_god"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple", "upgrade_deity_christian_god"} ) DefineDependency("upgrade-work-wid-utsiht", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-utsihte", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-waeteraelfadle", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-wambewaerce", -- contains a Latin passage {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-wennum", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-wennum-2", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-wifgemaedlan", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-wyrme", -- not available for fictional civilizations, since their worlds don't have worms {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-wyrt-forbore", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} ) DefineDependency("upgrade-work-wid-ylfa-gescotum", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-wid-ymbe", -- not available for fictional civilizations, since their worlds don't have bees {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"} ) DefineDependency("upgrade-work-with-tha-stithestan-feferas", {"upgrade-anglo-saxon-civilization", "unit-teuton-temple"}, "or", {"upgrade-english-civilization", "unit-teuton-temple"}, "or", {"upgrade-frankish-civilization", "unit-teuton-temple"}, "or", {"upgrade-suebi-civilization", "unit-teuton-temple"}, "or", {"upgrade_teutonic_civilization", "unit-teuton-temple"}, "or", {"upgrade-gothic-civilization", "unit-teuton-temple"}, "or", {"upgrade-dwarven-civilization", "unit-dwarven-temple"}, "or", {"upgrade-gnomish-civilization", "unit-dwarven-temple"}, "or", {"upgrade-goblin-civilization", "unit-goblin-temple"} )
gpl-2.0
Modified-MW-DF/modified-MDF
MWDF Project/Dwarf Fortress/hack/scripts/masterwork/removefirewood.lua
2
3329
local my_entity=df.historical_entity.find(df.global.ui.civ_id) local sText=" " local k=0 local v=1 for x,y in pairs(df.global.world.entities.all) do my_entity=y k=0 while k < #my_entity.resources.organic.wood.mat_index do v=my_entity.resources.organic.wood.mat_type[k] sText=dfhack.matinfo.decode(v,my_entity.resources.organic.wood.mat_index[k]) if (sText==nil) then --LIQUID barrels my_entity.resources.organic.wood.mat_type:erase(k) my_entity.resources.organic.wood.mat_index:erase(k) k=k-1 else if(sText.material.id=="WOOD") then if(sText.plant.id=="FIREWOOD") then my_entity.resources.organic.wood.mat_type:erase(k) my_entity.resources.organic.wood.mat_index:erase(k) k=k-1 end end end k=k+1 end k=0 while k < #my_entity.resources.misc_mat.crafts.mat_index do v=my_entity.resources.misc_mat.crafts.mat_type[k] sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.crafts.mat_index[k]) if (sText==nil) then --LIQUID barrels my_entity.resources.misc_mat.crafts.mat_type:erase(k) my_entity.resources.misc_mat.crafts.mat_index:erase(k) k=k-1 else if(sText.material.id=="WOOD") then if(sText.plant.id=="FIREWOOD") then my_entity.resources.misc_mat.crafts.mat_type:erase(k) my_entity.resources.misc_mat.crafts.mat_index:erase(k) k=k-1 end end end k=k+1 end k=0 while k < #my_entity.resources.misc_mat.barrels.mat_index do v=my_entity.resources.misc_mat.barrels.mat_type[k] sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.barrels.mat_index[k]) if (sText==nil) then --LIQUID barrels my_entity.resources.misc_mat.barrels.mat_type:erase(k) my_entity.resources.misc_mat.barrels.mat_index:erase(k) k=k-1 else if(sText.material.id=="WOOD") then if(sText.plant.id=="FIREWOOD") then my_entity.resources.misc_mat.barrels.mat_type:erase(k) my_entity.resources.misc_mat.barrels.mat_index:erase(k) k=k-1 end end end k=k+1 end k=0 while k < #my_entity.resources.misc_mat.wood2.mat_index do v=my_entity.resources.misc_mat.wood2.mat_type[k] sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.wood2.mat_index[k]) if (sText==nil) then --LIQUID wood2 my_entity.resources.misc_mat.wood2.mat_type:erase(k) my_entity.resources.misc_mat.wood2.mat_index:erase(k) k=k-1 else if(sText.material.id=="WOOD") then if(sText.plant.id=="FIREWOOD") then my_entity.resources.misc_mat.wood2.mat_type:erase(k) my_entity.resources.misc_mat.wood2.mat_index:erase(k) k=k-1 end end end k=k+1 end k=0 while k < #my_entity.resources.misc_mat.cages.mat_index do v=my_entity.resources.misc_mat.cages.mat_type[k] sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.cages.mat_index[k]) if (sText==nil) then --LIQUID cages my_entity.resources.misc_mat.cages.mat_type:erase(k) my_entity.resources.misc_mat.cages.mat_index:erase(k) k=k-1 else if(sText.material.id=="WOOD") then if(sText.plant.id=="FIREWOOD") then my_entity.resources.misc_mat.cages.mat_type:erase(k) my_entity.resources.misc_mat.cages.mat_index:erase(k) k=k-1 end end end k=k+1 end end
mit
MegaBits/megabits_wiki
extensions/Scribunto/engines/LuaCommon/lualib/mw.site.lua
3
2815
local site = {} function site.setupInterface( info ) -- Boilerplate site.setupInterface = nil local php = mw_interface mw_interface = nil site.siteName = info.siteName site.server = info.server site.scriptPath = info.scriptPath site.stylePath = info.stylePath site.currentVersion = info.currentVersion site.stats = { pagesInCategory = php.pagesInCategory, pagesInNamespace = php.pagesInNamespace, usersInGroup = php.usersInGroup, } -- Process namespace list into more useful tables site.namespaces = {} local namespacesByName = {} site.subjectNamespaces = {} site.talkNamespaces = {} site.contentNamespaces = {} for ns, data in pairs( info.namespaces ) do data.subject = info.namespaces[data.subject] data.talk = info.namespaces[data.talk] data.associated = info.namespaces[data.associated] site.namespaces[ns] = data namespacesByName[data.name] = data if data.canonicalName then namespacesByName[data.canonicalName] = data end for i = 1, #data.aliases do namespacesByName[data.aliases[i]] = data end if data.isSubject then site.subjectNamespaces[ns] = data end if data.isTalk then site.talkNamespaces[ns] = data end if data.isContent then site.contentNamespaces[ns] = data end end -- Set __index for namespacesByName to handle names-with-underscores -- and non-standard case local getNsIndex = php.getNsIndex setmetatable( namespacesByName, { __index = function ( t, k ) if type( k ) == 'string' then -- Try with fixed underscores k = string.gsub( k, '_', ' ' ) if rawget( t, k ) then return rawget( t, k ) end -- Ask PHP, because names are case-insensitive local ns = getNsIndex( k ) if ns then rawset( t, k, site.namespaces[ns] ) end end return rawget( t, k ) end } ) -- Set namespacesByName as the lookup table for site.namespaces, so -- something like site.namespaces.Wikipedia works without having -- pairs( site.namespaces ) iterate all those names. setmetatable( site.namespaces, { __index = namespacesByName } ) -- Copy the site stats, and set up the metatable to load them if necessary. local loadSiteStats = php.loadSiteStats site.stats.x = php.loadSiteStats if info.stats then loadSiteStats = nil for k, v in pairs( info.stats ) do site.stats[k] = v end end setmetatable( site.stats, { __index = function ( t, k ) if t ~= site.stats then -- cloned return site.stats[k] end if k == 'admins' then t.admins = t.usersInGroup( 'sysop' ) elseif loadSiteStats then for k, v in pairs( loadSiteStats() ) do t[k] = v end loadSiteStats = nil end return rawget( t, k ) end } ) -- Register this library in the "mw" global mw = mw or {} mw.site = site package.loaded['mw.site'] = site end return site
gpl-2.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/rori/creatures/leviasquall.lua
1
4686
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. leviasquall = Creature:new { objectName = "leviasquall", -- Lua Object Name creatureType = "ANIMAL", gender = "", speciesName = "leviasquall", stfName = "mob/creature_names", objectCRC = 2862937050, socialGroup = "Squall", level = 19, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 5500, healthMin = 4500, strength = 0, constitution = 0, actionMax = 5500, actionMin = 4500, quickness = 0, stamina = 0, mindMax = 5500, mindMin = 4500, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 15, energy = 0, electricity = 30, stun = 0, blast = -1, heat = -1, cold = 30, acid = -1, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 1, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 180, weaponMaxDamage = 190, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0.25, -- Likely hood to be tamed datapadItemCRC = 713872273, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "bone_mammal_rori", boneMax = 50, hideType = "hide_bristley_rori", hideMax = 61, meatType = "meat_herbivore_rori", meatMax = 50, --skills = { " Stun attack", "", "" } skills = { "squallAttack1" }, respawnTimer = 60, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(leviasquall, 2862937050) -- Add to Global Table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/slashcommands/requests/requestStatMigrationData.lua
1
2493
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 RequestStatMigrationDataSlashCommand = { name = "requeststatmigrationdata", alternativeNames = "", animation = "", invalidStateMask = 2097152, --glowingJedi, invalidPostures = "", target = 2, targeType = 1, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 0, } AddRequestStatMigrationDataSlashCommand(RequestStatMigrationDataSlashCommand)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/talus/npcs/binayre/binayreRuffian.lua
1
4580
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. binayreRuffian = Creature:new { objectName = "binayreRuffian", -- Lua Object Name creatureType = "NPC", faction = "binayre", factionPoints = 20, gender = "", speciesName = "binayre_ruffian", stfName = "mob/creature_names", objectCRC = 3680180330, socialGroup = "binayre", level = 13, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG + AGGRESSIVE_FLAG, healthMax = 1900, healthMin = 1500, strength = 0, constitution = 0, actionMax = 1900, actionMin = 1500, quickness = 0, stamina = 0, mindMax = 1900, mindMin = 1500, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = 0, stun = -1, blast = 0, heat = 0, cold = 0, acid = 0, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 1, invincible = 0, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 140, weaponMaxDamage = 150, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "binayreAttack1" }, respawnTimer = 180, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(binayreRuffian, 3680180330) -- Add to Global Table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/object/tangible/wearables/armor/kashyyykian_hunting/objects.lua
1
8310
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_tangible_wearables_armor_kashyyykian_hunting_shared_armor_kashyyykian_hunting_bracer_l = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/armor_kashyyykian_hunting_bracer_l_wke_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/bracer_l.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:armor_kashyyykian_hunting_bracer_l", gameObjectType = 261, locationReservationRadius = 0, lookAtText = "@wearables_lookat:armor_kashyyykian_hunting_bracer_l", noBuildRadius = 0, objectName = "@wearables_name:armor_kashyyykian_hunting_bracer_l", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_kashyyykian_hunting_shared_armor_kashyyykian_hunting_bracer_l, 2126287876) object_tangible_wearables_armor_kashyyykian_hunting_shared_armor_kashyyykian_hunting_bracer_r = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/armor_kashyyykian_hunting_bracer_r_wke_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/bracer_r.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:armor_kashyyykian_hunting_bracer_r", gameObjectType = 261, locationReservationRadius = 0, lookAtText = "@wearables_lookat:armor_kashyyykian_hunting_bracer_r", noBuildRadius = 0, objectName = "@wearables_name:armor_kashyyykian_hunting_bracer_r", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_kashyyykian_hunting_shared_armor_kashyyykian_hunting_bracer_r, 241815959) object_tangible_wearables_armor_kashyyykian_hunting_shared_armor_kashyyykian_hunting_chest_plate = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/armor_kashyyykian_hunting_chest_plate_wke_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/cowl_long_closed_mouth.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:armor_kashyyykian_hunting_chest_plate", gameObjectType = 257, locationReservationRadius = 0, lookAtText = "@wearables_lookat:armor_kashyyykian_hunting_chest_plate", noBuildRadius = 0, objectName = "@wearables_name:armor_kashyyykian_hunting_chest_plate", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_kashyyykian_hunting_shared_armor_kashyyykian_hunting_chest_plate, 3776759545) object_tangible_wearables_armor_kashyyykian_hunting_shared_armor_kashyyykian_hunting_leggings = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/armor_kashyyykian_hunting_leggings_wke_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/pant_leggings.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:armor_kashyyykian_hunting_leggings", gameObjectType = 260, locationReservationRadius = 0, lookAtText = "@wearables_lookat:armor_kashyyykian_hunting_leggings", noBuildRadius = 0, objectName = "@wearables_name:armor_kashyyykian_hunting_leggings", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_kashyyykian_hunting_shared_armor_kashyyykian_hunting_leggings, 4053289243)
lgpl-3.0
mkwia/jc2atc
scripts/vehiclemech/server/PlaneCrash.lua
1
4273
class "Planecrash" function Planecrash:__init() HeliVehicles = {[3] = true, [14] = true, [37] = true, [57] = true, [62] = true, [64] = true, [65] = true, [67] = true} PlaneVehicles = {[24] = true, [30] = true, [34] = true, [39] = true, [51] = true, [59] = true, [81] = true, [85] = true} AirVehicles = {[3] = true, [14] = true, [37] = true, [57] = true, [62] = true, [64] = true, [65] = true, [67] = true, [24] = true, [30] = true, [34] = true, [39] = true, [51] = true, [59] = true, [81] = true, [85] = true} planehealth = 0.1 helihealth = 0.01 Events:Subscribe("PlayerChat", PlayerChat) math.random() end function PlayerChat(args, player) local words = args.text:split(" ") local Weather = DefaultWorld:GetWeatherSeverity() local Positionx = string.format("%i", args.player:GetPosition().x + 16384) local Positionz = string.format("%i", args.player:GetPosition().z + 16384) if args.text == "/mayday" and not args.player:InVehicle() then Chat:Send(args.player, "You need to be in a plane or helicopter to do that!", Color(255, 255, 255)) return false elseif args.text == "/mayday" and PlaneVehicles[args.player:GetVehicle():GetModelId()] then if Weather == 2 then args.player:GetVehicle():SetHealth(planehealth) args.player:GetVehicle():SetDeathRemove(true) if math.random() <= 0.5 then Chat:Broadcast(tostring(args.player).. "'s plane couldn't handle the turbulence!", Color(255, 255, 255)) elseif math.random() > 0.5 then Chat:Broadcast(tostring(args.player).. "'s plane was struck by lightning!", Color(255, 255, 255)) else Chat:Broadcast(tostring(args.player).. "'s plane's wing was ripped off!", Color(255, 255, 255)) end Chat:Broadcast("Last blackbox broadcast puts " ..tostring(args.player) .." at " ..tostring(Positionx).. ", " ..tostring(Positionz).. ".", Color(255, 255, 255)) return false else args.player:GetVehicle():SetHealth(planehealth) args.player:GetVehicle():SetDeathRemove(true) if math.random() <= 0.5 then Chat:Broadcast(tostring(args.player).. "'s plane's engines have failed!", Color(255, 255, 255)) elseif math.random() > 0.5 then Chat:Broadcast(tostring(args.player).. "'s plane had no left phalange!", Color(255, 255, 255)) else Chat:Broadcast(tostring(args.player).. "'s plane had a fuel leak!", Color(255, 255, 255)) end Chat:Broadcast("Last blackbox broadcast puts " ..tostring(args.player) .." at " ..tostring(Positionx).. ", " ..tostring(Positionz).. ".", Color(255, 255, 255)) return false end elseif args.text == "/mayday" and HeliVehicles[args.player:GetVehicle():GetModelId()] then if Weather == 2 then args.player:GetVehicle():SetHealth(helihealth) args.player:GetVehicle():SetDeathRemove(true) if math.random() <= 0.5 then Chat:Broadcast(tostring(args.player).. "'s helicopter was struck by lightning!", Color(255, 255, 255)) elseif math.random() > 0.5 then Chat:Broadcast(tostring(args.player).. "'s helicopter got caught in a tornado!", Color(255, 255, 255)) else Chat:Broadcast(tostring(args.player).. "'s helicopter was lost in the Bermuda Triangle!", Color(255, 255, 255)) end Chat:Broadcast("Last blackbox broadcast puts " ..tostring(args.player) .." at " ..tostring(Positionx).. ", " ..tostring(Positionz).. ".", Color(255, 255, 255)) return false else args.player:GetVehicle():SetHealth(helihealth) args.player:GetVehicle():SetDeathRemove(true) if math.random() <= 0.5 then Chat:Broadcast(tostring(args.player).. "'s helicopter's engines have failed!", Color(255, 255, 255)) elseif math.random() > 0.5 then Chat:Broadcast(tostring(args.player).. "'s helicopter's rotors fell off!", Color(255, 255, 255)) else Chat:Broadcast(tostring(args.player).. "'s helicopter has a fuel leak!", Color(255, 255, 255)) end Chat:Broadcast("Last blackbox broadcast puts " ..tostring(args.player) .." at " ..tostring(Positionx).. ", " ..tostring(Positionz).. ".", Color(255, 255, 255)) return false end elseif args.text == "/mayday" and not AirVehicles[args.player:GetVehicle():GetModelId()] then Chat:Send(args.player, "You need to be in a plane or helicopter to do that!", Color(255, 255, 255)) return false else return true end end Planecrash = Planecrash()
mit
Andrettin/Wyrmsun
scripts/factions.lua
1
3660
-- _________ __ __ -- / _____// |_____________ _/ |______ ____ __ __ ______ -- \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ -- / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ -- /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > -- \/ \/ \//_____/ \/ -- ______________________ ______________________ -- T H E W A R B E G I N S -- Stratagus - A free fantasy real time strategy game engine -- -- (c) Copyright 2015-2022 by Andrettin -- -- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- Load("scripts/civilizations/assyrian/factions.lua") Load("scripts/civilizations/basque/factions.lua") Load("scripts/civilizations/briton/factions.lua") Load("scripts/civilizations/castillian/factions.lua") Load("scripts/civilizations/celt/factions.lua") Load("scripts/civilizations/chinese/factions.lua") Load("scripts/civilizations/dwarf/factions.lua") Load("scripts/civilizations/elf/factions.lua") Load("scripts/civilizations/etruscan/factions.lua") Load("scripts/civilizations/ettin/factions.lua") Load("scripts/civilizations/uralic/factions.lua") Load("scripts/civilizations/gael/factions.lua") Load("scripts/civilizations/gaul/factions.lua") Load("scripts/civilizations/english/factions.lua") Load("scripts/civilizations/frankish/factions.lua") Load("scripts/civilizations/gnome/factions.lua") Load("scripts/civilizations/goblin/factions.lua") Load("scripts/civilizations/greek/factions.lua") Load("scripts/civilizations/hebrew/factions.lua") Load("scripts/civilizations/hittite/factions.lua") Load("scripts/civilizations/iberian/factions.lua") Load("scripts/civilizations/illyrian/factions.lua") Load("scripts/civilizations/italian/factions.lua") Load("scripts/civilizations/kobold/factions.lua") Load("scripts/civilizations/latin/factions.lua") Load("scripts/civilizations/magyar/factions.lua") Load("scripts/civilizations/minoan/factions.lua") Load("scripts/civilizations/norse/factions.lua") Load("scripts/civilizations/orc/factions.lua") Load("scripts/civilizations/persian/factions.lua") Load("scripts/civilizations/portuguese/factions.lua") Load("scripts/civilizations/romanian/factions.lua") Load("scripts/civilizations/teuton/factions.lua") Load("scripts/civilizations/thracian/factions.lua") Load("scripts/civilizations/troll/factions.lua") Load("scripts/civilizations/turkish/factions.lua") Load("scripts/civilizations/welsh/factions.lua") -- deity factions DefineFaction("asgard", { Name = "Asgard", Adjective = "Asgardian", Civilization = "einherjar", Type = "polity", Color = "blue", DefaultTier = "kingdom", DefaultAI = "passive" }) DefineFaction("hel", { Name = "Hel", Adjective = "Hel", Civilization = "einherjar", Type = "polity", Color = "black", DefaultTier = "kingdom", DefaultAI = "passive" })
gpl-2.0
mkwia/jc2atc
scripts/playerlist/client/gui.lua
1
6339
-- Written by JaTochNietDan, with slight modifications by Philpax class 'ListGUI' function ListGUI:__init() self.active = false self.LastTick = 0 self.ReceivedLastUpdate = true self.window = Window.Create() self.window:SetSizeRel( Vector2( 0.25, 0.8 ) ) self.window:SetPositionRel( Vector2( 0.5, 0.5 ) - self.window:GetSizeRel()/2 ) self.window:SetTitle( "Total Players: 0" ) self.window:SetVisible( self.active ) self.list = SortedList.Create( self.window ) self.list:SetDock( GwenPosition.Fill ) self.list:SetMargin( Vector2( 4, 4 ), Vector2( 4, 0 ) ) self.list:AddColumn( "ID", 32 ) self.list:AddColumn( "Name" ) self.list:AddColumn( "Bounty", 48) self.list:AddColumn( "Ping", 48 ) self.list:SetButtonsVisible( true ) self.filter = TextBox.Create( self.window ) self.filter:SetDock( GwenPosition.Bottom ) self.filter:SetSize( Vector2( self.window:GetSize().x, 32 ) ) self.filter:SetMargin( Vector2( 4, 4 ), Vector2( 4, 4 ) ) self.filter:Subscribe( "TextChanged", self, self.FilterChanged ) self.filterGlobal = LabeledCheckBox.Create( self.window ) self.filterGlobal:SetDock( GwenPosition.Bottom ) self.filterGlobal:SetSize( Vector2( self.window:GetSize().x, 20 ) ) self.filterGlobal:SetMargin( Vector2( 4, 4 ), Vector2( 4, 0 ) ) self.filterGlobal:GetLabel():SetText( "Search entire name" ) self.filterGlobal:GetCheckBox():SetChecked( true ) self.filterGlobal:GetCheckBox():Subscribe( "CheckChanged", self, self.FilterChanged ) self.player = nil self.PlayerCount = 0 self.Rows = {} self.sort_dir = false self.last_column = -1 self.list:Subscribe( "SortPress", function(button) self.sort_dir = not self.sort_dir end) self.list:SetSort( function( column, a, b ) if column ~= -1 then self.last_column = column elseif column == -1 and self.last_column ~= -1 then column = self.last_column else column = 0 end local a_value = a:GetCellText(column) local b_value = b:GetCellText(column) if column == 0 or column == 2 then local a_num = tonumber(a_value) local b_num = tonumber(b_value) if a_num ~= nil and b_num ~= nil then a_value = a_num b_value = b_num end end if self.sort_dir then return a_value > b_value else return a_value < b_value end end ) self:AddPlayer(LocalPlayer) for player in Client:GetPlayers() do self:AddPlayer(player) end self.window:SetTitle("Total Players: "..tostring(self.PlayerCount)) Network:Subscribe("UpdatePings", self, self.UpdatePings) Events:Subscribe( "KeyUp", self, self.KeyUp ) Events:Subscribe( "LocalPlayerInput", self, self.LocalPlayerInput ) Events:Subscribe( "PostTick", self, self.PostTick ) Events:Subscribe( "PlayerJoin", self, self.PlayerJoin ) Events:Subscribe( "PlayerQuit", self, self.PlayerQuit ) self.list:Subscribe( "RowSelected", self, self.ChoosePlayer ) Events:Subscribe( "Render", self, self.DrawAvatar ) self.window:Subscribe( "WindowClosed", self, self.CloseClicked ) end function ListGUI:GetActive() return self.active end function ListGUI:SetActive( state ) self.active = state self.window:SetVisible( self.active ) Mouse:SetVisible( self.active ) end function ListGUI:KeyUp( args ) if args.key == VirtualKey.F6 then self:SetActive( not self:GetActive() ) if not self:GetActive() then self.list:UnselectAll() self.player = nil end end end function ListGUI:LocalPlayerInput( args ) if self:GetActive() and Game:GetState() == GUIState.Game then return false end end function ListGUI:UpdatePings( list ) for ID, ping in pairs(list) do if self.Rows[ID] ~= nil then self.Rows[ID]:SetCellText( 3, tostring(ping) ) local bounty = Player.GetById(ID):GetValue( "Bounty" ) if bounty ~= nil then self.Rows[ID]:SetCellText( 2, "£"..tostring(bounty) ) else self.Rows[ID]:SetCellText( 2, "£0" ) end end end self.ReceivedLastUpdate = true end function ListGUI:PlayerJoin( args ) self:AddPlayer(args.player) self.window:SetTitle("Total Players: "..tostring(self.PlayerCount)) end function ListGUI:PlayerQuit( args ) self:RemovePlayer(args.player) self.window:SetTitle("Total Players: "..tostring(self.PlayerCount)) end function ListGUI:ChoosePlayer() local p = self.list:GetSelectedRow():GetCellText(0) self.player = Player.GetById( tonumber(p) ) end function ListGUI:DrawAvatar() if not self.active or self.player == nil then return end local rs = Render.Size self.player:GetAvatar(2):Draw( Vector2( rs.x * 0.85 - 100, rs.y * 0.5 - 100 ), Vector2( 200, 200 ), Vector2.Zero, Vector2.One) end function ListGUI:CloseClicked( args ) self:SetActive( false ) self.list:UnselectAll() self.player = nil end function ListGUI:AddPlayer( player ) self.PlayerCount = self.PlayerCount + 1 local item = self.list:AddItem( tostring(player:GetId()) ) item:SetCellText( 1, player:GetName() ) item:SetCellText( 2, "£0") item:SetCellText( 3, "..." ) self.Rows[player:GetId()] = item local text = self.filter:GetText():lower() local visible = (string.find( item:GetCellText(1):lower(), text ) == 1) item:SetVisible( visible ) end function ListGUI:RemovePlayer( player ) self.PlayerCount = self.PlayerCount - 1 if self.Rows[player:GetId()] == nil then return end self.list:RemoveItem( self.Rows[player:GetId()] ) self.Rows[player:GetId()] = nil end function ListGUI:FilterChanged() local text = self.filter:GetText():lower() local globalSearch = self.filterGlobal:GetCheckBox():GetChecked() if text:len() > 0 then for k, v in pairs(self.Rows) do --[[ Use a plain text search, instead of a pattern search, to determine whether the string is within this row. If pattern searching is used, pattern characters such as '[' and ']' in names cause this function to error. ]] local index = v:GetCellText(1):lower():find( text, 1, true ) if globalSearch then v:SetVisible( index ~= nil ) else v:SetVisible( index == 1 ) end end else for k, v in pairs(self.Rows) do v:SetVisible( true ) end end end function ListGUI:PostTick() if self:GetActive() then if Client:GetElapsedSeconds() - self.LastTick >= 5 then Network:Send("SendPingList", LocalPlayer) self.LastTick = Client:GetElapsedSeconds() self.ReceivedLastUpdate = false end end end list = ListGUI()
mit
TheAnswer/FirstTest
bin/scripts/creatures/objects/yavin4/creatures/lurkingAngler.lua
1
4752
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. lurkingAngler = Creature:new { objectName = "lurkingAngler", -- Lua Object Name creatureType = "ANIMAL", gender = "", speciesName = "lurking_angler", stfName = "mob/creature_names", objectCRC = 3645434131, socialGroup = "Angler", level = 30, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG + AGGRESSIVE_FLAG, healthMax = 10200, healthMin = 8400, strength = 0, constitution = 0, actionMax = 10200, actionMin = 8400, quickness = 0, stamina = 0, mindMax = 10200, mindMin = 8400, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = -1, stun = -1, blast = 0, heat = -1, cold = 0, acid = 0, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 1, killer = 0, ferocity = 0, aggressive = 1, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 290, weaponMaxDamage = 300, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateweaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, -- Likely hood to be tamed datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 20, hideType = "", hideMax = 20, meatType = "meat_insect_yavin4", meatMax = 4, --skills = { " Poison attack (medium)", " Intimidation attack", " Ranged attack (spit)" } skills = { "anglerAttack1", "anglerAttack2", "anglerAttack5" }, respawnTimer = 60, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(lurkingAngler, 3645434131) -- Add to Global Table
lgpl-3.0
focusworld/max_bot
libs/mimetype.lua
3662
2922
-- Thanks to https://github.com/catwell/lua-toolbox/blob/master/mime.types do local mimetype = {} -- TODO: Add more? local types = { ["text/html"] = "html", ["text/css"] = "css", ["text/xml"] = "xml", ["image/gif"] = "gif", ["image/jpeg"] = "jpg", ["application/x-javascript"] = "js", ["application/atom+xml"] = "atom", ["application/rss+xml"] = "rss", ["text/mathml"] = "mml", ["text/plain"] = "txt", ["text/vnd.sun.j2me.app-descriptor"] = "jad", ["text/vnd.wap.wml"] = "wml", ["text/x-component"] = "htc", ["image/png"] = "png", ["image/tiff"] = "tiff", ["image/vnd.wap.wbmp"] = "wbmp", ["image/x-icon"] = "ico", ["image/x-jng"] = "jng", ["image/x-ms-bmp"] = "bmp", ["image/svg+xml"] = "svg", ["image/webp"] = "webp", ["application/java-archive"] = "jar", ["application/mac-binhex40"] = "hqx", ["application/msword"] = "doc", ["application/pdf"] = "pdf", ["application/postscript"] = "ps", ["application/rtf"] = "rtf", ["application/vnd.ms-excel"] = "xls", ["application/vnd.ms-powerpoint"] = "ppt", ["application/vnd.wap.wmlc"] = "wmlc", ["application/vnd.google-earth.kml+xml"] = "kml", ["application/vnd.google-earth.kmz"] = "kmz", ["application/x-7z-compressed"] = "7z", ["application/x-cocoa"] = "cco", ["application/x-java-archive-diff"] = "jardiff", ["application/x-java-jnlp-file"] = "jnlp", ["application/x-makeself"] = "run", ["application/x-perl"] = "pl", ["application/x-pilot"] = "prc", ["application/x-rar-compressed"] = "rar", ["application/x-redhat-package-manager"] = "rpm", ["application/x-sea"] = "sea", ["application/x-shockwave-flash"] = "swf", ["application/x-stuffit"] = "sit", ["application/x-tcl"] = "tcl", ["application/x-x509-ca-cert"] = "crt", ["application/x-xpinstall"] = "xpi", ["application/xhtml+xml"] = "xhtml", ["application/zip"] = "zip", ["application/octet-stream"] = "bin", ["audio/midi"] = "mid", ["audio/mpeg"] = "mp3", ["audio/ogg"] = "ogg", ["audio/x-m4a"] = "m4a", ["audio/x-realaudio"] = "ra", ["video/3gpp"] = "3gpp", ["video/mp4"] = "mp4", ["video/mpeg"] = "mpeg", ["video/quicktime"] = "mov", ["video/webm"] = "webm", ["video/x-flv"] = "flv", ["video/x-m4v"] = "m4v", ["video/x-mng"] = "mng", ["video/x-ms-asf"] = "asf", ["video/x-ms-wmv"] = "wmv", ["video/x-msvideo"] = "avi" } -- Returns the common file extension from a content-type function mimetype.get_mime_extension(content_type) return types[content_type] end -- Returns the mimetype and subtype function mimetype.get_content_type(extension) for k,v in pairs(types) do if v == extension then return k end end end -- Returns the mimetype without the subtype function mimetype.get_content_type_no_sub(extension) for k,v in pairs(types) do if v == extension then -- Before / return k:match('([%w-]+)/') end end end return mimetype end
gpl-2.0
sweetbot0/sweetbot
libs/mimetype.lua
3662
2922
-- Thanks to https://github.com/catwell/lua-toolbox/blob/master/mime.types do local mimetype = {} -- TODO: Add more? local types = { ["text/html"] = "html", ["text/css"] = "css", ["text/xml"] = "xml", ["image/gif"] = "gif", ["image/jpeg"] = "jpg", ["application/x-javascript"] = "js", ["application/atom+xml"] = "atom", ["application/rss+xml"] = "rss", ["text/mathml"] = "mml", ["text/plain"] = "txt", ["text/vnd.sun.j2me.app-descriptor"] = "jad", ["text/vnd.wap.wml"] = "wml", ["text/x-component"] = "htc", ["image/png"] = "png", ["image/tiff"] = "tiff", ["image/vnd.wap.wbmp"] = "wbmp", ["image/x-icon"] = "ico", ["image/x-jng"] = "jng", ["image/x-ms-bmp"] = "bmp", ["image/svg+xml"] = "svg", ["image/webp"] = "webp", ["application/java-archive"] = "jar", ["application/mac-binhex40"] = "hqx", ["application/msword"] = "doc", ["application/pdf"] = "pdf", ["application/postscript"] = "ps", ["application/rtf"] = "rtf", ["application/vnd.ms-excel"] = "xls", ["application/vnd.ms-powerpoint"] = "ppt", ["application/vnd.wap.wmlc"] = "wmlc", ["application/vnd.google-earth.kml+xml"] = "kml", ["application/vnd.google-earth.kmz"] = "kmz", ["application/x-7z-compressed"] = "7z", ["application/x-cocoa"] = "cco", ["application/x-java-archive-diff"] = "jardiff", ["application/x-java-jnlp-file"] = "jnlp", ["application/x-makeself"] = "run", ["application/x-perl"] = "pl", ["application/x-pilot"] = "prc", ["application/x-rar-compressed"] = "rar", ["application/x-redhat-package-manager"] = "rpm", ["application/x-sea"] = "sea", ["application/x-shockwave-flash"] = "swf", ["application/x-stuffit"] = "sit", ["application/x-tcl"] = "tcl", ["application/x-x509-ca-cert"] = "crt", ["application/x-xpinstall"] = "xpi", ["application/xhtml+xml"] = "xhtml", ["application/zip"] = "zip", ["application/octet-stream"] = "bin", ["audio/midi"] = "mid", ["audio/mpeg"] = "mp3", ["audio/ogg"] = "ogg", ["audio/x-m4a"] = "m4a", ["audio/x-realaudio"] = "ra", ["video/3gpp"] = "3gpp", ["video/mp4"] = "mp4", ["video/mpeg"] = "mpeg", ["video/quicktime"] = "mov", ["video/webm"] = "webm", ["video/x-flv"] = "flv", ["video/x-m4v"] = "m4v", ["video/x-mng"] = "mng", ["video/x-ms-asf"] = "asf", ["video/x-ms-wmv"] = "wmv", ["video/x-msvideo"] = "avi" } -- Returns the common file extension from a content-type function mimetype.get_mime_extension(content_type) return types[content_type] end -- Returns the mimetype and subtype function mimetype.get_content_type(extension) for k,v in pairs(types) do if v == extension then return k end end end -- Returns the mimetype without the subtype function mimetype.get_content_type_no_sub(extension) for k,v in pairs(types) do if v == extension then -- Before / return k:match('([%w-]+)/') end end end return mimetype end
gpl-3.0
amir1213/am
libs/mimetype.lua
3662
2922
-- Thanks to https://github.com/catwell/lua-toolbox/blob/master/mime.types do local mimetype = {} -- TODO: Add more? local types = { ["text/html"] = "html", ["text/css"] = "css", ["text/xml"] = "xml", ["image/gif"] = "gif", ["image/jpeg"] = "jpg", ["application/x-javascript"] = "js", ["application/atom+xml"] = "atom", ["application/rss+xml"] = "rss", ["text/mathml"] = "mml", ["text/plain"] = "txt", ["text/vnd.sun.j2me.app-descriptor"] = "jad", ["text/vnd.wap.wml"] = "wml", ["text/x-component"] = "htc", ["image/png"] = "png", ["image/tiff"] = "tiff", ["image/vnd.wap.wbmp"] = "wbmp", ["image/x-icon"] = "ico", ["image/x-jng"] = "jng", ["image/x-ms-bmp"] = "bmp", ["image/svg+xml"] = "svg", ["image/webp"] = "webp", ["application/java-archive"] = "jar", ["application/mac-binhex40"] = "hqx", ["application/msword"] = "doc", ["application/pdf"] = "pdf", ["application/postscript"] = "ps", ["application/rtf"] = "rtf", ["application/vnd.ms-excel"] = "xls", ["application/vnd.ms-powerpoint"] = "ppt", ["application/vnd.wap.wmlc"] = "wmlc", ["application/vnd.google-earth.kml+xml"] = "kml", ["application/vnd.google-earth.kmz"] = "kmz", ["application/x-7z-compressed"] = "7z", ["application/x-cocoa"] = "cco", ["application/x-java-archive-diff"] = "jardiff", ["application/x-java-jnlp-file"] = "jnlp", ["application/x-makeself"] = "run", ["application/x-perl"] = "pl", ["application/x-pilot"] = "prc", ["application/x-rar-compressed"] = "rar", ["application/x-redhat-package-manager"] = "rpm", ["application/x-sea"] = "sea", ["application/x-shockwave-flash"] = "swf", ["application/x-stuffit"] = "sit", ["application/x-tcl"] = "tcl", ["application/x-x509-ca-cert"] = "crt", ["application/x-xpinstall"] = "xpi", ["application/xhtml+xml"] = "xhtml", ["application/zip"] = "zip", ["application/octet-stream"] = "bin", ["audio/midi"] = "mid", ["audio/mpeg"] = "mp3", ["audio/ogg"] = "ogg", ["audio/x-m4a"] = "m4a", ["audio/x-realaudio"] = "ra", ["video/3gpp"] = "3gpp", ["video/mp4"] = "mp4", ["video/mpeg"] = "mpeg", ["video/quicktime"] = "mov", ["video/webm"] = "webm", ["video/x-flv"] = "flv", ["video/x-m4v"] = "m4v", ["video/x-mng"] = "mng", ["video/x-ms-asf"] = "asf", ["video/x-ms-wmv"] = "wmv", ["video/x-msvideo"] = "avi" } -- Returns the common file extension from a content-type function mimetype.get_mime_extension(content_type) return types[content_type] end -- Returns the mimetype and subtype function mimetype.get_content_type(extension) for k,v in pairs(types) do if v == extension then return k end end end -- Returns the mimetype without the subtype function mimetype.get_content_type_no_sub(extension) for k,v in pairs(types) do if v == extension then -- Before / return k:match('([%w-]+)/') end end end return mimetype end
gpl-2.0
TheAnswer/FirstTest
bin/scripts/object/draft_schematic/item/component/objects.lua
1
8350
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_draft_schematic_item_component_shared_item_electronic_control_unit = SharedDraftSchematicObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0 } ObjectTemplates:addTemplate(object_draft_schematic_item_component_shared_item_electronic_control_unit, 989624055) object_draft_schematic_item_component_shared_item_electronic_energy_distributor = SharedDraftSchematicObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0 } ObjectTemplates:addTemplate(object_draft_schematic_item_component_shared_item_electronic_energy_distributor, 1152098080) object_draft_schematic_item_component_shared_item_electronic_power_conditioner = SharedDraftSchematicObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0 } ObjectTemplates:addTemplate(object_draft_schematic_item_component_shared_item_electronic_power_conditioner, 3615264224) object_draft_schematic_item_component_shared_item_electronics_gp_module = SharedDraftSchematicObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0 } ObjectTemplates:addTemplate(object_draft_schematic_item_component_shared_item_electronics_gp_module, 4228360112) object_draft_schematic_item_component_shared_item_electronics_memory_module = SharedDraftSchematicObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0 } ObjectTemplates:addTemplate(object_draft_schematic_item_component_shared_item_electronics_memory_module, 2170102415) object_draft_schematic_item_component_shared_item_micro_sensor_suite = SharedDraftSchematicObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0 } ObjectTemplates:addTemplate(object_draft_schematic_item_component_shared_item_micro_sensor_suite, 622519855)
lgpl-3.0
REZATITAN/XY
plugins/greeter.lua
13
4223
--[[ Sends a custom message when a user enters or leave a chat. !welcome group The custom message will send to the group. Recommended way. !welcome pm The custom message will send to private chat newly joins member. Not recommended as a privacy concern and the possibility of user reporting the bot. !welcome disable Disable welcome service. Also, you can just disable greeter plugin. --]] do local function run(msg, matches) local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then local welcome_stat = data[tostring(msg.to.id)]['settings']['welcome'] if matches[1] == 'welcome' and is_mod(msg) then if matches[2] == 'group' and welcome_stat ~= 'group' then data[tostring(msg.to.id)]['settings']['welcome'] = 'group' save_data(_config.moderation.data, data) return 'Welcome service already enabled.\nWelcome message will shown in group.' elseif matches[2] == 'pm' and welcome_stat ~= 'private' then data[tostring(msg.to.id)]['settings']['welcome'] = 'private' save_data(_config.moderation.data, data) return 'Welcome service already enabled.\nWelcome message will send as private message to new member.' elseif matches[2] == 'disable' then if welcome_stat == 'no' then return 'Welcome service is not enabled.' else data[tostring(msg.to.id)]['settings']['welcome'] = 'no' save_data(_config.moderation.data, data) return 'Welcome service has been disabled.' end end end if welcome_stat ~= 'no' and msg.action and msg.action.type then local action = msg.action.type if action == 'chat_add_user' or action == 'chat_add_user_link' or action == 'chat_del_user' then if msg.action.link_issuer then user_id = msg.from.id new_member = (msg.from.first_name or '')..' '..(msg.from.last_name or '') username = '@'..msg.from.username..' AKA ' or '' user_flags = msg.flags else user_id = msg.action.user.id new_member = (msg.action.user.first_name or '')..' '..(msg.action.user.last_name or '') username = '@'..msg.action.user.username..' AKA ' or '' user_flags = msg.action.user.flags end -- do not greet (super)banned users or API bots. if is_super_banned(user_id) or is_banned(user_id, msg.to.id) then print 'Ignored. User is banned!' return nil end if user_flags == 4352 then print 'Ignored. It is an API bot.' return nil end end if matches[1] == 'chat_add_user' or matches[1] == 'chat_add_user_link' then if data[tostring(msg.to.id)] then local about = '' local rules = '' if data[tostring(msg.to.id)]['description'] then about = '\nDescription :\n'..data[tostring(msg.to.id)]['description']..'\n' end if data[tostring(msg.to.id)]['rules'] then rules = '\nRules :\n'..data[tostring(msg.to.id)]['rules']..'\n' end local welcomes = 'Welcome '..username..new_member..' ['..user_id..'].\n' ..'You are in group '..msg.to.title..'.\n' if welcome_stat == 'group' then receiver = get_receiver(msg) elseif welcome_stat == 'private' then receiver = 'user#id'..msg.from.id end send_large_msg(receiver, welcomes..about..rules..'\n', ok_cb, false) end elseif matches[1] == 'chat_del_user' then return 'Bye '..new_member..'!' end end end end return { description = 'Sends a custom message when a user enters or leave a chat.', usage = { moderator = { '!welcome group : Welcome message will shows in group.', '!welcome pm : Welcome message will send to new member via PM.', '!welcome disable : Disable welcome message.' }, }, patterns = { '^!!tgservice (.+)$', '^!(welcome) (.*)$' }, run = run } end
gpl-2.0
TheAnswer/FirstTest
bin/scripts/slashcommands/skills/taunt.lua
1
2548
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 TauntSlashCommand = { name = "taunt", alternativeNames = "", animation = "", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", target = 1, targeType = 2, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 1, } AddTauntSlashCommand(TauntSlashCommand)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/object/tangible/space/story_loot/objects.lua
1
56091
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_tangible_space_story_loot_shared_loot_all_freighter = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_handheld_viewscreen_s1.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_all_freighter", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_all_freighter, 3579895697) object_tangible_space_story_loot_shared_loot_all_freighter_2 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_droid_module_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_all_freighter_2", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_all_freighter_2, 3551864923) object_tangible_space_story_loot_shared_loot_dantooine_anthro = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/thm_prp_ledger.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_anthro", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_anthro, 1723215073) object_tangible_space_story_loot_shared_loot_dantooine_anthro2 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_handheld_viewscreen_s2.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_anthro2", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_anthro2, 592143953) object_tangible_space_story_loot_shared_loot_dantooine_blacksun = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_datapad.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_blacksun", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_blacksun, 3245065394) object_tangible_space_story_loot_shared_loot_dantooine_blacksun2 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_engineering_analysis_board.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_blacksun2", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_blacksun2, 298529626) object_tangible_space_story_loot_shared_loot_dantooine_force = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_data_disk.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_force", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_force, 4024561732) object_tangible_space_story_loot_shared_loot_dantooine_imp = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/thm_prp_decryptor_imperial.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_imp", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_imp, 2359349823) object_tangible_space_story_loot_shared_loot_dantooine_imp2 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_datapad.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_imp2", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_imp2, 3751168254) object_tangible_space_story_loot_shared_loot_dantooine_junk = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_handheld_viewscreen_s1.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_junk", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_junk, 506610356) object_tangible_space_story_loot_shared_loot_dantooine_junk2 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_data_disk.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_junk2", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_junk2, 1637466894) object_tangible_space_story_loot_shared_loot_dantooine_junk3 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_droid_module_s03.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_junk3", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_junk3, 680830083) object_tangible_space_story_loot_shared_loot_dantooine_mining = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/thm_prp_ledger.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_mining", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_mining, 1853798346) object_tangible_space_story_loot_shared_loot_dantooine_mining2 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_handheld_viewscreen_s1.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_mining2", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_mining2, 3453526249) object_tangible_space_story_loot_shared_loot_dantooine_rebel = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_data_disk.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_rebel", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_rebel, 3847010341) object_tangible_space_story_loot_shared_loot_dantooine_rebel2 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_droid_module_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_rebel2", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_rebel2, 3180356710) object_tangible_space_story_loot_shared_loot_dantooine_scavengers = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_simple.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_scavengers", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_scavengers, 1838597503) object_tangible_space_story_loot_shared_loot_dantooine_scavengers2 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_simple.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_scavengers2", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_scavengers2, 686371632) object_tangible_space_story_loot_shared_loot_dantooine_scavengers3 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_ticket.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_scavengers3", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_scavengers3, 1642353853) object_tangible_space_story_loot_shared_loot_dantooine_slave = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_droid_module_s03.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_slave", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_slave, 3661960880) object_tangible_space_story_loot_shared_loot_dantooine_warren = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_data_disk.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_dantooine_warren", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_dantooine_warren, 1982024474) object_tangible_space_story_loot_shared_loot_endor_artisan = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_handheld_viewscreen_s1.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_endor_artisan", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_endor_artisan, 843112558) object_tangible_space_story_loot_shared_loot_endor_artisan2 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_data_disk.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_endor_artisan2", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_endor_artisan2, 3188995210) object_tangible_space_story_loot_shared_loot_endor_series_tinrilo = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_ticket.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_endor_series_tinrilo", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_endor_series_tinrilo, 4247652196) object_tangible_space_story_loot_shared_loot_naboo_borvo = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/thm_prp_ledger.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_naboo_borvo", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_naboo_borvo, 1520410243) object_tangible_space_story_loot_shared_loot_naboo_civspeeder = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_datapad.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_naboo_civspeeder", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_naboo_civspeeder, 2417494884) object_tangible_space_story_loot_shared_loot_naboo_droid = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_data_disk.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_naboo_droid", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_naboo_droid, 1611326943) object_tangible_space_story_loot_shared_loot_naboo_imperial = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/thm_prp_decryptor_imperial.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_naboo_imperial", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_naboo_imperial, 854700506) object_tangible_space_story_loot_shared_loot_naboo_miner = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_droid_program_disk.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_naboo_miner", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_naboo_miner, 1114974083) object_tangible_space_story_loot_shared_loot_naboo_rsf = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_droid_module_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_naboo_rsf", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_naboo_rsf, 355997813) object_tangible_space_story_loot_shared_loot_naboo_series_tinrilo = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_ticket.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_naboo_series_tinrilo", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_naboo_series_tinrilo, 3063834510) object_tangible_space_story_loot_shared_loot_tatooine_bestine_pirates = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_data_disk.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_tatooine_bestine_pirates", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_tatooine_bestine_pirates, 3042526533) object_tangible_space_story_loot_shared_loot_tatooine_blacksun = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_engineering_analysis_board.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_tatooine_blacksun", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_tatooine_blacksun, 2091210633) object_tangible_space_story_loot_shared_loot_tatooine_blacksun2 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_handheld_viewscreen_s2.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_tatooine_blacksun2", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_tatooine_blacksun2, 1403716599) object_tangible_space_story_loot_shared_loot_tatooine_hutt = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_droid_module_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_tatooine_hutt", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_tatooine_hutt, 1733541614) object_tangible_space_story_loot_shared_loot_tatooine_imp = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/thm_prp_decryptor_imperial.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_tatooine_imp", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_tatooine_imp, 804394387) object_tangible_space_story_loot_shared_loot_tatooine_mining = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_tool_handheld_viewscreen_s1.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_tatooine_mining", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_tatooine_mining, 2776381679) object_tangible_space_story_loot_shared_loot_tatooine_rebel = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_droid_module_s03.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_tatooine_rebel", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_tatooine_rebel, 2201065761) object_tangible_space_story_loot_shared_loot_tatooine_series_tinrilo = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_ticket.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_tatooine_series_tinrilo", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_tatooine_series_tinrilo, 1420399460) object_tangible_space_story_loot_shared_loot_tatooine_valarian = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_data_disk.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@space/story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@space/story_loot_n:loot_tatooine_valarian", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_tatooine_valarian, 1385044449) object_tangible_space_story_loot_shared_loot_template = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_droid_program_disk.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@story_loot_d:template_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@story_loot_n:template_n", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_space_story_loot_shared_loot_template, 4061585871)
lgpl-3.0
amir1213/am
bot/creed.lua
1
15502
package.path = package.path .. ';.luarocks/share/lua/5.2/?.lua' ..';.luarocks/share/lua/5.2/?/init.lua' package.cpath = package.cpath .. ';.luarocks/lib/lua/5.2/?.so' require("./bot/utils") VERSION = '1.0' -- This function is called when tg receive a msg function on_msg_receive (msg) if not started then return end local receiver = get_receiver(msg) print (receiver) --vardump(msg) msg = pre_process_service_msg(msg) if msg_valid(msg) then msg = pre_process_msg(msg) if msg then match_plugins(msg) -- mark_read(receiver, ok_cb, false) end end end function ok_cb(extra, success, result) end function on_binlog_replay_end() started = true postpone (cron_plugins, false, 60*5.0) _config = load_config() -- load plugins plugins = {} load_plugins() end function msg_valid(msg) -- Don't process outgoing messages if msg.out then print('\27[36mNot valid: msg from us\27[39m') return false end -- Before bot was started if msg.date < now then print('\27[36mNot valid: old msg\27[39m') return false end if msg.unread == 0 then print('\27[36mNot valid: readed\27[39m') return false end if not msg.to.id then print('\27[36mNot valid: To id not provided\27[39m') return false end if not msg.from.id then print('\27[36mNot valid: From id not provided\27[39m') return false end if msg.from.id == our_id then print('\27[36mNot valid: Msg from our id\27[39m') return false end if msg.to.type == 'encr_chat' then print('\27[36mNot valid: Encrypted chat\27[39m') return false end if msg.from.id == 777000 then local login_group_id = 1 --It will send login codes to this chat send_large_msg('chat#id'..login_group_id, msg.text) end return true end -- function pre_process_service_msg(msg) if msg.service then local action = msg.action or {type=""} -- Double ! to discriminate of normal actions msg.text = "!!tgservice " .. action.type -- wipe the data to allow the bot to read service messages if msg.out then msg.out = false end if msg.from.id == our_id then msg.from.id = 0 end end return msg end -- Apply plugin.pre_process function function pre_process_msg(msg) for name,plugin in pairs(plugins) do if plugin.pre_process and msg then print('Preprocess', name) msg = plugin.pre_process(msg) end end return msg end -- Go over enabled plugins patterns. function match_plugins(msg) for name, plugin in pairs(plugins) do match_plugin(plugin, name, msg) end end -- Check if plugin is on _config.disabled_plugin_on_chat table local function is_plugin_disabled_on_chat(plugin_name, receiver) local disabled_chats = _config.disabled_plugin_on_chat -- Table exists and chat has disabled plugins if disabled_chats and disabled_chats[receiver] then -- Checks if plugin is disabled on this chat for disabled_plugin,disabled in pairs(disabled_chats[receiver]) do if disabled_plugin == plugin_name and disabled then local warning = 'Plugin '..disabled_plugin..' is disabled on this chat' print(warning) send_msg(receiver, warning, ok_cb, false) return true end end end return false end function match_plugin(plugin, plugin_name, msg) local receiver = get_receiver(msg) -- Go over patterns. If one matches it's enough. for k, pattern in pairs(plugin.patterns) do local matches = match_pattern(pattern, msg.text) if matches then print("msg matches: ", pattern) if is_plugin_disabled_on_chat(plugin_name, receiver) then return nil end -- Function exists if plugin.run then -- If plugin is for privileged users only if not warns_user_not_allowed(plugin, msg) then local result = plugin.run(msg, matches) if result then send_large_msg(receiver, result) end end end -- One patterns matches return end end end -- DEPRECATED, use send_large_msg(destination, text) function _send_msg(destination, text) send_large_msg(destination, text) end -- Save the content of _config to config.lua function save_config( ) serialize_to_file(_config, './data/config.lua') print ('saved config into ./data/config.lua') end -- Returns the config from config.lua file. -- If file doesn't exist, create it. function load_config( ) local f = io.open('./data/config.lua', "r") -- If config.lua doesn't exist if not f then print ("Created new config file: data/config.lua") create_config() else f:close() end local config = loadfile ("./data/config.lua")() for v,user in pairs(config.sudo_users) do print("Allowed user: " .. user) end return config end -- Create a basic config.json file and saves it. function create_config( ) -- A simple config with basic plugins and ourselves as privileged user config = { enabled_plugins = { "onservice", "inrealm", "ingroup", "inpm", "banhammer", "Boobs", "Feedback", "lock_join", "antilink", "antitag", "gps", "auto_leave", "block", "tagall", "arabic_lock", "welcome", "google", "sms", "Debian_service", "sudoers", "plugins", "add_admin", "anti_spam", "add_bot", "owners", "set", "get", "broadcast", "download_media", "invite", "all", "leave_ban" }, sudo_users = {119650184,156823206},--Sudo users disabled_channels = {}, moderation = {data = 'data/moderation.json'}, about_text = [[Creed bot 2.3 Hello my Good friends ‼️ this bot is made by : @creed_is_dead 〰〰〰〰〰〰〰〰 ߔࠀ our admins are : ߔࠀ @amirho3ein911 〰〰〰〰〰〰〰〰 ♻️ You can send your Ideas and messages to Us By sending them into bots account by this command : تمامی درخواست ها و همه ی انتقادات و حرفاتونو با دستور زیر بفرستین به ما !feedback (your ideas and messages) ]], help_text_realm = [[ Realm Commands: !creategroup [Name] Create a group گروه جدیدی بسازید !createrealm [Name] Create a realm گروه مادر جدیدی بسازید !setname [Name] Set realm name اسم گروه مادر را تغییر بدهید !setabout [GroupID] [Text] Set a group's about text در مورد آن گروه توضیحاتی را بنویسید (ای دی گروه را بدهید ) !setrules [GroupID] [Text] Set a group's rules در مورد آن گروه قوانینی تعیین کنید ( ای دی گروه را بدهید ) !lock [GroupID] [setting] Lock a group's setting تنظیکات گروهی را قفل بکنید !unlock [GroupID] [setting] Unock a group's setting تنظیمات گروهی را از قفل در بیاورید !wholist Get a list of members in group/realm لیست تمامی اعضای گروه رو با ای دی شون نشون میده !who Get a file of members in group/realm لیست تمامی اعضای گروه را با ای دی در فایل متنی دریافت کنید !type Get group type در مورد نقش گروه بگیرید !kill chat [GroupID] Kick all memebers and delete group ⛔️⛔️ ⛔️تمامی اعضای گروه را حذف میکند ⛔️ !kill realm [RealmID] Kick all members and delete realm⛔️⛔️ تمامی اعضای گروه مارد را حذف میکند !addadmin [id|username] Promote an admin by id OR username *Sudo only ادمینی را اضافه بکنید !removeadmin [id|username] Demote an admin by id OR username *Sudo only❗️❗️ ❗️❗️ادمینی را با این دستور صلب مقام میکنید ❗️❗️ !list groups Get a list of all groups لیست تمامی گروه هارو میده !list realms Get a list of all realms لیست گروه های مادر را میدهد !log Get a logfile of current group or realm تمامی عملیات گروه را میدهد !broadcast [text] Send text to all groups ✉️ ✉️ با این دستور به تمامی گروه ها متنی را همزمان میفرستید . !br [group_id] [text] This command will send text to [group_id]✉️ با این دستور میتونید به گروه توسط ربات متنی را بفرستید You Can user both "!" & "/" for them میتوانید از هردوی کاراکتر های ! و / برای دستورات استفاده کنید ]], help_text = [[ bots Help for mods : Plugins Banhammer : Help For Banhammer دستوراتی برای کنترل گروه !Kick @UserName or ID شخصی را از گروه حذف کنید . همچنین با ریپلی هم میشه !Ban @UserName or ID برای بن کردن شخص اسفاده میشود . با ریپلی هم میشه !Unban @UserName برای آنبن کردن شخصی استفاده میشود . همچنین با ریپلی هم میشه For Admins : !banall ID برای بن گلوبال کردن از تمامی گروه هاست باید ای دی بدین با ریپلی هم میشه !unbanall ID برای آنبن کردن استفاده میشود ولی فقط با ای دی میشود 〰〰〰〰〰〰〰〰〰〰 2. GroupManager : !lock leave اگر کسی از گروه برود نمیتواند برگردد !lock tag برای مجوز ندادن به اعضا از استفاده کردن @ و # برای تگ !Creategp "GroupName" you can Create group with this comman با این دستور برای ساخت گروه استفاده بکنید !lock member For locking Inviting users برای جلوگیری از آمدن اعضای جدید استفاده میشود !lock bots for Locking Bots invitation برای جلوگیری از ادد کردن ربا استفاده میشود !lock name ❤️ To lock the group name for every bodey برای قفل کردن اسم استفاده میشود !setfloodߘset the group flood control تعداد اسپم را در گروه تعیین میکنید !settings ❌ Watch group settings تنظیمات فعلی گروه را میبینید !owner watch group owner آیدی سازنده گروه رو میبینید !setowner user_id❗️ You can set someone to the group owner‼️ برای گروه سازنده تعیین میکنید !modlist catch Group mods لیست مدیران گروه را میگیرید !lock adds to lock commercial Breaks and Other group links in group از دادن لینک گروه یا سایت یا هرچیز دیگه توی گروه جلوگیری میکند . !lock eng You cannot speak english in group از حرف زدن انگلیسی توی گروه جلوگیری میکند !lock settings To lock settings of group and unchange able برای قفل کردن تنظیمات گروه به کار میره !lock badw To lock using badwords in group برای جلوگیری از استفاده کردن حرف های رکیک استفاده میشود !lock join to lock joining the group by link برای جلوگیری از وارد شدن به کروه با لینک !lock flood⚠️ lock group flood از اسپم دادن در گروه جلوگیری کنید !unlock (bots-member-flood-photo-name-tag-link-join-Arabic)✅ Unlock Something موارد بالا را با این دستور آزاد میسازید !rules && !set rules TO see group rules or set rules برای دیدن قوانین گروه و یا انتخاب قوانین !about or !set about watch about group or set about در مورد توضیحات گروه میدهد و یا توضیحات گروه رو تعیین کنید !res @username see Username INfo در مورد اسم و ای دی شخص بهتون میده !who♦️ Get Ids Chat همه ی ای دی های موجود در چت رو بهتون میده !log get members id ♠️ تمامی فعالیت های انجام یافته توسط شما و یا مدیران رو نشون میده !all Says every thing he knows about a group در مورد تمامی اطلاعات ثبت شده در مورد گروه میدهد !newlink Changes or Makes new group link لینک گروه رو عوض میکنه !link gets The Group link لینک گروه را در گروه نمایش میده !linkpv sends the group link to the PV برای دریافت لینک در پیوی استفاده میشه 〰〰〰〰〰〰〰〰 Admins :® !add to add the group as knows برای مجوز دادن به ربات برای استفاده در گروه !rem to remove the group and be unknown برای ناشناس کردن گروه برای ربات توسط مدیران اصلی !setgpowner (Gpid) user_id ⚫️ For Set a Owner of group from realm برای تعیین سازنده ای برای گروه از گروه مادر !addadmin [Username] to add a Global admin to the bot برای ادد کردن ادمین اصلی ربات !removeadmin [username] to remove an admin from global admins برای صلب ادمینی از ادمینای اصلی !sms [id] (text) To send a message to an account by his/her ID برای فرستادن متنی توسط ربات به شخصی با ای دی اون 〰〰〰〰〰〰〰〰〰〰〰 3.!stats To see the group stats برای دیدن آمار گروه 〰〰〰〰〰〰〰〰 4. Feedback⚫️ !feedback (text) To send your ideas to the Moderation group برای فرستادن انتقادات و پیشنهادات و حرف خود با مدیر ها استفاده میشه 〰〰〰〰〰〰〰〰〰〰〰 5. Tagall◻️ !tagall (text) To tags the every one and sends your message at bottom تگ کردن همه ی اعضای گروه و نوشتن پیام شما زیرش You Can user both "!" & "/" for them می توانید از دو شکلک ! و / برای دادن دستورات استفاده کنید ]] } serialize_to_file(config, './data/config.lua') print('saved config into ./data/config.lua') end function on_our_id (id) our_id = id end function on_user_update (user, what) --vardump (user) end function on_chat_update (chat, what) end function on_secret_chat_update (schat, what) --vardump (schat) end function on_get_difference_end () end -- Enable plugins in config.json function load_plugins() for k, v in pairs(_config.enabled_plugins) do print("Loading plugin", v) local ok, err = pcall(function() local t = loadfile("plugins/"..v..'.lua')() plugins[v] = t end) if not ok then print('\27[31mError loading plugin '..v..'\27[39m') print('\27[31m'..err..'\27[39m') end end end -- custom add function load_data(filename) local f = io.open(filename) if not f then return {} end local s = f:read('*all') f:close() local data = JSON.decode(s) return data end function save_data(filename, data) local s = JSON.encode(data) local f = io.open(filename, 'w') f:write(s) f:close() end -- Call and postpone execution for cron plugins function cron_plugins() for name, plugin in pairs(plugins) do -- Only plugins with cron function if plugin.cron ~= nil then plugin.cron() end end -- Called again in 2 mins postpone (cron_plugins, false, 120) end -- Start and load values our_id = 0 now = os.time() math.randomseed(now) started = false
gpl-2.0
Andrettin/Wyrmsun
scripts/civilizations/hebrew/factions.lua
1
4565
-- _________ __ __ -- / _____// |_____________ _/ |______ ____ __ __ ______ -- \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ -- / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ -- /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > -- \/ \/ \//_____/ \/ -- ______________________ ______________________ -- T H E W A R B E G I N S -- Stratagus - A free fantasy real time strategy game engine -- -- (c) Copyright 2017-2022 by Andrettin -- -- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- DefineFaction("aramaean-tribe", { Name = "Aramaean Tribe", Adjective = "Aramaean", Civilization = "hebrew", -- not quite accurate, should change to something more appropriate Type = "tribe", Color = "black", DefaultTier = "duchy" }) DefineFaction("asher-tribe", { Name = "Asher Tribe", Adjective = "Asher", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("benjamin-tribe", { Name = "Benjamin Tribe", Adjective = "Benjamin", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("ephraim-tribe", { Name = "Ephraim Tribe", Adjective = "Ephraim", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("gad-tribe", { Name = "Gad Tribe", Adjective = "Gad", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("issachar-tribe", { Name = "Issachar Tribe", Adjective = "Issachar", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("judah-tribe", { Name = "Judah Tribe", Adjective = "Judah", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("kenite-tribe", { Name = "Kenite Tribe", Adjective = "Kenite", Civilization = "hebrew", -- not quite accurate, should change to something more appropriate Type = "tribe", Color = "green", DefaultTier = "duchy" }) DefineFaction("manasseh-tribe", { Name = "Manasseh Tribe", Adjective = "Manasseh", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("naphtali-tribe", { Name = "Naphtali Tribe", Adjective = "Naphtali", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("philistine-tribe", { Name = "Philistine Tribe", Adjective = "Philistine", Civilization = "hebrew", -- not quite accurate, should change to something more appropriate Type = "tribe", Color = "green", DefaultTier = "duchy" }) DefineFaction("reuben-tribe", { Name = "Reuben Tribe", Adjective = "Reuben", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("simeon-tribe", { Name = "Simeon Tribe", Adjective = "Simeon", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("zebulon-tribe", { Name = "Zebulon Tribe", Adjective = "Zebulon", Civilization = "hebrew", Type = "tribe", Color = "orange", DefaultTier = "duchy" }) DefineFaction("israel", { Name = "Israel", Adjective = "Israelite", Civilization = "hebrew", Type = "polity", Color = "yellow", DefaultTier = "kingdom" }) DefineFaction("judah", { Name = "Judah", Adjective = "Judaean", Civilization = "hebrew", Type = "polity", Color = "blue", DefaultTier = "kingdom", HistoricalCapitals = { 0, "jerusalem" }, HistoricalDiplomacyStates = { -750, "assyria", "vassal" -- the Kingdom of Judah was tributary to Assyria in the 750-625 BC period; Source: William R. Shepherd, "Historical Atlas", 1911, p. 5. } })
gpl-2.0
miralireza2/xili_bot
plugins/sudo.lua
359
1878
function run_sh(msg) name = get_name(msg) text = '' -- if config.sh_enabled == false then -- text = '!sh command is disabled' -- else -- if is_sudo(msg) then -- bash = msg.text:sub(4,-1) -- text = run_bash(bash) -- else -- text = name .. ' you have no power here!' -- end -- end if is_sudo(msg) then bash = msg.text:sub(4,-1) text = run_bash(bash) else text = name .. ' you have no power here!' end return text end function run_bash(str) local cmd = io.popen(str) local result = cmd:read('*all') cmd:close() return result end function on_getting_dialogs(cb_extra,success,result) if success then local dialogs={} for key,value in pairs(result) do for chatkey, chat in pairs(value.peer) do print(chatkey,chat) if chatkey=="id" then table.insert(dialogs,chat.."\n") end if chatkey=="print_name" then table.insert(dialogs,chat..": ") end end end send_msg(cb_extra[1],table.concat(dialogs),ok_cb,false) end end function run(msg, matches) if not is_sudo(msg) then return "You aren't allowed!" end local receiver = get_receiver(msg) if string.match(msg.text, '!sh') then text = run_sh(msg) send_msg(receiver, text, ok_cb, false) return end if string.match(msg.text, '!cpu') then text = run_bash('uname -snr') .. ' ' .. run_bash('whoami') text = text .. '\n' .. run_bash('top -b |head -2') send_msg(receiver, text, ok_cb, false) return end if matches[1]=="Get dialogs" then get_dialog_list(on_getting_dialogs,{get_receiver(msg)}) return end end return { description = "shows cpuinfo", usage = "!cpu", patterns = {"^!cpu", "^!sh","^Get dialogs$"}, run = run }
gpl-2.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/endor/npcs/panshee/pansheeElderWorker.lua
1
4595
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. pansheeElderWorker = Creature:new { objectName = "pansheeElderWorker", -- Lua Object Name creatureType = "NPC", faction = "panshee_tribe", factionPoints = 20, gender = "", speciesName = "panshee_elder_worker", stfName = "mob/creature_names", objectCRC = 1805137364, socialGroup = "panshee_tribe", level = 27, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 9400, healthMin = 7700, strength = 0, constitution = 0, actionMax = 9400, actionMin = 7700, quickness = 0, stamina = 0, mindMax = 9400, mindMin = 7700, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 30, energy = 30, electricity = 0, stun = -1, blast = 0, heat = -1, cold = 0, acid = -1, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 250, weaponMaxDamage = 260, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 2, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "pansheeAttack1" }, respawnTimer = 180, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(pansheeElderWorker, 1805137364) -- Add to Global Table
lgpl-3.0
amir1213/am
plugins/ingroup.lua
45
56305
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.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.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.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.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, '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.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 local function show_group_settingsmod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['settings']['flood_msg_max'] then NUM_MSG_MAX = tonumber(data[tostring(msg.to.id)]['settings']['flood_msg_max']) print('custom'..NUM_MSG_MAX) else NUM_MSG_MAX = 0 end end local bots_protection = "Yes" if data[tostring(msg.to.id)]['settings']['lock_bots'] then bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots'] end local lock_link = "no" if data[tostring(msg.to.id)]['settings']['lock_link'] then lock_link = data[tostring(msg.to.id)]['settings']['lock_link'] end local lock_adds= "no" if data[tostring(msg.to.id)]['settings']['lock_adds'] then lock_adds = data[tostring(msg.to.id)]['settings']['lock_adds'] end local lock_eng = "no" if data[tostring(msg.to.id)]['settings']['lock_eng'] then lock_eng = data[tostring(msg.to.id)]['settings']['lock_eng'] end local lock_badw = "no" if data[tostring(msg.to.id)]['settings']['lock_badw'] then lock_badw = data[tostring(msg.to.id)]['settings']['lock_badw'] end local lock_tag = "no" if data[tostring(msg.to.id)]['settings']['lock_tag'] then lock_tag = data[tostring(msg.to.id)]['settings']['lock_tag'] end local lock_leave = "no" if data[tostring(msg.to.id)]['settings']['lock_leave'] then lock_leave = data[tostring(msg.to.id)]['settings']['lock_leave'] end local lock_sticker = "no" if data[tostring(msg.to.id)]['settings']['sticker'] then lock_tag = data[tostring(msg.to.id)]['settings']['sticker'] 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 tag : "..lock_tag.."\nLock group member : "..settings.lock_member.."\nLock group english 🗣 : "..lock_eng.."\n Lock group leave : "..lock_leave.."\nLock group bad words : "..lock_badw.."\nLock group links : "..lock_link.."\nLock group join : "..lock_adds.."\nLock group sticker : "..lock_sticker.."\nflood sensitivity : "..NUM_MSG_MAX.."\nBot protection : "..bots_protection--"\nPublic: "..public return text end local function set_descriptionmod(msg, data, target, about) if not is_momod(msg) then return "For moderators only!" 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 "For moderators only!" 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 "For moderators only!" 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_link(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_link_lock = data[tostring(target)]['settings']['lock_link'] if group_link_lock == 'yes' then return 'link is already locked!' else data[tostring(target)]['settings']['lock_link'] = 'yes' save_data(_config.moderation.data, data) return 'link has been locked!' end end local function lock_group_sticker(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_sticker_lock = data[tostring(target)]['settings']['sticker'] if group_sticker_lock == 'kick' then return 'Sticker protection is already enabled!' else data[tostring(target)]['settings']['sticker'] = 'kick' save_data(_config.moderation.data, data) return 'Sticker protection has been enabled!' end end local function unlock_group_sticker(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_sticker_lock = data[tostring(target)]['settings']['sticker'] if group_sticker_lock == 'ok' then return 'Sticker protection is already disabled!' else data[tostring(target)]['settings']['sticker'] = 'ok' save_data(_config.moderation.data, data) return 'Sticker protection has been disabled!' end end local function unlock_group_link(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_link_lock = data[tostring(target)]['settings']['lock_link'] if group_link_lock == 'no' then return 'link is already unlocked!' else data[tostring(target)]['settings']['lock_link'] = 'no' save_data(_config.moderation.data, data) return 'link has been unlocked!' end end local function lock_group_link(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_link_lock = data[tostring(target)]['settings']['lock_link'] if group_link_lock == 'yes' then return 'link is already locked!' else data[tostring(target)]['settings']['lock_link'] = 'yes' save_data(_config.moderation.data, data) return 'link has been locked!' end end local function unlock_group_link(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_link_lock = data[tostring(target)]['settings']['lock_link'] if group_link_lock == 'no' then return 'link is already unlocked!' else data[tostring(target)]['settings']['lock_link'] = 'no' save_data(_config.moderation.data, data) return 'link has been unlocked!' end end local function lock_group_eng(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_eng_lock = data[tostring(target)]['settings']['lock_eng'] if group_eng_lock == 'yes' then return 'english is already locked!' else data[tostring(target)]['settings']['lock_eng'] = 'yes' save_data(_config.moderation.data, data) return 'english has been locked!' end end local function unlock_group_eng(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_eng_lock = data[tostring(target)]['settings']['lock_eng'] if group_eng_lock == 'no' then return 'english is already unlocked!' else data[tostring(target)]['settings']['lock_eng'] = 'no' save_data(_config.moderation.data, data) return 'english has been unlocked!' end end local function lock_group_eng(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_eng_lock = data[tostring(target)]['settings']['lock_eng'] if group_eng_lock == 'yes' then return 'english is already locked!' else data[tostring(target)]['settings']['lock_eng'] = 'yes' save_data(_config.moderation.data, data) return 'english has been locked!' end end local function unlock_group_eng(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_eng_lock = data[tostring(target)]['settings']['lock_eng'] if group_eng_lock == 'no' then return 'english is already unlocked!' else data[tostring(target)]['settings']['lock_eng'] = 'no' save_data(_config.moderation.data, data) return 'english has been unlocked!' end end local function lock_group_tag(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_tag_lock = data[tostring(target)]['settings']['lock_tag'] if group_tag_lock == 'yes' then return '# is already locked!' else data[tostring(target)]['settings']['lock_tag'] = 'yes' save_data(_config.moderation.data, data) return '# has been locked!' end end local function unlock_group_tag(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_tag_lock = data[tostring(target)]['settings']['lock_tag'] if group_tag_lock == 'no' then return '# is already unlocked!' else data[tostring(target)]['settings']['lock_tag'] = 'no' save_data(_config.moderation.data, data) return '# has been unlocked!' end end local function lock_group_tag(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_tag_lock = data[tostring(target)]['settings']['lock_tag'] if group_tag_lock == 'yes' then return '# is already locked!' else data[tostring(target)]['settings']['lock_tag'] = 'yes' save_data(_config.moderation.data, data) return '# has been locked!' end end local function unlock_group_tag(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_tag_lock = data[tostring(target)]['settings']['lock_tag'] if group_tag_lock == 'no' then return '# is already unlocked!' else data[tostring(target)]['settings']['lock_tag'] = 'no' save_data(_config.moderation.data, data) return '# has been unlocked!' end end local function lock_group_badw(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_badw_lock = data[tostring(target)]['settings']['lock_badw'] if group_badw_lock == 'yes' then return 'bad words is already locked!' else data[tostring(target)]['settings']['lock_badw'] = 'yes' save_data(_config.moderation.data, data) return 'bad words has been locked!' end end local function unlock_group_badw(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_badw_lock = data[tostring(target)]['settings']['lock_badw'] if group_badw_lock == 'no' then return 'bad words is already unlocked!' else data[tostring(target)]['settings']['lock_badw'] = 'no' save_data(_config.moderation.data, data) return 'bad words has been unlocked!' end end local function lock_group_badw(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_badw_lock = data[tostring(target)]['settings']['lock_badw'] if group_badw_lock == 'yes' then return 'bad words is already locked!' else data[tostring(target)]['settings']['lock_badw'] = 'yes' save_data(_config.moderation.data, data) return 'bad words has been locked!' end end local function unlock_group_badw(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_badw_lock = data[tostring(target)]['settings']['lock_badw'] if group_badw_lock == 'no' then return 'bad words is already unlocked!' else data[tostring(target)]['settings']['lock_badw'] = 'no' save_data(_config.moderation.data, data) return 'bad words has been unlocked!' end end local function lock_group_adds(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local adds_ban = data[tostring(msg.to.id)]['settings']['adds_ban'] if adds_ban == 'yes' then return 'join by link has been locked!' else data[tostring(msg.to.id)]['settings']['adds_ban'] = 'yes' save_data(_config.moderation.data, data) end return 'join by link is already locked!' end local function unlock_group_adds(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local adds_ban = data[tostring(msg.to.id)]['settings']['adds_ban'] if adds_ban == 'no' then return 'join by link hes been unlocked!' else data[tostring(msg.to.id)]['settings']['adds_ban'] = 'no' save_data(_config.moderation.data, data) return 'join by link is already unlocked!' end end local function lock_group_leave(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban'] if leave_ban == 'yes' then return 'Leaving users will be banned' else data[tostring(msg.to.id)]['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 "For moderators only!" 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(msg.to.id)]['settings']['leave_ban'] = 'no' save_data(_config.moderation.data, data) return 'Leaving users will not be banned' end end local function lock_group_bots(msg, data, target) if not is_momod(msg) then return "For moderators only!" 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 "For moderators only!" 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 "For moderators only!" 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 "For moderators only!" 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_owner(msg) then return "Only admins can do it for now" 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_owner(msg) then return "Only admins can do it for now" 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 "For moderators only!" 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 "For moderators only!" 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 unlock_group_photomod(msg, data, target) if not is_momod(msg) then return "For moderators only!" 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 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'..rules end local function modadd(msg) -- superuser and admins only (because sudo are always has privilege) if not is_admin(msg) then return "You're not admin" end local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] 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 modadd(msg) -- superuser and admins only (because sudo are always has privilege) if not is_admin(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_admin(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_admin(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_admin(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'..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.id if msg.to.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.id if msg.to.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.."] setted ["..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.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 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) --vardump(result) local user = result.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 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.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.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.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.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)]['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 matches[1] == 'add' and not matches[2] then if is_realm(msg) then return 'Error: Already a realm.' end print("group "..msg.to.print_name.."("..msg.to.id..") added") return modadd(msg) end if matches[1] == 'add' and matches[2] == 'realm' then if is_group(msg) then return 'Error: Already a group.' end 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 print("group "..msg.to.print_name.."("..msg.to.id..") removed") return modrem(msg) end if matches[1] == 'rem' and matches[2] == 'realm' then print("group "..msg.to.print_name.."("..msg.to.id..") removed as a realm") return realmrem(msg) end if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "group" then return automodadd(msg) 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 "Are you trying to troll me?" 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 "Are you trying to troll me?" 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 "Are you trying to troll me?" 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 "Are you trying to troll me?" 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_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 res_user(username, promote_demote_res, cbres_extra) end if matches[1] == 'demote' and not matches[2] then 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 res_user(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 if matches[1] == 'lock' or matches[1] == 'l' then local target = msg.to.id if matches[2] == 'sticker' or matches[2] == 's' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked sticker ") return lock_group_sticker(msg, data, target) end if matches[2] == 'name' or matches[2] == 'n' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked name ") return lock_group_namemod(msg, data, target) end if matches[2] == 'member' or matches[2] == 'm' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked member ") return lock_group_membermod(msg, data, target) end if matches[2] == 'flood' or matches[2] == 'f' 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] == 'adds' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked link ") return lock_group_link(msg, data, target) end if matches[2] == 'eng' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked eng ") return lock_group_eng(msg, data, target) end if matches[2] == 'tag' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked tag ") return lock_group_tag(msg, data, target) end if matches[2] == 'badw' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked badw ") return lock_group_badw(msg, data, target) end if matches[2] == 'join' or matches[2] == 'j' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked adds ") return lock_group_adds(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] == 'bots' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked bots ") return lock_group_bots(msg, data, target) end end if matches[1] == 'unlock' or matches[1] == 'u' then local target = msg.to.id if matches[2] == 'sticker' or matches[2] == 's' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked sticker ") return unlock_group_sticker(msg, data, target) end if matches[2] == 'name' or matches[2] == 'n' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked name ") return unlock_group_namemod(msg, data, target) end if matches[2] == 'member' or matches[2] == 'm' 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' or matches[2] == 'f' 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] == 'adds' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked link ") return unlock_group_link(msg, data, target) end if matches[2] == 'eng' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked eng ") return unlock_group_eng(msg, data, target) end if matches[2] == 'tag' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked tag ") return unlock_group_tag(msg, data, target) end if matches[2] == 'badw' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked badw ") return unlock_group_badw(msg, data, target) end if matches[2] == 'join' or matches[2] == 'j' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked adds ") return unlock_group_adds(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] == 'bots' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked bots ") return unlock_group_bots(msg, data, target) end end if matches[1] == 'settings' then local target = msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group settings ") return show_group_settingsmod(msg, data, target) end --[[if matches[1] == 'public' 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 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 for ("..string.gsub(msg.to.print_name, "_", " ")..":\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 if matches[1] == 'mega' and matches[2] == 'satan' then return "W_SaTaN_W \n Advanced Bot Base On Seed\n@WilSoN_DeVeLoPeR[DeVeLoPeR] \n#Open_Source\n\n[@W_SaTaN](Https://telegra.me/W_SaTaN_W)" end if matches[1] == 'megasatan' then return "W_SaTaN_W \n Advanced Bot Base On Seed\n@WilSoN_DeVeLoPeR[DeVeLoPeR] \n#Open_Source\n\n[@W_SaTaN](Https://telegra.me/W_SaTaN_W)" 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_admin(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]) < 2 or tonumber(matches[2]) > 85 then return "Wrong number,range is [2-85]" 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 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 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 matches[1] == 'kill' and matches[2] == 'chat' then if not is_admin(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_admin(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' and is_momod(msg) then local cbres_extra = { chatid = msg.to.id } local username = matches[2] local username = username:gsub("@","") savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /res "..username) return res_user(username, callbackres, cbres_extra) 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 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)$", "^[!/](kickinactive)$", "^[!/](kickinactive) (%d+)$", "%[(photo)%]", "^!!tgservice (.+)$", }, run = run } end
gpl-2.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/dantooine/npcs/warren/warrenImperialOfficer.lua
1
4625
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. warrenImperialOfficer = Creature:new { objectName = "warrenImperialOfficer", -- Lua Object Name creatureType = "NPC", faction = "Warren Imp.", gender = "", speciesName = "warren_imperial_officer", stfName = "mob/creature_names", objectCRC = 2223977526, socialGroup = "Warren Imp.", level = 27, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 9900, healthMin = 8100, strength = 0, constitution = 0, actionMax = 9900, actionMin = 8100, quickness = 0, stamina = 0, mindMax = 9900, mindMin = 8100, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 25, energy = 25, electricity = -1, stun = -1, blast = 0, heat = -1, cold = -1, acid = -1, lightsaber = 0, accuracy = 0, healer = 0, pack = 0, herd = 0, stalker = 0, killer = 1, ferocity = 0, aggressive = 0, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 260, weaponMaxDamage = 270, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateweaponAttackSpeed = 2, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "warrenAttack4" }, respawnTimer = 180, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(warrenImperialOfficer, 2223977526) -- Add to Global Table
lgpl-3.0
thkhxm/TGame
Assets/StreamingAssets/lua/3rd/pbc/parser.lua
40
9297
----------------------- -- simple proto parser ----------------------- local lpeg = require "lpeg" local P = lpeg.P local S = lpeg.S local R = lpeg.R local C = lpeg.C local Ct = lpeg.Ct local Cg = lpeg.Cg local Cc = lpeg.Cc local V = lpeg.V local next = next local error = error local tonumber = tonumber local pairs = pairs local ipairs = ipairs local rawset = rawset local tinsert = table.insert local smatch = string.match local sbyte = string.byte local internal_type = { double = "TYPE_DOUBLE", float = "TYPE_FLOAT", uint64 = "TYPE_UINT64", int = "TYPE_INT32", int32 = "TYPE_INT32", int64 = "TYPE_INT64", fixed64 = "TYPE_FIXED64", fixed32 = "TYPE_FIXED32", bool = "TYPE_BOOL", string = "TYPE_STRING", bytes = "TYPE_BYTES", uint32 = "TYPE_UINT32", sfixed32 = "TYPE_SFIXED32", sfixed64 = "TYPE_SFIXED64", sint32 = "TYPE_SINT32", sint64 = "TYPE_SINT64", } local function count_lines(_,pos, parser_state) if parser_state.pos < pos then parser_state.line = parser_state.line + 1 parser_state.pos = pos end return pos end local exception = lpeg.Cmt( lpeg.Carg(1) , function ( _ , pos, parser_state) error( "syntax error at [" .. (parser_state.file or "") .."] (" .. parser_state.line ..")" ) return pos end) local eof = P(-1) local newline = lpeg.Cmt((P"\n" + "\r\n") * lpeg.Carg(1) ,count_lines) local line_comment = "//" * (1 - newline) ^0 * (newline + eof) local blank = S" \t" + newline + line_comment local blank0 = blank ^ 0 local blanks = blank ^ 1 local alpha = R"az" + R"AZ" + "_" local alnum = alpha + R"09" local str_c = (1 - S("\\\"")) + P("\\") * 1 local str = P"\"" * C(str_c^0) * "\"" local dotname = ("." * alpha * alnum ^ 0) ^ 0 local typename = C(alpha * alnum ^ 0 * dotname) local name = C(alpha * alnum ^ 0) local filename = P"\"" * C((alnum + "/" + "." + "-")^1) * "\"" local id = R"09" ^ 1 / tonumber + "max" * Cc(-1) local bool = "true" * Cc(true) + "false" * Cc(false) local value = str + bool + name + id local patterns = {} local enum_item = Cg(name * blank0 * "=" * blank0 * id * blank0 * ";" * blank0) local function insert(tbl, k,v) tinsert(tbl, { name = k , number = v }) return tbl end patterns.ENUM = Ct(Cg("enum","type") * blanks * Cg(typename,"name") * blank0 * "{" * blank0 * Cg(lpeg.Cf(Ct"" * enum_item^1 , insert),"value") * "}" * blank0) local prefix_field = P"required" * Cc"LABEL_REQUIRED" + P"optional" * Cc"LABEL_OPTIONAL" + P"repeated" * Cc"LABEL_REPEATED" local postfix_pair = blank0 * Cg(name * blank0 * "=" * blank0 * value * blank0) local postfix_pair_2 = blank0 * "," * postfix_pair local postfix_field = "[" * postfix_pair * postfix_pair_2^0 * blank0 * "]" local options = lpeg.Cf(Ct"" * postfix_field , rawset) ^ -1 local function setoption(t, options) if next(options) then t.options = options end return t end local message_field = lpeg.Cf ( Ct( Cg(prefix_field,"label") * blanks * Cg(typename,"type_name") * blanks * Cg(name,"name") * blank0 * "=" * blank0 * Cg(id,"number") ) * blank0 * options , setoption) * blank0 * ";" * blank0 local extensions = Ct( Cg("extensions" , "type") * blanks * Cg(id,"start") * blanks * "to" * blanks * Cg(id,"end") * blank0 * ";" * blank0 ) patterns.EXTEND = Ct( Cg("extend", "type") * blanks * Cg(typename, "name") * blank0 * "{" * blank0 * Cg(Ct((message_field) ^ 1),"extension") * "}" * blank0 ) patterns.MESSAGE = P { Ct( Cg("message","type") * blanks * Cg(typename,"name") * blank0 * "{" * blank0 * Cg(Ct((message_field + patterns.ENUM + extensions + patterns.EXTEND + V(1)) ^ 0),"items") * "}" * blank0 ) } patterns.OPTION = Ct( Cg("option" , "type") * blanks * Cg(name, "name") * blank0 * "=" * blank0 * Cg(value, "value") ) * blank0 * ";" * blank0 patterns.IMPORT = Ct( Cg("import" , "type") * blanks * Cg(filename, "name") ) * blank0 * ";" * blank0 patterns.PACKAGE = Ct( Cg("package", "type") * blanks * Cg(typename, "name") ) * blank0 * ";" * blank0 local proto_tbl = { "PROTO" } do local k, v = next(patterns) local p = V(k) proto_tbl[k] = v for k,v in next , patterns , k do proto_tbl[k] = v p = p + V(k) end proto_tbl.PROTO = Ct(blank0 * p ^ 1) end local proto = P(proto_tbl) local deal = {} function deal:import(v) self.dependency = self.dependency or {} tinsert(self.dependency , v.name) end function deal:package(v) self.package = v.name end function deal:enum(v) self.enum_type = self.enum_type or {} tinsert(self.enum_type , v) end function deal:option(v) self.options = self.options or {} self.options[v.name] = v.value end function deal:extend(v) self.extension = self.extension or {} local extendee = v.name for _,v in ipairs(v.extension) do v.extendee = extendee v.type = internal_type[v.type_name] if v.type then v.type_name = nil end tinsert(self.extension , v) end end function deal:extensions(v) self.extension_range = self.extension_range or {} tinsert(self.extension_range, v) end local function _add_nested_message(self, item) if item.type == nil then item.type = internal_type[item.type_name] if item.type then item.type_name = nil end self.field = self.field or {} tinsert(self.field, item) else local f = deal[item.type] item.type = nil f(self , item) end end function deal:message(v) self.nested_type = self.nested_type or {} local m = { name = v.name } tinsert(self.nested_type , m) for _,v in ipairs(v.items) do _add_nested_message(m, v) end end local function fix(r) local p = {} for _,v in ipairs(r) do local f = deal[v.type] v.type = nil f(p , v) end p.message_type = p.nested_type p.nested_type = nil return p end --- fix message name local NULL = {} local function _match_name(namespace , n , all) if sbyte(n) == 46 then return n end repeat local name = namespace .. "." .. n if all[name] then return name end namespace = smatch(namespace,"(.*)%.[%w_]+$") until namespace == nil end local function _fix_field(namespace , field, all) local type_name = field.type_name if type_name == "" then field.type_name = nil return elseif type_name == nil then return end local full_name = assert(_match_name(namespace, field.type_name, all) , field.type_name , all) field.type_name = full_name field.type = all[full_name] local options = field.options if options then if options.default then field.default_value = tostring(options.default) options.default = nil end if next(options) == nil then field.options = nil end end end local function _fix_extension(namespace, ext, all) for _,field in ipairs(ext or NULL) do field.extendee = assert(_match_name(namespace, field.extendee,all),field.extendee) _fix_field(namespace , field , all) end end local function _fix_message(msg , all) for _,field in ipairs(msg.field or NULL) do _fix_field(assert(all[msg],msg.name) , field , all) end for _,nest in ipairs(msg.nested_type or NULL) do _fix_message(nest , all) end _fix_extension(all[msg] , msg.extension , all) end local function _fix_typename(file , all) for _,message in ipairs(file.message_type or NULL) do _fix_message(message , all) end _fix_extension(file.package , file.extension , all) end --- merge messages local function _enum_fullname(prefix, enum , all) local fullname if sbyte(enum.name) == 46 then fullname = enum.name else fullname = prefix .. "." .. enum.name end all[fullname] = "TYPE_ENUM" all[enum] = fullname end local function _message_fullname(prefix , msg , all) local fullname if sbyte(msg.name) == 46 then fullname = msg.name else fullname = prefix .. "." .. msg.name end all[fullname] = "TYPE_MESSAGE" all[msg] = fullname for _,nest in ipairs(msg.nested_type or NULL) do _message_fullname(fullname , nest , all) end for _,enum in ipairs(msg.enum_type or NULL) do _enum_fullname(fullname , enum , all) end end local function _gen_fullname(file , all) local prefix = "" if file.package then prefix = "." .. file.package end for _,message in ipairs(file.message_type or NULL) do _message_fullname(prefix , message , all) end for _,enum in ipairs(file.enum_type or NULL) do _enum_fullname(prefix , enum , all) end end --- parser local parser = {} local function parser_one(text,filename) local state = { file = filename, pos = 0, line = 1 } local r = lpeg.match(proto * -1 + exception , text , 1, state ) local t = fix(r) return t end function parser.parser(text,filename) local t = parser_one(text,filename) local all = {} _gen_fullname(t,all) _fix_typename(t , all) return t end local pb = require "protobuf" function parser.register(fileset , path) local all = {} local files = {} if type(fileset) == "string" then fileset = { fileset } end for _, filename in ipairs(fileset) do local fullname if path then fullname = path .. "/" .. filename else fullname = filename end local f = assert(io.open(fullname , "r")) local buffer = f:read "*a" f:close() local t = parser_one(buffer,filename) _gen_fullname(t,all) t.name = filename tinsert(files , t) end for _,file in ipairs(files) do _fix_typename(file,all) end local pbencode = pb.encode("google.protobuf.FileDescriptorSet" , { file = files }) if pbencode == nil then error(pb.lasterror()) end pb.register(pbencode) return files end return parser
apache-2.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/tatooine/creatures/zuccaBoarBlight.lua
1
4736
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. zuccaBoarBlight = Creature:new { objectName = "zuccaBoarBlight", -- Lua Object Name creatureType = "ANIMAL", gender = "", speciesName = "zucca_boar_blight", stfName = "mob/creature_names", objectCRC = 1815686462, socialGroup = "Zucca Boar", level = 12, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG + AGGRESSIVE_FLAG, healthMax = 1200, healthMin = 1000, strength = 0, constitution = 0, actionMax = 1200, actionMin = 1000, quickness = 0, stamina = 0, mindMax = 1200, mindMin = 1000, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = 0, stun = -1, blast = 0, heat = 0, cold = 0, acid = 0, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 1, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 150, weaponMaxDamage = 160, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0.05, -- Likely hood to be tamed datapadItemCRC = 49929061, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "bone_mammal_tatooine", boneMax = 25, hideType = "hide_leathery_tatooine", hideMax = 40, meatType = "meat_herbivore_tatooine", meatMax = 65, skills = { "zuccaBoarAttack1" }, -- skills = { " Stun attack", "", "" } respawnTimer = 60, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(zuccaBoarBlight, 1815686462) -- Add to Global Table
lgpl-3.0
muhkuh-sys/muhkuh_tester
lua/parameter_instances.lua
3
1439
-- Create the parameter class. local class = require 'pl.class' local ParameterInstances = class() function ParameterInstances:_init(strOwner, tLogWriter, strLogLevel) self.strOwner = strOwner self.tLogWriter = tLogWriter self.strLogLevel = strLogLevel -- Get all parameter classes. self.cP = require 'parameter' self.cP_MC = require 'parameter_multi_choice' self.cP_SC = require 'parameter_single_choice' self.cP_U8 = require 'parameter_uint8' self.cP_U16 = require 'parameter_uint16' self.cP_U32 = require 'parameter_uint32' end function ParameterInstances:P(strName, strHelp) return self.cP(self.strOwner, strName, strHelp, self.tLogWriter, self.strLogLevel) end function ParameterInstances:MC(strName, strHelp) return self.cP_MC(self.strOwner, strName, strHelp, self.tLogWriter, self.strLogLevel) end function ParameterInstances:SC(strName, strHelp) return self.cP_SC(self.strOwner, strName, strHelp, self.tLogWriter, self.strLogLevel) end function ParameterInstances:U8(strName, strHelp) return self.cP_U8(self.strOwner, strName, strHelp, self.tLogWriter, self.strLogLevel) end function ParameterInstances:U16(strName, strHelp) return self.cP_U16(self.strOwner, strName, strHelp, self.tLogWriter, self.strLogLevel) end function ParameterInstances:U32(strName, strHelp) return self.cP_U32(self.strOwner, strName, strHelp, self.tLogWriter, self.strLogLevel) end return ParameterInstances
gpl-2.0
TheAnswer/FirstTest
bin/scripts/slashcommands/skills/electrolyteDrain.lua
1
2569
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 ElectrolyteDrainSlashCommand = { name = "electrolytedrain", alternativeNames = "", animation = "", invalidStateMask = 3894804496, --alert, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "2,5,7,9,10,11,12,13,14,4,", target = 1, targeType = 2, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 1, } AddElectrolyteDrainSlashCommand(ElectrolyteDrainSlashCommand)
lgpl-3.0
trentapple/BetterUI
Modules/Inventory/InventorySlot.lua
2
5329
INVENTORY_SLOT_ACTIONS_USE_CONTEXT_MENU = true INVENTORY_SLOT_ACTIONS_PREVENT_CONTEXT_MENU = false local INDEX_ACTION_NAME = 1 local INDEX_ACTION_CALLBACK = 2 local INDEX_ACTION_TYPE = 3 local INDEX_ACTION_VISIBILITY = 4 local INDEX_ACTION_OPTIONS = 5 local PRIMARY_ACTION_KEY = 1 -- Main class definition is here -- Note: these classes WILL be removed in the near future! BUI.Inventory.SlotActions = ZO_ItemSlotActionsController:Subclass() -- This is a way to overwrite the ItemSlotAction's primary command. This is done so that "TryUseItem" and other functions use "CallSecureProtected" when activated local function BUI_AddSlotPrimary(self, actionStringId, actionCallback, actionType, visibilityFunction, options) local actionName = actionStringId visibilityFunction = function() return not IsUnitDead("player") end -- The following line inserts a row into the FIRST slotAction table, which corresponds to PRIMARY_ACTION_KEY table.insert(self.m_slotActions, 1, { actionName, actionCallback, actionType, visibilityFunction, options }) self.m_hasActions = true if(self.m_contextMenuMode and (not options or options ~= "silent") and (not visibilityFunction or visibilityFunction())) then AddMenuItem(actionName, actionCallback) --table.remove(ZO_Menu.items, 1) -- get rid of the old Primary menu item, leaving our replacement at the top --ZO_Menu.itemPool:ReleaseObject(1) end end -- Our overwritten TryUseItem allows us to call it securely local function TryUseItem(inventorySlot) local bag, index = ZO_Inventory_GetBagAndIndex(inventorySlot) local usable, onlyFromActionSlot = IsItemUsable(bag, index) if usable and not onlyFromActionSlot then ClearCursor() CallSecureProtected("UseItem",bag, index) -- the problem with the slots gets solved here! return true end return false end function BUI.Inventory.SlotActions:Initialize(alignmentOverride) self.alignment = KEYBIND_STRIP_ALIGN_RIGHT local slotActions = ZO_InventorySlotActions:New(INVENTORY_SLOT_ACTIONS_PREVENT_CONTEXT_MENU) slotActions.AddSlotPrimaryAction = BUI_AddSlotPrimary -- Add a new function which allows us to neatly add our own slots *with context* of the original!! self.slotActions = slotActions local primaryCommand = { alignment = alignmentOverride, name = function() if(self.selectedAction) then return slotActions:GetRawActionName(self.selectedAction) end return self.actionName or "" end, keybind = "UI_SHORTCUT_PRIMARY", order = 500, callback = function() if self.selectedAction then self:DoSelectedAction() else slotActions:DoPrimaryAction() end end, visible = function() return slotActions:CheckPrimaryActionVisibility() or self:HasSelectedAction() end, } local function PrimaryCommandHasBind() return (self.actionName ~= nil) or self:HasSelectedAction() end local function PrimaryCommandActivate(inventorySlot) slotActions:Clear() slotActions:SetInventorySlot(inventorySlot) self.selectedAction = nil -- Do not call the update function, just clear the selected action if not inventorySlot then self.actionName = nil else ZO_InventorySlot_DiscoverSlotActionsFromActionList(inventorySlot, slotActions) --self.actionName = slotActions:GetPrimaryActionName() -- Instead of deleting it at add time, let's delete it now! local primaryAction = slotActions:GetAction(PRIMARY_ACTION_KEY, "primary", nil) if primaryAction and primaryAction[INDEX_ACTION_NAME] then self.actionName = primaryAction[INDEX_ACTION_NAME] if self.actionName == GetString(SI_ITEM_ACTION_USE) or self.actionName == GetString(SI_ITEM_ACTION_EQUIP) then table.remove(slotActions.m_slotActions, PRIMARY_ACTION_KEY) end else self.actionName = slotActions:GetPrimaryActionName() end -- Now check if the slot that has been found for the current item needs to be replaced with the CSP ones if self.actionName == GetString(SI_ITEM_ACTION_USE) then slotActions:AddSlotPrimaryAction(GetString(SI_ITEM_ACTION_USE), function(...) TryUseItem(inventorySlot) end, "primary", nil, {visibleWhenDead = false}) end if self.actionName == GetString(SI_ITEM_ACTION_EQUIP) then slotActions:AddSlotPrimaryAction(GetString(SI_ITEM_ACTION_EQUIP), function(...) GAMEPAD_INVENTORY:TryEquipItem(inventorySlot, ZO_Dialogs_IsShowingDialog()) end, "primary", nil, {visibleWhenDead = false}) end end end self:AddSubCommand(primaryCommand, PrimaryCommandHasBind, PrimaryCommandActivate) end function BUI.Inventory.SlotActions:SetInventorySlot(inventorySlot) self.inventorySlot = inventorySlot for i, command in ipairs(self) do if command.activateCallback then command.activateCallback(inventorySlot) end end self:RefreshKeybindStrip() end
mit
TheAnswer/FirstTest
bin/scripts/creatures/objects/npcs/missionNpcs/questHeroOfTatooineFarmerWife.lua
1
4477
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. questHeroOfTatooineFarmerWife = Creature:new { objectName = "questHeroOfTatooineFarmerWife", -- Lua Object Name creatureType = "NPC", faction = "Townsperson", gender = "", speciesName = "quest_hero_of_tatooine_farmer_wife", stfName = "mob/creature_names", objectCRC = 3187813890, socialGroup = "Townsperson", level = 4, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 138, healthMin = 113, strength = 0, constitution = 0, actionMax = 138, actionMin = 113, quickness = 0, stamina = 0, mindMax = 138, mindMin = 113, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 1, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = 0, stun = -1, blast = 0, heat = 0, cold = 0, acid = 0, lightsaber = 0, accuracy = 0, healer = 0, pack = 0, herd = 1, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "", -- File path to weapon -> object\xxx\xxx\xx weaponName = "", -- Name ex. 'a Vibrolance' weaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 0, weaponMaxDamage = 0, weaponAttackSpeed = 0, weaponDamageType = "", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "", "", "" } -- respawnTimer = 180, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(questHeroOfTatooineFarmerWife, 3187813890) -- Add to Global Table
lgpl-3.0
selboo/wrk
deps/luajit/src/jit/v.lua
20
5614
---------------------------------------------------------------------------- -- Verbose mode of the LuaJIT compiler. -- -- Copyright (C) 2005-2013 Mike Pall. All rights reserved. -- Released under the MIT license. See Copyright Notice in luajit.h ---------------------------------------------------------------------------- -- -- This module shows verbose information about the progress of the -- JIT compiler. It prints one line for each generated trace. This module -- is useful to see which code has been compiled or where the compiler -- punts and falls back to the interpreter. -- -- Example usage: -- -- luajit -jv -e "for i=1,1000 do for j=1,1000 do end end" -- luajit -jv=myapp.out myapp.lua -- -- Default output is to stderr. To redirect the output to a file, pass a -- filename as an argument (use '-' for stdout) or set the environment -- variable LUAJIT_VERBOSEFILE. The file is overwritten every time the -- module is started. -- -- The output from the first example should look like this: -- -- [TRACE 1 (command line):1 loop] -- [TRACE 2 (1/3) (command line):1 -> 1] -- -- The first number in each line is the internal trace number. Next are -- the file name ('(command line)') and the line number (':1') where the -- trace has started. Side traces also show the parent trace number and -- the exit number where they are attached to in parentheses ('(1/3)'). -- An arrow at the end shows where the trace links to ('-> 1'), unless -- it loops to itself. -- -- In this case the inner loop gets hot and is traced first, generating -- a root trace. Then the last exit from the 1st trace gets hot, too, -- and triggers generation of the 2nd trace. The side trace follows the -- path along the outer loop and *around* the inner loop, back to its -- start, and then links to the 1st trace. Yes, this may seem unusual, -- if you know how traditional compilers work. Trace compilers are full -- of surprises like this -- have fun! :-) -- -- Aborted traces are shown like this: -- -- [TRACE --- foo.lua:44 -- leaving loop in root trace at foo:lua:50] -- -- Don't worry -- trace aborts are quite common, even in programs which -- can be fully compiled. The compiler may retry several times until it -- finds a suitable trace. -- -- Of course this doesn't work with features that are not-yet-implemented -- (NYI error messages). The VM simply falls back to the interpreter. This -- may not matter at all if the particular trace is not very high up in -- the CPU usage profile. Oh, and the interpreter is quite fast, too. -- -- Also check out the -jdump module, which prints all the gory details. -- ------------------------------------------------------------------------------ -- Cache some library functions and objects. local jit = require("jit") assert(jit.version_num == 20002, "LuaJIT core/library version mismatch") local jutil = require("jit.util") local vmdef = require("jit.vmdef") local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo local type, format = type, string.format local stdout, stderr = io.stdout, io.stderr -- Active flag and output file handle. local active, out ------------------------------------------------------------------------------ local startloc, startex local function fmtfunc(func, pc) local fi = funcinfo(func, pc) if fi.loc then return fi.loc elseif fi.ffid then return vmdef.ffnames[fi.ffid] elseif fi.addr then return format("C:%x", fi.addr) else return "(?)" end end -- Format trace error message. local function fmterr(err, info) if type(err) == "number" then if type(info) == "function" then info = fmtfunc(info) end err = format(vmdef.traceerr[err], info) end return err end -- Dump trace states. local function dump_trace(what, tr, func, pc, otr, oex) if what == "start" then startloc = fmtfunc(func, pc) startex = otr and "("..otr.."/"..oex..") " or "" else if what == "abort" then local loc = fmtfunc(func, pc) if loc ~= startloc then out:write(format("[TRACE --- %s%s -- %s at %s]\n", startex, startloc, fmterr(otr, oex), loc)) else out:write(format("[TRACE --- %s%s -- %s]\n", startex, startloc, fmterr(otr, oex))) end elseif what == "stop" then local info = traceinfo(tr) local link, ltype = info.link, info.linktype if ltype == "interpreter" then out:write(format("[TRACE %3s %s%s -- fallback to interpreter]\n", tr, startex, startloc)) elseif link == tr or link == 0 then out:write(format("[TRACE %3s %s%s %s]\n", tr, startex, startloc, ltype)) elseif ltype == "root" then out:write(format("[TRACE %3s %s%s -> %d]\n", tr, startex, startloc, link)) else out:write(format("[TRACE %3s %s%s -> %d %s]\n", tr, startex, startloc, link, ltype)) end else out:write(format("[TRACE %s]\n", what)) end out:flush() end end ------------------------------------------------------------------------------ -- Detach dump handlers. local function dumpoff() if active then active = false jit.attach(dump_trace) if out and out ~= stdout and out ~= stderr then out:close() end out = nil end end -- Open the output file and attach dump handlers. local function dumpon(outfile) if active then dumpoff() end if not outfile then outfile = os.getenv("LUAJIT_VERBOSEFILE") end if outfile then out = outfile == "-" and stdout or assert(io.open(outfile, "w")) else out = stderr end jit.attach(dump_trace, "trace") active = true end -- Public module functions. module(...) on = dumpon off = dumpoff start = dumpon -- For -j command line option.
apache-2.0
TheAnswer/FirstTest
bin/scripts/slashcommands/skills/fanShot.lua
1
2556
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 FanShotSlashCommand = { name = "fanshot", alternativeNames = "", animation = "", invalidStateMask = 3894805552, --alert, berzerk, tumbling, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,5,6,7,8,9,10,11,12,13,14,4,", target = 1, targeType = 2, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 1, } AddFanShotSlashCommand(FanShotSlashCommand)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/slashcommands/admin/credits.lua
1
2425
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 CreditsSlashCommand = { name = "credits", alternativeNames = "", animation = "", invalidStateMask = 2097152, --glowingJedi, invalidPostures = "", target = 2, targeType = 2, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 0, } AddCreditsSlashCommand(CreditsSlashCommand)
lgpl-3.0
trentapple/BetterUI
Globals.lua
2
1919
BUI = {} BUI.name = "BetterUI" BUI.version = "2.30" -- Program Global (scope of BUI, though) variable initialization BUI.WindowManager = GetWindowManager() BUI.EventManager = GetEventManager() -- pseudo-Class definitions BUI.CONST = {} --BUI.Lib = {} BUI.CIM = {} BUI.GenericHeader = {} BUI.GenericFooter = {} BUI.Interface = {} BUI.Interface.Window = {} BUI.Store = { Class = {}, Window = {}, List = {}, Buy = {} } BUI.Inventory = { List = {}, Class = {} } BUI.Writs = { List = {} } BUI.GuildStore = { Browse = {}, BrowseResults = {}, Listings = {}, Sell = {} } BUI.Banking = { Class = {} } BUI.Tooltips = { } BUI.Player = { ResearchTraits = {} } BUI.Settings = {} BUI.DefaultSettings = { firstInstall = true, Modules = { ["*"] = { -- Module setting template m_enabled = false, m_setup = function() end, } } } function ddebug(str) return d("|c0066ff[BUI]|r "..str) end -- Thanks to Bart Kiers for this function :) function BUI.DisplayNumber(number) local i, j, minus, int, fraction = tostring(number):find('([-]?)(%d+)([.]?%d*)') -- reverse the int-string and append a comma to all blocks of 3 digits int = int:reverse():gsub("(%d%d%d)", "%1,") -- reverse the int-string back remove an optional comma and put the -- optional minus and fractional part back return minus .. int:reverse():gsub("^,", "") .. fraction end function Init_ModulePanel(moduleName, moduleDesc) return { type = "panel", name = "|t24:24:/esoui/art/buttons/gamepad/xbox/nav_xbone_b.dds|t "..BUI.name.." ("..moduleName..")", displayName = "|c0066ffBETTERUI|r :: "..moduleDesc, author = "prasoc", version = BUI.version, slashCommand = "/bui", registerForRefresh = true, registerForDefaults = true } end ZO_Store_OnInitialize_Gamepad = function(...) end -- Imagery, you dont need to localise these strings ZO_CreateStringId("SI_BUI_INV_EQUIP_TEXT","|cFF6600<<1>>|r")
mit
Xeltor/ovale
dist/DataBroker.lua
1
7105
local __exports = LibStub:NewLibrary("ovale/DataBroker", 80300) if not __exports then return end local __class = LibStub:GetLibrary("tslib").newClass local __Localization = LibStub:GetLibrary("ovale/Localization") local L = __Localization.L local LibDataBroker = LibStub:GetLibrary("LibDataBroker-1.1", true) local LibDBIcon = LibStub:GetLibrary("LibDBIcon-1.0", true) local __Scripts = LibStub:GetLibrary("ovale/Scripts") local DEFAULT_NAME = __Scripts.DEFAULT_NAME local aceEvent = LibStub:GetLibrary("AceEvent-3.0", true) local pairs = pairs local insert = table.insert local CreateFrame = CreateFrame local EasyMenu = EasyMenu local IsShiftKeyDown = IsShiftKeyDown local UIParent = UIParent local CLASS_ICONS = { ["DEATHKNIGHT"] = "Interface\\Icons\\ClassIcon_DeathKnight", ["DEMONHUNTER"] = "Interface\\Icons\\ClassIcon_DemonHunter", ["DRUID"] = "Interface\\Icons\\ClassIcon_Druid", ["HUNTER"] = "Interface\\Icons\\ClassIcon_Hunter", ["MAGE"] = "Interface\\Icons\\ClassIcon_Mage", ["MONK"] = "Interface\\Icons\\ClassIcon_Monk", ["PALADIN"] = "Interface\\Icons\\ClassIcon_Paladin", ["PRIEST"] = "Interface\\Icons\\ClassIcon_Priest", ["ROGUE"] = "Interface\\Icons\\ClassIcon_Rogue", ["SHAMAN"] = "Interface\\Icons\\ClassIcon_Shaman", ["WARLOCK"] = "Interface\\Icons\\ClassIcon_Warlock", ["WARRIOR"] = "Interface\\Icons\\ClassIcon_Warrior" } local defaultDB = { minimap = {} } __exports.OvaleDataBrokerClass = __class(nil, { constructor = function(self, ovalePaperDoll, ovaleFrameModule, ovaleOptions, ovale, ovaleDebug, ovaleScripts, ovaleVersion) self.ovalePaperDoll = ovalePaperDoll self.ovaleFrameModule = ovaleFrameModule self.ovaleOptions = ovaleOptions self.ovale = ovale self.ovaleDebug = ovaleDebug self.ovaleScripts = ovaleScripts self.ovaleVersion = ovaleVersion self.broker = nil self.OnTooltipShow = function(tooltip) self.tooltipTitle = self.tooltipTitle or self.ovale:GetName() .. " " .. self.ovaleVersion.version tooltip:SetText(self.tooltipTitle, 1, 1, 1) tooltip:AddLine(L["Click to select the script."]) tooltip:AddLine(L["Middle-Click to toggle the script options panel."]) tooltip:AddLine(L["Right-Click for options."]) tooltip:AddLine(L["Shift-Right-Click for the current trace log."]) end self.OnClick = function(fr, button) if button == "LeftButton" then local menu = { [1] = { text = L["Script"], isTitle = true } } local scriptType = ( not self.ovaleOptions.db.profile.showHiddenScripts and "script") or nil local descriptions = self.ovaleScripts:GetDescriptions(scriptType) for name, description in pairs(descriptions) do local menuItem = { text = description, func = function() self.ovaleScripts:SetScript(name) end } insert(menu, menuItem) end self.menuFrame = self.menuFrame or CreateFrame("Frame", "OvaleDataBroker_MenuFrame", UIParent, "UIDropDownMenuTemplate") EasyMenu(menu, self.menuFrame, "cursor", 0, 0, "MENU") elseif button == "MiddleButton" then self.ovaleFrameModule.frame:ToggleOptions() elseif button == "RightButton" then if IsShiftKeyDown() then self.ovaleDebug:DoTrace(true) else self.ovaleOptions:ToggleConfig() end end end self.OnInitialize = function() if LibDataBroker then local broker = { type = "data source", text = "", icon = CLASS_ICONS[self.ovale.playerClass], OnClick = self.OnClick, OnTooltipShow = self.OnTooltipShow } self.broker = LibDataBroker:NewDataObject(self.ovale:GetName(), broker) if LibDBIcon then LibDBIcon:Register(self.ovale:GetName(), self.broker, self.ovaleOptions.db.profile.apparence.minimap) end end if self.broker then self.module:RegisterMessage("Ovale_ProfileChanged", self.UpdateIcon) self.module:RegisterMessage("Ovale_ScriptChanged", self.Ovale_ScriptChanged) self.module:RegisterMessage("Ovale_SpecializationChanged", self.Ovale_ScriptChanged) self.module:RegisterEvent("PLAYER_ENTERING_WORLD", self.Ovale_ScriptChanged) self.Ovale_ScriptChanged() self.UpdateIcon() end end self.OnDisable = function() if self.broker then self.module:UnregisterEvent("PLAYER_ENTERING_WORLD") self.module:UnregisterMessage("Ovale_SpecializationChanged") self.module:UnregisterMessage("Ovale_ProfileChanged") self.module:UnregisterMessage("Ovale_ScriptChanged") end end self.UpdateIcon = function() if LibDBIcon and self.broker then local minimap = self.ovaleOptions.db.profile.apparence.minimap LibDBIcon:Refresh(self.ovale:GetName(), minimap) if minimap and minimap.hide then LibDBIcon:Hide(self.ovale:GetName()) else LibDBIcon:Show(self.ovale:GetName()) end end end self.Ovale_ScriptChanged = function() local script = self.ovaleOptions.db.profile.source[self.ovale.playerClass .. "_" .. self.ovalePaperDoll:GetSpecialization()] self.broker.text = (script == DEFAULT_NAME and self.ovaleScripts:GetDefaultScriptName(self.ovale.playerClass, self.ovalePaperDoll:GetSpecialization())) or script or "Disabled" end self.module = ovale:createModule("OvaleDataBroker", self.OnInitialize, self.OnDisable, aceEvent) local options = { minimap = { order = 25, type = "toggle", name = L["Show minimap icon"], get = function(info) return not self.ovaleOptions.db.profile.apparence.minimap.hide end, set = function(info, value) self.ovaleOptions.db.profile.apparence.minimap.hide = not value self.UpdateIcon() end } } for k, v in pairs(defaultDB) do self.ovaleOptions.defaultDB.profile.apparence[k] = v end for k, v in pairs(options) do self.ovaleOptions.options.args.apparence.args[k] = v end self.ovaleOptions:RegisterOptions(self) end, })
mit
Andrettin/Wyrmsun
scripts/species/mammal/artiodactyl/suid.lua
1
3440
-- _________ __ __ -- / _____// |_____________ _/ |______ ____ __ __ ______ -- \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ -- / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ -- /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > -- \/ \/ \//_____/ \/ -- ______________________ ______________________ -- T H E W A R B E G I N S -- Stratagus - A free fantasy real time strategy game engine -- -- (c) Copyright 2016-2022 by Andrettin -- -- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- DefineSpeciesGenus("microstonyx", { -- Source: Mauricio Antón and Jorge Morales, "Madrid antes del hombre", 2009, pp. 56-57. Name = "Microstonyx", Family = "suidae" }) DefineSpeciesGenus("seta", { -- fictional genus Name = "Seta", Family = "suidae" }) DefineSpecies("bunolistriodon-lockarti", { -- Source: Mauricio Antón and Jorge Morales, "Madrid antes del hombre", 2009, pp. 19, 56. Name = "Bunolistriodon", -- Bunolistriodon lockarti Genus = "bunolistriodon", Species = "lockarti", Homeworld = "earth", Terrains = {"grass", "semi_dry_grass", "dry_grass", "dirt", "dry-mud", "mud"}, -- this species lived in Miocene Madrid, which was mostly arid with a swampy lake in the middle EvolvesFrom = {"helohyus"}, Era = "miocene" -- Middle Miocene -- primarily herbivore -- 65cm shoulder height -- lived in Eurasia }) DefineSpecies("conohyus-simorrense", { -- Source: Mauricio Antón and Jorge Morales, "Madrid antes del hombre", 2009, pp. 56-57. Name = "Conohyus", -- Conohyus simorrense Genus = "conohyus", Species = "simorrense", Homeworld = "earth", Terrains = {"grass", "semi_dry_grass", "dry_grass", "dirt", "dry-mud", "mud"}, -- this species lived in Miocene Madrid, which was mostly arid with a swampy lake in the middle EvolvesFrom = {"helohyus"}, Era = "miocene" -- Middle Miocene -- 60cm shoulder height -- lived in Eurasia and Africa -- could chew hard objects like bones -- carrion was probably an important part of its diet }) DefineSpecies("microstonyx-major", { -- Source: Mauricio Antón and Jorge Morales, "Madrid antes del hombre", 2009, pp. 56-57. Name = "Microstonyx", -- Microstonyx major Genus = "microstonyx", Species = "major", Homeworld = "earth", Terrains = {"grass", "semi_dry_grass", "dry_grass", "dirt", "dry-mud", "mud"}, -- this species lived in Miocene Madrid, which was mostly arid with a swampy lake in the middle EvolvesFrom = {"helohyus"}, Era = "miocene" -- Upper Miocene -- lived in Eurasia -- 100 cm shoulder height -- weighted about 300kg })
gpl-2.0
devilrap97/alirap97
plugins/en-voice.lua
5
1053
--[[ ▀▄ ▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀ ▀▄ ▄▀ ▀▄ ▄▀ ▀▄ ▄▀ BY SAJJAD NOORI ▀▄ ▄▀ ▀▄ ▄▀ BY SAJAD NOORI (@SAJJADNOORI) ▀▄ ▄▀ ▀▄ ▄▀ JUST WRITED BY SAJJAD NOORI ▀▄ ▄▀ ▀▄ ▄▀ voice : صوت ▀▄ ▄▀ ▀▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀ --]] do local function run(msg, matches) local url = "http://tts.baidu.com/text2audio?lan=en&ie=UTF-8&text="..matches[1] local receiver = get_receiver(msg) local file = download_to_file(url,'text.ogg') send_audio('channel#id'..msg.to.id, file, ok_cb , false) end return { description = "text to voice", usage = { "voice [text]" }, patterns = { "^voice (.+)$" }, run = run } end
gpl-2.0
weiDDD/WSSParticleSystem
cocos2d/cocos/scripting/lua-bindings/auto/api/EaseBounceIn.lua
1
1092
-------------------------------- -- @module EaseBounceIn -- @extend EaseBounce -- @parent_module cc -------------------------------- -- brief Create the action with the inner action.<br> -- param action The pointer of the inner action.<br> -- return A pointer of EaseBounceIn action. If creation failed, return nil. -- @function [parent=#EaseBounceIn] create -- @param self -- @param #cc.ActionInterval action -- @return EaseBounceIn#EaseBounceIn ret (return value: cc.EaseBounceIn) -------------------------------- -- -- @function [parent=#EaseBounceIn] clone -- @param self -- @return EaseBounceIn#EaseBounceIn ret (return value: cc.EaseBounceIn) -------------------------------- -- -- @function [parent=#EaseBounceIn] update -- @param self -- @param #float time -- @return EaseBounceIn#EaseBounceIn self (return value: cc.EaseBounceIn) -------------------------------- -- -- @function [parent=#EaseBounceIn] reverse -- @param self -- @return EaseBounce#EaseBounce ret (return value: cc.EaseBounce) return nil
apache-2.0
Mohammadrezar/telediamond
plugins/inrealm.lua
183
36473
-- data saved to moderation.json -- check moderation plugin do local function create_group(msg) -- superuser and admins only (because sudo are always has privilege) if is_sudo(msg) or is_realm(msg) and is_admin1(msg) then local group_creator = msg.from.print_name create_group_chat (group_creator, group_name, ok_cb, false) return 'Group [ '..string.gsub(group_name, '_', ' ')..' ] has been created.' end end local function create_realm(msg) -- superuser and admins only (because sudo are always has privilege) if is_sudo(msg) or is_realm(msg) and is_admin1(msg) then local group_creator = msg.from.print_name create_group_chat (group_creator, group_name, ok_cb, false) return 'Realm [ '..string.gsub(group_name, '_', ' ')..' ] has been created.' end end local function killchat(cb_extra, success, result) local receiver = cb_extra.receiver local chat_id = "chat#id"..result.peer_id local chatname = result.print_name for k,v in pairs(result.members) do kick_user_any(v.peer_id, result.peer_id) end end local function killrealm(cb_extra, success, result) local receiver = cb_extra.receiver local chat_id = "chat#id"..result.peer_id local chatname = result.print_name for k,v in pairs(result.members) do kick_user_any(v.peer_id, result.peer_id) end end local function get_group_type(msg) local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then if not data[tostring(msg.to.id)]['group_type'] then if msg.to.type == 'chat' and not is_realm(msg) then data[tostring(msg.to.id)]['group_type'] = 'Group' save_data(_config.moderation.data, data) elseif msg.to.type == 'channel' then data[tostring(msg.to.id)]['group_type'] = 'SuperGroup' save_data(_config.moderation.data, data) end end local group_type = data[tostring(msg.to.id)]['group_type'] return group_type else return 'Chat type not found.' end end local function callbackres(extra, success, result) --vardump(result) local user = result.peer_id local name = string.gsub(result.print_name, "_", " ") local chat = 'chat#id'..extra.chatid local channel = 'channel#id'..extra.chatid send_large_msg(chat, user..'\n'..name) send_large_msg(channel, user..'\n'..name) return user end local function set_description(msg, data, target, about) if not is_admin1(msg) then return "For admins only!" 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 set_rules(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local data_cat = 'rules' data[tostring(target)][data_cat] = rules save_data(_config.moderation.data, data) return 'Set group rules to:\n'..rules end -- lock/unlock group name. bot automatically change group name when locked local function lock_group_name(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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_name(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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 --lock/unlock group member. bot automatically kick new added user when locked local function lock_group_member(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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_member(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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 --lock/unlock group photo. bot automatically keep group photo when locked local function lock_group_photo(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_photo_lock = data[tostring(target)]['settings']['lock_photo'] if group_photo_lock == 'yes' then return 'Group photo is already locked' else data[tostring(target)]['settings']['set_photo'] = 'waiting' save_data(_config.moderation.data, data) end return 'Please send me the group photo now' end local function unlock_group_photo(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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_flood(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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_flood(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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_arabic(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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_admin1(msg) then return "For admins only!" end local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic'] if group_arabic_lock == 'no' then return 'Arabic/Persian is already unlocked' else data[tostring(target)]['settings']['lock_arabic'] = 'no' save_data(_config.moderation.data, data) return 'Arabic/Persian 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 char. in names is already locked' else data[tostring(target)]['settings']['lock_rtl'] = 'yes' save_data(_config.moderation.data, data) return 'RTL char. in names 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 char. in names is already unlocked' else data[tostring(target)]['settings']['lock_rtl'] = 'no' save_data(_config.moderation.data, data) return 'RTL char. in names has been unlocked' end end local function lock_group_links(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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_admin1(msg) then return "For admins only!" 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_spam(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_spam_lock = data[tostring(target)]['settings']['lock_spam'] if group_spam_lock == 'yes' then return 'SuperGroup spam is already locked' else data[tostring(target)]['settings']['lock_spam'] = 'yes' save_data(_config.moderation.data, data) return 'SuperGroup spam has been locked' end end local function unlock_group_spam(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_spam_lock = data[tostring(target)]['settings']['lock_spam'] if group_spam_lock == 'no' then return 'SuperGroup spam is not locked' else data[tostring(target)]['settings']['lock_spam'] = 'no' save_data(_config.moderation.data, data) return 'SuperGroup spam has been unlocked' end end local function lock_group_rtl(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl'] if group_rtl_lock == 'yes' then return 'RTL char. in names is already locked' else data[tostring(target)]['settings']['lock_rtl'] = 'yes' save_data(_config.moderation.data, data) return 'RTL char. in names has been locked' end end local function unlock_group_rtl(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl'] if group_rtl_lock == 'no' then return 'RTL char. in names is already unlocked' else data[tostring(target)]['settings']['lock_rtl'] = 'no' save_data(_config.moderation.data, data) return 'RTL char. in names has been unlocked' end end local function lock_group_sticker(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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_admin1(msg) then return "For admins only!" 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 set_public_membermod(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_public_lock = data[tostring(target)]['settings']['public'] if group_public_lock == 'yes' then return 'Group is already public' else data[tostring(target)]['settings']['public'] = 'yes' save_data(_config.moderation.data, data) end return 'SuperGroup is now: public' end local function unset_public_membermod(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_public_lock = data[tostring(target)]['settings']['public'] if group_public_lock == 'no' then return 'Group is not public' else data[tostring(target)]['settings']['public'] = 'no' save_data(_config.moderation.data, data) return 'SuperGroup is now: not public' end end -- show group settings local function show_group_settings(msg, data, target) local data = load_data(_config.moderation.data, data) if not is_admin1(msg) then return "For admins only!" end if data[tostring(target)]['settings'] then if not data[tostring(target)]['settings']['public'] then data[tostring(target)]['settings']['public'] = 'no' end end local settings = data[tostring(target)]['settings'] local text = "Group settings for "..target..":\nLock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nPublic: "..settings.public end -- show SuperGroup settings local function show_super_group_settings(msg, data, target) local data = load_data(_config.moderation.data, data) if not is_admin1(msg) then return "For admins only!" end if data[tostring(msg.to.id)]['settings'] then if not data[tostring(msg.to.id)]['settings']['public'] then data[tostring(msg.to.id)]['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 if data[tostring(target)]['settings'] then if not data[tostring(target)]['settings']['lock_member'] then data[tostring(target)]['settings']['lock_member'] = 'no' end end local settings = data[tostring(target)]['settings'] local text = "SuperGroup settings for "..target..":\nLock links : "..settings.lock_link.."\nLock flood: "..settings.flood.."\nLock spam: "..settings.lock_spam.."\nLock Arabic: "..settings.lock_arabic.."\nLock Member: "..settings.lock_member.."\nLock RTL: "..settings.lock_rtl.."\nLock sticker: "..settings.lock_sticker.."\nPublic: "..settings.public.."\nStrict settings: "..settings.strict return text end local function returnids(cb_extra, success, result) local i = 1 local receiver = cb_extra.receiver local chat_id = "chat#id"..result.peer_id local chatname = result.print_name local text = 'Users in '..string.gsub(chatname,"_"," ")..' (ID: '..result.peer_id..'):\n\n' for k,v in pairs(result.members) do if v.print_name then local username = "" text = text ..i..' - '.. string.gsub(v.print_name,"_"," ") .. " [" .. v.peer_id .. "] \n\n" i = i + 1 end end local file = io.open("./groups/lists/"..result.peer_id.."memberlist.txt", "w") file:write(text) file:flush() file:close() end local function cb_user_info(cb_extra, success, result) local receiver = cb_extra.receiver if result.first_name then first_name = result.first_name:gsub("_", " ") else first_name = "None" end if result.last_name then last_name = result.last_name:gsub("_", " ") else last_name = "None" end if result.username then username = "@"..result.username else username = "@[none]" end text = "User Info:\n\nID: "..result.peer_id.."\nFirst: "..first_name.."\nLast: "..last_name.."\nUsername: "..username send_large_msg(receiver, text) end local function admin_promote(msg, admin_id) if not is_sudo(msg) then return "Access denied!" end local admins = 'admins' if not data[tostring(admins)] then data[tostring(admins)] = {} save_data(_config.moderation.data, data) end if data[tostring(admins)][tostring(admin_id)] then return admin_id..' is already an admin.' end data[tostring(admins)][tostring(admin_id)] = admin_id save_data(_config.moderation.data, data) return admin_id..' has been promoted as admin.' end local function admin_demote(msg, admin_id) if not is_sudo(msg) then return "Access denied!" end local data = load_data(_config.moderation.data) local admins = 'admins' if not data[tostring(admins)] then data[tostring(admins)] = {} save_data(_config.moderation.data, data) end if not data[tostring(admins)][tostring(admin_id)] then return admin_id..' is not an admin.' end data[tostring(admins)][tostring(admin_id)] = nil save_data(_config.moderation.data, data) return admin_id..' has been demoted from admin.' end local function admin_list(msg) local data = load_data(_config.moderation.data) local admins = 'admins' if not data[tostring(admins)] then data[tostring(admins)] = {} save_data(_config.moderation.data, data) end local message = 'List of global admins:\n' for k,v in pairs(data[tostring(admins)]) do message = message .. '- (at)' .. v .. ' [' .. k .. '] ' ..'\n' end return message end local function groups_list(msg) local data = load_data(_config.moderation.data) local groups = 'groups' if not data[tostring(groups)] then return 'No groups at the moment' end local message = 'List of groups:\n' for k,v in pairs(data[tostring(groups)]) do if data[tostring(v)] then if data[tostring(v)]['settings'] then local settings = data[tostring(v)]['settings'] for m,n in pairs(settings) do if m == 'set_name' then name = n end end local group_owner = "No owner" if data[tostring(v)]['set_owner'] then group_owner = tostring(data[tostring(v)]['set_owner']) end local group_link = "No link" if data[tostring(v)]['settings']['set_link'] then group_link = data[tostring(v)]['settings']['set_link'] end message = message .. '- '.. name .. ' (' .. v .. ') ['..group_owner..'] \n {'..group_link.."}\n" end end end local file = io.open("./groups/lists/groups.txt", "w") file:write(message) file:flush() file:close() return message end local function realms_list(msg) local data = load_data(_config.moderation.data) local realms = 'realms' if not data[tostring(realms)] then return 'No Realms at the moment' end local message = 'List of Realms:\n' for k,v in pairs(data[tostring(realms)]) do local settings = data[tostring(v)]['settings'] for m,n in pairs(settings) do if m == 'set_name' then name = n end end local group_owner = "No owner" if data[tostring(v)]['admins_in'] then group_owner = tostring(data[tostring(v)]['admins_in']) end local group_link = "No link" if data[tostring(v)]['settings']['set_link'] then group_link = data[tostring(v)]['settings']['set_link'] end message = message .. '- '.. name .. ' (' .. v .. ') ['..group_owner..'] \n {'..group_link.."}\n" end local file = io.open("./groups/lists/realms.txt", "w") file:write(message) file:flush() file:close() return message end local function admin_user_promote(receiver, member_username, member_id) local data = load_data(_config.moderation.data) if not data['admins'] then data['admins'] = {} save_data(_config.moderation.data, data) end if data['admins'][tostring(member_id)] then return send_large_msg(receiver, '@'..member_username..' is already an admin.') end data['admins'][tostring(member_id)] = member_username save_data(_config.moderation.data, data) return send_large_msg(receiver, '@'..member_username..' has been promoted as admin.') end local function admin_user_demote(receiver, member_username, member_id) local data = load_data(_config.moderation.data) if not data['admins'] then data['admins'] = {} save_data(_config.moderation.data, data) end if not data['admins'][tostring(member_id)] then send_large_msg(receiver, "@"..member_username..' is not an admin.') return end data['admins'][tostring(member_id)] = nil save_data(_config.moderation.data, data) send_large_msg(receiver, 'Admin @'..member_username..' has been demoted.') end local function username_id(cb_extra, success, result) local mod_cmd = cb_extra.mod_cmd local receiver = cb_extra.receiver local member = cb_extra.member local text = 'No user @'..member..' in this group.' for k,v in pairs(result.members) do vusername = v.username if vusername == member then member_username = member member_id = v.peer_id if mod_cmd == 'addadmin' then return admin_user_promote(receiver, member_username, member_id) elseif mod_cmd == 'removeadmin' then return admin_user_demote(receiver, member_username, member_id) end end end send_large_msg(receiver, text) end local function res_user_support(cb_extra, success, result) local receiver = cb_extra.receiver local get_cmd = cb_extra.get_cmd local support_id = result.peer_id if get_cmd == 'addsupport' then support_add(support_id) send_large_msg(receiver, "User ["..support_id.."] has been added to the support team") elseif get_cmd == 'removesupport' then support_remove(support_id) send_large_msg(receiver, "User ["..support_id.."] has been removed from the support team") end end local function set_log_group(target, data) if not is_admin1(msg) then return end local log_group = data[tostring(target)]['log_group'] if log_group == 'yes' then return 'Log group is already set' else data[tostring(target)]['log_group'] = 'yes' save_data(_config.moderation.data, data) return 'Log group has been set' end end local function unset_log_group(msg) if not is_admin1(msg) then return end local log_group = data[tostring(target)]['log_group'] if log_group == 'no' then return 'Log group is not set' else data[tostring(target)]['log_group'] = 'no' save_data(_config.moderation.data, data) return 'log group has been disabled' end end local function help() local help_text = tostring(_config.help_text_realm) return help_text end function run(msg, matches) local name_log = user_print_name(msg.from) if matches[1] == 'log' and is_owner(msg) then local receiver = get_receiver(msg) savelog(msg.to.id, "log file created by owner/support/admin") send_document(receiver,"./groups/logs/"..msg.to.id.."log.txt", ok_cb, false) end if matches[1] == 'who' and msg.to.type == 'chat' and is_momod(msg) then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested member list ") local receiver = get_receiver(msg) chat_info(receiver, returnids, {receiver=receiver}) local file = io.open("./groups/lists/"..msg.to.id.."memberlist.txt", "r") text = file:read("*a") send_large_msg(receiver,text) file:close() end if matches[1] == 'wholist' and is_momod(msg) then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested member list in a file") local receiver = get_receiver(msg) chat_info(receiver, returnids, {receiver=receiver}) send_document("chat#id"..msg.to.id,"./groups/lists/"..msg.to.id.."memberlist.txt", ok_cb, false) end if matches[1] == 'whois' and is_momod(msg) then local receiver = get_receiver(msg) local user_id = "user#id"..matches[2] user_info(user_id, cb_user_info, {receiver = receiver}) end if not is_sudo(msg) then if is_realm(msg) and is_admin1(msg) then print("Admin detected") else return end end if matches[1] == 'creategroup' and matches[2] then group_name = matches[2] group_type = 'group' return create_group(msg) end --[[ Experimental if matches[1] == 'createsuper' and matches[2] then if not is_sudo(msg) or is_admin1(msg) and is_realm(msg) then return "You cant create groups!" end group_name = matches[2] group_type = 'super_group' return create_group(msg) end]] if matches[1] == 'createrealm' and matches[2] then if not is_sudo(msg) then return "Sudo users only !" end group_name = matches[2] group_type = 'realm' return create_realm(msg) end local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) if matches[1] == 'setabout' and matches[2] == 'group' and is_realm(msg) then local target = matches[3] local about = matches[4] return set_description(msg, data, target, about) end if matches[1] == 'setabout' and matches[2] == 'sgroup'and is_realm(msg) then local channel = 'channel#id'..matches[3] local about_text = matches[4] local data_cat = 'description' local target = matches[3] channel_set_about(channel, about_text, ok_cb, false) data[tostring(target)][data_cat] = about_text save_data(_config.moderation.data, data) return "Description has been set for ["..matches[2]..']' end if matches[1] == 'setrules' then rules = matches[3] local target = matches[2] return set_rules(msg, data, target) end if matches[1] == 'lock' then local target = matches[2] if matches[3] == 'name' then return lock_group_name(msg, data, target) end if matches[3] == 'member' then return lock_group_member(msg, data, target) end if matches[3] == 'photo' then return lock_group_photo(msg, data, target) end if matches[3] == 'flood' then return lock_group_flood(msg, data, target) end if matches[2] == 'arabic' then return lock_group_arabic(msg, data, target) end if matches[3] == 'links' then return lock_group_links(msg, data, target) end if matches[3] == 'spam' then return lock_group_spam(msg, data, target) end if matches[3] == 'rtl' then return unlock_group_rtl(msg, data, target) end if matches[3] == 'sticker' then return lock_group_sticker(msg, data, target) end end if matches[1] == 'unlock' then local target = matches[2] if matches[3] == 'name' then return unlock_group_name(msg, data, target) end if matches[3] == 'member' then return unlock_group_member(msg, data, target) end if matches[3] == 'photo' then return unlock_group_photo(msg, data, target) end if matches[3] == 'flood' then return unlock_group_flood(msg, data, target) end if matches[3] == 'arabic' then return unlock_group_arabic(msg, data, target) end if matches[3] == 'links' then return unlock_group_links(msg, data, target) end if matches[3] == 'spam' then return unlock_group_spam(msg, data, target) end if matches[3] == 'rtl' then return unlock_group_rtl(msg, data, target) end if matches[3] == 'sticker' then return unlock_group_sticker(msg, data, target) end end if matches[1] == 'settings' and matches[2] == 'group' and data[tostring(matches[3])]['settings'] then local target = matches[3] text = show_group_settingsmod(msg, target) return text.."\nID: "..target.."\n" end if matches[1] == 'settings' and matches[2] == 'sgroup' and data[tostring(matches[3])]['settings'] then local target = matches[3] text = show_supergroup_settingsmod(msg, target) return text.."\nID: "..target.."\n" end if matches[1] == 'setname' and is_realm(msg) then local settings = data[tostring(matches[2])]['settings'] 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, "Realm { "..msg.to.print_name.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]") end if matches[1] == 'setgpname' and is_admin1(msg) then local new_name = string.gsub(matches[3], '_', ' ') data[tostring(matches[2])]['settings']['set_name'] = new_name save_data(_config.moderation.data, data) local group_name_set = data[tostring(matches[2])]['settings']['set_name'] local chat_to_rename = 'chat#id'..matches[2] local channel_to_rename = 'channel#id'..matches[2] rename_chat(to_rename, group_name_set, ok_cb, false) rename_channel(channel_to_rename, group_name_set, ok_cb, false) savelog(matches[3], "Group { "..group_name_set.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]") end if matches[1] == 'help' and is_realm(msg) then savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /help") return help() end --[[if matches[1] == 'set' then if matches[2] == 'loggroup' and is_sudo(msg) then local target = msg.to.peer_id savelog(msg.to.peer_id, name_log.." ["..msg.from.id.."] set as log group") return set_log_group(target, data) end end if matches[1] == 'rem' then if matches[2] == 'loggroup' and is_sudo(msg) then local target = msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] set as log group") return unset_log_group(target, data) end end]] if matches[1] == 'kill' and matches[2] == 'chat' and matches[3] then if not is_admin1(msg) then return end if is_realm(msg) then local receiver = 'chat#id'..matches[3] return modrem(msg), print("Closing Group: "..receiver), chat_info(receiver, killchat, {receiver=receiver}) else return 'Error: Group '..matches[3]..' not found' end end if matches[1] == 'kill' and matches[2] == 'realm' and matches[3] then if not is_admin1(msg) then return end if is_realm(msg) then local receiver = 'chat#id'..matches[3] return realmrem(msg), print("Closing realm: "..receiver), chat_info(receiver, killrealm, {receiver=receiver}) else return 'Error: Realm '..matches[3]..' not found' end end if matches[1] == 'rem' and matches[2] then -- Group configuration removal data[tostring(matches[2])] = 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(matches[2])] = nil save_data(_config.moderation.data, data) send_large_msg(receiver, 'Chat '..matches[2]..' removed') end if matches[1] == 'chat_add_user' then if not msg.service then return end local user = 'user#id'..msg.action.user.id local chat = 'chat#id'..msg.to.id if not is_admin1(msg) and is_realm(msg) then chat_del_user(chat, user, ok_cb, true) end end if matches[1] == 'addadmin' then if not is_sudo(msg) then-- Sudo only return end if string.match(matches[2], '^%d+$') then local admin_id = matches[2] print("user "..admin_id.." has been promoted as admin") return admin_promote(msg, admin_id) else local member = string.gsub(matches[2], "@", "") local mod_cmd = "addadmin" chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member}) end end if matches[1] == 'removeadmin' then if not is_sudo(msg) then-- Sudo only return end if string.match(matches[2], '^%d+$') then local admin_id = matches[2] print("user "..admin_id.." has been demoted") return admin_demote(msg, admin_id) else local member = string.gsub(matches[2], "@", "") local mod_cmd = "removeadmin" chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member}) end end if matches[1] == 'support' and matches[2] then if string.match(matches[2], '^%d+$') then local support_id = matches[2] print("User "..support_id.." has been added to the support team") support_add(support_id) return "User ["..support_id.."] has been added to the support team" else local member = string.gsub(matches[2], "@", "") local receiver = get_receiver(msg) local get_cmd = "addsupport" resolve_username(member, res_user_support, {get_cmd = get_cmd, receiver = receiver}) end end if matches[1] == '-support' then if string.match(matches[2], '^%d+$') then local support_id = matches[2] print("User "..support_id.." has been removed from the support team") support_remove(support_id) return "User ["..support_id.."] has been removed from the support team" else local member = string.gsub(matches[2], "@", "") local receiver = get_receiver(msg) local get_cmd = "removesupport" resolve_username(member, res_user_support, {get_cmd = get_cmd, receiver = receiver}) end end if matches[1] == 'type'then local group_type = get_group_type(msg) return group_type end if matches[1] == 'list' then if matches[2] == 'admins' then return admin_list(msg) end -- if matches[2] == 'support' and not matches[2] then -- return support_list() -- end end if matches[1] == 'list' and matches[2] == 'groups' then if msg.to.type == 'chat' or msg.to.type == 'channel' then groups_list(msg) send_document("chat#id"..msg.to.id, "./groups/lists/groups.txt", ok_cb, false) send_document("channel#id"..msg.to.id, "./groups/lists/groups.txt", ok_cb, false) return "Group list created" --group_list(msg) elseif msg.to.type == 'user' then groups_list(msg) send_document("user#id"..msg.from.id, "./groups/lists/groups.txt", ok_cb, false) return "Group list created" --group_list(msg) end end if matches[1] == 'list' and matches[2] == 'realms' then if msg.to.type == 'chat' or msg.to.type == 'channel' then realms_list(msg) send_document("chat#id"..msg.to.id, "./groups/lists/realms.txt", ok_cb, false) send_document("channel#id"..msg.to.id, "./groups/lists/realms.txt", ok_cb, false) return "Realms list created" --realms_list(msg) elseif msg.to.type == 'user' then realms_list(msg) send_document("user#id"..msg.from.id, "./groups/lists/realms.txt", ok_cb, false) return "Realms list created" --realms_list(msg) end end if matches[1] == 'res' and is_momod(msg) then local cbres_extra = { chatid = msg.to.id } local username = matches[2] local username = username:gsub("@","") savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /res "..username) return resolve_username(username, callbackres, cbres_extra) end end return { patterns = { "^[#!/](creategroup) (.*)$", "^[#!/](createsuper) (.*)$", "^[#!/](createrealm) (.*)$", "^[#!/](setabout) (%d+) (.*)$", "^[#!/](setrules) (%d+) (.*)$", "^[#!/](setname) (.*)$", "^[#!/](setgpname) (%d+) (.*)$", "^[#!/](setname) (%d+) (.*)$", "^[#!/](lock) (%d+) (.*)$", "^[#!/](unlock) (%d+) (.*)$", "^[#!/](mute) (%d+)$", "^[#!/](unmute) (%d+)$", "^[#!/](settings) (.*) (%d+)$", "^[#!/](wholist)$", "^[#!/](who)$", "^[#!/]([Ww]hois) (.*)", "^[#!/](type)$", "^[#!/](kill) (chat) (%d+)$", "^[#!/](kill) (realm) (%d+)$", "^[#!/](rem) (%d+)$", "^[#!/](addadmin) (.*)$", -- sudoers only "^[#!/](removeadmin) (.*)$", -- sudoers only "[#!/ ](support)$", "^[#!/](support) (.*)$", "^[#!/](-support) (.*)$", "^[#!/](list) (.*)$", "^[#!/](log)$", "^[#!/](help)$", "^!!tgservice (.+)$", }, run = run } end
agpl-3.0
TheAnswer/FirstTest
bin/scripts/skills/creatureSkills/lok/npcs/canyonCorsairAttacks.lua
1
2854
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. canyonCorsairAttack1 = { attackname = "canyonCorsairAttack1", animation = "creature_attack_light", requiredWeaponType = NONE, range = 10, damageRatio = 1.2, speedRatio = 4, areaRange = 0, accuracyBonus = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(canyonCorsairAttack1) ---------------------------------------------------------------------------------------
lgpl-3.0
Xeltor/ovale
dist/hooves/paladin/Hooves_Protection.lua
1
15037
local __exports = LibStub:GetLibrary("ovale/scripts/ovale_paladin") if not __exports then return end __exports.registerPaladinProtectionHooves = function(OvaleScripts) do local name = "hooves_prot" local desc = "[Hooves][8.2] Paladin: Protection" local code = [[ Include(ovale_common) Include(ovale_trinkets_mop) Include(ovale_trinkets_wod) Include(ovale_paladin_spells) # Protection AddIcon specialization=2 help=main { # Interrupt # if { target.InRange(shield_of_the_righteous) or target.InRange(hammer_of_the_righteous) } #and HasFullControl() if not Mounted() { if { target.InRange(rebuke) } and HasFullControl() { PaladinHealMe() if not BuffPresent(consecration_buff) Spell(consecration) ProtectionDefaultShortCdActions() ProtectionDefaultCdActions() ProtectionDefaultMainActions() } } } AddFunction ProtectionUseHeartEssence { Spell(concentrated_flame_essence) } AddFunction ProtectionSelfHealCondition { (HealthPercent() < 40) or (IncomingDamage(10) < MaxHealth() * 1.25 and HealthPercent() < 55 and Talent(righteous_protector_talent)) or (IncomingDamage(13) < MaxHealth() * 1.6 and HealthPercent() < 55) or (IncomingDamage(6) < MaxHealth() * 0.7 and HealthPercent() < 65 and Talent(righteous_protector_talent)) or (IncomingDamage(9) < MaxHealth() * 1.2 and HealthPercent() < 55) or (HealthPercent() < 60 and HasEquippedItem(saruans_resolve) and (SpellCharges(light_of_the_protector) >= 2 or SpellCharges(hand_of_the_protector) >= 2)) } AddFunction PaladinHealMe { unless(DebuffPresent(healing_immunity_debuff)) { if ProtectionSelfHealCondition() Spell(light_of_the_protector) if (HealthPercent() < 35) UseHealthPotions() } } AddFunction ProtectionGetInMeleeRange { if CheckBoxOn(opt_melee_range) and not target.InRange(rebuke) Texture(misc_arrowlup help=L(not_in_melee_range)) } ### actions.precombat AddFunction ProtectionPrecombatMainActions { #consecration #Spell(consecration) } AddFunction ProtectionPrecombatMainPostConditions { } AddFunction ProtectionPrecombatShortCdActions { } AddFunction ProtectionPrecombatShortCdPostConditions { #Spell(consecration) } AddFunction ProtectionPrecombatCdActions { #flask #food #augmentation #snapshot_stats #potion if CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(item_unbridled_fury usable=1) unless Spell(consecration) { #lights_judgment Spell(lights_judgment) } } AddFunction ProtectionPrecombatCdPostConditions { #Spell(consecration) } ### actions.cooldowns AddFunction ProtectionCooldownsMainActions { } AddFunction ProtectionCooldownsMainPostConditions { } AddFunction ProtectionCooldownsShortCdActions { #seraphim,if=cooldown.shield_of_the_righteous.charges_fractional>=2 if SpellCharges(shield_of_the_righteous count=0) >= 2 Spell(seraphim) } AddFunction ProtectionCooldownsShortCdPostConditions { } AddFunction ProtectionCooldownsCdActions { #fireblood,if=buff.avenging_wrath.up if BuffPresent(avenging_wrath_buff) Spell(fireblood) #use_item,name=azsharas_font_of_power,if=cooldown.seraphim.remains<=10|!talent.seraphim.enabled unless SpellCharges(shield_of_the_righteous count=0) >= 2 and Spell(seraphim) { #avenging_wrath,if=buff.seraphim.up|cooldown.seraphim.remains<2|!talent.seraphim.enabled if BuffPresent(seraphim_buff) or SpellCooldown(seraphim) < 2 or not Talent(seraphim_talent) Spell(avenging_wrath) #bastion_of_light,if=cooldown.shield_of_the_righteous.charges_fractional<=0.5 if SpellCharges(shield_of_the_righteous count=0) <= 0.5 Spell(bastion_of_light) #potion,if=buff.avenging_wrath.up if BuffPresent(avenging_wrath_buff) and CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(item_unbridled_fury usable=1) #use_items,if=buff.seraphim.up|!talent.seraphim.enabled #use_item,name=grongs_primal_rage,if=((cooldown.judgment.full_recharge_time>4|(!talent.crusaders_judgment.enabled&prev_gcd.1.judgment))&cooldown.avengers_shield.remains>4&buff.seraphim.remains>4)|(buff.seraphim.remains<4) #use_item,name=merekthas_fang,if=!buff.avenging_wrath.up&(buff.seraphim.up|!talent.seraphim.enabled) #use_item,name=razdunks_big_red_button } } AddFunction ProtectionCooldownsCdPostConditions { SpellCharges(shield_of_the_righteous count=0) >= 2 and Spell(seraphim) } AddFunction ProtectionDefaultMainActions { #call_action_list,name=cooldowns ProtectionCooldownsMainActions() unless ProtectionCooldownsMainPostConditions() { #consecration,if=!consecration.up if not BuffPresent(consecration_buff) Spell(consecration) #judgment,if=(cooldown.judgment.remains<gcd&cooldown.judgment.charges_fractional>1&cooldown_react)|!talent.crusaders_judgment.enabled if SpellCooldown(judgment_protection) < GCD() and SpellCharges(judgment_protection count=0) > 1 and not SpellCooldown(judgment_protection) > 0 or not Talent(crusaders_judgment_talent) Spell(judgment_protection) #avengers_shield,if=cooldown_react if not SpellCooldown(avengers_shield) > 0 Spell(avengers_shield) #judgment,if=cooldown_react|!talent.crusaders_judgment.enabled if not SpellCooldown(judgment_protection) > 0 or not Talent(crusaders_judgment_talent) Spell(judgment_protection) #concentrated_flame,if=(!talent.seraphim.enabled|buff.seraphim.up)&!dot.concentrated_flame_burn.remains>0|essence.the_crucible_of_flame.rank<3 if { not Talent(seraphim_talent) or BuffPresent(seraphim_buff) } and not target.DebuffRemaining(concentrated_flame_burn_debuff) > 0 or AzeriteEssenceRank(the_crucible_of_flame_essence_id) < 3 Spell(concentrated_flame_essence) #anima_of_death Spell(anima_of_death) #blessed_hammer,strikes=3 Spell(blessed_hammer) #hammer_of_the_righteous Spell(hammer_of_the_righteous) #consecration Spell(consecration) } } AddFunction ProtectionDefaultMainPostConditions { ProtectionCooldownsMainPostConditions() } AddFunction ProtectionDefaultShortCdActions { #auto_attack ProtectionGetInMeleeRange() #call_action_list,name=cooldowns ProtectionCooldownsShortCdActions() unless ProtectionCooldownsShortCdPostConditions() { #worldvein_resonance,if=buff.lifeblood.stack<3 if BuffStacks(lifeblood_buff) < 3 Spell(worldvein_resonance_essence) #shield_of_the_righteous,if=(buff.avengers_valor.up&cooldown.shield_of_the_righteous.charges_fractional>=2.5)&(cooldown.seraphim.remains>gcd|!talent.seraphim.enabled) if BuffPresent(avengers_valor_buff) and SpellCharges(shield_of_the_righteous count=0) >= 2.5 and { SpellCooldown(seraphim) > GCD() or not Talent(seraphim_talent) } Spell(shield_of_the_righteous) #shield_of_the_righteous,if=(buff.avenging_wrath.up&!talent.seraphim.enabled)|buff.seraphim.up&buff.avengers_valor.up if BuffPresent(avenging_wrath_buff) and not Talent(seraphim_talent) or BuffPresent(seraphim_buff) and BuffPresent(avengers_valor_buff) Spell(shield_of_the_righteous) #shield_of_the_righteous,if=(buff.avenging_wrath.up&buff.avenging_wrath.remains<4&!talent.seraphim.enabled)|(buff.seraphim.remains<4&buff.seraphim.up) if BuffPresent(avenging_wrath_buff) and BuffRemaining(avenging_wrath_buff) < 4 and not Talent(seraphim_talent) or BuffRemaining(seraphim_buff) < 4 and BuffPresent(seraphim_buff) Spell(shield_of_the_righteous) } } AddFunction ProtectionDefaultShortCdPostConditions { ProtectionCooldownsShortCdPostConditions() or not BuffPresent(consecration) and Spell(consecration) or { SpellCooldown(judgment_protection) < GCD() and SpellCharges(judgment_protection count=0) > 1 and not SpellCooldown(judgment_protection) > 0 or not Talent(crusaders_judgment_talent) } and Spell(judgment_protection) or not SpellCooldown(avengers_shield) > 0 and Spell(avengers_shield) or { not SpellCooldown(judgment_protection) > 0 or not Talent(crusaders_judgment_talent) } and Spell(judgment_protection) or { { not Talent(seraphim_talent) or BuffPresent(seraphim_buff) } and not target.DebuffRemaining(concentrated_flame_burn_debuff) > 0 or AzeriteEssenceRank(the_crucible_of_flame_essence_id) < 3 } and Spell(concentrated_flame_essence) or Spell(anima_of_death) or Spell(blessed_hammer) or Spell(hammer_of_the_righteous) or Spell(consecration) } AddFunction ProtectionDefaultCdActions { #ProtectionInterruptActions() #call_action_list,name=cooldowns ProtectionCooldownsCdActions() unless ProtectionCooldownsCdPostConditions() or BuffStacks(lifeblood_buff) < 3 and Spell(worldvein_resonance_essence) { #lights_judgment,if=buff.seraphim.up&buff.seraphim.remains<3 if BuffPresent(seraphim_buff) and BuffRemaining(seraphim_buff) < 3 Spell(lights_judgment) unless not BuffPresent(consecration) and Spell(consecration) or { SpellCooldown(judgment_protection) < GCD() and SpellCharges(judgment_protection count=0) > 1 and not SpellCooldown(judgment_protection) > 0 or not Talent(crusaders_judgment_talent) } and Spell(judgment_protection) or not SpellCooldown(avengers_shield) > 0 and Spell(avengers_shield) or { not SpellCooldown(judgment_protection) > 0 or not Talent(crusaders_judgment_talent) } and Spell(judgment_protection) or { { not Talent(seraphim_talent) or BuffPresent(seraphim_buff) } and not target.DebuffRemaining(concentrated_flame_burn_debuff) > 0 or AzeriteEssenceRank(the_crucible_of_flame_essence_id) < 3 } and Spell(concentrated_flame_essence) { #lights_judgment,if=!talent.seraphim.enabled|buff.seraphim.up if not Talent(seraphim_talent) or BuffPresent(seraphim_buff) Spell(lights_judgment) unless Spell(anima_of_death) or Spell(blessed_hammer) or Spell(hammer_of_the_righteous) or Spell(consecration) { #heart_essence,if=!(essence.the_crucible_of_flame.major|essence.worldvein_resonance.major|essence.anima_of_life_and_death.major|essence.memory_of_lucid_dreams.major) if not { AzeriteEssenceIsMajor(the_crucible_of_flame_essence_id) or AzeriteEssenceIsMajor(worldvein_resonance_essence_id) or AzeriteEssenceIsMajor(anima_of_life_and_death_essence_id) or AzeriteEssenceIsMajor(memory_of_lucid_dreams_essence_id) } ProtectionUseHeartEssence() } } } } AddFunction ProtectionDefaultCdPostConditions { ProtectionCooldownsCdPostConditions() or BuffStacks(lifeblood_buff) < 3 and Spell(worldvein_resonance_essence) or not BuffPresent(consecration) and Spell(consecration) or { SpellCooldown(judgment_protection) < GCD() and SpellCharges(judgment_protection count=0) > 1 and not SpellCooldown(judgment_protection) > 0 or not Talent(crusaders_judgment_talent) } and Spell(judgment_protection) or not SpellCooldown(avengers_shield) > 0 and Spell(avengers_shield) or { not SpellCooldown(judgment_protection) > 0 or not Talent(crusaders_judgment_talent) } and Spell(judgment_protection) or { { not Talent(seraphim_talent) or BuffPresent(seraphim_buff) } and not target.DebuffRemaining(concentrated_flame_burn_debuff) > 0 or AzeriteEssenceRank(the_crucible_of_flame_essence_id) < 3 } and Spell(concentrated_flame_essence) or Spell(anima_of_death) or Spell(blessed_hammer) or Spell(hammer_of_the_righteous) or Spell(consecration) } ### actions.cooldowns AddFunction ProtectionCooldownsMainActions { } AddFunction ProtectionCooldownsMainPostConditions { } AddFunction ProtectionCooldownsShortCdActions { #seraphim,if=cooldown.shield_of_the_righteous.charges_fractional>=2 if SpellCharges(shield_of_the_righteous count=0) >= 2 Spell(seraphim) } AddFunction ProtectionCooldownsShortCdPostConditions { } AddFunction ProtectionUseItemActions { #Item(Trinket0Slot text=13 usable=1) #Item(Trinket1Slot text=14 usable=1) } AddFunction ProtectionCooldownsCdActions { #fireblood,if=buff.avenging_wrath.up if BuffPresent(avenging_wrath_buff) Spell(fireblood) #use_item,name=azsharas_font_of_power,if=cooldown.seraphim.remains<=10|!talent.seraphim.enabled if SpellCooldown(seraphim) <= 10 or not Talent(seraphim_talent) ProtectionUseItemActions() #use_item,name=ashvanes_razor_coral,if=(debuff.razor_coral_debuff.stack>7&buff.avenging_wrath.up)|debuff.razor_coral_debuff.stack=0 if target.DebuffStacks(razor_coral_debuff) > 7 and BuffPresent(avenging_wrath_buff) or target.DebuffStacks(razor_coral_debuff) == 0 ProtectionUseItemActions() unless SpellCharges(shield_of_the_righteous count=0) >= 2 and Spell(seraphim) { #avenging_wrath,if=buff.seraphim.up|cooldown.seraphim.remains<2|!talent.seraphim.enabled if BuffPresent(seraphim_buff) or SpellCooldown(seraphim) < 2 or not Talent(seraphim_talent) Spell(avenging_wrath) #memory_of_lucid_dreams,if=!talent.seraphim.enabled|cooldown.seraphim.remains<=gcd|buff.seraphim.up if not Talent(seraphim_talent) or SpellCooldown(seraphim) <= GCD() or BuffPresent(seraphim_buff) Spell(memory_of_lucid_dreams_essence) #bastion_of_light,if=cooldown.shield_of_the_righteous.charges_fractional<=0.5 if SpellCharges(shield_of_the_righteous count=0) <= 0.5 Spell(bastion_of_light) #potion,if=buff.avenging_wrath.up if BuffPresent(avenging_wrath_buff) and CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(item_potion_of_unbridled_fury usable=1) #use_items,if=buff.seraphim.up|!talent.seraphim.enabled if BuffPresent(seraphim_buff) or not Talent(seraphim_talent) ProtectionUseItemActions() #use_item,name=grongs_primal_rage,if=cooldown.judgment.full_recharge_time>4&cooldown.avengers_shield.remains>4&(buff.seraphim.up|cooldown.seraphim.remains+4+gcd>expected_combat_length-time)&consecration.up if SpellCooldown(judgment_protection) > 4 and SpellCooldown(avengers_shield) > 4 and { BuffPresent(seraphim_buff) or SpellCooldown(seraphim) + 4 + GCD() > 600 - TimeInCombat() } and BuffPresent(consecration) ProtectionUseItemActions() #use_item,name=pocketsized_computation_device,if=cooldown.judgment.full_recharge_time>4*spell_haste&cooldown.avengers_shield.remains>4*spell_haste&(!equipped.grongs_primal_rage|!trinket.grongs_primal_rage.cooldown.up)&consecration.up if SpellCooldown(judgment_protection) > 4 * { 100 / { 100 + SpellCastSpeedPercent() } } and SpellCooldown(avengers_shield) > 4 * { 100 / { 100 + SpellCastSpeedPercent() } } and { not HasEquippedItem(grongs_primal_rage_item) or BuffExpires(trinket_grongs_primal_rage_cooldown_buff) } and BuffPresent(consecration) ProtectionUseItemActions() #use_item,name=merekthas_fang,if=!buff.avenging_wrath.up&(buff.seraphim.up|!talent.seraphim.enabled) if not BuffPresent(avenging_wrath_buff) and { BuffPresent(seraphim_buff) or not Talent(seraphim_talent) } ProtectionUseItemActions() #use_item,name=razdunks_big_red_button ProtectionUseItemActions() } } AddFunction ProtectionCooldownsCdPostConditions { SpellCharges(shield_of_the_righteous count=0) >= 2 and Spell(seraphim) } ### actions.precombat AddFunction ProtectionPrecombatMainActions { #consecration #Spell(consecration) } AddFunction ProtectionPrecombatMainPostConditions { } AddFunction ProtectionPrecombatShortCdActions { } AddFunction ProtectionPrecombatShortCdPostConditions { #Spell(consecration) } ]] OvaleScripts:RegisterScript("PALADIN", "protection", name, desc, code, "script") end end
mit
TheAnswer/FirstTest
bin/scripts/object/SharedPlayerObjectTemplate.lua
1
2115
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. SharedPlayerObjectTemplate = SharedIntangibleObjectTemplate:new { }
lgpl-3.0
focusworld/max_bot
bot/utils.lua
494
23873
URL = require "socket.url" http = require "socket.http" https = require "ssl.https" ltn12 = require "ltn12" serpent = require "serpent" feedparser = require "feedparser" json = (loadfile "./libs/JSON.lua")() mimetype = (loadfile "./libs/mimetype.lua")() redis = (loadfile "./libs/redis.lua")() JSON = (loadfile "./libs/dkjson.lua")() http.TIMEOUT = 10 function get_receiver(msg) if msg.to.type == 'user' then return 'user#id'..msg.from.id end if msg.to.type == 'chat' then return 'chat#id'..msg.to.id end if msg.to.type == 'encr_chat' then return msg.to.print_name end end function is_chat_msg( msg ) if msg.to.type == 'chat' then return true end return false end function string.random(length) local str = ""; for i = 1, length do math.random(97, 122) str = str..string.char(math.random(97, 122)); end return str; end function string:split(sep) local sep, fields = sep or ":", {} local pattern = string.format("([^%s]+)", sep) self:gsub(pattern, function(c) fields[#fields+1] = c end) return fields end -- DEPRECATED function string.trim(s) print("string.trim(s) is DEPRECATED use string:trim() instead") return s:gsub("^%s*(.-)%s*$", "%1") end -- Removes spaces function string:trim() return self:gsub("^%s*(.-)%s*$", "%1") end function get_http_file_name(url, headers) -- Eg: foo.var local file_name = url:match("[^%w]+([%.%w]+)$") -- Any delimited alphanumeric on the url file_name = file_name or url:match("[^%w]+(%w+)[^%w]+$") -- Random name, hope content-type works file_name = file_name or str:random(5) local content_type = headers["content-type"] local extension = nil if content_type then extension = mimetype.get_mime_extension(content_type) end if extension then file_name = file_name.."."..extension end local disposition = headers["content-disposition"] if disposition then -- attachment; filename=CodeCogsEqn.png file_name = disposition:match('filename=([^;]+)') or file_name end return file_name end -- Saves file to /tmp/. If file_name isn't provided, -- will get the text after the last "/" for filename -- and content-type for extension function download_to_file(url, file_name) print("url to download: "..url) local respbody = {} local options = { url = url, sink = ltn12.sink.table(respbody), redirect = true } -- nil, code, headers, status local response = nil if url:starts('https') then options.redirect = false response = {https.request(options)} else response = {http.request(options)} end local code = response[2] local headers = response[3] local status = response[4] if code ~= 200 then return nil end file_name = file_name or get_http_file_name(url, headers) local file_path = "/tmp/"..file_name print("Saved to: "..file_path) file = io.open(file_path, "w+") file:write(table.concat(respbody)) file:close() return file_path end function vardump(value) print(serpent.block(value, {comment=false})) end -- taken from http://stackoverflow.com/a/11130774/3163199 function scandir(directory) local i, t, popen = 0, {}, io.popen for filename in popen('ls -a "'..directory..'"'):lines() do i = i + 1 t[i] = filename end return t end -- http://www.lua.org/manual/5.2/manual.html#pdf-io.popen function run_command(str) local cmd = io.popen(str) local result = cmd:read('*all') cmd:close() return result end -- User has privileges function is_sudo(msg) local var = false -- Check users id in config for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end -- Returns the name of the sender function get_name(msg) local name = msg.from.first_name if name == nil then name = msg.from.id end return name end -- Returns at table of lua files inside plugins function plugins_names( ) local files = {} for k, v in pairs(scandir("plugins")) do -- Ends with .lua if (v:match(".lua$")) then table.insert(files, v) end end return files end -- Function name explains what it does. function file_exists(name) local f = io.open(name,"r") if f ~= nil then io.close(f) return true else return false end end -- Save into file the data serialized for lua. -- Set uglify true to minify the file. function serialize_to_file(data, file, uglify) file = io.open(file, 'w+') local serialized if not uglify then serialized = serpent.block(data, { comment = false, name = '_' }) else serialized = serpent.dump(data) end file:write(serialized) file:close() end -- Returns true if the string is empty function string:isempty() return self == nil or self == '' end -- Returns true if the string is blank function string:isblank() self = self:trim() return self:isempty() end -- DEPRECATED!!!!! function string.starts(String, Start) print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead") return Start == string.sub(String,1,string.len(Start)) end -- Returns true if String starts with Start function string:starts(text) return text == string.sub(self,1,string.len(text)) end -- Send image to user and delete it when finished. -- cb_function and cb_extra are optionals callback function _send_photo(receiver, file_path, cb_function, cb_extra) local cb_extra = { file_path = file_path, cb_function = cb_function, cb_extra = cb_extra } -- Call to remove with optional callback send_photo(receiver, file_path, cb_function, cb_extra) end -- Download the image and send to receiver, it will be deleted. -- cb_function and cb_extra are optionals callback function send_photo_from_url(receiver, url, cb_function, cb_extra) -- If callback not provided cb_function = cb_function or ok_cb cb_extra = cb_extra or false local file_path = download_to_file(url, false) if not file_path then -- Error local text = 'Error downloading the image' send_msg(receiver, text, cb_function, cb_extra) else print("File path: "..file_path) _send_photo(receiver, file_path, cb_function, cb_extra) end end -- Same as send_photo_from_url but as callback function function send_photo_from_url_callback(cb_extra, success, result) local receiver = cb_extra.receiver local url = cb_extra.url local file_path = download_to_file(url, false) if not file_path then -- Error local text = 'Error downloading the image' send_msg(receiver, text, ok_cb, false) else print("File path: "..file_path) _send_photo(receiver, file_path, ok_cb, false) end end -- Send multiple images asynchronous. -- param urls must be a table. function send_photos_from_url(receiver, urls) local cb_extra = { receiver = receiver, urls = urls, remove_path = nil } send_photos_from_url_callback(cb_extra) end -- Use send_photos_from_url. -- This function might be difficult to understand. function send_photos_from_url_callback(cb_extra, success, result) -- cb_extra is a table containing receiver, urls and remove_path local receiver = cb_extra.receiver local urls = cb_extra.urls local remove_path = cb_extra.remove_path -- The previously image to remove if remove_path ~= nil then os.remove(remove_path) print("Deleted: "..remove_path) end -- Nil or empty, exit case (no more urls) if urls == nil or #urls == 0 then return false end -- Take the head and remove from urls table local head = table.remove(urls, 1) local file_path = download_to_file(head, false) local cb_extra = { receiver = receiver, urls = urls, remove_path = file_path } -- Send first and postpone the others as callback send_photo(receiver, file_path, send_photos_from_url_callback, cb_extra) end -- Callback to remove a file function rmtmp_cb(cb_extra, success, result) local file_path = cb_extra.file_path local cb_function = cb_extra.cb_function or ok_cb local cb_extra = cb_extra.cb_extra if file_path ~= nil then os.remove(file_path) print("Deleted: "..file_path) end -- Finally call the callback cb_function(cb_extra, success, result) end -- Send document to user and delete it when finished. -- cb_function and cb_extra are optionals callback function _send_document(receiver, file_path, cb_function, cb_extra) local cb_extra = { file_path = file_path, cb_function = cb_function or ok_cb, cb_extra = cb_extra or false } -- Call to remove with optional callback send_document(receiver, file_path, rmtmp_cb, cb_extra) end -- Download the image and send to receiver, it will be deleted. -- cb_function and cb_extra are optionals callback function send_document_from_url(receiver, url, cb_function, cb_extra) local file_path = download_to_file(url, false) print("File path: "..file_path) _send_document(receiver, file_path, cb_function, cb_extra) end -- Parameters in ?a=1&b=2 style function format_http_params(params, is_get) local str = '' -- If is get add ? to the beginning if is_get then str = '?' end local first = true -- Frist param for k,v in pairs (params) do if v then -- nil value if first then first = false str = str..k.. "="..v else str = str.."&"..k.. "="..v end end end return str end -- Check if user can use the plugin and warns user -- Returns true if user was warned and false if not warned (is allowed) function warns_user_not_allowed(plugin, msg) if not user_allowed(plugin, msg) then local text = 'This plugin requires privileged user' local receiver = get_receiver(msg) send_msg(receiver, text, ok_cb, false) return true else return false end end -- Check if user can use the plugin function user_allowed(plugin, msg) if plugin.privileged and not is_sudo(msg) then return false end return true end function send_order_msg(destination, msgs) local cb_extra = { destination = destination, msgs = msgs } send_order_msg_callback(cb_extra, true) end function send_order_msg_callback(cb_extra, success, result) local destination = cb_extra.destination local msgs = cb_extra.msgs local file_path = cb_extra.file_path if file_path ~= nil then os.remove(file_path) print("Deleted: " .. file_path) end if type(msgs) == 'string' then send_large_msg(destination, msgs) elseif type(msgs) ~= 'table' then return end if #msgs < 1 then return end local msg = table.remove(msgs, 1) local new_cb_extra = { destination = destination, msgs = msgs } if type(msg) == 'string' then send_msg(destination, msg, send_order_msg_callback, new_cb_extra) elseif type(msg) == 'table' then local typ = msg[1] local nmsg = msg[2] new_cb_extra.file_path = nmsg if typ == 'document' then send_document(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'image' or typ == 'photo' then send_photo(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'audio' then send_audio(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'video' then send_video(destination, nmsg, send_order_msg_callback, new_cb_extra) else send_file(destination, nmsg, send_order_msg_callback, new_cb_extra) end end end -- Same as send_large_msg_callback but friendly params function send_large_msg(destination, text) local cb_extra = { destination = destination, text = text } send_large_msg_callback(cb_extra, true) end -- If text is longer than 4096 chars, send multiple msg. -- https://core.telegram.org/method/messages.sendMessage function send_large_msg_callback(cb_extra, success, result) local text_max = 4096 local destination = cb_extra.destination local text = cb_extra.text local text_len = string.len(text) local num_msg = math.ceil(text_len / text_max) if num_msg <= 1 then send_msg(destination, text, ok_cb, false) else local my_text = string.sub(text, 1, 4096) local rest = string.sub(text, 4096, text_len) local cb_extra = { destination = destination, text = rest } send_msg(destination, my_text, send_large_msg_callback, cb_extra) end end -- Returns a table with matches or nil function match_pattern(pattern, text, lower_case) if text then local matches = {} if lower_case then matches = { string.match(text:lower(), pattern) } else matches = { string.match(text, pattern) } end if next(matches) then return matches end end -- nil end -- Function to read data from files function load_from_file(file, default_data) local f = io.open(file, "r+") -- If file doesn't exists if f == nil then -- Create a new empty table default_data = default_data or {} serialize_to_file(default_data, file) print ('Created file', file) else print ('Data loaded from file', file) f:close() end return loadfile (file)() end -- See http://stackoverflow.com/a/14899740 function unescape_html(str) local map = { ["lt"] = "<", ["gt"] = ">", ["amp"] = "&", ["quot"] = '"', ["apos"] = "'" } new = string.gsub(str, '(&(#?x?)([%d%a]+);)', function(orig, n, s) var = map[s] or n == "#" and string.char(s) var = var or n == "#x" and string.char(tonumber(s,16)) var = var or orig return var end) return new end --Check if this chat is realm or not function is_realm(msg) local var = false local realms = 'realms' local data = load_data(_config.moderation.data) local chat = msg.to.id if data[tostring(realms)] then if data[tostring(realms)][tostring(msg.to.id)] then var = true end return var end end --Check if this chat is a group or not function is_group(msg) local var = false local groups = 'groups' local data = load_data(_config.moderation.data) local chat = msg.to.id if data[tostring(groups)] then if data[tostring(groups)][tostring(msg.to.id)] then var = true end return var end end function savelog(group, logtxt) local text = (os.date("[ %c ]=> "..logtxt.."\n \n")) local file = io.open("./groups/logs/"..group.."log.txt", "a") file:write(text) file:close() end function user_print_name(user) if user.print_name then return user.print_name end local text = '' if user.first_name then text = user.last_name..' ' end if user.lastname then text = text..user.last_name end return text end --Check if user is the owner of that group or not function is_owner(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['set_owner'] then if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then var = true end end end if data['admins'] then if data['admins'][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_owner2(user_id, group_id) local var = false local data = load_data(_config.moderation.data) if data[tostring(group_id)] then if data[tostring(group_id)]['set_owner'] then if data[tostring(group_id)]['set_owner'] == tostring(user_id) then var = true end end end if data['admins'] then if data['admins'][tostring(user_id)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == user_id then var = true end end return var end --Check if user is admin or not function is_admin(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id local admins = 'admins' if data[tostring(admins)] then if data[tostring(admins)][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_admin2(user_id) local var = false local data = load_data(_config.moderation.data) local user = user_id local admins = 'admins' if data[tostring(admins)] then if data[tostring(admins)][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == user_id then var = true end end return var end --Check if user is the mod of that group or not function is_momod(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['moderators'] then if data[tostring(msg.to.id)]['moderators'][tostring(user)] then var = true end end end if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['set_owner'] then if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then var = true end end end if data['admins'] then if data['admins'][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_momod2(user_id, group_id) local var = false local data = load_data(_config.moderation.data) local usert = user_id if data[tostring(group_id)] then if data[tostring(group_id)]['moderators'] then if data[tostring(group_id)]['moderators'][tostring(usert)] then var = true end end end if data[tostring(group_id)] then if data[tostring(group_id)]['set_owner'] then if data[tostring(group_id)]['set_owner'] == tostring(user_id) then var = true end end end if data['admins'] then if data['admins'][tostring(user_id)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == usert then var = true end end return var end -- Returns the name of the sender function kick_user(user_id, chat_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_owner2(user_id, chat_id) then -- Ignore admins return end local chat = 'chat#id'..chat_id local user = 'user#id'..user_id chat_del_user(chat, user, ok_cb, true) end -- Ban function ban_user(user_id, chat_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_admin2(user_id) then -- Ignore admins return end -- Save to redis local hash = 'banned:'..chat_id redis:sadd(hash, user_id) -- Kick from chat kick_user(user_id, chat_id) end -- Global ban function banall_user(user_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_admin2(user_id) then -- Ignore admins return end -- Save to redis local hash = 'gbanned' redis:sadd(hash, user_id) end -- Global unban function unbanall_user(user_id) --Save on redis local hash = 'gbanned' redis:srem(hash, user_id) end -- Check if user_id is banned in chat_id or not function is_banned(user_id, chat_id) --Save on redis local hash = 'banned:'..chat_id local banned = redis:sismember(hash, user_id) return banned or false end -- Check if user_id is globally banned or not function is_gbanned(user_id) --Save on redis local hash = 'gbanned' local banned = redis:sismember(hash, user_id) return banned or false end -- Returns chat_id ban list function ban_list(chat_id) local hash = 'banned:'..chat_id local list = redis:smembers(hash) local text = "Ban list !\n\n" for k,v in pairs(list) do local user_info = redis:hgetall('user:'..v) if user_info and user_info.print_name then text = text..k.." - "..string.gsub(user_info.print_name, "_", " ").." ["..v.."]\n" else text = text..k.." - "..v.."\n" end end return text end -- Returns globally ban list function banall_list() local hash = 'gbanned' local list = redis:smembers(hash) local text = "global bans !\n\n" for k,v in pairs(list) do local user_info = redis:hgetall('user:'..v) if user_info and user_info.print_name then text = text..k.." - "..string.gsub(user_info.print_name, "_", " ").." ["..v.."]\n" else text = text..k.." - "..v.."\n" end end return text end -- /id by reply function get_message_callback_id(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id send_large_msg(chat, result.from.id) else return 'Use This in Your Groups' end end -- kick by reply for mods and owner function Kick_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't kick myself" end if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin return "you can't kick mods,owner and admins" end chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) else return 'Use This in Your Groups' end end -- Kick by reply for admins function Kick_by_reply_admins(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't kick myself" end if is_admin2(result.from.id) then -- Ignore admins return end chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) else return 'Use This in Your Groups' end end --Ban by reply for admins function ban_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't ban myself" end if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin return "you can't kick mods,owner and admins" end ban_user(result.from.id, result.to.id) send_large_msg(chat, "User "..result.from.id.." Banned") else return 'Use This in Your Groups' end end -- Ban by reply for admins function ban_by_reply_admins(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't ban myself" end if is_admin2(result.from.id) then -- Ignore admins return end ban_user(result.from.id, result.to.id) send_large_msg(chat, "User "..result.from.id.." Banned") else return 'Use This in Your Groups' end end -- Unban by reply function unban_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't unban myself" end send_large_msg(chat, "User "..result.from.id.." Unbanned") -- Save on redis local hash = 'banned:'..result.to.id redis:srem(hash, result.from.id) else return 'Use This in Your Groups' end end function banall_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't banall myself" end if is_admin2(result.from.id) then -- Ignore admins return end local name = user_print_name(result.from) banall_user(result.from.id) chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) send_large_msg(chat, "User "..name.."["..result.from.id.."] hammered") else return 'Use This in Your Groups' end end
gpl-2.0
weiDDD/WSSParticleSystem
cocos2d/cocos/scripting/lua-bindings/auto/api/ParallaxNode.lua
1
2060
-------------------------------- -- @module ParallaxNode -- @extend Node -- @parent_module cc -------------------------------- -- Adds a child to the container with a local z-order, parallax ratio and position offset.<br> -- param child A child node.<br> -- param z Z order for drawing priority.<br> -- param parallaxRatio A given parallax ratio.<br> -- param positionOffset A given position offset. -- @function [parent=#ParallaxNode] addChild -- @param self -- @param #cc.Node child -- @param #int z -- @param #vec2_table parallaxRatio -- @param #vec2_table positionOffset -- @return ParallaxNode#ParallaxNode self (return value: cc.ParallaxNode) -------------------------------- -- -- @function [parent=#ParallaxNode] removeAllChildrenWithCleanup -- @param self -- @param #bool cleanup -- @return ParallaxNode#ParallaxNode self (return value: cc.ParallaxNode) -------------------------------- -- Create a Parallax node. <br> -- return An autoreleased ParallaxNode object. -- @function [parent=#ParallaxNode] create -- @param self -- @return ParallaxNode#ParallaxNode ret (return value: cc.ParallaxNode) -------------------------------- -- @overload self, cc.Node, int, string -- @overload self, cc.Node, int, int -- @function [parent=#ParallaxNode] addChild -- @param self -- @param #cc.Node child -- @param #int zOrder -- @param #int tag -- @return ParallaxNode#ParallaxNode self (return value: cc.ParallaxNode) -------------------------------- -- -- @function [parent=#ParallaxNode] visit -- @param self -- @param #cc.Renderer renderer -- @param #mat4_table parentTransform -- @param #unsigned int parentFlags -- @return ParallaxNode#ParallaxNode self (return value: cc.ParallaxNode) -------------------------------- -- -- @function [parent=#ParallaxNode] removeChild -- @param self -- @param #cc.Node child -- @param #bool cleanup -- @return ParallaxNode#ParallaxNode self (return value: cc.ParallaxNode) return nil
apache-2.0
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/armorsmith/masterArmorsmith/compositeArmorRightBicep.lua
1
5161
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. compositeArmorRightBicep = Object:new { objectName = "Composite Armor Right Bicep", stfName = "armor_composite_bicep_r", stfFile = "wearables_name", objectCRC = 1081487272, groupName = "craftArmorPersonalGroupF", -- Group schematic is awarded in (See skills table) craftingToolTab = 2, -- (See DraftSchemticImplementation.h) complexity = 45, size = 4, xpType = "crafting_clothing_armor", xp = 420, assemblySkill = "armor_assembly", experimentingSkill = "armor_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "auxilary_coverage, body, liner, hardware_and_attachments, binding_and_reinforcement, padding, armor, load_bearing_harness, reinforcement", ingredientSlotType = "0, 0, 0, 0, 0, 0, 1, 2, 2", resourceTypes = "ore_intrusive, fuel_petrochem_solid_known, fiberplast_naboo, aluminum, copper_beyrllius, hide_wooly, object/tangible/component/armor/shared_armor_segment_composite.iff, object/tangible/component/clothing/shared_synthetic_cloth.iff, object/tangible/component/clothing/shared_reinforced_fiber_panels.iff", resourceQuantities = "50, 50, 25, 30, 20, 20, 2, 1, 1", combineTypes = "0, 0, 0, 0, 0, 0, 1, 1, 1", contribution = "100, 100, 100, 100, 100, 100, 100, 100, 100", numberExperimentalProperties = "1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 1", experimentalProperties = "XX, XX, XX, XX, OQ, SR, OQ, UT, MA, OQ, MA, OQ, MA, OQ, XX, XX, OQ, SR, XX", experimentalWeights = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalGroupTitles = "null, null, null, exp_durability, exp_quality, exp_resistance, exp_durability, exp_durability, exp_durability, null, null, exp_resistance, null", experimentalSubGroupTitles = "null, null, sockets, hit_points, armor_effectiveness, armor_integrity, armor_health_encumbrance, armor_action_encumbrance, armor_mind_encumbrance, armor_rating, armor_special_type, armor_special_effectiveness, armor_special_integrity", experimentalMin = "0, 0, 0, 1000, 1, 30000, 25, 22, 25, 1, 0, 0, 0", experimentalMax = "0, 0, 0, 1000, 40, 50000, 15, 13, 15, 1, 0, 0, 0", experimentalPrecision = "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", tanoAttributes = "objecttype=261:objectcrc=1668390786:stfFile=wearables_name:stfName=armor_composite_bicep_r:stfDetail=:itemmask=62975:customattributes=specialprotection=restraineffectiveness;vunerability=stuneffectiveness;armorPiece=261;armorStyle=4097;:", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "/private/index_color_1", customizationDefaults = "0", customizationSkill = "armor_customization" } DraftSchematics:addDraftSchematic(compositeArmorRightBicep, 1081487272)--- Add to global DraftSchematics table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/slashcommands/generic/applyPowerup.lua
1
2454
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 ApplyPowerupSlashCommand = { name = "applypowerup", alternativeNames = "", animation = "", invalidStateMask = 2097152, --glowingJedi, invalidPostures = "12,13,14,", target = 2, targeType = 1, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 0, } AddApplyPowerupSlashCommand(ApplyPowerupSlashCommand)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/tailor/casualWearIvComplexClothing/twilekLekkuWrap.lua
1
4315
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. twilekLekkuWrap = Object:new { objectName = "Twi'lek Lekku Wrap", stfName = "hat_twilek_s02", stfFile = "wearables_name", objectCRC = 1138623015, groupName = "craftClothingCasualGroupD", -- Group schematic is awarded in (See skills table) craftingToolTab = 8, -- (See DraftSchemticImplementation.h) complexity = 17, size = 1, xpType = "crafting_clothing_general", xp = 110, assemblySkill = "clothing_assembly", experimentingSkill = "clothing_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "shell, binding_and_weatherproofing, liner", ingredientSlotType = "0, 0, 1", resourceTypes = ", petrochem_inert_polymer, object/tangible/component/clothing/shared_synthetic_cloth.iff", resourceQuantities = "0, 40, 2", combineTypes = "0, 0, 1", contribution = "100, 100, 100", numberExperimentalProperties = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalProperties = "XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX", experimentalWeights = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalGroupTitles = "null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null", experimentalSubGroupTitles = "null, null, sockets, hitpoints, mod_idx_one, mod_val_one, mod_idx_two, mod_val_two, mod_idx_three, mod_val_three, mod_idx_four, mod_val_four, mod_idx_five, mod_val_five, mod_idx_six, mod_val_six", experimentalMin = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", experimentalMax = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", experimentalPrecision = "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", tanoAttributes = "objecttype=:objectcrc=3374602318:stfFile=:stfName=:stfDetail=:itemmask=65535::", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "/private/index_color_1", customizationDefaults = "103", customizationSkill = "clothing_customization" } DraftSchematics:addDraftSchematic(twilekLekkuWrap, 1138623015)--- Add to global DraftSchematics table
lgpl-3.0
weiDDD/WSSParticleSystem
cocos2d/cocos/scripting/lua-bindings/script/framework/audio.lua
1
5853
--[[ Copyright (c) 2011-2014 chukong-inc.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] local audio = {} local engine = cc.SimpleAudioEngine:getInstance() function audio.getMusicVolume() local volume = engine:getMusicVolume() if DEBUG > 1 then printf("[audio] getMusicVolume() - volume: %0.2f", volume) end return volume end function audio.setMusicVolume(volume) volume = checknumber(volume) if DEBUG > 1 then printf("[audio] setMusicVolume() - volume: %0.2f", volume) end engine:setMusicVolume(volume) end function audio.preloadMusic(filename) assert(filename, "audio.preloadMusic() - invalid filename") if DEBUG > 1 then printf("[audio] preloadMusic() - filename: %s", tostring(filename)) end engine:preloadMusic(filename) end function audio.playMusic(filename, isLoop) assert(filename, "audio.playMusic() - invalid filename") if type(isLoop) ~= "boolean" then isLoop = true end audio.stopMusic() if DEBUG > 1 then printf("[audio] playMusic() - filename: %s, isLoop: %s", tostring(filename), tostring(isLoop)) end engine:playMusic(filename, isLoop) end function audio.stopMusic(isReleaseData) isReleaseData = checkbool(isReleaseData) if DEBUG > 1 then printf("[audio] stopMusic() - isReleaseData: %s", tostring(isReleaseData)) end engine:stopMusic(isReleaseData) end function audio.pauseMusic() if DEBUG > 1 then printf("[audio] pauseMusic()") end engine:pauseMusic() end function audio.resumeMusic() if DEBUG > 1 then printf("[audio] resumeMusic()") end engine:resumeMusic() end function audio.rewindMusic() if DEBUG > 1 then printf("[audio] rewindMusic()") end engine:rewindMusic() end function audio.isMusicPlaying() local ret = engine:isMusicPlaying() if DEBUG > 1 then printf("[audio] isMusicPlaying() - ret: %s", tostring(ret)) end return ret end function audio.getSoundsVolume() local volume = engine:getEffectsVolume() if DEBUG > 1 then printf("[audio] getSoundsVolume() - volume: %0.1f", volume) end return volume end function audio.setSoundsVolume(volume) volume = checknumber(volume) if DEBUG > 1 then printf("[audio] setSoundsVolume() - volume: %0.1f", volume) end engine:setEffectsVolume(volume) end function audio.playSound(filename, isLoop) if not filename then printError("audio.playSound() - invalid filename") return end if type(isLoop) ~= "boolean" then isLoop = false end if DEBUG > 1 then printf("[audio] playSound() - filename: %s, isLoop: %s", tostring(filename), tostring(isLoop)) end return engine:playEffect(filename, isLoop) end function audio.pauseSound(handle) if not handle then printError("audio.pauseSound() - invalid handle") return end if DEBUG > 1 then printf("[audio] pauseSound() - handle: %s", tostring(handle)) end engine:pauseEffect(handle) end function audio.pauseAllSounds() if DEBUG > 1 then printf("[audio] pauseAllSounds()") end engine:pauseAllEffects() end function audio.resumeSound(handle) if not handle then printError("audio.resumeSound() - invalid handle") return end if DEBUG > 1 then printf("[audio] resumeSound() - handle: %s", tostring(handle)) end engine:resumeEffect(handle) end function audio.resumeAllSounds() if DEBUG > 1 then printf("[audio] resumeAllSounds()") end engine:resumeAllEffects() end function audio.stopSound(handle) if not handle then printError("audio.stopSound() - invalid handle") return end if DEBUG > 1 then printf("[audio] stopSound() - handle: %s", tostring(handle)) end engine:stopEffect(handle) end function audio.stopAllSounds() if DEBUG > 1 then printf("[audio] stopAllSounds()") end engine:stopAllEffects() end audio.stopAllEffects = audio.stopAllSounds function audio.preloadSound(filename) if not filename then printError("audio.preloadSound() - invalid filename") return end if DEBUG > 1 then printf("[audio] preloadSound() - filename: %s", tostring(filename)) end engine:preloadEffect(filename) end function audio.unloadSound(filename) if not filename then printError("audio.unloadSound() - invalid filename") return end if DEBUG > 1 then printf("[audio] unloadSound() - filename: %s", tostring(filename)) end engine:unloadEffect(filename) end return audio
apache-2.0
bartvm/Penlight
lua/pl/array2d.lua
26
13368
--- Operations on two-dimensional arrays. -- See @{02-arrays.md.Operations_on_two_dimensional_tables|The Guide} -- -- Dependencies: `pl.utils`, `pl.tablex`, `pl.types` -- @module pl.array2d local type,tonumber,assert,tostring,io,ipairs,string,table = _G.type,_G.tonumber,_G.assert,_G.tostring,_G.io,_G.ipairs,_G.string,_G.table local setmetatable,getmetatable = setmetatable,getmetatable local tablex = require 'pl.tablex' local utils = require 'pl.utils' local types = require 'pl.types' local imap,tmap,reduce,keys,tmap2,tset,index_by = tablex.imap,tablex.map,tablex.reduce,tablex.keys,tablex.map2,tablex.set,tablex.index_by local remove = table.remove local splitv,fprintf,assert_arg = utils.splitv,utils.fprintf,utils.assert_arg local byte = string.byte local stdout = io.stdout local array2d = {} local function obj (int,out) local mt = getmetatable(int) if mt then setmetatable(out,mt) end return out end local function makelist (res) return setmetatable(res,utils.stdmt.List) end local function index (t,k) return t[k] end --- return the row and column size. -- @array2d t a 2d array -- @treturn int number of rows -- @treturn int number of cols function array2d.size (t) assert_arg(1,t,'table') return #t,#t[1] end --- extract a column from the 2D array. -- @array2d a 2d array -- @param key an index or key -- @return 1d array function array2d.column (a,key) assert_arg(1,a,'table') return makelist(imap(index,a,key)) end local column = array2d.column --- map a function over a 2D array -- @func f a function of at least one argument -- @array2d a 2d array -- @param arg an optional extra argument to be passed to the function. -- @return 2d array function array2d.map (f,a,arg) assert_arg(1,a,'table') f = utils.function_arg(1,f) return obj(a,imap(function(row) return imap(f,row,arg) end, a)) end --- reduce the rows using a function. -- @func f a binary function -- @array2d a 2d array -- @return 1d array -- @see pl.tablex.reduce function array2d.reduce_rows (f,a) assert_arg(1,a,'table') return tmap(function(row) return reduce(f,row) end, a) end --- reduce the columns using a function. -- @func f a binary function -- @array2d a 2d array -- @return 1d array -- @see pl.tablex.reduce function array2d.reduce_cols (f,a) assert_arg(1,a,'table') return tmap(function(c) return reduce(f,column(a,c)) end, keys(a[1])) end --- reduce a 2D array into a scalar, using two operations. -- @func opc operation to reduce the final result -- @func opr operation to reduce the rows -- @param a 2D array function array2d.reduce2 (opc,opr,a) assert_arg(3,a,'table') local tmp = array2d.reduce_rows(opr,a) return reduce(opc,tmp) end local function dimension (t) return type(t[1])=='table' and 2 or 1 end --- map a function over two arrays. -- They can be both or either 2D arrays -- @func f function of at least two arguments -- @int ad order of first array (1 or 2) -- @int bd order of second array (1 or 2) -- @tab a 1d or 2d array -- @tab b 1d or 2d array -- @param arg optional extra argument to pass to function -- @return 2D array, unless both arrays are 1D function array2d.map2 (f,ad,bd,a,b,arg) assert_arg(1,a,'table') assert_arg(2,b,'table') f = utils.function_arg(1,f) if ad == 1 and bd == 2 then return imap(function(row) return tmap2(f,a,row,arg) end, b) elseif ad == 2 and bd == 1 then return imap(function(row) return tmap2(f,row,b,arg) end, a) elseif ad == 1 and bd == 1 then return tmap2(f,a,b) elseif ad == 2 and bd == 2 then return tmap2(function(rowa,rowb) return tmap2(f,rowa,rowb,arg) end, a,b) end end --- cartesian product of two 1d arrays. -- @func f a function of 2 arguments -- @array t1 a 1d table -- @array t2 a 1d table -- @return 2d table -- @usage product('..',{1,2},{'a','b'}) == {{'1a','2a'},{'1b','2b'}} function array2d.product (f,t1,t2) f = utils.function_arg(1,f) assert_arg(2,t1,'table') assert_arg(3,t2,'table') local res, map = {}, tablex.map for i,v in ipairs(t2) do res[i] = map(f,t1,v) end return res end --- flatten a 2D array. -- (this goes over columns first.) -- @array2d t 2d table -- @return a 1d table -- @usage flatten {{1,2},{3,4},{5,6}} == {1,2,3,4,5,6} function array2d.flatten (t) local res = {} local k = 1 for _,a in ipairs(t) do -- for all rows for i = 1,#a do res[k] = a[i] k = k + 1 end end return makelist(res) end --- reshape a 2D array. -- @array2d t 2d array -- @int nrows new number of rows -- @bool co column-order (Fortran-style) (default false) -- @return a new 2d array function array2d.reshape (t,nrows,co) local nr,nc = array2d.size(t) local ncols = nr*nc / nrows local res = {} local ir,ic = 1,1 for i = 1,nrows do local row = {} for j = 1,ncols do row[j] = t[ir][ic] if not co then ic = ic + 1 if ic > nc then ir = ir + 1 ic = 1 end else ir = ir + 1 if ir > nr then ic = ic + 1 ir = 1 end end end res[i] = row end return obj(t,res) end --- swap two rows of an array. -- @array2d t a 2d array -- @int i1 a row index -- @int i2 a row index function array2d.swap_rows (t,i1,i2) assert_arg(1,t,'table') t[i1],t[i2] = t[i2],t[i1] end --- swap two columns of an array. -- @array2d t a 2d array -- @int j1 a column index -- @int j2 a column index function array2d.swap_cols (t,j1,j2) assert_arg(1,t,'table') for i = 1,#t do local row = t[i] row[j1],row[j2] = row[j2],row[j1] end end --- extract the specified rows. -- @array2d t 2d array -- @tparam {int} ridx a table of row indices function array2d.extract_rows (t,ridx) return obj(t,index_by(t,ridx)) end --- extract the specified columns. -- @array2d t 2d array -- @tparam {int} cidx a table of column indices function array2d.extract_cols (t,cidx) assert_arg(1,t,'table') local res = {} for i = 1,#t do res[i] = index_by(t[i],cidx) end return obj(t,res) end --- remove a row from an array. -- @function array2d.remove_row -- @array2d t a 2d array -- @int i a row index array2d.remove_row = remove --- remove a column from an array. -- @array2d t a 2d array -- @int j a column index function array2d.remove_col (t,j) assert_arg(1,t,'table') for i = 1,#t do remove(t[i],j) end end local Ai = byte 'A' local function _parse (s) local c,r if s:sub(1,1) == 'R' then r,c = s:match 'R(%d+)C(%d+)' r,c = tonumber(r),tonumber(c) else c,r = s:match '(.)(.)' c = byte(c) - byte 'A' + 1 r = tonumber(r) end assert(c ~= nil and r ~= nil,'bad cell specifier: '..s) return r,c end --- parse a spreadsheet range. -- The range can be specified either as 'A1:B2' or 'R1C1:R2C2'; -- a special case is a single element (e.g 'A1' or 'R1C1') -- @string s a range. -- @treturn int start col -- @treturn int start row -- @treturn int end col -- @treturn int end row function array2d.parse_range (s) if s:find ':' then local start,finish = splitv(s,':') local i1,j1 = _parse(start) local i2,j2 = _parse(finish) return i1,j1,i2,j2 else -- single value local i,j = _parse(s) return i,j end end --- get a slice of a 2D array using spreadsheet range notation. @see parse_range -- @array2d t a 2D array -- @string rstr range expression -- @return a slice -- @see array2d.parse_range -- @see array2d.slice function array2d.range (t,rstr) assert_arg(1,t,'table') local i1,j1,i2,j2 = array2d.parse_range(rstr) if i2 then return array2d.slice(t,i1,j1,i2,j2) else -- single value return t[i1][j1] end end local function default_range (t,i1,j1,i2,j2) local nr, nc = array2d.size(t) i1,j1 = i1 or 1, j1 or 1 i2,j2 = i2 or nr, j2 or nc if i2 < 0 then i2 = nr + i2 + 1 end if j2 < 0 then j2 = nc + j2 + 1 end return i1,j1,i2,j2 end --- get a slice of a 2D array. Note that if the specified range has -- a 1D result, the rank of the result will be 1. -- @array2d t a 2D array -- @int i1 start row (default 1) -- @int j1 start col (default 1) -- @int i2 end row (default N) -- @int j2 end col (default M) -- @return an array, 2D in general but 1D in special cases. function array2d.slice (t,i1,j1,i2,j2) assert_arg(1,t,'table') i1,j1,i2,j2 = default_range(t,i1,j1,i2,j2) local res = {} for i = i1,i2 do local val local row = t[i] if j1 == j2 then val = row[j1] else val = {} for j = j1,j2 do val[#val+1] = row[j] end end res[#res+1] = val end if i1 == i2 then res = res[1] end return obj(t,res) end --- set a specified range of an array to a value. -- @array2d t a 2D array -- @param value the value (may be a function) -- @int i1 start row (default 1) -- @int j1 start col (default 1) -- @int i2 end row (default N) -- @int j2 end col (default M) -- @see tablex.set function array2d.set (t,value,i1,j1,i2,j2) i1,j1,i2,j2 = default_range(t,i1,j1,i2,j2) for i = i1,i2 do tset(t[i],value,j1,j2) end end --- write a 2D array to a file. -- @array2d t a 2D array -- @param f a file object (default stdout) -- @string fmt a format string (default is just to use tostring) -- @int i1 start row (default 1) -- @int j1 start col (default 1) -- @int i2 end row (default N) -- @int j2 end col (default M) function array2d.write (t,f,fmt,i1,j1,i2,j2) assert_arg(1,t,'table') f = f or stdout local rowop if fmt then rowop = function(row,j) fprintf(f,fmt,row[j]) end else rowop = function(row,j) f:write(tostring(row[j]),' ') end end local function newline() f:write '\n' end array2d.forall(t,rowop,newline,i1,j1,i2,j2) end --- perform an operation for all values in a 2D array. -- @array2d t 2D array -- @func row_op function to call on each value -- @func end_row_op function to call at end of each row -- @int i1 start row (default 1) -- @int j1 start col (default 1) -- @int i2 end row (default N) -- @int j2 end col (default M) function array2d.forall (t,row_op,end_row_op,i1,j1,i2,j2) assert_arg(1,t,'table') i1,j1,i2,j2 = default_range(t,i1,j1,i2,j2) for i = i1,i2 do local row = t[i] for j = j1,j2 do row_op(row,j) end if end_row_op then end_row_op(i) end end end local min, max = math.min, math.max ---- move a block from the destination to the source. -- @array2d dest a 2D array -- @int di start row in dest -- @int dj start col in dest -- @array2d src a 2D array -- @int i1 start row (default 1) -- @int j1 start col (default 1) -- @int i2 end row (default N) -- @int j2 end col (default M) function array2d.move (dest,di,dj,src,i1,j1,i2,j2) assert_arg(1,dest,'table') assert_arg(4,src,'table') i1,j1,i2,j2 = default_range(src,i1,j1,i2,j2) local nr,nc = array2d.size(dest) i2, j2 = min(nr,i2), min(nc,j2) --i1, j1 = max(1,i1), max(1,j1) dj = dj - 1 for i = i1,i2 do local drow, srow = dest[i+di-1], src[i] for j = j1,j2 do drow[j+dj] = srow[j] end end end --- iterate over all elements in a 2D array, with optional indices. -- @array2d a 2D array -- @tparam {int} indices with indices (default false) -- @int i1 start row (default 1) -- @int j1 start col (default 1) -- @int i2 end row (default N) -- @int j2 end col (default M) -- @return either value or i,j,value depending on indices function array2d.iter (a,indices,i1,j1,i2,j2) assert_arg(1,a,'table') local norowset = not (i2 and j2) i1,j1,i2,j2 = default_range(a,i1,j1,i2,j2) local n,i,j = i2-i1+1,i1-1,j1-1 local row,nr = nil,0 local onr = j2 - j1 + 1 return function() j = j + 1 if j > nr then j = j1 i = i + 1 if i > i2 then return nil end row = a[i] nr = norowset and #row or onr end if indices then return i,j,row[j] else return row[j] end end end --- iterate over all columns. -- @array2d a a 2D array -- @return each column in turn function array2d.columns (a) assert_arg(1,a,'table') local n = a[1][1] local i = 0 return function() i = i + 1 if i > n then return nil end return column(a,i) end end --- new array of specified dimensions -- @int rows number of rows -- @int cols number of cols -- @param val initial value; if it's a function then use `val(i,j)` -- @return new 2d array function array2d.new(rows,cols,val) local res = {} local fun = types.is_callable(val) for i = 1,rows do local row = {} if fun then for j = 1,cols do row[j] = val(i,j) end else for j = 1,cols do row[j] = val end end res[i] = row end return res end return array2d
mit
TheAnswer/FirstTest
bin/scripts/object/tangible/component/item/quest_item/objects.lua
1
23046
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_tangible_component_item_quest_item_shared_corrective_inducer = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:corrective_inducer", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:corrective_inducer", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:corrective_inducer", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_corrective_inducer, 2184126369) object_tangible_component_item_quest_item_shared_current_motivator = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:current_motivator", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:current_motivator", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:current_motivator", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_current_motivator, 899191445) object_tangible_component_item_quest_item_shared_cycle_control = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:cycle_control", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:cycle_control", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:cycle_control", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_cycle_control, 361454355) object_tangible_component_item_quest_item_shared_decoherence_sensor = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:decoherence_sensor", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:decoherence_sensor", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:decoherence_sensor", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_decoherence_sensor, 2146196136) object_tangible_component_item_quest_item_shared_directional_sensor = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:directional_sensor", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:directional_sensor", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:directional_sensor", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_directional_sensor, 3309489661) object_tangible_component_item_quest_item_shared_loop_auditor = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:loop_auditor", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:loop_auditor", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:loop_auditor", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_loop_auditor, 111523036) object_tangible_component_item_quest_item_shared_momentum_compensator = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:momentum_compensator", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:momentum_compensator", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:momentum_compensator", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_momentum_compensator, 2600965554) object_tangible_component_item_quest_item_shared_particle_sensor = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:particle_sensor", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:particle_sensor", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:particle_sensor", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_particle_sensor, 1180256886) object_tangible_component_item_quest_item_shared_signal_cleanup_unit = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:signal_cleanup_unit", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:signal_cleanup_unit", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:signal_cleanup_unit", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_signal_cleanup_unit, 754272347) object_tangible_component_item_quest_item_shared_signal_rerouter = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:signal_rerouter", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:signal_rerouter", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:signal_rerouter", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_signal_rerouter, 2201370721) object_tangible_component_item_quest_item_shared_spin_alignment_inducer = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:spin_alignment_inducer", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:spin_alignment_inducer", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:spin_alignment_inducer", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_spin_alignment_inducer, 529542099) object_tangible_component_item_quest_item_shared_transductive_shunt = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:transductive_shunt", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:transductive_shunt", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:transductive_shunt", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_transductive_shunt, 3561575461) object_tangible_component_item_quest_item_shared_tuning_cell = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:tuning_cell", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:tuning_cell", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:tuning_cell", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_tuning_cell, 815023209) object_tangible_component_item_quest_item_shared_variance_throttle = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:variance_throttle", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:variance_throttle", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:variance_throttle", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_variance_throttle, 3604740995) object_tangible_component_item_quest_item_shared_voltage_inducer = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_comp_electronic_module_complex.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@weapon_detail:voltage_inducer", gameObjectType = 262144, locationReservationRadius = 0, lookAtText = "@weapon_lookat:voltage_inducer", noBuildRadius = 0, objectName = "@craft_item_ingredients_n:voltage_inducer", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_component_item_quest_item_shared_voltage_inducer, 373412997)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/skills/creatureSkills/endor/creatures/borgleAttacks.lua
1
4955
borgleAttack1 = { attackname = "borgleAttack1", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 4, arearange = 7, accuracyBonus = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 50, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(borgleAttack1) --------------------------------------------------------------------------------------- borgleAttack2 = { attackname = "borgleAttack2", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 4, arearange = 7, accuracyBonus = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 50, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(borgleAttack2) --------------------------------------------------------------------------------------- borgleAttack3 = { attackname = "borgleAttack3", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 4, arearange = 7, accuracyBonus = 0, knockdownChance = 0, postureDownChance = 50, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(borgleAttack3) --------------------------------------------------------------------------------------- borgleAttack4 = { attackname = "borgleAttack4", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 4, arearange = 7, accuracyBonus = 0, healthAttackChance = 100, actionAttackChance = 0, mindAttackChance = 0, dotChance = 50, tickStrengthOfHit = 1, fireStrength = 0, fireType = 0, bleedingStrength = 0, bleedingType = 0, poisonStrength = 0, poisonType = 0, diseaseStrength = 100, diseaseType = HEALTH, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddDotPoolAttackTargetSkill(borgleAttack4) -------------------------------------------------------------------------------------- borgleAttack5 = { attackname = "borgleAttack5", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 4, arearange = 7, accuracyBonus = 0, knockdownChance = 50, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(borgleAttack5) ---------------------------------------------------------------------------------------
lgpl-3.0
praveenjha527/Algorithm-Implementations
Rabin_Karp/Lua/Yonaba/rabin_karp_test.lua
26
1214
-- Tests for rabin_karp.lua local rabin_karp = require 'rabin_karp' local total, pass = 0, 0 local function dec(str, len) return #str < len and str .. (('.'):rep(len-#str)) or str:sub(1,len) end local function run(message, f) total = total + 1 local ok, err = pcall(f) if ok then pass = pass + 1 end local status = ok and 'PASSED' or 'FAILED' print(('%02d. %68s: %s'):format(total, dec(message,68), status)) end local function same(t, b) if #t ~= #b then return false end for k,v in ipairs(t) do if b[k] ~= v then return false end end return true end run('Testing Rabin_Karp', function() assert(same(rabin_karp('abcde', 'abcabcdabcde'),{8})) assert(same(rabin_karp('t', 'test'),{1,4})) assert(same(rabin_karp('lua', 'lua lua lua lu lua'), {1,5,9,16})) end) run('Can also take an optional prime number for hashing Rabin_Karp', function() assert(same(rabin_karp('abcde', 'abcabcdabcde',23),{8})) assert(same(rabin_karp('t', 'test',13),{1,4})) assert(same(rabin_karp('lua', 'lua lua lua lu lua',19), {1,5,9,16})) end) print(('-'):rep(80)) print(('Total : %02d: Pass: %02d - Failed : %02d - Success: %.2f %%') :format(total, pass, total-pass, (pass*100/total)))
mit
asmagill/hammerspoon
extensions/spotlight/spotlight.lua
4
15074
--- === hs.spotlight === --- --- This module allows Hammerspoon to preform Spotlight metadata queries. --- --- This module will only be able to perform queries on volumes and folders which are not blocked by the Privacy settings in the System Preferences Spotlight panel. --- --- A Spotlight query consists of two phases: an initial gathering phase where information currently in the Spotlight database is collected and returned, and a live-update phase which occurs after the gathering phase and consists of changes made to the Spotlight database, such as new entries being added, information in existing entries changing, or entities being removed. --- --- The syntax for Spotlight Queries is beyond the scope of this module's documentation. It is a subset of the syntax supported by the Objective-C NSPredicate class. Some references for this syntax can be found at: --- * https://developer.apple.com/library/content/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/QueryFormat.html --- * https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html --- --- Depending upon the callback messages enabled with the [hs.spotlight:callbackMessages](#callbackMessages) method, your callback assigned with the [hs.spotlight:setCallback](#setCallback) method, you can determine the query phase by noting which messages you have received. During the initial gathering phase, the following callback messages may be observed: "didStart", "inProgress", and "didFinish". Once the initial gathering phase has completed, you will only observe "didUpdate" messages until the query is stopped with the [hs.spotlight:stop](#stop) method. --- --- You can also check to see if the initial gathering phase is in progress with the [hs.spotlight:isGathering](#isGathering) method. --- --- You can access the individual results of the query with the [hs.spotlight:resultAtIndex](#resultAtIndex) method. For convenience, metamethods have been added to the spotlightObject which make accessing individual results easier: an individual spotlightItemObject may be accessed from a spotlightObject by treating the spotlightObject like an array; e.g. `spotlightObject[n]` will access the n'th spotlightItemObject in the current results. --- === hs.spotlight.group === --- --- This sub-module is used to access results to a spotlightObject query which have been grouped by one or more attribute values. --- --- A spotlightGroupObject is a special object created when you specify one or more grouping attributes with [hs.spotlight:groupingAttributes](#groupingAttributes). Spotlight items which match the Spotlight query and share a common value for the specified attribute will be grouped in objects you can retrieve with the [hs.spotlight:groupedResults](#groupedResults) method. This method returns an array of spotlightGroupObjects. --- --- For each spotlightGroupObject you can identify the attribute and value the grouping represents with the [hs.spotlight.group:attribute](#attribute) and [hs.spotlight.group:value](#value) methods. An array of the results which belong to the group can be retrieved with the [hs.spotlight.group:resultAtIndex](#resultAtIndex) method. For convenience, metamethods have been added to the spotlightGroupObject which make accessing individual results easier: an individual spotlightItemObject may be accessed from a spotlightGroupObject by treating the spotlightGroupObject like an array; e.g. `spotlightGroupObject[n]` will access the n'th spotlightItemObject in the grouped results. --- === hs.spotlight.item === --- --- This sub-module is used to access the individual results of a spotlightObject or a spotlightGroupObject. --- --- Each Spotlight item contains attributes which you can access with the [hs.spotlight.item:valueForAttribute](#valueForAttribute) method. An array containing common attributes for the type of entity the item represents can be retrieved with the [hs.spotlight.item:attributes](#attributes) method, however this list of attributes is usually not a complete list of the attributes available for a given spotlightItemObject. Many of the known attribute names are included in the `hs.spotlight.commonAttributeKeys` constant array, but even this is not an exhaustive list -- an application may create and assign any key it wishes to an entity for inclusion in the Spotlight metadata database. --- --- For convenience, metamethods have been added to the spotlightItemObjects as a shortcut to the [hs.spotlight.item:valueForAttribute](#valueForAttribute) method; e.g. you can access the value of a specific attribute by treating the attribute as a key name: `spotlightItemObject.kMDItemPath` will return the path to the entity the spotlightItemObject refers to. local USERDATA_TAG = "hs.spotlight" local module = require("hs.libspotlight") local objectMT = hs.getObjectMetatable(USERDATA_TAG) local itemObjMT = hs.getObjectMetatable(USERDATA_TAG .. ".item") local groupObjMT = hs.getObjectMetatable(USERDATA_TAG .. ".group") require("hs.sharing") -- get NSURL helper -- private variables and methods ----------------------------------------- -- Public interface ------------------------------------------------------ module.definedSearchScopes = ls.makeConstantsTable(module.definedSearchScopes) table.sort(module.commonAttributeKeys) module.commonAttributeKeys = ls.makeConstantsTable(module.commonAttributeKeys) --- hs.spotlight:searchScopes([scope]) -> table | spotlightObject --- Method --- Get or set the search scopes allowed for the Spotlight query. --- --- Parameters: --- * `scope` - an optional table or list of items specifying the search scope for the Spotlight query. Defaults to an empty array, specifying that the search is not limited in scope. --- --- Returns: --- * if an argument is provided for `scope`, returns the spotlightObject; otherwise returns a table containing the current search scopes. --- --- Notes: --- * Setting this property while a query is running stops the query and discards the current results. The receiver immediately starts a new query. --- --- * Each item listed in the `scope` table may be a string or a file URL table as described in documentation for the `hs.sharing.URL` and `hs.sharing.fileURL` functions. --- * if an item is a string and matches one of the values in the [hs.spotlight.definedSearchScopes](#definedSearchScopes) table, then the scope for that item will be added to the valid search scopes. --- * if an item is a string and does not match one of the predefined values, it is treated as a path on the local system and will undergo tilde prefix expansion befor being added to the search scopes (i.e. "~/" will be expanded to "/Users/username/"). --- * if an item is a table, it will be treated as a file URL table. local searchScopes = objectMT.searchScopes objectMT.searchScopes = function(self, ...) local args = table.pack(...) if args.n == 0 then return searchScopes(self) elseif args.n == 1 then return searchScopes(self, ...) else args.n = nil return searchScopes(self, args) end end --- hs.spotlight:callbackMessages([messages]) -> table | spotlightObject --- Method --- Get or specify the specific messages that should generate a callback. --- --- Parameters: --- * `messages` - an optional table or list of items specifying the specific callback messages that will generate a callback. Defaults to { "didFinish" }. --- --- Returns: --- * if an argument is provided, returns the spotlightObject; otherwise returns the current values --- --- Notes: --- * Valid messages for the table are: "didFinish", "didStart", "didUpdate", and "inProgress". See [hs.spotlight:setCallback](#setCallback) for more details about the messages. local callbackMessages = objectMT.callbackMessages objectMT.callbackMessages = function(self, ...) local args = table.pack(...) if args.n == 0 then return callbackMessages(self) elseif args.n == 1 then return callbackMessages(self, ...) else args.n = nil return callbackMessages(self, args) end end --- hs.spotlight:groupingAttributes([attributes]) -> table | spotlightObject --- Method --- Get or set the grouping attributes for the Spotlight query. --- --- Parameters: --- * `attributes` - an optional table or list of items specifying the grouping attributes for the Spotlight query. Defaults to an empty array. --- --- Returns: --- * if an argument is provided, returns the spotlightObject; otherwise returns the current values --- --- Notes: --- * Setting this property while a query is running stops the query and discards the current results. The receiver immediately starts a new query. --- * Setting this property will increase CPU and memory usage while performing the Spotlight query. --- --- * Thie method allows you to access results grouped by the values of specific attributes. See `hs.spotlight.group` for more information on using and accessing grouped results. --- * Note that not all attributes can be used as a grouping attribute. In such cases, the grouped result will contain all results and an attribute value of nil. local groupingAttributes = objectMT.groupingAttributes objectMT.groupingAttributes = function(self, ...) local args = table.pack(...) if args.n == 0 then return groupingAttributes(self) elseif args.n == 1 then return groupingAttributes(self, ...) else args.n = nil return groupingAttributes(self, args) end end --- hs.spotlight:valueListAttributes([attributes]) -> table | spotlightObject --- Method --- Get or set the attributes for which value list summaries are produced for the Spotlight query. --- --- Parameters: --- * `attributes` - an optional table or list of items specifying the attributes for which value list summaries are produced for the Spotlight query. Defaults to an empty array. --- --- Returns: --- * if an argument is provided, returns the spotlightObject; otherwise returns the current values --- --- Notes: --- * Setting this property while a query is running stops the query and discards the current results. The receiver immediately starts a new query. --- * Setting this property will increase CPU and memory usage while performing the Spotlight query. --- --- * This method allows you to specify attributes for which you wish to gather summary information about. See [hs.spotlight:valueLists](#valueLists) for more information about value list summaries. --- * Note that not all attributes can be used as a value list attribute. In such cases, the summary for the attribute will specify all results and an attribute value of nil. local valueListAttributes = objectMT.valueListAttributes objectMT.valueListAttributes = function(self, ...) local args = table.pack(...) if args.n == 0 then return valueListAttributes(self) elseif args.n == 1 then return valueListAttributes(self, ...) else args.n = nil return valueListAttributes(self, args) end end --- hs.spotlight:sortDescriptors([attributes]) -> table | spotlightObject --- Method --- Get or set the sorting preferences for the results of a Spotlight query. --- --- Parameters: --- * `attributes` - an optional table or list of items specifying sort descriptors which affect the sorting order of results for a Spotlight query. Defaults to an empty array. --- --- Returns: --- * if an argument is provided, returns the spotlightObject; otherwise returns the current values --- --- Notes: --- * Setting this property while a query is running stops the query and discards the current results. The receiver immediately starts a new query. --- --- * A sort descriptor may be specified as a string or as a table of key-value pairs. In the case of a string, the sort descriptor will sort items in an ascending manner. When specified as a table, at least the following keys should be specified: --- * `key` - a string specifying the attribute to sort by --- * `ascending` - a boolean, default true, specifying whether the sort order should be ascending (true) or descending (false). --- --- * This method attempts to specify the sorting order of the results returned by the Spotlight query. --- * Note that not all attributes can be used as an attribute in a sort descriptor. In such cases, the sort descriptor will have no affect on the order of returned items. local sortDescriptors = objectMT.sortDescriptors objectMT.sortDescriptors = function(self, ...) local args = table.pack(...) if args.n == 0 then return sortDescriptors(self) elseif args.n == 1 then return sortDescriptors(self, ...) else args.n = nil return sortDescriptors(self, args) end end objectMT.__index = function(self, key) if objectMT[key] then return objectMT[key] end if math.type(key) == "integer" and key > 0 and key <= self:count() then return self:resultAtIndex(key) else return nil end end objectMT.__call = function(self, cmd, ...) local currentlyRunning = self:isRunning() if table.pack(...).n > 0 then self:searchScopes(...):queryString(cmd) else self:queryString(cmd) end if not currentlyRunning then self:start() end return self end objectMT.__pairs = function(self) return function(_, k) if k == nil then k = 1 else k = k + 1 end local v = _[k] if v == nil then return nil else return k, v end end, self, nil end objectMT.__len = function(self) return self:count() end itemObjMT.__index = function(self, key) if itemObjMT[key] then return itemObjMT[key] end return self:valueForAttribute(key) end itemObjMT.__pairs = function(self) local keys = self:attributes() return function() local k = table.remove(keys) if k then return k, self:valueForAttribute(k) else return nil end end, self, nil end -- no numeric indexes, so... -- itemObjMT.__len = function(self) return 0 end groupObjMT.__index = function(self, key) if groupObjMT[key] then return groupObjMT[key] end if math.type(key) == "integer" and key > 0 and key <= self:count() then return self:resultAtIndex(key) else return nil end end groupObjMT.__pairs = function(self) return function(_, k) if k == nil then k = 1 else k = k + 1 end local v = _[k] if v == nil then return nil else return k, v end end, self, nil end groupObjMT.__len = function(self) return self:count() end -- Return Module Object -------------------------------------------------- return module
mit
wincent/wincent
aspects/nvim/files/.config/nvim/lua/wincent/vim/plaintext.lua
1
1543
local autocmd = wincent.vim.autocmd local setlocal = wincent.vim.setlocal -- Switch to plaintext mode with: call wincent#functions#plaintext() local plaintext = function() setlocal('concealcursor', 'nc') setlocal('list', false) setlocal('textwidth', 0) setlocal('wrap') setlocal('wrapmargin', 0) wincent.vim.spell() -- Break undo sequences into chunks (after punctuation); see: `:h i_CTRL-G_u` -- -- From: -- -- https://twitter.com/vimgifs/status/913390282242232320 -- -- Via: -- -- https://github.com/ahmedelgabri/dotfiles/blob/f2b74f6cd4d/files/.vim/plugin/mappings.vim#L27-L33 -- vim.keymap.set('i', '!', '!<C-g>u', { buffer = true }) vim.keymap.set('i', ',', ',<C-g>u', { buffer = true }) vim.keymap.set('i', '.', '.<C-g>u', { buffer = true }) vim.keymap.set('i', ':', ':<C-g>u', { buffer = true }) vim.keymap.set('i', ';', ';<C-g>u', { buffer = true }) vim.keymap.set('i', '?', '?<C-g>u', { buffer = true }) vim.keymap.set('n', 'j', 'gj', { buffer = true }) vim.keymap.set('n', 'k', 'gk', { buffer = true }) -- Ideally would keep 'list' set, and restrict 'listchars' to just -- show whitespace errors, but 'listchars' is global and I don't want -- to go through the hassle of saving and restoring. autocmd('BufWinEnter', '<buffer>', 'match Error /\\s\\+$/') autocmd('InsertEnter', '<buffer>', 'match Error /\\s\\+\\%#\\@<!$/') autocmd('InsertLeave', '<buffer>', 'match Error /\\s\\+$/') autocmd('BufWinLeave', '<buffer>', 'call clearmatches()') end return plaintext
unlicense
zlatebogdan/gnunet
bin/wireshark.lua
6
5537
-- declare our protocol gwlan_proto = Proto("gnunet","Gnunet Layer") -- create a function to dissect it local f = gwlan_proto.fields f.len = ProtoField.uint16 ("gnunet.len", "Gnunet Message Len") f.type = ProtoField.uint16 ("gnunet.type", "Gnunet Message Type") -- rhs_proto.fields.sequence = ProtoField.uint16("rhs.sequence","Sequence number") f_proto = DissectorTable.new("gnunet.proto", "Gnunet Protocoll", FT_UINT16, BASE_DEC) --gwlan_proto.fields = {f_len, f_type} function gwlan_proto.dissector(buffer,pinfo,tree) pinfo.cols.protocol = "Gnunet Packet" gnunet_packet_disector(buffer,pinfo,tree) end function gwlan_proto.init() end function gnunet_packet_disector(buffer,pinfo,tree) if (buffer:len() > 4) then local len = buffer(0,2):uint() local type = buffer(2,2):uint() if (len <= buffer:len()) then local dissect = f_proto:get_dissector(type) if dissect ~= nil then dissect:call(buffer(0, len):tvb(), pinfo, tree) else local subtree = tree:add(fragmentack, buffer(),"Gnunet Packet Type: " .. buffer(2,2):uint() .. "(" .. buffer:len() .. ")") gnunet_message_header(buffer, pinfo, subtree) end end --if (len < buffer:len()) then -- gwlan_proto.dissector(buffer(len, buffer:len() - len):tvb(), pinfo, tree) --end else if (buffer:len() == 4) then local subtree = tree:add(fragmentack, buffer(),"Gnunet Packet (" .. buffer:len() .. ")") gnunet_message_header(buffer, pinfo, subtree) end end end function gnunet_message_header(buffer, pinfo, tree) if (buffer:len() >= 4) then local len = buffer(0,2) local type = buffer(2,2) tree:add(buffer(0,2), "Message Len: " .. buffer(0,2):uint()) tree:add(buffer(2,2), "Message Type: " .. buffer(2,2):uint()) end end -- load the udp.port table llc_table = DissectorTable.get("llc.dsap") -- register our protocol to handle llc.dsap 0x1e llc_table:add(31,gwlan_proto) fragmentack = Proto("gnunet.fragmentack","Gnunet Fragment Ack") function fragmentack.dissector(buffer,pinfo,tree) pinfo.cols.protocol = "Gnunet Fragment Ack" local subtree = tree:add(fragmentack, buffer(),"Gnunet Data ack (" .. buffer:len() .. ")") gnunet_message_header(buffer, pinfo, subtree) if buffer:len() >= 16 then subtree:add(buffer(4,4),"Fragment Id: " .. buffer(4,4):uint()) subtree:add(buffer(8,8),"Bits: " .. buffer(8,8)) end end fragment = Proto("gnunet.fragment","Gnunet Fragment") function fragment.dissector(buffer,pinfo,tree) pinfo.cols.protocol = "Gnunet Fragment" local subtree = tree:add(fragment, buffer(),"Gnunet Fragment (" .. buffer:len() .. ")") gnunet_message_header(buffer, pinfo, subtree) if buffer:len() >= 13 then subtree:add(buffer(4,4),"Fragment Id: " .. buffer(4,4):uint()) subtree:add(buffer(8,2),"Total Size: " .. buffer(8,2):uint()) subtree:add(buffer(10,2),"Offset: " .. buffer(10,2):uint()) if buffer(10,2):uint() == 0 then if (buffer(8,2):uint() <= buffer:len() - 12) then gnunet_packet_disector(buffer(12):tvb(),pinfo,tree) end else subtree:add(buffer(12), "Data: " .. buffer(12)) end end end hello = Proto("gnunet.hello","Gnunet Hello Message") function hello.dissector(buffer,pinfo,tree) pinfo.cols.protocol = "Gnunet Hello Message" local subtree = tree:add(hello, buffer(),"Gnunet Hello Message (" .. buffer:len() .. ")") gnunet_message_header(buffer, pinfo, subtree) if buffer:len() > (264 + 8) then subtree:add(buffer(4,4),"Reserved: " .. buffer(4,4):uint()) RsaPublicKeyBinaryEncoded(buffer(8 , 264):tvb(),pinfo, subtree) else subtree:add(buffer(4), "SIZE WRONG (< 272)") end end wlan = Proto("gnunet.wlan","Gnunet WLAN Message") function wlan.dissector(buffer,pinfo,tree) pinfo.cols.protocol = "Gnunet WLAN Message" local subtree = tree:add(wlan, buffer(),"Gnunet WLAN Message (" .. buffer:len() .. ")") gnunet_message_header(buffer, pinfo, subtree) if buffer:len() > (4 + 4 + 2*64) then subtree:add(buffer(4,4),"CRC: " .. buffer(4,4):uint()) local peer = GNUNET_PeerIdentity(buffer(8,64), pinfo, subtree) peer:append_text(" Traget") peer = GNUNET_PeerIdentity(buffer(8 + 64,64), pinfo, subtree) peer:append_text(" Source") else subtree:add(buffer(8), "SIZE WRONG (< 4 + 4 + 2*64)") end if (buffer:len() - (4 + 4 + 2*64) > 0) then gnunet_packet_disector(buffer(4 + 4 + 2*64):tvb(),pinfo,tree) end end function RsaPublicKeyBinaryEncoded(buffer,pinfo,tree) local subtree = tree:add(gwlan_proto,buffer(),"Gnunet RsaPublicKeyBinaryEncoded(" .. buffer:len() .. ")") subtree:add(buffer(0,2),"Len: " .. buffer(0,2):uint()) subtree:add(buffer(2,2),"Sizen: " .. buffer(2,2):uint()) subtree:add(buffer(4,258),"Pub Key: " .. buffer(4,258)) subtree:add(buffer(262,2),"Padding: " .. buffer(262,2):uint()) end function GNUNET_PeerIdentity(buffer,pinfo,tree) local subtree = tree:add(gwlan_proto,buffer(),"Gnunet PeerIdentity(" .. buffer:len() .. ")") subtree:add(buffer(0),"hashPubKey: " .. buffer(0)) return subtree end transport_session_keepalive = Proto("gnunet.transport_session_keepalive","Gnunet transport session keepalive") function transport_session_keepalive.dissector(buffer,pinfo,tree) pinfo.cols.protocol = "Gnunet transport session keepalive" local subtree = tree:add(transport_session_keepalive, buffer(),"Gnunet transport session keepalive (" .. buffer:len() .. ")") gnunet_message_header(buffer, pinfo, subtree) end f_proto:add(43,wlan) f_proto:add(39,transport_session_keepalive) f_proto:add(19,fragmentack) f_proto:add(18,fragment) f_proto:add(16,hello)
gpl-3.0
TheAnswer/FirstTest
bin/scripts/slashcommands/skills/installMissionTerminal.lua
1
2622
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 InstallMissionTerminalSlashCommand = { name = "installmissionterminal", alternativeNames = "", animation = "", invalidStateMask = 3760653056, --combatAttitudeNormal, combatAttitudeAggressive, immobilized, frozen, swimming, glowingJedi, pilotingShip, shipOperations, shipGunner, invalidPostures = "5,6,7,8,9,10,", target = 2, targeType = 0, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 0, } AddInstallMissionTerminalSlashCommand(InstallMissionTerminalSlashCommand)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/dantooine/npcs/janta/jantaShaman.lua
1
4853
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. jantaShaman = Creature:new { objectName = "jantaShaman", -- Lua Object Name creatureType = "NPC", faction = "janta_tribe", factionPoints = 20, gender = "", speciesName = "janta_shaman", stfName = "mob/creature_names", objectCRC = 4083847450, socialGroup = "janta_tribe", level = 60, combatFlags = ATTACKABLE_FLAG, healthMax = 14000, healthMin = 12000, strength = 500, constitution = 500, actionMax = 14000, actionMin = 12000, quickness = 500, stamina = 500, mindMax = 14000, mindMin = 12000, focus = 500, willpower = 500, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = -1, energy = 40, electricity = 100, stun = -1, blast = -1, heat = 0, cold = 100, acid = 0, lightsaber = 0, accuracy = 300, healer = 1, pack = 1, herd = 1, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/melee/polearm/shared_lance_staff_wood_s1.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "a Wooden Staff", -- Name ex. 'a Vibrolance' weaponTemp = "lance_staff_wood_s1", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "PolearmMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 1, weaponMinDamage = 470, weaponMaxDamage = 650, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "object/weapon/melee/knife/shared_knife_stone.iff", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "a Stone Knife", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "knife_stone", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "OneHandedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 1, alternateWeaponMinDamage = 470, alternateWeaponMaxDamage = 650, alternateweaponAttackSpeed = 2, alternateWeaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0,11,15,19,33,65", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "kungaAttack01", "kungaAttack02", "kungaAttack03", "kungaAttack04", "kungaAttack05", "kungaAttack06", "kungaAttack07", "kungaAttack08" }, respawnTimer = 300, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(jantaShaman, 4083847450) -- Add to Global Table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/slashcommands/admin/database.lua
1
2429
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 DatabaseSlashCommand = { name = "database", alternativeNames = "", animation = "", invalidStateMask = 2097152, --glowingJedi, invalidPostures = "", target = 2, targeType = 0, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 0, } AddDatabaseSlashCommand(DatabaseSlashCommand)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/tailor/formalWearIvHighFashion/comfortableSlacks.lua
1
4609
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. comfortableSlacks = Object:new { objectName = "Comfortable Slacks", stfName = "pants_s13", stfFile = "wearables_name", objectCRC = 4074046798, groupName = "craftClothingFormalGroupD", -- Group schematic is awarded in (See skills table) craftingToolTab = 8, -- (See DraftSchemticImplementation.h) complexity = 17, size = 4, xpType = "crafting_clothing_general", xp = 160, assemblySkill = "clothing_assembly", experimentingSkill = "clothing_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "body, binding_and_hardware, hardware, lining, trim", ingredientSlotType = "0, 0, 0, 1, 1", resourceTypes = "object/tangible/component/clothing/shared_synthetic_cloth.iff, petrochem_inert, object/tangible/component/clothing/shared_metal_fasteners.iff, object/tangible/component/clothing/shared_synthetic_cloth.iff, object/tangible/component/clothing/shared_trim.iff", resourceQuantities = "2, 60, 1, 3, 2", combineTypes = "0, 0, 0, 1, 1", contribution = "100, 100, 100, 100, 100", numberExperimentalProperties = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalProperties = "XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX", experimentalWeights = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalGroupTitles = "null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null", experimentalSubGroupTitles = "null, null, sockets, hitpoints, mod_idx_one, mod_val_one, mod_idx_two, mod_val_two, mod_idx_three, mod_val_three, mod_idx_four, mod_val_four, mod_idx_five, mod_val_five, mod_idx_six, mod_val_six", experimentalMin = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", experimentalMax = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", experimentalPrecision = "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", tanoAttributes = "objecttype=16777228:objectcrc=2722910984:stfFile=wearables_name:stfName=pants_s13:stfDetail=:itemmask=62975::", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "/private/index_color_1", customizationDefaults = "12", customizationSkill = "clothing_customization" } DraftSchematics:addDraftSchematic(comfortableSlacks, 4074046798)--- Add to global DraftSchematics table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/slashcommands/admin/clearVeteranReward.lua
1
2469
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 ClearVeteranRewardSlashCommand = { name = "clearveteranreward", alternativeNames = "", animation = "", invalidStateMask = 2097152, --glowingJedi, invalidPostures = "", target = 2, targeType = 1, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 0, } AddClearVeteranRewardSlashCommand(ClearVeteranRewardSlashCommand)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/object/object/base/objects.lua
1
3896
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_object_base_shared_base_object = SharedObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "", clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, detailedDescription = "string_id_table", gameObjectType = 0, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@obj_n:unknown_object", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0 } ObjectTemplates:addTemplate(object_object_base_shared_base_object, 2637095427) object_object_base_shared_object_default = SharedObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "", clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, detailedDescription = "string_id_table", gameObjectType = 0, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@obj_n:unknown_object", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 0, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0 } ObjectTemplates:addTemplate(object_object_base_shared_object_default, 1571647223)
lgpl-3.0
ludi1991/skynet
test/testsha.lua
79
77629
local skynet = require "skynet" local crypt = require "crypt" local function sha1(text) local c = crypt.sha1(text) return crypt.hexencode(c) end local function hmac_sha1(key, text) local c = crypt.hmac_sha1(key, text) return crypt.hexencode(c) end -- test case from http://regex.info/code/sha1.lua print(1) assert(sha1 "http://regex.info/blog/" == "7f103bf600de51dfe91062300c14738b32725db5", 1) print(2) assert(sha1(string.rep("a", 10000)) == "a080cbda64850abb7b7f67ee875ba068074ff6fe", 2) print(3) assert(sha1 "abc" == "a9993e364706816aba3e25717850c26c9cd0d89d", 3) print(4) assert(sha1 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" == "84983e441c3bd26ebaae4aa1f95129e5e54670f1", 4) print(5) assert(sha1 "The quick brown fox jumps over the lazy dog" == "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12", 5) print(6) assert(sha1 "The quick brown fox jumps over the lazy cog" == "de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3", 6) print(7) assert("efb750130b6cc9adf4be219435e575442ec68b7c" == sha1(string.char(136,43,218,202,158,86,64,140,154,173,20,184,170,125,37,54,208,68,171,24,164,89,142,111,148,235,187,181,122):rep(76)), 7) print(8) assert("432dff9d4023e13194170287103d0377ed182d96" == sha1(string.char(20,174):rep(407)), 8) print(9) assert("ccba5c47946530726bb86034dbee1dbf0c203e99" == sha1(string.char(20,54,149,252,176,4,96,100,223):rep(753)), 9) print(10) assert("4d6fea4f8576cd6648ae2d2ee4dc5df0a8309115" == sha1(string.char(118,171,221,33,54,209,223,152,35,67,88,50):rep(985)), 10) print(11) assert("f560412aabf813d01f15fdc6650489584aabd266" == sha1(string.char(23,85,29,13,146,55,164,14,206,196,109,183,53,92,97,123,242,220,112,15,43,113,22,246,114,29,209,219,190):rep(177)), 11) print(12) assert("b56795e12f3857b3ba1cbbcedb4d92dd9c419328" == sha1(string.char(21,216):rep(131)), 12) print(13) assert("54f292ecb7561e8ce27984685b427234c9465095" == sha1(string.char(15,205,12,181,4,114,128,118,219):rep(818)), 13) print(14) assert("fe265c1b5a848e5f3ada94a7e1bb98a8ce319835" == sha1(string.char(136,165,10,46,167,184,86,255,58,206,237,21,255,15,198,211,145,112,228,146,26,69,92,158,182,165,244,39,152):rep(605)), 14) print(15) assert("96f186998825075d528646059edadb55fdd96659" == sha1(string.char(100,226,28,248,132,70,221,54,92,181,82,128,191,12,250,244):rep(94)), 15) print(16) assert("e29c68e4d6ffd3998b2180015be9caee59dd8c8a" == sha1(string.char(247,14,15,163,0,53,50,113,84,121):rep(967)), 16) print(17) assert("6d2332a82b3600cbc5d2417f944c38be9f1081ae" == sha1(string.char(93,98,119,201,41,27,89,144,25,141,117,26,111,132):rep(632)), 17) print(18) assert("d84a91da8fb3aa7cd59b99f347113939406ef8eb" == sha1(string.char(28,252,0,4,150,164,91):rep(568)), 18) print(19) assert("8edf1b92ad5a90ed762def9a873a799b4bda97f9" == sha1(string.char(166,67,113,111,161,253,169,195,158,97,96,150,49,219,103,16,186,184,37,109,228,111):rep(135)), 19) print(20) assert("d5b2c7019f9ff2f75c38dc040c827ab9d1a42157" == sha1(string.char(38,252,110,224,168,60,2,133,8,153,200,0,199,104,191,62,28,168,73,48,199,217,83):rep(168)), 20) print(21) assert("5aeb57041bfada3b72e3514f493d7b9f4ca96620" == sha1(string.char(57):rep(738)), 21) print(22) assert("4548238c8c2124c6398427ed447ae8abbb8ead27" == sha1(string.char(221,131,171):rep(230)), 22) print(23) assert("ed0960b87a790a24eb2890d8ea8b18043f1a87d5" == sha1(string.char(151,113,144,19,249,148,75,51,164,233,102,232,3,58,81,99,101,255,93,231,147,150,212,216,109,62):rep(110)), 23) print(24) assert("d7ac6233298783af55901907bb99c13b2afbca99" == sha1(string.char(44,239,189,203,196,79,82,143,99,21,125,75,167,26,108,161,9,193,72):rep(919)), 24) print(25) assert("43600b41a3c5267e625bbdfde95027429c330c60" == sha1(string.char(122,70,129,24,192,213,205,224,62,79,81,129,22,171):rep(578)), 25) print(26) assert("5816df09a78e4594c1b02b170aa57333162def38" == sha1(string.char(76,103,48,150,115,161,86,42,247,82,197,213,155,108,215,18,119):rep(480)), 26) print(27) assert("ef7903b1e811a086a9a5a5142242132e1367ae1d" == sha1(string.char(143,70):rep(65)), 27) print(28) assert("6e16b2dac71e338a4bd26f182fdd5a2de3c30e6c" == sha1(string.char(130,114,144,219,245,72,205,44,149,68,150,169,243):rep(197)), 28) print(29) assert("6cc772f978ca5ef257273f046030f84b170f90c9" == sha1(string.char(26,49,141,64,30,61,12):rep(362)), 29) print(30) assert("54231fc19a04a64fc1aa3dce0882678b04062012" == sha1(string.char(76,252,160,253,253,167,27,179,237,15,219,46,141,255,23,53,184,190,233,125,211,11):rep(741)), 30) print(31) assert("5511a993b808e572999e508c3ce27d5f12bb4730" == sha1(string.char(197,139,184,188,200,31,171,236,252,147,123,75,7,138,111,167,68,114,73,80,51,233,241,233,91):rep(528)), 31) print(32) assert("64c4577d4763c95f47ac5d21a292836a34b8b124" == sha1(string.char(177,114,100,216,18,57,2,110,108,60,81,80,253,144,179,47,228,42,105,72,86,18,30,167):rep(901)), 32) print(33) assert("bb0467117e3b630c2b3d9cdf063a7e6766a3eae1" == sha1(string.char(249,99,174,228,15,211,121,152,203,115,197,198,66,17,196,6,159,170,116):rep(800)), 33) print(34) assert("1f9c66fca93bc33a071eef7d25cf0b492861e679" == sha1(string.char(205,64,237,65,171,0,176,17,104,6,101,29,128,200,214,24,32,91,115,71,26,11,226,69,141,83,249,129):rep(288)), 34) print(35) assert("55d228d9bfd522105fe1e1f1b5b09a1e8ee9f782" == sha1(string.char(96,37,252,185,137,194,215,191,190,235,73,224,125,18,146,74,32,82,58,95,49,102,85,57,241,54,55):rep(352)), 35) print(36) assert("58c3167e666bf3b4062315a84a72172688ad08b1" == sha1(string.char(65,91,96,147,212,18,32,144,138,187,70,26,105,42,71,13,229,137,185,10,86,124,171,204,104,42,2,172):rep(413)), 36) print(37) assert("f97936ca990d1c11a9967fd12fc717dcd10b8e9e" == sha1(string.char(253,159,59,76,230,153,22,198,15,9,223,3,31):rep(518)), 37) print(38) assert("5d15229ad10d2276d45c54b83fc0879579c2828e" == sha1(string.char(149,20,176,144,39,216,82,80,56,38,152,49,167,120,222,20,26,51,157,131,160,52,6):rep(895)), 38) print(39) assert("3757d3e98d46205a6b129e09b0beefaa0e453e64" == sha1(string.char(120,131,113,78,7,19,59,120,210,220,73,118,36,240,64,46,149,3,120,223,80,232,255,212,250,76,109,108,133):rep(724)), 39) print(40) assert("5e62539caa6c16752739f4f9fd33ca9032fff7e1" == sha1(string.char(216,240,166,165,2,203,2,189,137,219,231,229):rep(61)), 40) print(41) assert("3ff1c031417e7e9a34ce21be6d26033f66cb72c9" == sha1(string.char(4,178,215,183,17,198,184,253,137,108,178,74,244,126,32):rep(942)), 41) print(42) assert("8c20831fc3c652e5ce53b9612878e0478ab11ee6" == sha1(string.char(115,157,59,188,221,67,52,151,147,233,84,30,243,250,109,103,101,0,219,13,176,38,21):rep(767)), 42) print(43) assert("09c7c977cb39893c096449770e1ed75eebb9e5a1" == sha1(string.char(184,131,17,61,201,164,19,25,36,141,173,74,134,132,104,23,104,136,121,232,12,203,115,111,54,114,251,223,61,126):rep(458)), 43) print(44) assert("9534d690768bc85d2919a059b05561ec94547fc2" == sha1(string.char(49,93,136,112,92,42,117,28,31):rep(187)), 44) print(45) assert("7dfca0671de92a62de78f63c0921ff087f2ba61d" == sha1(string.char(194,78,252,112,175,6,26,103,4,47,195,99,78,130,40,58,84,175,240,180,255,108,3,42,51,111,35,49,217,160):rep(72)), 45) print(46) assert("62bf20c51473c6a0f23752e369cabd6c167c9415" == sha1(string.char(28,126,243,196,155,31,158,50):rep(166)), 46) print(47) assert("2ece95e43aba523cdbf248d07c05f569ecd0bd12" == sha1(string.char(76,230,117,248,231,228):rep(294)), 47) print(48) assert("722752e863386b737f29a08f23a0ec21c4313519" == sha1(string.char(61,102,1,118):rep(470)), 48) print(49) assert("a638db01b5af10a828c6e5b73f4ca881974124a0" == sha1(string.char(130,8,4):rep(768)), 49) print(50) assert("54c7f932548703cc75877195276bc2aa9643cf9b" == sha1(string.char(193,232,122,142,213,243,224,29,201,6,127,45,4,36,92,200,148,111,106,110,221,235,197,51,66,221,123,155,222,186):rep(290)), 50) print(51) assert("ecfc29397445d85c0f6dd6dc50a1272accba0920" == sha1(string.char(221,76,21,148,12,109,232,113,230,110,96,82,36):rep(196)), 51) print(52) assert("31d966d9540f77b49598fa22be4b599c3ba307aa" == sha1(string.char(148,237,212,223,44,133,153):rep(53)), 52) print(53) assert("9f97c8ace98db9f61d173bf2b705404eb2e9e283" == sha1(string.char(190,233,29,208,161,231,248,214,210):rep(451)), 53) print(54) assert("63449cfce29849d882d9552947ebf82920392aea" == sha1(string.char(216,12,113,137,33,99,200,140,6,222,170,2,115,50,138,134,211,244,176,250,42,95):rep(721)), 54) print(55) assert("15dc62f4469fb9eae76cd86a84d576905c4bbfe7" == sha1(string.char(50,194,13,88,156,226,39,135,165,204):rep(417)), 55) print(56) assert("abbc342bcfdb67944466e7086d284500e25aa103" == sha1(string.char(35,39,227,31,206,163,148,163,172,253,98,21,215,43,226,227,130,151,236,177,176,63,30,47,74):rep(960)), 56) print(57) assert("77ae3a7d3948eaa2c60d6bc165ba2812122f0cce" == sha1(string.char(166,83,82,49,153,89,58,79,131,163,125,18,43,135,120,17,48,94,136):rep(599)), 57) print(58) assert("d62e1c4395c8657ab1b1c776b924b29a8e009de1" == sha1(string.char(196,199,71,80,10,233,9,229,91,72,73,205,75,77,122,243,219,152):rep(964)), 58) print(59) assert("15d98d5279651f4a2566eda6eec573812d050ff7" == sha1(string.char(78,70,7,229,21,78,164,158,114,232,100,102,92,18,133,160,56,177,160,49,168,149,13,39,249,214,54,41):rep(618)), 59) print(60) assert("c3d9bc6535736f09fbb018427c994e58bbcb98f6" == sha1(string.char(129,208,110,40,135,3):rep(618)), 60) print(61) assert("7dc6b3f309cbe9fa3b2947c2526870a39bf96dc4" == sha1(string.char(126,184,110,39,55,177,108,179,214,200,175,118,125,212,19,147,137,133,89,209,89,189,233,164,71,81,156,215,152):rep(908)), 61) print(62) assert("b2d4ca3e787a1e475f6608136e89134ae279be57" == sha1(string.char(182,80,145,53,128,194,228,155,53):rep(475)), 62) print(63) assert("fbe6b9c3a7442806c5b9491642c69f8e56fdd576" == sha1(string.char(9,208,72,179,222,245,140,143,123,111,236,241,40,36,49,68,61,16,169,124,104,42,136,82,172):rep(189)), 63) print(64) assert("f87d96380201954801004f6b82af1953427dfdcb" == sha1(string.char(153,133,37,2,24,150,93,242,223,68,202,54,118,141,76,35,100,137,13):rep(307)), 64) print(65) assert("a953e2d054dd77f75337dd9dfa58ec4d3978cfb4" == sha1(string.char(112,215,41,50,221,94):rep(155)), 65) print(66) assert("e5c3047f9abfdd60f0c386b9a820f11d7028bc70" == sha1(string.char(247,177,124,213,47,175,139,203,81,21,85):rep(766)), 66) print(67) assert("ee6fe88911a13abfc0006f8809f51b9de7f5920f" == sha1(string.char(81,84,151,242,186,133,39,245,175,79,66,170,246,216,0,88,100,190,137,2,146,58):rep(10)), 67) print(68) assert("091db84d93bb68349eecf6bfa9378251ecd85500" == sha1(string.char(180,71,122,187):rep(129)), 68) print(69) assert("d8041c7d65201cc5a77056a5c7eb94a524494754" == sha1(string.char(188,99,87,126,152,214,159,151,234,223,199,247,213,107,63,59,12,146,175,57,79,200,132,202):rep(81)), 69) print(70) assert("cca1d77faf56f70c82fcb7bc2c0ac9daf553adff" == sha1(string.char(199,1,184,22,113,25,95,87,169,114,130,205,125,159,170,99):rep(865)), 70) print(71) assert("c009245d9767d4f56464a7b3d6b8ad62eba5ddeb" == sha1(string.char(39,168,16,191,95,82,184,102,242,224,15,108):rep(175)), 71) print(72) assert("8ce115679600324b58dc8745e38d9bea0a9fb4d6" == sha1(string.char(164,247,250,142,139,131,158,241,27,36,81,239,26,233,105,64,38,249,151,75,142,17,56,217,125,74,132,213,213):rep(426)), 72) print(73) assert("75f1e55718fd7a3c27792634e70760c6a390d40f" == sha1(string.char(32,145,170,90,188,97,251,159,244,153,21,126,2,67,36,110,31,251,66):rep(659)), 73) print(74) assert("615722261d6ec8cef4a4e7698200582958193f26" == sha1(string.char(51,24,1,69,81,157,34,185,26,159,231,119):rep(994)), 74) print(75) assert("4f61d2c1b60d342c51bc47641e0993d42e89c0f9" == sha1(string.char(175,25,99,122,247,217,204,100,0,35,57,65,150,182,51,79,169,99,9,33,113,113,113):rep(211)), 75) print(76) assert("7d9842e115fc2af17a90a6d85416dbadb663cef3" == sha1(string.char(136,42,39,219,103,95,119,125,205,72,174,15,210,213,23,75,120,56,104,31,63,255,253,100,61,55):rep(668)), 76) print(77) assert("3eccab72b375de3ba95a9f0fa715ae13cae82c08" == sha1(string.char(190,254,173,227,195,41,49,122,135,57,100):rep(729)), 77) print(78) assert("7dd68f741731211e0442ce7251e56950e0d05f96" == sha1(string.char(101,155,117,8,143,40,192,100,162,121,142,191,92):rep(250)), 78) print(79) assert("5e98cdb7f6d7e4e2466f9be23ec20d9177c5ddff" == sha1(string.char(84,67,182,136,89):rep(551)), 79) print(80) assert("dba1c76e22e2c391bde336c50319fbff2d66c3bb" == sha1(string.char(99,226,185,1,192):rep(702)), 80) print(81) assert("4b160b8bfe24147b01a247bfdc7a5296b6354e38" == sha1(string.char(144,141,254,1,166,144,129,232,203,31,192,75,145,12):rep(724)), 81) print(82) assert("27625ad9833144f6b818ef1cf54245dd4897d8aa" == sha1(string.char(31,187,82,156,224,133,116,251,180,165,246,8):rep(661)), 82) print(83) assert("0ce5e059d22a7ba5e2af9f0c6551d010b08ba197" == sha1(string.char(228):rep(672)), 83) print(84) assert("290982513a7f67a876c043d3c7819facb9082ea6" == sha1(string.char(150,44,52,144,68,76,207,114,106,153,99,39,219,81,73,140,71,4,228,220,55,244,210,225,221,32):rep(881)), 84) print(85) assert("14cf924aafceea393a8eb5dd06616c1fe1ccd735" == sha1(string.char(140,194,247,253,117,121,184,216,249,84,41,12,199):rep(738)), 85) print(86) assert("91e9cc620573db9a692bb0171c5c11b5946ad5c3" == sha1(string.char(48,77,182,152,26,145,231,116,179,95,21,248,120,55,73,66):rep(971)), 86) print(87) assert("3eb85ec3db474d01acafcbc5ec6e942b3a04a382" == sha1(string.char(68,211):rep(184)), 87) print(88) assert("f9bd0e886c74d730cb2457c484d30ce6a47f7afa" == sha1(string.char(168,73,19,144,110,93,7,216,40,111,212,192,33,9,136,28,210,175,140,47,125,243,206,157,151,252,26):rep(511)), 88) print(89) assert("64461476eb8bba70e322e4b83db2beaee5b495d4" == sha1(string.char(33,141):rep(359)), 89) print(90) assert("761e44ffa4df3b4e28ca22020dee1e0018107d21" == sha1(string.char(254,172,185,30,245,135,14,5,186,42,47,22):rep(715)), 90) print(91) assert("41161168b99104087bae0f5287b10a15c805596f" == sha1(string.char(79):rep(625)), 91) print(92) assert("7088f4d88146e6e7784172c2ad1f59ec39fa7768" == sha1(string.char(20,138,80,102,138,182,54,210,38,214,125,123,157,209,215,37):rep(315)), 92) print(93) assert("2e498e938cb3126ac1291cee8c483a91479900c1" == sha1(string.char(140,197,97,112,205,97,134,190):rep(552)), 93) print(94) assert("81a2491b727ef2b46fb84e4da2ced84d43587f4e" == sha1(string.char(109,44,17,199,17,107,170,54,113,153,212,161,174):rep(136)), 94) print(95) assert("0e4f8a07072968fbc4fe32deccbb95f113b32df7" == sha1(string.char(181,247,203,166,34,61,180,48,46,77,98,251,72,210,217,242,135,133,38,12,177,163,249,31,1,162):rep(282)), 95) print(96) assert("8d15dddd48575a1a0330976b57e2104629afe559" == sha1(string.char(15,60,105,249,158,45,14,208,202,232,255,181,234,217):rep(769)), 96) print(97) assert("98a9dd7b57418937cbd42f758baac4754d5a4a4b" == sha1(string.char(115,121,91,76,175,110,149,190,56,178,191,157,101,220,190,251,62,41,190,37):rep(879)), 97) print(98) assert("578487979de082f69e657d165df5031f1fa84030" == sha1(string.char(189,240,198,207,102,142,241,154):rep(684)), 98) print(99) assert("3e6667b40afb6bcc052654dd64a653ad4b4f9689" == sha1(string.char(85,82,55,80,43,17,57,20,157,10,148,85,154,58,254,254,221,132,53,105,43,234,251,110,111):rep(712)), 99) print(100) assert("31285f3fa3c6a086d030cf0f06b07e7a96b5cbd0" == hmac_sha1("63xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "data"), 100) print(101) assert("2d183212abc09247e21282d366eeb14d0bc41fb4" == hmac_sha1("64xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "data"), 101) print(102) assert("ff825333e64e696fc13d82c19071fa46dc94a066" == hmac_sha1("65xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "data"), 102) print(103) assert("ecc8b5d3abb5182d3d570a6f060fef2ee6c11a44" == hmac_sha1(string.char(220,58,17,206,77,234,240,187,69,25,179,182,186,38,57,83,120,107,198,148,234,246,46,96,83,28,231,89,3,169,42,62,125,235,137), string.char(1,225,98,83,100,71,237,241,239,170,244,215,3,254,14,24,216,66,69,30,124,126,96,177,241,20,44,3,92,111,243,169,100,119,198,167,146,242,30,124,7,22,251,52,235,95,211,145,56,204,236,37,107,139,17,184,65,207,245,101,241,12,50,149,19,118,208,133,198,33,80,94,87,133,146,202,27,89,201,218,171,206,21,191,43,77,127,30,187,194,166,39,191,208,42,167,77,202,186,225,4,86,218,237,157,117,175,106,63,166,132,136,153,243,187)), 103) print(104) assert("bd1577a9417d804ee2969636fa9dde838beb967d" == hmac_sha1(string.char(216,76,38,50,235,99,92,110,245,5,134,195,113,7), string.char(144,3,250,84,145,227,206,87,188,42,169,182,106,31,207,205,33,76,52,158,255,49,129,169,9,145,203,225,90,228,163,33,49,99,29,135,60,112,152,5,200,121,35,77,56,116,68,109,190,136,184,248,144,172,47,107,30,16,105,232,146,137,24,81,245,94,28,76,27,82,105,146,252,219,119,164,21,14,74,192,209,208,156,56,172,124,89,218,51,108,44,174,193,161,228,147,219,129,172,210,248,239,22,11,62,128,1,50,98,233,141,224,102,152,44,68,66,46,210,114,138,113,121,90,7,70,125,191,192,222,225,200,217,48,22,10,132,29,236,71,108,140,102,96,51,142,51,220,4)), 104) print(105) assert("e8ddf90f0c117ee61b33db4df49d7fc31beca7f7" == hmac_sha1(string.char(189,213,184,86,24,160,198,82,138,223,71,149,249,70,183,47,0,106,27,39,85,102,57,190,237,182,2,10,21,253,252,3,68,73,154,75,79,247,28,132,229,50,2,197,204,213,170,213,255,83,100,213,60,67,202,61,137,125,16,215,254,157,106,5), string.char(78,103,249,15,43,214,87,62,52,57,135,84,44,92,142,209,120,139,76,216,33,223,203,96,218,12,6,126,241,195,47,203,196,22,113,138,228,44,122,37,215,166,184,195,91,97,175,153,115,243,37,225,82,250,54,240,20,237,149,183,5,43,142,113,214,130,100,149,83,232,70,106,152,110,25,74,46,60,159,239,193,173,235,146,173,142,110,71,1,97,54,217,52,228,250,42,223,53,105,24,87,98,117,245,101,189,147,238,48,111,68,52,169,78,151,38,21,249)), 105) print(106) assert("e33c987c31bb45b842868d49e7636bd840a1ffd3" == hmac_sha1(string.char(154,60,91,199,157,45,32,99,248,5,163,234,114,223,234,48,238,82,43,242,52,176,243,5,135,26,141,49,105,120,220,135,192,96,219,152,126,74,58,110,200,56,108,1,68,175,82,235,149,191,67,72,195,46,35,131,237,188,177,223,145,122,26,234,136,93,34,96,71,214,55,27,13,116,235,109,58,83,175,226,59,13,218,93,5,132,43,235), string.char(182,10,154)), 106) print(107) assert("f6039d217c16afadfcfae7c5e3d1859801a0fe22" == hmac_sha1(string.char(73,120,173,165,190,159,174,100,255,56,217,98,249,11,166,25,66,95,96,99,70,73,223,132,231,147,220,151,79,102,111,98), string.char(134,93,229,103)), 107) print(108) assert("f6056b19cf6b070e62a0917a46f4b3aefcf6262d" == hmac_sha1(string.char(49,40,62,214,208,180,147,74,162,196,193,9,118,47,100,9,235,94,3,122,226,163,145,175,233,148,251,88,49,216,208,110,13,97,255,189,120,252,223,241,55,210,77,4), string.char(92,185,37,240,36,97,21,132,188,80,103,36,162,245,63,104,19,106,242,44,96,28,197,26,46,168,73,46,76,105,30,167,101,64,67,119,65,140,177,226,223,108,206,60,59,0,182,125,42,200,101,159,109,6,62,85,67,66,88,137,92,234,61,19,22,177,144,127,129,129,195,230,180,149,128,148,45,18,94,163,196,55,70,184,251,3,200,162,16,210,188,61,186,218,173,227,212,8,125,20,138,82,68,170,24,158,90,98,228,166,246,96,74,24,217,93,91,102,246,221,121,115,157,243,45,158,45,90,186,11,127,179,59,72,37,71,148,123,62,150,114,167,248,197,18,251,92,164,158,83,129,58,127,162,181,92,85,121,13,118,250,221,220,150,231,5,230,28,213,25,251,17,71,68,234,173,10,206,111,72,123,205,49,73,62,209,173,46,94,91,151,122)), 108) print(109) assert("15ddfa1baa0a3723d8aff00aeefa27b5b02ede95" == hmac_sha1(string.char(91,117,129,150,117,169,221,182,193,130,126,206,129,177,184,171,174,224,91,234,60,197,243,158,59,0,122,240,145,106,192,179,96,84,46,239,170,123,120,51,142,101,45,34), string.char(27,71,38,183,232,93,23,174,151,181,121,91,142,138,180,125,75,243,160,220,225,205,205,72,13,162,104,218,47,162,77,23,16,154,31,156,122,67,227,25,190,102,200,57,116,190,131,8,208,76,174,53,204,88,227,239,71,67,208,32,57,72,165,121,80,139,80,29,90,32,229,208,115,169,238,189,206,82,180,68,157,124,119,1,75,27,122,246,197,178,90,225,138,244,73,12,226,104,191,70,53,210,245,250,239,238,3,229,196,22,28,199,122,158,9,33,109,182,109,87,25,159,159,146,217,77,37,25,173,211,38,173,70,252,18,193,7,167,160,135,63,190,149,14,221,143,173,152,184,143,157,245,137,219,74,239,185,40,14,0,29,87,169,84,67,75,255,252,201,131,75,108,43,129,210,193,108,139,60,228,29,36,150,15,86)), 109) print(110) assert("d7cba04970a79f5d04c772fbe74bcc0951ff9c67" == hmac_sha1(string.char(159,179,206,236,86,25,53,102,163,243,239,139,134,14,243), string.char(106,160,249,31,114,205,9,66,139,182,209,218,31,151,57,132,182,85,218,220,103,15,210,218,101,244,240,227,12,184,127,137,40,127,232,195,234,182,0,214,125,122,141,207,61,244,143,202,159,229,100,76,165,44,226,137,100,61,1,107,132,142,144,158,223,249,151,78,186,194,189,83,45,66,178,41,23,172,195,137,170,216,208,27,149,112,68,188,0)), 110) print(111) assert("84625a20dc9ada78ec9de910d37734a299f01c5d" == hmac_sha1(string.char(85,239,250,237,210,126,142,84,119,107,100,163,15,179,132,206,112,85,119,101,44,163,240,10,14,69,169,158,170,190,95,66,129,69,218,229), string.char(210,103,131,185,91,224,115,108,129,11,50,16,90,98,64,124,157,177,50,21,30,201,244,101,136,104,149,102,34,166,25,62,1,79,216,4,221,113,168,169,5,151,172,22,166,28,130,137,251,164,220,189,253,45,149,80,247,84,130,208,69,49,120,8,90,154,100,191,121,81,230,207,23,189,7,164,112,123,158,192,224,255,218,200,70,238,211,161,35,251,150,125,24,10,131,220,57,178,196,38,231,196,206,94,118,32,56,197,136,148,145,247,188,64,56,53,195,140,92,202,22,122,229,105,115,14,42,27,107,223,105)), 111) print(112) assert("c463318ac1878cd770ec93b2710b706296316894" == hmac_sha1(string.char(162,21,153,195,254,135,203,75,152,144,200,187,226,4,248,93,161,180,219,181,99,130,122,28,179,140,152,9,21,115,34,140,162,45,88,4,33,238,179,125,58,23,108,194,158,48,191,40,3,50,81,247,114,241,0,88,147,93,57,178,73,187,11,195,254,171,106,167,245,190,117,160,1,219,200,249,107,233,58,19,122), string.char(246,179,198,163,52,106,45,38,131,22,142,185,149,121,79,211,0,16,102,52,46,176,83,7,32,42,103,184,234,107,180,128,128,130,21,27,236)), 112) print(113) assert("e2d37df980593b3e52aadb0d99d61114fb2c1182" == hmac_sha1(string.char(43,84,125,158,182,211,26,238,222,247,6,171,184,54,70,44,169,4,74,34,98,71,118,189,138,53,8,164,117,22,76,171,57,255,122,230,110,122,228,22,252,123,174,218,222,77,80,150,159,43,236,137,234,48,122,138,100,137,112), string.char(249,234,226,86,109,2,157,76,229,42,178,223,196,247,42,194,17,17,117,3,45,6,80,202,22,105,44,242,84,25,21,189,5,216,35,200,220,192,110,81,215,145,109,179,48,44,40,35,216,240,48,240,33,210,79,35,64,189,81,15,135,228,83,14,254,32,211,229,158,79,188,230,84,106,78,126,226,106,203,59,67,134,186,52,21,48,2,142,231,116,241,167,177,175,74,188,232,234,56,41,181,118,232,190,184,76,64,109,167,178,123,118,3,50,46,254,253,83,156,116,220,247,69,27,160,167,210,205,79,60,28,253,17,219,32,44,217,223,77,153,229,55,113,75,234,154,247,13,133,49,220,200,241,111,136,205,14,78,222,55,181,250,160,143,224,37,63,227,155,12,39,173,209,45,171,93,93,70,36,129,111,173,183,112,31,231,22,146,129,171,75,128,45)), 113) print(114) assert("666f9c282cf544c9c28006713a7461c7efbbdbda" == hmac_sha1(string.char(71,33,203,83,173,199,175,245,206,13,237,187,54,61,85,15,153,125,168,223,231,56,46,250,173,192,247,189,45,166,225,223,109,254,15,79,144,188,71,201,70,25,218,205,13,184,204,219,221,82,133,189,144,179,242,125,211,108,100,1,132,110,231,87,107,91,169,101,241,105,30), string.char(98,122,51,157,136,38,149,9,82,27,218,155,76,61,254,154,43,172,59,105,123,45,97,146,191,58,50,153,139,40,37,116)), 114) print(115) assert("6904a4ce463002b03923c71cdac6c38f57315b63" == hmac_sha1(string.char(15,40,41,76,105,201,153,223,174,12,100,114,234,95,204,95,84,31,26,28,69,85,48,111,40,173,162,6,198,36,252,179,244,9,112,213,64,87,58,186,4,147,229,211,161,30,226,159,75,38,91,89,224,245,156,110,229,50,210), string.char(213,155,72,86,75,185,138,211,199,57,75,9,1,141,184,89,82,180,105,17,193,63,161,202,25,60,16,201,72,179,74,129,73,172,84,39,140,33,25,122,136,143,116,100,100,234,246,108,135,180,85,12,85,151,176,154,172,147,249,242,180,207,126,126,235,203,55,8,251,29,135,134,166,152,80,76,242,15,69,225,199,221,133,118,194,227,9,185,190,125,120,116,182,15,241,209,113,253,241,58,145,106,136,25,60,47,174,209,251,54,159,98,103,88,245,61,108,91,12,245,119,191,232,36)), 115) print(116) assert("c57c742c772f92cce60cf3a1ddc263b8df0950f3" == hmac_sha1(string.char(193,178,151,175,44,234,140,18,10,183,92,17,232,95,94,198,229,188,188,131,247,236,215,129,243,171,223,83,42,173,88,157,29,46,221,57,80,179,139,80), string.char(214,95,30,179,51,95,183,198,185,9,76,215,255,122,91,103,133,117,42,33,0,145,60,129,129,237,203,59,141,214,108,79,247,244,187,250,157,177,245,72,191,63,176,211)), 116) print(117) assert("092336f7f1767874098a54d5f27092fbb92b7c94" == hmac_sha1(string.char(208,10,217,108,72,232,56,67,6,179,160,172,29,67,115,171,118,82,124,118,61,111,21,132,209,92,212,166,181,129,43,55,198,96,169,112,86,212,68,214,81,239,122,216,104,73,114,209,60,182,248,118,74,100,26,1,176,3,166,188), string.char(42,4,235,56,198,119,175,244,93,77)), 117) print(118) assert("c1d58ad2b611c4d9d59e339da7952bdae4a70737" == hmac_sha1(string.char(100,129,37,207,188,116,232,140,204,90,90,93,124,132,140,81,102,156,67,254,228,192,150,161,10,62,143,218,237,111,151,98,78,168,188,87,170,190,35,228,169,228,143,252,213,85,11,124,92,91,18,27,122,141,98,6,77,106,205,209,2,185,249), string.char(58,190,56,255,176,80,220,228,0,251,108,108,220,197,51,131,164,162,60,181,21,54,122,174,31,13,4,84,198,203,105,11,64,230,1,30,218,208,252,219,44,147,2,108,227,66,49,71,21,95,248,93,193,180,165,240,224,226,13,9,208,186,12,118,243,28,113,49,122,192,212,164,43,41,151,183,187,126,115,85,174,40,125,9,54,193,164,95,21,77,200,226,50,115,187,122,34,141,255,224,239,12,132,191,48,102,205,248,128,164,116,48,39,191,98,53,169,230,249,215,231,152,45,27,226,10,143,15,209,157,208,181,15,210,195,5,29,48,29,125,62,59,191,216,170,179,226,110,40,46,32,130,235,48,234,233,17)), 118) print(119) assert("3de84c915278a7d5e7d5629ec88193fb5bbadd15" == hmac_sha1(string.char(89,175,111,33,154,12,173,230,28,117), string.char(188,233,41,180,142,157,96,76,105,212,92,202,155,167,179,28,12,156,64,73,32,253,253,166,9,240,7,0,248,43,101,135,226,231,173,221,180,43,160,217,6,38,183,186,214,217,137,83,148,148,40,141,217,98,209,12,167,102,95,166,136,231,232,84,59,112,148,201,166,104,135,124,189,85,160,183,143,122,200,190,144,205,25,254,180,188,108,225,171,131,240,185,86,243,192,173,130,50,150,57,242,180,132,193,11,110,247,121,25,24,110,199,156,121,233,149,79,103,15,173,184,143,45,125,164,242,125,10,183,189,189,135,121,59,148,106,77,9,16,123,176,100,142,246,156,180,202,87,43,102,113,123)), 119) print(120) assert("e8cc5a50f80e7d52edd7ae4ec037414b70798598" == hmac_sha1(string.char(139,243,17,238,11,156,138,122,212,86,201,213,100,167,65,199,92,182,255,36,221,82,192,213,199,162,69,42,222,95,65,170,146,48,39,185,147,18,140,122,168,141), string.char(141,216,25,29,235,207,123,188,85,53,131,180,125,226,97,244,250,138,64,39,30,250,146,101,219,171,213,158,164,172,137,22,136,86,46,77,95,213,66,198,15,24,164,148,29,166,169,195,196,111,122,147,247,215,148,9,129,40,133,178,69,242,171,235,181,83,241,208,237,17,37,30,188,152,47,214,69,229,114,225,75,172,163,184,38,158,230,177,187,124,33,240,238,148,197,235,237,98,33,237,59,205,147,128,108,254,95,5,6,49,10,224,78,139,164,235,220,78,224,15,213,136,198,217,114,156,130,247,167,64,36,10,183,221,193,220,195,80,125,143,248,228,254,6,221,137,170,211,66)), 120) print(121) assert("80d9a0bc9600e6a0130681158a1787ef6b9c91d6" == hmac_sha1(string.char(152,28,190,131,179,120,137,63,214,85,213,89,116,246,171,92,0,47,44,102,120,206,185,116,71,106,195), string.char(250,9,181,163,46,88,166,238,164,40,207,236,152,104,201,42,14,255,125,57,173,176,230,171,63,6,254,130,140,201,45,152,164,216,171,27,172,105,19,103,128,33,255,93,64,155,55,210,140,2,94,168,168,164,5,218,249,227,221,133,72,112,97,243,140,149,193,80)), 121) print(122) assert("cb4182de586a30d606a057c948fe33733145790a" == hmac_sha1(string.char(193,229,65,81,159,93,162,173,74,64,195,41,80,189,104,238,119,67,255,63,209,247,146,247,210,208,86,14,102,153,246,175,242,209,42,4,243,138,217,58,206,147,19,163,152,239,154,78,5,1,175,97,251,24,185,10,67,107,174,145,178,121,36,238,108,85,214,162,78,195,107,135,114,76,180,37,99,103,78,232,29,244,11,60,236,112,18,241,39,164,107,18), string.char(222,85,11,36,12,191,252,103,180,161,84,168,21,125,50,76,4,148,195,230,210,114,35,116,225,176,16,64,44,20,17,224,227,243,175,251,204,177,41,223,76,216,228,221,54,226,150,209,145,175,142,137,140,25,196,99,252,175,125,15,39,76,47,127,188,51,88,227,194,171,249,141,12,249,225,199,241,112,153,26,107,204,191,23,241,46,223,143,9,9,46,64,197,209,23,18,208,139,148,45,146,94,80,86,49,12,122,218,14,210,133,164,39,227,102,60,129,6,43)), 122) print(123) assert("864e291ec69124c3a43976bae4ba1788f181f027" == hmac_sha1(string.char(231,211,73,154,64,125,224,253,200,234,208,210,83,9), string.char(33,248,155,139,159,173,90,40,200,95,96,12,81,103,8,139,211,189,87,75,8,6,36,103,116,204,137,181,81,233,97,171,47,27,143,164,63,3,223,107,80,232,182,154,7,255,190,171,209,115,219,6,34,109,1,254,214,73,2)), 123) print(124) assert("bee434914e65818f81bd07e4e0bbb58328be3ca1" == hmac_sha1(string.char(222,123,148,175,157,117,104,212,169,13,252,113,231,104,37,8,147,119,92,27,100,132,250,105,63,13,195,90,251,122,185,97,159,68,36,7,75,163,179,3,6,170,164,152,86,30,49,239,201,245,43,220,78,62,154,206,95,24,149,138,138,15,24,68,58,255,99,88,143,192,12), string.char(97,76,73,171,140,99,57,217,56,73,182,189,58,19,177,104,85,85,45,31,170,132,53,51,155,143,70,169,189,5,41,231,34,132,235,228,114,58,100,105,146,27,67,89,32,34,78,133,155,222,88,26,83,198,128,183,19,243,27,186,192,77,184,54,142,57,24)), 124) print(125) assert("0268f79ef55c3651a66a64a21f47495c5beeb212" == hmac_sha1(string.char(181,166,229,31,47,25,64,129,95,242,221,96,73,42,243,170,15,33,14,198,78,194,235,139,177,112,191,190,52,224,93,95,107,125,245,17,170,161,53,148,19,180,83,154,45,98,76,170,51,178,114,71,34,242,184,75,1,130,199,40,197,88,203,86,169,109,206,67,86,175,201,135,101,76,130,144,248,80,212,14,119,186), string.char(53,208,22,216,93,88,59,64,135,112,49,253,34,11,210,160,117,40,219,36,226,45,207,163,134,133,199,101)), 125) print(126) assert("bcb2473c745d7dee1ec17207d1d804d401828035" == hmac_sha1(string.char(143,117,182,35), string.char(110,95,240,139,124,96,238,255,165,146,205,18,155,244,252,176,24,19,253,39,33,248,90,95,34,115,70,63,195,91,124,144,243,91,110,80,173,47,46,231,73,228,207,37,183,28,42,144,66,248,178,255,129,52,55,232,1,33,193,185,184,237,8)), 126) print(127) assert("402ed75be595f59519e3dd52323817a65e9ff95b" == hmac_sha1(string.char(247,77,247,124,27,156,148,227,12,21,17,94,56,14,118,47,140,239,200,249,216,139,7,172,16,211,237,94,62,201,227,42,250,8,179,21,39,85,186,145,147,106,127,67,111,250,163,89,152,115,166,254,8,246,141,238,43,45,194,131,191,202), string.char(138,227,90,40,221,37,181,54,26,20,24,125,19,101,12,120,111,20,104,10,225,140,64,218,8,33,179,95,215,142,203,127,243,231,166,76,234,159,59,160,132,56,215,143,103,75,155,158,56,126,71,252,229,54,34,240,30,133,110,67,146,213,116,73,14,160,186,169,155,196,84,132,171,200,171,56,92,38,136,90,57,155,145,67,190,198,235,112,242,120,150,191,216,41,21,36,205,42,68,145,226,246,178,70,60,157,254,206,70,84,189,36,197,48,208,249,144,223,6,72,17,253,236,106,205,245,30,1,80,121,165,103,12,202,115,227,192,64,42,223,113,200,195,156,120,202,110,131,130,39,64,217,108,23,133,140,56,144,167,77,45,236,145,161,150,229,85,231,203,159,203,85,125,221,226)), 127) print(128) assert("20231b6abcdd7e5d5e22f83706652acf1ae5255e" == hmac_sha1(string.char(132,122,252,170,107,28,195,210,121,194,245,252,42,64,42,103,220,18,61,68,19,78,182,234,93,130,175,20,4,199,66,91,247,247,87,107,89,205,68,125,19,254,59,47,228,134,200,145,148,78,52,236,51,255,152,231,47,168,213,124,228,34,48), string.char(61,232,69,199,207,49,72,159,37,230,105,207,63,141,245,127,142,77,168,111,126,92,145,26,202,215,116,19,125,81,203,11,86,36,19,218,90,255,4,10,21,185,151,111,188,125,123,2,137,151,171,178,195,199,106,55,42,42,20,164,35,177,237,41,207,24,102,218,213,223,204,186,212,30,59,121,52,34,84,76,142,179,75,6,84,8,72,210,72,177,45,103,218,70,165,69,36,152,50,228,147,192,61,104,209,76,155,147,169,162,151,178,72,109,241,41,76,0,60,251,107,99,92,37,95,215,172,154,172,93,254,65,176,43,99,242,151,78,48,58,35,49,23,174,115,224,227,106,49,30,9)), 128) print(129) assert("b5a24d7aadc1e8fb71f914e1fa581085a8114b27" == hmac_sha1(string.char(233,21,254,12,70,129,236,10,187,36,119,197,152,242,131,11,10,243,169,217,128,247,196,111,183,109,146,155,92,91,71,83,0,136,109,1,130,143,0,8,6,22,160,153,190,164,199,56,152,229), string.char(152,112,218,132,38,125,94,106,64,9,137,105)), 129) print(130) assert("7fd9169b441711bef04ea08ed87b1cd8f245aeb2" == hmac_sha1(string.char(108,226,105,159), string.char(103,218,254,85,50,58,111,74,108,60,174,27,113,65,100,217,97,208,125,38,170,151,72,125,82,114,185,58,4,143,39,223,250,168,66,182,37,216,130,111,103,157,59,0,245,222,8,65,240)), 130) print(131) assert("98038102f8476b28dd11b535b6c1b93eb8089360" == hmac_sha1(string.char(77,121,52,138,71,149,161,87,106,75,232,247,8,148,175,24,23,60,151,104,176,208,148,227,226,191,73,123,164,36,177,235,101,190,128,202,139,116,201,125,61,41,204,187,48,107,63,231,12,137,11,228,93,136,178,243,90), string.char(90,6,232,110,12,66,45,86,141,121,2,6,177,135,64,208,45,178,129,37,253,246,74,48,71,211,243,121,31,209,138,147,185,141,65,185,245,9,137,134,148,123,181,128,204,74,222,150,239,169,179,36,236,104,147,255,251,204,5,191,198,185,153,195,26,112,179,170,232,101,238,143,143)), 131) print(132) assert("ba43c9b8e98b4b7176a1bb63fcbed5b004dc4fcd" == hmac_sha1(string.char(133,107,178,183,204,2,203,106,242,180,87,58,134), string.char(211,208,255,34,198,99,119,185,171,52,118,94,65,241,45,24,40,6,2,203,126,216,21,51,245,154,92,198,201,220,190,135,182,137,113,68,250,94,126,233,140,94,118,244,244,98,252,97,217,204,239,218,178,240,65,150,246,217,231,142,157,33,113,135,135,214,137,103,211,213,48,132,171,43,96,51,241,45,42,237,53,247,134,102,163,214,96,147,131,74,180,19,7,12,174,60,37,60,78,85,92,186,121,27,234,128,132,64,47,106,127,218,52,30,59,230,85,240,164,54,168,232,131,110,145,125,255,238,145,237,134,196,197,138,105,74,34,134,29,249,222,119,194,104,230)), 132) print(133) assert("0c1ad0332f0c6c1f61e6cc86f0a343065635ecb3" == hmac_sha1(string.char(230,111,251,74,216,102,12,134,90,44,121,175,56,221,225,235,180,246,56,12,236,119,119,109,97,59,224,121,27,37,72,219,138,193,50,219,193,152,1,229,224,197,233,76,188,62,120,17,63,158,186,198,87,135,34,60,164,139,3,200,20,188,203,110,212,137,91,70,35,255,146,213,216,71,73,143,55,219,54,142,105,83,175,193,32,226,150,51,59), string.char(185,250,11,8,121,214,91,27,1,50,67,204,219,252,212,198,117,234,57,127,214,12,220,104,44,177,225,238,103,138,144,162,28,69,143,108,192,4,160,63,175,185,123,46,151,221,127,145,55,32,85,245,251,178,125,223,107,192,206,207,232,231,190,44,221,173,1,59,12,178,112,22,253,222,14,40,18,141,128,144,196,6,112,206,183,144,215,156,159,79,132,152,170,22,68,106,137,248,12,242,231,98,96,144,148,20,212,30,242,109,36,112,50,51,57,212,181,191,80,73,215,119,244,209,57,108,147,182,67,204,154,48,216,116)), 133) print(134) assert("466442888b6989fd380f918d0476a16ae26279cf" == hmac_sha1(string.char(250,60,248,215,154,159,2,121), string.char(236,249,8,10,180,146,36,144,83,196,49,166,17,81,51,72,28)), 134) print(135) assert("f9febfeda402b930ec1b95c1325788305cb9fde8" == hmac_sha1(string.char(124,195,165,216,158,253,119,86,162,36,185,72,162,141,160,225,183,25,54,123,73,61,40,165,101,154,157,200,113,14,117,144,185,64,236,219,3,87,90,49), string.char(73,1,223,35,5,159,39,85,95,170,227,61,14,227,142,222,255,253,152,123,104,35,229,6,195,106,30,59,5,36,2,173,71,161,217,189,47,193,3,216,34,10,25,30,212,255,141,94,25,72,52,58,50,56,180,99,173,155)), 135) print(136) assert("53fe70b7e825d017ef0bdecbacdda4e8a76cbc6f" == hmac_sha1(string.char(144,144,130,150,207,183,143,100,188,177,90,5,4,95,116,105,252,118,187,251,35,113,251,86,36,234,176,165,55,165,158,4,182,85,62,255,18,146,128,67,221,183,78,71,158,184,140,14,84,44,36,79,244,158,37,1,122,43,103,228,217,253,72,113,228,121,160,29,87,5,158,64,38,253,179,122,187,157,106,99,161,79,97,176,119,86,101,40,142,241,217,85), string.char(12,89,157,112,207,206,171,254,87,106,42,113,70,72,222,239,88,94,14,41,14,175,206,56,219,244,230,40,33,154,107,249,45,70,55,104,151,193,246,133,99,59,244,179,8,145,225,100,146,142,128,74,40,155,99,93,204,253,249,222,64,99,156,121,142,49,166,62,171,223,135,55,212,183,144,218,56,12,211,99,254,58,249,219,197,189,173,141,60,196,241,157,67,151,251,172,49,105,200,88,224,175,9,79,65,40,5,255,222,14,152,149,228,83,154,207,104,132,106,96,40,229,182,120,100,207,223,81,171,141,1,171)), 136) print(137) assert("81b1df7265954a8aee4e119800169660ff9e75c8" == hmac_sha1(string.char(232,167,4,53,90,111,79,91,163,125,230,202,52,242,160,135,66,211,246,17,131,109,109,235,91), string.char(111,177,251,180,63,13,33,205,231,130,203,167,177,156,87,70,33,148,229,163,158,224,123,37,18,204,185,89,235,2,30,252,229,202,170,157,175,157,208,254,135,190,34,14,42,211,154,243,31,100,71,53,169,76,36)), 137) print(138) assert("caf986508402b3feb70c5b44d902f4a9428a44d2" == hmac_sha1(string.char(127,2,162,53,6,172,189,169,176,254,107,46,57,207,23,25,182,72,34,228,164,113,12,179,149,45,169,19,3,204,202,10,126,153,130,41,143,200,198,47,215,15,58,124,225,60,171,98,8,211,72,235,211,187,172,37,119,96,55,243,98,198,225,191,79,207,94,215,255,21,101,128,153,233,88,101,57,195,70,194), string.char(97,24,129,203,10,176,242,39,165,95,51,30,187,106,207,160,18,154,16,130,178,80,206,128,148,56,213,55,46,85,76,100,50,131,41,167,130,12,81,161,158,55,181,12,12,38,89,193,136,220,81,114,191,157,20,221,171,245)), 138) print(139) assert("83bd91a9e8072010f3b54d215c56ada0cd810bb6" == hmac_sha1(string.char(215,33,57,193,51,126,38,114,7,29,93,101,78,152,222,121,42,0,236,169,48,137,202,48,90,249,235,46,44,126,78,251,15,84,200,235,43,108,8,196,210,57,152,86,254), string.char(153,35,68,230,52,95,243,220,32,101,148,76,80,168,187,172,170,254,10,70,31,117,40,131,61,155,200,189,25,198,120,41,181,53,14,175,64,89,126,94,242,61,52,1,188,255,121,254,74,88,19,10,126,225,89,31,21,104,199,82,149,60,110,194,123,236,13,38,7,213,176,182,202,211,178,185,99,8,173,220,168,166,108,208,71,152,174,5,134,167,220,47,74,177,231,90,114,208,168,47,112,74,58,73,94,224,101,64,128,255,186,179,119,159,117,110,2,188,38,73,230,39,50,73,162,22,117,185,182,168,70,252,11,242,243,165,32,104,220,211)), 139) print(140) assert("c123d92ee67689922dfb3b68a45584e7e5dc5dc3" == hmac_sha1(string.char(167,32,181,181,249,210), string.char(249,7,96,196,48,157,109,129,192,227,82,84,196,167,224,145,61,177,60,74,217,117,199,147,147,54,198,138,5,51,135,112,29,184,49,16,0,240,172,21,214,114,146,57,2,154,205,60,113,32,113,255,165,5,178,15,159)), 140) print(141) assert("454d9ba00ac4e0e90a2866ba2abefba40dac9aab" == hmac_sha1(string.char(116,2,170,84,236,37), string.char(219,144,86,39,237,166,110,90,213,70)), 141) print(142) assert("e919cce3908786205511fee0283e1eb41c0c45a1" == hmac_sha1(string.char(180,76,140,201,56,232,48,183,173,36,111,94,208,153,234,255,52,18,121,118,117,77,92,74,241,103,193,164,169,1,60,46,101,73,61,221,26,253,209,124,99,154,177,218,59,238,159,191,0,65,117,78,15,12,92,35,254,40,11,112,112,91,49,248,198,229,161,247,130,170,76,146,8,220,134,96,155,68,50,168,186,135,188,186,36), string.char(26,47,201,201,197,232,196,239,204,197,162,14,53,254,88,75,43,254,11,20,52,61,136,206,162,29,223,55,125,50,200,239,135,51,154,54,78,191,188,0,137,191,149,162,191,103,0,168,52,178,147,251,253,86,98,17,15,202,231,0,122,10,131,25,15,129,48,190,60,205,185,114,193,122,19,47,52,142,124,107,45,174,221,196,18,32,79,12,129,84,40)), 142) print(143) assert("fa770f6b76984edb0f7fa514a19d3c7ef9c82c51" == hmac_sha1(string.char(70,55,200,82,238,241,84,180,129,122,103,199,170,177), string.char(88,236,14,60,249,2,197,242,76,152,248,241,158,232,113,242,209,93,232,113,147,210,80,180,44,124,186,150,172,177,138,131,117,151,174,231,93,248,244,200,191,169,159,206,232,246,2,121,106,183,107,79,210,73,145,244,254,248,85,217,156,221,238,120,224,176,31,56,246,26,3,186,189,86,41,17,34,8,208,58,46,130,226,139,209,194,3,34,55,213,154,12,250,229,201,122,89,47,177,229,80,165,183,77,178,139,3,241,165,196,239,93,98,101,99,210,99,5,135,132,151,197,4,154,87,130,145,175,243,238,132,0,146,14,6,205,227,78,150,59,191,223,74,145,57,82,30,223,90,205,248,47,195,220,215,167,112,216,20,130,26,88,170,101,26,14,216,62,169,217,1,135,193,147,218)), 143) print(144) assert("d3418e6e6d0a96f8ea7c511273423651a63590c8" == hmac_sha1(string.char(61,175,211,89,77,91,143,76,18,30,252,16,181,45,211,37,207,204,174,174,60,208,36,85,23,106,141,215,62,8,158,98,209,49,96,143,129,99,11,159,79,116,98,244,51,237,227,250,73,196,36,216,181,157,159,87,248,108,29,22,181,175,72,92,160,127,46,204,202,175,61,108,172,50,225,48,84,167,116,67,183), string.char(174,62,218,81,85,89,4,35,26)), 144) print(145) assert("f2fbe13b442bff3c09dcdaeaf375cb2f5214f821" == hmac_sha1(string.char(188,80,129,208,85,53,8,122,92,99,56,251,59,108,97,145,1,97,157,181,156,243,30,204,227,88,205,151), string.char(137,30,19,71,50,239,11,212,91,234,79,248,244,118,108,245,251,78,53,136,249,55,210,231,109,207,153,83,10,63,98,225,79,113,124,64,100,16,195,9,136,28,50,215,93,93,153,25,97,77,4,13,46,34,164,59,33,206,62,125,8,79,219,42,155,39,241,96,18)), 145) print(146) assert("aeacb03e8284a01b93e51e483df58a9492035668" == hmac_sha1(string.char(62,67,97,44,112,68,107,91,105,4,183,154,9,14,164,180,87,140,195,231,62,49,250,154,193,186,219,18,100,156,176,124,223,164,68,64,105,214,144,200,65), string.char(221,20,36,192,59,234,90,174,232,184,75,15,92,229,59,191,36,51,4,190,226,35,237,189,21,100,135,138,171,202,163,227,176,231,72,185,43,197,134,157,44,86,26,42,230,251,2,124,220,245,242,116,77,35,197,154,237,73,117,131,126,242,167,242,8,72,163,171,60,29,77,152,142,69,25,234,195,2,159,49,178,63,48,56,131,143,165,22,142,116,109,11,57,71,101,99,84,204,56,233,173,65,180,228,211,10,197,204,26,70,198,81,217,83,130,70,79,54,93,96,116,32,21,219,193,70,55,84,161,89,47,206,13,167,46,104,205,218)), 146) print(147) assert("e163c334e08bd3fa537c1ea309ce99cfbcd97930" == hmac_sha1(string.char(238,187,29,13,100,125,10,129,46,251,49,62,207,74,243,25,25,73,196,100,114,64,141,173,143,144,70,13,162,227,33,255,83,58,254,138,23,146,90,86,17,33,152,227,15,100,200,147,81,114,166,234,47,60,70,190,208,28,16,44,71,150,101,197,182,57,143,79,29,135,45,211,194,62,234,28,244,74,56,104,187,94,146,174,190,198,55,143,134,60,186,144,190,100,102,0,171,151), string.char(177,90,20,162,64,145,130,87,137,70,153,237,51,138,248,29,166,134,168,68,133,121,161,26,228,137,145,116,243,224,201,229,61,107,250,198,214,208,72,169,248,155,247,54,163,167,71,248,69,106,105,139,224,138,85,94,31,143,4,215,83,239,21,198,28,1,120,83,91,92,58,150,110,77,111,166,222,236,170,129,2,121,86,66,42,129,146,232,46,248,136,175,130,118,126,205,184,136,6,35,180,174,194,59,89,243,199,38,97,48,80,98,45,111)), 147) print(148) assert("6a82b3a54ed409f612a934caf96e6c4799286f19" == hmac_sha1(string.char(11,59,108,100,113,56,239,211,2,138,219,101,50,50,111,31,171,212,228,55,89,196,44,158,77,252,212,134,106,7,250,223,219,46,231,87,9,62,213,104,169,49,1,75,3,10,50,238,5,150,47,14,47,45,171,183,40,245,194,249,228,216,85), string.char(97,131,91,189,9,52,88,203,250,245,46,96,7,95,176,61,57,192,91,231,193,32,41,169,96,101,39,240,29,143,24,56,57,177,70,135,225,90,42,192,134,103,239,175,243,246,76,137,14,237,82,215,7,76,246,219,132,50,175,25,164,4,216,65,102,0,114,216,159,80,58,32,4,100,22,35,71,140,49,16,216,182,91,80,181,129,151,55,130,7,77,84,211,111,45,51,192,123,213,192,11,81,138,60,225,21,37,182,180,223,170,163,110,9,47,214,200,249,164,98,215)), 148) print(149) assert("79caa9946fcf0ccdd882bc409abe77d3470d28f7" == hmac_sha1(string.char(202,142,21,201,45,72,11,211,67,134,42,192,96,255,210,211,252,6,101,131,25,195,101,76,250,161,148,242,30,129,241,85,68,173,236,140,120,80,71,62,55,4,33,104,52,160,143,118,252,72), string.char(100,188,93,165,75,34,224,223,6,130,52,160,83,157,253,27,200,125,117,249,41,203,19,242,4,188,209,213,211,20,162,252,215,238,221,30,219,252,246,110,117,77,89,204,221,246,69,62,160,186,37,144,43,151,39,133,254,134,24,223)), 149) print(150) assert("bd1e60a3df42e2687746766d7d67d57e262f3c9b" == hmac_sha1(string.char(57,212,172,224,206,230,13,50,80,54,19,87,147,166,245,67,118,37,101,214,207,60,66,29,197,236,146,140,192,15,36,155,108,121,215,211,210,118,22,20,56,245,42,153,150,32,224,201,171,2,238,41,70,140,73,60,215,243,86,20,169,152,220,104,95,215,187), string.char(245,123,43,109,29,108,197,27,55,167,255,177,226,205,111,126,146,75,93,70,180,90,139,218,243,232,221,247,129,77,115,101,144,42,13,249,223,127,200,213,140,113,23,10,149,107,244,86,41,133,147,26,167,85,189,76,176,12,190,52,90,54,78,29,97,204,161,224,59,243,128,64,133,95,192,19,137,220,96,228,97,161,51,21,157,172,127,76,53,38,83,126,178,26,203,206,165,241,101,130,79,122,75,29,205,240,1,68,222,48,101,7,29,6,82,240,133,112)), 150) print(151) assert("fe249fa66eb1e6228e1e5166d7862d119ffa0dcf" == hmac_sha1(string.char(152,13,170,129,7,65,32,194,85,196,85,12,170,227,139,215,70,137,246,105,100,111,252,221,54,174,90,169,59,11,198,33,110,94,246,195,174,13,212,47,18,94,17,67,68,56,251,213,92,67,243,114,181,166,24,182,238,146,48,196,11,238,91,213,46,184,187,199,15,221,193,36,73,244,30,222,175,132,165,177,162,54,215,130,171,58,26,144,218,62,172,120,188,20,182,242,47,178,120,175), string.char(129,126,32,58,251,104,186,25,18,204,5,240,65,194,32,205,194,18,151,173,185,249,237,55,145,8,41,18,171,28,59,234,62,163,32,173,197,176,206,224,95,176,218,168,183,82,53,172,205,6,223,190,189,16,3,34,212,201,54,152,89,231,194,95,8,238,133,56,139,157,115,35,74,58,21,162,111,36,105,135,151,30,207,33,198,186,122,221,98,36,196,251,27)), 151) print(152) assert("88aef9bb450b75bf96e8b5fd7831ed0d16d7fe7a" == hmac_sha1(string.char(162,225,9,204,87,95,132,152,211,133,93,120,105,156,131,55,245,224,33,115,182,10,28,49,80,175,241,67,66,52,21,55,174,108,66,100,77,20), string.char(55,61,250,187,157,98,212,245,5,54,170,60,235,228,197,182,230,24,195,215,202,55,56,153,9,94,164,107,67,93,143,1,235,195,133,201,103,57,130,177,71,73,169,80,21,251,130,247,21,61,228,39,166,173,211,203,149,55,11,224,70,52,248,118,112,219,39,188,147,5,203,101,158,134,53,250,103,73,154,249,71,181,53,171,227,26,79,200,145,178,24,80,102,26,90,101,70,143,233,17,150,181,170)), 152) print(153) assert("a057dd823478540bbe9a6fcdf2d4dcfcac663545" == hmac_sha1(string.char(83,17,204,150,211,96,88,52,225,90,61,59,28,127,135), string.char(49,226,129,162,111,75,221,186,24,219,219,178,226,132,19,126,192,69,124,114,214,31,7,127,194,134,202,147,45,176,215,141,41,94,69,38,199,231,185,223,10,104,108,50,237,20,76,194,33,43,117,117,176,3,117,117,55,68,112,207,74,72,163)), 153) print(154) assert("b11757ccfafc8feadc4e9402c820f4903f20032b" == hmac_sha1(string.char(34,11,53,219), string.char(225,194,251,106,223,229,212,105,164,172,25,25,224,199,225,172,197,42,167,1,227,165,17,247,75,250,10,208,99,124,254,158,103,74,89,60,78,141,201,44,253,87,248,239,74,86,75,64,249,189,21,170,249,18,139,21,130,226,66,200,231,35,227,147,95,213,133,35,47,236,52,64,122,115,80,170,27,50,182,151,180,106,120,85,103,255,143,27,233,43,217,152,70,82,8,229,103,42,153,38,130,184,108,160,199,69,38,184)), 154) print(155) assert("bfd0994350b2e1e0d6a1faed059f67f1dd8b361f" == hmac_sha1(string.char(221,156,128,63,215,109,55,123,41,27,110,127,209,144,178,143,120,12,226,47,56,212,131,228,3,40,186,208,233,135,33,206,92,214,153,77,12,220,72,240,176,53,22,37,130,58,180,4,111,124,135,31,192,71,117,87,11,41,231,101,37,164,112,3,55,141,250,131,191,117,90,159,224,244,9,251,154), string.char(35,88,113,69,231,5,150,40,123,13,197,27,49,72,161,1,212,222,252,74,197,170,137,72,231,245,117,236,29,12,36,59,225,103,44,119,136,34,241,17,142,239,46,152,129,163,107,17,165,112,187,15,122,217,67,13,215,157,212,26,103,226,237,161,213,3,152,88,247,236,130,133,84,200,132,191,166,8,96,247,4,142,14,81,179,64,88,202,156,242,181,95,162,19,97,223,51,76,176,218,22,116,24,238,204,128,241,236,204,2,56,86,77,211,4,52,221,82,94,76,9,21,182,112,199,161,29,39,183,120,13,0,124,136,95,182,241,3,73,167,51,237,152,149,84,147,41,42,241,174,12,30,226,245,139,230,127,34,205,41,166,228,242,105,251,4,150,29,106,42,27,239,89,249,230,246,242,149,4,60,240,93,13,166,102,239,81,216,137,196)), 155) print(156) assert("15c4527be05987a9b5c33b920be4a4402f7cf941" == hmac_sha1(string.char(132,158,227,135,167,32,19,192,144,48,232,68,79,78,135,122,136,140,97,67,34,91,225,48,126,67,77,115,154,189,13,45,8,234,59,233,245,77,34,76,95,78,3,250,179,224,20,25,6,202,214,115,165,230,85,115,250,236,135,34,32,158,196,45,207,61,71,51,93,27,187,232,175,233,147,68,231,110,12,198,233,165,24,209,206,25,16,252,127,72), string.char(210,162,121,23,181,21,75,54,110,47,15,166,133,206,100,217,57,133,228,32,112,208,186,28,140,8,207,74,185,17,128,29,181,172,20,156,64,192,112,8,207,131,53,10,182,147,224,71,218,94,71,86,215,2,133,46,160,27,51,189,38,130,224,120,185,144,253,117,193,24,154,229,247,132,62,103,65,163,106,172,22,5,2,32,129,38,213,118,110,125,156,14,48,240,170,225,158,89,92,190,254,231,51,220,8,174,188,233,226,106,224,99,218,82,64,219,206,75,166,111,25,7,87,248,145,251,109,106,243,241,89,200,85,184,155,183,249,61,70,87,115,182,81,80,155,24,245,123,184,102,214,255,122,83,61,214,88,235,169,28,147,196,247,97,28,82,193,72,71,96,243,176,35,189,236,44,184,52,151,249,186,189,150,184,142,238,88,113,120,68,234,50,136,104,80,145,179,57,6,186)), 156) print(157) assert("b9f87f5f23583bdd21b1ea18e7e647513b7b0596" == hmac_sha1(string.char(216,79,247,98,215,219,128,232,135,111,179,168,80,76,36,250,224,157,229,209,238,186,212,188,200,52,208,200,210,79,182,186,22,22,37,34,86,107,89,238,168,90,53,30,151,191,89,163,253,24,204,152,118,1,158,25,168,2,123,91,111,39,101,239,247,37,200,51,215,31,146,211,163,136,208), string.char(153,134,211,81,255,219,50,91,67,48,102,63,244,170,129,66,3,151,110,167,142,150,153,95,89,90,23,87,12,85,42,209,197,36,41,189,199,136,196,159,125,53,253,192,135,234,94,34,87,79,143,213,237,149,212,170,231,181,22,72,81,233,151,243,134,71,160,155,121,32,233,251,187,179,139,48,254,206,172,165,202,105,222,31,223,95,203,87,114,52,218,59,187,41,43,135,200,108,102,201,85,199,8,176,249,44,96,104,160,85,149,177,25,88,55,231,85,120,227,6,180,24)), 157) print(158) assert("0b586895674ab11d3b395c07ddb01151a6e562f5" == hmac_sha1(string.char(26,110,222,147,168,18,74,206,186,238,154,250,229,207,138,175,126,82,236,148,74,180,27,168,159,89,211,34,39,115,227,239,22,199,252,96,100,16,193,117,111,102,75,70,2,114,214,196,29,26,43,189,183,0,194,217,204), string.char(90,15,17,198,223,30,20,138,203,132,6,170,107,40,167,58,194,212,244,49,174,60,209,164,26,87,174,177,41,166,95,173,40,61,47,136,147,239,125,167,146,180,97,167,33,185,5,110,128,36,61,52,140,20,189,16,216,83,164,46,74,16,251,250,72,50,47,5,86,60,56,77,101,64,11,120,124,194,212,199,136,87,157,160,90,172,101,222,235,23,111,11,36,11,68,20,43,251,65,212,206,150,0,50,146,170,183,93,89,142,161,50,110,237,95,191,22,184,62,194,81)), 158) print(159) assert("38b25a1d9d927ba5e6b294d2aa69c0ab8ab0a0c5" == hmac_sha1(string.char(93,218,103,160,235,71,107,150,18,170,193,9,63,245,77,150,71,242,137,52,243,12,207,183,222,252,20,215,210,194,241,79), string.char(87,97,35,201,134,196,180)), 159) print(160) assert("a72ce76565c2876e78f86ce9e137a9881328fddc" == hmac_sha1(string.char(48,215,222,182,164,136,31,53,160,28,61,171,220,159,243,154,169,101,191,193,99,28,140,59,60,215,77,170,51,136,50,145,159,135,237,149,83,154,219,223,29,200,85,193,173,201,66,142,100,21,89,144,111,5,24,229,228,154,160,32,210,71,19,63,244,230,61,185,221,158,151,51), string.char(196,237,178,172,24,232,144,251,253,31,8,63,69,58,202,88,120,219,39,34,223,173,196,164,135,93,188,69,126,58,153,37,72,219,50,152,76,235,244,223,205,60,74,12,109,203,134,239,40,181,207,99,118,149,179,84,14,53,189,201,55,110,67,81,116,140,31,247,163,135,53,254,82,230,55,162,255,230,149,144,217,62,164,59,124,59,78,177,115,47,26,169,228,18,167,232,89,161,56,105,127,111,230,93,230,181,222,212,254,85,32,117,140,80,246,117,21,140,221,198,11,196,112,69,122,125,156)), 160) print(161) assert("cd324faf8204be01296bea85a22d991533fd353e" == hmac_sha1(string.char(25,136,140,2,222,149,164,20,148,15,90,33,106,111,10,252,67,120,57,49,251,171,99,173,114,16,102,240,206,188,231,174,51,124,38,1,217,142,4,15,78,4,5,128,207,82), string.char(84,0,42,233,157,150,105,1,216,32,170,11,100,98,103,220,137,102,32,185,55,211,207,179,252,190,248,117,253,189,196,71,112,32,4,198,87,5,133,125,238,107,210,227,149,206,12,124,31,59,213,66,105,100,240,237,149,232,174,140,127,9,65,204,162,243,100,120,6,229,71,56,140,128,228,102,121,14,43,166,252,230,172,93,96,25,214,174,151,2,50,64,152,164,132,115,109,176,25,144,171,252,231,72)), 161) print(162) assert("fb6e40ddbf3df49d4b44ccecf9e9bc74567df49e" == hmac_sha1(string.char(31,41,38,118,207,197,83,231,45,187,105,1,246,6,34,16,214,148,97,64,139,27,73,129,71,129,183,182,228,12,74,242,94,43,121,163,188,242,92,43,154,103,20,208,89,213,63,46,81,60,69,217,238,237,97,18), string.char(126,99,64,121,143,219,76,227,119,32,135,246,48,55,214,38,179,255,33,43,32,140,228,44,218,40,187,117,172,131,225,222,72,61,213,132,167,121,190,167,66,213,199,59,212,61,69,242,46,169,89,191,74,0,228,208,46,112,7,81,88,203,95,180,179,75,116,222,115,239,1,132,178,73,139,252,77,1,151,222,108,84,196,161,79,220,80,44,223,44,131,252,58,28,201,3,77,211,33,208,237,47,251,79,134,223,48,8,0,236,139,11,232,186,188,134,249,29,208,154,137,169,218,228,203,254,106,88,35,252,155,111,119,14,147,161,19,60,145,157,120,236,108,122,218,168,105,59,10,44,99,208,86)), 162) print(163) assert("373f21bf8fe4e855f882cc976ebed31717f4c791" == hmac_sha1(string.char(198,41,45,129,159,48,37,183,170,144,24,223,108,176,68,60,197,245,254,165,24,152,14,25,243,46,6,25,142,99,64,10,145,229,74,232,162,201,72,215,116,26,179,127,107,45,193,232,96,170,168,153,79,47), string.char(79,250,224,177,254,56,111,120,135,79,55,200,199,71,65,132,222,7,106,170,26,179,235,237,47,172,88,28,244,88,137,177,92,178,147,129,147,85,88,157,30,207,235,246,132,98,232,18,201,57,151,90,174,148,126,22,38,118,133,49,83,156,56,195,10,95,180,250,215,220,251,5,131,243,70,2,162,239,197,153,196,28,181,167,26,14,247,86,244,69,190,100,255,158,217,222,58,116,126,245,240,139,255,213,7,28,222,99,12,127,57,2,212,33,136,220,203,251,87,205,213,160,146,162,73,55,112,203,60,243,139,167,45,91,68,62,204,245,206,221,52,253,5,193,69,19,190,131,64,250,12,127,77,212,53,83,102,212,11,215,253,143,111,201)), 163) print(164) assert("df709285c8a1917aaa6d570bd1d4225ca916b110" == hmac_sha1(string.char(193,124,34,185,160,71,134,56,178,152,165,219,223,89,174,116,11,237), string.char(47,110,24,9,42,187,179,71,114,43,155,129,158,24,130,32,208,3,46,63,16,1,192,210,72,220,200,89,120,80,82,65,199,119,167,86,57,33,105,118,215,60,18,155,17,154,63,59,189,153,236,78,219,89,4,116,208,122,56,65,253,220,57,147,162,242,193,86,45,145,151,61,30,138,105,139,99,89)), 164) print(165) assert("66be81c24c87feeecfd805872c6cde41cb1dd732" == hmac_sha1(string.char(128,186,31,231,128,48,206,237,59), string.char(56,228,42,58,98,45,202,132,30,78,80,52,36,128,7,55,209,148,181,52,185,220,137,85,111,128,220,109,55,70,185,242,253,155,165,193,240,63,144,253,240,147,18,161,7,46,40,148,201,0,127,1,33,145,180,247,90,206,178,96,62,137,130,99,248,248,227,135,213,21,230,40,88,162,106,240,218,93,226,108,9,121,173,70,255,106,137,222,135,206,104,153,171,1,52,156,166,27,98,7,74,180,206,11,193,129,77,194,86,224,175,79,77,95,134,62,58,252,180,100,191,53,28,59,121,123,146,107,121,249,168,51,204,170,141,26,84,126,38,77,203,11,58,123,155,167,60,176,151,7,39,75,217,254,32,110,79,123,188,133,158,178,132,198,169,23,5,104,124,44,206,191,239,139,152,110,207,42)), 165) print(166) assert("2d1dd80c3f0fc323ca46ebd0f73c628caa03f88b" == hmac_sha1(string.char(142,87,50,47,146,180,251,164,35,75,53,50,101,115,90,97,66,12), string.char(174,244,41,143,173,27,117,79,53,73,0,189,83,91,13,71,117,85,96,32,199,168,244,72,218,249,207,107,244,1,113,203,160,156,89,244,132,5,4,220,254,112,77,156,158,105,180,98,40,99,198,236,134,209,13,237,93,220,177,70,97,76,178,106,60,60,92,248)), 166) print(167) assert("444ef9725523ad1aac3d1c20f4954cdf1550d706" == hmac_sha1(string.char(242,169,63,243,133,158,118,205,250,154,66,127,178,170,214,241,96,22,173,138,6,189,90,45,108,70,236,108,93,58,54,204,85,241,194,55,55,184), string.char(30,52,200,164,245,80,75)), 167) print(168) assert("2170bcfb79e4ab2164287a30ee26535681e34505" == hmac_sha1(string.char(121,111,11,221,34,216,169,179,73,247,222,122,96,168,61,168,201,230,139,158,110,154,74,83,118,254,237,255,99,212,46,218,83,69,185,10,249,78,46,76,206,206,137,133,118,57,241,114,228,54,51,68,71,224,188,188,0,119,173,94,120,1,25,13,237,4,181,170,222,92,106,28,9,111,128,137,228,2,110,4,137,171,219,70), string.char(108,95,232,156,70,235,149,211,52,84,86,25,251,127,119,231,109,144,54,177,96,118,213,3,8,119,95,192,187,221,115,83,67,39,207,82,215,85,156,198,179,246,177,202,115,103,79,97,222,133,113,201,27,92,185,48,227,223,142,96,143,181,175,238,115,112,29,30,126,59,109,252,136,153,28,112,50,138,155,249,223,114,93,107,122,114,163,226,53,219,44,15,172,233,76,98,175,107,246,181,249,112,230,173,152,211,183,120,227,165,187,10,240,94)), 168) print(169) assert("2bcd1eb6df83aed8bcdfbb36474651f466b1fb22" == hmac_sha1(string.char(178,135,218,237,192,188,60,157,46,65,76,100,66,248,152,23,200,194,67,107,95,127,67,111,149,64,60,158,199,115,159,64,45,192,212,179,46,13,171,104,139,49,185,254,235,183,65,52,140,30,89), string.char(106,32,155,133,229,130,33,200,31,51,242)), 169) print(170) assert("505910401632c487cd9482ecd6ad16928f21d6f4" == hmac_sha1(string.char(170,34,244,62,31,230,158,102,235,63,93,33,111,253,232,211,132,160,120,156,107), string.char(43,16,194,149,208,76,252,14,73,11,1,172,79,41,132,217,125,96,221,110,199,248,129,122,45,63,77,145,21,98,40,149,154,9,127,27,168,224,204,167,203,74,218,196,236,230,47,29,122,138,65,239,123,120,29,68,236,137,130,95,114,230,185,146,32,69,201,48,251,233,103,61,132,167,245,42,68,249,145,166,137,204,186)), 170) print(171) assert("6d5f9ae7e8a51f2e615ae3aa8525a41b0bf77282" == hmac_sha1(string.char(166,8,119,187,177,166,23,183,147,37,177,162,102,16,93,204,247,119,248,179,23,89,48,145,188,37,197,176,238,218,173,6,216,229,224,108,58,78,40,199,9,241,191,154,88,124,237,142,228,7,235,102,142,123,4,124,38,46,170,229,116,243,104,106,26,163,94,2,118,71,173,171,104), string.char(41,12,123,197,199,117,129,177,132,149,175,83,168,79,76,58,236,204,99,121,155,207,228,89,236,154,103,137,183,221,208,93,22,222,28,237,140,21,25,149,188,111,6,85,251,31,73,79,239,246,66,46,215,157,184,5,207,4)), 171) print(172) assert("8c20120cd131e07d9fa46467602d57c9017ca22d" == hmac_sha1(string.char(12,24,169,75,70,190,156,115,112,233,245,216,85,248,62,24,91,179,204,185,0,129,209,137,116,97,242,183,35,151,91,170,41,4,81,12,120,47,78,145,193,50,237,224,62,203,171,169,6,141,126,75,29,40), string.char(47,165,0,107,170,77,37,219,45,135,102,68,144,218,213,74,35,58,246,179,171,3,148,55,216,32,29,102,83,58,29,11,166,75,243,60,21,9,202,179,236,129,212,62,217,203,6,193,18,176,156,198,86,140,135,222,109,48,195,112,167,218,92,76,71,40,128,221,235,43,81,109,198,51,77,122,183,111,173,195,8,249,40,159,212,136,180,215,171,70,60,108,26,185,11,222,67,47,142,179,158,131,135,153,168,251,199,21,44,7,164,68,212,209,54,75,18,200,117,213,16,175,152,29,146,154,151,236,143,173,86,70,224,138,71,33,33,151,122,205,128,223,166,51,149,125,178,225,234,164,180)), 172) print(173) assert("1ef2a94a2e620a164e07590f006c5a46b722fe7e" == hmac_sha1(string.char(78,109,133,245,198,165,112,63,135,53,124,251,110,183,41,34,153,68,22,253,66,201,9,41,15,99,105,14,252,172,212,39,100,14,128,16,64,47,104,37,33,27,203,120,163,182,52,37,27,224,212,40,134,81,70,29,155,101,246,141,238,41,253,124,222,216,49,49,85,46,51,51,122,39,221,156,104,7,14,52,71,93,31,219), string.char(191,94,78,159,209,12,118,97,214,190,238,108,175,252,192,244,8,104,145,30,236,242,45,49,215,185,251,73,46,101,156,221,136,245,45,240,138,174,187,151,0,122,113,154,195,94,245,186,218,211,203,189,37,251,21,33,225,66,168,152,102,200,245,101,102,217,193,215,194,214,48,131,153,140,75,100,237,240,32,89,113,17,125,177,189,188,212,101,211,212,102,57,251,213,216,14,86,204,198,147,122,97,203,127,100,107,126,107,116,34,220,122,154,130,135,199,9,243,9,194,214)), 173) print(174) assert("ad924bedf84061c998029fb2f168877f0b3939bb" == hmac_sha1(string.char(174,37,249,22,190,230,152,74,215,14,1,180,201,164,238,160,59,157,213,35,36,43,116,160,158,144,131,30,213,232,29,183,205,87,35,85,252,120,126,5,54,113,176), string.char(25,233,197,224,170,150,207,83,58,255,63,236,20,13,179,143,48,248,212,16,220,143,14,123,207,59,28,124,19)), 174) print(175) assert("75a6cfbedde0f1b196209a282b25f5f8b9fef3d1" == hmac_sha1(string.char(131,192,35,70,146,214,224,190,220,240,195,81,129,33,207,253,47,230,111,169,187,136,52,244,217,178,143,140,225,154,105,95,112,201,136,90,221,255,44,31,48,178,90,178,218,122,228,165,90,189,107,45,217,249,89,213,136,139,91,187,202,204,26,250,112), string.char(41,13,202,37,1,104,116,166,245,50,221,59,115,68,187,115,80,93,202,147,10,96,209,213,76,103,143,237,217,21,124,152,82,54,147,207,164,43,89,83,118,67,43,179,79,64,127,252,9,26,125,101,80,192,111,224,104,243,45,67,54,251,238,146,154,212,193,181,138,168,231,171,203,62,93,97,46,55,109,253,214,79,60,62,126,183,235,63,121,46,99,3,223,174,223,2,208,78,7,15,161,56,160,59,205,122,138,77,47,250,107,136,65,199,98,86,131,217,96,226,11,166,185,131,231,76,28,83,140,7,146,87,158,20,102,224,86,5,232,96,34,129,172,236,146,1,139,63,252,1,48,196,242,41,145,97,254,174,88,107,169,70,158,165,246,160,4,16,212,109,236)), 175) print(176) assert("c6f51cc53b0a341dafa4607ee834cffaa8c7c2a2" == hmac_sha1(string.char(85,193,15,80,156,124,171,95,40,75,229,181,147,237,153,83,232,67,210,131,57,69,7,226,226,195,164,46,185,83,120,177,67,77,119,201,9,123,117,111,148,176,12,145,14,80,225,95,71,136,179,94,136,6,78,230,149,135,176,131,19,125,185,48,200,244,111,8,28,170,82,121,242,200,208,145,73,59,234,19,87,61,79,137,245,148,212,94,96,253,227,60,162,170,49,102), string.char(200,235,229,185,225,227,209,209,199,11,112,58,19,202,246,237,94,60,90,176,145,87,191,138,171,88,242,239,21,146,3,92,255,188,99,146,74,134,252,19,201,111,239,76,249,231,71,109,230,240,192,234,253,52,58,173,153,24,131,161,97,222,0,203,177,179,186,160,46,206,73,176,154,39,248,22,66,164,232,120,188,5,73,245,68,8,40,157,155,93,50,207)), 176) print(177) assert("a07ef6f8799ef46062ffea5a43bb3edd30c1fdde" == hmac_sha1(string.char(81,90,37,124,211,22,19,34,50,56,90,45,17,230,233,38,76,24,250), string.char(142,185,46,191,103,207,110,48,71,10,217,115,193,52,131,87,106,39,9,80,216,15,235,169,30,143,3,7,188,78,34,136,18,200,181,140,22,253,141,59,235,25,59,204,147,80,162,108,237,101,167,249,7,168,24,123,215,220,198,38,133,253,72,168,10,139,84,22,195,36,241,128,70,132,28,242,56,40,159,113,184,187,89,38,198,255,176,88,112,125,68,12,57,207,3,251,72,198,135,48,118,244,199,192,205,164,181,243,40,33,195,204,9,78,108,253,114,211,173,121,245,104,13,116,143,160,241,139,210,162,78,62,69,232,40,248,254,177,6,148,177,168,51,253,177,84,152,29,107,91,186,68,118,30,125,62,196,24,14,87,158,83,39,240,192,79,78,61,133,109,106,98,120,232,144,18,49,96,17,202,208,189,152,171,219,19,41,132,179,219,83,220,201,36,191)), 177) print(178) assert("63585793821f635534879a8576194f385f4a551a" == hmac_sha1(string.char(78,213,189,105,102,116,246,215), string.char(162,53,102,158,78,125,120,189,186,214,237,16,219,220,44,24,30,62,32,177,104,217,225,27,92,128,95,202,50,177,239,152,151,161,31,152,93,108,29,125,23,63,55,243,160,169,99,102,15,188,196,129,217,239,132,180,177,251,132,173,62,172,21,139,16,137,231,6,243,185,218,60,60,156,166,153,99,149,144,192,151,249,141,165,222,254,4,111,58,46,106,78,160,215,49,128,252,4,114,236,132,108,114,189,143,45,42,84,134,81,47,140,247,146,247,179,63,14,92,136,120,139)), 178) print(179) assert("95bb1229d26df63839ba4846a41505d48ff98290" == hmac_sha1(string.char(121,190,21,20,39,101,53,249,44,132,19,132,4,114,199,22,32,143,38,33,184,181,66,55,183,240,31,204,225,230,125,186,87,25,90,229,11,55,239,62,101,67,238,1,104,178,191,144,148,105,6,26,127,154,135,247,248,171,41,44,57,83,186,220,42,40,68,153,189,221), string.char(99,150,114,100,37,53,229,202,20,171,246,91,188,188,46,232,70,26,151,35,223,28,97,132,9,242,55,238,98,75,108,91,226,48,236,209,133,92,68,194,241,199,188,86,59,255,230,128,252,193,94,113,134,27,32,50,191,176,159,185,89,209,255,192,9,214,252,63,147,8,92,162,114,72,50,101,136,180,95,39,55,143,137,118,40,14,104,3,149,153,230,135,98,93,72,180,72,86,185,80,107,69,68,20,73)), 179) print(180) assert("9e7c9a258a32e6b3667549cef7a61f307f49b4b9" == hmac_sha1(string.char(105,200,69,23,156,169,151,107,30,139,196,145,128,108,52,7,181,248,255,83,176,169,152,51,158,236,49,191,65,208,155,204,105,179,148,226,142,194,63,253,217,184,69,11,135,185,203,150,146,57,129,80,87,84,231,168,63,186,149,85,128,236,135,217,246,255,121,70,251,68,139,215,199,143,87,13,196,20,50,92,55,116,34,141,117,89,228,94,63,142,250,182,58,91,68,214), string.char(38,52,86,63,109,91,84,11,33,250,194,192,178,94,37,17,65,111,173,17,37,54,163,168,142,91,191,197,161,229,44,163,163,125,81,204,167,185,244,119,75,28,211,87,159)), 180) print(181) assert("7fb01c88e7e519265c18e714efd38bc66f831071" == hmac_sha1(string.char(138,214,212,108,83,152,165,123), string.char(148,223,186,162,237,166,230,68,59,78,220,164,231,42,46,211,239,38,39,150,174,50,58,4,0,135,87,123,123,5,33,252,197,6,53,83,27,178,189,228,166,252,91,141,67,44,68,106,222,17,46,84,214,252,110,181,216,132,14,246,209,57,183,155,238,64,215,121,8,169,157,175,182,191,169,94,116,105,91,49,203,30,155,202,39,140,146,6,115,162,112,130,175,86,143,128,126,249,148,185,39,174,63,83,19,76,164,34,228,97,198,250,65,3,168,158,61,130,167,166,144,185,146,184,160,39,189,11,243,125,255,60,217,46)), 181) print(182) assert("15ab3da2a97592c5f2e22586b4c8a8653411e756" == hmac_sha1(string.char(6,242,91,101,37,118,105,53,170,56,114,144,117,49,53,203,169,216,9,232,9,170,204,129,82,41,210,45,86,176,139,80,152,168,1,154,32,111,89,165,143,205,21,236,105,62,231,106,232,205,7,189,245,52,145,100,78,140,200,183,209,232,196,88,109,175,70,153,150,231,252,7,189,119,97,176,216,201,186,245,24,128,33,57,113,188,184,0,146,248,69,255,77,144,101), string.char(186,246,72,178,189,127,22,42,22,217,81,156,253,142,152,86,42,41,164,77,150,11,208,155,154,185,18,81,156,185,140,224,215,98,1,97,33,194,137,206,144,219,207,210,52,203,198,1,109,182,65,138,122,227,168,207,213,110,206,102,12,181,198,195,133,218,23,187,117,190,56,140,154,239,105,62,96,148,126,187,47,24,139,194,18,211,225,252,195,49,102,138,165,160,90,153,100,140,105,154,242,59,133,226,19,68,125,59,83,140,48,240,226,129,151,79,130,59,96,111,27,73,198)), 182) print(183) assert("7b06792805f4e8062ee9dfbbaffccd787c6f98e1" == hmac_sha1(string.char(83,132,152,16,245,136,91,241,37,158,80,92,65,223,79,3,189,213,89,253,159,93,194,52,218), string.char(212,242,37,98,229,190,238,23,210,197,147,253,82,105,146,168,198,253,2,160,165,188,165,221,179,112,136,72,149,79,138,70,101,95,210,73,157,14,211,92,27,230,177,84,170,183,15,40,0,92,222,252,166,48,1,139,40,16,186,178,231,109,100,125,253,125,123,94,115,94,150,157,186,230,115,163,194,164,30,131,162,90,28,61,44,248,137,8,246,173,31,177,236,39,8,10,192,148,211,36,215,57)), 183) print(184) assert("a28fe22ba0845ae3d57273febbbf1d13e8fde928" == hmac_sha1(string.char(149), string.char(11,139,249,120,214,252,67,75)), 184) print(185) assert("87a9daa85402f6c4b02f1e9fd6edd7e5d178bb88" == hmac_sha1(string.char(114,92,75,169,228,153,182,206,125,139,162,232,77,38,72,129,132,81,11,153,91,92,152,253,10,79,138,142,17,191,161,194,147,213,43,214,39,32,146,46,132,40,77,192,82,54,55,239,50,47), string.char(114,8,110,153,77,155,178,113,203,30,21,41,136,111,176,255,74,214,117,12,189,194,198,37,73,152,196,108,207,188,187,31,227,237,17,1,66,200,73,83,31,61,161,61,31,149,1,152,140,202,163,175,140,136,51,59,121,28,125,192,238,96,192,65,33,177,136,135,173,13,52,101,42,55,189,201,157,244,104,235,148,114,84,154,10,99,153,41,208,213,41,83,193,129,216,46,4,226,81,184,1,249,70,93,183,173,9,29,57,75,209,67,227,49,253,132,129,13,157,55,66,191,136,67,95,108,155,116,17,125,151,217,242,204,110,143,189,201,118)), 185) print(186) assert("6300b2f6236b83de0c84ff1816d246231a5d3b79" == hmac_sha1(string.char(215,10,19,7,73,236,63,23,34,49,11,240,186,195,32,171,67,85,7,95,190,237,77,216,115,36,230,204,139,95,229,37,201,115,81,96,217,205,49,22,169,32,90,2,90,93,137,247,83,229,39,88,235,175,191,246,80,40,228,114,188,115,14,252,35,40,130,240,20,25,202,80,184,27,227,175,149,64,110,223,25,64,57,189,153,176,143,30,76,2,68), string.char(13,245,250,139,223,128,3,6,189,59,12,139,38,153,215,76,250,198,91,117,242,118,34,26,133,244,143,5,56,182,213,167,144,71,250,40,202,81,22,14,72,201,143,10,177,4,166,75,160,156,100,5,147,138,104,98,9,125,81,202,44,120,241,221,181,0,169,155,96,1,4,205,145,105,150,122,135,231,42,165,179,83,39,122,159,193,139,28,4,201,178,41,168,11,177,61,39,14,196,60,29,131,201,91,46,35,128,63,167,48,132,134,105,224,246,244,81,144,209,123,222,190,167,138,76,194,42,152,23,125,52,156,18,217,101,207,239,63,235,3,3,49,147,172,158,97,179,86,233,85,155,245,206,205,165,195,180,223,20,62,197,143,149,126,152)), 186) print(187) assert("35fe4e0cf2417a783d5bdbc17bbc0ab77d2699e7" == hmac_sha1(string.char(15,157,117,128,204,42,12,183,229,129,132,234,228,150,235,100,100,77,160,26,154,230,246,138,150,120,252,20,188,138,171,189,208,62,201,58,158,152,167,165,98,249,52,143,7,26,109,227,144,81,213,157,31,155,26,12,206,103,193,29,142,126,205,123,83,111,179,166,31,32,183,183,100,54,51,205,180,186,160,220,176,233,42,94,62,241,88,74,31,24,22,115,179,124,136,206,78,83), string.char(248,157,191,249,76,86,187,243,10,116,1,227,141,21,104,154,167,72,30,245,6,57,40,170,253,15,4,192,237,237,142,141,196,243,231,245,121,219,150,237,212,118,78,25,201,249,174,21,76,98,187,155,82,243,218,142,239,101,235,240,134,70,212,205,136,165,170,71,121,137,44,8,110,14,167,162,233,92,51,191,178,227,85,134,168,222,121,62,35,127,57,92,80,142,91,112,9,248,129,127,236,2,190,165,125,236,188,117,158,241,181,134,54,133,16,64,100,156,59,83,249,105,235,187,160,186,158,173,52,25,129,20,156,209,102,170,209,10,3,233,12,228,205,138,16,140,108,74,75,65,238,155,251,129,73,236,118,93,202,217,46,180,165,27,84,120,61,186,173,148,131,161,187,30,175,21,249,12,245,145,89,93,61,151,254,29,247,51,198,238,111,52,30,254)), 187) print(188) assert("83c2a380e55ecbc6190b9817bb291a00c36de5e8" == hmac_sha1(string.char(61,128,92,30,94,101,187,67,197,177,98,100,191,221,190,196,86,62,8,238,225,3,93,127,28,126,217,206,56,192,90,9,74,34,43,228,190,162,57,99,170,238,230,196,99,213,31,6,184,11,79,82,100,68,255,40,63), string.char(78,173,248,128,215,226,77,57,233,135,163,11,241,74,59,78,169,219,125,37,182,56,139,89,32,52,80,165,233,52,179,54,216,45,205,209,173,33,12,148,231,66,126,155,191,91,155,174,23,15,14,28,77,186,139,113,48,141,153,177,252,194,23,61,181,189,66,151,45,11,119,74,236,107,206,244,41,117,161,182,233,138,57,196,90,118,28,99,186,150,54,180,105,230,2,41,246,19,80,211,173,102,72,78,82,253,5,183,248,101,173,204,2,145,105,4,160,44,110,211,63,45,46,78)), 188) print(189) assert("bd59d0dcf812107a613a2d892322f532c16ec210" == hmac_sha1(string.char(161,183,101,160,169,208,82,58,88,198,190,85,53,240,56,6,20,136,86,18,216,63,190), string.char(39,227,142,194,37,34,121,168,239,99,70,39,179,128,26,113,47,95,70,129,255,219,63,233,44,33,19,127,22,24,208,50,19,141,185,19,54,82,147,138,44,69)), 189) print(190) assert("6aa92cb64b2e390fbf04dc7edfe3af068109ffba" == hmac_sha1(string.char(202,230,55,100,136,80,156,240,98,73,97,72,191,195,185,105,150,97,148,33,167,140,212,100,247,154,5,152,117,24,128,221,150,49,143,86,12,211,161,75,177,75,145,46,112,143,37,181,84,50,230,81), string.char(131,200,0,161,117,217,5,10,64,79,178,147,64,248,35,147,135,103,157,181,194,123,76,13,150,118,204,63,32,203,155,222,227,148,31,28,218,83,245,17,208,200,104,78,85,31,114,194,67,159,184,167,42,199,241,6,182,195,3,79,22,236,124)), 190) print(191) assert("a42cf08fa6d8ad6ae00251aeed0357dca80645c7" == hmac_sha1(string.char(170,52,245,172,122,225,164,248,23,35,54,243,118,35,165,16,6), string.char(245,115,59,162,179,146,39,213,64,240,80,108,190,127,116,16,154,211,33,171,150,46,77,213,99,88,160,101,236,202,70,26,61,83,79,110,127,74,97,34,18,243,140,34,244,249,225,88,132,102,7,99,220,140,46,111,96,48,93,44,47,186,86,246,244,127,236,150,35,69,111,238,54,24,71,157,254,21,2,194,69,47,190,87,72,235,60,243,40,153,111,55,220,25,91,17,156,195,57,207,107,145,6,82,104,232,209)), 191) print(192) assert("8dd62dcf68ef2d193005921161341839b8cac487" == hmac_sha1(string.char(136,5,195,241,18,208,11,46,252,182,96,183,164,87,248,13), string.char(78,49,162,9,47,79,26,139,66,194,248,90,171,207,167,43,201,223,102,192,49,145,83,42,1,52,250,116,216,133,224,224,17,143,41,153,65,214,231,109,160,5,31,85,17,186,199,226,214,92,21,194,148,98,68,209,50,74,26,150,97,59,223,8,131,173,145,6,31,126,248,86,226,2,94,15,3,202,239,99,177,237,61,99,14,253,26,246,0,151,2,7,159,40,249,166)), 192) print(193) assert("eff66e7a69ae7d2a90b2d80c64ce7c41fe560a19" == hmac_sha1(string.char(123,54,89,205,103,116,21,97,164,41,23,224,151,195,22,196,90,52,253,92), string.char(141,12,168,171,49,30,165,57,107,214,157,224,36,163,182,184,103,186,133,22,2,215,52,220,95,205,231,180,221,139,67,184,21,46,172,95,183,220,31,27,227,122,183,196,114,206,132,162,51,164,84,212,172,63,218,236,127,215,218,77,119,105,14,19,164,53,149,11,13,1,29,246,69,200,208,239,154,60,245,31,172,82,158,165,197,250,151,83,12,156,215,201,66,45,238,228,77,125,157,35,235,162,78,220,132,14,137,168,238,127,10,24,41,132,181,43,95,73,33,32,129,149,145,55,80,156,171,73,90,183,166,182,163,154,31,104,14,56,59,102,72,210,121,191,251,239,1,5,76,116,158,89,40,69,220,107,23,168,106,93,92,95,21,91,118,118,71,29,64,142,84,15,153,193,47,214,30,117,236,217)), 193) print(194) assert("0f1adc518afcca2ed7ad0adaaedd544835ddb76e" == hmac_sha1(string.char(142,36,199,16,52,54,62,146,153,25,162,85,251,247), string.char(110,70,53,237,120,53,50,196,24,82,199,210,156,178,110,124,7,24,229,89,39,1,10,96,74,211,36,79,166,4,33,238,64,220,239,129,48,232,244,172,142,79,154,73,36,107,182,208,191,25,201,19,233,23,60,236,180,76,116,53,232,181,101,62,160,252,213,171,166,113,193,73,75,13,209,63,76,92,95,176,119,0,125,174,42,138,77,23,212,81,180,10,193,118,244,242,163,246,206,150,162,92,20,208,51,71,254,197,11,222,203,153,208,251,243,193,124,141,215,171,55,244,230,78,158,32,223,138,156,43,98,39,191,108,111,6,117,130,195,100,221,233,17,98,180,49,132,139,171,20,180,7,206,35,54,17,48,253,130,185,249,2,52,17,207,73,24,33)), 194) print(195) assert("5e87f8d9a653312fd7b070a33a5d9e67b28b9a84" == hmac_sha1(string.char(255,237,33,255,4,170,95,90,88,77,217,10,94,118,134,20,33,208,17,136,77,18,169,205,112,36,203,231,67,47,186,91,7,17,29), string.char(97,211,98,53,135,238,42,101,144,12,75,185,119,223,114,81,201,94,21,118,16,152,74,215,56,61,131,151,83,96,83,59,49,199,255,207,153,90,231,39,181,4,59,9,2,150,207,124,209,120,37,236,195,66,189,209,137,9,165,78,172,142,209,243,237,145,204,210,222,153,52,127,39,174,133,17,186,219,87,142,209,212,223,60,249,57,244,251,44,254,73,238,52,99,94,237,189,185,237,1,101,166,220,170,103,209)), 195) print(196) assert("837c7cc92e0d2c725b1d1d2f02ef787be37896fa" == hmac_sha1(string.char(150,241,64,89,79,72,88,157,113,139,190,43,211,214,202,52,124,91,111,198,47,161,120,17,120,157,112,248,245,154,254,25,233,96,216), string.char(214,251,73,193,181,158,253,28,23,48,186,168,162,26,124,103,22,195,165,63,189,196,162,229,69,1,208,85,249,24,73,101,243,149,68,236,124,147,108,67,37,75,202,143,57,124,71,176,27,216,208,183,164,173,219,170,79,10,198,1,232,35,9,19,70,131,211,60,37,94,146,98,92,31,150,95,89,189,46,38,156,118,171,137,86,87,32,173,77,14,135,233,233,114,162,136,57,113,73,115,134,87,184)), 196) print(197) assert("64534553f76e55b890101380ad9149d3cacb5b76" == hmac_sha1(string.char(231,24,192,54,17,14,98,122,119,170,71,54,206,207,223,109,164,181,124,186,122,111,122,34,157,24,237,130,207,206,117,76,183,162,174,124,60,60,77,114,139,170,194,143,232,74,160,141,161,171,51,178,162,159,234,208,55), string.char(141,184,241,185,112,45,53,192,72,152,139,145,146,149,145,151,12,140,111,79,158,172,212,175,75,225,127,4,252,104,5,94,105,24,141,183,79,208,240,227,63,126,213,4,13,109,216,244,237,24,196,52,212,245,147,109,18,63,69,107,122,245,101,67,212,232,92,25,135,67,127,247,187,143,224,198,105,38,147,12,238,6,57,53,105,246,0,127,222,69,163,44,11,245,82,220,32,108,33,70,93,177,89,75,192,214,104,236,84,28,221,209,27,12,80,239,111,249,57,39,236,193,17,69,66,180,63,193,242,248,72,22,225,56,198,235,111,102,33,171,159,124,220,143,108,10,71,186,219,213,28,209,145,188,36,70,59,9,235,154,57,12,211,146,6,87,83)), 197) print(198) assert("b7efbbc21ac1a746e22368e814ef5921056331ac" == hmac_sha1(string.char(137,153,151,252,88,36,165,92,194,50,19,117), string.char(155,113,35,47,22,52,144,77,130,20,178,133,75,207,168,146,132,209,160,7,123,190,117,196,147,212,142,25,182,222,56,249,192,228,6,224,250,221,89,7,176,27,37,49,215,192,74,132,127,101,32,23,34,131,23,74,37,226,208,205,162,242,102)), 198) print(199) assert("950ad3222f4917f868d09feab237a909fb6d50b7" == hmac_sha1(string.char(78,46,85,132,231,4,243,255,22,45,240,155,151,119,94,213,50,111,10,83,40,204,49,52,17,69,132,44,213,83,54,251,211,159,123,55,17,58,162,170,210,3,35,237,165,181,217,27,7,249,158,22,158,207,77,121,37,63,37,39,204,68,99,158,78,175,73,183,47,99,134,65,74,234,154,33,14,117,126,98,167,242,106,112,145,82), string.char(144,133,184,16,9,8,227,98,190,60,141,255,87,69,63,214,12,67,14,206,32,120,59,232,176,82,32,194,115,52,148,143,126,86,82,101,167,249,17,169,9,105,228)), 199) skynet.start(skynet.exit)
mit
TheAnswer/FirstTest
bin/scripts/items/objects/weapons/unarmed/vibroknuckler.lua
1
2428
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. vibroknuckler = Weapon:new{ objectName = "Vibroknuckler", templateName = "object/weapon/melee/special/shared_vibroknuckler.iff", objectCRC = 1697024206, objectType = MELEEWEAPON, armorPiercing = WEAPON_LIGHT, certification = "cert_vibroknuckler", attackSpeed = 2.2, minDamage = 36, maxDamage = 139 }
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/slashcommands/admin/setMinimumSpawnTime.lua
1
2473
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 SetMinimumSpawnTimeSlashCommand = { name = "setminimumspawntime", alternativeNames = "", animation = "", invalidStateMask = 2097152, --glowingJedi, invalidPostures = "", target = 2, targeType = 0, disabled = 0, maxRangeToTarget = 0, --adminLevel = 0, addToCombatQueue = 0, } AddSetMinimumSpawnTimeSlashCommand(SetMinimumSpawnTimeSlashCommand)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/tailor/casualWearIiiWeatherWear/wookieePaddedGloves.lua
1
3802
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser 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 --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. wookieePaddedGloves = Object:new { objectName = "Wookiee Padded Gloves", stfName = "wke_gloves_s03", stfFile = "wearables_name", objectCRC = 1176247740, groupName = "craftClothingCasualGroupC", -- Group schematic is awarded in (See skills table) craftingToolTab = 8, -- (See DraftSchemticImplementation.h) complexity = 17, size = 2, xpType = "crafting_clothing_general", xp = 140, assemblySkill = "clothing_assembly", experimentingSkill = "clothing_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "shell, liner, grip_pads", ingredientSlotType = "0, 0, 0", resourceTypes = "fiberplast, hide, petrochem_inert", resourceQuantities = "15, 25, 20", combineTypes = "0, 0, 0", contribution = "100, 100, 100", numberExperimentalProperties = "1, 1, 1, 1", experimentalProperties = "XX, XX, XX, XX", experimentalWeights = "1, 1, 1, 1", experimentalGroupTitles = "null, null, null, null", experimentalSubGroupTitles = "null, null, sockets, hitpoints", experimentalMin = "0, 0, 0, 1000", experimentalMax = "0, 0, 0, 1000", experimentalPrecision = "0, 0, 0, 0", tanoAttributes = "objecttype=16777232:objectcrc=2828120513:stfFile=wearables_name:stfName=wke_gloves_s03:stfDetail=:itemmask=61955::", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "", customizationDefaults = "", customizationSkill = "clothing_customization" } DraftSchematics:addDraftSchematic(wookieePaddedGloves, 1176247740)--- Add to global DraftSchematics table
lgpl-3.0