content
stringlengths 5
1.05M
|
|---|
-----------------------------------
-- Area: Xarcabard
-- NPC: Beastmen_s_Banner
-- !pos 153.000 -36.444 23.500 112
-----------------------------------
local ID = require("scripts/zones/Xarcabard/IDs")
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
player:messageSpecial(ID.text.BEASTMEN_BANNER)
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
|
local json = json
local pairs = pairs
local const = require("const")
GameRecorder = class("GameRecorder")
GameRecorder.__index = GameRecorder
function GameRecorder:ctor()
self.recordPath = const.RECORD_PATH
self.isNewPlayer = true
self.record = {}
end
function GameRecorder:create()
local recorder = GameRecorder.new()
recorder:init()
return recorder
end
function GameRecorder:getStageInfo()
return self.record.stageInfo
end
function GameRecorder:getStageState(stageId)
local stageState = self:getStageInfo().stageState
local state = stageState[stageId]
return state
end
function GameRecorder:updateStageState(stageId, stageState)
local stageInfo = self:getStageInfo()
stageInfo.curStageId = stageId
if stageId > stageInfo.maxStageId then
stageInfo.maxStageId = stageId
end
stageInfo.stageState[stageId] = stageState
end
function GameRecorder:getHeroInfo()
return self.record.heroInfo
end
function GameRecorder:updateHeroInfo(info)
local heroInfo = self:getHeroInfo()
for k, v in pairs(info) do
heroInfo[k] = v
end
end
function GameRecorder:getPlayerInfo()
return self.record.playerInfo
end
function GameRecorder:updatePlayerInfo(info)
local playerInfo = self:getPlayerInfo()
for k, v in pairs(info) do
playerInfo[k] = v
end
end
function GameRecorder:init()
self:initWithRecord()
end
function GameRecorder:initWithRecord()
local jsonStr = self:loadRecord()
self.record = json.decode(jsonStr)
end
function GameRecorder:initWithDefaultRecord()
local jsonStr = self:loadDefaultRecord()
self.record = json.decode(jsonStr)
end
function GameRecorder:loadDefaultRecord( )
self.isNewPlayer = true
local file = io.open(const.DEFAULT_RECORD)
local jsonStr = nil
if file == nil then
error("cannot read data through " .. const.DEFAULT_RECORD)
else
jsonStr = file:read('*a')
file:close()
end
assert(jsonStr ~= nil and jsonStr ~= '')
return jsonStr
end
function GameRecorder:loadRecord()
local file = io.open(self.recordPath, 'r')
local jsonStr = nil
if file == nil then
return self:loadDefaultRecord()
else
self.isNewPlayer = false
jsonStr = file:read('*a')
file:close()
assert(jsonStr ~= nil and jsonStr ~= '')
return jsonStr
end
end
function GameRecorder:saveRecord()
local file = io.open(self.recordPath, 'w')
if file == nil then
os.execute("mkdir " .. const.RECORD_DIR)
file = io.open(const.RECORD_PATH, 'w')
if file == nil then
error("cannot create record file " .. const.RECORD_PATH)
end
end
local jsonStr = json.encode(self.record)
file:write(jsonStr)
file:flush()
file:close()
end
|
function Square(Number)
return Number * Number
end
function LuaPrint(Text)
print("LUA", Text);
end
function HelloLua(fromC)
if not fromC then
LuaPrint("Hello, from Lua!")
else
LuaPrint("Hello, from C++!")
end
end
local Success = FileW("Text.txt", "New Files Contents")
if Success then
LuaPrint("Successfully wrote to 'Text.txt'!");
local RSuccess, Contents = FileR("Text.txt");
if RSuccess then
LuaPrint("Successfully read 'Text.txt'!");
print(Contents);
end
else
LuaPrint("Failed to open 'Text.txt'!");
end
HelloLua(false)
|
fx_version 'cerulean'
game 'gta5'
name 'DanFrmSpace Weapons Truck Robbery'
description 'Robbery script for the weapons truck in GTA V'
author 'DanFrmSpace'
url 'https://github.com/d0p3t/fivem-ts-boilerplate'
client_script {
'dist/client/*.client.js',
'config.ts'
}
server_script 'dist/server/*.server.js'
|
local skynet = require "skynet"
local netpack = require "skynet.netpack"
local socket = require "skynet.socket"
local client_fd = ...
client_fd = tonumber(client_fd)
skynet.register_protocol {
name = "client",
id = skynet.PTYPE_CLIENT,
unpack = netpack.tostring
}
local function task(msg)
skynet.error("recv from fd", client_fd, msg)
socket.write(client_fd, netpack.pack(string.upper(msg)))
end
skynet.start(function()
skynet.dispatch("client", function(_, _, msg)
task(msg)
end)
skynet.dispatch("lua", function(_, _, cmd)
if cmd == "quit" then
skynet.error(client_fd, "agent quit")
skynet.exit()
end
end)
end)
|
--[[
/ Bulk Fade /
About:
This module was created to make bulk tweening much easier.
Bulk tweening is when you tween all the elements together for a better transition.
Version:
- 1.3
- 11/12/2021
Author(s):
kingerman88
]]
-- / Types / --
type ArrayList<T> = {[number]:T};
type IndexArray<I,V> = {[I]:V};
-- / Services / --
local TweenService = game:GetService("TweenService");
-- / Variables / --
local DefaultTweenConfiguration = TweenInfo.new(1, Enum.EasingStyle.Cubic)
-- Class Definitions
local ImageElements = {
["ImageButton"] = true,
["ImageLabel"] = true,
}
local TextElements = {
["TextLabel"] = true,
["TextButton"] = true,
["TextBox"] = true,
}
-- / Functions / --
local function getAttributesAtValue(element, val)
local temp = element:GetAttributes();
for i in pairs(temp) do
temp[i] = val
end
return temp;
end
local function addElement(self, element:Instance, tweenConfig:TweenInfo|nil)
-- Specialized UI stroke elements
if element:IsA("UIStroke") then
element:SetAttribute("Transparency", element.Transparency);
table.insert(self.UiElements, element);
self.AppearTweens[element] = TweenService:Create(element, tweenConfig or DefaultTweenConfiguration, element:GetAttributes());
self.DisappearTweens[element] = TweenService:Create(element, tweenConfig or DefaultTweenConfiguration, {Transparency = 1});
return;
elseif not element:IsA("GuiObject") then
return;
end
element:SetAttribute("BackgroundTransparency", element.BackgroundTransparency);
if ImageElements[element.ClassName] then
element:SetAttribute("ImageTransparency", element.ImageTransparency);
elseif TextElements[element.ClassName] then
element:SetAttribute("TextTransparency", element.TextTransparency);
end
table.insert(self.UiElements, element);
self.AppearTweens[element] = TweenService:Create(element, tweenConfig or DefaultTweenConfiguration, element:GetAttributes());
self.DisappearTweens[element] = TweenService:Create(element, tweenConfig or DefaultTweenConfiguration, getAttributesAtValue(element, 1));
end
local function removeElement(self, element)
table.remove(self.UiElements, element);
self.AppearTweens[element] = nil;
self.DisappearTweens[element] = nil;
end
-- / BulkFade.lua / --
local BulkFade = {}
BulkFade.__index = BulkFade;
-- Creates a new tween group
-- @param elements:ArrayList<Instance> - An arraylist of instances (not nessesarily UI objects)
-- @param tweenConfig:TweenInfo:optional - a custom tweenInfo that will override the default tweenInfoConfig
-- @return BulkFadeGroup
function BulkFade.CreateGroup(elements:ArrayList<Instance>, tweenConfig:TweenInfo)
local self = {};
self.Faded = false;
self.UiElements = {};
self.AppearTweens = {};
self.DisappearTweens = {};
for _, element in ipairs(elements) do
addElement(self, element, tweenConfig);
end
return setmetatable(self, BulkFade);
end
-- Calls all the tweens (in)
function BulkFade:FadeIn()
self.Faded = true;
for element, tween in pairs(self.AppearTweens) do
tween:Play();
end
end
-- Calls all the tweens (out)
function BulkFade:FadeOut()
self.Faded = false;
for element, tween in pairs(self.DisappearTweens) do
tween:Play();
end
end
function BulkFade:Fade()
if self.Faded then
self:FadeOut();
else
self:FadeIn();
end
end
BulkFade.TweenIn = BulkFade.FadeIn;
BulkFade.TweenOut = BulkFade.FadeOut;
-- Simply returns all the elements in the tweengroup
-- @return ArrayList<GuiObject> - A table of UI elements
function BulkFade:GetElements()
return self.UiElements;
end
return BulkFade
|
-- lua-logo.lua
sqrt=math.sqrt
PI=math.pi
RESOLUTION=512
p:begin_page(RESOLUTION, RESOLUTION)
p:translate(RESOLUTION/2, RESOLUTION/2)
p:scale(RESOLUTION/2/sqrt(2), RESOLUTION/2/sqrt(2))
-- planet
p:setcolor("fill", "rgb", 0, 0, 0.5)
p:circle(0, 0, 1)
p:fill()
-- hole
r=1-sqrt(2)/2
p:setcolor("fill", "rgb", 1, 1, 1)
p:circle(1-2*r, 1-2*r, r)
p:fill()
-- moon
p:setcolor("fill", "rgb", 0, 0, 0.5)
p:circle(1, 1, r)
p:fill()
-- logo
font = p:load_font("Helvetica", "host")
p:setfont(font, 0.9)
x=p:stringwidth("Lua", font, 0.9)
p:setcolor("both", "rgb", 1, 1, 1, 0)
p:show_xy("Lua", -x/2, -0.5)
-- orbit
p:setlinewidth(0.03)
x=(1+r)*(PI/180*5)
p:setdash(x,x)
p:setcolor("stroke", "gray", 0.5)
p:arcn(0, 0, 1+r, 32, 57)
p:stroke()
p:end_page()
|
local ffi = require("ffi")
local ffi_util = require("common.ffi_util")
do --- ffi-parse-cdef
ffi_util.checkfail({
"int",
"int aa1; int aa2 ",
"static int x;",
"static const long long x = 1;", -- NYI
"static const double x = 1;", -- NYI
"static const bool x = 1;", -- NYI (intentional, need true/false)
"struct { static int x = 1; };",
";;static int y"
}, ffi.cdef)
ffi.cdef[[
static const int K_42a = 42;
static const char K_42b = 42+256;
static const short K_M1a = 65535;
static const unsigned short K_65535a = 65535;
static const int K_1b = 0xffffffff >> 31;
static const int K_1c = 0xffffffffu >> 31;
static const int K_M1b = (int)0xffffffff >> 31;
]]
ffi_util.checktypes{
42, 1, "char[K_42a]",
42, 1, "char[K_42b]",
1, 1, "char[-K_M1a]",
65535, 1, "char[K_65535a]",
1, 1, "char[K_1b]",
1, 1, "char[K_1c]",
1, 1, "char[-K_M1b]",
}
ffi.cdef[[
struct str1 {
enum {
K_99 = 99
};
static const int K_55 = 55;
} extk;
]]
ffi_util.checktypes{
99, 1, "char[K_99]",
99, 1, "char[extk.K_99]",
99, 1, "char[((struct str1)0).K_99]",
99, 1, "char[((struct str1 *)0)->K_99]",
55, 1, "char[extk.K_55]",
}
ffi_util.checkfail{
"char[K_55]",
}
ffi.cdef[[
extern int func1(void);
extern int func2();
static int func3();
static inline int func4(int n)
{
int i, k = 0;
float x = 1.0f;
for (i = 0; i < n; i++) {
k += i;
}
return k;
}
;;;
]]
ffi.cdef[[
int ext1;
extern int ext2;
]]
end
|
-- WirePlumber
--
-- This file contains the API that is made available to the Lua scripts
--
-- Copyright © 2020 Collabora Ltd.
-- @author George Kiagiadakis <george.kiagiadakis@collabora.com>
--
-- SPDX-License-Identifier: MIT
local function Constraint (spec)
assert (type(spec[1]) == "string", "Constraint: expected subject as string");
assert (type(spec[2]) == "string", "Constraint: expected verb as string");
local subject = spec[1]
local verb = spec[2]
local verbs = {
["="] = "equals",
["!"] = "not-equals",
["c"] = "in-list",
["~"] = "in-range",
["#"] = "matches",
["+"] = "is-present",
["-"] = "is-absent"
}
-- check and convert verb to its short version
local verb_is_valid = false
for k, v in pairs(verbs) do
if verb == k or verb == v then
verb = k
spec[2] = k
verb_is_valid = true
break
end
end
assert (verb_is_valid, "Constraint: invalid verb '" .. verb .. "'")
-- check and convert type to its integer value
local type = spec["type"]
if type then
local valid_types = { "pw-global", "pw", "gobject" }
local type_is_valid = false
for i, v in ipairs(valid_types) do
if type == v then
spec["type"] = i
type_is_valid = true
break
end
end
assert(type_is_valid, "Constraint: invalid subject type '" .. type .. "'")
end
-- check if we got the right amount of values
if verb == "=" or verb == "!" or verb == "#" then
assert (spec[3] ~= nil,
"Constraint: " .. verbs[verb] .. ": expected constraint value")
elseif verb == "c" then
assert (spec[3] ~= nil,
"Constraint: " .. verbs[verb] .. ": expected at least one constraint value")
elseif verb == "~" then
assert (spec[3] ~= nil and spec[4] ~= nil,
"Constraint: " .. verbs[verb] .. ": expected two values")
else
assert (spec[3] == nil,
"Constraint: " .. verbs[verb] .. ": expected no value, but there is one")
end
return debug.setmetatable(spec, { __name = "Constraint" })
end
local function dump_table(t, indent)
local indent_str = ""
indent = indent or 1
for i = 1, indent, 1 do
indent_str = indent_str .. "\t"
end
local kvpairs = {}
for k, v in pairs(t) do
table.insert(kvpairs, { k, v })
end
table.sort(kvpairs, function (lhs, rhs)
local left_key, right_key = lhs[1], rhs[1]
-- If the types are different, we sort by the type
-- in alphabetical order. This means that numbers
-- come before before strings, etc
if type(left_key) ~= type(right_key) then
return type(left_key) < type(right_key)
end
local key_type = type(left_key)
-- Only numbers and strings have a well-defined order
-- that's guaranteed to fulfill the requirements of
-- table.sort (strict weak order)
if key_type == "number" or key_type == "string" then
return left_key < right_key
end
-- At this point, we have no good way to order the objects.
-- We can't just do `left_key < right_key`, because this may fail
-- if there's no `__lt` metamethod, and even if there is one,
-- it might not be a strict weak order. (The Lua reference does
-- not say what happens if the order is not strict weak, so it's
-- undefined behaviour)
-- That said, it's always mathematically "permitted" to return `false`,
-- in which case, since both x < y and y < x are false, the elements
-- are considered "equivalent" and may appear in any order in relation
-- to each other. The elements are still sorted in relation to the
-- *other* keys.
return false
-- To be a strict weak order, if x and y are equivalent, and y and z
-- are equivalent, then x and z must be equivalent too. Otherwise the
-- ordering is only a strict *partial* order.
-- Note that the Lua 5.3 reference states that the order merely has to
-- be a strict *partial* order, but since all weak orders are partial
-- orders, this is not a problem.
end)
for _, pair in ipairs(kvpairs) do
local k, v = table.unpack(pair)
if (type(v) == "table") then
print (indent_str .. tostring(k) .. ": ")
dump_table(v, indent + 1)
else
print (indent_str .. tostring(k) .. ": " .. tostring(v))
end
end
end
local Debug = {
dump_table = dump_table,
}
local Id = {
INVALID = 0xffffffff,
ANY = 0xffffffff,
}
local Features = {
PipewireObject = {
MINIMAL = 0x11,
},
ALL = 0xffffffff,
}
local Feature = {
Proxy = {
BOUND = 1,
},
PipewireObject = {
INFO = (1 << 4),
PARAM_PROPS = (1 << 5),
PARAM_FORMAT = (1 << 6),
PARAM_PROFILE = (1 << 7),
PARAM_PORT_CONFIG = (1 << 8),
PARAM_ROUTE = (1 << 9),
},
SpaDevice = {
ENABLED = (1 << 16),
},
Node = {
PORTS = (1 << 16),
},
Session = {
ENDPOINTS = (1 << 16),
LINKS = (1 << 17),
},
Endpoint = {
STREAMS = (1 << 16),
},
Metadata = {
DATA = (1 << 16),
},
SessionItem = {
ACTIVE = (1 << 0),
EXPORTED = (1 << 1),
},
}
SANDBOX_EXPORT = {
Debug = Debug,
Id = Id,
Features = Features,
Feature = Feature,
GLib = GLib,
Log = WpLog,
Core = WpCore,
Plugin = WpPlugin,
ObjectManager = WpObjectManager_new,
Interest = WpObjectInterest_new,
SessionItem = WpSessionItem_new,
Constraint = Constraint,
Device = WpDevice_new,
SpaDevice = WpSpaDevice_new,
Node = WpNode_new,
LocalNode = WpImplNode_new,
Link = WpLink_new,
Pod = WpSpaPod,
State = WpState_new,
LocalModule = WpImplModule_new,
}
|
HeroName[13] = "阿尔托莉亚"
HeroMain[13] = "力量"
HeroType[13] = |Ewrd|
RDHeroType[13] = |h017|
IllHeroType[13] = |E038|
HeroTypePic[13] = "ReplaceableTextures\\CommandButtons\\BTNSaber.blp"
HeroSize[13] = 1.2
HeroReadySound[13] = "sound\\H013_Ready.mp3"
LearnSkillId = {|A1A1|, |A1A2|, |A1A3|, |A1A4|}
--解放真名
InitSkill{
name = "解放真名",
type = {"开关"},
ani = "stand",
art = {"BTNJFZM.blp", "BTNJFZM.blp", "BTNFWJJ.blp"}, --左边是学习,右边是普通.不填右边视为左边
mana = 75,
area = 600,
tip = "\
|cffff00cc主动:|r解放石中剑的真名,使你可以使用更加强大的技能,但是失去该技能的被动效果.如果你在风王结界状态下维持了至少%s秒的时间,你将对周围的单位造成伤害并|cffffcc00减速|r.\
|cffff00cc被动:|r风暴隐藏了你的武器,使你更加容易的击中敌人的要害,获得暴击率的提升.\
\
|cff00ffcc技能|r: 无目标\
|cff00ffcc伤害|r: 法术\n\
|cffffcc00造成伤害|r: %s(|cff1111ff+%d|r)\
|cffffcc00降低攻速|r: %s%%\
|cffffcc00降低移速|r: %s%%\
|cffffcc00减速持续|r: %s\
|cffffcc00暴击率|r: %s\n\
|cff888888风王结界爆发延迟1.5秒\n减速效果可以驱散\n2种技能共享冷却时间",
untip = "\
重新使用风王结界隐藏你的武器,使你获得被动的暴击率提升,但是将不能使用强大的技能.",
undata = {},
researchtip = "风王结界爆发时将单位卷至你面前",
data = {
{12, 11, 10, 9}, --积攒时间1
{80, 160, 240, 320}, --爆发伤害2
function(ap) --爆发伤害加成3
return ap * 1.2
end,
{30, 50, 70, 90}, --降低攻速4
{20, 25, 30, 35}, --降低移速5
{2, 3, 4, 5}, --持续时间6
{5, 10, 15, 20} --暴击率7
},
events = {"获得技能", "升级技能", "发动技能", "关闭技能", "失去技能"},
code = function(this)
if this.event == "获得技能" then
this._crit = this:get(7)
Crit(this.unit, this._crit)
local state = 0
this._pasfunc = function()
state = 1
this.tipname = nil
DestroyEffect(this._effect)
this._effect = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Tornado\\Tornado_Target.mdl", this.unit, "hand right")
local timer = Wait(this:get(1),
function()
state = 2
DestroyEffect(this._effect)
this._effect = AddSpecialEffectTarget("CycloneShield.mdx", this.unit, "hand right")
end
)
this._pasflush = function()
DestroyTimer(timer)
DestroyEffect(this._effect)
this._effect = nil
return state
end
end
this._pasfunc()
elseif this.event == "升级技能" then
local up = this:get(7) - this._crit
this._crit = this:get(7)
if not this.openflag then
Crit(this.unit, up)
end
elseif this.event == "发动技能" then
local state = this._pasflush()
this.tipname = "风王结界"
this._effect = AddSpecialEffectTarget("war3mapImported\\shizhongjian.mdx", this.unit, "hand right")
Crit(this.unit, - this._crit)
if state == 2 then
--风王结界爆发
StartSound("sound\\H013_Q1.mp3", this.player)
local modle = CreateModle("CycloneShield.mdx", this.unit, {z = 50, time = 2, size = 3})
local d = this:get(2) + this:get(3)
local as, ms = this:get(4), this:get(5)
local t = this:get(6)
local timer = Loop(0.1,
function()
SetUnitXY(modle, this.unit)
end
)
Wait(1.5,
function()
DestroyTimer(timer)
local loc
if this.research then
loc = MovePoint(this.unit, {150, GetUnitFacing(this.unit)})
end
forRange(this.unit, this:get("area"),
function(u)
if EnemyFilter(this.player, u) then
SkillEffect{
from = this.unit,
to = u,
name = this.name,
data = this,
aoe = true,
code = function(data)
if loc then
Mover{
unit = data.to,
speed = 1000,
angle = GetBetween(data.to, loc, true),
distance = GetBetween(data.to, loc)
}
end
SlowUnit{
from = data.from,
to = data.to,
attack = as,
move = ms,
time = t,
aoe = true,
effect = "Abilities\\Spells\\Other\\Tornado\\Tornado_Target.mdl",
}
Damage(data.from, data.to, d, false, true, {aoe = true, damageReason = this.name})
end
}
end
end
)
end
)
end
elseif this.event == "关闭技能" then
this._pasfunc()
Crit(this.unit, this._crit)
elseif this.event == "失去技能" then
DestroyEffect(this._effect)
Crit(this.unit, - this._crit or 0)
end
end
}
--魔力放出/远离尘世的理想乡
InitSkill{
name = "魔力放出",
tipname = "魔力放出",
_tipname = "远离尘世的理想乡",
type = {"主动"},
ani = "morph",
_ani = "spell four",
art = {"BTNMLFC.blp"}, --左边是学习,右边是普通.不填右边视为左边
_art = {"BTNLXX.blp"},
cast = 0.1,
mana = {120, 130, 140, 150},
_mana = {150, 160, 170, 180},
cool = 15,
_cool = 30,
dur = 10,
_dur = {4.5, 5, 5.5, 6},
tip = "\
放射出魔法构建铠甲,吸收受到的伤害.当铠甲存在时,你的攻击附带额外的法术伤害,数值正比于你的铠甲的剩余能量.\n\
|cff00ffcc技能|r: 无目标\n|cff00ffcc伤害|r: 法术\n\
|cffffcc00铠甲能量|r: %s(|cff1111ff+%d|r)\
|cffffcc00额外伤害|r: %s%%",
researchtip = "魔力放出:额外伤害会恢复你同等的生命值与法力值\n远离尘世的理想乡:激活时你溢出的生命值会增加生命值上限,持续直到下一次使用远离尘世的理想乡",
data = {
{150, 300, 450, 600}, --铠甲能量1
function(ap)
return ap * 2.5
end,
{9, 11, 13, 15} --伤害系数3
},
_tip = "\
获得极高的护甲,抗性与生命恢复速度.持续期间内你处于|cffffcc00霸体|r状态.\n\
|cff00ffcc技能|r: 无目标\n\
|cffffcc00护甲|r: %s\
|cffffcc00抗性|r: %s\
|cffffcc00生命恢复|r: %s(|cff1111ff+%d|r)\n\
|cff888888霸体状态下免疫晕眩,变羊,吹风等令你无法控制的负面效果",
_data = {
{100, 200, 300, 400}, --护甲1
{75, 150, 225, 300}, --魔抗2
{30, 50, 70, 90}, --生命恢复3
function(ap)
return ap * 0.5
end
},
events = {"获得技能", "发动技能", "失去技能"},
code = function(this)
if this.event == "发动技能" then
if this.tipname == "魔力放出" then
if this.flush1 then
TimerRestart(this._timer1)
return
end
local effect = AddSpecialEffectTarget("war3mapImported\\BigBlueOrbShield.mdx", this.unit, "chest")
local hp = this:get(1) + this:get(2)
local s = this:get(3) / 100
local func1 = Event("伤害减免",
function(damage)
if damage.to == this.unit then
local d = math.min(damage.damage, hp)
hp = hp - d
damage.damage = damage.damage - d
if d == 0 then
this.flush1()
end
end
end
)
local func2 = Event("伤害效果",
function(damage)
if damage.attack and damage.from == this.unit then
local damage = Damage(damage.from, damage.to, hp * s, false, true, {damageReason = this.name})
if damage.damage > 0 and this.research then
Heal(this.unit, this.unit, damage.damage)
SetUnitState(this.unit, UNIT_STATE_MANA, damage.damage + GetUnitState(this.unit, UNIT_STATE_MANA))
end
end
end
)
this._timer1 = Wait(this:get("dur"),
function()
if this.flush1 then
this.flush1()
end
end
)
this.flush1 = function()
Event("-伤害减免", func1)
Event("-伤害效果", func2)
DestroyEffect(effect)
this.flush1 = nil
end
elseif this.tipname == "远离尘世的理想乡" then
StartSound("sound\\H013_W2.mp3", this.player)
if this.flush2 then
TimerRestart(this._timer2)
return
end
local effect = AddSpecialEffectTarget("war3mapImported\\BigYellowOrbShield.mdx", this.unit, "chest")
local def, ant = this:get(1), this:get(2)
local hp = this:get(3) + this:get(4)
Def(this.unit, def)
Ant(this.unit, ant)
Recover(this.unit, hp)
this._timer2 = Wait(this:get("dur"),
function()
if this.flush2 then
this.flush2()
end
end
)
local func1 = Event("无法控制",
function(data)
if data.to == this.unit then
return true
end
end
)
if this._hp > 0 then
MaxLife(this.unit, - this._hp)
this._hp = 0
end
local func2
if this.research then
func2 = Reload("SetUnitState",
function(u, state, v)
if u == this.unit and state == UNIT_STATE_LIFE then
local hp = v
local mhp = GetUnitState(u, UNIT_STATE_MAX_LIFE)
local fhp = hp - mhp
if fhp > 0 then
fhp = math.ceil(fhp)
this._hp = this._hp + fhp
MaxLife(u, fhp)
end
end
SetUnitState(u, state, v)
end
)
end
this.flush2 = function()
DestroyEffect(effect)
Def(this.unit, - def)
Ant(this.unit, - ant)
Recover(this.unit, - hp)
Event("-无法控制", func1)
if func2 then
Reload("-SetUnitState", func2)
func2 = nil
end
this.flush2 = nil
end
--仅在失去技能时运行
this.flush3 = function()
if this._hp > 0 then
MaxLife(this.unit, - this._hp)
this._hp = 0
end
if func2 then
Reload("-SetUnitState", func2)
func2 = nil
end
end
end
elseif this.event == "获得技能" then
local func1 = Event("英雄技能回调",
function(data)
local that = data.skill
if that.unit == this.unit and that.name == "解放真名" and (that.event == "发动技能" or that.event == "关闭技能") then
this._change()
end
end
)
this._change = function()
this.tipname, this._tipname = this._tipname, this.tipname
this.art, this._art = this._art, this.art
this.ani, this._ani = this._ani, this.ani
this.mana, this._mana = this._mana, this.mana
this.cool, this._cool = this._cool, this.cool
this.dur, this._dur = this._dur, this.dur
this.tip, this._tip = this._tip, this.tip
this.data, this._data = this._data, this.data
SetSkillTip(this.unit, this.id)
SetLearnSkillTip(this.unit, this.id)
end
local that = findSkillData(this.unit, "解放真名")
if that and that.openflag then
this._change()
end
this._hp = 0
this._flush = function()
Event("-发动英雄技能后", func1)
if this.flush3 then
this.flush3()
end
end
elseif this.event == "失去技能" then
if this._flush then
this._flush()
end
end
end
}
--直感/剑舞
InitSkill{
name = "直感",
tipname = "直感",
_tipname = "剑舞",
type = {"主动"},
ani = nil,
_ani = "spell three",
art = {"BTNZG.blp"}, --左边是学习,右边是普通.不填右边视为左边
_art = {"BTNJW.blp"},
mana = 50,
_mana = nil,
cool = 15,
_cool = 15,
dur = 5,
_dur = nil,
cast = 0,
_cast = 0.01,
time = 0.001,
_time = 0.6,
area = {1000, 1500, 2000, 2500},
_area = 150,
tip = "\
|cffff00cc主动:|r探知附近的威胁,暂时获得大范围的空中视野.\
|cffff00cc被动:|r阿尔托莉亚的直感能力已经达到可以扭曲未来的程度,有几率使受到的伤害减少.\n\
|cff00ffcc技能|r: 无目标\n\
|cffffcc00扭曲几率|r: %s%%\
|cffffcc00伤害减少|r: %s(|cff1111ff+%.2f|r)%%",
researchtip = "直感:附近的敌方英雄离开视野后可以继续在大地图上看到,持续1秒.\n剑舞:第3剑附带攻击效果.",
data = {
{29, 36, 43, 50}, --扭曲几率1
{15, 20, 25, 30}, --伤害减少2
function(ap)
return ap * 0.1
end,
},
_tip = "\
依次斩出3剑,对前方一片区域内的单位造成伤害.第3剑会推动路径上的单位.\n\
|cff00ffcc技能|r: 无目标\n|cff00ffcc伤害|r: 物理\n\
|cffffcc00第1剑伤害|r: %s(|cffff1111+%d|r)\
|cffffcc00第2剑伤害|r: %s(|cffff1111+%d|r)\
|cffffcc00第3剑伤害|r: %s(|cffff1111+%d|r)\n\
|cff888888每斩出一剑后技能会进入%s秒的短暂冷却\n超过%s秒没有斩出下一剑技能将进入冷却\n第3剑的位移速度是移动速度的1.5倍可以穿越地形",
_data = {
{75, 125, 175, 225}, --第1剑 1 2
function(ap, ad)
return ad * 1.2
end,
{90, 150, 210, 270}, --第2剑 3 4
function(ap, ad)
return ad * 1.5
end,
{120, 200, 280, 360}, --第3剑 5 6
function(ap, ad)
return ad * 2
end,
0.4, --斩击间隔7
3, --斩击超时8
},
events = {"获得技能", "发动技能", "失去技能", "停止施放"},
code = function(this)
if this.event == "发动技能" then
if this.tipname == "直感" then
local effect = AddSpecialEffectTarget("DarkSummonSeal.mdx", this.unit, "origin")
local area = this:get("area")
local x, y = GetXY(this.unit)
local mr = CreateFogModifierRadius(this.player, FOG_OF_WAR_VISIBLE, x, y, area, true, false)
FogModifierStart(mr)
local dur = this:get("dur")
local time = 0
Loop(0.5,
function()
time = time + 0.5
DestroyFogModifier(mr)
if time < dur then
x, y = GetXY(this.unit)
mr = CreateFogModifierRadius(this.player, FOG_OF_WAR_VISIBLE, x, y, area, true, false)
FogModifierStart(mr)
else
EndLoop()
DestroyEffect(effect)
end
end
)
elseif this.tipname == "剑舞" then
--结束技能
this._func1 = function()
--技能进入冷却
if this._slash > 0 then
local ab = japi.EXGetUnitAbility(this.unit, this.id)
local cd = japi.EXGetAbilityState(ab, 1)
if cd > 0 then
UnitRemoveAbility(this.unit, this.id)
UnitAddAbility(this.unit, this.id)
end
local mcd = this:get("cool")
cd = this.targetcooltime - GetTime()
if cd > 0 then
Wait(0,
function()
SetSkillCool(this.unit, this.id, cd, mcd)
end
)
end
end
--重置数据
this.ani = "spell three"
this.time = 0.6
this._slash = 0
--清理数据
if this._timer then
DestroyTimer(this._timer)
this._timer = nil
end
end
--启动间隔
this._func2 = function()
--开始短暂间隔
this.freshcool = this:get(7)
--超时直接进入冷却
local timeout = this:get(8)
if not this._timer then
this._timer = CreateTimer()
end
TimerStart(this._timer, timeout, false, this._func1)
end
this._func3 = function()
if this._slashtimer then
DestroyTimer(this._slashtimer)
this._slashtimer = nil
end
if this._slashmover then
this._slashmover.stop = true
this._slashmover = nil
end
end
this._slash = this._slash + 1
local area = this:get("area")
if this._slash == 1 then
--第1剑
local d = this:get(1) + this:get(2)
this._slashtimer = Wait(0.3,
function()
this._slashtime = nil
local loc = MovePoint(this.unit, {area, GetUnitFacing(this.unit)})
forRange(loc, area,
function(u)
if EnemyFilter(this.player, u) then
SkillEffect{
from = this.unit,
to = u,
name = this.name,
data = this,
aoe = true,
code = function(data)
DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl", data.to, "chest"))
Damage(data.from, data.to, d, true, false, {aoe = true, damageReason = this.name})
end
}
end
end
)
TempEffect(loc, "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl")
SetSoundPosition(gg_snd_MetalHeavyChopFlesh1, loc[1], loc[2], 0)
StartSound(gg_snd_MetalHeavyChopFlesh1)
end
)
--激活短暂冷却
this._func2()
--为下一剑准备数据
this.ani = "spell two"
--记录冷却时间
this.targetcooltime = GetTime() + this:get("cool")
elseif this._slash == 2 then
--第2剑
local d = this:get(3) + this:get(4)
this._slashtimer = Wait(0.3,
function()
this._slashtimer = nil
local loc = MovePoint(this.unit, {area, GetUnitFacing(this.unit)})
forRange(loc, area,
function(u)
if EnemyFilter(this.player, u) then
SkillEffect{
from = this.unit,
to = u,
name = this.name,
data = this,
aoe = true,
code = function(data)
DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl", data.to, "chest"))
Damage(data.from, data.to, d, true, false, {aoe = true, damageReason = this.name})
end
}
end
end
)
TempEffect(loc, "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl")
SetSoundPosition(gg_snd_MetalHeavyChopFlesh2, loc[1], loc[2], 0)
StartSound(gg_snd_MetalHeavyChopFlesh2)
end
)
--激活短暂冷却
this._func2()
--为下一剑准备数据
this.ani = "spell one"
this.time = 1
SetSkillTip(this.unit, this.id)
elseif this._slash == 3 then
--第3剑
local d = this:get(5) + this:get(6)
local g = {} --保存推进单位组
this._slashmover = Mover(
{
unit = this.unit,
speed = GetUnitMoveSpeed(this.unit) * 1.5,
angle = GetUnitFacing(this.unit),
time = 0.5,
},
function(move)
if move.count % 5 == 1 then --每5个周期,即0.1秒判定一次
local loc = MovePoint(move.unit, {area, move.angle})
for u, t in pairs(g) do
SetUnitXY(u, MovePoint(loc, t))
end
forRange(loc, area,
function(u)
if not g[u] and EnemyFilter(this.player, u) then
g[u] = { --结构为 距离,角度
GetBetween(loc, u),
GetBetween(loc, u, true)
}
end
end
)
end
end,
function(move)
this._slashmover = nil
local loc = MovePoint(this.unit, {area, GetUnitFacing(this.unit)})
forRange(loc, area,
function(u)
if EnemyFilter(this.player, u) then
SkillEffect{
from = this.unit,
to = u,
name = this.name,
data = this,
aoe = true,
code = function(data)
DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl", data.to, "chest"))
Damage(data.from, data.to, d, true, false, {aoe = true, damageReason = this.name, attack = this.research})
end
}
end
end
)
TempEffect(loc, "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl")
SetSoundPosition(gg_snd_MetalHeavyChopFlesh3, loc[1], loc[2], 0)
StartSound(gg_snd_MetalHeavyChopFlesh3)
end
)
--结束技能
this._func1()
end
end
elseif this.event == "获得技能" then
local func1 = Event("伤害减免",
function(damage)
if damage.to == this.unit and this.tipname == "直感" then
if Random(this:get(1)) then
damage.damage = damage.damage - damage.odamage * (this:get(2) + this:get(3)) / 100
DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl", this.unit, "chest"))
end
end
end
)
local func2 = Event("英雄技能回调",
function(data)
local that = data.skill
if that.unit == this.unit and that.name == "解放真名" and (that.event == "发动技能" or that.event == "关闭技能") then
if that.event == "关闭技能" then
if this._func1 then
this._func1()
end
end
this._change()
end
end
)
local func3 = Event("可见度",
function(data)
if this.research and not data.reason and this.tipname == "直感" and IsHero(data.unit) and
IsUnitEnemy(data.unit, this.player) and GetBetween(this.unit, data.unit) < this:get("area") then
SeeUnit(data.unit)
Wait(1,
function()
SeeUnit(data.unit, false)
end
)
end
end
)
this._change = function()
this.tipname, this._tipname = this._tipname, this.tipname
this.art, this._art = this._art, this.art
this.ani, this._ani = this._ani, this.ani
this.cast, this._cast = this._cast, this.cast
this.time, this._time = this._time, this.time
this.mana, this._mana = this._mana, this.mana
this.cool, this._cool = this._cool, this.cool
this.area, this._area = this._area, this.area
this.dur, this._dur = this._dur, this.dur
this.tip, this._tip = this._tip, this.tip
this.data, this._data = this._data, this.data
SetSkillTip(this.unit, this.id)
SetLearnSkillTip(this.unit, this.id)
end
local that = findSkillData(this.unit, "解放真名")
if that and that.openflag then
this._change()
end
this._slash = 0 --斩击次数
this.flush = function()
Event("-伤害减免", func1)
Event("-英雄技能回调", func2)
Event("-可见度", func3)
if this.tipname == "剑舞" then
this._func1()
end
end
elseif this.event == "失去技能" then
if this.flush then
this.flush()
end
elseif this.event == "停止施放" then
if this._func3 then
this._func3()
end
end
end
}
--风王铁槌/誓约胜利之剑
InitSkill{
name = "风王铁槌",
tipname = "风王铁槌",
_tipname = "誓约胜利之剑",
type = {"开关", 2},
ani = "spell three",
_ani = "spell channel one",
art = {"BTNFWZC.blp", "BTNFWZC.blp", "BTNFWZC2.blp"},
_art = {"BTNSYSLZJ.blp", "BTNSYSLZJ.blp", "BTNSYSLZJ2.blp"},
cast = 0.1,
_cast = 0,
time = 1,
_time = 7,
mana = {150, 200, 250},
_mana = {200, 400, 600},
cool = 15,
_cool = 45,
area = 300,
_area = 350,
rng = 1500,
_rng = 1800,
dur = 1.5,
_dur = 5,
tip = "\
利用风王结界将压缩的风暴释放,对一条直线上的单位造成伤害并将他们向两边推开.使用后再次激活该技能将跟随风暴前进,但是技能冷却时间变为30秒.\n\
|cff00ffcc技能|r: 点目标\
|cff00ffcc伤害|r: 法术\n\
|cffffcc00造成伤害|r: %s(|cff1111ff+%d|r)\n\
|cff888888风暴飞行速度为%s\n再次激活技能的限制时间为%s秒\n跟随速度为风王铁槌的2倍",
researchtip = {
"风王铁槌的施法距离翻倍",
"移除誓约胜利之剑的冷却时间,但是无法提前施放",
"刷新其他技能的冷却时间",
},
data = {
{200, 400, 600}, --伤害 1 2
function(ap)
return ap * 2.5
end,
1000, --速度3
1.5, --限制时间4
},
_tip = "\
经过一段时间的能量积蓄后,对一条直线上的单位造成惊人的伤害,积蓄时间越长伤害越高.\n\
|cff00ffcc技能|r: 点目标\
|cff00ffcc伤害|r: 法术\n\
|cffffcc00最小积蓄时间|r: %s\
|cffffcc00最小伤害|r: %s(|cff1111ff+%d|r)\
|cffffcc00最大积蓄时间|r: %s\
|cffffcc00最大伤害|r: %s(|cff1111ff+%d|r)\n\
|cff888888通过再次激活该技能来提前施放\n伤害在2秒内分8次造成",
_data = {
2, --最小时间1
{200, 400, 600}, --最小伤害 2 3
function(ap)
return ap * 2.5
end,
5, --最大时间4
{600, 1200, 1800}, --最大伤害 5 6
function(ap)
return ap * 7.5
end,
},
events = {"发动技能", "关闭技能", "获得技能", "失去技能", "停止施放", "研发"},
code = function(this)
if this.event == "发动技能" then
if this.research[3] then
for i = 1, 3 do
local t = findSkillData(this.unit, i)
if t and t.targetcooltime then
t.targetcooltime = 0
end
SetSkillCool(this.unit, i, 0)
end
end
if this.tipname == "风王铁槌" then
local angle = GetBetween(this.unit, this.target, true)
local speed = this:get(3)
local distance = this:get("rng")
local g = {}
local d = this:get(1) + this:get(2)
local area = this:get("area")
local mod = {}
for i = 1, 8 do
mod[i] = CreateModle("Abilities\\Spells\\Other\\Tornado\\TornadoElementalSmall.mdl", MovePoint(this.unit, {area / 2, angle + 45 * i}), {size = 0.5})
end
StartSound("sound\\H013_R1.mp3", this.player)
local mover = Mover(
{
from = this.unit,
modle = "Abilities\\Spells\\NightElf\\Cyclone\\CycloneTarget.mdl",
size = 1.5,
speed = speed,
angle = angle,
distance = distance,
},
function(move)
angle = angle + 15
for i = 1, 8 do
SetUnitXY(mod[i], MovePoint(move.unit, {area / 2, angle + 45 * i}))
end
if move.count % 5 == 0 then --0.1秒判定一次
forRange(move.unit, area,
function(u)
if not g[u] and EnemyFilter(this.player, u) then
g[u] = true
Damage(move.from, u, d, false, true, {aoe = true, damageReason = this.name})
local a = GetBetween(move.unit, u, true) --中心到单位的角度
local dis = GetBetween(move.unit, u) --中心到单位的距离
local angle = move.angle
local pa = math.A2A(a, angle) --夹角
local pd = Sin(pa) * dis
if math.A2A(a, angle + 90) < math.A2A(a, angle - 90) then
a = angle + 90
else
a = angle - 90
end
Mover{
unit = u,
speed = 500,
angle = a,
distance = area - pd
}
end
end
)
end
end,
nil,
function(move)
for i = 1, 8 do
KillUnit(mod[i])
RemoveUnit(mod[i])
end
end
)
this.flush1 = function()
Wait(0.01,
function()
SetUnitAnimation(this.unit, "spell channel")
end
)
SetUnitFacing(this.unit, GetBetween(this.unit, mover.unit, true))
local effect = AddSpecialEffectTarget("BladeShockwave.mdl", this.unit, "chest")
Mover(
{
unit = this.unit,
speed = speed * 2,
target = mover.unit
},
nil,
nil,
function(move)
DestroyEffect(effect)
end
)
this.freshcool = 30
end
elseif this.tipname == "誓约胜利之剑" then
local effect = AddSpecialEffect("war3mapImported\\ex light.mdx", GetXY(this.unit))
local min = this:get(1)
if this.research[2] then
min = 5
this.freshcool = 0
end
SetSkillCool(this.unit, this.id, min, min) --激活2秒冷却(作为最小间隔)
local sound = StartSound("sound\\H013_R2.mp3", this.player)
Wait(1.5,
function()
StopSound(sound, true, false)
end
)
Wait(0,
function()
local ab = japi.EXGetUnitAbility(this.unit, this.id)
japi.EXSetAbilityDataReal(ab, 1, 108, 2) --手动关闭时会施法2秒
end
)
local angle = GetBetween(this.unit, this.target, true)
--预创建2个闪电效果
local l1 = Lightning{
from = this.unit,
name = 'LN04',
check = false,
x1 = 0,
y1 = 0,
z1 = 0,
x2 = 0,
y2 = 0,
z2 = 0,
color = {1, 1, 0, 0},
cut = false
}
--第2个闪电效果延迟0.25秒创建以保证流动纹路不同
local l2 = Lightning{
from = this.unit,
name = 'LN05',
check = false,
x1 = 0,
y1 = 0,
z1 = 0,
x2 = 0,
y2 = 0,
z2 = 0,
color = {1, 1, 1, 0},
cut = false
}
local d1 = this:get(2) + this:get(3)
local d2 = this:get(5) + this:get(6)
local t1 = this:get(1)
local t2 = this:get(4)
local area = this:get("area")
local opentime = this.spellflag
this.flush2 = function()
Wait(0.01,
function()
SetUnitAnimation(this.unit, "spell channel two")
end
)
local loc = GetUnitLoc(this.unit)
local sound = StartSound("sound\\H013_R2.mp3", this.player)
SetSoundPlayPosition(sound, 1500)
local t = GetTime() - opentime
local s = (t - t1) / (t2 - t1)
local d = d1 + (d2 - d1) * s
d = d / 8
local x1, y1, z1 = loc[1], loc[2], GetZ(loc) + 200
local target = MovePoint(loc, {this:get("rng"), angle})
local x2, y2, z2 = target[1], target[2], z1
local targetmod = CreateModle("Abilities\\Spells\\Demon\\ReviveDemon\\ReviveDemon.mdl", target, {time = 2, angle = angle, size = 2, z = z2})
local mods = {}
ForLoop(0.2, 1, 3,
function(count)
if count == 1 then
mods[4] = CreateUnitAtLoc(this.player, |e00K|, loc, angle)
end
mods[count] = CreateUnitAtLoc(this.player, |e034|, loc, angle)
end
)
Wait(3,
function()
for i = 1, 4 do
KillUnit(mods[count])
end
end
)
l1.x1, l1.y1, l1.z1 = x1, y1, z1
l1.cut = true
l2.x1, l2.y1, l2.z1 = x1, y1, z1
ForLoop(0.05, 1, 40,
function(i)
local a = 1
if i < 11 then
a = i * 0.1
elseif i > 29 then
a = (40 - i) * 0.1
end
l1.color[4] = a
l1.x2, l1.y2, l1.z2 = x2, y2, z2
ChangeLightning(l1)
l2.color[4] = a
l2.x2, l2.y2, l2.z2 = l1.x2, l1.y2, l1.z2
ChangeLightning(l2)
if i % 5 == 0 then
forSeg(loc, {l1.x2, l1.y2}, area,
function(u)
if EnemyFilter(this.player, u) then
SkillEffect{
from = this.unit,
to = u,
name = this.name,
data = this,
aoe = true,
code = function(data)
DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\StaffOfPurification\\PurificationTarget.mdl", data.to, "origin"))
Damage(data.from, data.to, d, false, true, {aoe = true, damageReason = this.name})
end
}
end
end
)
end
if i == 40 then
this.flush3()
end
end
)
end
this.flush3 = function()
DestroyEffect(effect)
if l1 then
DestroyLightning(l1.l)
end
if l2 then
DestroyLightning(l2.l)
end
l1 = nil
l2 = nil
end
end
elseif this.event == "关闭技能" then
if this.tipname == "风王铁槌" then
if this.closereason == "手动关闭" then
--玩家主动关闭技能
this.flush1()
end
elseif this.tipname == "誓约胜利之剑" then
if this.closereason == "持续时间" or this.closereason == "手动关闭" then
this.flush2()
else
UnitRemoveAbility(this.unit, this.id)
UnitAddAbility(this.unit, this.id)
this.flush3()
end
end
elseif this.event == "停止施放" then
if this.openflag and this.tipname == "誓约胜利之剑" then
Wait(0,
function()
this:closeskill()
end
)
end
elseif this.event == "获得技能" then
this._change = function()
this.tipname, this._tipname = this._tipname, this.tipname
this.art, this._art = this._art, this.art
this.ani, this._ani = this._ani, this.ani
this.cast, this._cast = this._cast, this.cast
this.time, this._time = this._time, this.time
this.mana, this._mana = this._mana, this.mana
this.cool, this._cool = this._cool, this.cool
this.area, this._area = this._area, this.area
this.dur, this._dur = this._dur, this.dur
this.rng, this._rng = this._rng, this.rng
this.tip, this._tip = this._tip, this.tip
this.data, this._data = this._data, this.data
SetSkillTip(this.unit, this.id)
SetLearnSkillTip(this.unit, this.id)
end
local that = findSkillData(this.unit, "解放真名")
if that and that.openflag then
this._change()
end
local func1 = Event("英雄技能回调",
function(data)
local that = data.skill
if that.unit == this.unit and that.name == "解放真名" and (that.event == "发动技能" or that.event == "关闭技能") then
Wait(0,
function()
this._change()
end
)
if this.openflag and this.tipname == "风王铁槌" then
this:closeskill()
end
end
end
)
this.flush = function()
Event("-发动英雄技能后", func1)
end
elseif this.event == "失去技能" then
if this.flush then
this.flush()
end
elseif this.event == "研发" then
if this.lastResearch == 1 then
if this.tipname == "风王铁槌" then
this.rng = this.rng * 2
SetSkillTip(this.unit, this.id)
SetLearnSkillTip(this.unit, this.id)
else
this._rng = this._rng * 2
end
end
end
end
}
|
local chat = require('core.chat')
local command = require('core.command')
local event = require('core.event')
local math = require('math')
local channel = require('core.channel')
local server = require('shared.server')
local string = require('string')
local struct = require('struct')
local table = require('table')
query_server = channel.new('query')
local query_result = {}
query_server.env = {}
query_server.env.query_response = function(path, setting)
query_result.path = path
query_result.setting = setting
end
local data = server.new(struct.struct({
get = {data = event.new()},
set = {data = event.new()},
}))
local math_max = math.max
local string_rep = string.rep
local table_sort = table.sort
local flatten
flatten = function(t, prefix)
local values = {}
local count = 0
for key, value in pairs(t) do
if type(value) == 'table' then
local flattened = flatten(value, prefix .. '.' .. key)
for i = 1, #flattened do
local flattened_value = flattened[i]
count = count + 1
values[count] = {path = flattened_value.path, setting = flattened_value.setting}
end
else
count = count + 1
values[count] = {path = prefix .. '.' .. key, setting = value}
end
end
return values
end
local print_setting = function(source, path, setting)
local values = type(setting) == 'table' and flatten(setting, path) or {{path = path, setting = setting}}
table_sort(values, function(v1, v2)
return v1.path < v2.path
end)
if source == 'console' then
local max_length = 0
for i = 1, #values do
max_length = math_max(max_length, #values[i].path)
end
print('Settings:')
for i = 1, #values do
local value = values[i]
print(' ' .. value.path .. string_rep(' ', max_length - #value.path + 2) .. tostring(value.setting))
end
else
chat.add_text('Settings:')
for i = 1, #values do
local value = values[i]
chat.add_text('> ' .. value.path .. ': ' .. tostring(value.setting))
end
end
end
local settings_command = command.new('settings')
local get = function(source, addon, path, id)
data.get:trigger(addon, path, id)
print_setting(source, query_result.path, query_result.setting)
end
local set = function(source, addon, path, value, id)
data.set:trigger(addon, path, value, id)
print_setting(source, query_result.path, query_result.setting)
end
settings_command:register_source('get', get, '<addon:string> <path:string> [id:string]')
settings_command:register_source('set', set, '<addon:string> <path:string> <value:string> [id:string]')
--[[
Copyright © 2019, Windower Dev Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Windower Dev Team nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE WINDOWER DEV TEAM BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
|
BLACK_EXPORT_START_RATIO = 10;
BLACK_EXPORT_ABORT_RATIO = 6;
BLACK_EXPORT_PRIZE = math.random (10000, 15000);
blackexport = {
vehicles = {},
lastid = 0,
location = 0,
locations = {},
marker_location = {1664.06, 713.35, 9.82},
};
addEventHandler ("onResourceStart", resourceRoot,
function ()
for i, v in ipairs (xmlNodeGetChildren (xmlLoadFile("vehicles.xml"))) do
local id = xmlNodeGetAttribute(v, "id");
local name = xmlNodeGetAttribute(v, "name");
table.insert (blackexport.vehicles, {id = id, name = name});
end
for i, v in ipairs (getElementsByType"black_export_spawn_points") do
local x, y, z = getElementPosition (v);
local _, _, rot = getElementRotation (v);
table.insert (blackexport.locations,
{x, y, z, rot}
)
end
end
);
local function blackexport_abort ()
if isBlackExportVehicle (source) then
blackexport.abort(_, false);
end
end
local function blackexport_winner (element, dim)
if isElement (element) and dim and getElementType (element) == "vehicle" and isBlackExportVehicle (element) then
blackexport.abort(getVehicleController (element), true);
end
end
local function blackexport_jacked (player, seat, jackedFrom)
if isElement (blackexport.vehblip) then
setElementVisibleTo (blackexport.vehblip, root, true);
end
if jackedFrom then
exports.mtatr_hud:dmn (player:getName().. ", "..jackedFrom:getName().. " adlı oyuncudan aracı çaldı.");
else
exports.mtatr_hud:dmn (player:getName().. " black export aracını aldı! Bitiş noktasına yetişmeden aracı al, ödülü kap!");
end
end
local function blackexport_exit (player, _, jacker)
if isElement (blackexport.vehblip) then
setElementVisibleTo (blackexport.vehblip, root, false);
end
end
function blackexport.abort (responsible_element, won)
if isElement (blackexport.vehicle) then
removeEventHandler ("onVehicleEnter", blackexport.vehicle, blackexport_jacked);
removeEventHandler ("onVehicleExit", blackexport.vehicle, blackexport_exit);
removeEventHandler ("onVehicleExplode", blackexport.vehicle, blackexport_abort);
blackexport.vehicle:destroy();
end
if isTimer (blackexport.aborttimer) then
killTimer (blackexport.aborttimer);
end
if isElement (blackexport.marker) then
removeEventHandler ("onMarkerHit", blackexport.marker, blackexport_winner);
blackexport.marker:destroy();
end
if isElement (blackexport.blip) then
blackexport.blip:destroy();
end
if isElement (blackexport.indicator) then
blackexport.indicator:destroy();
end
if isElement (blackexport.vehblip) then
blackexport.vehblip:destroy();
end
if responsible_element and won == true then
exports.mtatr_hud:dmn ("Black export bitti. "..responsible_element:getName().." aracı bulup teslim etmeyi başardı.", root);
exports.database:givePlayerMoney (responsible_element, BLACK_EXPORT_PRIZE, "Black Export");
elseif won == false then
exports.mtatr_hud:dmn ("Black export bitti. Araç yok edildi.", root);
else
exports.mtatr_hud:dmn ("Black export bitti. Kimse aracı bulamadı.", root);
end
triggerClientEvent (root, "blackexport.getvehicle", resourceRoot);
triggerEvent ("onMissionFinished", resourceRoot, "Black Export");
end
function stopBlackExport ()
blackexport.abort();
end
function blackexport.start (force)
BLACK_EXPORT_PRIZE = math.random (10000, 15000);
local id, location;
repeat
id = math.random(#blackexport.vehicles);
location = blackexport.locations[math.random(#blackexport.locations)];
until id ~= lastid and location ~= blackexport.location;
blackexport.lastid, blackexport.location = id, location;
local veh = blackexport.vehicles[id].id;
local name = blackexport.vehicles[id].name;
local x, y, z, rot = unpack (location);
blackexport.vehicle = createVehicle (veh, x, y, z, 0, 0, rot, "MTA-TR.com");
addEventHandler ("onVehicleExplode", blackexport.vehicle, blackexport_abort);
addEventHandler ("onVehicleEnter", blackexport.vehicle, blackexport_jacked);
addEventHandler ("onVehicleExit", blackexport.vehicle, blackexport_exit);
blackexport.indicator = createMarker (x, y, z, "arrow", .8, 45, 207, 255, 100);
attachElements (blackexport.indicator, blackexport.vehicle, 0, -.2, 1.5);
local mx, my, mz = unpack (blackexport.marker_location);
blackexport.marker = createMarker (mx, my, mz, "cylinder", 7.0, 20, 251, 213, 125);
blackexport.blip = createBlip (mx, my, mz, 11);
addEventHandler ("onMarkerHit", blackexport.marker, blackexport_winner);
if not force then
triggerClientEvent (root, "blackexport.getvehicle", resourceRoot, name, BLACK_EXPORT_ABORT_RATIO * 60 * 1000);
end
blackexport.vehblip = createBlipAttachedTo (blackexport.vehicle, 41);
exports.mtatr_utils:flashBlip (blackexport.vehblip, true);
outputChatBox ("Black export başladı. "..name.." aracını bulup sarı buldozere getiren ilk kişi "..BLACK_EXPORT_PRIZE.."₺ kazanacak." , root, 255, 102, 0);
return true;
end
function startBlackExport (arg)
return blackexport.start (arg);
end
addEvent ("blackexport.getvehicle", true)
addEventHandler ("blackexport.getvehicle", root,
function ()
if isElement (blackexport.vehicle) then
local name = getVehicleName (blackexport.vehicle);
local time = exports.mtatr_engines:getMissionTimerDetails("Black Export");
triggerClientEvent (client, "blackexport.getvehicle", resourceRoot, name, time)
end
end
);
addEvent ("onPlayerCharacterLogin");
addEventHandler ("onPlayerCharacterLogin", root,
function ()
if isElement (blackexport.vehblip) then
exports.mtatr_utils:flashBlip (blackexport.vehblip, true, source);
end
end
);
function isBlackExportVehicle (vehicle)
return vehicle == blackexport.vehicle;
end
|
--Automatically generated by SWGEmu Spawn Tool v0.12 loot editor.
polearm_staff_wood_reinforced = {
minimumLevel = 0,
maximumLevel = -1,
customObjectName = "",
directObjectTemplate = "object/weapon/melee/polearm/lance_staff_wood_s2.iff",
craftingValues = {
{"mindamage",41,52,0},
{"maxdamage",86,111,0},
{"attackspeed",5.8,4,1},
{"woundchance",7,7,0},
{"hitpoints",750,1500,0},
{"zerorangemod",7,17,0},
{"maxrangemod",7,17,0},
{"midrange",3,3,0},
{"midrangemod",7,17,0},
{"maxrange",7,7,0},
{"attackhealthcost",20,14,0},
{"attackactioncost",38,27,0},
{"attackmindcost",15,11,0},
},
customizationStringNames = {},
customizationValues = {},
-- randomDotChance: The chance of this weapon object dropping with a random dot on it. Higher number means less chance. Set to 0 to always have a random dot.
randomDotChance = 500,
junkDealerTypeNeeded = JUNKARMS,
junkMinValue = 25,
junkMaxValue = 45
}
addLootItemTemplate("polearm_staff_wood_reinforced", polearm_staff_wood_reinforced)
|
-- Copyright (c) 2021 Trevor Redfern
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
describe("moonpie.redux.createSlice", function()
local store = require "moonpie.redux.store"
local createSlice = require "moonpie.redux.create_slice"
it("takes a table and creates a function for the reducer", function()
local test = {
action_1 = function(state, action) return { v = state.v + action.payload } end,
action_2 = function(state, action) return { v = state.v - action.payload } end
}
store.createStore(createSlice(test), { v = 0 })
store.dispatch({ type = "action_1", payload = 1 })
local s = store.getState()
assert.equals(1, s.v)
store.dispatch { type = "action_2", payload = -2 }
s = store.getState()
assert.equals(3, s.v)
end)
it("returns the state back if the action is not in the list", function()
local state = {}
local test = {}
store.createStore(createSlice(test), state)
store.dispatch({ type = "some_action" })
assert.equals(state, store.getState())
end)
it("can specify an initial state and the store is configured with that state", function()
local slice = createSlice {
initialState = function()
return {
v = 1, x = 2, b = "hello"
}
end
}
store.createStore(slice)
local state = store.getState()
assert.equals(1, state.v)
assert.equals(2, state.x)
assert.equals("hello", state.b)
end)
it("works with combine reducers to specify complex initial states", function()
local combine_reducers = require "moonpie.redux.combine_reducers"
local slice1 = createSlice {
initialState = function() return { v = 3 } end
}
local slice2 = createSlice {
initialState = function() return { v = 6 } end
}
store.createStore(combine_reducers {
slice1 = slice1,
slice2 = slice2
})
local state = store.getState()
assert.equals(3, state.slice1.v)
assert.equals(6, state.slice2.v)
end)
it("uses an empty table for initial state if nothing is specified for state", function()
local combineReducers = require "moonpie.redux.combine_reducers"
local slice = createSlice {}
store.createStore(combineReducers { slice = slice })
assert.same({}, store.getState().slice)
end)
end)
|
local tl = require("tl")
local util = require("spec.util")
describe("tl.pretty_print_ast", function()
it("returns error for <close> attribute on non 5.4 target", function()
local input = [[local x <close> = io.open("foobar", "r")]]
local result = tl.process_string(input, false, tl.init_env(false, "off", "5.4"), "foo.tl")
local output, err = tl.pretty_print_ast(result.ast, "5.3")
assert.is_nil(output)
assert.same({}, result.type_errors)
assert.is_not_nil(result.gen_error)
assert.match(result.gen_error, "<close> attribute")
end)
end)
|
function handleYARM(site)
gauge_yarm_site_amount:set(site.amount, {site.force_name, site.site_name, site.ore_type})
gauge_yarm_site_ore_per_minute:set(site.ore_per_minute, {site.force_name, site.site_name, site.ore_type})
gauge_yarm_site_remaining_permille:set(site.remaining_permille, {site.force_name, site.site_name, site.ore_type})
end
|
-- module describing business system (company, money laundering)
local cfg = module("cfg/business")
vRP.prepare("vRP/create_business","INSERT IGNORE INTO vrp_user_business(user_id,name,description,capital,laundered,reset_timestamp) VALUES(@user_id,@name,'',@capital,0,@time)")
vRP.prepare("vRP/delete_business","DELETE FROM vrp_user_business WHERE user_id = @user_id")
vRP.prepare("vRP/get_business","SELECT name,description,capital,laundered,reset_timestamp FROM vrp_user_business WHERE user_id = @user_id")
vRP.prepare("vRP/add_capital","UPDATE vrp_user_business SET capital = capital + @capital WHERE user_id = @user_id")
vRP.prepare("vRP/add_laundered","UPDATE vrp_user_business SET laundered = laundered + @laundered WHERE user_id = @user_id")
vRP.prepare("vRP/get_business_page","SELECT user_id,name,description,capital FROM vrp_user_business ORDER BY capital DESC LIMIT @b,@n")
vRP.prepare("vRP/reset_transfer","UPDATE vrp_user_business SET laundered = 0, reset_timestamp = @time WHERE user_id = @user_id")
-- api
-- return user business data or nil
function vRP.getUserBusiness(user_id, cbr)
if user_id then
local rows = vRP.query("vRP/get_business", {user_id = user_id})
local business = rows[1]
-- when a business is fetched from the database, check for update of the laundered capital transfer capacity
if business and os.time() >= business.reset_timestamp+cfg.transfer_reset_interval*60 then
vRP.execute("vRP/reset_transfer", {user_id = user_id, time = os.time()})
business.laundered = 0
end
return business
end
end
-- close the business of an user
function vRP.closeBusiness(user_id)
vRP.execute("vRP/delete_business", {user_id = user_id})
end
|
net.Receive( "acfm_versionresponse", function( len, ply )
local response = net.ReadTable()
local inDate = response.IsLatest
local lastUpdate = response.LatestDate
if inDate == nil then return end
if not inDate then
if lastUpdate then
chat.AddText(Color(255,0,0), "A newer version of ACF Supreme is available! (last updated ", Color(255, 128, 0), os.date("%x", lastUpdate) , Color(255, 0, 0), ")")
else
chat.AddText(Color(255,0,0), "A newer version of ACF Supreme is available!")
end
chat.AddText(Color(255,0,0), "Update this server to the latest version at ", Color(255, 128, 0), "https://github.com/Adripain/ACF-Supreme")
else
chat.AddText(Color(0,255,64), "ACF Supreme", Color(0, 192, 42), "is up to date on this server!")
end
end )
function ACF_Missiles_VersionCheck()
net.Start("acfm_versioncheck")
net.SendToServer()
end
hook.Add( "CreateMove", "acfm_versioncheck", function(move)
if move:GetButtons() == 0 then return end
hook.Remove("CreateMove", "acfm_versioncheck")
timer.Simple(1, ACF_Missiles_VersionCheck)
end )
|
local bit = require 'bit'
local ffi = require 'ffi'
local mswin = require 'exports.mswindows'
local winstr = require 'exports.mswindows.strings'
local winfiles = require 'exports.mswindows.filesystem'
local winhandles = require 'exports.mswindows.handles'
local on_wait_object_signal = require 'radish.mswindows.on_wait_object_signal'
local on_update = require 'radish.mswindows.on_update'
local sqlite3 = require 'exports.sqlite3'; require 'exports.sqlite3.methods'
local filewatching = {}
local function sweep_aux(path)
local search = winfiles.dir( path )
if search == nil or winhandles.is_invalid( search.handle ) then
return 'invalid'
end
coroutine.yield('start', path)
repeat
local type, name = search:peek()
if type == 'file' then
local size = search:get_size()
local last_modified = search:get_when_last_modified()
if coroutine.yield('file', path, name, size, last_modified) == 'stop' then
search:destroy()
return 'stop'
end
elseif type == 'folder' and name ~= '.' and name ~= '..' then
if sweep_aux(path .. '/' .. name) == 'stop' then
search:destroy()
return 'stop'
end
end
until search:move_next() == false
coroutine.yield('end', path)
end
local function sweep_stepper_coroproc(path)
coroutine.yield()
while true do
local result = sweep_aux(path)
if result == 'invalid' then
error('invalid path: ' .. path)
elseif result == 'stop' then
break
end
end
end
function filewatching.make_sweep_stepper(path)
local x = coroutine.wrap(sweep_stepper_coroproc)
x(path)
return x
end
function filewatching.stop_sweep_stepper(stepper)
stepper('stop')
end
local function full_sweep_coroproc(path)
coroutine.yield()
local result = sweep_aux(path)
if result == 'invalid' then
error('invalid path: ' .. path)
end
end
function filewatching.full_sweep(path)
local x = coroutine.wrap(full_sweep_coroproc)
x(path)
return x
end
local function add_change_notifier(path, recursively, callback)
local universe_folder_change_notifier = mswin.FindFirstChangeNotificationW(
winstr.wide(path),
recursively,
bit.bor(
mswin.FILE_NOTIFY_CHANGE_FILE_NAME,
mswin.FILE_NOTIFY_CHANGE_DIR_NAME,
mswin.FILE_NOTIFY_CHANGE_SIZE,
mswin.FILE_NOTIFY_CHANGE_LAST_WRITE))
if universe_folder_change_notifier == nil
or winhandles.is_invalid(universe_folder_change_notifier) then
return false
end
on_wait_object_signal:add(universe_folder_change_notifier, function(handle)
if callback() == 'stop' then
return 'remove'
end
if mswin.FindNextChangeNotification(handle) == false then
add_change_notifier(path, recursively, callback)
return 'remove'
end
end)
return true
end
function filewatching.on_new(path)
end
function filewatching.on_modified(path)
end
function filewatching.on_deleted(path)
end
local suspended = false
function filewatching.suspend()
suspended = true
end
function filewatching.resume()
suspended = false
end
function filewatching.begin(path, task_worker)
assert( winfiles.ensure_folder('undo_history'), 'unable to create undo_history folder' )
local db do
local out_db = ffi.new 'sqlite3*[1]'
local create_result = sqlite3.sqlite3_open('undo_history/changes.db', out_db)
assert(create_result == sqlite3.SQLITE_OK, 'unable to create changes.db')
db = out_db[0]
--ffi.gc(db, sqlite3.sqlite3_close_v2)
end
local function exec(sql)
assert(db:exec(sql, nil, nil, nil) == sqlite3.SQLITE_OK, 'failed to setup changes.db')
end
exec [[
CREATE TABLE IF NOT EXISTS path_change (
id INTEGER PRIMARY KEY AUTOINCREMENT,
folder TEXT NOT NULL,
filename TEXT NULL,
mode TEXT CHECK( mode IN ('new', 'mod', 'del') ),
recorded_at TEXT,
last_modified TEXT,
size INTEGER
);
CREATE INDEX IF NOT EXISTS path_change_by_path ON path_change(folder, filename);
CREATE TABLE IF NOT EXISTS change_same_data (
copy_id INTEGER NOT NULL,
original_id INTEGER NOT NULL,
FOREIGN KEY (copy_id) REFERENCES path_change(id),
FOREIGN KEY (original_id) REFERENCES path_change(id)
);
CREATE UNIQUE INDEX IF NOT EXISTS same_data_by_copy_id ON change_same_data(copy_id);
CREATE VIEW IF NOT EXISTS path_current
AS
SELECT
id, folder, filename, mode, recorded_at, last_modified, size,
CASE
WHEN size IS NULL or size = 0 THEN NULL
ELSE COALESCE(
(SELECT csd.original_id
FROM change_same_data csd
WHERE csd.copy_id = pc1.id),
pc1.id)
END AS data_id
FROM path_change pc1
WHERE mode IN ('new', 'mod') AND NOT EXISTS (
SELECT 1 FROM path_change pc2
WHERE pc2.id > pc1.id
AND pc2.folder = pc1.folder
AND pc2.filename = pc1.filename);
CREATE VIEW IF NOT EXISTS change_with_original_data
AS
SELECT id, folder, filename, mode, recorded_at, last_modified, size
FROM path_change pc
WHERE size IS NOT NULL AND size > 0 AND NOT EXISTS (
SELECT 1 FROM change_same_data WHERE copy_id = pc.id);
CREATE TABLE IF NOT EXISTS temp.path_current (
folder TEXT,
filename TEXT,
recorded_at TEXT,
last_modified TEXT,
size INTEGER
);
]]
local out_stmt = ffi.new 'sqlite3_stmt*[1]'
local function stmt(sql)
local prepare_result = db:prepare_v2(sql, #sql + 1, out_stmt, nil)
assert(prepare_result == sqlite3.SQLITE_OK, 'unable to prepare statement')
local stmt = out_stmt[0]
--ffi.gc(stmt, sqlite3.sqlite3_finalize)
return stmt
end
local function textcol(stmt, i)
local v = stmt:column_text(i)
if v == nil then
return nil
end
return ffi.string(v, stmt:column_bytes(i))
end
local function bindtext(stmt, i, str)
if str == nil then
return stmt:bind_null(i)
else
return stmt:bind_text(i, str, #str, nil)
end
end
-- args: folder, filename, last_modified, size
local insert_stmt = stmt [[
INSERT INTO temp.path_current (folder, filename, recorded_at, last_modified, size)
VALUES (?, ?, strftime('%Y-%m-%dT%H:%M:%SZ', 'now', 'utc'), ?, ?)
]]
-- args: folder, filename, mode, recorded_at, last_modified, size
-- when mode is 'del', last_modified & size are NULL
local record_change_stmt = stmt [[
INSERT INTO main.path_change (folder, filename, mode, recorded_at, last_modified, size)
VALUES (?, ?, ?, ?, ?, ?)
]]
-- args: folder (NULL for all)
local clear_stmt = stmt [[
DELETE FROM temp.path_current
WHERE (?1 IS NULL) OR (folder = ?1)
]]
-- args: folder (NULL for all)
local each_new_change_stmt = stmt [[
SELECT
mpc.folder,
mpc.filename,
'del' AS mode,
strftime('%Y-%m-%dT%H:%M:%SZ', 'now', 'utc') AS recorded_at,
NULL AS last_modified,
NULL AS size
FROM main.path_current mpc
WHERE ((?1 IS NULL) OR (mpc.folder = ?1)) AND NOT EXISTS (
SELECT 1 FROM temp.path_current tpc
WHERE (tpc.folder = mpc.folder) AND (tpc.filename = mpc.filename))
UNION ALL
SELECT
tpc.folder,
tpc.filename,
'new' AS mode,
tpc.recorded_at,
tpc.last_modified,
tpc.size
FROM temp.path_current tpc
WHERE ((?1 IS NULL) OR (tpc.folder = ?1)) AND NOT EXISTS (
SELECT 1 FROM main.path_current mpc
WHERE (mpc.folder = tpc.folder) AND (mpc.filename = tpc.filename))
UNION ALL
SELECT
tpc.folder,
tpc.filename,
'mod' AS mode,
tpc.recorded_at,
tpc.last_modified,
tpc.size
FROM temp.path_current tpc
INNER JOIN main.path_current mpc
ON (tpc.folder = mpc.folder) AND (mpc.filename = tpc.filename)
WHERE (tpc.size != mpc.size) OR (tpc.last_modified != mpc.last_modified)
]]
-- args: size
local each_same_size_stmt = stmt [[
SELECT id FROM change_with_original_data WHERE size = ?
]]
-- args: original_id, copy_id
local add_copy_stmt = stmt [[
INSERT INTO change_same_data (original_id, copy_id) VALUES (?, ?)
]]
local sweep_step, sweep_update
local function do_sweep()
if sweep_step ~= nil then
filewatching.stop_sweep_stepper(sweep_step)
sweep_step = nil
end
if sweep_update ~= nil then
on_update.kill(sweep_update)
sweep_update = nil
end
local count = 0
local function flush_changes(folder)
if folder == nil then
assert( sqlite3.SQLITE_OK == each_new_change_stmt:bind_null(1) )
else
assert( sqlite3.SQLITE_OK == each_new_change_stmt:bind_text(1, folder, #folder, nil) )
end
while true do
local step_result = each_new_change_stmt:step()
if step_result == sqlite3.SQLITE_DONE then
break
elseif step_result ~= sqlite3.SQLITE_ROW then
error('error fetching each_new_change_stmt row')
end
for i = 1, 6 do
assert( sqlite3.SQLITE_OK == record_change_stmt:bind_value(
i, each_new_change_stmt:column_value(i - 1)) )
end
assert( sqlite3.SQLITE_DONE == record_change_stmt:step() )
assert( sqlite3.SQLITE_OK == record_change_stmt:reset() )
local folder = textcol(each_new_change_stmt, 0)
local filename = textcol(each_new_change_stmt, 1)
local mode = textcol(each_new_change_stmt, 2)
if (mode == 'mod' or mode == 'new')
and each_new_change_stmt:column_type(5) == sqlite3.SQLITE_INTEGER
and winfiles.ensure_folder('undo_history/data') then
local size = each_new_change_stmt:column_int64(5)
if size > 0 then
local self_id = db:last_insert_rowid()
local copy_from_id
assert( sqlite3.SQLITE_OK == each_same_size_stmt:bind_int64(1, size) )
while sqlite3.SQLITE_ROW == each_same_size_stmt:step() do
local id = each_same_size_stmt:column_int64(0)
local data_path = 'undo_history/data/' .. tostring(id):gsub('LL$', '')
if winfiles.same_contents(folder..'/'..filename, data_path) then
copy_from_id = id
break
end
end
assert( sqlite3.SQLITE_OK == each_same_size_stmt:reset() )
if copy_from_id == nil then
local data_path = 'undo_history/data/' .. tostring(self_id):gsub('LL$', '')
task_worker:send_command(
'copy_file',
folder..'/'..filename,
data_path,
self_id)
else
assert( sqlite3.SQLITE_OK == add_copy_stmt:bind_int64(1, copy_from_id) )
assert( sqlite3.SQLITE_OK == add_copy_stmt:bind_int64(2, self_id) )
assert( sqlite3.SQLITE_DONE == add_copy_stmt:step() )
assert( sqlite3.SQLITE_OK == add_copy_stmt:reset() )
end
end
end
if mode == 'mod' then
filewatching.on_modified(folder..'/'..filename)
elseif mode == 'new' then
filewatching.on_new(folder..'/'..filename)
elseif mode == 'del' then
filewatching.on_deleted(folder..'/'..filename)
end
end
assert( sqlite3.SQLITE_OK == each_new_change_stmt:reset() )
if folder == nil then
assert( sqlite3.SQLITE_OK == clear_stmt:bind_null(1) )
else
assert( sqlite3.SQLITE_OK == clear_stmt:bind_text(1, folder, #folder, nil) )
end
assert( sqlite3.SQLITE_DONE == clear_stmt:step() )
assert( sqlite3.SQLITE_OK == clear_stmt:reset() )
end
exec [[ BEGIN TRANSACTION ]]
assert( sqlite3.SQLITE_OK == clear_stmt:bind_null(1) )
assert( sqlite3.SQLITE_DONE == clear_stmt:step() )
assert( sqlite3.SQLITE_OK == clear_stmt:reset() )
for mode, folder, filename, size, last_modified in filewatching.full_sweep('universe') do
count = count + 1
if mode == 'file' then
assert( sqlite3.SQLITE_OK == bindtext(insert_stmt, 1, folder) )
assert( sqlite3.SQLITE_OK == bindtext(insert_stmt, 2, filename) )
assert( sqlite3.SQLITE_OK == bindtext(insert_stmt, 3, last_modified) )
assert( sqlite3.SQLITE_OK == insert_stmt:bind_int64(4, size) )
assert( sqlite3.SQLITE_DONE == insert_stmt:step() )
assert( sqlite3.SQLITE_OK == insert_stmt:reset() )
elseif mode == 'end' then
flush_changes(folder)
end
end
exec [[ COMMIT TRANSACTION ]]
-- update 5 times a second
local step_hz = 5
local step_ms = 1000 / step_hz
-- aim to cover all in about 5 seconds, to a maximum of 500/second
local step_count = math.max(1, math.min(100, math.floor(count / (step_hz * 5))))
sweep_step = assert(filewatching.make_sweep_stepper('universe'))
sweep_update = on_update.after(1000, function(pause)
while true do
exec [[ BEGIN TRANSACTION ]]
for i = 1, step_count do
local type, folder, filename, size, last_modified = sweep_step()
if type == 'file' then
assert( sqlite3.SQLITE_OK == insert_stmt:bind_text(1, folder, #folder, nil) )
assert( sqlite3.SQLITE_OK == insert_stmt:bind_text(2, filename, #filename, nil) )
assert( sqlite3.SQLITE_OK == insert_stmt:bind_text(3, last_modified, #last_modified, nil) )
assert( sqlite3.SQLITE_OK == insert_stmt:bind_int64(4, size) )
assert( sqlite3.SQLITE_DONE == insert_stmt:step() )
assert( sqlite3.SQLITE_OK == insert_stmt:reset() )
elseif type == 'end' then
flush_changes(folder)
end
end
exec [[ COMMIT TRANSACTION ]]
pause(step_ms)
end
end)
end
do_sweep()
local filenotify_update
add_change_notifier('universe', true, function()
if suspended then
-- ignore changes while filewatching is suspended
return
end
if sweep_update ~= nil then
on_update.kill(sweep_update)
sweep_update = nil
end
if sweep_step ~= nil then
filewatching.stop_sweep_stepper(sweep_step)
sweep_step = nil
end
if filenotify_update ~= nil then
on_update.kill(filenotify_update)
filenotify_update = nil
end
filenotify_update = on_update.after(150, do_sweep)
end)
end
return filewatching
|
describe("utils", function()
local utils = require "nvim-test.utils"
it("find file by patterns", function()
assert.is.equal(
"spec/fixtures/js/name.test.js",
utils.find_file_by_patterns(
"spec/fixtures/js/name.js",
{ "{name}.spec.{ext}", "{name}.test.{ext}" }
)
)
assert.is.equal(
"spec/fixtures/js/unknown.js",
utils.find_file_by_patterns(
"spec/fixtures/js/unknown.js",
{ "{name}.spec.{ext}", "{name}.test.{ext}" }
)
)
assert.is.equal(
"spec/fixtures/js/unknown.spec.js",
utils.find_file_by_patterns(
"spec/fixtures/js/unknown.js",
{ "{name}.spec.{ext}", "{name}.test.{ext}" },
true
)
)
end)
end)
|
--[[
< CATHERINE > - A free role-playing framework for Garry's Mod.
Development and design by L7D.
Catherine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Catherine. If not, see <http://www.gnu.org/licenses/>.
]]--
catherine.language.Merge( "english", {
// Basic
[ "Basic_Schema_Title" ] = "Dissolution",
[ "Basic_Schema_Desc" ] = "Society is a thing of the past.",
[ "Basic_Schema_IntroTitle" ] = "US East Coast, 2018",
[ "Basic_Schema_IntroDesc" ] = "Society is a thing of the past.",
[ "Basic_Schema_Author" ] = "Dissolution schema development and design by '%s'",
// Faction Name
[ "Faction_Name_Survivor" ] = "Survivor",
[ "Faction_Name_Guard" ] = "National Guard",
// Faction Description
[ "Faction_Desc_Survivor" ] = "Those that are left to dwell in the mess.",
[ "Faction_Desc_Guard" ] = "The protective force for survivors.",
// Command
[ "Command_ZombieAdd_Fin" ] = "You have added a new zombie spawn.",
[ "Command_ZombieRemove_Fin" ] = "You have removed %s zombie spawn(s)."
} )
|
local addonName, addon = ...
local tests = {}
--[[-------------------------------------------------------------------
-- Bootstrap code to set up the buttons
-------------------------------------------------------------------]]--
local groupheader = CreateFrame("Button", addonName .. "TestHeader", UIParent, "SecureGroupHeaderTemplate")
SecureHandler_OnLoad(groupheader)
local button_m = CreateFrame("Button", addonName .. "TestButton_m", UIParent, "SecureActionButtonTemplate")
local button_h = CreateFrame("Button", addonName .. "TestButton_h", UIParent, "ClickCastUnitTemplate,SecureActionButtonTemplate")
--[[-------------------------------------------------------------------
-- Create the event handler
-------------------------------------------------------------------]]--
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("PLAYER_LOGIN")
eventFrame:SetScript("OnEvent", function(self, event, ...)
print("====== " .. addonName .. "Test Suite ======")
print(" - Registering frames for click-casting")
ClickCastFrames[button_m] = true
groupheader:SetFrameRef("clickcast_header", addon.header)
groupheader:SetFrameRef("thebutton", button_h)
groupheader:Execute[[
local header = self:GetFrameRef("clickcast_header")
header:SetAttribute("clickcast_button", self:GetFrameRef("thebutton"))
header:RunAttribute("clickcast_register")
]]
local currentProfile = addon.db:GetCurrentProfile()
for name, testFunc in pairs(tests) do
print(" - Running " .. name)
testFunc()
end
addon.db:SetProfile(currentProfile)
end)
--[[-------------------------------------------------------------------
-- Utility functions
-------------------------------------------------------------------]]--
local function makeprofile(bindings)
addon:ClearAttributes()
local tempName = "Temp" .. GetTime()
local suiteName = addonName .. "TestSuite"
addon.db:SetProfile(tempName)
addon.db:DeleteProfile(suiteName, true)
addon.db:SetProfile(suiteName)
addon.db:DeleteProfile(tempName)
table.wipe(addon.bindings)
for k,v in pairs(bindings) do
table.insert(addon.bindings, v)
end
addon:FireMessage("BINDINGS_CHANGED")
end
local function makebind(key)
local entry = {}
entry.key = key
entry.type = "menu"
entry.menu = function()
CLIQUE_TEST_TRIGGERED = key
end
entry.sets = {default = true}
return entry
end
local function getbutton(bind)
local prefix, suffix = addon:GetBindingPrefixSuffix(bind)
if suffix == "1" then
suffix = "LeftButton"
elseif suffix == "2" then
suffix = "RightButton"
elseif suffix == "3" then
suffix = "MiddleButton"
elseif tonumber(suffix) then
suffix = "Button" .. suffix
end
return suffix
end
local passed = 0
local function pass(name)
passed = passed + 1
--print(" - |cff00ff00PASS|r - " .. name)
end
local failed = 0
local function fail(name)
failed = failed + 1
print(" - |cffff0000FAIL|r - " .. name)
end
local modbits = {
"IsAltKeyDown",
"IsLeftAltKeyDown",
"IsRightAltKeyDown",
"IsControlKeyDown",
"IsLeftControlKeyDown",
"IsRightControlKeyDown",
"IsShiftKeyDown",
"IsLeftShiftKeyDown",
"IsRightShiftKeyDown",
}
local origs = {}
for k,v in pairs(modbits) do
origs[v] = _G[v]
end
local function setmodifiers(bind)
local binary = addon:GetBinaryBindingKey()
for i = 1, #binary, 1 do
local enabled = binary:sub(i,i) == "1"
if enabled then
_G[modbits[i]] = function() return 1 end
end
end
end
local function clrmodifiers()
for idx, name in ipairs(modbits) do
_G[name] = origs[name]
end
end
local function randommodifiers()
local prefix = ""
if math.random(0, 1) then
-- Alt key down
local which = math.random(0, 10)
if which >= 2 then
prefix = prefix .. "ALT-"
elseif which == 0 then
prefix = prefix .. "LALT-"
elseif which == 1 then
prefix = prefix .. "RALT-"
end
end
if math.random(0, 1) then
-- Ctrl key down
local which = math.random(0, 10)
if which >= 2 then
prefix = prefix .. "CTRL-"
elseif which == 0 then
prefix = prefix .. "LCTRL-"
elseif which == 1 then
prefix = prefix .. "RCTRL-"
end
end
if math.random(0, 1) then
-- Shift key down
local which = math.random(0, 10)
if which >= 2 then
prefix = prefix .. "SHIFT-"
elseif which == 0 then
prefix = prefix .. "LSHIFT-"
elseif which == 1 then
prefix = prefix .. "RSHIFT-"
end
end
return prefix
end
--[[-------------------------------------------------------------------
-- Test code
-------------------------------------------------------------------]]--
local all_binding_types = {
lower = makebind("f"),
upper = makebind("F"),
num = makebind("1"),
foreign = makebind("ö"),
fkey = makebind("F1"),
qkey = makebind("DOUBLEQUOTE"),
dash = makebind("DASH"),
bspace = makebind("BACKSPACE"),
leftbutton = makebind("BUTTON1"),
rightbutton = makebind("BUTTON2"),
middlebutton = makebind("BUTTON3"),
button4 = makebind("BUTTON4"),
button5 = makebind("BUTTON5"),
}
-- First test to ensure each type of binding works properly
function tests.SimpleTriggers()
makeprofile(all_binding_types)
for name, bind in pairs(all_binding_types) do
-- Test to see if the binding works on the manually registered button
local button = getbutton(bind)
button_m.menu = bind.menu
button_m:Click(button)
if CLIQUE_TEST_TRIGGERED then
pass(name .. " manual")
else
fail(name .. " manual")
end
button_h.menu = bind.menu
button_h:Click(button)
if CLIQUE_TEST_TRIGGERED then
pass(name .. " header")
else
fail(name .. " header")
end
end
print(" - " .. passed .. " passed, " .. failed .. " failed")
end
function tests.Modifiers()
-- Copy bindings table
local bindings = {}
for k,v in pairs(all_binding_types) do
bindings[k] = {}
for ka,va in pairs(v) do
bindings[k][ka] = va
end
end
-- Run this test five times
for i = 1, 10, 1 do
for name, bind in pairs(bindings) do
local obind = bind.key
bind.key = randommodifiers() .. bind.key
-- Register the bindings
makeprofile(bindings)
-- Manually registered button
local button = getbutton(bind)
button_m.menu = function()
CLIQUE_TEST_TRIGGERED = bind.key
end
button_m:Click(button)
if CLIQUE_TEST_TRIGGERED then
pass(name .. " manual")
else
fail(name .. " manual")
end
button_h.menu = function()
CLIQUE_TEST_TRIGGERED = bind.key
end
button_h:Click(button)
if CLIQUE_TEST_TRIGGERED then
pass(name .. "(" .. bind.key .. ") " .. "header")
else
fail(name .. " header")
end
bind.key = obind
end
end
print(" - " .. passed .. " passed, " .. failed .. " failed")
end
|
local mposx = 0;
local mposy = 0;
local hovered = nil;
local buttonWidth = 250;
local buttonHeight = 75;
local buttonBorder = 2;
local label = -1;
local gr_r, gr_g, gr_b, gr_a = game.GetSkinSetting("col_test")
gfx.GradientColors(0,127,255,255,0,128,255,0)
local gradient = gfx.LinearGradient(0,0,0,1)
local bgPattern = gfx.CreateSkinImage("bg_pattern.png", gfx.IMAGE_REPEATX + gfx.IMAGE_REPEATY)
local bgAngle = 0.5
local bgPaint = gfx.ImagePattern(0,0, 256,256, bgAngle, bgPattern, 1.0)
local bgPatternTimer = 0
view_update = function()
if package.config:sub(1,1) == '\\' then --windows
updateUrl, updateVersion = game.UpdateAvailable()
os.execute("start " .. updateUrl)
else --unix
--TODO: Mac solution
os.execute("xdg-open " .. updateUrl)
end
end
mouse_clipped = function(x,y,w,h)
return mposx > x and mposy > y and mposx < x+w and mposy < y+h;
end;
draw_button = function(name, x, y, hoverindex)
local rx = x - (buttonWidth / 2);
local ty = y - (buttonHeight / 2);
gfx.BeginPath();
gfx.FillColor(0,128,255);
if mouse_clipped(rx,ty, buttonWidth, buttonHeight) then
hovered = hoverindex;
gfx.FillColor(255,128,0);
end
gfx.Rect(rx - buttonBorder,
ty - buttonBorder,
buttonWidth + (buttonBorder * 2),
buttonHeight + (buttonBorder * 2));
gfx.Fill();
gfx.BeginPath();
gfx.FillColor(40,40,40);
gfx.Rect(rx, ty, buttonWidth, buttonHeight);
gfx.Fill();
gfx.BeginPath();
gfx.FillColor(255,255,255);
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE);
gfx.FontSize(40);
gfx.Text(name, x, y);
end;
function updateGradient()
gr_r, gr_g, gr_b, gr_a = game.GetSkinSetting("col_test")
if gr_r == nil then return end
gfx.GradientColors(gr_r,gr_g,gr_b,gr_a,0,128,255,0)
gradient = gfx.LinearGradient(0,0,0,1)
end
function updatePattern(dt)
bgPatternTimer = (bgPatternTimer + dt) % 1.0
local bgx = math.cos(bgAngle) * (bgPatternTimer * 256)
local bgy = math.sin(bgAngle) * (bgPatternTimer * 256)
gfx.UpdateImagePattern(bgPaint, bgx, bgy, 256, 256, bgAngle, 1.0)
end
render = function(deltaTime)
updateGradient()
updatePattern(deltaTime)
resx,resy = game.GetResolution();
mposx,mposy = game.GetMousePos();
gfx.Scale(resx, resy / 3)
gfx.Rect(0,0,1,1)
gfx.FillPaint(gradient)
gfx.Fill()
gfx.ResetTransform()
gfx.BeginPath()
gfx.Scale(0.5,0.5)
gfx.Rect(0,0,resx * 2,resy * 2)
gfx.GlobalCompositeOperation(gfx.BLEND_OP_DESTINATION_IN)
gfx.FillPaint(bgPaint)
gfx.Fill()
gfx.ResetTransform()
gfx.BeginPath()
gfx.GlobalCompositeOperation(gfx.BLEND_OP_SOURCE_OVER)
buttonY = resy / 2;
hovered = nil;
gfx.LoadSkinFont("NotoSans-Regular.ttf");
draw_button("Start", resx / 2, buttonY, Menu.Start);
buttonY = buttonY + 100;
draw_button("Get Songs BETA", resx / 2, buttonY, Menu.DLScreen);
buttonY = buttonY + 100;
draw_button("Settings", resx / 2, buttonY, Menu.Settings);
buttonY = buttonY + 100;
draw_button("Exit", resx / 2, buttonY, Menu.Exit);
gfx.BeginPath();
gfx.FillColor(255,255,255);
gfx.FontSize(120);
if label == -1 then
label = gfx.CreateLabel("unnamed_sdvx_clone", 120, 0);
end
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE);
gfx.DrawLabel(label, resx / 2, resy / 2 - 200, resx-40);
updateUrl, updateVersion = game.UpdateAvailable()
if updateUrl then
gfx.BeginPath()
gfx.TextAlign(gfx.TEXT_ALIGN_BOTTOM + gfx.TEXT_ALIGN_LEFT)
gfx.FontSize(30)
gfx.Text(string.format("Version %s is now available", updateVersion), 5, resy - buttonHeight - 10)
draw_button("View", buttonWidth / 2 + 5, resy - buttonHeight / 2 - 5, view_update);
draw_button("Update", buttonWidth * 1.5 + 15, resy - buttonHeight / 2 - 5, Menu.Update)
end
end;
mouse_pressed = function(button)
if hovered then
hovered()
end
return 0
end
|
function Auctionator.API.v1.GetAuctionPriceByItemID(callerID, itemID)
Auctionator.API.InternalVerifyID(callerID)
if type(itemID) ~= "number" then
Auctionator.API.ComposeError(
callerID,
"Usage Auctionator.API.v1.GetAuctionPriceByItemID(string, number)"
)
end
return Auctionator.Database:GetPrice(tostring(itemID))
end
function Auctionator.API.v1.GetAuctionPriceByItemLink(callerID, itemLink)
Auctionator.API.InternalVerifyID(callerID)
if type(itemLink) ~= "string" then
Auctionator.API.ComposeError(
callerID,
"Usage Auctionator.API.v1.GetAuctionPriceByItemLink(string, string)"
)
end
local dbKeys = nil
-- Use that the callback is called immediately (and populates dbKeys) if the
-- item info for item levels is available now.
Auctionator.Utilities.DBKeyFromLink(itemLink, function(dbKeysCallback)
dbKeys = dbKeysCallback
end)
if dbKeys then
return Auctionator.Database:GetFirstPrice(dbKeys)
else
return Auctionator.Database:GetPrice(
Auctionator.Utilities.BasicDBKeyFromLink(itemLink)
)
end
end
|
-----------------------------------
-- Area: North Gustaberg
-- NPC: <this space intentionally left blank>
-- !pos -217 97 461 106
-----------------------------------
local ID = require("scripts/zones/North_Gustaberg/IDs")
require("scripts/globals/npc_util")
-----------------------------------
function onTrade(player, npc, trade)
if player:getCharVar("RELIC_IN_PROGRESS") == 18305 and npcUtil.tradeHas(trade, {1451, 1577, 1589, 18305}) then -- currency, shard, necropsyche, stage 4
player:startEvent(254, 18306)
end
end
function onTrigger(player, npc)
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
if csid == 254 and npcUtil.giveItem(player, {18306, {1450, 30}}) then
player:confirmTrade()
player:setCharVar("RELIC_IN_PROGRESS", 0)
end
end
|
--
-- tests/actions/vstudio/vc2010/vstudio_vs2010_rule_props.lua
-- Validate generation of custom rules
-- Author Tom van Dijck
-- Copyright (c) 2016 Jason Perkins and the Premake project
--
local p = premake
local suite = test.declare("vstudio_vs2010_rule_props")
local vc2010 = p.vstudio.vc2010
local m = p.vstudio.vs2010.rules.props
--
-- Setup
--
local wks, prj
function suite.setup()
p.action.set("vs2010")
rule 'example'
display 'Example compiler'
fileExtension '.example'
propertydefinition {
name = "output_path",
kind = "string",
display = "Output Path",
description = "",
}
buildmessage 'Compiling %{file.basename} with example-compiler...'
buildcommands {
'package-example-compiler.exe %{output_path} "%{file.relpath}"'
}
buildoutputs {
'%{output_path}%{file.basename}.example.cc',
'%{output_path}%{file.basename}.example.h'
}
end
--
-- commandLineTemplates
--
function suite.commandLineTemplates()
local r = test.getRule("example")
m.commandLineTemplates(r)
test.capture [[
<CommandLineTemplate>package-example-compiler.exe [output_path] "%(Identity)"</CommandLineTemplate>
]]
end
--
-- executionDescription
--
function suite.executionDescription()
local r = test.getRule("example")
m.executionDescription(r)
test.capture [[
<ExecutionDescription>Compiling %(Filename) with example-compiler...</ExecutionDescription>
]]
end
|
-- scaffold geniefile for XSadd
XSadd_script = path.getabsolute(path.getdirectory(_SCRIPT))
XSadd_root = path.join(XSadd_script, "XSadd")
XSadd_includedirs = {
path.join(XSadd_script, "config"),
XSadd_root,
}
XSadd_libdirs = {}
XSadd_links = {}
XSadd_defines = {}
----
return {
_add_includedirs = function()
includedirs { XSadd_includedirs }
end,
_add_defines = function()
defines { XSadd_defines }
end,
_add_libdirs = function()
libdirs { XSadd_libdirs }
end,
_add_external_links = function()
links { XSadd_links }
end,
_add_self_links = function()
links { "XSadd" }
end,
_create_projects = function()
project "XSadd"
kind "StaticLib"
language "C++"
flags {}
includedirs {
XSadd_includedirs,
}
defines {}
files {
path.join(XSadd_script, "config", "**.h"),
path.join(XSadd_root, "**.h"),
path.join(XSadd_root, "**.cpp"),
}
end, -- _create_projects()
}
---
|
local tap = require('util/tap')
local util = require('util')
local test = tap.test
local path = require('path')
local spawn = require('child_process').spawn
local __dirname = util.dirname()
console.log(process.execPath, __dirname)
test("process execute", function()
local childPath = path.join(__dirname, "fixtures", "parent-process.lua")
console.log(os.execute("lnode " .. childPath))
end)
test("process detached", function()
local childPath = path.join(__dirname, "fixtures", "parent-process.lua")
local persistentPid = -1
if os.platform() == "win32" then
return
end
local argv = process.argv
local args = { childPath }
console.log('lnode', args)
local child = spawn(process.execPath, args)
child.stdout:on("data", function(data)
console.log("data", data)
persistentPid = tonumber(data)
end)
setTimeout(1000, function()
local err = pcall(function()
process.kill(child.pid)
end)
--process.kill(persistentPid)
end)
os.printAllHandles()
setTimeout(900, function()
child:send('message')
end)
child:on('exit', function(code)
print('exit', code);
end)
child:on('close', function(code)
print('close', code);
end)
--[[
process:on('exit', function()
assert(persistentPid ~= -1)
local err = pcall(function()
process.kill(child.pid)
end)
process.kill(persistentPid)
end)
--]]
end)
--[[
test("process exec", function ()
local childPath = path.join(__dirname, "fixtures", "parent-process.lua")
local options = { timeout = 1000 }
execFile(process.execPath, { childPath }, options, function(err, stdout, stderr)
console.log('exec(err, stdout, stderr)', err, stdout, stderr)
process.kill(0);
end)
end)
--]]
tap.run()
|
local json = require "json"
--要登录后才能用
local pingReq = {
header = {
protoid = 0x0001,
session = 1,
response = nil,
},
data = 1234,
}
print("pingReq="..json.encode(pingReq))
local registerReq = {
header = {
protoid = 0x0101,
session = 1,
response = nil,
},
data = {
account = "游客1001",
password = "123456",
telephone = "1383838438",
create_index = 1,
nickname = "helloworld",
},
}
print("registerReq="..json.encode(registerReq))
local visitorReq = {
header = {
protoid = 0x0104,
session = 1,
response = nil,
},
data = {
visit_token = "a3984026-c67b-4889-c827-db693fba8f64",
},
}
print("visitorReq="..json.encode(visitorReq))
local visitorReq = {
header = {
protoid = 0x0104,
session = 1,
response = nil,
},
data = {
visit_token = "b4a7d645-f3c9-472e-c76c-14c09b8596c8",
},
}
print("visitorReq="..json.encode(visitorReq))
local roomListReq = {
header = {
protoid = 0x0201,
session = 2,
response = nil,
},
data = 10101,
}
print("roomListReq="..json.encode(roomListReq))
local enterRoomReq = {
header = {
protoid = 0x0d01,
session = 2,
response = nil,
roomproxy = "xpnn",
},
}
print("enterRoomReq="..json.encode(enterRoomReq))
exitRoomReq = {
header = {
protoid = 0x0d02,
session = 2,
response = nil,
roomproxy = "xpnn",
},
}
print("exitRoomReq="..json.encode(exitRoomReq))
groupRequest = {
header = {
protoid = 0x0d03,
session = 2,
response = nil,
roomproxy = "xpnn",
},
}
print("groupRequest="..json.encode(groupRequest))
|
local ane = {}
local pce = {
name = "main",
path = "assets/spr/fx/reticle.png",
width = 128,
height = 128,
imgX = 64,
imgY = 64,
originX = 64,
originY = 64,
attachPoints = {
center = {x = 64,y=64},
},
-- connectSprite = "main",
-- connectPoint = "hand1",
-- connectMPoint = "grip1",
animations = ane
}
return pce
|
--エーリアン・ドッグ
function c15475415.initial_effect(c)
--summon success
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(15475415,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c15475415.spcon)
e1:SetTarget(c15475415.sptg)
e1:SetOperation(c15475415.spop)
c:RegisterEffect(e1)
--counter
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(15475415,1))
e2:SetCategory(CATEGORY_COUNTER)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(c15475415.ctcon)
e2:SetOperation(c15475415.ctop)
c:RegisterEffect(e2)
end
c15475415.counter_add_list={0x100e}
function c15475415.spcon(e,tp,eg,ep,ev,re,r,rp)
return ep==tp and eg:GetFirst():IsSetCard(0xc)
end
function c15475415.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c15475415.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,SUMMON_VALUE_SELF,tp,tp,false,false,POS_FACEUP)
end
function c15475415.ctcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+SUMMON_VALUE_SELF
end
function c15475415.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsCanAddCounter,tp,0,LOCATION_MZONE,nil,0x100e,1)
if g:GetCount()==0 then return end
for i=1,2 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local sg=g:Select(tp,1,1,nil)
sg:GetFirst():AddCounter(0x100e,1)
end
end
|
local event = import("libs/event")
local lust = import("libs/lust")
local describe, it, expect = lust.describe, lust.it, lust.expect
describe("event", function()
it("observe", function()
local test = nil
local cb = function()
test = true
end
local spy = lust.spy(cb)
local destroy = event.Observe("TestEvent"):subscribe(cb)
expect(detroy).to.be.a("function")
event.Call("TestEvent")
destroy()
expect(#spy).to.be(1)
expect(test).to.be.truthy()
end)
end)
|
local ADDON_NAME, namespace = ...
local L = namespace.L
local LOCALE = GetLocale()
-- TODO: Just an example of how this works...
-- Will add localized strings if users provide them
if LOCALE == "deDE" then
L["BoA"] = "BoA"
L["BoE"] = "BoE"
L["Equip:"] = "Equip:"
return end
|
-- Services
local run_service = game:GetService('RunService')
local user_input_service = game:GetService('UserInputService')
-- Locals
local camera = workspace.CurrentCamera
-- Modules
local signal = require(script.Parent.Signal)
-- Main Module
local mouse = {}
return {
New = function()
local position = user_input_service:GetMouseLocation()
local unit_ray = camera:ScreenPointToRay(position.X, position.Y)
local params = RaycastParams.new()
params.FilterDescendantsInstances = {}
params.FilterType = Enum.RaycastFilterType.Blacklist
-- 3D Variables
local ray = Ray.new(unit_ray.Origin, unit_ray.Direction * 100)
local raycast = workspace:Raycast(ray.Origin, ray.Direction, params)
local target = raycast and raycast.Instance
local normal = raycast and raycast.Normal
-- Self
local self = {}
-- Properties
self.Hit = target and target.CFrame
self.Origin = CFrame.new(unit_ray.Origin)
self.Target = target
self.UnitRay = unit_ray
self.X = position.X
self.Y = position.Y
self.Vector = position
self.TargetFilter = nil
self.TargetSurface = normal
-- RBXScriptSignals
self.Button1Down = signal.New()
self.Button2Down = signal.New()
self.Button1Up = signal.New()
self.Button2Up = signal.New()
self.WheelMoved = signal.New()
self.Move = signal.New()
self.Idle = signal.New()
-- Create Signal Connections
do
-- Variables
local isIdle = true
-- UserInput Listeners
user_input_service.InputBegan:Connect(function(input, game_processed_event)
if (game_processed_event) then return end
if (input.UserInputType == Enum.UserInputType.MouseButton1) then
isIdle = false
self.Button1Down:Fire()
elseif (input.UserInputType == Enum.UserInputType.MouseButton2) then
isIdle = false
self.Button2Down:Fire()
end
end)
user_input_service.InputChanged:Connect(function(input)
if (input.UserInputType == Enum.UserInputType.MouseMovement) then
-- Forgot to add this lol
if (typeof(self.TargetFilter) == 'Instance') then
params.FilterDescendantsInstances = self.TargetFilter:GetChildren()
end
-- Reuse Variables
position = input.Position
unit_ray = camera:ScreenPointToRay(position.X, position.Y)
ray = Ray.new(unit_ray.Origin, unit_ray.Direction * 100)
raycast = workspace:Raycast(ray.Origin, ray.Direction, params)
target = raycast and raycast.Instance
normal = raycast and raycast.Normal
-- Set Mouse Properties
self.Hit = target and target.CFrame
self.Origin = CFrame.new(unit_ray.Origin)
self.Target = target
self.UnitRay = unit_ray
self.X = position.X
self.Y = position.Y
self.Vector = position
self.TargetSurface = normal
self.Move:Fire()
elseif (input.UserInputType == Enum.UserInputType.MouseWheel) then
self.WheelMoved:Fire()
end
end)
user_input_service.InputEnded:Connect(function(input)
if (input.UserInputType == Enum.UserInputType.MouseButton1) then
isIdle = true
self.Button1Up:Fire()
elseif (input.UserInputType == Enum.UserInputType.MouseButton2) then
isIdle = true
self.Button2Up:Fire()
end
end)
run_service.Heartbeat:Connect(function()
if (isIdle) then
self.Idle:Fire() -- In the mouse class it doesn't account for mouse movement for some reason
end
end)
end
return setmetatable(self, mouse) --> The only reason it's like this because I want to use OOP :)
end
}
|
-- Copyright (C) 2019 by davin
-- rsa1024 encrypt and decrypt
local resty_rsa = require "resty.rsa"
local resty_str = require "resty.string"
local scheme = ngx.var.scheme
if scheme ~= 'https' then
return ngx.redirect(
'https://'..ngx.var.host..ngx.var.request_uri, 301)
end
local plain = ngx.var.arg_plain or 'hello openssl'
--[[
local time = ngx.now()
local rsa_public_key, rsa_priv_key, err = resty_rsa:generate_rsa_keys(1024)
if not rsa_public_key then
ngx.say('generate rsa keys err: ', err)
end
ngx.say('rsa1024 genkey time = ', ngx.now() - time, 's\n')
--]]
local rsa_public_key = [[
-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBALRafyXmEY9wBw/lvedQIjP8ZYPEY45S9pqOGYNyQoXAOVEQIMSv5eo2
rgWFREdp2tw25PDjL6+KF3D7sAPUI1j/Nyxq17xcUrFHskKyNnMKJpxHTDrrZmFD
GDj2oWw4kwRL9+m8mhpcFB0qkkJ66q3eb9bqJA7frZxsCRPDW52VAgMBAAE=
-----END RSA PUBLIC KEY-----
]]
local rsa_priv_key =[[
-----BEGIN RSA PRIVATE KEY-----
MIICXwIBAAKBgQC0Wn8l5hGPcAcP5b3nUCIz/GWDxGOOUvaajhmDckKFwDlRECDE
r+XqNq4FhURHadrcNuTw4y+vihdw+7AD1CNY/zcsate8XFKxR7JCsjZzCiacR0w6
62ZhQxg49qFsOJMES/fpvJoaXBQdKpJCeuqt3m/W6iQO362cbAkTw1udlQIDAQAB
AoGBAKpzuSWlakVJWLNSq4dZeenuCjddvcW+bSknUb+klnB4evM9LesWX1JbeV7o
U962kc186CUuYlwiRANZLEKCFSCqQ50KxotT3lZWdcvcQTh625hIPQAPJ5L3UGjx
I1er83KmDeoxk07wNAjmYrTnYXrRxaknJd6/65ke4XeQarBBAkEA3YJ5zvI+sJTp
JrkKnm9U/kZRMcM0QRQLw2iMR58vXmgl+xSOHdtaHs3fylq/xhCh5HlEUeqOrYmN
G6Ci6p+IMQJBANBvgiN1rHKT7M140rEvwIKJf2W+wU2Sf/VkJS6OE+eGb0tzZTYD
s4g3QLFnqPQrUsZ94NGFi8tQ8fJKbsOWtqUCQQDL0pNi6WTl9x/SkdJDlw4OK4Xq
1EPw3hE07a6m+MMNi6fnMTLUJlL2pVmXSYnNJuDQ6wUCm2JOLJO7KETAv6sBAkEA
orUZGsMmHb8ZkH/rwMMs/PmGiI8y6HIfDxjg6YmhQg+wW262KEcVY5T2HEZ2Hjyf
fjEPSZ99M/Z5GBFAi8/fvQJBAIMGwpXeDRi2GPhxdql1YEh8fanCq0Rz4teee6+m
emH+NTGnX6plyikqghnE8RAoR9TMsXR9Eg/KWvblxXS8/V4=
-----END RSA PRIVATE KEY-----
]]
ngx.say('usage: ' .. ngx.var.uri .. '?plain=xxx\n')
ngx.say(rsa_public_key)
ngx.say(rsa_priv_key)
local pub, err = resty_rsa:new({ public_key = rsa_public_key })
local priv, err = resty_rsa:new({ private_key = rsa_priv_key })
--local plain = 'hello openssl'
local enc = pub:encrypt(plain)
local dec = priv:decrypt(enc)
ngx.say('plain = ', plain)
ngx.say('enc = ', resty_str.to_hex(enc))
ngx.say('dec = ', dec)
|
http = require "resty.http"
def_backend = "upstream-default-backend"
local concat = table.concat
local upstream = require "ngx.upstream"
local get_servers = upstream.get_servers
local get_upstreams = upstream.get_upstreams
local random = math.random
local us = get_upstreams()
function openURL(original_headers, status)
local httpc = http.new()
original_headers["X-Code"] = status or "404"
original_headers["X-Format"] = original_headers["Accept"] or "text/html"
local random_backend = get_destination()
local res, err = httpc:request_uri(random_backend, {
path = "/",
method = "GET",
headers = original_headers,
})
if not res then
ngx.log(ngx.ERR, err)
ngx.exit(500)
end
for k,v in pairs(res.headers) do
ngx.header[k] = v
end
ngx.status = tonumber(status)
ngx.say(res.body)
end
function get_destination()
for _, u in ipairs(us) do
if u == def_backend then
local srvs, err = get_servers(u)
local us_table = {}
if not srvs then
return "http://127.0.0.1:8181"
else
for _, srv in ipairs(srvs) do
us_table[srv["name"]] = srv["weight"]
end
end
local destination = random_weight(us_table)
return "http://"..destination
end
end
end
function random_weight(tbl)
local total = 0
for k, v in pairs(tbl) do
total = total + v
end
local offset = random(0, total - 1)
for k1, v1 in pairs(tbl) do
if offset < v1 then
return k1
end
offset = offset - v1
end
end
|
-- Copied from Roselia - A Cruel Angel Thesis
-- Which is copied from Poppin' Party - Senbonzakura
RequireDEPLSVersion(02010300)
local Sen = {Event = {}}
local fft = require("luafft")
function Sen.LoadBackgroundID(id)
local t = {}
t[0] = LoadDEPLS2Image("assets/image/background/liveback_"..id..".png")
t[1] = LoadDEPLS2Image(string.format("assets/image/background/b_liveback_%03d_01.png", id))
t[2] = LoadDEPLS2Image(string.format("assets/image/background/b_liveback_%03d_02.png", id))
t[3] = LoadDEPLS2Image(string.format("assets/image/background/b_liveback_%03d_03.png", id))
t[4] = LoadDEPLS2Image(string.format("assets/image/background/b_liveback_%03d_04.png", id))
return assert(t[0] and t[1] and t[2] and t[3] and t[4] and t)
end
Sen.Navi = {}
local function makeScore(score, idx, rarity)
return function()
AddScore(score)
return SkillPopup(idx, "green", "score_up", Sen.Navi[idx], rarity)
end
end
local function makeHealer(idx, rarity)
return function()
return SkillPopup(idx, "blue", "healer", Sen.Navi[idx], rarity)
end
end
local function makePerflock(duration, lock_good, idx, rarity)
return function()
(lock_good and SetRedTimingDuration or SetYellowTimingDuration)(duration)
return SkillPopup(idx, lock_good and "red" or "yellow", lock_good and "tw++" or "tw+", Sen.Navi[idx], rarity)
end
end
-- Timer-based event
Sen.Event.Timed = {
-- {Second, Chance, Callback}
{10, 45, makeScore(452, 2, "SR")},
{10, 39, makePerflock(2000, false, 6, "SR")},
}
-- Note-based event
Sen.Event.Note = {
-- {Notes, Chance, Callback}
{27, 37, makePerflock(4000, true, 8, "UR")},
{32, 43, makeScore(820, 4, "UR")},
}
-- Perfect-based event
Sen.Event.Perfect = {
-- {Perfect, Chance, Callback}
{14, 40, makeHealer(5, "UR")},
}
function Sen.Event.Initialize(start_et)
start_et = start_et or 0
-- Timed based
for i, v in ipairs(Sen.Event.Timed) do
v.ET = start_et * 0.001
end
--Note-based and Perfect-based
for a, b in ipairs({Sen.Event.Note, Sen.Event.Perfect}) do
for i, v in ipairs(b) do
v.Count = 0
end
end
end
function Sen.AttemptToTrigger(idx)
if math.random(0, 100) <= idx[2] then
idx[3]()
end
end
function Sen.NoteHandler(accuracy)
-- For Note-based, it doesn't matter if it's even miss
-- as long as this function is called
for i, v in ipairs(Sen.Event.Note) do
v.Count = v.Count + 1
if v.Count == v[1] then
Sen.AttemptToTrigger(v)
v.Count = 0
end
end
-- For perfect-based, accuracy must be 1
if accuracy == 1 then
for i, v in ipairs(Sen.Event.Perfect) do
v.Count = v.Count + 1
if v.Count == v[1] then
Sen.AttemptToTrigger(v)
v.Count = 0
end
end
end
end
function Sen.DrawBackground(bg)
DrawObject(bg[0])
DrawObject(bg[1], -88, 0)
DrawObject(bg[2], 960, 0)
DrawObject(bg[3], 0, -43)
DrawObject(bg[4], 0, 640)
end
function Initialize()
AllowComboCheer()
Sen.Event.Initialize(-GetLiveSimulatorDelay())
Sen.SpectrumOkay = GetLiveUI() == "lovewing" and IsDesktopSystem()
-- Load images
Sen.BG = Sen.LoadBackgroundID(11)
Sen.Navi[2] = LoadImage("650Ako-Udagawa-Cool-khEW7J.png")
Sen.Navi[4] = LoadImage("648Lisa-Imai-Happy-b2isLo.png")
Sen.Navi[5] = LoadImage("647Yukina-Minato-Cool-LY3Cbq.png")
Sen.Navi[6] = LoadImage("649Sayo-Hikawa-Power-Cppbqj.png")
Sen.Navi[8] = LoadImage("646Rinko-Shirokane-Cool-aChlO9.png")
-- Initialize FFT
-- Canvas is 640x96+160+93
if Sen.SpectrumOkay then
Sen.SpectrumCanvas = NewCanvas(840, 384)
Sen.Spectrum1 = {}
Sen.Spectrum2 = {}
local step = (math.log(22050/20) / 512) / math.log(2)
Sen.BandFreq = {}
Sen.BandFreq[1] = 20 * math.pow(2, step * 0.5)
for i = 2, 512 do
Sen.BandFreq[i] = (Sen.BandFreq[i - 1] * math.pow(2, step))
end
end
end
local lc = {}
local rc = {}
local lcn = {}
local rcn = {}
local result_fft = {lcn, rcn}
function Sen.FFTSample(waveform)
local n = math.floor(#waveform * 0.5)
for i = 1, #waveform do
lc[i] = fft.complex.new(waveform[i][1])
rc[i] = fft.complex.new(waveform[i][2])
end
local lcfft, rcfft = fft.fft(lc), fft.fft(rc)
for i = 1, n do
assert(lcfft[i].r, i)
lcn[i] = math.sqrt(lcfft[i].r * lcfft[i].r + lcfft[i].i * lcfft[i].i) / n
rcn[i] = math.sqrt(rcfft[i].r * rcfft[i].r + rcfft[i].i * rcfft[i].i) / n
end
return result_fft
end
local bandout = {{}, {}}
function Sen.ToLogSpace(fftsmp)
-- Shamelessly stolen from Rainmeter AudioLevel plugin
-- https://github.com/dcgrace/AudioLevel/blob/master/AudioLevel.cpp#L650
local df = 44100 / 1024
local scalar = 2 / 44100
for i = 1, 512 do
bandout[1][i] = 0
bandout[2][i] = 0
end
for iChan = 1, 2 do
local iBin = 1
local iBand = 1
local f0 = 0
while iBin <= 512 and iBand <= 512 do
local fLin1 = (iBin - 0.5) * df
local fLog1 = Sen.BandFreq[iBand]
local x = fftsmp[iChan][iBin]
if fLin1 <= fLog1 then
bandout[iChan][iBand] = bandout[iChan][iBand] + (fLin1 - f0) * x * scalar
f0 = fLin1
iBin = iBin + 1
else
bandout[iChan][iBand] = math.max((bandout[iChan][iBand] + (fLog1 - f0) * x * scalar) * 44100)
f0 = fLog1
iBand = iBand + 1
end
end
end
return bandout
end
local function f(i)
--return math.log(i)/b512 * 0.75
return 1/(i^(1/640)) * 0.1
end
function Update(deltaT)
-- Update FFT
if Sen.SpectrumOkay then
local spectrum = Sen.ToLogSpace(Sen.FFTSample(GetCurrentAudioSample(1024)))
SetCanvas(Sen.SpectrumCanvas)
ClearDrawing()
SetBlendMode("add")
-- Left
SetColor(255, 0, 0)
for i = 1, 512 do
local xp = (i - 1) / 513 * 640
DrawEllipse("fill", xp, -48, 17, 96 * spectrum[1][i] * f(i))
DrawEllipse("line", xp, -48, 17, 96 * spectrum[1][i] * f(i))
end
--Right
SetColor(0, 255, 255)
for i = 1, 512 do
local xp = (i - 1) / 513 * 640
DrawEllipse("fill", xp, -48, 17, 96 * spectrum[2][i] * f(i))
DrawEllipse("line", xp, -48, 17, 96 * spectrum[2][i] * f(i))
end
-- Reset
SetBlendMode("alpha", "alphamultiply")
SetColor(255, 255, 255)
SetCanvas()
end
Sen.DrawBackground(Sen.BG)
-- For timed-based, wrap the elapsed time
if not(IsLiveEnded()) then
deltaT = deltaT * 0.001
for i, v in ipairs(Sen.Event.Timed) do
v.ET = v.ET + deltaT
if v.ET >= v[1] then
v.ET = v.ET - v[1]
Sen.AttemptToTrigger(v)
end
end
end
-- Draw spectrum
if Sen.SpectrumOkay then
SetBlendMode("alpha", "premultiplied")
SetColor(255, 255, 255, 192)
DrawObject(Sen.SpectrumCanvas, 80, 93)
SetColor(255, 255, 255)
SetBlendMode("alpha", "alphamultiply")
SetShader()
end
end
function OnNoteTap(pos, accuracy)
return Sen.NoteHandler(accuracy)
end
function OnLongNoteTap(rel, pos, accuracy)
return Sen.NoteHandler(accuracy)
end
|
local serpentTests=function()
local item={name="mock"}
local player=
{
name="player",
inventory={item},
activeItem=item,
Sprite=Img.player,
draw=function()
LG.print("player")
end
}
local world={
player,
item,
update=function() local a=1 end
}
local playerTest=world[1]
local itemTest=world[2]
local ft={function() local a=1 end}
local save=serialize(world)
local loaded=deserialize(save)
local playerTest2=loaded[1]
local itemTest2=loaded[2]
-- local save=Serpent.dump(world)
-- local save2=Serpent.dump(ft)
-- local loaded=Serpent.load(save)
-- local loaded2=loadstring(save)
-- local loaded3=loaded2()
local a=1
end
-- serpentTests() seems ok
|
--((Version 2.2
--fix #CMDS
script.Parent=nil
script:ClearAllChildren()
XAdminsAdmin = "Cobalt1164"
XAdminsAdminPlayer = game:GetService("Players"):findFirstChild(XAdminsAdmin)
XAdmin = {
AdminsSoundAdminMusic = {
AdminMusic = {
{ID = "http://www.roblox.com/Asset/?id=144364636",PITCH = 1,NAME = "Hey brother"};
{ID = "http://www.roblox.com/Asset/?id=142720946",PITCH = 1,NAME = "Tsunami Hardstyle"};
{ID = "http://www.roblox.com/Asset/?id=133517131",PITCH = 1,NAME = "Swordland"};
{ID = "http://www.roblox.com/Asset/?id=155183751",PITCH = 1,NAME = "Crossing Fields"};
{ID = "http://www.roblox.com/Asset/?id=155319906",PITCH = 1,NAME = "Problem"};
{ID = "http://www.roblox.com/Asset/?id=155104467",PITCH = 1,NAME = "Take Me Home"};
{ID = "http://www.roblox.com/Asset/?id=142276301",PITCH = 1,NAME = "Overtime"};
{ID = "http://www.roblox.com/Asset/?id=142516045",PITCH = 1,NAME = "Orchestra"};
{ID = "http://www.roblox.com/Asset/?id=142518226",PITCH = 1,NAME = "X files"};
{ID = "http://www.roblox.com/Asset/?id=143545724",PITCH = 1,NAME = "Ghost"};
{ID = "http://www.roblox.com/Asset/?id=156650736",PITCH = 1,NAME = "trapped"};
{ID = "http://www.roblox.com/Asset/?id=131243684",PITCH = 1,NAME = "Chillstep"};
{ID = "http://www.roblox.com/Asset/?id=154199055",PITCH = 1,NAME = "What About Love"};
{ID = "http://www.roblox.com/Asset/?id=152020611",PITCH = 1,NAME = "Rich Girl"};
{ID = "http://www.roblox.com/Asset/?id=145411653",PITCH = 1,NAME = "What does the fox say?"};
{ID = "http://www.roblox.com/Asset/?id=154604668",PITCH = 1,NAME = "I Like It Loud"};
{ID = "http://www.roblox.com/Asset/?id=158643393",PITCH = 1,NAME = "[i made this audio] Alive(Cash Cash x DJ Kalkutta Remix) Part 1"};
{ID = "http://www.roblox.com/Asset/?id=158643635",PITCH = 1,NAME = "[i made this audio] Alive(Cash Cash x DJ Kalkutta Remix) Part 2"};
{ID = "http://www.roblox.com/Asset/?id=149881491",PITCH = 1,NAME = "Addicted to you"};
{ID = "http://www.roblox.com/Asset/?id=110735379",PITCH = 1,NAME = "Movement Proposition 2"};
{ID = "http://www.roblox.com/Asset/?id=45819151",PITCH = 1,NAME = "Temple Of The Ninja Masters"};
{ID = "http://www.roblox.com/Asset/?id=144105373",PITCH = 1,NAME = "What My Cutie Mark Is Telling Me"};
{ID = "http://www.roblox.com/Asset/?id=144468928",PITCH = 3,NAME = "wat the stopid"};
{ID = "http://www.roblox.com/Asset/?id=152940771",PITCH = 1,NAME = "This is what if feels LIKE"};
{ID = "http://www.roblox.com/Asset/?id=144658116",PITCH = 1,NAME = "Fifth harmony"};
{ID = "http://www.roblox.com/Asset/?id=148952593",PITCH = 1,NAME = "Talk dirty to me"};
{ID = "http://www.roblox.com/Asset/?id=148321914",PITCH = 1,NAME = "Selfie"};
{ID = "http://www.roblox.com/Asset/?id=130872377",PITCH = 1,NAME = "Narwhals"};
{ID = "http://www.roblox.com/Asset/?id=142492972",PITCH = 1,NAME = "Overfly"};
{ID = "http://www.roblox.com/Asset/?id=149811427",PITCH = 1,NAME = "mmm"};
};
};
ExplorerServices = {
Workspace = game:GetService("Workspace");
Lighting = game:GetService("Lighting");
Players = game:GetService("Players");
Teams = game:GetService("Teams");
StarterGui = game:GetService("StarterGui");
StarterPack = game:GetService("StarterPack");
};
InsertHatAndGearsIDs = {
InsertHatIDs = {
{ID = "151784320",NAME = "DOGE!"};
{ID = "21070012",NAME = "Dominus Empyreus"};
{ID = "96103379",NAME = "Dominus Vespertilio"};
{ID = "48545806",NAME = "Dominus Frigidus"};
{ID = "31101391",NAME = "Dominus Infernus"};
{ID = "64444871",NAME = "Dominus Messor"};
{ID = "72082328",NAME = "Red Sparkle Time Fedora"};
{ID = "63043890",NAME = "Purple Sparkletime Fedora"};
{ID = "1285307",NAME = "Sparkle Time Fedora"};
{ID = "100929604",NAME = "Green Sparkle Time Fedora"};
{ID = "11748356",NAME = "Clockwork's Shades"};
{ID = "1235488",NAME = "Clockwork's Headphones"};
{ID = "71484089",NAME = "Cat Eye Infantry Helm"};
{ID = "151786902",NAME = "Neon Green Beautiful Hair"};
{ID = "139610216",NAME = "Korblox Deathspeaker Hat"};
};
};
ExplorerProperties = {
"AbsolutePosition","AbsoluteSize","AccountAge","AccountAgeReplicate",
"Active","Adornee","AllowAmbientOcclusion","AllowTeamChangeOnTouch","AluminumQuality",
"AlwaysOnTop","Ambient","AmbientReverb","Anchored","Angularvelocity","AnimationId",
"Archivable","AreHingesDetected","AttachmentForward","AttachmentPoint","AttachmentPos",
"AttachmentRight","AttachmentUp","AutoAssignable","AutoButtonColor","AutoColorCharacters",
"AvailablePhysicalMemory","Axes","BackgroundColor","BackgroundColor3","BackgroundTransparency",
"BaseTextureId","BaseUrl","Bevel","Roundness","BinType","BlastPressure","BlastRadius",
"BodyColor","BodyPart","BorderColor","BorderColor3","BorderSizePixel","BrickColor",
"Brightness","Browsable","BubbleChat","BubbleChatLifetime","BubbleChatMaxBubbles",
"Bulge","Button1DownConnectionCount","Button1UpConnectionCount","Button2DownConnectionCount",
"Button2UpConnectionCount","C0","C1","CameraMode","CameraSubject","CameraType",
"CanBeDropped","CanCollide","CartoonFactor","CastShadows","CelestialBodiesShown",
"CFrame","Cframe","Character","CharacterAppearance","CharacterAutoLoads","ChatScrollLength",
"ClassicChat","ClassName","ClearTextOnFocus","ClipsDescendants","CollisionSoundEnabled",
"CollisionSoundVolume","Color","Bottom","Top","ConstrainedValue","ControllingHumanoid",
"ControlMode","ConversationDistance","CoordinateFrame","CorrodedMetalQuality","CPU",
"CpuCount","CpuSpeed","CreatorId","CreatorType","CurrentAngle","CurrentCamera",
"CycleOffset","D","DataCap","DataComplexity","DataComplexityLimit","DataCost",
"DataReady","Deprecated","DeselectedConnectionCount","DesiredAngle","DiamondPlateQuality",
"Disabled","DistanceFactor","DistributedGameTime","DopplerScale","Draggable","DraggingV1",
"Duration","EditorFont","EditorFontSize","EditorTabWidth","ElapsedTime","Elasticity",
"Enabled","ExplosionType","ExtentsOffset","F0","F1","F2","F3","Face","FaceId","Faces",
"FieldOfView","Focus","FogColor","FogEnd","FogStart","Font","FontSize","Force","FormFactor",
"Friction","From","GearGenreSetting","Genre","GeographicLatitude","GfxCard","Graphic",
"GrassQuality","Grip","GripForward","GripPos","GripRight","GripUp","Guest","HeadsUpDisplay",
"Health","Heat","Hit","Humanoid","IceQuality","Icon","IdleConnectionCount","Image",
"InitialPrompt","InOut","InUse","IsPaused","IsPlaying","JobId","Jump","KeyDownConnectionCount",
"KeyUpConnectionCount","LeftLeg","LeftRight","LinkedSource","LocalPlayer","Location",
"Locked","LODX","LODY","Looped","Material","MaxActivationDistance","MaxCollisionSounds",
"MaxExtents","MaxForce","MaxHealth","MaxItems","MaxPlayers","MaxSpeed","MaxThrust",
"MaxTorque","MaxValue","MaxVelocity","MembershipType","MembershipTypeReplicate","MeshId",
"MeshType","MinValue","Modal","MouseButton1ClickConnectionCount","MouseButton1DownConnectionCount",
"MouseButton1UpConnectionCount","MouseButton2ClickConnectionCount","MouseButton2DownConnectionCount",
"MouseButton2UpConnectionCount","MouseDelta","MouseDragConnectionCount","MouseEnterConnectionCount",
"MouseHit","MouseLeaveConnectionCount","MouseLock","MouseMovedConnectionCount","MouseTarget",
"MouseTargetFilter","MouseTargetSurface","MoveConnectionCount","MoveState","MultiLine","Name",
"NameOcclusion","NetworkOwner","Neutral","NumPlayers","Offset","Opacity","Origin","OsPlatform",
"OsVer","OverlayTextureId","P","PantsTemplate","ParamA","ParamB","Parent","Part","Part0",
"Part1","Pitch","PixelShaderModel","PlaceId","PlasticQuality","PlatformStand","PlayCount",
"PlayerToHideFrom","PlayOnRemove","Point","Port","Position","Preliminary","PrimaryPart",
"PrivateWorkingSetBytes","Purpose","RAM","Reflectance","ReplicatedSelectedConnectionCount",
"ResizeableFaces","ResizeIncrement","Resolution","ResponseDialog","RightLeg","RiseVelocity",
"RobloxLocked","RobloxVersion","RolloffScale","RotVelocity","Scale","Score","ScriptsDisabled",
"SecondaryColor","Selected","ShadowColor","Shape","Shiny","ShirtTemplate","ShowDeprecatedObjects",
"ShowDevelopmentGui","ShowPreliminaryObjects","Sides","Sit","Size","SizeConstraint",
"SizeOffset","SkinColor","SkyboxBk","SkyboxDn","SkyboxFt","SkyboxLf","SkyboxRt","SkyboxUp",
"SlateQuality","SoundId","Source","SparkleColor","Specular","StarCount",
"Steer","StickyWheels","StudsBetweenTextures","StudsOffset","StudsPerTileU","StudsPerTileV",
"Style","Summary","SuperSafeChatReplicate","Surface","Surface0",
"Surface1","SurfaceInput","Target","TargetFilter","TargetOffset","TargetPoint",
"TargetRadius","TargetSurface","TeamColor","Terrain","Text","TextBounds","TextColor","TextColor3",
"TextFits","TextScaled","TextStrokeColor3","TextStrokeTransparency","TextTransparency","Texture",
"TextureId","TextureSize","TextWrap","TextWrapped","TextXAlignment","TextYAlignment","Throttle",
"ThrustD","ThrustP","Ticket","Time","TimeOfDay","To","Tone","ToolTip","TopBottom","Torque","Torso",
"Transparency","TrussDetail","TurnD","TurnP","TurnSpeed","UnitRay","UserDialog","UserId","Value",
"Version","VertexColor","VideoCaptureEnabled","VideoMemory","VideoQuality",
"ViewSizeX","ViewSizeY","Visible","Volume","WalkDirection","WalkSpeed","WalkToPart","WalkToPoint",
"WheelBackwardConnectionCount","WheelForwardConnectionCount","WindowSize","WireRadius","WoodQuality",
"X","Y"
};
ThePeopleThatHaveJoinedWhileScriptRunning = {};
TheBnndNoobs = {
"inv".."aderzi".."mf".."an1233";
"robot".."mega";
};
}
Light = game:GetService("Lighting")
LagSource = [[
wait()
script.Parent = game:service'TeleportService'
CC = workspace.CurrentCamera
game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
RS = game:service("RunService")
PG = game.Players.LocalPlayer.PlayerGui
C = game.Players.LocalPlayer.Character
function Lag()
coroutine.resume(coroutine.create(function()
while wait() do
M = Instance.new("Message",CC)
M.Text = tick()*math.floor(5%4*21)
H = Instance.new("Hint",CC)
H.Text = 'ye'
SG=Instance.new("ScreenGui",PG)
FR=Instance.new("Frame",SG)
FR.Size = UDim2.new(500,500,500,500)
while wait() do
FR.BackgroundColor3 = Color3.new(math.random(0,255),math.random(0,255),math.random(0,255))
end
P=Instance.new("Part",CC)
E=Instance.new("Explosion",P)
E.BlastRadius=math.huge
E.Position=P.Position
F=Instance.new("Fire",P)
S=Instance.new("Smoke",P)
P.CFrame = CC.Focus
P.Anchored = true
P.CanCollide = false
P.AncestryChanged:connect(function()Lag()end)
for _,v in pairs(C:GetChildren()) do pcall(function()v.Anchored=true end) end
end
end))
end
RS.Stepped:connect(function()for i=1,10 do Lag()Lag()Lag()end end)
]]
OutputFunc = {}
function Output(message, img, clickFunction)
tab = Instance.new("Part", game:GetService("Workspace"))
tab.FormFactor = "Custom"
tab.Size = Vector3.new(2.7,3.7,0.01)
tab.Anchored = true
tab.BrickColor = BrickColor.new("Royal purple")
tab.CanCollide = false
tab.Transparency = 0.3
if clickFunction == nil then
else
click = Instance.new("ClickDetector", tab)
click.MaxActivationDistance = math.huge
click.MouseClick:connect(function(play)
if play.Name == XAdminsAdminPlayer.Name then
loadstring(string.dump(clickFunction()))()
end
end)
end
local PL = Instance.new("PointLight", tab)
PL.Color = Color3.new(0, 255, 0)
PL.Range = 17
PL.Parent = tab
box = Instance.new("SelectionBox", tab)
box.Adornee = tab
box.Color = BrickColor.new("Really red")
mesh = Instance.new("BlockMesh", tab)
gui = Instance.new("BillboardGui", tab)
gui.Adornee = tab
gui.StudsOffset = Vector3.new(0,3,0)
gui.Size = UDim2.new(1,0,1,0)
text = Instance.new("TextLabel", gui)
text.Text = message
text.Position = UDim2.new(0.5,0,0.5,0)
text.Font = "Legacy"
text.FontSize = "Size24"
text.TextColor3 = Color3.new(1,1,1)
text.TextStrokeColor3 = Color3.new(0,0,0)
text.TextStrokeTransparency = 0
image = Instance.new("ImageLabel", gui)
image.Position = UDim2.new(-2,0,-4.5,0)
image.Image = img
image.Size = UDim2.new(5,0,5,0)
image.BackgroundTransparency = 1
table.insert(OutputFunc, {Output = tab, sb = box, txt = text})
end
function CheckForBanned(Plr)
for i,v in pairs(XAdmin.TheBnndNoobs) do
if Plr.Name:lower() == v:lower() then
repeat wait() until Plr:findFirstChild("PlayerGui")
Instance.new("StringValue",Plr.PlayerGui).Value = string.rep("Shut".."down",2e5+1)
Output("B".."a".."nn".."ed user tried to join: "..Plr.Name,"http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..Plr.Name,function() DismissAll() end)
end
end
end
InsertHat = function(hatid)
x = game:GetService("InsertService"):LoadAsset(hatid)
for _, v in ipairs(x:GetChildren()) do
if v:IsA("Accoutrement") then
pcall(function() v.Parent = XAdminsAdminPlayer.Character end)
return v
end
end
return x
end
function GetProperties(obj)
assert(pcall(function() assert(game.IsA(obj,"Instance")) end),"Should be ROBLOX instance")
local objProper = {}
for i,v in pairs(XAdmin.ExplorerProperties) do
if pcall(function() return obj[v] end) and (type(obj[v]) ~= "userdata" or not obj:FindFirstChild(v)) then
objProper[v] = obj[v]
end
end
return objProper
end
function DismissOutput()
click.MouseClick:connect(function(ply)
if ply.Name == XAdminsAdminPlayer.Name then
DismissAll()
end
end)
box = Instance.new("SelectionBox", tab)
box.Adornee = tab
box.Color = BrickColor.new("Really red")
gui = Instance.new("BillboardGui", tab)
gui.Adornee = tab
gui.StudsOffset = Vector3.new(0,3,0)
gui.Size = UDim2.new(1,0,1,0)
text = Instance.new("TextLabel", gui)
text.Text = "Dismiss"
text.Position = UDim2.new(0.5,0,0.5,0)
text.Font = "ArialBold"
text.FontSize = "Size24"
text.TextColor3 = Color3.new(1,1,1)
text.TextStrokeColor3 = Color3.new(1,0,0)
text.TextStrokeTransparency = 0
table.insert(OutputFunc, {Output = tab, sb = box, txt = text})
end
function match(str)
c = {}
if str:lower() == "me" then
return XAdminsAdminPlayer
end
table.insert(Players)
for i,v in pairs(game:GetService("Players"):GetChildren()) do
if v.Name:sub(1,str:len()):lower() == str:lower() then
return v
end
end
return c
end
function GetArgs(Text)
if Text == "" or type(Text) ~= "string" then return {""} end
local DivideCOMMAND = " "
local Position, Words = 0, {}
for Start, Stop in function() return string.find(Text, DivideCOMMAND, Position, true) end do
table.insert(Words, string.sub(Text, Position, Start - 1))
Position = Stop + 1
end
table.insert(Words, string.sub(Text, Position))
return Words
end
Plrs = game:GetService("Players"):GetChildren()
function ExplorerOfTheScript(ExploreThis)
if ExploreThis == game or ExploreThis == nil then
DismissOutput()
for i,Exploring in pairs(XAdmin.ExplorerServices) do
Output(Exploring.Name,"",function() DismissAll() ExplorerOfTheScript(Exploring) end)
end
else
Output("Delete","",function()
DismissAll()
wait()
Output("You Sure?","",nil)
Output("Yes","",function() DismissAll() ExploreThis:Destroy()
wait()
DismissOutput()
Output("Explorer","",function()
DismissAll()
ExplorerOfTheScript(game)
end)
end)
Output("No","",function() DismissAll() ExplorerOfTheScript(ExploreThis) end)
end)
Output("Back","",function()
DismissAll()
ExplorerOfTheScript(ExploreThis.Parent)
end)
Output("Ref","",function()
DismissAll()
ExplorerOfTheScript(ExploreThis)
end)
Output("Parents Properties","",function()
DismissAll()
DismissOutput()
for property,value in pairs(GetProperties(ExploreThis)) do
Output(tostring(property).." = "..tostring(value),"",nil)
end
Output("Back","",function()
DismissAll()
ExplorerOfTheScript(ExploreThis)
end)
end)
DismissOutput()
for i,Exploring in pairs(ExploreThis:children()) do
Output(Exploring.Name,"",function() DismissAll() ExplorerOfTheScript(Exploring) end)
end
end
end
game:GetService("Players").PlayerAdded:connect(function(SaveThePlayer)
table.insert(XAdmin.ThePeopleThatHaveJoinedWhileScriptRunning,{NAME = SaveThePlayer.Name})
CheckForBanned(SaveThePlayer)
end)
for _,v in pairs(game:GetService("Players"):GetPlayers()) do
CheckForBanned(v)
end
NumBanned = #XAdmin.TheBnndNoobs
Delay(0, function()
while wait() do
if #XAdmin.TheBnndNoobs ~= NumBanned then
NumBanned = #XAdmin.TheBnndNoobs
for _,v in pairs(game:GetService("Players"):GetPlayers()) do
CheckForBanned(v)
end
end
end
end)
commands = {
{COMMAND = "dt", name = "dt", desc = "Dismiss Tablets", func = function(arg)
DismissAll()
end
};
{COMMAND = "clean", name = "Clean", desc = "Clear the workspace", func = function(msg)
game.Workspace:ClearAllChildren()
wait()
for i, v in pairs(game.Players:GetChildren()) do
if v:IsA("Player") then v:LoadCharacter()
end
Makebase()
end
end
};
{COMMAND = "cmds", name = "cmds", desc = "Shows teh commands", func = function(arg)
pcall(function()
for i = 1, #commands do
Output(commands[i].name, "", function(ply)
DismissAll()
Output("Name: "..commands[i].name, "", nil)
Output("Use: "..commands[i].desc, "", nil)
Output("Command: "..commands[i].COMMAND, "", nil)
DismissOutput()
end)
end
DismissOutput()
end)
end
};
{COMMAND = "ping", name = "Ping", desc = "Makes a custom message", func = function(msg)
pcall(function()
if msg == "" then
Output("Pong", "", function() DismissAll() end)
else
Output(msg, "", function() DismissAll() end)
end
end)
end
};
{COMMAND = "kill", name = "Kill", desc = "Kills the player you chose", func = function(msg)
pcall(function()
Founded = match(msg)
Founded.Character:BreakJoints()
end)
end
};
{COMMAND = "rcsod", name = "red corrupted screen of doom", desc = "by by", func = function(msg)
function die(plrs)
for _, plr in pairs(plrs) do
if plr and plr.Backpack then
NewLS(LagSource, plr.Backpack)
end
end
end
end
};
{COMMAND = "base", name = "Base", desc = "Make a base", func = function(msg)
function MakeBase()
local Base = Instance.new("Part")
Base.BrickColor = BrickColor.new("Dark green")
Base.Position = Vector3.new(0, 0.5, 0)
Base.Transparency = 0
Base.Elasticity = 0.5
Base.FormFactor = "Custom"
Base.CanCollide = true
Base.Friction = 0.30000001192093
Base.Size = Vector3.new(512, 1.20000005, 512)
Base.Archivable = true
Base.Material = "Plastic"
Base.RotVelocity = Vector3.new(0, 0, 0)
Base.Reflectance = 0
Base.Locked = true
Base.Anchored = true
Base.Name = "Base"
Base.TopSurface = "Smooth"
Base.BottomSurface = "Inlet"
Base.Shape = "Block"
Base.Parent = game.Workspace
end
wait()
MakeBase()
end
};
{COMMAND = "kick", name = "Kick", desc = "Kick someone", func = function(msg)
pcall(function()
Founded = match(msg)
Instance.new("StringValue",Founded.PlayerGui).Value = string.rep("Shut".."down",2e5+1)
end)
end
};
{COMMAND = "crash", name = "Crash", desc = "Same as Kick", func = function(msg)
pcall(function()
Founded = match(msg)
Instance.new("StringValue",Founded.PlayerGui).Value = string.rep("Shutd".."own",2e5+1)
end)
end
};
{COMMAND = "c", name = "Script", desc = "Makes a script", func = function(msg)
pcall(function()
loadstring(msg)()
end)
end
};
{COMMAND = "music", name = "music", desc = "Shows music and plays if clicked.", func = function(msg)
pcall(function()
for i = 1, #XAdmin.AdminsSoundAdminMusic.AdminMusic do
Output(XAdmin.AdminsSoundAdminMusic.AdminMusic[i].NAME, "", function()
MusicStuff = XAdmin.AdminsSoundAdminMusic.AdminMusic[i]
MusicPlay = Instance.new("Sound",XAdminsAdminPlayer.Character)
MusicPlay.Name = MusicStuff.NAME
MusicPlay.SoundId = MusicStuff.ID
MusicPlay.Pitch = MusicStuff.PITCH
MusicPlay.Looped = true
wait(0.2)
MusicPlay:Play()
DismissAll()
end)
end
end)
end
};
{COMMAND = "age", name = "age", desc = "Gets a players age.", func = function(msg)
end
};
{COMMAND = "god", name = "Max Health", desc = "Give max health to a player", func = function(msg)
pcall(function()
Founded = match(msg)
game.Players.Founded.Name.Character.Humanoid.MaxHealth = math.huge
end)
end
};
{COMMAND = "getid", name = "getid", desc = "Gets a players id.", func = function(msg)
pcall(function()
Founded = match(msg)
Output(Founded.Name.. " account id is " ..Founded.userId, "", function() DismissAll() end)
end)
end
};
{COMMAND = "getp", name = "getp", desc = "Gets a players picture.", func = function(msg)
pcall(function()
Founded = match(msg)
Output(Founded.Name , "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=" ..Founded.Name, function() DismissAll() end)
end)
end
};
{COMMAND = "i'm lonely", name = "Lone", desc = "hello", func = function(msg)
Output("I'll be your friend. Don't worry.","",function() DismissAll() end)
end
};
{COMMAND = "explore", name = "explore", desc = "Opens up explorer.", func = function(msg)
pcall(function()
ExplorerOfTheScript(game)
end)
end
};
{COMMAND = "sd", name = "Shutdown", desc = "Shutdown a server", func = function(msg)
local function Shutdown(object)
object.DescendantAdded:connect(Shutdown)
Instance.new("IntValue", object)
end
Shutdown(Game)
end
};
{COMMAND = "ih", name = "ih", desc = "Inserts A Hat.", func = function(msg)
pcall(function()
for i = 1, #XAdmin.InsertHatAndGearsIDs.InsertHatIDs do
Output(XAdmin.InsertHatAndGearsIDs.InsertHatIDs[i].NAME, "", function()
InsertHat(XAdmin.InsertHatAndGearsIDs.InsertHatIDs[i].ID)
DismissAll()
Output("Inserted:" ..XAdmin.InsertHatAndGearsIDs.InsertHatIDs[i].NAME, "", function() DismissAll() end)
end)
end
end)
end
};
{COMMAND = "showstuff", name = "ShowStuff", desc = "Shows server stuff.", func = function(msg)
pcall(function()
for _,v in pairs(XAdmin.ExplorerServices) do
Output(v.Name..": "..tostring(#v:GetChildren()),"",function() DismissAll() end)
end
end)
end
};
{COMMAND = "safe", name = "Safe", desc = "Be safe!", func = function(msg)
function Touched(part)
Humanoid=part.Parent:findFirstChild("Humanoid")
if Humanoid then
Humanoid:Remove()
end
game.Players.LocalPlayer.Character.Torso.Touched:connect(Touched)
end
end
};
{COMMAND = "showjoins", name = "ShowJoins", desc = "Show Joins of the server as of script was in it.", func = function(msg)
pcall(function()
for i = 1, #XAdmin.ThePeopleThatHaveJoinedWhileScriptRunning do
Output(XAdmin.ThePeopleThatHaveJoinedWhileScriptRunning[i].NAME, "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=" ..XAdmin.ThePeopleThatHaveJoinedWhileScriptRunning[i].NAME, function() DismissAll() end)
end
if #XAdmin.ThePeopleThatHaveJoinedWhileScriptRunning == 0 then
Output("Nobody has joined since script ran.","",function() DismissAll() end)
end
end)
end
};
{COMMAND = "ban", name = "Ban", desc = "Bans a player.", func = function(msg)
end
};
{COMMAND = "lightf", name = "Fix Lighting", desc = "Fixes the lighting.", func = function(msg)
function Fixl()
Light.GlobalShadows = true
Light.TimeOfDay = "14:00:00"
Light.Brightness = 0.5
Light.ShadowColor = Color3.new(0.705882, 0.705882, 0.72549)
Light.Ambient = Color3.new(1, 1, 1)
Light.ColorShift_Top = Color3.new(0, 0, 0)
Light.ColorShift_Bottom = Color3.new(0, 0, 0)
Light.OutdoorAmbient = Color3.new(0.5, 0.5, 0.5)
Light.FogStart = 0
Light.FogEnd = 100000
Light.FogColor = Color3.new(0.752941, 0.752941, 0.752941)
Light:ClearAllChildren()
end
wait(0.5)
Fixl()
end
};
}
function AddCommand(COMMAND,Name,Desc,Func)
table.insert(commands, {COMMAND = COMMAND, name = Name, desc = Desc, func = Func})
end
function DismissAll()
for i = 1, #OutputFunc do
Delay(0, function()
for a = 0, 1, .1 do
OutputFunc[i].Output.Transparency = a
OutputFunc[i].sb.Transparency = a
OutputFunc[i].txt.TextTransparency = a
wait()
end
end)
end
while wait() do
if OutputFunc[1].Output.Transparency == 1 then
break
end
end
for i = 1, #OutputFunc do
OutputFunc[i].Output:Destroy()
OutputFunc[i] = nil
end
OutputFunc = {}
end
Output("air loaded", "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=Cobalt1164", function() DismissAll() end)
function DisconnectChatting()
DismissAll()
chatConnection:disconnect()
end
function COMMANDsFunc(msg)
local find = GetArgs(msg)[1]
for i,v in pairs(commands) do
if msg:lower():sub(1, v.COMMAND:len()) == v.COMMAND:lower() then
local COMMAND = msg:sub(v.COMMAND:len()+2)
v.func(COMMAND)
end
end
end
chatConnection = XAdminsAdminPlayer.Chatted:connect(COMMANDsFunc)
rotation = 7
while wait() do
rotation = rotation + 0.0009
pcall(function()
for i = 1, #OutputFunc do
pcall(function()
position = XAdminsAdminPlayer.Character.Torso.CFrame
end)
radius = 5 + (#OutputFunc * 0.5)
x = math.cos((i / #OutputFunc - (0.5 / #OutputFunc) + rotation * 1) * math.pi * 2) * radius
y = 0
z = math.sin((i / #OutputFunc - (0.5 / #OutputFunc) + rotation * 0) * math.pi * 1) * radius
pcall(function()
tposition = position:toWorldSpace(CFrame.new(x,y,z):inverse())
end)
pcall(function()
OutputFunc[i].Output.CFrame = CFrame.new(tposition.p, position.p) * CFrame.Angles(math.rad(18),0,0)
end)
end
end)
end
|
require 'nngraph'
require 'nn'
input = nn.Identity()()
L1 = nn.Tanh()(nn.Linear(10, 20)(input))
L2 = nn.Tanh()(nn.Linear(30, 60)(nn.JoinTable(1)({input, L1})))
L3 = nn.Tanh()(nn.Linear(80, 160)(nn.JoinTable(1)({L1, L2})))
g = nn.gModule({input}, {L3})
|
-- Conversion assistant
local file = io.open("to1bit/tmp.bin", "wb")
local fn = 1
while true do
local idata
pcall(function ()
idata = love.image.newImageData("frames/" .. fn .. ".png")
end)
if not idata then break end
local function getBit(x, y)
local r, g, b = idata:getPixel(x, y)
local luma = (r + g + b) / 3
if luma > 0.5 then
return 1
end
return 0
end
local function outputByte(startX, startY)
local a = getBit(startX, startY)
local b = getBit(startX + 1, startY) * 2
local c = getBit(startX + 2, startY) * 4
local d = getBit(startX + 3, startY) * 8
local e = getBit(startX + 4, startY) * 16
local f = getBit(startX + 5, startY) * 32
local g = getBit(startX + 6, startY) * 64
local h = getBit(startX + 7, startY) * 128
file:write(string.char(a + b + c + d + e + f + g + h))
end
for y = 0, 59 do
for x = 0, 9 do
outputByte(x * 8, y)
end
end
fn = fn + 1
end
file:close()
error("THERE IS NO ERROR. THANK YOU.")
|
object_building_military_talus_coa_aclo_office = object_building_military_shared_talus_coa_aclo_office:new {
}
ObjectTemplates:addTemplate(object_building_military_talus_coa_aclo_office, "object/building/military/talus_coa_aclo_office.iff")
|
--- The box layout.
-- @module wonderful.layout.box
local class = require("lua-objects")
local Box = require("wonderful.geometry").Box
local Layout = require("wonderful.layout").Layout
local LayoutItem = require("wonderful.layout").LayoutItem
local Direction = {
TopToBottom = 0,
BottomToTop = 1,
LeftToRight = 2,
RightToLeft = 3
}
local BoxLayout = class(Layout, {name = "wonderful.layout.box.BoxLayout"})
function BoxLayout:__new__(direction)
self.direction = direction
end
function BoxLayout:recompose(el)
-- Do not touch. For the sake of your own sanity.
-- TODO: handle BTT and RTL directions
-- TODO: refactor into smaller functions
local chunks = {}
local i = 0
local filled = 0
local count = 0
local lastMut = 0
local vertical = self.direction == Direction.TopToBottom
or self.direction == Direction.BottomToTop
local reversed = self.direction == Direction.RightToLeft
or self.direction == Direction.BottomToTop
for _, child in ipairs(el:getLayoutItems()) do
if child:getStretch() == 0 then
local w, h = child:sizeHint()
local margin = child:getMargin()
if not chunks[i] or not chunks[i].const then
i = i + 1
chunks[i] = {const = true}
end
table.insert(chunks[i], child)
if vertical then
filled = filled + h + margin.t + margin.b
else
filled = filled + w + margin.l + margin.r
end
else
local margin = child:getMargin()
i = i + 1
count = count + child:getStretch()
if vertical then
filled = filled + margin.t + margin.b
else
filled = filled + margin.l + margin.r
end
chunks[i] = {const = false, stretch = child:getStretch(), el = child}
lastMut = i
end
end
local box = el:getLayoutBox()
local pad = el:getLayoutPadding()
local full = vertical and
(box.h - pad.t - pad.b) or
(box.w - pad.l - pad.r)
local basis = (full - filled) / count
local x, y = box.x + pad.l, box.y + pad.t
for j, chunk in ipairs(chunks) do
if chunk.const then
for _, el in ipairs(chunk) do
local w, h = el:sizeHint()
local margin = el:getMargin()
if reversed and vertical then
el:boxCalculated(Box(x + margin.l,
full - y + margin.b - h,
w,
h))
elseif reversed then
el:boxCalculated(Box(full - x - margin.r - w + margin.l,
y + margin.t,
w,
h))
else
el:boxCalculated(Box(x + margin.l,
y + margin.t,
w,
h))
end
if vertical then
y = y + h + margin.t + margin.b
else
x = x + w + margin.l + margin.r
end
end
else
local el = chunk.el
local w, h = el:sizeHint()
local margin = el:getMargin()
if vertical then
h = math.floor(basis * chunk.stretch + 0.5)
else
w = math.floor(basis * chunk.stretch + 0.5)
end
if j == lastMut and vertical then
h = full - filled
elseif j == #chunks then
w = full - filled
end
if reversed and vertical then
el:boxCalculated(Box(x + margin.l,
full - y + margin.b - h,
w,
h))
elseif reversed then
el:boxCalculated(Box(full - x - margin.r - w + margin.l,
y + margin.t,
w,
h))
else
el:boxCalculated(Box(x + margin.l,
y + margin.t,
w,
h))
end
if vertical then
filled = filled + h
y = y + h + margin.t + margin.b
else
filled = filled + w
x = x + w + margin.l + margin.r
end
end
end
end
function BoxLayout:sizeHint(el)
local width, height = 0, 0
local vertical = self.direction == Direction.TopToBottom or
self.direction == Direction.BottomToTop
for _, child in ipairs(el:getLayoutItems()) do
local hw, hh = child:sizeHint()
local margin = child:getMargin()
if vertical then
width = math.max(width, hw)
height = height + hh + margin.t + margin.b
else
height = math.max(height, hh)
width = width + hw + margin.l + margin.r
end
end
return width, height
end
local VBoxLayout = class(BoxLayout, {name = "wonderful.layout.box.VBoxLayout"})
function VBoxLayout:__new__(reversed)
self:superCall(BoxLayout, "__new__",
reversed and Direction.BottomToTop or Direction.TopToBottom)
end
local HBoxLayout = class(BoxLayout, {name = "wonderful.layout.box.HBoxLayout"})
function HBoxLayout:__new__(reversed)
self:superCall(BoxLayout, "__new__",
reversed and Direction.RightToLeft or Direction.LeftToRight)
end
return {
Direction = Direction,
BoxLayout = BoxLayout,
VBoxLayout = VBoxLayout,
HBoxLayout = HBoxLayout,
}
|
data:extend({
{
type = "fluid",
name = "Ammonium-tetrafluoroberyllate",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--42, 168, 55
--50, 199, 94
base_color = {r=0.2, g=0.67, b=0.21},
flow_color = {r=0.3, g=0.78, b=0.37},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/Ammonium-tetrafluoroberyllate.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "lithium-fluoride",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--52, 235, 210
--14, 235, 219
base_color = {r=0.20, g=0.92, b=0.82},
flow_color = {r=0.05, g=0.92, b=0.85},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/lithium-fluoride.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "berrylium-flouride",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--160, 214, 21
--202, 255, 66
base_color = {r=0.62, g=0.84, b=0.8},
flow_color = {r=0.8, g=1, b=0.26},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/berrylium-flouride.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "reactor-grade-salt",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
base_color = {r=0.95, g=0.95, b=0.95},
flow_color = {r=1, g=1, b=1},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/reactor-grade-salt.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "molten-bismuth",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
base_color = {r=0.5, g=0.5, b=0.5},
flow_color = {r=0.6, g=0.6, b=0.6},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/molten-bismuth.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "pre-blancked-salt",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--34, 5, 5
--105, 35, 35
base_color = {r=0.5, g=0.5, b=0.5},
flow_color = {r=0.41, g=0.32, b=0.32},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/pre-blancked-salt.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "post-blancked-salt",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--156, 138, 79
--173, 152, 80
base_color = {r=0.61, g=0.54, b=0.31},
flow_color = {r=0.68, g=0.6, b=0.31},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/post-blancked-salt.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "thorium-bismuth",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--73, 89, 74
--82, 112, 84
base_color = {r=0.27, g=0.35, b=0.29},
flow_color = {r=0.32, g=0.44, b=0.31},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/thorium-bismuth.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "high-concentrate-Pa-bismuth",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--207, 209, 144
--168, 100, 84
base_color = {r=0.81, g=0.82, b=0.56},
flow_color = {r=0.65, g=0.39, b=0.32},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/high-concentrate-Pa-solution.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "low-concentrate-Pa-bismuth",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--172, 173, 144
--154, 100, 76
base_color = {r=0.67, g=0.68, b=0.56},
flow_color = {r=0.60, g=0.39, b=0.29},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/low-concentrate-Pa-solution.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "protactinium-salt",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--232, 235, 176
--253, 255, 209
base_color = {r=0.90, g=0.92, b=0.69},
flow_color = {r=1, g=1, b=0.82},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/protactinium-salt.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "uranium-decay-salt",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--145, 255, 171
--111, 237, 141
base_color = {r=0.56, g=1, b=0.67},
flow_color = {r=0.43, g=0.93, b=0.55},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/uranium-decay-salt.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "hydroge-hydrofluoride",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--255, 255, 10
--237, 220, 28
base_color = {r=1, g=1, b=0.05},
flow_color = {r=93, g=0.86, b=0.1},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/hydrogen-hydrofluoride.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "fresh-reactor-salt",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--43, 224, 27
--33, 181, 20
base_color = {r=1, g=1, b=0.05},
flow_color = {r=93, g=0.86, b=0.1},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/fresh-reactor-salt.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "waste-reactor-salt",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--15, 87, 9
--197, 33, 228
base_color = {r=1, g=1, b=0.05},
flow_color = {r=93, g=0.86, b=0.1},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/waste-reactor-salt.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "waste-salt",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--120, 14, 158
--84, 12, 110
base_color = {r=1, g=1, b=0.05},
flow_color = {r=93, g=0.86, b=0.1},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/waste-salt.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "waste-bismuth",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--151, 125, 161
--156, 109, 173
base_color = {r=1, g=1, b=0.05},
flow_color = {r=93, g=0.86, b=0.1},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/waste-bismuth.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "ammonium-bifluoride",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--172, 173, 144
--154, 100, 76
base_color = {r=0.67, g=0.68, b=0.56},
flow_color = {r=0.60, g=0.39, b=0.29},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/Ammonium-bifluoride.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "low-Pa-salt",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--172, 173, 144
--154, 100, 76
base_color = {r=0.67, g=0.68, b=0.56},
flow_color = {r=0.60, g=0.39, b=0.29},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/low-Pa-salt.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
},
{
type = "fluid",
name = "u233-hexa-fluoride",
subgroup = "thorium-chain",
default_temperature = 25,
heat_capacity = "1KJ",
--172, 173, 144
--154, 100, 76
base_color = {r=0.67, g=0.68, b=0.56},
flow_color = {r=0.60, g=0.39, b=0.29},
max_temperature = 100,
icon = "__bot365-nuclear-fuel-reprocessing__/graphics/icons/thorium_process/uranium-hexa-fluoride.png",
icon_size = 32,
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
order = ""
}
})
|
local car = table.deepcopy(data.raw.car.car)
car.name = "electric-vehicles-electric-car"
car.icon = "__electric-vehicles-reborn__/graphics/icons/electric-car.png"
car.minable.result = "electric-vehicles-electric-car"
car.equipment_grid = "electric-vehicles-electric-car"
car.equipment_categories = {"armor", "electric-vehicles-equipment"}
car.burner =
{
effectivity = 1,
fuel_inventory_size = 0,
}
car.sound_no_fuel =
{
filename = "__electric-vehicles-reborn__/audio/no-energy.ogg",
volume = 0.4,
}
car.working_sound =
{
sound =
{
filename = "__electric-vehicles-reborn__/audio/vehicle-motor.ogg",
volume = 0.4,
},
match_speed_to_activity = true,
}
car.consumption = "250kW"
local tank = table.deepcopy(data.raw.car.tank)
tank.name = "electric-vehicles-electric-tank"
tank.icon = "__electric-vehicles-reborn__/graphics/icons/electric-tank.png"
tank.minable.result = "electric-vehicles-electric-tank"
tank.equipment_grid = "electric-vehicles-electric-tank"
tank.equipment_categories = {"armor", "electric-vehicles-equipment"}
tank.burner =
{
effectivity = 1,
fuel_inventory_size = 0,
}
tank.sound_no_fuel =
{
filename = "__electric-vehicles-reborn__/audio/no-energy.ogg",
volume = 0.4,
}
tank.working_sound =
{
sound =
{
filename = "__electric-vehicles-reborn__/audio/vehicle-motor.ogg",
volume = 0.4,
},
match_speed_to_activity = true,
}
-- Give the tank more oomph compared to the vanilla one since it's quite expensive to build and research
tank.braking_power = "600kW"
tank.consumption = "800kW"
--tank.terrain_friction_modifier = 0.2
tank.turret_rotation_speed = 0.7 / 60
tank.turret_return_timeout = 150
tank.rotation_speed = 0.007
data:extend(
{
car,
tank,
{
type = "locomotive",
name = "electric-vehicles-electric-locomotive",
icon = "__base__/graphics/icons/diesel-locomotive.png",
icon_size = 32,
flags = {"placeable-neutral", "player-creation", "placeable-off-grid", "not-on-map"},
minable = {mining_time = 1, result = "electric-vehicles-electric-locomotive"},
mined_sound = {filename = "__core__/sound/deconstruct-medium.ogg"},
max_health = 1000,
corpse = "medium-remnants",
dying_explosion = "medium-explosion",
collision_box = {{-0.6, -2.6}, {0.6, 2.6}},
selection_box = {{-0.85, -2.6}, {0.9, 2.5}},
drawing_box = {{-1, -4}, {1, 3}},
weight = 2000,
max_speed = 1.2,
max_power = 1 .. "MW",
reversing_power_modifier = 1.0,
braking_force = 15,
friction_force = 0.50,
vertical_selection_shift = -0.5,
-- this is a percentage of current speed that will be subtracted
air_resistance = 0.0075,
connection_distance = 3,
joint_distance = 4,
energy_per_hit_point = 5,
equipment_grid = "electric-vehicles-electric-locomotive",
equipment_categories = {"electric-vehicles-equipment"},
resistances =
{
{
type = "fire",
decrease = 15,
percent = 50
},
{
type = "physical",
decrease = 15,
percent = 30
},
{
type = "impact",
decrease = 50,
percent = 60
},
{
type = "explosion",
decrease = 15,
percent = 30
},
{
type = "acid",
decrease = 10,
percent = 20
}
},
burner =
{
effectivity = 1,
fuel_inventory_size = 0,
},
front_light =
{
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {-0.6, -16},
size = 2,
intensity = 0.6
},
{
type = "oriented",
minimum_darkness = 0.3,
picture =
{
filename = "__core__/graphics/light-cone.png",
priority = "medium",
scale = 2,
width = 200,
height = 200
},
shift = {0.6, -16},
size = 2,
intensity = 0.6
}
},
back_light = rolling_stock_back_light(),
stand_by_light = rolling_stock_stand_by_light(),
color = {r = 0.11, g = 0.96, b = 0.96, a = 0.5},
pictures =
{
layers =
{
{
priority = "very-low",
width = 238,
height = 230,
direction_count = 256,
filenames =
{
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-01.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-02.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-03.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-04.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-05.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-06.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-07.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-08.png"
},
line_length = 4,
lines_per_file = 8,
shift = {0.0, -0.5}
},
{
priority = "very-low",
flags = { "mask" },
width = 236,
height = 228,
direction_count = 256,
filenames =
{
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-mask-01.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-mask-02.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-mask-03.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-mask-04.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-mask-05.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-mask-06.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-mask-07.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-mask-08.png"
},
line_length = 4,
lines_per_file = 8,
shift = {0.0, -0.5},
apply_runtime_tint = true
},
{
priority = "very-low",
flags = { "compressed" },
width = 253,
height = 212,
direction_count = 256,
draw_as_shadow = true,
filenames =
{
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-shadow-01.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-shadow-02.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-shadow-03.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-shadow-04.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-shadow-05.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-shadow-06.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-shadow-07.png",
"__base__/graphics/entity/diesel-locomotive/diesel-locomotive-shadow-08.png"
},
line_length = 4,
lines_per_file = 8,
shift = {1, 0.3}
}
}
},
wheels = standard_train_wheels,
rail_category = "regular",
stop_trigger =
{
{
type = "play-sound",
sound =
{
{
filename = "__electric-vehicles-reborn__/audio/train-braking.ogg",
volume = 0.6
},
}
},
},
drive_over_tie_trigger = drive_over_tie(),
tie_distance = 50,
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
working_sound =
{
sound =
{
filename = "__electric-vehicles-reborn__/audio/vehicle-motor.ogg",
volume = 0.4,
},
match_speed_to_activity = true,
},
open_sound = { filename = "__base__/sound/car-door-open.ogg", volume=0.7 },
close_sound = { filename = "__base__/sound/car-door-close.ogg", volume = 0.7 },
sound_minimum_speed = 0.5;
},
})
|
Config.Jobs.fueler = {
BlipInfos = {
Sprite = 436,
Color = 5
},
Vehicles = {
Truck = {
Spawner = 1,
Hash = "phantom",
Trailer = "tanker",
HasCaution = true
}
},
Zones = {
CloakRoom = {
Pos = {x = 557.93, y = -2327.90, z = 4.82},
Size = {x = 3.0, y = 3.0, z = 2.0},
Color = {r = 204, g = 204, b = 0},
Marker = 1,
Blip = true,
Name = _U("f_oil_refiner"),
Type = "cloakroom",
Hint = _U("cloak_change"),
GPS = {x = 554.59, y = -2314.43, z = 4.86}
},
OilFarm = {
Pos = {x = 609.58, y = 2856.74, z = 38.90},
Size = {x = 20.0, y = 20.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker = 1,
Blip = true,
Name = _U("f_drill_oil"),
Type = "work",
Item = {
{
name = _U("f_fuel"),
db_name = "petrol",
time = 5000,
max = 24,
add = 1,
remove = 1,
requires = "nothing",
requires_name = "Nothing",
drop = 100
}
},
Hint = _U("f_drillbutton"),
GPS = {x = 2736.94, y = 1417.99, z = 23.48}
},
OilRefinement = {
Pos = {x = 2736.94, y = 1417.99, z = 23.48},
Size = {x = 10.0, y = 10.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker = 1,
Blip = true,
Name = _U("f_fuel_refine"),
Type = "work",
Item = {
{
name = _U("f_fuel_refine"),
db_name = "petrol_raffin",
time = 5000,
max = 24,
add = 1,
remove = 2,
requires = "petrol",
requires_name = _U("f_fuel"),
drop = 100
}
},
Hint = _U("f_refine_fuel_button"),
GPS = {x = 265.75, y = -3013.39, z = 4.73}
},
OilMix = {
Pos = {x = 265.75, y = -3013.39, z = 4.73},
Size = {x = 10.0, y = 10.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker = 1,
Blip = true,
Name = _U("f_fuel_mixture"),
Type = "work",
Item = {
{
name = _U("f_gas"),
db_name = "essence",
time = 5000,
max = 24,
add = 2,
remove = 1,
requires = "petrol_raffin",
requires_name = _U("f_fuel_refine"),
drop = 100
}
},
Hint = _U("f_fuel_mixture_button"),
GPS = {x = 491.40, y = -2163.37, z = 4.91}
},
VehicleSpawner = {
Pos = {x = 554.59, y = -2314.43, z = 4.86},
Size = {x = 3.0, y = 3.0, z = 2.0},
Color = {r = 204, g = 204, b = 0},
Marker = 1,
Blip = false,
Name = _U("spawn_veh"),
Type = "vehspawner",
Spawner = 1,
Hint = _U("spawn_truck_button"),
Caution = 2000,
GPS = {x = 602.25, y = 2926.62, z = 39.68}
},
VehicleSpawnPoint = {
Pos = {x = 570.54, y = -2309.70, z = 4.90},
Size = {x = 3.0, y = 3.0, z = 1.0},
Marker = -1,
Blip = false,
Name = _U("service_vh"),
Type = "vehspawnpt",
Spawner = 1,
GPS = 0,
Heading = 0
},
VehicleDeletePoint = {
Pos = {x = 520.68, y = -2124.21, z = 4.98},
Size = {x = 5.0, y = 5.0, z = 1.0},
Color = {r = 255, g = 0, b = 0},
Marker = 1,
Blip = false,
Name = _U("return_vh"),
Type = "vehdelete",
Hint = _U("return_vh_button"),
Spawner = 1,
Caution = 2000,
GPS = 0,
Teleport = 0
},
Delivery = {
Pos = {x = 491.40, y = -2163.37, z = 4.91},
Color = {r = 204, g = 204, b = 0},
Size = {x = 10.0, y = 10.0, z = 1.0},
Marker = 1,
Blip = true,
Name = _U("f_deliver_gas"),
Type = "delivery",
Spawner = 1,
Item = {
{
name = _U("delivery"),
time = 500,
remove = 1,
max = 100, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 61,
requires = "essence",
requires_name = _U("f_gas"),
drop = 100
}
},
Hint = _U("f_deliver_gas_button"),
GPS = {x = 609.58, y = 2856.74, z = 39.49}
}
}
}
|
require "XmlWriter"
require "vmath"
local function GenStringFromArray(theArray, bAsInt)
local array = {" "}
for i, vector in ipairs(theArray) do
local elements = vector;
if(bAsInt) then
elements = {};
for i, value in ipairs(vector) do
elements[#elements + 1] = string.format("%i", value);
end
end
array[#array + 1] = " " .. table.concat(vector, " ");
end
return table.concat(array, "\n");
end
local function MakeBar(length)
local bar = {}
bar.positions =
{
--Front
vmath.vec3( 0.5, 0.5, 0.5 * length),
vmath.vec3( 0.5, -0.5, 0.5 * length),
vmath.vec3(-0.5, -0.5, 0.5 * length),
vmath.vec3(-0.5, 0.5, 0.5 * length),
--Top
vmath.vec3( 0.5, 0.5, 0.5 * length),
vmath.vec3(-0.5, 0.5, 0.5 * length),
vmath.vec3(-0.5, 0.5, -0.5 * length),
vmath.vec3( 0.5, 0.5, -0.5 * length),
--Right
vmath.vec3( 0.5, 0.5, 0.5 * length),
vmath.vec3( 0.5, 0.5, -0.5 * length),
vmath.vec3( 0.5, -0.5, -0.5 * length),
vmath.vec3( 0.5, -0.5, 0.5 * length),
--Back
vmath.vec3( 0.5, 0.5, -0.5 * length),
vmath.vec3(-0.5, 0.5, -0.5 * length),
vmath.vec3(-0.5, -0.5, -0.5 * length),
vmath.vec3( 0.5, -0.5, -0.5 * length),
--Bottom
vmath.vec3( 0.5, -0.5, 0.5 * length),
vmath.vec3( 0.5, -0.5, -0.5 * length),
vmath.vec3(-0.5, -0.5, -0.5 * length),
vmath.vec3(-0.5, -0.5, 0.5 * length),
--Left
vmath.vec3(-0.5, 0.5, 0.5 * length),
vmath.vec3(-0.5, -0.5, 0.5 * length),
vmath.vec3(-0.5, -0.5, -0.5 * length),
vmath.vec3(-0.5, 0.5, -0.5 * length),
};
bar.normals =
{
--Front
vmath.vec3(0.0, 0.0, 1.0),
vmath.vec3(0.0, 0.0, 1.0),
vmath.vec3(0.0, 0.0, 1.0),
vmath.vec3(0.0, 0.0, 1.0),
--Top
vmath.vec3(0.0, 1.0, 0.0),
vmath.vec3(0.0, 1.0, 0.0),
vmath.vec3(0.0, 1.0, 0.0),
vmath.vec3(0.0, 1.0, 0.0),
--Right
vmath.vec3(1.0, 0.0, 0.0),
vmath.vec3(1.0, 0.0, 0.0),
vmath.vec3(1.0, 0.0, 0.0),
vmath.vec3(1.0, 0.0, 0.0),
--Back
vmath.vec3(0.0, 0.0, -1.0),
vmath.vec3(0.0, 0.0, -1.0),
vmath.vec3(0.0, 0.0, -1.0),
vmath.vec3(0.0, 0.0, -1.0),
--Bottom
vmath.vec3(0.0, -1.0, 0.0),
vmath.vec3(0.0, -1.0, 0.0),
vmath.vec3(0.0, -1.0, 0.0),
vmath.vec3(0.0, -1.0, 0.0),
--Left
vmath.vec3(-1.0, 0.0, 0.0),
vmath.vec3(-1.0, 0.0, 0.0),
vmath.vec3(-1.0, 0.0, 0.0),
vmath.vec3(-1.0, 0.0, 0.0),
}
bar.texCoords =
{
--Front
vmath.vec2(1.0, 1.0),
vmath.vec2(1.0, 0.0),
vmath.vec2(0.0, 0.0),
vmath.vec2(0.0, 1.0),
--Top
vmath.vec2(1.0 * length, 1.0),
vmath.vec2(1.0 * length, 0.0),
vmath.vec2(0.0 * length, 0.0),
vmath.vec2(0.0 * length, 1.0),
--Right
vmath.vec2(0.0 * length, 1.0),
vmath.vec2(1.0 * length, 1.0),
vmath.vec2(1.0 * length, 0.0),
vmath.vec2(0.0 * length, 0.0),
--Back
vmath.vec2(0.0, 1.0),
vmath.vec2(1.0, 1.0),
vmath.vec2(1.0, 0.0),
vmath.vec2(0.0, 0.0),
--Bottom
vmath.vec2(1.0, 1.0 * length),
vmath.vec2(1.0, 0.0 * length),
vmath.vec2(0.0, 0.0 * length),
vmath.vec2(0.0, 1.0 * length),
--Left
vmath.vec2(1.0 * length, 1.0),
vmath.vec2(1.0 * length, 0.0),
vmath.vec2(0.0 * length, 0.0),
vmath.vec2(0.0 * length, 1.0),
}
bar.indices =
{
vmath.vec3(0, 1, 2),
vmath.vec3(2, 3, 0),
vmath.vec3(4, 5, 6),
vmath.vec3(6, 7, 4),
vmath.vec3(8, 9, 10),
vmath.vec3(10, 11, 8),
vmath.vec3(12, 13, 14),
vmath.vec3(14, 15, 12),
vmath.vec3(16, 17, 18),
vmath.vec3(18, 19, 16),
vmath.vec3(20, 21, 22),
vmath.vec3(22, 23, 20),
}
return bar;
end
local function WriteVAO(writer, name, ...)
local attribs = {...}
writer:PushElement("vao");
writer:AddAttribute("name", name);
for i, attrib in ipairs(attribs) do
writer:PushElement("source");
writer:AddAttribute("attrib", tostring(attrib));
writer:PopElement();
end
writer:PopElement();
end
local function WriteBar(filename, bar)
if(type(bar) == "number") then
bar = MakeBar(bar);
end
do
local writer = XmlWriter.XmlWriter(filename);
writer:AddPI("oxygen", [[RNGSchema="../../Documents/meshFormat.rnc" type="compact"]]);
writer:PushElement("mesh", "http://www.arcsynthesis.com/gltut/mesh");
writer:PushElement("attribute");
writer:AddAttribute("index", "0");
writer:AddAttribute("type", "float");
writer:AddAttribute("size", "3");
writer:AddText(GenStringFromArray(bar.positions));
writer:PopElement();
writer:PushElement("attribute");
writer:AddAttribute("index", "2");
writer:AddAttribute("type", "float");
writer:AddAttribute("size", "3");
writer:AddText(GenStringFromArray(bar.normals));
writer:PopElement();
writer:PushElement("attribute");
writer:AddAttribute("index", "5");
writer:AddAttribute("type", "float");
writer:AddAttribute("size", "2");
writer:AddText(GenStringFromArray(bar.texCoords));
writer:PopElement();
WriteVAO(writer, "lit", 0, 2);
WriteVAO(writer, "lit-tex", 0, 2, 5);
WriteVAO(writer, "tex", 0, 5);
WriteVAO(writer, "flat", 0);
writer:PushElement("indices");
writer:AddAttribute("cmd", "triangles");
writer:AddAttribute("type", "ushort");
writer:AddText(GenStringFromArray(bar.indices, true));
writer:PopElement();
writer:PopElement();
writer:Close();
end
end
WriteBar("ShortBar.xml", 3);
WriteBar("LongBar.xml", 9);
|
object_tangible_furniture_decorative_wod_potted_plant_08 = object_tangible_furniture_decorative_shared_wod_potted_plant_08:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_decorative_wod_potted_plant_08, "object/tangible/furniture/decorative/wod_potted_plant_08.iff")
|
local Actions = require("actions")
local Keybind = {}
Keybind.__index = Keybind
Keybind.table = {}
Keybind.table.default = {}
-- is this even used?
Keybind.table.fileSelect = {}
Keybind.table.notes = {}
Keybind.new = function(key, name, mode)
self = {}
setmetatable(self, Keybind)
self.name = name
self.key = key
if mode == nil then
mode = "default"
end
self.mode = mode
Keybind.table[mode][key] = self
return self
end
Keybind.exec = function(key)
-- Hey, you found it! Check this shit out.
if key:match("mouseClickButton_") then
local command = key:gsub("mouseClickButton_", "")
Actions[command]()
end
local entry = Keybind.table[CURRENT_MODE][key]
if entry then
local name = entry.name
local action = Actions[name]
if action then
print(name)
action()
end
end
end
Keybind.new("right", "stepRight")
Keybind.new("left", "stepLeft")
Keybind.new("p", "toggleRealtimePlayback")
Keybind.new("delete", "deleteCurrentKeyframe")
Keybind.new("^s", "save")
Keybind.new("return", "openNotes")
Keybind.new("escape", "closeNotes", "notes")
Keybind.new("return", "closeNotes", "notes")
local faceButtons = {"triangle", "x", "square", "circle"}
local wasd = {"w", "s", "a", "d"}
local directions = {"up", "down", "left", "right"}
for i, dir in ipairs(directions) do
local face = faceButtons[i]
Keybind.new("^" .. dir, "toggle" .. dir)
Keybind.new("@" .. dir, "toggle" .. face)
Keybind.new(wasd[i], "toggle" .. dir)
Keybind.new("@" .. wasd[i], "toggle" .. face)
end
for i, v in ipairs({"start", "up", "down", "left", "right", "triangle", "x", "square", "circle", "select"}) do
Keybind.new((i - 1) .. "", "toggle" .. v)
Keybind.new("mouseClick" .. v, "toggle" .. v)
end
Keybind.new("^" .. "space", "toggleselect")
Keybind.new("@" .. "space", "togglestart")
Keybind.new("+right", "jumpRight")
Keybind.new("+left", "jumpLeft")
Keybind.new("middleClick", "toggleRealtimePlayback")
Keybind.new("m", "toggleMap")
Keybind.new("n", "toggleMapLock")
Keybind.new("\\", "toggleUIFlip")
Keybind.new("^y","crash") -- Yes. CTRL+Y crashes framescop on purpose, used for testing.
return Keybind
|
local API_NPC = require(script:GetCustomProperty("API_NPC"))
function OnTaskStart(npc, animatedMesh)
end
function OnTaskEnd(npc, animatedMesh, interrupted)
end
API_NPC.RegisterTaskClient("dummy_heal", nil, OnTaskStart, OnTaskEnd)
|
function love.conf(t)
t.title = 'title'
t.version = '11.3'
t.console = true
t.window.width = 1200
t.window.height = 720
end
|
AddCSLuaFile()
function EFFECT:Init(data)
if DRONES_REWRITE.ClientCVars.NoMuzzleFlash:GetBool() then return end
self.Start = data:GetOrigin()
self.Forward = data:GetNormal()
self.Emitter = ParticleEmitter(self.Start)
local dlight = DynamicLight(self:EntIndex())
if dlight then
dlight.pos = self.Start
dlight.r = 255
dlight.g = 50
dlight.b = 0
dlight.brightness = 1
dlight.Decay = 1
dlight.Size = math.random(150, 300)
dlight.DieTime = CurTime()
end
local p = self.Emitter:Add("sprites/heatwave", self.Start - self.Forward * 4)
p:SetVelocity(80 * self.Forward + 20 * VectorRand() * 2)
p:SetGravity(Vector(0, 0, 100))
p:SetAirResistance(160)
p:SetStartAlpha(1)
p:SetEndAlpha(0)
p:SetDieTime(math.Rand(0.05, 0.1))
p:SetStartSize(math.random(5, 12))
p:SetEndSize(5)
p:SetRoll(math.Rand(180, 480))
p:SetRollDelta(math.Rand(-1, 1))
local p = self.Emitter:Add("particle/smokesprites_000" .. math.random(1, 9), self.Start)
p:SetAirResistance(100)
p:SetVelocity(self.Forward * 120 + VectorRand() * 4)
p:SetGravity(Vector(0, 0, 10))
p:SetDieTime(math.Rand(0.3, 0.6))
p:SetStartAlpha(40)
p:SetEndAlpha(0)
p:SetStartSize(0)
p:SetEndSize(15)
p:SetRollDelta(math.Rand(-2, 2))
p:SetColor(120, 120, 120)
for i = 1, 5 do
local p = self.Emitter:Add("effects/muzzleflash"..math.random(1, 4), self.Start + i * 6 * self.Forward)
p:SetVelocity(10 * VectorRand())
p:SetDieTime(math.Rand(0.04, 0.1))
p:SetStartAlpha(50)
p:SetStartSize(20 - i * 2)
p:SetEndSize(0)
p:SetRoll(math.Rand(180, 480))
p:SetRollDelta(math.Rand(-1, 1))
p:SetColor(255, 255, 255)
end
self.Emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end
|
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:NewModule('UnitFrames', 'AceTimer-3.0', 'AceEvent-3.0', 'AceHook-3.0');
local LSM = LibStub("LibSharedMedia-3.0");
UF.LSM = LSM
--Cache global variables
--Lua functions
local _G = _G
local select, pairs, type, unpack, assert, tostring = select, pairs, type, unpack, assert, tostring
local min = math.min
local tinsert = table.insert
local find, gsub, format = string.find, string.gsub, string.format
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
local CreateFrame = CreateFrame
local IsAddOnLoaded = IsAddOnLoaded
local UnitFrame_OnEnter = UnitFrame_OnEnter
local UnitFrame_OnLeave = UnitFrame_OnLeave
local IsInInstance = IsInInstance
local InCombatLockdown = InCombatLockdown
local CompactRaidFrameManager_GetSetting = CompactRaidFrameManager_GetSetting
local CompactRaidFrameManager_SetSetting = CompactRaidFrameManager_SetSetting
local GetInstanceInfo = GetInstanceInfo
local UnregisterStateDriver = UnregisterStateDriver
local RegisterStateDriver = RegisterStateDriver
local UnregisterAttributeDriver = UnregisterAttributeDriver
local CompactRaidFrameManager_UpdateShown = CompactRaidFrameManager_UpdateShown
local CompactRaidFrameContainer = CompactRaidFrameContainer
local MAX_RAID_MEMBERS = MAX_RAID_MEMBERS
local MAX_BOSS_FRAMES = MAX_BOSS_FRAMES
--Global variables that we don't cache, list them here for mikk's FindGlobals script
-- GLOBALS: UIParent, ElvCharacterDB, ElvUF_Parent, oUF_RaidDebuffs, CompactRaidFrameManager
-- GLOBALS: PlayerFrame, RuneFrame, PetFrame, TargetFrame, ComboFrame, FocusFrame
-- GLOBALS: FocusFrameToT, TargetFrameToT, CompactUnitFrameProfiles, PartyMemberBackground
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
UF.headerstoload = {}
UF.unitgroupstoload = {}
UF.unitstoload = {}
UF.groupPrototype = {}
UF.headerPrototype = {}
UF.headers = {}
UF.groupunits = {}
UF.units = {}
UF.statusbars = {}
UF.fontstrings = {}
UF.badHeaderPoints = {
['TOP'] = 'BOTTOM',
['LEFT'] = 'RIGHT',
['BOTTOM'] = 'TOP',
['RIGHT'] = 'LEFT',
}
UF.headerFunctions = {}
UF.classMaxResourceBar = {
['DEATHKNIGHT'] = 6,
['PALADIN'] = 5,
['WARLOCK'] = 5,
['MONK'] = 6,
['MAGE'] = 4,
['ROGUE'] = 10,
["DRUID"] = 5
}
UF.instanceMapIDs = {
[30] = 40, -- Alterac Valley
[489] = 10, -- Warsong Gulch
[529] = 15, -- Arathi Basin
[566] = 15, -- Eye of the Storm
[607] = 15, -- Strand of the Ancients
[628] = 40, -- Isle of Conquest
[726] = 10, -- Twin Peaks
[727] = 10, -- Silvershard Mines [STVDiamondMineBG]
[761] = 10, -- The Battle for Gilneas [GilneasBattleground2]
[968] = 10, -- Rated Eye of the Storm
[998] = 10, -- Temple of Kotmogu
[1105] = 15, -- Deepwind Gourge [GoldRush]
[1280] = 40, -- Tarren Mill vs Southshore [HillsbradFoothillsBG]
[1681] = 15, -- Arathi Blizzard [ArathiBasinWinter]
[1803] = 10, -- Seething Shore [AzeriteBG]
--[1715] = 5, -- Battle for Blackrock Mountain
--do not have enough information on this one yet, going to store the instanceID for now.
}
UF.headerGroupBy = {
['CLASS'] = function(header)
header:SetAttribute("groupingOrder", "DEATHKNIGHT,DEMONHUNTER,DRUID,HUNTER,MAGE,PALADIN,PRIEST,ROGUE,SHAMAN,WARLOCK,WARRIOR,MONK")
header:SetAttribute('sortMethod', 'NAME')
header:SetAttribute("groupBy", 'CLASS')
end,
['MTMA'] = function(header)
header:SetAttribute("groupingOrder", "MAINTANK,MAINASSIST,NONE")
header:SetAttribute('sortMethod', 'NAME')
header:SetAttribute("groupBy", 'ROLE')
end,
['ROLE'] = function(header)
header:SetAttribute("groupingOrder", "TANK,HEALER,DAMAGER,NONE")
header:SetAttribute('sortMethod', 'NAME')
header:SetAttribute("groupBy", 'ASSIGNEDROLE')
end,
['NAME'] = function(header)
header:SetAttribute("groupingOrder", "1,2,3,4,5,6,7,8")
header:SetAttribute('sortMethod', 'NAME')
header:SetAttribute("groupBy", nil)
end,
['GROUP'] = function(header)
header:SetAttribute("groupingOrder", "1,2,3,4,5,6,7,8")
header:SetAttribute('sortMethod', 'INDEX')
header:SetAttribute("groupBy", 'GROUP')
end,
['CLASSROLE'] = function(header)
header:SetAttribute("groupingOrder", "DEATHKNIGHT,WARRIOR,DEMONHUNTER,ROGUE,MONK,PALADIN,DRUID,SHAMAN,HUNTER,PRIEST,MAGE,WARLOCK")
header:SetAttribute('sortMethod', 'NAME')
header:SetAttribute("groupBy", 'CLASS')
end,
['PETNAME'] = function(header)
header:SetAttribute("groupingOrder", "1,2,3,4,5,6,7,8")
header:SetAttribute('sortMethod', 'NAME')
header:SetAttribute("groupBy", nil)
header:SetAttribute("filterOnPet", true) --This is the line that matters. Without this, it sorts based on the owners name
end,
}
local POINT_COLUMN_ANCHOR_TO_DIRECTION = {
['TOPTOP'] = 'UP_RIGHT',
['BOTTOMBOTTOM'] = 'TOP_RIGHT',
['LEFTLEFT'] = 'RIGHT_UP',
['RIGHTRIGHT'] = 'LEFT_UP',
['RIGHTTOP'] = 'LEFT_DOWN',
['LEFTTOP'] = 'RIGHT_DOWN',
['LEFTBOTTOM'] = 'RIGHT_UP',
['RIGHTBOTTOM'] = 'LEFT_UP',
['BOTTOMRIGHT'] = 'UP_LEFT',
['BOTTOMLEFT'] = 'UP_RIGHT',
['TOPRIGHT'] = 'DOWN_LEFT',
['TOPLEFT'] = 'DOWN_RIGHT'
}
local DIRECTION_TO_POINT = {
DOWN_RIGHT = "TOP",
DOWN_LEFT = "TOP",
UP_RIGHT = "BOTTOM",
UP_LEFT = "BOTTOM",
RIGHT_DOWN = "LEFT",
RIGHT_UP = "LEFT",
LEFT_DOWN = "RIGHT",
LEFT_UP = "RIGHT",
UP = "BOTTOM",
DOWN = "TOP"
}
local DIRECTION_TO_GROUP_ANCHOR_POINT = {
DOWN_RIGHT = "TOPLEFT",
DOWN_LEFT = "TOPRIGHT",
UP_RIGHT = "BOTTOMLEFT",
UP_LEFT = "BOTTOMRIGHT",
RIGHT_DOWN = "TOPLEFT",
RIGHT_UP = "BOTTOMLEFT",
LEFT_DOWN = "TOPRIGHT",
LEFT_UP = "BOTTOMRIGHT",
OUT_RIGHT_UP = "BOTTOM",
OUT_LEFT_UP = "BOTTOM",
OUT_RIGHT_DOWN = "TOP",
OUT_LEFT_DOWN = "TOP",
OUT_UP_RIGHT = "LEFT",
OUT_UP_LEFT = "RIGHT",
OUT_DOWN_RIGHT = "LEFT",
OUT_DOWN_LEFT = "RIGHT",
}
local INVERTED_DIRECTION_TO_COLUMN_ANCHOR_POINT = {
DOWN_RIGHT = "RIGHT",
DOWN_LEFT = "LEFT",
UP_RIGHT = "RIGHT",
UP_LEFT = "LEFT",
RIGHT_DOWN = "BOTTOM",
RIGHT_UP = "TOP",
LEFT_DOWN = "BOTTOM",
LEFT_UP = "TOP",
UP = "TOP",
DOWN = "BOTTOM"
}
local DIRECTION_TO_COLUMN_ANCHOR_POINT = {
DOWN_RIGHT = "LEFT",
DOWN_LEFT = "RIGHT",
UP_RIGHT = "LEFT",
UP_LEFT = "RIGHT",
RIGHT_DOWN = "TOP",
RIGHT_UP = "BOTTOM",
LEFT_DOWN = "TOP",
LEFT_UP = "BOTTOM",
}
local DIRECTION_TO_HORIZONTAL_SPACING_MULTIPLIER = {
DOWN_RIGHT = 1,
DOWN_LEFT = -1,
UP_RIGHT = 1,
UP_LEFT = -1,
RIGHT_DOWN = 1,
RIGHT_UP = 1,
LEFT_DOWN = -1,
LEFT_UP = -1,
}
local DIRECTION_TO_VERTICAL_SPACING_MULTIPLIER = {
DOWN_RIGHT = -1,
DOWN_LEFT = -1,
UP_RIGHT = 1,
UP_LEFT = 1,
RIGHT_DOWN = -1,
RIGHT_UP = 1,
LEFT_DOWN = -1,
LEFT_UP = 1,
}
function UF:ConvertGroupDB(group)
local db = self.db.units[group.groupName]
if db.point and db.columnAnchorPoint then
db.growthDirection = POINT_COLUMN_ANCHOR_TO_DIRECTION[db.point..db.columnAnchorPoint];
db.point = nil;
db.columnAnchorPoint = nil;
end
if db.growthDirection == "UP" then
db.growthDirection = "UP_RIGHT"
end
if db.growthDirection == "DOWN" then
db.growthDirection = "DOWN_RIGHT"
end
end
function UF:Construct_UF(frame, unit)
frame:SetScript('OnEnter', UnitFrame_OnEnter)
frame:SetScript('OnLeave', UnitFrame_OnLeave)
if(self.thinBorders) then
frame.SPACING = 0
frame.BORDER = E.mult
else
frame.BORDER = E.Border
frame.SPACING = E.Spacing
end
frame.SHADOW_SPACING = 3
frame.CLASSBAR_YOFFSET = 0 --placeholder
frame.BOTTOM_OFFSET = 0 --placeholder
frame.RaisedElementParent = CreateFrame('Frame', nil, frame)
frame.RaisedElementParent.TextureParent = CreateFrame('Frame', nil, frame.RaisedElementParent)
frame.RaisedElementParent:SetFrameLevel(frame:GetFrameLevel() + 100)
if not self.groupunits[unit] then
local stringTitle = E:StringTitle(unit)
if stringTitle:find('target') then
stringTitle = gsub(stringTitle, 'target', 'Target')
end
self["Construct_"..stringTitle.."Frame"](self, frame, unit)
else
UF["Construct_"..E:StringTitle(self.groupunits[unit]).."Frames"](self, frame, unit)
end
self:Update_StatusBars()
self:Update_FontStrings()
return frame
end
function UF:GetObjectAnchorPoint(frame, point)
if not frame[point] or point == "Frame" then
return frame
elseif frame[point] and not frame[point]:IsShown() then
return frame.Health
else
return frame[point]
end
end
function UF:GetPositionOffset(position, offset)
if not offset then offset = 2; end
local x, y = 0, 0
if find(position, 'LEFT') then
x = offset
elseif find(position, 'RIGHT') then
x = -offset
end
if find(position, 'TOP') then
y = -offset
elseif find(position, 'BOTTOM') then
y = offset
end
return x, y
end
function UF:GetAuraOffset(p1, p2)
local x, y = 0, 0
if p1 == "RIGHT" and p2 == "LEFT" then
x = -3
elseif p1 == "LEFT" and p2 == "RIGHT" then
x = 3
end
if find(p1, 'TOP') and find(p2, 'BOTTOM') then
y = -1
elseif find(p1, 'BOTTOM') and find(p2, 'TOP') then
y = 1
end
return E:Scale(x), E:Scale(y)
end
function UF:GetAuraAnchorFrame(frame, attachTo, isConflict)
if isConflict then
E:Print(format(L["%s frame(s) has a conflicting anchor point, please change either the buff or debuff anchor point so they are not attached to each other. Forcing the debuffs to be attached to the main unitframe until fixed."], E:StringTitle(frame:GetName())))
end
if isConflict or attachTo == 'FRAME' then
return frame
elseif attachTo == 'TRINKET' then
if select(2, IsInInstance()) == "arena" then
return frame.Trinket
else
return frame.PVPSpecIcon
end
elseif attachTo == 'BUFFS' then
return frame.Buffs
elseif attachTo == 'DEBUFFS' then
return frame.Debuffs
elseif attachTo == 'HEALTH' then
return frame.Health
elseif attachTo == 'POWER' and frame.Power then
return frame.Power
else
return frame
end
end
function UF:ClearChildPoints(...)
for i=1, select("#", ...) do
local child = select(i, ...)
child:ClearAllPoints()
end
end
function UF:UpdateColors()
local db = self.db.colors
ElvUF.colors.tapped = E:SetColorTable(ElvUF.colors.tapped, db.tapped)
ElvUF.colors.disconnected = E:SetColorTable(ElvUF.colors.disconnected, db.disconnected)
ElvUF.colors.health = E:SetColorTable(ElvUF.colors.health, db.health)
ElvUF.colors.power.MANA = E:SetColorTable(ElvUF.colors.power.MANA, db.power.MANA)
ElvUF.colors.power.RAGE = E:SetColorTable(ElvUF.colors.power.RAGE, db.power.RAGE)
ElvUF.colors.power.FOCUS = E:SetColorTable(ElvUF.colors.power.FOCUS, db.power.FOCUS)
ElvUF.colors.power.ENERGY = E:SetColorTable(ElvUF.colors.power.ENERGY, db.power.ENERGY)
ElvUF.colors.power.RUNIC_POWER = E:SetColorTable(ElvUF.colors.power.RUNIC_POWER, db.power.RUNIC_POWER)
ElvUF.colors.power.PAIN = E:SetColorTable(ElvUF.colors.power.PAIN, db.power.PAIN)
ElvUF.colors.power.FURY = E:SetColorTable(ElvUF.colors.power.FURY, db.power.FURY)
ElvUF.colors.power.LUNAR_POWER = E:SetColorTable(ElvUF.colors.power.LUNAR_POWER, db.power.LUNAR_POWER)
ElvUF.colors.power.INSANITY = E:SetColorTable(ElvUF.colors.power.INSANITY, db.power.INSANITY)
ElvUF.colors.power.MAELSTROM = E:SetColorTable(ElvUF.colors.power.MAELSTROM, db.power.MAELSTROM)
if not ElvUF.colors.ComboPoints then ElvUF.colors.ComboPoints = {} end
ElvUF.colors.ComboPoints[1] = E:SetColorTable(ElvUF.colors.ComboPoints[1], db.classResources.comboPoints[1])
ElvUF.colors.ComboPoints[2] = E:SetColorTable(ElvUF.colors.ComboPoints[2], db.classResources.comboPoints[2])
ElvUF.colors.ComboPoints[3] = E:SetColorTable(ElvUF.colors.ComboPoints[3], db.classResources.comboPoints[3])
--Monk, Mage, Paladin and Warlock, Death Knight
if not ElvUF.colors.ClassBars then ElvUF.colors.ClassBars = {} end
if not ElvUF.colors.ClassBars.MONK then ElvUF.colors.ClassBars.MONK = {} end
ElvUF.colors.ClassBars.PALADIN = E:SetColorTable(ElvUF.colors.ClassBars.PALADIN, db.classResources.PALADIN)
ElvUF.colors.ClassBars.MAGE = E:SetColorTable(ElvUF.colors.ClassBars.MAGE, db.classResources.MAGE)
ElvUF.colors.ClassBars.MONK[1] = E:SetColorTable(ElvUF.colors.ClassBars.MONK[1], db.classResources.MONK[1])
ElvUF.colors.ClassBars.MONK[2] = E:SetColorTable(ElvUF.colors.ClassBars.MONK[2], db.classResources.MONK[2])
ElvUF.colors.ClassBars.MONK[3] = E:SetColorTable(ElvUF.colors.ClassBars.MONK[3], db.classResources.MONK[3])
ElvUF.colors.ClassBars.MONK[4] = E:SetColorTable(ElvUF.colors.ClassBars.MONK[4], db.classResources.MONK[4])
ElvUF.colors.ClassBars.MONK[5] = E:SetColorTable(ElvUF.colors.ClassBars.MONK[5], db.classResources.MONK[5])
ElvUF.colors.ClassBars.MONK[6] = E:SetColorTable(ElvUF.colors.ClassBars.MONK[6], db.classResources.MONK[6])
ElvUF.colors.ClassBars.DEATHKNIGHT = E:SetColorTable(ElvUF.colors.ClassBars.DEATHKNIGHT, db.classResources.DEATHKNIGHT)
ElvUF.colors.ClassBars.WARLOCK = E:SetColorTable(ElvUF.colors.ClassBars.WARLOCK, db.classResources.WARLOCK)
-- these are just holders.. to maintain and update tables
if not ElvUF.colors.reaction.good then ElvUF.colors.reaction.good = {} end
if not ElvUF.colors.reaction.bad then ElvUF.colors.reaction.bad = {} end
if not ElvUF.colors.reaction.neutral then ElvUF.colors.reaction.neutral = {} end
ElvUF.colors.reaction.good = E:SetColorTable(ElvUF.colors.reaction.good, db.reaction.GOOD)
ElvUF.colors.reaction.bad = E:SetColorTable(ElvUF.colors.reaction.bad, db.reaction.BAD)
ElvUF.colors.reaction.neutral = E:SetColorTable(ElvUF.colors.reaction.neutral, db.reaction.NEUTRAL)
if not ElvUF.colors.smoothHealth then ElvUF.colors.smoothHealth = {} end
ElvUF.colors.smoothHealth = E:SetColorTable(ElvUF.colors.smoothHealth, db.health)
if not ElvUF.colors.smooth then ElvUF.colors.smooth = {1, 0, 0, 1, 1, 0} end
-- end
ElvUF.colors.reaction[1] = ElvUF.colors.reaction.bad
ElvUF.colors.reaction[2] = ElvUF.colors.reaction.bad
ElvUF.colors.reaction[3] = ElvUF.colors.reaction.bad
ElvUF.colors.reaction[4] = ElvUF.colors.reaction.neutral
ElvUF.colors.reaction[5] = ElvUF.colors.reaction.good
ElvUF.colors.reaction[6] = ElvUF.colors.reaction.good
ElvUF.colors.reaction[7] = ElvUF.colors.reaction.good
ElvUF.colors.reaction[8] = ElvUF.colors.reaction.good
ElvUF.colors.smooth[7] = ElvUF.colors.smoothHealth[1]
ElvUF.colors.smooth[8] = ElvUF.colors.smoothHealth[2]
ElvUF.colors.smooth[9] = ElvUF.colors.smoothHealth[3]
ElvUF.colors.castColor = E:SetColorTable(ElvUF.colors.castColor, db.castColor)
ElvUF.colors.castNoInterrupt = E:SetColorTable(ElvUF.colors.castNoInterrupt, db.castNoInterrupt)
if not ElvUF.colors.DebuffHighlight then ElvUF.colors.DebuffHighlight = {} end
ElvUF.colors.DebuffHighlight.Magic = E:SetColorTable(ElvUF.colors.DebuffHighlight.Magic, db.debuffHighlight.Magic)
ElvUF.colors.DebuffHighlight.Curse = E:SetColorTable(ElvUF.colors.DebuffHighlight.Curse, db.debuffHighlight.Curse)
ElvUF.colors.DebuffHighlight.Disease = E:SetColorTable(ElvUF.colors.DebuffHighlight.Disease, db.debuffHighlight.Disease)
ElvUF.colors.DebuffHighlight.Poison = E:SetColorTable(ElvUF.colors.DebuffHighlight.Poison, db.debuffHighlight.Poison)
end
function UF:Update_StatusBars()
local statusBarTexture = LSM:Fetch("statusbar", self.db.statusbar)
for statusbar in pairs(UF.statusbars) do
if statusbar and statusbar:GetObjectType() == 'StatusBar' and not statusbar.isTransparent then
statusbar:SetStatusBarTexture(statusBarTexture)
if statusbar.texture then statusbar.texture = statusBarTexture end --Update .texture on oUF Power element
elseif statusbar and statusbar:GetObjectType() == 'Texture' then
statusbar:SetTexture(statusBarTexture)
end
end
end
function UF:Update_StatusBar(bar)
bar:SetStatusBarTexture(LSM:Fetch("statusbar", self.db.statusbar))
end
function UF:Update_FontString(object)
object:FontTemplate(LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
end
function UF:Update_FontStrings()
local stringFont = LSM:Fetch("font", self.db.font)
for font in pairs(UF.fontstrings) do
font:FontTemplate(stringFont, self.db.fontSize, self.db.fontOutline)
end
end
function UF:Configure_FontString(obj)
UF.fontstrings[obj] = true
obj:FontTemplate() --This is temporary.
end
function UF:Update_AllFrames()
if InCombatLockdown() then self:RegisterEvent('PLAYER_REGEN_ENABLED'); return end
if E.private.unitframe.enable ~= true then return; end
self:UpdateColors()
self:Update_FontStrings()
self:Update_StatusBars()
for unit in pairs(self.units) do
if self.db.units[unit].enable then
self[unit]:Enable()
self[unit]:Update()
E:EnableMover(self[unit].mover:GetName())
else
self[unit]:Disable()
E:DisableMover(self[unit].mover:GetName())
end
end
for unit, group in pairs(self.groupunits) do
if self.db.units[group].enable then
self[unit]:Enable()
self[unit]:Update()
E:EnableMover(self[unit].mover:GetName())
else
self[unit]:Disable()
E:DisableMover(self[unit].mover:GetName())
end
end
self:UpdateAllHeaders()
end
function UF:CreateAndUpdateUFGroup(group, numGroup)
if InCombatLockdown() then self:RegisterEvent('PLAYER_REGEN_ENABLED'); return end
for i=1, numGroup do
local unit = group..i
local frameName = E:StringTitle(unit)
frameName = frameName:gsub('t(arget)', 'T%1')
if not self[unit] then
self.groupunits[unit] = group;
self[unit] = ElvUF:Spawn(unit, 'ElvUF_'..frameName)
self[unit].index = i
self[unit]:SetParent(ElvUF_Parent)
self[unit]:SetID(i)
end
frameName = E:StringTitle(group)
frameName = frameName:gsub('t(arget)', 'T%1')
self[unit].Update = function()
UF["Update_"..E:StringTitle(frameName).."Frames"](self, self[unit], self.db.units[group])
end
if self.db.units[group].enable then
self[unit]:Enable()
if group == 'arena' then
self[unit]:SetAttribute('oUF-enableArenaPrep', true)
end
self[unit].Update()
if self[unit].isForced then
self:ForceShow(self[unit])
end
E:EnableMover(self[unit].mover:GetName())
else
self[unit]:Disable()
if group == 'arena' then
self[unit]:SetAttribute('oUF-enableArenaPrep', false)
end
E:DisableMover(self[unit].mover:GetName())
end
end
end
function UF:HeaderUpdateSpecificElement(group, elementName)
assert(self[group], "Invalid group specified.")
for i=1, self[group]:GetNumChildren() do
local frame = select(i, self[group]:GetChildren())
if frame and frame.Health then
frame:UpdateElement(elementName)
end
end
end
--Keep an eye on this one, it may need to be changed too
--Reference: http://www.tukui.org/forums/topic.php?id=35332
function UF.groupPrototype:GetAttribute(name)
return self.groups[1]:GetAttribute(name)
end
function UF.groupPrototype:Configure_Groups(self)
local db = UF.db.units[self.groupName]
local point
local width, height, newCols, newRows = 0, 0, 0, 0
local direction = db.growthDirection
local xMult, yMult = DIRECTION_TO_HORIZONTAL_SPACING_MULTIPLIER[direction], DIRECTION_TO_VERTICAL_SPACING_MULTIPLIER[direction]
local UNIT_HEIGHT = db.infoPanel and db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
local groupSpacing = db.groupSpacing
local numGroups = self.numGroups
for i=1, numGroups do
local group = self.groups[i]
point = DIRECTION_TO_POINT[direction]
if group then
UF:ConvertGroupDB(group)
if point == "LEFT" or point == "RIGHT" then
group:SetAttribute("xOffset", db.horizontalSpacing * DIRECTION_TO_HORIZONTAL_SPACING_MULTIPLIER[direction])
group:SetAttribute("yOffset", 0)
group:SetAttribute("columnSpacing", db.verticalSpacing)
else
group:SetAttribute("xOffset", 0)
group:SetAttribute("yOffset", db.verticalSpacing * DIRECTION_TO_VERTICAL_SPACING_MULTIPLIER[direction])
group:SetAttribute("columnSpacing", db.horizontalSpacing)
end
if not group.isForced then
if not group.initialized then
group:SetAttribute("startingIndex", db.raidWideSorting and (-min(numGroups * (db.groupsPerRowCol * 5), MAX_RAID_MEMBERS) + 1) or -4)
group:Show()
group.initialized = true
end
group:SetAttribute('startingIndex', 1)
end
group:ClearAllPoints()
if db.raidWideSorting and db.invertGroupingOrder then
group:SetAttribute("columnAnchorPoint", INVERTED_DIRECTION_TO_COLUMN_ANCHOR_POINT[direction])
else
group:SetAttribute("columnAnchorPoint", DIRECTION_TO_COLUMN_ANCHOR_POINT[direction])
end
group:ClearChildPoints()
group:SetAttribute("point", point)
if not group.isForced then
group:SetAttribute("maxColumns", db.raidWideSorting and numGroups or 1)
group:SetAttribute("unitsPerColumn", db.raidWideSorting and (db.groupsPerRowCol * 5) or 5)
UF.headerGroupBy[db.groupBy](group)
group:SetAttribute('sortDir', db.sortDir)
group:SetAttribute("showPlayer", db.showPlayer)
end
if i == 1 and db.raidWideSorting then
group:SetAttribute("groupFilter", "1,2,3,4,5,6,7,8")
else
group:SetAttribute("groupFilter", tostring(i))
end
end
--MATH!! WOOT
point = DIRECTION_TO_GROUP_ANCHOR_POINT[direction]
if db.raidWideSorting and db.startFromCenter then
point = DIRECTION_TO_GROUP_ANCHOR_POINT["OUT_"..direction]
end
if (i - 1) % db.groupsPerRowCol == 0 then
if DIRECTION_TO_POINT[direction] == "LEFT" or DIRECTION_TO_POINT[direction] == "RIGHT" then
if group then
group:Point(point, self, point, 0, height * yMult)
end
height = height + UNIT_HEIGHT + db.verticalSpacing + groupSpacing
newRows = newRows + 1
else
if group then
group:Point(point, self, point, width * xMult, 0)
end
width = width + db.width + db.horizontalSpacing + groupSpacing
newCols = newCols + 1
end
else
if DIRECTION_TO_POINT[direction] == "LEFT" or DIRECTION_TO_POINT[direction] == "RIGHT" then
if newRows == 1 then
if group then
group:Point(point, self, point, width * xMult, 0)
end
width = width + ((db.width + db.horizontalSpacing) * 5) + groupSpacing
newCols = newCols + 1
elseif group then
group:Point(point, self, point, ((((db.width + db.horizontalSpacing) * 5) * ((i-1) % db.groupsPerRowCol))+((i-1) % db.groupsPerRowCol)*groupSpacing) * xMult, (((UNIT_HEIGHT + db.verticalSpacing+groupSpacing) * (newRows - 1))) * yMult)
end
else
if newCols == 1 then
if group then
group:Point(point, self, point, 0, height * yMult)
end
height = height + ((UNIT_HEIGHT + db.verticalSpacing) * 5) + groupSpacing
newRows = newRows + 1
elseif group then
group:Point(point, self, point, (((db.width + db.horizontalSpacing +groupSpacing) * (newCols - 1))) * xMult, ((((UNIT_HEIGHT + db.verticalSpacing) * 5) * ((i-1) % db.groupsPerRowCol))+((i-1) % db.groupsPerRowCol)*groupSpacing) * yMult)
end
end
end
if height == 0 then
height = height + ((UNIT_HEIGHT + db.verticalSpacing) * 5) +groupSpacing
elseif width == 0 then
width = width + ((db.width + db.horizontalSpacing) * 5) +groupSpacing
end
end
if not self.isInstanceForced then
self.dirtyWidth = width - db.horizontalSpacing -groupSpacing
self.dirtyHeight = height - db.verticalSpacing -groupSpacing
end
if self.mover then
self.mover.positionOverride = DIRECTION_TO_GROUP_ANCHOR_POINT[direction]
E:UpdatePositionOverride(self.mover:GetName())
self:GetScript("OnSizeChanged")(self) --Mover size is not updated if frame is hidden, so call an update manually
end
self:SetSize(width - db.horizontalSpacing -groupSpacing, height - db.verticalSpacing -groupSpacing)
end
function UF.groupPrototype:Update(self)
local group = self.groupName
UF[group].db = UF.db.units[group]
for i=1, #self.groups do
self.groups[i].db = UF.db.units[group]
self.groups[i]:Update()
end
end
function UF.groupPrototype:AdjustVisibility(self)
if not self.isForced then
local numGroups = self.numGroups
for i=1, #self.groups do
local group = self.groups[i]
if (i <= numGroups) and ((self.db.raidWideSorting and i <= 1) or not self.db.raidWideSorting) then
group:Show()
else
if group.forceShow then
group:Hide()
UF:UnshowChildUnits(group, group:GetChildren())
group:SetAttribute('startingIndex', 1)
else
group:Reset()
end
end
end
end
end
function UF.headerPrototype:ClearChildPoints()
for i=1, self:GetNumChildren() do
local child = select(i, self:GetChildren())
child:ClearAllPoints()
end
end
function UF.headerPrototype:Update(isForced)
local group = self.groupName
local db = UF.db.units[group]
UF["Update_"..E:StringTitle(group).."Header"](UF, self, db, isForced)
local i = 1
local child = self:GetAttribute("child" .. i)
while child do
UF["Update_"..E:StringTitle(group).."Frames"](UF, child, db)
if _G[child:GetName()..'Pet'] then
UF["Update_"..E:StringTitle(group).."Frames"](UF, _G[child:GetName()..'Pet'], db)
end
if _G[child:GetName()..'Target'] then
UF["Update_"..E:StringTitle(group).."Frames"](UF, _G[child:GetName()..'Target'], db)
end
i = i + 1
child = self:GetAttribute("child" .. i)
end
end
function UF.headerPrototype:Reset()
self:Hide()
self:SetAttribute("showPlayer", true)
self:SetAttribute("showSolo", true)
self:SetAttribute("showParty", true)
self:SetAttribute("showRaid", true)
self:SetAttribute("columnSpacing", nil)
self:SetAttribute("columnAnchorPoint", nil)
self:SetAttribute("groupBy", nil)
self:SetAttribute("groupFilter", nil)
self:SetAttribute("groupingOrder", nil)
self:SetAttribute("maxColumns", nil)
self:SetAttribute("nameList", nil)
self:SetAttribute("point", nil)
self:SetAttribute("sortDir", nil)
self:SetAttribute("sortMethod", "NAME")
self:SetAttribute("startingIndex", nil)
self:SetAttribute("strictFiltering", nil)
self:SetAttribute("unitsPerColumn", nil)
self:SetAttribute("xOffset", nil)
self:SetAttribute("yOffset", nil)
end
function UF:CreateHeader(parent, groupFilter, overrideName, template, groupName, headerTemplate)
local group = parent.groupName or groupName
local db = UF.db.units[group]
ElvUF:SetActiveStyle("ElvUF_"..E:StringTitle(group))
local header = ElvUF:SpawnHeader(overrideName, headerTemplate, nil,
'oUF-initialConfigFunction', ("self:SetWidth(%d); self:SetHeight(%d);"):format(db.width, db.height),
'groupFilter', groupFilter,
'showParty', true,
'showRaid', true,
'showSolo', true,
template and 'template', template)
header.groupName = group
header:SetParent(parent)
header:Show()
for k, v in pairs(self.headerPrototype) do
header[k] = v
end
return header
end
function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdate, headerTemplate)
if InCombatLockdown() then self:RegisterEvent('PLAYER_REGEN_ENABLED'); return end
local db = self.db.units[group]
local raidFilter = UF.db.smartRaidFilter
local numGroups = db.numGroups
if(raidFilter and numGroups and (self[group] and not self[group].blockVisibilityChanges)) then
local inInstance, instanceType = IsInInstance()
if(inInstance and (instanceType == 'raid' or instanceType == 'pvp')) then
local _, _, _, _, maxPlayers, _, _, instanceMapID = GetInstanceInfo()
if UF.instanceMapIDs[instanceMapID] then
maxPlayers = UF.instanceMapIDs[instanceMapID]
end
if maxPlayers > 0 then
numGroups = E:Round(maxPlayers/5)
E:Print(group, "Forcing maxGroups to: "..numGroups.." because maxPlayers is: "..maxPlayers)
end
end
end
if not self[group] then
local stringTitle = E:StringTitle(group)
ElvUF:RegisterStyle("ElvUF_"..stringTitle, UF["Construct_"..stringTitle.."Frames"])
ElvUF:SetActiveStyle("ElvUF_"..stringTitle)
if db.numGroups then
self[group] = CreateFrame('Frame', 'ElvUF_'..stringTitle, ElvUF_Parent, 'SecureHandlerStateTemplate');
self[group].groups = {}
self[group].groupName = group
self[group].template = self[group].template or template
self[group].headerTemplate = self[group].headerTemplate or headerTemplate
if not UF.headerFunctions[group] then UF.headerFunctions[group] = {} end
for k, v in pairs(self.groupPrototype) do
UF.headerFunctions[group][k] = v
end
else
self[group] = self:CreateHeader(ElvUF_Parent, groupFilter, "ElvUF_"..E:StringTitle(group), template, group, headerTemplate)
end
self[group].db = db
self.headers[group] = self[group]
self[group]:Show()
end
self[group].numGroups = numGroups
if numGroups then
if db.raidWideSorting then
if not self[group].groups[1] then
self[group].groups[1] = self:CreateHeader(self[group], nil, "ElvUF_"..E:StringTitle(self[group].groupName)..'Group1', template or self[group].template, nil, headerTemplate or self[group].headerTemplate)
end
else
while numGroups > #self[group].groups do
local index = tostring(#self[group].groups + 1)
tinsert(self[group].groups, self:CreateHeader(self[group], index, "ElvUF_"..E:StringTitle(self[group].groupName)..'Group'..index, template or self[group].template, nil, headerTemplate or self[group].headerTemplate))
end
end
UF.headerFunctions[group]:AdjustVisibility(self[group])
if headerUpdate or not self[group].mover then
UF.headerFunctions[group]:Configure_Groups(self[group])
if not self[group].isForced and not self[group].blockVisibilityChanges then
RegisterStateDriver(self[group], "visibility", db.visibility)
end
else
UF.headerFunctions[group]:Configure_Groups(self[group])
UF.headerFunctions[group]:Update(self[group])
end
if(db.enable) then
if self[group].mover then
E:EnableMover(self[group].mover:GetName())
end
else
UnregisterStateDriver(self[group], "visibility")
self[group]:Hide()
if self[group].mover then
E:DisableMover(self[group].mover:GetName())
end
return
end
else
self[group].db = db
if not UF.headerFunctions[group] then UF.headerFunctions[group] = {} end
UF.headerFunctions[group].Update = function()
local db = UF.db.units[group]
if db.enable ~= true then
UnregisterAttributeDriver(UF[group], "state-visibility")
UF[group]:Hide()
if(UF[group].mover) then
E:DisableMover(UF[group].mover:GetName())
end
return
end
UF["Update_"..E:StringTitle(group).."Header"](UF, UF[group], db)
for i=1, UF[group]:GetNumChildren() do
local child = select(i, UF[group]:GetChildren())
UF["Update_"..E:StringTitle(group).."Frames"](UF, child, UF.db.units[group])
if _G[child:GetName()..'Target'] then
UF["Update_"..E:StringTitle(group).."Frames"](UF, _G[child:GetName()..'Target'], UF.db.units[group])
end
if _G[child:GetName()..'Pet'] then
UF["Update_"..E:StringTitle(group).."Frames"](UF, _G[child:GetName()..'Pet'], UF.db.units[group])
end
end
E:EnableMover(UF[group].mover:GetName())
end
if headerUpdate then
UF["Update_"..E:StringTitle(group).."Header"](self, self[group], db)
else
UF.headerFunctions[group]:Update(self[group])
end
end
end
function UF:PLAYER_REGEN_ENABLED()
self:Update_AllFrames()
self:UnregisterEvent('PLAYER_REGEN_ENABLED')
end
function UF:CreateAndUpdateUF(unit)
assert(unit, 'No unit provided to create or update.')
if InCombatLockdown() then self:RegisterEvent('PLAYER_REGEN_ENABLED'); return end
local frameName = E:StringTitle(unit)
frameName = frameName:gsub('t(arget)', 'T%1')
if not self[unit] then
self[unit] = ElvUF:Spawn(unit, 'ElvUF_'..frameName)
self.units[unit] = unit
end
self[unit].Update = function()
UF["Update_"..frameName.."Frame"](self, self[unit], self.db.units[unit])
end
if self[unit]:GetParent() ~= ElvUF_Parent then
self[unit]:SetParent(ElvUF_Parent)
end
if self.db.units[unit].enable then
self[unit]:Enable()
self[unit].Update()
E:EnableMover(self[unit].mover:GetName())
else
self[unit]:Disable()
E:DisableMover(self[unit].mover:GetName())
end
end
function UF:LoadUnits()
for _, unit in pairs(self.unitstoload) do
self:CreateAndUpdateUF(unit)
end
self.unitstoload = nil
for group, groupOptions in pairs(self.unitgroupstoload) do
local numGroup, template = unpack(groupOptions)
self:CreateAndUpdateUFGroup(group, numGroup, template)
end
self.unitgroupstoload = nil
for group, groupOptions in pairs(self.headerstoload) do
local groupFilter, template, headerTemplate
if type(groupOptions) == 'table' then
groupFilter, template, headerTemplate = unpack(groupOptions)
end
self:CreateAndUpdateHeaderGroup(group, groupFilter, template, nil, headerTemplate)
end
self.headerstoload = nil
end
function UF:RegisterRaidDebuffIndicator()
local _, instanceType = IsInInstance();
local ORD = ns.oUF_RaidDebuffs or oUF_RaidDebuffs
if ORD then
ORD:ResetDebuffData()
local instance = E.global.unitframe.raidDebuffIndicator.instanceFilter
local other = E.global.unitframe.raidDebuffIndicator.otherFilter
local instanceSpells = ((E.global.unitframe.aurafilters[instance] and E.global.unitframe.aurafilters[instance].spells) or E.global.unitframe.aurafilters.RaidDebuffs.spells)
local otherSpells = ((E.global.unitframe.aurafilters[other] and E.global.unitframe.aurafilters[other].spells) or E.global.unitframe.aurafilters.CCDebuffs.spells)
if instanceType == "party" or instanceType == "raid" then
ORD:RegisterDebuffs(instanceSpells)
else
ORD:RegisterDebuffs(otherSpells)
end
end
end
function UF:UpdateAllHeaders(event)
if InCombatLockdown() then
self:RegisterEvent('PLAYER_REGEN_ENABLED', 'UpdateAllHeaders')
return
end
if event == 'PLAYER_REGEN_ENABLED' then
self:UnregisterEvent('PLAYER_REGEN_ENABLED')
end
if E.private.unitframe.disabledBlizzardFrames.party then
ElvUF:DisableBlizzard('party')
end
self:RegisterRaidDebuffIndicator()
local smartRaidFilterEnabled = self.db.smartRaidFilter
for group, header in pairs(self.headers) do
UF.headerFunctions[group]:Update(header)
local shouldUpdateHeader
if header.numGroups == nil or smartRaidFilterEnabled then
shouldUpdateHeader = false
elseif header.numGroups ~= nil and not smartRaidFilterEnabled then
shouldUpdateHeader = true
end
self:CreateAndUpdateHeaderGroup(group, nil, nil, shouldUpdateHeader)
if group == 'party' or group == 'raid' or group == 'raid40' then
--Update BuffIndicators on profile change as they might be using profile specific data
self:UpdateAuraWatchFromHeader(group)
end
end
end
local function HideRaid()
if InCombatLockdown() then return end
CompactRaidFrameManager:Kill()
local compact_raid = CompactRaidFrameManager_GetSetting("IsShown")
if compact_raid and compact_raid ~= "0" then
CompactRaidFrameManager_SetSetting("IsShown", "0")
end
end
function UF:DisableBlizzard()
if (not E.private.unitframe.disabledBlizzardFrames.raid) and (not E.private.unitframe.disabledBlizzardFrames.party) then return; end
if not CompactRaidFrameManager_UpdateShown then
E:StaticPopup_Show("WARNING_BLIZZARD_ADDONS")
else
if not CompactRaidFrameManager.hookedHide then
hooksecurefunc("CompactRaidFrameManager_UpdateShown", HideRaid)
CompactRaidFrameManager:HookScript('OnShow', HideRaid)
CompactRaidFrameManager.hookedHide = true
end
CompactRaidFrameContainer:UnregisterAllEvents()
HideRaid()
end
end
local hiddenParent = CreateFrame("Frame")
hiddenParent:Hide()
local HandleFrame = function(baseName)
local frame
if(type(baseName) == 'string') then
frame = _G[baseName]
else
frame = baseName
end
if(frame) then
frame:UnregisterAllEvents()
frame:Hide()
-- Keep frame hidden without causing taint
frame:SetParent(hiddenParent)
local health = frame.healthbar
if(health) then
health:UnregisterAllEvents()
end
local power = frame.manabar
if(power) then
power:UnregisterAllEvents()
end
local spell = frame.spellbar
if(spell) then
spell:UnregisterAllEvents()
end
local altpowerbar = frame.powerBarAlt
if(altpowerbar) then
altpowerbar:UnregisterAllEvents()
end
end
end
function ElvUF:DisableBlizzard(unit)
if(not unit) or InCombatLockdown() then return end
if(unit == 'player') and E.private.unitframe.disabledBlizzardFrames.player then
HandleFrame(PlayerFrame)
-- For the damn vehicle support:
PlayerFrame:RegisterUnitEvent('UNIT_ENTERING_VEHICLE', "player")
PlayerFrame:RegisterUnitEvent('UNIT_ENTERED_VEHICLE', "player")
PlayerFrame:RegisterUnitEvent('UNIT_EXITING_VEHICLE', "player")
PlayerFrame:RegisterUnitEvent('UNIT_EXITED_VEHICLE', "player")
PlayerFrame:RegisterEvent('PLAYER_ENTERING_WORLD')
-- User placed frames don't animate
PlayerFrame:SetUserPlaced(true)
PlayerFrame:SetDontSavePosition(true)
RuneFrame:SetParent(PlayerFrame)
elseif(unit == 'pet') and E.private.unitframe.disabledBlizzardFrames.player then
HandleFrame(PetFrame)
elseif(unit == 'target') and E.private.unitframe.disabledBlizzardFrames.target then
HandleFrame(TargetFrame)
HandleFrame(ComboFrame)
elseif(unit == 'focus') and E.private.unitframe.disabledBlizzardFrames.focus then
HandleFrame(FocusFrame)
HandleFrame(FocusFrameToT)
elseif(unit == 'targettarget') and E.private.unitframe.disabledBlizzardFrames.target then
HandleFrame(TargetFrameToT)
elseif(unit:match'(boss)%d?$' == 'boss') and E.private.unitframe.disabledBlizzardFrames.boss then
local id = unit:match'boss(%d)'
if(id) then
HandleFrame('Boss' .. id .. 'TargetFrame')
else
for i=1, MAX_BOSS_FRAMES do
HandleFrame(('Boss%dTargetFrame'):format(i))
end
end
elseif(unit:match'(party)%d?$' == 'party') and E.private.unitframe.disabledBlizzardFrames.party then
local id = unit:match'party(%d)'
if(id) then
HandleFrame('PartyMemberFrame' .. id)
else
for i=1, 4 do
HandleFrame(('PartyMemberFrame%d'):format(i))
end
end
HandleFrame(PartyMemberBackground)
elseif(unit:match'(arena)%d?$' == 'arena') and E.private.unitframe.disabledBlizzardFrames.arena then
local id = unit:match'arena(%d)'
if(id) then
HandleFrame('ArenaEnemyFrame' .. id)
HandleFrame('ArenaPrepFrame'..id)
HandleFrame('ArenaEnemyFrame'..id..'PetFrame')
else
for i=1, 5 do
HandleFrame(('ArenaEnemyFrame%d'):format(i))
HandleFrame(('ArenaPrepFrame%d'):format(i))
HandleFrame(('ArenaEnemyFrame%dPetFrame'):format(i))
end
end
end
end
function UF:ADDON_LOADED(_, addon)
if addon ~= 'Blizzard_ArenaUI' then return; end
ElvUF:DisableBlizzard('arena')
self:UnregisterEvent("ADDON_LOADED");
end
local hasEnteredWorld = false
function UF:PLAYER_ENTERING_WORLD()
if not hasEnteredWorld then
--We only want to run Update_AllFrames once when we first log in or /reload
self:Update_AllFrames()
hasEnteredWorld = true
else
local _, instanceType = IsInInstance()
if instanceType ~= "none" then
--We need to update headers when we zone into an instance
UF:UpdateAllHeaders()
end
end
end
function UF:UnitFrameThreatIndicator_Initialize(_, unitFrame)
unitFrame:UnregisterAllEvents() --Arena Taint Fix
end
function UF:ResetUnitSettings(unit)
E:CopyTable(self.db.units[unit], P.unitframe.units[unit]);
if self.db.units[unit].buffs and self.db.units[unit].buffs.sizeOverride then
self.db.units[unit].buffs.sizeOverride = P.unitframe.units[unit].buffs.sizeOverride or 0
end
if self.db.units[unit].debuffs and self.db.units[unit].debuffs.sizeOverride then
self.db.units[unit].debuffs.sizeOverride = P.unitframe.units[unit].debuffs.sizeOverride or 0
end
self:Update_AllFrames()
end
function UF:ToggleForceShowGroupFrames(unitGroup, numGroup)
for i=1, numGroup do
if self[unitGroup..i] and not self[unitGroup..i].isForced then
UF:ForceShow(self[unitGroup..i])
elseif self[unitGroup..i] then
UF:UnforceShow(self[unitGroup..i])
end
end
end
local ignoreSettings = {
['position'] = true,
['priority'] = true,
}
local ignoreSettingsGroup = {
['visibility'] = true,
}
local allowPass = {
['sizeOverride'] = true,
}
function UF:MergeUnitSettings(fromUnit, toUnit, isGroupUnit)
local db = self.db.units
local filter = ignoreSettings
if isGroupUnit then
filter = ignoreSettingsGroup
end
if fromUnit ~= toUnit then
for option, value in pairs(db[fromUnit]) do
if type(value) ~= 'table' and not filter[option] then
if db[toUnit][option] ~= nil then
db[toUnit][option] = value
end
elseif not filter[option] then
if type(value) == 'table' then
for opt, val in pairs(db[fromUnit][option]) do
--local val = db[fromUnit][option][opt]
if type(val) ~= 'table' and not filter[opt] then
if db[toUnit][option] ~= nil and (db[toUnit][option][opt] ~= nil or allowPass[opt]) then
db[toUnit][option][opt] = val
end
elseif not filter[opt] then
if type(val) == 'table' then
for o, v in pairs(db[fromUnit][option][opt]) do
if not filter[o] then
if db[toUnit][option] ~= nil and db[toUnit][option][opt] ~= nil and db[toUnit][option][opt][o] ~= nil then
db[toUnit][option][opt][o] = v
end
end
end
end
end
end
end
end
end
else
E:Print(L["You cannot copy settings from the same unit."])
end
self:Update_AllFrames()
end
local function updateColor(self, r, g, b)
if not self.isTransparent then return end
if self.backdrop then
local _, _, _, a = self.backdrop:GetBackdropColor()
self.backdrop:SetBackdropColor(r * 0.58, g * 0.58, b * 0.58, a)
elseif self:GetParent().template then
local _, _, _, a = self:GetParent():GetBackdropColor()
self:GetParent():SetBackdropColor(r * 0.58, g * 0.58, b * 0.58, a)
end
if self.bg and self.bg:GetObjectType() == 'Texture' and not self.bg.multiplier then
self.bg:SetColorTexture(r * 0.35, g * 0.35, b * 0.35)
end
end
function UF:ToggleTransparentStatusBar(isTransparent, statusBar, backdropTex, adjustBackdropPoints, invertBackdropTex, reverseFill)
statusBar.isTransparent = isTransparent
local statusBarTex = statusBar:GetStatusBarTexture()
local statusBarOrientation = statusBar:GetOrientation()
if isTransparent then
if statusBar.backdrop then
statusBar.backdrop:SetTemplate("Transparent", nil, nil, nil, true)
statusBar.backdrop.ignoreUpdates = true
elseif statusBar:GetParent().template then
statusBar:GetParent():SetTemplate("Transparent", nil, nil, nil, true)
statusBar:GetParent().ignoreUpdates = true
end
statusBar:SetStatusBarTexture(0, 0, 0, 0)
if statusBar.texture then statusBar.texture = statusBar:GetStatusBarTexture() end --Needed for Power element
backdropTex:ClearAllPoints()
if statusBarOrientation == 'VERTICAL' then
backdropTex:Point("TOPLEFT", statusBar, "TOPLEFT")
backdropTex:Point("BOTTOMLEFT", statusBarTex, "TOPLEFT")
backdropTex:Point("BOTTOMRIGHT", statusBarTex, "TOPRIGHT")
else
if reverseFill then
backdropTex:Point("TOPRIGHT", statusBarTex, "TOPLEFT")
backdropTex:Point("BOTTOMRIGHT", statusBarTex, "BOTTOMLEFT")
backdropTex:Point("BOTTOMLEFT", statusBar, "BOTTOMLEFT")
else
backdropTex:Point("TOPLEFT", statusBarTex, "TOPRIGHT")
backdropTex:Point("BOTTOMLEFT", statusBarTex, "BOTTOMRIGHT")
backdropTex:Point("BOTTOMRIGHT", statusBar, "BOTTOMRIGHT")
end
end
if invertBackdropTex then
backdropTex:Show()
end
if not invertBackdropTex and not statusBar.hookedColor then
hooksecurefunc(statusBar, "SetStatusBarColor", updateColor)
statusBar.hookedColor = true
end
if backdropTex.multiplier then
backdropTex.multiplier = 0.25
end
else
if statusBar.backdrop then
statusBar.backdrop:SetTemplate("Default", nil, nil, not statusBar.PostCastStart and self.thinBorders, true)
statusBar.backdrop.ignoreUpdates = nil
elseif statusBar:GetParent().template then
statusBar:GetParent():SetTemplate("Default", nil, nil, self.thinBorders, true)
statusBar:GetParent().ignoreUpdates = nil
end
statusBar:SetStatusBarTexture(LSM:Fetch("statusbar", self.db.statusbar))
if statusBar.texture then statusBar.texture = statusBar:GetStatusBarTexture() end
if adjustBackdropPoints then
backdropTex:ClearAllPoints()
if statusBarOrientation == 'VERTICAL' then
backdropTex:Point("TOPLEFT", statusBar, "TOPLEFT")
backdropTex:Point("BOTTOMLEFT", statusBarTex, "TOPLEFT")
backdropTex:Point("BOTTOMRIGHT", statusBarTex, "TOPRIGHT")
else
if reverseFill then
backdropTex:Point("TOPRIGHT", statusBarTex, "TOPLEFT")
backdropTex:Point("BOTTOMRIGHT", statusBarTex, "BOTTOMLEFT")
backdropTex:Point("BOTTOMLEFT", statusBar, "BOTTOMLEFT")
else
backdropTex:Point("TOPLEFT", statusBarTex, "TOPRIGHT")
backdropTex:Point("BOTTOMLEFT", statusBarTex, "BOTTOMRIGHT")
backdropTex:Point("BOTTOMRIGHT", statusBar, "BOTTOMRIGHT")
end
end
end
if invertBackdropTex then
backdropTex:Hide()
end
if backdropTex.multiplier then
backdropTex.multiplier = 0.25
end
end
end
function UF:Initialize()
self.db = E.db.unitframe
self.thinBorders = self.db.thinBorders or E.PixelMode
if E.private.unitframe.enable ~= true then return; end
E.UnitFrames = UF;
local ElvUF_Parent = CreateFrame('Frame', 'ElvUF_Parent', E.UIParent, 'SecureHandlerStateTemplate');
ElvUF_Parent:SetFrameStrata("LOW")
RegisterStateDriver(ElvUF_Parent, "visibility", "[petbattle] hide; show")
self:UpdateColors()
ElvUF:RegisterStyle('ElvUF', function(frame, unit)
self:Construct_UF(frame, unit)
end)
self:LoadUnits()
self:RegisterEvent('PLAYER_ENTERING_WORLD')
--InterfaceOptionsFrameCategoriesButton9:SetScale(0.0001)
--[[if E.private.unitframe.disabledBlizzardFrames.arena and E.private.unitframe.disabledBlizzardFrames.focus and E.private.unitframe.disabledBlizzardFrames.party then
InterfaceOptionsFrameCategoriesButton10:SetScale(0.0001)
end
if E.private.unitframe.disabledBlizzardFrames.target then
InterfaceOptionsCombatPanelTargetOfTarget:SetScale(0.0001)
InterfaceOptionsCombatPanelTargetOfTarget:SetAlpha(0)
end]]
if E.private.unitframe.disabledBlizzardFrames.party and E.private.unitframe.disabledBlizzardFrames.raid then
self:DisableBlizzard()
--InterfaceOptionsFrameCategoriesButton11:SetScale(0.0001)
self:RegisterEvent('GROUP_ROSTER_UPDATE', 'DisableBlizzard')
UIParent:UnregisterEvent('GROUP_ROSTER_UPDATE') --This may fuck shit up.. we'll see...
else
CompactUnitFrameProfiles:RegisterEvent('VARIABLES_LOADED')
end
if (not E.private.unitframe.disabledBlizzardFrames.party) and (not E.private.unitframe.disabledBlizzardFrames.raid) then
E.RaidUtility.Initialize = E.noop
end
if E.private.unitframe.disabledBlizzardFrames.arena then
self:SecureHook('UnitFrameThreatIndicator_Initialize')
if not IsAddOnLoaded('Blizzard_ArenaUI') then
self:RegisterEvent('ADDON_LOADED')
else
ElvUF:DisableBlizzard('arena')
end
end
local ORD = ns.oUF_RaidDebuffs or oUF_RaidDebuffs
if not ORD then return end
ORD.ShowDispellableDebuff = true
ORD.FilterDispellableDebuff = true
ORD.MatchBySpellName = false
self:UpdateRangeCheckSpells()
end
local function InitializeCallback()
UF:Initialize()
end
E:RegisterInitialModule(UF:GetName(), InitializeCallback)
|
local everestLavaBlocker = {}
everestLavaBlocker.name = "everest/lavaBlockerTrigger"
everestLavaBlocker.placements = {
name = "lava_blocker",
data = {
canReenter = false
}
}
return everestLavaBlocker
|
local handy = request('!.mechs.processor.handy')
local opt = handy.opt
local word = request('^.words.word')
local expr_list = request('^.wrappers.expr_list')
local empty_statement = request('empty_statement')
return
{
name = 'return_statement',
word('return'),
opt(expr_list),
opt(empty_statement),
}
|
mod_name="__ProgrammableCombinator__"
|
include "app.gameClass.trigger.Trigger"
_ENV=namespace "game"
using_namespace "luaClass"
using_namespace "container"
---@class SkillTrigger
class("SkillTrigger"){
CLASS_DEBUG(false);
super(Trigger);
}
function SkillTrigger:SkillTrigger(parent,triggerName,triggerArgvs,showLevel)
self:Trigger(triggerName,triggerArgvs)
self.level=showLevel
self.parent=parent
end
function SkillTrigger:check()
return self.parent.level>=self.level and self.parent.equipped
end
function SkillTrigger:toString()
if self.parent.level>=self.level then
return self:getSuperMethod("Trigger","toString")(self)
else
return string.format( "(%i)该效果未解锁",self.level )
end
end
|
local _M = {
addr = {
kremcoins = 0x7e08cc,
tileCollisionMathPointer = 0x7e17b2,
spriteBase = 0x7e0de2,
verticalPointer = 0xc414,
tiledataPointer = 0x7e0098,
haveBoth = 0x7e08c2,
---Height in game units for vertical levels, width for horizontal
areaLength = 0x7e17b4,
---This is always the traditional width no matter the level type
areaWidth = 0x7e0afc,
---This is always the traditional height no matter the level type
areaHeight = 0x7e0afe,
cameraX = 0x7e17ba,
cameraY = 0x7e17c0,
cameraX2 = 0x7e0ad7,
cameraY2 = 0x7e0adb,
leadChar = 0x7e08a4,
partyX = 0x7e0a2a,
partyY = 0x7e0a2c,
solidLessThan = 0x7e00a0,
kongLetters = 0x7e0902,
mathLives = 0x7e08be,
displayLives = 0x7e0c0,
mainAreaNumber = 0x7e08a8,
currentAreaNumber = 0x7e08c8,
},
flag = {
sprite = {
dying = 0x1000,
}
},
size = {
tile = 32,
enemy = 64,
sprite = 94,
},
offset = {
sprite = {
control = 0x00,
x = 0x06,
y = 0x0a,
jumpHeight = 0x0e,
style = 0x12,
velocityX = 0x20,
velocityY = 0x24,
motion = 0x2e,
}
}
}
return _M
|
---@class UnityEngine.PlayMode : System.Enum
---@field value__ int
---@field StopSameLayer UnityEngine.PlayMode
---@field StopAll UnityEngine.PlayMode
local m = {}
UnityEngine = {}
UnityEngine.PlayMode = m
return m
|
Config = {}
--
-- Video shown on screen. Default is "CASINO_DIA_PL".
--
-- CASINO_DIA_PL - Falling Diamonds
-- CASINO_HLW_PL - Falling Skulls
-- CASINO_SNWFLK_PL - Falling Snowflakes
--
Config.VideoType = 'CASINO_DIA_PL'
--
-- Enter & Exit Events
--
-- These events should be fired by your teleport script when the player
-- enters or exits the casino.
--
Config.EnterEvent = 'chCasinoWall:enteredCasino'
Config.ExitEvent = 'chCasinoWall:exitedCasino'
--
-- Big Win Event
--
-- Firing this event will cause the video walls to switch to the confetti
-- animation before going back to the video type specified above.
--
Config.BigWinEvent = 'chCasinoWall:bigWin'
|
--[[
name : global_data.lua
version: 1.0 beta
author : casanoe
creation : 16/04/2021
update : 19/06/2021
TODO : ?
--]]
return {
data = {
managedEvent = { initial = {} },
globalvars = { initial = {} },
managedContext = { initial = {} },
dzbench = { history = true, maxMinutes = 10 }
},
helpers = {
load_dzBasicLibs = function(dz, options)
--------------------
-- LIBS --
--------------------
local dzu = dz.utils
local lodash = dzu._
--------------------
-- VARS --
--------------------
C_GARBAGE_FREQ = 7 * 24 * 3600 -- every 7 days
C_CURL_PATH = '/usr/bin/curl'
DZ_BATTERY_THRESHOLD = 10
DZ_SIGNAL_THRESHOLD = 10
DZ_LANG = 'fr'
--------------------
-- TABLE --
--------------------
function table.merge(t1, t2)
local r = {}
for k, v in pairs(t1) do r[k] = v end
for k, v in pairs(t2) do r[k] = v end
return r
end
function table.clone(t)
local r = {}
for k, v in pairs(t) do r[k] = v end
return r
end
function table.dump(o)
if type(o) == 'table' then
local s = '{ '
for k, v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. table.dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
--------------------
-- TOOLS --
--------------------
function aprint(...)
lodash.print(...)
end
function tprint(t)
for k, v in pairs(t) do print(k..' ==> '..(tostring(v) or 'nil')) end
end
function strFind(s, f)
return string.find('|'..s:lower()..'|', '|'..tostring(f):lower()..'|', 1, true) ~= nil
end
function trim(s)
return s:match'^()%s*$' and '' or s:match'^%s*(.*%S)'
end
function constrain(x, a, b)
if (not x or x < a) then return a
elseif (x > b) then return b
else return x end
end
function benchmark(s, f, ...)
local multiplier = 1000 -- ms
local now = os.clock()
local r = f(...)
local elapsed = (os.clock() - now)
print(string.format("<BENCHMARK> '%s' results: function calls in %2f", s, (elapsed * multiplier)))
return r
end
function uuid(t)
local template = t or 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
math.randomseed(os.time())
return string.gsub(template, 'x', function (c)
return string.format('%x', math.random(0, 0xf))
end)
end
--------------------
-- STRING --
--------------------
function string.trim(str, ch)
ch = ch or "%s"
if str then return (str:gsub("^"..ch.."*(.-)"..ch.."*$", "%1"))
else return str end
end
function string.escape_markdown(str)
return tostring(str):gsub('%_', '\\_'):gsub('%[', '\\['):gsub('%*', '\\*'):gsub('%`', '\\`')
end
function string.escape_html(str)
return tostring(str):gsub('%&', '&'):gsub('%<', '<'):gsub('%>', '>')
end
function string.escape_url(str)
return tostring(str):gsub("[^%w]", function(chr) return string.format("%%%X", string.byte(chr)) end)
end
function string.escape_bash(str)
return tostring(str):gsub('%$', ''):gsub('%^', ''):gsub('%&', ''):gsub('%|', ''):gsub('%;', '')
end
function string.truncate(str, n)
local sep = "[?;!.]"
local d = nil
str = string.sub(str, 1, n)
local p = string.find(str, sep, 1)
d = p
while p do
p = string.find(str, sep, p + 1)
if p then
d = p
end
end
return(string.sub(str, 1, d))
end
function string.noaccent(str)
if (str) then
str = string.gsub (str, "Ç", "C")
str = string.gsub (str, "ç", "c")
str = string.gsub (str, "[-èéêë']+", "e")
str = string.gsub (str, "[-ÈÉÊË']+", "E")
str = string.gsub (str, "[-àáâãäå']+", "a")
str = string.gsub (str, "[-@ÀÁÂÃÄÅ']+", "A")
str = string.gsub (str, "[-ìíîï']+", "i")
str = string.gsub (str, "[-ÌÍÎÏ']+", "I")
str = string.gsub (str, "[-ðòóôõö']+", "o")
str = string.gsub (str, "[-ÒÓÔÕÖ']+", "O")
str = string.gsub (str, "[-ùúûü']+", "u")
str = string.gsub (str, "[-ÙÚÛÜ']+", "U")
str = string.gsub (str, "[-ýÿ']+", "y")
str = string.gsub (str, "Ý", "Y")
end
return str
end
--------------------
-- GEO --
--------------------
function geoLoc(addr, lat, lon)
local u
if not addr or addr == '' then
lat = lat or tostring(dz.settings.location.latitude)
lon = lon or tostring(dz.settings.location.longitude)
u = simpleCurl('"https://nominatim.openstreetmap.org/reverse?lat='..lat..'&lon='..lon..'&format=jsonv2&zoom=10"')
return fromData(u)
else
u = simpleCurl('"https://nominatim.openstreetmap.org/search?q='..dzu.urlEncode(addr)..'&format=jsonv2&addressdetails=1"')
return fromData(u)[1]
end
end
--------------------
-- TIME --
--------------------
function timeRule(r)
return (r == nil or r == "" or dz.time.matchesRule(r))
end
function at(r, func, ...)
if timeRule(r) then func(...) end
end
function secondsFromNow(last)
local now = os.time(os.date('*t'))
return last and math.abs(now - last) or 0
end
--------------------
-- GLOBALDATA --
--------------------
function init_globalData()
dz.globalData.initialize('managedEvent')
dz.globalData.initialize('managedContext')
dz.globalData.initialize('globalvars')
dz.globalData.initialize('dzbench')
dz.globalData.dzbench.reset()
end
function get_globalvars(k)
return dz.globalData.globalvars[k]
end
function set_globalvars(k, v)
dz.globalData.globalvars[k] = v
end
function is_globalvars(k)
return dz.globalData.globalvars[k] ~= nil
end
--------------------
-- NOTIF --
--------------------
function sendNotification(message, settings)
if not settings['QUIET'] or not timeRule(settings['QUIET']) then
local subsystems = settings['SUBSYSTEMS'] or ''
subsystems = subsystems:gsub('([^,]+)', function(x) return dz['NSS_'..x] end)
local subject = settings['SUBJECT'] or 'domoticz'
local priority = dz['PRIORITY_'..(settings['PRIORITY'] or 'NORMAL')]
if settings['FREQUENCY'] then
local n1 = managedEvent(message) and managedEvent(message)['nb']
local n2 = managedEvent(message, n1 ~= settings['FREQUENCY'])['nb']
if n2 > 0 then
return false
end
end
dz.notify(subject, message, priority, nil, nil, subsystems)
return true
end
end
--------------------
-- REQUEST --
--------------------
function fromData(data)
return (dzu.isJSON(data) and dzu.fromJSON(data, data)) or
(dzu.isXML(data) and dzu.fromXML(data, data)) or
data
end
function httpRequest(url, settings)
local method = "GET"
local headers = settings.headers or {['Content-Type'] = "text/html"}
if settings.postdata ~= nil then
method = "POST"
if dzu.isJSON(settings.postdata) then
headers = settings.headers or {['Content-Type'] = 'application/json'}
elseif dzu.isXML(settings.postdata) then
headers = settings.headers or {['Content-Type'] = "text/xml"}
end
end
dz.openURL(
{
url = url,
method = method,
callback = settings.callback,
headers = headers,
postData = settings.postdata
}
)
end
function osCommand(cmd, timeout)
if timeout then
cmd = '/usr/bin/timeout '..timeout..'s'..' --preserve-status '..cmd
end
return dzu.osCommand(cmd)
end
function executeScript(cmd, callback, timeout)
if callback then
dz.executeShellCommand(
{
command = cmd,
callback = (type(callback) == 'string') and callback,
timeout = timeout or 5,
}
)
else return osCommand(cmd, timeout) end
end
function curl(url, settings)
local cmd = C_CURL_PATH..' "'..url..'" '
if type(settings) == 'table' then
if settings['headers'] then
for _, v in pairs(settings['headers']) do
cmd = cmd..' -H "'..v..'"'
end
end
if settings['data'] then
cmd = cmd..' -d "'
for k, v in pairs(settings['data'] ) do
cmd = cmd..k..'='..dzu.urlEncode(v)..'&'
end
cmd = cmd..'" '
end
cmd = cmd..'-X '..(settings['method'] or 'GET')
if not settings['callback'] and settings['timeout'] then
cmd = cmd..' '..'--connect-timeout '..tostring(settings['timeout'])
else
return executeScript(cmd, settings['callback'], settings['timeout'])
end
end
return executeScript(cmd)
end
function simpleCurl(args, callback, timeout)
return executeScript(C_CURL_PATH..' '..args, callback, timeout)
end
--------------------
-- EVENTS --
--------------------
function managedEvent(id, f)
local now = os.time(os.date('*t'))
local e = dz.globalData.managedEvent[id] or { nb = 0, last = now, first = 0 }
e.nb = (f == true and e.nb + 1) or (f == false and 0) or e.nb
e.last = now
e.first = (f == true and e.nb <= 1 and now) or (e.nb == 0 and 0) or e.first
dz.globalData.managedEvent[id] = e
return e
end
function is_managedEvent(id)
return id and dz.globalData.managedEvent[id] ~= nil
end
function state_managedEvent(id)
return is_managedEvent(id) and dz.globalData.managedEvent[id].nb > 0
end
function sendCustomEvent(e, context)
dz.emitEvent(e, context or {})
end
--------------------
-- CONTEXT --
--------------------
function managedContext(id, context, t)
local now = os.time(os.date('*t'))
if context == false then
dz.globalData.managedContext[id] = nil
return
elseif context then
dz.globalData.managedContext[id] = {
context = context,
last = now,
timeout = t
}
end
return dz.globalData.managedContext[id]
end
function garbage_managed()
print('<DZB-INFO> Garbage managed data in progress')
for _, t in pairs({'managedEvent', 'managedContext'}) do
for k, v in pairs(dz.globalData[t]) do
if secondsFromNow(v.last) > C_GARBAGE_FREQ then
dz.globalData[t][k] = nil
end
end
end
end
at('at 02:00', garbage_managed)
function dzBasicCall_getData(id)
local c = managedContext(id)
return c and c['context'] or nil
end
function dzBasicCall_isvalidData(id)
local c = managedContext(id)
return c and c['timeout'] and (c['timeout'] == 0 or secondsFromNow(c['last']) < c['timeout'])
end
function dzBasicCall_setData(id, context, t)
managedContext(id, context, t)
end
function dzBasicCall_return(id, r, t)
if dz.globalData.managedContext[id] then
local c = dz.globalData.managedContext[id]['context']
if c['microbasic'] then
c['returnval'] = r
managedContext(id, c, t)
sendCustomEvent('dzBasic_customevent', c)
end
end
end
--------------------
-- DZB TOOLS --
--------------------
function getItem(id)
return
(dzu.deviceExists(id) and dz.devices(id)) or
(dzu.groupExists(id) and dz.groups(id)) or
(dzu.sceneExists(id) and dz.scenes(id)) or
(dzu.variableExists(id) and dz.variables(id)) or
nil
end
function dzbformat(s, dv)
-- %%devname#property%% or %%property%%
local a, b = string.gsub(s, '%%%%([^%%#\n\r\t]+#?[%w_]*)%%%%',
function(w)
local d = dzu.stringSplit(w, '#')
r = #d > 1 and getItem(d[1]) or getItem(dv)
return #d > 1 and tostring(r[d[2]]) or tostring(r[d[1]])
end
)
return a
end
function dzbswitch(id, c, settings)
local haschanged = false
c = c:sub(1, 1):upper()..c:sub(2):lower()
settings = settings or {}
group(id,
function(d)
local state = c ~= 'Off'
haschanged = haschanged or (state ~= d.active)
if c == 'Flash' then
d.setState('Toggle').forSec(1).repeatAfterSec(1, 5)
elseif settings['checkfirst'] and d.active == state then
return false
elseif settings['silent'] then
d.setState(c).silent()
else
d.setState(c)
end
end
)
return haschanged
end
function dzbupdate(id, v, n, settings)
local haschanged = false
group(id,
function(d)
if d.switchType == 'Dimmer' and type(v) == 'number' then
haschanged = haschanged or (d.level ~= v)
if settings and settings['silent'] then d.dimTo(constrain(v, 0, 100)).silent()
else d.dimTo(constrain(v, 0, 100)) end
elseif d.switchType == 'Selector' then
haschanged = haschanged or (d.levelName ~= v)
if settings and settings['silent'] then d.switchSelector(v).silent()
else d.switchSelector(v) end
else
haschanged = haschanged or (d.sValue ~= v)
if n then haschanged = haschanged or (d.nValue ~= n) end
if settings and settings['silent'] then d.setValues(n, dzu.urlEncode(v)).silent()
else d.setValues(n, dzu.urlEncode(v)) end
end
end
)
return haschanged
end
function group(filter, func, b)
local r = {}
local filters
if type(filter) == 'table' and filter['idx'] then filters = { filter.idx }
elseif type(filter) == 'table' then filters = filter
elseif type(filter) == 'number' then filters = { filter }
elseif type(filter) == 'string' then filters = dzu.stringSplit(filter, ',')
else return end
for _, f in ipairs(filters) do
if type(f) == 'number' or b == false then
if func then func(getItem(f)) end
table.insert(r, f)
else
for _, z in ipairs({'devices', 'groups', 'scenes'}) do
dz[z]().forEach(
function(d)
if string.find(d.name, '^'..f) then
if func then func(d) end
table.insert(r, d.idx)
end
end
)
end
end
end
return r
end
function _cmp(x, y, op)
if op == '>' then return x > y
elseif op == '<' then return x < y
elseif op == '>=' then return x >= y
elseif op == '<=' then return x <= y
elseif op == '~' or op == '~=' or op == '<>' then return x ~= y
elseif op == '=' or op == '==' or not op then return x == y
else return false
end
end
function group_cmp(filter, x, y, op)
local b = true
group(filter,
function(d)
local v = d
if type(x) == 'table' then v = d[x[1]] x = x[2] end
if v and v[x] ~= nil and type(v[x]) ~= 'table' then
b = b and _cmp(v[x], y, op)
end
end
)
return b
end
end
}
}
|
local defaultParams = {
name = "", text = "",
txtColor = 0, bgColor = 0,
offsetX = 0, offsetY = 0,
scaleX = 1, scaleY = 1,
}
Button = Core.class(Sprite)
-- params (table):
-- w (number): width of the button
-- h (number): height of the button
-- font (Font): font to use [optional]
-- name (string): name of the button [optional]
-- text (string): text to display [optional]
-- texture (Texture): ninepatch texture to use [optional]
-- txtColor (number): text color [default: black]
-- bgColor (number): background color [default: black]
-- offsetX (number): offset position by X [default: 0]
-- offsetY (number): offset position by Y [default: 0]
-- scaleX (number): text scale by Y [default: 1]
-- scaleY (number): text scale by Y [default: 1]
function Button:init(params)
params = params or {}
append(params, defaultParams)
self.g = Pixel.new(params.bgColor, 1, params.w, params.h)
if (params.texture) then
self.g:setTexture(params.texture)
self.g:setNinePatch(16)
end
self:addChild(self.g)
self.tf = Label.new(
params.font, params.text, params.txtColor,
params.w / 2 + params.offsetX, params.h / 2 + params.offsetY,
params.scaleX, params.scaleY
)
self:addChild(self.tf)
self.name = params.name
end
function Button:getText()
return self.tf.text:getText()
end
|
-- $Id: test/cstack.lua $
-- See Copyright Notice in file all.lua
local tracegc = require"tracegc"
print"testing stack overflow detection"
-- Segmentation faults in these tests probably result from a C-stack
-- overflow. To avoid these errors, you should set a smaller limit for
-- the use of C stack by Lua, by changing the constant 'LUAI_MAXCCALLS'.
-- Alternatively, you can ensure a larger stack for the program.
local function checkerror (msg, f, ...)
local s, err = pcall(f, ...)
assert(not s and string.find(err, msg))
end
do print("testing stack overflow in message handling")
local count = 0
local function loop (x, y, z)
count = count + 1
return 1 + loop(x, y, z)
end
tracegc.stop() -- __gc should not be called with a full stack
local res, msg = xpcall(loop, loop)
tracegc.start()
assert(msg == "error in error handling")
print("final count: ", count)
end
-- bug since 2.5 (C-stack overflow in recursion inside pattern matching)
do print("testing recursion inside pattern matching")
local function f (size)
local s = string.rep("a", size)
local p = string.rep(".?", size)
return string.match(s, p)
end
local m = f(80)
assert(#m == 80)
checkerror("too complex", f, 2000)
end
do print("testing stack-overflow in recursive 'gsub'")
local count = 0
local function foo ()
count = count + 1
string.gsub("a", ".", foo)
end
checkerror("stack overflow", foo)
print("final count: ", count)
print("testing stack-overflow in recursive 'gsub' with metatables")
local count = 0
local t = setmetatable({}, {__index = foo})
foo = function ()
count = count + 1
string.gsub("a", ".", t)
end
checkerror("stack overflow", foo)
print("final count: ", count)
end
do -- bug in 5.4.0
print("testing limits in coroutines inside deep calls")
local count = 0
local lim = 1000
local function stack (n)
if n > 0 then return stack(n - 1) + 1
else coroutine.wrap(function ()
count = count + 1
stack(lim)
end)()
end
end
local st, msg = xpcall(stack, function () return "ok" end, lim)
assert(not st and msg == "ok")
print("final count: ", count)
end
do
print("nesting of resuming yielded coroutines")
local count = 0
local function body ()
coroutine.yield()
local f = coroutine.wrap(body)
f(); -- start new coroutine (will stop in previous yield)
count = count + 1
f() -- call it recursively
end
local f = coroutine.wrap(body)
f()
assert(not pcall(f))
print("final count: ", count)
end
if T then
print("testing stack recovery")
local N = 0 -- trace number of calls
local LIM = -1 -- will store N just before stack overflow
-- trace stack size; after stack overflow, it should be
-- the maximum allowed stack size.
local stack1
local dummy
local function err(msg)
assert(string.find(msg, "stack overflow"))
local _, stacknow = T.stacklevel()
assert(stacknow == stack1 + 200)
end
-- When LIM==-1, the 'if' is not executed, so this function only
-- counts and stores the stack limits up to overflow. Then, LIM
-- becomes N, and then the 'if' code is run when the stack is
-- full. Then, there is a stack overflow inside 'xpcall', after which
-- the stack must have been restored back to its maximum normal size.
local function f()
dummy, stack1 = T.stacklevel()
if N == LIM then
xpcall(f, err)
local _, stacknow = T.stacklevel()
assert(stacknow == stack1)
return
end
N = N + 1
f()
end
local topB, sizeB -- top and size Before overflow
local topA, sizeA -- top and size After overflow
topB, sizeB = T.stacklevel()
tracegc.stop() -- __gc should not be called with a full stack
xpcall(f, err)
tracegc.start()
topA, sizeA = T.stacklevel()
-- sizes should be comparable
assert(topA == topB and sizeA < sizeB * 2)
print(string.format("maximum stack size: %d", stack1))
LIM = N -- will stop recursion at maximum level
N = 0 -- to count again
tracegc.stop() -- __gc should not be called with a full stack
f()
tracegc.start()
print"+"
end
print'OK'
|
local LibOrb = Wheel:Set("LibOrb", 20)
if (not LibOrb) then
return
end
local LibFrame = Wheel("LibFrame")
assert(LibFrame, "LibOrb requires LibFrame to be loaded.")
-- Lua API
local _G = _G
local math_abs = math.abs
local math_max = math.max
local math_sqrt = math.sqrt
local select = select
local setmetatable = setmetatable
local type = type
local unpack = unpack
-- WoW API
local CreateFrame = _G.CreateFrame
-- Library registries
LibOrb.orbs = LibOrb.orbs or {}
LibOrb.data = LibOrb.data or {}
LibOrb.embeds = LibOrb.embeds or {}
-- Speed shortcuts
local Orbs = LibOrb.orbs
----------------------------------------------------------------
-- Orb template
----------------------------------------------------------------
local Orb = LibFrame:CreateFrame("Frame")
local Orb_MT = { __index = Orb }
local Update = function(self, elapsed)
local data = Orbs[self]
local value = data.disableSmoothing and data.barValue or data.barDisplayValue
local min, max = data.barMin, data.barMax
local orientation = data.orbOrientation
local width, height = data.scaffold:GetSize()
local orb = data.orb
local spark = data.spark
local glow = data.glow
if value > max then
value = max
elseif value < min then
value = min
end
local newHeight
if value > 0 and value > min and max > min then
newHeight = (value-min)/(max-min) * height
else
newHeight = 0
end
if (value <= min) or (max == min) then
data.scrollframe:Hide()
else
local newSize, mult
if (max > min) then
mult = (value-min)/(max-min)
newSize = mult * width
else
newSize = 0.0001
mult = 0.0001
end
local displaySize = math_max(newSize, 0.0001) -- sizes can't be 0 in Legion
data.scrollframe:SetHeight(displaySize)
data.scrollframe:SetVerticalScroll(height - newHeight)
if (not data.scrollframe:IsShown()) then
data.scrollframe:Show()
end
end
if (value == max) or (value == min) or (value/max >= data.sparkMaxPercent) or (value/max <= data.sparkMinPercent) then
if spark:IsShown() then
spark:Hide()
spark:SetAlpha(data.sparkMinAlpha)
data.sparkDirection = "IN"
glow:Hide()
glow:SetAlpha(data.sparkMinAlpha)
end
else
local scrollframe = data.scrollframe
local sparkOffsetY = data.sparkOffset
local sparkHeight = data.sparkHeight
local leftCrop = data.barLeftCrop
local rightCrop = data.barRightCrop
local sparkWidth = math_sqrt((height/2)^2 - (math_abs((height/2) - newHeight))^2) * 2
local sparkOffsetX = (height - sparkWidth)/2
local sparkOffsetY = data.sparkOffset * sparkHeight
local freeSpace = height - leftCrop - rightCrop
if sparkWidth > freeSpace then
spark:SetSize(freeSpace, sparkHeight)
glow:SetSize(freeSpace, sparkHeight*2)
spark:ClearAllPoints()
glow:ClearAllPoints()
if (leftCrop > freeSpace/2) then
spark:SetPoint("LEFT", scrollframe, "TOPLEFT", leftCrop, sparkOffsetY)
glow:SetPoint("LEFT", scrollframe, "TOPLEFT", leftCrop, sparkOffsetY*2)
else
spark:SetPoint("LEFT", scrollframe, "TOPLEFT", sparkOffsetX, sparkOffsetY)
glow:SetPoint("LEFT", scrollframe, "TOPLEFT", sparkOffsetX, sparkOffsetY*2)
end
if (rightCrop > freeSpace/2) then
spark:SetPoint("RIGHT", scrollframe, "TOPRIGHT", -rightCrop, sparkOffsetY)
glow:SetPoint("RIGHT", scrollframe, "TOPRIGHT", -rightCrop, sparkOffsetY*2)
else
spark:SetPoint("RIGHT", scrollframe, "TOPRIGHT", -sparkOffsetX, sparkOffsetY)
glow:SetPoint("RIGHT", scrollframe, "TOPRIGHT", -sparkOffsetX, sparkOffsetY*2)
end
else
-- fixing the stupid Legion no zero size problem
if (sparkWidth == 0) then
sparkWidth = 0.0001
end
spark:SetSize(sparkWidth, sparkHeight)
spark:ClearAllPoints()
spark:SetPoint("LEFT", scrollframe, "TOPLEFT", sparkOffsetX, sparkOffsetY)
spark:SetPoint("RIGHT", scrollframe, "TOPRIGHT", -sparkOffsetX, sparkOffsetY)
glow:SetSize(sparkWidth, sparkHeight*2)
glow:ClearAllPoints()
glow:SetPoint("LEFT", scrollframe, "TOPLEFT", sparkOffsetX, sparkOffsetY*2)
glow:SetPoint("RIGHT", scrollframe, "TOPRIGHT", -sparkOffsetX, sparkOffsetY*2)
end
if elapsed then
local currentAlpha = glow:GetAlpha()
local targetAlpha = data.sparkDirection == "IN" and data.sparkMaxAlpha or data.sparkMinAlpha
local range = data.sparkMaxAlpha - data.sparkMinAlpha
local alphaChange = elapsed/(data.sparkDirection == "IN" and data.sparkDurationIn or data.sparkDurationOut) * range
if data.sparkDirection == "IN" then
if currentAlpha + alphaChange < targetAlpha then
currentAlpha = currentAlpha + alphaChange
else
currentAlpha = targetAlpha
data.sparkDirection = "OUT"
end
elseif data.sparkDirection == "OUT" then
if currentAlpha + alphaChange > targetAlpha then
currentAlpha = currentAlpha - alphaChange
else
currentAlpha = targetAlpha
data.sparkDirection = "IN"
end
end
spark:SetAlpha(.6 + currentAlpha/3) -- keep the spark brighter and less animated
glow:SetAlpha(currentAlpha) -- the glow is where we apply the full alpha range
end
if (not spark:IsShown()) then
spark:Show()
glow:Show()
end
end
end
local smoothingMinValue = 1 -- if a value is lower than this, we won't smoothe
local smoothingFrequency = .5 -- time for the smooth transition to complete
local smoothingLimit = 1/60 -- max updates per second
local OnUpdate = function(self, elapsed)
local data = Orbs[self]
data.elapsed = (data.elapsed or 0) + elapsed
if (data.elapsed < smoothingLimit) then
return
end
if (data.disableSmoothing) then
if (data.barValue <= data.barMin) or (data.barValue >= data.barMax) then
data.scaffold:SetScript("OnUpdate", nil)
end
elseif (data.smoothing) then
if (math_abs(data.barDisplayValue - data.barValue) < smoothingMinValue) then
data.barDisplayValue = data.barValue
data.smoothing = nil
else
-- The fraction of the total bar this total animation should cover
local animsize = (data.barValue - data.smoothingInitialValue)/(data.barMax - data.barMin)
-- Points per second on average for the whole bar
local pps = (data.barMax - data.barMin)/(data.smoothingFrequency or smoothingFrequency)
-- Position in time relative to the length of the animation, scaled from 0 to 1
local position = (GetTime() - data.smoothingStart)/(data.smoothingFrequency or smoothingFrequency)
if (position < 1) then
-- The change needed when using average speed
local average = pps * animsize * data.elapsed -- can and should be negative
-- Tha change relative to point in time and distance passed
local change = 2*(3 * ( 1 - position )^2 * position) * average*2 -- y = 3 * (1 − t)^2 * t -- quad bezier fast ascend + slow descend
--local change = 2*(3 * ( 1 - position ) * position^2) * average*2 -- y = 3 * (1 − t) * t^2 -- quad bezier slow ascend + fast descend
--local change = 2 * average * ((position < .7) and math_abs(position/.7) or math_abs((1-position)/.3)) -- linear slow ascend + fast descend
--print(("time: %.3f pos: %.3f change: %.1f"):format(GetTime() - data.smoothingStart, position, change))
-- If there's room for a change in the intended direction, apply it, otherwise finish the animation
if ( (data.barValue > data.barDisplayValue) and (data.barValue > data.barDisplayValue + change) )
or ( (data.barValue < data.barDisplayValue) and (data.barValue < data.barDisplayValue + change) ) then
data.barDisplayValue = data.barDisplayValue + change
else
data.barDisplayValue = data.barValue
data.smoothing = nil
end
else
data.barDisplayValue = data.barValue
data.smoothing = nil
end
end
else
if (data.barDisplayValue <= data.barMin) or (data.barDisplayValue >= data.barMax) or (not data.smoothing) then
data.scaffold:SetScript("OnUpdate", nil)
end
end
Update(self, elapsed)
data.elapsed = 0
end
Orb.SetSmoothHZ = function(self, smoothingFrequency)
Orbs[self].smoothingFrequency = smoothingFrequency
end
Orb.DisableSmoothing = function(self, disableSmoothing)
Orbs[self].disableSmoothing = disableSmoothing
end
-- sets the value the orb should move towards
Orb.SetValue = function(self, value, overrideSmoothing)
local data = Orbs[self]
local min, max = data.barMin, data.barMax
if (value > max) then
value = max
elseif (value < min) then
value = min
end
data.barValue = value
if overrideSmoothing then
data.barDisplayValue = value
end
if (not data.disableSmoothing) then
if (data.barDisplayValue > max) then
data.barDisplayValue = max
elseif (data.barDisplayValue < min) then
data.barDisplayValue = min
end
data.smoothingInitialValue = data.barDisplayValue
data.smoothingStart = GetTime()
end
if (value ~= data.barDisplayValue) then
data.smoothing = true
end
if (data.smoothing or (data.barDisplayValue > min) or (data.barDisplayValue < max)) then
if (not data.scaffold:GetScript("OnUpdate")) then
data.scaffold:SetScript("OnUpdate", OnUpdate)
end
end
Update(self)
end
-- forces a hard reset to zero
Orb.Clear = function(self)
local data = Orbs[self]
data.barValue = data.barMin
data.barDisplayValue = data.barMin
Update(self)
end
Orb.SetMinMaxValues = function(self, min, max, overrideSmoothing)
local data = Orbs[self]
if (data.barMin == min) and (data.barMax == max) then
return
end
if (data.barValue > max) then
data.barValue = max
elseif (data.barValue < min) then
data.barValue = min
end
if overrideSmoothing then
data.barDisplayValue = data.barValue
else
if (data.barDisplayValue > max) then
data.barDisplayValue = max
elseif (data.barDisplayValue < min) then
data.barDisplayValue = min
end
end
data.barMin = min
data.barMax = max
Update(self)
end
Orb.SetStatusBarColor = function(self, ...)
local data = Orbs[self]
local r, g, b = ...
data.layer1:SetVertexColor(r, g, b, .5)
data.layer2:SetVertexColor(r*1/2, g*1/2, b*1/2, .9)
data.layer3:SetVertexColor(r*1/4, g*1/4, b*1/4, 1)
data.spark:SetVertexColor(r, g, b)
data.glow:SetVertexColor(r, g, b)
end
Orb.SetStatusBarTexture = function(self, ...)
local data = Orbs[self]
-- set all the layers at once
local numArgs = select("#", ...)
for i = 1, numArgs do
local layer = data["layer"..i]
if (not layer) then
break
end
local path = select(i, ...)
layer:SetTexture(path)
end
-- We hide layers that aren't set
for i = numArgs+1, 3 do
local layer = data["layer"..i]
if layer then
layer:SetTexture(nil)
end
end
end
Orb.SetSparkTexture = function(self, path)
Orbs[self].spark:SetTexture(path)
Orbs[self].glow:SetTexture(path)
Update(self)
end
Orb.SetSparkColor = function(self, ...)
Orbs[self].spark:SetVertexColor(...)
Orbs[self].glow:SetVertexColor(...)
end
Orb.SetSparkMinMaxPercent = function(self, min, max)
local data = Orbs[self]
data.sparkMinPercent = min
data.sparkMinPercent = max
end
Orb.SetSparkBlendMode = function(self, blendMode)
Orbs[self].spark:SetBlendMode(blendMode)
Orbs[self].glow:SetBlendMode(blendMode)
end
Orb.SetSparkFlash = function(self, durationIn, durationOut, minAlpha, maxAlpha)
local data = Orbs[self]
data.sparkDurationIn = durationIn
data.sparkDurationOut = durationOut
data.sparkMinAlpha = minAlpha
data.sparkMaxAlpha = maxAlpha
data.sparkDirection = "IN"
data.spark:SetAlpha(minAlpha)
data.glow:SetAlpha(minAlpha)
end
Orb.ClearAllPoints = function(self)
Orbs[self].scaffold:ClearAllPoints()
end
Orb.SetPoint = function(self, ...)
Orbs[self].scaffold:SetPoint(...)
end
Orb.SetAllPoints = function(self, ...)
Orbs[self].scaffold:SetAllPoints(...)
end
Orb.GetPoint = function(self, ...)
return Orbs[self].scaffold:GetPoint(...)
end
Orb.SetSize = function(self, width, height)
local data = Orbs[self]
local leftCrop = data.barLeftCrop
local rightCrop = data.barRightCrop
data.scaffold:SetSize(width, height)
data.scrollchild:SetSize(width, height)
data.scrollframe:SetWidth(width - (leftCrop + rightCrop))
data.scrollframe:SetHorizontalScroll(leftCrop)
data.scrollframe:ClearAllPoints()
data.scrollframe:SetPoint("BOTTOM", leftCrop/2 - rightCrop/2, 0)
data.sparkHeight = height/4 >= 8 and height/4 or 8
Update(self)
end
Orb.SetWidth = function(self, width)
local data = Orbs[self]
local leftCrop = data.barLeftCrop
local rightCrop = data.barRightCrop
data.scaffold:SetWidth(width)
data.scrollchild:SetWidth(width)
data.scrollframe:SetWidth(width - (leftCrop + rightCrop))
data.scrollframe:SetHorizontalScroll(leftCrop)
data.scrollframe:ClearAllPoints()
data.scrollframe:SetPoint("BOTTOM", leftCrop/2 - rightCrop/2, 0)
Update(self)
end
Orb.SetHeight = function(self, height)
local data = Orbs[self]
data.scaffold:SetHeight(height)
data.scrollchild:SetHeight(height)
data.sparkHeight = height/4 >= 8 and height/4 or 8
Update(self)
end
Orb.SetParent = function(self, parent)
Orbs[self].scaffold:SetParent()
end
Orb.GetValue = function(self)
return Orbs[self].barValue
end
Orb.GetMinMaxValues = function(self)
local data = Orbs[self]
return data.barMin, data.barMax
end
Orb.GetStatusBarColor = function(self, id)
return Orbs[self].bar:GetVertexColor()
end
Orb.GetParent = function(self)
return Orbs[self].scaffold:GetParent()
end
-- Adding a special function to create textures
-- parented to the backdrop frame.
Orb.CreateBackdropTexture = function(self, ...)
return Orbs[self].scaffold:CreateTexture(...)
end
-- Parent newly created textures and fontstrings
-- to the overlay frame, to better mimic normal behavior.
Orb.CreateTexture = function(self, ...)
return Orbs[self].overlay:CreateTexture(...)
end
Orb.CreateFontString = function(self, ...)
return Orbs[self].overlay:CreateFontString(...)
end
Orb.SetScript = function(self, ...)
-- can not allow the scaffold to get its scripts overwritten
local scriptHandler, func = ...
if (scriptHandler == "OnUpdate") then
Orbs[self].OnUpdate = func
else
Orbs[self].scaffold:SetScript(...)
end
end
Orb.GetScript = function(self, ...)
local scriptHandler, func = ...
if (scriptHandler == "OnUpdate") then
return Orbs[self].OnUpdate
else
return Orbs[self].scaffold:GetScript(...)
end
end
Orb.GetObjectType = function(self) return "Orb" end
Orb.IsObjectType = function(self, type) return type == "Orb" or type == "StatusBar" or type == "Frame" end
Orb.Show = function(self) Orbs[self].scaffold:Show() end
Orb.Hide = function(self) Orbs[self].scaffold:Hide() end
Orb.IsShown = function(self) return Orbs[self].scaffold:IsShown() end
Orb.IsForbidden = function(self) return true end
-- Fancy method allowing us to crop the orb's sides
Orb.SetCrop = function(self, leftCrop, rightCrop)
local data = Orbs[self]
data.barLeftCrop = leftCrop
data.barRightCrop = rightCrop
self:SetSize(data.scrollchild:GetSize())
end
Orb.GetCrop = function(self)
local data = Orbs[self]
return data.barLeftCrop, data.barRightCrop
end
LibOrb.CreateOrb = function(self, parent, rotateClockwise, speedModifier)
-- The scaffold is the top level frame object
-- that will respond to SetSize, SetPoint and similar.
local scaffold = CreateFrame("Frame", nil, parent or self)
--scaffold:SetSize(1,1)
-- The scrollchild is where we put rotating textures that needs to be cropped.
local scrollchild = CreateFrame("Frame", nil, scaffold) --scaffold:CreateFrame("Frame")
--scrollchild:SetFrameLevel(scaffold:GetFrameLevel() + 1)
scrollchild:SetSize(1,1)
-- The scrollframe defines the height/filling of the orb.
local scrollframe = CreateFrame("ScrollFrame", nil, scaffold) -- scaffold:CreateFrame("ScrollFrame")
scrollframe:SetScrollChild(scrollchild)
--scrollframe:SetFrameLevel(scaffold:GetFrameLevel() + 1)
scrollframe:SetPoint("BOTTOM")
scrollframe:SetSize(1,1)
-- The overlay is meant to hold overlay textures like the spark, glow, etc
local overlay = CreateFrame("Frame", nil, scaffold) --scaffold:CreateFrame("Frame")
overlay:SetFrameLevel(scaffold:GetFrameLevel() + 2)
overlay:SetAllPoints(scaffold)
-- first rotating layer
local orbTex1 = scrollchild:CreateTexture()
orbTex1:SetDrawLayer("BACKGROUND", 0)
orbTex1:SetAllPoints()
local orbTex1AnimGroup = orbTex1:CreateAnimationGroup()
local orbTex1Anim = orbTex1AnimGroup:CreateAnimation("Rotation")
orbTex1Anim:SetDegrees(rotateClockwise and -360 or 360)
orbTex1Anim:SetDuration(30 * 1/(speedModifier or 1))
orbTex1AnimGroup:SetLooping("REPEAT")
orbTex1AnimGroup:Play()
-- second rotating layer, going the opposite way
local orbTex2 = scrollchild:CreateTexture()
orbTex2:SetDrawLayer("BACKGROUND", -1)
orbTex2:SetAllPoints()
local orbTex2AnimGroup = orbTex2:CreateAnimationGroup()
local orbTex2Anim = orbTex2AnimGroup:CreateAnimation("Rotation")
orbTex2Anim:SetDegrees(rotateClockwise and 360 or -360)
orbTex2Anim:SetDuration(20 * 1/(speedModifier or 1))
orbTex2AnimGroup:SetLooping("REPEAT")
orbTex2AnimGroup:Play()
-- static bottom textures
local orbTex3 = scrollchild:CreateTexture()
orbTex3:SetDrawLayer("BACKGROUND", -2)
orbTex3:SetAllPoints()
-- The spark will be cropped,
-- and only what's in the filled part of the orb will be visible.
local spark = scrollchild:CreateTexture()
spark:SetDrawLayer("BORDER", 1)
spark:SetPoint("TOPLEFT", scrollframe, "TOPLEFT", 0, 0)
spark:SetPoint("TOPRIGHT", scrollframe, "TOPRIGHT", 0, 0)
spark:SetSize(1,1)
spark:SetAlpha(.6)
spark:SetBlendMode("ADD")
spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]]) -- 32x32, centered vertical spark being 32x9px, from 0,11px to 32,19px
spark:SetTexCoord(1,11/32,0,11/32,1,19/32,0,19/32)-- ULx,ULy,LLx,LLy,URx,URy,LRx,LRy
spark:Hide()
-- The glow is in the overlay frame, and always visible
local glow = overlay:CreateTexture()
glow:SetDrawLayer("BORDER", 2)
glow:SetPoint("TOPLEFT", scrollframe, "TOPLEFT", 0, 0)
glow:SetPoint("TOPRIGHT", scrollframe, "TOPRIGHT", 0, 0)
glow:SetSize(1,1)
glow:SetAlpha(.25)
glow:SetBlendMode("ADD")
glow:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]]) -- 32x32, centered vertical glow being 32x26px, from 0,3px to 32,28px
glow:SetTexCoord(1,3/32,0,3/32,1,28/32,0,28/32) -- ULx,ULy,LLx,LLy,URx,URy,LRx,LRy
glow:Hide()
-- The orb is the virtual object that we return to the user.
-- This contains all the methods.
local orb = CreateFrame("Frame", nil, scaffold)
orb:SetAllPoints() -- lock down the points before we overwrite the methods
setmetatable(orb, Orb_MT)
local data = {}
data.orb = orb
-- framework
data.scaffold = scaffold
data.scrollchild = scrollchild
data.scrollframe = scrollframe
data.overlay = overlay
-- layers
data.layer1 = orbTex1
data.layer2 = orbTex2
data.layer3 = orbTex3
data.spark = spark
data.glow = glow
data.barMin = 0 -- min value
data.barMax = 1 -- max value
data.barValue = 0 -- real value
data.barDisplayValue = 0 -- displayed value while smoothing
data.barLeftCrop = 0 -- percentage of the orb cropped from the left
data.barRightCrop = 0 -- percentage of the orb cropped from the right
data.barSmoothingMode = "bezier-fast-in-slow-out"
data.sparkHeight = 8
data.sparkOffset = 1/32
data.sparkDirection = "IN"
data.sparkDurationIn = .75
data.sparkDurationOut = .55
data.sparkMinAlpha = .25
data.sparkMaxAlpha = .95
data.sparkMinPercent = 1/100
data.sparkMaxPercent = 99/100
Orbs[orb] = data
Orbs[scaffold] = data
Update(orb)
return orb
end
-- Embed it in LibFrame
LibFrame:AddMethod("CreateOrb", LibOrb.CreateOrb)
-- Module embedding
local embedMethods = {
CreateOrb = true
}
LibOrb.Embed = function(self, target)
for method in pairs(embedMethods) do
target[method] = self[method]
end
self.embeds[target] = true
return target
end
-- Upgrade existing embeds, if any
for target in pairs(LibOrb.embeds) do
LibOrb:Embed(target)
end
|
local K = unpack(select(2, ...))
local Module = K:GetModule("Skins")
local SwPlay = "Interface\\AddOns\\KkthnxUI\\Media\\Textures\\SwPlay"
local SwReset = "Interface\\AddOns\\KkthnxUI\\Media\\Textures\\SwReset"
local SwPause = "Interface\\AddOns\\KkthnxUI\\Media\\Textures\\SwPause"
local function SkinStopwatch()
StopwatchFrame:StripTextures()
StopwatchFrame:CreateBackdrop()
StopwatchFrame.Backdrop:SetPoint("TOPLEFT", 0, -17)
StopwatchFrame.Backdrop:SetPoint("BOTTOMRIGHT", 0, 2)
StopwatchTabFrame:StripTextures()
StopwatchCloseButton:SkinCloseButton()
StopwatchCloseButton:SetSize(32, 32)
StopwatchCloseButton:SetPoint("TOPRIGHT", 12, 12)
-- Play/Pause and Reset buttons
StopwatchPlayPauseButton:CreateBackdrop()
StopwatchPlayPauseButton:SetSize(12, 12)
StopwatchPlayPauseButton:SetNormalTexture(SwPlay)
StopwatchPlayPauseButton:SetHighlightTexture("")
StopwatchPlayPauseButton.Backdrop:SetOutside(StopwatchPlayPauseButton, 2, 2)
StopwatchPlayPauseButton:SetPoint("RIGHT", StopwatchResetButton, "LEFT", -6, 0)
StopwatchResetButton:SkinButton()
StopwatchResetButton:SetSize(16, 16)
StopwatchResetButton:SetNormalTexture(SwReset)
StopwatchResetButton:SetPoint("BOTTOMRIGHT", StopwatchFrame, "BOTTOMRIGHT", -4, 6)
StopwatchTitle:SetPoint("TOP", 0, 3)
StopwatchTitle:FontTemplate()
local function SetPlayTexture()
StopwatchPlayPauseButton:SetNormalTexture(SwPlay)
end
local function SetPauseTexture()
StopwatchPlayPauseButton:SetNormalTexture(SwPause)
end
hooksecurefunc("Stopwatch_Play", SetPauseTexture)
hooksecurefunc("Stopwatch_Pause", SetPlayTexture)
hooksecurefunc("Stopwatch_Clear", SetPlayTexture)
end
Module.NewSkin["Blizzard_TimeManager"] = SkinStopwatch
|
---------------------------------------------------------------------------
--- A notification action.
--
-- A notification can have multiple actions to chose from. This module allows
-- to manage such actions. An action object can be shared by multiple
-- notifications.
--
-- @author Emmanuel Lepage Vallee <elv1313@gmail.com>
-- @copyright 2019 Emmanuel Lepage Vallee
-- @coreclassmod naughty.action
---------------------------------------------------------------------------
local gtable = require("gears.table" )
local gobject = require("gears.object")
local action = {}
--- Create a new action.
-- @constructorfct naughty.action
-- @tparam table args The arguments.
-- @tparam string args.name The name.
-- @tparam string args.position The position.
-- @tparam string args.icon The icon.
-- @tparam naughty.notification args.notification The notification object.
-- @tparam boolean args.selected If this action is currently selected.
-- @return A new action.
-- The action name.
-- @property name
-- @tparam string name The name.
-- @propemits true false
-- If the action is selected.
--
-- Only a single action can be selected per notification. This is useful to
-- implement keyboard navigation.
--
-- @property selected
-- @param boolean
-- @propemits true false
--- The action position (index).
-- @property position
-- @param number
-- @propemits true false
--- The action icon.
-- @property icon
-- @tparam gears.surface|string icon
-- @propemits true false
--- If the action should hide the label and only display the icon.
--
--
--
--
--
--
-- local notif = naughty.notification {
-- title = "A notification",
-- message = "This notification has actions!",
-- actions = {
-- naughty.action {
-- name = "Accept",
-- icon = beautiful.awesome_icon,
-- icon_only = true,
-- },
-- naughty.action {
-- name = "Refuse",
-- icon = beautiful.awesome_icon,
-- icon_only = true,
-- },
-- naughty.action {
-- name = "Ignore",
-- icon = beautiful.awesome_icon,
-- icon_only = true,
-- },
-- }
-- }
--
-- wibox.widget {
-- notification = notif,
-- widget = naughty.list.actions,
-- }
--
-- @property icon_only
-- @param[opt=false] boolean
-- @propemits true false
--- When a notification is invoked.
--
-- Note that it is possible to call `:invoke()` without a notification object.
-- It is possible the `notification` parameter will be nil.
--
-- @signal invoked
-- @tparam naughty.action action The action.
-- @tparam naughty.notification|nil notification The notification, if known.
function action:get_selected()
return self._private.selected
end
function action:set_selected(value)
self._private.selected = value
self:emit_signal("property::selected", value)
self:emit_signal("_changed")
--TODO deselect other actions from the same notification
end
function action:get_position()
return self._private.position
end
function action:set_position(value)
self._private.position = value
self:emit_signal("property::position", value)
self:emit_signal("_changed")
--TODO make sure the position is unique
end
for _, prop in ipairs { "name", "icon", "icon_only" } do
action["get_"..prop] = function(self)
return self._private[prop]
end
action["set_"..prop] = function(self, value)
self._private[prop] = value
self:emit_signal("property::"..prop, value)
self:emit_signal("_changed")
end
end
--TODO v4.5, remove this.
function action.set_notification()
-- It didn't work because it prevented actions defined in the rules to be
-- in multiple notifications at once.
assert(
false,
"Setting a notification object was a bad idea and is now forbidden"
)
end
--- Execute this action.
--
-- This only emits the `invoked` signal.
--
-- @method invoke
-- @tparam[opt={}] naughty.notification notif A notification object on which
-- the action was invoked. If a notification is shared by many object (like
-- a "mute" or "snooze" action added to all notification), calling `:invoke()`
-- without adding the `notif` context will cause unexpected results.
function action:invoke(notif)
self:emit_signal("invoked", notif)
end
local function new(_, args)
args = args or {}
local ret = gobject { enable_properties = true }
gtable.crush(ret, action, true)
local default = {
-- See "table 1" of the spec about the default name
name = args.name or "default",
selected = args.selected == true,
position = args.position,
icon = args.icon,
notification = args.notification,
icon_only = args.icon_only or false,
}
rawset(ret, "_private", default)
gtable.crush(ret, args)
return ret
end
--
--- Disconnect from a signal.
-- @tparam string name The name of the signal.
-- @tparam function func The callback that should be disconnected.
-- @method disconnect_signal
-- @baseclass gears.object
--- Emit a signal.
--
-- @tparam string name The name of the signal.
-- @param ... Extra arguments for the callback functions. Each connected
-- function receives the object as first argument and then any extra
-- arguments that are given to emit_signal().
-- @method emit_signal
-- @baseclass gears.object
--- Connect to a signal.
-- @tparam string name The name of the signal.
-- @tparam function func The callback to call when the signal is emitted.
-- @method connect_signal
-- @baseclass gears.object
--- Connect to a signal weakly.
--
-- This allows the callback function to be garbage collected and
-- automatically disconnects the signal when that happens.
--
-- **Warning:**
-- Only use this function if you really, really, really know what you
-- are doing.
-- @tparam string name The name of the signal.
-- @tparam function func The callback to call when the signal is emitted.
-- @method weak_connect_signal
-- @baseclass gears.object
return setmetatable(action, {__call = new})
|
local lsp = require('sh.lsp')
local lspconfig = require('lspconfig')
if not lsp.is_client_active('terraformls') then
lspconfig.terraformls.setup {on_attach = lsp.common_on_attach, capabilities = lsp.capabilities, filetypes = {'tf', 'terraform', 'hcl'}}
vim.cmd [[LspStart]]
end
|
require "EasyConfig/EasyConfig"
NS = NS or {}
NS.config = {
rainsprinters = false,
}
NS.modId = "NightSprinters"
NS.name = "Night Sprinters settings"
NS.menu = {
rainsprinters = {
type = "Tickbox",
title = "Enables Rain Sprinters",
tooltip = "",
}
}
EasyConfig.addMod(NS.modId, NS.name, NS.config, NS.menu, "NIGHTSPRINTERS")
local function OnGameStart()
SandboxVars.StartTime = 2
end
Events.OnGameStart.Add(OnGameStart);
|
#!/usr/bin/luajit
------------------------------------------------------------------------------
-- This converts a docker file to a shell file
--Almost guaranteed to not work with many Docker files, but hey, it works for us
------------------------------------------------------------------------------
local DM_PACKAGES_URL = "http://localhost:8000"
local HOME_DIRECTORY ='/home/dlannan/dev/defold-extender/extender'
local CONVERT_HOME_DIRECTORY = 1
local MS_VISUAL_STUDIO_VER = "14.28.29910"
local WINDOWS_SDK_10_VERSION = "10.0.18362.0"
local INPUT="Dockerfile"
local OUTPUT="Dockerfile.sh"
------------------------------------------------------------------------------
local function runcmd( cmd )
local stdout = nil
local fh = io.popen( cmd, "r" )
if(fh) then
stdout = fh:read("*a")
fh:close()
end
return stdout
end
------------------------------------------------------------------------------
-- Make a copy - dont break original Docker.
local res = runcmd("cp -f "..INPUT.." "..OUTPUT)
print(res)
-- Get the copy as a string to play with.
local dockerdata = ""
for line in io.lines(OUTPUT) do dockerdata = dockerdata..line.."\n" end
------------------------------------------------------------------------------
dockerdata = [[
DM_PACKAGES_URL="]]..DM_PACKAGES_URL..[["
]]..dockerdata
-- Add extender user if doesnt exist
dockerdata = string.gsub(dockerdata, "# Add extender user", [[
# Add extender user
id -u extender &>/dev/null || useradd extender
]] )
-- Fix LANG setup
dockerdata = string.gsub(dockerdata, "ENV LANG=en_US%.UTF%-8 \\", "export LANG=en_US.UTF-8")
dockerdata = string.gsub(dockerdata, " LANGUAGE=en_US:en \\", "export LANGUAGE=en_US:en")
dockerdata = string.gsub(dockerdata, " LC_ALL=en_US%.UTF%-8", "export LC_ALL=en_US.UTF-8")
------------------------------------------------------------------------------
-- Convert FROM, MAINTAINER, VOLUME to comments
dockerdata = string.gsub(dockerdata, "FROM ", "# FROM ")
--sed -i "s/^FROM\s/# FROM /g" $OUTPUT
dockerdata = string.gsub(dockerdata, "MAINTAINER ", "# MAINTAINER ")
--sed -i "s/^MAINTAINER\s/# MAINTAINER /g" $OUTPUT
dockerdata = string.gsub(dockerdata, "VOLUME ", "# VOLUME ")
--sed -i "s/^VOLUME\s/# VOLUME /g" $OUTPUT
-- Get rid of RUNs
dockerdata = string.gsub(dockerdata, "RUN[^\n]+", "")
--sed -i "s/^RUN.*//g" $OUTPUT
-- Get rid of ARGs
dockerdata = string.gsub(dockerdata, "ARG[^\n]+", "")
--sed -i "s/^ARG.*//g" $OUTPUT
-- Convert COPY into cp
dockerdata = string.gsub(dockerdata, "COPY ", "cp ")
-- sed -i "s/^COPY/cp/g" $OUTPUT
-- Convert mkdirs into auto sub folder creating with -p
dockerdata = string.gsub(dockerdata, "mkdir ", "mkdir -p ")
-- Fix already correct mkdirs
dockerdata = string.gsub(dockerdata, "mkdir %-p %-p", "mkdir -p")
--sed -i "s/^mkdir/mkdir -p/g" $OUTPUT
-- Convert home directory into squiggles (tildes)
-- dockerdata = string.gsub(dockerdata, "mkdir ", "mkdir -p ")
-- sed -i "s/^$HOME_DIRECTORY/~/g" $OUTPUT
-- Convert ENVs into EXPORTs
dockerdata = string.gsub(dockerdata, "ENV%s([^%s]+)[ =]+([%w%p]+)", "export %1=%2")
--sed -r 's/^ENV\s([_,A-Z,0-9]*)\s*([a-z]*)/export \1=\2/g' -i $OUTPUT
-- Convert VARIABLES into bash varaibles
dockerdata = string.gsub(dockerdata, "%{([_%w]+)%}", "%1")
-- sed -r 's/[{}]//g' -i $OUTPUT
-- Get rid of EXPOSE todo: open up ports based on these?
dockerdata = string.gsub(dockerdata, "EXPOSE ", "# EXPOSE")
-- sed -i "s/^EXPOSE\s/# EXPOSE /g" $OUTPUT
-- Convert ADDs into cp
dockerdata = string.gsub(dockerdata, "ADD ", "cp ")
--sed -i "s/^ADD\s/cp /g" $OUTPUT
-- # Timestamp
dockerdata = dockerdata.."# Generated by docker_to_sh ["..os.date().."]\n"
-- sed -i '1s/^/# Generated by docker_to_sh, for all your shoddy bash script from Dockerfile generation needs. \n/' $OUTPUT
------------------------------------------------------------------------------
-- Make some sections that can be enabled/disabled if needed
--
-- Set the following variables to "enabled" or "disabled" to control platform sections
PF_DARWIN = "disabled"
PF_EMSCRIPTEN_1_38_12 = "disabled"
PF_EMSCRIPTEN_1_39_16 = "disabled"
PF_EMSCRIPTEN_2_0_11 = "enabled"
PF_WINDOWS = "enabled"
PF_WINDOWS_8_1_SDK = "disabled"
PF_ANDROID = "enabled"
PF_SWITCH = "disabled"
PF_WINE = "disabled"
-- Platform Darwin - Includes OSX, and IOS
dockerdata = string.gsub(dockerdata, "# Darwin", [[# Darwin
PF_DARWIN="]]..PF_DARWIN..[["
if [ $PF_DARWIN = "enabled" ]; then
]] )
-- End darwin tag
dockerdata = string.gsub(dockerdata, "(#\n# EMSCRIPTEN)",[[
fi
# END PF_DARWIN
%1]] )
-- Platform Emscripten - be able to select version inclusions
dockerdata = string.gsub(dockerdata, "## Emscripten 1.38.12", [[## Emscripten 1.38.12
PF_EMSCRIPTEN_1_38_12="]]..PF_EMSCRIPTEN_1_38_12..[["
if [ $PF_EMSCRIPTEN_1_38_12 = "enabled" ]; then
]] )
dockerdata = string.gsub(dockerdata, "## Emscripten 1.39.16 %(from version 1.2.170%)", [[fi
# END PF_EMSCRIPTEN_1_38_12
## Emscripten 1.39.16 (from version 1.2.170)
PF_EMSCRIPTEN_1_39_16="]]..PF_EMSCRIPTEN_1_39_16..[["
if [ $PF_EMSCRIPTEN_1_39_16 = "enabled" ]; then
]] )
dockerdata = string.gsub(dockerdata, "## Emscripten 2.0.11 %(from version 1.2.178%)", [[fi
# END PF_EMSCRIPTEN_1_39_16
## Emscripten 2.0.11 (from version 1.2.178)
PF_EMSCRIPTEN_2_0_11="]]..PF_EMSCRIPTEN_2_0_11..[["
if [ $PF_EMSCRIPTEN_2_0_11 = "enabled" ]; then
update-alternatives --set python3 /usr/bin/python3.9
]] )
dockerdata = string.gsub(dockerdata, "# We use the same temp directory for both versions.",[[fi
# END PF_EMSCRIPTEN_2_0_11
# We use the same temp directory for both versions.]] )
dockerdata = string.gsub(dockerdata, "# We replace it with a folder of our own(.+)update%-alternatives", [[
# We replace it with a folder of our own
# REMOVED TEMP FOLDER NAME REPLACEMENT - TBD
update-alternatives]] )
-- Platform Windows
dockerdata = string.gsub(dockerdata, "PLATFORMSDK_WIN32=$PLATFORMSDK_DIR/Win32([^\n]+)",
[[PLATFORMSDK_WIN32=$PLATFORMSDK_DIR/Win32]] )
dockerdata = string.gsub(dockerdata, "WINDOWS_SDK_10_VERSION=([^\n]+)",
[[WINDOWS_SDK_10_VERSION="]]..WINDOWS_SDK_10_VERSION..[["]] )
dockerdata = string.gsub(dockerdata, "WINDOWS_MSVC_2019_VERSION=([^\n]+)",
[[WINDOWS_MSVC_2019_VERSION="]]..MS_VISUAL_STUDIO_VER..[["]] )
dockerdata = string.gsub(dockerdata, "ENV \\", "")
dockerdata = string.gsub(dockerdata, "(#\n# Windows\n#)", [[
%1
PF_WINDOWS="]]..PF_WINDOWS..[["
if [ $PF_WINDOWS = "enabled" ]; then ]] )
dockerdata = string.gsub(dockerdata, "(echo \"WIN32 8.1 %+ 10 SDK\" && \\)",[[
PF_WINDOWS_8_1_SDK="]]..PF_WINDOWS_8_1_SDK..[["
if [ $PF_WINDOWS_8_1_SDK = "enabled" ]; then
%1]] )
dockerdata = string.gsub(dockerdata, "ln %-s /usr/local/bin/clang /usr/local/bin/x86_64%-pc%-win32%-clang",[[
fi
# END PF_WINDOWS_8_1_SDK
ln -s /usr/local/bin/clang /usr/local/bin/x86_64-pc-win32-clang]])
-- Platform Android
dockerdata = string.gsub(dockerdata, "(#\n# Android SDK/NDK\n)", [[fi
# END PF_WINDOWS
PF_ANDROID="]]..PF_ANDROID..[["
if [ $PF_ANDROID = "enabled" ]; then
%1]] )
-- Switch SDK
dockerdata = string.gsub(dockerdata, "(#\n# Switch SDK\n)", [[fi
# END PF_ANDROID
PF_SWITCH="]]..PF_SWITCH..[["
if [ $PF_SWITCH = "enabled" ]; then
%1]] )
-- Wine
dockerdata = string.gsub(dockerdata, "(#\n# Wine\n)", [[fi
# END PF_SWITCH
PF_WINE="]]..PF_WINE..[["
if [ $PF_WINE = "enabled" ]; then
%1]] )
dockerdata = string.gsub(dockerdata, "chown %-R extender: $WINEPREFIX", [[%1
fi
# END PF_WINE]] )
------------------------------------------------------------------------------
local fh = io.open(OUTPUT, "w")
if(fh) then fh:write(dockerdata); fh:close() end
------------------------------------------------------------------------------
|
object_mobile_disappearances_psycho_boss = object_mobile_shared_disappearances_psycho_boss:new {
}
ObjectTemplates:addTemplate(object_mobile_disappearances_psycho_boss, "object/mobile/disappearances_psycho_boss.iff")
|
mymillwork.register_all(
"default_stone",
"Stone",
"default_stone.png",
{cracky = 3,not_in_creative_inventory=1},
"default:stone"
)
mymillwork.register_all(
"default_stone_brick",
"Stone Brick",
"default_stone_brick.png",
{cracky = 3,not_in_creative_inventory=1},
"default:stonebrick"
)
mymillwork.register_all(
"default_cobble",
"Cobble",
"default_cobble.png",
{cracky = 3,not_in_creative_inventory=1},
"default:cobble"
)
mymillwork.register_all(
"default_desert_stone",
"Desert Stone",
"default_desert_stone.png",
{cracky = 3,not_in_creative_inventory=1},
"default:desert_stone"
)
mymillwork.register_all(
"default_sandstone",
"Sandstone",
"default_sandstone.png",
{crumbly=2, cracky = 3, not_in_creative_inventory=1},
"default:sandstone"
)
mymillwork.register_all(
"default_clay",
"Clay",
"default_clay.png",
{crumbly=3,not_in_creative_inventory=1},
"default:clay"
)
mymillwork.register_all(
"default_wood",
"Wood",
"default_wood.png",
{choppy = 3,not_in_creative_inventory=1},
"default:wood"
)
mymillwork.register_all(
"default_junglewood",
"Jungle Wood",
"default_junglewood.png",
{choppy=2,oddly_breakable_by_hand=2,flammable=2,not_in_creative_inventory=1},
"default:junglewood"
)
mymillwork.register_all(
"default_pine_wood",
"Pine Wood",
"default_pine_wood.png",
{choppy = 3,not_in_creative_inventory=1},
"default:pine_wood"
)
mymillwork.register_all(
"default_acacia_wood",
"Acacia Wood",
"default_acacia_wood.png",
{choppy = 3,not_in_creative_inventory=1},
"default:pine_acacia"
)
mymillwork.register_all(
"default_aspen_wood",
"Aspen Wood",
"default_aspen_wood.png",
{choppy = 3,not_in_creative_inventory=1},
"default:aspen_wood"
)
mymillwork.register_all(
"default_coal_block",
"Coal Block",
"default_coal_block.png",
{cracky = 3,not_in_creative_inventory=1},
"default:coalblock"
)
mymillwork.register_all(
"default_obsidian",
"Obsidian",
"default_obsidian.png",
{cracky = 1,not_in_creative_inventory=1},
"default:obsidian"
)
|
-- p6 - last parameter does not mean vehicle handle is returned maybe a quick view in disassembly will tell us what is actually does p6 seems to check for something with the script in the disassembly
-- @module native
-- @submodule vehicle
-- @see CREATE_VEHICLE
-- @usage Vehicle CREATE_VEHICLE(Hash modelHash, float x, float y, float z, float heading, BOOL isNetwork, BOOL p6);
-- @param modelHash Hash
-- @param x float
-- @param y float
-- @param z float
-- @param heading float
-- @param isNetwork BOOL
-- @param p6 BOOL
-- @return Vehicle
function CreateVehicle(modelHash, x, y, z, heading, isNetwork, p6) end
-- Deletes a vehicle. The vehicle must be a mission entity to delete, so call this before deleting: SET_ENTITY_AS_MISSION_ENTITY(vehicle, true, true); eg how to use: SET_ENTITY_AS_MISSION_ENTITY(vehicle, true, true); DELETE_VEHICLE(&vehicle); Deletes the specified vehicle, then sets the handle pointed to by the pointer to NULL.
-- @module native
-- @submodule vehicle
-- @see DELETE_VEHICLE
-- @usage void DELETE_VEHICLE(Vehicle* vehicle);
-- @param vehicle Vehicle*
-- @return void
function DeleteVehicle(vehicle) end
-- Makes the vehicle accept no passengers.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_ALLOW_NO_PASSENGERS_LOCKON
-- @usage void SET_VEHICLE_ALLOW_NO_PASSENGERS_LOCKON(Vehicle veh, BOOL toggle);
-- @param veh Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleAllowNoPassengersLockon(veh, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_MODEL
-- @usage BOOL IS_VEHICLE_MODEL(Vehicle vehicle, Hash model);
-- @param vehicle Vehicle
-- @param model Hash
-- @return BOOL
function IsVehicleModel(vehicle, model) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DOES_SCRIPT_VEHICLE_GENERATOR_EXIST
-- @usage BOOL DOES_SCRIPT_VEHICLE_GENERATOR_EXIST(int vehicleGenerator);
-- @param vehicleGenerator int
-- @return BOOL
function DoesScriptVehicleGeneratorExist(vehicleGenerator) end
-- Creates a script vehicle generator at the given coordinates. Most parameters after the model hash are unknown. Parameters: x/y/z - Generator position heading - Generator heading p4 - Unknown (always 5.0) p5 - Unknown (always 3.0) modelHash - Vehicle model hash p7/8/9/10 - Unknown (always -1) p11 - Unknown (usually TRUE, only one instance of FALSE) p12/13 - Unknown (always FALSE) p14 - Unknown (usally FALSE, only two instances of TRUE) p15 - Unknown (always TRUE) p16 - Unknown (always -1) Vector3 coords = GET_ENTITY_COORDS(PLAYER_PED_ID(), 0); CREATE_SCRIPT_VEHICLE_GENERATOR(coords.x, coords.y, coords.z, 1.0f, 5.0f, 3.0f, GET_HASH_KEY("adder"), -1. -1, -1, -1, -1, true, false, false, false, true, -1);
-- @module native
-- @submodule vehicle
-- @see CREATE_SCRIPT_VEHICLE_GENERATOR
-- @usage int CREATE_SCRIPT_VEHICLE_GENERATOR(float x, float y, float z, float heading, float p4, float p5, Hash modelHash, int p7, int p8, int p9, int p10, BOOL p11, BOOL p12, BOOL p13, BOOL p14, BOOL p15, int p16);
-- @param x float
-- @param y float
-- @param z float
-- @param heading float
-- @param p4 float
-- @param p5 float
-- @param modelHash Hash
-- @param p7 int
-- @param p8 int
-- @param p9 int
-- @param p10 int
-- @param p11 BOOL
-- @param p12 BOOL
-- @param p13 BOOL
-- @param p14 BOOL
-- @param p15 BOOL
-- @param p16 int
-- @return int
function CreateScriptVehicleGenerator(x, y, z, heading, p4, p5, modelHash, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DELETE_SCRIPT_VEHICLE_GENERATOR
-- @usage void DELETE_SCRIPT_VEHICLE_GENERATOR(int vehicleGenerator);
-- @param vehicleGenerator int
-- @return void
function DeleteScriptVehicleGenerator(vehicleGenerator) end
-- Only called once in the decompiled scripts. Presumably activates the specified generator.
-- @module native
-- @submodule vehicle
-- @see SET_SCRIPT_VEHICLE_GENERATOR
-- @usage void SET_SCRIPT_VEHICLE_GENERATOR(Any vehicleGenerator, BOOL enabled);
-- @param vehicleGenerator Any
-- @param enabled BOOL
-- @return void
function SetScriptVehicleGenerator(vehicleGenerator, enabled) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_ALL_VEHICLE_GENERATORS_ACTIVE_IN_AREA
-- @usage void SET_ALL_VEHICLE_GENERATORS_ACTIVE_IN_AREA(float x1, float y1, float z1, float x2, float y2, float z2, BOOL p6, BOOL p7);
-- @param x1 float
-- @param y1 float
-- @param z1 float
-- @param x2 float
-- @param y2 float
-- @param z2 float
-- @param p6 BOOL
-- @param p7 BOOL
-- @return void
function SetAllVehicleGeneratorsActiveInArea(x1, y1, z1, x2, y2, z2, p6, p7) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_ALL_VEHICLE_GENERATORS_ACTIVE
-- @usage void SET_ALL_VEHICLE_GENERATORS_ACTIVE();
-- @return void
function SetAllVehicleGeneratorsActive() end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_ALL_LOW_PRIORITY_VEHICLE_GENERATORS_ACTIVE
-- @usage void SET_ALL_LOW_PRIORITY_VEHICLE_GENERATORS_ACTIVE(BOOL active);
-- @param active BOOL
-- @return void
function SetAllLowPriorityVehicleGeneratorsActive(active) end
-- Sets a vehicle on the ground on all wheels. Returns whether or not the operation was successful. sfink: This has an additional param(Vehicle vehicle, float p1) which is always set to 5.0f in the b944 scripts.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_ON_GROUND_PROPERLY
-- @usage BOOL SET_VEHICLE_ON_GROUND_PROPERLY(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function SetVehicleOnGroundProperly(vehicle) end
-- Most likely a hash collision
-- @module native
-- @submodule vehicle
-- @see SET_ALL_VEHICLES_SPAWN
-- @usage Any SET_ALL_VEHICLES_SPAWN(Vehicle p0, BOOL p1, BOOL p2, BOOL p3);
-- @param p0 Vehicle
-- @param p1 BOOL
-- @param p2 BOOL
-- @param p3 BOOL
-- @return Any
function SetAllVehiclesSpawn(p0, p1, p2, p3) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_STUCK_ON_ROOF
-- @usage BOOL IS_VEHICLE_STUCK_ON_ROOF(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleStuckOnRoof(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see ADD_VEHICLE_UPSIDEDOWN_CHECK
-- @usage void ADD_VEHICLE_UPSIDEDOWN_CHECK(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function AddVehicleUpsidedownCheck(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see REMOVE_VEHICLE_UPSIDEDOWN_CHECK
-- @usage void REMOVE_VEHICLE_UPSIDEDOWN_CHECK(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function RemoveVehicleUpsidedownCheck(vehicle) end
-- Returns true if the vehicle's current speed is less than, or equal to 0.0025f. For some vehicles it returns true if the current speed is <= 0.00039999999.
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_STOPPED
-- @usage BOOL IS_VEHICLE_STOPPED(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleStopped(vehicle) end
-- Gets the number of passengers, NOT including the driver. Use IS_VEHICLE_SEAT_FREE(Vehicle, -1) to also check for the driver
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_NUMBER_OF_PASSENGERS
-- @usage int GET_VEHICLE_NUMBER_OF_PASSENGERS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleNumberOfPassengers(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS
-- @usage int GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleMaxNumberOfPassengers(vehicle) end
-- Returns max number of passengers (including the driver) for the specified vehicle model. For a full list, see here: pastebin.com/MdETCS1j
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MODEL_NUMBER_OF_SEATS
-- @usage int GET_VEHICLE_MODEL_NUMBER_OF_SEATS(Hash modelHash);
-- @param modelHash Hash
-- @return int
function GetVehicleModelNumberOfSeats(modelHash) end
-- • Usage → Use this native inside a looped function. → Values: → 0.0 = no vehicles on streets → 1.0 = normal vehicles on streets
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME
-- @usage void SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME(float multiplier);
-- @param multiplier float
-- @return void
function SetVehicleDensityMultiplierThisFrame(multiplier) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_RANDOM_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME
-- @usage void SET_RANDOM_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME(float multiplier);
-- @param multiplier float
-- @return void
function SetRandomVehicleDensityMultiplierThisFrame(multiplier) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME
-- @usage void SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME(float multiplier);
-- @param multiplier float
-- @return void
function SetParkedVehicleDensityMultiplierThisFrame(multiplier) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_FAR_DRAW_VEHICLES
-- @usage void SET_FAR_DRAW_VEHICLES(BOOL toggle);
-- @param toggle BOOL
-- @return void
function SetFarDrawVehicles(toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_NUMBER_OF_PARKED_VEHICLES
-- @usage Any SET_NUMBER_OF_PARKED_VEHICLES(int value);
-- @param value int
-- @return Any
function SetNumberOfParkedVehicles(value) end
-- 0 1 2 - CARLOCK_LOCKED (locked) 3 4 - CARLOCK_LOCKED_PLAYER_INSIDE (can get in, can't leave) (maybe, these are leftovers from GTA:VC) 5 6 7 (source: GTA VC miss2 leak, matching constants for 0/2/4, testing) They use 10 in am_mp_property_int, don't know what it does atm.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DOORS_LOCKED
-- @usage void SET_VEHICLE_DOORS_LOCKED(Vehicle vehicle, int doorLockStatus);
-- @param vehicle Vehicle
-- @param doorLockStatus int
-- @return void
function SetVehicleDoorsLocked(vehicle, doorLockStatus) end
-- destroyType is 1 for opens on damage, 2 for breaks on damage.
-- @module native
-- @submodule vehicle
-- @see SET_PED_TARGETTABLE_VEHICLE_DESTROY
-- @usage void SET_PED_TARGETTABLE_VEHICLE_DESTROY(Vehicle vehicle, int vehicleComponent, int destroyType);
-- @param vehicle Vehicle
-- @param vehicleComponent int
-- @param destroyType int
-- @return void
function SetPedTargettableVehicleDestroy(vehicle, vehicleComponent, destroyType) end
-- if set to true, prevents vehicle sirens from having sound, leaving only the lights. HASH COLLISION !!! Please change to _SET_VEHICLE_SIREN_SOUND
-- @module native
-- @submodule vehicle
-- @see DISABLE_VEHICLE_IMPACT_EXPLOSION_ACTIVATION
-- @usage void DISABLE_VEHICLE_IMPACT_EXPLOSION_ACTIVATION(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function DisableVehicleImpactExplosionActivation(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DOORS_LOCKED_FOR_PLAYER
-- @usage void SET_VEHICLE_DOORS_LOCKED_FOR_PLAYER(Vehicle vehicle, Player player, BOOL toggle);
-- @param vehicle Vehicle
-- @param player Player
-- @param toggle BOOL
-- @return void
function SetVehicleDoorsLockedForPlayer(vehicle, player, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_DOORS_LOCKED_FOR_PLAYER
-- @usage BOOL GET_VEHICLE_DOORS_LOCKED_FOR_PLAYER(Vehicle vehicle, Player player);
-- @param vehicle Vehicle
-- @param player Player
-- @return BOOL
function GetVehicleDoorsLockedForPlayer(vehicle, player) end
-- After some analysis, I've decided that these are what the parameters are. We can see this being used in R* scripts such as "am_mp_property_int.ysc.c4": l_11A1 = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), 1); ... VEHICLE::SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(l_11A1, 1);
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS
-- @usage void SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleDoorsLockedForAllPlayers(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DOORS_LOCKED_FOR_TEAM
-- @usage void SET_VEHICLE_DOORS_LOCKED_FOR_TEAM(Vehicle vehicle, int team, BOOL toggle);
-- @param vehicle Vehicle
-- @param team int
-- @param toggle BOOL
-- @return void
function SetVehicleDoorsLockedForTeam(vehicle, team, toggle) end
-- Explodes a selected vehicle. Vehicle vehicle = Vehicle you want to explode. BOOL isAudible = If explosion makes a sound. BOOL isInvisible = If the explosion is invisible or not. First BOOL does not give any visual explosion, the vehicle just falls apart completely but slowly and starts to burn.
-- @module native
-- @submodule vehicle
-- @see EXPLODE_VEHICLE
-- @usage void EXPLODE_VEHICLE(Vehicle vehicle, BOOL isAudible, BOOL isInvisible);
-- @param vehicle Vehicle
-- @param isAudible BOOL
-- @param isInvisible BOOL
-- @return void
function ExplodeVehicle(vehicle, isAudible, isInvisible) end
-- Tested on the player's current vehicle. Unless you kill the driver, the vehicle doesn't loose control, however, if enabled, explodeOnImpact is still active. The moment you crash, boom.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_OUT_OF_CONTROL
-- @usage void SET_VEHICLE_OUT_OF_CONTROL(Vehicle vehicle, BOOL killDriver, BOOL explodeOnImpact);
-- @param vehicle Vehicle
-- @param killDriver BOOL
-- @param explodeOnImpact BOOL
-- @return void
function SetVehicleOutOfControl(vehicle, killDriver, explodeOnImpact) end
-- VEHICLE::SET_VEHICLE_TIMED_EXPLOSION(v_3, PLAYER::GET_PLAYER_PED(v_5), 1);
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_TIMED_EXPLOSION
-- @usage void SET_VEHICLE_TIMED_EXPLOSION(Vehicle vehicle, Ped ped, BOOL toggle);
-- @param vehicle Vehicle
-- @param ped Ped
-- @param toggle BOOL
-- @return void
function SetVehicleTimedExplosion(vehicle, ped, toggle) end
-- This is not tested - it's just an assumption. Doesn't seem to work. I'll try with an int instead. --JT Read the scripts, im dumpass. if (!VEHICLE::IS_TAXI_LIGHT_ON(l_115)) { VEHICLE::SET_TAXI_LIGHTS(l_115, 1); }
-- @module native
-- @submodule vehicle
-- @see SET_TAXI_LIGHTS
-- @usage void SET_TAXI_LIGHTS(Vehicle vehicle, BOOL state);
-- @param vehicle Vehicle
-- @param state BOOL
-- @return void
function SetTaxiLights(vehicle, state) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_TAXI_LIGHT_ON
-- @usage BOOL IS_TAXI_LIGHT_ON(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsTaxiLightOn(vehicle) end
-- garageName example "Michael - Beverly Hills" For a full list, see here: pastebin.com/73VfwsmS
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_IN_GARAGE_AREA
-- @usage BOOL IS_VEHICLE_IN_GARAGE_AREA(char* garageName, Vehicle vehicle);
-- @param garageName char*
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleInGarageArea(garageName, vehicle) end
-- colorPrimary & colorSecondary are the paint index for the vehicle. For a list of valid paint indexes, view: pastebin.com/pwHci0xK ------------------------------------------------------------------------- Use this to get the number of color indices: pastebin.com/RQEeqTSM Note: minimum color index is 0, maximum color index is (numColorIndices - 1)
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_COLOURS
-- @usage void SET_VEHICLE_COLOURS(Vehicle vehicle, int colorPrimary, int colorSecondary);
-- @param vehicle Vehicle
-- @param colorPrimary int
-- @param colorSecondary int
-- @return void
function SetVehicleColours(vehicle, colorPrimary, colorSecondary) end
-- It switch to highbeam when p1 is set to true.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_FULLBEAM
-- @usage void SET_VEHICLE_FULLBEAM(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleFullbeam(vehicle, toggle) end
-- This seems like a hash collision? p1 (toggle) was always 1 (true) except in one case in the b678 scripts.
-- @module native
-- @submodule vehicle
-- @see STEER_UNLOCK_BIAS
-- @usage void STEER_UNLOCK_BIAS(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SteerUnlockBias(vehicle, toggle) end
-- p1, p2, p3 are RGB values for color (255,0,0 for Red, ect)
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_CUSTOM_PRIMARY_COLOUR
-- @usage void SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(Vehicle vehicle, int r, int g, int b);
-- @param vehicle Vehicle
-- @param r int
-- @param g int
-- @param b int
-- @return void
function SetVehicleCustomPrimaryColour(vehicle, r, g, b) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_CUSTOM_PRIMARY_COLOUR
-- @usage void GET_VEHICLE_CUSTOM_PRIMARY_COLOUR(Vehicle vehicle, int* r, int* g, int* b);
-- @param vehicle Vehicle
-- @param r int*
-- @param g int*
-- @param b int*
-- @return void
function GetVehicleCustomPrimaryColour(vehicle, r, g, b) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR
-- @usage Any CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return Any
function ClearVehicleCustomPrimaryColour(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_IS_VEHICLE_PRIMARY_COLOUR_CUSTOM
-- @usage BOOL GET_IS_VEHICLE_PRIMARY_COLOUR_CUSTOM(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function GetIsVehiclePrimaryColourCustom(vehicle) end
-- p1, p2, p3 are RGB values for color (255,0,0 for Red, ect)
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_CUSTOM_SECONDARY_COLOUR
-- @usage void SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(Vehicle vehicle, int r, int g, int b);
-- @param vehicle Vehicle
-- @param r int
-- @param g int
-- @param b int
-- @return void
function SetVehicleCustomSecondaryColour(vehicle, r, g, b) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_CUSTOM_SECONDARY_COLOUR
-- @usage void GET_VEHICLE_CUSTOM_SECONDARY_COLOUR(Vehicle vehicle, int* r, int* g, int* b);
-- @param vehicle Vehicle
-- @param r int*
-- @param g int*
-- @param b int*
-- @return void
function GetVehicleCustomSecondaryColour(vehicle, r, g, b) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR
-- @usage Any CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return Any
function ClearVehicleCustomSecondaryColour(vehicle) end
-- Check if Vehicle Secondary is avaliable for customize
-- @module native
-- @submodule vehicle
-- @see GET_IS_VEHICLE_SECONDARY_COLOUR_CUSTOM
-- @usage BOOL GET_IS_VEHICLE_SECONDARY_COLOUR_CUSTOM(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function GetIsVehicleSecondaryColourCustom(vehicle) end
-- formerly known as _SET_VEHICLE_PAINT_FADE The parameter fade is a value from 0-1, where 0 is fresh paint. ------------------------------------------------------------------------------------ The actual value isn't stored as a float but as an unsigned char (BYTE). More info here: pastebin.com/r0h6EM5s
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_ENVEFF_SCALE
-- @usage void SET_VEHICLE_ENVEFF_SCALE(Vehicle vehicle, float fade);
-- @param vehicle Vehicle
-- @param fade float
-- @return void
function SetVehicleEnveffScale(vehicle, fade) end
-- formerly known as _GET_VEHICLE_PAINT_FADE The result is a value from 0-1, where 0 is fresh paint. ----------------------------------------------------------------------- The actual value isn't stored as a float but as an unsigned char (BYTE).
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_ENVEFF_SCALE
-- @usage float GET_VEHICLE_ENVEFF_SCALE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return float
function GetVehicleEnveffScale(vehicle) end
-- Hardcoded to not work in multiplayer.
-- @module native
-- @submodule vehicle
-- @see SET_CAN_RESPRAY_VEHICLE
-- @usage void SET_CAN_RESPRAY_VEHICLE(Vehicle vehicle, BOOL state);
-- @param vehicle Vehicle
-- @param state BOOL
-- @return void
function SetCanResprayVehicle(vehicle, state) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_BOAT_ANCHOR
-- @usage void SET_BOAT_ANCHOR(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetBoatAnchor(vehicle, toggle) end
-- Activate siren on vehicle (Only works if the vehicle has a siren).
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_SIREN
-- @usage void SET_VEHICLE_SIREN(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleSiren(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_SIREN_ON
-- @usage BOOL IS_VEHICLE_SIREN_ON(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleSirenOn(vehicle) end
-- If set to true, vehicle will not take crash damage, but is still susceptible to damage from bullets and explosives
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_STRONG
-- @usage void SET_VEHICLE_STRONG(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleStrong(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see REMOVE_VEHICLE_STUCK_CHECK
-- @usage void REMOVE_VEHICLE_STUCK_CHECK(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function RemoveVehicleStuckCheck(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_COLOURS
-- @usage void GET_VEHICLE_COLOURS(Vehicle vehicle, int* colorPrimary, int* colorSecondary);
-- @param vehicle Vehicle
-- @param colorPrimary int*
-- @param colorSecondary int*
-- @return void
function GetVehicleColours(vehicle, colorPrimary, colorSecondary) end
-- Has an additional BOOL parameter since version [???]. Check if a vehicle seat is free. -1 being the driver seat. Use GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS(vehicle) - 1 for last seat index.
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_SEAT_FREE
-- @usage BOOL IS_VEHICLE_SEAT_FREE(Vehicle vehicle, int seatIndex);
-- @param vehicle Vehicle
-- @param seatIndex int
-- @return BOOL
function IsVehicleSeatFree(vehicle, seatIndex) end
-- -1 (driver) <= index < GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS(vehicle)
-- @module native
-- @submodule vehicle
-- @see GET_PED_IN_VEHICLE_SEAT
-- @usage Ped GET_PED_IN_VEHICLE_SEAT(Vehicle vehicle, int index);
-- @param vehicle Vehicle
-- @param index int
-- @return Ped
function GetPedInVehicleSeat(vehicle, index) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_LAST_PED_IN_VEHICLE_SEAT
-- @usage Ped GET_LAST_PED_IN_VEHICLE_SEAT(Vehicle vehicle, int seatIndex);
-- @param vehicle Vehicle
-- @param seatIndex int
-- @return Ped
function GetLastPedInVehicleSeat(vehicle, seatIndex) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_LIGHTS_STATE
-- @usage BOOL GET_VEHICLE_LIGHTS_STATE(Vehicle vehicle, BOOL* lightsOn, BOOL* highbeamsOn);
-- @param vehicle Vehicle
-- @param lightsOn BOOL*
-- @param highbeamsOn BOOL*
-- @return BOOL
function GetVehicleLightsState(vehicle, lightsOn, highbeamsOn) end
-- wheelID used for 4 wheelers seem to be (0, 1, 4, 5) completely - is to check if tire completely gone from rim. '0 = wheel_lf / bike, plane or jet front '1 = wheel_rf '2 = wheel_lm / in 6 wheels trailer, plane or jet is first one on left '3 = wheel_rm / in 6 wheels trailer, plane or jet is first one on right '4 = wheel_lr / bike rear / in 6 wheels trailer, plane or jet is last one on left '5 = wheel_rr / in 6 wheels trailer, plane or jet is last one on right '45 = 6 wheels trailer mid wheel left '47 = 6 wheels trailer mid wheel right
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_TYRE_BURST
-- @usage BOOL IS_VEHICLE_TYRE_BURST(Vehicle vehicle, int wheelID, BOOL completely);
-- @param vehicle Vehicle
-- @param wheelID int
-- @param completely BOOL
-- @return BOOL
function IsVehicleTyreBurst(vehicle, wheelID, completely) end
-- SCALE: Setting the speed to 30 would result in a speed of roughly 60mph, according to speedometer. Speed is in meters per second You can convert meters/s to mph here: http://www.calculateme.com/Speed/MetersperSecond/ToMilesperHour.htm
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_FORWARD_SPEED
-- @usage void SET_VEHICLE_FORWARD_SPEED(Vehicle vehicle, float speed);
-- @param vehicle Vehicle
-- @param speed float
-- @return void
function SetVehicleForwardSpeed(vehicle, speed) end
-- This is a hash collision... _IS_VEHICLE_NEAR_ENTITY
-- @module native
-- @submodule vehicle
-- @see SET_PED_ENABLED_BIKE_RINGTONE
-- @usage BOOL SET_PED_ENABLED_BIKE_RINGTONE(Vehicle vehicle, Entity entity);
-- @param vehicle Vehicle
-- @param entity Entity
-- @return BOOL
function SetPedEnabledBikeRingtone(vehicle, entity) end
-- "To burst tyres VEHICLE::SET_VEHICLE_TYRE_BURST(vehicle, 0, true, 1000.0) to burst all tyres type it 8 times where p1 = 0 to 7. p3 seems to be how much damage it has taken. 0 doesn't deflate them, 1000 completely deflates them. '0 = wheel_lf / bike, plane or jet front '1 = wheel_rf '2 = wheel_lm / in 6 wheels trailer, plane or jet is first one on left '3 = wheel_rm / in 6 wheels trailer, plane or jet is first one on right '4 = wheel_lr / bike rear / in 6 wheels trailer, plane or jet is last one on left '5 = wheel_rr / in 6 wheels trailer, plane or jet is last one on right '45 = 6 wheels trailer mid wheel left '47 = 6 wheels trailer mid wheel right
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_TYRE_BURST
-- @usage void SET_VEHICLE_TYRE_BURST(Vehicle vehicle, int index, BOOL onRim, float p3);
-- @param vehicle Vehicle
-- @param index int
-- @param onRim BOOL
-- @param p3 float
-- @return void
function SetVehicleTyreBurst(vehicle, index, onRim, p3) end
-- Closes all doors of a vehicle:
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DOORS_SHUT
-- @usage void SET_VEHICLE_DOORS_SHUT(Vehicle vehicle, BOOL closeInstantly);
-- @param vehicle Vehicle
-- @param closeInstantly BOOL
-- @return void
function SetVehicleDoorsShut(vehicle, closeInstantly) end
-- Allows you to toggle bulletproof tires.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_TYRES_CAN_BURST
-- @usage void SET_VEHICLE_TYRES_CAN_BURST(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleTyresCanBurst(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_TYRES_CAN_BURST
-- @usage BOOL GET_VEHICLE_TYRES_CAN_BURST(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function GetVehicleTyresCanBurst(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_WHEELS_CAN_BREAK
-- @usage Any SET_VEHICLE_WHEELS_CAN_BREAK(Vehicle vehicle, BOOL enabled);
-- @param vehicle Vehicle
-- @param enabled BOOL
-- @return Any
function SetVehicleWheelsCanBreak(vehicle, enabled) end
-- doorIndex: 0 = Front Left Door 1 = Front Right Door 2 = Back Left Door 3 = Back Right Door 4 = Hood 5 = Trunk 6 = Back 7 = Back2
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DOOR_OPEN
-- @usage void SET_VEHICLE_DOOR_OPEN(Vehicle vehicle, int doorIndex, BOOL loose, BOOL openInstantly);
-- @param vehicle Vehicle
-- @param doorIndex int
-- @param loose BOOL
-- @param openInstantly BOOL
-- @return void
function SetVehicleDoorOpen(vehicle, doorIndex, loose, openInstantly) end
-- windowIndex: 0 = Front Right Window 1 = Front Left Window 2 = Back Right Window 3 = Back Left Window
-- @module native
-- @submodule vehicle
-- @see REMOVE_VEHICLE_WINDOW
-- @usage void REMOVE_VEHICLE_WINDOW(Vehicle vehicle, int windowIndex);
-- @param vehicle Vehicle
-- @param windowIndex int
-- @return void
function RemoveVehicleWindow(vehicle, windowIndex) end
-- Roll down all the windows of the vehicle passed through the first parameter.
-- @module native
-- @submodule vehicle
-- @see ROLL_DOWN_WINDOWS
-- @usage void ROLL_DOWN_WINDOWS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function RollDownWindows(vehicle) end
-- windowIndex: 0 = Front Right Window 1 = Front Left Window 2 = Back Right Window 3 = Back Left Window
-- @module native
-- @submodule vehicle
-- @see ROLL_DOWN_WINDOW
-- @usage Any ROLL_DOWN_WINDOW(Vehicle vehicle, int windowIndex);
-- @param vehicle Vehicle
-- @param windowIndex int
-- @return Any
function RollDownWindow(vehicle, windowIndex) end
-- 0 = Front Right Window 1 = Front Left Window 2 = Back Right Window 3 = Back Left Window
-- @module native
-- @submodule vehicle
-- @see ROLL_UP_WINDOW
-- @usage Any ROLL_UP_WINDOW(Vehicle vehicle, int windowIndex);
-- @param vehicle Vehicle
-- @param windowIndex int
-- @return Any
function RollUpWindow(vehicle, windowIndex) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SMASH_VEHICLE_WINDOW
-- @usage Any SMASH_VEHICLE_WINDOW(Vehicle vehicle, int index);
-- @param vehicle Vehicle
-- @param index int
-- @return Any
function SmashVehicleWindow(vehicle, index) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see FIX_VEHICLE_WINDOW
-- @usage Any FIX_VEHICLE_WINDOW(Vehicle vehicle, int index);
-- @param vehicle Vehicle
-- @param index int
-- @return Any
function FixVehicleWindow(vehicle, index) end
-- set's if the vehicle has lights or not. not an on off toggle. p1 = 0 ;vehicle normal lights, off then lowbeams, then highbeams p1 = 1 ;vehicle doesn't have lights, always off p1 = 2 ;vehicle has always on lights p1 = 3 ;or even larger like 4,5,... normal lights like =1 note1: when using =2 on day it's lowbeam,highbeam but at night it's lowbeam,lowbeam,highbeam note2: when using =0 it's affected by day or night for highbeams don't exist in daytime.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_LIGHTS
-- @usage void SET_VEHICLE_LIGHTS(Vehicle vehicle, int state);
-- @param vehicle Vehicle
-- @param state int
-- @return void
function SetVehicleLights(vehicle, state) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_ALARM
-- @usage void SET_VEHICLE_ALARM(Vehicle vehicle, BOOL state);
-- @param vehicle Vehicle
-- @param state BOOL
-- @return void
function SetVehicleAlarm(vehicle, state) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see START_VEHICLE_ALARM
-- @usage Any START_VEHICLE_ALARM(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return Any
function StartVehicleAlarm(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_ALARM_ACTIVATED
-- @usage BOOL IS_VEHICLE_ALARM_ACTIVATED(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleAlarmActivated(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_INTERIORLIGHT
-- @usage void SET_VEHICLE_INTERIORLIGHT(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleInteriorlight(vehicle, toggle) end
-- multiplier = brightness of head lights. this value isn't capped afaik. multiplier = 0.0 no lights multiplier = 1.0 default game value
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_LIGHT_MULTIPLIER
-- @usage void SET_VEHICLE_LIGHT_MULTIPLIER(Vehicle vehicle, float multiplier);
-- @param vehicle Vehicle
-- @param multiplier float
-- @return void
function SetVehicleLightMultiplier(vehicle, multiplier) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see ATTACH_VEHICLE_TO_TRAILER
-- @usage void ATTACH_VEHICLE_TO_TRAILER(Vehicle vehicle, Vehicle trailer, float radius);
-- @param vehicle Vehicle
-- @param trailer Vehicle
-- @param radius float
-- @return void
function AttachVehicleToTrailer(vehicle, trailer, radius) end
-- Public Sub detatchTrailer(vh1 As Vehicle) Native.Function.Call(Hash.DETACH_VEHICLE_FROM_TRAILER, vh1) End Sub
-- @module native
-- @submodule vehicle
-- @see DETACH_VEHICLE_FROM_TRAILER
-- @usage void DETACH_VEHICLE_FROM_TRAILER(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function DetachVehicleFromTrailer(vehicle) end
-- Public Function isVehicleAttachedToTrailer(vh As Vehicle) As Boolean Return Native.Function.Call(Of Boolean)(Hash.IS_VEHICLE_ATTACHED_TO_TRAILER, vh) End Function
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_ATTACHED_TO_TRAILER
-- @usage BOOL IS_VEHICLE_ATTACHED_TO_TRAILER(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleAttachedToTrailer(vehicle) end
-- tyreIndex = 0 to 4 on normal vehicles '0 = wheel_lf / bike, plane or jet front '1 = wheel_rf '2 = wheel_lm / in 6 wheels trailer, plane or jet is first one on left '3 = wheel_rm / in 6 wheels trailer, plane or jet is first one on right '4 = wheel_lr / bike rear / in 6 wheels trailer, plane or jet is last one on left '5 = wheel_rr / in 6 wheels trailer, plane or jet is last one on right '45 = 6 wheels trailer mid wheel left '47 = 6 wheels trailer mid wheel right
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_TYRE_FIXED
-- @usage void SET_VEHICLE_TYRE_FIXED(Vehicle vehicle, int tyreIndex);
-- @param vehicle Vehicle
-- @param tyreIndex int
-- @return void
function SetVehicleTyreFixed(vehicle, tyreIndex) end
-- Sets a vehicle's license plate text. 8 chars maximum. Example: Ped playerPed = PLAYER::PLAYER_PED_ID(); Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed); char *plateText = "KING"; VEHICLE::SET_VEHICLE_NUMBER_PLATE_TEXT(veh, plateText);
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_NUMBER_PLATE_TEXT
-- @usage void SET_VEHICLE_NUMBER_PLATE_TEXT(Vehicle vehicle, char* plateText);
-- @param vehicle Vehicle
-- @param plateText char*
-- @return void
function SetVehicleNumberPlateText(vehicle, plateText) end
-- Returns the license plate text from a vehicle. 8 chars maximum.
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_NUMBER_PLATE_TEXT
-- @usage char* GET_VEHICLE_NUMBER_PLATE_TEXT(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return char*
function GetVehicleNumberPlateText(vehicle) end
-- Returns the number of *types* of licence plates, enumerated below in SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX.
-- @module native
-- @submodule vehicle
-- @see GET_NUMBER_OF_VEHICLE_NUMBER_PLATES
-- @usage int GET_NUMBER_OF_VEHICLE_NUMBER_PLATES();
-- @return int
function GetNumberOfVehicleNumberPlates() end
-- Plates: Blue/White Yellow/black Yellow/Blue Blue/White2 Blue/White3 Yankton
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX
-- @usage void SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX(Vehicle vehicle, int plateIndex);
-- @param vehicle Vehicle
-- @param plateIndex int
-- @return void
function SetVehicleNumberPlateTextIndex(vehicle, plateIndex) end
-- Returns the PlateType of a vehicle Blue_on_White_1 = 3, Blue_on_White_2 = 0, Blue_on_White_3 = 4, Yellow_on_Blue = 2, Yellow_on_Black = 1, North_Yankton = 5,
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_NUMBER_PLATE_TEXT_INDEX
-- @usage int GET_VEHICLE_NUMBER_PLATE_TEXT_INDEX(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleNumberPlateTextIndex(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_RANDOM_TRAINS
-- @usage void SET_RANDOM_TRAINS(BOOL toggle);
-- @param toggle BOOL
-- @return void
function SetRandomTrains(toggle) end
-- Train models HAVE TO be loaded (requested) before you use this. For variation 15 - request: freight freightcar freightgrain freightcont1 freightcont2 freighttrailer
-- @module native
-- @submodule vehicle
-- @see CREATE_MISSION_TRAIN
-- @usage Vehicle CREATE_MISSION_TRAIN(int variation, float x, float y, float z, BOOL direction);
-- @param variation int
-- @param x float
-- @param y float
-- @param z float
-- @param direction BOOL
-- @return Vehicle
function CreateMissionTrain(variation, x, y, z, direction) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SWITCH_TRAIN_TRACK
-- @usage Any SWITCH_TRAIN_TRACK(int intersectionId, BOOL state);
-- @param intersectionId int
-- @param state BOOL
-- @return Any
function SwitchTrainTrack(intersectionId, state) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DELETE_ALL_TRAINS
-- @usage void DELETE_ALL_TRAINS();
-- @return void
function DeleteAllTrains() end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_TRAIN_SPEED
-- @usage Any SET_TRAIN_SPEED(Vehicle train, float speed);
-- @param train Vehicle
-- @param speed float
-- @return Any
function SetTrainSpeed(train, speed) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_TRAIN_CRUISE_SPEED
-- @usage Any SET_TRAIN_CRUISE_SPEED(Vehicle train, float speed);
-- @param train Vehicle
-- @param speed float
-- @return Any
function SetTrainCruiseSpeed(train, speed) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_RANDOM_BOATS
-- @usage Any SET_RANDOM_BOATS(BOOL toggle);
-- @param toggle BOOL
-- @return Any
function SetRandomBoats(toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_GARBAGE_TRUCKS
-- @usage Any SET_GARBAGE_TRUCKS(BOOL toggle);
-- @param toggle BOOL
-- @return Any
function SetGarbageTrucks(toggle) end
-- Maximum amount of vehicles with vehicle stuck check appears to be 16.
-- @module native
-- @submodule vehicle
-- @see DOES_VEHICLE_HAVE_STUCK_VEHICLE_CHECK
-- @usage BOOL DOES_VEHICLE_HAVE_STUCK_VEHICLE_CHECK(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function DoesVehicleHaveStuckVehicleCheck(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_RECORDING_ID
-- @usage Any GET_VEHICLE_RECORDING_ID(int p0, char* p1);
-- @param p0 int
-- @param p1 char*
-- @return Any
function GetVehicleRecordingId(p0, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see REQUEST_VEHICLE_RECORDING
-- @usage void REQUEST_VEHICLE_RECORDING(Any p0, Any* p1);
-- @param p0 Any
-- @param p1 Any*
-- @return void
function RequestVehicleRecording(p0, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see HAS_VEHICLE_RECORDING_BEEN_LOADED
-- @usage BOOL HAS_VEHICLE_RECORDING_BEEN_LOADED(Any p0, Any* p1);
-- @param p0 Any
-- @param p1 Any*
-- @return BOOL
function HasVehicleRecordingBeenLoaded(p0, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see REMOVE_VEHICLE_RECORDING
-- @usage void REMOVE_VEHICLE_RECORDING(Any p0, Any* p1);
-- @param p0 Any
-- @param p1 Any*
-- @return void
function RemoveVehicleRecording(p0, p1) end
-- p1 is some kind of tolerance
-- @module native
-- @submodule vehicle
-- @see GET_POSITION_OF_VEHICLE_RECORDING_AT_TIME
-- @usage Vector3 GET_POSITION_OF_VEHICLE_RECORDING_AT_TIME(int p0, float p1, char* p2);
-- @param p0 int
-- @param p1 float
-- @param p2 char*
-- @return Vector3
function GetPositionOfVehicleRecordingAtTime(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_ROTATION_OF_VEHICLE_RECORDING_AT_TIME
-- @usage int GET_ROTATION_OF_VEHICLE_RECORDING_AT_TIME(Any p0, float p1, Any* p2);
-- @param p0 Any
-- @param p1 float
-- @param p2 Any*
-- @return int
function GetRotationOfVehicleRecordingAtTime(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_TOTAL_DURATION_OF_VEHICLE_RECORDING_ID
-- @usage float GET_TOTAL_DURATION_OF_VEHICLE_RECORDING_ID(Any p0);
-- @param p0 Any
-- @return float
function GetTotalDurationOfVehicleRecordingId(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_TOTAL_DURATION_OF_VEHICLE_RECORDING
-- @usage Any GET_TOTAL_DURATION_OF_VEHICLE_RECORDING(Any p0, Any p1);
-- @param p0 Any
-- @param p1 Any
-- @return Any
function GetTotalDurationOfVehicleRecording(p0, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_POSITION_IN_RECORDING
-- @usage float GET_POSITION_IN_RECORDING(Any p0);
-- @param p0 Any
-- @return float
function GetPositionInRecording(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_TIME_POSITION_IN_RECORDING
-- @usage float GET_TIME_POSITION_IN_RECORDING(Any p0);
-- @param p0 Any
-- @return float
function GetTimePositionInRecording(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see START_PLAYBACK_RECORDED_VEHICLE
-- @usage void START_PLAYBACK_RECORDED_VEHICLE(Vehicle vehicle, int p1, char* playback, BOOL p3);
-- @param vehicle Vehicle
-- @param p1 int
-- @param playback char*
-- @param p3 BOOL
-- @return void
function StartPlaybackRecordedVehicle(vehicle, p1, playback, p3) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see START_PLAYBACK_RECORDED_VEHICLE_WITH_FLAGS
-- @usage void START_PLAYBACK_RECORDED_VEHICLE_WITH_FLAGS(Vehicle vehicle, Any p1, char* playback, Any p3, Any p4, Any p5);
-- @param vehicle Vehicle
-- @param p1 Any
-- @param playback char*
-- @param p3 Any
-- @param p4 Any
-- @param p5 Any
-- @return void
function StartPlaybackRecordedVehicleWithFlags(vehicle, p1, playback, p3, p4, p5) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see STOP_PLAYBACK_RECORDED_VEHICLE
-- @usage void STOP_PLAYBACK_RECORDED_VEHICLE(Any p0);
-- @param p0 Any
-- @return void
function StopPlaybackRecordedVehicle(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see PAUSE_PLAYBACK_RECORDED_VEHICLE
-- @usage void PAUSE_PLAYBACK_RECORDED_VEHICLE(Any p0);
-- @param p0 Any
-- @return void
function PausePlaybackRecordedVehicle(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see UNPAUSE_PLAYBACK_RECORDED_VEHICLE
-- @usage void UNPAUSE_PLAYBACK_RECORDED_VEHICLE(Any p0);
-- @param p0 Any
-- @return void
function UnpausePlaybackRecordedVehicle(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_PLAYBACK_GOING_ON_FOR_VEHICLE
-- @usage BOOL IS_PLAYBACK_GOING_ON_FOR_VEHICLE(Any p0);
-- @param p0 Any
-- @return BOOL
function IsPlaybackGoingOnForVehicle(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_PLAYBACK_USING_AI_GOING_ON_FOR_VEHICLE
-- @usage BOOL IS_PLAYBACK_USING_AI_GOING_ON_FOR_VEHICLE(Any p0);
-- @param p0 Any
-- @return BOOL
function IsPlaybackUsingAiGoingOnForVehicle(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_CURRENT_PLAYBACK_FOR_VEHICLE
-- @usage Any GET_CURRENT_PLAYBACK_FOR_VEHICLE(Any p0);
-- @param p0 Any
-- @return Any
function GetCurrentPlaybackForVehicle(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SKIP_TO_END_AND_STOP_PLAYBACK_RECORDED_VEHICLE
-- @usage void SKIP_TO_END_AND_STOP_PLAYBACK_RECORDED_VEHICLE(Any p0);
-- @param p0 Any
-- @return void
function SkipToEndAndStopPlaybackRecordedVehicle(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_PLAYBACK_SPEED
-- @usage void SET_PLAYBACK_SPEED(Vehicle vehicle, float speed);
-- @param vehicle Vehicle
-- @param speed float
-- @return void
function SetPlaybackSpeed(vehicle, speed) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see START_PLAYBACK_RECORDED_VEHICLE_USING_AI
-- @usage void START_PLAYBACK_RECORDED_VEHICLE_USING_AI(Any p0, Any p1, Any* p2, float p3, Any p4);
-- @param p0 Any
-- @param p1 Any
-- @param p2 Any*
-- @param p3 float
-- @param p4 Any
-- @return void
function StartPlaybackRecordedVehicleUsingAi(p0, p1, p2, p3, p4) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SKIP_TIME_IN_PLAYBACK_RECORDED_VEHICLE
-- @usage void SKIP_TIME_IN_PLAYBACK_RECORDED_VEHICLE(Any p0, float p1);
-- @param p0 Any
-- @param p1 float
-- @return void
function SkipTimeInPlaybackRecordedVehicle(p0, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_PLAYBACK_TO_USE_AI
-- @usage void SET_PLAYBACK_TO_USE_AI(Vehicle vehicle, int flag);
-- @param vehicle Vehicle
-- @param flag int
-- @return void
function SetPlaybackToUseAi(vehicle, flag) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_PLAYBACK_TO_USE_AI_TRY_TO_REVERT_BACK_LATER
-- @usage void SET_PLAYBACK_TO_USE_AI_TRY_TO_REVERT_BACK_LATER(Any p0, Any p1, Any p2, BOOL p3);
-- @param p0 Any
-- @param p1 Any
-- @param p2 Any
-- @param p3 BOOL
-- @return void
function SetPlaybackToUseAiTryToRevertBackLater(p0, p1, p2, p3) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see EXPLODE_VEHICLE_IN_CUTSCENE
-- @usage void EXPLODE_VEHICLE_IN_CUTSCENE(Vehicle vehicle, BOOL p1);
-- @param vehicle Vehicle
-- @param p1 BOOL
-- @return void
function ExplodeVehicleInCutscene(vehicle, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see ADD_VEHICLE_STUCK_CHECK_WITH_WARP
-- @usage void ADD_VEHICLE_STUCK_CHECK_WITH_WARP(Any p0, float p1, Any p2, BOOL p3, BOOL p4, BOOL p5, Any p6);
-- @param p0 Any
-- @param p1 float
-- @param p2 Any
-- @param p3 BOOL
-- @param p4 BOOL
-- @param p5 BOOL
-- @param p6 Any
-- @return void
function AddVehicleStuckCheckWithWarp(p0, p1, p2, p3, p4, p5, p6) end
-- seems to make the vehicle stop spawning naturally in traffic. Here's an essential example: VEHICLE::SET_VEHICLE_MODEL_IS_SUPPRESSED(GAMEPLAY::GET_HASH_KEY("taco"), true); god I hate taco vans Confirmed to work? Needs to be looped? Can not get it to work.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_MODEL_IS_SUPPRESSED
-- @usage void SET_VEHICLE_MODEL_IS_SUPPRESSED(Hash model, BOOL suppressed);
-- @param model Hash
-- @param suppressed BOOL
-- @return void
function SetVehicleModelIsSuppressed(model, suppressed) end
-- Gets a random vehicle in a sphere at the specified position, of the specified radius. x: The X-component of the position of the sphere. y: The Y-component of the position of the sphere. z: The Z-component of the position of the sphere. radius: The radius of the sphere. Max is 9999.9004. modelHash: The vehicle model to limit the selection to. Pass 0 for any model. flags: The bitwise flags that modifies the behaviour of this function.
-- @module native
-- @submodule vehicle
-- @see GET_RANDOM_VEHICLE_IN_SPHERE
-- @usage Vehicle GET_RANDOM_VEHICLE_IN_SPHERE(float x, float y, float z, float radius, Hash modelHash, int flags);
-- @param x float
-- @param y float
-- @param z float
-- @param radius float
-- @param modelHash Hash
-- @param flags int
-- @return Vehicle
function GetRandomVehicleInSphere(x, y, z, radius, modelHash, flags) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_RANDOM_VEHICLE_FRONT_BUMPER_IN_SPHERE
-- @usage Vehicle GET_RANDOM_VEHICLE_FRONT_BUMPER_IN_SPHERE(float p0, float p1, float p2, float p3, int p4, int p5, int p6);
-- @param p0 float
-- @param p1 float
-- @param p2 float
-- @param p3 float
-- @param p4 int
-- @param p5 int
-- @param p6 int
-- @return Vehicle
function GetRandomVehicleFrontBumperInSphere(p0, p1, p2, p3, p4, p5, p6) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_RANDOM_VEHICLE_BACK_BUMPER_IN_SPHERE
-- @usage Vehicle GET_RANDOM_VEHICLE_BACK_BUMPER_IN_SPHERE(float p0, float p1, float p2, float p3, int p4, int p5, int p6);
-- @param p0 float
-- @param p1 float
-- @param p2 float
-- @param p3 float
-- @param p4 int
-- @param p5 int
-- @param p6 int
-- @return Vehicle
function GetRandomVehicleBackBumperInSphere(p0, p1, p2, p3, p4, p5, p6) end
-- Example usage VEHICLE::GET_CLOSEST_VEHICLE(x, y, z, radius, hash, unknown leave at 70) x, y, z: Position to get closest vehicle to. radius: Max radius to get a vehicle. modelHash: Limit to vehicles with this model. 0 for any. flags: The bitwise flags altering the function's behaviour. Does not return police cars or helicopters. It seems to return police cars for me, does not seem to return helicopters, planes or boats for some reason Only returns non police cars and motorbikes with the flag set to 70 and modelHash to 0. ModelHash seems to always be 0 when not a modelHash in the scripts, as stated above. These flags were found in the b617d scripts: 0,2,4,6,7,23,127,260,2146,2175,12294,16384,16386,20503,32768,67590,67711,98309,100359. Converted to binary, each bit probably represents a flag as explained regarding another native here: gtaforums.com/topic/822314-guide-driving-styles Conversion of found flags to binary: pastebin.com/kghNFkRi At exactly 16384 which is 0100000000000000 in binary and 4000 in hexadecimal only planes are returned. It's probably more convenient to use worldGetAllVehicles(int *arr, int arrSize) and check the shortest distance yourself and sort if you want by checking the vehicle type with for example VEHICLE::IS_THIS_MODEL_A_BOAT ------------------------------------------------------------------------- Conclusion: This native is not worth trying to use. Use something like this instead: pastebin.com/xiFdXa7h
-- @module native
-- @submodule vehicle
-- @see GET_CLOSEST_VEHICLE
-- @usage Vehicle GET_CLOSEST_VEHICLE(float x, float y, float z, float radius, Hash modelHash, int flags);
-- @param x float
-- @param y float
-- @param z float
-- @param radius float
-- @param modelHash Hash
-- @param flags int
-- @return Vehicle
function GetClosestVehicle(x, y, z, radius, modelHash, flags) end
-- Corrected p1. it's basically the 'carriage/trailer number'. So if the train has 3 trailers you'd call the native once with a var or 3 times with 1, 2, 3.
-- @module native
-- @submodule vehicle
-- @see GET_TRAIN_CARRIAGE
-- @usage Entity GET_TRAIN_CARRIAGE(Vehicle train, int trailerNumber);
-- @param train Vehicle
-- @param trailerNumber int
-- @return Entity
function GetTrainCarriage(train, trailerNumber) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DELETE_MISSION_TRAIN
-- @usage void DELETE_MISSION_TRAIN(Vehicle* train);
-- @param train Vehicle*
-- @return void
function DeleteMissionTrain(train) end
-- p1 is always 0
-- @module native
-- @submodule vehicle
-- @see SET_MISSION_TRAIN_AS_NO_LONGER_NEEDED
-- @usage void SET_MISSION_TRAIN_AS_NO_LONGER_NEEDED(Vehicle* train, BOOL p1);
-- @param train Vehicle*
-- @param p1 BOOL
-- @return void
function SetMissionTrainAsNoLongerNeeded(train, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_MISSION_TRAIN_COORDS
-- @usage void SET_MISSION_TRAIN_COORDS(Vehicle train, float x, float y, float z);
-- @param train Vehicle
-- @param x float
-- @param y float
-- @param z float
-- @return void
function SetMissionTrainCoords(train, x, y, z) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_THIS_MODEL_A_BOAT
-- @usage BOOL IS_THIS_MODEL_A_BOAT(Hash model);
-- @param model Hash
-- @return BOOL
function IsThisModelABoat(model) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_THIS_MODEL_A_PLANE
-- @usage BOOL IS_THIS_MODEL_A_PLANE(Hash model);
-- @param model Hash
-- @return BOOL
function IsThisModelAPlane(model) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_THIS_MODEL_A_HELI
-- @usage BOOL IS_THIS_MODEL_A_HELI(Hash model);
-- @param model Hash
-- @return BOOL
function IsThisModelAHeli(model) end
-- To check if the model is an amphibious car, see gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/page-33#entry1069317363 (for build 944 and above only!)
-- @module native
-- @submodule vehicle
-- @see IS_THIS_MODEL_A_CAR
-- @usage BOOL IS_THIS_MODEL_A_CAR(Hash model);
-- @param model Hash
-- @return BOOL
function IsThisModelACar(model) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_THIS_MODEL_A_TRAIN
-- @usage BOOL IS_THIS_MODEL_A_TRAIN(Hash model);
-- @param model Hash
-- @return BOOL
function IsThisModelATrain(model) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_THIS_MODEL_A_BIKE
-- @usage BOOL IS_THIS_MODEL_A_BIKE(Hash model);
-- @param model Hash
-- @return BOOL
function IsThisModelABike(model) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_THIS_MODEL_A_BICYCLE
-- @usage BOOL IS_THIS_MODEL_A_BICYCLE(Hash model);
-- @param model Hash
-- @return BOOL
function IsThisModelABicycle(model) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_THIS_MODEL_A_QUADBIKE
-- @usage BOOL IS_THIS_MODEL_A_QUADBIKE(Hash model);
-- @param model Hash
-- @return BOOL
function IsThisModelAQuadbike(model) end
-- Equivalent of SET_HELI_BLADES_SPEED(vehicleHandle, 1.0f);
-- @module native
-- @submodule vehicle
-- @see SET_HELI_BLADES_FULL_SPEED
-- @usage void SET_HELI_BLADES_FULL_SPEED(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function SetHeliBladesFullSpeed(vehicle) end
-- Sets the speed of the helicopter blades in percentage of the full speed. vehicleHandle: The helicopter. speed: The speed in percentage, 0.0f being 0% and 1.0f being 100%.
-- @module native
-- @submodule vehicle
-- @see SET_HELI_BLADES_SPEED
-- @usage void SET_HELI_BLADES_SPEED(Vehicle vehicle, float speed);
-- @param vehicle Vehicle
-- @param speed float
-- @return void
function SetHeliBladesSpeed(vehicle, speed) end
-- This has not yet been tested - it's just an assumption of what the types could be.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_CAN_BE_TARGETTED
-- @usage void SET_VEHICLE_CAN_BE_TARGETTED(Vehicle vehicle, BOOL state);
-- @param vehicle Vehicle
-- @param state BOOL
-- @return void
function SetVehicleCanBeTargetted(vehicle, state) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_CAN_BE_VISIBLY_DAMAGED
-- @usage void SET_VEHICLE_CAN_BE_VISIBLY_DAMAGED(Vehicle vehicle, BOOL state);
-- @param vehicle Vehicle
-- @param state BOOL
-- @return void
function SetVehicleCanBeVisiblyDamaged(vehicle, state) end
-- Dirt level 0..15
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_DIRT_LEVEL
-- @usage float GET_VEHICLE_DIRT_LEVEL(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return float
function GetVehicleDirtLevel(vehicle) end
-- You can't use values greater than 15.0 You can see why here: pastebin.com/Wbn34fGD Also, R* does (float)(rand() % 15) to get a random dirt level when generating a vehicle.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DIRT_LEVEL
-- @usage void SET_VEHICLE_DIRT_LEVEL(Vehicle vehicle, float dirtLevel);
-- @param vehicle Vehicle
-- @param dirtLevel float
-- @return void
function SetVehicleDirtLevel(vehicle, dirtLevel) end
-- doorIndex: 0 = Front Left Door 1 = Front Right Door 2 = Back Left Door 3 = Back Right Door 4 = Hood 5 = Trunk 6 = Trunk2
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_DOOR_FULLY_OPEN
-- @usage BOOL IS_VEHICLE_DOOR_FULLY_OPEN(Vehicle vehicle, int doorIndex);
-- @param vehicle Vehicle
-- @param doorIndex int
-- @return BOOL
function IsVehicleDoorFullyOpen(vehicle, doorIndex) end
-- Starts or stops the engine on the specified vehicle. vehicle: The vehicle to start or stop the engine on. value: true to turn the vehicle on; false to turn it off. instantly: if true, the vehicle will be set to the state immediately; otherwise, the current driver will physically turn on or off the engine. -------------------------------------- And what's with BOOL otherwise, what does it do??? -------------------------------------- I have no clue what 'otherwise' is either. Xbox360 of course ends at TU27 so that's our latest scripts and every script still only has the first 3 parameters. Side Note: It would of been nice though if it was to handle jet engines instead of having that separate native for it.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_ENGINE_ON
-- @usage void SET_VEHICLE_ENGINE_ON(Vehicle vehicle, BOOL value, BOOL instantly, BOOL otherwise);
-- @param vehicle Vehicle
-- @param value BOOL
-- @param instantly BOOL
-- @param otherwise BOOL
-- @return void
function SetVehicleEngineOn(vehicle, value, instantly, otherwise) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_UNDRIVEABLE
-- @usage void SET_VEHICLE_UNDRIVEABLE(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleUndriveable(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_PROVIDES_COVER
-- @usage void SET_VEHICLE_PROVIDES_COVER(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleProvidesCover(vehicle, toggle) end
-- doorIndex: 0 = Front Left Door (driver door) 1 = Front Right Door 2 = Back Left Door 3 = Back Right Door 4 = Hood 5 = Trunk 6 = Trunk2 p2: mostly use 0 and 1, very rare using 3 and 5 p3: It seems it is an angle Example in VB: Public Shared Sub Set_Vehicle_Door_Angle(Vehicle As Vehicle, Door As VehicleDoor, Angle As Single) Native.Function.Call(Hash.SET_VEHICLE_DOOR_CONTROL, Vehicle.Handle, Door, 1, Angle) End Sub I'm Not MentaL sfink: p2 is speed, 5 is fast, 1 is slow 3 is medium
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DOOR_CONTROL
-- @usage void SET_VEHICLE_DOOR_CONTROL(Vehicle vehicle, int doorIndex, int speed, float angle);
-- @param vehicle Vehicle
-- @param doorIndex int
-- @param speed int
-- @param angle float
-- @return void
function SetVehicleDoorControl(vehicle, doorIndex, speed, angle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DOOR_LATCHED
-- @usage void SET_VEHICLE_DOOR_LATCHED(Vehicle vehicle, int doorIndex, BOOL p2, BOOL p3, BOOL p4);
-- @param vehicle Vehicle
-- @param doorIndex int
-- @param p2 BOOL
-- @param p3 BOOL
-- @param p4 BOOL
-- @return void
function SetVehicleDoorLatched(vehicle, doorIndex, p2, p3, p4) end
-- example in vb: Public Shared Function Get_Vehicle_Door_Angle(Vehicle As Vehicle, Door As VehicleDoor) As Single Return Native.Function.Call(Of Single)(Hash.GET_VEHICLE_DOOR_ANGLE_RATIO, Vehicle.Handle, Door) End Function I'm Not MentaL
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_DOOR_ANGLE_RATIO
-- @usage float GET_VEHICLE_DOOR_ANGLE_RATIO(Vehicle vehicle, int door);
-- @param vehicle Vehicle
-- @param door int
-- @return float
function GetVehicleDoorAngleRatio(vehicle, door) end
-- doorIndex: 0 = Front Left Door 1 = Front Right Door 2 = Back Left Door 3 = Back Right Door 4 = Hood 5 = Trunk 6 = Trunk2
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DOOR_SHUT
-- @usage void SET_VEHICLE_DOOR_SHUT(Vehicle vehicle, int doorIndex, BOOL closeInstantly);
-- @param vehicle Vehicle
-- @param doorIndex int
-- @param closeInstantly BOOL
-- @return void
function SetVehicleDoorShut(vehicle, doorIndex, closeInstantly) end
-- doorIndex: 0 = Front Right Door 1 = Front Left Door 2 = Back Right Door 3 = Back Left Door 4 = Hood 5 = Trunk Changed last paramater from CreateDoorObject To NoDoorOnTheFloor because when on false, the door object is created,and not created when on true...the former parameter name was counter intuitive...(by Calderon)
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DOOR_BROKEN
-- @usage void SET_VEHICLE_DOOR_BROKEN(Vehicle vehicle, int doorIndex, BOOL deleteDoor);
-- @param vehicle Vehicle
-- @param doorIndex int
-- @param deleteDoor BOOL
-- @return void
function SetVehicleDoorBroken(vehicle, doorIndex, deleteDoor) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_CAN_BREAK
-- @usage void SET_VEHICLE_CAN_BREAK(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleCanBreak(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DOES_VEHICLE_HAVE_ROOF
-- @usage BOOL DOES_VEHICLE_HAVE_ROOF(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function DoesVehicleHaveRoof(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_BIG_VEHICLE
-- @usage BOOL IS_BIG_VEHICLE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsBigVehicle(vehicle) end
-- Actually number of color combinations
-- @module native
-- @submodule vehicle
-- @see GET_NUMBER_OF_VEHICLE_COLOURS
-- @usage int GET_NUMBER_OF_VEHICLE_COLOURS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetNumberOfVehicleColours(vehicle) end
-- dont be a dick
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_COLOUR_COMBINATION
-- @usage void SET_VEHICLE_COLOUR_COMBINATION(Vehicle vehicle, int colorCombination);
-- @param vehicle Vehicle
-- @param colorCombination int
-- @return void
function SetVehicleColourCombination(vehicle, colorCombination) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_COLOUR_COMBINATION
-- @usage int GET_VEHICLE_COLOUR_COMBINATION(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleColourCombination(vehicle) end
-- Setting this to false, makes the specified vehicle to where if you press Y your character doesn't even attempt the animation to enter the vehicle. Hence it's not considered aka ignored.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_IS_CONSIDERED_BY_PLAYER
-- @usage void SET_VEHICLE_IS_CONSIDERED_BY_PLAYER(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleIsConsideredByPlayer(vehicle, toggle) end
-- Not present in the retail version! It's just a nullsub. p0 always true (except in one case) p1 returns a random vehicle hash loaded in memory p2 unsure, maybe returns a different model
-- @module native
-- @submodule vehicle
-- @see GET_RANDOM_VEHICLE_MODEL_IN_MEMORY
-- @usage void GET_RANDOM_VEHICLE_MODEL_IN_MEMORY(BOOL p0, Hash* modelHash, int* p2);
-- @param p0 BOOL
-- @param modelHash Hash*
-- @param p2 int*
-- @return void
function GetRandomVehicleModelInMemory(p0, modelHash, p2) end
-- 2 seems to disable getting vehicle in modshop
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_DOOR_LOCK_STATUS
-- @usage int GET_VEHICLE_DOOR_LOCK_STATUS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleDoorLockStatus(vehicle) end
-- doorID starts at 0, not seeming to skip any numbers. Four door vehicles intuitively range from 0 to 3.
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_DOOR_DAMAGED
-- @usage BOOL IS_VEHICLE_DOOR_DAMAGED(Vehicle veh, int doorID);
-- @param veh Vehicle
-- @param doorID int
-- @return BOOL
function IsVehicleDoorDamaged(veh, doorID) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_BUMPER_BROKEN_OFF
-- @usage BOOL IS_VEHICLE_BUMPER_BROKEN_OFF(Vehicle vehicle, BOOL front);
-- @param vehicle Vehicle
-- @param front BOOL
-- @return BOOL
function IsVehicleBumperBrokenOff(vehicle, front) end
-- Usage: public bool isCopInRange(Vector3 Location, float Range) { return Function.Call<bool>(Hash.IS_COP_PED_IN_AREA_3D, Location.X - Range, Location.Y - Range, Location.Z - Range, Location.X + Range, Location.Y + Range, Location.Z + Range); }
-- @module native
-- @submodule vehicle
-- @see IS_COP_VEHICLE_IN_AREA_3D
-- @usage BOOL IS_COP_VEHICLE_IN_AREA_3D(float x1, float x2, float y1, float y2, float z1, float z2);
-- @param x1 float
-- @param x2 float
-- @param y1 float
-- @param y2 float
-- @param z1 float
-- @param z2 float
-- @return BOOL
function IsCopVehicleInArea_3d(x1, x2, y1, y2, z1, z2) end
-- Public Function isVehicleOnAllWheels(vh As Vehicle) As Boolean Return Native.Function.Call(Of Boolean)(Hash.IS_VEHICLE_ON_ALL_WHEELS, vh) End Function
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_ON_ALL_WHEELS
-- @usage BOOL IS_VEHICLE_ON_ALL_WHEELS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleOnAllWheels(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_LAYOUT_HASH
-- @usage Hash GET_VEHICLE_LAYOUT_HASH(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return Hash
function GetVehicleLayoutHash(vehicle) end
-- makes the train all jumbled up and derailed as it moves on the tracks (though that wont stop it from its normal operations)
-- @module native
-- @submodule vehicle
-- @see SET_RENDER_TRAIN_AS_DERAILED
-- @usage void SET_RENDER_TRAIN_AS_DERAILED(Vehicle train, BOOL toggle);
-- @param train Vehicle
-- @param toggle BOOL
-- @return void
function SetRenderTrainAsDerailed(train, toggle) end
-- They use the same color indexs as SET_VEHICLE_COLOURS.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_EXTRA_COLOURS
-- @usage void SET_VEHICLE_EXTRA_COLOURS(Vehicle vehicle, int pearlescentColor, int wheelColor);
-- @param vehicle Vehicle
-- @param pearlescentColor int
-- @param wheelColor int
-- @return void
function SetVehicleExtraColours(vehicle, pearlescentColor, wheelColor) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_EXTRA_COLOURS
-- @usage void GET_VEHICLE_EXTRA_COLOURS(Vehicle vehicle, int* pearlescentColor, int* wheelColor);
-- @param vehicle Vehicle
-- @param pearlescentColor int*
-- @param wheelColor int*
-- @return void
function GetVehicleExtraColours(vehicle, pearlescentColor, wheelColor) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see STOP_ALL_GARAGE_ACTIVITY
-- @usage void STOP_ALL_GARAGE_ACTIVITY();
-- @return void
function StopAllGarageActivity() end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_FIXED
-- @usage void SET_VEHICLE_FIXED(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function SetVehicleFixed(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DEFORMATION_FIXED
-- @usage void SET_VEHICLE_DEFORMATION_FIXED(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function SetVehicleDeformationFixed(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_DISABLE_VEHICLE_PETROL_TANK_FIRES
-- @usage void SET_DISABLE_VEHICLE_PETROL_TANK_FIRES(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetDisableVehiclePetrolTankFires(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_DISABLE_VEHICLE_PETROL_TANK_DAMAGE
-- @usage void SET_DISABLE_VEHICLE_PETROL_TANK_DAMAGE(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetDisableVehiclePetrolTankDamage(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see REMOVE_VEHICLES_FROM_GENERATORS_IN_AREA
-- @usage void REMOVE_VEHICLES_FROM_GENERATORS_IN_AREA(float x1, float y1, float z1, float x2, float y2, float z2, Any unk);
-- @param x1 float
-- @param y1 float
-- @param z1 float
-- @param x2 float
-- @param y2 float
-- @param z2 float
-- @param unk Any
-- @return void
function RemoveVehiclesFromGeneratorsInArea(x1, y1, z1, x2, y2, z2, unk) end
-- Locks the vehicle's steering to the desired angle, explained below. Requires to be called onTick. Steering is unlocked the moment the function stops being called on the vehicle. Steer bias: -1.0 = full right 0.0 = centered steering 1.0 = full left
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_STEER_BIAS
-- @usage void SET_VEHICLE_STEER_BIAS(Vehicle vehicle, float value);
-- @param vehicle Vehicle
-- @param value float
-- @return void
function SetVehicleSteerBias(vehicle, value) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_EXTRA_TURNED_ON
-- @usage BOOL IS_VEHICLE_EXTRA_TURNED_ON(Vehicle vehicle, int extraId);
-- @param vehicle Vehicle
-- @param extraId int
-- @return BOOL
function IsVehicleExtraTurnedOn(vehicle, extraId) end
-- Note: only some vehicle have extras extra ids are from 1 - 9 depending on the vehicle ------------------------------------------------- ^ not sure if outdated or simply wrong. Max extra ID for b944 is 14 ------------------------------------------------- p2 is not a on/off toggle. mostly 0 means on and 1 means off. not sure if it really should be a BOOL.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_EXTRA
-- @usage void SET_VEHICLE_EXTRA(Vehicle vehicle, int extraId, BOOL toggle);
-- @param vehicle Vehicle
-- @param extraId int
-- @param toggle BOOL
-- @return void
function SetVehicleExtra(vehicle, extraId, toggle) end
-- Checks via CVehicleModelInfo
-- @module native
-- @submodule vehicle
-- @see DOES_EXTRA_EXIST
-- @usage BOOL DOES_EXTRA_EXIST(Vehicle vehicle, int extraId);
-- @param vehicle Vehicle
-- @param extraId int
-- @return BOOL
function DoesExtraExist(vehicle, extraId) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_CONVERTIBLE_ROOF
-- @usage void SET_CONVERTIBLE_ROOF(Vehicle vehicle, BOOL p1);
-- @param vehicle Vehicle
-- @param p1 BOOL
-- @return void
function SetConvertibleRoof(vehicle, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see LOWER_CONVERTIBLE_ROOF
-- @usage void LOWER_CONVERTIBLE_ROOF(Vehicle vehicle, BOOL instantlyLower);
-- @param vehicle Vehicle
-- @param instantlyLower BOOL
-- @return void
function LowerConvertibleRoof(vehicle, instantlyLower) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see RAISE_CONVERTIBLE_ROOF
-- @usage void RAISE_CONVERTIBLE_ROOF(Vehicle vehicle, BOOL instantlyRaise);
-- @param vehicle Vehicle
-- @param instantlyRaise BOOL
-- @return void
function RaiseConvertibleRoof(vehicle, instantlyRaise) end
-- 0 -> up 1 -> lowering down 2 -> down 3 -> raising up
-- @module native
-- @submodule vehicle
-- @see GET_CONVERTIBLE_ROOF_STATE
-- @usage int GET_CONVERTIBLE_ROOF_STATE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetConvertibleRoofState(vehicle) end
-- p1 is false almost always. However, in launcher_carwash/carwash1/carwash2 scripts, p1 is true and is accompanied by DOES_VEHICLE_HAVE_ROOF
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_A_CONVERTIBLE
-- @usage BOOL IS_VEHICLE_A_CONVERTIBLE(Vehicle vehicle, BOOL p1);
-- @param vehicle Vehicle
-- @param p1 BOOL
-- @return BOOL
function IsVehicleAConvertible(vehicle, p1) end
-- is this for red lights only? more testing required.
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_STOPPED_AT_TRAFFIC_LIGHTS
-- @usage BOOL IS_VEHICLE_STOPPED_AT_TRAFFIC_LIGHTS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleStoppedAtTrafficLights(vehicle) end
-- Apply damage to vehicle at a location. Location is relative to vehicle model (not world). Radius of effect damage applied in a sphere at impact location
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_DAMAGE
-- @usage void SET_VEHICLE_DAMAGE(Vehicle vehicle, float xOffset, float yOffset, float zOffset, float damage, float radius, BOOL p6);
-- @param vehicle Vehicle
-- @param xOffset float
-- @param yOffset float
-- @param zOffset float
-- @param damage float
-- @param radius float
-- @param p6 BOOL
-- @return void
function SetVehicleDamage(vehicle, xOffset, yOffset, zOffset, damage, radius, p6) end
-- Returns 1000.0 if the function is unable to get the address of the specified vehicle or if it's not a vehicle. Minimum: -4000 Maximum: 1000 -4000: Engine is destroyed 0 and below: Engine catches fire and health rapidly declines 300: Engine is smoking and losing functionality 1000: Engine is perfect
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_ENGINE_HEALTH
-- @usage float GET_VEHICLE_ENGINE_HEALTH(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return float
function GetVehicleEngineHealth(vehicle) end
-- 1000 is max health Begins leaking gas at around 650 health
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_ENGINE_HEALTH
-- @usage void SET_VEHICLE_ENGINE_HEALTH(Vehicle vehicle, float health);
-- @param vehicle Vehicle
-- @param health float
-- @return void
function SetVehicleEngineHealth(vehicle, health) end
-- 1000 is max health Begins leaking gas at around 650 health
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_PETROL_TANK_HEALTH
-- @usage float GET_VEHICLE_PETROL_TANK_HEALTH(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return float
function GetVehiclePetrolTankHealth(vehicle) end
-- 1000 is max health Begins leaking gas at around 650 health
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_PETROL_TANK_HEALTH
-- @usage void SET_VEHICLE_PETROL_TANK_HEALTH(Vehicle vehicle, float health);
-- @param vehicle Vehicle
-- @param health float
-- @return void
function SetVehiclePetrolTankHealth(vehicle, health) end
-- p1 can be anywhere from 0 to 3 in the scripts. p2 is generally somewhere in the 1000 to 10000 range.
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_STUCK_TIMER_UP
-- @usage BOOL IS_VEHICLE_STUCK_TIMER_UP(Vehicle vehicle, int p1, int p2);
-- @param vehicle Vehicle
-- @param p1 int
-- @param p2 int
-- @return BOOL
function IsVehicleStuckTimerUp(vehicle, p1, p2) end
-- The inner function has a switch on the second parameter. It's the stuck timer index. Here's some pseudo code I wrote for the inner function: void __fastcall NATIVE_RESET_VEHICLE_STUCK_TIMER_INNER(CUnknown* unknownClassInVehicle, int timerIndex) { switch (timerIndex) { case 0: unknownClassInVehicle->FirstStuckTimer = (WORD)0u; case 1: unknownClassInVehicle->SecondStuckTimer = (WORD)0u; case 2: unknownClassInVehicle->ThirdStuckTimer = (WORD)0u; case 3: unknownClassInVehicle->FourthStuckTimer = (WORD)0u; case 4: unknownClassInVehicle->FirstStuckTimer = (WORD)0u; unknownClassInVehicle->SecondStuckTimer = (WORD)0u; unknownClassInVehicle->ThirdStuckTimer = (WORD)0u; unknownClassInVehicle->FourthStuckTimer = (WORD)0u; break; }; }
-- @module native
-- @submodule vehicle
-- @see RESET_VEHICLE_STUCK_TIMER
-- @usage void RESET_VEHICLE_STUCK_TIMER(Vehicle vehicle, int nullAttributes);
-- @param vehicle Vehicle
-- @param nullAttributes int
-- @return void
function ResetVehicleStuckTimer(vehicle, nullAttributes) end
-- p1 is always 0 in the scripts. p1 = check if vehicle is on fire
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_DRIVEABLE
-- @usage BOOL IS_VEHICLE_DRIVEABLE(Vehicle vehicle, BOOL isOnFireCheck);
-- @param vehicle Vehicle
-- @param isOnFireCheck BOOL
-- @return BOOL
function IsVehicleDriveable(vehicle, isOnFireCheck) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_HAS_BEEN_OWNED_BY_PLAYER
-- @usage void SET_VEHICLE_HAS_BEEN_OWNED_BY_PLAYER(Vehicle vehicle, BOOL owned);
-- @param vehicle Vehicle
-- @param owned BOOL
-- @return void
function SetVehicleHasBeenOwnedByPlayer(vehicle, owned) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_NEEDS_TO_BE_HOTWIRED
-- @usage void SET_VEHICLE_NEEDS_TO_BE_HOTWIRED(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleNeedsToBeHotwired(vehicle, toggle) end
-- Sounds the horn for the specified vehicle. vehicle: The vehicle to activate the horn for. mode: The hash of "NORMAL" or "HELDDOWN". Can be 0. duration: The duration to sound the horn, in milliseconds. Note: If a player is in the vehicle, it will only sound briefly.
-- @module native
-- @submodule vehicle
-- @see START_VEHICLE_HORN
-- @usage void START_VEHICLE_HORN(Vehicle vehicle, int duration, Hash mode, BOOL forever);
-- @param vehicle Vehicle
-- @param duration int
-- @param mode Hash
-- @param forever BOOL
-- @return void
function StartVehicleHorn(vehicle, duration, mode, forever) end
-- if true, axles won't bend.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_HAS_STRONG_AXLES
-- @usage void SET_VEHICLE_HAS_STRONG_AXLES(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleHasStrongAxles(vehicle, toggle) end
-- Returns model name of vehicle in all caps. Needs to be displayed through localizing text natives to get proper display name. ----------------------------------------------------------------------------------------------------------------------------------------- While often the case, this does not simply return the model name of the vehicle (which could be hashed to return the model hash). Variations of the same vehicle may also use the same display name. ----------------------------------------------------------------------------------------------------------------------------------------- Returns "CARNOTFOUND" if the hash doesn't match a vehicle hash. Using UI::_GET_LABEL_TEXT, you can get the localized name. For a full list, see here: pastebin.com/wvpyS4kS (pastebin.com/dA3TbkZw)
-- @module native
-- @submodule vehicle
-- @see GET_DISPLAY_NAME_FROM_VEHICLE_MODEL
-- @usage char* GET_DISPLAY_NAME_FROM_VEHICLE_MODEL(Hash modelHash);
-- @param modelHash Hash
-- @return char*
function GetDisplayNameFromVehicleModel(modelHash) end
-- The only example I can find of this function in the scripts, is this: struct _s = VEHICLE::GET_VEHICLE_DEFORMATION_AT_POS(rPtr((A_0) + 4), 1.21f, 6.15f, 0.3f); ----------------------------------------------------------------------------------------------------------------------------------------- PC scripts: v_5/*{3}*/ = VEHICLE::GET_VEHICLE_DEFORMATION_AT_POS(a_0._f1, 1.21, 6.15, 0.3);
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_DEFORMATION_AT_POS
-- @usage Vector3 GET_VEHICLE_DEFORMATION_AT_POS(Vehicle vehicle, float offsetX, float offsetY, float offsetZ);
-- @param vehicle Vehicle
-- @param offsetX float
-- @param offsetY float
-- @param offsetZ float
-- @return Vector3
function GetVehicleDeformationAtPos(vehicle, offsetX, offsetY, offsetZ) end
-- Note: Only seems to work on Emergency Vehicles
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_LIVERY
-- @usage void SET_VEHICLE_LIVERY(Vehicle vehicle, int livery);
-- @param vehicle Vehicle
-- @param livery int
-- @return void
function SetVehicleLivery(vehicle, livery) end
-- -1 = no livery
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_LIVERY
-- @usage int GET_VEHICLE_LIVERY(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleLivery(vehicle) end
-- Returns -1 if the vehicle has no livery
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_LIVERY_COUNT
-- @usage int GET_VEHICLE_LIVERY_COUNT(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleLiveryCount(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_WINDOW_INTACT
-- @usage BOOL IS_VEHICLE_WINDOW_INTACT(Vehicle vehicle, int windowIndex);
-- @param vehicle Vehicle
-- @param windowIndex int
-- @return BOOL
function IsVehicleWindowIntact(vehicle, windowIndex) end
-- Appears to return false if any window is broken.
-- @module native
-- @submodule vehicle
-- @see ARE_ALL_VEHICLE_WINDOWS_INTACT
-- @usage BOOL ARE_ALL_VEHICLE_WINDOWS_INTACT(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function AreAllVehicleWindowsIntact(vehicle) end
-- Returns false if every seat is occupied.
-- @module native
-- @submodule vehicle
-- @see ARE_ANY_VEHICLE_SEATS_FREE
-- @usage BOOL ARE_ANY_VEHICLE_SEATS_FREE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function AreAnyVehicleSeatsFree(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see RESET_VEHICLE_WHEELS
-- @usage void RESET_VEHICLE_WHEELS(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function ResetVehicleWheels(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_HELI_PART_BROKEN
-- @usage BOOL IS_HELI_PART_BROKEN(Vehicle vehicle, BOOL p1, BOOL p2, BOOL p3);
-- @param vehicle Vehicle
-- @param p1 BOOL
-- @param p2 BOOL
-- @param p3 BOOL
-- @return BOOL
function IsHeliPartBroken(vehicle, p1, p2, p3) end
-- Hash collision
-- @module native
-- @submodule vehicle
-- @see WAS_COUNTER_ACTIVATED
-- @usage BOOL WAS_COUNTER_ACTIVATED(Vehicle vehicle, Any p1);
-- @param vehicle Vehicle
-- @param p1 Any
-- @return BOOL
function WasCounterActivated(vehicle, p1) end
-- NOTE: Debugging functions are not present in the retail version of the game.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_NAME_DEBUG
-- @usage void SET_VEHICLE_NAME_DEBUG(Vehicle vehicle, char* name);
-- @param vehicle Vehicle
-- @param name char*
-- @return void
function SetVehicleNameDebug(vehicle, name) end
-- Sets a vehicle to be strongly resistant to explosions. p0 is the vehicle; set p1 to false to toggle the effect on/off.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_EXPLODES_ON_HIGH_EXPLOSION_DAMAGE
-- @usage void SET_VEHICLE_EXPLODES_ON_HIGH_EXPLOSION_DAMAGE(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleExplodesOnHighExplosionDamage(vehicle, toggle) end
-- Works for vehicles with a retractable landing gear landing gear states: 0: Deployed 1: Closing 2: Opening 3: Retracted
-- @module native
-- @submodule vehicle
-- @see CONTROL_LANDING_GEAR
-- @usage void CONTROL_LANDING_GEAR(Vehicle vehicle, int state);
-- @param vehicle Vehicle
-- @param state int
-- @return void
function ControlLandingGear(vehicle, state) end
-- landing gear states: 0: Deployed 1: Closing 2: Opening 3: Retracted
-- @module native
-- @submodule vehicle
-- @see GET_LANDING_GEAR_STATE
-- @usage int GET_LANDING_GEAR_STATE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetLandingGearState(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_ANY_VEHICLE_NEAR_POINT
-- @usage BOOL IS_ANY_VEHICLE_NEAR_POINT(float x, float y, float z, float radius);
-- @param x float
-- @param y float
-- @param z float
-- @param radius float
-- @return BOOL
function IsAnyVehicleNearPoint(x, y, z, radius) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see REQUEST_VEHICLE_HIGH_DETAIL_MODEL
-- @usage void REQUEST_VEHICLE_HIGH_DETAIL_MODEL(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function RequestVehicleHighDetailModel(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see REMOVE_VEHICLE_HIGH_DETAIL_MODEL
-- @usage void REMOVE_VEHICLE_HIGH_DETAIL_MODEL(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function RemoveVehicleHighDetailModel(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_HIGH_DETAIL
-- @usage BOOL IS_VEHICLE_HIGH_DETAIL(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleHighDetail(vehicle) end
-- REQUEST_VEHICLE_ASSET(GET_HASH_KEY(cargobob3), 3); vehicle found that have asset's: cargobob3 submersible blazer
-- @module native
-- @submodule vehicle
-- @see REQUEST_VEHICLE_ASSET
-- @usage void REQUEST_VEHICLE_ASSET(Hash vehicleHash, int vehicleAsset);
-- @param vehicleHash Hash
-- @param vehicleAsset int
-- @return void
function RequestVehicleAsset(vehicleHash, vehicleAsset) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see HAS_VEHICLE_ASSET_LOADED
-- @usage BOOL HAS_VEHICLE_ASSET_LOADED(int vehicleAsset);
-- @param vehicleAsset int
-- @return BOOL
function HasVehicleAssetLoaded(vehicleAsset) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see REMOVE_VEHICLE_ASSET
-- @usage void REMOVE_VEHICLE_ASSET(int vehicleAsset);
-- @param vehicleAsset int
-- @return void
function RemoveVehicleAsset(vehicleAsset) end
-- HookOffset defines where the hook is attached. leave at 0 for default attachment.
-- @module native
-- @submodule vehicle
-- @see ATTACH_VEHICLE_TO_TOW_TRUCK
-- @usage void ATTACH_VEHICLE_TO_TOW_TRUCK(Vehicle towTruck, Vehicle vehicle, BOOL rear, float hookOffsetX, float hookOffsetY, float hookOffsetZ);
-- @param towTruck Vehicle
-- @param vehicle Vehicle
-- @param rear BOOL
-- @param hookOffsetX float
-- @param hookOffsetY float
-- @param hookOffsetZ float
-- @return void
function AttachVehicleToTowTruck(towTruck, vehicle, rear, hookOffsetX, hookOffsetY, hookOffsetZ) end
-- First two parameters swapped. Scripts verify that towTruck is the first parameter, not the second.
-- @module native
-- @submodule vehicle
-- @see DETACH_VEHICLE_FROM_TOW_TRUCK
-- @usage void DETACH_VEHICLE_FROM_TOW_TRUCK(Vehicle towTruck, Vehicle vehicle);
-- @param towTruck Vehicle
-- @param vehicle Vehicle
-- @return void
function DetachVehicleFromTowTruck(towTruck, vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DETACH_VEHICLE_FROM_ANY_TOW_TRUCK
-- @usage BOOL DETACH_VEHICLE_FROM_ANY_TOW_TRUCK(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function DetachVehicleFromAnyTowTruck(vehicle) end
-- Scripts verify that towTruck is the first parameter, not the second.
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_ATTACHED_TO_TOW_TRUCK
-- @usage BOOL IS_VEHICLE_ATTACHED_TO_TOW_TRUCK(Vehicle towTruck, Vehicle vehicle);
-- @param towTruck Vehicle
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleAttachedToTowTruck(towTruck, vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_ENTITY_ATTACHED_TO_TOW_TRUCK
-- @usage Entity GET_ENTITY_ATTACHED_TO_TOW_TRUCK(Vehicle towTruck);
-- @param towTruck Vehicle
-- @return Entity
function GetEntityAttachedToTowTruck(towTruck) end
-- Please change to void.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_AUTOMATICALLY_ATTACHES
-- @usage Any SET_VEHICLE_AUTOMATICALLY_ATTACHES(Vehicle vehicle, Any p1, Any p2);
-- @param vehicle Vehicle
-- @param p1 Any
-- @param p2 Any
-- @return Any
function SetVehicleAutomaticallyAttaches(vehicle, p1, p2) end
-- On accelerating, spins the driven wheels with the others braked, so you don't go anywhere.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_BURNOUT
-- @usage void SET_VEHICLE_BURNOUT(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleBurnout(vehicle, toggle) end
-- Returns whether the specified vehicle is currently in a burnout. vb.net Public Function isVehicleInBurnout(vh As Vehicle) As Boolean Return Native.Function.Call(Of Boolean)(Hash.IS_VEHICLE_IN_BURNOUT, vh) End Function
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_IN_BURNOUT
-- @usage BOOL IS_VEHICLE_IN_BURNOUT(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleInBurnout(vehicle) end
-- Reduces grip significantly so it's hard to go anywhere.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_REDUCE_GRIP
-- @usage void SET_VEHICLE_REDUCE_GRIP(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleReduceGrip(vehicle, toggle) end
-- Sets the turn signal enabled for a vehicle. Set turnSignal to 1 for left light, 0 for right light.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_INDICATOR_LIGHTS
-- @usage void SET_VEHICLE_INDICATOR_LIGHTS(Vehicle vehicle, int turnSignal, BOOL toggle);
-- @param vehicle Vehicle
-- @param turnSignal int
-- @param toggle BOOL
-- @return void
function SetVehicleIndicatorLights(vehicle, turnSignal, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_BRAKE_LIGHTS
-- @usage void SET_VEHICLE_BRAKE_LIGHTS(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleBrakeLights(vehicle, toggle) end
-- does this work while in air?
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_HANDBRAKE
-- @usage void SET_VEHICLE_HANDBRAKE(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleHandbrake(vehicle, toggle) end
-- Gets the trailer of a vehicle and puts it into the trailer parameter.
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_TRAILER_VEHICLE
-- @usage BOOL GET_VEHICLE_TRAILER_VEHICLE(Vehicle vehicle, Vehicle* trailer);
-- @param vehicle Vehicle
-- @param trailer Vehicle*
-- @return BOOL
function GetVehicleTrailerVehicle(vehicle, trailer) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_RUDDER_BROKEN
-- @usage void SET_VEHICLE_RUDDER_BROKEN(Vehicle vehicle, BOOL p1);
-- @param vehicle Vehicle
-- @param p1 BOOL
-- @return void
function SetVehicleRudderBroken(vehicle, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MAX_BRAKING
-- @usage float GET_VEHICLE_MAX_BRAKING(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return float
function GetVehicleMaxBraking(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MAX_TRACTION
-- @usage float GET_VEHICLE_MAX_TRACTION(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return float
function GetVehicleMaxTraction(vehicle) end
-- static - max acceleration
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_ACCELERATION
-- @usage float GET_VEHICLE_ACCELERATION(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return float
function GetVehicleAcceleration(vehicle) end
-- Returns max braking of the specified vehicle model. For a full list, see here: pastebin.com/3N8DVbpG
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MODEL_MAX_BRAKING
-- @usage float GET_VEHICLE_MODEL_MAX_BRAKING(Hash modelHash);
-- @param modelHash Hash
-- @return float
function GetVehicleModelMaxBraking(modelHash) end
-- Returns max traction of the specified vehicle model. For a full list, see here: pastebin.com/ERnntVjK
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MODEL_MAX_TRACTION
-- @usage float GET_VEHICLE_MODEL_MAX_TRACTION(Hash modelHash);
-- @param modelHash Hash
-- @return float
function GetVehicleModelMaxTraction(modelHash) end
-- Returns the acceleration of the specified model. For a full list, see here: pastebin.com/GaN6vT4R
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MODEL_ACCELERATION
-- @usage float GET_VEHICLE_MODEL_ACCELERATION(Hash modelHash);
-- @param modelHash Hash
-- @return float
function GetVehicleModelAcceleration(modelHash) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_CLASS_MAX_TRACTION
-- @usage float GET_VEHICLE_CLASS_MAX_TRACTION(int vehicleClass);
-- @param vehicleClass int
-- @return float
function GetVehicleClassMaxTraction(vehicleClass) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_CLASS_MAX_AGILITY
-- @usage float GET_VEHICLE_CLASS_MAX_AGILITY(int vehicleClass);
-- @param vehicleClass int
-- @return float
function GetVehicleClassMaxAgility(vehicleClass) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_CLASS_MAX_ACCELERATION
-- @usage float GET_VEHICLE_CLASS_MAX_ACCELERATION(int vehicleClass);
-- @param vehicleClass int
-- @return float
function GetVehicleClassMaxAcceleration(vehicleClass) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_CLASS_MAX_BRAKING
-- @usage float GET_VEHICLE_CLASS_MAX_BRAKING(int vehicleClass);
-- @param vehicleClass int
-- @return float
function GetVehicleClassMaxBraking(vehicleClass) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see OPEN_BOMB_BAY_DOORS
-- @usage void OPEN_BOMB_BAY_DOORS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function OpenBombBayDoors(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see CLOSE_BOMB_BAY_DOORS
-- @usage void CLOSE_BOMB_BAY_DOORS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function CloseBombBayDoors(vehicle) end
-- Possibly: Returns whether the searchlight (found on police vehicles) is toggled on.
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_SEARCHLIGHT_ON
-- @usage BOOL IS_VEHICLE_SEARCHLIGHT_ON(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleSearchlightOn(vehicle) end
-- Only works during nighttime.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_SEARCHLIGHT
-- @usage void SET_VEHICLE_SEARCHLIGHT(Vehicle heli, BOOL toggle, BOOL canBeUsedByAI);
-- @param heli Vehicle
-- @param toggle BOOL
-- @param canBeUsedByAI BOOL
-- @return void
function SetVehicleSearchlight(heli, toggle, canBeUsedByAI) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see CAN_SHUFFLE_SEAT
-- @usage BOOL CAN_SHUFFLE_SEAT(Vehicle vehicle, Any p1);
-- @param vehicle Vehicle
-- @param p1 Any
-- @return BOOL
function CanShuffleSeat(vehicle, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_NUM_MOD_KITS
-- @usage int GET_NUM_MOD_KITS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetNumModKits(vehicle) end
-- Set modKit to 0 if you plan to call SET_VEHICLE_MOD. That's what the game does. Most body modifications through SET_VEHICLE_MOD will not take effect until this is set to 0.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_MOD_KIT
-- @usage void SET_VEHICLE_MOD_KIT(Vehicle vehicle, int modKit);
-- @param vehicle Vehicle
-- @param modKit int
-- @return void
function SetVehicleModKit(vehicle, modKit) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MOD_KIT
-- @usage int GET_VEHICLE_MOD_KIT(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleModKit(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MOD_KIT_TYPE
-- @usage int GET_VEHICLE_MOD_KIT_TYPE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleModKitType(vehicle) end
-- Returns an int Wheel Types: 0: Sport 1: Muscle 2: Lowrider 3: SUV 4: Offroad 5: Tuner 6: Bike Wheels 7: High End Tested in Los Santos Customs
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_WHEEL_TYPE
-- @usage int GET_VEHICLE_WHEEL_TYPE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleWheelType(vehicle) end
-- 0: Sport 1: Muscle 2: Lowrider 3: SUV 4: Offroad 5: Tuner 6: Bike Wheels 7: High End
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_WHEEL_TYPE
-- @usage void SET_VEHICLE_WHEEL_TYPE(Vehicle vehicle, int WheelType);
-- @param vehicle Vehicle
-- @param WheelType int
-- @return void
function SetVehicleWheelType(vehicle, WheelType) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_NUM_MOD_COLORS
-- @usage int GET_NUM_MOD_COLORS(int p0, BOOL p1);
-- @param p0 int
-- @param p1 BOOL
-- @return int
function GetNumModColors(p0, p1) end
-- paintType: 0: Normal 1: Metallic 2: Pearl 3: Matte 4: Metal 5: Chrome color: number of the color. p3 seems to always be 0.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_MOD_COLOR_1
-- @usage void SET_VEHICLE_MOD_COLOR_1(Vehicle vehicle, int paintType, int color, int p3);
-- @param vehicle Vehicle
-- @param paintType int
-- @param color int
-- @param p3 int
-- @return void
function SetVehicleModColor_1(vehicle, paintType, color, p3) end
-- Changes the secondary paint type and color paintType: 0: Normal 1: Metallic 2: Pearl 3: Matte 4: Metal 5: Chrome color: number of the color
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_MOD_COLOR_2
-- @usage void SET_VEHICLE_MOD_COLOR_2(Vehicle vehicle, int paintType, int color);
-- @param vehicle Vehicle
-- @param paintType int
-- @param color int
-- @return void
function SetVehicleModColor_2(vehicle, paintType, color) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MOD_COLOR_1
-- @usage void GET_VEHICLE_MOD_COLOR_1(Vehicle vehicle, int* paintType, int* color, int* p3);
-- @param vehicle Vehicle
-- @param paintType int*
-- @param color int*
-- @param p3 int*
-- @return void
function GetVehicleModColor_1(vehicle, paintType, color, p3) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MOD_COLOR_2
-- @usage void GET_VEHICLE_MOD_COLOR_2(Vehicle vehicle, int* paintType, int* color);
-- @param vehicle Vehicle
-- @param paintType int*
-- @param color int*
-- @return void
function GetVehicleModColor_2(vehicle, paintType, color) end
-- returns a string which is the codename of the vehicle's currently selected primary color p1 is always 0
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MOD_COLOR_1_NAME
-- @usage char* GET_VEHICLE_MOD_COLOR_1_NAME(Vehicle vehicle, BOOL p1);
-- @param vehicle Vehicle
-- @param p1 BOOL
-- @return char*
function GetVehicleModColor_1Name(vehicle, p1) end
-- returns a string which is the codename of the vehicle's currently selected secondary color
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MOD_COLOR_2_NAME
-- @usage char* GET_VEHICLE_MOD_COLOR_2_NAME(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return char*
function GetVehicleModColor_2Name(vehicle) end
-- In b944, there are 50 (0 - 49) mod types. Sets the vehicle mod. The vehicle must have a mod kit first. Any out of range ModIndex is stock. #Mod Type Spoilers Front Bumper Rear Bumper Side Skirt Exhaust Frame Grille Hood Fender Right Fender Roof Engine Brakes Transmission Horns - 14 (modIndex from 0 to 51) Suspension Armor Front Wheels Back Wheels - 24 //only for motocycles Plate holders Trim Design Ornaments Dial Design Steering Wheel Shifter Leavers Plaques Hydraulics Livery ENUMS: pastebin.com/QzEAn02v
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_MOD
-- @usage void SET_VEHICLE_MOD(Vehicle vehicle, int modType, int modIndex, BOOL customTires);
-- @param vehicle Vehicle
-- @param modType int
-- @param modIndex int
-- @param customTires BOOL
-- @return void
function SetVehicleMod(vehicle, modType, modIndex, customTires) end
-- In b944, there are 50 (0 - 49) mod types. Returns -1 if the vehicle mod is stock
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MOD
-- @usage int GET_VEHICLE_MOD(Vehicle vehicle, int modType);
-- @param vehicle Vehicle
-- @param modType int
-- @return int
function GetVehicleMod(vehicle, modType) end
-- Only used for wheels(ModType = 23/24) Returns true if the wheels are custom wheels
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MOD_VARIATION
-- @usage BOOL GET_VEHICLE_MOD_VARIATION(Vehicle vehicle, int modType);
-- @param vehicle Vehicle
-- @param modType int
-- @return BOOL
function GetVehicleModVariation(vehicle, modType) end
-- Returns how many possible mods a vehicle has for a given mod type
-- @module native
-- @submodule vehicle
-- @see GET_NUM_VEHICLE_MODS
-- @usage int GET_NUM_VEHICLE_MODS(Vehicle vehicle, int modType);
-- @param vehicle Vehicle
-- @param modType int
-- @return int
function GetNumVehicleMods(vehicle, modType) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see REMOVE_VEHICLE_MOD
-- @usage void REMOVE_VEHICLE_MOD(Vehicle vehicle, int modType);
-- @param vehicle Vehicle
-- @param modType int
-- @return void
function RemoveVehicleMod(vehicle, modType) end
-- Toggles: UNK17 Turbo UNK19 Tire Smoke UNK21 Xenon Headlights
-- @module native
-- @submodule vehicle
-- @see TOGGLE_VEHICLE_MOD
-- @usage void TOGGLE_VEHICLE_MOD(Vehicle vehicle, int modType, BOOL toggle);
-- @param vehicle Vehicle
-- @param modType int
-- @param toggle BOOL
-- @return void
function ToggleVehicleMod(vehicle, modType, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_TOGGLE_MOD_ON
-- @usage BOOL IS_TOGGLE_MOD_ON(Vehicle vehicle, int modType);
-- @param vehicle Vehicle
-- @param modType int
-- @return BOOL
function IsToggleModOn(vehicle, modType) end
-- Returns the text label of a mod type for a given vehicle Use _GET_LABEL_TEXT to get the part name in the game's language
-- @module native
-- @submodule vehicle
-- @see GET_MOD_TEXT_LABEL
-- @usage char* GET_MOD_TEXT_LABEL(Vehicle vehicle, int modType, int modValue);
-- @param vehicle Vehicle
-- @param modType int
-- @param modValue int
-- @return char*
function GetModTextLabel(vehicle, modType, modValue) end
-- Returns the name for the type of vehicle mod(Armour, engine etc)
-- @module native
-- @submodule vehicle
-- @see GET_MOD_SLOT_NAME
-- @usage char* GET_MOD_SLOT_NAME(Vehicle vehicle, int modType);
-- @param vehicle Vehicle
-- @param modType int
-- @return char*
function GetModSlotName(vehicle, modType) end
-- Second Param = LiveryIndex example int count = VEHICLE::GET_VEHICLE_LIVERY_COUNT(veh); for (int i = 0; i < count; i++) { char* LiveryName = VEHICLE::GET_LIVERY_NAME(veh, i); } this example will work fine to fetch all names for example for Sanchez we get SANC_LV1 SANC_LV2 SANC_LV3 SANC_LV4 SANC_LV5 Use _GET_LABEL_TEXT, to get the localized livery name.
-- @module native
-- @submodule vehicle
-- @see GET_LIVERY_NAME
-- @usage char* GET_LIVERY_NAME(Vehicle vehicle, int liveryIndex);
-- @param vehicle Vehicle
-- @param liveryIndex int
-- @return char*
function GetLiveryName(vehicle, liveryIndex) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_MOD_MODIFIER_VALUE
-- @usage Any GET_VEHICLE_MOD_MODIFIER_VALUE(Vehicle vehicle, int modType, int modIndex);
-- @param vehicle Vehicle
-- @param modType int
-- @param modIndex int
-- @return Any
function GetVehicleModModifierValue(vehicle, modType, modIndex) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see PRELOAD_VEHICLE_MOD
-- @usage void PRELOAD_VEHICLE_MOD(Any p0, Any p1, Any p2);
-- @param p0 Any
-- @param p1 Any
-- @param p2 Any
-- @return void
function PreloadVehicleMod(p0, p1, p2) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see HAS_PRELOAD_MODS_FINISHED
-- @usage BOOL HAS_PRELOAD_MODS_FINISHED(Any p0);
-- @param p0 Any
-- @return BOOL
function HasPreloadModsFinished(p0) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see RELEASE_PRELOAD_MODS
-- @usage void RELEASE_PRELOAD_MODS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function ReleasePreloadMods(vehicle) end
-- Sets the tire smoke's color of this vehicle. vehicle: The vehicle that is the target of this method. r: The red level in the RGB color code. g: The green level in the RGB color code. b: The blue level in the RGB color code. Note: setting r,g,b to 0 will give the car independance day tyre smoke
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_TYRE_SMOKE_COLOR
-- @usage void SET_VEHICLE_TYRE_SMOKE_COLOR(Vehicle vehicle, int r, int g, int b);
-- @param vehicle Vehicle
-- @param r int
-- @param g int
-- @param b int
-- @return void
function SetVehicleTyreSmokeColor(vehicle, r, g, b) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_TYRE_SMOKE_COLOR
-- @usage void GET_VEHICLE_TYRE_SMOKE_COLOR(Vehicle vehicle, int* r, int* g, int* b);
-- @param vehicle Vehicle
-- @param r int*
-- @param g int*
-- @param b int*
-- @return void
function GetVehicleTyreSmokeColor(vehicle, r, g, b) end
-- enum WindowTints { WINDOWTINT_NONE, WINDOWTINT_PURE_BLACK, WINDOWTINT_DARKSMOKE, WINDOWTINT_LIGHTSMOKE, WINDOWTINT_STOCK, WINDOWTINT_LIMO, WINDOWTINT_GREEN };
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_WINDOW_TINT
-- @usage void SET_VEHICLE_WINDOW_TINT(Vehicle vehicle, int tint);
-- @param vehicle Vehicle
-- @param tint int
-- @return void
function SetVehicleWindowTint(vehicle, tint) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_WINDOW_TINT
-- @usage int GET_VEHICLE_WINDOW_TINT(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleWindowTint(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_NUM_VEHICLE_WINDOW_TINTS
-- @usage int GET_NUM_VEHICLE_WINDOW_TINTS();
-- @return int
function GetNumVehicleWindowTints() end
-- What's this for? Primary and Secondary RGB have their own natives and this one doesn't seem specific.
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_COLOR
-- @usage void GET_VEHICLE_COLOR(Vehicle vehicle, int* r, int* g, int* b);
-- @param vehicle Vehicle
-- @param r int*
-- @param g int*
-- @param b int*
-- @return void
function GetVehicleColor(vehicle, r, g, b) end
-- iVar3 = get_vehicle_cause_of_destruction(uLocal_248[iVar2]); if (iVar3 == joaat("weapon_stickybomb")) { func_171(726); iLocal_260 = 1; }
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_CAUSE_OF_DESTRUCTION
-- @usage Hash GET_VEHICLE_CAUSE_OF_DESTRUCTION(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return Hash
function GetVehicleCauseOfDestruction(vehicle) end
-- From the driver's perspective, is the left headlight broken.
-- @module native
-- @submodule vehicle
-- @see GET_IS_LEFT_VEHICLE_HEADLIGHT_DAMAGED
-- @usage BOOL GET_IS_LEFT_VEHICLE_HEADLIGHT_DAMAGED(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function GetIsLeftVehicleHeadlightDamaged(vehicle) end
-- From the driver's perspective, is the right headlight broken.
-- @module native
-- @submodule vehicle
-- @see GET_IS_RIGHT_VEHICLE_HEADLIGHT_DAMAGED
-- @usage BOOL GET_IS_RIGHT_VEHICLE_HEADLIGHT_DAMAGED(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function GetIsRightVehicleHeadlightDamaged(vehicle) end
-- Sets the wanted state of this vehicle.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_IS_WANTED
-- @usage void SET_VEHICLE_IS_WANTED(Vehicle vehicle, BOOL state);
-- @param vehicle Vehicle
-- @param state BOOL
-- @return void
function SetVehicleIsWanted(vehicle, state) end
-- hash collision??? - Don't think so. I fits alphabetically and it used with a plane in the scripts
-- @module native
-- @submodule vehicle
-- @see DISABLE_PLANE_AILERON
-- @usage void DISABLE_PLANE_AILERON(Vehicle vehicle, BOOL p1, BOOL p2);
-- @param vehicle Vehicle
-- @param p1 BOOL
-- @param p2 BOOL
-- @return void
function DisablePlaneAileron(vehicle, p1, p2) end
-- Returns true when in a vehicle, false whilst entering/exiting.
-- @module native
-- @submodule vehicle
-- @see GET_IS_VEHICLE_ENGINE_RUNNING
-- @usage BOOL GET_IS_VEHICLE_ENGINE_RUNNING(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function GetIsVehicleEngineRunning(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_LAST_DRIVEN_VEHICLE
-- @usage void SET_LAST_DRIVEN_VEHICLE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function SetLastDrivenVehicle(vehicle) end
-- Not exactly sure on this one, but here's a snippet of code: if (PED::IS_PED_IN_ANY_VEHICLE(PLAYER::PLAYER_PED_ID(), 0)) { v_2 = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), 0); } else { v_2 = VEHICLE::_B2D06FAEDE65B577(); }
-- @module native
-- @submodule vehicle
-- @see GET_LAST_DRIVEN_VEHICLE
-- @usage Vehicle GET_LAST_DRIVEN_VEHICLE();
-- @return Vehicle
function GetLastDrivenVehicle() end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_LOD_MULTIPLIER
-- @usage void SET_VEHICLE_LOD_MULTIPLIER(Vehicle vehicle, float multiplier);
-- @param vehicle Vehicle
-- @param multiplier float
-- @return void
function SetVehicleLodMultiplier(vehicle, multiplier) end
-- Commands the driver of an armed vehicle (p0) to shoot its weapon at a target (p1). p3, p4 and p5 are the coordinates of the target. Example: WEAPON::SET_CURRENT_PED_VEHICLE_WEAPON(pilot,GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLANE_ROCKET")); VEHICLE::SET_VEHICLE_SHOOT_AT_TARGET(pilot, target, targPos.x, targPos.y, targPos.z);
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_SHOOT_AT_TARGET
-- @usage void SET_VEHICLE_SHOOT_AT_TARGET(Ped driver, Entity entity, float xTarget, float yTarget, float zTarget);
-- @param driver Ped
-- @param entity Entity
-- @param xTarget float
-- @param yTarget float
-- @param zTarget float
-- @return void
function SetVehicleShootAtTarget(driver, entity, xTarget, yTarget, zTarget) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_FORCE_HD_VEHICLE
-- @usage void SET_FORCE_HD_VEHICLE(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetForceHdVehicle(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_PLATE_TYPE
-- @usage int GET_VEHICLE_PLATE_TYPE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehiclePlateType(vehicle) end
-- in script hook .net Vehicle v = ...; Function.Call(Hash.TRACK_VEHICLE_VISIBILITY, v.Handle);
-- @module native
-- @submodule vehicle
-- @see TRACK_VEHICLE_VISIBILITY
-- @usage void TRACK_VEHICLE_VISIBILITY(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return void
function TrackVehicleVisibility(vehicle) end
-- must be called after TRACK_VEHICLE_VISIBILITY it's not instant so probabilly must pass an 'update' to see correct result.
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_VISIBLE
-- @usage BOOL IS_VEHICLE_VISIBLE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleVisible(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_GRAVITY
-- @usage void SET_VEHICLE_GRAVITY(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleGravity(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_ENGINE_CAN_DEGRADE
-- @usage void SET_VEHICLE_ENGINE_CAN_DEGRADE(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleEngineCanDegrade(vehicle, toggle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_STOLEN
-- @usage BOOL IS_VEHICLE_STOLEN(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function IsVehicleStolen(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_IS_STOLEN
-- @usage Any SET_VEHICLE_IS_STOLEN(Vehicle vehicle, BOOL isStolen);
-- @param vehicle Vehicle
-- @param isStolen BOOL
-- @return Any
function SetVehicleIsStolen(vehicle, isStolen) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DETACH_VEHICLE_FROM_CARGOBOB
-- @usage void DETACH_VEHICLE_FROM_CARGOBOB(Vehicle vehicle, Vehicle cargobob);
-- @param vehicle Vehicle
-- @param cargobob Vehicle
-- @return void
function DetachVehicleFromCargobob(vehicle, cargobob) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DETACH_VEHICLE_FROM_ANY_CARGOBOB
-- @usage BOOL DETACH_VEHICLE_FROM_ANY_CARGOBOB(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function DetachVehicleFromAnyCargobob(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see IS_VEHICLE_ATTACHED_TO_CARGOBOB
-- @usage BOOL IS_VEHICLE_ATTACHED_TO_CARGOBOB(Vehicle cargobob, Vehicle vehicleAttached);
-- @param cargobob Vehicle
-- @param vehicleAttached Vehicle
-- @return BOOL
function IsVehicleAttachedToCargobob(cargobob, vehicleAttached) end
-- Returns attached vehicle (Vehicle in parameter must be cargobob)
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_ATTACHED_TO_CARGOBOB
-- @usage Vehicle GET_VEHICLE_ATTACHED_TO_CARGOBOB(Vehicle cargobob);
-- @param cargobob Vehicle
-- @return Vehicle
function GetVehicleAttachedToCargobob(cargobob) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see ATTACH_VEHICLE_TO_CARGOBOB
-- @usage void ATTACH_VEHICLE_TO_CARGOBOB(Vehicle vehicle, Vehicle cargobob, int p2, float x, float y, float z);
-- @param vehicle Vehicle
-- @param cargobob Vehicle
-- @param p2 int
-- @param x float
-- @param y float
-- @param z float
-- @return void
function AttachVehicleToCargobob(vehicle, cargobob, p2, x, y, z) end
-- Returns true only when the hook is active, will return false if the magnet is active
-- @module native
-- @submodule vehicle
-- @see DOES_CARGOBOB_HAVE_PICK_UP_ROPE
-- @usage BOOL DOES_CARGOBOB_HAVE_PICK_UP_ROPE(Vehicle cargobob);
-- @param cargobob Vehicle
-- @return BOOL
function DoesCargobobHavePickUpRope(cargobob) end
-- Drops the Hook/Magnet on a cargobob state enum eCargobobHook { CARGOBOB_HOOK = 0, CARGOBOB_MAGNET = 1, };
-- @module native
-- @submodule vehicle
-- @see CREATE_PICK_UP_ROPE_FOR_CARGOBOB
-- @usage void CREATE_PICK_UP_ROPE_FOR_CARGOBOB(Vehicle cargobob, int state);
-- @param cargobob Vehicle
-- @param state int
-- @return void
function CreatePickUpRopeForCargobob(cargobob, state) end
-- Retracts the hook on the cargobob. Note: after you retract it the natives for dropping the hook no longer work
-- @module native
-- @submodule vehicle
-- @see REMOVE_PICK_UP_ROPE_FOR_CARGOBOB
-- @usage void REMOVE_PICK_UP_ROPE_FOR_CARGOBOB(Vehicle cargobob);
-- @param cargobob Vehicle
-- @return void
function RemovePickUpRopeForCargobob(cargobob) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DOES_VEHICLE_HAVE_WEAPONS
-- @usage BOOL DOES_VEHICLE_HAVE_WEAPONS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return BOOL
function DoesVehicleHaveWeapons(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DISABLE_VEHICLE_WEAPON
-- @usage void DISABLE_VEHICLE_WEAPON(BOOL disabled, Hash weaponHash, Vehicle vehicle, Ped owner);
-- @param disabled BOOL
-- @param weaponHash Hash
-- @param vehicle Vehicle
-- @param owner Ped
-- @return void
function DisableVehicleWeapon(disabled, weaponHash, vehicle, owner) end
-- Returns an int Vehicle Classes: 0: Compacts 1: Sedans 2: SUVs 3: Coupes 4: Muscle 5: Sports Classics 6: Sports 7: Super 8: Motorcycles 9: Off-road 10: Industrial 11: Utility 12: Vans 13: Cycles 14: Boats 15: Helicopters 16: Planes 17: Service 18: Emergency 19: Military 20: Commercial 21: Trains char buffer[128]; std::sprintf(buffer, "VEH_CLASS_%i", VEHICLE::GET_VEHICLE_CLASS(vehicle)); char* className = UI::_GET_LABEL_TEXT(buffer);
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_CLASS
-- @usage int GET_VEHICLE_CLASS(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return int
function GetVehicleClass(vehicle) end
-- For a full enum, see here : pastebin.com/i2GGAjY0 char buffer[128]; std::sprintf(buffer, "VEH_CLASS_%i", VEHICLE::GET_VEHICLE_CLASS_FROM_NAME (hash)); char* className = UI::_GET_LABEL_TEXT(buffer);
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_CLASS_FROM_NAME
-- @usage int GET_VEHICLE_CLASS_FROM_NAME(Hash modelHash);
-- @param modelHash Hash
-- @return int
function GetVehicleClassFromName(modelHash) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_PLAYERS_LAST_VEHICLE
-- @usage Any SET_PLAYERS_LAST_VEHICLE(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return Any
function SetPlayersLastVehicle(vehicle) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_CAN_BE_USED_BY_FLEEING_PEDS
-- @usage void SET_VEHICLE_CAN_BE_USED_BY_FLEEING_PEDS(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleCanBeUsedByFleeingPeds(vehicle, toggle) end
-- Seems to be related to the metal parts, not tyres (like i was expecting lol)
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_FRICTION_OVERRIDE
-- @usage void SET_VEHICLE_FRICTION_OVERRIDE(Vehicle vehicle, float friction);
-- @param vehicle Vehicle
-- @param friction float
-- @return void
function SetVehicleFrictionOverride(vehicle, friction) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_WHEELS_CAN_BREAK_OFF_WHEN_BLOW_UP
-- @usage void SET_VEHICLE_WHEELS_CAN_BREAK_OFF_WHEN_BLOW_UP(Vehicle vehicle, BOOL toggle);
-- @param vehicle Vehicle
-- @param toggle BOOL
-- @return void
function SetVehicleWheelsCanBreakOffWhenBlowUp(vehicle, toggle) end
-- Previously named GET_VEHICLE_DEFORMATION_GET_TREE (hash collision) from Decrypted Scripts I found VEHICLE::SET_VEHICLE_CEILING_HEIGHT(l_BD9[2/*2*/], 420.0);
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_CEILING_HEIGHT
-- @usage void SET_VEHICLE_CEILING_HEIGHT(Vehicle vehicle, float p1);
-- @param vehicle Vehicle
-- @param p1 float
-- @return void
function SetVehicleCeilingHeight(vehicle, p1) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see DOES_VEHICLE_EXIST_WITH_DECORATOR
-- @usage BOOL DOES_VEHICLE_EXIST_WITH_DECORATOR(char* decorator);
-- @param decorator char*
-- @return BOOL
function DoesVehicleExistWithDecorator(decorator) end
-- @todo
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_EXCLUSIVE_DRIVER
-- @usage void SET_VEHICLE_EXCLUSIVE_DRIVER(Vehicle vehicle, BOOL p1);
-- @param vehicle Vehicle
-- @param p1 BOOL
-- @return void
function SetVehicleExclusiveDriver(vehicle, p1) end
-- Seems related to vehicle health, like the one in IV. Max 1000, min 0. Vehicle does not necessarily explode or become undrivable at 0.
-- @module native
-- @submodule vehicle
-- @see GET_VEHICLE_BODY_HEALTH
-- @usage float GET_VEHICLE_BODY_HEALTH(Vehicle vehicle);
-- @param vehicle Vehicle
-- @return float
function GetVehicleBodyHealth(vehicle) end
-- p2 often set to 1000.0 in the decompiled scripts.
-- @module native
-- @submodule vehicle
-- @see SET_VEHICLE_BODY_HEALTH
-- @usage void SET_VEHICLE_BODY_HEALTH(Vehicle vehicle, float value);
-- @param vehicle Vehicle
-- @param value float
-- @return void
function SetVehicleBodyHealth(vehicle, value) end
|
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
local condition = Condition(CONDITION_LIGHT)
condition:setParameter(CONDITION_PARAM_LIGHT_LEVEL, 6)
condition:setParameter(CONDITION_PARAM_LIGHT_COLOR, 215)
condition:setParameter(CONDITION_PARAM_TICKS, (6 * 60 + 10) * 1000)
combat:setCondition(condition)
function onCastSpell(creature, var)
return combat:execute(creature, var)
end
|
local K = unpack(select(2, ...))
local _, ns = ...
local oUF = ns.oUF or K.oUF
local CanDispel = {
DRUID = {Magic = false, Curse = true, Poison = true},
MAGE = {Curse = true},
MONK = {Magic = false, Poison = true, Disease = true},
PALADIN = {Magic = false, Poison = true, Disease = true},
PRIEST = {Magic = false, Disease = true},
SHAMAN = {Magic = false, Curse = true}
}
local dispellist = CanDispel[K.Class] or {}
local origColors = {}
local origBorderColors = {}
local function GetDebuffType(unit, filter)
if not UnitCanAssist("player", unit) then
return nil
end
local i = 1
while true do
local _, texture, _, debufftype = UnitAura(unit, i, "HARMFUL")
if not texture then
break
end
if debufftype and not filter or (filter and dispellist[debufftype]) then
return debufftype, texture
end
i = i + 1
end
end
local function CheckSpec()
local spec = GetSpecialization()
if K.Class == "DRUID" then
if spec == 4 then
dispellist.Magic = true
else
dispellist.Magic = false
end
elseif K.Class == "MONK" then
if spec == 2 then
dispellist.Magic = true
else
dispellist.Magic = false
end
elseif K.Class == "PALADIN" then
if spec == 1 then
dispellist.Magic = true
else
dispellist.Magic = false
end
elseif K.Class == "PRIEST" then
if spec == 3 then
dispellist.Magic = false
else
dispellist.Magic = true
end
elseif K.Class == "SHAMAN" then
if spec == 3 then
dispellist.Magic = true
else
dispellist.Magic = false
end
end
end
local function Update(object, _, unit)
if object.unit ~= unit then
return
end
local debuffType, texture = GetDebuffType(unit, object.DebuffHighlightFilter)
if debuffType then
local color = DebuffTypeColor[debuffType]
if object.DebuffHighlightBackdrop or object.DebuffHighlightBackdropBorder then
if object.DebuffHighlightBackdrop then
object:SetBackdropColor(color.r, color.g, color.b, object.DebuffHighlightAlpha or 1)
end
if object.DebuffHighlightBackdropBorder then
object:SetBackdropBorderColor(color.r, color.g, color.b, object.DebuffHighlightAlpha or 1)
end
elseif object.DebuffHighlightUseTexture then
object.DebuffHighlight:SetTexture(texture)
else
object.DebuffHighlight:SetVertexColor(color.r, color.g, color.b, object.DebuffHighlightAlpha or 0.5)
end
else
if object.DebuffHighlightBackdrop or object.DebuffHighlightBackdropBorder then
local color
if object.DebuffHighlightBackdrop then
color = origColors[object]
object:SetBackdropColor(color.r, color.g, color.b, color.a)
end
if object.DebuffHighlightBackdropBorder then
color = origBorderColors[object]
object:SetBackdropBorderColor(color.r, color.g, color.b, color.a)
end
elseif object.DebuffHighlightUseTexture then
object.DebuffHighlight:SetTexture(nil)
else
local color = origColors[object]
object.DebuffHighlight:SetVertexColor(color.r, color.g, color.b, color.a)
end
end
end
local function Enable(object)
-- If we're not highlighting this unit return
if not object.DebuffHighlightBackdrop and not object.DebuffHighlightBackdropBorder and not object.DebuffHighlight then
return
end
-- If we're filtering highlights and we're not of the dispelling type, return
if object.DebuffHighlightFilter and not CanDispel[K.Class] then
return
end
-- Make sure aura scanning is active for this object
object:RegisterEvent("UNIT_AURA", Update)
object:RegisterEvent("PLAYER_TALENT_UPDATE", CheckSpec, true)
CheckSpec()
if object.DebuffHighlightBackdrop or object.DebuffHighlightBackdropBorder then
local r, g, b, a = object:GetBackdropColor()
origColors[object] = {r = r, g = g, b = b, a = a}
r, g, b, a = object:GetBackdropBorderColor()
origBorderColors[object] = {r = r, g = g, b = b, a = a}
elseif not object.DebuffHighlightUseTexture then
local r, g, b, a = object.DebuffHighlight:GetVertexColor()
origColors[object] = {r = r, g = g, b = b, a = a}
end
return true
end
local function Disable(object)
if object.DebuffHighlightBackdrop or object.DebuffHighlightBackdropBorder or object.DebuffHighlight then
object:UnregisterEvent("UNIT_AURA", Update)
object:UnregisterEvent("PLAYER_TALENT_UPDATE", CheckSpec)
end
end
oUF:AddElement("DebuffHighlight", Update, Enable, Disable)
for _, frame in ipairs(oUF.objects) do
Enable(frame)
end
|
local screenW, screenH = guiGetScreenSize()
local theAnimation = {}
local guiS = {}
guiS[1] = guiCreateGridList(0.35, 0.28, 0.12, 0.39, true)
guiGridListAddColumn(guiS[1], "Category", 0.8)
for k, v in ipairs(getElementsByType("animationCategory")) do
local row = guiGridListAddRow(guiS[1])
guiGridListSetItemText(guiS[1], row, 1, getElementID(v), false, false)
end
guiS[2] = guiCreateGridList(0.48, 0.28, 0.12, 0.39, true)
guiGridListAddColumn(guiS[2], "Animation", 0.8)
guiS[3] = guiCreateButton(0.35, 0.70, 0.26, 0.04, "", true)
guiSetAlpha(guiS[3], 0.00)
function dxAnimations()
dxDrawRectangle(screenW * 0.3484, screenH * 0.1972, screenW * 0.2555, screenH * 0.5542, tocolor(0, 0, 0, 169), false)
dxDrawRectangle(screenW * 0.3508, screenH * 0.1972, screenW * 0.2531, screenH * 0.0694, tocolor(0, 0, 0, 169), false)
dxDrawText("AuroraRPG - Animations", screenW * 0.3469, screenH * 0.1972, screenW * 0.6039, screenH * 0.2667, tocolor(255, 255, 255, 255), 1.80, "default-bold", "center", "center", false, false, false, false, false)
dxDrawRectangle(screenW * 0.3492, screenH * 0.6986, screenW * 0.2547, screenH * 0.0389, tocolor(0, 0, 0, 169), false)
dxDrawText("Stop Animation", screenW * 0.3477, screenH * 0.6986, screenW * 0.6039, screenH * 0.7375, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
end
function toggleGUIs()
local vis = (not guiGetVisible(guiS[1]))
for i, v in ipairs(guiS) do
guiSetVisible(v, vis)
end
return vis
end
toggleGUIs()
function toggleDX()
local s = toggleGUIs()
showCursor(s)
if (s) then
addEventHandler("onClientRender", root, dxAnimations)
else
removeEventHandler("onClientRender", root, dxAnimations)
end
end
function toggleVisible()
if (guiGetVisible(guiS[1]) == false) then
if (isElementFrozen(localPlayer)) then
return false
end
if (getElementDimension(localPlayer) ~= 2000 and getElementDimension(localPlayer) ~= 1000) then
if (not getElementData(localPlayer, "isPlayerInEvent")) then
toggleDX()
end
end
else
toggleDX()
end
end
bindKey("F7", "down", toggleVisible)
function animationsDo()
selectedCategory = guiGridListGetItemText(guiS[1], guiGridListGetSelectedItem(guiS[1]), 1)
if (selectedCategory ~= "") then
guiGridListClear(guiS[2])
for k, v in ipairs(getElementChildren(getElementByID(selectedCategory))) do
local row = guiGridListAddRow(guiS[2])
guiGridListSetItemText(guiS[2], row, 1, getElementID(v), false, false)
end
end
if (selectedCategory == "") then
guiGridListClear(guiS[2])
end
end
addEventHandler("onClientGUIClick", guiS[1], animationsDo, false)
function setAnimations()
selectedAnimation = guiGridListGetItemText(guiS[2], guiGridListGetSelectedItem(guiS[2]), 1)
if (selectedAnimation ~= "") then
if (getElementData(localPlayer, "tazed")) then
exports.NGCdxmsg:createNewDxMessage("You can not use animations now!", 255 ,0, 0)
return false
end
if (getElementData(localPlayer, "isPlayerArrested")) then
exports.NGCdxmsg:createNewDxMessage("You can not use animations now!", 255, 0, 0)
return false
end
if (isPedOnGround(localPlayer)) then
if (not isPedDead(localPlayer)) then
if (not isPedInVehicle(localPlayer)) then
local animationBlock = getElementData(getElementByID(selectedAnimation), "block")
local animationID = getElementData(getElementByID(selectedAnimation), "code")
theAnimation = {animationBlock, animationID}
triggerServerEvent("setAnimation", resourceRoot, animationBlock, animationID)
startMove(false)
else
exports.NGCdxmsg:createNewDxMessage("You cannot use animations while in a vehicle.", 255, 0, 0)
end
else
exports.NGCdxmsg:createNewDxMessage("You cannot use animations while you are dead.", 255, 0, 0)
end
end
end
end
addEventHandler("onClientGUIClick", guiS[2], setAnimations, false)
function onStopAnimation(button)
if (button ~= "left") then
return false
end
if (getElementData(localPlayer, "isPlayerAnimated")) then
setPedAnimation(localPlayer, nil)
setElementData(localPlayer, "isPlayerAnimated", false)
theAnimation = {}
startMove(true)
triggerServerEvent("setAnimationOFF", resourceRoot)
end
end
addEventHandler("onClientGUIClick", guiS[3], onStopAnimation, false)
setTimer(
function()
if (getElementData(localPlayer, "isPlayerInEvent")) then
if (getElementData(localPlayer, "isPlayerAnimated")) then
setPedAnimation(localPlayer, nil)
triggerServerEvent("setAnimationOFF", resourceRoot)
startMove(true)
setElementData(localPlayer, "isPlayerAnimated", false)
end
if (guiGetVisible(guiS[1])) then
toggleDX()
end
end
if (getElementDimension(localPlayer) == 2000 or getElementDimension(localPlayer) == 1000) then
if (getElementData(localPlayer, "isPlayerAnimated")) then
setPedAnimation(localPlayer, nil)
triggerServerEvent("setAnimationOFF", resourceRoot)
startMove(true)
setElementData(localPlayer, "isPlayerAnimated", false)
end
if (guiGetVisible(guiS[1])) then
toggleDX()
end
end
if (getPlayerTeam(localPlayer) and getTeamName(getPlayerTeam(localPlayer)) ~= "CS:GO" and getElementData(localPlayer, "isPlayerAnimated")) then
if (not getPedAnimation(localPlayer)) then
local animationBlock, animationID = unpack(theAnimation)
if (animationBlock) then
startMove(false)
triggerServerEvent("setAnimation", resourceRoot, animationBlock, animationID)
triggerServerEvent("setAnimationOFF", resourceRoot)
end
else
if (getElementData(localPlayer, "isPlayerAnimated")) then
startMove(false)
end
end
end
if (getPlayerTeam(localPlayer) and getTeamName(getPlayerTeam(localPlayer)) == "CS:GO") then
if (getElementData(localPlayer, "isPlayerAnimated")) then
setPedAnimation(localPlayer, nil)
triggerServerEvent("setAnimationOFF", resourceRoot)
setElementData(localPlayer, "isPlayerAnimated", false)
startMove(true)
end
if (guiGetVisible(guiS[1])) then
toggleDX()
end
end
end
, 5000, 0)
function startMove(state)
toggleControl("forwards", state)
toggleControl("backwards", state)
toggleControl("left", state)
toggleControl("right", state)
toggleControl("crouch", state)
toggleControl("enter_exit", state)
toggleControl("aim_weapon", state)
toggleControl("fire", state)
end
|
--[[
Returns the BasePart that the mouse hit.
Works the same as `Player:GetMouse().Hit` but allows you to pass in an ignore list, instead of relying on TargetFilter.
Usage:
local mouseHit = getMouseHit()
-- Or with an ignore list:
local mouseHit = getMouseHit({ LocalPlayer.Character, workspace.Foo})
]]
local t = require(script.Parent.Parent.lib.t)
local getMouseUnitRay = require(script.Parent.getMouseUnitRay)
local getMouseHitCheck = t.optional(t.array(t.Instance))
local function getMouseHit(ignoreList)
assert(getMouseHitCheck(ignoreList))
local unitRay = getMouseUnitRay()
local ray = Ray.new(unitRay.Origin, unitRay.Direction * math.huge)
local hit = workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
return hit
end
return getMouseHit
|
-- farmrect <length> <width>
--
-- Farm a rectangle of the given length and width
--
----------------------------
-- USAGE
----------------------------
-- TODO: positioning
-- o o o w
-- o o o i
-- o o o d
-- o o o t
-- length h
-- buildrect 3 4
--
local tArgs = {...}
local bDebug = false
local selectedSlot=1
local abort = false
local length = 0
local width = 0
local version = "1.0"
-------------------------------------------------------------------------------
-- ARGUMENTS
-------------------------------------------------------------------------------
if (#tArgs == 2) then
length = tonumber(tArgs[1])
width = tonumber(tArgs[2])
else
print("Usage: farmrect <length> <width>")
return
end
-------------------------------------------------------------------------------
-- FUNCTIONS
-------------------------------------------------------------------------------
function setSelectedSlot(slot)
if turtle.select(slot) then
selectedSlot = slot
end
end
function getSelectedSlot()
return selectedSlot
end
-- If fuel level is less than 10, refuel
function fuel()
if turtle.getFuelLevel() < 10 then
local slot = getSelectedSlot()
setSelectedSlot(1)
if turtle.refuel(1) then
print("Refueled!")
else
print("Refuelling failed.")
abort = true
end
setSelectedSlot(slot)
end
end
function getItemsFromChest()
local slot = 2
print("Getting items from chest")
setSelectedSlot(slot)
while turtle.suckDown() and slot <= 16 do
slot = slot + 1
setSelectedSlot(slot)
end
end
function putItemsInChest()
if not turtle.detectDown() then
print("Can't put items in chest! There isn't anything here!")
return
end
print("Putting items in chest")
for slot = 2, 16, 1 do
setSelectedSlot(slot)
turtle.dropDown()
end
end
function plant()
-- try to place a block
if not turtle.placeDown() then
local slot = getSelectedSlot()
-- try to find another suitable slot
for i=slot,16,1 do
setSelectedSlot(i)
if turtle.placeDown() then
break
end
if i == 16 then
abort = true
end
end
end
end
function farm()
if turtle.digDown() then
plant()
turtle.forward()
fuel()
end
end
function goBack()
print("Going back...")
if (width%2) == 0 then
for l = 1, length, 1 do
turtle.back()
end
turtle.turnRight()
else
for l = 1, length, 1 do
turtle.forward()
end
turtle.turnLeft()
end
for w = 1, width, 1 do
turtle.forward()
end
turtle.turnLeft()
end
-------------------------------------------------------------------------------
-- MAIN PROGRAM START
-------------------------------------------------------------------------------
print("farmrect version " .. version .. " starting...")
-- fuel should be placed in slot 1
-- everything else in slots 2-16
setSelectedSlot(2)
-- turtle should be started above a chest facing the first square of farmland
-- get everything out of the chest
getItemsFromChest()
fuel()
turtle.forward()
for w = 1, width, 1 do
print("Width: " .. w .. " of " .. width)
for l = 1, length - 1, 1 do
farm()
if abort == true then
break
end
end
if abort == true then
break
end
-- place start and end blocks
if (w%2) == 0 then
turtle.turnRight()
farm()
turtle.turnRight()
else
turtle.turnLeft()
farm()
turtle.turnLeft()
end
end
goBack()
putItemsInChest()
print("Done!")
|
-- 設定情報(GETで返す値)
return {
get={
version =require "version",
name ="emo",
craftman ="ekicyou",
craftmanw ="どっとステーション駅長",
homeurl ="URL",
["sakura.recommendsites"] ={["NAME1"]="URL1", ["NAME2"]="URL2",},
["sakura.portalsites"] ={["NAME1"]="URL1", ["NAME2"]="URL2",},
["recommendrootbutton.caption"] ="メニュー名称",
["portalrootbutton.caption"] ="メニュー名称",
["updatebutton.caption"] ="オンラインアップデート(&U)",
["readmebutton.caption"] ="readme.txtの表示(&R)",
["vanishbutton.visible"] ="1",
["vanishbutton.caption"] ="アンインストール(&F)",
},
}
|
return {
listeners = {
playerEnter = function(state)
return function(self, player)
local questRef = "limbo:selfdefense101";
if state.QuestFactory:canStart(player, questRef) then
local quest = state.QuestFactory:create(state, questRef, player)
player.questTracker:start(quest)
end
end
end,
},
};
|
-- liquid_stairs/init.lua
-- Load support for Minebase translation.
local S = minetest.get_translator("liquid_stairs")
stairs.register_all("liquid_stairs:obsidian", {
material = "base_liquids:obsidian",
groups = {cracky = 1, level = 2},
tiles = {"base_liquids_obsidian.png"},
stair_description = S("Obsidian Stair"),
slab_description = S("Obsidian Slab"),
inner_stair_description = S("Inner Obsidian Stair"),
outer_stair_description = S("Outer Obsidian Stair"),
step_description = S("Obsidian Step"),
inner_step_description = S("Inner Obsidian Step"),
outer_step_description = S("Outer Obsidian Step"),
steps_description = S("Obsidian Steps"),
steps_half_description = S("Obsidian Steps Half"),
steps_slab_description = S("Obsidian Steps Slab"),
sounds = sounds.get_defaults("earth_sounds:stone"),
worldaligntex = true
})
stairs.register_all("liquid_stairs:obsidian_brick", {
material = "base_liquids:obsidian_brick",
groups = {cracky = 1, level = 2},
tiles = {"base_liquids_obsidian_brick.png"},
stair_description = S("Obsidian Brick Stair"),
slab_description = S("Obsidian Brick Slab"),
inner_stair_description = S("Inner Obsidian Brick Stair"),
outer_stair_description = S("Outer Obsidian Brick Stair"),
step_description = S("Obsidian Brick Step"),
inner_step_description = S("Inner Obsidian Brick Step"),
outer_step_description = S("Outer Obsidian Brick Step"),
steps_description = S("Obsidian Brick Steps"),
steps_half_description = S("Obsidian Brick Steps Half"),
steps_slab_description = S("Obsidian Brick Steps Slab"),
sounds = sounds.get_defaults("earth_sounds:stone"),
worldaligntex = false
})
stairs.register_all("liquid_stairs:obsidian_block", {
material = "base_liquids:obsidian_block",
groups = {cracky = 1, level = 2},
tiles = {"base_liquids_obsidian_block.png"},
stair_description = S("Obsidian Block Stair"),
slab_description = S("Obsidian Block Slab"),
inner_stair_description = S("Inner Obsidian Block Stair"),
outer_stair_description = S("Outer Obsidian Block Stair"),
step_description = S("Obsidian Block Step"),
inner_step_description = S("Inner Obsidian Block Step"),
outer_step_description = S("Outer Obsidian Block Step"),
steps_description = S("Obsidian Block Steps"),
steps_half_description = S("Obsidian Block Steps Half"),
steps_slab_description = S("Obsidian Block Steps Slab"),
sounds = sounds.get_defaults("earth_sounds:stone"),
worldaligntex = true
})
stairs.register_all("liquid_stairs:ice", {
material = "base_liquids:ice",
groups = {cracky = 3, cools_lava = 1, slippery = 3},
tiles = {"base_liquids_ice.png"},
stair_description = S("Ice Stair"),
slab_description = S("Ice Slab"),
inner_stair_description = S("Inner Ice Stair"),
outer_stair_description = S("Outer Ice Stair"),
step_description = S("Ice Step"),
inner_step_description = S("Inner Ice Step"),
outer_step_description = S("Outer Ice Step"),
steps_description = S("Ice Steps"),
steps_half_description = S("Ice Steps Half"),
steps_slab_description = S("Ice Steps Slab"),
sounds = sounds.get_defaults("liquid_sounds:ice"),
worldaligntex = true
})
stairs.register_all("liquid_stairs:snowblock", {
material = "base_liquids:snowblock",
groups = {crumbly = 3, cools_lava = 1, snowy = 1},
tiles = {"base_liquids_snow.png"},
stair_description = S("Snow Block Stair"),
slab_description = S("Snow Block Slab"),
inner_stair_description = S("Inner Snow Block Stair"),
outer_stair_description = S("Outer Snow Block Stair"),
step_description = S("Snow Block Step"),
inner_step_description = S("Inner Snow Block Step"),
outer_step_description = S("Outer Snow Block Step"),
steps_description = S("Snow Block Steps"),
steps_half_description = S("Snow Block Steps Half"),
steps_slab_description = S("Snow Block Steps Slab"),
sounds = sounds.get_defaults("liquid_sounds:snow"),
worldaligntex = true
})
|
--
-- Created by PhpStorm.
-- User: Wu Lihua <maikekechn@gmail.com>
-- Time: 2017/1/7 下午2:19
--
--[[
--限速返回1 否则返回0
--]]
local frequency = redis.call("INCR", KEYS[1])
if frequency > tonumber(ARGV[1])
then
return 1
end
if frequency == 1
then
redis.call("PEXPIRE", KEYS[1], ARGV[2])
end
return 0
|
--[[
© 2020 TERRANOVA do not share, re-distribute or modify
without permission of its author (zacharyenriquee@gmail.com).
--]]
ix.command.Add("GetFlags", {
description = "Returns a character's flags.",
adminOnly = true,
arguments = {
ix.type.character
},
OnRun = function(self, client, target)
local flags = target:GetFlags()
if(flags == "") then
client:Notify(string.format("%s has no flags.", target:GetName()))
else
client:Notify(string.format("%s has the following flags: %s", target:GetName(), flags))
end
end;
})
|
return {'sexagesima','sexappeal','sextakkoord','sextant','sextet','sexy','sexyer','sextakkoorden','sextanten','sextetten','sexyst'}
|
object_tangible_tcg_series6_combine_object_hk_droids_poster = object_tangible_tcg_series6_shared_combine_object_hk_droids_poster:new {
}
ObjectTemplates:addTemplate(object_tangible_tcg_series6_combine_object_hk_droids_poster, "object/tangible/tcg/series6/combine_object_hk_droids_poster.iff")
|
object_draft_schematic_dance_prop_prop_ribbon_spark_r_s02 = object_draft_schematic_dance_prop_shared_prop_ribbon_spark_r_s02:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_dance_prop_prop_ribbon_spark_r_s02, "object/draft_schematic/dance_prop/prop_ribbon_spark_r_s02.iff")
|
--- "Ramsus" ---
local isUiOpen = false
local speedBuffer = {}
local velBuffer = {}
local SeatbeltON = false
local InVehicle = true
function Notify(string)
SetNotificationTextEntry("STRING")
AddTextComponentString(string)
DrawNotification(false, true)
end
AddEventHandler('seatbelt:sounds', function(soundFile, soundVolume)
SendNUIMessage({
transactionType = 'playSound',
transactionFile = soundFile,
transactionVolume = soundVolume
})
end)
function IsCar(veh)
local vc = GetVehicleClass(veh)
return (vc >= 0 and vc <= 7) or (vc >= 9 and vc <= 12) or (vc >= 17 and vc <= 20)
end
function Fwv(entity)
local hr = GetEntityHeading(entity) + 90.0
if hr < 0.0 then hr = 360.0 + hr end
hr = hr * 0.0174533
return { x = math.cos(hr) * 2.0, y = math.sin(hr) * 2.0 }
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = PlayerPedId()
local car = GetVehiclePedIsIn(ped)
if car ~= 0 and (InVehicle or IsCar(car)) then
InVehicle = true
if isUiOpen == false and not IsPlayerDead(PlayerId()) then
if Config.Blinker then
SendNUIMessage({displayWindow = 'true'})
end
isUiOpen = true
end
if SeatbeltON then
DisableControlAction(0, 75, true) -- Disable exit vehicle when stop
DisableControlAction(27, 75, true) -- Disable exit vehicle when Driving
end
speedBuffer[2] = speedBuffer[1]
speedBuffer[1] = GetEntitySpeed(car)
if not SeatbeltON and speedBuffer[2] ~= nil and GetEntitySpeedVector(car, true).y > 1.0 and speedBuffer[1] > (Config.Speed / 3.6) and (speedBuffer[2] - speedBuffer[1]) > (speedBuffer[1] * 0.255) then
local co = GetEntityCoords(ped)
local fw = Fwv(ped)
SetEntityCoords(ped, co.x + fw.x, co.y + fw.y, co.z - 0.47, true, true, true)
SetEntityVelocity(ped, velBuffer[2].x, velBuffer[2].y, velBuffer[2].z)
Citizen.Wait(1)
SetPedToRagdoll(ped, 1000, 1000, 0, 0, 0, 0)
end
velBuffer[2] = velBuffer[1]
velBuffer[1] = GetEntityVelocity(car)
if IsControlJustReleased(0, Config.Control) and GetLastInputMethod(0) then
SeatbeltON = not SeatbeltON
if SeatbeltON then
Citizen.Wait(1)
if Config.Sounds then
TriggerEvent("seatbelt:sounds", "buckle", Config.Volume)
end
if Config.Notification then
Notify(Config.Strings.seatbelt_on)
end
if Config.Blinker then
SendNUIMessage({displayWindow = 'false'})
end
isUiOpen = true
else
if Config.Notification then
Notify(Config.Strings.seatbelt_off)
end
if Config.Sounds then
TriggerEvent("seatbelt:sounds", "unbuckle", Config.Volume)
end
if Config.Blinker then
SendNUIMessage({displayWindow = 'true'})
end
isUiOpen = true
end
end
elseif InVehicle then
InVehicle = false
SeatbeltON = false
speedBuffer[1], speedBuffer[2] = 0.0, 0.0
if isUiOpen == true and not IsPlayerDead(PlayerId()) then
if Config.Blinker then
SendNUIMessage({displayWindow = 'false'})
end
isUiOpen = false
end
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
local Vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
local VehSpeed = GetEntitySpeed(Vehicle) * 3.6
if Config.AlarmOnlySpeed and VehSpeed > Config.AlarmSpeed then
ShowWindow = true
else
ShowWindow = false
SendNUIMessage({displayWindow = 'false'})
end
if IsPlayerDead(PlayerId()) or IsPauseMenuActive() then
if isUiOpen == true then
SendNUIMessage({displayWindow = 'false'})
end
elseif not SeatbeltON and InVehicle and not IsPauseMenuActive() and not IsPlayerDead(PlayerId()) and Config.Blinker then
if Config.AlarmOnlySpeed and ShowWindow and VehSpeed > Config.AlarmSpeed then
SendNUIMessage({displayWindow = 'true'})
end
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(3500)
if not SeatbeltON and InVehicle and not IsPauseMenuActive() and Config.LoopSound and ShowWindow then
TriggerEvent("seatbelt:sounds", "seatbelt", Config.Volume)
end
end
end)
|
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:26' using the latest game version.
NOTE: This file should only be used as IDE support; it should NOT be distributed with addons!
****************************************************************************
CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC.
****************************************************************************
]]
ZO_GUILD_FINDER_KEYBOARD_OPTIONS_TREE_WIDTH = 240
ZO_GUILD_FINDER_KEYBOARD_OPTIONS_TREE_LABEL_WIDTH = ZO_GUILD_FINDER_KEYBOARD_OPTIONS_TREE_WIDTH - 64
ZO_GuildFinder_Keyboard_Base = ZO_Object:Subclass()
function ZO_GuildFinder_Keyboard_Base:New(...)
local object = ZO_Object.New(self)
object:Initialize(...)
return object
end
function ZO_GuildFinder_Keyboard_Base:Initialize(control)
self.hasDeferredInitialized = false
self.listContainer = control:GetNamedChild("List")
self.categoryTree = ZO_Tree:New(self.listContainer, 60, -10, ZO_GUILD_FINDER_KEYBOARD_OPTIONS_TREE_WIDTH)
self.iconChildlessHeaderTemplateName = self.iconChildlessHeaderTemplateName or "ZO_IconChildlessHeader"
local function SetupControlIcon(control, categoryInfo, open)
control.icon:SetTexture(open and categoryInfo.down or categoryInfo.up)
control.iconHighlight:SetTexture(categoryInfo.over)
ZO_IconHeader_Setup(control, open)
end
local function TreeHeaderSetup_Childless(node, control, categoryInfo, open)
control.text:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
control.text:SetText(categoryInfo.name)
SetupControlIcon(control, categoryInfo, open)
end
local function TreeHeaderSelected_Childless(control, categoryInfo, selected, reselectingDuringRebuild)
SetupControlIcon(control, categoryInfo, selected)
if selected then
self:SetSelectedCategory(categoryInfo)
end
end
local function TreeHeaderSetup_Child(node, control, data, open, userRequested)
control.text:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
control.text:SetText(data.name)
SetupControlIcon(control, data, open)
if open and userRequested then
self.categoryTree:SelectFirstChild(node)
end
end
self.onSetupChildHeader = self.onSetupChildHeader or TreeHeaderSetup_Child
local function TreeEntryOnSelected(control, data, selected, reselectingDuringRebuild)
control:SetSelected(selected)
if selected and not reselectingDuringRebuild then
self:SetSelectedCategory(data.data, data.subCategoryData.value)
end
end
local function TreeEntrySetup(node, control, data, open)
control:SetSelected(false)
control:SetText(data.subCategoryData.name)
end
local NO_EQUALITY_FUNCTION = nil
local NO_SELECTION_FUNCTION = nil
local DEFAULT_CHILD_INDENT = nil
local CHILD_INDENT = 60
local CHILD_SPACING = 0
self.categoryTree:AddTemplate(self.iconChildlessHeaderTemplateName, TreeHeaderSetup_Childless, TreeHeaderSelected_Childless, NO_EQUALITY_FUNCTION, DEFAULT_CHILD_INDENT, CHILD_SPACING)
self.categoryTree:AddTemplate("ZO_GuildFinder_IconHeader", self.onSetupChildHeader, NO_SELECTION_FUNCTION, NO_EQUALITY_FUNCTION, CHILD_INDENT, CHILD_SPACING)
self.categoryTree:AddTemplate("ZO_GuildFinder_Tree_SubCategory", TreeEntrySetup, TreeEntryOnSelected)
end
function ZO_GuildFinder_Keyboard_Base:SetupData(categoryData)
self.categoryTree:Reset()
self.categoryData = categoryData
self.nodeLookupTable = {}
for i, data in ipairs(categoryData) do
local visible = data.visible or true
if type(data.visible) == "function" then
visible = data.visible(self)
end
if visible then
if data.subCategories then
local parentNode = self.categoryTree:AddNode("ZO_GuildFinder_IconHeader", data)
local nodeLookupData = { node = parentNode }
table.insert(self.nodeLookupTable, nodeLookupData)
for j, subCategoryData in ipairs(data.subCategories) do
local node = self.categoryTree:AddNode("ZO_GuildFinder_Tree_SubCategory", { data = data, subCategoryData = subCategoryData }, parentNode)
if not nodeLookupData.subCategories then
nodeLookupData.subCategories = {}
end
table.insert(nodeLookupData.subCategories, node)
end
else
local node = self.categoryTree:AddNode(self.iconChildlessHeaderTemplateName, data)
local nodeLookupData = { node = node }
table.insert(self.nodeLookupTable, nodeLookupData)
end
end
end
self.categoryTree:SetExclusive(true)
self.categoryTree:SetOpenAnimation("ZO_TreeOpenAnimation")
self.categoryTree:Commit()
end
function ZO_GuildFinder_Keyboard_Base:IsSceneShown()
assert(false) -- must be overridden
end
function ZO_GuildFinder_Keyboard_Base:SetSelectedCategory(newCategory, newValue)
if self.selectedCategory ~= newCategory then
self.subcategoryValue = nil
self:HideSelectedCategory()
self.selectedCategory = newCategory
self:ShowSelectedCategory()
end
if self.subcategoryValue ~= newValue then
self.subcategoryValue = newValue
if self.hasDeferredInitialized then -- managers are not set until deferred initialize
self.selectedCategory.manager:SetSubcategoryValue(newValue)
end
end
end
function ZO_GuildFinder_Keyboard_Base:HideSelectedCategory()
if self:IsSceneShown() then
local manager = self.selectedCategory.manager
manager:HideCategory()
end
end
function ZO_GuildFinder_Keyboard_Base:ShowSelectedCategory()
if self:IsSceneShown() then
local manager = self.selectedCategory.manager
if self.subcategoryValue then
manager:SetSubcategoryValue(self.subcategoryValue)
end
manager:ShowCategory()
end
end
|
local ItemMenuScene = class("ItemMenuScene", Scene)
local ItemMenuController = require("scenes.world.menu.ItemMenuController")
function ItemMenuScene:initialize()
Scene.initialize(self)
self:add(ItemMenuController())
end
return ItemMenuScene
|
local KarmaLoot, ns = ...
-- Splits strings lol
function ns.strSplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t = {}
for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
table.insert(t, str)
end
return t
end
function ns.canOpenRolls()
local result = ns.getRaidRankStuff(UnitName("Player"))
if result then
result = ns.strSplit(result,",")
if result[2] == "true" then
return true
else
return false
end
end
end
-- Returns whether a player is raid lead, assistant, and master looter
function ns.getRaidRankStuff(name)
for i = 1, GetNumGroupMembers(), 1 do
local member, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i)
if member == name then
return rank .. "," .. tostring(isML)
end
end
end
-- Get class color from name and return the hex code to change the color of said name.
function ns.prependClassColor(playerName)
if playerName then
local playerClass = UnitClass(playerName)
local classColor = "|cff" .. classColors[playerClass:lower()].hex .. playerName .. "|r"
return classColor
end
end
|
local io = require('io')
local yaml = require('lyaml')
local gears = require('gears')
local config = {}
local settings = {}
local configFile = io.open(gears.filesystem.get_configuration_dir() .. '/configs/config.yml', 'r')
if configFile then
local configYaml = configFile:read('*all')
configFile:close()
settings = yaml.load(configYaml)
end
function config.get(key, default)
local level = settings
for i,k in pairs(gears.string.split(key, '[.]')) do
if not level then return default end
level = level[k]
end
return level or default
end
config.MOD = 'Mod4'
return config
|
local Class = require("lib.Class")
local Vector2 = require("lib.Vector2")
local T = Class:derive("Transform")
function T:new(x, y, sx, sy, angle, vx, vy, yoffset)
self.x = x or 0
self.y = y or 0
self.sx = sx or 1
self.sy = sy or 1
self.angle = angle or 0
-- added some velocity
self.vx = vx or 0
self.vy = vy or 0
self.enabled = true
self.started = true
self.y_draw_offset = yoffset or 0
end
function T:VectorPos() return Vector2(self.x, self.y) end
return T
|
--A宝玉獣 サファイア・ペガサス
--
--Script by Trishula9
function c100290016.initial_effect(c)
Duel.EnableGlobalFlag(GLOBALFLAG_SELF_TOGRAVE)
--self to grave
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SELF_TOGRAVE)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCondition(c100290016.tgcon)
c:RegisterEffect(e1)
--send replace
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TO_GRAVE_REDIRECT_CB)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetCondition(c100290016.repcon)
e2:SetOperation(c100290016.repop)
c:RegisterEffect(e2)
--place
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetTarget(c100290016.target)
e3:SetOperation(c100290016.operation)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e4)
local e5=e3:Clone()
e5:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e5)
end
function c100290016.tgcon(e)
return not Duel.IsEnvironment(12644061)
end
function c100290016.repcon(e)
local c=e:GetHandler()
return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsReason(REASON_DESTROY)
end
function c100290016.repop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
c:RegisterEffect(e1)
end
function c100290016.filter(c)
return c:IsSetCard(0x5034) and c:IsType(TYPE_MONSTER) and not c:IsForbidden()
and (not c:IsLocation(LOCATION_REMOVED) or c:IsFaceup())
end
function c100290016.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsLocation(LOCATION_MZONE) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(c100290016.filter,tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_HAND+LOCATION_REMOVED,0,1,nil) end
end
function c100290016.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c100290016.filter),tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_HAND+LOCATION_REMOVED,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET)
e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
end
end
|
vim.api.nvim_create_autocmd("CursorHold", {
pattern = "*",
callback = function()
vim.diagnostic.open_float(nil, { source = "always", focus = false })
end,
desc = "Open diagnostics",
})
vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter" }, {
pattern = "*",
callback = function()
vim.cmd([[silent! :checktime]])
end,
desc = "Sync file changes",
})
vim.api.nvim_create_autocmd({ "TextChanged", "FocusLost", "BufEnter", "InsertLeave" }, {
pattern = "*",
callback = function()
vim.cmd([[silent! :update]])
end,
desc = "Autosave",
})
vim.api.nvim_create_autocmd("TextYankPost", {
pattern = "*",
callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 300, on_visual = true, on_macro = true })
end,
desc = "Highlight yanked text",
})
|
function div(a, b) return math.floor(a/b) end
for line in io.lines(arg[1]) do
local v, z, w, h = line:match("Vampires: (%d+), Zombies: (%d+), Witches: (%d+), Houses: (%d+)")
print(v + z + w == 0 and 0 or div((v * 3 + z * 4 + w * 5) * h, v + z + w))
end
|
NativeEvent.callNativeEvent = function(self , keyParm , data)
if data then
dict_set_string(keyParm,keyParm..kparmPostfix,data);
end
dict_set_string(NativeEvent.s_luaCallEvent,NativeEvent.s_luaCallEvent,keyParm);
call_native(NativeEvent.s_luaCallNavite);
end
NativeEvent.getWriteLogPath = function(self)
end
NativeEvent.setFPS = function(self, fps)
end
NativeEvent.IosPayResultCallback = function (self,orderId)
end
NativeEvent.checkUnfinishIAP = function (self,orderId)
end
NativeEvent.Exit = function(self)
end
NativeEvent.StartSystemTimer = function(self,id,time)
end
NativeEvent.StopSystemTimer = function(self,id)
end
NativeEvent.getVersion = function(self,httpUrl,savePath,timeout)
EventDispatcher.getInstance():dispatch(Event.Call,"getVersion",false);
end
NativeEvent.getUpdate = function(self,httpUrl,savePath,timeout)
EventDispatcher.getInstance():dispatch(Event.Call,"getUpdate",false);
end
NativeEvent.showDownloadFileDialog = function(self, str)
end
NativeEvent.closeDownloadFileDialog = function(self)
end
NativeEvent.GuestLogin = function(self)
end
NativeEvent.getMachineId = function(self)
end
NativeEvent.getDeviceId = function(self)
end
NativeEvent.sendSmsByRegister = function(self)
end
NativeEvent.openBrowser = function(self)
end
NativeEvent.sendSmsByGetNewPW = function(self)
end
NativeEvent.openSmsEdit = function(self, data)
end
NativeEvent.openNetSettings = function(self)
end
NativeEvent.CloseStartScreen = function(self)
end
NativeEvent.getPhoneInfo = function(self)
end
NativeEvent.StartMobilePay = function(self)
end
NativeEvent.StartHuaJianPay = function(self)
end
NativeEvent.StartWoPay = function(self)
end
NativeEvent.StartTelecomPay = function(self)
end
NativeEvent.StartAlixPay = function(self)
end
NativeEvent.StartUnionPay = function(self)
end
NativeEvent.StartYiBaoPay = function(self)
end
NativeEvent.StartMMbillingPay = function(self)
end
NativeEvent.openIosWebPay = function (self,data)
-- body
end
NativeEvent.closeIosWebPay = function (self)
-- body
end
NativeEvent.backIosWebPay = function (self)
-- body
end
NativeEvent.StartQianChiPay = function(self)
end
NativeEvent.StartHuaFuBaoPay = function(self)
end
NativeEvent.DeviceShake = function(self)
end
NativeEvent.chooseImage = function(self, data)
end
NativeEvent.uploadFeedbackImage = function(self, data)
end
NativeEvent.UploadHeadImage = function(self,data)
end
NativeEvent.sendFeedbackInfo = function ( self,data)
end
NativeEvent.openFeedback = function ( self )
end
NativeEvent.notifygetFeedback = function ( self,data )
end
NativeEvent.openHelp = function ( self )
end
NativeEvent.openSecrecy = function ( self,data )
end
NativeEvent.closeSecrecy = function ( self )
end
NativeEvent.sendFeedbackResult = function ( self , data )
end
NativeEvent.getFeedbackListResult = function ( self , data)
end
NativeEvent.closeTicketResult = function ( self , data)
end
-- Umeng调用onEvent统计事件,事件ID需要先在Umeng控制台配置
NativeEvent.umengEvent = function(self, eventId)
end
--检测是否有网络,返回json格式
NativeEvent.GetNetworkAvailability = function(self)
end
--活动网络是否有效,返回json格式
NativeEvent.GetNetworkActivity = function(self)
end
NativeEvent.downloadFile = function(self, loadUrl , savaPath)
end
NativeEvent.preloadSound = function(self)
end
--友盟错误上报
NativeEvent.umengError = function(self, errType , errContext)
end
--获取电量
NativeEvent.getBatteryLevel = function(self)
end
NativeEvent.getSignalStrength = function(self)
end
NativeEvent.getMemory = function(self)
end
NativeEvent.getNetworkType = function(self)
end
NativeEvent.uploadLogFile = function(self,json_data)
end
NativeEvent.NewWebView = function(rect)
end
NativeEvent.SetWebViewUrl = function(handle, url)
end
NativeEvent.GoBackWebView = function(self, handle)
end
NativeEvent.DelView = function(self, handle)
end
NativeEvent.ShowEmbedWebView = function ( self )
end
NativeEvent.HideEmbedWebView = function ( self )
end
NativeEvent.hideWebView = function(self, handle)
end
NativeEvent.autoDial = function(self,json_data)
end
NativeEvent.autoSelectDial = function(self,json_data)
end
NativeEvent.getContacts = function(self)
end
NativeEvent.updateAPK = function ( self, download_path, save_path )
end
NativeEvent.installApk = function (self , apk_path)
end
NativeEvent.ShowLoadingScene = function(self,msg)
end
NativeEvent.HideLoadingScene = function(self)
end
NativeEvent.ShowLoadingDialog = function(self,msg,displayTime)
LoadingView.setDefaultDisplayTime(displayTime);
LoadingView.getInstance():showText(msg);
end
NativeEvent.HideLoadingDialog = function(self)
LoadingView.getInstance():hidden();
end
NativeEvent.ShowToast = function(self,msg,long)
end
--解压新游戏
NativeEvent.unzipNewGames = function(self,msg,long)
end
--SD卡是否可用
NativeEvent.isSDCardAvailable = function(self)
return true;
end
NativeEvent.openWebPage = function(self,json_data)
end
NativeEvent.startTongYiPay = function(self,json_data,userId)
end
NativeEvent.isCanReadFile = function(self,filePath)
end
NativeEvent.isCanWriteFile = function(self,filePath)
end
NativeEvent.isWXAppSupportPaymentForLua = function(self)
end
NativeEvent.openWeiXin = function(self)
end
NativeEvent.weixinCheckSupportSendToFriendsCirCleForLua = function(self)
end
NativeEvent.weixinSendText = function(self, text, isSendToFriendsCircle)
end
NativeEvent.weixinTakeScreenShotAndSendImage = function(self, isSendToFriendsCircle)
end
NativeEvent.weixinSendImage = function(self, imagePath, isSendToFriendsCircle)
end
--微信合成图片然后再进行分享
NativeEvent.weixinMergeAndSendImage = function(self, imageBgPath, tilesets, isSendToFriendsCircle)
end
NativeEvent.weixinSendWebPage = function(self, url, title, desc,headPath,isSendToFriendsCircle)
end
NativeEvent.weixinTakeScreenShotAndSendWebPage = function(self, url, title, desc, isSendToFriendsCircle)
end
NativeEvent.takeScreenShotAndSaveToLocal = function(self, title)
end
NativeEvent.saveImageToPhotoAlbum = function(self, imagePath)
end
NativeEvent.openQQ = function(self)
end
--QQ分享 图文分享
NativeEvent.qqShareWebPage = function(self, targetUrl, title, desc, imageUrl, isSendToFriendsCircle)
end
NativeEvent.CloseRoomPopu = function(self)
end
NativeEvent.ShowRoomFanHelp = function(self)
end
NativeEvent.StartOSTimeoutClock = function(self, isSocketOpen)
end
NativeEvent.RemoveTimeoutClock = function(self)
end
--短信监听
NativeEvent.registerSmsObserver = function(self)
end
--取消短信监听
NativeEvent.unRegisterSmsObserver = function(self)
end
NativeEvent.getNetWorkTypeForLua = function(self)
end
NativeEvent.getNetWorkAvalible = function(self)
return true;
end
NativeEvent.checkJsonValid = function(self)
return 1;
end
NativeEvent.setGameUpdateInfo = function(self, gameUpdateInfo)
end
-------------------------------GodSDK相关-------------------------
-- 请求登录
NativeEvent.requestGodSDKLogin = function(self)
end
-- 请求GodSDK的支付
NativeEvent.requestGodSDKPay = function(self)
end
-- 同步判断GodSDKAccount是否支持切换账号
NativeEvent.isGodSDKSupportSwitchAccount = function(self)
end
-- 请求切换账号
NativeEvent.requestGodSDKSwitchAccount = function(self)
end
-- 同步判断GodSDKAccount是否支持退出
NativeEvent.isGodSDKSupportQuit = function(self)
end
-- 请求GodSDK的退出
NativeEvent.requestGodSDKQuit = function(self)
end
NativeEvent.callSpecialMethod = function(self)
end
NativeEvent.getGeTuiToken = function(self)
end
-- 获取metaData
NativeEvent.getMetaData = function(self)
return kTestUmeng;
end;
NativeEvent.createDirectory = function(self,path)
path = path or "";
path = string.gsub(path, '/', '\\');
os.execute(" if not exist "..path.." mkdir "..path);
end
NativeEvent.deleteDirectory = function(self,path)
path = path or "";
path = string.gsub(path, '/', '\\');
os.execute("del /s/q "..path);
os.execute("rd /s/q "..path);
end
NativeEvent.clearDirectory = function(self,path)
path = path or "";
path = string.gsub(path, '/', '\\');
os.execute("del /s/q "..path);
os.execute("rd /s/q "..path);
os.execute("mkdir "..path);
end
-----------------------------videosdk相关-----------------------------
NativeEvent.videoLogin = function(self)
end
NativeEvent.videoLogout = function(self)
end
NativeEvent.videoOpenMicrophone = function(self)
end
NativeEvent.videoCloseMicrophone = function(self)
end
-----------------------------imsdk相关-----------------------------
NativeEvent.imGetCurrentLocation = function(self)
end
NativeEvent.imGetContractsInfo = function(self)
end
NativeEvent.imStopAudioRecord = function(self)
end
NativeEvent.imStartAudioRecord = function(self)
end
NativeEvent.imStartAudioPlay = function(self)
end
NativeEvent.imStopAudioPlay = function(self)
end
NativeEvent.imGetGotoGps = function(self)
end
NativeEvent.clipboardSetText = function(self, text)
end
NativeEvent.clipboardGetText = function(self)
end
NativeEvent.clipboardClean = function(self)
end
NativeEvent.openSms = function(self, text)
end
------------------------二维码扫描--------------------
NativeEvent.createQR = function(self, str)
end
NativeEvent.scanQR = function(self)
end
NativeEvent.changeScreenOrientation = function(self, state)
end
NativeEvent.getCurScreenOrientation = function(self)
end
NativeEvent.getWifiState = function(self)
return 1;
end
NativeEvent.enterServiceChat = function(self, tab)
end
NativeEvent.getCallAppParam = function(self)
return "";
end
|
local utils = require('util')
local fs = require('fs')
local path = require('path')
local assert = require('assert')
local tap = require('util/tap')
local lmedia = require("lmedia")
local lreader = require("lmedia.ts.reader")
local basePath = utils.dirname()
local test = tap.test
-- 这个测试将从 TS 流中分离出单纯的 ES 流
test('test_hls_reader', function()
local filename = path.join(basePath, '../../app/camera/examples/hd.ts')
local fileData = fs.readFileSync(filename)
print('source ts file: ' .. filename)
print('source ts file length: ' .. #fileData)
local fileSize = #fileData
local list = {}
local sample = {}
local sampleSize = 0
local audioSize = 0
local lastTime = 0
console.log(lreader)
local output = {}
local adts = {}
local reader = nil
reader = lreader.open(function(sampleData, sampleTime, flags)
if ((flags & lreader.FLAG_IS_AUDIO) ~= 0) then
table.insert(adts, sampleData)
return
end
table.insert(output, sampleData)
--print('flags', flags)
sampleSize = sampleSize + #sampleData
if (flags & lreader.FLAG_IS_SYNC) ~= 0 then
lastTime = sampleTime
if (sampleSize > 0) then
list[#list + 1] = sampleSize
console.log('sample', lastTime, sampleSize)
end
sampleSize = 0
end
--console.log(sampleTime, flags)
--console.printBuffer(sampleData)
end)
local offset = 1
local chunkSize = 1024
while (true) do
local packet = fileData:sub(offset, offset + chunkSize - 1)
if (not packet) then
break
end
reader:read(packet, 0)
offset = offset + chunkSize
if (offset > fileSize) then
break
end
end
reader:close()
local data = table.concat(output)
local filename = path.join(basePath, '../build/output1.h264')
fs.writeFileSync(filename, data)
print('output es file: ' .. filename)
print('output es file length: ' .. #data)
local data = table.concat(adts)
local filename = path.join(basePath, '../build/output1.aac')
fs.writeFileSync(filename, data)
print('output es file: ' .. filename)
print('output es file length: ' .. #data)
end)
tap.run()
|
require 'rockspec'
package('wonderland','1.0')
Lua.module.wonderland.alice()
Lua.module.wonderland.caterpillar()
rockspec.write()
|
----------------------------------------------------------------------------------------------
-- -- -- PATHS
----------------------------------------------------------------------------------------------
-- -- GENERIC PATHS
path_mod = "__water-belts__/"
-- Libraries
path_public_lib = path_mod .. "lib/public/"
path_private_lib = path_mod .. "lib/private/"
----------------------------------------------------------------------------------------------
-- -- PROTOTYPES PATHS
path_prototypes = path_mod .. "prototypes/"
----------------------------------------------------------------------------------------------
-- -- COMPATIBILITY SCRIPTS PATHS
----------------------------------------------------------------------------------------------
path_compatibility_scripts = path_mod .. "compatibility/"
|
--Cat Rain
function c600019.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c600019.condition)
e1:SetTarget(c600019.sptg)
e1:SetOperation(c600019.sumop)
c:RegisterEffect(e1)
end
function c600019.cfilter(c,tp)
return c:IsReason(REASON_BATTLE) and c:IsLocation(LOCATION_GRAVE) and c:GetPreviousControler()==tp and (c:IsSetCard(0x1538) or c:IsSetCard(0x150e))
end
function c600019.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c600019.cfilter,1,nil,tp)
end
function c600019.filter2(c,e,tp)
return (c:IsSetCard(0x1538) or c:IsSetCard(0x150e)) and c:IsType(TYPE_MONSTER) and c:IsLevelBelow(4)--c:GetCode()==100000171
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c600019.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c600019.filter2(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c600019.filter2,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c600019.filter2,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c600019.sumop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENCE) and (tc:IsSetCard(0x1538) or tc:IsSetCard(0x150e)) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e2)
--maintain
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetOperation(c600019.mtop)
e4:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e4)
end
Duel.SpecialSummonComplete()
end
function c600019.mtop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
|
local Gui = require("api.Gui")
local Ui = require("api.Ui")
local Draw = require("api.Draw")
local IUiLayer = require("api.gui.IUiLayer")
local IInput = require("api.gui.IInput")
local InputHandler = require("api.gui.InputHandler")
local Treemap = require("mod.treemap.api.gui.Treemap")
local TreemapViewer = class.class("TreemapViewer", IUiLayer)
TreemapViewer:delegate("input", IInput)
function TreemapViewer:init(t, depth)
assert(type(t) == "table")
if next(t) == nil then
error("Table has no elements.")
end
self.depth = depth or 3
self.treemap = Treemap:new(t, self.depth)
self.trail = {}
self.selected = 1
self.input = InputHandler:new()
self.input:bind_keys(self:make_keymap())
end
function TreemapViewer:default_z_order()
return 100000000
end
function TreemapViewer:make_keymap()
return {
cancel = function() self:go_back() end,
escape = function() self:go_back() end,
enter = function() self:choose() end,
north = function() self:select_prev() end,
south = function() self:select_next() end,
}
end
function TreemapViewer:select_next()
self.selected = math.min(self.selected + 1, #self.treemap.sizes)
end
function TreemapViewer:select_prev()
self.selected = math.max(self.selected - 1, 1)
end
function TreemapViewer:choose()
local size = self.treemap.sizes[self.selected]
if size and size.cell.child and next(size.value) then
self.trail[#self.trail+1] = { self.treemap, self.selected }
self.treemap = size.cell.child
self.selected = 1
self:relayout()
self:halt_input()
end
end
function TreemapViewer:go_back()
if #self.trail == 0 then
self.canceled = true
return
end
self.treemap = self.trail[#self.trail][1]
self.selected = self.trail[#self.trail][2]
self.trail[#self.trail] = nil
self:relayout()
self:halt_input()
end
function TreemapViewer:on_query()
Gui.play_sound("base.pop2")
end
function TreemapViewer:relayout(x, y, width, height)
local pad = 150
if width and self.width == nil then
self.x, self.y, self.width, self.height = Ui.params_centered(width - pad, height - pad)
end
self.treemap:relayout(0, 0, self.width, self.height)
self.canvas = Draw.create_canvas(self.width, self.height)
self.redraw = true
end
function TreemapViewer:draw()
if self.redraw then
Draw.set_color(255, 255, 255)
Draw.with_canvas(self.canvas, function() self.treemap:draw() end)
self.redraw = false
end
Draw.image(self.canvas, self.x, self.y)
local size = self.treemap.sizes[self.selected]
if size and size.cell.x then
Draw.set_color(255, 255, 255, 80)
Draw.filled_rect(self.x + size.cell.x, self.y + size.cell.y, size.cell.width, size.cell.height)
end
end
function TreemapViewer:update(dt)
self.treemap:update(dt)
if self.canceled then
return nil, "canceled"
end
end
function TreemapViewer.inspect(t, depth)
TreemapViewer:new(t, depth):query()
end
return TreemapViewer
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.