content stringlengths 5 1.05M |
|---|
-----------------------------------
-- Area: Port Jeuno
-- NPC: Imasuke
-- Starts and Finishes Quest: The Antique Collector
-- !pos -165 11 94 246
-----------------------------------
require("scripts/globals/settings")
require("scripts/globals/titles")
require("scripts/globals/keyitems")
require("scripts/globals/shop")
require("scripts/globals/quests")
local ID = require("scripts/zones/Port_Jeuno/IDs")
-----------------------------------
function onTrade(player, npc, trade)
local theAntiqueCollector = player:getQuestStatus(JEUNO, tpz.quest.id.jeuno.THE_ANTIQUE_COLLECTOR)
-- THE ANTIQUE COLLECTOR (kaiser sword)
if (theAntiqueCollector == QUEST_ACCEPTED and trade:hasItemQty(16631, 1) and trade:getItemCount() == 1) then
player:startEvent(15) -- End quest
end
end
function onTrigger(player, npc)
local circleOfTime = player:getQuestStatus(JEUNO, tpz.quest.id.jeuno.THE_CIRCLE_OF_TIME)
local theAntiqueCollector = player:getQuestStatus(JEUNO, tpz.quest.id.jeuno.THE_ANTIQUE_COLLECTOR)
local circleProgress = player:getCharVar("circleTime")
-- CIRCLE OF TIME
if (circleOfTime == QUEST_ACCEPTED) then
if (circleProgress == 1) then
player:startEvent(30)
elseif (circleProgress == 2) then
player:startEvent(29)
elseif (circleProgress == 3) then
player:startEvent(32)
elseif (circleProgress == 4) then
player:startEvent(33)
elseif (circleProgress == 5) then
player:startEvent(31)
end
-- THE ANTIQUE COLLECTOR
elseif (theAntiqueCollector == QUEST_AVAILABLE and player:getFameLevel(JEUNO) >= 3) then
player:startEvent(13) -- Start quest
elseif (theAntiqueCollector == QUEST_ACCEPTED) then
player:startEvent(14) -- Mid CS
-- DEFAULT DIALOG
else
player:startEvent(12)
end
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
-- THE ANTIQUE COLLECTOR
if (csid == 13 and option == 1) then
player:addQuest(JEUNO, tpz.quest.id.jeuno.THE_ANTIQUE_COLLECTOR)
elseif (csid == 15) then
player:addTitle(tpz.title.TRADER_OF_ANTIQUITIES)
if (player:hasKeyItem(tpz.ki.MAP_OF_DELKFUTTS_TOWER) == false) then
player:addKeyItem(tpz.ki.MAP_OF_DELKFUTTS_TOWER)
player:messageSpecial(ID.text.KEYITEM_OBTAINED, tpz.ki.MAP_OF_DELKFUTTS_TOWER)
else
player:addGil(2000 * GIL_RATE)
player:messageSpecial(ID.text.GIL_OBTAINED, 2000 * GIL_RATE)
player:addExp(2000 * EXP_RATE)
end
player:addFame(JEUNO, 30)
player:tradeComplete(trade)
player:completeQuest(JEUNO, tpz.quest.id.jeuno.THE_ANTIQUE_COLLECTOR)
-- CIRCLE OF TIME
elseif (csid == 29 and option == 1) then
player:setCharVar("circleTime", 3)
elseif (csid == 30 and option == 1) then
player:setCharVar("circleTime", 3)
elseif (csid == 30 and option == 0) then
player:setCharVar("circleTime", 2)
elseif (csid == 33) then
player:setCharVar("circleTime", 5)
end
end
|
local mod = EPGP:NewModule("gptooltip", "AceHook-3.0")
local GP = LibStub("LibGearPoints-1.3")
local L = LibStub("AceLocale-3.0"):GetLocale("EPGP")
local LUI = LibStub("LibEPGPUI-1.0")
local ItemUtils = LibStub("LibItemUtils-1.0")
local function TooltipAddGpLine(tooltip, i, gp, c)
if not gp then return false end
local c = c or ""
if gp == 0 and c == "" then return false end
local s = ("GP%d: %d"):format(i, gp)
if c ~= "" then
s = s .. " (" .. c .. ")"
end
tooltip:AddLine(s, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b);
return true
end
function OnTooltipSetItem(tooltip, ...)
local _, itemlink = tooltip:GetItem()
if not itemlink then return end
local gp1, c1, gp2, c2, gp3, c3 = GP:GetValue(itemlink)
if mod.db.profile.ilvl then
local ilvl = select(4, GetItemInfo(itemlink))
if ilvl then
tooltip:AddLine(("ilvl: %s"):format(ilvl))
end
end
if not TooltipAddGpLine(tooltip, 1, gp1, c1) then return end
if not TooltipAddGpLine(tooltip, 2, gp2, c2) then return end
if not TooltipAddGpLine(tooltip, 3, gp3, c3) then return end
end
mod.dbDefaults = {
profile = {
enabled = true,
threshold = 4, -- Epic
ilvl = false,
}
}
function mod:OnInitialize()
self.db = EPGP.db:RegisterNamespace("gptooltip", mod.dbDefaults)
end
mod.optionsName = L["Tooltip"]
mod.optionsDesc = L["GP on tooltips"]
mod.optionsArgs = {
help = {
order = 1,
type = "description",
name = L["Provide a proposed GP value of armor on tooltips. Quest items or tokens that can be traded for armor will also have a proposed GP value."],
fontSize = "medium",
},
threshold = {
order = 10,
type = "select",
name = L["Quality threshold"],
desc = L["Only display GP values for items at or above this quality."],
values = {
[0] = ITEM_QUALITY0_DESC, -- Poor
[1] = ITEM_QUALITY1_DESC, -- Common
[2] = ITEM_QUALITY2_DESC, -- Uncommon
[3] = ITEM_QUALITY3_DESC, -- Rare
[4] = ITEM_QUALITY4_DESC, -- Epic
[5] = ITEM_QUALITY5_DESC, -- Legendary
[6] = ITEM_QUALITY6_DESC, -- Artifact
},
get = function() return GP:GetQualityThreshold() end,
set = function(info, itemQuality)
info.handler.db.profile.threshold = itemQuality
GP:SetQualityThreshold(itemQuality)
end,
},
spacer1 = LUI:OptionsSpacer(11, 0.001),
ilvl = {
order = 20,
type = "toggle",
name = L["Show item level"],
},
}
function mod:OnEnable()
GP:SetQualityThreshold(self.db.profile.threshold)
local obj = EnumerateFrames()
while obj do
if obj:IsObjectType("GameTooltip") and obj ~= ItemUtils.tooltip then
assert(obj:HasScript("OnTooltipSetItem"))
self:HookScript(obj, "OnTooltipSetItem", OnTooltipSetItem)
end
obj = EnumerateFrames(obj)
end
end
|
local gcc = ToolsetPrototype( 'gcc' );
function gcc.configure( toolset, gcc_settings )
local paths = os.getenv( 'PATH' );
return {
gcc = which( gcc_settings.gcc or os.getenv('CC') or 'gcc', paths );
gxx = which( gcc_settings.gxx or os.getenv('CXX') or 'g++', paths );
ar = which( gcc_settings.ar or os.getenv('AR') or 'ar', paths );
};
end
function gcc.validate( toolset, gcc_settings )
return
exists( gcc_settings.gcc ) and
exists( gcc_settings.gxx ) and
exists( gcc_settings.ar )
;
end
function gcc.initialize( toolset )
local Cc = PatternPrototype( 'Cc' );
Cc.identify = gcc.object_filename;
Cc.build = function( toolset, target ) gcc.compile( toolset, target, 'c' ) end;
toolset.Cc = Cc;
local Cxx = PatternPrototype( 'Cxx' );
Cxx.identify = gcc.object_filename;
Cxx.build = function( toolset, target ) gcc.compile( toolset, target, 'c++' ) end;
toolset.Cxx = Cxx;
local StaticLibrary = FilePrototype( 'StaticLibrary' );
StaticLibrary.identify = gcc.static_library_filename;
StaticLibrary.build = gcc.archive;
StaticLibrary.depend = cc.static_library_depend;
toolset.StaticLibrary = StaticLibrary;
local DynamicLibrary = FilePrototype( 'DynamicLibrary' );
DynamicLibrary.identify = gcc.dynamic_library_filename;
DynamicLibrary.prepare = cc.collect_transitive_dependencies;
DynamicLibrary.build = gcc.link;
toolset.DynamicLibrary = DynamicLibrary;
local Executable = FilePrototype( 'Executable' );
Executable.identify = gcc.executable_filename;
Executable.prepare = cc.collect_transitive_dependencies;
Executable.build = gcc.link;
toolset.Executable = Executable;
toolset:defaults {
architecture = 'native';
assertions = true;
debug = true;
exceptions = true;
fast_floating_point = false;
generate_map_file = true;
optimization = false;
preprocess = false;
run_time_type_info = true;
standard = 'c++17';
strip = false;
toolchain = 'gcc';
verbose_linking = false;
warning_level = 3;
warnings_as_errors = true;
};
return true;
end
function gcc.object_filename( toolset, identifier )
return ('%s.o'):format( identifier );
end
function gcc.static_library_filename( toolset, identifier )
local identifier = absolute( toolset:interpolate(identifier) );
local filename = ('%s/lib%s.a'):format( branch(identifier), leaf(identifier) );
return identifier, filename;
end
function gcc.dynamic_library_filename( toolset, identifier )
local identifier = absolute( toolset:interpolate(identifier) );
local filename = ('%s/lib%s.so'):format( branch(identifier), leaf(identifier) );
return identifier, filename;
end
function gcc.executable_filename( toolset, identifier )
local identifier = absolute( toolset:interpolate(identifier) );
local filename = identifier;
return identifier, filename;
end
-- Compile C and C++ source to object files.
function gcc.compile( toolset, target, language )
local flags = {};
gcc.append_defines( toolset, target, flags );
gcc.append_include_directories( toolset, target, flags );
gcc.append_compile_flags( toolset, target, flags, language );
local gcc_ = toolset.gcc.gcc;
local environment = { PATH = branch(gcc_) };
local ccflags = table.concat( flags, ' ' );
local dependencies = ('%s.d'):format( target );
local source = target:dependency();
local output = target:filename();
local input = absolute( source:filename() );
printf( leaf(source:id()) );
target:clear_implicit_dependencies();
system(
gcc_,
('gcc %s -MMD -MF "%s" -o "%s" "%s"'):format(ccflags, dependencies, output, input),
environment,
toolset:dependencies_filter(target)
);
end
-- Archive objects into a static library.
function gcc.archive( toolset, target )
pushd( toolset:obj_directory(target) );
local objects = {};
local outdated_objects = 0;
for _, dependency in target:dependencies() do
local prototype = dependency:prototype();
if prototype ~= toolset.Directory and prototype ~= toolset.StaticLibrary and prototype ~= toolset.DynamicLibrary then
table.insert( objects, relative(dependency) );
if dependency:outdated() then
outdated_objects = outdated_objects + 1;
end
end
end
if outdated_objects > 0 or not exists(target) then
printf( leaf(target) );
local objects = table.concat( objects, '" "' );
local ar = toolset.gcc.ar;
local environment = { PATH = branch(ar) };
system( ar, ('ar -rcs "%s" "%s"'):format(native(target), objects), environment );
else
touch( target );
end
popd();
end
-- Link dynamic libraries and executables.
function gcc.link( toolset, target )
pushd( toolset:obj_directory(target) );
local objects = {};
for _, dependency in walk_dependencies(target) do
local prototype = dependency:prototype();
if prototype ~= toolset.StaticLibrary and prototype ~= toolset.DynamicLibrary and prototype ~= toolset.Directory then
table.insert( objects, relative(dependency) );
end
end
local flags = {};
gcc.append_link_flags( toolset, target, flags );
gcc.append_library_directories( toolset, target, flags );
local libraries = {};
gcc.append_libraries( toolset, target, libraries );
gcc.append_third_party_libraries( toolset, target, libraries );
if #objects > 0 then
local ldflags = table.concat( flags, ' ' );
local ldobjects = table.concat( objects, '" "' );
local ldlibs = table.concat( libraries, ' ' );
local gxx = toolset.gcc.gxx;
local environment = { PATH = branch(gxx) };
printf( leaf(target) );
system( gxx, ('g++ %s "%s" %s'):format(ldflags, ldobjects, ldlibs), environment );
end
popd();
end
function gcc.append_flags( flags, values, format )
local format = format or '%s';
if values then
for _, flag in ipairs(values) do
table.insert( flags, format:format(flag) );
end
end
end
function gcc.append_defines( toolset, target, flags )
if not toolset.assertions then
table.insert( flags, '-DNDEBUG' );
end
gcc.append_flags( flags, toolset.defines, '-D%s' );
gcc.append_flags( flags, target.defines, '-D%s' );
end
function gcc.append_include_directories( toolset, target, flags )
gcc.append_flags( flags, target.include_directories, '-I "%s"' );
gcc.append_flags( flags, toolset.include_directories, '-I "%s"' );
end
function gcc.append_compile_flags( toolset, target, flags, language )
table.insert( flags, '-c' );
table.insert( flags, ('-march=%s'):format(toolset.architecture) );
table.insert( flags, '-fpic' );
gcc.append_flags( flags, target.cppflags );
gcc.append_flags( flags, toolset.cppflags );
local language = language or 'c++';
table.insert( flags, ('-x %s'):format(language) );
if string.find(language, 'c++', 1, true) then
if toolset.exceptions then
table.insert( flags, '-fexceptions' );
end
if toolset.run_time_type_info then
table.insert( flags, '-frtti' );
end
local standard = toolset.standard;
if standard then
table.insert( flags, ('-std=%s'):format(standard) );
end
end
if toolset.debug then
table.insert( flags, '-g3' );
end
if toolset.optimization then
table.insert( flags, '-O3' );
table.insert( flags, '-Ofast' );
end
if toolset.preprocess then
table.insert( flags, '-E' );
end
if toolset.runtime_checks then
table.insert( flags, '-fstack-protector' );
else
table.insert( flags, '-fno-stack-protector' );
end
if toolset.warnings_as_errors then
table.insert( flags, '-Werror' );
end
local warning_level = toolset.warning_level
if warning_level == 0 then
table.insert( flags, '-w' );
elseif warning_level == 1 then
table.insert( flags, '-Wall' );
elseif warning_level >= 2 then
table.insert( flags, '-Wall -Wextra' );
end
if language:find('c++', 1, true) then
gcc.append_flags( flags, toolset.cxxflags );
gcc.append_flags( flags, target.cxxflags );
else
gcc.append_flags( flags, toolset.cflags );
gcc.append_flags( flags, target.cflags );
end
end
function gcc.append_library_directories( toolset, target, flags )
gcc.append_flags( flags, target.library_directories, '-L "%s"' );
gcc.append_flags( flags, toolset.library_directories, '-L "%s"' );
end
function gcc.append_link_flags( toolset, target, flags )
gcc.append_flags( flags, toolset.ldflags );
gcc.append_flags( flags, target.ldflags );
table.insert( flags, ('-march=%s'):format(toolset.architecture) );
table.insert( flags, "-std=c++11" );
if target:prototype() == toolset.DynamicLibrary then
table.insert( flags, "-shared" );
end
if toolset.verbose_linking then
table.insert( flags, "--verbose" );
end
if toolset.debug then
table.insert( flags, "-g" );
end
-- The latest GCC with Android (or clang with iOS) doesn't recognize
-- '-Wl,map' to specify the path to output a mapfile.
-- if toolset.generate_map_file then
-- table.insert( flags, ('-Wl,-Map,"%s"'):format(native(("%s.map"):format(target:filename()))) );
-- end
if toolset.strip and not toolset.generate_dsym_bundle then
table.insert( flags, "-Wl,--strip-all" );
end
if toolset.exported_symbols_list then
table.insert( flags, ('-exported_symbols_list "%s"'):format(absolute(toolset.exported_symbols_list)) );
end
table.insert( flags, ('-o "%s"'):format(native(target:filename())) );
end
function gcc.append_libraries( toolset, target, flags )
for _, dependency in target:dependencies() do
local prototype = dependency:prototype();
if prototype == toolset.StaticLibrary or prototype == toolset.DynamicLibrary then
local library = dependency;
if library.whole_archive then
table.insert( flags, '-Wl,--whole-archive' );
end
table.insert( flags, ('-l%s'):format(library:id()) );
if library.whole_archive then
table.insert( flags, '-Wl,--no-whole-archive' );
end
end
end
end
function gcc.append_third_party_libraries( toolset, target, flags )
gcc.append_flags( flags, toolset.libraries, '-l%s' );
gcc.append_flags( flags, target.libraries, '-l%s' );
end
return gcc;
|
package.path = package.path .. ';../libs/?.lua'
require("utf8data")
require("utf8")
window = js.global
currentWord = ""
numWin = 0
numLose = 0
secondsLeft = 0
TTL = 15
timer = nil
strTimer = nil
btnStart = nil
txtResult = nil
interval = "секунд"
intervalEnding = {"", "а", "ы"}
strings = {
pushbutton = "Нажмите кнопку \"Играть\".",
gameover = "Игра закончена. ",
time = "Осталось ",
timeover = "Время истекло. ",
good = "Угадали. "
}
wordList = {"АНТИЛОПА", "БЕГЕМОТ", "АВТОМОБИЛЬ", "ФУТБОЛ", "ПАРОВОЗ", "КОРОБКА", "ПИАНИНО", "ТЕЛЕВИЗОР", "РЕСТОРАН", "ОЛИМПИАДА"}
-- Вспомогательные функции
-- Перемешиваем значения в таблице
-- void table.shuffle(table t)
function table.shuffle(t)
math.randomseed(os.time())
local counter = #t
while counter > 1 do
local index = math.random(counter)
t[index], t[counter] = t[counter], t[index]
counter = counter - 1
end
return t
end
-- Разбиваем строку по символам, преобразуя в таблицу
-- table string:split()
function string:split()
local t = {}
for i=1, string.utf8len(self) do
table.insert(t, string.utf8sub(self, i, i))
end
return t
end
-- Делаем правильные окончания
function ending(num, str, t)
if num%100 >= 11 and num%100 <= 14 then return str .. t[1] end
local n = num%10
if n == 1 then return str .. t[2] end
if n == 2 or n == 3 or n == 4 then return str .. t[3] end
return str .. t[1]
end
-- Выбираем случайное слово, перемешиваем его и запускаем счётчик
-- void getNewWord()
function getNewWord()
if #wordList == 0 then
strTimer.innerHTML = strings["gameover"]
return
end
secondsLeft = TTL
changeTimer()
table.shuffle(wordList)
currentWord = table.remove(wordList, 1)
-- перепутанная строка
window.document:getElementById("strWord").innerHTML = table.concat(table.shuffle(currentWord:split()))
txtResult.value = "" -- очистка поля ввода
txtResult:focus()
btnStart.disabled = "disabled"
txtResult.disabled = ""
timer = window:setInterval(getTime, 1000) -- запуск таймера
end
function getTime()
secondsLeft = secondsLeft - 1
changeTimer()
if secondsLeft <= 0 then -- время вышло
numLose = numLose + 1
window.document:getElementById("strLose").innerHTML = numLose
window:clearInterval(timer)
btnStart.disabled = ""
btnStart:focus()
txtResult.disabled = "disabled"
end
end
function changeTimer()
if secondsLeft == 0 then strTimer.innerHTML = strings["timeover"] .. strings["pushbutton"]; return end
strTimer.innerHTML = strings["time"] .. secondsLeft .. " " .. ending(secondsLeft, interval, intervalEnding );
end
-- Прверяем то, что вводит пользователь
function checkInput()
if string.utf8upper(txtResult.value) == currentWord then -- игрок угадал
numWin = numWin + 1
window.document:getElementById("strWin").innerHTML = numWin
btnStart.disabled = ""
window:clearInterval(timer)
strTimer.innerHTML = strings["good"] .. strings["pushbutton"]
btnStart:focus()
txtResult.disabled = "disabled"
end
end
-- init
txtResult = window.document:getElementById("txtResult")
txtResult:addEventListener("keyup", checkInput)
btnStart = window.document:getElementById("btnStart")
btnStart:addEventListener("click", getNewWord)
strTimer = window.document:getElementById("strTimer")
strTimer.innerHTML = strings["pushbutton"]
|
--=========== Copyright © 2017, Planimeter, All rights reserved. =============--
--
-- Purpose:
--
--============================================================================--
argv = {}
for _, v in ipairs( arg ) do argv[ v ] = true end
if ( argv[ "--debug" ] ) then
_DEBUG = true
end
if ( argv[ "--dedicated" ] ) then
_SERVER = true
_DEDICATED = true
end
if ( not _SERVER ) then
_CLIENT = true
end
function framework.conf( c )
if ( _DEDICATED ) then
c.modules.window = false
c.modules.graphics = false
else
c.window.title = "Untitled"
c.window.icon = "images/icon.png"
if ( jit.os == "OSX" ) then
c.window.icon = "images/icon_osx.png"
end
end
c.identity = false
end
|
local InGameSetup = script.Parent.Parent
local SetGlobalGuiInset = require(InGameSetup.Actions.SetGlobalGuiInset)
return function(state, action)
state = state or {
left = 0,
top = 36,
right = 0,
bottom = 0,
}
if action.type == SetGlobalGuiInset.name then
return {
left = action.left,
top = action.top,
right = action.right,
bottom = action.bottom,
}
end
return state
end |
local basedir = "http://heavy.noxiousnet.com/music/"
local function ms(m, s) return m * 60 + s end
GM.BackgroundMusic = {
{
"Foozogz",
"Party Rabbit",
"foozogz-party_rabbit.ogg",
288
},
{
"Foozogz",
"Enveloped",
"foozogz-enveloped.ogg",
205
},
{
"Foozogz",
"Pinkie Loves Sugar VIP",
"foozogz-pinkie_loves_sugar_vip.ogg",
217
},
{
"Foozogz",
"A Sunny Day",
"foozogz-a_sunny_day.ogg",
208
},
{
"Foozogz",
"Dream Chaser",
"foozogz-dream_chaser.ogg",
222
},
{
"Foozogz",
"Pinkie's Videogame BGM",
"foozogz-pinkies_video_game_bgm.ogg",
240
},
{
"Foozogz",
"Fluttershy Likes Being Nice",
"foozogz-fluttershy_likes_being_nice.ogg",
ms(3, 56)
},
{
"Foozogz",
"Feeling Whimsical",
"foozogz-feeling_whimsical.ogg",
ms(2, 54)
},
{
"Foozogz",
"Stratacoaster",
"foozogz-stratacoaster.ogg",
ms(3, 54)
},
{
"Starship Amazing",
"A Full-Length Docudrama Based On The Making Of The Movie Space Jam",
"starship_amazing-a_full-length_docudrama_based_on_the_making_of_the_movie_space_jam.ogg",
ms(5, 16)
},
{
"Level 99",
"Ecco: The Tides of Time 'Waves of Stone'",
"level99-waves_of_stone.ogg",
ms(3, 54)
},
{
"GARticuno",
"Ore no Barklimouto",
"garticuno-ore_no_barklimouto.ogg",
ms(4, 13)
},
{
"_ensnare_",
"Excerpt from Live Mix Jan 2012",
"_ensnare_-excerpt_from_live_mix_jan_2012.ogg",
ms(2, 53)
},
{
"Foozogz",
"Of Fond Memories",
"foozogz-of_fond_memories.ogg",
ms(3, 23)
},
{
"Foozogz",
"Sweetheart",
"foozogz-sweetheart.ogg",
ms(3, 48)
},
{
"Foozogz",
"Space Invaders",
"foozogz-space_invaders.ogg",
ms(4, 07)
},
{
"Planetboom",
"SuperSonic",
"planetboom-supersonic.ogg",
ms(3, 15)
},
{
"Warrior's Orochi",
"Theme of Lu Bu",
"warriors_orochi-theme_of_lu_bu.ogg",
ms(2, 15)
},
{
"Nutritious",
"Trial by Fire",
"nutritious-trial_by_fire.ogg",
ms(4, 00)
}
}
AccessorFunc(GM, "CurrentTrack", "CurrentTrack", FORCE_STRING)
local Music
local MusicChannel
local CVarVolume = CreateClientConVar("pbe2_volume", "25", true, false)
cvars.AddChangeCallback("pbe2_volume", function(cvar, oldvalue, newvalue)
oldvalue = tonumber(oldvalue) or 0
newvalue = tonumber(newvalue) or 0
GAMEMODE.MusicVolume = math.Clamp(math.ceil(newvalue) / 100, 0, 1)
GAMEMODE:MusicVolumeChanged(oldvalue)
end)
function GM:MusicVolumeChanged(oldvalue)
if self.MusicVolume == 0 then
self:StopMusic()
else
if self.MusicVolume > 0 and oldvalue <= 0 then
self:PlayMusic()
end
if MusicChannel then
MusicChannel:SetVolume(self.MusicVolume)
end
end
end
local NextMusic
function GM:MusicThink()
if self.MusicVolume == nil then
self.MusicVolume = math.Clamp(math.ceil(CVarVolume:GetInt()) / 100, 0, 1)
self:MusicVolumeChanged(0)
elseif NextMusic and RealTime() >= NextMusic then
self:PlayMusic()
end
end
function GM:PlayMusic(trackid)
if self.MusicVolume <= 0 then return end
local track = self.BackgroundMusic[trackid]
if not track then
local currenttrack = self:GetCurrentTrack()
local notplaying = {}
for k, v in pairs(self.BackgroundMusic) do
if v[1] ~= currenttrack then
table.insert(notplaying, v)
end
end
math.randomseed(CurTime())
track = table.Random(notplaying)
end
self:StopMusic()
self:PlayMusicUrl(basedir..track[3])
self:SetCurrentTrack(track[1])
NextMusic = RealTime() + track[4]
end
function GM:PlayMusicUrl(url)
Music = sound.PlayURL(url, "noblock", function(channel)
if channel then
MusicChannel = channel
channel:SetVolume(self.MusicVolume)
end
end)
end
function GM:StopMusic()
if MusicChannel then
MusicChannel:Stop()
MusicChannel = nil
end
NextMusic = 0
end
|
-- This plugin copyright Alexander Harkness 2013, licensed under the MIT license.
-- Configuration
g_ServerLang = "en"
g_ConsoleLang = "en"
-- Global Variables
g_Plugin = nil
g_PluginDir = ""
g_DataLoc = ""
g_UserData = nil
-- START WITH DA AWESOME!
function Initialize( Plugin )
-- Set up the globals.
g_Plugin = Plugin
g_PluginDir = Plugin:GetLocalFolder()
g_DataLoc = g_PluginDir .. "/userdata.ini"
-- Set up the plugin details.
Plugin:SetName( "TransAPI" )
Plugin:SetVersion( 1 )
-- This is the place for commands!
cPluginManager.BindCommand("/language", "transapi.setlang", HandleLanguageCommand, " - Set your preferred language (use ISO 639-1)")
-- Load the userdata file.
g_UserData = cIniFile()
LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
return true
end
function GetLanguage( Player )
-- Returns a language to use.
if g_UserData:ReadFile(g_DataLoc) then
local userLang = g_UserData:GetValueSet( Player:GetName(), "language", "false" )
g_UserData:WriteFile(g_DataLoc)
end
if userLang == "false" then
return g_ServerLang
else
return userLang
end
end
function GetConsoleLanguage()
-- Return the language to use for console messages.
return g_ConsoleLang
end
function HandleLanguageCommand( Split, Player )
-- If the user is not setting the language, tell them the currently selected one.
if #Split ~= 2 then
local userLang = g_UserData:GetValueSet( Player:GetName(), "language", "false" )
if userLang == "false" then
return g_ServerLang
else
return userLang
end
end
-- Set the language.
local success = g_UserData:SetValue( Player:GetName(), "language", Split[2] )
g_UserData:WriteFile(g_DataLoc)
if not success then
Player:SendMessage( "Language could not be set!" )
else
Player:SendMessage( "Language set!" )
end
return true
end
function OnDisable()
LOG( "Disabled TransAPI!" )
end
|
local copas = require "copas"
local lfs = require "lfs"
local file = require "pl.file"
local path = require "pl.path"
local JSON = require "json"
local shell = require "lib/shell"
local md5 = require "md5"
local pretty = require 'pl.pretty'
local struct = require 'struct'
local file_image = require "lib/file-image"
local DeviceConfigFile = "devconfig.lua"
local FirmwareConfigFile = "fwconfig.lua"
local CONFIG_HASH_NAME = "config_hash.cfg"
local ProjectMt = {}
ProjectMt.__index = ProjectMt
local function GenerateFileLists(storage, fileList)
local function store(f, content)
storage:AddFile(f, content)
print("GENERATE:", f, #content, content)
end
local function store_table(f, t)
table.sort(t)
local content = "return {" .. table.concat(t, ",") .. "}"
storage:AddFile(f, content)
print("GENERATE:", f, #content, content)
end
table.insert(fileList, storage.basePath .. "/" .. "lfs-files.lua")
table.insert(fileList, storage.basePath .. "/" .. "lfs-services.lua")
table.insert(fileList, storage.basePath .. "/" .. "lfs-events.lua")
local file_list = {}
local event_list = {}
local service_list = {}
for _, v in ipairs(fileList) do
local base = path.basename(v)
local name = base:gsub(".lua", "")
table.insert(file_list, string.format([["%s"]], name))
if name:find("srv%-") then
table.insert(service_list, string.format([["%s"]], name))
end
if name:find("event%-") then
table.insert(event_list, string.format([["%s"]], name))
end
end
store_table("lfs-services.lua", service_list)
store_table("lfs-events.lua", event_list)
store_table("lfs-files.lua", file_list)
end
local function FilterFiles(source, fileList, generateList)
for k, v in pairs(source) do
local t = type(k)
if t == "number" then
fileList[#fileList + 1] = v
elseif t == "string" then
generateList[k] = v
else
error("Unknown file entry type: " .. t)
end
end
end
local function PreprocessGeneratedFile(self, conf, vars)
for i, v in ipairs(conf) do
local arg = path.normpath(v:formatEx(vars))
-- print("GEN:", i, conf[i], "->", arg)
conf[i] = arg
end
end
-- local function PreprocessConditionalFile(self, fileList, name, item, vars)
-- if self.config.hw[name] then
-- for i, v in ipairs(item) do
-- local arg = path.normpath(v:formatEx(vars))
-- -- print("COND:", i, item[i], "->", arg)
-- table.insert(fileList, arg)
-- end
-- end
-- end
local function PreprocessFileList(self, fileList, vars)
local keys = table.keys(fileList)
table.sort(keys, function(a,b) return tostring(a) < tostring(b) end)
for _, key in ipairs(keys) do
local k = key
local v = fileList[k]
local t = type(k)
-- print(t, k, v)
if t == "number" then
-- print(k, fileList[k])
fileList[k] = path.normpath(v:formatEx(vars))
elseif t == "string" then
print(k, v.mode)
if v.mode == "generated" then
PreprocessGeneratedFile(self, v, vars)
else
error("Unknown file entry mode: " .. v.mode)
end
else
error("Unknown file entry type: " .. t)
end
end
end
function ProjectMt:AddModuleFiles()
for _,v in ipairs(self.modules) do
-- print("PROCESSING MODULE: ", v)
local fw_module = self.firmware.modules[v]
if not fw_module then
error("There is no module: " .. v)
end
self.lfs = table.merge(self.lfs, fw_module.lfs or {})
self.files = table.merge(self.files, fw_module.files or {})
end
end
function ProjectMt:Preprocess()
self.modules = table.merge(self.config.project.modules or {}, table.keys(self.config.project.config.hw))
print("MODULES: ", table.concat(self.modules, ","))
self.lfs = table.merge(self.config.firmware.lfs, self.config.project.lfs)
self.files = table.merge(self.config.firmware.files, self.config.project.files)
self.config = table.merge(self.chip.config, self.config.project.config)
self.config["hostname"] = self.chip.name
local vars = {
FW = configuration.fairy_node_base .. "/src/",
PROJECT = self.projectDir .. "/files/",
COMMON = "common/"
}
self:AddModuleFiles()
-- print("LFS:")
PreprocessFileList(self, self.lfs, vars)
-- print("FILES:")
PreprocessFileList(self, self.files, vars)
end
function ProjectMt:CalcTimestamps()
function process(lst)
local content = { }
local max = 0
for _, v in ipairs(lst) do
if type(v) == "string" then
local attr = lfs.attributes(v)
if not attr then
error("Cannot get attributes of file " .. v)
end
if attr.modification > max then
max = attr.modification
end
table.insert(content, file.read(v))
end
end
local all_code = table.concat(content, "")
return { timestamp = max, hash = md5.sumhexa(all_code) }
end
return {
lfs = process(self.lfs),
root = process(self.files),
config = json.decode(self:GenerateConfigFiles()[CONFIG_HASH_NAME]),
}
end
function ProjectMt:GetConfigFileContent(name)
local v = self.config[name]
if not v then
print("There is no config " .. name)
return nil
end
if type(v) == "string" then
return v
else
return JSON.encode(v)
end
end
function ProjectMt:GenerateConfigFiles()
local r = { }
local all_content = { }
for k, _ in pairs(self.config) do
local name = k .. ".cfg"
local content = self:GetConfigFileContent(k)
-- print("GENERATE:", name, #content)
r[name] = content
table.insert(all_content, name .. "|" .. content)
end
table.sort(all_content)
r[CONFIG_HASH_NAME] = JSON.encode({
hash = md5.sumhexa(table.concat(all_content, "")),
timestamp = os.time(),
})
return r
end
function ProjectMt:GenerateDynamicFiles(source, outStorage, list)
for k, v in pairs(source) do
local lines, code = shell.LinesOf("lua", nil, v)
if not code then
error("Command execution failed!")
end
local content = table.concat(lines, "\n")
print("GENERATE", k, #content)
table.insert(list, outStorage:AddFile(k, content))
end
local ts = self:CalcTimestamps()
local pretty_ts = pretty.write(ts.lfs)
local timestamp_file = string.format([[return %s ]], pretty_ts )
print("LFS-TIMESTAMP: \n---------------\n" .. timestamp_file .. "\n---------------")
table.insert(list, outStorage:AddFile("lfs-timestamp.lua", timestamp_file))
end
local function AssertFileUniqness(fileList)
local arr = {}
local succ = true
for _, v in ipairs(fileList) do
if arr[v] then
succ = false
print("FILE IS NOT UNIQUE: " .. v)
end
arr[v] = true
end
return succ
end
function ProjectMt:BuildLFS(outStorage, fw_commit_hash)
local luac = self.luac:GetLuacForHash(fw_commit_hash)
if not luac then
error("LFS compiler is not available")
end
local generated_storage = require("lib/file_storage").new()
local fileList = {}
local generateList = {}
FilterFiles(self.lfs, fileList, generateList)
self:GenerateDynamicFiles(generateList, generated_storage, fileList)
GenerateFileLists(generated_storage, fileList)
if not AssertFileUniqness(fileList) then
error("Canot generate lfs if not all files are unique!")
end
print("Files in lfs: ", #fileList, "\n" .. table.concat(table.sorted(fileList), "\n"))
local args = {
"f",
o = outStorage:AddFile("lfs.pending.img")
}
if not self.chip.config.debug then
table.insert(args, "s")
end
if not self.chip.config.integer then
table.insert(args, "f")
end
if self.chip.lfs and self.chip.lfs.size then
args.m = tostring(self.chip.lfs.size)
end
--
shell.Start(luac, args, nil, unpack(fileList))
generated_storage:Clear()
end
function ProjectMt:BuildRootImage()
local fileList = {}
for _,v in ipairs(self.files) do
fileList[path.basename(v)] = file.read(v)
end
local ts = self:CalcTimestamps()
print(JSON.encode(ts.root))
fileList["root-timestamp.lua"] = "return " .. pretty.write(ts.root)
local files = table.keys(fileList)
print("Files in root: ", #files, "\n" .. table.concat(files, "\n"))
return file_image.Pack(fileList)
end
function ProjectMt:BuildConfigImage()
local fileList = self:GenerateConfigFiles()
local files = table.keys(fileList)
print("Files in config: ", #files, "\n" .. table.concat(files, "\n"))
return file_image.Pack(fileList)
end
-----------------------------------------------
local ProjectModule = {}
ProjectModule.__index = ProjectModule
ProjectModule.__deps = {
devconfig = "project-config",
fwconfig = "fw-config",
luac = "luac-builder",
}
function ProjectModule:LogTag()
return "ProjectModule"
end
function ProjectModule:BeforeReload()
end
function ProjectModule:AfterReload()
end
function ProjectModule:Init()
end
function ProjectModule:ProjectExists(chipid)
return self.devconfig.chipid[chipid] ~= nil
end
function ProjectModule:ListDeviceIds()
return table.keys(self.devconfig.chipid)
end
function ProjectModule:LoadProject(chipid)
local chip_config = self.devconfig.chipid[chipid]
if not chip_config then
error("ERROR: Unknown chip " .. chipid)
end
local mt = {
__index = function(t, name)
return rawget(t, name) or self.devconfig.chipid[chipid][name] or ProjectMt[name]
end
}
local proj = {
chip = chip_config,
}
proj.projectDir = self.devconfig.projectDir .. "/" .. chip_config.project
proj.firmware = self.fwconfig -- TODO
proj.config = {
firmware = self.fwconfig,
project = dofile(proj.projectDir .. "/" .. FirmwareConfigFile),
}
proj.luac = self.luac
setmetatable(proj, mt)
proj:Preprocess()
return proj
end
return ProjectModule
|
require 'init'
require 'lib'
-- 添加指定时间内限流, 防止高峰情况, 日期, 星期, 时间段
-- 指定url进行限流, 防止服务器高并发无法处理
-- 自动防火墙封禁IP
local function waf_main()
ngx.update_time()
if WHITE_IP_CHECK() then
elseif WHITE_URL_CHECK() then
elseif FORBIDDEN_IP_CHECK() then
elseif LIMIT_IP_CHECK() then
elseif LIMIT_URI_CHECK() then
elseif CHECK_STREAM_LIMIT() then
elseif POST_ATTACK_CHECK() then
elseif URL_ARGS_ATTACK_CHECK() then
end
end
waf_main()
|
-- if a mod adds technology in data-final-fixes, then we need to add optional dependency on those mods :/
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
local roughNumberOfTechs = 100*math.floor(0.5 + tablelength(data.raw["technology"])/100)
local costModifier = 1 / math.sqrt(math.sqrt(roughNumberOfTechs))
for techname, tech in pairs(data.raw["technology"]) do
if techname ~= "automation" then
tech.unit.count = 25*math.max(math.floor((tech.unit.count * math.max(tech.unit.time * costModifier, 1) * 2)/25), 1)
tech.unit.time = 10
end
end
|
AddCSLuaFile()
local W = "WHITE"
local name = "Whelen PAR-46 Spotlight"
local COMPONENT = {}
COMPONENT.Model = "models/schmal/whelen_spotlight.mdl"
COMPONENT.Skin = 0
COMPONENT.Bodygroups = {}
COMPONENT.NotLegacy = true
COMPONENT.ColorInput = 1
COMPONENT.UsePhases = true
COMPONENT.Category = "Exterior"
COMPONENT.DefaultColors = {
[1] = W
}
COMPONENT.Meta = {
auto_whelen_spotlight = {
AngleOffset = 0,
W = 12,
H = 12,
WMult = .9,
Sprite = "sprites/emv/whelen_spotlight",
Scale = 2,
NoLegacy = true,
DirAxis = "Up",
DirOffset = 90
}
}
COMPONENT.Positions = {
[1] = { Vector( 8.62, -2.38, 4.19 ), Angle( 20, -128, 5 ), "auto_whelen_spotlight" },
}
COMPONENT.Sections = {
["auto_whelen_spotlight"] = {
[1] = { { 1, "_1" } }
},
}
COMPONENT.Patterns = {
["auto_whelen_spotlight"] = {
["c1"] = { 1 }
}
}
COMPONENT.Modes = {
Primary = {
M1 = { ["auto_whelen_spotlight"] = "c1" },
M2 = {},
M3 = {}
},
Auxiliary = {},
Illumination = {
T = {
{ 1, W }
}
}
}
EMVU:AddAutoComponent( COMPONENT, name ) |
Party = {}
Party.__index = Party
function Party:Create()
local this =
{
mMembers = {}
}
setmetatable(this, self)
return this
end
function Party:Add(member)
self.mMembers[member.mId] = member
end
function Party:RemoveById(id)
self.mMembers[id] = nil
end
function Party:Remove(member)
self:RemoveById(member.mId)
end
function Party:ToArray()
local array = {}
for k, v in pairs(self.mMembers) do
table.insert(array, v)
end
return array
end
-- Count the number of this item equipped
function Party:EquipCount(itemId)
local count = 0
for _,v in pairs(self.mMembers) do
count = count + v:EquipCount(itemId)
end
return count
end
function Party:Rest()
for _, v in pairs(self.mMembers) do
local stats = v.mStats
if stats:Get("hp_now") > 0 then
stats:Set("hp_now", stats:Get("hp_max"))
stats:Set("mp_now", stats:Get("mp_max"))
end
end
end
function Party:DebugPrintParty()
for _, v in pairs(self.mMembers) do
local stats = v.mStats
local name = v.mName
local hpNow = stats:Get("hp_now")
local hpMax = stats:Get("hp_max")
print(string.format("%s\t\t%d/%d", name, hpNow, hpMax))
end
end
function Party:DebugHurtParty()
for _, v in pairs(self.mMembers) do
local stats = v.mStats
stats:Set("hp_now", 10)
print("ow")
end
end |
-- Init Menu
Menu.Spacing()
Menu.Separator()
Menu.Spacing()
Menu.Checkbox("Enable Teamdamage ESP", "cEnableTDamageESP", true)
Menu.Checkbox("Enemy Only", "cTDamageEnemy", true)
Menu.Checkbox("Enable Draw Distance", "cEnableTDamageDDistance", true)
Menu.SliderInt("Draw Distance", "cTDamageDraw", 500, 2000, "", 1250)
Menu.SliderInt("Position", "cTDamagePos", 0, 100, "", 0)
Menu.Combo( "Alignment", "cTDamageAlign", { "Top Left", "Top Right", "Bottom Left", "Bottom Right" }, 3)
Menu.ColorPicker("Text Clr", "cTDamageTextClr", 255, 255, 255, 255)
Menu.Separator()
--Global Vars
local nextAutosave = 0
local first = true
--Cool Shit
local kills = {}
local damage = {}
--Setup lua
function Setup()
Menu.SetBool("cEnableTDamageSizing", false)
for i = 1, 64 do
kills[i] = 0
damage[i] = 0
end
end
--well, the name said it
function UIDToPlayer(uid)
for i = 1, 64 do
local pCurrent = IEntityList.GetPlayer(i)
if (not pCurrent or pCurrent:GetClassId() ~= 40) then goto skip end
local Info = CPlayerInfo.new()
if (not pCurrent:GetPlayerInfo(Info)) then goto skip end
if Info.userId == uid then
return i
end
::skip::
end
end
Hack.RegisterCallback("PaintTraverse", function ()
if not Menu.GetBool("cEnableTDamageESP") then return end
--if Menu.GetBool("cDisableTDamageESPCheck") and not Menu.GetBool("&Vars.esp_enabled") then return end
if first then
Setup()
first = false
end
local pLocal = IEntityList.GetPlayer(IEngine.GetLocalPlayer())
for i = 1, 64 do
if IEngine.GetLocalPlayer() == i then goto skip end
local pCurrent = IEntityList.GetPlayer(i)
if (not pCurrent or pCurrent:GetClassId() ~= 40 or pCurrent:IsDormant() or not pCurrent:IsAlive() or not pCurrent:IsTeammate()) then goto skip end
local box = pCurrent:GetBox()
local cPos = pCurrent:GetAbsOrigin()
local lPos = pCurrent:GetAbsOrigin()
local dist = Math.VectorDistance(lPos, cPos)
--This string below might be usefull for an alternate rendering when too far away
--Print((box.bottom - box.top) / 15)
local dist = Math.VectorDistance(pLocal:GetAbsOrigin(), pCurrent:GetAbsOrigin())
local sizeZ = 15
if Menu.GetBool("cEnableTDamageSizing") then sizeZ = dist / 50 end
if dist < 1500 then sizeZ = 15 end
Print(sizeZ)
local textPos = 0
local onePercent = (box.bottom - box.top) / 100
if Menu.GetInt("cTDamageAlign") == 0 or Menu.GetInt("cTDamageAlign") == 1 then textPos = (box.top + 20) + (Menu.GetInt("cTDamagePos") * onePercent) else textPos = box.bottom - (Menu.GetInt("cTDamagePos") * onePercent) end
local clr = Menu.GetColor("cTDamageTextClr")
if dist <= Menu.GetInt("cTDamageDraw") and Menu.GetBool("cEnableTDamageDDistance") then
local kSize = Render.CalcTextSize_1("Kills: " .. kills[i], sizeZ)
local x = box.right + 5
if Menu.GetInt("cTDamageAlign") == 0 or Menu.GetInt("cTDamageAlign") == 2 then x = box.left - kSize.x - 5 end
Render.Text_1("Kills: " .. kills[i], x, textPos - 25, sizeZ, clr, false, false)
local dSize = Render.CalcTextSize_1("Damage: " .. damage[i], sizeZ)
if Menu.GetInt("cTDamageAlign") == 0 or Menu.GetInt("cTDamageAlign") == 2 then x = box.left - dSize.x - 5 end
Render.Text_1("Damage: " .. damage[i], x, textPos - 10, sizeZ, clr, false, false)
elseif not Menu.GetBool("cEnableTDamageDDistance") then
local kSize = Render.CalcTextSize_1("Kills: " .. kills[i], sizeZ)
local x = box.right + 5
if Menu.GetInt("cTDamageAlign") == 0 or Menu.GetInt("cTDamageAlign") == 2 then x = box.left - kSize.x - 5 end
Render.Text_1("Kills: " .. kills[i], x, textPos - 25, sizeZ, clr, false, false)
local dSize = Render.CalcTextSize_1("Damage: " .. damage[i], sizeZ)
if Menu.GetInt("cTDamageAlign") == 0 or Menu.GetInt("cTDamageAlign") == 2 then x = box.left - dSize.x - 5 end
Render.Text_1("Damage: " .. damage[i], x, textPos - 10, sizeZ, clr, false, false)
end
::skip::
end
end)
Hack.RegisterCallback("FireEventClientSideThink", function(Event)
if Event:GetName() == "player_hurt" then
local attackerID = UIDToPlayer(Event:GetInt("attacker"))
local hurt = IEntityList.GetPlayer(UIDToPlayer(Event:GetInt("userid")))
local attacker = IEntityList.GetPlayer(UIDToPlayer(Event:GetInt("attacker")))
local dmg = Event:GetInt("dmg_health")
if not hurt then return end
if not attacker then return end
if hurt ~= attacker then
if attacker:IsTeammate() or IEngine.GetLocalPlayer() == attackerID then
if hurt:IsTeammate() or IEngine.GetLocalPlayer() == UIDToPlayer(Event:GetInt("userid")) then
damage[attackerID] = damage[attackerID] + dmg
end
end
end
end
if Event:GetName() == "player_death" then
local attackerID = UIDToPlayer(Event:GetInt("attacker"))
local hurt = IEntityList.GetPlayer(UIDToPlayer(Event:GetInt("userid")))
local attacker = IEntityList.GetPlayer(UIDToPlayer(Event:GetInt("attacker")))
if not hurt then return end
if not attacker then return end
if hurt ~= attacker then
if attacker:IsTeammate() or IEngine.GetLocalPlayer() == attackerID then
if hurt:IsTeammate() or IEngine.GetLocalPlayer() == UIDToPlayer(Event:GetInt("userid")) then
kills[attackerID] = kills[attackerID] + 1
end
end
end
end
end)
|
#!/usr/bin/env luajit
require "strict"
local argparse = require "argparse"
local geant4 = require "geant4"
local view = require "view"
-- Parse settings from the command line
local parser = argparse()
:name "scan-geant4"
:description "Perform a Geant4 scan"
parser:argument("site", "Site name.")
parser:argument("period", "Downsampling period.")
:default(1)
:convert(tonumber)
parser:option("-e --events", "Number of Monte Carlo events.")
:default(1)
:convert(tonumber)
parser:option("--particle", "Primary particle.")
:default("Geantino")
parser:option("--energy", "Kinetic energy (GeV).")
:default(1E+04)
:convert(tonumber)
parser:flag("-t --tessellate", "Use native tessellation.")
parser:flag("--stl", "Tessellate and dump an STL file.")
parser:flag("--secondaries", "Track secondaries.")
parser:option("-c --cut", "Production cut (m).")
:default(1.)
:convert(tonumber)
local args = parser:parse()
-- Instanciate the geant4 engine
local topography = function()
-- The topography data and their downsampling period
local map_name = { CDC = "pdd.png", ULS = "tianshan.png" }
return {area = map_name[args.site], period = args.period}
end
local mode
if args.stl then
mode = 2
elseif args.tessellate then
mode = 1
else
mode = 0
end
geant4.initialise{
area = ({ CDC = "pdd", ULS = "tianshan" })[args.site],
period = args.period,
mode = mode,
secondaries = args.secondaries,
cut = args.cut
}
-- Run the scan
local site = view.View(args.site)
geant4.configure{events = args.events, verbosity = 0}
local cpu, steps, depth = 0., 0, 0.
for los in site:lines_of_sight()
do
local n, d, t = geant4.run(site, args.particle, args.energy, los.azimuth,
los.elevation)
cpu, steps, depth = cpu + t, steps + n, depth + d
print(string.format("%4d %4d %.5E %.5E %d", los.i, los.j, d, t, n))
io.flush()
end
-- Print summary statistics
print(string.format("# mean depth : %.5E m", depth / site.LOS))
print(string.format("# total steps : %d", steps))
print(string.format("# steps per LOS : %.3f", steps / site.LOS))
print(string.format("# total cpu : %.5E s", cpu))
print(string.format("# cpu per LOS : %.3f ms", cpu / site.LOS * 1E+03))
print(string.format("# cpu per step : %.3f mus", cpu / steps * 1E+06))
|
local Observable = require 'reactivex.observable'
local Subscription = require 'reactivex.subscription'
local Observer = require 'reactivex.observer'
--- Given an Observable that produces Observables, returns an Observable that produces the values
-- produced by the most recently produced Observable.
-- @returns {Observable}
function Observable:switch()
return self:lift(function (destination)
local innerSubscription
local sink
local function onNext(...)
return destination:onNext(...)
end
local function onError(message)
return destination:onError(message)
end
local function onCompleted()
return destination:onCompleted()
end
local function switch(source)
if innerSubscription then
innerSubscription:unsubscribe()
sink:remove(innerSubscription)
end
innerSubscription = source:subscribe(onNext, onError, nil)
sink:add(innerSubscription)
end
sink = Observer.create(switch, onError, onCompleted)
return sink
end)
end
|
--[[
╔══════════════════════════════════════════════╗
║ Settings for nvim-treesitter/nvim-treesitter ║
╚══════════════════════════════════════════════╝
--]]
require("nvim-treesitter.configs").setup {
ensure_installed = 'maintained', -- one of 'all', 'maintained' (parsers with maintainers), or a list of languages
highlight = {
enable = true
},
indent = {
enable = false
}
}
|
local Thief = Class(function(self, inst)
self.inst = inst
self.stolenitems = {}
self.onstolen--[[inst, victim, item]] = nil
end)
function Thief:SetOnStolenFn(fn)
self.onstolen = fn
end
function Thief:StealItem(victim, itemtosteal, attack)
if victim.components.inventory and not victim.components.inventory.nosteal then
local item = itemtosteal or victim.components.inventory:FindItem(function(item) return not item:HasTag("nosteal") end)
if attack then
self.inst.components.combat:DoAttack(victim)
end
if item then
local direction = Vector3(self.inst.Transform:GetWorldPosition()) - Vector3(victim.Transform:GetWorldPosition() )
victim.components.inventory:DropItem(item, false, direction:GetNormalized())
table.insert(self.stolenitems, item)
if self.onstolen then
self.onstolen(self.inst, victim, item)
end
end
elseif victim.components.container then
local item = itemtosteal or victim.components.container:FindItem(function(item) return not item:HasTag("nosteal") end)
if attack then
if victim.components.equippable and victim.components.inventoryitem and victim.components.inventoryitem.owner then
self.inst.components.combat:DoAttack(victim.components.inventoryitem.owner)
end
end
victim.components.container:DropItem(item)
table.insert(self.stolenitems, item)
if self.onstolen then
self.onstolen(self.inst, victim, item)
end
end
end
return Thief |
init = function(args)
depth = tonumber(args[1]) or 1
local reqs = {}
for i=1, depth do
reqs[i] = wrk.format(nil, "/databases/StackOverflow/docs?&id=questions/".. math.random(12350817) .."")
end
req = table.concat(reqs)
end
request = function()
return req
end |
function updateGameState()
--ToDo
IS_GAME_RUNNING = true
end
function updateChars(segment)
if not IS_GAME_RUNNING then return end
checkFlagsInSegmentUsingTable(segment, CHARS, 2)
end
function updateSeaHearTail(segment)
if not IS_GAME_RUNNING then return end
checkFlagsInSegmentUsingTable(segment, SEA_HARE_TAIL)
end
function updateGoldKey(segment)
if not IS_GAME_RUNNING then return end
checkFlagsInSegmentUsingTable(segment, GOLD_KEY)
end
function updateMidgeMallet(segment)
if not IS_GAME_RUNNING then return end
checkFlagsInSegmentUsingTable(segment, MIDGE_MALLET)
end
function updateMoogleBelt(segment)
if not IS_GAME_RUNNING then return end
checkFlagsInSegmentUsingTable(segment, MOOGLE_BELT)
end
function updateSeeds(segment)
if not IS_GAME_RUNNING then return end
checkFlagsInSegmentUsingTable(segment, SEEDS)
end
function updateMagic(segment)
if not IS_GAME_RUNNING then return end
checkFlagsInSegmentUsingTable(segment, MAGIC)
end
function updateWeaponOrbs(segment)
if not IS_GAME_RUNNING then return end
checkFlagsInSegmentUsingTable(segment, WEAPONS_ORBS, 1)
end
function updateWeapons(segment)
if not IS_GAME_RUNNING then return end
checkFlagsInSegmentUsingTable(segment, WEAPONS)
end
function updateEventFlags(segment)
if not EVENT_FLAG_MAPPING then
return
end
local vals = {}
for k,v in pairs(EVENT_FLAG_MAPPING) do
local addr = EVENT_FLAGS_ADDR + v
local readResult = AutoTracker:ReadU8(addr)
local code = EVENT_MAPPING[k][1]
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("Updating location %s with val %x from addr %x",code,readResult,addr))
end
if EVENT_MAPPING[k][2] then
local obj = Tracker:FindObjectForCode(code)
if obj then
if readResult > 0 then
obj.AvailableChestCount = 0
else
obj.AvailableChestCount = obj.ChestCount
end
end
else
if readResult > 0 then
if vals[code] then
vals[code] = vals[code] + 1
else
vals[code] = 1
end
end
end
end
for code,count in pairs(vals) do
local obj = Tracker:FindObjectForCode(code)
if obj then
obj.AvailableChestCount = obj.ChestCount - count
end
end
end
function getEventPointer(eventNr)
local addr = EVENT_POINTER_TABLE_ADDR + eventNr * 3
local readResult = AutoTracker:ReadU24(addr) - 0xc00000
--if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
--print(string.format("Got Pointer for Event %x from addr %x: %x",eventNr,addr,readResult))
--end
return readResult
end
function updateEvent(eventNr)
local prt = getEventPointer(eventNr)
local addr = prt
local startOfEvent = addr
local endOfEvent = addr
local isNothingEvent = false
local readResult = AutoTracker:ReadU8(addr)
local flag = nil
--if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
--print(string.format("============ updateEvent parsing event =============="))
--print(string.format("initial read at %x: %x",addr,readResult))
--end
while readResult ~= 0x00 do
--if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
-- print(string.format("read %x at %x for event %x",readResult,addr,eventNr))
--end
if readResult == 0x29 or readResult == 0x2A or readResult == 0x30 then
local readResult2 = AutoTracker:ReadU8(addr+1)
--if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
--print(string.format("found flag manipulation at %x on flag %x",addr,readResult2))
--end
for i = 1,#EVENT_FLAGS+1 do
if readResult2 == EVENT_FLAGS[i] then
--if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
--print(string.format("actually relevant PogChamp!"))
--end
flag = readResult2
end
end
--elseif readResult == 0x50 and isNothingEventText(addr+1) then
--isNothingEvent = true
end
if flag then
break
end
if EVENT_CMDS[readResult] then
--if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
--print(string.format("identified %x at %x as command with %x params",readResult,addr,EVENT_CMDS[readResult]))
--end
addr = addr + EVENT_CMDS[readResult]
else
--if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
--print(string.format("%x at %x is an unidentified command or text",readResult,addr))
--end
end
addr = addr + 1
readResult = AutoTracker:ReadU8(addr)
endOfEvent = addr
end
--if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
--print(string.format("====================================================="))
--end
--if AUTOTRACKER_ENABLE_DEBUG_LOGGING and flag then
--print(string.format("found flag %x for eventNr %x",flag,eventNr))
--end
--if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
--print(string.format("====================================================="))
--end
EVENT_FLAG_MAPPING[eventNr] = flag
if not flag then
NOTHING_EVENTS[eventNr] = {startOfEvent,endOfEvent}
end
end
function updateEventPointerTableAddr(segment)
local tableAddr = AutoTracker:ReadU24(EVENT_POINTER_TABLE_ADDR_ADDR) - 0xc00000
if tableAddr > 0 then
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("Event pointer table at %x",tableAddr))
end
EVENT_POINTER_TABLE_ADDR = tableAddr
if not ADDED_EVENT_POINTER_TABLE_MEMORY_WATCH then
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("Adding event pointer table watch now"))
ScriptHost:AddMemoryWatch("EventPointerTable",tableAddr,0x3*0xA00,updateEventPointerTable)
end
ADDED_EVENT_POINTER_TABLE_MEMORY_WATCH = true
end
else
EVENT_POINTER_TABLE_ADDR = nil
ADDED_EVENT_POINTER_TABLE_MEMORY_WATCH = false
end
end
function canPullAllPointers()
if not EVENT_POINTER_TABLE_ADDR then
return false
end
for k,_ in pairs(EVENT_MAPPING) do
local addr = getEventPointer(k)
if addr <= 0 then
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("can not pull all pointers yet"))
end
return false
end
end
return true
end
function updateEventPointerTable()
if not EVENT_POINTER_TABLE_ADDR then
ADDED_EVENT_DATA_MEMORY_WATCHES = false
return
end
if not ADDED_EVENT_DATA_MEMORY_WATCHES then
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("Adding event data watch now"))
end
if not canPullAllPointers() then
return
end
for k,_ in pairs(EVENT_MAPPING) do
local addr = getEventPointer(k)
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("Adding Event Data Watches for eventNr %x at addr %x with size %x",k,addr,EVENT_DATA_WATCH_SIZE))
end
ScriptHost:AddMemoryWatch("EventData"..k,addr,EVENT_DATA_WATCH_SIZE,updateEventData)
end
ADDED_EVENT_DATA_MEMORY_WATCHES = true
end
end
function updateEventData(segment)
updateEvents()
end
function updateEvents()
if not canPullAllPointers() then
return
end
EVENT_FLAG_MAPPING = {}
NOTHING_EVENTS = {}
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("============ updateEvents ==========================="))
end
for k,_ in pairs(EVENT_MAPPING) do
updateEvent(k)
end
for k,v in pairs(EVENT_FLAG_MAPPING) do
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("Event %x has flag %x",k,v))
end
end
for k,v in pairs(NOTHING_EVENTS) do
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("Event %x @ %x to %x has no flag",k,v[1],v[2]))
end
end
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("====================================================="))
end
end
function updateCurrentEventPointer()
if not NOTHING_EVENTS then
return
end
local readResult = AutoTracker:ReadU24(CURRENT_EVENT_POINTER_ADDR) - 0xC00000
if readResult > 0 then
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("Currently running event at %x",readResult))
end
for k,v in pairs(NOTHING_EVENTS) do
if readResult >= v[1] and readResult <= v[2] then
if AUTOTRACKER_ENABLE_DEBUG_LOGGING then
print(string.format("Currently running location event %x",k))
end
local code = EVENT_MAPPING[k][1]
local obj = Tracker:FindObjectForCode(code)
if obj then
if EVENT_MAPPING[k][2] then
obj.AvailableChestCount = 0
elseif not EVENT_MAPPING[k][3] and obj.AvailableChestCount > 0 then
EVENT_MAPPING[k][3] = true
obj.AvailableChestCount = obj.AvailableChestCount - 1
end
end
end
end
end
end |
local sprite = BaseSprite:extend({ type = 'brick' })
local ExplosionQuads = {
love.graphics.newQuad(16, 0, 8, 8, Graphics.tiles:getDimensions()),
love.graphics.newQuad(24, 0, 8, 8, Graphics.tiles:getDimensions()),
love.graphics.newQuad(16, 8, 8, 8, Graphics.tiles:getDimensions()),
love.graphics.newQuad(24, 8, 8, 8, Graphics.tiles:getDimensions()),
}
function sprite:constructor (x, y)
self.destroyed = false
self.visible = true
self.x = x
self.y = y
self.behavior = Behavior {
default = {
{ duration = 1, quad = Quads.tiles[1][15] },
},
}
GlobalState.world:add(self, self.x, self.y, 16, 16)
end
function sprite:hit (col, big)
if col.normal.y == 1 then
if big then
self.exploded = true
GlobalState.world:remove(self)
Sounds.brickSmash:seek(0)
Sounds.brickSmash:play()
Timer.after(0.3, function () self:destroy() end)
else
self.y = self.y-4
Timer.after(0.1, function () self.y = self.y+4 end)
Sounds.bump:seek(0)
Sounds.bump:play()
end
end
end
function sprite:update (dt)
if self.destroyed then return end
self.behavior:update(dt)
if GlobalState.onFrame then
if self.exploded then
self.dist = (self.dist or 0) + 2
self.y = self.y-1
end
end
end
function sprite:draw ()
if self.destroyed then return end
if not self.exploded then
if self.behavior.frame.quad then
love.graphics.draw(Graphics.tiles, self.behavior.frame.quad, self.x, self.y)
end
else
love.graphics.draw(Graphics.tiles, ExplosionQuads[1], self.x-self.dist/3, self.y, math.rad(270+self.dist*4))
love.graphics.draw(Graphics.tiles, ExplosionQuads[2], self.x+8+self.dist/3, self.y, math.rad(self.dist*4))
love.graphics.draw(Graphics.tiles, ExplosionQuads[3], self.x-self.dist/3, self.y+self.dist/3, math.rad(270+self.dist*4))
love.graphics.draw(Graphics.tiles, ExplosionQuads[4], self.x+8+self.dist/3, self.y+self.dist/3, math.rad(self.dist*4))
end
end
return sprite
|
am.addCMD("jail", 'Jails a player', 'Administration', function(caller, target, reason, duration)
am.notify(nil, am.green, caller:Nick(), am.def, ' has jailed ', am.red, target:Nick(), am.def, ' for ', am.red, duration.pretty, am.def, ' because of ', am.red, reason)
// Do the jailing
target.jailed = true
target:Freeze(true)
// Print the jail time left on the target's HUD
local tLeft = duration.seconds
timer.Create("jail_"..target:SteamID(), 1, tLeft, function()
target:PrintMessage(HUD_PRINTCENTER, "You have ".. tLeft .."s left")
tLeft = tLeft - 1
end)
// Undo the jail time
timer.Simple(tLeft, function()
if (IsValid(target) && target.jailed) then
target:Freeze(false)
target.jailed = false
end
end)
end):addParam({
name = 'target',
type = 'player'
}):addParam({
name = 'reason',
type = 'string'
}):addParam({
name = 'time',
type = 'duration'
}):setPerm("jail")
am.addCMD("unjail", 'Unjails a player', 'Administration', function(caller, target)
if (!target.jailed) then return end
am.notify(nil, am.green, caller:Nick(), am.def, ' has unjailed ', am.red, target:Nick())
// Destroy the countdown timer
timer.Destroy("jail_"..target:SteamID())
// Unjail them
target.jailed = false
target:Freeze(false)
end):addParam({
name = 'target',
type = 'player'
}):setPerm("jail")
|
--沼地の魔神王
function c791095990.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(791095990,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCost(c791095990.cost)
e1:SetTarget(c791095990.target)
e1:SetOperation(c791095990.operation)
c:RegisterEffect(e1)
--fusion substitute
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_FUSION_SUBSTITUTE)
e2:SetCondition(c791095990.subcon)
c:RegisterEffect(e2)
end
function c791095990.subcon(e)
return e:GetHandler():IsLocation(LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE)
end
function c791095990.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToGraveAsCost() and c:IsDiscardable() end
Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD)
end
function c791095990.filter(c)
return (c:IsCode(24094653) or c:IsCode(45906428) or c:IsCode(12071500) or c:IsCode(94820406) or c:IsCode(35255456) or c:IsCode(54283059)) and c:IsAbleToHand()
end
function c791095990.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c791095990.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c791095990.operation(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c791095990.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
|
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel(impulse.Config.InventoryStorageModel)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:DrawShadow(false)
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
phys:EnableMotion(false)
end
end
function ENT:OnTakeDamage(dmg)
return false
end
function ENT:CanPlayerUse(ply)
if not self.impulseSaveKeyValue or not self.impulseSaveKeyValue["MasterDoor"] then
return true
end
local door = ents.GetMapCreatedEntity(self.impulseSaveKeyValue["MasterDoor"])
if not door:IsValid() or not door:IsDoor() then
return true
end
if ply.OwnedDoors and ply.OwnedDoors[door] then
return true
else
return false
end
end
function ENT:Use(activator, caller)
if activator:IsPlayer() and activator:Alive() then
if activator:GetSyncVar(SYNC_ARRESTED, false) then
return activator:Notify("You cannot access your storage when detained.")
end
if activator:IsCP() then
return activator:Notify("You cannot access your storage as this team.")
end
if not self:CanPlayerUse(activator) then
return activator:Notify("You do not have access to this storage chest.")
end
net.Start("impulseInvStorageOpen")
net.Send(activator)
hook.Run("PlayerOpenStorage", activator, self)
activator.currentStorage = self
end
end
|
local CollectionUtils = {}
function CollectionUtils.addToTable(table, k1, k2, value)
if table[k1] == nil then
rawset(table, k1, {})
end
rawset(table[k1], k2, value)
end
return CollectionUtils
|
local bc = require "bc"
local _new_ = function(self, instance)
instance = instance or {}
setmetatable(instance, self)
self.__index = self
return instance
end
local StopPlanOutException = {}
function StopPlanOutException:new(inExperiment)
return _new_(self, {inExperiment = inExperiment})
end
local isOperator = function(op)
return type(op) == "table" and op.op ~= nil
end
local map = function(obj, func, context)
local results = {}
if type(obj) == "table" then
for i, val in ipairs(obj) do
table.insert(results, func(val, i, obj))
end
end
return results
end
local round = function(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
local deepcopy
-- Delcaration must be separated from definition because it is recursive
deepcopy = function(orig)
local copy
local status, err = pcall(function()
local orig_type = type(orig)
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[deepcopy(orig_key)] = deepcopy(orig_value)
end
setmetatable(copy, deepcopy(getmetatable(orig)))
else -- number, string, boolean, etc
copy = orig
end
end)
if err ~= nil then print(cjson(err)) end
return copy
end
local shallowcopy = function(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in pairs(orig) do
copy[orig_key] = orig_value
end
else -- number, string, boolean, etc
copy = orig
end
return copy
end
table.slice = function(tbl, first, last, step)
local sliced = {}
for i = first or 1, last or #tbl, step or 1 do
sliced[#sliced+1] = tbl[i]
end
return sliced
end
local instanceOf = function(subject, super)
super = tostring(super)
local mt = getmetatable(subject)
while true do
if mt == nil then return false end
if tostring(mt) == super then return true end
mt = getmetatable(mt)
end
end
local tablelength = function(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
table.indexOf = function( t, object )
if "table" == type( t ) then
for i, v in pairs(t) do
if object == t[i] then
return i
end
end
end
return -1
end
table.merge = function(results, ...)
local arg={...}
for i,v in ipairs(arg) do
if type(v) == "table" then
for k,vp in pairs(v) do
results[k] = shallowcopy(vp)
end
else
table.insert(results, v)
end
end
return results
end
string.split = function(pString, pPattern)
local Table = {} -- NOTE: use {n = 0} in Lua-5.0
local fpat = "(.-)" .. pPattern
local last_end = 1
local s, e, cap = pString:find(fpat, 1)
while s do
if s ~= 1 or cap ~= "" then
table.insert(Table,cap)
end
last_end = e+1
s, e, cap = pString:find(fpat, last_end)
end
if last_end <= #pString then
cap = pString:sub(last_end)
table.insert(Table, cap)
end
return Table
end
table.filledLength = function(table)
local len = 0
for i, v in ipairs(table) do
if v ~= -1 then len = len + 1 end
end
return len
end
table.length = function(table)
if #table == 0 then
local i = 0
for k,v in pairs(table) do i = i + 1 end
return i
end
return #table
end
local hex2bc = function(s)
local x=bc.number(0)
for i=1,#s do
x=16*x+tonumber(s:sub(i,i),16)
end
return x
end
local range = function(max, start)
local l = {}
for i = start or 1, max do
table.insert(l, i)
end
return l
end
return {
range = range,
hex2bc = hex2bc,
tablelength = tablelength,
instanceOf = instanceOf,
shallowcopy = shallowcopy,
deepcopy = deepcopy,
round = round,
map = map,
isOperator = isOperator,
StopPlanOutException = StopPlanOutException,
_new_ = _new_
}
|
local mod = DBM:NewMod(2114, "DBM-Party-BfA", 7, 1001)
local L = mod:GetLocalizedStrings()
mod:SetRevision("20190618235231")
mod:SetCreatureID(129227)
mod:SetEncounterID(2106)
mod:DisableESCombatDetection()--ES fires for nearby trash even if boss isn't pulled
mod:SetZone()
mod:SetMinSyncRevision(17732)
mod:RegisterCombat("combat")
mod:RegisterEventsInCombat(
"SPELL_AURA_APPLIED 257582",
"SPELL_CAST_START 257593 258622 275907 258627",
"SPELL_CAST_SUCCESS 271698"
)
local warnRagingGaze = mod:NewTargetAnnounce(257582, 2)
local warnPulse = mod:NewCastAnnounce(258622, 3)
local specWarnCallEarthRager = mod:NewSpecialWarningCount(257593, nil, nil, nil, 1, 2)
local specWarnRagingGaze = mod:NewSpecialWarningRun(257582, nil, nil, nil, 4, 2)
local yellRagingGaze = mod:NewYell(257582)
local specWarnInfusion = mod:NewSpecialWarningSwitch(271698, "-Tank", nil, nil, 1, 2)
--local specWarnResonantPulse = mod:NewSpecialWarningDodge(258622, nil, nil, nil, 2, 2)
local specWarnTectonicSmash = mod:NewSpecialWarningDodge(275907, "Tank", nil, 2, 1, 2)
local specWarnQuake = mod:NewSpecialWarningDodge(258627, nil, nil, nil, 2, 2)
--local specWarnGTFO = mod:NewSpecialWarningGTFO(238028, nil, nil, nil, 1, 8)
local timerCallEarthragerCD = mod:NewNextCountTimer(60.4, 257593, nil, nil, nil, 1)
--local timerInfusionCD = mod:NewAITimer(13, 271698, nil, nil, nil, 3, nil, DBM_CORE_DAMAGE_ICON)--Health based?
local timerResonantPulseCD = mod:NewCDTimer(32.2, 258622, nil, nil, nil, 2)
local timerTectonicSmashCD = mod:NewCDTimer(23.0, 275907, nil, nil, nil, 3)--23-28
mod:AddInfoFrameOption(257481, true)
mod.vb.addCount = 0
local updateInfoFrame
do
local ccList = {
[1] = DBM:GetSpellInfo(257481),--Trap included with fight
[2] = DBM:GetSpellInfo(6770),--Rogue Sap
[3] = DBM:GetSpellInfo(9484),--Priest Shackle
[4] = DBM:GetSpellInfo(20066),--Paladin Repentance
[5] = DBM:GetSpellInfo(118),--Mage Polymorph
[6] = DBM:GetSpellInfo(51514),--Shaman Hex
[7] = DBM:GetSpellInfo(3355),--Hunter Freezing Trap
}
local lines = {}
local floor = math.floor
updateInfoFrame = function()
table.wipe(lines)
for i = 1, 5 do
local uId = "boss"..i
if UnitExists(uId) then
for s = 1, #ccList do
local spellName = ccList[s]
local _, _, _, _, _, expires = DBM:UnitDebuff(uId, spellName)
if expires then
local debuffTime = expires - GetTime()
lines[UnitName(uId)] = floor(debuffTime)
break
end
end
end
end
return lines
end
end
function mod:OnCombatStart(delay)
self.vb.addCount = 0
timerCallEarthragerCD:Start(60-delay, 1)
--timerInfusionCD:Start(1-delay)--19.6
timerResonantPulseCD:Start(10.6-delay)
if not self:IsNormal() then
timerTectonicSmashCD:Start(5-delay)
end
if self.Options.InfoFrame then
DBM.InfoFrame:SetHeader(DBM:GetSpellInfo(227909))
DBM.InfoFrame:Show(5, "function", updateInfoFrame, false, true)
end
end
function mod:OnCombatEnd()
-- if self.Options.RangeFrame then
-- DBM.RangeCheck:Hide()
-- end
if self.Options.InfoFrame then
DBM.InfoFrame:Hide()
end
end
function mod:SPELL_AURA_APPLIED(args)
local spellId = args.spellId
if spellId == 257582 then
warnRagingGaze:CombinedShow(0.5, args.destName)--In case two adds are up
if args:IsPlayer() and self:AntiSpam(3.5, 2) then
specWarnRagingGaze:Show()
specWarnRagingGaze:Play("justrun")
specWarnRagingGaze:ScheduleVoice(1.5, "keepmove")
yellRagingGaze:Yell()
end
end
end
--mod.SPELL_AURA_APPLIED_DOSE = mod.SPELL_AURA_APPLIED
function mod:SPELL_CAST_START(args)
local spellId = args.spellId
if spellId == 257593 then
self.vb.addCount = self.vb.addCount + 1
specWarnCallEarthRager:Show(self.vb.addCount)
specWarnCallEarthRager:Play("bigmob")
timerCallEarthragerCD:Start(60, self.vb.addCount+1)--add self.vb.addCount+1
elseif spellId == 258622 then
warnPulse:Show()
timerResonantPulseCD:Start()
elseif spellId == 275907 then
specWarnTectonicSmash:Show()
specWarnTectonicSmash:Play("shockwave")
timerTectonicSmashCD:Start()
elseif spellId == 258627 and self:AntiSpam(3.5, 1) then
specWarnQuake:Show()
specWarnQuake:Play("watchstep")
end
end
function mod:SPELL_CAST_SUCCESS(args)
local spellId = args.spellId
if spellId == 271698 then
specWarnInfusion:Show()
specWarnInfusion:Play("killmob")
--timerInfusionCD:Start()--15.8, 36.4, 64.0
end
end
--[[
function mod:SPELL_PERIODIC_DAMAGE(_, _, _, _, destGUID, _, _, _, spellId)
if spellId == 228007 and destGUID == UnitGUID("player") and self:AntiSpam(2, 4) then
specWarnGTFO:Show()
specWarnGTFO:Play("watchfeet")
end
end
mod.SPELL_PERIODIC_MISSED = mod.SPELL_PERIODIC_DAMAGE
function mod:UNIT_DIED(args)
local cid = self:GetCIDFromGUID(args.destGUID)
if cid == 124396 then
end
end
function mod:UNIT_SPELLCAST_SUCCEEDED(uId, _, spellId)
if spellId == 257939 then
end
end
--]]
|
local M = {}
function M.getCompletionItems(prefix, score_func)
local items = vim.api.nvim_call_function('vim_dadbod_completion#omni',{0, prefix})
for _, item in pairs(items) do
item.user_data = vim.fn.json_encode({ hover = item.info })
item.dup = 0
end
return items
end
M.complete_item = {
item = M.getCompletionItems
}
local nvim_cmp_source = {}
---Source constructor.
nvim_cmp_source.new = function()
local self = setmetatable({}, { __index = nvim_cmp_source })
return self
end
nvim_cmp_source.get_debug_name = function()
return 'vim-dadbod-completion'
end
function nvim_cmp_source:is_available()
return true
end
function nvim_cmp_source:get_trigger_characters(_)
return { '"', '`', '[', ']', '.' }
end
function nvim_cmp_source:complete(params, callback)
local input = string.sub(params.context.cursor_before_line, params.offset)
local results = vim.fn['vim_dadbod_completion#omni'](0, input)
local items = {}
for _, item in ipairs(results) do
table.insert(items, {
label = item.abbr,
dup = 0,
insertText = item.word,
labelDetails = {
description = item.menu,
},
documentation = item.info,
})
end
callback({
items = items,
isIncomplete = true
})
end
M.nvim_cmp_source = nvim_cmp_source.new()
return M
|
object_tangible_loot_mustafar_cube_loot_cube_loot_3o = object_tangible_loot_mustafar_cube_loot_shared_cube_loot_3o:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_mustafar_cube_loot_cube_loot_3o, "object/tangible/loot/mustafar/cube/loot/cube_loot_3o.iff")
|
RegisterServerEvent("drift:toggledrift")
AddEventHandler("drift:toggledrift", function()
TriggerClientEvent("drift:toggledrift", source)
end)
|
local error = error
local string = string
local oo = {}
function oo.NotImplemented(class, name, ...)
class[name] = function(self)
error(string.format("Missing function definition for %q in %q", name, self._ClassName))
end
end
function oo.InheritClass(baseClass, newName)
if baseClass == nil then
error("Base class was nil!")
end
local newClass = table.copy(baseClass)
newClass._ClassName = newName
newClass._BaseClass = baseClass
newClass.New = function()
local obj = setmetatable({}, { __index = newClass })
return obj
end
return newClass
end
function oo.CreateClass(name)
local class = {}
class._ClassName = name
class.New = function()
local obj = setmetatable({}, { __index = class })
return obj
end
return class
end
return oo
|
-- COPYRIGHT: KISELEV NIKOLAY
-- Licence: MIT
-- BUTTONPONY
-- Version: 1.0
fur = {w = 1500, h = 750}
if musicplay == nil then musicplay = true end
anima = 0
frame = 1
colors = {
{226, 145, 145},
{153, 221, 146},
{147, 216, 185},
{148, 196, 211},
{148, 154, 206},
{179, 148, 204},
{204, 150, 177},
{204, 164, 153},
{223, 229, 146},
{255, 165, 96},
{107, 255, 99},
{101, 255, 204},
{101, 196, 255},
{101, 107, 255},
{173, 101, 255},
{255, 101, 244},
{255, 101, 132},
{255, 101, 101}
}
function fixmou(x, y)
local w, h = love.window.getMode()
local nx = (x - (fortouch[1] * s)) / (fur.w * s)
local ny = (y - (fortouch[2] * s)) / (fur.h * s)
if nx >= 0 and nx <= 1 and ny >= 0 and ny <= 1 then
return nx, ny
else
return 2, 2
end
end
function fit()
local w, h = love.window.getMode()
if w / fur.w < h / fur.h then
s = w / fur.w
t = {0, (h / s - fur.h) / 2}
else
s = h / fur.h
t = {(w / s - fur.w) / 2, 0}
end
do --MESH
backimg = love.graphics.newImage("bg.bmp")
backimg:setWrap("repeat")
backimg:setFilter("nearest")
local w, h = love.window.getMode()
local iw, ih = backimg:getDimensions()
iw = (iw / s) * 100
ih = (ih / s) * 100
if w / fur.w < h / fur.h then
side = t[2]
fortouch = {0, side}
meshp = {x1 = 0, y1 = -side, x2 = 0, y2 = fur.h}
vertices = {
{ -- top-left
0, 0,
0, 0,
255, 255, 255},
{ -- top-right
fur.w, 0,
fur.w / iw, 0,
255, 255, 255},
{ -- bottom-right
fur.w, side,
fur.w / iw, side / ih,
255, 255, 255},
{ -- bottom-left
0, side,
0, side / ih,
255, 255, 255}
}
else
side = t[1]
fortouch = {side, 0}
meshp = {x1 = -side, y1 = 0, x2 = fur.w, y2 = 0}
vertices = {
{ -- top-left
0, 0,
0, 0,
255, 255, 255},
{ -- top-right
side, 0,
side / iw, 0,
255, 255, 255},
{ -- bottom-right
side, fur.h,
side / iw, fur.h / ih,
255, 255, 255},
{ -- bottom-left
0, fur.h,
0, fur.h / ih,
255, 255, 255}
}
end
mesh = love.graphics.newMesh(vertices, "fan")
mesh:setTexture(backimg)
end
end
function love.graphics.paradraw(im, x, y, z)
love.graphics.draw(im, x, y, 0, fur.w / 60, fur.h / 30, im:getWidth() / 2, im:getHeight() / 2)
end
love.window.setMode(2, 1, {fullscreen = true})
love.window.setTitle("ButtonPony")
logo = love.graphics.newImage("bg.bmp")
love.window.setIcon(logo:getData())
fit()
love.graphics.setDefaultFilter("nearest")
love.graphics.setBackgroundColor(0, 0, 0)
menc = {{0, 0, 0}, {0, 0, 0}}
if love.filesystem.exists("main.ttf") then
aqua = {
love.graphics.newFont("main.ttf", 170),
love.graphics.newFont("main.ttf", 170 * 0.75),
love.graphics.newFont("main.ttf", 170 * 0.5),
love.graphics.newFont("main.ttf", 170 * 0.4),
love.graphics.newFont("main.ttf", 40)
}
end
pn = {}
pn[1] = love.graphics.newImage("img/pn1.bmp")
pn[2] = love.graphics.newImage("img/pn2.bmp")
pn.y = 600
back = love.graphics.newImage("img/sky.bmp")
door = love.graphics.newImage("img/door.bmp")
function love.wheelmoved()
oexit()
end
function love.mousepressed(x, y)
x, y = fixmou(x, y)
if x > 0.02 and x < 0.235 and y > 0.3 and y < 0.55 then
ostart()
elseif x > 0.02 and x < 0.13 and y > 0.8 and y < 0.95 then
oexit()
end
end
function love.update(dt)
end
function ostart()
love.mousepressed = otou
function love.update(dt)
if sec == nil or sec > 0.2 then
sec = 0
if pn.y < 600 then
pn.y = 600
frame = 1
else
pn.y = 550
frame = 2
end
else sec = sec + dt end
if nsec == nil or nsec > 0.01 then
nsec = 0
anima = anima + 8
else nsec = nsec + dt end
if anima > 655 then
frame = 0
if anima > 700 then
love.update = oupdate
oload()
end
end
end
end
function oexit()
love.event.quit()
end
function love.draw()
love.graphics.scale(s, s)
love.graphics.translate(t[1], t[2])
love.graphics.setLineStyle("smooth")
love.graphics.setLineWidth(1)
love.graphics.setColor(255, 255, 255)
if anima < 700 then
love.graphics.paradraw(back, 750 - anima, 375)
love.graphics.setColor(colors[16])
if frame ~= 0 then love.graphics.paradraw(pn[frame], 750, pn.y) end
love.graphics.setColor(colors[8])
love.graphics.paradraw(door, 1400 - anima, 375)
love.graphics.setFont(aqua[1])
love.graphics.setColor(0, 0, 0)
love.graphics.print("Поч дома нельзя пони", 45 - anima, 110, 0, 0.3, 0.8)
love.graphics.setFont(aqua[2])
love.graphics.setColor(menc[1])
love.graphics.print("Начать", 46 - anima, 300, 0, 0.6, 0.8)
love.graphics.setFont(aqua[4])
love.graphics.setColor(menc[2])
love.graphics.print("Уйти", 50 - anima, 620, 0, 0.6, 1)
else ostartdraw() end
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(mesh, meshp.x1, meshp.y1)
love.graphics.draw(mesh, meshp.x2, meshp.y2)
end
-- SOMEBODY WATCHING ME!! --
-- SOMEBODY WATCHING ME!! --
-- SOMEBODY WATCHING ME!! --
-- SOMEBODY WATCHING ME!! --
-- SOMEBODY WATCHING ME!! --
function oload()
p = love.audio.newSource("Art_Of_Escapism_-_Howling_Down.mp3", "static")
p:setLooping(true)
p:play()
love.graphics.setBackgroundColor(30, 30, 30)
love.physics.setMeter(fur.h * 0.4)
speed = true
money = 0
frame = 1
move = 0
w = love.physics.newWorld(0, love.physics.getMeter() * 9.868464)
edges = {}
edges[1] = {}
edges[1].b = love.physics.newBody(w, 0, 0, "static")
edges[1].s = love.physics.newEdgeShape(0, 0, fur.w * 2, 0)
edges[1].f = love.physics.newFixture(edges[1].b, edges[1].s)
edges[2] = {}
edges[2].b = love.physics.newBody(w, 0, 0, "static")
edges[2].s = love.physics.newEdgeShape(0, fur.h, fur.w * 2, fur.h)
edges[2].f = love.physics.newFixture(edges[2].b, edges[2].s)
pony = {}
pony.b = love.physics.newBody(w, 350, 350, "dynamic")
pony.s = love.physics.newPolygonShape(-160 * 0.8, 90 * 0.8, -160 * 0.8, -0 * 0.8, 80 * 0.8, -140 * 0.8, 130 * 0.8, -140 * 0.8, 90 * 0.8, 130 * 0.8, 160 * 0.8, -0 * 0.8, -115 * 0.8, 130 * 0.8)
pony.f = love.physics.newFixture(pony.b, pony.s, 1)
local obmeb = 1
mebel = {}
while love.filesystem.exists("img/" .. tostring(obmeb) .. ".bmp") do
mebel[#mebel + 1] = love.graphics.newImage("img/" .. tostring(obmeb) .. ".bmp")
obmeb = obmeb + 1
end
mbl = {}
techpoint = 600
while techpoint < fur.w + 150 do
local point = love.math.random(#mebel)
local at = mebel[point]
wid, hei = at:getDimensions()
wid = wid * 20
hei = hei * 20
mbl[#mbl + 1] = {im = at}
mbl[#mbl].b = love.physics.newBody(w, techpoint + wid / 2, 375, "dynamic")
mbl[#mbl].s = love.physics.newRectangleShape(wid, hei)
mbl[#mbl].f = love.physics.newFixture(mbl[#mbl].b, mbl[#mbl].s)
techpoint = techpoint + wid + 4
end
end
function otou(x, y)
x, y = fixmou(x, y)
if speed then
speed = false
if x > 0.5 then
pony.b:applyAngularImpulse(10000)
pony.b:applyForce(30000, -30000)
else
pony.b:applyAngularImpulse(10000)
pony.b:applyForce(-300, -30000)
end
end
end
function oupdate(dt)
w:update(dt)
edges[1].b:setX(pony.b:getX() - 300)
edges[2].b:setX(pony.b:getX() - 300)
if sec == nil or sec > 0.2 then
sec = 0
if frame == 2 then
frame = 1
else
frame = 2
end
else
sec = sec + dt
end
if min == nil or min > 1 then
min = 0
speed = true
else
min = min + dt
end
if pony.b:getX() + 900 > techpoint then
local point = love.math.random(#mebel)
local at = mebel[point]
wid, hei = at:getDimensions()
wid = wid * 20
hei = hei * 20
mbl[#mbl + 1] = {im = at}
mbl[#mbl].b = love.physics.newBody(w, techpoint + wid / 2, 375, "dynamic")
mbl[#mbl].s = love.physics.newRectangleShape(wid, hei)
mbl[#mbl].f = love.physics.newFixture(mbl[#mbl].b, mbl[#mbl].s)
techpoint = techpoint + wid + love.math.random(300)
money = money + love.math.random(500) / 100
end
end
function ostartdraw()
love.graphics.translate(300 - pony.b:getX(), 0)
love.graphics.setColor(colors[16])
love.graphics.draw(pn[frame], pony.b:getX(), pony.b:getY(), pony.b:getAngle(), 20, 20, pn[frame]:getWidth() / 2, pn[frame]:getHeight() / 2)
for i, v in ipairs(mbl) do
while colors[i] == nil do
i = i - #colors
end
love.graphics.setColor(colors[i])
love.graphics.draw(v.im, v.b:getX(), v.b:getY(), v.b:getAngle(), 20, 20, v.im:getWidth() / 2, v.im:getHeight() / 2)
end
ec = {love.graphics.getColor()}
love.graphics.setBackgroundColor(ec[1] / 4, ec[2] / 4, ec[3] / 4)
love.graphics.translate(-(300 - pony.b:getX()), 0)
love.graphics.setColor(colors[1])
love.graphics.print("-$"..tostring(money), 0, 20, 0, 0.4, 0.4)
end |
function table.create(keys, vals)
local result = {}
if type(vals) == 'table' then
for i,k in ipairs(keys) do
result[k] = vals[i]
end
else
for i,k in ipairs(keys) do
result[k] = vals
end
end
return result
end
function mathClamp(number, min, max)
return number <= min and min or (number >= max and max or number)
end
|
local g = vim.g
g['pandoc#syntax#conceal#use'] = false
|
--
local M = {}
require('mx_util.deepcopy')
local copyfunc = {}
local _deepcopy_dispatch = {}
local function deepcopy_cls(x, memo, cls, cname)
local copier = _deepcopy_dispatch[cname]
if copier then
return copier(x, memo)
end
copier = cls.__deepcopy
if copier then
return copier(x, memo)
end
local rv
if cls.__reduce_ex then
rv = cls.__reduce_ex(x, 4)
elseif cls.__reduce then
rv = cls.__reduce(x)
end
if rv then
return M._reconstruct(x, rv, true, memo)
end
-- default
--local ok, ret = pcall(cls)
--if not ok then
-- return table.deepcopy(x, memo, copyfunc)
--end
--for k, v in pairs(x) do
-- k = M.deepcopy(k, memo)
-- v = M.deepcopy(v, memo)
-- ret[k] = v
--end
--return ret
local y = setmetatable({}, getmetatable(x))
y['.class'] = cls
for k, v in pairs(x) do
if k ~= '.class' then
k = M.deepcopy(k, memo)
v = M.deepcopy(v, memo)
y[k] = v
end
end
return y
end
for k, v in pairs(table.deepcopy_copyfunc_list) do
copyfunc[k] = v
end
copyfunc['function'] = table.deepcopy_copyfunc_list._plainolddata
local rawget = rawget
local rawset = rawset
local next = next
local getmetatable = debug and debug.getmetatable or getmetatable
local setmetatable = debug and debug.setmetatable or setmetatable
function copyfunc.table(stack, orig, copy, state, arg1, arg2, arg3, arg4)
local orig_prevkey, grabkey = nil, false
if state == nil then
copy = stack[orig]
if copy ~= nil then
return copy, true
else
local orig_meta = getmetatable(orig)
if orig_meta ~= nil then
local cls = orig['.class']
local cname = orig['.classname']
if cls and cname then
copy = deepcopy_cls(orig, stack, cls, cname)
stack[orig] = copy
return copy, true
else
copy = {}
stack[orig] = copy
if not stack.metatable_immutable then
stack:_recurse(orig_meta)
return copy, 'metatable'
else
setmetatable(copy, orig_meta)
end
end
else
copy = {}
stack[orig] = copy
end
end
orig_prevkey = nil
grabkey = true
elseif state == 'metatable' then
local copy_meta = arg2
stack:_pop(2)
if copy_meta ~= nil then
setmetatable(copy, copy_meta)
end
orig_prevkey = nil
grabkey = true
elseif state == 'key' then
local orig_key = arg1
local copy_key = arg2
if copy_key ~= nil then
local orig_value = rawget(orig, orig_key)
stack:_recurse(orig_value)
return copy, 'value'
else
stack:_pop(2)
orig_prevkey = orig_key
grabkey = true
end
elseif state == 'value' then
local orig_key = arg1
local copy_key = arg2
local copy_value = arg4
stack:_pop(4)
if copy_value ~= nil then
rawset(copy, copy_key, copy_value)
end
orig_prevkey = orig_key
grabkey = true
end
if grabkey then
local orig_key, orig_value = next(orig, orig_prevkey)
if orig_key ~= nil then
stack:_recurse(orig_key)
return copy, 'key'
else
return copy, true
end
end
return
end
function M.deepcopy(x, memo, _nil)
local ty = type(x)
if ty ~= 'table' then
return x
end
memo, _nil = default(memo, {}, _nil, {})
local y = memo[x] or _nil
if y ~= _nil then
return y
end
return table.deepcopy(x, memo, copyfunc)
end
function M._reconstruct(x, info, deep, memo)
if type(info) == 'string' then
return x
end
memo = memo or {}
local deepcopy = M.deepcopy
local callable, args, state, listiter, dictiter = info[1], info[2], info[3], info[4], info[5]
if deep then
args = deepcopy(args, memo)
end
local y = callable(unpack(args))
memo[x] = y
if state then
if deep then
state = deepcopy(state, memo)
end
if y.__setstate then
y:__setstate(state)
else
local slotstate
if islist(state) and #state == 2 then
state, slotstate = state[1], state[2]
end
if state then
for k, v in pairs(state) do
y[k] = v
end
end
if slotstate then
for k, v in pairs(slotstate) do
y[k] = v
end
end
end
end
if listiter then
for item in listiter do
if deep then
item = M.deepcopy(item, memo)
end
table.insert(y, item)
end
end
if dictiter then
for key, value in dictiter do
if deep then
key = deepcopy(key, memo)
value = deepcopy(value, memo)
end
y[key] = value
end
end
return y
end
return M
|
---@type Robot
return function(robot)
while true do
robot:call("score")
coroutine.yield "SUSPEND"
end
end
|
local glove = require 'stackmachine/glove'
local utils = require 'stackmachine/utils'
local config = require 'stackmachine/config'
local json = require "stackmachine/json"
local http = require "socket.http"
local ltn12 = require "ltn12"
local thread = nil
local tasks = {}
function tasks.report(message, data)
local data = data or {}
data["version"] = config.version
data["os"] = love._os
data["distinct_id"] = utils.distinctId()
if thread == nil then
thread = glove.thread.newThread("tasks", "stackmachine/task_thread.lua")
thread:start()
end
local msg = string.gsub(message, "\'", "\"")
local request = {
["url"] = config.links.errors,
["payload"] = {
["errors"] = {
{["message"] = msg, ["tags"] = data},
}
}
}
thread:set('request', json.encode(request))
end
function tasks.track(event, data)
if thread == nil then
thread = glove.thread.newThread("tasks", "stackmachine/task_thread.lua")
thread:start()
end
local data = data or {}
data["version"] = config.version
data["os"] = love._os
data["distinct_id"] = utils.distinctId()
local request = {
["url"] = config.links.metrics,
["payload"] = {
["metrics"] = {
{ ["event"] = event, ["properties"] = data },
},
},
}
thread:set("request", json.encode(request))
end
return tasks
|
-- Snackbar PseudoInstance
-- @documentation https://rostrap.github.io/Libraries/RoStrapUI/Snackbar/
-- @author Validark
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TextService = game:GetService("TextService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Resources = require(ReplicatedStorage:WaitForChild("Resources"))
local Color = Resources:LoadLibrary("Color")
local Debug = Resources:LoadLibrary("Debug")
local Tween = Resources:LoadLibrary("Tween")
local Typer = Resources:LoadLibrary("Typer")
local Shadow = Resources:LoadLibrary("Shadow")
local RippleButton = Resources:LoadLibrary("RippleButton")
local Enumeration = Resources:LoadLibrary("Enumeration")
local PseudoInstance = Resources:LoadLibrary("PseudoInstance")
local RoStrapPriorityUI = Resources:LoadLibrary("RoStrapPriorityUI")
local ReplicatedPseudoInstance = Resources:LoadLibrary("ReplicatedPseudoInstance")
local TEXT_SIZE = 20
local FONT = Enum.Font.SourceSans.Value
local BUTTON_FONT = Enum.Font.SourceSansSemibold.Value
local BUTTON_SIZE = 18
local CORNER_OFFSET = 8
local HEIGHT = 48
local SMALLEST_WIDTH = 294
local TweenCompleted = Enum.TweenStatus.Completed
local Deceleration = Enumeration.EasingFunction.Deceleration.Value
local Acceleration = Enumeration.EasingFunction.Acceleration.Value
Enumeration.SnackbarPosition = { "Left", "Right", "Center" }
local StatePosition = {
[Enumeration.SnackbarPosition.Left.Value] = {
AnchorPoint = Vector2.new(0, 0);
ExitPosition = UDim2.new(0, 7, 1, 0);
EnterPosition = UDim2.new(0, 7, 1, -HEIGHT - CORNER_OFFSET);
};
[Enumeration.SnackbarPosition.Right.Value] = {
AnchorPoint = Vector2.new(1, 0);
ExitPosition = UDim2.new(1, -7, 1, 0);
EnterPosition = UDim2.new(1, -7, 1, -HEIGHT - CORNER_OFFSET);
};
[Enumeration.SnackbarPosition.Center.Value] = {
AnchorPoint = Vector2.new(0.5, 0);
ExitPosition = UDim2.new(0.5, 0, 1, 0);
EnterPosition = UDim2.new(0.5, 0, 1, -HEIGHT - CORNER_OFFSET);
};
}
local SnackbarImage = Instance.new("ImageLabel")
SnackbarImage.BackgroundTransparency = 1
SnackbarImage.Name = "Snackbar"
SnackbarImage.ZIndex = 2
SnackbarImage.Image = "rbxassetid://1934624205"
SnackbarImage.ImageColor3 = Color3.fromRGB(50, 50, 50)
SnackbarImage.ScaleType = Enum.ScaleType.Slice.Value
SnackbarImage.SliceCenter = Rect.new(4, 4, 252, 252)
SnackbarImage.ZIndex = 3
local SnackbarText = Instance.new("TextLabel")
SnackbarText.AnchorPoint = Vector2.new(0, 0.5)
SnackbarText.BackgroundTransparency = 1
SnackbarText.Name = "SnackbarText"
SnackbarText.Position = UDim2.new(0, 16, 0.5, 0)
SnackbarText.Size = UDim2.new(1, 0, 1, -12)
SnackbarText.ZIndex = 3
SnackbarText.Font = FONT
SnackbarText.TextColor3 = Color3.fromRGB(255, 255, 255)
SnackbarText.TextSize = TEXT_SIZE
SnackbarText.TextXAlignment = Enum.TextXAlignment.Left.Value
SnackbarText.Parent = SnackbarImage
local Shadow = PseudoInstance.new("Shadow")
Shadow.Elevation = 6
Shadow.Parent = SnackbarImage
local LocalPlayer, PlayerGui do
if RunService:IsClient() then
repeat LocalPlayer = Players.LocalPlayer until LocalPlayer or not wait()
repeat PlayerGui = LocalPlayer:FindFirstChildOfClass("PlayerGui") until PlayerGui or not wait()
end
end
local function OnActionPressed(self)
if not self.Dismissed then
self:Dismiss()
self.OnAction:Fire(LocalPlayer)
end
end
local LARGE_FRAME_SIZE = Vector2.new(32767, 32767)
local Storage = {}
local function IsInputting(CurrentlyInputting)
for _, Bool in next, CurrentlyInputting do
if Bool == true then
return true
end
end
return false
end
return PseudoInstance:Register("Snackbar", {
Storage = Storage;
WrappedProperties = {
Object = { "Active", "LayoutOrder", "NextSelectionDown", "NextSelectionLeft", "NextSelectionRight", "NextSelectionUp" },
};
Methods = {
Enter = function(self)
self.Dismissed = false
local SnackbarFrame = self.Object
SnackbarFrame.Parent = self.SCREEN
SnackbarFrame.Position = self.ExitPosition
if Storage.OpenSnackbar then
Storage.OpenSnackbar:Dismiss()
end
Storage.OpenSnackbar = self
local CurrentlyInputting = {}
SnackbarFrame.InputBegan:Connect(function(InputObject)
CurrentlyInputting[InputObject.UserInputType.Value] = true
end)
SnackbarFrame.InputEnded:Connect(function(InputObject)
CurrentlyInputting[InputObject.UserInputType.Value] = false
end)
Tween(SnackbarFrame, "Position", self.EnterPosition, Deceleration, self.ENTER_TIME, false, function(Completed)
if Completed == TweenCompleted and wait(self.DisplayTime) then
while IsInputting(CurrentlyInputting) do
repeat wait() until not IsInputting(CurrentlyInputting)
wait(self.DisplayTime)
end
self:Dismiss()
end
end)
end;
Dismiss = function(self)
if not self.Dismissed then
self.Dismissed = true
local SnackbarFrame = self.Object
SnackbarFrame.ZIndex = SnackbarFrame.ZIndex - 1
Tween(SnackbarFrame, "Position", self.ExitPosition, Acceleration, self.ENTER_TIME, true, function(Completed)
if Completed == TweenCompleted then
SnackbarFrame.Parent = nil
if Storage.OpenSnackbar == self then
Storage.OpenSnackbar = nil
end
end
end)
end
end;
};
Events = {
"OnAction";
};
Internals = {
"SnackbarText", "SnackbarAction", "RegisteredRippleInputs", "EnterPosition", "ExitPosition";
SHOULD_BLUR = false;
ActionButtonWidth = 0;
TextWidth = 0;
ENTER_TIME = 0.275;
AdjustSnackbarSize = function(self)
local Width = self.ActionButtonWidth + self.TextWidth + 16*3
self.Object.Size = UDim2.new(0, Width > SMALLEST_WIDTH and Width or SMALLEST_WIDTH, 0, HEIGHT)
end;
};
Properties = {
SnackbarPosition = Typer.AssignSignature(2, Typer.EnumerationOfTypeSnackbarPosition, function(self, Position)
local State = StatePosition[Position.Value]
self.Object.AnchorPoint = State.AnchorPoint
self.ExitPosition = State.ExitPosition
self.EnterPosition = State.EnterPosition
self:rawset("SnackbarPosition", Position)
end);
ActionText = Typer.AssignSignature(2, Typer.String, function(self, ActionText)
if ActionText == "" then
self.SnackbarAction.Parent = nil
self.ActionButtonWidth = 0
else
self.SnackbarAction.Text = ActionText
local Width = TextService:GetTextSize(ActionText, BUTTON_SIZE, BUTTON_FONT, LARGE_FRAME_SIZE).X + 16
self.SnackbarAction.Size = UDim2.new(0, Width, 1, -12)
self.ActionButtonWidth = Width
self.SnackbarAction.Parent = self.Object
self:rawset("ActionText", ActionText)
end
self:AdjustSnackbarSize()
end);
ActionColor3 = Typer.AssignSignature(2, Typer.Color3, function(self, Color)
if self.SnackbarAction.Parent ~= nil then
self.SnackbarAction.PrimaryColor3 = Color
self:rawset("ActionColor3", Color)
end
end);
Text = Typer.AssignSignature(2, Typer.String, function(self, Text)
-- Assign Text to SnackbarText.Text
-- Update Size according to TextBounds, which shouldn't be a property of Snackbar
self.TextWidth = TextService:GetTextSize(Text, TEXT_SIZE, FONT, LARGE_FRAME_SIZE).X
self.SnackbarText.Text = Text
self:AdjustSnackbarSize()
self:rawset("Text", Text)
end);
DisplayTime = Typer.AssignSignature(2, Typer.Number, function(self, DisplayTime)
self:rawset("DisplayTime", DisplayTime)
end)
},
Init = function(self, ...)
self:rawset("Object", SnackbarImage:Clone())
self.SnackbarText = self.Object.SnackbarText
self:rawset("DisplayTime", 5)
local SnackbarAction = PseudoInstance.new("RippleButton")
SnackbarAction.AnchorPoint = Vector2.new(1, 0.5)
SnackbarAction.Name = "SnackbarAction"
SnackbarAction.Position = UDim2.new(1, -8, 0.5, 0)
SnackbarAction.ZIndex = 4
SnackbarAction.Font = BUTTON_FONT
SnackbarAction.PrimaryColor3 = Color.Purple[300]
SnackbarAction.TextSize = BUTTON_SIZE
SnackbarAction.Style = Enumeration.ButtonStyle.Flat.Value
self.Janitor:Add(SnackbarAction.OnPressed:Connect(OnActionPressed, self), "Disconnect")
self.SnackbarAction = SnackbarAction
self.SnackbarPosition = Enumeration.SnackbarPosition.Center
self.Janitor:Add(self.Object, "Destroy")
self.Janitor:Add(self.SnackbarText, "Destroy")
self.Janitor:Add(SnackbarAction, "Destroy")
self:superinit(...)
end;
}, RoStrapPriorityUI)
|
AddCSLuaFile()
ENT.Base = "gballoon_tower_base"
ENT.Type = "anim"
ENT.PrintName = "Microwave Generator"
ENT.Category = "RotgB: Towers"
ENT.Author = "Piengineer"
ENT.Contact = "http://steamcommunity.com/id/Piengineer12/"
ENT.Purpose = "This tower very slowly creates microwave cones that can bypass most gBalloon immunities."
ENT.Instructions = ""
ENT.Spawnable = false
ENT.AdminOnly = false
ENT.RenderGroup = RENDERGROUP_BOTH
ENT.Model = Model("models/hunter/blocks/cube1x1x025.mdl")
ENT.FireRate = 0.5
ENT.Cost = 700
ENT.DetectionRadius = 256
ENT.AttackDamage = 10
ENT.LOSOffset = Vector(0,0,32)
ENT.UserTargeting = true
ENT.AbilityCooldown = 45
ENT.rotgb_MicrowaveAngle = 20
ENT.rotgb_AbilityType = 0
ENT.rotgb_Lighten = 0
ENT.rotgb_FiresMade = {}
ENT.UpgradeReference = {
{
Names = {"Unstoppable Waves","Intense Waves","Thermal Detection","Concentrated Waves","Extreme Frequency Waves","Extremely Concentrated Waves"},
Descs = {
"Increases the tower's range to infinite.",
"Considerably increases microwave damage.",
"Enables the tower to see hidden gBalloons.",
"Tremendously increases microwave damage, but slightly decreases microwave width.",
"Colossally increases microwave damage. Once every 45 seconds, firing at this tower colossally increases fire rate and triples the width of microwaves for 15 seconds.",
"Colossally decreases the width of microwaves for vastly increased damage, enough to destroy Red gBlimps in a single hit."
},
Prices = {650,1250,3000,5000,75000,850000},
Funcs = {
function(self)
self.InfiniteRange = true
end,
function(self)
self.AttackDamage = self.AttackDamage + 10
end,
function(self)
self.SeeCamo = true
end,
function(self)
self.AttackDamage = self.AttackDamage + 40
self.rotgb_MicrowaveAngle = self.rotgb_MicrowaveAngle / 1.5
end,
function(self)
self.AttackDamage = self.AttackDamage + 240
self.HasAbility = true
self.rotgb_AbilityType = bit.bor(self.rotgb_AbilityType, 1)
end,
function(self)
self.rotgb_MicrowaveAngle = self.rotgb_MicrowaveAngle / 5
self.AttackDamage = self.AttackDamage + 14700
end
}
},
{
Names = {"Stronger Battery","Diffractional Waves","Open Fryer","20-Star Fryer","gBalloon S.E.A.R.","Now That's Hot"},
Descs = {
"Increases the tower's fire rate.",
"Triples the width of microwaves.",
"Microwaves are now emitted in all directions.",
"Microwaves now have a 20% chance to set gBalloons on fire permanently. Every time the tower successfully does this, new fires from this tower pop one extra layer for 10 seconds. This effect stacks.",
"Microwaves are now guaranteed to set gBalloons alight. Once every 45 seconds, firing at this tower increases damage dealt for new fires by 95 layers for 15 seconds.",
"All fires deal 25 times more damage!"
},
Prices = {300,1750,5000,10000,50000,1.5e6},
Funcs = {
function(self)
self.FireRate = self.FireRate * 1.5
end,
function(self)
self.rotgb_MicrowaveAngle = self.rotgb_MicrowaveAngle * 3
end,
function(self)
self.rotgb_MicrowaveAngle = self.rotgb_MicrowaveAngle * 3
end,
function(self)
self.rotgb_Lighten = 0.2
end,
function(self)
self.rotgb_Lighten = 1
self.HasAbility = true
self.rotgb_AbilityType = bit.bor(self.rotgb_AbilityType, 2)
end,
function(self)
self.rotgb_OmegaFires = true
end
}
}
}
ENT.UpgradeLimits = {6,2}
function ENT:FireFunction(gBalloons)
self:SetNWFloat("LastFireTime",CurTime())
local startpos = self:GetShootPos()
local fireDir = self:WorldToLocal(gBalloons[1]:LocalToWorld(gBalloons[1]:OBBCenter()))
fireDir.z = 0
fireDir:Normalize()
self:SetNWVector("OurTurning",fireDir)
local anglecos = math.cos(math.rad(self.rotgb_MicrowaveAngle))
for k,v in pairs(gBalloons) do
local bpos = self:WorldToLocal(v:LocalToWorld(v:OBBCenter()))
bpos.z = 0
bpos:Normalize()
if bpos:Dot(fireDir) >= anglecos then
v:TakeDamage(self.AttackDamage,self:GetTowerOwner(),self)
if not v.MicrowaveFire and self.rotgb_Lighten > math.random() then
local damage = (10 + self:GetFireDamageBonus()) * (self.rotgb_OmegaFires and 25 or 1)
v:RotgB_Ignite(damage, self:GetTowerOwner(), self, 1000000)
v.MicrowaveFire = true
table.insert(self.rotgb_FiresMade, CurTime() + 10)
end
end
end
end
function ENT:GetFireDamageBonus()
for k,v in pairs(self.rotgb_FiresMade) do
if v < CurTime() then
self.rotgb_FiresMade[k] = nil
end
end
return table.Count(self.rotgb_FiresMade) * 10
end
local laserMat = Material("trails/laser")
local layer_color = Color(255,255,255,31)
function ENT:ROTGB_Draw()
local delta = math.Clamp(math.Remap(1/self.FireRate+self:GetNWFloat("LastFireTime",0)-CurTime(),1/self.FireRate,0,1,0),0,1)
local abilitydelta = math.Clamp(math.Remap(self:GetNWFloat("rotgb_CC")-CurTime(),10,0,1,0),0,1)
local desiredangle = Angle(0,90*CurTime()%360,0)
if not self:GetNWVector("OurTurning",vector_origin):IsZero() and delta > 0 then
local gdir = self:GetNWVector("OurTurning")+vector_origin
local abmul = abilitydelta > 0 and bit.band(self.rotgb_AbilityType, 1) == 1 and 3 or 1
gdir:Rotate(Angle(0,-self.rotgb_MicrowaveAngle*abmul,0))
render.SetMaterial(laserMat)
for i=0,2,0.125 do
render.DrawBeam(self:GetShootPos(),self:LocalToWorld(gdir*(self.InfiniteRange and 32768 or self.DetectionRadius)+self.LOSOffset),4,0,1,Color(255,255,0,delta*255))
gdir:Rotate(Angle(0,self.rotgb_MicrowaveAngle*0.125*abmul,0))
end
end
render.SetColorMaterial()
render.DrawBox(self:GetShootPos(),self:LocalToWorldAngles(desiredangle),Vector(-8,-8,-8),Vector(8,8,8),Color(255,255,abilitydelta*255))
for i=1,6 do
if i == 5 then
desiredangle = Angle(89.99, desiredangle[2], 0)
elseif i == 6 then
desiredangle = Angle(-89.99, desiredangle[2], 0)
else
desiredangle:RotateAroundAxis(vector_up,90)
end
local preangle = self:LocalToWorldAngles(desiredangle)
local normal = preangle:Forward()
local dist = normal*(delta+1)*12
render.DrawQuadEasy(self:GetShootPos()+dist, normal, 16, 16, layer_color, preangle[3])
render.DrawQuadEasy(self:GetShootPos()+dist, -normal, 16, 16, layer_color, -preangle[3])
end
end
function ENT:TriggerAbility()
self:SetNWFloat("rotgb_CC", CurTime()+15)
if bit.band(self.rotgb_AbilityType, 1) == 1 then
self.FireRate = self.FireRate * 5
self.rotgb_MicrowaveAngle = self.rotgb_MicrowaveAngle * 3
timer.Simple(15,function()
if IsValid(self) then
self.FireRate = self.FireRate / 5
self.rotgb_MicrowaveAngle = self.rotgb_MicrowaveAngle / 3
end
end)
end
if bit.band(self.rotgb_AbilityType, 2) == 2 then
self.AttackDamage = self.AttackDamage + 190
local timetoinsert = CurTime() + 15
for i=1,95 do
table.insert(self.rotgb_FiresMade, timetoinsert)
end
end
end |
--------------------------------------------------------------------------------
-- Handler.......... : onPublishWorkshopFileUpdate
-- Author........... :
-- Description...... :
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function Steam.onPublishWorkshopFileUpdate ( sWorkshopItemID, sFilePath, sTitle, sDescription, sAI, sCallback )
--------------------------------------------------------------------------------
this.publishFileUpdate ( sWorkshopItemID, sFilePath, sTitle, sDescription, sAI, sCallback )
--------------------------------------------------------------------------------
end
--------------------------------------------------------------------------------
|
--[[
item.lua
An item button
--]]
--libs/other jambers
local InvData = Combuctor:GetModule('InventoryData')
--that's classy
local Item = Combuctor:NewClass('Button')
Item.SIZE = 37
Combuctor.Item = Item
local ITEM_COLOR = {
[0] = {0.8, 0.8,0.8,0.8},
[1] = {0.5, 0.5,0.5,0.8},
[2] = {0, 1.0,0, 0.8},
[3] = {0, 0.0,1, 0.8},
[4] = {0.5, 0, 1, 0.8},
[5] = {1.0, 0.5,0, 0.8},
[6] = {1.0, 0, 0, 0.8},
[7] = {1, 1, 0, 0.6},
[8] = {0, 0.8, 1, 0.6},
[9] = {1, 1, 0, 0.6},
};
--[[
Dummy Slot
A hack, used to provide a tooltip for cached items without tainting other item code
--]]
do
local slot = CreateFrame('Button')
slot:RegisterForClicks('anyUp')
slot:SetToplevel(true)
slot:Hide()
local function Slot_OnEnter(self)
local parent = self:GetParent()
local link = parent.hasItem
parent:LockHighlight()
if parent.cached and link then
Item.AnchorTooltip(self)
GameTooltip:SetHyperlink(link)
GameTooltip:Show()
end
end
local function Slot_OnLeave(self)
GameTooltip:Hide()
self:Hide()
end
local function Slot_OnHide(self)
local parent = self:GetParent()
if parent then
parent:UnlockHighlight()
end
end
local function Slot_OnClick(self, button)
self:GetParent():OnModifiedClick(button)
end
slot.UpdateTooltip = Slot_OnEnter
slot:SetScript('OnClick', Slot_OnClick)
slot:SetScript('OnEnter', Slot_OnEnter)
slot:SetScript('OnLeave', Slot_OnLeave)
slot:SetScript('OnShow', Slot_OnEnter)
slot:SetScript('OnHide', Slot_OnHide)
Item.dummySlot = slot
end
--[[
The item widget
--]]
local id = 1
function Item:New()
local item = self:Bind(_G["CombuctorItem"..id] or CreateFrame('Button', 'CombuctorItem' .. id, nil, 'ContainerFrameItemButtonTemplate'))
--5.4 add
local newItemTexture = item.NewItemTexture;
if newItemTexture then
newItemTexture:Hide();
end
--6.0 add
local battlepayItemTexture = item.BattlepayItemTexture;
if battlepayItemTexture then
battlepayItemTexture:Hide();
end
--add a quality border texture
local border = item:CreateTexture(nil, 'OVERLAY')
border:SetAllPoints(item:GetNormalTexture());
border:SetTexture('Interface\\AddOns\\Combuctor\\textures\\Border')
border:Hide()
item.border = border
--hack, make sure the cooldown model stays visible
item.cooldown = _G[item:GetName() .. 'Cooldown']
item.cooldown:SetFrameLevel(4)
--get rid of any registered frame events, and use my own
item:UnregisterAllEvents()
item:SetScript('OnEvent', nil)
item:SetScript('OnEnter', self.OnEnter)
item:SetScript('OnHide', self.OnHide)
item:SetScript('PreClick',ItemInfo_ContainerItemPreClick)
item:SetScript('PostClick', self.PostClick)
item.UpdateTooltip = nil
id = id + 1
return item
end
function Item:GetBlizzard(id)
local bag = ceil(id / MAX_CONTAINER_ITEMS)
local slot = (id-1) % MAX_CONTAINER_ITEMS + 1
local item = _G[format('ContainerFrame%dItem%d', bag, slot)]
if item then
item:SetID(0)
item:ClearAllPoints()
return item
end
end
--item pool methods
do
local unused = {}
function Item:Get()
local item = next(unused)
if item then
unused[item] = nil
return item
end
return self:New()
end
function Item:Release()
unused[self] = true
self.cached = nil
self.hasItem = nil
self:SetParent(nil)
self:Hide()
end
end
--dummy bag, a hack to enforce the internal blizzard rule that item:GetParent():GetID() == bagID
function Item:GetDummyBag(parent, id)
local dummyBags = parent.dummyBags
--metatable magic to create a new frame on demand
if not dummyBags then
dummyBags = setmetatable({}, {
__index = function(t, k)
local f = CreateFrame('Frame', nil, parent)
f:SetID(k)
t[k] = f
return f
end
})
parent.dummyBags = dummyBags
end
return dummyBags[id]
end
--[[ Update Methods ]]--
function Item:Set(parent, bag, slot)
self:SetParent(self:GetDummyBag(parent, bag))
self:SetID(slot)
self:Update()
return item
end
-- Update the texture, lock status, and other information about an item
function Item:Update()
local player, bag, slot = self:GetSlotInfo()
local link, count, texture, quality, locked, readable, cached = InvData:GetItemInfo(bag, slot, player)
local bagFamily = select(2, GetContainerNumFreeSlots(bag));
local isQuestItem, questId, isActive = GetContainerItemQuestInfo(bag, slot);
self.readable = readable
self.cached = cached
self.hasItem = texture and link
SetItemButtonDesaturated(self, locked)
SetItemButtonTexture(self, texture or 'Interface/PaperDoll/UI-Backpack-EmptySlot')
SetItemButtonCount(self, count)
if (bagFamily and bagFamily > 0) then
SetItemButtonNormalTextureVertexColor(self, 1.0, 1.0, 0.0);
else
SetItemButtonNormalTextureVertexColor(self, 1.0, 1.0, 1.0);
end
self:UpdateBorder(quality,nil, questId, isActive)
self:UpdateCooldown()
if GameTooltip:IsOwned(self) then
self:UpdateTooltip()
end
if not self.hasItem then --若当前物品栏无物品则隐藏tooltip
GameTooltip:Hide();
end
end
--colors the item border based on the quality of the item. hides it for common/poor items
function Item:UpdateBorder(quality,quest, questId, isActive)
local border = self.border
local link = self.hasItem
if questId then
if (not isActive) then
_G[self:GetName().."IconQuestTexture"]:SetTexture(TEXTURE_ITEM_QUEST_BANG);
else
_G[self:GetName().."IconQuestTexture"]:SetTexture(TEXTURE_ITEM_QUEST_BORDER);
end
_G[self:GetName().."IconQuestTexture"]:Show();
return;
else
_G[self:GetName().."IconQuestTexture"]:Hide();
end
if (quest) then
border:SetVertexColor(0.0, 0.8, 0.8, 0.5);
border:Show();
return;
end
if link and quality and quality > 1 then
local r, g, b = GetItemQualityColor(quality)
border:SetVertexColor(unpack(ITEM_COLOR[quality]))
border:Show()
else
border:Hide()
end
end
function Item:UpdateLock(locked)
local player, bag, slot = self:GetSlotInfo()
local locked = select(3, GetContainerItemInfo(bag, slot))
SetItemButtonDesaturated(self, locked)
end
function Item:UpdateCooldown()
if (not self.cached) and self.hasItem then
local player, bag, slot = self:GetSlotInfo()
local start, duration, enable = GetContainerItemCooldown(bag, slot)
CooldownFrame_Set(self.cooldown, start, duration, enable)
elseif self.cooldown:IsShown() then
CooldownFrame_Set(self.cooldown, 0, 0, 0)
end
end
--fade out slots, if not true
function Item:Highlight(enable)
if enable then
self:LockHighlight()
else
self:UnlockHighlight()
end
end
--[[ Frame Events ]]--
function Item:OnDragStart()
if self.cached and CursorHasItem() then
ClearCursor()
end
end
function Item:OnModifiedClick(button)
if self.cached and self.hasItem then
local player, bag, slot = self:GetSlotInfo()
HandleModifiedItemClick(InvData:GetItemLink(bag, slot, player))
end
end
function Item:OnHide()
if self.hasStackSplit and self.hasStackSplit == 1 then
StackSplitFrame:Hide()
end
end
--[[ Tooltip Methods ]]--
function Item:OnEnter()
if self.cached then
self.dummySlot:SetParent(self)
self.dummySlot:SetAllPoints(self)
self.dummySlot:Show()
else
self.dummySlot:Hide()
--boo for special case bank code
local player, bag, slot = self:GetSlotInfo()
if bag == BANK_CONTAINER or bag == REAGENTBANK_CONTAINER then
local getSlot = bag == BANK_CONTAINER and BankButtonIDToInvSlotID or bag == REAGENTBANK_CONTAINER and ReagentBankButtonIDToInvSlotID
if self.hasItem then
self:AnchorTooltip()
GameTooltip:SetInventoryItem('player', getSlot(slot))
GameTooltip:Show()
end
else
ContainerFrameItemButton_OnEnter(self)
end
end
end
Item.UpdateTooltip = Item.OnEnter
--[[ Convenience Functions ]]--
function Item:GetPlayer()
local bag = self:GetParent()
if bag then
local frame = bag:GetParent()
return frame and frame:GetPlayer()
end
return UnitName('player')
end
function Item:GetBag()
local bag = self:GetParent()
return bag and bag:GetID()
end
function Item:GetSlotInfo()
return self:GetPlayer(), self:GetBag(), self:GetID()
end
function Item:AnchorTooltip()
if self:GetRight() >= (GetScreenWidth() / 2) then
GameTooltip:SetOwner(self, 'ANCHOR_LEFT')
else
GameTooltip:SetOwner(self, 'ANCHOR_RIGHT')
end
end |
LmodMessage("5.0rc2: ",convertToCanonical("5.0rc2"))
LmodMessage("5.0: ",convertToCanonical("5.0"))
LmodMessage("5.1: ",convertToCanonical("5.1"))
LmodMessage("5.1.0: ",convertToCanonical("5.1.0"))
LmodMessage("5.1.1: ",convertToCanonical("5.1.1"))
LmodMessage("default: ",convertToCanonical("default"))
local result = (convertToCanonical("default") < convertToCanonical("5.1.1"))
LmodMessage("\"default\" < \"5.1.1\" is ", tostring(result))
if (convertToCanonical(LmodVersion()) > convertToCanonical("0.5")) then
LmodMessage("(1) Passed Module Test")
end
if (convertToCanonical(LmodVersion()) < convertToCanonical("100000000000.0")) then
LmodMessage("(2) Passed Module Test")
end
if (convertToCanonical(LmodVersion()) > convertToCanonical("100000000000.0")) then
LmodMessage("(3) Failed Module Test")
unknownFunc("A","b","C")
end
local nameA = {
"LMOD_VERSION",
"LMOD_VERSION_MAJOR",
"LMOD_VERSION_MINOR",
"LMOD_VERSION_SUBMINOR",
}
for i = 1,#nameA do
local vstr = os.getenv(nameA[i])
if (vstr) then
LmodMessage("Lmod reports a ",nameA[i])
end
end
for i = 1,#nameA do
local vstr = os.getenv(nameA[i])
if (vstr) then
LmodMessage("-%%- ",nameA[i],": ",vstr)
end
end
|
-- This file is subject to copyright - contact swampservers@gmail.com for more information.
-- INSTALL: CINEMA
include("shared.lua")
SWEP.Instructions = "Primary: Vocal Outburst\nSecondary: Self-Harming\nReload: Greeting"
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
net.Receive("AutismArm", function()
ply = net.ReadEntity()
if not IsValid(ply) then return end
mult = net.ReadFloat()
if not ply:LookupBone("ValveBiped.Bip01_L_Upperarm") then return end
ply:ManipulateBoneAngles(ply:LookupBone("ValveBiped.Bip01_L_Upperarm"), Angle(-30 * mult, -50 * mult, -10 * mult))
ply:ManipulateBoneAngles(ply:LookupBone("ValveBiped.Bip01_L_Forearm"), Angle(5 * mult, -100 * mult, 0))
ply:ManipulateBoneAngles(ply:LookupBone("ValveBiped.Bip01_L_Hand"), Angle(0, 0, -30 * mult))
end) |
Stack = {}
function Stack:new()
o = {}
setmetatable(o, self)
self.__index = self
return o
end
function Stack:push(o)
self[#self + 1] = o
end
function Stack:pop()
o = self:top()
self[#self] = nil
return o
end
function Stack:top()
return self[#self]
end
function Stack:isempty()
return nil == self:top()
end
return Stack
|
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local voices = { {text = 'Selling weapons, ammunition and armor. Special offers only available here, have a look!'} }
npcHandler:addModule(VoiceModule:new(voices))
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if msgcontains(msg, "package for rashid") then
if player:getStorageValue(Storage.TravellingTrader.Mission02) >= 1 and player:getStorageValue(Storage.TravellingTrader.Mission02) < 3 then
npcHandler:say({
"Oooh, damn, I completely forgot about that. I was supposed to pick it up from the Outlaw Camp. ...",
"I can't leave my shop here right now, please go and talk to Snake Eye about that package... I promise he won't make any trouble. ...",
"Don't tell Rashid! I really don't want him to know that I forgot his order. Okay?"
}, cid)
npcHandler.topic[cid] = 1
end
elseif msgcontains(msg, "yes") then
if npcHandler.topic[cid] == 1 then
npcHandler:say("Thank you, I appreciate it. Don't forget to mention the package to Snake.", cid)
player:setStorageValue(Storage.TravellingTrader.Mission02, player:getStorageValue(Storage.TravellingTrader.Mission02) + 1)
npcHandler.topic[cid] = 0
end
end
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Greetings and Banor be with you, |PLAYERNAME|! May I interest you in a {trade} for weapons, ammunition or armor?")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell, |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell, |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Of course, just browse through my wares. If you're only interested in {distance} equipment, let me know.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
|
------ MADE BY MAX F. ------
--FOR JUSTICE COMMUNITY RP--
----------------------------
----------------------------------------------------------------------------------------------------
--------------------------------------CREATING THE MENUS------------------------------------------
----------------------------------------------------------------------------------------------------
_mainPool = NativeUI.CreatePool()
LTDMenu = NativeUI.CreateMenu( '', '', 0, 0, 'shopui_title_gasstation', 'shopui_title_gasstation')
_mainPool:Add(LTDMenu)
TFSMenu = NativeUI.CreateMenu( '', '', 0, 0, 'shopui_title_conveniencestore', 'shopui_title_conveniencestore')
_mainPool:Add(TFSMenu)
RLMenu = NativeUI.CreateMenu( '', '', 0, 0, 'shopui_title_liquorstore2', 'shopui_title_liquorstore2')
_mainPool:Add(RLMenu)
YJMenu = NativeUI.CreateMenu( '', '', 0, 0, 'shopui_title_liquorstore3', 'shopui_title_liquorstore3')
_mainPool:Add(YJMenu)
ALMenu = NativeUI.CreateMenu( '', '', 0, 0, 'shopui_title_liquorstore', 'shopui_title_liquorstore')
_mainPool:Add(ALMenu)
BSMenu = NativeUI.CreateMenu( '', '', 0, 0, 'shopui_title_liquorstore', 'shopui_title_liquorstore')
_mainPool:Add(BSMenu)
----------------------------------------------------------------------------------------------------
---------------------------------------------DATABASES----------------------------------------------
----------------------------------------------------------------------------------------------------
local LTD = {
name = 'LTD',
Menus = {
{
menu = nil,
name = 'Food',
Items ={
{name = 'Bread', price = '~g~Free', regin = 10},
{name = 'Cereals', price = '~g~Free', regin = 8},
{name = 'Steak', price = '~g~Free', regin = 25},
{name = 'Cheese Sandwich', price = '~g~Free', regin = 20},
{name = 'Banana', price = '~g~Free', regin = 7},
{name = 'Apple', price = '~g~Free', regin = 5},
{name = 'Orange', price = '~g~Free', regin = 5},
}
},
{
menu = nil,
name = 'Beverages',
Items = {
{name = 'A.M', price = '~g~Free', regin = 14},
{name = 'Stranzo', price = '~g~Free', regin = 16},
{name = 'Pigwasser', price = '~g~Free', regin = 15},
{name = 'Logger', price = '~g~Free', regin = 16},
{name = 'Blarneys', price = '~g~Free', regin = 14},
{name = 'Dusche', price = '~g~Free', regin = 10},
{name = 'Sprunk', price = '~g~Free', regin = 14},
{name = 'eCola', price = '~g~Free', regin = 16},
{name = 'Junk', price = '~g~Free', regin = 15},
{name = 'Mas Fuego', price = '~g~Free', regin = 16},
{name = 'Orang_O_Tang', price = '~g~Free', regin = 14},
{name = 'Water', price = '~g~Free', regin = 10},
{name = 'Milk', price = '~g~Free', regin = 9},
{name = 'Apple Juice', price = '~g~Free', regin = 19},
{name = 'Orange Juice', price = '~g~Free', regin = 17},
}
},
{
menu = nil,
name = 'Cigarets',
Items = {
{name = 'Redwood', price = '~g~Free', regin = -4},
{name = 'Debonaire', price = '~g~Free', regin = -4},
{name = 'Cardiaque', price = '~g~Free', regin = -4},
{name = 'GR&NG', price = '~g~Free', regin = -4},
}
},
{
menu = nil,
name = 'Snacks',
Items = {
{name = 'Ego Chaser', price = '~g~Free', regin = 12},
{name = 'Sweet Nothings', price = '~g~Free', regin = 12},
{name = 'Captain\'s Log', price = '~g~Free', regin = 12},
{name = 'Zebrabar', price = '~g~Free', regin = 12},
{name = 'EarthQuakes', price = '~g~Free', regin = 12},
{name = 'P\'s & Q\'s', price = '~g~Free', regin = 12},
{name = 'Meteorite', price = '~g~Free', regin = 12},
{name = 'Phat Chips', price = '~g~Free', regin = 7},
}
}
},
Locations = {
{x = -47.98, y = -1756.98, z = 28.42},
{x = -707.58, y = -913.67, z = 18.22},
{x = 1163.18, y = -323.01, z = 68.21},
{x = 1699.04, y = 4924.27, z = 41.06},
},
Colors = {R = 22, G = 26, B = 52}
}
local TFS = {
name = '24/7',
Menus = {
{
menu = nil,
name = 'Food',
Items ={
{name = 'Bread', price = '~g~Free', regin = 10},
{name = 'Cereals', price = '~g~Free', regin = 8},
{name = 'Steak', price = '~g~Free', regin = 25},
{name = 'Cheese Sandwich', price = '~g~Free', regin = 20},
{name = 'Banana', price = '~g~Free', regin = 7},
{name = 'Apple', price = '~g~Free', regin = 5},
{name = 'Orange', price = '~g~Free', regin = 5},
}
},
{
menu = nil,
name = 'Beverages',
Items = {
{name = 'A.M', price = '~g~Free', regin = 14},
{name = 'Stranzo', price = '~g~Free', regin = 16},
{name = 'Pigwasser', price = '~g~Free', regin = 15},
{name = 'Logger', price = '~g~Free', regin = 16},
{name = 'Blarneys', price = '~g~Free', regin = 14},
{name = 'Dusche', price = '~g~Free', regin = 10},
{name = 'Sprunk', price = '~g~Free', regin = 14},
{name = 'eCola', price = '~g~Free', regin = 16},
{name = 'Junk', price = '~g~Free', regin = 15},
{name = 'Mas Fuego', price = '~g~Free', regin = 16},
{name = 'Orang_O_Tang', price = '~g~Free', regin = 14},
{name = 'Water', price = '~g~Free', regin = 10},
{name = 'Milk', price = '~g~Free', regin = 9},
{name = 'Apple Juice', price = '~g~Free', regin = 19},
{name = 'Orange Juice', price = '~g~Free', regin = 17},
}
},
{
menu = nil,
name = 'Cigarets',
Items = {
{name = 'Redwood', price = '~g~Free', regin = -4},
{name = 'Debonaire', price = '~g~Free', regin = -4},
{name = 'Cardiaque', price = '~g~Free', regin = -4},
{name = 'GR&NG', price = '~g~Free', regin = -4},
}
},
{
menu = nil,
name = 'Snacks',
Items = {
{name = 'Ego Chaser', price = '~g~Free', regin = 12},
{name = 'Sweet Nothings', price = '~g~Free', regin = 12},
{name = 'Captain\'s Log', price = '~g~Free', regin = 12},
{name = 'Zebrabar', price = '~g~Free', regin = 12},
{name = 'EarthQuakes', price = '~g~Free', regin = 12},
{name = 'P\'s & Q\'s', price = '~g~Free', regin = 12},
{name = 'Meteorite', price = '~g~Free', regin = 12},
{name = 'Phat Chips', price = '~g~Free', regin = 7},
}
}
},
Locations = {
{x = 26.04, y = -1347.27, z = 28.5},
{x = 2678.79, y = 3280.71, z = 54.24},
{x = 1961.46, y = 3740.68, z = 31.34},
{x = 374.13, y = 326.13, z = 102.57},
},
Colors = {R = 44, G = 171, B = 81}
}
local RL = {
name = 'Rob\'s Liquor',
Menus = {
{
menu = nil,
name = 'Beverages',
Items = {
{name = 'A.M', price = '~g~Free', regin = 14},
{name = 'Stranzo', price = '~g~Free', regin = 16},
{name = 'Pigwasser', price = '~g~Free', regin = 15},
{name = 'Logger', price = '~g~Free', regin = 16},
{name = 'Blarneys', price = '~g~Free', regin = 14},
{name = 'Dusche', price = '~g~Free', regin = 10},
{name = 'Patriot', price = '~g~Free', regin = 9},
{name = 'Darracho', price = '~g~Free', regin = 19},
{name = 'Brew', price = '~g~Free', regin = 17},
{name = 'Jakey\'s Lager', price = '~g~Free', regin = 17},
{name = 'Syrah', price = '~g~Free', regin = 17},
{name = 'Benedict', price = '~g~Free', regin = 17},
}
},
{
menu = nil,
name = 'Liquors',
Items = {
{name = 'Tequilya', price = '~g~Free', regin = -14},
{name = 'Rum', price = '~g~Free', regin = -16},
{name = 'The Mount', price = '~g~Free', regin = -15},
{name = 'Cardiaque', price = '~g~Free', regin = -16},
{name = 'Bourgeoix', price = '~g~Free', regin = -14},
{name = 'Cherenkov', price = '~g~Free', regin = -10},
{name = 'Vodka', price = '~g~Free', regin = -29},
{name = 'Bleuter\'d', price = '~g~Free', regin = -19},
}
},
{
menu = nil,
name = 'Cigarets',
Items = {
{name = 'Redwood', price = '~g~Free', regin = -4},
{name = 'Debonaire', price = '~g~Free', regin = -4},
{name = 'Cardiaque', price = '~g~Free', regin = -4},
{name = 'GR&NG', price = '~g~Free', regin = -4},
}
},
{
menu = nil,
name = 'Snacks',
Items = {
{name = 'Ego Chaser', price = '~g~Free', regin = 12},
{name = 'Sweet Nothings', price = '~g~Free', regin = 12},
{name = 'Captain\'s Log', price = '~g~Free', regin = 12},
{name = 'Zebrabar', price = '~g~Free', regin = 12},
{name = 'EarthQuakes', price = '~g~Free', regin = 12},
{name = 'P\'s & Q\'s', price = '~g~Free', regin = 12},
{name = 'Meteorite', price = '~g~Free', regin = 12},
{name = 'Phat Chips', price = '~g~Free', regin = 7},
}
}
},
Locations = {
{x = 1136.18, y = -982.22, z = 45.42},
{x = -1222.97, y = -906.9, z = 11.33},
{x = -1487.61, y = -379.31, z = 39.16},
{x = -2968.24, y = 391.08, z = 14.04},
{x = 1166.0, y = 2708.92, z = 37.16},
},
Colors = {R = 250, G = 0, B = 0}
}
local BS = {
name = 'BurgerShot',
Menus = {
{
menu = nil,
name = 'Meals',
Items = {
{name = 'Eco Meal', price = '~g~Free', regin = 67},
{name = 'The Double Meal', price = '~g~Free', regin = 79},
{name = 'The Killer', price = '~g~Free', regin = 95},
{name = 'The Spico', price = '~g~Free', regin = 91},
{name = 'The King', price = '~g~Free', regin = 100},
{name = 'The Dark Knight', price = '~g~Free', regin = 100},
}
},
{
menu = nil,
name = 'Burgers',
Items = {
{name = 'Chicken Burger', price = '~g~Free', regin = 35},
{name = 'Double Chicken Burger', price = '~g~Free', regin = 45},
{name = 'Grilled Chicken Burger', price = '~g~Free', regin = 40},
{name = 'Ham Burger', price = '~g~Free', regin = 35},
{name = 'Double Hamburger', price = '~g~Free', regin = 45},
{name = 'Grilled Hamburger', price = '~g~Free', regin = 40},
{name = 'Grandee Chicken Burger', price = '~g~Free', regin = 37},
{name = 'Specialee Hamburger', price = '~g~Free', regin = 37},
}
},
{
menu = nil,
name = 'Drinks',
Items = {
{name = 'Sprunk', price = '~g~Free', regin = 14},
{name = 'eCola', price = '~g~Free', regin = 16},
{name = 'Water', price = '~g~Free', regin = 10},
{name = 'Apple Juice', price = '~g~Free', regin = 19},
{name = 'Orange Juice', price = '~g~Free', regin = 17},
}
},
{
menu = nil,
name = 'French-Fries',
Items = {
{name = 'French-Fries with cheese', price = '~g~Free', regin = 30},
{name = 'spicy French-Fries', price = '~g~Free', regin = 29},
}
}
},
Locations = {
-- {x = -1193.61, y = -892.61, z = 14},
{x = -1687.58, y = -1092.02, z = 12.15},
},
Colors = {R = 222, G = 141, B = 0}
}
local YJ = {
name = 'Yellow Jack',
Menus = {
{
menu = nil,
name = 'Beverages',
Items = {
{name = 'A.M', price = '~g~Free', regin = 14},
{name = 'Stranzo', price = '~g~Free', regin = 16},
{name = 'Pigwasser', price = '~g~Free', regin = 15},
{name = 'Logger', price = '~g~Free', regin = 16},
{name = 'Blarneys', price = '~g~Free', regin = 14},
{name = 'Dusche', price = '~g~Free', regin = 10},
}
},
{
menu = nil,
name = 'Liquors',
Items = {
{name = 'Tequilya', price = '~g~Free', regin = -14},
{name = 'Rum', price = '~g~Free', regin = -16},
{name = 'The Mount', price = '~g~Free', regin = -15},
{name = 'Cardiaque', price = '~g~Free', regin = -16},
{name = 'Bourgeoix', price = '~g~Free', regin = -14},
{name = 'Cherenkov', price = '~g~Free', regin = -10},
{name = 'Vodka', price = '~g~Free', regin = -29},
{name = 'Bleuter\'d', price = '~g~Free', regin = -19},
}
}
},
Locations = {
{x = 1985.56, y = 3052.52, z = 46.22}
},
Colors = {R = 255, G = 226, B = 3}
}
local AL = {
name = 'Ace Liquor',
Menus = {
{
menu = nil,
name = 'Beverages',
Items = {
{name = 'A.M', price = '~g~Free', regin = nil},
{name = 'Stranzo', price = '~g~Free', regin = nil},
{name = 'Pigwasser', price = '~g~Free', regin = nil},
{name = 'Logger', price = '~g~Free', regin = nil},
{name = 'Blarneys', price = '~g~Free', regin = nil},
{name = 'Dusche', price = '~g~Free', regin = nil},
{name = 'Patriot', price = '~g~Free', regin = nil},
{name = 'Darracho', price = '~g~Free', regin = nil},
{name = 'Brew', price = '~g~Free', regin = nil},
{name = 'Jakey\'s Lager', price = '~g~Free', regin = nil},
}
},
{
menu = nil,
name = 'Liquors',
Items = {
{name = 'Tequilya', price = '~g~Free', regin = nil},
{name = 'Rum', price = '~g~Free', regin = nil},
{name = 'The Mount', price = '~g~Free', regin = nil},
{name = 'Cardiaque', price = '~g~Free', regin = nil},
{name = 'Bourgeoix', price = '~g~Free', regin = nil},
{name = 'Cherenkov', price = '~g~Free', regin = nil},
{name = 'Vodka', price = '~g~Free', regin = nil},
{name = 'Bleuter\'d', price = '~g~Free', regin = nil},
}
},
{
menu = nil,
name = 'Cigarets',
Items = {
{name = 'Redwood', price = '~g~Free', regin = nil},
{name = 'Debonaire', price = '~g~Free', regin = nil},
{name = 'Cardiaque', price = '~g~Free', regin = nil},
{name = 'GR&NG', price = '~g~Free', regin = nil},
}
},
{
menu = nil,
name = 'Snacks',
Items = {
{name = 'Ego Chaser', price = '~g~Free', regin = nil},
{name = 'Sweet Nothings', price = '~g~Free', regin = nil},
{name = 'Captain\'s Log', price = '~g~Free', regin = nil},
{name = 'Zebrabar', price = '~g~Free', regin = nil},
{name = 'EarthQuakes', price = '~g~Free', regin = nil},
{name = 'P\'s & Q\'s', price = '~g~Free', regin = nil},
{name = 'Meteorite', price = '~g~Free', regin = nil},
{name = 'Phat Chips', price = '~g~Free', regin = nil},
}
}
},
Locations = {
{x = 1393.58, y = 3604.81, z = 33.98}
},
Colors = {R = 61, G = 255, B = 197}
}
------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------FUNCTIONS----------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------
function ShowNotification(message)
SetNotificationTextEntry('STRING')
AddTextComponentString(message)
DrawNotification(true, false)
end
function Alert(message)
SetTextComponentFormat('STRING')
AddTextComponentString(message)
EndTextCommandDisplayHelp(0, 0, 1, -1)
end
function drawMarker(x, y, z, red, green, blue) --DrawMarker wrapper
DrawMarker(1, x, y, z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.25, red, green, blue, 100, false, true, 2, false, nil, nil, false)
end
function SubMenuAdd(menuPool, menu, Company)
for i, m in ipairs(Company['Menus']) do
Company.Menus[i].menu = menuPool:AddSubMenu(menu, Company.Menus[i].name, '', 'shopui_title_gasstation', 'shopui_title_gasstation')
for k, t in ipairs(Company.Menus[i].Items) do
local _Item = NativeUI.CreateItem(Company.Menus[i].Items[k].name, 'Price: ' .. Company.Menus[i].Items[k].price)
Company.Menus[i].menu.SubMenu:AddItem(_Item)
_Item.Activated = function(sender, item)
if item == _Item then
ShowNotification('+1 ' .. Company.Menus[i].Items[k].name)
-- add to database // inventory
end
end
end
end
end
----------------------------------------------------------------------------------------------------
-------------------------------------------Marker Handler-------------------------------------------
----------------------------------------------------------------------------------------------------
function MarkerHandler(Menu, Company)
for k, v in ipairs(Company['Locations']) do
drawMarker(Company.Locations[k].x, Company.Locations[k].y, Company.Locations[k].z, Company.Colors.R, Company.Colors.G, Company.Colors.B)
mycoords = GetEntityCoords(PlayerPedId(), true)
if GetDistanceBetweenCoords(Company.Locations[k].x, Company.Locations[k].y, Company.Locations[k].z, mycoords.x, mycoords.y, mycoords.z, true) < 1.5 then
Alert('Press ~INPUT_TALK~ to access ' .. Company.name .. '.')
if IsControlJustPressed(1, 51) then -- E
Menu:Visible(not Menu:Visible())
end
end
end
end
----------------------------------------------------------------------------------------------------
---------------------------------------------MENUS SHIT---------------------------------------------
----------------------------------------------------------------------------------------------------
SubMenuAdd(_mainPool, LTDMenu, LTD)
SubMenuAdd(_mainPool, TFSMenu, TFS)
SubMenuAdd(_mainPool, RLMenu, RL)
SubMenuAdd(_mainPool, YJMenu, YJ)
SubMenuAdd(_mainPool, ALMenu, AL)
SubMenuAdd(_mainPool, BSMenu, BS)
_mainPool:RefreshIndex()
----------------------------------------------------------------------------------------------------
-------------------------------------------Markers Maker--------------------------------------------
----------------------------------------------------------------------------------------------------
Citizen.CreateThread( function()
while true do
Citizen.Wait(0)
_mainPool:ProcessMenus()
MarkerHandler(LTDMenu, LTD)
MarkerHandler(TFSMenu, TFS)
MarkerHandler(RLMenu, RL)
MarkerHandler(YJMenu, YJ)
MarkerHandler(ALMenu, AL)
MarkerHandler(BSMenu, BS)
end
end) |
local ____modules = {}
local ____moduleCache = {}
local ____originalRequire = require
local function require(file)
if ____moduleCache[file] then
return ____moduleCache[file]
end
if ____modules[file] then
____moduleCache[file] = ____modules[file]()
return ____moduleCache[file]
else
if ____originalRequire then
return ____originalRequire(file)
else
error("module '" .. file .. "' not found")
end
end
end
____modules = {
["lualib_bundle"] = function() function __TS__ArrayIsArray(value)
return (type(value) == "table") and ((value[1] ~= nil) or (next(value, nil) == nil))
end
function __TS__ArrayConcat(arr1, ...)
local args = {...}
local out = {}
for ____, val in ipairs(arr1) do
out[#out + 1] = val
end
for ____, arg in ipairs(args) do
if __TS__ArrayIsArray(arg) then
local argAsArray = arg
for ____, val in ipairs(argAsArray) do
out[#out + 1] = val
end
else
out[#out + 1] = arg
end
end
return out
end
function __TS__ArrayEvery(arr, callbackfn)
do
local i = 0
while i < #arr do
if not callbackfn(_G, arr[i + 1], i, arr) then
return false
end
i = i + 1
end
end
return true
end
function __TS__ArrayFilter(arr, callbackfn)
local result = {}
do
local i = 0
while i < #arr do
if callbackfn(_G, arr[i + 1], i, arr) then
result[#result + 1] = arr[i + 1]
end
i = i + 1
end
end
return result
end
function __TS__ArrayForEach(arr, callbackFn)
do
local i = 0
while i < #arr do
callbackFn(_G, arr[i + 1], i, arr)
i = i + 1
end
end
end
function __TS__ArrayFind(arr, predicate)
local len = #arr
local k = 0
while k < len do
local elem = arr[k + 1]
if predicate(_G, elem, k, arr) then
return elem
end
k = k + 1
end
return nil
end
function __TS__ArrayFindIndex(arr, callbackFn)
do
local i = 0
local len = #arr
while i < len do
if callbackFn(_G, arr[i + 1], i, arr) then
return i
end
i = i + 1
end
end
return -1
end
function __TS__ArrayIncludes(self, searchElement, fromIndex)
if fromIndex == nil then
fromIndex = 0
end
local len = #self
local k = fromIndex
if fromIndex < 0 then
k = len + fromIndex
end
if k < 0 then
k = 0
end
for i = k, len do
if self[i + 1] == searchElement then
return true
end
end
return false
end
function __TS__ArrayIndexOf(arr, searchElement, fromIndex)
local len = #arr
if len == 0 then
return -1
end
local n = 0
if fromIndex then
n = fromIndex
end
if n >= len then
return -1
end
local k
if n >= 0 then
k = n
else
k = len + n
if k < 0 then
k = 0
end
end
do
local i = k
while i < len do
if arr[i + 1] == searchElement then
return i
end
i = i + 1
end
end
return -1
end
function __TS__ArrayJoin(self, separator)
if separator == nil then
separator = ","
end
local result = ""
for index, value in ipairs(self) do
if index > 1 then
result = tostring(result) .. tostring(separator)
end
result = tostring(result) .. tostring(
tostring(value)
)
end
return result
end
function __TS__ArrayMap(arr, callbackfn)
local newArray = {}
do
local i = 0
while i < #arr do
newArray[i + 1] = callbackfn(_G, arr[i + 1], i, arr)
i = i + 1
end
end
return newArray
end
function __TS__ArrayPush(arr, ...)
local items = {...}
for ____, item in ipairs(items) do
arr[#arr + 1] = item
end
return #arr
end
function __TS__ArrayReduce(arr, callbackFn, ...)
local len = #arr
local k = 0
local accumulator = nil
if select("#", ...) ~= 0 then
accumulator = select(1, ...)
elseif len > 0 then
accumulator = arr[1]
k = 1
else
error("Reduce of empty array with no initial value", 0)
end
for i = k, len - 1 do
accumulator = callbackFn(_G, accumulator, arr[i + 1], i, arr)
end
return accumulator
end
function __TS__ArrayReduceRight(arr, callbackFn, ...)
local len = #arr
local k = len - 1
local accumulator = nil
if select("#", ...) ~= 0 then
accumulator = select(1, ...)
elseif len > 0 then
accumulator = arr[k + 1]
k = k - 1
else
error("Reduce of empty array with no initial value", 0)
end
for i = k, 0, -1 do
accumulator = callbackFn(_G, accumulator, arr[i + 1], i, arr)
end
return accumulator
end
function __TS__ArrayReverse(arr)
local i = 0
local j = #arr - 1
while i < j do
local temp = arr[j + 1]
arr[j + 1] = arr[i + 1]
arr[i + 1] = temp
i = i + 1
j = j - 1
end
return arr
end
function __TS__ArrayShift(arr)
return table.remove(arr, 1)
end
function __TS__ArrayUnshift(arr, ...)
local items = {...}
do
local i = #items - 1
while i >= 0 do
table.insert(arr, 1, items[i + 1])
i = i - 1
end
end
return #arr
end
function __TS__ArraySort(arr, compareFn)
if compareFn ~= nil then
table.sort(
arr,
function(a, b) return compareFn(_G, a, b) < 0 end
)
else
table.sort(arr)
end
return arr
end
function __TS__ArraySlice(list, first, last)
local len = #list
local relativeStart = first or 0
local k
if relativeStart < 0 then
k = math.max(len + relativeStart, 0)
else
k = math.min(relativeStart, len)
end
local relativeEnd = last
if last == nil then
relativeEnd = len
end
local final
if relativeEnd < 0 then
final = math.max(len + relativeEnd, 0)
else
final = math.min(relativeEnd, len)
end
local out = {}
local n = 0
while k < final do
out[n + 1] = list[k + 1]
k = k + 1
n = n + 1
end
return out
end
function __TS__ArraySome(arr, callbackfn)
do
local i = 0
while i < #arr do
if callbackfn(_G, arr[i + 1], i, arr) then
return true
end
i = i + 1
end
end
return false
end
function __TS__ArraySplice(list, ...)
local len = #list
local actualArgumentCount = select("#", ...)
local start = select(1, ...)
local deleteCount = select(2, ...)
local actualStart
if start < 0 then
actualStart = math.max(len + start, 0)
else
actualStart = math.min(start, len)
end
local itemCount = math.max(actualArgumentCount - 2, 0)
local actualDeleteCount
if actualArgumentCount == 0 then
actualDeleteCount = 0
elseif actualArgumentCount == 1 then
actualDeleteCount = len - actualStart
else
actualDeleteCount = math.min(
math.max(deleteCount or 0, 0),
len - actualStart
)
end
local out = {}
do
local k = 0
while k < actualDeleteCount do
local from = actualStart + k
if list[from + 1] then
out[k + 1] = list[from + 1]
end
k = k + 1
end
end
if itemCount < actualDeleteCount then
do
local k = actualStart
while k < (len - actualDeleteCount) do
local from = k + actualDeleteCount
local to = k + itemCount
if list[from + 1] then
list[to + 1] = list[from + 1]
else
list[to + 1] = nil
end
k = k + 1
end
end
do
local k = len
while k > ((len - actualDeleteCount) + itemCount) do
list[k] = nil
k = k - 1
end
end
elseif itemCount > actualDeleteCount then
do
local k = len - actualDeleteCount
while k > actualStart do
local from = (k + actualDeleteCount) - 1
local to = (k + itemCount) - 1
if list[from + 1] then
list[to + 1] = list[from + 1]
else
list[to + 1] = nil
end
k = k - 1
end
end
end
local j = actualStart
for i = 3, actualArgumentCount do
list[j + 1] = select(i, ...)
j = j + 1
end
do
local k = #list - 1
while k >= ((len - actualDeleteCount) + itemCount) do
list[k + 1] = nil
k = k - 1
end
end
return out
end
function __TS__ArrayToObject(array)
local object = {}
do
local i = 0
while i < #array do
object[i] = array[i + 1]
i = i + 1
end
end
return object
end
function __TS__ArrayFlat(array, depth)
if depth == nil then
depth = 1
end
local result = {}
for ____, value in ipairs(array) do
if (depth > 0) and __TS__ArrayIsArray(value) then
result = __TS__ArrayConcat(
result,
__TS__ArrayFlat(value, depth - 1)
)
else
result[#result + 1] = value
end
end
return result
end
function __TS__ArrayFlatMap(array, callback)
local result = {}
do
local i = 0
while i < #array do
local value = callback(_G, array[i + 1], i, array)
if (type(value) == "table") and __TS__ArrayIsArray(value) then
result = __TS__ArrayConcat(result, value)
else
result[#result + 1] = value
end
i = i + 1
end
end
return result
end
function __TS__ArraySetLength(arr, length)
if (((length < 0) or (length ~= length)) or (length == math.huge)) or (math.floor(length) ~= length) then
error(
"invalid array length: " .. tostring(length),
0
)
end
do
local i = #arr - 1
while i >= length do
arr[i + 1] = nil
i = i - 1
end
end
return length
end
function __TS__Class(self)
local c = {prototype = {}}
c.prototype.__index = c.prototype
c.prototype.constructor = c
return c
end
function __TS__ClassExtends(target, base)
target.____super = base
local staticMetatable = setmetatable({__index = base}, base)
setmetatable(target, staticMetatable)
local baseMetatable = getmetatable(base)
if baseMetatable then
if type(baseMetatable.__index) == "function" then
staticMetatable.__index = baseMetatable.__index
end
if type(baseMetatable.__newindex) == "function" then
staticMetatable.__newindex = baseMetatable.__newindex
end
end
setmetatable(target.prototype, base.prototype)
if type(base.prototype.__index) == "function" then
target.prototype.__index = base.prototype.__index
end
if type(base.prototype.__newindex) == "function" then
target.prototype.__newindex = base.prototype.__newindex
end
if type(base.prototype.__tostring) == "function" then
target.prototype.__tostring = base.prototype.__tostring
end
end
function __TS__CloneDescriptor(____bindingPattern0)
local enumerable
enumerable = ____bindingPattern0.enumerable
local configurable
configurable = ____bindingPattern0.configurable
local get
get = ____bindingPattern0.get
local set
set = ____bindingPattern0.set
local writable
writable = ____bindingPattern0.writable
local value
value = ____bindingPattern0.value
local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
local hasGetterOrSetter = (get ~= nil) or (set ~= nil)
local hasValueOrWritableAttribute = (writable ~= nil) or (value ~= nil)
if hasGetterOrSetter and hasValueOrWritableAttribute then
error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
end
if get or set then
descriptor.get = get
descriptor.set = set
else
descriptor.value = value
descriptor.writable = writable == true
end
return descriptor
end
function __TS__Decorate(decorators, target, key, desc)
local result = target
do
local i = #decorators
while i >= 0 do
local decorator = decorators[i + 1]
if decorator then
local oldResult = result
if key == nil then
result = decorator(_G, result)
elseif desc == true then
local value = rawget(target, key)
local descriptor = __TS__ObjectGetOwnPropertyDescriptor(target, key) or ({configurable = true, writable = true, value = value})
local desc = decorator(_G, target, key, descriptor) or descriptor
local isSimpleValue = (((desc.configurable == true) and (desc.writable == true)) and (not desc.get)) and (not desc.set)
if isSimpleValue then
rawset(target, key, desc.value)
else
__TS__SetDescriptor(
target,
key,
__TS__ObjectAssign({}, descriptor, desc)
)
end
elseif desc == false then
result = decorator(_G, target, key, desc)
else
result = decorator(_G, target, key)
end
result = result or oldResult
end
i = i - 1
end
end
return result
end
function __TS__DecorateParam(paramIndex, decorator)
return function(____, target, key) return decorator(_G, target, key, paramIndex) end
end
function __TS__ObjectGetOwnPropertyDescriptors(object)
local metatable = getmetatable(object)
if not metatable then
return {}
end
return rawget(metatable, "_descriptors") or ({})
end
function __TS__Delete(target, key)
local descriptors = __TS__ObjectGetOwnPropertyDescriptors(target)
local descriptor = descriptors[key]
if descriptor then
if not descriptor.configurable then
error(
((("Cannot delete property " .. tostring(key)) .. " of ") .. tostring(target)) .. ".",
0
)
end
descriptors[key] = nil
return true
end
if target[key] ~= nil then
target[key] = nil
return true
end
return false
end
function __TS__DelegatedYield(iterable)
if type(iterable) == "string" then
for index = 0, #iterable - 1 do
coroutine.yield(
__TS__StringAccess(iterable, index)
)
end
elseif iterable.____coroutine ~= nil then
local co = iterable.____coroutine
while true do
local status, value = coroutine.resume(co)
if not status then
error(value, 0)
end
if coroutine.status(co) == "dead" then
return value
else
coroutine.yield(value)
end
end
elseif iterable[Symbol.iterator] then
local iterator = iterable[Symbol.iterator](iterable)
while true do
local result = iterator:next()
if result.done then
return result.value
else
coroutine.yield(result.value)
end
end
else
for ____, value in ipairs(iterable) do
coroutine.yield(value)
end
end
end
function __TS__New(target, ...)
local instance = setmetatable({}, target.prototype)
instance:____constructor(...)
return instance
end
function __TS__GetErrorStack(self, constructor)
local level = 1
while true do
local info = debug.getinfo(level, "f")
level = level + 1
if not info then
level = 1
break
elseif info.func == constructor then
break
end
end
return debug.traceback(nil, level)
end
function __TS__WrapErrorToString(self, getDescription)
return function(self)
local description = getDescription(self)
local caller = debug.getinfo(3, "f")
if (_VERSION == "Lua 5.1") or (caller and (caller.func ~= error)) then
return description
else
return (tostring(description) .. "\n") .. self.stack
end
end
end
function __TS__InitErrorClass(self, Type, name)
Type.name = name
return setmetatable(
Type,
{
__call = function(____, _self, message) return __TS__New(Type, message) end
}
)
end
Error = __TS__InitErrorClass(
_G,
(function()
local ____ = __TS__Class()
____.name = ""
function ____.prototype.____constructor(self, message)
if message == nil then
message = ""
end
self.message = message
self.name = "Error"
self.stack = __TS__GetErrorStack(_G, self.constructor.new)
local metatable = getmetatable(self)
if not metatable.__errorToStringPatched then
metatable.__errorToStringPatched = true
metatable.__tostring = __TS__WrapErrorToString(_G, metatable.__tostring)
end
end
function ____.prototype.__tostring(self)
return (((self.message ~= "") and (function() return (self.name .. ": ") .. self.message end)) or (function() return self.name end))()
end
return ____
end)(),
"Error"
)
for ____, errorName in ipairs({"RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError"}) do
_G[errorName] = __TS__InitErrorClass(
_G,
(function()
local ____ = __TS__Class()
____.name = ____.name
__TS__ClassExtends(____, Error)
function ____.prototype.____constructor(self, ...)
Error.prototype.____constructor(self, ...)
self.name = errorName
end
return ____
end)(),
errorName
)
end
__TS__Unpack = table.unpack or unpack
function __TS__FunctionBind(fn, thisArg, ...)
local boundArgs = {...}
return function(____, ...)
local args = {...}
do
local i = 0
while i < #boundArgs do
table.insert(args, i + 1, boundArgs[i + 1])
i = i + 1
end
end
return fn(
thisArg,
__TS__Unpack(args)
)
end
end
____symbolMetatable = {
__tostring = function(self)
return ("Symbol(" .. (self.description or "")) .. ")"
end
}
function __TS__Symbol(description)
return setmetatable({description = description}, ____symbolMetatable)
end
Symbol = {
iterator = __TS__Symbol("Symbol.iterator"),
hasInstance = __TS__Symbol("Symbol.hasInstance"),
species = __TS__Symbol("Symbol.species"),
toStringTag = __TS__Symbol("Symbol.toStringTag")
}
function __TS__GeneratorIterator(self)
return self
end
function __TS__GeneratorNext(self, ...)
local co = self.____coroutine
if coroutine.status(co) == "dead" then
return {done = true}
end
local status, value = coroutine.resume(co, ...)
if not status then
error(value, 0)
end
return {
value = value,
done = coroutine.status(co) == "dead"
}
end
function __TS__Generator(fn)
return function(...)
local args = {...}
local argsLength = select("#", ...)
return {
____coroutine = coroutine.create(
function() return fn(
(unpack or table.unpack)(args, 1, argsLength)
) end
),
[Symbol.iterator] = __TS__GeneratorIterator,
next = __TS__GeneratorNext
}
end
end
function __TS__InstanceOf(obj, classTbl)
if type(classTbl) ~= "table" then
error("Right-hand side of 'instanceof' is not an object", 0)
end
if classTbl[Symbol.hasInstance] ~= nil then
return not (not classTbl[Symbol.hasInstance](classTbl, obj))
end
if type(obj) == "table" then
local luaClass = obj.constructor
while luaClass ~= nil do
if luaClass == classTbl then
return true
end
luaClass = luaClass.____super
end
end
return false
end
function __TS__InstanceOfObject(value)
local valueType = type(value)
return (valueType == "table") or (valueType == "function")
end
function __TS__IteratorGeneratorStep(self)
local co = self.____coroutine
local status, value = coroutine.resume(co)
if not status then
error(value, 0)
end
if coroutine.status(co) == "dead" then
return
end
return true, value
end
function __TS__IteratorIteratorStep(self)
local result = self:next()
if result.done then
return
end
return true, result.value
end
function __TS__IteratorStringStep(self, index)
index = index + 1
if index > #self then
return
end
return index, string.sub(self, index, index)
end
function __TS__Iterator(iterable)
if type(iterable) == "string" then
return __TS__IteratorStringStep, iterable, 0
elseif iterable.____coroutine ~= nil then
return __TS__IteratorGeneratorStep, iterable
elseif iterable[Symbol.iterator] then
local iterator = iterable[Symbol.iterator](iterable)
return __TS__IteratorIteratorStep, iterator
else
return __TS__Unpack(
{
ipairs(iterable)
}
)
end
end
Map = (function()
local Map = __TS__Class()
Map.name = "Map"
function Map.prototype.____constructor(self, entries)
self[Symbol.toStringTag] = "Map"
self.items = {}
self.size = 0
self.nextKey = {}
self.previousKey = {}
if entries == nil then
return
end
local iterable = entries
if iterable[Symbol.iterator] then
local iterator = iterable[Symbol.iterator](iterable)
while true do
local result = iterator:next()
if result.done then
break
end
local value = result.value
self:set(value[1], value[2])
end
else
local array = entries
for ____, kvp in ipairs(array) do
self:set(kvp[1], kvp[2])
end
end
end
function Map.prototype.clear(self)
self.items = {}
self.nextKey = {}
self.previousKey = {}
self.firstKey = nil
self.lastKey = nil
self.size = 0
end
function Map.prototype.delete(self, key)
local contains = self:has(key)
if contains then
self.size = self.size - 1
local next = self.nextKey[key]
local previous = self.previousKey[key]
if next and previous then
self.nextKey[previous] = next
self.previousKey[next] = previous
elseif next then
self.firstKey = next
self.previousKey[next] = nil
elseif previous then
self.lastKey = previous
self.nextKey[previous] = nil
else
self.firstKey = nil
self.lastKey = nil
end
self.nextKey[key] = nil
self.previousKey[key] = nil
end
self.items[key] = nil
return contains
end
function Map.prototype.forEach(self, callback)
for ____, key in __TS__Iterator(
self:keys()
) do
callback(_G, self.items[key], key, self)
end
end
function Map.prototype.get(self, key)
return self.items[key]
end
function Map.prototype.has(self, key)
return (self.nextKey[key] ~= nil) or (self.lastKey == key)
end
function Map.prototype.set(self, key, value)
local isNewValue = not self:has(key)
if isNewValue then
self.size = self.size + 1
end
self.items[key] = value
if self.firstKey == nil then
self.firstKey = key
self.lastKey = key
elseif isNewValue then
self.nextKey[self.lastKey] = key
self.previousKey[key] = self.lastKey
self.lastKey = key
end
return self
end
Map.prototype[Symbol.iterator] = function(self)
return self:entries()
end
function Map.prototype.entries(self)
local ____ = self
local items = ____.items
local nextKey = ____.nextKey
local key = self.firstKey
return {
[Symbol.iterator] = function(self)
return self
end,
next = function(self)
local result = {done = not key, value = {key, items[key]}}
key = nextKey[key]
return result
end
}
end
function Map.prototype.keys(self)
local nextKey = self.nextKey
local key = self.firstKey
return {
[Symbol.iterator] = function(self)
return self
end,
next = function(self)
local result = {done = not key, value = key}
key = nextKey[key]
return result
end
}
end
function Map.prototype.values(self)
local ____ = self
local items = ____.items
local nextKey = ____.nextKey
local key = self.firstKey
return {
[Symbol.iterator] = function(self)
return self
end,
next = function(self)
local result = {done = not key, value = items[key]}
key = nextKey[key]
return result
end
}
end
Map[Symbol.species] = Map
return Map
end)()
__TS__MathAtan2 = math.atan2 or math.atan
function __TS__Number(value)
local valueType = type(value)
if valueType == "number" then
return value
elseif valueType == "string" then
local numberValue = tonumber(value)
if numberValue then
return numberValue
end
if value == "Infinity" then
return math.huge
end
if value == "-Infinity" then
return -math.huge
end
local stringWithoutSpaces = string.gsub(value, "%s", "")
if stringWithoutSpaces == "" then
return 0
end
return 0 / 0
elseif valueType == "boolean" then
return (value and 1) or 0
else
return 0 / 0
end
end
function __TS__NumberIsFinite(value)
return (((type(value) == "number") and (value == value)) and (value ~= math.huge)) and (value ~= -math.huge)
end
function __TS__NumberIsNaN(value)
return value ~= value
end
____radixChars = "0123456789abcdefghijklmnopqrstuvwxyz"
function __TS__NumberToString(self, radix)
if ((((radix == nil) or (radix == 10)) or (self == math.huge)) or (self == -math.huge)) or (self ~= self) then
return tostring(self)
end
radix = math.floor(radix)
if (radix < 2) or (radix > 36) then
error("toString() radix argument must be between 2 and 36", 0)
end
local integer, fraction = math.modf(
math.abs(self)
)
local result = ""
if radix == 8 then
result = string.format("%o", integer)
elseif radix == 16 then
result = string.format("%x", integer)
else
repeat
do
result = tostring(
__TS__StringAccess(____radixChars, integer % radix)
) .. tostring(result)
integer = math.floor(integer / radix)
end
until not (integer ~= 0)
end
if fraction ~= 0 then
result = tostring(result) .. "."
local delta = 1e-16
repeat
do
fraction = fraction * radix
delta = delta * radix
local digit = math.floor(fraction)
result = tostring(result) .. tostring(
__TS__StringAccess(____radixChars, digit)
)
fraction = fraction - digit
end
until not (fraction >= delta)
end
if self < 0 then
result = "-" .. tostring(result)
end
return result
end
function __TS__ObjectAssign(to, ...)
local sources = {...}
if to == nil then
return to
end
for ____, source in ipairs(sources) do
for key in pairs(source) do
to[key] = source[key]
end
end
return to
end
function ____descriptorIndex(self, key)
local value = rawget(self, key)
if value ~= nil then
return value
end
local metatable = getmetatable(self)
while metatable do
local rawResult = rawget(metatable, key)
if rawResult ~= nil then
return rawResult
end
local descriptors = rawget(metatable, "_descriptors")
if descriptors then
local descriptor = descriptors[key]
if descriptor then
if descriptor.get then
return descriptor.get(self)
end
return descriptor.value
end
end
metatable = getmetatable(metatable)
end
end
function ____descriptorNewindex(self, key, value)
local metatable = getmetatable(self)
while metatable do
local descriptors = rawget(metatable, "_descriptors")
if descriptors then
local descriptor = descriptors[key]
if descriptor then
if descriptor.set then
descriptor.set(self, value)
else
if descriptor.writable == false then
error(
((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
0
)
end
descriptor.value = value
end
return
end
end
metatable = getmetatable(metatable)
end
rawset(self, key, value)
end
function __TS__SetDescriptor(target, key, desc, isPrototype)
if isPrototype == nil then
isPrototype = false
end
local metatable = ((isPrototype and (function() return target end)) or (function() return getmetatable(target) end))()
if not metatable then
metatable = {}
setmetatable(target, metatable)
end
local value = rawget(target, key)
if value ~= nil then
rawset(target, key, nil)
end
if not rawget(metatable, "_descriptors") then
metatable._descriptors = {}
end
local descriptor = __TS__CloneDescriptor(desc)
metatable._descriptors[key] = descriptor
metatable.__index = ____descriptorIndex
metatable.__newindex = ____descriptorNewindex
end
function __TS__ObjectDefineProperty(target, key, desc)
local luaKey = (((type(key) == "number") and (function() return key + 1 end)) or (function() return key end))()
local value = rawget(target, luaKey)
local hasGetterOrSetter = (desc.get ~= nil) or (desc.set ~= nil)
local descriptor
if hasGetterOrSetter then
if value ~= nil then
error(
"Cannot redefine property: " .. tostring(key),
0
)
end
descriptor = desc
else
local valueExists = value ~= nil
descriptor = {
set = desc.set,
get = desc.get,
configurable = (((desc.configurable ~= nil) and (function() return desc.configurable end)) or (function() return valueExists end))(),
enumerable = (((desc.enumerable ~= nil) and (function() return desc.enumerable end)) or (function() return valueExists end))(),
writable = (((desc.writable ~= nil) and (function() return desc.writable end)) or (function() return valueExists end))(),
value = (((desc.value ~= nil) and (function() return desc.value end)) or (function() return value end))()
}
end
__TS__SetDescriptor(target, luaKey, descriptor)
return target
end
function __TS__ObjectEntries(obj)
local result = {}
for key in pairs(obj) do
result[#result + 1] = {key, obj[key]}
end
return result
end
function __TS__ObjectFromEntries(entries)
local obj = {}
local iterable = entries
if iterable[Symbol.iterator] then
local iterator = iterable[Symbol.iterator](iterable)
while true do
local result = iterator:next()
if result.done then
break
end
local value = result.value
obj[value[1]] = value[2]
end
else
for ____, entry in ipairs(entries) do
obj[entry[1]] = entry[2]
end
end
return obj
end
function __TS__ObjectGetOwnPropertyDescriptor(object, key)
local metatable = getmetatable(object)
if not metatable then
return
end
if not rawget(metatable, "_descriptors") then
return
end
return rawget(metatable, "_descriptors")[key]
end
function __TS__ObjectKeys(obj)
local result = {}
for key in pairs(obj) do
result[#result + 1] = key
end
return result
end
function __TS__ObjectRest(target, usedProperties)
local result = {}
for property in pairs(target) do
if not usedProperties[property] then
result[property] = target[property]
end
end
return result
end
function __TS__ObjectValues(obj)
local result = {}
for key in pairs(obj) do
result[#result + 1] = obj[key]
end
return result
end
function __TS__ParseFloat(numberString)
local infinityMatch = string.match(numberString, "^%s*(-?Infinity)")
if infinityMatch then
return (((__TS__StringAccess(infinityMatch, 0) == "-") and (function() return -math.huge end)) or (function() return math.huge end))()
end
local number = tonumber(
string.match(numberString, "^%s*(-?%d+%.?%d*)")
)
return number or (0 / 0)
end
__TS__parseInt_base_pattern = "0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTvVwWxXyYzZ"
function __TS__ParseInt(numberString, base)
if base == nil then
base = 10
local hexMatch = string.match(numberString, "^%s*-?0[xX]")
if hexMatch then
base = 16
numberString = ((string.match(hexMatch, "-") and (function() return "-" .. tostring(
__TS__StringSubstr(numberString, #hexMatch)
) end)) or (function() return __TS__StringSubstr(numberString, #hexMatch) end))()
end
end
if (base < 2) or (base > 36) then
return 0 / 0
end
local allowedDigits = (((base <= 10) and (function() return __TS__StringSubstring(__TS__parseInt_base_pattern, 0, base) end)) or (function() return __TS__StringSubstr(__TS__parseInt_base_pattern, 0, 10 + (2 * (base - 10))) end))()
local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
local number = tonumber(
string.match(numberString, pattern),
base
)
if number == nil then
return 0 / 0
end
if number >= 0 then
return math.floor(number)
else
return math.ceil(number)
end
end
Set = (function()
local Set = __TS__Class()
Set.name = "Set"
function Set.prototype.____constructor(self, values)
self[Symbol.toStringTag] = "Set"
self.size = 0
self.nextKey = {}
self.previousKey = {}
if values == nil then
return
end
local iterable = values
if iterable[Symbol.iterator] then
local iterator = iterable[Symbol.iterator](iterable)
while true do
local result = iterator:next()
if result.done then
break
end
self:add(result.value)
end
else
local array = values
for ____, value in ipairs(array) do
self:add(value)
end
end
end
function Set.prototype.add(self, value)
local isNewValue = not self:has(value)
if isNewValue then
self.size = self.size + 1
end
if self.firstKey == nil then
self.firstKey = value
self.lastKey = value
elseif isNewValue then
self.nextKey[self.lastKey] = value
self.previousKey[value] = self.lastKey
self.lastKey = value
end
return self
end
function Set.prototype.clear(self)
self.nextKey = {}
self.previousKey = {}
self.firstKey = nil
self.lastKey = nil
self.size = 0
end
function Set.prototype.delete(self, value)
local contains = self:has(value)
if contains then
self.size = self.size - 1
local next = self.nextKey[value]
local previous = self.previousKey[value]
if next and previous then
self.nextKey[previous] = next
self.previousKey[next] = previous
elseif next then
self.firstKey = next
self.previousKey[next] = nil
elseif previous then
self.lastKey = previous
self.nextKey[previous] = nil
else
self.firstKey = nil
self.lastKey = nil
end
self.nextKey[value] = nil
self.previousKey[value] = nil
end
return contains
end
function Set.prototype.forEach(self, callback)
for ____, key in __TS__Iterator(
self:keys()
) do
callback(_G, key, key, self)
end
end
function Set.prototype.has(self, value)
return (self.nextKey[value] ~= nil) or (self.lastKey == value)
end
Set.prototype[Symbol.iterator] = function(self)
return self:values()
end
function Set.prototype.entries(self)
local nextKey = self.nextKey
local key = self.firstKey
return {
[Symbol.iterator] = function(self)
return self
end,
next = function(self)
local result = {done = not key, value = {key, key}}
key = nextKey[key]
return result
end
}
end
function Set.prototype.keys(self)
local nextKey = self.nextKey
local key = self.firstKey
return {
[Symbol.iterator] = function(self)
return self
end,
next = function(self)
local result = {done = not key, value = key}
key = nextKey[key]
return result
end
}
end
function Set.prototype.values(self)
local nextKey = self.nextKey
local key = self.firstKey
return {
[Symbol.iterator] = function(self)
return self
end,
next = function(self)
local result = {done = not key, value = key}
key = nextKey[key]
return result
end
}
end
Set[Symbol.species] = Set
return Set
end)()
WeakMap = (function()
local WeakMap = __TS__Class()
WeakMap.name = "WeakMap"
function WeakMap.prototype.____constructor(self, entries)
self[Symbol.toStringTag] = "WeakMap"
self.items = {}
setmetatable(self.items, {__mode = "k"})
if entries == nil then
return
end
local iterable = entries
if iterable[Symbol.iterator] then
local iterator = iterable[Symbol.iterator](iterable)
while true do
local result = iterator:next()
if result.done then
break
end
local value = result.value
self.items[value[1]] = value[2]
end
else
for ____, kvp in ipairs(entries) do
self.items[kvp[1]] = kvp[2]
end
end
end
function WeakMap.prototype.delete(self, key)
local contains = self:has(key)
self.items[key] = nil
return contains
end
function WeakMap.prototype.get(self, key)
return self.items[key]
end
function WeakMap.prototype.has(self, key)
return self.items[key] ~= nil
end
function WeakMap.prototype.set(self, key, value)
self.items[key] = value
return self
end
WeakMap[Symbol.species] = WeakMap
return WeakMap
end)()
WeakSet = (function()
local WeakSet = __TS__Class()
WeakSet.name = "WeakSet"
function WeakSet.prototype.____constructor(self, values)
self[Symbol.toStringTag] = "WeakSet"
self.items = {}
setmetatable(self.items, {__mode = "k"})
if values == nil then
return
end
local iterable = values
if iterable[Symbol.iterator] then
local iterator = iterable[Symbol.iterator](iterable)
while true do
local result = iterator:next()
if result.done then
break
end
self.items[result.value] = true
end
else
for ____, value in ipairs(values) do
self.items[value] = true
end
end
end
function WeakSet.prototype.add(self, value)
self.items[value] = true
return self
end
function WeakSet.prototype.delete(self, value)
local contains = self:has(value)
self.items[value] = nil
return contains
end
function WeakSet.prototype.has(self, value)
return self.items[value] == true
end
WeakSet[Symbol.species] = WeakSet
return WeakSet
end)()
function __TS__SourceMapTraceBack(fileName, sourceMap)
_G.__TS__sourcemap = _G.__TS__sourcemap or ({})
_G.__TS__sourcemap[fileName] = sourceMap
if _G.__TS__originalTraceback == nil then
_G.__TS__originalTraceback = debug.traceback
debug.traceback = function(thread, message, level)
local trace
if ((thread == nil) and (message == nil)) and (level == nil) then
trace = _G.__TS__originalTraceback()
else
trace = _G.__TS__originalTraceback(thread, message, level)
end
if type(trace) ~= "string" then
return trace
end
local result = string.gsub(
trace,
"(%S+).lua:(%d+)",
function(file, line)
local fileSourceMap = _G.__TS__sourcemap[tostring(file) .. ".lua"]
if fileSourceMap and fileSourceMap[line] then
return (file .. ".ts:") .. tostring(fileSourceMap[line])
end
return (file .. ".lua:") .. line
end
)
return result
end
end
end
function __TS__Spread(iterable)
local arr = {}
if type(iterable) == "string" then
do
local i = 0
while i < #iterable do
arr[#arr + 1] = __TS__StringAccess(iterable, i)
i = i + 1
end
end
else
for ____, item in __TS__Iterator(iterable) do
arr[#arr + 1] = item
end
end
return __TS__Unpack(arr)
end
function __TS__StringAccess(self, index)
if (index >= 0) and (index < #self) then
return string.sub(self, index + 1, index + 1)
end
end
function __TS__StringCharAt(self, pos)
if pos ~= pos then
pos = 0
end
if pos < 0 then
return ""
end
return string.sub(self, pos + 1, pos + 1)
end
function __TS__StringCharCodeAt(self, index)
if index ~= index then
index = 0
end
if index < 0 then
return 0 / 0
end
return string.byte(self, index + 1) or (0 / 0)
end
function __TS__StringConcat(str1, ...)
local args = {...}
local out = str1
for ____, arg in ipairs(args) do
out = tostring(out) .. tostring(arg)
end
return out
end
function __TS__StringEndsWith(self, searchString, endPosition)
if (endPosition == nil) or (endPosition > #self) then
endPosition = #self
end
return string.sub(self, (endPosition - #searchString) + 1, endPosition) == searchString
end
function __TS__StringIncludes(self, searchString, position)
if not position then
position = 1
else
position = position + 1
end
local index = string.find(self, searchString, position, true)
return index ~= nil
end
function __TS__StringPadEnd(self, maxLength, fillString)
if fillString == nil then
fillString = " "
end
if maxLength ~= maxLength then
maxLength = 0
end
if (maxLength == -math.huge) or (maxLength == math.huge) then
error("Invalid string length", 0)
end
if (#self >= maxLength) or (#fillString == 0) then
return self
end
maxLength = maxLength - #self
if maxLength > #fillString then
fillString = tostring(fillString) .. tostring(
string.rep(
fillString,
math.floor(maxLength / #fillString)
)
)
end
return tostring(self) .. tostring(
string.sub(
fillString,
1,
math.floor(maxLength)
)
)
end
function __TS__StringPadStart(self, maxLength, fillString)
if fillString == nil then
fillString = " "
end
if maxLength ~= maxLength then
maxLength = 0
end
if (maxLength == -math.huge) or (maxLength == math.huge) then
error("Invalid string length", 0)
end
if (#self >= maxLength) or (#fillString == 0) then
return self
end
maxLength = maxLength - #self
if maxLength > #fillString then
fillString = tostring(fillString) .. tostring(
string.rep(
fillString,
math.floor(maxLength / #fillString)
)
)
end
return tostring(
string.sub(
fillString,
1,
math.floor(maxLength)
)
) .. tostring(self)
end
function __TS__StringReplace(source, searchValue, replaceValue)
searchValue = string.gsub(searchValue, "[%%%(%)%.%+%-%*%?%[%^%$]", "%%%1")
if type(replaceValue) == "string" then
replaceValue = string.gsub(replaceValue, "%%", "%%%%")
local result = string.gsub(source, searchValue, replaceValue, 1)
return result
else
local result = string.gsub(
source,
searchValue,
function(match) return replaceValue(_G, match) end,
1
)
return result
end
end
function __TS__StringSlice(self, start, ____end)
if (start == nil) or (start ~= start) then
start = 0
end
if ____end ~= ____end then
____end = 0
end
if start >= 0 then
start = start + 1
end
if (____end ~= nil) and (____end < 0) then
____end = ____end - 1
end
return string.sub(self, start, ____end)
end
function __TS__StringSubstring(self, start, ____end)
if ____end ~= ____end then
____end = 0
end
if (____end ~= nil) and (start > ____end) then
start, ____end = __TS__Unpack({____end, start})
end
if start >= 0 then
start = start + 1
else
start = 1
end
if (____end ~= nil) and (____end < 0) then
____end = 0
end
return string.sub(self, start, ____end)
end
function __TS__StringSplit(source, separator, limit)
if limit == nil then
limit = 4294967295
end
if limit == 0 then
return {}
end
local out = {}
local index = 0
local count = 0
if (separator == nil) or (separator == "") then
while (index < (#source - 1)) and (count < limit) do
out[count + 1] = __TS__StringAccess(source, index)
count = count + 1
index = index + 1
end
else
local separatorLength = #separator
local nextIndex = (string.find(source, separator, nil, true) or 0) - 1
while (nextIndex >= 0) and (count < limit) do
out[count + 1] = __TS__StringSubstring(source, index, nextIndex)
count = count + 1
index = nextIndex + separatorLength
nextIndex = (string.find(
source,
separator,
math.max(index + 1, 1),
true
) or 0) - 1
end
end
if count < limit then
out[count + 1] = __TS__StringSubstring(source, index)
end
return out
end
function __TS__StringStartsWith(self, searchString, position)
if (position == nil) or (position < 0) then
position = 0
end
return string.sub(self, position + 1, #searchString + position) == searchString
end
function __TS__StringSubstr(self, from, length)
if from ~= from then
from = 0
end
if length ~= nil then
if (length ~= length) or (length <= 0) then
return ""
end
length = length + from
end
if from >= 0 then
from = from + 1
end
return string.sub(self, from, length)
end
function __TS__StringTrim(self)
local result = string.gsub(self, "^[%s ]*(.-)[%s ]*$", "%1")
return result
end
function __TS__StringTrimEnd(self)
local result = string.gsub(self, "[%s ]*$", "")
return result
end
function __TS__StringTrimStart(self)
local result = string.gsub(self, "^[%s ]*", "")
return result
end
____symbolRegistry = {}
function __TS__SymbolRegistryFor(key)
if not ____symbolRegistry[key] then
____symbolRegistry[key] = __TS__Symbol(key)
end
return ____symbolRegistry[key]
end
function __TS__SymbolRegistryKeyFor(sym)
for key in pairs(____symbolRegistry) do
if ____symbolRegistry[key] == sym then
return key
end
end
end
function __TS__TypeOf(value)
local luaType = type(value)
if luaType == "table" then
return "object"
elseif luaType == "nil" then
return "undefined"
else
return luaType
end
end
end,
["vec3"] = function() --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
require("lualib_bundle");
local ____exports = {}
____exports.Vec3 = __TS__Class()
local Vec3 = ____exports.Vec3
Vec3.name = "Vec3"
function Vec3.prototype.____constructor(self, x, y, z)
self.north = math.floor(x)
self.up = math.floor(y)
self.east = math.floor(z)
end
function Vec3.prototype.__tostring(self)
return (((tostring(self.north) .. ",") .. tostring(self.up)) .. ",") .. tostring(self.east)
end
function Vec3.prototype.plus(self, x, y, z)
return __TS__New(____exports.Vec3, self.north + x, self.up + y, self.east + z)
end
function ____exports.parse(self, position)
local north, up, east = unpack(
__TS__StringSplit(position, ",")
)
return __TS__New(
____exports.Vec3,
__TS__ParseInt(north),
__TS__ParseInt(up),
__TS__ParseInt(east)
)
end
____exports.DIRECTIONS_OFFSETS = {
north = __TS__New(____exports.Vec3, 1, 0, 0),
south = __TS__New(____exports.Vec3, -1, 0, 0),
east = __TS__New(____exports.Vec3, 0, 0, 1),
west = __TS__New(____exports.Vec3, 0, 0, -1),
up = __TS__New(____exports.Vec3, 0, 1, 0),
down = __TS__New(____exports.Vec3, 0, -1, 0)
}
____exports.directionsBack = {north = "south", south = "north", east = "west", west = "east", up = "down", down = "up"}
____exports.directionsRight = {north = "east", south = "west", east = "south", west = "north"}
____exports.directionsLeft = {north = "west", south = "east", east = "north", west = "south"}
function ____exports.spiral(self, size, around, ____until)
local x = 0
local z = 0
local dx = 0
local dz = -1
local results = {}
do
local i = 0
while i < (size ^ 2) do
local position = __TS__New(____exports.Vec3, around.north + x, 0, around.east + z)
if ____until and ____until(nil, position) then
return {position}
end
__TS__ArrayPush(results, position)
if ((x == z) or ((x < 0) and (x == -z))) or ((x > 0) and (x == (1 - z))) then
dx, dz = unpack({-dz, dx})
end
x, z = unpack({x + dx, z + dz})
i = i + 1
end
end
return results
end
function ____exports.positionBetween(self, position1, position2)
return __TS__New(____exports.Vec3, (position1.north + position2.north) / 2, (position1.up + position2.up) / 2, (position1.east + position2.east) / 2)
end
function ____exports.getDistanceTo(self, position, position2)
return (math.abs(position.north - position2.north) + math.abs(position.east - position2.east)) + math.abs(position.up - position2.up)
end
return ____exports
end,
["state"] = function() --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
require("lualib_bundle");
local ____exports = {}
local vec3 = require("vec3")
local function loadPosition(self)
local file = fs.open("position.txt", "r")
local data
print(file)
if file == nil then
return __TS__New(vec3.Vec3, 0, 0, 0)
else
data = file.readAll()
file.close()
return vec3:parse(data)
end
end
local function loadDirection(self)
local file = fs.open("direction.txt", "r")
if file == nil then
return "north"
else
local data = file.readAll()
file.close()
return data
end
end
____exports.currentPosition = loadPosition(nil)
function ____exports.savePosition(self, position)
____exports.currentPosition = position
local file = fs.open("position.txt", "w")
if file ~= nil then
file.write(
tostring(____exports.currentPosition)
)
file.close()
end
end
____exports.currentDirection = loadDirection(nil)
function ____exports.saveDirection(self, direction)
____exports.currentDirection = direction
local file, reason = fs.open("direction.txt", "w")
file.write(____exports.currentDirection)
file.close()
end
function ____exports.getPositionForDirection(self, dir)
local directionOffsets = vec3.DIRECTIONS_OFFSETS[dir]
return ____exports.currentPosition:plus(directionOffsets.north, directionOffsets.up, directionOffsets.east)
end
____exports.inventoryFull = false
function ____exports.updateInventoryFull(self)
____exports.inventoryFull = turtle.getItemCount(4 * 4) > 0
return ____exports.inventoryFull
end
____exports.headingToSpawn = false
function ____exports.setHeadingToSpawn(self, value)
____exports.headingToSpawn = value
end
return ____exports
end,
["world"] = function() --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
require("lualib_bundle");
local ____exports = {}
local vec3 = require("vec3")
local state = require("state")
local function loadWorld(self)
local file = fs.open("world.txt", "r")
local data
if file == nil then
return {}
else
data = file.readAll()
file.close()
return textutils.unserialize(data)
end
end
____exports.world = loadWorld(nil)
function ____exports.saveWorld(self)
local file = fs.open("world.txt", "w")
file.write(
textutils.serialize(____exports.world)
)
file.close()
end
____exports.ORES = {"minecraft:coal_ore", "minecraft:iron_ore", "minecraft:gold_ore", "minecraft:lapis_ore", "minecraft:diamond_ore", "minecraft:redstone_ore", "minecraft:emerald_ore"}
____exports.UNDERGROUND_MINEABLE = {"minecraft:stone", "minecraft:cobblestone", "minecraft:andesite", "minecraft:granite", "minecraft:diorite", "minecraft:obsidian", "minecraft:dirt", "crumbs:cobbled_andesite", "crumbs:cobbled_granite", "crumbs:cobbled_diorite", "wild_explorer:blunite", "wild_explorer:carbonite", "blockus:bluestone"}
function ____exports.setBlock(self, position, block)
____exports.world[tostring(position)] = block
end
function ____exports.getBlock(self, position)
return ____exports.world[tostring(position)]
end
____exports.setBlock(
nil,
__TS__New(vec3.Vec3, 0, 0, 0),
"minecraft:air"
)
function ____exports.isDirectionVisitedAir(self, dir)
local directionCoordinates = state:getPositionForDirection(dir)
if ____exports.getBlock(nil, directionCoordinates) then
return ____exports.getBlock(nil, directionCoordinates) == "minecraft:air"
else
return false
end
end
function ____exports.findNearestBlockPosition(self, blocks, height, center)
if center == nil then
center = state.currentPosition
end
local nearestOreDistance = 99999
local nearestOrePosition = nil
for ____, ____value in ipairs(
__TS__ObjectEntries(____exports.world)
) do
local blockPositionString
blockPositionString = ____value[1]
local block
block = ____value[2]
if __TS__ArrayIncludes(blocks, block) then
local blockPosition = vec3:parse(blockPositionString)
if ((height == nil) or (height == blockPosition.up)) and (blockPositionString ~= tostring(state.currentPosition)) then
local blockDistance = vec3:getDistanceTo(blockPosition, center)
if blockDistance < nearestOreDistance then
nearestOreDistance = blockDistance
nearestOrePosition = blockPosition
end
end
end
end
return nearestOrePosition
end
function ____exports.countUnknownBlocksAround(self, position, ____debug)
local count = 0
for ____, direction in ipairs(
__TS__ObjectValues(vec3.DIRECTIONS_OFFSETS)
) do
local checkPosition = position:plus(direction.north, direction.up, direction.east)
if ____exports.getBlock(nil, checkPosition) == nil then
if ____debug then
print(checkPosition, direction)
end
count = count + 1
end
end
return count
end
function ____exports.findNearestUnexplored(self)
local nearestUnexplored = vec3:spiral(
512,
__TS__New(vec3.Vec3, 0, 0, 0),
function(____, position)
local block = ____exports.getBlock(nil, position)
return (block == nil) and (((position.north ~= state.currentPosition.north) or (position.up ~= state.currentPosition.up)) or (position.east ~= state.currentPosition.east))
end
)
if #nearestUnexplored >= 1 then
return nearestUnexplored[1]
else
return nil
end
end
return ____exports
end,
["movement"] = function() --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
local ____exports = {}
local world = require("world")
local vec3 = require("vec3")
local state = require("state")
local suckInDirection
function ____exports.turnInDirection(self, dir)
local previousDirection = state.currentDirection
state:saveDirection(dir)
local success, reason = false, nil
if dir == previousDirection then
return
elseif dir == vec3.directionsBack[previousDirection] then
success, reason = turtle.turnRight()
turtle.turnRight()
elseif dir == vec3.directionsLeft[previousDirection] then
success, reason = turtle.turnLeft()
elseif dir == vec3.directionsRight[previousDirection] then
success, reason = turtle.turnRight()
else
state:saveDirection(previousDirection)
error(
("ERROR: unknown turn direction \"" .. tostring(dir)) .. "\"",
0
)
end
if not success then
state:saveDirection(previousDirection)
error(
"Error turning: " .. tostring(reason),
0
)
end
end
function ____exports.inspectInDirection(self, dir)
local directionCoordinates = state:getPositionForDirection(dir)
if world:getBlock(directionCoordinates) then
return world:getBlock(directionCoordinates)
end
local inspectResponse = nil
if dir == "up" then
inspectResponse = {
turtle.inspectUp()
}
elseif dir == "down" then
inspectResponse = {
turtle.inspectDown()
}
else
____exports.turnInDirection(nil, dir)
inspectResponse = {
turtle.inspect()
}
end
local block
local success = inspectResponse[1]
if type(inspectResponse[2]) == "string" then
if inspectResponse[2] == "No block to inspect" then
block = {name = "minecraft:air"}
else
print("error inspecting", inspectResponse[2])
return
end
else
block = inspectResponse[2]
end
local blockName = ((success and (function() return block.name end)) or (function() return "minecraft:air" end))()
world:setBlock(directionCoordinates, blockName)
return block
end
function ____exports.scanAround(self, blocks)
local forward, left, right, back = state.currentDirection, vec3.directionsLeft[state.currentDirection], vec3.directionsRight[state.currentDirection], vec3.directionsBack[state.currentDirection]
____exports.inspectInDirection(nil, "up")
____exports.inspectInDirection(nil, "down")
____exports.inspectInDirection(nil, forward)
if world:getBlock(
state:getPositionForDirection(right)
) then
____exports.inspectInDirection(nil, left)
____exports.inspectInDirection(nil, back)
else
____exports.inspectInDirection(nil, right)
____exports.inspectInDirection(nil, back)
____exports.inspectInDirection(nil, left)
end
if blocks then
return world:findNearestBlockPosition(blocks)
else
return nil
end
end
function suckInDirection(self, dir)
local success
local reason
if dir == "up" then
success, reason = turtle.suckUp()
elseif dir == "down" then
success, reason = turtle.suckDown()
else
____exports.turnInDirection(nil, dir)
success, reason = turtle.suck()
end
state:updateInventoryFull()
end
function ____exports.refuelAll(self)
local couldRefuel = false
do
local i = 1
while i <= 16 do
turtle.select(i)
local r = turtle.refuel()
if r then
couldRefuel = true
end
i = i + 1
end
end
if couldRefuel then
print("Refueled turtle!")
else
print("Couldn't find any fuel :(")
end
turtle.select(1)
end
function ____exports.moveInDirection(self, dir)
local success
local reason
local previousPosition = state.currentPosition
local newPosition = state:getPositionForDirection(dir)
state:savePosition(newPosition)
if dir == "up" then
success, reason = turtle.up()
elseif dir == "down" then
success, reason = turtle.down()
else
____exports.turnInDirection(nil, dir)
success, reason = turtle.forward()
end
if success then
world:setBlock(newPosition, "minecraft:air")
____exports.inspectInDirection(nil, dir)
else
state:savePosition(previousPosition)
if reason == "Out of fuel" then
____exports.refuelAll(nil)
elseif reason == "Movement obstructed" then
____exports.scanAround(nil)
end
print(
"Error moving: " .. tostring(reason)
)
end
end
function ____exports.digInDirection(self, dir)
local success
local reason
if dir == "up" then
success, reason = turtle.digUp()
elseif dir == "down" then
success, reason = turtle.digDown()
else
____exports.turnInDirection(nil, dir)
success, reason = turtle.dig()
end
if not success then
if reason ~= "Nothing to dig here" then
error(
"Error digging: " .. tostring(reason),
0
)
else
suckInDirection(nil, dir)
end
end
local blockPosition = state:getPositionForDirection(dir)
world:setBlock(blockPosition, "minecraft:air")
end
return ____exports
end,
["pathing"] = function() --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
require("lualib_bundle");
local ____exports = {}
local state = require("state")
local vec3 = require("vec3")
local world = require("world")
local movement = require("movement")
function ____exports._getDirectionTo(self, position, preferVisited)
local allowedDirections = {}
if preferVisited then
if position.north > state.currentPosition.north then
__TS__ArrayPush(allowedDirections, "north")
end
if position.north < state.currentPosition.north then
__TS__ArrayPush(allowedDirections, "south")
end
if position.east > state.currentPosition.east then
__TS__ArrayPush(allowedDirections, "east")
end
if position.east < state.currentPosition.east then
__TS__ArrayPush(allowedDirections, "west")
end
if position.up > state.currentPosition.up then
__TS__ArrayPush(allowedDirections, "up")
end
if position.up < state.currentPosition.up then
__TS__ArrayPush(allowedDirections, "down")
end
else
if (position.north + 2) >= state.currentPosition.north then
__TS__ArrayPush(allowedDirections, "north")
end
if (position.north - 2) <= state.currentPosition.north then
__TS__ArrayPush(allowedDirections, "south")
end
if (position.east + 2) >= state.currentPosition.east then
__TS__ArrayPush(allowedDirections, "east")
end
if (position.east - 2) <= state.currentPosition.east then
__TS__ArrayPush(allowedDirections, "west")
end
if (position.up + 2) >= state.currentPosition.up then
__TS__ArrayPush(allowedDirections, "up")
end
if (position.up - 2) <= state.currentPosition.up then
__TS__ArrayPush(allowedDirections, "down")
end
end
local bestDirection = nil
local bestDirectionScore = -999
for ____, direction in ipairs(allowedDirections) do
local theoreticalPosition = state:getPositionForDirection(direction)
local directionScore = 0
local unknownBlocksAround = world:countUnknownBlocksAround(
state:getPositionForDirection(direction)
)
if preferVisited then
if (direction == "up") or (direction == "down") then
directionScore = directionScore - (unknownBlocksAround / 4)
else
directionScore = directionScore - unknownBlocksAround
end
else
if (direction == "up") or (direction == "down") then
directionScore = directionScore + (unknownBlocksAround / 4)
else
directionScore = directionScore + (unknownBlocksAround / 1.2)
end
end
if direction == state.currentDirection then
directionScore = directionScore + 1
end
if (direction == "north") and (position.north > state.currentPosition.north) then
directionScore = directionScore + 1.1
elseif (direction == "south") and (position.north < state.currentPosition.north) then
directionScore = directionScore + 1.1
elseif (direction == "east") and (position.east > state.currentPosition.east) then
directionScore = directionScore + 1.1
elseif (direction == "west") and (position.east < state.currentPosition.east) then
directionScore = directionScore + 1.1
elseif (direction == "up") and (position.up > state.currentPosition.up) then
directionScore = directionScore + 1.1
elseif (direction == "down") and (position.up > state.currentPosition.up) then
directionScore = directionScore + 1.1
end
directionScore = directionScore - (vec3:getDistanceTo(position, theoreticalPosition) / 2)
if directionScore > bestDirectionScore then
bestDirectionScore = directionScore
bestDirection = direction
end
end
local bestUnknownBlocksAround = world:countUnknownBlocksAround(
state:getPositionForDirection(bestDirection),
true
)
print("best:", bestUnknownBlocksAround)
return bestDirection
end
function ____exports.getDirectionTo(self, position, preferVisited, nextTo)
local allowedDirections = {}
if preferVisited then
if position.north > state.currentPosition.north then
__TS__ArrayPush(allowedDirections, "north")
end
if position.north < state.currentPosition.north then
__TS__ArrayPush(allowedDirections, "south")
end
if position.east > state.currentPosition.east then
__TS__ArrayPush(allowedDirections, "east")
end
if position.east < state.currentPosition.east then
__TS__ArrayPush(allowedDirections, "west")
end
if position.up > state.currentPosition.up then
__TS__ArrayPush(allowedDirections, "up")
end
if position.up < state.currentPosition.up then
__TS__ArrayPush(allowedDirections, "down")
end
else
if (position.north + 2) >= state.currentPosition.north then
__TS__ArrayPush(allowedDirections, "north")
end
if (position.north - 2) <= state.currentPosition.north then
__TS__ArrayPush(allowedDirections, "south")
end
if (position.east + 2) >= state.currentPosition.east then
__TS__ArrayPush(allowedDirections, "east")
end
if (position.east - 2) <= state.currentPosition.east then
__TS__ArrayPush(allowedDirections, "west")
end
if (position.up + 2) >= state.currentPosition.up then
__TS__ArrayPush(allowedDirections, "up")
end
if (position.up - 2) <= state.currentPosition.up then
__TS__ArrayPush(allowedDirections, "down")
end
end
local bestDirection = nil
local bestDirectionScore = -999
for ____, direction in ipairs(allowedDirections) do
local theoreticalPosition = state:getPositionForDirection(direction)
local directionScore = 0
local unknownBlocksAround = world:countUnknownBlocksAround(
state:getPositionForDirection(direction)
)
if preferVisited then
if (direction == "up") or (direction == "down") then
directionScore = directionScore - (unknownBlocksAround / 4)
else
directionScore = directionScore - unknownBlocksAround
end
else
if (direction == "up") or (direction == "down") then
directionScore = directionScore + (unknownBlocksAround / 4)
else
directionScore = directionScore + (unknownBlocksAround / 1.2)
end
end
if direction == state.currentDirection then
directionScore = directionScore + 1
end
if (direction == "north") and (position.north > state.currentPosition.north) then
directionScore = directionScore + 1.1
elseif (direction == "south") and (position.north < state.currentPosition.north) then
directionScore = directionScore + 1.1
elseif (direction == "east") and (position.east > state.currentPosition.east) then
directionScore = directionScore + 1.1
elseif (direction == "west") and (position.east < state.currentPosition.east) then
directionScore = directionScore + 1.1
elseif (direction == "up") and (position.up > state.currentPosition.up) then
directionScore = directionScore + 1.1
elseif (direction == "down") and (position.up > state.currentPosition.up) then
directionScore = directionScore + 1.1
end
directionScore = directionScore - (vec3:getDistanceTo(position, theoreticalPosition) / 2)
if directionScore > bestDirectionScore then
bestDirectionScore = directionScore
bestDirection = direction
end
end
local bestUnknownBlocksAround = world:countUnknownBlocksAround(
state:getPositionForDirection(bestDirection),
true
)
print("best:", bestUnknownBlocksAround)
return bestDirection
end
____exports["goto"] = function(self, position)
while not (((state.currentPosition.north == position.north) and (state.currentPosition.east == position.east)) and (state.currentPosition.up == position.up)) do
local recommendedDirection = ____exports.getDirectionTo(nil, position, true)
movement:digInDirection(recommendedDirection)
movement:moveInDirection(recommendedDirection)
end
end
return ____exports
end,
["index"] = function() --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
require("lualib_bundle");
local ____exports = {}
local world = require("world")
local movement = require("movement")
local vec3 = require("vec3")
local state = require("state")
local pathing = require("pathing")
local TOTAL_SLOTS = 4 * 4
local function returnToSpawn(self)
state:setHeadingToSpawn(true)
print("Going to spawn...")
local spawnPosition = __TS__New(vec3.Vec3, 0, 0, 0)
while not (((state.currentPosition.north == 0) and (state.currentPosition.east == 0)) and (state.currentPosition.up == 0)) do
local recommendedDirection = pathing:getDirectionTo(spawnPosition, true)
print(",,recommendedDirection", recommendedDirection)
movement:digInDirection(recommendedDirection)
movement:moveInDirection(recommendedDirection)
end
movement:turnInDirection("north")
state:setHeadingToSpawn(false)
end
local function returnToStartingHeight(self)
if state.currentPosition.up == 0 then
return
end
if state.currentPosition.up > 0 then
do
local i = 1
while i < state.currentPosition.up do
movement:digInDirection("down")
movement:moveInDirection("down")
i = i + 1
end
end
elseif state.currentPosition.up < 0 then
do
local i = 1
while i < -state.currentPosition.up do
movement:digInDirection("up")
movement:moveInDirection("up")
i = i + 1
end
end
end
end
local function depositAllAtSpawn(self)
returnToSpawn(nil)
do
local i = 1
while i <= TOTAL_SLOTS do
turtle.select(i)
turtle.refuel()
local success, reason = turtle.dropDown()
if reason then
print(reason)
end
i = i + 1
end
end
turtle.select(1)
end
print("Ok")
state:updateInventoryFull()
if state.inventoryFull then
depositAllAtSpawn(nil)
end
local miningOres = false
while true do
local nearestOrePosition = movement:scanAround(world.ORES)
if nearestOrePosition then
print(
"To " .. tostring(nearestOrePosition)
)
local recommendedDirection = pathing:getDirectionTo(nearestOrePosition, true)
movement:digInDirection(recommendedDirection)
movement:moveInDirection(recommendedDirection)
miningOres = true
else
returnToStartingHeight(nil)
local nearestMineablePosition = world:findNearestUnexplored()
local recommendedDirection
if nearestMineablePosition then
recommendedDirection = pathing:getDirectionTo(nearestMineablePosition)
else
recommendedDirection = state.currentDirection
end
print(
((".To " .. tostring(nearestMineablePosition)) .. " ") .. tostring(recommendedDirection)
)
movement:digInDirection(recommendedDirection)
movement:moveInDirection(recommendedDirection)
end
movement:scanAround()
if state.currentPosition.up == 0 then
movement:inspectInDirection("up")
local upBlock = world:getBlock(
state:getPositionForDirection("up")
)
if __TS__ArrayIncludes(world.UNDERGROUND_MINEABLE, upBlock) then
movement:digInDirection("up")
end
end
if state.inventoryFull then
depositAllAtSpawn(nil)
end
world:saveWorld()
end
return ____exports
end,
}
return require("index")
|
local skynet = require "skynet"
local api = require "api"
local sys = require "sys"
local log = require "log"
local seri = require "seri"
local mqtt = require "mqtt"
local dump = require "utils.dump"
local text = require("text").mqtt
local client
local running = true
local subsribe_ack_err_code = 128
local log_prefix = ""
local cocurrency = 5
local keepalive_timeout = 6000
local telemetry_topic = ""
local telemetry_qos = 1
local telemetry_pack
local attributes_topic = ""
local attributes_qos = 1
local attributes_pack
local teleindication_topic = ""
local teleindication_qos = 1
local rpc_topic = ""
local rpc_qos = 1
local connect_topic = ""
local connect_qos = 1
local disconnect_topic = ""
local disconnect_qos = 1
local gtelemetry_topic = ""
local gtelemetry_qos = 1
local gtelemetry_pack
local gattributes_topic = ""
local gattributes_qos = 1
local greq_topic = ""
local greq_qos = 1
local gresp_topic = ""
local gresp_qos = 1
local sub_retry_count = 3
local sub_retry_timeout = 200
local reconnect_timeout = 200
local pub_retry_count
local pub_retry_timeout = 2000
local handler_map = {}
local req_map = {
open_console = api.frpappid,
close_console = api.frpappid,
open_ssh = api.frpappid,
close_ssh = api.frpappid,
open_vnc = api.frpappid,
close_vnc = api.frpappid,
vpn_info = api.vpnappid,
open_peer = api.vpnappid,
close_peer = api.vpnappid,
upgrade = api.sysappid
}
local attributes_map = {
[api.infokey] = "edgeinfo",
southapps = "southapps",
vpn = "vpn",
frp = "frp",
repo = "repo"
}
local function ensure_subscribe(cli, topic, qos)
local done = false
local count = 0
local function suback(ack)
if ack.rc[1] ~= subsribe_ack_err_code then
log.info(log_prefix, text.sub_suc, topic)
-- Strictly rc[1] >= qos
done = true
else
log.error(log_prefix, text.sub_fail, topic)
end
end
while running and not done do
if count < sub_retry_count then
if cli.connection then
cli:subscribe {
topic = topic,
qos = qos,
callback = suback
}
end
count = count + 1
skynet.sleep(sub_retry_timeout)
else
log.error(log_prefix, text.sub_fail, topic)
break
end
end
end
local function init_pub_retry_count(keepalive, pinglimit)
-- retry till connection issue detected
local k = keepalive or 6000
local p = pinglimit or 3
pub_retry_count = k * (p + 1) // pub_retry_timeout + 1
end
local function ensure_publish(cli, msg, dev)
local done = false
local count = 0
local function puback()
done = true
log.debug(log_prefix, text.pub_suc, msg.topic)
end
while running and not done do
if count < pub_retry_count then
if cli.connection then
cli:publish {
topic = msg.topic,
qos = msg.qos,
payload = msg.payload,
callback = puback,
dup = (count ~= 0),
retain = false
}
end
count = count + 1
skynet.sleep(pub_retry_timeout)
else
-- only store due to connection issue
if not cli.connection and dev then
local data = seri.pack(msg)
api.store(dev, data)
else
log.error(log_prefix, text.pub_fail, msg.topic)
end
break
end
end
end
local post_map = {
online = function(dev)
if type(dev) ~= "string" then
log.error(log_prefix, text.invalid_post, "online")
return
end
local payload = seri.pack({ device = dev })
if not payload then
log.error(log_prefix, text.invalid_post, "online")
return
end
local msg = {}
msg.topic = connect_topic
msg.qos = connect_qos
msg.payload = payload
ensure_publish(client, msg)
end,
offline = function(dev)
if type(dev) ~= "string" then
log.error(log_prefix, text.invalid_post, "offline")
return
end
local payload = seri.pack({ device = dev })
if not payload then
log.error(log_prefix, text.invalid_post, "offline")
return
end
local msg = {}
msg.topic = disconnect_topic
msg.qos = disconnect_qos
msg.payload = payload
ensure_publish(client, msg)
end,
teleindication = function(dev, data)
if type(dev) ~= "string" or type(data) ~= "table" then
log.error(log_prefix, text.invalid_post, "teleindication")
return
end
local payload = seri.pack({ [dev] = data })
if not payload then
log.error(log_prefix, text.invalid_post, "teleindication")
return
end
local msg = {}
msg.topic = teleindication_topic
msg.qos = teleindication_qos
msg.payload = payload
ensure_publish(client, msg)
end,
attributes = function(dev, attr)
if type(dev) ~= "string" or type(attr) ~= "table" then
log.error(log_prefix, text.invalid_post, "attributes")
return
end
local payload = attributes_pack({ [dev] = attr })
if not payload then
log.error(log_prefix, text.invalid_post, "attributes")
return
end
local msg = {}
msg.topic = attributes_topic
msg.qos = attributes_qos
msg.payload = payload
ensure_publish(client, msg)
end,
gtelemetry = function(_dev, data)
if type(data) ~= "table" then
log.error(log_prefix, text.invalid_post, "gtelemetry")
return
end
local payload = gtelemetry_pack(data)
if not payload then
log.error(log_prefix, text.invalid_post, "gtelemetry")
return
end
local msg = {}
msg.topic = gtelemetry_topic
msg.qos = gtelemetry_qos
msg.payload = payload
ensure_publish(client, msg)
end,
gattributes = function(_dev, attr)
if type(attr) ~= "table" then
log.error(log_prefix, text.invalid_post, "gattributes")
return
end
local key, value = next(attr)
local k = attributes_map[key]
if not k or type(value) ~= "table" then
log.error(log_prefix, text.invalid_post, "gattributes")
return
end
local payload = seri.pack({ [k] = seri.pack(value) })
if not payload then
log.error(log_prefix, text.invalid_post, "gattributes")
return
end
local msg = {}
msg.topic = gattributes_topic
msg.qos = gattributes_qos
msg.payload = payload
ensure_publish(client, msg)
end
}
local function ping(cli)
local check_timeout = keepalive_timeout+200
while cli.connection do
if skynet.now()-cli.comm_time >= keepalive_timeout then
cli:send_pingreq()
end
skynet.sleep(check_timeout)
end
end
local function handle_pinglimit(count, cli)
log.error(log_prefix, text.connect_fail)
cli:disconnect()
end
local function handle_error(err)
log.error(log_prefix, text.error, err)
end
local function handle_close(conn)
api.offline()
log.error(log_prefix, text.close, conn.close_reason)
end
local function handle_connect(connack, cli)
if connack.rc ~= 0 then
return
end
log.info(log_prefix, text.connect_suc)
api.online()
skynet.fork(ping, cli)
skynet.fork(ensure_subscribe, cli, rpc_topic, rpc_qos)
skynet.fork(ensure_subscribe, cli, gattributes_topic, gattributes_qos)
skynet.fork(ensure_subscribe, cli, greq_topic, greq_qos)
end
--[[
payload = {
"device":"",
"data":{
"id": $request_id,
"method":"",
"params":{}
}
}
--]]
local function decode_rpc(msg)
local request = seri.unpack(msg.payload)
if type(request) ~= "table" then
log.error(log_prefix, text.unpack_fail)
return false
end
if type(request.device) ~= "string" then
log.error(log_prefix, text.unknown_dev)
return false
end
if type(request.data) == "table" then
local data = request.data
if data.id and data.method and data.params then
if data.params.value then
log.info(log_prefix, "decoded rpc",
request.device,
data.method,
dump(data.params.value))
return request.device, data.method, data.params.value, data.id
else
log.error(log_prefix, text.invalid_req)
return false
end
else
log.error(log_prefix, text.invalid_req)
return false
end
else
log.error(log_prefix, text.invalid_req)
return false
end
end
--[[
payload = {
"device":"",
"id": $request_id,
"data":{}
}
--]]
local function respond_rpc(cli, dev, ret, session)
local response = {
device = dev,
id = session,
data = ret
}
local payload = seri.pack(response)
if not payload then
log.error(log_prefix, text.pack_fail)
return
end
local msg = {}
msg.topic = rpc_topic
msg.qos = rpc_qos
msg.payload = payload
ensure_publish(cli, msg)
end
local forked = 0
local function busy_rpc()
if forked < cocurrency then
forked = forked + 1
return false
else
return true
end
end
local function done_rpc()
forked = forked - 1
end
local function handle_rpc(msg, cli)
if busy_rpc() then
log.error(log_prefix, text.busy)
else
skynet.fork(function()
local dev, cmd, arg, session = decode_rpc(msg)
if dev then
local ok, ret = api.external_request(dev, cmd, arg)
if ret then
respond_rpc(cli, dev, { ok, ret }, session)
else
respond_rpc(cli, dev, ok, session)
end
end
done_rpc()
end)
end
end
local function unpack_conf(conf)
local c = seri.unpack(conf)
if type(c) == "table" then
return c
else
error(text.unpack_fail)
end
end
local function unpack_vpn(conf)
return { [api.vpnappid] = unpack_conf(conf) }
end
local function unpack_frp(conf)
return { [api.frpappid] = unpack_conf(conf) }
end
local function unpack_repo(conf)
return { repo = unpack_conf(conf) }
end
local conf_map = {
southapps = function(conf)
local c = unpack_conf(conf)
if type(c.apps) == "table" then
local apps = c.apps
local app_name, device_name, tag_name
for i, app in pairs(apps) do
app_name = string.format("%s_%s", app.app_name, app.app_version)
app.app_name = nil
app.app_version = nil
if type(app.devices) == "table" then
local devices = {}
for _, device in pairs(app.devices) do
device_name = device.device_name
device.device_name = nil
if type(device.tags) == "table" then
local tags = {}
for _, tag in pairs(device.tags) do
tag_name = tag.tag_name
tag.tag_name = nil
tags[tag_name] = tag
end
device.tags = tags
end
devices[device_name] = device
end
app.devices = devices
end
apps[i] = { [app_name] = app }
end
end
return c
end,
wg = unpack_vpn,
frp = unpack_frp,
repo = unpack_repo
}
local function decode_config(msg)
local conf = seri.unpack(msg.payload)
if type(conf) ~= "table" then
log.error(log_prefix, text.unpack_fail)
return false
end
log.info(log_prefix, "origin config", dump(conf))
local k, v = next(conf)
local f = conf_map[k]
if f then
local ok, c = pcall(f, v)
if ok then
log.info(log_prefix, "decoded config", dump(c))
else
log.error(log_prefix, "decode config fail", c)
end
return ok, k, c
else
log.error(log_prefix, "unknown config key", tostring(k))
return false
end
end
local function respond_config(key, ok, err)
post_map.gattributes(api.iotedgedev, { [key] = { res = ok, err = err } })
end
local function handle_config(msg, cli)
skynet.fork(function()
local ok, key, conf = decode_config(msg)
if ok then
local err
ok, err = api.sys_request("configure", conf)
if ok then
log.info(log_prefix, text.configure_suc)
respond_config(key, ok, err)
api.external_request(api.hostappid, "post_attr")
else
log.error(log_prefix, text.configure_fail, err)
respond_config(key, ok, err)
end
else
if key then
respond_config(key, ok, conf)
end
end
end)
end
--[[
msg = {
topic=request_id
}
payload = {
"method":"",
"params":{}
}
--]]
local function decode_req(msg)
local request = seri.unpack(msg.payload)
if type(request) ~= "table" then
log.error(log_prefix, text.unpack_fail)
return false
end
local dev = req_map[request.method]
if not dev then
log.error(log_prefix, text.invalid_req)
return false
end
if type(request.params) ~= "table" then
log.error(log_prefix, text.invalid_req)
return false
end
local session = msg.topic:match("^.+/([^/]+)$")
if math.tointeger(session) then
if request.params.value then
log.info(log_prefix, "decoded req",
dev,
request.method,
dump(request.params.value))
return dev, request.method, request.params.value, session
else
log.error(log_prefix, text.invalid_req)
return false
end
else
log.error(log_prefix, text.invalid_req)
return false
end
end
local function respond_req(cli, ret, session)
local payload = seri.pack(ret)
if not payload then
log.error(log_prefix, text.pack_fail)
return
end
local msg = {}
msg.topic = gresp_topic.."/"..session
msg.qos = gresp_qos
msg.payload = payload
ensure_publish(cli, msg)
end
local function handle_req(msg, cli)
if busy_rpc() then
log.error(log_prefix, text.busy)
else
skynet.fork(function()
local dev, cmd, arg, session = decode_req(msg)
if dev then
local ok, ret = api.external_request(dev, cmd, arg)
if ret then
respond_req(cli, { res = ok, ret = ret }, session)
else
respond_req(cli, { res = ok }, session)
end
if ok then
api.external_request(api.hostappid, "post_attr")
end
end
done_rpc()
end)
end
end
local function init_seri(topic)
if topic:match("^.+/zip$") then
return seri.zpack
else
return seri.pack
end
end
local function greq_prefix(greq)
local prefix = greq:match("^(.+)/[%+%d]+$")
return prefix
end
local function init_topics(topic)
telemetry_topic = topic.telemetry.txt
telemetry_qos = topic.telemetry.qos
telemetry_pack = init_seri(telemetry_topic)
attributes_topic = topic.attributes.txt
attributes_qos = topic.attributes.qos
attributes_pack = init_seri(attributes_topic)
teleindication_topic = topic.teleindication.txt
teleindication_qos = topic.teleindication.qos
rpc_topic = topic.rpc.txt
rpc_qos = topic.rpc.qos
connect_topic = topic.connect.txt
connect_qos = topic.connect.qos
disconnect_topic = topic.disconnect.txt
disconnect_qos = topic.disconnect.qos
gtelemetry_topic = topic.gtelemetry.txt
gtelemetry_qos = topic.gtelemetry.qos
gtelemetry_pack = init_seri(gtelemetry_topic)
gattributes_topic = topic.gattributes.txt
gattributes_qos = topic.gattributes.qos
greq_topic = topic.greq.txt
greq_qos = topic.greq.qos
gresp_topic = topic.gresp.txt
gresp_qos = topic.gresp.qos
handler_map[rpc_topic] = handle_rpc
handler_map[gattributes_topic] = handle_config
handler_map[greq_prefix(greq_topic)] = handle_req
end
local function handle_request(msg, cli)
cli:acknowledge(msg)
if msg.dup then
log.debug(log_prefix, text.dup_req, msg.topic)
end
local h = handler_map[msg.topic]
if h then
h(msg, cli)
else
h = handler_map[greq_prefix(msg.topic)]
if h then
h(msg, cli)
else
log.error(log_prefix, text.invalid_req, msg.topic)
end
end
end
function on_exit()
running = false
local ok, err = client:disconnect()
if ok then
log.info(log_prefix, text.stop_suc)
else
log.error(log_prefix, text.stop_fail, err)
end
end
function on_payload(dev, data)
local msg = seri.unpack(data)
ensure_publish(client, msg, dev)
end
function on_post(k, dev, data)
local f = post_map[k]
if f then
f(dev, data)
else
log.error(log_prefix, text.invalid_post)
end
end
function on_data(dev, data)
if type(dev) ~= "string" or type(data) ~= "table" then
log.error(log_prefix, text.invalid_post, "telemetry")
return
end
local payload = telemetry_pack({[dev] = data})
if not payload then
log.error(log_prefix, text.invalid_post, "telemetry")
return
end
local msg = {}
msg.topic = telemetry_topic
msg.qos = telemetry_qos
msg.payload = payload
ensure_publish(client, msg, dev)
end
function on_conf(conf)
math.randomseed(math.floor(skynet.time()))
log_prefix = "MQTT client "..conf.id.."("..conf.uri..")"
keepalive_timeout = conf.keep_alive*100
seri.init(conf.seri)
init_pub_retry_count(keepalive_timeout, conf.ping_limit)
api.mqtt_init()
init_topics(conf.topic)
cocurrency = conf.cocurrency
client = mqtt.client {
uri = conf.uri,
id = conf.id,
username = conf.username,
password = conf.password,
clean = conf.clean,
secure = conf.secure,
keep_alive = conf.keep_alive,
version = conf.version == "v3.1.1" and mqtt.v311 or mqtt.v50,
ping_limit = conf.ping_limit
}
local mqtt_callback = {
connect = handle_connect,
message = handle_request,
error = handle_error,
close = handle_close,
pinglimit = handle_pinglimit
}
client:on(mqtt_callback)
skynet.timeout(0, function()
while running do
if client.connection then
client:iteration()
else
skynet.sleep(reconnect_timeout)
client:start_connecting()
end
end
end)
return true
end
|
object_tangible_holiday_love_day_rewards_11_love_day_prop_2011_flowers_s02_r = object_tangible_holiday_love_day_rewards_11_shared_love_day_prop_2011_flowers_s02_r:new {
}
ObjectTemplates:addTemplate(object_tangible_holiday_love_day_rewards_11_love_day_prop_2011_flowers_s02_r, "object/tangible/holiday/love_day/rewards_11/love_day_prop_2011_flowers_s02_r.iff")
|
-- Module: PersonalAssistant.PABanking.Items
-- Developer: Klingo
PAB_Items = {}
PAB_Items.queueSize = 0
PAB_Items.loopCount = 0
PAB_Items.esoPlusReloopRequired = false
function PAB_Items.DepositAndWithdrawItems(lastLoop)
lastLoop = lastLoop or false
PAB_Items.failedDeposits = 0
PAB_Items.loopCount = PAB_Items.loopCount + 1
-- local itemMoved = PAB_Items.DoItemStacking(BAG_BANK)
-- while (itemMoved == nil) do
-- do nothing; wait
-- end
-- http://wiki.esoui.com/AddOn_Quick_Questions#How_do_I_generate_my_own_.22events.22_in_Lua.3F
-- first deposit items to the bank
local itemsDeposited = PAB_Items.DoItemTransaction(BAG_BACKPACK, BAG_BANK, PAC_ITEMTYPE_DEPOSIT, lastLoop)
local itemsDepositedPlus = false
-- if a re-loop with subscriber bank is required, or if there are existin
if (IsESOPlusSubscriber() and PAB_Items.esoPlusReloopRequired) then
itemsDepositedPlus = PAB_Items.DoItemTransaction(BAG_BACKPACK, BAG_SUBSCRIBER_BANK, PAC_ITEMTYPE_DEPOSIT, lastLoop)
end
-- then withdraw items from the bank
local itemsWithdrawn = PAB_Items.DoItemTransaction(BAG_BANK, BAG_BACKPACK, PAC_ITEMTYPE_WITHDRAWAL, lastLoop)
local itemsWithdrawnPlus = false
if (IsESOPlusSubscriber()) then
itemsWithdrawnPlus = PAB_Items.DoItemTransaction(BAG_SUBSCRIBER_BANK, BAG_BACKPACK, PAC_ITEMTYPE_WITHDRAWAL, lastLoop)
end
-- then we can deposit the advanced items to the bank
local itemsAdvancedDepositedWithdrawn = PAB_AdvancedItems.DoAdvancedItemTransaction(BAG_BANK)
local itemsAdvancedDepositedWithdrawnPlus = false
if (IsESOPlusSubscriber()) then
itemsAdvancedDepositedWithdrawnPlus = PAB_AdvancedItems.DoAdvancedItemTransaction(BAG_SUBSCRIBER_BANK)
end
-- while (itemsAdvancedDepositedWithdrawn == nil) do
-- do nothing; wait
-- end
if (itemsDeposited or itemsDepositedPlus or itemsWithdrawn or itemsWithdrawnPlus or itemsAdvancedDepositedWithdrawn or itemsAdvancedDepositedWithdrawnPlus) then
return true
else
return false
end
end
function PAB_Items.DoItemTransaction(fromBagId, toBagId, transactionType, lastLoop)
local activeProfile = PA_SavedVars.General.activeProfile
local timer = 100
local skipChecksAndProceed = false
local itemMoved = false
local depStackType = PA_SavedVars.Banking[activeProfile].itemsDepStackType
local witStackType = PA_SavedVars.Banking[activeProfile].itemsWitStackType
local fromBagItemTypeList = PAB_Items.getItemTypeList(fromBagId)
local toBagItemTypeList = PAB_Items.getItemTypeList(toBagId)
-- pre-determine if in case of Junk the checks shall be skipped
if ((transactionType == PAC_ITEMTYPE_DEPOSIT) and (PA_SavedVars.Banking[activeProfile].itemsJunkSetting == PAC_ITEMTYPE_DEPOSIT)) then
-- we are in deposit mode and junk shall be deposited
skipChecksAndProceed = true
elseif ((transactionType == PAC_ITEMTYPE_WITHDRAWAL) and (PA_SavedVars.Banking[activeProfile].itemsJunkSetting == PAC_ITEMTYPE_WITHDRAWAL)) then
-- we are in withdrawal mode and junk shall be withdrawn
skipChecksAndProceed = true
end
for currFromBagItem = 0, #fromBagItemTypeList do
-- store some transfer related information per item
local transferInfo = {}
transferInfo["fromBagId"] = fromBagId
transferInfo["toBagId"] = toBagId
transferInfo["fromItemName"] = GetItemName(transferInfo["fromBagId"], currFromBagItem):upper()
transferInfo["fromItemLink"] = PA.getFormattedItemLink(transferInfo["fromBagId"], currFromBagItem)
transferInfo["stackSize"] = GetSlotStackSize(transferInfo["fromBagId"], currFromBagItem)
transferInfo["origStackSize"] = transferInfo["stackSize"]
local isJunk = IsItemJunk(transferInfo["fromBagId"], currFromBagItem)
local isStolen = IsItemStolen(transferInfo["fromBagId"], currFromBagItem)
local itemFound = false
-- only proceed if the item is not stolen
if (not isStolen) then
-- check if the item is marked as junk and whether junk shall be deposited too
if isJunk and PA_SavedVars.Banking[activeProfile].itemsJunkSetting == PAC_ITEMTYPE_IGNORE then
-- do nothing; skip item (no junk shall be moved)
elseif isJunk and ((transactionType == PAC_ITEMTYPE_DEPOSIT) and (PA_SavedVars.Banking[activeProfile].itemsJunkSetting == PAC_ITEMTYPE_WITHDRAWAL)) then
-- do nothing; skip item (junk has to be withdrawn but we are in deposit mode)
elseif isJunk and ((transactionType == PAC_ITEMTYPE_WITHDRAWAL) and (PA_SavedVars.Banking[activeProfile].itemsJunkSetting == PAC_ITEMTYPE_DEPOSIT)) then
-- do nothing; skip item (junk has to be deposited but we are in withdraw mode)
else
-- loop through all item types
for currItemType = 1, #PAItemTypes do
-- checks if this item type has been enabled for deposits/withdraws and if it does match the type of the source item.... or if it is Junk and checks shall be skipped
if (((PA_SavedVars.Banking[activeProfile].ItemTypes[PAItemTypes[currItemType]] == transactionType) and (fromBagItemTypeList[currFromBagItem] == PAItemTypes[currItemType])) or (isJunk and skipChecksAndProceed)) then
-- then loop through all items in the target bag
for currToBagItem = 0, #toBagItemTypeList do
-- store the name of the target item
transferInfo["toItemName"] = GetItemName(transferInfo["toBagId"], currToBagItem):upper()
-- compare the names
if transferInfo["fromItemName"] == transferInfo["toItemName"] then
-- item found in target bag, transfer item from source bag to target bag and get info how many items left
itemFound = true
itemMoved = true
transferInfo["stackSize"] = PAB_Items.transferItem(currFromBagItem, currToBagItem, transferInfo, lastLoop)
end
-- if no items left, break. otherwise continue the loop
if transferInfo["stackSize"] == 0 then
break
-- if "-1" returned, not enough space was available. stop the rest.
elseif transferInfo["stackSize"] < 0 then
return
end
end
-- all target-items checked - are still stacks left?
if transferInfo["stackSize"] > 0 then
-- only continue if it is allowed to start new stacks
if ((transactionType == PAC_ITEMTYPE_DEPOSIT and not (depStackType == PAB_STACKING_INCOMPLETE)) or (transactionType == PAC_ITEMTYPE_WITHDRAWAL and not (witStackType == PAB_STACKING_INCOMPLETE))) then
-- only deposit them, if full transaction is set or the item was already found (but had a full stack already)
if ((transactionType == PAC_ITEMTYPE_DEPOSIT and depStackType == PAB_STACKING_FULL) or (transactionType == PAC_ITEMTYPE_WITHDRAWAL and witStackType == PAB_STACKING_FULL) or itemFound) then
itemMoved = true
zo_callLater(function() PAB_Items.transferItem(currFromBagItem, nil, transferInfo, lastLoop) end, timer)
timer = timer + PA_SavedVars.Banking[activeProfile].itemsTimerInterval
-- increase the queue of the "callLater" calls
PAB_Items.queueSize = PAB_Items.queueSize + 1
break
end
end
end
end
end
end
end
end
return itemMoved
end
function PAB_Items.DoItemStacking(bagId)
-- TODO: check the configuration if this shall be done or skipped
local itemMoved = false
local fromBagItemNameList = PAB_Items.getItemNameList(bagId)
local toBagItemNameList = PAB_Items.getItemNameList(bagId)
for currFromBagItem = #fromBagItemNameList, 1, -1 do
-- only the upcoming items shall be checked, not the full list again
for currToBagItem = (currFromBagItem - 1), 0, -1 do
if not(currFromBagItem == currToBagItem) then
local fromItemName = GetItemName(bagId, currFromBagItem):upper()
local toItemName = GetItemName(bagId, currToBagItem):upper()
if (fromItemName == toItemName) and not (fromItemName == "") then
local toStackSize, maxStack = GetSlotStackSize(bagId, currToBagItem)
if (maxStack > toStackSize) then
local fromStackSize, _ = GetSlotStackSize(bagId, currFromBagItem)
local size = 0
if (maxStack - toStackSize) > fromStackSize then
size = fromStackSize
else
size = maxStack - toStackSize
end
-- PA.println("stacking %s from %d (%d/%d) to %d (%d/%d)", fromItemName, currFromBagItem, toStackSize, maxStack, currToBagItem, fromStackSize, maxStack)
ClearCursor()
-- call secure protected (pickup the item via cursor)
result = CallSecureProtected("PickupInventoryItem", bagId, currFromBagItem, size)
if (result) then
-- call secure protected (drop the item on the cursor)
result = CallSecureProtected("PlaceInInventory", bagId, currToBagItem)
end
-- clear the cursor again to avoid issues
ClearCursor()
itemMoved = true
break
end
end
end
end
end
-- as long as there was at least one stacking done, try to stack more
if (itemMoved) then
zo_callLater(function() PAB_Items.DoItemStacking(bagId) end, 250)
else
-- return 'true' to indicate that stacking is complete
return true
end
end
-- prepares the actual move
function PAB_Items.transferItem(fromSlotIndex, toSlotIndex, transferInfo, lastLoop)
-- if there is no toSlot, try to find one
if toSlotIndex == nil then toSlotIndex = FindFirstEmptySlotInBag(transferInfo["toBagId"]) end
-- good, there is a slot
if toSlotIndex ~= nil then
local bankStackSize = GetSlotStackSize(transferInfo["toBagId"], toSlotIndex)
-- have to read GetSlotStackSize again, as the targetBag-Slot could be empty, leading to value 0
local _, maxStackSize = GetSlotStackSize(transferInfo["fromBagId"], fromSlotIndex)
-- new stack size = maxStackSize minus existing bankStack
local moveableStackSize = maxStackSize - bankStackSize
local remainingStackSize = 0
if (transferInfo["stackSize"] <= moveableStackSize) then
moveableStackSize = transferInfo["stackSize"]
else
remainingStackSize = transferInfo["stackSize"] - moveableStackSize
end
if moveableStackSize > 0 then
PAB_Items.moveItem(fromSlotIndex, toSlotIndex, moveableStackSize, transferInfo)
-- Before version 1.4.0 it could happen that when the item is not yet in the bank, the itemMove failed.
-- This used to happen only if there are more than ~20 new items for the bank.
-- This method will check if the item is still in its original place after 1-2 seconds
-- and prints a message in case it happened again.
zo_callLater(function() PAB_Items.isItemMoved(fromSlotIndex, moveableStackSize, transferInfo, lastLoop) end, (1000 + PA_SavedVars.Banking[PA_SavedVars.General.activeProfile].itemsTimerInterval))
end
return remainingStackSize
else
-- no free slot found in regular bag
-- check if ESO Plus Subscriber, and if we are currently moving to regular bank
if (IsESOPlusSubscriber() and transferInfo["toBagId"] == BAG_BANK) then
-- in this case, also check subscriber bag before stating that there is no free space
PAB_Items.esoPlusReloopRequired = true
else
PAB.println("PAB_NoSpaceInFor", PA.getBagName(transferInfo["toBagId"]) , transferInfo["fromItemLink"])
return -1
end
end
end
-- checks if an item really has been moved or of it is still there
function PAB_Items.isItemMoved(fromSlotIndex, moveableStackSize, transferInfo, lastLoop)
local depositFailed = false
-- check if the same stack size is in the "old" slotIndex
if (GetSlotStackSize(transferInfo["fromBagId"], fromSlotIndex) == transferInfo["origStackSize"]) then
-- check if the same item name is in the "old" slotIndex
if (GetItemName(transferInfo["fromBagId"], fromSlotIndex):upper() == transferInfo["fromItemName"]) then
-- the item is still there and has NOT been moved.
depositFailed = true
PAB_Items.failedDeposits = PAB_Items.failedDeposits + 1
if lastLoop then
PAB.println("PAB_ItemMovedToFailed", transferInfo["fromItemLink"], PA.getBagName(transferInfo["toBagId"]))
end
end
end
if not depositFailed then
-- now we know for sure that the deposit did work
PAB.println("PAB_ItemMovedTo", moveableStackSize, transferInfo["fromItemLink"], PA.getBagName(transferInfo["toBagId"]))
end
-- decrease the queue size as the check has been done
PAB_Items.queueSize = PAB_Items.queueSize - 1
if PAB_Items.queueSize == 0 then
PAB_Items.reDeposit()
end
end
-- actually moves the item
function PAB_Items.moveItem(fromSlotIndex, toSlotIndex, stackSize, transferInfo)
-- TODO: API 100009 --> replace with RequestMoveItem ???
-- RequestMoveItem (number sourceBag, number sourceSlot, number destBag, number destSlot, number stackCount)
local result = true
-- clear the cursor first
ClearCursor()
-- call secure protected (pickup the item via cursor)
result = CallSecureProtected("PickupInventoryItem", transferInfo["fromBagId"], fromSlotIndex, stackSize)
if (result) then
-- call secure protected (drop the item on the cursor)
result = CallSecureProtected("PlaceInInventory", transferInfo["toBagId"], toSlotIndex)
end
-- clear the cursor again to avoid issues
ClearCursor()
if result then
-- we only know for sure that it did work after the check that is done later. Don't post the success message yet!
-- PAB.println("PAB_ItemMovedTo", stackSize, transferInfo["fromItemLink"], PA.getBagName(transferInfo["toBagId"]))
else
PAB.println("PAB_ItemNotMovedTo", stackSize, transferInfo["fromItemLink"], PA.getBagName(transferInfo["toBagId"]))
end
end
-- checks if there are failedDeposits and re-runs the whole deposit-process in case the bank has not yet been closed
function PAB_Items.reDeposit()
-- the bank is still open and there were failed Deposits
if not PAB.isBankClosed and PAB_Items.failedDeposits > 0 then
-- only run the deposit again if it didn't loop for three times yet
if PAB_Items.loopCount < PAB_DEPOSIT_MAX_LOOPS then
-- do it again! :)
PAB_Items.DepositAndWithdrawItems()
elseif PAB_Items.loopCount == PAB_DEPOSIT_MAX_LOOPS then
-- and a last time (lastLoop = true)
PAB_Items.DepositAndWithdrawItems(true)
end
else
-- either the bank was closed or there are no more items to be deposited; or the maxLoop was reached
-- TODO: implement summary stats
end
end
-- ---------------------------------------------------------------------------------------------------------------
-- returns a list of all item types in a bag
function PAB_Items.getItemTypeList(bagId)
local itemTypeList = {}
local bagSlots = GetBagSize(bagId)
for slotIndex = 0, bagSlots - 1 do
itemTypeList[slotIndex] = GetItemType(bagId, slotIndex)
end
return itemTypeList
end
-- returns a list of all item names in a bag
function PAB_Items.getItemNameList(bagId)
local itemNameList = {}
local bagSlots = GetBagSize(bagId)
for slotIndex = 0, bagSlots - 1 do
itemNameList[slotIndex] = GetItemName(bagId, slotIndex):upper()
end
return itemNameList
end |
stead.menu_prefix = ' '
local mpar = function(v, vv, rc)
if stead.type(v) == 'string' or stead.type(vv) == 'string' then
return stead.par(stead.space_delim, v, vv);
elseif v == true or vv == true then
return true
end
return rc
end
local call = function(o, m, ...)
local rc = nil
local v, r = stead.call(o, m, ...);
if r == false or v == false then
rc = false
elseif r or v then
rc = true
end
return v, r, rc
end
stead.obj_proxy = function(o, act, use_mode, used_act, useit_act)
local v = {};
v.proxy_type = true;
local d = stead.dispof(o);
if stead.type(d) == 'string' then
v.nam = stead.menu_prefix..d;
end
if inv():srch(o) then
v.nam = txtem(v.nam);
end
if not v.nam then
v.nam = true
end
v.pobj = o;
v.pact = act;
v.use_mode = use_mode;
v.used_act = used_act;
v.useit_act = useit_act;
v.save = function(self, name, h, need)
if need then
h:write(stead.string.format(name.." = stead.obj_proxy(%s, %s, %s, %s, %s);\n",
stead.tostring(self.pobj),
stead.tostring(self.pact),
stead.tostring(self.use_mode),
stead.tostring(self.used_act),
stead.tostring(self.useit_act)));
end
stead.savemembers(h, self, name, false);
end
if use_mode then
v.use = function(s, w)
if w.proxy_type then
local v, r, vv, rr, rc, ri
rc = false
local act = s.pact
v, r, ri = call(game, 'before_'..act, s.pobj, w.pobj);
rc = ri or rc
if ri == false then
return v, false
end
vv, r, ri = call(s.pobj, act, w.pobj);
rc = ri or rc
v = mpar(v, vv, rc);
if ri == false then
return v, false
end
if stead.type(s.used_act) == 'string'
and ri == nil then -- used only if use did nothing
vv, r, ri = call(w.pobj, s.used_act, s.pobj);
rc = ri or rc
v = mpar(v, vv, rc);
if ri == false then
return v, false
end
end
if ri then
vv, rr, ri = call(game, 'after_'..act, s.pobj, w.pobj);
rc = rc or ri
v = mpar(v, vv, rc);
if ri == false then
return v, false
end
end
if v == nil then
v = stead.call(game, act, s.pobj, w.pobj);
end
return v, false;
end
end
end
v.inv = function(s)
local v, r, vv, rr, rc, ri
rc = false
local act = s.pact
if s.use_mode then
act = s.useit_act
if stead.type(act) ~= 'string' then
return nil
end
end
v, r, ri = call(game, 'before_'..act, s.pobj);
rc = rc or ri
if ri == false then
return v
end
vv, r, ri = call(s.pobj, act);
rc = rc or ri
v = mpar(v, vv, rc)
if ri == false then
return v
end
if ri then
vv, rr, ri = call(game, 'after_'..act, s.pobj);
rc = rc or ri
v = mpar(v, vv, rc);
end
if v == nil then
v = stead.call(game, act, s.pobj);
end
return v, rc;
end
if use_mode then
return obj(v)
end
return menu(v)
end
stead.proxy_fill_objs = function(s, w, act, use_mode, used_act, useit_act)
local rc = false
for i, o, ii in stead.opairs(w) do
o = stead.ref(o);
if isObject(o) and not isDisabled(o) and o ~= s and not isPhrase(o)
and not o.proxy_type and not isStatus(o) then
s.obj:add(stead.obj_proxy(o, act, use_mode, used_act, useit_act));
if not isRoom(o) then
stead.proxy_fill_objs(s, o.obj, act, use_mode, used_act, useit_act);
end
rc = true
end
end
return rc
end
local select_only = function(s)
for k, o in stead.opairs(stead.me().obj) do
o = stead.ref(o)
if o.action_type and o._state and o ~= s then
o:inv();
end
end
stead.obj_tag(stead.me(), MENU_TAG_ID);
end
local proxy_menu = function(nam, act, _scene, _inv, _way, use_mode, used_act, useit_act, _ifhave)
local v = { };
if stead.type(act) ~= 'string' then
error("Wrong parameter to proxy_menu.", 3)
end
if null[act] then
error(stead.tostring(act).."is a reserved handler. Do not use it.", 3)
end
if used_act and null[used_act] then
error(stead.tostring(used_act).."is a reserved handler. Do not use it.", 3)
end
if useit_act and null[useit_act] then
error(stead.tostring(useit_act).."is a reserved handler. Do not use it.", 3)
end
v.action_type = true;
v._state = false;
v.nam = nam;
v.disp = function(s)
local n = stead.call(s, 'nam')
if s._state then
return txtu(txtnb(n));
end
return txtnb(n);
end
v.fill_scene = _scene;
v.fill_inv = _inv;
v.fill_ifhave = _ifhave;
v.fill_way = _way;
v.gen = function(s)
local k,o,i
local rc = false
s.obj:zap();
if s.fill_inv then
rc = stead.proxy_fill_objs(s, inv(), act, use_mode, used_act, useit_act);
end
if not s.fill_ifhave or rc then
if s.fill_scene then
stead.proxy_fill_objs(s, stead.here().obj, act, use_mode, used_act, useit_act);
end
end
if s.fill_way then
stead.proxy_fill_objs(s, stead.here().way, act, use_mode, used_act, useit_act);
end
select_only(s);
end
v.inv = function(s)
local i,o
local k,v
s._state = not s._state
if s._state then
s:gen();
else
s.obj:zap();
end
return nil, true -- to say instead, do not redraw scene, only inv ;)
end
return menu(v);
end
local function gen_actions(s)
for k, o in stead.opairs(stead.me().obj) do
o = stead.ref(o)
if o.action_type and o._state then
o:gen();
end
end
end
act_menu = function(nam, act)
local v = { };
v.action_type = true;
v.nam = nam;
v.gen = function(s)
end
v.inv = function(s)
local v, r
v, r = stead.call(game, act);
return v, r
end
return menu(v);
end
obj_menu = function(nam, act, _scene, _inv, _way)
return proxy_menu(nam, act, _scene, _inv, _way)
end
use_menu = function(nam, act, used_act, useit_act, _scene, _inv, _ifhave)
return proxy_menu(nam, act, _scene, _inv, false, true, used_act, useit_act, _ifhave)
end
inv = function(s)
return stead.me().inventory;
end
game.onuse = function(s, v, w) -- do not let use on non proxy obj
if not v.proxy_type and not w.proxy_type then
return
end
if not v.proxy_type or not w.proxy_type then
return false
end
end
player = stead.inherit(player, function(v)
v.inv = function(s)
gen_actions(s);
return stead.player_inv(s);
end
v.inventory = list {}
return v
end)
pl = player(pl) -- reinit
-- vim:ts=4
|
-- keep it ordered
local invalidTypes = {
1, 135, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
189, 190, 191, 411, 415, 424, 439, 440, 468, 469, 474, 475, 476, 477, 478,
479, 480, 481, 482, 483, 484, 485, 501, 518, 519, 520, 524, 525, 536, 543,
549, 576, 581, 582, 597, 616, 623, 625, 638, 639, 640, 641, 642, 643, 645,
646, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 678, 700,
701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 713, 715, 718, 719,
722, 723, 737, 741, 742, 743, 744, 748, 751, 752, 753, 754, 755, 756, 757,
758, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777,
778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792,
793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807,
808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822,
823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837,
838, 839, 840, 841, 847, 864, 865, 866, 867, 871, 872, 880, 891, 892, 893,
894, 895, 896, 897, 898, 911, 912, 917, 930, 941, 942, 946, 953, 954, 983,
995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008,
1009, 1010, 1012, 1014, 1015, 1022, 1028, 1074, 1075, 1080, 1081, 1082, 1083,
1084, 1085, 1086, 1087, 1089, 1090, 1096, 1097, 1098, 1099, 1100, 1141, 1145,
1153, 1154, 1155, 1156, 1160, 1170, 1171, 1172, 1176, 1177, 1178, 1182, 1192,
1193, 1194, 1198, 1215, 1216, 1225, 1226, 1227, 1228, 1235, 1236, 1237, 1238,
1239, 1240, 1241, 1242, 1250, 1254, 1263, 1267, 1273, 1274, 1287, 1302, 1318,
1319, 1320, 1327, 1328, 1329, 1330, 1340, 1343, 1345, 1347, 1348, 1349, 1350,
1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, 1368,
1369, 1370, 1374, 1375, 1376, 1388, 1392, 1395, 1400, 1402, 1404, 1409, 1410,
1411, 1420, 1421, 1427, 1429, 1432, 1433, 1434, 1435, 1438, 1442, 1443, 1451,
1452, 1458, 1462
}
local looktype = TalkAction("/looktype")
function looktype.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if param == "" then
player:sendCancelMessage("Command param required.")
return false
end
local lookType = tonumber(param)
if lookType >= 0 and lookType < 1469 and not table.contains(invalidTypes, lookType) then
local playerOutfit = player:getOutfit()
playerOutfit.lookType = lookType
player:setOutfit(playerOutfit)
else
player:sendCancelMessage("A look type with that id does not exist.")
end
return false
end
looktype:separator(" ")
looktype:register()
|
local FixedGRU = {}
function FixedGRU.rnn(nstep, avg, emb_dim)
if avg == nil then
avg = 0
end
if emb_dim == nil then
emb_dim = 256
end
local inputs = {}
for n = 1,nstep do
table.insert(inputs, nn.Identity()())
end
-- gates for update
local i2h_update = {}
local h2h_update = {}
-- gates for reset
local i2h_reset = {}
local h2h_reset = {}
-- candidate hidden state
local i2h = {}
local h2h = {}
-- actual hidden state
local hids = {}
for i,v in ipairs(inputs) do
i2h_update[i] = nn.Sequential()
i2h_update[i]:add(nn.Linear(emb_dim,emb_dim))
i2h_reset[i] = nn.Sequential()
i2h_reset[i]:add(nn.Linear(emb_dim,emb_dim))
i2h[i] = nn.Sequential()
i2h[i]:add(nn.Linear(emb_dim,emb_dim))
if i > 1 then
i2h_update[i]:share(i2h_update[1],'weight', 'bias', 'gradWeight', 'gradBias')
i2h_reset[i]:share(i2h_reset[1],'weight', 'bias', 'gradWeight', 'gradBias')
i2h[i]:share(i2h[1], 'weight', 'bias', 'gradWeight', 'gradBias')
h2h_update[i-1] = nn.Sequential()
h2h_update[i-1]:add(nn.Linear(emb_dim,emb_dim))
h2h_reset[i-1] = nn.Sequential()
h2h_reset[i-1]:add(nn.Linear(emb_dim,emb_dim))
h2h[i-1] = nn.Sequential()
h2h[i-1]:add(nn.Linear(emb_dim,emb_dim))
if i > 2 then
h2h_update[i-1]:share(h2h_update[i-2],'weight', 'bias', 'gradWeight', 'gradBias')
h2h_reset[i-1]:share(h2h_reset[i-2],'weight', 'bias', 'gradWeight', 'gradBias')
h2h[i-1]:share(h2h[i-2],'weight', 'bias', 'gradWeight', 'gradBias')
end
-- compute update and reset gates.
update = nn.Sigmoid()(nn.CAddTable()({i2h_update[i](inputs[i]), h2h_update[i-1](hids[i-1])}))
reset = nn.Sigmoid()(nn.CAddTable()({i2h_reset[i](inputs[i]), h2h_reset[i-1](hids[i-1])}))
-- compute candidate hidden state.
local gated_hidden = nn.CMulTable()({reset, hids[i-1]})
local p1 = i2h[i](inputs[i])
local p2 = h2h[i-1](gated_hidden)
local hidden_cand = nn.Tanh()(nn.CAddTable()({p1, p2}))
-- use gates to interpolate hidden state.
local zh = nn.CMulTable()({update, hidden_cand})
local zhm1 = nn.CMulTable()({nn.AddConstant(1,false)(nn.MulConstant(-1,false)(update)), hids[i-1]})
hids[i] = nn.CAddTable()({zh, zhm1})
else
hids[i] = nn.Tanh()(i2h[i](inputs[i]))
end
end
local hid
if avg == 1 then
hid = hids[1]
for n = 2,nstep do
hid = nn.CAddTable()({hid, hids[n]})
end
hid = nn.MulConstant(1./nstep)(hid)
else
hid = hids[#hids]
end
local outputs = {}
table.insert(outputs, hid)
return nn.gModule(inputs, outputs)
end
return FixedGRU
|
function NPC:OnTakeDamage(npc, attacker, inflictor, dmginfo)
if dmginfo:IsExplosionDamage() then
dmginfo:SetDamageType(DMG_DIRECT)
end
return self.BaseClass.OnTakeDamage(self, npc, attacker, inflictor, dmginfo)
end
function NPC:OnDamagedEnt(npc, ent, dmginfo)
local damage = dmginfo:GetDamage()
if damage == cvars.Number("sk_zombie_dmg_one_slash", 0) or damage == cvars.Number("sk_zombie_dmg_both_slash", 0) then
dmginfo:SetDamage(GetConVar("zm_zombie_dmg_one_slash"):GetInt())
end
end |
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
function onGetFormulaValues(player, level, magicLevel)
local min = (level * 0.2 + magicLevel * 70) + 438
local max = (level * 0.2 + magicLevel * 92) + 544
return min, max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local spell = Spell("instant")
function spell.onCastSpell(creature, variant)
return combat:execute(creature, variant)
end
spell:name("Intense Wound Cleansing")
spell:words("exura gran ico")
spell:group("healing")
spell:vocation("knight;true", "elite knight;true")
spell:id(158)
spell:cooldown(600000) -- 600 sec
spell:groupCooldown(1000)
spell:level(80)
spell:mana(200)
spell:isSelfTarget(true)
spell:isAggressive(false)
spell:isPremium(true)
spell:needLearn(false)
spell:register()
|
wait(.25)
run = game:GetService("RunService")
local player = game.Players.LocalPlayer;char = player.Character;char.Archivable = true;
hrp = char:findFirstChild("HumanoidRootPart");head = char:findFirstChild("Head");ra = char:findFirstChild("Right Arm");la = char:findFirstChild("Left Arm");t = char:findFirstChild("Torso");humanoid = char:findFirstChild("Humanoid");ll = char:findFirstChild("Left Leg");rl = char:findFirstChild("Right Leg");
if player.Backpack:findFirstChild("WindKatana") then
player.Backpack:findFirstChild("WindKatana").Parent = nil
end
local hb = Instance.new("HopperBin", player.Backpack)
hb.Name = "WindKatana"
sword = Instance.new("Model");sword.Name = "WindKatana"
script.Parent = hb;idol = true
if char:findFirstChild(hb.Name) then
char:findFirstChild(hb.Name):Destroy()
end
equip=false;anim = false;banim=false;click=false;damageon=false;DMG=0;edown=false;canjump=true;running=false;don=false;Damag = 10;fell = true;lenormal=true;lerun=false;canjump=true;locanrun=false;ss=false;canboost = true
if char:findFirstChild(hb.Name) then
char:findFirstChild(hb.Name).Parent = nil
end
function weldIt(p1,p2,r1,r2,place)
local w = Instance.new("Weld")
if place then
w.Parent = place
else
w.Parent = p1
end
w.Part0 = p1
w.Part1 = p2
w.C0 = r1
if r2 then
w.C1 = r2
end
return w
end
Add = {
part = function(color,size,pos, place, naym,scale, thing,mt,ccd,id,transparent,loool,ff,yos)
if loool ~= nil then
balleff = Instance.new(loool, place)
else
balleff = Instance.new("Part", place)
balleff.Material = "SmoothPlastic"
balleff.TopSurface = "SmoothNoOutlines"
balleff.BottomSurface = "SmoothNoOutlines"
balleff.RightSurface = "SmoothNoOutlines"
balleff.LeftSurface = "SmoothNoOutlines"
end
balleff.Name = naym
balleff.Anchored= true
balleff.CFrame = pos
if loool == nil then
balleff.Shape = thing
end
if ff then
balleff.FormFactor = ff
end
balleff.CanCollide = ccd;balleff.Transparency = transparent;
balleff.TopSurface = 0
balleff.BottomSurface = 0
balleff.Size = size
balleff.BrickColor = BrickColor.new(color)
if not yos then
mesh = Instance.new("SpecialMesh",balleff)
mesh.MeshType = mt
else
mesh = Instance.new(yos,balleff)
end
mesh.Scale = scale
if mt == "FileMesh" then
mesh.MeshId = id
end
balleff.Parent = place
return balleff
end,
bp = function(parent,num,p)
lop = Instance.new("BodyPosition",parent)
lop.Name = num
lop.maxForce = Vector3.new(math.huge,math.huge,math.huge)
lop.position = p
return lop
end,
BG = function(P,cf)
local bg = Instance.new("BodyGyro",P)
bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
bg.P = 14000
bg.cframe = cf
return bg
end
}
-- MAKING THE BLADE---
Lite= Add.part("Mid gray",Vector3.new(0.300000042, 0.299999982, 0.399999976),CFrame.new(-185.849991, 1.64999986, -65.3999939, 0, -1, 0, 1, 0, -0, 0, 0, 1),sword,"Lite",Vector3.new(0.800000012, 0.800000012, 0.699999988),"Block","Brick",false,nil,0,Part,"Custom")
Dark= Add.part("Black",Vector3.new(0.400000066, 0.799999952, 0.49999997),CFrame.new(-185.991409, 1.50857925, -65.3999939, -0.707106709, -0.707106709, 0, 0.707106709, -0.707106709, 0, 0, 0, 1),sword,"Dark",Vector3.new(0.100000001, 0.949999988, 0.574999988),"Block","Brick",false,nil,0,Part,"Custom")
Dark= Add.part("Black",Vector3.new(0.400000066, 0.399999976, 0.399999976),CFrame.new(-185.991409, 1.50857735, -65.3999939, 0, -1, 0, 1, 0, -0, 0, 0, 1),sword,"Dark",Vector3.new(1, 1, 0.600000024),"Block","Brick",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.900000036, 0.200000003, 0.399999976),CFrame.new(-183.909775, 3.94065022, -65.3999939, 0.500000119, -0.866025269, 0, 0.866025269, 0.500000119, 0, 0, 0, 1),sword,"Blade",Vector3.new(1, 1, 0.200000003),"Block","Brick",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.900000036, 0.200000003, 0.399999976),CFrame.new(-183.803696, 3.83458066, -65.3799896, 0.500000119, 0.866025269, 1.44789709e-007, 0.866025269, -0.500000119, -6.87506159e-008, 1.28551001e-008, 1.5976687e-007, -1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.900000036, 0.200000003, 0.399999976),CFrame.new(-185.531784, 1.82677507, -65.3999939, 0.707106829, -0.707106709, 0, 0.707106709, 0.707106829, 0, 0, 0, 1),sword,"Blade",Vector3.new(1, 1, 0.200000003),"Block","Brick",false,nil,0,Part,"Custom")
Dark= Add.part("Black",Vector3.new(0.300000042, 0.299999982, 0.399999976),CFrame.new(-185.849991, 1.64999986, -65.3999939, 0, -1, 0, 1, 0, -0, 0, 0, 1),sword,"Dark",Vector3.new(1, 1, 0.600000024),"Block","Brick",false,nil,0,Part,"Custom")
Dark= Add.part("Black",Vector3.new(0.200000077, 0.200000003, 0.5),CFrame.new(-185.991409, 1.50857735, -65.3999939, 0, -1, 0, 1, 0, -0, 0, 0, 1),sword,"Dark",Vector3.new(1, 1, 0.600000024),"Block","Brick",false,nil,0,Part,"Custom")
Lite= Add.part("Mid gray",Vector3.new(0.400000066, 0.399999976, 0.399999976),CFrame.new(-185.991409, 1.50857735, -65.3999939, 0, -1, 0, 1, 0, -0, 0, 0, 1),sword,"Lite",Vector3.new(0.800000012, 0.800000012, 0.699999988),"Block","Brick",false,nil,0,Part,"Custom")
BPart= Add.part("Black",Vector3.new(0.5, 0.399999976, 0.399999976),CFrame.new(-187.087418, 0.412563771, -65.3999939, 0.707106769, -0.70710665, 0, 0.70710665, 0.707106769, 0, 0, 0, 1),sword,"BPart",Vector3.new(0.300000012, 1, 0.800000012),"Block","Cylinder",false,nil,0,Part,"Custom")
Dark= Add.part("Black",Vector3.new(0.300000042, 0.299999982, 0.399999976),CFrame.new(-186.132828, 1.36715674, -65.3999939, 0, -1, 0, 1, 0, -0, 0, 0, 1),sword,"Dark",Vector3.new(1, 1, 0.600000024),"Block","Brick",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(1, 0.200000003, 0.399999976),CFrame.new(-185.461075, 1.68535447, -65.4199982, -0.707106948, 0.70710659, 4.49529054e-008, -0.70710659, -0.707106948, -1.68587405e-007, -8.74227553e-008, -1.50995817e-007, 1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.450000018, 0.200000003, 0.399999976),CFrame.new(-183.487625, 4.42047977, -65.4199982, -0.42261827, 0.906307817, 6.54755326e-008, -0.906307817, -0.42261827, -1.5063398e-007, -1.08849591e-007, -1.23001655e-007, 1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Lite= Add.part("Mid gray",Vector3.new(0.300000042, 0.299999982, 0.399999976),CFrame.new(-186.132828, 1.36715674, -65.3999939, 0, -1, 0, 1, 0, -0, 0, 0, 1),sword,"Lite",Vector3.new(0.800000012, 0.800000012, 0.699999988),"Block","Brick",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.900000036, 0.200000003, 0.399999976),CFrame.new(-184.824173, 2.3771975, -65.4199982, -0.642787755, 0.766044319, 4.49529054e-008, -0.766044319, -0.642787755, -1.68587405e-007, -1.00250247e-007, -1.42801824e-007, 1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.200000048, 0.400000006, 0.399999976),CFrame.new(-183.458023, 4.85696697, -65.3999939, -4.58588154e-008, 0.34202069, -0.939692378, -1.01666373e-008, 0.939692378, 0.34202069, 1, 2.52381778e-008, -3.96159798e-008),sword,"Blade",Vector3.new(0.400000006, 1, 0.5),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.900000036, 0.200000003, 0.399999976),CFrame.new(-184.28212, 3.08361006, -65.3799896, 0.57357651, 0.819151938, 1.44790121e-007, 0.819151938, -0.57357651, -6.87501966e-008, 2.67313585e-008, 1.58038603e-007, -1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.900000036, 0.200000003, 0.399999976),CFrame.new(-184.824173, 2.3771956, -65.3799896, 0.642787695, 0.766044378, 1.25616637e-007, 0.766044378, -0.642787695, -8.79236737e-008, 1.33913973e-008, 1.52744178e-007, -1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(1, 0.200000003, 0.399999976),CFrame.new(-185.461075, 1.68535447, -65.3799896, 0.707106829, 0.707106709, 1.06770145e-007, 0.707106709, -0.707106829, -1.06770166e-007, 0, 1.50995803e-007, -1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.5, 0.200000003, 0.399999976),CFrame.new(-183.40889, 4.83704281, -65.3799896, -0.0871555209, 0.99619472, 2.72493907e-007, 0.99619472, 0.0871555209, 5.89535674e-008, 3.49798697e-008, 2.76595131e-007, -1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.400000036, 0.200000003, 0.399999976),CFrame.new(-183.604263, 4.50388622, -65.3999939, 0.42261833, -0.906307757, 0, 0.906307757, 0.42261833, 0, 0, 0, 1),sword,"Blade",Vector3.new(1, 1, 0.200000003),"Block","Brick",false,nil,0,Part,"Custom")
Handle= Add.part("Medium stone grey",Vector3.new(1.20000005, 0.399999976, 0.399999976),CFrame.new(-186.627823, 0.872184277, -65.3999939, 0.707106769, -0.70710665, 0, 0.70710665, 0.707106769, 0, 0, 0, 1),sword,"Handle",Vector3.new(1, 1, 0.600000024),"Block","Cylinder",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.450000018, 0.200000003, 0.399999976),CFrame.new(-183.487625, 4.4204855, -65.3799896, 0.422614396, 0.906309605, 1.64295614e-007, 0.906309605, -0.422614396, -4.92447079e-008, 2.48027376e-008, 1.69714212e-007, -1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.900000036, 0.200000003, 0.399999976),CFrame.new(-184.930252, 2.48326516, -65.3999939, 0.642787695, -0.766044378, 0, 0.766044378, 0.642787695, 0, 0, 0, 1),sword,"Blade",Vector3.new(1, 1, 0.200000003),"Block","Brick",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.900000036, 0.200000003, 0.399999976),CFrame.new(-184.28212, 3.08361387, -65.4199982, -0.57357657, 0.819151938, 4.49529622e-008, -0.819151938, -0.57357657, -1.6858732e-007, -1.12314666e-007, -1.33521056e-007, 1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.900000036, 0.200000003, 0.399999976),CFrame.new(-183.803696, 3.83458257, -65.4199982, -0.500000179, 0.866025329, 6.55408243e-008, -0.866025329, -0.500000179, -1.5046507e-007, -9.75361445e-008, -1.31992579e-007, 1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.5, 0.200000003, 0.399999976),CFrame.new(-183.40889, 4.83704853, -65.4199982, 0.0871553719, 0.99619472, 6.76225653e-008, -0.99619472, 0.0871553719, -1.49568123e-007, -1.54892646e-007, -5.43295755e-008, 1),sword,"Blade",Vector3.new(1, 0.5, 0.100000001),"Block","Wedge",false,nil,0,Part,"Custom")
Core= Add.part("Bright red",Vector3.new(0.200000077, 0.200000003, 0.5),CFrame.new(-185.991409, 1.50857735, -65.3999939, 0, -1, 0, 1, 0, -0, 0, 0, 1),sword,"Core",Vector3.new(0.800000012, 0.800000012, 0.699999988),"Block","Brick",false,nil,0,Part,"Custom")
Blade= Add.part("Medium stone grey",Vector3.new(0.900000036, 0.200000003, 0.399999976),CFrame.new(-184.388199, 3.18968129, -65.3999939, 0.57357651, -0.819151998, 0, 0.819151998, 0.57357651, 0, 0, 0, 1),sword,"Blade",Vector3.new(1, 1, 0.200000003),"Block","Brick",false,nil,0,Part,"Custom")
hitbox= Add.part("Medium stone grey",Vector3.new(1, 3.46000004, 1),CFrame.new(-184.459076, 3.10561037, -65.4410172, 0.060511604, 0.598099828, -0.799133182, -0.0353691019, 0.801382124, 0.597104728, 0.997539937, -0.0078676939, 0.0696469769),sword,"hitbox",Vector3.new(1, 1, 1),"Block","Brick",false,nil,1,Part,"Brick")
while not ra or not la or not t or not humanoid or not head or not ll or not rl or not hrp do
wait()
end
hrpw = hrp:findFirstChild("RootJoint");lh = t:findFirstChild("Left Hip");rh = t:findFirstChild("Right Hip");rs = t:findFirstChild("Right Shoulder");ls = t:findFirstChild("Left Shoulder");neck = t:findFirstChild("Neck");
while not ls or not rs or not neck or not hrpw do
wait()
end
co = hrpw.C0
moop = {}
function Hit(p)
if don then
Damagefunc(p,Damag-5,Damag+5,math.random(10,30),"Normal") end
if QHIT then
if not checkintable(p.Parent, moop) then
Damagefunc(p,Damag+5,Damag+15,math.random(10,30),"Normal");
table.insert(moop, p.Parent);else print("herena") end
end
end
nu = sword:GetChildren()
for i = 1, #nu do
if nu[i].Name ~= "Handle" then
if nu[i].Name == "Blade" or nu[i].Name == "hitbox" then
nu[i].Touched:connect(Hit)
end
w = Instance.new("Weld", sword.Handle)
w.Part0 = sword.Handle
w.Part1 = nu[i]
w.C0 = sword.Handle.CFrame:toObjectSpace(nu[i].CFrame)
nu[i].Anchored = false
end
end
sword.Handle.Anchored = false;sword.Parent = char
function backweld()
bw = weldIt(t,Handle,CFrame.new(1.15,-0.85,-1)*CFrame.Angles(math.rad(25),math.rad(-90),0),nil)
return bw
end
backweld()
function checkintable(chek, tabl)
for i = 1, #tabl do
if tabl[i] == check then
return true
end
end
return false
end
------function of le splash-------------
function splash()
local blcf = hitbox.CFrame*CFrame.new(-.125,.2,0)
if scfr and (hitbox.Position-scfr.p).magnitude > .1 then
local h = 4.7
local a,b = Triangle((scfr*CFrame.new(0,h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p,(blcf*CFrame.new(0,h/2,0)).p)
if a then game.Debris:AddItem(a,.1) end if b then game.Debris:AddItem(b,.1) end
local a,b = Triangle((blcf*CFrame.new(0,h/2,0)).p,(blcf*CFrame.new(0,-h/2,0)).p,(scfr*CFrame.new(0,-h/2,0)).p)
if a then game.Debris:AddItem(a,.1) end if b then game.Debris:AddItem(b,.1) end
scfr = blcf
elseif not scfr then
scfr = blcf
end
end
function rest(num)
for i = 0, 1, 0.13 do
if combo ~= num then
return
end
normal(i)
wait()
end
if combo ~= num then
return
end
scfr=nil;anim = false;running=false;canslash=false;combo=4;runit()
end
-------------------------slashr------------------------------------------------------slashr------------------------------------------------------slashr-----------------------------
slash ={
function()
anim = true
for i = 0, 1, 0.23 do
animate("Toso",(co-Vector3.new(0,0.4,0)),0,math.rad(5),math.rad(170),i);
animate("rr",CFrame.new(1.5,0.5,0),0,math.rad(95),math.rad(110),i);animate("lr",CFrame.new(-1.5,0.5,0),math.rad(-45),0,math.rad(-25),i)
animate("bw",CFrame.new(0,-1,0),0,math.rad(90),0,i)
animate("hr",CFrame.new(0,1,0),0,math.rad(-90),0,i)
animate("reg",CFrame.new(0.5,-1.1,-0.65),math.rad(-15),0,0,i)
animate("leg",CFrame.new(-0.5,-1.2,0),math.rad(-25),0,0,i)
wait()
end
wait()
don = true;attackdebounce = false;scfr = nil
for i = 0, 1, 0.16 do
wait()
splash()
animate("Toso",(co-Vector3.new(0,0,0)),0,math.rad(0),math.rad(20),i);animate("hr",CFrame.new(0,1,0),0,math.rad(-20),0,i)
animate("reg",CFrame.new(0.5,-1.5,0),math.rad(0),0,0,i)
animate("leg",CFrame.new(-0.5,-1.5,0),math.rad(0),0,0,i)
animate("rr",CFrame.new(1.5,0.5,0),0,math.rad(-60),math.rad(110),i);
end
scfr = nil;don = false;canslash=true;
rest(1)
end,
function()
anim = true
for i = 0, 1, 0.24 do
animate("bw",CFrame.new(0,-1,0),math.rad(20),math.rad(90),math.rad(0),i)
animate("Toso",(co-Vector3.new(0,0,0)),0,math.rad(0),math.rad(-50),i);animate("hr",CFrame.new(0,1,0),0,math.rad(10),0,i)
animate("reg",CFrame.new(0.5,-1.5,0),math.rad(0),0,math.rad(10),i)
animate("leg",CFrame.new(-0.5,-1.5,0),math.rad(0),0,0,i)
animate("rr",CFrame.new(1.5,0.5,0),math.rad(90),math.rad(0),math.rad(110),i);
wait()
end
wait();don = true;attackdebounce = false;scfr=nil;
for i = 0, 1, 0.2 do
wait()
splash()
animate("bw",CFrame.new(0,-1,0),math.rad(-60),math.rad(90),math.rad(0),i)
animate("Toso",(co-Vector3.new(0,0.3,0)),math.rad(40),math.rad(0),math.rad(0),i);animate("hr",CFrame.new(0,1,0),math.rad(40),math.rad(10),0,i)
animate("reg",CFrame.new(0.5,-1.2,-0.2),math.rad(10),0,math.rad(10),i)
animate("leg",CFrame.new(-0.5,-1.2,-0.6),math.rad(30),0,0,i)
animate("rr",CFrame.new(1.2,0.5,-0.3),math.rad(75),math.rad(0),math.rad(-40),i);
end
scfr = nil;don = false;canslash=true
rest(2)
end,
function()
anim = true;
for i = 0, 1, 0.24 do
wait();
animate("bw",CFrame.new(0,-1,0),math.rad(0),math.rad(90),math.rad(0),i)
animate("Toso",(co-Vector3.new(0,0,0)),0,math.rad(0),math.rad(30),i);animate("hr",CFrame.new(0,1,0),0,math.rad(-30),0,i)
animate("reg",CFrame.new(0.5,-1.5,0),math.rad(0),0,math.rad(15),i)
animate("leg",CFrame.new(-0.5,-1.5,0),math.rad(0),0,math.rad(-15),i)
animate("rr",CFrame.new(1,0.6,-0.25),math.rad(180),math.rad(40),math.rad(-70),i);
end;don = true;attackdebounce = false;scfr=nil
for i = 0, 1, 0.2 do
wait()
splash()
animate("bw",CFrame.new(0,-1,0),math.rad(-40),math.rad(90),math.rad(0),i)
animate("Toso",(co-Vector3.new(0,0,0)),0,math.rad(0),math.rad(-50),i);animate("hr",CFrame.new(0,1,0),0,math.rad(50),0,i)
animate("reg",CFrame.new(0.5,-1.5,0),math.rad(20),0,math.rad(6),i)
animate("leg",CFrame.new(-0.5,-1.5,0),math.rad(-10),0,math.rad(-10),i)
animate("rr",CFrame.new(1.5,0.5,0),math.rad(0),math.rad(60),math.rad(50),i);
end
scfr = nil;don = false;canslash=true
rest(3)
end,
function()
anim = true
for i = 0, 1, 0.24 do
animate("bw",CFrame.new(0,-1,0),math.rad(-100),math.rad(90),math.rad(0),i)
animate("Toso",(co-Vector3.new(0,0.6,0)),0,math.rad(0),math.rad(-40),i);animate("hr",CFrame.new(0,1,0),0,math.rad(-30),0,i)
animate("reg",CFrame.new(0.5,-0.9,-0.5),math.rad(0),0,math.rad(15),i)
animate("leg",CFrame.new(-0.5,-0.9,0.15),math.rad(-45),0,math.rad(0),i)
animate("rr",CFrame.new(1.4,0.5,0),math.rad(0),math.rad(0),math.rad(75),i);
wait()
end;wait();don = true;attackdebounce = false;scfr=nil
for i = 0, 1, 0.24 do
wait();splash()
animate("bw",CFrame.new(0,-1,0),math.rad(0),math.rad(90),math.rad(0),i)
animate("Toso",(co-Vector3.new(0,0,0)),0,math.rad(0),math.rad(30),i);animate("hr",CFrame.new(0,1,0),0,math.rad(-30),0,i)
animate("reg",CFrame.new(0.5,-1.5,0),math.rad(0),0,math.rad(15),i)
animate("leg",CFrame.new(-0.5,-1.5,0),math.rad(0),0,math.rad(-15),i)
animate("rr",CFrame.new(1,0.6,-0.25),math.rad(180),math.rad(40),math.rad(-70),i);
end;scfr = nil;don = false;canslash=true;rest(4)
end
}
-------------------------slashr------------------------------------------------------slashr------------------------------------------------------slashr-----------------------------
combo = 4;canslash=false
function clik()
if not anim or canslash then
canslash=false;scfr = nil
if combo == 4 then
combo=1;slash[1]();
elseif combo == 1 then
combo=2;slash[2]()
elseif combo == 2 then
combo=3;slash[3]()
elseif combo == 3 then
combo=4;slash[4]()
end
end
end
QHIT = false;
skills = {
function(mouse)
anim = true;locanrun=true;canjump=false
normal(1)
mh = mouse.Hit.p
x,y,z = (CFrame.new(char.Torso.Position,Vector3.new(mh.X,char.Torso.Position.Y,mh.Z))):toEulerAnglesXYZ()
char.Torso.CFrame = CFrame.new(char.Torso.Position,Vector3.new(mh.X,char.Torso.Position.Y,mh.Z))
wait();QHIT = true
for i = 0, 1, 0.333333 do
animate("bw",CFrame.new(0,-1,0),math.rad(-90),math.rad(90),math.rad(0),i)
animate("Toso",(co-Vector3.new(0,0.4,0)),0,math.rad(5),math.rad(-90),i);animate("hr",CFrame.new(0,1,0),math.rad(-10),math.rad(90),0,i)
animate("rr",CFrame.new(1.2,0.5,-1),math.rad(90),math.rad(0),math.rad(-90),i);
wait()
end
wait();moop={};
for i = 0, 1, 0.333333 do
animate("bw",CFrame.new(0,-1,0),math.rad(-90),math.rad(90),math.rad(0),i)
animate("Toso",(co-Vector3.new(0,0.4,0)),0,math.rad(5),math.rad(90),i); animate("hr",CFrame.new(0,1,0),math.rad(-10),math.rad(-70),0,i)
animate("rr",CFrame.new(1.5,0.5,0),math.rad(90),math.rad(0),math.rad(90),i);
wait()
end;mufu={}
wind1= Add.part("Institutional white",Vector3.new(4, 1.2, 1),(hitbox.CFrame-Vector3.new(0,1,0))*CFrame.Angles(math.rad(-10),0,math.rad(90)),sword,"wind",Vector3.new(1.6, 1.1, 1.1),"Block","Sphere",false,nil,0.69999998807907,Part,"Brick")
wind2= Add.part("Really black",Vector3.new(4, 1.2, 1),(hitbox.CFrame-Vector3.new(0,1,0))*CFrame.Angles(math.rad(-10),0,math.rad(90)),sword,"wind",Vector3.new(1.6, 1.1, 1.1),"Block","Sphere",false,nil,0.60000002384186,Part,"Brick");wind2.Mesh.Offset = Vector3.new(0.4,0,0)
wind3= Add.part("Medium stone grey",Vector3.new(4, 1.2, 1),(hitbox.CFrame-Vector3.new(0,1,0))*CFrame.Angles(math.rad(-10),0,math.rad(90)),sword,"wind",Vector3.new(1.6, 1.1, 1.1),"Block","Sphere",false,nil,0.5,Part,"Brick");wind3.Mesh.Offset = Vector3.new(0.6,0,0)
wind1.CFrame = hitbox.CFrame*CFrame.Angles(math.rad(-10),0,math.rad(90))-Vector3.new(0,0.3,0);wind2.CFrame = hitbox.CFrame*CFrame.Angles(math.rad(-10),0,math.rad(90))-Vector3.new(0,0.3,0);wind3.CFrame = hitbox.CFrame*CFrame.Angles(math.rad(-10),0,math.rad(90))-Vector3.new(0,0.3,0)
eff2 = Add.part("Medium stone grey", Vector3.new(), hitbox.CFrame*CFrame.Angles(1,1,1),char,"effect",Vector3.new(1,1,1),"Block","Brick",false,nil,0.4,Part,"Brick")
eff1 = Add.part("Medium stone grey", Vector3.new(1,1,1), hitbox.CFrame*CFrame.Angles(math.random(-360,360),math.random(-360,360),math.random(-360,360)),char,"effect",Vector3.new(1,1,1),"Block","Brick",false,nil,0.4,Part,"Brick")
eff3= Add.part("White",Vector3.new(1, 1, 1),hitbox.CFrame*CFrame.new(0,0,-1),char,"effect",Vector3.new(1.5, 1.5, 1),"Block","FileMesh",false,"http://www.roblox.com/asset/?id=3270017",0.8,Part,"Symmetric")
eff4= Add.part("Black",Vector3.new(1, 1, 1),hitbox.CFrame*CFrame.new(0,0,-1.5),char,"effect",Vector3.new(1.25, 1.25, 1),"Block","FileMesh",false,"http://www.roblox.com/asset/?id=3270017",0.8,Part,"Symmetric")
eff1.CFrame = hitbox.CFrame*CFrame.Angles(math.random(-360,360),math.random(-360,360),math.random(-360,360));eff2.CFrame = hitbox.CFrame*CFrame.Angles(math.random(-360,360),math.random(-360,360),math.random(-360,360))
eff3.CFrame = (hitbox.CFrame*CFrame.new(0,-1,0))*CFrame.Angles(math.rad(90),0,0);eff4.CFrame=(hitbox.CFrame*CFrame.new(0,-1.5,0))*CFrame.Angles(math.rad(90),0,0)
table.insert(mufu,wind1);table.insert(mufu,wind2);table.insert(mufu,wind3);
coroutine.resume(coroutine.create(function(p1,p2,p3,p4,cf1)
for i = 0,1,1/13 do
p1.CFrame = (cf1*CFrame.new(0,3*i,-.5*i))*CFrame.Angles(math.rad(math.random(-400,400)),math.rad(math.random(-400,400)),math.rad(math.random(-400,400)));p1.Transparency=p1.Transparency+(0.6*(1/13))
p2.CFrame = (cf1*CFrame.new(0,3*i,-.5*i))*CFrame.Angles(math.rad(math.random(-400,400)),math.rad(math.random(-400,400)),math.rad(math.random(-400,400)));p2.Transparency=p2.Transparency+(0.6*(1/13))
p3.CFrame = (cf1*CFrame.new(0,-1+8*i,0.17-(8*(0.5/3))*i)*CFrame.Angles(math.rad(90),0,0));p3.Mesh.Scale = Vector3.new(1.5+1*i,1.5+1*i,1);p3.Transparency = 0.8+0.3*i
p4.CFrame = (cf1*CFrame.new(0,-1.5+7.5*i,0.17-(7.5*(0.5/3))*i)*CFrame.Angles(math.rad(90),0,0));p4.Mesh.Scale = Vector3.new(1.25+1*i,1.25+1*i,1);p4.Transparency = 0.8+0.3*i
wait();
end;p1.Parent=nil;p2.Parent=nil;p3.Parent=nil;p4.Parent=nil
end),eff1,eff2,eff3,eff4,hitbox.CFrame)
for x = 1, #mufu do
coroutine.resume(coroutine.create(function(wind,hey,trans,mehx)
for i = 0, 1, (1/13) do
wind.Mesh.Scale = Vector3.new(hey.X+1*i,hey.Y-hey.Y*i,hey.Z-hey.Z*i)
wind.Mesh.Offset = Vector3.new(mehx+1*i,0,0)
wind.Transparency = trans+(1-trans)*i
wait()
end;wind.Parent=nil
end),mufu[x],mufu[x].Mesh.Scale,mufu[x].Transparency,mufu[x].Mesh.Offset.X)
end
QHIT = false;locanrun=false;canjump=true;lerun=false
anim = false;
end,
function()
anim = true;canjump = false
bodyp = Add.bp(t,"Stay",t.Position);
for i = 0, 1, 1/7 do
animate("bw",CFrame.new(0,-1,0),0,math.rad(90),0,i)
animate("Toso",(co-Vector3.new(0,0.5,0)),math.rad(30),math.rad(0),math.rad(0),i)
animate("hr",CFrame.new(0,1,0),math.rad(-10),math.rad(0),0,i)
animate("rr",CFrame.new(1.5,0.5,0),math.rad(90),math.rad(35),math.rad(-25),i)
animate("lr",CFrame.new(-1.5,0.5,0),math.rad(-15),0,math.rad(-45),i)
animate("reg",CFrame.new(0.5,-1,-0.65),math.rad(25),0,0,i)
animate("leg",CFrame.new(-0.5,-1.3,0),math.rad(5),0,0,i)
wait()
end;logic = Add.BG(hrp,hrp.CFrame)
for i = 1, 10 do
boost= Add.part("White",Vector3.new(1, 1, 1),t.CFrame*CFrame.new(0,0,-1),char,"effect",Vector3.new(3, 3, 3),"Block","FileMesh",false,"http://www.roblox.com/asset/?id=20329976",0.3,Part,"Symmetric")
boost.CFrame = CFrame.new(t.Position-Vector3.new(0,1.2,0))*CFrame.Angles(0,math.rad(math.random(-360,360)),0)
coroutine.resume(coroutine.create(function(mama)
for i = 0, 1, 1/12 do
mama.CFrame = mama.CFrame*CFrame.Angles(0,math.rad(math.random(-360,360)),0);mama.Transparency = 0.3+0.5*i;mama.Mesh.Scale = Vector3.new(3+1*i,3+1*i,3+1*i);
wait()
end;mama.Parent=nil
end),boost)
wait()
end;
for i = 0, 1, 1/7 do
animate("bw",CFrame.new(0,-1,0),0,math.rad(90),0,i)
animate("Toso",(co-Vector3.new(0,0,0)),math.rad(0),math.rad(0),math.rad(0),i)
animate("hr",CFrame.new(0,1,0),math.rad(0),math.rad(0),0,i)
animate("rr",CFrame.new(1.5,0.5,0),math.rad(0),math.rad(90),math.rad(90),i)
animate("lr",CFrame.new(-1.5,0.5,0),math.rad(-15),0,math.rad(-45),i)
animate("reg",CFrame.new(0.5,-1,-0),math.rad(0),0,math.rad(25),i)
animate("leg",CFrame.new(-0.5,-1,0),math.rad(0),0,math.rad(-25),i)
wait()
end;
ball = Add.part("White", Vector3.new(1,1,1), t.CFrame, char, "Effect", Vector3.new(20,20,20), "Block", "Sphere",false,nil,0.7,Part,"Custom")ball.Anchored = false
anchor = Add.part("White",Vector3.new(5,5,5),t.CFrame,char,"anchor",Vector3.new(20,20,20),"Block","Sphere",false,nil,1,Part,"Custom");anchor.Anchored = false
wind = Add.part("White",Vector3.new(5,5,5),t.CFrame,char,"anchor",Vector3.new(20,20,20),"Block","FileMesh",false,"http://www.roblox.com/asset/?id=1051557",0.6,Part,"Custom");wind.Anchored = false
a=weldIt(t,anchor,CFrame.new(0,0,0),CFrame.new(0,0,0),nil);b=weldIt(t,wind,CFrame.new(0,0,0),CFrame.new(0,0,0),nil);c=weldIt(t,ball,CFrame.new(0,0,0),CFrame.new(0,0,0),nil)
already = {};weldos={};lepeepz=checkdist(t,17);gage = b.C0
for i = 1, #lepeepz do
if lepeepz[i] then
haw = weldIt(anchor,lepeepz[i].Torso,anchor.CFrame:toObjectSpace(lepeepz[i].Torso.CFrame),nil,nil)
table.insert(weldos,haw);
end
end
for i = 0,1, 1/120 do
if math.floor((i*120)%30) == 1 then
for x = 1,#lepeepz do
if lepeepz[x] and lepeepz[x]:findFirstChild("Humanoid") and lepeepz[x]:findFirstChild("Torso") then
attackdebounce = false
Damagefunc(lepeepz[x].Torso,(humanoid.MaxHealth/10),(humanoid.MaxHealth/10),math.random(10,30),"Normal")
end
end
end
if math.floor((i*120)%4) == 1 then
lolbob = Add.part("White",Vector3.new(5,5,5),t.CFrame*CFrame.Angles(math.rad(math.random(-100,100)),math.rad(math.random(-100,100)),math.rad(math.random(-100,100))),char,"anchor",Vector3.new(2.5,2.5,2.5),"Block","FileMesh",false,"rbxassetid://168892432 ",0.4,Part,"Custom")
lolbob.CFrame = t.CFrame*CFrame.Angles(0,math.rad(-360,360),0)
coroutine.resume(coroutine.create(function(clone)
for i = 0, 1, 0.1 do
clone.Mesh.Scale = Vector3.new(2.5+5*i,2.5+5*i,2.5+5*i);clone.Transparency = 0.4+0.4*i
wait()
end;clone.Parent = nil
end),lolbob)
end
animate("Toso",(co-Vector3.new(0,0,0)),math.rad(0),math.rad(0),math.rad((360*16)*i),i);b.C0 = gage*CFrame.Angles(0,math.rad(100*i),0);ball.Transparency = 0.6-0.4*i;wind.Transparency = 0.6-0.4*i
for i = 1,#weldos do
weldos[i].C0 = weldos[i].C0*CFrame.new(0,0.0625,0)
end
wait()
end;logic.Parent=nil
coroutine.resume(coroutine.create(function(a1,a2,a3,ws,w)
for i = 0, 1, 0.1 do
w.C0 = ws*CFrame.Angles(0,math.rad(100*i),0)
a1.Mesh.Scale = Vector3.new(20+3*i,20+3*i,20+3*i);a1.Transparency = 0.2+0.8*i
a2.Mesh.Scale = Vector3.new(20+3*i,20+3*i,20+3*i);a2.Transparency = 0.2+0.8*i
wait()
end;a1.Parent=nil;a2.Parent=nil;a3.Parent=nil;
end),wind,ball,anchor,b.C0,b)
for i = 1,#weldos do if weldos[i] then weldos[i].Parent = nil end end
wait()
anim = false;bodyp.Parent=nil;canjump=true;
end,
function()
niye = sword:GetChildren();guard=true;br = BrickColor.new("Institutional white")
if ss then
br = BrickColor.new("Medium stone grey");guard = false
end
for i = 1,# niye do
if niye[i].Name == "Blade" then
niye[i].BrickColor = br;ss = guard
end
end
end,
function(bik,rotate)
if not canboost then return end
coroutine.resume(coroutine.create(function(ilan,ratat)
yolo = Add.bp(hrp,"BOPOLS",hrp.Position);canboost=false;
boosts= Add.part("White",Vector3.new(5,5,5),hrp.CFrame,char,"boom",Vector3.new(2.5,2.5,2.5),"Block","FileMesh",false,"http://www.roblox.com/asset/?id=20329976",0.4,Part,"Custom")
boosts.CFrame = (t.CFrame-Vector3.new(0,1.5,0))*CFrame.Angles(0,0,math.rad(ratat))
coroutine.resume(coroutine.create(function(thing)
print("yo")
for i = 0, 1, 0.05 do
thing.Mesh.Scale = Vector3.new(2.5+1*i,2.5+1*i,2.5+1*i);thing.Transparency = 0.4+0.5*i
wait()
end;thing.Parent=nil
end),boosts)
for i = 0, 1, 0.1 do
yolo.position = (hrp.CFrame*CFrame.new(0,0,ilan)).p
wait()
end
yolo.Parent = nil;canboost=true
end),bik,rotate)
end
}
function led(key, mouse)
key = key:lower()
if anim then return end
if key == "z" then
skills[1](mouse)
elseif key == "x" then
skills[2](mouse)
elseif key == "r" then
skills[3]()
elseif key == "c" then
skills[4](-15,120)
elseif key == "v" then
skills[4](10,-120)
end
end
function normal(i)
animate("bw",CFrame.new(0,-1,0),0,math.rad(90),0,i)
animate("Toso",(co-Vector3.new(0,0.4,0)),0,math.rad(5),math.rad(90),i)
animate("hr",CFrame.new(0,1,0),math.rad(-10),math.rad(-70),0,i)
animate("rr",CFrame.new(1.5,0.5,0),math.rad(90),math.rad(115),math.rad(-25),i)
animate("lr",CFrame.new(-1.5,0.5,0),math.rad(35),0,math.rad(-25),i)
animate("reg",CFrame.new(0.5,-1.1,-0.65),math.rad(-15),0,0,i)
animate("leg",CFrame.new(-0.5,-1.2,0),math.rad(-25),0,0,i)
end
function Equip(mouse)
print("yup")
if equip then return end
while anim do wait() end
rh.Parent=nil;rs.Parent=nil;lh.Parent=nil;neck.Parent=nil;ls.Parent=nil;rlw = weldIt(t,rl, CFrame.new(0.5,-1.5,0),CFrame.new(0,0.5,0));llw = weldIt(t,ll, CFrame.new(-0.5,-1.5,0),CFrame.new(0,0.5,0));
rw = weldIt(t,ra,CFrame.new(1.5,0.5,0),CFrame.new(0,0.5,0),nil);lw = weldIt(t,la,CFrame.new(-1.5,0.5,0),CFrame.new(0,0.5,0));nw = weldIt(t,head,CFrame.new(0, 1, 0),CFrame.new(0,-0.5,0))
anim = true
bw.Parent = nil;running=false;idol=true;
hw = weldIt(ra,Handle,CFrame.new(0,-1,0)*CFrame.Angles(0,math.rad(90),0),nil)
for i = 0,1,0.1 do
normal(i)
wait(0.0001)
end
mouse.Button1Down:connect(clik)
mouse.KeyDown:connect(function(k) led(k, mouse) end)
equip = true;anim = false;
end
function unequip(mouse)
if not equip then return end
while anim do wait() end
anim = true;ss=false
for i = 0,1,0.1 do
animate("Toso",co-Vector3.new(0,0.4-0.4*i,0),0,0,0,i)
animate("hr",CFrame.new(0,1,0),0,0,0,i)
animate("rr",CFrame.new(1.5,0.5,0),0,0,0,i)
animate("lr",CFrame.new(-1.5,0.5,0),0,0,0,i)
animate("reg",CFrame.new(0.5,-1.5,0),0,0,0,i)
animate("leg",CFrame.new(-0.5,-1.5,0),0,0,0,i)
wait(0.0001)
end
hw.Parent = nil;backweld()
rw.Parent=nil;lw.Parent=nil;hrpw.C0 = co;rlw.Parent=nil;llw.Parent=nil;rh.Parent=t;lh.Parent=t;rs.Parent=t;ls.Parent=t;neck.Parent=t;
equip=false;anim=false
end
canrun=false
function runit()
if(t.Velocity*Vector3.new(1, 0, 1)).magnitude > 2 and not anim and equip and fell then
running = true;
for i = 0, 1,(1/7) do
if not anim and equip and running and fell then
animate("bw",CFrame.new(0,-1,0),0,math.rad(90),0,i)
animate("Toso",(co-Vector3.new(0,0.4,0)),0,math.rad(5),math.rad(80),i)
animate("hr",CFrame.new(0,1,0),math.rad(0),math.rad(-80),0,i)
animate("rr",CFrame.new(1.5,0.5,0),math.rad(90),math.rad(45),math.rad(-25),i)
animate("lr",CFrame.new(-1.5,0.5,0),math.rad(-35),0,math.rad(-30),i)
--[[animate("reg",CFrame.new(0.5,-1.1,0.2),math.rad(5),math.rad(-80),0,i)
animate("leg",CFrame.new(-0.5,-1.2,-0.2),math.rad(-2),math.rad(-80),0,i)]]
animate("reg",CFrame.new(0.6,-1.2,0),math.rad(5+35*math.cos((inf-7)/4)),math.rad(-40),0,i)
animate("leg",CFrame.new(-0.6,-1.2,0),math.rad(-2-35*math.cos((inf-7)/4)),math.rad(-40),0,i)
wait()
else
if hw then
hw.C0 = CFrame.new(0,-1,0)*CFrame.Angles(0,math.rad(90),0) end
break
end
end
end
end
--[[function run(speed)
if speed>0 then
if (t.Velocity*Vector3.new(1, 0, 1)).magnitude > 2 then
runit()
end
else
running = false
for i = 0, 1, 0.142 do
if not anim and equip and not running then
normal(i)
wait()
else
if hw then
hw.C0 = CFrame.new(0,-1,0)*CFrame.Angles(0,math.rad(90),0) end
break
end
end
idol = true
end
inf = 0
end]]
--to[mem
function Lerp(x,y,inc) return x + (y - x) * inc end
function animate(mem,cfr,x,y,z,e)
To[mem].X=Lerp(To[mem].X,x,e);To[mem].Y=Lerp(To[mem].Y,y,e);To[mem].Z=Lerp(To[mem].Z,z,e)
To[mem].cf=(cfr-Vector3.new(cfr.X,cfr.Y,cfr.Z))+Vector3.new(Lerp(To[mem].cf.X,cfr.X,e),Lerp(To[mem].cf.Y,cfr.Y,e),Lerp(To[mem].cf.Z,cfr.Z,e))
end
To={
rr={X=0;Y=0;Z=0;cf=CFrame.new(1.5,0.5,0)};bw={X=math.rad(5);Y=math.rad(90);Z=0;cf=CFrame.new(0,-1,0)};lr={X=0;Y=0;Z=0;cf=CFrame.new(-1.5,0.5,0)};hr={X=0;Y=0;Z=0;cf=CFrame.new(0,1.5,0)};leg={X=0;Y=0;Z=0;cf=CFrame.new(-0.5,-1,0)};reg={X=0;Y=0;Z=0;cf=CFrame.new(0.5,-1,0)};Toso={X=0;Y=0;Z=0;cf=co}
}
game:service'RunService'.RenderStepped:connect(function()
if rw then rw.C0=To["rr"].cf*CFrame.Angles((To["rr"].X),(To["rr"].Y),(To["rr"].Z)); end
if hw and equip then hw.C0=To["bw"].cf*CFrame.Angles((To["bw"].X),(To["bw"].Y),(To["bw"].Z)) end
if lw then lw.C0=To["lr"].cf*CFrame.Angles((To["lr"].X),(To["lr"].Y),(To["lr"].Z));end
if nw then nw.C0=To["hr"].cf*CFrame.Angles((To["hr"].X),To["hr"].Y,To["hr"].Z);end
if rlw then rlw.C0=To["reg"].cf*CFrame.Angles(To["reg"].X,To["reg"].Y,To["reg"].Z);end
if llw then llw.C0=To["leg"].cf*CFrame.Angles(To["leg"].X,To["leg"].Y,To["leg"].Z);end
if hrpw then hrpw.C0=To["Toso"].cf*CFrame.Angles(To["Toso"].X,To["Toso"].Y,To["Toso"].Z) end
end)
function NoOutline(Part)
Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface = 10,10,10,10,10,10
end
---------------------1274182751856210985126509218u8071894718946189406194189410-------------------------------------------
---------------------1274182751856210985126509218u8071894718946189406194189410-------------------------------------------
---------------------1274182751856210985126509218u8071894718946189406194189410-------------------------------------------
local ppart = Instance.new("Part")
ppart.Material = "SmoothPlastic"
ppart.TopSurface,ppart.BottomSurface = 0,0
ppart.FormFactor = "Custom"
ppart.Size = Vector3.new(.2,.2,.2)
ppart:BreakJoints()
ppart.TopSurface = "SmoothNoOutlines"
ppart.BottomSurface = "SmoothNoOutlines"
ppart.RightSurface = "SmoothNoOutlines"
ppart.LeftSurface = "SmoothNoOutlines"
ppart.CanCollide = false
local function CFrameFromTopBack(at, top, back)
local right = top:Cross(back)
return CFrame.new(at.x, at.y, at.z,
right.x, top.x, back.x,
right.y, top.y, back.y,
right.z, top.z, back.z)
end
function Triangle(a, b, c)
local edg1 = (c-a):Dot((b-a).unit)
local edg2 = (a-b):Dot((c-b).unit)
local edg3 = (b-c):Dot((a-c).unit)
if edg1 <= (b-a).magnitude and edg1 >= 0 then
a, b, c = a, b, c
elseif edg2 <= (c-b).magnitude and edg2 >= 0 then
a, b, c = b, c, a
elseif edg3 <= (a-c).magnitude and edg3 >= 0 then
a, b, c = c, a, b
else
assert(false, "unreachable")
end
local len1 = (c-a):Dot((b-a).unit)
local len2 = (b-a).magnitude - len1
local width = (a + (b-a).unit*len1 - c).magnitude
local maincf = CFrameFromTopBack(a, (b-a):Cross(c-b).unit, -(b-a).unit)
local list = {}
if len1 > 0.01 then
local w1 = Instance.new('WedgePart', m)
w1.Material = "SmoothPlastic"
w1.FormFactor = 'Custom'
if Mode=="Unactive" then
w1.BrickColor = ppart.BrickColor
elseif Mode=="Hero" then
w1.BrickColor = BrickColor.new("Bright blue")
elseif Mode=="Infamous" then
w1.BrickColor = BrickColor.new("Bright red")
end
w1.Transparency = ppart.Transparency
w1.Reflectance = ppart.Reflectance
w1.Material = ppart.Material
w1.CanCollide = ppart.CanCollide
NoOutline(w1)
local sz = Vector3.new(0.2, width, len1)
w1.Size = sz
local sp = Instance.new("SpecialMesh",w1)
sp.MeshType = "Wedge"
sp.Scale = Vector3.new(0,1,1) * sz/w1.Size
w1:BreakJoints()
w1.Anchored = true
w1.Parent = workspace
w1.Transparency = 0.8
coroutine.resume(coroutine.create(function(Part)
for i=0,1,0.1 do
wait()
Part.Transparency=Part.Transparency+0.02
end
end),w1)
w1.CFrame = maincf*CFrame.Angles(math.pi,0,math.pi/2)*CFrame.new(0,width/2,len1/2)
table.insert(list,w1)
end
if len2 > 0.01 then
local w2 = Instance.new('WedgePart', m)
w2.Material = "SmoothPlastic"
w2.FormFactor = 'Custom'
if Mode=="Unactive" then
w2.BrickColor = ppart.BrickColor
elseif Mode=="Hero" then
w2.BrickColor = BrickColor.new("Bright blue")
elseif Mode=="Infamous" then
w2.BrickColor = BrickColor.new("Bright red")
end
w2.Transparency = ppart.Transparency
w2.Reflectance = ppart.Reflectance
w2.Material = ppart.Material
w2.CanCollide = ppart.CanCollide
NoOutline(w2)
local sz = Vector3.new(0.2, width, len2)
w2.Size = sz
local sp = Instance.new("SpecialMesh",w2)
sp.MeshType = "Wedge"
sp.Scale = Vector3.new(0,1,1) * sz/w2.Size
w2:BreakJoints()
w2.Anchored = true
w2.Parent = workspace
w2.Transparency = 0.8
coroutine.resume(coroutine.create(function(Part)
for i=0,1,0.1 do
wait()
Part.Transparency=Part.Transparency+0.02
end
end),w2)
w2.CFrame = maincf*CFrame.Angles(math.pi,math.pi,-math.pi/2)*CFrame.new(0,width/2,-len1 - len2/2)
table.insert(list,w2)
end
return unpack(list)
end
---------------------1274182751856210985126509218u8071894718946189406194189410-------------------------------------------
---------------------1274182751856210985126509218u8071894718946189406194189410-------------------------------------------
---------------------1274182751856210985126509218u8071894718946189406194189410-------------------------------------------
------------------------------
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~=char.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))
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)
blocked=false
block=hit.Parent:findFirstChild("Block")
if block~=nil then
if block.Value>0 then
blocked=true
block.Value=block.Value-1
print(block.Value)
end
end
if blocked==false then
print("NOOOOP")
h.Health=h.Health-Damage
showDamage(hit.Parent,Damage,.5,BrickColor:Red())
else
print("NOOOOP")
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)
if Rootpart then
vp.velocity=RootPart.CFrame.lookVector*knockback+RootPart.Velocity/1.05
end
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,20,0)
bodyVelocity.P=5000
bodyVelocity.maxForce=Vector3.new(8e+003, 8e+003, 8e+003)
bodyVelocity.Parent=hit
game:GetService("Debris"):AddItem(bodyVelocity,.5)
elseif Type=="Freeze" then
BodPos=Instance.new("BodyPosition")
BodPos.P=50000
BodPos.D=1000
BodPos.maxForce=Vector3.new(math.huge,math.huge,math.huge)
BodPos.position=hit.Parent.Torso.Position
BodPos.Parent=hit.Parent.Torso
BodGy = it("BodyGyro")
BodGy.maxTorque = Vector3.new(4e+005,4e+005,4e+005)*math.huge
BodGy.P = 20e+003
BodGy.Parent=hit.Parent.Torso
BodGy.cframe = hit.Parent.Torso.CFrame
hit.Parent.Torso.Anchored=true
coroutine.resume(coroutine.create(function(Part)
wait(1.5)
Part.Anchored=false
end),hit.Parent.Torso)
game:GetService("Debris"):AddItem(BodPos,3)
game:GetService("Debris"):AddItem(BodGy,3)
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
function humang()
if not canjump then
humanoid.Jump = false
end
end
function checkint(tabl,thing)
for i = 1,#tabl do
if tabl[i] == thing then
return true
end
end
return false
end
------------------------------------------------------
--humanoid.Running:connect(run)
humanoid.Changed:connect(humang)
hb.Deselected:connect(unequip)
hb.Selected:connect(Equip)
function checkdist(Part,magni)
tabol = {}
for _,c in pairs(workspace:children()) do
local hum=c:findFirstChild("Humanoid")
if hum~=nil then
local head=c:findFirstChild("Torso")
if head~=nil then
local targ=head.Position-Part.Position
local mag=targ.magnitude
if mag<=magni and c.Name~=player.Name then
table.insert(tabol, c)
end
end
end
end
return tabol
end
inf = 0;lejump = false;
while true do
if inf == 1000 then
inf = 0
end
if (t.Velocity*Vector3.new(1, 0, 1)).magnitude <= 2 and not anim and equip and (fell and (t.Velocity.Y <= 1 and t.Velocity.Y >= -1)) then
lerun=false;if rlw and hrpw and llw then
if lenormal then
for i = 0, 1, 0.2 do
if (t.Velocity*Vector3.new(1, 0, 1)).magnitude <= 2 and not anim and equip and (fell and (t.Velocity.Y <= 1 and t.Velocity.Y >= -1)) then
normal(i)
wait()
else
break
end
end
lenormal = false
end
animate("Toso",co-Vector3.new(0,0.4-0.2*math.cos(inf/23),0),0,math.rad(5),math.rad(90),1)
animate("reg",CFrame.new(0.5,-1.1-0.2*math.cos(inf/23),-0.65),math.rad(-15),0,0,1)
animate("leg",CFrame.new(-0.5,-1.2,0),math.rad(-25-15*(-1*math.cos(inf/23))),0,0,1)
animate("rr",CFrame.new(1.5,0.5,0),math.rad(90),math.rad(115),math.rad(-25+5*math.cos(inf/23)),1)
animate("lr",CFrame.new(-1.5,0.5,0),math.rad(35),0,math.rad(-25-10*math.cos(inf/23)),1)
end
elseif(t.Velocity*Vector3.new(1, 0, 1)).magnitude > 2 and not anim and equip and (fell and (t.Velocity.Y <= 1 and t.Velocity.Y >= -1)) or locanrun then
lenormal=true;
if not lerun and not locanrun then
runit()
lerun=true
end
animate("reg",CFrame.new(0.6,-1.2,0),math.rad(5+35*math.cos(inf/4)),math.rad(-40),0,1)
animate("leg",CFrame.new(-0.6,-1.2,0),math.rad(-2-35*math.cos(inf/4)),math.rad(-40),0,1)
elseif t.Velocity.Y > 1 and not anim and equip and not lejump then
lejump=true;lenormal=true;lerun=false
for i = 0, 1, 1/4 do
if not anim and equip and lejump then
animate("hr",CFrame.new(0,1,0),math.rad(15),math.rad(0),0,i)
animate("reg",CFrame.new(0.6,-1.2,0),math.rad(35),math.rad(-40),0,i)
animate("leg",CFrame.new(-0.6,-1.2,0),math.rad(-35),math.rad(-40),0,i)
animate("rr",CFrame.new(1.5,0.5,0),math.rad(90),math.rad(75),math.rad(-25),i)
animate("lr",CFrame.new(-1.5,0.5,0),math.rad(-35),0,math.rad(-30),i)
wait()
else
break
end
end
lejump=false
if t.Velocity.Y > 1 and not anim and equip and not lejump then
fell = false
end
elseif t.Velocity.Y < -1 and not anim and equip and not lejump and not crosh then
fell = false;lenormal=true;lerun=false
for i = 0, 1, 1/4 do
if not anim and equip and (crosh == nil or (crosh and crosh.CanCollide == false)) then
animate("hr",CFrame.new(0,1,0),math.rad(-5),math.rad(0),0,i)
animate("reg",CFrame.new(0.6,-1.2,0),math.rad(-25),math.rad(-40),0,i)
animate("leg",CFrame.new(-0.6,-1.2,0),math.rad(15),math.rad(-40),0,i)
animate("rr",CFrame.new(1.5,0.5,0),math.rad(90),math.rad(100),math.rad(-25),i)
animate("lr",CFrame.new(-1.5,0.5,0),math.rad(46),0,math.rad(-30),i)
wait()
else
print('break')
break
end
end
lejump = false
else
idol = true;lenormal=true;lerun=false
end
ray = Ray.new(t.Position,(((t.CFrame*CFrame.new(0,-1.5,0)).p)-t.Position).unit*3)
crosh, endPoint = Workspace:FindPartOnRay(ray,char)
if (crosh) then
lejump=false
fell = true
end
if ss then
windy= Add.part("Institutional white",Vector3.new(4, 1.2, 1),(hitbox.CFrame),sword,"wind",Vector3.new(math.random(50,110)/100, 0.3, 0.3),"Block","Sphere",false,nil,0.69999998807907,Part,"Brick");windy.Anchored = false; windyweld=weldIt(hitbox,windy,CFrame.new(math.random(-100,100)/130,-2,math.random(-100,100)/130)*CFrame.Angles(0,0,math.rad(90)),nil,nil)
coroutine.resume(coroutine.create(function(w,was,cu)
for i = 0, 1, 0.2 do
was.C0 = cu+Vector3.new(0,4*i,0)
wait()
end;was.Parent=nil;w.Parent = nil;print("yomama")
end),windy,windyweld,windyweld.C0)
end
inf =inf+1
wait()
end
|
return {--[[ #PVF_File ]]
["[player number]"]={2,8},
["[pvp start area]"]={0,0,0,0,0,0,0,0,0,0,0,0},
["[dungeon]"]={3,},
["[type]"]="[normal]",
["[greed]"]="NN II",
["[tile]"]={"Tile/ForestOver.til","Tile/ForestOver.til","Tile/ForestOver.til","Tile/ForestOverUnder.til","Tile/ForestUnder.til","Tile/ForestUnderOver.til","Tile/ForestOver.til","Tile/ForestOver.til",},
["[far sight scroll]"]=56,
["[middle sight scroll]"]=90,
["[near sight scroll]"]=110,
["[background animation]"]={
["[ani info]"]={
["[filename]"]="Animation/far0.ani",
["[layer]"]="[distantback]",
["[order]"]="[below]",},
["[ani info]"]={
["[filename]"]="Animation/mid1.ani",
["[layer]"]="[middleback]",
["[order]"]="[below]",},},
["[pathgate pos]"]={13,248,1776,240,895,170,896,348},
["[sound]"]={"M_MIRKWOOD","AMB_RAIN_01",},
["[animation]"]={"Animation/Flower2.ani","[normal]",628,320,0,"Animation/Flower2.ani","[normal]",343,307,0,"Animation/Flower0.ani","[normal]",693,258,0,"Animation/Flower1.ani","[normal]",1213,189,0,"Animation/aniFlower.ani","[bottom]",350,197,0,"Animation/Grass2.ani","[bottom]",1083,301,0,"Animation/Grass0.ani","[bottom]",470,263,0,"Animation/Grass0.ani","[bottom]",743,219,0,"Animation/Grass2.ani","[bottom]",849,297,0,"Animation/Grass2.ani","[bottom]",1286,271,0,"Animation/Stone0.ani","[bottom]",601,227,0,"Animation/Stone0.ani","[bottom]",562,285,0,"Animation/Stone0.ani","[bottom]",942,216,0,"Animation/Stone0.ani","[bottom]",1021,297,0,"Animation/StoneHead.ani","[closeback]",672,145,0,"Animation/StonePillar1.ani","[closeback]",1356,140,0,"Animation/StoneHead.ani","[closeback]",1127,165,0,"Animation/StonePillar0.ani","[closeback]",440,136,0,"Animation/StonePillar0.ani","[closeback]",391,136,0,"Animation/StonePillar0.ani","[closeback]",347,135,0,},
["[passive object]"]={3,200,260,400,4,200,260,0,231,803,219,0,231,599,224,0,221,1193,236,0,221,778,246,0,221,779,313,0,231,1035,323,0,},
["[monster]"]={1,0,4,524,204,0,1,1,"[fixed]","[normal]",1,0,4,1302,224,0,1,1,"[fixed]","[normal]",1,0,4,1276,313,0,1,1,"[fixed]","[normal]",1,0,4,590,322,0,1,1,"[fixed]","[normal]",11,0,4,670,253,0,1,1,"[fixed]","[normal]",11,0,4,911,212,0,1,1,"[fixed]","[normal]",11,0,4,908,270,0,1,1,"[fixed]","[normal]",1,0,4,1167,317,0,1,1,"[fixed]","[normal]",1,0,4,1058,247,0,1,1,"[fixed]","[normal]",1,0,4,1015,221,0,1,1,"[fixed]","[normal]",1,0,4,981,273,0,1,1,"[fixed]","[normal]",1,0,4,696,299,0,1,1,"[fixed]","[normal]",1,0,4,651,311,0,1,1,"[fixed]","[normal]",1,0,4,1268,239,0,1,1,"[fixed]","[normal]",1,0,4,1366,265,0,1,1,"[fixed]","[normal]",3,0,4,1112,302,0,1,1,"[fixed]","[normal]",3,0,4,1102,209,0,1,1,"[fixed]","[normal]",3,0,4,828,282,0,1,1,"[fixed]","[normal]",},
["[monster specific AI]"]={"[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]","[normal]",},
["[special passive object]"]={225,464,211,0,0,225,1406,216,0,0,231,1139,269,0,1,"[item]",1,1,-1,-1,-1,221,1201,292,0,2,"[monster]",1,3,3,10,-1,"[item]",3,-1,1,-1,-1,231,554,304,0,1,"[item]",1,1,-1,-1,-1,},
["[event monster position]"]={679,270,0,667,200,0,490,266,0,846,254,0,},
["[map name]"]="PVP无名",
} |
local class = require 'middleclass'
local logger = require 'hj212.logger'
local waitable = require 'hj212.client.station.waitable'
local cems = class('hj212.client.station.cems')
local CEMS_TM = {
-- CEMS 安装地点的环境大气压值,Pa
Ba = {
name = 'a01006',
--name = 'i23001',
default = 101.325,
rate = 1000
},
-- CEMS 测量的烟气静压值,Pa
Ps = {
name = 'a01013',
default = 101.325,
rate = 1000
},
-- CEMS 测量的烟气温度,℃
ts = {
name = 'a01012',
},
-- CEMS 最大间隔 5s 采集测量的烟气流速值,m/s
Vp = {
name = 'a01011',
},
-- CEMS 安装点位烟囱或烟道断面的面积,m2
F = {
name = 'a01016',
default = 1
},
-- 烟气绝对湿度(又称水分含量),%
Xsw = {
name = 'a01014',
rate = 0.01,
},
-- 排放烟气中含氧量干基体积浓度,%
Cvo2 = {
name = 'a19001',
rate = 0.01
},
-- CEMS 设置速度场系数
Kv = {
name = 'Kv',
default = 1
},
-- CEMS 排放标准中规定的该行业标准过量空气系数
As = {
name = 'As',
default = 1.7 --
},
Co2s = {
name = 'Co2s',
default = 0.1 -- ????
},
-- Mno 一氧化氮摩尔质量
Mno = {
name = 'Mno',
default = 30,
},
-- Mno2 一氧化氮摩尔质量
Mno2 = {
name = 'Mno2',
default = 46,
},
}
function cems:initialize(station)
self._station = station
self._tag_map = {}
for k, v in pairs(CEMS_TM) do
local tag_v = {
name = v.name,
rate = v.rate,
default = v.default or 0
}
self._tag_map[k] = tag_v
local wtag = waitable:new(station, tag_v.name)
self[k] = function(self, timeout)
local value, timestamp = wtag:value(timeout)
if not value then
local err = string.format("Failed to get %s. error:%s", k, timestamp)
logger.warning(err)
return tag_v.default, os.time()
end
if tag_v.rate then
return value * tag_v.rate, timestamp
else
return value, timestamp
end
end
end
end
function cems:set_default(name, default)
local tag_v = assert(self._tag_map[name])
if default == nil then
tag_v.default = CEMS_TM[name].default or 0
else
tag_v.default = default
end
end
function cems:set_rate(name, rate)
local tag_v = assert(self._tag_map[name])
if rate == nil then
tag_v.rate = CEMS_TM[name].rate or nil
else
tag_v.rate = rate
end
end
function cems:get(name)
local tag_v = assert(self._tag_map[name])
return self._station:find_tag(tag_v.name)
end
function cems:rate(name)
local tag_v = assert(self._tag_map[name])
return tag_v.rate or 1
end
return cems
|
local config = {} -- extension configuration
config.frontend = {
mainColor = "#49bf9d",
selectedColor = "#1e90ff",
databaseUrl = "/database",
databaseHomeUrl = "",
databaseExecuteUrl = "/execute",
databaseDeleteUrl = "/delete",
databaseDeleteReferenceUrl = "/deleteReference",
databaseDeleteAllReferencesUrl = "/deleteAllReferences",
databaseAddUrl = "/add",
databaseAddReferenceUrl = "/addReference",
databaseEditUrl = "/edit",
databaseSaveUrl = "/save",
}
config.property = {
forbidDirectSqlQuery = true,
}
config.localization = {
}
config.location = {
{name = property.databaseUrl .. property.databaseHomeUrl, script = "controller/DatabaseController.lua", access = "DatabaseRedirectOnSessionTimeoutFilter"},
{name = property.databaseUrl .. property.databaseExecuteUrl, script = "controller/DatabaseExecuteController.lua", requestBody = true, access = "DatabaseThrowErrorOnSessionTimeoutFilter"},
{name = property.databaseUrl .. property.databaseDeleteUrl, script = "controller/DatabaseDeleteController.lua", requestBody = true, access = "DatabaseThrowErrorOnSessionTimeoutFilter"},
{name = property.databaseUrl .. property.databaseDeleteReferenceUrl, script = "controller/DatabaseDeleteReferenceController.lua", requestBody = true, access = "DatabaseThrowErrorOnSessionTimeoutFilter"},
{name = property.databaseUrl .. property.databaseDeleteAllReferencesUrl, script = "controller/DatabaseDeleteAllReferencesController.lua", requestBody = true, access = "DatabaseThrowErrorOnSessionTimeoutFilter"},
{name = property.databaseUrl .. property.databaseAddUrl, script = "controller/DatabaseAddController.lua", access = "DatabaseThrowErrorOnSessionTimeoutFilter"},
{name = property.databaseUrl .. property.databaseAddReferenceUrl, script = "controller/DatabaseAddReferenceController.lua", access = "DatabaseThrowErrorOnSessionTimeoutFilter"},
{name = property.databaseUrl .. property.databaseEditUrl, script = "controller/DatabaseEditController.lua", access = "DatabaseThrowErrorOnSessionTimeoutFilter"},
{name = property.databaseUrl .. property.databaseSaveUrl, script = "controller/DatabaseSaveController.lua", requestBody = true, access = "DatabaseThrowErrorOnSessionTimeoutFilter"}
}
config.access = {
{name = "DatabaseRedirectOnSessionTimeoutFilter", script = "filter/DatabaseRedirectOnSessionTimeoutFilter.lua"},
{name = "DatabaseThrowErrorOnSessionTimeoutFilter", script = "filter/DatabaseThrowErrorOnSessionTimeoutFilter.lua"},
}
config.javascript = {
{name = "DatabaseTemplate", script = "controller/DatabaseTemplate.js"},
{name = "DatabaseNavigation", script = "widget/DatabaseNavigation.js"},
{name = "DatabaseHeader", script = "widget/DatabaseHeader.js"},
{name = "DatabaseEditor", script = "widget/DatabaseEditor.js"},
{name = "DatabaseTabs", script = "widget/DatabaseTabs.js"},
{name = "DatabaseResult", script = "widget/DatabaseResult.js"},
{name = "DatabaseEditObject", script = "widget/DatabaseEditObject.js"}
}
config.stylesheet = {
{name = "DatabaseTemplate", script = "controller/DatabaseTemplate.css"},
{name = "DatabaseNavigation", script = "widget/DatabaseNavigation.css"},
{name = "DatabaseHeader", script = "widget/DatabaseHeader.css"},
}
config.module = {
}
config.static = {
"static"
}
return config -- return extension configuration |
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:25' 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.
****************************************************************************
]]
--------------------------------------------
--Battleground Scoreboard In Game Scene
--------------------------------------------
ZO_Battleground_Scoreboard_In_Game = ZO_Object:Subclass()
function ZO_Battleground_Scoreboard_In_Game:New(...)
local scoreboard = ZO_Object.New(self)
scoreboard:Initialize(...)
return scoreboard
end
function ZO_Battleground_Scoreboard_In_Game:Initialize(control)
self.inGameTimer = control
self.inGameTimerLabel = control:GetNamedChild("Timer")
BATTLEGROUND_SCOREBOARD_IN_GAME_TIMER_FRAGMENT = ZO_SimpleSceneFragment:New(self.inGameTimer)
BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE = ZO_Scene:New("battleground_scoreboard_in_game", SCENE_MANAGER)
BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE:RegisterCallback("StateChange", function(oldState, newState)
if newState == SCENE_SHOWING then
self:OnShowing()
elseif newState == SCENE_HIDDEN then
self:OnHidden()
end
end)
BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE:SetSceneRestoreHUDSceneToggleUIMode(true)
BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE:SetSceneRestoreHUDSceneToggleGameMenu(true)
BATTLEGROUND_SCOREBOARD_IN_GAME_UI_SCENE = ZO_Scene:New("battleground_scoreboard_in_game_ui", SCENE_MANAGER)
SYSTEMS:RegisterKeyboardRootScene("battleground_scoreboard_in_game", BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE)
SYSTEMS:RegisterGamepadRootScene("battleground_scoreboard_in_game", BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE)
local function OnGamepadModeChanged(eventId, isGamepadPreferred)
self:CloseScoreboard()
end
EVENT_MANAGER:RegisterForEvent("BattlegroundScoreboardInGame", EVENT_GAMEPAD_PREFERRED_MODE_CHANGED, OnGamepadModeChanged)
self:InitializeKeybindStrip()
self:InitializePlatformStyle()
end
function ZO_Battleground_Scoreboard_In_Game:InitializeKeybindStrip()
self.keybindStripDescriptor =
{
alignment = KEYBIND_STRIP_ALIGN_RIGHT,
-- Close
{
name = GetString(SI_BATTLEGROUND_SCOREBOARD_CLOSE),
keybind = "HIDE_BATTLEGROUND_SCOREBOARD",
callback = function()
self:CloseScoreboard()
end,
},
-- Leave Battleground
{
name = GetString(SI_BATTLEGROUND_SCOREBOARD_LEAVE_BATTLEGROUND),
keybind = "LEAVE_BATTLEGROUND",
callback = function()
self:OnLeaveBattlegroundPressed()
end,
},
}
self.listNavigationKeybindStripDescriptor =
{
alignment = KEYBIND_STRIP_ALIGN_CENTER,
--Player Options
{
name = GetString(SI_BATTLEGROUND_SCOREBOARD_PLAYER_OPTIONS_KEYBIND),
keybind = "BATTLEGROUND_SCOREBOARD_PLAYER_OPTIONS",
visible = function()
return IsInGamepadPreferredMode()
end,
callback = function()
BATTLEGROUND_SCOREBOARD_FRAGMENT:ShowGamepadPlayerMenu()
end,
},
-- Previous Entry Select
{
name = GetString(SI_BATTLEGROUND_SCOREBOARD_PREVIOUS_PLAYER_KEYBIND),
keybind = "BATTLEGROUND_SCOREBOARD_PREVIOUS",
callback = function()
BATTLEGROUND_SCOREBOARD_FRAGMENT:SelectPreviousPlayerData()
end,
},
-- Next Entry Select
{
name = GetString(SI_BATTLEGROUND_SCOREBOARD_NEXT_PLAYER_KEYBIND),
keybind = "BATTLEGROUND_SCOREBOARD_NEXT",
callback = function()
BATTLEGROUND_SCOREBOARD_FRAGMENT:SelectNextPlayerData()
end,
},
}
end
function ZO_Battleground_Scoreboard_In_Game:InitializePlatformStyle()
self.platformStyle = ZO_PlatformStyle:New(function(style) self:ApplyPlatformStyle(style) end)
end
function ZO_Battleground_Scoreboard_In_Game:ApplyPlatformStyle(style)
ApplyTemplateToControl(self.inGameTimer, ZO_GetPlatformTemplate("ZO_BattlegroundScoreboard_Timer"))
end
function ZO_Battleground_Scoreboard_In_Game:CloseScoreboard()
if SCENE_MANAGER:IsShowing("battleground_scoreboard_in_game") or SCENE_MANAGER:IsShowing("battleground_scoreboard_in_game_ui") then
BATTLEGROUND_SCOREBOARD_FRAGMENT:HideInGameScoreboard()
end
end
function ZO_Battleground_Scoreboard_In_Game:OnLeaveBattlegroundPressed()
ZO_Dialogs_ShowPlatformDialog("CONFIRM_LEAVE_BATTLEGROUND")
end
function ZO_Battleground_Scoreboard_In_Game:UpdateTimer()
self.inGameTimerLabel:SetText(BATTLEGROUND_HUD_FRAGMENT:GetStateText())
end
function ZO_Battleground_Scoreboard_In_Game:OnShowing()
self:SetupPreferredKeybindFragments()
self:SetupKeybindStripDescriptorAlignment()
KEYBIND_STRIP:RemoveDefaultExit()
KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
KEYBIND_STRIP:AddKeybindButtonGroup(self.listNavigationKeybindStripDescriptor)
self:UpdateTimer()
self.inGameTimer:SetHandler("OnUpdate", function() self:UpdateTimer() end)
self:RefreshMatchInfoFragments()
end
function ZO_Battleground_Scoreboard_In_Game:OnHidden()
KEYBIND_STRIP:RemoveKeybindButtonGroup(self.listNavigationKeybindStripDescriptor)
KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
KEYBIND_STRIP:RestoreDefaultExit()
self.inGameTimer:SetHandler("OnUpdate", function() self:UpdateTimer() end)
end
function ZO_Battleground_Scoreboard_In_Game:SetupKeybindStripDescriptorAlignment()
if IsInGamepadPreferredMode() then
self.keybindStripDescriptor.alignment = KEYBIND_STRIP_ALIGN_LEFT
self.listNavigationKeybindStripDescriptor.alignment = KEYBIND_STRIP_ALIGN_LEFT
else
self.keybindStripDescriptor.alignment = KEYBIND_STRIP_ALIGN_RIGHT
self.listNavigationKeybindStripDescriptor.alignment = KEYBIND_STRIP_ALIGN_CENTER
end
end
function ZO_Battleground_Scoreboard_In_Game:SetupPreferredKeybindFragments()
if IsInGamepadPreferredMode() then
BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE:AddFragmentGroup(FRAGMENT_GROUP.GAMEPAD_KEYBIND_STRIP_GROUP)
BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE:RemoveFragmentGroup(FRAGMENT_GROUP.KEYBOARD_KEYBIND_STRIP_GROUP)
else
BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE:AddFragmentGroup(FRAGMENT_GROUP.KEYBOARD_KEYBIND_STRIP_GROUP)
BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE:RemoveFragmentGroup(FRAGMENT_GROUP.GAMEPAD_KEYBIND_STRIP_GROUP)
end
end
function ZO_Battleground_Scoreboard_In_Game:RefreshMatchInfoFragments()
local groupToAdd, groupToRemove
if IsInGamepadPreferredMode() then
groupToAdd = FRAGMENT_GROUP.BATTLEGROUND_MATCH_INFO_GAMEPAD_GROUP
groupToRemove = FRAGMENT_GROUP.BATTLEGROUND_MATCH_INFO_KEYBOARD_GROUP
else
groupToAdd = FRAGMENT_GROUP.BATTLEGROUND_MATCH_INFO_KEYBOARD_GROUP
groupToRemove = FRAGMENT_GROUP.BATTLEGROUND_MATCH_INFO_GAMEPAD_GROUP
end
BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE:RemoveFragmentGroup(groupToRemove)
BATTLEGROUND_SCOREBOARD_IN_GAME_UI_SCENE:RemoveFragmentGroup(groupToRemove)
BATTLEGROUND_SCOREBOARD_IN_GAME_SCENE:AddFragmentGroup(groupToAdd)
BATTLEGROUND_SCOREBOARD_IN_GAME_UI_SCENE:AddFragmentGroup(groupToAdd)
end
------------------
-- XML Functions
------------------
function ZO_Battleground_Scoreboard_In_Game_Timer_OnInitialize(control)
ZO_BATTLEGROUND_SCOREBOARD_IN_GAME = ZO_Battleground_Scoreboard_In_Game:New(control)
end
|
function ScreenGameplay_P1X()
local st = GAMESTATE:GetCurrentStyle():GetStepsType();
if st == "StepsType_Dance_Solo" then
return SCREEN_CENTER_X;
elseif st == "StepsType_Dance_Couple" then
return WideScale(SCREEN_CENTER_X-175,SCREEN_CENTER_X-160);
else
return WideScale(SCREEN_CENTER_X-175,SCREEN_CENTER_X-240);
end
end
function ScreenGameplay_P2X()
local st = GAMESTATE:GetCurrentStyle():GetStepsType();
if st == "StepsType_Dance_Solo" then
return SCREEN_CENTER_X;
elseif st == "StepsType_Dance_Couple" then
return WideScale(SCREEN_CENTER_X+175,SCREEN_CENTER_X+160);
else
return WideScale(SCREEN_CENTER_X+175,SCREEN_CENTER_X+240);
end
end
function ScreenGameplayLifeY()
return SCREEN_TOP+35
end
function play_sample_music()
if GAMESTATE:IsCourseMode() then return end
local song = GAMESTATE:GetCurrentSong()
if song then
local songpath = song:GetMusicPath()
local sample_start = song:GetSampleStart()
local sample_len = song:GetSampleLength()
if songpath and sample_start and sample_len then
SOUND:DimMusic(PREFSMAN:GetPreference("SoundVolume"), math.huge)
SOUND:PlayMusicPart(songpath, sample_start,sample_len, 0.5, 1.5, true, true)
else
stop_music()
end
else
stop_music()
end
end
function stop_music()
SOUND:PlayMusicPart("", 0, 0)
end
|
-----------------------------------
-- Area: Port Bastok
-- NPC: Brita
-- Type: Standard NPC
-- !pos 58.161 -3.101 -6.695 236
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
player:startEvent(346, 0, 1);
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
end;
|
include('shared.lua')
function ENT:Initialize()
self.RealModel = "models/maver1k_XVII/Stalker/mutants/karlik.mdl"
end
function ENT:Draw()
if self.Entity:GetNWBool( "Teleport", false ) then
local TEMP_Emitter = ParticleEmitter(self:GetPos(), false)
if(IsValid(TEMP_Emitter)) then
local TEMP_Particle = TEMP_Emitter:Add( "particles/conc_warp", self.Entity:GetNWVector("OldPos", self:GetPos()))
TEMP_Particle:SetDieTime( 4 )
TEMP_Particle:SetStartAlpha( 255 )
TEMP_Particle:SetEndAlpha( 10 )
TEMP_Particle:SetStartSize( 100 )
TEMP_Particle:SetEndSize( 1 )
TEMP_Particle:SetColor( 50,255,50 )
TEMP_Particle:SetGravity(Vector(0,0,0))
--TEMP_Particle:SetVelocity((-self:GetVelocity():GetNormalized()*math.random(30,40))+
--Vector(math.random(-28,28),math.random(-28,28),math.random(-28,28)))
TEMP_Particle:SetCollide(true)
TEMP_Emitter:Finish()
self.Entity:SetNWBool( "Teleport", false )
end
end
if self.Entity:GetNWBool( "Knocking", false ) then
local TEMP_Emitter = ParticleEmitter(self:GetPos(), false)
if(IsValid(TEMP_Emitter)) then
local TEMP_Particle = TEMP_Emitter:Add( "particles/conc_warp", self:GetPos()+Vector(0,0,64))
TEMP_Particle:SetDieTime( 0.3 )
TEMP_Particle:SetStartAlpha( 255 )
TEMP_Particle:SetEndAlpha( 100 )
TEMP_Particle:SetStartSize( 1 )
TEMP_Particle:SetEndSize( 400 )
TEMP_Particle:SetColor( 255,255,255 )
TEMP_Particle:SetGravity(Vector(0,0,0))
--TEMP_Particle:SetVelocity((-self:GetVelocity():GetNormalized()*math.random(30,40))+
--Vector(math.random(-28,28),math.random(-28,28),math.random(-28,28)))
TEMP_Particle:SetCollide(true)
TEMP_Emitter:Finish()
self.Entity:SetNWBool( "Knocking", false )
end
end
self:SetModel("models/maver1k_XVII/Stalker/mutants/karlik.mdl")
self:DrawModel()
end |
--
-- The battery bank acts as a both an energy storage unit and battery charger!
-- Charge up any batteries
--
local Groups = assert(foundation.com.Groups)
local cluster_devices = assert(yatm.cluster.devices)
local cluster_energy = assert(yatm.cluster.energy)
local Energy = assert(yatm.energy)
local EnergyDevices = assert(yatm.energy.EnergyDevices)
local fspec = assert(foundation.com.formspec.api)
local function num_round(value)
local d = value - math.floor(value)
if d > 0.5 then
return math.ceil(value)
else
return math.floor(value)
end
end
local mode_to_index = {
none = 1,
i = 2,
o = 3,
io = 4
}
local function get_battery_bank_formspec(pos, user, assigns)
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local meta = minetest.get_meta(pos)
local mode = meta:get_string("mode")
local node_inv_name = "nodemeta:" .. spos
local cio = fspec.calc_inventory_offset
return yatm.formspec_render_split_inv_panel(user, 8, 4, { bg = "machine" }, function (loc, rect)
if loc == "main_body" then
return fspec.list(node_inv_name, "batteries", rect.x, rect.y, 4, 4) ..
fspec.dropdown(rect.x + cio(4), rect.y, 4, 1, "mode", { "node", "i", "o", "io" }, mode_to_index[mode] or 1)
elseif loc == "footer" then
return fspec.list_ring(node_inv_name, "batteries") ..
fspec.list_ring("current_player", "main")
end
return ""
end)
end
local function battery_bank_on_receive_fields(player, formname, fields, assigns)
local meta = minetest.get_meta(assigns.pos)
if fields["mode"] then
meta:set_string("mode", fields["mode"])
end
return true
end
local function battery_bank_refresh_infotext(pos)
-- despite this saying infotext, it can also be used to refresh the node state
-- no hard or fast rules here
local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
local nodedef = minetest.registered_nodes[node.name]
local capacity = meta:get_int("energy_capacity")
local energy = meta:get_int("energy")
local usable = EnergyDevices.get_usable_stored_energy(pos, node)
local intended_state = meta:get_string("network_state")
local infotext =
cluster_devices:get_node_infotext(pos) .. "\n" ..
cluster_energy:get_node_infotext(pos) .. "\n" ..
"Energy: " .. Energy.format_string(energy, capacity) .. "\n" ..
"Usable Energy: " .. tostring(usable)
meta:set_string("infotext", infotext)
local i = 0
if capacity > 0 then
i = math.min(math.max(num_round(4 * energy / capacity), 0), 4)
end
local new_node_name
if intended_state == "down" then
-- Ignore it
--new_node_name = nodedef.yatm_network.states.off
new_node_name = nodedef.yatm_network.states.off
elseif intended_state == "up" then
new_node_name = nodedef.yatm_network.states["on" .. i]
elseif intended_state == "conflict" then
new_node_name = nodedef.yatm_network.states["error" .. i]
end
if new_node_name then
if node.name ~= new_node_name then
node.name = new_node_name
minetest.swap_node(pos, node)
cluster_devices:schedule_update_node(pos, node)
cluster_energy:schedule_update_node(pos, node)
end
end
end
local battery_bank_yatm_network = {
kind = "energy_storage",
groups = {
device_controller = 2,
energy_storage = 1,
energy_receiver = 1,
},
default_state = "off",
states = {
off = "yatm_energy_storage:battery_bank_off",
error0 = "yatm_energy_storage:battery_bank_error0",
error1 = "yatm_energy_storage:battery_bank_error1",
error2 = "yatm_energy_storage:battery_bank_error2",
error3 = "yatm_energy_storage:battery_bank_error3",
error4 = "yatm_energy_storage:battery_bank_error4",
on0 = "yatm_energy_storage:battery_bank_on0",
on1 = "yatm_energy_storage:battery_bank_on1",
on2 = "yatm_energy_storage:battery_bank_on2",
on3 = "yatm_energy_storage:battery_bank_on3",
on4 = "yatm_energy_storage:battery_bank_on4",
},
energy = {
},
}
local invbat = assert(yatm.energy.inventory_batteries)
local function refresh_battery_bank_capacity(pos)
local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
local inv = meta:get_inventory()
local capacity = invbat.calc_capacity(inv, "batteries")
local energy = invbat.calc_stored_energy(inv, "batteries")
meta:set_int("energy", energy)
meta:set_int("energy_capacity", capacity)
yatm.queue_refresh_infotext(pos, node)
end
function battery_bank_yatm_network.energy.capacity(pos, node)
local meta = minetest.get_meta(pos)
-- this value gets refreshed when the inventory changes and it rescans
return meta:get_int("energy_capacity")
end
function battery_bank_yatm_network.energy.receive_energy(pos, node, energy_left, dtime, ot)
local meta = minetest.get_meta(pos)
local mode = meta:get_string("mode")
if mode == "io" or mode == "i" then
local inv = meta:get_inventory()
local new_energy, used = invbat.receive_energy(inv, "batteries", energy_left)
meta:set_int("energy", new_energy)
yatm.queue_refresh_infotext(pos, node)
return used
end
return 0
end
function battery_bank_yatm_network.energy.get_usable_stored_energy(pos, node)
local meta = minetest.get_meta(pos)
local mode = meta:get_string("mode")
if mode == "io" or mode == "o" then
return meta:get_int("energy")
end
return 0
end
function battery_bank_yatm_network.energy.use_stored_energy(pos, node, energy_to_use)
local meta = minetest.get_meta(pos)
local mode = meta:get_string("mode")
if mode == "io" or mode == "o" then
local inv = meta:get_inventory()
local new_energy, used = invbat.consume_energy(inv, "batteries", energy_to_use)
meta:set_int("energy", new_energy)
yatm.queue_refresh_infotext(pos, node)
return used
end
return 0
end
local function battery_bank_on_construct(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("batteries", 16)
meta:set_string("mode", "io")
yatm.devices.device_on_construct(pos)
end
local function battery_bank_on_rightclick(pos, node, user)
local formspec_name = "yatm_energy_storage:battery_bank:" .. minetest.pos_to_string(pos)
local assigns = { pos = pos, node = node }
local formspec = get_battery_bank_formspec(pos, user, assigns)
nokore.formspec_bindings:show_formspec(user:get_player_name(), formspec_name, formspec, {
state = assigns,
on_receive_fields = receive_fields
})
end
local function battery_bank_on_dig(pos, node, digger)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("batteries") then
return minetest.node_dig(pos, node, digger)
end
return false
end
local function battery_bank_transition_device_state(pos, node, state)
local meta = minetest.get_meta(pos)
meta:set_string("network_state", state)
yatm.queue_refresh_infotext(pos, node)
end
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
if to_list == "batteries" then
return 1
else
return count
end
end
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if listname == "batteries" then
if Groups.has_group(stack:get_definition(), "battery") then
return 1
end
end
return 0
end
local function on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
if listname == "batteries" then
refresh_battery_bank_capacity(pos)
end
end
local function on_metadata_inventory_put(pos, listname, index, stack, player)
if listname == "batteries" then
refresh_battery_bank_capacity(pos)
end
end
local function on_metadata_inventory_take(pos, listname, index, stack, player)
if listname == "batteries" then
refresh_battery_bank_capacity(pos)
end
end
local sub_states = {}
for i = 0,4 do
sub_states["error" .. i] = {
tiles = {
"yatm_battery_bank_top.error.png",
"yatm_battery_bank_bottom.png",
"yatm_battery_bank_side.png",
"yatm_battery_bank_side.png^[transformFX",
"yatm_battery_bank_back.level." .. i .. ".png",
"yatm_battery_bank_front.level." .. i .. ".png"
},
}
sub_states["on" .. i] = {
tiles = {
-- "yatm_battery_bank_top.on.png",
{
name = "yatm_battery_bank_top.on.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0
},
},
"yatm_battery_bank_bottom.png",
"yatm_battery_bank_side.png",
"yatm_battery_bank_side.png^[transformFX",
"yatm_battery_bank_back.level." .. i .. ".png",
"yatm_battery_bank_front.level." .. i .. ".png"
},
}
end
yatm.devices.register_stateful_network_device({
basename = "yatm_energy_storage:battery_bank",
description = "Battery Bank",
groups = {
cracky = 1,
yatm_energy_device = 1,
},
drop = battery_bank_yatm_network.states.off,
sounds = yatm.node_sounds:build("metal"),
tiles = {
"yatm_battery_bank_top.off.png",
"yatm_battery_bank_bottom.png",
"yatm_battery_bank_side.png",
"yatm_battery_bank_side.png^[transformFX",
"yatm_battery_bank_back.level.0.png",
"yatm_battery_bank_front.level.0.png"
},
paramtype = "none",
paramtype2 = "facedir",
on_construct = battery_bank_on_construct,
on_rightclick = battery_bank_on_rightclick,
on_dig = battery_bank_on_dig,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_put = allow_metadata_inventory_put,
on_metadata_inventory_move = on_metadata_inventory_move,
on_metadata_inventory_put = on_metadata_inventory_put,
on_metadata_inventory_take = on_metadata_inventory_take,
yatm_network = battery_bank_yatm_network,
refresh_infotext = battery_bank_refresh_infotext,
transition_device_state = battery_bank_transition_device_state,
}, sub_states)
|
local shop = {
-- id, name, cheese, fraise, collector
head = {
[0] = { "-", 0, 0 },
[1] = { "Chapéu de Helicóptero", 500, 50 },
[2] = { "Chapéu de Palha", 200, 40 },
[3] = { "Capacete branco", 20, 0 },
[4] = { "Cartola", 200, 40 },
[5] = { "Chapéu de Sol", 100, 20 },
[6] = { "Chapéu Fedora", 500, 60 },
[7] = { "Capacete de Soldado", 200, 40 },
[8] = { "Capacete de Mineirador", 300, 40 },
[9] = { "Chapéu de General", 500, 60 },
[10] = { "Boina", 100, 40 },
[11] = { "Bandana do Naruto", 500, 60 },
[12] = { "Chifres", 200, 40 },
[13] = { "Aureola", 500, 60 },
[14] = { "Capacete Vicking", 300, 45 },
[15] = { "Máscara de Ladrão", 200, 40 },
[16] = { "Chapéu de Pirata", 300, 40 },
[17] = { "Chapéu de Bruxa", 200, 40 },
[18] = { "Chapéu Coco", 300, 45 },
[19] = { "Chapéu de Enfermeira", 300, 45 },
[20] = { "Chapéu Policial", 500, 40 },
[21] = { "Gorro Natalino", 20, 5 },
[22] = { "Chapéu de Cozinheiro", 300, 45 },
[23] = { "Tiara de Coelinho", 400, 50 },
[24] = { "Chapéu de pelo Russo", 50, 10 },
[25] = { "Chapéu de Cowboy", 250, 40 },
[26] = { "Chapéu de Limão", 300, 40 },
[27] = { "Chapéu Mandarim", 800, 0 },
[28] = { "Rabo de cavalo", 300, 45 },
[29] = { "Chapéu do Tio Sam", 500, 50, false },
[30] = { "Cabelo da Marge Simpson", 200, 40 },
[31] = { "Chapéu do Mario", 300, 40 },
[32] = { "Cabelo do Goku", 800, 70 },
[33] = { "Chapéu de Aniversário", 150, 25 },
[34] = { "Chapéu do Asterix", 400, 50 },
[35] = { "Coroa", 1000, 100 },
[36] = { "Dreads", 500, 60 },
[37] = { "Blackpower", 200, 40 },
[38] = { "Capacete do Faraó", 800, 80 },
[39] = { "Abóbora", 400, 40 },
[40] = { "Caveira com cabelo", 800, 100 },
[41] = { "Chifre de Rena", 600, 60 },
[42] = { "Boneco de Neve no Rosto", 500, 50 },
[43] = { "Cabelo Loiro", 200, 40 },
[44] = { "Chapéu com flores", 250, 40 },
[45] = { "Cabelo do Elvis Presley", 300, 50 },
[46] = { "Chapéu Chinês", 100, 10 },
[47] = { "Cocar", 1500, 150 },
[48] = { "Chapéu verde de praia", 300, 50 },
[49] = { "Chapéu de Bobo da Corte", 500, 50 },
[50] = { "Chapéu do Deadmau5", 400, 50 },
[51] = { "Chapéu de Aviador", 200, 40 },
[52] = { "Capacete Mega Man", 400, 40 },
[53] = { "Chapéu do Viewtiful Joe", 400, 40 },
[54] = { "Ovo", 50, 5 },
[55] = { "Cartola de Doende", 100, 10 },
[56] = { "Chapéu de Peixe", 400, 40 },
[57] = { "Chapéu de Gato", 400, 40 },
[58] = { "Aquário", 400, 40 },
[59] = { "Laço de presente", 300, 60 },
[60] = { "Cesta de Ovos", 400, 40 },
[61] = { "Cabelo laranja", 200, 40 },
[62] = { "Chapéu do Luffy", 300, 40 },
[63] = { "Cabelo do Sonic", 350, 0 },
[64] = { "Chapéu Turco", 300, 40 },
[65] = { "Cabelo Moreno", 200, 40 },
[66] = { "Chapéu do Link", 300, 40 },
[67] = { "Tubarão", 400, 40 },
[68] = { "Crina da Rainbow Dash", 200, 40 },
[69] = { "Crina da Twillight Sparkle", 200, 40 },
[70] = { "Crina da AppleJack", 200, 40 },
[71] = { "Crina da Pinkie Pie", 200, 40 },
[72] = { "Crina da Rarity", 200, 40 },
[73] = { "Crina da Fluttershy", 200, 40 },
[74] = { "Chapéu de Esquimó", 150, 40 },
[75] = { "Chapéu de Caçador", 50, 10 },
[76] = { "Sacola de papel", 200, 40 },
[77] = { "Chapéu Mexicano", 250, 40 },
[78] = { "Chapéu do Ash Ketchum", 300, 40 },
[79] = { "Gorro de dormir", 250, 40 },
[80] = { "Faca sangrenta", 500, 50 },
[81] = { "Lençol fantasma", 450, 40 },
[82] = { "Chapéu vampiro", 300, 40 },
[83] = { "Turbante", 300, 40 },
[84] = { "Árvore Natalina", 400, 40 },
[85] = { "Meia natalina", 300, 40 },
[86] = { "Chapéu contest Krissim", 1000, 100 },
[87] = { "Máscara de carnaval", 800, 100 },
[88] = { "Penacho de Palha", 200, 40 },
[89] = { "Chapéu de pescador", 400, 40 },
[90] = { "Varinha com queijo", 400, 40 },
[91] = { "Concha", 400, 40 },
[92] = { "Chapéu de capitão", 400, 40 },
[93] = { "Chapéu de marinheiro", 400, 40 },
[94] = { "Galinha", 700, 40 },
[95] = { "Chapéu de bolo", 0, 0 },
[96] = { "Cabelo do Shadow", 400, 40 },
[97] = { "Bolas de sorvete", 400, 40 },
[98] = { "Juba de Leão", 400, 40 },
[99] = { "Coroa de Princesa", 200, 40 },
[101] = { "Chapéu Hokage", 300, 40 },
[102] = { "Capacete Gladiador", 500, 40 },
[103] = { "Chapéu de Velas", 250, 40 },
[104] = { "Cubo de Gelo", 600, 60 },
[105] = { "Chapéu de Sapo", 100, 10 },
[106] = { "Chapéu de Pintinho", 300, 20 },
[107] = { "Chapéu de Panda", 400, 50 },
[108] = { "Chapéu de Formatura", 500, 40 },
[109] = { "Côco", 400, 40 },
[110] = { "Cueca", 20, 5 },
[111] = { "Chifres de Bóde", 400, 40 },
[112] = { "Coroa de Folhas", 200, 30 },
[113] = { "Touca de frio", 300, 40 },
[114] = { "Ursinho de pelúcia", 800, 100 },
[115] = { "Chapéu de fitas", 250, 40 },
[116] = { "Penteado laranja", 600, 40 },
[117] = { "Sino com asas", 500, 100 },
[118] = { "Capacete Egípcio", 600, 60 },
[119] = { "Polvo", 350, 40 },
[120] = { "Livro aberto", 400, 60 },
[121] = { "Aranha", 600, 70 },
[122] = { "Chifre de unicórnio", 250, 40 },
[123] = { "Capuz", 2000, 100 },
[124] = { "Cupcake", 500, 50 },
[125] = { "Gorro do Bob Marley", 1600, 100 },
[126] = { "Banana", 450, 40 },
[127] = { "Lenço vermelho", 350, 40 },
[128] = { "Laço vermelho", 200, 40 },
[129] = { "Vassoura", 400, 40 },
[130] = { "Gorro de frio", 400, 40 },
[131] = { "Queijo", 350, 40 },
[132] = { "Coroa do Rei", 1000, 100 },
[133] = { "Chapéu arco-íris", 1200, 100 },
[134] = { "Chapéu da Marmota", 400, 40 },
[135] = { "Chapéu do ano novo chinês", 350, 40 },
[136] = { "Concha de Caracol", 350, 40 },
[137] = { "Chapéu de Padeiro", 200, 40 },
[138] = { "Cocar Shaman", 3001, 0 },
[139] = { "Carcaça de Dinossauro", 1200, 120 },
[140] = { "Capacete de Astronauta", 1000, 100 },
[141] = { "Boné da Moranguinho", 800, 80 },
[142] = { "Capacete Futebol Americano", 500, 40 },
[143] = { "Boné azul", 300, 40 },
[144] = { "Gorro da Mamãe Noel", 800, 80 },
[145] = { "Chapéu Abacaxi", 600, 50 },
[146] = { "Desentupidor", 250, 40 },
[147] = { "Castelo de Areia", 250, 40 },
[148] = { "Chapéu de Peixe Vermelho", 800, 80 },
[149] = { "Chapéu de Construtor", 300, 40 },
--[150] = { "Chapéu de Crocodilo", 0, 0, true },
--[151] = { "Chapéu Pimp", 0, 0, true },
--[152] = { "Capacete do Sauron", 0, 0, true },
--[153] = { "Capacete de motociclista", 0, 0, true },
--[154] = { "Coroa de louros", 0, 0, true },
--[155] = { "Botão de Tulipa", 0, 0, true },
--[156] = { "Trevo de 4 folhas", 0, 0, true },
--[157] = { "Boina cinza", 0, 0, true },
--[158] = { "Chapéu do Inspetor Bugiganga", 0, 0, true },
--[159] = { "Prato", 0, 0, true },
--[160] = { "Crânio de Pteranodonte", 0, 0, true },
--[161] = { "Chapéu de cogumelo", 0, 0, true },
--[162] = { "Chapéu de melancia", 0, 0, true },
--[163] = { "Chapéu do Capitão America", 0, 0, true },
[164] = { "Capacete do Loki", 500, 60, true },
--[165] = { "Durião", 0, 0, true },
[166] = { "Cabeça de cavalo", 1000, 100, true },
--[167] = { "Cérebro", 0, 0, true },
--[168] = { "Chapéu de bruxa com doces", 0, 0, true },
[169] = { "Sombrero do Dia dos Mortos", 800, 100, true },
[170] = { "Capuz do Decidueye", 500, 60, true },
--[171] = { "Folha", 0, 0, true },
--[172] = { "Boné do Dipper Pines", 0, 0, true },
[173] = { "Capuz do Umbreon", 2000, 100, true },
--[174] = { "Casco azul do Mario Kart", 0, 0, true },
--[175] = { "Chapéu de guarda-chuva", 0, 0, true },
--[176] = { "Chapéu do Tony Tony Chopper", 0, 0, true },
--[177] = { "Chapéu de quati", 0, 0, true },
--[178] = { "Concha de Slowking", 0, 0, true },
--[179] = { "Chapéu de Verka Serduchka", 0, 0, true },
[180] = { "Chapéu da Marisa Kirisame", 500, 60, true },
--[181] = { "Chapéu de crânio de Gnar", 0, 0, true },
[182] = { "Chapéu de palha com flor", 0, 0, },
--[183] = { "Chapéu da Selene", 0, 0, true },
--[184] = { "Bandana da May", 0, 0, true },
[185] = { "Chapéu da Fashion Squad", 0, 0, },
[186] = { "Chapéu da Lillie", 500, 60, true },
--[187] = { "Chapéu do Carrots", 0, 0, true },
--[188] = { "Chapéu Shako", 0, 0, true },
--[189] = { "Tiara de rena", 0, 0, true },
--[190] = { "Capacete de bombeiro", 0, 0, true },
--[191] = { "Chapéu de Magikarp", 0, 0, true },
--[192] = { "Chapéu do The Cat in the Hat", 0, 0, true },
--[193] = { "Chapéu da Gloria", 0, 0, true },
--[194] = { "Chapéu de funcionário da Krusty Krab", 0, 0, true },
--[195] = { "Chapéu de São Patrício", 0, 0, true },
--[196] = { "Tiara de abelha", 0, 0, true },
[197] = { "Touca de bebê", 400, 50, true },
[198] = { "Chapéu de pombo", 1500, 100, true },
};
eye = {
[0] = { "-", 0, 0 },
[1] = { "Óculos de Sol", 200, 30 },
[2] = { "Óculos de Coração", 200, 30 },
[3] = { "Óculos de SOl mal", 200, 30 },
[4] = { "Monóculo", 200, 30 },
[5] = { "Tapa-olho", 300, 40 },
[6] = { "Máscara de Mergulhador", 800, 70 },
[7] = { "Óculos 3D", 50, 10 },
[8] = { "Óculos", 50, 10 },
[9] = { "Cílios Femininos", 20, 5 },
[10] = { "Óculos de Listras", 100, 25 },
[11] = { "Máscara do Ciclope", 200, 30 },
[12] = { "Máscara Kitsune", 400, 40 },
[13] = { "Nariz de batata", 0, 0 },
[14] = { "Máscara de carnaval", 100, 20 },
[15] = { "Chapéu de Creeper", 400, 40 },
[16] = { "Bandana Japan Expo", 0, 0 },
[17] = { "Máscara de Múmia", 500, 50 },
[18] = { "Olhos com mola", 500, 50 },
[19] = { "Caveira", 500, 50 },
[20] = { "Óculos Nerd", 250, 40 },
[21] = { "Caveira de Dinossauro", 1000, 100 },
[22] = { "Tapa-olho branco", 250, 40 },
[23] = { "Protetor de Ski", 500, 50 },
[24] = { "Óculos de aviador", 450, 40 },
[25] = { "Arranhão", 300, 40 },
[26] = { "Máscara do Jason", 700, 60 },
--[27] = { "Capacete da Garnet", 0, 0, true },
--[28] = { "Óculos Thug life", 0, 0, true },
--[29] = { "Cabelo do Tracer", 0, 0, true },
[30] = { "Máscara Deku", 300, 40, true },
--[31] = { "Olho de Cyborg", 0, 0, true },
--[32] = { "Máscara da Peste", 0, 0, true },
[33] = { "Máscara do Coringa", 300, 40, true },
--[34] = { "Óculos de Abóbora", 0, 0, true },
--[35] = { "Óculos da DJ Pon-3", 0, 0, true },
--[36] = { "Óculos da Homura", 0, 0, true },
--[37] = { "Óculos de Natal", 0, 0, true },
};
ear = {
[0] = { "-", 0, 0 },
[1] = { "Laço rosa", 100, 40 },
[2] = { "Aranha", 200, 40 },
[3] = { "Brinco bola de natal", 50, 10 },
[4] = { "Flor", 20, 5 },
[5] = { "Headphones", 300, 0 },
[6] = { "Brinco de coração", 150, 40 },
[7] = { "Brinco Poisson", 400, 40 },
[8] = { "Brinco Estrela do Mar", 400, 40 },
[9] = { "Queijo", 0, 0 },
[10] = { "Item 4001", 4001, 0 },
[11] = { "Tapa-ouvidos natalinos", 500, 50 },
[12] = { "Brinco pirulito de natal", 60, 20 },
[13] = { "Tiara de Rosa", 200, 40 },
[14] = { "Tiara de Coelho", 200, 40 },
[15] = { "Máscara contest Holldine", 600, 60 },
[16] = { "Brinco patinho", 250, 30 },
[17] = { "Óculos de espião", 400, 40 },
[18] = { "Brinco duplo", 40, 10 },
[19] = { "Laço branco", 100, 10 },
[20] = { "Parafusos", 250, 40 },
[21] = { "Flecha", 300, 40 },
[22] = { "Brinco de caveira", 400, 40 },
[23] = { "Cristais de gelo", 50, 10 },
[24] = { "Brinco de coelho", 200, 30 },
[25] = { "Flor do Havaí", 600, 100 },
[26] = { "Visco", 400, 40 },
[27] = { "Espinhos de ferro", 1000, 80 },
[28] = { "Laço de coração", 600, 40 },
[29] = { "Brinco de carnaval", 400, 40 },
[30] = { "Brinco da Deusa Shaman", 250, 40 },
[31] = { "Ferradura de Ouro", 400, 400 },
[32] = { "Laço com Sino", 250, 30 },
[33] = { "Laço de bolinhas de natal", 200, 40 },
[34] = { "Laço com penas", 600, 80 },
[35] = { "Laço de Borboleta", 600, 80 },
[36] = { "Touca-rato de inverno", 500, 80 },
[37] = { "Brinco de guizo", 100, 20 },
--[38] = { "Fones de ouvido", 0, 0, true },
--[39] = { "Brinco de cerejas", 0, 0, true },
--[40] = { "Coroa de girassol", 0, 0, true },
--[41] = { "Brinco de laranja", 0, 0, true },
--[42] = { "Cabelo da Cat Noir", 0, 0, true },
--[43] = { "Flor de baunilha", 0, 0, true },
--[44] = { "Abóbora", 0, 0, true },
--[45] = { "Coroa de flores", 0, 0, true },
--[46] = { "Capacete do Skyrim Iron", 0, 0, true },
--[47] = { "Fones de rena", 0, 0, true },
--[48] = { "Glitter", 0, 0, true },
--[49] = { "Floco de neve", 0, 0, true },
--[50] = { "Asas do Dia dos Namorados", 0, 0, true },
[51] = { "Brinco Kickstarter", 50, 5 },
--[52] = { "Flor de Hibisco da Selene", 0, 0, true },
--[53] = { "Estrela cadente", 0, 0, true },
--[54] = { "Antenas do Saiki Kusuo", 0, 0, true },
--[55] = { "Morcegos", 0, 0, true },
--[56] = { "Brinco de coração", 0, 0, true },
[57] = { "Rosa", 600, 40, true },
[58] = { "Ovos de Páscoa", 0, 0, },
[59] = { "Penas de Shaman", 0, 0, },
[60] = { "Arco-íris", 0, 0, },
[61] = { "Brinco do Tanjiro Kamado", 400, 50, },
};
mouth = {
[0] = { "-", 0, 0 },
[1] = { "Bigode", 100, 20 },
[2] = { "Trigo", 25, 10 },
[3] = { "Gravata borboleta", 150, 25 },
[4] = { "Fumo", 400, 40 },
[5] = { "Rosa", 300, 40 },
[6] = { "Sabre de Luz verde", 300, 40 },
[7] = { "Sabre de Luz vermelho", 300, 40 },
[8] = { "Facão", 400, 50 },
[9] = { "Máscara de Gás", 400, 40 },
[10] = { "Trevo de 4 folhas", 20, 10 },
[11] = { "Esqueleto de peixe", 400, 40 },
[12] = { "Chupeta", 150, 20 },
[13] = { "Pirulito", 150, 25 },
[14] = { "Máscara de cirurgião", 50, 10 },
[15] = { "Abóbora", 250, 40 },
[16] = { "Nariz de palhaço", 50, 10 },
[17] = { "Dentes grandes", 40, 20 },
[18] = { "Picareta Minecraft", 400, 40 },
[19] = { "Morango", 0, 0 },
[20] = { "Pincel", 20, 5 },
[21] = { "Sorvete francês", 60, 10 },
[22] = { "Osso", 100, 10 },
[23] = { "Rosquinha", 100, 10 },
[24] = { "Dentes de vampiro", 200, 40 },
[25] = { "Chocolate", 100, 20 },
[26] = { "Biscoito", 100, 20 },
[27] = { "Caixa de chocolate", 150, 40 },
[28] = { "Buquê de rosas", 300, 60 },
[29] = { "Cenoura", 50, 10 },
[30] = { "Pretzel", 200, 40 },
[31] = { "Bambu", 200, 40 },
[32] = { "Leque Japan Expo", 0, 0 },
[33] = { "Diploma", 300, 40 },
[34] = { "Sardinha", 400, 40 },
[35] = { "Bala", 100, 20 },
[36] = { "Bengala natalino", 200, 40 },
[37] = { "Cookie", 300, 40 },
[38] = { "Maçã do amor", 200, 40 },
[39] = { "Pandeiro", 50, 8 },
[40] = { "Bico de galinha", 300, 60 },
[41] = { "Apito", 300, 40 },
[42] = { "Mochila", 400, 50 },
[43] = { "Bigode branco", 400, 40 },
[44] = { "Fondie", 250, 40 },
[45] = { "Língua", 100, 40 },
[46] = { "Sanduíche", 500, 50 },
[47] = { "Corneta", 350, 40 },
[48] = { "Mamadeira", 250, 40 },
[49] = { "Pedaço de Torta", 150, 40 },
[50] = { "Bule", 300, 40 },
[51] = { "Carta do Dia dos Namorados", 250, 40 },
[52] = { "Espátula de bolo", 250, 40 },
[53] = { "Bandeira de Racing", 600, 40 },
[54] = { "Martelo da Idade Média", 600, 60 },
[55] = { "Caixa de presente", 400, 50 },
[56] = { "Shuriken", 450, 50 },
[57] = { "Barba negra", 400, 40 },
[58] = { "Regador", 350, 40 },
[59] = { "Baguete", 250, 40 },
[60] = { "Coxa de frango", 150, 40 },
[61] = { "Balde de areia", 300, 40 },
[62] = { "Martelo", 250, 40 },
[63] = { "Motoserra", 400, 40 },
--[64] = { "Filtro de cachorro", 0, 0, true },
--[65] = { "Tacos", 0, 0, true },
--[66] = { "Bola de chiclete", 0, 0, true },
--[67] = { "Pedaço de melancia", 0, 0, true },
[68] = { "Caveira Mexicana", 500, 60, true },
--[69] = { "Mordaça", 0, 0, true },
[70] = { "Fatia de pizza", 500, 40, true },
};
neck = {
[0] = { "-", 0, 0 },
[1] = { "Cachecol francês", 200, 40 },
[2] = { "Lenço vermelho", 200, 40 },
[3] = { "Barba", 60, 20 },
[4] = { "Colar de flores", 50, 20 },
[5] = { "Gravata preta", 80, 20 },
[6] = { "Cachecol verde", 50, 20 },
[7] = { "Sino", 150, 20 },
[8] = { "Barril de bebida", 100, 20 },
[9] = { "Cachecol de Halloween", 150, 40 },
[10] = { "Grinalda vermelha", 100, 20 },
[11] = { "Gravata Borboleta", 200, 20 },
[12] = { "Guarda-sol", 300, 40 },
[13] = { "Máquina Fotográfica", 400, 40 },
[14] = { "Gravata laranja", 200, 40 },
[15] = { "Medalha", 150, 25 },
[16] = { "Amuleto de olho grego", 200, 40 },
[17] = { "Gargantilha", 150, 40 },
[18] = { "Fone de ouvido", 450, 40 },
[19] = { "Ombreira", 500, 50 },
[20] = { "Estrela de Sheriff", 200, 40 },
[21] = { "Blusa laranja amarrada", 150, 40 },
[22] = { "Arco-íris", 350, 40 },
[23] = { "Chapéu de Vitória Régia", 600, 50 },
[24] = { "Cachecol da Bandeira de Racing", 450, 40 },
[25] = { "Laço da chapeuzinho vermelho", 150, 35 },
[26] = { "Lenço ninja", 600, 60 },
[27] = { "Colar de flores havaianas", 250, 40 },
[28] = { "Colar de Folhas", 150, 40 },
[29] = { "Foice", 600, 50 },
[30] = { "Bóia salva-vidas", 300, 40 },
[31] = { "Gola rufo", 300, 40 },
[32] = { "Guirlanda", 250, 40 },
[33] = { "Pirulito de bengala", 800, 100 },
--[34] = { "Asas de Shaman", 0, 0, true },
--[35] = { "Asas de cúpido", 0, 0, true },
--[36] = { "Gola de Dilophosaurus", 0, 0, true },
[37] = { "Asas de Borboleta", 400, 50, true },
--[38] = { "Asas de morcego", 0, 0, true },
--[39] = { "Lenço", 0, 0, true },
[40] = { "Laço do Dia dos Namorados", 400, 50, true },
--[41] = { "Coleira do Scooby-Doo", 0, 0, true },
--[42] = { "Cachecol da Ylgr", 0, 0, true },
[43] = { "Laço com estrela", 400, 50, true },
[44] = { "Gravata de morcego", 0, 0 },
--[45] = { "Colar do N", 0, 0 },
[46] = { "Lenço da Daphne Blake", 400, 40 },
[47] = { "Gravata da Kagamine Rin", 600, 80 },
};
hair_style = {
[0] = { "-", 0, 0 },
[1] = { "Cabelo punk", 400, 40 },
[2] = { "Cabelo bagunçado", 400, 40 },
[3] = { "Cabelo loiro", 400, 40 },
[4] = { "Franja marrom", 400, 40 },
[5] = { "Franja azul", 400, 40 },
[6] = { "Crina da Apple Bloom", 300, 40 },
[7] = { "Crina da Scootaloo", 300, 40 },
[8] = { "Crina da Sweetie Belle", 300, 40 },
[9] = { "Cabelo Hatsune Miku", 400, 40 },
[10] = { "Cabelo do Kagamine Rin", 200, 40 },
[11] = { "Cabelo loiro de franja", 200, 40 },
[12] = { "Cabelo masculino de periquito", 200, 40 },
[13] = { "Cabelo da princesa Brave", 400, 40 },
[14] = { "Blackpower estiloso", 150, 20 },
[15] = { "Cabelo da Emília", 250, 40 },
[16] = { "Penteado do Levi", 250, 40 },
[17] = { "Cabelo da Elsa", 1000, 100 },
[18] = { "Bobs da Dona Florinda", 200, 40 },
[19] = { "Cabelo da Deusa Shaman", 1000, 110 },
[20] = { "Cabelo Dragon Ball", 800, 80 },
[21] = { "Touca rosa de gato", 900, 100 },
[22] = { "Coque", 300, 40 },
[23] = { "Cabelo do IT", 300, 40 },
--[24] = { "Peruca de juíz", 0, 0, true },
[25] = { "Cabelo ajeitado", 250, 40 },
[26] = { "Cabelo comprido com trança", 400, 60 },
--[27] = { "Cabelo do mulher das cavernas", 0, 0, true },
--[28] = { "Cabelo do Arnold", 0, 0, true },
--[29] = { "Cabelo da Cammy", 0, 0, true },
--[30] = { "Cabelo do Guile", 0, 0, true },
--[31] = { "Sorvete derretido", 0, 0, true },
--[32] = { "Cabelo do Inkling", 0, 0, true },
[33] = { "Penteado Poney com Coroa", 400, 50 },
[34] = { "Penteado Poney", 400, 50 },
[35] = { "Penteado Arlequina", 400, 60 },
[36] = { "Cabelo do Chibiusa", 300, 40, true },
--[37] = { "Cabelo Ombre Feminino", 0, 0, true },
--[38] = { "Cabelo Verde com trança", 0, 0, true },
--[39] = { "Cabelo de Rockeiro", 0, 0, true },
--[40] = { "Cabelo do Izuku", 0, 0, true },
[41] = { "Cabelo do Varian", 600, 70, true },
--[42] = { "Cabelo da Zero Two", 0, 0, true },
--[43] = { "Cabelo da Tsuyu", 0, 0, true },
--[44] = { "Cabelo da Ladybug", 0, 0, true },
--[45] = { "Cabelo com aranha", 0, 0, true },
--[46] = { "Cabelo da Reimu", 0, 0, true },
--[47] = { "Cabelo da Mabel Pines", 0, 0, true },
--[48] = { "Cabelo da Ylgr", 0, 0, true },
--[49] = { "Cabelo da Inuyasha", 0, 0, true },
--[50] = { "Cabelo da Annie Leonhart", 0, 0, true },
[51] = { "Cabelo do Lucio", 600, 70, true },
--[52] = { "Cabelo da Octoling", 0, 0, true },
[53] = { "Penteado Schezo Wegey", 300, 30 },
[54] = { "Penteado Ray", 400, 50 },
[55] = { "Penteado Emma", 400, 50 },
--[56] = { "Cabelo da Selene", 0, 0, true },
--[57] = { "Cabelo do All Might", 0, 0, true },
--[58] = { "Cabelo da Toph", 0, 0, true },
--[59] = { "Cabelo do Arthur", 0, 0, true },
--[60] = { "Cabelo da Link", 0, 0, true },
--[61] = { "Cabelo da May", 0, 0, true },
--[62] = { "Cabelo da Lillie", 0, 0, true },
--[63] = { "Cabelo da MEIKA Hime", 0, 0, true },
--[64] = { "Cabelo da DJ Pon-3", 0, 0, true },
--[65] = { "Cabelo do Senku Ishigami", 0, 0, true },
--[66] = { "Cabelo da Homura", 0, 0, true },
--[67] = { "Cabelo do Connor", 0, 0, true },
--[68] = { "Cabelo azul com coração", 0, 0, true },
--[69] = { "Cabelo da Isabelle", 0, 0, true },
--[70] = { "Cabelo da Cozy Glow", 0, 0, true },
[71] = { "Penteado Dawn", 400, 60, true },
--[72] = { "Cabelo do N", 0, 0, true },
[73] = { "Cabelo da Sugar Belle", 400, 50, true },
[74] = { "Cabelo da Daphne Blake", 400, 60, true },
[75] = { "Cabelo Ombre Masculino", 400, 60, true },
[76] = { "Cabelo do Todoroki", 400, 60, true },
[77] = { "Cabelo do Tanjiro Kamado ", 400, 60, true },
};
tail = {
[0] = { "-", 0, 0 },
[1] = { "Diamante", 2000, 200 },
[2] = { "Estrela", 800, 80 },
[3] = { "Laço rosa", 1000, 100 },
[4] = { "Coração", 1000, 150 },
[5] = { "Ovo de páscoa", 1000, 80 },
[6] = { "Sol", 1500, 150 },
[7] = { "Lua", 1500, 150 },
[8] = { "Círculos dourados", 2000, 200 },
[9] = { "Abóbora", 1000, 100 },
[10] = { "Sino", 800, 80 },
[11] = { "Anéis", 1500, 150 },
[12] = { "Trevo de 4 folhas", 800, 80 },
[13] = { "Berimbau", 900, 100 },
[14] = { "Capacete Egípcio", 1000, 100 },
[15] = { "Bola de futebol", 1500, 150 },
[16] = { "Concha", 1000, 100 },
[17] = { "Meia", 800, 80 },
[18] = { "Ursinho de Goma", 1000, 100 },
[19] = { "Espanta-pesadelos", 3000, 200 },
[20] = { "Nota musical", 1000, 80 },
[21] = { "Morcego", 1500, 150 },
[22] = { "Lamparina Chinesa", 1500, 100 },
[23] = { "Penas de Carnaval", 1500, 120 },
[24] = { "Anvil God", 1200, 120 },
[25] = { "Pote de Ouro", 1000, 100 },
[26] = { "Asa shaman", 1200, 100 },
[27] = { "Balão", 1000, 120 },
[28] = { "Planeta", 1000, 80 },
[29] = { "Bola de Demolição", 800, 80 },
[30] = { "Rato e Terra", 900, 100 },
--[31] = { "Pena", 0, 0, true },
--[32] = { "Avelã", 0, 0, true },
--[33] = { "Golfinho", 0, 0, true },
--[34] = { "Laço", 0, 0, true },
[35] = { "Borboleta", 1500, 180, true },
[36] = { "Lampião", 1200, 120, true },
[37] = { "Trouxa de roupa", 1200, 120, true },
[38] = { "Piñata", 1500, 120, true },
[39] = { "Martisor", 1500, 120, true },
};
contact_lens = {
[0] = { "-", 0, 0 },
[1] = { "Olho laranja", 150, 40 },
[2] = { "Olho azul", 100, 30 },
[3] = { "Olho rosa", 150, 40 },
[4] = { "Olho verde", 100, 30 },
[5] = { "Olho raivoso vermelho", 250, 100 },
[6] = { "Olho raivoso verde", 200, 80 },
[7] = { "Olho raivoso azul", 200, 80 },
[8] = { "Olho raivoso amarelo", 250, 100 },
[10] = { "Olho cílios venticais", 200, 80 },
[11] = { "Olho azul vidrado", 170, 60 },
[12] = { "Olho cílios horizontais", 120, 30 },
[13] = { "Olho fechado", 160, 50 },
[14] = { "Olho raivoso laranja", 200, 80 },
[15] = { "Olho raivoso roxo", 250, 100 },
[16] = { "Olho raivoso rosa", 250, 100 },
[17] = { "Olho grande lilás", 180, 70 },
[18] = { "Olho grande verde", 180, 70 },
[19] = { "Olho grande azul", 180, 70 },
[20] = { "Olho grande laranja", 180, 70 },
[22] = { "Olho grande amarelo", 180, 70 },
[23] = { "Olho grande vermelho", 180, 70 },
[24] = { "Olho grande rosa", 180, 70 },
[25] = { "Olho grande marrom", 180, 70 },
[26] = { "Olho grande cinza", 180, 70 },
[27] = { "Olho simples preto", 100, 30, },
},
hand = {
[0] = { "-", 0, 0 },
[1] = { "Nabo", 1200, 200 },
[2] = { "Pulseira", 1100, 180 },
--[3] = { "Bola de Futebol", 0, 0, true },
--[4] = { "Arma d'água", 0, 0, true },
--[5] = { "Varinha", 0, 0, true },
[6] = { "Bóia", 1200, 200, true },
[7] = { "Pokeball", 1400, 250, true },
--[8] = { "Urso de pelúcia", 0, 0, true },
--[9] = { "Xícara de café", 0, 0, true },
--[10] = { "Varinha mágica", 0, 0, true },
--[11] = { "Mão do Thanos", 0, 0, true },
--[12] = { "Pirulito de bengala", 0, 0, true },
--[13] = { "Algodão-doce", 0, 0, true },
--[14] = { "Microfone", 0, 0, true },
--[15] = { "Picolé", 0, 0, true },
[16] = { "Espada", 1400, 200, true },
--[17] = { "Varinha de coração", 0, 0, true },
[18] = { "Tridente", 1300, 230, true },
[19] = { "Bastão de Baiseball", 1400, 250, true },
--[20] = { "Chave Inglesa", 0, 0, true },
[21] = { "Rosa", 1100, 180 },
--[22] = { "Estpátula do Bob Esponja", 0, 0, true },
[23] = { "Chocalho", 1200, 200, true },
[24] = { "Ovo de Páscoa", 1100, 180, true },
[25] = { "Presente", 1200, 200, true },
[26] = { "Saco de pipoca", 1200, 200, true },
[27] = { "Bola de Hugby", 1200, 200, true },
},
fur = {
[-7] = { "Cor preta", 3000, 150 },
[-6] = { "Cor amarelo-dourada", 3000, 150 },
[-5] = { "Cor cinza escuro", 3000, 150 },
[-4] = { "Cor branca", 3000, 150 },
[-3] = { "Cor cinza claro", 3000, 150 },
[-2] = { "Cor marrom", 1000, 50 },
[-1] = { "Cor bege", 1000, 50 },
[1] = { "Padrão", 0, 0 },
[2] = { "Pelo de Porquinho-da-índia", 6000, 300 },
[3] = { "Pelo de Gato Siamês", 6000, 300 },
[4] = { "Pelo Acinzentado", 6000, 300 },
[5] = { "Pelo Branco e marrom com listras pretas", 6000, 300 },
[6] = { "Pelo de Hamster", 6000, 300 },
[7] = { "Pelo de Gambá", 8000, 350 },
[8] = { "Pelo de Tigre", 10000, 400 },
[9] = { "Pelo de Raposa", 7000, 400 },
[10] = { "Pelo de Esqueleto", 0, 0 },
[11] = { "Pelo contest Sovenasark", 7000, 350 },
[12] = { "Pelo contest Kreature", 6500, 325 },
[13] = { "Pelo contest Squeakymaus", 6000, 300 },
[14] = { "Pelo de Rato-das-neves", 6000, 300 },
[15] = { "Pelo de Panda vermelho", 6000, 400 },
[16] = { "Pelo de Coelho", 0, 0 },
[17] = { "Pelo de Zebra", 6000, 300 },
[18] = { "Pelo de Panda", 6000, 400 },
[19] = { "Pelo Lunar", 7000, 400 },
[20] = { "Pelo Solar", 7000, 400 },
[21] = { "Pelo de Leopardo", 6000, 300 },
[22] = { "Pelo Selvagem", 6000, 300 },
[23] = { "Pelo Preto de Tattoo de Esqueleto", 7000, 500 },
[24] = { "Pelo de Leopardo-das-neves", 7000, 500 },
[25] = { "Pelo de Coração", 5000, 360 },
[26] = { "Pelo da Sorte", 7000, 400 },
[27] = { "Pelo de Tucano", 6000, 350 },
[28] = { "Pelo de Páscoa", 8000, 450 },
[29] = { "Pelo Egípcio", 7000, 400 },
[30] = { "Pelo da Copa 2015", 7000, 400 },
[31] = { "Pelo de Girafa", 6000, 350 },
[32] = { "Pelo de Nuvem", 7000, 400 },
[34] = { "Pelo de Rottweiler", 6000, 350 },
[36] = { "Pelo de Lêmure", 7000, 400 },
[38] = { "Pelo de Lêmure-de-cauda-anelada", 6000, 350 },
[39] = { "Pelo rosa de Cupido", 7000, 400 },
[41] = { "Pelo de Gazela", 6000, 350 },
[43] = { "Pelo de Ovo de Páscoa", 7000, 400 },
[44] = { "Pelo de Pinguim", 6500, 400 },
[46] = { "Pelo de Música", 7500, 450 },
[47] = { "Pelo do Tails", 7000, 375 },
[48] = { "Pelo de Volta às aulas", 8000, 500 },
[49] = { "Pelo de Vaca", 6000, 400 },
[50] = { "Pelo de Drácula", 7000, 450 },
[52] = { "Pelo de Múmia", 8000, 500 },
[53] = { "Pelo de Esquimó", 6000, 400 },
[54] = { "Pelo do Hantaro", 7000, 350 },
[55] = { "Pelo Real", 6500, 400 },
[56] = { "Pelo de Unicórnio", 7000, 400 },
[57] = { "Pelo de Dragão", 5500, 350 },
[58] = { "Pelo do Dia dos Namorados", 7000, 400 },
[59] = { "Pelo de Carnaval", 7000, 400 },
[60] = { "Pelo da Água", 6500, 350 },
[61] = { "Pelo da Deusa Shaman", 8500, 550 },
[62] = { "Pelo de Irlandês (St.Patrik)", 6500, 350 },
[63] = { "Pelo de Cozinheiro", 6000, 380 },
[64] = { "Pelo de Esquilo", 6000, 350 },
[65] = { "Pelo da Chapeuzinho Vermelho", 5000, 300 },
[67] = { "Pelo do Vento", 5000, 0 },
[68] = { "Pelo de Terra", 10000, 0 },
[69] = { "Pelo de Fogo", 15000, 0 },
[70] = { "Pelo de Gato", 6000, 350 },
[71] = { "Pelo Militar", 6000, 350 },
[72] = { "Pelo de Tubarão", 7000, 400 },
[73] = { "Pelo Espacial", 7500, 430 },
[74] = { "Pelo de Joaninha", 6000, 350 },
[76] = { "Pelo das Olimpíadas", 6000, 400 },
[77] = { "Pelo de Orca", 6000, 450 },
[78] = { "Pelo de Lobisomem", 8000, 450 },
[79] = { "Pelo de Ceifador", 5500, 350 },
[80] = { "Pelo de Biscoito de Gengibre", 6000, 400 },
[81] = { "Pelo do Totoro", 7000, 500 },
[82] = { "Pelo do Tigre Escuro", 6000, 450 },
[83] = { "Pelo de Morango", 5500, 350 },
[84] = { "Pelo de Peixe Dourado", 6000, 400 },
[85] = { "Pelo de Calopsita", 5500, 400 },
[86] = { "Pelo de Arara Azul", 5500, 400 },
[87] = { "Pelo da Dory", 5500, 350 },
[88] = { "Pelo de Lily", 6000, 400 },
[89] = { "Pelo de Coruja da noite", 5500, 400 },
[90] = { "Pelo de Elefante", 5500, 400 },
[91] = { "Pelo de Pato", 5500, 400 },
[92] = { "Pelo de Yeti", 6000, 500 },
[93] = { "Pelo de Coruja", 5500, 400, true },
[94] = { "Pelo de Mordecai", 5500, 400, true },
[95] = { "Pelo de Eevee", 5500, 500, true },
[96] = { "Pelo de Carneiro", 5500, 400, true },
[97] = { "Pelo de Gambá claro", 5500, 400, true },
[98] = { "Rato de Bolo Red Velvet", 5500, 400, true },
[99] = { "Pelo de Marill", 6000, 450, true },
--[100] = { "Pelo de Banana com chocolate", 0, 0, true },
--[101] = { "Pelo de Veado", 0, 0, true },
--[102] = { "Pelo de Furão", 0, 0, true },
--[103] = { "Pelo de Hiena", 0, 0, true },
--[104] = { "Pelo de Raposa de Funcho", 0, 0, true },
--[105] = { "Pelo de Robin Europeu", 0, 0, true },
[106] = { "Pelo de Estrela", 5500, 400, true },
--[107] = { "Pelo de Litten", 0, 0, true },
--[108] = { "Pelo de Leão", 0, 0, true },
[109] = { "Pelo de Falcão Pigmeu", 10000, 500, true },
[110] = { "Pelo de Tigre branco", 10000, 500 },
--[111] = { "Pelo de Lêmure", 0, 0, true },
--[112] = { "Pelo de Gambá", 0, 0, true },
--[113] = { "Pelo de Banguela", 0, 0, true },
--[114] = { "Pelo de Porco-espinho", 0, 0, true },
[115] = { "Pelo do Dia dos Mortos", 5000, 400, true },
--[116] = { "Pelo de Vaporeon", 0, 0, true },
--[117] = { "Pelo de Quati", 0, 0, true },
--[119] = { "Pelo de Caracal", 0, 0, true },
--[120] = { "Pelo de Cavalo", 0, 0, true },
--[121] = { "Pelo de Ursinhos Carinhosos", 0, 0, true },
--[122] = { "Pelo de Axolote", 0, 0, true },
--[123] = { "Pelo de Pássaro Azul Chapim", 0, 0, true },
[124] = { "Pelo de Abacaxi", 5000, 400, true },
--[125] = { "Pelo de Mariposa", 0, 0, true },
--[126] = { "Pelo de Petauro de Açúcar", 0, 0, true },
--[127] = { "Pelo Branco elegante", 0, 0, true },
--[128] = { "Pelo de Aligátor", 0, 0, true },
[129] = { "Pelo de Martim Pescador", 5000, 400, true },
--[130] = { "Pelo de Mega Charizard X", 0, 0, true },
[131] = { "Pelo de Gnar", 5000, 400, true },
--[132] = { "Pelo de Carpa", 0, 0, true },
--[133] = { "Pelo de Chinchila", 0, 0, true },
--[134] = { "Pelo de Mega Audino", 0, 0, true },
--[135] = { "Pelo de Suco", 0, 0, true },
[136] = { "Pelo de Flor", 5000, 400, true },
--[137] = { "Pelo de Porco", 0, 0, true },
--[138] = { "Pelo de Lagosta", 0, 0, true },
--[139] = { "Pelo de Dom-fafe", 0, 0, true },
[140] = { "Pelo de Morcego", 5000, 400, true },
[141] = { "Pelo de Motoqueiro-fantasma", 5000, 400, true },
--[142] = { "Pelo de Lion", 0, 0, true },
[143] = { "Pelo de Dewott", 5000, 400, true },
--[144] = { "Pelo de Wooloo", 0, 0, true },
[145] = { "Pelo de Bambi", 5000, 400, true },
--[146] = { "Pelo de Stitch", 0, 0, true },
--[147] = { "Pelo de Lycanroc", 0, 0, true },
--[148] = { "Pelo de Mariposa Luna", 0, 0, true },
--[149] = { "Pelo de Milkshake de algodão-doce", 0, 0, true },
--[150] = { "Pelo de Chessur", 0, 0, true },
--[151] = { "Pelo de Sorvete", 0, 0, true },
[152] = { "Pelo de Sapo", 5000, 400, true },
[153] = { "Pelo Divindade", 6000, 400, true },
[154] = { "Pelo de Cupcake", 6000, 400, true },
--[155] = { "Pelo de Furão", 0, 0, true },
[156] = { "Pelo de Lagarto Leopardo", 6000, 400, true },
[157] = { "Pelo de Corgi", 6000, 400, true },
[158] = { "Pelo de Cabra", 6000, 400, true },
[159] = { "Pelo de Kitsune", 7000, 500, true },
[160] = { "Pelo de Lince", 6000, 400, true },
[161] = { "Pelo de Estrela Funky", 6000, 400, true },
};
}
local getLook = function(player)
local look = tfm.get.room.playerList[player].look
local fur, items = look:match("(%d+)(.+)")
local out = { tonumber(fur) }
for item, colors in items:gmatch("[;,](%d+)([_+%x]*)") do
local tmp = { id = tonumber(item), colors = { } }
for c in colors:gmatch("[_+](%x+)") do
tmp.colors[#tmp.colors + 1] = c
end
out[#out + 1] = tmp
end
return out
end
local displayLook = function(p, n)
local look = getLook(p)
local info = {
[1] = { "Pelo", shop.fur[look[1]] },
[2] = { "Cabeça", shop.head[look[2].id] },
[3] = { "Olho", shop.eye[look[3].id] },
[4] = { "Orelha", shop.ear[look[4].id] },
[5] = { "Boca", shop.mouth[look[5].id] },
[6] = { "Pescoço", shop.neck[look[6].id] },
[7] = { "Penteado", shop.hair_style[look[7].id] },
[8] = { "Rabo", shop.tail[look[8].id] },
[9] = { "Lente de contato", shop.contact_lens[look[9].id] },
[10] = { "Mão", shop.hand[look[10].id] },
}
local price = {
cheese = { 0, 0 },
fraise = { 0, 0 }
}
local y = 0
for i = 1, 10 do
if (type(look[i]) == "number" and look[i] or look[i].id) > 0 and info[i][2] then
local colors = {}
if type(look[i]) == "table" then
for c = 1, #look[i].colors do
colors[#colors + 1] = "<font color='#" .. look[i].colors[c] .. "'>#" .. look[i].colors[c] .. "</font>"
end
end
if info[2][2] == 0 then
price.cheese[2] = price.cheese[2] + info[i][2][3]
price.fraise[1] = price.fraise[1] + info[i][2][3]
else
price.cheese[1] = price.cheese[1] + info[i][2][2]
if info[2][3] == 0 then
price.fraise[2] = price.fraise[2] + info[i][2][2]
else
price.fraise[1] = price.fraise[1] + info[i][2][3]
end
end
if #colors > 0 then
price.cheese[2] = price.cheese[2] + 20
price.fraise[1] = price.fraise[1] + 20
end
local c = table.concat(colors, " - ")
ui.addTextArea(i, info[i][1] .. " : <V>" .. info[i][2][1] .. "<N>\n<a href='event:'>" .. c, n, 300, 20 + 48 * y, 150, 40, 1, 1, 1, true)
y = y + 1
end
end
ui.addTextArea(11, "Preço em queijo: <J><B>$" .. price.cheese[1] .. "</B>" .. (price.cheese[2] > 0 and (" <N>+ <R><B>$" .. price.cheese[2] .. "</B>") or "") .. "\n<N>Preço em morango: <R><B>$" .. price.fraise[1] .. "</B>" .. (price.fraise[2] > 0 and (" <N>+ <J><B>$" .. price.fraise[2] .. "</B>") or "") , n, 5, 30, 150, 150, 1, 1, 1, true)
end
eventChatCommand = function(n, c)
c = c:lower():gsub("%a", string.upper, 1)
if not c:find("#") then c = c .. "#0000" end
if tfm.get.room.playerList[c] then
displayLook(c, n)
end
end
eventNewPlayer = function(playerName)
tfm.exec.chatMessage("<ROSE>Seu look é <B>" .. tfm.get.room.playerList[playerName].look .. "</B>", playerName)
tfm.exec.chatMessage("<J>Digite !nomeDoJogador para ver o preço do visual.", playerName)
end
table.foreach(tfm.get.room.playerList, eventNewPlayer)
|
AddCSLuaFile()
if not LIB_APERTURE then return end
--============= Conversion Gel ==============
PORTAL_PAINT_PORTAL = PORTAL_PAINT_COUNT + 1
local PAINT_INFO = {}
PAINT_INFO.COLOR = Color(200, 200, 200)
PAINT_INFO.NAME = "Portal Gel"
if SERVER then
end -- SERVER
LIB_APERTURE:CreateNewPaintType(PORTAL_PAINT_PORTAL, PAINT_INFO)
|
local lspconfig = require 'lspconfig'
local util = require 'lspconfig/util'
local saga = require 'lspsaga'
saga.init_lsp_saga {
code_action_prompt = {
enable = true,
sign = false,
virtual_text = true,
}
}
local custom_attach = function(client)
print("'" .. client.name .."' language server started");
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' })
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' })
end
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
virtual_text = false,
update_in_insert = false
}
)
lspconfig.cssls.setup { on_attach = custom_attach }
lspconfig.html.setup { on_attach = custom_attach }
lspconfig.tsserver.setup {
on_attach = custom_attach,
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'typescript.tsx', 'vue' }
}
lspconfig.clangd.setup { on_attach = custom_attach }
lspconfig.rust_analyzer.setup { on_attach = custom_attach }
lspconfig.fsautocomplete.setup { on_attach = custom_attach }
lspconfig.vuels.setup { on_attach = custom_attach }
lspconfig.pylsp.setup { on_attach = custom_attach }
lspconfig.hls.setup {
on_attach = custom_attach,
root_dir = util.root_pattern('*.cabal', 'stack.yaml', 'cabal.project', 'package.yaml', 'hie.yaml', '*.hs')
}
lspconfig.ocamllsp.setup { on_attach = custom_attach }
lspconfig.texlab.setup {
filetypes = { 'tex', 'bib', 'plaintex' },
on_attach = custom_attach
}
lspconfig.diagnosticls.setup {
on_attach = custom_attach,
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'typescript.tsx', 'vue' },
init_options = {
linters = {
eslint = {
command = './node_modules/.bin/eslint',
rootPatterns = {'.git', '.eslintrc.cjs', '.eslintrc', '.eslintrc.json', '.eslintrc.js'},
debounce = 100,
args = {'--stdin', '--stdin-filename', '%filepath', '--format', 'json'},
sourceName = 'eslint',
parseJson = {
errorsRoot = '[0].messages',
line = 'line',
column = 'column',
endLine = 'endLine',
endColumn = 'endColumn',
message = '[eslint] ${message} [${ruleId}]',
security = 'severity',
},
securities = {[2] = 'error', [1] = 'warning'},
}
},
filetypes = {
javascript = 'eslint',
javascriptreact = 'eslint',
typescript = 'eslint',
typescriptreact = 'eslint',
['typescript.tsx'] = 'eslint',
vue = 'eslint',
},
formatters = {
prettier = {
command = './node_modules/.bin/prettier',
rootPatterns = { '.prettierrc', '.git' },
args = { '--stdin-filepath', '%filename' },
requiredFiles = { '.prettierrc', '.prettierrc.json' },
}
},
formatFiletypes = {
javascript = 'prettier',
javascriptreact = 'prettier',
typescript = 'prettier',
typescriptreact = 'prettier',
['typescript.tsx'] = 'prettier',
vue = 'prettier',
}
}
}
lspconfig.sourcekit.setup {
filetypes = { 'swift' },
on_attach = custom_attach
}
lspconfig.bashls.setup{}
require'compe'.setup {
enabled = true;
autocomplete = true;
min_length = 1;
source = {
path = true;
buffer = true;
nvim_lsp = true;
spell = true;
};
}
|
-- PlayFab Authentication API
-- This is the main file you should require in your game
-- All api calls are documented here: https://docs.microsoft.com/gaming/playfab/api-references/
-- Example code:
-- local PlayFabAuthenticationApi = require("PlayFab.PlayFabAuthenticationApi")
-- PlayFabAuthenticationApi.<AuthenticationApiCall>(request, successCallbackFunc, errorCallbackFunc)
local IPlayFabHttps = require("PlayFab.IPlayFabHttps")
local PlayFabSettings = require("PlayFab.PlayFabSettings")
local PlayFabAuthenticationApi = {
settings = PlayFabSettings.settings
}
-- Method to exchange a legacy AuthenticationTicket or title SecretKey for an Entity Token or to refresh a still valid
-- Entity Token.
-- API Method Documentation: https://docs.microsoft.com/rest/api/playfab/authentication/authentication/getentitytoken
-- Request Documentation: https://docs.microsoft.com/rest/api/playfab/authentication/authentication/getentitytoken#getentitytokenrequest
-- Response Documentation: https://docs.microsoft.com/rest/api/playfab/authentication/authentication/getentitytoken#getentitytokenresponse
function PlayFabAuthenticationApi.GetEntityToken(request, onSuccess, onError)
local authKey = nil
local authValue = nil
if (PlayFabSettings._internalSettings.entityToken) then
authKey = "X-EntityToken"
authValue = PlayFabSettings._internalSettings.entityToken
end
if (PlayFabSettings._internalSettings.sessionTicket) then
authKey = "X-Authorization"
authValue = PlayFabSettings._internalSettings.sessionTicket
end
if (PlayFabSettings.settings.devSecretKey) then
authKey = "X-SecretKey"
authValue = PlayFabSettings.settings.devSecretKey
end
local externalOnSuccess = onSuccess
function wrappedOnSuccess(result)
PlayFabSettings._internalSettings.entityToken = result.EntityToken
if (externalOnSuccess) then
externalOnSuccess(result)
end
end
onSuccess = wrappedOnSuccess
IPlayFabHttps.MakePlayFabApiCall("/Authentication/GetEntityToken", request, authKey, authValue, onSuccess, onError)
end
-- Method for a server to validate a client provided EntityToken. Only callable by the title entity.
-- API Method Documentation: https://docs.microsoft.com/rest/api/playfab/authentication/authentication/validateentitytoken
-- Request Documentation: https://docs.microsoft.com/rest/api/playfab/authentication/authentication/validateentitytoken#validateentitytokenrequest
-- Response Documentation: https://docs.microsoft.com/rest/api/playfab/authentication/authentication/validateentitytoken#validateentitytokenresponse
function PlayFabAuthenticationApi.ValidateEntityToken(request, onSuccess, onError)
if (not PlayFabSettings.settings.titleId or not PlayFabSettings._internalSettings.entityToken) then error("Must call GetEntityToken first, to call this method") end
IPlayFabHttps.MakePlayFabApiCall("/Authentication/ValidateEntityToken", request, "X-EntityToken", PlayFabSettings._internalSettings.entityToken, onSuccess, onError)
end
return PlayFabAuthenticationApi
|
data:extend(
{
{ type = "recipe",
name = "iron-oxide",
category = "chemistry",
icon = "__MiningStation__/graphics/icons/iron-oxide.png",
energy_required = 2,
subgroup = "bob-resource-chemical",
enabled = false,
ingredients =
{
{"iron-ore",1},
{type = "fluid", name="oxygen", amount=2.5},
},
results =
{
{type="item", name="iron-oxide", amount = 1},
{type="fluid", name="sulfur-dioxide", amount = 1},
}
},
{ type = "recipe",
name = "iron-oxide-2",
category = "chemistry",
icon = "__MiningStation__/graphics/icons/iron-oxide.png",
energy_required = 2,
subgroup = "bob-resource-chemical",
enabled = false,
ingredients =
{
{type = "fluid", name = "molten-iron",amount = 0.6},
{type = "fluid", name="oxygen", amount=2.5},
},
results =
{
{type="item", name="iron-oxide", amount = 1},
{type="fluid", name="sulfur-dioxide", amount = 1},
}
},
{ type = "recipe",
name = "lead-oxide-2",
category = "chemistry",
icon = "__bobplates__/graphics/icons/lead-oxide.png",
energy_required = 2,
subgroup = "bob-resource-chemical",
enabled = false,
ingredients =
{
{type = "fluid", name = "molten-lead",amount = 0.6},
{type = "fluid", name="oxygen", amount=2.5},
},
results =
{
{type="item", name="lead-oxide", amount = 1},
{type="fluid", name="sulfur-dioxide", amount = 1},
}
},
{ type = "recipe",
name = "adv-iron",
icon = "__MiningStation__/graphics/icons/adv-iron.png",
category = "chemical-furnace",
energy_required = 25,
subgroup = "bob-material-chemical",
enabled = false,
ingredients =
{
{"iron-oxide",7},
{"carbon", 3},
{"nickel-plate", 1},
{type = "fluid", name="sulfuric-acid", amount=4.2},
},
results =
{
{type="item", name="iron-plate", amount = 9},
}
},
{ type = "recipe",
name = "adv-nickel",
category = "electrolysis",
energy_required = 7,
icon = "__MiningStation__/graphics/icons/adv-nickel.png",
subgroup = "bob-material-electrolysis",
enabled = false,
ingredients =
{
{"nickel-ore",3},
{"zinc-ore", 1},
{type = "fluid", name = "nitric-acid", amount = 2},
},
results =
{
{type="item", name="nickel-plate", amount = 5},
}
},
}
)
|
local ffi = require 'ffi'
local math = require 'oxcart.math'
|
CreateClientConVar( "secondperson", "1", true, false )
CreateClientConVar( "secondperson_pos", "1", true, false )
CreateClientConVar( "secondperson_ang", "0", true, false )
local enabled = GetConVar( "secondperson" )
local usePos = GetConVar( "secondperson_pos" )
local useAng = GetConVar( "secondperson_ang" )
hook.Add( "CalcView", "SecondPersonView", function( ply, pos, ang, fov )
if !enabled:GetBool() or ply:GetViewEntity() ~= ply then return end
local eyes = ply:GetAttachment( ply:LookupAttachment( "eyes" ) )
return { origin = usePos:GetBool() and eyes.Pos or pos, angles = useAng:GetBool() and eyes.Ang or ang, fov = fov, drawviewer = true }
end )
hook.Add( "PopulateToolMenu", "SecondPersonSettings", function()
spawnmenu.AddToolMenuOption( "Options", "View", "Second_Person_Options", "Second Person", "", "", function( panel )
panel:ClearControls()
panel:CheckBox( "Enabled", "secondperson" )
panel:CheckBox( "Use eye position", "secondperson_pos" )
panel:CheckBox( "Use eye angles", "secondperson_ang" )
end )
end )
|
return {'nuyens'} |
-- Event notes hooks
function onEvent(name, value1, value2)
if name == 'Play Sound' then
playSound(value1, value2)
end
end |
object_mobile_tatooine_wald_customer = object_mobile_shared_tatooine_wald_customer:new {
}
ObjectTemplates:addTemplate(object_mobile_tatooine_wald_customer, "object/mobile/tatooine_wald_customer.iff")
|
local _, ns = ...
local ct = ns.Config
----------------------------------------------------------------
-- Colors
----------------------------------------------------------------
ct.Colors = {
-- Damage
["DAMAGE"] = { r = 1.00, g = 0.10, b = 0.10 },
["SPELL_DAMAGE"] = { r = 0.79, g = 0.30, b = 0.85 },
["SPLIT_DAMAGE"] = { r = 1.00, g = 1.00, b = 1.00 },
-- Heal
["HEAL"] = { r = 0.10, g = 1.00, b = 0.10 },
["HEAL_ABSORB"] = { r = 0.10, g = 1.00, b = 0.10 },
["ABSORB_ADDED"] = { r = 1.00, g = 1.00, b = 0.50 },
-- Miss
["MISS"] = { r = 1.00, g = 1.00, b = 1.00 },
["DODGE"] = { r = 1.00, g = 1.00, b = 1.00 },
["PARRY"] = { r = 1.00, g = 1.00, b = 1.00 },
["EVADE"] = { r = 1.00, g = 1.00, b = 1.00 },
["IMMUNE"] = { r = 1.00, g = 1.00, b = 1.00 },
["DEFLECT"] = { r = 1.00, g = 1.00, b = 1.00 },
["REFLECT"] = { r = 1.00, g = 1.00, b = 1.00 },
-- Resistance
["ABSORB"] = { r = 1.00, g = 1.00, b = 1.00 },
["BLOCK"] = { r = 1.00, g = 1.00, b = 1.00 },
["RESIST"] = { r = 1.00, g = 1.00, b = 1.00 },
-- Cast
["SPELL_CAST"] = { r = 1.00, g = 0.85, b = 0.00 },
["SPELL_ACTIVE"] = { r = 1.00, g = 0.85, b = 0.00 },
-- Auras
["SPELL_AURA_END"] = { r = 0.10, g = 1.00, b = 0.10 },
["SPELL_AURA_END_HARMFUL"] = { r = 1.00, g = 0.10, b = 0.10 },
["SPELL_AURA_START"] = { r = 1.00, g = 0.85, b = 0.00 },
["SPELL_AURA_START_HARMFUL"] = { r = 1.00, g = 0.10, b = 0.10 },
["EXTRA_ATTACKS"] = { r = 1.00, g = 1.00, b = 1.00 },
-- Extra
["INTERRUPT"] = { r = 1.00, g = 0.50, b = 0.00 },
["DISPEL"] = { r = 1.00, g = 1.00, b = 1.00 },
-- Gains
["FACTION"] = { r = 0.10, g = 0.10, b = 1.00 },
["HONOR_GAINED"] = { r = 0.10, g = 0.10, b = 1.00 },
-- Others
["HEALTH_LOW"] = { r = 1.00, g = 0.10, b = 0.10 },
["MANA_LOW"] = { r = 1.00, g = 0.10, b = 0.10 },
["ENTERING_COMBAT"] = { r = 1.00, g = 0.10, b = 0.10 },
["LEAVING_COMBAT"] = { r = 1.00, g = 0.10, b = 0.10 },
}
ct.Colors["Auras"] = {
["BUFF"] = { r = 0.00, g = 1.00, b = 0.50 },
["DEBUFF"] = { r = 1.00, g = 0.00, b = 0.50 },
}
ct.Colors["Power"] = {
["MANA"] = { r = 0.31, g = 0.45, b = 0.63 },
["INSANITY"] = { r = 0.40, g = 0.00, b = 0.80 },
["MAELSTROM"] = { r = 0.00, g = 0.50, b = 1.00 },
["LUNAR_POWER"] = { r = 0.93, g = 0.51, b = 0.93 },
["HOLY_POWER"] = { r = 0.95, g = 0.90, b = 0.60 },
["RAGE"] = { r = 0.69, g = 0.31, b = 0.31 },
["FOCUS"] = { r = 0.71, g = 0.43, b = 0.27 },
["ENERGY"] = { r = 0.65, g = 0.63, b = 0.35 },
["CHI"] = { r = 0.71, g = 1.00, b = 0.92 },
["RUNES"] = { r = 0.55, g = 0.57, b = 0.61 },
["SOUL_SHARDS"] = { r = 0.50, g = 0.32, b = 0.55 },
["FURY"] = { r = 0.78, g = 0.26, b = 0.99 },
["PAIN"] = { r = 1.00, g = 0.61, b = 0.00 },
["RUNIC_POWER"] = { r = 0.00, g = 0.82, b = 1.00 },
["AMMOSLOT"] = { r = 0.80, g = 0.60, b = 0.00 },
["FUEL"] = { r = 0.00, g = 0.55, b = 0.50 },
["POWER_TYPE_STEAM"] = { r = 0.55, g = 0.57, b = 0.61 },
["POWER_TYPE_PYRITE"] = { r = 0.60, g = 0.09, b = 0.17 },
["ALTPOWER"] = { r = 0.00, g = 1.00, b = 1.00 },
["COMBO_POINTS"] = { r = 1.00, g = 0.96, b = 0.41 },
["DEMONIC_FURY"] = { r = 1.00, g = 1.00, b = 1.00 },
["ARCANE_CHARGES"] = { r = 0.10, g = 0.10, b = 0.98 },
["AMMOSLOT"] = { r = 0.80, g = 0.60, b = 0.00 },
["STAGGER"] = {
[1] = { r = 0.42, g = 1.00, b = 0.42 },
[2] = { r = 1.00, g = 1.00, b = 0.42 },
[3] = { r = 1.00, g = 0.42, b = 0.42 },
}
}
ct.Colors["School"] = {
[SCHOOL_MASK_NONE] = { r = 1.00, g = 1.00, b = 1.00 },
[SCHOOL_MASK_PHYSICAL] = { r = 1.00, g = 1.00, b = 0.00 },
[SCHOOL_MASK_HOLY] = { r = 1.00, g = 0.90, b = 0.50 },
[SCHOOL_MASK_FIRE] = { r = 1.00, g = 0.50, b = 0.00 },
[SCHOOL_MASK_NATURE] = { r = 0.30, g = 1.00, b = 0.30 },
[SCHOOL_MASK_FROST] = { r = 0.50, g = 1.00, b = 1.00 },
[SCHOOL_MASK_SHADOW] = { r = 0.50, g = 0.50, b = 1.00 },
[SCHOOL_MASK_ARCANE] = { r = 1.00, g = 0.50, b = 1.00 },
} |
#!/usr/bin/env lua
--[[
Copyright (C) 2015 Real-Time Innovations, Inc.
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.
--]]
--- DDSL Tutorial
-- @usage
-- Step though one lesson at a time. Look at the code (this file) side by side.
-- ../bin/run ddsl-tutorial [starting_lesson_number]
-- OR
-- ./ddsl-tutorial.lua [starting_lesson_number]
-- @author Rajive Joshi
package.path = '../src/?.lua;../src/?/init.lua;' .. package.path
local xtypes = require('ddsl.xtypes')
local xutils = require('ddsl.xtypes.utils')
local Tutorial = require('tutorial')
local show = Tutorial.show
--============================================================================--
-- DDSL Helpers
local function show_datatype(datatype, description)
description = description or (tostring(datatype) .. ' datatype:')
local idl = xutils.to_idl_string_table(datatype, { description })
show(table.concat(idl, '\n\t'))
end
local function show_instance(instance, description)
description = description or (tostring(instance) .. ' instance:')
local values = xutils.to_instance_string_table(instance, { description })
show(table.concat(values, '\n\t'))
end
--============================================================================--
-- DDSL Lessons
local tutorial
tutorial = Tutorial:new{
--==========================================================================--
{ intro = function ()
show(
-- Show the welcome message:
[[
Welcome to the DDSL Tutorial!
Please open this lua tutorial source file in a code viewer/editor,
and follow along the lessons, one at a time, at your own pace.
You can rerun the tutorial, or jump to a specific lesson simply by
running this lua script with the lesson number, thus:
ddsl_tutorial <n>
where n is the lesson number to jump to or restart from.
Version: ]],
-- Show the current DDSL version
xtypes.log.version)
end
},
--==========================================================================--
{ const = function ()
local MAX_COLOR_LEN = xtypes.const{ MAX_COLOR_LEN = { xtypes.long, 128 } }
local value, datatype
show('--- MAX_COLOR_LEN ---')
show_datatype(MAX_COLOR_LEN)
value, datatype = MAX_COLOR_LEN()
show('\tvalue ', value)
assert(value == 128)
show('\tdatatype', datatype)
assert(datatype == xtypes.long)
return MAX_COLOR_LEN
end
},
--==========================================================================--
{ shapetype = function ()
show('--- define a datatype (template) using declarative style ---')
local MAX_COLOR_LEN = xtypes.const{ MAX_COLOR_LEN = { xtypes.long, 128 } }
show_datatype(MAX_COLOR_LEN)
local ShapeType = xtypes.struct{
ShapeType = {
{ x = { xtypes.long } },
{ y = { xtypes.long } },
{ shapesize = { xtypes.long } },
{ color = { xtypes.string(MAX_COLOR_LEN), xtypes.Key } },
xtypes.Extensibility{'EXTENSIBLE_EXTENSIBILITY'},
xtypes.top_level{},
}
}
show_datatype(ShapeType)
return MAX_COLOR_LEN, ShapeType
end
},
--==========================================================================--
{ shapetype_imperative = function ()
show('--- define the same datatype (template) using imperative style ---')
local MAX_COLOR_LEN = xtypes.const{ MAX_COLOR_LEN = { xtypes.long, 128 } }
show_datatype(MAX_COLOR_LEN)
local ShapeType = xtypes.struct{ShapeType=xtypes.EMPTY}
ShapeType[1] = { x = { xtypes.long } }
ShapeType[2] = { y = { xtypes.long } }
ShapeType[3] = { shapesize = { xtypes.long } }
ShapeType[4] = { color = { xtypes.string(MAX_COLOR_LEN), xtypes.Key } }
ShapeType[xtypes.QUALIFIERS] = {
xtypes.Extensibility{'EXTENSIBLE_EXTENSIBILITY'},
xtypes.top_level{},
}
show_datatype(ShapeType)
return MAX_COLOR_LEN, ShapeType
end
},
--==========================================================================--
{ shapetype_xml_import = function ()
local xml = require('ddsl.xtypes.xml')
-- xml.log.verbosity(xml.log.DEBUG) -- OPTIONAL: turn on debugging
show('--- import datatypes defined in XML ---')
local datatypes = xml.filelist2xtypes({
'tutorial.xml',
})
show('--- export datatypes to IDL ---')
for i = 1, #datatypes do
show_datatype(datatypes[i], tostring(datatypes[i]) .. ':')
end
return table.unpack(datatypes)
end
},
--==========================================================================--
{ shapetype_model_iterators = function ()
local MAX_COLOR_LEN, ShapeType = tutorial:dolesson('shapetype')
show("--- show model attributes ---")
show('KIND', ShapeType[xtypes.KIND]())
show('NS', ShapeType[xtypes.NS])
show('NAME', ShapeType[xtypes.NAME])
show('BASE', ShapeType[xtypes.BASE])
show('QUALIFIERS = ', table.unpack(ShapeType[xtypes.QUALIFIERS]))
for i = 1, #ShapeType[xtypes.QUALIFIERS] do
local qualifier = ShapeType[xtypes.QUALIFIERS][i]
show(table.concat{'qualifier[', i, '] = '}, qualifier) -- use tostring
show('\t', -- OR construct ourselves
qualifier[xtypes.NAME], --annotation/collection name
table.concat(qualifier, ' ')) --annotation/collection attributes
end
show("--- iterate through the model members ---")
for i = 1, #ShapeType do
local role, roledef = next(ShapeType[i])
show('', role, table.unpack(roledef))
end
return MAX_COLOR_LEN, ShapeType
end
},
--==========================================================================--
{ struct_model_operators = function ()
local MAX_COLOR_LEN, ShapeType = tutorial:dolesson('shapetype')
show('--- add member z ---')
ShapeType[#ShapeType+1] = { z = { xtypes.string() , xtypes.Key } }
show_datatype(ShapeType)
show('--- remove member x ---')
ShapeType[1] = nil
show_datatype(ShapeType)
show('--- redefine member y ---')
ShapeType[1] = { y = { xtypes.double } }
show_datatype(ShapeType)
show('--- add a base struct ---')
local Property = xtypes.struct{
Property = {
{ name = { xtypes.string(MAX_COLOR_LEN) } },
{ value = { xtypes.string(MAX_COLOR_LEN) } },
}
}
ShapeType[xtypes.BASE] = Property
show_datatype(ShapeType)
show_instance(ShapeType)
return ShapeType
end
},
--==========================================================================--
{ shape_instance = function ()
local MAX_COLOR_LEN, ShapeType = tutorial:dolesson('shapetype')
show('--- create an instance from the datatype (template) ---')
local shape = xtypes.new_instance(ShapeType)
-- shape is equivalent to manually defining the following --
local shape_manual = {
x = 50,
y = 30,
shapesize = 20,
color = 'GREEN',
}
show('--- initialize the shape instance from shape_manual table ---')
for role, _ in pairs(shape) do
shape[role] = shape_manual[role]
show('\t', role, shape[role])
end
show_instance(shape)
show("--- show instance 'model' attributes ---")
show('KIND', shape[xtypes.KIND]())
show('NS', shape[xtypes.NS])
show('NAME', shape[xtypes.NAME])
show('QUALIFIERS', table.unpack(shape[xtypes.QUALIFIERS]))
show('BASE', shape[xtypes.BASE])
show('template', xtypes.template(shape))
assert(xtypes.template(shape) == ShapeType)
return MAX_COLOR_LEN, ShapeType, shape
end
},
--==========================================================================--
{ shape_instance_iterators = function ()
local MAX_COLOR_LEN,ShapeType,shape = tutorial:dolesson('shape_instance')
show("--- iterate through instance members : unordered ---")
for role, value in pairs(shape) do
show(role, value, ':', table.unpack(shape(role)))
end
show("--- iterate through instance members : ordered ---")
for i = 1, #shape do
local role, roledef = next(shape[i])
show(role, shape[role], ':', table.unpack(roledef))
end
return shape
end
},
--==========================================================================--
{ shape_accessors = function ()
local MAX_COLOR_LEN, ShapeType = tutorial:dolesson('shapetype')
show('--- template member values are DDSDynamicData accessor strings ---')
show_instance(ShapeType)
return ShapeType
end
},
--==========================================================================--
{ inheritance_and_nested_struct_seq = function ()
local MAX_COLOR_LEN, ShapeType = tutorial:dolesson('shapetype')
show('--- define a property struct ---')
local Property = xtypes.struct{
Property = {
{ name = { xtypes.string(MAX_COLOR_LEN) } },
{ value = { xtypes.string(MAX_COLOR_LEN) } },
}
}
show_datatype(Property)
show('--- define a derived struct with a sequence of properties ---')
local ShapeTypeWithProperties = xtypes.struct{
ShapeTypeWithProperties = {
ShapeType,
{ properties = { Property, xtypes.sequence(5) } },
}
}
show_datatype(ShapeTypeWithProperties)
show('--- template member values are DDSDynamicData accessor strings ---')
show_instance(ShapeTypeWithProperties)
show('--- create a new instance ---')
local shapeWithProperties = xtypes.new_instance(ShapeTypeWithProperties)
shapeWithProperties.x = 50
shapeWithProperties.y = 30
shapeWithProperties.shapesize = 20
shapeWithProperties.color = 'GREEN'
for i = 1, shapeWithProperties.properties() - 2 do
shapeWithProperties.properties[i].name = 'name' .. i
shapeWithProperties.properties[i].value = i
end
show_instance(shapeWithProperties)
show('properties is_collection ?',
xtypes.is_collection(shapeWithProperties.properties))
assert(xtypes.is_collection(shapeWithProperties.properties) == true)
assert(shapeWithProperties.properties() == 5)
show('properties capacity', shapeWithProperties.properties(), -- or
ShapeTypeWithProperties.properties())
show('properties length', #shapeWithProperties.properties)
assert(#shapeWithProperties.properties == 3)
return ShapeTypeWithProperties, shapeWithProperties
end
},
--==========================================================================--
{ typedefs = function ()
local MAX_COLOR_LEN, ShapeType = tutorial:dolesson('shapetype')
local MyShape = xtypes.typedef{
MyShape = { ShapeType }
}
local MyShapeSeq = xtypes.typedef{
MyShapeSeq = { MyShape, xtypes.sequence(7) }
}
local MyShapeSeqArray = xtypes.typedef{
MyShapeSeqArray = { MyShapeSeq, xtypes.array(3,5) }
}
local alias, collection_qualifier
show('--- MyShapeSeqArray ---')
show_datatype(MyShapeSeqArray)
alias, collection_qualifier = MyShapeSeqArray()
show('\talias ', alias)
assert(alias == MyShapeSeq)
show('\tqualifier', collection_qualifier,
collection_qualifier[xtypes.NAME],
collection_qualifier[1], collection_qualifier[2])
assert(collection_qualifier[xtypes.NAME] == 'array' and
collection_qualifier[1] == 3, collection_qualifier[1] == 5)
show('--- MyShapeSeq ---')
show_datatype(MyShapeSeq)
alias, collection_qualifier = MyShapeSeq()
show('\talias ', alias)
assert(alias == MyShape)
show('\tqualifier', collection_qualifier,
collection_qualifier[xtypes.NAME],
collection_qualifier[1])
assert(collection_qualifier[xtypes.NAME] == 'sequence' and
collection_qualifier[1] == 7)
show('--- MyShape ---')
show_datatype(MyShape)
alias, collection_qualifier = MyShape()
show('\talias ', alias)
assert(alias == ShapeType)
show('\tqualifier', collection_qualifier)
assert(collection_qualifier == nil)
show('--- resolve ---')
show('\tMyShapeSeqArray -> ', xtypes.resolve(MyShapeSeqArray))
return MAX_COLOR_LEN, ShapeType, MyShape, MyShapeSeq, MyShapeSeqArray
end
},
--[[ Lesson Template: copy and paste the content to create the next lesson
--==========================================================================--
{ next_lesson_title = function ()
end
},
--]]
}
--============================================================================--
-- main --
tutorial:run(arg[1] or 1)
|
Weapon.PrettyName = "HS-338"
Weapon.WeaponID = "arccw_awm"
Weapon.DamageMultiplier = 2.2
Weapon.WeaponType = WEAPON_PRIMARY |
#!/usr/local/bin/lua
-- X = nil
-- type(X)==nil 结果为 false 的原因是因为 type(type(X))==string。
if type(nil) == nil then
print("type(nil) == nil")
else
print("type(nil) != nil")
end
if type(nil) == "nil" then
print("type(nil) == \"nil\"")
else
print("type(nil) != \"nil\"")
end
--[[
boolean 类型只有两个可选值:true(真) 和 false(假)
Lua 把 false 和 nil 看作是 false,其他的都为 true,数字 0 也是 true
--]]
print(type(true))
print(type(false))
print(type(nil))
if false or nil then
print("至少有一个是 true")
else
print("false 和 nil 都为 false")
end
if 0 then
print("数字 0 是 true")
else
print("数字 0 为 false")
end
|
local _G = _G or getfenv(0)
local module = ShaguTweaks:register({
title = "Debuff Timer",
description = "Show debuff durations on the target unit frame.",
expansions = { ["vanilla"] = true, ["tbc"] = nil },
category = "Unit Frames",
enabled = true,
})
local libdebuff = ShaguTweaks.libdebuff
local UnitDebuff = libdebuff and libdebuff.UnitDebuff
local TimeConvert = ShaguTweaks.TimeConvert
local function CreateTextCooldown(cooldown)
if cooldown.readable then return end
cooldown.readable = CreateFrame("Frame", "pfCooldownFrame", cooldown:GetParent())
cooldown.readable:SetAllPoints(cooldown)
cooldown.readable:SetFrameLevel(cooldown:GetParent():GetFrameLevel() + 1)
cooldown.readable.text = cooldown.readable:CreateFontString("pfCooldownFrameText", "OVERLAY")
cooldown.readable.text:SetFont(STANDARD_TEXT_FONT, 10, "OUTLINE")
cooldown.readable.text:SetPoint("CENTER", cooldown.readable, "CENTER", 0, 0)
cooldown.readable:SetScript("OnUpdate", function()
parent = this:GetParent()
if not parent then this:Hide() end
if not this.next then this.next = GetTime() + .1 end
if this.next > GetTime() then return end
this.next = GetTime() + .1
-- fix own alpha value (should be inherited, but somehow isn't always)
this:SetAlpha(parent:GetAlpha())
local remaining = this.duration - (GetTime() - this.start)
if remaining >= 0 then
this.text:SetText(TimeConvert(remaining))
else
this:Hide()
end
end)
end
module.enable = function(self)
local HookTargetDebuffButton_Update = TargetDebuffButton_Update
TargetDebuffButton_Update = function()
HookTargetDebuffButton_Update()
for i=1, MAX_TARGET_DEBUFFS do
local effect, rank, texture, stacks, dtype, duration, timeleft = libdebuff:UnitDebuff("target", i)
local button = _G["TargetFrameDebuff"..i]
if not button.cd then
button.cd = CreateFrame("Model", "TargetFrameDebuff"..i.."Cooldown", button, "CooldownFrameTemplate")
button.cd.noCooldownCount = true
button.cd:SetAllPoints()
button.cd:SetScale(.6)
button.cd:SetAlpha(.8)
end
if effect and duration and timeleft then
local start = GetTime() + timeleft - duration
CooldownFrame_SetTimer(button.cd, start, duration, 1)
CreateTextCooldown(button.cd)
button.cd.readable.start = start
button.cd.readable.duration = duration
button.cd.readable:Show()
button.cd:Show()
else
CooldownFrame_SetTimer(button.cd,0,0,0)
end
end
end
end
|
-- ======================================================================
-- Binary Boarding
-- Advent of Code 2020 Day 05 -- Eric Wastl -- https://adventofcode.com
--
-- lua implementation by Dr. Dean Earl Wright III
-- ======================================================================
-- ======================================================================
-- t e s t _ b p a s s . l u a
-- ======================================================================
-- "Test Bpass for Advent of Code 2020 day 05, Binary Boarding"
-- ----------------------------------------------------------------------
-- require
-- ----------------------------------------------------------------------
local luaunit = require('luaunit')
local bpass = require('bpass')
-- ----------------------------------------------------------------------
-- constants
-- ----------------------------------------------------------------------
local EXAMPLE_TEXT = "FBFBBFFRLR"
local EXAMPLES = {
{ text = "BFFFBBFRRR", row=70, column=7, seat=567 },
{ text = "FFFBBBFRRR", row=14, column=7, seat=119 },
{ text = "BBFFBBFRLL", row=102, column=4, seat=820}
}
-- ======================================================================
-- TestBpass
-- ======================================================================
function test_empty_init()
-- "Test the default Bpass creation"
-- 1. Create default Bpass object
local myobj = bpass:Bpass()
-- 2. Make sure it has the default values
luaunit.assertEquals(myobj.part2, false)
luaunit.assertEquals(#myobj.text, 0)
luaunit.assertEquals(myobj.row, 0)
luaunit.assertEquals(myobj.column, 0)
luaunit.assertEquals(myobj.seat, 0)
end
function test_text_init()
-- "Test the Bpass object creation from text"
-- 1. Create Phone object from text
local myobj = bpass:Bpass({text=EXAMPLE_TEXT})
-- 2. Make sure it has the expected values
luaunit.assertEquals(myobj.part2, false)
luaunit.assertEquals(#myobj.text, 10)
luaunit.assertEquals(myobj.row, 44)
luaunit.assertEquals(myobj.column, 5)
luaunit.assertEquals(myobj.seat, 357)
end
function test_examples_one()
-- Test multiple passports
-- 1. Loop for all of the examples
for _, example in ipairs(EXAMPLES) do
-- 2. Create a passport from the example text
local myobj = bpass:Bpass({text=example['text']})
-- 3. Check the passport
luaunit.assertEquals(myobj.row, example['row'])
luaunit.assertEquals(myobj.column, example['column'])
luaunit.assertEquals(myobj.seat, example['seat'])
end
end
-- ----------------------------------------------------------------------
-- module initialization
-- ----------------------------------------------------------------------
os.exit( luaunit.LuaUnit.run() )
-- ======================================================================
-- end t e s t _ b p a s s . p y end
-- ======================================================================
|
local Geom2D = {}
local tau = 2*math.pi
local sin = math.sin
local cos = math.cos
local floor = math.floor
local ceil = math.ceil
-- Generate transforms for rotations
local d = defines.direction
-- x = x*t[1] + y*t[2]
-- y = x*t[3] + y*t[4]
local rotations = {
[d.north] = { 1, 0, 0, 1 }, -- No change
[d.northeast] = {-1, 0, 0, 1 }, -- Mirror on X axis.
}
-- Compute the rest of the rotations.
do
local t
for i = d.east, d.northwest do
t = rotations[i-2]
rotations[i] = { -t[3], -t[4], t[1], t[2] }
end
end
Geom2D.rotations = rotations
local Rect = {}
do
--local almost_one = 0.99999999999999
local almost_one = 1
Rect.__mt = { __index = Rect }
function Rect:clone(into)
--log(serpent.line(self))
if not into then
into = {}
end
for k, v in pairs(self) do
into[k] = v
end
setmetatable(into, self.__mt)
return into
end
function Rect.from_box(box, t)
local x1 = box.left_top.x
local x2 = box.right_bottom.x
local y1 = box.left_top.y
local y2 = box.right_bottom.y
local orientation = box.orientation or 0
local dir = nil
if t == nil then
t = { 1, 2, 3, 4, 5, 6, 7, 8, xmin = nil, xmax = nil, ymin = nil, ymax = nil, orientation = orientation }
setmetatable(t, Rect.__mt)
else
t.orientation = orientation
end
if orientation == 0.75 then
dir = d.west
elseif orientation == 0.50 then
dir = d.south
elseif orientation == 0.25 then
dir = d.east
elseif orientation == 0 then
dir = d.north
end
if dir ~= nil then
t[1], t[2] = x1, y1
t[3], t[4] = x2, y1
t[5], t[6] = x2, y2
t[7], t[8] = x1, y2
t.right = true
t.xmin, t.xmax = x1, x2
t.ymin, t.ymax = y1, y2
return t:rotate(dir)
else
t.right = false
end
local xo = (x1 + x2) / 2
local yo = (y1 + y2) / 2
x1, x2, y1, y2 = x1 - xo, x2 - xo, y1 - yo, y2 - yo
local theta = orientation * tau
local sin_theta = sin(theta)
local cos_theta = cos(theta)
local xmin, xmax, ymin, ymax
local function _r(i, x, y)
x, y = xo + x * cos_theta - y * sin_theta, yo + x * sin_theta + y * cos_theta
if i == 1 then
xmin, xmax = x, x
ymin, ymax = y, y
else
if xmin > x then
xmin = x
end
if ymin > y then
ymin = y
end
if xmax < x then
xmax = x
end
if ymax < y then
ymax = y
end
end
t[i], t[i + 1] = x, y
end
_r(1, x1, y1)
_r(3, x2, y1)
_r(5, x2, y2)
_r(7, x1, y2)
t.xmin, t.xmax = xmin, xmax
t.ymin, t.ymax = ymin, ymax
return t
end
function Rect:rotate(dir)
local xx, xy, yx, yy = table.unpack(rotations[dir])
local x, y
local xmin, ymin, xmax, ymax
for i = 1, 7, 2 do
x = self[i]
y = self[i+1]
x, y = x*xx + y*xy, x*yx + y*yy
if i == 1 then
xmin, xmax = x, x
ymin, ymax = y, y
else
if xmin > x then xmin = x end
if ymin > y then ymin = y end
if xmax < x then xmax = x end
if ymax < y then ymax = y end
end
self[i], self[i+1] = x, y
end
self.xmin, self.xmax = xmin, xmax
self.ymin, self.ymax = ymin, ymax
return self
end
function Rect:translate(x, y)
self.xmin = self.xmin + x
self.xmax = self.xmax + x
self.ymin = self.ymin + y
self.ymax = self.ymax + y
for i = 1, 7, 2 do
self[i] = self[i] + x
self[i+1] = self[i+1] + y
end
return self
end
local function _extents(ax, ay, rect)
local n, px, py, dot, min, max
local divisor = ax*ax+ay*ay
for i = 1, 8, 2 do
n = (rect[i]*ax + rect[i+1]*ay) / divisor
dot = n*ax*ax + n*ay*ay
if i == 1 then
min, max = dot, dot
else
if min > dot then min = dot end
if max < dot then max = dot end
end
end
return min, max
end
local function _extents2(ax, ay, x, y)
local n, px, py, dot, min, max
local divisor = ax*ax+ay*ay
for xp = 0, 1 do
for yp = 0, 1 do
n = ((x+(xp*almost_one))*ax + (y+(yp*almost_one))*ay) / divisor
dot = n*ax*ax + n*ay*ay
if min == nil then
min, max = dot, dot
else
if min > dot then min = dot end
if max < dot then max = dot end
end
end
end
return min, max
end
function Rect:overlaps(other)
if not (self.xmax >= other.xmin and other.xmax >= self.xmin and self.ymax >= other.ymin and other.ymax >= self.ymin) then
return false
end
local function check_axis(ax, ay)
local amin, amax = _extents(ax, ay, self)
local bmin, bmax = _extents(ax, ay, other)
return (bmax >= amin and amax >= bmin)
end
return (
check_axis(self[3] - self[1], self[4] - self[2])
and check_axis(self[3] - self[5], self[4] - self[6])
and check_axis(other[3] - other[1], other[4] - other[2])
and check_axis(other[3] - other[5], other[4] - other[6])
)
end
function Rect:tiles(result, tile_name)
tile_name = tile_name or true
if not result then
result = {}
setmetatable(result, { __index = function(t, k) local v = {}; t[k] = v; return v end })
end
if self.right then
for x = floor(self.xmin), ceil(self.xmax - 1) do
for y = floor(self.ymin), ceil(self.ymax - 1) do
result[x][y] = tile_name
end
end
return result
end
local function check_axis(ax, ay, x, y)
local amin, amax = _extents(ax, ay, self)
local bmin, bmax = _extents2(ax, ay, x, y)
return (bmax >= amin and amax >= bmin)
end
-- {0, 0, 0, 1, 1, 1, 1, 0 }
--game.print(serpent.line(self))
for x = floor(self.xmin), ceil(self.xmax) do
for y = floor(self.ymin), ceil(self.ymax) do
if (
check_axis(self[3] - self[1], self[4] - self[2], x, y)
and check_axis(self[3] - self[5], self[4] - self[6], x, y)
and check_axis(0, almost_one, x, y)
and check_axis(-almost_one, 0, x, y)
) then
result[x][y] = tile_name
end
end
end
return result
end
end
Geom2D.Rect = Rect
local area_to_rectangle, is_overlapping_rectangle, get_overlapping_tiles
do
-- It's not shameless theft if I stole it from my own mod.
-- Adapted from math shown at:
-- https://www.gamedev.net/articles/programming/general-and-gameplay-programming/2d-rotated-rectangle-collision-r2604/
local tau = 2*math.pi
local sin = math.sin
local cos = math.cos
local floor = math.floor
local ceil = math.ceil
local almost_one = 1.0
function area_to_rectangle(box, t)
local x1 = box.left_top.x
local x2 = box.right_bottom.x
local y1 = box.left_top.y
local y2 = box.right_bottom.y
if not t then
-- No table to reuse, so create a new one.
t = {1, 2, 3, 4, 5, 6, 7, 8, xmin=nil, xmax=nil, ymin=nil, ymax=nil, orientation=(box.orientation or 0)}
end
if (not box.orientation) or (box.orientation == 0) then
t[1], t[2] = x1, y1
t[3], t[4] = x2, y1
t[5], t[6] = x2, y2
t[7], t[8] = x1, y2
t.xmin, t.xmax = x1, x2
t.ymin, t.ymax = y1, y2
return t
end
local xo = (x1 + x2) / 2
local yo = (y1 + y2) / 2
x1, x2, y1, y2 = x1 - xo, x2 - xo, y1 - yo, y2 - yo
local theta = box.orientation * tau
local sin_theta = sin(theta)
local cos_theta = cos(theta)
local xmin, xmax, ymin, ymax
local function _r(i, x, y)
x, y = xo + x*cos_theta - y*sin_theta, yo + x*sin_theta + y*cos_theta
if i == 1 then
xmin, xmax = x, x
ymin, ymax = y, y
else
if xmin > x then xmin = x end
if ymin > y then ymin = y end
if xmax < x then xmax = x end
if ymax < y then ymax = y end
end
t[i], t[i+1] = x, y
end
_r(1, x1, y1)
_r(3, x2, y1)
_r(5, x2, y2)
_r(7, x1, y2)
t.xmin, t.xmax = xmin, xmax
t.ymin, t.ymax = ymin, ymax
return t
end
local function _extents(ax, ay, rect)
local n, px, py, dot, min, max
local divisor = ax*ax+ay*ay
for i = 1, 8, 2 do
--x, y = unpack(rect[i])
n = (rect[i]*ax + rect[i+1]*ay) / divisor
--px = n*ax
--py = n*ay
--dot = px*ax + py*ay
dot = n*ax*ax + n*ay*ay
if i == 1 then
min, max = dot, dot
else
if min > dot then min = dot end
if max < dot then max = dot end
end
end
return min, max
end
local function _extents2(ax, ay, x, y)
local n, px, py, dot, min, max
local divisor = ax*ax+ay*ay
for xp = 0, 1 do
for yp = 0, 1 do
n = ((x+(xp*almost_one))*ax + (y+(yp*almost_one))*ay) / divisor
dot = n*ax*ax + n*ay*ay
if min == nil then
min, max = dot, dot
else
if min > dot then min = dot end
if max < dot then max = dot end
end
end
end
--
--n = (x*ax + y*ay) / divisor
--min = n*ax*ax + n*ay*ay
--n = ((x+almost_one)*ax + (y+almost_one*ay)) / divisor
--max = n*ax*ax + n*ay*ay
--
--if max < min then
-- return max, min
--else
-- return min, max
--end
return min, max
end
function is_overlapping_rectangle(a, b)
if not (a.xmax >= b.xmin and b.xmax >= a.xmin and a.ymax >= b.ymin and b.ymax >= a.ymin) then
return false
end
local function check_axis(ax, ay)
local amin, amax = _extents(ax, ay, a)
local bmin, bmax = _extents(ax, ay, b)
return (bmax >= amin and amax >= bmin)
end
return (
check_axis(a[3] - a[1], a[4] - a[2])
and check_axis(a[3] - a[5], a[4] - a[6])
and check_axis(b[3] - b[1], b[4] - b[2])
and check_axis(b[3] - b[5], b[4] - b[6])
)
end
function get_overlapping_tiles(rect, result, tile)
tile = tile or true
if not result then
result = {}
setmetatable(result, { __index = function(t, k) local v = {}; t[k] = v; return v end })
end
if not box.orientation or box.orientation == 0 then
for x = floor(box.left_top.x), ceil(box.right_bottom.x - 1) do
for y = floor(box.left_top.y), ceil(box.right_bottom.y - 1) do
result[x][y] = tile
end
end
return result
end
local rect = area_to_rectangle(box) -- Convert to box
local function check_axis(ax, ay, x, y)
local amin, amax = _extents(ax, ay, rect)
local bmin, bmax = _extents2(ax, ay, x, y)
return (bmax >= amin and amax >= bmin)
end
-- {0, 0, 0, 1, 1, 1, 1, 0 }
for x = floor(rect.xmin), ceil(rect.xmax) do
for y = floor(rect.ymin), ceil(rect.ymax) do
if (
check_axis(rect[3] - rect[1], rect[4] - rect[2], x, y)
and check_axis(rect[3] - rect[5], rect[4] - rect[6], x, y)
and check_axis(0, almost_one, x, y)
and check_axis(-almost_one, 0, x, y)
) then
result[x][y] = tile
end
end
end
return result
end
end
Geom2D.get_overlapping_tiles = get_overlapping_tiles
Geom2D.is_overlapping_rectangle = is_overlapping_rectangle
Geom2D.area_to_rectangle = area_to_rectangle
return Geom2D
|
return {
version = "1.4",
luaversion = "5.1",
tiledversion = "1.4.3",
orientation = "orthogonal",
renderorder = "right-down",
width = 32,
height = 22,
tilewidth = 8,
tileheight = 8,
nextlayerid = 5,
nextobjectid = 837,
properties = {},
tilesets = {
{
name = "tiles-overworld",
firstgid = 1,
filename = "../../../../../tiled/new_tilesets/tiles-overworld.tsx",
tilewidth = 8,
tileheight = 8,
spacing = 0,
margin = 0,
columns = 36,
image = "../../graphics/tiles-overworld.png",
imagewidth = 288,
imageheight = 128,
objectalignment = "unspecified",
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 8,
height = 8
},
properties = {},
terrains = {},
tilecount = 576,
tiles = {}
},
{
name = "collide8",
firstgid = 577,
filename = "../../../../../tiled/new_tilesets/collide8.tsx",
tilewidth = 8,
tileheight = 8,
spacing = 0,
margin = 0,
columns = 1,
image = "../../graphics/collider8.png",
imagewidth = 8,
imageheight = 8,
objectalignment = "unspecified",
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 8,
height = 8
},
properties = {},
terrains = {},
tilecount = 1,
tiles = {}
}
},
layers = {
{
type = "tilelayer",
x = 0,
y = 0,
width = 32,
height = 22,
id = 2,
name = "Water_layer",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
},
{
type = "tilelayer",
x = 0,
y = 0,
width = 32,
height = 22,
id = 1,
name = "Ground_layer",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0,
5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 0, 0,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 0, 0,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
},
{
type = "tilelayer",
x = 0,
y = 0,
width = 32,
height = 22,
id = 3,
name = "Collision_layer",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88,
123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124,
87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88,
123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 88, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 87, 88, 0, 0, 87, 88,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 124, 0, 0, 123, 124, 0, 0, 0, 0, 0, 0, 123, 124, 0, 0, 123, 124,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 87, 88, 0, 0, 87, 88, 0, 0, 87, 88, 0, 0, 87, 88, 0, 0, 87, 88, 0, 0, 87, 88, 0, 0, 87, 88,
0, 0, 0, 0, 0, 0, 123, 124, 0, 0, 123, 124, 0, 0, 123, 124, 0, 0, 123, 124, 0, 0, 123, 124, 0, 0, 123, 124, 0, 0, 123, 124,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 88, 0, 0, 87, 88, 0, 0, 0, 0, 0, 0, 87, 88, 0, 0, 87, 88,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 124, 0, 0, 123, 124, 0, 0, 0, 0, 0, 0, 123, 124, 0, 0, 123, 124,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88,
123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124,
87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88, 87, 88,
123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124, 123, 124
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 4,
name = "Collide",
visible = false,
opacity = 0.5,
offsetx = 0,
offsety = 0,
properties = {},
objects = {
{
id = 610,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 611,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 612,
name = "",
type = "",
shape = "rectangle",
x = 208,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 613,
name = "",
type = "",
shape = "rectangle",
x = 216,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 614,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 615,
name = "",
type = "",
shape = "rectangle",
x = 232,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 616,
name = "",
type = "",
shape = "rectangle",
x = 240,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 617,
name = "",
type = "",
shape = "rectangle",
x = 248,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 623,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 624,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 625,
name = "",
type = "",
shape = "rectangle",
x = 64,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 626,
name = "",
type = "",
shape = "rectangle",
x = 72,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 627,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 628,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 629,
name = "",
type = "",
shape = "rectangle",
x = 96,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 630,
name = "",
type = "",
shape = "rectangle",
x = 104,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 651,
name = "",
type = "",
shape = "rectangle",
x = 208,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 652,
name = "",
type = "",
shape = "rectangle",
x = 200,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 653,
name = "",
type = "",
shape = "rectangle",
x = 192,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 654,
name = "",
type = "",
shape = "rectangle",
x = 184,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 655,
name = "",
type = "",
shape = "rectangle",
x = 176,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 656,
name = "",
type = "",
shape = "rectangle",
x = 168,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 657,
name = "",
type = "",
shape = "rectangle",
x = 160,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 658,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 676,
name = "",
type = "",
shape = "rectangle",
x = 240,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 677,
name = "",
type = "",
shape = "rectangle",
x = 232,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 678,
name = "",
type = "",
shape = "rectangle",
x = 224,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 679,
name = "",
type = "",
shape = "rectangle",
x = 216,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 680,
name = "",
type = "",
shape = "rectangle",
x = 248,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 681,
name = "",
type = "",
shape = "rectangle",
x = 128,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 682,
name = "",
type = "",
shape = "rectangle",
x = 136,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 683,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 684,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 685,
name = "",
type = "",
shape = "rectangle",
x = 160,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 686,
name = "",
type = "",
shape = "rectangle",
x = 168,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 687,
name = "",
type = "",
shape = "rectangle",
x = 176,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 688,
name = "",
type = "",
shape = "rectangle",
x = 184,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 689,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 690,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 691,
name = "",
type = "",
shape = "rectangle",
x = 240,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 692,
name = "",
type = "",
shape = "rectangle",
x = 240,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 693,
name = "",
type = "",
shape = "rectangle",
x = 248,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 694,
name = "",
type = "",
shape = "rectangle",
x = 248,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 695,
name = "",
type = "",
shape = "rectangle",
x = 240,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 696,
name = "",
type = "",
shape = "rectangle",
x = 248,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 697,
name = "",
type = "",
shape = "rectangle",
x = 248,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 698,
name = "",
type = "",
shape = "rectangle",
x = 240,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 699,
name = "",
type = "",
shape = "rectangle",
x = 208,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 700,
name = "",
type = "",
shape = "rectangle",
x = 216,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 701,
name = "",
type = "",
shape = "rectangle",
x = 216,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 703,
name = "",
type = "",
shape = "rectangle",
x = 208,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 704,
name = "",
type = "",
shape = "rectangle",
x = 208,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 705,
name = "",
type = "",
shape = "rectangle",
x = 208,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 706,
name = "",
type = "",
shape = "rectangle",
x = 216,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 707,
name = "",
type = "",
shape = "rectangle",
x = 216,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 708,
name = "",
type = "",
shape = "rectangle",
x = 208,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 709,
name = "",
type = "",
shape = "rectangle",
x = 216,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 710,
name = "",
type = "",
shape = "rectangle",
x = 240,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 711,
name = "",
type = "",
shape = "rectangle",
x = 248,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 712,
name = "",
type = "",
shape = "rectangle",
x = 248,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 713,
name = "",
type = "",
shape = "rectangle",
x = 240,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 714,
name = "",
type = "",
shape = "rectangle",
x = 216,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 715,
name = "",
type = "",
shape = "rectangle",
x = 208,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 723,
name = "",
type = "",
shape = "rectangle",
x = 256,
y = 40,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 724,
name = "",
type = "",
shape = "rectangle",
x = 256,
y = 48,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 727,
name = "",
type = "",
shape = "rectangle",
x = 256,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 728,
name = "",
type = "",
shape = "rectangle",
x = 256,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 731,
name = "",
type = "",
shape = "rectangle",
x = 256,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 732,
name = "",
type = "",
shape = "rectangle",
x = 256,
y = 112,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 735,
name = "",
type = "",
shape = "rectangle",
x = 256,
y = 136,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 736,
name = "",
type = "",
shape = "rectangle",
x = 256,
y = 144,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 750,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 751,
name = "",
type = "",
shape = "rectangle",
x = 96,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 752,
name = "",
type = "",
shape = "rectangle",
x = 104,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 753,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 754,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 755,
name = "",
type = "",
shape = "rectangle",
x = 128,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 756,
name = "",
type = "",
shape = "rectangle",
x = 136,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 757,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 766,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 767,
name = "",
type = "",
shape = "rectangle",
x = 32,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 768,
name = "",
type = "",
shape = "rectangle",
x = 40,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 769,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 770,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 771,
name = "",
type = "",
shape = "rectangle",
x = 64,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 772,
name = "",
type = "",
shape = "rectangle",
x = 72,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 773,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 774,
name = "",
type = "",
shape = "rectangle",
x = 8,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 775,
name = "",
type = "",
shape = "rectangle",
x = 16,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 776,
name = "",
type = "",
shape = "rectangle",
x = 8,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 777,
name = "",
type = "",
shape = "rectangle",
x = 16,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 778,
name = "",
type = "",
shape = "rectangle",
x = 24,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 779,
name = "",
type = "",
shape = "rectangle",
x = 32,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 780,
name = "",
type = "",
shape = "rectangle",
x = 40,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 785,
name = "",
type = "",
shape = "rectangle",
x = 0,
y = 152,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 786,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 40,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 787,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 48,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 788,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 789,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 790,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 72,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 791,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 80,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 792,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 793,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 794,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 104,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 795,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 112,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 796,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 797,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 798,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 136,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 799,
name = "",
type = "",
shape = "rectangle",
x = -8,
y = 144,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 800,
name = "",
type = "",
shape = "rectangle",
x = 0,
y = 32,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 801,
name = "",
type = "",
shape = "rectangle",
x = 176,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 802,
name = "",
type = "",
shape = "rectangle",
x = 176,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 803,
name = "",
type = "",
shape = "rectangle",
x = 184,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 804,
name = "",
type = "",
shape = "rectangle",
x = 184,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 805,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 806,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 807,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 808,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 809,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 810,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 811,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 812,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 813,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 814,
name = "",
type = "",
shape = "rectangle",
x = 144,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 815,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 816,
name = "",
type = "",
shape = "rectangle",
x = 152,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 817,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 818,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 819,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 120,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 820,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 128,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 821,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 822,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 823,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 824,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 825,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 826,
name = "",
type = "",
shape = "rectangle",
x = 112,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 827,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 56,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 828,
name = "",
type = "",
shape = "rectangle",
x = 120,
y = 64,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 829,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 830,
name = "",
type = "",
shape = "rectangle",
x = 80,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 831,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 832,
name = "",
type = "",
shape = "rectangle",
x = 88,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 833,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 834,
name = "",
type = "",
shape = "rectangle",
x = 48,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 835,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 88,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
},
{
id = 836,
name = "",
type = "",
shape = "rectangle",
x = 56,
y = 96,
width = 8,
height = 8,
rotation = 0,
gid = 577,
visible = true,
properties = {}
}
}
}
}
}
|
return function ()
vim.g.dirvish_mode = ':sort ,^.*[\\/],'
end
|
local setmetatable = setmetatable
local singleton
local cipher = {}
cipher.__index = cipher
function cipher.new()
if singleton == nil then
singleton = setmetatable({}, cipher)
end
return singleton
end
function cipher:encrypt(d)
return d
end
function cipher:decrypt(d)
return d
end
return cipher |
local Spider = Fight:extend()
function Spider:new(...)
Spider.super.new(self, ...)
Art.new(self, "spider")
self.enemyName = "creature"
self.anim:add("attacking", 2);
self.anim:add("defending", 1);
self.anim:add("prepareAttack", 2);
self.anim:add("prepareDefense", 1);
self.health = 100
self.attack = 3
self.timeAttacking = 4
self.timeDefending = 3
self.strength = 20
self.description = "Внезапно, [username] столкнулась с паукообразным существом. Его клыки были остры как бритва, и он не спускал глаз с врага."
self.attackDescription = "Существо нацелило свои клыки на [username]"
self.prepareAttackDescription = "Значит, существо готовилось к нападению!"
end
function Spider:update(dt)
Spider.super.update(self, dt)
end
function Spider:draw()
Spider.super.draw(self)
end
function Spider:__tostring()
return lume.tostring(self, "Forest")
end
return Spider |
vim.opt.completeopt = { "menu", "menuone", "noselect" }
local lspkind = require "lspkind"
lspkind.init()
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
vim.fn["UltiSnips#Anon"](args.body)
end,
},
mapping = {
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-s>'] = cmp.mapping.complete({
config = {sources = {{ name = 'nvim_lsp' }}}
}),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable,
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
},
sources ={
{ name = 'ultisnips' },
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'nvim_lua'},
{ name = 'buffer', keyword_length = 4,},
},
formatting = {
format = lspkind.cmp_format {
with_text = true,
menu = {
buffer = "[buf]",
nvim_lua = "[api]",
nvim_lsp = "[LSP]",
path = "[path]",
ultisnips= "[snip]",
},
},
},
experimental = {
native_menu = false,
},
require'cmp'.setup.cmdline('/', {sources = {{ name = 'buffer' }}}),
require'cmp'.setup.cmdline(':', {sources = {{ name = 'cmdline' }}}),
})
|
--[[The MIT License (MIT)
Copyright (c) 2017 IllidanS4
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 entityEnumerator = {
__gc = function(enum)
if enum.destructor and enum.handle then
enum.destructor(enum.handle)
end
enum.destructor = nil
enum.handle = nil
end
}
local function EnumerateEntities(initFunc, moveFunc, disposeFunc)
return coroutine.wrap(function()
local iter, id = initFunc()
if not id or id == 0 then
disposeFunc(iter)
return
end
local enum = {handle = iter, destructor = disposeFunc}
setmetatable(enum, entityEnumerator)
local next = true
repeat
coroutine.yield(id)
next, id = moveFunc(iter)
until not next
enum.destructor, enum.handle = nil, nil
disposeFunc(iter)
end)
end
function EnumerateObjects()
return EnumerateEntities(FindFirstObject, FindNextObject, EndFindObject)
end
function EnumeratePeds()
return EnumerateEntities(FindFirstPed, FindNextPed, EndFindPed)
end
function EnumerateVehicles()
return EnumerateEntities(FindFirstVehicle, FindNextVehicle, EndFindVehicle)
end
function EnumeratePickups()
return EnumerateEntities(FindFirstPickup, FindNextPickup, EndFindPickup)
end
--[[Usage:
for ped in EnumeratePeds() do
<do something with 'ped'>
end
]] |
--------------------------------------------------------------------------------
_G.CHERRY_VERSION = '3.7.0'
--------------------------------------------------------------------------------
-- debug
require 'cherry.libs.logger'
require 'cherry.libs.test-rect'
-- libs extensions
require 'cherry.libs.math'
require 'cherry.libs.string'
require 'cherry.libs.table'
--------------------------------------------------------------------------------
local time = require 'cherry.libs.time'
local seed = time.getTimeMs()
math.randomseed(seed)
--------------------------------------------------------------------------------
-- corona
_G.composer = _G.composer or require 'composer'
-- app
_G.App = require 'cherry.core.app'
_G.Router = require 'cherry.core.router'
--------------------------------------------------------------------------------
_G.FULL_W = display.contentWidth
_G.FULL_H = display.contentHeight
_G.W = display.safeActualContentWidth
_G.H = display.safeActualContentHeight
_G.TOP = display.safeScreenOriginY
_G.BOTTOM = display.safeScreenOriginY + display.safeActualContentHeight
-- local safeArea = display.newRect(W / 2, TOP + H / 2, W, H)
-- local colorize = require 'cherry.libs.colorize'
-- safeArea:setFillColor(colorize('#fff'))
-- safeArea.alpha = 0.2
--------------------------------------------------------------------------------
-- https://docs.coronalabs.com/tutorial/media/extendAnchors/index.html#extending-anchor-points-1
display.setDefault('isAnchorClamped', false)
|
ENT.Type = "point"
---------------------------------------------------------
--
---------------------------------------------------------
function ENT:Initialize()
end
---------------------------------------------------------
--
---------------------------------------------------------
function ENT:KeyValue(key, value)
if (key == "gamemode") then
local data = string.Explode(" ", value)
self.minigames = {}
for k, v in pairs(data) do
table.insert(self.minigames, v)
end
else
self[key] = value
end
end |
-- add easy way for lua code to be the text source for a geeklet
local module = {
--[=[
_NAME = 'GeekTool Replacement',
_VERSION = 'the 3rd digit of Pi/0',
_URL = 'https://github.com/asmagill/hammerspoon-config',
_LICENSE = [[ See README.md ]]
_DESCRIPTION = [[]],
--]=]
}
local fnutils = require("hs.fnutils")
local drawing = require("hs.drawing")
local stext = require("hs.styledtext")
local task = require("hs.task")
local timer = require("hs.timer")
-- local caffeinate = require("hs.caffeinate")
local log = require("hs.logger").new("geeklets","warning")
module.log = log
-- private variables and methods -----------------------------------------
local registeredGeeklets = {}
local orderDrawings = function(name)
if registeredGeeklets[name].isVisible then
for i = #registeredGeeklets[name].drawings, 2, -1 do
registeredGeeklets[name].drawings[i]:orderBelow(registeredGeeklets[name].drawings[1])
end
end
end
local GeekTimer = timer.new(1, function()
for i,v in pairs(registeredGeeklets) do
if (v.lastRun + v.period) <= os.time() then
if v.enabled then
if v.kind == "task" then
if v.task and v.task:isRunning() then
if (v.lastNotified + 60) < os.time() then
log.wf("%s: is still running -- either period is too short or it has hung", v.name)
v.lastNotified = os.time()
end
else
v.task = task.new(v.path, function(c, o, e)
if c ~= 0 then
log.wf("%s: status: %d error:%s output:%s", v.name, c, e, o)
end
v.drawings[1]:setStyledText(stext.ansi(o, v.textStyle))
v.lastNotified = 0
v.task = nil
end)
v.lastRun = os.time()
v.task:start()
end
elseif v.kind == "lua" then
local state, result = nil, ""
if type(v.code) == "function" then
state, result = pcall(v.code)
else
state, result = pcall(dofile, v.code)
end
if state then
if result then
if v.isAlreadyStyled then
v.drawings[1]:setStyledText(result)
else
v.drawings[1]:setStyledText(stext.ansi(result, v.textStyle))
end
else
v.drawings[1]:hide()
end
v.lastRun = os.time()
v.lastNotified = 0
else
if (v.lastNotified + 60) < os.time() then
log.wf("%s: error %s", v.name, tostring(result))
local errorStyle = {}
for i,v in pairs(v.textStyle) do errorStyle[i] = v end
errorStyle.color = {red=1}
errorStyle.font = stext.convertFont(v.textStyle.font, stext.fontTraits.italicFont)
v.drawings[1]:setStyledText(stext.ansi(tostring(result), errorStyle))
v.lastNotified = os.time()
end
end
end
orderDrawings(v.name)
end
end
end
end)
-- local geekletSleepWatcher = caffeinate.watcher.new(function(event)
-- if event == caffeinate.watcher.systemDidWake then
-- for i,v in pairs(registeredGeeklets) do
-- v.lastNotified = 0
-- end
-- elseif event == caffeinate.watcher.systemWillSleep then
-- for i,v in pairs(registeredGeeklets) do
-- if v.task and v.task:isRunning() then
-- v.task:setCallback(nil):terminate()
-- end
-- end
-- end
-- end):start()
local watchable = require("hs.watchable")
module.watchCaffeinatedState = watchable.watch("generalStatus.caffeinatedState", function(w, p, i, old, new)
if new == 1 then -- systemWillSleep
for i,v in pairs(registeredGeeklets) do
if v.task and v.task:isRunning() then
v.task:setCallback(nil):terminate()
end
end
elseif new == 0 then -- systemDidWake
for i,v in pairs(registeredGeeklets) do
v.lastNotified = 0
end
end
end)
-- Change the defaults in here if you don't like mine!
local registerGeeklet = function(kind, name, period, path, frame, textStyle, otherDrawings)
assert(kind == "lua" or kind == "task", "Unknown geeklet type: "..tostring(kind))
local code = nil
if kind == "lua" then code, path = path, nil end
local theStyle, theDrawings = textStyle, otherDrawings
-- take advantage of the fact that textStyle is a table while otherDrawings is an array
if type(textStyle) == "table" and #textStyle ~= 0 then
theDrawings = textStyle
theStyle = {}
end
if not theStyle.font then theStyle.font = { name = "Menlo", size = 12 } end
if not registeredGeeklets[name] then
registeredGeeklets[name] = setmetatable({
kind = kind,
name = name,
period = period,
path = path,
code = code,
frame = frame,
textStyle = theStyle,
isAlreadyStyled = theStyle.skip,
isVisible = true,
enabled = false,
lastRun = -1,
lastNotified = -1,
shouldHover = false,
isOnAllSpaces = true,
layer = true,
drawings = theDrawings,
}, {
__index = {
start = module.start,
stop = module.stop,
delete = module.delete,
visible = module.visible,
toggle = module.toggle,
hover = module.hover,
onAllSpaces = module.onAllSpaces,
wantsLayer = module.wantsLayer,
}
})
table.insert(registeredGeeklets[name].drawings, 1, drawing.text(frame, " "))
else
error(name.." is already registered", 2)
end
return registeredGeeklets[name]:hover(registeredGeeklets[name].shouldHover)
:visible(registeredGeeklets[name].isVisible)
:wantsLayer(registeredGeeklets[name].layer)
:onAllSpaces(registeredGeeklets[name].isOnAllSpaces)
end
-- Public interface ------------------------------------------------------
module.registerLuaGeeklet = function(name, period, code, frame, textStyle, otherDrawings)
assert(type(name) == "string", "Argument 1, Name, must be specified as a string")
assert(type(period) == "number", "Argument 2, Period, must be specified as a number")
assert(type(code) == "string" or type(code) == "function", "Argument 3, Path, must be specified as a string or a function")
assert(type(frame) == "table", "Argument 4, Frame, must be specified as a table")
return registerGeeklet("lua", name, period, code, frame, textStyle, otherDrawings)
end
module.registerShellGeeklet = function(name, period, path, frame, textStyle, otherDrawings)
assert(type(name) == "string", "Argument 1, Name, must be specified as a string")
assert(type(period) == "number", "Argument 2, Period, must be specified as a number")
assert(type(path) == "string", "Argument 3, Path, must be specified as a string")
assert(type(frame) == "table", "Argument 4, Frame, must be specified as a table")
return registerGeeklet("task", name, period, path, frame, textStyle, otherDrawings)
end
module.start = function(name)
local iReturn = name
if type(name) == "table" then name = name.name end
if not registeredGeeklets[name] then
error(name.." is not registered", 2)
else
registeredGeeklets[name].enabled = true
end
return iReturn
end
module.stop = function(name)
local iReturn = name
if type(name) == "table" then name = name.name end
if not registeredGeeklets[name] then
error(name.." is not registered", 2)
else
registeredGeeklets[name].enabled = false
end
return iReturn
end
module.delete = function(name)
local iReturn = name
if type(name) == "table" then name = name.name end
if not registeredGeeklets[name] then
error(name.." is not registered", 2)
else
registeredGeeklets[name]:stop()
-- for j,k in ipairs(registeredGeeklets[name].drawings) do
-- k:delete()
for k = #registeredGeeklets[name].drawings, 1, -1 do
registeredGeeklets[name].drawings[k]:delete()
end
registeredGeeklets[name].drawings = nil
registeredGeeklets[name] = nil
end
end
module.visible = function(name, state)
local iReturn = name
if type(name) == "table" then name = name.name end
if not registeredGeeklets[name] then
error(name.." is not registered", 2)
else
if state == nil then return registeredGeeklets[name].isVisible end
-- for i,v in ipairs(registeredGeeklets[name].drawings) do
-- if state then v:show() else v:hide() end
for v = #registeredGeeklets[name].drawings, 1, -1 do
if state then
registeredGeeklets[name].drawings[v]:show()
else
registeredGeeklets[name].drawings[v]:hide()
end
end
registeredGeeklets[name].isVisible = state
orderDrawings(name)
end
return iReturn
end
module.hover = function(name, state)
local iReturn = name
if type(name) == "table" then name = name.name end
if not registeredGeeklets[name] then
error(name.." is not registered", 2)
else
if state == nil then return registeredGeeklets[name].shouldHover end
-- for i,v in ipairs(registeredGeeklets[name].drawings) do
for v = #registeredGeeklets[name].drawings, 1, -1 do
if state then
-- v:setLevel(drawing.windowLevels.popUpMenu)
registeredGeeklets[name].drawings[v]:setLevel(drawing.windowLevels.popUpMenu)
else
-- v:setLevel(drawing.windowLevels.desktopIcon)
registeredGeeklets[name].drawings[v]:setLevel(drawing.windowLevels.desktopIcon)
end
end
registeredGeeklets[name].shouldHover = state
orderDrawings(name)
end
return iReturn
end
module.toggle = function(name)
if type(name) == "table" then name = name.name end
return module.visible(name, not registeredGeeklets[name].isVisible)
end
module.wantsLayer = function(name, state)
local iReturn = name
if type(name) == "table" then name = name.name end
if not registeredGeeklets[name] then
error(name.." is not registered", 2)
else
if state == nil then return registeredGeeklets[name].layer end
registeredGeeklets[name].drawings[1]:wantsLayer(state)
registeredGeeklets[name].layer = state
end
return iReturn
end
module.onAllSpaces = function(name, state)
local iReturn = name
if type(name) == "table" then name = name.name end
if not registeredGeeklets[name] then
error(name.." is not registered", 2)
else
if state == nil then return registeredGeeklets[name].isOnAllSpaces end
-- for j,k in ipairs(registeredGeeklets[name].drawings) do
for k = #registeredGeeklets[name].drawings, 1, -1 do
if state then
-- k:setBehaviorByLabels{"canJoinAllSpaces"}
registeredGeeklets[name].drawings[k]:setBehaviorByLabels{"canJoinAllSpaces"}
else
-- k:setBehaviorByLabels{"default"}
registeredGeeklets[name].drawings[k]:setBehaviorByLabels{"default"}
end
end
registeredGeeklets[name].onAllSpaces = state
end
return iReturn
end
module.status = function()
print("GeekLet timer status: "..(GeekTimer:running() and "running" or "stopped"))
print(string.format("%-20s %-8s %1s %1s %s","Name", "Period", "E", "V", "Last Run"))
print(string.rep("-",60))
for i,v in fnutils.sortByKeys(registeredGeeklets) do
print(string.format("%-20s %6d %1s %1s %s",
i,
v.period,
(v.enabled and "T" or "F"),
(v.isVisible and "T" or "F"),
((v.lastRun == -1) and "not yet" or os.date("%c", v.lastRun))
))
end
end
module.stopUpdates = function()
return GeekTimer:stop()
end
module.startUpdates = function()
return GeekTimer:start()
end
module.hideAll = function()
for i,v in pairs(registeredGeeklets) do
if v.visible then
-- for j, k in ipairs(v.drawings) do k:hide() end
for k = #v.drawings, 1, -1 do
v.drawings[k]:hide()
end
end
end
end
module.showAll = function()
for i,v in pairs(registeredGeeklets) do
if v.visible then
-- for j, k in ipairs(v.drawings) do k:show() end
for k = #v.drawings, 1, -1 do
v.drawings[k]:show()
end
end
end
end
module.timer = GeekTimer
module.sleepWatcher = geekletSleepWatcher
module.geeklets = registeredGeeklets
-- Return Module Object --------------------------------------------------
-- return setmetatable(module, {
-- __gc = function(obj)
-- if GeekTimer:running() then GeekTimer:stop() end
-- end
-- })
return module
|
--[[
MIT License
Copyright (c) 2019-2021 Marco Lizza
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 Class = require("tofu.core").Class
local System = require("tofu.core").System
local Canvas = require("tofu.graphics").Canvas
local Display = require("tofu.graphics").Display
local Program = require("tofu.graphics").Program
local Font = require("tofu.graphics").Font
local Timer = require("tofu.timers").Timer
local Background = Class.define()
function Background:__ctor(canvas, transparent, palette)
local _, height = canvas:size()
local half_height = math.tointeger(height * 0.5)
local quarter_height = math.tointeger(height * 0.25)
self.font = Font.new(Canvas.new("assets/images/font-8x8.png", transparent, palette:match(255, 255, 255)),
8, 8)
self.timer = Timer.new(10, 0, function(_)
local program = Program.gradient(transparent, {
{ 0, palette:get(math.random(0, transparent)) },
{ quarter_height - 1, palette:get(math.random(0, transparent)) },
{ half_height - 1, palette:get(math.random(0, transparent)) },
{ height - quarter_height - 1, palette:get(math.random(0, transparent)) },
{ height - 1, palette:get(math.random(0, transparent)) }
})
-- program:wait(0, height - math.tointeger(quarter_height / 2) - 1)
-- program:modulo(-width * 4)
Display.program(program)
end)
end
function Background:update(_)
end
function Background:render(canvas)
--[[
self.canvas:push()
local x, y = 0, 0
local dy = 0
local message = '* T O F U - E N G I N E '
local colours = { 0, 5, 6, 10, 7, 23, 6, 5 }
local offset = 0 -- math.tointeger(t * 17.0)
local cursor = math.tointeger(t * 5.0)
for k = 0, 49 do
local dx = 0
local max_char_height = 0
for i = 0, 59 do
local j = ((cursor + k + i) % #message) + 1
local c = message:sub(j, j)
local char_width, char_height = self.font:size(c)
if char_height > max_char_height then
max_char_height = char_height
end
canvas:shift(0, colours[(i + offset) % #colours + 1])
self.font:write(c, x + dx, y + dy)
dx = dx + char_width
end
dy = dy + char_height
end
self.canvas:pop()
--]]
local width, height = canvas:size()
self.font:write(canvas, width, 0, string.format("%d FPS", System.fps()), "right", "top")
self.font:write(canvas, width, height, string.format("%d KiB", System.heap("kb")), "right", "bottom")
end
return Background
|
local p = Instance.new ("Part" , game.Workspace)
p.Name = "Base"
p.Size = Vector3.new (512,0.400000006,512)
p.Anchored = true
p.Locked = true
p.CFrame = CFrame.new(0, 0, 0)
local k = Instance.new ("Message" , game.Workspace)
game.Workspace.Base.BrickColor = BrickColor.new ("Earth green")
|
local TweenService = game:GetService("TweenService")
local require = require(game:GetService("ReplicatedStorage"):WaitForChild("ApeIntelligence"))
local DraggableBar = require("DraggableBar")
local BuildWindow = require("BuildWindow")
local DraggableWindow = {}
DraggableWindow.__index = DraggableWindow
DraggableWindow.ClassName = "DraggableWindow"
DraggableWindow.Info = TweenInfo.new(.4, Enum.EasingStyle.Quad)
local Properties = {
["Frame"] = {
BackgroundTransparency = 1;
};
["TextLabel"] = {
BackgroundTransparency = 1; TextTransparency = 1;
TextStrokeTransparency = 1;
};
["TextButton"] = {
BackgroundTransparency = 1; TextTransparency = 1;
TextStrokeTransparency = 1;
};
["ImageButton"] = {
BackgroundTransparency = 1; ImageTransparency = 1;
};
["ImageLabel"] = {
BackgroundTransparency = 1; ImageTransparency = 1;
};
}
function DraggableWindow.SetupCanvas(Player)
assert(Player:WaitForChild("PlayerGui", 5), string.format("%q is not present", "PlayerGui"))
local ScreenGui = BuildWindow.CreateScreenGui(true)
ScreenGui.Name = "MenuPanel"
ScreenGui.Parent = Player.PlayerGui
return ScreenGui
end
--- wrapper for draggable menus
-- use .new to create a new one from scratch
function DraggableWindow.new(Parent, Title)
local Gui = BuildWindow:CreateFullPackage(Title)
local Bar = Gui:FindFirstChild("Header")
Gui.Parent = Parent
return DraggableWindow.CreateExisting(Bar, Gui)
end
-- use .CreateExisting to create one off an existing menu
function DraggableWindow.CreateExisting(Bar, Gui)
local CloseButton = Gui:FindFirstChild("CloseButton", true)
assert(CloseButton, string.format("%q is not present", "CloseButton"))
local self = setmetatable(DraggableBar.new(Bar, Gui), DraggableWindow)
self.Enabled = false
self.Animating = false
self.Contents = {}
local function HandleDescendant(GuiBase)
if not typeof(GuiBase) == "Instance" or not GuiBase:IsA("GuiBase") or not Properties[GuiBase.ClassName] then return end
local Tab = {}
for PropName, _ in pairs(Properties[GuiBase.ClassName]) do
if GuiBase[PropName] then
Tab[PropName] = GuiBase[PropName]
end
end
self.Contents[GuiBase] = {
[true] = Tab;
[false] = Properties[GuiBase.ClassName];
}
end
self.Maid:GiveTask(Gui.DescendantAdded:Connect(function(GuiBase)
HandleDescendant(GuiBase)
end))
self.Maid:GiveTask(Gui.DescendantRemoving:Connect(function(GuiBase)
if typeof(GuiBase) ~= "Instance" or not GuiBase:IsA("GuiBase") or not self.Conents[GuiBase] then return end
self.Conents[GuiBase] = nil
end))
self.Maid:GiveTask(CloseButton.Activated:Connect(function()
self:Toggle(false)
end))
for _, GuiBase in pairs(Gui:GetDescendants()) do
HandleDescendant(GuiBase)
end
self:Toggle(false)
self.Gui.Visible = false
return self
end
function DraggableWindow:Toggle(Bool)
if self.Animating then return end
self.Animating = true
if Bool then
self.Gui.Visible = true
end
local LastTween
for GuiBase, Table in pairs(self.Contents) do
LastTween = TweenService:Create(GuiBase, self.Info, Table[Bool])
LastTween:Play()
end
LastTween.Completed:Wait()
self.Enabled = Bool
self.Gui.Visible = Bool
self.Animating = false
end
function DraggableWindow:Destroy()
self.Maid:DoCleaning()
self.Gui:Destroy()
end
return DraggableWindow |
local lib = _3DreamEngine
local class = { }
function class:setLOD(min, max)
self.LOD_min = min
self.LOD_max = max
end
function class:getLOD()
return self.LOD_min, self.LOD_max
end
function class:setVisible(b)
self:setRenderVisibility(b)
self:setShadowVisibility(b)
end
function class:setRenderVisibility(b)
if self.class == "object" then
for d,s in pairs(self.objects) do
s:setRenderVisibility(b)
end
for d,s in pairs(self.meshes) do
s:setRenderVisibility(b)
end
else
self.renderVisibility = b or false
end
end
function class:getRenderVisibility()
return self.renderVisibility
end
function class:setShadowVisibility(b)
if self.class == "object" then
for d,s in pairs(self.objects) do
s:setShadowVisibility(b)
end
for d,s in pairs(self.meshes) do
s:setShadowVisibility(b)
end
else
self.shadowVisibility = b or false
end
end
function class:getShadowVisibility()
return self.shadowVisibility
end
function class:setFarVisibility(b)
if self.class == "object" then
for d,s in pairs(self.objects) do
s:setFarVisibility(b)
end
for d,s in pairs(self.meshes) do
s:setFarVisibility(b)
end
else
self.farVisibility = b
end
end
function class:getFarVisibility()
return self.farVisibility == true
end
return class |
local Attack1 = script:GetCustomProperty("Attack1"):WaitForObject()
local Attack2 = script:GetCustomProperty("Attack2"):WaitForObject()
local Dodge = script:GetCustomProperty("Dodge"):WaitForObject()
local BladeProjectile = script:GetCustomProperty("BladeProjectile")
function BladeAttack(ability)
local target = ability.owner:GetPrivateNetworkedData("Target")
if target ~= nil then
local forwardVector = ability.owner:GetWorldTransform():GetForwardVector()
print("Spawned")
local projectile = Projectile.Spawn(BladeProjectile, ability.owner:GetWorldPosition() + forwardVector * 300, Vector3.UP)
projectile.speed = 300
projectile.gravityScale = 0
projectile.lifeSpan = 2
projectile.homingTarget = target
end
end
Attack1.executeEvent:Connect(BladeAttack) |
local ControllerImageLibrary = {}
local spritesheets = {}
for _, platform in pairs(script.Spritesheets:GetChildren()) do
spritesheets[platform.Name] = {}
for _, style in pairs(platform:GetChildren()) do
spritesheets[platform.Name][style.Name] = require(style).new()
end
end
local function getImageInstance(instanceType, index, style)
local platform = "XboxOne"
if type(index)== "userdata" then
index = string.sub(tostring(index), 14)
end
local sheet = spritesheets[platform][style]
if not sheet then
warn("Could not find style: " .. style)
return
end
local element = sheet:GetSprite(instanceType, index)
return element
end
function ControllerImageLibrary:GetImageLabel(index, style, platform)
return getImageInstance("ImageLabel", index, style, platform)
end
function ControllerImageLibrary:GetImageButton(index, style, platform)
return getImageInstance("ImageButton", index, style, platform)
end
return ControllerImageLibrary
|
test = {
a = function (n1, n2, s1, s2)
return {s1, s2, n2, n1}
end,
b = function (strnum)
return {tonumber(strnum), tonumber64(strnum)}
end
}
|
local ShadowFiend = {}
-- ShadowFiend.autoRaze = Menu.AddOption({"Hero Specific", "Shadow Fiend"}, "Auto Raze for KS", "On/Off")
ShadowFiend.awareness = Menu.AddOption({"Hero Specific", "Shadow Fiend"}, "Awareness", "Show Kill Potential")
ShadowFiend.font = Renderer.LoadFont("Tahoma", 30, Enum.FontWeight.EXTRABOLD)
function ShadowFiend.OnDraw()
if not Menu.IsEnabled(ShadowFiend.awareness) then return end
local myHero = Heroes.GetLocal()
if not myHero or NPC.GetUnitName(myHero) ~= "npc_dota_hero_nevermore" then return end
local myMana = NPC.GetMana(myHero)
local magicDamageFactor = 0.75
local raze_short = NPC.GetAbilityByIndex(myHero, 0)
local raze_mid = NPC.GetAbilityByIndex(myHero, 1)
local raze_long = NPC.GetAbilityByIndex(myHero, 2)
local raze_level = Ability.GetLevel(raze_short)
local raze_damage = (raze_level > 0) and 100+75*(raze_level-1) or 0
local true_raze_damage = raze_damage * magicDamageFactor
local raze_radius = 250
local raze_mana_cost = 90
local short_range, mid_range, long_range = 200, 450, 700
for i = 1, Heroes.Count() do
local enemy = Heroes.Get(i)
if not NPC.IsIllusion(enemy) and not Entity.IsSameTeam(myHero, enemy) and not Entity.IsDormant(enemy) and Entity.IsAlive(enemy) then
local enemyHp = Entity.GetHealth(enemy)
local physicalDamage = NPC.GetDamageMultiplierVersus(myHero, enemy) * NPC.GetTrueDamage(myHero) * NPC.GetArmorDamageMultiplier(enemy)
local hitsLeft = (physicalDamage > 0) and math.ceil((enemyHp - true_raze_damage) / physicalDamage) or 999999
-- =================
-- Awareness
-- =================
local pos = Entity.GetAbsOrigin(enemy)
local x, y, visible = Renderer.WorldToScreen(pos)
-- red : can kill; green : cant kill
if enemyHp - true_raze_damage <= 0 then
Renderer.SetDrawColor(255, 0, 0, 255)
Renderer.DrawTextCentered(ShadowFiend.font, x, y, "One", 1)
elseif enemyHp - 2 * true_raze_damage <= 0 then
Renderer.SetDrawColor(255, 0, 0, 255)
Renderer.DrawTextCentered(ShadowFiend.font, x, y, "Two", 1)
else
Renderer.SetDrawColor(0, 255, 0, 255)
Renderer.DrawTextCentered(ShadowFiend.font, x, y, hitsLeft, 1)
end
-- ======================
-- auto kill using razes
-- ======================
-- local myPos = Entity.GetAbsOrigin(myHero)
-- local myAngle = Entity.GetRotation(myHero)
-- -- one raze to kill
-- if enemyHp - true_raze_damage <= 0 then
-- -- short_range +/- raze_radius/2
-- if Ability.IsCastable(raze_short, myMana) and NPC.IsEntityInRange(enemy, myHero, short_range+raze_radius/2) then
-- Ability.CastNoTarget(raze_short)
-- sleep(0.02)
-- end
-- -- mid_range +/- raze_radius/2
-- if Ability.IsCastable(raze_short, myMana) and not NPC.IsEntityInRange(enemy, myHero, mid_range-raze_radius/2) and NPC.IsEntityInRange(enemy, myHero, mid_range+raze_radius/2) then
-- Ability.CastNoTarget(raze_mid)
-- sleep(0.02)
-- end
-- -- long_range +/- raze_radius/2
-- if Ability.IsCastable(raze_short, myMana) and not NPC.IsEntityInRange(enemy, myHero, long_range-raze_radius/2) and NPC.IsEntityInRange(enemy, myHero, long_range+raze_radius/2) then
-- Ability.CastNoTarget(raze_long)
-- sleep(0.02)
-- end
-- -- two razes to kill
-- elseif enemyHp - 2 * true_raze_damage <= 0 then
-- end
end -- end of if statement
end -- end of for loop
end
local clock = os.clock
function sleep(n) -- seconds
local t0 = clock()
while clock() - t0 <= n do end
end
return ShadowFiend |
require 'dp'
require 'cutorch'
require 'cunn'
require 'cunnx'
local dptest = {}
local precision_forward = 1e-4
local precision_backward = 1e-2
local nloop = 10000
local times = {}
local dptestx = {}
function dptest.languagemodel()
local ds = dp.BillionWords{train_file='train_tiny.th7',context_size=5}
local hierarchy = ds:hierarchy()
local train = ds:trainSet()
local nn_inputs = {}
local a = torch.Timer()
for i=1,nloop,512 do
local batch = train:sub(i,i+511)
local targets = batch:targets():forward('b')
table.insert(nn_inputs, {batch:inputs():forward('bt'), targets})
end
print("input Time ".. a:time().real)
local tm = {}
local title = 'language model forward'
times[title] = tm
local model = dp.Sequential{
models = {
dp.Dictionary{
dict_size = ds:vocabularySize(),
output_size = 50
},
dp.Neural{
input_size = 50*5,
output_size = 50,
transfer = nn.Tanh()
},
dp.SoftmaxTree{
input_size = 50,
hierarchy = hierarchy,
root_id = 880542
}
}
}
model:zeroStatistics()
a:reset()
local resdp, batch
for i=1,nloop,512 do
batch = train:sub(batch, i, i+511)
local carry = batch:carry()
carry:putObj('nSample', 512)
resdp = model:forward(batch:inputs(), carry)
end
tm.dp = a:time().real
print("dp Time ".. a:time().real)--]]
local tm4 = {}
local title = 'language model forward cuda'
times[title] = tm4
model:cuda()
model:zeroStatistics()
a:reset()
local resdpCuda
for i=1,nloop,512 do
batch = train:sub(batch, i, i+511)
local carry = batch:carry()
carry:putObj('nSample', 512)
resdpCuda = model:forward(batch:inputs(), carry)
end
tm4.dp = a:time().real
tm4.nn = tm.dp
print("dp cuda Time ".. a:time().real)
local trunk = nn.Sequential()
trunk:add(nn.LookupTable(ds:vocabularySize(),50))
trunk:add(nn.Reshape(50*5))
trunk:add(nn.Linear(50*5,50))
trunk:add(nn.Tanh())
local para = nn.ParallelTable()
para:add(trunk)
para:add(nn.Identity())
local mlp = nn.Sequential()
mlp:add(para)
mlp:add(nn.SoftMaxTree(50,hierarchy,880542))
local groundtruth = mlp:forward(nn_inputs[1])
a:reset()
for i = 1,#nn_inputs do
groundtruth = mlp:forward(nn_inputs[i])
end
tm.nn = a:time().real
print("nn Time ".. a:time().real)
local tm2 = {}
local title = 'language model softmax forward'
times[title] = tm2
mlp = nn.Sequential()
mlp:add(trunk)
mlp:add(nn.Linear(50,800000))
mlp:add(nn.LogSoftMax())
tm2.dp = tm.nn
local groundtruth = mlp:forward(nn_inputs[1][1])
a:reset()
for i = 1,#nn_inputs do
groundtruth = mlp:forward(nn_inputs[i][1])
end
tm2.nn = a:time().real
print("softmax Time ".. a:time().real)
local tm3 = {}
local title = 'language model softmax focused forward'
times[title] = tm3
mlp = nn.Sequential()
mlp:add(trunk)
mlp:add(nn.Linear(50,100))
mlp:add(nn.LogSoftMax())
tm3.dp = tm.nn
local groundtruth = mlp:forward(nn_inputs[1][1])
a:reset()
for i = 1,#nn_inputs do
groundtruth = mlp:forward(nn_inputs[i][1])
end
tm3.nn = a:time().real
print("softmax focused Time ".. a:time().real)
end
function nn.testBenchmark(tests)
math.randomseed(os.time())
jac = nn.Jacobian
mytester = torch.Tester()
mytester:add(dptest)
mytester:run(tests)
print ''
for module,tm in pairs(times) do
print(module .. ': \t average speedup is ' .. (tm.nn / (tm.dp or 1e6)))
end
end
nn.testBenchmark()
|
io.stdout:setvbuf("no") --For console output to work
function love.conf(t)
t.identity = ".lovediscord" -- The name of the save directory (string)
t.version = "11.2" -- The LÖVE version this game was made for (string)
t.console = false -- Attach a console (boolean, Windows only)
t.accelerometerjoystick = false -- Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
t.externalstorage = true -- True to save files (and read from the save directory) in external storage on Android (boolean)
t.gammacorrect = false -- Enable gamma-correct rendering, when supported by the system (boolean)
t.window = nil --Disable love.window, no graphics needed for a discord bot.
t.modules.audio = false -- Disable the audio module (boolean)
t.modules.data = true -- Enable the data module (boolean)
t.modules.event = true -- Enable the event module (boolean)
t.modules.graphics = false -- Disable the graphics module (boolean)
t.modules.image = true -- Enable the image module (boolean)
t.modules.joystick = false -- Disable the joystick module (boolean)
t.modules.keyboard = false -- Disable the keyboard module (boolean)
t.modules.math = true -- Enable the math module (boolean)
t.modules.mouse = false -- Disable the mouse module (boolean)
t.modules.physics = false -- Disable the physics module (boolean)
t.modules.sound = false -- Disable the sound module (boolean)
t.modules.system = true -- Enable the system module (boolean)
t.modules.timer = true -- Enable the timer module (boolean), Disabling it will result 0 delta time in love.update
t.modules.touch = false -- Disable the touch module (boolean)
t.modules.video = false -- Disable the video module (boolean)
t.modules.window = false -- Disable the window module (boolean)
t.modules.thread = true -- Enable the thread module (boolean)
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.