content
stringlengths
5
1.05M
require("prototypes.entity.e-cheat")
return { setup = function() local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true require("lspconfig").cssls.setup({ capabilities = capabilities, }) end, }
local filename, args = ... local docroot = args -- create new class XFilterDrop local XFilterDrop = { } XFilterDrop.__index = XFilterDrop -- "classmethod" to create new instance function XFilterDrop:new(vr) -- vr:debug("New XSendfile instance") local o = { } setmetatable(o, self) return o end -- normal method to handle content function XFilterDrop:handle(vr, outq, inq) -- drop input, close it if nil ~= inq then inq.is_closed = true inq:skip_all() end return lighty.HANDLER_GO_ON end -- create a new filter which drops all input and adds it to the vrequest -- returns the filter object so you can insert your own content in f.out (it is already closed) local function add_drop_filter(vr) local f = vr:add_filter_out(XFilterDrop:new()) local inq = f['in'] if nil ~= inq then inq.is_closed = true inq:skip_all() end f.out.is_closed = true return f end local function handle_x_sendfile(vr) -- vr:debug("handle x-sendfile") -- wait for response if not vr.has_response then if vr.is_handled then -- vr:debug("x-sendfile: waiting for response headers") return lighty.HANDLER_WAIT_FOR_EVENT else -- vr:debug("No response handler yet, cannot handle X-Sendfile") return lighty.HANDLER_GO_ON end end -- vr:debug("handle x-sendfile: headers available") -- add filter if x-sendfile header is not empty local xs = vr.resp.headers["X-Sendfile"] if xs and xs ~= "" then xs = lighty.path_simplify(xs) if docroot and xs:sub(docroot.len()) ~= docroot then vr:error("x-sendfile: File '".. xs .. "'not in required docroot '" .. docroot .. "'") return lighty.HANDLER_GO_ON end -- make sure to drop all other content from the backend local f = add_drop_filter(vr) vr.resp.headers["X-Sendfile"] = nil -- remove header from response -- Add checks for the pathname here vr:debug("XSendfile:handle: pushing file '" .. xs .. "' as content") f.out:add_file(xs) end end actions = handle_x_sendfile
local enum = require("wordplay.enum") local TokenType = enum { -- Single-character tokens. [0] = "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET", "RIGHT_BRACKET", [10] = "COLON", "COMMA", "DOT", "MINUS", "PERCENT", "POUND", "PLUS", "SEMICOLON", "SLASH", "STAR", -- One or two character tokens. -- [11] [30] = "BANG", "BANG_EQUAL", "EQUAL", "EQUAL_EQUAL", "GREATER", "GREATER_EQUAL", "LESS", "LESS_EQUAL", -- Literals. -- [19] [40] = "COMMENT", "IDENTIFIER", "STRING", "NUMBER", } local Token_mt = { __tostring = function(self) return string.format("%s %s %s", TokenType[self.Kind], self.lexeme, self.literal) end; } local function Token(obj) setmetatable(obj, Token_mt) return obj; end return { Token = Token; TokenType = TokenType; }
local function upgrade_formspec (upgrades, desc) local posY = 0.5 local fspec = "" for k in pairs(upgrades) do local scrib = elepm.upgrading.dict[k] if not scrib then scrib = k end fspec = fspec .. "label[1,"..(posY + 0.25)..";"..scrib.."]" fspec = fspec .. "list[detached:soldering;"..k..";7,"..posY..";1,1;]" posY = posY + 1 end return "size[8,8.5]".. default.gui_bg.. default.gui_bg_img.. default.gui_slots.. "label[0,0;Modifying "..desc.."]".. fspec.. "list[current_player;main;0,4.25;8,1;]".. "list[current_player;main;0,5.5;8,3;8]".. "listring[current_player;main]".. default.get_hotbar_bg(0, 4.25) end local function set_component_list (pos, list) local meta = minetest.get_meta(pos) local len = 0 for _,v in pairs(list) do if v ~= nil then len = len + 1 end end if len == 0 and meta:get_string("components") ~= "" then meta:set_string("components", "") else meta:set_string("components", minetest.serialize(list)) end if elepm then elepm.handle_machine_upgrades(pos) end end local function machine_modify (pos, node, user) local nodedef = minetest.registered_nodes[node.name] if not nodedef.ele_upgrades then return minetest.chat_send_player(user:get_player_name(), "This machine cannot be modified.") end local meta = minetest.get_meta(pos) local comps = meta:get_string("components") -- Prevent the node from being dug -- It is recommended to have this check in can_dig callback. meta:set_int("drop_lock", 1) -- Save the soldered machine as an attribute on the player local umeta = user:get_meta() umeta:set_string("soldering", minetest.pos_to_string(pos)) -- Deserialize component list if comps ~= "" then comps = minetest.deserialize(comps) else comps = {} end -- Create detached inventory for upgrades local inv = minetest.create_detached_inventory("soldering", { allow_move = function (inv, from_list, from_index, to_list, to_index, count, player) return 0 end, allow_put = function (inv, listname, index, stack, player) if minetest.get_item_group(stack:get_name(), "ele_upgrade_component") == 0 or minetest.get_item_group(stack:get_name(), listname) < 2 then return 0 end return 1 end, allow_take = function (inv, listname, index, stack, player) return stack:get_count() end, on_put = function (inv, listname, index, stack, player) comps[listname] = stack:get_name() set_component_list(pos, comps) end, on_take = function (inv, listname, index, stack, player) comps[listname] = nil set_component_list(pos, comps) end, }, user:get_player_name()) -- Add lists for k in pairs(nodedef.ele_upgrades) do inv:set_size(k, 1) if comps[k] then inv:set_stack(k, 1, ItemStack(comps[k])) end end -- Open the formspec minetest.show_formspec(user:get_player_name(), "elepower_tools:soldering_iron", upgrade_formspec(nodedef.ele_upgrades, nodedef.description)) end minetest.register_on_player_receive_fields(function (player, formname, fields) if formname ~= "elepower_tools:soldering_iron" or not player then return false end local umeta = player:get_meta() local pos = umeta:get_string("soldering") if not pos then return false end pos = minetest.string_to_pos(pos) local meta = minetest.get_meta(pos) if fields["quit"] then meta:set_int("drop_lock", 0) umeta:set_string("soldering", "") end return true end) minetest.register_on_leaveplayer(function (player) local umeta = player:get_meta() local soldering = umeta:get_string("soldering") if soldering == "" then return end local pos = minetest.string_to_pos(soldering) local meta = minetest.get_meta(pos) if meta:get_int("drop_lock") == 1 then meta:set_int("drop_lock", 0) end umeta:set_string("soldering", "") end) ele.register_tool("elepower_tools:soldering_iron", { description = "Soldering Iron\nUsed to replace components in machines", inventory_image = "eletools_soldering_iron.png", wield_image = "eletools_soldering_iron.png^[transformR270", ele_capacity = 8000, ele_usage = 64, on_use = function (itemstack, user, pointed_thing) if not user or user:get_player_name() == "" then return itemstack end if pointed_thing and pointed_thing.type == "node" then local pos = pointed_thing.under local node = minetest.get_node_or_nil(pos) if not node or node.name == "air" or minetest.is_protected(pos, user:get_player_name()) then return itemstack end if ele.helpers.get_item_group(node.name, "ele_machine") then machine_modify(pos, node, user) end end return itemstack end })
fx_version 'adamant' game 'gta5' client_scripts { 'cl.lua', 'cfg.lua', }
local Randy = require('randy') local Tap = require('tap') local tap = Tap.new {name='randy.lua'} tap:addTest( 'integer()', function (test) local r = Randy.new() local ones = 0 local twos = 0 for _ = 1, 1000 do local result = r:integer(2) if result == 2 then twos = twos + 1 elseif result == 1 then ones = ones + 1 else error('Should not go here') end end test:isTrue(math.abs(ones - twos) < 30, string.format('ones=%d | twos=%d', ones, twos)) end) tap:addTest( 'pickOne', function (test) local r = Randy.new() test:equal(r:pickOne({1}), 1) local sum = 0 for _ = 1, 100 do local v = r:pickOne({1, 2}) sum = sum + v end test:isTrue(math.abs(sum - 150) < 2, tostring(sum)) end) tap:addTest( 'sample', function (test) local r = Randy.new() local v1 = r:sample({1,2}, 2) test:equal(#v1, 2, 'should sample all') end) return tap
--[[ bag.lua A bag button object --]] local ADDON, Addon = ... local L = LibStub('AceLocale-3.0'):GetLocale(ADDON) local Bag = Addon:NewClass('Bag', 'CheckButton') Bag.SIZE = 32 Bag.TEXTURE_SIZE = 64 * (Bag.SIZE/36) Bag.GetSlot = Bag.GetID --[[ Constructor ]]-- function Bag:New(parent, id) local bag = self:Bind(CreateFrame('CheckButton', ADDON .. self.Name .. id, parent)) local icon = bag:CreateTexture(bag:GetName() .. 'IconTexture', 'BORDER') icon:SetAllPoints(bag) local count = bag:CreateFontString(nil, 'OVERLAY') count:SetFontObject('NumberFontNormal') count:SetPoint('BOTTOMRIGHT', -4, 3) count:SetJustifyH('RIGHT') local filter = CreateFrame('Frame', nil, bag) filter:SetPoint('TOPRIGHT', 4, 4) filter:SetSize(20, 20) local filterIcon = filter:CreateTexture() filterIcon:SetAllPoints() local nt = bag:CreateTexture() nt:SetTexture([[Interface\Buttons\UI-Quickslot2]]) nt:SetWidth(self.TEXTURE_SIZE) nt:SetHeight(self.TEXTURE_SIZE) nt:SetPoint('CENTER', 0, -1) local pt = bag:CreateTexture() pt:SetTexture([[Interface\Buttons\UI-Quickslot-Depress]]) pt:SetAllPoints() local ht = bag:CreateTexture() ht:SetTexture([[Interface\Buttons\ButtonHilight-Square]]) ht:SetAllPoints() local ct = bag:CreateTexture() ct:SetTexture([[Interface\Buttons\CheckButtonHilight]]) ct:SetBlendMode('ADD') ct:SetAllPoints() bag:SetID(id) bag:SetNormalTexture(nt) bag:SetPushedTexture(pt) bag:SetCheckedTexture(ct) bag:SetHighlightTexture(ht) bag:RegisterForClicks('anyUp') bag:RegisterForDrag('LeftButton') bag:SetSize(self.SIZE, self.SIZE) bag.Count, bag.FilterIcon = count, filter bag.FilterIcon.Icon = filterIcon bag.Icon = icon bag:SetScript('OnEnter', bag.OnEnter) bag:SetScript('OnLeave', bag.OnLeave) bag:SetScript('OnClick', bag.OnClick) bag:SetScript('OnDragStart', bag.OnDrag) bag:SetScript('OnReceiveDrag', bag.OnClick) bag:SetScript('OnShow', bag.RegisterEvents) bag:SetScript('OnHide', bag.UnregisterSignals) bag:RegisterEvents() return bag end --[[ Interaction ]]-- function Bag:OnClick(button) if button == 'RightButton' then if not self:IsReagents() and not self:IsPurchasable() then ContainerFrame1FilterDropDown:SetParent(self) PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON) ToggleDropDownMenu(1, nil, ContainerFrame1FilterDropDown, self, 0, 0) end elseif self:IsPurchasable() then self:Purchase() elseif CursorHasItem() and not self:IsCached() then if self:IsBackpack() then PutItemInBackpack() else PutItemInBag(self:GetInfo().slot) end elseif self:CanToggle() then self:Toggle() end self:UpdateToggle() end function Bag:OnDrag() if self:IsCustomSlot() and not self:IsCached() then PlaySound(SOUNDKIT.IG_BACKPACK_OPEN) PickupBagFromSlot(self:GetInfo().slot) end end function Bag:OnEnter() if self:GetRight() > (GetScreenWidth() / 2) then GameTooltip:SetOwner(self, 'ANCHOR_LEFT') else GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') end self:UpdateTooltip() self:SetFocus(true) end function Bag:OnLeave() if GameTooltip:IsOwned(self) then GameTooltip:Hide() end self:SetFocus(false) end --[[ Events ]]-- function Bag:RegisterEvents() self:Update() self:UnregisterSignals() self:RegisterFrameSignal('OWNER_CHANGED', 'RegisterEvents') self:RegisterFrameSignal('FILTERS_CHANGED', 'UpdateToggle') self:RegisterEvent('BAG_CLOSED', 'BAG_UPDATE') self:RegisterEvent('BAG_UPDATE') if self:IsBank() or self:IsBankBag() or self:IsReagents() then self:RegisterMessage('CACHE_BANK_OPENED', 'RegisterEvents') self:RegisterMessage('CACHE_BANK_CLOSED', 'RegisterEvents') end if self:IsCustomSlot() then if self:IsCached() then self:RegisterEvent('GET_ITEM_INFO_RECEIVED', 'Update') else self:RegisterEvent('ITEM_LOCK_CHANGED', 'UpdateLock') self:RegisterEvent('CURSOR_UPDATE', 'UpdateCursor') end elseif self:IsReagents() then self:RegisterEvent('REAGENTBANK_PURCHASED', 'Update') end end function Bag:BAG_UPDATE(_, bag) if bag == self:GetSlot() then self:Update() end end --[[ Update ]]-- function Bag:Update() local info = self:GetInfo() self.FilterIcon:SetShown(not info.cached) self.Count:SetText(info.free and info.free > 0 and info.free) if self:IsBackpack() or self:IsBank() then self:SetIcon('Interface/Buttons/Button-Backpack-Up') elseif self:IsReagents() then self:SetIcon('Interface/Icons/Achievement_GuildPerk_BountifulBags') else self:SetIcon(info.icon or 'Interface/PaperDoll/UI-PaperDoll-Slot-Bag') self.link = info.link if not info.icon then self.Count:SetText() end end for i = LE_BAG_FILTER_FLAG_EQUIPMENT, NUM_LE_BAG_FILTER_FLAGS do local id = self:GetSlot() local active = id > NUM_BAG_SLOTS and GetBankBagSlotFlag(id - NUM_BAG_SLOTS, i) or GetBagSlotFlag(id, i) if active then self.FilterIcon.Icon:SetAtlas(BAG_FILTER_ICONS[i]) end end self:UpdateLock() self:UpdateCursor() self:UpdateToggle() end function Bag:UpdateLock() if self:IsCustomSlot() then SetItemButtonDesaturated(self, self:GetInfo().locked) end end function Bag:UpdateCursor() if not self:IsCustomSlot() then if CursorCanGoInSlot(self:GetInfo().slot) then self:LockHighlight() else self:UnlockHighlight() end end end function Bag:UpdateToggle() self:SetChecked(not self:IsHidden()) end function Bag:UpdateTooltip() GameTooltip:ClearLines() -- title if self:IsPurchasable() then GameTooltip:SetText(self:IsReagents() and REAGENT_BANK or BANK_BAG_PURCHASE, 1, 1, 1) GameTooltip:AddLine(L.TipPurchaseBag) SetTooltipMoney(GameTooltip, self:GetCost()) elseif self:IsBackpack() then GameTooltip:SetText(BACKPACK_TOOLTIP, 1,1,1) elseif self:IsBank() then GameTooltip:SetText(BANK, 1,1,1) elseif self:IsReagents() then GameTooltip:SetText(REAGENT_BANK, 1,1,1) elseif self.link then GameTooltip:SetHyperlink(self.link) elseif self:IsBankBag() then GameTooltip:SetText(BANK_BAG, 1, 1, 1) else GameTooltip:SetText(EQUIP_CONTAINER, 1, 1, 1) end -- instructions if self:CanToggle() then GameTooltip:AddLine(self:IsHidden() and L.TipShowBag or L.TipHideBag) end GameTooltip:Show() end --[[ Actions ]]-- function Bag:Purchase() PlaySound(SOUNDKIT.IG_MAINMENU_OPEN) if self:IsReagents() then StaticPopup_Show('CONFIRM_BUY_REAGENTBANK_TAB') else if not StaticPopupDialogs['CONFIRM_BUY_BANK_SLOT_' .. ADDON] then StaticPopupDialogs['CONFIRM_BUY_BANK_SLOT_' .. ADDON] = { text = CONFIRM_BUY_BANK_SLOT, button1 = YES, button2 = NO, OnAccept = PurchaseSlot, OnShow = function(self) MoneyFrame_Update(self.moneyFrame, GetBankSlotCost(GetNumBankSlots())) end, hasMoneyFrame = 1, hideOnEscape = 1, timeout = 0, preferredIndex = STATICPOPUP_NUMDIALOGS } end StaticPopup_Show('CONFIRM_BUY_BANK_SLOT_' .. ADDON) end end function Bag:Toggle() local profile = self:GetProfile() local hidden = profile.hiddenBags local slot = profile.exclusiveReagent and not hidden[REAGENTBANK_CONTAINER] and REAGENTBANK_CONTAINER or self:GetSlot() hidden[slot] = not hidden[slot] self:SendFrameSignal('FILTERS_CHANGED') self:SetFocus(true) end function Bag:SetFocus(focus) local state = focus and self:GetSlot() self:GetFrame().focusedBag = state self:SendFrameSignal('FOCUS_BAG', state) end function Bag:SetIcon(icon) local color = self:IsPurchasable() and .1 or 1 SetItemButtonTexture(self, icon) SetItemButtonTextureVertexColor(self, 1, color, color) end --[[ Bag Type ]]-- function Bag:IsBackpack() return Addon:IsBackpack(self:GetSlot()) end function Bag:IsBackpackBag() return Addon:IsBackpackBag(self:GetSlot()) end function Bag:IsBank() return Addon:IsBank(self:GetSlot()) end function Bag:IsReagents() return Addon:IsReagents(self:GetSlot()) end function Bag:IsBankBag() return Addon:IsBankBag(self:GetSlot()) end function Bag:IsCustomSlot() return self:IsBackpackBag() or self:IsBankBag() end function Bag:CanToggle() return self:IsBackpack() or self:IsBank() or not self:IsPurchasable() end --[[ Info ]]-- function Bag:IsCached() return self:GetInfo().cached end function Bag:GetCost() return self:IsReagents() and GetReagentBankCost() or GetBankSlotCost(GetNumBankSlots()) end function Bag:IsPurchasable() if not self:IsCached() then return self:IsBankBag() and (self:GetSlot() - NUM_BAG_SLOTS) > GetNumBankSlots() or self:IsReagents() and not IsReagentBankUnlocked() end end function Bag:IsHidden() return not self:GetFrame():IsShowingBag(self:GetSlot()) end function Bag:GetInfo() return Addon:GetBagInfo(self:GetOwner(), self:GetSlot()) end
local Gamestate = require("lib.hump.gamestate") local colors = require("src.colors") local gfx = require("src.gfx") local Board = require("src.states.board") local ENTER = 0.5 -- fade in time local HOLD = 2.0 -- hold time local LEAVE = 0.5 -- fade out time local Studio = {} function Studio:init() gfx.loadUniformSpriteSheet("studio", "gfx/studio.png") self.ttl = ENTER + LEAVE + HOLD end function Studio:update(delta_time) self.ttl = self.ttl - delta_time if self.ttl < 0 then Gamestate.switch(Board) end end function Studio:mousepressed(x, y, button, istouch) Gamestate.switch(Board) -- any key end function Studio:keypressed(key) Gamestate.switch(Board) -- any key end function Studio:draw() love.graphics.setColor(colors.white) gfx.drawSprite("studio", 0, 0) -- fade in if self.ttl > (LEAVE + HOLD) then local progress = (self.ttl - HOLD - LEAVE) / ENTER gfx.colorScreen({22, 22, 29, progress * 255}) end -- fade out if self.ttl < LEAVE then local progress = 1.0 - (self.ttl / LEAVE) gfx.colorScreen({22, 22, 29, progress * 255}) end end return Studio
local AuctionHouse = { Name = "AuctionHouse", Type = "System", Namespace = "C_AuctionHouse", Functions = { { Name = "CalculateCommodityDeposit", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, { Name = "duration", Type = "number", Nilable = false }, { Name = "quantity", Type = "number", Nilable = false }, }, Returns = { { Name = "depositCost", Type = "number", Nilable = true }, }, }, { Name = "CalculateItemDeposit", Type = "Function", Arguments = { { Name = "item", Type = "table", Mixin = "ItemLocationMixin", Nilable = false }, { Name = "duration", Type = "number", Nilable = false }, { Name = "quantity", Type = "number", Nilable = false }, }, Returns = { { Name = "depositCost", Type = "number", Nilable = true }, }, }, { Name = "CanCancelAuction", Type = "Function", Arguments = { { Name = "ownedAuctionID", Type = "number", Nilable = false }, }, Returns = { { Name = "canCancelAuction", Type = "bool", Nilable = false }, }, }, { Name = "CancelAuction", Type = "Function", Arguments = { { Name = "ownedAuctionID", Type = "number", Nilable = false }, }, }, { Name = "CancelCommoditiesPurchase", Type = "Function", }, { Name = "CancelSell", Type = "Function", }, { Name = "CloseAuctionHouse", Type = "Function", }, { Name = "ConfirmCommoditiesPurchase", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, { Name = "quantity", Type = "number", Nilable = false }, }, }, { Name = "FavoritesAreAvailable", Type = "Function", Returns = { { Name = "favoritesAreAvailable", Type = "bool", Nilable = false }, }, }, { Name = "GetAuctionItemSubClasses", Type = "Function", Arguments = { { Name = "classID", Type = "number", Nilable = false }, }, Returns = { { Name = "subClasses", Type = "table", InnerType = "number", Nilable = false }, }, }, { Name = "GetAvailablePostCount", Type = "Function", Arguments = { { Name = "item", Type = "table", Mixin = "ItemLocationMixin", Nilable = false }, }, Returns = { { Name = "listCount", Type = "number", Nilable = false }, }, }, { Name = "GetBidInfo", Type = "Function", Arguments = { { Name = "bidIndex", Type = "number", Nilable = false }, }, Returns = { { Name = "bid", Type = "BidInfo", Nilable = true }, }, }, { Name = "GetBidType", Type = "Function", Arguments = { { Name = "bidTypeIndex", Type = "number", Nilable = false }, }, Returns = { { Name = "typeItemKey", Type = "ItemKey", Nilable = true }, }, }, { Name = "GetBrowseResults", Type = "Function", Returns = { { Name = "browseResults", Type = "table", InnerType = "BrowseResultInfo", Nilable = false }, }, }, { Name = "GetCancelCost", Type = "Function", Arguments = { { Name = "ownedAuctionID", Type = "number", Nilable = false }, }, Returns = { { Name = "cancelCost", Type = "number", Nilable = false }, }, }, { Name = "GetCommoditySearchResultInfo", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, { Name = "commoditySearchResultIndex", Type = "number", Nilable = false }, }, Returns = { { Name = "result", Type = "CommoditySearchResultInfo", Nilable = true }, }, }, { Name = "GetCommoditySearchResultsQuantity", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, }, Returns = { { Name = "totalQuantity", Type = "number", Nilable = false }, }, }, { Name = "GetExtraBrowseInfo", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, Returns = { { Name = "extraInfo", Type = "number", Nilable = false }, }, }, { Name = "GetFilterGroups", Type = "Function", Returns = { { Name = "filterGroups", Type = "table", InnerType = "AuctionHouseFilterGroup", Nilable = false }, }, }, { Name = "GetItemCommodityStatus", Type = "Function", Arguments = { { Name = "item", Type = "table", Mixin = "ItemLocationMixin", Nilable = false }, }, Returns = { { Name = "isCommodity", Type = "ItemCommodityStatus", Nilable = false }, }, }, { Name = "GetItemKeyFromItem", Type = "Function", Arguments = { { Name = "item", Type = "table", Mixin = "ItemLocationMixin", Nilable = false }, }, Returns = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, }, { Name = "GetItemKeyInfo", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, { Name = "restrictQualityToFilter", Type = "bool", Nilable = false, Default = false }, }, Returns = { { Name = "itemKeyInfo", Type = "ItemKeyInfo", Nilable = true }, }, }, { Name = "GetItemKeyRequiredLevel", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, Returns = { { Name = "requiredLevel", Type = "number", Nilable = false }, }, }, { Name = "GetItemSearchResultInfo", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, { Name = "itemSearchResultIndex", Type = "number", Nilable = false }, }, Returns = { { Name = "result", Type = "ItemSearchResultInfo", Nilable = true }, }, }, { Name = "GetItemSearchResultsQuantity", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, Returns = { { Name = "totalQuantity", Type = "number", Nilable = false }, }, }, { Name = "GetMaxBidItemBid", Type = "Function", Returns = { { Name = "maxBid", Type = "number", Nilable = true }, }, }, { Name = "GetMaxBidItemBuyout", Type = "Function", Returns = { { Name = "maxBuyout", Type = "number", Nilable = true }, }, }, { Name = "GetMaxCommoditySearchResultPrice", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, }, Returns = { { Name = "maxUnitPrice", Type = "number", Nilable = true }, }, }, { Name = "GetMaxItemSearchResultBid", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, Returns = { { Name = "maxBid", Type = "number", Nilable = true }, }, }, { Name = "GetMaxItemSearchResultBuyout", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, Returns = { { Name = "maxBuyout", Type = "number", Nilable = true }, }, }, { Name = "GetMaxOwnedAuctionBid", Type = "Function", Returns = { { Name = "maxBid", Type = "number", Nilable = true }, }, }, { Name = "GetMaxOwnedAuctionBuyout", Type = "Function", Returns = { { Name = "maxBuyout", Type = "number", Nilable = true }, }, }, { Name = "GetNumBidTypes", Type = "Function", Returns = { { Name = "numBidTypes", Type = "number", Nilable = false }, }, }, { Name = "GetNumBids", Type = "Function", Returns = { { Name = "numBids", Type = "number", Nilable = false }, }, }, { Name = "GetNumCommoditySearchResults", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, }, Returns = { { Name = "numSearchResults", Type = "number", Nilable = false }, }, }, { Name = "GetNumItemSearchResults", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, Returns = { { Name = "numItemSearchResults", Type = "number", Nilable = false }, }, }, { Name = "GetNumOwnedAuctionTypes", Type = "Function", Returns = { { Name = "numOwnedAuctionTypes", Type = "number", Nilable = false }, }, }, { Name = "GetNumOwnedAuctions", Type = "Function", Returns = { { Name = "numOwnedAuctions", Type = "number", Nilable = false }, }, }, { Name = "GetNumReplicateItems", Type = "Function", Returns = { { Name = "numReplicateItems", Type = "number", Nilable = false }, }, }, { Name = "GetOwnedAuctionInfo", Type = "Function", Arguments = { { Name = "ownedAuctionIndex", Type = "number", Nilable = false }, }, Returns = { { Name = "ownedAuction", Type = "OwnedAuctionInfo", Nilable = true }, }, }, { Name = "GetOwnedAuctionType", Type = "Function", Arguments = { { Name = "ownedAuctionTypeIndex", Type = "number", Nilable = false }, }, Returns = { { Name = "typeItemKey", Type = "ItemKey", Nilable = true }, }, }, { Name = "GetQuoteDurationRemaining", Type = "Function", Returns = { { Name = "quoteDurationSeconds", Type = "number", Nilable = false }, }, }, { Name = "GetReplicateItemBattlePetInfo", Type = "Function", Arguments = { { Name = "index", Type = "number", Nilable = false }, }, Returns = { { Name = "creatureID", Type = "number", Nilable = false }, { Name = "displayID", Type = "number", Nilable = false }, }, }, { Name = "GetReplicateItemInfo", Type = "Function", Arguments = { { Name = "index", Type = "number", Nilable = false }, }, Returns = { { Name = "name", Type = "string", Nilable = true }, { Name = "texture", Type = "number", Nilable = true }, { Name = "count", Type = "number", Nilable = false }, { Name = "qualityID", Type = "number", Nilable = false }, { Name = "usable", Type = "bool", Nilable = true }, { Name = "level", Type = "number", Nilable = false }, { Name = "levelType", Type = "string", Nilable = true }, { Name = "minBid", Type = "number", Nilable = false }, { Name = "minIncrement", Type = "number", Nilable = false }, { Name = "buyoutPrice", Type = "number", Nilable = false }, { Name = "bidAmount", Type = "number", Nilable = false }, { Name = "highBidder", Type = "string", Nilable = true }, { Name = "bidderFullName", Type = "string", Nilable = true }, { Name = "owner", Type = "string", Nilable = true }, { Name = "ownerFullName", Type = "string", Nilable = true }, { Name = "saleStatus", Type = "number", Nilable = false }, { Name = "itemID", Type = "number", Nilable = false }, { Name = "hasAllInfo", Type = "bool", Nilable = true }, }, }, { Name = "GetReplicateItemLink", Type = "Function", Arguments = { { Name = "index", Type = "number", Nilable = false }, }, Returns = { { Name = "itemLink", Type = "string", Nilable = true }, }, }, { Name = "GetReplicateItemTimeLeft", Type = "Function", Arguments = { { Name = "index", Type = "number", Nilable = false }, }, Returns = { { Name = "timeLeft", Type = "number", Nilable = false }, }, }, { Name = "GetTimeLeftBandInfo", Type = "Function", Arguments = { { Name = "timeLeftBand", Type = "AuctionHouseTimeLeftBand", Nilable = false }, }, Returns = { { Name = "timeLeftMinSeconds", Type = "number", Nilable = false }, { Name = "timeLeftMaxSeconds", Type = "number", Nilable = false }, }, }, { Name = "HasFavorites", Type = "Function", Returns = { { Name = "hasFavorites", Type = "bool", Nilable = false }, }, }, { Name = "HasFullBidResults", Type = "Function", Returns = { { Name = "hasFullBidResults", Type = "bool", Nilable = false }, }, }, { Name = "HasFullBrowseResults", Type = "Function", Returns = { { Name = "hasFullBrowseResults", Type = "bool", Nilable = false }, }, }, { Name = "HasFullCommoditySearchResults", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, }, Returns = { { Name = "hasFullResults", Type = "bool", Nilable = false }, }, }, { Name = "HasFullItemSearchResults", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, Returns = { { Name = "hasFullResults", Type = "bool", Nilable = false }, }, }, { Name = "HasFullOwnedAuctionResults", Type = "Function", Returns = { { Name = "hasFullOwnedAuctionResults", Type = "bool", Nilable = false }, }, }, { Name = "HasMaxFavorites", Type = "Function", Returns = { { Name = "hasMaxFavorites", Type = "bool", Nilable = false }, }, }, { Name = "HasSearchResults", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, Returns = { { Name = "hasSearchResults", Type = "bool", Nilable = false }, }, }, { Name = "IsFavoriteItem", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, Returns = { { Name = "isFavorite", Type = "bool", Nilable = false }, }, }, { Name = "IsSellItemValid", Type = "Function", Arguments = { { Name = "item", Type = "table", Mixin = "ItemLocationMixin", Nilable = false }, { Name = "displayError", Type = "bool", Nilable = false, Default = true }, }, Returns = { { Name = "valid", Type = "bool", Nilable = false }, }, }, { Name = "IsThrottledMessageSystemReady", Type = "Function", Returns = { { Name = "canSendThrottledMessage", Type = "bool", Nilable = false }, }, }, { Name = "MakeItemKey", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, { Name = "itemLevel", Type = "number", Nilable = false, Default = 0 }, { Name = "itemSuffix", Type = "number", Nilable = false, Default = 0 }, { Name = "battlePetSpeciesID", Type = "number", Nilable = false, Default = 0 }, }, Returns = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, }, { Name = "PlaceBid", Type = "Function", Arguments = { { Name = "auctionID", Type = "number", Nilable = false }, { Name = "bidAmount", Type = "number", Nilable = false }, }, }, { Name = "PostCommodity", Type = "Function", Arguments = { { Name = "item", Type = "table", Mixin = "ItemLocationMixin", Nilable = false }, { Name = "duration", Type = "number", Nilable = false }, { Name = "quantity", Type = "number", Nilable = false }, { Name = "unitPrice", Type = "number", Nilable = false }, }, }, { Name = "PostItem", Type = "Function", Arguments = { { Name = "item", Type = "table", Mixin = "ItemLocationMixin", Nilable = false }, { Name = "duration", Type = "number", Nilable = false }, { Name = "quantity", Type = "number", Nilable = false }, { Name = "bid", Type = "number", Nilable = true }, { Name = "buyout", Type = "number", Nilable = true }, }, }, { Name = "QueryBids", Type = "Function", Arguments = { { Name = "sorts", Type = "table", InnerType = "AuctionHouseSortType", Nilable = false }, { Name = "auctionIDs", Type = "table", InnerType = "number", Nilable = false }, }, }, { Name = "QueryOwnedAuctions", Type = "Function", Arguments = { { Name = "sorts", Type = "table", InnerType = "AuctionHouseSortType", Nilable = false }, }, }, { Name = "RefreshCommoditySearchResults", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, }, }, { Name = "RefreshItemSearchResults", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, }, { Name = "ReplicateItems", Type = "Function", Documentation = { "This function should be used in place of an 'allItem' QueryAuctionItems call to query the entire auction house." }, }, { Name = "RequestMoreBrowseResults", Type = "Function", }, { Name = "RequestMoreCommoditySearchResults", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, }, Returns = { { Name = "hasFullResults", Type = "bool", Nilable = false }, }, }, { Name = "RequestMoreItemSearchResults", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, Returns = { { Name = "hasFullResults", Type = "bool", Nilable = false }, }, }, { Name = "RequestOwnedAuctionBidderInfo", Type = "Function", Arguments = { { Name = "auctionID", Type = "number", Nilable = false }, }, Returns = { { Name = "bidderName", Type = "string", Nilable = true }, }, }, { Name = "SearchForFavorites", Type = "Function", Arguments = { { Name = "sorts", Type = "table", InnerType = "AuctionHouseSortType", Nilable = false }, }, }, { Name = "SearchForItemKeys", Type = "Function", Arguments = { { Name = "itemKeys", Type = "table", InnerType = "ItemKey", Nilable = false }, { Name = "sorts", Type = "table", InnerType = "AuctionHouseSortType", Nilable = false }, }, }, { Name = "SendBrowseQuery", Type = "Function", Arguments = { { Name = "query", Type = "AuctionHouseBrowseQuery", Nilable = false }, }, }, { Name = "SendSearchQuery", Type = "Function", Documentation = { "Search queries are restricted to 100 calls per minute. These should not be used to query the entire auction house. See ReplicateItems" }, Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, { Name = "sorts", Type = "table", InnerType = "AuctionHouseSortType", Nilable = false }, { Name = "separateOwnerItems", Type = "bool", Nilable = false }, }, }, { Name = "SendSellSearchQuery", Type = "Function", Documentation = { "Search queries are restricted to 100 calls per minute. These should not be used to query the entire auction house. See ReplicateItems" }, Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, { Name = "sorts", Type = "table", InnerType = "AuctionHouseSortType", Nilable = false }, { Name = "separateOwnerItems", Type = "bool", Nilable = false }, }, }, { Name = "SetFavoriteItem", Type = "Function", Arguments = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, { Name = "setFavorite", Type = "bool", Nilable = false }, }, }, { Name = "StartCommoditiesPurchase", Type = "Function", Arguments = { { Name = "itemID", Type = "number", Nilable = false }, { Name = "quantity", Type = "number", Nilable = false }, }, }, }, Events = { { Name = "AuctionCanceled", Type = "Event", LiteralName = "AUCTION_CANCELED", Payload = { { Name = "auctionID", Type = "number", Nilable = false }, }, }, { Name = "AuctionHouseAuctionCreated", Type = "Event", LiteralName = "AUCTION_HOUSE_AUCTION_CREATED", Documentation = { "This signal is not used in the base UI but is included for AddOn ease-of-use." }, Payload = { { Name = "auctionID", Type = "number", Nilable = false }, }, }, { Name = "AuctionHouseBrowseFailure", Type = "Event", LiteralName = "AUCTION_HOUSE_BROWSE_FAILURE", }, { Name = "AuctionHouseBrowseResultsAdded", Type = "Event", LiteralName = "AUCTION_HOUSE_BROWSE_RESULTS_ADDED", Payload = { { Name = "addedBrowseResults", Type = "table", InnerType = "BrowseResultInfo", Nilable = false }, }, }, { Name = "AuctionHouseBrowseResultsUpdated", Type = "Event", LiteralName = "AUCTION_HOUSE_BROWSE_RESULTS_UPDATED", }, { Name = "AuctionHouseClosed", Type = "Event", LiteralName = "AUCTION_HOUSE_CLOSED", }, { Name = "AuctionHouseDisabled", Type = "Event", LiteralName = "AUCTION_HOUSE_DISABLED", }, { Name = "AuctionHouseFavoritesUpdated", Type = "Event", LiteralName = "AUCTION_HOUSE_FAVORITES_UPDATED", }, { Name = "AuctionHouseNewBidReceived", Type = "Event", LiteralName = "AUCTION_HOUSE_NEW_BID_RECEIVED", Payload = { { Name = "auctionID", Type = "number", Nilable = false }, }, }, { Name = "AuctionHouseNewResultsReceived", Type = "Event", LiteralName = "AUCTION_HOUSE_NEW_RESULTS_RECEIVED", Documentation = { "This signal is not used in the base UI but is included for AddOn ease-of-use. Payload is nil for browse queries." }, Payload = { { Name = "itemKey", Type = "ItemKey", Nilable = true }, }, }, { Name = "AuctionHouseScriptDeprecated", Type = "Event", LiteralName = "AUCTION_HOUSE_SCRIPT_DEPRECATED", }, { Name = "AuctionHouseShow", Type = "Event", LiteralName = "AUCTION_HOUSE_SHOW", }, { Name = "AuctionHouseThrottledMessageDropped", Type = "Event", LiteralName = "AUCTION_HOUSE_THROTTLED_MESSAGE_DROPPED", }, { Name = "AuctionHouseThrottledMessageQueued", Type = "Event", LiteralName = "AUCTION_HOUSE_THROTTLED_MESSAGE_QUEUED", }, { Name = "AuctionHouseThrottledMessageResponseReceived", Type = "Event", LiteralName = "AUCTION_HOUSE_THROTTLED_MESSAGE_RESPONSE_RECEIVED", }, { Name = "AuctionHouseThrottledMessageSent", Type = "Event", LiteralName = "AUCTION_HOUSE_THROTTLED_MESSAGE_SENT", }, { Name = "AuctionHouseThrottledSystemReady", Type = "Event", LiteralName = "AUCTION_HOUSE_THROTTLED_SYSTEM_READY", }, { Name = "AuctionMultisellFailure", Type = "Event", LiteralName = "AUCTION_MULTISELL_FAILURE", }, { Name = "AuctionMultisellStart", Type = "Event", LiteralName = "AUCTION_MULTISELL_START", Payload = { { Name = "numRepetitions", Type = "number", Nilable = false }, }, }, { Name = "AuctionMultisellUpdate", Type = "Event", LiteralName = "AUCTION_MULTISELL_UPDATE", Payload = { { Name = "createdCount", Type = "number", Nilable = false }, { Name = "totalToCreate", Type = "number", Nilable = false }, }, }, { Name = "BidAdded", Type = "Event", LiteralName = "BID_ADDED", Payload = { { Name = "bidID", Type = "number", Nilable = false }, }, }, { Name = "BidsUpdated", Type = "Event", LiteralName = "BIDS_UPDATED", }, { Name = "CommodityPriceUnavailable", Type = "Event", LiteralName = "COMMODITY_PRICE_UNAVAILABLE", }, { Name = "CommodityPriceUpdated", Type = "Event", LiteralName = "COMMODITY_PRICE_UPDATED", Payload = { { Name = "updatedUnitPrice", Type = "number", Nilable = false }, { Name = "updatedTotalPrice", Type = "number", Nilable = false }, }, }, { Name = "CommodityPurchaseFailed", Type = "Event", LiteralName = "COMMODITY_PURCHASE_FAILED", }, { Name = "CommodityPurchaseSucceeded", Type = "Event", LiteralName = "COMMODITY_PURCHASE_SUCCEEDED", }, { Name = "CommodityPurchased", Type = "Event", LiteralName = "COMMODITY_PURCHASED", Payload = { { Name = "itemID", Type = "number", Nilable = false }, { Name = "quantity", Type = "number", Nilable = false }, }, }, { Name = "CommoditySearchResultsAdded", Type = "Event", LiteralName = "COMMODITY_SEARCH_RESULTS_ADDED", Payload = { { Name = "itemID", Type = "number", Nilable = false }, }, }, { Name = "CommoditySearchResultsUpdated", Type = "Event", LiteralName = "COMMODITY_SEARCH_RESULTS_UPDATED", Payload = { { Name = "itemID", Type = "number", Nilable = false }, }, }, { Name = "ExtraBrowseInfoReceived", Type = "Event", LiteralName = "EXTRA_BROWSE_INFO_RECEIVED", Payload = { { Name = "itemID", Type = "number", Nilable = false }, }, }, { Name = "ItemKeyItemInfoReceived", Type = "Event", LiteralName = "ITEM_KEY_ITEM_INFO_RECEIVED", Payload = { { Name = "itemID", Type = "number", Nilable = false }, }, }, { Name = "ItemPurchased", Type = "Event", LiteralName = "ITEM_PURCHASED", Payload = { { Name = "itemID", Type = "number", Nilable = false }, }, }, { Name = "ItemSearchResultsAdded", Type = "Event", LiteralName = "ITEM_SEARCH_RESULTS_ADDED", Payload = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, }, }, { Name = "ItemSearchResultsUpdated", Type = "Event", LiteralName = "ITEM_SEARCH_RESULTS_UPDATED", Payload = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, { Name = "newAuctionID", Type = "number", Nilable = true }, }, }, { Name = "OwnedAuctionBidderInfoReceived", Type = "Event", LiteralName = "OWNED_AUCTION_BIDDER_INFO_RECEIVED", Payload = { { Name = "auctionID", Type = "number", Nilable = false }, { Name = "bidderName", Type = "string", Nilable = false }, }, }, { Name = "OwnedAuctionsUpdated", Type = "Event", LiteralName = "OWNED_AUCTIONS_UPDATED", }, { Name = "ReplicateItemListUpdate", Type = "Event", LiteralName = "REPLICATE_ITEM_LIST_UPDATE", }, }, Tables = { { Name = "AuctionHouseFilterCategory", Type = "Enumeration", NumValues = 3, MinValue = 0, MaxValue = 2, Fields = { { Name = "Uncategorized", Type = "AuctionHouseFilterCategory", EnumValue = 0 }, { Name = "Equipment", Type = "AuctionHouseFilterCategory", EnumValue = 1 }, { Name = "Rarity", Type = "AuctionHouseFilterCategory", EnumValue = 2 }, }, }, { Name = "AuctionStatus", Type = "Enumeration", NumValues = 2, MinValue = 0, MaxValue = 1, Fields = { { Name = "Active", Type = "AuctionStatus", EnumValue = 0 }, { Name = "Sold", Type = "AuctionStatus", EnumValue = 1 }, }, }, { Name = "ItemCommodityStatus", Type = "Enumeration", NumValues = 3, MinValue = 0, MaxValue = 2, Fields = { { Name = "Unknown", Type = "ItemCommodityStatus", EnumValue = 0 }, { Name = "Item", Type = "ItemCommodityStatus", EnumValue = 1 }, { Name = "Commodity", Type = "ItemCommodityStatus", EnumValue = 2 }, }, }, { Name = "AuctionHouseBrowseQuery", Type = "Structure", Fields = { { Name = "searchString", Type = "string", Nilable = false }, { Name = "sorts", Type = "table", InnerType = "AuctionHouseSortType", Nilable = false }, { Name = "minLevel", Type = "number", Nilable = true }, { Name = "maxLevel", Type = "number", Nilable = true }, { Name = "filters", Type = "table", InnerType = "AuctionHouseFilter", Nilable = true }, { Name = "itemClassFilters", Type = "table", InnerType = "AuctionHouseItemClassFilter", Nilable = true }, }, }, { Name = "AuctionHouseFilterGroup", Type = "Structure", Fields = { { Name = "category", Type = "AuctionHouseFilterCategory", Nilable = false }, { Name = "filters", Type = "table", InnerType = "AuctionHouseFilter", Nilable = false }, }, }, { Name = "AuctionHouseItemClassFilter", Type = "Structure", Fields = { { Name = "classID", Type = "number", Nilable = false }, { Name = "subClassID", Type = "number", Nilable = true }, { Name = "inventoryType", Type = "number", Nilable = true }, }, }, { Name = "AuctionHouseSortType", Type = "Structure", Fields = { { Name = "sortOrder", Type = "AuctionHouseSortOrder", Nilable = false }, { Name = "reverseSort", Type = "bool", Nilable = false }, }, }, { Name = "BidInfo", Type = "Structure", Fields = { { Name = "auctionID", Type = "number", Nilable = false }, { Name = "itemKey", Type = "ItemKey", Nilable = false }, { Name = "itemLink", Type = "string", Nilable = true }, { Name = "timeLeft", Type = "AuctionHouseTimeLeftBand", Nilable = false }, { Name = "minBid", Type = "number", Nilable = true }, { Name = "bidAmount", Type = "number", Nilable = true }, { Name = "buyoutAmount", Type = "number", Nilable = true }, { Name = "bidder", Type = "string", Nilable = true }, }, }, { Name = "BrowseResultInfo", Type = "Structure", Fields = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, { Name = "appearanceLink", Type = "string", Nilable = true }, { Name = "totalQuantity", Type = "number", Nilable = false }, { Name = "minPrice", Type = "number", Nilable = false }, { Name = "containsOwnerItem", Type = "bool", Nilable = false }, }, }, { Name = "CommoditySearchResultInfo", Type = "Structure", Fields = { { Name = "itemID", Type = "number", Nilable = false }, { Name = "quantity", Type = "number", Nilable = false }, { Name = "unitPrice", Type = "number", Nilable = false }, { Name = "auctionID", Type = "number", Nilable = false }, { Name = "owners", Type = "table", InnerType = "string", Nilable = false }, { Name = "totalNumberOfOwners", Type = "number", Nilable = false }, { Name = "timeLeftSeconds", Type = "number", Nilable = true }, { Name = "numOwnerItems", Type = "number", Nilable = false }, { Name = "containsOwnerItem", Type = "bool", Nilable = false }, { Name = "containsAccountItem", Type = "bool", Nilable = false }, }, }, { Name = "ItemKey", Type = "Structure", Fields = { { Name = "itemID", Type = "number", Nilable = false }, { Name = "itemLevel", Type = "number", Nilable = false, Default = 0 }, { Name = "itemSuffix", Type = "number", Nilable = false, Default = 0 }, { Name = "battlePetSpeciesID", Type = "number", Nilable = false, Default = 0 }, }, }, { Name = "ItemKeyInfo", Type = "Structure", Fields = { { Name = "itemName", Type = "string", Nilable = false }, { Name = "battlePetLink", Type = "string", Nilable = true }, { Name = "appearanceLink", Type = "string", Nilable = true }, { Name = "quality", Type = "number", Nilable = false }, { Name = "iconFileID", Type = "number", Nilable = false }, { Name = "isPet", Type = "bool", Nilable = false }, { Name = "isCommodity", Type = "bool", Nilable = false }, { Name = "isEquipment", Type = "bool", Nilable = false }, }, }, { Name = "ItemSearchResultInfo", Type = "Structure", Fields = { { Name = "itemKey", Type = "ItemKey", Nilable = false }, { Name = "owners", Type = "table", InnerType = "string", Nilable = false }, { Name = "totalNumberOfOwners", Type = "number", Nilable = false }, { Name = "timeLeft", Type = "AuctionHouseTimeLeftBand", Nilable = false }, { Name = "auctionID", Type = "number", Nilable = false }, { Name = "quantity", Type = "number", Nilable = false }, { Name = "itemLink", Type = "string", Nilable = true }, { Name = "containsOwnerItem", Type = "bool", Nilable = false }, { Name = "containsAccountItem", Type = "bool", Nilable = false }, { Name = "containsSocketedItem", Type = "bool", Nilable = false }, { Name = "bidder", Type = "string", Nilable = true }, { Name = "minBid", Type = "number", Nilable = true }, { Name = "bidAmount", Type = "number", Nilable = true }, { Name = "buyoutAmount", Type = "number", Nilable = true }, { Name = "timeLeftSeconds", Type = "number", Nilable = true }, }, }, { Name = "OwnedAuctionInfo", Type = "Structure", Fields = { { Name = "auctionID", Type = "number", Nilable = false }, { Name = "itemKey", Type = "ItemKey", Nilable = false }, { Name = "itemLink", Type = "string", Nilable = true }, { Name = "status", Type = "AuctionStatus", Nilable = false }, { Name = "quantity", Type = "number", Nilable = false }, { Name = "timeLeftSeconds", Type = "number", Nilable = true }, { Name = "timeLeft", Type = "AuctionHouseTimeLeftBand", Nilable = true }, { Name = "bidAmount", Type = "number", Nilable = true }, { Name = "buyoutAmount", Type = "number", Nilable = true }, { Name = "bidder", Type = "string", Nilable = true }, }, }, }, }; APIDocumentation:AddDocumentationTable(AuctionHouse);
local ft = {} local function clonefunction(func, env) return load(string.dump(func, true), nil, "b", env); end local function instantiateClass(inst_class_tbl, ...) local inst_tbl = {} local environments = {}; local constructors = {} local function builderrormessage(msg) return "Cannot make an instance of the class '" .. ft.type(inst_class_tbl) .. "'.\n[Reason] " .. msg .. "\n"; end local function extendmethodenv(env, class_tbl) local _ = class_tbl._ft_base and extendmethodenv(env, class_tbl._ft_base); if class_tbl[1] and ft.type.istable(class_tbl[1]) then for k, v in pairs(class_tbl[1]) do if env[k] then error(builderrormessage("Duplicate field name '" .. k .. "' found in method environment extension of class '" .. ft.type(class_tbl) .. "'."), 0); end if ft.type.isboolean(v) or ft.type.isnumber(v) or ft.type.isstring(v) then error(builderrormessage("Invalid type '" .. ft.type(v) .. "' found in method environment extension of class '" .. ft.type(class_tbl) .. "'."), 0); end env[k] = v; end end return env; end local createmethods; -- forward declaration local function createmethod(func, inst_tbl, class_tbl) -- method environment local envKey = tostring(class_tbl); local env = environments[envKey]; if not env then env = extendmethodenv({ this = inst_tbl; }, class_tbl); environments[envKey] = env; -- super if class_tbl._ft_base then env.super = createmethods({}, class_tbl._ft_base); end end -- create the method local method = clonefunction(func); local i = 1; local up = debug.getupvalue(func, i); while up do if up == "_ENV" then debug.setupvalue(method, i, env); elseif env[up] then error(builderrormessage("Ambiguous method environment found in '" .. ft.type(class_tbl) .. "': there is an upvalue with the same name '" .. up .. "'"), 0); else debug.upvaluejoin(method, i, func, i); end i = i + 1; up = debug.getupvalue(func, i); end; return method; end createmethods = function(where, class_tbl) for k, v in pairs(class_tbl) do local funcIsUtility = (string.find(k, "_ft_") == 1) if not where[k] then if ft.type.isfunction(v) and not funcIsUtility then local method = createmethod(v, inst_tbl, class_tbl); if k == "constructor" then constructors[class_tbl] = method; else where[k] = method; end elseif ft.type.isfunction(v) and funcIsUtility then where[k] = v; elseif not ft.type.isfunction(v) and not (ft.type.istable(v) and k == 1) then error(builderrormessage("Invalid class syntax. Field named '" .. k .. "' of type '" .. ft.type(v) .. "' not allowed in class definition."), 0); end end end return class_tbl._ft_base and createmethods(where, class_tbl._ft_base) and where or where; end createmethods(inst_tbl, inst_class_tbl); -- invoke constructor local function invokeconstructor(class_tbl, ...) if class_tbl._ft_base then invokeconstructor(class_tbl._ft_base) end local _ = constructors[class_tbl] and constructors[class_tbl](...); end invokeconstructor(inst_class_tbl, ...); return inst_tbl; end; local function defineClass(classpath, base, classdef) local class_tbl = { }; for k,v in pairs(classdef) do class_tbl[k] = v; end -- static methods for each instance - dont have this and super local namespace = (string.gsub(classpath, "(.*)%.%a$", "%1")); local classtype = "[class " .. tostring(classpath) .. "]"; function class_tbl._ft_getclassname () return classpath; end function class_tbl._ft_gettype () return classtype; end function class_tbl._ft_getbasetype (class_tbl) return base and base._ft_getbasetype(base) or ft.type(class_tbl); end function class_tbl._ft_issubclassof (x) return ((ft.type(class_tbl) == ft.type(x)) or (base and base._ft_issubclassof(x))) == true; end -- meta local class_mtbl = { _ft_base = base; __metatable = {}; __call = instantiateClass; } function class_mtbl.__index(self, key) return class_mtbl[key]; end return setmetatable(class_tbl, class_mtbl); end; ft.class = {_ft_ns = "ft.class", _ft_nspath = "ft.class"}; local class_functor_mtbl = {__metatable = {}}; function class_functor_mtbl.__call(self, ...) if ft.type.isclass(self._ft_classdef) then local status, result = pcall(self._ft_classdef, ...); return status and result or ft.exception(result, 1); else local arg = {...}; local base = arg[1]; local baseclass = ft.type.isclass(base) and ft.type.isclass(base._ft_classdef) and base._ft_classdef or ft.type.isclass(base) and base or nil; if base and not baseclass then ft.exception("invalid base class provided. Expected '[class <classname>]' got '" .. ft.type(base) .. "'", 1); end return function(classdef) local status, result = pcall(defineClass, self._ft_nspath, baseclass, classdef); if not status then ft.exception(result, 1) end self._ft_classdef = result; self._ft_gettype = function() return ft.type(self._ft_classdef); end; return self._ft_classdef; end; end; end; function class_functor_mtbl.__index(this, key) if string.sub(key, 1, string.len("_ft_"))=="_ft_" then return rawget(this, key); end; local val = rawget(this, key) or setmetatable({_ft_ns = key, _ft_nspath = rawget(this, "_ft_nspath") .. "." .. key}, class_functor_mtbl); rawset(this, key, val); return val; end; setmetatable(ft.class, { __index = class_functor_mtbl.__index; }); ------------- type ------------- ft.type = setmetatable({ -- base types validation isnil = function(x) return x == nil; end; isboolean = function(x) return ft.type(x) == "boolean"; end; isstring = function(x) return ft.type(x) == "string"; end; isnumber = function(x) return ft.type(x) == "number"; end; isfunction = function(x) return ft.type(x) == "function"; end; istable = function(x) return ft.type(x) == "table"; end; istablelike = function(x) return type(x) == "table"; end; isclass = function(x) local _,_,c = string.find(ft.type(x), "%[(class) ft%.class[%.%a%d]+%]") return c == "class" end; -- compare types issame = function(x, y) return ft.type(x) == ft.type(y); end; isdifferent = function(x, y) return ft.type(x) ~= ft.type(y); end; issamebase = function(x, y) return ft.type.getbasetype(x) == ft.type.getbasetype(y); end; issubclass = function(x, y) return ft.type.isclass(x) and x._ft_issubclassof(y) or ft.type.issame(x, y); end; getbasetype = function(x) if ft.type.isclass(x) then return x._ft_getbasetype() end return ft.type(x) end; }, { __call = function(this, x) local t = type(x) -- handle custom types if t == "table" and ft.type.isfunction(x._ft_gettype) then t = x._ft_gettype() end return t end }); ------------- exception ------------- function ft.exception(msg, level) error("[Error] " .. debug.traceback(msg, (level or 0) + 2)); os.exit(-1); end return ft;
local backgroundTexture = game.getTexture("res/menu_bg.png") local buttonTexture = game.getTexture("res/button_small.png") local function createWorldSelectButton(menu, slot) local selector = menu:addButton("Create New World") if slot == 0 then local name = "World Name" local date = "01/01/20" selector.text = name .. '/' .. date selector.onClick = function() game.gui():change("transition", { message = "Starting Game" } ) game.control():loadWorld("Test") end else selector.onClick = function() game.gui():push("new_world") end end end local function onCreate(overlay) local menu = StackMenu:create(900, overlay, 15, "Play World") menu:pad(50) menu:setBackground(backgroundTexture) for characterSlot = 0, 4 do createWorldSelectButton(menu, characterSlot) end local joinWorldButton = overlay:addButton() joinWorldButton.textSize = 50 joinWorldButton.text = "Join World" joinWorldButton.image = buttonTexture joinWorldButton.size = GuiDim.new(0, 400, 0, 90) joinWorldButton.position = GuiDim.new(0.75, 0, 0.8, 0) setHighlightOnMouseOver(joinWorldButton) joinWorldButton.onClick = function() game.gui():push("join_world") end menu:pad(50) menu:addBackButton() end game.gui():addGui{ id = "world_select", create = onCreate, }
--config.lua local ticks_per_update = settings.startup["ret-ticks-per-update"].value function store(power) return power / 60 * (ticks_per_update + 5) end config = { pole_max_wire_distance = 17, pole_supply_area = 4, -- Refills the buffer until the next update pole_flow_limit = 4800000, -- Pole enable buffer (1kJ) pole_enable_buffer = 1000, -- Locomotive Mk 1 (600kW, like vanilla) locomotive_power = 600000, locomotive_storage = store(1200000), -- Locomotive Mk 2 (1.2MW, two times vanilla) advanced_locomotive_power = 1200000, advanced_locomotive_storage = store(2400000), -- Modular Locomotive (1.8MW, three times vanilla) modular_locomotive_base_power = 1800000, modular_locomotive_storage = store(3600000) } function toW(value) return string.format("%dW", value) end function toJ(value) return string.format("%dJ", value) end -- ### Mod compatibility ### -- increase flow limit if train overhaul is installed if settings.startup["train-overhaul-power-multiplicator"] then config.pole_flow_limit = 9600000 * settings.startup["train-overhaul-power-multiplicator"].value end
local log = require("log") local Api = require("coreApi") local json = require("json") local http = require("http") function ReceiveFriendMsg(CurrentQQ, data) return 1 end function ReceiveGroupMsg(CurrentQQ, data) if string.find(data.Content, ".gayhub") == 1 then Api.Api_SendMsg(--调用发消息的接口 CurrentQQ, { toUser = data.FromGroupId, --回复当前消息的来源群ID sendToType = 2, --2发送给群1发送给好友3私聊 sendMsgType = "TextMsg", --进行文本复读回复 groupid = 0, --不是私聊自然就为0咯 content = "lua插件:https://github.com/XJLZ/LuaPlugins \nNodejs版:https://github.com/XJLZ/IOTBOT-Node.js", --回复内容 atUser = 0 --是否 填上data.FromUserId就可以复读给他并@了 } ) end return 1 end function ReceiveEvents(CurrentQQ, data, extData) return 1 end
class = require 'pl.class' M = require 'pl.Map' S = require 'pl.Set' List = require 'pl.List' asserteq = require 'pl.test' . asserteq asserteq2 = require 'pl.test' . asserteq2 MultiMap = require 'pl.MultiMap' OrderedMap = require 'pl.OrderedMap' s1 = S{1,2} s2 = S{1,2} -- equality asserteq(s1,s2) -- union asserteq(S{1,2} + S{2,3},S{1,2,3}) -- intersection asserteq(S{1,2} * S{2,3}, S{2}) -- symmetric_difference asserteq(S{1,2} ^ S{2,3}, S{1,3}) m = M{one=1,two=2} asserteq(m,M{one=1,two=2}) m:update {three=3,four=4} asserteq(m,M{one=1,two=2,three=3,four=4}) class.Animal() function Animal:_init(name) self.name = name end function Animal:__tostring() return self.name..': '..self:speak() end class.Dog(Animal) function Dog:speak() return 'bark' end class.Cat(Animal) function Cat:_init(name,breed) self:super(name) -- must init base! self.breed = breed end function Cat:speak() return 'meow' end Lion = class(Cat) function Lion:speak() return 'roar' end fido = Dog('Fido') felix = Cat('Felix','Tabby') leo = Lion('Leo','African') asserteq(tostring(fido),'Fido: bark') asserteq(tostring(felix),'Felix: meow') asserteq(tostring(leo),'Leo: roar') assert(Dog:class_of(fido)) assert(fido:is_a(Dog)) assert(leo:is_a(Animal)) m = MultiMap() m:set('john',1) m:set('jane',3) m:set('john',2) ms = MultiMap{john={1,2},jane={3}} asserteq(m,ms) m = OrderedMap() m:set('one',1) m:set('two',2) m:set('three',3) asserteq(m:values(),List{1,2,3}) -- usually exercized like this: --for k,v in m:iter() do print(k,v) end fn = m:iter() asserteq2 ('one',1,fn()) asserteq2 ('two',2,fn()) asserteq2 ('three',3,fn()) o1 = OrderedMap {{z=2},{beta=1},{name='fred'}} asserteq(tostring(o1),'{z=2,beta=1,name="fred"}') -- order of keys is not preserved here! o2 = OrderedMap {z=4,beta=1.1,name='alice',extra='dolly'} o1:update(o2) asserteq(tostring(o1),'{z=4,beta=1.1,name="alice",extra="dolly"}') o1:set('beta',nil) asserteq(o1,OrderedMap{{z=4},{name='alice'},{extra='dolly'}}) o3 = OrderedMap() o3:set('dog',10) o3:set('cat',20) o3:set('mouse',30) asserteq(o3:keys(),{'dog','cat','mouse'}) o3:set('dog',nil) asserteq(o3:keys(),{'cat','mouse'}) -- Vadim found a problem when clearing a key which did not exist already. -- The keys list would then contain the key, although the map would not o3:set('lizard',nil) asserteq(o3:keys(),{'cat','mouse'}) asserteq(o3:values(), {20,30}) asserteq(tostring(o3),'{cat=20,mouse=30}') -- copy constructor o4 = OrderedMap(o3) asserteq(o4,o3) -- constructor throws an error if the argument is bad -- (errors same as OrderedMap:update) asserteq(false,pcall(function() m = OrderedMap('string') end)) ---- changing order of key/value pairs ---- o3 = OrderedMap{{cat=20},{mouse=30}} o3:insert(1,'bird',5) -- adds key/value before specified position o3:insert(1,'mouse') -- moves key keeping old value asserteq(o3:keys(),{'mouse','bird','cat'}) asserteq(tostring(o3),'{mouse=30,bird=5,cat=20}') o3:insert(2,'cat',21) -- moves key and sets new value asserteq(tostring(o3),'{mouse=30,cat=21,bird=5}') -- if you don't specify a value for an unknown key, nothing happens to the map o3:insert(3,'alligator') asserteq(tostring(o3),'{mouse=30,cat=21,bird=5}')
-- Hit-reg Fix by Devieth -- Script for SAPP and Chimera -- Default = 0.08 -- Recommended = 0.05 -- Minimum = 0.045 -- Above 0.08 hit-reg gets worse, unless you want that... -- Below 0.03 headshots STOP WORKING ENTIRELY!!! value = 0.046 -- Force enable the fix every time the script is loaded/reloaded. -- **Warning** If the script loads and no map is loaded the server WILL crash. force_enable = false api_version = "1.10.0.0" -- SAPP clua_version = 2.05 -- Chimera if full_build then set_callback("map load", "OnGameStart") end ce, client_info_size = 0x40, 0xEC function OnScriptLoad() register_callback(cb['EVENT_GAME_START'], "OnGameStart") --register_callback(cb['EVENT_TICK'], "loop") object_table = read_dword(read_dword(sig_scan("8B0D????????8B513425FFFF00008D") + 2)) network_struct = read_dword(sig_scan("F3ABA1????????BA????????C740??????????E8????????668B0D") + 3) --timer(100, "loop") end player_objects = {} function loop() for i = 1,16 do if player_present(i) then local client_machineinfo_struct = get_client_machine_info(i) local melee = read_bit(client_machineinfo_struct + 0x24, 7) if melee == 1 then write_bit(client_machineinfo_struct + 0x24, 7, 0) else write_bit(client_machineinfo_struct + 0x24, 7, 1) end end end return true end function get_client_machine_info(PlayerIndex) if player_present(PlayerIndex) then return network_struct + 0x3B8 + ce + to_real_index(PlayerIndex) * client_info_size else return network_struct + 0x3B8 + ce + (tonumber(PlayerIndex) - 1) * client_info_size end end function get_client_network_struct(PlayerIndex) if player_present(PlayerIndex) then return network_struct + 0x1AA + ce + to_real_index(PlayerIndex) * 0x20 else return network_struct + 0x1AA + ce + (tonumber(PlayerIndex) - 1) * 0x20 end end function OnScriptUnload() end function OnGameStart() if full_build then set_timer(66, "hit_reg_fix") else timer(66, "hit_reg_fix") end end function hit_reg_fix() -- Lets loop through all the tags (doing this so this script even works on custom maps.) for i = 0, read_word(0x4044000C) - 1 do local tag = read_dword(0x40440000) + i * 0x20 local tag_class = string.reverse(string.sub(read_string(tag),1,4)) local tag_address = read_dword(tag + 0x14) -- Is the tag a bipd tag? if tag_class == "bipd" then -- If the it is a bipd tag lets change the auto_aim_width to a smaller value. -- Doing this makes the auto_aim (bullet curving) pull more accurately pull to the body parts. write_float(tag_address + 0x458, value) end end return false end
local awful = require("awful") local beautiful = require("beautiful") local keys = require("core.keys") local env = require("environment") awful.rules.rules = { -- all clients { rule = { }, properties = { border_width = beautiful.border_width, border_color = beautiful.border_normal, focus = awful.client.focus.filter, maximized_horizontal = false, maximized_vertical = false, maximized = false, raise = true, keys = keys.clientkeys, buttons = keys.clientbuttons, screen = awful.screen.preferred, placement = awful.placement.no_overlap+awful.placement.no_offscreen, size_hints_honor = false, } }, -- titlebars { rule_any = { type = { "dialog", "normal" } }, properties = { titlebars_enabled = true } }, { rule = { name = "MPlayer" }, properties = { floating = true } }, -- feh { rule_any = { class = {"feh","Lxappearance","Blueman-manager"} }, properties = { floating = true, placement = awful.placement.centered, buttons = nil, keys = nil, sticky = true, titlebars_enabled = false, }, }, --firefox { rule_any = { class = {"firefox","Google-chrome"} }, properties = { tag = env.taglist[2] } }, --URxvt { rule = { class = "URxvt" }, properties = { tag = env.taglist[1] } }, --visual studio code { rule = { class = "Code" }, properties = { tag = env.taglist[3] } }, --thunar { rule = { class = "Thunar" }, properties = { tag = env.taglist[4] } }, --qBittorrent { rule_any = { class = {"qBittorrent","hakuneko-desktop","YACReaderLibrary","Inkscape","Gimp"} }, properties = { tag = env.taglist[5] } } }
return [[ dotfiles for osx Currently using the following: * iTerm2 terminal * Terminal theme: Profiles->Colors->Color Presets...-> srcery_iterm ]]
slot0 = class("WorldAtlas", import("...BaseEntity")) slot0.Fields = { achEntranceList = "table", sairenEntranceList = "table", replaceDic = "table", config = "table", costMapDic = "table", mapDic = "table", activeEntranceId = "number", areaEntranceList = "table", pressingMapList = "table", portEntranceList = "table", activeMapId = "number", taskMarkDic = "table", world = "table", transportDic = "table", treasureMarkDic = "table", id = "number", entranceDic = "table", taskPortDic = "table", mapEntrance = "table" } slot0.EventUpdateProgress = "WorldAtlas.EventUpdateProgress" slot0.EventUpdateActiveEntrance = "WorldAtlas.EventUpdateActiveEntrance" slot0.EventUpdateActiveMap = "WorldAtlas.EventUpdateActiveMap" slot0.EventAddPressingMap = "WorldAtlas.EventAddPressingMap" slot0.EventAddPressingEntrance = "WorldAtlas.EventAddPressingEntrance" slot0.EventUpdatePortTaskMark = "WorldAtlas.EventUpdatePortTaskMark" slot0.ScaleShrink = 1 slot0.ScaleFull = 2 slot0.ScaleExpand = 3 slot0.ScaleHalf = 4 slot0.Scales = { slot0.ScaleShrink, slot0.ScaleHalf, slot0.ScaleFull } slot0.Build = function (slot0) slot0.entranceDic = {} slot0.mapDic = {} slot0.taskMarkDic = {} slot0.treasureMarkDic = {} slot0.sairenEntranceList = {} slot0.costMapDic = {} slot0.pressingMapList = {} slot0.transportDic = {} slot0.taskPortDic = {} end slot0.Dispose = function (slot0) WPool:ReturnMap(slot0.entranceDic) WPool:ReturnMap(slot0.mapDic) slot0:Clear() end slot0.Setup = function (slot0, slot1) slot0.id = slot1 slot0.config = pg.world_expedition_data_by_map[slot0.id] slot0:BuildEntranceDic() end slot0.NewEntrance = function (slot0, slot1) slot2 = WPool:Get(WorldEntrance) slot2:Setup(slot1, slot0) slot0.entranceDic[slot1] = slot2 return slot2 end slot0.NewMap = function (slot0, slot1) slot2 = WPool:Get(WorldMap) slot2:Setup(slot1) slot0.mapDic[slot1] = slot2 return slot2 end slot0.BuildEntranceDic = function (slot0) slot1 = { { field = "stage_chapter", name = "step" }, { field = "task_chapter", name = "task" }, { field = "teasure_chapter", name = "treasure" } } slot0.mapEntrance = {} slot0.areaEntranceList = {} slot0.portEntranceList = {} slot0.achEntranceList = {} slot0.replaceDic = { step = {}, task = {}, treasure = {}, open = { {}, {} } } _.each(pg.world_chapter_colormask.all, function (slot0) if pg.world_chapter_colormask[slot0].world ~= slot0.id then return end slot0.areaEntranceList[slot3] = slot0.areaEntranceList[slot0:NewEntrance(slot0).GetAreaId(slot2)] or {} table.insert(slot0.areaEntranceList[slot3], slot0) if slot2:HasPort() then slot0.portEntranceList[slot4] = slot0.portEntranceList[slot2:GetPortId()] or {} table.insert(slot0.portEntranceList[slot4], slot0) end for slot7, slot8 in ipairs(slot1) do for slot12, slot13 in ipairs(slot2.config[slot8.field]) do if slot8.name == "step" then for slot17 = slot13[1], slot13[2], 1 do slot0.replaceDic[slot8.name][slot17] = slot0.replaceDic[slot8.name][slot17] or {} slot0.replaceDic[slot8.name][slot17][slot0] = slot2 end else slot0.replaceDic[slot8.name][slot13[1]] = slot0.replaceDic[slot8.name][slot13[1]] or {} slot0.replaceDic[slot8.name][slot13[1]][slot0] = slot2 end end end if #slot2.config.normal_target > 0 or #slot2.config.cryptic_target > 0 then table.insert(slot0.achEntranceList, slot2) end slot0.mapEntrance[slot1.chapter] = slot2 slot0.replaceDic.open[1][slot0:NewMap(slot4).config.open_stage[1]] = slot0.replaceDic.open[1][slot0.NewMap(slot4).config.open_stage[1]] or {} slot0.replaceDic.open[1][slot5.config.open_stage[1]][slot0] = 1 slot0.replaceDic.open[2][slot5.config.open_stage[2]] = slot0.replaceDic.open[2][slot5.config.open_stage[2]] or {} slot0.replaceDic.open[2][slot5.config.open_stage[2]][slot0] = 1 end) end slot0.GetEntrance = function (slot0, slot1) return slot0.entranceDic[slot1] end slot0.SetActiveEntrance = function (slot0, slot1) if slot0.activeEntranceId ~= slot1.id then slot0.activeEntranceId = slot1.id slot0:DispatchEvent(slot0.EventUpdateActiveEntrance, slot1) end end slot0.GetActiveEntrance = function (slot0) return slot0.activeEntranceId and slot0:GetEntrance(slot0.activeEntranceId) end slot0.GetMap = function (slot0, slot1) if not slot0.mapDic[slot1] then slot0:NewMap(slot1) end return slot0.mapDic[slot1] end slot0.SetActiveMap = function (slot0, slot1) if slot0.activeMapId ~= slot1.id then slot0.activeMapId = slot1.id slot0:DispatchEvent(slot0.EventUpdateActiveMap, slot1) end end slot0.GetActiveMap = function (slot0) return slot0.activeMapId and slot0:GetMap(slot0.activeMapId) end slot0.GetDiscoverRate = function (slot0) return 0 end slot0.CheckMapActive = function (slot0, slot1) return slot0:GetMap(slot1).active or _.any(_.values(slot0:GetPartMaps(slot1)), function (slot0) return slot0.active end) end slot0.GetAtlasPixelSize = function (slot0) return Vector2(slot0.config.size[1], slot0.config.size[2]) end slot0.GetAchEntranceList = function (slot0) return slot0.achEntranceList end slot0.GetOpenEntranceDic = function (slot0, slot1) return slot0.replaceDic.open[nowWorld:GetRealm()][slot1] or {} end slot0.GetStepDic = function (slot0, slot1) return slot0.replaceDic.step[slot1] or {} end slot0.GetTaskDic = function (slot0, slot1) return slot0.replaceDic.task[slot1] or {} end slot0.GetTreasureDic = function (slot0, slot1) return slot0.replaceDic.treasure[slot1] or {} end slot0.UpdateProgress = function (slot0, slot1, slot2) slot3 = {} for slot7 = slot1 + 1, slot2, 1 do for slot11 in pairs(slot0:GetOpenEntranceDic(slot7)) do slot3[slot11] = 1 end end slot0:DispatchEvent(slot0.EventUpdateProgress, slot3) slot3 = {} for slot7 in pairs(slot0:GetStepDic(slot2)) do slot3[slot7] = 1 end for slot7 in pairs(slot0:GetStepDic(slot1)) do slot3[slot7] = (slot3[slot7] or 0) - 1 end for slot7, slot8 in pairs(slot3) do if slot8 ~= 0 then slot0.entranceDic[slot7]:UpdateDisplayMarks("step", slot8 > 0) end end end slot0.UpdateTask = function (slot0, slot1) slot3 = (slot1:getState() == WorldTask.STATE_ONGOING and 1) or 0 slot3 = slot3 - ((slot0.taskMarkDic[slot1.id] and 1) or 0) slot0.taskMarkDic[slot1.id] = slot2 for slot7 in pairs(slot0:GetTaskDic(slot1.id)) do if slot1.config.type == 0 then slot0.entranceDic[slot7]:UpdateDisplayMarks("task_main", slot3 > 0) else slot0.entranceDic[slot7]:UpdateDisplayMarks("task", slot3 > 0) end end slot4 = slot1:GetFollowingEntrance() if slot3 ~= 0 and slot4 then if slot1.config.type == 0 then slot0.entranceDic[slot4]:UpdateDisplayMarks("task_following_main", slot3 > 0) else slot0.entranceDic[slot4]:UpdateDisplayMarks("task_following", slot3 > 0) end end end slot0.UpdateTreasure = function (slot0, slot1) slot5 = (nowWorld.GetInventoryProxy(slot2).GetItemCount(slot3, slot1) > 0 and 1) or 0 slot5 = slot5 - ((slot0.treasureMarkDic[slot1] and 1) or 0) slot0.treasureMarkDic[slot1] = slot4 > 0 if slot5 ~= 0 then slot6 = slot2:FindTreasureEntrance(slot1) slot8 = pg.world_item_data_template[slot1].usage_arg[1] == 1 if slot8 then slot6:UpdateDisplayMarks("treasure_sairen", slot5 > 0) else slot6:UpdateDisplayMarks("treasure", slot5 > 0) end end end slot0.SetPressingMarkList = function (slot0, slot1) _.each(slot0.pressingMapList, function (slot0) slot0:GetMap(slot0):UpdatePressingMark(false) end) slot0.pressingMapList = slot1 _.each(slot0.pressingMapList, function (slot0) slot0:GetMap(slot0):UpdatePressingMark(true) end) slot0.BuildTransportDic(slot0) end slot0.BuildTransportDic = function (slot0) slot0.transportDic = {} for slot4, slot5 in pairs(slot0.entranceDic) do if slot5:IsPressing() then slot0.transportDic[slot4] = true for slot9 in pairs(slot5.transportDic) do slot0.transportDic[slot9] = true end end end if nowWorld:IsReseted() then slot0:AddPortTransportDic() end end slot0.AddPortTransportDic = function (slot0) for slot4, slot5 in pairs(slot0.portEntranceList) do for slot9, slot10 in ipairs(slot5) do slot0.transportDic[slot10] = true end end end slot0.MarkMapTransport = function (slot0, slot1) if slot0.mapEntrance[slot1] then slot0.transportDic[slot2.id] = true end end slot0.AddPressingMap = function (slot0, slot1) if _.any(slot0.pressingMapList, function (slot0) return slot0 == slot0 end) then return else slot0.GetMap(slot0, slot1):UpdatePressingMark(true) table.insert(slot0.pressingMapList, slot1) if slot0.mapEntrance[slot1] then slot3 = { [slot2.id] = true } slot0.transportDic[slot2.id] = true for slot7 in pairs(slot2.transportDic) do if not slot0.transportDic[slot7] then slot0.transportDic[slot7] = true slot3[slot7] = true end end slot0:DispatchEvent(slot0.EventAddPressingEntrance, slot3) end slot0:DispatchEvent(slot0.EventAddPressingMap, slot1) end end slot0.SetSairenEntranceList = function (slot0, slot1) _.each(slot0.sairenEntranceList, function (slot0) slot1 = slot0:GetEntrance(slot0) slot1:UpdateSairenMark(false) slot1:UpdateDisplayMarks("sairen", false) end) slot0.sairenEntranceList = slot1 _.each(slot0.sairenEntranceList, function (slot0) slot1 = slot0:GetEntrance(slot0) slot1:UpdateSairenMark(true) slot1:UpdateDisplayMarks("sairen", true) end) end slot0.RemoveSairenEntrance = function (slot0, slot1) if table.indexof(slot0.sairenEntranceList, slot1.id) then table.remove(slot0.sairenEntranceList, slot2) slot1:UpdateSairenMark(false) slot1:UpdateDisplayMarks("sairen", false) end end slot0.SetCostMapList = function (slot0, slot1) for slot5 in pairs(slot0.costMapDic) do slot0:GetMap(slot5).isCost = false end slot0.costMapDic = {} _.each(slot1, function (slot0) slot0.costMapDic[slot0.random_id] = true slot0:GetMap(slot0.random_id).isCost = true end) end slot0.UpdateCostMap = function (slot0, slot1, slot2) if not slot0.costMapDic[slot1] and slot2 then nowWorld:ClearAllFleetDefeatEnemies() end slot0.costMapDic[slot1] = slot2 end slot0.SetPortTaskList = function (slot0, slot1) slot0.taskPortDic = {} for slot5, slot6 in ipairs(slot1) do slot0.taskPortDic[slot6] = true end end slot0.UpdatePortTaskMark = function (slot0, slot1, slot2) if tobool(slot0.taskPortDic[slot1]) ~= slot2 then slot0.taskPortDic[slot1] = slot2 slot3 = {} for slot7, slot8 in ipairs(slot0.portEntranceList[slot1]) do slot3[slot8] = true end slot0:DispatchEvent(slot0.EventUpdatePortTaskMark, slot3) end end return slot0
local function clientReset(player) -- assert(typeof(playerId) == "string") return { type = script.Name, playerId = tostring(player.UserId), playerName = tostring(player.Name), replicateTo = tostring(player.UserId), } end return clientReset
UT.Driving = {} UT.Driving.units = {} local settings = UT.getSettings() UT.Driving.packagesLoaded = settings.loadPackages function UT.Driving.setPackagesLoading(value) local settings = UT.getSettings() settings.loadPackages = value UT.setSettings(settings) if value then UT.showMessage("packages loading enabled", UT.colors.enabled) if not UT.Driving.packagesLoaded then UT.showMessage(UT.messages.restartHeist, UT.colors.info) end else UT.showMessage("packages loading disabled", UT.colors.disabled) end end function UT.Driving.removeVehicles() if game_state_machine:current_state_name() == "ingame_driving" then managers.player:set_player_state("standard") end local count = 0 for key, unit in pairs(UT.Driving.units) do if not alive(unit) then goto continue end unit:set_position(Vector3(0, 0, -10000)) unit:set_rotation(Rotation(0, 0, 0)) count = count + 1 ::continue:: end UT.Driving.units = {} UT.showMessage("removed " .. tostring(count) .. " vehicle" .. (count > 1 and "s" or ""), UT.colors.info) end function UT.Driving.spawnVehicle(id) if not UT.Driving.packagesLoaded then UT.showMessage("you must first load packages", UT.colors.error) return end if LuaNetworking:GetNumberOfPeers() > 0 then UT.showMessage("you must be alone in the game", UT.colors.error) return end local vehiclePosition = UT.getPlayerPosition() local vehicleRotation = UT.getCameraRotationFlat() local playerPosition = Vector3(vehiclePosition[1], vehiclePosition[2], vehiclePosition[3] + 350) local playerRotation = UT.getCameraRotation() local unit = UT.spawnUnit(Idstring(id), vehiclePosition, vehicleRotation) if not unit then return end UT.teleportation(playerPosition, playerRotation) table.insert(UT.Driving.units, unit) end UTClassDriving = true
local dap = require('dap') dap.set_log_level('TRACE'); -- Enable virtual text. vim.g.dap_virtual_text = true -- Setup for debugging in Node dap.adapters.node2 = { type = 'executable', command = 'node', args = {os.getenv('HOME') .. '/vscode-node-debug2/out/src/nodeDebug.js'}, } -- Setup for debugging in Chrome dap.adapters.chrome = { type = "executable", command = "node", args = {os.getenv("HOME") .. "/vscode-chrome-debug/out/src/chromeDebug.js"} } -- Configurations local js_for_chrome = { "typescript", "javascriptreact", "typescriptreact", } for _, lang in ipairs(js_for_chrome) do dap.configurations[lang] = { { type = "chrome", request = "attach", program = "${file}", cwd = vim.fn.getcwd(), sourceMaps = true, protocol = "inspector", port = 9222, webRoot = "${workspaceFolder}" } } end dap.configurations.javascript = { { type = 'node2', request = 'launch', program = '${file}', cwd = vim.fn.getcwd(), sourceMaps = true, protocol = 'inspector', console = 'integratedTerminal', }, { type = "chrome", request = "attach", program = "${file}", cwd = vim.fn.getcwd(), sourceMaps = true, protocol = "inspector", port = 9222, webRoot = "${workspaceFolder}" } }
local console = require 'console' function love.load() -- Step 1: load console, parameters are optional, defaults enumerated below -- The key to open/close console == ` -- font size == 14 -- false = no key repeat by default, pressing (and not releasing backspace) will act in a strange way -- nil == function called when user press return, see console.lua and defaultInputCallback function -- It is fine not to run console.load() console.load(love.graphics.newFont("inconsolata/Inconsolata.otf", 16)) console.defineCommand( -- How to create a custom command "hello", "Print 'Hello World'.", function() console.i("Hello World!!!") end ) console.defineCommand( -- Custom command tree "test", "test arguements", function(...) local cmd = {} for i = 1, select("#", ...) do cmd[i] = tostring(select(i, ...)) end if cmd[1] == "help" then console.i("* How to use multiple custom args.") console.i("* Commands:") console.i("test one") console.i("test two") console.i("test three alpha") console.i("test three bravo [msg]") return elseif cmd[1] == "one" then console.d("one") return elseif cmd[1] == "two" then console.d("two") return elseif cmd[1] == "three" then if cmd[2] == "alpha" then console.d("three alpha") elseif cmd[2] == "bravo" then if cmd[3] then console.d("three bravo " .. cmd[3]) else console.e("Wrong Syntax!") end else console.e("Wrong Syntax!") end return else console.e("Wrong Syntax!") end end, true ) end function love.update( dt ) -- Step 2: Make sure that you update console with dt console.update(dt) -- Use it console.i(msg), console.d(msg), console.e(msg) -- if somethingHappend then -- console.i("Something ...") -- end end function love.draw() drawGrid() -- Step 3: draw console last inside the 'love.draw' function console.draw() end function love.keypressed(key) -- Step 4: let console consume keys so that it can open and close (default `) and consume user input while open if console.keypressed(key) then return end if key == "escape" then love.event.quit() end end function love.textinput(t) console.textinput(t) end function love.resize( w, h ) -- Step 5: If your application allows a resize-able window, then call console.resize on love.resize console.resize(w, h) end function love.mousepressed(x, y, button) -- Step 6: When the console is open, the mouse scrolls the console text if console.mousepressed(x, y, button) then return end end function drawGrid( ) for i =0, math.floor(1920/100) do for j=0, math.floor(1080/100) do if (i + j) % 2 == 0 then love.graphics.setColor(255/255, 255/255, 255/255, 200/255) else love.graphics.setColor(255/255, 255/255, 255/255, 220/255) end love.graphics.rectangle("fill", i*100, j*100, 100, 100) end end end
-- Copyright (c) 2021 Trevor Redfern -- -- This software is released under the MIT License. -- https://opensource.org/licenses/MIT local Thunk = require "moonpie.redux.thunk" local Aliens = require "game.rules.aliens" local Camera = require "game.ui.camera" local Character = require "game.rules.character" local FieldOfView = require "game.rules.field_of_view" local FogOfWar = require "game.rules.fog_of_war" local GameState = require "game.rules.game_state" local NPCs = require "game.rules.npcs" local Player = require "game.rules.player" local Stats = require "game.rules.stats" local Actions = {} Actions.types = require "game.rules.turn.types" function Actions.process(player_action) return Thunk(Actions.types.PROCESS, function(dispatch, getState) dispatch(Stats.actions.count(1, Stats.keys.turnCounter)) dispatch(player_action) local enemies = NPCs.selectors.getEnemies(getState()) if enemies then for _, e in ipairs(enemies) do dispatch(NPCs.actions.think(e)) end end local spawners = Aliens.selectors.getSpawners(getState()) if spawners then for _, spawner in ipairs(spawners) do dispatch(NPCs.actions.checkSpawnEnemy(spawner)) end end -- Check for dead characters local dead = Character.selectors.getDead(getState()) if dead then for _, e in ipairs(dead) do dispatch(Character.actions.remove(e)) end end -- Update camera position to follow character local cam = Camera.selectors.get(getState()) if cam then dispatch(Camera.actions.centerOnPlayer(cam.width, cam.height)) end -- Update FoV for characters dispatch(FieldOfView.actions.calculateAll()) -- Player Fog of War local player = Player.selectors.getPlayer(getState()) dispatch(FogOfWar.actions.updatePerspective(player)) dispatch(GameState.actions.checkGameOver()) end) end return Actions
module(...,package.seeall) require "sys" require "audio" require "net" require "misc" require "lvsym" scr0 = nil scr1 = nil sign = nil menu_btn = nil ret_btn = nil menu_page = nil is_hidden = true clock = nil key_number = lvgl.KEY_NEXT key_pending = false key_state = lvgl.INDEV_STATE_REL local function menu_item_event_cb(label, event) --if (label == nil) then -- return --end --if (event == lvgl.EVENT_FOCUSED) then -- sys.timerStart(lvgl.page_focus, 500, menu_page, label, lvgl.ANIM_ON) lvgl.page_focus(menu_page, label, lvgl.ANIM_ON) --end end local function update_sign() quality = net.getRssi() lvgl.img_set_src(sign, lvgl.SYMBOL_BATTERY_FULL) end local function btn_event_cb(btn, event) if (btn == nil) then return end --if (event == lvgl.EVENT_CLICKED) then --toggle_menu_page() if (btn == menu_btn) then lvgl.obj_set_hidden(menu_page, false) else lvgl.obj_set_hidden(menu_page, true) end --end end local function send_to_menu_btn() lvgl.event_send(menu_btn, lvgl.EVENT_CLICKED, nil) end local function send_to_ret_btn() lvgl.event_send(ret_btn, lvgl.EVENT_CLICKED, nil) end local function show_scr1() lvgl.disp_load_scr(scr1) -- sys.timerStart(show_menu, 2000) sys.timerStart(send_to_menu_btn, 2000) sys.timerStart(send_to_ret_btn, 10000) end local function create() th = lvgl.theme_material_init(80, nil) lvgl.theme_set_current(th) scr0 = lvgl.cont_create(nil, nil) scr1 = lvgl.cont_create(nil, nil) logo = lvgl.img_create(scr0, nil) lvgl.img_set_src(logo, "/lua/logo.jpg") lvgl.obj_align(logo, nil, lvgl.ALIGN_CENTER, 0, -40) label = lvgl.label_create(scr0, nil) lvgl.label_set_text(label, "上海合宙通信") lvgl.obj_align(label, nil, lvgl.ALIGN_CENTER, 0, 50) bg = lvgl.img_create(scr1, nil) lvgl.img_set_src(bg, "/lua/bg.jpg") lvgl.obj_align(bg, nil, lvgl.ALIGN_CENTER, 0, 0) sign = lvgl.img_create(scr1, nil) lvgl.img_set_src(sign, lvgl.SYMBOL_BATTERY_FULL) lvgl.obj_align(sign, nil, lvgl.ALIGN_IN_TOP_LEFT, 2, 1) battery = lvgl.img_create(scr1, nil) lvgl.img_set_src(battery, lvgl.SYMBOL_NEW_LINE) lvgl.obj_align(battery, nil, lvgl.ALIGN_IN_TOP_RIGHT, -2, 1) clock = lvgl.label_create(scr1, nil) time = misc.getClock() lvgl.label_set_text(clock, time.hour..":"..time.min..":"..time.sec) lvgl.obj_align(clock, nil, lvgl.ALIGN_CENTER, 0, 0) menu_btn = lvgl.btn_create(scr1, nil) lvgl.obj_set_size(menu_btn, 40, 30) menu_label = lvgl.label_create(menu_btn, nil) lvgl.label_set_text(menu_label, "菜单") lvgl.obj_align(menu_btn, nil, lvgl.ALIGN_IN_BOTTOM_LEFT, 2, -1) lvgl.obj_set_event_cb(menu_btn, btn_event_cb) g = lvgl.get_keypad_group() --lvgl.group_add_obj(g, menu_btn) ret_btn = lvgl.btn_create(scr1, nil) lvgl.obj_set_size(ret_btn, 40, 30) ret = lvgl.label_create(ret_btn, nil) lvgl.label_set_text(ret, "返回") lvgl.obj_align(ret_btn, nil, lvgl.ALIGN_IN_BOTTOM_RIGHT, -2, -1) lvgl.obj_set_event_cb(ret_btn, btn_event_cb) --lvgl.group_add_obj(g, ret_btn) menu_page = lvgl.page_create(scr1, nil) lvgl.page_set_sb_mode(menu_page, lvgl.SB_MODE_AUTO) lvgl.page_set_scrl_layout(menu_page, lvgl.LAYOUT_COL_M) lvgl.obj_set_width(menu_page, lvgl.obj_get_width(scr1)) lvgl.obj_set_height(menu_page, 120) lvgl.obj_align(menu_page, nil, lvgl.ALIGN_CENTER, 0, 0) menu_opt_0 = lvgl.label_create(menu_page, nil) --menu_opts["0"] = menu_opt_0 lvgl.label_set_text(menu_opt_0, "选项0") lvgl.obj_set_width(menu_opt_0, lvgl.page_get_fit_width(menu_page)) lvgl.obj_set_event_cb(menu_opt_0, menu_item_event_cb) lvgl.group_add_obj(g, menu_opt_0) menu_opt_1 = lvgl.label_create(menu_page, nil) --menu_opts["1"] = menu_opt_1 lvgl.label_set_text(menu_opt_1, "选项1") lvgl.obj_set_width(menu_opt_1, lvgl.page_get_fit_width(menu_page)) lvgl.obj_set_event_cb(menu_opt_1, menu_item_event_cb) lvgl.group_add_obj(g, menu_opt_1) menu_opt_2 = lvgl.label_create(menu_page, nil) --menu_opts["2"] = menu_opt_2 lvgl.label_set_text(menu_opt_2, "选项2") lvgl.obj_set_width(menu_opt_2, lvgl.page_get_fit_width(menu_page)) lvgl.obj_set_event_cb(menu_opt_2, menu_item_event_cb) lvgl.group_add_obj(g, menu_opt_2) menu_opt_3 = lvgl.label_create(menu_page, nil) --menu_opts["3"] = menu_opt_3 lvgl.label_set_text(menu_opt_3, "选项3") lvgl.obj_set_width(menu_opt_3, lvgl.page_get_fit_width(menu_page)) lvgl.obj_set_event_cb(menu_opt_3, menu_item_event_cb) lvgl.group_add_obj(g, menu_opt_3) lvgl.obj_set_hidden(menu_page, is_hidden) lvgl.disp_load_scr(scr0) sys.timerStart(show_scr1, 3000) end local function keyMsg(msg) log.info("keyMsg",msg.key_matrix_row,msg.key_matrix_col,msg.pressed) if (msg.pressed) then key_state = lvgl.INDEV_STATE_PR else key_state = lvgl.INDEV_STATE_REL end key_pending = true; end rtos.on(rtos.MSG_KEYPAD,keyMsg) rtos.init_module(rtos.MOD_KEYPAD,0,0x0F,0x0F) local function input() if (key_pending) then local data = { type = lvgl.INDEV_TYPE_KEYPAD, state = key_state, key = key_number } key_pending = false return data end return nil end count = 0 local function key_event_gen() key_pending = true key_state = (count % 2) == 0 and lvgl.INDEV_STATE_PR or lvgl.INDEV_STATE_REL --lvgl.page_focus(menu_page, menu_opts[""..(count % 4)]) count = count + 1 end local function update_time() time = misc.getClock() lvgl.label_set_text(clock, time.hour..":"..time.min..":"..time.sec) end sys.timerLoopStart(update_sign, 5000) sys.timerLoopStart(update_time, 1000) sys.timerLoopStart(key_event_gen, 1000) -- sys.timerStart(lvgl.init, 5000, create, input) lvgl.init(create, input)
-- premake5.lua -- Helpers function os.winSdkVersion() local reg_arch = iif( os.is64bit(), "\\Wow6432Node\\", "\\" ) local sdk_version = os.getWindowsRegistry( "HKLM:SOFTWARE" .. reg_arch .."Microsoft\\Microsoft SDKs\\Windows\\v10.0\\ProductVersion" ) if sdk_version ~= nil then return sdk_version end end -- Premake workspace "Noctis" configurations { "Debug", "OptDebug", "Release" } location "build" -- Generate files in build folder cppdialect "C++17" -- enable C++17 features architecture "x86_64" kind "ConsoleApp" language "C++" targetdir "build/bin/" includedirs { "src" } flags { "FatalWarnings", "MultiProcessorCompile" } filter "Configurations:Debug" defines { "_DEBUG" } symbols "On" targetdir "build/bin/debug" filter "Configurations:OptDebug" defines { "NDEBUG" } symbols "On" targetdir "build/bin/optdebug" optimize "Debug" filter "Configurations:Release" defines { "NDEBUG" } symbols "On" targetdir "build/bin/release" optimize "Full" filter "system:windows" toolset (iif(_ACTION == "vs2019", "v142", "v141")) systemversion (os.winSdkVersion() .. ".0") debugdir "../workdir/" project "Noctis" files { "src/**.cpp", "src/**.hpp", "src/3rdparty/**.hxx", "**.natvis" } location "build/Noctis"
#!/usr/bin/env lua -- Copyright (c) 2016 Francois Perrad local f = arg[1] and assert(io.open(arg[1], 'r')) or io.stdin local src = string.gsub(f:read'*a', '[^><+%-%.,%[%]]', '') f:close() print[[ #!/usr/bin/env lua io.stdout:setvbuf'no' local buffer = setmetatable({}, { __index = function () return 0 -- default value end }) local ptr = 1 -- end of prologue ]] print((string.gsub(src, '.', { ['+'] = [[ buffer[ptr] = buffer[ptr] + 1 ]], ['-'] = [[ buffer[ptr] = buffer[ptr] - 1 ]], ['>'] = [[ ptr = ptr + 1 ]], ['<'] = [[ ptr = ptr - 1 ]], ['.'] = [[ io.stdout:write(string.char(buffer[ptr])) ]], [','] = [[ buffer[ptr] = string.byte(io.stdin:read(1) or '\0') ]], ['['] = [[ while buffer[ptr] ~= 0 do ]], [']'] = [[ end ]] })))
local fs = require 'diagnosticls-nvim.fs' return { sourceName = 'ts_standard', command = fs.get_executable('ts-standard', 'node'), debounce = 100, args = { '--stdin', '--stdin-filename', '%filepath', '--verbose' }, offsetLine = 0, offsetColumn = 0, formatLines = 1, formatPattern = { [[^\s*([^:]+):(\d+):(\d+):\s([^:]+)$]], { line = 2, column = 3, message = 4, }, }, rootPatterns = { '.git', '.gitignore', }, }
----------------------------------- -- Area: Selbina -- NPC: Yaya -- Starts Quest: Under the sea -- !pos -19 -2 -16 248 ----------------------------------- require("scripts/globals/quests") ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) if player:getFameLevel(SELBINA) >= 2 and player:getQuestStatus(OTHER_AREAS_LOG, tpz.quest.id.otherAreas.UNDER_THE_SEA) == QUEST_AVAILABLE then player:startEvent(31) -- Start quest "Under the sea" else player:startEvent(153) -- Standard dialog end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) if csid == 31 then player:addQuest(OTHER_AREAS_LOG, tpz.quest.id.otherAreas.UNDER_THE_SEA) player:setCharVar("underTheSeaVar", 1) end end
function Return(keys) local caster = keys.caster local attacker = keys.attacker local ability = keys.ability local level = ability:GetLevel() - 1 local strMultiplier = caster:GetStrength() * ability:GetLevelSpecialValueFor("str_to_reflection_pct", level) * 0.01 local multiplier = ((ability:GetLevelSpecialValueFor("base_reflection", level) * 0.01) + strMultiplier) local return_damage = keys.damage * multiplier if attacker:GetTeamNumber() ~= caster:GetTeamNumber() and not attacker:IsBoss() and not attacker:IsMagicImmune() and not caster:IsIllusion() and not caster:PassivesDisabled() then local pfx = ParticleManager:CreateParticle("particles/units/heroes/hero_centaur/centaur_return.vpcf", PATTACH_POINT_FOLLOW, caster) ParticleManager:SetParticleControlEnt(pfx, 0, caster, PATTACH_POINT_FOLLOW, "attach_hitloc", caster:GetAbsOrigin(), true) ParticleManager:SetParticleControlEnt(pfx, 1, attacker, PATTACH_POINT_FOLLOW, "attach_hitloc", attacker:GetAbsOrigin(), true) ApplyDamage({ victim = attacker, attacker = caster, damage = return_damage, damage_type = ability:GetAbilityDamageType(), damage_flags = DOTA_DAMAGE_FLAG_NO_SPELL_AMPLIFICATION, ability = ability }) end end
toxic_spray_trap = { click = function(block, npc) if (block.blType == BL_PC) then -- Carnage etc. if block.state == 1 then return end if not block:canPK(block) then return end end block.attacker = npc.owner removeTrapItem(npc) npc:delete() toxic_spray.cast(npc, block) block:updateState() end, endAction = function(npc, owner) removeTrap(npc) end } toxic_spray = { cast = function(player, target) local duration = 40000 if target.blType == BL_MOB then duration = 185000 end if (target.blType == BL_MOB) then if target:checkIfCast(venoms) then return end target:setDuration("toxic_spray", duration) target:sendAnimation(1) elseif (target.blType == BL_PC and target:canPK(target)) then if target:checkIfCast(venoms) then return end target:sendMinitext("Poison.") target:setDuration("toxic_spray", duration) target:sendAnimation(1) end end, while_cast = function(target) local damage = target.baseHealth *.01 if (damage > 1000) then damage = 1000 end if (damage < 1) then damage = 1 end if (target.blType == BL_PC) then target:sendAnimation(1) if (target.health > damage) then target:removeHealthExtend(damage, 0, 0, 0, 0, 0) else target.health = 1 end if os.time() % 2 == 0 then target:sendMinitext("Poison is spreading through your veins.") end target:sendAnimation(1, 5) elseif target.blType == BL_MOB then target:sendAnimation(1) if (target.health > damage) then target:removeHealthExtend(damage, 0, 0, 0, 0, 0) else target.health = 1 end end end }
Core = {}; -- Core Lib Scenes = {}; pl = {}; Debug = {}; inspect = require("Lib/Extlibs/Inspect"); pl.Date = require("Lib/Extlibs/pl/Date"); pl.List = require("Lib/Extlibs/pl/List"); pl.String = require("Lib/Extlibs/pl/stringx"); pl.Table = require("Lib/Extlibs/pl/tablex"); pl.Array2d = require("Lib/Extlibs/pl/array2d"); pl.Comprehension = require("Lib/Extlibs/pl/comprehension"); C = pl.Comprehension.new(); pl.Func = require("Lib/Extlibs/pl/func"); pl.Input = require("Lib/Extlibs/pl/input"); pl.Balanced = require("Lib/Extlibs/pl/luabalanced"); pl.Map = require("Lib/Extlibs/pl/Map"); pl.Operator = require("Lib/Extlibs/pl/operator"); pl.Permute = require("Lib/Extlibs/pl/permute"); pl.Seq = require("Lib/Extlibs/pl/seq"); pl.Sip = require("Lib/Extlibs/pl/sip"); pl.Strict = require("Lib/Extlibs/pl/strict"); pl.StringIO = require("Lib/Extlibs/pl/stringio"); pl.Set = require("Lib/Extlibs/pl/Set"); pl.Text = require("Lib/Extlibs/pl/text"); pl.Types = require("Lib/Extlibs/pl/types"); pl.Utils = require("Lib/Extlibs/pl/utils"); pl.String:import(); function LuaCore.Exists(path) local pathToTest = load("return " .. path); local noError, noNil = pcall(pathToTest); if not noError or noNil == nil then return false; end return true; end LuaCore.libList = {}; function LuaCore.IsLibLoaded(lib) for _, v in pairs(LuaCore.libList) do if v == lib then return true; end end return false; end
--*********************************************************** --** ROBERT JOHNSON ** --*********************************************************** require "TimedActions/ISBaseTimedAction" ---@class ISAddCoalInFurnace : ISBaseTimedAction ISAddCoalInFurnace = ISBaseTimedAction:derive("ISAddCoalInFurnace"); function ISAddCoalInFurnace:isValid() -- camping.updateClientCampfire(self.campfire) local playerInv = self.character:getInventory() return playerInv:contains(self.coal) end function ISAddCoalInFurnace:update() self.coal:setJobDelta(self:getJobDelta()); self.character:setMetabolicTarget(Metabolics.HeavyDomestic); end function ISAddCoalInFurnace:start() self.coal:setJobType(getText("ContextMenu_Add_fuel_to_fire")); self.coal:setJobDelta(0.0); end function ISAddCoalInFurnace:stop() ISBaseTimedAction.stop(self); self.coal:setJobDelta(0.0); self.furnace:syncFurnace(); end function ISAddCoalInFurnace:perform() self.coal:getContainer():setDrawDirty(true); self.coal:setJobDelta(0.0); local use = math.floor(self.coal:getUsedDelta()/self.coal:getUseDelta()); for i=0,use do if self.furnace:getFuelAmount() == 100 then break; end self.furnace:addFuel(10); self.coal:Use(); end self.furnace:syncFurnace(); -- camping.lightMyFire(self.campfire, self.character, self.lighter, self.petrol) -- needed to remove from queue / start next. ISBaseTimedAction.perform(self); end function ISAddCoalInFurnace:new(furnace, coal, character) local o = {} setmetatable(o, self) self.__index = self o.character = character; o.stopOnWalk = true; o.stopOnRun = true; o.maxTime = 100; -- custom fields o.furnace = furnace o.coal = coal; return o; end
-- "Test cases" for ndex and ndex-list local ndex = require('Ndex') local ndexlist = require('Ndex-list') local nondex = require('test.LoadNondex') local render = require('Render') nondex{ types = false } -- Cases tested: -- Standard -- Standard -- Base form (with alternative forms) -- Alternative form -- Useless form print(ndex.list{args={'067 398 487 487O 569Gi kubfu giratina aegislashS ', color = 'alola'}}) -- Pokémon without ndex nor types print(ndex.list{args={'snorlobello', color = 'hoenn'}}) -- ndex-list: only fourth gen to have a readable list print(ndexlist.listgen{args={' 8 '}}) -- print(ndexlist.list{}) -- manualEntry print(ndex.header{args={'galar'}}) print(render.entry{args={ 'Ndex.manualEntry', "[[€urshifu|urshifu|type1=lotta|type2=buio£]]", "[[€urshifuGi|urshifu|type1=lotta|type2=buio£]]", "[[€urshifuP|urshifu|type1=lotta|type2=acqua£]]", "[[€urshifuPGi|urshifu|type1=lotta|type2=acqua£]]", }}) print('</div>')
if GetLocale() ~= "deDE" then return end if not DBM_GUI_Translations then DBM_GUI_Translations = {} end local L = DBM_GUI_Translations L.MainFrame = "Deadly Boss Mods" L.TranslationByPrefix = "Übersetzt von " L.TranslationBy = "Ebmor@EU-Malorne" L.Website = "Besuche die Diskussions-/Support-Foren: |cFF73C2FBwww.deadlybossmods.com|r. Folge auf Twitter: @deadlybossmods oder @MysticalOS" L.WebsiteButton = "Foren" L.OTabBosses = "Bosse" L.OTabOptions = GAMEOPTIONS_MENU L.TabCategory_Options = "Allgemeine Einstellungen" L.TabCategory_OTHER = "Sonstige Boss Mods" L.BossModLoaded = "Statistiken von %s" L.BossModLoad_now = [[Dieses Boss Mod ist nicht geladen. Es wird automatisch geladen, wenn du die Instanz betrittst. Du kannst auch auf den Button klicken um das Boss Mod manuell zu laden.]] L.PosX = 'Position X' L.PosY = 'Position Y' L.MoveMe = 'Positionieren' L.Button_OK = 'OK' L.Button_Cancel = 'Abbrechen' L.Button_LoadMod = 'Lade Boss Mod' L.Mod_Enabled = "Aktiviere Boss Mod" L.Mod_Reset = "Lade Standardeinstellungen" L.Reset = "Zurücksetzen" L.Enable = "Aktiviert" L.Disable = "Deaktiviert" L.NoSound = "Kein Sound" L.IconsInUse = "Zeichennutzung des Mods" -- Tab: Boss Statistics L.BossStatistics = "Boss Statistiken" L.Statistic_Kills = "Siege:" L.Statistic_Wipes = "Niederlagen:" L.Statistic_Incompletes = "Abgebrochen:" L.Statistic_BestKill = "Rekordzeit:" L.Statistic_BestRank = "Höchste Stufe:" -- Tab: General Core Options L.General = "Allgemeine Grundeinstellungen" L.EnableMiniMapIcon = "Aktiviere Minimap-Symbol" L.UseSoundChannel = "Audiokanal um DBM-Sounddateien abzuspielen" L.UseMasterChannel = "Master Audiokanal" L.UseDialogChannel = "Dialog Audiokanal" L.UseSFXChannel = "Soundeffekte (SFX) Audiokanal" L.Latency_Text = "Maximale Synchronisierungslatenz: %d" L.ModelOptions = "Einstellungen für 3D-Modellanzeige" L.EnableModels = "Aktiviere 3D-Modelle in den Bosseinstellungen" L.ModelSoundOptions = "Soundeinstellung für Modellanzeige" L.ModelSoundShort = SHORT L.ModelSoundLong = TOAST_DURATION_LONG L.Button_RangeFrame = "Zeige Abstandsfenster" L.Button_InfoFrame = "Zeige Infofenster" L.Button_TestBars = "Starte Testbalken" L.Button_ResetInfoRange = "Info-/Abstandsfenster zurücksetzen" -- Tab: Raidwarning L.Tab_RaidWarning = "Schlachtzugwarnungen" L.RaidWarning_Header = "Einstellungen für Schlachtzugwarnungen" L.RaidWarnColors = "Farben für Schlachtzugwarnungen" L.RaidWarnColor_1 = "Farbe 1" L.RaidWarnColor_2 = "Farbe 2" L.RaidWarnColor_3 = "Farbe 3" L.RaidWarnColor_4 = "Farbe 4" L.InfoRaidWarning = [[Hier werden Position und Farben des Fensters für Schlachtzugwarnungen festgelegt. Dieses Fenster wird für Nachrichten wie "Spieler X ist betroffen von Y" verwendet.]] L.ColorResetted = "Diese Farbeinstellung wurde zurückgesetzt." L.ShowWarningsInChat = "Zeige Warnungen im Chatfenster" L.ShowFakedRaidWarnings = "Zeige Warnungen als künstliche Schlachtzugwarnungen" L.WarningIconLeft = "Zeige Symbol links an" L.WarningIconRight = "Zeige Symbol rechts an" L.WarningIconChat = "Zeige Symbole im Chatfenster" L.WarningAlphabetical = "Sortiere Namen alphabetisch" L.Warn_FontType = "Schriftart" L.Warn_FontStyle = "Schriftstil" L.Warn_FontShadow = "Schatten" L.Warn_FontSize = "Schriftgröße: %d" L.Warn_Duration = "Warnungsdauer: %ds" L.None = "normal" L.Outline = "mit Umriss" L.ThickOutline = "mit dickem Umriss" L.MonochromeOutline = "ohne Kantenglättung, mit Umriss" L.MonochromeThickOutline = "ohne Kantenglättung, mit dickem Umriss" L.RaidWarnSound = "Sound für Schlachtzugwarnungen" -- Tab: Generalwarnings L.Tab_GeneralMessages = "Allgemeine Meldungen" L.CoreMessages = "Systemmeldungen" L.ShowPizzaMessage = "Zeige Meldungen für Timerbroadcasts im Chatfenster" L.ShowAllVersions = "Zeige beim Durchführen einer Versionsprüfung die Boss Mod Versionen aller Gruppenmitglieder im Chatfenster (ansonsten nur eine Zusammenfassung der Aktualität)" L.CombatMessages = "Kampfmeldungen" L.ShowEngageMessage = "Zeige Meldungen für den Beginn von Kämpfen im Chatfenster" L.ShowDefeatMessage = "Zeige Meldungen für Siege/Niederlagen im Chatfenster" L.ShowGuildMessages = "Zeige Meldungen für Kampfbeginn/Siege/Niederlagen deiner Gilde im Chatfenster" L.WhisperMessages = "Flüstermeldungen" L.AutoRespond = "Aktiviere automatische Antwort während eines Bosskampfes" L.EnableStatus = "Antworte auf 'status'-Flüsteranfragen" L.WhisperStats = "Füge Sieg-/Niederlagestatistik den Flüsterantworten hinzu" L.DisableStatusWhisper = "Deaktiviere 'status'-Flüsteranfragen für die gesamte Gruppe (nur als Gruppenleiter; nur für normale/heroische/mythische Schlachtzüge und Herausforderungsmodus/mythische Dungeons)" -- Tab: Barsetup L.BarSetup = "Balkeneinstellungen" L.BarTexture = "Balkentextur" L.BarStyle = "Balkenstil" L.BarDBM = "DBM (mit Animationen)" L.BarSimple = "Einfach (ohne Animationen)" L.BarStartColor = "Startfarbe" L.BarEndColor = "Endfarbe" L.Bar_Font = "Schriftart für Balken" L.Bar_FontSize = "Schriftgröße: %d" L.Bar_Height = "Balkenhöhe: %d" L.Slider_BarOffSetX = "Abstand X: %d" L.Slider_BarOffSetY = "Abstand Y: %d" L.Slider_BarWidth = "Breite: %d" L.Slider_BarScale = "Skalierung: %0.2f" --Types L.BarStartColorAdd = "Startfarbe (Add)" L.BarEndColorAdd = "Endfarbe (Add)" L.BarStartColorAOE = "Startfarbe (AOE)" L.BarEndColorAOE = "Endfarbe (AOE)" L.BarStartColorDebuff = "Startfarbe (Anvisiert)" L.BarEndColorDebuff = "Endfarbe (Anvisiert)" L.BarStartColorInterrupt = "Startfarbe (Unterbrechung)" L.BarEndColorInterrupt = "Endfarbe (Unterbrechung)" L.BarStartColorRole = "Startfarbe (Rolle)" L.BarEndColorRole = "Endfarbe (Rolle)" L.BarStartColorPhase = "Startfarbe (Phase)" L.BarEndColorPhase = "Endfarbe (Phase)" L.BarStartColorUI = "Startfarbe (Nutzer)" L.BarEndColorUI = "Endfarbe (Nutzer)" --Type 7 options L.Bar7Header = "Einstellungen für Nutzerbalken" L.Bar7ForceLarge = "Nutze immer großen Balken" L.Bar7CustomInline = "Zeichen '!' einbetten" L.Bar7Footer = "(keine Live-Aktual. der Dummy-Balken)" -- Tab: Timers L.AreaTitle_BarColors = "Balkenfarben nach Timertyp" L.AreaTitle_BarSetup = "Allgemeine Balkeneinstellungen" L.AreaTitle_BarSetupSmall = "Einstellungen für kleine Balken" L.AreaTitle_BarSetupHuge = "Einstellungen für große Balken" L.EnableHugeBar = "Aktiviere große Balken (Balken 2)" L.BarIconLeft = "Symbol links" L.BarIconRight = "Symbol rechts" L.ExpandUpwards = "Erweitere oben" L.FillUpBars = "Balken auffüllen" L.ClickThrough = "Mausereignisse deaktiv. (durchklickbar)" L.Bar_Decimal = "Nachkomma unterhalb Restzeit: %d" L.Bar_DBMOnly = "Folgende Einstellungen werden nur beim \"DBM\"-Balkenstil berücksichtigt:" L.Bar_EnlargeTime = "Vergrößern unterhalb Restzeit: %d" L.Bar_EnlargePercent = "Vergrößern unterhalb Rest: %0.1f%%" L.BarSpark = "Balkenfunken" L.BarFlash = "Aufblinkende Balken bei baldigem Ablauf" L.BarSort = "Sortiere nach verbleibender Zeit" L.BarColorByType = "Färbung nach Typ" L.BarInlineIcons = "Zeichen einbetten" L.ShortTimerText = "Nutze kurzen Timertext (falls verfügbar)" -- Tab: Spec Warn Frame L.Panel_SpecWarnFrame = "Spezialwarnungen" L.Area_SpecWarn = "Einstellungen für Spezialwarnungen" L.SpecWarn_ClassColor = "Benutze Klassenfarben für Spezialwarnungen" L.ShowSWarningsInChat = "Zeige Spezialwarnungen im Chatfenster" L.SWarnNameInNote = "Nutze SW 5 falls eine Notiz deinen Namen enthält" L.SpecWarn_FlashFrame = "Aufblinkender Bildschirm bei Spezialwarnungen" L.SpecWarn_FlashFrameRepeat = "Wiederhole %d-mal (falls aktiviert)" L.SpecWarn_Font = "Schriftart für Spezialwarnungen" --unused L.SpecWarn_FontSize = "Schriftgröße: %d" L.SpecWarn_FontColor = "Schriftfarbe" L.SpecWarn_FontType = "Schriftart" L.SpecWarn_FlashRepeat = "Wiederh. Blinken" L.SpecWarn_FlashColor = "Blinkfarbe %d" L.SpecWarn_FlashDur = "Blinkdauer: %0.1f" L.SpecWarn_FlashAlpha = "Blinkalpha: %0.1f" L.SpecWarn_DemoButton = "Zeige Beispiel" L.SpecWarn_MoveMe = "Positionieren" L.SpecWarn_ResetMe = "Zurücksetzen" L.SpecialWarnSound = "Sound für Spezialwarnungen, die dich oder deine Funktion betreffen" L.SpecialWarnSound2 = "Sound für Spezialwarnungen, die jeden betreffen" L.SpecialWarnSound3 = "Sound für SEHR wichtige Spezialwarnungen" L.SpecialWarnSound4 = "Sound für \"Lauf weg!\"-Spezialwarnungen" L.SpecialWarnSound5 = "Sound für Spezialwarnungen mit Notizen die deinen Namen enthalten" -- Tab: Heads Up Display Frame L.Panel_HUD = "HudMap" L.Area_HUDOptions = "Einstellungen für die HudMap" L.HUDColorOverride = "Überschreibe Mod-spezifische Farben für die HudMap" L.HUDSizeOverride = "Überschreibe Mod-spezifische Größen für die HudMap" L.HUDAlphaOverride = "Überschreibe Mod-spezifische Alphawerte (Transparenz) für die HudMap" L.HUDTextureOverride = "Überschreibe Mod-spezifische Texturen für die HudMap (wirkt nicht für 'Schlachtzugzeichen' Textureinstellungen)" L.HUDColorSelect = "HM Farbe %d" L.HUDTextureSelect1 = "Textur für primäre HudMap" L.HUDTextureSelect2 = "Textur für sekundäre HudMap" L.HUDTextureSelect3 = "Textur für tertiäre HudMap" L.HUDTextureSelect4 = "Textur für 'lauf zu' HudMap" L.HUDSizeSlider = "Kreisradius: %0.1f" L.HUDAlphaSlider = "Alpha: %0.1f" -- Tab: Spoken Alerts Frame L.Panel_SpokenAlerts = "Gesprochene Warnungen" L.Area_VoiceSelection = "Stimmenauswahl für akustische Zählungen und gesprochene Warnungen" L.CountdownVoice = "Primäre Stimme für Zählungen" L.CountdownVoice2 = "Sekundäre Stimme für Zählungen" L.CountdownVoice3 = "Tertiäre Stimme für Zählungen" L.VoicePackChoice = "Sprachpack für gesprochene Warnungen" L.Area_CountdownOptions = "Countdown-Einstellungen" L.ShowCountdownText = "Zeige Countdown-Text während Zählungen mit der primären Stimme" L.Area_VoicePackOptions = "Sprachpack-Einstellungen (Drittanbieter)" L.SpecWarn_NoSoundsWVoice = "Filtere Spezialwarnungssounds für Warnungen, für die eine Sprachausgabe verfügbar ist..." L.SWFNever = "nicht filtern" L.SWFDefaultOnly = "Spezialwarnungen eingestellt auf den Standardsound (spielt benutzerdefinierte Sounds)" L.SWFAll = "Spezialwarnungen eingestellt auf irgendeinen Sound" L.SpecWarn_AlwaysVoice = "Spiele immer alle gesprochenen Warnungen (ignoriert Boss-spezifische Einstellung, nützlich für Schlachtzugsleiter)" -- Tab: HealthFrame L.Panel_HPFrame = "Lebensanzeige" L.Area_HPFrame = "Einstellungen für die Lebensanzeige" L.HP_Enabled = "Lebensanzeige immer anzeigen (ignoriert Boss-spezifische Einstellung)" L.HP_GrowUpwards = "Erweitere Lebensanzeige nach oben" L.HP_ShowDemo = "Anzeigen" L.BarWidth = "Balkenbreite: %d" -- Tab: Global Filter L.Panel_SpamFilter = "Deaktivierung von DBM-Funktionen" L.Area_SpamFilter_Outgoing = "Globale Deaktivierungs- und Filtereinstellungen für DBM" L.SpamBlockNoShowAnnounce = "Zeige keine Mitteilungen und spiele keine Warnungssounds" L.SpamBlockNoSpecWarn = "Zeige keine Spezialwarnungen und spiele keine Spezialwarnungssounds" L.SpamBlockNoShowTimers = "Zeige keine Mod-Timer (Boss Mod/Herausforderungsmodus/Gruppensuche/Wiedererscheinen)" L.SpamBlockNoShowUTimers = "Zeige keine von anderen gesendeten Timer (benutzerdefiniert/Pull/Pause)" L.SpamBlockNoSetIcon = "Setze keine Zeichen auf Ziele" L.SpamBlockNoRangeFrame = "Zeige kein Abstandsfenster/-radar an" L.SpamBlockNoInfoFrame = "Zeige kein Infofenster an" L.SpamBlockNoHudMap = "Zeige keine HudMap" L.SpamBlockNoHealthFrame = "Zeige keine Lebensanzeige an" L.SpamBlockNoCountdowns = "Spiele keine Countdown-Sounds" L.SpamBlockNoYells = "Sende keine automatischen Schreie" L.SpamBlockNoNoteSync = "Akzeptiere keine geteilten Notizen" L.Area_Restore = "DBM-Wiederherstellungseinstellungen (Setzen des vorherigen Nutzerzustands nach Mod-Ende)" L.SpamBlockNoIconRestore = "Setze Markierungszeichen am Kampfende nicht auf den vorherigen Zustand zurück" L.SpamBlockNoRangeRestore = "Setze das Abstandsfenster nicht auf den vorherigen Zustand zurück, wenn es von Mods ausgeblendet wird" -- Tab: Spam Filter L.Area_SpamFilter = "Spam-Filter" L.DontShowFarWarnings = "Zeige keine Mitteilungen/Timer für weit entfernte Ereignisse" L.StripServerName = "Entferne den Realmnamen der Spieler in Warnungen und Timern" L.SpamBlockBossWhispers = "Aktiviere Filter für &lt;DBM&gt;-Flüstermitteilungen im Kampf" L.BlockVersionUpdateNotice = "Zeige häufigere Meldungen zur Aktualisierung einer veralteten DBM-Version im Chatfenster statt als Pop-up" L.Area_SpecFilter = "Filtereinstellungen für Rollen" L.FilterTankSpec = "Unterdrücke Warnungen für Tanks, falls deine aktuelle Spezialisierung keine \"Schutz\"-Spezialisierung ist (Hinweis: Diese Filterung sollte normalerweise nicht deaktiviert werden, da alle individuellen \"Spott\"-Warnungen nun standardmäßig aktiviert sind.)" L.FilterInterrupts = "Unterdrücke Warnungen für unterbrechbare Zauber, falls diese nicht von deinem aktuellen Ziel oder Fokusziel gewirkt werden (Hinweis: Diese Einstellung hat keine Wirkung auf Zauber, deren Unterbrechung als kritisch eingestuft wird und die wahrscheinlich tödlich für den Schlachtzug sind, falls sie nicht unterbrochen werden.)" L.FilterInterruptNoteName = "Unterdrücke Warnungen für unterbrechbare Zauber (mit Zählung), falls die Warnung nicht deinen Namen in der nutzerdefinierten Notiz enthält" L.FilterDispels = "Unterdrücke Warnungen für reinigbare Zauber, falls deine Reinigungen noch abklingen" L.FilterSelfHud = "Filtere dich selbst in HudMap (ausgenommen Abstands-basierte Hud-Funktionen)" L.Area_PullTimer = "Filtereinstellungen für Pull-, Pausen-, Kampf- und benutzerdefinierte Timer" L.DontShowPTNoID = "Blockiere Pull-Timer, die nicht aus deiner derzeitigen Zone gesendet worden sind" L.DontShowPT = "Zeige keinen Timerbalken für Pull-/Pausen-Timer" L.DontShowPTText = "Zeige keine Mitteilungen für Pull-/Pausen-Timer im Chatfenster" L.DontPlayPTCountdown = "Spiele keinen akustischen Countdown für Pull-, Pausen-, Kampf- und benutzerdefinierte Timer" L.DontShowPTCountdownText = "Zeige keinen optischen Countdown für Pull-, Pausen-, Kampf- und benutzerdefinierte Timer" L.PT_Threshold = "Zeige keinen opt. Countd. für Pausen-/Kampf-/Nutzer-Timer über: %d" L.Panel_HideBlizzard = "Deaktivierung von Spielelementen" L.Area_HideBlizzard = "Einstellungen zum Deaktivieren und Verbergen von Spielelementen" L.HideBossEmoteFrame = "Verberge das Fenster \"RaidBossEmoteFrame\" während Bosskämpfen" L.HideWatchFrame = "Verberge das Fenster für die Questverfolgung während Bosskämpfen, falls keine Erfolge verfolgt werden" L.HideGarrisonUpdates = "Verberge Garnisonsmeldungen während Bosskämpfen" L.HideGuildChallengeUpdates = "Verberge Gildenerfolgsmeldungen während Bosskämpfen" L.HideTooltips = "Verberge Tooltips während Bosskämpfen" L.DisableSFX = "Deaktiviere Soundeffekte während Bosskämpfen" L.SpamBlockSayYell = "Sprechblasen-Ansagen im Chatfenster ausblenden" L.DisableCinematics = "Verberge Videosequenzen" L.AfterFirst = "Nach jeweils einmaligem Abspielen" L.Always = ALWAYS L.DisableTalkingHead = "Blockiere \"Sprechenden Kopf\"" L.CombatOnly = "im Kampf deaktivieren (alle)" L.RaidCombat = "im Kampf deaktivieren (nur Bosse)" L.Panel_ExtraFeatures = "Sonstige Funktionen" -- L.Area_ChatAlerts = "Alarmmeldungen im Chatfenster" L.RoleSpecAlert = "Zeige Alarmmeldung, wenn deine Beutespezialisierung nicht deiner aktuellen Spezialisierung beim Betreten eines Schlachtzugs entspricht" L.CheckGear = "Zeige Alarmmeldung beim Pull, wenn deine angelegte Gegenstandsstufe viel niedriger als die in deinen Taschen (40+) oder deine Hauptwaffe nicht ausgerüstet ist" L.WorldBossAlert = "Zeige Alarmmeldung, wenn auf deinem Realm Gildenmitglieder oder Freunde möglicherweise beginnen gegen Weltbosse zu kämpfen (ungenau falls Sender \"CRZed\" ist)" -- L.Area_SoundAlerts = "Akustische und aufblinkende Alarme" L.LFDEnhance = "Spiele \"Bereitschaftscheck\"-Sound und lasse Anwendungsymbol aufblicken für Rollenabfragen und Einladungen der Gruppensuche im Master- oder Dialog-Audiokanal (funktioniert z.B. auch wenn Soundeffekte abgeschaltet sind und ist allgemein lauter)" L.WorldBossNearAlert = "Spiele \"Bereitschaftscheck\"-Sound und lasse Anwendungsymbol aufblicken, wenn Weltbosse in deiner Nähe gepullt werden, die du brauchst" L.RLReadyCheckSound = "Wenn ein Bereitschaftscheck durchgeführt wird, den Sound im Master- oder Dialog-Audiokanal abspielen und Anwendungsymbol aufblicken lassen" L.AFKHealthWarning = "Spiele Alarmsound und lasse Anwendungsymbol aufblicken, wenn du Gesundheit verlierst, während du als nicht an der Tastatur (\"AFK\") markiert bist" --L.AutoReplySound --translate? (misleading option..) -- L.TimerGeneral = "Allgemeine Einstellungen für Timer" L.SKT_Enabled = "Zeige Timer für Rekordzeit für aktuellen Kampf (falls verfügbar)" L.CRT_Enabled = "Zeige Zeit bis zur nächsten Wiederbelebungsaufladung im Kampf" L.ShowRespawn = "Zeige Zeit bis zum Wiedererscheinen des Bosses nach einer Niederlage" L.ShowQueuePop = "Zeige verbleibende Zeit zur Annahme einer Warteschlangeneinladung (Gruppensuche, Schlachtfelder, etc.)" -- L.Area_AutoLogging = "Automatische Aufzeichnungen" L.AutologBosses = "Automatische Aufzeichnung von Bosskämpfen im spieleigenen Kampflog (/dbm pull vor Bossen wird benötigt um die Aufzeichnung rechtzeitig für \"Pre-Pots\" und andere Ereignisse zu starten)" L.AdvancedAutologBosses = "Automatische Aufzeichnung von Bosskämpfen mit Addon \"Transcriptor\"" L.LogOnlyRaidBosses = "Nur Schlachtzugbosskämpfe der aktuellen Erweiterung aufzeichnen\n(ohne Schlachtzugsbrowser-/Dungeon-/Szenarienbosskämpfe/alte Spielinhalte)" -- L.Area_3rdParty = "Einstellungen für Addons von Drittanbietern" L.ShowBBOnCombatStart = "Führe bei Kampfbeginn eine \"BigBrother\"-Buffprüfung durch" L.BigBrotherAnnounceToRaid = "Verkünde Ergebnis der \"BigBrother\"-Buffprüfung zum Schlachtzug" L.Area_Invite = "Einstellungen für Einladungen" L.AutoAcceptFriendInvite = "Automatisch Gruppeneinladungen von Freunden akzeptieren" L.AutoAcceptGuildInvite = "Automatisch Gruppeneinladungen von Gildenmitgliedern akzeptieren" L.Area_Advanced = "Erweiterte Einstellungen" L.FakeBW = "Bei Versionsprüfungen als \"BigWigs\" ausgeben, statt als DBM (nützlich für Gilden, die die Nutzung von \"BigWigs\" erzwingen)" L.AITimer = "Erzeuge automatisch Timer für unbekannte Kämpfe mit der in DBM eingebauten Timer-KI (nützlich beim erstmaligen Pullen eines Test-Bosses, etwa auf Beta- oder PTR-Servern) Hinweis: Dies funktioniert nicht richtig bei mehreren Gegnern mit derselben Fähigkeit." L.AutoCorrectTimer = "Korrigiere automatisch zu lange Timer (nützlich für Gilden, die Kämpfe im topaktuellen \"End-Content\" bestreiten, für die noch keine aktualisierten Boss Mods verfügbar sind) Hinweis: Diese Einstellung kann auch einige Timer verschlechtern, falls bei Phasenwechseln, deren Behandlung in DBM bislang noch nicht geeignet programmiert wurde, Timerrücksetzungen stattfinden." L.PizzaTimer_Headline = 'Erstelle einen "Pizza-Timer"' L.PizzaTimer_Title = 'Name (z.B. "Pizza!")' L.PizzaTimer_Hours = "Stunden" L.PizzaTimer_Mins = "Min" L.PizzaTimer_Secs = "Sek" L.PizzaTimer_ButtonStart = "Starte Timer" L.PizzaTimer_BroadCast = "Anderen Schlachtzugspielern anzeigen" L.Panel_Profile = "Profile" L.Area_CreateProfile = "Profilerzeugung für DBM Core Einstellungen" L.EnterProfileName = "Profilnamen eingeben" L.CreateProfile = "Erzeuge Profil mit Standardeinstellungen" L.Area_ApplyProfile = "Aktives Profil für DBM Core Einstellungen" L.SelectProfileToApply = "Anzuwendendes Profil auswählen" L.Area_CopyProfile = "Kopiere Profil für DBM Core Einstellungen" L.SelectProfileToCopy = "Zu kopierendes Profil auswählen" L.Area_DeleteProfile = "Entferne Profil für DBM Core Einstellungen" L.SelectProfileToDelete = "Zu löschendes Profil auswählen" L.Area_DualProfile = "Boss Mod Profileinstellungen" L.DualProfile = "Aktiviere Unterstützung für verschiedene Boss Mod Einstellungen pro Spezialisierung (Die Verwaltung der Boss Mod Profile erfolgt im geladenen Boss Mod Statistikfenster.)" L.Area_ModProfile = "Kopiere Mod-Einstellungen von Charakter/Spezialisierung oder lösche Mod-Einstellungen" L.ModAllReset = "Alle Einstellungen zurücksetzen" L.ModAllStatReset = "Alle Statistiken zurücksetzen" L.SelectModProfileCopy = "Kopiere alle Einstellungen von" L.SelectModProfileCopySound = "Kopiere nur Soundeinst. von" L.SelectModProfileCopyNote = "Kopiere nur Notizen von" L.SelectModProfileDelete = "Lösche Mod-Einstellungen für" -- Misc L.FontHeight = 16
local cjson = require("cjson") local _M = {} -- 获取http get/post 请求参数 function _M.getArgs(name, default) local request_method = ngx.var.request_method local args = {} -- 参数获取 if "POST" == request_method then ngx.req.read_body() local postArgs = ngx.req.get_post_args() if postArgs then for k, v in pairs(postArgs) do args[k] = v end end end if name ~= nil then if default == nil then default = '' end return args[name] or default end return args end function _M.input(name, default) local args = {} local request_method = ngx.var.request_method if (request_method == 'GET') then args = ngx.req.get_uri_args() else ngx.req.read_body() --获取body体 local body = ngx.req.get_body_data() if (body ~= nil and body ~= '[]') then local res, table_body = pcall(cjson.decode, body) if res == false then return args end args = table_body end end if name ~= nil then if default == nil then default = '' end return args[name] or default end return args end return _M
local util = require("util.util") local _M = {} _M._VERSION = '1.0' local function getCookieValue(s,key) local i,j = string.find(s,key,0,true) local value if i == nil then return nil end local q,_ = string.find(s,";",j,true); if q == nil then value = string.sub(s,j+1) else value = string.sub(s,j+1,q-1) end -- 去掉首尾空白 return (value:gsub("^%s+", ""):gsub("%s+$", "")) end local function getValueFromNginx(key) if string.find(key,"cookie;") ~= nil then key = string.sub(key,8).."=" local allCookie = (ngx.var.http_cookie) if allCookie == nil then return nil end local value = getCookieValue(allCookie,key) return value end return ngx.var[key] end local function doFilterUnit(tokenName, id, ruleParsed) local unit local idUnitMapping = ruleParsed["idUnitMapping"] for _, mapping in pairs(idUnitMapping["items"]) do for _, act in pairs(mapping["action"]) do if unit == nil then if act["condKey"] == "@"..tokenName or act["condKey"] == "$"..tokenName then local hit = act["filter"](id, act["val"]) if hit then return mapping["name"] end end end end end return nil end local function getUnit(ruleParsed, key) local transformedId = key for _, transformer in pairs(ruleParsed["idTransformer"]) do for _, act in pairs(transformer["action"]) do if act["filter"] ~= nil then transformedId = act["filter"](transformedId, act["config"]) end end if transformedId ~= nil then local unit = doFilterUnit(transformer["tokenName"], transformedId, ruleParsed) if unit ~= nil then return unit end end end return nil end local function default(parsed_rule) if parsed_rule["defaultUnit"] ~= nil then local rd = math.random(1,100) if parsed_rule["defaultUnit"][rd] ~= nil then return parsed_rule["defaultUnit"][rd] end end return -1 end -- 正常 返回 flag -- -1 则走 本地 -- -2 则报错 function _M.getUnitForRequest(ruleParsed, isUnitEnabled) if isUnitEnabled then if not ruleParsed or ruleParsed["idUnitMapping"] == nil then return -1 else local unit, key local idSource = ruleParsed["idSource"] if type(idSource) == "table" then for i = 1, #idSource do key = getValueFromNginx(idSource[i]) if key ~= nil then break end end else key = getValueFromNginx(idSource) end if key ~= nil then ngx.var.unit_key = key unit = getUnit(ruleParsed,key) if unit ~= nil then return unit end end return -1 end else return -1 end end return _M
------------------------------------------------------------------------ --- @file esp.lua --- @brief ESP utility. --- Utility functions for the esp_header structs --- Includes: --- - ESP constants --- - IPsec IV --- - ESP header utility --- - Definition of esp packets ------------------------------------------------------------------------ local ffi = require "ffi" require "proto.template" local initHeader = initHeader local math = require "math" --------------------------------------------------------------------------- ---- esp constants --------------------------------------------------------------------------- local esp = {} ------------------------------------------------------------------------------------- ---- IPsec IV ------------------------------------------------------------------------------------- -- struct ffi.cdef[[ union ipsec_iv { uint32_t uint32[2]; }; ]] local ipsecIV = {} ipsecIV.__index = ipsecIV local ipsecIVType = ffi.typeof("union ipsec_iv") --- Set the IPsec IV. --- @param iv IPsec IV in 'union ipsec_iv' format. function ipsecIV:set(iv) local random_iv = ffi.new("union ipsec_iv") random_iv.uint32[0] = math.random(0, 2^32-1) random_iv.uint32[1] = math.random(0, 2^32-1) local iv = iv or random_iv self.uint32[0] = hton(iv.uint32[1]) self.uint32[1] = hton(iv.uint32[0]) end --- Retrieve the IPsec IV. --- @return IV in 'union ipsec_iv' format. function ipsecIV:get() local iv = ipsecIVType() iv.uint32[0] = hton(self.uint32[1]) iv.uint32[1] = hton(self.uint32[0]) return iv end --- Get the IPsec IV as string. --- @param iv IPsec IV in string format. function ipsecIV:getString(doByteSwap) doByteSwap = doByteSwap or false if doByteSwap then self = self:get() end return ("0x%08x%08x"):format(self.uint32[1], self.uint32[0]) end --------------------------------------------------------------------------- ---- esp header --------------------------------------------------------------------------- -- definition of the header format esp.headerFormat = [[ uint32_t spi; uint32_t sqn; union ipsec_iv iv; ]] --- Variable sized member esp.headerVariableMember = nil local espHeader = initHeader() espHeader.__index = espHeader --- Set the SPI. --- @param int SPI of the esp header as A bit integer. function espHeader:setSPI(int) int = int or 0 self.spi = hton(int) end --- Retrieve the SPI. --- @return SPI as A bit integer. function espHeader:getSPI() return hton(self.spi) end --- Retrieve the SPI as string. --- @return SPI as string. function espHeader:getSPIString() return ("0x%08x"):format(self.spi) end --- Set the SQN. --- @param int SQN of the esp header as A bit integer. function espHeader:setSQN(int) int = int or 0 self.sqn = hton(int) end --- Retrieve the SQN. --- @return SQN as A bit integer. function espHeader:getSQN() return hton(self.sqn) end --- Retrieve the SQN as string. --- @return SQN as string. function espHeader:getSQNString() return self:getSQN() end --- Set the IV. --- @param int IV of the esp header as 'union ipsec_iv'. function espHeader:setIV(iv) self.iv:set(iv) end --- Retrieve the IV. --- @return SPI as 'union ipsec_iv'. function espHeader:getIV() return self.iv:get() end --- Retrieve the IV as string. --- @return IV as string. function espHeader:getIVString() return self.iv:getString(true) end --- Set all members of the esp header. --- Per default, all members are set to default values specified in the respective set function. --- Optional named arguments can be used to set a member to a user-provided value. --- @param args Table of named arguments. Available arguments: espSPI, espSQN --- @param pre prefix for namedArgs. Default 'esp'. --- @usage fill() -- only default values --- @usage fill{ espXYZ=1 } -- all members are set to default values with the exception of espXYZ, ... function espHeader:fill(args, pre) args = args or {} pre = pre or "esp" self:setSPI(args[pre .. "SPI"]) self:setSQN(args[pre .. "SQN"]) self:setIV(args[pre .. "IV"]) end --- Retrieve the values of all members. --- @param pre prefix for namedArgs. Default 'esp'. --- @return Table of named arguments. For a list of arguments see "See also". --- @see espHeader:fill function espHeader:get(pre) pre = pre or "esp" local args = {} args[pre .. "SPI"] = self:getSPI() args[pre .. "SQN"] = self:getSQN() args[pre .. "IV"] = self:getIV() return args end --- Retrieve the values of all members. --- @return Values in string format. function espHeader:getString() --TODO: add data from ESP trailer return "ESP spi " .. self:getSPIString() .. " sqn " .. self:getSQNString() .. " iv " .. self:getIVString() end ------------------------------------------------------------------------ ---- Metatypes ------------------------------------------------------------------------ ffi.metatype("union ipsec_iv", ipsecIV) esp.metatype = espHeader return esp
animComp = {} function animComp.newAnim(qFrames, animTime, doRepeat) local anim = {} anim.time = animTime anim.capTime = animTime / qFrames anim.qFrames = qFrames anim.canRepeat = (doRepeat==nil or doRepeat==true) animComp.restart(anim) return anim; end function animComp.update(dt, anim) anim.curr_time = anim.curr_time + dt if anim.curr_time > anim.capTime then anim.curr_time = anim.curr_time - anim.capTime anim.curr_frame = anim.curr_frame+1 if anim.curr_frame > anim.qFrames then if not anim.canRepeat then anim.curr_frame = anim.qFrames anim.finished = true return -1 else anim.curr_frame = 1 end end end return anim.curr_frame end function animComp.restart(anim) anim.curr_frame = 1 anim.curr_time = 0 anim.finished = false end
local PluginRoot = script:FindFirstAncestor("PluginRoot") local load = require(PluginRoot.Loader).load local Roact = load("Roact") local ScrollingVerticalList = load("Framework/ScrollingVerticalList") local StoryWrapper = load("Stories/StoryWrapper") local e = Roact.createElement return function(target) Roact.setGlobalConfig({ typeChecks = true, propValidation = true, }) local section = e(ScrollingVerticalList, { size = UDim2.new(0, 200, 0, 200), position = UDim2.new(0, 20, 0, 20), paddingTop = 12, paddingRight = 12, paddingBottom = 12, paddingLeft = 12, paddingList = 12, }, { Text1 = e("TextLabel", { Text = "Text1", Size = UDim2.new(0, 100, 0, 100), TextStrokeColor3 = Color3.new(0, 0, 0), TextStrokeTransparency = 0, TextColor3 = Color3.new(1, 1, 1), LayoutOrder = 1, }), Text2 = e("TextLabel", { Text = "Text2", Size = UDim2.new(1, 0, 0, 100), TextStrokeColor3 = Color3.new(0, 0, 0), TextStrokeTransparency = 0, TextColor3 = Color3.new(1, 1, 1), LayoutOrder = 2, }), }) local handle = Roact.mount(StoryWrapper({ modalTarget = target }, section), target) return function() Roact.unmount(handle) end end
--- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by Bzouk. --- DateTime: 22.12.2020 11:11 --- require "ISUI/ISPanel" require "ISUI/ISButton" require "ISUI/ISInventoryPane" require "ISUI/ISInventoryPage" require "ISUI/ISResizeWidget" require "ISUI/ISMouseDrag" require "ISUI/ISLayoutManager" require "TimedActions/ISInventoryTransferAction" require "bcUtils" -- same function in ISInventoryPaneContextMenu local function predicateNotBroken(item) return not item:isBroken() end ISBzHotSlot = ISPanel:derive("ISBzHotSlot"); function ISBzHotSlot:new (x, y, width, height, parent, object, slot, windowNum) local o = {} o = ISPanel:new(x, y, width, height); setmetatable(o, self) self.__index = self o.x = x; o.y = y; o.anchorBottom = true; o.anchorLeft = true; o.anchorRight = true; o.anchorTop = true; o.backgroundColor = { r = 0, g = 0, b = 0, a = 0.8 }; o.borderColor = { r = 0.4, g = 0.4, b = 0.4, a = 1 }; o.dirty = true; o.height = height; o.width = width; o.object = object; o.parent = parent; o.slot = slot; o.sizeOfRemoveButton = math.max(10, getTextManager():MeasureStringY(UIFont.Small, getText("UI_Bz_Fast_HotBar_Slot_Remove"))) o.windowNum = windowNum return o end function ISBzHotSlot:createChildren() self.removeButton = ISButton:new(0, self:getHeight() - self.sizeOfRemoveButton, self:getWidth(), self.sizeOfRemoveButton, getText("UI_Bz_Fast_HotBar_Slot_Remove")) self.removeButton:setOnClick(ISBzHotBar.ClearSlotButton, self.slot, self.windowNum) self:addChild(self.removeButton); self.removeButton:setVisible(false); end function ISBzHotSlot:render() if self.object.item == nil then self.removeButton:setVisible(false); return ; end self.removeButton:setVisible(true); local imgSize = math.min(self.width, self.height - self.sizeOfRemoveButton); local alpha = 0.3; if self.object.count > 0 then alpha = 0.7; end if self.object.texture ~= nil then self:drawTextureScaled(self.object.texture, (self.width - imgSize) / 2, 0, imgSize, imgSize, alpha, 1, 1, 1); else self.removeButton:setVisible(false); return ; end local text = "(" .. self.object.count .. ")"; -- ( text, x,double y,double r,double g, double b,double alpha) self:drawText(text, self.width - getTextManager():MeasureStringX(UIFont.Small, text), self.removeButton.y - (getTextManager():MeasureStringY(UIFont.Small, text) + 1), 1, 1, 1, 1, UIFont.Small); end function ISBzHotSlot:update() --ISPanel.update(self) if self.object.item ~= nil then local player = getPlayer() if player == nil then return end ; local playerInv = player:getInventory() if playerInv == nil then return end ; --self.object.count = playerInv:getItemCountRecurse(self.object.item) self.object.count = playerInv:getCountTypeEvalRecurse(self.object.item, predicateNotBroken) end end function ISBzHotSlot:onMouseUp(_, _) if ISMouseDrag.dragging then local dragging = ISInventoryPane.getActualItems(ISMouseDrag.dragging); for _, v in ipairs(dragging) do ISBzHotBar.PutItemInSlot(v:getFullType(), self.slot, self.windowNum) break end else self:ActivateSlot() end end function ISBzHotSlot:onRightMouseUp(x, y) if self.object.item == nil then return end local items = {}; local playerObj = getPlayer() -- do nothing if sleeping if playerObj:isAsleep() then return end table.insert(items, playerObj:getInventory():getFirstTypeEvalRecurse(self.object.item, predicateNotBroken)); ISInventoryPaneContextMenu.createMenu(0, true, items, self:getAbsoluteX() + x, self:getAbsoluteY() + y) end -- look for any damaged body part on the player + from ISInventoryPaneContextMenu + merge BaseHandler from ISHealthPanel -- bodyPart:scratched() or bodyPart:deepWounded() or bodyPart:bitten() or bodyPart:stitched() or bodyPart:bleeding() or bodyPart:isBurnt() and not bodyPart:bandaged() then -- Java public boolean HasInjury() { -- return this.bitten | this.scratched | this.deepWounded | this.bleeding | this.getBiteTime() > 0.0F | this.getScratchTime() > 0.0F | this.getCutTime() > 0.0F | this.getFractureTime() > 0.0F | this.haveBullet() | this.getBurnTime() > 0.0F; -- } ISBzHotSlot.haveDamagePart = function(playerId) local result = {}; local bodyParts = getSpecificPlayer(playerId):getBodyDamage():getBodyParts(); -- fetch all the body part for i=0,BodyPartType.ToIndex(BodyPartType.MAX) - 1 do local bodyPart = bodyParts:get(i); -- if it's damaged if (bodyPart:HasInjury() or bodyPart:stitched()) and not bodyPart:bandaged() then table.insert(result, bodyPart); end end return result; end -- Main called after maouse up on item function ISBzHotSlot:ActivateSlot() -- No item do nothing if self.object.item == nil then return end local playerObj = getPlayer() -- do nothing if sleeping if playerObj:isAsleep() then return end local playerNumber = getPlayer():getPlayerNum() -- search in inventory + backpack and container in inventory -- local item = playerObj:getInventory():getFirstTypeRecurse(self.object.item); local playerInv = playerObj:getInventory() local item = playerInv:getFirstTypeEvalRecurse(self.object.item, predicateNotBroken) -- no item do nothing if not item then return end -- container where item is located -- from ISWorldObjectContextMenu local returnToContainer = item:getContainer():isInCharacterInventory(playerObj) and item:getContainer() -- https://projectzomboid.com/modding/zombie/inventory/InventoryItem.html -- same like ISInventoryPane:doContextualDblClick(item) if instanceof(item, "Food") then -- food smoke (also food) if item:isPoison() == false then -- if not posion, if item:getHungChange() < 0 then if playerObj:getMoodles():getMoodleLevel(MoodleType.FoodEaten) >= 3 and playerObj:getNutrition():getCalories() >= 1000 then return end ISInventoryPaneContextMenu.onEatItems({ item }, 0.5, playerNumber); if returnToContainer and (returnToContainer ~= playerInv) then ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, playerInv, returnToContainer)) end else local cmd = item:getCustomMenuOption() or getText("ContextMenu_Eat") if cmd ~= getText("ContextMenu_Eat") then ISInventoryPaneContextMenu.onEatItems({ item }, 1, playerNumber); end end end elseif instanceof(item, "DrainableComboItem") then if item:isWaterSource() and (playerObj:getStats():getThirst() > 0.1) and not item:isTaintedWater() then -- water ISInventoryPaneContextMenu ISInventoryPaneContextMenu.onDrinkForThirst(item, playerObj) if returnToContainer and (returnToContainer ~= playerInv) then ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, playerInv, returnToContainer)) end elseif ISInventoryPaneContextMenu.startWith(item:getType(), "Pills") then -- pills like betablockers -- ISInventoryPaneContextMenu ISInventoryPaneContextMenu.onPillsItems({ item }, playerNumber) if returnToContainer and (returnToContainer ~= playerInv) then ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, playerInv, returnToContainer)) end -- if alcohol disinfectant elseif (ISInventoryPaneContextMenu.startWith(item:getType(), "Disinfectant") or ISInventoryPaneContextMenu.startWith(item:getType(), "AlcoholWipes")) and item:getAlcoholPower() > 0 then -- we get all the damaged body part local bodyPartDamaged = ISBzHotSlot.haveDamagePart(playerNumber); for _, v in ipairs(bodyPartDamaged) do if v:getAlcoholLevel() == 0 then -- if zero alcohol present then for _, k in ipairs(ISInventoryPane.getActualItems({ item })) do -- if Disinfectant isn't in main inventory, put it there first. ISInventoryPaneContextMenu.transferIfNeeded(playerObj, k) -- apply Disinfect ISTimedActionQueue.add(ISDisinfect:new(playerObj, playerObj, k, v)); end end end if returnToContainer and (returnToContainer ~= playerInv) then ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, playerInv, returnToContainer)) end elseif item:getType() == "DishCloth" or item:getType() == "BathTowel" and playerObj:getBodyDamage():getWetness() > 0 then -- ISInventoryPaneContextMenu ISInventoryPaneContextMenu.onDryMyself({ item }, playerNumber) elseif item:getType() == "Thread" and item:getUsedDelta() >= 0 then local itemNeedle = playerObj:getInventory():getFirstTypeEvalRecurse("Needle", predicateNotBroken) -- no itemNeedle do nothing if not itemNeedle then return end ; local returnToContainerNeedle = itemNeedle:getContainer():isInCharacterInventory(playerObj) and item:getContainer() -- we get all the damaged body part local bodyPartsDamaged = ISBzHotSlot.haveDamagePart(playerNumber); for _, bodyPart in ipairs(bodyPartsDamaged) do if bodyPart:isDeepWounded() and not bodyPart:haveGlass() then -- if thread isn't in main inventory, put it there first. ISInventoryPaneContextMenu.transferIfNeeded(playerObj, item); ISInventoryPaneContextMenu.transferIfNeeded(playerObj, itemNeedle); ISTimedActionQueue.add( ISStitch:new(playerObj,playerObj, item, bodyPart, true)); end end if returnToContainer and (returnToContainer ~= playerInv) then ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, playerInv, returnToContainer)) end if returnToContainerNeedle and (returnToContainerNeedle ~= playerInv) then ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, itemNeedle, playerInv, returnToContainerNeedle)) end end elseif instanceof(item, "HandWeapon") and item:getCondition() > 0 then local itemsInHand = playerObj:getPrimaryHandItem() local gameHotbar = getPlayerHotbar(playerNumber); local fromHotbar = gameHotbar and gameHotbar:isItemAttached(itemsInHand); if item:isTwoHandWeapon() and not playerObj:isItemInBothHands(item) then ISInventoryPaneContextMenu.OnTwoHandsEquip({ item }, playerNumber) if ISBzHotBar.config.main.transferWeapons and itemsInHand and not fromHotbar and returnToContainer and (returnToContainer ~= playerInv) then ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, itemsInHand, playerInv, returnToContainer)) end else if (not playerObj:isPrimaryHandItem(item)) and not getSpecificPlayer(playerNumber):getBodyDamage():getBodyPart(BodyPartType.Hand_R):isDeepWounded() and (getSpecificPlayer(playerNumber):getBodyDamage():getBodyPart(BodyPartType.Hand_R):getFractureTime() == 0 or getSpecificPlayer(playerNumber):getBodyDamage():getBodyPart(BodyPartType.Hand_R):getSplintFactor() > 0) then -- forbid reequipping skinned items to avoid multiple problems for now local add = true; if playerObj:getSecondaryHandItem() == item and item:getScriptItem():getReplaceWhenUnequip() then add = false; end if add then ISInventoryPaneContextMenu.OnPrimaryWeapon({ item }, playerNumber) if ISBzHotBar.config.main.transferWeapons and itemsInHand and not fromHotbar and returnToContainer and (returnToContainer ~= playerInv) then ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, itemsInHand, playerInv, returnToContainer)) end end end end elseif instanceof(item, "Radio") and (instanceof(item, "InventoryItem") and not instanceof(item, "HandWeapon")) then if playerObj:isEquipped(item) then ISTimedActionQueue.add(ISUnequipAction:new(playerObj, item, 50)); return end if (not playerObj:isPrimaryHandItem(item)) and not getSpecificPlayer(playerNumber):getBodyDamage():getBodyPart(BodyPartType.Hand_R):isDeepWounded() and (getSpecificPlayer(playerNumber):getBodyDamage():getBodyPart(BodyPartType.Hand_R):getFractureTime() == 0 or getSpecificPlayer(playerNumber):getBodyDamage():getBodyPart(BodyPartType.Hand_R):getSplintFactor() > 0) then -- forbid reequipping skinned items to avoid multiple problems for now local add = true; if playerObj:getSecondaryHandItem() == item and item:getScriptItem():getReplaceWhenUnequip() then add = false; end if add then ISInventoryPaneContextMenu.OnPrimaryWeapon({ item }, playerNumber) end end else -- other items if item:isCanBandage() then -- we get all the damaged body part + not bandaged local bodyPartsDamaged = ISBzHotSlot.haveDamagePart(playerNumber); local isDone = false for _, bodyPart in ipairs(bodyPartsDamaged) do if bodyPart:isNeedBurnWash() and item:getBandagePower() >= 2 then ISInventoryPaneContextMenu.transferIfNeeded(playerObj, item) ISTimedActionQueue.add(ISCleanBurn:new(playerObj, playerObj,item, bodyPart)); -- ISRemoveGlass:new(self:getDoctor(), self:getPatient(), self.bodyPart) isDone = true break end end if isDone then return end for _, bodyPart in ipairs(bodyPartsDamaged) do ISInventoryPaneContextMenu.onApplyBandage({ item }, bodyPart, playerNumber) return end elseif item:getCategory() == "Clothing" and not playerObj:isEquipped(item) then -- extra option items use mouse right click --if item:getClothingItemExtraOption() then -- return -- end --if item:getClothingExtraSubmenu() then -- return -- end ISInventoryPaneContextMenu.onWearItems({ item }, playerNumber) elseif item:getCategory() == "Literature" and not item:canBeWrite() and not playerObj:getTraits():isIlliterate() then ISInventoryPaneContextMenu.onLiteratureItems({ item }, playerNumber) elseif item:getType() == "SutureNeedleHolder" or item:getType() == "Tweezers" then -- we get all the damaged body part local bodyPartsDamaged = ISBzHotSlot.haveDamagePart(playerNumber); for _, bodyPart in ipairs(bodyPartsDamaged) do if bodyPart:haveGlass() then -- if Tweezers or SutureNeedleHolder isn't in main inventory, put it there first. ISInventoryPaneContextMenu.transferIfNeeded(playerObj, item) ISTimedActionQueue.add(ISRemoveGlass:new(playerObj, playerObj,bodyPart)); -- ISRemoveGlass:new(self:getDoctor(), self:getPatient(), self.bodyPart) elseif bodyPart:haveBullet() then ISInventoryPaneContextMenu.transferIfNeeded(playerObj, item) ISTimedActionQueue.add(ISRemoveBullet:new(playerObj, playerObj, bodyPart)); end end if returnToContainer and (returnToContainer ~= playerInv) then ISTimedActionQueue.add(ISInventoryTransferAction:new(playerObj, item, playerInv, returnToContainer)) end elseif item:getType() == "SutureNeedle" then -- we get all the damaged body part local bodyPartsDamaged = ISBzHotSlot.haveDamagePart(playerNumber); for _, bodyPart in ipairs(bodyPartsDamaged) do if bodyPart:isDeepWounded() and not bodyPart:haveGlass() then -- -- if SutureNeedle isn't in main inventory, put it there first. ISInventoryPaneContextMenu.transferIfNeeded(playerObj, item); ISTimedActionQueue.add( ISStitch:new(playerObj,playerObj, item, bodyPart, true)); return end end elseif item:getType() == "ComfreyCataplasm" then -- Aids recovery from broken bones. local bodyPartsDamaged = ISBzHotSlot.haveDamagePart(playerNumber); for _, bodyPart in ipairs(bodyPartsDamaged) do if bodyPart:getFractureTime() > 0 and bodyPart:getComfreyFactor() == 0 and bodyPart:getGarlicFactor() == 0 and bodyPart:getPlantainFactor() then ISInventoryPaneContextMenu.transferIfNeeded(playerObj, item); ISTimedActionQueue.add(ISComfreyCataplasm:new(playerObj,playerObj, item, bodyPart)); return end end elseif item:getType() == "WildGarlicCataplasm" then -- Helps to fight against infection. local bodyPartsDamaged = ISBzHotSlot.haveDamagePart(playerNumber); for _, bodyPart in ipairs(bodyPartsDamaged) do if bodyPart:isInfectedWound() and bodyPart:getGarlicFactor() == 0 and bodyPart:getComfreyFactor() == 0 and bodyPart:getPlantainFactor() then ISInventoryPaneContextMenu.transferIfNeeded(playerObj, item); ISTimedActionQueue.add(ISGarlicCataplasm:new(playerObj,playerObj, item, bodyPart)); return end end elseif item:getType() == "PlantainCataplasm" then -- Aids recovery from wounds. - in java scratched deepWounded cut local bodyPartsDamaged = ISBzHotSlot.haveDamagePart(playerNumber); for _, bodyPart in ipairs(bodyPartsDamaged) do if (bodyPart:scratched() or bodyPart:deepWounded() or bodyPart:isCut()) and bodyPart:getPlantainFactor() and bodyPart:getGarlicFactor() == 0 and bodyPart:getComfreyFactor() == 0 then ISInventoryPaneContextMenu.transferIfNeeded(playerObj, item); ISTimedActionQueue.add(ISPlantainCataplasm:new(playerObj,playerObj, item, bodyPart)); return end end elseif item:getType() == "Splint" then -- fix broken bones Splint. local bodyPartsDamaged = ISBzHotSlot.haveDamagePart(playerNumber); for _, bodyPart in ipairs(bodyPartsDamaged) do if bodyPart:getFractureTime() > 0 and bodyPart:getSplintFactor() == 0 then ISInventoryPaneContextMenu.transferIfNeeded(playerObj, item); ISTimedActionQueue.add(ISSplint:new(playerObj,playerObj,nil, item, bodyPart, true)); return end end end end end
return {'obboezem','obbink','obbens','obbes'}
ESX = nil local PlayerData = {} local isLoggedIn = false Callbacks = nil actionCb = {} isPhoneOpen = false Citizen.CreateThread(function() while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(0) end while ESX.GetPlayerData().job == nil do Citizen.Wait(10) end ESX.PlayerData = ESX.GetPlayerData() end) RegisterNetEvent('mythic_phone:client:ActionCallback') AddEventHandler('mythic_phone:client:ActionCallback', function(identifier, data) if actionCb[identifier] ~= nil then actionCb[identifier](data) actionCb[identifier] = nil end end) RegisterNetEvent('mythic_phone:client:TogglePhone') AddEventHandler('mythic_phone:client:TogglePhone', function(identifier, data) TogglePhone() end) RegisterNetEvent('mythic_phone:client:SetupData') AddEventHandler('mythic_phone:client:SetupData', function(data) SendNUIMessage({ action = 'setup', data = data }) end) function DrawUIText(text, font, centre, x, y, scale, r, g, b, a) SetTextFont(font) SetTextProportional(0) SetTextScale(scale, scale) SetTextColour(r, g, b, a) SetTextDropShadow(0, 0, 0, 0,255) SetTextEdge(1, 0, 0, 0, 255) SetTextDropShadow() SetTextOutline() SetTextCentre(centre) SetTextEntry("STRING") AddTextComponentString(text) DrawText(x , y) end function CalculateTimeToDisplay() hour = GetClockHours() minute = GetClockMinutes() local obj = {} if hour <= 9 then hour = "0" .. hour end if minute <= 9 then minute = "0" .. minute end obj.hour = hour obj.minute = minute return obj end function hasPhone(cb) ESX.TriggerServerCallback("mythic_phone:hasItemCb", function(haveIt) if haveIt then cb(true) else cb(false) end end, "phone", 1) end function hasDecrypt(cb) ESX.TriggerServerCallback("mythic_phone:hasItemCb", function(haveIt) if haveIt then cb(true) else cb(false) end end, "decrypt", 1) end function toggleIrc(status) if not status then TriggerEvent('mythic_phone:client:setEnableApp', 'IRC', false) else TriggerEvent('mythic_phone:client:setEnableApp', 'IRC', true) end end function ShowNoPhoneWarning() exports.mythic_notify:SendAlert('inform', 'You dont have a phone buddy.') end RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) isLoggedIn = true local counter = 0 Citizen.CreateThread(function() while isLoggedIn do if IsDisabledControlJustReleased(1, 170) then TogglePhone() end if counter <= 0 then local time = CalculateTimeToDisplay() SendNUIMessage({ action = 'updateTime', time = time.hour .. ':' .. time.minute }) counter = 100 else counter = counter - 1 end Citizen.Wait(-1) end end) end) function TogglePhone() if not openingCd or isPhoneOpen then isPhoneOpen = not isPhoneOpen if isPhoneOpen == true then hasPhone(function(hasPhone) if hasPhone then PhonePlayIn() SetNuiFocus(true, true) if Call ~= nil then SendNUIMessage( { action = 'show', number = Call.number, initiator = Call.initiator } ) else SendNUIMessage( { action = 'show' } ) end DisableControls() else isPhoneOpen = false end end) else SetNuiFocus(false, false) if not IsInCall() then PhonePlayOut() end SendNUIMessage( { action = 'hide' } ) end openingCd = true end Citizen.CreateThread(function() Citizen.Wait(2000) openingCd = false end) end function ForceClosePhone() isPhoneOpen = false SetNuiFocus(isPhoneOpen, isPhoneOpen) if not IsInCall() then PhonePlayOut() end SendNUIMessage( { action = 'hide' } ) end function DisableControls() Citizen.CreateThread(function() while isPhoneOpen do DisableControlAction(0, 1, true) -- LookLeftRight DisableControlAction(0, 2, true) -- LookUpDown DisableControlAction(0, 106, true) -- VehicleMouseControlOverride DisableControlAction(0, 30, true) -- disable left/right DisableControlAction(0, 31, true) -- disable forward/back DisableControlAction(0, 36, true) -- INPUT_DUCK DisableControlAction(0, 21, true) -- disable sprint DisableControlAction(0, 63, true) -- veh turn left DisableControlAction(0, 64, true) -- veh turn right DisableControlAction(0, 71, true) -- veh forward DisableControlAction(0, 72, true) -- veh backwards DisableControlAction(0, 75, true) -- disable exit vehicle DisablePlayerFiring(PlayerId(), true) -- Disable weapon firing DisableControlAction(0, 24, true) -- disable attack DisableControlAction(0, 25, true) -- disable aim DisableControlAction(1, 37, true) -- disable weapon select DisableControlAction(0, 47, true) -- disable weapon DisableControlAction(0, 58, true) -- disable weapon DisableControlAction(0, 140, true) -- disable melee DisableControlAction(0, 141, true) -- disable melee DisableControlAction(0, 142, true) -- disable melee DisableControlAction(0, 143, true) -- disable melee DisableControlAction(0, 263, true) -- disable melee DisableControlAction(0, 264, true) -- disable melee DisableControlAction(0, 257, true) -- disable melee Citizen.Wait(1) end end) end RegisterNUICallback("ClosePhone", function(data, cb) TogglePhone() end) RegisterNUICallback("ClearUnread", function(data, cb) UpdateAppUnread('messages', 0) end)
------------------------------------------------------------------------ --[[ ArgMax ]]-- -- Returns the index of the maxima for dimension dim. -- Cannot backpropagate through this module. -- Created for use with ReinforceCategorical. ------------------------------------------------------------------------ local ArgMax, parent = torch.class("nn.ArgMax", "nn.Module") function ArgMax:__init(dim, nInputDim, asLong) parent.__init(self) self.dim = dim or 1 self.nInputDim = nInputDim or 9999 self.asLong = (asLong == nil) and true or asLong if self.asLong then self.output = torch.LongTensor() end end function ArgMax:updateOutput(input) self._value = self._value or input.new() self._indices = self._indices or (torch.type(input) == 'torch.CudaTensor' and (torch.CudaLongTensor and torch.CudaLongTensor() or torch.CudaTensor()) or torch.LongTensor()) local dim = (input:dim() > self.nInputDim) and (self.dim + 1) or self.dim torch.max(self._value, self._indices, input, dim) if input:dim() > 1 then local idx = self._indices:select(dim, 1) self.output:resize(idx:size()):copy(idx) else self.output:resize(self._indices:size()):copy(self._indices) end return self.output end function ArgMax:updateGradInput(input, gradOutput) -- cannot backprop from an index so just return a dummy zero tensor self.gradInput:resizeAs(input):zero() return self.gradInput end function ArgMax:type(type) -- torch.max expects a LongTensor as indices, whereas cutorch.max expects a CudaTensor. if type == 'torch.CudaTensor' then parent.type(self, type) else -- self._indices must be a LongTensor. Setting it to nil temporarily avoids -- unnecessary memory allocations. local indices indices, self._indices = self._indices, nil parent.type(self, type) self._indices = indices and indices:long() or nil end if self.asLong then self.output = torch.LongTensor() end return self end
local THNN = require 'nn.THNN' local SpatialDownSampling, parent = torch.class('nn.SpatialDownSampling', 'nn.Module') function SpatialDownSampling:__init(nInputPlane, kW, kH, dW, dH, padW, padH) parent.__init(self) dW = dW or 1 dH = dH or 1 self.nInputPlane = nInputPlane self.nOutputPlane = nInputPlane self.kW = kW self.kH = kH self.dW = dW self.dH = dH self.padW = padW or 0 self.padH = padH or self.padW self.kernel = torch.Tensor(self.nOutputPlane, nInputPlane, kH, kW) -- bilinear kernel self.K = torch.Tensor(kH, kW) local cx = (self.kW + 1.0) / 2.0 local cy = (self.kH + 1.0) / 2.0 local sdy = 2.0 * self.dW / 6.0 local sdx = 2.0 * self.dH / 6.0 local vy = sdy * sdy local vx = sdx * sdx for i = 1,kW do local dx = (cx-i)*(cx-i) for j = 1,kH do local dy = (cy-j)*(cy-j) local val = math.exp(-0.5*(dx/vx+dy/vy)) self.K[j][i] = val end end self.K = self.K / torch.sum(self.K) self:reset() self.gradInput = nil end function SpatialDownSampling:reset() self.kernel:zero() for i = 1,self.nInputPlane do self.kernel[i][i]:copy(self.K) end end local function backCompatibility(self) self.finput = self.finput or self.kernel.new() self.fgradInput = self.fgradInput or self.kernel.new() if self.padding then self.padW = self.padding self.padH = self.padding self.padding = nil else self.padW = self.padW or 0 self.padH = self.padH or 0 end if self.kernel:dim() == 2 then self.kernel = self.kernel:view(self.nOutputPlane, self.nInputPlane, self.kH, self.kW) end end function SpatialDownSampling:updateOutput(input) assert(input.THNN, torch.type(input)..'.THNN backend not imported') backCompatibility(self) input.THNN.SpatialConvolutionMM_updateOutput( input:cdata(), self.output:cdata(), self.kernel:cdata(), THNN.optionalTensor(self.bias), self.finput:cdata(), self.fgradInput:cdata(), self.kW, self.kH, self.dW, self.dH, self.padW, self.padH ) return self.output end function SpatialDownSampling:updateGradInput(input, gradOutput) end function SpatialDownSampling:type(type,tensorCache) self.finput = self.finput and torch.Tensor() self.fgradInput = self.fgradInput and torch.Tensor() return parent.type(self,type,tensorCache) end function SpatialDownSampling:__tostring__() local s = string.format('%s(%d -> %d, %dx%d', torch.type(self), self.nInputPlane, self.nOutputPlane, self.kW, self.kH) if self.dW ~= 1 or self.dH ~= 1 or self.padW ~= 0 or self.padH ~= 0 then s = s .. string.format(', %d,%d', self.dW, self.dH) end if (self.padW or self.padH) and (self.padW ~= 0 or self.padH ~= 0) then s = s .. ', ' .. self.padW .. ',' .. self.padH end if self.bias then return s .. ')' else return s .. ') without bias' end end
-- LuaJIT's memory profile post-processing module. local M = {} local symtab = require "utils.symtab" function M.form_heap_delta(events, symbols) -- Auto resurrects source event lines for counting/reporting. local dheap = setmetatable({}, {__index = function(t, line) rawset(t, line, { dbytes = 0, nalloc = 0, nfree = 0, }) return t[line] end}) for _, event in pairs(events.alloc) do if event.loc then local ev_line = symtab.demangle(symbols, event.loc) if (event.alloc > 0) then dheap[ev_line].dbytes = dheap[ev_line].dbytes + event.alloc dheap[ev_line].nalloc = dheap[ev_line].nalloc + event.num end end end -- Realloc and free events are pretty the same. -- We aren't interested in aggregated alloc/free sizes for -- the event, but only for new and old size values inside -- alloc-realloc-free chain. Assuming that we have -- no collisions between different object addresses. local function process_non_alloc_events(events_by_type) for _, event in pairs(events_by_type) do -- Realloc and free events always have key named "primary" -- that references the table with memory changed -- (may be empty). for _, heap_chunk in pairs(event.primary) do local ev_line = symtab.demangle(symbols, heap_chunk.loc) if (heap_chunk.alloced > 0) then dheap[ev_line].dbytes = dheap[ev_line].dbytes + heap_chunk.alloced dheap[ev_line].nalloc = dheap[ev_line].nalloc + heap_chunk.count end if (heap_chunk.freed > 0) then dheap[ev_line].dbytes = dheap[ev_line].dbytes - heap_chunk.freed dheap[ev_line].nfree = dheap[ev_line].nfree + heap_chunk.count end end end end process_non_alloc_events(events.realloc) process_non_alloc_events(events.free) return dheap end return M
local resty_redis = require("resty.redis") local strutil = require("acid.strutil") local rpc_logging = require("acid.rpc_logging") local to_str = strutil.to_str local _M = { _VERSION = "0.1" } local mt = { __index = _M } local function get_redis_cli(self) local redis_cli, err_msg = resty_redis:new() if redis_cli == nil then return nil, 'NewRedisError', err_msg end redis_cli:set_timeout(self.timeout) local ok, err_msg = redis_cli:connect( self.ip, self.port ) if ok == nil then return nil, 'ConnectRedisError', err_msg end return redis_cli end local function run_redis_cmd(self, cmd, ...) local args = {...} local log_entry = rpc_logging.new_entry('redis', { ip = self.ip, port = self.port, uri = to_str(cmd, ':', args[1])}) local redis_cli, err_code, err_msg = get_redis_cli(self) rpc_logging.set_time(log_entry, 'upstream', 'conn') if err_code ~= nil then rpc_logging.set_err(log_entry, err_code) rpc_logging.add_log(log_entry) return nil, err_code, err_msg end local val, err_msg = redis_cli[cmd](redis_cli, ... ) rpc_logging.set_time(log_entry, 'upstream', 'recv') if val == nil or err_msg ~= nil then rpc_logging.set_err(log_entry, err_msg) rpc_logging.add_log(log_entry) return nil, 'RunRedisCMDError', to_str('cmd: ', cmd, ', err: ', err_msg) end local itv = log_entry.upstream.time.conn + log_entry.upstream.time.recv if itv >= self.min_log_time then rpc_logging.add_log(log_entry) end if self.keepalive_timeout ~= nil then redis_cli:set_keepalive(self.keepalive_timeout, self.keepalive_size) end return val end function _M.new(_, ip, port, opts) local opts = opts or {} local obj = { ip = ip, port = port, timeout = opts.timeout or 1000, retry_count = opts.retry_count or 1, keepalive_size = opts.keepalive_size, keepalive_timeout = opts.keepalive_timeout, min_log_time = opts.min_log_time or 0.005, } return setmetatable( obj, mt ) end function _M.retry(self, n) self.retry_count = n return self end function _M.transaction(self, cmds) local ok, err_code, err_msg = self:multi() if err_code ~= nil then return nil, err_code, err_msg end if ok ~= 'OK' then return nil, 'RunRedisCMDError', 'multi no reply with the string OK' end for _, cmd_and_args in ipairs(cmds) do local cmd, cmd_args = unpack(cmd_and_args) local rst, err_code, err_msg = self[cmd](self, unpack(cmd_args or {})) if err_code ~= nil then self:discard() return nil, err_code, err_msg end if rst ~= 'QUEUED' then self:discard() return nil, 'RunRedisCMDError', cmd .. ' no reply with the string QUEUED' end end local multi_rst, err_code, err_msg = self:exec() if err_code ~= nil then self:discard() return nil, err_code, err_msg end return multi_rst end setmetatable(_M, {__index = function(_, cmd) local method = function (self, ...) local val, err_code, err_msg for ii = 1, self.retry_count, 1 do val, err_code, err_msg = run_redis_cmd(self, cmd, ...) if err_code == nil then return val, nil, nil end ngx.log(ngx.WARN, to_str('redis retry ', ii, ' error. ', err_code, ':', err_msg)) end return nil, err_code, err_msg end _M[cmd] = method return method end}) return _M
-- Command line code to serialize assets for rojo syncing local feed = "return {\n" local defaults = { ["Volume"] = 0.5, ["EmitterSize"] = 10, ["MaxDistance"] = 10000, ["Looped"] = false, ["PlaybackSpeed"] = 1, } for _, sound in pairs(game.ReplicatedStorage.assets.sounds:GetChildren()) do feed = feed .. "\t[\"" .. sound.Name .. "\"] = {\n" for property, default in pairs(defaults) do local value = sound[property] if value ~= default then if typeof(value) == "number" then value = (math.floor(value * 10)) / 10 end feed = feed .. "\t\t" .. property .. " = " .. tostring(value) .. ",\n" end end feed = feed .. "\t\tSoundId = \"" .. sound.SoundId .. "\",\n" feed = feed .. "\t},\n" end feed = feed .. "}" workspace.stuff.Source = feed
--- @title: --- GNPanel: <Panel> Base GNLib panel used as a parent for other VGUIs such as GNButton. --- @note: --- Parent: DFrame --- @params: --- GNPanel/SetColor( Color color ): <function> Set panel color --- GNPanel/GetColor(): <function> Get panel color --- GNPanel/SetDefaultCursor( string cursor ): <function> Set panel cursor (https://wiki.facepunch.com/gmod/Cursors) --- GNPanel/GetDefaultCursor(): <function> Get panel cursor --- GNPanel/IsClicking(): <function> Return if the panel is clicked --- GNPanel/IsHovered(): <function> Return if the panel is hovered --- GNPanel/GetLastClickPos(): <function> Return the X and Y-position of the last click --- GNPanel/SetEnabled( boolean bool ): <function> Set if the panel is enabled or disabled (it mainly change the cursor) --- GNPanel/IsEnabled(): <function> Return if the panel is enabled --- GNPanel/DoClick(): <function/event> Called on click --- GNPanel/OnPressed(): <function/event> Called on left mouse button press --- GNPanel/OnReleased(): <function/event> Called on left mouse button release local PANEL = {} AccessorFunc( PANEL, "color", "Color" ) AccessorFunc( PANEL, "default_cursor", "DefaultCursor" ) function PANEL:Init() self:SetSize( 500, 500 ) self:Center() self:ShowCloseButton( false ) self:SetDraggable( false ) self:SetTitle( "" ) self.color = GNLib.Colors.MidnightBlue self:SetDefaultCursor() self.enabled = true self.clicking = false self.hovered = false self.last_click_x = 0 self.last_click_y = 0 end function PANEL:SetDefaultCursor( cursor ) self.default_cursor = cursor or "none" self:SetCursor( self.default_cursor ) end function PANEL:IsClicking() return self.clicking end function PANEL:IsHovered() return self.hovered end function PANEL:GetLastClickPos() return self.last_click_x, self.last_click_y end -- > Enable function PANEL:SetEnabled( bool ) self.enabled = bool self:SetCursor( bool and self.default_cursor or "none" ) end function PANEL:IsEnabled() return self.enabled end -- > Events function PANEL:DoClick() end function PANEL:OnPressed() end function PANEL:OnReleased() end function PANEL:OnMousePressed( key_code ) if not self.enabled then return end if MOUSE_LEFT == key_code then self.last_click_x, self.last_click_y = self:LocalCursorPos() self.clicking = true self:OnPressed() end end function PANEL:OnMouseReleased( key_code ) if self.clicking then self:DoClick() self.clicking = false self:OnReleased() end end function PANEL:OnMousePassed( hovered ) self.hovered = hovered end function PANEL:OnCursorExited() self:OnMousePassed( false ) self.clicking = false end function PANEL:OnCursorEntered() self:OnMousePassed( true ) end vgui.Register( "GNPanel", PANEL, "DFrame" )
return {'hor','hora','horde','hordeloop','hordeloopster','hordelopen','hordeloper','horden','horeca','horecabedrijf','horecabeheer','horecabeleid','horecabestemming','horecabeurs','horecabond','horecaboot','horecabranche','horecafaciliteiten','horecafunctie','horecagebied','horecagedeelte','horecagelegenheid','horecagroothandel','horecaondernemer','horecaonderneming','horecapersoneel','horecaprijzen','horecasector','horecavereniging','horecavergunning','horecavoorziening','horecawet','horecazaak','horen','horendol','horendrager','horenswaard','horentje','horig','horige','horigheid','horizon','horizonbepaling','horizont','horizontaal','horizontalisering','horizontalisme','horizontalistisch','horizonvervuiling','hork','horkerig','horlepiep','horloge','horlogearmband','horlogebandje','horlogeglas','horlogekast','horlogeketting','horlogemaker','horlogemerk','horlogerie','horloges','horlogesleutel','horlogeveer','horlogewijzer','hormon','hormonaal','hormonen','hormonengebruik','hormonenhandel','hormonenmaffia','hormoon','hormoonbehandeling','hormoonbepaling','hormoongebruik','hormoonhuishouding','hormooninjectie','hormoonpreparaat','hormoonproductie','hormoonspiegel','hormoonstimulatie','hormoonverstorend','hormoonvlees','hormoonvrij','horoscoop','horoscooptrekker','horrelvoet','horren','horreur','horribel','horror','horrorfilm','horrorgenre','horrorkomedie','horrorscenario','horrorverhaal','hors','horsmakreel','horst','horsten','hort','horten','hortensia','horticultuur','hortoloog','hortus','horzel','horzelfunctie','hortologie','horecamedewerker','hormoontherapie','hormonenhuishouding','hormoonbalans','hormoonklier','hormoonkuur','hormoonstelsel','hormoonwerking','hormoonzalf','horrengaas','horrorliefhebber','horizonlijn','horoscooptekening','horebeke','horenaar','horpmaal','horstenaar','horster','horsts','horst','horatio','horck','hordijk','horstink','horbach','horlings','hornstra','horstman','horvers','horeman','horenberg','horjus','horneman','hornsveld','horsting','hortensius','horsmans','horden','hornman','horsthuis','horseling','hornes','hormes','hord','hordes','hordt','horecabazen','horecabedrijven','horecabezoekers','horecagelegenheden','horecamedewerkers','horecaondernemingen','horecapanden','horecavoorzieningen','horend','horende','horenden','horendolle','horendragers','horens','horentjes','horigen','horizonnen','horizontale','horizontaler','horizonten','horken','horlogebandjes','horlogeglazen','horlogekasten','horlogekettingen','horlogemakers','horlogesleutels','horlogetje','horlogeveren','horlogewijzers','hormonale','hormons','hormoonontregelaars','hormoontabletten','hormoonverstorende','horoscooptrekkers','horoscopen','horrelvoeten','horretje','horretjes','horrorverhalen','hortend','hortensias','hortte','hortten','horzels','horzeltje','horzeltjes','horzen','hordde','hordelopers','horecaondernemers','horecazaken','horizonbepalingen','horizontalistische','horkerige','hormoonbehandelingen','hormooninjecties','hormoonpreparaten','hormoonspiegels','horrorfilms','horsen','horsmakrelen','hortende','horzelfuncties','horribele','horlepiepen','horlogerieen','hortologen','hortussen','horatios','hormoonklieren','horrorliefhebbers','horlogemerken','hormoonbepalingen','hormoonkuren','hormoonvrije','horrorscenarios'}
local nn = require 'nn' require 'cunn' local Convolution = cudnn.SpatialConvolution local SBatchNorm = nn.SpatialBatchNormalization local Max = nn.SpatialMaxPooling local ReLU = nn.ReLU local Dropout = nn.Dropout local function convblock(ninput, noutput) return nn.Sequential() :add(Convolution(ninput,noutput,3,3,1,1,1,1)) :add(ReLU(true)) :add(SBatchNorm(noutput)) :add(Max(2,2,2,2)) :add(Dropout(0.2)) end local function createModel(opt) local model = nn.Sequential() model:add(convblock(3,32)) -- 16x16 model:add(convblock(32,64)) -- 8x8 model:add(convblock(64,128)) -- 4x4 model:add(nn.View(-1):setNumInputDims(3)) model:add(nn.Linear(2048,512)) model:add(ReLU(true)) model:add(nn.BatchNormalization(512)) model:add(Dropout(0.5)) model:add(nn.Linear(512,100)) local function ConvInit(name) for k,v in pairs(model:findModules(name)) do local n = v.kW*v.kH*v.nOutputPlane v.weight:normal(0,math.sqrt(2/n)) v.bias:zero() end end local function BNInit(name) for k,v in pairs(model:findModules(name)) do v.weight:fill(1) v.bias:zero() end end ConvInit('cudnn.SpatialConvolution') ConvInit('nn.SpatialConvolution') BNInit('fbnn.SpatialBatchNormalization') BNInit('cudnn.SpatialBatchNormalization') BNInit('nn.SpatialBatchNormalization') BNInit('nn.BatchNormalization') for k,v in pairs(model:findModules('nn.Linear')) do v.bias:zero() end model:cuda() if opt.cudnn == 'deterministic' then model:apply(function(m) if m.setMode then m:setMode(1,1,1) end end) end model:get(1).gradInput = nil return model end return createModel
-- MySQL client library ffi binding. -- Written by Cosmin Apreutesei. Public domain. -- Supports MySQL Connector/C 6.1. -- Based on MySQL 5.7 manual. local ffi = require 'ffi' local bit = require 'bit' require 'mysql_h' local C local M = {} -- select a mysql client library implementation. local function bind(lib) if not C then if not lib or lib == 'mysql' then -- C = ffi.load(ffi.abi 'win' and 'libmysql' or 'mysqlclient') C = ffi.load('/usr/local/mysql/lib/libmysqlclient.dylib') elseif lib == 'mariadb' then C = ffi.load 'mariadb' elseif type(lib) == 'string' then C = ffi.load(lib) else C = lib end M.C = C end return M end M.bind = bind -- we compare NULL pointers against NULL instead of nil for compatibility with luaffi. local NULL = ffi.cast('void*', nil) local function ptr(p) -- convert NULLs to nil if p == NULL then return nil end return p end local function cstring(data) -- convert null-term non-empty C strings to lua strings if data == NULL or data[0] == 0 then return nil end return ffi.string(data) end -- error reporting local function myerror(mysql, stacklevel) local err = cstring(C.mysql_error(mysql)) if not err then return end error(string.format('mysql error: %s', err), stacklevel or 3) end local function checkz(mysql, ret) if ret == 0 then return end myerror(mysql, 4) end local function checkh(mysql, ret) if ret ~= NULL then return ret end myerror(mysql, 4) end local function enum(e, prefix) local v = type(e) == 'string' and (prefix and C[prefix .. e] or C[e]) or e return assert(v, 'invalid enum value') end -- client library info function M.thread_safe() bind() return C.mysql_thread_safe() == 1 end function M.client_info() bind() return cstring(C.mysql_get_client_info()) end function M.client_version() bind() return tonumber(C.mysql_get_client_version()) end -- connections local function bool_ptr(b) return ffi.new('my_bool[1]', b or false) end local function uint_bool_ptr(b) return ffi.new('uint32_t[1]', b or false) end local function uint_ptr(i) return ffi.new('uint32_t[1]', i) end local function proto_ptr(proto) -- proto is 'MYSQL_PROTOCOL_*' or mysql.C.MYSQL_PROTOCOL_* return ffi.new('uint32_t[1]', enum(proto)) end local function ignore_arg() return nil end local option_encoders = { MYSQL_ENABLE_CLEARTEXT_PLUGIN = bool_ptr, MYSQL_OPT_LOCAL_INFILE = uint_bool_ptr, MYSQL_OPT_PROTOCOL = proto_ptr, MYSQL_OPT_READ_TIMEOUT = uint_ptr, MYSQL_OPT_WRITE_TIMEOUT = uint_ptr, MYSQL_OPT_USE_REMOTE_CONNECTION = ignore_arg, MYSQL_OPT_USE_EMBEDDED_CONNECTION = ignore_arg, MYSQL_OPT_GUESS_CONNECTION = ignore_arg, MYSQL_SECURE_AUTH = bool_ptr, MYSQL_REPORT_DATA_TRUNCATION = bool_ptr, MYSQL_OPT_RECONNECT = bool_ptr, MYSQL_OPT_SSL_VERIFY_SERVER_CERT = bool_ptr, MYSQL_ENABLE_CLEARTEXT_PLUGIN = bool_ptr, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS = bool_ptr } function M.connect(t, ...) bind() local host, user, pass, db, charset, port local unix_socket, flags, options, attrs local key, cert, ca, capath, cipher if type(t) == 'string' then host, user, pass, db, charset, port = t, ... else host, user, pass, db, charset, port = t.host, t.user, t.pass, t.db, t.charset, t.port unix_socket, flags, options, attrs = t.unix_socket, t.flags, t.options, t.attrs key, cert, ca, capath, cipher = t.key, t.cert, t.ca, t.capath, t.cipher end port = port or 0 local client_flag = 0 if type(flags) == 'number' then client_flag = flags elseif flags then for k, v in pairs(flags) do local flag = enum(k, 'MYSQL_') -- 'CLIENT_*' or mysql.C.MYSQL_CLIENT_* enum client_flag = v and bit.bor(client_flag, flag) or bit.band(client_flag, bit.bnot(flag)) end end local mysql = assert(C.mysql_init(nil)) ffi.gc(mysql, C.mysql_close) if options then for k, v in pairs(options) do local opt = enum(k) -- 'MYSQL_OPT_*' or mysql.C.MYSQL_OPT_* enum local encoder = option_encoders[k] if encoder then v = encoder(v) end assert(C.mysql_options(mysql, opt, ffi.cast('const void*', v)) == 0, 'invalid option') end end if attrs then for k, v in pairs(attrs) do assert( C.mysql_options4(mysql, C.MYSQL_OPT_CONNECT_ATTR_ADD, k, v) == 0) end end if key then checkz(mysql, C.mysql_ssl_set(mysql, key, cert, ca, capath, cipher)) end checkh(mysql, C.mysql_real_connect(mysql, host, user, pass, db, port, unix_socket, client_flag)) if charset then mysql:set_charset(charset) end return mysql end local conn = {} -- connection methods function conn.close(mysql) C.mysql_close(mysql) ffi.gc(mysql, nil) end function conn.set_charset(mysql, charset) checkz(mysql, C.mysql_set_character_set(mysql, charset)) end function conn.select_db(mysql, db) checkz(mysql, C.mysql_select_db(mysql, db)) end function conn.change_user(mysql, user, pass, db) checkz(mysql, C.mysql_change_user(mysql, user, pass, db)) end function conn.set_multiple_statements(mysql, yes) checkz(mysql, C.mysql_set_server_option(mysql, yes and C.MYSQL_OPTION_MULTI_STATEMENTS_ON or C.MYSQL_OPTION_MULTI_STATEMENTS_OFF)) end -- connection info function conn.charset(mysql) return cstring(C.mysql_character_set_name(mysql)) end function conn.charset_info(mysql) local info = ffi.new 'MY_CHARSET_INFO' checkz(C.mysql_get_character_set_info(mysql, info)) assert(info.name ~= NULL) assert(info.csname ~= NULL) return { number = info.number, state = info.state, name = cstring(info.csname), -- csname and name are inverted from the spec collation = cstring(info.name), comment = cstring(info.comment), dir = cstring(info.dir), mbminlen = info.mbminlen, mbmaxlen = info.mbmaxlen } end function conn.ping(mysql) local ret = C.mysql_ping(mysql) if ret == 0 then return true elseif C.mysql_error(mysql) == C.MYSQL_CR_SERVER_GONE_ERROR then return false end myerror(mysql) end function conn.thread_id(mysql) return C.mysql_thread_id(mysql) -- NOTE: result is cdata on x64! end function conn.stat(mysql) return cstring(checkh(mysql, C.mysql_stat(mysql))) end function conn.server_info(mysql) return cstring(checkh(mysql, C.mysql_get_server_info(mysql))) end function conn.host_info(mysql) return cstring(checkh(mysql, C.mysql_get_host_info(mysql))) end function conn.server_version(mysql) return tonumber(C.mysql_get_server_version(mysql)) end function conn.proto_info(...) return C.mysql_get_proto_info(...) end function conn.ssl_cipher(mysql) return cstring(C.mysql_get_ssl_cipher(mysql)) end -- transactions function conn.commit(mysql) checkz(mysql, C.mysql_commit(mysql)) end function conn.rollback(mysql) checkz(mysql, C.mysql_rollback(mysql)) end function conn.set_autocommit(mysql, yes) checkz(mysql, C.mysql_autocommit(mysql, yes == nil or yes)) end -- queries function conn.escape_tobuffer(mysql, data, size, buf, sz) size = size or #data assert(sz >= size * 2 + 1) return tonumber(C.mysql_real_escape_string(mysql, buf, data, size)) end function conn.escape(mysql, data, size) size = size or #data local sz = size * 2 + 1 local buf = ffi.new('uint8_t[?]', sz) sz = conn.escape_tobuffer(mysql, data, size, buf, sz) return ffi.string(buf, sz) end function conn.query(mysql, data, size) checkz(mysql, C.mysql_real_query(mysql, data, size or #data)) end -- query info function conn.field_count(...) return C.mysql_field_count(...) end local minus1_uint64 = ffi.cast('uint64_t', ffi.cast('int64_t', -1)) function conn.affected_rows(mysql) local n = C.mysql_affected_rows(mysql) if n == minus1_uint64 then myerror(mysql) end return tonumber(n) end function conn.insert_id(...) return C.mysql_insert_id(...) -- NOTE: result is cdata on x64! end function conn.errno(conn) local err = C.mysql_errno(conn) if err == 0 then return end return err end function conn.sqlstate(mysql) return cstring(C.mysql_sqlstate(mysql)) end function conn.warning_count(...) return C.mysql_warning_count(...) end function conn.info(mysql) return cstring(C.mysql_info(mysql)) end -- query results function conn.next_result(mysql) -- multiple statement queries return multiple results local ret = C.mysql_next_result(mysql) if ret == 0 then return true end if ret == -1 then return false end myerror(mysql) end function conn.more_results(mysql) return C.mysql_more_results(mysql) == 1 end local function result_function(func) return function(mysql) local res = checkh(mysql, C[func](mysql)) return ffi.gc(res, C.mysql_free_result) end end conn.store_result = result_function 'mysql_store_result' conn.use_result = result_function 'mysql_use_result' local res = {} -- result methods function res.free(res) C.mysql_free_result(res) ffi.gc(res, nil) end function res.row_count(res) return tonumber(C.mysql_num_rows(res)) end function res.field_count(...) return C.mysql_num_fields(...) end function res.eof(res) return C.mysql_eof(res) ~= 0 end -- field info local field_type_names = { [ffi.C.MYSQL_TYPE_DECIMAL] = 'decimal', -- DECIMAL or NUMERIC [ffi.C.MYSQL_TYPE_TINY] = 'tinyint', [ffi.C.MYSQL_TYPE_SHORT] = 'smallint', [ffi.C.MYSQL_TYPE_LONG] = 'int', [ffi.C.MYSQL_TYPE_FLOAT] = 'float', [ffi.C.MYSQL_TYPE_DOUBLE] = 'double', -- DOUBLE or REAL [ffi.C.MYSQL_TYPE_NULL] = 'null', [ffi.C.MYSQL_TYPE_TIMESTAMP] = 'timestamp', [ffi.C.MYSQL_TYPE_LONGLONG] = 'bigint', [ffi.C.MYSQL_TYPE_INT24] = 'mediumint', [ffi.C.MYSQL_TYPE_DATE] = 'date', -- pre mysql 5.0, storage = 4 bytes [ffi.C.MYSQL_TYPE_TIME] = 'time', [ffi.C.MYSQL_TYPE_DATETIME] = 'datetime', [ffi.C.MYSQL_TYPE_YEAR] = 'year', [ffi.C.MYSQL_TYPE_NEWDATE] = 'date', -- mysql 5.0+, storage = 3 bytes [ffi.C.MYSQL_TYPE_VARCHAR] = 'varchar', [ffi.C.MYSQL_TYPE_BIT] = 'bit', [ffi.C.MYSQL_TYPE_TIMESTAMP2] = 'timestamp', -- mysql 5.6+, can store fractional seconds [ffi.C.MYSQL_TYPE_DATETIME2] = 'datetime', -- mysql 5.6+, can store fractional seconds [ffi.C.MYSQL_TYPE_TIME2] = 'time', -- mysql 5.6+, can store fractional seconds [ffi.C.MYSQL_TYPE_NEWDECIMAL] = 'decimal', -- mysql 5.0+, Precision math DECIMAL or NUMERIC [ffi.C.MYSQL_TYPE_ENUM] = 'enum', [ffi.C.MYSQL_TYPE_SET] = 'set', [ffi.C.MYSQL_TYPE_TINY_BLOB] = 'tinyblob', [ffi.C.MYSQL_TYPE_MEDIUM_BLOB] = 'mediumblob', [ffi.C.MYSQL_TYPE_LONG_BLOB] = 'longblob', [ffi.C.MYSQL_TYPE_BLOB] = 'text', -- TEXT or BLOB [ffi.C.MYSQL_TYPE_VAR_STRING] = 'varchar', -- VARCHAR or VARBINARY [ffi.C.MYSQL_TYPE_STRING] = 'char', -- CHAR or BINARY [ffi.C.MYSQL_TYPE_GEOMETRY] = 'spatial' -- Spatial field } local binary_field_type_names = { [ffi.C.MYSQL_TYPE_BLOB] = 'blob', [ffi.C.MYSQL_TYPE_VAR_STRING] = 'varbinary', [ffi.C.MYSQL_TYPE_STRING] = 'binary' } local field_flag_names = { [ffi.C.MYSQL_NOT_NULL_FLAG] = 'not_null', [ffi.C.MYSQL_PRI_KEY_FLAG] = 'pri_key', [ffi.C.MYSQL_UNIQUE_KEY_FLAG] = 'unique_key', [ffi.C.MYSQL_MULTIPLE_KEY_FLAG] = 'key', [ffi.C.MYSQL_BLOB_FLAG] = 'is_blob', [ffi.C.MYSQL_UNSIGNED_FLAG] = 'unsigned', [ffi.C.MYSQL_ZEROFILL_FLAG] = 'zerofill', [ffi.C.MYSQL_BINARY_FLAG] = 'is_binary', [ffi.C.MYSQL_ENUM_FLAG] = 'is_enum', [ffi.C.MYSQL_AUTO_INCREMENT_FLAG] = 'autoincrement', [ffi.C.MYSQL_TIMESTAMP_FLAG] = 'is_timestamp', [ffi.C.MYSQL_SET_FLAG] = 'is_set', [ffi.C.MYSQL_NO_DEFAULT_VALUE_FLAG] = 'no_default', [ffi.C.MYSQL_ON_UPDATE_NOW_FLAG] = 'on_update_now', [ffi.C.MYSQL_NUM_FLAG] = 'is_number' } local function field_type_name(info) local type_flag = tonumber(info.type) local field_type = field_type_names[type_flag] -- charsetnr 63 changes CHAR into BINARY, VARCHAR into VARBYNARY, TEXT into BLOB field_type = info.charsetnr == 63 and binary_field_type_names[type_flag] or field_type return field_type end -- convenience field type fetcher (less garbage) function res.field_type(res, i) assert(i >= 1 and i <= res:field_count(), 'index out of range') local info = C.mysql_fetch_field_direct(res, i - 1) local unsigned = bit.bor(info.flags, C.MYSQL_UNSIGNED_FLAG) ~= 0 return field_type_name(info), tonumber(info.length), unsigned, info.decimals end function res.field_info(res, i) assert(i >= 1 and i <= res:field_count(), 'index out of range') local info = C.mysql_fetch_field_direct(res, i - 1) local t = { name = cstring(info.name, info.name_length), org_name = cstring(info.org_name, info.org_name_length), table = cstring(info.table, info.table_length), org_table = cstring(info.org_table, info.org_table_length), db = cstring(info.db, info.db_length), catalog = cstring(info.catalog, info.catalog_length), def = cstring(info.def, info.def_length), length = tonumber(info.length), max_length = tonumber(info.max_length), decimals = info.decimals, charsetnr = info.charsetnr, type_flag = tonumber(info.type), type = field_type_name(info), flags = info.flags, extension = ptr(info.extension) } for flag, name in pairs(field_flag_names) do t[name] = bit.band(flag, info.flags) ~= 0 end return t end -- convenience field name fetcher (less garbage) function res.field_name(res, i) assert(i >= 1 and i <= res:field_count(), 'index out of range') local info = C.mysql_fetch_field_direct(res, i - 1) return cstring(info.name, info.name_length) end -- convenience field iterator, shortcut for: for i=1,res:field_count() do local field = res:field_info(i) ... end function res.fields(res) local n = res:field_count() local i = 0 return function() if i == n then return end i = i + 1 return i, res:field_info(i) end end -- row data fetching and parsing ffi.cdef('double strtod(const char*, char**);') local function parse_int(data, sz) -- using strtod to avoid string creation return ffi.C.strtod(data, nil) end local function parse_float(data, sz) return tonumber(ffi.cast('float', ffi.C.strtod(data, nil))) -- because windows is missing strtof() end local function parse_double(data, sz) return ffi.C.strtod(data, nil) end ffi.cdef('int64_t strtoll(const char*, char**, int) ' .. (ffi.os == 'Windows' and ' asm("_strtoi64")' or '') .. ';') local function parse_int64(data, sz) return ffi.C.strtoll(data, nil, 10) end ffi.cdef('uint64_t strtoull(const char*, char**, int) ' .. (ffi.os == 'Windows' and ' asm("_strtoui64")' or '') .. ';') local function parse_uint64(data, sz) return ffi.C.strtoull(data, nil, 10) end local function parse_bit(data, sz) data = ffi.cast('uint8_t*', data) -- force unsigned local n = data[0] -- this is the msb: bit fields always come in big endian byte order if sz > 6 then -- we can cover up to 6 bytes with only Lua numbers n = ffi.new('uint64_t', n) end for i = 1, sz - 1 do n = n * 256 + data[i] end return n end local function parse_date_(data, sz) assert(sz >= 10) local z = ('0'):byte() local year = (data[0] - z) * 1000 + (data[1] - z) * 100 + (data[2] - z) * 10 + (data[3] - z) local month = (data[5] - z) * 10 + (data[6] - z) local day = (data[8] - z) * 10 + (data[9] - z) return year, month, day end local function parse_time_(data, sz) assert(sz >= 8) local z = ('0'):byte() local hour = (data[0] - z) * 10 + (data[1] - z) local min = (data[3] - z) * 10 + (data[4] - z) local sec = (data[6] - z) * 10 + (data[7] - z) local frac = 0 for i = 9, sz - 1 do frac = frac * 10 + (data[i] - z) end return hour, min, sec, frac end local function format_date(year, month, day) return string.format('%04d-%02d-%02d', year, month, day) end local function format_time(hour, min, sec, frac) if frac and frac ~= 0 then return string.format('%02d:%02d:%02d.%d', hour, min, sec, frac) else return string.format('%02d:%02d:%02d', hour, min, sec) end end local function datetime_tostring(t) local date, time if t.year then date = format_date(t.year, t.month, t.day) end if t.sec then time = format_time(t.hour, t.min, t.sec, t.frac) end if date and time then return date .. ' ' .. time else return assert(date or time) end end local datetime_meta = {__tostring = datetime_tostring} local function datetime(t) return setmetatable(t, datetime_meta) end local function parse_date(data, sz) local year, month, day = parse_date_(data, sz) return datetime {year = year, month = month, day = day} end local function parse_time(data, sz) local hour, min, sec, frac = parse_time_(data, sz) return datetime {hour = hour, min = min, sec = sec, frac = frac} end local function parse_datetime(data, sz) local year, month, day = parse_date_(data, sz) local hour, min, sec, frac = parse_time_(data + 11, sz - 11) return datetime { year = year, month = month, day = day, hour = hour, min = min, sec = sec, frac = frac } end local field_decoders = { -- other field types not present here are returned as strings, unparsed [ffi.C.MYSQL_TYPE_TINY] = parse_int, [ffi.C.MYSQL_TYPE_SHORT] = parse_int, [ffi.C.MYSQL_TYPE_LONG] = parse_int, [ffi.C.MYSQL_TYPE_FLOAT] = parse_float, [ffi.C.MYSQL_TYPE_DOUBLE] = parse_double, [ffi.C.MYSQL_TYPE_TIMESTAMP] = parse_datetime, [ffi.C.MYSQL_TYPE_LONGLONG] = parse_int64, [ffi.C.MYSQL_TYPE_INT24] = parse_int, [ffi.C.MYSQL_TYPE_DATE] = parse_date, [ffi.C.MYSQL_TYPE_TIME] = parse_time, [ffi.C.MYSQL_TYPE_DATETIME] = parse_datetime, [ffi.C.MYSQL_TYPE_NEWDATE] = parse_date, [ffi.C.MYSQL_TYPE_TIMESTAMP2] = parse_datetime, [ffi.C.MYSQL_TYPE_DATETIME2] = parse_datetime, [ffi.C.MYSQL_TYPE_TIME2] = parse_time, [ffi.C.MYSQL_TYPE_YEAR] = parse_int, [ffi.C.MYSQL_TYPE_BIT] = parse_bit } local unsigned_decoders = {[ffi.C.MYSQL_TYPE_LONGLONG] = parse_uint64} local function mode_flags(mode) local assoc = mode and mode:find 'a' local numeric = not mode or not assoc or mode:find 'n' local decode = not mode or not mode:find 's' local packed = mode and mode:find '[an]' local fetch_fields = assoc or decode -- if assoc we need field_name, if decode we need field_type return numeric, assoc, decode, packed, fetch_fields end local function fetch_row(res, numeric, assoc, decode, field_count, fields, t) local values = C.mysql_fetch_row(res) if values == NULL then if res.conn ~= NULL then -- buffered read: check for errors myerror(res.conn, 4) end return nil end local sizes = C.mysql_fetch_lengths(res) for i = 0, field_count - 1 do local v = values[i] if v ~= NULL then local decoder if decode then local ftype = tonumber(fields[i].type) local unsigned = bit.bor(fields[i].flags, C.MYSQL_UNSIGNED_FLAG) ~= 0 decoder = unsigned and unsigned_decoders[ftype] or field_decoders[ftype] or ffi.string else decoder = ffi.string end v = decoder(values[i], tonumber(sizes[i])) if numeric then t[i + 1] = v end if assoc then local k = ffi.string(fields[i].name, fields[i].name_length) t[k] = v end end end return t end function res.fetch(res, mode, t) local numeric, assoc, decode, packed, fetch_fields = mode_flags(mode) local field_count = C.mysql_num_fields(res) local fields = fetch_fields and C.mysql_fetch_fields(res) local row = fetch_row(res, numeric, assoc, decode, field_count, fields, t or {}) if not row then return nil end if packed then return row else return true, unpack(row) end end function res.rows(res, mode, t) local numeric, assoc, decode, packed, fetch_fields = mode_flags(mode) local field_count = C.mysql_num_fields(res) local fields = fetch_fields and C.mysql_fetch_fields(res) local i = 0 res:seek(1) return function() local row = fetch_row(res, numeric, assoc, decode, field_count, fields, t or {}) if not row then return nil end i = i + 1 if packed then return i, row else return i, unpack(row) end end end function res.tell(...) return C.mysql_row_tell(...) end function res.seek(res, where) -- use in conjunction with res:row_count() if type(where) == 'number' then C.mysql_data_seek(res, where - 1) else C.mysql_row_seek(res, where) end end -- reflection local function list_function(func) return function(mysql, wild) local res = checkh(mysql, C[func](mysql, wild)) return ffi.gc(res, C.mysql_free_result) end end conn.list_dbs = list_function 'mysql_list_dbs' conn.list_tables = list_function 'mysql_list_tables' conn.list_processes = result_function 'mysql_list_processes' -- remote control function conn.kill(mysql, pid) checkz(mysql, C.mysql_kill(mysql, pid)) end function conn.shutdown(mysql, level) checkz(mysql, C.mysql_shutdown(mysql, enum( level or C.MYSQL_SHUTDOWN_DEFAULT, 'MYSQL_'))) end function conn.refresh(mysql, t) -- options are 'REFRESH_*' or mysql.C.MYSQL_REFRESH_* enums local options = 0 if type(t) == 'number' then options = t else for k, v in pairs(t) do if v then options = bit.bor(options, enum(k, 'MYSQL_')) end end end checkz(mysql, C.mysql_refresh(mysql, options)) end function conn.dump_debug_info(mysql) checkz(mysql, C.mysql_dump_debug_info(mysql)) end -- prepared statements local function sterror(stmt, stacklevel) local err = cstring(C.mysql_stmt_error(stmt)) if not err then return end error(string.format('mysql error: %s', err), stacklevel or 3) end local function stcheckz(stmt, ret) if ret == 0 then return end sterror(stmt, 4) end local function stcheckbool(stmt, ret) if ret == 1 then return end sterror(stmt, 4) end local function stcheckh(stmt, ret) if ret ~= NULL then return ret end sterror(stmt, 4) end function conn.prepare(mysql, query) local stmt = checkh(mysql, C.mysql_stmt_init(mysql)) ffi.gc(stmt, C.mysql_stmt_close) stcheckz(stmt, C.mysql_stmt_prepare(stmt, query, #query)) return stmt end local stmt = {} -- statement methods function stmt.close(stmt) stcheckbool(stmt, C.mysql_stmt_close(stmt)) ffi.gc(stmt, nil) end function stmt.exec(stmt) stcheckz(stmt, C.mysql_stmt_execute(stmt)) end function stmt.next_result(stmt) local ret = C.mysql_stmt_next_result(stmt) if ret == 0 then return true end if ret == -1 then return false end sterror(stmt) end function stmt.store_result(stmt) stcheckz(stmt, C.mysql_stmt_store_result(stmt)) end function stmt.free_result(stmt) stcheckbool(stmt, C.mysql_stmt_free_result(stmt)) end function stmt.row_count(stmt) return tonumber(C.mysql_stmt_num_rows(stmt)) end function stmt.affected_rows(stmt) local n = C.mysql_stmt_affected_rows(stmt) if n == minus1_uint64 then sterror(stmt) end return tonumber(n) end function stmt.insert_id(...) return C.mysql_stmt_insert_id(...) end function stmt.field_count(stmt) return tonumber(C.mysql_stmt_field_count(stmt)) end function stmt.param_count(stmt) return tonumber(C.mysql_stmt_param_count(stmt)) end function stmt.errno(stmt) local err = C.mysql_stmt_errno(stmt) if err == 0 then return end return err end function stmt.sqlstate(stmt) return cstring(C.mysql_stmt_sqlstate(stmt)) end function stmt.result_metadata(stmt) local res = stcheckh(stmt, C.mysql_stmt_result_metadata(stmt)) return res and ffi.gc(res, C.mysql_free_result) end function stmt.fields(stmt) local res = stmt:result_metadata() if not res then return nil end local fields = res:fields() return function() local i, info = fields() if not i then res:free() end return i, info end end function stmt.fetch(stmt) local ret = C.mysql_stmt_fetch(stmt) if ret == 0 then return true end if ret == C.MYSQL_NO_DATA then return false end if ret == C.MYSQL_DATA_TRUNCATED then return true, 'truncated' end sterror(stmt) end function stmt.reset(stmt) stcheckz(stmt, C.mysql_stmt_reset(stmt)) end function stmt.tell(...) return C.mysql_stmt_row_tell(...) end function stmt.seek(stmt, where) -- use in conjunction with stmt:row_count() if type(where) == 'number' then C.mysql_stmt_data_seek(stmt, where - 1) else C.mysql_stmt_row_seek(stmt, where) end end function stmt.write(stmt, param_number, data, size) stcheckz(stmt, C.mysql_stmt_send_long_data(stmt, param_number, data, size or #data)) end function stmt.update_max_length(stmt) local attr = ffi.new 'my_bool[1]' stcheckz(stmt, C.mysql_stmt_attr_get(stmt, C.STMT_ATTR_UPDATE_MAX_LENGTH, attr)) return attr[0] == 1 end function stmt.set_update_max_length(stmt, yes) local attr = ffi.new('my_bool[1]', yes == nil or yes) stcheckz(stmt, C.mysql_stmt_attr_set(stmt, C.STMT_ATTR_CURSOR_TYPE, attr)) end function stmt.cursor_type(stmt) local attr = ffi.new 'uint32_t[1]' stcheckz(stmt, C.mysql_stmt_attr_get(stmt, C.STMT_ATTR_CURSOR_TYPE, attr)) return attr[0] end function stmt.set_cursor_type(stmt, cursor_type) local attr = ffi.new('uint32_t[1]', enum(cursor_type, 'MYSQL_')) stcheckz(stmt, C.mysql_stmt_attr_set(stmt, C.STMT_ATTR_CURSOR_TYPE, attr)) end function stmt.prefetch_rows(stmt) local attr = ffi.new 'uint32_t[1]' stcheckz(stmt, C.mysql_stmt_attr_get(stmt, C.STMT_ATTR_PREFETCH_ROWS, attr)) return attr[0] end function stmt.set_prefetch_rows(stmt, n) local attr = ffi.new('uint32_t[1]', n) stcheckz(stmt, C.mysql_stmt_attr_set(stmt, C.STMT_ATTR_PREFETCH_ROWS, attr)) end -- prepared statements / bind buffers -- see http://dev.mysql.com/doc/refman/5.7/en/c-api-prepared-statement-type-codes.html local bb_types_input = { -- conversion-free types tinyint = ffi.C.MYSQL_TYPE_TINY, smallint = ffi.C.MYSQL_TYPE_SHORT, int = ffi.C.MYSQL_TYPE_LONG, integer = ffi.C.MYSQL_TYPE_LONG, -- alias of int bigint = ffi.C.MYSQL_TYPE_LONGLONG, float = ffi.C.MYSQL_TYPE_FLOAT, double = ffi.C.MYSQL_TYPE_DOUBLE, time = ffi.C.MYSQL_TYPE_TIME, date = ffi.C.MYSQL_TYPE_DATE, datetime = ffi.C.MYSQL_TYPE_DATETIME, timestamp = ffi.C.MYSQL_TYPE_TIMESTAMP, text = ffi.C.MYSQL_TYPE_STRING, char = ffi.C.MYSQL_TYPE_STRING, varchar = ffi.C.MYSQL_TYPE_STRING, blob = ffi.C.MYSQL_TYPE_BLOB, binary = ffi.C.MYSQL_TYPE_BLOB, varbinary = ffi.C.MYSQL_TYPE_BLOB, null = ffi.C.MYSQL_TYPE_NULL, -- conversion types (can only use one of the above C types) mediumint = ffi.C.MYSQL_TYPE_LONG, real = ffi.C.MYSQL_TYPE_DOUBLE, decimal = ffi.C.MYSQL_TYPE_BLOB, numeric = ffi.C.MYSQL_TYPE_BLOB, year = ffi.C.MYSQL_TYPE_SHORT, tinyblob = ffi.C.MYSQL_TYPE_BLOB, tinytext = ffi.C.MYSQL_TYPE_BLOB, mediumblob = ffi.C.MYSQL_TYPE_BLOB, mediumtext = ffi.C.MYSQL_TYPE_BLOB, longblob = ffi.C.MYSQL_TYPE_BLOB, longtext = ffi.C.MYSQL_TYPE_BLOB, bit = ffi.C.MYSQL_TYPE_LONGLONG, -- MYSQL_TYPE_BIT is not available for input params set = ffi.C.MYSQL_TYPE_BLOB, enum = ffi.C.MYSQL_TYPE_BLOB } local bb_types_output = { -- conversion-free types tinyint = ffi.C.MYSQL_TYPE_TINY, smallint = ffi.C.MYSQL_TYPE_SHORT, mediumint = ffi.C.MYSQL_TYPE_INT24, -- int32 int = ffi.C.MYSQL_TYPE_LONG, integer = ffi.C.MYSQL_TYPE_LONG, -- alias of int bigint = ffi.C.MYSQL_TYPE_LONGLONG, float = ffi.C.MYSQL_TYPE_FLOAT, double = ffi.C.MYSQL_TYPE_DOUBLE, real = ffi.C.MYSQL_TYPE_DOUBLE, decimal = ffi.C.MYSQL_TYPE_NEWDECIMAL, -- char[] numeric = ffi.C.MYSQL_TYPE_NEWDECIMAL, -- char[] year = ffi.C.MYSQL_TYPE_SHORT, time = ffi.C.MYSQL_TYPE_TIME, date = ffi.C.MYSQL_TYPE_DATE, datetime = ffi.C.MYSQL_TYPE_DATETIME, timestamp = ffi.C.MYSQL_TYPE_TIMESTAMP, char = ffi.C.MYSQL_TYPE_STRING, binary = ffi.C.MYSQL_TYPE_STRING, varchar = ffi.C.MYSQL_TYPE_VAR_STRING, varbinary = ffi.C.MYSQL_TYPE_VAR_STRING, tinyblob = ffi.C.MYSQL_TYPE_TINY_BLOB, tinytext = ffi.C.MYSQL_TYPE_TINY_BLOB, blob = ffi.C.MYSQL_TYPE_BLOB, text = ffi.C.MYSQL_TYPE_BLOB, mediumblob = ffi.C.MYSQL_TYPE_MEDIUM_BLOB, mediumtext = ffi.C.MYSQL_TYPE_MEDIUM_BLOB, longblob = ffi.C.MYSQL_TYPE_LONG_BLOB, longtext = ffi.C.MYSQL_TYPE_LONG_BLOB, bit = ffi.C.MYSQL_TYPE_BIT, -- conversion types (can only use one of the above C types) null = ffi.C.MYSQL_TYPE_TINY, set = ffi.C.MYSQL_TYPE_BLOB, enum = ffi.C.MYSQL_TYPE_BLOB } local number_types = { [ffi.C.MYSQL_TYPE_TINY] = 'int8_t[1]', [ffi.C.MYSQL_TYPE_SHORT] = 'int16_t[1]', [ffi.C.MYSQL_TYPE_LONG] = 'int32_t[1]', [ffi.C.MYSQL_TYPE_INT24] = 'int32_t[1]', [ffi.C.MYSQL_TYPE_LONGLONG] = 'int64_t[1]', [ffi.C.MYSQL_TYPE_FLOAT] = 'float[1]', [ffi.C.MYSQL_TYPE_DOUBLE] = 'double[1]' } local uint_types = { [ffi.C.MYSQL_TYPE_TINY] = 'uint8_t[1]', [ffi.C.MYSQL_TYPE_SHORT] = 'uint16_t[1]', [ffi.C.MYSQL_TYPE_LONG] = 'uint32_t[1]', [ffi.C.MYSQL_TYPE_INT24] = 'uint32_t[1]', [ffi.C.MYSQL_TYPE_LONGLONG] = 'uint64_t[1]' } local time_types = { [ffi.C.MYSQL_TYPE_TIME] = true, [ffi.C.MYSQL_TYPE_DATE] = true, [ffi.C.MYSQL_TYPE_DATETIME] = true, [ffi.C.MYSQL_TYPE_TIMESTAMP] = true } local time_struct_types = { [ffi.C.MYSQL_TYPE_TIME] = ffi.C.MYSQL_TIMESTAMP_TIME, [ffi.C.MYSQL_TYPE_DATE] = ffi.C.MYSQL_TIMESTAMP_DATE, [ffi.C.MYSQL_TYPE_DATETIME] = ffi.C.MYSQL_TIMESTAMP_DATETIME, [ffi.C.MYSQL_TYPE_TIMESTAMP] = ffi.C.MYSQL_TIMESTAMP_DATETIME } local params = {} -- params bind buffer methods local params_meta = {__index = params} local fields = {} -- params bind buffer methods local fields_meta = {__index = fields} -- "varchar(200)" -> "varchar", 200; "decimal(10,4)" -> "decimal", 12; "int unsigned" -> "int", nil, true local function parse_type(s) s = s:lower() local unsigned = false local rest = s:match '(.-)%s+unsigned$' if rest then s, unsigned = rest, true end local rest, sz = s:match '^%s*([^%(]+)%s*%(%s*(%d+)[^%)]*%)%s*$' if rest then s, sz = rest, assert(tonumber(sz), 'invalid type') if s == 'decimal' or s == 'numeric' then -- make room for the dot and the minus sign sz = sz + 2 end end return s, sz, unsigned end local function bind_buffer(bb_types, meta, types) local self = setmetatable({}, meta) self.count = #types self.buffer = ffi.new('MYSQL_BIND[?]', #types) self.data = {} -- data buffers, one for each field self.lengths = ffi.new('unsigned long[?]', #types) -- length buffers, one for each field self.null_flags = ffi.new('my_bool[?]', #types) -- null flag buffers, one for each field self.error_flags = ffi.new('my_bool[?]', #types) -- error (truncation) flag buffers, one for each field for i, typedef in ipairs(types) do local stype, size, unsigned = parse_type(typedef) local btype = assert(bb_types[stype], 'invalid type') local data if stype == 'bit' then if btype == C.MYSQL_TYPE_LONGLONG then -- for input: use unsigned int64 and ignore size data = ffi.new 'uint64_t[1]' self.buffer[i - 1].is_unsigned = 1 size = 0 elseif btype == C.MYSQL_TYPE_BIT then -- for output: use mysql conversion-free type size = size or 64 -- if missing size, assume maximum size = math.ceil(size / 8) assert(size >= 1 and size <= 8, 'invalid size') data = ffi.new('uint8_t[?]', size) end elseif number_types[btype] then assert(not size, 'fixed size type') data = ffi.new(unsigned and uint_types[btype] or number_types[btype]) self.buffer[i - 1].is_unsigned = unsigned size = ffi.sizeof(data) elseif time_types[btype] then assert(not size, 'fixed size type') data = ffi.new 'MYSQL_TIME' data.time_type = time_struct_types[btype] size = 0 elseif btype == C.MYSQL_TYPE_NULL then assert(not size, 'fixed size type') size = 0 else assert(size, 'missing size') data = size > 0 and ffi.new('uint8_t[?]', size) or nil end self.null_flags[i - 1] = true self.data[i] = data self.lengths[i - 1] = 0 self.buffer[i - 1].buffer_type = btype self.buffer[i - 1].buffer = data self.buffer[i - 1].buffer_length = size self.buffer[i - 1].is_null = self.null_flags + (i - 1) self.buffer[i - 1].error = self.error_flags + (i - 1) self.buffer[i - 1].length = self.lengths + (i - 1) end return self end local function params_bind_buffer(types) return bind_buffer(bb_types_input, params_meta, types) end local function fields_bind_buffer(types) return bind_buffer(bb_types_output, fields_meta, types) end local function bind_check_range(self, i) assert(i >= 1 and i <= self.count, 'index out of bounds') end -- realloc a buffer using supplied size. only for varsize fields. function params:realloc(i, size) bind_check_range(self, i) assert(ffi.istype(self.data[i], 'uint8_t[?]'), 'attempt to realloc a fixed size field') local data = size > 0 and ffi.new('uint8_t[?]', size) or nil self.null_flags[i - 1] = true self.data[i] = data self.lengths[i - 1] = 0 self.buffer[i - 1].buffer = data self.buffer[i - 1].buffer_length = size end fields.realloc = params.realloc function fields:get_date(i) bind_check_range(self, i) local btype = tonumber(self.buffer[i - 1].buffer_type) local date = btype == C.MYSQL_TYPE_DATE or btype == C.MYSQL_TYPE_DATETIME or btype == C.MYSQL_TYPE_TIMESTAMP local time = btype == C.MYSQL_TYPE_TIME or btype == C.MYSQL_TYPE_DATETIME or btype == C.MYSQL_TYPE_TIMESTAMP assert(date or time, 'not a date/time type') if self.null_flags[i - 1] == 1 then return nil end local tm = self.data[i] return date and tm.year or nil, date and tm.month or nil, date and tm.day or nil, time and tm.hour or nil, time and tm.minute or nil, time and tm.second or nil, time and tonumber(tm.second_part) or nil end function params:set_date(i, year, month, day, hour, min, sec, frac) bind_check_range(self, i) local tm = self.data[i] local btype = tonumber(self.buffer[i - 1].buffer_type) local date = btype == C.MYSQL_TYPE_DATE or btype == C.MYSQL_TYPE_DATETIME or btype == C.MYSQL_TYPE_TIMESTAMP local time = btype == C.MYSQL_TYPE_TIME or btype == C.MYSQL_TYPE_DATETIME or btype == C.MYSQL_TYPE_TIMESTAMP assert(date or time, 'not a date/time type') local tm = self.data[i] tm.year = date and math.max(0, math.min(year or 0, 9999)) or 0 tm.month = date and math.max(1, math.min(month or 0, 12)) or 0 tm.day = date and math.max(1, math.min(day or 0, 31)) or 0 tm.hour = time and math.max(0, math.min(hour or 0, 59)) or 0 tm.minute = time and math.max(0, math.min(min or 0, 59)) or 0 tm.second = time and math.max(0, math.min(sec or 0, 59)) or 0 tm.second_part = time and math.max(0, math.min(frac or 0, 999999)) or 0 self.null_flags[i - 1] = false end function params:set(i, v, size) bind_check_range(self, i) v = ptr(v) if v == nil then self.null_flags[i - 1] = true return end local btype = tonumber(self.buffer[i - 1].buffer_type) if btype == C.MYSQL_TYPE_NULL then error('attempt to set a null type param') elseif number_types[btype] then -- this includes bit type which is LONGLONG self.data[i][0] = v self.null_flags[i - 1] = false elseif time_types[btype] then self:set_date(i, v.year, v.month, v.day, v.hour, v.min, v.sec, v.frac) else -- var-sized types and raw bit blobs size = size or #v local bsize = tonumber(self.buffer[i - 1].buffer_length) assert(bsize >= size, 'string too long') ffi.copy(self.data[i], v, size) self.lengths[i - 1] = size self.null_flags[i - 1] = false end end function fields:get(i) bind_check_range(self, i) local btype = tonumber(self.buffer[i - 1].buffer_type) if btype == C.MYSQL_TYPE_NULL or self.null_flags[i - 1] == 1 then return nil end if number_types[btype] then return self.data[i][0] -- ffi converts this to a number or int64 type, which maches result:fetch() decoding elseif time_types[btype] then local t = self.data[i] if t.time_type == C.MYSQL_TIMESTAMP_TIME then return datetime { hour = t.hour, min = t.minute, sec = t.second, frac = tonumber(t.second_part) } elseif t.time_type == C.MYSQL_TIMESTAMP_DATE then return datetime {year = t.year, month = t.month, day = t.day} elseif t.time_type == C.MYSQL_TIMESTAMP_DATETIME then return datetime { year = t.year, month = t.month, day = t.day, hour = t.hour, min = t.minute, sec = t.second, frac = tonumber(t.second_part) } else error 'invalid time' end else local sz = math.min(tonumber(self.buffer[i - 1].buffer_length), tonumber(self.lengths[i - 1])) if btype == C.MYSQL_TYPE_BIT then return parse_bit(self.data[i], sz) else return ffi.string(self.data[i], sz) end end end function fields:is_null(i) -- returns true if the field is null bind_check_range(self, i) local btype = self.buffer[i - 1].buffer_type return btype == C.MYSQL_TYPE_NULL or self.null_flags[i - 1] == 1 end function fields:is_truncated(i) -- returns true if the field value was truncated bind_check_range(self, i) return self.error_flags[i - 1] == 1 end local varsize_types = { char = true, binary = true, varchar = true, varbinary = true, tinyblob = true, tinytext = true, blob = true, text = true, mediumblob = true, mediumtext = true, longblob = true, longtext = true, bit = true, set = true, enum = true } function stmt.bind_result_types(stmt, maxsize) local types = {} local field_count = stmt:field_count() local res = stmt:result_metadata() if not res then return nil end for i = 1, field_count do local ftype, size, unsigned, decimals = res:field_type(i) if ftype == 'decimal' then ftype = string.format('%s(%d,%d)', ftype, size - 2, decimals) elseif varsize_types[ftype] then size = math.min(size, maxsize or 65535) ftype = string.format('%s(%d)', ftype, size) end ftype = unsigned and ftype .. ' unsigned' or ftype types[i] = ftype end res:free() return types end function stmt.bind_params(stmt, ...) local types = type((...)) == 'string' and {...} or ... or {} assert(stmt:param_count() == #types, 'wrong number of param types') local bb = params_bind_buffer(types) stcheckz(stmt, C.mysql_stmt_bind_param(stmt, bb.buffer)) return bb end function stmt.bind_result(stmt, arg1, ...) local types if type(arg1) == 'string' then types = {arg1, ...} elseif type(arg1) == 'number' then types = stmt:bind_result_types(arg1) elseif arg1 then types = arg1 else types = stmt:bind_result_types() end assert(stmt:field_count() == #types, 'wrong number of field types') local bb = fields_bind_buffer(types) stcheckz(stmt, C.mysql_stmt_bind_result(stmt, bb.buffer)) return bb end -- publish methods ffi.metatype('MYSQL', {__index = conn}) ffi.metatype('MYSQL_RES', {__index = res}) ffi.metatype('MYSQL_STMT', {__index = stmt}) -- publish classes (for introspection, not extending) M.conn = conn M.res = res M.stmt = stmt M.params = params M.fields = fields return M
local tinsert = table.insert -- -------------------------------------------------------------------------------------------------------- -- Add gltfloader to load meshes into pool temps -- local gltf = require("meshpool.gltfloader") local fpgen = require("meshpool.filepool-gen") -- -------------------------------------------------------------------------------------------------------- -- MeshPool -- Concept: Aim is to provide a "Defold like" interface to the meshpool game objects within the pool. -- The objects all have generic names and settings, but the user shall be able to provide their -- own names and use the "simpler" interfaces here to manipulate a meshpool go. -- Note: This is not ideal, it adds another "layer" of abstraction which is something I personally -- dont like doing. So there might likey be an native extension in the future to make this all more -- Defold friendly. local meshpool = { maxindex = 0, currentindex = 0, } -- The files mapped into the meshpool. Each file is mapped to a temp go/mesh. -- The meshpool should always be created with "maximum" amount of gameobjects to be used. -- A priority system will be added to allow gameobjects to "take over" less used gameobjects. meshpool.files = { -- helmet = { name = "helmet", go = "/temp/temp001", fpath = "/assets/models/DamagedHelmet/glTF/DamagedHelmet.gltf", priority = 0 }, -- car = { name = "helmet", go = "/temp/temp001", fpath = "/assets/models/ALPINIST/ALPINIST_HI_Body.gltf", priority = 0 }, } -- -------------------------------------------------------------------------------------------------------- -- A reverse mnapping from goname->meshpoolfiles (might be handy later) meshpool.mapped = { } -- -------------------------------------------------------------------------------------------------------- function init( count, regenerate ) -- The make pool files is not needed for every run. But it keeps all the objects "clean" -- Should add a return check for success if(regenerate) then fpgen.makecollection("assets/temp.collection", count) end meshpool.maxindex = count meshpool.currentindex = #meshpool.files + 1 -- If there are files already set (as above) then add automatically for k, v in pairs(meshpool.files) do addmesh( v.fpath, v.name ) end end -- -------------------------------------------------------------------------------------------------------- -- Uses a tempobject within the pool, assigns a goname to the mapping (must be unique). -- Initial pos vec3 or initial rotation quat can be provided. Otherwise will be default function addmesh( filepath, name, initpos, initrot ) if(meshpool.currentindex > meshpool.maxindex) then print("No More Meshes!"); return nil end -- Is this new or current meshfile local ismesh = meshpool.files[name] local pos = initpos or vmath.vector3(0, 0, 0) local rot = initrot or vmath.quat_rotation_y(0.0) local goname = "/temp/temp"..string.format("%03d", meshpool.currentindex) if(ismesh == nil) then meshpool.currentindex = meshpool.currentindex + 1 end -- Add gltfloader to load files! -- gltf:load(filepath, goname, "temp") go.set_rotation(rot, goname) go.set_position(pos, goname) meshpool.files[name] = { name = name, goname = goname, fpath = filepath, priority = 0 } meshpool.mapped[goname] = meshpool.files[name] return goname end -- -------------------------------------------------------------------------------------------------------- -- TODO: Add object manipulation routines and shader controls. Also updaters, message handlers and controllers. -- -------------------------------------------------------------------------------------------------------- meshpool.init = init meshpool.addmesh = addmesh return meshpool -- --------------------------------------------------------------------------------------------------------
local Transpose, parent = torch.class('nn.Transpose', 'nn.Module') -- transpose dimensions: -- n = nn.Transpose({1,4},{1,3}) -- will transpose dims 1 and 4, then 1 and 3... function Transpose:__init(...) parent.__init(self) self.permutations = {...} end function Transpose:updateOutput(input) for _,perm in ipairs(self.permutations) do input = input:transpose(perm[1],perm[2]) end self.output:resizeAs(input):copy(input) return self.output end function Transpose:updateGradInput(input, gradOutput) local ndim = gradOutput:nDimension() for i = #self.permutations,1,-1 do local perm = self.permutations[i] gradOutput = gradOutput:transpose(perm[1],perm[2]) end self.gradInput:resizeAs(gradOutput):copy(gradOutput) return self.gradInput end
local discordia = require('discordia') local settings = require("./resources/settings.lua") local client = discordia.Client{fetchMembers=true} coroutine.wrap(function() require('./resources/framework.lua')(client,{settings=settings}) end)() client:run(settings.token)
local shroud = game.Workspace.Orbs:FindFirstChildOfClass('Folder') local plr = game.Players.LocalPlayer.Character.HumanoidRootPart while true do wait(2) for _, h in pairs(shroud['SpeedOrb']:GetChildren()) do if h.ClassName == "MeshPart" then h.CFrame = plr.CFrame end end end
module(..., package.seeall) local MP = require("ManchesterParser") require "core" --ROLE function setPrefixFromSchemaAssertionRole(compartment, oldValue) local name = compartment:find("/parentCompartment/subCompartment:has(/compartType[id='Name'])") local compartment = compartment:filter(function(obj) return obj:find("/compartType"):attr("id") == "schemaAssertion" end) local owl_fields_specific = require("OWLGrEd_UserFields.owl_fields_specific") local prefixResult = owl_fields_specific.setAllPrefixesView(name:find("/compartType"), name, nil) if compartment:attr("value") == "false" then local parentCompartment = compartment:find("/parentCompartment") local domainAndRange = parentCompartment:find("/subCompartment:has(/compartType[id='domainAndRange'])") domainAndRange:attr("value", "true") core.update_compartment_input_from_value(domainAndRange) local localRange = parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])") localRange:attr("value", "false") core.update_compartment_input_from_value(localRange) domainAndRange:find("/component"):attr("checked", "true") if domainAndRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) domainAndRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end localRange:find("/component"):attr("checked", "false") if localRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) localRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])/component"), false) name:attr("input", "!" .. prefixResult.. name:attr("value")) else local domainAndRange = compartment:find("/parentCompartment/subCompartment:has(/compartType[id='domainAndRange'])"):attr("value") local localRange = compartment:find("/parentCompartment/subCompartment:has(/compartType[id='localRange'])"):attr("value") local result = "" if domainAndRange == "false" then result = "+" if localRange == "false" then result = "++" end end name:attr("input", result .. prefixResult .. name:attr("value")) end -------------------------------------- --TO DO disableEnableProperty -------------------------------------- end function setPrefixFromDomainAndRangeRole(compartment, oldValue) local name = compartment:find("/parentCompartment/subCompartment:has(/compartType[id='Name'])") local compartment = compartment:filter(function(obj) return obj:find("/compartType"):attr("id") == "domainAndRange" end) local owl_fields_specific = require("OWLGrEd_UserFields.owl_fields_specific") local prefixResult = owl_fields_specific.setAllPrefixesView(name:find("/compartType"), name, nil) if compartment:attr("value") == "true" then local parentCompartment = compartment:find("/parentCompartment") local localRange = parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])") localRange:attr("value", "false") core.update_compartment_input_from_value(localRange) localRange:find("/component"):attr("checked", "false") if localRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) localRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])/component"), false) local result = "" local schemaAssertion = parentCompartment:find("/subCompartment:has(/compartType[id='schemaAssertion'])"):attr("value") if schemaAssertion == "false" then result = "!" end if name ~= nil and name:attr("value") ~= "" then name:attr("input", result .. prefixResult.. name:attr("value")) end else local parentCompartment = compartment:find("/parentCompartment") local schemaAssertion = parentCompartment:find("/subCompartment:has(/compartType[id='schemaAssertion'])") schemaAssertion:attr("value", "true") core.update_compartment_input_from_value(schemaAssertion) schemaAssertion:find("/component"):attr("checked", "true") if schemaAssertion:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) schemaAssertion:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end local localRange = parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])") localRange:attr("value", "true") core.update_compartment_input_from_value(localRange) localRange:find("/component"):attr("checked", "true") if localRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) localRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])/component"), true) local result = "" if schemaAssertion:attr("value") == "false" then result = "!" else result = "+" if localRange:attr("value") == "false" then result = "++" end end if name ~= nil and name:attr("value") ~= "" then name:attr("input", result .. prefixResult.. name:attr("value")) end end utilities.refresh_element(name, utilities.current_diagram()) -- local compartType = compartment:find("/parentCompartment/compartType"):attr("id") -- if compartType == "Role" then compartType = "InvRole" -- else compartType = "Role" end -- local inverseCompartment = compartment:find("/parentCompartment/element/compartment:has(/compartType[id='".. compartType .."'])") -- print(inverseCompartment:size(), compartType) -- setPrefixFromDomainAndRangeRole(inverseCompartment, oldValue) end function setPrefixFromLocalRangeRole(compartment, oldValue) local name = compartment:find("/parentCompartment/subCompartment:has(/compartType[id='Name'])") local owl_fields_specific = require("OWLGrEd_UserFields.owl_fields_specific") local prefixResult = owl_fields_specific.setAllPrefixesView(name:find("/compartType"), name, nil) local schemaAssertion = compartment:find("/parentCompartment/subCompartment:has(/compartType[id='schemaAssertion'])"):attr("value") local domainAndRange = compartment:find("/parentCompartment/subCompartment:has(/compartType[id='domainAndRange'])"):attr("value") local localRange = compartment:attr("value") local result = "" if schemaAssertion == "false" then result = "!" elseif domainAndRange == "false" then result = "+" if localRange == "false" then result = "++" end end name:attr("input", result ..prefixResult.. name:attr("value")) utilities.refresh_element(name, utilities.current_diagram()) end function setPrefixNameRole(dataCompartType, dataCompartment, parsingCompartment) local result = "" if dataCompartment~=nil then local schemaAssertion = dataCompartment:find("/parentCompartment/subCompartment:has(/compartType[id='schemaAssertion'])"):attr("value") local domainAndRange = dataCompartment:find("/parentCompartment/subCompartment:has(/compartType[id='domainAndRange'])"):attr("value") local localRange = dataCompartment:find("/parentCompartment/subCompartment:has(/compartType[id='localRange'])"):attr("value") -- if schemaAssertion == "false" then result = "!" -- elseif domainAndRange == "false" then -- result = "+" -- if localRange == "false" then result = "++" end -- end if schemaAssertion ~= "true" then result = "!" elseif domainAndRange ~= "true" then result = "+" if localRange ~= "true" then result = "++" end end end local owl_fields_specific = require("OWLGrEd_UserFields.owl_fields_specific") result = result .. owl_fields_specific.setAllPrefixesView(dataCompartType, dataCompartment, parsingCompartment) return result end --ROLE --ATTRIBUTE function setPrefixFromSchemaAssertionAttribute(compartment, oldValue) local name = compartment:find("/element/compartment:has(/compartType[id='Name'])") local compartment = compartment:filter(function(obj) return obj:find("/compartType"):attr("id") == "schemaAssertion" end) if compartment:attr("value") == "false" then local parentCompartment = compartment:find("/element") local domainAndRange = parentCompartment:find("/compartment:has(/compartType[id='domainAndRange'])") domainAndRange:attr("value", "true") core.update_compartment_input_from_value(domainAndRange) local localRange = parentCompartment:find("/compartment:has(/compartType[id='localRange'])") localRange:attr("value", "false") core.update_compartment_input_from_value(localRange) domainAndRange:find("/component"):attr("checked", "true") if domainAndRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) domainAndRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end localRange:find("/component"):attr("checked", "false") if localRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) localRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='localRange'])/component"), false) name:attr("input", "!" .. name:attr("value")) else local domainAndRange = compartment:find("/element/subCompartment:has(/compartType[id='domainAndRange'])"):attr("value") local localRange = compartment:find("/element/subCompartment:has(/compartType[id='localRange'])"):attr("value") local result = "" if domainAndRange == "false" then result = "+" if localRange == "false" then result = "++" end end name:attr("input", result .. name:attr("value")) end -------------------------------------- --TO DO disableEnableProperty -------------------------------------- end function setPrefixFromDomainAndRangeAttribute(compartment, oldValue) local name = compartment:find("/element/compartment:has(/compartType[id='Name'])") local compartment = compartment:filter(function(obj) return obj:find("/compartType"):attr("id") == "domainAndRange" end) if compartment:attr("value") == "true" then local parentCompartment = compartment:find("/element") local localRange = parentCompartment:find("/compartment:has(/compartType[id='localRange'])") localRange:attr("value", "false") core.update_compartment_input_from_value(localRange) localRange:find("/component"):attr("checked", "false") if localRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) localRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='localRange'])/component"), false) local result = "" local schemaAssertion = parentCompartment:find("/compartment:has(/compartType[id='schemaAssertion'])"):attr("value") if schemaAssertion == "false" then result = "!" end name:attr("input", result .. name:attr("value")) else local parentCompartment = compartment:find("/element") local schemaAssertion = parentCompartment:find("/compartment:has(/compartType[id='schemaAssertion'])") schemaAssertion:attr("value", "true") core.update_compartment_input_from_value(schemaAssertion) schemaAssertion:find("/component"):attr("checked", "true") if schemaAssertion:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) schemaAssertion:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end local localRange = parentCompartment:find("/compartment:has(/compartType[id='localRange'])") localRange:attr("value", "true") core.update_compartment_input_from_value(localRange) localRange:find("/component"):attr("checked", "true") if localRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) localRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='localRange'])/component"), true) local result = "" if schemaAssertion:attr("value") == "false" then result = "!" else result = "+" if localRange:attr("value") == "false" then result = "++" end end name:attr("input", result .. name:attr("value")) end utilities.refresh_element(name, utilities.current_diagram()) end function setPrefixFromLocalRangeAttribute(compartment, oldValue) local name = compartment:find("/element/compartment:has(/compartType[id='Name'])") local schemaAssertion = compartment:find("/element/compartment:has(/compartType[id='schemaAssertion'])"):attr("value") local domainAndRange = compartment:find("/element/compartment:has(/compartType[id='domainAndRange'])"):attr("value") local localRange = compartment:attr("value") local result = "" if schemaAssertion == "false" then result = "!" elseif domainAndRange == "false" then result = "+" if localRange == "false" then result = "++" end end name:attr("input", result .. name:attr("value")) utilities.refresh_element(name, utilities.current_diagram()) end function setPrefixeNameAttribute(dataCompartType, dataCompartment, parsingCompartment) local result = "" if dataCompartment~=nil then local schemaAssertion = dataCompartment:find("/element/compartment:has(/compartType[id='schemaAssertion'])"):attr("value") local domainAndRange = dataCompartment:find("/element/compartment:has(/compartType[id='domainAndRange'])"):attr("value") local localRange = dataCompartment:find("/element/compartment:has(/compartType[id='localRange'])"):attr("value") if schemaAssertion == "false" then result = "!" elseif domainAndRange == "false" then result = "+" if localRange == "false" then result = "++" end end end return result end --ATTRIBUTE --ATTRIBUTES function setPrefixFromSchemaAssertionAttributes(compartment, oldValue) local compartment = compartment:filter(function(obj) return obj:find("/compartType"):attr("id") == "schemaAssertion" end) local parentCompartment = compartment:find("/parentCompartment") local domainAndRange = parentCompartment:find("/subCompartment:has(/compartType[id='domainAndRange'])") if compartment:attr("value") == "false" or (compartment:attr("value") ~= "true" and compartment:attr("value") ~= " ") then local parentCompartment = compartment:find("/parentCompartment") local domainAndRange = parentCompartment:find("/subCompartment:has(/compartType[id='domainAndRange'])") if domainAndRange:attr("value") ~= "true" then domainAndRange:attr("value", "true") core.update_compartment_input_from_value(domainAndRange) domainAndRange:find("/component"):attr("checked", "true") if domainAndRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) domainAndRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])/component"), false) end local localRange = parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])") if localRange:attr("value") ~= "false" or (localRange:attr("value") ~= "true" or localRange:attr("value") ~= "+") then localRange:attr("value", "false") core.update_compartment_input_from_value(localRange) localRange:find("/component"):attr("checked", "false") if localRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) localRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end end -- core.create_missing_compartment(parentCompartment, parentCompartment:find("/compartType"), parentCompartment:find("/compartType/subCompartType[id='hiddenCompartment']")) local hiddenCompartment = parentCompartment:find("/subCompartment:has(/compartType[id='hiddenCompartment'])") if hiddenCompartment:attr("value") ~= "false" then hiddenCompartment:attr("value", "false") core.update_compartment_input_from_value(hiddenCompartment) -- if hiddenCompartment:find("/component"):is_not_empty() then -- local cmd = utilities.create_command("D#Command", {info = "Refresh"}) -- hiddenCompartment:find("/component"):link("command", cmd) -- utilities.execute_cmd_obj(cmd) -- end end -- name:attr("input", "!" .. name:attr("value")) -- parentCompartment:find("/form/component"):each(function(com) -- if com:attr("id") == "IsFunctional" or com:attr("id") == "EquivalentProperties" or com:attr("id") == "SuperProperties(<)" or com:attr("id") == "DisjointProperties(<>)" then -- com:attr("enabled", false) -- local cmd = utilities.create_command("D#Command", {info = "Refresh"}) -- com:link("command", cmd) -- utilities.execute_cmd_obj(cmd) -- com:find("/component"):each(function(obj) -- obj:attr("enabled", false) -- local cmd = utilities.create_command("D#Command", {info = "Refresh"}) -- obj:link("command", cmd) -- utilities.execute_cmd_obj(cmd) -- obj:find("/component"):each(function(obj2) -- obj2:attr("enabled", false) -- local cmd = utilities.create_command("D#Command", {info = "Refresh"}) -- obj2:link("command", cmd) -- utilities.execute_cmd_obj(cmd) -- end) -- end) -- end -- end) -- if parentCompartment:find("/subCompartment:has(/compartType[id='IsFunctional'])"):size() > 0 or -- parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment"):size() > 0 or -- parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment"):size() > 0 or -- parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment"):size() > 0 then -- deleteCompartmentsForm("- IsFunctional\n- EquivalentProperties\n- DisjointProperties\n- SuperProperties") -- end -- if parentCompartment:find("/subCompartment:has(/compartType[id='IsFunctional'])"):size() > 0 and parentCompartment:find("/subCompartment:has(/compartType[id='IsFunctional'])"):attr("value") == "true" then -- local isFunc = parentCompartment:find("/subCompartment:has(/compartType[id='IsFunctional'])"):attr("value", "false") -- core.update_compartment_input_from_value(isFunc) -- isFunc:find("/component"):attr("checked", "false") -- end -- if parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment"):size() > 0 then -- deleteCompartment(parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment")) -- parentCompartment:find("/subCompartment:has(/compartType[id='EquivalentProperties'])"):attr("value", "") -- core.update_compartment_input_from_value(parentCompartment:find("/subCompartment:has(/compartType[id='EquivalentProperties'])")) -- parentCompartment:find("/form/component[id='EquivalentProperties']/component[id='field']"):attr("text", "") -- end -- if parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment"):size() > 0 then -- deleteCompartment(parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment")) -- parentCompartment:find("/subCompartment:has(/compartType[id='DisjointProperties'])"):attr("value", "") -- core.update_compartment_input_from_value(parentCompartment:find("/subCompartment:has(/compartType[id='DisjointProperties'])")) -- parentCompartment:find("/form/component[id='DisjointProperties']/component[id='field']"):attr("text", "") -- end -- if parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment"):size() > 0 then -- deleteCompartment(parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment")) -- parentCompartment:find("/subCompartment:has(/compartType[id='SuperProperties'])"):attr("value", "") -- core.update_compartment_input_from_value(parentCompartment:find("/subCompartment:has(/compartType[id='SuperProperties'])")) -- parentCompartment:find("/form/component[id='SuperProperties']/component[id='field']"):attr("text", "") -- end -- name:attr("input", "+" .. name:attr("value")) else local parentCompartment = compartment:find("/parentCompartment") local schemaAssertion = parentCompartment:find("/subCompartment:has(/compartType[id='schemaAssertion'])"):attr("value") local domainAndRange = parentCompartment:find("/subCompartment:has(/compartType[id='domainAndRange'])"):attr("value") local localRange = parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])"):attr("value") local result = "false" if (schemaAssertion == "true" or schemaAssertion == " ") and (domainAndRange ~= "true" and domainAndRange ~= "!" and domainAndRange ~= " ") and (localRange ~= "true" and localRange ~= "+") then result = "true" end local domainAndRange = parentCompartment:find("/subCompartment:has(/compartType[id='domainAndRange'])") if domainAndRange:attr("value") == "true" or domainAndRange:attr("value") == "!" or domainAndRange:attr("value") == " " then domainAndRange:attr("value", "true") core.update_compartment_input_from_value(domainAndRange) end -- core.create_missing_compartment(parentCompartment, parentCompartment:find("/compartType"), parentCompartment:find("/compartType/subCompartType[id='hiddenCompartment']")) local hiddenCompartment = parentCompartment:find("/subCompartment:has(/compartType[id='hiddenCompartment'])") if hiddenCompartment:attr("value") ~= result then hiddenCompartment:attr("value", result) core.update_compartment_input_from_value(hiddenCompartment) -- if hiddenCompartment:find("/component"):is_not_empty() then -- local cmd = utilities.create_command("D#Command", {info = "Refresh"}) -- hiddenCompartment:find("/component"):link("command", cmd) -- utilities.execute_cmd_obj(cmd) -- end end -- name:attr("input", name:attr("value")) -- local parentCompartment = compartment:find("/parentCompartment") -- parentCompartment:find("/form/component"):each(function(com) -- if com:attr("id") == "IsFunctional" or com:attr("id") == "EquivalentProperties" or com:attr("id") == "SuperProperties(<)" or com:attr("id") == "DisjointProperties(<>)" then -- com:attr("enabled", true) -- local cmd = utilities.create_command("D#Command", {info = "Refresh"}) -- com:link("command", cmd) -- utilities.execute_cmd_obj(cmd) -- com:find("/component"):each(function(obj) -- obj:attr("enabled", true) -- local cmd = utilities.create_command("D#Command", {info = "Refresh"}) -- obj:link("command", cmd) -- utilities.execute_cmd_obj(cmd) -- obj:find("/component"):each(function(obj2) -- obj2:attr("enabled", true) -- local cmd = utilities.create_command("D#Command", {info = "Refresh"}) -- obj2:link("command", cmd) -- utilities.execute_cmd_obj(cmd) -- end) -- end) -- end -- end) end end function setPrefixFromFromDomainAndRangeAttributes(compartment, oldValue) local compartment = compartment:filter(function(obj) return obj:find("/compartType"):attr("id") == "domainAndRange" end) if compartment:attr("value") == "true" or compartment:attr("value") == "!" or compartment:attr("value") == " " then local parentCompartment = compartment:find("/parentCompartment") local localRange = parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])") if localRange:attr("value") ~= "false" then localRange:attr("value", "false") core.update_compartment_input_from_value(localRange) localRange:find("/component"):attr("checked", "false") if localRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) localRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])/component"), false) end else local parentCompartment = compartment:find("/parentCompartment") local schemaAssertion = parentCompartment:find("/subCompartment:has(/compartType[id='schemaAssertion'])") if schemaAssertion:attr("value") ~= "true" then schemaAssertion:attr("value", "true") core.update_compartment_input_from_value(schemaAssertion) schemaAssertion:find("/component"):attr("checked", "true") if schemaAssertion:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) schemaAssertion:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end end local localRange = parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])") if localRange:attr("value") ~= "true" then localRange:attr("value", "true") core.update_compartment_input_from_value(localRange) localRange:find("/component"):attr("checked", "true") if localRange:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) localRange:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])/component"), true) end end local parentCompartment = compartment:find("/parentCompartment") local schemaAssertion = parentCompartment:find("/subCompartment:has(/compartType[id='schemaAssertion'])"):attr("value") local domainAndRange = parentCompartment:find("/subCompartment:has(/compartType[id='domainAndRange'])"):attr("value") local localRange = parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])"):attr("value") local result = false if (schemaAssertion == "true" or schemaAssertion == " ") and (domainAndRange ~= "true" and domainAndRange ~= "!" and domainAndRange ~= " ") and (localRange ~= "true" and localRange ~= "+") then result = "true" end -- core.create_missing_compartment(parentCompartment, parentCompartment:find("/compartType"), parentCompartment:find("/compartType/subCompartType[id='hiddenCompartment']")) local hiddenCompartment = parentCompartment:find("/subCompartment:has(/compartType[id='hiddenCompartment'])") if hiddenCompartment:attr("value") ~= result then hiddenCompartment:attr("value", result) core.update_compartment_input_from_value(hiddenCompartment) -- if hiddenCompartment:find("/component"):is_not_empty() then -- local cmd = utilities.create_command("D#Command", {info = "Refresh"}) -- hiddenCompartment:find("/component"):link("command", cmd) -- utilities.execute_cmd_obj(cmd) -- end end end function setPrefixFromLocalRangeAttributes(compartment, oldValue) local parentCompartment = compartment:find("/parentCompartment") local schemaAssertion = parentCompartment:find("/subCompartment:has(/compartType[id='schemaAssertion'])"):attr("value") local domainAndRange = parentCompartment:find("/subCompartment:has(/compartType[id='domainAndRange'])"):attr("value") local localRange = parentCompartment:find("/subCompartment:has(/compartType[id='localRange'])"):attr("value") local result = false if (schemaAssertion == "true" or schemaAssertion == " ") and (domainAndRange ~= "true" and domainAndRange ~= "!" and domainAndRange ~= " ") and (localRange ~= "true" and localRange ~= "+") then result = "true" end -- core.create_missing_compartment(parentCompartment, parentCompartment:find("/compartType"), parentCompartment:find("/compartType/subCompartType[id='hiddenCompartment']")) local hiddenCompartment = parentCompartment:find("/subCompartment:has(/compartType[id='hiddenCompartment'])") hiddenCompartment:attr("value", result) hiddenCompartment = hiddenCompartment:first() core.update_compartment_input_from_value(hiddenCompartment) -- if hiddenCompartment:find("/component"):is_not_empty() then -- local cmd = utilities.create_command("D#Command", {info = "Refresh"}) -- hiddenCompartment:find("/component"):link("command", cmd) -- utilities.execute_cmd_obj(cmd) -- end end --ATTRIBUTES function hideField() return false end --------------------------------------------------------------------------------- function setPrefixesPlusFromAllFaluesFromDataProperty(compartment, oldValue) local compartment = compartment:filter(function(obj) return obj:find("/compartType"):attr("id") == "allValuesFrom" end) if compartment:attr("value") == "true" then local parentCompartment = compartment:find("/parentCompartment") local noSchema = parentCompartment:find("/subCompartment:has(/compartType[id='noSchema'])") noSchema:attr("value", "false") core.update_compartment_input_from_value(noSchema) noSchema:find("/component"):attr("checked", "false") if noSchema:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) noSchema:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end parentCompartment:find("/form/component"):each(function(com) if com:attr("id") == "IsFunctional" or com:attr("id") == "EquivalentProperties" or com:attr("id") == "SuperProperties(<)" or com:attr("id") == "DisjointProperties(<>)" then com:attr("enabled", false) local cmd = utilities.create_command("D#Command", {info = "Refresh"}) com:link("command", cmd) utilities.execute_cmd_obj(cmd) com:find("/component"):each(function(obj) obj:attr("enabled", false) local cmd = utilities.create_command("D#Command", {info = "Refresh"}) obj:link("command", cmd) utilities.execute_cmd_obj(cmd) obj:find("/component"):each(function(obj2) obj2:attr("enabled", false) local cmd = utilities.create_command("D#Command", {info = "Refresh"}) obj2:link("command", cmd) utilities.execute_cmd_obj(cmd) end) end) end end) if parentCompartment:find("/subCompartment:has(/compartType[id='IsFunctional'])"):size() > 0 or parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment"):size() > 0 or parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment"):size() > 0 or parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment"):size() > 0 then deleteCompartmentsForm("- IsFunctional\n- EquivalentProperties\n- DisjointProperties\n- SuperProperties") end if parentCompartment:find("/subCompartment:has(/compartType[id='IsFunctional'])"):size() > 0 and parentCompartment:find("/subCompartment:has(/compartType[id='IsFunctional'])"):attr("value") == "true" then local isFunc = parentCompartment:find("/subCompartment:has(/compartType[id='IsFunctional'])"):attr("value", "false") core.update_compartment_input_from_value(isFunc) isFunc:find("/component"):attr("checked", "false") end if parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment"):size() > 0 then deleteCompartment(parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment")) parentCompartment:find("/subCompartment:has(/compartType[id='EquivalentProperties'])"):attr("value", "") core.update_compartment_input_from_value(parentCompartment:find("/subCompartment:has(/compartType[id='EquivalentProperties'])")) parentCompartment:find("/form/component[id='EquivalentProperties']/component[id='field']"):attr("text", "") end if parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment"):size() > 0 then deleteCompartment(parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment")) parentCompartment:find("/subCompartment:has(/compartType[id='DisjointProperties'])"):attr("value", "") core.update_compartment_input_from_value(parentCompartment:find("/subCompartment:has(/compartType[id='DisjointProperties'])")) parentCompartment:find("/form/component[id='DisjointProperties']/component[id='field']"):attr("text", "") end if parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment"):size() > 0 then deleteCompartment(parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment")) parentCompartment:find("/subCompartment:has(/compartType[id='SuperProperties'])"):attr("value", "") core.update_compartment_input_from_value(parentCompartment:find("/subCompartment:has(/compartType[id='SuperProperties'])")) parentCompartment:find("/form/component[id='SuperProperties']/component[id='field']"):attr("text", "") end -- name:attr("input", "+" .. name:attr("value")) else -- name:attr("input", name:attr("value")) local parentCompartment = compartment:find("/parentCompartment") parentCompartment:find("/form/component"):each(function(com) if com:attr("id") == "IsFunctional" or com:attr("id") == "EquivalentProperties" or com:attr("id") == "SuperProperties(<)" or com:attr("id") == "DisjointProperties(<>)" then com:attr("enabled", true) local cmd = utilities.create_command("D#Command", {info = "Refresh"}) com:link("command", cmd) utilities.execute_cmd_obj(cmd) com:find("/component"):each(function(obj) obj:attr("enabled", true) local cmd = utilities.create_command("D#Command", {info = "Refresh"}) obj:link("command", cmd) utilities.execute_cmd_obj(cmd) obj:find("/component"):each(function(obj2) obj2:attr("enabled", true) local cmd = utilities.create_command("D#Command", {info = "Refresh"}) obj2:link("command", cmd) utilities.execute_cmd_obj(cmd) end) end) end end) end -- utilities.refresh_element(name, utilities.current_diagram()) end function setContainerNameVisible(compartment,oldValue) local containerName= compartment:find("/element/compartment:has(/compartType[id='Name'])") if compartment:attr("value") == "true" then containerName:link("compartStyle",containerName:find("/compartType/compartStyle[id='NameInvisible']")) else containerName:link("compartStyle",containerName:find("/compartType/compartStyle[id='Name']")) end end function setUniqueContainerName(form) local name = form:find("/presentationElement/compartment:has(/compartType[id='Name'])") if name:attr("value") == nil or name:attr("value") == "" then local containerName = "Container_" local count = 1 while lQuery("ElemType[id='Container']/element/compartment:has(/compartType[id='Name'])[value='" .. containerName .. count .. "']"):is_not_empty() do count = count + 1 end name:attr("value", containerName .. count) name:attr("input", containerName .. count) utilities.refresh_element(form:find("/presentationElement"), utilities.current_diagram()) end end function deleteCheckBoxCompartment(compartType, parentCompartment) local isFunc = parentCompartment:find("/subCompartment:has(/compartType[id='"..compartType.."'])") if isFunc:attr("value") == "true" then isFunc:attr("value", "false") core.update_compartment_input_from_value(isFunc) isFunc:find("/component"):attr("checked", "false") local cmd = utilities.create_command("D#Command", {info = "Refresh"}) isFunc:link("command", cmd) utilities.execute_cmd_obj(cmd) end end function setPrefixesPlusFromAllFaluesFrom(compartment, oldValue) local name = compartment:find("/parentCompartment/subCompartment:has(/compartType[id='Name'])") local compartment = compartment:filter(function(obj) return obj:find("/compartType"):attr("id") == "allValuesFrom" end) if compartment:attr("value") == "true" then local parentCompartment = compartment:find("/parentCompartment") local noSchema = parentCompartment:find("/subCompartment:has(/compartType[id='noSchema'])") noSchema:attr("value", "false") core.update_compartment_input_from_value(noSchema) noSchema:find("/component"):attr("checked", "false") if noSchema:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) noSchema:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end name:attr("input", "+" .. name:attr("value")) -- parentCompartment:find("/subCompartment"):each(function(obj) -- print(obj:find("/compartType"):attr("id"), obj:attr("value")) -- end) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Functional'])/component"), false) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='InverseFunctional'])/component"), false) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Symmetric'])/component"), false) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Asymmetric'])/component"), false) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Reflexive'])/component"), false) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Irreflexive'])/component"), false) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Transitive'])/component"), false) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='SuperProperties'])/subCompartment/component"), false) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='DisjointProperties'])/subCompartment/component"), false) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='PropertyChains'])/subCompartment/component"), false) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='EquivalentProperties'])/subCompartment/component"), false) if parentCompartment:find("/subCompartment:has(/compartType[id='Functional'])"):attr("value") == "true" or parentCompartment:find("/subCompartment:has(/compartType[id='InverseFunctional'])"):attr("value") == "true" or parentCompartment:find("/subCompartment:has(/compartType[id='Symmetric'])"):attr("value") == "true" or parentCompartment:find("/subCompartment:has(/compartType[id='Asymmetric'])"):attr("value") == "true" or parentCompartment:find("/subCompartment:has(/compartType[id='Reflexive'])"):attr("value") == "true" or parentCompartment:find("/subCompartment:has(/compartType[id='Irreflexive'])"):attr("value") == "true" or parentCompartment:find("/subCompartment:has(/compartType[id='Transitive'])"):attr("value") == "true" or parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment"):size() > 0 or parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment"):size() > 0 or parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousPropertyChains'])/subCompartment"):size() > 0 or parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment"):size() > 0 then deleteCompartmentsForm("- Functional\n- InverseFunctional\n- Symmetric\n- Asymmetric\n- Irreflexive\n- Reflexive\n- Transitive\n- EquivalentProperties\n- DisjointProperties\n- SuperProperties\n- PropertyChains") deleteCheckBoxCompartment('Functional', parentCompartment) deleteCheckBoxCompartment('InverseFunctional', parentCompartment) deleteCheckBoxCompartment('Symmetric', parentCompartment) deleteCheckBoxCompartment('Asymmetric', parentCompartment) deleteCheckBoxCompartment('Irreflexive', parentCompartment) deleteCheckBoxCompartment('Reflexive', parentCompartment) deleteCheckBoxCompartment('Transitive', parentCompartment) if parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment"):size() > 0 then deleteCompartment(parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment")) parentCompartment:find("/subCompartment:has(/compartType[id='EquivalentProperties'])"):attr("value", "") core.update_compartment_input_from_value(parentCompartment:find("/subCompartment:has(/compartType[id='EquivalentProperties'])")) parentCompartment:find("/form/component[id='EquivalentProperties']/component[id='field']"):attr("text", "") end if parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment"):size() > 0 then deleteCompartment(parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment")) parentCompartment:find("/subCompartment:has(/compartType[id='DisjointProperties'])"):attr("value", "") core.update_compartment_input_from_value(parentCompartment:find("/subCompartment:has(/compartType[id='DisjointProperties'])")) parentCompartment:find("/form/component[id='DisjointProperties']/component[id='field']"):attr("text", "") end if parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment"):size() > 0 then deleteCompartment(parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment")) parentCompartment:find("/subCompartment:has(/compartType[id='SuperProperties'])"):attr("value", "") core.update_compartment_input_from_value(parentCompartment:find("/subCompartment:has(/compartType[id='SuperProperties'])")) parentCompartment:find("/form/component[id='SuperProperties']/component[id='field']"):attr("text", "") end if parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousPropertyChains'])/subCompartment"):size() > 0 then deleteCompartment(parentCompartment:find("/subCompartment/subCompartment:has(/compartType[id='ASFictitiousPropertyChains'])/subCompartment")) parentCompartment:find("/subCompartment:has(/compartType[id='PropertyChains'])"):attr("value", "") core.update_compartment_input_from_value(parentCompartment:find("/subCompartment:has(/compartType[id='PropertyChains'])")) parentCompartment:find("/form/component[id='PropertyChains']/component[id='field']"):attr("text", "") end end else name:attr("input", name:attr("value")) local parentCompartment = compartment:find("/parentCompartment") disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Functional'])/component"), true) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='InverseFunctional'])/component"), true) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Symmetric'])/component"), true) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Asymmetric'])/component"), true) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Reflexive'])/component"), true) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Irreflexive'])/component"), true) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='Transitive'])/component"), true) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='SuperProperties'])/subCompartment/component"), true) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='DisjointProperties'])/subCompartment/component"), true) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='PropertyChains'])/subCompartment/component"), true) disableEnableProperty(parentCompartment:find("/subCompartment:has(/compartType[id='EquivalentProperties'])/subCompartment/component"), true) end utilities.refresh_element(name, utilities.current_diagram()) end function setPrefixesPlusFromAllFaluesFromAttribute(compartment, oldValue) local name = compartment:find("/element/compartment:has(/compartType[id='Name'])") local compartment = compartment:filter(function(obj) return obj:find("/compartType"):attr("id") == "allValuesFrom" end) if compartment:attr("value") == "true" then local parentCompartment = compartment:find("/element") local noSchema = parentCompartment:find("/compartment:has(/compartType[id='noSchema'])") noSchema:attr("value", "false") core.update_compartment_input_from_value(noSchema) noSchema:find("/component"):attr("checked", "false") if noSchema:find("/component"):is_not_empty() then local cmd = utilities.create_command("D#Command", {info = "Refresh"}) noSchema:find("/component"):link("command", cmd) utilities.execute_cmd_obj(cmd) end name:attr("input", "+" .. name:attr("value")) disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='IsFunctional'])/component"), false) disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='SuperProperties'])/subCompartment/component"), false) disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='DisjointProperties'])/subCompartment/component"), false) disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='EquivalentProperties'])/subCompartment/component"), false) if parentCompartment:find("/compartment:has(/compartType[id='IsFunctional'])"):attr("value") == "true" or parentCompartment:find("/compartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment"):size() > 0 or parentCompartment:find("/compartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment"):size() > 0 or parentCompartment:find("/compartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment"):size() > 0 then deleteCompartmentsForm("- IsFunctional\n- EquivalentProperties\n- DisjointProperties\n- SuperProperties\n- PropertyChains") deleteCheckBoxCompartment('IsFunctional', parentCompartment) if parentCompartment:find("/compartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment"):size() > 0 then deleteCompartment(parentCompartment:find("/compartment/subCompartment:has(/compartType[id='ASFictitiousEquivalentProperties'])/subCompartment")) parentCompartment:find("/compartment:has(/compartType[id='EquivalentProperties'])"):attr("value", "") core.update_compartment_input_from_value(parentCompartment:find("/compartment:has(/compartType[id='EquivalentProperties'])")) parentCompartment:find("/form/component[id='EquivalentProperties']/component[id='field']"):attr("text", "") end if parentCompartment:find("/compartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment"):size() > 0 then deleteCompartment(parentCompartment:find("/compartment/subCompartment:has(/compartType[id='ASFictitiousDisjointProperties'])/subCompartment")) parentCompartment:find("/compartment:has(/compartType[id='DisjointProperties'])"):attr("value", "") core.update_compartment_input_from_value(parentCompartment:find("/compartment:has(/compartType[id='DisjointProperties'])")) parentCompartment:find("/form/component[id='DisjointProperties']/component[id='field']"):attr("text", "") end if parentCompartment:find("/compartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment"):size() > 0 then deleteCompartment(parentCompartment:find("/compartment/subCompartment:has(/compartType[id='ASFictitiousSuperProperties'])/subCompartment")) parentCompartment:find("/compartment:has(/compartType[id='SuperProperties'])"):attr("value", "") core.update_compartment_input_from_value(parentCompartment:find("/compartment:has(/compartType[id='SuperProperties'])")) parentCompartment:find("/form/component[id='SuperProperties']/component[id='field']"):attr("text", "") end end else name:attr("input", name:attr("value")) local parentCompartment = compartment:find("/element") disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='IsFunctional'])/component"), true) disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='SuperProperties'])/subCompartment/component"), true) disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='DisjointProperties'])/subCompartment/component"), true) disableEnableProperty(parentCompartment:find("/compartment:has(/compartType[id='EquivalentProperties'])/subCompartment/component"), true) end utilities.refresh_element(name, utilities.current_diagram()) end function disableEnableProperty(obj, value) obj:attr("enabled", value) local cmd = utilities.create_command("D#Command", {info = "Refresh"}) obj:link("command", cmd) utilities.execute_cmd_obj(cmd) obj:find("/container/component"):each(function(com) com:attr("enabled", value) local cmd = utilities.create_command("D#Command", {info = "Refresh"}) com:link("command", cmd) utilities.execute_cmd_obj(cmd) end) end function onAttributeOpen(form) local attribute = form:find("/presentationElement") if attribute:find("/subCompartment"):size() == 0 then core.create_missing_compartment(attribute, attribute:find("/compartType"), attribute:find("/compartType/subCompartType[id='schemaAssertion']")) core.create_missing_compartment(attribute, attribute:find("/compartType"), attribute:find("/compartType/subCompartType[id='domainAndRange']")) core.create_missing_compartment(attribute, attribute:find("/compartType"), attribute:find("/compartType/subCompartType[id='localRange']")) core.create_missing_compartment(attribute, attribute:find("/compartType"), attribute:find("/compartType/subCompartType[id='hiddenCompartment']")) local schemaAssertion = attribute:find("/subCompartment:has(/compartType[id='schemaAssertion'])") local domainAndRange = attribute:find("/subCompartment:has(/compartType[id='domainAndRange'])") local localRange = attribute:find("/subCompartment:has(/compartType[id='localRange'])") schemaAssertion:attr("value", "true") domainAndRange:attr("value", "true") core.update_compartment_input_from_value(schemaAssertion) core.update_compartment_input_from_value(domainAndRange) core.update_compartment_input_from_value(localRange) schemaAssertion:link("component", form:find("/component[id='schemaAssertion']/component/component[id='field']")) schemaAssertion:find("/component"):attr("checked", "true") domainAndRange:link("component", form:find("/component[id='domainAndRange']/component/component[id='field']")) domainAndRange:find("/component"):attr("checked", "true") localRange:link("component", form:find("/component[id='localRange']/component/component[id='field']")) -- localRange:find("/component"):attr("checked", "false") end local domainAndRange = attribute:find("/subCompartment:has(/compartType[id='domainAndRange'])") if domainAndRange:attr("value") == "true" or domainAndRange:attr("value") == "!" or domainAndRange:attr("value") == " " then form:find("/component[id='localRange']"):each(function(com) com:attr("enabled", false) com:find("/component"):each(function(obj) obj:attr("enabled", false) obj:find("/component"):each(function(obj2) obj2:attr("enabled", false) end) end) end) end -- local attribute = form:find("/presentationElement") -- local allValuesFrom = attribute:find("/subCompartment:has(/compartType[id='allValuesFrom'])") -- if allValuesFrom:size() > 0 and allValuesFrom:attr("value") == "true" then -- form:find("/component"):each(function(com) -- if com:attr("id") == "IsFunctional" or com:attr("id") == "EquivalentProperties" or com:attr("id") == "SuperProperties(<)" or com:attr("id") == "DisjointProperties(<>)" then -- com:attr("enabled", false) -- com:find("/component"):each(function(obj) -- obj:attr("enabled", false) -- obj:find("/component"):each(function(obj2) -- obj2:attr("enabled", false) -- end) -- end) -- end -- end) -- end end function disablePropertiesOnOpen(form) if form:find("/component[id='TabContainer']/component[caption='Direct']/component/component/component/compartment:has(/compartType[id='domainAndRange'])"):attr("value") == "true" then form:find("/component[id='TabContainer']/component[caption='Direct']/component/component/component"):each(function(com) local compartType = com:find("/compartment/compartType"):attr("id") if compartType == "localRange" then com:attr("enabled", false) end end) end if form:find("/component[id='TabContainer']/component[caption='Inverse']/component/component/component/compartment:has(/compartType[id='domainAndRange'])"):attr("value") == "true" then form:find("/component[id='TabContainer']/component[caption='Inverse']/component/component/component"):each(function(com) local compartType = com:find("/compartment/compartType"):attr("id") if compartType == "localRange" then com:attr("enabled", false) end end) end -- if form:find("/component[id='TabContainer']/component[caption='Direct']/component/component/component/compartment:has(/compartType[id='allValuesFrom'])"):attr("value") == "true" then -- form:find("/component[id='TabContainer']/component[caption='Direct']/component"):each(function(com) -- local compartType = com:attr("id") -- if compartType == "EquivalentProperties(=)" or compartType == "SuperProperties(<)" or compartType == "DisjointProperties(<>)" or compartType == "PropertyChains" then -- com:attr("enabled", false) -- com:find("/component/component"):each(function(obj) -- obj:attr("enabled", false) -- end) -- end -- com:find("/component/component"):each(function(obj) -- local compartType = obj:find("/compartment/compartType"):attr("id") -- if compartType == "Transitive" or compartType == "Irreflexive" or compartType == "Reflexive" or compartType == "Asymmetric" or compartType == "Symmetric" or compartType == "InverseFunctional" or compartType == "Functional" then -- obj:attr("enabled", false) -- end -- end) -- end) -- end -- if form:find("/component[id='TabContainer']/component[caption='Inverse']/component/component/component/compartment:has(/compartType[id='allValuesFrom'])"):attr("value") == "true" then -- form:find("/component[id='TabContainer']/component[caption='Inverse']/component"):each(function(com) -- local compartType = com:attr("id") -- if compartType == "EquivalentProperties(=)" or compartType == "SuperProperties(<)" or compartType == "DisjointProperties(<>)" or compartType == "PropertyChains" then -- com:attr("enabled", false) -- com:find("/component/component"):each(function(obj) -- obj:attr("enabled", false) -- end) -- end -- com:find("/component/component"):each(function(obj) -- local compartType = obj:find("/compartment/compartType"):attr("id") -- if compartType == "Transitive" or compartType == "Irreflexive" or compartType == "Reflexive" or compartType == "Asymmetric" or compartType == "Symmetric" or compartType == "InverseFunctional" or compartType == "Functional" then -- obj:attr("enabled", false) -- end -- end) -- end) -- end end function onAttributeLinkOpen(form) local attribute = form:find("/presentationElement") local domainAndRange = attribute:find("/compartment:has(/compartType[id='domainAndRange'])") if domainAndRange:attr("value") == "true" then form:find("/component[id='localRange']"):each(function(com) com:attr("enabled", false) com:find("/component"):each(function(obj) obj:attr("enabled", false) obj:find("/component"):each(function(obj2) obj2:attr("enabled", false) end) end) end) end -- local allValuesFrom = attribute:find("/compartment:has(/compartType[id='allValuesFrom'])") -- if allValuesFrom:size() > 0 and allValuesFrom:attr("value") == "true" then -- form:find("/component"):each(function(com) -- if com:attr("id") == "IsFunctional" or com:attr("id") == "EquivalentProperties" or com:attr("id") == "SuperProperties" or com:attr("id") == "DisjointProperties" then -- com:attr("enabled", false) -- com:find("/component"):each(function(obj) -- obj:attr("enabled", false) -- obj:find("/component"):each(function(obj2) -- obj2:attr("enabled", false) -- end) -- end) -- end -- end) -- end end function deleteCompartment(compartment) local parent_compartment = compartment:find("/parentCompartment") deleteSubCompartments(compartment) if not parent_compartment:is_empty() then core.update_compartment_value_from_subcompartments(parent_compartment) end end function deleteSubCompartments(compartment) compartment:find("/subCompartment"):each(function(com) deleteSubCompartments(com) end) compartment:delete() end function deleteCompartmentsForm(text) local close_button = lQuery.create("D#Button", { caption = "Close" ,eventHandler = utilities.d_handler("Click", "lua_engine", "lua.OWLGrEd_Schema.schema.closeDeleteCompartment()") }) local form = lQuery.create("D#Form", { id = "deteleCompartments" ,caption = "Warning" ,buttonClickOnClose = false ,cancelButton = close_button ,defaultButton = close_button ,eventHandler = utilities.d_handler("Close", "lua_engine", "lua.OWLGrEd_Schema.schema.closeDeleteCompartment()") ,minimumWidth = 300 ,maximumWidth = 300 ,prefferedWidth = 300 ,component = { lQuery.create("D#VerticalBox",{ id = "HorizontalAllForms" ,component = { lQuery.create("D#VerticalBox", { horizontalAlignment = -1 ,component = { lQuery.create("D#Label", {caption = "The following properties will be deleted:"}) ,lQuery.create("D#Label", {caption = text}) } }) }}) ,lQuery.create("D#HorizontalBox", { horizontalAlignment = 1 ,component = {close_button} }) } }) dialog_utilities.show_form(form) end function closeDeleteCompartment() lQuery("D#Event"):delete() utilities.close_form("deteleCompartments") end function selectRadioButtonValue(id, caption) local pValue = lQuery("OWL_PP#ExportParameter[pName = '" .. id .. "']"):attr("pValue") if caption == pValue then return true else return false end end function saveRadioButtonParameter() local radioButton = lQuery("D#Event/source"):last() local radioButtonCaption = radioButton:attr("caption") local radioButtonId = radioButton:attr("id") local pValue = lQuery("OWL_PP#ExportParameter[pName = '" .. radioButtonId .. "']") pValue:attr("pValue", radioButtonCaption) setExportAxioms() end function saveCheckBoxParameter() local checkBox = lQuery("D#Event/source"):last() local checkedId = checkBox:attr("id") local checked = checkBox:attr("checked") local pValue = lQuery("OWL_PP#ExportParameter[pName = '" .. checkedId .. "']") pValue:attr("pValue", checked) setExportAxioms() end function setExportAxioms() -- context = false, Standard (non-shema) ontology only if lQuery("OWL_PP#ExportParameter[pName = 'includeSchemaAssertionsInAnnotationForm']"):attr("pValue") == "false" and lQuery("OWL_PP#ExportParameter[pName = 'schemaExtension']"):attr("pValue") == "Standard (non-shema) ontology only" then local SubClassOf = [[SubClassOf([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'][/localRange == 'true' || /localRange == '+'][/Type/Type:$isEmpty != true] $getClassExpr ObjectAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace))) SubClassOf([$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'][/localRange == 'true' || /localRange == '+'][/Type/Type:$isEmpty != true] $getClassExpr DataAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'][/Type/Type:$isEmpty != true] $getClassExpr ObjectAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace))) SubClassOf([$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'][/Type/Type:$isEmpty != true] $getClassExpr DataAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)))]] end lQuery("ElemType[id='Class']/compartType/subCompartType[id='Attributes']/tag[key = 'ExportAxiom']"):attr("value", [[Declaration(ObjectProperty([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'] /Name:$getUri(/Name /Namespace))) Declaration(DataProperty([$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'] /Name:$getUri(/Name /Namespace))) ObjectPropertyDomain([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) $getDomainOrRange) DataPropertyDomain([$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) $getDomainOrRange) ObjectPropertyRange([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)) DataPropertyRange([/Type:$isEmpty != true][$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)) ]] .. SubClassOf) lQuery("ElemType[id='Class']/compartType/subCompartType[id='Attributes']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value",[[AnnotationAssertion($getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) SubClassOf = [[SubClassOf([/localRange == 'true'] $getClassExpr(/end) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression)) SubClassOf([/localRange == 'true'] $getClassExpr(/start) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/end) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression)) SubClassOf($getClassExpr(/start) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression))]] end lQuery("ElemType[id='Attribute']/tag[key = 'ExportAxiom']"):attr("value", [[Declaration(DataProperty(/Name:$getUri(/Name /Namespace))) DataPropertyDomain([/domainAndRange == 'true']/Name:$getUri(/Name /Namespace) $getClassExpr(/end)) DataPropertyDomain([/domainAndRange == 'true']/Name:$getUri(/Name /Namespace) $getClassExpr(/start)) DataPropertyRange([/domainAndRange == 'true'] /Name:$getUri(/Name /Namespace) $getDataTypeExpression) AnnotationAssertion([/schemaAssertion == 'true'] ?(Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getDataTypeExpression)) <http://lumii.lv/2018/1.0/owlc#source> /Name:$getUri(/Name /Namespace) $getClassExpr(/end)) AnnotationAssertion([/schemaAssertion == 'true'] ?(Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getDataTypeExpression)) <http://lumii.lv/2018/1.0/owlc#source> /Name:$getUri(/Name /Namespace) $getClassExpr(/start)) ]] .. SubClassOf) lQuery("ElemType[id='Attribute']/compartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion($getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) SubClassOf = [[SubClassOf([/../localRange == 'true'] $getClassExpr(/start) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/end)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/start) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/end)))]] end lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType[id='Name']/tag[key = 'ExportAxiom']"):attr("value",[[Declaration(ObjectProperty($getUri(/Name /Namespace))) ObjectPropertyDomain([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/start)) ObjectPropertyRange([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/end)) ]] .. SubClassOf) local SubClassOf = [[SubClassOf([/../localRange == 'true'] $getClassExpr(/end) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/start)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/end) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/start)))]] end lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType[id='Name']/tag[key = 'ExportAxiom']"):attr("value",[[Declaration(ObjectProperty($getUri(/Name /Namespace))) ObjectPropertyDomain([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/end)) ObjectPropertyRange([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/start)) InverseObjectProperties([/../../Role/domainAndRange == 'true'][/../domainAndRange == 'true']$getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) AnnotationAssertion([/../../Role/domainAndRange != 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#source> $getClassExpr(/start)) Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/start)) <http://lumii.lv/2018/1.0/owlc#isInverse> $getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) AnnotationAssertion([/../domainAndRange != 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#source> $getClassExpr(/start)) Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/start)) <http://lumii.lv/2018/1.0/owlc#isInverse> $getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) ]] .. SubClassOf) lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion($getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion($getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) if lQuery("Plugin[id='DefaultOrder']"):is_not_empty() and lQuery("Plugin[id='DefaultOrder']"):attr("status") == "loaded" then lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType[id='posInTable']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(<http://lumii.lv/2011/1.0/owlgred#posInTable> /../Name:$getUri(/Name /Namespace) "$value")]]) lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType[id='posInTable']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(<http://lumii.lv/2011/1.0/owlgred#posInTable> /../Name:$getUri(/Name /Namespace) "$value")]]) end -- context = true, Standard (non-shema) ontology only elseif lQuery("OWL_PP#ExportParameter[pName = 'includeSchemaAssertionsInAnnotationForm']"):attr("pValue") == "true" and lQuery("OWL_PP#ExportParameter[pName = 'schemaExtension']"):attr("pValue") == "Standard (non-shema) ontology only" then local SubClassOf = [[SubClassOf([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'][/Type/Type:$isEmpty != true] $getClassExpr ObjectAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace))) SubClassOf([$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'][/localRange == 'true' || /localRange == '+'][/Type/Type:$isEmpty != true] $getClassExpr DataAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'][/Type/Type:$isEmpty != true] $getClassExpr ObjectAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace))) SubClassOf([$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'][/Type/Type:$isEmpty != true] $getClassExpr DataAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)))]] end lQuery("ElemType[id='Class']/compartType/subCompartType[id='Attributes']/tag[key = 'ExportAxiom']"):attr("value", [[Declaration(ObjectProperty([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'] /Name:$getUri(/Name /Namespace))) Declaration(DataProperty([$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'] /Name:$getUri(/Name /Namespace))) AnnotationAssertion([/schemaAssertion == 'true' || /schemaAssertion == ' '][/Type/Type:$isEmpty != true][/Type/Type != 'Thing'][/../../Name/Name != ''] Annotation(<http://lumii.lv/2018/1.0/owlc#target> /Type:$getTypeExpression(/Type /Namespace)) <http://lumii.lv/2018/1.0/owlc#source> /Name:$getUri(/Name /Namespace) $getClassExpr) AnnotationAssertion([/schemaAssertion == 'true' || /schemaAssertion == ' '][/Type/Type:$isEmpty == true || /Type/Type == 'Thing'][/../../Name/Name != ''] <http://lumii.lv/2018/1.0/owlc#source> /Name:$getUri(/Name /Namespace) $getClassExpr) ObjectPropertyDomain([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) $getDomainOrRange) DataPropertyDomain([$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) $getDomainOrRange) ObjectPropertyRange([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)) ]].. SubClassOf) lQuery("ElemType[id='Class']/compartType/subCompartType[id='Attributes']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value",[[AnnotationAssertion([/../../schemaAssertion == 'true' || /../../schemaAssertion == ' ']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr) $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language))) AnnotationAssertion([/../../schemaAssertion != 'true'][/../../schemaAssertion != ' '] $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) SubClassOf = [[SubClassOf([/localRange == 'true'] $getClassExpr(/end) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression)) SubClassOf([/localRange == 'true'] $getClassExpr(/start) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/end) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression)) SubClassOf($getClassExpr(/start) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression))]] end lQuery("ElemType[id='Attribute']/tag[key = 'ExportAxiom']"):attr("value", [[Declaration(DataProperty(/Name:$getUri(/Name /Namespace))) DataPropertyDomain([/domainAndRange == 'true']/Name:$getUri(/Name /Namespace) $getClassExpr(/end)) DataPropertyDomain([/domainAndRange == 'true']/Name:$getUri(/Name /Namespace) $getClassExpr(/start)) DataPropertyRange([/domainAndRange == 'true'] /Name:$getUri(/Name /Namespace) $getDataTypeExpression) AnnotationAssertion([/schemaAssertion == 'true'] ?(Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getDataTypeExpression)) <http://lumii.lv/2018/1.0/owlc#source> /Name:$getUri(/Name /Namespace) $getClassExpr(/end)) AnnotationAssertion([/schemaAssertion == 'true'] ?(Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getDataTypeExpression)) <http://lumii.lv/2018/1.0/owlc#source> /Name:$getUri(/Name /Namespace) $getClassExpr(/start)) ]].. SubClassOf) lQuery("ElemType[id='Attribute']/compartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(?([/../../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/end))) ?([/../../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/start))) $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language))) AnnotationAssertion([/../../schemaAssertion != 'true'] $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) SubClassOf = [[SubClassOf([/../localRange == 'true'] $getClassExpr(/start) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/end)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/start) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/end)))]] end lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType[id='Name']/tag[key = 'ExportAxiom']"):attr("value",[[Declaration(ObjectProperty($getUri(/Name /Namespace))) ObjectPropertyDomain([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/start)) ObjectPropertyRange([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/end)) AnnotationAssertion([/../schemaAssertion == 'true'][$getClassName(/end) != 'Thing'][$getClassName(/start) != ''] ?(Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/end))) <http://lumii.lv/2018/1.0/owlc#source> $getUri(/Name /Namespace) $getClassExpr(/start)) AnnotationAssertion([/../schemaAssertion == 'true'][$getClassName(/end) == 'Thing' || $getClassName(/end) == ''][$getClassName(/start) != ''] <http://lumii.lv/2018/1.0/owlc#source> $getUri(/Name /Namespace) $getClassExpr(/start)) ]].. SubClassOf) SubClassOf = [[SubClassOf([/../localRange == 'true'] $getClassExpr(/end) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/start)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/end) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/start)))]] end lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType[id='Name']/tag[key = 'ExportAxiom']"):attr("value",[[Declaration(ObjectProperty($getUri(/Name /Namespace))) ObjectPropertyDomain([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/end)) ObjectPropertyRange([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/start)) InverseObjectProperties([/../../Role/domainAndRange == 'true'][/../domainAndRange == 'true']$getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) AnnotationAssertion([/../../Role/domainAndRange != 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#source> $getClassExpr(/start)) Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/start)) <http://lumii.lv/2018/1.0/owlc#isInverse> $getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) AnnotationAssertion([/../domainAndRange != 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#source> $getClassExpr(/start)) Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/start)) <http://lumii.lv/2018/1.0/owlc#isInverse> $getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) AnnotationAssertion([/../schemaAssertion == 'true'][$getClassName(/start) != 'Thing'][$getClassName(/end) != ''] ?(Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/start))) <http://lumii.lv/2018/1.0/owlc#source> $getUri(/Name /Namespace) $getClassExpr(/end)) AnnotationAssertion([/../schemaAssertion == 'true'][$getClassName(/start) == 'Thing' || $getClassName(/start) == ''][$getClassName(/end) != ''] <http://lumii.lv/2018/1.0/owlc#source> $getUri(/Name /Namespace) $getClassExpr(/end)) ]].. SubClassOf) lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(?([/../../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/start))) $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(?([/../../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/end))) $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) if lQuery("Plugin[id='DefaultOrder']"):is_not_empty() and lQuery("Plugin[id='DefaultOrder']"):attr("status") == "loaded" then lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType[id='posInTable']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(?([/../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/start))) <http://lumii.lv/2011/1.0/owlgred#posInTable> /../Name:$getUri(/Name /Namespace) "$value")]]) lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType[id='posInTable']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(?([/../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/end))) <http://lumii.lv/2011/1.0/owlgred#posInTable> /../Name:$getUri(/Name /Namespace) "$value")]]) end -- context = true, !Standard (non-shema) ontology only elseif lQuery("OWL_PP#ExportParameter[pName = 'includeSchemaAssertionsInAnnotationForm']"):attr("pValue") == "true" and lQuery("OWL_PP#ExportParameter[pName = 'schemaExtension']"):attr("pValue") ~= "Standard (non-shema) ontology only" then local SubClassOf = [[SubClassOf([$getAttributeType(/Type/Type /isObjectAttribute) == 'ObjectProperty'][/localRange == 'true' || /localRange == '+'][/Type/Type:$isEmpty != true] $getClassExpr ObjectAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace))) SubClassOf([$getAttributeType(/Type/Type /isObjectAttribute) == 'DataProperty'][/localRange == 'true' || /localRange == '+'][/Type/Type:$isEmpty != true] $getClassExpr DataAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf([$getAttributeType(/Type/Type /isObjectAttribute) == 'ObjectProperty'][/Type/Type:$isEmpty != true] $getClassExpr ObjectAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace))) SubClassOf([$getAttributeType(/Type/Type /isObjectAttribute) == 'DataProperty'][/Type/Type:$isEmpty != true] $getClassExpr DataAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)))]] end lQuery("ElemType[id='Class']/compartType/subCompartType[id='Attributes']/tag[key = 'ExportAxiom']"):attr("value", [[Declaration(ObjectProperty([$getAttributeType(/Type/Type /isObjectAttribute) == 'ObjectProperty'] /Name:$getUri(/Name /Namespace))) Declaration(DataProperty([$getAttributeType(/Type/Type /isObjectAttribute) == 'DataProperty'] /Name:$getUri(/Name /Namespace))) AnnotationAssertion([/schemaAssertion == 'true' || /schemaAssertion == ' '][/Type/Type:$isEmpty != true][/Type/Type != 'Thing'][/../../Name/Name != ''] Annotation(<http://lumii.lv/2018/1.0/owlc#target> /Type:$getTypeExpression(/Type /Namespace)) <http://lumii.lv/2018/1.0/owlc#source> /Name:$getUri(/Name /Namespace) $getClassExpr) AnnotationAssertion([/schemaAssertion == 'true' || /schemaAssertion == ' '][/Type/Type:$isEmpty == true || /Type/Type == 'Thing'][/../../Name/Name != ''] <http://lumii.lv/2018/1.0/owlc#source> /Name:$getUri(/Name /Namespace) $getClassExpr) ObjectPropertyRange([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)) DataPropertyRange([/Type:$isEmpty != true][$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)) ]].. SubClassOf) lQuery("ElemType[id='Class']/compartType/subCompartType[id='Attributes']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value",[[AnnotationAssertion([/../../schemaAssertion == 'true' || /../../schemaAssertion == ' ']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr) $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language))) AnnotationAssertion([/../../schemaAssertion != 'true'][/../../schemaAssertion != ' '] $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) SubClassOf = [[SubClassOf([/localRange == 'true'] $getClassExpr(/end) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression)) SubClassOf([/localRange == 'true'] $getClassExpr(/start) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/end) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression)) SubClassOf($getClassExpr(/start) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression))]] end lQuery("ElemType[id='Attribute']/tag[key = 'ExportAxiom']"):attr("value", [[Declaration(DataProperty(/Name:$getUri(/Name /Namespace))) DataPropertyRange([/domainAndRange == 'true'] /Name:$getUri(/Name /Namespace) $getDataTypeExpression) AnnotationAssertion([/schemaAssertion == 'true'] ?(Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getDataTypeExpression)) <http://lumii.lv/2018/1.0/owlc#source> /Name:$getUri(/Name /Namespace) $getClassExpr(/end)) AnnotationAssertion([/schemaAssertion == 'true'] ?(Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getDataTypeExpression)) <http://lumii.lv/2018/1.0/owlc#source> /Name:$getUri(/Name /Namespace) $getClassExpr(/start)) ]].. SubClassOf) lQuery("ElemType[id='Attribute']/compartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(?([/../../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/end))) ?([/../../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/start))) $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language))) AnnotationAssertion([/../../schemaAssertion != 'true'] $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) SubClassOf = [[SubClassOf([/../localRange == 'true'] $getClassExpr(/start) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/end)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/start) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/end)))]] end lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType[id='Name']/tag[key = 'ExportAxiom']"):attr("value",[[Declaration(ObjectProperty($getUri(/Name /Namespace))) ObjectPropertyRange([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/end)) AnnotationAssertion([/../schemaAssertion == 'true'][$getClassName(/end) != 'Thing'][$getClassName(/start) != ''] ?(Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/end))) <http://lumii.lv/2018/1.0/owlc#source> $getUri(/Name /Namespace) $getClassExpr(/start)) AnnotationAssertion([/../schemaAssertion == 'true'][$getClassName(/end) == 'Thing' || $getClassName(/end) == ''][$getClassName(/start) != ''] <http://lumii.lv/2018/1.0/owlc#source> $getUri(/Name /Namespace) $getClassExpr(/start)) ]].. SubClassOf) SubClassOf = [[SubClassOf([/../localRange == 'true'] $getClassExpr(/end) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/start)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/end) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/start)))]] end lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType[id='Name']/tag[key = 'ExportAxiom']"):attr("value",[[Declaration(ObjectProperty($getUri(/Name /Namespace))) ObjectPropertyRange([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/start)) InverseObjectProperties([/../../Role/domainAndRange == 'true'][/../domainAndRange == 'true']$getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) AnnotationAssertion([/../../Role/domainAndRange != 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#source> $getClassExpr(/start)) Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/start)) <http://lumii.lv/2018/1.0/owlc#isInverse> $getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) AnnotationAssertion([/../domainAndRange != 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#source> $getClassExpr(/start)) Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/start)) <http://lumii.lv/2018/1.0/owlc#isInverse> $getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) AnnotationAssertion([/../schemaAssertion == 'true'][$getClassName(/start) != 'Thing'][$getClassName(/end) != ''] ?(Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/start))) <http://lumii.lv/2018/1.0/owlc#source> $getUri(/Name /Namespace) $getClassExpr(/end)) AnnotationAssertion([/../schemaAssertion == 'true'][$getClassName(/start) == 'Thing' || $getClassName(/start) == ''][$getClassName(/end) != ''] <http://lumii.lv/2018/1.0/owlc#source> $getUri(/Name /Namespace) $getClassExpr(/end)) ]].. SubClassOf) lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(?([/../../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/start))) $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(?([/../../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/end))) $getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) if lQuery("Plugin[id='DefaultOrder']"):is_not_empty() and lQuery("Plugin[id='DefaultOrder']"):attr("status") == "loaded" then lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType[id='posInTable']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(?([/../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/start))) <http://lumii.lv/2011/1.0/owlgred#posInTable> /../Name:$getUri(/Name /Namespace) "$value")]]) lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType[id='posInTable']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(?([/../schemaAssertion == 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#context> $getClassExpr(/end))) <http://lumii.lv/2011/1.0/owlgred#posInTable> /../Name:$getUri(/Name /Namespace) "$value")]]) end -- context = false, !Standard (non-shema) ontology only elseif lQuery("OWL_PP#ExportParameter[pName = 'includeSchemaAssertionsInAnnotationForm']"):attr("pValue") == "false" and lQuery("OWL_PP#ExportParameter[pName = 'schemaExtension']"):attr("pValue") ~= "Standard (non-shema) ontology only" then local SubClassOf = [[SubClassOf([$getAttributeType(/Type/Type /isObjectAttribute) == 'ObjectProperty'][/localRange == 'true' || /localRange == '+'][/Type/Type:$isEmpty != true] $getClassExpr ObjectAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace))) SubClassOf([$getAttributeType(/Type/Type /isObjectAttribute) == 'DataProperty'][/localRange == 'true' || /localRange == '+'][/Type/Type:$isEmpty != true] $getClassExpr DataAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf([$getAttributeType(/Type/Type /isObjectAttribute) == 'ObjectProperty'][/Type/Type:$isEmpty != true] $getClassExpr ObjectAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace))) SubClassOf([$getAttributeType(/Type/Type /isObjectAttribute) == 'DataProperty'][/Type/Type:$isEmpty != true] $getClassExpr DataAllValuesFrom(/Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)))]] end lQuery("ElemType[id='Class']/compartType/subCompartType[id='Attributes']/tag[key = 'ExportAxiom']"):attr("value", [[Declaration(ObjectProperty([$getAttributeType(/Type/Type /isObjectAttribute) == 'ObjectProperty'] /Name:$getUri(/Name /Namespace))) Declaration(DataProperty([$getAttributeType(/Type/Type /isObjectAttribute) == 'DataProperty'] /Name:$getUri(/Name /Namespace))) ]] .. SubClassOf .. [[ObjectPropertyRange([$getAttributeType(/Type /isObjectAttribute) == 'ObjectProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace)) DataPropertyRange([/Type:$isEmpty != true][$getAttributeType(/Type /isObjectAttribute) == 'DataProperty'][/domainAndRange == 'true' || /domainAndRange == '!' || /domainAndRange == ' '] /Name:$getUri(/Name /Namespace) /Type:$getTypeExpression(/Type /Namespace))]]) lQuery("ElemType[id='Class']/compartType/subCompartType[id='Attributes']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value",[[AnnotationAssertion($getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) SubClassOf = [[SubClassOf([/localRange == 'true'] $getClassExpr(/end) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression)) SubClassOf([/localRange == 'true'] $getClassExpr(/start) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/end) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression)) SubClassOf($getClassExpr(/start) DataAllValuesFrom(/Name:$getUri(/Name /Namespace) $getDataTypeExpression))]] end lQuery("ElemType[id='Attribute']/tag[key = 'ExportAxiom']"):attr("value", [[Declaration(DataProperty(/Name:$getUri(/Name /Namespace))) DataPropertyRange([/domainAndRange == 'true'] /Name:$getUri(/Name /Namespace) $getDataTypeExpression) ]].. SubClassOf) lQuery("ElemType[id='Attribute']/compartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion($getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) SubClassOf = [[SubClassOf([/../localRange == 'true'] $getClassExpr(/start) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/end)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/start) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/end)))]] end lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType[id='Name']/tag[key = 'ExportAxiom']"):attr("value",[[Declaration(ObjectProperty($getUri(/Name /Namespace))) ObjectPropertyRange([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/end)) ]].. SubClassOf) SubClassOf = [[SubClassOf([/../localRange == 'true'] $getClassExpr(/end) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/start)))]] if lQuery("OWL_PP#ExportParameter[pName = 'computePropertyRangeClosure']"):attr("pValue") == "true" then SubClassOf = [[SubClassOf($getClassExpr(/end) ObjectAllValuesFrom($getUri(/Name /Namespace) $getClassExpr(/start)))]] end lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType[id='Name']/tag[key = 'ExportAxiom']"):attr("value",[[Declaration(ObjectProperty($getUri(/Name /Namespace))) ObjectPropertyRange([/../domainAndRange == 'true'] $getUri(/Name /Namespace) $getDomainOrRange(/start)) InverseObjectProperties([/../../Role/domainAndRange == 'true'][/../domainAndRange == 'true']$getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) AnnotationAssertion([/../../Role/domainAndRange != 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#source> $getClassExpr(/start)) Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/start)) <http://lumii.lv/2018/1.0/owlc#isInverse> $getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) AnnotationAssertion([/../domainAndRange != 'true']Annotation(<http://lumii.lv/2018/1.0/owlc#source> $getClassExpr(/start)) Annotation(<http://lumii.lv/2018/1.0/owlc#target> $getClassExpr(/start)) <http://lumii.lv/2018/1.0/owlc#isInverse> $getUri(/Name /Namespace) /../../Role/Name:$getUri(/Name /Namespace)) ]].. SubClassOf) lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion($getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType/subCompartType[id='Annotation']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion($getAnnotationProperty(/AnnotationType /Namespace) /../../Name:$getUri(/Name /Namespace) "$value(/ValueLanguage/Value)" ?(@$value(/ValueLanguage/Language)))]]) if lQuery("Plugin[id='DefaultOrder']"):is_not_empty() and lQuery("Plugin[id='DefaultOrder']"):attr("status") == "loaded" then lQuery("ElemType[id='Association']/compartType[id='Role']/subCompartType[id='posInTable']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(<http://lumii.lv/2011/1.0/owlgred#posInTable> /../Name:$getUri(/Name /Namespace) "$value")]]) lQuery("ElemType[id='Association']/compartType[id='InvRole']/subCompartType[id='posInTable']/tag[key = 'ExportAxiom']"):attr("value", [[AnnotationAssertion(<http://lumii.lv/2011/1.0/owlgred#posInTable> /../Name:$getUri(/Name /Namespace) "$value")]]) end end end function schemaGrammar(compartment) local additional_clauses = {} local generated_grammer = make_compart_grammer(compartment:find("/compartType"), compartment, "?", additional_clauses, true) local grammer = string.format("%s%s", generated_grammer, table.concat(additional_clauses)) local clauses = [[ ( ( {:schemaAssertion: '' -> " " :} {:hiddenCompartment: '' -> "++" :} "++" ) / ( {:schemaAssertion: '' -> " " :} {:localRange: '' -> "+" :} "+" )/ ( {:domainAndRange: '' -> "!" :} "!" )/ ( {:schemaAssertion: '' -> " " :} {:domainAndRange: '' -> " " :} "" ) ) ]] .. grammer -- print(clauses) return clauses end function make_compart_grammer(compart_type, compart, is_optional, additional_clauses, root) local delimiter = compart_type:attr("concatStyle") or "" delimiter = string.format("{('%s')}?", delimiter) local sub_comparts = compart_type:find("/subCompartType") local size = sub_comparts:size() local i = 0 local grammer = "" sub_comparts:each(function(sub_compart_type) if sub_compart_type:attr("id") ~= "schemaAssertion" and sub_compart_type:attr("id") ~= "domainAndRange" and sub_compart_type:attr("id") ~= "localRange" and sub_compart_type:attr("id") ~= "hiddenCompartment" then local new_grammer = "" local id = sub_compart_type:attr("id") i = i + 1 local sub_sub_comparts = sub_compart_type:find("/subCompartType") local sub_compart_id = sub_compart_type:attr("id") local prefix, suffix = core.get_prefix_suffix(sub_compart_type, nil, compart) prefix = core.recalculate_pattern(prefix) suffix = core.recalculate_pattern(suffix) local pattern, pattern_clauses = core.get_pattern(sub_compart_type, suffix) if prefix ~= "" then prefix = "'" .. prefix .. "'" end if suffix ~= "" then suffix = "'" .. suffix .. "'" end if i > 1 and i <= size then local tmp_optional = is_optional if sub_sub_comparts:is_not_empty() then local sub_compart_delimiter = sub_compart_type:attr("concatStyle") sub_compart_delimiter = core.recalculate_pattern(sub_compart_delimiter) if sub_compart_delimiter ~= "" then sub_compart_delimiter = "'" .. sub_compart_delimiter .. "'" end local start, finish = string.find(sub_compart_id, "ASFictitious") if start == 1 and finish == 12 then local sub_compart_pattern = make_compart_grammer(sub_compart_type, compart, "?", additional_clauses, true) new_grammer = delimiter .. " (" .. prefix .. " {:" .. sub_compart_id .. ": (" .. sub_compart_pattern .. " -> {} " .. "(" .. sub_compart_delimiter .. " " .. sub_compart_pattern .. " -> {})* " --.. ") -> {} :} " .. suffix .. ")" .. " \n" .. ") -> {} :} " .. suffix .. ")" .. tmp_optional .. " \n" --.. delimiter .. sub_compart_pattern .. " -> {} :} " .. suffix .. ")? " .. "-> {} " else local sub_compart_pattern = make_compart_grammer(sub_compart_type, compart, is_optional, additional_clauses) new_grammer = delimiter .. " (" .. prefix .. " {:" .. sub_compart_id .. ": (" .. sub_compart_pattern .. ") " .. " -> {} :} " .. suffix .. ")" .. tmp_optional .. " \n" end else new_grammer = delimiter .. " (" .. prefix .. " {:" .. sub_compart_id .. ": " .. pattern .. " :} " .. suffix .. ")" .. tmp_optional .. " \n" table.insert(additional_clauses, pattern_clauses) end else local tmp_optional = is_optional if sub_sub_comparts:size() == 1 then tmp_optional = "?" else tmp_optional = "" end if sub_sub_comparts:is_not_empty() then local sub_compart_delimiter = sub_compart_type:attr("concatStyle") if sub_compart_delimiter ~= "" then sub_compart_delimiter = "'" .. sub_compart_delimiter .. "'" end local start, finish = string.find(sub_compart_id, "ASFictitious") if start == 1 and finish == 12 then local sub_compart_pattern = make_compart_grammer(sub_compart_type, compart, "?", additional_clauses, true) new_grammer = "(" .. prefix .. " {:" .. sub_compart_id .. ": (" .. sub_compart_pattern .. " -> {} " .. "(" .. sub_compart_delimiter .. " " .. sub_compart_pattern .. " -> {})* " .. ") -> {} :}" .. suffix .. ")" .. tmp_optional .. " \n" else local sub_compart_pattern = make_compart_grammer(sub_compart_type, compart, is_optional, additional_clauses) new_grammer = "(" .. prefix .. " {:" .. sub_compart_id .. ": (" .. sub_compart_pattern .. ") -> {} :} " .. suffix .. ")" .. tmp_optional .. " \n" end else new_grammer = "(" .. prefix .. " {:" .. sub_compart_id .. ": " .. pattern .. " :} " .. suffix .. ")" .. tmp_optional .. " \n" table.insert(additional_clauses, pattern_clauses) end end grammer = grammer .. new_grammer end end) return grammer end
-- This Flag is a descendant of the Common folder instead of Modules/Flags -- because it needs to be accessible by both Modules/Common/LegacyThumbnailUrls and -- other places like Emotes, InspectAndBuy -- -- Since the server only has access to the Common and Server folders, it's -- placed here so both parts of the codebase can access it. game:DefineFastFlag("UseThumbnailUrl", false) return function() return game:GetFastFlag("UseThumbnailUrl") end
local Unit = require 'common.class' () function Unit:_init(specname) local spec = require('database.units.' .. specname) self.spec = spec self.hp = spec.max_hp self.hitDamage = self.spec.hitDamage end function Unit:get_name() return self.spec.name end function Unit:reset(name, SpriteAtlas) local pos = self:getPos() self:_init(name) local app = self:get_appearance() if SpriteAtlas == nil then print("NUL:", name) end print(SpriteAtlas) SpriteAtlas:changeId(self, pos, app) end function Unit:get_appearance() return self.spec.appearance end function Unit:get_hp() return self.hp, self.spec.max_hp end function Unit:set_color(color) self.spec.color = color end function Unit:get_cost() return self.spec.cost end function Unit:getPos() return self.pos end function Unit:setPos(pos) self.pos = pos end function Unit:dimHitDamage(dim) self.hitDamage = math.max(0, self.hitDamage - dim) print("dim", dim) print(self:get_name(), self.hitDamage) end function Unit:isMonster() return self.spec.isMonster end function Unit:isHero() return self.spec.isHero end function Unit:isHealer() return self.spec.isHealer end function Unit:isDengue() return self.spec.isDengue end function Unit:isDobby() return self.spec.isDobby end function Unit:changeHp(damage) local aux = math.min(self.spec.max_hp, self.hp - damage) self.hp = math.max(0, aux) end function Unit:getHitDamage() return self.spec.hitDamage end function Unit:getFieldRadius() if self.spec.fieldRadius then return self.spec.fieldRadius else return 0 end end function Unit:setDrawCircle(drawCircle) self.drawCircle = drawCircle end function Unit:getDrawCircle() return self.drawCircle end function Unit:solve(unit2, dist, SpriteAtlas) if self.spec.solver then self.spec.solver(unit2, dist, SpriteAtlas) end end function Unit:levelUp() local hit, hp, cost = 0, 0, 0 local level = self.spec.level if level + 1 <= self.spec.maxLevel then hit, hp, cost = self.spec.levelUp(level) self.spec.level = level + 1 end print("depois", hit, hp, cost) self.spec.hitDamage = self.spec.hitDamage + hit self.spec.max_hp = self.spec.max_hp + hp self.spec.cost = self.spec.cost + cost end function Unit:getLevelUpCost() return self.spec.levelUpCost end function Unit:isMaxLevel() return (self.spec.level == self.spec.maxLevel) end return Unit
Clothes = { ["chapeu"] = { name = "hats", hash = 0x9925C067 }, ["camisa"] = { name = "shirts", hash = 0x2026C46D }, ["colete"] = { name = "vests", hash = 0x485EE834 }, ["casaco"] = { name = "coats", hash = 0x662AC34 }, ["calca"] = { name = "pants", hash = 0x1D4C528A }, ["mascara"] = { name = "masks", hash = 0x7505EF42 }, ["botas"] = { name = "boots", hash =0x777EC6EF }, ["luvas"] = { name = "gloves", hash = 0xEABE0032 }, ["saia"] = { name = "skirts", hash = 0xA0E3AB7F }, ["coldre"] = { name = "holsters", hash = 0x9B2C8B89 } }
local L = LibStub("AceLocale-3.0"):NewLocale("StableSnapshot", "deDE") if not L then return end --@localization(locale="deDE", format="lua_additive_table", handle-unlocalized="english", handle-subnamespaces="concat")@
data:extend{ { type = "int-setting", name = "RailTools_max-search-distance", setting_type = "runtime-global", order = 100, default_value = 100, minimum_value = 2, }, { type = "int-setting", name = "RailTools_max-placed-signals", setting_type = "runtime-global", order = 100, default_value = 100, minimum_value = 1, }, { type = "int-setting", name = "RailTools_autoplace-interval", setting_type = "runtime-per-user", order = 100, default_value = 13, minimum_value = 2, }, { type = "int-setting", name = "RailTools_train-length", setting_type = "runtime-per-user", order = 100, default_value = 41, minimum_value = 2, }, }
--[[ Copyright 2014-2015 The Luvit Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --]] local loaded = pcall(require, 'openssl') if not loaded then return end local _common_tls = require('./common') local net = require('net') local DEFAULT_CIPHERS = _common_tls.DEFAULT_CIPHERS local extend = function(...) local args = {...} local obj = args[1] for i=2, #args do for k,v in pairs(args[i]) do obj[k] = v end end return obj end local Server = net.Server:extend() function Server:init(options, connectionListener) options = options or {} options.server = true local sharedCreds = _common_tls.createCredentials(options) net.Server.init(self, options, function(raw_socket) local socket socket = _common_tls.TLSSocket:new(raw_socket, { secureContext = sharedCreds, isServer = true, requestCert = options.requestCert, rejectUnauthorized = options.rejectUnauthorized, }) socket:on('secureConnection', function() connectionListener(socket) end) socket:on('error',function(err) connectionListener(socket,err) end) self.socket = socket if self.sni_hosts then socket:sni(self.sni_hosts) end end) end function Server:sni(hosts) self.sni_hosts = hosts end local DEFAULT_OPTIONS = { ciphers = DEFAULT_CIPHERS, rejectUnauthorized = true, -- TODO checkServerIdentity } local function connect(options, callback) local hostname, port, sock callback = callback or function() end options = extend({}, DEFAULT_OPTIONS, options or {}) port = options.port hostname = options.host or options.servername sock = _common_tls.TLSSocket:new(nil, options) sock:connect(port, hostname, callback) return sock end local function createServer(options, secureCallback) local server = Server:new() server:init(options, secureCallback) return server end return { TLSSocket = _common_tls.TLSSocket, createCredentials = _common_tls.createCredentials, connect = connect, createServer = createServer, }
local t = Def.ActorFrame { Def.Quad { InitCommand=function(self) self:xy(SCREEN_CENTER_X,SCREEN_CENTER_Y):zoomto(SCREEN_WIDTH,SCREEN_HEIGHT):diffuse(color("#000000")) end, OnCommand=function(self) self:stretchto(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM):cropleft(1):fadeleft(0.5):linear(0.5):cropleft(-0.5):diffuse(color("#000000")) end }, LoadActor ( "Screen cancel.ogg" )..{StartTransitioningCommand=function(self) self:play() end} } return t
vim.o.termguicolors = true vim.o.pumblend = 15 vim.o.ignorecase = true vim.o.smartcase = true vim.o.incsearch = true vim.o.hidden = true vim.o.history = 5000 vim.o.tabstop = 2 vim.o.shiftwidth = vim.o.tabstop vim.wo.number = true -- vim.wo.cursorcolumn = true -- vim.wo.cursorline = true vim.opt.fillchars["eob"] = " " vim.o.shortmess = vim.o.shortmess .. "c" vim.o.mouse = "a" vim.g.timeoutlen = 10
----------------------------------- -- Area: Wajaom Woodlands -- NPC: Watisa -- Type: Chocobo Renter -- !pos -201 -11 93 51 ----------------------------------- require("scripts/globals/chocobo") ----------------------------------- local eventSucceed = 9 local eventFail = 10 function onTrade(player,npc,trade) end function onTrigger(player,npc) tpz.chocobo.renterOnTrigger(player, eventSucceed, eventFail) end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) tpz.chocobo.renterOnEventFinish(player, csid, option, eventSucceed) end
local memo = require 'memo' local t = require 'testhelper' local c = 0 local add=memo(function(a,b) c=c+1 return a+b end) t(c, 0) t(add(1,2), 3) t(c, 1) t(add(1,2), 3) t(c, 1) t(add(1,2), 3) t(c, 1) t(add(2,2), 4) t(c, 2) t(add(2,2), 4) t(c, 2) t.test_embedded_example() t()
squid = class:new() function squid:init(x, y, color, p) self.x = x-1+2/16 self.y = y-1+4/16 self.width = 12/16 self.height = 12/16 self.rotation = 0 --for portals self.speedy = 0 self.speedx = 0 self.active = true self.static = false self.autodelete = true self.gravity = 0 self.category = 30 self.color = color or "white" self.freezable = true self.frozen = false --IMAGE STUFF self.drawable = true if self.color == "pink" then self.graphic = pinksquidimg self.quad = squidquad[spriteset][1] elseif self.color == "baby" then self.graphic = squidbabyimg self.quad = squidbabyquad[spriteset][1] else self.graphic = squidimg self.quad = squidquad[spriteset][1] end self.offsetX = 6 self.offsetY = 3 self.quadcenterX = 8 self.quadcenterY = 8 self.mask = { true, true, false, true, true, true, true, true, true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true} self.direction = "left" self.timer = 0 self.state = "idle" self.freezetimer = 0 self.shot = false if self.color == "nanny" then self.child = {} for i = 1, 4 do self.child[i] = squid:new(x+3/16, y-(8/16)*i, "baby", self) table.insert(objects["squid"], self.child[i]) end elseif self.color == "baby" then self.parent = p self.i = #self.parent.child+1 self.width = 6/16 self.height = 6/16 self.offsetX = 4 self.offsetY = 3 self.quadcenterX = 4 self.quadcenterY = 6 end end function squid:update(dt) --rotate back to 0 (portals) if self.rotation > 0 then self.rotation = self.rotation - portalrotationalignmentspeed*dt if self.rotation < 0 then self.rotation = 0 end elseif self.rotation < 0 then self.rotation = self.rotation + portalrotationalignmentspeed*dt if self.rotation > 0 then self.rotation = 0 end end if self.frozen then return false end if self.shot then self.speedy = self.speedy + shotgravity*dt self.x = self.x+self.speedx*dt self.y = self.y+self.speedy*dt return false elseif self.color == "baby" then if not self.parent or self.parent.shot then self:shotted(dir) return false end local i = self.i-1 local v = self.parent.child[i] --target if self.i == 1 then v = self.parent end while ((not v) or v.shot) and i > 0 do i = i-1 if i < 1 then v = self.parent else v = self.parent.child[i] end end local relativex, relativey = (v.x+ -self.x), (v.y + -self.y) - self.i/8 local distance = math.sqrt(relativex*relativex+relativey*relativey) if not self.chase then self.speedx = 0 self.speedy = squidfallspeed self.state = "idle" if self.supersized then self.chase = (distance > 1*self.supersized) else self.chase = (distance > 1) end else self.state = "upward" self.speedx, self.speedy = (relativex)/distance*(squidxspeed), (relativey)/distance*(squidxspeed) if distance < 1/16 then self.speedx = 0 self.state = "idle" self.chase = false end end self.x = self.x+self.speedx*dt self.y = self.y+self.speedy*dt if self.state == "idle" then self.quad = squidbabyquad[spriteset][1] else self.quad = squidbabyquad[spriteset][2] end return false elseif not self.frozen then if self.track then self.animationtimer = self.animationtimer + dt while self.animationtimer > goombaanimationspeed*2 do self.animationtimer = self.animationtimer - goombaanimationspeed*2 if self.quad == squidquad[spriteset][1] then self.quad = squidquad[spriteset][2] else self.quad = squidquad[spriteset][1] end end else --get nearest player closestplayer = 1 for i = 2, players do local v = objects["player"][i] if math.abs(self.x - v.x) < math.abs(self.x - objects["player"][closestplayer].x) then closestplayer = i end end if self.state == "idle" then self.speedy = squidfallspeed --get if change state to upward if (self.y+self.speedy*dt) + self.height + 0.0625 >= (objects["player"][closestplayer].y - (24/16 - objects["player"][closestplayer].height)) then self.state = "upward" self.upx = self.x self.speedx = 0 self.speedy = 0 --get if to change direction if true then--math.random(2) == 1 then if self.direction == "right" then if self.x > objects["player"][closestplayer].x then self.direction = "left" end else if self.x < objects["player"][closestplayer].x then self.direction = "right" end end end end elseif self.state == "upward" then if self.direction == "right" then self.speedx = self.speedx + squidacceleration*dt if self.speedx > squidxspeed then self.speedx = squidxspeed end else self.speedx = self.speedx - squidacceleration*dt if self.speedx < -squidxspeed then self.speedx = -squidxspeed end end self.speedy = self.speedy - squidacceleration*dt if self.speedy < -squidupspeed then self.speedy = -squidupspeed end if math.abs(self.x - self.upx) >= 2 then self.state = "downward" self.quad = squidquad[spriteset][2] self.downy = self.y self.speedx = 0 end elseif self.state == "downward" then self.speedy = squidfallspeed if self.y > self.downy + squiddowndistance then self.state = "idle" self.quad = squidquad[spriteset][1] end end end self.x = self.x+self.speedx*dt self.y = self.y+self.speedy*dt return false else self.speedx = 0 self.speedy = 0 end end function squid:shotted(dir) --fireball, star, turtle playsound(shotsound) self.shot = true self.active = false self.gravity = shotgravity self.speedy = -shotjumpforce self.direction = dir or "right" if self.direction == "left" then self.speedx = -shotspeedx else self.speedx = shotspeedx end end function squid:stomp() self:shotted("left") end function squid:freeze() self.frozen = true end function squid:rightcollide(a, b) if self:globalcollide() then return false end end function squid:leftcollide(a, b) if self:globalcollide() then return false end end function squid:ceilcollide(a, b) if self:globalcollide() then return false end end function squid:floorcollide(a, b) if self:globalcollide() then return false end end function squid:globalcollide(a, b) return true end function squid:dotrack() self.track = true self.animationtimer = 0 end function squid:dosupersize() if self.color == "nanny" then for i = 1, 4 do supersizeentity(self.child[i]) end end end
LmodMessage("Processing Dependency/5.6")
--[[ Settings for Player Effects ]] -- Wheather to use the HUD to expose the active effects to players (true or false) playereffects.use_hud = true -- Wheather to use autosave (true or false) playereffects.use_autosave = true -- The time interval between autosaves, in seconds (only used when use_autosave is true) playereffects.autosave_time = 10 -- If true, this loads some examples from example.lua. playereffects.use_examples = false
return function (colony) local bit = require('bit32') local uv = uv_open() -- locals local js_arr = colony.js_arr local js_obj = colony.js_obj local js_new = colony.js_new local js_tostring = colony.js_tostring local js_instanceof = colony.js_instanceof local js_typeof = colony.js_typeof local js_arguments = colony.js_arguments local js_break = colony.js_break local js_cont = colony.js_cont local js_seq = colony.js_seq local js_in = colony.js_in local js_setter_index = colony.js_setter_index local js_getter_index = colony.js_getter_index local js_proto_get = colony.js_proto_get local obj_proto = colony.obj_proto local num_proto = colony.num_proto local func_proto = colony.func_proto local str_proto = colony.str_proto local arr_proto = colony.arr_proto local regex_proto = colony.regex_proto local global = colony.global --[[ --|| Buffer --]] if _G._colony_global_Buffer then global.Buffer = _G._colony_global_Buffer global.Buffer.byteLength = function (this, msg) return type(msg) == 'string' and string.len(msg) or msg.length end end --[[ --|| process --]] global.process = js_obj({ memoryUsage = function (ths) return js_obj({ heapUsed=collectgarbage('count')*1024 }); end, platform = "colony", binding = function (self, key) return _G['_colony_binding_' + key](global); end, versions = js_obj({ node = "0.10.0", colony = "0.1.0" }), env = js_obj({}), stdin = js_obj({ resume = function () end, setEncoding = function () end }), stdout = js_obj({}) }) --[[ --|| global variables --]] global:__defineGetter__('____dirname', function (this) return string.gsub(string.sub(debug.getinfo(2).source, 2), "/?[^/]+$", "") end) global:__defineGetter__('____filename', function (this) return string.sub(debug.getinfo(2).source, 2) end) end
--[[ MIT License Copyright (c) 2020 DekuJuice Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]]-- local Node = require("class.engine.Node") local NodeTreeView = Node:subclass("NodeTreeView") NodeTreeView.static.dontlist = true NodeTreeView:define_signal("node_selected") local _pop_sentinel = {} function NodeTreeView:initialize() Node.initialize(self) self.is_open = true end function NodeTreeView:parented(parent) parent:add_action("Show Node Tree", function() self.is_open = not self.is_open end) end function NodeTreeView:draw() local editor = self:get_parent() if imgui.BeginMainMenuBar() then if imgui.BeginMenu("View") then editor:_menu_item("Show Node Tree", self.is_open) imgui.EndMenu() end imgui.EndMainMenuBar() end if not self.is_open then return end local model = editor:get_active_scene_model() local window_flags = {} imgui.SetNextWindowSize(800, 600, {"ImGuiCond_FirstUseEver"}) local flags = {} local should_draw, open = imgui.Begin("Node Tree", self.is_open, flags) self.is_open = open if should_draw then if imgui.Button(("%s Add Node"):format(IconFont.PLUS)) then editor:do_action("Add Node") end imgui.SameLine() if imgui.Button(("%s Instance Scene"):format(IconFont.LINK)) then editor:do_action("Instance Scene") end imgui.BeginChild("##Tree Area", -1, -1, true, {"ImGuiWindowFlags_HorizontalScrollbar"} ) if imgui.BeginTable("##Table", 2, {"ImGuiTableFlags_RowBg", "ImGuiTableFlags_BordersVInner"}) then local cw, ch = imgui.GetContentRegionAvail() imgui.TableSetupColumn("", nil, cw - 30); imgui.TableSetupColumn("", nil, 30); local root = model:get_tree():get_current_scene() local stack = { root } while #stack > 0 do local top = table.remove(stack) if top == _pop_sentinel then imgui.TreePop() else imgui.TableNextRow() local is_leaf = true for _,child in ipairs(top:get_children()) do if child:get_owner() == root then is_leaf = false break end end local tree_node_flags = { "ImGuiTreeNodeFlags_OpenOnArrow", "ImGuiTreeNodeFlags_SpanFullWidth", "ImGuiTreeNodeFlags_DefaultOpen", } if is_leaf then table.insert(tree_node_flags, "ImGuiTreeNodeFlags_Leaf") end for _, s in ipairs(model:get_selected_nodes()) do if top == s then table.insert(tree_node_flags, "ImGuiTreeNodeFlags_Selected") end if top:is_parent_of(s) then imgui.SetNextItemOpen(true) end end imgui.TableSetColumnIndex(0) local dname = top:get_name() if top.class.icon then dname = ("%s %s"):format(top.class.icon, dname) end local open = imgui.TreeNodeEx(dname, tree_node_flags) if imgui.BeginPopupContextItem("NodeContextMenu") then model:set_selected_nodes({top}) if top ~= root then editor:_menu_item("Move Node Up") editor:_menu_item("Move Node Down") editor:_menu_item("Duplicate Node") editor:_menu_item("Reparent Node") end editor:_menu_item("Delete Node") imgui.EndPopup() end if imgui.IsItemClicked(0) and not imgui.IsItemToggledOpen() then model:set_selected_nodes({top}) self:emit_signal("node_selected", top) end if top:get_filepath() then imgui.SameLine() imgui.Text(("%s"):format(IconFont.LINK)) end --[[if top:get_owner() then imgui.SameLine() imgui.Text(top:get_owner():get_name()) end]]-- if open then table.insert(stack, _pop_sentinel) local children = top:get_children() for i = #children, 1, -1 do local c = children[i] if c:get_owner() == root then table.insert(stack, c) end end end imgui.TableSetColumnIndex(1) local visible = top:get_visible() local visible_in_tree = top:is_visible_in_tree() local b if visible then b = IconFont.EYE else b = IconFont.EYE_OFF end if not visible_in_tree then imgui.PushStyleColor("ImGuiCol_Button", 0.260, 0.590, 0.980, 0.200) imgui.PushStyleColor("ImGuiCol_ButtonHovered", 0.260, 0.590, 0.980, 0.400) imgui.PushStyleColor("ImGuiCol_ButtonActive", 0.060, 0.530, 0.980, 0.200) end if imgui.Button(b) then local cmd = model:create_command("Toggle Visibility") local func = function() top:set_visible(not top:get_visible()) end cmd:add_do_func(func) cmd:add_undo_func(func) model:commit_command(cmd) end if not visible_in_tree then imgui.PopStyleColor(3) end end end imgui.EndTable() end imgui.EndChild() if imgui.IsWindowFocused("ImGuiFocusedFlags_RootAndChildWindows") then editor:get_node("Inspector"):set_auto_inspect_nodes(true) end end imgui.End() end return NodeTreeView
-- -- MultinomialAction.lua -- hard-attention -- -- Created by Andrey Kolishchak on 09/27/15. -- require 'nn' local MultinomialAction, parent = torch.class('nn.MultinomialAction', 'nn.Module') function MultinomialAction:__init() parent.__init(self) self.epsilon = 1e-12 self.input = torch.Tensor() end function MultinomialAction:updateOutput(input) self.input:resizeAs(input):copy(input):add(self.epsilon) if self.train == true then self.output = torch.multinomial(self.input, 1) else _, self.output = torch.max(self.input, 2) end return self.output end function MultinomialAction:updateGradInput(input, gradOutput) local reward_loss = gradOutput self.gradInput:resizeAs(input):zero() self.gradInput:scatter(2, self.output, 1) self.gradInput:cdiv(self.input) local reward = reward_loss:expandAs(self.gradInput) self.gradInput:cmul(reward) return self.gradInput end
--TODO: Add domain-specific manuals, Document local air = require("air") local json = require("json") local file = require("file") file.activate_json(json) local segment = {} segment.setnames = {} segment.name = "enforcer" segment.settings = { automod = { list = { }, status = false, warn_limit = 3 } } if globals.enofrcer then if globals.enforcer.setnames then segment.setnames = globals.enforcer.setnames end if globals.enforcer.settings then segment.settings = global.enforcer.settings end end segment.warns = file.readJSON("./servers/"..id.."/warns.json",{}) events:on("serverSaveConfig",function() if not globals.enforcer then globals.enforcer = {} end globals.enforcer.setnames = segment.setnames globals.enforcer.settings = segment.settings file.writeJSON("./servers/"..id.."/warns.json",segment.warns) end) local warn = function(ID,reason) local guild = client:getGuild(id) local member = guild:getMember(tostring(ID)) if not segment.warns[tostring(ID)] then segment.warns[tostring(ID)] = {} end table.insert(segment.warns[tostring(ID)],1,reason) if segment.settings.warn_limit and (#segment.warns[tostring(ID)] >= segment.settings.warn_limit) and guild:getMember(tostring(ID)) then if segment.settings.warn_punishment == "kick" then member:kick("Warning quota exceeded.") elseif segment.settings.warn_punishment == "ban" then member:ban("Warning quota exceeded.",segment.settings.ban_days) end end _ = (client:getUser(tostring(ID)) and client:getUser(tostring(ID)):send("__You have been warned.__\nReason: "..reason)) signals:emit("warn",function(args) if args[1] and member.name:find(args[1],1,true) then return true elseif not args[1] then return true else return false end end,{ user = member.id, name = member.name }) end segment.commands = { ["change-name"] = { help = {embed = { title = "Enforce a name upon a specific user", description = "Whenever the user attempts to change their name, it will be changed back", fields = { {name = "Usage: ",value = "change-name <user> <name>"}, {name = "Perms: ",value = "manageNicknames"} } }}, perms = { perms = { "manageNicknames" } }, args = { "member", "string" }, exec = function(msg,args,opts) name = args[2] args[1]:setNickname(name) segment.setnames[tostring(args[1].id)] = name msg:reply("Now assigning an enforced name upon "..args[1].name) end }, ["reset-name"] = { help = {embed = { title = "Stop enforcing a name upon a user", description = "Reverses the effect of ``change-name``", fields = { {name = "Usage: ",value = "reset-name"}, {name = "Perms: ",value = "manageNicknames"} } }}, perms = { perms = { "manageNicknames" } }, args = { "member" }, exec = function(msg,args,opts) if segment.setnames[tostring(args[1].id)] then segment.setnames[tostring(args[1].id)] = nil args[1]:setNickname(nil) msg:reply("No longer tracking "..args[1].name) else msg:reply("This user haven't been assigned an enforced name") end end }, ["wipe"] = { help = {embed={ title = "Wipe user messages", description = "Searches and deletes all messages of a specific user in a specified range", fields = { {name = "Usage: ",value = "wipe-user <range> <user mention or id>"}, {name = "Perms: ",value = "manageMessages"} } }}, perms = { perms = { "manageMessages" } }, args = { "number", }, exec = function(msg,args,opts) if tonumber(args[1]) and tonumber(args[1]) > 101 then msg:reply("Search limit is too high") return end local messages = {} msg.channel:getMessages(args[1]):forEach(function(v) messages[#messages+1] = v.id end) msg.channel:bulkDelete(messages) end }, ["wipe-user"] = { help = {embed={ title = "Wipe user messages", description = "Searches and deletes all messages of a specific user in a specified range", fields = { {name = "Usage: ",value = "wipe-user <range> <user mention or id>"}, {name = "Perms: ",value = "manageMessages"} } }}, perms = { perms = { "manageMessages" } }, args = { "number", "member" }, exec = function(msg,args,opts) if tonumber(args[1]) and tonumber(args[1]) > 101 then msg:reply("Search limit is too high") return end local messages = {} local target = args[2].user msg.channel:getMessages(args[1]):forEach(function(v) if v.author.id == target.id then messages[#messages+1] = v.id end end) msg.channel:bulkDelete(messages) end }, ["wipe-pattern"] = { help = {embed={ title = "Wipe by pattern", description = "Searches for a specific pattern in a range of messages, and wipes if certain conditions are met", fields = { {name = "Usage: ",value = "wipe-pattern <range> <pattern>"}, {name = "Perms: ",value = "manageMessages"} } }}, perms = { perms = { "manageMessages" } }, args = { "number", "string" }, exec = function(msg,args,opts) if tonumber(args[1]) and tonumber(args[1]) > 101 then msg:reply("Search limit is too high") return end local messages = {} msg.channel:getMessages(args[1]):forEach(function(v) if v.content:find(args[2],1,true) then messages[#messages+1] = v.id end end) msg.channel:bulkDelete(messages) end }, ["kick"] = { help = {embed={ title = "Kick a member", description = "Self-descriptive", fields = { {name = "Usage: ",value = "kick <member> [<reason>]"}, {name = "Perms: ",value= "kickMembers"} } }}, perms = { perms = { "kickMembers" } }, args = { "member" }, exec = function(msg,args,opts) local member = args[1] signals:emit("kick",function(args) if args[1] and member.name:find(args[1],1,true) then return true elseif not args[1] then return true else return false end end,{ user = member.id, name = member.name, reason = args[2] }) member:kick(args[2]) end }, ["ban"] = { help = {embed={ title = "Ban a member", description = "Self-descriptive", fields = { {name = "Usage: ",value = "ban <member> [<reason> [<days>]]"}, {name = "Perms: ",value= "banMembers"} } }}, perms = { perms = { "banMembers" } }, args = { "member" }, exec = function(msg,args,opts) local member = args[1] signals:emit("kick",function(args) if args[1] and member.name:find(args[1],1,true) then return true elseif not args[1] then return true else return false end end,{ user = member.id, name = member.name, reason = args[2], days = args[3] }) member:ban(args[2],tonumber(args[3])) end }, ["purge"] = { help = {embed={ title = "Purge bot messages", description = "If a number is provided, the bot will search through that amount of messages, or through 100 of them by default", fields = { {name = "Usage: ",value = "ban <member> [<reason> [<days>]]"}, {name = "Perms: ",value= "manageMessages"} } }}, perms = { perms = { "manageMessages" } }, exec = function(msg,args,opts) local messages = {} if tonumber(args[1]) and tonumber(args[1]) > 101 then msg:reply("Search limit is too high") return end msg.channel:getMessages(tonumber(args[1]) or 100):forEach(function(v) if (v.author.id == client.user.id) or (v.content:find(globals.prefix)==1) then messages[#messages+1] = v.id end end) msg.channel:bulkDelete(messages) end }, ["warn"] = { help = {embed={ title = "Warn a user", descriptions = "Warnings by themselves don't do any punishment to the user, but they allow managing users", fields = { {name = "Usage: ",value = "warn <user> <reason>"}, {name = "Perms: ",value = "kickMembers"} } }}, perms = { perms = { "kickMembers" } }, args = { "member", "string" }, exec = function(msg,args,opts) local reason = table.concat(args," ",2) warn(args[1].id,reason) msg:reply({embed = { title = "User "..args[1].name.." warned", description = "Reason: ```"..reason.."```" }}) end }, ["warns"] = { help = {embed={ title = "List warnings", descriptions = "self-descriptive", fields = { {name = "Usage: ",value = "warns <member> [<page>]"}, {name = "Perms: ",value = "kickMembers"} } }}, perms = { perms = { "kickMembers" } }, args = { "member", }, exec = function(msg,args,opts) local page = (tonumber(args[2]) or 1)-1 local new_embed = { title = "Warnings for "..args[1].name, fields = {} } if page < 0 then new_embed.description = "Page "..page.." not found, reverting to first page" page = 0 end if segment.warns[tostring(args[1].id)] and #segment.warns[tostring(args[1].id)] > 0 then for I = 1+(page*5),5+(page*5) do local warn = segment.warns[tostring(args[1].id)][I] if warn then table.insert(new_embed.fields,{name = "ID: "..tostring(I),value = warn}) end end msg:reply({embed = new_embed}) else msg:reply("This user has no warnings") end end }, ["unwarn"] = { help = {embed={ title = "Revoke a warning issued to a user", descriptions = "self-descriptive", fields = { {name = "Usage: ",value = "unwarn <user> [<warn id>]"}, {name = "Perms: ",value = "kickMembers"} } }}, perms = { perms = { "kickMembers" } }, args = { "member", }, exec = function(msg,args,opts) local warn_id = (tonumber(args[2]) or 1) if segment.warns[tostring(args[1].id)][warn_id] then table.remove(segment.warns[tostring(args[1].id)],warn_id) msg:reply("Revoked warning #"..warn_id) else msg:reply("No warning with id "..warn_id) end end }, ["add-role"] = { help = {embed={ title = "Give some specific user a role", descriptions = "self-descriptive", fields = { {name = "Usage: ",value = "unwarn <member> <role>"}, {name = "Perms: ",value = "manageRoles"} } }}, perms = { perms = { "manageRoles" } }, args = { "member", "role" }, exec = function(msg,args,opts) args[1]:addRole(tostring(args[2].id)) end }, ["remove-role"] = { help = {embed={ title = "Revoke a role from a user", descriptions = "self-descriptive", fields = { {name = "Usage: ",value = "remove-role <member> <role>"}, {name = "Perms: ",value = "manageRoles"} } }}, perms = { perms = { "manageRoles" } }, args = { "member", "role" }, exec = function(msg,args,opts) args[1]:removeRole(tostring(args[2].id)) end }, } events:on("memberUpdate",function(member) if segment.setnames[tostring(member.id)] and member.nickname ~= segment.setnames[tostring(member.id)] then member:setNickname(segment.setnames[tostring(member.id)]) end end) --old automod code --[[ events:on("messageCreate",function(msg) if segment.settings.automod.status then local trigger = "" for k,v in pairs(segment.settings.automod.list) do if msg.content:find(v) and msg.author ~= client.user then trigger = trigger..v.."," end end if trigger ~= "" then full_text,author = msg.content.."",msg.author msg:delete() msg.author:send("The words \""..trigger.."\" are banned on this server.\nThis is the text that these words were found in: ```"..full_text.."```") if segment.settings.automod.punishment == "kick" then msg.author:kick("Usage of banned words") elseif segment.settings.automod.punishment == "warn" then warn(msg.author.id,"Usage of banned words",msg.guild) end end end end) ]] return segment
local K, C = unpack(select(2, ...)) local Module = K:GetModule("Blizzard") if not Module then return end local _G = _G local floor = math.floor local format = string.format local CreateFrame = _G.CreateFrame local hooksecurefunc = _G.hooksecurefunc local UnitAlternatePowerInfo = _G.UnitAlternatePowerInfo local UnitPowerMax = _G.UnitPowerMax local UnitPower = _G.UnitPower local statusBarColorGradient = false local statusBarColor = {r = 0.2, g = 0.4, b = 0.8} local statusTextFormat = "NAMECURMAX" local statusWidth = 250 local statusHeight = 20 local statusBar = K.GetTexture(C["UITextures"].GeneralTextures) local font = K.GetFont(C["UIFonts"].GeneralFonts) local function updateTooltip(self) if _G.GameTooltip:IsForbidden() then return end if self.powerName and self.powerTooltip then _G.GameTooltip:SetText(self.powerName, 1, 1, 1) _G.GameTooltip:AddLine(self.powerTooltip, nil, nil, nil, 1) _G.GameTooltip:Show() end end local function onEnter(self) if (not self:IsVisible()) or _G.GameTooltip:IsForbidden() then return end _G.GameTooltip:ClearAllPoints() _G.GameTooltip_SetDefaultAnchor(_G.GameTooltip, self) updateTooltip(self) end local function onLeave() _G.GameTooltip:Hide() end function Module:SetAltPowerBarText(name, value, max, percent) local textFormat = statusTextFormat if textFormat == "NONE" or not textFormat then return "" elseif textFormat == "NAME" then return format("%s", name) elseif textFormat == "NAMEPERC" then return format("%s: %s%%", name, percent) elseif textFormat == "NAMECURMAX" then return format("%s: %s / %s", name, value, max) elseif textFormat == "NAMECURMAXPERC" then return format("%s: %s / %s - %s%%", name, value, max, percent) elseif textFormat == "PERCENT" then return format("%s%%", percent) elseif textFormat == "CURMAX" then return format("%s / %s", value, max) elseif textFormat == "CURMAXPERC" then return format("%s / %s - %s%%", value, max, percent) end end function Module:PositionAltPowerBar() local holder = CreateFrame("Frame", "AltPowerBarHolder", UIParent) holder:SetPoint("TOP", UIParent, "TOP", 0, -18) holder:SetSize(128, 50) _G.PlayerPowerBarAlt:ClearAllPoints() _G.PlayerPowerBarAlt:SetPoint("CENTER", holder, "CENTER") _G.PlayerPowerBarAlt:SetParent(holder) _G.PlayerPowerBarAlt.ignoreFramePositionManager = true --[[ The Blizzard function FramePositionDelegate:UIParentManageFramePositions() calls :ClearAllPoints on PlayerPowerBarAlt under certain conditions. Doing ".ClearAllPoints = K.Noop" causes error when you enter combat. --]] local function Position(bar) bar:SetPoint("CENTER", AltPowerBarHolder, "CENTER") end hooksecurefunc(_G.PlayerPowerBarAlt, "ClearAllPoints", Position) K.Mover(holder, "PlayerPowerBarAlt", "Alternative Power", {"TOP", UIParent, "TOP", 0, -18}, statusWidth or 250, statusHeight or 20) end function Module:UpdateAltPowerBarColors() local bar = _G.KkthnxUI_AltPowerBar if statusBarColorGradient then if bar.colorGradientR and bar.colorGradientG and bar.colorGradientB then bar:SetStatusBarColor(bar.colorGradientR, bar.colorGradientG, bar.colorGradientB) elseif bar.powerValue then local power, maxPower = bar.powerValue or 0, bar.powerMaxValue or 0 local value = (maxPower > 0 and power / maxPower) or 0 bar.colorGradientValue = value local r, g, b = K.ColorGradient(value, 0.8,0,0, 0.8,0.8,0, 0,0.8,0) bar.colorGradientR, bar.colorGradientG, bar.colorGradientB = r, g, b bar:SetStatusBarColor(r, g, b) else bar:SetStatusBarColor(0.6, 0.6, 0.6) -- uh, fallback! end else local color = statusBarColor bar:SetStatusBarColor(color.r, color.g, color.b) end end function Module:UpdateAltPowerBarSettings() local bar = _G.KkthnxUI_AltPowerBar bar:SetSize(statusWidth or 250, statusHeight or 20) bar:SetStatusBarTexture(statusBar) bar.text:SetFontObject(font) AltPowerBarHolder:SetSize(bar.Backdrop:GetSize()) K.SmoothBar(bar) local textFormat = statusTextFormat if textFormat == "NONE" or not textFormat then bar.text:SetText("") else local power, maxPower, perc = bar.powerValue or 0, bar.powerMaxValue or 0, bar.powerPercent or 0 local text = Module:SetAltPowerBarText(bar.powerName or "", power, maxPower, perc) bar.text:SetText(text) end end function Module:SkinAltPowerBar() local powerbar = CreateFrame("StatusBar", "KkthnxUI_AltPowerBar", UIParent) powerbar:CreateBackdrop() powerbar.Backdrop:SetFrameLevel(1) powerbar:SetMinMaxValues(0, 200) powerbar:SetPoint("CENTER", AltPowerBarHolder) powerbar:Hide() powerbar:SetScript("OnEnter", onEnter) powerbar:SetScript("OnLeave", onLeave) powerbar.text = powerbar:CreateFontString(nil, "OVERLAY") powerbar.text:SetPoint("CENTER", powerbar, "CENTER") powerbar.text:SetJustifyH("CENTER") Module:UpdateAltPowerBarSettings() Module:UpdateAltPowerBarColors() -- Event handling powerbar:RegisterEvent("UNIT_POWER_UPDATE") powerbar:RegisterEvent("UNIT_POWER_BAR_SHOW") powerbar:RegisterEvent("UNIT_POWER_BAR_HIDE") powerbar:RegisterEvent("PLAYER_ENTERING_WORLD") powerbar:SetScript("OnEvent", function(bar) _G.PlayerPowerBarAlt:UnregisterAllEvents() _G.PlayerPowerBarAlt:Hide() local barType, min, _, _, _, _, _, _, _, _, powerName, powerTooltip = UnitAlternatePowerInfo("player") if not barType then barType, min, _, _, _, _, _, _, _, _, powerName, powerTooltip = UnitAlternatePowerInfo("target") end bar.powerName = powerName bar.powerTooltip = powerTooltip if barType then local power = UnitPower("player", _G.ALTERNATE_POWER_INDEX) local maxPower = UnitPowerMax("player", _G.ALTERNATE_POWER_INDEX) or 0 local perc = (maxPower > 0 and floor(power / maxPower * 100)) or 0 bar.powerValue = power bar.powerMaxValue = maxPower bar.powerPercent = perc bar:Show() bar:SetMinMaxValues(min, maxPower) bar:SetValue(power) if statusBarColorGradient then local value = (maxPower > 0 and power / maxPower) or 0 bar.colorGradientValue = value local r, g, b = K.ColorGradient(value, 0.8,0,0, 0.8,0.8,0, 0,0.8,0) bar.colorGradientR, bar.colorGradientG, bar.colorGradientB = r, g, b bar:SetStatusBarColor(r, g, b) end local text = Module:SetAltPowerBarText(powerName or "", power, maxPower, perc) bar.text:SetText(text) else bar:Hide() end end) end function Module:CreateAltPowerbar() if not IsAddOnLoaded("SimplePowerBar") then self:PositionAltPowerBar() self:SkinAltPowerBar() end end
-- Chinese Traditional localization file for zhTW. by BNSSNB and rest by Google translator local _ -- global functions and variebles to locals to keep LINT happy local assert = _G.assert local LibStub = _G.LibStub; assert(LibStub ~= nil,'LibStub') -- local AddOn local ADDON = ... local AceLocale = LibStub:GetLibrary("AceLocale-3.0"); local L = AceLocale:NewLocale(ADDON, "zhTW"); if not L then return end -- L["NOP_TITLE"] = "New Openables" L["NOP_VERSION"] = "|cFFFFFFFF%s 使用 |cFFFF00FF/nop|cFFFFFFFF" L["CLICK_DRAG_MSG"] = "ALT-左鍵點擊拖曳移動。" L["CLICK_OPEN_MSG"] = "左鍵點擊開啟或使用。" L["CLICK_SKIP_MSG"] = "右鍵點擊略過物品" L["CLICK_BLACKLIST_MSG"] = "CTRL-右鍵點擊到黑名單物品。" L["No openable items!"] = "沒有可開啟物品!" L["BUTTON_RESET"] = "重置並移動按鈕到螢幕中間!" L["NOP_USE"] = "使用:" L["Spell:"] = "施法:" L["BLACKLISTED_ITEMS"] = "|cFFFF00FF永遠黑名單物品:" L["BLACKLIST_EMPTY"] = "|cFFFF00FF永遠黑名單是空的" L["PERMA_BLACKLIST"] = "永遠黑名單:|cFF00FF00" L["SESSION_BLACKLIST"] = "本次上線黑名單:|cFF00FF00" L["TEMP_BLACKLIST"] = "臨時黑名單:|cFF00FF00" L["|cFFFF0000Error loading tooltip for|r "] = "|cFFFF0000錯誤載入提示|r " L["Plans, patterns and recipes cache update."] = "計畫、圖案和配方快取更新。" L["Spell patterns cache update."] = "施法圖案快取更新。" L["|cFFFF0000Error loading tooltip for spell |r "] = "|cFFFF0000法術錯誤載入提示 |r " L["|cFFFF0000Error loading tooltip for spellID %d"] = "|cFFFF0000%d 法術ID錯誤載入提示" L["TOGGLE"] = "切換" L["Skin Button"] = "皮膚按鈕" L["Masque Enable"] = "Masque 啟用" L["Need UI reload or relogin to activate."] = "需要UI重新加載或重新登錄才能激活。" L["Lock Button"] = "鎖定按鈕" L["Lock button in place to disbale drag."] = "鎖定按鈕來禁用拖曳。" L["Glow Button"] = "閃光按鈕" L["When item is placed by zone change, button will have glow effect."] = "當物品根據區域改變來放置,按鈕將會有發光效果。" L["Backdrop Button"] = "背景按鈕" L["Create or remove backdrop around button, need reload UI."] = "創建或移除環繞按鈕的背景,需要重載UI。" L["Session skip"] = "本次上線略過" L["Skipping item last until relog."] = "略過物品直到重新登入。" L["Clear Blacklist"] = "清空黑名單" L["Reset Permanent blacklist."] = "重置永遠黑名單。" L["Zone unlock"] = "區域解鎖" L["Don't zone restrict openable items"] = "不要根據區域限制可開啟的物品" L["Profession"] = "專業" L["Place items usable by lockpicking"] = "根據開鎖放置可使用物品" L["Button"] = "按鈕" L["Buttom location"] = "按鈕位置" L["Button size"] = "按鈕大小" L["Width and Height"] = "寬和高" L["Button size in pixels"] = "按鈕大小向素" L["Miner's Coffee stacks"] = "礦工咖啡堆疊數" L["Allow buff up to this number of stacks"] = "允許增益堆疊到此數字" L["Quest bar"] = "任務條" L["Quest items placed on bar"] = "任務物品放置在條上" L["Visible"] = "可視的" L["Make button visible by placing fake item on it"] = "透過放置假物品使按鈕可見" L["Swap"] = "交換" L["Swap location of numbers for count and cooldown timer"] = "交換數字計數和冷卻時間的位置" L["Buttons per row"] = "每行幾個按鈕" L["AutoQuest"] = "自動任務" L["Auto accept or hand out quests from AutoQuestPopupTracker!"] = "自動接受或交出任務從AutoQuestPopupTracker!" L["Strata"] = "地層" L["Set strata for items button to HIGH, place it over normal windows."] = "將項目的地層按鈕設置為高,將其放在普通窗口上。" L["Herald"] = "先鋒" L["Announce completed work orders, artifact points etc.."] = "宣布完成的工單,工件點等。" L["Skip on Error"] = "跳過錯誤" L["Temporary blacklist item when click produce error message"] = "臨時黑名單項目點擊時產生錯誤信息" L["HIDE_IN_COMBAT"] = "顯示聲望" L["HIDE_IN_COMBAT_HELP"] = "在戰鬥中隱藏物品按鈕" L["SHOW_REPUTATION"] = "顯示聲望" L["SHOW_REPUTATION_HELP"] = "顯示軍團的聲望站在工具提示信譽標記項目。激活/取消激活需要遊戲客戶端重新加載。" L["SKIP_EXALTED"] = "跳過崇高" L["SKIP_EXALTED_HELP"] = "已經崇高的時候不要使用軍團聲望代幣。" L["SKIP_MAXPOWER"] = "Skip artifact" L["SKIP_MAXPOWER_HELP"] = "Skip artifact power tokens when artifact have maximum traits." L["Number of buttons placed in one row"] = "放置在一行的按鈕數" L["Spacing"] = "間距" L["Space between buttons"] = "按鈕之間的距離" L["Sticky"] = "黏附" L["Anchor to Item button"] = "定位到物品按鈕" L["Direction"] = "方向" L["Expand bar to"] = "條的擴展方向" L["Up"] = "上" L["Down"] = "下" L["Left"] = "左" L["Right"] = "右" L["Add new row"] = "增加新行" L["Above or below last one"] = "最後一個以上或以下" L["Hot-Key"] = "熱鍵" L["Key to use for automatic key binding."] = "用於自動綁定按鍵的熱鍵。" L["Quest"] = "任務" L["Quest not found for this item."] = "找不到此物品的任務。" L["Items cache update run |cFF00FF00%d."] = "物品快取更新執行|cFF00FF00%d。" L["Spells cache update run |cFF00FF00%d."] = "法術快取更新執行|cFF00FF00%d。" L["TOGO_ANNOUNCE"] = "%s:%d完成 還剩%d!" L["REWARD_ANNOUNCE"] = "%s的巔峰聲望獎勵已就緒!" L["SHIPYARD_ANNOUNCE"] = "船塢還有%d/%d艘船!" L["ARTIFACT_ANNOUNCE"] = "%s有%d特長已就緒!" L["ARCHAELOGY_ANNOUNCE"] = "考古學 %s已就緒!" L["TALENT_ANNOUNCE"] = "%s 已就緒!" L["RESTARTED_LOOKUP"] = "臨時黑名單已清除,重新開始建立!" L["CONSOLE_USAGE"] = [=[ [reset|skin|lock|clear|list|unlist|skip|glow|zone|quest|show] reset - 將會重置物品位置到螢幕中間 skin - 將會切換按鈕皮膚 lock - 將會鎖定/解鎖按鈕 clear - 將會重置永遠黑名單 list - 列出永遠黑名單物品 unlist - 根據物品ID從黑名單移除單獨物品 skip - 切換右鍵點擊略過臨時或是直到重新記錄 glow - 切換按鈕在區域時物品發亮 zone - 切換物品區域限制 quest - 開關任務條 show - 空按鈕可見]=];
-- xed-init.lua local ffi = require("ffi") ffi.cdef[[ void xed_tables_init(); ]] local xedlib = ffi.load("xed.dll") local exports = { xedlib = xedlib; } -- This must be called once before using the library xedlib.xed_tables_init(); return exports;
measure = {"\(^\circ\)", "'", "''"} numb = {} index = {} for i = 1,3 do index[i] = math.random(4) - 1 if (index[i] > 0) then index[i] = 1 end end if (index[1] == 0 and index[2] == 0) then index[1] = 1 end numb[1] = index[1] * math.random(180) value = numb[1] for i = 2,3 do numb[i] = index[i] * math.random(59) value = value * 60 + numb[i] end answ = "" for i = 1,3 do if (numb[i] ~= 0) then answ = answ .. " " .. tostring(numb[i]) .. measure[i] end end
project "Lapack" kind "None" zpm.export(function() if zpm.configuration( "lapack-version" ) == "MKL" then zpm.uses "Zefiros-Software/MKL" end end)
-- Copyright (c) 2020-2021 shadmansaleh -- MIT license, see LICENSE for more details. -- stylua: ignore local colors = { color3 = '#2c3043', color6 = '#a1aab8', color7 = '#82aaff', color8 = '#ae81ff', color0 = '#092236', color1 = '#ff5874', color2 = '#c3ccdc', } return { replace = { a = { fg = colors.color0, bg = colors.color1, gui = 'bold' }, b = { fg = colors.color2, bg = colors.color3 }, }, inactive = { a = { fg = colors.color6, bg = colors.color3, gui = 'bold' }, b = { fg = colors.color6, bg = colors.color3 }, c = { fg = colors.color6, bg = colors.color3 }, }, normal = { a = { fg = colors.color0, bg = colors.color7, gui = 'bold' }, b = { fg = colors.color2, bg = colors.color3 }, c = { fg = colors.color2, bg = colors.color3 }, }, visual = { a = { fg = colors.color0, bg = colors.color8, gui = 'bold' }, b = { fg = colors.color2, bg = colors.color3 }, }, insert = { a = { fg = colors.color0, bg = colors.color2, gui = 'bold' }, b = { fg = colors.color2, bg = colors.color3 }, }, }
--- === plugins.core.streamdeck.manager === --- --- Elgato Stream Deck Manager Plugin. local require = require local log = require "hs.logger".new "streamDeck" local application = require "hs.application" local appWatcher = require "hs.application.watcher" local canvas = require "hs.canvas" local image = require "hs.image" local streamdeck = require "hs.streamdeck" local dialog = require "cp.dialog" local i18n = require "cp.i18n" local tools = require "cp.tools" local config = require "cp.config" local json = require "cp.json" local displayNotification = dialog.displayNotification local imageFromPath = image.imageFromPath local imageFromURL = image.imageFromURL local spairs = tools.spairs local mod = {} -- defaultLayoutPath -> string -- Variable -- Default Layout Path local defaultLayoutPath = config.basePath .. "/plugins/core/streamdeck/default/Default.cpStreamDeck" --- plugins.core.streamdeck.manager.defaultLayout -> table --- Variable --- Default Stream Deck Layout mod.defaultLayout = json.read(defaultLayoutPath) --- plugins.core.streamdeck.manager.activeBanks <cp.prop: table> --- Field --- Table of active banks for each application. mod.activeBanks = config.prop("streamDeck.activeBanks", { ["Mini"] = {}, ["Original"] = {}, ["XL"] = {}, }) -- plugins.core.streamdeck.manager.devices -> table -- Variable -- Table of Stream Deck Devices. mod.devices = { ["Mini"] = {}, ["Original"] = {}, ["XL"] = {}, } -- plugins.core.streamdeck.manager.deviceOrder -> table -- Variable -- Table of Stream Deck Device Orders. mod.deviceOrder = { ["Mini"] = {}, ["Original"] = {}, ["XL"] = {}, } -- plugins.core.streamdeck.manager.numberOfButtons -> table -- Variable -- Table of Stream Deck Device Button Count. mod.numberOfButtons = { ["Mini"] = 6, ["Original"] = 15, ["XL"] = 32, } --- plugins.core.streamdeck.manager.items <cp.prop: table> --- Field --- Contains all the saved Stream Deck Buttons mod.items = json.prop(config.userConfigRootPath, "Stream Deck", "Default v2.cpStreamDeck", mod.defaultLayout) -- imageHolder -> hs.canvas -- Constant -- Canvas used to store the blackIcon. local imageHolder = canvas.new{x = 0, y = 0, h = 100, w = 100} imageHolder[1] = { frame = { h = 100, w = 100, x = 0, y = 0 }, fillColor = { hex = "#000000" }, type = "rectangle", } -- blackIcon -> hs.image -- Constant -- A black icon local blackIcon = imageHolder:imageFromCanvas() --- plugins.core.streamdeck.manager.getDeviceType(object) -> string --- Function --- Translates a Stream Deck button layout into a device type string. --- --- Parameters: --- * object - A `hs.streamdeck` object --- --- Returns: --- * "Mini", "Original" or "XL" function mod.getDeviceType(object) -------------------------------------------------------------------------------- -- Detect Device Type: -------------------------------------------------------------------------------- local columns, rows = object:buttonLayout() if columns == 3 and rows == 2 then return "Mini" elseif columns == 5 and rows == 3 then return "Original" elseif columns == 8 and rows == 4 then return "XL" else log.ef("Unknown Stream Deck Model. Columns: %s, Rows: %s", columns, rows) end end --- plugins.core.streamdeck.manager.buttonCallback(object, buttonID, pressed) -> none --- Function --- Stream Deck Button Callback --- --- Parameters: --- * object - The `hs.streamdeck` userdata object --- * buttonID - A number containing the button that was pressed/released --- * pressed - A boolean indicating whether the button was pressed (`true`) or released (`false`) --- --- Returns: --- * None function mod.buttonCallback(object, buttonID, pressed) if pressed then local serialNumber = object:serialNumber() local deviceType = mod.getDeviceType(object) local deviceID = mod.deviceOrder[deviceType][serialNumber] local frontmostApplication = application.frontmostApplication() local bundleID = frontmostApplication:bundleID() local activeBanks = mod.activeBanks() local bankID = activeBanks and activeBanks[deviceType] and activeBanks[deviceType][deviceID] and activeBanks[deviceType][deviceID][bundleID] or "1" -------------------------------------------------------------------------------- -- Get layout from preferences file: -------------------------------------------------------------------------------- local items = mod.items() local deviceData = items[deviceType] and items[deviceType][deviceID] -------------------------------------------------------------------------------- -- Revert to "All Applications" if no settings for frontmost app exist: -------------------------------------------------------------------------------- if deviceData and not deviceData[bundleID] then bundleID = "All Applications" end -------------------------------------------------------------------------------- -- Ignore if ignored: -------------------------------------------------------------------------------- local ignoreData = items[deviceType] and items[deviceType]["1"] and items[deviceType]["1"][bundleID] if ignoreData and ignoreData.ignore and ignoreData.ignore == true then bundleID = "All Applications" end buttonID = tostring(buttonID) if items[deviceType] and items[deviceType][deviceID] and items[deviceType][deviceID][bundleID] and items[deviceType][deviceID][bundleID][bankID] and items[deviceType][deviceID][bundleID][bankID][buttonID] then local handlerID = items[deviceType][deviceID][bundleID][bankID][buttonID]["handlerID"] local action = items[deviceType][deviceID][bundleID][bankID][buttonID]["action"] if handlerID and action then local handler = mod._actionmanager.getHandler(handlerID) handler:execute(action) end end end end --- plugins.core.streamdeck.manager.update() -> none --- Function --- Updates the screens of all Stream Deck devices. --- --- Parameters: --- * None --- --- Returns: --- * None function mod.update() for deviceType, devices in pairs(mod.devices) do for _, device in pairs(devices) do -------------------------------------------------------------------------------- -- Determine bundleID: -------------------------------------------------------------------------------- local serialNumber = device:serialNumber() local buttonCount = mod.numberOfButtons[deviceType] local deviceID = mod.deviceOrder[deviceType][serialNumber] local frontmostApplication = application.frontmostApplication() local bundleID = frontmostApplication:bundleID() -------------------------------------------------------------------------------- -- Get layout from preferences file: -------------------------------------------------------------------------------- local items = mod.items() local deviceData = items[deviceType] and items[deviceType][deviceID] -------------------------------------------------------------------------------- -- Revert to "All Applications" if no settings for frontmost app exist: -------------------------------------------------------------------------------- if deviceData and not deviceData[bundleID] then bundleID = "All Applications" end -------------------------------------------------------------------------------- -- Ignore if ignored: -------------------------------------------------------------------------------- local ignoreData = items[deviceType] and items[deviceType]["1"] and items[deviceType]["1"][bundleID] if ignoreData and ignoreData.ignore and ignoreData.ignore == true then bundleID = "All Applications" end -------------------------------------------------------------------------------- -- Determine bankID: -------------------------------------------------------------------------------- local activeBanks = mod.activeBanks() local bankID = activeBanks and activeBanks[deviceType] and activeBanks[deviceType][deviceID] and activeBanks[deviceType][deviceID][bundleID] or "1" -------------------------------------------------------------------------------- -- Get bank data: -------------------------------------------------------------------------------- local bankData = deviceData and deviceData[bundleID] and deviceData[bundleID][bankID] -------------------------------------------------------------------------------- -- Update every button: -------------------------------------------------------------------------------- for buttonID=1, buttonCount do local success = false local buttonData = bankData and bankData[tostring(buttonID)] if buttonData then local label = buttonData["label"] local icon = buttonData["icon"] if icon then -------------------------------------------------------------------------------- -- Draw an icon: -------------------------------------------------------------------------------- icon = imageFromURL(icon) device:setButtonImage(buttonID, icon) success = true elseif label then -------------------------------------------------------------------------------- -- Draw a label: -------------------------------------------------------------------------------- local c = canvas.new{x = 0, y = 0, h = 100, w = 100} c[1] = { frame = { h = 100, w = 100, x = 0, y = 0 }, fillColor = { hex = "#000000" }, type = "rectangle", } c[2] = { frame = { h = 100, w = 100, x = 0, y = 0 }, text = label, textAlignment = "left", textColor = { white = 1.0 }, textSize = 20, type = "text", } local textIcon = c:imageFromCanvas() device:setButtonImage(buttonID, textIcon) success = true end end if not success then -------------------------------------------------------------------------------- -- Default to black if no label or icon supplied: -------------------------------------------------------------------------------- device:setButtonImage(buttonID, blackIcon) end end end end end --- plugins.core.streamdeck.manager.discoveryCallback(connected, object) -> none --- Function --- Stream Deck Discovery Callback --- --- Parameters: --- * connected - A boolean, `true` if a device was connected, `false` if a device was disconnected --- * object - An `hs.streamdeck` object, being the device that was connected/disconnected --- --- Returns: --- * None function mod.discoveryCallback(connected, object) local serialNumber = object:serialNumber() if serialNumber == nil then log.ef("Failed to get Stream Deck's Serial Number. This normally means the Stream Deck App is running.") else local deviceType = mod.getDeviceType(object) if connected then --log.df("Stream Deck Connected: %s - %s", deviceType, serialNumber) mod.devices[deviceType][serialNumber] = object:buttonCallback(mod.buttonCallback) -------------------------------------------------------------------------------- -- Sort the devices alphabetically based on serial number: -------------------------------------------------------------------------------- local count = 1 for sn, _ in spairs(mod.devices[deviceType], function(_,a,b) return a < b end) do mod.deviceOrder[deviceType][sn] = tostring(count) count = count + 1 end mod.update() else if mod.devices and mod.devices[deviceType][serialNumber] then --log.df("Stream Deck Disconnected: %s - %s", deviceType, serialNumber) mod.devices[deviceType][serialNumber] = nil else log.ef("Disconnected Stream Deck wasn't previously registered: %s - %s", deviceType, serialNumber) end end end end --- plugins.core.streamdeck.manager.start() -> boolean --- Function --- Starts the Stream Deck Plugin --- --- Parameters: --- * None --- --- Returns: --- * None function mod.start() -------------------------------------------------------------------------------- -- Setup watch to refresh the Stream Deck's when apps change focus: -------------------------------------------------------------------------------- mod._appWatcher = appWatcher.new(function(_, event) if event == appWatcher.activated then mod.update() end end):start() -------------------------------------------------------------------------------- -- Initialise Stream Deck support: -------------------------------------------------------------------------------- streamdeck.init(mod.discoveryCallback) end --- plugins.core.streamdeck.manager.start() -> boolean --- Function --- Stops the Stream Deck Plugin --- --- Parameters: --- * None --- --- Returns: --- * None function mod.stop() -------------------------------------------------------------------------------- -- Kill any devices: -------------------------------------------------------------------------------- for deviceType, devices in pairs(mod.devices) do for serialNumber, _ in pairs(devices) do mod.devices[deviceType][serialNumber] = nil end end -------------------------------------------------------------------------------- -- Kill the app watcher: -------------------------------------------------------------------------------- if mod._appWatcher then mod._appWatcher:stop() mod._appWatcher = nil end end --- plugins.core.streamdeck.manager.enabled <cp.prop: boolean> --- Field --- Enable or disable Stream Deck Support. mod.enabled = config.prop("enableStreamDesk", false):watch(function(enabled) if enabled then mod.start() else mod.stop() end end) local plugin = { id = "core.streamdeck.manager", group = "core", required = true, dependencies = { ["core.action.manager"] = "actionmanager", ["core.commands.global"] = "global", ["core.application.manager"] = "appmanager", ["core.controlsurfaces.manager"] = "csman", } } function plugin.init(deps, env) local icon = imageFromPath(env:pathToAbsolute("/../prefs/images/streamdeck.icns")) mod._actionmanager = deps.actionmanager -------------------------------------------------------------------------------- -- Setup action: -------------------------------------------------------------------------------- local global = deps.global global :add("cpStreamDeck") :whenActivated(function() mod.enabled:toggle() end) :groupedBy("commandPost") :image(icon) -------------------------------------------------------------------------------- -- Setup Bank Actions: -------------------------------------------------------------------------------- local actionmanager = deps.actionmanager local numberOfBanks = deps.csman.NUMBER_OF_BANKS local numberOfDevices = deps.csman.NUMBER_OF_DEVICES actionmanager.addHandler("global_streamDeckbanks") :onChoices(function(choices) for device, _ in pairs(mod.devices) do for unit=1, numberOfDevices do local deviceLabel = device if deviceLabel == "Original" then deviceLabel = "" else deviceLabel = deviceLabel .. " " end for bank=1, numberOfBanks do choices:add("Stream Deck " .. deviceLabel .. i18n("bank") .. " " .. tostring(bank) .. " (Unit " .. unit .. ")") :subText(i18n("streamDeckBankDescription")) :params({ action = "bank", device = device, unit = tostring(unit), bank = bank, id = device .. "_" .. unit .. "_" .. tostring(bank), }) :id(device .. "_" .. unit .. "_" .. tostring(bank)) :image(icon) end choices :add(i18n("next") .. " Stream Deck " .. deviceLabel .. i18n("bank") .. " (Unit " .. unit .. ")") :subText(i18n("streamDeckBankDescription")) :params({ action = "next", device = device, unit = tostring(unit), id = device .. "_" .. unit .. "_nextBank" }) :id(device .. "_" .. unit .. "_nextBank") :image(icon) choices :add(i18n("previous") .. " Stream Deck " .. deviceLabel .. i18n("bank") .. " (Unit " .. unit .. ")") :subText(i18n("streamDeckBankDescription")) :params({ action = "previous", device = device, unit = tostring(unit), id = device .. "_" .. unit .. "_previousBank", }) :id(device .. "_" .. unit .. "_previousBank") :image(icon) end end return choices end) :onExecute(function(result) if result then local device = result.device local unit = result.unit local frontmostApplication = application.frontmostApplication() local bundleID = frontmostApplication:bundleID() local items = mod.items() local unitData = items[device] and items[device]["1"] -- The ignore preference is stored on unit 1. -------------------------------------------------------------------------------- -- Revert to "All Applications" if no settings for frontmost app exist: -------------------------------------------------------------------------------- if unitData and not unitData[bundleID] then bundleID = "All Applications" end -------------------------------------------------------------------------------- -- Ignore if ignored: -------------------------------------------------------------------------------- local ignoreData = items[device] and items[device]["1"] and items[device]["1"][bundleID] if ignoreData and ignoreData.ignore and ignoreData.ignore == true then bundleID = "All Applications" end local activeBanks = mod.activeBanks() if not activeBanks[device] then activeBanks[device] = {} end if not activeBanks[device][unit] then activeBanks[device][unit] = {} end local currentBank = activeBanks and activeBanks[device] and activeBanks[device][unit] and activeBanks[device][unit][bundleID] or "1" if result.action == "bank" then activeBanks[device][unit][bundleID] = tostring(result.bank) elseif result.action == "next" then if tonumber(currentBank) == numberOfBanks then activeBanks[device][unit][bundleID] = "1" else activeBanks[device][unit][bundleID] = tostring(tonumber(currentBank) + 1) end elseif result.action == "previous" then if tonumber(currentBank) == 1 then activeBanks[device][unit][bundleID] = tostring(numberOfBanks) else activeBanks[device][unit][bundleID] = tostring(tonumber(currentBank) - 1) end end local newBank = activeBanks[device][unit][bundleID] mod.activeBanks(activeBanks) mod.update() items = mod.items() -- Reload items local label = items[bundleID] and items[bundleID][newBank] and items[bundleID][newBank]["bankLabel"] or newBank local deviceLabel = device if deviceLabel == "Original" then deviceLabel = "" else deviceLabel = deviceLabel .. " " end displayNotification("Stream Deck " .. deviceLabel .. "(Unit " .. unit .. ") " .. i18n("bank") .. ": " .. label) end end) :onActionId(function(action) return "streamDeckBank" .. action.id end) return mod end function plugin.postInit() if mod.enabled() then mod.start() end end return plugin
util.AddNetworkString("StockMenu_Open"); util.AddNetworkString("NewStockDataReceived"); util.AddNetworkString("Player_ShareActions"); util.AddNetworkString("ChatMsg_CL"); stockdata = {}; local function ChatMsgCL(ply, msg) net.Start("ChatMsg_CL"); net.WriteString(msg); net.Send(ply); end //this reloads the layout of the menu if it's open. local function UpdateLayoutCL() net.Start("NewStockDataReceived"); net.WriteTable(stockdata); net.Broadcast(); end //this however reloads the clients networked shares. local function ReloadShares_CL(ply) local shares = ply.Shares or {}; for k,v in pairs(shares) do ply:SetNWInt("Share_"..k, v); end end local function PricePerStock(symb) local li = stockdata["query"]["results"]["quote"]; //client table for k,v in pairs(li) do if (v["Symbol"] == symb) then return v["LastTradePriceOnly"]; end end return 0; end //local url = stock.Host.."?q=select * from yahoo.finance.stocks where symbol='"..stock.Stocklist.."'&format=json" local url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20('"..stock.Stocklist.."')&env=http://datatables.org/alltables.env&format=json" hook.Add("Initialize", "PrintStockData", function() print("Stock - About to pull stock info from Yahoo Finance!"); http.Fetch( url, function( body, len, headers, code ) if (body) then stockdata = util.JSONToTable(body); end end, function( error ) print(error) end ); timer.Create("UpdateStockInfo", stock.StockPullInterval, 0, function() print("Stock - About to pull stock info from Yahoo Finance!"); http.Fetch( url, function( body, len, headers, code ) if (body) then stockdata = util.JSONToTable(body); UpdateLayoutCL(); end end, function( error ) print(error) end ); end) end) hook.Add("PlayerSay", "OpenStockMenu", function(ply, text) if (text == stock.ChatCommand) then net.Start("StockMenu_Open"); net.WriteTable(stockdata); net.Send(ply); end end) hook.Add("PlayerSpawn", "LoadShares", function(ply) local shares = {}; local fil = file.Read("stocks/shares_"..ply:UniqueID()..".txt", "DATA"); if (fil) then local tbl = util.JSONToTable(fil); ply.Shares = tbl; ReloadShares_CL(ply); else for k,v in pairs(stock.RealNameList) do shares[k] = 0; ply.Shares = shares; end ReloadShares_CL(ply); end end) local function SaveShares(caller) local shares = caller.Shares or {}; local shares = util.TableToJSON(shares); if (!file.IsDir("stocks", "DATA")) then file.CreateDir("stocks"); end local fil = file.Write("stocks/shares_"..caller:UniqueID()..".txt", shares); if (fil) then ChatMsgCL(caller, "Shares saved!"); end end local function BuyShare(num, sto, caller) if (!num or !sto) then ChatMsgCL(caller, "No number or stock supplied!"); return; end local num = tonumber(num); if (!num) then ChatMsgCL(caller, "Improper number of shares sent to the server! Was there a non-numerical character in yours?"); return; end local sto = table.KeyFromValue(stock.RealNameList, sto); local cur_shares = caller:GetShares(sto); if (cur_shares == stock.SharesPerStock) then ChatMsgCL(caller, "You have the max amount of shares for this stock allowed!"); return; end if (cur_shares + num > stock.SharesPerStock) then num = stock.SharesPerStock - cur_shares; end //will be too many; just give them enough until they reach max, not go over. local pps = PricePerStock(sto); local price = num * pps; if (!caller:canAfford(price)) then ChatMsgCL(caller, "You can't afford this many stocks! Make sure you view the preview price on the GUI!"); return; end caller:addMoney(price * -1); caller:SetNWInt("Share_"..sto, cur_shares + num); caller.Shares[sto] = cur_shares + num; ChatMsgCL(caller, "Thanks for your purchase of "..num.." shares!"); SaveShares(caller); end local function SellShare(num, sto, caller) if (!num or !sto) then ChatMsgCL(caller, "No number or stock supplied!"); return; end local num = tonumber(num); if (!num) then ChatMsgCL(caller, "Improper number of shares sent to the server! Was there a non-numerical character in yours?"); return; end local sto = table.KeyFromValue(stock.RealNameList, sto); local cur_shares = caller:GetShares(sto); if (cur_shares == 0) then ChatMsgCL(caller, "You don't own any shares! Therefore you can't sell any!"); return; end if (cur_shares - num < 0) then local dif = num - cur_shares; //get how many are left over num = num - dif; end //will be too many; just give them enough until they reach max, not go over. local pps = PricePerStock(sto); local price = num * pps; caller:addMoney(price); caller:SetNWInt("Share_"..sto, cur_shares - num); caller.Shares[sto] = cur_shares - num; ChatMsgCL(caller, "You have made "..price.." from "..num.." shares!"); SaveShares(caller); end net.Receive("Player_ShareActions", function(len, caller) local num = net.ReadString(); local stock = net.ReadString(); local act = net.ReadString(); if (act == "Buy") then BuyShare(num, stock, caller); else SellShare(num, stock, caller); end end) hook.Add("PlayerDisconnect", "SaveShares", function(ply) SaveShares(ply); end)
--[[ EntranceJew made this. https://github.com/EntranceJew/hooker Edited by VideahGams to fit the engines needs ]] --- The hook library allows scripts to interact with game or user created events. It allows you to "hook" a function onto an event created with -- hook.run or hook.call and run code when that events happens that either works independently or modifies the event's arguments. This is the -- preferred method instead of overriding functions to add your own code into it. local hook = { hookTable = {}, hookIter = pairs -- override this if you want globally deterministic hook iteration } -- this is where we store our hooks and the things that latch on to them like greedy little hellions local function pack(...) return {n = select('#', ...), ...} end --- Add a hook to be called when an event occurs. -- @param eventName Name of event to hook. -- @param identifier Unique identifier, allowing you to replace or remove hooks. -- @param func Function to be called, along with arguments. function hook.add( eventName, identifier, func ) --string, any, function if hook.hookTable[eventName]==nil then hook.hookTable[eventName] = {} end hook.hookTable[eventName][identifier] = func end --- Calls all hooks associated with the event name. -- @param eventName The event to call hooks for. -- @param args Arguments to be passed to hooks. -- @return Data from called hooks. function hook.call( eventName, ... ) --string, varargs if hook.hookTable[eventName]==nil then -- skip processing the hook because nobody's listening return nil else local results for identifier,func in hook.hookIter(hook.hookTable[eventName]) do results = pack(func(...)) results.n = nil if #results>0 then -- potential problems if relying on sandwiching a nil in the return results return unpack(results) end end end end --- Returns a table containing all hooks. -- @return table: Hooks function hook.getTable() return hook.hookTable end --- Removes a hook from given event name, using the hooks unique identifier. -- @param eventName Event to remove hook from. -- @param identifier Unique identifier of hook to be removed. -- @return boolean: If removal was successful. function hook.remove( eventName, identifier ) --[[string, string]] if hook.hookTable[eventName]==nil or hook.hookTable[eventName][identifier]==nil then return false else hook.hookTable[eventName][identifier] = nil end -- see if the table is empty and nil it for the benefit of hook.Call's optimization for k,v in pairs(hook.hookTable[eventName]) do -- we found something, exit the function return true end -- if we reach this far then the table must've been empty hook.hookTable[eventName] = nil return true end return hook
--- A module designed to show multiple sprites or UI elements at once. --- @classmod scene local scheduler = require "scheduler" local camera = require "camera" local parser = parser --Circular dependencies! local sprite = require "sprite" local font = love.graphics.getFont() local fontHeight = font:getHeight() local visibleText = {} local i = 1 local defaultPaddingX, defaultPaddingY = 20, 10 local lastYOffset = 0 --- The internal function used by printText to write to the screen. --- @tparam string text The text to write to the screen. --- @tparam number paddingX How many pixels from the left/right side should be left by the text. --- @tparam number paddingY How many pixels from the top/bottom side should be left by the text. --- @tparam number i Which row the text should be on (1-however many fit on the screen) --- @tparam table|nil color (Optional) What color the text should be. Defaults to white. local function printText2(text, paddingX, paddingY, i, color) assert(type(text) == "string", ("String expected, got %s."):format(type(text))) assert(type(paddingX) == "number", ("Number expected, got %s."):format(type(paddingX))) assert(type(paddingY) == "number", ("Number expected, got %s."):format(type(paddingY))) assert(type(i) == "number", ("Number expected, got %s."):format(type(i))) assert(color == nil or type(color) == "table", ("Table or nil expected, got %s."):format(type(color))) if type(color) == "table" then assert(#color == 3 or #color == 4, ("Color must be of length 3 or 4, was length %d."):format(#color)) end local localYOffset = (i - 1) * (fontHeight + paddingY) + paddingY local yOffset = 0 if localYOffset > love.graphics.getHeight() then yOffset = love.graphics.getHeight() - localYOffset - fontHeight - paddingY end local textDrawable = love.graphics.newText(font, text) if color then textDrawable:addf({ color, text }, love.graphics.getWidth() - 2 * paddingX, "left", 0, 0) end textDrawable:setFont(font) local textSprite = sprite { x = paddingX, y = localYOffset, w = textDrawable:getWidth(), h = textDrawable:getHeight(), group = "GUI", image = textDrawable, visible = true } visibleText[#visibleText + 1] = textSprite return yOffset end local scene = { scenes = {}, currentScenes = {} } --- Print the given text on the screen, moving the camera down when the text gets off screen. --- Make reset true to move the text back to the top of the screen. --- @param _ unused --- @tparam string text The text to print on screen --- @tparam boolean|nil reset (Optional) If true, will reset the text back to the top of the screen. --- @tparam table|nil color (Optional) The color to make the text. White by default. --- @return nil function scene.printText(_, text, reset, color) local yOffset assert(color == nil or type(color) == "table", ("Color must be nil or a table, was a %s."):format(type(color))) if type(color) == "table" then assert(#color == 3 or #color == 4, ("Color must be of length 3 or 4, had length %d."):format(#color)) end if reset then i = 0 yOffset = 0 end yOffset = printText2(text, defaultPaddingX, defaultPaddingY, i, color) if yOffset ~= lastYOffset then camera.inst:pan(camera.inst.x, camera.inst.y + yOffset - lastYOffset, 0) lastYOffset = yOffset end i = i + 1 end --- Clears all visible text from printText. --- @return nil function scene.clearText() for _, v in pairs(visibleText) do v.visible = false --Make the sprites invisible so they disappear before garbage collection. end visibleText = {} --Release all of the references to the sprites, causing them to get collected. end --- Creates a new scene. --- @tparam string name the name of the new scene --- @return nil function scene:new(name) name = name == nil and self or name assert(type(name) == "string", ("String expected, got %s."):format(type(name))) scene.scenes[name] = scene.scenes[name] or { class = scene, name = name } return setmetatable(scene.scenes[name], { __index = scene.scenes[name].class }) end --- Sets a value to the given scene. --- @tparam string sceneName The name of the scene to set the sprite to. --- @tparam string spriteName The name of the sprite within the scene. --- @tparam any value The value to insert into the scene. --- @return nil function scene:set(sceneName, spriteName, value) if not sprite then sceneName, spriteName, value = self, sceneName, spriteName end sceneName = type(sceneName) == "table" and sceneName.name or sceneName assert(type(sceneName) == "string", ("Name expected, got %s."):format(type(sceneName))) assert(type(spriteName) == "string", ("spriteName expected, got %s."):format(type(spriteName))) if not scene.scenes[sceneName] then scene:new(sceneName) end scene.scenes[sceneName][spriteName] = value end --- Clears the scene with the given name, or self if called with a scene. --- @tparam string|nil sceneName (Optional) The name of the scene, if a reference to the scene is not available. --- @return nil function scene:clear(sceneName) sceneName = sceneName or self.name assert(sceneName, "Expected scene or scene name, got nil.") local thisScene = scene.scenes[sceneName] assert(thisScene, ("No scene with name %s found."):format(sceneName)) if thisScene.onClear then thisScene:onClear(scene) end for k, v in pairs(thisScene) do if type(v) == "table" and k ~= "class" then v.visible = false end end for i = 1, #scene.currentScenes do if scene.currentScenes[i] == thisScene then table.remove(scene.currentScenes, i) break end end end --- Shows the scene with the given name, or self if called with a scene. --- @tparam string sceneName The name of the scene, if a reference to the scene is not available. --- @return nil function scene.show(sceneName) assert(type(sceneName) == "string" or type(sceneName) == "table", ("String or table expected, got %s"):format(type(sceneName))) sceneName = type(sceneName) == "string" and sceneName or sceneName.name scene.currentScenes[#scene.currentScenes + 1] = type(sceneName) == "string" and scene.scenes[sceneName] or sceneName local foundScene = false for i = 1, #scene.currentScenes do local currentScene = scene.scenes[scene.currentScenes[i].name] print(scene.currentScenes[i].name) if currentScene.onShow then currentScene:onShow(scene) end for k, v in pairs(currentScene) do if type(v) == "table" and k ~= "class" then foundScene = true v.visible = true end end end assert(foundScene, ("No scene with name %s found."):format(sceneName)) end --- Returns the scene with the given name, or errors if there is not one. --- @tparam string sceneName The name of the scene. --- @return table The scene with the given name. function scene.get(sceneName) assert(type(sceneName) == "string", ("String expected, got %s."):format(type(sceneName))) assert(scene.scenes[sceneName], ("No scene found with name %s."):format(sceneName)) return scene.scenes[sceneName] end --- Switches scenes by running scene.clearAll() and showing the given scene(s). --- @tparam string sceneName The name of the first scene to show. function scene.switch(sceneName, ...) assert(sceneName, "Name or scene expected, got nil.") if not sceneName then sceneName = self end scene.clearAll() scene.show(sceneName) local scenes = { ... } for i = 1, #scenes do scene.show(scenes[i]) end end --- Clears all scenes. --- @return nil function scene.clearAll() for _, scene in pairs(scene.currentScenes) do scene:clear() end end --- Returns which scenes are visible. --- @treturn table which scenes are visible. function scene.visible() return scene.currentScenes end --- Returns if self is visible. --- @treturn boolean If self is visible. function scene:isVisible() assert(self, "What are you trying to check the visibility of?") assert(self.name, "Self has no name.") assert(scene.scenes[self.name], ("No scene by the name %s exists."):format(self.name)) for k, v in pairs(scene.scenes[self.name]) do assert(v, ("Scene %s contains no elements!"):format(self.name)) if type(v) == "table" then return v.visible end end end --- Loads the scene file at the given location. --- @tparam string sceneName The path to the scene. --- @return nil function scene:load(sceneName) if not sceneName then sceneName = self end assert(sceneName, "Cannot load scene without a name.") self = scene if not self.scenes[sceneName] then local sceneTbl = dofile("scenes/" .. sceneName .. ".scene") assert(sceneTbl, ("Could not load scene %s at scenes/%s.scene. Is the file malformed?"):format(sceneName, sceneName)) local newScene = self:new(sceneName) for k = #sceneTbl, 1, -1 do local item = sceneTbl[k] if type(item) == "table" then local itemName = item.name local itemConstructor = item.type item.name = nil item.visible = false local itemSprite = itemConstructor(item) item.name = itemName newScene:set(sceneName, itemName, itemSprite) end end for k, v in pairs(sceneTbl) do if not tonumber(k) or k < 0 or k > #sceneTbl then newScene[k] = v end end if sceneTbl.init then sceneTbl:init(scene) newScene.init = sceneTbl.init end newScene.name = sceneName self.scenes[sceneName] = newScene end return self.scenes[sceneName] end --- Fades out the game using a vignette over seconds, then clears all scenes. --- @tparam number seconds How many seconds it should take to fade out. --- @tparam function fct A callback to run when it's done. --- @return nil function scene.circularFadeOut(seconds, fct) assert(type(seconds) == "number", ("Number expected, got %s."):format(type(seconds))) assert(type(fct) == "function" or not fct, ("Function or nil expected, got %s."):format(type(fct))) scheduler.before(seconds, function(timePassed) effects.vignette:set("opacity", timePassed / seconds) effects.vignette:set("softness", timePassed / seconds) effects.vignette:set("radius", 1 - timePassed / seconds) end) scheduler.after(seconds, function() scene.clearAll() effects.vignette:set("radius", .25) effects.vignette:set("opacity", 0) effects.vignette:set("softness", .45) if type(fct) == "function" then fct() end end) end --- Fades in the game using a vignette over seconds. --- @tparam number seconds How many seconds it should take to fade in. --- @tparam function fct A callback to run when it's done. --- @return nil function scene.circularFadeIn(seconds, fct) assert(type(seconds) == "number", ("Number expected, got %s."):format(type(seconds))) assert(type(fct) == "function" or not fct, ("Function or nil expected, got %s."):format(type(fct))) scheduler.before(seconds, function(timePassed) effects.vignette:set("opacity", 1 - timePassed / seconds) effects.vignette:set("softness", 1 - timePassed / seconds) effects.vignette:set("radius", timePassed / seconds) end) scheduler.after(seconds, function() parser.unlock() effects.vignette:set("radius", .25) effects.vignette:set("opacity", 0) effects.vignette:set("softness", .45) if type(fct) == "function" then fct() end end) end --- Fades out the game over seconds, then clears all scenes. --- @tparam number seconds How many seconds it should take to fade out. --- @tparam function fct A callback to run when it's done. --- @return nil function scene.fadeOut(seconds, fct) assert(type(seconds) == "number", ("Number expected, got %s."):format(type(seconds))) assert(type(fct) == "function" or not fct, ("Function or nil expected, got %s."):format(type(fct))) effects.vignette:set("radius", 0) scheduler.before(seconds, function(timePassed) effects.vignette:set("opacity", timePassed / seconds) end) scheduler.after(seconds, function() scene.clearAll() effects.vignette:set("radius", .25) effects.vignette:set("opacity", 0) effects.vignette:set("softness", .45) if type(fct) == "function" then fct() end end) end --- Fades in the game over seconds. --- @tparam number seconds How many seconds it should take to fade in. --- @tparam function fct A callback to run when it's done. --- @return nil function scene.fadeIn(seconds, fct) assert(type(seconds) == "number", ("Number expected, got %s."):format(type(seconds))) assert(type(fct) == "function" or not fct, ("Function or nil expected, got %s."):format(type(fct))) scheduler.before(seconds, function(timePassed) effects.vignette:set("opacity", 1 - timePassed / seconds) end) scheduler.after(seconds, function() effects.vignette:set("radius", .25) effects.vignette:set("opacity", 0) effects.vignette:set("softness", .45) if type(fct) == "function" then fct() end end) end return scene
return { -- "System.Globalization.Native", "System.IO.Compression.Native", -- "System.IO.Ports.Native", -- "System.Native", -- "System.Net.Security.Native", -- "System.Security.Cryptography.Native.OpenSsl" }
local SwapTest = {} local SwapCardCtr = import(".SwapCardCtr") --所有牌 local allCard = { 0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D, 0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D, 0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D, 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D, } --主函数 function SwapTest:main( ... ) --创建场景 local scene = cc.Scene:create() self.scene = scene --获取桌子场景 local creatorReader = creator.CreatorReader:createWithFilename('creator/Scene/SilvaZhang/swap/SwapTableScene.ccreator'); creatorReader:setup(); local swapScene = creatorReader:getNodeGraph(); scene:addChild(swapScene) local Canvas = swapScene:getChildByName("Canvas") local tableBg = Canvas:getChildByName("tableBg") --发牌按钮 self.startBtn = tableBg:getChildByName("startBtn") self:initView() self:createStarBtn() self:bindEventListener() return scene end function SwapTest:bindEventListener() local function callback( event ) local data = event._usedata if data.ready then self.startBtn:setVisible(true) end end local listener1 = cc.EventListenerCustom:create("ready",callback) local eventDispatcher = cc.Director:getInstance():getEventDispatcher(); eventDispatcher:addEventListenerWithFixedPriority(listener1, 1) end --创建模块 function SwapTest:initView( ) --创建CardLayerCtr,将view加入场景中 local swapCardCtr = SwapCardCtr:create() local cardLayerView = swapCardCtr:getView() self.scene:addChild(cardLayerView) end --修改按钮 function SwapTest:createStarBtn( ) local callback = function(tag) local tempCards= clone(allCard) local initData = { cardByteList = { [1] = {}, [2] = {}, [3] = {}, } } --发牌随机 local row = 1 for i = 1,13 do local cardNum = #tempCards local index = math.random(1, cardNum) local tempCard = tempCards[index] table.remove(tempCards, index) if i == 4 or i == 9 then row = row + 1 end table.insert(initData.cardByteList[row],tempCard) end --发送换牌消息 if initData.cardByteList then local myEvent=cc.EventCustom:new("initCard") myEvent.initData = initData local customEventDispatch=cc.Director:getInstance():getEventDispatcher() customEventDispatch:dispatchEvent(myEvent) end tag:setVisible(false) end self.startBtn:addClickEventListener(callback) end return handler(SwapTest, SwapTest.main)
local OVALE, Ovale = ... local OvaleScripts = Ovale.OvaleScripts do local name = "icyveins_deathknight_blood" local desc = "[7.0] Icy-Veins: DeathKnight Blood" local code = [[ Include(ovale_common) Include(ovale_trinkets_mop) Include(ovale_trinkets_wod) Include(ovale_deathknight_spells) AddCheckBox(opt_interrupt L(interrupt) default specialization=blood) AddCheckBox(opt_melee_range L(not_in_melee_range) specialization=blood) AddCheckBox(opt_legendary_ring_tank ItemName(legendary_ring_bonus_armor) default specialization=blood) AddFunction BloodDefaultShortCDActions { if CheckBoxOn(opt_melee_range) and not target.InRange(death_strike) Texture(misc_arrowlup help=L(not_in_melee_range)) if not BuffPresent(rune_tap_buff) Spell(rune_tap) if Rune() <= 2 Spell(blood_tap) } AddFunction BloodDefaultMainActions { BloodHealMe() if InCombat() and BuffExpires(bone_shield_buff 3) Spell(marrowrend) if not Talent(soulgorge_talent) and target.DebuffRefreshable(blood_plague_debuff) Spell(blood_boil) if target.DebuffRefreshable(blood_plague_debuff) Spell(deaths_caress) if not BuffPresent(death_and_decay_buff) and BuffPresent(crimson_scourge_buff) and Talent(rapid_decomposition_talent) Spell(death_and_decay) if RunicPower() >= 100 and target.TimeToDie() >= 10 Spell(bonestorm) if RunicPowerDeficit() <= 20 Spell(death_strike) if BuffStacks(bone_shield_buff) <= 2+4*Talent(ossuary_talent) Spell(marrowrend) if not BuffPresent(death_and_decay_buff) and Rune() >= 3 and Talent(rapid_decomposition_talent) Spell(death_and_decay) if not target.DebuffPresent(mark_of_blood_debuff) Spell(mark_of_blood) if Rune() >= 3 or RunicPower() < 45 Spell(heart_strike) Spell(consumption) Spell(blood_boil) } AddFunction BloodDefaultAoEActions { BloodHealMe() if RunicPower() >= 100 Spell(bonestorm) if InCombat() and BuffExpires(bone_shield_buff 3) Spell(marrowrend) if not Talent(soulgorge_talent) and DebuffCountOnAny(blood_plague_debuff) < Enemies(tagged=1) Spell(blood_boil) if not BuffPresent(death_and_decay_buff) and BuffPresent(crimson_scourge_buff) Spell(death_and_decay) if RunicPowerDeficit() <= 20 Spell(death_strike) if BuffStacks(bone_shield_buff) <= 2+4*Talent(ossuary_talent) Spell(marrowrend) if not BuffPresent(death_and_decay_buff) and Enemies() >= 3 Spell(death_and_decay) if not target.DebuffPresent(mark_of_blood_debuff) Spell(mark_of_blood) if Rune() >= 3 or RunicPower() < 45 Spell(heart_strike) Spell(consumption) Spell(blood_boil) if target.DebuffRefreshable(blood_plague_debuff) Spell(deaths_caress) } AddFunction BloodHealMe { if HealthPercent() <= 70 Spell(death_strike) if (DamageTaken(5) * 0.2) > (Health() / 100 * 25) Spell(death_strike) if (BuffStacks(bone_shield_buff) * 3) > (100 - HealthPercent()) Spell(tombstone) if HealthPercent() <= 70 Spell(consumption) } AddFunction BloodDefaultCdActions { BloodInterruptActions() if IncomingDamage(1.5 magic=1) > 0 spell(antimagic_shell) if CheckBoxOn(opt_legendary_ring_tank) Item(legendary_ring_bonus_armor usable=1) Item(Trinket0Slot usable=1 text=13) Item(Trinket1Slot usable=1 text=14) Spell(vampiric_blood) if target.InRange(blood_mirror) Spell(blood_mirror) Spell(dancing_rune_weapon) if BuffStacks(bone_shield_buff) >= 5 Spell(tombstone) Item(unbending_potion usable=1) } AddFunction BloodInterruptActions { if CheckBoxOn(opt_interrupt) and not target.IsFriend() and target.IsInterruptible() { if target.InRange(mind_freeze) Spell(mind_freeze) if not target.Classification(worldboss) { if target.InRange(asphyxiate) Spell(asphyxiate) Spell(arcane_torrent_runicpower) if target.InRange(quaking_palm) Spell(quaking_palm) Spell(war_stomp) } } } AddCheckBox(opt_deathknight_blood_aoe L(AOE) default specialization=blood) AddIcon help=shortcd specialization=blood { BloodDefaultShortCDActions() } AddIcon enemies=1 help=main specialization=blood { BloodDefaultMainActions() } AddIcon checkbox=opt_deathknight_blood_aoe help=aoe specialization=blood { BloodDefaultAoEActions() } AddIcon help=cd specialization=blood { #if not InCombat() ProtectionPrecombatCdActions() BloodDefaultCdActions() } ]] OvaleScripts:RegisterScript("DEATHKNIGHT", "blood", name, desc, code, "script") end -- THE REST OF THIS FILE IS AUTOMATICALLY GENERATED. -- ANY CHANGES MADE BELOW THIS POINT WILL BE LOST. do local name = "simulationcraft_death_knight_frost_t19p" local desc = "[7.0] SimulationCraft: Death_Knight_Frost_T19P" local code = [[ # Based on SimulationCraft profile "Death_Knight_Frost_T19P". # class=deathknight # spec=frost # talents=3320032 Include(ovale_common) Include(ovale_trinkets_mop) Include(ovale_trinkets_wod) Include(ovale_deathknight_spells) AddCheckBox(opt_interrupt L(interrupt) default specialization=frost) AddCheckBox(opt_melee_range L(not_in_melee_range) specialization=frost) AddCheckBox(opt_use_consumables L(opt_use_consumables) default specialization=frost) AddCheckBox(opt_legendary_ring_strength ItemName(legendary_ring_strength) default specialization=frost) AddFunction FrostInterruptActions { if CheckBoxOn(opt_interrupt) and not target.IsFriend() and target.Casting() { if target.InRange(mind_freeze) and target.IsInterruptible() Spell(mind_freeze) if target.Distance(less 8) and target.IsInterruptible() Spell(arcane_torrent_runicpower) if target.Distance(less 5) and not target.Classification(worldboss) Spell(war_stomp) } } AddFunction FrostUseItemActions { Item(Trinket0Slot text=13 usable=1) Item(Trinket1Slot text=14 usable=1) } AddFunction FrostGetInMeleeRange { if CheckBoxOn(opt_melee_range) and not target.InRange(death_strike) Texture(misc_arrowlup help=L(not_in_melee_range)) } ### actions.default AddFunction FrostDefaultMainActions { #obliteration,if=(!talent.frozen_pulse.enabled|(rune<2&runic_power<28))&!talent.gathering_storm.enabled if { not Talent(frozen_pulse_talent) or Rune() < 2 and RunicPower() < 28 } and not Talent(gathering_storm_talent) Spell(obliteration) #call_action_list,name=generic,if=!talent.breath_of_sindragosa.enabled&!(talent.gathering_storm.enabled&buff.remorseless_winter.remains) if not Talent(breath_of_sindragosa_talent) and not { Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) } FrostGenericMainActions() unless not Talent(breath_of_sindragosa_talent) and not { Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) } and FrostGenericMainPostConditions() { #call_action_list,name=bos,if=talent.breath_of_sindragosa.enabled&!dot.breath_of_sindragosa.ticking if Talent(breath_of_sindragosa_talent) and not BuffPresent(breath_of_sindragosa_buff) FrostBosMainActions() unless Talent(breath_of_sindragosa_talent) and not BuffPresent(breath_of_sindragosa_buff) and FrostBosMainPostConditions() { #call_action_list,name=bos_ticking,if=talent.breath_of_sindragosa.enabled&dot.breath_of_sindragosa.ticking if Talent(breath_of_sindragosa_talent) and BuffPresent(breath_of_sindragosa_buff) FrostBosTickingMainActions() unless Talent(breath_of_sindragosa_talent) and BuffPresent(breath_of_sindragosa_buff) and FrostBosTickingMainPostConditions() { #call_action_list,name=gs_ticking,if=talent.gathering_storm.enabled&buff.remorseless_winter.remains&!talent.breath_of_sindragosa.enabled if Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) and not Talent(breath_of_sindragosa_talent) FrostGsTickingMainActions() } } } } AddFunction FrostDefaultMainPostConditions { not Talent(breath_of_sindragosa_talent) and not { Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) } and FrostGenericMainPostConditions() or Talent(breath_of_sindragosa_talent) and not BuffPresent(breath_of_sindragosa_buff) and FrostBosMainPostConditions() or Talent(breath_of_sindragosa_talent) and BuffPresent(breath_of_sindragosa_buff) and FrostBosTickingMainPostConditions() or Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) and not Talent(breath_of_sindragosa_talent) and FrostGsTickingMainPostConditions() } AddFunction FrostDefaultShortCdActions { #auto_attack FrostGetInMeleeRange() #pillar_of_frost,if=!equipped.140806|!talent.breath_of_sindragosa.enabled if not HasEquippedItem(140806) or not Talent(breath_of_sindragosa_talent) Spell(pillar_of_frost) #pillar_of_frost,if=equipped.140806&talent.breath_of_sindragosa.enabled&((runic_power>=50&cooldown.hungering_rune_weapon.remains<10)|(cooldown.breath_of_sindragosa.remains>20)) if HasEquippedItem(140806) and Talent(breath_of_sindragosa_talent) and { RunicPower() >= 50 and SpellCooldown(hungering_rune_weapon) < 10 or SpellCooldown(breath_of_sindragosa) > 20 } Spell(pillar_of_frost) #call_action_list,name=generic,if=!talent.breath_of_sindragosa.enabled&!(talent.gathering_storm.enabled&buff.remorseless_winter.remains) if not Talent(breath_of_sindragosa_talent) and not { Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) } FrostGenericShortCdActions() unless not Talent(breath_of_sindragosa_talent) and not { Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) } and FrostGenericShortCdPostConditions() { #call_action_list,name=bos,if=talent.breath_of_sindragosa.enabled&!dot.breath_of_sindragosa.ticking if Talent(breath_of_sindragosa_talent) and not BuffPresent(breath_of_sindragosa_buff) FrostBosShortCdActions() unless Talent(breath_of_sindragosa_talent) and not BuffPresent(breath_of_sindragosa_buff) and FrostBosShortCdPostConditions() { #call_action_list,name=bos_ticking,if=talent.breath_of_sindragosa.enabled&dot.breath_of_sindragosa.ticking if Talent(breath_of_sindragosa_talent) and BuffPresent(breath_of_sindragosa_buff) FrostBosTickingShortCdActions() unless Talent(breath_of_sindragosa_talent) and BuffPresent(breath_of_sindragosa_buff) and FrostBosTickingShortCdPostConditions() { #call_action_list,name=gs_ticking,if=talent.gathering_storm.enabled&buff.remorseless_winter.remains&!talent.breath_of_sindragosa.enabled if Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) and not Talent(breath_of_sindragosa_talent) FrostGsTickingShortCdActions() } } } } AddFunction FrostDefaultShortCdPostConditions { not Talent(breath_of_sindragosa_talent) and not { Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) } and FrostGenericShortCdPostConditions() or Talent(breath_of_sindragosa_talent) and not BuffPresent(breath_of_sindragosa_buff) and FrostBosShortCdPostConditions() or Talent(breath_of_sindragosa_talent) and BuffPresent(breath_of_sindragosa_buff) and FrostBosTickingShortCdPostConditions() or Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) and not Talent(breath_of_sindragosa_talent) and FrostGsTickingShortCdPostConditions() } AddFunction FrostDefaultCdActions { #mind_freeze FrostInterruptActions() #arcane_torrent,if=runic_power.deficit>20 if RunicPowerDeficit() > 20 Spell(arcane_torrent_runicpower) #blood_fury,if=buff.pillar_of_frost.up if BuffPresent(pillar_of_frost_buff) Spell(blood_fury_ap) #berserking,if=buff.pillar_of_frost.up if BuffPresent(pillar_of_frost_buff) Spell(berserking) #use_item,slot=finger2 if CheckBoxOn(opt_legendary_ring_strength) Item(legendary_ring_strength usable=1) #use_item,slot=trinket1 FrostUseItemActions() #potion,name=prolonged_power,if=buff.pillar_of_frost.up&(!talent.breath_of_sindragosa.enabled|!cooldown.breath_of_sindragosa.remains) if BuffPresent(pillar_of_frost_buff) and { not Talent(breath_of_sindragosa_talent) or not SpellCooldown(breath_of_sindragosa) > 0 } and CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(prolonged_power_potion usable=1) #sindragosas_fury,if=buff.pillar_of_frost.up&(buff.unholy_strength.up|(buff.pillar_of_frost.remains<3&target.time_to_die<60))&debuff.razorice.stack=5&!buff.obliteration.up if BuffPresent(pillar_of_frost_buff) and { BuffPresent(unholy_strength_buff) or BuffRemaining(pillar_of_frost_buff) < 3 and target.TimeToDie() < 60 } and target.DebuffStacks(razorice_debuff) == 5 and not BuffPresent(obliteration_buff) Spell(sindragosas_fury) #call_action_list,name=generic,if=!talent.breath_of_sindragosa.enabled&!(talent.gathering_storm.enabled&buff.remorseless_winter.remains) if not Talent(breath_of_sindragosa_talent) and not { Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) } FrostGenericCdActions() unless not Talent(breath_of_sindragosa_talent) and not { Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) } and FrostGenericCdPostConditions() { #call_action_list,name=bos,if=talent.breath_of_sindragosa.enabled&!dot.breath_of_sindragosa.ticking if Talent(breath_of_sindragosa_talent) and not BuffPresent(breath_of_sindragosa_buff) FrostBosCdActions() unless Talent(breath_of_sindragosa_talent) and not BuffPresent(breath_of_sindragosa_buff) and FrostBosCdPostConditions() { #call_action_list,name=bos_ticking,if=talent.breath_of_sindragosa.enabled&dot.breath_of_sindragosa.ticking if Talent(breath_of_sindragosa_talent) and BuffPresent(breath_of_sindragosa_buff) FrostBosTickingCdActions() unless Talent(breath_of_sindragosa_talent) and BuffPresent(breath_of_sindragosa_buff) and FrostBosTickingCdPostConditions() { #call_action_list,name=gs_ticking,if=talent.gathering_storm.enabled&buff.remorseless_winter.remains&!talent.breath_of_sindragosa.enabled if Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) and not Talent(breath_of_sindragosa_talent) FrostGsTickingCdActions() } } } } AddFunction FrostDefaultCdPostConditions { not Talent(breath_of_sindragosa_talent) and not { Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) } and FrostGenericCdPostConditions() or Talent(breath_of_sindragosa_talent) and not BuffPresent(breath_of_sindragosa_buff) and FrostBosCdPostConditions() or Talent(breath_of_sindragosa_talent) and BuffPresent(breath_of_sindragosa_buff) and FrostBosTickingCdPostConditions() or Talent(gathering_storm_talent) and BuffPresent(remorseless_winter_buff) and not Talent(breath_of_sindragosa_talent) and FrostGsTickingCdPostConditions() } ### actions.bos AddFunction FrostBosMainActions { #frost_strike,if=talent.icy_talons.enabled&buff.icy_talons.remains<1.5&cooldown.breath_of_sindragosa.remains>6 if Talent(icy_talons_talent) and BuffRemaining(icy_talons_buff) < 1.5 and SpellCooldown(breath_of_sindragosa) > 6 Spell(frost_strike) #remorseless_winter,if=talent.gathering_storm.enabled if Talent(gathering_storm_talent) Spell(remorseless_winter) #howling_blast,target_if=!dot.frost_fever.ticking if not target.DebuffPresent(frost_fever_debuff) Spell(howling_blast) #frost_strike,if=runic_power>=90&set_bonus.tier19_4pc if RunicPower() >= 90 and ArmorSetBonus(T19 4) Spell(frost_strike) #remorseless_winter,if=buff.rime.react&equipped.132459 if BuffPresent(rime_buff) and HasEquippedItem(132459) Spell(remorseless_winter) #howling_blast,if=buff.rime.react&(dot.remorseless_winter.ticking|cooldown.remorseless_winter.remains>1.5|!equipped.132459) if BuffPresent(rime_buff) and { target.DebuffPresent(remorseless_winter_debuff) or SpellCooldown(remorseless_winter) > 1.5 or not HasEquippedItem(132459) } Spell(howling_blast) #obliterate,if=!buff.rime.react&!(talent.gathering_storm.enabled&!(cooldown.remorseless_winter.remains>2|rune>4))&rune>3 if not BuffPresent(rime_buff) and not { Talent(gathering_storm_talent) and not { SpellCooldown(remorseless_winter) > 2 or Rune() >= 5 } } and Rune() >= 4 Spell(obliterate) #frost_strike,if=runic_power>=70|((talent.gathering_storm.enabled&cooldown.remorseless_winter.remains<3&cooldown.breath_of_sindragosa.remains>10)&rune<5) if RunicPower() >= 70 or Talent(gathering_storm_talent) and SpellCooldown(remorseless_winter) < 3 and SpellCooldown(breath_of_sindragosa) > 10 and Rune() < 5 Spell(frost_strike) #obliterate,if=!buff.rime.react&!(talent.gathering_storm.enabled&!(cooldown.remorseless_winter.remains>2|rune>4)) if not BuffPresent(rime_buff) and not { Talent(gathering_storm_talent) and not { SpellCooldown(remorseless_winter) > 2 or Rune() >= 5 } } Spell(obliterate) #horn_of_winter,if=cooldown.breath_of_sindragosa.remains>15&runic_power<=70&rune<4 if SpellCooldown(breath_of_sindragosa) > 15 and RunicPower() <= 70 and Rune() < 4 Spell(horn_of_winter) #frost_strike,if=cooldown.breath_of_sindragosa.remains>15 if SpellCooldown(breath_of_sindragosa) > 15 Spell(frost_strike) #remorseless_winter,if=cooldown.breath_of_sindragosa.remains>10 if SpellCooldown(breath_of_sindragosa) > 10 Spell(remorseless_winter) } AddFunction FrostBosMainPostConditions { } AddFunction FrostBosShortCdActions { } AddFunction FrostBosShortCdPostConditions { Talent(icy_talons_talent) and BuffRemaining(icy_talons_buff) < 1.5 and SpellCooldown(breath_of_sindragosa) > 6 and Spell(frost_strike) or Talent(gathering_storm_talent) and Spell(remorseless_winter) or not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or RunicPower() >= 90 and ArmorSetBonus(T19 4) and Spell(frost_strike) or BuffPresent(rime_buff) and HasEquippedItem(132459) and Spell(remorseless_winter) or BuffPresent(rime_buff) and { target.DebuffPresent(remorseless_winter_debuff) or SpellCooldown(remorseless_winter) > 1.5 or not HasEquippedItem(132459) } and Spell(howling_blast) or not BuffPresent(rime_buff) and not { Talent(gathering_storm_talent) and not { SpellCooldown(remorseless_winter) > 2 or Rune() >= 5 } } and Rune() >= 4 and Spell(obliterate) or { RunicPower() >= 70 or Talent(gathering_storm_talent) and SpellCooldown(remorseless_winter) < 3 and SpellCooldown(breath_of_sindragosa) > 10 and Rune() < 5 } and Spell(frost_strike) or not BuffPresent(rime_buff) and not { Talent(gathering_storm_talent) and not { SpellCooldown(remorseless_winter) > 2 or Rune() >= 5 } } and Spell(obliterate) or SpellCooldown(breath_of_sindragosa) > 15 and RunicPower() <= 70 and Rune() < 4 and Spell(horn_of_winter) or SpellCooldown(breath_of_sindragosa) > 15 and Spell(frost_strike) or SpellCooldown(breath_of_sindragosa) > 10 and Spell(remorseless_winter) } AddFunction FrostBosCdActions { unless Talent(icy_talons_talent) and BuffRemaining(icy_talons_buff) < 1.5 and SpellCooldown(breath_of_sindragosa) > 6 and Spell(frost_strike) or Talent(gathering_storm_talent) and Spell(remorseless_winter) or not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) { #breath_of_sindragosa,if=runic_power>=50&(!equipped.140806|cooldown.hungering_rune_weapon.remains<10) if RunicPower() >= 50 and { not HasEquippedItem(140806) or SpellCooldown(hungering_rune_weapon) < 10 } Spell(breath_of_sindragosa) } } AddFunction FrostBosCdPostConditions { Talent(icy_talons_talent) and BuffRemaining(icy_talons_buff) < 1.5 and SpellCooldown(breath_of_sindragosa) > 6 and Spell(frost_strike) or Talent(gathering_storm_talent) and Spell(remorseless_winter) or not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or RunicPower() >= 90 and ArmorSetBonus(T19 4) and Spell(frost_strike) or BuffPresent(rime_buff) and HasEquippedItem(132459) and Spell(remorseless_winter) or BuffPresent(rime_buff) and { target.DebuffPresent(remorseless_winter_debuff) or SpellCooldown(remorseless_winter) > 1.5 or not HasEquippedItem(132459) } and Spell(howling_blast) or not BuffPresent(rime_buff) and not { Talent(gathering_storm_talent) and not { SpellCooldown(remorseless_winter) > 2 or Rune() >= 5 } } and Rune() >= 4 and Spell(obliterate) or { RunicPower() >= 70 or Talent(gathering_storm_talent) and SpellCooldown(remorseless_winter) < 3 and SpellCooldown(breath_of_sindragosa) > 10 and Rune() < 5 } and Spell(frost_strike) or not BuffPresent(rime_buff) and not { Talent(gathering_storm_talent) and not { SpellCooldown(remorseless_winter) > 2 or Rune() >= 5 } } and Spell(obliterate) or SpellCooldown(breath_of_sindragosa) > 15 and RunicPower() <= 70 and Rune() < 4 and Spell(horn_of_winter) or SpellCooldown(breath_of_sindragosa) > 15 and Spell(frost_strike) or SpellCooldown(breath_of_sindragosa) > 10 and Spell(remorseless_winter) } ### actions.bos_ticking AddFunction FrostBosTickingMainActions { #howling_blast,target_if=!dot.frost_fever.ticking if not target.DebuffPresent(frost_fever_debuff) Spell(howling_blast) #remorseless_winter,if=runic_power>=30&((buff.rime.react&equipped.132459)|(talent.gathering_storm.enabled&(dot.remorseless_winter.remains<=gcd|!dot.remorseless_winter.ticking))) if RunicPower() >= 30 and { BuffPresent(rime_buff) and HasEquippedItem(132459) or Talent(gathering_storm_talent) and { target.DebuffRemaining(remorseless_winter_debuff) <= GCD() or not target.DebuffPresent(remorseless_winter_debuff) } } Spell(remorseless_winter) #howling_blast,if=((runic_power>=20&set_bonus.tier19_4pc)|runic_power>=30)&buff.rime.react if { RunicPower() >= 20 and ArmorSetBonus(T19 4) or RunicPower() >= 30 } and BuffPresent(rime_buff) Spell(howling_blast) #obliterate,if=runic_power<=75|rune>3 if RunicPower() <= 75 or Rune() >= 4 Spell(obliterate) #horn_of_winter,if=runic_power<70&!buff.hungering_rune_weapon.up&rune<5 if RunicPower() < 70 and not BuffPresent(hungering_rune_weapon_buff) and Rune() < 5 Spell(horn_of_winter) #remorseless_winter,if=talent.gathering_storm.enabled|!set_bonus.tier19_4pc|runic_power<30 if Talent(gathering_storm_talent) or not ArmorSetBonus(T19 4) or RunicPower() < 30 Spell(remorseless_winter) } AddFunction FrostBosTickingMainPostConditions { } AddFunction FrostBosTickingShortCdActions { } AddFunction FrostBosTickingShortCdPostConditions { not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or RunicPower() >= 30 and { BuffPresent(rime_buff) and HasEquippedItem(132459) or Talent(gathering_storm_talent) and { target.DebuffRemaining(remorseless_winter_debuff) <= GCD() or not target.DebuffPresent(remorseless_winter_debuff) } } and Spell(remorseless_winter) or { RunicPower() >= 20 and ArmorSetBonus(T19 4) or RunicPower() >= 30 } and BuffPresent(rime_buff) and Spell(howling_blast) or { RunicPower() <= 75 or Rune() >= 4 } and Spell(obliterate) or RunicPower() < 70 and not BuffPresent(hungering_rune_weapon_buff) and Rune() < 5 and Spell(horn_of_winter) or { Talent(gathering_storm_talent) or not ArmorSetBonus(T19 4) or RunicPower() < 30 } and Spell(remorseless_winter) } AddFunction FrostBosTickingCdActions { unless not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or RunicPower() >= 30 and { BuffPresent(rime_buff) and HasEquippedItem(132459) or Talent(gathering_storm_talent) and { target.DebuffRemaining(remorseless_winter_debuff) <= GCD() or not target.DebuffPresent(remorseless_winter_debuff) } } and Spell(remorseless_winter) or { RunicPower() >= 20 and ArmorSetBonus(T19 4) or RunicPower() >= 30 } and BuffPresent(rime_buff) and Spell(howling_blast) or { RunicPower() <= 75 or Rune() >= 4 } and Spell(obliterate) or RunicPower() < 70 and not BuffPresent(hungering_rune_weapon_buff) and Rune() < 5 and Spell(horn_of_winter) { #hungering_rune_weapon,if=equipped.140806&(runic_power<30|(runic_power<70&talent.gathering_storm.enabled))&!buff.hungering_rune_weapon.up&rune<2 if HasEquippedItem(140806) and { RunicPower() < 30 or RunicPower() < 70 and Talent(gathering_storm_talent) } and not BuffPresent(hungering_rune_weapon_buff) and Rune() < 2 Spell(hungering_rune_weapon) #hungering_rune_weapon,if=talent.runic_attenuation.enabled&runic_power<30&!buff.hungering_rune_weapon.up&rune<2 if Talent(runic_attenuation_talent) and RunicPower() < 30 and not BuffPresent(hungering_rune_weapon_buff) and Rune() < 2 Spell(hungering_rune_weapon) #hungering_rune_weapon,if=runic_power<35&!buff.hungering_rune_weapon.up&rune<2 if RunicPower() < 35 and not BuffPresent(hungering_rune_weapon_buff) and Rune() < 2 Spell(hungering_rune_weapon) #hungering_rune_weapon,if=runic_power<25&!buff.hungering_rune_weapon.up&rune<1 if RunicPower() < 25 and not BuffPresent(hungering_rune_weapon_buff) and Rune() < 1 Spell(hungering_rune_weapon) #empower_rune_weapon,if=runic_power<20 if RunicPower() < 20 Spell(empower_rune_weapon) } } AddFunction FrostBosTickingCdPostConditions { not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or RunicPower() >= 30 and { BuffPresent(rime_buff) and HasEquippedItem(132459) or Talent(gathering_storm_talent) and { target.DebuffRemaining(remorseless_winter_debuff) <= GCD() or not target.DebuffPresent(remorseless_winter_debuff) } } and Spell(remorseless_winter) or { RunicPower() >= 20 and ArmorSetBonus(T19 4) or RunicPower() >= 30 } and BuffPresent(rime_buff) and Spell(howling_blast) or { RunicPower() <= 75 or Rune() >= 4 } and Spell(obliterate) or RunicPower() < 70 and not BuffPresent(hungering_rune_weapon_buff) and Rune() < 5 and Spell(horn_of_winter) or { Talent(gathering_storm_talent) or not ArmorSetBonus(T19 4) or RunicPower() < 30 } and Spell(remorseless_winter) } ### actions.generic AddFunction FrostGenericMainActions { #frost_strike,if=!talent.shattering_strikes.enabled&(buff.icy_talons.remains<1.5&talent.icy_talons.enabled) if not Talent(shattering_strikes_talent) and BuffRemaining(icy_talons_buff) < 1.5 and Talent(icy_talons_talent) Spell(frost_strike) #frost_strike,if=talent.shattering_strikes.enabled&debuff.razorice.stack=5 if Talent(shattering_strikes_talent) and target.DebuffStacks(razorice_debuff) == 5 Spell(frost_strike) #howling_blast,target_if=!dot.frost_fever.ticking if not target.DebuffPresent(frost_fever_debuff) Spell(howling_blast) #remorseless_winter,if=(buff.rime.react&equipped.132459&!(buff.obliteration.up&spell_targets.howling_blast<2))|talent.gathering_storm.enabled if BuffPresent(rime_buff) and HasEquippedItem(132459) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } or Talent(gathering_storm_talent) Spell(remorseless_winter) #howling_blast,if=buff.rime.react&!(buff.obliteration.up&spell_targets.howling_blast<2)&!(equipped.132459&talent.gathering_storm.enabled) if BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and not { HasEquippedItem(132459) and Talent(gathering_storm_talent) } Spell(howling_blast) #howling_blast,if=buff.rime.react&!(buff.obliteration.up&spell_targets.howling_blast<2)&equipped.132459&talent.gathering_storm.enabled&(debuff.perseverance_of_the_ebon_martyr.up|cooldown.remorseless_winter.remains>3) if BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and HasEquippedItem(132459) and Talent(gathering_storm_talent) and { target.DebuffPresent(perseverance_of_the_ebon_martyr_debuff) or SpellCooldown(remorseless_winter) > 3 } Spell(howling_blast) #obliterate,if=!buff.obliteration.up&(equipped.132366&talent.frozen_pulse.enabled&(set_bonus.tier19_2pc=1|set_bonus.tier19_4pc=1)) if not BuffPresent(obliteration_buff) and HasEquippedItem(132366) and Talent(frozen_pulse_talent) and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } Spell(obliterate) #frost_strike,if=runic_power.deficit<=10 if RunicPowerDeficit() <= 10 Spell(frost_strike) #frost_strike,if=buff.obliteration.up&!buff.killing_machine.react if BuffPresent(obliteration_buff) and not BuffPresent(killing_machine_buff) Spell(frost_strike) #remorseless_winter,if=spell_targets.remorseless_winter>=2&!(talent.frostscythe.enabled&buff.killing_machine.react&spell_targets.frostscythe>=2) if Enemies() >= 2 and not { Talent(frostscythe_talent) and BuffPresent(killing_machine_buff) and Enemies() >= 2 } Spell(remorseless_winter) #frostscythe,if=(buff.killing_machine.react&spell_targets.frostscythe>=2) if BuffPresent(killing_machine_buff) and Enemies() >= 2 Spell(frostscythe) #glacial_advance,if=spell_targets.glacial_advance>=2 if Enemies() >= 2 Spell(glacial_advance) #frostscythe,if=spell_targets.frostscythe>=3 if Enemies() >= 3 Spell(frostscythe) #obliterate,if=buff.killing_machine.react if BuffPresent(killing_machine_buff) Spell(obliterate) #frost_strike,if=talent.gathering_storm.enabled&talent.murderous_efficiency.enabled&(set_bonus.tier19_2pc=1|set_bonus.tier19_4pc=1) if Talent(gathering_storm_talent) and Talent(murderous_efficiency_talent) and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } Spell(frost_strike) #frost_strike,if=(talent.horn_of_winter.enabled|talent.hungering_rune_weapon.enabled)&(set_bonus.tier19_2pc=1|set_bonus.tier19_4pc=1) if { Talent(horn_of_winter_talent) or Talent(hungering_rune_weapon_talent) } and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } Spell(frost_strike) #obliterate Spell(obliterate) #glacial_advance Spell(glacial_advance) #horn_of_winter,if=!buff.hungering_rune_weapon.up if not BuffPresent(hungering_rune_weapon_buff) Spell(horn_of_winter) #frost_strike Spell(frost_strike) #remorseless_winter,if=talent.frozen_pulse.enabled if Talent(frozen_pulse_talent) Spell(remorseless_winter) } AddFunction FrostGenericMainPostConditions { } AddFunction FrostGenericShortCdActions { } AddFunction FrostGenericShortCdPostConditions { not Talent(shattering_strikes_talent) and BuffRemaining(icy_talons_buff) < 1.5 and Talent(icy_talons_talent) and Spell(frost_strike) or Talent(shattering_strikes_talent) and target.DebuffStacks(razorice_debuff) == 5 and Spell(frost_strike) or not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or { BuffPresent(rime_buff) and HasEquippedItem(132459) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } or Talent(gathering_storm_talent) } and Spell(remorseless_winter) or BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and not { HasEquippedItem(132459) and Talent(gathering_storm_talent) } and Spell(howling_blast) or BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and HasEquippedItem(132459) and Talent(gathering_storm_talent) and { target.DebuffPresent(perseverance_of_the_ebon_martyr_debuff) or SpellCooldown(remorseless_winter) > 3 } and Spell(howling_blast) or not BuffPresent(obliteration_buff) and HasEquippedItem(132366) and Talent(frozen_pulse_talent) and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } and Spell(obliterate) or RunicPowerDeficit() <= 10 and Spell(frost_strike) or BuffPresent(obliteration_buff) and not BuffPresent(killing_machine_buff) and Spell(frost_strike) or Enemies() >= 2 and not { Talent(frostscythe_talent) and BuffPresent(killing_machine_buff) and Enemies() >= 2 } and Spell(remorseless_winter) or BuffPresent(killing_machine_buff) and Enemies() >= 2 and Spell(frostscythe) or Enemies() >= 2 and Spell(glacial_advance) or Enemies() >= 3 and Spell(frostscythe) or BuffPresent(killing_machine_buff) and Spell(obliterate) or Talent(gathering_storm_talent) and Talent(murderous_efficiency_talent) and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } and Spell(frost_strike) or { Talent(horn_of_winter_talent) or Talent(hungering_rune_weapon_talent) } and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } and Spell(frost_strike) or Spell(obliterate) or Spell(glacial_advance) or not BuffPresent(hungering_rune_weapon_buff) and Spell(horn_of_winter) or Spell(frost_strike) or Talent(frozen_pulse_talent) and Spell(remorseless_winter) } AddFunction FrostGenericCdActions { unless not Talent(shattering_strikes_talent) and BuffRemaining(icy_talons_buff) < 1.5 and Talent(icy_talons_talent) and Spell(frost_strike) or Talent(shattering_strikes_talent) and target.DebuffStacks(razorice_debuff) == 5 and Spell(frost_strike) or not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or { BuffPresent(rime_buff) and HasEquippedItem(132459) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } or Talent(gathering_storm_talent) } and Spell(remorseless_winter) or BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and not { HasEquippedItem(132459) and Talent(gathering_storm_talent) } and Spell(howling_blast) or BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and HasEquippedItem(132459) and Talent(gathering_storm_talent) and { target.DebuffPresent(perseverance_of_the_ebon_martyr_debuff) or SpellCooldown(remorseless_winter) > 3 } and Spell(howling_blast) or not BuffPresent(obliteration_buff) and HasEquippedItem(132366) and Talent(frozen_pulse_talent) and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } and Spell(obliterate) or RunicPowerDeficit() <= 10 and Spell(frost_strike) or BuffPresent(obliteration_buff) and not BuffPresent(killing_machine_buff) and Spell(frost_strike) or Enemies() >= 2 and not { Talent(frostscythe_talent) and BuffPresent(killing_machine_buff) and Enemies() >= 2 } and Spell(remorseless_winter) or BuffPresent(killing_machine_buff) and Enemies() >= 2 and Spell(frostscythe) or Enemies() >= 2 and Spell(glacial_advance) or Enemies() >= 3 and Spell(frostscythe) or BuffPresent(killing_machine_buff) and Spell(obliterate) or Talent(gathering_storm_talent) and Talent(murderous_efficiency_talent) and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } and Spell(frost_strike) or { Talent(horn_of_winter_talent) or Talent(hungering_rune_weapon_talent) } and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } and Spell(frost_strike) or Spell(obliterate) or Spell(glacial_advance) or not BuffPresent(hungering_rune_weapon_buff) and Spell(horn_of_winter) or Spell(frost_strike) or Talent(frozen_pulse_talent) and Spell(remorseless_winter) { #empower_rune_weapon Spell(empower_rune_weapon) #hungering_rune_weapon,if=!buff.hungering_rune_weapon.up if not BuffPresent(hungering_rune_weapon_buff) Spell(hungering_rune_weapon) } } AddFunction FrostGenericCdPostConditions { not Talent(shattering_strikes_talent) and BuffRemaining(icy_talons_buff) < 1.5 and Talent(icy_talons_talent) and Spell(frost_strike) or Talent(shattering_strikes_talent) and target.DebuffStacks(razorice_debuff) == 5 and Spell(frost_strike) or not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or { BuffPresent(rime_buff) and HasEquippedItem(132459) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } or Talent(gathering_storm_talent) } and Spell(remorseless_winter) or BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and not { HasEquippedItem(132459) and Talent(gathering_storm_talent) } and Spell(howling_blast) or BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and HasEquippedItem(132459) and Talent(gathering_storm_talent) and { target.DebuffPresent(perseverance_of_the_ebon_martyr_debuff) or SpellCooldown(remorseless_winter) > 3 } and Spell(howling_blast) or not BuffPresent(obliteration_buff) and HasEquippedItem(132366) and Talent(frozen_pulse_talent) and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } and Spell(obliterate) or RunicPowerDeficit() <= 10 and Spell(frost_strike) or BuffPresent(obliteration_buff) and not BuffPresent(killing_machine_buff) and Spell(frost_strike) or Enemies() >= 2 and not { Talent(frostscythe_talent) and BuffPresent(killing_machine_buff) and Enemies() >= 2 } and Spell(remorseless_winter) or BuffPresent(killing_machine_buff) and Enemies() >= 2 and Spell(frostscythe) or Enemies() >= 2 and Spell(glacial_advance) or Enemies() >= 3 and Spell(frostscythe) or BuffPresent(killing_machine_buff) and Spell(obliterate) or Talent(gathering_storm_talent) and Talent(murderous_efficiency_talent) and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } and Spell(frost_strike) or { Talent(horn_of_winter_talent) or Talent(hungering_rune_weapon_talent) } and { ArmorSetBonus(T19 2) == 1 or ArmorSetBonus(T19 4) == 1 } and Spell(frost_strike) or Spell(obliterate) or Spell(glacial_advance) or not BuffPresent(hungering_rune_weapon_buff) and Spell(horn_of_winter) or Spell(frost_strike) or Talent(frozen_pulse_talent) and Spell(remorseless_winter) } ### actions.gs_ticking AddFunction FrostGsTickingMainActions { #frost_strike,if=buff.icy_talons.remains<1.5&talent.icy_talons.enabled if BuffRemaining(icy_talons_buff) < 1.5 and Talent(icy_talons_talent) Spell(frost_strike) #remorseless_winter Spell(remorseless_winter) #howling_blast,target_if=!dot.frost_fever.ticking if not target.DebuffPresent(frost_fever_debuff) Spell(howling_blast) #howling_blast,if=buff.rime.react&!(buff.obliteration.up&spell_targets.howling_blast<2) if BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } Spell(howling_blast) #obliteration,if=(!talent.frozen_pulse.enabled|(rune<2&runic_power<28)) if not Talent(frozen_pulse_talent) or Rune() < 2 and RunicPower() < 28 Spell(obliteration) #obliterate,if=rune>3|buff.killing_machine.react|buff.obliteration.up if Rune() >= 4 or BuffPresent(killing_machine_buff) or BuffPresent(obliteration_buff) Spell(obliterate) #frost_strike,if=runic_power>80|(buff.obliteration.up&!buff.killing_machine.react) if RunicPower() > 80 or BuffPresent(obliteration_buff) and not BuffPresent(killing_machine_buff) Spell(frost_strike) #obliterate Spell(obliterate) #horn_of_winter,if=runic_power<70&!buff.hungering_rune_weapon.up if RunicPower() < 70 and not BuffPresent(hungering_rune_weapon_buff) Spell(horn_of_winter) #glacial_advance Spell(glacial_advance) #frost_strike Spell(frost_strike) } AddFunction FrostGsTickingMainPostConditions { } AddFunction FrostGsTickingShortCdActions { } AddFunction FrostGsTickingShortCdPostConditions { BuffRemaining(icy_talons_buff) < 1.5 and Talent(icy_talons_talent) and Spell(frost_strike) or Spell(remorseless_winter) or not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and Spell(howling_blast) or { Rune() >= 4 or BuffPresent(killing_machine_buff) or BuffPresent(obliteration_buff) } and Spell(obliterate) or { RunicPower() > 80 or BuffPresent(obliteration_buff) and not BuffPresent(killing_machine_buff) } and Spell(frost_strike) or Spell(obliterate) or RunicPower() < 70 and not BuffPresent(hungering_rune_weapon_buff) and Spell(horn_of_winter) or Spell(glacial_advance) or Spell(frost_strike) } AddFunction FrostGsTickingCdActions { unless BuffRemaining(icy_talons_buff) < 1.5 and Talent(icy_talons_talent) and Spell(frost_strike) or Spell(remorseless_winter) or not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and Spell(howling_blast) or { Rune() >= 4 or BuffPresent(killing_machine_buff) or BuffPresent(obliteration_buff) } and Spell(obliterate) or { RunicPower() > 80 or BuffPresent(obliteration_buff) and not BuffPresent(killing_machine_buff) } and Spell(frost_strike) or Spell(obliterate) or RunicPower() < 70 and not BuffPresent(hungering_rune_weapon_buff) and Spell(horn_of_winter) or Spell(glacial_advance) or Spell(frost_strike) { #hungering_rune_weapon,if=!buff.hungering_rune_weapon.up if not BuffPresent(hungering_rune_weapon_buff) Spell(hungering_rune_weapon) #empower_rune_weapon Spell(empower_rune_weapon) } } AddFunction FrostGsTickingCdPostConditions { BuffRemaining(icy_talons_buff) < 1.5 and Talent(icy_talons_talent) and Spell(frost_strike) or Spell(remorseless_winter) or not target.DebuffPresent(frost_fever_debuff) and Spell(howling_blast) or BuffPresent(rime_buff) and not { BuffPresent(obliteration_buff) and Enemies() < 2 } and Spell(howling_blast) or { Rune() >= 4 or BuffPresent(killing_machine_buff) or BuffPresent(obliteration_buff) } and Spell(obliterate) or { RunicPower() > 80 or BuffPresent(obliteration_buff) and not BuffPresent(killing_machine_buff) } and Spell(frost_strike) or Spell(obliterate) or RunicPower() < 70 and not BuffPresent(hungering_rune_weapon_buff) and Spell(horn_of_winter) or Spell(glacial_advance) or Spell(frost_strike) } ### actions.precombat AddFunction FrostPrecombatMainActions { } AddFunction FrostPrecombatMainPostConditions { } AddFunction FrostPrecombatShortCdActions { } AddFunction FrostPrecombatShortCdPostConditions { } AddFunction FrostPrecombatCdActions { #flask,name=countless_armies #food,name=fishbrul_special #augmentation,name=defiled #snapshot_stats #potion,name=prolonged_power if CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(prolonged_power_potion usable=1) } AddFunction FrostPrecombatCdPostConditions { } ### Frost icons. AddCheckBox(opt_deathknight_frost_aoe L(AOE) default specialization=frost) AddIcon checkbox=!opt_deathknight_frost_aoe enemies=1 help=shortcd specialization=frost { if not InCombat() FrostPrecombatShortCdActions() unless not InCombat() and FrostPrecombatShortCdPostConditions() { FrostDefaultShortCdActions() } } AddIcon checkbox=opt_deathknight_frost_aoe help=shortcd specialization=frost { if not InCombat() FrostPrecombatShortCdActions() unless not InCombat() and FrostPrecombatShortCdPostConditions() { FrostDefaultShortCdActions() } } AddIcon enemies=1 help=main specialization=frost { if not InCombat() FrostPrecombatMainActions() unless not InCombat() and FrostPrecombatMainPostConditions() { FrostDefaultMainActions() } } AddIcon checkbox=opt_deathknight_frost_aoe help=aoe specialization=frost { if not InCombat() FrostPrecombatMainActions() unless not InCombat() and FrostPrecombatMainPostConditions() { FrostDefaultMainActions() } } AddIcon checkbox=!opt_deathknight_frost_aoe enemies=1 help=cd specialization=frost { if not InCombat() FrostPrecombatCdActions() unless not InCombat() and FrostPrecombatCdPostConditions() { FrostDefaultCdActions() } } AddIcon checkbox=opt_deathknight_frost_aoe help=cd specialization=frost { if not InCombat() FrostPrecombatCdActions() unless not InCombat() and FrostPrecombatCdPostConditions() { FrostDefaultCdActions() } } ### Required symbols # 132366 # 132459 # 140806 # arcane_torrent_runicpower # berserking # blood_fury_ap # breath_of_sindragosa # breath_of_sindragosa_buff # breath_of_sindragosa_talent # death_strike # empower_rune_weapon # frost_fever_debuff # frost_strike # frostscythe # frostscythe_talent # frozen_pulse_talent # gathering_storm_talent # glacial_advance # horn_of_winter # horn_of_winter_talent # howling_blast # hungering_rune_weapon # hungering_rune_weapon_buff # hungering_rune_weapon_talent # icy_talons_buff # icy_talons_talent # killing_machine_buff # legendary_ring_strength # mind_freeze # murderous_efficiency_talent # obliterate # obliteration # obliteration_buff # perseverance_of_the_ebon_martyr_debuff # pillar_of_frost # pillar_of_frost_buff # prolonged_power_potion # razorice_debuff # remorseless_winter # remorseless_winter_buff # remorseless_winter_debuff # rime_buff # runic_attenuation_talent # shattering_strikes_talent # sindragosas_fury # unholy_strength_buff # war_stomp ]] OvaleScripts:RegisterScript("DEATHKNIGHT", "frost", name, desc, code, "script") end do local name = "simulationcraft_death_knight_unholy_t19p" local desc = "[7.0] SimulationCraft: Death_Knight_Unholy_T19P" local code = [[ # Based on SimulationCraft profile "Death_Knight_Unholy_T19P". # class=deathknight # spec=unholy # talents=1210023 Include(ovale_common) Include(ovale_trinkets_mop) Include(ovale_trinkets_wod) Include(ovale_deathknight_spells) AddCheckBox(opt_interrupt L(interrupt) default specialization=unholy) AddCheckBox(opt_melee_range L(not_in_melee_range) specialization=unholy) AddCheckBox(opt_use_consumables L(opt_use_consumables) default specialization=unholy) AddFunction UnholyInterruptActions { if CheckBoxOn(opt_interrupt) and not target.IsFriend() and target.Casting() { if target.InRange(mind_freeze) and target.IsInterruptible() Spell(mind_freeze) if target.InRange(asphyxiate) and not target.Classification(worldboss) Spell(asphyxiate) if target.Distance(less 8) and target.IsInterruptible() Spell(arcane_torrent_runicpower) if target.Distance(less 5) and not target.Classification(worldboss) Spell(war_stomp) } } AddFunction UnholyUseItemActions { Item(Trinket0Slot text=13 usable=1) Item(Trinket1Slot text=14 usable=1) } AddFunction UnholyGetInMeleeRange { if CheckBoxOn(opt_melee_range) and not target.InRange(death_strike) Texture(misc_arrowlup help=L(not_in_melee_range)) } ### actions.default AddFunction UnholyDefaultMainActions { #outbreak,target_if=!dot.virulent_plague.ticking if not target.DebuffPresent(virulent_plague_debuff) Spell(outbreak) #run_action_list,name=valkyr,if=talent.dark_arbiter.enabled&pet.valkyr_battlemaiden.active if Talent(dark_arbiter_talent) and pet.Present() UnholyValkyrMainActions() unless Talent(dark_arbiter_talent) and pet.Present() and UnholyValkyrMainPostConditions() { #call_action_list,name=generic UnholyGenericMainActions() } } AddFunction UnholyDefaultMainPostConditions { Talent(dark_arbiter_talent) and pet.Present() and UnholyValkyrMainPostConditions() or UnholyGenericMainPostConditions() } AddFunction UnholyDefaultShortCdActions { #auto_attack UnholyGetInMeleeRange() unless not target.DebuffPresent(virulent_plague_debuff) and Spell(outbreak) { #dark_transformation,if=equipped.137075&cooldown.dark_arbiter.remains>165 if HasEquippedItem(137075) and SpellCooldown(dark_arbiter) > 165 Spell(dark_transformation) #dark_transformation,if=equipped.137075&!talent.shadow_infusion.enabled&cooldown.dark_arbiter.remains>55 if HasEquippedItem(137075) and not Talent(shadow_infusion_talent) and SpellCooldown(dark_arbiter) > 55 Spell(dark_transformation) #dark_transformation,if=equipped.137075&talent.shadow_infusion.enabled&cooldown.dark_arbiter.remains>35 if HasEquippedItem(137075) and Talent(shadow_infusion_talent) and SpellCooldown(dark_arbiter) > 35 Spell(dark_transformation) #dark_transformation,if=equipped.137075&target.time_to_die<cooldown.dark_arbiter.remains-8 if HasEquippedItem(137075) and target.TimeToDie() < SpellCooldown(dark_arbiter) - 8 Spell(dark_transformation) #dark_transformation,if=equipped.137075&cooldown.summon_gargoyle.remains>160 if HasEquippedItem(137075) and SpellCooldown(summon_gargoyle) > 160 Spell(dark_transformation) #dark_transformation,if=equipped.137075&!talent.shadow_infusion.enabled&cooldown.summon_gargoyle.remains>55 if HasEquippedItem(137075) and not Talent(shadow_infusion_talent) and SpellCooldown(summon_gargoyle) > 55 Spell(dark_transformation) #dark_transformation,if=equipped.137075&talent.shadow_infusion.enabled&cooldown.summon_gargoyle.remains>35 if HasEquippedItem(137075) and Talent(shadow_infusion_talent) and SpellCooldown(summon_gargoyle) > 35 Spell(dark_transformation) #dark_transformation,if=equipped.137075&target.time_to_die<cooldown.summon_gargoyle.remains-8 if HasEquippedItem(137075) and target.TimeToDie() < SpellCooldown(summon_gargoyle) - 8 Spell(dark_transformation) #dark_transformation,if=!equipped.137075&rune<=3 if not HasEquippedItem(137075) and Rune() < 4 Spell(dark_transformation) #blighted_rune_weapon,if=rune<=3 if Rune() < 4 Spell(blighted_rune_weapon) #run_action_list,name=valkyr,if=talent.dark_arbiter.enabled&pet.valkyr_battlemaiden.active if Talent(dark_arbiter_talent) and pet.Present() UnholyValkyrShortCdActions() unless Talent(dark_arbiter_talent) and pet.Present() and UnholyValkyrShortCdPostConditions() { #call_action_list,name=generic UnholyGenericShortCdActions() } } } AddFunction UnholyDefaultShortCdPostConditions { not target.DebuffPresent(virulent_plague_debuff) and Spell(outbreak) or Talent(dark_arbiter_talent) and pet.Present() and UnholyValkyrShortCdPostConditions() or UnholyGenericShortCdPostConditions() } AddFunction UnholyDefaultCdActions { #mind_freeze UnholyInterruptActions() #arcane_torrent,if=runic_power.deficit>20 if RunicPowerDeficit() > 20 Spell(arcane_torrent_runicpower) #blood_fury Spell(blood_fury_ap) #berserking Spell(berserking) #use_item,slot=trinket1 UnholyUseItemActions() #potion,name=prolonged_power,if=buff.unholy_strength.react if BuffPresent(unholy_strength_buff) and CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(prolonged_power_potion usable=1) unless not target.DebuffPresent(virulent_plague_debuff) and Spell(outbreak) or HasEquippedItem(137075) and SpellCooldown(dark_arbiter) > 165 and Spell(dark_transformation) or HasEquippedItem(137075) and not Talent(shadow_infusion_talent) and SpellCooldown(dark_arbiter) > 55 and Spell(dark_transformation) or HasEquippedItem(137075) and Talent(shadow_infusion_talent) and SpellCooldown(dark_arbiter) > 35 and Spell(dark_transformation) or HasEquippedItem(137075) and target.TimeToDie() < SpellCooldown(dark_arbiter) - 8 and Spell(dark_transformation) or HasEquippedItem(137075) and SpellCooldown(summon_gargoyle) > 160 and Spell(dark_transformation) or HasEquippedItem(137075) and not Talent(shadow_infusion_talent) and SpellCooldown(summon_gargoyle) > 55 and Spell(dark_transformation) or HasEquippedItem(137075) and Talent(shadow_infusion_talent) and SpellCooldown(summon_gargoyle) > 35 and Spell(dark_transformation) or HasEquippedItem(137075) and target.TimeToDie() < SpellCooldown(summon_gargoyle) - 8 and Spell(dark_transformation) or not HasEquippedItem(137075) and Rune() < 4 and Spell(dark_transformation) or Rune() < 4 and Spell(blighted_rune_weapon) { #run_action_list,name=valkyr,if=talent.dark_arbiter.enabled&pet.valkyr_battlemaiden.active if Talent(dark_arbiter_talent) and pet.Present() UnholyValkyrCdActions() unless Talent(dark_arbiter_talent) and pet.Present() and UnholyValkyrCdPostConditions() { #call_action_list,name=generic UnholyGenericCdActions() } } } AddFunction UnholyDefaultCdPostConditions { not target.DebuffPresent(virulent_plague_debuff) and Spell(outbreak) or HasEquippedItem(137075) and SpellCooldown(dark_arbiter) > 165 and Spell(dark_transformation) or HasEquippedItem(137075) and not Talent(shadow_infusion_talent) and SpellCooldown(dark_arbiter) > 55 and Spell(dark_transformation) or HasEquippedItem(137075) and Talent(shadow_infusion_talent) and SpellCooldown(dark_arbiter) > 35 and Spell(dark_transformation) or HasEquippedItem(137075) and target.TimeToDie() < SpellCooldown(dark_arbiter) - 8 and Spell(dark_transformation) or HasEquippedItem(137075) and SpellCooldown(summon_gargoyle) > 160 and Spell(dark_transformation) or HasEquippedItem(137075) and not Talent(shadow_infusion_talent) and SpellCooldown(summon_gargoyle) > 55 and Spell(dark_transformation) or HasEquippedItem(137075) and Talent(shadow_infusion_talent) and SpellCooldown(summon_gargoyle) > 35 and Spell(dark_transformation) or HasEquippedItem(137075) and target.TimeToDie() < SpellCooldown(summon_gargoyle) - 8 and Spell(dark_transformation) or not HasEquippedItem(137075) and Rune() < 4 and Spell(dark_transformation) or Rune() < 4 and Spell(blighted_rune_weapon) or Talent(dark_arbiter_talent) and pet.Present() and UnholyValkyrCdPostConditions() or UnholyGenericCdPostConditions() } ### actions.aoe AddFunction UnholyAoeMainActions { #death_and_decay,if=spell_targets.death_and_decay>=2 if Enemies() >= 2 Spell(death_and_decay) #epidemic,if=spell_targets.epidemic>4 if Enemies() > 4 Spell(epidemic) #scourge_strike,if=spell_targets.scourge_strike>=2&(dot.death_and_decay.ticking|dot.defile.ticking) if Enemies() >= 2 and { target.DebuffPresent(death_and_decay_debuff) or target.DebuffPresent(defile_debuff) } Spell(scourge_strike) #clawing_shadows,if=spell_targets.clawing_shadows>=2&(dot.death_and_decay.ticking|dot.defile.ticking) if Enemies() >= 2 and { target.DebuffPresent(death_and_decay_debuff) or target.DebuffPresent(defile_debuff) } Spell(clawing_shadows) #epidemic,if=spell_targets.epidemic>2 if Enemies() > 2 Spell(epidemic) } AddFunction UnholyAoeMainPostConditions { } AddFunction UnholyAoeShortCdActions { } AddFunction UnholyAoeShortCdPostConditions { Enemies() >= 2 and Spell(death_and_decay) or Enemies() > 4 and Spell(epidemic) or Enemies() >= 2 and { target.DebuffPresent(death_and_decay_debuff) or target.DebuffPresent(defile_debuff) } and Spell(scourge_strike) or Enemies() >= 2 and { target.DebuffPresent(death_and_decay_debuff) or target.DebuffPresent(defile_debuff) } and Spell(clawing_shadows) or Enemies() > 2 and Spell(epidemic) } AddFunction UnholyAoeCdActions { } AddFunction UnholyAoeCdPostConditions { Enemies() >= 2 and Spell(death_and_decay) or Enemies() > 4 and Spell(epidemic) or Enemies() >= 2 and { target.DebuffPresent(death_and_decay_debuff) or target.DebuffPresent(defile_debuff) } and Spell(scourge_strike) or Enemies() >= 2 and { target.DebuffPresent(death_and_decay_debuff) or target.DebuffPresent(defile_debuff) } and Spell(clawing_shadows) or Enemies() > 2 and Spell(epidemic) } ### actions.castigator AddFunction UnholyCastigatorMainActions { #festering_strike,if=debuff.festering_wound.stack<=4&runic_power.deficit>23 if target.DebuffStacks(festering_wound_debuff) <= 4 and RunicPowerDeficit() > 23 Spell(festering_strike) #death_coil,if=!buff.necrosis.up&talent.necrosis.enabled&rune<=3 if not BuffPresent(necrosis_buff) and Talent(necrosis_talent) and Rune() < 4 Spell(death_coil) #scourge_strike,if=buff.necrosis.react&debuff.festering_wound.stack>=3&runic_power.deficit>23 if BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 23 Spell(scourge_strike) #scourge_strike,if=buff.unholy_strength.react&debuff.festering_wound.stack>=3&runic_power.deficit>23 if BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 23 Spell(scourge_strike) #scourge_strike,if=rune>=2&debuff.festering_wound.stack>=3&runic_power.deficit>23 if Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 23 Spell(scourge_strike) #death_coil,if=talent.shadow_infusion.enabled&talent.dark_arbiter.enabled&!buff.dark_transformation.up&cooldown.dark_arbiter.remains>15 if Talent(shadow_infusion_talent) and Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and SpellCooldown(dark_arbiter) > 15 Spell(death_coil) #death_coil,if=talent.shadow_infusion.enabled&!talent.dark_arbiter.enabled&!buff.dark_transformation.up if Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) Spell(death_coil) #death_coil,if=talent.dark_arbiter.enabled&cooldown.dark_arbiter.remains>15 if Talent(dark_arbiter_talent) and SpellCooldown(dark_arbiter) > 15 Spell(death_coil) #death_coil,if=!talent.shadow_infusion.enabled&!talent.dark_arbiter.enabled if not Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) Spell(death_coil) } AddFunction UnholyCastigatorMainPostConditions { } AddFunction UnholyCastigatorShortCdActions { } AddFunction UnholyCastigatorShortCdPostConditions { target.DebuffStacks(festering_wound_debuff) <= 4 and RunicPowerDeficit() > 23 and Spell(festering_strike) or not BuffPresent(necrosis_buff) and Talent(necrosis_talent) and Rune() < 4 and Spell(death_coil) or BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 23 and Spell(scourge_strike) or BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 23 and Spell(scourge_strike) or Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 23 and Spell(scourge_strike) or Talent(shadow_infusion_talent) and Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and Spell(death_coil) or Talent(dark_arbiter_talent) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or not Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and Spell(death_coil) } AddFunction UnholyCastigatorCdActions { } AddFunction UnholyCastigatorCdPostConditions { target.DebuffStacks(festering_wound_debuff) <= 4 and RunicPowerDeficit() > 23 and Spell(festering_strike) or not BuffPresent(necrosis_buff) and Talent(necrosis_talent) and Rune() < 4 and Spell(death_coil) or BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 23 and Spell(scourge_strike) or BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 23 and Spell(scourge_strike) or Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 23 and Spell(scourge_strike) or Talent(shadow_infusion_talent) and Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and Spell(death_coil) or Talent(dark_arbiter_talent) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or not Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and Spell(death_coil) } ### actions.generic AddFunction UnholyGenericMainActions { #death_coil,if=runic_power.deficit<10 if RunicPowerDeficit() < 10 Spell(death_coil) #death_coil,if=!talent.dark_arbiter.enabled&buff.sudden_doom.up&!buff.necrosis.up&rune<=3 if not Talent(dark_arbiter_talent) and BuffPresent(sudden_doom_buff) and not BuffPresent(necrosis_buff) and Rune() < 4 Spell(death_coil) #death_coil,if=talent.dark_arbiter.enabled&buff.sudden_doom.up&cooldown.dark_arbiter.remains>5&rune<=3 if Talent(dark_arbiter_talent) and BuffPresent(sudden_doom_buff) and SpellCooldown(dark_arbiter) > 5 and Rune() < 4 Spell(death_coil) #festering_strike,if=debuff.festering_wound.stack<6&cooldown.apocalypse.remains<=6 if target.DebuffStacks(festering_wound_debuff) < 6 and SpellCooldown(apocalypse) <= 6 Spell(festering_strike) #festering_strike,if=debuff.soul_reaper.up&!debuff.festering_wound.up if target.DebuffPresent(soul_reaper_unholy_debuff) and not target.DebuffPresent(festering_wound_debuff) Spell(festering_strike) #scourge_strike,if=debuff.soul_reaper.up&debuff.festering_wound.stack>=1 if target.DebuffPresent(soul_reaper_unholy_debuff) and target.DebuffStacks(festering_wound_debuff) >= 1 Spell(scourge_strike) #clawing_shadows,if=debuff.soul_reaper.up&debuff.festering_wound.stack>=1 if target.DebuffPresent(soul_reaper_unholy_debuff) and target.DebuffStacks(festering_wound_debuff) >= 1 Spell(clawing_shadows) #call_action_list,name=aoe,if=active_enemies>=2 if Enemies() >= 2 UnholyAoeMainActions() unless Enemies() >= 2 and UnholyAoeMainPostConditions() { #call_action_list,name=instructors,if=equipped.132448 if HasEquippedItem(132448) UnholyInstructorsMainActions() unless HasEquippedItem(132448) and UnholyInstructorsMainPostConditions() { #call_action_list,name=standard,if=!talent.castigator.enabled&!equipped.132448 if not Talent(castigator_talent) and not HasEquippedItem(132448) UnholyStandardMainActions() unless not Talent(castigator_talent) and not HasEquippedItem(132448) and UnholyStandardMainPostConditions() { #call_action_list,name=castigator,if=talent.castigator.enabled&!equipped.132448 if Talent(castigator_talent) and not HasEquippedItem(132448) UnholyCastigatorMainActions() } } } } AddFunction UnholyGenericMainPostConditions { Enemies() >= 2 and UnholyAoeMainPostConditions() or HasEquippedItem(132448) and UnholyInstructorsMainPostConditions() or not Talent(castigator_talent) and not HasEquippedItem(132448) and UnholyStandardMainPostConditions() or Talent(castigator_talent) and not HasEquippedItem(132448) and UnholyCastigatorMainPostConditions() } AddFunction UnholyGenericShortCdActions { #soul_reaper,if=debuff.festering_wound.stack>=6&cooldown.apocalypse.remains<4 if target.DebuffStacks(festering_wound_debuff) >= 6 and SpellCooldown(apocalypse) < 4 Spell(soul_reaper_unholy) #apocalypse,if=debuff.festering_wound.stack>=6 if target.DebuffStacks(festering_wound_debuff) >= 6 Spell(apocalypse) unless RunicPowerDeficit() < 10 and Spell(death_coil) or not Talent(dark_arbiter_talent) and BuffPresent(sudden_doom_buff) and not BuffPresent(necrosis_buff) and Rune() < 4 and Spell(death_coil) or Talent(dark_arbiter_talent) and BuffPresent(sudden_doom_buff) and SpellCooldown(dark_arbiter) > 5 and Rune() < 4 and Spell(death_coil) or target.DebuffStacks(festering_wound_debuff) < 6 and SpellCooldown(apocalypse) <= 6 and Spell(festering_strike) { #soul_reaper,if=debuff.festering_wound.stack>=3 if target.DebuffStacks(festering_wound_debuff) >= 3 Spell(soul_reaper_unholy) unless target.DebuffPresent(soul_reaper_unholy_debuff) and not target.DebuffPresent(festering_wound_debuff) and Spell(festering_strike) or target.DebuffPresent(soul_reaper_unholy_debuff) and target.DebuffStacks(festering_wound_debuff) >= 1 and Spell(scourge_strike) or target.DebuffPresent(soul_reaper_unholy_debuff) and target.DebuffStacks(festering_wound_debuff) >= 1 and Spell(clawing_shadows) { #defile Spell(defile) #call_action_list,name=aoe,if=active_enemies>=2 if Enemies() >= 2 UnholyAoeShortCdActions() unless Enemies() >= 2 and UnholyAoeShortCdPostConditions() { #call_action_list,name=instructors,if=equipped.132448 if HasEquippedItem(132448) UnholyInstructorsShortCdActions() unless HasEquippedItem(132448) and UnholyInstructorsShortCdPostConditions() { #call_action_list,name=standard,if=!talent.castigator.enabled&!equipped.132448 if not Talent(castigator_talent) and not HasEquippedItem(132448) UnholyStandardShortCdActions() unless not Talent(castigator_talent) and not HasEquippedItem(132448) and UnholyStandardShortCdPostConditions() { #call_action_list,name=castigator,if=talent.castigator.enabled&!equipped.132448 if Talent(castigator_talent) and not HasEquippedItem(132448) UnholyCastigatorShortCdActions() } } } } } } AddFunction UnholyGenericShortCdPostConditions { RunicPowerDeficit() < 10 and Spell(death_coil) or not Talent(dark_arbiter_talent) and BuffPresent(sudden_doom_buff) and not BuffPresent(necrosis_buff) and Rune() < 4 and Spell(death_coil) or Talent(dark_arbiter_talent) and BuffPresent(sudden_doom_buff) and SpellCooldown(dark_arbiter) > 5 and Rune() < 4 and Spell(death_coil) or target.DebuffStacks(festering_wound_debuff) < 6 and SpellCooldown(apocalypse) <= 6 and Spell(festering_strike) or target.DebuffPresent(soul_reaper_unholy_debuff) and not target.DebuffPresent(festering_wound_debuff) and Spell(festering_strike) or target.DebuffPresent(soul_reaper_unholy_debuff) and target.DebuffStacks(festering_wound_debuff) >= 1 and Spell(scourge_strike) or target.DebuffPresent(soul_reaper_unholy_debuff) and target.DebuffStacks(festering_wound_debuff) >= 1 and Spell(clawing_shadows) or Enemies() >= 2 and UnholyAoeShortCdPostConditions() or HasEquippedItem(132448) and UnholyInstructorsShortCdPostConditions() or not Talent(castigator_talent) and not HasEquippedItem(132448) and UnholyStandardShortCdPostConditions() or Talent(castigator_talent) and not HasEquippedItem(132448) and UnholyCastigatorShortCdPostConditions() } AddFunction UnholyGenericCdActions { #dark_arbiter,if=!equipped.137075&runic_power.deficit<30 if not HasEquippedItem(137075) and RunicPowerDeficit() < 30 Spell(dark_arbiter) #dark_arbiter,if=equipped.137075&runic_power.deficit<30&cooldown.dark_transformation.remains<2 if HasEquippedItem(137075) and RunicPowerDeficit() < 30 and SpellCooldown(dark_transformation) < 2 Spell(dark_arbiter) #summon_gargoyle,if=!equipped.137075,if=rune<=3 if Rune() < 4 Spell(summon_gargoyle) #summon_gargoyle,if=equipped.137075&cooldown.dark_transformation.remains<10&rune<=3 if HasEquippedItem(137075) and SpellCooldown(dark_transformation) < 10 and Rune() < 4 Spell(summon_gargoyle) unless target.DebuffStacks(festering_wound_debuff) >= 6 and SpellCooldown(apocalypse) < 4 and Spell(soul_reaper_unholy) or target.DebuffStacks(festering_wound_debuff) >= 6 and Spell(apocalypse) or RunicPowerDeficit() < 10 and Spell(death_coil) or not Talent(dark_arbiter_talent) and BuffPresent(sudden_doom_buff) and not BuffPresent(necrosis_buff) and Rune() < 4 and Spell(death_coil) or Talent(dark_arbiter_talent) and BuffPresent(sudden_doom_buff) and SpellCooldown(dark_arbiter) > 5 and Rune() < 4 and Spell(death_coil) or target.DebuffStacks(festering_wound_debuff) < 6 and SpellCooldown(apocalypse) <= 6 and Spell(festering_strike) or target.DebuffStacks(festering_wound_debuff) >= 3 and Spell(soul_reaper_unholy) or target.DebuffPresent(soul_reaper_unholy_debuff) and not target.DebuffPresent(festering_wound_debuff) and Spell(festering_strike) or target.DebuffPresent(soul_reaper_unholy_debuff) and target.DebuffStacks(festering_wound_debuff) >= 1 and Spell(scourge_strike) or target.DebuffPresent(soul_reaper_unholy_debuff) and target.DebuffStacks(festering_wound_debuff) >= 1 and Spell(clawing_shadows) or Spell(defile) { #call_action_list,name=aoe,if=active_enemies>=2 if Enemies() >= 2 UnholyAoeCdActions() unless Enemies() >= 2 and UnholyAoeCdPostConditions() { #call_action_list,name=instructors,if=equipped.132448 if HasEquippedItem(132448) UnholyInstructorsCdActions() unless HasEquippedItem(132448) and UnholyInstructorsCdPostConditions() { #call_action_list,name=standard,if=!talent.castigator.enabled&!equipped.132448 if not Talent(castigator_talent) and not HasEquippedItem(132448) UnholyStandardCdActions() unless not Talent(castigator_talent) and not HasEquippedItem(132448) and UnholyStandardCdPostConditions() { #call_action_list,name=castigator,if=talent.castigator.enabled&!equipped.132448 if Talent(castigator_talent) and not HasEquippedItem(132448) UnholyCastigatorCdActions() } } } } } AddFunction UnholyGenericCdPostConditions { target.DebuffStacks(festering_wound_debuff) >= 6 and SpellCooldown(apocalypse) < 4 and Spell(soul_reaper_unholy) or target.DebuffStacks(festering_wound_debuff) >= 6 and Spell(apocalypse) or RunicPowerDeficit() < 10 and Spell(death_coil) or not Talent(dark_arbiter_talent) and BuffPresent(sudden_doom_buff) and not BuffPresent(necrosis_buff) and Rune() < 4 and Spell(death_coil) or Talent(dark_arbiter_talent) and BuffPresent(sudden_doom_buff) and SpellCooldown(dark_arbiter) > 5 and Rune() < 4 and Spell(death_coil) or target.DebuffStacks(festering_wound_debuff) < 6 and SpellCooldown(apocalypse) <= 6 and Spell(festering_strike) or target.DebuffStacks(festering_wound_debuff) >= 3 and Spell(soul_reaper_unholy) or target.DebuffPresent(soul_reaper_unholy_debuff) and not target.DebuffPresent(festering_wound_debuff) and Spell(festering_strike) or target.DebuffPresent(soul_reaper_unholy_debuff) and target.DebuffStacks(festering_wound_debuff) >= 1 and Spell(scourge_strike) or target.DebuffPresent(soul_reaper_unholy_debuff) and target.DebuffStacks(festering_wound_debuff) >= 1 and Spell(clawing_shadows) or Spell(defile) or Enemies() >= 2 and UnholyAoeCdPostConditions() or HasEquippedItem(132448) and UnholyInstructorsCdPostConditions() or not Talent(castigator_talent) and not HasEquippedItem(132448) and UnholyStandardCdPostConditions() or Talent(castigator_talent) and not HasEquippedItem(132448) and UnholyCastigatorCdPostConditions() } ### actions.instructors AddFunction UnholyInstructorsMainActions { #festering_strike,if=debuff.festering_wound.stack<=3&runic_power.deficit>13 if target.DebuffStacks(festering_wound_debuff) <= 3 and RunicPowerDeficit() > 13 Spell(festering_strike) #death_coil,if=!buff.necrosis.up&talent.necrosis.enabled&rune<=3 if not BuffPresent(necrosis_buff) and Talent(necrosis_talent) and Rune() < 4 Spell(death_coil) #scourge_strike,if=buff.necrosis.react&debuff.festering_wound.stack>=4&runic_power.deficit>29 if BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 4 and RunicPowerDeficit() > 29 Spell(scourge_strike) #clawing_shadows,if=buff.necrosis.react&debuff.festering_wound.stack>=3&runic_power.deficit>11 if BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 11 Spell(clawing_shadows) #scourge_strike,if=buff.unholy_strength.react&debuff.festering_wound.stack>=4&runic_power.deficit>29 if BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 4 and RunicPowerDeficit() > 29 Spell(scourge_strike) #clawing_shadows,if=buff.unholy_strength.react&debuff.festering_wound.stack>=3&runic_power.deficit>11 if BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 11 Spell(clawing_shadows) #scourge_strike,if=rune>=2&debuff.festering_wound.stack>=4&runic_power.deficit>29 if Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 4 and RunicPowerDeficit() > 29 Spell(scourge_strike) #clawing_shadows,if=rune>=2&debuff.festering_wound.stack>=3&runic_power.deficit>11 if Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 11 Spell(clawing_shadows) #death_coil,if=talent.shadow_infusion.enabled&talent.dark_arbiter.enabled&!buff.dark_transformation.up&cooldown.dark_arbiter.remains>15 if Talent(shadow_infusion_talent) and Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and SpellCooldown(dark_arbiter) > 15 Spell(death_coil) #death_coil,if=talent.shadow_infusion.enabled&!talent.dark_arbiter.enabled&!buff.dark_transformation.up if Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) Spell(death_coil) #death_coil,if=talent.dark_arbiter.enabled&cooldown.dark_arbiter.remains>15 if Talent(dark_arbiter_talent) and SpellCooldown(dark_arbiter) > 15 Spell(death_coil) #death_coil,if=!talent.shadow_infusion.enabled&!talent.dark_arbiter.enabled if not Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) Spell(death_coil) } AddFunction UnholyInstructorsMainPostConditions { } AddFunction UnholyInstructorsShortCdActions { } AddFunction UnholyInstructorsShortCdPostConditions { target.DebuffStacks(festering_wound_debuff) <= 3 and RunicPowerDeficit() > 13 and Spell(festering_strike) or not BuffPresent(necrosis_buff) and Talent(necrosis_talent) and Rune() < 4 and Spell(death_coil) or BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 4 and RunicPowerDeficit() > 29 and Spell(scourge_strike) or BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 4 and RunicPowerDeficit() > 29 and Spell(scourge_strike) or BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 4 and RunicPowerDeficit() > 29 and Spell(scourge_strike) or Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or Talent(shadow_infusion_talent) and Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and Spell(death_coil) or Talent(dark_arbiter_talent) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or not Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and Spell(death_coil) } AddFunction UnholyInstructorsCdActions { } AddFunction UnholyInstructorsCdPostConditions { target.DebuffStacks(festering_wound_debuff) <= 3 and RunicPowerDeficit() > 13 and Spell(festering_strike) or not BuffPresent(necrosis_buff) and Talent(necrosis_talent) and Rune() < 4 and Spell(death_coil) or BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 4 and RunicPowerDeficit() > 29 and Spell(scourge_strike) or BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 4 and RunicPowerDeficit() > 29 and Spell(scourge_strike) or BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 4 and RunicPowerDeficit() > 29 and Spell(scourge_strike) or Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 3 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or Talent(shadow_infusion_talent) and Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and Spell(death_coil) or Talent(dark_arbiter_talent) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or not Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and Spell(death_coil) } ### actions.precombat AddFunction UnholyPrecombatMainActions { } AddFunction UnholyPrecombatMainPostConditions { } AddFunction UnholyPrecombatShortCdActions { #raise_dead Spell(raise_dead) } AddFunction UnholyPrecombatShortCdPostConditions { } AddFunction UnholyPrecombatCdActions { #flask,name=countless_armies #food,name=nightborne_delicacy_platter #augmentation,name=defiled #snapshot_stats #potion,name=prolonged_power if CheckBoxOn(opt_use_consumables) and target.Classification(worldboss) Item(prolonged_power_potion usable=1) unless Spell(raise_dead) { #army_of_the_dead Spell(army_of_the_dead) } } AddFunction UnholyPrecombatCdPostConditions { Spell(raise_dead) } ### actions.standard AddFunction UnholyStandardMainActions { #festering_strike,if=debuff.festering_wound.stack<=3&runic_power.deficit>13 if target.DebuffStacks(festering_wound_debuff) <= 3 and RunicPowerDeficit() > 13 Spell(festering_strike) #death_coil,if=!buff.necrosis.up&talent.necrosis.enabled&rune<=3 if not BuffPresent(necrosis_buff) and Talent(necrosis_talent) and Rune() < 4 Spell(death_coil) #scourge_strike,if=buff.necrosis.react&debuff.festering_wound.stack>=1&runic_power.deficit>15 if BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 15 Spell(scourge_strike) #clawing_shadows,if=buff.necrosis.react&debuff.festering_wound.stack>=1&runic_power.deficit>11 if BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 11 Spell(clawing_shadows) #scourge_strike,if=buff.unholy_strength.react&debuff.festering_wound.stack>=1&runic_power.deficit>15 if BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 15 Spell(scourge_strike) #clawing_shadows,if=buff.unholy_strength.react&debuff.festering_wound.stack>=1&runic_power.deficit>11 if BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 11 Spell(clawing_shadows) #scourge_strike,if=rune>=2&debuff.festering_wound.stack>=1&runic_power.deficit>15 if Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 15 Spell(scourge_strike) #clawing_shadows,if=rune>=2&debuff.festering_wound.stack>=1&runic_power.deficit>11 if Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 11 Spell(clawing_shadows) #death_coil,if=talent.shadow_infusion.enabled&talent.dark_arbiter.enabled&!buff.dark_transformation.up&cooldown.dark_arbiter.remains>15 if Talent(shadow_infusion_talent) and Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and SpellCooldown(dark_arbiter) > 15 Spell(death_coil) #death_coil,if=talent.shadow_infusion.enabled&!talent.dark_arbiter.enabled&!buff.dark_transformation.up if Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) Spell(death_coil) #death_coil,if=talent.dark_arbiter.enabled&cooldown.dark_arbiter.remains>15 if Talent(dark_arbiter_talent) and SpellCooldown(dark_arbiter) > 15 Spell(death_coil) #death_coil,if=!talent.shadow_infusion.enabled&!talent.dark_arbiter.enabled if not Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) Spell(death_coil) } AddFunction UnholyStandardMainPostConditions { } AddFunction UnholyStandardShortCdActions { } AddFunction UnholyStandardShortCdPostConditions { target.DebuffStacks(festering_wound_debuff) <= 3 and RunicPowerDeficit() > 13 and Spell(festering_strike) or not BuffPresent(necrosis_buff) and Talent(necrosis_talent) and Rune() < 4 and Spell(death_coil) or BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 15 and Spell(scourge_strike) or BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 15 and Spell(scourge_strike) or BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 15 and Spell(scourge_strike) or Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or Talent(shadow_infusion_talent) and Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and Spell(death_coil) or Talent(dark_arbiter_talent) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or not Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and Spell(death_coil) } AddFunction UnholyStandardCdActions { } AddFunction UnholyStandardCdPostConditions { target.DebuffStacks(festering_wound_debuff) <= 3 and RunicPowerDeficit() > 13 and Spell(festering_strike) or not BuffPresent(necrosis_buff) and Talent(necrosis_talent) and Rune() < 4 and Spell(death_coil) or BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 15 and Spell(scourge_strike) or BuffPresent(necrosis_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 15 and Spell(scourge_strike) or BuffPresent(unholy_strength_buff) and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 15 and Spell(scourge_strike) or Rune() >= 2 and target.DebuffStacks(festering_wound_debuff) >= 1 and RunicPowerDeficit() > 11 and Spell(clawing_shadows) or Talent(shadow_infusion_talent) and Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and not pet.BuffPresent(dark_transformation_buff) and Spell(death_coil) or Talent(dark_arbiter_talent) and SpellCooldown(dark_arbiter) > 15 and Spell(death_coil) or not Talent(shadow_infusion_talent) and not Talent(dark_arbiter_talent) and Spell(death_coil) } ### actions.valkyr AddFunction UnholyValkyrMainActions { #death_coil Spell(death_coil) #festering_strike,if=debuff.festering_wound.stack<8&cooldown.apocalypse.remains<5 if target.DebuffStacks(festering_wound_debuff) < 8 and SpellCooldown(apocalypse) < 5 Spell(festering_strike) #call_action_list,name=aoe,if=active_enemies>=2 if Enemies() >= 2 UnholyAoeMainActions() unless Enemies() >= 2 and UnholyAoeMainPostConditions() { #festering_strike,if=debuff.festering_wound.stack<=3 if target.DebuffStacks(festering_wound_debuff) <= 3 Spell(festering_strike) #scourge_strike,if=debuff.festering_wound.up if target.DebuffPresent(festering_wound_debuff) Spell(scourge_strike) #clawing_shadows,if=debuff.festering_wound.up if target.DebuffPresent(festering_wound_debuff) Spell(clawing_shadows) } } AddFunction UnholyValkyrMainPostConditions { Enemies() >= 2 and UnholyAoeMainPostConditions() } AddFunction UnholyValkyrShortCdActions { unless Spell(death_coil) { #apocalypse,if=debuff.festering_wound.stack=8 if target.DebuffStacks(festering_wound_debuff) == 8 Spell(apocalypse) unless target.DebuffStacks(festering_wound_debuff) < 8 and SpellCooldown(apocalypse) < 5 and Spell(festering_strike) { #call_action_list,name=aoe,if=active_enemies>=2 if Enemies() >= 2 UnholyAoeShortCdActions() } } } AddFunction UnholyValkyrShortCdPostConditions { Spell(death_coil) or target.DebuffStacks(festering_wound_debuff) < 8 and SpellCooldown(apocalypse) < 5 and Spell(festering_strike) or Enemies() >= 2 and UnholyAoeShortCdPostConditions() or target.DebuffStacks(festering_wound_debuff) <= 3 and Spell(festering_strike) or target.DebuffPresent(festering_wound_debuff) and Spell(scourge_strike) or target.DebuffPresent(festering_wound_debuff) and Spell(clawing_shadows) } AddFunction UnholyValkyrCdActions { unless Spell(death_coil) or target.DebuffStacks(festering_wound_debuff) == 8 and Spell(apocalypse) or target.DebuffStacks(festering_wound_debuff) < 8 and SpellCooldown(apocalypse) < 5 and Spell(festering_strike) { #call_action_list,name=aoe,if=active_enemies>=2 if Enemies() >= 2 UnholyAoeCdActions() } } AddFunction UnholyValkyrCdPostConditions { Spell(death_coil) or target.DebuffStacks(festering_wound_debuff) == 8 and Spell(apocalypse) or target.DebuffStacks(festering_wound_debuff) < 8 and SpellCooldown(apocalypse) < 5 and Spell(festering_strike) or Enemies() >= 2 and UnholyAoeCdPostConditions() or target.DebuffStacks(festering_wound_debuff) <= 3 and Spell(festering_strike) or target.DebuffPresent(festering_wound_debuff) and Spell(scourge_strike) or target.DebuffPresent(festering_wound_debuff) and Spell(clawing_shadows) } ### Unholy icons. AddCheckBox(opt_deathknight_unholy_aoe L(AOE) default specialization=unholy) AddIcon checkbox=!opt_deathknight_unholy_aoe enemies=1 help=shortcd specialization=unholy { if not InCombat() UnholyPrecombatShortCdActions() unless not InCombat() and UnholyPrecombatShortCdPostConditions() { UnholyDefaultShortCdActions() } } AddIcon checkbox=opt_deathknight_unholy_aoe help=shortcd specialization=unholy { if not InCombat() UnholyPrecombatShortCdActions() unless not InCombat() and UnholyPrecombatShortCdPostConditions() { UnholyDefaultShortCdActions() } } AddIcon enemies=1 help=main specialization=unholy { if not InCombat() UnholyPrecombatMainActions() unless not InCombat() and UnholyPrecombatMainPostConditions() { UnholyDefaultMainActions() } } AddIcon checkbox=opt_deathknight_unholy_aoe help=aoe specialization=unholy { if not InCombat() UnholyPrecombatMainActions() unless not InCombat() and UnholyPrecombatMainPostConditions() { UnholyDefaultMainActions() } } AddIcon checkbox=!opt_deathknight_unholy_aoe enemies=1 help=cd specialization=unholy { if not InCombat() UnholyPrecombatCdActions() unless not InCombat() and UnholyPrecombatCdPostConditions() { UnholyDefaultCdActions() } } AddIcon checkbox=opt_deathknight_unholy_aoe help=cd specialization=unholy { if not InCombat() UnholyPrecombatCdActions() unless not InCombat() and UnholyPrecombatCdPostConditions() { UnholyDefaultCdActions() } } ### Required symbols # 132448 # 137075 # apocalypse # arcane_torrent_runicpower # army_of_the_dead # asphyxiate # berserking # blighted_rune_weapon # blood_fury_ap # castigator_talent # clawing_shadows # dark_arbiter # dark_arbiter_talent # dark_transformation # dark_transformation_buff # death_and_decay # death_and_decay_debuff # death_coil # death_strike # defile # defile_debuff # epidemic # festering_strike # festering_wound_debuff # mind_freeze # necrosis_buff # necrosis_talent # outbreak # prolonged_power_potion # raise_dead # scourge_strike # shadow_infusion_talent # soul_reaper_unholy # soul_reaper_unholy_debuff # sudden_doom_buff # summon_gargoyle # unholy_strength_buff # valkyr_battlemaiden # virulent_plague_debuff # war_stomp ]] OvaleScripts:RegisterScript("DEATHKNIGHT", "unholy", name, desc, code, "script") end
-- urHelpers.lua -- Set of helper functions and commonly used functions wrapped into single calls -- Created by Bryan Summersett on 3/28/2010 function table.copy(t) local t2 = {} for k,v in pairs(t) do t2[k] = v end return t2 end -- recursively updates an attribute on every element involved function RSetAttrs(r,opts) for i,v in pairs({r:Children()}) do RSetAttrs(v,opts) end SetAttrs(r,opts) end -- require a file using urMus-style. If includes 'var', then -- the file's content will be assigned to that global var and not required again. -- Req('underscore','_') function Req(name,var) if not var then return dofile(SystemPath(name..".lua")) end if not _G[var] then _G[var] = dofile(SystemPath(name..".lua")); return _G[var]; end end Req('underscore','us') -- use shorthand notation to set a number of attributes in the urMus api. -- supported attributes include: input, layer, width, height, -- x,y, img, color, gradient, alpha, rotate function SetAttrs(r,opts) local set = function(r) for k,fn in pairs({ input='EnableInput', layer='SetLayer', w='SetWidth',h='SetHeight', width='SetWidth',height='SetHeight', alpha='SetAlpha' }) do if opts[k] then r[fn](r,opts[k]) end end if opts.x or opts.y then local cur = {r:Anchor()} r:SetAnchor(cur[1] or 'BOTTOMLEFT', cur[2] or r:Parent(), cur[3] or 'BOTTOMLEFT', opts.x or cur[4] or 0, opts.y or cur[5] or 0) end local make_texture = function(r) if not r.t then r.t = r:Texture() end end if opts.img then local next_power_two = function(n) if n == 0 then return 0 end local i = 0 repeat i=i+1 until 2^i >= n return 2^i end local w_tex = next_power_two(opts.width) local h_tex = next_power_two(opts.height) make_texture(r) -- urMus textures are openGL textures, so they're resized to the nearest -- power of 2. We need to set the texCoords to compensate r.t:SetTexture(opts.img) r.t:SetTexCoord(0,opts.width/w_tex,opts.height/h_tex,0.0) r.tc = {r.t:TexCoord()} end if opts.color then make_texture(r) r.t:SetTexture(unpack(ParseColor(opts['color']))) end if opts.gradient then local g = {opts.gradient[1]} g[2] = ParseColor(opts.gradient[2]); g[2][4] = g[2][4] or 255; -- add alpha g[3] = ParseColor(opts.gradient[3]); g[3][4] = g[3][4] or 255 make_texture(r) r.t:SetGradientColor(unpack(us.flatten(g))) end -- texture attributes for k,fn in pairs({ rotate='SetRotation', blend='SetBlendMode' }) do if opts[k] then r.t[fn](r.t,opts[k]) end end end if r.Parent then set(r) else for i,v in pairs(r) do set(v) end end end -- Make an image: -- r = MakeRegion({w=100, h=200, img='thing.jpg'}) -- Make a black box: -- r = MakeRegion({w=100, h=100, color={0,0,0}}) -- Make a label attached to a : -- r = MakeRegion({w=300, h=100, -- color={255,255,255}, -- label={text="Test", -- color={0,0,0}, -- shadow={0,0,0,190,2,-3,6}}}) function MakeRegion(opts) opts = opts or {} local parent = opts['parent'] or UIParent local r = Region('region','MakeRegion region',parent) r:SetParent(parent) opts['input'] = opts['input'] or true opts['layer'] = opts['layer'] or 'MEDIUM' opts['width'] = opts['width'] or opts['w'] or 100 opts['height'] = opts['height'] or opts['h'] or 100 opts['color'] = opts['color'] or 'white' opts['blend'] = opts['blend'] or 'BLEND' -- do a bunch of attribute setting SetAttrs(r,opts) if opts['label'] then local l = opts['label'] local fsize = l['size'] or 12 local text = l['text'] or "" r.tl = r:TextLabel(); r.tl:SetFont(l['font'] or "Trebuchet MS") r.tl:SetHorizontalAlign(l['align'] or "LEFT"); r.tl:SetLabelHeight(fsize) r.tl:SetWrap(l['wrap'] or 'WORD') r.tl:SetLabel(text) -- first four (r,g,b,a) local color = {255,255,255,255} if l['color'] then if type(l['color']) == 'table' then for i,v in pairs(l['color']) do color[i] = v end -- copy our colors over elseif type(l['color']) == 'string' then color = ParseColor(l['color']) color[4] = 255 end end r.tl:SetColor(unpack(color)) -- shadow settings. first four (r,g,b,a); then offset (x,y); then blur radius (px) local shadow = {0,0,0,190,2,-3,6} if l['shadow'] then for i,v in pairs(l['shadow']) do shadow[i] = v end -- copy our shadow params over end r.tl:SetShadowColor(unpack(us.first(shadow,4))) r.tl:SetShadowOffset(unpack(us.first(shadow,5))) r.tl:SetShadowBlur(shadow[7]) -- if the width isn't specified for this region and we have a label, -- set its width to be the width of the text label's width if not opts.width then r:SetWidth(string.len(text)*(fsize/2)) end end -- if position arguments, do r:Show() return r end -- adds or updates an event for a given object -- Operates similarly to addEventListener() in JS function AddEvent(obj,e_name,fn) if not obj.events then obj.events = {} end local e = obj.events if not e[e_name] then e[e_name] = {} end local q = e[e_name] if not q[fn] then table.insert(q,fn) end obj:Handle(e_name,function(...) for i,v in pairs(q) do fn(unpack({...})) end end) end -- removes a given event handler for an obj. -- Operates similarly to removeEventListener() in JS function RemoveEvent(obj,e_name,fn) if not obj.events then return end local e = obj.events if not e[e_name] then return end local q = e[e_name]; -- reject fns equal to fn local temp = {} for i,v in pairs(q) do if v ~= fn then temp[i] = v end end; obj.events[e_name] = temp if #obj.events[e_name] == 0 then obj:Handle(e_name,nil) end -- remove handler if none left end -- uses a table to find color values; this fn can be called as {r,g,b} or {'colorname'} -- and is based on CSS color table values function ParseColor(c) local colors = {aliceblue={240,248,255}, antiquewhite={250,235,215}, aqua={0,255,255}, aquamarine={127,255,212}, azure={240,255,255}, beige={245,245,220}, bisque={255,228,196}, black={0,0,0}, blanchedalmond={255,235,205}, blue={0,0,255}, blueviolet={138,43,226}, brown={165,42,42}, burlywood={222,184,135}, cadetblue={95,158,160}, chartreuse={127,255,0}, chocolate={210,105,30}, coral={255,127,80}, cornflowerblue={100,149,237}, cornsilk={255,248,220}, crimson={220,20,60}, cyan={0,255,255}, darkblue={0,0,139}, darkcyan={0,139,139}, darkgoldenrod={184,134,11}, darkgray={169,169,169}, darkgreen={0,100,0}, darkgrey={169,169,169}, darkkhaki={189,183,107}, darkmagenta={139,0,139}, darkolivegreen={85,107,47}, darkorange={255,140,0}, darkorchid={153,50,204}, darkred={139,0,0}, darksalmon={233,150,122}, darkseagreen={143,188,143}, darkslateblue={72,61,139}, darkslategray={47,79,79}, darkslategrey={47,79,79}, darkturquoise={0,206,209}, darkviolet={148,0,211}, deeppink={255,20,147}, deepskyblue={0,191,255}, dimgray={105,105,105}, dimgrey={105,105,105}, dodgerblue={30,144,255}, firebrick={178,34,34}, floralwhite={255,250,240}, forestgreen={34,139,34}, fuchsia={255,0,255}, gainsboro={220,220,220}, ghostwhite={248,248,255}, gold={255,215,0}, goldenrod={218,165,32}, gray={128,128,128}, green={0,128,0}, greenyellow={173,255,47}, grey={128,128,128}, honeydew={240,255,240}, hotpink={255,105,180}, indianred={205,92,92}, indigo={75,0,130}, ivory={255,255,240}, khaki={240,230,140}, lavender={230,230,250}, lavenderblush={255,240,245}, lawngreen={124,252,0}, lemonchiffon={255,250,205}, lightblue={173,216,230}, lightcoral={240,128,128}, lightcyan={224,255,255}, lightgoldenrodyellow={250,250,210}, lightgray={211,211,211}, lightgreen={144,238,144}, lightgrey={211,211,211}, lightpink={255,182,193}, lightsalmon={255,160,122}, lightseagreen={32,178,170}, lightskyblue={135,206,250}, lightslategray={119,136,153}, lightslategrey={119,136,153}, lightsteelblue={176,196,222}, lightyellow={255,255,224}, lime={0,255,0}, limegreen={50,205,50}, linen={250,240,230}, magenta={255,0,255}, maroon={128,0,0}, mediumaquamarine={102,205,170}, mediumblue={0,0,205}, mediumorchid={186,85,211}, mediumpurple={147,112,219}, mediumseagreen={60,179,113}, mediumslateblue={123,104,238}, mediumspringgreen={0,250,154}, mediumturquoise={72,209,204}, mediumvioletred={199,21,133}, midnightblue={25,25,112}, mintcream={245,255,250}, mistyrose={255,228,225}, moccasin={255,228,181}, navajowhite={255,222,173}, navy={0,0,128}, oldlace={253,245,230}, olive={128,128,0}, olivedrab={107,142,35}, orange={255,165,0}, orangered={255,69,0}, orchid={218,112,214}, palegoldenrod={238,232,170}, palegreen={152,251,152}, paleturquoise={175,238,238}, palevioletred={219,112,147}, papayawhip={255,239,213}, peachpuff={255,218,185}, peru={205,133,63}, pink={255,192,203}, plum={221,160,221}, powderblue={176,224,230}, purple={128,0,128}, red={255,0,0}, rosybrown={188,143,143}, royalblue={65,105,225}, saddlebrown={139,69,19}, salmon={250,128,114}, sandybrown={244,164,96}, seagreen={46,139,87}, seashell={255,245,238}, sienna={160,82,45}, silver={192,192,192}, skyblue={135,206,235}, slateblue={106,90,205}, slategray={112,128,144}, slategrey={112,128,144}, snow={255,250,250}, springgreen={0,255,127}, steelblue={70,130,180}, tan={210,180,140}, teal={0,128,128}, thistle={216,191,216}, tomato={255,99,71}, turquoise={64,224,208}, violet={238,130,238}, wheat={245,222,179}, white={255,255,255}, whitesmoke={245,245,245}, yellow={255,255,0}, yellowgreen={154,205,50} } if type(c) == 'table' then return c elseif type(c) == 'string' and colors[c] then return colors[c] else return nil end end
fx_version 'cerulean' game 'gta5' ui_page 'nui/ui.html' shared_script 'config.lua' client_script 'client/main.lua' server_script 'server/main.lua' files { 'nui/**' }
help( [[ OpenSees is a software framework for developing applications to simulate the performance of structural and geotechnical systems subjected to earthquakes. ]]) whatis("Loads opensees, used to simulate the performance of structural and geotechnical systems subjected to earthquakes") local version = "6482" local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/opensees/"..version prepend_path("PATH", pathJoin(base, "bin")) family('opensees')
game 'rdr3' fx_version 'adamant' rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.' ui_page "html/index.html" client_script 'client.lua' server_scripts { '@mysql-async/lib/MySQL.lua', 'server.lua' } files { "html/index.html", "html/styles.css", "html/eden.png", "html/telegram.png", "html/telegram_background.png", "html/telegram_divider.png", "html/telegram_footer.png", "html/telegram_header.png", "html/reset.css", "html/listener.js" }
level_max_x = { -- Emerald Hill Zone ["zone=0,act=0"] = 0x2A40, ["zone=0,act=1"] = 0x29C0, -- Chemical Plant Zone ["zone=13,act=0"] = 0x2840, ["zone=13,act=1"] = 0x2943, -- Aquatic Ruin Zone ["zone=15,act=0"] = 0x298C, ["zone=15,act=1"] = 0x298D, -- Casino Night Zone ["zone=12,act=0"] = 0x2840, ["zone=12,act=1"] = 0x2740, -- Hill Top Zone ["zone=7,act=0"] = 0x2900, ["zone=7,act=1"] = 0x2E2E, -- Mystic Cave Zone ["zone=11,act=0"] = 0x2450, ["zone=11,act=1"] = 0x21A0, -- Oil Ocean Zone ["zone=10,act=0"] = 0x3040, ["zone=10,act=1"] = 0x2856, -- Metropolis Zone ["zone=4,act=0"] = 0x2300, ["zone=4,act=1"] = 0x1F40, ["zone=5,act=0"] = 0x29AF, -- Wing Fortress Zone ["zone=6,act=0"] = 0x29D9, } function clip(v, min, max) if v < min then return min elseif v > max then return max else return v end end prev_lives = 3 function contest_done() if data.game_mode == 16 then -- bonus level return true end if data.lives < prev_lives then return true end prev_lives = data.lives if calc_progress(data) >= 1 then return true end return false end offset_x = nil end_x = nil function calc_progress(data) if offset_x == nil then offset_x = -data.x local key = string.format("zone=%d,act=%d", data.zone, data.act) end_x = level_max_x[key] - data.x end local cur_x = clip(data.x + offset_x, 0, end_x) return cur_x / end_x end prev_progress = 0 frame_count = 0 frame_limit = 18000 function contest_reward() frame_count = frame_count + 1 local progress = calc_progress(data) local reward = (progress - prev_progress) * 9000 prev_progress = progress -- bonus for beating level if progress >= 1 then reward = reward + (1 - clip(frame_count/frame_limit, 0, 1)) * 1000 end return reward end
local run_plugin = true local socket = require "socket" local ffi = require "ffi" address, port = "127.0.0.1", 49002 udp = socket.udp() udp:settimeout(0) udp:setpeername(address, port) DataRef("AHARS1_pitch", "sim/cockpit2/gauges/indicators/pitch_AHARS_deg_pilot", "readonly") DataRef("AHARS1_roll", "sim/cockpit2/gauges/indicators/roll_AHARS_deg_pilot", "readonly") DataRef("AHARS1_hdg", "sim/cockpit2/gauges/indicators/heading_AHARS_deg_mag_pilot", "readonly") DataRef("AHARS1_cas", "sim/cockpit2/gauges/indicators/calibrated_airspeed_kts_pilot", "readonly") DataRef("ap_mode", "sim/cockpit/autopilot/autopilot_mode", "readonly") DataRef("ap_state", "sim/cockpit/autopilot/autopilot_state", "readonly") DataRef("ap_sr", "sim/cockpit2/annunciators/autopilot_soft_ride", "readonly") DataRef("ap_hb", "sim/cockpit/warnings/annunciators/autopilot_bank_limit", "readonly") DataRef("ap_servos", "sim/cockpit2/autopilot/servos_on", "readonly") DataRef("ap_yd", "sim/cockpit/switches/yaw_damper_on", "readonly") DataRef("fd_pitch", "sim/cockpit/autopilot/flight_director_pitch", "readonly") DataRef("fd_roll", "sim/cockpit/autopilot/flight_director_roll", "readonly") DataRef("fd_mode", "sim/cockpit2/autopilot/flight_director_mode", "readonly") DataRef("fd_as", "sim/cockpit2/autopilot/airspeed_dial_kts", "readonly") DataRef("ralt", "sim/cockpit2/gauges/indicators/radio_altimeter_height_ft_pilot", "readonly") DataRef("dh", "sim/cockpit/misc/radio_altimeter_minimum", "readonly") DataRef("xp_hsi_selector", "sim/cockpit2/radios/actuators/HSI_source_select_pilot", "readonly") DataRef("nav1_nav_id", "sim/cockpit2/radios/indicators/nav1_nav_id", "readonly") DataRef("nav2_nav_id", "sim/cockpit2/radios/indicators/nav2_nav_id", "readonly") DataRef("gps_nav_id", "sim/cockpit2/radios/indicators/gps_nav_id", "readonly") DataRef("om", "sim/cockpit2/radios/indicators/outer_marker_signal_ratio", "readonly") DataRef("mm", "sim/cockpit2/radios/indicators/middle_marker_signal_ratio", "readonly") DataRef("im", "sim/cockpit2/radios/indicators/inner_marker_signal_ratio", "readonly") function send_packets() -- local info_to_print = string.format("%f, %f, %f, %f", pitch, roll, hdg_t, hdg_m) -- AHARS1 local t = {AHARS1_pitch, AHARS1_roll, AHARS1_hdg, AHARS1_cas} -- array of floating point numbers local str = "DATA "..ffi.string(ffi.new("int[1]", 17), 1).."000"..ffi.string(ffi.new("float[?]", #t, t), 4 * #t) udp:send(str) -- AUTOPILOT if ap_mode > 1 then if ap_servos == 1 then ap_cws = 0 else ap_cws = 1 end else ap_cws = 0 end t = {ap_mode, ap_state, ap_hb/1.0, ap_sr/1.0, ap_cws/1, ap_yd/1} str = "DATA "..ffi.string(ffi.new("int[1]", 19), 1).."000"..ffi.string(ffi.new("float[?]", #t, t), 4 * #t) udp:send(str) -- RALT, DH, t = {ralt, dh} str = "DATA "..ffi.string(ffi.new("int[1]", 18), 1).."000"..ffi.string(ffi.new("float[?]", #t, t), 4 * #t) udp:send(str) -- FLIGHT DIRECTOR t = {fd_mode, fd_pitch, fd_roll, fd_as} str = "DATA "..ffi.string(ffi.new("int[1]", 20), 1).."000"..ffi.string(ffi.new("float[?]", #t, t), 4 * #t) udp:send(str) -- SELECTED NAV RADIO (this will have to change for EHSI version...) t= {} -- Handle trigger for EFIS APR mode if xp_hsi_selector == 0 then if string.sub(nav1_nav_id, 0, 1) == 'I' then t.source = "LOC" else t.source = "VOR" end t.id = nav1_nav_id elseif xp_hsi_selector == 1 then if string.sub(nav2_nav_id, 0, 1) == 'I' then t.source = "LOC" else t.source = "VOR" end t.id = nav2_nav_id elseif xp_hsi_selector ==2 then t.source = "GPS" t.id = gps_nav_id else -- ADF t.source = "ADF" t.id = nil end str = "DATA "..ffi.string(ffi.new("int[1]", 21), 1).."000"..string.format("%3s%s", t.source, t.id) udp:send(str) -- NAV markers t = {om, mm, im} str = "DATA "..ffi.string(ffi.new("int[1]", 22), 1).."000"..ffi.string(ffi.new("float[?]", #t, t), 4 * #t) udp:send(str) end do_every_frame("send_packets()") add_macro("Enable BK EFS50 UDP", "run_plugin = true", "run_plugin = false", "deactivate")
local function app(params) local win1 = WMCreateWindow(params) function win1.drawForeground(self, ctxt) --print("win1:drawForeground(): ", self, ctxt) ctxt:noStroke() ctxt:fill(255,0,0) ctxt:circle(self.frame.width/2, self.frame.height/2, self.frame.height/2) end win1:show() while true do win1:draw() yield(); end end return app
local t = Def.ActorFrame{}; t[#t+1] = Def.Sprite{ InitCommand=cmd(pause;y,-10;queuecommand,"Set"); SetCommand=function(self) self:Load(THEME:GetPathG("","ScreenGameplay StageFrame/Stages 1x9")); local GetStage = GAMESTATE:GetCurrentStage(); if GetStage == 'Stage_1st' then self:setstate(0); elseif GetStage == 'Stage_2nd' then self:setstate(1); elseif GetStage == 'Stage_3rd' then self:setstate(2); elseif GetStage == 'Stage_4th' then self:setstate(3); elseif GetStage == 'Stage_5th' then self:setstate(4); elseif GetStage == 'Stage_Final' then self:setstate(5); elseif GetStage == 'Stage_Extra1' then self:setstate(6); elseif GetStage == 'Stage_Extra2' then self:setstate(7); elseif GetStage == 'Stage_Event' then self:setstate(8); else self:visible(false) end; end; }; t[#t+1] = LoadActor("2ndStage.png")..{ InitCommand=cmd(y,15); } return t
--[[----------------------------------------------------------------------- * | Copyright (C) Shaobo Wan (Tinywan) * | Github: https://github.com/Tinywan * | Author: Tinywan * | Date: 2017/5/8 16:25 * | Mail: Overcome.wan@Gmail.com * |------------------------------------------------------------------------ * | version: 1.0 * | description: redis_iresty 长连接带连接池测试 * |------------------------------------------------------------------------ --]] local redis = require "resty.redis_iresty" local red = redis:new() local ok, err = red:connect_mod("127.0.0.1", 63800) if not ok then ngx.say("failed to connect: ", err) return end local res, err = red:auth("tinywan123456") if not res then ngx.say("failed to authenticate: ", err) return end local ok, err = red:set("OPenresty", "NGINX-based Media Streaming Server") if not ok then ngx.say("failed to set: ", err) return end ngx.say("set result: ", ok)
-- -- Testmodule initialisation, this script is called via autoload mechanism when the -- TeamSpeak 3 client starts. -- require("ts3init") -- Required for ts3RegisterModule require("z15announcegrp/events") -- Forwarded TeamSpeak 3 callbacks require("sgtcommon/sgt-common") -- Common functions for my lua scripts require("z15announcegrp/announcegrp") -- Some demo functions callable from TS3 client chat input local MODULE_NAME = "announcegrp" -- Define which callbacks you want to receive in your module. Callbacks not mentioned -- here will not be called. To avoid function name collisions, your callbacks should -- be put into an own package. local registeredEvents = { onTextMessageEvent = announcegrp_events.onTextMessageEvent, onClientMoveEvent = announcegrp_events.onClientMoveEvent, onClientMoveMovedEvent = announcegrp_events.onClientMoveMovedEvent, } -- Register your callback functions with a unique module name. ts3RegisterModule(MODULE_NAME, registeredEvents)
-- This isn't quite complete yet. -- It ideally needs to be more flexible. -- -- See libv01 for some examples. -- Note that the API has been modified since then. -- I've tried to get some of the stuff to work, -- but there's really no guarantees there. -- -- Stuff in old01 probably won't work without modification. print("const.lua") dofile("libv02/const.lua") print("players.lua") dofile("libv02/players.lua") print("hooks.lua") dofile("libv02/hooks.lua") print("map.lua") dofile("libv02/map.lua") print("build.lua") dofile("libv02/build.lua") print("loaded")
-- ============================================================= -- Copyright Roaming Gamer, LLC. 2008-2018 (All Rights Reserved) -- ============================================================= local public = {} local getTimer = system.getTimer function public.create_fps( allowDrag, scale ) scale = scale or 1 local fpsMeter = display.newGroup() fpsMeter.back = display.newRect( fpsMeter, left + 2 * scale, top + 2 * scale, 100 * scale, 25 * scale ) fpsMeter.back.anchorX = 0 fpsMeter.back.anchorY = 0 fpsMeter.lastTime = getTimer() local cx = fpsMeter.back.x + fpsMeter.back.contentWidth/2 local cy = fpsMeter.back.y + fpsMeter.back.contentHeight/2 fpsMeter.label = display.newText(fpsMeter, "initializing...", cx, cy, native.systemFont, 12 * scale ) fpsMeter.label:setFillColor( 0,0,0 ) fpsMeter.avgWindow = {} fpsMeter.maxWindowSize = display.fps * 2 or 60 fpsMeter.enterFrame = function(self) self:toFront() --self.back.x = left + 2 --self.back.y = top + 2 self.label.x = self.back.x + self.back.contentWidth/2 self.label.y = self.back.y + self.back.contentHeight/2 local avgWindow = fpsMeter.avgWindow local curTime = getTimer() local dt = curTime - self.lastTime self.lastTime = curTime if( dt == 0 ) then return end avgWindow[#avgWindow+1] = 1000/dt while( #avgWindow > self.maxWindowSize ) do table.remove(avgWindow,1) end if( #avgWindow ~= self.maxWindowSize ) then return end local sum = 0 for i = 1, #avgWindow do sum = avgWindow[i] + sum end fpsMeter.label.text = round(sum/#avgWindow) .. " FPS" end; timer.performWithDelay(1000, function() Runtime:addEventListener("enterFrame", fpsMeter) end ) if( allowDrag ) then fpsMeter.back.touch = function(self, event) if( event.phase == "began" ) then self.isFocus = true display.currentStage:setFocus( self, event.id ) self.x0 = self.x self.y0 = self.y elseif( self.isFocus ) then local dx = event.x - event.xStart local dy = event.y - event.yStart self.x = self.x0 + dx self.y = self.y0 + dy if( event.phase == "ended" ) then self.isFocus = false display.currentStage:setFocus( self, nil ) end end return true end; fpsMeter.back:addEventListener( "touch" ) end end function public.create_mem( allowDrag, scale ) scale = scale or 1 local hud = display.newGroup() local hudFrame = display.newRect( hud, 0, 0, 240*scale, 80*scale) hudFrame:setFillColor(0.2,0.2,0.2) hudFrame:setStrokeColor(1,1,0) hudFrame.strokeWidth = 1 hudFrame.x = right - hudFrame.contentWidth/2 - 5*scale hudFrame.y = top + hudFrame.contentHeight/2 + 5*scale local mMemLabel = display.newText( hud, "Main Mem:", hudFrame.x - hudFrame.contentWidth/2 + 15 * scale, hudFrame.y - hudFrame.contentHeight/2 + 15 * scale, native.systemFont, 16*scale ) mMemLabel:setFillColor(1,0.4,0) mMemLabel.anchorX = 0 mMemLabel.anchorY = 0 local tMemLabel = display.newText( hud, "Texture Mem:", hudFrame.x - hudFrame.contentWidth/2 + 15 * scale , hudFrame.y + hudFrame.contentHeight/2 - 15 * scale, native.systemFont, 16*scale ) tMemLabel:setFillColor(0.2,1,0) tMemLabel.anchorX = 0 tMemLabel.anchorY = 1 hud.enterFrame = function( self ) self:toFront() mMemLabel.x = hudFrame.x - hudFrame.contentWidth/2 + 10 * scale mMemLabel.y = hudFrame.y - hudFrame.contentHeight/2 + 15 * scale tMemLabel.x = hudFrame.x - hudFrame.contentWidth/2 + 10 * scale tMemLabel.y = hudFrame.y + hudFrame.contentHeight/2 - 15 * scale -- Fill in current main memory usage collectgarbage("collect") -- Collect garbage every frame to get 'true' current memory usage local mmem = collectgarbage( "count" ) mMemLabel.text = "Main Mem: " .. round(mmem/(1024),2) .. " MB" -- Fill in current texture memory usage local tmem = system.getInfo( "textureMemoryUsed" ) tMemLabel.text = "Texture Mem: " .. round(tmem/(1024 * 1024),2) .. " MB" end; Runtime:addEventListener( "enterFrame", hud ) if( allowDrag ) then hudFrame.touch = function(self, event) if( event.phase == "began" ) then self.isFocus = true display.currentStage:setFocus( self, event.id ) self.x0 = self.x self.y0 = self.y elseif( self.isFocus ) then local dx = event.x - event.xStart local dy = event.y - event.yStart self.x = self.x0 + dx self.y = self.y0 + dy if( event.phase == "ended" ) then self.isFocus = false display.currentStage:setFocus( self, nil ) end end return true end; hudFrame:addEventListener( "touch" ) end end _G.ssk.meters = public return public
require = function() end local isServer = triggerServerEvent == nil local isClient = not isServer local allClasses = {} local mainString local oldInit = System.init local prepareInit = function(classes) for _, class in ipairs(classes) do allClasses[#allClasses + 1] = class end end local finalizeInit = function(classes, settings) for _, class in ipairs(classes) do allClasses[#allClasses + 1] = class end mainString = settings.Main oldInit(allClasses, settings) end function prepareManifest(filepath) if not fileExists(filepath) then return end System.init = prepareInit local file = fileOpen(filepath) local content = fileRead(file, fileGetSize(file)) fileClose(file) local result = loadstring(content) result()() end function finalizeManifest(filepath) if not fileExists(filepath) then return end System.init = finalizeInit local file = fileOpen(filepath) local content = fileRead(file, fileGetSize(file)) fileClose(file) local result = loadstring(content) result()() end function prepareModule(path) local path = path .. "/Lua/Compiled/" .. ( isServer and "Server" or "Client") .. "/manifest.lua" prepareManifest(path) end for _, modulePath in ipairs(moduleTable) do prepareModule(modulePath) end local mainManifest = isServer and "Dist/Server/manifest.lua" or "Dist/Client/manifest.lua" finalizeManifest(mainManifest) function runEntryPoint() if (isClient) then -- instantiate the local player to ensure ElementManager.GetElement will always return a LocalPlayer instance local localPlayer = Slipe.Client.Peds.LocalPlayer.getInstance() end local stringEntryPoint = System.entryPoint local splits = split(stringEntryPoint, ".") local result = _G for _, split in ipairs(splits) do result = result[split] end result() -- Let the server know we are ready to accept incoming rpcs if(triggerServerEvent ~= nil) then triggerServerEvent("slipe-client-ready-rpc", root) end end initEvents() runEntryPoint()