content stringlengths 5 1.05M |
|---|
--- This module provides some utilities to wipe arrays.
--
-- 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.
--
-- [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
--
-- Standard library imports --
local unpack = unpack
-- Cached module references --
local _WipeRange_
-- Exports --
local M = {}
-- Helper for nil array argument --
local Empty = {}
-- count: Value count
-- ...: Array values
local function AuxUnpackAndWipeRange (array, first, last, wipe, ...)
_WipeRange_(array, first, last, wipe)
return ...
end
--- Wipes an array, returning the overwritten values.
-- @param array Array to wipe. May be **nil**, though _count_ must then be 0.
-- @uint[opt=#array] count Size of array.
-- @param wipe Value used to wipe over entries.
-- @return Array values (number of return values = _count_).
function M.UnpackAndWipe (array, count, wipe)
return AuxUnpackAndWipeRange(array, 1, count, wipe, unpack(array or Empty, 1, count))
end
--- Wipes a range in an array, returning the overwritten values.
-- @param array Array to wipe. May be **nil**, though _last_ must resolve to 0.
-- @uint[opt=1] first Index of first entry.
-- @uint[opt=#array] last Index of last entry.
-- @param wipe Value used to wipe over entries.
-- @return Array values (number of return values = _last_ - _first_ + 1).
function M.UnpackAndWipeRange (array, first, last, wipe)
return AuxUnpackAndWipeRange(array, first, last, wipe, unpack(array or Empty, first, last))
end
--- Wipes a range in an array.
-- @param array Array to wipe. May be **nil**, though _last_ must resolve to 0.
-- @uint[opt=1] first Index of first entry.
-- @uint[opt=#array] last Index of last entry.
-- @param wipe Value used to wipe over entries.
-- @return _array_.
function M.WipeRange (array, first, last, wipe)
for i = first or 1, last or #(array or Empty) do
array[i] = wipe
end
return array
end
-- Cache module members.
_WipeRange_ = M.WipeRange
-- Export the module.
return M |
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"
command.add(nil, {
["save-all-unsaved-changes"] = function()
core.log("Saving all unsaved changes...")
for _, doc in ipairs(core.docs) do
if doc:is_dirty() then
if doc.filename then
doc:save()
else
command.perform("doc:save-as")
end
end
end
end,
})
keymap.add { ["alt+s"] = "save-all-unsaved-changes" } |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BitBuffer = require(ReplicatedStorage.BitBuffer)
local CommonSpec = ReplicatedStorage.BitBuffer.CommonSpec
local RobloxSpec = ReplicatedStorage.BitBuffer.RobloxSpec
local commonSpecModuleNames = require(CommonSpec)
local robloxSpecModuleNames = require(RobloxSpec)
local try = require(ReplicatedStorage.try)
local function runTestModule(name, parent)
local testModule = parent:FindFirstChild(name)
assert(testModule, "unable to find spec file: " .. name)
local test = require(testModule)
test(try.new, BitBuffer)
end
for _, name in ipairs(commonSpecModuleNames) do
runTestModule(name, CommonSpec)
end
for _, name in ipairs(robloxSpecModuleNames) do
runTestModule(name, RobloxSpec)
end
local finalPass, finalFail, finalDisabled = try.reportFinal()
print(string.format("FINAL COUNT: %i PASSED, %s FAILED, %s DISABLED", finalPass, finalFail, finalDisabled))
|
data:extend(
{
{
type = "technology",
name = "gem-processing",
icon = "__Engineersvsenvironmentalist__/graphics/icons/ore/gem-ore.png",
prerequisites = {"steel-processing","silicon-processing"},
effects =
{
{
type = "unlock-recipe",
recipe = "sort-gem-ore"
},
{
type = "unlock-recipe",
recipe = "grinding-wheel"
},
{
type = "unlock-recipe",
recipe = "polishing-wheel"
},
{
type = "unlock-recipe",
recipe = "polishing-wheel-synthetic"
},
},
unit =
{
count = 10,
ingredients =
{
{"science-pack-1", 1},
{"science-pack-2", 1},
},
time = 15
},
order = "a-d-b",
},
}
) |
-- Standard awesome library
require("awful")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
-- The default is a dark theme
theme_path = "/home/zhou/.config/awesome/themes/default/theme.lua"
-- Uncommment this for a lighter theme
-- theme_path = "/usr/share/awesome/themes/sky/theme.lua"
-- Actually load theme
beautiful.init(theme_path)
-- This is used later as the default terminal and editor to run.
terminal = "lxterminal"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier,
awful.layout.suit.floating
}
-- Table of clients that should be set floating. The index may be either
-- the application class or instance. The instance is useful when running
-- a console app in a terminal like (Music on Console)
-- xterm -name mocp -e mocp
floatapps =
{
-- by class
["MPlayer"] = true,
["pinentry"] = true,
["gimp"] = true,
["smplayer"] = true,
["vlc"] = true,
["emesene"] = true,
["linux-fetion"] = true,
["qq"] = true,
["stardict"] = true,
-- by instance
["mocp"] = true
}
-- Applications to be moved to a pre-defined tag by class or instance.
-- Use the screen and tags indices.
apptags =
{
-- ["Firefox"] = { screen = 1, tag = 2 },
-- ["mocp"] = { screen = 2, tag = 4 },
}
-- Define if we want to use titlebar on all applications.
use_titlebar = false
-- }}}
-- {{{ Tags
-- Define tags table.
tags = {}
for s = 1, screen.count() do
-- Each screen has its own tag table.
tags[s] = {}
-- Create 9 tags per screen.
for tagnumber = 1, 5 do
tags[s][tagnumber] = tag(tagnumber)
-- Add tags to screen one by one
tags[s][tagnumber].screen = s
awful.layout.set(layouts[1], tags[s][tagnumber])
end
-- I'm sure you want to see at least one tag.
tags[s][1].selected = true
end
tags[1][1].name = "冲浪"
--tags[1][1].layout = awful.layout.suit.magnifier
tags[1][2].name = "文档"
tags[1][3].name = "虚拟"
--tags[1][2].layout = awful.layout.suit.floating
tags[1][4].name = "影音"
tags[1][5].name = "学习"
tags[1][6].name = "游戏"
-- }}}
-- {{{ Wibox
-- Create a textbox widget
mytextbox = widget({ type = "textbox", align = "right" })
-- Set the default text in textbox
mytextbox.text = "<b><small> " .. awesome.release .. " </small></b>"
-- Create a laucher widget and a main menu
myawesomemenu = {
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
{ "restart", awesome.restart },
{ "quit", awesome.quit }
}
mymainmenu = awful.menu.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal }
}
})
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu = mymainmenu })
-- Create a systray
mysystray = widget({ type = "systray", align = "right" })
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, function (tag) tag.selected = not tag.selected end),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
client.focus = c
c:raise()
end),
awful.button({ }, 3, function ()
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ width=250 })
end
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end))
for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt({ align = "left" })
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox[s] = widget({ type = "imagebox", align = "right" })
mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(function(c)
return awful.widget.tasklist.label.currenttags(c, s)
end, mytasklist.buttons)
-- Create the wibox
mywibox[s] = wibox({ position = "top", fg = beautiful.fg_normal, bg = beautiful.bg_normal })
-- Add widgets to the wibox - order matters
mywibox[s].widgets = { --mylauncher,
mytaglist[s],
mytasklist[s],
mypromptbox[s],
mytextbox,
s == 1 and mysystray or nil,
mylayoutbox[s] }
mywibox[s].screen = s
end
-- }}}
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
awful.key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "k",
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "w", function () mymainmenu:show(true) end),
-- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus( 1) end),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
-- Standard program
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit),
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
-- Prompt
awful.key({ modkey }, "F1", function () mypromptbox[mouse.screen]:run() end),
-- 自定义设置
awful.key({ modkey }, "r", function () awful.util.spawn("dmenu_run") end),
awful.key({ modkey }, "p", function () awful.util.spawn("dmenu_path | dmenu -b") end),
awful.key({ modkey }, "e", function () awful.util.spawn("emacsclient -c") end),
-- 音量调节
--awful.key({ }, "#121", function () awful.util.spawn("mute") end),
awful.key({ }, "#122", function () awful.util.spawn("amixer -q sset PCM 2dB-") end),
awful.key({ }, "#123", function () awful.util.spawn("amixer -q sset PCM 2dB+") end),
-- 待机与休眠
awful.key({ }, "#150", function () awful.util.spawn("gksudo pm-suspend") end),
awful.key({ }, "#244", function () awful.util.spawn("gksudo pm-hibernate") end),
-- 锁屏
awful.key({ modkey }, "s", function () awful.util.spawn("xlock") end),
awful.key({ modkey }, "x",
function ()
awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen].widget,
awful.util.eval, nil,
awful.util.getdir("cache") .. "/history_eval")
end)
)
-- Client awful tagging: this is useful to tag some clients and then do stuff like move to tag on them
clientkeys = awful.util.table.join(
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
awful.key({ modkey }, "t", awful.client.togglemarked),
awful.key({ modkey,}, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical
end)
)
-- Compute the maximum number of digit we need, limited to 9
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber));
end
for i = 1, keynumber do
globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, i,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewonly(tags[screen][i])
end
end),
awful.key({ modkey, "Control" }, i,
function ()
local screen = mouse.screen
if tags[screen][i] then
tags[screen][i].selected = not tags[screen][i].selected
end
end),
awful.key({ modkey, "Shift" }, i,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i])
end
end),
awful.key({ modkey, "Control", "Shift" }, i,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i])
end
end),
awful.key({ modkey, "Shift" }, "F" .. i,
function ()
local screen = mouse.screen
if tags[screen][i] then
for k, c in pairs(awful.client.getmarked()) do
awful.client.movetotag(tags[screen][i], c)
end
end
end))
end
-- Set keys
root.keys(globalkeys)
-- }}}
-- {{{ Hooks
-- Hook function to execute when focusing a client.
awful.hooks.focus.register(function (c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_focus
end
end)
-- Hook function to execute when unfocusing a client.
awful.hooks.unfocus.register(function (c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_normal
end
end)
-- Hook function to execute when marking a client
awful.hooks.marked.register(function (c)
c.border_color = beautiful.border_marked
end)
-- Hook function to execute when unmarking a client.
awful.hooks.unmarked.register(function (c)
c.border_color = beautiful.border_focus
end)
-- Hook function to execute when the mouse enters a client.
awful.hooks.mouse_enter.register(function (c)
-- Sloppy focus, but disabled for magnifier layout
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end
end)
-- Hook function to execute when a new client appears.
awful.hooks.manage.register(function (c, startup)
-- If we are not managing this application at startup,
-- move it to the screen where the mouse is.
-- We only do it for filtered windows (i.e. no dock, etc).
if not startup and awful.client.focus.filter(c) then
c.screen = mouse.screen
end
if use_titlebar then
-- Add a titlebar
awful.titlebar.add(c, { modkey = modkey })
end
-- Add mouse bindings
c:buttons(awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize)
))
-- New client may not receive focus
-- if they're not focusable, so set border anyway.
c.border_width = beautiful.border_width
c.border_color = beautiful.border_normal
-- Check if the application should be floating.
local cls = c.class
local inst = c.instance
if floatapps[cls] ~= nil then
awful.client.floating.set(c, floatapps[cls])
elseif floatapps[inst] ~= nil then
awful.client.floating.set(c, floatapps[inst])
end
-- Check application->screen/tag mappings.
local target
if apptags[cls] then
target = apptags[cls]
elseif apptags[inst] then
target = apptags[inst]
end
if target then
c.screen = target.screen
awful.client.movetotag(tags[target.screen][target.tag], c)
end
-- Do this after tag mapping, so you don't see it on the wrong tag for a split second.
client.focus = c
-- Set key bindings
c:keys(clientkeys)
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c)
-- Honor size hints: if you want to drop the gaps between windows, set this to false.
-- c.size_hints_honor = false
end)
-- Hook function to execute when arranging the screen.
-- (tag switch, new client, etc)
awful.hooks.arrange.register(function (screen)
local layout = awful.layout.getname(awful.layout.get(screen))
if layout and beautiful["layout_" ..layout] then
mylayoutbox[screen].image = image(beautiful["layout_" .. layout])
else
mylayoutbox[screen].image = nil
end
-- Give focus to the latest client in history if no window has focus
-- or if the current window is a desktop or a dock one.
if not client.focus then
local c = awful.client.focus.history.get(screen, 0)
if c then client.focus = c end
end
end)
-- Hook called every minute
awful.hooks.timer.register(60, function ()
-- mytextbox.text = os.date(" %a %b %d, %H:%M ")
mytextbox.text = os.date(" %Y年%m月%d日%a %H:%M ")
end)
-- Autorun programs
autorun = "true"
autorunApps =
{
"xsetroot -cursor_name left_ptr",
-- "emacs",
-- "xscreensaver",
-- "ibus",
-- "fcitx",
-- "parcellite",
-- "wicd-client"
}
if autorun then
for app = 1, #autorunApps do
awful.util.spawn(autorunApps[app])
end
end
-- }}}
|
local class = require 'class'
local Timer = class 'Timer'
function Timer:initialize(duration, func)
-- Overall timer duration
self.duration = duration
-- elapsed time
self.currentTicker = 0
-- is timer active? Can be paused/resumed
self.active= false
-- On finish function (optional)
self.onFinish = func or false
-- Has the timer ended already
self.done = true
end
function Timer:start()
assert(self.done)
self.active = true
self.done = false
end
function Timer:update(dt)
if not self.active then return end
self.currentTicker = self.currentTicker + dt*1000
if self.currentTicker >= self.duration then
self.active = false
self.done = true
if self.onFinish then
self.onFinish()
end
end
end
function Timer:pause()
assert(not self.done)
self.active = false
end
function Timer:resume()
assert(not self.done)
self.active = true
end
return Timer |
AI = baseCharacter:new()
function AI:load()
baseCharacter:load({
scale = 0.035 * utils.vh, -- 0.25
xCenter = love.graphics.getWidth() / 2,
yCenter = love.graphics.getHeight() / 2,
})
self.ySpeed = 7 * utils.vh
self.timer = 0
self.rotation = 0
end
function AI:update(dt)
dt = math.min(dt, 0.5)
self.timer = self.timer + dt
self:animate(dt)
self:animateWings()
if self.timer >= 0.5 then
self.ySpeed = self.ySpeed * -1
self.timer = 0
end
end
function AI:draw()
self:drawPlayerModel()
end
function AI:animateWings()
if not self.wings.isAnimating then
self.wings.isAnimating = true
Timer.after(0.1, function()
self.wings.back.rotation = math.pi / 6
self.wings.front.rotation = math.pi / 6
Timer.after(0.1, function()
self.wings.back.rotation = 0
self.wings.front.rotation = 0
Timer.after(0.1, function()
self.wings.back.rotation = -math.pi / 6
self.wings.front.rotation = -math.pi / 6
Timer.after(0.1, function()
self.wings.back.rotation = 0
self.wings.front.rotation = 0
self.wings.isAnimating = false
end)
end)
end)
end)
end
end
function AI:animate(dt)
self.y = self.y + self.ySpeed * dt
end |
function onMailReceive(cid, target, item, openBox)
if(openBox) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "New mail has arrived.")
end
return true
end
|
local argparse = require "3rdparty.argparse.argparse"
return argparse |
local CCBLoader = {}
local function fillCallbacks(proxy, owner, names, nodes, events)
if not owner then return end
--Callbacks
for i = 1, #names do
local callbackName = names[i]
local callbackNode = tolua.cast(nodes[i],"cc.Node")
proxy:setCallback(callbackNode, function(sender, event)
if owner and owner[callbackName] and "function" == type(owner[callbackName]) then
owner[callbackName](owner, sender, event)
else
print("Warning: Cannot find lua function:" .. ":" .. callbackName .. " for selector")
end
end, events[i])
end
end
local function fillMembers(owner, names, nodes)
if not owner then return end
--Variables
for i = 1, #names do
local outletName = names[i]
local outletNode = tolua.cast(nodes[i],"cc.Node")
owner[outletName] = outletNode
-- print("fillMembers:", outletName, outletNode)
end
end
local function extend(node, name)
local codePath = (CCBLoader.codeRootPath and CCBLoader.codeRootPath ~= "") and CCBLoader.codeRootPath .. "." .. name or name
local luaObj = require(codePath)
for k,v in pairs(luaObj) do
node[k] = v
end
end
local function fillNode(proxy, ccbReader, owner, isRoot)
local rootName = ccbReader:getDocumentControllerName()
local animationManager = ccbReader:getActionManager()
local node = animationManager:getRootNode()
-- print("fillNode:", rootName, node)
--owner set in readCCBFromFile is proxy
if nil ~= owner then
--Callbacks
local ownerCallbackNames = ccbReader:getOwnerCallbackNames()
local ownerCallbackNodes = ccbReader:getOwnerCallbackNodes()
local ownerCallbackControlEvents = ccbReader:getOwnerCallbackControlEvents()
fillCallbacks(proxy, owner, ownerCallbackNames, ownerCallbackNodes, ownerCallbackControlEvents)
--Variables
local ownerOutletNames = ccbReader:getOwnerOutletNames()
local ownerOutletNodes = ccbReader:getOwnerOutletNodes()
fillMembers(owner, ownerOutletNames, ownerOutletNodes)
end
--document root
if "" ~= rootName then
extend(node, rootName)
node.animationManager = animationManager
--Callbacks
local documentCallbackNames = animationManager:getDocumentCallbackNames()
local documentCallbackNodes = animationManager:getDocumentCallbackNodes()
local documentCallbackControlEvents = animationManager:getDocumentCallbackControlEvents()
fillCallbacks(proxy, node, documentCallbackNames, documentCallbackNodes, documentCallbackControlEvents)
--Variables
local documentOutletNames = animationManager:getDocumentOutletNames()
local documentOutletNodes = animationManager:getDocumentOutletNodes()
fillMembers(node, documentOutletNames, documentOutletNodes)
--[[
if (typeof(controller.onDidLoadFromCCB) == "function")
controller.onDidLoadFromCCB();
]]--
--Setup timeline callbacks
local keyframeCallbacks = animationManager:getKeyframeCallbacks()
for i = 1 , #keyframeCallbacks do
local callbackCombine = keyframeCallbacks[i]
local beignIndex,endIndex = string.find(callbackCombine,":")
local callbackType = tonumber(string.sub(callbackCombine,1,beignIndex - 1))
local callbackName = string.sub(callbackCombine,endIndex + 1, -1)
--Document callback
if 1 == callbackType then
local callfunc = cc.CallFunc:create(function(sender, event)
if node and node[callbackName] and type(node[callbackName]) == "function" then
node[callbackName](node, sender, event)
else
print("Warning: Cannot find lua function:" .. callbackName .. " for animation selector")
end
end)
animationManager:setCallFuncForLuaCallbackNamed(callfunc, callbackCombine);
elseif 2 == callbackType and nil ~= owner then --Owner callback
local callfunc = cc.CallFunc:create(owner[callbackName])--need check
animationManager:setCallFuncForLuaCallbackNamed(callfunc, callbackCombine)
end
end
--start animation
local autoPlaySeqId = animationManager:getAutoPlaySequenceId()
if -1 ~= autoPlaySeqId then
animationManager:runAnimationsForSequenceIdTweenDuration(autoPlaySeqId, 0)
end
end
--subReaders
local subReaders = ccbReader:getSubReaders()
-- print("subReaders:", subReaders and #subReaders or 0, subReaders)
-- table.dump(subReaders)
if subReaders then
for i=1, #subReaders do
local reader = subReaders[i]
fillNode(proxy, reader, owner, false)
end
end
if not isRoot and node and type(node.ctor) == "function" then
node:ctor()
end
end
local function doLoad(fileName, proxy, owner)
if nil == proxy then
return nil
end
local strFilePath = (CCBLoader.ccbiRootPath and CCBLoader.ccbiRootPath ~= "") and CCBLoader.ccbiRootPath .. fileName or fileName
local ccbReader = proxy:createCCBReader()
local node = ccbReader:load(strFilePath)
fillNode(proxy, ccbReader, owner, true)
return node
end
------------------------------------------------------------
function CCBLoader:setRootPath(codeRoot, ccbiRoot)
if ccbiRoot and string.sub(ccbiRoot, -1) ~= "/" then
ccbiRoot = ccbiRoot .. "/"
end
self.codeRootPath = codeRoot or self.codeRootPath
self.ccbiRootPath = ccbiRoot or self.ccbiRootPath
end
function CCBLoader:load(fileName, owner)
local proxy = cc.CCBProxy:create()
return doLoad(fileName, proxy, owner)
end
return CCBLoader |
freeze = {
cast = function(player, target)
local duration = 60000
local magicCost = 800
local damage = 112
if (not player:canCast(1, 1, 0)) then
return
end
if (player.magic < magicCost) then
player:sendMinitext("Your will is too weak.")
return
end
if (target.blType == BL_PC and not player:canPK(target)) or target.blType == BL_NPC then
player:sendMinitext("You cannot attack that target.")
return
end
player:sendAction(6, 20)
player.magic = player.magic - magicCost
player:sendStatus()
player:playSound(1)
player:sendMinitext("You cast Freeze.")
player:sendMinitext("Calling Freeze.")
target:sendAnimation(52)
target.attacker = player.ID
target:removeHealthExtend(damage, 1, 1, 1, 1, 0)
end
}
|
local util = {}
-- font handling
local fonts = {}
function util.getFont(size)
assert(type(size) == "number")
fonts[size] = fonts[size] or love.graphics.newFont("resources/AlegreyaSans-Regular.ttf", size)
return fonts[size]
end
function util.radToDeg(rad)
return rad * (180 / math.pi)
end
function util.degToRad(deg)
return deg * (math.pi / 180)
end
function util.list(iterable)
local r = {}
for v in iterable do
r[#r+1] = v
end
return r
end
function util.keys(table)
local keys = {}
for k, _ in pairs(table) do
keys[#keys+1] = k
end
return keys
end
function util.clamp(value, min, max)
return math.max(min, math.min(max, value))
end
function util.remap(value, minValue, maxValue, minReturn, maxReturn)
return minReturn + (maxReturn - minReturn) * ((value - minValue) / (maxValue - minValue))
end
function util.count(table)
local c = 0
for _ in pairs(table) do c = c + 1 end
return c
end
function util.copy(orig)
local copy = {}
if getmetatable(orig) then
setmetatable(copy, getmetatable(orig))
end
for k, v in pairs(orig) do
if type(v) == "table" then
v = util.copy(v)
end
copy[k] = v
end
return copy
end
function util.indexOf(ys, x)
for i, y in ipairs(ys) do
if x == y then
return i
end
end
end
function util.find(t, cb)
for i, v in ipairs(t) do
if cb(v, i) then
return v
end
end
end
function util.matchall(s, pattern)
local parts = {}
for match in s:gmatch(pattern) do
table.insert(parts, match)
end
return parts
end
function util.round(n)
return math.floor(n + 0.5)
end
function util.formatFloat(v, nminor)
nminor = nminor or 0
s = tostring(util.round(v * 10^nminor) / 10^nminor)
local split = util.list(s:gmatch('([^\\.]+)'))
s = split[1]
if nminor > 0 then
s = s .. '.' .. (split[2] or 0)
end
return s
end
function util.shortestRotation(a1, a2)
local angle = a2 - a1
if angle > math.pi then
angle = angle - 2 * math.pi
elseif angle < -math.pi then
angle = angle + 2 * math.pi
end
return angle
end
function util.last(t)
return t[#t]
end
function util.swapwrap(t, i, j)
i = ((i - 1 + #t) % #t) + 1
j = ((j - 1 + #t) % #t) + 1
t[i], t[j] = t[j], t[i]
end
function util.extend(table, ...)
for _, other in ipairs({...}) do
for k, v in pairs(other) do
table[k] = v
end
end
return table
end
local function pprint(obj, indent, prefix)
if type(obj) == "table" then
io.write(string.format("%s%stable=%s, size=%s, metatable=%s\n",
indent, prefix, obj, util.count(obj), getmetatable(obj)))
for k, v in pairs(obj) do
pprint(k, ' ' .. indent, "key: ")
pprint(v, ' ' .. indent, "value: ")
end
else
io.write(string.format("%s%s%s (%s)\n", indent, prefix, obj, type(obj)))
end
end
function util.pprint(...)
for _, obj in ipairs({...}) do
pprint(obj, "", "")
end
end
local solidColor = love.graphics.newShader [[
extern float r, g, b, a, threshold;
vec4 effect(vec4 col, Image tex, vec2 texcoord, vec2 screencoord) {
vec4 c = Texel(tex, texcoord.xy);
if (c.r + c.g + c.b > threshold && c.a > threshold) {
return vec4(r, g, b, a);
}
return vec4(0.0);
}
]]
solidColor:send('threshold', 0.1)
function util.solidColorShader(r, g, b, a)
solidColor:send('r', r)
solidColor:send('g', g)
solidColor:send('b', b)
solidColor:send('a', a or 1)
return solidColor
end
return util
|
--------------
-- Includes --
--------------
#include 'include/internal_events.lua'
---------------
-- Variables --
---------------
local g_Effects = {}
local g_Enabled = {}
local g_LowFpsSeconds = 0
-------------------
-- Custom events --
-------------------
addEvent('onRafalhAddEffect')
addEvent('onRafalhGetEffects')
addEvent('toxic.onEffectInfo')
addEvent('toxic.onEffectInfoReq')
--------------------------------
-- Local function definitions --
--------------------------------
local function checkFps()
-- Note: it needs scorefps resource
local fps = tonumber(getElementData(g_Me, 'fps'))
if(not fps) then return end
-- If FPS < 25 disable effects
if(fps >= 25) then
g_LowFpsSeconds = 0
return
end
-- LOW FPS
g_LowFpsSeconds = g_LowFpsSeconds + 1
-- Allow low FPS for 20 seconds
if(g_LowFpsSeconds < 20) then return end
for res, info in pairs(g_Effects) do
local enabled = call(res, 'isEffectEnabled')
if(enabled) then
-- disable first enabled effect
call(res, 'setEffectEnabled', false)
-- count from 0
g_LowFpsSeconds = 0
-- display message for user
local name = info.name
if(type(name) == 'table') then
name = name[Settings.locale] or name[1]
end
if(name) then
outputMsg(Styles.red, "%s has been disabled to improve your FPS!", name)
end
break
end
end
end
local function onResStop(res)
if(not g_Effects[res]) then return end
-- Effect has been stoped
g_Effects[res] = nil
-- Effects list has changed
invalidateSettingsGui()
end
local function onEffectInfo(info)
-- Check parameters
assert(info and info.name and info.res)
-- Register effect resource
g_Effects[info.res] = info
-- Apply effect settings
local resName = getResourceName(info.res)
local enabled = g_Enabled[resName]
if(enabled ~= nil) then
call(info.res, 'setEffectEnabled', enabled)
end
-- Effects list has changed
invalidateSettingsGui()
end
local function onAddEffect(res, name)
-- Old API
local info = {name = name, res = res}
onEffectInfo(info)
end
local function init()
addEventHandler('onClientResourceStop', g_Root, onResStop)
addEventHandler('onRafalhAddEffect', g_Root, onAddEffect)
addEventHandler('toxic.onEffectInfo', g_Root, onEffectInfo)
-- Get all effects on startup
triggerEvent('onRafalhGetEffects', g_Root)
triggerEvent('toxic.onEffectInfoReq', g_Root)
-- Check if FPS is not too low
setTimer(checkFps, 1000, 0)
end
local EffectSettings =
{
name = 'effects',
default = '',
priority = 1000,
cast = tostring,
onChange = function(oldVal, newVal)
g_Enabled = fromJSON(newVal)
for res, enabled in pairs(g_Enabled) do
local res = getResourceFromName(res)
if(res and g_Effects[res]) then
call(res, 'setEffectEnabled', tobool(enabled))
end
end
end,
createGui = function(wnd, x, y, w, onChange)
guiCreateLabel(x, y + 5, w, 20, "Effects:", false, wnd)
local h, gui = 25, {}
local function onBtnToggle()
onChange('effects')
end
for res, info in pairs(g_Effects) do
local enabled = call(res, 'isEffectEnabled')
local name = info.name
if(type(name) == 'table') then
name = name[Settings.locale] or name[1]
end
if(name) then
guiCreateLabel(x, y + h, 200, 20, name, false, wnd)
gui[res] = OnOffBtn.create(x + 200, y + h, wnd, enabled)
gui[res].onChange = onBtnToggle
if(info.hasOptions) then
local optsBtn = guiCreateButton(x + 200 + OnOffBtn.w + 5, y + h, 60, OnOffBtn.h, "Options", false, wnd)
addEventHandler('onClientGUIClick', optsBtn, function()
call(res, 'openEffectOptions')
end, false)
end
h = h + 25
end
end
return h, gui
end,
acceptGui = function(gui)
for res, btn in pairs(gui) do
if(g_Effects[res]) then
local resName = getResourceName(res)
g_Enabled[resName] = btn:isEnabled()
end
end
Settings.effects = toJSON(g_Enabled)
end,
}
addInitFunc(init)
addInitFunc(function()
Settings.register(EffectSettings, -2000)
end, -2000)
|
local command = {}
command.name = "command"
command.commands = {}
command.prefix = "+"
_G.PREFIX = command.prefix
function command.SetPrefix(cmd)
command.prefix = cmd or "+"
end
function command.GetPrefix()
return command.prefix
end
function command.Register(label, desc, category, func)
if not label then
print("[command]", "[Error]", "Invalid command name given")
return
end
if not func then
print("[command]", "[Error]", "Invalid function given")
return
end
label = string.lower(label)
command.commands[label] = {
command = label,
desc = desc or "n/a",
category = category or "n/a",
func = func
}
print("[command]", "The command", label, "has now been registered")
end
function command.Reload(cmd)
package.loaded[cmd] = nil
end
function command.Getcommand(cmd)
return command.commands[cmd] or false
end
function command.FormatArguments(args)
local Start, End = nil, nil
for k, v in pairs(args) do
if (string.sub(v, 1, 1) == "\"") then
Start = k
elseif Start and (string.sub(v, string.len(v), string.len(v)) == "\"") then
End = k
break
end
end
if Start and End then
args[Start] = string.Trim(table.concat(args, " ", Start, End), "\"")
for i = 1, (End - Start) do
table.remove(args, Start + 1)
end
args = command.FormatArguments(args)
end
return args
end
CLIENT:on("messageCreate", function(msg)
local author = msg.author
local content = msg.content
if author == CLIENT.user then return end
if author.bot then return end
local prefix = command.GetPrefix()
if not (string.sub(content, 1, string.len(prefix)) == prefix) then
return
end
local args = command.FormatArguments(string.Explode(" ", content))
args[1] = string.sub(args[1], string.len(prefix) + 1)
local command = command.Getcommand(string.lower(args[1]))
if not command then print("Invalid command", "'"..args[1].."'") return end
table.remove(args, 1)
command.func(msg, args)
end)
command.cooling = {}
-- Boolean; Returns true if the command is on cooldown for the message sender, false if they arent
function command.Cooldown(message, cid, time, response)
local id = tostring(message.author.id)
if command.cooling[id] == nil then command.cooling[id] = {} end
local cmds = command.cooling[id]
local cooldown = false;
local now = os.time() + (os.clock() / 10)
if cmds[cid] ~= nil then
local expires = cmds[cid]
if expires < now then
cmds[cid] = nil
else
cooldown = expires - now
end
else
cmds[cid] = now + time
end
if cooldown == false then return false end
if response == nil then response = "You need to wait %s seconds to run this command again." end
message:reply(response:gsub('%%s', math.round(cooldown)))
return true
end
-- Guild Member; Returns the first mention, first ID, or author of the message specified
function command.FirstMention(message)
local args = string.Explode(" ", message.content)
local mention = message.mentionedUsers.first;
if mention ~= nil then mention = message.guild:getMember(mention) end
if mention == nil and #args > 1 then mention = message.guild:getMember(args[2]) end
if mention == nil then mention = message.guild:getMember(message.author) end
return mention
end
return command |
require "catui"
local love = love
local redis = require 'redis'
local settings = require 'settings'
local redisConfig = settings.redisConfig
local redisClient
local function connectRedis()
redisClient = redis.connect(redisConfig)
redisClient:select(redisConfig.db)
end
-- REDIS KEY类型
local REDIS_KEY_TYPE = {
[1] = 'string',
[2] = 'hash',
}
-- unicode_to_utf8
local function unicode_to_utf8(convertStr)
if type(convertStr) ~= "string" then
return convertStr
end
local bit = require("bit")
local resultStr = ""
local i = 1
while true do
local num1 = string.byte(convertStr, i)
local unicode
if num1 ~= nil and string.sub(convertStr, i, i + 1) == "\\u" then
unicode = tonumber("0x" .. string.sub(convertStr, i + 2, i + 5))
i = i + 6
elseif num1 ~= nil then
unicode = num1
i = i + 1
else
break
end
if unicode <= 0x007f then
resultStr = resultStr .. string.char(bit.band(unicode, 0x7f))
elseif unicode >= 0x0080 and unicode <= 0x07ff then
resultStr = resultStr .. string.char(bit.bor(0xc0, bit.band(bit.rshift(unicode, 6), 0x1f)))
resultStr = resultStr .. string.char(bit.bor(0x80, bit.band(unicode, 0x3f)))
elseif unicode >= 0x0800 and unicode <= 0xffff then
resultStr = resultStr .. string.char(bit.bor(0xe0, bit.band(bit.rshift(unicode, 12), 0x0f)))
resultStr = resultStr .. string.char(bit.bor(0x80, bit.band(bit.rshift(unicode, 6), 0x3f)))
resultStr = resultStr .. string.char(bit.bor(0x80, bit.band(unicode, 0x3f)))
end
end
resultStr = resultStr .. '\0'
return resultStr
end
function love.load(arg)
connectRedis()
love.graphics.setBackgroundColor(35, 42, 50, 255)
mgr = UIManager:getInstance()
local keys = redisClient:keys('*')
table.sort(keys, function(a, b) return a < b end) -- key排序
local len = #keys
local keyHight = 20
local keyWidth = 200
local contentKey = UIContent:new()
contentKey:setPos(0, 0)
contentKey:setSize(keyWidth, 600)
contentKey:setContentSize(keyWidth, keyHight * len)
mgr.rootCtrl.coreContainer:addChild(contentKey)
local contentValue = UIContent:new()
contentValue:setPos(200, 0)
contentValue:setSize(600, 600)
contentValue:setContentSize(600, 600)
mgr.rootCtrl.coreContainer:addChild(contentValue)
local keyTypeEdit = UIEditText:new()
keyTypeEdit:setPos(0, 0)
keyTypeEdit:setSize(600, 20)
contentValue:addChild(keyTypeEdit)
for i = 1, len do
local keyEditText = UIEditText:new()
keyEditText:setPos(0, (i - 1) * keyHight)
keyEditText:setSize(keyWidth, keyHight)
keyEditText:setText("\t" .. keys[i])
contentKey:addChild(keyEditText)
local hashContent
keyEditText.events:on(UI_CLICK, function()
if hashContent then
contentValue:removeChild(hashContent)
end
local keyType = redisClient:type(keys[i])
keyTypeEdit:setText(keyType .. "\t : \t" .. keys[i])
if keyType == REDIS_KEY_TYPE[1] then
local value = redisClient:get(keys[i])
hashContent = UIEditText:new()
hashContent:setPos(0, 20)
hashContent:setSize(600, 580)
hashContent:setText(value)
contentValue:addChild(hashContent)
elseif keyType == REDIS_KEY_TYPE[2] then
local hkeys = redisClient:hkeys(keys[i])
table.sort(hkeys, function(a, b) return a < b end)
local hashLen = #hkeys
hashContent = UIContent:new()
hashContent:setPos(0, 20)
hashContent:setSize(600, 580)
hashContent:setContentSize(600, 580)
contentValue:addChild(hashContent)
local tableHeadText = UIEditText:new()
tableHeadText:setPos(0, 0)
tableHeadText:setSize(600, keyHight)
tableHeadText:setText(string.format("%10s%20s%50s", 'row', 'key', 'value'))
hashContent:addChild(tableHeadText)
local tableHight = hashLen*keyHight + keyHight
tableHight = tableHight > 280 and 280 or tableHight
local list = redisClient:hgetall(keys[i])
for j = 1, hashLen do
local hashValueEdit = UIEditText:new()
hashValueEdit:setPos(0, (j-1)*keyHight + keyHight)
hashValueEdit:setSize(600, keyHight)
hashValueEdit:setText(string.format("%10s%20s%50s", j, hkeys[j], '...'))
hashContent:addChild(hashValueEdit)
local hashKeyEdit
local hashValueText
local hashValue = list[hkeys[j]]
hashValueEdit.events:on(UI_CLICK, function()
-- 增加key
if hashKeyEdit then
hashContent:removeChild(hashKeyEdit)
end
hashKeyEdit = UIEditText:new()
hashKeyEdit:setPos(0, tableHight)
hashKeyEdit:setSize(600, 50)
hashKeyEdit:setText("key\t:\t" .. hkeys[j])
hashContent:addChild(hashKeyEdit)
-- 显示value
if hashValueText then
hashContent:removeChild(hashValueText)
end
hashValueText = UIEditText:new()
hashValueText:setPos(0, tableHight+50)
hashValueText:setSize(600, 580 - (tableHight + 50))
hashValueText:setText("value\t:\t" .. hashValue)
hashContent:addChild(hashValueText)
end)
end
end
end)
end
end
function love.update(dt)
mgr:update(dt)
end
function love.draw()
mgr:draw()
end
function love.mousemoved(x, y, dx, dy)
mgr:mouseMove(x, y, dx, dy)
end
function love.mousepressed(x, y, button, isTouch)
mgr:mouseDown(x, y, button, isTouch)
end
function love.mousereleased(x, y, button, isTouch)
mgr:mouseUp(x, y, button, isTouch)
end
function love.keypressed(key, scancode, isrepeat)
mgr:keyDown(key, scancode, isrepeat)
end
function love.keyreleased(key)
mgr:keyUp(key)
end
function love.wheelmoved(x, y)
mgr:whellMove(x, y)
end
function love.textinput(text)
mgr:textInput(text)
end
|
-- colorscheme
vim.g.vscode_style = "dark"
vim.g.vscode_transparent = 1
vim.cmd[[colorscheme vscode]]
-- statusbar
require'lualine'.setup()
|
Config = {}
Config.Times = { 10, 22 } --Hours, in server time, that the degradation will occur |
local status_ok, filetype = pcall(require, "filetype")
if not status_ok then
return
end
filetype.setup{}
|
--------------------------------
-- @module Effect3D
-- @extend Ref
-- @parent_module cc
--------------------------------
--
-- @function [parent=#Effect3D] draw
-- @param self
-- @param #mat4_table transform
--------------------------------
--
-- @function [parent=#Effect3D] setTarget
-- @param self
-- @param #cc.Sprite3D sprite
-- @param #cc.Mesh childMesh
return nil
|
vim.cmd([[source ~/.config/nvim/vim/coc.vim]])
|
local ok = prequire('project_nvim')
if not ok then
return
end
require('project_nvim').setup {
manual_mode = true,
ignore_lsp = { 'null-ls' },
}
require('telescope').load_extension('projects')
vim.keymap.set('n', '<LocalLeader>fp', '<Cmd>Telescope projects<CR>')
local group = vim.api.nvim_create_augroup('ProjectCd', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'VimEnter' }, {
group = group,
callback = function()
if vim.tbl_contains({ 'nofile', 'prompt' }, vim.bo.buftype) then
return
end
if vim.tbl_contains({ 'help', 'qf' }, vim.bo.filetype) then
return
end
local ok, project = prequire('project_nvim.project')
if ok then
local root = project.get_project_root()
if root and vim.loop.cwd() ~= root then
vim.api.nvim_cmd({
cmd = 'tcd',
args = { root },
mods = {
silent = true,
},
}, {})
end
end
end,
})
vim.api.nvim_create_autocmd('VimLeavePre', {
group = group,
callback = function()
require('project_nvim.utils.history').write_projects_to_history()
end,
})
|
NoRun = {}
function mycheck(sender)
local id = getProcessIDFromProcessName("RobloxPlayer.exe");
for i,v in pairs(NoRun) do
if v==id or not id then
return
end
end
table.insert(NoRun, id);
openProcess(id);
autoAssemble([[
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(loop1)
label(endloop1)
label(continue)
alloc(script,4096)
label(exit)
script:
db 77 61 69 74 28 31 30 29 0D 0A 67 61 6D 65 2E 50 6C 61 79 65 72 73 2E 4C 6F 63 61 6C 50 6C 61 79 65 72 2E 43 68 61 74 74 65 64 3A 63 6F 6E 6E 65 63 74 28 66 75 6E 63 74 69 6F 6E 28 73 74 29 0D 0A 53 70 61 77 6E 28 66 75 6E 63 74 69 6F 6E 28 29 0D 0A 6C 6F 61 64 73 74 72 69 6E 67 28 73 74 29 28 29 20 0D 0A 65 6E 64 29 0D 0A 65 6E 64 29 2D 2D 5B 5B 30 2F 32 39 2F 31 30 0D 0A 2D 2D 20 50 6C 65 61 73 65 20 6E 6F 74 65 20 74 68 61 74 20 74 68 65 73 65 20 61 72 65 20 6C 6F 61 64 65 64 20 69 6E 20 61 20 73 70 65 63 69 66 69 63 20 6F 72 64 65 72 20 74 6F 20 64 69 6D 69 6E 69 73 68 20 65 72 72 6F 72 73 2F 70 65 72 63 65 69 76 65 64 20 6C 6F 61 64 20 74 69 6D 65 20 62 79 20 75 73 65 5D 5D 20
newmem:
originalcode:
cmp byte ptr[eax+3],43
jne continue
cmp byte ptr[eax+4],72
jne continue
pushad
mov ecx,0
loop1:
mov bl,byte ptr[script+ecx]
mov byte ptr [eax+ecx],bl
add ecx,1
cmp cl,E6
jnb endloop1
jmp loop1
endloop1:
popad
continue:
push edx
push ecx
push eax
push ebx
call 008D3C40
exit:
jmp returnhere
00715D0D:
jmp newmem
nop
nop
nop
nop
returnhere:
]])
end
t=createTimer(nil)
timer_setInterval(t, 300)
timer_onTimer(t, mycheck)
timer_setEnabled(t,true)
|
-- namesizer
-- a name synthesizer
-- K2 to create nonsense name
-- K3 to synthesize a name
local NameSizer = include("lib/namesizer")
local name = ""
local shiftDown = false
function init()
name = NameSizer.rnd()
redraw()
end
function key(n, z)
if n == 1 then
shiftDown = z == 1
elseif shiftDown and n == 2 and z == 1 then
name = NameSizer.phonic_nonsense()
redraw()
elseif shiftDown and n == 3 and z == 1 then
name = NameSizer.phonic_nonsense().." "..NameSizer.phonic_nonsense()
redraw()
elseif not shiftDown and n == 2 and z == 1 then
name = NameSizer.new_word()
redraw()
elseif not shiftDown and n == 3 and z == 1 then
name = NameSizer.rnd()
redraw()
end
end
function redraw()
screen.clear();
screen.move(64, 32 + 5)
screen.text_center(name)
screen.update();
end |
-- eLua build system
module( ..., package.seeall )
local lfs = require "lfs"
local sf = string.format
utils = require "utils.utils"
-------------------------------------------------------------------------------
-- Various helpers
-- Return the time of the last modification of the file
local function get_ftime( path )
local t = lfs.attributes( path, 'modification' )
return t or -1
end
-- Check if a given target name is phony
local function is_phony( target )
return target:find( "#phony" ) == 1
end
-- Return a string with $(key) replaced with 'value'
local function expand_key( s, key, value )
if not value then return s end
local fmt = sf( "%%$%%(%s%%)", key )
return ( s:gsub( fmt, value ) )
end
-- Return a target name considering phony targets
local function get_target_name( s )
if not is_phony( s ) then return s end
end
-- 'Liniarize' a file name by replacing its path separators indicators with '_'
local function linearize_fname( s )
return ( s:gsub( "[\\/]", "__" ) )
end
-- Helper: transform a table into a string if needed
local function table_to_string( t )
if not t then return nil end
if type( t ) == "table" then t = table.concat( t, " " ) end
return t
end
-- Helper: return the extended type of an object (takes into account __type)
local function exttype( o )
local t = type( o )
if t == "table" and o.__type then t = o:__type() end
return t
end
---------------------------------------
-- Table utils
-- (from http://lua-users.org/wiki/TableUtils)
function table.val_to_str( v )
if "string" == type( v ) then
v = string.gsub( v, "\n", "\\n" )
if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then
return "'" .. v .. "'"
end
return '"' .. string.gsub(v,'"', '\\"' ) .. '"'
else
return "table" == type( v ) and table.tostring( v ) or tostring( v )
end
end
function table.key_to_str ( k )
if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then
return k
else
return "[" .. table.val_to_str( k ) .. "]"
end
end
function table.tostring( tbl )
local result, done = {}, {}
for k, v in ipairs( tbl ) do
table.insert( result, table.val_to_str( v ) )
done[ k ] = true
end
for k, v in pairs( tbl ) do
if not done[ k ] then
table.insert( result,
table.key_to_str( k ) .. "=" .. table.val_to_str( v ) )
end
end
return "{" .. table.concat( result, "," ) .. "}"
end
-------------------------------------------------------------------------------
-- Dummy 'builder': simply checks the date of a file
local _fbuilder = {}
_fbuilder.new = function( target, dep )
local self = {}
setmetatable( self, { __index = _fbuilder } )
self.target = target
self.dep = dep
return self
end
_fbuilder.build = function( self )
-- Doesn't build anything but returns 'true' if the dependency is newer than
-- the target
if is_phony( self.target ) then
return true
else
return get_ftime( self.dep ) > get_ftime( self.target )
end
end
_fbuilder.target_name = function( self )
return get_target_name( self.dep )
end
-- Object type
_fbuilder.__type = function()
return "_fbuilder"
end
-------------------------------------------------------------------------------
-- Target object
local _target = {}
_target.new = function( target, dep, command, builder, ttype )
local self = {}
setmetatable( self, { __index = _target } )
self.target = target
self.command = command
self.builder = builder
builder:register_target( target, self )
self:set_dependencies( dep )
self.dep = self:_build_dependencies( self.origdep )
self.dont_clean = false
self.can_substitute_cmdline = false
self._force_rebuild = #self.dep == 0
builder.runlist[ target ] = false
self:set_type( ttype )
return self
end
-- Set dependencies as a string; actual dependencies are computed by _build_dependencies
-- (below) when 'build' is called
_target.set_dependencies = function( self, dep )
self.origdep = dep
end
-- Set the target type
-- This is only for displaying actions
_target.set_type = function( self, ttype )
local atable = { comp = { "[COMPILE]", 'blue' } , dep = { "[DEPENDS]", 'magenta' }, link = { "[LINK]", 'yellow' }, asm = { "[ASM]", 'white' } }
local tdata = atable[ ttype ]
if not tdata then
self.dispstr = is_phony( self.target ) and "[PHONY]" or "[TARGET]"
self.dispcol = 'green'
else
self.dispstr = tdata[ 1 ]
self.dispcol = tdata[ 2 ]
end
end
-- Set dependencies
-- This uses a proxy table and returns string deps dynamically according
-- to the targets currently registered in the builder
_target._build_dependencies = function( self, dep )
-- Step 1: start with an array
if type( dep ) == "string" then dep = utils.string_to_table( dep ) end
-- Step 2: linearize "dep" array keeping targets
local filter = function( e )
local t = exttype( e )
return t ~= "_ftarget" and t ~= "_target"
end
dep = utils.linearize_array( dep, filter )
-- Step 3: strings are turned into _fbuilder objects if not found as targets;
-- otherwise the corresponding target object is used
for i = 1, #dep do
if type( dep[ i ] ) == 'string' then
local t = self.builder:get_registered_target( dep[ i ] )
dep[ i ] = t or _fbuilder.new( self.target, dep[ i ] )
end
end
return dep
end
-- Set pre-build function
_target.set_pre_build_function = function( self, f )
self._pre_build_function = f
end
-- Set post-build function
_target.set_post_build_function = function( self, f )
self._post_build_function = f
end
-- Force rebuild
_target.force_rebuild = function( self, flag )
self._force_rebuild = flag
end
-- Set additional arguments to send to the builder function if it is a callable
_target.set_target_args = function( self, args )
self._target_args = args
end
-- Function to execute in clean mode
_target._cleaner = function( target, deps, tobj, disp_mode )
-- Clean the main target if it is not a phony target
local dprint = function( ... )
if disp_mode ~= "minimal" then print( ... ) end
end
if not is_phony( target ) then
if tobj.dont_clean then
dprint( sf( "[builder] Target '%s' will not be deleted", target ) )
return 0
end
if disp_mode ~= "minimal" then io.write( sf( "[builder] Removing %s ... ", target ) ) end
if os.remove( target ) then dprint "done." else dprint "failed!" end
end
return 0
end
-- Build the given target
_target.build = function( self )
if self.builder.runlist[ self.target ] then return end
local docmd = self:target_name() and lfs.attributes( self:target_name(), "mode" ) ~= "file"
docmd = docmd or self.builder.global_force_rebuild
local initdocmd = docmd
self.dep = self:_build_dependencies( self.origdep )
local depends, dep, previnit = '', self.dep, self.origdep
-- Iterate through all dependencies, execute each one in turn
local deprunner = function()
for i = 1, #dep do
local res = dep[ i ]:build()
docmd = docmd or res
local t = dep[ i ]:target_name()
if exttype( dep[ i ] ) == "_target" and t and not is_phony( self.target ) then
docmd = docmd or get_ftime( t ) > get_ftime( self.target )
end
if t then depends = depends .. t .. " " end
end
end
deprunner()
-- Execute the preb-build function if needed
if self._pre_build_function then self._pre_build_function( self, docmd ) end
-- If the dependencies changed as a result of running the pre-build function
-- run through them again
if previnit ~= self.origdep then
self.dep = self:_build_dependencies( self.origdep )
depends, dep, docmd = '', self.dep, initdocmd
deprunner()
end
-- If at least one dependency is new rebuild the target
docmd = docmd or self._force_rebuild or self.builder.clean_mode
local keep_flag = true
if docmd and self.command then
if self.builder.disp_mode ~= 'all' and self.builder.disp_mode ~= "minimal" and not self.builder.clean_mode then
io.write( utils.col_funcs[ self.dispcol ]( self.dispstr ) .. " " )
end
local cmd, code = self.command
if self.builder.clean_mode then cmd = _target._cleaner end
if type( cmd ) == 'string' then
cmd = expand_key( cmd, "TARGET", self.target )
cmd = expand_key( cmd, "DEPENDS", depends )
cmd = expand_key( cmd, "FIRST", dep[ 1 ]:target_name() )
if self.builder.disp_mode == 'all' then
print( cmd )
elseif self.builder.disp_mode ~= "minimal" then
print( self.target )
end
code = self:execute( cmd )
else
if not self.builder.clean_mode and self.builder.disp_mode ~= "all" and self.builder.disp_mode ~= "minimal" then
print( self.target )
end
code = cmd( self.target, self.dep, self.builder.clean_mode and self or self._target_args, self.builder.disp_mode )
if code == 1 then -- this means "mark target as 'not executed'"
keep_flag = false
code = 0
end
end
if code ~= 0 and code ~= true then
print( utils.col_red( "[builder] Error building target" ) )
if self.builder.disp_mode ~= 'all' and type( cmd ) == "string" then
print( utils.col_red( "[builder] Last executed command was: " ) )
print( cmd )
end
os.exit( 1 )
end
end
-- Execute the post-build function if needed
if self._post_build_function then self._post_build_function( self, docmd ) end
-- Marked target as "already ran" so it won't run again
self.builder.runlist[ self.target ] = true
return docmd and keep_flag
end
-- Return the actual target name (taking into account phony targets)
_target.target_name = function( self )
return get_target_name( self.target )
end
-- Restrict cleaning this target
_target.prevent_clean = function( self, flag )
self.dont_clean = flag
end
-- Object type
_target.__type = function()
return "_target"
end
_target.execute = function( self, cmd )
local code
if utils.is_windows() and #cmd > 8190 and self.can_substitute_cmdline then
-- Avoid cmd's maximum command line length limitation
local t = cmd:find( " " )
f = io.open( "tmpcmdline", "w" )
local rest = cmd:sub( t + 1 )
f:write( ( rest:gsub( "\\", "/" ) ) )
f:close()
cmd = cmd:sub( 1, t - 1 ) .. " @tmpcmdline"
end
local code = os.execute( cmd )
os.remove( "tmpcmdline" )
return code
end
_target.set_substitute_cmdline = function( self, flag )
self.can_substitute_cmdline = flag
end
-------------------------------------------------------------------------------
-- Builder public interface
builder = { KEEP_DIR = 0, BUILD_DIR_LINEARIZED = 1 }
---------------------------------------
-- Initialization and option handling
-- Create a new builder object with the output in 'build_dir' and with the
-- specified compile, dependencies and link command
builder.new = function( build_dir )
self = {}
setmetatable( self, { __index = builder } )
self.build_dir = build_dir or ".build"
self.exe_extension = utils.is_windows() and "exe" or ""
self.clean_mode = false
self.opts = utils.options_handler()
self.args = {}
self.user_args = {}
self.build_mode = self.KEEP_DIR
self.targets = {}
self.targetargs = {}
self._tlist = {}
self.runlist = {}
self.disp_mode = 'all'
self.cmdline_macros = {}
self.c_targets = {}
self.preprocess_mode = false
self.asm_mode = false
return self
end
-- Helper: create the build output directory
builder._create_build_dir = function( self )
if self.build_dir_created then return end
if self.build_mode ~= self.KEEP_DIR then
-- Create builds directory if needed
local mode = lfs.attributes( self.build_dir, "mode" )
if not mode or mode ~= "directory" then
if not utils.full_mkdir( self.build_dir ) then
print( "[builder] Unable to create directory " .. self.build_dir )
os.exit( 1 )
end
end
end
self.build_dir_created = true
end
-- Add an options to the builder
builder.add_option = function( self, name, help, default, data )
self.opts:add_option( name, help, default, data )
end
-- Initialize builder from the given command line
builder.init = function( self, args )
-- Add the default options
local opts = self.opts
opts:add_option( "build_mode", 'choose location of the object files', self.KEEP_DIR,
{ keep_dir = self.KEEP_DIR, build_dir_linearized = self.BUILD_DIR_LINEARIZED } )
opts:add_option( "build_dir", 'choose build directory', self.build_dir )
opts:add_option( "disp_mode", 'set builder display mode', 'summary', { 'all', 'summary', 'minimal' } )
-- Apply default values to all options
for i = 1, opts:get_num_opts() do
local o = opts:get_option( i )
self.args[ o.name:upper() ] = o.default
end
-- Read and interpret command line
for i = 1, #args do
local a = args[ i ]
if a:upper() == "-C" then -- clean option (-c)
self.clean_mode = true
elseif a:upper() == '-H' then -- help option (-h)
self:_show_help()
os.exit( 1 )
elseif a:upper() == "-E" then -- preprocess
self.preprocess_mode = true
elseif a:upper() == "-S" then -- generate assembler
self.asm_mode = true
elseif a:find( '-D' ) == 1 and #a > 2 then -- this is a macro definition that will be auomatically added to the compiler flags
table.insert( self.cmdline_macros, a:sub( 3 ) )
elseif a:find( '=' ) then -- builder argument (key=value)
local k, v = opts:handle_arg( a )
if not k then
self:_show_help()
os.exit( 1 )
end
self.args[ k:upper() ] = v
self.user_args[ k:upper() ] = true
else -- this must be the target name / target arguments
if self.targetname == nil then
self.targetname = a
else
table.insert( self.targetargs, a )
end
end
end
-- Read back the default options
self.build_mode = self.args.BUILD_MODE
self.build_dir = self.args.BUILD_DIR
self.disp_mode = self.args.DISP_MODE
end
-- Return the value of the option with the given name
builder.get_option = function( self, optname )
return self.args[ optname:upper() ]
end
-- Returns true if the given option was specified by the user on the command line, false otherwise
builder.is_user_option = function( self, optname )
return self.user_args[ optname:upper() ]
end
-- Show builder help
builder._show_help = function( self )
print( "[builder] Valid options:" )
print( " -h: help (this text)" )
print( " -c: clean target" )
print( " -E: generate preprocessed output for single file targets" )
print( " -S: generate assembler output for single file targets" )
self.opts:show_help()
end
---------------------------------------
-- Builder configuration
-- Set the compile command
builder.set_compile_cmd = function( self, cmd )
self.comp_cmd = cmd
end
-- Set the link command
builder.set_link_cmd = function( self, cmd )
self.link_cmd = cmd
end
-- Set the assembler command
builder.set_asm_cmd = function( self, cmd )
self._asm_cmd = cmd
end
-- Set (actually force) the object file extension
builder.set_object_extension = function( self, ext )
self.obj_extension = ext
end
-- Set (actually force) the executable file extension
builder.set_exe_extension = function( self, ext )
self.exe_extension = ext
end
-- Set the clean mode
builder.set_clean_mode = function( self, isclean )
self.clean_mode = isclean
end
-- Sets the build mode
builder.set_build_mode = function( self, mode )
self.build_mode = mode
end
-- Set the build directory
builder.set_build_dir = function( self, dir )
if self.build_dir_created then
print "[builder] Error: build directory already created"
os.exit( 1 )
end
self.build_dir = dir
self:_create_build_dir()
end
-- Return the current build directory
builder.get_build_dir = function( self )
return self.build_dir
end
-- Return the target arguments
builder.get_target_args = function( self )
return self.targetargs
end
-- Set a specific dependency generation command for the assembler
-- Pass 'false' to skip dependency generation for assembler files
builder.set_asm_dep_cmd = function( self, asm_dep_cmd )
self.asm_dep_cmd = asm_dep_cmd
end
-- Set a specific dependency generation command for the compiler
-- Pass 'false' to skip dependency generation for C files
builder.set_c_dep_cmd = function( self, c_dep_cmd )
self.c_dep_cmd = c_dep_cmd
end
-- Save the builder configuration for a given component to a string
builder._config_to_string = function( self, what )
local ctable = {}
local state_fields
if what == 'comp' then
state_fields = { 'comp_cmd', '_asm_cmd', 'c_dep_cmd', 'asm_dep_cmd', 'obj_extension' }
elseif what == 'link' then
state_fields = { 'link_cmd' }
else
print( sf( "Invalid argument '%s' to _config_to_string", what ) )
os.exit( 1 )
end
utils.foreach( state_fields, function( k, v ) ctable[ v ] = self[ v ] end )
return table.tostring( ctable )
end
-- Check the configuration of the given component against the previous one
-- Return true if the configuration has changed
builder._compare_config = function( self, what )
local res = false
local crtstate = self:_config_to_string( what )
if not self.clean_mode then
local fconf = io.open( self.build_dir .. utils.dir_sep .. ".builddata." .. what, "rb" )
if fconf then
local oldstate = fconf:read( "*a" )
fconf:close()
if oldstate:lower() ~= crtstate:lower() then res = true end
end
end
-- Write state to build dir
fconf = io.open( self.build_dir .. utils.dir_sep .. ".builddata." .. what, "wb" )
if fconf then
fconf:write( self:_config_to_string( what ) )
fconf:close()
end
return res
end
-- Sets the way commands are displayed
builder.set_disp_mode = function( self, mode )
mode = mode:lower()
if mode ~= 'all' and mode ~= 'summary' and mode ~= "minimal" then
print( sf( "[builder] Invalid display mode '%s'", mode ) )
os.exit( 1 )
end
self.disp_mode = mode
end
---------------------------------------
-- Command line builders
-- Internal helper
builder._generic_cmd = function( self, args )
local compcmd = args.compiler or "gcc"
compcmd = compcmd .. " "
local flags = type( args.flags ) == 'table' and table_to_string( utils.linearize_array( args.flags ) ) or args.flags
local defines = type( args.defines ) == 'table' and table_to_string( utils.linearize_array( args.defines ) ) or args.defines
local includes = type( args.includes ) == 'table' and table_to_string( utils.linearize_array( args.includes ) ) or args.includes
local comptype = table_to_string( args.comptype ) or "-c"
compcmd = compcmd .. utils.prepend_string( defines, "-D" )
compcmd = compcmd .. utils.prepend_string( includes, "-I" )
return compcmd .. flags .. " " .. comptype .. " -o $(TARGET) $(FIRST)"
end
-- Return a compile command based on the specified args
builder.compile_cmd = function( self, args )
args.defines = { args.defines, self.cmdline_macros }
if self.preprocess_mode then
args.comptype = "-E"
elseif self.asm_mode then
args.comptype = "-S"
else
args.comptype = "-c"
end
return self:_generic_cmd( args )
end
-- Return an assembler command based on the specified args
builder.asm_cmd = function( self, args )
args.defines = { args.defines, self.cmdline_macros }
args.compiler = args.assembler
args.comptype = self.preprocess_mode and "-E" or "-c"
return self:_generic_cmd( args )
end
-- Return a link command based on the specified args
builder.link_cmd = function( self, args )
local flags = type( args.flags ) == 'table' and table_to_string( utils.linearize_array( args.flags ) ) or args.flags
local libraries = type( args.libraries ) == 'table' and table_to_string( utils.linearize_array( args.libraries ) ) or args.libraries
local linkcmd = args.linker or "gcc"
linkcmd = linkcmd .. " " .. flags .. " -o $(TARGET) $(DEPENDS)"
linkcmd = linkcmd .. " " .. utils.prepend_string( libraries, "-l" )
return linkcmd
end
---------------------------------------
-- Target handling
-- Create a return a new C to object target
builder.c_target = function( self, target, deps, comp_cmd )
return _target.new( target, deps, comp_cmd or self.comp_cmd, self, 'comp' )
end
-- Create a return a new ASM to object target
builder.asm_target = function( self, target, deps, asm_cmd )
return _target.new( target, deps, asm_cmd or self._asm_cmd, self, 'asm' )
end
-- Return the name of a dependency file name corresponding to a C source
builder.get_dep_filename = function( self, srcname )
return utils.replace_extension( self.build_dir .. utils.dir_sep .. linearize_fname( srcname ), "d" )
end
-- Create a return a new C dependency target
builder.dep_target = function( self, dep, depdeps, dep_cmd )
local depname = self:get_dep_filename( dep )
return _target.new( depname, depdeps, dep_cmd, self, 'dep' )
end
-- Create and return a new link target
builder.link_target = function( self, out, dep, link_cmd )
local path, ext = utils.split_ext( out )
if not ext and self.exe_extension and #self.exe_extension > 0 then
out = out .. self.exe_extension
end
local t = _target.new( out, dep, link_cmd or self.link_cmd, self, 'link' )
if self:_compare_config( 'link' ) then t:force_rebuild( true ) end
t:set_substitute_cmdline( true )
return t
end
-- Create and return a new generic target
builder.target = function( self, dest_target, deps, cmd )
return _target.new( dest_target, deps, cmd, self )
end
-- Register a target (called from _target.new)
builder.register_target = function( self, name, obj )
self._tlist[ name:gsub( "\\", "/" ) ] = obj
end
-- Returns a registered target (nil if not found)
builder.get_registered_target = function( self, name )
return self._tlist[ name:gsub( "\\", "/" ) ]
end
---------------------------------------
-- Actual building functions
-- Return the object name corresponding to a source file name
builder.obj_name = function( self, name, ext )
local r = ext or self.obj_extension
if not r then
r = utils.is_windows() and "obj" or "o"
end
local objname = utils.replace_extension( name, r )
-- KEEP_DIR: object file in the same directory as source file
-- BUILD_DIR_LINEARIZED: object file in the build directory, linearized filename
if self.build_mode == self.KEEP_DIR then
return objname
elseif self.build_mode == self.BUILD_DIR_LINEARIZED then
return self.build_dir .. utils.dir_sep .. linearize_fname( objname )
end
end
-- Read and interpret dependencies for each file specified in "ftable"
-- "ftable" is either a space-separated string with all the source files or an array
builder.read_depends = function( self, ftable )
if type( ftable ) == 'string' then ftable = utils.string_to_table( ftable ) end
-- Read dependency data
local dtable = {}
for i = 1, #ftable do
local f = io.open( self:get_dep_filename( ftable[ i ] ), "rb" )
local lines = ftable[ i ]
if f then
lines = f:read( "*a" )
f:close()
lines = lines:gsub( "\n", " " ):gsub( "\\%s+", " " ):gsub( "%s+", " " ):gsub( "^.-: (.*)", "%1" )
end
dtable[ ftable[ i ] ] = lines
end
return dtable
end
-- Create and return compile targets for the given sources
builder.create_compile_targets = function( self, ftable, res )
if type( ftable ) == 'string' then ftable = utils.string_to_table( ftable ) end
res = res or {}
ccmd, oname = "-c", "o"
if self.preprocess_mode then
ccmd, oname = '-E', "pre"
elseif self.asm_mode then
ccmd, oname = '-S', 's'
end
-- Build dependencies for all targets
for i = 1, #ftable do
local isasm = ftable[ i ]:find( "%.c$" ) == nil
-- Skip assembler targets if 'asm_dep_cmd' is set to 'false'
-- Skip C targets if 'c_dep_cmd' is set to 'false'
local skip = isasm and self.asm_dep_cmd == false
skip = skip or ( not isasm and self.c_dep_cmd == false )
local deps = self:get_dep_filename( ftable[ i ] )
local target
if not isasm then
local depcmd = skip and self.comp_cmd or ( self.c_dep_cmd or self.comp_cmd:gsub( ccmd .. " ", sf( ccmd .. " -MD -MF %s ", deps ) ) )
target = self:c_target( self:obj_name( ftable[ i ], oname ), { self:get_registered_target( deps ) or ftable[ i ] }, depcmd )
else
local depcmd = skip and self._asm_cmd or ( self.asm_dep_cmd or self._asm_cmd:gsub( ccmd .. " ", sf( ccmd .. " -MD -MF %s ", deps ) ) )
target = self:asm_target( self:obj_name( ftable[ i ], oname ), { self:get_registered_target( deps ) or ftable[ i ] }, depcmd )
end
-- Pre build step: replace dependencies with the ones from the compiler generated dependency file
local dprint = function( ... ) if self.disp_mode ~= "minimal" then print( ... ) end end
if not skip then
target:set_pre_build_function( function( t, _ )
if not self.clean_mode then
local fres = self:read_depends( ftable[ i ] )
local fdeps = fres[ ftable[ i ] ]
if #fdeps:gsub( "%s+", "" ) == 0 then fdeps = ftable[ i ] end
t:set_dependencies( fdeps )
else
if self.disp_mode ~= "minimal" then io.write( sf( "[builder] Removing %s ... ", deps ) ) end
if os.remove( deps ) then dprint "done." else dprint "failed!" end
end
end )
end
target.srcname = ftable[ i ]
-- TODO: check clean mode?
if not isasm then self.c_targets[ #self.c_targets + 1 ] = target end
table.insert( res, target )
end
return res
end
-- Add a target to the list of builder targets
builder.add_target = function( self, target, help, alias )
self.targets[ target.target ] = { target = target, help = help }
alias = alias or {}
for _, v in ipairs( alias ) do
self.targets[ v ] = { target = target, help = help }
end
return target
end
-- Make a target the default one
builder.default = function( self, target )
self.deftarget = target.target
self.targets.default = { target = target, help = "default target" }
end
-- Build everything
builder.build = function( self, target )
local t = self.targetname or self.deftarget
if not t then
print( utils.col_red( "[builder] Error: build target not specified" ) )
os.exit( 1 )
end
local trg
-- Look for single targets (C source files)
for _, ct in pairs( self.c_targets ) do
if ct.srcname == t then
trg = ct
break
end
end
if not trg then
if not self.targets[ t ] then
print( sf( "[builder] Error: target '%s' not found", t ) )
print( "Available targets: " )
print( " all source files" )
for k, v in pairs( self.targets ) do
if not is_phony( k ) then
print( sf( " %s - %s", k, v.help or "(no help available)" ) )
end
end
if self.deftarget and not is_phony( self.deftarget ) then
print( sf( "Default target is '%s'", self.deftarget ) )
end
os.exit( 1 )
else
if self.preprocess_mode or self.asm_mode then
print( "[builder] Error: preprocess (-E) or asm (-S) works only with single file targets." )
os.exit( 1 )
end
trg = self.targets[ t ].target
end
end
self:_create_build_dir()
-- At this point check if we have a change in the state that would require a rebuild
if self:_compare_config( 'comp' ) then
print( utils.col_yellow( "[builder] Forcing rebuild due to configuration change." ) )
self.global_force_rebuild = true
else
self.global_force_rebuild = false
end
-- Do the actual build
local res = trg:build()
if not res then print( utils.col_yellow( sf( '[builder] %s: up to date', t ) ) ) end
if self.clean_mode then
os.remove( self.build_dir .. utils.dir_sep .. ".builddata.comp" )
os.remove( self.build_dir .. utils.dir_sep .. ".builddata.link" )
end
print( utils.col_yellow( "[builder] Done building target." ) )
return res
end
-- Create dependencies, create object files, link final object
builder.make_exe_target = function( self, target, file_list )
local odeps = self:create_compile_targets( file_list )
local exetarget = self:link_target( target, odeps )
self:default( self:add_target( exetarget ) )
return exetarget
end
-------------------------------------------------------------------------------
-- Other exported functions
function new_builder( build_dir )
return builder.new( build_dir )
end
|
--new
function DIALOG()
--Trigger
--Triggernumber,Type,Person
--0,D,Zakashi
--1,D,Kev
--2,D,Benjamin
--3,D,Tangent
--Startnode, Person
--0
--50, Zakashi
--100, Kev Critter
--150, Benjamin Kain
--200, Tangent Employee
--Items -> none
-----------------------------------------------------
--Human Resource Director
NODE(0)
SAY("What a strange coincidence that you would come right when we need you. The beam weapon project is progressing in big steps. A test run has already been made to see the effects it has on various materials. It is all very convincing. Only that alone is not sufficient for Tangent.")
ANSWER("CONTINUE",1)
NODE(1)
SAY("Knowledge is required. Information on the progress of BioTech developments. For this purpose we need a reliable Runner like you to conduct some investigation into that direction.")
ANSWER("Investigation? What kind of investigation?",2)
NODE(2)
SAY("Tangent has various methods to get required information. There are many contact persons who would sell their own mother for money. Enough of them to directly play into our hands.")
ANSWER("Isn't spying illegal?",3)
NODE(3)
SAY("Spying? You obviously still haven't learnt that Tangent only does what every other company does as well. Which is exactly the reason why Tangent is still in business.")
ANSWER("CONTINUE",4)
NODE(4)
SAY("You can't really be so innocent to believe that other companies don't use the same methods, right? This task is important for the company. And as far as I am concerned you are either for or against Tangent. I would not advise you to be against Tangent.")
ANSWER("I did not want to seem insulting, sorry. It's just...",5)
NODE(5)
SAY("Look around and you'll see two possibilities. Either you belong to a powerful faction or... you should decrease your life expectancy accordingly. The contact person for this task can be found at the Catlock Bay.")
ANSWER("CONTINUE",6)
NODE(6)
SAY("You can offer him up to 10000 credits if you think the information is worth it. He is a Tsunami with the name of Gruber. Be on your guard.")
ANSWER("CONTINUE",7)
NODE(7)
SAY("There is no law in the Wastelands so be careful. Don't stay too long out there or you might catch a nasty mutation. If you find out anything interesting just come back here and report to me.")
STARTMISSION()
SETNEXTDIALOGSTATE(200)
ENDDIALOG()
NODE(8)
SAY("It is your choice. If you change your mind just come back here.")
ENDDIALOG()
NODE()
-----------------------------------------------------
--Zakashi
NODE(50)
SAY("Come closer, I don't want to repeat myself in the case you don't understand me. Who sent you?")
ANSWER("I am coming from Tangent. You are supposed to have information on how far the development of the BioTech Beam weapon has advanced so far.",51)
NODE(51)
SAY("Me? I am supposed to have that information? don't make a fool of yourself. I only have information about who could help you. But I am not certain if you really want to know that.")
ANSWER("Why? After all that is the only reason why I came all this way into the Wastelands.",52)
NODE(52)
SAY("I hope you are aware that I am Tsunami?")
ANSWER("Yes, I have been informed. Just tell me that person you spoke about. Then I can finally leave this death zone.",53)
NODE(53)
SAY("You might try that crazy Kev Critter at the Blackmist Garbage Dump. But speaking about death zones...")
ANSWER("CONTINUE",54)
NODE(54)
SAY("BioTech already anticipated that there would be many people nosing around their secrets. People that have to be stopped. That is why they paid me to eliminate this threat. ")
ANSWER("One moment. What is that supposed to mean? You have been hired to kill people?",55)
NODE(55)
SAY("Very good, yes. People like you to be precise.")
ANSWER("I am certain we could manage this peacefully.",56)
NODE(56)
SAY("I am sorry but I am always loyal to the client. That is why I am going to kill you now.")
ANSWER("But...",57)
NODE(57)
SAY("Too late...")
ACTIVATEDIALOGTRIGGER(0)
SETNEXTDIALOGSTATE(58)
ATTACK()
ENDDIALOG()
NODE(58)
SAY("Only one person will leave this place alive.")
ATTACK()
ENDDIALOG()
-----------------------------------------------------
--Kev Critter
NODE(100)
ISMISSIONTARGETACCOMPLISHED(0)
if(result==0)then
SAY("I see so many stars... so many... do you see them too?")
ENDDIALOG()
else
SAY("Huh? Are you a ghost?")
ANSWER("I can assure you I am very much real and not in a particular good mood.",101)
end
NODE(101)
SAY("... I.... don't know, do I know you? The sky is so strange...")
ANSWER("You seem to be on drugs. Bah, I can't talk to you like that.",102)
NODE(102)
SAY("What? Yes, I can talk... but about what? Hihihi. Quick, bring me some of this Powerbooze Gold. That helps most of the time.")
ANSWER("Do I have a choice?... I thought so...",103)
NODE(103)
SAY("Everything is so strange...")
SETNEXTDIALOGSTATE(104)
ENDDIALOG()
--Spieler besorgt Powerbooze Gold 804
NODE(104)
TAKEITEM(804)
if(result==0)then
SAY("Please bring me a Powerbooze Gold.")
ENDDIALOG()
else
SAY("Ahhh... that's much better... this drug was shit. I think I burned too many braincells on this trip.")
ANSWER("I would definitively say so. Are you crazy? Getting on a trip like that?",105)
end
NODE(105)
SAY("That's easy to say for you... it is warm in the city, everybody has a nice appartement and you give a damn about the people here in the Wastelands.")
ANSWER("You can't say that...",106)
NODE(106)
SAY("Have a look around and count the abandoned villages... all were destroyed from mutants or even worse things.")
ANSWER("CONTINUE",107)
NODE(107)
SAY("And the citizens of Neocron sit on their hands and swallow one Powerbooze after the other. I would much prefer to do that as well if I did not have this job here.")
ANSWER("I am sick of it. Somebody already tried to kill me only because I wanted some information about BioTech.",108)
NODE(108)
SAY("Yes, every faction is guarding their secrets at all costs. Do you want to cry out your soul here or do you actually have anything useful to say?")
ANSWER("I won't be talked to like that. I would love to smash your face for that one. Tell me how far BioTech is with the development of their Beamweapon!",109)
NODE(109)
SAY("You are not very polite. Think about something else... maybe a little bit more polite.")
ANSWER("...Alright... I did not want to get all that excited anyway. Could you please tell me something? I would like to know how far the development of the BioTech Beamweapon has come.",110)
NODE(110)
SAY("Very good, much better, wasn't that difficult either, don't you think?... argh, my head still hurts... Alright, I only know one BioTech employee. Don't know if he can help you... just try it... His name is Benjamin. You can find him in the Industrial Sector 02. He always says that that is his world.")
SETNEXTDIALOGSTATE(111)
ACTIVATEDIALOGTRIGGER(1)
ENDDIALOG()
NODE(111)
SAY("Ask Benjamin in Industrial 02, I don't want to get involved.")
ENDDIALOG()
-----------------------------------------------------
--Benjamin Kain
NODE(150)
ISMISSIONTARGETACCOMPLISHED(1)
if(result==0)then
SAY("Go away, leave me be.")
ENDDIALOG()
else
SAY("Yes? What?")
ANSWER("Do you work for BioTech? Since I have heard something like that...",151)
end
NODE(151)
SAY("Would you be a little bit more precise?")
ANSWER("I would have liked to get some information but I need your help with it.",152)
NODE(152)
SAY("Do I look as if it would be fun to answer such questions to some pedestrians?")
ANSWER("I can offer you a compensation for your trouble. For all the effort you have to put into it.",153)
NODE(153)
SAY("Credits? You mean credits? Well, maybe something would spring to my mind. But it could cost a little bit.")
ANSWER("That sounds much better. Do you by any chance happen to know about the newly developed beam weapon ? BioTech should already have invested a lot of work into that project.",154)
NODE(154)
SAY("Funny that you should ask. I know about it and I can even offer you more. For the right price, that is. I have a blueprint of that beamweapon right here with me.")
ANSWER("Really? That is an exceptional coincidence. How much do you want for that?",155)
NODE(155)
SAY("Since I believe BioTech should concentrate more on already established projects, not something like weapons, rather something like implants.")
ANSWER("CONTINUE",156)
NODE(156)
SAY("That's why I am offering it to you at a special price. But not right now since that would just draw too much attention to me. At the moment I can offer you the information about the status of the project.")
ANSWER("That is exactly what I need.",157)
NODE(157)
SAY("For you it's only 15000.")
ANSWER("I can only offer you 10000. My superiors did not allocate more for this assignment.",158)
NODE(158)
SAY("Alright, if it has to be. The development of the beam weapon has progressed rather far already. A complex method to concentrate several beams has already been found and is being tested as we speak.")
ANSWER("CONTINUE",159)
NODE(159)
SAY("At the moment there are still problems with the size of the emitters. Three persons would not be able to lift it off the ground. Since the CityAdmin has given out precise instructions the power of the weapon is about 15 percent higher than a comparable weapon that is available now.")
ANSWER("Good, that is very revealing. Thank you. I will quite possibly contact you again because of that blueprint.",160)
NODE(160)
SAY("Yes, do that. But I cannot guarantee that I will still have the blueprint then.")
SETNEXTDIALOGSTATE(161)
ACTIVATEDIALOGTRIGGER(2)
ENDDIALOG()
NODE(161)
SAY("If you are not interested at the blueprint I have no desire to further speak to you.")
ENDDIALOG()
-----------------------------------------------------
--Human Resource Director
NODE(200)
ISMISSIONTARGETACCOMPLISHED(2)
if(result==0)then
SAY("Don't you have something to report? The contact person is in the Catlock Bay Area.")
ENDDIALOG()
else
SAY("Have you acquired any news?")
ANSWER("It was almost an odyssee. I had to cross the whole Wastelands just to find somebody who could provide the information.",201)
end
NODE(201)
SAY("Nobody claimed that it would be easy to get these informations. But you seem to have found something if I am not mistaken.")
ANSWER("Yes, I do know now that BioTech is already testing their weapon's power. But it would seem that they have problems with the size of the cannon.",202)
NODE(202)
SAY("Very interesting. your report is identical to those of some other operatives. that means we can be pretty sure that this information is right.")
ANSWER("I have expected that other Runners would get the same assignment. But isn't it rather elaborate and costly to do that?",203)
NODE(203)
SAY("Yes it is but we cannot properly assess if the Runner will be successful with his mission or not. Which means we are playing safe and sending more people. You have done a good job, Runner.")
ANSWER("Wait a moment. The contact person did even have a blueprint of the BioTech prototype.",204)
NODE(204)
SAY("... If that is true we have to look into that ourselves. You can allow yourself some rest for now.")
ANSWER("CONTINUE",205)
NODE(205)
GIVEMONEY(5000)
SAY("It will take some time until we evaluated all information. Only then can we plan the next step. But for your services you have earned yourself 5000 credits.")
EPICRUNFINISHED(4,2)
ACTIVATEDIALOGTRIGGER(3)
ENDDIALOG()
end |
module(..., package.seeall)
local db = BAMBOO_DB
--- create a list
--
function save( key, tbl )
-- if exist, remove it first
if db:exists(key) then
db:del(key)
end
-- push all elements in tbl to redis hash
for k, v in pairs(tbl) do
db:hset(key, k, tostring(v))
end
end
--- update a list
--
function update( key, tbl )
for k, v in pairs(tbl) do
db:hset(key, k, tostring(v))
end
end
function retrieve( key )
return db:hgetall(key)
end
-- in hash store, passed into add function should be a table
-- such as { good = true }
function add( key, tbl )
update(key, tbl)
end
-- in hash store, passed into remove function should be a table
-- remove action will check the key and value's equality before real deletion
function remove(key, tbl)
for k, v in pairs(tbl) do
if db:hget(key, k) == tostring(v) then
db:hdel(key, k)
end
end
end
function has(key, keytocheck)
if db:hget(key, keytocheck) then
return true
else
return false
end
end
function num(key)
return db:hlen(key)
end
|
mapEffects = require "lib/mapEffects"
target.avatar_oriented_effect(mapEffects.getAvatarOrientedEffect("userTalk")) |
-- @is_minor boolean
function TrackList:adjust_windows(is_minor)
return r.TrackList_AdjustWindows(is_minor)
end
function TrackList:update_all_external_surfaces()
return r.TrackList_UpdateAllExternalSurfaces()
end
|
-- makes any arrow markers move up and down like in single player
local streamedMarkers = {} -- { marker = { (baseX, baseY, baseZ | offsetX, offsetY, offsetZ, attachedTo = elem), anim = anim } }
local sin = math.sin
local function setMarkerZ(marker, angle)
local info = streamedMarkers[marker]
if not info then
return
end
local baseX, baseY, baseZ
if info.attachedTo then
baseX, baseY, baseZ = getElementPosition(info.attachedTo)
baseX, baseY, baseZ = baseX + info[1], baseY + info[2], baseZ + info[3]
else
baseX, baseY, baseZ = unpack(info)
end
setElementPosition(marker, baseX, baseY, baseZ + sin(angle))
end
addEventHandler('onClientElementStreamIn', root,
function()
if getElementType(source) ~= 'marker' or getMarkerType(source) ~= 'arrow' then
return
end
local attachedTo = getElementAttachedTo(source)
if attachedTo then
local x, y, z = getElementPosition(source)
local baseX, baseY, baseZ = getElementPosition(attachedTo)
detachElements(source)
streamedMarkers[source] = { x - baseX, y - baseY, z - baseZ, attachedTo = attachedTo }
else
streamedMarkers[source] = { getElementPosition(source) }
end
streamedMarkers[source].anim = Animation.createAndPlay(source, { from = 0, to = 2*math.pi, time = 2000, repeats = 0, fn = setMarkerZ })
end
)
addEventHandler('onClientElementStreamOut', root,
function()
if getElementType(source) ~= 'marker' or getMarkerType(source) ~= 'arrow' then
return
end
local info = streamedMarkers[source]
if info.attachedTo then
attachElements(source, info.attachedTo, unpack(info))
else
setElementPosition(source, unpack(info))
end
info.anim:remove()
streamedMarkers[source] = nil
end
)
|
require "import"
import "mlua.muk"
import "com.michael.NoScrollListView"
import "com.michael.NoScrollGridView"
local debug_time_create_n=os.clock()
if not 文件是否存在(MUKAPP文件()) then
创建文件夹(MUKAPP文件())
end
if not 文件是否存在(MUKAPP文件("Download")) then
创建文件夹(MUKAPP文件("Download"))
end
if not 文件是否存在(内置存储文件()) then
创建文件夹(内置存储文件())
end
if not 文件是否存在(内置存储文件("Note")) then
创建文件夹(内置存储文件("Note"))
end
local function jxUrl(newIntent)
local Created_Thing=""
local uriString = tostring(newIntent.getData())
if "num1"==uriString then
Created_Thing=[[ch_light("工具")
控件隐藏(page_home)
控件可见(page_tool)
_title.Text="工具"]]
elseif "num2"==uriString then
Created_Thing=[[跳转页面("mlua/search")]]
elseif "num3"==uriString then
Created_Thing=[[page_home_p.showPage(3)]]
elseif "num4"==uriString then
Created_Thing=[[跳转页面("mlua/view-code")]]
end
activityContent=Created_Thing
isShortcut="Shortcut"
end
if Build.VERSION.SDK_INT >= 30 then
import "android.content.pm.ShortcutInfo"
import "android.graphics.drawable.Icon"
--创建Intent对象
local intent1 = Intent(Intent.ACTION_MAIN);
--ComponentName设置应用之间跳转 包名(这里直接获取程序包名), 包名+类名(AndroLua打包后还是这个)
intent1.setComponent(ComponentName(activity.getPackageName(),"com.androlua.Main"));
intent1.setData(Uri.parse("num1"));
local intent2 = Intent(Intent.ACTION_MAIN);
intent2.setComponent(ComponentName(activity.getPackageName(),"com.androlua.Main"));
intent2.setData(Uri.parse("num2"));
--[[local intent3 = Intent(Intent.ACTION_MAIN);
intent3.setComponent(ComponentName(activity.getPackageName(),"com.androlua.Main"));
intent3.setData(Uri.parse("num3"));]]
local intent4 = Intent(Intent.ACTION_MAIN);
intent4.setComponent(ComponentName(activity.getPackageName(),"com.androlua.Main"));
intent4.setData(Uri.parse("num4"));
local SHORTCUT_TABLE={
{"ID1","工具",intent1,activity.getLuaDir(图标("inbox"))},
{"ID2","搜索",intent2,activity.getLuaDir(图标("search"))},
--{"ID3","社区",intent3,activity.getLuaDir(图标("chat_bubble"))},
{"ID4","代码调试",intent4,activity.getLuaDir(图标("build"))},
}
--动态的Shortcut,获取ShortcutManager,快捷方式管理器
--提供了添加,移除,更新,禁用,启动,获取静态快捷方式,获取动态快捷方式,获取固定在桌面的快捷方式等方法
local scm = activity.getSystemService(activity.SHORTCUT_SERVICE);
local infos = ArrayList();
for k,v in pairs(SHORTCUT_TABLE) do
local si = ShortcutInfo.Builder(this,v[1])
.setIcon(Icon.createWithBitmap(loadbitmap(v[4])))
--快捷方式添加到桌面显示的标签文本
.setShortLabel(v[2])
--长按图标快捷方式显示的标签文本(既快捷方式名字)
.setLongLabel(v[2])
.setIntent(v[3])
.build();
infos.add(si);
end
--添加快捷方式
scm.setDynamicShortcuts(infos);
--移除快捷方式
--scm.removeDynamicShortcuts(infos);
--Intent回调设置点击事件
function onNewIntent(intent)
newIntent=intent
jxUrl(newIntent)
end
end
activityContent=Created_Thing
activityContent,isShortcut=...
function showD(id)--主页底栏项目高亮动画
local kidt=id.getChildAt(0)
local kidw=id.getChildAt(1)
local animatorSet = AnimatorSet()
local tscaleX = ObjectAnimator.ofFloat(kidt, "scaleX", {kidt.scaleX, 1.0})
local tscaleY = ObjectAnimator.ofFloat(kidt, "scaleY", {kidt.scaleY, 1.0})
local wscaleX = ObjectAnimator.ofFloat(kidw, "scaleX", {kidw.scaleX, 1.0})
local wscaleY = ObjectAnimator.ofFloat(kidw, "scaleY", {kidw.scaleY, 1.0})
animatorSet.setDuration(256)
animatorSet.setInterpolator(DecelerateInterpolator());
animatorSet.play(tscaleX)
.with(tscaleY)
.with(wscaleX)
.with(wscaleY)
animatorSet.start();
end
function closeD(id)--主页底栏项目灰色动画
local gkidt=id.getChildAt(0)
local gkidw=id.getChildAt(1)
local ganimatorSet = AnimatorSet()
local gtscaleX = ObjectAnimator.ofFloat(gkidt, "scaleX", {gkidt.scaleX, 0.9})
local gtscaleY = ObjectAnimator.ofFloat(gkidt, "scaleY", {gkidt.scaleY, 0.9})
local gwscaleX = ObjectAnimator.ofFloat(gkidw, "scaleX", {gkidw.scaleX, 0.9})
local gwscaleY = ObjectAnimator.ofFloat(gkidw, "scaleY", {gkidw.scaleY, 0.9})
ganimatorSet.setDuration(256)
ganimatorSet.setInterpolator(DecelerateInterpolator());
ganimatorSet.play(gtscaleX)
.with(gtscaleY)
.with(gwscaleX)
.with(gwscaleY)
ganimatorSet.start();
end
function jcpage(z)--主页
jc.showPage(z)
end
lastclick = os.time() - 2
function onKeyDown(code,event)
local now = os.time()
if string.find(tostring(event),"KEYCODE_BACK") ~= nil then
if pop.isShowing() then
pop.dismiss()
return true
end
if _drawer.isDrawerOpen(Gravity.LEFT) then
_drawer.closeDrawer(Gravity.LEFT)
return true
end
if now - lastclick > 2 then
Snakebar("再按一次退出")
lastclick = now
return true
end
end
end
function 文字卡片(title,content)
return {
LinearLayout;
layout_width="-1";
layout_height="-2";
orientation="vertical";
{
CardView;
CardElevation="0dp";
CardBackgroundColor=cardbackc;
Radius="8dp";
layout_width="-1";
layout_height="-2";
layout_margin="16dp";
layout_marginTop="8dp";
layout_marginBottom="8dp";
{
LinearLayout;
layout_width="-1";
layout_height="-1";
orientation="vertical";
padding="16dp";
{
TextView;
text=title;
textColor=primaryc;
textSize="16sp";
gravity="center|left";
Typeface=字体("product-Bold");
};
{
TextView;
text=content;
textColor=stextc;
textSize="14sp";
gravity="center|left";
--Typeface=字体("product");
layout_marginTop="12dp";
};
};
};
};
end
function onDestroy()
--os.exit()
end
function onCreate()
--[[Http.get("https://www.mukapp.top/tongji/",function(code,content,cookie,header)
end)]]
--设置视图
activity.setContentView(loadlayout("layout/bookmain"))
--沉浸状态栏
--[[if 全局主题值=="Day" then
沉浸状态栏(true)
else
沉浸状态栏()
end]]
local id={swipe1,swipe2,swipe3,swipe4,swipe5}
for i=1,#id do
id[i].setProgressViewOffset(true,0, 64)
id[i].setColorSchemeColors({转0x(primaryc),转0x(primaryc)-0x9f000000})
id[i].setProgressBackgroundColorSchemeColor(转0x(barbackgroundc))
end
id=nil
波纹({_menu,_more,page1,page2,page3,page4,jc1,jc2,mbf,mxz,mqh},"圆主题")
波纹({newnote},"方主题")
图标注释(_more,"更多")
图标注释(_menu,"导航")
local ch_item_checked_background = GradientDrawable()
.setShape(GradientDrawable.RECTANGLE)
.setColor(转0x(primaryc)-0xde000000)
.setCornerRadii({0,0,dp2px(24),dp2px(24),dp2px(24),dp2px(24),0,0});
local drawer_item={
{
LinearLayout;
Focusable=true;
layout_width="fill";
layout_height="wrap";
{
TextView;
id="title";
textSize="14dp";
textColor=primaryc;
layout_marginTop="8dp";
layout_marginLeft="16dp";
Typeface=字体("product");
};
};
{
LinearLayout;
layout_width="-1";
layout_height="48dp";
gravity="center|left";
{
ImageView;
id="iv";
ColorFilter=textc;
layout_marginLeft="24dp";
layout_width="24dp";
layout_height="24dp";
};
{
TextView;
id="tv";
layout_marginLeft="16dp";
textSize="14dp";
textColor=textc;
Typeface=字体("product");
};
};
{
RelativeLayout;
layout_width="-1";
layout_height="48dp";
{
LinearLayout;
layout_width="-1";
layout_height="-1";
layout_marginRight="8dp";
BackgroundDrawable=ch_item_checked_background;
};
{
LinearLayout;
layout_width="-1";
layout_height="-1";
gravity="center|left";
{
ImageView;
id="iv";
ColorFilter=primaryc;
layout_marginLeft="24dp";
layout_width="24dp";
layout_height="24dp";
};
{
TextView;
id="tv";
layout_marginLeft="16dp";
textSize="14dp";
textColor=primaryc;
Typeface=字体("product");
};
};
};
{
LinearLayout;
layout_width="-1";
layout_height="-2";
gravity="center|left";
onClick=function()end;
{
TextView;
layout_width="-1";
layout_height="2px";
background="#21000000";
layout_marginTop="8dp";
layout_marginBottom="8dp";
};
};
};
--侧滑adapter
adp=LuaMultiAdapter(activity,drawer_item)
drawer_lv.setAdapter(adp)--侧滑
--侧滑table
local ch_table={
"分割线",
{"主页","home",},
{"工具","inbox",},
{"源码","get_app",},
"分割线",
-- {"捐赠muk","card_giftcard",},
{"分享","open_in_new",},
{"关于","info",},
-- {"设置","settings",},
{"退出","exit_to_app",},
};
function ch_light(n)--侧滑高亮
adp.clear()
for i=1,#ch_table do
if ch_table[i]=="分割线"then
adp.add{__type=4}
elseif n==ch_table[i][1] then
adp.add{__type=3,iv={src=图标(ch_table[i][2])},tv=ch_table[i][1]}
else
adp.add{__type=2,iv={src=图标(ch_table[i][2])},tv=ch_table[i][1]}
end
end
end
ch_light("主页")
page_home.setVisibility(View.VISIBLE)
page_tool.setVisibility(View.GONE)
drawer_lv.setOnItemClickListener(AdapterView.OnItemClickListener{
onItemClick=function(id,v,zero,one)--侧滑
_drawer.closeDrawer(Gravity.LEFT)
local s=v.Tag.tv.Text
if s=="退出" then
关闭页面()
elseif s=="主页" then
ch_light("主页")
page_home.setVisibility(View.VISIBLE)
page_tool.setVisibility(View.GONE)
page_source.setVisibility(View.GONE)
page_home_p.showPage(0)
_title.Text="MLua手册"
elseif s=="工具" then
ch_light("工具")
page_home.setVisibility(View.GONE)
page_tool.setVisibility(View.VISIBLE)
page_source.setVisibility(View.GONE)
_title.Text="工具"
elseif s=="源码" then
ch_light("源码")
page_source.setVisibility(View.VISIBLE)
page_home.setVisibility(View.GONE)
page_tool.setVisibility(View.GONE)
_title.Text="源码"
elseif s=="分享" then
local intent=Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "分享MLua手册");
intent.putExtra(Intent.EXTRA_TEXT, "MLua手册\n这是一个全新的lua手册\n--\nhttps://www.coolapk.com/apk/com.muk.luahb");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(Intent.createChooser(intent,"分享到:"));
elseif s=="关于" then
activity.newActivity("mlua/about")
elseif s=="设置" then
activity.newActivity("mlua/settings")
elseif s=="捐赠muk" then
activity.newActivity("mlua/web",{"https://www.mukapp.top/pay/"})
else
Snakebar(s)
end
end})
--主页pageview
page_home_p.setOnPageChangeListener(PageView.OnPageChangeListener{
onPageScrolled=function(a,b,c)
end,
onPageSelected=function(v)
local x=primaryc
local c=stextc
local c1=c
local c2=c
local c3=c
local c4=c
if v==0 then
c1=x
showD(page1)
closeD(page2)
closeD(page3)
closeD(page4)
end
if v==1 then
c2=x
showD(page2)
closeD(page1)
closeD(page3)
closeD(page4)
end
if v==2 then
c3=x
showD(page3)
closeD(page1)
closeD(page2)
closeD(page4)
end
if v==3 then
c4=x
showD(page4)
closeD(page1)
closeD(page2)
closeD(page3)
end
page1.getChildAt(0).setColorFilter(转0x(c1))
page2.getChildAt(0).setColorFilter(转0x(c2))
page3.getChildAt(0).setColorFilter(转0x(c3))
page4.getChildAt(0).setColorFilter(转0x(c4))
page1.getChildAt(1).setTextColor(转0x(c1))
page2.getChildAt(1).setTextColor(转0x(c2))
page3.getChildAt(1).setTextColor(转0x(c3))
page4.getChildAt(1).setTextColor(转0x(c4))
end
})
--工具
local tool_list_item={
LinearLayout;
layout_width="-1";
layout_height="-2";
{
CardView;
CardElevation="0dp";
CardBackgroundColor=cardbackc;
Radius="8dp";
layout_width="-1";
layout_height="48dp";
layout_margin="8dp";
{
LinearLayout;
layout_width="-1";
layout_height="-1";
gravity="center";
{
TextView;
id="tladp_text";
textColor=textc;
textSize="14sp";
gravity="center";
Typeface=字体("product");
};
{
TextView;
id="tladp_activity";
layout_width="0";
layout_height="0";
};
};
};
};
tladp=LuaAdapter(activity,tool_list_item)
tool_list.setAdapter(tladp)--工具
tladp.add{tladp_text="MD配色参考",tladp_activity="tools-mdcolor"}
tladp.add{tladp_text="渐变颜色参考",tladp_activity="tools-gcc"}
tladp.add{tladp_text="颜色选择器",tladp_activity="tools-palette"}
tladp.add{tladp_text="get/post调试",tladp_activity="tools-http"}
tladp.add{tladp_text="Jar转Dex",tladp_activity="tools-jartodex"}
tladp.add{tladp_text="代码调试",tladp_activity="view-code"}
tool_list.setOnItemClickListener(AdapterView.OnItemClickListener{
onItemClick=function(parent, v, pos,id)
local s=v.Tag.tladp_activity.Text
if s=="NO" then
local s=v.Tag.tladp_text.Text
return true
end
跳转页面("mlua/"..s)
end
})
listalpha=AlphaAnimation(0,1)
listalpha.setDuration(256)
controller=LayoutAnimationController(listalpha)
controller.setDelay(0.4)
controller.setOrder(LayoutAnimationController.ORDER_NORMAL)
tool_list.setLayoutAnimation(controller)
drawer_lv.setLayoutAnimation(controller)
page_home.setLayoutAnimation(controller)
homelist.setLayoutAnimation(controller)
--PopupWindow
local Popup_layout={
LinearLayout;
{
CardView;
CardElevation="6dp";
CardBackgroundColor=backgroundc;
Radius="8dp";
layout_width="-1";
layout_height="-2";
layout_margin="8dp";
{
GridView;
layout_height="-1";
layout_width="-1";
NumColumns=1;
id="Popup_list";
};
};
};
pop=PopupWindow(activity)
pop.setContentView(loadlayout(Popup_layout))
pop.setWidth(dp2px(192))
pop.setHeight(-2)
pop.setOutsideTouchable(true)
pop.setBackgroundDrawable(ColorDrawable(0x00000000))
pop.onDismiss=function()
end
Popup_list_item={
LinearLayout;
layout_width="-1";
layout_height="48dp";
{
TextView;
id="popadp_text";
textColor=textc;
layout_width="-1";
layout_height="-1";
textSize="14sp";
gravity="left|center";
paddingLeft="16dp";
Typeface=字体("product");
};
};
popadp=LuaAdapter(activity,Popup_list_item)
Popup_list.setAdapter(popadp)
popadp.add{popadp_text="搜索",}
Popup_list.setOnItemClickListener(AdapterView.OnItemClickListener{
onItemClick=function(parent, v, pos,id)
pop.dismiss()
local s=v.Tag.popadp_text.Text
if s=="搜索" then
跳转页面("mlua/search")
end
end
})
jc.setOnPageChangeListener(PageView.OnPageChangeListener{
onPageScrolled=function(a,b,c)
local w=activity.getWidth()/2
local wd=c/2
if a==0 then
page_scroll.setX(wd)
end
if a==1 then
page_scroll.setX(wd+w)
end
end,
onPageSelected=function(v)
local x=primaryc
local c=stextc
local c1=c
local c2=c
if v==0 then
c1=x
end
if v==1 then
c2=x
end
jc1.getChildAt(0).setTextColor(转0x(c1))
jc2.getChildAt(0).setTextColor(转0x(c2))
end
})
homeitem={
{
LinearLayout;
layout_width="-1";
layout_height="-2";
orientation="vertical";
onClick=function()end;
{
CardView;
CardElevation="0dp";
CardBackgroundColor=cardbackc;
Radius="8dp";
layout_width="-1";
layout_height="-2";
layout_margin="16dp";
layout_marginTop="8dp";
layout_marginBottom="8dp";
{
LinearLayout;
layout_width="-1";
layout_height="-1";
orientation="vertical";
padding="16dp";
{
TextView;
id="title";
textColor=primaryc;
textSize="16sp";
gravity="center|left";
Typeface=字体("product-Bold");
};
{
TextView;
id="content";
textColor=textc;
textSize="14sp";
gravity="center|left";
--Typeface=字体("product");
layout_marginTop="12dp";
};
};
};
};
{
LinearLayout;
layout_width="-1";
layout_height="-2";
orientation="vertical";
onClick=function()end;
{
TextView;
textColor=primaryc;
textSize="14sp";
gravity="center|left";
Typeface=字体("product-Bold");
layout_margin="16dp";
layout_marginBottom="8dp";
id="title";
};
};
{
LinearLayout;
layout_width="-1";
layout_height="-2";
orientation="vertical";
onClick=function()end;
{
CardView;
CardElevation="0dp";
CardBackgroundColor="#10000000";
Radius="8dp";
layout_width="-1";
layout_height=(activity.Width-dp2px(32))/520*150;
layout_margin="16dp";
layout_marginTop="8dp";
layout_marginBottom="8dp";
{
ImageView;
scaleType="centerCrop";
layout_width="-1";
layout_height="-1";
colorFilter=viewshaderc;
id="pic";
};
{
TextView;
id="content";
layout_width="-1";
layout_height="-1";
textColor="#00000000";
onClick=function(v)跳转页面("mlua/web",{v.Text})end;
};
};
};
{
LinearLayout;
layout_width="-1";
layout_height="-2";
orientation="vertical";
onClick=function()end;
{
CardView;
CardElevation="0dp";
CardBackgroundColor=cardbackc;
Radius="8dp";
layout_width="-1";
layout_height="110dp";
layout_margin="16dp";
layout_marginTop="8dp";
layout_marginBottom="8dp";
{
LinearLayout;
layout_width="-1";
layout_height="-1";
{
ImageView;
id="pic";
scaleType="centerCrop";
layout_width=dp2px(110)/280*440;
layout_height="-1";
colorFilter=viewshaderc;
};
{
TextView;
id="content";
textColor=textc;
textSize="16sp";
gravity="center|left";
Typeface=字体("product-Bold");
layout_margin="16dp";
--layout_marginBottom="8dp";
layout_height="-1";
layout_width="-1";
layout_weight="1";
};
};
{
TextView;
id="link";
layout_width="-1";
layout_height="-1";
textColor="#00000000";
onClick=function(v)跳转页面("mlua/web",{v.Text})end;
};
};
};
{
LinearLayout;
layout_width="-1";
layout_height="-2";
orientation="vertical";
onClick=function()end;
{
CardView;
CardElevation="0dp";
CardBackgroundColor=cardbackc;
Radius="8dp";
layout_width="-1";
layout_height="-2";
layout_margin="16dp";
layout_marginTop="8dp";
layout_marginBottom="8dp";
{
TextView;
id="title";
textColor=textc;
textSize="16sp";
gravity="center|left";
Typeface=字体("product");
layout_width="-1";
layout_height="-1";
padding="16dp";
};
};
};
{
LinearLayout;
layout_width="-1";
layout_height="-2";
orientation="vertical";
paddingLeft="8dp";
paddingRight="8dp";
onClick=function()end;
{
NoScrollGridView;
id="favorite";
layout_height="-2";
layout_width="-1";
--DividerHeight=0;
NumColumns=2;
--layout_marginTop="8dp";
};
};
}
homeadp=LuaMultiAdapter(activity,homeitem)
homelist.setAdapter(homeadp)--侧滑
function 获取公告()
获取信息("notice",function(content)
swipe1.setRefreshing(false)
homeadp=LuaMultiAdapter(activity,homeitem)
homelist.setAdapter(homeadp)--侧滑
if content=="error" then
homeadp.add{__type=1,title={text="远程公告获取失败"},content="请确认网络是否有问题,如果网络无问题请下拉刷新或者等待。"}
return true
end
local content=content:gsub("<br>","")
for v in content:gmatch("{(.-)}") do
if 全局主题值=="Day" then
bwz=0x3f000000
else
bwz=0x3fffffff
end
if v=="公告" then
homeadp.add{__type=2,title="公告"}
homeadp.add{__type=1,title={text="欢迎使用"},content="欢迎向我反馈特性(bug)或者为该软件的开发提供建议。\nMUK QQ:1773798610"}
--return true
else
if v:match("==#(.-)")==nil then
if v:match("<(.-)?>")=="tit-s" then
homeadp.add{__type=2,title=v:match(">(.+)")}
elseif v:match("<(.-)?>")=="big-text-yiyan" then
homeadp.add{__type=5,title={
text=v:match(">(.+)"),
BackgroundDrawable=activity.Resources.getDrawable(ripples).setColor(ColorStateList(int[0].class{int{}},int{bwz}));
onClick=function(v)
--activity.newActivity("edit-home")
复制文本(v.text)
提示("已复制")
end;
}}
elseif v:match("<(.-)?>")=="big-text" then
homeadp.add{__type=5,title={
text=v:match(">(.+)"),
BackgroundDrawable=nil;
onClick=nil;
}}
elseif v:match("(.+) | "):match("<(.-)?>")=="pic-c" then
homeadp.add{__type=3,pic={src=v:match(">(.-) | ")},content={
text=v:match(" | (.+)"),
BackgroundDrawable=activity.Resources.getDrawable(ripples).setColor(ColorStateList(int[0].class{int{}},int{bwz}))
}}
elseif v:match("(.+) | "):match("<(.-)?>")=="pic-tex-c" then
local imgurl,url,dtext=v:match(">(.-) | (.-) | (.+)")
homeadp.add{__type=4,pic={src=imgurl},content={
text=dtext,
},link={
text=url,
BackgroundDrawable=activity.Resources.getDrawable(ripples).setColor(ColorStateList(int[0].class{int{}},int{bwz}))
}}
else
homeadp.add{__type=1,title=v:match("(.+) | "),content=v:match(" | (.+)")}
end
end
end
end
end)
end
获取公告()
dmitem={
LinearLayout;
layout_width="-1";
layout_height="-2";
orientation="vertical";
{
CardView;
CardElevation="0dp";
CardBackgroundColor=cardbackc;
Radius="8dp";
layout_width="-1";
layout_height="-2";
layout_margin="16dp";
layout_marginTop="8dp";
layout_marginBottom="8dp";
{
LinearLayout;
layout_width="-1";
layout_height="-1";
orientation="vertical";
padding="16dp";
{
TextView;
textColor=textc;
textSize="16sp";
gravity="center|left";
Typeface=字体("product");
id="_title";
};
{
TextView;
--textColor=stextc;
--textSize="12sp";
--gravity="center|left";
--Typeface=字体("product");
--layout_marginTop="12dp";
id="_text";
--maxLines=3;
layout_width="0";
layout_height="0";
};
};
};
};
dmdata={}
dmadp=LuaAdapter(activity,dmdata,dmitem)
dmlist.setAdapter(dmadp)
function 获取代码()
获取信息("code",function(content)
swipe2.setRefreshing(false)
if content=="error" then
--Snakebar("获取失败")
Snakebar("代码获取失败,请确认网络是否有问题,如果网络无问题请下拉刷新或者等待。")
if activity.getSharedData("code")~=nil then
dmdata={}
dmadp=LuaAdapter(activity,dmdata,dmitem)
dmlist.setAdapter(dmadp)
local content=activity.getSharedData("code"):gsub("<br>","")
for v in content:gmatch("@{(.-)}@") do
if v:match("==#(.-)")==nil then
dmdata[#dmdata+1]={_title=v:match("(.+){@!"),_text=v:match("{@!\n(.+)")}
end
end
dmadp.notifyDataSetChanged()
end
return true
end
activity.setSharedData("code",content)
dmdata={}
dmadp=LuaAdapter(activity,dmdata,dmitem)
dmlist.setAdapter(dmadp)
local content=content:gsub("<br>","")
for v in content:gmatch("@{(.-)}@") do
if v:match("==#(.-)")==nil then
dmdata[#dmdata+1]={_title=v:match("(.+){@!"),_text=v:match("{@!\n(.+)")}
end
end
dmadp.notifyDataSetChanged()
end)
end
获取代码()
dmlist.setOnItemClickListener(AdapterView.OnItemClickListener{
onItemClick=function(id,v,zero,one)
local s=v.Tag._text.Text
跳转页面("mlua/view-code",{v.Tag._title.Text,v.Tag._text.Text})
end})
jcdata={}
jcadp=LuaAdapter(activity,jcdata,dmitem)
jclist.setAdapter(jcadp)
function 获取教程()
获取信息("tutorial",function(content)
swipe3.setRefreshing(false)
if content=="error" then
--Snakebar("获取失败")
Snakebar("文字教程获取失败,请确认网络是否有问题,如果网络无问题请下拉刷新或者等待。")
if activity.getSharedData("tutorial")~=nil then
jcdata={}
jcadp=LuaAdapter(activity,jcdata,dmitem)
jclist.setAdapter(jcadp)
local content=activity.getSharedData("tutorial"):gsub("<br>","")
for v in content:gmatch("@{(.-)}@") do
if v:match("==#(.-)")==nil then
jcdata[#jcdata+1]={_title=v:match("(.+){@!"),_text=v:match("{@!\n(.+)")}
end
end
jcadp.notifyDataSetChanged()
end
return true
end
activity.setSharedData("tutorial",content)
jcdata={}
jcadp=LuaAdapter(activity,jcdata,dmitem)
jclist.setAdapter(jcadp)
local content=content:gsub("<br>","")
for v in content:gmatch("@{(.-)}@") do
if v:match("==#(.-)")==nil then
jcdata[#jcdata+1]={_title=v:match("(.+){@!"),_text=v:match("{@!\n(.+)")}
end
end
jcadp.notifyDataSetChanged()
end)
end
获取教程()
jclist.setOnItemClickListener(AdapterView.OnItemClickListener{
onItemClick=function(id,v,zero,one)
跳转页面("mlua/view-tutorial",{v.Tag._title.Text,one,jcdata})
end})
spdata={}
spadp=LuaAdapter(activity,spdata,dmitem)
spjc.setAdapter(spadp)
function 获取视频教程()
获取信息("video",function(content)
swipe4.setRefreshing(false)
if content=="error" then
--Snakebar("获取失败")
Snakebar("视频教程获取失败,请确认网络是否有问题,如果网络无问题请下拉刷新或者等待。")
if activity.getSharedData("video")~=nil then
spdata={}
spadp=LuaAdapter(activity,spdata,dmitem)
spjc.setAdapter(spadp)
local content=activity.getSharedData("video"):gsub("<br>","")
for v in content:gmatch("{(.-)}") do
if v:match("==#(.-)")==nil then
spdata[#spdata+1]={_title=v:match("(.+) | "),_text=v:match(" | (.+)")}
end
end
spadp.notifyDataSetChanged()
end
return true
end
activity.setSharedData("video",content)
spdata={}
spadp=LuaAdapter(activity,spdata,dmitem)
spjc.setAdapter(spadp)
local content=content:gsub("<br>","")
for v in content:gmatch("{(.-)}") do
if v:match("==#(.-)")==nil then
spdata[#spdata+1]={_title=v:match("(.+) | "),_text=v:match(" | (.+)")}
end
end
spadp.notifyDataSetChanged()
end)
end
获取视频教程()
spjc.setOnItemClickListener(AdapterView.OnItemClickListener{
onItemClick=function(id,v,zero,one)
跳转页面("mlua/video-play",{v.Tag._text.Text})
--跳转页面("mediaplayer",{v.Tag._text.Text,1,"Title"})
end})
swipe1.setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener{onRefresh=function()
获取公告()
获取代码()
获取教程()
获取视频教程()
end})
swipe2.setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener{onRefresh=function()
获取代码()
end})
swipe3.setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener{onRefresh=function()
获取教程()
end})
swipe4.setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener{onRefresh=function()
获取视频教程()
end})
检查更新()
if isShortcut then
loadstring(activityContent)()
end
newnote.setOnTouchListener({
onTouch=function(v,n)
if tostring(n):find("ACTION_DOWN") then
ObjectAnimator.ofFloat(xf1, "translationZ", {xf1.translationZ, dp2px(8)})
.setDuration(128)--设置动画时间
.setInterpolator(DecelerateInterpolator())--设置动画插入器,减速
.start()
elseif tostring(n):find("ACTION_UP") then
ObjectAnimator.ofFloat(xf1, "translationZ", {xf1.translationZ, dp2px(4)})
.setDuration(128)--设置动画时间
.setInterpolator(AccelerateInterpolator())--设置动画插入器,减速
.start()
end
end})
function 新建笔记()
activity.newActivity("mlua/new-note")
end
noteitem={
LinearLayout;
layout_width="-1";
layout_height="-2";
orientation="vertical";
{
CardView;
CardElevation="0dp";
CardBackgroundColor=cardbackc;
Radius="8dp";
layout_width="-1";
layout_height="-2";
layout_margin="16dp";
layout_marginTop="8dp";
layout_marginBottom="8dp";
{
LinearLayout;
layout_width="-1";
layout_height="-1";
orientation="vertical";
padding="16dp";
{
TextView;
textColor=textc;
textSize="16sp";
gravity="center|left";
Typeface=字体("product");
id="title";
};
{
TextView;
--textColor=stextc;
--textSize="12sp";
--gravity="center|left";
--Typeface=字体("product");
--layout_marginTop="12dp";
id="text";
--maxLines=3;
layout_width="0";
layout_height="0";
};
{
TextView;
textColor=stextc;
textSize="12sp";
gravity="center|left";
Typeface=字体("product");
layout_marginTop="12dp";
id="time";
};
};
};
};
notedata={}
noteadp=LuaAdapter(activity,notedata,noteitem)
notelist.setAdapter(noteadp)
function 加载笔记()
notedata={}
for i,v in ipairs(luajava.astable(File(内置存储文件("Note")).listFiles())) do
local v=tostring(v)
local _,name=v:match("(.+)/(.+)")
notedata[#notedata+1]={title=name,text=(v),time=获取文件修改时间(v)}
end
noteadp=LuaAdapter(activity,notedata,noteitem)
notelist.setAdapter(noteadp)
if notelist.getCount()==0 then
创建文件(内置存储文件("Note/创建你的第一条笔记"))
写入文件(内置存储文件("Note/创建你的第一条笔记"),[[笔记在退出时会自动保存
隔一段时间也会自动保存
"全部笔记"页面可以添加/删除/重命名笔记
]])
加载笔记()
end
end
加载笔记()
notelist.setOnItemClickListener(AdapterView.OnItemClickListener{
onItemClick=function(id,v,zero,one)
跳转页面("mlua/edit-note",{v.Tag.text.Text})
end})
notelist.setOnItemLongClickListener(AdapterView.OnItemLongClickListener{
onItemLongClick=function(id,v,zero,one)
local _,name=v.Tag.text.Text:match("(.+)/(.+)")
三按钮对话框(name,"请选择操作","重命名","删除","取消",function()
跳转页面("mlua/new-note",{v.Tag.text.Text})
关闭对话框()
end,function()
关闭对话框()
双按钮对话框("确认要删除笔记 "..name.." 吗?","此操作不可撤销","确认删除","取消",function()
删除文件(v.Tag.text.Text)
加载笔记()
关闭对话框()
end,function()关闭对话框()end)
end,function()关闭对话框()end)
return true
end})
分屏()
local debug_time_create=os.clock()-debug_time_create_n
if mukactivity.getData("Setting_Activity_LoadTime")=="true" then
print(debug_time_create)
end
web.removeView(web.getChildAt(0))
function 加载动画(n)
jztitle.Text=n
控件可见(jzdh)
end
function 设置值(anm)
import "android.graphics.Paint$Align"
import "android.graphics.Paint$FontMetrics"
local myLuaDrawable=LuaDrawable(function(mCanvas,mPaint,mDrawable)
--获取控件宽和高的最小值
local r=math.min(mDrawable.getBounds().right,mDrawable.getBounds().bottom)
--画笔属性
mPaint.setColor(转0x(primaryc))
mPaint.setAntiAlias(true)
mPaint.setStrokeWidth(r/8)
mPaint.setStyle(Paint.Style.STROKE)
--mPaint.setStrokeCap(Paint.Cap.ROUND)
local mPaint2=Paint()
mPaint2.setColor(转0x(primaryc))
mPaint2.setAntiAlias(true)
mPaint2.setStrokeWidth(r/2)
mPaint2.setStyle(Paint.Style.FILL)
mPaint2.setTextAlign(Paint.Align.CENTER)
mPaint2.setTextSize(sp2px(14))
--圆弧绘制坐标范围:左上坐标,右下坐标
return function(mCanvas)
local n=anm*360/100
local fontMetrics = mPaint2.getFontMetrics();
local top = fontMetrics.top;--为基线到字体上边框的距离,即上图中的top
local bottom = fontMetrics.bottom;--为基线到字体下边框的距离,即上图中的bottom
local baseLineY =r/2 - top/2 - bottom/2
if anm==100 then
mCanvas.drawText("完成",r/2,baseLineY,mPaint2);
else
mCanvas.drawText(tostring(anm),r/2,baseLineY,mPaint2);
end
mCanvas.drawArc(RectF(r/8/2,r/8/2,r-r/8/2,r-r/8/2),-90,n,false,mPaint)
--mDrawable.invalidateSelf()
end
end)
--绘制的Drawble设置成控件背景
spb.background=myLuaDrawable
end
import "com.lua.*"
静态渐变(转0x(primaryc)-转0x("#9f000000"),转0x(primaryc),webprogress,"横")
web.setWebChromeClient(LuaWebChrome(LuaWebChrome.IWebChrine{
onProgressChanged=function(view, newProgress)
设置值(newProgress)
local lpm=webprogress.getLayoutParams()
lpm.width=newProgress*(activity.Width/100)
webprogress.setLayoutParams(lpm)
end,
}));
web.setWebViewClient{
shouldOverrideUrlLoading=function(view,url)
if url:match("lanzous.com/(.+)")~="b00z6jhmf" then
--activity.newActivity("source",{url:gsub("lanzous.com","lanzous.com/tp")})
Http.get(url:gsub("lanzous.com","lanzous.com/tp"),function(code,content)
提示("正在下载")
local c,a,b=content:match([[<div class="md">(.-) ?<.-dpost ?= ?'https://(.-)'.-sgo ?= ?'(.-)']])
local link="https://"..a..b
--activity.newActivity("source",{link})
Http.download(link,MUKAPP文件("Download/"..c),function(code,content)
if code==200 then
提示("下载完成")
xpcall(function()
重命名文件(content,content:gsub("%.zip$",".alp"))
content=content:gsub("%.zip$",".alp")
intent = Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.setAction(Intent.ACTION_VIEW)
intent.setData(Uri.fromFile(File(content)))
activity.startActivity(Intent.createChooser(intent, "请选择导入到的编辑器"))
end,function()
提示("拉起应用失败,请手动导入")
end)
else
提示("下载失败 "..code)
end
end)
end)
return true
end
end,
onPageStarted=function(view,url,favicon)
控件可见(webprogress)
控件可见(jzdh)
swipe5.setRefreshing(true)
end,
onPageFinished=function(view,url)
控件隐藏(webprogress)
控件隐藏(jzdh)
swipe5.setRefreshing(false)
v=[[
document.querySelector('.top').style.display="none";
document.querySelector('.d1').style.display="none";
document.querySelector('.d11').style.display="none";
document.querySelector('.d7').style.display="none";
document.querySelector('.d12').style.display="none";
document.querySelector('.pc').style.display="none";
document.querySelector('.bgimg').style.display="none";
document.querySelector('.teta').style.display="none";
document.querySelector('.tetb').style.display="none";
document.querySelector('.tet').innerHTML="Lua交流群 686976850<br>部分源码因为年代久远或使用第三方编辑器而不能被androlua+使用<br>部分源码有多个版本,请查看名称后面的日期<br>由于androlua+的工程都很小,所以您点击文件名后会自动下载工程,下载目录:]]..MUKAPP文件("Download/")..[[<br>下载完成后会自动更改后缀为alp,并且会提醒您导入工程";
document.getElementsByTagName('body')[0].style.background=']]..backgroundc..[[';
document.querySelector('.tet').style.color=']]..textc..[[';
]]
web.loadUrl([[
javascript:(function()
{ ]]..v..[[ })()
]]);
end
}
web.setDownloadListener{
onDownloadStart=function(url, userAgent, contentDisposition, mimetype, contentLength)
return true
end
};
web.getSettings().setSupportZoom(false);
web.getSettings().setBuiltInZoomControls(false);
web.getSettings().setDefaultFontSize(14);
web.getSettings().setDisplayZoomControls(false);
web.getSettings().setUseWideViewPort(true);
web.getSettings().setLoadWithOverviewMode(true);
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
web.getSettings().setAllowFileAccess(true);
web.getSettings().setAppCacheEnabled(true);
web.getSettings().setDomStorageEnabled(true);
web.getSettings().setDatabaseEnabled(true);
web.loadUrl("https://www.lanzous.com/b00z6jhmf")--加载网页
swipe5.setRefreshing(true)
swipe5.setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener{onRefresh=function()
web.reload()
end})
web.setOnScrollChangeListener{
onScrollChange=function( view, i, i1, i2, i3)
if web.getScrollY() == 0 then
swipe5.setEnabled(true);
else
swipe5.setEnabled(false);
end
end
}
end
function onStart()
pcall(function()
加载笔记()
end)
end
function onResult(name,...)
if name=="settings" then
渐变跳转页面("mlua/home")
关闭页面()
end
if name=="web" then
web.reload()
end
if name=="new-note" or name=="edit-note" then
加载笔记()
end
end
mukactivity.setDataR("USE_TIMES",0)
mukactivity.setDataR("USE_STAR",0)
mukactivity.setData("USE_TIMES",mukactivity.getData("USE_TIMES")+1)
if mukactivity.getData("USE_TIMES")>=4 and mukactivity.getData("USE_STAR")==0 then
双按钮对话框("给我评个分吧ʕ•ٹ•ʔ","如果你觉得我很好用,请在酷安上给我好评!(ㆁωㆁ*)","五星好评!","拒绝并不再提示",function()
关闭对话框(an)
viewIntent = Intent("android.intent.action.VIEW",Uri.parse("https://www.coolapk.com/apk/com.muk.luahb"))
activity.startActivity(viewIntent)
mukactivity.setData("USE_STAR",1)
提示("谢谢ʕ•̀ω•́ʔ✧")
end,function()
关闭对话框(an)
mukactivity.setData("USE_STAR",1)
end,0)
end
function onConfigurationChanged( newConfig)
分屏()
end
function 分屏()
if activity.Height*0.9<activity.Width then
Activity_Multi=true
local m_ALocation=int{0,0}
mActionBar_top.getLocationOnScreen(m_ALocation)
if m_ALocation[1]>=状态栏高度 then
local linearParams = mActionBar_top.getLayoutParams()
linearParams.height=0
mActionBar_top.setLayoutParams(linearParams)
Activity_Multi_Bottom=true
Activity_mActionBar_top=nil
else
local linearParams = mActionBar_top.getLayoutParams()
linearParams.height=状态栏高度
mActionBar_top.setLayoutParams(linearParams)
Activity_Multi_Bottom=false
Activity_mActionBar_top=true
end
local linearParams = mActionBar.getLayoutParams()
linearParams.height=dp2px(48)
mActionBar.setLayoutParams(linearParams)
local linearParams = mBottomBar.getLayoutParams()
linearParams.height=dp2px(48)
mBottomBar.setLayoutParams(linearParams)
else
Activity_mActionBar_top=true
Activity_Multi_Bottom=nil
Activity_Multi=nil
local linearParams = mActionBar.getLayoutParams()
linearParams.height=dp2px(56)
mActionBar.setLayoutParams(linearParams)
local linearParams = mBottomBar.getLayoutParams()
linearParams.height=dp2px(56)
mBottomBar.setLayoutParams(linearParams)
end
end |
require "libs.utils"
require "libs.taskmgr"
require "libs.sysTime"
require "libs.datastructs"
require "libs.fileActions"
require "libs.folderActions"
require "libs.logging"
require "kernel.settingsmgr"
require "kernel.displaymgr"
require "kernel.eventmgr"
require "kernel.networkmgr"
--PANDORA Meaning
--P lanetary
--A utomated
--N etwork
--D elivery
--O ptimization
--R eal-time
--A nalysis
SysConfig = {
AppName = "PANDORA",
Version = 0.1,
NumGenerator = math.random,
Time = SysTime,
Debug = false,
DebugLogPath = '/src/data/debug.txt',
Display_Manager = nil,
Event_Manager = nil,
Network_Manager = nil,
Power_Manager = nil,
Production_Manager = nil,
Settings_Manager = nil,
Storage_Manager = nil,
System_Status_Manager = nil,
Train_Manager = nil
}
function Initialize()
print(".....Initializing "..SysConfig.AppName.."...........")
print(".....System Configuration Loading...")
--Initialize the System Clock
SysConfig.Time:InitClient()
--Read Settings file here
SysConfig.Settings_Manager = AppModule:RegisterAndInitialize({enabled = true, execute = SettingsManager})
--Register Display Manager
--Init args:
-- Key: Screen designator (screen1 or screen2)
-- Fields:
-- name = Screen Component name
-- width = Screen Render width
-- isMirror = Does screen mirror desktop. If mirror display, the width value will be ignored. It will inherit from the primary display
-- desktop s is currently reserved for a screen driver(will change if large screens are interactable)
SysConfig.Display_Manager = AppModule:RegisterAndInitialize({enabled = true, execute = DisplayManager, refresh_rate = 1.0, initArgs = {["screen1"] = {name = "screen1", width = 220, isMirror = true}} })
--Enable Event Listener
SysConfig.Event_Manager = AppModule:RegisterAndInitialize({enabled = true, execute = EventManager })
--Enable Network Manager
SysConfig.Network_Manager = AppModule:RegisterAndInitialize({enabled = true, execute = NetworkManager})
end
function Program()
Initialize()
Log.Information(SysConfig.AppName.." is Running!")
---------------------------------EXAMPLE CODE FOR FILE COPY/DEPLOY KEEP--------------------------
--Copy the entire drive using /
--tt = Folder:CopyFolderToBuffer("/", {"/.vs"}, true)
--Test Write to debug file
--local str = ''
--for k,v in ipairs(tt) do str = str..string.format("%s\n",v.path) end
--File:Write(SysConfig.DebugLogPath, str, false)
--computer.stop()
--Copies the Buffer to the drive
--Folder:WriteFolderBuffer('/testCopy/',tt)
--computer.stop()
-------------------------------------------------------------------------------------------------
if SysConfig.Debug then
SysConfig.Display_Manager.execute:GetAllScreenDetails()
SysConfig.Event_Manager.execute.Listen()
SysConfig.Display_Manager.execute.Render()
else
--App seems to run with 2 or more tasks, 1 task(spawned) causes massive fps drop and stuttering
--TaskMgr:spawnTimed(30,SysTime.RequestTime())
TaskMgr:spawnTimed(0.3,SysTime.Start)
--TaskMgr:spawn(SysTime.Start)
TaskMgr:spawnTimed(SysConfig.Display_Manager.refresh_interval,SysConfig.Display_Manager.execute.Render)
TaskMgr:spawn(SysConfig.Event_Manager.execute.Listen)
--Run the OS Indefinitely
TaskMgr:run()
end
print(SysConfig.AppName.." Finished. Shutting Down")
Log.Information(SysConfig.AppName.." Finished. Shutting Down")
computer.stop()
end
Program()
--TODO
[[
Screen Mirror() -- Done
DropDown
ListBox
Pagination
Checkbox
Settings Manager - Read/Write and defined settings
Queue System for queuing builds
Deployment - On Floppy for easy startup?
Tab Page Designs
Network_Manager ( all) -- Whitelisting and blacklisting
Inventory Manager
Remote Factory Deployment
Power Plant manager
Transport Manager(Trucks/Trains)
Speaker/Sound Mgr
]] |
-- Created by @project-author@ character is Bearesquishy - dalaran please credit whenever.
-- Source on GitHub: https://n6rej.github.io
local addonName, addonTable, addon = ...
-- Get reference to AdiBags addon
local AdiBags = LibStub("AceAddon-3.0"):GetAddon("AdiBags")
local db = addonTable.db
local MatchIDs
local tooltip
local Result = {}
-- Debug mode switch
local debugMode = false
if debugMode then
--@debug@
--"Version: " .. '@project-version@'
--@end-debug@
end
local function tooltipInit()
local tip, leftside = CreateFrame("GameTooltip"), {}
for i = 1, 6 do
local left, right = tip:CreateFontString(), tip:CreateFontString()
left:SetFontObject(GameFontNormal)
right:SetFontObject(GameFontNormal)
tip:AddFontStrings(left, right)
leftside[i] = left
end
tip.leftside = leftside
return tip
end
-- Check for existing filter
local function CheckFilter(newFilter)
local filterExists = false
for key, value in AdiBags:IterateFilters() do
if value.filterName == newFilter then
filterExists = true
return filterExists
end
end
return filterExists
end
-- Create Filters
local function CreateFilter(name, uiName, uiDesc, title, items)
local filter = AdiBags:RegisterFilter(uiName, 98, "ABEvent-1.0")
-- Register Filter with adibags
filter.uiName = uiName
filter.uiDesc = uiDesc .. " Version: @project-version@"
filter.items = items
function filter:OnInitialize()
-- Assign item table to filter
self.items = filter.items
end
function filter:Update()
self:SendMessage("AdiBags_FiltersChanged")
end
function filter:OnEnable()
AdiBags:UpdateFilters()
end
function filter:OnDisable()
AdiBags:UpdateFilters()
end
function filter:Filter(slotData)
if self.items[tonumber(slotData.itemId)] then
return title
end
tooltip = tooltip or tooltipInit()
tooltip:SetOwner(UIParent, "ANCHOR_NONE")
tooltip:ClearLines()
if slotData.bag == BANK_CONTAINER then
tooltip:SetInventoryItem("player", BankButtonIDToInvSlotID(slotData.slot, nil))
else
tooltip:SetBagItem(slotData.bag, slotData.slot)
end
tooltip:Hide()
end
end
-- Run filters
local function AllFilters(db)
for name, group in pairs(db.Filters) do
-- Does filter already exist?
local filterExists = CheckFilter(group.uiName)
if not filterExists == nil or filterExists == false then
-- name = Name of table
-- group.uiName = Name to use in filter listing
-- group.uiDesc = Description to show in filter listing
-- group.items = table of items to sort
CreateFilter(name, group.uiName, group.uiDesc, group.title, group.items)
end
end
end
-- Start here
AllFilters(db)
|
object_tangible_item_entertainer_console_stage_fog_machine = object_tangible_item_entertainer_console_shared_stage_fog_machine:new {
}
ObjectTemplates:addTemplate(object_tangible_item_entertainer_console_stage_fog_machine, "object/tangible/item/entertainer_console/stage_fog_machine.iff")
|
-- A Multibow keyboard layout for the Kdenlive (https://kdenlive.org/) open
-- source non-linear video editor.
--[[
Copyright 2019 Harald Albrecht
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.
]]--
-- allow users to set their own configuration before req'ing this
-- module, in order to control the key layout. For defaults, please see
-- below.
local k = _G.kdenlive or {} -- module
local mb = require("snippets/multibow")
-- luacheck: ignore 614
--[[
The Keybow layout is as follows when in landscape orientation, with the USB
cable going off "northwards":
┋┋
┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐
┊ 11 ┊ ┊ 8 ┊ ┊ 5 ┊ ┊ 2 ┊
└╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘
┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐
┊ 10 ┊ ┊ 7 ┊ ┊ 4 ┊ ┊ 1 ┊
└╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘
┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐ ┌╌╌╌╌┐
┊ 9 ┊ ┊ 6 ┊ ┊ 3 ┊ ┊ 0 ┊
└╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘ └╌╌╌╌┘
⍇ ⍈
(⯬) (⯮)
]]--
k.KEY_PLAY_AROUND_MOUSE = k.KEY_PLAY_AROUND_MOUSE or 10
k.KEY_ZONE_BEGIN = k.KEY_ZONE_BEGIN or 7
k.KEY_ZONE_END = k.KEY_ZONE_END or 4
k.KEY_CLIP_BEGIN = k.KEY_CLIP_BEGIN or 6
k.KEY_CLIP_END = k.KEY_CLIP_END or 3
k.KEY_PROJECT_BEGIN = k.KEY_PROJECT_BEGIN or 6
k.KEY_PROJECT_END = k.KEY_PROJECT_END or 3
-- (Default) key colors for unshifted and shifted keys.
k.COLOR_UNSHIFTED = k.COLOR_UNSHIFTED or {r=0, g=1, b=0}
k.COLOR_SHIFTED = k.COLOR_SHIFTED or {r=1, g=0, b=0}
function k.play_around_mouse(...)
mb.tap("p")
mb.tap_times(keybow.LEFT_ARROW, 3, keybow.LEFT_SHIFT)
mb.tap("i")
mb.tap_times(keybow.RIGHT_ARROW, 3, keybow.LEFT_SHIFT)
mb.tap("o")
mb.tap(...)
end
-- Unshift to primary keymap. For simplification, use it with the "anykey"
-- release handlers, see below.
function k.unshift(_)
mb.activate_keymap(k.keymap.name)
end
-- Helps avoiding individual color setting...
function k.init_color(keymap, color)
for keyno, keydef in pairs(keymap) do
if type(keyno) == "number" and keyno >= 0 then
if not keydef.c then
keydef.c = color
end
end
end
return keymap
end
k.keymap = k.init_color({
name="kdenlive",
[k.KEY_ZONE_BEGIN] = {press=function() mb.tap("I") end},
[k.KEY_ZONE_END] = {press=function() mb.tap("O") end},
[k.KEY_CLIP_BEGIN] = {press=function() mb.tap(keybow.HOME) end},
[k.KEY_CLIP_END] = {press=function() mb.tap(keybow.END) end},
[k.KEY_PLAY_AROUND_MOUSE] = {press=function() k.play_around_mouse(keybow.SPACE, keybow.LEFT_CTRL) end},
}, k.COLOR_UNSHIFTED)
k.keymap_shifted = k.init_color({
name="kdenlive-shifted",
secondary=true,
[k.KEY_PROJECT_BEGIN] = {press=function() mb.tap(keybow.HOME, keybow.LEFT_CTRL) end},
[k.KEY_PROJECT_END] = {press=function() mb.tap(keybow.END, keybow.LEFT_CTRL) end},
[k.KEY_PLAY_AROUND_MOUSE] = {press=function() k.play_around_mouse(keybow.SPACE, keybow.LEFT_ALT) end},
[-1] = {release=k.unshift},
}, k.COLOR_SHIFTED)
k.keymap.shift_to = k.keymap_shifted
k.keymap_shifted.shift_to = k.keymap
mb.register_keymap(k.keymap)
mb.register_keymap(k.keymap_shifted)
return k -- module
|
if CLIENT then
local lip_error, eye_error = nil, nil
local _, convarValues = vrmod.AddCallbackedConvar("vrmod_use_sranipal", nil, "0", nil, nil, nil, nil, tobool)
local origMouthMove = nil
local flexSetups = {}
net.Receive( "vrmod_flexsetup", function( len, ply )
local ply = net.ReadEntity()
if not IsValid(ply) then return end
ply.vrmod_flexsetup = {
scale = net.ReadUInt(4),
eye = net.ReadBool(),
lip = net.ReadBool(),
flexes = {},
weights = {},
smoothWeights = {},
}
for i = 1,net.ReadUInt(8) do
ply.vrmod_flexsetup.flexes[#ply.vrmod_flexsetup.flexes+1] = net.ReadUInt(8)
end
if ply.vrmod_flexsetup.lip then
if origMouthMove == nil then
origMouthMove = GAMEMODE.MouthMoveAnimation
GAMEMODE.MouthMoveAnimation = function(...)
local args = {...}
if not args[2].vrmod_flexsetup or args[2].vrmod_flexsetup.lip == false then
origMouthMove(unpack(args))
end
end
end
end
for i = 0, ply:GetFlexNum()-1 do
ply:SetFlexWeight(i,0)
end
flexSetups[ply:SteamID()] = ply.vrmod_flexsetup
hook.Add("UpdateAnimation","vrmod_sranipal",function(ply)
local setup = ply.vrmod_flexsetup
if setup then
for k,v in ipairs(setup.flexes) do
setup.smoothWeights[k] = Lerp(0.4, setup.smoothWeights[k] or 0, (setup.weights[k] or 0) * setup.scale)
ply:SetFlexWeight(v, setup.smoothWeights[k] )
end
end
end)
end)
net.Receive( "vrmod_flexdata", function( len, ply )
local ply = net.ReadEntity()
if not ply.vrmod_flexsetup then return end
if ply.vrmod_flexsetup.eye then
ply:SetEyeTarget(net.ReadVector())
end
for i = 1, #ply.vrmod_flexsetup.flexes do
ply.vrmod_flexsetup.weights[i] = net.ReadUInt(16) / 65535
end
end)
hook.Add("VRMod_Menu","vrmod_n_sranipal",function(frame)
if VRMOD_SRanipalInit == nil then return end
frame.SettingsForm:CheckBox("Enable SRanipal", "vrmod_use_sranipal")
frame.SettingsForm:ControlHelp("For Vive Pro Eye / Vive Facial Tracker")
end)
hook.Add("VRMod_Start","sranipal",function(ply)
if ply ~= LocalPlayer() then
net.Start("vrmod_requestflexsetup")
net.WriteEntity(ply)
net.SendToServer()
return
end
vrmod.RemoveInGameMenuItem( "Flexbinder" )
if not convarValues.vrmod_use_sranipal or VRMOD_SRanipalInit == nil then return end
--
local err1, err2 = VRMOD_SRanipalInit()
eye_error, lip_error = (err1 or eye_error), (err2 or lip_error)
local dataTables = {VRMOD_SRanipalGetLipData(), VRMOD_SRanipalGetEyeData()}
--
local filename = "vrmod/flexbinder/"..string.match(string.sub(ply:GetModel(),1,-5),"[^/]*$")..".txt"
local connections = util.JSONToTable(file.Read(filename) or "[]")
local flexScale = 1
if isnumber(connections[#connections]) then
flexScale = connections[#connections]
connections[#connections] = nil
end
--
local connectedFlexes = {}
local function flexSetup()
connectedFlexes = {}
local addedFlexes = {}
for k,v in ipairs(connections) do
if addedFlexes[v.flex] then continue end
addedFlexes[v.flex] = true
connectedFlexes[#connectedFlexes+1] = v.flex
end
net.Start("vrmod_flexsetup")
net.WriteUInt(flexScale,4)
net.WriteBool(eye_error==0)
net.WriteBool(lip_error==0)
net.WriteUInt(#connectedFlexes,8)
for k,v in ipairs(connectedFlexes) do
net.WriteUInt(v,8)
end
net.SendToServer()
end
flexSetup()
--
if eye_error == 0 or lip_error == 0 then
local weights = {}
hook.Add("Tick","vrmod_flextest",function()
local setup = ply.vrmod_flexsetup
if not g_VR.active or not setup then return end
net.Start("vrmod_flexdata", true)
if eye_error == 0 then
VRMOD_SRanipalGetEyeData()
local leftEyePos, rightEyePos = g_VR.eyePosLeft, g_VR.eyePosRight
local leftEyeDir, rightEyeDir = dataTables[2].gaze_direction, dataTables[3].gaze_direction
local leftEyeDir = LocalToWorld(Vector(leftEyeDir.z, leftEyeDir.x, leftEyeDir.y),Angle(),Vector(),g_VR.view.angles)
local rightEyeDir = LocalToWorld(Vector(rightEyeDir.z, rightEyeDir.x, rightEyeDir.y),Angle(),Vector(),g_VR.view.angles)
local n = rightEyeDir:Cross(leftEyeDir:Cross(rightEyeDir))
local c = leftEyePos + math.abs( (rightEyePos-leftEyePos):Dot(n) / leftEyeDir:Dot(n) ) * leftEyeDir
if c.x == 1/0 or c.x ~= c.x then
c = (dataTables[2].eye_openness > dataTables[3].eye_openness) and leftEyePos+leftEyeDir*100 or rightEyePos+rightEyeDir*100
end
ply:SetEyeTarget(c)
net.WriteVector(c)
end
if lip_error == 0 then
VRMOD_SRanipalGetLipData()
end
for i = 1,#connectedFlexes do
weights[connectedFlexes[i]] = 0
end
for k,v in ipairs(connections) do
weights[v.flex] = weights[v.flex] + dataTables[v.tab][v.key] * v.mul + v.add
end
for k,v in ipairs(connectedFlexes) do
--ply:SetFlexWeight(v, weights[v])
setup.weights[k] = weights[v]
net.WriteUInt(weights[v]*65535, 16)
end
net.SendToServer()
end)
end
--
vrmod.AddInGameMenuItem("Flexbinder", 0, 1, function()
local ang = Angle(0,g_VR.tracking.hmd.ang.yaw-90,45)
local pos, ang = WorldToLocal( g_VR.tracking.hmd.pos + Vector(0,0,-20) + Angle(0,g_VR.tracking.hmd.ang.yaw,0):Forward()*30 + ang:Forward()*1366*-0.02 + ang:Right()*768*-0.02, ang, g_VR.origin, g_VR.originAngle)
VRUtilMenuOpen("flexbinder", 1366, 768, nil, 4, pos, ang, 0.04, true, function()
hook.Remove("PreRender","flexbinder")
end)
local blacklist = {
["gaze_origin_mm"] = true,
["gaze_direction"] = true,
["head_rightleft"] = true,
["head_updown"] = true,
["head_tilt"] = true,
["eyes_updown"] = true,
["eyes_rightleft"] = true,
["body_rightleft"] = true,
["chest_rightleft"] = true,
["head_forwardback"] = true,
["gesture_updown"] = true,
["gesture_rightleft"] = true,
["timestamp"] = true,
}
local inputs, outputs = {}, {}
for i = 1,#dataTables do
for k,v in pairs(dataTables[i]) do
inputs[#inputs+1] = not blacklist[k] and {(i==2 and "left_" or i==3 and "right_" or "")..k,k,i,{}} or nil --displayname, key, datatableindex, connections
end
end
for i = 0,ply:GetFlexNum()-1 do
outputs[#outputs+1] = not blacklist[ply:GetFlexName(i)] and {ply:GetFlexName(i), i, nil, {}} or nil --flexname, flexid, nil, connections
end
for k,v in ipairs(connections) do
local inputIndex, outputIndex = 0,0
for k2,v2 in ipairs(inputs) do
inputIndex = (v2[2] == v.key and v2[3] == v.tab) and k2 or inputIndex
end
for k2,v2 in ipairs(outputs) do
outputIndex = (v2[2] == v.flex) and k2 or outputIndex
end
inputs[inputIndex][4][#inputs[inputIndex][4]+1] = outputIndex
outputs[outputIndex][4][#outputs[outputIndex][4]+1] = inputIndex
end
local draggedItem = 0
local dragStartX, dragStartY = 0, 0
local leftScrollAmount, rightScrollAmount = 0, 0
local mul, add, test = 0, 0, 0
local selectedInput, selectedOutput, selectedConnection = 0, 0, 0
local hoveredInput, hoveredOutput = 0, 0
local fileChanges = false
--
dataTables[#dataTables+1] = {0}
local testConnections = {{key=1,tab=#dataTables,mul=0,add=0,flex=0}}
local origConnections = connections
--
hook.Add("PreRender","flexbinder",function()
local cursorX, cursorY = g_VR.menuCursorX, g_VR.menuCursorY
--handle click press
if g_VR.menuFocus == "flexbinder" and g_VR.changedInputs.boolean_primaryfire == true then
--scrollbars
dragStartX, dragStartY = cursorX, cursorY
if (cursorX > 5 and cursorX < 25) or (cursorX > 1341 and cursorX < 1361) then
draggedItem = cursorX >= 25 and 2 or 1
dragStartY = dragStartY - (draggedItem==1 and leftScrollAmount or rightScrollAmount)
end
--sliders
if cursorX > 460 and cursorX < 460+450 and cursorY > 289 and cursorY < 289+18*3 then
draggedItem = 3+math.floor((cursorY-289)/18)
if draggedItem == 5 then --test
connections = testConnections
testConnections[1].flex = outputs[selectedOutput][2]
flexSetup()
end
end
--select input/output
local prevInput, prevOutput = selectedInput,selectedOutput
if cursorX > 30 and cursorX < 330 and cursorY > 40 and cursorY < 763 then
selectedInput = math.floor((cursorY-40+leftScrollAmount)/18)+1
end
if cursorX > 1036 and cursorX < 1336 and cursorY > 40 and cursorY < 763 then
selectedOutput = math.floor((cursorY-40+rightScrollAmount)/18)+1
end
if (prevInput ~= selectedInput or prevOutput ~= selectedOutput) and selectedInput > 0 and selectedOutput > 0 then
selectedConnection, add, mul = 0, 0, 0
for k,v in ipairs(connections) do
if v.key == inputs[selectedInput][2] and v.tab == inputs[selectedInput][3] and v.flex == outputs[selectedOutput][2] then
selectedConnection = k
add = v.add
mul = v.mul
break
end
end
end
--scale
if ((cursorX > 1000 and cursorX < 1030) or (cursorX > 1121 and cursorX < 1151)) and cursorY > 5 and cursorY < 35 then
flexScale = math.Clamp(flexScale + (cursorX < 1030 and -1 or 1),1,9)
fileChanges = true
flexSetup()
end
--clear
if cursorX > 1156 and cursorX < 1256 and cursorY > 5 and cursorY < 35 then
connections = {}
for k,v in ipairs(inputs) do v[4] = {} end
for k,v in ipairs(outputs) do v[4] = {} end
selectedConnection = 0
fileChanges = true
end
--save
if cursorX > 1261 and cursorX < 1361 and cursorY > 5 and cursorY < 35 then
file.CreateDir("vrmod/flexbinder")
connections[#connections+1] = flexScale
file.Write(filename,util.TableToJSON(connections,true))
connections[#connections] = nil
fileChanges = false
end
--connect/disconnect
if cursorX > 770 and cursorX < 770+190 and cursorY > 347 and cursorY < 347+25 and selectedInput > 0 and selectedOutput > 0 then --todo remove input/output checks
if selectedConnection == 0 then
inputs[selectedInput][4][#inputs[selectedInput][4]+1] = selectedOutput
outputs[selectedOutput][4][#outputs[selectedOutput][4]+1] = selectedInput
connections[#connections+1] = {key = inputs[selectedInput][2], tab = inputs[selectedInput][3], mul = mul, add = add, flex = outputs[selectedOutput][2]}
selectedConnection = #connections
else
for k,v in ipairs(inputs[selectedInput][4]) do
if v == selectedOutput then
table.remove(inputs[selectedInput][4], k)
table.remove(connections,selectedConnection)
selectedConnection, add, mul = 0, 0, 0
break
end
end
for k,v in ipairs(outputs[selectedOutput][4]) do
if v == selectedInput then
table.remove(outputs[selectedOutput][4], k)
break
end
end
end
fileChanges = true
flexSetup()
end
end
--handle click release
if g_VR.changedInputs.boolean_primaryfire == false then
if draggedItem == 5 then
test = 0
connections = origConnections
flexSetup()
end
if selectedConnection > 0 and (draggedItem == 3 or draggedItem == 4) then
connections[selectedConnection].mul = mul
connections[selectedConnection].add = add
fileChanges = true
end
draggedItem = 0
end
--dragging
if draggedItem > 0 then
leftScrollAmount = draggedItem ~= 1 and leftScrollAmount or cursorY-dragStartY
rightScrollAmount = draggedItem ~= 2 and rightScrollAmount or cursorY-dragStartY
local sliderStep = 450/(2/0.05)
mul = draggedItem ~= 3 and mul or math.Clamp(math.floor((cursorX-460+sliderStep/2)/sliderStep)*sliderStep/225-1,-1,1)
add = draggedItem ~= 4 and add or math.Clamp(math.floor((cursorX-460+sliderStep/2)/sliderStep)*sliderStep/225-1,-1,1)
if draggedItem == 5 then
test = math.Clamp((cursorX-460-2)/450,0,1)
testConnections[1].add = test
end
end
--hovering
hoveredInput = 0
if not g_VR.input.boolean_primaryfire and cursorX > 30 and cursorX < 330 and cursorY > 40 and cursorY < 763 then
hoveredInput = math.floor((cursorY-40+leftScrollAmount)/18)+1
hoveredInput = (hoveredInput==selectedInput) and 0 or hoveredInput
end
hoveredOutput = 0
if not g_VR.input.boolean_primaryfire and cursorX > 1036 and cursorX < 1336 and cursorY > 40 and cursorY < 763 then
hoveredOutput = math.floor((cursorY-40+rightScrollAmount)/18)+1
hoveredOutput = (hoveredOutput==selectedOutput) and 0 or hoveredOutput
end
--start rendering
VRUtilMenuRenderStart("flexbinder")
surface.SetFont( "ChatFont" )
surface.SetTextColor( 255, 255, 255 )
--background
surface.SetDrawColor( 0, 0, 0, 230 )
surface.DrawRect( 0, 0, 1366, 768 )
--left scroll panel
local contentHeight = #inputs*18
local panelHeight = 768-45
local maxScrollAmount = contentHeight-panelHeight
leftScrollAmount = math.Clamp(leftScrollAmount,0,maxScrollAmount)
surface.SetDrawColor( 128, 128, 128, 255 )
surface.DrawRect( 5, 40, 20, panelHeight )
surface.SetDrawColor( 64, 64, 64, 255 )
surface.DrawRect( 6, 41 + leftScrollAmount, 18, panelHeight-maxScrollAmount-2 )
local text_x, text_y = 30, 40-leftScrollAmount
if hoveredInput > 0 then
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawOutlinedRect(30,text_y+18*(hoveredInput-1),300,19)
end
if selectedInput > 0 then
surface.SetDrawColor( 0, 255, 0, 255 )
surface.DrawOutlinedRect(30,text_y+18*(selectedInput-1),300,19)
end
for k,v in ipairs(inputs) do
surface.SetTextPos( text_x, text_y )
surface.DrawText( v[1] )
surface.SetTextPos( text_x + 250, text_y )
surface.DrawText( tostring(math.Round(dataTables[v[3]][v[2]],3)) )
text_y = text_y + 18
end
--right scroll panel
local contentHeight = #outputs*18
local maxScrollAmount = contentHeight-panelHeight
rightScrollAmount = math.Clamp(rightScrollAmount,0,maxScrollAmount)
surface.SetDrawColor( 128, 128, 128, 255 )
surface.DrawRect( 1341, 40, 20, panelHeight )
surface.SetDrawColor( 64, 64, 64, 255 )
surface.DrawRect( 1342, 41 + rightScrollAmount, 18, panelHeight-maxScrollAmount-2 )
local text_x, text_y = 1040, 40-rightScrollAmount
if hoveredOutput > 0 then
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawOutlinedRect(1036,text_y+18*(hoveredOutput-1),300,19)
end
if selectedOutput > 0 then
surface.SetDrawColor( 0, 255, 0, 255 )
surface.DrawOutlinedRect(1036,text_y+18*(selectedOutput-1),300,19)
end
for i = 1,#outputs do
surface.SetTextPos( text_x, text_y )
surface.DrawText( outputs[i][1] )
surface.SetTextPos( text_x + 250, text_y )
surface.DrawText( tostring(math.Round(ply:GetFlexWeight(outputs[i][2]),3)) )
text_y = text_y + 18
end
--connecting lines
local input = hoveredInput > 0 and hoveredInput or selectedInput
if input > 0 then
for k,v in ipairs(inputs[input][4]) do
local tmp = (v == selectedOutput and input == selectedInput ) and 0 or 255
surface.SetDrawColor(tmp,255,tmp,255)
surface.DrawLine(330,49-leftScrollAmount+(input-1)*18,1036,49-rightScrollAmount+18*(v-1))
end
end
local output = hoveredOutput > 0 and hoveredOutput or selectedOutput
if output > 0 then
for k,v in ipairs(outputs[output][4]) do
local tmp = (v == selectedInput and output == selectedOutput ) and 0 or 255
surface.SetDrawColor(tmp,255,tmp,255)
surface.DrawLine(330,49-leftScrollAmount+(v-1)*18,1036,49-rightScrollAmount+18*(output-1))
end
end
--edit node
if selectedInput > 0 and selectedOutput > 0 then
surface.SetDrawColor(200,200,200,255)
surface.DrawOutlinedRect(383,284,600,100)
surface.SetDrawColor( 0, 0, 0, 200 )
surface.DrawRect(383,284,600,100)
surface.SetDrawColor( 200, 200, 200, 255 )
--if selectedConnection > 0 then
surface.SetTextPos( 388, 289 )
surface.DrawText( "Multiply" )
surface.SetTextPos( 920, 289 )
surface.DrawText( tostring(math.Round(mul,2)) )
surface.DrawRect(460,295,450,4)
surface.DrawRect(460+((mul+1)/2)*450,290,4,14)
surface.SetTextPos( 388, 289+18 )
surface.DrawText( "Add" )
surface.SetTextPos( 920, 289+18 )
surface.DrawText( tostring(math.Round(add,2)) )
surface.DrawRect(460,295+18,450,4)
surface.DrawRect(460+((add+1)/2)*450,290+18,4,14)
--end
surface.SetTextPos( 388, 289+18*2 )
surface.DrawText( "Test" )
surface.SetTextPos( 920, 289+18*2 )
surface.DrawText( tostring(math.Round(test,2)) )
surface.DrawRect(460,295+18*2,450,4)
surface.DrawRect(460+test/1*450,290+18*2,4,14)
surface.SetTextPos( 780, 350 )
surface.DrawText( "Connect / Disconnect" )
surface.DrawOutlinedRect(770,347,190,25)
end
--top bar
render.OverrideBlend(true,BLEND_ZERO,BLEND_ZERO,BLENDFUNC_ADD, BLEND_ONE, BLEND_ZERO, BLENDFUNC_ADD)
surface.SetDrawColor( 0, 0, 0, 230 )
surface.DrawRect(0,0,1366,40)
surface.DrawRect(0,768-5,1366,5)
render.OverrideBlend(false)
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawOutlinedRect( 1000, 5, 30, 30 )
surface.SetTextPos( 1010, 10 )
surface.DrawText( "- Scale: "..flexScale )
surface.DrawOutlinedRect( 1121, 5, 30, 30 )
surface.SetTextPos( 1130, 10 )
surface.DrawText( "+" )
surface.SetTextPos( 5, 10 )
surface.DrawText( "lip_error: "..tostring(lip_error)..", eye_error: "..tostring(eye_error) )
surface.SetTextPos( 500, 10 )
surface.DrawText( "File: "..filename..(fileChanges and "*" or "") )
surface.DrawOutlinedRect( 1156, 5, 100, 30 )
surface.SetTextPos( 1185, 10 )
surface.DrawText( "Clear" )
surface.DrawOutlinedRect( 1261, 5, 100, 30 )
surface.SetTextPos( 1290, 10 )
surface.DrawText( "Save" )
VRUtilMenuRenderEnd()
end)
hook.Add("VRMod_OpenQuickMenu","flexbinder",function()
hook.Remove("VRMod_OpenQuickMenu","flexbinder")
VRUtilMenuClose("flexbinder")
return false
end)
end)
end)
hook.Add("VRMod_Exit","sranipal",function(ply,steamid)
ply.vrmod_flexsetup = nil
flexSetups[steamid] = nil
local found = false
for k,v in pairs(flexSetups) do
found = found or v.lip
end
if not found then
GAMEMODE.MouthMoveAnimation = origMouthMove or GAMEMODE.MouthMoveAnimation
origMouthMove = nil
end
if table.Count(flexSetups) == 0 then
hook.Remove("UpdateAnimation","vrmod_sranipal")
end
if ply == LocalPlayer() then
hook.Remove("Tick","vrmod_flextest")
end
end)
elseif SERVER then
util.AddNetworkString("vrmod_requestflexsetup")
util.AddNetworkString("vrmod_flexsetup")
util.AddNetworkString("vrmod_flexdata")
local function sendFlexSetup(ply, recipient)
if ply.vrmod_flexsetup == nil then return end
net.Start("vrmod_flexsetup")
net.WriteEntity(ply)
net.WriteUInt( ply.vrmod_flexsetup.scale, 4)
net.WriteBool( ply.vrmod_flexsetup.eye)
net.WriteBool( ply.vrmod_flexsetup.lip)
net.WriteUInt(#ply.vrmod_flexsetup.flexes, 8)
for k,v in ipairs(ply.vrmod_flexsetup.flexes) do
net.WriteUInt(v,8)
end
if recipient then
net.Send(recipient)
else
net.Broadcast()
end
end
vrmod.NetReceiveLimited( "vrmod_requestflexsetup",10,32, function( len, ply )
sendFlexSetup(net.ReadEntity(), ply)
end)
vrmod.NetReceiveLimited( "vrmod_flexsetup",10,1024, function( len, ply )
ply.vrmod_flexsetup = {
scale = net.ReadUInt(4),
eye = net.ReadBool(),
lip = net.ReadBool(),
flexes = {}
}
for i = 1,net.ReadUInt(8) do
ply.vrmod_flexsetup.flexes[#ply.vrmod_flexsetup.flexes+1] = net.ReadUInt(8)
end
for i = 0,ply:GetFlexNum()-1 do
--if we don't do this and set flex weights on client they will look bugged / different in each eye
--this also blocks blinking, and allows setting weights above 1 on client
--and also allows client to set weights at any time without them getting pulled back to zero
ply:SetFlexWeight(i,0)
end
sendFlexSetup(ply, nil)
end)
vrmod.NetReceiveLimited( "vrmod_flexdata",1/engine.TickInterval()+5,1024, function( len, ply )
if not ply.vrmod_flexsetup then return end
net.Start("vrmod_flexdata")
net.WriteEntity(ply)
if ply.vrmod_flexsetup.eye then
net.WriteVector(net.ReadVector())
end
for k,v in ipairs(ply.vrmod_flexsetup.flexes) do
net.WriteUInt( net.ReadUInt(16), 16 )
end
net.SendOmit(ply)
end)
end
|
O = {
auto_close_tree = 0,
auto_complete = true,
colorscheme = 'iceberg',
hidden_files = true,
wrap_lines = false,
number = true,
relative_number = true,
shell = 'bash',
-- @usage pass a table with your desired languages
treesitter = {
ensure_installed = "all",
ignore_install = {"haskell"},
highlight = {enabled = true},
playground = {enabled = true},
rainbow = {enabled = false}
},
database = {save_location = '~/.config/nvcode_db', auto_execute = 1},
python = {
linter = '',
-- @usage can be 'yapf', 'black'
formatter = '',
autoformat = false,
isort = false,
diagnostics = {virtual_text = true, signs = true, underline = true}
},
dart = {sdk_path = '/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot'},
lua = {
-- @usage can be 'lua-format'
formatter = '',
autoformat = false,
diagnostics = {virtual_text = true, signs = true, underline = true}
},
sh = {
-- @usage can be 'shellcheck'
linter = '',
-- @usage can be 'shfmt'
formatter = '',
autoformat = false,
diagnostics = {virtual_text = true, signs = true, underline = true}
},
tsserver = {
-- @usage can be 'eslint'
linter = '',
-- @usage can be 'prettier'
formatter = '',
autoformat = false,
diagnostics = {virtual_text = true, signs = true, underline = true}
},
json = {
-- @usage can be 'prettier'
formatter = '',
autoformat = false,
diagnostics = {virtual_text = true, signs = true, underline = true}
},
tailwindls = {filetypes = {'html', 'css', 'scss', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'}},
clang = {diagnostics = {virtual_text = true, signs = true, underline = true}}
-- css = {formatter = '', autoformat = false, virtual_text = true},
-- json = {formatter = '', autoformat = false, virtual_text = true}
}
DATA_PATH = vim.fn.stdpath('data')
CACHE_PATH = vim.fn.stdpath('cache')
|
-- Based on tilecoding Version3 from https://webdocs.cs.ualberta.ca/~sutton/tiles/tiles3.html
local function tilecoding(opt)
-- Set a random seed for consistent hashing
math.randomseed(65597)
local numTilings = opt.numTilings
local scaleFactor = opt.scaleFactor
local memorySize = opt.memorySize
local stateMins = opt.stateMins or {}
local sizeVal = opt.sizeVal or 2048
local maxLongInteger = 2147483647
local maxLongIntegerBy4 = math.floor(maxLongInteger/4)
local randomTable = {}
-- initialize the table of random numbers for UNH hashing
for i = 1,sizeVal do
-- the range are matching the original python code
randomTable[i] = math.random(0, maxLongIntegerBy4 - 1)
end
local _qstate = {}
local _base = {}
local function hashcoords(coordinates, m)
local increment = 449
local res = 0
for i = 1, #coordinates do
rtIdx = ((coordinates[i] + (i*increment)) % sizeVal) + 1
res = res + randomTable[rtIdx]
end
return res % m
end
local tc = {}
function tc.feature(s)
local floats = {}
assert(#s==#scaleFactor,"Dimension of scaling factor and feature vectors must match!")
for i=1,#s do
if stateMins[i] then
floats[i] = (s[i] + stateMins[i]) / scaleFactor[i]
else
floats[i] = s[i] / scaleFactor[i]
end
end
local F = tc.tiles(memorySize, numTilings, floats)
return F
end
function tc.tiles(memorySize, numTilings, floats)
local coords = {}
local Tiles = {}
local _qstate = {}
local b = 0
for i = 1, #floats do
_qstate[i] = math.floor(floats[i] * numTilings)
end
for tiling = 1,numTilings do -- for each tiling
local tilingX2 = tiling*2
table.insert(coords,tiling)
b = tiling
for q = 1,#_qstate do
table.insert(coords, math.floor((_qstate[q] + b) / numTilings))
b = b + tilingX2
end
table.insert(Tiles, hashcoords(coords, memorySize))
end
return Tiles
end
return tc
end
return tilecoding |
vim.g.calendar_google_calendar = 1
vim.g.calendar_google_task = 1
vim.g.calendar_first_day = "monday"
vim.g.calendar_task = 1
vim.g.calendar_event_start_time = 1
|
local packer = nil
local function init()
if not packer then
vim.api.nvim_command('packadd packer.nvim')
packer = require('packer')
packer.init({
disable_commands = true,
auto_clean = true,
compile_on_sync = true,
})
end
local use = packer.use
packer.reset()
use 'nathom/filetype.nvim'
use 'tpope/vim-sensible'
use {
'LnL7/vim-nix',
ft = 'nix',
}
use 'gpanders/editorconfig.nvim'
use {
'kevinhwang91/nvim-hlslens',
opt = true,
event = 'CmdlineEnter',
}
use {
'kevinhwang91/nvim-bqf',
ft = 'qf',
}
use {
'troydm/zoomwintab.vim',
opt = true,
cmd = 'ZoomWinTabToggle',
setup = function ()
vim.g.zoomwintab_remap = 0
end,
}
use 'simeji/winresizer'
use {
'unblevable/quick-scope',
opt = true,
event = 'CursorMoved',
setup = function ()
vim.g.qs_highlight_on_keys = {'f', 'F', 't', 'T'}
end,
}
use {
'lewis6991/impatient.nvim',
config = [[require'packer.cfg.impatient-nvim']],
}
use {
'goolord/alpha-nvim',
requires = { 'kyazdani42/nvim-web-devicons' },
config = [[require'packer.cfg.alpha-nvim']],
}
use {
'themercorp/themer.lua',
config = [[require'packer.cfg.themer-lua']],
}
use {
'ulwlu/elly.vim',
opt = true,
}
use {
'akinsho/nvim-bufferline.lua',
requires = 'kyazdani42/nvim-web-devicons',
config = [[require'packer.cfg.bufferline-nvim']],
}
use {
'windwp/windline.nvim',
opt = true,
config = [[ require'wlsample.vscode' ]],
}
use {
'nvim-lualine/lualine.nvim',
config = [[require'packer.cfg.lualine-nvim']],
}
use {
'mvllow/modes.nvim',
event = 'InsertEnter',
config = [[require'packer.cfg.modes-nvim']],
setup = function ()
vim.opt.cursorline = true
end
}
use {
'lewis6991/gitsigns.nvim',
requires = 'nvim-lua/plenary.nvim',
config = [[require'packer.cfg.gitsigns-nvim']],
}
use {
'tkmpypy/chowcho.nvim',
opt = true,
cmd = { 'Chowcho' },
config = [[require'packer.cfg.chowcho-nvim']],
}
use {
'gelguy/wilder.nvim',
opt = true,
event = 'CmdlineEnter',
requires = { 'romgrk/fzy-lua-native', after = 'wilder.nvim' },
config = [[require'packer.cfg.wilder-nvim']],
}
use {
'lukas-reineke/indent-blankline.nvim',
setup = function ()
vim.opt.list = true
vim.opt.listchars:append('eol:↴')
end,
config = [[require'packer.cfg.indent-blanklin-nvim']],
}
use {
'kyazdani42/nvim-tree.lua',
cmd = 'NvimTreeToggle',
opt = true,
config = [[require'packer.cfg.nvim-tree']],
}
use {
'ojroques/nvim-bufdel',
opt = true,
cmd = {'BufDel','BufDel!'},
config = [[require'packer.cfg.nvim-bufdel']],
}
use {
'nvim-treesitter/nvim-treesitter',
requires = {
{ 'p00f/nvim-ts-rainbow', after = 'nvim-treesitter' },
{ 'windwp/nvim-ts-autotag', after = 'nvim-treesitter' },
},
config = [[require'packer.cfg.nvim-treesitter']],
}
use {
'romgrk/nvim-treesitter-context',
wants = 'nvim-treesitter',
config = [[require'packer.cfg.nvim-treesitter-context']],
}
use {
'haringsrob/nvim_context_vt',
wants = 'nvim-treesitter',
config = [[require'packer.cfg.nvim_context_vt']],
}
use {
'nvim-telescope/telescope.nvim',
cmd = 'Telescope',
requires = {
{ 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
{ 'nvim-telescope/telescope-live-grep-raw.nvim' },
{ 'nvim-lua/plenary.nvim' },
},
config =[[require'packer.cfg.telescope-nvim']]
}
use {
'phaazon/hop.nvim',
opt = true,
cmd = {'HopChar1', 'HopChar2', 'HopLineAC', 'HopLineBC'},
config = [[require'packer.cfg.hop-nvim']],
}
use {
'hrsh7th/nvim-cmp',
requires = {
{ 'hrsh7th/vim-vsnip' },
{ 'hrsh7th/cmp-buffer', after = 'nvim-cmp' },
{ 'hrsh7th/cmp-nvim-lsp' , after = 'nvim-cmp' },
{ 'hrsh7th/cmp-nvim-lsp-signature-help' , after = 'nvim-cmp' },
{ 'hrsh7th/cmp-calc' , after = 'nvim-cmp' },
{ 'hrsh7th/cmp-path', after = 'nvim-cmp' },
{ 'hrsh7th/cmp-vsnip', after = { 'nvim-cmp', 'vim-vsnip' } },
{ 'ray-x/cmp-treesitter', after = 'nvim-cmp' },
},
event = { 'InsertEnter', 'CmdlineEnter' },
config = [[require'packer.cfg.nvim-cmp']],
}
use {
'abecodes/tabout.nvim',
config = [[require'packer.cfg.tabout-nvim']],
opt = true,
event = 'InsertEnter',
wants = 'nvim-treesitter',
after = 'nvim-cmp',
}
use {
'm-demare/hlargs.nvim',
requires = { 'nvim-treesitter/nvim-treesitter' },
config = [[require('hlargs').setup()]],
}
use {
'windwp/nvim-autopairs',
opt = true,
event = { 'CursorMoved', 'InsertEnter' },
config = [[require'packer.cfg.nvim-autopairs']],
}
use {
'danymat/neogen',
ft = { 'lua', 'python', 'javascript', 'cpp', 'go', 'java', 'rust', 'csharp' },
}
use {
'onsails/lspkind-nvim',
config = [[require'packer.cfg.lspkind']],
}
use {
'sindrets/diffview.nvim',
requires = 'nvim-lua/plenary.nvim',
cmd = { 'DiffviewOpen', 'DiffviewToggleFiles' },
opt = true,
config = [[require'packer.cfg.diffview-nvim']],
}
use {
'ray-x/lsp_signature.nvim',
config = [[require'packer.cfg.lsp_signature-nvim']],
}
use {
-- maintained fork version
'tami5/lspsaga.nvim',
opt = true,
cmd = 'Lspsaga',
config = [[require'packer.cfg.lspsaga-nvim']],
}
use {
'norcalli/nvim-colorizer.lua',
config = [[require 'packer.cfg.nvim-colorizer-lua']],
}
use 'tversteeg/registers.nvim'
use {
'ahmedkhalf/project.nvim',
config = [[require'packer.cfg.project-nvim']],
}
use 'neovim/nvim-lspconfig'
use 'hrsh7th/cmp-nvim-lsp'
use {
'williamboman/nvim-lsp-installer',
requires = {
'nvim-lspconfig',
'hrsh7th/cmp-nvim-lsp',
'RRethy/vim-illuminate'
},
config = [[require'packer.cfg.nvim-lsp-installer']],
}
use {
'stevearc/aerial.nvim',
opt = true,
cmd = { 'AerialToggle' },
}
use {
'edluffy/specs.nvim',
opt = true,
event = 'CursorMoved',
config = [[require'packer.cfg.specs-nvim']],
}
use {
'luukvbaal/stabilize.nvim',
config = [[require'packer.cfg.stabilize-nvim']],
}
use {
'folke/todo-comments.nvim',
requires = 'nvim-lua/plenary.nvim',
cmd = {
'TodoQuickFix',
'TodoLocList',
'TodoTrouble',
'TodoTelescope',
},
opt = true,
config = [[require'packer.cfg.todo-comments-nvim']],
}
use {
'akinsho/toggleterm.nvim',
config = [[require'packer.cfg.toggleterm-nvim']],
}
use {
'folke/trouble.nvim',
opt = true,
cmd = 'TroubleToggle',
requires = 'kyazdani42/nvim-web-devicons',
config = [[require'packer.cfg.trouble-nvim']],
}
use {
'ojroques/vim-oscyank',
opt = true,
cmd = 'OSCYank',
}
use {
't9md/vim-quickhl',
keys = {
'<Plug>(quickhl-manual-this)',
'<Plug>(quickhl-manual-reset)',
},
setup = function()
vim.api.nvim_set_keymap('n', '<Leader>m', '<Plug>(quickhl-manual-this)', { silent = true })
vim.api.nvim_set_keymap('x', '<Leader>m', '<Plug>(quickhl-manual-this)', { silent = true })
vim.api.nvim_set_keymap('n', '<Leader>M', '<Plug>(quickhl-manual-reset)', { silent = true })
vim.api.nvim_set_keymap('x', '<Leader>M', '<Plug>(quickhl-manual-reset)', { silent = true })
end,
}
use {
'mattn/vim-sonictemplate',
cmd = 'Template',
opt = true,
}
use {
'hrsh7th/vim-vsnip' ,
opt = true,
event = 'InsertEnter',
}
use {
'lewis6991/spaceless.nvim',
opt = true,
event = 'InsertEnter',
config = [[require'spaceless'.setup()]],
}
use {
'folke/twilight.nvim',
opt = true,
config = [[require'packer.cfg.twilight-nvim']],
}
use {
'folke/zen-mode.nvim',
wants = 'twilight.nvim',
cmd = 'ZenMode',
opt = true,
config = [[require'packer.cfg.zen-mode-nvim']],
}
use {
'ellisonleao/glow.nvim',
opt = true,
cmd = 'Glow',
setup = function ()
vim.g.glow_border = 'rounded'
end,
}
use {
'rmagatti/goto-preview',
config = [[require'packer.cfg.goto-preview']],
}
use {
'max397574/better-escape.nvim',
config = [[require'packer.cfg.better-escape-nvim']],
}
use {
'folke/which-key.nvim',
wants = 'toggleterm',
config = [[require'packer.cfg.which-key-nvim']],
}
use 'vim-jp/vimdoc-ja'
use {
'jghauser/mkdir.nvim',
opt = true,
event = 'CmdlineEnter',
config = [[require'mkdir']],
}
use {
'CRAG666/code_runner.nvim',
opt = true,
cmd = {
'RunFile',
'RunProject',
},
requires = 'nvim-lua/plenary.nvim',
config = [[require'packer.cfg.code_runner-nvim']],
}
use {
'dstein64/nvim-scrollview',
opt = true,
event = 'WinScrolled',
config = [[require'packer.cfg.nvim-scrollview']],
}
use {
'karb94/neoscroll.nvim',
opt = true,
event = 'WinScrolled',
config = [[require'packer.cfg.neoscroll-nvim']],
}
use {
'nvim-pack/nvim-spectre',
}
use {
'narutoxy/dim.lua',
requires = { 'nvim-treesitter/nvim-treesitter', 'neovim/nvim-lspconfig' },
config = function()
require('dim').setup()
end
}
use {
'delphinus/skkeleton_indicator.nvim',
wants = 'vim-skk/skkeleton',
config = [[require'packer.cfg.skkeleton_indicator-nvim']],
}
-- deno --
use {
'vim-denops/denops.vim',
}
use {
'vim-skk/skkeleton',
wants = 'vim-denops/denops.vim',
config = [[require'packer.cfg.skkeleton-config']],
setup = [[require'packer.cfg.skkeleton-setup']],
}
end
local plugins = setmetatable({}, {
__index = function(_, key)
init()
return packer[key]
end,
})
function plugins.load()
local present, _ = pcall(require, 'packer_compiled')
if not present then
assert('Run PackerCompile')
end
vim.cmd([[command! PackerInstall lua require('packer.plugins').install()]])
vim.cmd([[command! PackerUpdate lua require('packer.plugins').update()]])
vim.cmd([[command! PackerSync lua require('packer.plugins').sync()]])
vim.cmd([[command! PackerClean lua require('packer.plugins').clean()]])
vim.cmd([[command! PackerCompile lua require('packer.plugins').compile()]])
end
return plugins
|
LGlobal_BGMmusid = 0;
LGlobal_BGMStream = NULL;
LGlobal_BGMChannel = NULL;
LGlobal_SEInfos = {};
function LGlobal_LoadBGM(musid, bForce)
if bForce == nil then
bForce = false;
end
if LGlobal_BGMmusid == musid and not bForce then
return;
end
if LGlobal_BGMChannel ~= NULL then
if LGlobal_BGMStream ~= NULL then
game.FreeMusic(LGlobal_BGMStream);
LGlobal_BGMStream = NULL;
end
LGlobal_StopBGM();
LGlobal_BGMStream = NULL;
end
local stream = game.LoadMusic(musid);
LGlobal_BGMStream = stream;
LGlobal_BGMmusid = musid;
return stream;
end
function LGlobal_PlayBGM(bLoop, bForce)
if bForce == nil then
bForce = false;
end
if LGlobal_BGMChannel ~= NULL and bForce then
LGlobal_StopBGM();
end
local channel = LGlobal_BGMChannel;
if channel == NULL then
channel = game.PlayMusic(LGlobal_BGMStream, bLoop);
LGlobal_BGMChannel = channel;
end
LGlobal_SetBGMVol();
return channel;
end
function LGlobal_StopBGM()
game.StopChannel(LGlobal_BGMChannel);
LGlobal_BGMChannel = NULL;
end
function LGlobal_PauseBGM()
game.PauseChannel(LGlobal_BGMChannel);
end
function LGlobal_ResumeBGM()
game.ResumeChannel(LGlobal_BGMChannel);
end
function LGlobal_LoadSE(seid)
local nSE = table.getn(LGlobal_SEInfos);
for i=1, nSE do
if LGlobal_SEInfos[i].seid == seid then
return LGlobal_SEInfos[i].effect;
end
end
local effect = game.LoadSE(seid);
if effect ~= NULL then
LGlobal_SEInfos[nSE+1].seid = seid;
LGlobal_SEInfos[nSE+1].effect = effect;
LGlobal_SEInfos[nSE+1].channel = NULL;
end
return effect;
end
function LGlobal_FreeSE(seid)
local nSE = table.getn(LGlobal_SEInfos);
if seid == nil then
for i=1, nSE do
LGlobal_FreeSE(i);
end
return;
end
for i=1, nSE do
if LGlobal_SEInfos[i].seid == seid then
game.StopChannel(LGlobal_SEInfos[i].channel);
game.FreeSE(LGlobal_SEInfos[i].effect);
for j=i, nSE-1 do
LGlobal_SEInfos[j].seid = LGlobal_SEInfos[j+1].seid;
LGlobal_SEInfos[j].effect = LGlobal_SEInfos[j+1].effect;
LGlobal_SEInfos[j].channel = LGlobal_SEInfos[j+1].channel;
end
LGlobal_SEInfos[nSE] = nil;
end
end
end
function LGlobal_PlaySE(seid)
local nSE = table.getn(LGlobal_SEInfos);
for i=1, nSE do
if LGlobal_SEInfos[i].seid == seid then
game.StopChannel(LGlobal_SEInfos[i].channel);
local channel = game.PlaySE(LGlobal_SEInfos[i].effect);
LGlobal_SEInfos[i].channel = channel;
LGlobal_SetSEVol();
return channel;
end
end
return NULL;
end
function LGlobal_SetBGMVol()
if LGlobal_BGMChannel ~= NULL then
local bgmvol = game.GetBGMSEVol();
game.SetChannelInfo(LGlobal_BGMChannel, bgmvol);
end
end
function LGlobal_SetSEVol()
local nSE = table.getn(LGlobal_SEInfos);
local bgmvol, sevol = game.GetBGMSEVol();
for i=1, nSE do
if LGlobal_SEInfos[i].channel ~= NULL then
game.SetChannelInfo(LGlobal_SEInfos[i].channel, sevol);
end
end
end |
-- NetHack 3.6 medusa.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $
-- Copyright (c) 1989 by Jean-Christophe Collet
-- Copyright (c) 1990, 1991 by M. Stephenson
-- NetHack may be freely redistributed. See license for details.
--
des.level_init({ style = "solidfill", fg = " " });
des.level_flags("noteleport", "mazelevel")
--
-- Here the Medusa rules some slithery monsters from her 'palace', with
-- a yellow dragon nesting in the backyard.
--
des.map([[
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
}}}}}}}}}}}}}}........}}}}}}}}}}}}}}}}}}}}}}}..}}}.....}}}}}}}}}}}----|}}}}}
}}}}}}..----------F-.....}}}}}}}}}}}}}}}}..---...}}}}....T.}}}}}}}....|}}}}}
}}}.....|...F......S}}}}....}}}}}}}...}}.....|}}.}}}}}}}......}}}}|......}}}
}}}.....+...|..{...|}}}}}}}}}}}}.....}}}}|...|}}}}}}}}}}}.}}}}}}}}----.}}}}}
}}......|...|......|}}}}}}}}}......}}}}}}|.......}}}}}}}}}}}}}..}}}}}...}}}}
}}|-+--F|-+--....|F|-|}}}}}....}}}....}}}-----}}.....}}}}}}}......}}}}.}}}}}
}}|...}}|...|....|}}}|}}}}}}}..}}}}}}}}}}}}}}}}}}}}....}}}}}}}}....T.}}}}}}}
}}|...}}F...+....F}}}}}}}..}}}}}}}}}}}}}}...}}}}}}}}}}}}}}}}}}}}}}....}}..}}
}}|...}}|...|....|}}}|}....}}}}}}....}}}...}}}}}...}}}}}}}}}}}}}}}}}.....}}}
}}--+--F|-+--....-F|-|....}}}}}}}}}}.T...}}}}....---}}}}}}}}}}}}}}}}}}}}}}}}
}}......|...|......|}}}}}.}}}}}}}}}....}}}}}}}.....|}}}}}}}}}.}}}}}}}}}}}}}}
}}}}....+...|..{...|.}}}}}}}}}}}}}}}}}}}}}}}}}}.|..|}}}}}}}......}}}}...}}}}
}}}}}}..|...F......|...}}}}}}}}}}..---}}}}}}}}}}--.-}}}}}....}}}}}}....}}}}}
}}}}}}}}-----S----F|....}}}}}}}}}|...|}}}}}}}}}}}}...}}}}}}...}}}}}}..}}}}}}
}}}}}}}}}..............T...}}}}}.|.......}}}}}}}}}}}}}}..}...}.}}}}....}}}}}
}}}}}}}}}}....}}}}...}...}}}}}.......|.}}}}}}}}}}}}}}.......}}}}}}}}}...}}}}
}}}}}}}}}}..}}}}}}}}}}.}}}}}}}}}}-..--.}}}}}}}}..}}}}}}..T...}}}..}}}}}}}}}}
}}}}}}}}}...}}}}}}}}}}}}}}}}}}}}}}}...}}}}}}}....}}}}}}}.}}}..}}}...}}}}}}}}
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.}}}}}}....}}}}}}}}}}}}}}}}}}}...}}}}}}
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
]]);
--
local place = selection.new();
place:set(04,08);
place:set(10,04);
place:set(10,08);
place:set(10,12);
--
des.region(selection.area(00,00,74,19),"lit")
des.region({ region={13,03, 18,13}, lit=1, type="ordinary", prefilled=1 })
--
des.teleport_region({ region = {64,01,74,17}, dir="down" });
des.teleport_region({ region = {02,02,18,13}, dir="up" });
--
des.levregion({ region = {67,01,74,20}, type="stair-up" });
local mx, my = place:rndcoord(1);
des.stair("down", mx, my)
--
des.door("locked",04,06)
des.door("locked",04,10)
des.door("locked",08,04)
des.door("locked",08,12)
des.door("locked",10,06)
des.door("locked",10,10)
des.door("locked",12,08)
--
des.levregion({ region = {27,00,79,20}, type="branch" });
--
des.non_diggable(selection.area(01,01,22,14));
--
des.object("crystal ball", 07,08)
--
local px, py = place:rndcoord(1);
des.object({ id="statue",x=px, y=py, buc="uncursed",
montype="knight", historic=1, male=1,name="Perseus",
contents = function()
if math.random(0,99) < 75 then
des.object({ id = "shield of reflection", buc="cursed", spe=0 })
end
if math.random(0,99) < 25 then
des.object({ id = "levitation boots", spe=0 })
end
if math.random(0,99) < 50 then
des.object({ id = "scimitar", buc="blessed", spe=2 })
end
if math.random(0,99) < 50 then
des.object("sack")
end
end
});
--
des.object({ id = "statue", contents=0 })
des.object({ id = "statue", contents=0 })
des.object({ id = "statue", contents=0 })
des.object({ id = "statue", contents=0 })
des.object({ id = "statue", contents=0 })
des.object({ id = "statue", contents=0 })
des.object({ id = "statue", contents=0 })
for i=1,8 do
des.object()
end
--
for i=1,7 do
des.trap()
end
--
des.monster("Medusa", mx, my)
des.monster("kraken", 07,07)
--
-- the nesting dragon
des.monster({ id = "yellow dragon", x=05, y=04, asleep=1 })
if math.random(0,99) < 50 then
des.monster({ id = "baby yellow dragon", x=04,y=04, asleep=1 })
end
if math.random(0,99) < 25 then
des.monster({ id = "baby yellow dragon", x=04, y=05, asleep=1 })
end
des.object({ id = "egg", x=05, y=04, montype="yellow dragon" });
if math.random(0,99) < 50 then
des.object({ id = "egg", x=05, y=04, montype="yellow dragon" });
end
if math.random(0,99) < 25 then
des.object({ id = "egg", x=05, y=04, montype="yellow dragon" });
end
--
des.monster("giant eel")
des.monster("giant eel")
des.monster("jellyfish")
des.monster("jellyfish")
for i=1,14 do
des.monster("S")
end
for i=1,4 do
des.monster("black naga hatchling")
des.monster("black naga")
end
|
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful")
local naughty = require("naughty")
local lain = require("lain")
local http = require("socket.http")
local json = require("JSON")
local ltn12 = require("ltn12")
local secrets = require("secrets")
local markup = require("lain.util.markup")
local helpers = require("utils.helpers")
local my_table = awful.util.table or gears.table
local pad = helpers.pad
local theme_pad = awful.util.theme_functions.pad_fn
local keygrabber = require("awful.keygrabber")
local createAnimObject = require("utils.animation").createAnimObject
local margin = wibox.container.margin
local background = wibox.container.background
local text = wibox.widget.textbox
local icon = awful.util.theme_functions.colored_icon()
local font = awful.util.theme_functions.font_fn
local info_screen =
wibox {
visible = false,
screen = nil
}
local backdrop = wibox {type = "dock", x = 0, y = 0}
local info_screen_grabber
function info_screen_show(show_rofi)
local s = awful.screen.focused()
local screen_width = s.geometry.width
local screen_height = s.geometry.height
backdrop =
wibox(
{
type = "dock",
height = screen_height,
width = screen_width,
x = 0,
y = 0,
screen = s,
ontop = true,
visible = true,
opacity = 1,
bg = "#000000cc"
}
)
info_screen =
wibox(
{
x = 0,
y = 0,
visible = true,
ontop = true,
screen = s,
type = "dock",
height = screen_height,
width = 450,
opacity = 1,
bg = beautiful.wibar_bg
}
)
-- createAnimObject(0.6, info_screen, {x = 0, opacity = 1}, "outCubic")
-- createAnimObject(0.6, backdrop, {opacity = 1}, "outCubic")
backdrop:buttons(
awful.util.table.join(
awful.button(
{},
1,
function()
info_screen_hide()
end
)
)
)
info_screen_setup(s, show_rofi)
end
function info_screen_hide()
local s = awful.screen.focused()
backdrop.visible = false
info_screen.opacity = 0
info_screen.x = -400
info_screen.visible = false
-- createAnimObject(
-- 0.6,
-- info_screen,
-- {x = -400, opacity = 0},
-- "outCubic",
-- function()
-- info_screen.visible = false
-- end
-- )
gears.timer {
autostart = true,
timeout = 0.3,
callback = function()
awful.keygrabber.stop(info_screen_grabber)
end
}
end
local time_text = wibox.widget.textclock(markup("#FFFFFF", markup.font("FiraCode 30", "%H:%M")))
local date_text = wibox.widget.textclock(markup("#838790", markup.font("FiraCode 12", "%A, %B %d, %Y")))
function title(txt)
return text(markup("#FFFFFF", markup.font("FiraCode Bold 14", txt)))
end
function widget_info(w1, w2, w3)
local marginalizedW2 = margin(w2)
local ret =
wibox.widget {
{
{
w1,
marginalizedW2,
layout = wibox.layout.fixed.horizontal
},
nil,
w3,
layout = wibox.layout.align.horizontal
},
widget = margin,
left = 40,
right = 40,
top = 10,
bottom = 10
}
ret:connect_signal(
"mouse::enter",
function()
createAnimObject(1, marginalizedW2, {left = 10}, "outCubic")
end
)
ret:connect_signal(
"mouse::leave",
function()
createAnimObject(1, marginalizedW2, {left = 0}, "outCubic")
end
)
return ret
end
function widget_button(w, action)
local bg_normal = awful.util.theme.widget_bg .. "00"
local bg_hover = awful.util.theme.widget_bg .. "ff"
w = background(w, bg_normal)
w:connect_signal(
"mouse::enter",
function()
w.bg = bg_hover
end
)
w:connect_signal(
"mouse::leave",
function()
w.bg = bg_normal
end
)
w:buttons(my_table.join(awful.button({}, 1, action)))
return w
end
local cpu_fn = function(format)
return lain.widget.cpu(
{
settings = function()
widget:set_markup(
format and format(awful.util.theme_functions.icon_string({ icon = "", size = 9, font = "Font Awesome 5 Pro" }), cpu_now.usage) or
(awful.util.theme_functions.icon_string({ icon = "" }) .. pad(1) .. font(cpu_now.usage .. "%"))
)
end
}
)
end
local cpu =
widget_info(
cpu_fn(
function(ic, usage)
return markup(beautiful.white, ic .. theme_pad(3) .. "CPU")
end
),
nil,
cpu_fn(
function(_, usage)
return usage .. "%"
end
)
)
local mem_fn = function(format)
return lain.widget.mem(
{
timeout = 1,
settings = function()
widget:set_markup(
format and format(awful.util.theme_functions.icon_string({ icon = "", size = 9, font = "Font Awesome 5 Pro" }), mem_now.perc) or
(awful.util.theme_functions.icon_string({ icon = "", size = 9, font = "Font Awesome 5 Pro" }) .. pad(1) .. font(mem_now.perc .. "%"))
)
end
}
)
end
local mem =
widget_info(
mem_fn(
function(ic, usage)
return markup(beautiful.white, ic .. theme_pad(3) .. "Memory")
end
),
nil,
mem_fn(
function(_, usage)
return usage .. "%"
end
)
)
local root_used = text()
local fs_root_used = widget_info(icon({ icon = "", font = "Font Awesome 5 Pro" }), text(markup("#FFFFFF", theme_pad(3) .. "/")), root_used)
local home_used = text()
local fs_home_used = widget_info(icon({ icon = "", font = "Font Awesome 5 Pro" }), text(markup("#FFFFFF", theme_pad(3) .. "/Home")), home_used)
for _, s in ipairs {{partition = "sdb3", widget = root_used}, {partition = "sdb4", widget = home_used}} do
awful.widget.watch(
string.format('bash -c "df -hl | grep \'%s\' | awk \'{print $5}\'"', s.partition),
120,
function(w, stdout)
s.widget:set_markup(string.gsub(stdout, "^%s*(.-)%s*$", "%1"))
end
)
end
local uptime = text()
local uptime_widget = widget_info(icon({ icon = "", font = "Font Awesome 5 Pro" }), text(markup("#FFFFFF", theme_pad(3) .. "Uptime")), uptime)
awful.widget.watch(
'bash -c "uptime | grep -ohe \'up .*\' | sed \'s/,//g\' | awk \'{ print $2 }\'"',
60,
function(w, stdout)
uptime:set_markup(string.gsub(stdout, "^%s*(.-)%s*$", "%1"))
end
)
local packages_number =
awful.widget.watch(
string.format("sh %s/bin/get_packages_with_update.sh", os.getenv("HOME")),
3600,
function(widget, stdout, stderr)
widget:set_markup(string.gsub(stdout, "^%s*(.-)%s*$", "%1"))
end,
text()
)
local packages =
widget_info(icon({ icon = "", font = "Font Awesome 5 Pro" }), text(markup("#FFFFFF", theme_pad(3) .. "New Updates")), packages_number)
packages:buttons(
awful.util.table.join(
awful.button(
{},
1,
function()
awful.spawn("xterm -e 'yay -Syyu'")
end
)
)
)
local network_connectivity = text("Not Connected")
local network =
widget_info(icon({ icon = "", font = "Font Awesome 5 Pro" }), margin(text(markup("#FFFFFF", "Network")), 20), network_connectivity)
gears.timer {
timeout = 5,
autostart = true,
callnow = true,
callback = function()
if awful.util.variables.is_network_connected == true then
network_connectivity:set_markup("Connected")
else
network_connectivity:set_markup("Not Connected")
end
end
}
local system_information_collapse_icon = text("")
local system_information_title =
widget_info(
icon({ icon = "", font = "Font Awesome 5 Pro" }),
text(markup("#FFFFFF", theme_pad(3) .. "System")),
system_information_collapse_icon
)
local system_information_collapse =
wibox.container.constraint(
wibox.container.background(
wibox.widget {
layout = wibox.layout.fixed.vertical,
uptime_widget,
cpu,
mem,
fs_root_used,
fs_home_used
},
"#1c1c1c"
),
"exact",
450,
0
)
local system_information_collapsed = true
system_information_title:buttons(
awful.util.table.join(
awful.button(
{},
1,
function()
if system_information_collapsed == true then
system_information_collapse.height = 190
system_information_collapse_icon:set_markup("")
system_information_collapsed = false
elseif system_information_collapsed == false then
system_information_collapse.height = 0
system_information_collapse_icon:set_markup("")
system_information_collapsed = true
end
end
)
)
)
local system_information =
wibox.widget {
layout = wibox.layout.fixed.vertical,
system_information_title,
system_information_collapse
}
local clipboard =
require("widgets/damn/clipboard")(
function(widget, data, items)
widget:reset()
for _, item in ipairs(items) do
local clipboard_icon = icon({ icon = "", font = "Font Awesome 5 Pro" })
local clipboard_text = text(markup("#FFFFFF", theme_pad(3) .. item.input))
local clipboard_container =
widget_button(
widget_info(clipboard_icon, clipboard_text, nil),
function()
awful.spawn.easy_async(
string.format("curl http://localhost:9102/copy/%s", item.id),
function(stdout, stderr, reason, exit_code)
naughty.notification {message = "Copied to clipboard!"}
end
)
end
)
widget:add(clipboard_container)
end
end
)
local sound_output_icon = icon({ icon = "", font = "Font Awesome 5 Pro" })
local sound_output_text = text(markup("#FFFFFF", theme_pad(3) .. "Output: Local"))
local sound_output =
widget_button(
widget_info(sound_output_icon, sound_output_text, nil),
function()
awful.spawn.easy_async(
string.format("bash %s/bin/sound_toggle toggle", os.getenv("HOME")),
function(stdout)
local text = string.gsub(stdout, "^%s*(.-)%s*$", "%1")
sound_output_text:set_markup(markup("#FFFFFF", theme_pad(3) .. "Output: " .. (text == "" and "Local" or text)))
end
)
end
)
awful.spawn.easy_async(
string.format("bash %s/bin/sound_toggle", os.getenv("HOME")),
function(stdout)
local text = string.gsub(stdout, "^%s*(.-)%s*$", "%1")
sound_output_text:set_markup(markup("#FFFFFF", theme_pad(3) .. "Output: " .. (text == "" and "Local" or text)))
end
)
local github_icon = icon({ icon = "", font = "Font Awesome 5 Pro" })
local github_text = text(markup("#FFFFFF", theme_pad(3) .. "Github Notifications"))
local github_notifications = text(markup("#FFFFFF", theme_pad(3) .. "Loading notifications"))
local github =
widget_button(
widget_info(github_icon, github_text, github_notifications),
function()
awful.spawn.with_shell("google-chrome-beta https://github.com/notifications")
end
)
if awful.util.theme_functions.set_github_listener then
awful.util.theme_functions.set_github_listener(
function(text)
github_notifications:set_markup(markup("#FFFFFF", theme_pad(3) .. (text == "" and "0" or text)))
end
)
end
local toggl_icon = icon({ icon = "", font = "Font Awesome 5 Pro" })
local toggl_text = text(markup("#FFFFFF", theme_pad(3) .. "Toggl"))
local toggl_active = text(markup("#FFFFFF", theme_pad(3) .. "Loading active task"))
local toggl =
widget_button(
widget_info(toggl_icon, toggl_text, toggl_active),
function()
awful.spawn.with_shell("google-chrome-beta https://www.toggl.com/app/timer")
end
)
awful.widget.watch(
string.format("sh %s/.config/polybar/scripts/toggl.sh description", os.getenv("HOME")),
60,
function(widget, stdout)
local text = string.gsub(stdout, "^%s*(.-)%s*$", "%1")
toggl_text:set_markup(markup("#FFFFFF", theme_pad(3) .. (text == "" and "No Task" or text)))
end
)
awful.widget.watch(
string.format("sh %s/.config/polybar/scripts/toggl.sh duration", os.getenv("HOME")),
60,
function(widget, stdout)
local text = string.gsub(stdout, "^%s*(.-)%s*$", "%1")
toggl_active:set_markup(markup("#FFFFFF", theme_pad(3) .. (text == "-m" and "" or text)))
end
)
local toggl_reports_icon = icon({ icon = "", font = "Font Awesome 5 Pro" })
local toggl_reports_text = text(markup("#FFFFFF", theme_pad(3) .. "Reports"))
local toggl_reports = widget_info(toggl_reports_icon, toggl_reports_text, text())
local toggl_syna_icon = icon({ icon = "", font = "Font Awesome 5 Pro" })
local toggl_syna_text = text(markup("#FFFFFF", theme_pad(3) .. "Syna"))
local toggl_syna_active = text(markup("#FFFFFF", theme_pad(3) .. "Loading Report"))
local toggl_syna_reload = icon({ icon = "", font = "Font Awesome 5 Pro" })
local toggl_syna =
widget_button(
widget_info(
toggl_syna_icon,
toggl_syna_text,
wibox.widget {
toggl_syna_active,
wibox.container.margin(toggl_syna_reload, 10),
layout = wibox.layout.fixed.horizontal
}
),
function()
awful.spawn.with_shell("google-chrome-beta https://www.toggl.com/app/reports/summary/2623050")
end
)
local prev_toggl_syna_text = ""
function fetch_toggle_syna()
awful.widget.watch(
string.format("sh %s/bin/toggl-report diff", os.getenv("HOME")),
60,
function(widget, stdout)
local text = string.gsub(stdout, "^%s*(.-)%s*$", "%1")
if text ~= "m" then
toggl_syna_active:set_markup(markup("#FFFFFF", theme_pad(3) .. "-" .. text))
prev_toggl_syna_text = text
elseif prev_toggl_syna_text == "" then
toggl_syna_active:set_markup(markup("#FFFFFF", theme_pad(3) .. "Failed"))
end
end
)
end
fetch_toggle_syna()
toggl_syna_reload:buttons(my_table.join(awful.button({}, 1, fetch_toggle_syna)))
local power_button = background(margin(title(icon({ icon = "", font = "Font Awesome 5 Pro" }, true) .. " Power"), 40, 40, 20, 20), "#1c1c1c")
power_button:connect_signal(
"mouse::enter",
function()
power_button.bg = awful.util.theme.widget_bg
end
)
power_button:connect_signal(
"mouse::leave",
function()
power_button.bg = beautiful.wibar_bg
end
)
power_button:buttons(
awful.util.table.join(
awful.button(
{},
1,
function()
info_screen_hide()
exit_screen_show()
end
)
)
)
local widgets = {
{
{
layout = wibox.layout.fixed.vertical,
margin(pad(0), 0, 0, 32),
margin(time_text, 40, 40),
margin(date_text, 40, 40, 0, 20),
background(margin(title("Work Information"), 40, 40, 10, 10), "#1c1c1c"),
margin(pad(0), 0, 0, 0, 16),
toggl,
github,
toggl_reports,
toggl_syna,
margin(pad(0), 0, 0, 0, 32),
background(margin(title("Information"), 40, 40, 10, 10), "#1c1c1c"),
margin(pad(0), 0, 0, 0, 16),
packages,
network,
system_information,
margin(pad(0), 0, 0, 0, 32),
background(margin(title("Settings"), 40, 40, 10, 10), "#1c1c1c"),
margin(pad(0), 0, 0, 0, 16),
sound_output,
margin(pad(0), 0, 0, 0, 32),
-- background(margin(title("Clipboard"), 40, 40, 10, 10), "#1c1c1c"),
-- clipboard
},
nil,
power_button,
layout = wibox.layout.align.vertical
},
widget = wibox.container.background,
bg = awful.util.theme.bg_panel
}
local close_button = widget_button(wibox.container.constraint(wibox.container.place(icon({ icon = "", size = 12 })), "exact", 50, 50))
close_button:buttons(
awful.util.table.join(
awful.button(
{},
1,
function()
info_screen_hide()
end
)
)
)
function info_screen_setup(s, show_rofi)
if show_rofi ~= true then
info_screen_grabber =
awful.keygrabber.run(
function(_, key, event)
if event == "release" then
return
end
if key == "Escape" or key == "q" or key == "x" then
info_screen_hide()
end
end
)
info_screen:setup(
{
layout = wibox.layout.align.horizontal,
nil,
widgets
}
)
return
end
awful.spawn.easy_async(
"rofi -show drun",
function(stdout, stderr, reason, exit_code)
info_screen_hide()
end
)
info_screen:setup(
{
layout = wibox.layout.align.horizontal,
nil,
nil
-- beautiful.statusbar(
-- s,
-- false,
-- close_button,
-- gears.color(
-- {
-- type = "linear",
-- from = {20, 0},
-- to = {70, 0},
-- stops = {{0, awful.util.theme.bg_panel}, {1, "#050505"}}
-- }
-- )
-- )
}
)
end
|
-- type = helm -- DO NOT REMOVE THIS LINE!
local name = "helm"
local version = "3.8.2"
local org = ""
local repo = name
food = {
name = name,
description = "The Kubernetes Package Manager",
license = "Apache-2.0",
homepage = "https://github.com/helm/helm",
version = version,
packages = {
{
os = "darwin",
arch = "amd64",
url = "https://get.helm.sh/helm-v" .. version .. "-darwin-amd64.tar.gz",
sha256 = "25bb4a70b0d9538a97abb3aaa57133c0779982a8091742a22026e60d8614f8a0",
resources = {
{
path = "darwin-amd64/" .. name,
installpath = "bin/" .. name,
executable = true
}
}
},
{
os = "darwin",
arch = "arm64",
url = "https://get.helm.sh/helm-v" .. version .. "-darwin-arm64.tar.gz",
sha256 = "dfddc0696597c010ed903e486fe112a18535ab0c92e35335aa54af2360077900",
resources = {
{
path = "darwin-arm64/" .. name,
installpath = "bin/" .. name,
executable = true
}
}
},
{
os = "linux",
arch = "amd64",
url = "https://get.helm.sh/helm-v" .. version .. "-linux-amd64.tar.gz",
sha256 = "6cb9a48f72ab9ddfecab88d264c2f6508ab3cd42d9c09666be16a7bf006bed7b",
resources = {
{
path = "linux-amd64/" .. name,
installpath = "bin/" .. name,
executable = true
}
}
},
{
os = "linux",
arch = "arm64",
url = "https://get.helm.sh/helm-v" .. version .. "-linux-arm64.tar.gz",
sha256 = "238db7f55e887f9c1038b7e43585b84389a05fff5424e70557886cad1635b3ce",
resources = {
{
path = "linux-arm64/" .. name,
installpath = "bin/" .. name,
executable = true
}
}
},
{
os = "windows",
arch = "amd64",
url = "https://get.helm.sh/helm-v" .. version .. "-windows-amd64.tar.gz",
sha256 = "a23a029b269a016b0c1c92f5d2ee2c1e67b36d223a51c61c484ab41c413c8c22",
resources = {
{
path = "windows-amd64\\" .. name .. ".exe",
installpath = "bin\\" .. name .. ".exe"
}
}
}
}
}
|
MODULE_HELP_START = 'Commands'
MODULE_HELP_CONTENTS = [[<font face="mono" size="15"><a href="event:Commands">Commands</a></font>
]]
MODULE_HELP = {
['Commands'] = [[<font face="mono" size="15">!help
!init
!s <command>
!ui [!]me|all|<name>...
!r
!reset
tfm.exec.newGame(curMap)
!m [<map>]
!map [<map>]
tfm.exec.newGame()
!set { <name>=<value>... }
!dir <variable>
!dump <value>
!<function> [<value>...]
!do
!end
!redo
!undo
</font>
]]
}
MODULE_HELP_CLOSE='<TI><a href="event:help_close"><p align="center">X</p></a>'
|
local TXT = Localize{
[0] = " ",
[1] = "Crate",
[2] = "Barrel",
[3] = "Well",
[4] = "Drink from the Well",
[5] = "Fountain",
[6] = "Drink from the Fountain",
[7] = "House",
[8] = "Trash Heap",
[9] = "Keg",
[10] = "Cart",
[11] = "Refreshing!",
[12] = "Boat",
[13] = "Dock",
[14] = "Anvil",
[15] = "Button",
[16] = "Chest",
[17] = "Event 46",
[18] = "Event 1",
[19] = "Fruit Tree",
[20] = "Door",
[21] = "This Door is Locked",
[22] = "+50 Fire Resistance temporary.",
[23] = "+5 Hit points restored.",
[24] = "+5 Spell points restored.",
[25] = "+2 Luck permanent",
[26] = "Event 15",
[27] = "Event 29",
[28] = "Event 42",
[29] = "Event 74",
[30] = "Enter The Temple of the Moon",
[31] = "Enter the Dragon's Cave",
[32] = "Event 89",
[33] = "Event 107",
[34] = "Event 139",
[35] = "Temple",
[36] = "Guilds",
[37] = "Stables",
[38] = "Docks",
[39] = "Shops",
[40] = "Lord Markham",
[41] = "This cave is sealed by a powerful magical ward.",
[42] = "Enjoy 'The Game'",
[43] = "",
[44] = "",
[45] = "",
[46] = "Welcome to Emerald Isle",
[47] = "",
[48] = "",
[49] = "",
[50] = "Obelisk",
[51] = "Nothing Seems to have happened",
[52] = "Shrine",
[53] = "Alter",
[54] = "You Pray",
}
table.copy(TXT, evt.str, true)
evt.hint[1] = evt.str[46] -- "Welcome to Emerald Isle"
evt.house[2] = 8 -- "The Knight's Blade"
Game.MapEvtLines:RemoveEvent(2)
evt.map[2] = function()
evt.EnterHouse{Id = 8} -- "The Knight's Blade"
end
evt.house[3] = 8 -- "The Knight's Blade"
Game.MapEvtLines:RemoveEvent(3)
evt.map[3] = function()
end
evt.house[4] = 43 -- "Erik's Armory"
Game.MapEvtLines:RemoveEvent(4)
evt.map[4] = function()
evt.EnterHouse{Id = 43} -- "Erik's Armory"
end
evt.house[5] = 43 -- "Erik's Armory"
Game.MapEvtLines:RemoveEvent(5)
evt.map[5] = function()
end
evt.house[6] = 84 -- "Emerald Enchantments"
Game.MapEvtLines:RemoveEvent(6)
evt.map[6] = function()
evt.EnterHouse{Id = 84} -- "Emerald Enchantments"
end
evt.house[7] = 84 -- "Emerald Enchantments"
Game.MapEvtLines:RemoveEvent(7)
evt.map[7] = function()
end
evt.house[8] = 116 -- "The Blue Bottle"
Game.MapEvtLines:RemoveEvent(8)
evt.map[8] = function()
evt.EnterHouse{Id = 116} -- "The Blue Bottle"
end
evt.house[9] = 116 -- "The Blue Bottle"
Game.MapEvtLines:RemoveEvent(9)
evt.map[9] = function()
end
evt.house[10] = 310 -- "Healer's Tent"
Game.MapEvtLines:RemoveEvent(10)
evt.map[10] = function()
evt.EnterHouse{Id = 310} -- "Healer's Tent"
end
evt.house[11] = 310 -- "Healer's Tent"
Game.MapEvtLines:RemoveEvent(11)
evt.map[11] = function()
end
evt.house[12] = 1570 -- "Island Training Grounds"
Game.MapEvtLines:RemoveEvent(12)
evt.map[12] = function()
evt.EnterHouse{Id = 1570} -- "Island Training Grounds"
end
evt.house[13] = 1570 -- "Island Training Grounds"
Game.MapEvtLines:RemoveEvent(13)
evt.map[13] = function()
end
evt.house[14] = 239 -- "Two Palms Tavern"
Game.MapEvtLines:RemoveEvent(14)
evt.map[14] = function()
evt.EnterHouse{Id = 239} -- "Two Palms Tavern"
end
evt.house[15] = 239 -- "Two Palms Tavern"
Game.MapEvtLines:RemoveEvent(15)
evt.map[15] = function()
end
evt.house[16] = 128 -- "Initiate Guild of Fire"
Game.MapEvtLines:RemoveEvent(16)
evt.map[16] = function()
evt.EnterHouse{Id = 128} -- "Initiate Guild of Fire"
end
evt.house[17] = 128 -- "Initiate Guild of Fire"
Game.MapEvtLines:RemoveEvent(17)
evt.map[17] = function()
end
evt.house[18] = 134 -- "Initiate Guild of Air"
Game.MapEvtLines:RemoveEvent(18)
evt.map[18] = function()
evt.EnterHouse{Id = 134} -- "Initiate Guild of Air"
end
evt.house[19] = 134 -- "Initiate Guild of Air"
Game.MapEvtLines:RemoveEvent(19)
evt.map[19] = function()
end
evt.house[20] = 152 -- "Initiate Guild of Spirit"
Game.MapEvtLines:RemoveEvent(20)
evt.map[20] = function()
evt.EnterHouse{Id = 152} -- "Initiate Guild of Spirit"
end
evt.house[21] = 152 -- "Initiate Guild of Spirit"
Game.MapEvtLines:RemoveEvent(21)
evt.map[21] = function()
end
evt.house[22] = 164 -- "Initiate Guild of Body"
Game.MapEvtLines:RemoveEvent(22)
evt.map[22] = function()
evt.EnterHouse{Id = 164} -- "Initiate Guild of Body"
end
evt.house[23] = 164 -- "Initiate Guild of Body"
Game.MapEvtLines:RemoveEvent(23)
evt.map[23] = function()
end
evt.house[24] = 1168 -- "The Lady Margaret"
Game.MapEvtLines:RemoveEvent(24)
evt.map[24] = function()
evt.EnterHouse{Id = 1168} -- "The Lady Margaret"
end
evt.house[25] = 485 -- "Lady Margaret"
Game.MapEvtLines:RemoveEvent(25)
evt.map[25] = function()
end
evt.hint[26] = evt.str[100] -- ""
Game.MapEvtLines:RemoveEvent(26)
evt.map[26] = function() -- function events.LoadMap()
evt.Subtract{"NPCs", Value = 342} -- "Big Daddy Jim"
end
events.LoadMap = evt.map[26].last
evt.hint[37] = evt.str[100] -- ""
Game.MapEvtLines:RemoveEvent(37)
evt.map[37] = function() -- function events.LoadMap()
if evt.Cmp{"QBits", Value = 806} then -- Return to EI
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 10, X = 3244, Y = 9265, Z = 900, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 3, Count = 2, X = 4406, Y = 8851, Z = 900, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 8, X = 500, Y = 8191, Z = 700, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 8, X = 5893, Y = 8379, Z = 400, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 10, X = 6758, Y = 8856, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 3, Count = 2, X = 7738, Y = 7005, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 6, X = 8402, Y = 7527, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 2, Count = 5, X = 9881, Y = 7481, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 2, Count = 4, X = 11039, Y = 7117, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 7, X = 12360, Y = 6764, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 2, Count = 4, X = 13389, Y = 6797, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 3, Count = 2, X = 14777, Y = 6911, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 7, X = 12560, Y = 5717, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 5, X = 12438, Y = 4787, Z = 170, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 3, Count = 2, X = 12481, Y = 3299, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 7, X = 12674, Y = 2105, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 2, Count = 4, X = 11248, Y = 2852, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 6, X = 9585, Y = 5015, Z = 0, -- ERROR: Not found
NPCGroup = 563, unk = 0}
evt.SummonMonsters{TypeIndexInMapStats = 3, Level = 1, Count = 3, X = 12205, Y = 4919, Z = 170, -- ERROR: Not found
NPCGroup = 2098, unk = 0}
evt.Subtract{"QBits", Value = 806} -- Return to EI
evt.SpeakNPC{NPC = 356} -- "Sally"
end
end
events.LoadMap = evt.map[37].last
evt.hint[49] = evt.str[7] -- "House"
evt.house[50] = 1167 -- "Donna Wyrith's Residence"
Game.MapEvtLines:RemoveEvent(50)
evt.map[50] = function()
evt.EnterHouse{Id = 1167} -- "Donna Wyrith's Residence"
end
evt.house[51] = 1170 -- "Mia Lucille' Home"
Game.MapEvtLines:RemoveEvent(51)
evt.map[51] = function()
evt.EnterHouse{Id = 1170} -- "Mia Lucille' Home"
end
evt.house[52] = 1171 -- "Zedd's Place"
Game.MapEvtLines:RemoveEvent(52)
evt.map[52] = function()
evt.EnterHouse{Id = 1171} -- "Zedd's Place"
end
evt.house[53] = 1608 -- "House 227"
Game.MapEvtLines:RemoveEvent(53)
evt.map[53] = function()
evt.EnterHouse{Id = 1608} -- "House 227"
end
evt.house[54] = 1173 -- "House 228"
Game.MapEvtLines:RemoveEvent(54)
evt.map[54] = function()
evt.EnterHouse{Id = 1173} -- "House 228"
end
evt.house[55] = 1174 -- "House 229"
Game.MapEvtLines:RemoveEvent(55)
evt.map[55] = function()
evt.EnterHouse{Id = 1174} -- "House 229"
end
evt.house[56] = 1183 -- "Carolyn Weathers' House"
Game.MapEvtLines:RemoveEvent(56)
evt.map[56] = function()
evt.EnterHouse{Id = 1183} -- "Carolyn Weathers' House"
end
evt.house[57] = 1184 -- "Tellmar Residence"
Game.MapEvtLines:RemoveEvent(57)
evt.map[57] = function()
evt.EnterHouse{Id = 1184} -- "Tellmar Residence"
end
evt.house[58] = 1185 -- "House 241"
Game.MapEvtLines:RemoveEvent(58)
evt.map[58] = function()
evt.EnterHouse{Id = 1185} -- "House 241"
end
evt.house[59] = 1186 -- "House 242"
Game.MapEvtLines:RemoveEvent(59)
evt.map[59] = function()
evt.EnterHouse{Id = 1186} -- "House 242"
end
evt.house[60] = 1198 -- "House 254"
Game.MapEvtLines:RemoveEvent(60)
evt.map[60] = function()
evt.EnterHouse{Id = 1198} -- "House 254"
end
evt.house[61] = 1199 -- "House 255"
Game.MapEvtLines:RemoveEvent(61)
evt.map[61] = function()
evt.EnterHouse{Id = 1199} -- "House 255"
end
evt.house[62] = 1199 -- "House 255"
Game.MapEvtLines:RemoveEvent(62)
evt.map[62] = function()
evt.EnterHouse{Id = 1199} -- "House 255"
end
evt.hint[63] = evt.str[14] -- "Anvil"
evt.hint[64] = evt.str[10] -- "Cart"
evt.hint[65] = evt.str[9] -- "Keg"
evt.house[66] = 1163 -- "Markham's Headquarters"
Game.MapEvtLines:RemoveEvent(66)
evt.map[66] = function()
evt.EnterHouse{Id = 1163} -- "Markham's Headquarters"
end
evt.house[67] = 1163 -- "Markham's Headquarters"
Game.MapEvtLines:RemoveEvent(67)
evt.map[67] = function()
end
evt.hint[68] = evt.str[36] -- "Guilds"
evt.hint[69] = evt.str[39] -- "Shops"
evt.hint[70] = evt.str[40] -- "Lord Markham"
evt.hint[101] = evt.str[30] -- "Enter The Temple of the Moon"
Game.MapEvtLines:RemoveEvent(101)
evt.map[101] = function()
evt.MoveToMap{X = -1208, Y = -4225, Z = 366, Direction = 320, LookAngle = 0, SpeedZ = 0, HouseId = 387, Icon = 3, Name = "7D06.blv"} -- "Temple of the Moon"
end
evt.hint[102] = evt.str[31] -- "Enter the Dragon's Cave"
Game.MapEvtLines:RemoveEvent(102)
evt.map[102] = function()
if evt.Cmp{"Inventory", Value = 1364} then -- "Ring of UnWarding"
evt.MoveToMap{X = 752, Y = 2229, Z = 1, Direction = 1012, LookAngle = 0, SpeedZ = 0, HouseId = 389, Icon = 3, Name = "7D28.Blv"} -- "Dragon's Lair"
else
evt.StatusText{Str = 41} -- "This cave is sealed by a powerful magical ward."
end
end
evt.hint[109] = evt.str[3] -- "Well"
evt.hint[110] = evt.str[4] -- "Drink from the Well"
Game.MapEvtLines:RemoveEvent(110)
evt.map[110] = function()
evt.ForPlayer(-- ERROR: Const not found
"All")
if not evt.Cmp{"QBits", Value = 828} then -- 1-time EI Well
evt.Set{"QBits", Value = 828} -- 1-time EI Well
evt.Add{"BaseEndurance", Value = 32}
evt.Add{"SkillPoints", Value = 5}
else
if evt.Cmp{"FireResBonus", Value = 50} then
evt.StatusText{Str = 11} -- "Refreshing!"
else
evt.Set{"FireResBonus", Value = 50}
evt.StatusText{Str = 22} -- "+50 Fire Resistance temporary."
evt.Add{"AutonotesBits", Value = 258} -- "50 points of temporary Fire resistance from the central town well on Emerald Island."
end
end
end
Game.MapEvtLines:RemoveEvent(111)
evt.map[111] = function() -- Timer(<function>, const.Day, 1*const.Second)
evt.Set{"MapVar0", Value = 30}
evt.Set{"MapVar1", Value = 30}
end
Timer(evt.map[111].last, const.Day, 1*const.Second)
evt.hint[112] = evt.str[4] -- "Drink from the Well"
Game.MapEvtLines:RemoveEvent(112)
evt.map[112] = function()
if evt.Cmp{"MapVar0", Value = 1} then
evt.Subtract{"MapVar0", Value = 1}
evt.Add{"HP", Value = 5}
evt.Add{"AutonotesBits", Value = 259} -- "5 Hit Points regained from the well east of the Temple on Emerald Island."
evt.StatusText{Str = 23} -- "+5 Hit points restored."
else
evt.StatusText{Str = 11} -- "Refreshing!"
end
end
evt.hint[113] = evt.str[4] -- "Drink from the Well"
Game.MapEvtLines:RemoveEvent(113)
evt.map[113] = function()
if evt.Cmp{"MapVar1", Value = 1} then
evt.Subtract{"MapVar1", Value = 1}
evt.Add{"SP", Value = 5}
evt.StatusText{Str = 24} -- "+5 Spell points restored."
else
evt.StatusText{Str = 11} -- "Refreshing!"
end
evt.Set{"AutonotesBits", Value = 4} -- "5 Spell Points regained from the well west of the Temple on Emerald Island."
end
evt.hint[114] = evt.str[4] -- "Drink from the Well"
Game.MapEvtLines:RemoveEvent(114)
evt.map[114] = function()
if evt.Cmp{"QBits", Value = 536} then -- "Find the Blessed Panoply of Sir BunGleau and return to the Angel in Castle Harmondale""
goto _15
end
if evt.Cmp{"QBits", Value = 538} then -- "Find the Blessed Panoply of Sir BunGleau and return to William Setag in the Deyja Moors."
goto _15
end
if not evt.Cmp{"BaseLuck", Value = 15} then
if evt.Cmp{"MapVar2", Value = 1} then
evt.Subtract{"MapVar2", Value = 1}
evt.Add{"BaseLuck", Value = 2}
evt.StatusText{Str = 25} -- "+2 Luck permanent"
return
end
end
evt.StatusText{Str = 11} -- "Refreshing!"
do return end
::_15::
evt.MoveToMap{X = 9828, Y = 6144, Z = 97, Direction = 2047, LookAngle = 0, SpeedZ = 0, HouseId = 0, Icon = 0, Name = "mdt09.blv"}
end
RefillTimer(function()
evt.Set{"MapVar2", Value = 8}
end, const.Month, true)
evt.hint[115] = evt.str[4] -- "Drink from the Well"
Game.MapEvtLines:RemoveEvent(115)
evt.map[115] = function()
if not evt.Cmp{"MapVar4", Value = 3} then
if not evt.Cmp{"MapVar3", Value = 1} then
if not evt.Cmp{"Gold", Value = 201} then
if evt.Cmp{"BaseLuck", Value = 15} then
evt.Add{"MapVar3", Value = 1}
evt.Add{"Gold", Value = 1000}
evt.Add{"MapVar4", Value = 1}
return
end
end
end
end
evt.StatusText{Str = 11} -- "Refreshing!"
end
RefillTimer(function()
evt.Set{"MapVar3", Value = 0}
end, const.Week, true)
evt.hint[118] = evt.str[1] -- "Crate"
Game.MapEvtLines:RemoveEvent(118)
evt.map[118] = function()
evt.OpenChest{Id = 1}
end
evt.hint[119] = evt.str[1] -- "Crate"
Game.MapEvtLines:RemoveEvent(119)
evt.map[119] = function()
evt.OpenChest{Id = 2}
end
evt.hint[120] = evt.str[1] -- "Crate"
Game.MapEvtLines:RemoveEvent(120)
evt.map[120] = function()
evt.OpenChest{Id = 3}
end
evt.hint[121] = evt.str[1] -- "Crate"
Game.MapEvtLines:RemoveEvent(121)
evt.map[121] = function()
evt.OpenChest{Id = 4}
end
evt.hint[122] = evt.str[1] -- "Crate"
Game.MapEvtLines:RemoveEvent(122)
evt.map[122] = function()
evt.OpenChest{Id = 5}
end
evt.hint[123] = evt.str[1] -- "Crate"
Game.MapEvtLines:RemoveEvent(123)
evt.map[123] = function()
evt.OpenChest{Id = 6}
end
evt.hint[124] = evt.str[16] -- "Chest"
Game.MapEvtLines:RemoveEvent(124)
evt.map[124] = function()
evt.OpenChest{Id = 7}
end
Game.MapEvtLines:RemoveEvent(200)
evt.map[200] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.Set{"QBits", Value = 529} -- No more docent babble
evt.SpeakNPC{NPC = 342} -- "Big Daddy Jim"
end
end
Game.MapEvtLines:RemoveEvent(201)
evt.map[201] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 359} -- "Baron BunGleau"
end
end
Game.MapEvtLines:RemoveEvent(202)
evt.map[202] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 360} -- "Zedd True Shot"
end
end
Game.MapEvtLines:RemoveEvent(203)
evt.map[203] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 361} -- "Alex the Mentor"
end
end
Game.MapEvtLines:RemoveEvent(204)
evt.map[204] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 362} -- "Alex the Mentor"
end
end
Game.MapEvtLines:RemoveEvent(205)
evt.map[205] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 363} -- "Alex the Mentor"
end
end
Game.MapEvtLines:RemoveEvent(206)
evt.map[206] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 364} -- "Operator"
end
end
Game.MapEvtLines:RemoveEvent(207)
evt.map[207] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 365} -- "Count ZERO"
end
end
Game.MapEvtLines:RemoveEvent(208)
evt.map[208] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 366} -- "Messenger"
end
end
Game.MapEvtLines:RemoveEvent(209)
evt.map[209] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 367} -- "Alex the Mentor"
end
end
Game.MapEvtLines:RemoveEvent(210)
evt.map[210] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 368} -- "Alex the Mentor"
end
end
Game.MapEvtLines:RemoveEvent(211)
evt.map[211] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 369} -- "Doom Bearer"
end
end
Game.MapEvtLines:RemoveEvent(212)
evt.map[212] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 370} -- "Alex the Mentor"
end
end
Game.MapEvtLines:RemoveEvent(213)
evt.map[213] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 371} -- "Myrta Bumblebee"
end
end
Game.MapEvtLines:RemoveEvent(214)
evt.map[214] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 372} -- "Alex the Mentor"
end
end
Game.MapEvtLines:RemoveEvent(215)
evt.map[215] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 373} -- "Duke Bimbasto"
end
end
Game.MapEvtLines:RemoveEvent(216)
evt.map[216] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 374} -- "Sir Vilx of Stone City"
end
end
Game.MapEvtLines:RemoveEvent(217)
evt.map[217] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 375} -- "Alex the Mentor"
end
end
Game.MapEvtLines:RemoveEvent(218)
evt.map[218] = function()
if not evt.Cmp{"QBits", Value = 529} then -- No more docent babble
evt.SpeakNPC{NPC = 376} -- "Pascal the Mad Mage"
end
end
evt.hint[219] = evt.str[15] -- "Button"
Game.MapEvtLines:RemoveEvent(219)
evt.map[219] = function()
evt.CastSpell{Spell = 43, Mastery = const.GM, Skill = 10, FromX = 10495, FromY = 17724, FromZ = 2370, ToX = 10495, ToY = 24144, ToZ = 4500} -- "Death Blossom"
end
evt.hint[220] = evt.str[100] -- ""
Game.MapEvtLines:RemoveEvent(220)
evt.map[220] = function() -- Timer(<function>, const.Day, 1*const.Hour)
if evt.CheckMonstersKilled{CheckType = 1, Id = 71, Count = 0} then
evt.SummonMonsters{TypeIndexInMapStats = 1, Level = 1, Count = 10, X = -336, Y = 14512, Z = 0, NPCGroup = 71, unk = 0} -- "Ridge walkers in Bracada"
evt.SummonMonsters{TypeIndexInMapStats = 1, Level = 2, Count = 5, X = 16, Y = 16352, Z = 90, NPCGroup = 71, unk = 0} -- "Ridge walkers in Bracada"
evt.SummonMonsters{TypeIndexInMapStats = 1, Level = 1, Count = 10, X = 480, Y = 18288, Z = 6, NPCGroup = 71, unk = 0} -- "Ridge walkers in Bracada"
end
end
Timer(evt.map[220].last, const.Day, 1*const.Hour)
Game.MapEvtLines:RemoveEvent(573)
evt.map[573] = function()
evt.ForPlayer(-- ERROR: Const not found
"All")
if not evt.Cmp{"Inventory", Value = 1540} then -- "Lost Scroll of Wonka"
evt.SetMessage{Str = 768}
return
end
evt.SetMessage{Str = 769}
evt.ForPlayer(-- ERROR: Const not found
3)
if evt.Cmp{"FireSkill", Value = 1} then
evt.Set{"FireSkill", Value = 49152}
evt.Set{"FireSkill", Value = 8}
end
evt.ForPlayer(-- ERROR: Const not found
2)
if evt.Cmp{"FireSkill", Value = 1} then
evt.Set{"FireSkill", Value = 49152}
evt.Set{"FireSkill", Value = 8}
end
evt.ForPlayer(-- ERROR: Const not found
1)
if evt.Cmp{"FireSkill", Value = 1} then
evt.Set{"FireSkill", Value = 49152}
evt.Set{"FireSkill", Value = 8}
end
evt.ForPlayer(-- ERROR: Const not found
0)
if evt.Cmp{"FireSkill", Value = 1} then
evt.Set{"FireSkill", Value = 49152}
evt.Set{"FireSkill", Value = 8}
end
evt.ForPlayer(-- ERROR: Const not found
"All")
evt.Subtract{"QBits", Value = 784} -- "Find the Lost Scroll of Wonka and return it to Blayze on Emerald Island."
evt.Subtract{"Inventory", Value = 1540} -- "Lost Scroll of Wonka"
evt.Add{"Awards", Value = 129} -- "Recovered the Lost Scroll of Wonka"
evt.SetNPCTopic{NPC = 478, Index = 1, Event = 0} -- "Blayze "
evt.Add{"Experience", Value = 40000}
end
Game.MapEvtLines:RemoveEvent(574)
evt.map[574] = function()
evt.ForPlayer(-- ERROR: Const not found
"All")
if evt.Cmp{"Inventory", Value = 1361} then -- "Watcher's Ring of Elemental Water"
evt.SetMessage{Str = 772}
evt.SetNPCTopic{NPC = 483, Index = 0, Event = 1993} -- "Tobren Rainshield" : "The Greatest Hero"
return
end
if not evt.Cmp{"Inventory", Value = 1128} then -- "Water Walk"
evt.ForPlayer(-- ERROR: Const not found
"Current")
evt.Add{"Inventory", 1128} -- "Water Walk"
end
evt.SetMessage{Str = 771}
end
Game.MapEvtLines:RemoveEvent(575)
evt.map[575] = function()
evt.ForPlayer(-- ERROR: Const not found
"Current")
if evt.Cmp{"WaterSkill", Value = 136} then
evt.SetMessage{Str = 130}
else
if not evt.Cmp{"WaterSkill", Value = 72} then
evt.SetMessage{Str = 126}
else
if evt.Cmp{"Gold", Value = 3000} then
evt.Add{"WaterSkill", Value = 128}
evt.Subtract{"Gold", Value = 3000}
evt.SetMessage{Str = 133}
else
evt.SetMessage{Str = 125}
end
end
end
end
evt.map[100] = function() -- function events.LoadMap()
if not evt.Cmp{"QBits", Value = 519} then -- Finished Scavenger Hunt
if not evt.Cmp{"QBits", Value = 518} then -- "Return a wealthy hat to the Judge on Emerald Island."
if not evt.Cmp{"QBits", Value = 517} then -- "Return a musical instrument to the Judge on Emerald Island."
if not evt.Cmp{"QBits", Value = 516} then -- "Return a floor tile to the Judge on Emerald Island."
if not evt.Cmp{"QBits", Value = 515} then -- "Return a longbow to the Judge on Emerald Island."
if not evt.Cmp{"QBits", Value = 514} then -- "Return a seashell to the Judge on Emerald Island."
if not evt.Cmp{"QBits", Value = 513} then -- "Return a red potion to the Judge on Emerald Island."
evt.Add{"QBits", Value = 518} -- "Return a wealthy hat to the Judge on Emerald Island."
evt.Add{"QBits", Value = 517} -- "Return a musical instrument to the Judge on Emerald Island."
evt.Add{"QBits", Value = 516} -- "Return a floor tile to the Judge on Emerald Island."
evt.Add{"QBits", Value = 515} -- "Return a longbow to the Judge on Emerald Island."
evt.Add{"QBits", Value = 514} -- "Return a seashell to the Judge on Emerald Island."
evt.Add{"QBits", Value = 513} -- "Return a red potion to the Judge on Emerald Island."
evt.ShowMovie{DoubleSize = 1, Name = "\"intro post\""}
end
end
end
end
end
end
end
end
events.LoadMap = evt.map[100].last
--[[ MMMerge additions ]]--
-- Emerald Island
function events.AfterLoadMap()
Party.QBits[936] = true -- DDMapBuff, changed for rev4 for merge
end
-- Remove arcomage from Emerald Island's taverns
function events.DrawShopTopics(t)
if t.HouseType == const.HouseType.Tavern then
t.Handled = true
t.NewTopics[1] = const.ShopTopics.RentRoom
t.NewTopics[2] = const.ShopTopics.BuyFood
t.NewTopics[3] = const.ShopTopics.Learn
end
end
|
for index, force in pairs(game.forces) do
if force.technologies["X100_assembler"].researched then
force.recipes["X100_assembler"].enabled = true
force.recipes["processing_cable_X100"].enabled = true
force.recipes["processing_gear_X100"].enabled = true
force.recipes["processing_unit_X100"].enabled = true
force.recipes["advanced_circuit_X100"].enabled = true
force.recipes["electronic_circuit_X100"].enabled = true
end
if force.technologies["X100_assembler"].researched then
force.recipes["splitter_X100"].enabled = true
force.recipes["transport_belt_X100"].enabled = true
force.recipes["loader_x100"].enabled = true
force.recipes["transport_ground_100"].enabled = true
end
end |
return {
install_script = function()
if require("installer/utils/os").is_windows then
return [[
if (Test-Path PowerShellEditorServices) {
Remove-Item -Force -Recurse PowerShellEditorServices
}
Invoke-WebRequest -UseBasicParsing https://github.com/PowerShell/PowerShellEditorServices/releases/latest/download/PowerShellEditorServices.zip -OutFile "pses.zip"
Expand-Archive .\pses.zip -DestinationPath .\PowerShellEditorServices
Remove-Item pses.zip
]]
else
return [[
curl -L -o "pses.zip" https://github.com/PowerShell/PowerShellEditorServices/releases/latest/download/PowerShellEditorServices.zip
rm -rf PowerShellEditorServices
unzip pses.zip -d PowerShellEditorServices
rm pses.zip
]]
end
end,
lsp_config = function()
local fs = require("installer/utils/fs")
local config = require("installer/integrations/ls/utils").extract_config("powershell_es")
local temp_path = vim.fn.stdpath("cache")
local bundle_path = fs.module_path("ls", "powershell_es") .. "/PowerShellEditorServices"
local command_fmt =
[[%s/PowerShellEditorServices/Start-EditorServices.ps1 -BundledModulesPath %s -LogPath %s/powershell_es.log -SessionDetailsPath %s/powershell_es.session.json -FeatureFlags @() -AdditionalModules @() -HostName nvim -HostProfileId 0 -HostVersion 1.0.0 -Stdio -LogLevel Normal]]
local command = command_fmt:format(bundle_path, bundle_path, temp_path, temp_path)
local cmd = { "pwsh", "-NoLogo", "-NoProfile", "-Command", command }
config.default_config.cmd = cmd
config.default_config.on_new_config = function(new_config)
new_config.cmd = cmd
end
return config
end,
}
|
local Dialogue = {}
utf8 = require"utf8"
function utf8.sub(str, i, j)
if i == 0 and j == 0 then
return nil
end
local ii = i
local jj = j
if ii < 0 then ii = utf8.len(str)-math.abs(ii) + 1 end
if jj < 0 then jj = utf8.len(str)-math.abs(jj) + 1 end
local r = ""
local s = utf8.offset(str, ii)
for p = ii+1, jj+1 do
local e = utf8.offset(str, p) - 1
r = r .. str:sub(s, e)
s = e+1
end
return r
end
function utf8.isutf8(str)
for i = 1, utf8.len(str) do
if utf8.codepoint(utf8.sub(str, i, i)) > 400 then
return true
end
end
return false
end
function utf8.noutf8(str)
local r = ""
for i = 1, utf8.len(str) do
if utf8.codepoint(utf8.sub(str, i, i)) > 400 then
r = r .. Key.Exit
else
r = r .. utf8.sub(str, i, i)
end
end
return r
end
function utf8.string(str)
local r = ""
for i = 1, utf8.len(str) do
if utf8.codepoint(utf8.sub(str, i, i)) > 400 then
r = r .. utf8.sub(str, i, i)
end
end
return r
end
function Dialogue:New(text, f, fs)
local a = {}
setmetatable(a, self)
self.__index = self
a:Init(text, f, fs)
return a
end
function Dialogue:Reset()
self.Done = false
self.Char = {}
self.Count = 0
self.TextX = 0
self.TextY = 0
self.TextNum = 0
self.TextLine = 0
self.ColorCount = #self.Colors - 1
self.CharColor = { 255, 255, 255 }
end
function Dialogue:Init(text, f, fs)
self.Offset = 2
self.SpeDraw = {}
local function GetColor(text)
local sp = 1
local ss, all_ = string.gsub(utf8.noutf8(text), '<', '<')
local all = 0
local col = {}
while all < all_ do
local s1, e1 = string.find(utf8.noutf8(text), '<', sp)
local s2, e2 = string.find(utf8.noutf8(text), '>', sp)
local color = utf8.sub(utf8.noutf8(text), s1+1, s2-1)
sp = e2 + 1
all = all + 1
table.insert(col, {color, e2})
end
return col
end
local function Split(str, char)
local t = {}
local eP = 0
for i=1,utf8.len(str) do
if utf8.sub(str,i,i) == char then
table.insert(t,utf8.sub(str,eP+1,i-1))
eP = i
end
end
table.insert(t,utf8.sub(str,eP+1,-1))
return t
end
self.Done = false
self.UnTypeText = text
self.Time = 2
self.Count = 0
self.TextNum = 0
self.FontScale = fs or 1
self.Font = f or GLOBAL_UT_BATTLE.Font
self.Colors = GetColor(self.UnTypeText)
self.Char = {}
self.CharColor = {1,1,1,1}
self.ColorCount = #self.Colors-1
self.Text = self.UnTypeText
self.x = 0
self.y = 0
self.TextX = 0
self.TextY = 0
self.Alpha = 1
self.CanSkip = false
for k, v in pairs(self.Colors) do
self.Text = string.gsub(self.Text, '<' .. v[1] .. '>', '')
local rgba = Split(v[1], ',')
for _, V in pairs(rgba) do
V = tonumber(V) or 0
end
v.color = rgba
end
end
function Dialogue:AddChar(dt)
self.Count = self.Count + dt
if self.Count >= self.Time*dt then
self.Count = 0
self.TextNum = self.TextNum + 1
local char = utf8.sub(self.Text, self.TextNum, self.TextNum)
self.TextX = self.TextX + self.Font:getWidth(utf8.sub(self.Text, self.TextNum-1, self.TextNum-1) or "a")*self.FontScale
if char == '/' then
self.TextX = 0
self.TextY = self.TextY + self.Font:getHeight()*self.FontScale
else
for k, v in pairs(self.Colors) do
local s = 0
for i = 1, #self.Colors - self.ColorCount do
s = s + 2 + #self.Colors[i][1]
end
if self.TextNum+s-1 == v[2] then
self.ColorCount = self.ColorCount - 1
if self.ColorCount < 0 then
self.ColorCount = #self.Colors-1
end
self.CharColor = v.color
end
end
table.insert(self.Char,
{
char = char,
x = self.TextX,
y = self.TextY,
xs = self.TextX,
ys = self.TextY,
i = 0,
color = self.CharColor,
t = love.math.random(25, 100),
a = love.math.random(0, 360)
})
end
end
end
function Dialogue:Update(dt)
if not self.Done then
for k,v in pairs(self.Char) do
v.i = v.i + dt
if v.i >= v.t*dt then
v.i = 0
if v.x == v.xs and v.y == v.ys then
v.x = v.xs + math.sin(v.a)*self.Offset
v.y = v.ys + math.cos(v.a)*self.Offset
v.t = 5
else
v.x = v.xs
v.y = v.ys
v.t = love.math.random(50, 150)
v.a = love.math.random(0, 360)
end
end
end
if self.TextNum < utf8.len(self.Text) then
self:AddChar(dt)
end
if self.CanSkip then
if GLOBAL_UT_BATTLE.PressedKey == Key.Exit then
repeat
self:AddChar(dt)
until (self.TextNum >= utf8.len(self.Text))
end
end
if self.TextNum >= utf8.len(self.Text) and GLOBAL_UT_BATTLE.PressedKey == Key.Enter then
self.Done = true
self.Alpha = 0
GLOBAL_UT_BATTLE.PressedKey = ""
else
GLOBAL_UT_BATTLE.PressedKey = ""
end
end
end
function Dialogue:Bubble()
end
function Dialogue:Draw()
love.graphics.setColor(1, 1, 1, self.Alpha)
love.graphics.setFont(self.Font)
self:Bubble()
love.graphics.translate(self.x, self.y)
for k, v in pairs(self.Char) do
love.graphics.setColor( unpack(v.color) )
love.graphics.print(v.char, v.x, v.y, 0, self.FontScale)
end
for k,v in pairs(self.SpeDraw) do
love.graphics.draw(v.Image, self.Char[v.num].x, self.Char[v.num].y, 0, self.FontScale)
end
love.graphics.translate(-self.x, -self.y)
end
return Dialogue |
local old_ptd002_init = PlayerTweakData.init
function PlayerTweakData:init(tweak_data)
old_ptd002_init(self, tweak_data)
self.damage.DOWNED_TIME = 60
end |
modifier_flying_for_pathing = class( {} )
function modifier_flying_for_pathing:CheckState()
local state = {
[MODIFIER_STATE_FLYING_FOR_PATHING_PURPOSES_ONLY] = true
}
return state
end
function modifier_flying_for_pathing:IsHidden()
return true
end
function modifier_flying_for_pathing:IsPurgable()
return false
end
function modifier_flying_for_pathing:IsPurgeException()
return false
end
function modifier_flying_for_pathing:IsStunDebuff()
return false
end
function modifier_flying_for_pathing:IsDebuff()
return false
end
|
local platform = ...
loadfile(RootDirectory .. "ProjectGen\\Middlewares\\assimp.lua")(platform)
loadfile(RootDirectory .. "ProjectGen\\Middlewares\\rapidjson.lua")(platform) |
local mongo = require('mongo');
local inspect = require('inspect');
function db (config)
local db = mongo.Connection.New();
db:connect(config.db.host);
function getIncomingExtensions ()
local query = db:query("viola.incoming");
local exts = {};
for result in query:results() do
exts[result.extension] = result;
end;
return exts;
end;
function findDeviceByExtension (extension)
app.noop('extension for find'..extension);
local cursor = db:query("viola.extensions", {
extension = extension
});
local item = cursor:next();
local device;
if (item) then
device = item.device;
app.noop("device: "..inspect(device));
end;
return device;
end;
function findMobileByExtension (extension)
app.noop('extension for find: '..extension);
local cursor = db:query("viola.extensions", {
extension = string.sub(extension, 2);
});
local item = cursor:next();
local mobile;
if (item) then
mobile = item.mobile;
app.noop("mobile: "..inspect(mobile));
end;
return mobile;
end;
function checkRecord (peername)
local device = 'SIP/'..peername;
app.noop(device)
local cursor = db:query("viola.extensions", {
device = device
});
local item = cursor:next();
app.noop(item)
local record;
if (item) then
record = item.record;
end;
app.noop("record: "..record);
return record;
end;
function findIVRByExtension (extension)
app.noop('extension for find in ivr: '..extension);
local cursor = db:query("viola.ivr", {
extension = extension
});
local item = cursor:next();
local menu;
if (item) then
menu = item;
app.noop("ivr menu: "..inspect(menu));
end;
return menu;
end;
function findTimeByExtension(extension)
app.noop("time"..extension);
local cursor = db:query("viola.times", {
extension = extension
});
local item = cursor:next();
local time;
if (item) then
time = item;
app.noop("time: "..inspect(time));
end;
return time;
end;
function findQueueByExtension (extension)
app.noop('extension for find in queue: '..extension);
local cursor = db:query("viola.queue", {
extension = extension
});
local item = cursor:next();
local queue;
if (item) then
queue = item;
app.noop("queue: "..inspect(queue));
end;
return queue;
end;
return {
["findDeviceByExtension"] = findDeviceByExtension;
["findMobileByExtension"] = findMobileByExtension;
["checkRecord"] = checkRecord;
["findIVRByExtension"] = findIVRByExtension;
["findQueueByExtension"] = findQueueByExtension;
["getIncomingExtensions"] = getIncomingExtensions;
["findTimeByExtension"] = findTimeByExtension;
};
end;
return db; |
character = {
[104001] = { name = 30001, description = 35001, itemtype = 1, vocation = 1, camp = 1, quality = 4, maxquality = 4, skill1 = { {1, 511}, }, skill2 = { {21, 521}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 1, }, },
[107001] = { name = 30002, description = 35002, itemtype = 1, vocation = 1, camp = 1, quality = 7, maxquality = 11, skill1 = { {1, 511}, {61, 512}, {121, 513}, }, skill2 = { {21, 521}, {81, 522}, {141, 523}, }, skill3 = { {41, 531}, {101, 532}, {161, 533}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 2, }, },
[107002] = { name = 30003, description = 35003, itemtype = 1, vocation = 3, camp = 1, quality = 7, maxquality = 11, skill1 = { {1, 511}, {61, 512}, {121, 513}, }, skill2 = { {21, 521}, {81, 522}, {141, 523}, }, skill3 = { {41, 531}, {101, 532}, {161, 533}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 3, }, },
[107003] = { name = 30004, description = 35004, itemtype = 1, vocation = 4, camp = 1, quality = 7, maxquality = 11, skill1 = { {1, 511}, {61, 512}, {121, 513}, }, skill2 = { {21, 521}, {81, 522}, {141, 523}, }, skill3 = { {41, 531}, {101, 532}, {161, 533}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 4, }, },
[110001] = { name = 30005, description = 35005, itemtype = 1, vocation = 2, camp = 1, quality = 10, maxquality = 18, skill1 = { {1, 511}, {81, 512}, {161, 513}, }, skill2 = { {21, 521}, {101, 522}, {181, 523}, {241, 524}, }, skill3 = { {41, 531}, {121, 532}, {201, 533}, {261, 534}, }, skill4 = { {61, 541}, {141, 542}, {221, 543}, {281, 544}, }, skill6 = { {10, 511}, {11, 512}, }, attribute1 = { {1, 113}, {2, 25}, {4, 18}, {5, 31}, {16, 1000}, {8, 1000}, {25, 2}, {13, 90}, }, gender = 1, handbookhero_id = { 5, }, },
[110002] = { name = 30006, description = 35006, itemtype = 1, vocation = 3, camp = 1, quality = 10, maxquality = 18, skill1 = { {1, 611}, {81, 612}, {161, 613}, {241, 614}, }, skill2 = { {21, 621}, {101, 622}, {181, 623}, {261, 624}, }, skill3 = { {41, 631}, {121, 632}, {201, 633}, {281, 634}, }, skill4 = { {61, 641}, {141, 642}, {221, 643}, }, skill6 = { {10, 511}, {11, 512}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 6, }, },
[110003] = { name = 30007, description = 35007, itemtype = 1, vocation = 1, camp = 1, quality = 10, maxquality = 18, skill1 = { {1, 611}, {81, 612}, {161, 613}, {241, 614}, }, skill2 = { {21, 621}, {101, 622}, {181, 623}, }, skill3 = { {41, 631}, {121, 632}, {201, 633}, {261, 634}, }, skill4 = { {61, 641}, {141, 642}, {221, 643}, {281, 644}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 7, }, },
[110004] = { name = 30008, description = 35008, itemtype = 1, vocation = 4, camp = 1, quality = 10, maxquality = 18, skill1 = { {1, 611}, {81, 612}, {161, 613}, {241, 614}, }, skill2 = { {21, 621}, {101, 622}, {181, 623}, {261, 624}, }, skill3 = { {41, 631}, {121, 632}, {201, 633}, {281, 634}, }, skill4 = { {61, 641}, {141, 642}, {221, 643}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 8, }, },
[110005] = { name = 30009, description = 35009, itemtype = 1, vocation = 1, camp = 1, quality = 10, maxquality = 18, skill1 = { {1, 611}, {81, 612}, {161, 613}, {241, 614}, }, skill2 = { {21, 621}, {101, 622}, {181, 623}, {261, 624}, }, skill3 = { {41, 631}, {121, 632}, {201, 633}, }, skill4 = { {61, 641}, {141, 642}, {221, 643}, {281, 644}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 9, }, },
[113001] = { name = 30010, description = 35010, itemtype = 1, vocation = 1, camp = 1, quality = 13, maxquality = 18, skill1 = { {1, 611}, {21, 612}, {121, 613}, {221, 614}, }, skill2 = { {1, 621}, {41, 622}, {141, 623}, {241, 624}, }, skill3 = { {1, 631}, {61, 632}, {161, 633}, {261, 634}, }, skill4 = { {1, 641}, {81, 642}, {181, 643}, {281, 644}, }, skill5 = { {1, 651}, {101, 652}, {201, 653}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 10, }, },
[113002] = { name = 30011, description = 35011, itemtype = 1, vocation = 2, camp = 1, quality = 13, maxquality = 18, skill1 = { {1, 611}, {21, 612}, {121, 613}, }, skill2 = { {1, 621}, {41, 622}, {141, 623}, {221, 624}, }, skill3 = { {1, 631}, {61, 632}, {161, 633}, {241, 634}, }, skill4 = { {1, 641}, {81, 642}, {181, 643}, {261, 644}, }, skill5 = { {1, 651}, {101, 652}, {201, 653}, {281, 654}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 11, }, },
[113003] = { name = 30012, description = 35012, itemtype = 1, vocation = 1, camp = 1, quality = 13, maxquality = 18, skill1 = { {1, 611}, {21, 612}, {121, 613}, {221, 614}, }, skill2 = { {1, 621}, {41, 622}, {141, 623}, {241, 624}, }, skill3 = { {1, 631}, {61, 632}, {161, 633}, {261, 634}, }, skill4 = { {1, 641}, {81, 642}, {181, 643}, }, skill5 = { {1, 651}, {101, 652}, {201, 653}, {281, 654}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 12, }, },
[113004] = { name = 30013, description = 35013, itemtype = 1, vocation = 1, camp = 1, quality = 13, maxquality = 18, skill1 = { {1, 611}, {21, 612}, {121, 613}, {221, 614}, }, skill2 = { {1, 621}, {41, 622}, {141, 623}, {241, 624}, }, skill3 = { {1, 631}, {61, 632}, {161, 633}, {261, 634}, }, skill4 = { {1, 641}, {81, 642}, {181, 643}, {281, 644}, }, skill5 = { {1, 651}, {101, 652}, {201, 653}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 13, }, },
[113005] = { name = 30014, description = 35014, itemtype = 1, vocation = 3, camp = 1, quality = 13, maxquality = 18, skill1 = { {1, 611}, {21, 612}, {121, 613}, {221, 614}, }, skill2 = { {1, 621}, {41, 622}, {141, 623}, {241, 624}, }, skill3 = { {1, 631}, {61, 632}, {161, 633}, {261, 634}, }, skill4 = { {1, 641}, {81, 642}, {181, 643}, {281, 644}, }, skill5 = { {1, 651}, {101, 652}, {201, 653}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 2, handbookhero_id = { 14, }, },
[113006] = { name = 30015, description = 35015, itemtype = 1, vocation = 4, camp = 1, quality = 13, maxquality = 18, skill1 = { {1, 611}, {21, 612}, {121, 613}, {221, 614}, }, skill2 = { {1, 621}, {41, 622}, {141, 623}, {241, 624}, }, skill3 = { {1, 631}, {61, 632}, {161, 633}, {261, 634}, }, skill4 = { {1, 641}, {81, 642}, {181, 643}, {281, 644}, }, skill5 = { {1, 651}, {101, 652}, {201, 653}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 2, handbookhero_id = { 15, }, },
[113007] = { name = 30016, description = 35016, itemtype = 1, vocation = 2, camp = 1, quality = 13, maxquality = 18, skill1 = { {1, 611}, {21, 612}, {121, 613}, {221, 614}, }, skill2 = { {1, 621}, {41, 622}, {141, 623}, {241, 624}, }, skill3 = { {1, 631}, {61, 632}, {161, 633}, {261, 634}, }, skill4 = { {1, 641}, {81, 642}, {181, 643}, {281, 644}, }, skill5 = { {1, 651}, {101, 652}, {201, 653}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 16, }, },
[204001] = { name = 30017, description = 35017, itemtype = 1, vocation = 3, camp = 2, quality = 4, maxquality = 4, skill1 = { {1, 611}, }, skill2 = { {21, 621}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 17, }, },
[207001] = { name = 30018, description = 35018, itemtype = 1, vocation = 3, camp = 2, quality = 7, maxquality = 11, skill1 = { {1, 611}, {61, 612}, {121, 613}, }, skill2 = { {21, 621}, {81, 622}, {141, 623}, }, skill3 = { {41, 631}, {101, 632}, {161, 633}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 18, }, },
[207002] = { name = 30019, description = 35019, itemtype = 1, vocation = 1, camp = 2, quality = 7, maxquality = 11, skill1 = { {1, 611}, {61, 612}, {121, 613}, }, skill2 = { {21, 621}, {81, 622}, {141, 623}, }, skill3 = { {41, 631}, {101, 632}, {161, 633}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 19, }, },
[207003] = { name = 30020, description = 35020, itemtype = 1, vocation = 1, camp = 2, quality = 7, maxquality = 11, skill1 = { {1, 611}, {61, 612}, {121, 613}, }, skill2 = { {21, 621}, {81, 622}, {141, 623}, }, skill3 = { {41, 631}, {101, 632}, {161, 633}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 20, }, },
[210001] = { name = 30021, description = 35021, itemtype = 1, vocation = 1, camp = 2, quality = 10, maxquality = 18, skill1 = { {1, 2111}, {81, 2112}, {161, 2113}, }, skill2 = { {21, 2121}, {101, 2122}, {181, 2123}, {241, 2124}, }, skill3 = { {41, 2131}, {121, 2132}, {201, 2133}, {261, 2134}, }, skill4 = { {61, 2141}, {141, 2142}, {221, 2143}, {281, 2144}, }, skill6 = { {10, 511}, {11, 512}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 21, }, },
[210002] = { name = 30022, description = 35022, itemtype = 1, vocation = 4, camp = 2, quality = 10, maxquality = 18, skill1 = { {1, 2211}, {81, 2212}, {161, 2213}, {241, 2214}, }, skill2 = { {21, 2221}, {101, 2222}, {181, 2223}, {261, 2224}, }, skill3 = { {41, 2231}, {121, 2232}, {201, 2233}, {281, 2234}, }, skill4 = { {61, 2241}, {141, 2242}, {221, 2243}, }, skill6 = { {10, 511}, {11, 512}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 22, }, },
[210003] = { name = 30023, description = 35023, itemtype = 1, vocation = 3, camp = 2, quality = 10, maxquality = 18, skill1 = { {1, 2211}, {81, 2212}, {161, 2213}, {241, 2214}, }, skill2 = { {21, 2221}, {101, 2222}, {181, 2223}, }, skill3 = { {41, 2231}, {121, 2232}, {201, 2233}, {261, 2234}, }, skill4 = { {61, 2241}, {141, 2242}, {221, 2243}, {281, 2244}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 3, handbookhero_id = { 23, }, },
[213001] = { name = 30024, description = 35024, itemtype = 1, vocation = 2, camp = 2, quality = 13, maxquality = 18, skill1 = { {1, 2211}, {21, 2212}, {121, 2213}, }, skill2 = { {1, 2221}, {41, 2222}, {141, 2223}, {221, 2224}, }, skill3 = { {1, 2231}, {61, 2232}, {161, 2233}, {241, 2234}, }, skill4 = { {1, 2241}, {81, 2242}, {181, 2243}, {261, 2244}, }, skill5 = { {1, 2251}, {101, 2252}, {201, 2253}, {281, 2254}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 24, }, },
[213002] = { name = 30025, description = 35025, itemtype = 1, vocation = 3, camp = 2, quality = 13, maxquality = 18, skill1 = { {1, 2211}, {21, 2212}, {121, 2213}, {221, 2214}, }, skill2 = { {1, 2221}, {41, 2222}, {141, 2223}, {241, 2224}, }, skill3 = { {1, 2231}, {61, 2232}, {161, 2233}, {261, 2234}, }, skill4 = { {1, 2241}, {81, 2242}, {181, 2243}, {281, 2244}, }, skill5 = { {1, 2251}, {101, 2252}, {201, 2253}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 25, }, },
[213003] = { name = 30026, description = 35026, itemtype = 1, vocation = 4, camp = 2, quality = 13, maxquality = 18, skill1 = { {1, 2211}, {21, 2212}, {121, 2213}, {221, 2214}, }, skill2 = { {1, 2221}, {41, 2222}, {141, 2223}, {241, 2224}, }, skill3 = { {1, 2231}, {61, 2232}, {161, 2233}, {261, 2234}, }, skill4 = { {1, 2241}, {81, 2242}, {181, 2243}, {281, 2244}, }, skill5 = { {1, 2251}, {101, 2252}, {201, 2253}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 26, }, },
[213004] = { name = 30027, description = 35027, itemtype = 1, vocation = 1, camp = 2, quality = 13, maxquality = 18, skill1 = { {1, 2211}, {21, 2212}, {121, 2213}, {221, 2214}, }, skill2 = { {1, 2221}, {41, 2222}, {141, 2223}, {241, 2224}, }, skill3 = { {1, 2231}, {61, 2232}, {161, 2233}, {261, 2234}, }, skill4 = { {1, 2241}, {81, 2242}, {181, 2243}, {281, 2244}, }, skill5 = { {1, 2251}, {101, 2252}, {201, 2253}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 27, }, },
[213005] = { name = 30028, description = 35028, itemtype = 1, vocation = 3, camp = 2, quality = 13, maxquality = 18, skill1 = { {1, 2211}, {21, 2212}, {121, 2213}, }, skill2 = { {1, 2221}, {41, 2222}, {141, 2223}, {221, 2224}, }, skill3 = { {1, 2231}, {61, 2232}, {161, 2233}, {241, 2234}, }, skill4 = { {1, 2241}, {81, 2242}, {181, 2243}, {261, 2244}, }, skill5 = { {1, 2251}, {101, 2252}, {201, 2253}, {281, 2254}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 28, }, },
[304001] = { name = 30029, description = 35029, itemtype = 1, vocation = 2, camp = 3, quality = 4, maxquality = 4, skill1 = { {1, 2211}, }, skill2 = { {21, 2221}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 29, }, },
[307001] = { name = 30030, description = 35030, itemtype = 1, vocation = 4, camp = 3, quality = 7, maxquality = 11, skill1 = { {1, 2211}, {61, 2212}, {121, 2213}, }, skill2 = { {21, 2221}, {81, 2222}, {141, 2223}, }, skill3 = { {41, 2231}, {101, 2232}, {161, 2233}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 30, }, },
[307002] = { name = 30031, description = 35031, itemtype = 1, vocation = 1, camp = 3, quality = 7, maxquality = 11, skill1 = { {1, 2211}, {61, 2212}, {121, 2213}, }, skill2 = { {21, 2221}, {81, 2222}, {141, 2223}, }, skill3 = { {41, 2231}, {101, 2232}, {161, 2233}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 31, }, },
[310001] = { name = 30032, description = 35032, itemtype = 1, vocation = 2, camp = 3, quality = 10, maxquality = 18, skill1 = { {1, 2211}, {81, 2212}, {161, 2213}, {241, 2214}, }, skill2 = { {21, 2221}, {101, 2222}, {181, 2223}, {261, 2224}, }, skill3 = { {41, 2231}, {121, 2232}, {201, 2233}, }, skill4 = { {61, 2241}, {141, 2242}, {221, 2243}, {281, 2244}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 32, }, },
[310002] = { name = 30033, description = 35033, itemtype = 1, vocation = 3, camp = 3, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, {241, 3314}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {261, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, {281, 3344}, }, skill6 = { {10, 511}, {11, 512}, }, attribute1 = { {1, 113}, {2, 25}, {4, 18}, {5, 31}, {16, 1000}, {8, 1000}, {25, 2}, {13, 90}, }, gender = 1, handbookhero_id = { 33, }, },
[310003] = { name = 30034, description = 35034, itemtype = 1, vocation = 4, camp = 3, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, {241, 3314}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {261, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {281, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 34, }, },
[310004] = { name = 30035, description = 35035, itemtype = 1, vocation = 1, camp = 3, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {241, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {261, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, {281, 3344}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 35, }, },
[313001] = { name = 30036, description = 35036, itemtype = 1, vocation = 2, camp = 3, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, {221, 3314}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {241, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {261, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, {281, 3354}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 2, handbookhero_id = { 36, }, },
[313002] = { name = 30037, description = 35037, itemtype = 1, vocation = 4, camp = 3, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, {221, 3314}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {241, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {261, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, {281, 3354}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 2, handbookhero_id = { 37, }, },
[313003] = { name = 30038, description = 35038, itemtype = 1, vocation = 3, camp = 3, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {241, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {261, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, {281, 3344}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 2, handbookhero_id = { 38, }, },
[313004] = { name = 30039, description = 35039, itemtype = 1, vocation = 2, camp = 3, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, {221, 3314}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {241, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {261, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, {281, 3354}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 39, }, },
[404001] = { name = 30040, description = 35040, itemtype = 1, vocation = 4, camp = 4, quality = 4, maxquality = 4, skill1 = { {1, 3311}, }, skill2 = { {21, 3321}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 2, handbookhero_id = { 40, }, },
[407001] = { name = 30041, description = 35041, itemtype = 1, vocation = 4, camp = 4, quality = 7, maxquality = 11, skill1 = { {1, 3311}, {61, 3312}, {121, 3313}, }, skill2 = { {21, 3321}, {81, 3322}, {141, 3323}, }, skill3 = { {41, 3331}, {101, 3332}, {161, 3333}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 2, handbookhero_id = { 41, }, },
[407002] = { name = 30042, description = 35042, itemtype = 1, vocation = 4, camp = 4, quality = 7, maxquality = 11, skill1 = { {1, 3311}, {61, 3312}, {121, 3313}, }, skill2 = { {21, 3321}, {81, 3322}, {141, 3323}, }, skill3 = { {41, 3331}, {101, 3332}, {161, 3333}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 2, handbookhero_id = { 42, }, },
[410001] = { name = 30043, description = 35043, itemtype = 1, vocation = 3, camp = 4, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, {241, 3314}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {261, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {281, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, }, attribute1 = { {1, 108}, {3, 31}, {4, 18}, {5, 29}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 43, }, },
[410002] = { name = 30044, description = 35044, itemtype = 1, vocation = 2, camp = 4, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, {241, 3314}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {261, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {281, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, }, attribute1 = { {1, 113}, {2, 25}, {4, 18}, {5, 31}, {16, 1000}, {8, 1000}, {25, 2}, {13, 90}, }, gender = 2, handbookhero_id = { 44, }, },
[410003] = { name = 30045, description = 35045, itemtype = 1, vocation = 1, camp = 4, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {241, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {261, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, {281, 3344}, }, attribute1 = { {1, 119}, {2, 21}, {4, 50}, {5, 33}, {16, 1000}, {8, 1000}, {25, 2}, {13, 73}, }, gender = 1, handbookhero_id = { 45, }, },
[410004] = { name = 30046, description = 35046, itemtype = 1, vocation = 4, camp = 4, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, {241, 3314}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {261, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {281, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 46, }, },
[413001] = { name = 30047, description = 35047, itemtype = 1, vocation = 4, camp = 4, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, {241, 3314}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {261, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {281, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 47, }, },
[413002] = { name = 30048, description = 35048, itemtype = 1, vocation = 4, camp = 4, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, {221, 3314}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {241, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {261, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, {281, 3354}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 48, }, },
[413003] = { name = 30049, description = 35049, itemtype = 1, vocation = 3, camp = 4, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, {221, 3314}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {241, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {261, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {281, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 49, }, },
[413004] = { name = 30050, description = 35050, itemtype = 1, vocation = 3, camp = 4, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {221, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {241, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {261, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, {281, 3354}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 50, }, },
[413005] = { name = 30051, description = 35051, itemtype = 1, vocation = 2, camp = 4, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, {221, 3314}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {241, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {261, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {281, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 51, }, },
[510001] = { name = 30052, description = 35052, itemtype = 1, vocation = 4, camp = 5, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {241, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {261, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, {281, 3344}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 52, }, },
[510002] = { name = 30053, description = 35053, itemtype = 1, vocation = 2, camp = 5, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {241, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {261, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, {281, 3344}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 53, }, },
[510003] = { name = 30054, description = 35054, itemtype = 1, vocation = 1, camp = 5, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, {241, 3314}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {261, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, {281, 3344}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 54, }, },
[513001] = { name = 30055, description = 35055, itemtype = 1, vocation = 4, camp = 5, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {221, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {241, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {261, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, {281, 3354}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 55, }, },
[513002] = { name = 30056, description = 35056, itemtype = 1, vocation = 4, camp = 5, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {221, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {241, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {261, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, {281, 3354}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 56, }, },
[513003] = { name = 30057, description = 35057, itemtype = 1, vocation = 4, camp = 5, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, {221, 3314}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {241, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {261, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {281, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 57, }, },
[513004] = { name = 30058, description = 35058, itemtype = 1, vocation = 4, camp = 5, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {221, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {241, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {261, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, {281, 3354}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 58, }, },
[610001] = { name = 30059, description = 35059, itemtype = 1, vocation = 4, camp = 6, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, {241, 3314}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {261, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {281, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 59, }, },
[610002] = { name = 30060, description = 35060, itemtype = 1, vocation = 2, camp = 6, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, {241, 3314}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {261, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {281, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 60, }, },
[610003] = { name = 30061, description = 35061, itemtype = 1, vocation = 1, camp = 6, quality = 10, maxquality = 18, skill1 = { {1, 3311}, {81, 3312}, {161, 3313}, }, skill2 = { {21, 3321}, {101, 3322}, {181, 3323}, {241, 3324}, }, skill3 = { {41, 3331}, {121, 3332}, {201, 3333}, {261, 3334}, }, skill4 = { {61, 3341}, {141, 3342}, {221, 3343}, {281, 3344}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 61, }, },
[613001] = { name = 30062, description = 35062, itemtype = 1, vocation = 4, camp = 6, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, {221, 3314}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {241, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {261, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {281, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 62, }, },
[613002] = { name = 30063, description = 35063, itemtype = 1, vocation = 4, camp = 6, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, {221, 3314}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {241, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {261, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {281, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 1, handbookhero_id = { 63, }, },
[613003] = { name = 30064, description = 35064, itemtype = 1, vocation = 4, camp = 6, quality = 13, maxquality = 18, skill1 = { {1, 3311}, {21, 3312}, {121, 3313}, {221, 3314}, }, skill2 = { {1, 3321}, {41, 3322}, {141, 3323}, {241, 3324}, }, skill3 = { {1, 3331}, {61, 3332}, {161, 3333}, {261, 3334}, }, skill4 = { {1, 3341}, {81, 3342}, {181, 3343}, {281, 3344}, }, skill5 = { {1, 3351}, {101, 3352}, {201, 3353}, }, attribute1 = { {1, 115}, {3, 23}, {4, 19}, {5, 35}, {16, 1000}, {8, 1000}, {25, 2}, {13, 80}, }, gender = 2, handbookhero_id = { 64, }, },
}
return character
|
local ui = script.Parent.Parent
local Roact = require(game.ReplicatedStorage.Roact)
local Common = game.ReplicatedStorage.Pioneers.Common
local Client = ui.Parent
local RunService = game:GetService("RunService")
local ViewWorld = require(Client.ViewWorld)
local TileMarker = Roact.Component:extend("TileMarker")
function TileMarker:init()
end
function TileMarker:render()
local children = {}
local inst = self.props.inst:getValue()
if not inst then return end
children.Marker = Roact.createElement("ImageLabel", {
Name = "TileMarker",
BackgroundTransparency = 1,
Position = UDim2.new(0.5, 0, 0.5, 0),
Size = UDim2.new(1, 0, 1, 0),
AnchorPoint = Vector2.new(0.5, 0.5),
Image = self.props.imageId,
ImageTransparency = 0,
})
return Roact.createElement("BillboardGui", {
Adornee = inst,
Size = UDim2.new(10, 0, 10, 0),
AlwaysOnTop = true,
}, children)
end
function TileMarker:didMount()
end
function TileMarker:willUnmount()
end
return TileMarker
|
--[[
This module provides additional randomness-related functions, e.g. enerating continuous noise.
]]
--luacheck: no max line length
local random = {}
function random.new_rng()
local rng = {}
-- initialize the seedbox to random values
function rng:seed()
local seedbox = {}
for i=0, 255 do
seedbox[i] = math.random()
end
self.seedbox = seedbox
end
-- return a random number for i
function rng:noise_1d(i)
local seed_index = math.floor(i)%255
return self.seedbox[seed_index]
end
-- simple 1D continuous noise function
function rng:continuous_noise_1d(f)
local a,b = self:noise_1d(f), self:noise_1d(f+1)
local p = f%1
local v = (p*b)+((1-p)*a)
return v
end
-- return a random number for x,y
function rng:noise_2d(x,y)
local seed_index = math.floor((x + y*15731)%255)
return self.seedbox[seed_index]
end
-- simple 2D continuous noise function
function rng:continuous_noise_2d(x,y)
local xi,xf = math.floor(x), x%1
local yi,yf = math.floor(y), y%1
local n00 = self:noise_2d(xi,yi)
local n01 = self:noise_2d(xi,yi+1)
local n10 = self:noise_2d(xi+1,yi)
local n11 = self:noise_2d(xi+1,yi+1)
local nx = (n11*yf)+(n10*(1-yf))
local ny = (n01*yf)+(n00*(1-yf))
local v = (nx*xf)+(ny*(1-xf))
return v
end
return rng
end
return random
|
local data = require("internal.data")
local i18n = require("internal.i18n.init")
local Chara = require("api.Chara")
local Rand = require("api.Rand")
local I18N = require("api.I18N")
local WeightedSampler = require("mod.tools.api.WeightedSampler")
local Log = require("api.Log")
local Talk = {}
Talk.DEFAULT_RANDOM_WEIGHT = 10
local env_fns = {}
function env_fns.name(obj, ignore_sight)
local env = i18n.env
if ignore_sight == nil then
ignore_sight = true
end
return env.name(obj, ignore_sight)
end
function env_fns.player()
local player = Chara.player()
if player then
return player:calc("name")
else
return ""
end
end
function env_fns.aka()
local player = Chara.player()
if player then
return player:calc("title")
else
return ""
end
end
local function gen_env()
return {
i18n = i18n.env,
name = env_fns.name,
player = env_fns.player,
aka = env_fns.aka
}
end
function Talk.gen_text(chara, talk_event_id, args)
local tone = chara:calc("tone")
if type(tone) == "nil" then
return
elseif type(tone) == "string" then
tone = { tone }
end
assert(type(tone) == "table")
data["base.talk_event"]:ensure(talk_event_id)
local cands = {}
for _, tone_id in ipairs(tone) do
local tone_proto = data["base.tone"][tone_id]
if tone_proto then
local lang = tone_proto.texts[I18N.language()]
if lang then
local texts = lang[talk_event_id]
if texts then
for _, cand in ipairs(texts) do
cands[#cands+1] = { tone_id = tone_id, cand = cand }
end
end
end
else
Log.error("Missing custom talk tone '%s'", tone_id)
end
end
local sampler = WeightedSampler:new()
for _, entry in ipairs(cands) do
local tone_id = entry.tone_id
local cand = entry.cand
local ty = type(cand)
local weight = Talk.DEFAULT_RANDOM_WEIGHT
if ty == "string" or ty == "function" then
elseif ty == "table" then
if cand.pred == nil or cand.pred(chara, args) then
if type(cand[1]) == "string" then
cand = cand
else
cand = cand
weight = cand.weight or weight
end
end
else
error("Unknown talk text of type " .. ty .. "(" .. tone_id .. ")")
end
sampler:add(cand, weight)
end
if sampler:len() == 0 then
return nil
end
local result = sampler:sample()
local ty = type(result)
local locale_data = nil
local env = gen_env()
local function get_text(r)
local text
if ty == "string" then
text = r
elseif ty == "function" then
locale_data = locale_data or chara:produce_locale_data()
text = r(locale_data, env, args, chara)
elseif ty == "table" then
local choice = Rand.choice(r)
if choice then
text = get_text(r)
end
else
error("Unknown talk text of type " .. ty)
end
return text
end
return get_text(result)
end
function Talk.say(chara, talk_event_id, args, opts)
local text = Talk.gen_text(chara, talk_event_id, args)
if text then
local color = opts and opts.color
if color == nil then
color = "SkyBlue"
end
chara:mes_c(text, color)
end
return text
end
return Talk
|
-- Chatpic lets us print out obnoxious pictures using raid icons.
--
-- Specifically, it provides a place for pictures and sets. Pictures
-- are tables of strings that describe an image. The symbols that the
-- picture uses are interpreted by the set. For example:
--
-- Chatpic.set.banner={
-- ["_"]="{square}",
-- ["0"]="{circle}",
-- };
--
-- Chatpic.banner={
-- "_0_0_0_0_",
-- set="banner"
-- };
--
-- Chatpic.banner(Chat.g);
--
-- This describes a simple one-line picture. This will print a line of alternating
-- square and circle raid marks to your guild. The _ and 0 will be converted according
-- to the provided set. Characters that aren't in the set will be printed directly.
--
-- We don't need to provide a picture if we have a set. In the above case, we could
-- also do this:
--
-- Chatpic.set.banner("_0_0_0_0_", Chat.g);
--
-- which will yield the same result.
--
-- Most of Chatpic's grunt work is actually done by String.Transform. Chatpic just provides
-- a place to store sets and pictures, along with some metatable magic to make it convenient
-- to use. To continue our example, we could have just done this:
--
-- Chat.g(String.Transform("_0_0_0_0_", Chatpic.set.banner));
--
-- which also prints the same thing.
--
-- Chatpic doesn't come with a slash command, though it would be easy to provide one.
--
-- Slash.Register("cp", function(msg, editbox)
-- Chatpic[msg](Chat[editbox]);
-- end);
--
-- Which will print the "fail" picture to whatever medium you're using, such as guild, party, etc.
if nil ~= require then
require "fritomod/basic";
require "fritomod/currying";
require "fritomod/Strings-Transform";
end;
local function OutputTransform(set, picture, out, ...)
out=Curry(out, ...);
local transformed=Strings.Transform(picture, set);
if type(transformed)=="table" then
for i=1,#transformed do
out(transformed[i]);
end;
else
out(transformed);
end;
end;
local sets=setmetatable({}, {
__index=function(self, k)
if IsCallable(k) then
return self[k()];
end;
return rawget(self, tostring(k):lower());
end,
__newindex=function(self, k, set)
k=tostring(k):lower();
assert(type(set)=="table", "Set must be a table");
local mt=getmetatable(set);
if not mt then
mt={};
setmetatable(set, mt);
end;
-- Calling a set lets you write using that set's transformations.
mt.__call=function(self, str, out, ...)
OutputTransform(set, str, out, ...);
end;
rawset(self, k, set);
end
});
Chatpic=setmetatable({}, {
__index=function(self, k)
if type(k)=="function" then
return self[k()];
elseif type(k)=="table" then
return function(output, ...)
output=Curry(output, ...);
for i=1, #k do
self[k[i]](output);
end;
end;
else
assert(k, "key was falsy");
k=tostring(k):lower();
end;
return rawget(self, k);
end,
__newindex=function(self, k, picture)
k=tostring(k):lower();
if IsCallable(picture) then
rawset(self, k, picture);
else
local mt=getmetatable(picture);
if not mt then
mt={};
setmetatable(picture, mt);
end;
-- Calling a picture draws that picture using the provided output function.
mt.__call=function(self, out, ...)
local set=picture.set;
if type(picture.set)~="table" then
set=assert(Chatpic.set[picture.set], "Not a valid set name: "..tostring(picture.set));
end;
OutputTransform(set, picture, out, ...);
end;
rawset(self, k, picture);
end;
end
});
rawset(Chatpic, "set", sets);
rawset(Chatpic, "sets", sets);
|
local PlayerGuiUtil = {}
local Player = game:GetService("Players").LocalPlayer
function PlayerGuiUtil.GetPlayerGui()
local PlayerGui = Player:WaitForChild("PlayerGui") -- it should return at some point
return PlayerGui
end
return PlayerGuiUtil |
--
-- Copyright 2019 The FATE Authors. All Rights Reserved.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
local _M = {
_VERSION = '0.1'
}
local string = require "string"
function _M.string_startswith(str, start)
return string.sub(str, 1, string.len(start)) == start
end
function _M.string_split(str, delimiter)
if str == nil or str == "" or delimiter==nil then
return nil
end
local result = {}
for match in (str..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match)
end
return result
end
return _M
|
{
scoreMode = "SHIELD",
useTraffic = false,
puzzleGrid = false,
jumpMode = Diff.JumpModes.NONE,
maxAccel = 18,
factAccel = 0.6,
minAccel = 0,
maxDoubleSpan = 1.5,
minDoubleSpan = 0.5,
maxCrosshandSpan = 1.0
}
|
local Class = require("lib.middleclass")
local Image = require 'image'
local Map = require("src.map")
local Pellet = Class("Pellet")
local Quad = require 'image.quad'
local Util = require("src.util")
local Vector = require("lib.vector")
function Pellet:initialize(x, y, frequency)
self.position = Vector(x, y)
self.frequency = frequency
self.animationPhase = love.math.random()
self.animationSpeed = Util.lerp(1/3, 1, love.math.random())
Map.add(self, self.position.x, self.position.y)
end
function Pellet:consume(snake)
if (self.frequency) then
snake:setFrequency(self.frequency)
end
Map.remove(self, self.position.x, self.position.y)
self.dead = true
end
function Pellet:update(dt)
self.animationPhase = self.animationPhase + self.animationSpeed * dt
while self.animationPhase >= 1 do
self.animationPhase = self.animationPhase - 1
end
end
function Pellet:draw()
if (self.dead) then -- TEMP
return
end
love.graphics.push("all")
local x, y = Util.gridToScreen(self.position:unpack())
if (self.frequency) then
love.graphics.setColor(self.frequency.r, self.frequency.g, self.frequency.b)
else
love.graphics.setColor(1, 1, 1, 1)
end
love.graphics.draw(Image.tileset, Quad.pellet, x, y + 4 * math.sin(self.animationPhase * 2 * math.pi))
love.graphics.pop()
end
return Pellet
|
require "lib.classes.class"
--------------------------------------------------------------------------------------------------------
-- class: BasicCutscene
-- param: scenes:BasicScene -> the scenes of the cutscene
-- A cutscene class with scenes
local BasicCutscene = class(function(self, scenes)
self.scenes = scenes
self.current_scene = 0
end)
-- advanceScene: None -> bool
-- advances to the next scene
function BasicCutscene.advanceScene(self)
if self.current_scene < # self.scenes then
self.current_scene = self.current_scene + 1
return true
else
self:resetCutscene()
return false
end
end
-- getCurrentScene: None -> BasicScene
-- Gets the cutscene's current scene
function BasicCutscene.getCurrentScene(self)
return self.scenes[self.current_scene]
end
-- resetCutscene: None -> None
-- resets the current cutscene to the first scene
function BasicCutscene.resetCutscene(self)
self.current_scene = 0
end
-- getter
function BasicCutscene.getScenes(self)
return self.scenes
end
return BasicCutscene |
Locales['fr'] = {
['shop'] = 'magasin',
['shops'] = 'magasins',
['press_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au magasin.',
['bought'] = 'vous avez acheté ~b~1x ',
['not_enough'] = 'vous n\'avez ~r~pas assez~s~ d\'argent.',
}
|
-- Item data (c) Grinding Gear Games
return {
-- Helmet
[[
Armour/Evasion Helmet
Penitent Mask
Crafted: true
Prefix: LocalBaseArmourAndEvasionRating3
Prefix: LocalIncreasedArmourAndEvasion5
Prefix: IncreasedLife7
]],[[
Evasion/Energy Shield Helmet
Blizzard Crown
Crafted: true
Prefix: LocalBaseEvasionRatingAndEnergyShield3
Prefix: LocalIncreasedEvasionAndEnergyShield5_
Prefix: IncreasedLife7
]],[[
Armour/Energy Shield Helmet
Archdemon Crown
Crafted: true
Prefix: LocalBaseArmourAndEnergyShield3
Prefix: LocalIncreasedArmourAndEnergyShield5
Prefix: IncreasedLife7
]],[[
Armour Helmet
Eternal Burgonet
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRating3
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife7
]],[[
Evasion Helmet
Lion Pelt
Crafted: true
Prefix: LocalIncreasedEvasionRating3
Prefix: LocalIncreasedEvasionRatingPercent5
Prefix: IncreasedLife7
]],[[
Energy Shield Helmet
Hubris Circlet
Crafted: true
Prefix: IncreasedLife7
Prefix: LocalIncreasedEnergyShieldPercent5
Prefix: LocalIncreasedEnergyShield7
]],[[
Armour/Evasion Helmet
Nightmare Bascinet
Crafted: true
Prefix: LocalBaseArmourAndEvasionRating3
Prefix: LocalIncreasedArmourAndEvasion5
Prefix: IncreasedLife7
]],[[
Armour/Energy Shield Helmet
Praetor Crown
Crafted: true
Prefix: LocalBaseArmourAndEnergyShield3
Prefix: LocalIncreasedArmourAndEnergyShield5
Prefix: IncreasedLife7
]],[[
Armour/Energy Shield Helmet
Bone Helmet
Crafted: true
Prefix: LocalBaseArmourAndEnergyShield3
Prefix: LocalIncreasedArmourAndEnergyShield5
Prefix: IncreasedLife7
]],[[
Evasion/Energy Shield Helmet
Deicide Mask
Crafted: true
Prefix: LocalBaseEvasionRatingAndEnergyShield3
Prefix: LocalIncreasedEvasionAndEnergyShield5_
Prefix: IncreasedLife7
]],[[
Ward Helmet
Runic Crown
Crafted: true
Prefix: LocalIncreasedWardPercent3
Prefix: LocalIncreasedWard5___
Prefix: IncreasedLife7
]],
-- Gloves
[[
Evasion Gloves
Sinistral Gloves
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRating2
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife6
]],[[
Energy Shield Gloves
Nexus Gloves
Crafted: true
Prefix: IncreasedLife6
Prefix: LocalIncreasedEnergyShieldPercent5
Prefix: LocalIncreasedEnergyShield6
]],[[
Armour Gloves
Debilitation Gauntlets
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRating2
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife6
]],[[
Armour/Energy Shield Gloves
Apothecary's Gloves
Crafted: true
Prefix: LocalBaseArmourAndEnergyShield2_
Prefix: LocalIncreasedArmourAndEnergyShield5
Prefix: IncreasedLife6
]],[[
Armour Gloves
Titan Gauntlets
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRating2
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife6
]],[[
Armour Gloves
Spiked Gloves
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRating2
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife6
]],[[
Evasion Gloves
Slink Gloves
Crafted: true
Prefix: LocalIncreasedEvasionRating2
Prefix: LocalIncreasedEvasionRatingPercent5
Prefix: IncreasedLife6
]],[[
Evasion Gloves
Gripped Gloves
Crafted: true
Prefix: LocalIncreasedEvasionRating2
Prefix: LocalIncreasedEvasionRatingPercent5
Prefix: IncreasedLife6
]],[[
Energy Shield Gloves
Sorcerer Gloves
Crafted: true
Prefix: IncreasedLife6
Prefix: LocalIncreasedEnergyShieldPercent5
Prefix: LocalIncreasedEnergyShield6
]],[[
Energy Shield Gloves
Fingerless Silk Gloves
Crafted: true
Prefix: IncreasedLife6
Prefix: LocalIncreasedEnergyShieldPercent5
Prefix: LocalIncreasedEnergyShield6
]],[[
Armour/Evasion Gloves
Dragonscale Gauntlets
Crafted: true
Prefix: LocalBaseArmourAndEvasionRating2
Prefix: LocalIncreasedArmourAndEvasion5
Prefix: IncreasedLife6
]],[[
Armour/Energy Shield Gloves
Crusader Gloves
Crafted: true
Prefix: LocalBaseArmourAndEnergyShield2_
Prefix: LocalIncreasedArmourAndEnergyShield5
Prefix: IncreasedLife6
]],[[
Evasion/Energy Shield Gloves
Murder Mitts
Crafted: true
Prefix: LocalBaseEvasionRatingAndEnergyShield2
Prefix: LocalIncreasedEvasionAndEnergyShield5_
Prefix: IncreasedLife6
]],[[
Ward Gloves
Runic Gauntlets
Crafted: true
Prefix: LocalIncreasedWardPercent3
Prefix: LocalIncreasedWard5___
Prefix: IncreasedLife7
]],
-- Body Armour
[[
Armour Chest
Glorious Plate
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRating5
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife9
]],[[
Armour Chest
Astral Plate
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRating5
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife9
]],[[
Evasion Chest
Assassin's Garb
Crafted: true
Prefix: LocalIncreasedEvasionRating5
Prefix: LocalIncreasedEvasionRatingPercent5
Prefix: IncreasedLife9
]],[[
Evasion Chest
Zodiac Leather
Crafted: true
Prefix: LocalIncreasedEvasionRating5
Prefix: LocalIncreasedEvasionRatingPercent5
Prefix: IncreasedLife9
]],[[
Energy Shield Chest
Vaal Regalia
Crafted: true
Prefix: IncreasedLife9
Prefix: LocalIncreasedEnergyShieldPercent5
Prefix: LocalIncreasedEnergyShield10
]],[[
Armour/Evasion Chest
Triumphant Lamellar
Crafted: true
Prefix: LocalBaseArmourAndEvasionRating5
Prefix: LocalIncreasedArmourAndEvasion5
Prefix: IncreasedLife9
]],[[
Armour/Energy Shield Chest
Saintly Chainmail
Crafted: true
Prefix: LocalBaseArmourAndEnergyShield5
Prefix: LocalIncreasedArmourAndEnergyShield5
Prefix: IncreasedLife9
]],[[
Evasion/Energy Shield Chest
Carnal Armour
Crafted: true
Prefix: LocalBaseEvasionRatingAndEnergyShield5_
Prefix: LocalIncreasedEvasionAndEnergyShield5_
Prefix: IncreasedLife9
]],
-- Boots
[[
Evasion/Energy Shield Boots
Fugitive Boots
Crafted: true
Prefix: LocalIncreasedEvasionAndEnergyShield5_
Prefix: IncreasedLife6
Prefix: MovementVelocity5
Suffix: ChaosResist4
]],[[
Evasion Boots
Stormrider Boots
Crafted: true
Prefix: LocalIncreasedEvasionRatingPercent5
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Energy Shield Boots
Dreamquest Slippers
Crafted: true
Prefix: LocalIncreasedEnergyShieldPercent5
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Armour Boots
Brimstone Treads
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Armour Boots
Titan Greaves
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Evasion Boots
Slink Boots
Crafted: true
Prefix: LocalIncreasedEvasionRatingPercent5
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Energy Shield Boots
Sorcerer Boots
Crafted: true
Prefix: IncreasedLife6
Prefix: LocalIncreasedEnergyShieldPercent5
Prefix: MovementVelocity5
]],[[
Armour/Evasion Boots
Dragonscale Boots
Crafted: true
Prefix: LocalIncreasedArmourAndEvasion5
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Armour/Evasion Boots
Two-Toned Boots (Armour/Evasion)
Crafted: true
Prefix: LocalIncreasedArmourAndEvasion5
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Armour/Energy Shield Boots
Crusader Boots
Crafted: true
Prefix: LocalIncreasedArmourAndEnergyShield5
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Armour/Energy Shield Boots
Two-Toned Boots (Armour/Energy Shield)
Crafted: true
Prefix: LocalIncreasedArmourAndEnergyShield5
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Evasion/Energy Shield Boots
Murder Boots
Crafted: true
Prefix: LocalIncreasedEvasionAndEnergyShield5_
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Evasion/Energy Shield Boots
Two-Toned Boots (Evasion/Energy Shield)
Crafted: true
Prefix: LocalIncreasedEvasionAndEnergyShield5_
Prefix: IncreasedLife6
Prefix: MovementVelocity5
]],[[
Ward Boots
Runic Sabatons
Crafted: true
Prefix: LocalIncreasedWardPercent3
Prefix: LocalIncreasedWard5___
Prefix: IncreasedLife7
]],
-- Shields
[[
Energy Shield Shield
Transfer-attuned Spirit Shield
Crafted: true
Prefix: IncreasedLife8
Prefix: LocalIncreasedEnergyShieldPercent5
Prefix: LocalIncreasedEnergyShield9
]],[[
Evasion Shield
Cold-attuned Buckler
Crafted: true
Prefix: LocalIncreasedEvasionRating5
Prefix: LocalIncreasedEvasionRatingPercent5
Prefix: IncreasedLife8
]],[[
Armour Shield
Heat-attuned Tower Shield
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRating5
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife8
]],[[
Armour Shield
Pinnacle Tower Shield
Crafted: true
Prefix: LocalIncreasedPhysicalDamageReductionRating5
Prefix: LocalIncreasedPhysicalDamageReductionRatingPercent5
Prefix: IncreasedLife8
]],[[
Evasion Shield
Imperial Buckler
Crafted: true
Prefix: LocalIncreasedEvasionRating5
Prefix: LocalIncreasedEvasionRatingPercent5
Prefix: IncreasedLife8
]],[[
Energy Shield Shield
Titanium Spirit Shield
Crafted: true
Prefix: IncreasedLife8
Prefix: LocalIncreasedEnergyShieldPercent5
Prefix: LocalIncreasedEnergyShield9
]],[[
Armour/Evasion Shield
Elegant Round Shield
Crafted: true
Prefix: LocalBaseArmourAndEvasionRating5
Prefix: LocalIncreasedArmourAndEvasion5
Prefix: IncreasedLife8
]],[[
Armour/Energy Shield Shield
Archon Kite Shield
Crafted: true
Prefix: LocalBaseArmourAndEnergyShield5
Prefix: LocalIncreasedArmourAndEnergyShield5
Prefix: IncreasedLife8
]],[[
Evasion/Energy Shield Shield
Supreme Spiked Shield
Crafted: true
Prefix: LocalBaseEvasionRatingAndEnergyShield5_
Prefix: LocalIncreasedEvasionAndEnergyShield5_
Prefix: IncreasedLife8
]],
-- Amulets
[[
Energy Shield Amulet
Seaglass Amulet
Crafted: true
Prefix: IncreasedEnergyShield7
Prefix: IncreasedEnergyShieldPercent5
Suffix: Intelligence5
]],[[
Amulet
Amber Amulet
Crafted: true
Suffix: Strength5
]],[[
Amulet
Jade Amulet
Crafted: true
Suffix: Dexterity5
]],[[
Amulet
Lapis Amulet
Crafted: true
Suffix: Intelligence5
]],[[
Amulet
Onyx Amulet
Crafted: true
Suffix: AllAttributes5
]],[[
Amulet
Agate Amulet
Crafted: true
Suffix: Strength5
Suffix: Intelligence5
]],[[
Amulet
Turquoise Amulet
Crafted: true
Suffix: Dexterity5
Suffix: Intelligence5
]],[[
Amulet
Citrine Amulet
Crafted: true
Suffix: Dexterity5
Suffix: Strength5
]],[[
Mana Amulet
Paua Amulet
Crafted: true
Prefix: IncreasedMana7
Suffix: Intelligence5
Suffix: ManaRegeneration4
]],[[
Amulet
Marble Amulet
Crafted: true
]],[[
Mana Amulet
Blue Pearl Amulet
Crafted: true
Prefix: IncreasedMana7
Suffix: Intelligence5
Suffix: ManaRegeneration4
]],[[
Influence Amulet
Astrolabe Amulet
Crafted: true
]],[[
Amulet
Simplex Amulet
Crafted: true
]],
-- Rings
[[
Ring
Geodesic Ring
Crafted: true
]],[[
Resistance Ring
Cogwork Ring
Crafted: true
Suffix: FireResist4
Suffix: ColdResist4
Suffix: LightningResist4
]],[[
Mana Ring
Paua Ring
Crafted: true
Prefix: IncreasedMana7
Suffix: Intelligence5
Suffix: ManaRegeneration4
]],[[
Energy Shield Ring
Moonstone Ring
Crafted: true
Prefix: IncreasedEnergyShield6
Suffix: Intelligence5
]],[[
Ring
Diamond Ring
Crafted: true
]],[[
Resistance Ring
Ruby Ring
Crafted: true
Suffix: FireResist4
Suffix: ColdResist4
Suffix: LightningResist4
]],[[
Resistance Ring
Sapphire Ring
Crafted: true
Suffix: FireResist4
Suffix: ColdResist4
Suffix: LightningResist4
]],[[
Resistance Ring
Topaz Ring
Crafted: true
Suffix: FireResist4
Suffix: ColdResist4
Suffix: LightningResist4
]],[[
Chaos Resistance Ring
Amethyst Ring
Crafted: true
Suffix: ChaosResist4
]],[[
Resistance Ring
Ruby Ring
Crafted: true
Suffix: FireResist4
Suffix: ColdResist4
Suffix: LightningResist4
]],[[
Life Ring
Coral Ring
Crafted: true
Prefix: IncreasedLife4
Suffix: Strength6
]],[[
Resistance Ring
Prismatic Ring
Crafted: true
Suffix: FireResist4
Suffix: ColdResist4
Suffix: LightningResist4
]],[[
Resistance Ring
Two-Stone Ring
Variant: Fire and Cold
Variant: Cold and Lightning
Variant: Fire and Lightning
Crafted: true
Suffix: FireResist4
Suffix: ColdResist4
Suffix: LightningResist4
Implicits: 3
{variant:1}+(12 to 16)% to Fire and Cold Resistances
{variant:2}+(12 to 16)% to Cold and Lightning Resistances
{variant:3}+(12 to 16)% to Fire and Lightning Resistances
]],[[
Ring
Unset Ring
Crafted: true
Prefix: LocalIncreaseSocketedGemUnsetRing2
]],[[
Ring
Steel Ring
Crafted: true
Prefix: AddedPhysicalDamage4
Suffix: IncreasedAccuracyNew3
Suffix: IncreasedAttackSpeed1
]],[[
Ring
Iolite Ring
Crafted: true
]],[[
Ring
Opal Ring
Crafted: true
]],[[
Mana Ring
Cerulean Ring
Crafted: true
Prefix: IncreasedMana7
Suffix: Intelligence5
Suffix: ManaRegeneration4
]],[[
Life Ring
Vermillion Ring
Crafted: true
Prefix: IncreasedLife4
Suffix: Strength6
]],
-- Belts
[[
Belt
Rustic Sash
Crafted: true
]],[[
Energy Shield Belt
Chain Belt
Crafted: true
Prefix: IncreasedEnergyShield6
]],[[
Belt
Leather Belt
Crafted: true
Prefix: IncreasedLife4
Suffix: Strength6
]],[[
Belt
Heavy Belt
Crafted: true
Prefix: IncreasedLife4
Suffix: Strength6
]],[[
Energy Shield Belt
Crystal Belt
Crafted: true
Prefix: IncreasedEnergyShield6
]],[[
Belt
Vanguard Belt
Crafted: true
Prefix: IncreasedPhysicalDamageReductionRating5
Prefix: IncreasedLife5
]],[[
Flask Belt
Micro-Distillery Belt
Crafted: true
Suffix: BeltReducedFlaskChargesUsed1
Suffix: BeltIncreasedFlaskDuration1
]],[[
Belt
Mechalarm Belt
Crafted: true
]],
-- Quivers
[[
Quiver
Spike-Point Arrow Quiver
Crafted: true
Prefix: AddedPhysicalDamage3
Prefix: IncreasedLife7
Prefix: WeaponElementalDamage3
Suffix: IncreasedAttackSpeed1
Suffix: CriticalStrikeChanceWithBows4
Suffix: CriticalMultiplierWithBows3
]],
[[
Quiver
Artillery Quiver
Crafted: true
Prefix: AddedPhysicalDamage3
Prefix: IncreasedLife7
Prefix: WeaponElementalDamage3
Suffix: IncreasedAttackSpeed1
Suffix: CriticalStrikeChanceWithBows4
Suffix: CriticalMultiplierWithBows3
]],
-- Weapons
[[
Physical 1H Axe
Runic Hatchet
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 1H Axe
Vaal Hatchet
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 1H Axe
Psychotic Axe
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 1H Axe
Psychotic Axe
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 2H Axe
Fleshripper
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamageTwoHand6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 2H Axe
Despot Axe
Crafted: true
Prefix: WeaponElementalDamageOnTwohandWeapon4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 2H Axe
Apex Cleaver
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamageTwoHand6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 2H Axe
Apex Cleaver
Crafted: true
Prefix: WeaponElementalDamageOnTwohandWeapon4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical Bow
Harbinger Bow
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamageTwoHand6
Suffix: LocalIncreasedAttackSpeed2
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Bow
Thicket Bow
Crafted: true
Prefix: WeaponElementalDamageOnTwohandWeapon4
Suffix: LocalIncreasedAttackSpeed2
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Fire Bow
Solarine Bow
Crafted: true
Prefix: LocalAddedFireDamageRanged6
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed2
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+3 Bow
Thicket Bow
Crafted: true
Prefix: LocalIncreaseSocketedGemLevel1
Prefix: LocalIncreaseSocketedBowGemLevel2
Suffix: LocalIncreasedAttackSpeed2
]],[[
Physical Claw
Gemini Claw
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Claw
Imperial Claw
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Chaos Claw
Void Fangs
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalAddedChaosDamage1
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical Dagger
Ambusher
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Dagger
Ambusher
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Spell Dagger
Platinum Kris
Crafted: true
Prefix: SpellDamageOnWeapon5
Prefix: SpellDamageAndManaOnWeapon4
Suffix: LocalIncreasedAttackSpeed3
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical Dagger
Pneumatic Dagger
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Dagger
Pneumatic Dagger
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Spell Dagger
Infernal Blade
Crafted: true
Prefix: SpellDamageOnWeapon5
Prefix: SpellDamageAndManaOnWeapon4
Suffix: LocalIncreasedAttackSpeed3
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Vagan Dagger
Royal Skean
Crafted: true
Prefix: SpellDamageOnWeapon5
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
{custom}Hits can't be Evaded
]],[[
Spell Sceptre
Void Sceptre
Crafted: true
Prefix: SpellDamageOnWeapon5
Prefix: SpellDamageAndManaOnWeapon4
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Sceptre
Void Sceptre
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical Sceptre
Void Sceptre
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Spell Sceptre
Oscillating Sceptre
Crafted: true
Prefix: SpellDamageOnWeapon5
Prefix: SpellDamageAndManaOnWeapon4
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Sceptre
Oscillating Sceptre
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Spell Sceptre
Stabilising Sceptre
Crafted: true
Prefix: SpellDamageOnWeapon5
Prefix: SpellDamageAndManaOnWeapon4
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Sceptre
Stabilising Sceptre
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Spell Sceptre
Alternating Sceptre
Crafted: true
Prefix: SpellDamageOnWeapon5
Prefix: SpellDamageAndManaOnWeapon4
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Sceptre
Alternating Sceptre
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical Sceptre
Alternating Sceptre
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 1H Mace
Behemoth Mace
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 1H Mace
Behemoth Mace
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 1H Mace
Boom Mace
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 1H Mace
Boom Mace
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 2H Mace
Coronal Maul
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamageTwoHand6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 2H Mace
Coronal Maul
Crafted: true
Prefix: WeaponElementalDamageOnTwohandWeapon4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 2H Mace
Impact Force Propagator
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamageTwoHand6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 2H Mace
Impact Force Propagator
Crafted: true
Prefix: WeaponElementalDamageOnTwohandWeapon4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical Staff
Maelstrom Staff
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamageTwoHand6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Staff
Maelstrom Staff
Crafted: true
Prefix: WeaponElementalDamageOnTwohandWeapon6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical Staff
Eventuality Rod
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamageTwoHand6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Staff
Eventuality Rod
Crafted: true
Prefix: WeaponElementalDamageOnTwohandWeapon6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Spell Staff
Eclipse Staff
Crafted: true
Prefix: SpellDamageOnTwoHandWeapon5
Prefix: SpellDamageAndManaOnTwoHandWeapon4
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+5 Physical Staff
Eclipse Staff
Crafted: true
Prefix: GlobalSpellGemsLevelTwoHand1
Prefix: GlobalPhysicalSpellGemsLevelTwoHand2_
Prefix: SpellDamageOnTwoHandWeapon5
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+5 Fire Staff
Eclipse Staff
Crafted: true
Prefix: GlobalSpellGemsLevelTwoHand1
Prefix: GlobalFireSpellGemsLevelTwoHand2
Prefix: SpellDamageOnTwoHandWeapon5
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+5 Cold Staff
Eclipse Staff
Crafted: true
Prefix: GlobalSpellGemsLevelTwoHand1
Prefix: GlobalColdSpellGemsLevelTwoHand2
Prefix: SpellDamageOnTwoHandWeapon5
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+5 Lightning Staff
Eclipse Staff
Crafted: true
Prefix: GlobalSpellGemsLevelTwoHand1
Prefix: GlobalLightningSpellGemsLevelTwoHand2
Prefix: SpellDamageOnTwoHandWeapon5
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+5 Chaos Staff
Eclipse Staff
Crafted: true
Prefix: GlobalSpellGemsLevelTwoHand1
Prefix: GlobalChaosSpellGemsLevelTwoHand2
Prefix: SpellDamageOnTwoHandWeapon5
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Spell Staff
Battery Staff
Crafted: true
Prefix: SpellDamageOnTwoHandWeapon5
Prefix: SpellDamageAndManaOnTwoHandWeapon4
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+5 Physical Staff
Battery Staff
Crafted: true
Prefix: GlobalSpellGemsLevelTwoHand1
Prefix: GlobalPhysicalSpellGemsLevelTwoHand2_
Prefix: SpellDamageOnTwoHandWeapon5
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+5 Fire Staff
Battery Staff
Crafted: true
Prefix: GlobalSpellGemsLevelTwoHand1
Prefix: GlobalFireSpellGemsLevelTwoHand2
Prefix: SpellDamageOnTwoHandWeapon5
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+5 Cold Staff
Battery Staff
Crafted: true
Prefix: GlobalSpellGemsLevelTwoHand1
Prefix: GlobalColdSpellGemsLevelTwoHand2
Prefix: SpellDamageOnTwoHandWeapon5
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+5 Lightning Staff
Battery Staff
Crafted: true
Prefix: GlobalSpellGemsLevelTwoHand1
Prefix: GlobalLightningSpellGemsLevelTwoHand2
Prefix: SpellDamageOnTwoHandWeapon5
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
+5 Chaos Staff
Battery Staff
Crafted: true
Prefix: GlobalSpellGemsLevelTwoHand1
Prefix: GlobalChaosSpellGemsLevelTwoHand2
Prefix: SpellDamageOnTwoHandWeapon5
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 1H Sword
Tiger Hook
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 1H Sword
Jewelled Foil
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 1H Sword
Eternal Sword
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 1H Sword
Anarchic Spiritblade
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 1H Sword
Anarchic Spiritblade
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 1H Sword
Jewelled Foil
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical 2H Sword
Exquisite Blade
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamageTwoHand6
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 2H Sword
Reaver Sword
Crafted: true
Prefix: WeaponElementalDamageOnTwohandWeapon4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental 2H Sword
Banishing Blade
Crafted: true
Prefix: WeaponElementalDamageOnTwohandWeapon4
Suffix: LocalIncreasedAttackSpeed3
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical Wand
Imbued Wand
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed2
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Wand
Imbued Wand
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed2
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Spell Wand
Prophecy Wand
Crafted: true
Prefix: SpellDamageOnWeapon5
Prefix: SpellDamageAndManaOnWeapon4
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Physical Wand
Accumulator Wand
Crafted: true
Prefix: LocalIncreasedPhysicalDamagePercent5
Prefix: LocalIncreasedPhysicalDamagePercentAndAccuracyRating5
Prefix: LocalAddedPhysicalDamage6
Suffix: LocalIncreasedAttackSpeed2
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Elemental Wand
Accumulator Wand
Crafted: true
Prefix: WeaponElementalDamageOnWeapons4
Suffix: LocalIncreasedAttackSpeed2
Suffix: LocalCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],[[
Spell Wand
Accumulator Wand
Crafted: true
Prefix: SpellDamageOnWeapon5
Prefix: SpellDamageAndManaOnWeapon4
Suffix: SpellCriticalStrikeChance3
Suffix: LocalCriticalMultiplier4
]],
-- Jewels
[[
Jewel
Crimson Jewel
Crafted: true
]],[[
Jewel
Viridian Jewel
Crafted: true
]],[[
Jewel
Cobalt Jewel
Crafted: true
]],[[
Cluster Jewel
Large Cluster Jewel
Crafted: true
]],[[
Cluster Jewel
Medium Cluster Jewel
Crafted: true
]],[[
Cluster Jewel
Small Cluster Jewel
Crafted: true
]],
} |
local Paddle = {}
Paddle.__index = Paddle
function Paddle.new()
local self = setmetatable({}, Paddle)
self.x = 375
self.y = 550
self.height = 15
self.color = {171, 173, 156}
self.ballSpeedUp = 1
self:resetPaddle()
return self
end
function Paddle:resetPaddle()
self.width = 50
self.speed = 350
end
function Paddle:draw()
love.graphics.setColor(self.color[1], self.color[2], self.color[3])
love.graphics.rectangle('fill', self.x, self.y, self.width, self.height)
end
function Paddle:move(dt)
if love.keyboard.isScancodeDown('w') then
if self.y <= 200 then
self.y = 200
else
self.y = self.y - self.speed * dt
end
end
if love.keyboard.isScancodeDown('d') then
if self.x + self.width >= 775 then
self.x = 775 - self.width
else
self.x = self.x + self.speed * dt
end
end
if love.keyboard.isScancodeDown('s') then
if self.y + self.height >= 575 then
self.y = 575 - self.height
else
self.y = self.y + self.speed * dt
end
end
if love.keyboard.isScancodeDown('a') then
if self.x <= 25 then
self.x = 25
else
self.x = self.x - self.speed * dt
end
end
end
function Paddle:applyItem(item)
if item.item.name == 'paddle size up' then
self.width = self.width + item.item.value
elseif item.item.name == 'paddle speed up' then
self.speed = self.speed + item.item.value
elseif item.item.name == 'ball speed up' then
self.ballSpeedUp = self.ballSpeedUp + item.item.value
elseif item.item.name == 'paddle size down' then
self.width = self.width + item.item.value
elseif item.item.name == 'paddle speed down' then
self.speed = self.speed + item.item.value
elseif item.item.name == 'ball speed down' then
self.ballSpeedUp = self.ballSpeedUp + item.item.value
end
end
function Paddle:resetBallSpeedUp()
self.ballSpeedUp = 1
end
return Paddle
|
-- Copyright (c) 2021 EngineerSmith
-- Under the MIT license, see license suppiled with this file
local util = {}
util.getImageDimensions = function(image)
if image:typeOf("Texture") then
return image:getPixelDimensions()
else
return image:getDimensions()
end
end
-- TODO: Remove closure usage
local fillImageData = function(imageData, x, y, w, h, r, g, b, a)
imageData:mapPixel(function()
return r, g, b, a
end, x, y, w, h)
end
local extrudeImageData = function(dest, src, n, x, y, dx, dy, sx, sy, sw, sh)
for i = 1, n do
dest:paste(src, x + i * dx, y + i * dy, sx, sy, sw, sh)
end
end
util.extrudeWithFill = function(dest, src, n, x, y)
local iw, ih = src:getDimensions()
extrudeImageData(dest, src, n, x, y, 0, -1, 0, 0, iw, 1) -- top
extrudeImageData(dest, src, n, x, y, -1, 0, 0, 0, 1, ih) -- left
extrudeImageData(dest, src, n, x, y + ih - 1, 0, 1, 0, ih - 1, iw, 1) -- bottom
extrudeImageData(dest, src, n, x + iw - 1, y, 1, 0, iw - 1, 0, 1, ih) -- right
fillImageData(dest, x - n, y - n, n, n, src:getPixel(0, 0)) -- top-left
fillImageData(dest, x + iw, y - n, n, n, src:getPixel(iw - 1, 0)) -- top-right
fillImageData(dest, x + iw, y + ih, n, n, src:getPixel(iw - 1, ih - 1)) -- bottom-right
fillImageData(dest, x - n, y + ih, n, n, src:getPixel(0, ih - 1)) -- bottom-left
end
return util
|
local busyKey = KEYS[1]
local chgKey = KEYS[2]
local chgId = ARGV[1]
local expiresTimeMillis = ARGV[2]
local isBusy = redis.call('ZRANK', busyKey, chgId)
if isBusy then
error("CHG was already busy")
end
redis.call('ZADD', busyKey, expiresTimeMillis, chgId)
local queueCount = redis.call('HGET', chgKey, "qc")
return queueCount
|
return LoadActor("_name entry") .. {
InitCommand = function(self)
self:stretchto(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM)
end
}
|
--- MeshDataBuilder
--- Builder Pattern constructor for a MeshData
local MeshData = require(script.Parent.MeshData)
local root = script.Parent.Parent
local Builder = require(root.Builder)
local util = root.Util
local t = require(util.t)
local MeshDataBuilder = {
ClassName = "MeshDataBuilder";
}
MeshDataBuilder.__index = MeshDataBuilder
setmetatable(MeshDataBuilder, Builder)
function MeshDataBuilder.new()
local self = setmetatable(Builder.new(), MeshDataBuilder)
self.Mesh = nil
self.MeshType = nil
self.Offset = Vector3.new(0, 0, 0)
self.Scale = Vector3.new(1, 1, 1)
return self
end
-- makes sure everything is setup properly
-- runs an "any" check on the following properties
local BuilderCheck = Builder.Check({
"Mesh"
})
function MeshDataBuilder:Build()
assert(BuilderCheck(self))
return MeshData.fromData({
Mesh = self.Mesh,
MeshType = self.MeshType,
Offset = self.Offset,
Scale = self.Scale,
})
end
function MeshDataBuilder:WithMesh(meshName)
assert(MeshData.IsMeshClassName(meshName))
self.Mesh = meshName
return self
end
function MeshDataBuilder:WithMeshType(meshType)
assert(t.optional(MeshData.IsMeshType)(meshType))
self.MeshType = meshType
return self
end
function MeshDataBuilder:WithOffset(offset)
assert(t.Vector3(offset))
self.Offset = offset
return self
end
function MeshDataBuilder:WithScale(scale)
assert(t.Vector3(scale))
self.Scale = scale
return self
end
return MeshDataBuilder |
word = "test"
for i = 1, string.len(word), 1 do
print(string.sub(word,i,i)..string.sub(word,i+1,i+1)..string.sub(word,i+2,i+2)..string.sub(word,i+3,i+3))
print(string.sub(word,i,i)..string.sub(word,i+1,i+1)..string.sub(word,i+3,i+3)..string.sub(word,i+2,i+2))
print(string.sub(word,i,i)..string.sub(word,i+2,i+2)..string.sub(word,i+3,i+3)..string.sub(word,i+1,i+1))
print(string.sub(word,i,i)..string.sub(word,i+2,i+2)..string.sub(word,i+1,i+1)..string.sub(word,i+3,i+3))
print(string.sub(word,i,i)..string.sub(word,i+3,i+3)..string.sub(word,i+1,i+1)..string.sub(word,i+2,i+2))
print(string.sub(word,i,i)..string.sub(word,i+3,i+3)..string.sub(word,i+2,i+2)..string.sub(word,i+1,i+1))
print(string.rep(word,3,"-"))
end
|
object_building_general_valley_root_05 = object_building_general_shared_valley_root_05:new {
}
ObjectTemplates:addTemplate(object_building_general_valley_root_05, "object/building/general/valley_root_05.iff")
|
local HERO_KIT = script:GetCustomProperty("HeroKit"):WaitForObject()
local HERO_KIT_GEAR = script:GetCustomProperty("HeroKitEquipment"):WaitForObject()
EQUIPPED_GEAR = {}
function OnEquipped(_, player)
local gearToEquip = HERO_KIT_GEAR:GetChildren()
for _, gear in ipairs(gearToEquip) do
if (Object.IsValid(gear) and gear:IsA("Equipment")) then
gear:Equip(player)
table.insert(EQUIPPED_GEAR, gear)
end
end
player.serverUserData.gear = EQUIPPED_GEAR
end
function OnUnequipped(_, player)
if not Object.IsValid(player) then return end
for _, gear in pairs(player.serverUserData.gear) do
if (Object.IsValid(gear)) then
gear:Unequip()
gear:Destroy()
end
end
end
-- Registering equipment events
HERO_KIT.equippedEvent:Connect(OnEquipped)
HERO_KIT.unequippedEvent:Connect(OnUnequipped)
|
settings = { -- Set default display units here
["distance"] = 1,
["speed"] = 2,
["angle"] = 1
}
units = {
["distance"] = { -- Do not change these
{" м", 1}, -- 1
{" футов", 3.281} -- 2
},
["speed"] = { -- Do not change these
{" м/с", 0.278}, -- 1
{" км/ч", 1}, -- 2
{" миль/ч", 0.621}, -- 3
{" фт/с", 0.911}, -- 4
{" kts", 0.540} -- 5
},
["angle"] = { -- Do not change these
{"°", 1} -- 1
}
}
config = {
[1] = {
["name"] = "Автопилот",
["on"] = false
},
[2] = {
["name"] = "Вращение",
["on"] = false,
["setting"] = 0,
["units"] = "angle",
["min_setting"] = -60, -- Do not set less than -180
["max_setting"] = 60, -- Do not set greater than 180
["gain"] = 0.20, -- 0.20 default
["input"] = 0.7, -- Percentage from 0 to 1
["quick"] = "Ноль"
},
[3] = {
["name"] = "Наклон",
["on"] = false,
["setting"] = 0,
["units"] = "angle",
["min_setting"] = -60, -- Do not set less than -90
["max_setting"] = 60, -- Do not set greater than 90
["gain"] = 0.50, -- 0.50 default
["input"] = 0.8, -- Percentage from 0 to 1
["quick"] = "Ноль"
},
[4] = {
["name"] = "Направление",
["on"] = false,
["setting"] = 0,
["units"] = "angle",
["min_setting"] = 0, -- Do not change
["max_setting"] = 360, -- Do not change
["gain"] = 2.00, -- 2.00 default
["input"] = 45, -- Maximum roll angle while HH is active, 30 to 60 recommended
["quick"] = "Авто"
},
[5] = {
["name"] = "Высота",
["on"] = false,
["setting"] = 0,
["units"] = "distance",
["min_setting"] = 0, -- Do not set less than 0
["max_setting"] = 5000, -- Planes do not maneuver properly above 5000 m
["gain"] = 0.30, -- 0.30 default
["input"] = 45, -- Maximum pitch angle while AH is active, 30 to 60 recommended
["bias"] = 5, -- Correction for gravity
["step"] = 50, -- Step size for changing setting
["quick"] = "Авто"
},
[6] = {
["name"] = "Скорость",
["on"] = false,
["setting"] = 0,
["units"] = "speed",
["min_setting"] = 0, -- Do not set less than 0
["max_setting"] = 500, -- Planes rarely exceed 500 km/h
["gain"] = 0.04, -- 0.04 default
["input"] = 1, -- Percentage from 0 to 1, needs to be exactly 1 for take-off
["step"] = 5, -- Step size for changing setting
["quick"] = "Круиз"
},
[7] = {
["name"] = "К точке",
["on"] = false
},
[8] = {
["name"] = "Сближение",
["on"] = false
},
[9] = {
["name"] = "Цель",
["on"] = false
},
[10] = {
["name"] = "Параметры",
["on"] = false
}
}
planes = {
[24] = { -- F-33 DragonFly
["available"] = true,
["landing_speed"] = 160,
["cruise_speed"] = 296,
["max_speed"] = 406,
["slow_distance"] = 1000,
["flare_distance"] = 50,
["flare_pitch"] = 3,
["cone_angle"] = 90,
},
[30] = { -- Si-47 Leopard
["available"] = true,
["landing_speed"] = 160,
["cruise_speed"] = 277,
["max_speed"] = 340,
["slow_distance"] = 1000,
["flare_distance"] = 100,
["flare_pitch"] = 3,
["cone_angle"] = 90,
},
[34] = { -- G9 Eclipse
["available"] = true,
["landing_speed"] = 190,
["cruise_speed"] = 341,
["max_speed"] = 401,
["slow_distance"] = 1500,
["flare_distance"] = 150,
["flare_pitch"] = 3,
["cone_angle"] = 75,
},
[39] = { -- Aeroliner 474
["available"] = true,
["landing_speed"] = 180,
["cruise_speed"] = 324,
["max_speed"] = 352,
["slow_distance"] = 1000,
["flare_distance"] = 100,
["flare_pitch"] = -1,
["cone_angle"] = 60,
},
[51] = { -- Cassius 192
["available"] = true,
["landing_speed"] = 120,
["cruise_speed"] = 250,
["max_speed"] = 314,
["slow_distance"] = 1000,
["flare_distance"] = 100,
["flare_pitch"] = 3,
["cone_angle"] = 75,
},
[59] = { -- Peek Airhawk 225
["available"] = true,
["landing_speed"] = 130,
["cruise_speed"] = 207,
["max_speed"] = 242,
["slow_distance"] = 1000,
["flare_distance"] = 20,
["flare_pitch"] = 0,
["cone_angle"] = 90,
},
[81] = { -- Pell Silverbolt 6
["available"] = true,
["landing_speed"] = 150,
["cruise_speed"] = 262,
["max_speed"] = 343,
["slow_distance"] = 1000,
["flare_distance"] = 20,
["flare_pitch"] = 3,
["cone_angle"] = 90,
},
[85] = { -- Bering I-86DP
["available"] = true,
["landing_speed"] = 180,
["cruise_speed"] = 313,
["max_speed"] = 339,
["slow_distance"] = 1000,
["flare_distance"] = 200,
["flare_pitch"] = 3,
["cone_angle"] = 60,
}
}
airports = {
["PIA"] = {
["27"] = {
["near_marker"] = Vector3(-5842.51, 208.97, -3009.23),
["far_marker"] = Vector3(-6816.68, 208.97, -2994.51),
["glide_length"] = 4000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["09"] = {
["near_marker"] = Vector3(-6816.68, 208.97, -2994.51),
["far_marker"] = Vector3(-5842.51, 208.97, -3009.23),
["glide_length"] = 1500,
["glide_pitch"] = 5,
["cone_angle"] = 5
},
["05"] = {
["near_marker"] = Vector3(-6398.21, 208.90, -3176.93),
["far_marker"] = Vector3(-5998.58, 208.90, -3576.45),
["glide_length"] = 2500,
["glide_pitch"] = 5,
["cone_angle"] = 5
},
["23"] = {
["near_marker"] = Vector3(-5998.58, 208.90, -3576.45),
["far_marker"] = Vector3(-6398.21, 208.90, -3176.93),
["glide_length"] = 3000,
["glide_pitch"] = 3,
["cone_angle"] = 10
}
},
["Kem Sungai Sejuk"] = {
["04"] = {
["near_marker"] = Vector3(601.69, 298.84, -3937.16),
["far_marker"] = Vector3(882.20, 298.84, -4246.67),
["glide_length"] = 5000,
["glide_pitch"] = 4,
["cone_angle"] = 10
}
},
["Pulau Dayang Terlena"] = {
["03L"] = {
["near_marker"] = Vector3(-12238.39, 610.94, 4664.57),
["far_marker"] = Vector3(-11970.58, 610.94, 4162.33),
["glide_length"] = 5000,
["glide_pitch"] = 5,
["cone_angle"] = 10
},
["21R"] = {
["near_marker"] = Vector3(-11970.58, 610.94, 4162.33),
["far_marker"] = Vector3(-12238.39, 610.94, 4664.57),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 10
},
["03R"] = {
["near_marker"] = Vector3(-12101.96, 611.10, 4737.54),
["far_marker"] = Vector3(-11834.03, 611.10, 4236.06),
["glide_length"] = 5000,
["glide_pitch"] = 5,
["cone_angle"] = 10
},
["21L"] = {
["near_marker"] = Vector3(-11834.03, 611.10, 4236.06),
["far_marker"] = Vector3(-12101.96, 611.10, 4737.54),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 10
},
["12"] = {
["near_marker"] = Vector3(-12196.25, 611.22, 4874.13),
["far_marker"] = Vector3(-11693.96, 611.22, 5142.52),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["30"] = {
["near_marker"] = Vector3(-11693.96, 611.22, 5142.52),
["far_marker"] = Vector3(-12196.25, 611.22, 4874.13),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
},
["Kem Jalan Merpati"] = {
["30"] = {
["near_marker"] = Vector3(-6643.80, 1050.34, 11950.66),
["far_marker"] = Vector3(-7131.25, 1050.34, 11658.72),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
}
},
["Kem Udara Wau Pantas"] = {
["27"] = {
["near_marker"] = Vector3(6140.61, 251.00, 7158.83),
["far_marker"] = Vector3(5573.50, 251.00, 7158.61),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["09"] = {
["near_marker"] = Vector3(5573.50, 251.00, 7158.61),
["far_marker"] = Vector3(6140.61, 251.00, 7158.83),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["36"] = {
["near_marker"] = Vector3(6044.50, 251.00, 6996.85),
["far_marker"] = Vector3(6044.50, 251.00, 6428.61),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["18"] = {
["near_marker"] = Vector3(6044.50, 251.00, 6428.61),
["far_marker"] = Vector3(6044.50, 251.00, 6996.85),
["glide_length"] = 1500,
["glide_pitch"] = 3,
["cone_angle"] = 15
}
},
["Pulau Dongeng"] = {
["12"] = {
["near_marker"] = Vector3(5696.48, 264.18, 10363.78),
["far_marker"] = Vector3(5863.38, 264.18, 10460.01),
["glide_length"] = 2000,
["glide_pitch"] = 4,
["cone_angle"] = 15
}
},
["Tanah Lebar"] = {
["28R"] = {
["near_marker"] = Vector3(-160.40, 295.36, 7089.45),
["far_marker"] = Vector3(-351.18, 295.36, 7060.66),
["glide_length"] = 5000,
["glide_pitch"] = 5,
["cone_angle"] = 6
},
["28L"] = {
["near_marker"] = Vector3(-169.66, 295.35, 7148.39),
["far_marker"] = Vector3(-358.35, 295.35, 7119.41),
["glide_length"] = 5000,
["glide_pitch"] = 5,
["cone_angle"] = 6
}
},
["Kampung Tujuh Telaga"] = {
["14"] = {
["near_marker"] = Vector3(595.28, 207.06, -98.16),
["far_marker"] = Vector3(748.07, 208.15, 58.73),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
}
},
["Teluk Permata"] = {
["14"] = {
["near_marker"] = Vector3(-7123.66, 207.01, -10822.38),
["far_marker"] = Vector3(-6837.64, 207.01, -10636.57),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
}
},
["Banjaran Gundin"] = {
["23"] = {
["near_marker"] = Vector3(-4610.55, 405.64, -11649.26),
["far_marker"] = Vector3(-5012.30, 405.64, -11247.39),
["glide_length"] = 5000,
["glide_pitch"] = 5,
["cone_angle"] = 15
},
["45"] = {
["near_marker"] = Vector3(-5012.30, 405.64, -11247.39),
["far_marker"] = Vector3(-4610.55, 405.64, -11649.26),
["glide_length"] = 5000,
["glide_pitch"] = 5,
["cone_angle"] = 12
}
},
["Sungai Cengkih Besar"] = {
["20"] = {
["near_marker"] = Vector3(4706.35, 208.40, -10989.74),
["far_marker"] = Vector3(4477.04, 208.40, -10467.98),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["29"] = {
["near_marker"] = Vector3(4667.72, 208.44, -10624.48),
["far_marker"] = Vector3(4147.00, 208.44, -10853.32),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["11"] = {
["near_marker"] = Vector3(4147.00, 208.44, -10853.32),
["far_marker"] = Vector3(4667.72, 208.44, -10624.48),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
}
},
["Paya Luas"] = {
["27"] = {
["near_marker"] = Vector3(12011.65, 206.88, -10715.07),
["far_marker"] = Vector3(11440.75, 206.88, -10715.09),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["09"] = {
["near_marker"] = Vector3(11440.75, 206.88, -10715.09),
["far_marker"] = Vector3(12011.65, 206.88, -10715.07),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["36"] = {
["near_marker"] = Vector3(12171.29, 206.88, -10243.73),
["far_marker"] = Vector3(12171.29, 206.88, -10812.65),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["18"] = {
["near_marker"] = Vector3(12171.26, 206.88, -10812.65),
["far_marker"] = Vector3(12171.26, 206.88, -10243.73),
["glide_length"] = 1500,
["glide_pitch"] = 3,
["cone_angle"] = 15
}
},
["Lemabah Delima"] = {
["13"] = {
["near_marker"] = Vector3(9460.27, 204.78, 3661.23),
["far_marker"] = Vector3(9890.33, 204.78, 4031.97),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
},
["31"] = {
["near_marker"] = Vector3(9890.33, 204.78, 4032.38),
["far_marker"] = Vector3(9460.27, 204.78, 3661.23),
["glide_length"] = 5000,
["glide_pitch"] = 3,
["cone_angle"] = 15
}
}
}
local deg = math.deg
function DegreesDifference(theta1, theta2)
return (theta2 - theta1 + 180) % 360 - 180
end
function OppositeDegrees(theta)
return (theta + 180) % 360
end
function YawToHeading(yaw)
return yaw < 0 and -yaw or 360 - yaw
end
function HeadingToYaw(heading)
return heading < 180 and -heading or 360 - heading
end
function Vehicle:GetRoll()
return deg(self:GetAngle().roll)
end
function Vehicle:GetPitch()
return deg(self:GetAngle().pitch)
end
function Vehicle:GetYaw()
return deg(self:GetAngle().yaw)
end
function Vehicle:GetHeading()
return YawToHeading(self:GetYaw())
end
function Vehicle:GetAltitude()
return self:GetPosition().y - 200
end
function Vehicle:GetAirSpeed()
return self:GetLinearVelocity():Length() * 3.6
end
function Vehicle:GetVerticalSpeed()
return self:GetLinearVelocity().y * 3.6
end
function Vehicle:GetGroundSpeed()
local velocity = self:GetLinearVelocity()
return Vector2( velocity.x, velocity.z ):Length() * 3.6
end |
AddCSLuaFile()
DEFINE_BASECLASS( "base_anim" )
ENT.PrintName = "Pickup"
ENT.Author = "Jen Walter"
ENT.Information = "Item drop from CRAFTWORLD3."
ENT.Category = "CRAFTWORLD3"
ENT.Editable = false
ENT.Spawnable = true
ENT.AdminOnly = true
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
list.Set( "SENT", "Pickup", {
Name = "Pickup",
Class = "cw3_pickup",
Category = "CRAFTWORLD3"
} )
function ENT:SpawnFunction( ply, tr, ClassName )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 10
local ent = ents.Create( ClassName )
ent:SetPos( SpawnPos )
ent:Spawn()
return ent
end
if ( SERVER ) then
function ENT:Initialize()
self:SetPos(self:GetPos())
self.SourceAngle = self:GetAngles()
self.AngleFrame = 0
if self.ItemID == nil then
self.ItemID = math.random(4)
end
self.PickupName = "[UNDEFINED NAME]"
self.ItemOwner = "unassigned"
self.Desc = ""
self.ModelPath = ""
self:SetHealth(0)
if self.UseDelay == nil then self.UseDelay = 0 end --error-proofing
--RARITIES--
--1 - common
--2 - uncommon
--3 - rare
--4 - epic
--5 - legendary
--6 - mythic
--7 - wondrous
--8 - infinite
--9 - omega
--10 - ALPHAOMEGA
--11 - special
self.NoMerge = true
--ITEM INITIALISATION
--the code with the matching ItemID will be run when the item spawns
if not self.CustomItem then
if self.ItemID == 0 then
if !self.Qty then self.Qty = {1, 0} end
self.ModelPath = "models/tiggorech/borderlands/pickups/cash/cash_pickup.mdl"
self.soundfile = "mvm/mvm_money_pickup.wav"
self.PickupName = "$" .. bignumwrite(self.Qty)
self.Rare = 1
self:SetModelScale(1.35)
self.NoImpactNoise = true
self.SilentCollect = true
self.Desc = "Money money money!"
self.func = function(ent)
if !ent.DoshWait then ent.DoshWait = 0 end
if math.random(1,10) == 1 && ent.DoshWait < CurTime() then
ent:EmitSound("rf/dosh_collect" .. math.random(2) .. ".wav")
ent.DoshWait = CurTime() + 3
end
if TrueCraftling() && !self.IgnoreTrueCraftling then
ent:GainGold(self.Qty)
else
for k, v in pairs(player.GetAll()) do
v:GainGold(self.Qty)
end
end
end
elseif self.ItemID == 1 then
if !self.Qty then self.Qty = {1, 0} end
if bignumcompare(self.Qty, {99,0}) == 1 then
self.ModelPath = "models/hunter/blocks/cube1x1x1.mdl"
self.PickupName = "Mega gCube"
else
self.ModelPath = "models/hunter/blocks/cube05x05x05.mdl"
self.PickupName = "gCube"
end
self:SetMaterial("effects/australium_sapphire")
self:EmitSound("rf/discovery.wav", 115)
self.soundfile = "rf/rareitem.wav"
self.UseDelay = 3 + math.Rand(0,2)
self.Rare = 5
self.SilentCollect = true
self.Desc = "The letter 'g' symbolises the initial letter of a very formidable individual."
elseif self.ItemID == 2 then
if !self.Qty then self.Qty = {1, 0} end
if bignumcompare(self.Qty, {99,0}) == 1 then
self.ModelPath = "models/hunter/blocks/cube1x1x1.mdl"
self.PickupName = "Mega cCube"
else
self.ModelPath = "models/hunter/blocks/cube05x05x05.mdl"
self.PickupName = "cCube"
end
self:SetMaterial("effects/australium_emerald")
self:EmitSound("rf/discovery.wav", 115)
self.soundfile = "rf/rareitem.wav"
self.UseDelay = 3 + math.Rand(0,2)
self.Rare = 6
self.SilentCollect = true
self.Desc = "The letter 'c' symbolises this very world itself."
elseif self.ItemID == 3 then
self.Qty = {1, 0}
self.ModelPath = "models/items/ammopack_small.mdl"
self.soundfile = "items/gunpickup2.wav"
self.PickupName = "Ammo"
self.Rare = 2
self.NoPhysics = true
self.Desc = "Supplies all weapons with ammo."
self.func = function(ent)
for k, w in pairs(ent:GetWeapons()) do
if w:GetMaxClip1() <= 1 then
ent:GiveAmmo(15, w:GetPrimaryAmmoType())
else
ent:GiveAmmo(w:GetMaxClip1() * 5, w:GetPrimaryAmmoType())
end
end
end
elseif self.ItemID == 4 then
self.Qty = {1, 0}
self.ModelPath = "models/props_halloween/halloween_medkit_small.mdl"
self.soundfile = "rf/acquire.wav"
self.sndpitch = 80
self.PickupName = "2s Health Regen"
self.Rare = 2
self.NoPhysics = true
self.Desc = "Tasty chocolate."
self.func = function(ent)
ent.RegenerationTime = ent.RegenerationTime + 2
end
elseif self.ItemID == 5 then
if !self.Qty then self.Qty = {1, 0} end
self.ModelPath = "models/props_halloween/halloween_gift.mdl"
self:SetMaterial("effects/australium_sapphire")
self.soundfile = "ui/item_gift_wrap_unwrap.wav"
self.NoImpactNoise = true
self.NoAutoPickup = true
self.ZoneClearPickupImmunity = true
self.PickupName = bignumwrite(self.Qty) .. " Unclaimed gCubes"
self.Rare = 5
self.Desc = "Drops if a cube NPC dies to something other than a player's wrath."
self.func = function(ent)
ent:GiveCubes(1, self.Qty, self:GetPos())
end
elseif self.ItemID == 6 then
if !self.Qty then self.Qty = {1, 0} end
self.ModelPath = "models/props_halloween/halloween_gift.mdl"
self:SetMaterial("effects/australium_emerald")
self.soundfile = "ui/item_gift_wrap_unwrap.wav"
self.NoImpactNoise = true
self.NoAutoPickup = true
self.ZoneClearPickupImmunity = true
self.PickupName = bignumwrite(self.Qty) .. " Unclaimed cCubes"
self.Rare = 5
self.Desc = "Drops if a cube NPC dies to something other than a player's wrath."
self.func = function(ent)
ent:GiveCubes(2, self.Qty, self:GetPos())
end
elseif self.ItemID == 7 then
if !self.Qty then self.Qty = {1, 0} end
self.ModelPath = "models/props_halloween/halloween_gift.mdl"
self:SetMaterial("effects/australium_aquamarine")
self.soundfile = "ui/item_gift_wrap_unwrap.wav"
self.NoImpactNoise = true
self.NoAutoPickup = true
self.ZoneClearPickupImmunity = true
self.PickupName = bignumwrite(self.Qty) .. " Unclaimed AceCubes"
self.Rare = 5
self.Desc = "Drops if a cube NPC dies to something other than a player's wrath."
self.func = function(ent)
ent:GiveCubes(1, self.Qty, self:GetPos())
ent:GiveCubes(2, self.Qty, self:GetPos())
end
elseif self.ItemID == 8 then
local mats = {"effects/australium_sapphire", "models/player/shared/gold_player", "effects/australium_emerald", "effects/australium_amber", "effects/australium_platinum", "effects/australium_pinkquartz", "effects/australium_aquamarine", "models/weapons/v_slam/new light2", "models/props/cs_office/clouds", "effects/australium_ruby"}
local phrases = {"Level Up", "Upgrade", "Promotion", "Training", "Spec Ops", "Reclassification", "Advancement", "Improvement", "Empowerment", "Ameliorate"}
if !self.SubID then self.SubID = math.random(#mats) end
self.SubID = math.min(self.SubID, math.min(10, 3 + math.floor(GetCurZone()/5)))
self.ModelPath = "models/xqm/rails/trackball_1.mdl"
self:SetMaterial(mats[self.SubID])
self:EmitSound("rf/platinum.wav", 115)
self.soundfile = "rf/acquire.wav"
self.Qty = {1, 0}
self.NoImpactNoise = true
self.NoAutoPickup = true
self.ZoneClearPickupImmunity = true
self.NoPickupWhenNotHibernating = true
self.PickupName = phrases[self.SubID] .. " Capsule"
self.Rare = 9
self.Wondrous = true
self.Desc = "Cheat the leveling system once, you handsome rogue."
self.func = function(ent)
for k, v in pairs(player.GetAll()) do
v:SetLv(self.SubID, v.accountdata["level"][self.SubID] + 1)
end
end
elseif self.ItemID == 9 then
self.ModelPath = "models/props_halloween/hwn_flask_vial.mdl"
self.soundfile = "rf/stats/maxhealth.wav"
self.Qty = {1, 0}
self.NoImpactNoise = true
self.PickupName = "Rejuvenation Potion"
self.Rare = 3
self.Desc = "A refreshing, yet flavourless beverage. Recovers 25% Block."
self.func = function(ent)
bignumadd(ent.Block64, bignumdiv(bignumcopy(ent.MaxBlock64), 4))
end
elseif self.ItemID == -1 then
self.Qty = {1, 0}
self.ModelPath = "models/items/medkit_large.mdl"
self:EmitSound("rf/discovery.wav", 115)
self:SetColor(Color(0,0,255))
self.soundfile = "rf/acquire.wav"
self.UseDelay = 6
self.PickupName = "Pulse"
self.Rare = 4
self.NoPhysics = true
self.Desc = "A true death-cheater indeed."
elseif self.ItemID == -2 then
ParticleEffectAttach( "merasmus_spawn", 1, self, 2 )
self.Qty = {1, 0}
self.ModelPath = "models/props_td/atom_bomb.mdl"
self:EmitSound("rf/discovery.wav", 115)
self:SetColor(Color(127,0,255))
self.soundfile = "rf/acquire.wav"
self.PickupName = "Zone Bomb"
self.NoAutoPickup = true
self.Rare = 6
self.NoPhysics = true
self.Desc = "Claim your victory and move onto the next zone."
self.func = function(ent)
ParticleEffect("asplode_hoodoo", ent:GetPos(), Angle(0,0,0))
CompleteZone()
end
else
self:Remove()
end
else
self.Qty = {1, 0}
self.ModelPath = self.CustomModelPath
self.soundfile = self.customsoundfile
self.sndpitch = self.customsndpitch
self:SetMaterial(self.custommaterial)
self:SetModelScale(self.custommodelscale)
self.PickupName = self.CustomPickupName
self.Rare = self.CustomRare
self.NoPhysics = self.CustomNoPhysics
self.ZoneClearPickupImmunity = true
self.Desc = self.CustomDesc
self.func = self.customfunc
self.spawnfunc = self.customspawnfunc
if self.CustomCanOnlyBeTakenBy then
self.CanOnlyBeTakenBy = self.CustomCanOnlyBeTakenBy
end
self.NoAutoPickup = true
end
if self.spawnfunc then self.spawnfunc(self) end
if self.WeaponDrop then
self.func = function(ent) ent:RewardWeapon(self.WeaponClass, self.RndDmg) end
end
if self.NoModel then self.ModelPath = "models/hunter/blocks/cube025x025x025.mdl" end
if self.sndpitch == nil then self.sndpitch = 100 end --error-proofing
if self.NoPhysics then
self:SetModel("models/hunter/blocks/cube025x025x025.mdl")
else
self:SetModel(self.ModelPath)
end
local materialapplication = self:GetMaterial()
self:SetMaterial("null")
self:SetUseType( SIMPLE_USE )
self:SetTrigger(true)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:SetRenderMode(RENDERMODE_TRANSALPHA)
self:SetCollisionGroup(COLLISION_GROUP_WORLD)
if !self.NoModel then
if self.VisualStack then
for i = 1, self.Health64 do
local displaymodel = ents.Create("prop_dynamic")
displaymodel:SetModel(self.ModelPath)
if i != 1 then
displaymodel:SetParent(self:GetChildren()[1])
else
displaymodel:SetParent(self)
end
displaymodel:SetRenderMode(RENDERMODE_TRANSALPHA)
displaymodel:SetModelScale(self:GetModelScale())
displaymodel:SetColor(self:GetColor())
displaymodel:SetMaterial(materialapplication)
displaymodel:SetPos(self:GetPos() + Vector((i-1)*2,(i-1)*2,(i-1)*2))
displaymodel:SetAngles(self:GetAngles())
if displaymodel.SetSkin && self.SkinMod then
displaymodel:SetSkin(self.SkinMod)
end
displaymodel.Indestructible = 1
displaymodel.IsDebris = 1
displaymodel.SubmergeBroken = true
displaymodel:Spawn()
end
else
local displaymodel = ents.Create("prop_dynamic")
displaymodel:SetModel(self.ModelPath)
displaymodel:SetParent(self)
displaymodel:SetRenderMode(RENDERMODE_TRANSALPHA)
displaymodel:SetModelScale(self:GetModelScale())
displaymodel:SetColor(self:GetColor())
displaymodel:SetMaterial(materialapplication)
displaymodel:SetPos(self:GetPos())
displaymodel:SetAngles(self:GetAngles())
displaymodel.Indestructible = 1
displaymodel.IsDebris = 1
displaymodel.SubmergeBroken = true
displaymodel:Spawn()
end
end
self:SetUseType( SIMPLE_USE )
self:SetTrigger(true)
self:PrecacheGibs()
self:DrawShadow(false)
self.BeginUse = true
timer.Simple(0.01, function() if IsValid(self) then self.BeginUse = nil end end) --for insta-give pickups
self.PickedUp = 0
if self.Master then
ParticleEffectAttach( "mr_portal_exit", 1, self, 2 )
ParticleEffectAttach( "mr_portal_entrance", 1, self, 2 )
ParticleEffectAttach( "mr_b_fx_1_core", 1, self, 2 )
for i = 1, 8 do
timer.Simple(i/10, function() if IsValid(self) then
self:EmitSound("rf/super_evolve.mp3",95,50)
local beacon = ents.Create( "prop_dynamic" )
beacon:SetModel("models/worms/telepadsinglering.mdl")
beacon:SetMaterial("pac/default")
beacon.IsDebris = 1
beacon:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
beacon:SetPos(self:GetPos())
beacon:SetColor(Color(math.random(0,255),math.random(0,255),math.random(0,255)))
beacon:SetModelScale(0.001, 0)
beacon:SetModelScale(90, 2)
timer.Simple(2, function() if IsValid(beacon) then
for c = 1, 100 do
timer.Simple(c/100, function() if IsValid(beacon) then
beacon:SetPos(beacon:GetPos() + Vector(0,0,1))
end end)
end
beacon:SetModelScale(0.001, 1)
end end)
timer.Simple(3, function() if IsValid(beacon) then beacon:Remove() end end)
beacon:Spawn()
end end)
end
elseif self.Infinite then
self.NeverRemove = true
ParticleEffectAttach( "mr_b_fx_1_core", 1, self, 2 )
if !self.SilentInfinite then
self:EmitSound("rf/infinity.wav", 95)
end
elseif self.SemiWondrous then
self.NeverRemove = true
ParticleEffectAttach( "mr_effect_03_overflow", 1, self, 2 )
elseif self.Wondrous then
self.NeverRemove = true
ParticleEffectAttach( "mr_portal_entrance", 1, self, 2 )
end
timer.Simple(0, function() if IsValid(self) then
if IsValid(self:GetPhysicsObject()) then
local phys = self:GetPhysicsObject()
phys:AddVelocity(Vector(math.random(-50,50),math.random(-50,50),300))
phys:AddAngleVelocity(Vector(math.random(-1080,1080),math.random(-1080,1080),math.random(-1080,1080)))
end
end end)
self.ArchivePos = self:GetPos()
end
end
if ( CLIENT ) then
function ENT:Draw()
self:DrawModel()
end
end
function ENT:PhysicsCollide( data, physobj )
if (data.Speed > 1 && data.DeltaTime > 0.2 ) then
if !self.SilentCollect && !self.NoImpactNoise then
self:EmitSound( "rf/itemimpact.wav", 75, 100 )
end
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
end
end
function ENT:StartTouch(ply)
if ply:IsPlayer() && self.PickedUp == 0 && !self.NoAutoPickup then
self:Use(ply,ply,3,1)
end
end
function ENT:OnRemove()
if self.ShineSnd then
if self.ShineSnd:IsPlaying() then self.ShineSnd:Stop() end
end
if IsValid(self) then
if self.VisualRemove then
if !self.Descending and self.VisualStack then
for i = 1, self.Health64 do
local debris = ents.Create("base_gmodentity")
timer.Simple(5, function() if IsValid(debris) then debris:Remove() end end)
debris.Indestructible = 1
debris:SetPos(self:GetPos() + Vector((i-1)*2,(i-1)*2,(i-1)*2))
debris:SetModel(self.VisualRemoveModel)
debris:SetMaterial(self.VisualRemoveMaterial)
debris:SetModelScale(self.VisualRemoveModelScale)
debris:SetRenderMode(RENDERMODE_TRANSALPHA)
debris:SetColor(Color(self:GetColor().r, self:GetColor().g, self:GetColor().b, 103))
debris:PhysicsInit(SOLID_VPHYSICS)
debris:SetAngles(self:GetAngles())
debris:Spawn()
debris:SetSolid(SOLID_VPHYSICS)
debris:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
timer.Simple(0, function()
if IsValid(debris:GetPhysicsObject()) then
debris:GetPhysicsObject():SetVelocity(Vector(math.random(-200,200),math.random(-200,200),math.random(100,700)))
debris:GetPhysicsObject():AddAngleVelocity(Vector(math.random(-400,400),math.random(-400,400),math.random(-400,400)))
end
end)
end
else
local debris = ents.Create("base_gmodentity")
timer.Simple(5, function() if IsValid(debris) then debris:Remove() end end)
debris.Indestructible = 1
debris:SetPos(self:GetPos())
debris:SetModel(self.VisualRemoveModel)
debris:SetMaterial(self.VisualRemoveMaterial)
debris:SetRenderMode(RENDERMODE_TRANSALPHA)
debris:SetColor(Color(self:GetColor().r, self:GetColor().g, self:GetColor().b, 103))
debris:PhysicsInit(SOLID_VPHYSICS)
debris:SetAngles(self:GetAngles())
debris:Spawn()
debris:SetSolid(SOLID_VPHYSICS)
debris:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
timer.Simple(0, function()
if IsValid(debris:GetPhysicsObject()) then
debris:GetPhysicsObject():SetVelocity(Vector(math.random(-200,200),math.random(-200,200),math.random(100,700)))
debris:GetPhysicsObject():AddAngleVelocity(Vector(math.random(-400,400),math.random(-400,400),math.random(-400,400)))
end
end)
end
end
end
end
function ENT:OnTakeDamage( dmginfo )
end
function ENT:ActivateEffect( ply )
local raritycolours = {Color(255,255,255), Color(0,255,0), Color(0,133,255), Color(127,0,255),Color(255,135,0),Color(0,255,255),Color(255,0,0),Color(0,0,255),Color(255,133,133),Color(0,0,0),Color(255,0,255)}
if !self.SilentCollect then
SendPopoff(self.PickupName, ply,Color(0,0,0),raritycolours[math.min(math.max(1,self.Rare),#raritycolours) or 1])
end
if self.func then self.func(ply) end
end
if SERVER then
function ENT:Think()
if IsValid(self:GetChildren()[1]) && self.NoPhysics then
local child = self:GetChildren()[1]
child:SetAngles(Angle(0,CurTime()*50,0))
end
if self.Rare then
if self.Rare == 9 && self.ItemID != -3 then
if !self.ShineSnd then self.ShineSnd = CreateSound(self,"rf/loot_ambient.wav") end
if self.PickedUp == 0 then self.ShineSnd:Play() elseif self.ShineSnd:IsPlaying() then self.ShineSnd:Stop() end
end
if self.Rare == 10 && self.ItemID != -3 then
if !self.ShineSnd then self.ShineSnd = CreateSound(self,"rf/loot_ambient.wav") end
if self.PickedUp == 0 then self.ShineSnd:Play() self.ShineSnd:ChangePitch(50) elseif self.ShineSnd:IsPlaying() then self.ShineSnd:Stop() end
end
end
if !self.ArchivePos then self.ArchivePos = self:GetPos() end
if !util.IsInWorld(self.ArchivePos) && self.PickedUp != 1 then self:Remove() end --if we somehow first spawned outside the world
if self.PickedUp == 0 then
--if (GetConVar("craftworld3_pickups"):GetInt() or 1) == 0 then self:Remove() end
for k, hurt in pairs(ents.FindInSphere(self:GetPos(),1)) do
if hurt:GetClass() == "trigger_hurt" && self.PickedUp != 1 then
if !self.Retries then self.Retries = 0 end
self:SetPos(self.ArchivePos)
self:EmitSound("rf/discharge.wav")
self.Retries = self.Retries + 1
WarpFX(self)
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
if self.Retries > 10 then --still in water even after teleportation/teleported 10 times?
self:Remove()
end
end
end
if !self.Retries then self.Retries = 0 end
if self:WaterLevel() > 0 && self.PickedUp != 1 then
if !self.Retries then self.Retries = 0 end
self:SetPos(self.ArchivePos)
self:EmitSound("rf/discharge.wav")
self.Retries = self.Retries + 1
WarpFX(self)
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
if self:WaterLevel() > 0 or self.Retries > 10 then --still in water even after teleportation/teleported 10 times?
self:Remove()
end
end
end
if self.CanOnlyBeTakenBy then --is this item assigned to a player?
if not IsValid(self.CanOnlyBeTakenBy) then --does the said player no longer exist?
WarpFX(self)
self:Remove()
end
end
self:SetNWString("pickname", self.PickupName or "?")
self:SetNWString("pickdesc", self.Desc or "")
self:SetNWInt("pickamount", 1)
self:SetNWInt("pickrarity", self.Rare or 1)
self:SetNWString("itemowner", "unassigned")
self:RemoveAllDecals()
self:NextThink( CurTime() )
return true
end
end
function ENT:Use( ply, caller )
if self.PickedUp == 0 then
if self.DontAnimate then self.Immediate = true end
if ply:IsPlayer() && caller:IsPlayer() then
if self.NoPickupWhenNotHibernating && !Hibernating() then ply:PrintMessage(HUD_PRINTCENTER, "This item cannot be taken whilst the zone is not hibernating.") return end
if self.CanOnlyBeTakenBy then
if self.CanOnlyBeTakenBy != ply then
ply:PrintMessage(HUD_PRINTCENTER, "This item can only be taken by: " .. self.CanOnlyBeTakenBy:Nick())
end
end
if (self.ItemOwner == "unassigned" or self.ItemOwner == ply:SteamID()) && !self.DisallowUse then
if !self.BeginUse then
self.DisallowUse = true
local dupes = {}
if !self.NoMerge then
for k, v in pairs(ents.FindInSphere(self:GetPos(), 155)) do
if v != self then
if v.ItemID == self.ItemID && v.PickedUp != 1 && !v.BusyMerging then
table.insert(dupes, v)
end
end
end
end
if #dupes > 0 then
self.BusyMerging = true
local phys = self:GetPhysicsObject()
for k, v in pairs(dupes) do
if v.Rare > self.Rare then self.Rare = v.Rare end
self.Health64 = self.Health64 + v.Health64
v.DisallowUse = true
v.PickedUp = 1
if v.OneAtATime then
if v.soundfile then
v:EmitSound(v.soundfile, 72, v.sndpitch)
end
else
local soundtomake = self.soundfile or "NOSOUND"
local pitchtomake = self.sndpitch
for i = 1, #dupes do
timer.Simple(i/10, function() if IsValid(ply) then
if soundtomake != "NOSOUND" then
ply:EmitSound(soundtomake, 75, pitchtomake)
end
end end)
end
end
v:SetMoveType(MOVETYPE_NONE)
v:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
for i = 1, 26 do
timer.Simple(i/30, function() if IsValid(v) && IsValid(self) then
if i == 26 then
v:Remove()
else
local sourceangle = v:GetAngles()/25
local targetangle = self:GetAngles()/25
local sourceposition = v:GetPos()/25
local targetposition = self:GetPos()/25
local anglemath = (sourceangle*(25-i)) + (targetangle*i)
local positionmath = (sourceposition*(25-i)) + (targetposition*i)
v:SetPos(positionmath)
v:SetAngles(anglemath)
end
elseif IsValid(v) then
v:Remove()
end end)
end
end
self.DisallowUse = nil
self.BusyMerging = nil
self.NoMerge = true
self.NoMerge_Toggle = true
self:Use(ply,ply,3,1)
elseif self.OneAtATime && self.Health64 > 1 then
local onesie = ents.Create("cw3_pickup")
onesie.ItemID = self.ItemID
onesie.ItemOwner = ply:SteamID()
onesie:SetPos(self:GetPos())
onesie:SetAngles(self:GetAngles())
onesie.Health64 = 1
onesie.NoMerge = true
onesie.SkipUnbox = true
onesie:Spawn()
timer.Simple(0, function() if IsValid(onesie) && IsValid(ply) then if IsValid(self) then onesie.Rare = self.Rare end onesie:Use(ply,ply,3,1) end end)
self.Health64 = self.Health64 - 1
self.DisallowUse = nil
else
self.BeginUse = true
self.DisallowUse = nil
timer.Simple(0, function() if IsValid(self) && IsValid(ply) then self:Use(ply,ply,3,1) end end)
end
if self.NoMerge_Toggle then
self.NoMerge_Toggle = nil
self.NoMerge = nil
end
else
self.PickedUp = 1
if self.Descending then self.Immediate = false end --not compatible with Immediate trait
self:SetCollisionGroup(COLLISION_GROUP_WORLD)
local RandomX = math.Rand(-15,15)
local RandomY = math.Rand(-15,15)
local RandomZ = math.Rand(10,30)
self.RandomVector = Vector( RandomX, RandomY, RandomZ )
if !self.speedmult then self.speedmult = 1 end
if !self.speedmultoffset then self.speedmultoffset = 0 end
local speed = self.speedmult + self.speedmultoffset
if ply.classed == "beserker" && !self.Immedate then speed = speed*2 end
if ply.Dexterity && !self.Immediate then speed = speed/3 end
if self.Rare == 10 then
ply:EmitSound("rf/omega.wav", 85, 50)
ply:EmitSound("rf/omega.wav", 85, 50)
ply:EmitSound("rf/super_evolve.mp3", 85, 100)
elseif self.Rare == 9 then
ply:EmitSound("rf/omega.wav", 85, 100)
elseif self.Rare == 8 or self.Rare == 7 then
ply:EmitSound("rf/rareitem.wav", 85, 100)
end
if self.Immediate or self.RemoveOnUse then
self:ActivateEffect(ply)
if self.RemoveOnUse then
if self.BreakEffect then
local soundtable = { "rf/armor/woodbreak" .. math.random(1,3) .. ".wav", "rf/armor/plasticbreak" .. math.random(1,4) .. ".wav", "rf/armor/woodbreak" .. math.random(1,3) .. ".wav", "rf/armor/metalbreak" .. math.random(1,5) .. ".wav" }
if IsValid(ply) then ply:EmitSound(soundtable[self.BreakEffect]) end
DynamicEffect(self:GetPos(), self.BreakEffect)
end
end
end
if self.RemoveOnUse then self:Remove() else
timer.Simple(self.UseDelay, function() if IsValid(self) then
--speed = 5
if self.soundfile && !self.nosnd then
if self.VisualStack && !self.Descending then
local archivesnd = self.soundfile
local archivepitch = self.sndpitch
for s = 1, self.Health64 do
timer.Simple((s-1)/20, function() if IsValid(ply) then
ply:EmitSound(archivesnd, 75, archivepitch)
end end)
end
else
ply:EmitSound(self.soundfile, 75, self.sndpitch)
end
end
self:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
self:SetMoveType(MOVETYPE_NONE)
self:SetModelScale(1, speed/10)
if IsValid(self:GetPhysicsObject()) then self:GetPhysicsObject():EnableMotion(false) end
local pos = self:GetPos()/(20*speed)
local ang = self:GetAngles()/(20*speed)
for i=1,130*speed do
timer.Simple(i/100, function()
if IsValid(self) then
local headpos
local headbone = "ValveBiped.Bip01_Head1"
if ply:GetBonePosition(ply:LookupBone(headbone)) then
headpos = ply:GetBonePosition(ply:LookupBone(headbone)) + Vector(0,0,15) + self.RandomVector
else
headpos = Vector(0,0,25+ply:OBBMaxs()) + self.RandomVector
end
local calcpos = (pos*((20*speed) - i)) + ((headpos/(20*speed))*i)
if i >= 110*speed && !self.JustResized then
self:SetModelScale(0.01,speed/5)
self.JustResized = true
if IsValid(self:GetChildren()[1]) then
self:GetChildren()[1]:SetModelScale(0.01,speed/5)
local subject = self:GetChildren()[1]:GetChildren()
for c = 1, #subject do
subject[c]:SetModelScale(0.01,speed/5)
end
end
end
if i <= 20*speed then
self:SetPos(calcpos)
self:SetAngles(self:GetAngles() - ang)
elseif i >= 110*speed then
self:SetPos((ply:GetBonePosition(ply:LookupBone(headbone))*(1-self:GetModelScale())) + (headpos*self:GetModelScale()))
else
self:SetPos(headpos)
self:SetAngles(Angle(0,0,0))
end
end
end)
end
timer.Simple(((130*speed)/100) + 0.1, function() if IsValid(self) then
if !self.Immediate then if IsValid(ply) then self:ActivateEffect(ply) end end
if self.PFX then
ParticleEffect(self.PFX, self:GetPos(), Angle(0,0,0))
end
if self.BreakEffect then
local soundtable = { "rf/armor/woodbreak" .. math.random(1,3) .. ".wav", "rf/armor/plasticbreak" .. math.random(1,4) .. ".wav", "rf/armor/woodbreak" .. math.random(1,3) .. ".wav", "rf/armor/metalbreak" .. math.random(1,5) .. ".wav" }
if IsValid(ply) then ply:EmitSound(soundtable[self.BreakEffect]) end
DynamicEffect(self:GetPos(), self.BreakEffect)
end
if !self.IsCrystal then self:Remove() end
end end)
end end)
end
end
elseif !self.DisallowUse then
ply:PrintMessage(HUD_PRINTCENTER, "Please wait for this item to become available (wait for the '!' mark to appear).")
end
end
end
end |
--[[
Copyright (c) 2015 深圳市辉游科技有限公司.
--]]
local HelpLayer = class('HelpLayer')
local utils = require('utils.utils')
local AccountInfo = require('AccountInfo')
local showMessageBox = require('UICommon.MsgBox').showMessageBox
local showToastBox = require('UICommon.ToastBox2').showToastBox
local hideToastBox = require('UICommon.ToastBox2').hideToastBox
function HelpLayer.extend(target, ...)
local t = tolua.getpeer(target)
if not t then
t = {}
tolua.setpeer(target, t)
end
setmetatable(t, HelpLayer)
if type(target.ctor) == 'function' then
target:ctor(...)
end
return target
end
function HelpLayer:ctor()
self.showCloseButton = true
self.autoClose = false
self.grayBackground = true
self.closeOnClickOutside = true
self.closeAsCancel = true
self:init()
end
function HelpLayer:init()
local this = self
local rootLayer = self
local currentUser = AccountInfo.getCurrentUser()
local selfUserId = currentUser.userId
local uiRoot = cc.CSLoader:createNode('HelpLayer.csb')
self.uiRoot = uiRoot
rootLayer:addChild(uiRoot)
-- self.uiRoot:setOpacity(0)
require('utils.UIVariableBinding').bind(uiRoot, self, self)
self:initKeypadHandler()
self.PanelGray:setVisible(self.grayBackground)
this.MsgPanel:setVisible(true)
this.MsgPanel:setScale(0.001)
this.PanelRule:setVisible(false)
this.PanelFeedback:setVisible(true)
this:ButtonAbout_onClicked(this.ButtonAbout)
self:registerScriptHandler(function(event)
--print('event => ', event)
utils.invokeCallback(this["on_" .. event], this)
end)
self.LabelVersion:setString('v' .. require('version'))
end
function HelpLayer:on_enter()
local this = self
this.MsgPanel:runAction(
cc.Sequence:create(
cc.EaseElasticInOut:create(cc.ScaleTo:create(0.5, 1.0), 0.5),
cc.CallFunc:create(function()
-- if this.autoClose then
-- this:runAction(cc.Sequence:create(
-- cc.DelayTime:create(this.autoClose),
-- cc.CallFunc:create(__bind(this.close, this))
-- ))
-- end
end)
)
)
end
function HelpLayer:on_cleanup()
local this = self
end
function HelpLayer:close()
local this = self
--self.uiRoot:setOpacity(0)
if this.closing then
return
end
this.closing = true
this.PanelGray:setVisible(false)
this.MsgPanel:runAction(
cc.Sequence:create(
cc.EaseElasticInOut:create(cc.ScaleTo:create(0.5, 0.001), 0.5),
cc.TargetedAction:create(this, cc.RemoveSelf:create())
)
)
-- self.MsgPanel:setVisible(false)
-- self.ImageBox:setVisible(true)
-- self.ImageBox:runAction(
-- cc.Sequence:create(
-- cc.ScaleTo:create(0.15, 1),
-- cc.TargetedAction:create(this, cc.RemoveSelf:create())
-- )
-- )
end
function HelpLayer:initKeypadHandler()
local function onKeyReleased(keyCode, event)
if keyCode == cc.KeyCode.KEY_BACKSPACE then
event:stopPropagation()
self:ButtonClose_onClicked(self.ButtonClose_onClicked)
elseif keyCode == cc.KeyCode.KEY_MENU then
--label:setString("MENU clicked!")
end
end
local listener = cc.EventListenerKeyboard:create()
listener:registerScriptHandler(onKeyReleased, cc.Handler.EVENT_KEYBOARD_RELEASED )
self:getEventDispatcher():addEventListenerWithSceneGraphPriority(listener, self)
end
function HelpLayer:ButtonCancel_onClicked(sender, eventType)
if utils.invokeCallback(self.onCancelCallback) == false then
return
else
self:close()
end
end
function HelpLayer:ButtonOk_onClicked(sender, eventType)
local this = self
if this.closing then
return
end
if utils.invokeCallback(self.onOkCallback) == false then
return
else
self:close()
end
end
function HelpLayer:ButtonClose_onClicked(sender, eventType)
local this = self
if this.closing then
return
end
self:close()
end
function HelpLayer:RootBox_onClicked(sender, eventType)
if self.closeOnClickOutside then
if self.ButtonCancel:isVisible() then
self:ButtonCancel_onClicked(self.ButtonCancel)
elseif self.ButtonOk:isVisible() then
self:ButtonOk_onClicked(self.ButtonOk)
end
end
end
function HelpLayer:ButtonAbout_onClicked(sender)
if not self.PanelRule:isVisible() then
self.TabFeedback:setClippingEnabled(true)
self.TabAbout:setClippingEnabled(false)
self.PanelRule:setVisible(true)
self.PanelFeedback:setVisible(false)
end
-- if self.PageView:getCurPageIndex() ~= 0 then
-- self.TabFeedback:setClippingEnabled(true)
-- self.TabAbout:setClippingEnabled(false)
-- self.PageView:scrollToPage(0)
-- end
end
function HelpLayer:ButtonFeedback_onClicked(sender)
if not self.PanelFeedback:isVisible() then
self.TabAbout:setClippingEnabled(true)
self.TabFeedback:setClippingEnabled(false)
self.PanelFeedback:setVisible(true)
self.PanelRule:setVisible(false)
end
end
function HelpLayer:ButtonSubmitFeedback_onClicked(sender)
local this = self
local feedback = self.Feedback:getString()
feedback = string.trim(feedback)
if #feedback < 10 then
local msgParam = {
msg = '请输入至少10文字的反馈意见'
, grayBackground = true
, closeOnClickOutside = true
, buttonType = 'ok|close'
, closeAsCancel = true
}
showMessageBox(this, msgParam)
return
end
self.Feedback:setString('')
local toastParams = {
zorder = 1099,
showLoading = false,
grayBackground = false,
closeOnTouch = true,
closeOnBack = true,
showingTime = 2,
msg = '您的反馈已提交,非常感谢您宝贵的意见。'
}
showToastBox(this, toastParams)
end
local function showHelp(container)
local layer = cc.Layer:create()
local newLayer = HelpLayer.extend(layer)
newLayer:setLocalZOrder(1000)
container:addChild(newLayer)
end
return {
showHelp = showHelp
} |
local t = require( "taptest" )
local digitsum = require( "digitsum" )
t( digitsum( 1234 ), 10 )
t()
|
require("base.flang_import")
-- load our file
filename = "samples/1.flang"
local f = assert(io.open(filename, "r"))
local t = f:read("*all")
f:close()
print(t)
-- give it to the scanner
scanner = Flang.Scanner:new({sourceText = t})
while true do
char = scanner:get()
print(tostring(char))
if (char.cargo == Flang.Character.ENDMARK) then
break
end
end
|
-- last changes by: Tinsus at: 2016-07-02T09:27:42Z project-version: v1.9beta1 hash: eafe20edfe4fe4e78f770c249436eecdac101094
local LI = _G.LI
-- missing -> bossindent, posting dkps
--> reduce LI_DKP_own on bid and read it later...
LI.CurrentItems = {}
LI.CurrentDice = {}
LI.SendCache = {}
LI.NeedAssignment = {}
function LI.CountingDownDices()
for name, value in ipairs(LI.NeedAssignment) do
if LI.NeedAssignment[name]["timeout"] ~= nil then
LI.NeedAssignment[name]["timeout"] = LI.NeedAssignment[name]["timeout"] - 1
if LI.NeedAssignment[name]["timeout"] < 0 then
LI.DiceResult(value.link)
end
end
end
end
function LI.GroupItem(item)
if LI.IsValidSystem() then
local _, data = ParseHyperlink(item)
local hexID, Adura, stat12, stat34, stat56 = string.match(data, "(%x+) %x+ (%x+) (%x+) (%x+) (%x+) .*")
local short = LI.BuildShortLink(hexID, Adura, stat12, stat34, stat56, item)
if IsAssigner() then
table.insert(LI.NeedAssignment, {link = item, count = GetNumPartyMembers() or GetNumRaidMembers(), timeout = 9})
table.insert(LI.CheckForDicer, {item, short})
end
end
end
LI.CheckForDicer = {}
function LI.GroupAskItem(shortitem)
if LI.IsValidSystem() then
for i = 1, 6 do
if not getglobal("LI_LootFrame"..i.."_Show"):IsVisible() then
getglobal("LI_LootFrame"..i).link = LI.ShortLinks[shortitem]
getglobal("LI_LootFrame"..i):Show()
return
end
end
table.insert(LI.CurrentItems, shortitem)
end
end
function LI.CheckForDicers(item, short)
local lootID, name
local _, nameing = ParseHyperlink(item)
nameing = TEXT("Sys"..LI.HexToDec(string.match(nameing, "(%x+) %x+ (%x+) (%x+) (%x+) (%x+) .*")).."_name")
local luckys, b = {"900"..short.."~"}, 0
for i = 1, GetLootAssignItemSize() do
lootID, name = GetLootAssignItemInfo(i)
if name == nameing then
b = b + 1
end
end
if b > 1 then -- skipping items with the same name (already dicing)
for key, value in ipairs(LI.NeedAssignment) do
if value.link == item and LI.NeedAssignment[key]["dicetype"] ~= nil then
return table.insert(LI.CheckForDicer, {item, short})
end
end
end
LI.ResetTooltip()
LootIt_GameTooltip:SetHyperLink(item)
if yaCIt then
yaCIt.ShowTooltipBySelf(LootIt_GameTooltip)
end
local quality = LI.GetQuality(item)
local result = LI_MasterFilterChar[name]
if LI.Filterchecker("!"..TEXT("ITEM_QUALITY3_DESC").."&|$"..TEXT("SYS_WEAPON_POS04").."&|"..TEXT("Sys203606_name"), {false, true}, name, true, 3, quality) then
LI.SendToWeb(6, nil, item)
end
if not result then
for star = 1, 3 do
for filtername, value in pairs(LI_MasterFilterCharSpezial) do
result = LI.Filterchecker(filtername, {false, value}, name, true, star, quality)
if result then
break
end
end
if result then
break
end
end
end
if not result then
if quality <= LI_Data.Options.automaster then
result = 10
end
end
if result == 10 or result == 11 then
for i = 1, 36 do
local allowed = GetLootAssignMember(lootID, i)
local done = false
for j = 1, 36 do
if UnitName("raid"..j) == allowed then
done = true
if result == 11 then
table.insert(luckys, 9)
else
table.insert(luckys, math.random(1, 8))
end
break
end
end
if not done then
table.insert(luckys, 0)
end
end
LI.Send(table.concat(luckys))
for key, value in ipairs(LI.NeedAssignment) do
if value.link == item then
LI.NeedAssignment[key]["dicetype"] = result
break
end
end
end
end
function LI.GroupItemGot(link, name)
if LI.IsValidSystem() then
local _, nameing = ParseHyperlink(link)
local hexID, Adura, stat12, stat34, stat56 = string.match(nameing, "(%x+) %x+ (%x+) (%x+) (%x+) (%x+) .*")
local indent = hexID..string.sub(Adura, string.len(Adura) - 2, string.len(Adura))..stat12..stat34..stat56
local found = false
for i = 1, 6 do
if getglobal("LI_LootFrame"..i.."_Show"):IsVisible() then
if getglobal("LI_LootFrame"..i).link == link then
found = i
break
else
local _, nameing = ParseHyperlink(getglobal("LI_LootFrame"..i).link)
local hexID, Adura, stat12, stat34, stat56 = string.match(nameing, "(%x+) %x+ (%x+) (%x+) (%x+) (%x+) .*")
if indent == hexID..string.sub(Adura, string.len(Adura) - 2, string.len(Adura))..stat12..stat34..stat56 then
found = i
break
end
end
end
end
if found then
getglobal("LI_LootFrame"..found):Hide()
end
end
end
function LI.LootFrame_OnHide(this)
this.timeout = 300
getglobal(this:GetName().."_Show").timeout = 0.5
end
function LI.ReShow_OnUpdate(this, elapsedTime)
if this.timeout and elapsedTime then
this.timeout = this.timeout - elapsedTime
if this.timeout <= 0 then
this:Hide()
end
end
end
function LI.ReShow_OnHide(this)
this.timeout = nil
if string.find(this:GetName(), "DKP") then
if #LI.CurrentDKPItems ~= 0 then
LI.GroupAskDKPItem()
end
else
if #LI.CurrentItems ~= 0 then
LI.GroupAskItem(table.remove(LI.CurrentItems))
end
end
end
function LI.LootFrame_OnUpdate(this, elapsedTime)
this.timeout = this.timeout - elapsedTime
if this.timeout <= 0 then
LI.RollLoot(this, "pass", true)
end
end
function LI.ManageDices(name, value)
if name == UnitName("player") and #LI.CurrentDice > 0 then
local val = table.remove(LI.CurrentDice)
if val[2] == 3 then
value = LI.CurrentDKPBid[val[1]]
LI.CurrentDKPBid[val[1]] = nil
end
value = tostring(string.format("%x", value))
if string.len(value) == 1 then
value = "0"..value
end
if val[2] == 3 then
value = value.."--"
end
value = val[2]..value..val[1]
LI.Send(value)
end
end
function LI.UseChat()
if #LI.SendCache ~= 0 then
local msg = ""
repeat
local val = table.remove(LI.SendCache)
if (string.len(msg) + string.len(val) + 4) < 230 then
msg = msg.."~"..val
else
table.insert(LI.SendCache, 1, val)
break
end
until #LI.SendCache == 0
LI.SendMsg(msg)
end
end
function LI.Send(msg)
if msg == "NoMoreValid" and not LI_invalid then
LI_invalid = true
elseif msg == "NoMoreValid" and LI_invalid then
return
end
table.insert(LI.SendCache, msg)
end
function LI.SendMsg(msg)
local key
repeat
key = math.random(0, 94)
until key + 32 ~= 37 and key + 32 ~= 92 and key + 32 ~= 124 and LI.Decrypt(LI.Encrypt(msg, key), key) == msg
if DC and DC.Hooked_SendChatMessage then
DC.Hooked_SendChatMessage(LI.AddCheckSum(string.char(key + 32)..LI.Encrypt(msg, key)), "PARTY")
else
SendChatMessage(LI.AddCheckSum(string.char(key + 32)..LI.Encrypt(msg, key)), "PARTY")
end
end
function LI.DetectDiceShout(msg, name)
if not LI.IsValidShoud(msg) then
return true
elseif msg == LI.lastDetect then
return false
else
LI.lastDetect = msg
end
msg = LI.Decrypt(string.sub(msg, 4), string.byte(msg, 3) - 32)
repeat
-- Splitting
if string.find(msg, "~") then
msg = string.sub(msg, 2)
end
local start, data = string.find(msg, "~")
if start then
data = string.sub(msg, 1, start - 1)
msg = string.sub(msg, start)
else
data = msg
msg = ""
end
if not LI.DetectSysMsges(data, name) then
if name ~= UnitName("player") then
LI.SelfValid()
end
local typ = tonumber(string.sub(data, 1, 1))
local dice = LI.HexToDec(string.sub(data, 2, 3))
local link = LI.ShortLinks[string.sub(data, 4)]
local _, bidend = string.find(data, "%x+%-%-")
if bidend then
dice = LI.HexToDec(string.sub(data, 2, bidend - 2))
link = LI.ShortLinks[string.sub(data, bidend + 1)]
end
if IsAssigner() and typ == 4 and LI_DKP[LI_DKP_web.system]["user"][name] ~= nil and LI_DKP[LI_DKP_web.system]["user"][name] > dice then
dice = LI_DKP[LI_DKP_web.system]["user"][name]
end
-- Splitting
-- Allowed to dice on the item?
if typ == 9 then
link = string.sub(data, 4)
start = string.find(msg, "~")
for i = 1, 36 do
if UnitName("raid"..i) == UnitName("player") then
if string.byte(msg, i + 1) ~= 48 then
if string.byte(msg, i + 1) == 57 then
LI.GroupAskDKPItem(link)
else
LI.GroupAskItem(link)
end
end
break
end
end
-- Allowed to dice on the item?
-- Chat-Message with dice-result
elseif data and data ~= "" and not (string.len(data) == 36 and tonumber(data)) then
local typ2 = dice
if typ == 0 then
typ2 = ""
end
if not link then
return
end
local types = {TEXT("SYS_GIVE_UP"), LI.GROUPLOOT_GREED, LI.GROUPLOOT_ROLL, LI.Trans("DKP")}
LI.History(link, name, types[(tonumber(typ) or 0) + 1], typ2)
local quality = LI.GetQuality(link)
local info = ChatTypeInfo["SYSTEM"]
if LI_Data.Options["result"..quality..(typ + 1)] then
if LI_DKP_Mode == nil or LI_DKP_Mode ~= 1 or (LI_DKP_Mode == 1 and typ == 4) then
if LI_Data.Options.otherstyle then
local colors = {
{info.r * 0.75, info.g * 0.75, info.b * 0.75 },
{info.r, info.g , info.b },
{1 - (1 - info.r) * 0.75, 1 - (1 - info.g) * 0.75, 1 - (1 - info.b) * 0.75 },
{1 - (1 - info.r) * 0.75, 1 - (1 - info.g) * 0.75, 1 - (1 - info.b) * 0.75 },
}
DEFAULT_CHAT_FRAME:AddMessage(link.." - |Hplayer:"..name.."|h["..name.."]|h "..types[(tonumber(typ) or 0) + 1].." "..typ2, colors[(tonumber(typ) or 0) + 1][1], colors[(tonumber(typ) or 0) + 1][2], colors[(tonumber(typ) or 0) + 1][3])
else
DEFAULT_CHAT_FRAME:AddMessage(typ2.."|Hplayer:"..name.."|h["..name.."]|h "..types[(tonumber(typ) or 0) + 1].." "..link, info.r, info.g, info.b)
end
end
end
-- Chat-Message with dice-result
-- Storing results for Assignment
if IsAssigner() then
if typ == 0 then
dice = 0
else
dice = (typ - 1) * 100 + dice
end
for key, value in ipairs(LI.NeedAssignment) do
if value.link == link then
if LI.NeedAssignment[key] ~= nil and LI.NeedAssignment[key]["count"] ~= nil then
LI.NeedAssignment[key]["count"] = LI.NeedAssignment[key]["count"] - 1
LI.NeedAssignment[key][name] = dice
if LI.NeedAssignment[key]["count"] <= 0 then
LI.DiceResult(link)
end
end
break
end
end
end
end
end
until string.len(msg) <= 0
end
StaticPopupDialogs["LOOTIT_VALIDSYSTEM"] = {
button1 = TEXT("YES"),
button2 = TEXT("NO"),
whileDead = 1,
exclusive = 1,
showAlert = 1,
timeout = 60,
OnCancel = function()
if not LI_Data.Options.autodkp then
LI.Send("NotOkey")
end
end,
OnAccept = function()
LI.Send("Okey")
end,
OnShow = function()
if LI_Data.Options.autodkp then
LI.SendMsg("Okey")
end
end,
}
StaticPopupDialogs["LOOTIT_NOSYSTEM"] = {
button1 = TEXT("OK"),
whileDead = 1,
exclusive = 1,
showAlert = 1,
hideOnEscape = 1,
timeout = 10,
}
StaticPopupDialogs["LOOTIT_BROKENSYSTEM"] = {
button1 = TEXT("OK"),
whileDead = 1,
exclusive = 1,
showAlert = 1,
hideOnEscape = 1,
timeout = 10,
}
StaticPopupDialogs["LOOTIT_DONESYSTEM"] = {
button1 = TEXT("OK"),
whileDead = 1,
exclusive = 1,
hideOnEscape = 1,
timeout = 5,
}
function LI.DetectSysMsges(msg, name)
if string.find(msg, "ItsMe#.+") and not LI.IsValidSystem() then
LI.ValidThreshold = GetLootThreshold()
LI.ValidMember = string.match(msg, "#.+")
LI.ValidMember = string.sub(LI.ValidMember, 2)
LI.ValidMember = string.sub(LI.ValidMember, 1)
LI.LastMaster = LI.ValidMember
LI.MakeValid = true
LI_invalid = nil
StaticPopupDialogs["LOOTIT_DONESYSTEM"]["text"] = LI.Trans("MESSAGE_DKP_DONE")
StaticPopup_Show("LOOTIT_DONESYSTEM")
return true
elseif string.find(msg, "HowIsIt") and IsAssigner() then
LI.Send("ItsMe#"..LI.ValidMember)
if not LI_DKP[LI_DKP_web.system]["user"][name] then
LI_DKP[LI_DKP_web.system]["user"][name] = 0
end
LI.Send("IniDKP#"..tostring(name).."#"..tostring(LI_DKP[LI_DKP_web.system]["user"][name]))
return true
elseif string.find(msg, "SetDKP#.+##") then
if IsPartyLeader("player") or UnitIsRaidLeader("player") then
LI.SaveOwnLoot("alternate")
end
LI.CountOkeys = {}
for i = 1, 36 do
if UnitName("raid"..i) then
LI.CountOkeys[UnitName("raid"..i)] = true
end
end
StaticPopupDialogs["LOOTIT_VALIDSYSTEM"]["text"] = LI.Trans("MESSAGE_DKP_SET")
local text1 = string.match(msg, "#.+#")
text1 = string.sub(text1, 2)
text1 = string.sub(text1, 1, string.len(text1) - 2)
local text2 = string.match(msg, "##.+")
text2 = string.sub(text2, 3)
StaticPopup_Show("LOOTIT_VALIDSYSTEM", text1, text2)
LI.ValidMember = text1
LI.ValidThreshold = tonumber(text2)
return true
elseif msg == "Okey" then
LI.CountOkeys[name] = nil
local i = 0
for _ in pairs(LI.CountOkeys) do
i = i + 1
end
if i == 0 and (IsPartyLeader("player") or UnitIsRaidLeader("player") or tostring(LI.ValidMember) == UnitName("player")) then
LI.MakeValid = false
LI.SaveOwnLoot("master", LI.ValidThreshold, LI.ValidMember)
end
return true
elseif msg == "NotOkey" then
StaticPopup_Hide("LOOTIT_VALIDSYSTEM")
StaticPopupDialogs["LOOTIT_NOSYSTEM"]["text"] = LI.Trans("MESSAGE_DKP_FAIL")
StaticPopup_Show("LOOTIT_NOSYSTEM")
LI.MakeValid = nil
return true
elseif msg == "NoMoreValid" then
StaticPopupDialogs["LOOTIT_BROKENSYSTEM"]["text"] = LI.Trans("MESSAGE_DKP_BROKEN")
if LI.IsValidSystem() then
StaticPopup_Show("LOOTIT_BROKENSYSTEM")
end
LI.MakeValid = nil
LI.ValidThreshold = nil
LI.LastMaster = nil
LI.ValidMember = nil
LI_invalid = nil
LI_DKP_own = nil
if IsPartyLeader("player") or UnitIsRaidLeader("player") then
LI.SaveOwnLoot("alternate")
end
return true
elseif msg == "ValidSystemSetUp" then
StaticPopupDialogs["LOOTIT_DONESYSTEM"]["text"] = LI.Trans("MESSAGE_DKP_DONE")
StaticPopup_Show("LOOTIT_DONESYSTEM")
LI.DKP_SendData()
LI_invalid = nil
LI.MakeValid = true
return true
elseif string.find(msg, "^Method") then
LI_DKP_Mode = string.gfind(msg, "%d+")
LI_DKP_Mode = LI_DKP_Mode()
LI_DKP_Mode = tonumber(LI_DKP_Mode)
return true
elseif string.find(msg, "IniDKP#") then
LI.SelfValid()
local start, ende = string.find(msg, "#"..tostring(UnitName("player")).."#")
if start then
LI_DKP_own = tonumber(string.sub(msg, ende + 1))
end
return true
elseif string.find(msg, "DKPPlus#") then
LI.SelfValid()
local start, ende = string.find(msg, "#")
if start then
LI_DKP_own = LI_DKP_own + tonumber(string.sub(msg, ende + 1))
end
return true
elseif string.find(msg, "DKPEdit#") then
LI.SelfValid()
local start, ende = string.find(msg, "#"..tostring(UnitName("player")).."#")
if start then
LI_DKP_own = LI_DKP_own + tonumber(string.sub(msg, ende + 1))
end
return true
end
end
function LI.SelfValid()
if not LI.IsValidSystem() then
if IsAssigner() then
LI.Send("NoMoreValid")
else
LI.Send("HowIsIt")
end
end
end
LI_DKP_Mode = 0
LI_DKP_own = nil
LI.ItemsToSpend = {}
LI.Pass = 0
function LI.DiceResult(link)
table.insert(LI.ItemsToSpend, link)
end
function LI.SpendItems(link)
local lucky = UnitName("player")
local luckyvalue, lootID, key, name = 0
if IsAssigner() and GetLootAssignItemSize() ~= 0 then
for name2, value in ipairs(LI.NeedAssignment) do
if value.link == link then
key = name2
break
end
end
if not key then
return
end
local _, nameing = ParseHyperlink(link)
nameing = TEXT("Sys"..LI.HexToDec(string.match(nameing, "(%x+) %x+ (%x+) (%x+) (%x+) (%x+) .*")).."_name")
for i = 1, GetLootAssignItemSize() do
lootID, name = GetLootAssignItemInfo(i)
if name == nameing then
break
end
end
local pass = false
LI.NeedAssignment[key]["count"] = -1
LI.NeedAssignment[key]["timeout"] = -1
for _ = 1, 40 do
if not pass then
for name3, value in pairs(LI.NeedAssignment[key]) do
if tonumber(value) and value > luckyvalue then
luckyvalue = value
lucky = name3
end
end
end
if pass or luckyvalue == 0 then
pass = true
repeat
LI.Pass = LI.Pass + 1
lucky = UnitName("raid"..LI.Pass)
if LI.Pass >= 36 then
LI.Pass = 0
end
until lucky ~= nil
end
for i = 1, 36 do
local name4 = GetLootAssignMember(lootID, i)
if name4 and name4 == lucky then
AssignOnLoot(lootID, name4)
if LI.NeedAssignment[key][name4] ~= nil and LI.NeedAssignment[key][name4] >= 200 then
LI.SendToWeb(4, LI.NeedAssignment[key][name4] - 200, link, name4)
LI.DKP_SendData((LI.NeedAssignment[key][name4] - 200) * -1, name4)
end
table.remove(LI.NeedAssignment, key)
return
end
end
LI.NeedAssignment[key][lucky] = nil
end
end
end
function LI.IsValidSystem()
if LI.MakeValid then
if LI.ValidThreshold == GetLootThreshold() and GetLootMethod() == "master" then
return true
end
end
end
function LI.IsValidShoud(msg)
if not tonumber(string.sub(msg, 1, 1)) or string.sub(msg, 1, 1) ~= string.sub(msg, 2, 2) then
return false
end
local check = tonumber(string.sub(msg, 2, 2)) or -1
local msg = string.sub(msg, 3)
local sum = 0
for i = 1, string.len(msg) do
sum = string.byte(msg, i) + sum
end
return check == (sum % 10)
end
function LI.AddCheckSum(msg)
local sum, before = 0, msg
for i = 1, string.len(before) do
sum = string.byte(before, i) + sum
end
return tostring(sum % 10)..tostring(sum % 10)..before
end
function LI.Encrypt(msg, key)
local chiffre = ""
for i = 1, string.len(msg) do
local letter = string.byte(msg, i)
letter = letter + key
if letter > 126 then
letter = letter - 95
end
if letter == 37 then -- 37 % 92 \ 124 |
letter = "#1#"
elseif letter == 92 then
letter = "#2#"
elseif letter == 124 then
letter = "#3#"
else
letter = string.char(letter)
end
chiffre = chiffre..letter
end
return chiffre
end
function LI.Decrypt(msg, key)
local chiffre = ""
repeat
local letter = string.byte(msg, 1)
local check = string.match(msg, "^#%d#")
if check then
check = tonumber(string.sub(check, 2, 2))
if check > 3 or check < 1 then
check = nil
end
end
if check then -- 37 % 92 \ 124 |
if check == 1 then
letter = 37
elseif check == 2 then
letter = 92
elseif check == 3 then
letter = 124
end
msg = string.sub(msg, 4)
else
msg = string.sub(msg, 2)
end
letter = letter - key
if letter < 32 then
letter = letter + 95
end
chiffre = chiffre..string.char(letter)
until string.len(msg) <= 0
return chiffre
end
function LI.PaintFrame(this)
getglobal(this:GetName().."_Show"):Show()
this.timeout = 300
if not this.link then
this:Hide()
return
end
local _, data = ParseHyperlink(this.link)
local quality = LI.GetQuality(this.link)
local count
this.quality = quality
local hexID, Adura, stat12, stat34, stat56 = string.match(data, "(%x+) %x+ (%x+) (%x+) (%x+) (%x+) .*")
this.indent = LI.BuildShortLink(hexID, Adura, stat12, stat34, stat56, this.link)
local ID = LI.HexToDec(hexID)
local name = TEXT("Sys"..ID.."_name")
local texture = LI.GetTextureById(ID)
if name == "Sys"..ID.."_name" then
LootIt_GameTooltip:SetHyperLink(this.link)
if yaCIt then
yaCIt.ShowTooltipBySelf(LootIt_GameTooltip)
end
name = LootIt_GameTooltipTextLeft1:GetText()
end
this.name = name
local prefix = this:GetName()
local r, g, b = GetItemQualityColor(quality)
if count and ( count > 1 ) then
getglobal(prefix .. "_IconFrame_Count"):SetText(count)
getglobal(prefix .. "_IconFrame_Count"):Show()
else
getglobal(prefix .. "_IconFrame_Count"):Hide()
end
getglobal(prefix .. "_IconFrame_Icon"):SetFile(texture)
getglobal(prefix .. "_Name"):SetText(name)
getglobal(prefix .. "_Name"):SetColor(r, g, b)
if not LI.IsValidSystem() then
LI.RollLoot(this, "pass", true)
end
end
LI.CurrentDKPBid = {}
function LI.RollLoot(this, typ, auto)
local roll = 0
if typ == "roll" then
roll = 2
elseif typ == "greed" then
roll = 1
elseif typ == "DKP" then
roll = 3
LI.CurrentDKPBid[this.indent] = getglobal(this:GetName().."_Bidding"):GetText()
end
table.insert(LI.CurrentDice, {this.indent, roll})
LI.Roll = LI.Roll + 1
if roll ~= 3 and IsShiftKeyDown() and not auto then
local _, name = ParseHyperlink(this.link)
name = string.match(name, "(%x+) %x+ (%x+) (%x+) (%x+) (%x+) .*")
name = TEXT("Sys"..LI.HexToDec(name).."_name")
LI.AddData(name, nil, roll + 2, IsCtrlKeyDown())
end
this:Hide()
end
function LI.GetTextureById(ID)
local itemID_imgID = dofile("interface/addons/lootit/databases/itemID_imgID.lua")
local imgID_file = dofile("interface/addons/lootit/databases/imgID_file.lua")
if not imgID_file or not itemID_imgID then
LI.io("The image-databases are brocken. Please download the lastet LootIt!-Version on Curse.com!|r")
return "interface/icons/test_icons_07"
end
if ID > 550000 and ID < 560000 then
return "interface/icons/"..imgID_file[571316]
elseif ID > 770000 and ID < 780000 then
return "interface/icons/"..imgID_file[572779]
end
return (itemID_imgID[ID] and imgID_file[itemID_imgID[ID]]) and "interface/icons/"..tostring(imgID_file[itemID_imgID[ID]]) or "interface/icons/test_icons_01"
end
LI.ShortLinks = {}
function LI.BuildShortLink(hexID, Adura, stat12, stat34, stat56, link)
local short = LI.DecToAscii(LI.HexToDec(hexID..string.sub(Adura, string.len(Adura) - 2, string.len(Adura))..stat12..stat34..stat56))
LI.ShortLinks[short] = link
return short
end
function LI.HexToDec(hexID)
local hex, ID = string.lower(hexID), 0
for i = 1, string.len(hex) do
local a = string.sub(hex, 1, 1)
local value = tonumber(a) or string.byte(a) - 87
ID = ID + (16 ^ (string.len(hex) - 1)) * value
if string.len(hex) > 1 then
hex = string.sub(hex, 2)
end
end
return ID
end
function LI.DecToHex(dec, force2)
dec = tonumber(dec)
local K, hex, i, d = "0123456789ABCDEF", "", 0
while dec > 0 do
i = i + 1
dec, d = math.floor(dec / 16), math.fmod(dec, 16) + 1
hex = string.sub("0123456789ABCDEF", d, d)..hex
end
if not force2 then
return string.lower(hex)
else
hex = string.lower(hex)
if string.len(hex) == 0 then
return "00"
elseif string.len(hex) == 1 then
return "0"..hex
else
return hex
end
end
end
function LI.DecToAscii(dec)
local long = ""
while math.floor(dec) ~= 0 do
local char = math.floor((dec / 92 - math.floor(dec / 92)) * 92 + 32)
if char >= 92 then
char = char + 1
end
long = string.char(char)..long
dec = math.floor(dec / 92)
end
return long
end
function LI.AcsiiToDec(ascii)
local ID = 0
for i = 1, string.len(ascii) do
local a = string.sub(ascii, 1, 1)
local value = string.byte(a) - 32
if value >= 93 - 32 then
char = char - 1
end
ID = ID + (92 ^ (string.len(ascii) - 1)) * value
if string.len(ascii) > 1 then
ascii = string.sub(ascii, 2)
end
end
return ID
end
function LI.CheckOwnRollFrame(this)
if LI.Active() then
local roll = LI.GetItemLoot(this.name, this.link, true, this.quality)
if not roll and this.quality then
if this.quality < LI_Data.Options.autopass and this.quality > LI_Data.Options.autopassmin then
roll = 2
elseif this.quality < LI_Data.Options.autogreed and this.quality > LI_Data.Options.autogreedmin then
roll = 3
end
end
if roll then
local frame, mode = getglobal("LootIt_LootFrame"..this:GetID().."_Highlight")
frame:ClearAllAnchors()
if roll == 2 then
frame:SetAnchor("CENTER", "CENTER", getglobal(this:GetName().."_CancelButton"), 0, 0)
frame:Show()
mode = "pass"
elseif roll == 3 then
frame:SetAnchor("CENTER", "CENTER", getglobal(this:GetName().."_GreedButton"), 0, 0)
frame:Show()
mode = "greed"
elseif roll == 4 then
frame:SetAnchor("CENTER", "CENTER", getglobal(this:GetName().."_RollButton"), 0, 0)
frame:Show()
mode = "roll"
else
frame:Hide()
end
frame.roll = mode
end
end
end
function LI.HighlightUpdate2(this, elapsedTime)
this.updater = this.updater + elapsedTime
if this.updater >= 0.1 then
elapsedTime = this.updater
this.updater = 0
else
return
end
this.timer = this.timer - elapsedTime
if this.timer <= 0 then
LI.RollLoot(this:GetParent(), this.roll, true)
this:Hide()
end
local red, green, blue = LI.TrafficColor(this.timer)
getglobal(this:GetName().."_Color"):SetColor(red, green, blue)
end
LI.AllowDice = {}
function LI.SendAllowdDices(dkpbool)
local lootID, name, link
for i = 1, GetLootAssignItemSize() do
lootID, name = GetLootAssignItemInfo(i)
if lootID == LI.CurrendItem then
break
end
end
if not tonumber(lootID) then
return
end
local hexID, Adura, stat12, stat34, stat56, key
for i, val in ipairs(LI.NeedAssignment) do
local _, nameing = ParseHyperlink(val.link)
hexID, Adura, stat12, stat34, stat56 = string.match(nameing, "(%x+) %x+ (%x+) (%x+) (%x+) (%x+) .*")
nameing = TEXT("Sys"..LI.HexToDec(hexID).."_name")
if nameing == name then
link = val.link
key = i
break
end
end
if not link then
return
end
local luckys = {"900"..LI.BuildShortLink(hexID, Adura, stat12, stat34, stat56, link).."~"}
for i = 1, 36 do
local done
for j = 1, 36 do
if UnitName("raid"..i) == GetLootAssignMember(LI.CurrendItem, j) then
done = true
if LI.AllowDice[UnitName("raid"..i)] then
if dkpbool then
table.insert(luckys, 9)
else
table.insert(luckys, math.random(1, 8))
end
else
table.insert(luckys, 0)
end
break
end
end
end
LI.Send(table.concat(luckys))
local _, num = string.gsub(luckys[1], "0", "")
local _, num2 = string.gsub(table.concat(luckys), "0", "")
LI.NeedAssignment[key]["count"] = 36 - (num2 - num)
if dkpbool then
LI.NeedAssignment[key]["dicetype"] = 11
else
LI.NeedAssignment[key]["dicetype"] = 10
end
LI.AllowDice = {}
end
function LI.MiniConfigGenerateMasterloot(this)
local classes = {}
for i = 1, 36 do
if UnitName("raid"..i) then
local pri = UnitClass("raid"..i)
if pri then
if not classes[pri] then
classes[pri] = {}
end
classes[pri][UnitName("raid"..i)] = true
end
end
end
if not UIDROPDOWNMENU_MENU_LEVEL or UIDROPDOWNMENU_MENU_LEVEL == 1 then
UIDropDownMenu_AddButton({
text = "LootIt! "..LI.version,
isTitle = 1,
notCheckable = 1,
})
UIDropDownMenu_AddButton({
text = LI.Trans("ALLOW_DICE"),
notCheckable = 1,
})
local i = 0
for class, val in pairs(classes) do
i = i + 1
UIDropDownMenu_AddButton({
text = class,
hasArrow = 1,
value = class,
arg1 = val,
func = function(this)
for name in pairs(this.arg1) do
LI.AllowDice[name] = not LI.AllowDice[name]
end
end,
})
end
UIDropDownMenu_AddButton({
text = TEXT("STR_CHAT_SEND"),
notCheckable = 1,
func = function()
LI.SendAllowdDices(false)
end,
})
UIDropDownMenu_AddButton({
text = TEXT("STR_CHAT_SEND").."("..LI.Trans("DKP")..")",
notCheckable = 1,
func = function()
LI.SendAllowdDices(true)
end,
})
elseif UIDROPDOWNMENU_MENU_LEVEL == 2 then
for name in pairs(classes[UIDROPDOWNMENU_MENU_VALUE]) do
UIDropDownMenu_AddButton({
text = name,
arg1 = name,
checked = LI.AllowDice[name] == true,
func = function(this)
LI.AllowDice[this.arg1] = not LI.AllowDice[this.arg1]
end,
}, 2)
end
end
end
function LI.MiniConfigGenerateMasterlootAuto(this)
if LI_Data and LI_Data.Options ~= nil then
if not UIDROPDOWNMENU_MENU_LEVEL or UIDROPDOWNMENU_MENU_LEVEL == 1 then
UIDropDownMenu_AddButton({
text = "LootIt! "..LI.version,
isTitle = 1,
notCheckable = 1,
})
UIDropDownMenu_AddButton({
text = LI.Trans("AUTOMASTER")..": "..LI.GetQualityString(LI_Data.Options.automaster),
notCheckable = true,
hasArrow = 1,
value = 1,
})
UIDropDownMenu_AddButton({
text = LI.Trans("ITEMFILTER"),
notCheckable = true,
func = function(this)
LootIt_MasterItemFilter:Show()
CloseDropDownMenus()
end,
})
elseif UIDROPDOWNMENU_MENU_LEVEL == 2 then
if UIDROPDOWNMENU_MENU_VALUE == 1 then
for i = -1, LI.QualityCount do
info = {
text = LI.GetQualityString(i),
func = function(this)
LI_Data.Options.automaster = tonumber(this.arg1)
CloseDropDownMenus()
end,
arg1 = i,
}
info.checked = i == LI_Data.Options.automaster
UIDropDownMenu_AddButton(info, 2)
end
end
end
end
end
function LI.PaintMasterFilterFrame(filter)
if LI_MasterFilterCache == nil or filter then
LI_MasterFilterCache = {}
for name, value in pairs(LI_MasterFilterChar) do
table.insert(LI_MasterFilterCache, {name, value})
end
for name, value in pairs(LI_MasterFilterCharSpezial) do
table.insert(LI_MasterFilterCache, {name, value})
end
if filter and filter ~= "" and table.getn(LI_MasterFilterCache) ~= 0 then
local chache = LI_MasterFilterCache
LI_MasterFilterCache = {}
for _, val in ipairs(chache) do
if string.find(val[1], filter) then
table.insert(LI_MasterFilterCache, val)
end
end
end
local function comp(t1, t2)
if string.lower(t1[1]) < string.lower(t2[1]) then
return true
else
return false
end
end
table.sort(LI_MasterFilterCache, comp)
local num = table.getn(LI_MasterFilterCache) - LI.NumVisbileFilters(LootIt_MasterItemFilter_ScrollBar)
if num <= 1 then
num = 1
end
LootIt_MasterItemFilter_ScrollBar:SetMinMaxValues(1, num)
end
for i = 1, 10 do
local num = LootIt_MasterItemFilter_ScrollBar:GetValue() + i - 1
if LI_MasterFilterCache[num] ~= nil and not (i >= LI.NumVisbileFilters(LootIt_MasterItemFilter_ScrollBar)) then
local name = LI_MasterFilterCache[num][1]
getglobal("LootIt_MasterItemFilter_Filterlist_Item"..i):Show()
getglobal("LootIt_MasterItemFilter_Filterlist_Item"..i.."_Name"):SetText(name)
getglobal("LootIt_MasterItemFilter_Filterlist_Item"..i.."_Roll"):SetText(LI.ConvertIDToString(LI_MasterFilterCache[num][2], true))
else
getglobal("LootIt_MasterItemFilter_Filterlist_Item"..i):Hide()
end
end
end
function LI.AddMasterButton(this, itemname, roll)
if itemname == nil then
itemname = getglobal(this:GetParent():GetName().."_Itemname"):GetText()
end
if roll == nil then
roll = UIDropDownMenu_GetText(getglobal(this:GetParent():GetName().."_Rolling"))
end
roll = LI.ConvertStringToID(tostring(roll), true)
LI_MasterFilterChar[itemname] = nil
LI_MasterFilterCharSpezial[itemname] = nil
if LI.CheckForNormal(itemname) then
LI_MasterFilterChar[itemname] = roll
else
LI_MasterFilterCharSpezial[itemname] = roll
end
LI_MasterFilterCache = nil
LI.PaintMasterFilterFrame()
getglobal(this:GetParent():GetName().."_Itemname"):SetText("")
UIDropDownMenu_SetText(getglobal(this:GetParent():GetName().."_Rolling"), LI.Trans("ROLL"))
end
function LI.DelMasterButton(this)
local itemname = getglobal(this:GetParent():GetName().."_Itemname"):GetText()
LI_MasterFilterChar[itemname] = nil
LI_MasterFilterCharSpezial[itemname] = nil
LI_MasterFilterCache = nil
LI.PaintMasterFilterFrame()
getglobal(this:GetParent():GetName().."_Itemname"):SetText("")
UIDropDownMenu_SetText(getglobal(this:GetParent():GetName().."_Rolling"), LI.Trans("ROLL"))
end
function LI.LoadMasterRollingDropDown(this)
UIDropDownMenu_Initialize(this, LI.LoadMasterRollingDropDownGenerate)
end
function LI.LoadMasterRollingDropDownGenerate(this)
if LI_Data and LI_Data.Options ~= nil then
if not UIDROPDOWNMENU_MENU_LEVEL or UIDROPDOWNMENU_MENU_LEVEL == 1 then
UIDropDownMenu_AddButton({
text = LI.ConvertIDToString(1, true),
notCheckable = true,
func = function()
UIDropDownMenu_SetText(this, LI.ConvertIDToString(1, true))
end,
})
UIDropDownMenu_AddButton({
text = LI.ConvertIDToString(10, true),
notCheckable = true,
func = function()
UIDropDownMenu_SetText(this, LI.ConvertIDToString(10, true))
end,
})
UIDropDownMenu_AddButton({
text = LI.ConvertIDToString(11, true),
notCheckable = true,
func = function()
UIDropDownMenu_SetText(this, LI.ConvertIDToString(11, true))
end,
})
end
end
end
function LI.SelectMasterFilterRow(this)
getglobal(this:GetParent():GetParent():GetName().."_Itemname"):SetText(getglobal(this:GetName().."_Name"):GetText())
UIDropDownMenu_SetText(getglobal(this:GetParent():GetParent():GetName().."_Rolling"), getglobal(this:GetName().."_Roll"):GetText())
LI.PaintMasterFilterFrame()
end
function LI.DKP_SendData(value, name)
if LI_System and tostring(LI.ValidMember) == UnitName("player") then
LI.Send("Method#"..(LI_System.setting["methods"]))
for name, value in pairs(LI_DKP[LI_DKP_web.system]["user"]) do
LI.Send("IniDKP#"..tostring(name).."#"..tostring(value))
end
end
if name ~= nil then
LI_DKP[LI_DKP_web.system]["user"][name] = LI_DKP[LI_DKP_web.system]["user"][name] + value
LI.Send("DKPEdit#"..tostring(name).."#"..tostring(value))
elseif value ~= nil then
for name, _ in pairs(LI_DKP[LI_DKP_web.system]["user"]) do
LI_DKP[LI_DKP_web.system]["user"][name] = LI_DKP[LI_DKP_web.system]["user"][name] + value
end
LI.Send("DKPPlus#"..tostring(value))
end
end
function LI.DKP_Log_OnUpdate(this, elapsedTime)
if not this.Time then
this.Time = 1
else
this.Time = this.Time - elapsedTime
if this.Time <= 0 then
this.Time = nil
LI.DKP_Log()
end
end
end
function LI.DKP_StartStop(this)
if LI_RaidRunning then
LI.SendToWeb(2)
this:SetText(LI.Trans("START"))
else
LI.SendToWeb(1)
this:SetText(LI.Trans("STOP"))
end
end
function LI.DKP_Box_Check(this)
if this:GetID() == 1 then
LI_System = nil
if tonumber(this:GetText()) == nil then
this:SetText(0)
end
LI_DKP_web.system = math.floor(this:GetText())
local _, fun = pcall(dofile ,"Interface/DKP/"..(LI_DKP_web.system)..".lua")
if fun and type(fun) == "function" then
fun()
end
if LI_System ~= nil then
LI.io("DKP_FILE_LOADED")
if not LI_DKP[LI_DKP_web.system] or LI_System.timestamp > LI_DKP[LI_DKP_web.system]["timestamp"] then
LI_DKP[LI_DKP_web.system] = LI_System
end
local tmp = LI_Bosses
LI_Bosses = {}
for _, indent in ipairs(tmp) do
local a, b = string.find(indent, "^%d*")
local c, d = string.find(indent, "%d*$")
if not LI_Bosses[tonumber(string.sub(indent, a, b))] then
LI_Bosses[tonumber(string.sub(indent, a, b))] = {}
end
LI_Bosses[tonumber(string.sub(indent, a, b))][TEXT("Sys"..tonumber(string.sub(indent, c, d)).."_name")] = tonumber(string.sub(indent, c, d))
end
else
LI.io("DKP_FILE_ERROR")
LI_DKP_web.system = 0
end
this:SetText(LI_DKP_web.system)
elseif this:GetID() == 2 then
if string.len(tostring(this:GetText())) ~= 4 then
this:SetText("****")
end
LI_DKP_web.spin = this:GetText()
else
if this:GetText() == nil or this:GetText() == "" then
this:SetText(UnitName("player"))
end
if not LI_RaidRunning then
LI_DKP_web.name = this:GetText()
end
end
end
function LI.DKP_Box_Show(this)
if this:GetID() == 1 then
if LI_DKP_web.system then
this:SetText(LI_DKP_web.system)
else
this:SetText(0)
end
elseif this:GetID() == 2 then
if LI_DKP_web.spin then
this:SetText(LI_DKP_web.spin)
else
this:SetText("****")
end
else
if this:GetText() == nil or this:GetText() == "" then
this:SetText(tostring(GetZoneName()))
end
end
end
function LI.DKPPaintFrame(this)
LI.PaintFrame(this)
this.timeout = 60
end
LI.CurrentDKPItems = {}
function LI.DKPLootFrame_OnHide(this)
this.timeout = 60
LootIt_DKPBiddingFrame_Show.timeout = 5
end
function LI.GroupAskDKPItem(shortitem)
if LI.IsValidSystem() then
if not LootIt_DKPBiddingFrame_Show:IsVisible() then
if not shortitem and #LI.CurrentDKPItems ~= 0 then
shortitem = table.remove(LI.CurrentDKPItems)
end
LootIt_DKPBiddingFrame.link = LI.ShortLinks[shortitem]
LootIt_DKPBiddingFrame:Show()
elseif shortitem then
table.insert(LI.CurrentDKPItems, shortitem)
end
end
end
function LI.CheckBidding(this, reset)
local bid = this:GetText()
if not tonumber(bid) then
bid = string.match(bid, "%d+")
end
if bid == nil or reset then
bid = 0
getglobal(this:GetParent():GetName().."_RollButton"):Hide()
getglobal(this:GetParent():GetName().."_CancelButton"):Show()
if reset then
this:SetText("")
return
end
else
getglobal(this:GetParent():GetName().."_RollButton"):Show()
getglobal(this:GetParent():GetName().."_CancelButton"):Hide()
end
bid = math.floor(math.abs(bid))
if tonumber(LI_DKP_own) < 0 then --## error nil!
bid = 0
elseif tonumber(bid) > tonumber(LI_DKP_own) then
bid = math.floor(math.abs(LI_DKP_own))
end
if tostring(bid) ~= tostring(this:GetText()) then
this:SetText(bid)
else
if tostring(this:GetText()) == "0" then
LI.RollLoot(this:GetParent(), "greed")
else
LI.RollLoot(this:GetParent(), "DKP")
end
this:GetParent():Hide()
end
end
function LI.url_encode(str)
if str then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w ])",
function (c)
return string.format ("%%%02X", string.byte(c))
end
)
str = string.gsub (str, " ", "+")
else
return ""
end
return tostring(str)
end
LI_RaidRunning = false
LI_DKP_Logging = {}
LI_DKP_host = "http://lootit.org/"
if LI.debugmode and false then
LI_DKP_host = "http://localhost/lootitdkp/"
end
function LI.SendToWeb(typ, text, item, char)
if typ == 0 then
GC_OpenWebRadio(LI_DKP_host)
return
end
if not IsAssigner() then
return
end
if typ == 2 then
if LI_System and LI_System.setting and LI_System.setting.raid then
LI.Send("DKPPlus#"..(LI_System.setting.raid))
LI_DKP_Timer = nil
end
end
if not LI_RaidRunning and (typ == 3 or typ == 4) then
LI.SendToWeb(1)
end
if typ == 3 then
local send = nil
if string.find(text, "%d+-%d+") == nil then
if LI_Bosses[GetZoneID()] ~= nil then
if LI_Bosses[GetZoneID()][text] ~= nil then
text = GetZoneID().."-"..LI_Bosses[GetZoneID()][text]
if LI_System.setting[text] then
send = LI_System.setting[text]
end
else
LI.Log("Bossname "..text.." unknown in zone "..GetZoneID().."!")
end
else
LI.Log("ZoneID "..GetZoneID().." unknown!")
end
if not string.find(text, "%d+-%d+") == nil then
LI.io("This boss is not known to the system. Please report it to Tinsus at http://www.lootit.org/ Reporting allows to set and gain specific DKP later. Needed informations: ZoneID: "..GetZoneID().." Bossname: "..text.." Loca: "..GetLanguage())
end
end
if send then
LI.Send("DKPPlus#"..send)
elseif LI_System and LI_System.setting and LI_System.setting.bossdefault then
LI.Send("DKPPlus#"..LI_System.setting.bossdefault)
end
end
if text == nil then
text = LI_DKP_web.name
end
if text == nil then
StaticPopupDialogs["LOOTIT_ENTER_TEXT"] = {
text = LI.Trans("ENTER_TEXT"),
button1 = TEXT("ACCEPT"),
button2 = TEXT("CANCEL"),
OnShow = function(this)
if LI_DKP_web.name ~= nil then
getglobal(this:GetName().."EditBox"):SetText(LI_DKP_web.name)
else
getglobal(this:GetName().."EditBox"):SetText(tostring(GetZoneName()))
end
end,
OnAccept = function(this)
LI.SendToWeb(LI_SaveBin.typ, tostring(getglobal(this:GetName().."EditBox"):GetText()), LI_SaveBin.item, LI_SaveBin.char)
end,
hasEditBox = 1,
timeout = 0,
whileDead = 1,
exclusive = 1,
hideOnEscape = 1,
};
LI_SaveBin = {typ = typ, item = item, char = char},
StaticPopup_Show("LOOTIT_ENTER_TEXT")
return
else
LI_DKP_web.name = text
end
if char == nil then
local names = {}
for i = 1, 36 do
if UnitName("raid"..i) then
table.insert(names, UnitName("raid"..i))
end
end
table.sort(names)
char = table.concat(names, ",")
end
if typ == 1 then
LI_RaidRunning = true
elseif typ == 2 then
LI_RaidRunning = false
end
if not (typ == 3 and LI_DKP_Logging[#LI_DKP_Logging]["text"] == text) then
table.insert(LI_DKP_Logging, {time = LI.Time(), typ = typ, text = text, char = char, item = item})
end
LI.DKP_Log()
end
function LI.DKP_Ready()
if LI_DKP_web == nil
or LI_System == nil
or LI_DKP_web.spin == nil
or string.len(LI_DKP_web.spin) > 4
or LI_DKP_web.system == nil
or tostring(LI_DKP_web.system) == "0"
or tostring(LI_DKP_web.system) ~= tostring(LI_System.id)
or tostring(LI_DKP_web.name) == "" then
return false
end
return true
end
function LI.DKP_Log(onshow)
local text = ""
if #LI_DKP_Logging == 0 then
text = LI.Trans("EMPTY")
LootIt_DKP_Info_SendButton:Hide()
else
LootIt_DKP_Info_SendButton:Show()
local scroll = LootIt_DKP_Info_ScrollBar:GetValue() + 1
for i = scroll, scroll + 6 do
if LI_DKP_Logging[i] ~= nil then
local time = (LI_DKP_Logging[i]["time"] - LI_DKP_Logging[1]["time"])
local sec, min, hour = math.floor(time % 60), math.floor((time / 60) % 60), math.floor(time / 60 / 60)
if sec <= 9 then
sec = "0"..tostring(sec)
end
if min <= 9 then
min = "0"..tostring(min)
end
if hour <= 9 then
hour = "0"..tostring(hour)
end
text = text.."["..hour..":"..min..":"..sec.."] "
if LI_DKP_Logging[i]["typ"] == 1 then -- start
text = text..LI.Trans("RAID_START").."\n"
elseif LI_DKP_Logging[i]["typ"] == 2 then -- ende
text = text..LI.Trans("RAID_END").."\n"
elseif LI_DKP_Logging[i]["typ"] == 3 then -- kill
local boss = LI_DKP_Logging[i]["text"]
local _, minus = string.find(boss, "-")
if minus then
local zone = tonumber(string.sub(boss, 1, minus - 1))
local sysid = tonumber(string.sub(boss, minus + 1))
if sysid then
boss = TEXT("Sys"..sysid.."_name")
end
end
text = text..boss.."\n"
elseif LI_DKP_Logging[i]["typ"] == 4 then -- kauf
text = text..LI_DKP_Logging[i]["char"].." - "..LI_DKP_Logging[i]["item"].."\n"
elseif LI_DKP_Logging[i]["typ"] == 6 then -- drop //5 Korrektur (website)
text = text..LI_DKP_Logging[i]["item"].."\n"
end
end
end
end
LootIt_DKP_Info_Log:SetText(text)
local scroll = #LI_DKP_Logging - 7
if scroll < 0 then
scroll = 0
end
LootIt_DKP_Info_ScrollBar:SetMinMaxValues(0, scroll)
if onshow then
LootIt_DKP_Info_ScrollBar:SetValue(scroll)
end
if LI.DKP_Ready() and LI.IsValidSystem() then
LootIt_DKP_Info_StartStopButton:Show()
else
LootIt_DKP_Info_StartStopButton:Hide()
end
end
function LI.SendToBrowser()
if #LI_DKP_Logging ~= 0 then
repeat
local url = LI_DKP_host.."import.php?spin="..LI.url_encode(LI_DKP_web.spin).."&sys="..LI.url_encode(LI_DKP_web.system)
for i = 1, #LI_DKP_Logging do
if #LI_DKP_Logging >= 1 then
local part = LI_DKP_Logging[1]
part = "&a"..i.."="..LI.url_encode(LI_DKP_Logging[1]["typ"]).."&b"..i.."="..LI.url_encode(LI_DKP_Logging[1]["text"]).."&c"..i.."="..LI.url_encode(LI_DKP_Logging[1]["char"]).."&d"..i.."="..LI.url_encode(LI_DKP_Logging[1]["item"]).."&e"..i.."="..LI.url_encode(LI_DKP_Logging[1]["time"] - LI.Time())
if string.len(url) + string.len(part) <= 1000 then
url = url..part
table.remove(LI_DKP_Logging, 1)
else
break
end
else
break
end
end
GC_OpenWebRadio(url)
until #LI_DKP_Logging >= 0
else
LI.SendToWeb(0)
end
end
function LI.UpdateMasterLoot()
if LI.IsValidSystem() then
LootIt_MasterLootButton:Show()
LootIt_MasterLootDiceNow:Show()
LootFrameTitleText:SetText(LI.Trans("DKP"))
else
LootIt_MasterLootButton:Hide()
LootIt_MasterLootDiceNow:Hide()
LootFrameTitleText:SetText(TEXT("RK_LOOT_APPOINT"))
end
end
function LI.UpdateMasterLabel()
if LootFrame:IsVisible() then
for i = 1, 6 do
local item = (LootFrame.pageNum - 1) * 6 + i
if item <= GetLootAssignItemSize() then
_, name = GetLootAssignItemInfo(item)
for key, value in ipairs(LI.NeedAssignment) do
if name == TEXT("Sys"..LI.HexToDec(string.match(LI.NeedAssignment[key]["link"], "(%x+) %x+ (%x+) (%x+) (%x+) (%x+) .*")).."_name") then
result = LI.NeedAssignment[key]["dicetype"]
if result == 10 then
getglobal("LootFrameItem"..i.."Name"):SetText(LI.Trans("AUTOMASTER"))
elseif result == 11 then
getglobal("LootFrameItem"..i.."Name"):SetText(LI.Trans("DKP"))
else
getglobal("LootFrameItem"..i.."Name"):SetText(TEXT("CRAFTQUEUE_LIST"))
end
break
end
end
end
end
end
end
|
util.AddNetworkString("OpenRPNameMenu")
hook.Add("PlayerInitialSpawn", "RPNameSelectInitial", function(ply)
if (file.Exists("rpname/"..string.Replace(ply:SteamID(), ":", "_")..".txt", "DATA")) then
DarkRP.notify(ply, 0, 10, "Welcome Back to the Server!")
else
net.Start("OpenRPNameMenu")
net.WriteTable({})
net.Send(ply)
end
end)
hook.Add("PlayerSay", "RPNameDarkRPGloriusDisable", function(ply, text)
local start, ending = string.find(text, "rpname")
if (start == 2 && ending == 7 && file.Exists("rpname/"..string.Replace(ply:SteamID(), ":", "_")..".txt", "DATA")) then
DarkRP.notify(ply, 1, 10, "This is a shitty workaround to block you from changing names... Sorry!")
return ""
end
end)
net.Receive("OpenRPNameMenu", function(len, ply)
local steamid = string.Replace(ply:SteamID(), ":", "_")
if (!file.Exists("rpname", "DATA")) then
file.CreateDir("rpname")
end
ply:setRPName(net.ReadString())
file.Write("rpname/"..steamid..".txt", ply:GetName())
end)
DarkRP.defineChatCommand("forcerpname", function(ply, target)
if (ply:IsAdmin()) then
if (DarkRP.findPlayer(target[1])) then
if (file.Exists("rpname/"..string.Replace(ply:SteamID(), ":", "_")..".txt", "DATA")) then
net.Start("OpenRPNameMenu")
net.WriteTable(string.Explode(" ", DarkRP.findPlayer(target[1]):GetName()))
net.Send(DarkRP.findPlayer(target[1]))
DarkRP.notify(DarkRP.findPlayer(target[1]), 1, 5, ply:GetName().." forced you to change your name!")
DarkRP.notify(ply, 0, 5, "You forced "..DarkRP.findPlayer(target[1]):GetName().." to change his name!")
file.Delete("rpname/"..string.Replace(ply:SteamID(), ":", "_")..".txt")
else
DarkRP.notify(ply, 1, 5, "This player doesn't have an RPName!")
end
else
DarkRP.notify(ply, 1, 5, "The player you entered isn't valid!")
end
else
DarkRP.notify(ply, 1, 5, "You aren't an admin!")
end
return ""
end)
DarkRP.defineChatCommand("changerpname", function(ply) //There's no need to check if he has a Roleplay Name since he can't type this without one.
if (ply:canAfford(RPNameConfig["ChangeNameCost"])) then
net.Start("OpenRPNameMenu")
net.WriteTable(string.Explode(" ", ply:GetName()))
net.Send(ply)
ply:addMoney(-RPNameConfig["ChangeNameCost"])
DarkRP.notify(ply, 0, 5, "You payed "..DarkRP.formatMoney(RPNameConfig["ChangeNameCost"]).." to change your name!")
file.Delete("rpname/"..string.Replace(ply:SteamID(), ":", "_")..".txt")
else
DarkRP.notify(ply, 1, 5, "You can't afford to change your name!")
end
end) |
local COMMAND = {}
COMMAND.title = "MOTD"
COMMAND.description = "Open the Message Of The Day Popup."
COMMAND.author = "Nub"
COMMAND.timeCreated = "Tuesday, September 1st, 2020 @ 12:10 PM"
COMMAND.category = "Menu"
COMMAND.call = "motd"
COMMAND.server = function(caller, args)
if not caller:Nadmin_OpenMOTD() then
nadmin:Notify(caller, nadmin.colors.red, "The MOTD is currently disabled by server administration.")
end
end
nadmin:RegisterCommand(COMMAND)
|
---
-- @author Alf21
-- @module ShopEditor
ShopEditor = ShopEditor or {}
ShopEditor.savingKeys = {
credits = {typ = "number", bits = 8, default = 1}, -- from 0 to 255 (2^8 - 1)
minPlayers = {typ = "number", bits = 6}, -- from 0 to 63 (2^6 - 1)
globalLimited = {typ = "bool"}, -- 0 and 1
limited = {typ = "bool"}, -- 0 and 1
NoRandom = {typ = "bool"}, -- 0 and 1
notBuyable = {typ = "bool"}, -- 0 and 1
teamLimited = {typ = "bool"} -- 0 and 1
}
ShopEditor.cvars = {
ttt2_random_shops = {typ = "number", bits = 8},
ttt2_random_team_shops = {typ = "bool"},
ttt2_random_shop_reroll = {typ = "bool"},
ttt2_random_shop_reroll_cost = {typ = "number", bits = 8},
ttt2_random_shop_reroll_per_buy = {typ = "bool"}
}
local net = net
local pairs = pairs
---
-- Initializes the default data for an @{ITEM} or @{Weapon}
-- @param ITEM|Weapon item
-- @realm shared
function ShopEditor.InitDefaultData(item)
if not item then return end
for key, data in pairs(ShopEditor.savingKeys) do
if item[key] == nil then
if data.typ == "number" then
item[key] = data.default or 0
elseif data.typ == "bool" then
item[key] = data.default or false
else
item[key] = data.default or ""
end
end
end
end
---
-- Writes the @{ITEM} or @{Weapon} data to the network
-- @param string messageName
-- @param string name
-- @param ITEM|Weapon item
-- @param table|Player plys
-- @realm shared
function ShopEditor.WriteItemData(messageName, name, item, plys)
name = GetEquipmentFileName(name)
if not name or not item then return end
net.Start(messageName)
net.WriteString(name)
for key, data in pairs(ShopEditor.savingKeys) do
if data.typ == "number" then
net.WriteUInt(item[key], data.bits or 16)
elseif data.typ == "bool" then
net.WriteBool(item[key])
else
net.WriteString(item[key])
end
end
if SERVER then
local matched = false
for k = 1, #CHANGED_EQUIPMENT do
if CHANGED_EQUIPMENT[k][1] ~= name then continue end
matched = true
end
if not matched then
CHANGED_EQUIPMENT[#CHANGED_EQUIPMENT + 1] = {name, item}
end
if plys then
net.Send(plys)
else
net.Broadcast()
end
else
net.SendToServer()
end
end
---
-- Reads the @{ITEM} or @{Weapon} data from the network
-- @return string name of the equipment
-- @return ITEM|Weapon equipment table
-- @realm shared
function ShopEditor.ReadItemData()
local equip, name = GetEquipmentByName(net.ReadString())
if not equip then
return name
end
for key, data in pairs(ShopEditor.savingKeys) do
if data.typ == "number" then
equip[key] = net.ReadUInt(data.bits or 16)
elseif data.typ == "bool" then
equip[key] = net.ReadBool()
else
equip[key] = net.ReadString()
end
end
return name, equip
end
|
do local _={cmd_login_0={regex2=0,regex3=0,value="登陆成功",regex7=0,regex=0,key="cmd_login_0",regex1=0,regex6=0,regex5=0,showtype=2,regex4=0}};return _;end |
local _,_,_,tab,_ = unpack(require(arc_path .. 'code'))
local draw = require(arc_path .. 'draw')
-- shortcuts
local lg = love.graphics
local lk = love.keyboard
-- key class
local _key = {}
_key.__index = _key
function _key:new(btn)
local o = {}
setmetatable(o,_key)
o.btn = btn
o.t = 0
o.pos = 0
o.hit = false
return o
end
function _key:check(dt)
local z = self.pos
self.t = self.t+dt
if (z==0 and arc.btn.kp==self.btn) or (z==1 and lk.isDown(self.btn) and self.t>arc.cfg.key_wait0) then
self.pos = self.pos+1
self.t = 0
self.hit = true
return
end
if z == 2 and lk.isDown(self.btn) and self.t>arc.cfg.key_wait then
self.t = self.t-arc.cfg.key_wait
self.hit = true
return
end
if not lk.isDown(self.btn) then self.pos = 0 end
self.hit = false
end
return {_key}
|
--============ Copyright © 2020, Planimeter, All rights reserved. ============--
--
-- Purpose: API Documentation interface
--
--============================================================================--
local debug = debug
local error = error
local gui = gui
local ipairs = ipairs
local love = love
local pairs = pairs
local rawtype = rawtype
local require = require
local select = select
local string = string
local table = table
local tostring = tostring
local type = type
local typeof = typeof
local _G = _G
module( "docs" )
_VERSION = "v9.0.1"
callbacks = {
"keypressed",
"keyreleased",
"textinput",
"textedited",
"mousemoved",
"mousepressed",
"mousereleased",
"wheelmoved",
"touchpressed",
"touchreleased",
"touchmoved",
"joystickpressed",
"joystickreleased",
"joystickaxis",
"joystickhat",
"gamepadpressed",
"gamepadreleased",
"gamepadaxis",
"joystickadded",
"joystickremoved",
"focus",
"mousefocus",
"visible",
"quit",
"threaderror",
"resize",
"filedropped",
"directorydropped",
"lowmemory",
"update"
}
function findCallbacks( interface )
local t = {}
for k in pairs( interface ) do
if ( string.find( k, "on[%u%l+]+" ) == 1 ) then
table.insert( t, k )
end
if ( table.hasvalue( callbacks, k ) ) then
table.insert( t, k )
end
if ( k == "callback" ) then
table.insert( t, k )
end
end
return t
end
function findModule( modname )
local package = _G[ modname ] or gui[ modname ]
if ( package ) then return package end
if ( modname == "http" ) then
require( "engine.shared.socket.http" )
return findModule( modname )
end
if ( modname == "https" ) then
require( "engine.shared.socket.https" )
return findModule( modname )
end
if ( modname == "network" ) then
local client = table.shallowcopy( _G.networkclient )
local server = table.shallowcopy( _G.networkserver )
table.merge( client, server )
return client
end
if ( modname == "profile" ) then
require( "engine.shared.profile" )
return findModule( modname )
end
error( "module '" .. modname .. "' not found", 2 )
end
function getAllMethods( t )
local methods = {}
for k, v in pairs( t ) do
local builtin = string.find( tostring( v ), "builtin#%w+" )
local constructor = t.__type == k
local callback = table.hasvalue( getCallbacks( t ), k )
local metamethod = string.find( k, "__%w+" )
if ( type( v ) == "function" and
not builtin and
not constructor and
not callback and
not metamethod ) then
table.insert( methods, k )
end
end
table.sort( methods )
return methods
end
function getCallbacks( ... )
local args = { ... }
local callbacks = {}
for i = 1, select( "#", ... ) do
table.append( callbacks, findCallbacks( args[ i ] ) )
end
table.sort( callbacks )
return table.unique( callbacks )
end
function getClasses()
local classes = {}
local blacklist = {
"localplayer"
}
for k, v in pairs( _G ) do
if ( rawtype( v ) == "table" and
v.__type and
not string.find( k, "g_" ) and
not string.find( k, "localhost_" ) and
not string.find( k, "prop_" ) and
not table.hasvalue( blacklist, k ) ) then
table.insert( classes, k )
end
end
table.sort( classes )
return classes
end
function getClassMethods( class )
local classMethods = {}
local methods = getAllMethods( class )
for _, method in ipairs( methods ) do
if ( isClassMethod( class[ method ] ) ) then
table.insert( classMethods, method )
end
end
return classMethods
end
function getInterfacesAndLibraries()
local packages = {}
local blacklist = {
"engine",
"docs"
}
for k, v in pairs( _G ) do
if ( rawtype( v ) == "table" and
v._M and
not v.__type and
not table.hasvalue( blacklist, k ) ) then
table.insert( packages, k )
end
end
-- network interface
-- table.insert( packages, "network" )
-- socket interfaces
-- table.insert( packages, "http" )
-- table.insert( packages, "https" )
-- Lua 5.1.5 base library extensions
table.insert( packages, "math" )
table.insert( packages, "string" )
table.insert( packages, "table" )
-- profiling interface
table.insert( packages, "profile" )
table.sort( packages )
return table.unique( packages )
end
function getMethods( t )
local methods = {}
local m = getAllMethods( t )
local classMethods = getClassMethods( t )
for _, method in ipairs( m ) do
if ( not table.hasvalue( classMethods, method ) ) then
table.insert( methods, method )
end
end
return methods
end
function getPanels()
local panels = {}
local blacklist = {
"autoloader",
"console",
"debugoverlaypanel",
"framerate",
"handlers",
"init",
"netgraph",
"optionsmenu",
"scheme",
"testframe",
"watch"
}
local files = love.filesystem.getDirectoryItems( "engine/client/gui" )
for _, panel in ipairs( files ) do
local extension = "%." .. ( string.fileextension( panel ) or "" )
panel = string.gsub( panel, extension, "" )
if ( not string.find( panel, "^hud%a+" ) and
not table.hasvalue( blacklist, panel ) ) then
table.insert( panels, panel )
end
end
table.sort( panels )
return panels
end
function isClassMethod( f )
require( "engine.shared.dblib" )
local parameters = debug.getparameters( f )
return not parameters[ 1 ] or parameters[ 1 ] ~= "self"
end
function isPanel( modname )
local v = findModule( modname )
return typeof( v, "panel" ) or v == gui.panel
end
|
---@class UnityEngine.MeshRenderer : UnityEngine.Renderer
---@field additionalVertexStreams UnityEngine.Mesh
---@field subMeshStartIndex int
local m = {}
UnityEngine = {}
UnityEngine.MeshRenderer = m
return m |
local _, CLM = ...
-- Upvalues
local LOG = CLM.LOG
local MODULES = CLM.MODULES
local UTILS = CLM.UTILS
-- local CONSTANTS = CLM.CONSTANTS
-- local ACL_LEVEL = CONSTANTS.ACL.LEVEL
-- local keys = UTILS.keys
local typeof = UTILS.typeof
local empty = UTILS.empty
local capitalize = UTILS.capitalize
local getGuidFromInteger = UTILS.getGuidFromInteger
local NumberToClass = UTILS.NumberToClass
local whoamiGUID = UTILS.whoamiGUID
local Profile = CLM.MODELS.Profile
local LedgerManager = MODULES.LedgerManager
local LEDGER_PROFILE = CLM.MODELS.LEDGER.PROFILE
local ProfileManager = { }
function ProfileManager:Initialize()
LOG:Trace("ProfileManager:Initialize()")
self.cache = {
profilesGuidMap = {},
profiles = {}
}
-- Register mutators
LedgerManager:RegisterEntryType(
LEDGER_PROFILE.Update,
(function(entry)
LOG:TraceAndCount("mutator(ProfileUpdate)")
local iGUID = entry:GUID()
if type(iGUID) ~= "number" then return end
local GUID = getGuidFromInteger(iGUID)
local name = entry:name()
if empty(name) then return end
local class = capitalize(NumberToClass(entry:ingameClass()))
local spec = entry:spec()
local main = entry:main()
main = (type(main) == "number" and main ~= 0) and getGuidFromInteger(main) or ""
-- Check if it's an update
local profileInternal = self.cache.profiles[GUID]
if profileInternal then
if empty(class) then
class = profileInternal:Class()
end
if empty(spec) then
spec = profileInternal:Spec()
end
if empty(main) then
main = profileInternal:Main()
end
profileInternal.class = class
profileInternal.spec = spec
profileInternal.main = main
else
local profile = Profile:New(name, class, spec, main)
profile:SetGUID(GUID)
self.cache.profiles[GUID] = profile
self.cache.profilesGuidMap[name] = GUID
end
end))
LedgerManager:RegisterEntryType(
LEDGER_PROFILE.Remove,
(function(entry)
LOG:TraceAndCount("mutator(ProfileRemove)")
local GUID = entry:GUID()
if type(GUID) ~= "number" then return end
GUID = getGuidFromInteger(GUID)
if self.cache.profiles[GUID] then
self.cache.profiles[GUID] = nil
end
end))
LedgerManager:RegisterEntryType(
LEDGER_PROFILE.Link,
(function(entry)
LOG:TraceAndCount("mutator(ProfileLink)")
local GUID = entry:GUID()
if type(GUID) ~= "number" then return end
GUID = getGuidFromInteger(GUID)
local main = entry:main()
if type(main) ~= "number" then return end
main = getGuidFromInteger(main)
local altProfile = self:GetProfileByGUID(GUID)
if not typeof(altProfile, Profile) then return end
local mainProfile = self:GetProfileByGUID(main)
if not typeof(mainProfile, Profile) then
altProfile:ClearMain()
else
altProfile:SetMain(main)
end
end))
LedgerManager:RegisterOnRestart(function()
self:WipeAll()
end)
MODULES.ConfigManager:RegisterUniversalExecutor("pm", "ProfileManager", self)
end
function ProfileManager:NewProfile(GUID, name, class)
LOG:Trace("ProfileManager:NewProfile()")
if type(GUID) ~= "string" or GUID == "" then
LOG:Error("NewProfile(): Empty GUID")
return
end
if type(name) ~= "string" or name == "" then
LOG:Error("NewProfile(): Empty name")
return
end
if self:GetProfileByGUID(GUID) or self:GetProfileByName(name) then
LOG:Debug("NewProfile(): %s (%s) already exists", name, GUID)
return
end
LOG:Debug("New profile: [%s]: %s", GUID, name)
LedgerManager:Submit(LEDGER_PROFILE.Update:new(GUID, name, class), true)
end
function ProfileManager:RemoveProfile(GUID)
LOG:Trace("ProfileManager:RemoveProfile()")
if type(GUID) ~= "string" or GUID == "" then
LOG:Error("RemoveProfile(): Empty GUID")
return
end
LOG:Debug("Remove profile: [%s]", GUID)
LedgerManager:Submit(LEDGER_PROFILE.Remove:new(GUID), true)
end
-- TODO to do with the markings if profile is removed
function ProfileManager:MarkAsAltByNames(main, alt)
LOG:Trace("ProfileManager:MarkAsAltByNames()")
local mainProfile = self:GetProfileByName(main)
if not typeof(mainProfile, Profile) then
LOG:Error("MarkAsAltByNames(): Invalid main")
return
end
local altProfile = self:GetProfileByName(alt)
if not typeof(altProfile, Profile) then
LOG:Error("MarkAsAltByNames(): Invalid alt")
return
end
-- TODO: Protect from circular references / multi-level alt nesting
if alt == main then
if altProfile:Main() == "" then
LOG:Error("Removal of empty main for %s", alt)
return
else
-- Remove link
LedgerManager:Submit(LEDGER_PROFILE.Link:new(altProfile:GUID(), nil), true)
end
else
if mainProfile:Main() ~= "" then
LOG:Error("Alt -> Main chain for %s -> %s", alt, main)
return
end
LOG:Debug("Alt -> Main linking for %s -> %s", alt, main)
LedgerManager:Submit(LEDGER_PROFILE.Link:new(altProfile:GUID(), mainProfile:GUID()), true)
end
end
-- Functionalities
function ProfileManager:FillFromGuild(selectedRank, minLevel)
LOG:Trace("ProfileManager:FillFromGuild()")
if LOG.SEVERITY.DEBUG >= LOG:GetSeverity() then
LOG:Debug("FillFromGuild: rank: {%s}, minLevel: %s", selectedRank, minLevel)
end
local rankFilterFn, minLevelFn
if type(selectedRank) == "number" and selectedRank >= 0 then
rankFilterFn = (function(rankIndex)
return (selectedRank - 1) == rankIndex
end)
else
rankFilterFn = (function(rankIndex)
return true
end)
end
minLevel = tonumber(minLevel)
if type(minLevel) == "number" then
minLevelFn = (function(level, _minLevel)
if level >= _minLevel then
return true
end
return false
end)
else
minLevelFn = (function(level, _minLevel)
return true
end)
end
for i=1,GetNumGuildMembers() do
local name, _, rankIndex, level, _, _, _, _, _, _, class, _, _, _, _, _, GUID = GetGuildRosterInfo(i)
name, _ = strsplit("-", name)
if rankFilterFn(rankIndex) and minLevelFn(level, minLevel) then
self:NewProfile(GUID, name, class)
end
end
end
function ProfileManager:FillFromRaid()
LOG:Trace("ProfileManager:FillFromRaid()")
if not IsInRaid() then return end
for i=1,MAX_RAID_MEMBERS do
local name, _, _, _, _, class = GetRaidRosterInfo(i)
if name ~= nil then
name, _ = strsplit("-", name)
local GUID = UnitGUID("raid" .. tostring(i))
self:NewProfile(GUID, name, class)
end
end
end
function ProfileManager:AddTarget()
LOG:Trace("ProfileManager:AddTarget()")
if UnitIsPlayer("target") then
local GUID = UnitGUID("target")
local name = UTILS.GetUnitName("target")
local _, class, _ = UnitClass("target");
self:NewProfile(GUID, name, class)
else
LOG:Warning("Your target must be a player.")
end
end
function ProfileManager:WipeAll()
LOG:Trace("ProfileManager:WipeAll()")
self.cache = { profilesGuidMap = {}, profiles = {} }
end
function ProfileManager:GetMyProfile()
LOG:Trace("ProfileManager:GetMyProfile()")
return self:GetProfileByGUID(whoamiGUID())
end
-- Utility
function ProfileManager:GetGUIDFromName(name)
return self.cache.profilesGuidMap[name]
end
function ProfileManager:GetProfiles()
return self.cache.profiles
end
function ProfileManager:GetProfileByGUID(GUID)
return self.cache.profiles[GUID]
end
function ProfileManager:GetProfileByName(name)
return self.cache.profiles[self.cache.profilesGuidMap[name]]
end
-- Publis API
MODULES.ProfileManager = ProfileManager
|
local QDEF
QDEF = EscapeTheBogUtil.AddBogLocationQuest(
{
no_spawn_by_default = true,
entry_encounter = {
ETB_STARTING_OUT = 1,
},
repeat_encounter = EscapeTheBogUtil.GenericSafeRepeatEncounterTable,
sleep_encounter = EscapeTheBogUtil.GenericSleepEncounterTable,
GetPathDesc = function(quest)
return quest:GetLocalizedStr("DESC_1")
end,
},
{
name = "Bog Cave",
desc = "A cave in the middle of the bog. There does not appear to be any immediate danger, although there is not much here. If you want to survive, you should start moving.",
plax = "INT_Cave_MurderBay_1",
show_agents = true,
tags = {"cave", "bog"},
indoors = true,
},
{"dangerous", "dangerous"}
)
QDEF:Loc{
DESC_1 = "This path leads to the cave that you wake up in. It is a safe spot, although there is nothing of interest there.",
}
|
local _, CLM = ...
local Profile = {}
function Profile:New(name, class, spec, main)
local o = {}
setmetatable(o, self)
self.__index = self
o._GUID = ""
o.name = (name ~= nil) and tostring(name) or ""
o.class = (class ~= nil) and tostring(class) or ""
o.spec = (spec ~= nil) and tostring(spec) or ""
o.main = (main ~= nil) and tostring(main) or ""
o.version = {
major = 0,
minor = 0,
patch = 0,
changeset = ""
}
self._versionString = "Unknown"
return o
end
function Profile:Name()
return self.name
end
function Profile:Class()
return self.class
end
function Profile:Spec()
return self.spec
end
function Profile:Main()
return self.main
end
function Profile:SetMain(main)
self.main = main
end
function Profile:ClearMain()
self.main = ""
end
function Profile:SetGUID(GUID)
self._GUID = GUID
end
function Profile:GUID()
return self._GUID
end
function Profile:SetVersion(major, minor, patch, changeset)
self.version.major = tonumber(major) or 0
self.version.minor = tonumber(minor) or 0
self.version.patch = tonumber(patch) or 0
changeset = changeset or ""
self.version.changeset = tostring(changeset)
if self.version.changeset == "" then
self._versionString = string.format("v%d.%d.%d", self.version.major, self.version.minor, self.version.patch)
else
self._versionString = string.format("v%d.%d.%d-%s", self.version.major, self.version.minor, self.version.patch, self.version.changeset)
end
end
function Profile:Version()
return self.version
end
function Profile:VersionString()
return self._versionString
end
CLM.MODELS.Profile = Profile |
SCONFIG = L2TConfig.GetConfig();
moveDistance = 30;
ShowToClient("Q4", "Quest Going into a Real War, Let's Go to the Underground Traning Field! - Started");
LearnAllSkills();
MoveTo(-110755, 253477, -1739, moveDistance);
TargetNpc("Evain", 33464);
Talk();
ClickAndWait("talk_select", "Quest");
ClickAndWait("menu_select?ask=10323&reply=1", "\"Ready!\"");
ClickAndWait("quest_accept?quest_id=10323", "\"I'll put them down.\"");
MoveTo(-110755, 253477, -1739, moveDistance);
MoveTo(-110776, 253689, -1789, moveDistance);
MoveTo(-110535, 253636, -1789, moveDistance);
MoveTo(-110133, 252577, -1981, moveDistance);
MoveTo(-110194, 252547, -1983, moveDistance);
MoveTo(-110399, 252499, -1989, moveDistance);
TargetNpc("Holden", 33194);
Talk();
Click("menu_select?ask=-3500&reply=1", "Move to the Training Grounds Underground Facility.");
repeat
Sleep(1000);
until GetMe():GetRangeTo(-113815, 247744, -7876)<1000;
SCONFIG.melee.me.enabled = true;
SCONFIG.melee.me.attackRange = 50;
SCONFIG.targeting.option = L2TConfig.ETargetingType.TT_RANGE_FROM_CHAR;
SCONFIG.targeting.rangeType = L2TConfig.ETargetingRangeType.TRT_SQUERE;
SCONFIG.targeting.range = 400;
SCONFIG.pickup.userPickup.pickupRange = 200;
SCONFIG.pickup.userPickup.mode = L2TConfig.EPickupMode.PICKUP_BEFORE;
MoveTo(-113815, 247744, -7876, moveDistance);
MoveTo(-113993, 248284, -7876, moveDistance);
SetPause(false);
repeat
Sleep(4000);
until GetTarget() == nil;
SetPause(true);
MoveTo(-114049, 248374, -7876, moveDistance);
SetPause(false);
repeat
Sleep(2000);
until GetTarget() == nil;
SetPause(true);
MoveTo(-114594, 248571, -7876, moveDistance);
SetPause(false);
repeat
Sleep(2000);
until GetTarget() == nil;
SetPause(true);
MoveTo(-114967, 248141, -7876, moveDistance);
SetPause(false);
repeat
Sleep(2000);
until GetTarget() == nil;
SetPause(true);
MoveTo(-115025, 247867, -7872, moveDistance);
SetPause(false);
repeat
Sleep(2000);
until GetTarget() == nil;
SetPause(true);
MoveTo(-114862, 248296, -7877, moveDistance);
TargetNpc("Guard", 33021);
Talk();
ClickAndWait("menu_select?ask=10323&reply=1", "\"No, please tell me.\"");
ClearTargets();
ActivateSoulShot(1835, true); -- Soulshot: No Grade
ActivateSoulShot(3947, true); -- Blessed Spiritshot : No Grade
ActivateSoulShot(2509, true); -- Spiritshot : No Grade
MoveTo(-114862, 248296, -7877, moveDistance);
repeat
TargetNpc("Guard", 33021);
Talk();
ClearTargets();
Sleep(1000);
until GetQuestManager():GetQuestProgress(10323) == 6;
ClearTargets();
-- Quest state changed, ID: 10323, STATE: 6
MoveTo(-114862, 248296, -7877, moveDistance);
SetPause(false);
repeat
Sleep(2000);
until GetTarget() == nil;
SetPause(true);
ClearTargets();
MoveTo(-115052, 247919, -7877, moveDistance);
SetPause(false);
repeat
Sleep(2000);
until GetTarget() == nil;
SetPause(true);
ClearTargets();
MoveTo(-114622, 248520, -7877, moveDistance);
SetPause(false);
repeat
Sleep(2000);
until GetTarget() == nil;
SetPause(true);
ClearTargets();
MoveTo(-114603, 248615, -7877, moveDistance);
SetPause(false);
repeat
Sleep(2000);
until GetTarget() == nil;
SetPause(true);
ClearTargets();
MoveTo(-114132, 248397, -7872, moveDistance);
SetPause(false);
repeat
Sleep(2000);
until GetTarget() == nil;
SetPause(true);
MoveTo(-114012, 247724, -7877, moveDistance);
TargetNpc("Aymen", 33193);
Talk();
Click("menu_select?ask=-3502&reply=1", "I need to return back to town.");
repeat
Sleep(1000);
until GetQuestManager():GetQuestProgress(10323) == 8;
-- Quest state changed, ID: 10323, STATE: 8
Sleep(4000);
MoveTo(-110375, 252467, -1992, moveDistance);
MoveTo(-110128, 252770, -1930, moveDistance);
MoveTo(-110342, 253270, -1797, moveDistance);
MoveTo(-110507, 253744, -1791, moveDistance);
MoveTo(-111770, 254054, -1654, moveDistance);
MoveTo(-112118, 254402, -1520, moveDistance);
MoveTo(-112146, 254680, -1475, moveDistance);
MoveTo(-112027, 254808, -1443, moveDistance);
MoveTo(-111999, 255088, -1441, moveDistance);
MoveTo(-111750, 255588, -1447, moveDistance);
MoveTo(-111486, 255803, -1443, moveDistance);
MoveTo(-111402, 255852, -1443, moveDistance);
TargetNpc("Shannon", 32974);
Talk();
ClickAndWait("talk_select", "Quest");
ClickAndWait("quest_choice?choice=7&option=1", "[532302]");
ClickAndWait("menu_select?ask=10323&reply=1", "\"I can use shots now... that's pretty cool.\"");
ClearTargets();
ShowToClient("Q4", "Quest Going into a Real War, Let's Go to the Underground Traning Field! - Finished"); |
-- A cheating AI file, which draws additional cards and recovers LP each turn
-- Configure these to your liking
require("ai.ai")
EXTRA_SUMMON = 1
EXTRA_DRAW = 1
LP_RECOVER = 1000
GlobalCheating = true
math.randomseed( require("os").time() )
function OnStartOfDuel()
AI.Chat("AI script version "..Version)
AI.Chat("You selected a cheating AI")
AI.Chat("The AI will recover "..LP_RECOVER.." LP and draw "..EXTRA_DRAW.." additional cards each turn")
end
|
--[[--------------------------------------------------------------------
Gazelle: a system for building fast, reusable parsers
intfa_combine.lua
Once the lookahead has been calculated, we know what terminal(s)
each RTN/GLA state is expecting to see. We use this information to
build IntFAs that recognize any possible valid token that could
occur at this point in the input. We combine and reuse DFAs as much
as possible -- only when two terminals conflict is it necessary to
use different DFAs.
Copyright (c) 2007 Joshua Haberman. See LICENSE for details.
--------------------------------------------------------------------]]--
-- Determine what terminals (if any) conflict with each other.
-- In this context, "conflict" means that a string of characters can
-- be interpreted as one or more terminals.
function analyze_conflicts(terminals)
-- We detect conflicts by combining all the NFAs into a single DFA.
-- We then observe what states are final to more than one terminal.
local conflicts = {}
local nfas = {}
for name, terminal in pairs(terminals) do
if type(terminal) == "string" then
terminal = fa.intfa_for_string(terminal)
end
table.insert(nfas, {terminal, name})
end
local uber_dfa = nfas_to_dfa(nfas, true)
for state in each(uber_dfa:states()) do
if type(state.final) == "table" then -- more than one terminal ended in this state
for term1 in each(state.final) do
for term2 in each(state.final) do
if term1 ~= term2 then
conflicts[term1] = conflicts[term1] or Set:new()
conflicts[term1]:add(term2)
end
end
end
end
end
return conflicts
end
function has_conflicts(conflicts, term_set1, term_set2)
for term1 in each(term_set1) do
if conflicts[term1] then
for conflict in each(conflicts[term1]) do
if term_set2:contains(conflict) then
return true, term1, conflict
end
end
end
end
end
function create_or_reuse_termset_for(terminals, conflicts, termsets, nonterm)
if has_conflicts(conflicts, terminals, terminals) then
local has_conflict, c1, c2 = has_conflicts(conflicts, terminals, terminals)
error(string.format("Can't build DFA inside %s, because terminals %s and %s conflict",
nonterm, c1, c2))
end
local found_termset = false
for i, termset in ipairs(termsets) do
-- will this termset do? it will if none of our terminals conflict with any of the
-- existing terminals in this set.
-- (we can probably compute this faster by pre-computing equivalence classes)
if not has_conflicts(conflicts, termset, terminals) then
found_termset = i
break
end
end
if found_termset == false then
local new_termset = Set:new()
table.insert(termsets, new_termset)
found_termset = #termsets
end
-- add all the terminals for this phase of lookahead to the termset we found
local termset = termsets[found_termset]
for term in each(terminals) do
termset:add(term)
end
assert(termset:count() > 0)
return found_termset
end
function intfa_combine(all_terminals, state_term_pairs)
local conflicts = analyze_conflicts(all_terminals)
-- For each state in the grammar, create (or reuse) a DFA to run
-- when we hit that state.
local termsets = {}
local intfa_nums = {}
for state_term_pair in each(state_term_pairs) do
local state, terms = unpack(state_term_pair)
assert(terms:count() > 0)
local nonterm
if state.rtn == nil then
nonterm = state.gla.rtn_state.rtn.name
else
nonterm = state.rtn.name
end
intfa_nums[state] = create_or_reuse_termset_for(terms, conflicts, termsets, nonterm)
end
local dfas = OrderedSet:new()
for termset in each(termsets) do
local nfas = {}
for term in each(termset) do
local target = all_terminals[term]
assert(target, string.format("No terminal for terminal '%s'", tostring(serialize(term))))
if type(target) == "string" then
target = fa.intfa_for_string(target)
end
table.insert(nfas, {target, term})
end
local dfa = hopcroft_minimize(nfas_to_dfa(nfas))
dfa.termset = termset
dfas:add(dfa)
end
for state, intfa_num in pairs(intfa_nums) do
state.intfa = dfas:element_at(intfa_num)
end
dfas:sort(function (a, b) return b.termset:count() < a.termset:count() end)
return dfas
end
-- vim:et:sts=2:sw=2
|
-- local dbg = require("debugger")
-- dbg.auto_where = 2
local stub_vim = require'spec.helpers.stub_vim'.stub_vim
local complete = require'cccomplete'.complete
local api = require'nvimapi'
local r = require'spec.helpers.random'
insulate("default completion", function()
stub_vim{lines = {"", "# a comment", ""}, cursor = {2, 3}, ft = "elixir"}
complete()
it("has added and modified the lines #wip", function()
assert.are.same({"", "# a comment do", " ", "end", ""}, api.lines(1, 5))
end)
end)
context("no do cases", function()
describe("struct", function()
stub_vim{lines = {" hello >", " struct A"}, cursor = {2, 999}, ft = "crystal"}
complete()
it("expands", function()
assert.are.same({" hello >", " struct A", " ", " end"}, api.buffer())
assert.are.same({3, 999}, api.cursor())
end)
end)
end)
|
local l = exec.cmd("l")
l()
fmt.print("first l() ok\n")
fmt.print("next l() will fail\n")
l.error = "custom error"
l.errexit = true
l()
|
function onDrop(x, y, draginfo)
return PartySheetManager.onDrop(x, y, draginfo);
end |
--魚雷魚
function c90337190.initial_effect(c)
aux.AddCodeList(c,22702055)
--immune spell
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c90337190.econ)
e1:SetValue(c90337190.efilter)
c:RegisterEffect(e1)
end
function c90337190.econ(e)
return Duel.IsEnvironment(22702055)
end
function c90337190.efilter(e,te)
return te:IsActiveType(TYPE_SPELL)
end
|
sceneManager = {}
function sceneManager:load()
self.currentScene = 1
self.sceneToLoad = nil
base:loading()
end
function sceneManager:init(scene)
self.sceneToLoad = require (scene)
local loadState = self.sceneToLoad:load()
base.outsideLoaded = loadState
end
function sceneManager:openScene(scene)
base:loading()
self.clear()
self:init(scene)
end
function sceneManager.clear()
end
function sceneManager:update(dt)
if not base.globalLoaded then return end
self.sceneToLoad:update(dt, base.mouseX, base.mouseY)
end
function sceneManager:draw()
if not base.globalLoaded then return end
self.sceneToLoad:draw()
end
function sceneManager:keypressed(key)
if not base.globalLoaded then return end
self.sceneToLoad:keypressed(key)
end
function sceneManager:mousepressed(x, y, button, istouch, presses)
if not base.globalLoaded then return end
self.sceneToLoad:mousepressed(x, y, button, istouch, presses)
end |
group("third_party")
project("vulkan-loader")
uuid("07d77359-1618-43e6-8a4a-0ee9ddc5fa6a")
kind("StaticLib")
language("C")
defines({
"_LIB",
"API_NAME=\"vulkan\"",
})
removedefines({
"_UNICODE",
"UNICODE",
})
includedirs({
".",
})
recursive_platform_files()
-- Included elsewhere
removefiles("vk_loader_extensions.c")
filter("platforms:Windows")
warnings("Off") -- Too many warnings.
characterset("MBCS")
defines({
"VK_USE_PLATFORM_WIN32_KHR",
})
links({
"Cfgmgr32"
})
filter("platforms:not Windows")
removefiles("dirent_on_windows.c")
filter("platforms:Linux")
defines({
"VK_USE_PLATFORM_XCB_KHR",
[[SYSCONFDIR="\"/etc\""]],
[[FALLBACK_CONFIG_DIRS="\"/etc/xdg\""]],
[[DATADIR="\"/usr/share\""]],
[[FALLBACK_DATA_DIRS="\"/usr/share:/usr/local/share\""]],
})
|
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule('Skins')
--Lua functions
local _G = _G
--WoW API / Variables
--Just some test code
--[[local talkingHeadTextureKitRegionFormatStrings = {
["TextBackground"] = "%s-TextBackground",
["Portrait"] = "%s-PortraitFrame",
}
local talkingHeadDefaultAtlases = {
["TextBackground"] = "TalkingHeads-TextBackground",
["Portrait"] = "TalkingHeads-Alliance-PortraitFrame",
}
local talkingHeadFontColor = {
["TalkingHeads-Horde"] = {Name = CreateColor(0.28, 0.02, 0.02), Text = CreateColor(0.0, 0.0, 0.0), Shadow = CreateColor(0.0, 0.0, 0.0, 0.0)},
["TalkingHeads-Alliance"] = {Name = CreateColor(0.02, 0.17, 0.33), Text = CreateColor(0.0, 0.0, 0.0), Shadow = CreateColor(0.0, 0.0, 0.0, 0.0)},
["TalkingHeads-Neutral"] = {Name = CreateColor(0.33, 0.16, 0.02), Text = CreateColor(0.0, 0.0, 0.0), Shadow = CreateColor(0.0, 0.0, 0.0, 0.0)},
["Normal"] = {Name = CreateColor(1, 0.82, 0.02), Text = CreateColor(1, 1, 1), Shadow = CreateColor(0.0, 0.0, 0.0, 1.0)},
}
--test
function TestTalkingHead()
local frame = TalkingHeadFrame;
local model = frame.MainFrame.Model;
if( frame.finishTimer ) then
frame.finishTimer:Cancel();
frame.finishTimer = nil;
end
if ( frame.voHandle ) then
StopSound(frame.voHandle);
frame.voHandle = nil;
end
local currentDisplayInfo = model:GetDisplayInfo();
local displayInfo, cameraID, vo, duration, lineNumber, numLines, name, text, isNewTalkingHead, textureKitID
displayInfo = 76291
cameraID = 1240
vo = 103175
duration = 20.220001220703
lineNumber = 0
numLines = 4
name = "Some Ugly Woman"
text = "Testing this sheet out Testing this sheet out Testing this sheet out Testing this sheet out Testing this sheet out Testing this sheet out Testing this sheet out "
isNewTalkingHead = true
textureKitID = 0
local textFormatted = string.format(text);
if ( displayInfo and displayInfo ~= 0 ) then
local textureKit;
if ( textureKitID ~= 0 ) then
SetupTextureKits(textureKitID, frame.BackgroundFrame, talkingHeadTextureKitRegionFormatStrings, false, true);
SetupTextureKits(textureKitID, frame.PortraitFrame, talkingHeadTextureKitRegionFormatStrings, false, true);
textureKit = GetUITextureKitInfo(textureKitID);
else
SetupAtlasesOnRegions(frame.BackgroundFrame, talkingHeadDefaultAtlases, true);
SetupAtlasesOnRegions(frame.PortraitFrame, talkingHeadDefaultAtlases, true);
textureKit = "Normal";
end
local nameColor = talkingHeadFontColor[textureKit].Name;
local textColor = talkingHeadFontColor[textureKit].Text;
local shadowColor = talkingHeadFontColor[textureKit].Shadow;
frame.NameFrame.Name:SetTextColor(nameColor:GetRGB());
frame.NameFrame.Name:SetShadowColor(shadowColor:GetRGBA());
frame.TextFrame.Text:SetTextColor(textColor:GetRGB());
frame.TextFrame.Text:SetShadowColor(shadowColor:GetRGBA());
frame:Show();
if ( currentDisplayInfo ~= displayInfo ) then
model.uiCameraID = cameraID;
model:SetDisplayInfo(displayInfo);
else
if ( model.uiCameraID ~= cameraID ) then
model.uiCameraID = cameraID;
Model_ApplyUICamera(model, model.uiCameraID);
end
TalkingHeadFrame_SetupAnimations(model);
end
if ( isNewTalkingHead ) then
TalkingHeadFrame_Reset(frame, textFormatted, name);
TalkingHeadFrame_FadeinFrames();
else
if ( name ~= frame.NameFrame.Name:GetText() ) then
-- Fade out the old name and fade in the new name
frame.NameFrame.Fadeout:Play();
C_Timer.After(0.25, function()
frame.NameFrame.Name:SetText(name);
end);
C_Timer.After(0.5, function()
frame.NameFrame.Fadein:Play();
end);
frame.MainFrame.TalkingHeadsInAnim:Play();
end
if ( textFormatted ~= frame.TextFrame.Text:GetText() ) then
-- Fade out the old text and fade in the new text
frame.TextFrame.Fadeout:Play();
C_Timer.After(0.25, function()
frame.TextFrame.Text:SetText(textFormatted);
end);
C_Timer.After(0.5, function()
frame.TextFrame.Fadein:Play();
end);
end
end
local success, voHandle = PlaySound(vo, "Talking Head", true, true);
if ( success ) then
frame.voHandle = voHandle;
end
end
end]]
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.talkinghead ~= true then return end
local TalkingHeadFrame = _G.TalkingHeadFrame
TalkingHeadFrame.BackgroundFrame.TextBackground:SetAtlas(nil)
TalkingHeadFrame.PortraitFrame.Portrait:SetAtlas(nil)
TalkingHeadFrame.MainFrame.Model.PortraitBg:SetAtlas(nil)
TalkingHeadFrame.PortraitFrame:StripTextures()
if E.db.general.talkingHeadFrameBackdrop then
TalkingHeadFrame:StripTextures()
TalkingHeadFrame.MainFrame:StripTextures()
TalkingHeadFrame:CreateBackdrop("Transparent")
local button = TalkingHeadFrame.MainFrame.CloseButton
S:HandleCloseButton(button)
button:ClearAllPoints()
button:Point('TOPRIGHT', TalkingHeadFrame.BackgroundFrame, 'TOPRIGHT', 0, -2)
else
TalkingHeadFrame.MainFrame.Model:CreateBackdrop("Transparent")
TalkingHeadFrame.MainFrame.Model.backdrop:ClearAllPoints()
TalkingHeadFrame.MainFrame.Model.backdrop:Point("CENTER")
TalkingHeadFrame.MainFrame.Model.backdrop:Size(120, 119)
TalkingHeadFrame.MainFrame.CloseButton:Kill()
end
TalkingHeadFrame.BackgroundFrame.TextBackground.SetAtlas = E.noop
TalkingHeadFrame.PortraitFrame.Portrait.SetAtlas = E.noop
TalkingHeadFrame.MainFrame.Model.PortraitBg.SetAtlas = E.noop
TalkingHeadFrame.NameFrame.Name:SetTextColor(1, 0.82, 0.02)
TalkingHeadFrame.NameFrame.Name.SetTextColor = E.noop
TalkingHeadFrame.NameFrame.Name:SetShadowColor(0, 0, 0, 1)
TalkingHeadFrame.NameFrame.Name:SetShadowOffset(2, -2)
TalkingHeadFrame.TextFrame.Text:SetTextColor(1, 1, 1)
TalkingHeadFrame.TextFrame.Text.SetTextColor = E.noop
TalkingHeadFrame.TextFrame.Text:SetShadowColor(0, 0, 0, 1)
TalkingHeadFrame.TextFrame.Text:SetShadowOffset(2, -2)
end
S:AddCallbackForAddon("Blizzard_TalkingHeadUI", "TalkingHead", LoadSkin)
|
local computer = require("computer")
io.write(computer.address(),"\n")
|
--[[
-- Avoid tail calls like hell.
--]]
--[[
Copyright (C) 2013 simplex
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]--
return function()
local table = _G.table
local ipairs = _G.ipairs
local unpack = _G.unpack
local cleanup_fns = {}
local final_cleanup_fns = {}
local function AddCleanup(fn)
table.insert(cleanup_fns, fn)
end
AddFinalCleanup = function(fn)
table.insert(final_cleanup_fns, 1, fn)
end
local function NewVariableCleanupAdder(basic_adder)
return function(...)
local names = {...}
basic_adder(function(env)
for _, name in ipairs(names) do
env[name] = nil
end
end)
end
end
local AddVariableCleanup = NewVariableCleanupAdder(AddCleanup)
local AddFinalVariableCleanup = NewVariableCleanupAdder(AddFinalCleanup)
local function PerformCleanup()
for _, fn in ipairs(cleanup_fns) do
fn(_M)
end
for _, fn in ipairs(final_cleanup_fns) do
fn(_M)
end
cleanup_fns = {}
final_cleanup_fns = {}
end
_M.AddCleanup = AddCleanup
_M.AddFinalCleanup = AddFinalCleanup
_M.AddVariableCleanup = AddVariableCleanup
_M.AddFinalVariableCleanup = AddFinalVariableCleanup
_M.PerformCleanup = PerformCleanup
AddFinalVariableCleanup(
"AddCleanup",
"AddFinalCleanup",
"AddVariableCleanup",
"AddFinalVariableCleanup",
"PerformCleanup"
)
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.