content
stringlengths
5
1.05M
local config = require"lspinstall/util".extract_config("elixirls") config.default_config.cmd = { "./elixir-ls/language_server.sh" } return vim.tbl_extend('error', config, { install_script = [[ rm -rf elixir-ls curl -fLO https://github.com/elixir-lsp/elixir-ls/releases/latest/download/elixir-ls.zip unzip elixir-ls.zip -d elixir-ls chmod +x elixir-ls/language_server.sh rm elixir-ls.zip ]], })
-- genie, https://github.com/bkaradzic/GENie -- known working version -- https://github.com/bkaradzic/bx/blob/51f25ba638b9cb35eb2ac078f842a4bed0746d56/tools/bin/windows/genie.exe MINGW_ACTION = 'gmake' if _ACTION == MINGW_ACTION then -- need a msys2 with clang premake.gcc.cc = 'clang' premake.gcc.cxx = 'clang++' premake.gcc.ar = 'llvm-ar' premake.llvm = true local LIB_DIVERT_MINGW = 'external/WinDivert-2.2.0-A' local ROOT = _WORKING_DIR print(ROOT) solution('clumsy') location("./build") configurations({'Debug', 'Release'}) platforms({'x64', 'x32'}) project('clumsy') language("C") files({'src/**.c', 'src/**.h'}) links({'WinDivert', 'comctl32', 'Winmm', 'ws2_32'}) configuration('Debug') flags({'ExtraWarnings', 'Symbols'}) defines({'_DEBUG'}) kind("ConsoleApp") configuration('Release') flags({"Optimize"}) flags({'Symbols'}) -- keep the debug symbols for development defines({'NDEBUG'}) kind("ConsoleApp") configuration(MINGW_ACTION) links({'kernel32', 'gdi32', 'comdlg32', 'uuid', 'ole32'}) -- additional libs buildoptions({ '-Wno-missing-braces', '-Wno-missing-field-initializers', '--std=c99' }) objdir('obj_'..MINGW_ACTION) configuration({'x32', MINGW_ACTION}) defines({'X32'}) -- defines would be passed to resource compiler for whatever reason includedirs({LIB_DIVERT_MINGW .. '/include'}) libdirs({LIB_DIVERT_MINGW .. '/x86'}) resoptions({'-O coff', '-F pe-i386'}) -- mingw64 defaults to x64 configuration({'x64', MINGW_ACTION}) defines({'X64'}) includedirs({LIB_DIVERT_MINGW .. '/include'}) libdirs({LIB_DIVERT_MINGW .. '/x64'}) local function set_bin(platform, config, arch) local platform_str = platform local subdir = ROOT .. '/bin/' .. platform_str .. '/' .. config .. '/' .. arch local divert_lib if arch == 'x64' then divert_lib = ROOT .. '/' .. LIB_DIVERT_MINGW .. '/x64/' else divert_lib = ROOT .. '/' .. LIB_DIVERT_MINGW .. '/x86/' end configuration({platform, config, arch}) targetdir(subdir) debugdir(subdir) postbuildcommands({ -- robocopy returns non 0 will fail make 'cp ' .. divert_lib .. "WinDivert* " .. subdir, }) end set_bin(MINGW_ACTION, 'Debug', "x32") set_bin(MINGW_ACTION, 'Debug', "x64") set_bin(MINGW_ACTION, 'Release', "x32") set_bin(MINGW_ACTION, 'Release', "x64") end
posButtonx = 380 posButtony = 450 function menuLoad() imgMenu = love.graphics.newImage('image/tryme.png') end function menuUpdate(dt) end function menuDraw() love.graphics.setColor(1,1,1) love.graphics.draw(imgMenu,330,20) if love.keyboard.isDown("r") then love.graphics.setColor(1,1,1) love.graphics.print("X" ..love.mouse.getX().."Y".. love.mouse.getY(), 10, 10) end love.graphics.setColor(0.4,0.4,0.5) love.graphics.rectangle("fill" ,posButtonx,posButtony + 100,larguraBotaoMenu,alturaBotaoMenu) love.graphics.setColor(0,0,0) love.graphics.setFont(love.graphics.newFont(20)) love.graphics.print("INICIAR O JOGO", 480, 570) buttonIniciar = love.mouse.getX() > 380 and love.mouse.getY() > 550 and love.mouse.getX() < 730 and love.mouse.getY() < 615 if love.mouse.isDown(1) and buttonIniciar then gamestate = "fase1" end love.graphics.setColor(0.4,0.4,0.5) love.graphics.rectangle("fill" ,posButtonx,posButtony + 200,larguraBotaoMenu,alturaBotaoMenu) love.graphics.setColor(0,0,0) love.graphics.setFont(love.graphics.newFont(20)) love.graphics.print("SAIR DO JOGO", 485, 570 + 100) buttonSair = love.mouse.getX() > 380 and love.mouse.getY() > 650 and love.mouse.getX() < 730 and love.mouse.getY() < 710 if love.mouse.isDown(1) and buttonSair then love.event.quit() end end
minetest.register_privilege("damocles_builder", { description = "can build games on the server", }) minetest.register_privilege("damocles_center", { description = "can build on the center platform", })
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ========== PlaceObj('StoryBit', { ActivationEffects = { PlaceObj('PauseExpedition', nil), }, Category = "PlanetaryAnomaly", Effects = {}, Enabled = true, Image = "UI/Messages/rocket.tga", Prerequisites = {}, ScriptDone = true, Text = T(186317965668, --[[StoryBit LiftMeUp Text]] "Only through sheer luck the Rocket managed to make an emergency landing on a safe spot, but even now there are no signs that the engine could start working again."), TextReadyForValidation = true, TextsDone = true, Title = T(188954210890, --[[StoryBit LiftMeUp Title]] "Lift Me Up"), Trigger = "PlanetaryAnomalyEvent", VoicedText = T(440009087756, --[[voice:narrator]] "During flight to the Anomaly site, the engine stalled and the Rocket began losing altitude."), group = "Expeditions", id = "LiftMeUp", PlaceObj('StoryBitReply', { 'Text', T(437116028960, --[[StoryBit LiftMeUp Text]] "Abandon the expedition."), 'OutcomeText', "custom", 'CustomOutcomeText', T(251910959995, --[[StoryBit LiftMeUp CustomOutcomeText]] "the expedition will be lost"), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Effects', { PlaceObj('KillExpedition', nil), }, }), PlaceObj('StoryBitReply', { 'Text', T(966429692667, --[[StoryBit LiftMeUp Text]] "Send three rescue supply pods with replacement parts."), 'OutcomeText', "custom", 'CustomOutcomeText', T(474201552955, --[[StoryBit LiftMeUp CustomOutcomeText]] "pay Funding, the expedition will be saved"), 'Cost', 550000000, }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Effects', { PlaceObj('ResumeExpedition', nil), }, }), PlaceObj('StoryBitReply', { 'Text', T(628172516220, --[[StoryBit LiftMeUp Text]] "Send me the schematics, and put the expedition team on comm."), 'OutcomeText', "custom", 'CustomOutcomeText', T(521042853228, --[[StoryBit LiftMeUp CustomOutcomeText]] "the expedition will be saved"), 'Prerequisite', PlaceObj('IsCommander', { 'CommanderProfile', "inventor", }), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Effects', { PlaceObj('ResumeExpedition', nil), }, }), })
-- Copyright (C) 2017-2020 DBotThePony -- 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 SysTime = SysTime local timeStart = SysTime() DLib.MessageNoNL('Initializing DLib serverside ... ') CreateConVar('sv_dlib_hud_shift', '1', {FCVAR_REPLICATED, FCVAR_NOTIFY}, 'SV Override: Enable HUD shifting') AddCSLuaFile('dlib/modules/notify/client/cl_init.lua') AddCSLuaFile('dlib/modules/hudcommons/advanced_draw.lua') AddCSLuaFile('dlib/modules/hudcommons/colors.lua') AddCSLuaFile('dlib/modules/hudcommons/functions.lua') AddCSLuaFile('dlib/modules/hudcommons/hl2icons.lua') AddCSLuaFile('dlib/modules/hudcommons/matrix.lua') AddCSLuaFile('dlib/modules/hudcommons/menu.lua') AddCSLuaFile('dlib/modules/hudcommons/poly.lua') AddCSLuaFile('dlib/modules/hudcommons/position.lua') AddCSLuaFile('dlib/modules/hudcommons/position2.lua') AddCSLuaFile('dlib/modules/hudcommons/simple_draw.lua') AddCSLuaFile('dlib/modules/hudcommons/stencil.lua') AddCSLuaFile('dlib/modules/hudcommons/stripped.lua') AddCSLuaFile('dlib/modules/hudcommons/pattern.lua') AddCSLuaFile('dlib/modules/hudcommons/base/crosshairs.lua') AddCSLuaFile('dlib/modules/hudcommons/base/defaultvars.lua') AddCSLuaFile('dlib/modules/hudcommons/base/functions.lua') AddCSLuaFile('dlib/modules/hudcommons/base/init.lua') AddCSLuaFile('dlib/modules/hudcommons/base/logic.lua') AddCSLuaFile('dlib/modules/hudcommons/base/menus.lua') AddCSLuaFile('dlib/modules/hudcommons/base/variables.lua') AddCSLuaFile('dlib/modules/hudcommons/base/wepselect.lua') AddCSLuaFile('dlib/modules/notify/client/animated_base.lua') AddCSLuaFile('dlib/modules/notify/client/badges.lua') AddCSLuaFile('dlib/modules/notify/client/base_class.lua') AddCSLuaFile('dlib/modules/notify/client/centered_class.lua') AddCSLuaFile('dlib/modules/notify/client/cl_init.lua') AddCSLuaFile('dlib/modules/notify/client/font_obj.lua') AddCSLuaFile('dlib/modules/notify/client/legacy.lua') AddCSLuaFile('dlib/modules/notify/client/slide_class.lua') AddCSLuaFile('dlib/modules/notify/client/templates.lua') AddCSLuaFile('dlib/util/client/blur.lua') AddCSLuaFile('dlib/util/client/buystuff.lua') AddCSLuaFile('dlib/util/client/chat.lua') AddCSLuaFile('dlib/util/client/donate.lua') AddCSLuaFile('dlib/util/client/localglobal.lua') AddCSLuaFile('dlib/util/client/matnotify.lua') AddCSLuaFile('dlib/util/client/scrsize.lua') AddCSLuaFile('dlib/util/client/ttfreader.lua') AddCSLuaFile('dlib/util/client/menu.lua') AddCSLuaFile('dlib/util/client/displayprogress.lua') AddCSLuaFile('dlib/util/client/performance.lua') AddCSLuaFile('dlib/modules/client/friendstatus.lua') AddCSLuaFile('dlib/modules/client/lastnick.lua') include('modules/notify/sv_dnotify.lua') include('modules/server/dmysql4.lua') include('modules/server/dmysql4_bake.lua') include('modules/server/dmysql.lua') include('modules/server/friendstatus.lua') AddCSLuaFile('dlib/vgui/avatar.lua') AddCSLuaFile('dlib/vgui/button_layout.lua') AddCSLuaFile('dlib/vgui/colormixer.lua') AddCSLuaFile('dlib/vgui/dtextentry.lua') AddCSLuaFile('dlib/vgui/dtextinput.lua') AddCSLuaFile('dlib/vgui/extendedmenu.lua') AddCSLuaFile('dlib/vgui/player_button.lua') AddCSLuaFile('dlib/vgui/skin/colours.lua') AddCSLuaFile('dlib/vgui/skin/draw/buttons.lua') AddCSLuaFile('dlib/vgui/skin/draw/common.lua') AddCSLuaFile('dlib/vgui/skin/draw/gwen.lua') AddCSLuaFile('dlib/vgui/skin/draw/menus.lua') AddCSLuaFile('dlib/vgui/skin/draw/util.lua') AddCSLuaFile('dlib/vgui/skin/draw/window.lua') AddCSLuaFile('dlib/vgui/skin/hooks.lua') AddCSLuaFile('dlib/vgui/skin/icons.lua') AddCSLuaFile('dlib/vgui/skin.lua') AddCSLuaFile('dlib/vgui/util.lua') AddCSLuaFile('dlib/vgui/window.lua') AddCSLuaFile('dlib/vgui/filebrowser.lua') include('dlib/util/server/chat.lua') DLib.MessageNoPrefix(string.format('%.2f ms\n', (SysTime() - timeStart) * 1000)) timeStart = SysTime() DLib.Message('Running addons ...') if not VLL_CURR_FILE and not VLL2_FILEDEF then DLib.Loader.SharedLoad('dlib/autorun') DLib.Loader.ServerLoad('dlib/autorun/server') DLib.Loader.ClientLoad('dlib/autorun/client') end DLib.Message(string.format('Addons were initialized in %.2f ms', (SysTime() - timeStart) * 1000)) timeStart = SysTime() DLib.MessageNoNL('[DLib] Loading translations for i18n ... ') DLib.I18n.Reload() concommand.Add('dlib_reload_i18n', function(ply) if IsValid(ply) then return end timeStart = SysTime() DLib.Message('Reloading translations for i18n ... ') DLib.I18n.Reload() hook.Run('DLib.TranslationsReloaded') DLib.Message(string.format('i18n reload took %.2f ms', (SysTime() - timeStart) * 1000)) end) hook.Run('DLib.TranslationsReloaded') DLib.MessageNoPrefix(string.format('%.2f ms\n', (SysTime() - timeStart) * 1000)) MsgC('---------------------------------------------------------------\n')
local lush = require'lush' local base = require'lucid.base' local plugins = require'lucid.plugins' return lush.merge({ base, plugins })
--[[ Copyright (c) 2019 igor725, scaledteam released under The MIT license http://opensource.org/licenses/MIT ]] local bp = { global = true, defaults = { [7] = false, [8] = false, [9] = false, [10] = false, [11] = false } } local function setBlockPermFor(player, id, allowPlace, allowDelete) if player:isSupported('BlockPermissions')then allowPlace = (allowPlace and 1)or 0 allowDelete = (allowDelete and 1)or 0 player:sendPacket(false, 0x1C, id, allowPlace, allowDelete) end end function bp:load() registerSvPacket(0x1C, 'bbbb') getPlayerMT().setBlockPermissions = function(...) setBlockPermFor(...) end end function bp:prePlayerSpawn(player) for id, v in pairs(self.defaults)do if type(v) == 'boolean'then setBlockPermFor(player, id, v, v) elseif type(v) == 'table'then setBlockPermFor(player, id, unpack(v)) end end end return bp
war_gronda = Creature:new { objectName = "@mob/creature_names:war_gronda", socialGroup = "gronda", faction = "", level = 23, chanceHit = 0.34, damageMin = 200, damageMax = 210, baseXp = 2443, baseHAM = 5400, baseHAMmax = 6600, armor = 0, resists = {140,10,140,10,10,-1,-1,-1,-1}, meatType = "meat_carnivore", meatAmount = 390, hideType = "hide_leathery", hideAmount = 300, boneType = "bone_mammal", boneAmount = 240, milk = 0, tamingChance = 0.25, ferocity = 0, pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY, creatureBitmask = NONE, optionsBitmask = AIENABLED, diet = HERBIVORE, templates = {"object/mobile/war_gronda.iff"}, hues = { 24, 25, 26, 27, 28, 29, 30, 31 }, controlDeviceTemplate = "object/intangible/pet/gronda_hue.iff", scale = 1.1, lootGroups = {}, weapons = {}, conversationTemplate = "", attacks = { {"knockdownattack",""}, {"stunattack",""} } } CreatureTemplates:addCreatureTemplate(war_gronda, "war_gronda")
--[[---------------------------------------------------------------------------- UniteGalleryPluginManagerDialogSections.lua Export dialog customization for Unite Gallery exporter ------------------------------------------------------------------------------]] -- Lightroom SDK local LrView = import 'LrView' local LrPrefs = import 'LrPrefs' --============================================================================-- UniteGalleryPluginManagerDialogSections = {} ------------------------------------------------------------------------------- function UniteGalleryPluginManagerDialogSections.sectionsForBottomOfDialog( viewFactory, propertyTable ) local f = viewFactory local bind = LrView.bind local share = LrView.share local prefs = LrPrefs.prefsForPlugin() local result = { { title = LOC "$$$/UniteGallery/PluginManager/BottomSection/Title=Logging", synopsis = bind { key = 'title', object = propertyTable }, -- Enable logging f:row { f:static_text { title = LOC "$$$/UniteGallery/PluginManager/BottomSection/Method/Label=Method:", alignment = 'right', width = share 'labelWidth' }, f:popup_menu { value = bind { key = "logging_method", bind_to_object = prefs }, items = { { title = LOC "$$$/UniteGallery/PluginManager/BottomSection/Method/Off=None", value = "off", }, { title = LOC "$$$/UniteGallery/PluginManager/BottomSection/Method/File=Logfile", value = "logfile", }, { title = LOC "$$$/UniteGallery/PluginManager/BottomSection/Method/Console=Console", value = "print", }, }, tooltip = LOC "$$$/UniteGallery/PluginManager/BottomSection/Method/Tooltip=Activates logging to the given target system.", }, }, -- Log level f:row { f:static_text { title = LOC "$$$/UniteGallery/PluginManager/BottomSection/Level/Label=Log Level:", alignment = 'right', width = share 'labelWidth' }, f:popup_menu { enabled = bind { key = "logging_method", bind_to_object = prefs, transform = function( value, _ ) return value == "logfile" or value == "print" end }, value = bind { key = "logging_level", bind_to_object = prefs }, items = { { title = LOC "$$$/UniteGallery/PluginManager/BottomSection/Level/Trace=Everything", value = "trace", }, { title = LOC "$$$/UniteGallery/PluginManager/BottomSection/Level/Info=Normal", value = "info", }, { title = LOC "$$$/UniteGallery/PluginManager/BottomSection/Level/Error=Errors", value = "error", }, }, tooltip = LOC "$$$/UniteGallery/PluginManager/BottomSection/Level/Tooltip=The amount of data that is written to the log system.", }, }, }, } return result end
solution "gmsv_refresh" language "C++" location ( "project-" .. os.get() ) targetdir ( "build/" .. os.get() .. "/" ) flags { "StaticRuntime" } includedirs { "include" } libdirs { "lib" } links { "Psapi" } configurations { "Release" } configuration "Release" defines { "GMMODULE" } optimize "On" project "gmsv_refresh" kind "SharedLib" files { "src/**.cpp", "src/**.h" } if os.is "windows" then targetsuffix "_win32" elseif os.is "linux" then targetsuffix "_linux" elseif os.is "macosx" then targetsuffix "_osx" end
local Prop = {} Prop.Name = "City Hall" Prop.Government = true Prop.Doors = { Vector( 414, -4276, 352 ), Vector( 290, -4276, 352 ), } GM.Property:Register( Prop )
local utilities = {} require("bit32-compat") function utilities.required(t, name, context) if not t[name] then utilities.error(context.." needs a "..name.." parameter") end return t[name] end function utilities.error(message) print("\n! "..message.. " in "..SILE.currentlyProcessingFile) assert(false, "ERROR") os.exit(1) end function utilities.warn(message) print("\n! "..message) --print(debug.traceback()) --os.exit(1) end function utilities.debugging(category) return SILE.debugFlags[category] end function utilities.gtoke(string, pattern) string = string and tostring(string) or '' pattern = pattern and tostring(pattern) or "%s+" local length = #string return coroutine.wrap(function() local index = 1 repeat local first, last = string:find(pattern, index) if last then if index < first then coroutine.yield({ string = string:sub(index, first - 1) }) end coroutine.yield({ separator = string:sub(first, last) }) index = last + 1 else if index <= length then coroutine.yield({ string = string:sub(index) }) end break end until index > length end) end function utilities.debug(category, messages) if utilities.debugging(category) then print("["..category.."]", messages) end end function utilities.concat(array, c) return table.concat(utilities.map(tostring, array), c) end function utilities.inherit(orig, spec) local new = std.tree.clone(orig) if spec then for k,v in pairs(spec) do new[k] = v end end if new.init then new:init() end return new end function utilities.map(func, array) local new_array = {} local last = #array for i = 1, last do new_array[i] = func(array[i]) end return new_array end function utilities.splice(array, start, stop, replacement) local ptr = start local room = stop - start + 1 local last = replacement and #replacement or 0 for i = 1, last do if room > 0 then room = room - 1 array[ptr] = replacement[i] else table.insert(array, ptr, replacement[i]) end ptr = ptr + 1 end for i = 1, room do table.remove(array, ptr) end return array end function utilities.sum(array) local t = 0 local last = #array for i = 1, last do t = t + array[i] end return t end function utilities.codepoint(uchar) local seq = 0 local val = -1 for i = 1, #uchar do local c = string.byte(uchar, i) if seq == 0 then if val > -1 then return val end seq = c < 0x80 and 1 or c < 0xE0 and 2 or c < 0xF0 and 3 or c < 0xF8 and 4 or --c < 0xFC and 5 or c < 0xFE and 6 or error("invalid UTF-8 character sequence") val = bit32.band(c, 2^(8-seq) - 1) else val = bit32.bor(bit32.lshift(val, 6), bit32.band(c, 0x3F)) end seq = seq - 1 end return val end return utilities
local function eval(expr) local value = string.format('${%s}', expr) value = conky_parse(value) value = tonumber(value) return value; end return { eval = eval }
return { plugins = function(use) use("sheerun/vim-polyglot") use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) use("nvim-treesitter/nvim-treesitter-textobjects") end, setup = function() require("nvim-treesitter.configs").setup({ textobjects = { select = { enable = true, lookahead = true, keymaps = { ["af"] = "@function.outer", ["if"] = "@function.inner", ["ac"] = "@class.outer", ["ic"] = "@class.inner", ["ia"] = "@parameter.inner", ["aa"] = "@parameter.outer", -- ["i"] = "@block.inner", -- ["a"] = "@block.outer", -- ["im"] = "@call.inner", -- ["am"] = "@call.outer", -- @comment.outer -- ["iC"] = '@conditional.inner', -- ["aC"] = '@conditional.outer', -- @frame.inner -- @frame.outer -- @loop.inner -- @loop.outer -- @scopename.inner -- @statement.outer }, }, move = { enable = true, set_jumps = true, -- whether to set jumps in the jumplist goto_next_start = { [")m"] = "@function.outer", [")c"] = "@class.outer", }, goto_next_end = { [")M"] = "@function.outer", [")C"] = "@class.outer", }, goto_previous_start = { ["(m"] = "@function.outer", ["(c"] = "@class.outer", }, goto_previous_end = { ["(M"] = "@function.outer", ["(C"] = "@class.outer", }, }, }, highlight = { enable = true, additional_vim_regex_highlighting = true, disable = { "php", "yaml" }, -- TODO: test later }, indent = { enable = true, disable = { "php" }, -- TODO: test later }, autopairs = { enable = true, }, }) vim.cmd( [[ autocmd ColorScheme * highlight TSError cterm=undercurl ctermfg=1 gui=undercurl guifg=NONE guisp=#BF616A ]] ) vim.opt.foldmethod = "expr" vim.opt.foldexpr = "nvim_treesitter#foldexpr()" vim.opt.foldlevel = 99 end, }
--[[ #part of the 3DreamEngine by Luke100000 --]] local lib = _3DreamEngine function lib:renderSky(transformProj) love.graphics.push("all") if self.sky_cube then love.graphics.setShader(self.shaders.sky) self.shaders.sky:send("transformProj", transformProj) self.shaders.sky:send("sky", self.sky_cube) love.graphics.draw(self.object_cube.objects.Cube.mesh) elseif self.sky_hdri then --given hdri sphere love.graphics.setShader(self.shaders.sky_hdri) self.shaders.sky_hdri:send("exposure", self.sky_hdri_exposure) self.shaders.sky_hdri:send("transformProj", transformProj) self.object_sky.objects.Sphere.mesh:setTexture(self.sky_hdri) love.graphics.draw(self.object_sky.objects.Sphere.mesh) else --simple wilkie hosek sky love.graphics.setShader(self.shaders.sky_WilkieHosek) self.shaders.sky_WilkieHosek:send("transformProj", transformProj) self.shaders.sky_WilkieHosek:send("time", self.sky_time) love.graphics.setColor(self.sky_color:unpack()) self.object_sky.objects.Sphere.mesh:setTexture(self.textures:get("sky")) love.graphics.draw(self.object_sky.objects.Sphere.mesh) --stars if self.stars_enabled then local stars = -math.sin(self.sky_time * math.pi * 2) if stars > 0 then local starTex = self:getTexture(self.textures.stars_hdri) if starTex then love.graphics.setBlendMode("add", "premultiplied") love.graphics.setShader(self.shaders.sky_hdri) self.shaders.sky_hdri:send("exposure", stars) self.shaders.sky_hdri:send("transformProj", transformProj) self.object_sky.objects.Sphere.mesh:setTexture(starTex) love.graphics.draw(self.object_sky.objects.Sphere.mesh) end end end --moon and sun if self.sunMoon_enabled then --moon for sunMoon = 1, 2 do local x, y, z = (-self.sun):normalize():unpack() local l = math.sqrt(x^2+z^2) local a2 = self.sky_time * math.pi * 2.0 + (sunMoon-1) * math.pi local c2 = math.cos(a2) local s2 = math.sin(a2) local a1 = self.sun_offset local c1 = math.cos(a1) local s1 = math.sin(a1) local distance = sunMoon == 1 and 4.0 or (2.0 + math.sin(self.sky_time * math.pi * 2.0)) local transform = mat4:getIdentity():translate(0, 0, distance):rotateX(a2):rotateZ(a1) if sunMoon == 1 then local moon = self:getTexture(self.textures.moon) local moon_normal = self:getTexture(self.textures.moon_normal) if moon and moon_normal then love.graphics.setColor(1.0, 1.0, 1.0) love.graphics.setBlendMode("alpha") love.graphics.setShader(self.shaders.billboard_moon) self.shaders.billboard_moon:send("transform", transform) self.shaders.billboard_moon:send("transformProj", transformProj) self.shaders.billboard_moon:send("normalTex", moon_normal) self.shaders.billboard_moon:send("sun", {math.cos(self.sky_day / 30 * math.pi * 2), math.sin(self.sky_day / 30 * math.pi * 2), 0}) self.object_plane.objects.Plane.mesh:setTexture(moon) end else local sun = self:getTexture(self.textures.sun) if sun then love.graphics.setColor(self.sun_color) love.graphics.setBlendMode("add") love.graphics.setShader(self.shaders.billboard_sun) self.shaders.billboard_sun:send("transform", transform) self.shaders.billboard_sun:send("transformProj", transformProj) self.object_plane.objects.Plane.mesh:setTexture(sun) end end love.graphics.draw(self.object_plane.objects.Plane.mesh) end end --clouds if self.clouds_enabled then love.graphics.setBlendMode("alpha") love.graphics.setShader(self.shaders.clouds) self.shaders.clouds:send("sunColor", {(self.sun_color * 3.0):unpack()}) self.shaders.clouds:send("ambientColor", {(self.sun_color * 2.0):unpack()}) self.shaders.clouds:send("sunVec", {self.sun:normalize():unpack()}) self.shaders.clouds:send("scale", self.clouds_scale) self.shaders.clouds:send("time", {love.timer.getTime() * 0.001, 0.0}) self.shaders.clouds:send("threshold", self.clouds_threshold) self.shaders.clouds:send("thresholdInverted", 1.0 / (1.0 - math.min(0.99, self.clouds_threshold))) self.shaders.clouds:send("thresholdPackets", self.clouds_thresholdPackets) self.shaders.clouds:send("thresholdInvertedPackets", 1.0 / (1.0 - math.min(0.99, self.clouds_thresholdPackets))) self.shaders.clouds:send("packets", self.clouds_packets) self.shaders.clouds:send("weight", self.clouds_weight) self.shaders.clouds:send("sharpness", self.clouds_sharpness) self.shaders.clouds:send("detail", self.clouds_detail) self.shaders.clouds:send("thickness", self.clouds_thickness) self.object_cube.objects.Cube.mesh:setTexture(self.textures.clouds_rough) self.textures.clouds_rough:setWrap("repeat") self.shaders.clouds:send("tex_packets", self.textures.clouds_packets) self.textures.clouds_packets:setWrap("repeat") self.shaders.clouds:send("transformProj", transformProj) love.graphics.draw(self.object_cube.objects.Cube.mesh) end end love.graphics.pop() end
--Start of Global Scope---------------------------------------------------------- --End of Global Scope----------------------------------------------------------- --Start of Function and Event Scope--------------------------------------------- -- This is the function which then can be used from a control in the user interface local function printOnClick() print( 'This will be printed to the console when the button on the page is clicked' ) end -- Serving the function 'printOnClick' from this script. -- Function must also be served in the App Properties Script.serveFunction('ServeFunctionsPages.printOnClick', printOnClick) --End of Function and Event Scope------------------------------------------------
if(not _start)then local srv, cr = net.createServer(net.TCP,10),{} srv:listen(80,function(conn) local cn conn:on("receive", function(conn, payload) local req = dofile("web_request.lua")(payload) if req then cn = req.file cr[cn] = nil cr[cn] = coroutine.create(dofile("web_file.lua")) coroutine.resume(cr[cn], conn, req) end print(node.heap()) end) conn:on("sent",function(conn) if cr[cn]then local crS=coroutine.status(cr[cn]) if crS=="suspended"then local status=coroutine.resume(cr[cn]) if not status then conn:close() cr[cn]=nil collectgarbage() end elseif crS=="dead" then conn:close() cr[cn]=nil collectgarbage() end end end) end) end _start=true
local Music = {} local _handlers = setmetatable({}, {__mode="v"}) function Music:init() self.volume = 1 self.pitch = 1 self.target_volume = 0 self.fade_speed = 0 self.fade_callback = nil self.current = nil self.source = nil end function Music:fade(to, speed, callback) self.target_volume = to or 0 self.fade_speed = speed or 0.1 self.fade_callback = callback end function Music:getVolume() return self.volume * MUSIC_VOLUME * (self.current and MUSIC_VOLUMES[self.current] or 1) end function Music:getPitch() return self.pitch * (self.current and MUSIC_PITCHES[self.current] or 1) end function Music:play(music, volume, pitch) if music then local path = Assets.getMusicPath(music) if path then if volume then self.volume = volume end if self.current ~= music or not self.source or not self.source:isPlaying() then if self.source then self.source:stop() end self.current = music self.pitch = pitch or 1 self.source = love.audio.newSource(path, "stream") self.source:setVolume(self:getVolume()) self.source:setPitch(self:getPitch()) self.source:setLooping(true) self.source:play() else if volume then self.source:setVolume(self:getVolume()) end if pitch then self.pitch = pitch self.source:setPitch(self:getPitch()) end end end elseif self.source then if volume then self.volume = volume self.source:setVolume(self:getVolume()) end if pitch then self.pitch = pitch self.source:setPitch(self:getPitch()) end self.source:play() end end function Music:stop() if self.source then self.source:stop() end end function Music:pause() if self.source then self.source:pause() end end function Music:resume() if self.source then self.source:play() end end function Music:isPlaying() return self.source and self.source:isPlaying() or false end local function update(dt) for _,handler in ipairs(_handlers) do if handler.fade_speed ~= 0 and handler.volume ~= handler.target_volume then handler.volume = Utils.approach(handler.volume, handler.target_volume, handler.fade_speed * DTMULT) if handler.volume == handler.target_volume then handler.fade_speed = 0 if handler.fade_callback then handler.fade_callback() end end end if handler.source then local volume = handler:getVolume() if handler.source:getVolume() ~= volume then handler.source:setVolume(volume) end local pitch = handler:getPitch() if handler.source:getPitch() ~= pitch then handler.source:setPitch(pitch) end end end end local function new(music, volume, pitch) local handler = setmetatable({}, {__index = Music}) table.insert(_handlers, handler) handler:init() if music then handler.current = music handler.volume = volume or 1 handler.pitch = pitch or 1 handler:play(music, volume, pitch) end return handler end local default = new() local module = { new = new, update = update } for k in pairs(Music) do module[k] = function(...) return default[k](default, ...) end end return setmetatable(module, {__call = function(t, ...) return new(...) end})
AddCSLuaFile() --[[ This is the configuration table for our module loader. Feel free to change the load order of *your* modules. --]] loaderConfig = { splash = -- Super duper cool splash screen for cool kids like us. { "", " %@@@@@@@@@@@@@@@", " ///@@@ @@@@@@@", " /////@@@ @@@", " //////// @@@@@", " ////// ./ @@@@", " //// //// @@@", " ///////////////@", "", "", " - Advisor", " - An open source and expandable administration framework for your Garry's Mod servers and addons.", " - https://github.com/Erlite/gmod-advisor/" }, --[[ Load order for modules. DO NOT MODIFY THE ORDER OF THE MODULES. If you modify the order, we'll just assume you know what you're doing and you're void of our help, really. Same goes for modifying our module_name.lua files. --]] loadOrder = { "utils", -- Miscellaneous utilities. "logging", -- Advisor's logging module which is just about used by everything. "localization", -- Localization module used to translate "replicate", -- A high performance networking library for tables. "metatables", -- Advisor's metatables. "sql", -- Advisor's data persistence module. "framework", -- Advisor's core module. }, -- Use this to disable modules if you wanna. ignoredModules = { -- "someModuleName", } }
prototype_name = gs.prototype(prototype_parent, function() local prototype_variable = value local function prototype_method() return self.instance_variable end -- comment instance_variable = value function instance_method(self, arg1, arg2, ...) local a = 2 print(arg1 + arg2 + a) end function constructor(self, arg1) self.a = arg1 end end) local object = gs.new(prototype_name, arg1) if a == 2 then return "generics" elseif a >= 32 then return a + 20 else print("hello world!") end while condition do print("looping...") end for i = 1, 2 do print(var) end for key, value in iterator do print(array[key]) end function testing(...) return 99 end _GS = "GOSCRIPT"
return PlaceObj("ModDef", { "dependencies", { PlaceObj("ModDependency", { "id", "ChoGGi_Library", "title", "ChoGGi's Library", "version_major", 10, "version_minor", 3, }), }, "title", "Empty Mech Depot", "id", "ChoGGi_EmptyMechDepot", "pops_any_uuid", "c3b2ae57-aaf6-4dd1-a5ad-2bd33afd0505", "steam_id", "1411108310", "lua_revision", 1007000, -- Picard "version", 10, "version_major", 1, "version_minor", 0, "image", "Preview.jpg", "author", "ChoGGi", "code", { "Code/Script.lua", }, "has_options", true, "description", [[ Adds a button to mech depots to empty them out into a small depot in front of them. This also allows you to salvage mech depots with resources in them. You need to enable the mod option beforehand: This will delete the resources!. Includes mod option to stop it from deleting mech depot afterwards. ]], })
--[[ * Copyright (c) MZ3 Project Team All rights reserved. * Code licensed under the BSD License: * http://www.mz3.jp/license.txt ]] -------------------------------------------------- -- MZ3 Script : GoogleReader -- -- $Id: gmail.lua 1453 2009-12-13 13:06:06Z takke $ -------------------------------------------------- mz3.logger_debug('google_reader.lua start'); module("greader", package.seeall) -------------------------------------------------- -- サービスの登録(タブ初期化、ログイン設定用) -------------------------------------------------- mz3.regist_service('GoogleReader', true); -- ログイン設定画面のプルダウン名、表示名の設定 -- 'Google' を利用する。 -- Gmail プラグインと同様だが、Gmail プラグインがない場合を考慮し、 -- ここで設定する。 mz3_account_provider.set_param('Google', 'id_name', 'メールアドレス'); mz3_account_provider.set_param('Google', 'password_name', 'パスワード'); ---------------------------------------- -- アクセス種別の登録 ---------------------------------------- -- タグリスト type = MZ3AccessTypeInfo.create(); type:set_info_type('category'); -- カテゴリ type:set_service_type('GoogleReader'); -- サービス種別 type:set_serialize_key('GOOGLE_READER_TAG_LIST'); -- シリアライズキー type:set_short_title('GoogleReader タグリスト'); -- 簡易タイトル type:set_request_method('GET'); -- リクエストメソッド type:set_cache_file_pattern('google_reader\\{urlafter:/reader}.html'); -- キャッシュファイル type:set_request_encoding('utf8'); -- エンコーディング type:set_default_url('http://www.google.co.jp/reader/api/0/tag/list?output=xml&client=MZ3'); type:set_body_header(1, 'title', 'タイトル'); type:set_body_header(2, 'date', ''); type:set_body_header(3, 'date', ''); type:set_body_integrated_line_pattern(1, '%1'); type:set_body_integrated_line_pattern(2, ''); -- ログイン用 type = MZ3AccessTypeInfo.create(); type:set_info_type('category'); -- カテゴリ type:set_service_type('GoogleReader'); -- サービス種別 type:set_serialize_key('GOOGLE_READER_LOGIN'); -- シリアライズキー type:set_short_title('GoogleReader ログイン'); -- 簡易タイトル type:set_request_method('POST'); -- リクエストメソッド type:set_cache_file_pattern('google_reader\\login.html'); -- キャッシュファイル type:set_request_encoding('utf8'); -- エンコーディング -- フィード一覧 type = MZ3AccessTypeInfo.create(); type:set_info_type('category'); -- カテゴリ type:set_service_type('GoogleReader'); -- サービス種別 type:set_serialize_key('GOOGLE_READER_ATOM_LIST'); -- シリアライズキー type:set_short_title('GoogleReader フィード'); -- 簡易タイトル type:set_request_method('GET'); -- リクエストメソッド type:set_cache_file_pattern('google_reader\\{urlafter:/reader}.html'); -- キャッシュファイル type:set_request_encoding('utf8'); -- エンコーディング type:set_body_header(1, 'name', 'フィード'); type:set_body_header(2, 'title', 'タイトル'); type:set_body_header(3, 'date', '日付'); type:set_body_integrated_line_pattern(1, '%1 %3'); type:set_body_integrated_line_pattern(2, '%2'); -- フィード type = MZ3AccessTypeInfo.create(); type:set_info_type('other'); -- カテゴリ type:set_service_type('GoogleReader'); -- サービス種別 type:set_serialize_key('GOOGLE_READER_ATOM_ITEM'); -- シリアライズキー type:set_short_title('GoogleReader フィード'); -- 簡易タイトル type:set_request_method('GET'); -- リクエストメソッド type:set_request_encoding('utf8'); -- エンコーディング -- トークン type = MZ3AccessTypeInfo.create(); type:set_info_type('other'); -- カテゴリ type:set_service_type('GoogleReader'); -- サービス種別 type:set_serialize_key('GOOGLE_READER_TOKEN'); -- シリアライズキー type:set_short_title('GoogleReader Token'); -- 簡易タイトル type:set_request_method('GET'); -- リクエストメソッド type:set_request_encoding('utf8'); -- エンコーディング -- スターを付ける type = MZ3AccessTypeInfo:create(); type:set_info_type('post'); -- カテゴリ type:set_service_type('GoogleReader'); -- サービス種別 type:set_serialize_key('GOOGLE_READER_ADD_STAR'); -- シリアライズキー type:set_short_title('GoogleReader スター'); -- 簡易タイトル type:set_request_method('POST'); -- リクエストメソッド type:set_request_encoding('utf8'); -- エンコーディング -- 既読 type = MZ3AccessTypeInfo:create(); type:set_info_type('post'); -- カテゴリ type:set_service_type('GoogleReader'); -- サービス種別 type:set_serialize_key('GOOGLE_READER_SET_READ'); -- シリアライズキー type:set_short_title('GoogleReader 既読'); -- 簡易タイトル type:set_request_method('POST'); -- リクエストメソッド type:set_request_encoding('utf8'); -- エンコーディング ---------------------------------------- -- メニュー項目登録(静的に用意すること) ---------------------------------------- menu_items = {} -- メイン画面下ペイン用 menu_items.read = mz3_menu.regist_menu("greader.on_read_menu_item"); menu_items.open_by_browser = mz3_menu.regist_menu("greader.on_open_by_browser_menu_item"); menu_items.add_star = mz3_menu.regist_menu("greader.on_add_star_menu_item"); menu_items.show_main_view = mz3_menu.regist_menu("greader.on_show_main_view"); menu_items.set_read_to_feed = mz3_menu.regist_menu("greader.on_set_read_to_feed"); ---------------------------------------- -- メニューへの登録 ---------------------------------------- --- デフォルトのグループリスト生成イベントハンドラ -- -- @param serialize_key シリアライズキー(nil) -- @param event_name 'creating_default_group' -- @param group MZ3GroupData -- function on_creating_default_group(serialize_key, event_name, group) -- サポートするサービス種別の取得(スペース区切り) services = mz3_group_data.get_services(group); if services:find(' GoogleReader', 1, true) ~= nil then -- 受信トレイ local tab = MZ3GroupItem:create("GoogleReader"); tab:append_category("フォルダ一覧", "GOOGLE_READER_TAG_LIST"); mz3_group_data.append_tab(group, tab.item); tab:delete(); end end mz3.add_event_listener("creating_default_group", "greader.on_creating_default_group"); ---------------------------------------- -- パーサ ---------------------------------------- -------------------------------------------------- -- 【タグリスト】 -- -- フォルダ一覧 -- http://www.google.co.jp/reader/api/0/tag/list?output=xml&client=MZ3 -- -- 引数: -- parent: 上ペインの選択オブジェクト(MZ3Data*) -- body: 下ペインのオブジェクト群(MZ3DataList*) -- html: HTMLデータ(CHtmlArray*) -------------------------------------------------- function google_reader_tag_list_parser(parent, body, html) mz3.logger_debug("google_reader_tag_list_parser start"); -- wrapperクラス化 parent = MZ3Data:create(parent); body = MZ3DataList:create(body); html = MZ3HTMLArray:create(html); -- 全消去 body:clear(); local t1 = mz3.get_tick_count(); -- サービス利用判定 is_use_check = false; error_word = "401 Client Error"; -- ログイン判定 is_logged_in = false; local line_count = html:get_count(); for i=0, line_count-1 do line = html:get_at(i); -- サービス利用判定 if line_has_strings(line, error_word) then -- サービスを登録していないと無限ループする is_logged_in = true; break; end -- mz3.logger_debug(line); -- <object><list name="tags"><object> -- 上記があればログイン済 if line_has_strings(line, '<object><list name="tags"><object>') then is_logged_in = true; break; end end if is_use_check then else if is_logged_in then -- mz3.alert('ログイン済'); -- 複数行に分かれているので1行に結合 line = html:get_all_text(); -- ログイン済みのHTMLのパース parse_tag_list(parent, body, line); else -- ログイン処理 mail_address = mz3_account_provider.get_value('Google', 'id'); mail_password = mz3_account_provider.get_value('Google', 'password'); if (mail_address == "" or mail_password == "") then mz3.alert("メールアドレスとパスワードをログイン設定画面で設定して下さい"); return; end -- URL 生成 url = "https://www.google.com/accounts/ClientLogin"; post = mz3_post_data.create(); mz3_post_data.append_post_body(post, "Email=" .. mz3.url_encode(mail_address, 'utf8') .. "&"); mz3_post_data.append_post_body(post, "Passwd=" .. mz3.url_encode(mail_password, 'utf8') .. "&"); mz3_post_data.append_post_body(post, "service=reader"); -- 通信開始 access_type = mz3.get_access_type_by_key("GOOGLE_READER_LOGIN"); referer = ''; user_agent = nil; mz3.open_url(mz3_main_view.get_wnd(), access_type, url, referer, "text", user_agent, post); end end local t2 = mz3.get_tick_count(); mz3.logger_debug("google_reader_tag_list_parser end; elapsed : " .. (t2-t1) .. "[msec]"); end mz3.set_parser("GOOGLE_READER_TAG_LIST", "greader.google_reader_tag_list_parser"); --- ログイン済みのタグリストの解析 -- -- @param parent 上ペインの選択オブジェクト(MZ3Data*) -- @param body 下ペインのオブジェクト群(MZ3DataList*) -- @param line HTML 全文を1行に結合した文字列 -- function parse_tag_list(parent, body, line) mz3.logger_debug("parse_tag_list start"); -- 最初のobjectを読み飛ばす local list_tag = line:match('<list.->(.-)</list>'); if list_tag == nil then mz3.alert('取得失敗(no list tag)'); return; end -- data 生成 data = MZ3Data:create(); for object_tag in list_tag:gmatch("<object>(.-)</object>") do -- mz3.logger_debug(object_tag); -- /object/list/object/string[name="id"] -- <string name="id">user/xxx/state/com.google/starred</string> local id = object_tag:match('<string name="id">(.-)</'); -- 末尾の / 以降をフォルダ名とする local head, name = id:match('^(.*/)([^/]*)$'); -- URL --http://www.google.co.jp/reader/atom/user/-/state/com.google/starred local url = 'http://www.google.co.jp/reader/atom/' .. head .. mz3.url_encode(name, 'utf8'); if name == 'starred' then name = 'スター付き'; end if name == 'broadcast' then name = '公開'; end -- set data:set_text("name", name); data:set_text("title", name); data:set_text("url", url); data:set_access_type(mz3.get_access_type_by_key('GOOGLE_READER_ATOM_LIST')); -- data 追加 body:add(data.data); end -- data 削除 data:delete(); mz3.logger_debug("parse_tag_list end"); end -------------------------------------------------- -- 【ログイン】 -- -- 引数: -- parent: 上ペインの選択オブジェクト(MZ3Data*) -- body: 下ペインのオブジェクト群(MZ3DataList*) -- html: HTMLデータ(CHtmlArray*) -------------------------------------------------- function google_reader_login_parser(parent, body, html) mz3.logger_debug("google_reader_login_parser start"); -- wrapperクラス化 parent = MZ3Data:create(parent); body = MZ3DataList:create(body); html = MZ3HTMLArray:create(html); -- 全消去 body:clear(); local t1 = mz3.get_tick_count(); local login_ok = false; local line_count = html:get_count(); for i=0, line_count-1 do line = html:get_at(i); -- mz3.logger_debug(line); -- SID=... if line_has_strings(line, "SID=") then login_ok = true; end end -- mz3.alert('url : ' .. url); if login_ok == false then mz3.alert('ログインに失敗しました。 \nメールアドレスとパスワードを確認してください。'); return; end -- 通信開始 access_type = mz3.get_access_type_by_key("GOOGLE_READER_TAG_LIST"); url = nil; referer = ''; user_agent = nil; post = nil; mz3.open_url(mz3_main_view.get_wnd(), access_type, url, referer, "text", user_agent, post); local t2 = mz3.get_tick_count(); mz3.logger_debug("google_reader_login_parser end; elapsed : " .. (t2-t1) .. "[msec]"); end mz3.set_parser("GOOGLE_READER_LOGIN", "greader.google_reader_login_parser"); -------------------------------------------------- -- 【フィード】 -- -- 引数: -- parent: 上ペインの選択オブジェクト(MZ3Data*) -- body: 下ペインのオブジェクト群(MZ3DataList*) -- html: HTMLデータ(CHtmlArray*) -------------------------------------------------- reset_body_list_pos = 0; -- 取得後のボディリストの選択位置 function google_reader_atom_list_parser(parent, body, html) mz3.logger_debug("google_reader_atom_list_parser start"); -- wrapperクラス化 parent = MZ3Data:create(parent); body = MZ3DataList:create(body); html = MZ3HTMLArray:create(html); -- リクエストのURLが「次へ」であればクリアしない local last_url = mz3.get_last_request_url(); local insert_at = 0; local next_link_pos = 0; reset_body_list_pos = 0; if line_has_strings(last_url, 'c=') then -- 「次へ」のリクエストなので既存の「次へ」を削除する local n = body:get_count(); for i=0, n-1 do d = MZ3Data:create(body:get_data(i)); if d:get_serialize_key() == 'GOOGLE_READER_ATOM_LIST' then insert_at = i; next_link_pos = i; reset_body_list_pos = i; break; end end else -- 全消去 body:clear(); end local t1 = mz3.get_tick_count(); -- 複数行に分かれているので1行に結合 local line = html:get_all_text(); -- data 生成 data = MZ3Data:create(); for entry_tag in line:gmatch("<entry.->(.-)</entry>") do -- mz3.logger_debug(entry_tag); data:clear(); -- id -- <id gr:original-id="http://rss.rssad.jp/rss/ad/xxx/xxx?type=2&ent=xxx">tag:google.com,2005:reader/item/xxx</id> local id = entry_tag:match('<id .->(.-)</'); local updated = entry_tag:match('<updated>(.-)</'); local title = entry_tag:match('<title.->(.-)</'); title = title:gsub('&amp;', '&'); title = mz3.decode_html_entity(title); local author = ''; local source = entry_tag:match('<source.->(.-)</source>'); if source ~= nil then author = source:match('<title.->(.-)</'); author = author:gsub('&amp;', '&'); author = mz3.decode_html_entity(author); -- alternate 抽出+メニュー追加 -- <link rel="alternate" href="http://journal.mycom.co.jp" type="text/html"/> link_url = source:match('<link .-href="(.-)"'); data:add_link_list(link_url, link_url); end -- URL : <link rel="alternate" href="..."> を対象とする。 -- いわゆる代替URLなのでWebページとなる。 local url = entry_tag:match('<link rel="alternate" href="(.-)"'); if url ~= nil then url = url:gsub('&amp;', '&'); -- TODO decode_html_entity 必要? end local summary = entry_tag:match('<summary.->(.-)</summary>'); if summary ~= nil then summary = summary:gsub('&amp;', '&'); summary = mz3.decode_html_entity(summary); else summary = ''; end -- URL を抽出し、リンクにする if line_has_strings(summary, 'ttp') then for url in summary:gmatch("h?ttps?://[-_.!~*'()a-zA-Z0-9;/?:@&=+$,%#]+") do data:add_link_list(url, url); -- mz3.logger_debug('抽出URL: ' .. url); end end -- set data:set_text("id", id); -- 通常のアイテムと違い、ID が文字列である点に注意 data:set_text("name", author); data:set_text("title", title); data:parse_date_line(updated); data:set_text("url", url); data:add_text_array('body', summary); data:set_access_type(mz3.get_access_type_by_key('GOOGLE_READER_ATOM_ITEM')); -- data 追加 body:insert(insert_at, data.data); insert_at = insert_at + 1; end -- data 削除 data:delete(); -- <gr:continuation>CPPz-oaxoZ8C</gr:continuation> continuation = line:match('<gr:continuation>(.-)</gr:continuation>'); if continuation ~= nil then -- continuation 追加 -- URL はカテゴリから取得&連結 local category = MZ3Data:create(mz3_main_view.get_selected_category_item()); local category_url = category:get_text('url'); local url = category_url; if url:find("?", 1, false)~=nil then -- ? を含む url = url .. '&c=' .. continuation; else -- ? を含まない url = url .. '?c=' .. continuation; end -- 既にあれば書き換える if next_link_pos == 0 then -- data 生成 data = MZ3Data:create(); data:set_text("name", '次のページ'); data:set_text("title", ''); data:set_text("url", url); data:parse_date_line(''); data:set_access_type(mz3.get_access_type_by_key('GOOGLE_READER_ATOM_LIST')); body:add(data.data); -- data 削除 data:delete(); else d = MZ3Data:create(body:get_data(next_link_pos)); d:set_text('url', url); end end local t2 = mz3.get_tick_count(); mz3.logger_debug("google_reader_atom_list_parser end; elapsed : " .. (t2-t1) .. "[msec]"); end mz3.set_parser("GOOGLE_READER_ATOM_LIST", "greader.google_reader_atom_list_parser"); ---------------------------------------- -- イベントハンドラ ---------------------------------------- function on_after_get_end(event_name, serialize_key, body) if serialize_key == 'GOOGLE_READER_ATOM_LIST' then if reset_body_list_pos ~= 0 then -- カーソル位置の復帰 mz3_main_view.select_body_item(reset_body_list_pos); end return true; end return false; end mz3.add_event_listener('after_get_end', 'greader.on_after_get_end'); --- ボディリストのアイコンのインデックス取得 -- -- @param event_name 'get_body_list_default_icon_index' -- @param serialize_key シリアライズキー(nil) -- @param body body data -- -- @return (1) [bool] 成功時は true, 続行時は false -- @return (2) [int] アイコンインデックス -- function on_get_body_list_default_icon_index(event_name, serialize_key, body) if serialize_key == "GOOGLE_READER_ATOM_LIST" then return true, 8; end if serialize_key == "GOOGLE_READER_ATOM_ITEM" then return true, 8; end return false; end mz3.add_event_listener("get_body_list_default_icon_index", "greader.on_get_body_list_default_icon_index"); --- ViewStyle 変更 -- -- @param event_name 'get_view_style' -- @param serialize_key カテゴリのシリアライズキー -- -- @return (1) [bool] 成功時は true, 続行時は false -- @return (2) [int] VIEW_STYLE_* -- function on_get_view_style(event_name, serialize_key) service_type = mz3.get_service_type(serialize_key); if service_type=='GoogleReader' then return true, VIEW_STYLE_DEFAULT; end return false; end mz3.add_event_listener("get_view_style", "greader.on_get_view_style"); --- メイン画面に戻る function on_show_main_view(serialize_key, event_name, data) mz3.logger_debug('on_show_main_view : (' .. serialize_key .. ', ' .. event_name .. ')'); mz3.change_view('main_view'); return true; end --- 全文表示メニューまたはダブルクリックイベント function on_read_menu_item(serialize_key, event_name, data) -- メニュー直接の場合はシリアライズキーがないため data から取得する data = MZ3Data:create(data); serialize_key = data:get_serialize_key(); mz3.logger_debug('on_read_menu_item : (' .. serialize_key .. ', ' .. event_name .. ')'); if serialize_key == 'GOOGLE_READER_ATOM_LIST' then -- フィードリストのアイテム(フォルダ名) -- 本来はカテゴリ項目 item = ''; item = item .. data:get_text('name') .. "\r\n"; item = item .. "----\r\n"; item = item .. data:get_text('url') .. "\r\n"; mz3.alert(item, data:get_text('name')); end if serialize_key == 'GOOGLE_READER_ATOM_ITEM' then -- フィード詳細 -- 詳細画面で表示 data = mz3_main_view.get_selected_body_item(); mz3.show_detail_view(data); return true; --[[ item = ''; item = item .. data:get_text('name') .. " - " .. data:get_date() .. "\r\n"; item = item .. data:get_text('title') .. "\r\n"; item = item .. "----\r\n"; summary = data:get_text_array_joined_text('body'); summary = summary:gsub('<.->', ''); item = item .. summary .. "\r\n"; item = item .. "----\r\n"; item = item .. data:get_text('url') .. "\r\n"; mz3.alert(item, data:get_text('name')); ]] end return true; end --- フォルダを開くメニュー用ハンドラ function on_show_folder(serialize_key, event_name, data) -- ビューをメイン画面に移す(詳細画面のメニューに対応するため) mz3.change_view('main_view'); body = mz3_main_view.get_selected_body_item(); body = MZ3Data:create(body); name = body:get_text('name'); url = body:get_text('url'); key = "GOOGLE_READER_ATOM_LIST"; if line_has_strings(url, 'c=') == false then -- カテゴリ追加 title = "+" .. name; mz3_main_view.append_category(title, url, key); end -- 追加したカテゴリの取得開始 access_type = mz3.get_access_type_by_key(key); referer = ''; user_agent = nil; post = nil; mz3.open_url(mz3_main_view.get_wnd(), access_type, url, referer, "text", user_agent, post); end --- token 取得 function get_google_reader_token() url = 'http://www.google.com/reader/api/0/token'; referer = ''; user_agent = nil; is_blocking = true; access_type = mz3.get_access_type_by_key("GOOGLE_READER_TOKEN"); status, token = mz3.open_url(mz3_main_view.get_wnd(), access_type, url, referer, "text", user_agent, nil, is_blocking); -- local s = 'status : ' .. status .. '\r\n' .. 'token : [' .. token .. ']'; -- mz3.alert(s); if status ~= 200 then mz3.alert('トークンの取得に失敗しました。'); return nil; end return token; end --- スターを付ける function on_add_star_menu_item(serialize_key, event_name, data) mz3.logger_debug('on_add_star_menu_item: (' .. serialize_key .. ', ' .. event_name .. ')'); -- token 取得 token = get_google_reader_token(); if token == nil then return true; end -- POST data = MZ3Data:create(data); -- POSTパラメータ生成 post = MZ3PostData:create(); -- iパラメータはデータから取得する post:append_post_body('i=' .. mz3.url_encode(data:get_text('id'), 'utf8')); post:append_post_body('&a=' .. mz3.url_encode('user/-/state/com.google/starred', 'utf8')); post:append_post_body('&ac=edit'); post:append_post_body('&T=' .. token); -- 通信開始 url = 'http://www.google.co.jp/reader/api/0/edit-tag?client=MZ3'; access_type = mz3.get_access_type_by_key("GOOGLE_READER_ADD_STAR"); referer = ''; user_agent = nil; mz3.open_url(mz3_main_view.get_wnd(), access_type, url, referer, "text", user_agent, post.post_data); return true; end --- 記事の既読 function on_set_read_to_feed(serialize_key, event_name, data) mz3.logger_debug('on_set_read_to_feed: (' .. serialize_key .. ', ' .. event_name .. ')'); -- token 取得 token = get_google_reader_token(); if token == nil then return true; end -- POST data = MZ3Data:create(data); -- POSTパラメータ生成 post = MZ3PostData:create(); -- iパラメータはデータから取得する post:append_post_body('i=' .. mz3.url_encode(data:get_text('id'), 'utf8')); post:append_post_body('&a=' .. mz3.url_encode('user/-/state/com.google/read', 'utf8')); post:append_post_body('&ac=edit'); post:append_post_body('&T=' .. token); -- 通信開始 url = 'http://www.google.co.jp/reader/api/0/edit-tag?client=MZ3'; access_type = mz3.get_access_type_by_key("GOOGLE_READER_SET_READ"); referer = ''; user_agent = nil; mz3.open_url(mz3_main_view.get_wnd(), access_type, url, referer, "text", user_agent, post.post_data); return true; end --- POST 完了イベント -- -- @param event_name 'post_end' -- @param serialize_key 完了項目のシリアライズキー -- @param http_status HTTP Status Code (200, 404, etc...) -- @param filename レスポンスファイル -- @param wnd wnd -- function on_post_end(event_name, serialize_key, http_status, filename) service_type = mz3.get_service_type(serialize_key); if service_type~="GoogleReader" then return false; end -- ステータスコードチェック if http_status~=200 then -- エラーアリなので中断するために true を返す local msg="失敗しました"; mz3.logger_error(msg); mz3_main_view.set_info_text(msg); return true; end -- リクエストの種別に応じてメッセージを表示 if serialize_key == "GOOGLE_READER_ADD_STAR" then mz3_main_view.set_info_text("スターつけた!"); end if serialize_key == "GOOGLE_READER_SET_READ" then mz3_main_view.set_info_text("既読にした!"); end return true; end mz3.add_event_listener("post_end", "greader.on_post_end"); --- ボディリストのダブルクリック(またはEnter)のイベントハンドラ function on_body_list_click(serialize_key, event_name, data) if serialize_key=="GOOGLE_READER_ATOM_LIST" then -- カテゴリ追加 on_show_folder(serialize_key, event_name, data); return true; end if serialize_key=="GOOGLE_READER_ATOM_ITEM" then -- 全文表示 return on_read_menu_item(serialize_key, event_name, data); end -- 標準の処理を続行 return false; end mz3.add_event_listener("dblclk_body_list", "greader.on_body_list_click"); mz3.add_event_listener("enter_body_list", "greader.on_body_list_click"); --- 「ブラウザで開く」メニュー用ハンドラ function on_open_by_browser_menu_item(serialize_key, event_name, data) body = MZ3Data:create(mz3_main_view.get_selected_body_item()); mz3.open_url_by_browser_with_confirm(body:get_text('url')); end --- ボディリストのポップアップメニュー表示 -- -- @param event_name 'popup_body_menu' -- @param serialize_key ボディアイテムのシリアライズキー -- @param body body -- @param wnd wnd -- function on_popup_body_menu(event_name, serialize_key, body, wnd) -- インスタンス化 body = MZ3Data:create(body); serialize_key = body:get_serialize_key(); mz3.logger_debug('greader.on_popup_body_menu : (' .. serialize_key .. ', ' .. event_name .. ')'); if serialize_key=="GOOGLE_READER_ATOM_LIST" then -- メニュー生成 menu = MZ3Menu:create_popup_menu(); menu:append_menu("string", "詳細...", menu_items.read); -- ポップアップ menu:popup(wnd); -- メニューリソース削除 menu:delete(); return true; end if serialize_key=="GOOGLE_READER_ATOM_ITEM" then -- メニュー生成 menu = MZ3Menu:create_popup_menu(); if event_name == 'popup_body_menu' then menu:append_menu("string", "詳細", menu_items.read); else -- 詳細画面の場合 menu:append_menu("string", "メイン画面に戻る", menu_items.show_main_view); end menu:append_menu("string", "ブラウザで開く...", menu_items.open_by_browser); menu:append_menu("separator"); menu:append_menu("string", "スターを付ける", menu_items.add_star); -- menu:append_menu("string", "この記事を既読にする", menu_items.set_read_to_feed); -- リンク追加 n = body:get_link_list_size(); if n > 0 then menu:append_menu("separator"); for i=0, n-1 do id = ID_REPORT_URL_BASE+(i+1); menu:append_menu("string", "link : " .. body:get_link_list_text(i), id); end end -- ポップアップ menu:popup(wnd); -- メニューリソース削除 menu:delete(); return true; end return false; end mz3.add_event_listener("popup_body_menu", "greader.on_popup_body_menu"); --- 詳細画面の描画 function on_draw_detail_view(event_name, serialize_key, data, dc, cx, cy) service_type = mz3.get_service_type(serialize_key); if service_type ~= 'GoogleReader' then return false; end -- オブジェクト化 data = MZ3Data:create(data); g = MZ3Graphics:create(dc); -- 画面端のマージン x_margin = 5; y_margin = 5; ---------------------------------------------- -- ページ番号 ---------------------------------------------- g:set_font_size(-1); -- 小サイズフォント line_height = g:get_line_height(); x = x_margin; y = y_margin; -- 項目番号(ページ番号風で) local list = MZ3DataList:create(mz3_main_view.get_body_item_list()); local n = list:get_count(); idx = mz3_main_view.get_selected_body_item_idx(); text = (idx+1) .. '/' .. n; g:set_color("text", "MainBodyListDefaultText"); x = x_margin; y = y_margin; w = cx - x - x_margin; h = line_height; format = DT_NOPREFIX + DT_RIGHT; g:draw_text(text, x, y, w, h, format); ---------------------------------------------- -- 丈夫の文字列の描画 ---------------------------------------------- g:set_font_size(1); -- 大サイズフォント line_height = g:get_line_height(); -- 名前 x = x +x_margin; y = y_margin; w = cx - x - x_margin; h = line_height * 3.2; format = DT_WORDBREAK + DT_NOPREFIX + DT_EDITCONTROL + DT_LEFT + DT_END_ELLIPSIS; color_text_org = g:set_color("text", "MainBodyListNonreadText"); color_bk_org = g:set_color("bk", "MainStatusBG"); text = data:get_text('name'); g:draw_text(text, x, y, w, h, format); -- タイトル g:set_color("text", "MainBodyListDefaultText"); g:set_font_size(1); -- 大サイズフォント y = y + line_height *1.2; text = data:get_text('title') .. "\r\n"; g:draw_text(text, x, y, w, h, format); -- 日付 g:set_color("text", "MainBodyListDefaultText"); text = data:get_date(); y = y + h; format = DT_RIGHT; g:set_font_size(0); -- 中サイズフォント line_height = g:get_line_height(); g:draw_text(text, x, y, w, h, format); ---------------------------------------------- -- 本文 ---------------------------------------------- -- 開始Y座標はクライアント名の下側とアイコンの下側の下の方とする local y_source_bottom = y + line_height + y_margin; -- 本文 g:set_font_size(1); -- 大サイズフォント line_height = g:get_line_height(); g:set_color("text", "MainBodyListNonreadText"); text = data:get_text_array_joined_text('body'); -- 画像、タグ除去 text = text:gsub('<img .->', '[画像]'); text = text:gsub('<br.-/?>', '\r\n'); text = text:gsub("<.->", ""); y = y_source_bottom; -- 高さは画面の高さからN行引いた程度 -- h = cy * 2 / 3; h = cy - line_height * 8; x = x_margin; w = cx - x - x_margin; -- 本文用枠描画 g:draw_rect("border", x, y, w, h, "MainBodyListNonreadText"); border_margin = 5; x = x +border_margin; y = y +border_margin; w = w -border_margin*2; h = h -border_margin*2; format = DT_WORDBREAK + DT_NOPREFIX + DT_EDITCONTROL + DT_LEFT + DT_END_ELLIPSIS; g:draw_text(text, x, y, w, h, format); ---------------------------------------------- -- 前後項目の描画 ---------------------------------------------- local list = MZ3DataList:create(mz3_main_view.get_body_item_list()); local n = list:get_count(); local idx = mz3_main_view.get_selected_body_item_idx(); g:set_font_size(-1); -- 小サイズフォント line_height = g:get_line_height(); h = line_height; local y_lr_text = cy - line_height - y_margin; -- 前項目の描画 if idx > 0 then local f = MZ3Data:create(list:get_data(idx-1)); format = DT_NOPREFIX + DT_LEFT; x = x_margin + x_margin; w = cx / 2; g:draw_text('≪' .. f:get_text('name'), x, y_lr_text, w, h, format); end -- 次項目の描画 if idx < n-1 then local f = MZ3Data:create(list:get_data(idx+1)); format = DT_NOPREFIX + DT_RIGHT; x = cx /2; w = cx /2 - x_margin; g:draw_text(f:get_text('name') .. '≫', x, y_lr_text, w, h, format); end -- 色を戻す g:set_color("text", color_text_org); g:set_color("bk", color_bk_org); return true; end mz3.add_event_listener("draw_detail_view", "greader.on_draw_detail_view"); --- 詳細画面のキー押下イベント function on_keydown_detail_view(event_name, serialize_key, data, key) mz3.logger_debug('greader.on_keydown_detail_view : (' .. serialize_key .. ', ' .. event_name .. ', ' .. key .. ')'); service_type = mz3.get_service_type(serialize_key); if service_type~='GoogleReader' then return false; end if key == VK_DOWN or key == VK_UP then -- 下キー:次の発言 -- 上キー:前の発言 local list = MZ3DataList:create(mz3_main_view.get_body_item_list()); local n = list:get_count(); local idx = mz3_main_view.get_selected_body_item_idx(); if key == VK_DOWN then -- 次の項目を表示 if idx < n-1 then mz3_main_view.select_body_item(idx+1); else -- 先頭に戻る if n>0 then mz3_main_view.select_body_item(0); end end else -- 前の項目を表示 if idx >= 1 then mz3_main_view.select_body_item(idx-1); else -- 末尾に戻る mz3_main_view.select_body_item(n-1); end end data = mz3_main_view.get_selected_body_item(); mz3.show_detail_view(data); return true; end if key == VK_RIGHT or key == VK_LEFT then -- 左右キー return true; end if key == VK_RETURN or key == VK_ESCAPE or key == VK_BACK then -- 閉じる mz3.change_view('main_view'); return true; end if key == VK_F2 then -- ボディリストのメニューを表示 mz3.logger_debug('VK_F2'); greader.on_popup_body_menu(event_name, serialize_key, data, mz3_main_view.get_wnd()); return true; end return true; end mz3.add_event_listener("keydown_detail_view", "greader.on_keydown_detail_view"); --- 詳細画面のクリックイベント function on_click_detail_view(event_name, serialize_key, data, x, y, cx, cy) service_type = mz3.get_service_type(serialize_key); if service_type~='GoogleReader' then return false; end if y > cy/2 then -- 下側1/2であれば項目移動 if x < cx/2 then -- 左側:前の項目を表示 on_keydown_detail_view("keydown_detail_view", serialize_key, data, VK_UP); else -- 右側:次の項目を表示 on_keydown_detail_view("keydown_detail_view", serialize_key, data, VK_DOWN); end else -- 閉じる mz3.change_view('main_view'); end return true; end mz3.add_event_listener("click_detail_view", "greader.on_click_detail_view"); --- 詳細画面の右クリックイベント function on_rclick_detail_view(event_name, serialize_key, data, x, y) service_type = mz3.get_service_type(serialize_key); if service_type~='GoogleReader' then return false; end -- ボディリストのメニューを表示 on_popup_body_menu(event_name, serialize_key, data, mz3_main_view.get_wnd()); return true; end mz3.add_event_listener("rclick_detail_view", "greader.on_rclick_detail_view"); --- 詳細画面のマウスホイールイベント function on_mousewheel_detail_view(event_name, serialize_key, data, z_delta, vkey, x, y) service_type = mz3.get_service_type(serialize_key); if service_type~='GoogleReader' then return false; end -- mz3.logger_debug('z_delta : ' .. z_delta); if z_delta > 0 then -- 上方向:前の項目を表示 on_keydown_detail_view("keydown_detail_view", serialize_key, data, VK_UP); else -- 下方向:次の項目を表示 on_keydown_detail_view("keydown_detail_view", serialize_key, data, VK_DOWN); end return true; end mz3.add_event_listener("mousewheel_detail_view", "greader.on_mousewheel_detail_view"); --- 詳細画面のポップアップメニュー function on_popup_detail_menu(event_name, serialize_key, data, wnd) -- ボディリストのメニューを表示 return greader.on_popup_body_menu(event_name, serialize_key, data, mz3_main_view.get_wnd()); end mz3.add_event_listener("popup_detail_menu", "greader.on_popup_detail_menu"); mz3.logger_debug('google_reader.lua end');
local shell = require("shell") local fs = require("filesystem") local args, ops = shell.parse(...) local path = nil local verbose = false if ops.help then print( [[Usage cd [dir] For more options, run: man cd]]) return end if #args == 0 then local home = os.getenv("HOME") if not home then io.stderr:write("cd: HOME not set\n") return 1 end path = home elseif args[1] == '-' then verbose = true local oldpwd = os.getenv("OLDPWD"); if not oldpwd then io.stderr:write("cd: OLDPWD not set\n") return 1 end path = oldpwd else path = args[1] end local resolved = shell.resolve(path) if not fs.exists(resolved) then io.stderr:write("cd: ",path,": No such file or directory\n") return 1 end path = resolved local oldpwd = shell.getWorkingDirectory() local result, reason = shell.setWorkingDirectory(path) if not result then io.stderr:write("cd: ",reason) return 1 else os.setenv("OLDPWD", oldpwd) end if verbose then os.execute("pwd") end
if SERVER then AddCSLuaFile( "shared.lua" ) end if CLIENT then SWEP.PrintName = "Time Bomb" SWEP.Instructions = "" end SWEP.Author = "Douglas Huck" SWEP.Contact = "faceguydb@gmail.com" SWEP.Base = "weapon_banana" SWEP.ViewModel = "models/weapons/pbecustom/v_helibomb.mdl" SWEP.WorldModel = "models/weapons/pbecustom/w_helibomb_fix.mdl" SWEP.HoldReady = "grenade" SWEP.HoldNormal = "grenade" function SWEP:GetObjectToMake() return "pbe2_bomb" end
local A, L = ... local oUF = L.oUF or oUF local _, PlayerClass = UnitClass'player' local ClassPowerID, ClassPowerType local RequireSpec, RequireSpell local unpack = unpack do if(PlayerClass == 'MONK') then ClassPowerID = SPELL_POWER_CHI ClassPowerType = "CHI" RequireSpec = SPEC_MONK_WINDWALKER elseif(PlayerClass == 'PALADIN') then ClassPowerID = SPELL_POWER_HOLY_POWER ClassPowerType = "HOLY_POWER" RequireSpec = SPEC_PALADIN_RETRIBUTION elseif(PlayerClass == 'WARLOCK') then ClassPowerID = SPELL_POWER_SOUL_SHARDS ClassPowerType = "SOUL_SHARDS" elseif(PlayerClass == 'ROGUE' or PlayerClass == 'DRUID') then ClassPowerID = SPELL_POWER_COMBO_POINTS ClassPowerType = 'COMBO_POINTS' if(PlayerClass == 'DRUID') then RequireSpell = 5221 -- Shred end elseif(PlayerClass == 'MAGE') then ClassPowerID = SPELL_POWER_ARCANE_CHARGES ClassPowerType = 'ARCANE_CHARGES' RequireSpec = SPEC_MAGE_ARCANE end end local function CreateSplit(self,i) local bar = self.oClassBar local split = bar:CreateTexture() split:SetTexture(self.cfg.classbar.splits.texture) split:SetSize(unpack(self.cfg.classbar.splits.size)) split:SetVertexColor(unpack(self.cfg.classbar.splits.color)) local layer, sublayer = bar:GetStatusBarTexture():GetDrawLayer() split:SetDrawLayer(layer,sublayer+1) bar.splits[i] = split return split end local function UpdateSplits(self,maxSegments) if not self.cfg.classbar.splits or not self.cfg.classbar.splits.enabled then return end local bar = self.oClassBar if bar.maxSegments == maxSegments then return end bar.maxSegments = maxSegments if not maxSegments or maxSegments < 2 then if not bar.splits then return end for i=1,7 do if bar.splits[i] and bar.splits[i]:IsShown() then bar.splits[i]:Hide() end end return end if maxSegments > 8 then maxSegments = 5 end --anything above 8 will be split into 5 parts of 20%. if not bar.splits then bar.splits = {} end local p = bar:GetWidth()/maxSegments for i=1,7 do if i>maxSegments-1 then if bar.splits[i] and bar.splits[i]:IsShown() then bar.splits[i]:Hide() end else local split = bar.splits[i] or CreateSplit(self,i) split:SetPoint("CENTER",bar,"LEFT",p*i,0) if not split:IsShown() then split:Show() end end end end local function Update(self, event, unit, powerType) if(not (unit == 'player' and powerType == ClassPowerType or unit == 'vehicle' and powerType == 'COMBO_POINTS')) then return end local cb = self.oClassBar local ppcur, ppmax if unit == 'vehicle' then ppcur = GetComboPoints(unit) or 0 ppmax = MAX_COMBO_POINTS UpdateSplits(self,ppmax) else ppcur = UnitPower('player', ClassPowerID, true) or 0 ppmax = UnitPowerMax('player', ClassPowerID, true) UpdateSplits(self,UnitPowerMax('player', ClassPowerID)) end if ppcur == 0 then cb:Hide() else local color = oUF.colors.power[powerType] or {1,1,1} local r,g,b = unpack(color) cb:SetStatusBarColor(r,g,b) if cb.bg then local mu = cb.bg.multiplier or 0.3 cb.bg:SetVertexColor(r*mu, g*mu, b*mu) end cb:SetMinMaxValues(0, ppmax) cb:SetValue(ppcur) cb:Show() end end local function Path(self, ...) return (self.oClassBar.Override or Update) (self, ...) end local function ClassPowerEnable(self) self:RegisterEvent('UNIT_DISPLAYPOWER', Path) self:RegisterEvent('UNIT_POWER_FREQUENT', Path) self:RegisterEvent('UNIT_MAXPOWER', Path) if(UnitHasVehicleUI('player')) then Path(self, 'ClassPowerEnable', 'vehicle', 'COMBO_POINTS') else Path(self, 'ClassPowerEnable', 'player', ClassPowerType) end self.oClassBar.isEnabled = true end local function ClassPowerDisable(self) self:UnregisterEvent('UNIT_DISPLAYPOWER', Path) self:UnregisterEvent('UNIT_POWER_FREQUENT', Path) self:UnregisterEvent('UNIT_MAXPOWER', Path) Path(self, 'ClassPowerDisable', 'player', ClassPowerType) self.oClassBar:Hide() self.oClassBar.isEnabled = false end local function Visibility(self, event, unit) local element = self.oClassBar local shouldEnable if(UnitHasVehicleUI('player')) then shouldEnable = true unit = 'vehicle' elseif(ClassPowerID) then if(not RequireSpec or RequireSpec == GetSpecialization()) then if(not RequireSpell or IsPlayerSpell(RequireSpell)) then self:UnregisterEvent('SPELLS_CHANGED', Visibility) shouldEnable = true else self:RegisterEvent('SPELLS_CHANGED', Visibility, true) end end end local isEnabled = element.isEnabled if(shouldEnable and not isEnabled) then ClassPowerEnable(self) elseif(not shouldEnable and (isEnabled or isEnabled == nil)) then ClassPowerDisable(self) elseif(shouldEnable and isEnabled) then Path(self, event, unit, unit == 'vehicle' and 'COMBO_POINTS' or ClassPowerType) end end local function VisibilityPath(self, ...) return (self.oClassBar.OverrideVisibility or Visibility) (self, ...) end local function ForceUpdate(element) return VisibilityPath(element.__owner, 'ForceUpdate', element.__owner.unit) end local function Enable(self, unit) if(unit ~= 'player') then return end local element = self.oClassBar if(not element) then return end element.__owner = self element.ForceUpdate = ForceUpdate if(RequireSpec or RequireSpell) then self:RegisterEvent('PLAYER_TALENT_UPDATE', VisibilityPath, true) end return true end local function Disable(self) local element = self.oClassBar if(not element) then return end ClassPowerDisable(self) end oUF:AddElement('oClassBar', VisibilityPath, Enable, Disable)
return function() local createElement = require(script.Parent.Parent.createElement) local NoopRenderer = require(script.Parent.Parent.NoopRenderer) local createReconciler = require(script.Parent.Parent.createReconciler) local PureComponent = require(script.Parent) local noopReconciler = createReconciler(NoopRenderer) it("should be extendable", function() local MyComponent = PureComponent:extend("MyComponent") expect(MyComponent).to.be.ok() end) it("should skip updates for shallow-equal props", function() local updateCount = 0 local setValue local PureChild = PureComponent:extend("PureChild") function PureChild:willUpdate() updateCount = updateCount + 1 end function PureChild:render() return nil end local PureContainer = PureComponent:extend("PureContainer") function PureContainer:init() self.state = { value = 0, } end function PureContainer:didMount() setValue = function(value) self:setState({ value = value, }) end end function PureContainer:render() return createElement(PureChild, { value = self.state.value, }) end local element = createElement(PureContainer) local tree = noopReconciler.mountVirtualTree(element, nil, "PureComponent Tree") expect(updateCount).to.equal(0) setValue(1) expect(updateCount).to.equal(1) setValue(1) expect(updateCount).to.equal(1) setValue(2) expect(updateCount).to.equal(2) setValue(1) expect(updateCount).to.equal(3) noopReconciler.unmountVirtualTree(tree) end) end
class("BlackWhiteGridOPCommand", pm.SimpleCommand).execute = function (slot0, slot1) slot2 = slot1:getBody() slot3 = slot2.id slot4 = slot2.activityId slot5 = slot2.cmd if slot2.score < 0 then return end if not getProxy(ActivityProxy):getActivityById(slot4) or slot8:isEnd() then return end pg.ConnectionMgr.GetInstance():Send(11202, { cmd = 1, activity_id = slot4, arg1 = slot3, arg2 = slot6, arg_list = {} }, 11203, function (slot0) if slot0.result == 0 then if not table.contains(slot0.data1_list, PlayerConst.addTranDrop(slot0.award_list)) then table.insert(slot0.data1_list, slot1) end slot0.data2_list[table.indexof(slot0.data1_list, slot1)] = slot2 slot0.data2_list:updateActivity(slot0) slot0.data2_list:sendNotification(GAME.BLACK_WHITE_GRID_OP_DONE, { awards = slot1 }) else print(slot0.result) end end) end return class("BlackWhiteGridOPCommand", pm.SimpleCommand)
msg_tue = "Tuesday" msg_change = "Change" msg_wed = "Wednesday"
ESX = nil TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) RegisterServerEvent('mythic_base:server:CharacterSpawned') AddEventHandler('mythic_base:server:CharacterSpawned', function() local src = source local char = ESX.GetPlayerFromId(src) if settings == nil then exports['ghmattimysql']:scalar('SELECT data FROM phone_settings WHERE identifier = @identifier', { ['identifier'] = char.identifier }, function(dbSettings) if dbSettings ~= nil and json.decode(dbSettings) ~= nil then settings = { charid = char.identifier, settings = json.decode(dbSettings) } else settings = { charid = char.identifier, settings = { volume = 100, wallpaper = 1, ringtone = 1, text = 1 } } end end) end while settings == nil do Citizen.Wait(10) end TriggerClientEvent('8bit_phone:client:SetSettings', src, settings.settings) TriggerClientEvent('8bit_phone:client:SetupData', src, { { name = 'settings', data = settings.settings } }) end) function getData(source) local char = ESX.GetPlayerFromId(source) local identifier = GetPlayerIdentifiers(source)[1] local result = MySQL.Sync.fetchAll("SELECT * FROM phone_settings WHERE identifier = @identifier", {['@identifier'] = char.identifier}) if result[1] ~= nil then local identity = result[1] return { identifier = char.identifier['identifier'], data = char.identifier['data'] } else return nil end end RegisterServerEvent('mythic_base:server:SaveData') AddEventHandler('mythic_base:server:SaveData', function(data) local src = source local char = ESX.GetPlayerFromId(src) if getData(source) == nil then MySQL.Async.execute('INSERT INTO phone_settings (identifier, data) VALUES (@identifier, @data)', { ['@data'] = json.encode(data), ['@identifier'] = char.identifier }) settings.settings = data else MySQL.Async.execute('UPDATE phone_settings SET data = @data WHERE identifier = @identifier', { ['@data'] = json.encode(data), ['@identifier'] = char.identifier }) settings.settings = data end end)
flesh_eating_chuba = Creature:new { objectName = "@mob/creature_names:flesh_eating_chuba", socialGroup = "self", faction = "", level = 6, chanceHit = 0.25, damageMin = 50, damageMax = 55, baseXp = 113, baseHAM = 180, baseHAMmax = 220, armor = 0, resists = {0,0,0,0,0,0,0,-1,-1}, meatType = "meat_carnivore", meatAmount = 4, hideType = "hide_leathery", hideAmount = 3, boneType = "", boneAmount = 0, milk = 0, tamingChance = 0.25, ferocity = 0, pvpBitmask = ATTACKABLE, creatureBitmask = NONE, optionsBitmask = AIENABLED, diet = CARNIVORE, templates = {"object/mobile/chuba_hue.iff"}, controlDeviceTemplate = "object/intangible/pet/chuba_hue.iff", hues = { 24, 25, 26, 27, 28, 29, 30, 31 }, scale = 1.1, lootGroups = {}, weapons = {}, conversationTemplate = "", attacks = { } } CreatureTemplates:addCreatureTemplate(flesh_eating_chuba, "flesh_eating_chuba")
local MP = minetest.get_modpath("eco_mapgen") eco_mapgen.register_biome({ name = "underground", match = function(_, info) return info.type == "underground" end, full = MP .. "/schematics/base/air_full", replace = { ["air"] = "default:stone" } })
--[[ Copyright (c) 2016 Calvin Rose 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 url = require 'moonmint.url' local helper = require 'spec.helper' local testURL = helper.encode(url.encode, url.decode) test("Url encoding/decoding", function() test("Does basic encoding/decoding of simple strings", function() testURL("abcdefg") testURL("1233456") end) test("Encodes/decodes url special characters", function() testURL("!@#$%^&*()_+.,?:;\\") end) test("Encodes/decodes those darned plus signs", function() testURL("+ + +", "%2B+%2B+%2B") end) test("Encodes/decodes all possible bytes", function() for i = 0, 255 do testURL(string.char(i)) end end) test("Encodes/decodes strings of all possible bytes", function() for i = 0, 250 do testURL(string.char(i, i + 1, i + 2, i + 3, i + 4, i + 5)) end end) end)
return { BrickColorFormat = require(script.BrickColorFormat), Color3Format = require(script.Color3Format), EnumFormat = require(script.EnumFormat), NamingScheme = require(script.NamingScheme), NumberRangeFormat = require(script.NumberRangeFormat), PhysicalPropertiesFormat = require(script.PhysicalPropertiesFormat), UDim2Format = require(script.UDim2Format), }
local cpath = "{$WAF_PATH}/" local rpath = "{$WAF_PATH}/rule/" local logdir = "{$ROOT_PATH}/wwwlogs/waf/" local json = require "cjson" local ngx_match = ngx.re.find local _C = require "common" local C = _C:new(cpath, rpath, logdir) config = C:read_file_body_decode(cpath .. 'config.json') local site_config = C:read_file_body_decode(cpath .. 'site.json') C:setConfData(config, site_config) function initParams() local data = {} data['ip'] = C:get_client_ip() data['ipn'] = C:arrip(data['ip']) data['request_header'] = ngx.req.get_headers() data['uri'] = ngx.unescape_uri(ngx.var.uri) data['server_name'] = string.gsub(C:get_server_name(),'_','.') data['uri_request_args'] = ngx.req.get_uri_args() data['method'] = ngx.req.get_method() data['request_uri'] = ngx.var.request_uri return data end local params = initParams() C:setParams(params) function get_return_state(rstate,rmsg) result = {} result['status'] = rstate result['msg'] = rmsg return result end function get_waf_drop_ip() local data = ngx.shared.drop_ip:get_keys(0) return data end function is_chekc_table(data,strings) if type(data) ~= 'table' then return 1 end if not data then return 1 end data=chekc_ip_timeout(data) for k,v in pairs(data) do if strings ==v['ip'] then return 3 end end return 2 end function save_ip_on(data) locak_file=read_file_body(cpath2 .. 'stop_ip.lock') if not locak_file then C:write_file(cpath2 .. 'stop_ip.lock','1') end name='stop_ip' local extime=18000 data=json.encode(data) ngx.shared.btwaf:set(cpath2 .. name,data,extime) if not ngx.shared.btwaf:get(cpath2 .. name .. '_lock') then ngx.shared.btwaf:set(cpath2 .. name .. '_lock',1,0.5) C:write_file(cpath2 .. name .. '.json',data) end end function remove_btwaf_drop_ip() if not uri_request_args['ip'] or not C:is_ipaddr(uri_request_args['ip']) then return get_return_state(true,'格式错误') end if ngx.shared.btwaf:get(cpath2 .. 'stop_ip') then ret=ngx.shared.btwaf:get(cpath2 .. 'stop_ip') ip_data=json.decode(ret) result=is_chekc_table(ip_data,uri_request_args['ip']) os.execute("sleep " .. 0.6) ret2=ngx.shared.btwaf:get(cpath2 .. 'stop_ip') ip_data2=json.decode(ret2) if result == 3 then for k,v in pairs(ip_data2) do if uri_request_args['ip'] == v['ip'] then v['time']=0 end end end save_ip_on(ip_data2) end ngx.shared.drop_ip:delete(uri_request_args['ip']) return get_return_state(true,uri_request_args['ip'] .. '已解封') end function clean_btwaf_drop_ip() if ngx.shared.btwaf:get(cpath2 .. 'stop_ip') then ret2=ngx.shared.btwaf:get(cpath2 .. 'stop_ip') ip_data2=json.decode(ret2) for k,v in pairs(ip_data2) do v['time']=0 end save_ip_on(ip_data2) os.execute("sleep " .. 2) end local data = get_btwaf_drop_ip() for _,value in ipairs(data) do ngx.shared.drop_ip:delete(value) end return get_return_state(true,'已解封所有封锁IP') end function min_route() if ngx.var.remote_addr ~= '127.0.0.1' then return false end if uri == '/get_waf_drop_ip' then return_message(200,get_waf_drop_ip()) elseif uri == '/remove_waf_drop_ip' then return_message(200,remove_waf_drop_ip()) elseif uri == '/clean_waf_drop_ip' then return_message(200,clean_waf_drop_ip()) end end local get_html = C:read_file_body(config["reqfile_path"] .. '/' .. config["get"]["reqfile"]) local post_html = C:read_file_body(config["reqfile_path"] .. '/' .. config["post"]["reqfile"]) local user_agent_html = C:read_file_body(config["reqfile_path"] .. '/' .. config["user-agent"]["reqfile"]) local args_rules = C:read_file_table('args') local ip_white_rules = C:read_file('ip_white') local ip_black_rules = C:read_file('ip_black') local scan_black_rules = C:read_file('scan_black') function waf_args() if not config['get']['open'] or not C:is_site_config('get') then return false end if C:is_ngx_match(args_rules, params['uri_request_args'],'args') then C:write_log('args','regular') C:return_html(config['get']['status'], get_html) return true end return false end function waf_ip_white() for _,rule in ipairs(ip_white_rules) do if C:compare_ip(rule) then return true end end return false end function waf_ip_black() for _,rule in ipairs(ip_black_rules) do if C:compare_ip(rule) then ngx.exit(config['cc']['status']) return true end end return false end function waf_drop() local count,_ = ngx.shared.drop_ip:get(ip) if not count then return false end if count > config['retry'] then ngx.exit(config['cc']['status']) return true end return false end function waf_user_agent() if not config['user-agent']['open'] or not C:is_site_config('user-agent') then return false end if C:is_ngx_match(user_agent_rules,params['request_header']['user-agent'],'user_agent') then C:write_log('user_agent','regular') C:return_html(config['user-agent']['status'],user_agent_html) return true end return false end -- function cc() -- local ip = params['ip'] -- local request_uri = params['request_uri'] -- local endtime = config['cc']['endtime'] -- if not config['cc']['open'] or not site_cc then return false end -- local token = ngx.md5(ip .. '_' .. request_uri) -- local count,_ = ngx.shared.limit:get(token) -- if count then -- if count > limit then -- local safe_count,_ = ngx.shared.drop_sum:get(ip) -- if not safe_count then -- ngx.shared.drop_sum:set(ip,1,86400) -- safe_count = 1 -- else -- ngx.shared.drop_sum:incr(ip,1) -- end -- local lock_time = (endtime * safe_count) -- if lock_time > 86400 then lock_time = 86400 end -- ngx.shared.drop_ip:set(ip,retry+1,lock_time) -- C:write_log('cc',cycle..'秒内累计超过'..limit..'次请求,封锁' .. lock_time .. '秒') -- C:write_drop_ip('cc',lock_time) -- if not server_name then -- insert_ip_list(ip,lock_time,os.time(),'1111') -- else -- insert_ip_list(ip,lock_time,os.time(),server_name) -- end -- ngx.exit(config['cc']['status']) -- return true -- else -- ngx.shared.limit:incr(token,1) -- end -- else -- ngx.shared.limit:set(token,1,cycle) -- end -- return false -- end --强制验证是否使用正常浏览器访问网站 function waf_cc_increase() if not config['cc']['open'] or not site_cc then return false end if not site_config[server_name] then return false end if not site_config[server_name]['cc']['increase'] then return false end local cache_token = ngx.md5(ip .. '_' .. server_name) --判断是否已经通过验证 if ngx.shared.btwaf:get(cache_token) then return false end if cc_uri_white() then ngx.shared.btwaf:delete(cache_token .. '_key') ngx.shared.btwaf:set(cache_token,1,60) return false end if security_verification() then return false end send_check_heml(cache_token) end function waf_url() if not config['get']['open'] or not C:is_site_config('get') then return false end --正则-- if C:is_ngx_match(url_rules,params["uri"],'url') then C:write_log('url','regular') C:return_html(config['get']['status'],get_html) return true end return false end function waf_scan_black() if not config['scan']['open'] or not C:is_site_config('scan') then return false end if C:is_ngx_match(scan_black_rules['cookie'],params["request_header"]["cookie"],false) then C:write_log('scan','regular') ngx.exit(config['scan']['status']) return true end if C:is_ngx_match(scan_black_rules['args'],params["request_uri"],false) then C:write_log('scan','regular') ngx.exit(config['scan']['status']) return true end for key,value in pairs(params["request_header"]) do if C:is_ngx_match(scan_black_rules['header'], key, false) then C:write_log('scan','regular') ngx.exit(config['scan']['status']) return true end end return false end function waf_post_referer() if params['method'] ~= "POST" then return false end if C:is_ngx_match(referer_local, params['request_header']['Referer'],'post') then C:write_log('post_referer','regular') C:return_html(config['post']['status'],post_html) return true end return false end function waf_post() if not config['post']['open'] or not C:is_site_config('post') then return false end if params['method'] ~= "POST" then return false end if waf_post_referer() then return true end content_length = tonumber(params["request_header"]['content-length']) max_len = 640 * 1020000 if content_length > max_len then return false end if C:get_boundary() then return false end ngx.req.read_body() request_args = ngx.req.get_post_args() if not request_args then return false end if C:is_ngx_match(post_rules,request_args,'post') then C:write_log('post','regular') C:return_html(config['post']['status'],post_html) return true end return false end function post_data_chekc() if params['method'] =="POST" then if C:return_post_data() then return false end request_args = ngx.req.get_post_args() if not request_args then return false end if not request_header['Content-Type'] then return false end av=string.match(request_header['Content-Type'],"=.+") if not av then return false end ac=split(av,'=') if not ac then return false end list_list=nil for i,v in ipairs(ac) do list_list='--'..v end if not list_list then return false end aaa=nil for k,v in pairs(request_args) do aaa=v end if not aaa then return false end if tostring(aaa) == 'true' then return false end if type(aaa) ~= "string" then return false end data_len=split(aaa,list_list) --return return_message(200,data_len) if not data_len then return false end if arrlen(data_len) ==0 then return false end if C:is_ngx_match(post_rules,data_len,'post') then C:write_log('post','regular') C:return_html(config['post']['status'],post_html) return true end end end function X_Forwarded() if params['method'] ~= "GET" then return false end if not config['get']['open'] or not C:is_site_config('get') then return false end if C:is_ngx_match(args_rules,params["request_header"]['X-forwarded-For'],'args') then C:write_log('args','regular') C:return_html(config['get']['status'],get_html) return true end return false end function post_X_Forwarded() if not config['post']['open'] or not C:is_site_config('post') then return false end if params['method'] ~= "POST" then return false end if C:is_ngx_match(post_rules,params["request_header"]['X-forwarded-For'],'post') then C:write_log('post','regular') C:return_html(config['post']['status'],post_html) return true end return false end function php_path() if site_config[server_name] == nil then return false end for _,rule in ipairs(site_config[server_name]['disable_php_path']) do if ngx_match(uri,rule .. "/?.*\\.php$","isjo") then C:write_log('php_path','regular') C:return_html(config['other']['status'],other_html) return C:return_message(200,uri) end end return false end function url_path() if site_config[server_name] == nil then return false end for _,rule in ipairs(site_config[server_name]['disable_path']) do if ngx_match(uri,rule,"isjo") then C:write_log('path','regular') C:return_html(config['other']['status'],other_html) return true end end return false end function url_ext() if site_config[server_name] == nil then return false end for _,rule in ipairs(site_config[server_name]['disable_ext']) do if ngx_match(uri,"\\."..rule.."$","isjo") then C:write_log('url_ext','regular') C:return_html(config['other']['status'],other_html) return true end end return false end function url_rule_ex() if site_config[server_name] == nil then return false end if method == "POST" and not request_args then content_length=tonumber(request_header['content-length']) max_len = 640 * 102400000 request_args = nil if content_length < max_len then ngx.req.read_body() request_args = ngx.req.get_post_args() end end for _,rule in ipairs(site_config[server_name]['url_rule']) do if ngx_match(uri,rule[1],"isjo") then if C:is_ngx_match(rule[2],uri_request_args,false) then C:write_log('url_rule','regular') C:return_html(config['other']['status'],other_html) return true end if params['method'] == "POST" and request_args ~= nil then if C:is_ngx_match(rule[2],request_args,'post') then C:write_log('post','regular') C:return_html(config['other']['status'],other_html) return true end end end end return false end function url_tell() if site_config[server_name] == nil then return false end for _,rule in ipairs(site_config[server_name]['url_tell']) do if ngx_match(uri,rule[1],"isjo") then if uri_request_args[rule[2]] ~= rule[3] then C:write_log('url_tell','regular') C:return_html(config['other']['status'],other_html) return true end end end return false end function disable_upload_ext(ext) if not ext then return false end ext = string.lower(ext) if is_key(site_config[server_name]['disable_upload_ext'],ext) then C:write_log('upload_ext','上传扩展名黑名单') C:return_html(config['other']['status'],other_html) return true end end function data_in_php(data) if not data then return false else if C:is_ngx_match('php',data,'post') then C:write_log('upload_ext','上传扩展名黑名单') C:return_html(config['other']['status'],other_html) return true else return false end end end function post_data() if params["method"] ~= "POST" then return false end content_length = tonumber(params["request_header"]['content-length']) if not content_length then return false end max_len = 2560 * 1024000 if content_length > max_len then return false end local boundary = C:get_boundary() if boundary then ngx.req.read_body() local data = ngx.req.get_body_data() if not data then return false end local tmp = ngx.re.match(data,[[filename=\"(.+)\.(.*)\"]]) if not tmp then return false end if not tmp[2] then return false end local tmp2=ngx.re.match(ngx.req.get_body_data(),[[Content-Type:[^\+]{45}]]) --return return_message(200,tmp2[0]) disable_upload_ext(tmp[2]) if tmp2 == nil then return false end data_in_php(tmp2[0]) end return false end function waf_cookie() if not config['cookie']['open'] or not C:is_site_config('cookie') then return false end if not params["request_header"]['cookie'] then return false end if type(params["request_header"]['cookie']) ~= "string" then return false end request_cookie = string.lower(params["request_header"]['cookie']) if C:is_ngx_match(cookie_rules,request_cookie,'cookie') then C:write_log('cookie','regular') C:return_html(config['cookie']['status'],cookie_html) return true end return false end function waf_referer() if params["method"] ~= "GET" then return false end if not config['get']['open'] or not C:is_site_config('get') then return false end if C:is_ngx_match(referer_local,params["request_header"]['Referer'],'args') then C:write_log('get_referer','regular') C:return_html(config['get']['status'], get_html) return true end return false end function waf() min_route() if waf_ip_white() then return true end waf_ip_black() waf_drop() waf_user_agent() waf_url() if params["method"] == "GET" then waf_referer() waf_cookie() end if params["method"] == "POST" then waf_referer() waf_cookie() end waf_args() waf_scan_black() waf_post() post_data_chekc() local server_name = params["server_name"] if site_config[server_name] then X_Forwarded() post_X_Forwarded() php_path() url_path() url_ext() url_rule_ex() url_tell() post_data() end end waf()
local function item_to_matter(item) return { type = "recipe", name = item.item_name .. "-to-matter", localised_name = {"recipe-name.to-matter", {item.type .. "-name." .. item.item_name}}, category = "matter-conversion", subgroup = "matter-conversion", allow_as_intermediate = false, icons = { { icon = no_path_g_others .. "compatibility/Krastorio2/" .. item.item_name .. "-to-matter.png", icon_size = 64, icon_mipmaps = 1 } }, energy_required = item.energy_required, enabled = false, hidden = false, hide_from_player_crafting = true, always_show_made_in = true, always_show_products = true, show_amount_in_title = false, ingredients = { { type = item.type, name = item.item_name, amount = item.minimum_conversion_quantity } }, results= { { type = "fluid", name = "matter", amount = item.matter_value } }, order = "z[".. item.item_name .."-to-matter]" } end local function matter_to_item(item) return { type = "recipe", name = "matter-to-" .. item.item_name, localised_name = {"recipe-name.matter-to", {item.type .. "-name." .. item.item_name}}, category = "matter-deconversion", subgroup = "matter-deconversion", allow_as_intermediate = false, icons = { { icon = no_path_g_others .. "compatibility/Krastorio2/matter-to-" .. item.item_name .. ".png", icon_size = 64, icon_mipmaps = 1 } }, energy_required = item.energy_required, enabled = false, hide_from_player_crafting = true, always_show_made_in = true, always_show_products = true, show_amount_in_title = false, ingredients = { { type = "fluid", name = "matter", amount = item.matter_value } }, results= { { type = item.type, name = item.item_name, amount = item.minimum_conversion_quantity} }, order = "z[matter-to-" .. item.item_name .."]" } end -- @ recipes: Table<String> -- return Table<Effect> local function _tableToEffects(recipes) local effects = {} for _, name in pairs(recipes) do table.insert(effects, {type = "unlock-recipe", recipe = name}) end return effects end local matter_items = { -- thorium-ore { item_name = "thorium-ore", type = "item", minimum_conversion_quantity = 10, matter_value = 8, energy_required = 1, unlocked_by_technology = "kr-matter-thorium-processing" }, -- thorium-232 { item_name = "thorium-232", type = "item", minimum_conversion_quantity = 10, matter_value = 47.1, energy_required = 1, unlocked_by_technology = "kr-matter-thorium-processing" } } if mods["Krastorio2"] then data:extend({ { type = "technology", name = "kr-matter-thorium-processing", localised_name = "Thorium conversion", icon = no_path_g_others .. "compatibility/Krastorio2/matter-thorium.png", icon_size = 256, icon_mipmaps = 1, effects = _tableToEffects({"thorium-ore-to-matter", "thorium-232-to-matter", "matter-to-thorium-ore", "matter-to-thorium-232"}), prerequisites = {"kr-matter-processing"}, order = "g-e-e", unit = { count = 350, ingredients = { {"production-science-pack", 1}, {"utility-science-pack", 1}, {"matter-tech-card", 1} }, time = 45 } } }) for _, item in pairs(matter_items) do data:extend({ matter_to_item(item) }) data:extend({ item_to_matter(item) }) end end
--[[ LuCI - Lua Configuration Interface Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- module("luci.controller.ipsec", package.seeall) function index() entry({"admin", "services", "ipsec"}, alias("admin", "services", "ipsec", "policy"), _("IPSec")) entry({"admin", "services", "ipsec", "policy"}, arcombine(cbi("ipsec/policy"), cbi("ipsec/policy-add")), _("Policy")).leaf=true entry({"admin", "services", "ipsec", "general"}, cbi("ipsec/general"), _("General")).leaf = true entry({"admin", "services", "ipsec", "log"}, call("ipsec_log"), _("Log")).leaf = true entry({"admin", "services", "ipsec", "status"}, call("ipsec_status"), nil).leaf = true end function ipsec_status(section) local uci = require("luci.model.uci").cursor() local name = uci:get("ipsec", section, "name") local rv = luci.sys.exec("ubus call ipsec.policy.%s get_status" % name) luci.http.prepare_content("application/json") luci.http.write(rv) end function ipsec_log() local syslog = luci.sys.exec("logread | grep pluto") luci.template.render("ipsec/ipsec_log", { syslog=syslog}) end
object_ship_nova_orion_smuggler_heavy_tier1 = object_ship_shared_nova_orion_smuggler_heavy_tier1:new { } ObjectTemplates:addTemplate(object_ship_nova_orion_smuggler_heavy_tier1, "object/ship/nova_orion_smuggler_heavy_tier1.iff")
-- ui indicator/target --[[ g_Tutorial is a global var which is either false if we're not running a tutorial, or a table holding various parameters/state related to the tutorial List of members: EnableRockets - if not set to true, the city will not create starting rockets for you. EnableResupply - if not set to true the Resupply button in HUD will be disabled EnableResearchWarning - if not set to true, the city won't show the notification for research EnableResearch - if not set to true the Research button in HUD will be disabled EnableExplorationWarning - if not set to true, the city won't show the notification for exploration EnableRebuild - if not set to true, Rebuild button will be disabled during tutorial SuppressResupplyLaunch - if set to true will keep the Launch button in Resupply dialog disabled Map - tutorial scenario/map name Thread - the real time thread running the scenario-specific tutorial code UIArrows - created objects of class TutorialUIArrow MapMarkers - available objects of class TutorialMarker ConstructionTarget - table specifying the next construction class and location to enforce: * class * loc (point or object) * radius (in hexes) BuildMenuWhitelist - if specified, only listed items will be visible in build menu EnableExploration - if not set to true, exploration will be unavailable EnableOrbitalProbes - if not set to true, orbital probes will not be usable LastHint - id of the last displayed hint, internally used by TutorialNextHint EnableTransportProblemNotif - if not set to true, said notifications will be suppressed (value checked at start) RoverGatherResourceWorkTime - if set will override the default work time for rovers gathering resources from surface deposits --]] if FirstLoad then g_Tutorial = false g_TutorialArrows = {} g_TutorialScenarios = {} end function StartTutorial(id) local def = Presets.TutorialPreset.Default if not def[id] then return end def = def[id] if not CurrentThread() then return CreateRealTimeThread(StartTutorial, id) end if g_Tutorial and g_Tutorial.Map == def.map then TutorialCleanup() end WaitWarnAboutSkippedMods() -- change map LoadingScreenOpen("idLoadingScreen", "Tutorial") AccountStorage.CompletedTutorials = AccountStorage.CompletedTutorials or {} SaveAccountStorage(5000) CloseMenuDialogs() g_Tutorial = { Id = id, Map = def.map, MapMarkers = {}, } g_CurrentMissionParams.GameSessionID = g_CurrentMissionParams.GameSessionID or srp.random_encode64(96) ChangeMap(def.map) MapForEach("map", "TutorialMarker", function(o) if o.MarkerName ~= "" then assert(not g_Tutorial.MapMarkers[o.MarkerName], "Duplicate TutorialMarker name") g_Tutorial.MapMarkers[o.MarkerName] = o end o:ClearEnumFlags(const.efVisible) end) g_Tutorial.Loaded = true local idx = table.find(Presets.TutorialPreset.Default, "id", id) TelemetryTutorialAction("started", "step" .. (idx or ""), def.name) LoadingScreenClose("idLoadingScreen", "Tutorial") -- run tutorial-specific code g_Tutorial.Thread = CreateMapRealTimeThread(function() if g_TutorialScenarios[id] then g_TutorialScenarios[id]() end TutorialCleanup() end) end function WinTutorial(next_id) if not g_Tutorial or not AccountStorage then return end g_Tutorial.Won = true local def = Presets.TutorialPreset.Default[g_Tutorial.Id] local idx = table.find(Presets.TutorialPreset.Default, "id", g_Tutorial.Id) TelemetryTutorialAction("completed", "step" .. (idx or ""), def.name) AccountStorage.CompletedTutorials = AccountStorage.CompletedTutorials or {} AccountStorage.CompletedTutorials[g_Tutorial.Id] = true SaveAccountStorage(5000) if next_id then CreateRealTimeThread(StartTutorial, next_id) else CreateRealTimeThread(OpenPreGameMainMenu) end end function OnMsg.DoneMap() local map = GetMapName() if g_Tutorial and g_Tutorial.Map == map and g_Tutorial.Loaded then TutorialCleanup() g_Tutorial = false g_CurrentMissionParams.idMissionSponsor = "IMM" g_CurrentMissionParams.idCommanderProfile = "rocketscientist" end end function TutorialCleanup() if not g_Tutorial then return end RemoveAllTutorialArrows() local arrows = g_Tutorial.UIArrows or empty_table for i = #arrows, 1, -1 do arrows[i]:delete() end if IsValidThread(g_Tutorial.Thread) and g_Tutorial.Thread ~= CurrentThread() then DeleteThread(g_Tutorial.Thread) end if not g_Tutorial.Won then local def = Presets.TutorialPreset.Default[g_Tutorial.Id] local idx = table.find(Presets.TutorialPreset.Default, "id", g_Tutorial.Id) TelemetryTutorialAction("failed", "step" .. (idx or ""), def.name) end end function CountCompletedTutorials() local completed = AccountStorage and AccountStorage.CompletedTutorials local count = 0 for _, def in pairs(completed or empty_table) do count = count + 1 end return count end function CountTotalTutorials() return #Presets.TutorialPreset.Default end DefineClass.TutorialUIArrow = { __parents = { "XPopup" }, Background = RGBA(0, 0, 0, 0), FocusedBackground = RGBA(0, 0, 0, 0), BorderWidth = 0, BorderColor = RGBA(0, 0, 0, 0), FocusedBorderColor = RGBA(0, 0, 0, 0), HandleMouse = false, ChildrenHandleMouse = false, ZOrder = 1000, last_target = false, enabled = false, -- prevent getting focus } function TutorialUIArrow:Init() local image = XImage:new({ Image = "UI/Common/tutorial_arrow_right.tga", ImageScale = point(800, 800), --Columns = 6, FPS = 6, }, self) --image:SetAnimate(true) local anim_offset = point(30, 0) if self.AnchorType == "right" or self.AnchorType == "right-center" then image:SetImage("UI/Common/tutorial_arrow_left.tga") anim_offset = point(30, 0) --image.Angle = 270*60 elseif self.AnchorType == "center-top" or self.AnchorType == "top" then anim_offset = point(0, -30) --image.Angle = 180*60 image:SetImage("UI/Common/tutorial_arrow_down.tga") elseif self.AnchorType == "left" or self.AnchorType == "left-center" then --image.Angle = 90*60 anim_offset = point(-30, 0) image:SetImage("UI/Common/tutorial_arrow_right.tga") elseif self.AnchorType == "center-bottom" or self.AnchorType == "bottom" then anim_offset = point(0, 30) image:SetImage("UI/Common/tutorial_arrow_up.tga") end self:CreateThread("Update", function() while true do -- update anchor local target if not GetInGameMainMenu() then target = self:FindTarget() end if target and target:IsVisible() then if not self.Anchor or self.Anchor ~= target.box or self.last_target ~= target then self.last_target = target self.Anchor = target.box self:SetVisible(true, true) image:SetVisible(true, true) self:UpdateLayout() self:OnAttachToTarget(target) self:AddInterpolation{ id = "bounce", type = const.intRect, originalRect = self.box, originalRectAutoZoom = 1000, targetRect = self.box + anim_offset, targetRectAutoZoom = 1000, duration = 600, --start = 0, flags = const.intfPingPong + const.intfLooping, } end else self.last_target = false self:SetVisible(false, true) image:SetVisible(false, true) end Sleep(40) end end) if g_Tutorial then g_Tutorial.UIArrows = g_Tutorial.UIArrows or {} g_Tutorial.UIArrows[#g_Tutorial.UIArrows + 1] = self end end function TutorialUIArrow:Done() if g_Tutorial and g_Tutorial.UIArrows then table.remove_entry(g_Tutorial.UIArrows, self) end end function TutorialUIArrow:FindTarget() assert(false, "add a function in your arrow to locate the target control") return false end function TutorialUIArrow:OnAttachToTarget(target) --called only once each time attaching to the target end DefineClass.TutorialMarker = { __parents = { "MapMarkerObj" }, entity = "WayPoint", } DefineClass.ArrowTutorialBase = { __parents = { "AnimatedTextureObject" }, flags = { gofSpecialOrientMode = true, gofRealTimeAnim = true, efSelectable = false, efShadow = false, efSunShadow = false }, orient_mode = "facing_vertical", entity = "ArrowTutorial", } function ArrowTutorialBase:Init() self:SetScale(g_CurrentDepositScale) end DefineClass.ArrowTutorial = { __parents = { "ArrowTutorialBase", "AutoAttachObject" }, } function ShowTutorialArrow(where, class, entity) --uses: --ShowTutorialArrow(point) --ShowTutorialArrow(object) --ShowTutorialArrow("tutorial marker name") local position if type(where) == "string" then local marker = g_Tutorial.MapMarkers[where] position = marker and marker:GetPos() elseif IsValid(where) then if IsKindOf(where, "CObject") then local top_spot_idx = where:GetSpotBeginIndex("Top") position = where:GetSpotLoc(top_spot_idx) end elseif IsPoint(where) then position = where end assert(IsPoint(position), "No position for tutorial arrow") local arrow = PlaceObjectIn(class or "ArrowTutorial", MainMapID) arrow:SetPos(position) if entity then arrow:ChangeEntity(entity) end return arrow end function RemoveAllTutorialArrows() MapDelete("map", "ArrowTutorialBase") end DefineClass.TutorialGhostObj = { __parents = { "SpawnFXObject", "AutoAttachObject" }, flags = { cfConstructible = true, cofComponentCustomData = true }, } function TutorialGhostObj:ChangeEntity(...) SpawnFXObject.ChangeEntity(self, ...) AutoAttachObjectsToShapeshifter(self) PrepareForConstruction(self) self:SetConstruction(0, 2, self:GetBBox()) end function TutorialGhostObj:GetBBox() local bbox = self:GetEntityBBox() local attaches = self:GetAttaches() local i = 1 while i <= #(attaches or "") do local attach = attaches[i] if attach:GetClassFlags(const.cfConstructible) ~= 0 and attach:GetEnumFlags(const.efVisible) ~= 0 then bbox = Extend(bbox, attach:GetEntityBBox()) table.iappend(attaches, attach:GetAttaches()) end i = i + 1 end return bbox + self:GetVisualPos() end function TutorialNextHint(id) if not g_Tutorial then return end if g_Tutorial.LastHint then HintDisable(g_Tutorial.LastHint) end g_Tutorial.LastHint = id return HintTrigger(id, true) end function WaitTutorialPopup(...) if g_Tutorial and g_Tutorial.LastHint then HintDisable(g_Tutorial.LastHint) end while true do local igi = GetInGameInterface() if igi and igi:GetVisible() then break end Sleep(100) end return WaitPopupNotification(...) end function WaitTutorialPopupImmediate(...) if g_Tutorial and g_Tutorial.LastHint then HintDisable(g_Tutorial.LastHint) end return WaitPopupNotification(...) end function PlaceGhost(entity, pos, angle, hex_align) assert(IsValidEntity(entity)) angle = angle or 0 local obj = PlaceObjectIn("TutorialGhostObj", MainMapID) if hex_align then local q, r = WorldToHex(pos) pos = point(HexToWorld(q, r)) end obj:SetPos(pos) obj:SetAngle(angle) obj:ChangeEntity(entity) return obj end -- the following two waits will mostly work, assuming you dont receive multiple Msg in the same millisecond (e.g. alt+b) function WaitConstruction(...) local waited = {...} local last_bld while #waited > 0 do local ok, bld = WaitMsg("ConstructionComplete") for i = #waited, 1, -1 do if bld.template_name == waited[i] then table.remove(waited, i) last_bld = bld end end end return last_bld end function WaitConstructionSite(...) local waited = {...} while #waited > 0 do local ok, site = WaitMsg("ConstructionSitePlaced") for i = #waited, 1, -1 do if site.building_class == waited[i] then table.remove(waited, i) end end end end function WaitAnyConstructionSite(...) local waited = {...} while #waited > 0 do local ok, site = WaitMsg("ConstructionSitePlaced") for i = #waited, 1, -1 do if site.building_class == waited[i] then return end end end end function WaitBuildMenuItemSelected(category, item, mode, view_pos) local gamepad = GetUIStyleGamepad() local arrow = TutorialUIArrow:new({ AnchorType = "center-top", FindTarget = function() if (mode=="place" or mode == "place-instant") and GetInGameInterfaceMode() == "construction" then if view_pos then ViewObjectMars(view_pos) end return false end if not Dialogs.XBuildMenu then if gamepad then local dlg = GetDialog("GamepadIGMenu") return dlg and dlg.items and table.find_value(dlg.items, "name", "idBuild") or false end if not g_RightClickOpensBuildMenu then local dlg = GetHUD() return dlg and dlg.idBuild or false else return false end end local items = Dialogs.XBuildMenu.items local ctrl = table.find_value(items, "name", item) if ctrl then return ctrl end return Dialogs.XBuildMenu.idCategoryList[category] end, }, terminal.desktop) mode = mode or "construction" if mode=="place" then WaitConstructionSite(item) elseif mode == "place-instant" then WaitConstruction(item) elseif mode == "construction" then local city_construction = GetDefaultConstructionController(MainCity) while GetInGameInterfaceMode() ~= mode or city_construction.template ~= item do Sleep(50) end else while GetInGameInterfaceMode() ~= mode do Sleep(50) end end if arrow and arrow.window_state ~= "destroying" then arrow:delete() end end function FindBuildMenuItem(item, category, subcategory) if not Dialogs.XBuildMenu then if GetUIStyleGamepad() then local dlg = GetDialog("GamepadIGMenu") return dlg and dlg.items and table.find_value(dlg.items, "name", "idBuild") or false end if not g_RightClickOpensBuildMenu then local dlg = GetHUD() return dlg and dlg.idBuild or false else return false end end if Dialogs.XBuildMenu:HasMember(item) then return Dialogs.XBuildMenu[item] end if subcategory and Dialogs.XBuildMenu:HasMember(subcategory) then return Dialogs.XBuildMenu[subcategory] end return Dialogs.XBuildMenu.idCategoryList[category] end function WaitBuildMenuStorageSelected(item, anchor_type) local gamepad = GetUIStyleGamepad() local arrow = TutorialUIArrow:new({ AnchorType = anchor_type or "center-top", FindTarget = function() if not Dialogs.XBuildMenu then if gamepad then local dlg = GetDialog("GamepadIGMenu") return dlg and dlg.items and table.find_value(dlg.items, "name", "idBuild") or false end if not g_RightClickOpensBuildMenu then local dlg = GetHUD() return dlg and dlg.idBuild or false else return false end end if Dialogs.XBuildMenu:HasMember(item) then return Dialogs.XBuildMenu[item] end if Dialogs.XBuildMenu:HasMember("Depots") then return Dialogs.XBuildMenu.Depots end return Dialogs.XBuildMenu.idCategoryList.Storages end, }, terminal.desktop) local city_construction = GetDefaultConstructionController(MainCity) while GetInGameInterfaceMode() ~= "construction" or city_construction.template ~= item do Sleep(50) end if arrow and arrow.window_state ~= "destroying" then arrow:delete() end end function WaitInfopanelAction(class, action, condition_func) local find_target = function(self) if not IsKindOf(SelectedObj, class) then return false end if not Dialogs.Infopanel then return false end for i,button in ipairs(Dialogs.Infopanel.idMainButtons) do if button.OnPressParam == action then return button end end return false end WaitCustomUIButtonPressed(find_target, condition_func, "left-center") end function WaitResourceItemsChoice(name, condition_func, anchor_type) local find_target = function(self) if not Dialogs.ResourceItems then return false end for i,item in ipairs(Dialogs.ResourceItems.items) do if item.name == name then return item end end return false end WaitCustomUIButtonPressed(find_target, condition_func, anchor_type) end function WaitResearchQueued(tech_id, close, wait_any_tech) local tech_def = TechDef[tech_id] local tech_field = tech_def.group local field_order = UIColony:UITechField(tech_field) local x = table.find(field_order, tech_id) local y = table.find(Presets.TechFieldPreset.Default, "id", tech_field) local focus_order = point(x, y) local arrow = TutorialUIArrow:new({ AnchorType = "center-top", FindTarget = function(self) local dlg = Dialogs.ResearchDlg if not dlg then self.AnchorType = "center-top" if GetUIStyleGamepad() then local gamepadmenu = Dialogs.GamepadIGMenu if not gamepadmenu then return false end if not gamepadmenu.items then return false end return table.find_value(gamepadmenu.items, "name", "idResearch") or false else return Dialogs.HUD and Dialogs.HUD.idResearch or false end end if table.find(UIColony.research_queue, tech_id) and close then return dlg and dlg.idToolBar.idclose or false end --TODO: should the arrow change it's anchor type at this point? local research_dlg = Dialogs.ResearchDlg --local tech = research_dlg:GetRelativeFocus(focus_order, "exact") local tech local fields = research_dlg.idArea for _, field in ipairs(fields) do if not tech and field:HasMember("idFieldTech") then for _, ctrl in ipairs(field.idFieldTech) do if ctrl.context.id == tech_id then tech = ctrl break end end end end self.ZOrder = research_dlg.ZOrder + 1 return tech or false end, }, terminal.desktop) if wait_any_tech then local initial_cnt = #UIColony.research_queue while true do WaitMsg("ResearchQueueChange") if initial_cnt ~= #UIColony.research_queue then break end end else while true do WaitMsg("ResearchQueueChange") if table.find(UIColony.research_queue, tech_id) then break end end end if close then while Dialogs.ResearchDlg do Sleep(200) end end if arrow and arrow.window_state ~= "destroying" then arrow:delete() end end function WaitHUDButtonPressed(button, condition_func) local find_target = function(self) if GetUIStyleGamepad() then local gamepadmenu = Dialogs.GamepadIGMenu if not gamepadmenu then return false end if not gamepadmenu.items then return false end return table.find_value(gamepadmenu.items, "name", button) or false else return Dialogs.HUD and Dialogs.HUD[button] or false end end WaitCustomUIButtonPressed(find_target, condition_func, "center-top") end function WaitUIButtonPressed(dialog, button, condition_func, anchor_type) local find_target = function(self) local dlg = Dialogs[dialog] local gamepad = GetUIStyleGamepad() if gamepad then local dlg = GetDialog("GamepadIGMenu") return dlg and dlg.items and table.find_value(dlg.items, "name", button) or false end if not dlg then return false end return dlg[button] or false end WaitCustomUIButtonPressed(find_target, condition_func, anchor_type) end local function DefaultWaitCondition(arrow) return arrow.button_pressed end function WaitCustomUIButtonPressed(find_target_func, condition_func, anchor_type) condition_func = condition_func or DefaultWaitCondition local arrow = TutorialUIArrow:new({ AnchorType = anchor_type or "center-top", FindTarget = find_target_func, OnAttachToTarget = function(self, target) if target:HasMember("idButton") then target = target.idButton end local old_OnPress = target.OnPress target.OnPress = function(...) self.button_pressed = true return old_OnPress(...) end end, button_pressed = false, }, terminal.desktop) while not condition_func(arrow) do Sleep(50) end if arrow and arrow.window_state ~= "destroying" then arrow:delete() end end function WaitObjectSelected(obj, no_ingame_arrow, no_pin_arrow) if SelectedObj == obj then return end local ingame_arrow, ui_arrow --ingame arrow if not no_ingame_arrow then local top_spot_idx = obj:GetSpotBeginIndex("Top") ingame_arrow = PlaceObject("ArrowTutorialBase") obj:Attach(ingame_arrow, top_spot_idx) end --ui arrow if not no_pin_arrow then ui_arrow = TutorialUIArrow:new({ AnchorType = "center-top", FindTarget = function(self) local pins_dlg = Dialogs.PinsDlg if not pins_dlg then return false end for _,win in ipairs(pins_dlg) do if not win.Dock and win.context == obj then return win end end return false end, }, terminal.desktop) end --wait until selected while true do WaitMsg("SelectedObjChange") if SelectedObj == obj then break end end --clean up arrows if ingame_arrow then DoneObject(ingame_arrow) end if ui_arrow and ui_arrow.window_state ~= "destroying" then ui_arrow:delete() end end function WaitResourcesNearPoint(point, resource, amount, radius, ignore_classes) --set resource to something specific or set it to false for all resources radius = radius or 100*guim local total = 0 local stockpiles_func, drone_func if resource then --specific resource given stockpiles_func = function(pile, resource, getter_name, ignore_classes) if IsKindOfClasses(pile, ignore_classes) then return end if resource == "Fuel" and IsKindOf(pile, "SupplyRocket") then local extra = pile.unload_fuel_request and pile.unload_fuel_request:GetActualAmount() or 0 local current = (pile:GetLaunchFuel() - pile.refuel_request:GetActualAmount() + extra) total = total + current elseif pile:HasMember(getter_name) then total = total + pile[getter_name](pile) elseif type(pile.stockpiled_amount) == "table" then total = total + (pile.stockpiled_amount[resource] or 0) else total = total + (pile.stockpiled_amount or 0) end end drone_func = function(drone, resource, getter_name, ignore_classes) if IsKindOfClasses(drone, ignore_classes) then return end if drone.resource == resource then total = total + (drone.amount or 0) end end else --no specific resource - gather all resources stockpiles_func = function(pile, resource, getter_name, ignore_classes) if IsKindOfClasses(pile, ignore_classes) then return end if IsKindOf(pile, "SupplyRocket") then local extra = pile.unload_fuel_request and pile.unload_fuel_request:GetActualAmount() or 0 local current = (pile:GetLaunchFuel() - pile.refuel_request:GetActualAmount() + extra) total = total + current elseif type(pile.stockpiled_amount) == "table" then for res, amount in pairs(stockpiled_amount) do total = total + amount end else total = total + (pile.stockpiled_amount or 0) end end drone_func = function(drone, resource, getter_name, ignore_classes) if IsKindOfClasses(drone, ignore_classes) then return end total = total + (drone.amount or 0) end end ignore_classes = ignore_classes or { } local getter_name = "GetStored_" .. (resource or "") while true do total = 0 MapForEach(point, radius, "ResourceStockpileBase", stockpiles_func, resource, getter_name, ignore_classes) MapForEach(point, radius, "Drone", drone_func , resource, getter_name, ignore_classes) --print("currently", total, resource, "; expecting", amount) if total >= amount then break end Sleep(1000) end end function HasPoweredBuilding(label) for _, bld in ipairs(MainCity.labels[label] or empty_table) do if bld:HasPower() then return true end end end function IsBuildingInRange(bld, obj, range) local shape = GetEntityCombinedShape(bld:GetEntity()) local pos = bld:GetPos() local angle = bld:GetAngle() local target = obj if IsValid(obj) then target = obj:GetPos() end target = point(HexToWorld(WorldToHex(target))) for i = 1, #shape do local q, r = shape[i]:xy() local x, y = HexToWorld(q, r) local pt = pos + Rotate(point(x, y), angle) if HexAxialDistance(pt, target) <= range then return true end end end function GetSector(id) for i = 1, const.SectorCount do local row = MainCity.MapSectors[i] for j = 1, const.SectorCount do local sector = row[j] if sector.id == id then return sector end end end end TFormat.TutorialDisabledAchievementsText = function(context_obj) if Platform.ps4 then return T(10089, "Trophies are disabled during all tutorials.") else return T(10090, "Achievements are disabled during all tutorials.") end end
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- C R E D I T S -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --- === plugins.core.helpandsupport.credits === --- --- Credits Menu Item. -------------------------------------------------------------------------------- -- -- CONSTANTS: -- -------------------------------------------------------------------------------- local PRIORITY = 3 -------------------------------------------------------------------------------- -- -- THE MODULE: -- -------------------------------------------------------------------------------- local mod = {} --- plugins.core.helpandsupport.credits.show() -> nil --- Function --- Opens the CommandPost Credits in a browser --- --- Parameters: --- * None --- --- Returns: --- * None function mod.show() os.execute('open "http://help.commandpost.io/getting_started/credits/"') end -------------------------------------------------------------------------------- -- -- THE PLUGIN: -- -------------------------------------------------------------------------------- local plugin = { id = "core.helpandsupport.credits", group = "core", dependencies = { ["core.menu.helpandsupport.commandpost"] = "helpandsupport", ["core.commands.global"] = "global", } } -------------------------------------------------------------------------------- -- INITIALISE PLUGIN: -------------------------------------------------------------------------------- function plugin.init(deps) -------------------------------------------------------------------------------- -- Commands: -------------------------------------------------------------------------------- local global = deps.global global:add("cpCredits") :whenActivated(mod.show) :groupedBy("helpandsupport") deps.helpandsupport:addItem(PRIORITY, function() return { title = i18n("credits"), fn = mod.show } end) return mod end return plugin
local Animation = require(script.Animation) local AnimationSequence = require(script.AnimationSequence) local PrepareStep = require(script.PrepareStep) local makeAnimatedComponent = require(script.makeAnimatedComponent) local RoactAnimate = { Value = require(script.AnimatedValue), makeAnimatedComponent = makeAnimatedComponent, } -- Create animated variants of all the Roblox classes for _, ClassName: string in ipairs {"Frame", "ImageButton", "ImageLabel", "ScrollingFrame", "TextBox", "TextButton", "TextLabel", "ViewportFrame"} do RoactAnimate[ClassName] = makeAnimatedComponent(ClassName) end -- Creates an animation for a value. RoactAnimate.Animate = Animation.new -- Creates an animation from a table of animations. -- These animations will be run one-by-one. function RoactAnimate.Sequence(animations) return AnimationSequence.new(animations, false) end -- Creates an animation from a table of animations. -- These animations will be run all at once. function RoactAnimate.Parallel(animations) return AnimationSequence.new(animations, true) end -- Creates a preparation step. -- This allows instantaneous resetting of a value prior to animations completing. RoactAnimate.Prepare = PrepareStep.new return setmetatable(RoactAnimate, { __call = function(_, ...) return RoactAnimate.Animate(...) end, })
local str = "Hello_World" --常用函数 assert(str:ToLower() == "hello_world") assert(str:ToUpper() == "HELLO_WORLD") assert(str:StartsWith("Hello") == true) assert(str:StartsWith("wHello") == false) assert(str:EndsWith("World") == true) assert(str:EndsWith("Worl") == false) local splitArr = str:Split("_") assert(splitArr[1] == "Hello") assert(splitArr[2] == "World") assert(str:Contains("_") == true) assert(str:Contains(".") == false) assert(str:IndexOf("o") == 5) assert(str:LastIndexOf("o") == 8) local space = " " .. str .. " " assert(space:Trim() == str) --中文字符的长度获取 local zhStr = "Hello渔" assert(zhStr:Length() == 8) assert(zhStr:CharLength() == 6) --字符数组 local strCharArr = str:ToBytes() assert( table.equals( strCharArr, { string.byte("H"), string.byte("e"), string.byte("l"), string.byte("l"), string.byte("o"), string.byte("_"), string.byte("W"), string.byte("o"), string.byte("r"), string.byte("l"), string.byte("d") } ) ) local newStr = String.New(strCharArr) assert(newStr == str) -- StringBuilder local sb = StringBuilder.New() sb:AppendLine("hello") sb:Append("world") assert(sb:ToString() == "hello\nworld")
super_saiyan = { cast = function(player) if player:hasDuration("super_saiyan") then player:setDuration("super_saiyan", 1) else player:setDuration("super_saiyan", 600000) end -- player:sendAnimation(241, 599) -- player:sendAnimation(242, 599) clone.equip(player, player) player.gfxCrown = 273 player.gfxCrownC = 8 player.gfxFaceATC = 26 player:updateState() end, while_cast = function(player) player:sendAnimation(349) end, while_cast_250 = function(player) player:sendAnimation(509) end, uncast = function(player) player.gfxClone = 0 player:updateState() end }
-- Madonox local rs = game:GetService("RunService") local BasicService = {} BasicService.services = {} BasicService.httpEnabled = false local http = game:GetService("HttpService") BasicService.httpEnabled = pcall(function() http:GetAsync("https://www.google.com") end) if BasicService.httpEnabled == false then warn("BasicService requests the usage of HTTP service for naming modules, while it is not required, it is benificial.") end function BasicService:Index(serviceName : string,functionsKey,isSecure : boolean) local serviceClass = script.Parent.Classes.ServiceClass:Clone() serviceClass.Parent = script.Parent.Bin if BasicService.httpEnabled == true then serviceClass.Name = http:GenerateGUID(false) end for i,v in pairs(functionsKey) do require(serviceClass):Define(i,v) end require(serviceClass):Construct(serviceName,isSecure) BasicService.services[serviceName] = require(serviceClass):Get() end function BasicService:GetService(name : string) if BasicService.services[name] ~= nil then return BasicService.services[name],"pass" else return { ["result"] = function() warn("No service found under the name of "..name) end, },"err" end end return BasicService
local BaseScene = class("BaseScene") function BaseScene:ctor() end return BaseScene
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB local S = E:GetModule('Skins') --Cache global variables --Lua functions local _G = _G local gsub = gsub local pairs = pairs local strfind = strfind --WoW API / Variables local hooksecurefunc = hooksecurefunc --Global variables that we don't cache, list them here for mikk's FindGlobals script -- GLOBALS: NUMGOSSIPBUTTONS local function LoadSkin() if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.gossip ~= true then return end ItemTextFrame:StripTextures(true) ItemTextFrame:SetTemplate("Transparent") ItemTextScrollFrame:StripTextures() GossipFrame:SetTemplate("Transparent") GossipFramePortrait:Kill() S:HandleCloseButton(ItemTextFrameCloseButton) S:HandleCloseButton(GossipFrameCloseButton) S:HandleScrollBar(GossipGreetingScrollFrameScrollBar, 5) S:HandleScrollBar(ItemTextScrollFrameScrollBar) S:HandleNextPrevButton(ItemTextPrevPageButton) S:HandleNextPrevButton(ItemTextNextPageButton) ItemTextPageText:SetTextColor(1, 1, 1) hooksecurefunc(ItemTextPageText, "SetTextColor", function(self, headerType, r, g, b) if r ~= 1 or g ~= 1 or b ~= 1 then ItemTextPageText:SetTextColor(headerType, 1, 1, 1) end end) local StripAllTextures = { "GossipFrameGreetingPanel", "GossipFrame", "GossipFrameInset", "GossipGreetingScrollFrame" } for _, object in pairs(StripAllTextures) do _G[object]:StripTextures() end GossipGreetingScrollFrame:SetTemplate() if E.private.skins.parchmentRemover.enable then for i = 1, NUMGOSSIPBUTTONS do _G["GossipTitleButton"..i]:GetFontString():SetTextColor(1, 1, 1) end GossipGreetingText:SetTextColor(1, 1, 1) hooksecurefunc("GossipFrameUpdate", function() for i = 1, NUMGOSSIPBUTTONS do local button = _G["GossipTitleButton"..i] if button:GetFontString() then local Text = button:GetFontString():GetText() if Text and strfind(Text, '|cff000000') then button:GetFontString():SetText(gsub(Text, '|cff000000', '|cffffe519')) end end end end) else GossipGreetingScrollFrame.spellTex = GossipGreetingScrollFrame:CreateTexture(nil, 'ARTWORK') GossipGreetingScrollFrame.spellTex:SetTexture([[Interface\QuestFrame\QuestBG]]) GossipGreetingScrollFrame.spellTex:Point("TOPLEFT", 2, -2) GossipGreetingScrollFrame.spellTex:Size(506, 615) GossipGreetingScrollFrame.spellTex:SetTexCoord(0, 1, 0.02, 1) end GossipFrameGreetingGoodbyeButton:StripTextures() S:HandleButton(GossipFrameGreetingGoodbyeButton) S:HandleCloseButton(GossipFrameCloseButton,GossipFrame.backdrop) NPCFriendshipStatusBar:StripTextures() NPCFriendshipStatusBar:SetStatusBarTexture(E.media.normTex) NPCFriendshipStatusBar:CreateBackdrop('Default') E:RegisterStatusBar(NPCFriendshipStatusBar) end S:AddCallback("Gossip", LoadSkin)
local initiatives_selector = Initiative:selector_for_updated_drafts(app.session.member_id) ui.container{ attr = { class = "heading" }, content = _"Open initiatives you are supporting which has been updated their draft:" } slot.put("<br />") execute.view{ module = "initiative", view = "_list", params = { initiatives_selector = initiatives_selector } }
ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\master.lvl") -- -- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved. -- ScriptCB_DoFile("ME5_Master") ScriptCB_DoFile("ME5_setup_teams") ScriptCB_DoFile("ME5_ObjectiveConquest") -- Create a new MapManager object manager = MapManager:New{ -- Map-specific details bIsModMap = true, gameMode = "conquest", mapSize = "med", environmentType = "jungle", -- In-game music musicVariation_SSVxGTH = "1", musicVariation_SSVxCOL = "5", musicVariation_EVGxGTH = "9", musicVariation_EVGxCOL = "9", musicVariation_SSVxRPR = {"8", "5_mahavid"}, -- Online matches onlineSideVar = "SSVxGTH", onlineHeroSSV = "shep_soldier", onlineHeroGTH = "gethprime_me2", onlineHeroCOL = "colgeneral", onlineHeroEVG = "gethprime_me3", -- AI hero spawns. CP name, CP spawn path name heroSupportCPs = { {"cp1", "cp1_spawn"}, {"cp2", "cp2_spawn"}, {"cp3", "cp3_spawn"}, {"cp4", "cp4_spawn"}, {"cp5", "cp5_spawn"}, {"cp6", "cp6_spawn"}, }, -- Local ally spawns. CP name, CP spawn path name allySpawnCPs = { {"cp1", "cp1_spawn"}, {"cp2", "cp2_spawn"}, {"cp3", "cp3_spawn"}, {"cp4", "cp4_spawn"}, {"cp5", "cp5_spawn"}, {"cp6", "cp6_spawn"}, }, } -- Initialize the MapManager manager:Init() -- Randomize which team is ATT/DEF if not ScriptCB_InMultiplayer() then CIS = math.random(1,2) REP = (3 - CIS) else REP = 2 CIS = 1 end HuskTeam = 3 ATT = 1 DEF = 2 function ScriptPostLoad() --This defines the CPs. These need to happen first cp1 = CommandPost:New{name = "cp1"} cp2 = CommandPost:New{name = "cp2"} cp3 = CommandPost:New{name = "cp3"} cp4 = CommandPost:New{name = "cp4"} cp5 = CommandPost:New{name = "cp5"} cp6 = CommandPost:New{name = "cp6"} --This sets up the actual objective. This needs to happen after cp's are defined conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "game.modes.con", textDEF = "game.modes.con2", multiplayerRules = true} --This adds the CPs to the objective. This needs to happen after the objective is set up conquest:AddCommandPost(cp1) conquest:AddCommandPost(cp2) conquest:AddCommandPost(cp3) conquest:AddCommandPost(cp4) conquest:AddCommandPost(cp5) conquest:AddCommandPost(cp6) conquest:Start() EnableSPHeroRules() manager:Proc_ScriptPostLoad_End() AddDeathRegion("monorail") AddDeathRegion("ocean") SetProperty("cp1", "NeutralizeTime", 40) SetProperty("cp1", "CaptureTime", 35) SetProperty("cp2", "NeutralizeTime", 40) SetProperty("cp2", "CaptureTime", 35) SetProperty("cp3", "NeutralizeTime", 40) SetProperty("cp3", "CaptureTime", 35) SetProperty("cp4", "NeutralizeTime", 40) SetProperty("cp4", "CaptureTime", 35) SetProperty("cp5", "NeutralizeTime", 40) SetProperty("cp5", "CaptureTime", 35) SetProperty("cp6", "NeutralizeTime", 40) SetProperty("cp6", "CaptureTime", 35) end --------------------------------------------------------------------------- -- FUNCTION: ScriptInit -- PURPOSE: This function is only run once -- INPUT: -- OUTPUT: -- NOTES: The name, 'ScriptInit' is a chosen convention, and each -- mission script must contain a version of this function, as -- it is called from C to start the mission. --------------------------------------------------------------------------- function ScriptInit() -- Designers, these two lines *MUST* be first! StealArtistHeap(256*1024) -- Stormy variant if ME5_MapVarEDN == 1 then ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\Load\\edn_stormy.lvl") -- Cloudy variant elseif ME5_MapVarEDN == 2 then ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\Load\\edn_cloudy.lvl") -- Dusk variant elseif ME5_MapVarEDN == 3 then ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\Load\\edn_night.lvl") end SetMemoryPoolSize("ParticleTransformer::ColorTrans", 2551) SetMemoryPoolSize("ParticleTransformer::PositionTr", 1532) SetMemoryPoolSize("ParticleTransformer::SizeTransf", 1691) manager:Proc_ScriptInit_Begin() if not ScriptCB_InMultiplayer() then if ME5_Difficulty == 1 then SetAIDifficulty(1, -1) SetTeamAggressiveness(CIS,(0.53)) SetTeamAggressiveness(REP,(0.63)) elseif ME5_Difficulty == 2 then SetAIDifficulty(0, 0) SetTeamAggressiveness(CIS,(0.63)) SetTeamAggressiveness(REP,(0.73)) elseif ME5_Difficulty == 3 then SetAIDifficulty(-2, 1) SetTeamAggressiveness(CIS,(0.73)) SetTeamAggressiveness(REP,(0.83)) elseif ME5_Difficulty == 4 then SetAIDifficulty(-2, 2) SetTeamAggressiveness(CIS,(0.83)) SetTeamAggressiveness(REP,(0.93)) elseif ME5_Difficulty == 5 then SetAIDifficulty(-3, 3) SetTeamAggressiveness(CIS,(0.9)) SetTeamAggressiveness(REP,(1.0)) else SetAIDifficulty(-2, 2) SetTeamAggressiveness(CIS,(0.83)) SetTeamAggressiveness(REP,(0.93)) end else SetAIDifficulty(-2, 2) SetTeamAggressiveness(CIS,(0.85)) SetTeamAggressiveness(REP,(0.95)) end SetMaxFlyHeight(23) SetMaxPlayerFlyHeight(23) AISnipeSuitabilityDist(55) SetAttackerSnipeRange(70) SetDefenderSnipeRange(100) ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\SIDE\\me5tur.lvl", "tur_bldg_mturret", "tur_bldg_laser") manager:Proc_ScriptInit_SideSetup() ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\sound\\SFL_EDN_Streaming.lvl") -- Level Stats ClearWalkers() AddWalkerType(0, 0) -- special -> droidekas AddWalkerType(1, 0) -- 1x2 (1 pair of legs) AddWalkerType(2, 0) -- 2x2 (2 pairs of legs) AddWalkerType(3, 0) -- 3x2 (3 pairs of legs) local weaponCnt = 230 SetMemoryPoolSize("Aimer", 46) SetMemoryPoolSize("AmmoCounter", weaponCnt) SetMemoryPoolSize("BaseHint", 325) SetMemoryPoolSize("EnergyBar", weaponCnt) SetMemoryPoolSize("EntityCloth", 0) SetMemoryPoolSize("EntitySoundStatic", 43) SetMemoryPoolSize("Music", 99) SetMemoryPoolSize("Navigator", 100) SetMemoryPoolSize("Obstacle", 667) SetMemoryPoolSize("PathFollower", 100) SetMemoryPoolSize("PathNode", 256) SetMemoryPoolSize("SoldierAnimation", 382) SetMemoryPoolSize("SoundSpaceRegion", 96) SetMemoryPoolSize("TreeGridStack", 325) SetMemoryPoolSize("UnitAgent", 100) SetMemoryPoolSize("UnitController", 100) SetMemoryPoolSize("Weapon", weaponCnt) manager:Proc_ScriptInit_MemoryPoolInit() if not ScriptCB_InMultiplayer() then if ME5_SideVar >= 3 then print("EDNn_con: Injecting Alliance Soldier textures workaround...") ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\ME5\\GFX_EDN_Corpses.lvl") end end SetSpawnDelay(10.0, 0.25) -- Stormy variant if ME5_MapVarEDN == 1 then ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\ME5\\SKY\\spa_sky.lvl", "red") ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\ME5\\EDN.lvl", "EDN_conquest_red") SetDenseEnvironment("false") SetAIViewMultiplier(0.85) -- Cloudy variant elseif ME5_MapVarEDN == 2 then ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\ME5\\SKY\\spa_sky.lvl", "blue") ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\ME5\\EDN.lvl", "EDN_conquest_day") SetNumBirdTypes(1) SetBirdType(0,1.0,"bird") SetBirdFlockMinHeight(50); SetDenseEnvironment("false") SetAIViewMultiplier(0.9) -- Dusk variant elseif ME5_MapVarEDN == 3 then ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\ME5\\SKY\\spa_sky.lvl", "night") ReadDataFile("..\\..\\addon\\ME5\\data\\_LVL_PC\\ME5\\EDN.lvl", "EDN_conquest_night") SetDenseEnvironment("false") SetAIViewMultiplier(0.65) end -- Sound Stats OpenAudioStream("..\\..\\addon\\ME5\\data\\_LVL_PC\\Sound\\SFL_EDN_Streaming.lvl", "EDN_ambiance") manager:Proc_ScriptInit_MusicSetup() SoundFX() -- Camera Stats AddCameraShot(0.327342, 0.011198, -0.944287, 0.032303, -74.878967, 5.497213, -69.507790); -- tram station --AddCameraShot(0.335859, -0.053222, -0.928818, -0.147186, -74.092560, 6.867630, -67.068901); AddCameraShot(0.691021, -0.071285, 0.715514, 0.073812, 5.180315, 13.413967, 64.938232); -- rock arena AddCameraShot(0.890509, -0.062477, -0.449551, -0.031540, -103.704811, 15.089904, 28.269190); -- hillside AddCameraShot(0.609606, -0.055640, -0.787476, -0.071874, -108.782745, 17.936119, 58.947346); -- sharkteeth AddCameraShot(-0.288168, 0.029941, -0.951987, -0.098914, -10.234917, 8.470562, -24.091652); -- crate arena AddCameraShot(-0.000239, 0.000023, -0.995519, -0.094558, -1.801559, 5.236121, 14.380723); -- greenhouse manager:Proc_ScriptInit_End() end
local assert, setmetatable = assert, setmetatable return function(following, options) if not options.root_path then options.root_path = '/' end local r = options.router if not r then r = require 'routing.router' r = r.new { root_path=options.root_path, allow_path_override=options.allow_path_override } options.router = r end assert(r:add(options.urls)) return function(w, req) local handler, args = r:match_root(req.path) if not handler then return w:set_status_code(404) end req.route_args = args req.options = options handler = setmetatable({w = w, req = req}, handler) local m = req.method if m == 'GET' then m = handler.get elseif m == 'POST' then m = handler.post elseif m == 'PUT' then m = handler.put elseif m == 'DELETE' then m = handler.delete elseif m == 'PATCH' then m = handler.patch elseif m == 'HEAD' then m = handler.head elseif m == 'OPTIONS' then m = handler.options else return w:set_status_code(405) end if m then return m(handler) end return w:set_status_code(405) end end
--[[ Copyright (c) 2009 Peter "Corsix" Cawley 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 object = {} object.id = "cast_remover" object.thob = 24 object.research_category = "cure" object.research_fallback = 9 object.name = _S.object.cast_remover object.tooltip = _S.tooltip.objects.cast_remover object.ticks = false object.build_preview_animation = 5072 object.default_strength = 10 object.crashed_animation = 3388 object.show_in_town_map = true local function copy_north_to_south(t) t.south = t.north return t end object.idle_animations = copy_north_to_south { north = 2492, } object.walk_in_to_use = true -- This is only considered by use_object, not multi_use_object. object.usage_animations = copy_north_to_south { north = { in_use = {["Handyman"] = 3514}, }, } object.multi_usage_animations = { ["Alternate Male Patient - Nurse"] = copy_north_to_south { north = { begin_use = 2720, -- Patient invited onto machine begin_use_2 = 2696, -- Machine closes begin_use_3 = 2692, -- Nurse introduces the almighty black bucket in_use = 2688, -- The machine spits in the bucket finish_use = 3662, -- Nurse takes the bucket again (different tile than 3658!) finish_use_2 = 3658, -- The machine opens and the patient stands up }, }, ["Standard Female Patient - Nurse"] = copy_north_to_south { north = { begin_use = 4658, -- Patient invited onto machine begin_use_2 = 4666, -- Machine closes begin_use_3 = 4670, -- Nurse introduces the almighty black bucket in_use = 4674, -- The machine spits in the bucket finish_use = 5112, -- Nurse takes the bucket again finish_use_2 = 4682, -- The machine opens up and patient leaves }, }, } object.orientations = { north = { use_position = {0, 0}, handyman_position = {{0, -2}, {-1, -1}}, walk_in_tile = {0, -1}, use_position_secondary = {0, -1}, finish_use_position_secondary = {1, -1}, footprint = { {-1, -1, complete_cell = true}, {0, -1, only_passable = true}, {1, -1, only_passable = true}, {-1, 0, complete_cell = true}, {0, 0, only_passable = true, complete_cell = true}, {-1, 1, only_passable = true, need_west_side = true}, {-1, -2, only_passable = true, invisible = true, optional = true}, {-2, -1, only_passable = true, invisible = true, optional = true} }, list_bottom = true, render_attach_position = {-1, 1}, }, east = { use_position = {0, 0}, handyman_position = {{-1, -1}, {-2, 0}}, walk_in_tile = {-1, 0}, use_position_secondary = {-1, 0}, finish_use_position_secondary = {-1, 1}, footprint = { {-1, -1}, {0, -1, complete_cell = true}, {1, -1, only_passable = true, need_north_side = true}, {-1, 0, only_passable = true}, {0, 0, only_passable = true, complete_cell = true}, {-1, 1, only_passable = true}, {-2, -1, only_passable = true, invisible = true, optional = true}, {-1, -2, only_passable = true, invisible = true, optional = true} }, early_list = true, list_bottom = true, }, } local anim_mgr = TheApp.animation_manager anim_mgr:setMarker(object.idle_animations.north, {-1.6, -0.8}) return object
local array = {} local larray = require"iota.complex.array" local time = false array.new = larray.new local get = larray.get local set = larray.set array.inner = function(...) if TIME then time = os.clock() end local res = larray.inner(...) if TIME then TIME.inner = TIME.inner + (os.clock()-time) end if COUNT then COUNT.inner = COUNT.inner+1 end return res end array.xayb = function(x,a,y,b) if time then time = os.clock() end larray.xayb(x,a,y,b,false,false) if TIME then TIME.xayb = TIME.xayb + (os.clock()-time) end if COUNT then COUNT.xayb = COUNT.xayb+1 end end array.xcopy = function(x,a,y) if TIME then time = os.clock() end larray.xcopy(x,a,y,false) if TIME then TIME.xcopy = TIME.xcopy + (os.clock()-time) end if COUNT then COUNT.xcopy = COUNT.xcopy+1 end end array.print = function(a) for k=1,#a do print(string.format("%5d %10.6f %10.6fi",k,complex.real(get(a,k)),complex.imag(get(a,k)))) end end local mt = getmetatable(array.new(1)) mt.__index = function(a,k) return get(a,k) end mt.__newindex = function(a,k,v) set(a,k,v) end mt.__len = function(a) return larray.size(a) end return array
--[[ This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:29' using the latest game version. NOTE: This file should only be used as IDE support; it should NOT be distributed with addons! **************************************************************************** CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC. **************************************************************************** ]] function ZO_Pregame_CanSkipVideos() return GetCVar("HasPlayedPregameVideo") ~= "0" or ZO_IsConsoleOrHeronUI() end function ZO_Pregame_ShouldSkipVideos() -- only skip if the cvar is set, _and_ the player has seen the videos at least once return GetCVar("SkipPregameVideos") ~= "0" and ZO_Pregame_CanSkipVideos() end ZO_PREGAME_CHARACTER_COUNT = 0 ZO_PREGAME_FIRED_CHARACTER_CONSTRUCTION_READY = false ZO_PREGAME_CHARACTER_LIST_RECEIVED = false ZO_PREGAME_HAD_GLOBAL_ERROR = false local QUEUE_VIDEO = false local g_currentStateName = nil local g_currentStateData = nil local g_previousState = nil local g_loadingUpdates = false -- We don't want to show the video or the chapter upsell when we're logging out, only when we're logging in local shouldTryToPlayOpeningCinematic = false local shouldTryToShowChapterInterstitial = false function Pregame_ShowScene(sceneName) SCENE_MANAGER:Show(sceneName) ZO_Dialogs_ReleaseAllDialogsExcept("HANDLE_ERROR", "HANDLE_ERROR_WITH_HELP") end function AttemptQuickLaunch() if GetCVar("QuickLaunch") == "1" then local acctName = GetCVar("AccountName") local acctPwd = GetCVar("AccountPassword") if acctName ~= "" and acctPwd ~= "" then PregameLogin(acctName, acctPwd) end end end function AttemptToFireCharacterConstructionReady() if not ZO_PREGAME_FIRED_CHARACTER_CONSTRUCTION_READY and IsPregameCharacterConstructionReady() and ZO_PREGAME_CHARACTER_LIST_RECEIVED then ZO_PREGAME_FIRED_CHARACTER_CONSTRUCTION_READY = true CALLBACK_MANAGER:FireCallbacks("OnCharacterConstructionReady") end end local function PlayIntroCinematicAndAdvance() SetVideoCancelAllOnCancelAny(true) local videoDataId = GetOpeningCinematicVideoDataId() ZO_PlayVideoAndAdvance(PlayVideoById, videoDataId, QUEUE_VIDEO, VIDEO_SKIP_MODE_REQUIRE_CONFIRMATION_FOR_SKIP) end function ZO_PlayIntroCinematicAndReturn() SetVideoCancelAllOnCancelAny(true) local videoDataId = GetOpeningCinematicVideoDataId() ZO_PlayVideoAndReturn(PlayVideoById, videoDataId, QUEUE_VIDEO, VIDEO_SKIP_MODE_REQUIRE_CONFIRMATION_FOR_SKIP) end local g_sharedPregameStates = { ["CharacterSelect_FromIngame"] = { OnEnter = function() -- Let the character list receipt determine the state to go to. RequestCharacterList() end, OnExit = function() end }, ["PlayOpeningCinematic"] = { ShouldAdvance = function() return false end, OnEnter = function() PlayIntroCinematicAndAdvance() SCENE_MANAGER:ShowBaseScene() end, GetStateTransitionData = function() return "WaitForGameDataLoaded" end, OnExit = function() end, }, ["WaitForGameDataLoaded"] = { ShouldAdvance = function() return IsSystemLoaded(LOADING_SYSTEM_GAME_DATA) end, OnEnter = function() SuppressWorldList() RegisterForLoadingUpdates() -- Make sure we aren't showing a scene here if we -- didn't show the cinematic before switching to this scene SCENE_MANAGER:ShowBaseScene() end, OnExit = function() end, GetStateTransitionData = function() return "ChapterUpgradeInterstitial" end }, ["CharacterCreateFadeIn"] = { ShouldAdvance = function() return false end, OnEnter = function() ZO_CharacterCreate_FadeIn() end, GetStateTransitionData = function() return "CharacterCreate" end, OnExit = function() end, }, ["CharacterCreate"] = { OnEnter = function() ZO_CHARACTERCREATE_MANAGER:SetCharacterMode(CHARACTER_MODE_CREATION) local characterCreate = SYSTEMS:GetObject(ZO_CHARACTER_CREATE_SYSTEM_NAME) characterCreate:Reset() characterCreate:InitializeForCharacterCreate() if IsInGamepadPreferredMode() then Pregame_ShowScene("gamepadCharacterCreate") else Pregame_ShowScene("gameMenuCharacterCreate") -- PEGI update currently only needs to be shown on PC if DoesPlatformRequirePregamePEGI() and not HasAgreedToPEGI() then ZO_Dialogs_ShowDialog("PEGI_COUNTRY_SELECT") end end end, OnExit = function() ZO_Dialogs_ReleaseDialog("CHARACTER_CREATE_CREATING") SetCharacterCameraZoomAmount(-1) -- zoom all the way out when leaving this state end }, ["CharacterCreate_Barbershop"] = { OnEnter = function() if IsInGamepadPreferredMode() then Pregame_ShowScene("gamepadCharacterCreate") else Pregame_ShowScene("gameMenuCharacterCreate") end end, OnExit = function() ZO_Dialogs_ReleaseDialog("CHARACTER_CREATE_CREATING") SetCharacterCameraZoomAmount(-1) -- zoom all the way out when leaving this state end }, ["ChapterUpgrade"] = { ShouldAdvance = function() return false end, OnEnter = function() if IsInGamepadPreferredMode() then Pregame_ShowScene("chapterUpgradeGamepad") else Pregame_ShowScene("chapterUpgradeKeyboard") end end, GetStateTransitionData = function() return "CharacterSelect" end, OnExit = function() end, }, ["ChapterUpgradeInterstitial"] = { ShouldAdvance = function() if not shouldTryToShowChapterInterstitial then return true end return not CHAPTER_UPGRADE_MANAGER:ShouldShow() end, OnEnter = function() if IsInGamepadPreferredMode() then Pregame_ShowScene("chapterUpgradeGamepad") else Pregame_ShowScene("chapterUpgradeKeyboard") end end, GetStateTransitionData = function() return "WaitForCharacterDataLoaded" end, OnExit = function() end, }, ["WaitForCharacterDataLoaded"] = { ShouldAdvance = function() return IsPregameCharacterConstructionReady() end, OnEnter = function() end, GetStateTransitionData = function() if ZO_PREGAME_CHARACTER_COUNT > 0 then return "CharacterSelect" else return "CharacterCreateFadeIn" end end, OnExit = function() end, }, ["BeginLoadingIntoWorld"] = { OnEnter = function() if IsInGamepadPreferredMode() then ZO_CharacterSelect_Gamepad_ShowLoginScreen() else SCENE_MANAGER:ShowBaseScene() ZO_Dialogs_ShowDialog("REQUESTING_CHARACTER_LOAD") end end, OnExit = function() end }, ["ScreenAdjustIntro"] = { ShouldAdvance = function() return not IsConsoleUI() or GetCVar("PregameScreenAdjustEnabled") ~= "1" end, OnEnter = function() SCENE_MANAGER:Show("screenAdjust") SetCVar("PregameScreenAdjustEnabled", "false") end, OnExit = function() end, GetStateTransitionData = function() return "GammaAdjust" end, }, ["GammaAdjust"] = { ShouldAdvance = function() return not ZO_GammaAdjust_NeedsFirstSetup() end, OnEnter = function() SCENE_MANAGER:Show("gammaAdjust") end, OnExit = function() SetCVar("PregameGammaCheckEnabled", "false") end, GetStateTransitionData = function() if IsInGamepadPreferredMode() or not DoesPlatformSelectServer() then return "ShowEULA" else return "ServerSelectIntro" end end, }, ["PlayIntroMovies"] = { ShouldAdvance = function() return ZO_Pregame_ShouldSkipVideos() end, OnEnter = function() -- If you haven't played the videos, you can't skip them until they finish... local skipMode = ZO_Pregame_CanSkipVideos() and VIDEO_SKIP_MODE_ALLOW_SKIP or VIDEO_SKIP_MODE_NO_SKIP -- TODO: Determine if these videos need localization or subtitles... SetVideoCancelAllOnCancelAny(false) PlayVideo("Video/Bethesda_logo.bk2", QUEUE_VIDEO, skipMode) ZO_PlayVideoAndAdvance(PlayVideo, "Video/ZOS_logo.bk2", QUEUE_VIDEO, skipMode) end, GetStateTransitionData = function() return "ShowHavokSplashScreen" end, OnExit = function() end, }, ["ShowLegalSplashScreen"] = { ShouldAdvance = function() return ZO_Pregame_ShouldSkipVideos() end, OnEnter = function() SCENE_MANAGER:Show("copyrightLogosSplash") end, GetStateTransitionData = function() return "AccountLoginEntryPoint" end, OnExit = function() end, }, ["ShowHavokSplashScreen"] = { ShouldAdvance = function() return ZO_Pregame_ShouldSkipVideos() end, OnEnter = function() SimpleLogoSplash_ShowWithTexture("EsoUI/Art/Login/havok_logo.dds") end, GetStateTransitionData = function() return "ShowDMMVideo" end, OnExit = function() end, }, ["ShowDMMVideo"] = { ShouldAdvance = function() local serviceType = GetPlatformServiceType() return serviceType ~= PLATFORM_SERVICE_TYPE_DMM or ZO_Pregame_ShouldSkipVideos() end, OnEnter = function() local skipMode = ZO_Pregame_CanSkipVideos() and VIDEO_SKIP_MODE_ALLOW_SKIP or VIDEO_SKIP_MODE_NO_SKIP ZO_PlayVideoAndAdvance(PlayVideo, "Video/jp_DMM_logo.bk2", QUEUE_VIDEO, skipMode) end, GetStateTransitionData = function() -- The keyboard and gamepad flows begin to diverge here return "ShowLegalSplashScreen" end, OnExit = function() end, }, ["Disconnect"] = { OnEnter = function() SetCVar("QuickLaunch", "0") PregameDisconnect() end, OnExit = function () end, } } local g_keyboardPregameStates = {} function PregameStateManager_AddKeyboardStates(externalStates) for key, value in pairs(externalStates) do g_keyboardPregameStates[key] = value end end local g_gamepadPregameStates = {} function PregameStateManager_AddGamepadStates(externalStates) for key, value in pairs(externalStates) do g_gamepadPregameStates[key] = value end end function PregameStateManager_GetState(stateName) local state if IsInGamepadPreferredMode() then state = g_gamepadPregameStates[stateName] else state = g_keyboardPregameStates[stateName] end if not state then state = g_sharedPregameStates[stateName] end return state end function PregameStateManager_SetState(stateName, ...) local newPregameState = PregameStateManager_GetState(stateName) internalassert(newPregameState, "missing state for " .. stateName) local stateArgs = { ... } -- Because GetTransitionData returns the next state as the first argument, insert state name into this table. -- The actual arguments passed to OnEnter will be adjusted to account for it. table.insert(stateArgs, 1, stateName) if g_currentStateData then g_currentStateData.OnExit() end g_previousState = g_currentStateName local foundState = false while not foundState do g_currentStateName = stateName local shouldAdvance = (newPregameState.ShouldAdvance == nil) or newPregameState.ShouldAdvance() if shouldAdvance then if newPregameState and newPregameState.GetStateTransitionData then stateArgs = { newPregameState.GetStateTransitionData() } stateName = stateArgs[1] newPregameState = PregameStateManager_GetState(stateName) internalassert(newPregameState, "missing state for " .. stateName) else foundState = true end else foundState = true end end WriteToInterfaceLog(string.format("PregameStateManager_SetState - from: %s, to: %s", tostring(g_previousState), tostring(g_currentStateName))) g_currentStateData = newPregameState newPregameState.OnEnter(select(2, unpack(stateArgs))) CALLBACK_MANAGER:FireCallbacks("OnPregameEnterState", g_currentStateName) end function PregameStateManager_ReenterLoginState() if PregameStateManager_GetCurrentState() == "AccountLogin" then CALLBACK_MANAGER:FireCallbacks("OnPregameEnterState", "AccountLogin") else PregameStateManager_SetState("AccountLogin") end end function PregameStateManager_AdvanceState() local currentStateData = PregameStateManager_GetState(g_currentStateName) if currentStateData and currentStateData.GetStateTransitionData then PregameStateManager_SetState(currentStateData.GetStateTransitionData()) else -- If there are no transition data, then we're not going anywhere...we'll be locked in the current state. -- Do not call this if you're not on a state with transition data internalassert(false, string.format("Non-advancable state: %s", tostring(g_currentStateName))) end end -- this will only advance the state if we are currently in the state passed in function PregameStateManager_AdvanceStateFromState(state) if g_currentStateName == state then PregameStateManager_AdvanceState() end end function PregameStateManager_GetCurrentState() return g_currentStateName end function PregameStateManager_GetPreviousState() return g_previousState end local function OnCharacterListReceived(_, characterCount, maxCharacters, mostRecentlyPlayedCharacterId) ZO_PREGAME_CHARACTER_LIST_RECEIVED = true ZO_PREGAME_CHARACTER_COUNT = characterCount local isPlayingVideo = false if shouldTryToPlayOpeningCinematic then local openingCinematicSeen = GetCVar("OpeningCinematicSeen") == "1" if not openingCinematicSeen then SetCVar("OpeningCinematicSeen", 1) ZO_SavePlayerConsoleProfile() -- Play intro movie PregameStateManager_SetState("PlayOpeningCinematic") isPlayingVideo = true end end if not isPlayingVideo then -- Go to character create/select as necessary after we have our data -- If we are already at CharacterSelect when we get the character list, then we don't need to move -- This could happen when we rename or delete a character if PregameStateManager_GetCurrentState() ~= "CharacterSelect" then PregameStateManager_SetState("WaitForGameDataLoaded") -- If the data isn't fully loaded make sure we're registered for loading updates for things -- that depend on the "PregameFullyLoaded" callback. -- This can happen when we are returning to character select after being disconnected from the server if not PregameIsFullyLoaded() then RegisterForLoadingUpdates() end elseif characterCount == 0 then -- However, if we delete our last character then we need to switch to CharacterCreate -- so we can create a new character. We also want to avoid CharacterCreateFadeIn since -- that won't transition very nicely between CharacterSelect and CharacterCreate -- We are also assuming here that we already have character data since we were at character select PregameStateManager_SetState("CharacterCreate") end end -- if this hasn't been fired yet, then fire it (could have been a reload or coming from in-game) AttemptToFireCharacterConstructionReady() if DoesPlatformSupportDisablingShareFeatures() then -- re-enabled when the character list is loaded EnableShareFeatures() end end -- Debugging utility...you must be at character select already to use this. local function SetupUIReloadAfterLogin() RequestCharacterList() return "CharacterSelect" -- Return an invalid state, allow the character list receipt to figure out what state to advance to end local initialStateOverrideFn --= SetupUIReloadAfterLogin -- normally this is nil, it can be set to a custom function to allow the reload to drop into a desired state function UnregisterForLoadingUpdates() if g_loadingUpdates then EVENT_MANAGER:UnregisterForEvent("PregameStateManager", EVENT_AREA_LOAD_STARTED) EVENT_MANAGER:UnregisterForEvent("PregameStateManager", EVENT_SUBSYSTEM_LOAD_COMPLETE) EVENT_MANAGER:UnregisterForEvent("PregameStateManager", EVENT_LUA_ERROR) g_loadingUpdates = false end end local function OnAreaLoadStarted() ZO_Dialogs_ReleaseAllDialogs(true) end function IsPlayingChapterOpeningCinematic() return PregameStateManager_GetCurrentState() == "PlayOpeningCinematic" end function IsInCharacterSelectCinematicState() return PregameStateManager_GetCurrentState() == "CharacterSelect_PlayCinematic" end function IsInCharacterCreateState() return PregameStateManager_GetCurrentState() == "CharacterCreate" end local function OnCharacterSelected(_, characterId) PregameStateManager_SetState("BeginLoadingIntoWorld") end function PregameIsFullyLoaded() return GetNumLoadedSubsystems() == GetNumTotalSubsystemsToLoad() end function AttemptToAdvancePastChapterOpeningCinematic() if PregameIsFullyLoaded() then PregameStateManager_AdvanceStateFromState("PlayOpeningCinematic") end end function AttemptToAdvancePastCharacterSelectCinematic() if PregameIsFullyLoaded() then PregameStateManager_AdvanceStateFromState("CharacterSelect_PlayCinematic") end end local function OnSubsystemLoadComplete(_, subSystem) if subSystem == LOADING_SYSTEM_GAME_DATA or subSystem == LOADING_SYSTEM_SHARED_CHARACTER_OBJECT then AttemptToFireCharacterConstructionReady() -- LOADING_SYSTEM_GAME_DATA loads before LOADING_SYSTEM_SHARED_CHARACTER_OBJECT so if we hit either -- of those then the game data is loaded if subSystem == LOADING_SYSTEM_GAME_DATA then PregameStateManager_AdvanceStateFromState("WaitForGameDataLoaded") elseif subSystem == LOADING_SYSTEM_SHARED_CHARACTER_OBJECT then PregameStateManager_AdvanceStateFromState("WaitForCharacterDataLoaded") end end if PregameIsFullyLoaded() then if IsPlayingChapterOpeningCinematic() then AttemptToAdvancePastChapterOpeningCinematic() end CALLBACK_MANAGER:FireCallbacks("PregameFullyLoaded") UnregisterForLoadingUpdates() end end local function OnLuaErrorWhileLoading(_) -- Errors triggered during a loading screen will prevent some loading -- subsystems from completing, so the loading screen will never go away unless -- we do something. Let's immediately disconnect and bail back to the initial -- screen to handle this. We're calling lua code to handle errors in lua code, -- so we may still end up in the situation where our error recovery code never -- gets called, but the list of places where that could happen are very low; -- basically just this function. EVENT_MANAGER:UnregisterForEvent("PregameStateManager", EVENT_LUA_ERROR) ZO_PREGAME_HAD_GLOBAL_ERROR = true PregameDisconnectOnLuaError() end function RegisterForLoadingUpdates() if not g_loadingUpdates then EVENT_MANAGER:RegisterForEvent("PregameStateManager", EVENT_AREA_LOAD_STARTED, OnAreaLoadStarted) EVENT_MANAGER:RegisterForEvent("PregameStateManager", EVENT_SUBSYSTEM_LOAD_COMPLETE, OnSubsystemLoadComplete) EVENT_MANAGER:RegisterForEvent("PregameStateManager", EVENT_LUA_ERROR, OnLuaErrorWhileLoading) g_loadingUpdates = true end end local function OnShowPregameGuiInState(_, desiredState) SetGuiHidden("pregame", false) if initialStateOverrideFn then desiredState = initialStateOverrideFn() end if desiredState and desiredState ~= "" then PregameStateManager_SetState(desiredState, true) end end function PregameStateManager_PlayCharacter(charId, loadOption) if type(loadOption) == "string" then PregameStateManager_SetState(loadOption) else --We will need to revisit this once the tutorial gate is integrated into the build CALLBACK_MANAGER:FireCallbacks("OnCharacterLoadRequested") SelectCharacterForPlay(charId, loadOption) end end do local g_currentVideoPregameState = nil local function OnVideoPlaybackComplete() EVENT_MANAGER:UnregisterForEvent("ZO_PlayVideoAndAdvance", EVENT_VIDEO_PLAYBACK_COMPLETE) EVENT_MANAGER:UnregisterForEvent("ZO_PlayVideoAndAdvance", EVENT_VIDEO_PLAYBACK_ERROR) if not ZO_PREGAME_HAD_GLOBAL_ERROR then PregameStateManager_AdvanceStateFromState(g_currentVideoPregameState) end end function ZO_PlayVideoAndAdvance(playVideoFunction, ...) g_currentVideoPregameState = PregameStateManager_GetCurrentState() EVENT_MANAGER:RegisterForEvent("ZO_PlayVideoAndAdvance", EVENT_VIDEO_PLAYBACK_COMPLETE, OnVideoPlaybackComplete) EVENT_MANAGER:RegisterForEvent("ZO_PlayVideoAndAdvance", EVENT_VIDEO_PLAYBACK_ERROR, OnVideoPlaybackComplete) playVideoFunction(...) end end do local g_wasVideoStartedInGamepadPreferredMode = false local function OnVideoPlaybackComplete() EVENT_MANAGER:UnregisterForEvent("ZO_PlayVideoAndReturn", EVENT_VIDEO_PLAYBACK_COMPLETE) EVENT_MANAGER:UnregisterForEvent("ZO_PlayVideoAndReturn", EVENT_VIDEO_PLAYBACK_ERROR) if g_wasVideoStartedInGamepadPreferredMode ~= IsInGamepadPreferredMode() then -- The gamepad preferred mode changed event is supressed during while the video is playing, let's bring it back now ZO_Pregame_OnGamepadPreferredModeChanged() end end function ZO_PlayVideoAndReturn(playVideoFunction, ...) g_wasVideoStartedInGamepadPreferredMode = IsInGamepadPreferredMode() EVENT_MANAGER:RegisterForEvent("ZO_PlayVideoAndReturn", EVENT_VIDEO_PLAYBACK_COMPLETE, OnVideoPlaybackComplete) EVENT_MANAGER:RegisterForEvent("ZO_PlayVideoAndReturn", EVENT_VIDEO_PLAYBACK_ERROR, OnVideoPlaybackComplete) playVideoFunction(...) end end function PregameStateManager_ClearError() ZO_PREGAME_HAD_GLOBAL_ERROR = false end local function OnDisplayNameReady() shouldTryToPlayOpeningCinematic = true shouldTryToShowChapterInterstitial = true end function ZO_Pregame_DisplayServerDisconnectedError() if not IsErrorQueuedFromIngame() then return end local logoutError, globalErrorCode = GetErrorQueuedFromIngame() ZO_PREGAME_HAD_GLOBAL_ERROR = true local errorString local errorStringFormat if logoutError ~= LOGOUT_ERROR_NO_ERROR and logoutError ~= LOGOUT_ERROR_UNKNOWN_ERROR and logoutError ~= LOGOUT_ERROR_TRANSFER_FAILED then errorStringFormat = GetString("SI_LOGOUTERROR", logoutError) if errorStringFormat ~= "" then errorString = zo_strformat(errorStringFormat, GetGameURL()) end elseif globalErrorCode ~= GLOBAL_ERROR_CODE_NO_ERROR then -- if the error code is not in LogoutReason then it is probably in the GlobalErrorCode enum errorStringFormat = GetString("SI_GLOBALERRORCODE", globalErrorCode) if errorStringFormat ~= "" then errorString = zo_strformat(errorStringFormat, globalErrorCode) end end if errorString == nil or errorString == "" then if IsInGamepadPreferredMode() then errorString = zo_strformat(SI_UNEXPECTED_ERROR, GetString(SI_HELP_URL)) else errorString = GetString(SI_UNKNOWN_ERROR) end end local shouldReenterLoginState = true if logoutError == LOGOUT_ERROR_TRANSFER_FAILED then shouldReenterLoginState = false end if IsInGamepadPreferredMode() then if shouldReenterLoginState then -- Showing the error here also sets the state to AccountLogin PREGAME_INITIAL_SCREEN_GAMEPAD:ShowError(nil, errorString) end else if shouldReenterLoginState then PregameStateManager_ReenterLoginState() end ZO_Dialogs_ShowDialog("HANDLE_ERROR", nil, {mainTextParams = {errorString}}) end end local function OnDisconnectedFromServer() ZO_Dialogs_ReleaseAllDialogsExcept("HANDLE_ERROR", "HANDLE_ERROR_WITH_HELP") ZO_Pregame_DisplayServerDisconnectedError() local NUM_FLASHES_BEFORE_SOLID = 7 FlashTaskbarWindow("DISCONNECTED", NUM_FLASHES_BEFORE_SOLID) end local IS_WORLD_SELECT_STATE = ZO_CreateSetFromArguments("WorldSelect_Requested", "WorldSelect_ShowList", "WorldSelect") function ZO_Pregame_OnGamepadPreferredModeChanged() local currentState = PregameStateManager_GetCurrentState() if currentState == nil then -- The initial state has not been set up yet, let's wait for that return end if IsAnyVideoPlaying() then -- Allow the video to finish. All states that play a video should be -- able to be used in either keyboard or gamepad flows, to properly -- shuffle the player on to the next state return end if currentState == "GammaAdjust" then -- switching between kb/gamepad will be handled by platform style -- TODO: for ingame scenes, we can use the -- SetHandleGamepadPreferredModeChangedCallback to preempt any UI mode -- switching. ideally we could do the same for pregame scenes, so we could -- share code between the two return end local FORCE_CLOSE = true ZO_Dialogs_ReleaseAllDialogs(FORCE_CLOSE) if not IsAccountLoggedIn() or IS_WORLD_SELECT_STATE[currentState] then -- While in world select, we're logged in but haven't yet started the character loading process PregameStateManager_SetState("AccountLoginEntryPoint") elseif not IsPregameCharacterConstructionReady() then PregameStateManager_SetState("WaitForCharacterDataLoaded") elseif PregameStateManager_GetCurrentState() == "CharacterCreate" or GetNumCharacters() == 0 then PregameStateManager_SetState("CharacterCreate") else local wasLoadingIntoWorld = PregameStateManager_GetCurrentState() == "BeginLoadingIntoWorld" MoveCameraToCurrentCharacter() PregameStateManager_SetState("CharacterSelect") if wasLoadingIntoWorld then -- pop up the loading dialog. -- this needs to happen as a transition from character select so the input-appropriate version of that scene is visible in the background PregameStateManager_SetState("BeginLoadingIntoWorld") end end end function ZO_RegisterForSavedVars(systemName, version, defaults, callback) local function OnReady() local savedVars = ZO_SavedVars:NewAccountWide("ZO_Pregame_SavedVariables", version, systemName, defaults) callback(savedVars) end local function OnAddonLoaded(_, name) if name == "ZO_Pregame" then EVENT_MANAGER:UnregisterForEvent(systemName, EVENT_ADD_ON_LOADED) if IsAccountLoggedIn() then OnReady() end end end EVENT_MANAGER:RegisterForEvent(systemName, EVENT_ADD_ON_LOADED, OnAddonLoaded) -- Every time we log in, we need a new saved vars for that account EVENT_MANAGER:RegisterForEvent(systemName, EVENT_DISPLAY_NAME_READY, OnReady) end EVENT_MANAGER:RegisterForEvent("PregameStateManager", EVENT_DISPLAY_NAME_READY, OnDisplayNameReady) EVENT_MANAGER:RegisterForEvent("PregameStateManager", EVENT_CHARACTER_LIST_RECEIVED, OnCharacterListReceived) EVENT_MANAGER:RegisterForEvent("PregameStateManager", EVENT_SHOW_PREGAME_GUI_IN_STATE, OnShowPregameGuiInState) EVENT_MANAGER:RegisterForEvent("PregameStateManager", EVENT_CHARACTER_SELECTED_FOR_PLAY, OnCharacterSelected) EVENT_MANAGER:RegisterForEvent("PregameStateManager", EVENT_GAMEPAD_PREFERRED_MODE_CHANGED, ZO_Pregame_OnGamepadPreferredModeChanged) EVENT_MANAGER:RegisterForEvent("PregameStateManager", EVENT_DISCONNECTED_FROM_SERVER, OnDisconnectedFromServer)
local skynet = require "skynet" require "skynet.manager" skynet.start(function() --[[ 发送lua类型的消息给service,发送成功,该函数将阻塞等待响应返回,r的值为响应的返回值 ]] skynet.register ".testcallmsg" local r = skynet.call(".testluamsg", "lua", 1, "Twitter", true) skynet.error("skynet.call return value:", r) --[[ 通过skynet.pack来打包发送,返回的值也需要自己解包 ]] local msg, sz = skynet.pack(skynet.pack(2, "Twitter", false)) r = skynet.unpack(skynet.rawcall(".testluamsg", "lua", msg, sz)) skynet.error("skynet.rawcall return value:", r) end)
-- Copyright (c) 2019 Redfern, Trevor <trevorredfern@gmail.com> -- -- This software is released under the MIT License. -- https://opensource.org/licenses/MIT return setmetatable({ hot_keys = {}, key_down = {}, hotkey = function(self, key, callback) self.hot_keys[key] = callback end, reset = function(self) self.hot_keys = {} self.key_down = {} end, update = function(self) for k, v in pairs(self.hot_keys) do if self.isDown(k) then if not self.key_down[k] then v() self.key_down[k] = true end else self.key_down[k] = nil end end end },{ __index = love.keyboard })
--[[ /**********************************************************\ | | | hprose | | | | Official WebSite: http://www.hprose.com/ | | http://www.hprose.org/ | | | \**********************************************************/ /**********************************************************\ * * * hprose/date.lua * * * * hprose Date for Lua * * * * LastModified: Jun 19, 2015 * * Author: Ma Bingyao <andot@hprose.com> * * * \**********************************************************/ --]] local date = require('date') local dobj = getmetatable(date()) local pack = table.pack or function(...) return { n = select('#', ...), ... } end local date_call = date.__call local dobj_toutc = dobj.toutc local dobj_tolocal = dobj.tolocal local dobj_copy = dobj.copy function date:__call(...) local arg = pack(...) local o = date_call(self, ...) if arg.n == 0 then o.utc = false elseif arg.n == 1 then if type(arg[1]) == "boolean" then o.utc = arg[1] elseif type(arg[1]) == "table" then o.utc = arg[1].utc and true or false end elseif arg.n == 4 then if type(arg[4]) == "boolean" then o.utc = arg[4] else o.utc = false end elseif arg.n == 7 then if type(arg[7]) == "boolean" then o.utc = arg[7] else o.utc = false end elseif arg.n == 8 then if type(arg[8]) == "boolean" then o.utc = arg[8] else o.utc = false end end return o end function dobj:tolocal() if self.utc then dobj_tolocal(self) self.utc = false end return self end function dobj:toutc() if not self.utc then dobj_toutc(self) self.utc = true end return self end function dobj:copy() local o = dobj_copy(self) o.utc = self.utc return o end return date
return function() local tt = tmr.create() table.insert(timers, tt) local ii = 0 tt:alarm(30, tmr.ALARM_AUTO, function() if (ii/200)%3 == 0 then color = string.char(255,0,0) elseif (ii/200)%3 == 1 then color = string.char(255,100,0) else color = string.char(0,255,0) end buf:shift(1) buf:set(1, 0, 0, 0) buf:set(2, color) ws2812.write(buf) ii = ii + 1 end) end
local Utils = BeardLib.Utils local XML = Utils.XML or {} Utils.XML = XML --Finds a node from table 'tbl' with 'meta' as the name of the meta. function XML:GetNode(tbl, meta) if not tbl then return nil end for _, v in pairs(tbl) do if type(v) == "table" and v._meta == meta then return v end end return false end --Same as GetNode but allows you to find the node like this: node/a/b/c function XML:FindNode(tbl, metas) if not tbl then return nil end local splt = metas:split("/") local meta = splt[1] for _, v in pairs(tbl) do if type(v) == "table" and v._meta == meta then if splt[2] then self:FindNode(table.concat(splt, 2)) else return v end end end return false end --Finds a node and replaces it with 'new_node' function XML:SetNode(tbl, node, new_node) if not tbl then return nil end for i, v in pairs(tbl) do if type(v) == "table" and v == node then tbl[i] = new_node end end end function XML:SetNodeMeta(tbl, meta, new_node) if not tbl then return nil end for i, v in pairs(tbl) do if type(v) == "table" and v._meta == meta then tbl[i] = new_node end end end --Same as GetNode but packs every node it finds. function XML:GetNodes(tbl, meta) if not tbl then return nil end local t = {} for _, v in pairs(tbl) do if type(v) == "table" and v._meta == meta then table.insert(t, v) end end return t end --Gets index of node function XML:GetNodeIndex(tbl, node) if not tbl then return nil end for i, v in pairs(tbl) do if v == node then return i end end end --Gets first index of meta function XML:GetIndexMeta(tbl, meta) if not tbl then return nil end for i, v in pairs(tbl) do if type(v) == "table" and v._meta == meta then return i end end end --Same as GetMetaIndex but packs every result. function XML:GetMetaIndices(tbl, meta) if not tbl then return nil end local t = {} for i, v in pairs(tbl) do if type(v) == "table" and v._meta == meta then table.insert(t, i) end end return t end --Removes key tables from the table function XML:CleanKeys(tbl, shallow) if not tbl then return nil end for i, v in pairs(tbl) do if type(v) == "table" then if tonumber(i) == nil then tbl[i] = nil elseif not shallow then self:CleanKeys(v, shallow) end end end return tbl end --Removes indices from the table entirely. function XML:CleanIndices(tbl, shallow) if not tbl then return nil end for i, v in pairs(tbl) do if type(v) == "table" then if tonumber(i) ~= nil then tbl[i] = nil elseif not shallow then self:CleanIndices(v, shallow) end end end return tbl end --Removes keys only if the table contains at least two indices of the same meta. --Removes indices if only one of the same meta as the key exists. --In other words, makes sure that when you save the XML it won't duplicate shit. function XML:Clean(tbl, shallow) if not tbl then return nil end --Pack all keys local keys = {} for k, v in pairs(tbl) do if type(v) == "table" and not tonumber(k) then keys[k] = true end end --If key has two tables of the same meta remove key. local single_node = {} local multi_nodes = {} for k, v in pairs(tbl) do if type(v) == "table" and tonumber(k) then local meta = v._meta if single_node[meta] then single_node[meta] = nil keys[meta] = nil tbl[meta] = nil elseif keys[meta] then single_node[meta] = k end multi_nodes[k] = v end end --Remove duplicate of the key if only one exists. for meta, i in pairs(single_node) do tbl[i] = nil multi_nodes[i] = nil end --fix indices so it's saved to the XML. --first remove old indices so we won't overwrite any that were done before. for k, v in pairs(multi_nodes) do tbl[k] = nil end local i = 1 for k, v in pairs(multi_nodes) do tbl[i] = v i = i + 1 end --to avoid going through tables that are going to be removed we loop again. for k, v in pairs(tbl) do if type(v) == "table" and not shallow then self:Clean(v, shallow) end end return tbl end --Inserts a node properly so script serializer won't think the key and first index are the same thing. function XML:InsertNode(tbl, node) local nodes = self:GetMetaIndices(tbl, node._meta) for _, k in pairs(nodes) do if #nodes == 1 and tonumber(k) == nil then table.insert(tbl, tbl[k]) tbl[k] = nil end end table.insert(tbl, node) end --allows both key and index to be removed, useful for tables cleaned by XML:Clean function table.remove_key(tbl, key) if type(key) == "number" and #tbl >= key then table.remove(tbl, key) else tbl[key] = nil end end --like table delete only allows key values(doesn't force table.remove which accepts only indices) function table.delete_value(tbl, value) local key = table.get_key(tbl, value) if key then table.remove_key(tbl, key) end end
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Fubruhn -- Mog Locker NPC -- -- Event IDs: -- 600 = Not a mercenary + mog locker options -- 1st arg = Amount of time left on lease, as seconds past 2001/12/31 15:00:00. -- If this is 0, it shows the not a mecenary message instead. -- If this is -1, it shows the lease as expired. -- 2nd arg = Valid areas, 0=alzahbi only, 1=all areas -- 3rd arg = The number of earth days a lease extension is valid for (7) -- 4th arg = How big your locker is -- 5th arg = -- 6th arg = -- 7th arg = -- 8th arg = The number of days your lease is currently valid for -- -- 601 = Lease increased -- 1st arg = number of seconds from 2001/12/31 15:00:00 it is valid till. -- -- 602 = Expansion increased -- 4th arg = new size of locker ----------------------------------- require("scripts/globals/settings") require("scripts/globals/quests") require("scripts/globals/status") require("scripts/globals/missions") require("scripts/globals/moghouse") function getNumberOfCoinsToUpgradeSize(size) if size == 30 then return 4 elseif size == 40 then return 2 elseif size == 50 then return 3 elseif size == 60 then return 5 elseif size == 70 then return 10 elseif size == 80 then return 0 end end function onTrade(player, npc, trade) local numBronze = trade:getItemQty(2184) local numMythril = trade:getItemQty(2186) local numGold = trade:getItemQty(2187) if player:getCurrentMission(TOAU) >= tpz.mission.id.toau.PRESIDENT_SALAHEEM then if numBronze > 0 and numMythril == 0 and numGold == 0 then if addMogLockerExpiryTime(player, numBronze) then -- remove bronze player:tradeComplete() -- send event player:startEvent(601, getMogLockerExpiryTimestamp(player)) -- print("Expanded lease with "..numBronze.." bronze.") end elseif numGold > 0 or numMythril > 0 then -- see if we can expand the size local slotSize = player:getContainerSize(tpz.inv.MOGLOCKER) if slotSize == 30 and numMythril == 4 and numGold == 0 then player:changeContainerSize(tpz.inv.MOGLOCKER, 10) player:tradeComplete() player:startEvent(602, 0, 0, 0, 40) elseif slotSize == 40 and numMythril == 0 and numGold == 2 then player:changeContainerSize(tpz.inv.MOGLOCKER, 10) player:tradeComplete() player:startEvent(602, 0, 0, 0, 50) elseif slotSize == 50 and numMythril == 0 and numGold == 3 then player:changeContainerSize(tpz.inv.MOGLOCKER, 10) player:tradeComplete() player:startEvent(602, 0, 0, 0, 60) elseif slotSize == 60 and numMythril == 0 and numGold == 5 then player:changeContainerSize(tpz.inv.MOGLOCKER, 10) player:tradeComplete() player:startEvent(602, 0, 0, 0, 70) elseif slotSize == 70 and numMythril == 0 and numGold == 10 then player:changeContainerSize(tpz.inv.MOGLOCKER, 10) player:tradeComplete() player:startEvent(602, 0, 0, 0, 80) end end end end function onTrigger(player, npc) -- TODO: Check if they are >= Mission 2 -- if < mission 2 then -- player:startEvent(600) -- else if player:getCurrentMission(TOAU) >= tpz.mission.id.toau.PRESIDENT_SALAHEEM then local accessType = getMogLockerAccessType(player) local mogLockerExpiryTimestamp = getMogLockerExpiryTimestamp(player) if mogLockerExpiryTimestamp == nil then -- a nil timestamp means they haven't unlocked it yet. We're going to unlock it by merely talking to this NPC. --print("Unlocking mog locker for "..player:getName()) mogLockerExpiryTimestamp = unlockMogLocker(player) accessType = setMogLockerAccessType(player, MOGLOCKER_ACCESS_TYPE_ALLAREAS) end player:startEvent(600, mogLockerExpiryTimestamp, accessType, MOGLOCKER_ALZAHBI_VALID_DAYS, player:getContainerSize(tpz.inv.MOGLOCKER), getNumberOfCoinsToUpgradeSize(player:getContainerSize(tpz.inv.MOGLOCKER)), 2, 3, MOGLOCKER_ALLAREAS_VALID_DAYS) else player:startEvent(600) end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) -- printf("fCSID: %u", csid) -- printf("fRESULT: %u", option) if csid == 600 and option == 3 then local accessType = player:getCharVar(MOGLOCKER_PLAYERVAR_ACCESS_TYPE) if accessType == MOGLOCKER_ACCESS_TYPE_ALLAREAS then -- they want to restrict their access to alzahbi only setMogLockerAccessType(player, MOGLOCKER_ACCESS_TYPE_ALZAHBI) elseif accessType == MOGLOCKER_ACCESS_TYPE_ALZAHBI then -- they want to expand their access to all areas. setMogLockerAccessType(player, MOGLOCKER_ACCESS_TYPE_ALLAREAS) else print("Unknown mog locker access type: "..accessType) end end end
--!A cross-platform build utility based on Lua -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- Copyright (C) 2015-2020, TBOOX Open Source Group. -- -- @author ruki -- @file choicebox.lua -- -- load modules local log = require("ui/log") local view = require("ui/view") local rect = require("ui/rect") local panel = require("ui/panel") local event = require("ui/event") local action = require("ui/action") local curses = require("ui/curses") local button = require("ui/button") local object = require("ui/object") -- define module local choicebox = choicebox or panel() -- init choicebox function choicebox:init(name, bounds) -- init panel panel.init(self, name, bounds) -- init values self._VALUES = {} end -- on event function choicebox:on_event(e) -- select config if e.type == event.ev_keyboard then if e.key_name == "Down" then return self:select_next() elseif e.key_name == "Up" then return self:select_prev() elseif e.key_name == "Enter" or e.key_name == " " then self:_do_select() return true end elseif e.type == event.ev_command and e.command == "cm_enter" then self:_do_select() return true end end -- load values function choicebox:load(values, selected) -- clear the views first self:clear() -- insert values self._VALUES = values for idx, value in ipairs(values) do self:_do_insert(value, idx, idx == selected) end -- select the first item self:select(self:first()) -- invalidate self:invalidate() end -- do insert a value item function choicebox:_do_insert(value, index, selected) -- init text local text = (selected and "(X) " or "( ) ") .. tostring(value) -- init a value item view local item = button:new("choicebox.value." .. self:count(), rect:new(0, self:count(), self:width(), 1), text) -- attach this index item:extra_set("index", index) -- insert this config item self:insert(item) end -- do select the current config function choicebox:_do_select() -- clear selected text for v in self:views() do local text = v:text() if text and text:startswith("(X) ") then local i = v:extra("index") if i then local t = self._VALUES[i] v:text_set("( ) " .. tostring(t)) end end end -- get the current item local item = self:current() -- get the current index local index = item:extra("index") -- get the current value local value = self._VALUES[index] -- do action: on selected self:action_on(action.ac_on_selected, index, value) -- update text item:text_set("(X) " .. tostring(value)) end -- return module return choicebox
object_mobile_admiral_sait = object_mobile_shared_admiral_sait:new { } ObjectTemplates:addTemplate(object_mobile_admiral_sait, "object/mobile/admiral_sait.iff")
---------------------------------------------------------------------------------- -- -- scenetemplate.lua -- ---------------------------------------------------------------------------------- local storyboard = require( "storyboard" ) local scene = storyboard.newScene() ---------------------------------------------------------------------------------- -- -- NOTE: -- -- Code outside of listener functions (below) will only be executed once, -- unless storyboard.removeScene() is called. -- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -- BEGINNING OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- -- Called when the scene's view does not exist: function scene:createScene( event ) local group = self.view ----------------------------------------------------------------------------- -- CREATE display objects and add them to 'group' here. -- Example use-case: Restore 'group' from previously saved state. ----------------------------------------------------------------------------- end -- Called immediately after scene has moved onscreen: function scene:enterScene( event ) local group = self.view ----------------------------------------------------------------------------- -- INSERT code here (e.g. start timers, load audio, start listeners, etc.) ----------------------------------------------------------------------------- end -- Called when scene is about to move offscreen: function scene:exitScene( event ) local group = self.view ----------------------------------------------------------------------------- -- INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.) ----------------------------------------------------------------------------- end -- Called prior to the removal of scene's "view" (display group) function scene:destroyScene( event ) local group = self.view ----------------------------------------------------------------------------- -- INSERT code here (e.g. remove listeners, widgets, save state, etc.) ----------------------------------------------------------------------------- end --------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- -- "createScene" event is dispatched if scene's view does not exist scene:addEventListener( "createScene", scene ) -- "enterScene" event is dispatched whenever scene transition has finished scene:addEventListener( "enterScene", scene ) -- "exitScene" event is dispatched before next scene's transition begins scene:addEventListener( "exitScene", scene ) -- "destroyScene" event is dispatched before view is unloaded, which can be -- automatically unloaded in low memory situations, or explicitly via a call to -- storyboard.purgeScene() or storyboard.removeScene(). scene:addEventListener( "destroyScene", scene ) --------------------------------------------------------------------------------- return scene
local function openInventory( element, ax, ay ) triggerEvent( "subscribeToInventoryChanges", source, element ) triggerClientEvent( source, "openElementInventory", element, ax, ay ) end addEvent( "openFreakinInventory", true ) addEventHandler( "openFreakinInventory", getRootElement(), openInventory ) -- local function closeInventory( element ) triggerEvent( "unsubscribeFromInventoryChanges", source, element ) end addEvent( "closeFreakinInventory", true ) addEventHandler( "closeFreakinInventory", getRootElement(), closeInventory ) -- local function moveToElement( element, slot, ammo ) if not hasSpaceForItem( element ) then outputChatBox( "The Inventory is full.", source, 255, 0, 0 ) else if not ammo then local item = getItems( source )[ slot ] if item then if getElementType( element ) == "object" then -- safe if ( item[1] == 4 or item[1] == 5 ) and getElementDimension( element ) == item[2] then -- keys to that safe as well if countItems( source, item[1], item[2] ) < 2 then outputChatBox("You can't place your only key to that safe in the safe.", source, 255, 0, 0) return end end end moveItem( source, element, slot ) end else local name = "Safe" if getElementType( element ) == "vehicle" then name = "Vehicle" end if slot == 16 or slot == 18 or ( slot >= 35 and slot <= 40 ) then outputChatBox("You can't put those weapons into a " .. name .. ".", source, 255, 0, 0) elseif tonumber(getElementData(source, "duty")) > 0 then outputChatBox("You can't put your weapons in a " .. name .. " while being on duty.", source, 255, 0, 0) elseif tonumber(getElementData(source, "job")) == 4 and slot == 41 then outputChatBox("You can't put this spray can into a " .. name .. ".", source, 255, 0, 0) else exports.global:takeWeapon( source, slot ) giveItem( element, -slot, ammo ) end end end end addEvent( "moveToElement", true ) addEventHandler( "moveToElement", getRootElement(), moveToElement ) local function moveFromElement( element, slot, ammo ) local item = getItems( element )[slot] if item then if item[1] > 0 then moveItem( element, source, slot ) else takeItemFromSlot( element, slot ) if ammo < item[2] then exports.global:giveWeapon( source, -item[1], ammo ) giveItem( element, item[1], item[2] - ammo ) else exports.global:giveWeapon( source, -item[1], item[2] ) end triggerClientEvent( source, "forceElementMoveUpdate", source ) end end end addEvent( "moveFromElement", true ) addEventHandler( "moveFromElement", getRootElement(), moveFromElement )
--[[ ############################################################################## S V U I By: Failcoder ############################################################################## --]] --[[ GLOBALS ]]-- local _G = _G; local unpack = _G.unpack; local select = _G.select; local string = _G.string; local math = _G.math; local table = _G.table; --[[ STRING METHODS ]]-- local format, join, gsub = string.format, string.join, string.gsub; --[[ MATH METHODS ]]-- local ceil = math.ceil; -- Basic --[[ ADDON ]]-- local SV = _G['SVUI']; local L = SV.L; local MOD = SV.Skins; local Schema = MOD.Schema; --[[ ########################################################## FRAME LISTS ########################################################## ]]-- local CHAT_CONFIG_CHANNEL_LIST = _G.CHAT_CONFIG_CHANNEL_LIST; local CHANNELS = _G.CHANNELS; local ChatMenuList = { "ChatMenu", "EmoteMenu", "LanguageMenu", "VoiceMacroMenu", }; local ChatFrameWipeList = { "ChatConfigFrame", "ChatConfigBackgroundFrame", "ChatConfigCategoryFrame", --"ChatConfigChatSettingsClassColorLegend", "ChatConfigChatSettingsLeft", "ChatConfigChannelSettingsLeft", --"ChatConfigChannelSettingsClassColorLegend", "ChatConfigOtherSettingsCombat", "ChatConfigOtherSettingsPVP", "ChatConfigOtherSettingsSystem", "ChatConfigOtherSettingsCreature", "ChatConfigCombatSettingsFilters", "CombatConfigMessageSourcesDoneBy", "CombatConfigMessageSourcesDoneTo", "CombatConfigColorsUnitColors", --"CombatConfigColorsHighlighting", "CombatConfigColorsColorizeUnitNameCheck", "CombatConfigColorsColorizeSpellNamesCheck", "CombatConfigColorsColorizeDamageNumberCheck", "CombatConfigColorsColorizeDamageSchoolCheck", "CombatConfigColorsColorizeEntireLineCheck", "ChatConfigFrameDefaultButton", "ChatConfigFrameRedockButton", "ChatConfigFrameOkayButton", "CombatLogDefaultButton", "ChatConfigCombatSettingsFiltersCopyFilterButton", "ChatConfigCombatSettingsFiltersAddFilterButton", "ChatConfigCombatSettingsFiltersDeleteButton", "CombatConfigSettingsSaveButton", "ChatConfigFrameCancelButton", "ChatConfigCategoryFrame", "ChatConfigBackgroundFrame", --"ChatConfigChatSettingsClassColorLegend", --"ChatConfigChannelSettingsClassColorLegend", "ChatConfigCombatSettingsFilters", "ChatConfigCombatSettingsFiltersScrollFrame", "CombatConfigColorsHighlighting", "CombatConfigColorsColorizeUnitName", "CombatConfigColorsColorizeSpellNames", "CombatConfigColorsColorizeDamageNumber", "CombatConfigColorsColorizeDamageSchool", "CombatConfigColorsColorizeEntireLine", "ChatConfigChatSettingsLeft", "ChatConfigOtherSettingsCombat", "ChatConfigOtherSettingsPVP", "ChatConfigOtherSettingsSystem", "ChatConfigOtherSettingsCreature", "ChatConfigChannelSettingsLeft", "CombatConfigMessageSourcesDoneBy", "CombatConfigMessageSourcesDoneTo", "CombatConfigColorsUnitColors", }; local ChatFrameList4 = { "CombatConfigColorsColorizeSpellNames", "CombatConfigColorsColorizeDamageNumber", "CombatConfigColorsColorizeDamageSchool", "CombatConfigColorsColorizeEntireLine", }; local ChatFrameList5 = { "ChatConfigFrameOkayButton", "ChatConfigFrameDefaultButton", "ChatConfigFrameRedockButton", "CombatLogDefaultButton", "ChatConfigCombatSettingsFiltersDeleteButton", "ChatConfigCombatSettingsFiltersAddFilterButton", "ChatConfigCombatSettingsFiltersCopyFilterButton", "CombatConfigSettingsSaveButton", }; local ChatFrameList6 = { "CombatConfigColorsHighlightingLine", "CombatConfigColorsHighlightingAbility", "CombatConfigColorsHighlightingDamage", "CombatConfigColorsHighlightingSchool", "CombatConfigColorsColorizeUnitNameCheck", "CombatConfigColorsColorizeSpellNamesCheck", "CombatConfigColorsColorizeSpellNamesSchoolColoring", "CombatConfigColorsColorizeDamageNumberCheck", "CombatConfigColorsColorizeDamageNumberSchoolColoring", "CombatConfigColorsColorizeDamageSchoolCheck", "CombatConfigColorsColorizeEntireLineCheck", "CombatConfigFormattingShowTimeStamp", "CombatConfigFormattingShowBraces", "CombatConfigFormattingUnitNames", "CombatConfigFormattingSpellNames", "CombatConfigFormattingItemNames", "CombatConfigFormattingFullText", "CombatConfigSettingsShowQuickButton", "CombatConfigSettingsSolo", "CombatConfigSettingsParty", "CombatConfigSettingsRaid", }; --[[ ########################################################## HELPERS ########################################################## ]]-- local ChatGeneric_OnShow = function(self) if(not self.Panel) then self:SetStyle("Frame", "Window") end end local ChatMenu_OnShow = function(self) if(not self.Panel) then self:SetStyle("Frame", "Window") end self:ClearAllPoints() self:SetPoint("BOTTOMLEFT", ChatFrame1, "TOPLEFT", 0, 30) end local _hook_ChatConfig_UpdateCheckboxes = function(frame) if (not FCF_GetCurrentChatFrame()) then return; end local checkBoxTable = frame.checkBoxTable; local checkBoxNameString = frame:GetName().."CheckBox"; local boxHeight = 20 local colorsHeight = 20 local checkbox, baseName; for index, value in ipairs(checkBoxTable) do baseName = checkBoxNameString..index; checkbox = _G[baseName.."Check"]; if(checkbox) then if(not checkbox.Panel) then checkbox:RemoveTextures() checkbox:SetStyle("Frame", 'Transparent') end checkbox:SetHeight(boxHeight) checkbox.Panel:SetPoint("TOPLEFT",3,-1) checkbox.Panel:SetPoint("BOTTOMRIGHT",-3,1) local check = _G[baseName.."Check"] if(check) then check:SetStyle("CheckButton") end local colors = _G[baseName.."ColorClasses"] if(colors) then colors:SetStyle("CheckButton") colors:SetHeight(colorsHeight) end end end end --[[ ########################################################## CHAT MODR ########################################################## ]]-- local function ChatStyle() --print('test ChatStyle') if SV.db.Skins.blizzard.enable ~= true or SV.db.Skins.blizzard.chat ~= true then return end for i = 1, #ChatMenuList do local name = ChatMenuList[i] local this = _G[name] if(this) then if(name == "ChatMenu") then this:HookScript("OnShow", ChatMenu_OnShow) else this:HookScript("OnShow", ChatGeneric_OnShow) end end end for i = 1, #ChatFrameWipeList do local frame = _G[ChatFrameWipeList[i]] if(frame) then -- JV: 20161025 - Broken in 70100-22900 (7.1 build 22900) --frame:RemoveTextures() end end ChatConfigFrameOkayButton:SetPoint("RIGHT", ChatConfigFrameCancelButton, "RIGHT", -11, -1) ChatConfigCombatSettingsFiltersDeleteButton:SetPoint("TOPRIGHT", ChatConfigCombatSettingsFilters, "BOTTOMRIGHT", 0, -1) ChatConfigCombatSettingsFiltersAddFilterButton:SetPoint("RIGHT", ChatConfigCombatSettingsFiltersDeleteButton, "LEFT", -1, 0) ChatConfigCombatSettingsFiltersCopyFilterButton:SetPoint("RIGHT", ChatConfigCombatSettingsFiltersAddFilterButton, "LEFT", -1, 0) if(_G["CombatConfigTab1"]) then _G["CombatConfigTab1"]:RemoveTextures() end if(_G["CombatConfigTab2"]) then _G["CombatConfigTab2"]:RemoveTextures() end if(_G["CombatConfigTab3"]) then _G["CombatConfigTab3"]:RemoveTextures() end if(_G["CombatConfigTab4"]) then _G["CombatConfigTab4"]:RemoveTextures() end if(_G["CombatConfigTab5"]) then _G["CombatConfigTab5"]:RemoveTextures() end CombatConfigSettingsNameEditBox:SetStyle("Editbox") ChatConfigFrame:SetStyle("Frame", "Window", true) ChatConfigCategoryFrame:SetStyle("Frame", 'Transparent') ChatConfigBackgroundFrame:SetStyle("Frame", 'Transparent') for i = 1, #ChatFrameList4 do local this = _G[ChatFrameList4[i]] if(this) then this:ClearAllPoints() if this == CombatConfigColorsColorizeSpellNames then this:SetPoint("TOP",CombatConfigColorsColorizeUnitName,"BOTTOM",0,-2) else this:SetPoint("TOP",_G[ChatFrameList4[i-1]],"BOTTOM",0,-2) end end end --hooksecurefunc("ChatConfig_UpdateCheckboxes", _hook_ChatConfig_UpdateCheckboxes) -- do -- local chatchannellist = GetChannelList() -- local CreateChatChannelList = _G.CreateChatChannelList; -- local ChatConfigChannelSettings = _G.ChatConfigChannelSettings; -- CreateChatChannelList(ChatConfigChannelSettings, chatchannellist) -- end ChatConfig_CreateCheckboxes(ChatConfigChannelSettingsLeft, CHAT_CONFIG_CHANNEL_LIST, "ChatConfigCheckBoxWithSwatchAndClassColorTemplate", CHANNELS) ChatConfig_UpdateCheckboxes(ChatConfigChannelSettingsLeft) for i = 1, #COMBAT_CONFIG_TABS do local this = _G["CombatConfigTab"..i] if(this) then SV.API:Set("Tab", this) this:SetHeight(this:GetHeight()-2) this:SetWidth(ceil(this:GetWidth()+1.6)) _G["CombatConfigTab"..i.."Text"]:SetPoint("BOTTOM", 0, 10) end end CombatConfigTab1:ClearAllPoints() CombatConfigTab1:SetPoint("BOTTOMLEFT", ChatConfigBackgroundFrame, "TOPLEFT", 6, -2) for i = 1, #ChatFrameList5 do local this = _G[ChatFrameList5[i]] if(this) then this:SetStyle("Button") end end ChatConfigFrameOkayButton:SetPoint("TOPRIGHT", ChatConfigBackgroundFrame, "BOTTOMRIGHT", -3, -5) ChatConfigFrameDefaultButton:SetPoint("TOPLEFT", ChatConfigCategoryFrame, "BOTTOMLEFT", 1, -5) ChatConfigFrameRedockButton:SetPoint("TOPLEFT", ChatConfigBackgroundFrame, "BOTTOMLEFT", 10, -5) CombatLogDefaultButton:SetPoint("TOPLEFT", ChatConfigCategoryFrame, "BOTTOMLEFT", 1, -5) ChatConfigCombatSettingsFiltersDeleteButton:SetPoint("TOPRIGHT", ChatConfigCombatSettingsFilters, "BOTTOMRIGHT", -3, -1) ChatConfigCombatSettingsFiltersCopyFilterButton:SetPoint("RIGHT", ChatConfigCombatSettingsFiltersDeleteButton, "LEFT", -2, 0) ChatConfigCombatSettingsFiltersAddFilterButton:SetPoint("RIGHT", ChatConfigCombatSettingsFiltersCopyFilterButton, "LEFT", -2, 0) for i = 1, #ChatFrameList6 do local this = _G[ChatFrameList6[i]] if(this) then this:SetStyle("CheckButton") end end SV.API:Set("PageButton", ChatConfigMoveFilterUpButton,true) SV.API:Set("PageButton", ChatConfigMoveFilterDownButton,true) SV.API:Set("PageButton", CombatLogQuickButtonFrame_CustomAdditionalFilterButton,true) SV.API:Set("ScrollBar", SVUI_CopyChatScrollFrameScrollBar) SV.API:Set("CloseButton", SVUI_CopyChatFrameCloseButton) ChatConfigMoveFilterUpButton:ClearAllPoints() ChatConfigMoveFilterDownButton:ClearAllPoints() ChatConfigMoveFilterUpButton:SetPoint("TOPLEFT",ChatConfigCombatSettingsFilters,"BOTTOMLEFT",3,0) ChatConfigMoveFilterDownButton:SetPoint("LEFT",ChatConfigMoveFilterUpButton,24,0) CombatConfigSettingsNameEditBox:SetStyle("Editbox") ChatConfigFrame:SetSize(680,596) ChatConfigFrameHeader:ClearAllPoints() ChatConfigFrameHeader:SetPoint("TOP", ChatConfigFrame, "TOP", 0, -5) -- for i=1, select("#", GetChatWindowChannels(3)) do -- local info = select(i, GetChatWindowChannels(3)) -- print(info) -- end --_hook_ChatConfig_UpdateCheckboxes(ChatConfigChatSettingsLeft) --_hook_ChatConfig_UpdateCheckboxes(ChatConfigChannelSettingsLeft) end --[[ ########################################################## MOD LOADING ########################################################## ]]-- MOD:SaveCustomStyle("CHAT", ChatStyle)
-- CEF C API example -- Project website: https://github.com/cztomczak/cefcapi local ffi = require( "ffi" ) local cef = require( "../cef" ) -- ---------------------------------------------------------------------------- -- struct cef_client_t -- ---------------------------------------------------------------------------- --- -- Implement this structure to provide handler implementations. --- --- -- Return the handler for context menus. If no handler is -- provided the default implementation will be used. --- local function get_context_menu_handler(self) DEBUG_CALLBACK("get_context_menu_handler\n"); return nil; end --- -- Return the handler for dialogs. If no handler is provided the default -- implementation will be used. --- local function get_dialog_handler(self) DEBUG_CALLBACK("get_dialog_handler\n"); return nil; end --- -- Return the handler for browser display state events. --- local function get_display_handler(self) DEBUG_CALLBACK("get_display_handler\n"); return nil; end --- -- Return the handler for download events. If no handler is returned downloads -- will not be allowed. --- local function get_download_handler(self) DEBUG_CALLBACK("get_download_handler\n"); return nil; end --- -- Return the handler for drag events. --- local function get_drag_handler(self) DEBUG_CALLBACK("get_drag_handler\n"); return nil; end --- -- Return the handler for focus events. --- local function get_focus_handler(self) DEBUG_CALLBACK("get_focus_handler\n"); return nil; end --- -- Return the handler for geolocation permissions requests. If no handler is -- provided geolocation access will be denied by default. --- local function get_geolocation_handler(self) DEBUG_CALLBACK("get_geolocation_handler\n"); return nil; end --- -- Return the handler for JavaScript dialogs. If no handler is provided the -- default implementation will be used. --- local function get_jsdialog_handler(self) DEBUG_CALLBACK("get_jsdialog_handler\n"); return nil; end --- -- Return the handler for keyboard events. --- local function get_keyboard_handler(self) DEBUG_CALLBACK("get_keyboard_handler\n"); return nil; end --- -- Return the handler for browser life span events. --- local function get_life_span_handler(self) DEBUG_CALLBACK("get_life_span_handler\n"); -- Implemented! return g_life_span_handler; end --- -- Return the handler for browser load status events. --- local function get_load_handler(self) DEBUG_CALLBACK("get_load_handler\n"); return nil; end --- -- Return the handler for off-screen rendering events. --- local function get_render_handler(self) DEBUG_CALLBACK("get_render_handler\n"); return nil; end --- -- Return the handler for browser request events. --- local function get_request_handler(self) DEBUG_CALLBACK("get_request_handler\n"); return nil; end --- -- Called when a new message is received from a different process. Return true -- (1) if the message was handled or false (0) otherwise. Do not keep a -- reference to or attempt to access the message outside of this callback. --- local function on_process_message_received(self, browser, source_process, message) DEBUG_CALLBACK("on_process_message_received\n"); return 0; end function initialize_cef_client(client) DEBUG_CALLBACK("initialize_client_handler\n"); client.base.size = ffi.sizeof( client ); initialize_cef_base_ref_counted(ffi.cast( "cef_base_ref_counted_t*", client )); -- callbacks client.get_context_menu_handler = get_context_menu_handler; client.get_dialog_handler = get_dialog_handler; client.get_display_handler = get_display_handler; client.get_download_handler = get_download_handler; client.get_drag_handler = get_drag_handler; client.get_focus_handler = get_focus_handler; client.get_geolocation_handler = get_geolocation_handler; client.get_jsdialog_handler = get_jsdialog_handler; client.get_keyboard_handler = get_keyboard_handler; client.get_life_span_handler = get_life_span_handler; -- Implemented! client.get_load_handler = get_load_handler; client.get_render_handler = get_render_handler; client.get_request_handler = get_request_handler; client.on_process_message_received = on_process_message_received; end
local IsNew = false RegisterNetEvent('qb-interior:client:SetNewState') AddEventHandler('qb-interior:client:SetNewState', function(bool) IsNew = bool end) -- Thanks Stroudy <3 function CreateHotelFurnished(spawn) local object = {} local POIOffsets = {} POIOffsets.exit = json.decode('{"z":2.5,"y":-15.901171875,"x":4.251012802124,"h":2.2633972168}') local building = CreateObject(`playerhouse_hotel`, spawn.x - 0.7,spawn.y-0.4,spawn.z-1.42,false,false,false) FreezeEntityPosition(building,true) Citizen.Wait(100) local motelstuff = CreateObject(GetHashKey("v_49_motelmp_stuff"),spawn.x,spawn.y,spawn.z,false,false,false) local motelbed = CreateObject(GetHashKey("v_49_motelmp_bed"),spawn.x+1.4,spawn.y-0.55,spawn.z,false,false,false) local motelclothes = CreateObject(GetHashKey("v_49_motelmp_clothes"),spawn.x-2.0,spawn.y+2.0,spawn.z+0.15,false,false,false) local winframe = CreateObject(GetHashKey("v_49_motelmp_winframe"),spawn.x+0.74,spawn.y-4.26,spawn.z+1.11,false,false,false) local glass = CreateObject(GetHashKey("v_49_motelmp_glass"),spawn.x+0.74,spawn.y-4.26,spawn.z+1.13,false,false,false) local curtains = CreateObject(GetHashKey("v_49_motelmp_curtains"),spawn.x+0.74,spawn.y-4.15,spawn.z+0.9,false,false,false) local screen = CreateObject(GetHashKey("v_49_motelmp_screen"),spawn.x-2.21,spawn.y-0.6,spawn.z+0.79,false,false,false) --props local trainer = CreateObject(GetHashKey("v_res_fa_trainer02r"),spawn.x-1.9,spawn.y+3.0,spawn.z+0.38,false,false,false) local trainer2 = CreateObject(GetHashKey("v_res_fa_trainer02l"),spawn.x-2.1,spawn.y+2.95,spawn.z+0.38,false,false,false) local sink = CreateObject(GetHashKey("prop_sink_06"),spawn.x+1.1,spawn.y+4.0,spawn.z,false,false,false) local chair1 = CreateObject(GetHashKey("prop_chair_04a"),spawn.x+2.1,spawn.y-2.4,spawn.z,false,false,false) local chair2 = CreateObject(GetHashKey("prop_chair_04a"),spawn.x+0.7,spawn.y-3.5,spawn.z,false,false,false) local kettle = CreateObject(GetHashKey("prop_kettle"),spawn.x-2.3,spawn.y+0.6,spawn.z+0.9,false,false,false) local tvCabinet = CreateObject(GetHashKey("Prop_TV_Cabinet_03"),spawn.x-2.3,spawn.y-0.6,spawn.z,false,false,false) local tv = CreateObject(GetHashKey("prop_tv_06"),spawn.x-2.3,spawn.y-0.6,spawn.z+0.7,false,false,false) local toilet = CreateObject(GetHashKey("Prop_LD_Toilet_01"),spawn.x+2.1,spawn.y+2.9,spawn.z,false,false,false) local clock = CreateObject(GetHashKey("Prop_Game_Clock_02"),spawn.x-2.55,spawn.y-0.6,spawn.z+2.0,false,false,false) local phone = CreateObject(GetHashKey("v_res_j_phone"),spawn.x+2.4,spawn.y-1.9,spawn.z+0.64,false,false,false) local ironBoard = CreateObject(GetHashKey("v_ret_fh_ironbrd"),spawn.x-1.7,spawn.y+3.5,spawn.z+0.15,false,false,false) local iron = CreateObject(GetHashKey("prop_iron_01"),spawn.x-1.9,spawn.y+2.85,spawn.z+0.63,false,false,false) local mug1 = CreateObject(GetHashKey("V_Ret_TA_Mug"),spawn.x-2.3,spawn.y+0.95,spawn.z+0.9,false,false,false) local mug2 = CreateObject(GetHashKey("V_Ret_TA_Mug"),spawn.x-2.2,generator.y+0.9,generator.z+0.9,false,false,false) local binder = CreateObject(GetHashKey("v_res_binder"),spawn.x-2.2,spawn.y+1.3,spawn.z+0.87,false,false,false) FreezeEntityPosition(sink,true) FreezeEntityPosition(chair1,true) FreezeEntityPosition(chair2,true) FreezeEntityPosition(tvCabinet,true) FreezeEntityPosition(tv,true) SetEntityHeading(chair1,GetEntityHeading(chair1)+270) SetEntityHeading(chair2,GetEntityHeading(chair2)+180) SetEntityHeading(kettle,GetEntityHeading(kettle)+90) SetEntityHeading(tvCabinet,GetEntityHeading(tvCabinet)+90) SetEntityHeading(tv,GetEntityHeading(tv)+90) SetEntityHeading(toilet,GetEntityHeading(toilet)+270) SetEntityHeading(clock,GetEntityHeading(clock)+90) SetEntityHeading(phone,GetEntityHeading(phone)+220) SetEntityHeading(ironBoard,GetEntityHeading(ironBoard)+90) SetEntityHeading(iron,GetEntityHeading(iron)+230) SetEntityHeading(mug1,GetEntityHeading(mug1)+20) SetEntityHeading(mug2,GetEntityHeading(mug2)+230) table.insert(objects, motelstuff) table.insert(objects, motelbed) table.insert(objects, motelclothes) table.insert(objects, winframe) table.insert(objects, glass) table.insert(objects, curtains) table.insert(objects, screen) table.insert(objects, trainer) table.insert(objects, trainer2) table.insert(objects, sink) table.insert(objects, chair1) table.insert(objects, chair2) table.insert(objects, kettle) table.insert(objects, tvCabinet) table.insert(objects, tv) table.insert(objects, toilet) table.insert(objects, clock) table.insert(objects, phone) table.insert(objects, ironBoard) table.insert(objects, iron) table.insert(objects, mug1) table.insert(objects, mug2) table.insert(objects, binder) TeleportToInterior(spawn.x + POIOffsets.exit.x, spawn.y + POIOffsets.exit.y, spawn.z + 1.5, POIOffsets.exit.h) return { objects, POIOffsets } end function CreateApartmentFurnished(spawn) local objects = {} local POIOffsets = {} POIOffsets.exit = json.decode('{"z":1.2,"y":4.29636328125,"x":3.572736328125,"h":2.2633972168}') POIOffsets.clothes = json.decode('{"z":1.2,"y":-2.6444736328,"x":0.524350097,"h":2.2633972168}') POIOffsets.stash = json.decode('{"z":0.5,"y":1.9440585937501,"x":-1.08997509763,"h":2.2633972168}') POIOffsets.logout = json.decode('{"z":0.8,"y":-3.0555111328,"x":-4.5689604492,"h":2.2633972168}') DoScreenFadeOut(500) while not IsScreenFadedOut() do Citizen.Wait(10) end RequestModel(`gabz_pinkcage`) while not HasModelLoaded(`gabz_pinkcage`) do Citizen.Wait(3) end local house = CreateObject(`gabz_pinkcage`, spawn.x, spawn.y, spawn.z, false, false, false) FreezeEntityPosition(house, true) table.insert(objects, house) TeleportToInterior(spawn.x - 1.52089355468, spawn.y - 2.00144140625, spawn.z + 1.5, POIOffsets.exit.h) if IsNew then SetTimeout(750, function() TriggerEvent('qb-clothes:client:CreateFirstCharacter') IsNew = false end) end return { objects, POIOffsets } end function CreateMichaelShell(spawn) local objects = {} local POIOffsets = {} POIOffsets.exit = json.decode('{"z":1.4,"y":2.65636328125,"x":-10.572736328125,"h":265.633972168}') DoScreenFadeOut(500) while not IsScreenFadedOut() do Citizen.Wait(10) end RequestModel(`micheal_shell`) while not HasModelLoaded(`micheal_shell`) do Citizen.Wait(1000) end local house = CreateObject(`micheal_shell`, spawn.x, spawn.y, spawn.z, false, false, false) FreezeEntityPosition(house, true) table.insert(objects, house) TeleportToInterior(spawn.x - 9.52089355468, spawn.y + 2.80144140625, spawn.z + 1.5, POIOffsets.exit.h) return { objects, POIOffsets } end function CreateTrevorsShell(spawn) local objects = {} local POIOffsets = {} POIOffsets.exit = json.decode('{"z":7.9,"y":-3.9,"x":0.1,"h":358.633972168}') DoScreenFadeOut(500) while not IsScreenFadedOut() do Citizen.Wait(10) end RequestModel(`trevors_shell`) while not HasModelLoaded(`trevors_shell`) do Citizen.Wait(1000) end local house = CreateObject(`trevors_shell`, spawn.x, spawn.y, spawn.z, false, false, false) FreezeEntityPosition(house, true) table.insert(objects, house) TeleportToInterior(spawn.x + 0.0, spawn.y - 3.20144140625, spawn.z + 6.5, POIOffsets.exit.h) return { objects, POIOffsets } end function CreateLesterShell(spawn) local objects = {} local POIOffsets = {} POIOffsets.exit = json.decode('{"z":7.9,"y":-3.9,"x":0.1,"h":358.633972168}') DoScreenFadeOut(500) while not IsScreenFadedOut() do Citizen.Wait(10) end RequestModel(`playerhouse_tier2`) while not HasModelLoaded(`playerhouse_tier2`) do Citizen.Wait(1000) end local house = CreateObject(`playerhouse_tier2`, spawn.x, spawn.y, spawn.z, false, false, false) FreezeEntityPosition(house, true) table.insert(objects, house) TeleportToInterior(spawn.x + 0.0, spawn.y - 3.20144140625, spawn.z + 6.5, POIOffsets.exit.h) return { objects, POIOffsets } end function CreateGunshopShell(spawn) local objects = {} local POIOffsets = {} POIOffsets.exit = json.decode('{"z":5.9,"y":-5.5,"x":-1.0,"h":358.633972168}') DoScreenFadeOut(500) while not IsScreenFadedOut() do Citizen.Wait(10) end RequestModel(`gunshop_shell`) while not HasModelLoaded(`gunshop_shell`) do Citizen.Wait(1000) end local house = CreateObject(`gunshop_shell`, spawn.x, spawn.y, spawn.z, false, false, false) FreezeEntityPosition(house, true) table.insert(objects, house) TeleportToInterior(spawn.x + -1.0, spawn.y + -5.2, spawn.z + 6.5, POIOffsets.exit.h) return { objects, POIOffsets } end function CreateTrapHouseShell(spawn) local objects = {} local POIOffsets = {} POIOffsets.exit = json.decode('{"z":6.5,"y":-6.20144140625,"x":-0.5,"h":358.633972168}') DoScreenFadeOut(500) while not IsScreenFadedOut() do Citizen.Wait(10) end RequestModel(`traphouse_shell`) while not HasModelLoaded(`traphouse_shell`) do Citizen.Wait(1000) end local house = CreateObject(`traphouse_shell`, spawn.x, spawn.y, spawn.z, false, false, false) FreezeEntityPosition(house, true) table.insert(objects, house) TeleportToInterior(spawn.x + POIOffsets.exit.x, spawn.y + POIOffsets.exit.y, spawn.z + POIOffsets.exit.z, POIOffsets.exit.h) return { objects, POIOffsets } end -- Thanks Stroudy <3 function CreateTier1HouseFurnished(spawn, isBackdoor) local objects = {} local POIOffsets = {} POIOffsets.exit = json.decode('{"z":2.5,"y":-15.901171875,"x":4.251012802124,"h":2.2633972168}') POIOffsets.clothes = json.decode('{"z":2.5,"y":-3.9233189,"x":-7.84363671,"h":2.2633972168}') POIOffsets.stash = json.decode('{"z":2.5,"y":1.33868212,"x":-9.084908691,"h":2.2633972168}') POIOffsets.logout = json.decode('{"z":2.0,"y":-1.1463337,"x":-6.69117089,"h":2.2633972168}') POIOffsets.backdoor = json.decode('{"z":2.5,"y":4.3798828125,"x":0.88999176025391,"h":182.2633972168}') DoScreenFadeOut(500) while not IsScreenFadedOut() do Citizen.Wait(10) end RequestModel(`playerhouse_tier1_full`) while not HasModelLoaded(`playerhouse_tier1_full`) do Citizen.Wait(1000) end local shell = CreateObject(`playerhouse_tier1_full`, spawn.x, spawn.y, spawn.z, false, false, false) FreezeEntityPosition(shell, true) table.insert(objects, shell) local dt = CreateObject(`V_16_DT`,spawn.x-1.21854400,spawn.y-1.04389600,spawn.z+1.39068600,false,false,false) local mpmid01 = CreateObject(`V_16_mpmidapart01`,spawn.x+0.52447510,spawn.y-5.04953700,spawn.z+1.32,false,false,false) local mpmid09 = CreateObject(`V_16_mpmidapart09`,spawn.x+0.82202150,spawn.y+2.29612000,spawn.z+1.88,false,false,false) local mpmid07 = CreateObject(`V_16_mpmidapart07`,spawn.x-1.91445900,spawn.y-6.61911300,spawn.z+1.45,false,false,false) local mpmid03 = CreateObject(`V_16_mpmidapart03`,spawn.x-4.82565300,spawn.y-6.86803900,spawn.z+1.14,false,false,false) local midData = CreateObject(`V_16_midapartdeta`,spawn.x+2.28558400,spawn.y-1.94082100,spawn.z+1.288628,false,false,false) local glow = CreateObject(`V_16_treeglow`,spawn.x-1.37408500,spawn.y-0.95420070,spawn.z+1.135,false,false,false) local curtins = CreateObject(`V_16_midapt_curts`,spawn.x-1.96423300,spawn.y-0.95958710,spawn.z+1.280,false,false,false) local mpmid13 = CreateObject(`V_16_mpmidapart13`,spawn.x-4.65580700,spawn.y-6.61684000,spawn.z+1.259,false,false,false) local mpcab = CreateObject(`V_16_midapt_cabinet`,spawn.x-1.16177400,spawn.y-0.97333810,spawn.z+1.27,false,false,false) local mpdecal = CreateObject(`V_16_midapt_deca`,spawn.x+2.311386000,spawn.y-2.05385900,spawn.z+1.297,false,false,false) local mpdelta = CreateObject(`V_16_mid_hall_mesh_delta`,spawn.x+3.69693000,spawn.y-5.80020100,spawn.z+1.293,false,false,false) local beddelta = CreateObject(`V_16_mid_bed_delta`,spawn.x+7.95187400,spawn.y+1.04246500,spawn.z+1.28402300,false,false,false) local bed = CreateObject(`V_16_mid_bed_bed`,spawn.x+6.86376900,spawn.y+1.20651200,spawn.z+1.36589100,false,false,false) local beddecal = CreateObject(`V_16_MID_bed_over_decal`,spawn.x+7.82861300,spawn.y+1.04696700,spawn.z+1.34753700,false,false,false) local bathDelta = CreateObject(`V_16_mid_bath_mesh_delta`,spawn.x+4.45460500,spawn.y+3.21322800,spawn.z+1.21116100,false,false,false) local bathmirror = CreateObject(`V_16_mid_bath_mesh_mirror`,spawn.x+3.57740800,spawn.y+3.25032000,spawn.z+1.48871300,false,false,false) --props local beerbot = CreateObject(`Prop_CS_Beer_Bot_01`,spawn.x+1.73134600,spawn.y-4.88520200,spawn.z+1.91083000,false,false,false) local couch = CreateObject(`v_res_mp_sofa`,spawn.x-1.48765600,spawn.y+1.68100600,spawn.z+1.21640500,false,false,false) local chair = CreateObject(`v_res_mp_stripchair`,spawn.x-4.44770800,spawn.y-1.78048800,spawn.z+1.21640500,false,false,false) local chair2 = CreateObject(`v_res_tre_chair`,spawn.x+2.91325400,spawn.y-5.27835100,spawn.z+1.22746400,false,false,false) local plant = CreateObject(`Prop_Plant_Int_04a`,spawn.x+2.78941300,spawn.y-4.39133900,spawn.z+2.12746400,false,false,false) local lamp = CreateObject(`v_res_d_lampa`,spawn.x-3.61473100,spawn.y-6.61465100,spawn.z+2.08382800,false,false,false) local fridge = CreateObject(`v_res_fridgemodsml`,spawn.x+1.90339700,spawn.y-3.80026800,spawn.z+1.29917900,false,false,false) local micro = CreateObject(`prop_micro_01`,spawn.x+2.03442400,spawn.y-4.61585100,spawn.z+2.30395600,false,false,false) local sideBoard = CreateObject(`V_Res_Tre_SideBoard`,spawn.x+2.84053000,spawn.y-4.30947100,spawn.z+1.24577300,false,false,false) local bedSide = CreateObject(`V_Res_Tre_BedSideTable`,spawn.x-3.50363200,spawn.y-6.55289400,spawn.z+1.30625800,false,false,false) local lamp2 = CreateObject(`v_res_d_lampa`,spawn.x+2.69674700,spawn.y-3.83123500,spawn.z+2.09373700,false,false,false) local plant2 = CreateObject(`v_res_tre_tree`,spawn.x-4.96064800,spawn.y-6.09898500,spawn.z+1.31631400,false,false,false) local tableObj = CreateObject(`V_Res_M_DineTble_replace`,spawn.x-3.50712600,spawn.y-4.13621600,spawn.z+1.29625800,false,false,false) local tv = CreateObject(`Prop_TV_Flat_01`,spawn.x-5.53120400,spawn.y+0.76299670,spawn.z+2.17236000,false,false,false) local plant3 = CreateObject(`v_res_tre_plant`,spawn.x-5.14112800,spawn.y-2.78951000,spawn.z+1.25950800,false,false,false) local chair3 = CreateObject(`v_res_m_dinechair`,spawn.x-3.04652400,spawn.y-4.95971200,spawn.z+1.19625800,false,false,false) local lampStand = CreateObject(`v_res_m_lampstand`,spawn.x+1.26588400,spawn.y+3.68883900,spawn.z+1.30556700,false,false,false) local stool = CreateObject(`V_Res_M_Stool_REPLACED`,spawn.x-3.23216300,spawn.y+2.06159000,spawn.z+1.20556700,false,false,false) local chair4 = CreateObject(`v_res_m_dinechair`,spawn.x-2.82237200,spawn.y-3.59831300,spawn.z+1.25950800,false,false,false) local chair5 = CreateObject(`v_res_m_dinechair`,spawn.x-4.14955100,spawn.y-4.71316600,spawn.z+1.19625800,false,false,false) local chair6 = CreateObject(`v_res_m_dinechair`,spawn.x-3.80622900,spawn.y-3.37648300,spawn.z+1.19625800,false,false,false) local plant4 = CreateObject(`v_res_fa_plant01`,spawn.x+2.97859200,spawn.y+2.55307400,spawn.z+1.85796300,false,false,false) local storage = CreateObject(`v_res_tre_storageunit`,spawn.x+8.47819500,spawn.y-2.50979300,spawn.z+1.19712300,false,false,false) local storage2 = CreateObject(`v_res_tre_storagebox`,spawn.x+9.75982700,spawn.y-1.35874100,spawn.z+1.29625800,false,false,false) local basketmess = CreateObject(`v_res_tre_basketmess`,spawn.x+8.70730600,spawn.y-2.55503600,spawn.z+1.94059590,false,false,false) local lampStand2 = CreateObject(`v_res_m_lampstand`,spawn.x+9.54306000,spawn.y-2.50427700,spawn.z+1.30556700,false,false,false) local plant4 = CreateObject(`Prop_Plant_Int_03a`,spawn.x+9.87521400,spawn.y+3.90917400,spawn.z+1.20829700,false,false,false) local basket = CreateObject(`v_res_tre_washbasket`,spawn.x+9.39091500,spawn.y+4.49676300,spawn.z+1.19625800,false,false,false) local wardrobe = CreateObject(`V_Res_Tre_Wardrobe`,spawn.x+8.46626300,spawn.y+4.53223600,spawn.z+1.19425800,false,false,false) local basket2 = CreateObject(`v_res_tre_flatbasket`,spawn.x+8.51593000,spawn.y+4.55647300,spawn.z+3.46737300,false,false,false) local basket3 = CreateObject(`v_res_tre_basketmess`,spawn.x+7.57797200,spawn.y+4.55198800,spawn.z+3.46737300,false,false,false) local basket4 = CreateObject(`v_res_tre_flatbasket`,spawn.x+7.12286400,spawn.y+4.54689200,spawn.z+3.46737300,false,false,false) local wardrobe2 = CreateObject(`V_Res_Tre_Wardrobe`,spawn.x+7.24382000,spawn.y+4.53423500,spawn.z+1.19625800,false,false,false) local basket5 = CreateObject(`v_res_tre_flatbasket`,spawn.x+8.03364600,spawn.y+4.54835500,spawn.z+3.46737300,false,false,false) local switch = CreateObject(`v_serv_switch_2`,spawn.x+6.28086900,spawn.y-0.68169880,spawn.z+2.30326000,false,false,false) local table2 = CreateObject(`V_Res_Tre_BedSideTable`,spawn.x+5.84416200,spawn.y+2.57377400,spawn.z+1.22089100,false,false,false) local lamp3 = CreateObject(`v_res_d_lampa`,spawn.x+5.84912100,spawn.y+2.58001100,spawn.z+1.95311890,false,false,false) local laundry = CreateObject(`v_res_mlaundry`,spawn.x+5.77729800,spawn.y+4.60211400,spawn.z+1.19674400,false,false,false) local ashtray = CreateObject(`Prop_ashtray_01`,spawn.x-1.24716200,spawn.y+1.07820500,spawn.z+1.89089300,false,false,false) local candle1 = CreateObject(`v_res_fa_candle03`,spawn.x-2.89289900,spawn.y-4.35329700,spawn.z+2.02881310,false,false,false) local candle2 = CreateObject(`v_res_fa_candle02`,spawn.x-3.99865700,spawn.y-4.06048500,spawn.z+2.02530190,false,false,false) local candle3 = CreateObject(`v_res_fa_candle01`,spawn.x-3.37733400,spawn.y-3.66639800,spawn.z+2.02526200,false,false,false) local woodbowl = CreateObject(`v_res_m_woodbowl`,spawn.x-3.50787400,spawn.y-4.11983000,spawn.z+2.02589900,false,false,false) local tablod = CreateObject(`V_Res_TabloidsA`,spawn.x-0.80513000,spawn.y+0.51389600,spawn.z+1.18418800,false,false,false) local tapeplayer = CreateObject(`Prop_Tapeplayer_01`,spawn.x-1.26010100,spawn.y-3.62966400,spawn.z+2.37883200,false,false,false) local woodbowl2 = CreateObject(`v_res_tre_fruitbowl`,spawn.x+2.77764900,spawn.y-4.138297000,spawn.z+2.10340100,false,false,false) local sculpt = CreateObject(`v_res_sculpt_dec`,spawn.x+3.03932200,spawn.y+1.62726400,spawn.z+3.58363900,false,false,false) local jewlry = CreateObject(`v_res_jewelbox`,spawn.x+3.04164100,spawn.y+0.31671810,spawn.z+3.58363900,false,false,false) local basket6 = CreateObject(`v_res_tre_basketmess`,spawn.x-1.64906300,spawn.y+1.62675900,spawn.z+1.39038500,false,false,false) local basket7 = CreateObject(`v_res_tre_flatbasket`,spawn.x-1.63938900,spawn.y+0.91133310,spawn.z+1.39038500,false,false,false) local basket8 = CreateObject(`v_res_tre_flatbasket`,spawn.x-1.19923400,spawn.y+1.69598600,spawn.z+1.39038500,false,false,false) local basket9 = CreateObject(`v_res_tre_basketmess`,spawn.x-1.18293800,spawn.y+0.91436380,spawn.z+1.39038500,false,false,false) local bowl = CreateObject(`v_res_r_sugarbowl`,spawn.x-0.26029210,spawn.y-6.66716800,spawn.z+3.77324900,false,false,false) local breadbin = CreateObject(`Prop_Breadbin_01`,spawn.x+2.09788500,spawn.y-6.57634000,spawn.z+2.24041900,false,false,false) local knifeblock = CreateObject(`v_res_mknifeblock`,spawn.x+1.82084700,spawn.y-6.58438500,spawn.z+2.27399500,false,false,false) local toaster = CreateObject(`prop_toaster_01`,spawn.x-1.05790700,spawn.y-6.59017400,spawn.z+2.26793200,false,false,false) local wok = CreateObject(`prop_wok`,spawn.x+2.01728800,spawn.y-5.57091500,spawn.z+2.26793200,false,false,false) local plant5 = CreateObject(`Prop_Plant_Int_03a`,spawn.x+2.55015600,spawn.y+4.60183900,spawn.z+1.20829700,false,false,false) local tumbler = CreateObject(`p_tumbler_cs2_s`,spawn.x-0.90916440,spawn.y-4.24099100,spawn.z+2.26793200,false,false,false) local wisky = CreateObject(`p_whiskey_bottle_s`,spawn.x-0.92809300,spawn.y-3.99099100,spawn.z+2.26793200,false,false,false) local tissue = CreateObject(`v_res_tissues`,spawn.x+7.95889300,spawn.y-2.54847100,spawn.z+1.94013400,false,false,false) local pants = CreateObject(`V_16_Ap_Mid_Pants4`,spawn.x+7.55366500,spawn.y-0.25457100,spawn.z+1.33009200,false,false,false) local pants2 = CreateObject(`V_16_Ap_Mid_Pants5`,spawn.x+7.76753200,spawn.y+3.00476500,spawn.z+1.33052800,false,false,false) local hairdryer = CreateObject(`v_club_vuhairdryer`,spawn.x+8.12616000,spawn.y-2.50562000,spawn.z+1.96009390,false,false,false) FreezeEntityPosition(dt,true) FreezeEntityPosition(mpmid01,true) FreezeEntityPosition(mpmid09,true) FreezeEntityPosition(mpmid07,true) FreezeEntityPosition(mpmid03,true) FreezeEntityPosition(midData,true) FreezeEntityPosition(glow,true) FreezeEntityPosition(curtins,true) FreezeEntityPosition(mpmid13,true) FreezeEntityPosition(mpcab,true) FreezeEntityPosition(mpdecal,true) FreezeEntityPosition(mpdelta,true) FreezeEntityPosition(couch,true) FreezeEntityPosition(chair,true) FreezeEntityPosition(chair2,true) FreezeEntityPosition(plant,true) FreezeEntityPosition(lamp,true) FreezeEntityPosition(fridge,true) FreezeEntityPosition(micro,true) FreezeEntityPosition(sideBoard,true) FreezeEntityPosition(bedSide,true) FreezeEntityPosition(plant2,true) FreezeEntityPosition(tableObj,true) FreezeEntityPosition(tv,true) FreezeEntityPosition(plant3,true) FreezeEntityPosition(chair3,true) FreezeEntityPosition(lampStand,true) FreezeEntityPosition(chair4,true) FreezeEntityPosition(chair5,true) FreezeEntityPosition(chair6,true) FreezeEntityPosition(plant4,true) FreezeEntityPosition(storage,true) FreezeEntityPosition(storage2,true) FreezeEntityPosition(basket,true) FreezeEntityPosition(wardrobe,true) FreezeEntityPosition(wardrobe2,true) FreezeEntityPosition(table2,true) FreezeEntityPosition(lamp3,true) FreezeEntityPosition(laundry,true) FreezeEntityPosition(beddelta,true) FreezeEntityPosition(bed,true) FreezeEntityPosition(beddecal,true) FreezeEntityPosition(tapeplayer,true) FreezeEntityPosition(basket7,true) FreezeEntityPosition(basket6,true) FreezeEntityPosition(basket8,true) FreezeEntityPosition(basket9,true) table.insert(objects, dt) table.insert(objects, mpmid01) table.insert(objects, mpmid09) table.insert(objects, mpmid07) table.insert(objects, mpmid03) table.insert(objects, midData) table.insert(objects, glow) table.insert(objects, curtins) table.insert(objects, mpmid13) table.insert(objects, mpcab) table.insert(objects, mpdecal) table.insert(objects, mpdelta) table.insert(objects, couch) table.insert(objects, chair) table.insert(objects, chair2) table.insert(objects, plant) table.insert(objects, lamp) table.insert(objects, fridge) table.insert(objects, micro) table.insert(objects, sideBoard) table.insert(objects, bedSide) table.insert(objects, plant2) table.insert(objects, tableObj) table.insert(objects, tv) table.insert(objects, plant3) table.insert(objects, chair3) table.insert(objects, lampStand) table.insert(objects, chair4) table.insert(objects, chair5) table.insert(objects, chair6) table.insert(objects, plant4) table.insert(objects, storage2) table.insert(objects, basket) table.insert(objects, wardrobe) table.insert(objects, wardrobe2) table.insert(objects, table2) table.insert(objects, lamp3) table.insert(objects, laundry) table.insert(objects, beddelta) table.insert(objects, bed) table.insert(objects, beddecal) table.insert(objects, tapeplayer) table.insert(objects, basket7) table.insert(objects, basket6) table.insert(objects, basket8) table.insert(objects, basket9) SetEntityHeading(beerbot,GetEntityHeading(beerbot)+90) SetEntityHeading(couch,GetEntityHeading(couch)-90) SetEntityHeading(chair,GetEntityHeading(chair)+getRotation(0.28045480)) SetEntityHeading(chair2,GetEntityHeading(chair2)+getRotation(0.3276100)) SetEntityHeading(fridge,GetEntityHeading(chair2)+160) SetEntityHeading(micro,GetEntityHeading(micro)-80) SetEntityHeading(sideBoard,GetEntityHeading(sideBoard)+90) SetEntityHeading(bedSide,GetEntityHeading(bedSide)+180) SetEntityHeading(tv,GetEntityHeading(tv)+90) SetEntityHeading(plant3,GetEntityHeading(plant3)+90) SetEntityHeading(chair3,GetEntityHeading(chair3)+200) SetEntityHeading(chair4,GetEntityHeading(chair3)+100) SetEntityHeading(chair5,GetEntityHeading(chair5)+135) SetEntityHeading(chair6,GetEntityHeading(chair6)+10) SetEntityHeading(storage,GetEntityHeading(storage)+180) SetEntityHeading(storage2,GetEntityHeading(storage2)-90) SetEntityHeading(table2,GetEntityHeading(table2)+90) SetEntityHeading(tapeplayer,GetEntityHeading(tapeplayer)+90) SetEntityHeading(knifeblock,GetEntityHeading(knifeblock)+180) if not isBackdoor then TeleportToInterior(spawn.x + 3.69693000, spawn.y - 15.080020100, spawn.z + 1.5, spawn.h) else TeleportToInterior(spawn.x + 0.88999176025391, spawn.y + 4.3798828125, spawn.z + 1.5, spawn.h) end return { objects, POIOffsets } end
--!strict local createSymbol = require(script.Parent.createSymbol) local Symbols = {} -- Element kinds to be used in record-based conditionals (visitor pattern reconciler) local ElementKinds = {} ElementKinds.CreateInstance = createSymbol('CreateInstance') ElementKinds.Stamp = createSymbol('Stamp') ElementKinds.OnChild = createSymbol('OnChild') ElementKinds.Decorate = createSymbol('Decorate') ElementKinds.Index = createSymbol('Index') ElementKinds.Portal = createSymbol('Portal') ElementKinds.RenderComponent = createSymbol('RenderComponent') ElementKinds.LifecycleComponent = createSymbol('LifecycleComponent') ElementKinds.StateComponent = createSymbol('StateComponent') ElementKinds.SignalComponent = createSymbol('SignalComponent') ElementKinds.ContextProvider = createSymbol('ContextProvider') ElementKinds.ContextConsumer = createSymbol('ContextConsumer') ElementKinds.SiblingCluster = createSymbol('SiblingCluster') Symbols.ElementKinds = ElementKinds -- Decoration prop key symbols Symbols.Attributes = createSymbol('Attributes') Symbols.CollectionServiceTags = createSymbol('CollectionServiceTags') Symbols.Children = createSymbol('Children') Symbols.AttributeChangedSignals = createSymbol('AttributeChangedSymbols') Symbols.PropertyChangedSignals = createSymbol('PropertyChangedSignals') Symbols.OnMountWithHost = createSymbol('OnMountWithHost') Symbols.OnUnmountWithHost = createSymbol('OnUnmountWithHost') Symbols.OnUpdateWithHost = createSymbol('OnUpdateWithHost') -- Decoration prop value symbols Symbols.None = createSymbol('None') -- Internal symbols Symbols.IsPractTree = createSymbol('IsPractTree') Symbols.ElementKind = createSymbol('ElementKind') --Symbols.IsPractVirtualNode = createSymbol('IsPractVirtualNode') return Symbols
ITEM.name = "Полевой набор медика" ITEM.category = "Медицина" ITEM.desc = "Ларец со множеством выдвижных ящичков. Внутри находятся инструменты для проведения хирургических операций, бинты, припарки, а также несколько отваров и зелий." ITEM.model = "models/toussaint_box1.mdl" ITEM.price = 30 ITEM.width = 1 ITEM.height = 1 ITEM.permit = "misc" ITEM.healSeconds = 30 ITEM.health = 100 ITEM.quantity = 5
local dap = require("dap") local dutils = require("dap.utils") local util = require("eden.modules.protocol.dap.util") local function rust_crate() local metadata_json = vim.fn.system("cargo metadata --format-version 1 --no-deps") local metadata = vim.fn.json_decode(metadata_json) local target_dir = metadata.target_directory local results = {} for _, package in ipairs(metadata.packages) do for _, target in ipairs(package.targets) do if vim.tbl_contains(target.kind, "bin") then table.insert(results, target_dir .. "/debug/" .. target.name) end end end if #results == 1 then return results[1] end return util.user_select("Select target:", results) end local function lldb_init_commands() local sysroot = vim.fn.system("rustc --print sysroot"):gsub("\n", "") local path = sysroot .. "/lib/rustlib/etc" local lookup = string.format([[command script import "%s"/lldb_lookup.py]], path) local commands = string.format([[command source "%s"/lldb_commands]], path) local result = { lookup, commands, } return result end dap.adapters.lldb_rust = { name = "lldb", type = "executable", attach = { pidProperty = "pid", pidSelect = "ask", }, command = "lldb-vscode", env = util.pass_env({ LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY = "YES", }), initCommands = lldb_init_commands(), } dap.configurations.rust = { { name = "Debug Crate", type = "lldb_rust", request = "launch", program = function() return rust_crate() end, args = {}, }, { -- If you get an "Operation not permitted" error using this, try disabling YAMA: -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope name = "Attach", type = "lldb", request = "attach", pid = dutils.pick_process, args = {}, }, }
imperial_exterminator = Creature:new { objectName = "@mob/creature_names:imperial_exterminator", randomNameType = NAME_GENERIC, randomNameTag = true, socialGroup = "imperial", faction = "imperial", level = 28, chanceHit = 0.37, damageMin = 270, damageMax = 280, baseXp = 2914, baseHAM = 8200, baseHAMmax = 10000, armor = 2, resists = {5,5,5,-1,30,-1,30,-1,-1}, meatType = "", meatAmount = 0, hideType = "", hideAmount = 0, boneType = "", boneAmount = 0, milk = 0, tamingChance = 0.0, ferocity = 0, pvpBitmask = ATTACKABLE, creatureBitmask = PACK + KILLER, optionsBitmask = AIENABLED, diet = HERBIVORE, templates = {"object/mobile/dressed_imperial_exterminator.iff"}, lootGroups = { { groups = { {group = "junk", chance = 3200000}, {group = "wearables_common", chance = 2000000}, {group = "tailor_components", chance = 1500000}, {group = "loot_kit_parts", chance = 2000000}, {group = "pistols", chance = 1000000}, {group = "clothing_attachments", chance = 150000}, {group = "armor_attachments", chance = 150000} } } }, weapons = {"imperial_weapons_heavy"}, conversationTemplate = "", reactionStf = "@npc_reaction/military", attacks = merge(brawlermaster,marksmanmaster,riflemanmaster,carbineermaster) } CreatureTemplates:addCreatureTemplate(imperial_exterminator, "imperial_exterminator")
Player = game:GetService("Players").LocalPlayer Character = Player.Character PlayerGui = Player.PlayerGui Backpack = Player.Backpack Torso = Character.Torso Head = Character.Head Humanoid = Character.Humanoid LeftArm = Character["Left Arm"] LeftLeg = Character["Left Leg"] RightArm = Character["Right Arm"] RightLeg = Character["Right Leg"] LS = Torso["Left Shoulder"] LH = Torso["Left Hip"] RS = Torso["Right Shoulder"] RH = Torso["Right Hip"] Neck = Torso.Neck it=Instance.new vt=Vector3.new cf=CFrame.new euler=CFrame.fromEulerAnglesXYZ angles=CFrame.Angles necko=cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) necko2=cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) neckoav=cf(0, -2.25, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) neckoav2=cf(0, 1.125, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) LHC0=cf(-1,-1,0,-0,-0,-1,0,1,0,1,0,0) RHC0=cf(1,-1,0,0,0,1,0,1,0,-1,-0,-0) RootPart=Character.HumanoidRootPart RootJoint=RootPart.RootJoint RootCF=euler(-1.57,0,3.14) attack = false shadowattack=false attackdebounce = false MMouse=nil combo=0 cancombo=false combomove=false combotype="None" AvatarMode="Follow" lifestolen=false LifeStolenTorso=nil local LastPoint=nil local LastPoint2=nil local LastPoint3=nil local Point=LastPoint local Point2=LastPoint2 local Point3=LastPoint3 local rLastPoint=nil local rLastPoint2=nil local rLastPoint3=nil local rPoint=rLastPoint local rPoint2=rLastPoint2 local rPoint3=rLastPoint3 local avLastPoint=nil local avLastPoint2=nil local avLastPoint3=nil local avPoint=avLastPoint local avPoint2=avLastPoint2 local avPoint3=avLastPoint3 local TargetTorso=nil local con1=nil local con2=nil local shadowcon=nil --player player = nil --save shoulders RSH, LSH = nil, nil --welds RW, LW = Instance.new("Weld"), Instance.new("Weld") RW.Name="Right Shoulder" LW.Name="Left Shoulder" LH=Torso["Left Hip"] RH=Torso["Right Hip"] if Character:findFirstChild("Warden Claws",true) ~= nil then Character:findFirstChild("Warden Claws",true).Parent = nil end if Character:findFirstChild("Avatar",true) ~= nil then Character:findFirstChild("Avatar",true).Parent = nil end function NoOutline(Part) Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface = 10,10,10,10,10,10 end function part(formfactor,parent,reflectance,transparency,brickcolor,name,size) local fp = it("Part") fp.formFactor = formfactor fp.Parent = parent fp.Reflectance = reflectance fp.Transparency = transparency fp.CanCollide = false fp.Locked=true fp.BrickColor = brickcolor fp.Name = name fp.Size = size fp.Position = Torso.Position+vt(0,50,0) NoOutline(fp) fp.Material="Neon" fp:BreakJoints() return fp end function mesh(Mesh,part,meshtype,meshid,offset,scale) local mesh = it(Mesh) mesh.Parent = part if Mesh=="SpecialMesh" then mesh.MeshType = meshtype mesh.MeshId = meshid end mesh.Offset=offset mesh.Scale=scale return mesh end function weld(parent,part0,part1,c0) local weld = it("Weld") weld.Parent = parent weld.Part0 = part0 weld.Part1 = part1 weld.C0 = c0 return weld end local modelzorz = Instance.new("Model") modelzorz.Parent = Character modelzorz.Name = "Warden Claws" local prt1=part(1,modelzorz,0,0,BrickColor.new("Black"),"Part1",vt(1,1,1)) local prt2=part(1,modelzorz,0,0,BrickColor.new("Really black"),"Part2",vt(1,1,1)) local prt3=part(1,modelzorz,0,0,BrickColor.new("Black"),"Part3",vt(1,1,1)) local prt4=part(1,modelzorz,0,0,BrickColor.new("Really black"),"Part4",vt(1,1,1)) local prt5=part(1,modelzorz,0,0,BrickColor.new("Black"),"Part5",vt(1,1,1)) local prt6=part(1,modelzorz,0,0,BrickColor.new("Really black"),"Part6",vt(1,1,1)) local prt7=part(1,modelzorz,0,0,BrickColor.new("Black"),"Part7",vt(1,1,1)) local prt8=part(1,modelzorz,0,0,BrickColor.new("Really black"),"Part8",vt(1,1,1)) local prt9=part(1,modelzorz,0,0,BrickColor.new("Black"),"Part9",vt(1,1,1)) local prt10=part(1,modelzorz,0,0,BrickColor.new("Really black"),"Part10",vt(1,1,1)) local prt11=part(1,modelzorz,0,0,BrickColor.new("Black"),"Part11",vt(1,1,1)) local prt12=part(1,modelzorz,0,0,BrickColor.new("Really black"),"Part12",vt(1,1,1)) local msh1=mesh("BlockMesh",prt1,"","",vt(0,0,0),vt(0.2,1,0.1)) local msh2=mesh("SpecialMesh",prt2,"Wedge","",vt(0,0,0),vt(0.1,0.2,0.2)) local msh3=mesh("BlockMesh",prt3,"","",vt(0,0,0),vt(0.2,1,0.1)) local msh4=mesh("SpecialMesh",prt4,"Wedge","",vt(0,0,0),vt(0.1,0.2,0.2)) local msh5=mesh("BlockMesh",prt5,"","",vt(0,0,0),vt(0.2,1,0.1)) local msh6=mesh("SpecialMesh",prt6,"Wedge","",vt(0,0,0),vt(0.1,0.2,0.2)) local msh7=mesh("BlockMesh",prt7,"","",vt(0,0,0),vt(0.2,1,0.1)) local msh8=mesh("SpecialMesh",prt8,"Wedge","",vt(0,0,0),vt(0.1,0.2,0.2)) local msh9=mesh("BlockMesh",prt9,"","",vt(0,0,0),vt(0.2,1,0.1)) local msh10=mesh("SpecialMesh",prt10,"Wedge","",vt(0,0,0),vt(0.1,0.2,0.2)) local msh11=mesh("BlockMesh",prt11,"","",vt(0,0,0),vt(0.2,1,0.1)) local msh12=mesh("SpecialMesh",prt12,"Wedge","",vt(0,0,0),vt(0.1,0.2,0.2)) local wld1=weld(prt1,prt1,LeftArm,euler(0,0,0)*cf(0.41,1,0.4)) local wld2=weld(prt2,prt2,prt1,euler(0,1.57,3.14)*cf(0,0.715,0)) local wld3=weld(prt3,prt3,LeftArm,euler(0,0,0)*cf(0.41,1,0)) local wld4=weld(prt4,prt4,prt3,euler(0,1.57,3.14)*cf(0,0.715,0)) local wld5=weld(prt5,prt5,LeftArm,euler(0,0,0)*cf(0.41,1,-0.4)) local wld6=weld(prt6,prt6,prt5,euler(0,1.57,3.14)*cf(0,0.715,0)) local wld7=weld(prt7,prt7,RightArm,euler(0,0,0)*cf(-0.41,1,0.4)) local wld8=weld(prt8,prt8,prt7,euler(0,-1.57,3.14)*cf(0,0.715,0)) local wld9=weld(prt9,prt9,RightArm,euler(0,0,0)*cf(-0.41,1,0)) local wld10=weld(prt10,prt10,prt9,euler(0,-1.57,3.14)*cf(0,0.715,0)) local wld11=weld(prt11,prt11,RightArm,euler(0,0,0)*cf(-0.41,1,-0.4)) local wld12=weld(prt12,prt12,prt11,euler(0,-1.57,3.14)*cf(0,0.715,0)) local Avatar=Instance.new("Model") Avatar.Parent=modelzorz Avatar.Name="Shadow" local aroot=part(1,Avatar,0,1,BrickColor.new("Black"),"RootPart2",vt(1,1,1)) local aprt1=part(1,Avatar,0,1,BrickColor.new("Black"),"Torso",vt(1,1,1)) local aprt2=part(1,Avatar,0,0.5,BrickColor.new("Black"),"Head",vt(1,1,1)) local aprt3=part(1,Avatar,0,0.5,BrickColor.new("Black"),"Left Arm",vt(1,1,1)) local aprt4=part(1,Avatar,0,1,BrickColor.new("Black"),"Right Arm",vt(1,1,1)) local aprt5=part(1,Avatar,0,0.5,BrickColor.new("Black"),"Claw1",vt(1,1,1)) local aprt6=part(1,Avatar,0,0.5,BrickColor.new("Black"),"Claw1.1",vt(1,1,1)) local aprt7=part(1,Avatar,0,0.5,BrickColor.new("Black"),"Claw2",vt(1,1,1)) local aprt8=part(1,Avatar,0,0.5,BrickColor.new("Black"),"Claw2.1",vt(1,1,1)) local aprt9=part(1,Avatar,0,0.5,BrickColor.new("Black"),"Claw3",vt(1,1,1)) local aprt10=part(1,Avatar,0,0.5,BrickColor.new("Black"),"Claw3.1",vt(1,1,1)) local aprt11=part(1,Avatar,0,1,BrickColor.new("Black"),"Left Arm Hit",vt(1,1,1)) local arootmsh=mesh("BlockMesh",aroot,"","",vt(0,0,0),vt(2,2,1)) local amsh1=mesh("BlockMesh",aprt1,"","",vt(0,0,0),vt(4,4,2)) local amsh2=mesh("SpecialMesh",aprt2,"Head","",vt(0,0,0),vt(2.5,2,2.5)) local amsh3=mesh("BlockMesh",aprt3,"","",vt(0,0,0),vt(2,4,2)) local amsh4=mesh("BlockMesh",aprt4,"","",vt(0,0,0),vt(2,4,2)) local amsh5=mesh("BlockMesh",aprt5,"","",vt(0,0,0),vt(0.3,1.5,0.1)) local amsh6=mesh("SpecialMesh",aprt6,"Wedge","",vt(0,0,0),vt(0.1,0.3,0.3)) local amsh7=mesh("BlockMesh",aprt7,"","",vt(0,0,0),vt(0.3,1.5,0.1)) local amsh8=mesh("SpecialMesh",aprt8,"Wedge","",vt(0,0,0),vt(0.1,0.3,0.3)) local amsh9=mesh("BlockMesh",aprt9,"","",vt(0,0,0),vt(0.3,1.5,0.1)) local amsh10=mesh("SpecialMesh",aprt10,"Wedge","",vt(0,0,0),vt(0.1,0.3,0.3)) local amsh11=mesh("BlockMesh",aprt11,"","",vt(0,0,0),vt(1,1,1)) Avatar:BreakJoints() local arwld=weld(aroot,aroot,RootPart,euler(0,0,0)*cf(0,0,0)) local awld1=weld(aprt1,aprt1,aroot,euler(0,0,0)*cf(0,-3,-2)) local awld2=weld(aprt2,aprt2,aprt1,neckoav) awld2.C1=neckoav2 local awld3=weld(aprt3,aprt1,aprt3,cf(3,1,0)*euler(0,0,0)) awld3.C1=cf(0,1,0) local awld4=weld(aprt4,aprt1,aprt4,cf(-3,1,0)*euler(0,0,0)) awld4.C1=cf(0,1,0) local awld5=weld(aprt5,aprt5,aprt3,euler(0,0,0)*cf(-0.8,2.5,-0.6)) local awld6=weld(aprt6,aprt6,aprt5,euler(0,-1.57,3.14)*cf(0,1.05,0)) local awld7=weld(aprt7,aprt7,aprt3,euler(0,0,0)*cf(-0.8,2.5,0)) local awld8=weld(aprt8,aprt8,aprt7,euler(0,-1.57,3.14)*cf(0,1.05,0)) local awld9=weld(aprt9,aprt9,aprt3,euler(0,0,0)*cf(-0.8,2.5,0.6)) local awld10=weld(aprt10,aprt10,aprt9,euler(0,-1.57,3.14)*cf(0,1.05,0)) local awld11=weld(aprt11,aprt11,aprt4,euler(1.57,0,0)*cf(0,2,0)) numb=-1.8 numb2=0.8 for i=1,5 do local aprt12=part(1,Avatar,0,numb2,BrickColor.new("Black"),"Left Arm Fade",vt(1,1,1)) local amsh12=mesh("BlockMesh",aprt12,"","",vt(0,0,0),vt(2,1,2)) local awld12=weld(aprt12,aprt12,aprt4,cf(0,numb,0)) numb=numb+1.2 numb2=numb2+0.05 end local aprt14=part(1,Avatar,0,0.5,BrickColor.new("Black"),"Torso Fade1",vt(1,1,1)) local amsh14=mesh("BlockMesh",aprt14,"","",vt(0,0,0),vt(4,2,2)) local awld14=weld(aprt14,aprt14,aprt1,cf(0,-1.2,0)) numb=0.2 numb2=0.8 for i=1,5 do local aprt13=part(1,Avatar,0,numb2,BrickColor.new("Black"),"Torso Fade2",vt(1,1,1)) local amsh13=mesh("BlockMesh",aprt13,"","",vt(0,0,0),vt(4,0.5,2)) local awld13=weld(aprt13,aprt13,aprt1,cf(0,numb,0)) numb=numb+0.5 numb2=numb2+0.05 end coroutine.resume(coroutine.create(function() wait(1) for i=0,1,0.1 do wait() awld2.C0=neckoav*euler(-0.5*i,0,0) awld3.C0=cf(3,1,0)*euler(-0.5*i,0,0) awld3.C1=cf(0,1,0)*euler(0,0,-0.7*i) awld4.C0=cf(-3,1,0)*euler(-0.5*i,0,0) awld4.C1=cf(0,1,0)*euler(0,0,0.7*i) end end)) shadowfollowing=false shadowgyro="TrueAim" aroot.CFrame=Torso.CFrame BodPos=Instance.new("BodyPosition") BodPos.P=50000 BodPos.D=1000 BodPos.maxForce=Vector3.new(math.huge,math.huge,math.huge) BodPos.position=Torso.Position BodPos.Parent=aroot BodPos.Parent=nil BodGy = it("BodyGyro") BodGy.maxTorque = vt(math.huge,math.huge,math.huge) BodGy.P = 20e+003 BodGy.Parent=aroot BodGy.cframe=Torso.CFrame BodGy.Parent=nil coroutine.resume(coroutine.create(function(BodyyPosition,BodyGyro) while true do wait() Avatar.Parent=modelzorz --awld1.C0=euler(0,0,0)*cf(0,-3,-2) if AvatarMode=="Follow" then BodyyPosition.P=50000 BodyyPosition.D=1000 BodyyPosition.position=RootPart.Position BodyGyro.cframe=Torso.CFrame --[[elseif AvatarMode=="Aim" then BodPos.P=1000 BodPos.D=100 coroutine.resume(coroutine.create(function(Gairo) while AvatarMode=="Aim" do wait() if TargetTorso.Parent==nil then AvatarMode="Follow" end if shadowgyro=="TrueAim" then Gairo.cframe=cf(aroot.Position,TargetTorso.Position) elseif shadowgyro=="YAim" then Gairo.cframe=cf(aroot.Position,TargetTorso.Position) end end end),BodyGyro) shadowdebounce=false if math.random(1,2)==1 then shadowfollowing=true BodyPosition.position=TargetTorso.Position shadowgyro="TrueAim" shadowcon=aroot.Touched:connect(function(hit) shadowattack=true if hit==TargetTorso then if shadowdebounce==false then shadowdebounce=true shadowgyro="YAim" shadowfollowing=false so("http://www.roblox.com/asset/?id=28144425",aprt3,1,1) avLastPoint=aprt6.CFrame*CFrame.new(0,aprt6.Size.Y/7,0) avLastPoint2=aprt8.CFrame*CFrame.new(0,aprt8.Size.Y/7,0) avLastPoint3=aprt10.CFrame*CFrame.new(0,aprt10.Size.Y/7,0) avcon1=aprt6.Touched:connect(function(hit) Damagefunc(hit,20,40,math.random(50,80),"Knockdown",aprt1) end) avcon2=aprt8.Touched:connect(function(hit) Damagefunc(hit,20,40,math.random(50,80),"Knockdown",aprt1) end) avcon3=aprt10.Touched:connect(function(hit) Damagefunc(hit,20,40,math.random(50,80),"Knockdown",aprt1) end) for i=0,1,0.1 do wait() awld1.C0=euler(0,-1*i,0)*cf(0,-3,-2) awld3.C0=cf(3-2*i,1,-0.5*i)*euler(-0.5+2.5*i,0,0) awld3.C1=cf(0,1,0)*euler(0,1*i,-0.7+1.4*i) AvatarClawEffect() end avcon1:disconnect() avcon2:disconnect() avcon3:disconnect() wait(0.5) for i=0,1,0.1 do wait() awld1.C0=euler(0,-1+1*i,0)*cf(0,-3,-2) awld3.C0=cf(1+2*i,1,-0.5+0.5*i)*euler(2-2.5*i,0,0) awld3.C1=cf(0,1,0)*euler(0,1-1*i,0.7-1.4*i) end end end shadowattack=false end) coroutine.resume(coroutine.create(function(Connect) while shadowgyro=="TrueAim" do wait() end print("DISCONNECT") Connect:disconnect() end),shadowcon) coroutine.resume(coroutine.create(function() wait(5) aroot.CFrame=TargetTorso.CFrame end)) while shadowfollowing==true do wait() BodyPosition.position=TargetTorso.Position end else shadowgyro="TrueAim" shadowattack=true for i=0,1,0.1 do wait() local pos5 = Vector3.new(TargetTorso.Position.X,aprt11.Position.Y,TargetTorso.Position.Z) offset=(aprt11.Position.y-TargetTorso.Position.Y)/60 mag=(aprt11.Position-TargetTorso.Position).magnitude/80 offset=offset/mag print(offset) awld1.C0=euler(0,1.57*i,0)*cf(0,-3,-2) awld4.C0=cf(-3,1,0)*euler(-0.5+0.5*i,0,(-1.57+offset)*i) awld4.C1=cf(0,1,0)*euler(0,0,0.7-0.7*i) end wait(0.3) shoottrail(aprt11,0) for i=1,6 do wait(0.1) shoottrail(aprt11,10) end for i=0,1,0.1 do wait() awld1.C0=euler(0,1.57-1.57*i,0)*cf(0,-3,-2) awld4.C0=cf(-3,1,0)*euler(-0.5*i,0,(-1.57+offset)+(1.57-offset)*i) awld4.C1=cf(0,1,0)*euler(0,0,0.7*i) end shadowattack=false end wait(2)]] else BodyyPosition.P=50000 BodyyPosition.D=1000 end end end),BodPos,BodGy) if (script.Parent.className ~= "HopperBin") then Tool = Instance.new("HopperBin") Tool.Parent = Backpack Tool.Name = "Warden Claws" script.Parent = Tool end Bin = script.Parent local Bg = it("BodyGyro") Bg.maxTorque = Vector3.new(4e+005,4e+005,4e+005)*math.huge Bg.P = 20e+003 Bg.Parent = nil so = function(id,par,vol,pit) coroutine.resume(coroutine.create(function() local sou = Instance.new("Sound",par or workspace) sou.Volume=vol sou.Pitch=pit or 1 sou.SoundId=id wait() sou:play() wait(6) sou:Remove() end)) end function hideanim() equipped=false Torso.Neck.C0=necko RootJoint.C0=RootCF end function equipanim() equipped=true Torso.Neck.C0=necko*euler(0.2,0,0) LW.C0=cf(-1.5,0.5,0)*euler(0,1.57,-0.2) LW.C1=cf(0,0.5,0)*euler(-0.2,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.2) RW.C1=cf(0,0.5,0)*euler(-0.2,0,0) end function attackone() attack=true for i=0,1,0.1 do wait() RootJoint.C0=RootCF*euler(0,0,0.8*i) Torso.Neck.C0=necko*euler(0.2,0,-0.8*i) LW.C0=cf(-1.5,0.5,0)*euler(0,1.57,-0.2+0.2*i) LW.C1=cf(0,0.5,0)*euler(-0.2-1.37*i,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.2-0.2*i) RW.C1=cf(0,0.5,0)*euler(-0.2-0.2*i,0,0) end LastPoint=prt2.CFrame*CFrame.new(0,prt2.Size.Y/7,0) LastPoint2=prt4.CFrame*CFrame.new(0,prt4.Size.Y/7,0) LastPoint3=prt6.CFrame*CFrame.new(0,prt6.Size.Y/7,0) --so("http://www.roblox.com/asset/?id=28144425",prt4,1,1.5) con1=prt4.Touched:connect(function(hit) Damagefunc(hit,10,20,nil,"Snare") end) so("http://www.roblox.com/Asset?ID=92597369",prt4,1,1) for i=0,1,0.2 do wait() RootJoint.C0=RootCF*euler(0,0,0.8-2*i) Torso.Neck.C0=necko*euler(0.2,0,-0.8+2*i) LW.C0=cf(-1.5,0.5,0)*euler(0,1.57-0.2*i,0) LW.C1=cf(0,0.5,0)*euler(-1.57,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0) RW.C1=cf(0,0.5,0)*euler(-0.4,0,0) LeftClawEffect() end for i=0,1,0.2 do wait() RootJoint.C0=RootCF*euler(0,0,-1.2-0.3*i) Torso.Neck.C0=necko*euler(0.2,0,1.2+0.3*i) LW.C0=cf(-1.5,0.5,0)*euler(0,1.37-0.17*i,0) LW.C1=cf(0,0.5,0)*euler(-1.57,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0) RW.C1=cf(0,0.5,0)*euler(-0.4,0,0) LeftClawEffect() end con1:disconnect() attack=false end function attacktwo() attack=true rLastPoint=prt8.CFrame*CFrame.new(0,prt8.Size.Y/7,0) rLastPoint2=prt10.CFrame*CFrame.new(0,prt10.Size.Y/7,0) rLastPoint3=prt12.CFrame*CFrame.new(0,prt12.Size.Y/7,0) con1=prt10.Touched:connect(function(hit) Damagefunc(hit,5,30,nil,"Snare") end) so("http://www.roblox.com/Asset?ID=92597369",prt10,1,0.8) for i=0,1,0.2 do wait() RootJoint.C0=RootCF*euler(0,0,-1.5+2*i) Torso.Neck.C0=necko*euler(0.2,0,1.5-2*i) LW.C0=cf(-1.5,0.5,0)*euler(0,1.2,0) LW.C1=cf(0,0.5,0)*euler(-1.57,0,0) RW.C0=cf(1.5-0.5*i,0.5,-0.5*i)*euler(0,-1.57-1*i,-2*i) RW.C1=cf(0,0.5,0)*euler(-0.4+1*i,0,0) RightClawEffect() end con1:disconnect() attack=false end function attackthree() attack=true for i=0,1,0.2 do wait() RootJoint.C0=RootCF*euler(0,0,0.5-0.5*i) Torso.Neck.C0=necko*euler(0.2,0,-0.5+0.5*i) LW.C0=cf(-1.5,0.5,0)*euler(0,1.2+0.37*i,0) LW.C1=cf(0,0.5,0)*euler(-1.57,0,0) RW.C0=cf(1+0.5*i,0.5,-0.5+0.5*i)*euler(0,-2.57+1*i,-2+2*i) RW.C1=cf(0,0.5,0)*euler(0.6-2.17*i,0,3.14*i) end LastPoint=prt2.CFrame*CFrame.new(0,prt2.Size.Y/7,0) LastPoint2=prt4.CFrame*CFrame.new(0,prt4.Size.Y/7,0) LastPoint3=prt6.CFrame*CFrame.new(0,prt6.Size.Y/7,0) rLastPoint=prt8.CFrame*CFrame.new(0,prt8.Size.Y/7,0) rLastPoint2=prt10.CFrame*CFrame.new(0,prt10.Size.Y/7,0) rLastPoint3=prt12.CFrame*CFrame.new(0,prt12.Size.Y/7,0) con1=prt4.Touched:connect(function(hit) Damagefunc(hit,5,10,nil,"Snare") end) con2=prt10.Touched:connect(function(hit) Damagefunc(hit,5,10,nil,"Snare") end) for i=1,2 do so("http://www.roblox.com/Asset?ID=92597369",Torso,1,1.1) for i=0,1,0.3 do wait() RootJoint.C0=RootCF*euler(0,0,-3.14*i) LeftClawEffect() RightClawEffect() end so("http://www.roblox.com/Asset?ID=92597369",Torso,1,1.2) for i=0,1,0.3 do wait() RootJoint.C0=RootCF*euler(0,0,-3.14-3.14*i) LeftClawEffect() RightClawEffect() end end con1:disconnect() con2:disconnect() RootJoint.C0=RootCF*euler(0,0,0) attack=false end function LifeSteal() attack=true lifestolen=false for i=0,1,0.1 do wait() RootJoint.C0=RootCF*euler(0,0,1*i) Torso.Neck.C0=necko*euler(0.2,0,-1*i) LW.C0=cf(-1.5+0.5*i,0.5,-0.5*i)*euler(0,1.57-3.14*i,-0.2+0.2*i) LW.C1=cf(0,0.5,0)*euler(-0.2-1*i,0,0.2*i) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.2) RW.C1=cf(0,0.5,0)*euler(-0.2-1*i,0,0) end wait(0.1) con1=prt4.Touched:connect(function(hit) Damagefunc(hit,20,30,0,"LifeSteal",nil) end) LastPoint=prt2.CFrame*CFrame.new(0,prt2.Size.Y/7,0) LastPoint2=prt4.CFrame*CFrame.new(0,prt4.Size.Y/7,0) LastPoint3=prt6.CFrame*CFrame.new(0,prt6.Size.Y/7,0) so("http://www.roblox.com/Asset?ID=92597369",prt4,1,1.2) for i=0,1,0.2 do wait() RootJoint.C0=RootCF*cf(0,-5*i,0)*euler(0,0,1-2.57*i) Torso.Neck.C0=necko*euler(0.2,0,-1+2.57*i) LW.C0=cf(-1-0.5*i,0.5,-0.5+0.5*i)*euler(0,-1.57,0) LW.C1=cf(0,0.5,0)*euler(-1.2-0.37*i,-3.14*i,0.2-0.2*i) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.2) RW.C1=cf(0,0.5,0)*euler(-1.2,0,0) LeftClawEffect() end con1:disconnect() for i=1,5 do if combomove==false then wait(0.1) end end if lifestolen==false then cancombo=false for i=0,1,0.1 do wait() RootJoint.C0=RootCF*cf(0,-5+5*i,0)*euler(0,0,-1.57+1.57*i) Torso.Neck.C0=necko*euler(0.2,0,1.57-1.57*i) LW.C0=cf(-1.5,0.5,0)*euler(0,-1.57+3.14*i,-0.2*i) LW.C1=cf(0,0.5,0)*euler(-1.57+1.37*i,-3.14+3.14*i,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.2) RW.C1=cf(0,0.5,0)*euler(-1.2+1*i,0,0) end attack=false else cancombo=false if combomove==false then for i=0,1,0.2 do wait() RootJoint.C0=RootCF*cf(0,-5+5*i,0)*euler(0,0,-1.57+2.57*i) Torso.Neck.C0=necko*euler(0.2,0,1.57-2.57*i) LW.C0=cf(-1.5+0.5*i,0.5,-0.5*i)*euler(0,-1.57,0) LW.C1=cf(0,0.5,0)*euler(-1.57,-3.14+2.57*i,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.2) RW.C1=cf(0,0.5,0)*euler(-1.2,0,0) LeftClawEffectRed() end wait(0.5) for i=0,1,0.1 do wait() RootJoint.C0=RootCF*euler(0,0,1-1*i) Torso.Neck.C0=necko*euler(0.2,0,-1+1*i) LW.C0=cf(-1-0.5*i,0.5,-0.5+0.5*i)*euler(0,-1.57+3.14*i,-0.2*i) LW.C1=cf(0,0.5,0)*euler(-1.2+1*i,-0.57+0.57*i,0.2-0.2*i) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.2) RW.C1=cf(0,0.5,0)*euler(-1.2+1*i,0,0) end end attack=false end end function LifeStealCombo() attack=true con2=prt10.Touched:connect(function(hit) Damagefunc(hit,10,20,60,"Knockdown",Torso) end) rLastPoint=prt8.CFrame*CFrame.new(0,prt8.Size.Y/7,0) rLastPoint2=prt10.CFrame*CFrame.new(0,prt10.Size.Y/7,0) rLastPoint3=prt12.CFrame*CFrame.new(0,prt12.Size.Y/7,0) so("http://www.roblox.com/Asset?ID=92597369",prt10,1,1.4) for i=0,1,0.2 do wait() attack=true RootJoint.C0=RootCF*cf(0,-5,0)*euler(0,0,-1.57+3.14*i) Torso.Neck.C0=necko*euler(0.2,0,1.57) LW.C0=cf(-1.5,0.5,0)*euler(0,-1.57,0) LW.C1=cf(0,0.5,0)*euler(-1.57+1.37*i,-3.14,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.2-0.2*i) RW.C1=cf(0,0.5,0)*euler(-1.2-0.37*i,0,0) RightClawEffect() end for i=0,1,0.2 do wait() attack=true RootJoint.C0=RootCF*cf(0,-5+2*i,0)*euler(0,0,1.57+1.57*i) Torso.Neck.C0=necko*euler(0.2,0,1.57-1.57*i) LW.C0=cf(-1.5,0.5,0)*euler(0,-1.57,0) LW.C1=cf(0,0.5,0)*euler(-0.2,-3.14,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0) RW.C1=cf(0,0.5,0)*euler(-1.57,0,0) RightClawEffect() end con2:disconnect() for i=0,1,0.1 do wait() RootJoint.C0=RootCF*cf(0,-3+3*i,0)*euler(0,0,3.14+3.14*i) Torso.Neck.C0=necko*euler(0.2,0,0) LW.C0=cf(-1.5,0.5,0)*euler(0,-1.57,0) LW.C1=cf(0,0.5,0)*euler(-0.2,-3.14,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0) RW.C1=cf(0,0.5,0)*euler(-1.57+1.37*i,0,0) end wait(0.5) combomove=false attack=false end function Raise() attack=true for i=0,1,0.1 do wait() RootJoint.C0=RootCF Torso.Neck.C0=necko*euler(0.2+0.1*i,0,0) LW.C0=cf(-1.5,0.5,0)*euler(0,1.57,-0.2-0.1*i) LW.C1=cf(0,0.5,0)*euler(-0.2+0.1*i,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.2+0.1*i) RW.C1=cf(0,0.5,0)*euler(-0.2+0.1*i,0,0) end LastPoint=prt2.CFrame*CFrame.new(0,prt2.Size.Y/7,0) LastPoint2=prt4.CFrame*CFrame.new(0,prt4.Size.Y/7,0) LastPoint3=prt6.CFrame*CFrame.new(0,prt6.Size.Y/7,0) rLastPoint=prt8.CFrame*CFrame.new(0,prt8.Size.Y/7,0) rLastPoint2=prt10.CFrame*CFrame.new(0,prt10.Size.Y/7,0) rLastPoint3=prt12.CFrame*CFrame.new(0,prt12.Size.Y/7,0) con1=prt4.Touched:connect(function(hit) Damagefunc(hit,5,10,0,"Up",Torso) end) con2=prt10.Touched:connect(function(hit) Damagefunc(hit,5,10,0,"Up",Torso) end) so("http://www.roblox.com/Asset?ID=92597369",Torso,1,0.9) for i=0,1,0.2 do wait() RootJoint.C0=RootCF Torso.Neck.C0=necko*euler(0.3-0.6*i,0,0) LW.C0=cf(-1.5,0.5,0)*euler(0,1.57,-0.3+2.8*i) LW.C1=cf(0,0.5,0)*euler(-0.1+0.1*i,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.3-2.8*i) RW.C1=cf(0,0.5,0)*euler(-0.1+0.1*i,0,0) LeftClawEffect() RightClawEffect() end con1:disconnect() con2:disconnect() for i=0,1,0.2 do wait() Torso.Neck.C0=necko*euler(-0.3-0.1*i,0,0) LW.C0=cf(-1.5,0.5,0)*euler(0,1.57,2.5+0.1*i) LW.C1=cf(0,0.5,0)*euler(0,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,-2.5-0.1*i) RW.C1=cf(0,0.5,0)*euler(0,0,0) LeftClawEffect() RightClawEffect() end cancombo=true for i=1,2 do if combomove==false then wait(0.1) end end if combomove==false then for i=0,1,0.1 do wait() Torso.Neck.C0=necko*euler(-0.4+0.6*i,0,0) LW.C0=cf(-1.5,0.5,0)*euler(0,1.57,2.6-2.8*i) LW.C1=cf(0,0.5,0)*euler(-0.2*i,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,-2.6+2.8*i) RW.C1=cf(0,0.5,0)*euler(-0.2*i,0,0) end attack=false cancombo=false end end function RaiseCombo() attack=true bp2=Instance.new("BodyPosition") bp2.P=2000 bp2.D=100 bp2.maxForce=Vector3.new(math.huge,math.huge,math.huge) bp2.position=Torso.Position+vt(0,20,0) bp2.Parent=Torso for i=0,1,0.2 do wait() attack=true Torso.Neck.C0=necko*euler(-0.4,0,0) LW.C0=cf(-1.5,0.5,0)*euler(0,1.57-3.14*i,2.6) LW.C1=cf(0,0.5,0)*euler(0,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57+3.14*i,-2.6) RW.C1=cf(0,0.5,0)*euler(0,0,0) end bp2.Parent=nil LastPoint=prt2.CFrame*CFrame.new(0,prt2.Size.Y/7,0) LastPoint2=prt4.CFrame*CFrame.new(0,prt4.Size.Y/7,0) LastPoint3=prt6.CFrame*CFrame.new(0,prt6.Size.Y/7,0) rLastPoint=prt8.CFrame*CFrame.new(0,prt8.Size.Y/7,0) rLastPoint2=prt10.CFrame*CFrame.new(0,prt10.Size.Y/7,0) rLastPoint3=prt12.CFrame*CFrame.new(0,prt12.Size.Y/7,0) con1=prt4.Touched:connect(function(hit) Damagefunc(hit,10,15,50,"Knockdown",Torso) end) con2=prt10.Touched:connect(function(hit) Damagefunc(hit,10,15,50,"Knockdown",Torso) end) so("http://www.roblox.com/Asset?ID=92597369",Torso,1,0.7) for i=0,1,0.1 do wait() attack=true Torso.Neck.C0=necko*euler(-0.4+0.6*i,0,0) LW.C0=cf(-1.5,0.5,0)*euler(0,-1.57,2.6+4*i) LW.C1=cf(0,0.5,0)*euler(0,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,1.57,-2.6-4*i) RW.C1=cf(0,0.5,0)*euler(0,0,0) LeftClawEffect() RightClawEffect() end con1:disconnect() con2:disconnect() for i=0,1,0.1 do wait() attack=true Torso.Neck.C0=necko*euler(0.2,0,0) LW.C0=cf(-1.5,0.5,0)*euler(0,-1.57+3.14*i,0.1-0.3*i) LW.C1=cf(0,0.5,0)*euler(-0.2*i,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,1.57-3.14*i,-0.1+0.3*i) RW.C1=cf(0,0.5,0)*euler(-0.2*i,0,0) end wait(0.5) combomove=false attack=false end function ChangeAvatarMode(Mode) attack=true for i=0,1,0.1 do wait() Torso.Neck.C0=necko*euler(0.2-0.8*i,0,0) LW.C0=cf(-1.5+0.5*i,0.5,-0.5*i)*euler(3*i,1.57-1.57*i,-0.2+0.8*i) LW.C1=cf(0,0.5,0)*euler(-0.2+0.2*i,0,0) RW.C0=cf(1.5-0.5*i,0.5,-0.5*i)*euler(3*i,-1.57+1.57*i,0.2-0.8*i) RW.C1=cf(0,0.5,0)*euler(-0.2+0.2*i,0,0) end MagicCircle(BrickColor.new("Black"),prt4.CFrame,1,1,1,0.5,0.5,0.5,0.05) MagicCircle(BrickColor.new("Black"),prt10.CFrame,1,1,1,0.5,0.5,0.5,0.05) AvatarMode=Mode wait(0.5) for i=0,1,0.1 do wait() Torso.Neck.C0=necko*euler(-0.6+0.8*i,0,0) LW.C0=cf(-1-0.5*i,0.5,-0.5+0.5*i)*euler(3-3*i,1.57*i,0.6-0.8*i) LW.C1=cf(0,0.5,0)*euler(-0.2*i,0,0) RW.C0=cf(1+0.5*i,0.5,-0.5+0.5*i)*euler(3-3*i,-1.57*i,-0.6+0.8*i) RW.C1=cf(0,0.5,0)*euler(-0.2*i,0,0) end attack=false end function ShadowSlash() shadowattack=true so("http://www.roblox.com/asset/?id=28144425",aprt3,1,1) avLastPoint=aprt6.CFrame*CFrame.new(0,aprt6.Size.Y/7,0) avLastPoint2=aprt8.CFrame*CFrame.new(0,aprt8.Size.Y/7,0) avLastPoint3=aprt10.CFrame*CFrame.new(0,aprt10.Size.Y/7,0) avcon1=aprt6.Touched:connect(function(hit) Damagefunc(hit,20,40,math.random(50,80),"Knockdown",aprt1) end) avcon2=aprt8.Touched:connect(function(hit) Damagefunc(hit,20,40,math.random(50,80),"Knockdown",aprt1) end) avcon3=aprt10.Touched:connect(function(hit) Damagefunc(hit,20,40,math.random(50,80),"Knockdown",aprt1) end) for i=0,1,0.1 do wait() awld1.C0=euler(0,-1*i,0)*cf(0,-3,-2) awld3.C0=cf(3-2*i,1,-0.5*i)*euler(-0.5+2.5*i,0,0) awld3.C1=cf(0,1,0)*euler(0,1*i,-0.7+1.4*i) AvatarClawEffect() end avcon1:disconnect() avcon2:disconnect() avcon3:disconnect() wait(0.5) for i=0,1,0.1 do wait() awld1.C0=euler(0,-1+1*i,0)*cf(0,-3,-2) awld3.C0=cf(1+2*i,1,-0.5+0.5*i)*euler(2-2.5*i,0,0) awld3.C1=cf(0,1,0)*euler(0,1-1*i,0.7-1.4*i) end shadowattack=false end function ShadowDash() shadowattack=true for i=0,1,0.1 do wait() awld1.C0=euler(0,-1*i,0)*cf(0,-3,-2) awld3.C0=cf(3,1,0)*euler(-0.5+0.5*i,0,0) awld3.C1=cf(0,1,0)*euler(0,2.5*i,-0.7+0.5*i) end so("http://www.roblox.com/asset/?id=28144425",aprt3,1,0.9) avLastPoint=aprt6.CFrame*CFrame.new(0,aprt6.Size.Y/7,0) avLastPoint2=aprt8.CFrame*CFrame.new(0,aprt8.Size.Y/7,0) avLastPoint3=aprt10.CFrame*CFrame.new(0,aprt10.Size.Y/7,0) avcon1=aprt6.Touched:connect(function(hit) Damagefunc(hit,20,30,math.random(50,80),"Snare",aprt1) end) avcon2=aprt8.Touched:connect(function(hit) Damagefunc(hit,20,30,math.random(50,80),"Snare",aprt1) end) avcon3=aprt10.Touched:connect(function(hit) Damagefunc(hit,20,30,math.random(50,80),"Snare",aprt1) end) for i=0,1,0.1 do wait() awld1.C0=euler(0,-1-0.6*i,0)*cf(0,-3+1*i,-2+6*i) awld3.C0=cf(3,1,0)*euler(0,0,0) awld3.C1=cf(0,1,0)*euler(0.5*i,2.5+0.5*i,-0.2-1.5*i) AvatarClawEffect() end avcon1:disconnect() avcon2:disconnect() avcon3:disconnect() wait(0.2) for i=0,1,0.1 do wait() awld1.C0=euler(0,-1.6+1.6*i,0)*cf(0,-2-1*i,-2+6-6*i) awld3.C0=cf(3,1,0)*euler(-0.5*i,0,0) awld3.C1=cf(0,1,0)*euler(0.5-0.5*i,3-3*i,-1.7+1*i) end shadowattack=false end function ShadowExplode() shadowattack=true for i=0,1,0.1 do wait() awld3.C0=cf(3,1,-0.5*i)*euler(-0.5+1.7*i,0,0) awld3.C1=cf(0,1,0)*euler(0,0,-0.7+1.4*i) awld4.C0=cf(-3,1,-0.5*i)*euler(-0.5+1.7*i,0,0) awld4.C1=cf(0,1,0)*euler(0,0,0.7-1.4*i) end local boom=part(3,workspace,0,0,BrickColor.new("Black"),"Effect",vt(0.5,0.5,0.5)) boom.Anchored=true boom.CFrame=aprt1.CFrame*cf(0,0,-4) so("http://roblox.com/asset/?id=10209624",boom,0.1,.75) so("http://www.roblox.com/asset/?id=2101137",boom,1,0.3) --s.SoundId="http://www.roblox.com/asset/?id=3264793" game:GetService("Debris"):AddItem(boom,10) coroutine.resume(coroutine.create(function() for i=0,1,0.01 do wait() awld3.C0=cf(3,1+0.5*i,-0.5+0.5*i)*euler(1.5,0,0) awld3.C1=cf(0,1,0)*euler(0,0,0.7-2.27*i) awld4.C0=cf(-3,1+0.5*i,-0.5+0.5*i)*euler(1.5,0,0) awld4.C1=cf(0,1,0)*euler(0,0,-0.7+2.27*i) end end)) numb=0.01 for i=1,100 do wait() MagicCircle(BrickColor.new("Black"),boom.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))*cf(0,5,0),1,1,1,0.02,0.5,0.02,0.05) MagicBlock(BrickColor.new("Black"),boom.CFrame,1,1,1,numb,numb,numb) numb=numb+0.01 end so("http://www.roblox.com/asset/?id=3264793",boom,0.5,0.5) so("http://roblox.com/asset/?id=144844438",boom,1,1) so("http://www.roblox.com/asset/?id=2974249",boom,1,0.7) shadowattack=false end function ShadowShoot() shadowattack=true for i=0,1,0.1 do wait() local pos5 = Vector3.new(MMouse.Hit.p.x,aroot.Position.Y,MMouse.Hit.p.z) offset=(aroot.Position.y-MMouse.Hit.p.y)/60 mag=(aroot.Position-MMouse.Hit.p).magnitude/80 offset=offset/mag awld1.C0=euler(0,1.57*i,0)*cf(0,-3,-2) awld4.C0=cf(-3,1,0)*euler(-0.5+0.5*i,0,(-1.57+offset)*i) awld4.C1=cf(0,1,0)*euler(0,0,0.7-0.7*i) end wait(0.1) shoottrail(aprt11,0) for i=0,1,0.1 do wait() awld1.C0=euler(0,1.57-1.57*i,0)*cf(0,-3,-2) awld4.C0=cf(-3,1,0)*euler(-0.5*i,0,(-1.57+offset)+(1.57-offset)*i) awld4.C1=cf(0,1,0)*euler(0,0,0.7*i) end shadowattack=false end function ShadowWave() shadowattack=true for i=0,1,0.1 do wait() awld1.C0=euler(0,1.57*i,0)*cf(0,-3,-2) awld4.C0=cf(-3,1,0)*euler(-0.5+0.5*i,0,-1*i) awld4.C1=cf(0,1,0)*euler(0,0,0.7-0.7*i) end local bprt=part(3,workspace,0,1,BrickColor.new("Black"),"Effect",vt(0.5,0.5,0.5)) bprt.Anchored=true bprt.CFrame=Torso.CFrame*cf(0,-2.7,-5) local bmsh=mesh("CylinderMesh",bprt,"","",vt(0,0,0),vt(5,1,5)) coroutine.resume(coroutine.create(function(Part,Mesh) for i=1,0.5,-0.1 do wait() Part.Transparency=i end end),bprt) game:GetService("Debris"):AddItem(bprt,5) for i=0,1,0.05 do wait() awld1.C0=euler(0,1.57,0)*cf(0,-3,-2) awld4.C0=cf(-3,1+1*i,0)*euler(0,0,-1-1*i) awld4.C1=cf(0,1,0)*euler(0,0,0) end shadowattack=false end function rayCast(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore) end function effect(Color,Ref,LP,P1,returnn) local effectsmsh = Instance.new("BlockMesh") effectsmsh.Scale = Vector3.new(0.2,1,0.2) effectsmsh.Name = "Mesh" local effectsg = Instance.new("Part") effectsg.formFactor = 3 effectsg.CanCollide = false effectsg.Name = "Eff" effectsg.Locked = true effectsg.Anchored = true effectsg.Size = Vector3.new(0.5,1,0.5) effectsg.Parent = workspace effectsmsh.Parent = effectsg effectsg.BrickColor = BrickColor.new(Color) effectsg.Reflectance = Ref local point1 = P1 local mg = (LP.p - point1.p).magnitude effectsg.Size = Vector3.new(0.5,mg,0.5) effectsg.CFrame = CFrame.new((LP.p+point1.p)/2,point1.p) * CFrame.Angles(math.rad(90),0,0) effectsmsh.Scale = Vector3.new(0.2,1,0.2) game:GetService("Debris"):AddItem(effectsg,2) if returnn then return effectsg end coroutine.resume(coroutine.create(function(Part,Mesh) if not returnn then for i = 0 , 1 , 0.1 do wait() Part.Transparency = 1*i Mesh.Scale = Vector3.new(0.2-0.2*i,1,0.2-0.2*i) end wait() Part.Parent = nil end end),effectsg,effectsmsh) end function LeftClawEffect() local Point=prt2.CFrame*CFrame.new(0,prt2.Size.Y/7,0) effect("Black",0.5,LastPoint,Point) LastPoint=Point local Point2=prt4.CFrame*CFrame.new(0,prt4.Size.Y/7,0) effect("Black",0.5,LastPoint2,Point2) LastPoint2=Point2 local Point3=prt6.CFrame*CFrame.new(0,prt6.Size.Y/7,0) effect("Black",0.5,LastPoint3,Point3) LastPoint3=Point3 end function LeftClawEffectRed() local Point=prt2.CFrame*CFrame.new(0,prt2.Size.Y/7,0) effect("Bright red",0.5,LastPoint,Point) LastPoint=Point local Point2=prt4.CFrame*CFrame.new(0,prt4.Size.Y/7,0) effect("Bright red",0.5,LastPoint2,Point2) LastPoint2=Point2 local Point3=prt6.CFrame*CFrame.new(0,prt6.Size.Y/7,0) effect("Bright red",0.5,LastPoint3,Point3) LastPoint3=Point3 end function RightClawEffect() local rPoint=prt8.CFrame*CFrame.new(0,prt8.Size.Y/7,0) effect("Black",0.5,rLastPoint,rPoint) rLastPoint=rPoint local rPoint2=prt10.CFrame*CFrame.new(0,prt10.Size.Y/7,0) effect("Black",0.5,rLastPoint2,rPoint2) rLastPoint2=rPoint2 local rPoint3=prt12.CFrame*CFrame.new(0,prt12.Size.Y/7,0) effect("Black",0.5,rLastPoint3,rPoint3) rLastPoint3=rPoint3 end function AvatarClawEffect() local avPoint=aprt6.CFrame*CFrame.new(0,aprt6.Size.Y/7,0) effect("Black",0.5,avLastPoint,avPoint) avLastPoint=avPoint local avPoint2=aprt8.CFrame*CFrame.new(0,aprt8.Size.Y/7,0) effect("Black",0.5,avLastPoint2,avPoint2) avLastPoint2=avPoint2 local avPoint3=aprt10.CFrame*CFrame.new(0,aprt10.Size.Y/7,0) effect("Black",0.5,avLastPoint3,avPoint3) avLastPoint3=avPoint3 MagicBlock(BrickColor.new("Black"),aprt6.CFrame,3,3,3,-0.5,-0.5,-0.5) MagicBlock(BrickColor.new("Black"),aprt8.CFrame,3,3,3,-0.5,-0.5,-0.5) MagicBlock(BrickColor.new("Black"),aprt10.CFrame,3,3,3,-0.5,-0.5,-0.5) end function ElecEffect(cff,x,y,z) local prt=part(3,workspace,0,0,BrickColor.new("White"),"Part",vt(1,1,1)) prt.Anchored=true xval=math.random() yval=math.random() zval=math.random() msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(xval,yval,zval)) coroutine.resume(coroutine.create(function(Part,Mesh,Frame,xvaal,yvaal,zvaal) Part.CFrame=Frame*cf(math.random(-x,x),math.random(-y,y),math.random(-z,z)) for i=1,8 do wait() xvaal=xvaal-0.1 yvaal=yvaal-0.1 zvaal=zvaal-0.1 Mesh.Scale=vt(xvaal,yvaal,zvaal) Part.Transparency=Part.Transparency+0.09 end Part.Parent=nil end),prt,msh,cff,xval,yval,zval) end function MagicBlock(brickcolor,cframe,x1,y1,z1,x3,y3,z3) local prt=part(3,workspace,0,0,brickcolor,"Effect",vt(0.5,0.5,0.5)) prt.Anchored=true prt.CFrame=cframe*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)) local msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(x1,y1,z1)) game:GetService("Debris"):AddItem(prt,2) coroutine.resume(coroutine.create(function(Part,Mesh) for i=0,1,0.1 do wait() Part.CFrame=Part.CFrame Part.Transparency=i Mesh.Scale=Mesh.Scale+vt(x3,y3,z3) end Part.Parent=nil end),prt,msh) end function MagicBlock2(brickcolor,cframe,x1,y1,z1,x3,y3,z3) local prt=part(3,workspace,0,0,brickcolor,"Effect",vt(0.5,0.5,0.5)) prt.Anchored=true prt.CFrame=cframe*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)) local msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(x1,y1,z1)) game:GetService("Debris"):AddItem(prt,2) CF=prt.CFrame num=math.random(5,20) coroutine.resume(coroutine.create(function(Part,Mesh,CF2,Num) for i=0,1.05,0.05 do wait() Part.CFrame=CF2*cf(0,i*Num,0)*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)) Part.Transparency=i Mesh.Scale=Mesh.Scale+vt(x3,y3,z3) end Part.Parent=nil end),prt,msh,CF,num) end function MagicCircle(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay) local prt=part(3,workspace,0,0,brickcolor,"Effect",vt(0.5,0.5,0.5)) prt.Anchored=true prt.CFrame=cframe local msh=mesh("SpecialMesh",prt,"Sphere","",vt(0,0,0),vt(x1,y1,z1)) game:GetService("Debris"):AddItem(prt,2) coroutine.resume(coroutine.create(function(Part,Mesh) for i=0,1,delay do wait() Part.CFrame=Part.CFrame Part.Transparency=i Mesh.Scale=Mesh.Scale+vt(x3,y3,z3) end Part.Parent=nil end),prt,msh) end function MagicRing(brickcolor,cframe,x1,y1,z1,x2,y2,z2,x3,y3,z3) local prt=part(3,workspace,0,0,brickcolor,"Effect",vt(0.5,0.5,0.5)) prt.Anchored=true prt.CFrame=cframe*euler(x2,y2,z2) local msh=mesh("SpecialMesh",prt,"FileMesh","http://www.roblox.com/asset/?id=3270017",vt(0,0,0),vt(x1,y1,z1)) game:GetService("Debris"):AddItem(prt,2) coroutine.resume(coroutine.create(function(Part,Mesh) for i=0,1,0.03 do wait() Part.CFrame=Part.CFrame Part.Transparency=i Mesh.Scale=Mesh.Scale+vt(x3,y3,z3) end Part.Parent=nil end),prt,msh) end function BreakEffect(brickcolor,cframe,x1,y1,z1) local prt=part(3,workspace,0,0,brickcolor,"Effect",vt(0.5,0.5,0.5)) prt.Anchored=true prt.CFrame=cframe*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)) local msh=mesh("SpecialMesh",prt,"Sphere","",vt(0,0,0),vt(x1,y1,z1)) game:GetService("Debris"):AddItem(prt,2) coroutine.resume(coroutine.create(function(Part,CF,Numbb,randnumb) CF=Part.CFrame Numbb=0 randnumb=math.random()-math.random() rand1=math.random()/5 for i=0,1,rand1 do wait() CF=CF*cf(0,1,0) --Part.CFrame=Part.CFrame*euler(0.5,0,0)*cf(0,1,0) Part.CFrame=CF*euler(Numbb,0,0) Part.Transparency=i Numbb=Numbb+randnumb end Part.Parent=nil end),prt,CF,Numbb,randnumb) end function MagicFreeze(brickcolor,cframe,x1,y1,z1,x3,y3,z3) local prt=part(3,workspace,0.4,0.3,brickcolor,"Effect",vt(0.5,0.5,0.5)) prt.Anchored=true prt.CFrame=cframe*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)) local msh=mesh("SpecialMesh",prt,"FileMesh","http://www.roblox.com/asset/?id=1778999",vt(0,0,0),vt(x1,y1,z1)) game:GetService("Debris"):AddItem(prt,2) coroutine.resume(coroutine.create(function(Part,Mesh) for i=0,1,0.1 do Part.CFrame=Part.CFrame*cf(0,0.3,0) Mesh.Scale=Mesh.Scale+vt(x3,y3,z3) end wait(5) Part.Parent=nil end),prt,msh) end function MagicFire(brickcolor,cframe,x1,y1,z1) local prt=part(3,workspace,0,0,brickcolor,"Effect",vt(0.5,0.5,0.5)) prt.Anchored=true prt.CFrame=cframe*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)) local msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(x1,y1,z1)) game:GetService("Debris"):AddItem(prt,2) coroutine.resume(coroutine.create(function(Part,Mesh) for i=0,1,0.1 do wait() Part.CFrame=cf(Part.Position+vt(0,0.5,0))*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)) Part.Transparency=i Mesh.Scale=Mesh.Scale+vt(0.1,0.1,0.1) end Part.Parent=nil end),prt,msh) end function LifeStealEffect(brickcolor,cframe,x1,y1,z1) local prt=part(3,workspace,0,0,brickcolor,"Effect",vt(0.5,0.5,0.5)) prt.Anchored=false prt.CFrame=cframe*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)) game:GetService("Debris"):AddItem(prt,4) local msh=mesh("SpecialMesh",prt,"Sphere","",vt(0,0,0),vt(x1,y1,z1)) bp=Instance.new("BodyPosition") bp.P=2000 bp.D=100 bp.maxForce=Vector3.new(math.huge,math.huge,math.huge) bp.position=prt.Position+vt(math.random(-5,5),math.random(0,5),math.random(-5,5)) bp.Parent=prt coroutine.resume(coroutine.create(function(Part) wait(1.5) MagicCircle(BrickColor.new("Bright red"),Part.CFrame,2,2,2,0.2,0.2,0.2,0.05) Part.Transparency=1 local pprt=part(3,workspace,0,0,brickcolor,"Effect",vt(0.5,0.5,0.5)) local mmsh=mesh("SpecialMesh",pprt,"Sphere","",vt(0,0,0),vt(1,1,1)) pprt.Anchored=true cnM = ((Torso.Position + Part.Position) / 2).Magnitude pprt.Size=Vector3.new(1,1,cnM) pprt.CFrame=cf(Torso.Position,Part.Position)*cf(0,0,-cnM/2) game:GetService("Debris"):AddItem(pprt,2) coroutine.resume(coroutine.create(function(Part,Mesh) for i=0,1,0.05 do wait() Part.Transparency=1*i Mesh.Scale=vt(0.5-0.5*i,0.5-0.5*i,1) end Part.Parent=nil end),pprt,mmsh) end),prt) --[[coroutine.resume(coroutine.create(function(Part,Mesh) for i=0,1,0.1 do wait() Part.CFrame=Part.CFrame Part.Transparency=i Mesh.Scale=Mesh.Scale+vt(x3,y3,z3) end Part.Parent=nil end),prt,msh)]] end range=300 rangepower=5 function shoottrail(baseprt,spread) so("http://www.roblox.com/asset/?id=2767090",baseprt,2,1) coroutine.resume(coroutine.create(function(v) local spreadvector = (vt(math.random(-spread,spread),math.random(-spread,spread),math.random(-spread,spread)) / 100) * (baseprt.Position).magnitude/100 local dir = aprt11.CFrame.lookVector+spreadvector local hit,pos = rayCast(baseprt.Position,dir,10,workspace) local rangepos = range local function drawtrail(From,To) local effectsmsh = Instance.new("CylinderMesh") effectsmsh.Scale = Vector3.new(1,1,1) effectsmsh.Name = "Mesh" local effectsg = Instance.new("Part") effectsg.Transparency = 1 effectsg.formFactor = 3 effectsg.CanCollide = false effectsg.Name = "Eff" effectsg.Locked = true effectsg.Anchored = true effectsg.Size = Vector3.new(0.2,0.2,0.2) effectsg.Parent = Avatar effectsmsh.Parent = effectsg game:GetService("Debris"):AddItem(effectsg,0.2) local LP = From local point1 = To local mg = (LP - point1).magnitude effectsg.CFrame = CFrame.new((LP+point1)/2,point1) * CFrame.Angles(math.rad(90),0,0) local prt=part(3,Avatar,0,0,BrickColor.new("Black"),"Effect",vt(0.5,0.5,0.5)) prt.Anchored=true prt.CFrame=effectsg.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)) local msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(2,2,2)) game:GetService("Debris"):AddItem(prt,2) coroutine.resume(coroutine.create(function(Part,Mesh) for i=0,1,0.1 do wait() Part.CFrame=Part.CFrame Part.Transparency=i Mesh.Scale=Mesh.Scale+vt(-0.5,-0.5,-0.5) end Part.Parent=nil end),prt,msh) end local newpos = baseprt.Position local inc = rangepower repeat wait() wait() rangepos = rangepos - 10 dir = dir hit,pos = rayCast(newpos,dir,inc,Avatar) drawtrail(newpos,pos) newpos = newpos + (dir * inc) if inc >= 20 then inc = inc - 10 end if hit ~= nil then rangepos = 0 end until rangepos <= 0 if hit ~= nil then MagicCircle(BrickColor.new("Black"),CFrame.new(pos),1,1,1,0.5,0.5,0.5,0.05) if hit.Parent:FindFirstChild("Humanoid") ~= nil then hum = hit.Parent.Humanoid tTorso=hit.Parent.Torso Damagefunc(hit,10,20,math.random(50,80),"Snare",aprt1) so("http://www.roblox.com/asset/?id=4678959",hit.Parent.Torso,2,1) --ADmg(hum,hit) elseif hit.Parent.Parent ~= nil and hit.Parent.Parent:FindFirstChild("Humanoid") ~= nil then hum = hit.Parent.Parent.Humanoid tTorso=hit.Parent.Parent.Torso Damagefunc(hit.Parent,10,20,math.random(50,80),"Snare",aprt1) so("http://www.roblox.com/asset/?id=4678959",hit.Parent.Parent.Torso,2,1) --ADmg(hum,hit) end end end)) end so = function(id,par,vol,pit) coroutine.resume(coroutine.create(function() local sou = Instance.new("Sound",par or workspace) sou.Volume=vol sou.Pitch=pit or 1 sou.SoundId=id wait() sou:play() game:GetService("Debris"):AddItem(sou,6) end)) end function findNearestTorso(pos) local list = game:service("Workspace"):children() local torso = nil local dist = 50 local temp = nil local human = nil local temp2 = nil for x = 1, #list do temp2 = list[x] if (temp2.className == "Model") and (temp2 ~= Character) and (temp2.Name ~= "Fenrier") then temp = temp2:findFirstChild("Torso") human = temp2:findFirstChild("Humanoid") if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then if (temp.Position - pos).magnitude < dist then torso = temp dist = (temp.Position - pos).magnitude end end end end return torso end Damagefunc=function(hit,minim,maxim,knockback,Type,Property) if hit.Parent==nil then return end CPlayer=Bin h=hit.Parent:FindFirstChild("Humanoid") for _,v in pairs(hit.Parent:children()) do if v:IsA("Humanoid") then h=v end end if h~=nil and hit.Parent.Name~=Character.Name and hit.Parent:FindFirstChild("Torso")~=nil then if attackdebounce == false then attackdebounce = true coroutine.resume(coroutine.create(function() wait(0.2) attackdebounce = false end)) --[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then return end]] -- hs(hit,1.2) c=Instance.new("ObjectValue") c.Name="creator" c.Value=game:service("Players").LocalPlayer c.Parent=h game:GetService("Debris"):AddItem(c,.5) Damage=math.random(minim,maxim) -- h:TakeDamage(Damage) blocked=false block=hit.Parent:findFirstChild("Block") if block~=nil then print("herp") if block.Value>0 then blocked=true block.Value=block.Value-1 print(block.Value) end end if blocked==false then -- h:TakeDamage(Damage) h.Health=h.Health-Damage showDamage(hit.Parent,Damage,.5,BrickColor:Red()) else h.Health=h.Health-(Damage/2) showDamage(hit.Parent,Damage/2,.5,BrickColor.new("Bright blue")) end if Type=="Knockdown" then hum=hit.Parent.Humanoid hum.PlatformStand=true coroutine.resume(coroutine.create(function(HHumanoid) wait(1) HHumanoid.PlatformStand=false end),hum) local angle=(hit.Position-(Property.Position+Vector3.new(0,0,0))).unit print(angle) --hit.CFrame=CFrame.new(hit.Position,Vector3.new(angle.x,hit.Position.y,angle.z))*CFrame.fromEulerAnglesXYZ(math.pi/4,0,0) local bodvol=Instance.new("BodyVelocity") bodvol.velocity=angle*knockback bodvol.P=5000 bodvol.maxForce=Vector3.new(8e+003, 8e+003, 8e+003) bodvol.Parent=hit rl=Instance.new("BodyAngularVelocity") rl.P=3000 rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000 rl.angularvelocity=Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10)) rl.Parent=hit game:GetService("Debris"):AddItem(bodvol,.5) game:GetService("Debris"):AddItem(rl,.5) elseif Type=="Normal" then vp=Instance.new("BodyVelocity") vp.P=500 vp.maxForce=Vector3.new(math.huge,0,math.huge) -- vp.velocity=Character.Torso.CFrame.lookVector*Knockback vp.velocity=RootPart.CFrame.lookVector*knockback+RootPart.Velocity/1.05 if knockback>0 then vp.Parent=hit.Parent.Torso end game:GetService("Debris"):AddItem(vp,.5) elseif Type=="Up" then local bodyVelocity=Instance.new("BodyVelocity") bodyVelocity.velocity=vt(0,40,0) bodyVelocity.P=5000 bodyVelocity.maxForce=Vector3.new(8e+003, 8e+003, 8e+003) bodyVelocity.Parent=hit game:GetService("Debris"):AddItem(bodyVelocity,.5) coroutine.resume(coroutine.create(function(HitPers) wait(0.2) rl=Instance.new("BodyAngularVelocity") rl.P=3000 rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000 rl.angularvelocity=Vector3.new(math.random(-50,50),math.random(-50,50),math.random(-50,50)) rl.Parent=HitPers game:GetService("Debris"):AddItem(rl,.5) end),hit) elseif Type=="Snare" then bp=Instance.new("BodyPosition") bp.P=2000 bp.D=100 bp.maxForce=Vector3.new(math.huge,math.huge,math.huge) bp.position=hit.Parent.Torso.Position bp.Parent=hit.Parent.Torso coroutine.resume(coroutine.create(function(Part,BodPoss) while BodPoss.Parent~=nil do wait(0.1) MagicBlock(BrickColor.new("Black"),Part.CFrame,3,3,3,-0.2,-0.2,-0.2) end end),hit.Parent.Torso,bp) game:GetService("Debris"):AddItem(bp,2) elseif Type=="LifeSteal" then cancombo=true if lifestolen==false then lifestolen=true LifeStolenTorso=hit.Parent.Torso for i=1,5 do LifeStealEffect(BrickColor.new("Bright red"),hit.Parent.Torso.CFrame,1,1,1) end coroutine.resume(coroutine.create(function(Dam) wait(1.5) Heal=Dam Humanoid.Health=Humanoid.Health+Heal showDamage(Torso.Parent,Heal,.5,BrickColor.new("Medium green")) end),Damage) end end c=Instance.new("ObjectValue") c.Name="creator" c.Value=Player c.Parent=h game:GetService("Debris"):AddItem(c,.5) CRIT=false hitDeb=true AttackPos=6 end end end showDamage=function(Char,Dealt,du,Color) m=Instance.new("Model") m.Name=tostring(Dealt) h=Instance.new("Humanoid") h.Health=0 h.MaxHealth=0 h.Parent=m c=Instance.new("Part") c.Transparency=0 c.BrickColor=Color c.Name="Head" c.TopSurface=0 c.BottomSurface=0 c.formFactor="Plate" c.Size=Vector3.new(1,.4,1) ms=Instance.new("CylinderMesh") ms.Scale=Vector3.new(.8,.8,.8) if CRIT==true then ms.Scale=Vector3.new(1,1.25,1) end ms.Parent=c c.Reflectance=0 Instance.new("BodyGyro").Parent=c c.Parent=m c.CFrame=CFrame.new(Char["Head"].CFrame.p+Vector3.new(0,1.5,0)) f=Instance.new("BodyPosition") f.P=2000 f.D=100 f.maxForce=Vector3.new(math.huge,math.huge,math.huge) f.position=c.Position+Vector3.new(0,3,0) f.Parent=c game:GetService("Debris"):AddItem(m,.5+du) c.CanCollide=false m.Parent=workspace c.CanCollide=false end combo=0 eul=0 game:GetService("RunService").Stepped:connect(function() function ob1d(mouse) if cancombo==true then cancombo=false combomove=true if combotype=="LifeSteal" then LifeStealCombo() elseif combotype=="Raise" then RaiseCombo() end return end if attack==true then return end hold=true if combo==0 then combo=1 attackone() elseif combo==1 then combo=2 attacktwo() elseif combo==2 then combo=3 attackthree() elseif combo==3 then combo=0 end coroutine.resume(coroutine.create(function() wait(1) if attack==false then combo=0 RootJoint.C0=RootCF Torso.Neck.C0=necko*euler(0.2,0,0) LW.C0=cf(-1.5,0.5,0)*euler(0,1.57,-0.2) LW.C1=cf(0,0.5,0)*euler(-0.2,0,0) RW.C0=cf(1.5,0.5,0)*euler(0,-1.57,0.2) RW.C1=cf(0,0.5,0)*euler(-0.2,0,0) end end)) end function ob1u(mouse) hold = false end buttonhold = false function key(key) if shadowattack==false then if key=="z" then ShadowSlash() end if key=="x" then ShadowShoot() end if key=="c" then ShadowDash() end if key=="v" then ShadowExplode() --ShadowWave() end end if attack==true then return end if key=="g" then combotype="LifeSteal" LifeSteal() combotype="None" end if key=="h" then combotype="Raise" Raise() combotype="None" end --[[if key=="q" then ChangeAvatarMode("Follow") end if key=="e" then ChangeAvatarMode("Stay") end if key=="r" then if MMouse.Target~=nil and MMouse.Target.Parent:findFirstChild("Humanoid")~=nil and MMouse.Target.Parent:findFirstChild("Torso")~=nil then TargetTorso=MMouse.Target.Parent.Torso ChangeAvatarMode("Aim") end end]] end end) function key2(key) end function s(mouse) mouse.Button1Down:connect(function() ob1d(mouse) end) mouse.Button1Up:connect(function() ob1u(mouse) end) mouse.KeyDown:connect(key) mouse.KeyUp:connect(key2) unsheathed = true player = Player ch = Character MMouse = mouse RSH = ch.Torso["Right Shoulder"] LSH = ch.Torso["Left Shoulder"] -- RSH.Parent = nil LSH.Parent = nil -- RW.Part0 = ch.Torso RW.C0 = CFrame.new(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5) RW.C1 = CFrame.new(0, 0.5, 0) RW.Part1 = ch["Right Arm"] RW.Parent = ch.Torso --_G.R = RW -- LW.Part0 = ch.Torso LW.C0 = CFrame.new(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8) LW.C1 = CFrame.new(0, 0.5, 0) LW.Part1 = ch["Left Arm"] LW.Parent = ch.Torso --_G.L = LW -- equipanim() end function ds(mouse) hideanim() wait(0) RW.Parent = nil LW.Parent = nil RSH.Parent = player.Character.Torso LSH.Parent = player.Character.Torso end Bin.Selected:connect(s) Bin.Deselected:connect(ds) print("Warden Claws loaded.") --[[ Copyrighted (C) Fenrier 2014 ]]
local socket = require('socket') local fiber = require('fiber') local metrics = require('metrics') local checks = require('checks') local log = require('log') local graphite = {} -- Default values local DEFAULT_PREFIX = 'tarantool' local DEFAULT_HOST = '127.0.0.1' local DEFAULT_PORT = 2003 local DEFAULT_SEND_INTERVAL = 2 -- Constants local LABELS_SEP = ';' local function format_observation(prefix, obs) local metric_path = ('%s.%s'):format(prefix, obs.metric_name) if next(obs.label_pairs) then local label_pairs_str_parts = {} for label, value in pairs(obs.label_pairs) do table.insert(label_pairs_str_parts, ('%s=%s'):format(label, value)) end local label_pairs_str = table.concat(label_pairs_str_parts, LABELS_SEP) metric_path = metric_path .. LABELS_SEP .. label_pairs_str end metric_path = metric_path:gsub(' ', '_') -- remove spaces (e.g. in values) local ts = tostring(obs.timestamp):sub(1, -4) -- remove ULL suffix local graph = ('%s %s %s\n'):format(metric_path, obs.value, ts) return graph end local function graphite_worker(opts) fiber.name('metrics_graphite_worker') while true do metrics.invoke_callbacks() for _, c in pairs(metrics.collectors()) do for _, obs in ipairs(c:collect()) do local data = format_observation(opts.prefix, obs) local numbytes = opts.sock:sendto(opts.host, opts.port, data) if numbytes == nil then log.error('Error while sending to host %s port %s data %s', opts.host, opts.port, data) end end end fiber.sleep(opts.send_interval) end end function graphite.init(opts) checks { prefix = '?string', host = '?string', port = '?number', send_interval = '?number' } local sock = socket('AF_INET', 'SOCK_DGRAM', 'udp') assert(sock ~= nil, 'Socket creation failed') local prefix = opts.prefix or DEFAULT_PREFIX local host = opts.host or DEFAULT_HOST local port = opts.port or DEFAULT_PORT local send_interval = opts.send_interval or DEFAULT_SEND_INTERVAL fiber.create(graphite_worker, { prefix = prefix, sock = sock, host = host, port = port, send_interval = send_interval, }) end return graphite
--ペンテスタッグ --Pentestag --Scripted by Eerie Code function c100318042.initial_effect(c) --link summon c:EnableReviveLimit() aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkType,TYPE_EFFECT),2,2) --pierce local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_PIERCE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsLinkState)) c:RegisterEffect(e1) end
-- Gemeinschaft 5 module: call_history class -- (c) AMOOMA GmbH 2012-2013 -- module(...,package.seeall) function camelize_type(account_type) ACCOUNT_TYPES = { sipaccount = 'SipAccount', conference = 'Conference', faxaccount = 'FaxAccount', callthrough = 'Callthrough', huntgroup = 'HuntGroup', automaticcalldistributor = 'AutomaticCallDistributor', } return ACCOUNT_TYPES[account_type] or account_type; end CallHistory = {} -- Create CallHistory object function CallHistory.new(self, arg) arg = arg or {} object = arg.object or {} setmetatable(object, self); self.__index = self; self.class = 'callhistory'; self.log = arg.log; self.database = arg.database; return object; end function CallHistory.insert_entry(self, call_history) local keys = {} local values = {} call_history.created_at = 'NOW()'; call_history.updated_at = 'NOW()'; for key, value in pairs(call_history) do table.insert(keys, key); table.insert(values, value); end local sql_query = 'INSERT INTO `call_histories` (`' .. table.concat(keys, "`, `") .. '`) VALUES (' .. table.concat(values, ", ") .. ')'; local result = self.database:query(sql_query); if not result then self.log:error('[', call_history.caller_channel_uuid, '] CALL_HISTORY_SAVE - SQL: ', sql_query); end return result; end function CallHistory.insert_event(self, uuid, account_type, account_id, entry_type, event) require 'common.str' local call_history = {} call_history.entry_type = common.str.to_sql(entry_type); call_history.call_historyable_type = common.str.to_sql(camelize_type(account_type)); call_history.call_historyable_id = common.str.to_sql(account_id); call_history.caller_channel_uuid = common.str.to_sql(uuid); call_history.duration = common.str.to_sql(event:getHeader('variable_billsec')); call_history.caller_id_number = common.str.to_sql(event:getHeader('variable_effective_caller_id_number')); call_history.caller_id_name = common.str.to_sql(event:getHeader('variable_effective_caller_id_name')); call_history.callee_id_number = common.str.to_sql(event:getHeader('variable_effective_callee_id_number')); call_history.callee_id_name = common.str.to_sql(event:getHeader('variable_effective_callee_id_name')); call_history.result = common.str.to_sql(event:getHeader('variable_hangup_cause')); call_history.start_stamp = 'FROM_UNIXTIME(' .. math.floor(common.str.to_i(event:getHeader('Caller-Channel-Created-Time')) / 1000000) .. ')'; call_history.auth_account_type = common.str.to_sql(camelize_type(event:getHeader('variable_gs_auth_account_type'))); call_history.auth_account_id = common.str.to_sql(event:getHeader('variable_gs_auth_account_id')); call_history.callee_account_type = common.str.to_sql(camelize_type(event:getHeader('variable_gs_destination_type'))); call_history.callee_account_id = common.str.to_sql(event:getHeader('variable_gs_destination_id')); call_history.destination_number = common.str.to_sql(event:getHeader('variable_gs_destination_number')); call_history.forwarding_service = common.str.to_sql(event:getHeader('variable_gs_forwarding_service')); call_history.clir = common.str.to_sql(common.str.to_b(event:getHeader('variable_gs_clir'))); if not common.str.to_b(event:getHeader('variable_gs_clir')) then call_history.caller_account_type = common.str.to_sql(camelize_type(event:getHeader('variable_gs_caller_account_type') or event:getHeader('variable_gs_account_type'))); call_history.caller_account_id = common.str.to_sql(event:getHeader('variable_gs_caller_account_id') or event:getHeader('variable_gs_account_id')); end if common.str.to_s(event:getHeader('variable_gs_call_service')) == 'pickup' then call_history.forwarding_service = common.str.to_sql('pickup'); end self.log:info('[', uuid,'] CALL_HISTORY_SAVE ', entry_type,' - account: ', account_type, '=', account_id, ', caller: ', call_history.caller_id_number, ' ', call_history.caller_id_name, ', callee: ', call_history.callee_id_number, ' ', call_history.callee_id_name, ', result: ', call_history.result ); return self:insert_entry(call_history); end function CallHistory.insert_forwarded(self, uuid, account_type, account_id, caller, destination, result) require 'common.str' local call_history = {} call_history.entry_type = common.str.to_sql('forwarded'); call_history.call_historyable_type = common.str.to_sql(camelize_type(account_type)); call_history.call_historyable_id = common.str.to_sql(account_id); call_history.caller_channel_uuid = common.str.to_sql(uuid); call_history.duration = common.str.to_sql(caller:to_i('billsec')); call_history.caller_id_number = common.str.to_sql(caller.caller_id_number); call_history.caller_id_name = common.str.to_sql(caller.caller_id_name); call_history.callee_id_number = common.str.to_sql(caller.callee_id_number); call_history.callee_id_name = common.str.to_sql(caller.callee_id_name); call_history.result = common.str.to_sql(result.cause or 'UNSPECIFIED'); call_history.start_stamp = 'FROM_UNIXTIME(' .. math.floor(caller:to_i('created_time') / 1000000) .. ')'; if caller.account and not caller.clir then call_history.caller_account_type = common.str.to_sql(camelize_type(caller.account.class)); call_history.caller_account_id = common.str.to_sql(caller.account.id); end if caller.auth_account then call_history.auth_account_type = common.str.to_sql(camelize_type(caller.auth_account.class)); call_history.auth_account_id = common.str.to_sql(caller.auth_account.id); end if destination then call_history.callee_account_type = common.str.to_sql(camelize_type(destination.type)); call_history.callee_account_id = common.str.to_sql(destination.id); call_history.destination_number = common.str.to_sql(destination.number); end call_history.forwarding_service = common.str.to_sql(caller.forwarding_service); self.log:info('CALL_HISTORY_SAVE forwarded - account: ', account_type, '=', account_id, ', service: ', call_history.forwarding_service, ', caller: ', call_history.caller_id_number, ' ', call_history.caller_id_name, ', callee: ', call_history.callee_id_number, ' ', call_history.callee_id_name, ', result: ', call_history.result ); return self:insert_entry(call_history); end
local VERSION = '201709171' -- version history at end of file local AUTHOR_NOTE = "-[ luastring.lua package by ldeveloperl1985 version 201709171 ]-" local OBJDEF = { VERSION = VERSION, AUTHOR_NOTE = AUTHOR_NOTE, } function OBJDEF:echo () print("String Testing"); end function OBJDEF:echoSubString (str, start, no) return string.sub(str, start, no); end return OBJDEF;
--[[ local wibox = require('wibox') local gtable = require('gears.table') local keygrabber = require('awful.keygrabber') local gstring = require('gears.string') local gcolor = require('gears.color') local setmetatable = setmetatable local searchbox = {mt = {}} local function prompt_text_with_cursor(args) local char, spacer, text_start, text_end, ret local text = args.text or '' local _prompt = args.prompt or '' local underline = args.cursor_ul or 'none' if args.selectall then if #text == 0 then char = ' ' else char = gstring.xml_escape(text) end spacer = ' ' text_start = '' text_end = '' elseif #text < args.cursor_pos then char = ' ' spacer = '' text_start = gstring.xml_escape(text) text_end = '' else char = gstring.xml_escape(text:sub(args.cursor_pos, args.cursor_pos)) spacer = ' ' text_start = gstring.xml_escape(text:sub(1, args.cursor_pos - 1)) text_end = gstring.xml_escape(text:sub(args.cursor_pos + 1)) end local cursor_color = gcolor.ensure_pango_color(args.cursor_color) local text_color = gcolor.ensure_pango_color(args.text_color) if args.highlighter then text_start, text_end = args.highlighter(text_start, text_end) end ret = _prompt .. text_start .. '<span background="' .. cursor_color .. '" foreground="' .. text_color .. '" underline="' .. underline .. '">' .. char .. '</span>' .. text_end .. spacer return ret end local grabber local cur_pos = 1 function searchbox:focus() self.searchText = '' grabber = keygrabber.run( function(mod, key, event) if (event == 'press') then if key == 'Escape' then searchbox:unfocus() return elseif key == 'Left' then cur_pos = cur_pos - 1 elseif key == 'Right' then cur_pos = cur_pos + 1 elseif key == 'BackSpace' then if cur_pos > 1 then self.searchText = self.searchText:sub(1, cur_pos - 2) .. self.searchText:sub(cur_pos) cur_pos = cur_pos - 1 end elseif key:wlen() == 1 then self.searchText = self.searchText:sub(1, cur_pos - 1) .. key .. self.searchText:sub(cur_pos) cur_pos = cur_pos + #key end self.textbox.markup = prompt_text_with_cursor { text = self.searchText, cursor_pos = cur_pos, selectall = false } self:emit_signal('property::searchText') end end ) end function searchbox:unfocus() keygrabber.stop(grabber) end --- Create a new searchbox. -- @function searchbox local function new(text, ignore_markup) local ret = wibox.container.background() gtable.crush(ret, searchbox, true) ret.textbox = wibox.widget.textbox() ret.widget = ret.textbox ret.searchText = '' return ret end function searchbox.mt.__call(_, ...) return new(...) end return setmetatable(searchbox, searchbox.mt) ]]
return function(port) assert((not not wifi.sta.getip()) or (not not wifi.ap.getip()), "tcpserver: No viable IP found") --FIXME: should also assert 0 < port <= 65K local luasrv = net.createServer(net.TCP, 180) luasrv:listen(port, function(socket) local fifo = {} local fifo_drained = true local function onSent(c) if #fifo > 0 then c:send(table.remove(fifo, 1)) else fifo_drained = true end end local function s_output(str) table.insert(fifo, str) if socket ~= nil and fifo_drained then fifo_drained = false onSent(socket) end end local function onReceive(c, payload) uart.write(0, payload..'\n') node.input(payload) end local function onDisconnect(c) node.output(nil) end node.output(s_output, 0) socket:on("receive", onReceive) socket:on("disconnection", onDisconnect) socket:on("sent", onSent) print("Welcome to NodeMCU world.") end) print("luaserver running on port "..port) return luasrv end
pfDB["meta-tbc"] = { ["chests"] = { [-300405] = "_", [-300404] = "_", [-300403] = "_", [-300402] = "_", [-300401] = "_", [-300400] = "_", [-187072] = 0, [-186750] = 0, [-186748] = 0, [-186744] = 0, [-186741] = 0, [-186740] = 0, [-186739] = 0, [-186736] = 0, [-186734] = 0, [-186302] = 0, [-186263] = 0, [-185169] = 0, [-185168] = 0, [-185032] = 0, [-184941] = 0, [-184939] = 0, [-184937] = 0, [-184935] = 0, [-184933] = 0, [-184930] = 0, [-184622] = 0, [-184621] = 0, [-184620] = 0, [-184619] = 0, [-184504] = 0, [-182258] = 0, [-182069] = 0, [-181804] = 0, [-181802] = 0, [-181800] = 0, [-181798] = 0, [-181671] = 0, [-181366] = 0, [-181074] = "_", [-161513] = 0, [-153473] = 0, [-153472] = 0, [-153471] = 0, [-153470] = 0, [-19021] = 0, [-13873] = 0, [-3743] = 0, [-3719] = 0, [-3707] = 0, [-3706] = 0, [-3705] = 0, [-3695] = 0, [-3694] = 0, [-3693] = 0, [-3691] = 0, [-3690] = 0, [-3662] = 0, [-3659] = 0, [-3658] = 0, [-2847] = 0, [-2846] = 0, [-2845] = 0, }, ["flight"] = { [353] = "A", [1233] = "AH", [1574] = "A", [1575] = "A", [16189] = "H", [16192] = "H", [16587] = "H", [16822] = "A", [17554] = "A", [17555] = "A", [18785] = "A", [18788] = "A", [18789] = "A", [18791] = "H", [18807] = "H", [18808] = "H", [18809] = "A", [18930] = "AH", [18931] = "AH", [18937] = "A", [18938] = "AH", [18939] = "A", [18940] = "AH", [18942] = "H", [18953] = "H", [19317] = "H", [19558] = "H", [19581] = "AH", [19583] = "AH", [20234] = "A", [20515] = "AH", [20762] = "H", [21107] = "A", [21766] = "AH", [22216] = "AH", [22455] = "H", [22485] = "A", [22931] = "AH", [22935] = "A", [23612] = "AH", [24366] = "A", [24851] = "AH", [26560] = "AH", }, ["herbs"] = { [-185881] = 350, [-183046] = 235, [-183045] = 315, [-183044] = 300, [-183043] = 325, [-181281] = 375, [-181280] = 365, [-181279] = 350, [-181278] = 340, [-181277] = 325, [-181276] = 335, [-181275] = 325, [-181271] = 315, [-181270] = 300, [-181166] = 0, }, ["mines"] = { [-185877] = 350, [-185557] = 375, [-181570] = 350, [-181569] = 350, [-181557] = 375, [-181556] = 325, [-181555] = 300, [-181249] = 65, [-181248] = 0, [-73939] = 125, }, ["rares"] = { [601] = 19, [639] = "_", [723] = "_", [1037] = 24, [1140] = 31, [1361] = 28, [1720] = 25, [1849] = 58, [1885] = 58, [2753] = 38, [3651] = 16, [3652] = 17, [3672] = 17, [3718] = 20, [3792] = 31, [3831] = 23, [3872] = 21, [4030] = 29, [4339] = 41, [4380] = 38, [4425] = 27, [4438] = 25, [4842] = 27, [5346] = 48, [5348] = 62, [5367] = 52, [5789] = 10, [5790] = 9, [5793] = 10, [5794] = 10, [5795] = 9, [5796] = 8, [5797] = 22, [5800] = 22, [5912] = 19, [6228] = 28, [6489] = 32, [6490] = 32, [6646] = 53, [6647] = 51, [6650] = 50, [6651] = 49, [6652] = 51, [7895] = 35, [8206] = 51, [8208] = 43, [8923] = 56, [9025] = "_", [9041] = 54, [9042] = 53, [9417] = 60, [9736] = "_", [10203] = 62, [10236] = 33, [10237] = 35, [10238] = 35, [10239] = 38, [10584] = "_", [10808] = "_", [10810] = 59, [10818] = 43, [10820] = 45, [10899] = 61, [11383] = 57, [11467] = 59, [11580] = 41, [11676] = 1, [12037] = 31, [12116] = 60, [12237] = 46, [13977] = 60, [14016] = 1, [14018] = 1, [14019] = 1, [14229] = 35, [14230] = 37, [14233] = 37, [14235] = 40, [14236] = 37, [14237] = 38, [14266] = 19, [14268] = 15, [14341] = 53, [14346] = 52, [14425] = 24, [14506] = 62, [14697] = 71, [15796] = 59, [16179] = 73, [16180] = 73, [16181] = 73, [16184] = 60, [16854] = 11, [16855] = 10, [17075] = 63, [17144] = 65, [18241] = 30, [18677] = 61, [18678] = 62, [18679] = 62, [18680] = 63, [18681] = 63, [18682] = 63, [18683] = 68, [18684] = 66, [18685] = 64, [18686] = 64, [18689] = 65, [18690] = 68, [18692] = 68, [18693] = 68, [18694] = 68, [18695] = 69, [18696] = 68, [18697] = 69, [18698] = 68, [18699] = 68, [20932] = 70, [22060] = 18, [22062] = 18, [22625] = 70, [22631] = 1, [22636] = 1, [22637] = 1, [22642] = 1, }, }
local Path = require("plenary.path") local utils = require("cmp_pandoc.utils") local M = {} M.yaml_front_matter = function(bufnr) local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, true) local yaml_start = nil local yaml_end = nil local function is_valid(str) local match = string.match(str, "^%-%-%-") or string.match(str, "^%.%.%.") if match then if string.len(match) == 3 then return true end if string.sub(match, string.len(match) + 1, string.len(str)):match("^%s+") then return true end return false end return false end local i = 1 while i <= #lines do if string.match(lines[i], "^%-%-%-") and is_valid(lines[i]) and not yaml_start then yaml_start = i i = i + 1 end if is_valid(lines[i]) then yaml_end = i break end i = i + 1 end local previous_line_is_empty = (function() if yaml_start == nil then return end if yaml_start > 1 then return string.len(lines[yaml_start - 1]) == 0 end return true end)() local is_valid_yaml = yaml_start ~= nil and yaml_end ~= nil and (yaml_start ~= yaml_end) and previous_line_is_empty return { is_valid = is_valid_yaml, start = yaml_start, ["end"] = yaml_end, raw_content = is_valid_yaml and vim.list_slice(lines, yaml_start + 1, yaml_end - 1) or nil, } end M.get_bibliography_paths = function(bufnr) local front_matter = M.yaml_front_matter(bufnr) if not front_matter.is_valid then return end local bibliography_line = nil for index, value in ipairs(front_matter.raw_content) do if string.match(value, "^bibliography:") then bibliography_line = index break end end if not bibliography_line then return end local bibliography_field = vim.trim(string.match(front_matter.raw_content[bibliography_line], ":(.*)")) if string.len(bibliography_field) > 0 then return { bibliography_field } end local bibliography_inputs = {} local i = 1 while i <= #front_matter.raw_content do if string.match(front_matter.raw_content[i], "^%-%s[%w|%d|%D]+") then table.insert(bibliography_inputs, front_matter.raw_content[i]) end i = i + 1 end if #bibliography_inputs == 0 then return end return vim.tbl_map(function(bibliography) return vim.trim(string.match(bibliography, "-%s(.*)")) end, bibliography_inputs) end local read_file = function(path) local p = Path.new(vim.api.nvim_buf_get_name(0)):parent():joinpath(path):absolute() if Path:new(p):exists() then local file = io.open(p, "rb") local results = file:read("*all") file:close() return results end end local citations = function(path, opts) local data = read_file(path) if not data then return end local o = {} for citation in data:gmatch("@.-\n}\n") do table.insert(o, citation) end return vim.tbl_map(function(citation) local documentation = vim.tbl_map(function(field) return utils.format(citation, field) end, opts.fields) return utils.format_entry({ label = citation:match("@%w+{(.-),"), doc = opts.documentation, kind = "Field", value = table.concat(documentation, "\n"), }) end, o) end M.bibliography = function(bufnr, opts) local bib_paths = M.get_bibliography_paths(bufnr) if not bib_paths then return end local all_bib_entrys = {} for _, path in ipairs(bib_paths) do local citation = citations(path, opts) if citation then vim.list_extend(all_bib_entrys, citation) end end return all_bib_entrys end local crossreferences = function(line, opts) if string.match(line, utils.crossref_patterns.equation) and string.match(line, "^%$%$(.*)%$%$") then local equation = string.match(line, "^%$%$(.*)%$%$") return utils.format_entry({ label = string.match(line, utils.crossref_patterns.equation), doc = opts.documentation, value = opts.enable_nabla and utils.nabla(equation) or equation, }) end if string.match(line, utils.crossref_patterns.section) and string.match(line, "^#%s+(.*){") then return utils.format_entry({ label = string.match(line, utils.crossref_patterns.section), value = "*" .. vim.trim(string.match(line, "#%s+(.*){")) .. "*", }) end if string.match(line, utils.crossref_patterns.table) then return utils.format_entry({ label = string.match(line, utils.crossref_patterns.base), value = "*" .. vim.trim(string.match(line, "^:%s+(.*)%s+{")) .. "*", }) end if string.match(line, utils.crossref_patterns.lst) then return utils.format_entry({ label = string.match(line, utils.crossref_patterns.lst), value = "*" .. vim.trim(string.match(line, "^:%s+(.*)%s+{")) .. "*", }) end if string.match(line, utils.crossref_patterns.figure) then return utils.format_entry({ label = string.match(line, utils.crossref_patterns.figure), value = "*" .. vim.trim(string.match(line, "^%!%[.*%]%((.*)%)")) .. "*", }) end end M.references = function(bufnr, opts) local valid_lines = vim.tbl_filter(function(line) return line:match(utils.crossref_patterns.base) and not line:match("^%<!%-%-(.*)%-%-%>$") end, vim.api.nvim_buf_get_lines(bufnr, 0, -1, true)) if vim.tbl_isempty(valid_lines) then return end return vim.tbl_map(function(line) return crossreferences(line, opts) end, valid_lines) end M.init = function(self, callback, bufnr) local opts = self and self.opts or require("cmp_pandoc.config") local bib_items = M.bibliography(bufnr, opts.bibliography) local reference_items = M.references(bufnr, opts.crossref) local all_entrys = {} if reference_items then vim.list_extend(all_entrys, reference_items) end if bib_items then vim.list_extend(all_entrys, bib_items) end if not all_entrys then return callback() end return callback(all_entrys) end return M
object_tangible_quest_menagerie_terminal_52 = object_tangible_quest_shared_menagerie_terminal_52:new { } ObjectTemplates:addTemplate(object_tangible_quest_menagerie_terminal_52, "object/tangible/quest/menagerie_terminal_52.iff")
local colors = require('colors') local c = require('component') local gpu = c.gpu local function getCurrentStyle() return { color=gpu.getForeground(), backgroundColor=gpu.getBackground() } end local stateStyle = getCurrentStyle() local defaultStyle = clone(stateStyle) local function getHexaColor(color) if color == nil then return nil end if isString(color) then local paletteIndex = colors[color] if paletteIndex == nil then error('ui: bad color string value: ' .. String(color)) end return gpu.getPaletteColor(paletteIndex) end if color >= 1 and color <= 16 then return gpu.getPaletteColor(color) end return color end ------------------------------------------------------------------------------------------------ local function renderPrimitive(x, y, value, parentStyle, style) style = assign(parentStyle, style or {}) local newColor = getHexaColor(style.color or parentStyle.color) local newBgColor = getHexaColor(style.backgroundColor or parentStyle.backgroundColor) local colorChanged = isNotNil(newColor) and notEquals(stateStyle.color, newColor) local bgColorChanged = isNotNil(newBgColor) and notEquals(stateStyle.backgroundColor, newBgColor) if colorChanged then gpu.setForeground(newColor) stateStyle.color = newColor end if bgColorChanged then gpu.setBackground(newBgColor) stateStyle.backgroundColor = newBgColor end gpu.set(x, y, value) return { height=1, width=length(value) } end ------------------------------------------------------------------------------------------------ local function renderElement(elem, x, y, parentStyle, style, registerEvent) x = x or 1 y = y or 1 parentStyle = assign(parentStyle or defaultStyle, style or {}) if isString(elem) then return renderPrimitive(x, y, elem, parentStyle, style) end if elem.onClick or elem.onClickOutside or elem.onScroll then registerEvent(elem, x, y, elem.width, elem.height) end local stateDim = { width=0, height=0 } local state = { x=x, y=y } forEach(function(line) stateDim.height = stateDim.height + line.height if stateDim.width < line.width then stateDim.width = line.width end state.x = x forEach(function(subElem) local elemDim = renderElement(subElem, state.x, state.y, parentStyle, subElem.style, registerEvent) state.x = state.x + elemDim.width end, line.content) state.y = state.y + line.height end, elem.content) return stateDim end ------------------------------------------------------------------------------------------------ local function render(_, _, x, y, registerEvent) local rendered = false x = x or 1 y = y or 1 registerEvent = registerEvent or noop local function prepareScreen(style) gpu.setForeground(getHexaColor(style.color)) gpu.setBackground(getHexaColor(style.backgroundColor)) stateStyle = getCurrentStyle() local w, h = gpu.getResolution() gpu.fill(1, 1, w, h, ' ') end local previousRenderedElement = nil local function paint(elem) local elemStyle = elem and elem.style or {} local style = assign(defaultStyle, elemStyle) if not rendered then rendered = true prepareScreen(style) end local e = elem local prev = previousRenderedElement local dimChanged = e and prev and (prev.width > e.width or prev.height > e.height) local shapeChanged = e and prev and e.shape ~= prev.shape -- TODO: refactor this logic if not e or dimChanged or shapeChanged then local concernedElement = e or prev gpu.setForeground(getHexaColor(style.color)) gpu.setBackground(getHexaColor(style.backgroundColor)) if not e then stateStyle = getCurrentStyle() end gpu.fill(x, y, concernedElement.width, concernedElement.height, ' ') if e then gpu.setForeground(stateStyle.color) gpu.setBackground(stateStyle.backgroundColor) end end if e then renderElement(e, x, y, style, elemStyle, registerEvent); previousRenderedElement = e end end return paint end ------------------------------------------------------------------------------------------------ return render;
AddCSLuaFile() DEFINE_BASECLASS( "base_wire_entity" ) ENT.PrintName = "Wire Indicator" ENT.WireDebugName = "Indicator" if CLIENT then return end -- No more client function ENT:Initialize() self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) self.a = 0 self.ar = 0 self.ag = 0 self.ab = 0 self.aa = 0 self.b = 0 self.br = 0 self.bg = 0 self.bb = 0 self.ba = 0 self.Inputs = Wire_CreateInputs(self, { "A" }) end function ENT:Setup(a, ar, ag, ab, aa, b, br, bg, bb, ba) self.a = a or 0 self.ar = ar or 255 self.ag = ag or 0 self.ab = ab or 0 self.aa = aa or 255 self.b = b or 1 self.br = br or 0 self.bg = bg or 255 self.bb = bb or 0 self.ba = ba or 255 local factor = math.max(0, math.min(self.Inputs.A.Value-self.a/(self.b-self.a), 1)) self:TriggerInput("A", 0) end function ENT:TriggerInput(iname, value) if iname == "A" then local factor = math.Clamp((value-self.a)/(self.b-self.a), 0, 1) self:ShowOutput(factor) local r = math.Clamp((self.br-self.ar)*factor+self.ar, 0, 255) local g = math.Clamp((self.bg-self.ag)*factor+self.ag, 0, 255) local b = math.Clamp((self.bb-self.ab)*factor+self.ab, 0, 255) local a = math.Clamp((self.ba-self.aa)*factor+self.aa, 0, 255) self:SetColor(Color(r, g, b, a)) end end function ENT:ShowOutput(value) if value ~= self.PrevOutput then self:SetOverlayText( "Color = " .. string.format("%.1f", (value * 100)) .. "%" ) self.PrevOutput = value end end duplicator.RegisterEntityClass("gmod_wire_indicator", WireLib.MakeWireEnt, "Data", "a", "ar", "ag", "ab", "aa", "b", "br", "bg", "bb", "ba") function MakeWire7Seg( pl, Pos, Ang, Model, a, ar, ag, ab, aa, b, br, bg, bb, ba) if IsValid(pl) and not pl:CheckLimit( "wire_indicators" ) then return false end local function MakeWireIndicator(prototype, scale) local name, angOffset, posOffset = unpack(prototype) posOffset = Vector(0, posOffset.x, -posOffset.y) local Pos, Ang = LocalToWorld(posOffset * scale, Angle(), Pos, Ang), Ang + angOffset local ent = WireLib.MakeWireEnt(pl, { Class = "gmod_wire_indicator", Pos = Pos, Angle = Ang, Model = Model, frozen = frozen, nocollide = nocollide }, a, ar, ag, ab, aa, b, br, bg, bb, ba ) if IsValid(ent) then ent:SetNetworkedString("WireName", name) duplicator.StoreEntityModifier( ent, "WireName", { name = name } ) end return ent end local prototypes = { { "G", Angle(0, 0, 0), Vector(0, 0) }, { "A", Angle(0, 0, 0), Vector(0, 2) }, { "B", Angle(0, 0, 90), Vector(1, 1) }, { "C", Angle(0, 0, 90), Vector(1, -1) }, { "D", Angle(0, 0, 0), Vector(0, -2) }, { "E", Angle(0, 0, 90), Vector(-1, -1) }, { "F", Angle(0, 0, 90), Vector(-1, 1) } } local wire_indicators = {} wire_indicators[1] = MakeWireIndicator( prototypes[1], 0 ) -- get the scale (half the long side of the indicator) from the first one local scale = wire_indicators[1]:OBBMaxs().y for i = 2, 7 do wire_indicators[i] = MakeWireIndicator( prototypes[i], scale ) if not IsValid( wire_indicators[i] ) then break end for y = 1, i-1 do const = constraint.Weld( wire_indicators[i], wire_indicators[y], 0, 0, 0, true, true ) end wire_indicators[i - 1]:DeleteOnRemove( wire_indicators[i] ) --when one is removed, all are. a linked chain end if wire_indicators[7] then wire_indicators[7]:DeleteOnRemove( wire_indicators[1] ) --loops chain back to first end return wire_indicators end
nn = require 'nn' UpSample = nn.SpatialUpSamplingBilinear Max = nn.SpatialMaxPooling SBatchNorm = nn.SpatialBatchNormalization model = nn.Sequential() model:add(nn.SpatialConvolution(3, 1, 5, 5)) model:add(UpSample(5)) -- FPROP a multi-resolution sample input = torch.rand(3,5,5) input:float() model:forward(input) -- Print the size of the Threshold outputs list = model:listModules() for i = 1, #list do print(list[i].output:size()) end
--[[ #obj - Wavefront OBJ file --]] return function(self, obj, path, loadAsCollisions) --store vertices, normals and texture coordinates local vertices = { } local normals = { } local texVertices = { } --load object local material = obj.materials.None local blocked = false obj.objects.COLLISION_object = obj.objects.COLLISION_object or { faces = { }, final = { }, material = material, name = "COLLISION_object", } local o_col = obj.objects.COLLISION_object obj.objects.object = obj.objects.object or { faces = { }, final = { }, material = material, name = "object", } local o_def = obj.objects.object local o = loadAsCollisions and o_col or o_def for l in love.filesystem.lines(path) do local v = self:split(l, " ") if v[1] == "o" then blocked = false end if v[1] == "v" then vertices[#vertices+1] = {tonumber(v[2]), tonumber(v[3]), tonumber(v[4])} elseif v[1] == "vn" then normals[#normals+1] = {tonumber(v[2]), tonumber(v[3]), tonumber(v[4])} elseif v[1] == "vt" then texVertices[#texVertices+1] = {tonumber(v[2]), 1.0 - tonumber(v[3])} elseif v[1] == "usemtl" and not blocked then material = obj.materials[l:sub(8)] or self.materialLibrary[l:sub(8)] or obj.materials.None if obj.splitMaterials and not o.name:find("COLLISION") and not loadAsCollisions then local name = o.name .. "_" .. l:sub(8) obj.objects[name] = obj.objects[name] or { faces = { }, final = { }, material = material, name = o.name, --using base objects name instead, because the material is irelevant as a name } o = obj.objects[name] else o.material = material end elseif v[1] == "f" and not blocked then local verts = #v-1 --combine vertex and data into one for i = 1, verts do local v2 = self:split(v[i+1]:gsub("//", "/0/"), "/") local dv = vertices[tonumber(v2[1])] local dn = normals[tonumber(v2[3])] local uv = texVertices[tonumber(v2[2])] o.final[#o.final+1] = { dv[1], dv[2], dv[3], --position material.shaderValue or o.shaderValue or 1.0, --extra float for animations dn[1], dn[2], dn[3], --normal material, --material uv and uv[1], uv and uv[2], --UV } end if verts == 3 then --tris o.faces[#o.faces+1] = {#o.final-2, #o.final-1, #o.final-0} else --triangulates, fan style for i = 1, verts-2 do o.faces[#o.faces+1] = {#o.final-verts+1, #o.final-verts+1+i, #o.final-verts+2+i} end end elseif v[1] == "o" and not blocked then if l:find("REMOVE") then blocked = true elseif obj.mergeObjects then o = self:decodeObjectName(l:sub(3)):find("COLLISION") and o_col or o_def else local name = self:decodeObjectName(l:sub(3)) if loadAsCollisions then name = "COLLISION_" .. name end obj.objects[name] = obj.objects[name] or { faces = { }, final = { }, material = material, name = name, } o = obj.objects[name] end end end end
-- The getopt-functionality is loaded from pm3/getopt.lua -- Have a look there for further details getopt = require('getopt') bin = require('bin') dumplib = require('html_dumplib') example = "script run emul2html -o dumpdata.eml " author = "Martin Holst Swende" usage = "script run htmldump [-i <file>] [-o <file>]" desc =[[ This script takes a dumpfile on EML (ASCII) format and produces a html based dump, which is a bit more easily analyzed. Arguments: -h This help -i <file> Specifies the dump-file (input). If omitted, 'dumpdata.eml' is used -o <filename> Speciies the output file. If omitted, <curdate>.html is used. ]] ------------------------------- -- Some utilities ------------------------------- --- -- A debug printout-function function dbg(args) if DEBUG then print("###", args) end end --- -- This is only meant to be used when errors occur function oops(err) print("ERROR: ",err) end --- -- Usage help function help() print(desc) print("Example usage") print(example) end local function main(args) local input = "dumpdata.eml" local output = os.date("%Y-%m-%d_%H%M%S.html"); for o, a in getopt.getopt(args, 'i:o:h') do if o == "h" then return help() end if o == "i" then input = a end if o == "o" then output = a end end local filename, err = dumplib.convert_eml_to_html(input,output) if err then return oops(err) end print(("Wrote a HTML dump to the file %s"):format(filename)) end --[[ In the future, we may implement so that scripts are invoked directly into a 'main' function, instead of being executed blindly. For future compatibility, I have done so, but I invoke my main from here. --]] main(args)
local MAJOR, MINOR = 'Wasabi', 7 assert(LibStub, MAJOR .. ' requires LibStub') local lib, oldMinor = LibStub:NewLibrary(MAJOR, MINOR) if(not lib) then return end local databases = {} local function OnEvent(self, event, arg1) if(event == 'ADDON_LOADED' and arg1 == (self.parent or self.name)) then if(not _G[self.glob]) then _G[self.glob] = CopyTable(self.defaults) end self.db = _G[self.glob] for key, value in next, self.defaults do if(self.db[key] == nil) then self.db[key] = value end end self.temp = CopyTable(self.db) self:UnregisterEvent(event) end end local methods = {} local function CreatePanelProto(name, glob, defaults) assert(not databases[glob], 'Savedvariables "' .. glob .. '" is already in use') local panel = CreateFrame('Frame', name .. 'OptionsPanel', InterfaceOptionsFramePanelContainer) panel:RegisterEvent('ADDON_LOADED') panel:HookScript('OnEvent', OnEvent) panel:Hide() panel.name = name panel.defaults = defaults panel.glob = glob panel.temp = {} panel.objects = {} for method, func in next, methods do panel[method] = func end databases[glob] = true return panel end function methods:CreateChild(name, glob, defaults) assert(not self.parent, 'Cannot create child panel on a child panel.') local panel = CreatePanelProto(name, glob, defaults) panel.parent = self.name InterfaceOptions_AddCategory(panel) return panel end function methods:AddSlash(slash) if(not self.slashIndex) then self.slashIndex = 1 SlashCmdList[self.name] = function() self:ShowOptions() end else self.slashIndex = self.slashIndex + 1 end _G['SLASH_' .. self.name .. self.slashIndex] = slash end function methods:ShowOptions() -- BUG: On first load IOF doesn't select the right category or panel. InterfaceOptionsFrame_OpenToCategory(self.name) InterfaceOptionsFrame_OpenToCategory(self.name) end local internalMethods = {} function methods:Initialize(constructor) self:SetScript('OnShow', function() local _NAME = self:GetName() local ScrollChild = CreateFrame('Frame', _NAME .. 'ScrollChild', self) ScrollChild:SetHeight(1) ScrollChild.panel = self self.ScrollChild = ScrollChild for method, func in next, internalMethods do ScrollChild[method] = func end local Container = CreateFrame('ScrollFrame', _NAME .. 'Container', self) Container:SetPoint('TOPLEFT', 6, -6) Container:SetPoint('BOTTOMRIGHT', -6, 6) Container:SetScrollChild(ScrollChild) self.Container = Container ScrollChild:SetWidth(Container:GetWidth()) constructor(setmetatable(ScrollChild, {__index = lib.widgets})) self:UpdateSlider() self:refresh() self:SetScript('OnShow', nil) end) end function internalMethods:GetVariable(key, nested) if(nested) then return self.panel.temp[nested][key] else return self.panel.temp[key] end end function internalMethods:SetVariable(key, value, nested) if(nested) then self.panel.temp[nested][key] = value else self.panel.temp[key] = value end end function internalMethods:DeleteVariable(key, nested) if(nested) then self.panel.temp[nested][key] = nil else self.panel.temp[key] = nil end end function internalMethods:GetAllVariables(nested) if(nested) then return self.panel.temp[nested] else return self.panel.temp end end function internalMethods:AddObject(key, object) self.panel.objects[key] = object end function methods:refresh() for key, object in next, self.objects do object:Update(self.temp[key]) end self:Fire('Refresh', self.temp) end function methods:okay() for key, value in next, self.temp do if(self.db[key] ~= value) then self.db[key] = value end end self:Fire('Okay', self.temp) end function methods:default() table.wipe(self.temp) self.temp = CopyTable(self.defaults) self:Fire('Default', self.defaults) end function methods:cancel() table.wipe(self.temp) self.temp = CopyTable(self.db) self:Fire('Cancel', self.temp) end local function CreateSlider(Frame) local _NAME = Frame:GetName() local Slider = CreateFrame('Slider', _NAME .. 'Slider', Frame.Container) Slider:SetPoint('TOPRIGHT', 2, -14) Slider:SetPoint('BOTTOMRIGHT', 2, 13) Slider:SetWidth(16) Frame.Slider = Slider local Thumb = Frame.Container:CreateTexture(_NAME .. 'Thumb') Thumb:SetSize(16, 24) Thumb:SetTexture([[Interface\Buttons\UI-ScrollBar-Knob]]) Thumb:SetTexCoord(1/4, 3/4, 1/8, 7/8) Slider:SetThumbTexture(Thumb) local Up = CreateFrame('Button', _NAME .. 'Up', Slider) Up:SetPoint('BOTTOM', Slider, 'TOP') Up:SetSize(16, 16) Up:SetNormalTexture([[Interface\Buttons\UI-ScrollBar-ScrollUpButton-Up]]) Up:SetDisabledTexture([[Interface\Buttons\UI-ScrollBar-ScrollUpButton-Disabled]]) Up:SetHighlightTexture([[Interface\Buttons\UI-ScrollBar-ScrollUpButton-Highlight]]) Up:GetNormalTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) Up:GetDisabledTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) Up:GetHighlightTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) Up:GetHighlightTexture():SetBlendMode('ADD') Up:SetScript('OnClick', function() Slider:SetValue(Slider:GetValue() - Slider:GetHeight() / 3) end) local Down = CreateFrame('Button', _NAME .. 'Down', Slider) Down:SetPoint('TOP', Slider, 'BOTTOM') Down:SetSize(16, 16) Down:SetScript('OnClick', ScrollClick) Down:SetNormalTexture([[Interface\Buttons\UI-ScrollBar-ScrollDownButton-Up]]) Down:SetDisabledTexture([[Interface\Buttons\UI-ScrollBar-ScrollDownButton-Disabled]]) Down:SetHighlightTexture([[Interface\Buttons\UI-ScrollBar-ScrollDownButton-Highlight]]) Down:GetNormalTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) Down:GetDisabledTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) Down:GetHighlightTexture():SetTexCoord(1/4, 3/4, 1/4, 3/4) Down:GetHighlightTexture():SetBlendMode('ADD') Down:SetScript('OnClick', function() Slider:SetValue(Slider:GetValue() + Slider:GetHeight() / 3) end) Slider:SetScript('OnValueChanged', function(self, value) local min, max = self:GetMinMaxValues() if(value == min) then Up:Disable() else Up:Enable() end if(value == max) then Down:Disable() else Down:Enable() end self:GetParent():SetVerticalScroll(value) Frame.ScrollChild:SetPoint('TOP', 0, value) end) Slider:SetScript('OnMinMaxChanged', function(self, min) self:SetValue(self:GetValue() or min) end) Frame.Container:SetScript('OnMouseWheel', function(self, alpha) if(alpha > 0) then Slider:SetValue(Slider:GetValue() - Slider:GetHeight() / 3) else Slider:SetValue(Slider:GetValue() + Slider:GetHeight() / 3) end end) end lib.__createSlider = CreateSlider function methods:UpdateSlider() local containerWidth, containerHeight = self.Container:GetSize() local _, _, _, childHeight = self.ScrollChild:GetBoundsRect() local overflow = childHeight > containerHeight if(overflow ~= self.overflow) then self.overflow = overflow if(overflow) then if(not self.Slider) then CreateSlider(self) end self.Slider:Show() self.ScrollChild:SetWidth(containerWidth - 16) elseif(self.Slider) then self.Slider:Hide() self.ScrollChild:SetWidth(containerWidth) end end if(self.Slider) then self.Slider:SetMinMaxValues(0, math.max(0, childHeight - containerHeight)) end end function lib:New(name, glob, defaults) local panel = CreatePanelProto(name, glob, defaults) InterfaceOptions_AddCategory(panel) return panel end lib.widgets = CreateFrame('Frame') lib.widgetVersions = {} function lib:RegisterWidget(type, version, constructor) local oldVersion = self.widgetVersions[type] if(oldVersion and oldVersion >= version) then return end self.widgets['Create' .. type] = constructor self.widgetVersions[type] = version end function lib:GetWidgetVersion(type) return self.widgetVersions[type] end lib.baseWidgets = CreateFrame('Frame') lib.baseWidgetVersions = {} function lib:RegisterBaseWidget(type, version, constructor) local oldVersion = self.baseWidgetVersions[type] if(oldVersion and oldVersion >= version) then return end self.baseWidgets[type] = constructor self.baseWidgetVersions[type] = version end function lib:GetBaseWidgetVersion(type) return self.baseWidgetVersions[type] end function lib:InjectBaseWidget(widget, type) self.baseWidgets[type](widget) end -- not really a fan of CallbackHandler-1.0 local callbacks = {} function methods:Fire(event, ...) local eventCallbacks = callbacks[event] if(eventCallbacks) then for _, callback in next, eventCallbacks do callback(...) end end end function methods:On(event, callback) if(not callbacks[event]) then callbacks[event] = {} end table.insert(callbacks[event], callback) end
vim.cmd([[ iabbrev itn int iabbrev retunr return iabbrev reutnr return iabbrev esle else iabbrev vecotr vector ]])
--[[ Obsolete. You may delete this file. ]]
return { "icons/drug_001", "icons/drug_002", "icons/drug_003", "icons/drug_004", "icons/drug_005", "icons/drug_006", "icons/fete_water_01", "icons/fete_water_02", "icons/fete_water_03", "icons/fete_water_04", "icons/fete_water_05", "icons/fete_water_06", "icons/fete_water_07", "icons/fete_water_08", "icons/fete_water_09", "icons/fete_water_10", "icons/fete_water_11", "icons/fete_water_12", "icons/fete_water_13", "icons/fete_water_14", "icons/fete_water_15", "icons/item_potion_000_001", "icons/item_potion_000_002", "icons/item_potion_000_003", "icons/item_potion_010_001", "icons/item_potion_010_002", "icons/item_potion_010_003", "icons/item_potion_010_004", "icons/item_potion_010_005", "icons/item_potion_010_006", "icons/item_potion_020_001", "icons/item_potion_020_002", "icons/item_potion_020_003", "icons/item_potion_020_004", "icons/item_potion_020_005", "icons/item_potion_020_006", "icons/item_potion_020_007", "icons/item_potion_020_008", "icons/item_potion_030_001", "icons/item_potion_030_002", "icons/item_potion_030_003", "icons/item_potion_030_004", "icons/item_potion_030_005", "icons/item_potion_030_006", "icons/item_potion_030_007", "icons/item_potion_030_008", "icons/item_potion_040_001", "icons/item_potion_040_002", "icons/item_potion_040_003", "icons/item_potion_040_004", "icons/item_potion_040_005", "icons/item_potion_040_006", "icons/item_potion_040_007", "icons/item_potion_040_008", "icons/item_potion_040_009", "icons/item_potion_040_010", "icons/item_potion_050_001", "icons/item_potion_050_002", "icons/item_potion_050_003", "icons/item_potion_050_004", "icons/item_potion_050_005", "icons/item_potion_050_006", "icons/item_potion_050_007", "icons/item_potion_050_008", "icons/item_potion_050_009", "icons/item_potion_050_010", "icons/item_potion_060_001", "icons/item_potion_060_002", "icons/item_potion_060_003", "icons/item_potion_060_004", "icons/item_potion_060_005", "icons/item_potion_060_006", "icons/item_potion_060_007", "icons/item_potion_060_008", "icons/item_potion_070_001", "icons/item_potion_070_002", "icons/item_potion_070_003", "icons/item_potion_070_004", "icons/item_potion_070_005", "icons/item_potion_070_006", "icons/item_potion_99", }
-- Basic skinning example. local windowHeader = love.graphics.newImage 'skin/window_header.png' local windowBody = love.graphics.newImage 'skin/window.png' local checkboxTexture = love.graphics.newImage 'skin/checkbox.png' local checkboxOff = {checkboxTexture, love.graphics.newQuad(0, 0, 51, 55, 58, 115)} local checkboxOn = {checkboxTexture, love.graphics.newQuad(0, 55, 58, 60, 58, 115)} local buttonTexture = love.graphics.newImage 'skin/button.png' local buttonNormal = {buttonTexture, love.graphics.newQuad(0, 0, 69, 52, 69, 156)} local buttonActive = {buttonTexture, love.graphics.newQuad(0, 52, 69, 52, 69, 156)} local buttonHover = {buttonTexture, love.graphics.newQuad(0, 104, 69, 52, 69, 156)} local style = { ['text'] = { ['color'] = '#000000' }, ['button'] = { ['normal'] = buttonNormal, ['hover'] = buttonHover, ['active'] = buttonActive, ['text background'] = '#00000000', ['text normal'] = '#000000', ['text hover'] = '#000000', ['text active'] = '#ffffff' }, ['checkbox'] = { ['normal'] = checkboxOff, ['hover'] = checkboxOff, ['active'] = checkboxOff, ['cursor normal'] = checkboxOn, ['cursor hover'] = checkboxOn, ['text normal'] = '#000000', ['text hover'] = '#000000', ['text active'] = '#000000', ['text background'] = '#d3ceaa' }, ['window'] = { ['header'] = { ['normal'] = windowHeader, ['hover'] = windowHeader, ['active'] = windowHeader, ['label normal'] = '#000000', ['label hover'] = '#000000', ['label active'] = '#000000', ['label padding'] = {x = 10, y = 8} }, ['fixed background'] = windowBody, ['background'] = '#d3ceaa' } } local check = {value = false} return function (ui) ui:stylePush(style) if ui:windowBegin('Skin Example', 200, 200, 350, 200, 'title', 'movable') then ui:layoutSpaceBegin('dynamic', 150, 3) ui:layoutSpacePush(0.14, 0.15, 0.72, 0.3) ui:label('Skin example! Styles can change skins, colors, padding, font, and more.', 'wrap') ui:layoutSpacePush(0.2, 0.55, 0.2, 0.2) ui:button('Button') ui:layoutSpacePush(0.55, 0.55, 0.3, 0.2) ui:checkbox('Checkbox', check) ui:layoutSpaceEnd() end ui:windowEnd() ui:stylePop() end
local Tunnel = module("vrp","lib/Tunnel") local Proxy = module("vrp","lib/Proxy") vRP = Proxy.getInterface("vRP") --[ CONEXÃO ]----------------------------------------------------------------------------------------------------------------------------------------------------------- src = {} Tunnel.bindInterface("vrp_chest",src) vCLIENT = Tunnel.getInterface("vrp_chest") --[ VARIAVEIS ]--------------------------------------------------------------------------------------------------------------------------------------------------------- local logBauDmla = "" local logDplaArsenal = "" local logDplaEvidencias = "" --[ CHEST ]------------------------------------------------------------------------------------------------------------------------------------------------------------- local chest = { ["ems"] = { 5000,"ems.permissao" }, ["policia-arsenal"] = { 5000,"policia.permissao" }, ["policia-evidencias"] = { 5000,"policia.permissao" }, } --[ VARIÁVEIS ]--------------------------------------------------------------------------------------------------------------------------------------------------------- local actived = {} --[ ACTIVEDOWNTIME ]---------------------------------------------------------------------------------------------------------------------------------------------------- local actived = {} Citizen.CreateThread(function() while true do for k,v in pairs(actived) do if actived[k] > 0 then actived[k] = v - 1 if actived[k] <= 0 then actived[k] = nil end end end Citizen.Wait(100) end end) --[ CHECKINTPERMISSIONS ]----------------------------------------------------------------------------------------------------------------------------------------------- function src.checkIntPermissions(chestName) local source = source local user_id = vRP.getUserId(source) if user_id then if not vRP.searchReturn(source,user_id) then if vRP.hasPermission(user_id,"policia.permissao") then return true end if vRP.hasPermission(user_id,chest[chestName][2]) then return true end end end return false end --[ OPENCHEST ]--------------------------------------------------------------------------------------------------------------------------------------------------------- function src.openChest(chestName) local source = source local user_id = vRP.getUserId(source) if user_id then local hsinventory = {} local myinventory = {} local data = vRP.getSData("chest:"..tostring(chestName)) local result = json.decode(data) or {} if result then for k,v in pairs(result) do if vRP.itemBodyList(k) then table.insert(hsinventory,{ amount = parseInt(v.amount), name = vRP.itemNameList(k), index = vRP.itemIndexList(k), key = k, peso = vRP.getItemWeight(k) }) end end local inv = vRP.getInventory(parseInt(user_id)) for k,v in pairs(inv) do if vRP.itemBodyList(k) then table.insert(myinventory,{ amount = parseInt(v.amount), name = vRP.itemNameList(k), index = vRP.itemIndexList(k), key = k, peso = vRP.getItemWeight(k) }) end end end return hsinventory,myinventory,vRP.getInventoryWeight(user_id),vRP.getInventoryMaxWeight(user_id),vRP.computeItemsWeight(result),parseInt(chest[tostring(chestName)][1]) end return false end --[ STOREITEM ]--------------------------------------------------------------------------------------------------------------------------------------------------------- function src.storeItem(chestName,itemName,amount) if itemName then local source = source local user_id = vRP.getUserId(source) if user_id then if vRP.storeChestItem(user_id,"chest:"..tostring(chestName),itemName,amount,chest[tostring(chestName)][1]) then local identity = vRP.getUserIdentity(user_id) if identity then if chestName == "dmla" then PerformHttpRequest(logBauDmla, function(err, text, headers) end, 'POST', json.encode({ embeds = { { ------------------------------------------------------------ title = "REGISTRO DE BAÚ MÉDICO:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀", thumbnail = { url = "https://i.imgur.com/5ydYKZg.png" }, fields = { { name = "**QUEM GUARDOU:**", value = "**"..identity.name.." "..identity.firstname.."** [**"..user_id.."**]" }, { name = "**ITEM GUARDADO:**", value = "[ **Item: "..vRP.itemNameList(itemName).."** ][ **Quantidade: "..parseInt(amount).."** ]\n⠀⠀" } }, footer = { text = "BRZ - "..os.date("%d/%m/%Y | %H:%M:%S"), icon_url = "https://i.imgur.com/5ydYKZg.png" }, color = 16431885 } } }), { ['Content-Type'] = 'application/json' }) elseif chestName == "dpla-arsenal" then PerformHttpRequest(logDplaArsenal, function(err, text, headers) end, 'POST', json.encode({ embeds = { { ------------------------------------------------------------ title = "REGISTRO DE ARSENAL:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀", thumbnail = { url = "https://i.imgur.com/5ydYKZg.png" }, fields = { { name = "**QUEM GUARDOU:**", value = "**"..identity.name.." "..identity.firstname.."** [**"..user_id.."**]" }, { name = "**ITEM GUARDADO:**", value = "[ **Item: "..vRP.itemNameList(itemName).."** ][ **Quantidade: "..parseInt(amount).."** ]\n⠀⠀" } }, footer = { text = "BRZ - "..os.date("%d/%m/%Y | %H:%M:%S"), icon_url = "https://i.imgur.com/5ydYKZg.png" }, color = 16431885 } } }), { ['Content-Type'] = 'application/json' }) elseif chestName == "dpla-evicencias" then PerformHttpRequest(logDplaEvidencias, function(err, text, headers) end, 'POST', json.encode({ embeds = { { ------------------------------------------------------------ title = "REGISTRO DE EVIDENCIAS:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀", thumbnail = { url = "https://i.imgur.com/5ydYKZg.png" }, fields = { { name = "**QUEM GUARDOU:**", value = "**"..identity.name.." "..identity.firstname.."** [**"..user_id.."**]" }, { name = "**ITEM GUARDADO:**", value = "[ **Item: "..vRP.itemNameList(itemName).."** ][ **Quantidade: "..parseInt(amount).."** ]\n⠀⠀" } }, footer = { text = "BRZ - "..os.date("%d/%m/%Y | %H:%M:%S"), icon_url = "https://i.imgur.com/5ydYKZg.png" }, color = 16431885 } } }), { ['Content-Type'] = 'application/json' }) end end TriggerClientEvent("Chest:UpdateChest",source,"updateChest") else TriggerClientEvent("Notify",source,"negado","Você precisa especificar a quantidade.",10000) end end end end --[ TAKEITEM ]---------------------------------------------------------------------------------------------------------------------------------------------------------- function src.takeItem(chestName,itemName,amount) if itemName then local source = source local user_id = vRP.getUserId(source) if user_id then if vRP.tryChestItem(user_id,"chest:"..tostring(chestName),itemName,amount) then local identity = vRP.getUserIdentity(user_id) if identity then if chestName == "dmla" then PerformHttpRequest(logBauDmla, function(err, text, headers) end, 'POST', json.encode({ embeds = { { ------------------------------------------------------------ title = "REGISTRO DE BAÚ MÉDICO:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀", thumbnail = { url = "https://i.imgur.com/5ydYKZg.png" }, fields = { { name = "**QUEM RETIROU:**", value = "**"..identity.name.." "..identity.firstname.."** [**"..user_id.."**]" }, { name = "**ITEM RETIRADO:**", value = "[ **Item: "..vRP.itemNameList(itemName).."** ][ **Quantidade: "..parseInt(amount).."** ]\n⠀⠀" } }, footer = { text = "BRZ - "..os.date("%d/%m/%Y | %H:%M:%S"), icon_url = "https://i.imgur.com/5ydYKZg.png" }, color = 16431885 } } }), { ['Content-Type'] = 'application/json' }) elseif chestName == "dpla-arsenal" then PerformHttpRequest(logDplaArsenal, function(err, text, headers) end, 'POST', json.encode({ embeds = { { ------------------------------------------------------------ title = "REGISTRO DE ARSENAL:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀", thumbnail = { url = "https://i.imgur.com/5ydYKZg.png" }, fields = { { name = "**QUEM RETIROU:**", value = "**"..identity.name.." "..identity.firstname.."** [**"..user_id.."**]" }, { name = "**ITEM RETIRADO:**", value = "[ **Item: "..vRP.itemNameList(itemName).."** ][ **Quantidade: "..parseInt(amount).."** ]\n⠀⠀" } }, footer = { text = "BRZ - "..os.date("%d/%m/%Y | %H:%M:%S"), icon_url = "https://i.imgur.com/5ydYKZg.png" }, color = 16431885 } } }), { ['Content-Type'] = 'application/json' }) elseif chestName == "dpla-evicencias" then PerformHttpRequest(logDplaEvidencias, function(err, text, headers) end, 'POST', json.encode({ embeds = { { ------------------------------------------------------------ title = "REGISTRO DE EVIDENCIAS:⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n⠀", thumbnail = { url = "https://i.imgur.com/5ydYKZg.png" }, fields = { { name = "**QUEM RETIROU:**", value = "**"..identity.name.." "..identity.firstname.."** [**"..user_id.."**]" }, { name = "**ITEM RETIRADO:**", value = "[ **Item: "..vRP.itemNameList(itemName).."** ][ **Quantidade: "..parseInt(amount).."** ]\n⠀⠀" } }, footer = { text = "BRZ - "..os.date("%d/%m/%Y | %H:%M:%S"), icon_url = "https://i.imgur.com/5ydYKZg.png" }, color = 16431885 } } }), { ['Content-Type'] = 'application/json' }) end end TriggerClientEvent("Chest:UpdateChest",source,"updateChest") else TriggerClientEvent("Notify",source,"negado","Você precisa especificar a quantidade.",10000) end end end end
local utils = require("utils") local jautils = require("mods").requireFromPlugin("libraries.jautils") local drawableSpriteStruct = require("structs.drawable_sprite") local customRisingLava = {} customRisingLava.name = "FrostHelper/CustomRisingLava" jautils.createPlacementsPreserveOrder(customRisingLava, "normal", { { "intro", false }, { "speed", -30 }, { "coldColor1", "33ffe7", "color" }, { "hotColor1", "ff8933", "color" }, { "coldColor2", "4ca2eb", "color" }, { "hotColor2", "f25e29", "color" }, { "coldColor3", "0151d0", "color" }, { "hotColor3", "d01c01", "color" }, { "reverseCoreMode", false }, { "doRubberbanding", true }, }) function customRisingLava.sprite(room, entity) local rcm = entity.reverseCoreMode local topColor, fillColor = rcm and jautils.getColor(entity.coldColor1) or jautils.getColor(entity.hotColor1), rcm and jautils.getColor(entity.coldColor2) or jautils.getColor(entity.hotColor2) local bubbleColor = rcm and jautils.getColor(entity.coldColor3) or jautils.getColor(entity.hotColor3) local top = drawableSpriteStruct.fromTexture("editor/FrostHelper/CustomRisingLavaTop", entity) top:setColor(topColor) local fill = drawableSpriteStruct.fromTexture("editor/FrostHelper/CustomRisingLavaFill", entity) fill:setColor(fillColor) local bubbles = drawableSpriteStruct.fromTexture("editor/FrostHelper/CustomRisingLavaBubbles", entity) bubbles:setColor(topColor) return { top, fill, bubbles, drawableSpriteStruct.fromTexture("editor/FrostHelper/CustomRisingLavaOutline", entity) } end function customRisingLava.selection(room, entity) return utils.rectangle(entity.x - 12, entity.y - 12, 24, 24) end return customRisingLava
GuildControl = SimpleClass(BaseControl) function GuildControl:__init(...) end function GuildControl:__init_self() end function GuildControl:initEvent() --EventMgr:addListener(Define.On_Scene_Load_Begin,Bind(self.onSceneLoadBegin,self)) end --Control ClassName--uiEnum--openUI EventCmd--closeUI EventCmd Register('GuildControl',UIEnum.GuildUI,GuildCmd.On_Open_UI,GuildCmd.On_Close_UI)
--[[********************************** * * Multi Theft Auto - Admin Panel * * admin_ip2c.lua * * Original File by lil_Toady * **************************************]] local aCountries = {} local makeCor function getPlayerCountry ( player ) return getIpCountry ( getPlayerIP ( player ) ) end function getIpCountry ( ip ) if not loadIPGroupsIsReady() then return false end local ip_group = tonumber ( gettok ( ip, 1, 46 ) ) local ip_code = ( gettok ( ip, 2, 46 ) * 65536 ) + ( gettok ( ip, 3, 46 ) * 256 ) + ( gettok ( ip, 4, 46 ) ) if ( not aCountries[ip_group] ) then return false end for id, group in ipairs ( aCountries[ip_group] ) do local buffer = ByteBuffer:new( group ) local rstart = buffer:readInt24() if ip_code >= rstart then local rend = buffer:readInt24() if ip_code <= rend then local rcountry = buffer:readBytes( 2 ) return rcountry ~= "ZZ" and rcountry end end end return false end -- Returns false if aCountries is not ready function loadIPGroupsIsReady () if ( get ( "*useip2c" ) == "false" ) then return false end if ( #aCountries == 0 and not makeCor) then makeCor = coroutine.create(loadIPGroupsWorker) coroutine.resume(makeCor) end return makeCor == nil end setTimer( loadIPGroupsIsReady, 1000, 1 ) -- Load all IP groups from "conf/IpToCountryCompact.csv" function loadIPGroupsWorker () unrelPosReset() local readFilename = "conf/IpToCountryCompact.csv"; local hReadFile = fileOpen( readFilename, true ) if not hReadFile then outputHere ( "Cannot read " .. readFilename ) return end local buffer = "" local tick = getTickCount() while true do local endpos = string.find(buffer, "\n") if makeCor and ( getTickCount() > tick + 50 ) then -- Execution exceeded 50ms so pause and resume in 50ms setTimer(function() local status = coroutine.status(makeCor) if (status == "suspended") then coroutine.resume(makeCor) elseif (status == "dead") then makeCor = nil end end, 50, 1) coroutine.yield() tick = getTickCount() end -- If can't find CR, try to load more from the file if not endpos then if fileIsEOF( hReadFile ) then break end buffer = buffer .. fileRead( hReadFile, 500 ) end if endpos then -- Process line local line = string.sub(buffer, 1, endpos - 1) buffer = string.sub(buffer, endpos + 1) local parts = split( line, string.byte(',') ) if #parts > 2 then local rstart = tonumber(parts[1]) local rend = tonumber(parts[2]) local rcountry = parts[3] -- Relative to absolute numbers rstart = unrelRange ( rstart ) rend = unrelRange ( rend ) -- Top byte is group local group = math.floor( rstart / 0x1000000 ) -- Remove top byte from ranges rstart = rstart - group * 0x1000000 rend = rend - group * 0x1000000 if not aCountries[group] then aCountries[group] = {} end local count = #aCountries[group] + 1 -- Add country/IP range to aCountries local buffer = ByteBuffer:new() buffer:writeInt24( rstart ) buffer:writeInt24( rend ) buffer:writeBytes( rcountry, 2 ) aCountries[group][count] = buffer.data end end end fileClose(hReadFile) makeCor = nil collectgarbage("collect") -- Update currently connected players for user,info in pairs( aPlayers ) do info["country"] = getPlayerCountry ( user ) -- Send info to all admins for id, admin in ipairs(getElementsByType("player")) do if ( hasObjectPermissionTo ( admin, "general.adminpanel" ) ) then triggerClientEvent ( admin, "aClientPlayerJoin", user, false, false, false, false, false, aPlayers[user]["country"] ) end end end return true end -- For squeezing data together ByteBuffer = { new = function(self, indata) local newItem = { data = indata or "", readPos = 1 } return setmetatable(newItem, { __index = ByteBuffer }) end, Copy = function(self) return ByteBuffer:new(self.data) end, -- Write writeInt24 = function(self,value) local b0 = math.floor(value / 1) % 256 local b1 = math.floor(value / 256) % 256 local b2 = math.floor(value / 65536) % 256 self.data = self.data .. string.char(b0,b1,b2) end, writeBytes = function(self, chars, count) self.data = self.data .. string.sub(chars,1,count) end, -- Read readInt24 = function(self,value) local b0,b1,b2 = string.byte(self.data, self.readPos, self.readPos+2) self.readPos = self.readPos + 3 return b0 + b1 * 256 + b2 * 65536 end, readBytes = function(self, count) self.readPos = self.readPos + count return string.sub(self.data, self.readPos - count, self.readPos - 1) end, } -- Make a stream of absolute numbers relative to each other local relPos = 0 function relPosReset() relPos = 0 end function relRange( v ) local rel = v - relPos relPos = v return rel end -- Make a stream of relative numbers absolute local unrelPos = 0 function unrelPosReset() unrelPos = 0 end function unrelRange( v ) local unrel = v + unrelPos unrelPos = unrel return unrel end -- IP2C logging function outputHere( msg ) --outputServerLog ( msg ) outputChatBox ( msg ) end ---------------------------------------------------------------------------------------- -- -- How to update admin\conf\IpToCountryCompact.csv: -- -- 1. Download IPV4 CSV from http://software77.net/geo-ip/ and put IpToCountry.csv in admin\conf\ -- 2. Set 'makeAndTestCompactCsv' (below) to true -- 3. (Re)start admin -- 4. Type this command in client console: makecsv -- 5. Wait for 'makeCompactCsv done' message in client console -- 6. Set 'makeAndTestCompactCsv' (below) to false -- 7. Brand new'IpToCountryCompact.csv' should now be in admin\conf\ and will be used when admin is restarted -- ---------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- -- Set to true to enable commands "makecsv" and "iptest" ---------------------------------------------------------------------------------------- local makeAndTestCompactCsv = false if makeAndTestCompactCsv then outputServerLog( "Warning! makeAndTestCompactCsv is true" ) local makeCor -- Takes a 'IPV4 CSV' file sourced from http://software77.net/geo-ip/ -- and makes a smaller one for use by Admin addCommandHandler ( "makecsv", function () local status = makeCor and coroutine.status(makeCor) if (status == "suspended") then outputHere( "Please wait" ) return end makeCor = coroutine.create ( makeCompactCsvWorker ) coroutine.resume ( makeCor ) end ) function makeCompactCsvWorker () outputHere ( "makeCompactCsv started" ) relPosReset() local readFilename = "conf/IpToCountry.csv"; local hReadFile = fileOpen( readFilename, true ) if not hReadFile then outputHere ( "Cannot read " .. readFilename ) return end local writeFilename = "conf/IpToCountryCompact.csv"; local hWriteFile = fileCreate( writeFilename, true ) if not hWriteFile then fileClose(hReadFile) outputHere ( "Cannot create " .. writeFilename ) return end local tick = getTickCount() local cur = {} local buffer = "" while true do if ( makeCor and getTickCount() > tick + 50 ) then -- Execution exceeded 50ms so pause and resume in 50ms setTimer(function() local status = coroutine.status(makeCor) if (status == "suspended") then coroutine.resume(makeCor) elseif (status == "dead") then makeCor = nil end end, 50, 1) coroutine.yield() tick = getTickCount() end local endpos = string.find(buffer, "\n") -- If can't find CR, try to load more from the file if not endpos then if fileIsEOF( hReadFile ) then break end buffer = buffer .. fileRead( hReadFile, 500 ) end if endpos then -- Process line local line = string.sub(buffer, 1, endpos - 1) buffer = string.sub(buffer, endpos + 1) -- If not a comment line if string.sub(line,1,1) ~= '#' then -- Parse out required fields local _,_,rstart,rend,rcountry = string.find(line, '"(%w+)","(%w+)","%w+","%w+","(%w+)"' ) if rcountry then rstart = tonumber(rstart) rend = tonumber(rend) -- -- Save memory by joining ranges here -- local group = math.floor( rstart / 0x1000000 ) if group == cur.group and rstart == cur.rend + 1 and rcountry == cur.rcountry then -- We can extend previous range cur.rend = rend else -- Otherwise flush previous range writeCountryRange(hWriteFile, cur.rstart, cur.rend, cur.rcountry) -- and start a new one cur.group = group cur.rstart = rstart cur.rend = rend cur.rcountry = rcountry end end end end end -- Flush last range writeCountryRange(hWriteFile, cur.rstart, cur.rend, cur.rcountry) fileClose(hWriteFile) fileClose(hReadFile) outputHere ( "makeCompactCsv done" ) end function writeCountryRange(hWriteFile, rstart, rend, rcountry) if not rstart then return end -- Absolute to relative numbers rstart = relRange( rstart ) rend = relRange( rend ) -- Output line fileWrite( hWriteFile, rstart .. "," .. rend .. "," .. rcountry .. "\n" ) end function ipTestDo( c, ip ) local country = getIpCountry ( ip ) outputHere ( "ip " .. ip .. " is in " .. tostring(country) .. " (Expected " .. c .. ")" ) end function ipTest() ipTestDo ( "TR", "46.1.2.3" ) ipTestDo ( "ES", "88.1.2.3" ) ipTestDo ( "FR", "109.1.2.3" ) ipTestDo ( "AR", "190.1.2.3" ) ipTestDo ( "AU", "203.1.2.3" ) end addCommandHandler ( "iptest", ipTest ) end
-- MODULE AUTO-START -- Thanks to jo148 on github for making rofi dpi aware! local filesystem = require('gears.filesystem') local with_dpi = require('beautiful').xresources.apply_dpi local get_dpi = require('beautiful').xresources.get_dpi local awful = require('awful') local rofi_command = 'env /usr/bin/rofi -no-cycle -dpi ' .. get_dpi() .. ' -width ' .. with_dpi(400) .. ' -show drun -theme ' .. filesystem.get_configuration_dir() .. '/configuration/rofi.rasi -run-command "/bin/bash -c -i \'shopt -s expand_aliases; {cmd}\'"' local apps = { -- List of apps to start by default on some actions default = { terminal = 'env sakura', rofi = rofi_command, browser = 'env chromium', editor = 'mousepad', -- gui text editor files = 'pcmanfm', }, -- List of apps to start once on start-up run_on_start_up = { 'nm-applet --indicator', -- wifi '/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 ', -- credential manager '~/.config/autostart', "sleep 3 && onboard", 'xset s off ; xset -dpms ; xset s noblank', '/usr/local/bin/wdash', 'evdev-rce' } } local function run_once(cmd) local findme = cmd local firstspace = cmd:find(' ') if firstspace then findme = cmd:sub(0, firstspace - 1) end awful.spawn.with_shell(string.format('pgrep -u $USER -x %s > /dev/null || (%s)', findme, cmd)) end for _, app in ipairs(apps.run_on_start_up) do run_once(app) end
bar = Bar.new(8) barx = bar:get_x() barp = bar:print(2)
-- Disable Humanoids health regenerating
local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end local minutes = 20 local MINIMUM_WAGE = 50 local JOB_WAGE = 100 local POLICE_WAGE = 200 local MEDIC_WAGE = 500 CreateTimer(function() for key, player in pairs(GetAllPlayers()) do if PlayerData[player] then -- THOSE HAS TO BE ORDER BY WAGE AMOUNT (desc) if PlayerData[player].job == "medic" then PlayerData[player].bank_balance = PlayerData[player].bank_balance + MEDIC_WAGE CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(MEDIC_WAGE)))) elseif PlayerData[player].job == "police" then PlayerData[player].bank_balance = PlayerData[player].bank_balance + POLICE_WAGE CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(POLICE_WAGE)))) elseif PlayerData[player].job ~= nil then PlayerData[player].bank_balance = PlayerData[player].bank_balance + JOB_WAGE CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(JOB_WAGE)))) else PlayerData[player].bank_balance = PlayerData[player].bank_balance + MINIMUM_WAGE CallRemoteEvent(player, "MakeSuccessNotification", _("salary_notification", _("price_in_currency", tostring(MINIMUM_WAGE)))) end end end end, minutes * 60000)
return { item = { _ = { weird_thing = { weird_thing = { desc = { main = { text = "なん", footnote = "〜鑑定報告書:<嫌だなwwww>カテゴリ〜", } }, name = "変なもん", unidentified_name = "えっっっっっ?!" }, } } } }
object_tangible_collection_rock_bubbling_06 = object_tangible_collection_shared_rock_bubbling_06:new { gameObjectType = 8211,} ObjectTemplates:addTemplate(object_tangible_collection_rock_bubbling_06, "object/tangible/collection/rock_bubbling_06.iff")
description "Khat by MrPoll0" client_script "client/main.lua" server_script "server/main.lua"