content
stringlengths
5
1.05M
--[[********************************** * * Multi Theft Auto - Admin Panel * * client\main\admin_players.lua * * Original File by lil_Toady * **************************************]] aPlayersTab = {} aPlayers = {} addEvent("aClientPlayerJoin", true) function aPlayersTab.Create(tab) aPlayersTab.Tab = tab -- Player list (left pane) aPlayersTab.PlayerListSearch = guiCreateEdit(0.01, 0.01, 0.25, 0.04, "", true, tab) guiCreateInnerImage("client\\images\\search.png", aPlayersTab.PlayerListSearch) guiHandleInput(aPlayersTab.PlayerListSearch) aPlayersTab.PlayerList = guiCreateGridList(0.01, 0.06, 0.25, 0.88, true, tab) guiGridListAddColumn(aPlayersTab.PlayerList, "Player list", 0.85) aPlayersTab.Context = guiCreateContextMenu(aPlayersTab.PlayerList) aPlayersTab.ContextKick = guiContextMenuAddItem(aPlayersTab.Context, "Kick") aPlayersTab.ColorCodes = guiCreateCheckBox(0.01, 0.95, 0.25, 0.04, "Hide color codes", aGetSetting('hideColorCodes') or false, true, tab) aPlayersTab.SensitiveData = guiCreateCheckBox(0.2, 0.95, 0.25, 0.04, "Hide Sensitive Data", aGetSetting('hideSensitiveData') or false, true, tab) -- Player info (middle pane) guiCreateHeader(0.27, 0.04, 0.20, 0.04, "Player:", true, tab) aPlayersTab.InfoContext = guiCreateContextMenu() aPlayersTab.ContextCopy = guiContextMenuAddItem(aPlayersTab.InfoContext, "copy") aPlayersTab.Name = guiCreateLabel(0.27, 0.080, 0.45, 0.035, "Name: N/A", true, tab) guiSetContextMenu(aPlayersTab.Name, aPlayersTab.InfoContext) aPlayersTab.IP = guiCreateLabel(0.27, 0.125, 0.45, 0.035, "IP: N/A", true, tab) guiSetContextMenu(aPlayersTab.IP, aPlayersTab.InfoContext) aPlayersTab.Serial = guiCreateLabel(0.27, 0.170, 0.45, 0.035, "Serial: N/A", true, tab) guiSetContextMenu(aPlayersTab.Serial, aPlayersTab.InfoContext) aPlayersTab.Country = guiCreateLabel(0.27, 0.215, 0.45, 0.035, "Country: Unknown", true, tab) aPlayersTab.Account = guiCreateLabel(0.27, 0.260, 0.45, 0.035, "Account: N/A", true, tab) guiSetContextMenu(aPlayersTab.Account, aPlayersTab.InfoContext) aPlayersTab.Groups = guiCreateLabel(0.27, 0.305, 0.45, 0.035, "Groups: N/A", true, tab) aPlayersTab.Flag = guiCreateStaticImage(0.40, 0.125, 0.025806, 0.021154, "client\\images\\empty.png", true, tab) guiSetVisible(aPlayersTab.Flag, false) guiCreateHeader(0.27, 0.350, 0.20, 0.04, "Game:", true, tab) aPlayersTab.Health = guiCreateLabel(0.27, 0.395, 0.20, 0.04, "Health: 0%", true, tab) aPlayersTab.Armour = guiCreateLabel(0.45, 0.395, 0.20, 0.04, "Armour: 0%", true, tab) aPlayersTab.Skin = guiCreateLabel(0.27, 0.440, 0.20, 0.04, "Skin: N/A", true, tab) aPlayersTab.Team = guiCreateLabel(0.45, 0.440, 0.20, 0.04, "Team: None", true, tab) aPlayersTab.Weapon = guiCreateLabel(0.27, 0.485, 0.35, 0.04, "Weapon: N/A", true, tab) aPlayersTab.Ping = guiCreateLabel(0.27, 0.530, 0.20, 0.04, "Ping: 0", true, tab) aPlayersTab.Money = guiCreateLabel(0.45, 0.530, 0.20, 0.04, "Money: 0", true, tab) aPlayersTab.Area = guiCreateLabel(0.27, 0.575, 0.44, 0.04, "Area: Unknown", true, tab) guiSetContextMenu(aPlayersTab.Area, aPlayersTab.InfoContext) aPlayersTab.PositionX = guiCreateLabel(0.27, 0.620, 0.30, 0.04, "X: 0", true, tab) aPlayersTab.PositionY = guiCreateLabel(0.27, 0.665, 0.30, 0.04, "Y: 0", true, tab) aPlayersTab.PositionZ = guiCreateLabel(0.27, 0.710, 0.30, 0.04, "Z: 0", true, tab) guiSetContextMenu(aPlayersTab.PositionX, aPlayersTab.InfoContext) guiSetContextMenu(aPlayersTab.PositionY, aPlayersTab.InfoContext) guiSetContextMenu(aPlayersTab.PositionZ, aPlayersTab.InfoContext) aPlayersTab.Dimension = guiCreateLabel(0.27, 0.755, 0.20, 0.04, "Dimension: 0", true, tab) aPlayersTab.Interior = guiCreateLabel(0.45, 0.755, 0.20, 0.04, "Interior: 0", true, tab) guiCreateHeader(0.27, 0.805, 0.20, 0.04, "Vehicle:", true, tab) aPlayersTab.Vehicle = guiCreateLabel(0.27, 0.850, 0.35, 0.04, "Vehicle: N/A", true, tab) aPlayersTab.VehicleHealth = guiCreateLabel(0.27, 0.895, 0.25, 0.04, "Vehicle Health: 0%", true, tab) -- Action buttons (right pane) aPlayersTab.Messages = guiCreateButton(0.74, 0.01, 0.25, 0.04, "0/0 unread messages", true, tab) aPlayersTab.Kick = guiCreateButton(0.74, 0.1, 0.12, 0.04, "Kick", true, tab, "kick") aPlayersTab.Ban = guiCreateButton(0.87, 0.1, 0.12, 0.04, "Ban", true, tab, "ban") aPlayersTab.Mute = guiCreateButton(0.74, 0.145, 0.12, 0.04, "Mute", true, tab, "mute") aPlayersTab.Freeze = guiCreateButton(0.87, 0.145, 0.12, 0.04, "Freeze", true, tab, "freeze") aPlayersTab.Shout = guiCreateButton(0.74, 0.19, 0.12, 0.04, "Shout", true, tab, "shout") aPlayersTab.Spectate = guiCreateButton(0.87, 0.19, 0.12, 0.04, "Spectate", true, tab, "spectate") aPlayersTab.SetNick = guiCreateButton(0.74, 0.235, 0.12, 0.04, "Set nick", true, tab, "setnick") aPlayersTab.Admin = guiCreateButton(0.87, 0.235, 0.12, 0.04, "Give admin", true, tab, "setgroup") aPlayersTab.SlapOptions = guiCreateComboBox(0.76, 0.28, 0.1, 0.04, "0", true, tab) local width, height = guiGetSize(aPlayersTab.SlapOptions, false) for i = 0, 200, 20 do local id = guiComboBoxAddItem(aPlayersTab.SlapOptions, i) if i == 20 then guiComboBoxSetSelected(aPlayersTab.SlapOptions, id) end end guiSetSize(aPlayersTab.SlapOptions, width, height + (16 * 11), false) -- adjust height to fit items (16px per item) aPlayersTab.Slap = guiCreateButton(0.87, 0.28, 0.12, 0.04, "Slap!", true, tab, "slap") aPlayersTab.SetHealth = guiCreateButton(0.74, 0.35, 0.12, 0.04, "Set Health", true, tab, "sethealth") aPlayersTab.SetArmour = guiCreateButton(0.87, 0.35, 0.12, 0.04, "Set Armour", true, tab, "setarmour") aPlayersTab.SetSkin = guiCreateButton(0.74, 0.395, 0.12, 0.04, "Set Skin", true, tab, "setskin") aPlayersTab.SetTeam = guiCreateButton(0.87, 0.395, 0.12, 0.04, "Set Team", true, tab, "setteam") aPlayersTab.SetDimension = guiCreateButton(0.74, 0.44, 0.12, 0.04, "Set Dimens.", true, tab, "setdimension") aPlayersTab.SetInterior = guiCreateButton(0.87, 0.44, 0.12, 0.04, "Set Interior", true, tab, "setinterior") aPlayersTab.SetMoney = guiCreateButton(0.74, 0.485, 0.12, 0.04, "Set Money", true, tab, "setmoney") aPlayersTab.SetStats = guiCreateButton(0.87, 0.485, 0.12, 0.04, "Set Stats", true, tab, "setstat") aPlayersTab.GiveWeapon = guiCreateButton(0.74, 0.53, 0.25, 0.04, "Give Weapon", true, tab) aPlayersTab.JetPack = guiCreateButton(0.74, 0.575, 0.25, 0.04, "Give JetPack", true, tab, "jetpack") aPlayersTab.GiveVehicle = guiCreateButton(0.74, 0.62, 0.25, 0.04, "Give Vehicle", true, tab) aPlayersTab.WarpTo = guiCreateButton(0.74, 0.665, 0.25, 0.04, "Warp to player", true, tab, "warp") aPlayersTab.WarpPlayer = guiCreateButton(0.74, 0.71, 0.25, 0.04, "Warp player to...", true, tab, "warp") aPlayersTab.VehicleFix = guiCreateButton(0.74, 0.805, 0.12, 0.04, "Fix", true, tab, "repair") aPlayersTab.VehicleDestroy = guiCreateButton(0.74, 0.85, 0.12, 0.04, "Destroy", true, tab, "destroyvehicle") aPlayersTab.VehicleBlow = guiCreateButton(0.87, 0.805, 0.12, 0.04, "Blow", true, tab, "blowvehicle") aPlayersTab.VehicleCustomize = guiCreateButton(0.87, 0.85, 0.12, 0.04, "Customize", true, tab, "customize") aPlayersTab.AnonAdmin = guiCreateCheckBox(0.745, 0.942, 0.20, 0.04, "Anonymous Admin", isAnonAdmin(), true, tab) aPlayersTab.Refresh() -- EVENTS addEventHandler("onClientGUIClick", aPlayersTab.Context, aPlayersTab.onContextClick) addEventHandler("onClientGUIClick", aPlayersTab.InfoContext, aPlayersTab.onContextClick) addEventHandler("onClientGUIClick", aPlayersTab.Tab, aPlayersTab.onClientClick) addEventHandler("onClientGUIChanged", aPlayersTab.PlayerListSearch, aPlayersTab.onPlayerListSearch) addEventHandler("onClientPlayerChangeNick", root, aPlayersTab.onClientPlayerChangeNick) addEventHandler("aClientPlayerJoin", root, aPlayersTab.onClientPlayerJoin) addEventHandler("onClientPlayerQuit", root, aPlayersTab.onClientPlayerQuit) addEventHandler(EVENT_SYNC, root, aPlayersTab.onClientSync) addEventHandler("onClientResourceStop", resourceRoot, aPlayersTab.onClientResourceStop) addEventHandler("onAdminRefresh", aPlayersTab.Tab, aPlayersTab.onRefresh) sync(SYNC_PLAYERS) if (hasPermissionTo("command.listmessages")) then sync(SYNC_MESSAGES) end --bindKey("arrow_d", "down", aPlayersTab.onPlayerListScroll, 1) --bindKey("arrow_u", "down", aPlayersTab.onPlayerListScroll, -1) -- bindKey will not work while the searchbar has input focus - here is a hack using onClientKey instead addEventHandler("onClientKey", root, function(key, press) if not (key == "arrow_u" or key == "arrow_d") then return end if not press then return end if not guiGetVisible(aAdminMain.Form) then return end aPlayersTab.onPlayerListScroll(key, press and "down" or "up", key == "arrow_u" and -1 or 1) end) end function aPlayersTab.onContextClick(button) local translator = { [aPlayersTab.ContextKick] = aPlayersTab.Kick } if (translator[source]) then source = translator[source] aPlayersTab.onClientClick(button) elseif (source == aPlayersTab.ContextCopy) then if (contextSource) then local copy = string.sub(guiGetText(contextSource), guiGetText(contextSource):match("%w+:"):len() + 2) setClipboard(copy) end end end function aPlayersTab.onClientClick(button) if (button == "left") then if (source == aPlayersTab.Messages) then aMessages.Open() elseif (getElementType(source) == "gui-button") then if (guiGridListGetSelectedItem(aPlayersTab.PlayerList) == -1) then messageBox("No player selected!", MB_ERROR, MB_OK) else local player = getSelectedPlayer() local name = getPlayerName(player) if (source == aPlayersTab.Kick) then local reason = inputBox("Kick player " .. name, "Enter the kick reason") if (reason) then triggerServerEvent("aPlayer", localPlayer, player, "kick", reason) end elseif (source == aPlayersTab.Ban) then local reason = inputBox("Ban player " .. name, "Enter the ban reason") if (reason) then triggerServerEvent("aPlayer", localPlayer, player, "ban", reason) end elseif (source == aPlayersTab.Slap) then triggerServerEvent("aPlayer", localPlayer, player, "slap", guiComboBoxGetItemText(aPlayersTab.SlapOptions, guiComboBoxGetSelected(aPlayersTab.SlapOptions)) ) elseif (source == aPlayersTab.Mute) then triggerServerEvent( "aPlayer", localPlayer, player, iif(aPlayers[player].mute, "unmute", "mute") ) elseif (source == aPlayersTab.Freeze) then triggerServerEvent( "aPlayer", localPlayer, player, iif(aPlayers[player].freeze, "unfreeze", "freeze") ) elseif (source == aPlayersTab.Spectate) then aSpectate(player) elseif (source == aPlayersTab.SetNick) then local nick = inputBox("Set nick", "Enter new nickname for " .. name) if (nick) then triggerServerEvent("aPlayer", localPlayer, player, "setnick", nick) end elseif (source == aPlayersTab.Shout) then local shout = inputBox("Shout", "Enter text to be shown on player's screen") if (shout) then triggerServerEvent("aPlayer", localPlayer, player, "shout", shout) end elseif (source == aPlayersTab.SetHealth) then local health = inputBox("Set health", "Enter the health value", "100") if (health) then triggerServerEvent("aPlayer", localPlayer, player, "sethealth", health) end elseif (source == aPlayersTab.SetArmour) then local armour = inputBox("Set armour", "Enter the armour value", "100") if (armour) then triggerServerEvent("aPlayer", localPlayer, player, "setarmour", armour) end elseif (source == aPlayersTab.SetTeam) then aTeam.Show() elseif (source == aPlayersTab.SetSkin) then aSkin.Show(player) elseif (source == aPlayersTab.SetInterior) then aInterior.Show(player) elseif (source == aPlayersTab.JetPack) then triggerServerEvent("aPlayer", localPlayer, player, "jetpack") elseif (source == aPlayersTab.SetMoney) then local money = inputBox("Set money", "Enter the money value") if (money) then triggerServerEvent("aPlayer", localPlayer, player, "setmoney", money) end elseif (source == aPlayersTab.SetStats) then aPlayerStats(player) elseif (source == aPlayersTab.SetDimension) then local dimension = inputBox("Set dimension", "Enter dimension ID between 0 and 65535", "0") if (dimension) then triggerServerEvent("aPlayer", localPlayer, player, "setdimension", dimension) end elseif (source == aPlayersTab.GiveWeapon) then aWeapon.Show(player) elseif (source == aPlayersTab.GiveVehicle) then aVehicle.Show(player) elseif (source == aPlayersTab.VehicleFix) then triggerServerEvent("aVehicle", localPlayer, player, "repair") elseif (source == aPlayersTab.VehicleBlow) then triggerServerEvent("aVehicle", localPlayer, player, "blowvehicle") elseif (source == aPlayersTab.VehicleDestroy) then triggerServerEvent("aVehicle", localPlayer, player, "destroyvehicle") elseif (source == aPlayersTab.VehicleCustomize) then local vehicle = getPedOccupiedVehicle(player) if not isElement(vehicle) then messageBox("Player is not in a vehicle!", MB_ERROR) else aVehicleUpgrades.Open(player, vehicle) end elseif (source == aPlayersTab.WarpTo) then if player == localPlayer then messageBox("You can't warp to yourself!", MB_ERROR) else triggerServerEvent("aPlayer", localPlayer, player, "warp") end elseif (source == aPlayersTab.WarpPlayer) then aPlayerWarp(player) elseif (source == aPlayersTab.Admin) then if (aPlayers[player]["admin"] and messageBox("Revoke admin rights from " .. name .. "?", MB_WARNING)) then triggerServerEvent("aPlayer", localPlayer, player, "setgroup", false) elseif (messageBox("Give admin rights to " .. name .. "?", MB_WARNING)) then triggerServerEvent("aPlayer", localPlayer, player, "setgroup", true) end end end elseif (source == aPlayersTab.AnonAdmin) then setElementData(localPlayer, "AnonAdmin", guiCheckBoxGetSelected(aPlayersTab.AnonAdmin)) elseif (source == aPlayersTab.ColorCodes) then aPlayersTab.Refresh() aSetSetting('hideColorCodes', guiCheckBoxGetSelected(source)) elseif (source == aPlayersTab.SensitiveData) then local state = guiCheckBoxGetSelected(source) aSetSetting('hideSensitiveData', state) for k, v in ipairs(aAdminMain.Tabs) do if aAdminMain.BlockedTabsBySensitiveData[v.Acl] then guiSetEnabled(v.Tab, not state) end end if isElement(aServerTab.Password) then guiSetText(aServerTab.Password, "Password: " .. getSensitiveText(aServerTab['currentPassword'] or "None")) end elseif (source == aPlayersTab.PlayerList) then local player = getSelectedPlayer() if (player) then aPlayersTab.onRefresh() else guiSetText(aPlayersTab.Name, "Name: N/A") guiSetText(aPlayersTab.IP, "IP: N/A") guiSetText(aPlayersTab.Serial, "Serial: N/A") guiSetText(aPlayersTab.Account, "Account: N/A") guiSetText(aPlayersTab.Country, "Country: Unknown") guiSetText(aPlayersTab.Groups, "Groups: N/A") guiSetText(aPlayersTab.Mute, "Mute") guiSetText(aPlayersTab.Freeze, "Freeze") guiSetText(aPlayersTab.Admin, "Give admin") guiSetText(aPlayersTab.Health, "Health: 0%") guiSetText(aPlayersTab.Armour, "Armour: 0%") guiSetText(aPlayersTab.Skin, "Skin: N/A") guiSetText(aPlayersTab.Team, "Team: None") guiSetText(aPlayersTab.Ping, "Ping: 0") guiSetText(aPlayersTab.Money, "Money: 0") guiSetText(aPlayersTab.Dimension, "Dimension: 0") guiSetText(aPlayersTab.Interior, "Interior: 0") guiSetText(aPlayersTab.JetPack, "Give JetPack") guiSetText(aPlayersTab.Weapon, "Weapon: N/A") guiSetText(aPlayersTab.Area, "Area: Unknown") guiSetText(aPlayersTab.PositionX, "X: 0") guiSetText(aPlayersTab.PositionY, "Y: 0") guiSetText(aPlayersTab.PositionZ, "Z: 0") guiSetText(aPlayersTab.Vehicle, "Vehicle: N/A") guiSetText(aPlayersTab.VehicleHealth, "Vehicle Health: 0%") guiSetVisible(aPlayersTab.Flag, false) end end end end function aPlayersTab.onPlayerListSearch() guiGridListClear(aPlayersTab.PlayerList) local text = guiGetText(source) if (text == "") then for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(aPlayersTab.PlayerList) guiGridListSetItemText(aPlayersTab.PlayerList, row, 1, getPlayerName(player), false, false) guiGridListSetItemData(aPlayersTab.PlayerList, row, 1, player) end else for id, player in ipairs(getElementsByType("player")) do if (string.find(string.upper(getPlayerName(player)), string.upper(text))) then local row = guiGridListAddRow(aPlayersTab.PlayerList) guiGridListSetItemText(aPlayersTab.PlayerList, row, 1, getPlayerName(player), false, false) guiGridListSetItemData(aPlayersTab.PlayerList, row, 1, player) end end end end function aPlayersTab.onPlayerListScroll(key, state, inc) if (not guiGetVisible(aAdminMain.Form)) then return end local max = guiGridListGetRowCount(aPlayersTab.PlayerList) if (max <= 0) then return end local current = guiGridListGetSelectedItem(aPlayersTab.PlayerList) local next = current + inc max = max - 1 if (current == -1) then guiGridListSetSelectedItem(aPlayersTab.PlayerList, 0, 1) elseif (next > max) then return elseif (next < 0) then return else guiGridListSetSelectedItem(aPlayersTab.PlayerList, next, 1) end -- If we have finally selected an item if guiGridListGetSelectedItem(aPlayersTab.PlayerList) ~= -1 then aPlayersTab.onRefresh() end end function aPlayersTab.onClientPlayerChangeNick(oldNick, newNick) local id = 0 local list = aPlayersTab.PlayerList while (id <= guiGridListGetRowCount(list)) do if (guiGridListGetItemData(list, id, 1) == source) then if (guiCheckBoxGetSelected(aPlayersTab.ColorCodes)) then guiGridListSetItemText(list, id, 1, stripColorCodes(newNick), false, false) else guiGridListSetItemText(list, id, 1, newNick, false, false) end end id = id + 1 end end function aPlayersTab.onClientPlayerJoin(ip, username, serial, country, countryname) aPlayers[source] = {} aPlayers[source].name = getPlayerName(source) aPlayers[source].ip = ip aPlayers[source].serial = serial or "N/A" aPlayers[source].country = country aPlayers[source].countryname = countryname aPlayers[source].account = "guest" aPlayers[source].groups = "None" local list = aPlayersTab.PlayerList local row = guiGridListAddRow(list) if (guiCheckBoxGetSelected(aPlayersTab.ColorCodes)) then guiGridListSetItemText(list, row, 1, stripColorCodes(getPlayerName(source)), false, false) else guiGridListSetItemText(list, row, 1, getPlayerName(source), false, false) end guiGridListSetItemData(list, row, 1, source) if (aSpecPlayerList) then local row2 = guiGridListAddRow(aSpecPlayerList) guiGridListSetItemText(aSpecPlayerList, row2, 1, getPlayerName(source), false, false) end end function aPlayersTab.onClientPlayerQuit() local list = aPlayersTab.PlayerList local id = 0 while (id <= guiGridListGetRowCount(list)) do if (guiGridListGetItemData(list, id, 1) == source) then guiGridListRemoveRow(list, id) end id = id + 1 end if (aSpecPlayerList) then local id2 = 0 while (id2 <= guiGridListGetRowCount(aSpecPlayerList)) do if (guiGridListGetItemText(aSpecPlayerList, id2, 1) == getPlayerName(source)) then guiGridListRemoveRow(aSpecPlayerList, id2) end id2 = id2 + 1 end end aPlayers[source] = nil end function aPlayersTab.onClientSync(type, table) if (type == SYNC_PLAYER) then for type2, data in pairs(table) do aPlayers[source][type2] = data end elseif (type == SYNC_PLAYERS) then aPlayers = table elseif (type == SYNC_MESSAGES) then local prev = tonumber(string.sub(guiGetText(aPlayersTab.Messages), 1, 1)) if (prev < table["unread"]) then playSoundFrontEnd(18) end guiSetText(aPlayersTab.Messages, table["unread"] .. "/" .. table["total"] .. " unread messages") end end function aPlayersTab.onRefresh() local player = getSelectedPlayer() if (not player) then return end local data = aPlayers[player] if (not data) then return end sync(SYNC_PLAYER, player) guiSetText(aPlayersTab.IP, "IP: " .. getSensitiveText(aPlayers[player].ip)) guiSetText(aPlayersTab.Serial, "Serial: " .. getSensitiveText((aPlayers[player].serial or "Unknown"))) guiSetText(aPlayersTab.Country, "Country: " .. (aPlayers[player].countryname or "Unknown")) guiSetText(aPlayersTab.Account, "Account: " .. getSensitiveText((aPlayers[player]["account"] or "guest"))) guiSetText(aPlayersTab.Groups, "Groups: " .. (aPlayers[player]["groups"] or "None")) if (aPlayers[player].country and string.lower(tostring(aPlayers[player].country)) ~= "zz") then local x, y = guiGetPosition(aPlayersTab.Country, false) local width = guiLabelGetTextExtent(aPlayersTab.Country) guiSetPosition(aPlayersTab.Flag, x + width + 3, y + 4, false) guiSetVisible( aPlayersTab.Flag, guiStaticImageLoadImage( aPlayersTab.Flag, "client\\images\\flags\\" .. string.lower(tostring(aPlayers[player].country)) .. ".png" ) ) else guiSetVisible(aPlayersTab.Flag, false) end guiSetText(aPlayersTab.Name, "Name: " .. stripColorCodes(getPlayerName(player))) guiSetText(aPlayersTab.Mute, iif(aPlayers[player].mute, "Unmute", "Mute")) guiSetText(aPlayersTab.Freeze, iif(aPlayers[player].freeze, "Unfreeze", "Freeze")) if (isPedDead(player)) then guiSetText(aPlayersTab.Health, "Health: Dead") else guiSetText(aPlayersTab.Health, "Health: " .. math.ceil(getElementHealth(player)) .. "%") end guiSetText(aPlayersTab.Armour, "Armour: " .. math.ceil(getPedArmor(player)) .. "%") guiSetText(aPlayersTab.Skin, "Skin: " .. getElementModel(player) or "N/A") local team = getPlayerTeam(player) if (team) then guiSetText(aPlayersTab.Team, "Team: " .. getTeamName(team)) else guiSetText(aPlayersTab.Team, "Team: None") end guiSetText(aPlayersTab.Ping, "Ping: " .. getPlayerPing(player) or 0) guiSetText(aPlayersTab.Money, "Money: " .. (aPlayers[player].money or 0)) if (getElementDimension(player)) then guiSetText(aPlayersTab.Dimension, "Dimension: " .. getElementDimension(player)) end if (getElementInterior(player)) then guiSetText(aPlayersTab.Interior, "Interior: " .. getElementInterior(player)) end guiSetText(aPlayersTab.JetPack, iif(doesPedHaveJetPack(player), "Remove JetPack", "Give JetPack")) local weapon = getPedWeapon(player) if (weapon) then guiSetText(aPlayersTab.Weapon, "Weapon: " .. getWeaponNameFromID(weapon) .. " (ID: " .. weapon .. ")") end local x, y, z = getElementPosition(player) local area = getZoneName(x, y, z, false) local zone = getZoneName(x, y, z, true) guiSetText(aPlayersTab.Area, "Area: " .. getSensitiveText(iif(area == zone, area, area .. " (" .. zone .. ")"))) guiSetText(aPlayersTab.PositionX, "X: " .. getSensitiveText(x)) guiSetText(aPlayersTab.PositionY, "Y: " .. getSensitiveText(y)) guiSetText(aPlayersTab.PositionZ, "Z: " .. getSensitiveText(z)) local vehicle = getPedOccupiedVehicle(player) if (vehicle) then guiSetText( aPlayersTab.Vehicle, "Vehicle: " .. getVehicleName(vehicle) .. " (ID: " .. getElementModel(vehicle) .. ")" ) guiSetText(aPlayersTab.VehicleHealth, "Vehicle Health: " .. math.ceil(getElementHealth(vehicle)) .. "%") else guiSetText(aPlayersTab.Vehicle, "Vehicle: Foot") guiSetText(aPlayersTab.VehicleHealth, "Vehicle Health: 0%") end return player end function aPlayersTab.onClientResourceStop() --[[aSetSetting("currentWeapon", aCurrentWeapon) aSetSetting("currentAmmo", aCurrentAmmo) aSetSetting("currentVehicle", aCurrentVehicle) aSetSetting("currentSlap", aCurrentSlap)]] end function aPlayersTab.Refresh() local selected = getSelectedPlayer() local list = aPlayersTab.PlayerList guiGridListClear(list) local strip = guiCheckBoxGetSelected(aPlayersTab.ColorCodes) for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(list) local name = getPlayerName(player) if (strip) then name = stripColorCodes(name) end guiGridListSetItemText(list, row, 1, name, false, false) guiGridListSetItemData(list, row, 1, player) if (player == selected) then guiGridListSetSelectedItem(list, row, 1) end end end function getSelectedPlayer() local list = aPlayersTab.PlayerList local item = guiGridListGetSelectedItem(list) if (item ~= -1) then return guiGridListGetItemData(list, item, 1) end return nil end function getSensitiveText(text) if guiCheckBoxGetSelected(aPlayersTab.SensitiveData) then return ('*'):rep(utf8.len(text)) end return text end
module("lua.includer", package.seeall) local is_dotfile, explode_name, include, skeys, is_day_entry, ordinal_suffix, nice_date, output_day_entry, is_month, nice_month, output_month_entry is_dotfile = function(filename) return filename:sub(1, 1) == '.' end explode_name = function(filename) return filename:match("([^.]+)%.([^.]+)") end include = function(directory) local helper helper = function(current_directory, files) for entry in lfs.dir(current_directory) do if not is_dotfile(entry) then entry = current_directory .. "/" .. entry files[entry] = true if lfs.isdir(entry) then helper(entry, files) end end end end local all_files = { } helper(directory, all_files) return all_files end skeys = function(t) local keys do local _accum_0 = { } local _len_0 = 1 for k, _ in pairs(t) do _accum_0[_len_0] = k _len_0 = _len_0 + 1 end keys = _accum_0 end table.sort(keys) local i = 0 return function() i = i + 1 if keys[i] then return keys[i] end end end is_day_entry = function(filename) return filename:match("^%d%d%d%d/%d%d/%d%d%.tex$") ~= nil end ordinal_suffix = function(number) local _exp_0 = number if 1 == _exp_0 then return "st" elseif 2 == _exp_0 then return "nd" elseif 3 == _exp_0 then return "rd" else return "th" end end nice_date = function(date) local year, month, day = date:match("([^/]+)/([^/]+)/([^/]+)") local utime = os.time({ year = year, month = month, day = day }) local day_of_week = os.date("%A", utime) local month_name = os.date("%B", utime) day = tonumber(day) local nice_day = tostring(day) .. tostring(ordinal_suffix(day)) return tostring(day_of_week) .. ", " .. tostring(month_name) .. " " .. tostring(nice_day) end output_day_entry = function(filename) local basename, _ = explode_name(filename) tex.sprint("\\section{" .. tostring(nice_date(basename)) .. "}") tex.sprint("\\label{" .. tostring(basename) .. "}") tex.sprint("\\include*{" .. tostring(basename) .. "}") return tex.sprint("\\clearpage") end is_month = function(filename) return filename:match("^%d%d%d%d/%d%d$") ~= nil end nice_month = function(date) local year, month = date:match("([^/]+)/([^/]+)") local utime = os.time({ year = year, month = month, day = 1 }) return os.date("%B %Y", utime) end output_month_entry = function(filename) tex.sprint("\\chapter{" .. tostring(nice_month(filename)) .. "}") return tex.sprint("\\clearpage") end lua.includer.include_recent = function(year, n) local all_files = include(year) local entry_files do local _accum_0 = { } local _len_0 = 1 for f in skeys(all_files) do if is_day_entry(f) or is_month(f) then _accum_0[_len_0] = f _len_0 = _len_0 + 1 end end entry_files = _accum_0 end local skip = #entry_files - n for _, filename in ipairs(entry_files) do if skip < 1 then if is_day_entry(filename) then output_day_entry(filename) elseif is_month(filename) then output_month_entry(filename) end else skip = skip - 1 end end end lua.includer.include_year = function(year) return lua.includer.include_recent(year, math.huge) end
--[[ Copyright (C) Ordo Lunaris (Blackhand) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --]] --[[ ItemModel implementation for selling items from inventory. --]] vendor.OwnAuctionsItemModel = {} vendor.OwnAuctionsItemModel.prototype = {} vendor.OwnAuctionsItemModel.metatable = {__index = vendor.OwnAuctionsItemModel.prototype} local L = vendor.Locale.GetInstance() -- the identifiers of the supported columns vendor.OwnAuctionsItemModel.TEXTURE = 1 vendor.OwnAuctionsItemModel.NAME = 2 vendor.OwnAuctionsItemModel.COUNT = 3 vendor.OwnAuctionsItemModel.BID = 4 vendor.OwnAuctionsItemModel.BUYOUT = 5 vendor.OwnAuctionsItemModel.CURRENT_AUCTIONS = 6 vendor.OwnAuctionsItemModel.LOWER_BUYOUT = 7 vendor.OwnAuctionsItemModel.AVG_BUYOUT = 8 vendor.OwnAuctionsItemModel.UPPER_BUYOUT = 9 vendor.OwnAuctionsItemModel.TIME_LEFT = 10 local log = vendor.Debug:new("OwnAuctionsItemModel") --[[ Sorts according to a and b, taking into account heire names, if both are equal to avoid "hopping". --]] local function _SortHelper(a, b, na, nb) if (a == b) then return na < nb end return a < b end -- several sort functions local SORT_FUNCS = { [vendor.OwnAuctionsItemModel.COUNT] = { [true] = function(a, b) return _SortHelper(a.count, b.count, a.name, b.name) end, [false] = function(a, b) return _SortHelper(b.count, a.count, b.name, a.name) end }, [vendor.OwnAuctionsItemModel.CURRENT_AUCTIONS] = { [true] = function(a, b) return _SortHelper((a.currentAuctions or -1), (b.currentAuctions or -1), a.name, b.name) end, [false] = function(a, b) return _SortHelper((b.currentAuctions or -1), (a.currentAuctions or -1), b.name, a.name) end }, [vendor.OwnAuctionsItemModel.NAME] = { [true] = function(a, b) return a.name < b.name end, [false] = function(a, b) return a.name > b.name end }, [vendor.OwnAuctionsItemModel.BID] = { [true] = function(a, b) return _SortHelper((a.bid or 0) / a.count, (b.bid or 0) / b.count, a.name, b.name) end, [false] = function(a, b) return _SortHelper((b.bid or 0) / a.count, (a.bid or 0) / b.count, b.name, a.name) end }, [vendor.OwnAuctionsItemModel.BUYOUT] = { [true] = function(a, b) return _SortHelper((a.buyout or 0) / a.count, (b.buyout or 0) / b.count, a.name, b.name) end, [false] = function(a, b) return _SortHelper((b.buyout or 0) / a.count, (a.buyout or 0) / b.count, b.name, a.name) end }, [vendor.OwnAuctionsItemModel.LOWER_BUYOUT] = { [true] = function(a, b) return _SortHelper((a.lowerBuyout or 0), (b.lowerBuyout or 0), a.name, b.name) end, [false] = function(a, b) return _SortHelper((b.lowerBuyout or 0), (a.lowerBuyout or 0), b.name, a.name) end }, [vendor.OwnAuctionsItemModel.AVG_BUYOUT] = { [true] = function(a, b) return _SortHelper((a.avgBuyout or 0), (b.avgBuyout or 0), a.name, b.name) end, [false] = function(a, b) return _SortHelper((b.avgBuyout or 0), (a.avgBuyout or 0), b.name, a.name) end }, [vendor.OwnAuctionsItemModel.UPPER_BUYOUT] = { [true] = function(a, b) return _SortHelper((a.upperBuyout or 0), (b.upperBuyout or 0), a.name, b.name) end, [false] = function(a, b) return _SortHelper((b.upperBuyout or 0), (a.upperBuyout or 0), b.name, a.name) end }, [vendor.OwnAuctionsItemModel.TEXTURE] = { [true] = function(a, b) return _SortHelper(a.rarity, b.rarity, a.name, b.name) end, [false] = function(a, b) return _SortHelper(b.rarity, a.rarity, b.name, a.name) end }, [vendor.OwnAuctionsItemModel.TIME_LEFT] = { [true] = function(a, b) return _SortHelper(a.timeLeft, b.timeLeft, a.name, b.name) end, [false] = function(a, b) return _SortHelper(b.timeLeft, a.timeLeft, b.name, a.name) end } }; local function _IsOutDated(info) local time = info.leastCurrentTime or 0 -- log:Debug("_IsOutDated name [%s] now [%s] time [%s] diff [%s]", info.name, GetTime(), time, GetTime() - time) return GetTime() - time > vendor.OwnAuctions.db.profile.outDatedTimeout end --[[ Checks whether the list has to be sorted and does it in case. --]] local function _EnsureSorting(self) if (not self.sorted and self.index) then self.updateCount = self.updateCount + 1 table.sort(self.index, self.sortFunc) self.sorted = true end end --[[ Inits the table of descriptors. --]] local function _InitDescriptors(self) self.descriptors = { [vendor.OwnAuctionsItemModel.TEXTURE] = {type = "texture", title = L["Texture"], align = "LEFT", order = 1}; [vendor.OwnAuctionsItemModel.NAME] = {type = "text", align = "LEFT", weight = 35, minWidth = 60, sortable = true, title = L["Name"], order = 2}; [vendor.OwnAuctionsItemModel.COUNT] = {type = "number", align = "CENTER", weight = 10, minWidth = 20, sortable = true, title = L["Itms."], order = 3}; [vendor.OwnAuctionsItemModel.CURRENT_AUCTIONS] = {type = "text", align = "CENTER", weight = 10, minWidth = 40, sortable = true, title = L["Aucts."], order = 7}; [vendor.OwnAuctionsItemModel.TIME_LEFT] = {type = "text", align = "CENTER", weight = 10, minWidth = 40, sortable = true, title = L["Time Left"], order = 4}; [vendor.OwnAuctionsItemModel.BID] = {type = "text", align = "RIGHT", weight = 20, minWidth = 70, sortable = true, title = L["Bid"], order = 5}; [vendor.OwnAuctionsItemModel.BUYOUT] = {type = "text", align = "RIGHT", weight = 20, minWidth = 70, sortable = true, title = L["Buyout"], order = 6}; [vendor.OwnAuctionsItemModel.LOWER_BUYOUT] = {type = "text", align = "RIGHT", weight = 20, minWidth = 70, sortable = true, title = L["Lower"], order = 7}; [vendor.OwnAuctionsItemModel.AVG_BUYOUT] = {type = "text", align = "RIGHT", weight = 20, minWidth = 70, sortable = true, title = L["Average"], order = 8}; [vendor.OwnAuctionsItemModel.UPPER_BUYOUT] = {type = "text", align = "RIGHT", weight = 20, minWidth = 70, sortable = true, title = L["Upper"], order = 9}; } end local function _IsChange(a, b) local rtn = false if (not a) then rtn = b ~= nil elseif (not b) then rtn = a ~= nil else rtn = a ~= b end return rtn end --[[ Update all auction statistics, if itemLinkKey is nil. Otherwise only corresponding items will be updated. --]] local function _UpdateAuctionStatistics(self, itemLinkKey, ignoreNotifer) log:Debug("_UpdateAuctionStatistics enter itemLinkKey [%s]", itemLinkKey) if (itemLinkKey and not self.itemLinkKeys[itemLinkKey]) then log:Debug("ignore itemLinkKey [%s]", itemLinkKey) return end -- log:Debug("_UpdateAuctionStatistics self: %s itemLinkKey: %s", self, itemLinkKey) local neutralAh = vendor.AuctionHouse:IsNeutral() local hasChanged = false for _,info in pairs(self.index) do if (not itemLinkKey or itemLinkKey == info.itemLinkKey) then local avgBid, avgBuyout, lowerBid, lowerBuyout, upperBid, upperBuyout, numAuctions, numBuyouts, leastCurrentTime = vendor.Gatherer:GetCurrentAuctionInfo(info.itemLink, neutralAh, true) if (not avgBuyout) then local _, oldAvgBuyout = vendor.Gatherer:GetAuctionInfo(info.itemLink, neutralAh, true) avgBuyout = oldAvgBuyout end hasChanged = hasChanged or _IsChange(info.avgBid, avgBid) or _IsChange(info.avgBuyout, avgBuyout) or _IsChange(info.lowerBuyout, lowerBuyout) or _IsChange(info.upperBuyout, upperBuyout) or _IsChange(info.avgBuyout, avgBuyout) or _IsChange(info.currentAuctions, numAuctions) or _IsChange(info.leastCurrentTime, leastCurrentTime) info.avgBid = avgBid info.avgBuyout = avgBuyout info.lowerBuyout = lowerBuyout info.upperBuyout = upperBuyout info.currentAuctions = numAuctions info.leastCurrentTime = leastCurrentTime end end if (hasChanged) then log:Debug("has changed") self.sorted = false if (not ignoreNotifer) then for _,listener in pairs(self.updateListeners) do listener.func(listener.arg) end end end log:Debug("_UpdateAuctionStatistics exit") end --[[ Updates the list of own auctions. --]] local function _Update(self) -- we need it only, if auction house is open if (not vendor.AuctionHouse:IsOpen()) then log:Debug("ah is closed") return end GetOwnerAuctionItems(0) self.updateCount = self.updateCount + 1 log:Debug("Update enter") self.index = wipe(self.index) self.itemLinkKeys = wipe(self.itemLinkKeys) for i=1,GetNumAuctionItems("owner") do local name, texture, count, quality, _, level, unknown, minBid, minIncrement, buyoutPrice, bidAmount, highBidder, bidderFullName, owner, ownerFullName, saleStatus = GetAuctionItemInfo("owner", i) local itemLink = GetAuctionItemLink("owner", i) if (name and itemLink) then local itemLinkKey = vendor.Items:GetItemLinkKey(itemLink) local timeLeft = GetAuctionItemTimeLeft("owner", i) if (saleStatus == 1) then -- we have no count and no minBid :-( count = 1 minBid = 0 end local info = {name = name, texture = texture, count = count or 1, minBid = minBid, buyout = buyoutPrice or 0, bidAmount = bidAmount or 0, bid = math.max(minBid, bidAmount or 0), itemLink = itemLink, itemLinkKey = itemLinkKey, index = i, saleStatus = saleStatus, highBidder = highBidder, minIncrement = minIncrement or 0, quality = quality, level = level, timeLeft = timeLeft, coloredName = vendor.Format.ColorizeQuality(name, quality)} table.insert(self.index, info) self.itemLinkKeys[itemLinkKey] = true end end _UpdateAuctionStatistics(self, nil, true) self.sorted = false _EnsureSorting(self) for _,listener in pairs(self.updateListeners) do listener.func(listener.arg) end log:Debug("_Update leave size: %s", #self.index) end local function _GetMoney(money, count, outdated) local msg if (count > 1 and money > 0) then if (outdated) then return vendor.Format.FormatMoneyValuesGrayedOut(money, money * count, true) else return vendor.Format.FormatMoneyValues(money, money * count, true) end elseif (outdated) then return vendor.Format.FormatMoneyGrayedOut(money, true) else return vendor.Format.FormatMoney(money, true) end end --[[ Creates a new instance. --]] function vendor.OwnAuctionsItemModel:new() log:Debug("new") local instance = setmetatable({}, self.metatable) instance.index = {} instance.itemLinkKeys = {} instance.selectedIndex = {} instance.updateCount = 0 instance:Update() _InitDescriptors(instance) instance:Sort(vendor.OwnAuctionsItemModel.BUYOUT, true) instance.updateListeners = {} return instance end --[[ ItemModel function for returning the desired descriptor. --]] function vendor.OwnAuctionsItemModel.prototype:GetColumnDescriptor(id) return self.descriptors[id] end --[[ Returns the number of items available. --]] function vendor.OwnAuctionsItemModel.prototype:Size() return #self.index end function vendor.OwnAuctionsItemModel.prototype:GetItemLink(row) _EnsureSorting(self) local info = self.index[row] return info.itemLink end --[[ Returns the value(s) for the given row and column id. --]] function vendor.OwnAuctionsItemModel.prototype:GetValues(row, id) _EnsureSorting(self) local rtn1, rtn2, rtn3 local info = self.index[row] local outdated = _IsOutDated(info) if (id == vendor.OwnAuctionsItemModel.TEXTURE) then rtn1, rtn2, rtn3 = info.texture, info.itemLink, info.count elseif (id == vendor.OwnAuctionsItemModel.NAME) then if (info.saleStatus == 1) then if (info.highBidder) then rtn1 = L["%s - %s"]:format(info.coloredName, info.highBidder) else rtn1 = L["%s - Sold"]:format(info.coloredName) end elseif (info.bidAmount and info.bidAmount > 0 and info.saleStatus ~= 1 and info.highBidder) then rtn1 = L["%s - %s"]:format(info.coloredName, info.highBidder) else rtn1 = info.coloredName end elseif (id == vendor.OwnAuctionsItemModel.COUNT) then rtn1 = info.count elseif (id == vendor.OwnAuctionsItemModel.CURRENT_AUCTIONS) then if (outdated and info.currentAuctions) then rtn1 = vendor.OUTDATED_FONT_COLOR_CODE..info.currentAuctions..FONT_COLOR_CODE_CLOSE else rtn1 = info.currentAuctions end elseif (id == vendor.OwnAuctionsItemModel.BID) then rtn1 = _GetMoney(info.bid / info.count, info.count) elseif (id == vendor.OwnAuctionsItemModel.BUYOUT) then rtn1 = _GetMoney(info.buyout / info.count, info.count) elseif (id == vendor.OwnAuctionsItemModel.LOWER_BUYOUT) then rtn1 = _GetMoney(info.lowerBuyout or 0, info.count, outdated) elseif (id == vendor.OwnAuctionsItemModel.AVG_BUYOUT) then rtn1 = _GetMoney(info.avgBuyout or 0, info.count, outdated) elseif (id == vendor.OwnAuctionsItemModel.UPPER_BUYOUT) then rtn1 = _GetMoney(info.upperBuyout or 0, info.count, outdated) elseif (id == vendor.OwnAuctionsItemModel.TIME_LEFT) then if (info.saleStatus == 1 and info.timeLeft and info.timeLeft > 0) then rtn1 = AUCTION_ITEM_TIME_UNTIL_DELIVERY:format(SecondsToTime(info.timeLeft)) rtn2 = AUCTION_ITEM_TIME_UNTIL_DELIVERY:format(SecondsToTime(info.timeLeft)) elseif (info.timeLeft and info.timeLeft >= 1 and info.timeLeft <= 4) then rtn1 = AuctionFrame_GetTimeLeftText(info.timeLeft) rtn2 = AuctionFrame_GetTimeLeftTooltipText(info.timeLeft) else rtn1 = "???" end else error("unknown id: "..(id or "NA")); end -- log:Debug("GetValues row [%s] id [%s] rtn1 [%s] rtn2 [%s] rtn3 [%s]", row, id, rtn1, rtn2, rtn3) return rtn1, rtn2, rtn3 end function vendor.OwnAuctionsItemModel.prototype:GetHighlight(row) local highlight = nil _EnsureSorting(self) local info = self.index[row] if (info.saleStatus == 1) then highlight = self.soldHighlight elseif (info.lowerBuyout and info.lowerBuyout > 0 and info.lowerBuyout < (info.buyout / info.count)) then highlight = self.undercutHighlight elseif (not highlight and info.bidAmount and info.bidAmount > 0) then highlight = self.withBidHighlight end return highlight end --[[ Returns the auction data for the given row as index, itemLinkKey, itemLink, name, texture, count, bid, buyout, lowerBuyout, saleStatus, outdated, minBid, bidAmount, minIncrement, timeLeft, quality, level --]] function vendor.OwnAuctionsItemModel.prototype:Get(row) local info = self.index[row] return info.index, info.itemLinkKey, info.itemLink, info.name, info.texture, info.count, info.bid, info.buyout, info.lowerBuyout, info.saleStatus, _IsOutDated(info), info.minBid, info.bidAmount, info.minIncrement, info.timeLeft, info.quality, info.level end --[[ Sorts according to the given column. --]] function vendor.OwnAuctionsItemModel.prototype:Sort(id, ascending) vendor.Vendor:Debug("Sort id: %d ascending: %s", id, ascending) local sortable = self.descriptors[id].sortable if (sortable) then self.sortFunc = SORT_FUNCS[id][ascending] self.sorted = false self.sortId = id self.ascending = ascending _EnsureSorting(self) end end --[[ Toggles the sort state for the given type. If it's currently not the sorting criteria, then it will be activated and set to ascending. --]] function vendor.OwnAuctionsItemModel.prototype:ToggleSort(id) vendor.Vendor:Debug("ToggleSort id: %d", id) if (id == self.sortId) then self:Sort(id, not self.ascending) else self:Sort(id, true) end end --[[ Returns the sorted id and whether it's ascending. --]] function vendor.OwnAuctionsItemModel.prototype:GetSortInfo() return self.sortId, self.ascending end --[[ Selects the given item. --]] function vendor.OwnAuctionsItemModel.prototype:SelectItem(row, selected) self.index[row].selected = selected self.updateCount = self.updateCount + 1 end --[[ Returns whether the given item was selected. --]] function vendor.OwnAuctionsItemModel.prototype:IsSelected(row) _EnsureSorting(self) return self.index[row].selected end --[[ Returns the map with the indices of the selected items. --]] function vendor.OwnAuctionsItemModel.prototype:GetSelectedItems() _EnsureSorting(self) if (self.updateCount ~= self.selectedUpdateCount) then self.selectedIndex = wipe(self.selectedIndex) for i=1,#self.index do if (self.index[i].selected) then table.insert(self.selectedIndex, i) end end self.selectedUpdateCount = self.updateCount end return self.selectedIndex end --[[ Updates the list of items in inventory. --]] function vendor.OwnAuctionsItemModel.prototype:Update() _Update(self) end --[[ Updates the auction statistics of the own auctions. --]] function vendor.OwnAuctionsItemModel.prototype:UpdateAuctionStatistics(itemLinkKey) _UpdateAuctionStatistics(self, itemLinkKey) end function vendor.OwnAuctionsItemModel.prototype:SetWithBidHighlight(id) self.withBidHighlight = id end function vendor.OwnAuctionsItemModel.prototype:SetUndercutHighlight(id) self.undercutHighlight = id end function vendor.OwnAuctionsItemModel.prototype:SetSoldHighlight(id) self.soldHighlight = id end --[[ Registers a function that will be called, if the model has been updated. --]] function vendor.OwnAuctionsItemModel.prototype:RegisterUpdateListener(func, arg) table.insert(self.updateListeners, {func = func, arg = arg}) end
function EventHorizon:InitializeClass() self.config.gcdSpellID = 162794 self.config.past = -1.5 -- Number of seconds to show in the past. Default = -3 self.config.future = 12 -- Number of seconds to show in the future. Default = 12 -- Havoc -- Blade Dance self:newSpell({ requiredTree = 1, requiredLevel = 12, cooldown = 188499, playerbuff = 188499, }) -- Fel Rush self:newSpell({ requiredTree = 1, -- requiredLevel = 98, recharge = 195072, }) -- Felblade self:newSpell({ requiredTree = 1, requiredTalent = 3, cooldown = 232893, }) -- Vengeful Retreat self:newSpell({ requiredTree = 1, cooldown = 198793, }) -- Glaive Tempest self:newSpell({ requiredTree = 1, requiredTalent = 9, cooldown = 342817 }) -- Essence Break self:newSpell({ requiredTree = 1, requiredTalent = 15, cooldown = 258860, debuff = 320338 }) -- Fel Eruption self:newSpell({ requiredTree = 1, requiredTalent = 18, debuff = 211881, cooldown = 211881, }) -- Eye Beam self:newSpell({ requiredTree = 1, requiredLevel = 11, cooldown = 198013, }) -- Immolation Auro self:newSpell({ requiredTree = 1, requiredLevel = 27, playerbuff = 258920, cooldown = 258920, }) -- Fel Barrage self:newSpell({ requiredTree = 1, requiredTalent = 21, cooldown = 258925, }) -- -- Fury of the Illidari -- self:newSpell({ -- requiredTree = 1, -- requiredArtifactTalent = 201467, -- playerbuff = 201467, -- cooldown = 201467, -- }) -- Throw Glaive self:newSpell({ requiredTree = 1, requiredLevel = 10, recharge = 185123, }) -- Chaos Nova -- self:newSpell({ -- requiredTree = 1, -- requiredLevel = 100, -- cooldown = 179057, -- }) -- Defensive abilities, hidden by default due to the huge ammount of bars this spec has, remove the --[[ and ]]-- from the spell configs for any you'd like to display. --[[ -- Blur self:newSpell({ requiredTree = 1, requiredLevel = 21, cooldown = 198589, }) ]]-- --[[ -- Darkness self:newSpell({ requiredTree = 1, requiredLevel = 39, cooldown = 196718, }) ]]-- --[[ -- Netherwalk self:newSpell({ requiredTree = 1, requiredTalent = 12, cooldown = 196555, }) ]]-- -- Vengeance -- Soul Fragments self:newSpell({ requiredTree = 2, playerbuff = 203981, recharge = 189110, barcolors = { playerbuff = {128/255, 025/255, 157/255, 0.7}, recharge = {171/255, 191/255, 181/255, 0.5} }, }) -- Demon Spikes self:newSpell({ requiredTree = 2, requiredLevel = 1, playerbuff = 203720, recharge = 203720, barcolors = { playerbuff = {232/255, 202/255, 000/255, 0.7}, recharge = {171/255, 191/255, 181/255, 0.4} }, }) -- Immolation Aura self:newSpell({ requiredTree = 2, requiredLevel = 14, playerbuff = 258920, cooldown = 258920, barcolors = { playerbuff = {205/255, 237/255, 069/255, 0.7}, cooldown = {171/255, 191/255, 181/255, 0.5} }, }) -- Felblade self:newSpell({ requiredTree = 2, requiredTalent = 3, cooldown = 232893, }) -- Spirit Bomb self:newSpell({ requiredTree = 2, requiredTalent = 9, debuff = 247456, }) -- Fracture self:newSpell({ requiredTree = 2, requiredTalent = 12, recharge = 263642 }) -- Fel Eruption -- self:newSpell({ -- requiredTree = 2, -- requiredTalent = 9, -- playerbuff = 211881, -- cooldown = 211881, -- }) -- Sigil of Flame self:newSpell({ requiredTree = 2, requiredLevel = 12, debuff = 204596, cooldown = 204596, barcolors = { playerbuff = {070/255, 101/255, 009/255, 0.7}, cooldown = {171/255, 191/255, 181/255, 0.5} }, }) -- Soul Barrier self:newSpell({ requiredTree = 2, requiredTalent = 18, playerbuff = 263648, cooldown = 263648, }) -- Bulk Extraction self:newSpell({ requiredTree = 2, requiredTalent = 21, cooldown = 320341 }) -- Soul Carver -- self:newSpell({ -- requiredTree = 2, -- requiredArtifactTalent = 207407, -- cooldown = 207407, -- debuff = 207407, -- barcolors = { -- debuffmine = {202/255, 161/255, 055/255, 0.9}, -- cooldown = {202/255, 161/255, 055/255, 0.5} -- }, -- }) -- Sigil of Chains self:newSpell({ requiredTree = 2, requiredTalent = 15, debuff = 202138, cooldown = 202138, }) -- Fel Devastation self:newSpell({ requiredTree = 2, requiredLevel = 11, cooldown = 212084, }) -- Fiery Brand self:newSpell({ requiredTree = 2, requiredLevel = 1, debuff = 207744, cooldown = 204021, barcolors = { debuffmine = {151/255, 252/255, 131/255, 0.7}, cooldown = {171/255, 191/255, 181/255, 0.5} }, }) -- Metamorphosis self:newSpell({ requiredTree = 2, playerbuff = 187827, cooldown = 187827, barcolors = { playerbuff = {040/255, 050/255, 050/255, 0.7}, cooldown = {171/255, 191/255, 181/255, 0.5} }, }) end
return { PlaceObj("ModItemOptionToggle", { "name", "EnableMod", "DisplayName", T(302535920011303, "<color ChoGGi_yellow>Enable Mod</color>"), "Help", T(302535920011793, "Disable mod without having to see missing mod msg."), "DefaultValue", true, }), PlaceObj("ModItemOptionToggle", { "name", "SkipGrid0", "DisplayName", table.concat(T(9428, "Skip") .. " " .. T{11629, "GRID <i>", i = 0}), "Help", T(302535920011573, "Grids with production+consumption = 0 (doesn't skip grids that aren't producing due to throttle)."), "DefaultValue", true, }), PlaceObj("ModItemOptionToggle", { "name", "SkipGrid1", "DisplayName", table.concat(T(9428, "Skip") .. " " .. T{11629, "GRID <i>", i = 1}), "Help", T(302535920011572, "Grids that only have a single bld (sensor towers)."), "DefaultValue", true, }), PlaceObj("ModItemOptionNumber", { "name", "SkipGridX", "DisplayName", table.concat(T(9428, "Skip") .. " " .. T{11629, "GRID <i>", i = "X"}), "Help", T(302535920011571, "Grids that only have X amount of buildings (for smaller clusters, like a concrete \"hub\", 0 to disable)."), "DefaultValue", 0, "MinValue", 0, "MaxValue", 50, }), PlaceObj("ModItemOptionNumber", { "name", "DepositRemainingWarning", "DisplayName", T(302535920011939, "Deposit Remaining Warning"), "Help", T(302535920011940, "Show warning message when resource deposits (all of a single type) are below X amount (0 to disable)."), "DefaultValue", 100, "MinValue", 0, "MaxValue", 1000, }), PlaceObj("ModItemOptionToggle", { "name", "MergedGrids", "DisplayName", T(302535920011492, "Merge Grid Info"), "Help", T(302535920011569, "Splits each grid into a separate section in the tooltip."), "DefaultValue", true, }), PlaceObj("ModItemOptionNumber", { "name", "RolloverWidth", "DisplayName", table.concat(T(1000112, "Rollover") .. " " .. T(326044431931, "SIZE")), "Help", T(302535920011568, "Game default is 45, if you want the tooltips wider use this (I use small UI scale)."), "DefaultValue", 45, "MinValue", 0, "MaxValue", 100, }), PlaceObj("ModItemOptionToggle", { "name", "DisableTransparency", "DisplayName", T(302535920011577, "Disable Transparency"), "Help", T(302535920011576, "Disable transparency of Infobar."), "DefaultValue", false, }), PlaceObj("ModItemOptionToggle", { "name", "AlwaysShowRemaining", "DisplayName", T(302535920011828, "Always Show Remaining"), "Help", T(302535920011829, "Keep showing remaining amount of resources instead of N/A when prod over consump (time formatting only shows hours for neg numbers, this game uses 24 per Sol)."), "DefaultValue", false, }), }
--[[ © 2013 GmodLive private project do not share without permission of its author (Andrew Mensky vk.com/men232). --]] local greenCode = greenCode; local PLUGIN = PLUGIN or greenCode.plugin:Loader(); PLUGIN.class = {}; local TER_PLUGIN = greenCode.plugin:Get("territory"); greenCode.config:Add( "rent_time", 15, false, false, false ); function PLUGIN:TerritorySystemInitialized() TERRITORY_PERMISSION_CLASS:New{ name = "owner", desc = "Permission for owning", default = false }:Register(); TERRITORY_PERMISSION_CLASS:New{ name = "coowner", desc = "Permission for co-owning", default = false }:Register(); TERRITORY_PERMISSION_CLASS:New{ name = "canowning", desc = "Permission allow owning", default = false }:Register(); end; local playerMeta = FindMetaTable("Player"); function playerMeta:HoldingCount() return PLUGIN:HoldingCount( self ); end; function PLUGIN:HoldingCount( player ) local nCount = 0; for _, TERRITORY in pairs(TER_PLUGIN:GetStored()) do if ( TERRITORY:GetOwnerLevel(player) > 0 ) then nCount = nCount + 1; end; end; return nCount; end; -- A function to register class. function PLUGIN:RegisterPrice( sName, sDesc, funcAfford, funcAdd, cur ) self.class[ sName ] = { desc = sDesc, funcAfford = funcAfford, funcAdd = funcAdd, cur = cur }; end; function PLUGIN:P_CanAfford( sName, player, nAmount ) if ( self.class[sName] ) then return self.class[sName].funcAfford( player, nAmount ); end; return false, "Incorrect price type."; end; function PLUGIN:P_AddMoney( sName, player, nAmount ) if ( self.class[sName] ) then local bDone = self.class[sName].funcAdd(player, nAmount); if ( bDone != nil ) then return bDone; end; return true; end; return false, "Incorrect price type."; end; PLUGIN:RegisterPrice( "session", "Покупка на 1 игровой сеанс", playerMeta.CanAfford, playerMeta.AddMoney, "$" ); PLUGIN:RegisterPrice( "rent", "Аренда на "..greenCode.config:Get("rent_time"):Get(15).." мин", playerMeta.CanAfford, playerMeta.AddMoney, "$" ); PLUGIN:RegisterPrice( "perm", "Покупка на вечное владение", playerMeta.CanAfford, playerMeta.AddMoney, "$" ); --------------------- -- TERRITORY CLASS -- --------------------- function TERRITORY_CLASS:GetOwners() return self("owner", {}); end; function TERRITORY_CLASS:GetCoOwners() return self("coowner", {}); end; function TERRITORY_CLASS:IsOwned() return table.Count(self:GetOwners()) > 0 or table.Count(self:GetCoOwners()) > 0 end; function TERRITORY_CLASS:GetPrice( sType ) local nPrice = self("price",{})[sType] or 0; if ( sType == "session" or sType == "rent" ) then return greenCode.plugin:Call( "GetPrice", nPrice ) or nPrice; end; return nPrice; end; function TERRITORY_CLASS:GetOnlineOwners( bCoOwn ) local tOwners = {}; for uid, _ in pairs( self:GetOwners() ) do local player = _player.GetByUniqueID(tostring(uid)); if ( player ) then table.insert( tOwners, player ); end; end; if ( bCoOwn ) then for uid, _ in pairs( self:GetCoOwners() ) do local player = _player.GetByUniqueID(tostring(uid)); if ( player ) then table.insert( tOwners, player ); end; end; end; return tOwners; end; function TERRITORY_CLASS:GetAllPrice() local tPriceData = self("price",{}); tPriceData.session = greenCode.plugin:Call( "GetPrice", tPriceData.session or 0 ) or tPriceData.session or 0; return tPriceData; end; -- A function to get all doors location in territory. function TERRITORY_CLASS:GetDoors() local tDoors = {}; for k, v in pairs(_ents.GetAll()) do if ( greenCode.entity:IsDoor( v ) and self:IsInside( v:GetPos() ) ) then table.insert( tDoors, v ); end; end; return tDoors; end; if SERVER then function TERRITORY_CLASS:SetPrice( sType, nAmount ) if ( PLUGIN.class[sType] ) then local tPriceData = self("price",{}); tPriceData[sType] = nAmount; self:SetData( "price", tPriceData ); return true; end; return false, "Incorrect price type."; end; function TERRITORY_CLASS:RemoveAllOwners() local tPermissionData = self:GetPerm().private; if ( tPermissionData ) then for uid, _ in pairs( tPermissionData ) do self:SetPermission( "private", "coowner", uid, nil ); self:SetPermission( "private", "owner", uid, nil ); end; end; end; function TERRITORY_CLASS:SetOwner( player ) if ( self:GetPermission( "canowning", player, false ) ) then self:RemoveAllOwners(); return self:SetPermission( "private", "owner", player, true, os.time() ); else return false, "Вы не можете владеть этим."; end; end; function TERRITORY_CLASS:AddCoOwner( calling_ply, target_ply ) local parentUID = self("ownerSession"); if ( table.Count( self:GetOwners() ) > 0 and parentUID ) then local bDone, sReason, SESSION = self:SetPermission( "private", "coowner", target_ply, true, os.time() ); if ( bDone ) then greenCode.plugin:Call( "OnTerritoryAddCoOwner", self, calling_ply, target_ply, SESSION ); end; return bDone, sReason, SESSION; else return false, "Нет основного владельца."; end; end; function TERRITORY_CLASS:RemoveCoOwner( calling_ply, target_ply ) if ( self:GetOwnerLevel(target_ply) == 1 ) then local bDone, sReason, SESSION = self:SetPermission( "private", "coowner", target_ply, nil ); if ( bDone ) then greenCode.plugin:Call( "OnTerritoryRemoveCoOwner", self, calling_ply, target_ply, SESSION ); end; return bDone, sReason, SESSION; else return false, "Нет прав." end; end; function TERRITORY_CLASS:GetOwnerLevel( player ) if ( self:IsValid() ) then if ( self:GetPermission( "owner", player, false ) ) then return 2; elseif ( self:GetPermission( "coowner", player, false ) ) then return 1; end; end; return 0; end; function TERRITORY_CLASS:Buy( player, sPriceType ) local bDone, sReason = greenCode.plugin:Call( "PlayerCanBuyTerritory", self, player, sPriceType ); if ( bDone != false ) then bDone, sReason, SESSION = self:SetOwner( player ); if ( bDone ) then PLUGIN:P_AddMoney( sPriceType, player, -self:GetPrice(sPriceType) ); self:SetData("lastBuyType", sPriceType); greenCode.plugin:Call( "OnTerritoryBuy", self, player, sPriceType, SESSION ); end; end; return bDone, sReason; end; -- A function to sell territory. function TERRITORY_CLASS:Sell( player ) local bCanSell, sMsg = greenCode.plugin:Call( "PlayerCanSellTerritory", self, player ); if ( bCanSell != false ) then local nPriceType = self("lastBuyType", "session"); if ( !PLUGIN.class[nPriceType] ) then nPriceType = PLUGIN.class[1]; end; bCanSell, sMsg = PLUGIN:P_AddMoney( nPriceType, player, math.ceil(self:GetPrice(nPriceType)/2) ); if ( bCanSell ) then self.data.ownerSession = -1; -- Clean owner session. self:RemoveAllOwners(); greenCode.plugin:Call( "OnTerritorySell", self, player ); return true; end; end; return bCanSell, sMsg; end; function TERRITORY_CLASS:UpdateDoorOwner( player, bAllow ) local nOwnerLevel = self:GetOwnerLevel( player ); for _, door in pairs( self:GetDoors() ) do if ( door and IsValid(door) ) then if ( bAllow and door:IsOwnable() ) then if ( nOwnerLevel > 1 and !door:IsOwned() and !door:OwnedBy(player) ) then door:RemoveAllowed(player); door:Own(player); continue; elseif ( door:IsOwned() ) then door:AddAllowed(player); end; door:Own(player); else door:RemoveAllowed(player); door:UnOwn(player); end; end; end; end; else function TERRITORY_CLASS:GetOwnerLevel( player ) if ( self:IsValid() ) then local uid = tonumber(player:UniqueID()); if ( self:GetOwners()[uid] ) then return 2; elseif ( self:GetCoOwners()[uid] ) then return 1; end; end; return 0; end; end; -------------------- -- TERRITORY HOOK -- -------------------- if CLIENT then return end; function PLUGIN:OnTerritoryGetPermission( TERRITORY, sPermissionName, player ) if ( sPermissionName == "spawnobject" and TERRITORY:GetOwnerLevel(player) > 0 ) then return true, "Is owner!"; end; end; function PLUGIN:PlayerCharacterInitialized( player ) for _, TERRITORY in pairs(TER_PLUGIN:GetStored()) do if ( TERRITORY:GetOwnerLevel(player) > 0 ) then TERRITORY:UpdateDoorOwner(player, true); end; end; end; function PLUGIN:OnTerrytoryChangeOwners( TERRITORY, player, bValue ) if ( type(player) == "number" ) then player = _player.GetByUniqueID(tostring(player)); end; if ( player and type(player) == "Player" ) then timer.Simple(1, function() if ( IsValid(player) ) then TERRITORY:UpdateDoorOwner(player, tobool(bValue)); end; end); end; end; function PLUGIN:PlayerCanBuyTerritory( TERRITORY, player, sPriceType ) local nPrice = TERRITORY:GetPrice( sPriceType ); if ( !self.class[sPriceType] ) then return false, "Incorrect price type." elseif ( TERRITORY:GetOwnerLevel(player) > 0 ) then return false, "Вы уже владелец этой территорией."; elseif ( TERRITORY:IsOwned() ) then local tOwnerNames = {} for uid, v in pairs( TERRITORY:GetOwners() ) do table.insert( tOwnerNames, v.name ) end; return false, "Эта территория уже занята: " .. table.concat( tOwnerNames, ", " ).."."; elseif ( nPrice <= 0 ) then return false, "Эта территории бесценна =) Позовите админа, пусть исправит!"; elseif ( !self:P_CanAfford( sPriceType, player, nPrice ) ) then return false, "Вам это не по корману!"; end; end; function PLUGIN:PlayerCanSellTerritory( TERRITORY, player ) if ( TERRITORY:GetOwnerLevel(player) < 2 ) then return false, "Вы не можете продать эту территорию."; end; end; function PLUGIN:OnTerritoryChangePermission( TERRITORY, sPermissionName, sCharterName, player, bValue ) if ( sPermissionName == "owner" or sPermissionName == "coowner" ) then local uid, sid, sName = greenCode.session:GetPlayerData(player); local tData = sPermissionName == "owner" and TERRITORY:GetOwners() or TERRITORY:GetCoOwners(); if ( bValue ) then tData[uid] = { name = sName, sid = sid }; else tData[uid] = nil; end; TERRITORY:SetData( sPermissionName, tData ); greenCode.plugin:Call( "OnTerrytoryChangeOwners", TERRITORY, player, bValue ); elseif ( sPermissionName == "canowning" and sCharterName == "public" ) then TERRITORY:SetData( "forsale", bValue ); elseif ( sPermissionName == "spawnobject" and sCharterName == "private" ) then local uid, _, sName = greenCode.session:GetPlayerData(player); local tPropSpawnData = TERRITORY("propSpawn", {}); tPropSpawnData[uid] = bValue and sName or nil; TERRITORY:SetData( "propSpawn", tPropSpawnData ); end; end; function PLUGIN:OnTerrytoryCreate( tTerritoryData ) tTerritoryData["owner"] = {}; tTerritoryData["coowner"] = {}; tTerritoryData["price"] = { session = 0 }; tTerritoryData["forsale"] = false; tTerritoryData["propSpawn"] = {}; tTerritoryData["ownerSession"] = 0; tTerritoryData["_rent"] = 0; tTerritoryData["lastBuyType"] = ""; end; -- Called when player try buy door. function PLUGIN:PlayerBuyDoor( player, eDoor ) local TERRITORY = TER_PLUGIN:GetLocation( eDoor:GetPos() ); if ( TERRITORY and TERRITORY:IsValid() and !eDoor:AllowedToOwn( player ) and TERRITORY:GetOwnerLevel(player) < 2 ) then GAMEMODE:Notify( player, 1, 4, "Дверь часть территории '" .. TERRITORY:GetName().. "'." ); return false; end; end; -- Called when player try buy door. function PLUGIN:PlayerSellDoor( player, eDoor ) local TERRITORY = TER_PLUGIN:GetLocation( eDoor:GetPos() ); if ( TERRITORY and TERRITORY:IsValid() and TERRITORY:UniqueID() != 0 ) then GAMEMODE:Notify( player, 1, 4, "Дверь часть территории '" .. TERRITORY:GetName().. "'." ); return false; end; end; function PLUGIN:OnTerritoryPrintInfo( player, TERRITORY ) ULib.console( player, "\t\tOwner Level = " .. TERRITORY:GetOwnerLevel(player) ); ULib.console( player, "\t\tFor sale = " .. tostring(TERRITORY("forsale",false)) ); ULib.console( player, "\t\tLast Buy = " .. tostring(TERRITORY("lastBuyType","none")) ); ULib.console( player, "\t\tPrice:" ); for sType, nAmount in pairs( TERRITORY:GetAllPrice() ) do ULib.console( player, "\t\t\t"..sType.." = " .. nAmount ); end; end; -- Called when player buy some territory. function PLUGIN:OnTerritoryBuy( TERRITORY, player, sPriceType, SESSION ) -- to session buy, parent session to player. if ( sPriceType == "session" ) then SESSION:SetParent( tonumber(player:UniqueID()) ); elseif ( sPriceType == "rent" ) then SESSION:SetTimeOut( greenCode.config:Get("rent_time"):Get(15)*60 ); SESSION:SetParent(-1); -- Clean parent if before playey buy in seesion. elseif ( sPriceType == "perm" ) then SESSION:SetParent(-1); -- Clean parent if before playey buy in seesion or rent. end; TERRITORY:SetData("ownerSession", SESSION:UniqueID()); player:EmitSound( "greencode/mission_passed"..math.random(1,2)..".mp3" ); greenCode.hint:SendAll( player:Name().." купил территорию ["..TERRITORY:GetName().."] "..sPriceType..".", 5, Color( 100, 255, 100 ) ); player:ConCommand("cl_gc_custommenu_update 7920"); end; -- This fix to shared.lua GAMEMODE.DefaultTeam = TEAM_CITIZEN; -- Called when player sell some territory. function PLUGIN:OnTerritorySell( TERRITORY, player ) -- Set default team if ( self:HoldingCount(player) < 1 ) then player:ChangeTeam(GAMEMODE.DefaultTeam, true); end; -- Remove props. local tRemovedProps = { "Territory "..TERRITORY:Name().." - "..TERRITORY:UniqueID().." sell removed props:" }; for k, v in pairs( _ents.GetAll() ) do if ( v.FPPOwnerID and TER_PLUGIN:GetLocation( v:GetPos() ) == TERRITORY ) then table.insert( tRemovedProps, "["..v.FPPOwnerID.."] ["..v:EntIndex().." ["..v:GetClass().."]" ); v:Remove(); end; end; if ( #tRemovedProps > 1 ) then greenCode:Debug( table.concat(tRemovedProps, "\n\t\t") ); end; -- Update info greenCode.hint:SendAll( player:Name().." продал территорию ["..TERRITORY:GetName().."] "..".", 5, Color( 100, 255, 100 ) ); player:ConCommand("cl_gc_custommenu_update 7920"); end; function PLUGIN:OnTerritorySendData( tTerritoryData ) tTerritoryData.ownerSession = nil; end; function PLUGIN:OnSessionChangeTimeOut( SESSION, nValue, nPrev ) local tData = SESSION("territoryData"); if ( tData and tData.permission == "owner" ) then local TERRITORY = TER_PLUGIN:FindByID(tData.uid); if ( TERRITORY and TERRITORY:IsValid() and TERRITORY("lastBuyType") == "rent" ) then local curTime = CurTime(); local nEndTime = math.ceil( curTime + nValue ); local difference = math.abs(TERRITORY("_rent", 0) - nEndTime); if ( difference > 1 ) then TERRITORY:SetData("_rent", nEndTime); end; if ( nValue == 300 or nValue == 180 or nValue == 180 ) then for _, player in pairs( TERRITORY:GetOnlineOwners() ) do greenCode.hint:Send( player, "До продления аренды '"..TERRITORY:Name().."' осталось "..math.Round(nValue/60).." мин.", 5, Color( 255, 255, 100 ), nil, true ); end; end; end; end; end; function PLUGIN:GroupPay( tGroup, nPrice ) local nGoodPrice = math.Round( nPrice / #tGroup ); for k, player in pairs( tGroup ) do if ( !self:P_CanAfford( "rent", player, nGoodPrice ) and !player:DepositsCanAfford(nGoodPrice) ) then local nNotHave = nGoodPrice - (player:getDarkRPVar("money") or 0); player.gcGroupPay = player.gcGroupPay + (nGoodPrice - nNotHave); tGroup[k] = nil; return self:GroupPay( tGroup, nPrice - (nGoodPrice-nNotHave) ); else player.gcGroupPay = player.gcGroupPay + nGoodPrice; nPrice = nPrice - nGoodPrice; end; end; return nPrice; end; function PLUGIN:PreSessionClose( SESSION, uid ) local tData = SESSION("territoryData"); if ( tData ) then local TERRITORY = TER_PLUGIN:FindByID(tData.uid); if ( TERRITORY and TERRITORY:IsValid() and TERRITORY("lastBuyType") == "rent" ) then local nPrice = TERRITORY:GetPrice("rent"); local tOwners = TERRITORY:GetOnlineOwners(); local nGoodPrice = math.Round( nPrice / #tOwners ); for _, player in pairs( tOwners ) do player.gcGroupPay = 0; end; local nCost = self:GroupPay( tOwners, nPrice ); if ( nCost <= 0 ) then for _, player in pairs( tOwners ) do local bShouldDeposit = false; local DEPOSIT; if ( self:P_CanAfford( "rent", player, player.gcGroupPay ) ) then self:P_AddMoney( "rent", player, -player.gcGroupPay ); else DEPOSIT = player:DepositsCanAfford(-player.gcGroupPay); if ( DEPOSIT ) then DEPOSIT:AddMoney(-player.gcGroupPay); bShouldDeposit = true; end; end; greenCode.hint:Send( player, "Автоматическое продление аренды '"..TERRITORY:Name().."' "..greenCode.kernel:FormatNumber(player.gcGroupPay).."$"..( bShouldDeposit and " Оплата со счета #"..DEPOSIT:UniqueID().." - "..DEPOSIT:Name().."." or "" ), 5, Color( 255, 255, 100 ), nil, true ); end; SESSION:SetTimeOut( greenCode.config:Get("rent_time"):Get(15)*60 ); end; end; end; end; -------------------- -- PLUGIN COMMAND -- -------------------- greenCode.command:Add( "ter_buy", 0, function( player, command, args ) if ( #args < 2 ) then return; end; local bDone, sReason; local TERRITORY = TER_PLUGIN:FindByID(tonumber(args[1])) or TER_PLUGIN:FindByName(args[1]); if ( TERRITORY and TERRITORY:IsValid() ) then bDone, sReason = TERRITORY:Buy( player, args[2] ); else bDone, sReason = false, "Territory not found."; end; if ( !bDone ) then greenCode.hint:Send( player, sReason, 5, Color( 255, 100, 100 ), nil, true ); end end); greenCode.command:Add( "ter_sell", 0, function( player, command, args ) if ( #args < 1 ) then return; end; local bDone, sReason; local TERRITORY = TER_PLUGIN:FindByID(tonumber(args[1])) or TER_PLUGIN:FindByName(args[1]); if ( TERRITORY and TERRITORY:IsValid() ) then bDone, sReason = TERRITORY:Sell( player, args[2] ); else bDone, sReason = false, "Territory not found."; end; if ( !bDone ) then greenCode.hint:Send( player, sReason, 5, Color( 255, 100, 100 ), nil, true ); end end); greenCode.command:Add( "ter_allowcoown", 0, function( player, command, args ) if ( #args < 3 ) then return; end; local bDone, sReason; local TERRITORY = TER_PLUGIN:FindByID(tonumber(args[1])) or TER_PLUGIN:FindByName(args[1]); local bValue = tobool(args[3]) or nil; local TARGET_PLY_SESSION; if ( TERRITORY and TERRITORY:IsValid() ) then if ( TERRITORY:GetOwnerLevel(player) > 1 ) then local target_ply_uid, calling_ply_uid = tonumber(args[2]), tonumber(player:UniqueID()); TARGET_PLY_SESSION = greenCode.session:FindByID(target_ply_uid or -1); if ( target_ply_uid != calling_ply_uid and TARGET_PLY_SESSION and TARGET_PLY_SESSION:IsValid() and TARGET_PLY_SESSION("sid") ) then local sessionName = "private_"..calling_ply_uid.."_owner_"..TERRITORY:UniqueID(); local sessionUID = tonumber(util.CRC(sessionName)); local OWN_SESSION = greenCode.session:FindByID(sessionUID); if ( OWN_SESSION and OWN_SESSION:IsValid() and OWN_SESSION("territoryData") ) then local bShould, sError, PERM_SESSION; if ( bValue ) then bShould, sError, PERM_SESSION = TERRITORY:AddCoOwner( player, target_ply_uid ); else bShould, sError, PERM_SESSION = TERRITORY:RemoveCoOwner( player, target_ply_uid ); end; if ( bShould ) then PERM_SESSION:SetParent(OWN_SESSION:UniqueID()); -- Remove coowner when owner buy session in close. player:ConCommand("cl_gc_custommenu_update 7920"); bDone, sReason = bValue, "Вы "..(bValue and "добавили в совладельци " or "удалили из совладельцев ")..TARGET_PLY_SESSION:Name().." на '"..TERRITORY:Name().."'."; else sReason = sError; end; else bDone, sReason = false, "Inccorect owner session uid."; end; else bDone, sReason = false, "Inccorect player uid."; end; else bDone, sReason = false, "У вас нет прав."; end; else bDone, sReason = false, "Territory not found."; end; if ( bDone ) then greenCode.hint:SendAll( player:Name()..(bValue and "добавил в совладельци " or "удалил из совладельцев ")..TARGET_PLY_SESSION:Name().." на '"..TERRITORY:Name().."'.", 5, bValue and Color(100,255,100) or Color(255,100,100), nil, true ); else greenCode.hint:Send( player, sReason, 5, Color(255,100,100), nil, true ); end; end); greenCode.command:Add( "ter_allowspawn", 0, function( player, command, args ) if ( #args < 3 ) then return; end; local bDone, sReason; local TERRITORY = TER_PLUGIN:FindByID(tonumber(args[1])) or TER_PLUGIN:FindByName(args[1]); local bValue = tobool(args[3]) or nil; local PLY_SESSION if ( TERRITORY and TERRITORY:IsValid() ) then local nOwnerLevel = TERRITORY:GetOwnerLevel(player); if ( nOwnerLevel > 0 ) then local target_ply_uid, calling_ply_uid = tonumber(args[2]), tonumber(player:UniqueID()); PLY_SESSION = greenCode.session:FindByID(target_ply_uid or -1); if ( target_ply_uid != calling_ply_uid and PLY_SESSION and PLY_SESSION:IsValid() and PLY_SESSION("sid") ) then local sessionName = "private_"..calling_ply_uid..( nOwnerLevel > 1 and "_owner_" or "_coowner_")..TERRITORY:UniqueID(); local sessionUID = tonumber(util.CRC(sessionName)); local OWN_SESSION = greenCode.session:FindByID(sessionUID); if ( OWN_SESSION and OWN_SESSION:IsValid() and OWN_SESSION("territoryData") ) then local bShould, sError, PERM_SESSION = TERRITORY:SetPermission( "private", "spawnobject", target_ply_uid, bValue, bValue and os.time() ); if ( bShould ) then PERM_SESSION:SetParent(OWN_SESSION:UniqueID()); -- Remove propspawn when owner buy session in close. player:ConCommand("cl_gc_custommenu_update 7920"); bDone, sReason = true, "Вы "..(bValue and "разрешили" or "запретили").." "..PLY_SESSION:Name().." spawn объектов на '"..TERRITORY:Name().."'."; else sReason = sError; end; else bDone, sReason = false, "Inccorect owner session uid."; end; else bDone, sReason = false, "Inccorect player uid."; end; else bDone, sReason = false, "У вас нет прав."; end; else bDone, sReason = false, "Territory not found."; end; if ( bDone ) then greenCode.hint:Send( player, sReason, 5, bValue and Color(100,255,100) or Color(255,100,100), nil, true ); for _, v in pairs( TERRITORY:GetOnlineOwners(true) ) do if ( player == v ) then continue; end; greenCode.hint:Send( v, player:Name()..(bValue and " разрешили " or " запретили ")..PLY_SESSION:Name().." spawn объектов на '"..TERRITORY:Name().."'.", 5, bValue and Color(100,255,100) or Color(255,100,100), nil, true ); end; else greenCode.hint:Send( player, sReason, 5, Color(255,100,100), nil, true ); end; end);
function recipeGetResults(recipe,difficulty) difficulty = difficulty or "normal" local search = recipe if recipe[difficulty] then search = recipe[difficulty] end local results = search.results if search.result then results = {{ type = "item", name = search.result, amount = search.result_count or 1 }} end if not results then error("no recipe result found for recipe "..recipe.name) end return results end -- if multiple items are available pass item name! function recipeGetResultCount(recipe,item,difficulty) local results = recipeGetResults(recipe,difficulty) if #results == 1 then return results.amount or 1 end if #results == 0 then error("no recipe results found for recipe "..recipe.name.." to get result count...") end if not item then error("no item passed but multiple results available for recipe "..recipe.name) end for _,tabl in pairs(results) do if tabl.name == item then return tabl.amount end end error("multiple results for recipe "..recipe.name.." found but searched item "..item.." was not found") end function recipeRemoveResults(recipe) local erase = function(tabl) tabl.result = nil tabl.result_count = nil tabl.results = nil end erase(recipe) if recipe.normal then erase(recipe.normal) end if recipe.expensive then erase(recipe.expensive) end end function recipeChangeResultsForItemsByFactor(itemNameS, factor, roundValues) if type(itemNameS) == "string" then itemNameS = { itemNameS } elseif type(itemNameS) ~= "table" then err("Invalid type of argument passed: "..serpent.block(itemNameS)) return end info("All recipes will results "..tostring(factor).."x "..serpent.block(itemNameS)) local itemNamesSet = table.set(itemNameS) -- convert itemNames table to set -- loop through all recipes and change costs for that item for _,recipe in pairs(data.raw.recipe) do if recipe.result then if itemNamesSet[recipe.result] then recipe.result_count = (recipe.result_count or 1) * factor if roundValues then recipe.result_count = round(recipe.result_count) end end else for _,data in pairs(recipe.results) do if itemNamesSet[data.name] then data.amount = (data.amount or 1) * factor if roundValues then data.amount = round(data.amount) end end end end end end function recipeChangeCostsForItemsByFactor(itemNameS, factor, roundValues) if type(itemNameS) == "string" then itemNameS = { itemNameS } elseif type(itemNameS) ~= "table" then err("Invalid type of argument passed: "..serpent.block(itemNameS)) return end info("All recipes will cost "..tostring(factor).."x "..serpent.block(itemNameS)) local itemNamesSet = table.set(itemNameS) -- convert itemNames table to set -- loop through all recipes and change costs for that item for _,recipe in pairs(data.raw.recipe) do for _,data in pairs(recipe.ingredients) do if data.type and itemNamesSet[data.name] then data.amount = data.amount * factor if roundValues then data.amount = round(data.amount) end elseif itemNamesSet[data[1]] then data[2] = data[2] * factor if roundValues then data[2] = round(data[2]) end end end end end function recipeNamesOfItems(itemNameS) if type(itemNameS) == "string" then itemNameS = { itemNameS } elseif type(itemNameS) ~= "table" then err("Invalid type of argument passed: "..serpent.block(itemNameS)) return end local itemNamesSet = table.set(itemNameS) -- convert itemNames table to set -- loop through all recipes and put recipeNames in set local recipeNamesSet = {} for recipeName,data in pairs(data.raw.recipe) do if data.result and itemNamesSet[data.result] then recipeNamesSet[recipeName] = true elseif data.results then for _,resultData in pairs(data.results) do if itemNamesSet[resultData.name] then recipeNamesSet[recipeName] = true break end end end end return set.table(recipeNamesSet) -- convert set of recipeNames to table end -- recipeNameS: can be a name of a recipe or a table of names function recipeChangeCostsByFactor(recipeNameS, factor, roundValues) if type(recipeNameS) == "string" then recipeNameS = { recipeNameS } elseif type(recipeNameS) ~= "table" then err("Invalid type of argument passed: "..serpent.block(recipeNameS)) return end info("These recipes will cost "..tostring(factor).."x of everything: "..serpent.block(recipeNameS)) for _,name in pairs(recipeNameS) do local recipe = data.raw.recipe[name] for _,data in pairs(recipe.ingredients or recipe.normal.ingredients) do if data.type then data.amount = (data.amount or 1) * factor if roundValues then data.amount = round(data.amount) end else data[2] = (data[2] or 1) * factor if roundValues then data[2] = round(data[2]) end end end end end -- recipeNameS: can be a name of a recipe or a table of names function recipeChangeResultByFactor(recipeNameS,factor, roundValues) if type(recipeNameS) == "string" then recipeNameS = { recipeNameS } elseif type(recipeNameS) ~= "table" then err("Invalid type of argument passed: "..serpent.block(recipeNameS)) return end info("These recipes will result "..tostring(factor).."x of everything: "..serpent.block(recipeNameS)) for _,name in pairs(recipeNameS) do local recipe = data.raw.recipe[name] if recipe.result then recipe.result_count = (recipe.result_count or 1) * factor if roundValues then recipe.result_count = round(recipe.result_count) end --info(name.." results * "..tostring(factor).." -> "..tostring(recipe.result_count)) else for _,data in pairs(recipe.results) do data.amount = (data.amount or 1) * factor if roundValues then data.amount = round(data.amount) end --info(name.." results * "..tostring(factor).." -> "..tostring(data.amount).." "..data.name) end end end end -- To be removed in 3.0 function ChangeRecipe(Name, Ingredient1, Ingredient2, Amount) error("Use recipeReplaceIngredient function instead") end function recipeReplaceIngredient(name, ingredient1, ingredient2, amount) for k, v in pairs(data.raw["recipe"][name].ingredients) do if v[1] == ingredient1 then table.remove(data.raw["recipe"][name].ingredients, k) end end table.insert(data.raw["recipe"][name].ingredients,{ingredient2, amount}) end function recipeReplaceResult(recipeName, result1, result2, newAmount) local recipe = data.raw.recipe[recipeName] if recipe.result == result1 then recipe.result = result2 if newAmount then recipe.result_count = newAmount end elseif recipe.results then for _,result in pairs(recipe.results) do if result[1] == result1 then result[1] = result2 if newAmount then result[2] = newAmount end elseif result["name"] == result1 then result["name"] = result2 if newAmount then result["amount"] = newAmount end end end end end function recipeItemAmount(recipe,itemName) if recipe.ingredients == nil then err("ingredient list is nil for recipe: "..serpent.block(recipe)) end for _,tuple in pairs(recipe.ingredients) do if tuple["name"] == itemName then return tuple["amount"] elseif tuple[1] == itemName then return tuple[2] end end return 0 end function recipeResultsItemAmount(recipe,itemName,difficulty) if difficulty == nil then difficulty = "normal" end if recipe.results == nil and recipe.result == nil then return recipeResultsItemAmount(recipe[difficulty],itemName,difficulty) end if recipe.results == nil then if recipe.result == itemName then return recipe.result_count or 1 end return 0 end for _,tuple in pairs(recipe.results) do if tuple["name"] == itemName then return tuple["amount"] elseif tuple[1] == itemName then return tuple[2] end end return 0 end function recipeResultsContain(recipe,itemName) return recipeResultsItemAmount(recipe,itemName) > 0 end -- ingredient must be e.g. { type="item", name="stone", amount="1" } function recipeAddIngredient(recipe,ingredientNew) for _,ingredient in pairs(recipe.ingredients) do if ingredient.type == ingredientNew.type and ingredient.name == ingredientNew.name then ingredient.amount = ingredient.amount + ingredientNew.amount return end end table.insert(recipe.ingredients,ingredientNew) end
--------------------------------------------- -- Dark Wave -- -- Description: A wave of dark energy washes over targets in an area of effect. Additional effect: Bio -- Type: Magical -- Utsusemi/Blink absorb: Ignores shadows -- Range: 10' radial -- Notes: Severity of Bio effect varies by time of day, from 8/tic at midday to 20/tic at midnight. --------------------------------------------- require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/monstertpmoves") --------------------------------------------- function onMobSkillCheck(target, mob, skill) return 0 end function onMobWeaponSkill(target, mob, skill) local typeEffect = tpz.effect.BIO local cTime = VanadielHour() local power = 8 if (12 <= cTime) then local power = 8 + (cTime - 11) end MobStatusEffectMove(mob, target, typeEffect, power, 3, 60) local dmgmod = 1 local info = MobMagicalMove(mob, target, skill, mob:getWeaponDmg()*5, tpz.magic.ele.DARK, dmgmod, TP_NO_EFFECT) local dmg = MobFinalAdjustments(info.dmg, mob, skill, target, tpz.attackType.MAGICAL, tpz.damageType.DARK, MOBPARAM_IGNORE_SHADOWS) target:takeDamage(dmg, mob, tpz.attackType.MAGICAL, tpz.damageType.DARK) return dmg end
#! /usr/bin/lua require 'Test.More' plan(3) local mp = require 'MessagePack' local function my_cursor_string (str, i, j) return { s = str, i = i or 1, j = j or #str, underflow = function () error "missing bytes" end, } end local function my_unpack (s, i, j) local cursor = my_cursor_string(s, i, j) local data = mp.unpack_cursor(cursor) if cursor.i < cursor.j then error "extra bytes" end return data end local mpac = mp.pack({1, 2, 3}) local s = 'BAR' .. mpac .. 'BAZ' eq_array( my_unpack(s, 4, #s - 3), {1, 2, 3}, "my_unpack" ) error_like( function () my_unpack(s, 4) end, "extra bytes" ) error_like( function () my_unpack(s, 4, #s - 4) end, "missing bytes" )
ITEM.name = "Kopach" ITEM.model ="models/kek1ch/stalker_outfit.mdl" ITEM.newModel ="models/nasca/stalker/male_nbc_lone.mdl" ITEM.description= "Kopach suit." ITEM.longdesc = "This suit is a modified version of the standard Sunrise outfit, composed of a camouflaged CBRN suit with a Class III-a Kevlar vest. Favored by diggers and underground explorers." ITEM.width = 2 ITEM.height = 3 ITEM.price = 30000 ITEM.busflag = "dev" ITEM.br = 0.15 ITEM.fbr = 6 ITEM.ar = 0.4 ITEM.far = 3 ITEM.isHelmet = false ITEM.isGasmask = true ITEM.radProt = 0.5 ITEM.repairCost = ITEM.price/100*1 ITEM.overlayPath = "vgui/overlays/hud_gas" ITEM.ballisticlevels = {"0","ll-a","ll-a","0","0"} ITEM.img = ix.util.GetMaterial("vgui/hud/nbc.png") ITEM.weight = 9.800 ITEM.miscslots = 2 ITEM.newSkin = 0 ITEM.bodyGroups = { ["Hood"] = 1, } ITEM.skincustom[1] = { name = "Loner", skingroup = 0, modelOverride = "models/nasca/stalker/male_nbc_lone.mdl", } ITEM.skincustom[2] = { name = "Loner 2", skingroup = 1, modelOverride = "models/nasca/stalker/male_nbc_lone.mdl", } ITEM.skincustom[3] = { name = "Duty", skingroup = 0, modelOverride = "models/nasca/stalker/male_nbc_duty.mdl", } ITEM.skincustom[4] = { name = "Freedom", skingroup = 0, modelOverride = "models/nasca/stalker/male_nbc_free.mdl", } ITEM.skincustom[5] = { name = "Ecologist", skingroup = 0, modelOverride = "models/nasca/stalker/male_nbc_mono.mdl", } ITEM.skincustom[6] = { name = "Monolith", skingroup = 0, modelOverride = "models/nasca/stalker/male_nbc_mono.mdl", }
--Called from ../chiNteractor_04_treeview.lua numTextures=0; prevnumTextures=0; --######################################################### Update textures function UpdateTextures() numTextures=chiTextureQuery(0); if (not (numTextures==prevnumTextures)) then sk=0; for k=1,numTextures do sceneNum = chiTextureQuery(3,k-1); if (sceneNum > 0) then sk=sk+1; if (X_techTexturesSubFolders[sk]==nil) then name=chinTrimPath(chinTexture[k-1].name); X_techTexturesSubFolders[sk]=X_techTexturesFolder.AddFolder(X_techTexturesFolder,name); item=X_techTexturesSubFolders[sk]; X_techTexturesSubFolders[sk].iconTypeFolder=chinIconTexture; X_techTexturesSubFolders[sk].label.parent = chinTexture[k-1]; --===================== Assigning callback to texture folder function item.label.CustomSelected(this) local newSel=SelectionClass.New(); newSel.type=SELECTION_TYPE_TEXTURE; newSel.index=this.parent.index; newSel.originFeature=this; selectionStack.PushItem(newSel); end else end end end end end --######################################################### Callback for texture preview function TextureSetPreview(selectionItem) if (selectionItem.type==SELECTION_TYPE_TEXTURE) then chiMaterialSetProperty(mfdDisplayPanel.matlNum,8,selectionItem.index); end end selectionStack.PushCallBackCount=selectionStack.PushCallBackCount+1; k=selectionStack.PushCallBackCount; selectionStack.PushCallBacks[k]=TextureSetPreview;
-- Add border to :Lsp* commands -- https://github.com/neovim/nvim-lspconfig/issues/1717 vim.api.nvim_win_set_config(0, { border = "rounded" })
local unixsock = require("unixsock") local json = require("json") NodeSelectDockerImages = Node("SelectDockerImages") NodeSelectDockerContainers = Node("SelectDockerContainers") local dockerClient = unixsock.NewUnixSockClient("/var/run/docker.sock") local ret ret = dockerClient:Get("http://l/images/json?all=1") ret = json.decode(ret) NodeSelectDockerImages:SelectClearOptions() for k, image in pairs(ret) do NodeSelectDockerImages:SelectAppendOption(image.Id, image.RepoTags[1]) end ret = dockerClient:Get("http://l/containers/json?all=1") ret = json.decode(ret) NodeSelectDockerContainers:SelectClearOptions() for k, container in pairs(ret) do NodeSelectDockerContainers:SelectAppendOption(container.Id, string.format("%-20s %-30s [%s]", container.Names[1], container.Image, container.State)) end
return { PlaceObj("ModItemOptionToggle", { "name", "HideCheatsMenu", "DisplayName", T(0000, "Hide Cheats Menu"), "Help", T(0000, "Hide a menu entry to reduce horizontal space."), "DefaultValue", false, }), PlaceObj("ModItemOptionToggle", { "name", "HideECMMenu", "DisplayName", T(0000, "Hide ECM Menu"), "Help", T(0000, "Hide a menu entry to reduce horizontal space."), "DefaultValue", false, }), PlaceObj("ModItemOptionToggle", { "name", "HideGameMenu", "DisplayName", T(0000, "Hide Game Menu"), "Help", T(0000, "Hide a menu entry to reduce horizontal space."), "DefaultValue", false, }), PlaceObj("ModItemOptionToggle", { "name", "HideDebugMenu", "DisplayName", T(0000, "Hide Debug Menu"), "Help", T(0000, "Hide a menu entry to reduce horizontal space."), "DefaultValue", false, }), PlaceObj("ModItemOptionToggle", { "name", "HideHelpMenu", "DisplayName", T(0000, "Hide Help Menu"), "Help", T(0000, "Hide a menu entry to reduce horizontal space."), "DefaultValue", false, }), }
--[[ Created by Grid2 original authors, modified by Michael --]] local Range = Grid2.statusPrototype:new("range") local Grid2 = Grid2 local tonumber = tonumber local tostring = tostring local UnitIsUnit = UnitIsUnit local UnitInRange = UnitInRange local UnitIsFriend = UnitIsFriend local UnitCanAttack = UnitCanAttack local UnitCanAssist = UnitCanAssist local IsSpellInRange = IsSpellInRange local UnitIsDeadOrGhost = UnitIsDeadOrGhost local CheckInteractDistance = CheckInteractDistance local UnitPhaseReason = UnitPhaseReason or Grid2.Dummy local timer local curAlpha local curRange local groupType local cache = {} local UnitRangeCheck local grouped_units = Grid2.grouped_units local playerClass = select(2, UnitClass("player")) local rezSpellID = ({ -- classic has the same spellIDs DRUID = 20484, PRIEST = 2006, PALADIN = 7328, SHAMAN = 2008, MONK = 115178, DEATHKNIGHT = 61999, WARLOCK = 20707 })[playerClass] local rezSpell = rezSpellID and GetSpellInfo(rezSpellID) local rangeSpellID = ({ DRUID = 774, PALADIN = 19750, PRIEST = Grid2.isClassic and 2050 or 73325, SHAMAN = Grid2.isClassic and 25357 or 77472, MONK = 115450 })[playerClass] local rangeSpell = rangeSpellID and GetSpellInfo(rangeSpellID) local Ranges= { [99] = UnitIsVisible, [10] = function(unit) return CheckInteractDistance(unit,3) end, [28] = function(unit) return CheckInteractDistance(unit,4) end, [38] = function(unit) if grouped_units[unit] and groupType~='solo' then return UnitIsUnit(unit,"player") or UnitInRange(unit) else return CheckInteractDistance(unit,4) -- 28 yards for non grouped units: target/focus/bossX or when solo (because UnitInRange() does not work for pet when solo) end end, ["heal"] = function(unit) if UnitPhaseReason(unit) then return elseif UnitIsFriend("player", unit) then if UnitIsUnit(unit,'player') then return true elseif UnitIsDeadOrGhost(unit) then return IsSpellInRange(rezSpell,unit)==1 else return IsSpellInRange(rangeSpell,unit)==1 end else return CheckInteractDistance(unit,4) -- 28y for enemies end end, } local function Update() for unit in Grid2:IterateRosterUnits() do local value = UnitRangeCheck(unit) and 1 or false if value ~= cache[unit] then cache[unit] = value Range:UpdateIndicators(unit) end end end function Range:Grid_GroupTypeChanged(_, newGroupType) groupType = newGroupType end function Range:Grid_PlayerSpecChanged() if not tonumber(self.dbx.range) then -- If is not a number -> Using RangeSpell for the player class if available self:UpdateDB() end end function Range:Grid_UnitUpdated(_, unit) cache[unit] = UnitRangeCheck(unit) and 1 or false end function Range:Grid_UnitLeft(_, unit) cache[unit] = nil end function Range:GetPercent(unit) return cache[unit] or curAlpha end function Range:GetRanges() return Ranges, curRange end function Range:IsActive(unit) return not cache[unit] end function Range:OnEnable() self:UpdateDB() self:RegisterMessage("Grid_UnitUpdated") self:RegisterMessage("Grid_UnitLeft") self:RegisterMessage("Grid_PlayerSpecChanged") self:RegisterMessage("Grid_GroupTypeChanged") timer:Play() end function Range:OnDisable() self:UnregisterMessage("Grid_UnitUpdated") self:UnregisterMessage("Grid_UnitLeft") self:UnregisterMessage("Grid_PlayerSpecChanged") self:UnregisterMessage("Grid_GroupTypeChanged") timer:Stop() end -- Due to ancient code, configuration can store a heal spell name in status.dbx.range (Rejuv, Healing wave, etc), but this prevents -- to use the same profile for different healer classes, because the heal spell is different for each class: -- So we check if status.dbx.range stores a heal spell name (the value is not a number), and in this case the code loads the correct -- heal spell for the class (precalculated in rangeSpell variable) instead of the heal spell stored in config. function Range:UpdateDB() curAlpha = self.dbx.default or 0.25 curRange = tonumber(self.dbx.range) or (rangeSpellID and IsSpellKnown(rangeSpellID) and 'heal') or 38 UnitRangeCheck = Ranges[curRange] or Ranges[38] timer = timer or Grid2:CreateTimer( Update ) timer:SetDuration(self.dbx.elapsed or 0.25) end Range.GetColor = Grid2.statusLibrary.GetColor local function Create(baseKey, dbx) groupType = Grid2:GetGroupType() Grid2:RegisterStatus(Range, {"percent", "color"}, baseKey, dbx) return Range end Grid2.setupFunc["range"] = Create Grid2:DbSetStatusDefaultValue( "range", {type = "range", color1 = {r=1, g=0, b=0, a=1}, range=38, default = 0.25, elapsed = 0.5})
--[[function Spiral(X, Y) local x = 0 local y = 0 local dx = 0 local dy = -1; local t = math.max(X, Y); local maxI = t * t; for i = 0, maxI, 1 do if ((-X/2 <= x) and (x <= X/2) and (-Y/2 <= y) and (y <= Y/2)) then table.insert(pathway, { x = x, y = y, z = 503, id = i }) end if( (x == y) or ((x < 0) and (x == -y)) or ((x > 0) and (x == 1-y))) then t = dx; dx = -dy; dy = t; end x = x + dx; y = y + dy; end coroutine.yield() end local tick = getTickCount() local co = coroutine.create(Spiral) coroutine.resume(co, 100, 100) if ( fileExists("nodes.lua") ) then fileDelete("nodes.lua") end local file = fileCreate("nodes.lua") fileWrite(file, "local pathway = {}\n\n") if (file) then for index, node in ipairs(pathway) do fileWrite(file, "pathway[" .. index .. "] = { x = " .. node.x .. ", y = " .. node.y .. ", z = " .. node.z ..", id = " .. node.id .. "}\n") end fileClose(file); end outputDebugString("Done (".. ((getTickCount() - tick ) / 1000) .. " seconds)") ]]-- --[[ local valid_node_func = function ( node, neighbor ) local MAX_DIST = 4 if distance( node.x, node.y, 503, neighbor.x, neighbor.y, 503 ) < MAX_DIST then --Check here if nodes are obstructed return true end return false end local paths = path ( pathway[1], pathway[2], pathway, true, valid_node_func ) local tick = getTickCount() function renderPath() local seconds = ( getTickCount() - tick ) / 1000 if ( seconds > 5 ) then local x, y, z = getElementPosition(localPlayer) local node = nearest_node(x, y, z) paths = path ( pathway[1], node, pathway, true, valid_node_func ) tick = getTickCount() end if not paths then dxDrawText("NO PATH", 300, 300) else for i, node in ipairs ( paths ) do if ( paths[i+1] ) then local neighbor = paths[i+1]; dxDrawLine3D( node.x, node.y, node.z, neighbor.x, neighbor.y, neighbor.z, tocolor(255,200,0,200), 1.0) end end end dxDrawText(#paths, 300, 320) end addEventHandler("onClientPreRender", root, renderPath) ]]-- addEvent("pathfinding:onPedDamage", true) nodeList = {} local debugTimer local paths = {} local maxZombies = 30 local currentZombies = 0 function onResourceStart(resource) local nodes = getElementsByType("node", source) if ( #nodes > 0 ) then outputDebugString("Found " .. #nodes .. " nodes in resource " .. getResourceName(resource) .. ".") addNodesToList(nodes) end end function addNodesToList(nodes) for index, node in ipairs(nodes) do nodeList[index] = {} nodeList[index].id = index nodeList[index].x = node:getData("posX") nodeList[index].y = node:getData("posY") nodeList[index].z = node:getData("posZ") end triggerClientEvent(root, "pathfinding:sendNodesToClient", resourceRoot, nodeList) --test spawnTestDummy() end local valid_node_func = function ( node, neighbor ) local MAX_DIST = 6 if distance( node.x, node.y, node.z, neighbor.x, neighbor.y, node.z ) <= MAX_DIST then return true end return false end function calculatePath( zombie, endX, endY, endZ ) local startX, startY, startZ = getElementPosition(zombie) local startNode = nearest_node( startX, startY, startZ ) local endNode = nearest_node( endX + math.random( 1, 3 ), endY - math.random( 1, 3 ), endZ ) local currentDistance = getDistanceBetweenPoints3D( startX, startY, startZ, endX, endY, endZ ) if ( currentDistance <= 7 ) then return false end if ( startNode and endNode ) then local newPath = path( startNode, endNode, nodeList, true, valid_node_func ) if ( newPath and #newPath > 0 ) then local zombieId = zombie:getData("zombieId") zombie:setData("targetNode", 1) paths[zombie] = newPath --triggerClientEvent(root, "pathfinding:sendPathToClient", resourceRoot, zombieId, newPath) else outputDebugString("Could not determine path") end end end local updateTimer = nil local zombieSpawns = { { -164.3929, 25.62389, 503.249664 }, { -125.14426, 4.6317, 503.309631 }, { -85.36963, 25.11468, 503.167877 }, { -60.26727, 64.3479, 503.358673 }, { -72.54577, 103.91753, 502.73703 }, { -104.5975, 127.43274, 502.920776 }, { -146.86301, 134.76721, 502.916046 } } function spawnTestDummy() if ( currentZombies >= maxZombies ) then return false end for i, spawn in ipairs(zombieSpawns) do local x, y, z = unpack(zombieSpawns[i]) local nearestNode = nearest_node( x, y, z ) local dummy = createPed(math.random(115, 118), nearestNode.x + math.random( 2, 4 ), nearestNode.y - math.random( 2, 4 ), nearestNode.z + 2) --giveWeapon(dummy, 31, 9999, true) dummy:setData("zombie", true) dummy:setData("zombieId", i) dummy:setData("fired", false) currentZombies = currentZombies + 1 end if ( not updateTimer ) then updateTimer = setTimer(onZombieUpdate, 250, 0) setTimer(spawnTestDummy, 2500, 0) end end function onZombieUpdate() for i, ped in ipairs(getElementsByType("ped")) do if ( ped:getData("zombie")) then if ( findZombieTarget(ped) ) then updateZombieMovement(ped) end end end end function findZombieTarget(zombie) local zx, zy, zz = getElementPosition(zombie) local nearestPlayer = getNearestPlayer(zx, zy, zz) if ( isElement(nearestPlayer) ) then zombie:setData("target", nearestPlayer, true) return true end return false end function updateZombieMovement(zombie) local target = zombie:getData("target") if ( not isElement(target)) then zombie:setData("target", nil) return false end local px, py, pz = getElementPosition(target) if ( isElement(target)) then local zombieEndNode = nil local nx, ny, nz = nil, nil, nil local distance = 0 if ( paths[zombie] ) then zombieEndNode = paths[zombie][#paths[zombie]] nx, ny, nz = zombieEndNode.x, zombieEndNode.y, zombieEndNode.z distance = getDistanceBetweenPoints3D(px, py, pz, nx, ny, nz) end if ( not zombie:getData("targetNode") or distance >= 7 )then calculatePath( zombie, px, py, pz ) end end if ( paths[zombie] ) then for _, node in ipairs(paths[zombie]) do local targetNode = zombie:getData("targetNode") if (paths[zombie][targetNode]) then local tx, ty, tz = paths[zombie][targetNode].x, paths[zombie][targetNode].y, paths[zombie][targetNode].z local sx, sy, sz = getElementPosition(zombie) local rz = findRotation(sx, sy, tx, ty) local nodeDistance = getDistanceBetweenPoints3D(sx, sy, sz, tx, ty, tz) zombie:setRotation( 0, 0, rz ) zombie:setAnimation("PED", "RUN_CIVI") if ( nodeDistance < 2 and paths[zombie][targetNode+1]) then zombie:setData("targetNode", targetNode+1) elseif ( not paths[zombie][targetNode+1] ) then local distance = getDistanceBetweenPoints3D(px, py, pz, sx, sy, sz) zombie:setAnimation(false) zombie:setData("targetNode", nil) zombie:setData("targetPlayer", target) end end if ( zombie:getData("targetPlayer")) then local x, y, z = getElementPosition(zombie:getData("targetPlayer")) local zx, zy, zz = getElementPosition(zombie) local rz = findRotation(zx, zy, x, y) local distance = getDistanceBetweenPoints3D(x, y, z, zx, zy, zz) if( distance > 1.5 and distance <= 7 ) then zombie:setAnimation("PED", "RUN_CIVI") elseif ( distance <= 1.5 ) then local fired = zombie:getData("fired") local pHealth = getElementHealth(target) if ( pHealth > 0 ) then setElementRotation(zombie, 0, 0, rz) zombie:setAnimation(false) setElementHealth(target, math.max(0, getElementHealth(target) - 1)) triggerClientEvent(root, "pathfinding:onPedWeaponFire", zombie, target, fired) zombie:setData("fired", not fired) else --todo, start idling end elseif ( distance > 7 ) then zombie:setData("targetPlayer", nil) end setElementRotation(zombie, 0, 0, rz) end end end end function getNearestPlayer(x, y, z) local distanceToBeat = 9999 local selectedPlayer = nil for _, player in ipairs(getElementsByType("player")) do local px, py, pz = getElementPosition(player) local distance = getDistanceBetweenPoints3D(x, y, z, px, py, pz) if ( distance < distanceToBeat ) then distanceToBeat = distance selectedPlayer = player end end return selectedPlayer or nil end function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end function onPedDamage(ped, attacker, weapon, bodypart) if ( ped:getData("zombie")) then local health = getElementHealth(ped) if ( bodypart == 9 ) then setPedHeadless(ped, true) killPed(ped, attacker, weapon) end if ( health > 0 ) then setElementHealth(ped, health - math.random(40, 80)) end end end setTimer(function() for i,v in ipairs(getElementsByType("ped")) do if ( v:getData("zombie") and v.health <= 0 ) then outputDebugString("wasted"); v:setData("zombie", false) v:setData("target", false) v:setData("targetNode", false) v:setCollisionsEnabled(false) paths[v] = nil currentZombies = currentZombies - 1 end end end, 1234, 0) setTimer(function() local bodyCount = 0 for i,v in ipairs(getElementsByType("ped")) do if ( v.health <= 0 ) then destroyElement(v) outputDebugString("Removed dead bodies"); --bodyCount = bodyCount + 1 end end --currentZombies = currentZombies - bodyCount end, 60000, 0) addEventHandler("pathfinding:onPedDamage", root, onPedDamage) addEventHandler("onResourceStart", root, onResourceStart)
local Utils = require('golem.utils') local Obect = require('golem.object') local Canvas = {} -- New canvas -- @param number width -- @param number height function Canvas:new(width, height, color) Utils:assertType(width, 'Canvas width', 'number') Utils:assertType(height, 'Canvas height', 'number') if color then Utils:assertType(color, 'Canvas Color', 'table') Utils:assertType(color.r, 'Red Color', 'number' ) Utils:assertType(color.g, 'Green Color', 'number' ) Utils:assertType(color.b, 'Blue Color', 'number' ) Utils:assertType(color.a, 'Alpha Color', 'number' ) end -- Default color values. color = color or { r = 0, g = 0, b = 0, a = 255, } local canvas = { graphic = love.graphics.newCanvas(width, height) } -- Init canvas love.graphics.setCanvas(self.graphic) love.graphics.setBlendMode('alpha') function canvas:draw() love.graphics.clear() love.graphics.setColor(color.r, color.g, color.b, color.a) love.graphics.rectangle('fill', 0, 0, width, height) love.graphics.setScissor(0, 0, width, height) love.graphics.draw(self.graphic) end -- Reset canvas function canvas:reset() love.graphics.setScissor() love.graphics.setCanvas() end return canvas end return Canvas
local Plugin = SS.Plugins:New("Hide") // When players values get set function Plugin.PlayerSetVariables(Player) CVAR.New(Player, "Hidden", "Hidden", false) end // Chat command local Hide = SS.Commands:New("Hide") function Hide.Command(Player, Args) local Bool = SS.Lib.StringBoolean(Args[1]) CVAR.Update(Player, "Hidden", Bool) if (Bool) then SS.PlayerMessage(Player, "You are now hidden!", 0) Player:ConCommand("name MingeBag\n") Player:Spawn() else SS.PlayerMessage(Player, "You no longer hidden!", 0) end end Hide:Create(Hide.Command, {"server", "hide"}, "Hide/Unhide", "<1|0>", 1, " ") // Player spawn function Plugin.PlayerSpawn(Player) timer.Create("Hide: PlayerSpawn", 0.5, 1, function(Player) if (CVAR.Request(Player, "Hidden")) then Player:HideGUI("Hover", true) else Player:HideGUI("Hover", false) end end, Player) end // Player choose model function Plugin.PlayerChooseModel(Player) timer.Create("Hide: PlayerChooseModel", 0.5, 1, function(Player) if (CVAR.Request(Player, "Hidden")) then for K, V in pairs(SS.Groups.List) do if (V[7]) then if (V[4] != "") then Player:SetModel(V[4]) end end end end end, Player) end // Player choose team function Plugin.PlayerChooseTeam(Player) timer.Create("Hide: PlayerChooseTeam", 0.5, 1, function(Player) if (CVAR.Request(Player, "Hidden")) then local Default = SS.Groups.Default() Player:SetTeam(SS.Groups.Index(Default)) end end, Player) end // Meta local Meta = FindMetaTable("Player") local Backup = Meta.Name function Meta:Name(String) if (CVAR.Request(self, "Hidden")) then return SS.Lib.StringRandom(10) else return Backup(self, String) end end // Finish plugin Plugin:Create()
function love.conf(t) t.window.title = "Stars Demo" t.window.width = 600 t.window.height = 600 t.window.vsync = false end
if paladin_holy_purification == nil then paladin_holy_purification = class({}) end function paladin_holy_purification:GetAOERadius() local caster = self:GetCaster() local base_radius = self:GetSpecialValueFor("radius") -- Talent that increases radius local talent = caster:FindAbilityByName("special_bonus_unique_paladin_1") if talent and talent:GetLevel() > 0 then return base_radius + talent:GetSpecialValueFor("value") end return base_radius end function paladin_holy_purification:GetCooldown(level) local caster = self:GetCaster() local base_cooldown = self.BaseClass.GetCooldown(self, level) -- Talent that decreases cooldown local talent = caster:FindAbilityByName("special_bonus_unique_paladin_3") if talent and talent:GetLevel() > 0 then return base_cooldown - math.abs(talent:GetSpecialValueFor("value")) end return base_cooldown end function paladin_holy_purification:OnSpellStart() local caster = self:GetCaster() local target = self:GetCursorTarget() local caster_team = caster:GetTeamNumber() local target_team = target:GetTeamNumber() local radius = self:GetSpecialValueFor("radius") local damage_and_heal = self:GetSpecialValueFor("heal") local heal_particle_name_1 = "particles/units/heroes/hero_omniknight/omniknight_purification.vpcf" local heal_particle_name_2 = "particles/econ/items/omniknight/hammer_ti6_immortal/omniknight_purification_immortal_cast.vpcf" local heal_hit_particle_name = "particles/units/heroes/hero_omniknight/omniknight_purification_hit.vpcf" -- Talent that increases radius local talent_1 = caster:FindAbilityByName("special_bonus_unique_paladin_1") if talent_1 and talent_1:GetLevel() > 0 then radius = radius + talent_1:GetSpecialValueFor("value") end -- Talent that increases damage and heal local talent_2 = caster:FindAbilityByName("special_bonus_unique_paladin_6") if talent_2 and talent_2:GetLevel() > 0 then damage_and_heal = damage_and_heal + talent_2:GetSpecialValueFor("value") end if IsServer() then -- Init damage table local damage_table = {} damage_table.attacker = caster damage_table.damage = damage_and_heal damage_table.damage_type = DAMAGE_TYPE_PURE damage_table.ability = self -- Check if the target is an ally or enemy if caster_team == target_team then -- Sound on target (ally) target:EmitSound("Hero_Omniknight.Purification") -- Heal Particle local heal_particle = ParticleManager:CreateParticle(heal_particle_name_1, PATTACH_ABSORIGIN_FOLLOW, target) ParticleManager:SetParticleControl(heal_particle, 0, target:GetAbsOrigin()) ParticleManager:SetParticleControl(heal_particle, 1, Vector(radius, radius, radius)) ParticleManager:ReleaseParticleIndex(heal_particle) -- Heal the target (ally) target:Heal(damage_and_heal, self) local target_teams = DOTA_UNIT_TARGET_TEAM_ENEMY local target_types = bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC) local target_flags = DOTA_UNIT_TARGET_FLAG_NONE local enemies = FindUnitsInRadius(caster_team, target:GetAbsOrigin(), nil, radius, target_teams, target_types, target_flags, FIND_CLOSEST, false) for _, enemy in pairs(enemies) do -- Particles on enemies local hit_pfx = ParticleManager:CreateParticle(heal_hit_particle_name, PATTACH_ABSORIGIN_FOLLOW, enemy) ParticleManager:SetParticleControlEnt(hit_pfx, 0, caster, PATTACH_POINT_FOLLOW, "attach_hitloc", caster:GetAbsOrigin(), true) ParticleManager:SetParticleControlEnt(hit_pfx, 1, enemy, PATTACH_POINT_FOLLOW, "attach_hitloc", enemy:GetAbsOrigin(), true) ParticleManager:SetParticleControl(hit_pfx, 3, Vector(radius, 0, 0)) ParticleManager:ReleaseParticleIndex(hit_pfx) local particle = ParticleManager:CreateParticle(heal_particle_name_2, PATTACH_ABSORIGIN_FOLLOW, enemy) ParticleManager:SetParticleControl(particle, 0, enemy:GetAbsOrigin()) ParticleManager:SetParticleControl(particle, 1, enemy:GetAbsOrigin()) ParticleManager:ReleaseParticleIndex(particle) -- Damage enemies damage_table.victim = enemy ApplyDamage(damage_table) end else -- Spell block check if not target:TriggerSpellAbsorb(self) then -- Sound on target (enemy) target:EmitSound("Hero_Omniknight.Purification") -- Particles when cast on enemy local heal_particle = ParticleManager:CreateParticle(heal_particle_name_1, PATTACH_ABSORIGIN_FOLLOW, target) ParticleManager:SetParticleControl(heal_particle, 0, target:GetAbsOrigin()) ParticleManager:SetParticleControl(heal_particle, 1, Vector(radius/2, radius/2, radius/2)) ParticleManager:ReleaseParticleIndex(heal_particle) local particle = ParticleManager:CreateParticle(heal_particle_name_2, PATTACH_ABSORIGIN_FOLLOW, target) ParticleManager:SetParticleControl(particle, 0, target:GetAbsOrigin()) ParticleManager:SetParticleControl(particle, 1, target:GetAbsOrigin()) ParticleManager:ReleaseParticleIndex(particle) -- spell-immunit and invulnerability check if not target:IsMagicImmune() and not target:IsInvulnerable() then damage_table.victim = target ApplyDamage(damage_table) end local target_teams = DOTA_UNIT_TARGET_TEAM_FRIENDLY local target_types = bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC) local target_flags = DOTA_UNIT_TARGET_FLAG_NONE local allies = FindUnitsInRadius(caster_team, target:GetAbsOrigin(), nil, radius, target_teams, target_types, target_flags, FIND_CLOSEST, false) for _, ally in pairs(allies) do -- Particles on allies local hit_pfx = ParticleManager:CreateParticle(heal_hit_particle_name, PATTACH_ABSORIGIN_FOLLOW, ally) ParticleManager:SetParticleControlEnt(hit_pfx, 0, caster, PATTACH_POINT_FOLLOW, "attach_hitloc", caster:GetAbsOrigin(), true) ParticleManager:SetParticleControlEnt(hit_pfx, 1, ally, PATTACH_POINT_FOLLOW, "attach_hitloc", ally:GetAbsOrigin(), true) ParticleManager:SetParticleControl(hit_pfx, 3, Vector(radius, 0, 0)) ParticleManager:ReleaseParticleIndex(hit_pfx) -- Heal allies ally:Heal(damage_and_heal, self) end end end end end function paladin_holy_purification:ProcsMagicStick() return true end --------------------------------------------------------------------------------------------------- if guardian_angel_holy_purification == nil then guardian_angel_holy_purification = paladin_holy_purification end
-------------------------------- -- @module RadioButtonGroup -- @extend Widget -- @parent_module ccui -------------------------------- -- Remove a radio button from this group.<br> -- param radio button instance -- @function [parent=#RadioButtonGroup] removeRadioButton -- @param self -- @param #ccui.RadioButton radioButton -- @return RadioButtonGroup#RadioButtonGroup self (return value: ccui.RadioButtonGroup) -------------------------------- -- Query whether no-selection is allowed or not.<br> -- param true means no-selection is allowed, false means no-selection is not allowed. -- @function [parent=#RadioButtonGroup] isAllowedNoSelection -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- Get the index of selected radio button.<br> -- return the selected button's index. Returns -1 if no button is selected. -- @function [parent=#RadioButtonGroup] getSelectedButtonIndex -- @param self -- @return int#int ret (return value: int) -------------------------------- -- Set a flag for allowing no-selection feature.<br> -- If it is allowed, no radio button can be selected.<br> -- If it is not allowed, one radio button must be selected all time except it is empty.<br> -- Default is not allowed.<br> -- param true means allowing no-selection, false means disallowing no-selection. -- @function [parent=#RadioButtonGroup] setAllowedNoSelection -- @param self -- @param #bool allowedNoSelection -- @return RadioButtonGroup#RadioButtonGroup self (return value: ccui.RadioButtonGroup) -------------------------------- -- @overload self, ccui.RadioButton -- @overload self, int -- @function [parent=#RadioButtonGroup] setSelectedButtonWithoutEvent -- @param self -- @param #int index -- @return RadioButtonGroup#RadioButtonGroup self (return value: ccui.RadioButtonGroup) -------------------------------- -- Add a callback function which would be called when radio button is selected or unselected.<br> -- param callback A std::function with type @see `ccRadioButtonGroupCallback` -- @function [parent=#RadioButtonGroup] addEventListener -- @param self -- @param #function callback -- @return RadioButtonGroup#RadioButtonGroup self (return value: ccui.RadioButtonGroup) -------------------------------- -- Remove all radio button from this group. -- @function [parent=#RadioButtonGroup] removeAllRadioButtons -- @param self -- @return RadioButtonGroup#RadioButtonGroup self (return value: ccui.RadioButtonGroup) -------------------------------- -- Get a radio button in this group by index.<br> -- param index of the radio button<br> -- return radio button instance. Returns nullptr if out of index. -- @function [parent=#RadioButtonGroup] getRadioButtonByIndex -- @param self -- @param #int index -- @return RadioButton#RadioButton ret (return value: ccui.RadioButton) -------------------------------- -- Get the number of radio buttons in this group.<br> -- return the number of radio buttons in this group -- @function [parent=#RadioButtonGroup] getNumberOfRadioButtons -- @param self -- @return long#long ret (return value: long) -------------------------------- -- Add a radio button into this group.<br> -- param radio button instance -- @function [parent=#RadioButtonGroup] addRadioButton -- @param self -- @param #ccui.RadioButton radioButton -- @return RadioButtonGroup#RadioButtonGroup self (return value: ccui.RadioButtonGroup) -------------------------------- -- @overload self, ccui.RadioButton -- @overload self, int -- @function [parent=#RadioButtonGroup] setSelectedButton -- @param self -- @param #int index -- @return RadioButtonGroup#RadioButtonGroup self (return value: ccui.RadioButtonGroup) -------------------------------- -- Create and return a empty RadioButtonGroup instance pointer. -- @function [parent=#RadioButtonGroup] create -- @param self -- @return RadioButtonGroup#RadioButtonGroup ret (return value: ccui.RadioButtonGroup) -------------------------------- -- -- @function [parent=#RadioButtonGroup] getDescription -- @param self -- @return string#string ret (return value: string) -------------------------------- -- Default constructor.<br> -- lua new -- @function [parent=#RadioButtonGroup] RadioButtonGroup -- @param self -- @return RadioButtonGroup#RadioButtonGroup self (return value: ccui.RadioButtonGroup) return nil
wings_blue = { minimumLevel = 0, maximumLevel = 0, customObjectName = "Blue Wings", directObjectTemplate = "object/tangible/wearables/backpack/back_love_day_10_blue_wings.iff", craftingValues = {}, customizationStringNames = {}, customizationValues = {} } addLootItemTemplate("wings_blue", wings_blue)
local json = require "cjson" local function format_table(t) local str = '' for k, v in pairs(t) do str = str .. k .. '--' .. v .. '\r\n' end return str end -- JSON TO TABLE local str_json = '{"key1":"this is key1", "key2":"this is key2", "num":1}' local t = json.decode(str_json) ngx.say(format_table(t)) -- TABLE TO JSON local table1 = {key1="this is key1", key2="this is key2", num=12} local str_json1 = json.encode(table1) ngx.say(str_json1) -- TABLR TO JSON ARRAY local table2 = {key1={key1_1="6666", key1_2= "7777"}, key2= "8888"} local str_json2 = json.encode(table2) ngx.say(str_json2) -- ARRAY TO JSON local array = {12, 57, 56} array[4] = 79 json.encode_sparse_array(true) local str_json3 = json.encode(array) ngx.say(str_json3) -- error capture local json_str4 = '{"tt":""}, "name": "7777"}' local table3 = json.decode(json_str4) ngx.say(format_table(table3))
local lpeg = require "lpeg" local IS_WINDOWS = (package.config:sub(1,1) == '\\') local D_WIN = function(s) return '%' .. s .. '%' end local D_PSX = function(s) return '$' .. s end local D = IS_WINDOWS and D_WIN or D_PSX local P, C, Cs, Ct, Cp, S = lpeg.P, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.Cp, lpeg.S local any = P(1) local sym = any-S':${}% \t' local esc = (P'%%' / '%%') + (P'$$' / '$') local var = (P'%' * C(sym^1) * '%') + (P'${' * C(sym^1) * '}') + (P'$' * C(sym^1)) local function MakeSubPattern(fn) return Cs((esc + (var / fn) + any)^0) end local function BuildExpand(getenv) local function subst(k) local v = getenv(k) if v then return v end end local pattern = MakeSubPattern(subst) return function(str) return pattern:match(str) end end local Normalize do local psx_pattern = MakeSubPattern(D_PSX) local win_pattern = MakeSubPattern(D_WIN) local sys_pattern = MakeSubPattern(D) Normalize = function(str, mode) local pattern if mode == nil then pattern = sys_pattern elseif (mode == '$') or (mode == false) then pattern = psx_pattern elseif (mode == '%') or (mode == true) then pattern = win_pattern else error('unsupportde mode') end return pattern:match(str) end end local function split_first(str, sep, plain, pos) local e, e2 = string.find(str, sep, pos, plain) if e then return string.sub(str, 1, e - 1), string.sub(str, e2 + 1) end return str end local function make_map(mod) local env = setmetatable({},{ __index = function(_, k) return mod.getenv(k) end; __newindex = function(_, k, v) return mod.setenv(k, v, true) end; __call = function(_, upper) return mod.environ(upper) end; }) return env end return { IS_WINDOWS = IS_WINDOWS; build_expand = BuildExpand; normalize = Normalize; split_first = split_first; make_env_map = make_map; }
function love.load() target = {} target.x = 300 target.y = 300 target.radius = 40 score = 0 gameFont = love.graphics.newFont(20) font = love.graphics.newFont(80) timer = 10 timerScore = 5 colour = 1 end function love.update(dt) if timer >= 0 then timer = timer - dt timerScore = timerScore - dt end end function love.draw() --[[ love.graphics.setFont(gameFont) love.graphics.print('Easy', 100, 100) love.graphics.print('Medium', 200, 100) love.graphics.print('Hard', 300, 100) love.graphics.print('I hate Myself', 500, 100) crosshair colour red ]] function hard() love.graphics.setColor(0, colour, 0) love.graphics.circle("fill", target.x, target.y, target.radius) love.graphics.setColor(1, 1, 1) love.graphics.setFont(gameFont) love.graphics.print('Score', 0, 0) love.graphics.print(math.floor(score), 150, 0) love.graphics.print('Seconds Left', 500, 0) love.graphics.print(math.floor(timer), 700, 0) if timer <= 0 then love.graphics.clear(0, 0, 0, 0) love.graphics.setFont(font) love.graphics.print('Game over', 200, 300) love.graphics.print('Your Score ', 200, 0) love.graphics.print(math.floor(score), 400, 100) colour = 0 love.graphics.rectangle("fill", 200, 200, 400, 100) love.graphics.setColor(0, 1, 0) love.graphics.print('Try Again ', 200, 200) function love.mousepressed(x, y, button, istouch, presses) if button == 1 then love.load() end end end end hard() end function love.mousepressed(x, y, button, istouch, presses) if timer >= 0 then if button == 1 then local mouseTarget = distance(x, y, target.x, target.y) if mouseTarget < target.radius then -- Score + depends on how fast you click the circle, the score goes back to 5 and countsdown to less every second score = score + timerScore timerScore = 5 target.x = math.random(target.radius, love.graphics.getWidth() - target.radius) target.y = math.random(target.radius, love.graphics.getHeight() - target.radius) timer = timer + 0.5 -- lets up the game difficulty by decreasing the radius of the circle if target.radius > 12 then target.radius = target.radius - 3 end end end end end function distance(x1, y1, x2, y2) return math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2) end
local palette = require'scene-anothershootout/palette-anotherworld' local icosphere = require'geometry/icosphere' local shader = require'fogShader' local avatar = require'avatar' local physics = require'physics' local m = {} local dome local colorCycler = 1 local cc = colorCycler local onDesktop = false local pewSound = lovr.audio.newSource('scene-anothershootout/pewpew.ogg', 'static') local hitSound = lovr.audio.newSource('scene-anothershootout/rayhit.ogg', 'static') local rays = {} function m.load() lovr.graphics.setBackgroundColor(palette[14]) shader:send('fogColor', {lovr.graphics.getBackgroundColor()}) shader:send('fogStrength', 0.1) local vertices, indices = icosphere(1) dome = lovr.graphics.newMesh(vertices, 'triangles') dome:setVertexMap(indices) -- ground local ground = physics:box(150, 2, 150, {position= vec3(0, -1, 0), kinematic= true, color= palette[11]}) for i= 1, 30 do physics:box(.05 + math.random()*.3, .35 + math.random()*.3, .05 + math.random()*.3, {position= vec3(-3 + math.random()*6, math.random()*5, -5+math.random()*5), color= palette[math.random(19,20)]}) end onDesktop = lovr.headset.getName() == 'Simulator' end function m:update(dt) --helper for selecting colors colorCycler = (colorCycler + dt * 2) % #palette cc = math.floor(colorCycler) + 1 -- gunfire local hand = avatar.hands[2] or avatar.hands[1] if hand.triggerPress then pewSound:stop() pewSound:setPitch(0.9 + 0.1 * math.random()) pewSound:play() local hits = physics:raycast(hand.VRtransform, 0.2, 100) -- shooting ray local from = lovr.math.newVec3(hand.VRtransform:mul(vec3(0,0.055, -0.16))) local to if hits[1] then to = lovr.math.newVec3(hits[1].position) hits[1].collider:applyForce((quat(hand.VRtransform):direction() * dt * 150000):unpack()) hitSound:stop() hitSound:setPitch(0.9 + 0.1 * math.random()) hitSound:play() else to = lovr.math.newVec3(hand.VRtransform:mul(vec3(0,0,-100))) end table.insert(rays, 1, {from = from, to = to, lifetime = 0}) end for i,ray in ipairs(rays) do ray.lifetime = ray.lifetime + dt if ray.lifetime > 0.2 then rays[i] = nil end end end function drawGun() local hand = avatar.hands[2] or avatar.hands[1] lovr.graphics.push() lovr.graphics.transform(hand.VRtransform) lovr.graphics.setColor(palette[1]) stroke(vec3(0, 0.06, 0.03), vec3(0, 0, -0.18), 0, 0.02, 0.02) lovr.graphics.setColor(palette[4]) stroke(vec3(0, 0.05, 0.02), vec3(0, 0, -0.15), 0, 0.026, 0.042) lovr.graphics.setColor(palette[2]) --handle stroke(vec3(0, 0.06, -0.01), vec3(0, -0.11, 0.02), 0, 0.025, 0.04) lovr.graphics.pop() end function circleOf(drawFunction, loc, r, count, faceOut) for id = 1, count do local a = id * 2 * math.pi / count lovr.graphics.push() lovr.graphics.translate(loc) lovr.graphics.translate(r * math.cos(a), 0, r * math.sin(a)) lovr.graphics.rotate(faceOut and -a or 0, 0, 1, 0) drawFunction(id) lovr.graphics.pop() end end function city(size, lod) local averageHeight = 7 local scraperHeight = 30 lovr.graphics.setColor(palette[2]) if not onDesktop then lovr.graphics.cylinder(vec3(0, 0, -80), (1 - lod) * averageHeight, math.pi/2, 1, 0, 0, size * 0.9, size * 0.9, true, 7) end circleOf( function(id) math.randomseed(id) local height = 5 + 4 * math.random() + math.floor(math.random() * 1.2) * 30 * math.random() local offset = 8 * math.random() stroke(vec3(offset,0,2 * offset), vec3(0,height,0), 0, 3, 6) end, vec3(0, 0, -80), size / 2, 30, true) if not onDesktop then dome:draw(17, -15, -65, 20) end end function m:draw() local t = lovr.timer.getTime() lovr.graphics.setColor(palette[cc]) lovr.graphics.setShader(shader) drawGun() city(20, 0) math.randomseed(t) for i,ray in ipairs(rays) do lovr.graphics.setColor(palette[ray.lifetime < 0.1 and 13 or 10]) strokeTo(ray.from, ray.to, 0, 0.05, 0.02) lovr.graphics.setColor(palette[23]) lovr.graphics.sphere(ray.to, 0.08) end end return m
myhighscore = {} dofile(minetest.get_modpath("myhighscore").."/api.lua") dofile(minetest.get_modpath("myhighscore").."/scoreboard.lua")
--[[ Copyright 2016-2020 The Node.lua 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 core = require('core') local rtspMessage = require('rtsp/message') local RtspMessage = rtspMessage.RtspMessage local STATUS_CODES = rtspMessage.STATUS_CODES local meta = { } local exports = { meta = meta } ------------------------------------------------------------------------------- -- RtspCodec local FMT_REQUEST_LINE = "^(%u+) ([^ ]+) (%u+)/(%d%.%d)\r?\n" local FMT_STATUS_LINE = "^RTSP/(%d%.%d) (%d+) ([^\r\n]+)\r?\n" ---@class RtspCodec local RtspCodec = core.Emitter:extend() exports.RtspCodec = RtspCodec function RtspCodec:initialize() self.buffer = '' self.count = 0 self.currentContectLength = nil self.currentPacketLength = nil self.mode = 0 self.offset = 0 end -- ---@param data string function RtspCodec:decode(data) if (not data) then return end self.buffer = self.buffer .. data self.count = (self.count or 0) + 1 local message = nil local hasMore = true local err = nil while (hasMore) do message, hasMore, err = self:_decodeNext() -- console.log('decode', hasMore, message, err) if (message == nil) then -- break elseif (type(message) == 'string') then self:emit('packet', message) elseif (message.statusCode) then self:emit('response', message) else self:emit('request', message) end end end -- ---@param buffer string ---@return string packet ---@return boolean hasMore function RtspCodec:_decodePacket(buffer) if (#buffer < 4) then return nil, nil, 2 end local code, channel, length = string.unpack('>BBI2', buffer) self.currentPacketLength = length if #buffer < length + 4 then return nil, nil, 3 end local packet = buffer:sub(1, length + 4) self.buffer = buffer:sub(length + 4 + 1); local hasMore = self.buffer and (#self.buffer > 0) --[[ if (hasMore) then print('packet', #packet, #self.buffer) end --]] return packet, hasMore end -- ---@param buffer string ---@return string packet ---@return boolean hasMore function RtspCodec:_decodeMessageContent(buffer) if (#buffer < self.contentLength) then return nil, nil, 4 end local message = self.message; message.content = buffer:sub(1, self.contentLength) self.buffer = buffer:sub(self.contentLength + 1) self.mode = 0 self.message = nil self.contentLength = 0 local hasMore = self.buffer and (#self.buffer > 0) return message, hasMore, 5 end -- ---@param header string ---@return string packet ---@return boolean hasMore function RtspCodec:_decodeMessageHeader(header) -- Parse the status/request line local head = { } local _, offset -- [[ _, offset, head.version, head.statusCode, head.statusMessage = header:find(FMT_STATUS_LINE) if not offset then _, offset, head.method, head.path, head.protocol, head.version = header:find(FMT_REQUEST_LINE) if not offset then -- error("expected RTSP data") return nil, nil, 'expected RTSP data' end end --]] head.statusCode = head.statusCode and tonumber(head.statusCode) head.version = head.version and tonumber(head.version) -- We need to inspect some headers to know how to parse the body. local contentLength = 0 local message = RtspMessage:new() message.method = head.method message.path = head.path message.version = head.version message.statusCode = head.statusCode message.statusMessage = head.statusMessage -- Parse the header lines local key, value -- [[ while true do _, offset, key, value = header:find("^([^:\r\n]+): *([^\r\n]+)\r?\n", offset + 1) if not offset then break end -- Inspect a few headers and remember the values local lowerKey = key:lower() if lowerKey == "content-length" then contentLength = tonumber(value) end message.headers[key] = value; end --]] local hasMore = true if contentLength > 0 then self.mode = 1 self.contentLength = contentLength; self.message = message return nil, hasMore, 7 else return message, hasMore, 8 end end -- ---@return string message ---@return boolean hasMore ---@return any err function RtspCodec:_decodeNext() local buffer = self.buffer if (not buffer) or (#buffer <= 0) then return nil, nil, 1 end -- Start 4 bytes if (string.byte(buffer, 1) == 0x24) then -- $ - start code return self:_decodePacket(buffer) end -- Parse message content if (self.mode == 1) then return self:_decodeMessageContent(buffer) end -- Find message header end local _, length = buffer:find("\r?\n\r?\n", 1) -- console.log('length', length) -- First make sure we have all the head before continuing if not length then if #buffer < 8 * 1024 then return nil, nil, 6 end -- But protect against evil clients by refusing heads over 8K long. -- error("entity too large") return nil, nil, "entity too large" end local header = buffer:sub(1, length) self.buffer = buffer:sub(length + 1) return self:_decodeMessageHeader(header) end -- @param message {RtspMessage} function RtspCodec:encode(message) local head -- start line local version = message.version or 1.0 if message.method then -- Request Start Line local path = message.path assert(path and #path > 0, "expected non-empty path") head = { message.method .. ' ' .. path .. ' RTSP/' .. version .. '\r\n' } else -- Response Start Line local scheme = message.scheme or 'RTSP' local code = message.statusCode local reason = message.statusMessage or STATUS_CODES[message.statusCode] or 'OK' head = { scheme .. '/' .. version .. ' ' .. code .. ' ' .. reason .. '\r\n' } end if (message.content) then message:setHeader('Content-Length', #message.content) end -- headers for i = 1, #message.headers do -- console.log(i, message.headers[i]) local key, value = table.unpack(message.headers[i]) local lowerKey = key:lower() value = string.gsub(tostring(value), "[\r\n]+", " ") head[#head + 1] = key .. ': ' .. tostring(value) .. '\r\n' end -- headers end head[#head + 1] = '\r\n' -- message content if (message.content) then head[#head + 1] = message.content end return table.concat(head) end ------------------------------------------------------------------------------- -- exports function exports.newCodec() return RtspCodec:new() end function exports.parseHeaderValue(line, sep, eq) eq = eq or '=' sep = sep or ';' local tokens = line:split(sep) local data = {} local value = tokens[1] for i = 2, #tokens do local token = tokens[i] local ret = token:find(eq) if ret then data[token:sub(1, ret - 1)] = token:sub(ret + 1) else data[token] = '' end end return value, data end return exports
vim.g.nvim_tree_ignore = { ".git", "node_modules" } vim.g.nvim_tree_gitignore = 1 vim.g.nvim_tree_auto_open = 1 vim.g.nvim_tree_auto_close = 1 vim.g.nvim_tree_follow = 1 vim.g.nvim_tree_auto_ignore_ft = { "dashboard", "startify" } vim.g.nvim_tree_indent_markers = 1 vim.g.nvim_tree_git_hl = 1 vim.g.nvim_tree_disable_netrw = 0 vim.g.nvim_tree_lsp_diagnostics = 1 require("nvim-tree.events").on_nvim_tree_ready(function() vim.cmd("NvimTreeRefresh") end)
--[[ Copyright: (c) 2014 Jason White 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. Author: Jason White ]] require 'cairo' --[[ Configuration settings. Change these if you dare. ]] local settings = { font = { -- Font used for small text (e.g., cpu info) small = "Cantarell", -- Font used for large text (e.g., time, battery percentage) large = "Impact", }, cpu = { -- Number of CPUs. Use 0 to auto-detect the number. count = 0, --[[ Starting and ending angles of CPU widgets in radians. (This adjusts the spread.) Angles start at 3:00 on a clock and increase in the clockwise direction. (Recall that 2*pi radians constitutes one full cycle.) ]] angle_start = 1 * math.pi, -- Start at 9:00 angle_end = 2 * math.pi, -- and increase to 3:00 }, --[[ Time formatting. ]] time = { --[[ Time format (e.g., 12:37 PM) If you wish to use 24-hour time, you may need to adjust the font and/or font size such that the text below doesn't overlap. ]] time = "%I:%M %p", -- 12-hour time --time = "%H:%M", -- 24-hour time -- Day of the week day = "%A", -- Date (e.g., October 16, 2137) date = "%B %e, %Y", }, --[[ Network settings ]] network = { --[[ List of network interfaces to display. Comment out for network interfaces to be automatically detected. You can discover your network interface names by running "ip link show" command or listing the directory "/sys/class/net/". (Network interfaces are automatically detected using the latter method.) The number of "lanes" in the ring will automatically adjust to the number of network interfaces. Outer rings are listed first, inner rings are listed last. ]] --interfaces = {"eth0", "wlan1"}, --[[ Interface names to ignore when autodetecting. ]] ignore = {"lo"}, }, -- Battery ID battery = 0, } --[[ Color scheme best for a somewhat dark desktop background. ]] local dark_color_scheme = { --[[ Background color of the entire circle. This can be commented out if no background is desired. This is primarily useful if the desktop background color does not contrast well with Conky. ]] --bg = { 0, 0, 0, .1 }, --[[ Primary ring color ]] ring = { bg = { 1, 1, 1, .2 }, fg = { 1, 1, 1, .9 }, }, --[[ Alternate ring color ]] ring_alt = { bg = { 1, 1, 1, .2 }, fg = { .7, .9, 1, .8 }, }, --[[ Primary text color ]] text = { 1, 1, 1, 0.9 }, --[[ Alternate text color ]] text_alt = { 0.01, 0.75, 1, 1 }, --[[ Temperature colors. As many colors as desired can be added to this table. ]] temperature = { { .7, .9, 1, 0.9 }, { 1, 1, 0, 0.9 }, { 1, .5, 0, 0.9 }, { 1, 0, 0, 0.9 }, }, --[[ Battery colors. As many colors as desired can be added to this table. ]] battery = { { 0, 1, 0, 0.9 }, { 1, 1, 0, 0.9 }, { 1, .5, 0, 0.9 }, { 1, 0, 0, 0.9 }, }, } --[[ Selects the color scheme. ]] local colors = dark_color_scheme --[[ END OF USER CONFIGURATION OPTIONS ]] --[[ Detect the number of CPU cores. ]] local function get_cpu_count() if io.popen then local n = tonumber(io.popen("nproc"):read()) if n then return n end end -- Fallback method local n = 0 while tonumber(conky_parse("${cpu cpu".. n .."}")) do n = n + 1 end return n - 1 end --[[ Helper function. Checks if a value is in a table. ]] function table.contains(t, value) for i,v in ipairs(t) do if v == value then return true end end return false end --[[ Detect network interfaces ]] local function get_network_interfaces(ignore) interfaces = {} for iface in io.popen("ls -1 --indicator-style=none /sys/class/net"):lines() do if not table.contains(ignore, iface) then table.insert(interfaces, iface) end end return interfaces end if settings.network.interfaces == nil then settings.network.interfaces = get_network_interfaces(settings.network.ignore) end --[[ Draws a ring in the clockwise direction. ]] local function draw_ring(cr, ring, percentage, arc_fn) arc_fn = arc_fn or cairo_arc local sa, ea = ring.start_angle, ring.end_angle local t_arc = percentage * (ea - sa) cairo_new_sub_path(cr) cairo_set_line_width(cr, ring.thickness) -- Draw background ring if ring.bg then arc_fn(cr, ring.x, ring.y, ring.radius, sa, ea) cairo_set_source_rgba(cr, unpack(ring.bg)) cairo_stroke(cr) end -- Draw foreground ring if ring.fg then arc_fn(cr, ring.x, ring.y, ring.radius, sa, sa + t_arc) cairo_set_source_rgba(cr, unpack(ring.fg)) cairo_stroke(cr) end cairo_close_path(cr) end --[[ Draws a ring in the counter-clockwise direction. ]] local function draw_ring_inverse(cr, ring, percentage) draw_ring(cr, ring, percentage, cairo_arc_negative) end --[[ Draws aligned text. ]] local function draw_text_aligned(cr, text, x, y, x_align, y_align) local extents = cairo_text_extents_t:create() cairo_text_extents(cr, text, extents) local x = x - extents.width * x_align local y = y - extents.height * y_align cairo_move_to(cr, x, y) cairo_show_text(cr, text) return x, y, extents.width, extents.height end local function percent_index(p, t) return t[math.min(math.floor(p * #t) + 1, #t)] end --[[ Draws the time widget ]] local function draw_time_rings(cr) local t = os.date("*t") local ring = { bg = colors.ring_alt.bg, fg = colors.ring_alt.fg, x = .5, y = .5, radius = .5-2/536, thickness = 4/536, start_angle = -math.pi * 0.5, end_angle = math.pi * 1.5 } -- Draw hours draw_ring(cr, ring, (t.hour % 12) / 12) -- Draw minutes ring.radius = ring.radius - 1.5 * ring.thickness --ring.fg[4] = 0.6 draw_ring(cr, ring, t.min / 60) -- Draw seconds ring.radius = ring.radius - 1.5 * ring.thickness --ring.fg[4] = 0.7 draw_ring(cr, ring, t.sec / 60) end --[[ Draws the time text ]] local function draw_time_display(cr) local time = os.date(settings.time.time) local day = os.date(settings.time.day) local date = os.date(settings.time.date) local extents = cairo_text_extents_t:create() -- Set the time font cairo_select_font_face(cr, settings.font.large, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL ) cairo_set_font_size(cr, 56/536) -- Get the size of the time text cairo_text_extents(cr, time, extents) local time_w = extents.width -- Center horizontally local time_x = .5 - time_w / 2 local time_y = .5 + 16/536 -- Draw the time cairo_set_source_rgba(cr, unpack(colors.text)) cairo_move_to(cr, time_x, time_y) cairo_show_text(cr, time) -- Set the day/date font cairo_select_font_face(cr, settings.font.small, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD ) cairo_set_font_size(cr, 13/536) -- Get the size of the day text cairo_text_extents(cr, day, extents) local day_x = time_x + 4/536 local day_y = time_y + extents.height + 2/536 -- Draw the day cairo_set_source_rgba(cr, unpack(colors.text_alt)) cairo_move_to(cr, day_x, day_y) cairo_show_text(cr, day) -- Get the size of the date text cairo_text_extents(cr, date, extents) -- Right-align the date under the time local date_x = time_x + time_w - extents.width local date_y = time_y + extents.height + 2/536 -- Draw the date cairo_move_to(cr, date_x, date_y) cairo_show_text(cr, date) end --[[ Draws a single CPU widget at the specified coordinates. The ID is a number starting at 1 for each CPU. ]] local function draw_cpu_widget(cr, x, y, id) local ring = { bg = colors.ring.bg, x = x, y = y, radius = 32/536, thickness = 10/536, start_angle = -math.pi * 1.3, end_angle = math.pi * 0.3 } local usage = tonumber(conky_parse("${cpu cpu".. id .."}")) or 0 local percent = usage/100 ring.fg = percent_index(percent, colors.temperature) draw_ring(cr, ring, percent) -- Draw the CPU ID cairo_select_font_face(cr, settings.font.small, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD) cairo_set_font_size(cr, 10/536) cairo_set_source_rgba(cr, unpack(colors.text)) -- Draw the name draw_text_aligned(cr, "CPU " .. id, x, y - 4, 0.5, 0.5) -- Draw the CPU frequency draw_text_aligned(cr, conky_parse("${freq_g ".. id .."}") .. " GHz", x, y, 0.5, -0.5 ) -- Draw the percentage draw_text_aligned(cr, usage .. "%", x, y + ring.radius, 0.5, 0) end --[[ Draws all CPU widgets at pre-computed coordinates. ]] local function draw_cpu_widgets(cr, cpus) for k,v in pairs(cpus) do draw_cpu_widget(cr, v.x, v.y, k) end end --[[ Calculate the positions for the CPU widgets ]] local function get_cpus() local cpus = {} --local angle_start = math.pi*.5 - settings.cpu_spread/2 --local angle_end = math.pi*0.5 + settings.cpu_spread/2 local angle_start = settings.cpu.angle_start local angle_end = settings.cpu.angle_end local angle_inc = (angle_end - angle_start) / (settings.cpu.count-1) local angle = angle_start -- current angle local length = .5 - 74/536 for i=1, settings.cpu.count do table.insert(cpus, { x = length * math.cos(angle) + .5, y = length * math.sin(angle) + .5, }) angle = angle + angle_inc end return cpus end -- High watermarks for each network interface local network_max = {} --[[ Draws single network ring. This includes the upload and download speeds. ]] local function draw_network_ring(cr, interface, radius, thickness) local ring = { bg = colors.ring.bg, x = .5, y = .5, radius = radius, thickness = thickness, start_angle = -math.pi * 0.98, end_angle = -math.pi * 0.52 } local rate_up = tonumber(conky_parse("${upspeedf ".. interface .."}")) local rate_down = tonumber(conky_parse("${downspeedf ".. interface .."}" )) -- Calculate high watermarks local max = network_max[interface] if not max then max = {48, 128} end max[1] = math.max(max[1], rate_up) max[2] = math.max(max[1], rate_down) network_max[interface] = max -- Upload speed bar local p = rate_up / max[1] ring.fg = percent_index(p, colors.temperature) draw_ring(cr, ring, p) -- Download speed bar local p = rate_down / max[2] ring.fg = percent_index(p, colors.temperature) ring.start_angle = -math.pi * 0.02 ring.end_angle = -math.pi * 0.48 draw_ring_inverse(cr, ring, p) end --[[ Draws all network rings. ]] local function draw_network_rings(cr, radius, interfaces) local thickness = 12/536 local spacing = 1/536 local n = #interfaces if n == 0 then return end -- Thickness of each ring local ring_thickness = (thickness - spacing*(n - 1))/n -- Starting ring radius local ring_radius = radius + (thickness - ring_thickness) * .5 -- Draw the first ring draw_network_ring(cr, interfaces[1], ring_radius, ring_thickness) for i=2, n do ring_radius = ring_radius - ring_thickness - spacing draw_network_ring(cr, interfaces[i], ring_radius, ring_thickness) end cairo_select_font_face(cr, settings.font.small, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL ) cairo_set_font_size(cr, 11/536) cairo_set_source_rgba(cr, unpack(colors.text)) -- Draw the stats for each interface for k,v in ipairs(interfaces) do local upspeed = conky_parse(("${upspeed %s}"):format(v)):gsub("%s+$", "") local downspeed = conky_parse(("${downspeed %s}"):format(v)):gsub("%s+$", "") -- Only show the stats if something is happening if upspeed ~= "0B" then draw_text_aligned(cr, upspeed .. "/s", .5 - 16/536, .5 - radius + (48 + (k-1) * 16)/536, 1, 0 ) end if downspeed ~= "0B" then draw_text_aligned(cr, downspeed .. "/s", .5 + 16/536, .5 - radius + (48 + (k-1) * 16)/536, 0, 0 ) end end end --[[ Draws the memory ring. ]] local function draw_memory_widget(cr, radius) local ring = { bg = colors.ring.bg, fg = colors.ring.fg, x = .5, y = .5, radius = radius, thickness = 12/536, start_angle = math.pi * 0.02, end_angle = math.pi * 0.98, } local used = conky_parse("${mem}") local total = conky_parse("${memmax}") local percent = (tonumber(conky_parse("${memperc}")) or 0) -- Draw the ring draw_ring(cr, ring, percent / 100) -- Draw the memory usage cairo_select_font_face(cr, settings.font.small, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL ) cairo_set_font_size(cr, 11/536) cairo_set_source_rgba(cr, unpack(colors.text)) local _, y, _, h = draw_text_aligned(cr, used .." / ".. total, .5, .5 + radius - 36/536, .5, 0 ) -- Draw the memory usage percentage cairo_select_font_face(cr, settings.font.small, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD ) cairo_set_font_size(cr, 10/536) cairo_set_source_rgba(cr, unpack(colors.text_alt)) draw_text_aligned(cr, percent .. "%", .5, y + h + 4/536, .5, 0 ) end -- Nice battery status names. local battery_state = { C = "Charging", D = "Discharging", F = "Full", E = "Empty", -- The battery widget should not be displayed if this is the case. --N = "Not Present", --U = "Unknown", } --[[ Draws the battery ring and charge percentage. ]] local function draw_battery_widget(cr) local state = battery_state[conky_parse("${battery_short}"):sub(1,1)] if not state then return end local ring = { x = .5, y = .5, radius = .5 - 24/536, thickness = 8/536, start_angle = math.pi * -0.5, end_angle = math.pi * 1.5, } local battery = conky_parse("${battery_percent}") local p = tonumber(battery)/100 ring.fg = percent_index(1-p, colors.battery) draw_ring(cr, ring, p) cairo_select_font_face(cr, settings.font.large, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL) cairo_set_font_size(cr, 40/536) cairo_set_source_rgba(cr, unpack(colors.text)) draw_text_aligned(cr, battery .. "%", .5, 1 - 62/536, .5, 0 ) cairo_select_font_face(cr, settings.font.small, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD) cairo_set_font_size(cr, 12/536) cairo_set_source_rgba(cr, unpack(colors.text_alt)) draw_text_aligned(cr, state, .5, 1 - 60/536, .5, -1 ) end local cpus local window -- Called when the window size changes local function invalidate() window = { width = conky_window.width, height = conky_window.height, } cpus = get_cpus() end function conky_main() if conky_window == nil then return end if settings.cpu.count == 0 then local n = get_cpu_count() if n > 0 then --print(n .." CPU cores detected.") settings.cpu.count = n else -- Conky probably isn't ready yet. return end end -- Window size change? if (not window or window.width ~= conky_window.width or window.height ~= conky_window.height ) then --print("Window invalidated") invalidate() end -- Create a surface to draw on. local cs = cairo_xlib_surface_create( conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height ) local cr = cairo_create(cs) -- Draw the background if colors.bg then cairo_save(cr) cairo_scale(cr, conky_window.width, conky_window.height) cairo_arc(cr, .5, .5, .5 - 1/536, 0, 2*math.pi) cairo_set_source_rgba(cr, unpack(colors.bg)) cairo_fill_preserve(cr) cairo_restore(cr) cairo_stroke(cr) end cairo_scale(cr, conky_window.width, conky_window.height) -- Draw all the widgets draw_network_rings(cr, 130/536, settings.network.interfaces) draw_memory_widget(cr, 130/536) if settings.battery then draw_battery_widget(cr) end draw_cpu_widgets(cr, cpus) draw_time_rings(cr) draw_time_display(cr) -- Cleanup cairo_destroy(cr) cairo_surface_destroy(cs) end
RotateObjectState = AbstractState:extends{} function RotateObjectState:init() AbstractState.init(self) SB.SetMouseCursor("resize-x") self.ghostViews = {} end function RotateObjectState:GetRotatedObject(params, bridge) local objectID = params.objectID local angle = params.angle local avgX, avgZ = params.avgX, params.avgZ local pos = bridge.s11n:Get(objectID, "pos") local objectX, objectY, objectZ = pos.x, pos.y, pos.z local dx = objectX - avgX local dz = objectZ - avgZ local angle2 = angle + math.atan2(dx, dz) local len = math.sqrt(dx * dx + dz * dz) local objectAngle = 0 if bridge.s11n.getFuncs.dir then local dir = bridge.s11n:Get(objectID, "dir") objectAngle = math.atan2(dir.x, dir.z) + angle end local object = { angle = objectAngle, pos = { x = objectX, y = objectY, z = objectZ, } } if len > 0 then local x, z = avgX + len * math.sin(angle2), avgZ + len * math.cos(angle2) if math.abs(objectY - Spring.GetGroundHeight(objectX, objectZ)) < 5 then -- on ground, stick to it objectY = Spring.GetGroundHeight(x, z) end object.pos = { x = x, y = objectY, z = z, } end return object end function RotateObjectState:MouseMove(mx, my, ...) local result, coords = Spring.TraceScreenRay(mx, my, true) if result ~= "ground" then return end local selection = SB.view.selectionManager:GetSelection() local selCount = SB.view.selectionManager:GetSelectionCount() local avg = {x=0, y=0, z=0} for selType, selected in pairs(selection) do local bridge = ObjectBridge.GetObjectBridge(selType) for _, objectID in pairs(selected) do local pos = bridge.s11n:Get(objectID, "pos") avg.x = avg.x + pos.x avg.y = avg.y + pos.y avg.z = avg.z + pos.z end end avg.x = avg.x / selCount avg.y = avg.y / selCount avg.z = avg.z / selCount local dx, dz = coords[1] - avg.x, coords[3] - avg.z local angle = math.atan2(dx, dz) if self.angle == nil then self.angle = angle end angle = angle - self.angle self.ghostViews = {} for selType, selected in pairs(selection) do local bridge = ObjectBridge.GetObjectBridge(selType) self.ghostViews[selType] = {} for _, objectID in pairs(selected) do local object = self:GetRotatedObject({ objectID = objectID, angle = angle, avgX = avg.x, avgZ = avg.z, }, bridge) self.ghostViews[selType][objectID] = object end end end function RotateObjectState:MouseRelease(...) if not self.ghostViews then return end local commands = {} for objType, objects in pairs(self.ghostViews) do local bridge = ObjectBridge.GetObjectBridge(objType) for objectID, object in pairs(objects) do local modelID = bridge.getObjectModelID(objectID) local opts = { pos = object.pos } if bridge.s11n.setFuncs.dir then opts.dir = { x = math.sin(object.angle), y = 0, z = math.cos(object.angle) } end local cmd = SetObjectParamCommand(bridge.name, modelID, opts) table.insert(commands, cmd) end end local compoundCommand = CompoundCommand(commands) SB.commandManager:execute(compoundCommand) SB.stateManager:SetState(DefaultState()) end function RotateObjectState:DrawObject(objectID, object, bridge, shaderObj) local objectDefID = bridge.GetObjectDefID(objectID) local objectTeamID = bridge.s11n:Get(objectID, "team") gl.Uniform(shaderObj.teamColorID, Spring.GetTeamColor(objectTeamID)) bridge.DrawObject({ color = { r = 0.4, g = 1, b = 0.4, a = 0.8 }, objectDefID = objectDefID, objectTeamID = objectTeamID, pos = object.pos, angle = { x = 0, y = math.deg(object.angle), z = 0 }, }) end function RotateObjectState:DrawWorld() if not self.ghostViews then return end gl.PushAttrib(GL.DEPTH_BUFFER_BIT) gl.DepthTest(GL.LEQUAL) gl.DepthMask(true) local shaderObj = SB.view.modelShaders:GetShader() gl.UseShader(shaderObj.shader) gl.Uniform(shaderObj.timeID, os.clock()) if self.ghostViews.unit then for objectID, object in pairs(self.ghostViews.unit) do self:DrawObject(objectID, object, unitBridge, shaderObj) end end if self.ghostViews.feature then for objectID, object in pairs(self.ghostViews.feature) do self:DrawObject(objectID, object, featureBridge, shaderObj) end end gl.UseShader(0) for objType, objs in pairs(self.ghostViews) do if objType ~= "unit" and objType ~= "feature" then local bridge = ObjectBridge.GetObjectBridge(objType) if bridge.DrawObject then for objectID, object in pairs(objs) do bridge.DrawObject(objectID, object) end end end end gl.PopAttrib(GL.DEPTH_BUFFER_BIT) end
item_stoneskin = class(TransformationBaseClass) LinkLuaModifier("modifier_intrinsic_multiplexer", "modifiers/modifier_intrinsic_multiplexer.lua", LUA_MODIFIER_MOTION_NONE) LinkLuaModifier("modifier_item_stoneskin_stacking_stats", "items/transformation/stoneskin.lua", LUA_MODIFIER_MOTION_NONE) LinkLuaModifier("modifier_item_stoneskin_aura", "items/transformation/stoneskin.lua", LUA_MODIFIER_MOTION_NONE) LinkLuaModifier("modifier_item_stoneskin_aura_effect", "items/transformation/stoneskin.lua", LUA_MODIFIER_MOTION_NONE) LinkLuaModifier("modifier_item_stoneskin_stone_armor", "items/transformation/stoneskin.lua", LUA_MODIFIER_MOTION_NONE) function item_stoneskin:GetIntrinsicModifierName() return "modifier_intrinsic_multiplexer" end function item_stoneskin:GetIntrinsicModifierNames() return { "modifier_item_stoneskin_stacking_stats", "modifier_item_stoneskin_aura" } end function item_stoneskin:GetTransformationModifierName() return "modifier_item_stoneskin_stone_armor" end item_stoneskin_2 = item_stoneskin ------------------------------------------------------------------------ modifier_item_stoneskin_stacking_stats = class(ModifierBaseClass) function modifier_item_stoneskin_stacking_stats:IsHidden() return true end function modifier_item_stoneskin_stacking_stats:IsDebuff() return false end function modifier_item_stoneskin_stacking_stats:IsPurgable() return false end function modifier_item_stoneskin_stacking_stats:GetAttributes() return MODIFIER_ATTRIBUTE_MULTIPLE end function modifier_item_stoneskin_stacking_stats:OnCreated() local ability = self:GetAbility() if ability and not ability:IsNull() then self.int = ability:GetSpecialValueFor("bonus_intellect") self.armor = ability:GetSpecialValueFor("bonus_armor") end end function modifier_item_stoneskin_stacking_stats:OnRefresh() local ability = self:GetAbility() if ability and not ability:IsNull() then self.int = ability:GetSpecialValueFor("bonus_intellect") self.armor = ability:GetSpecialValueFor("bonus_armor") end end function modifier_item_stoneskin_stacking_stats:DeclareFunctions() return { MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS, MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, } end function modifier_item_stoneskin_stacking_stats:GetModifierPhysicalArmorBonus() return self.armor or self:GetAbility():GetSpecialValueFor("bonus_armor") end function modifier_item_stoneskin_stacking_stats:GetModifierBonusStats_Intellect() return self.int or self:GetAbility():GetSpecialValueFor("bonus_intellect") end -- function modifier_item_stoneskin_stacking_stats:OnStackCountChanged(numOldStacks) -- -- Echo stack count to a property on the item so that it can be checked for -- -- item icon purposes -- if IsClient() then -- local ability = self:GetAbility() -- ability.stoneskinState = self:GetStackCount() -- end -- end -- function modifier_item_stoneskin_stacking_stats:OnDestroy() -- local item = self:GetAbility() -- if item and item.mod and not item.mod:IsNull() then -- item.mod:Destroy() -- item.mod = nil -- end -- end --------------------------------------------------------------------------------------------------- modifier_item_stoneskin_aura = class(ModifierBaseClass) function modifier_item_stoneskin_aura:IsHidden() return true end function modifier_item_stoneskin_aura:IsDebuff() return false end function modifier_item_stoneskin_aura:IsPurgable() return false end function modifier_item_stoneskin_aura:IsAura() return true end function modifier_item_stoneskin_aura:GetModifierAura() return "modifier_item_stoneskin_aura_effect" end function modifier_item_stoneskin_aura:GetAuraRadius() return self:GetAbility():GetSpecialValueFor("aura_radius") end function modifier_item_stoneskin_aura:GetAuraSearchTeam() return DOTA_UNIT_TARGET_TEAM_FRIENDLY end function modifier_item_stoneskin_aura:GetAuraSearchType() return bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC) end --------------------------------------------------------------------------------------------------- modifier_item_stoneskin_aura_effect = class(ModifierBaseClass) function modifier_item_stoneskin_aura_effect:IsHidden() return false end function modifier_item_stoneskin_aura_effect:IsDebuff() return false end function modifier_item_stoneskin_aura_effect:IsPurgable() return false end function modifier_item_stoneskin_aura_effect:OnCreated() local ability = self:GetAbility() if ability and not ability:IsNull() then self.hp_regen_amp = ability:GetSpecialValueFor("hp_regen_amp") self.lifesteal_amp = ability:GetSpecialValueFor("lifesteal_amp") self.heal_amp = ability:GetSpecialValueFor("heal_amp") self.spell_lifesteal_amp = ability:GetSpecialValueFor("spell_lifesteal_amp") end end function modifier_item_stoneskin_aura_effect:OnRefresh() local ability = self:GetAbility() if ability and not ability:IsNull() then self.hp_regen_amp = ability:GetSpecialValueFor("hp_regen_amp") self.lifesteal_amp = ability:GetSpecialValueFor("lifesteal_amp") self.heal_amp = ability:GetSpecialValueFor("heal_amp") self.spell_lifesteal_amp = ability:GetSpecialValueFor("spell_lifesteal_amp") end end function modifier_item_stoneskin_aura_effect:DeclareFunctions() return { MODIFIER_PROPERTY_HP_REGEN_AMPLIFY_PERCENTAGE, MODIFIER_PROPERTY_HEAL_AMPLIFY_PERCENTAGE_TARGET, MODIFIER_PROPERTY_LIFESTEAL_AMPLIFY_PERCENTAGE, MODIFIER_PROPERTY_SPELL_LIFESTEAL_AMPLIFY_PERCENTAGE, } end function modifier_item_stoneskin_aura_effect:GetModifierHPRegenAmplify_Percentage() return self.hp_regen_amp or self:GetAbility():GetSpecialValueFor("hp_regen_amp") end function modifier_item_stoneskin_aura_effect:GetModifierHealAmplify_PercentageTarget() return self.heal_amp or self:GetAbility():GetSpecialValueFor("heal_amp") end function modifier_item_stoneskin_aura_effect:GetModifierLifestealRegenAmplify_Percentage() return self.lifesteal_amp or self:GetAbility():GetSpecialValueFor("lifesteal_amp") end function modifier_item_stoneskin_aura_effect:GetModifierSpellLifestealRegenAmplify_Percentage() return self.spell_lifesteal_amp or self:GetAbility():GetSpecialValueFor("spell_lifesteal_amp") end function modifier_item_stoneskin_aura_effect:GetTexture() return "custom/stoneskin_2" end ------------------------------------------------------------------------ modifier_item_stoneskin_stone_armor = class(ModifierBaseClass) function modifier_item_stoneskin_stone_armor:IsHidden() return false end function modifier_item_stoneskin_stone_armor:IsDebuff() return false end function modifier_item_stoneskin_stone_armor:IsPurgable() return false end function modifier_item_stoneskin_stone_armor:OnCreated() if IsServer() then self:GetParent():EmitSound("Hero_EarthSpirit.Petrify") end end function modifier_item_stoneskin_stone_armor:DeclareFunctions() return { MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS, MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS, MODIFIER_PROPERTY_AVOID_DAMAGE, MODIFIER_PROPERTY_STATUS_RESISTANCE_STACKING, --MODIFIER_PROPERTY_MOVESPEED_ABSOLUTE } end function modifier_item_stoneskin_stone_armor:GetModifierPhysicalArmorBonus() if not self:GetAbility() then if not self:IsNull() then self:Destroy() end return 0 end return self:GetAbility():GetSpecialValueFor("stone_armor") end function modifier_item_stoneskin_stone_armor:GetModifierMagicalResistanceBonus() if not self:GetAbility() then if not self:IsNull() then self:Destroy() end return 0 end return self:GetAbility():GetSpecialValueFor("stone_magic_resist") end function modifier_item_stoneskin_stone_armor:GetModifierAvoidDamage(event) local parent = self:GetParent() local ability = self:GetAbility() local chance = 50 if ability and not ability:IsNull() then chance = ability:GetSpecialValueFor("stone_block_chance") end if event.ranged_attack == true and event.damage_category == DOTA_DAMAGE_CATEGORY_ATTACK and RollPseudoRandomPercentage(chance, DOTA_PSEUDO_RANDOM_CUSTOM_GAME_1, parent) == true then return 1 end return 0 end function modifier_item_stoneskin_stone_armor:GetModifierStatusResistanceStacking() if not self:GetAbility() then if not self:IsNull() then self:Destroy() end return 0 end return self:GetAbility():GetSpecialValueFor("stone_status_resist") end function modifier_item_stoneskin_stone_armor:GetStatusEffectName() return "particles/status_fx/status_effect_earth_spirit_petrify.vpcf" end function modifier_item_stoneskin_stone_armor:StatusEffectPriority() return MODIFIER_PRIORITY_ULTRA end -- function modifier_item_stoneskin_stone_armor:GetModifierMoveSpeed_Absolute() -- if not self:GetAbility() then -- if not self:IsNull() then -- self:Destroy() -- end -- return -- end -- return self:GetAbility():GetSpecialValueFor("stone_move_speed") -- end function modifier_item_stoneskin_stone_armor:GetTexture() return "custom/stoneskin_2_active" end
local M={} M.on_attach = function(client) require'lsp_status'.on_attach(client) end return M
local TriHard = require('trihard') local g = love.graphics local function createTexture(w, h) local texture = g.newCanvas() g.setCanvas(texture) g.draw(g.newMesh({ {0, 0, 0, 0, 255, 255, 0}, {w, 0, 1, 0, 0, 255, 255}, {w, h, 1, 1, 255, 0, 255}, {0, h, 1, 1, 0, 0, 255} })) g.setCanvas() return texture end local function loadPolygonData(filepath) local file = io.open(filepath, 'r') local vertices = {} while true do local x, y = file:read('*n'), file:read('*n') if x == nil or y == nil then break end table.insert(vertices, x) table.insert(vertices, y) end return vertices end local function buildGeometry(vertices) shape = TriHard.Shape:new(vertices, {}) shape:sanitize() local material = TriHard.Material:new() geometry = TriHard.Geometry:new(shape, material) end local files = { '2.dat', 'bird.dat', -- 'custom.dat', 'debug.dat', -- 'debug2.dat', 'diamond.dat', 'dude.dat', 'funny.dat', 'kzer-za.dat', 'nazca_heron.dat', 'nazca_monkey.dat', -- 'sketchup.dat', 'star.dat', 'strange.dat', 'tank.dat', 'test.dat', } local currentFileIndex = 1 function love.load() background = createTexture(g.getWidth(), g.getHeight()) buildGeometry(loadPolygonData('test/data/' .. files[currentFileIndex])) g.setLineJoin('none') end function love.mousepressed() currentFileIndex = currentFileIndex % #files + 1 print(files[currentFileIndex]) buildGeometry(loadPolygonData('test/data/' .. files[currentFileIndex])) end function love.draw() g.setColor(255, 255, 255) g.draw(background) local b = geometry.bounds local w = b[3] - b[1] local h = b[4] - b[2] local sx, sy = g.getWidth() / w, g.getHeight() / h local scale = 1 if sx > sy then scale = sy else scale = sx end g.setLineWidth(1 / scale) g.scale(scale) g.translate(-b[1], -b[2]) geometry:draw(0, 0) g.setColor(0, 0, 0) for i,triangle in ipairs(geometry.triangles) do g.polygon('line', triangle) end end
local TdMapName = "ns2_tgns_td" local NetworkMessageNames = {WaveInProgress = "td_WaveInProgress", RecentlyWelded = "td_RecentlyWelded"} local waveInProgress local recentlyWeldedTime = {} local recentWeldTimespanInSeconds = 3 local recentWeldEffectEnabled -- kCatPackDuration = 60 TGNS.RegisterNetworkMessage(NetworkMessageNames.WaveInProgress, {i="boolean"}) TGNS.RegisterNetworkMessage(NetworkMessageNames.RecentlyWelded, {i="integer", t="float"}) local function wasRecentlyWelded(player) local result = false if player and player.GetTeamNumber and player.GetClientIndex then result = player:GetTeamNumber() == kMarineTeamType and Shared.GetTime() - (recentlyWeldedTime[player:GetClientIndex()] or 0) < recentWeldTimespanInSeconds end return result end Event.Hook("MapPostLoad", function() if Shared.GetMapName() == TdMapName then local originalMarineSetOrigin originalMarineSetOrigin = Class_ReplaceMethod("Marine", "SetOrigin", function(marineSelf, newOrigin) if not waveInProgress then originalMarineSetOrigin(marineSelf, newOrigin) end end) -- local originalLOSMixinOnUpdate -- originalLOSMixinOnUpdate = Class_ReplaceMethod("LOSMixin", "OnUpdate", function(losMixinSelf, deltaTime) -- losMixinSelf.sighted = true -- originalLOSMixinOnUpdate(marineSelf, deltaTime) -- end) Grenade.kMinLifeTime = 0 Class_ReplaceMethod("Player", "GetCanTakeDamageOverride", function(playerSelf) return false end) local originalMarineOnUpdateAnimationInput = Marine.OnUpdateAnimationInput Marine.OnUpdateAnimationInput = function(marineSelf, modelMixin) local originalMarineSelfCatpackboost = marineSelf.catpackboost marineSelf.catpackboost = true originalMarineOnUpdateAnimationInput(marineSelf, modelMixin) marineSelf.catpackboost = originalMarineSelfCatpackboost end local originalLOSMixinOnUpdate = LOSMixin.OnUpdate LOSMixin.OnUpdate = function(losMixinSelf, deltaTime) if originalLOSMixinOnUpdate then if losMixinSelf.GetIsAlive and losMixinSelf:GetIsAlive() then losMixinSelf.sighted = true end originalLOSMixinOnUpdate(losMixinSelf, deltaTime) end end local originalFlamethrowerFirePrimary = Flamethrower.FirePrimary Flamethrower.FirePrimary = function(flamethrowerSelf, player, bullets, range, penetration) local originalGetRange = flamethrowerSelf.GetRange flamethrowerSelf.GetRange = function(flamethrowerSelfSelf) local result = originalGetRange(flamethrowerSelfSelf) if wasRecentlyWelded(player) then result = result * 2 end return result end originalFlamethrowerFirePrimary(flamethrowerSelf, player, bullets, range, penetration) flamethrowerSelf.GetRange = originalGetRange end local originalBuildTechData = BuildTechData BuildTechData = function() local result = originalBuildTechData() TGNS.DoFor(result, function(d) if d[kTechDataId] == kTechId.Sentry then d[kTechDataBuildRequiresMethod] = function(techId, origin, normal, commander) return true end d[kTechDataSupply] = 5 elseif d[kTechDataId] == kTechId.SentryBattery then d[kTechDataBuildRequiresMethod] = function(techId, origin, normal, commander) return true end -- d[kTechDataCostKey] = 1 end if not TGNS.Has({kTechId.MedPack, kTechId.AmmoPack, kTechId.CatPack}, d[kTechDataId]) then local originalBuildRequiresMethod = d[kTechDataBuildRequiresMethod] d[kTechDataBuildRequiresMethod] = function() local result = originalBuildRequiresMethod and originalBuildRequiresMethod() or true if result and waveInProgress then result = false end return result end end end) return result end kTechData = nil ClearCachedTechData() local originalLookupTechData = LookupTechData LookupTechData = function(techId, fieldName, default) local result if fieldName == kTechDataBuildMethodFailedMessage and waveInProgress then result = "Wave in progress." else result = originalLookupTechData(techId, fieldName, default) end return result end if Client then local originalMarineOutlineMixinOnUpdate = MarineOutlineMixin.OnUpdate MarineOutlineMixin.OnUpdate = function(marineOutlineMixinSelf, deltaTime) -- Shared.Message("marineOutlineMixinSelf:GetRenderModel(): " .. tostring(marineOutlineMixinSelf:GetRenderModel())) local originalClientGetOutlinePlayers = Client.GetOutlinePlayers local originalClientGetLocalClientTeamNumber = Client.GetLocalClientTeamNumber local originalkEquipmentOutlineColorTSFBlue = kEquipmentOutlineColor.TSFBlue --local originalMarineOutlineMixinSelfGetRenderModel = marineOutlineMixinSelf.GetRenderModel if wasRecentlyWelded(marineOutlineMixinSelf) then -- Shared.Message("wasRecentlyWelded(marineOutlineMixinSelf): " .. tostring(wasRecentlyWelded(marineOutlineMixinSelf))) Client.GetOutlinePlayers = function() return true end Client.GetLocalClientTeamNumber = function() return kSpectatorIndex end kEquipmentOutlineColor.TSFBlue = kEquipmentOutlineColor.Yellow -- marineOutlineMixinSelf.GetRenderModel = function(marineOutlineMixinSelfSelf) -- return marineOutlineMixinSelfSelf:GetActiveWeapon():GetRenderModel() -- end end originalMarineOutlineMixinOnUpdate(marineOutlineMixinSelf, deltaTime) Client.GetOutlinePlayers = originalClientGetOutlinePlayers Client.GetLocalClientTeamNumber = originalClientGetLocalClientTeamNumber kEquipmentOutlineColor.TSFBlue = originalkEquipmentOutlineColorTSFBlue --marineOutlineMixinSelf.GetRenderModel = originalMarineOutlineMixinSelfGetRenderModel -- Shared.Message("Shared.GetTime(): " .. tostring(Shared.GetTime())) end end end end) if Predict or Client then TGNS.HookNetworkMessage(NetworkMessageNames.WaveInProgress, function(message) waveInProgress = message.i end) TGNS.HookNetworkMessage(NetworkMessageNames.RecentlyWelded, function(message) recentlyWeldedTime[message.i] = message.t end) end if Server or Client then local Plugin = {} local TD = {} if Client then end if Server then Plugin.HasConfig = true Plugin.ConfigName = "td.json" end local function OnClientInitialise() function Plugin:Think(deltaTime) if recentlyWeldedTime[Client.GetLocalClientIndex()] then local recentlyWelded = wasRecentlyWelded(Client.GetLocalPlayer()) if recentlyWelded ~= recentWeldEffectEnabled then Player.screenEffects.darkVision = Player.screenEffects.darkVision or Client.CreateScreenEffect("shaders/Blur.screenfx") Player.screenEffects.darkVision:SetActive(recentlyWelded) recentWeldEffectEnabled = recentlyWelded end end end end local function OnServerInitialise() Server.SetConfigSetting("force_even_teams_on_join", false) local WaveTextChannelId = 72 local waveStartDelayInSeconds = 25 local structures = {} local allWaveStructuresDeployed = {} local currentGameStartWhen = 0 local function markPlayerAsRecentlyWelded(player) recentlyWeldedTime[player:GetClientIndex()] = Shared.GetTime() TGNS.DoFor(TGNS.GetPlayerList(), function(p) TGNS.SendNetworkMessageToPlayer(p, NetworkMessageNames.RecentlyWelded, {i=player:GetClientIndex(), t=Shared.GetTime()}) end) end function Plugin:Think() -- if math.floor(Shared.GetTime()) % 5 == 0 then -- TGNS.DoFor(TGNS.GetPlayerList(), function(p) -- if Shared.GetTime() - (recentlyWeldedTime[p:GetClientIndex()] or 0) > recentWeldTimespanInSeconds then -- markPlayerAsRecentlyWelded(p) -- end -- end) -- end end local originalWelderPerformWeld = Welder.PerformWeld Welder.PerformWeld = function(welderSelf, player) local originalCheckMeleeCapsule = CheckMeleeCapsule CheckMeleeCapsule = function(weapon, player, damage, range, optionalCoords, traceRealAttack, scale, priorityFunc, filter, mask) local didHit, target, endPoint, direction, surface = originalCheckMeleeCapsule(weapon, player, damage, range, optionalCoords, traceRealAttack, scale, priorityFunc, filter, mask) if didHit and target and target.GetClientIndex then markPlayerAsRecentlyWelded(target) end return didHit, target, endPoint, direction, surface end originalWelderPerformWeld(welderSelf, player) CheckMeleeCapsule = originalCheckMeleeCapsule end local function limitationAdvisoryText(c, waveNumber) local result = "" if TGNS.ClientIsMarine(c) then result = string.format("\n\nYou %s during waves!%s", TGNS.IsClientCommander(c) and "can only drop ammo\nand catpacks" or "cannot move", waveNumber < 5 and "\nKill the moving structures!" or "") end return result end local function getWaveData(n) local waveInfo = Shine.Plugins.td.Config.Waves[n] if not TGNS.IsProduction() then -- waveInfo = "Test|Whip,0,1,5|1" end local waveData = TGNS.Split("|", waveInfo) local waveDamageModifier = waveData[3] local waveTitle = string.format("%s (Weapons Strength: %s%s)", waveData[1], math.floor(100 * waveDamageModifier), "%%") local structureInfos = TGNS.Select(TGNS.Split(";", waveData[2]), function(d) local structureData = TGNS.Split(",", d) return {type=structureData[1],delay=structureData[2],count=structureData[3],speed=structureData[4],damageModifier=waveDamageModifier} end) return {title=waveTitle, structures=structureInfos} end function TD.PrepareNextWave(chair, hive, waveNumber) waveInProgress = false -- local lastStructureKilledWaveNumber = waveNumber if #Shine.Plugins.td.Config.Waves >= waveNumber then local nextWaveData = getWaveData(waveNumber) local startDelayInSeconds = waveNumber - 1 % 5 == 0 and waveStartDelayInSeconds * 2 or waveStartDelayInSeconds TGNS.DoTimes(startDelayInSeconds, function(i) local secondsUntilWaveStart = startDelayInSeconds - i TGNS.ScheduleAction(startDelayInSeconds - secondsUntilWaveStart, function() -- if TGNS.IsGameInProgress() and chair and hive and (lastStructureKilledWaveNumber == waveNumber) then if TGNS.IsGameInProgress() and chair and hive then -- Shared.Message("secondsUntilWaveStart: " .. tostring(secondsUntilWaveStart)) if secondsUntilWaveStart > 0 then TGNS.DoFor(TGNS.GetHumanClientList(), function(c) if secondsUntilWaveStart == startDelayInSeconds - 1 then TGNS.SendNetworkMessageToPlayer(TGNS.GetPlayer(c), NetworkMessageNames.WaveInProgress, {i=waveInProgress}) end local teamRgb = TGNS.GetTeamRgb(TGNS.GetClientTeamNumber(c)) Shine.ScreenText.Add(WaveTextChannelId, {X = 0.5, Y = 0.6, Text = string.format("Next: Wave %s - %s%s", waveNumber, nextWaveData.title, TGNS.ClientIsMarine(c) and string.format("\nStarting %s\nPrepare and take positions.%s", secondsUntilWaveStart >= 3 and string.format("in %s seconds...", secondsUntilWaveStart + 1) or "now!", limitationAdvisoryText(c, waveNumber)) or ""), Duration = 600, R = teamRgb.R, G = teamRgb.G, B = teamRgb.B, Alignment = TGNS.ShineTextAlignmentCenter, Size = 3, FadeIn = 0, IgnoreFormat = true}, c) end) else TGNS.DoFor(TGNS.GetMarinePlayers(TGNS.GetPlayerList()), function(p) TGNS.AddPlayerResources(p, 10) local weapons = p:GetWeapons() TGNS.DoFor(weapons, function(w) if w.GiveAmmo then w:GiveAmmo(AmmoPack.kNumClips, true) end end) end) TD.SendWave(chair, hive, waveNumber) end end end) end) else if chair and chair:GetIsAlive() then hive:Kill() TGNS.DestroyEntity(hive) end end end function TD.SendWave(chair, hive, waveNumber) -- Shared.Message("waveNumber: " ..tostring(waveNumber)) local types = {} types.Whip = Whip.kMapName types.Shift = Shift.kMapName types.Crag = Crag.kMapName types.Drifter = Drifter.kMapName types.Shade = Shade.kMapName waveInProgress = true local waveData = getWaveData(waveNumber) TGNS.DoFor(TGNS.GetHumanClientList(), function(c) local teamRgb = TGNS.GetTeamRgb(TGNS.GetClientTeamNumber(c)) Shine.ScreenText.Add(WaveTextChannelId, {X = 0.5, Y = 0.6, Text = string.format("Wave %s%s", string.format("%s - %s", waveNumber, waveData.title), limitationAdvisoryText(c, waveNumber)), Duration = 600, R = teamRgb.R, G = teamRgb.G, B = teamRgb.B, Alignment = TGNS.ShineTextAlignmentCenter, Size = 3, FadeIn = 0, IgnoreFormat = true}, c) TGNS.SendNetworkMessageToPlayer(TGNS.GetPlayer(c), NetworkMessageNames.WaveInProgress, {i=waveInProgress}) end) local waveCurrentGameStartWhen = currentGameStartWhen TGNS.DoFor(waveData.structures, function(s, i) -- Shared.Message(string.format("type: %s, delay: %s, count: %s, speed: %s", s.type, s.delay, s.count, s.speed)) TGNS.ScheduleAction(s.delay, function() local theseStructuresAreIntendedForCurrentGame = waveCurrentGameStartWhen == currentGameStartWhen if theseStructuresAreIntendedForCurrentGame then TGNS.DoTimes(s.count, function() if TGNS.IsGameInProgress() and chair and hive then -- check to make sure current round is the round for which these structures were spawned local structure = CreateEntity(types[s.type], hive:GetOrigin(), kAlienTeamType) table.insert(structures, structure) -- local playingHumansCount = #TGNS.GetPlayingClients(TGNS.GetPlayerList()) -- if playingHumansCount > 1 then -- structure.damageModifier = s.damageModifier -- end structure.damageModifier = s.damageModifier if structure.SetConstructionComplete then structure:SetConstructionComplete() end local modifier = s.speed local fireSpeedModifier = function(entity) return entity:GetIsOnFire() and .5 or 1 end local originalGetMaxSpeed = structure.GetMaxSpeed structure.GetMaxSpeed = function(structureSelf) local result = originalGetMaxSpeed(structureSelf) return result * modifier * fireSpeedModifier(structureSelf) end local originalDrifterkMoveSpeed = Drifter.kMoveSpeed local originalDrifterOnUpdate = Drifter.OnUpdate structure.kDrifterMoveSpeed = originalDrifterkMoveSpeed * modifier Drifter.OnUpdate = function(drifterSelf, deltaTime) Drifter.kMoveSpeed = drifterSelf.kDrifterMoveSpeed * fireSpeedModifier(drifterSelf) originalDrifterOnUpdate(drifterSelf, deltaTime) Drifter.kMoveSpeed = originalDrifterkMoveSpeed end if structure.SetMature then structure:SetMature() end structure:SetMaxHealth(structure:GetMaxHealth() * modifier) structure:SetMaxArmor(structure:GetMaxArmor() * modifier) local targetHealth = structure:GetMaxHealth() local targetArmor = structure:GetMaxArmor() if structure.matureMaxHealth then structure.matureMaxHealth = structure.matureMaxHealth * modifier structure.matureMaxArmor = structure.matureMaxArmor * modifier targetHealth = structure.matureMaxHealth targetArmor = structure.matureMaxArmor end structure:SetHealth(targetHealth) structure:SetArmor(targetArmor) structure:GiveOrder(kTechId.Move, chair:GetId(), chair:GetOrigin(), nil, true, true) local originalStructureOnKill = structure.OnKill structure.OnKill = function(structureSelf, attacker, doer, point, direction) originalStructureOnKill(structureSelf, attacker, doer, point, direction) -- TGNS.DestroyEntity(structureSelf) TGNS.RemoveAllMatching(structures, structure) if waveNumber and allWaveStructuresDeployed[waveNumber] and #structures == 0 then -- Shared.Message(string.format("------------------------------------------------------------------------------------------------------- allWaveStructuresDeployed[%s] == true", waveNumber)) TD.PrepareNextWave(chair, hive, waveNumber + 1) end GetGamerules():GetTeam(kMarineTeamType):AddTeamResources(15) if attacker and attacker:isa("Marine") then TGNS.AddPlayerResources(attacker, 5) local weapons = attacker:GetWeapons() TGNS.DoFor(weapons, function(w) if w.GiveAmmo then w:GiveAmmo(AmmoPack.kNumClips, true) end end) end end local originalStructureCompletedCurrentOrder = structure.CompletedCurrentOrder structure.CompletedCurrentOrder = function(structureSelf) originalStructureCompletedCurrentOrder(structureSelf) if chair then local lengthFromChair = (structureSelf:GetOrigin() - chair:GetOrigin()):GetLength() -- Shared.Message("lengthFromChair: " .. tostring(lengthFromChair)) if lengthFromChair > 5 then TGNS.DoFor(TGNS.GetPlayingClients(TGNS.GetPlayerList()), function(c) Shine.ScreenText.Add(70, {X = 0.5, Y = 0.4, Text = "Blocked structures damage the chair and then die!", Duration = 6, R = 255, G = 0, B = 0, Alignment = TGNS.ShineTextAlignmentCenter, Size = 3, FadeIn = 0, IgnoreFormat = true}, c) end) end chair:DeductHealth(chair:GetMaxHealth() * .05) end structure:Kill() -- TGNS.ScheduleAction(5, function() -- TGNS.DestroyEntity(structure) -- end) end end end) if i == #waveData.structures then -- Shared.Message(string.format("------------------------------------------------------------------------------------------------------- allWaveStructuresDeployed[%s] = true", waveNumber)) allWaveStructuresDeployed[waveNumber] = true end end end) end) end TGNS.DisableUweGameReporting() local md = TGNSMessageDisplayer.Create("TD") function Plugin:JoinTeam(gamerules, player, newTeamNumber, force, shineForce) local cancel = false if not (force or shineForce) then if newTeamNumber == kAlienTeamType then md:ToPlayerNotifyError(player, "TD is played on the Marine team.") cancel = true end if cancel then return false end end end function Plugin:PostJoinTeam(gamerules, player, oldTeamNumber, newTeamNumber, force, shineForce) local client = TGNS.GetClient(player) if TGNS.ClientIsMarine(client) then TGNS.ScheduleAction(0, function() if client and Shine:IsValidClient(client) and TGNS.ClientIsMarine(client) and not TGNS.IsGameInProgress() then TGNS.ForceGameStart() end end) gamerules:RespawnPlayer(player) end end function Plugin:EndGame(gamerules, winningTeam) Shine.ScreenText.End(WaveTextChannelId) end function Plugin:ClientConnect(client) TGNS.ScheduleAction(0, function() if not TGNS.IsProduction() then TGNS.SendToTeam(TGNS.GetPlayer(client), kMarineTeamType) end Shine.ScreenText.Add(82, {X = .5, Y = 0.95, Text = "\nTD BETA - TGNS FORUMS FOR CHANGELOG", Duration = 120, R = 255, G = 255, B = 255, Alignment = TGNS.ShineTextAlignmentCenter, Size = 1, FadeIn = 0, IgnoreFormat = true}, c) end) end lastNoAttackNoticeTimes = {} lastNoWeldNoticeTimes = {} function Plugin:TakeDamage( Ent, Damage, Attacker, Inflictor, Point, Direction, ArmourUsed, HealthUsed, DamageType, PreventAlert ) if Ent and Ent:GetTeamNumber() == kAlienTeamType then if Ent:isa("Hive") or not Inflictor then Damage = 0 ArmourUsed = 0 HealthUsed = 0 if Ent:isa("Hive") then local client = TGNS.GetClient(Attacker) if client and (lastNoAttackNoticeTimes[client] == nil or lastNoAttackNoticeTimes[client] < Shared.GetTime() - 1) and (Attacker:GetOrigin() - Ent:GetOrigin()):GetLength() < kHitEffectRelevancyDistance then local teamRgb = TGNS.GetTeamRgb(Attacker:GetTeamNumber()) Shine.ScreenText.Add(70, {X = 0.5, Y = 0.4, Text = "You cannot damage the Hive. Attack the moving structures!", Duration = 6, R = teamRgb.R, G = teamRgb.G, B = teamRgb.B, Alignment = TGNS.ShineTextAlignmentCenter, Size = 3, FadeIn = 0, IgnoreFormat = true}, client) lastNoAttackNoticeTimes[client] = Shared.GetTime() end end else if Ent.damageModifier then Damage = Damage * Ent.damageModifier ArmourUsed = ArmourUsed * Ent.damageModifier HealthUsed = HealthUsed * Ent.damageModifier end end end return Damage, ArmourUsed, HealthUsed -- return 0, 0, 0 end TGNS.RegisterEventHook("GameStarted", function() currentGameStartWhen = Shared.GetTime() local chair = GetEntitiesForTeam( "CommandStation", kMarineTeamType )[1] local hive = GetEntitiesForTeam( "Hive", kAlienTeamType )[1] hive:SetMature() hive:SetHealth(hive:GetMatureMaxHealth()) hive:SetArmor(hive:GetMatureMaxArmor()) chair.GetCanBeWeldedOverride = function(chairSelf, doer) local client = TGNS.GetClient(doer) if client and (lastNoWeldNoticeTimes[client] == nil or Shared.GetTime() - lastNoWeldNoticeTimes[client] > 1) then local teamRgb = TGNS.GetTeamRgb(doer:GetTeamNumber()) Shine.ScreenText.Add(71, {X = 0.5, Y = 0.4, Text = "You cannot weld the Chair. The game ends when the Chair dies. Attack the moving structures!", Duration = 6, R = teamRgb.R, G = teamRgb.G, B = teamRgb.B, Alignment = TGNS.ShineTextAlignmentCenter, Size = 3, FadeIn = 0, IgnoreFormat = true}, client) lastNoWeldNoticeTimes[client] = Shared.GetTime() end return false, false end TD.PrepareNextWave(chair, hive, 1) end) local originalNS2GamerulesCheckGameEnd = NS2Gamerules.CheckGameEnd NS2Gamerules.CheckGameEnd = function(gameRulesSelf) local chairDestroyed = gameRulesSelf:GetTeam(kTeam1Index):GetNumAliveCommandStructures() == 0 local hiveDestroyed = gameRulesSelf:GetTeam(kTeam2Index):GetNumAliveCommandStructures() == 0 if chairDestroyed or hiveDestroyed then TGNS.DoFor(structures, function(s) s:Kill() end) -- explode all the eggs local originalGameRulesSelfTeam1GetHasTeamLost = gameRulesSelf.team1.GetHasTeamLost local originalGameRulesSelfTeam2GetHasTeamLost = gameRulesSelf.team2.GetHasTeamLost gameRulesSelf.team1.GetHasTeamLost = function(team1Self) return chairDestroyed end gameRulesSelf.team2.GetHasTeamLost = function(team1Self) return hiveDestroyed end originalNS2GamerulesCheckGameEnd(gameRulesSelf) gameRulesSelf.team1.GetHasTeamLost = originalGameRulesSelfTeam1GetHasTeamLost gameRulesSelf.team2.GetHasTeamLost = originalGameRulesSelfTeam2GetHasTeamLost end end local originalNS2GamerulesGetCanSpawnImmediately = NS2Gamerules.GetCanSpawnImmediately NS2Gamerules.GetCanSpawnImmediately = function() return true end -- local parent, OldSpawnInfantryPortal = LocateUpValue( MarineTeam.SpawnInitialStructures, "SpawnInfantryPortal", { LocateRecurse = true } ) -- function SpawnInfantryPortal( marineTeamSelf, techPoint ) -- end -- ReplaceUpValue( parent, "SpawnInfantryPortal", SpawnInfantryPortal, { LocateRecurse = true } ) local parent, OldCheckForNoIPs = LocateUpValue( MarineTeam.Update, "CheckForNoIPs", { LocateRecurse = true } ) function CheckForNoIPs( marineTeamSelf, timePassed ) end ReplaceUpValue( parent, "CheckForNoIPs", CheckForNoIPs, { LocateRecurse = true } ) end function Plugin:Initialise() self.Enabled = true function init() if Shared.GetMapName() == "" then Shine.Timer.Simple(0, init) elseif Shared.GetMapName() == TdMapName then if Client then OnClientInitialise() end if Server then OnServerInitialise() end end end init() return true end function Plugin:Cleanup() --Cleanup your extra stuff like timers, data etc. self.BaseClass.Cleanup( self ) end Shine:RegisterExtension("td", Plugin ) end
local moon = require("moon") local redis = require("moon.db.redis") local tbremove = table.remove local tbinsert = table.insert local setmetatable = setmetatable local M = { VERSION = "0.1", ip = "127.0.0.1", port = 6379 } local mt = {__index = M} function M.new(ip, port, max_size) local t = {} t.pool = {} t.max_size = max_size or 10 t._size = 0 if ip and port then t.ip = ip t.port = port end return setmetatable(t, mt) end function M:spawn(trytimes) local c = tbremove(self.pool) if not c then c = redis.new() if not c:connect(self.ip, self.port) then return nil, "connect redis failed" end self._size = self._size + 1 else local ok, _ = c:docmd("PING") if not ok then print("span redis not connect,reconnecting...") while not c:connect(self.ip, self.port) do print("reconnect redis server failed") if trytimes then trytimes = trytimes - 1 if trytimes <= 0 then return nil, "connect redis failed" end end moon.co_wait(1000) end end end return c end function M:close(c) if self._size >= self.max_size then local oc = tbremove(self.pool) if oc then oc:close() self._size = self._size - 1 end end tbinsert(self.pool, c) end function M:size() return self._size end return M
surface.CreateFont( "GModWorldtip", { font = "Helvetica", size = 20, weight = 700 }) local cl_drawworldtooltips = CreateConVar( "cl_drawworldtooltips", "1", { FCVAR_ARCHIVE } ) local WorldTip = nil local TipColor = Color( 250, 250, 200, 255 ) -- -- Adds a hint to the queue -- function AddWorldTip( unused1, text, unused2, pos, ent ) WorldTip = {} WorldTip.dietime = SysTime() + 0.05 WorldTip.text = text WorldTip.pos = pos WorldTip.ent = ent end local function DrawWorldTip( tip ) if ( IsValid( tip.ent ) ) then tip.pos = tip.ent:GetPos() end local pos = tip.pos:ToScreen() local black = Color( 0, 0, 0, 255 ) local tipcol = Color( TipColor.r, TipColor.g, TipColor.b, 255 ) local x = 0 local y = 0 local padding = 10 local offset = 50 surface.SetFont( "GModWorldtip" ) local w, h = surface.GetTextSize( tip.text ) x = pos.x - w y = pos.y - h x = x - offset y = y - offset draw.RoundedBox( 8, x-padding-2, y-padding-2, w+padding*2+4, h+padding*2+4, black ) local verts = {} verts[1] = { x=x+w/1.5-2, y=y+h+2 } verts[2] = { x=x+w+2, y=y+h/2-1 } verts[3] = { x=pos.x-offset/2+2, y=pos.y-offset/2+2 } draw.NoTexture() surface.SetDrawColor( 0, 0, 0, tipcol.a ) surface.DrawPoly( verts ) draw.RoundedBox( 8, x-padding, y-padding, w+padding*2, h+padding*2, tipcol ) local verts = {} verts[1] = { x=x+w/1.5, y=y+h } verts[2] = { x=x+w, y=y+h/2 } verts[3] = { x=pos.x-offset/2, y=pos.y-offset/2 } draw.NoTexture() surface.SetDrawColor( tipcol.r, tipcol.g, tipcol.b, tipcol.a ) surface.DrawPoly( verts ) draw.DrawText( tip.text, "GModWorldtip", x + w/2, y, black, TEXT_ALIGN_CENTER ) end function GM:PaintWorldTips() if ( !cl_drawworldtooltips:GetBool() ) then return end if ( WorldTip && WorldTip.dietime > SysTime() ) then DrawWorldTip( WorldTip ) end end
-- UI local ui = require "tek.ui" -- Validators local validators = require "src.validators.base_validators" -- Controllers local get_task = require "src.controller.get_task" local stop_task = require "src.controller.stop_task" local delete_task = require "src.controller.delete_task" local edit_task_time = require "src.controller.edit_task_time" local edit_task_project = require "src.controller.edit_task_project" local autocomplete_task = require "src.controller.autocomplete_task" local autocomplete_project = require "src.controller.autocomplete_project" local get_task_in_progress = require "src.controller.get_task_in_progress" local edit_task_description = require "src.controller.edit_task_description" -- Components local InputWithAutocomplete = require "src.ui.components.input_with_autocomplete" -- Utils local date = require "date.date" local report_error = require "src.ui.utils".report_error -- Constants local row_space = 5 return { set_task_to_edit = function(self, task_id, refresh) local task, _ = report_error(get_task(task_id)) local task_in_progress, _ = get_task_in_progress() local in_progress = false if task_in_progress and task.id == task_in_progress.id then in_progress = true end local start_time = date(task.start_time) local end_time = date(task.end_time) self:getById("edit_start_date"):setValue("Text", string.format( "%04d/%02d/%02d", start_time:getyear(), start_time:getmonth(), start_time:getday() )) self:getById("edit_start_date"):onSetText() self:getById("edit_start_time"):setValue("Text", string.format( "%02d:%02d", start_time:gethours(), start_time:getminutes() )) self:getById("edit_start_time"):onSetText() self:getById("edit_end_date"):setValue("Text", string.format( "%04d/%02d/%02d", end_time:getyear(), end_time:getmonth(), end_time:getday() )) self:getById("edit_end_date"):onSetText() self:getById("edit_end_time"):setValue("Text", string.format( "%02d:%02d", end_time:gethours(), end_time:getminutes() )) self:getById("edit_end_time"):onSetText() self:getById("edit_end_date"):setValue("Disabled", in_progress) self:getById("edit_end_time"):setValue("Disabled", in_progress) self:getById("edit_description"):setValue("Text", task.description) self:getById("edit_description"):onSetText() self:getById("edit_project"):setValue("Text", task.project) self:getById("edit_project"):onSetText() self:getById("edit_in_progress"):setValue("Selected", in_progress) self:getById("delete_task_btn"):setValue("onPress", function(_self) report_error(delete_task(task_id)) _self:getById("edit_task_window"):setValue( "Status", "hide" ) refresh() end) self:getById("save_task_btn"):setValue("onPress", function(self) -- Read new values from edit fields local new_start_date = self:getById("edit_start_date"):getText() local new_start_time = self:getById("edit_start_time"):getText() local _, err = report_error( validators.is_iso8601( string.format("%sT%s:00", new_start_date, new_start_time) ) ) if err ~= nil then print(err) return end local new_start = date( string.format("%sT%s:00", new_start_date, new_start_time) ) local new_end_date = self:getById("edit_end_date"):getText() local new_end_time = self:getById("edit_end_time"):getText() _, err = report_error( validators.is_iso8601( string.format("%sT%s:00", new_end_date, new_end_time) ) ) if err ~= nil then print(err) return end local new_end = date( string.format("%sT%s:00", new_end_date, new_end_time) ) local new_description = self:getById("edit_description"):getText() local new_project = self:getById("edit_project"):getText() local new_in_progress = self:getById("edit_in_progress").Selected -- Trigger field update when a change is detected if new_start ~= start_time and (new_end ~= end_time and not new_in_progress) then report_error(edit_task_time(task.id, new_start, new_end)) elseif new_start ~= start_time then if task.end_time == nil then report_error(edit_task_time(task.id, new_start, nil)) else report_error( edit_task_time( task.id, new_start, date(task.end_time) ) ) end elseif new_end ~= end_time and not new_in_progress then report_error( edit_task_time( task.id, date(task.start_time), new_end ) ) end if new_description ~= task.description then local _, error = edit_task_description( task.id, new_description ) if error then report_error(nil, "Invalid Description: "..error) return end end if new_project ~= task.project then local _, error = edit_task_project(task.id, new_project) if error then report_error(nil, "Invalid Project: "..error) return end end if in_progress ~= new_in_progress then if new_in_progress then -- This way the possible overlaping with other tasks is checked report_error(stop_task()) report_error( edit_task_time( task.id, date(task.start_time), nil ) ) else report_error(stop_task()) end end self:getById("edit_task_window"):setValue( "Status", "hide" ) refresh() end) end, init = function() local task_autocomplete = InputWithAutocomplete:new{ Callback = autocomplete_task, Id = "edit_description", Width = "fill" } local project_autocomplete = InputWithAutocomplete:new{ Callback = autocomplete_project, Id = "edit_project", Width = "fill" } local window = ui.Window:new { Title = "Edit Task", Id = "edit_task_window", Style = "margin: 15;", Status = "hide", Orientation = "vertical", Width = 400, Height = 300, Children = { ui.Group:new{ Width = "free", Height = "auto", Style = "margin-bottom: "..row_space..";", Children = { ui.Text:new{ Style = "text-align: left;", Width = 100, Text = "Time:", Class = "caption" }, ui.Input:new{ Id = "edit_start_date", Width = 76, Text = "27/11/2019" }, ui.Area:new{ Width = 2, Height = "auto" }, ui.Input:new{ Id = "edit_start_time", Width = 40, Text = "21:14" }, ui.Text:new{ Width = 20, Text = "To", Class = "caption" }, ui.Input:new{ Id = "edit_end_time", Width = 40, Text = "23:14", Disabled = false }, ui.Area:new{ Width = 2, Height = "auto" }, ui.Input:new{ Id = "edit_end_date", Width = 76, Text = "27/11/2019", Disabled = false }, ui.Area:new{ Width = 5, Height = "auto" }, ui.CheckMark:new{ Id = "edit_in_progress", Text = "In Progress", Selected = false, onSelect = function(self) self:getById("edit_end_date"):setValue("Disabled", self.Selected) self:getById("edit_end_time"):setValue("Disabled", self.Selected) end } } }, ui.Group:new{ Width = "free", Height = "auto", Style = "margin-bottom: "..row_space..";", Children = { ui.Text:new{ Style = "text-align: left;", Width = 100, Text = "Description:", Class = "caption" }, task_autocomplete } }, ui.Group:new{ Width = "free", Height = "auto", Style = "margin-bottom: "..(row_space * 2)..";", Children = { ui.Text:new{ Style = "text-align: left;", Width = 100, Text = "Project:", Class = "caption" }, project_autocomplete } }, ui.Group:new{ Width = "free", Height = "auto", Children = { ui.Button:new{ Id = "delete_task_btn", Width = 80, Text = "Delete" }, ui.Area:new{ Width = "free", Height = "auto" }, ui.Button:new{ Width = 80, Text = "Cancel", onPress = function(self) self:getById("edit_task_window"):setValue( "Status", "hide" ) end }, ui.Button:new{ Id = "save_task_btn", Width = 80, Text = "Save" } } } } } window:addInputHandler(ui.MSG_FOCUS, window, function(self, msg) -- Hide autocomplete popups when the window is not in focus local is_focused = msg[3] == 1 if not is_focused then task_autocomplete:endPopup() project_autocomplete:endPopup() end end) return window end }
--------------------------------------------------------------------------------------------------- -- real_names_redo mod by A S Lewis, based on real_names by Extex101 --------------------------------------------------------------------------------------------------- -- load_names.lua -- Loads lists of names --------------------------------------------------------------------------------------------------- local S = minetest.get_translator(minetest.get_current_modname()) --------------------------------------------------------------------------------------------------- -- Notes --------------------------------------------------------------------------------------------------- -- Let's divide the world into "languages", each with their own characteristic names -- -- The file .../names/config.txt provides a list of "languages". Each "language" is defined on a -- separate line. To add a new language, just add a new line -- -- Each line is in the form -- language_type language_name -- For example -- western French -- -- "language_type" specifies how the language handles names. There are three possible values: -- "western", "slavic" and "asian" -- For "western", we expect west European names, e.g. "Adam Smith" and "Alice Smith" -- For "slavic", we expect Slavic names, e.g. "Tomas Novák" and "Jana Nováková" -- For "asian", we expect the surname first, e.g. "Nguyễn Chi" and "Nguyễn Chau" -- "language_name" can be any text (including multiple words) -- -- For each "language", we add a sub-folder with the same "language_name" -- Each folder contains one or more of the following files: -- firstboy.txt -- firstgirl.txt -- last.txt -- lastgirl.txt -- All files are optional. The lastgirl.txt file is only used when "language_type" is "slavic" -- Each file consists of a list of names, one name per line. Empty lines are ignored --------------------------------------------------------------------------------------------------- -- Functions --------------------------------------------------------------------------------------------------- local function read_config_file(path) local file = io.open(path, "r") if not file then minetest.log("[" .. rn.name .. "] failed to read config file") return nil end for line in io.lines(path) do local lang_type = string.match(line, "(%w+)%s") local lang_name = string.match(line, "%w+%s+(.*)") rn.config_dict[lang_name] = lang_type rn.name_dict[lang_name] = {} -- (The first "language" loaded is the default one) if rn.lang_name == nil then rn.lang_name = lang_name rn.lang_type = lang_type end end file:close() end local function read_names(path) local name_list = {} local file = io.open(path, "r") if file then for line in io.lines(path) do -- Empty lines are ignored if string.match(line, "%w") then table.insert(name_list, line) end end file:close() end return name_list end --------------------------------------------------------------------------------------------------- -- Load and process files --------------------------------------------------------------------------------------------------- -- Load the config file read_config_file(rn.path .. "/names/config.txt"); -- For each 'language' specified by the config file, load lists of names for lang_name, lang_type in pairs (rn.config_dict) do rn.name_dict[lang_name]["first_boy"] = read_names(rn.path .. "/names/" .. lang_name .. "/firstboy.txt") rn.name_dict[lang_name]["first_girl"] = read_names(rn.path .. "/names/" .. lang_name .. "/firstgirl.txt") rn.name_dict[lang_name]["last"] = read_names(rn.path .. "/names/" .. lang_name .. "/last.txt") rn.name_dict[lang_name]["last_girl"] = read_names(rn.path .. "/names/" .. lang_name .. "/lastgirl.txt") end
local M = {} function M.setup(client) local ts = require "nvim-lsp-ts-utils" ts.setup { enable_import_on_completion = true, eslint_bin = "eslint_d", eslint_enable_diagnostics = true, eslint_enable_disable_comments = true, } ts.setup_client(client) end return M
object_draft_schematic_munition_beast_steroid_horse_lizard_mk2 = object_draft_schematic_munition_shared_beast_steroid_horse_lizard_mk2:new { } ObjectTemplates:addTemplate(object_draft_schematic_munition_beast_steroid_horse_lizard_mk2, "object/draft_schematic/munition/beast_steroid_horse_lizard_mk2.iff")
if (mode() == "load") then local mpath = os.getenv("MODULEPATH") mpath = mpath:gsub("/a1/","/a2/") io.stderr:write("MPATH: ",mpath,"\n") pushenv("MODULEPATH",mpath) end
local Debugger = {} Debugger.Clients = {} Debugger.NameMap = {} Debugger.EntVarCounts = {} util.AddNetworkString("metrostroi-debugger-dataupdate") util.AddNetworkString("metrostroi-debugger-entremoved") util.AddNetworkString("metrostroi-debugger-entnamemap") if game.SinglePlayer() then RunConsoleCommand("metrostroi_debugger_update_interval",0) end --[[else --Lets not reset it every time on dedicated servers RunConsoleCommand("metrostroi_debugger_update_interval",0.5) end--]] local function SendNameMap(ply,ent) net.Start("metrostroi-debugger-entnamemap") net.WriteInt(ent:EntIndex(),16) net.WriteTable(ent:GetDebugVars()) if ply then net.Send(ply) else net.Broadcast() end end --Add a new client to send an entities debugvars to local function AddClient(ply,ent) if not Debugger.Clients[ply] then Debugger.Clients[ply]={} end if table.HasValue(Debugger.Clients[ply],ent) then return end table.insert(Debugger.Clients[ply],ent) end local function RemoveEnt(ply,ent) if ply and Debugger.Clients[ply] then if ent then table.RemoveByValue(Debugger.Clients[ply],ent) else Debugger.Clients[ply]=nil end else for k,v in pairs(Debugger.Clients) do table.RemoveByValue(v,ent) end end end --Handler for adding new ents to listen to local function cmdinithandler(ply,cmd,args,fullstring) local ent = ply:GetEyeTrace().Entity if not IsValid(ent) or not ent.GetDebugVars then return end AddClient(ply,ent) end concommand.Add("metrostroi_debugtrainsystems", cmdinithandler, nil, "Add aimed at entity to debugger") -- Automatically engage debugger for train owner function Metrostroi.DebugTrain(train,ply) if not ply then ply = train:GetOwner() end if (not IsValid(train)) or (not IsValid(ply)) then return end AddClient(ply,train) end local nextthink = 0 local function think() if CurTime() < nextthink then return end nextthink = CurTime() + GetConVarNumber("metrostroi_debugger_update_interval") --Loop over clients and their ents and send the collected data --Check for new entity variables for ply,entlist in pairs(Debugger.Clients) do for k,ent in pairs(entlist) do local count = table.Count(ent:GetDebugVars()) if Debugger.EntVarCounts[ent] ~= count then SendNameMap(nil,ent) Debugger.EntVarCounts[ent] = count end end end --Send the bulk, nameless data for ply,entlist in pairs(Debugger.Clients) do net.Start("metrostroi-debugger-dataupdate") local count = table.Count(entlist) net.WriteInt(count,8) for k,ent in pairs(entlist) do local entvars = ent:GetDebugVars() local newtable = {} for k,v in SortedPairs(entvars) do table.insert(newtable,v) end net.WriteTable({ent:EntIndex(),newtable}) end net.Send(ply) end end hook.Add("Think","metrostroi-debugger-think",think) local function OnEntRemove(ent) RemoveEnt(nil,ent) --Client doesn't get all removed ents, broadcast it manually to all net.Start("metrostroi-debugger-entremoved") net.WriteInt(ent:EntIndex(),16) net.Broadcast() end hook.Add("EntityRemoved","metrostroi-debugger-cleanup",OnEntRemove) hook.Add("PlayerDisconnected","metrstroi-debugger-plycleanup",RemoveEnt)
--[[Author: Pizzalol Date: 04.03.2015. Awards the bonus gold to the modifier owner only if the modifier owner is alive]] function DevourGold( keys ) local target = MyHero local ability = keys.ability local ability_level = ability:GetLevel() - 1 local bonus_gold = ability:GetLevelSpecialValueFor("bonus_gold", ability_level) -- Give the gold only if the target is alive if target:IsAlive() then target:ModifyGold(bonus_gold, false, 0) Increment(bonus_gold) UpdateGoldTower(PlayerResource:GetPlayer(MyPlayerID), arne_goldtowers_gold) end end -- Function for updating gold gained from gold towers panorama UI function UpdateGoldTower(playerID, amount) if MyHero:GetHealth() >= 1 then CustomGameEventManager:Send_ServerToPlayer( PlayerResource:GetPlayer(MyPlayerID), "etd_update_goldgained", { lumber = arne_goldtowers_gold } ) end end function Increment(bonus_gold) arne_goldtowers_gold = arne_goldtowers_gold + bonus_gold end
local Fueled = Class(function(self, inst) self.inst = inst self.consuming = false self.maxfuel = 0 self.currentfuel = 0 self.rate = 1 self.accepting = false self.fueltype = "BURNABLE" self.secondaryfueltype = nil self.sections = 1 self.sectionfn = nil self.period = 1 self.bonusmult = 1 self.depleted = nil end) function Fueled:MakeEmpty() if self.currentfuel > 0 then self:DoDelta(-self.currentfuel) end end function Fueled:OnSave() if self.currentfuel ~= self.maxfuel then return {fuel = self.currentfuel} end end function Fueled:OnLoad(data) if data.fuel then self:InitializeFuelLevel(data.fuel) end end function Fueled:SetSectionCallback(fn) self.sectionfn = fn end function Fueled:SetDepletedFn(fn) self.depleted = fn end function Fueled:IsEmpty() return self.currentfuel <= 0 end function Fueled:SetSections(num) self.sections = num end function Fueled:CanAcceptFuelItem(item) return self.accepting and item and item.components.fuel and (item.components.fuel.fueltype == self.fueltype or item.components.fuel.fueltype == self.secondaryfueltype) end function Fueled:GetCurrentSection() if self:IsEmpty() then return 0 else return math.min( math.floor(self:GetPercent()* self.sections)+1, self.sections) end end function Fueled:ChangeSection(amount) local fuelPerSection = self.maxfuel / self.sections self:DoDelta((amount * fuelPerSection)-1) end function Fueled:TakeFuelItem(item) if self:CanAcceptFuelItem(item) then local oldsection = self:GetCurrentSection() -- self.currentfuel = self.currentfuel + (item.components.fuel.fuelvalue * self.bonusmult) -- if self.currentfuel > self.maxfuel then -- self.currentfuel = self.maxfuel -- end local moisturemgr = GetWorld().components.moisturemanager local fuelamt = item.components.fuel.fuelvalue * self.bonusmult if moisturemgr and not moisturemgr:IsEntityDry(item) then fuelamt = fuelamt * TUNING.WET_FUEL_PENALTY end self:DoDelta(fuelamt) if item.components.fuel then item.components.fuel:Taken(self.inst) end item:Remove() if self.sections > 1 and self.sectionfn then local newsection = self:GetCurrentSection() if oldsection ~= newsection then self.sectionfn(newsection,oldsection, self.inst) end end if self.ontakefuelfn then self.ontakefuelfn(self.inst) end return true end end function Fueled:SetUpdateFn(fn) self.updatefn = fn end function Fueled:GetDebugString() local section = self:GetCurrentSection() return string.format("%s %2.2f/%2.2f (-%2.2f) : section %d/%d %2.2f", self.consuming and "ON" or "OFF", self.currentfuel, self.maxfuel, self.rate, section, self.sections, self:GetSectionPercent()) end function Fueled:AddThreshold(percent, fn) table.insert(self.thresholds, {percent=percent, fn=fn}) --table.sort(self.thresholds, function(l,r) return l.percent < r.percent) end function Fueled:GetSectionPercent() local section = self:GetCurrentSection() return (self:GetPercent() - (section - 1)/self.sections) / (1/self.sections) end function Fueled:GetPercent() if self.maxfuel > 0 then return math.min(1, self.currentfuel / self.maxfuel) else return 0 end end function Fueled:SetPercent(amount) local target = (self.maxfuel * amount) self:DoDelta(target - self.currentfuel) end function Fueled:StartConsuming() self.consuming = true if self.task == nil then self.task = self.inst:DoPeriodicTask(self.period, function() self:DoUpdate(self.period) end) end end function Fueled:InitializeFuelLevel(fuel) local oldsection = self:GetCurrentSection() if self.maxfuel < fuel then self.maxfuel = fuel end self.currentfuel = fuel local newsection = self:GetCurrentSection() if oldsection ~= newsection and self.sectionfn then self.sectionfn(newsection, oldsection, self.inst) end end function Fueled:DoDelta(amount) local oldsection = self:GetCurrentSection() self.currentfuel = math.max(0, math.min(self.maxfuel, self.currentfuel + amount) ) local newsection = self:GetCurrentSection() if oldsection ~= newsection then if self.sectionfn then self.sectionfn(newsection,oldsection, self.inst) end if self.currentfuel <= 0 and self.depleted then self.depleted(self.inst) end end self.inst:PushEvent("percentusedchange", {percent = self:GetPercent()}) end function Fueled:DoUpdate( dt ) if self.consuming then self:DoDelta(-dt*self.rate) end if self:IsEmpty() then self:StopConsuming() end if self.updatefn then self.updatefn(self.inst) end end function Fueled:StopConsuming() self.consuming = false if self.task then self.task:Cancel() self.task = nil end end function Fueled:LongUpdate(dt) self:DoUpdate(dt) end return Fueled
local parent = ... local members = { "split" } local M = { } for _index_0 = 1, #members do local name = members[_index_0] M[name] = require(parent .. "._" .. name)[name] end return M
------------------ --Suck Suck Suck-- ------------------ --[[ JarLore V 5.2 LocalScript based admin Made by jarredbcv Originally made to rek oxcool1's sb but, I just get banned anywho.. :( ~ChangeLogs~ ;Added anti remove ;Added mode 1,2,3,4,5,6 ;Added Gui for admin control ;Added notifications ]]-- version = 5.2 wait(.1) script.Parent=nil local lp = game.Players.LocalPlayer local pt = {} local pt2 = {} local pt3 = {} local rad = math.rad local pi = math.pi local cf = CFrame.new local ca = CFrame.Angles local mr = math.random local count = 0 local bcount = 0 local mode = "origin" local bc = BrickColor.new local slct = 0 local speed = 1 local guit = {} local send = cf() local as = 4 local events = {} local fragdeb = false local ignore = {} local armloop = false local grab = nil local gdist = -5 local tim = 0 local c2timer = 0 local banned = {} local cmds = {} local clogs = {} local bet = "!" --[["The best ever!"]]-- local lerp = function(a,b,c) return a+(b-a)*c end local clerp = function(c1,c2,t) return c1:lerp(c2,t) end local ClrLerp = function(Mesh,Clr2,Step) Clr1 = Mesh.VertexColor Mesh.VertexColor = Vector3.new(lerp(Clr1.X,Clr2.X,Step),lerp(Clr1.Y,Clr2.Y,Step),lerp(Clr1.Z,Clr2.Z,Step)) end local GetDiscoColor = function(hue) local section = hue % 1 * 3 local secondary = 0.5 * math.pi * (section % 1) if section < 1 then return Vector3.new(1, 1 - math.cos(secondary), 1 - math.sin(secondary)) elseif section < 2 then return Vector3.new(1 - math.sin(secondary), 1, 1 - math.cos(secondary)) else return Vector3.new(1 - math.cos(secondary), 1 - math.sin(secondary), 1) end end local new = function(Object, Parent, Data) local Object = Instance.new(Object) for Index, Value in pairs(Data or {}) do Object[Index] = Value end Object.Parent = Parent return Object end local intable = function(tab, obj) for _, v in ipairs(tab) do if v == obj then return _ end end return 0 end local so = function(id,par,lo,pi,tm) Spawn(function() local s = new("Sound",par,{Looped=lo;Pitch=pi;SoundId = "http://roblox.com/asset/?id="..id}) wait() -- tnx anti s:play() s.Volume=.8 game.Debris:AddItem(s,tm) end) return s end local Lightning = function(Start,End,Times,Offset,Color,Thickness) local magz = (Start - End).magnitude local curpos = Start local trz = {-Offset,Offset} for i=1,Times do local li = new("Part",workspace,{Size=Vector3.new(Thickness,Thickness,magz/Times);BrickColor=bc('White');CanCollide=false;Anchored=true}) local m = new("SpecialMesh",li,{MeshId='rbxassetid://9856898';Scale=Vector3.new(Thickness*2,Thickness*2,magz/Times*2);TextureId='http://www.roblox.com/asset/?id=55687933';VertexColor = Color}) local ofz = Vector3.new(trz[math.random(1,2)],trz[math.random(1,2)],trz[math.random(1,2)]) local trolpos = cf(curpos,End)*cf(0,0,magz/Times).p+ofz if Times == i then local magz2 = (curpos - End).magnitude li.Size = Vector3.new(Thickness,Thickness,magz2) li.CFrame = cf(curpos,End)*cf(0,0,-magz2/2) else li.CFrame = cf(curpos,trolpos)*cf(0,0,magz/Times/2) end curpos = li.CFrame*cf(0,0,magz/Times/2).p game.Debris:AddItem(li,.3) Spawn(function() for i=1,10 do game:service"RunService".RenderStepped:wait() li.Transparency = li.Transparency+.1 end li:Destroy() end) end end local explosion = function(col1,col2,cfr,sz,rng) local a = new("Part",workspace,{Size=Vector3.new(1,1,1);CanCollide=false;Anchored=true}) local a2 = new("Part",workspace,{Size=Vector3.new(1,1,1);CanCollide=false;Anchored=true}) local a3 = new("Part",workspace,{Size=Vector3.new(1,1,1);CanCollide=false;Anchored=true}) v1,v2,v3=sz.x,sz.y,sz.z local m = new("SpecialMesh",a,{MeshId='rbxassetid://1185246';Scale=Vector3.new(v1,v2,v3);TextureId='http://www.roblox.com/asset/?id=55687933';VertexColor = col1}) local m2 = new("SpecialMesh",a2,{MeshId='rbxassetid://9856898';Scale=Vector3.new(v1/3*2,v2/3*2,v3/3*2);TextureId='http://www.roblox.com/asset/?id=55687933';VertexColor = col2}) local m3 = new("SpecialMesh",a3,{MeshId='rbxassetid://9856898';Scale=Vector3.new(v1/3*2,v2/3*2,v3/3*2);TextureId='http://www.roblox.com/asset/?id=55687933';VertexColor = col2}) a.CFrame=cfr a2.CFrame=cfr*CFrame.Angles(math.random(),math.random(),math.random()) a3.CFrame=cfr*CFrame.Angles(math.random(),math.random(),math.random()) for i,v in pairs(workspace:children()) do if v:IsA("Model") and v:findFirstChild("Humanoid") then if v:findFirstChild("Head") and v:findFirstChild("Torso") then if (v:findFirstChild("Torso").Position - a.Position).magnitude < rng and v.Name ~= lp.Character.Name then v:BreakJoints() end end end end game.Debris:AddItem(a,.6) game.Debris:AddItem(a2,.6) game.Debris:AddItem(a3,.6) Spawn(function() while true do game:service"RunService".RenderStepped:wait() if a.Transparency >= 1 then a:Destroy() a2:Destroy() a3:Destroy() break end m.Scale=m.Scale+Vector3.new(.1,0.1,0.1) m2.Scale=m2.Scale+Vector3.new(.1,0.1,0.1) m3.Scale=m3.Scale+Vector3.new(.1,0.1,0.1) a2.CFrame=a2.CFrame*CFrame.Angles(math.rad(2),math.rad(2),math.rad(2)) a3.CFrame=a3.CFrame*CFrame.Angles(-math.rad(2),-math.rad(2),-math.rad(2)) a.Transparency=a.Transparency+0.05 a2.Transparency=a2.Transparency+0.05 a3.Transparency=a3.Transparency+0.05 end end) end local frag = function(hit) local t = {} local A = {-1, 1} if hit.Name ~= "Base" and hit.Name ~= "adpart" and hit.Parent ~= lp.Character and hit.Parent.Parent ~= lp.Character and fragdeb ~= true then so("201858024",ch.Torso,false,math.random(7,11)/10,4) fragdeb = true hit:BreakJoints() local X, Y, Z = 0, 0, 0 for x = 1, 2 do if hit.Size.X > 1 then X = hit.Size.X/2 end for y = 1, 2 do if hit.Size.Y > 1 then Y = hit.Size.Y/2 end for z = 1, 2 do if hit.Size.Z > 1 then Z = hit.Size.Z/2 end local obj = Vector3.new(X*A[x],Y*A[y],Z*A[z]) if intable(t, obj) == 0 and (X ~= 0 or Y ~= 0) and (X ~= 0 or Z ~= 0) and (Y ~= 0 or Z ~= 0) then table.insert(t, obj) end end end end if #t > 0 then local h = hit:clone() local par = hit.Parent hit:Destroy() hit = h:clone() for _, v in ipairs(t) do local n = hit:clone() --n.FormFactor = "Custom" n.Size = hit.Size/2 local x,y,z = hit.CFrame:toEulerAnglesXYZ() n.CFrame = CFrame.new(v/2)*CFrame.Angles(x,y,z) +hit.Position n.Rotation = hit.Rotation n.Velocity = Vector3.new(0,0,0) n.RotVelocity = Vector3.new(0,0,0) n.Parent = par if n.Size.X <= 1 or n.Size.Z <= 1 then n.Anchored = false;n:BreakJoints();n.Velocity=Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10)) spawn(function() for i=1,10 do wait() n.Transparency=n.Transparency+.1 end n:Destroy() end) end n:BreakJoints() end end end wait() fragdeb = false end local notif = function(txt) for i,v in pairs(guit) do v.Position = v.Position - UDim2.new(0,0,0.03,0) end local notif = new("TextLabel",notificationbin,{TextWrapped = true;TextStrokeTransparency = 0;BorderSizePixel = 2;TextScaled = true;BackgroundColor3 = Color3.new(0, 0, 0);BackgroundTransparency = 0.5;Size = UDim2.new(0.2, 0, 0.02, 0);TextColor3 = Color3.new(1, 1, 1);BorderColor3 = Color3.new(1, 1, 1);Text = "{Notification}:"..txt;Position = UDim2.new(0.395, 0, 0.942, 0);TextXAlignment = Enum.TextXAlignment.Left}) so("205318910",lp.PlayerGui,false,1) table.insert(guit,notif) spawn(function() wait(5) for i=1,20 do wait() notif.BackgroundTransparency = notif.BackgroundTransparency +.05 notif.TextTransparency = notif.TextTransparency +.05 notif.TextStrokeTransparency = notif.TextStrokeTransparency +.05 end notif:Destroy() table.remove(guit,1) end) end local makeg = function() local jlgui = new("ScreenGui",lp.PlayerGui,{Name="JL_gui"}) local frame = new("Frame",jlgui,{Size = UDim2.new(0.2, 0, 0.025, 0);BorderColor3 = Color3.new(1, 1, 1);Position = UDim2.new(0.395, 0, 0.97, 0);BorderSizePixel = 2;BackgroundTransparency = 0.5;BackgroundColor3 = Color3.new(0, 0, 0)}) local textlabel = new("TextLabel",frame,{TextStrokeTransparency = 0;BorderSizePixel = 0;BackgroundColor3 = Color3.new(0, 0, 0);BackgroundTransparency = 0.9;Size = UDim2.new(0.2, 0, 1, 0);TextColor3 = Color3.new(1, 1, 1);Text = "Execute >";TextXAlignment = Enum.TextXAlignment.Right}) textbox = new("TextBox",frame,{TextStrokeTransparency = 0;BackgroundColor3 = Color3.new(0, 0, 0);Position = UDim2.new(0.201, 0, 0, 0);Size = UDim2.new(0.785, 0, 1, 0);BackgroundTransparency = 0.9;Text = "Press [R-CTRL] to focus";TextColor3 = Color3.new(1, 1, 1);TextXAlignment = Enum.TextXAlignment.Left}) local frame_2 = new("Frame",frame,{Size = UDim2.new(0.2, 0, 1, 0);BorderColor3 = Color3.new(1, 1, 1);Position = UDim2.new(1.02, 0, 0, 0);BorderSizePixel = 2;BackgroundTransparency = 0.5;BackgroundColor3 = Color3.new(0, 0, 0)}) textlabel_2 = new("TextLabel",frame_2,{TextStrokeTransparency = 0;BorderSizePixel = 0;BackgroundColor3 = Color3.new(0, 0, 0);BackgroundTransparency = 0.9;Size = UDim2.new(1, 0, 1, 0);TextColor3 = Color3.new(1, 1, 1);BorderColor3 = Color3.new(0, 0, 0);Text = "FPS:n/a"}) local frame_3 = new("Frame",frame,{Size = UDim2.new(0.2, 0, 1, 0);BorderColor3 = Color3.new(1, 1, 1);Position = UDim2.new(-.222, 0, 0, 0);BorderSizePixel = 2;BackgroundTransparency = 0.5;BackgroundColor3 = Color3.new(0, 0, 0)}) local textlabel_3 = new("TextLabel",frame_3,{TextStrokeTransparency = 0;BorderSizePixel = 0;BackgroundColor3 = Color3.new(0, 0, 0);BackgroundTransparency = 0.9;Size = UDim2.new(1, 0, 1, 0);TextColor3 = Color3.new(1, 1, 1);BorderColor3 = Color3.new(0, 0, 0);Text = "JarLore V"..version}) notificationbin = Instance.new("Folder", jlgui,{Name="Notification_bin"}) listbin = Instance.new("Folder", jlgui,{Name="List_bin"}) textbox.FocusLost:connect(function() local msg = textbox.Text local usedACommand=false for i,v in pairs(cmds) do if msg:lower():match(bet..v.Usage:lower()..'% ?') and usedACommand==false then usedACommand=true local Run, Error = ypcall(function() spawn(function() v.Function(lp.Name,msg:lower():match(bet..v.Usage:lower()..'%>?(.+)')or'') end) end) if Error then notif(Error) end end end textbox.Text = "Press [R-CTRL] to focus" end) end local makelist = function(na,list) local pos = -7 local frame = new("Frame", listbin,{Size = UDim2.new(0.15, 0, 0.25, 0);BorderColor3 = Color3.new(1, 1, 1);Position = UDim2.new(0.65, 0, 0.745, 0);BorderSizePixel = 2;BackgroundTransparency = 0.5;BackgroundColor3 = Color3.new(0, 0, 0)}) local textlabel = new("TextBox", frame,{TextStrokeTransparency = 0;BorderSizePixel = 2;BackgroundColor3 = Color3.new(0, 0, 0);Position = UDim2.new(0.01, 0, 0.005, 0);Size = UDim2.new(0.8, 0, 0.1, 0);BackgroundTransparency = 0.9;BorderColor3 = Color3.new(1, 1, 1);TextColor3 = Color3.new(1, 1, 1);Text=na}) local scrollingframe = new("ScrollingFrame", frame,{Size = UDim2.new(1, 0, 0.87, 0);CanvasSize=UDim2.new(0,0,0,0);MidImage = "rbxassetid://65372937";BorderColor3 = Color3.new(1, 1, 1);ScrollBarThickness = 7;TopImage = "rbxassetid://65372937";Position = UDim2.new(0, 0, 0.125, 0);BottomImage = "rbxassetid://65372937";BackgroundTransparency = 0.9;BackgroundColor3 = Color3.new(0, 0, 0)}) local textbutton = new("TextButton", frame,{TextStrokeTransparency = 0;BorderSizePixel = 2;BackgroundColor3 = Color3.new(0, 0, 0);BackgroundTransparency = 0.9;Size = UDim2.new(0.16, 0, 0.1, 0);Position = UDim2.new(0.83, 0, 0.005, 0);BorderColor3 = Color3.new(1, 1, 1);Text = "X";TextColor3 = Color3.new(1, 1, 1)}) for i,v in pairs(list) do local textlabel2 = new("TextLabel", scrollingframe,{TextStrokeTransparency = 0;BorderSizePixel = 0;BackgroundColor3 = Color3.new(0, 0, 0);BackgroundTransparency = 0.9;Size = UDim2.new(1, 0, 0, 20);TextColor3 = Color3.new(1, 1, 1);TextXAlignment = Enum.TextXAlignment.Left;Text=v}) textlabel2.Position = UDim2.new(0,0,0,pos+7) pos = pos + 25 scrollingframe.CanvasSize = UDim2.new(0,0,0,pos+15) end textbutton.MouseButton1Click:connect(function() frame:Destroy() end) end local efx = function(part) if not part then return end local Num = 0 local efxs = {} for i = 1,6 do local p = new("Part",workspace,{Size=Vector3.new(1,1,1);CanCollide=false;Anchored=true;CFrame=part.CFrame}) local msh = new("SpecialMesh",p,{Scale=Vector3.new(1.55,.5,.5);MeshId='rbxassetid://9756362';TextureId='rbxassetid://25701026';VertexColor=GetDiscoColor(i/10)}) table.insert(efxs,p) local p=new("Part",workspace,{Size=Vector3.new(1,1,1);CanCollide=false;Anchored=true;CFrame=part.CFrame}) msh=new("SpecialMesh",p,{Scale=Vector3.new(1.2,.5,.5);MeshId='rbxassetid://9756362';TextureId='rbxassetid://25701026';VertexColor=GetDiscoColor(i/10+1.2)}) table.insert(efxs,p) end for i=1,50 do wait() Num=Num+.1 for i,v in pairs(efxs)do if(i<7)then v.CFrame = clerp(v.CFrame,cf(part.CFrame.p)*cf(0,-math.sin(Num)*3,0)*ca(0,1.55+Num+math.rad(360/6)*i,0)*cf(3,0,0),.1) else v.CFrame = clerp(v.CFrame,cf(part.CFrame.p)*cf(0,math.sin(Num)*3,0)*ca(0,-Num+math.rad(360/6)*i,0)*cf(3,0,0),.1) end end end for i=1,10 do wait() for i,v in pairs(efxs)do ClrLerp(v.Mesh,Vector3.new(0,0,0),.3) v.Mesh.Scale=v.Mesh.Scale+Vector3.new(-.15,0,0) end end for i,v in pairs(efxs)do v:Destroy() end efxs={} end local GetPlrs = function(Msg) local R = {} if Msg:lower() == "all" then for i,v in pairs(game:GetService("Players"):GetPlayers()) do table.insert(R, v) end else for i,v in pairs(game:GetService("Players"):GetPlayers()) do if v.Name:lower():sub(1 ,#Msg)==Msg:lower() then table.insert(R, v) end end end return R end local AddCmd = function(Name, Usage, Description, Function) cmds[Name] = {Name = Name, Usage = Usage, Description = Description, Function = Function} end local fixcol = function() for i=1,#pt do pt[i].BrickColor = bc("White") end end local np = function(sz,col) local new = new("Part",workspace,{Size=Vector3.new(0,sz,0);BrickColor=BrickColor.new(col);CanCollide=false;Anchored=true;Locked=true;Name="adpart"}) return new end local pointa = function(var) if var == true then if armloop == false then armloop=true end else armloop=false ch['Right Arm'].Anchored = false armw.Parent = ch.Torso end end local fixspeed = function(spd) repeat wait() speed = speed + .025 until speed >= spd end local make = function() for i=1,6 do local a = np(1.2,"White") table.insert(pt,a) local a1 = np(1.4,"Black") table.insert(pt2,a1) local a2 = np(1.4,"Black") table.insert(pt2,a2) table.insert(pt3,a) table.insert(pt3,a1) table.insert(pt3,a2) end end --cmds-- AddCmd('Kill','kill','Kills <player>',function(Spkr,Msg) for _,player in next,GetPlrs(Msg)do spawn(function() notif(player.Name.." was killed.") efx(player.Character.Torso) player.Character:BreakJoints() end) end end) AddCmd('Kick','kick','Kicks <player>',function(Spkr,Msg) for _,player in next,GetPlrs(Msg)do spawn(function() notif(player.Name.." was kicked.") efx(player.Character.Torso) player:Destroy() end) end end) AddCmd('God','god','Gods <player>',function(Spkr,Msg) for _,player in next,GetPlrs(Msg)do spawn(function() notif(player.Name.." was godded.") efx(player.Character.Torso) player.Character.Humanoid.MaxHealth=1e1000 end) end end) AddCmd('UnGod','ungod','UnGods <player>',function(Spkr,Msg) for _,player in next,GetPlrs(Msg)do spawn(function() notif(player.Name.." was ungodded.") efx(player.Character.Torso) player.Character.Humanoid.MaxHealth=100 end) end end) AddCmd('ForceField','ff','ForceFields <player>',function(Spkr,Msg) for _,player in next,GetPlrs(Msg)do spawn(function() notif(player.Name.." was given a forcefield.") efx(player.Character.Torso) Instance.new("ForceField",player.Character).Name="j_ff" end) end end) AddCmd('ForceField','unff','UnForceFields <player>',function(Spkr,Msg) for _,player in next,GetPlrs(Msg)do spawn(function() notif(player.Name.."'s forcefield was removed.") efx(player.Character.Torso) player.Character:findFirstChild("j_ff"):Destroy() end) end end) AddCmd('Song','sng','Plays <song>',function(Spkr,Msg) notif(Msg.." was played.") spawn(function() if not game:service"Workspace":FindFirstChild("jbcv_sound") then local jbcv_sond=Instance.new("Sound",game:service"Workspace") jbcv_sond.Name="jbcv_sound" jbcv_sond.Looped=true jbcv_sond.Volume=1 end local sond=game:service"Workspace":FindFirstChild("jbcv_sound") sond.Volume=0 sond.Pitch=0 sond:Stop() wait() sond.SoundId="rbxassetid://"..Msg sond.Volume=1 sond.Pitch=1 sond:Play() end) end) AddCmd('Stop','stop','Stops <song>',function(Spkr,Msg) notif("Song was stopped.") local sond=game:service"Workspace":FindFirstChild("jbcv_sound") sond.Volume=0 sond.Pitch=0 sond:Stop() end) AddCmd('ShowLogs','clogs','Shows the chat logs for the server',function(Spkr,Msg) notif("Showing chatlogs.") makelist("ChatLogs",clogs) end) AddCmd('Commands','cmds','Shows a list of admin commands.',function(Spkr,Msg) notif("Showing commands.") local cmdtab = {} for i,v in pairs(cmds) do table.insert(cmdtab," "..v.Name.." Usage:"..v.Usage) end makelist("Commands",cmdtab) end) lp:GetMouse().Button1Down:connect(function() fixcol() if mode == "select" then so('233091183',ch.Torso,false,.8) if slct == 1 then pointa(false) mode = "origin" speed = .1 fixspeed(1) return elseif slct == 2 then pointa(false) mode = "ghost" speed = .1 fixspeed(1) return elseif slct == 3 then pointa(false) mode = "float" speed = .1 fixspeed(1) return elseif slct == 4 then mode = "kenisis" speed = .1 fixspeed(1) return elseif slct == 5 then pointa(false) mode = "saw" speed = .1 fixspeed(1) return elseif slct == 6 then pointa(false) mode = "lightning" speed = .1 fixspeed(1) return end elseif mode == "ghost" then so('200633455',ch.Torso,false,1) mode = "light" speed = .1 fixspeed(1) elseif mode == "lightning" then so('228343249',ch.Torso,false,.9) color=GetDiscoColor(tick()*.5) Lightning(guide.CFrame.p,lp:GetMouse().hit.p,math.random(5,10),math.random(-2.5,2.5),color,1.5) explosion(color,GetDiscoColor(tick()*.3),CFrame.new(lp:GetMouse().hit.p),Vector3.new(30,30,30),20) elseif mode == "kenisis" then if lp:GetMouse().Target~=nil and grab == nil then if lp:GetMouse().Target.ClassName=="Part" and lp:GetMouse().Target.Name~="Base" then gdist = -(ch:findFirstChild("Right Arm").Position - lp:GetMouse().Target.CFrame.p).magnitude grab=lp:GetMouse().Target local dis = (ch:findFirstChild("Head").Position - workspace.CurrentCamera.CoordinateFrame.p).magnitude lp.CameraMaxZoomDistance = dis lp.CameraMinZoomDistance = dis end end elseif mode == "float" then so('233856106',ch.Torso,false,.9) mode = "fly" bg=Instance.new("BodyGyro",ch.Torso) bv=Instance.new("BodyVelocity",ch.Torso) bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge) bv.maxForce = Vector3.new(99e3,99e3,99e3) if(ch.Humanoid.Sit ~= true)then ch.Humanoid.PlatformStand = true end speed = .1 fixspeed(1) elseif mode == "origin" then tim = game:service'RunService'.Stepped:wait() if (tim - c2timer < .2) then c2timer = tim speed = .15 send = lp:GetMouse().Hit.p mode = "tele" wait(.2) so('161006033',ch.Torso,false,.9) ch.Torso.CFrame = cf(send)*cf(0,3,0)*ca(0,ch.Torso.Rotation.Y,0) speed = .05 mode="origin" fixspeed(1) else wait(.15) end c2timer = tim end end) lp:GetMouse().Button2Down:connect(function() if mode == "kenisis" and grab then tim = game:service'RunService'.Stepped:wait() if (tim - c2timer < .2) then so('235097661',ch.Torso,false,1) local shot = grab grab=nil shot.Velocity=(lp:GetMouse().Hit.p-ch["Right Arm"].Position).unit*375 else wait(.15) end c2timer = tim end end) lp:GetMouse().Button1Up:connect(function() if mode == "fly" then mode = "float" so('233856106',ch.Torso,false,.8) bg:Destroy() bv:Destroy() ch.Humanoid.PlatformStand = false ch.Torso.CFrame = cf(ch.Torso.CFrame.X,ch.Torso.CFrame.Y,ch.Torso.CFrame.Z)*ca(0,ch.Torso.Rotation.Y,0) speed = .1 fixspeed(1) elseif mode == "light" then so('200633455',ch.Torso,false,.9) mode = "ghost" speed = .1 fixspeed(1) elseif mode == "kenisis" then grab = nil lp.CameraMaxZoomDistance = 400 lp.CameraMinZoomDistance = 0.5 end end) lp:GetMouse().KeyDown:connect(function(k) k = k:lower() if k == "e" and mode ~= "select" and mode ~= "fly" and mode ~= "light" then so('233091183',ch.Torso,false,.9) pointa(true) mode = "select" slct = 1 speed = .1 fixspeed(1) elseif string.byte(k) == 49 then textbox:CaptureFocus() end end) lp:GetMouse().WheelForward:connect(function() if mode =="kenisis" then gdist = gdist - 10 end end) lp:GetMouse().WheelBackward:connect(function() if mode =="kenisis" then if gdist < -5 then gdist = gdist + 10 end end end) guide = new("Part",workspace,{Size=Vector3.new(2,0,2);BrickColor=BrickColor.new("");CanCollide=false;Anchored=true;Locked=true;Transparency=1}) pl = new("PointLight",guide,{Color=BrickColor.new("Bright orange").Color;Range=0}) light = new("Fire",guide,{Size=3;Heat=0;Enabled=false}) BP=new("BodyPosition",nil,{maxForce=Vector3.new(9990000, 9990000, 9990000);position=Vector3.new(0,0,0)}) make() local curplrs = game.Players:GetPlayers() for i,v in pairs(curplrs) do v.Chatted:connect(function(m) table.insert(clogs,"["..v.Name.."]: "..m) end) end game:service"Players".ChildAdded:connect(function(p) if p.ClassName == "Player" then notif(p.Name.." has joined the server.") p.Chatted:connect(function(m) table.insert(clogs,"["..p.Name.."]: "..m) end) end end) game:service"Players".ChildRemoved:connect(function(p) if p.ClassName == "Player" then notif(p.Name.." has left the server.") end end) game:service("RunService").Stepped:connect(function() ch = lp.Character bcount = 0 for i=1,#pt do bcount = bcount + 2 if mode == "origin" then count = count + .0025 if i <= 3 then pt[i].CFrame = clerp(pt[i].CFrame,cf(ch.Torso.CFrame.p)*ca(0,count+rad(360/3)*i,0)*cf(2,-3,0)*ca(-pi/2,0,0),speed) else pt[i].CFrame = clerp(pt[i].CFrame,cf(ch.Torso.CFrame.p)*ca(0,-count-rad(360/3)*i,0)*cf(2.3,-3,0)*ca(pi/2,pi,0),speed) end elseif mode == "tele" then pt[i].CFrame = clerp(pt[i].CFrame,cf(send)*ca(0,0,pi/2)*ca(-count-rad(360/6)*i,0,0)*cf(0,3,0)*ca(pi/2,-pi/2,0),speed) elseif mode == "select" then guide.CanCollide=false ch.Humanoid.MaxHealth = 100 ch.Humanoid.WalkSpeed=16 pt[i].CFrame = clerp(pt[i].CFrame,ch.Torso.CFrame*ca(0,rad(-15)+rad(360/12)*i,0)*cf(5,0,0)*ca(pi/2,pi,0),speed) if lp:GetMouse().Target == pt[i] then if i == 1 then pt[i].BrickColor = bc("") slct = i elseif i == 2 then pt[i].BrickColor = bc("Royal purple") slct = i elseif i == 3 then pt[i].BrickColor = bc("Lapis") slct = i elseif i == 4 then pt[i].BrickColor = bc("Lime green") slct = i elseif i == 5 then pt[i].BrickColor = bc("Really red") slct = i elseif i == 6 then pt[i].BrickColor = bc("New Yeller") slct = i end else pt[i].BrickColor = bc("White") end elseif mode == "float" then guide.CanCollide=true count = count + .02 local goto = ch.Torso.CFrame*CFrame.new(0,-3,0) if Vector3.new(0, ch.Torso.Velocity.y, 0).magnitude > 5 then guide.CFrame=CFrame.new(goto.X,goto.Y,goto.Z) else guide.CFrame=CFrame.new(goto.X,guide.CFrame.Y,goto.Z) end if i <= 3 then pt[i].CFrame = clerp(pt[i].CFrame,cf(ch.Torso.CFrame.p)*ca(0,count+rad(360/3)*i,0)*cf(4,-3,0)*ca(pi/2,pi-rad(30),0),speed) else pt[i].CFrame = clerp(pt[i].CFrame,cf(ch.Torso.CFrame.p)*ca(0,-count-rad(360/3)*i,0)*cf(4.3,-3,0)*ca(pi/2,pi+rad(30),0),speed) end elseif mode == "kenisis" then count = count + .02 if grab ~= nil then light.Enabled=true BP.Parent=grab a= ch["Right Arm"].CFrame*CFrame.new(0,gdist,0)*CFrame.Angles(math.rad(90),0,-math.rad(180)) BP.position=a.p else BP.Parent=nil light.Enabled=false end light.Color = bc("Lime green").Color guide.CFrame=ch['Right Arm'].CFrame*cf(0,-1.5,0) local goto = ch.Torso.CFrame*CFrame.new(0,-3,0) if i <= 3 then pt[i].CFrame = clerp(pt[i].CFrame,ch['Right Arm'].CFrame*ca(0,count+rad(360/3)*i,0)*cf(.5,-1,0)*ca(pi/2,pi-rad(130),0),speed) else pt[i].CFrame = clerp(pt[i].CFrame,ch['Right Arm'].CFrame*ca(0,-count-rad(360/3)*i,0)*cf(.7,-1,0)*ca(pi/2,pi-rad(130),0),speed) end elseif mode == "ghost" then local ff = new("ForceField",ch) ch.Humanoid.MaxHealth = 100000 ch.Humanoid.Health = 100000 game.Debris:AddItem(ff,.001) light.Enabled=false ch.Humanoid.WalkSpeed=35 pl.Range=0 count = count + .005 if i <= 3 then pt[i].CFrame = clerp(pt[i].CFrame,cf(ch.Torso.CFrame.p)*cf(0,-math.sin(count)*3,0)*ca(0,1.55+count+math.rad(360/3)*i,0)*cf(3,0,0)*ca(0,pi,0),speed) else pt[i].CFrame = clerp(pt[i].CFrame,cf(ch.Torso.CFrame.p)*cf(0,math.sin(count)*3,0)*ca(0,-count+math.rad(360/3)*i,0)*cf(3,0,0)*ca(0,pi,0),speed) end ypcall(function() ch.Torso.CanCollide = false ch.Head.CanCollide = false end) elseif mode == "light" then ch.Humanoid.MaxHealth = 100 ch.Humanoid.WalkSpeed=16 guide.CFrame = CFrame.new(ch.Torso.CFrame.p)*CFrame.new(0,7,0) light.Enabled=true light.Color = bc("Bright orange").Color pl.Range=60 count = count + .005 if i <= 3 then pt[i].CFrame = clerp(pt[i].CFrame,cf(ch.Torso.CFrame.p)*cf(0,7,0)*ca(count,count,count+math.rad(360/3)*i)*cf(1.5,0,0),speed) else pt[i].CFrame = clerp(pt[i].CFrame,cf(ch.Torso.CFrame.p)*cf(0,7,0)*ca(count+1.1,count,count+math.rad(360/3)*i)*cf(2.25,0,0)*ca(0,0,0),speed) end ypcall(function() ch.Torso.CanCollide = false ch.Head.CanCollide = false end) elseif mode == "fly" then guide.CanCollide=false Direction = CFrame.new(ch.Torso.Position,lp:GetMouse().Hit.p) bg.cframe = Direction*CFrame.Angles(-1.55,0,0) bv.velocity = lp:GetMouse().Hit.lookVector*50 count = count + .01 if i <= 3 then pt[i].CFrame = clerp(pt[i].CFrame,ch.Torso.CFrame*ca(0,count+rad(360/3)*i,0)*cf(2,-3,0)*ca(pi/2,rad(30),0),speed) else pt[i].CFrame = clerp(pt[i].CFrame,ch.Torso.CFrame*ca(0,-count-rad(360/3)*i,0)*cf(2,3,0)*ca(pi/2,-rad(30),0),speed) end elseif mode == "saw" then count = count + .015 local part = pt[i] part.CFrame = clerp(pt[i].CFrame,ch.Torso.CFrame*ca(-count-rad(360/6)*i,0,0)*cf(0,3,0)*ca(pi/2,-pi/2,0),speed) local shootpos = pt[i].CFrame*cf(-2,0,0) local startpos = pt[i].CFrame*cf(-1.2,0,0) local ray = Ray.new(startpos.p,(shootpos.p - startpos.p).unit*2) local hit,position = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignore) if hit then frag(hit) end elseif mode == "lightning" then count = count + .015 guide.CFrame = cf(ch.Torso.CFrame.p)*CFrame.new(0,7,0) guide.CFrame = CFrame.new(guide.CFrame.p,lp:GetMouse().Hit.p) if i <= 3 then pt[i].CFrame = clerp(pt[i].CFrame,guide.CFrame*ca(-pi/2,count+rad(360/3)*i,0)*cf(1.7,0,0)*ca(pi/2,0,0),speed) else pt[i].CFrame = clerp(pt[i].CFrame,guide.CFrame*ca(-pi/2,-count-rad(360/3)*i,0)*cf(2,0,0)*ca(pi/2,-rad(30),0),speed) end end ignore = {} if bcount < 13 then pt2[bcount-1].CFrame = pt[i].CFrame *cf(-0.8,-0.5,0)*ca(0,0,rad(60)) pt2[bcount].CFrame = pt[i].CFrame *cf(-0.8,0.5,0)*ca(0,0,-rad(60)) end table.insert(ignore,pt2[bcount-1]) table.insert(ignore,pt2[bcount]) end if armloop then if ch.Torso:findFirstChild("Right Shoulder") then armw = ch.Torso:findFirstChild("Right Shoulder") armw.Parent = nil end ch['Right Arm'].Anchored = true local p0 = ch.Torso.CFrame p0 = p0 + ((p0 * ca(pi/-2,0,0)).lookVector * -0.5) + (p0 * ca(0,pi/-2,0)).lookVector local p1 = p0 + ((p0.p-lp:GetMouse().Hit.p).unit * -2) ch['Right Arm'].CFrame = cf((p0.p + p1.p)/2,p0.p) * ca(-math.pi/2,0,0) end for i,v in pairs(pt3) do if v.Parent ~= workspace then for i=1,#pt3 do game.Debris:AddItem(pt3[i],.1) end pt3 = {} pt2 = {} pt = {} make() end end if not lp.PlayerGui:findFirstChild("JL_gui") then makeg() end if guide.Parent ~= workspace then guide = new("Part",workspace,{Size=Vector3.new(2,0,2);BrickColor=BrickColor.new("");CanCollide=false;Anchored=true;Locked=true;Transparency=1}) pl = new("PointLight",guide,{Color=BrickColor.new("Bright orange").Color;Range=0}) light = new("Fire",guide,{Size=3;Heat=0;Enabled=false}) end if textlabel_2 then textlabel_2.Text = "FPS: "..math.floor(1/wait()*2) end end) efx(lp.Character.Torso) wait(.1) notif("JarLore Version"..version.." has successfully loaded.") wait(2) notif("You may start by pressing [L-CTRL] to focus.") --[["That'sa all folks!"]]--
TcpConnect = TcpConnect or class("TcpConnect", net_handler) function TcpConnect:ctor() self.super:ctor() self.recv_cb = nil self.native_handler = native.make_shared_lua_tcp_connect() self.native_handler:init(self) end function TcpConnect:set_recv_cb(cb) self.recv_cb = cb end function TcpConnect:on_recv(pid, bin) return self.recv_cb (self, pid, bin) end function TcpConnect:Reset() self.super:Reset() self.recv_cb = nil self.native_tcp_cnn = nil end function net_handler:get_native_connect_weak_ptr() return native.to_weak_ptr_net_connect(self.native_handler) end function net_handler:send(pid, bin) if not self.native_handler then return false end local ret = false if bin then ret = self.native_handler:send(pid, bin) else ret = self.native_handler:send(pid) end return ret end
require 'torch' local nn_utils = {} -- Sets the weights of a layer to random values within a range. -- @param weights The weights module to change, e.g. mlp.modules[1].weight. -- @param range Range for the new values (single number, e.g. 0.005) function nn_utils.setWeights(weights, range) weights:randn(weights:size()) weights:mul(range) end -- Initializes all weights of a multi layer network. -- @param model The nn.Sequential() model with one or more layers -- @param rangeWeights A range for the new weights values (single number, e.g. 0.005) -- @param rangeBias A range for the new bias values (single number, e.g. 0.005) function nn_utils.initializeWeights(model, rangeWeights, rangeBias) rangeWeights = rangeWeights or 0.005 rangeBias = rangeBias or 0.001 for m = 1, #model.modules do if model.modules[m].weight then nn_utils.setWeights(model.modules[m].weight, rangeWeights) end if model.modules[m].bias then nn_utils.setWeights(model.modules[m].bias, rangeBias) end end end -- Creates a tensor of N vectors, each of dimension OPT.noiseDim with random values -- between -1 and +1. -- @param N Number of vectors to generate -- @returns Tensor of shape (N, OPT.noiseDim) function nn_utils.createNoiseInputs(N) local noiseInputs = torch.Tensor(N, OPT.noiseDim) noiseInputs:uniform(-1.0, 1.0) return noiseInputs end -- Feeds noise vectors into G or AE+G and returns the result. -- @param noiseInputs Tensor from createNoiseInputs() -- @param outputAsList Whether to return the images as one list or as a tensor. -- @returns Either list of images (as returned by G/AE) or tensor of images function nn_utils.createImagesFromNoise(noiseInputs, outputAsList) local images local N = noiseInputs:size(1) local nBatches = math.ceil(N/OPT.batchSize) for i=1,nBatches do local batchStart = 1 + (i-1)*OPT.batchSize local batchEnd = math.min(i*OPT.batchSize, N) local generated = MODEL_G:forward(noiseInputs[{{batchStart, batchEnd}}]):clone() if images == nil then local img = generated[1] images = torch.Tensor(N, img:size(1), img:size(2), img:size(3)) end images[{{batchStart, batchEnd}, {}, {}, {}}] = generated end if outputAsList then local imagesList = {} for i=1, images:size(1) do imagesList[#imagesList+1] = images[i] end return imagesList else return images end end -- Creates new random images with G or AE+G. -- @param N Number of images to create. -- @param outputAsList Whether to return the images as one list or as a tensor. -- @param refineWithG Whether to allow AE+G or just AE (if AE was defined) -- @returns Either list of images (as returned by G/AE) or tensor of images function nn_utils.createImages(N, outputAsList, refineWithG) return nn_utils.createImagesFromNoise(nn_utils.createNoiseInputs(N), outputAsList, refineWithG) end -- Sorts images based on D's certainty that they are fake/real. -- Descending order starts at y=1 (Y_NOT_GENERATOR) and ends with y=0 (Y_GENERATOR). -- Therefore, in case of descending order, images for which D is very certain that they are real -- come first and images that seem to be fake (according to D) come last. -- @param images The images to sort. (Tensor) -- @param ascending If true then images that seem most fake to D are placed at the start of the list. -- Otherwise the list starts with probably real images. -- @param nbMaxOut Sets how many images may be returned max (cant be more images than provided). -- @return Tuple (list of images, list of predictions between 0.0 and 1.0) -- where 1.0 means "probably real" function nn_utils.sortImagesByPrediction(images, ascending, nbMaxOut) local predictions = torch.Tensor(images:size(1), 1) local nBatches = math.ceil(images:size(1)/OPT.batchSize) for i=1,nBatches do local batchStart = 1 + (i-1)*OPT.batchSize local batchEnd = math.min(i*OPT.batchSize, images:size(1)) predictions[{{batchStart, batchEnd}, {1}}] = MODEL_D:forward(images[{{batchStart, batchEnd}, {}, {}, {}}]) end local imagesWithPreds = {} for i=1,images:size(1) do imagesWithPreds[i] = {images[i], predictions[i][1]} end if ascending then table.sort(imagesWithPreds, function (a,b) return a[2] < b[2] end) else table.sort(imagesWithPreds, function (a,b) return a[2] > b[2] end) end local resultImages = {} local resultPredictions = {} for i=1,math.min(nbMaxOut,#imagesWithPreds) do resultImages[i] = imagesWithPreds[i][1] resultPredictions[i] = imagesWithPreds[i][2] end return resultImages, resultPredictions end -- Visualizes the current training status via Display (based on gfx.js) in the browser. -- It shows: -- Images generated from random noise (the noise vectors are set once at the start of the -- training, so the images should end up similar at each epoch) -- Images that were deemed "good" by D -- Images that were deemed "bad" by D -- Original images from the training set (as comparison) -- If an Autoencoder is defined, it will show the results of that network (before G is applied -- as refiner). -- @param noiseInputs The noise vectors for the random images. -- @returns void function nn_utils.visualizeProgress(noiseInputs) -- deactivate dropout nn_utils.switchToEvaluationMode() -- Generate images from G based on the provided noiseInputs -- If an autoencoder is defined, the images will be first generated by the autoencoder -- and then refined by G local semiRandomImagesUnrefined if MODEL_AE then semiRandomImagesUnrefined = nn_utils.createImagesFromNoise(noiseInputs, true, false) end local semiRandomImagesRefined = nn_utils.createImagesFromNoise(noiseInputs, true, true) -- denoise local diList = {} if DENOISER ~= nil then local batch = torch.Tensor(#semiRandomImagesRefined, IMG_DIMENSIONS[1], IMG_DIMENSIONS[2], IMG_DIMENSIONS[3]) for i=1,#semiRandomImagesRefined do batch[i] = semiRandomImagesRefined[i]:clone() end local denoisedImages = DENOISER:forward(batch) for i=1,denoisedImages:size(1) do table.insert(diList, denoisedImages[i]:clone()) end end -- Generate a synthetic test image as sanity test -- This should be deemed very bad by D local sanityTestImage = torch.Tensor(IMG_DIMENSIONS[1], IMG_DIMENSIONS[2], IMG_DIMENSIONS[3]) sanityTestImage:uniform(0.0, 0.50) for i=1,OPT.scale do for j=1,OPT.scale do if i == j then sanityTestImage[1][i][j] = 1.0 elseif i % 4 == 0 and j % 4 == 0 then sanityTestImage[1][i][j] = 0.5 end end end -- Collect original example images from the training set local trainImages = torch.Tensor(100, IMG_DIMENSIONS[1], IMG_DIMENSIONS[2], IMG_DIMENSIONS[3]) for i=1,100 do trainImages[i] = TRAIN_DATA[i] end -- Create random images images, they will split into good and bad images local randomImages = nn_utils.createImages(300, false) -- Place the sanity test image and one original image from the training corpus among -- the random Images. The first should be deemed bad by D, the latter as good. randomImages[299] = TRAIN_DATA[1] -- one real face as sanity test randomImages[300] = sanityTestImage -- synthetic non-face as sanity test -- find bad images (according to D) among the randomly generated ones local badImages, _ = nn_utils.sortImagesByPrediction(randomImages, true, 50) -- find good images (according to D) among the randomly generated ones local goodImages, _ = nn_utils.sortImagesByPrediction(randomImages, false, 50) --if semiRandomImagesUnrefined then --DISP.image(semiRandomImagesUnrefined, {win=OPT.window, width=IMG_DIMENSIONS[3]*15, title="semi-random generated images (before G)"}) --end --DISP.image(semiRandomImagesRefined, {win=OPT.window+1, width=IMG_DIMENSIONS[3]*15, title="semi-random generated images (after G)"}) --if #diList > 0 then --DISP.image(diList, {win=OPT.window+2, width=IMG_DIMENSIONS[3]*15, title="images by G, denoised"}) --end --DISP.image(goodImages, {win=OPT.window+3, width=IMG_DIMENSIONS[3]*15, title="best samples (first is best)"}) --DISP.image(badImages, {win=OPT.window+4, width=IMG_DIMENSIONS[3]*15, title="worst samples (first is worst)"}) --DISP.image(trainImages, {win=OPT.window+5, width=IMG_DIMENSIONS[3]*15, title="original images from training set"}) -- reactivate dropout nn_utils.switchToTrainingMode() end -- Switch networks to training mode (activate Dropout) function nn_utils.switchToTrainingMode() if MODEL_AE then MODEL_AE:training() end MODEL_G:training() MODEL_D:training() end -- Switch networks to evaluation mode (deactivate Dropout) function nn_utils.switchToEvaluationMode() if MODEL_AE then MODEL_AE:evaluate() end MODEL_G:evaluate() MODEL_D:evaluate() end --[[ function nn_utils.prepareNetworkForSave(net) local modules = net:listModules() for i=1,#modules do local m = modules[i] if m.output then m.output = torch.Tensor() print(i, "Resetting m.output") else print(i, "Not setting m.output") end if m.gradInput then m.gradInput = torch.Tensor() print(i, "Resetting m.gradInput") else print(i, "Not setting m.gradInput") end end end --]] -- from https://github.com/torch/DEPRECEATED-torch7-distro/issues/47 function nn_utils.zeroDataSize(data) if type(data) == 'table' then for i = 1, #data do data[i] = nn_utils.zeroDataSize(data[i]) end elseif type(data) == 'userdata' then data = torch.Tensor():typeAs(data) end return data end -- from https://github.com/torch/DEPRECEATED-torch7-distro/issues/47 -- Resize the output, gradInput, etc temporary tensors to zero (so that the on disk size is smaller) function nn_utils.prepareNetworkForSave(node) if node.output ~= nil then node.output = nn_utils.zeroDataSize(node.output) end if node.gradInput ~= nil then node.gradInput = nn_utils.zeroDataSize(node.gradInput) end if node.finput ~= nil then node.finput = nn_utils.zeroDataSize(node.finput) end -- Recurse on nodes with 'modules' if (node.modules ~= nil) then if (type(node.modules) == 'table') then for i = 1, #node.modules do local child = node.modules[i] nn_utils.prepareNetworkForSave(child) end end end collectgarbage() end function nn_utils.getNumberOfParameters(net) local nparams = 0 local dModules = net:listModules() for i=1,#dModules do if dModules[i].weight ~= nil then nparams = nparams + dModules[i].weight:nElement() end end return nparams end function nn_utils.deactivateCuda(net) -- transferring to float first, so that the clone does not happen on the gpu (can cause -- out of memory otherwise) --[[ print("A", torch.type(net), torch.type(net:get(1))) net:float() local newNet = net:clone() net:cuda() print("B", torch.type(net), torch.type(net:get(1))) if torch.type(newNet:get(1)) == 'nn.Copy' then return newNet:get(2) else return newNet end --]] if isInCudaMode(net) then -- [1] Copy -- [2] Sequential (the network) -- [3] Copy -- transferring to float first, so that the clone does not happen on the gpu (can cause -- out of memory otherwise) net:get(2):float() local newNet = net:clone() net:get(2):cuda() return newNet:get(2) else return net:clone() end end -- Activates CUDA mode on a network and returns the result. -- This adds Copy layers at the start and end of the network. -- Expects the default tensor to be FloatTensor. -- @param net The network to activate CUDA mode on. -- @returns The CUDA network function nn_utils.activateCuda(net) --[[ local newNet = net:clone() newNet:cuda() local tmp = nn.Sequential() tmp:add(nn.Copy('torch.FloatTensor', 'torch.CudaTensor')) tmp:add(newNet) tmp:add(nn.Copy('torch.CudaTensor', 'torch.FloatTensor')) return tmp --]] -- does the network already contain any copy layers? local containsCopyLayers = false local modules = net:listModules() for i=1,#modules do local t = torch.type(modules[i]) if string.find(t, "Copy") ~= nil then containsCopyLayers = true break end end -- no copy layers in the network yet -- add them at the start and end if containsCopyLayers then return net else local newNet = net:clone() local tmp = nn.Sequential() tmp:add(nn.Copy('torch.FloatTensor', 'torch.CudaTensor')) tmp:add(newNet) tmp:add(nn.Copy('torch.CudaTensor', 'torch.FloatTensor')) newNet:cuda() newNet = tmp return newNet end --[[ local firstCopyFound = false local lastCopyFound = false modules = newNet:listModules() for i=1,#modules do local t = torch.type(modules[i]) if string.find(t, "Copy") ~= nil then if not firstCopyFound then firstCopyFound = true modules[i]:cuda() modules[i].intype = 'torch.FloatTensor' modules[i].outtype = 'torch.CudaTensor' else -- last copy found lastCopyFound = true modules[i]:float() modules[i].intype = 'torch.CudaTensor' modules[i].outtype = 'torch.FloatTensor' end elseif lastCopyFound then modules[i]:float() elseif firstCopyFound then modules[i]:cuda() else modules[i]:float() end end --]] return newNet end function isInCudaMode(net) -- TODO is there a function in cunn to check if :cuda() has been called on a sequential? local l1 = net:get(1) local l2 = net:get(2) local l3 = net:get(3) return torch.type(l1) == 'nn.Copy' and torch.type(l2) == 'nn.Sequential' and torch.type(l3) == 'nn.Copy' end return nn_utils
-- params : ... player = game:GetService("Players").LocalPlayer char = player.Character mouse = player:GetMouse() for i,v in pairs(char:GetChildren()) do if v.ClassName == "BoolValue" then v:Destroy() else if v.ClassName == "NumberValue" then v:Destroy() else if v.ClassName == "IntValue" then v:Destroy() else if v.ClassName == "CFrameValue" then v:Destroy() else if v.ClassName == "Model" then v:Destroy() end end end end end end local makeorb = false idleq = false local skl = false local healingmode = false parts = {} poses = {} sizes = {} local obj3, HBOX1, HBOX2, TARG10, TARG11, STARG, lastdg, objs, objs2, dg, dgm = nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil local active = true local spinning = false team = Instance.new("StringValue", char) team.Name = "Team" team.Value = player.Name makepart = function(transparency, collide, color, size, cf, material, shape, debris, anchored) local p = Instance.new("Part", game.Workspace) if transparency ~= nil then p.Transparency = transparency end p.Anchored = true if collide ~= nil then p.CanCollide = collide if color ~= nil then p.BrickColor = BrickColor.new(color) end if size ~= nil then p.Size = size end if cf ~= nil then p.CFrame = cf end if material ~= nil then p.Material = material end if shape ~= nil then p.Shape = shape end if debris ~= nil then game.Debris:AddItem(p, debris) end p.TopSurface = "SmoothNoOutlines" p.BottomSurface = "SmoothNoOutlines" p.LeftSurface = "SmoothNoOutlines" p.RightSurface = "SmoothNoOutlines" p.FrontSurface = "SmoothNoOutlines" p.BackSurface = "SmoothNoOutlines" return p end end meshsomething = function(part, meshid, textureid, scale, mt) local msh = nil if mt ~= nil then msh = Instance.new(mt, part) else msh = Instance.new("SpecialMesh", part) end if meshid ~= nil then msh.MeshId = meshid end if textureid ~= nil then msh.TextureId = textureid end if scale ~= nil then msh.Scale = scale end return msh end local lastdf, df, dfm = nil, nil, nil local basicunlocked = false stats=Instance.new("BoolValue", char) stats.Name="Stats" stats.Value=false mc = Instance.new("NumberValue", stats) mc.Name = "CloanTime" mc.Value = 0 ht = Instance.new("NumberValue", stats) ht.Name = "HealingTime" ht.Value = 6 stun = Instance.new("BoolValue", stats) stun.Name = "Stunned" stun.Value = false atk = Instance.new("NumberValue", stats) atk.Name = "Attack" atk.Value = 1 def = Instance.new("NumberValue", stats) def.Name = "Defense" def.Value = 1 spd = Instance.new("NumberValue", stats) spd.Name = "Speed" spd.Value = 1 deft = Instance.new("NumberValue", stats) deft.Name = "DefenseTime" deft.Value = 0 atkt = Instance.new("NumberValue", stats) atkt.Name = "AttackTime" atkt.Value = 0 spdt = Instance.new("NumberValue", stats) spdt.Name = "SpeedTime" spdt.Value = 0 posd = Instance.new("BoolValue", stats) posd.Name = "Posioned" posd.Value = false pt = Instance.new("NumberValue", stats) pt.Name = "PoisonTime" pt.Value = 0 bl = Instance.new("BoolValue", stats) bl.Name = "Blocking" bl.Value = false bll = Instance.new("BoolValue", stats) bll.Name = "BlockingLabel" bll.Value = false blt = Instance.new("NumberValue", stats) blt.Name = "BlockingLeft" blt.Value = 50 pb = Instance.new("BoolValue", stats) pb.Name = "PauseBlock" pb.Value = false blm = 100 gd = Instance.new("BoolValue", stats) gd.Name = "Ground" local TARG7, obj, TARG8, obj2 = nil, nil, nil, nil for i,v in pairs(char:GetChildren()) do if v.ClassName == "Weld" then v:destroy() end if v.ClassName == "Model" then v:Destroy() end end for i,v in pairs(player.PlayerGui:GetChildren()) do if v.Name == "UI" then v:Destroy() end end for i,v in pairs(char.Head:GetChildren()) do if v.ClassName == "Sound" then v:Destroy() end end local m = Instance.new("Model") m.Name = "Runic Tunes" p1 = Instance.new("Part", m) p1.BrickColor = BrickColor.new("Lily white") p1.Material = Enum.Material.SmoothPlastic p1.Name = "BLD" p1.CFrame = CFrame.new(158.814728, 7.5604434, 68.9112091, 0.118325084, -0.0106279431, -0.992919028, 0.00754601555, 0.999924302, -0.00980370957, 0.992947757, -0.00633254647, 0.118396461) p1.CanCollide = false p1.Size = Vector3.new(0.200000003, 1.96283054, 0.200000003) p1.BackSurface = Enum.SurfaceType.SmoothNoOutlines p1.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p1.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p1.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p1.RightSurface = Enum.SurfaceType.SmoothNoOutlines p1.TopSurface = Enum.SurfaceType.SmoothNoOutlines b1 = Instance.new("BlockMesh", p1) b1.Name = "Mesh" b1.Scale = Vector3.new(0.648554683, 1, 0.684892654) p2 = Instance.new("Part", m) p2.BrickColor = BrickColor.new("Steel blue") p2.Material = Enum.Material.Neon p2.Name = "BLD" p2.CFrame = CFrame.new(158.814041, 7.5597086, 68.9119949, 0.118325084, -0.0106279431, -0.992919028, 0.00754601555, 0.999924302, -0.00980370957, 0.992947757, -0.00633254647, 0.118396461) p2.CanCollide = false p2.Size = Vector3.new(0.200000003, 1.97707105, 0.200000003) p2.BackSurface = Enum.SurfaceType.SmoothNoOutlines p2.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p2.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p2.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p2.RightSurface = Enum.SurfaceType.SmoothNoOutlines p2.TopSurface = Enum.SurfaceType.SmoothNoOutlines b2 = Instance.new("BlockMesh", p2) b2.Name = "Mesh" b2.Scale = Vector3.new(0.557979703, 1, 0.633331835) p3 = Instance.new("WedgePart", m) p3.BrickColor = BrickColor.new("Steel blue") p3.Material = Enum.Material.Neon p3.Name = "BLD" p3.CFrame = CFrame.new(156.878372, 13.0602722, 69.0994492, -0.11835397, -0.992914915, -0.0106989695, -0.00756300753, -0.00987302419, 0.999923646, -0.992943823, 0.118426017, -0.0063409037) p3.CanCollide = false p3.FormFactor = Enum.FormFactor.Symmetric p3.Size = Vector3.new(0.200000003, 0.402665049, 0.777830362) p3.BackSurface = Enum.SurfaceType.SmoothNoOutlines p3.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p3.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p3.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p3.RightSurface = Enum.SurfaceType.SmoothNoOutlines p3.TopSurface = Enum.SurfaceType.SmoothNoOutlines b3 = Instance.new("SpecialMesh", p3) b3.MeshType = Enum.MeshType.Wedge b3.Name = "Mesh" b3.Scale = Vector3.new(0.498162329, 1, 1) p4 = Instance.new("Part", m) p4.BrickColor = BrickColor.new("Steel blue") p4.Material = Enum.Material.Neon p4.Name = "BLD" p4.CFrame = CFrame.new(157.307724, 12.1233807, 69.0564804, 0.118310027, 0.529905677, -0.839764893, 0.00755101116, 0.845199645, 0.534398854, 0.992949247, -0.0695658773, 0.0959944203) p4.CanCollide = false p4.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p4.BackSurface = Enum.SurfaceType.SmoothNoOutlines p4.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p4.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p4.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p4.RightSurface = Enum.SurfaceType.SmoothNoOutlines p4.TopSurface = Enum.SurfaceType.SmoothNoOutlines b4 = Instance.new("BlockMesh", p4) b4.Name = "Mesh" b4.Scale = Vector3.new(0.50920862, 1, 1) p5 = Instance.new("Part", m) p5.BrickColor = BrickColor.new("Steel blue") p5.Material = Enum.Material.Neon p5.Name = "BLD" p5.CFrame = CFrame.new(160.176987, 12.1517935, 68.714447, -0.118335038, -0.547754049, 0.828229785, -0.0075480137, 0.834562182, 0.550863683, -0.992946565, 0.0589350685, -0.10289254) p5.CanCollide = false p5.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p5.BackSurface = Enum.SurfaceType.SmoothNoOutlines p5.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p5.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p5.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p5.RightSurface = Enum.SurfaceType.SmoothNoOutlines p5.TopSurface = Enum.SurfaceType.SmoothNoOutlines b5 = Instance.new("BlockMesh", p5) b5.Name = "Mesh" b5.Scale = Vector3.new(0.50920862, 1, 1) p6 = Instance.new("Part", m) p6.BrickColor = BrickColor.new("Steel blue") p6.Material = Enum.Material.Neon p6.Name = "BLD" p6.CFrame = CFrame.new(157.422958, 12.2590694, 69.0417023, 0.118307069, 0.747301161, -0.653870761, 0.00755501352, 0.657798648, 0.753157079, 0.992949605, -0.0940439478, 0.0721764714) p6.CanCollide = false p6.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p6.BackSurface = Enum.SurfaceType.SmoothNoOutlines p6.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p6.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p6.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p6.RightSurface = Enum.SurfaceType.SmoothNoOutlines p6.TopSurface = Enum.SurfaceType.SmoothNoOutlines b6 = Instance.new("BlockMesh", p6) b6.Name = "Mesh" b6.Scale = Vector3.new(0.50920862, 1, 1) p7 = Instance.new("Part", m) p7.BrickColor = BrickColor.new("Lily white") p7.Material = Enum.Material.SmoothPlastic p7.Name = "BLD" p7.CFrame = CFrame.new(158.754517, 12.4360352, 68.8841705, 0.11835397, -0.99291575, 0.0106354216, 0.00756300753, -0.00980902929, -0.999924123, 0.992943823, 0.118425608, 0.00634848187) p7.CanCollide = false p7.Size = Vector3.new(0.200000003, 1.43592846, 0.234207362) p7.BackSurface = Enum.SurfaceType.SmoothNoOutlines p7.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p7.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p7.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p7.RightSurface = Enum.SurfaceType.SmoothNoOutlines p7.TopSurface = Enum.SurfaceType.SmoothNoOutlines b7 = Instance.new("BlockMesh", p7) b7.Name = "Mesh" b7.Scale = Vector3.new(0.58933264, 1, 1) p8 = Instance.new("WedgePart", m) p8.BrickColor = BrickColor.new("Steel blue") p8.Material = Enum.Material.Neon p8.Name = "BLD" p8.CFrame = CFrame.new(157.24379, 11.7580929, 69.0659103, -0.11835397, -0.992914915, -0.0106989695, -0.00756300753, -0.00987302419, 0.999923646, -0.992943823, 0.118426017, -0.0063409037) p8.CanCollide = false p8.FormFactor = Enum.FormFactor.Symmetric p8.Size = Vector3.new(0.200000003, 0.402665049, 0.777830362) p8.BackSurface = Enum.SurfaceType.SmoothNoOutlines p8.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p8.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p8.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p8.RightSurface = Enum.SurfaceType.SmoothNoOutlines p8.TopSurface = Enum.SurfaceType.SmoothNoOutlines b8 = Instance.new("SpecialMesh", p8) b8.MeshType = Enum.MeshType.Wedge b8.Name = "Mesh" b8.Scale = Vector3.new(0.498162329, 1, 1) p9 = Instance.new("WedgePart", m) p9.BrickColor = BrickColor.new("Steel blue") p9.Material = Enum.Material.Neon p9.Name = "BLD" p9.CFrame = CFrame.new(160.248718, 11.7879009, 68.7096558, 0.118293986, 0.992922843, -0.0106371325, 0.00756400824, 0.00981101859, 0.999924242, 0.992950976, -0.11836566, -0.00634988351) p9.CanCollide = false p9.FormFactor = Enum.FormFactor.Symmetric p9.Size = Vector3.new(0.200000003, 0.402665049, 0.777830362) p9.BackSurface = Enum.SurfaceType.SmoothNoOutlines p9.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p9.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p9.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p9.RightSurface = Enum.SurfaceType.SmoothNoOutlines p9.TopSurface = Enum.SurfaceType.SmoothNoOutlines b9 = Instance.new("SpecialMesh", p9) b9.MeshType = Enum.MeshType.Wedge b9.Name = "Mesh" b9.Scale = Vector3.new(0.498162329, 1, 1) p10 = Instance.new("Part", m) p10.BrickColor = BrickColor.new("Lily white") p10.Material = Enum.Material.SmoothPlastic p10.Name = "BLD" p10.CFrame = CFrame.new(159.46701, 12.4445133, 68.7992249, 0.118308052, 0.694607854, -0.709595263, 0.00755301397, 0.713963687, 0.700143218, 0.992949486, -0.0881922767, 0.0792213902) p10.CanCollide = false p10.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p10.BackSurface = Enum.SurfaceType.SmoothNoOutlines p10.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p10.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p10.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p10.RightSurface = Enum.SurfaceType.SmoothNoOutlines p10.TopSurface = Enum.SurfaceType.SmoothNoOutlines b10 = Instance.new("BlockMesh", p10) b10.Name = "Mesh" b10.Scale = Vector3.new(0.58933264, 0.815570593, 0.824843287) p11 = Instance.new("Part", m) p11.BrickColor = BrickColor.new("Steel blue") p11.Material = Enum.Material.Neon p11.Name = "BLD" p11.CFrame = CFrame.new(159.728104, 12.4282827, 68.7657394, -0.118352018, -0.982557595, 0.143443584, -0.00755901122, 0.145346135, 0.989352942, -0.99294436, 0.116007797, -0.0246291868) p11.CanCollide = false p11.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p11.BackSurface = Enum.SurfaceType.SmoothNoOutlines p11.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p11.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p11.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p11.RightSurface = Enum.SurfaceType.SmoothNoOutlines p11.TopSurface = Enum.SurfaceType.SmoothNoOutlines b11 = Instance.new("BlockMesh", p11) b11.Name = "Mesh" b11.Scale = Vector3.new(0.50920862, 1, 1) p12 = Instance.new("Part", m) p12.BrickColor = BrickColor.new("Steel blue") p12.Material = Enum.Material.Neon p12.Name = "BLD" p12.CFrame = CFrame.new(160.058914, 12.2851906, 68.727478, -0.118341058, -0.761105955, 0.6377424, -0.00755101349, 0.642926514, 0.765891731, -0.992945552, 0.0858209506, -0.0818318427) p12.CanCollide = false p12.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p12.BackSurface = Enum.SurfaceType.SmoothNoOutlines p12.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p12.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p12.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p12.RightSurface = Enum.SurfaceType.SmoothNoOutlines p12.TopSurface = Enum.SurfaceType.SmoothNoOutlines b12 = Instance.new("BlockMesh", p12) b12.Name = "Mesh" b12.Scale = Vector3.new(0.50920862, 1, 1) p13 = Instance.new("Part", m) p13.BrickColor = BrickColor.new("Steel blue") p13.Material = Enum.Material.Neon p13.Name = "BLD" p13.CFrame = CFrame.new(157.750641, 12.4086933, 69.0015106, 0.118294001, 0.97926718, -0.164452553, 0.00756200869, 0.164722145, 0.986311972, 0.992951095, -0.117918529, 0.0120804515) p13.CanCollide = false p13.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p13.BackSurface = Enum.SurfaceType.SmoothNoOutlines p13.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p13.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p13.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p13.RightSurface = Enum.SurfaceType.SmoothNoOutlines p13.TopSurface = Enum.SurfaceType.SmoothNoOutlines b13 = Instance.new("BlockMesh", p13) b13.Name = "Mesh" b13.Scale = Vector3.new(0.50920862, 1, 1) p14 = Instance.new("Part", m) p14.BrickColor = BrickColor.new("Steel blue") p14.Material = Enum.Material.Neon p14.Name = "BLD" p14.CFrame = CFrame.new(159.909805, 12.3785143, 68.7444763, -0.118348099, -0.916854024, 0.381280303, -0.0075570154, 0.384799153, 0.922970295, -0.992944837, 0.106350563, -0.0524689853) p14.CanCollide = false p14.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p14.BackSurface = Enum.SurfaceType.SmoothNoOutlines p14.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p14.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p14.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p14.RightSurface = Enum.SurfaceType.SmoothNoOutlines p14.TopSurface = Enum.SurfaceType.SmoothNoOutlines b14 = Instance.new("BlockMesh", p14) b14.Name = "Mesh" b14.Scale = Vector3.new(0.50920862, 1, 1) p15 = Instance.new("Part", m) p15.BrickColor = BrickColor.new("Steel blue") p15.Material = Enum.Material.Neon p15.Name = "BLD" p15.CFrame = CFrame.new(157.570007, 12.3553028, 69.0234451, 0.118300028, 0.908478975, -0.400840968, 0.00755601097, 0.402840227, 0.915240228, 0.992950439, -0.111301847, 0.0407916084) p15.CanCollide = false p15.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p15.BackSurface = Enum.SurfaceType.SmoothNoOutlines p15.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p15.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p15.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p15.RightSurface = Enum.SurfaceType.SmoothNoOutlines p15.TopSurface = Enum.SurfaceType.SmoothNoOutlines b15 = Instance.new("BlockMesh", p15) b15.Name = "Mesh" b15.Scale = Vector3.new(0.50920862, 1, 1) p16 = Instance.new("Part", m) p16.BrickColor = BrickColor.new("Steel blue") p16.Material = Enum.Material.Neon p16.Name = "BLD" p16.CFrame = CFrame.new(158.742798, 12.4337044, 68.8831253, 0.118293986, 0.992922843, -0.0106371325, 0.00756400824, 0.00981101859, 0.999924242, 0.992950976, -0.11836566, -0.00634988351) p16.CanCollide = false p16.Size = Vector3.new(0.200000003, 1.83073652, 0.486118287) p16.BackSurface = Enum.SurfaceType.SmoothNoOutlines p16.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p16.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p16.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p16.RightSurface = Enum.SurfaceType.SmoothNoOutlines p16.TopSurface = Enum.SurfaceType.SmoothNoOutlines b16 = Instance.new("BlockMesh", p16) b16.Name = "Mesh" b16.Scale = Vector3.new(0.50920862, 1, 1) p17 = Instance.new("Part", m) p17.BrickColor = BrickColor.new("Lily white") p17.Material = Enum.Material.SmoothPlastic p17.Name = "BLD" p17.CFrame = CFrame.new(158.041702, 12.4303865, 68.9691162, 0.118307985, 0.694608331, -0.709595621, 0.00755301351, 0.713964105, 0.700143635, 0.992949724, -0.0881923735, 0.0792214721) p17.CanCollide = false p17.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p17.BackSurface = Enum.SurfaceType.SmoothNoOutlines p17.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p17.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p17.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p17.RightSurface = Enum.SurfaceType.SmoothNoOutlines p17.TopSurface = Enum.SurfaceType.SmoothNoOutlines b17 = Instance.new("BlockMesh", p17) b17.Name = "Mesh" b17.Scale = Vector3.new(0.58933264, 0.815570593, 0.824843287) p18 = Instance.new("Part", m) p18.BrickColor = BrickColor.new("Steel blue") p18.Material = Enum.Material.Neon p18.Name = "BLD" p18.CFrame = CFrame.new(160.275757, 13.6879368, 68.6909027, -0.11834804, -0.91685462, 0.381280571, -0.0075570168, 0.384799421, 0.922970891, -0.992945075, 0.10635069, -0.0524690524) p18.CanCollide = false p18.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p18.BackSurface = Enum.SurfaceType.SmoothNoOutlines p18.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p18.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p18.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p18.RightSurface = Enum.SurfaceType.SmoothNoOutlines p18.TopSurface = Enum.SurfaceType.SmoothNoOutlines b18 = Instance.new("BlockMesh", p18) b18.Name = "Mesh" b18.Scale = Vector3.new(0.50920862, 1, 1) p19 = Instance.new("Part", m) p19.BrickColor = BrickColor.new("Steel blue") p19.Material = Enum.Material.Neon p19.Name = "BLD" p19.CFrame = CFrame.new(160.094055, 13.7376461, 68.7121124, -0.118351959, -0.982558072, 0.143443704, -0.00755901216, 0.145346209, 0.989353597, -0.992944598, 0.116007946, -0.0246292129) p19.CanCollide = false p19.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p19.BackSurface = Enum.SurfaceType.SmoothNoOutlines p19.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p19.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p19.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p19.RightSurface = Enum.SurfaceType.SmoothNoOutlines p19.TopSurface = Enum.SurfaceType.SmoothNoOutlines b19 = Instance.new("BlockMesh", p19) b19.Name = "Mesh" b19.Scale = Vector3.new(0.50920862, 1, 1) p20 = Instance.new("Part", m) p20.BrickColor = BrickColor.new("Steel blue") p20.Material = Enum.Material.Neon p20.Name = "BLD" p20.CFrame = CFrame.new(160.543045, 13.4612131, 68.660759, -0.118334994, -0.547754407, 0.828230321, -0.00754801324, 0.834562838, 0.550863981, -0.992946804, 0.0589351282, -0.102892645) p20.CanCollide = false p20.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p20.BackSurface = Enum.SurfaceType.SmoothNoOutlines p20.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p20.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p20.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p20.RightSurface = Enum.SurfaceType.SmoothNoOutlines p20.TopSurface = Enum.SurfaceType.SmoothNoOutlines b20 = Instance.new("BlockMesh", p20) b20.Name = "Mesh" b20.Scale = Vector3.new(0.50920862, 1, 1) p21 = Instance.new("WedgePart", m) p21.BrickColor = BrickColor.new("Steel blue") p21.Material = Enum.Material.Neon p21.Name = "BLD" p21.CFrame = CFrame.new(160.61467, 13.0973186, 68.6560059, 0.118293941, 0.992923439, -0.0106371343, 0.00756401056, 0.0098110307, 0.999924839, 0.992951334, -0.118365787, -0.0063498863) p21.CanCollide = false p21.FormFactor = Enum.FormFactor.Symmetric p21.Size = Vector3.new(0.200000003, 0.402665049, 0.777830362) p21.BackSurface = Enum.SurfaceType.SmoothNoOutlines p21.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p21.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p21.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p21.RightSurface = Enum.SurfaceType.SmoothNoOutlines p21.TopSurface = Enum.SurfaceType.SmoothNoOutlines b21 = Instance.new("SpecialMesh", p21) b21.MeshType = Enum.MeshType.Wedge b21.Name = "Mesh" b21.Scale = Vector3.new(0.498162329, 1, 1) p22 = Instance.new("Part", m) p22.BrickColor = BrickColor.new("Steel blue") p22.Material = Enum.Material.Neon p22.Name = "BLD" p22.CFrame = CFrame.new(160.42485, 13.5945854, 68.6738205, -0.118341006, -0.761106491, 0.637742817, -0.00755101489, 0.642926931, 0.765892208, -0.99294579, 0.0858210698, -0.0818319246) p22.CanCollide = false p22.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p22.BackSurface = Enum.SurfaceType.SmoothNoOutlines p22.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p22.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p22.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p22.RightSurface = Enum.SurfaceType.SmoothNoOutlines p22.TopSurface = Enum.SurfaceType.SmoothNoOutlines b22 = Instance.new("BlockMesh", p22) b22.Name = "Mesh" b22.Scale = Vector3.new(0.50920862, 1, 1) p23 = Instance.new("Part", m) p23.BrickColor = BrickColor.new("Lily white") p23.Material = Enum.Material.SmoothPlastic p23.Name = "BLD" p23.CFrame = CFrame.new(158.827927, 6.39995003, 68.9178162, 0.118325025, -0.0106279431, -0.992919743, 0.00754601602, 0.999924898, -0.00980372261, 0.992947996, -0.00633254927, 0.11839661) p23.CanCollide = false p23.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p23.BackSurface = Enum.SurfaceType.SmoothNoOutlines p23.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p23.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p23.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p23.RightSurface = Enum.SurfaceType.SmoothNoOutlines p23.TopSurface = Enum.SurfaceType.SmoothNoOutlines b23 = Instance.new("BlockMesh", p23) b23.Name = "Mesh" b23.Scale = Vector3.new(0.718227684, 0.506206095, 0.73399806) p24 = Instance.new("Part", m) p24.BrickColor = BrickColor.new("Lily white") p24.Material = Enum.Material.SmoothPlastic p24.Name = "BLD" p24.CFrame = CFrame.new(158.827576, 6.39646339, 68.9185486, 0.118325025, -0.0106279431, -0.992919743, 0.00754601602, 0.999924898, -0.00980372261, 0.992947996, -0.00633254927, 0.11839661) p24.CanCollide = false p24.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p24.BackSurface = Enum.SurfaceType.SmoothNoOutlines p24.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p24.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p24.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p24.RightSurface = Enum.SurfaceType.SmoothNoOutlines p24.TopSurface = Enum.SurfaceType.SmoothNoOutlines b24 = Instance.new("BlockMesh", p24) b24.Name = "Mesh" b24.Scale = Vector3.new(0.648554683, 0.687896371, 0.684892654) p25 = Instance.new("Part", m) p25.BrickColor = BrickColor.new("Steel blue") p25.Material = Enum.Material.Neon p25.Name = "BLD" p25.CFrame = CFrame.new(158.736465, 14.890851, 68.865036, 0.118337922, -0.709601462, -0.694597363, 0.00755000906, 0.700135171, -0.713972449, 0.992946208, 0.0792460293, 0.0882102326) p25.CanCollide = false p25.Size = Vector3.new(0.200000003, 0.345786512, 0.341257185) p25.BackSurface = Enum.SurfaceType.SmoothNoOutlines p25.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p25.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p25.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p25.RightSurface = Enum.SurfaceType.SmoothNoOutlines p25.TopSurface = Enum.SurfaceType.SmoothNoOutlines b25 = Instance.new("BlockMesh", p25) b25.Name = "Mesh" b25.Scale = Vector3.new(0.50920862, 1, 1) p26 = Instance.new("Part", m) p26.BrickColor = BrickColor.new("Lily white") p26.Material = Enum.Material.SmoothPlastic p26.Name = "BLD" p26.CFrame = CFrame.new(158.801727, 8.90960407, 68.9055328, 0.118325025, -0.0106279431, -0.992919743, 0.00754601602, 0.999924898, -0.00980372261, 0.992947996, -0.00633254927, 0.11839661) p26.CanCollide = false p26.Size = Vector3.new(0.200000003, 0.346768677, 0.492501974) p26.BackSurface = Enum.SurfaceType.SmoothNoOutlines p26.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p26.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p26.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p26.RightSurface = Enum.SurfaceType.SmoothNoOutlines p26.TopSurface = Enum.SurfaceType.SmoothNoOutlines b26 = Instance.new("BlockMesh", p26) b26.Name = "Mesh" b26.Scale = Vector3.new(0.58933264, 1, 1) p27 = Instance.new("Part", m) p27.BrickColor = BrickColor.new("Lily white") p27.Material = Enum.Material.SmoothPlastic p27.Name = "Main" p27.CFrame = CFrame.new(158.815582, 7.5606904, 68.9103928, 0.118325055, -0.0106279459, -0.992918789, 0.0075460095, 0.999924064, -0.00980370119, 0.992947042, -0.00633254554, 0.118396379) p27.Size = Vector3.new(0.200000003, 1.93370783, 0.200000003) p27.BackSurface = Enum.SurfaceType.SmoothNoOutlines p27.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p27.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p27.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p27.RightSurface = Enum.SurfaceType.SmoothNoOutlines p27.TopSurface = Enum.SurfaceType.SmoothNoOutlines b27 = Instance.new("BlockMesh", p27) b27.Name = "Mesh" b27.Scale = Vector3.new(0.718227684, 1, 0.73399806) p28 = Instance.new("Part", m) p28.BrickColor = BrickColor.new("Lily white") p28.Material = Enum.Material.SmoothPlastic p28.Name = "BLD" p28.CFrame = CFrame.new(158.93222, 6.67016792, 68.9040375, 0.0761855617, -0.992928326, 0.0911706984, 0.712377787, -0.00977398362, -0.70173943, 0.697660565, 0.118399531, 0.706581771) p28.CanCollide = false p28.FormFactor = Enum.FormFactor.Symmetric p28.Elasticity = 0 p28.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p28.BackSurface = Enum.SurfaceType.SmoothNoOutlines p28.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p28.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p28.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p28.RightSurface = Enum.SurfaceType.SmoothNoOutlines p28.TopSurface = Enum.SurfaceType.SmoothNoOutlines b28 = Instance.new("SpecialMesh", p28) b28.MeshId = "http://www.roblox.com/Asset/?id=9756362" b28.TextureId = "" b28.MeshType = Enum.MeshType.FileMesh b28.Name = "Mesh" b28.Scale = Vector3.new(0.0979999974, 0.0979999974, 0.0979999974) p29 = Instance.new("Part", m) p29.BrickColor = BrickColor.new("Lily white") p29.Material = Enum.Material.SmoothPlastic p29.Name = "BLD" p29.CFrame = CFrame.new(158.808517, 8.45066643, 68.9044189, 0.118325025, -0.0106279431, -0.992919743, 0.00754601602, 0.999924898, -0.00980372261, 0.992947996, -0.00633254927, 0.11839661) p29.CanCollide = false p29.Size = Vector3.new(0.200000003, 0.200000003, 0.201797724) p29.BackSurface = Enum.SurfaceType.SmoothNoOutlines p29.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p29.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p29.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p29.RightSurface = Enum.SurfaceType.SmoothNoOutlines p29.TopSurface = Enum.SurfaceType.SmoothNoOutlines b29 = Instance.new("BlockMesh", p29) b29.Name = "Mesh" b29.Scale = Vector3.new(0.718227684, 0.502999544, 1) p30 = Instance.new("Part", m) p30.BrickColor = BrickColor.new("Lily white") p30.Material = Enum.Material.SmoothPlastic p30.Name = "BLD" p30.CFrame = CFrame.new(158.909317, 8.45204735, 68.8931046, 0.0761855543, -0.992928326, 0.0911706984, 0.712377965, -0.00977396779, -0.701739252, 0.697660387, 0.118399531, 0.706581891) p30.CanCollide = false p30.FormFactor = Enum.FormFactor.Symmetric p30.Elasticity = 0 p30.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p30.BackSurface = Enum.SurfaceType.SmoothNoOutlines p30.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p30.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p30.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p30.RightSurface = Enum.SurfaceType.SmoothNoOutlines p30.TopSurface = Enum.SurfaceType.SmoothNoOutlines b30 = Instance.new("SpecialMesh", p30) b30.MeshId = "http://www.roblox.com/Asset/?id=9756362" b30.TextureId = "" b30.MeshType = Enum.MeshType.FileMesh b30.Name = "Mesh" b30.Scale = Vector3.new(0.0979999974, 0.0979999974, 0.0979999974) p31 = Instance.new("Part", m) p31.BrickColor = BrickColor.new("Lily white") p31.Material = Enum.Material.SmoothPlastic p31.Name = "BLD" p31.CFrame = CFrame.new(158.708908, 8.45005894, 68.917038, 0.0761882216, -0.992918432, 0.0911584049, 0.712373853, -0.0097635109, -0.701733112, 0.697653294, 0.118402772, 0.70658499) p31.CanCollide = false p31.FormFactor = Enum.FormFactor.Symmetric p31.Elasticity = 0 p31.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p31.BackSurface = Enum.SurfaceType.SmoothNoOutlines p31.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p31.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p31.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p31.RightSurface = Enum.SurfaceType.SmoothNoOutlines p31.TopSurface = Enum.SurfaceType.SmoothNoOutlines b31 = Instance.new("SpecialMesh", p31) b31.MeshId = "http://www.roblox.com/Asset/?id=9756362" b31.TextureId = "" b31.MeshType = Enum.MeshType.FileMesh b31.Name = "Mesh" b31.Scale = Vector3.new(0.0979999974, 0.0979999974, 0.0979999974) p32 = Instance.new("Part", m) p32.BrickColor = BrickColor.new("Steel blue") p32.Material = Enum.Material.Neon p32.Name = "Ray" p32.CFrame = CFrame.new(158.769913, 11.8427038, 68.8844223, 0.118325047, -0.0106279496, -0.992918074, 0.00754600298, 0.999923468, -0.00980368629, 0.992946327, -0.00633254042, 0.118396193) p32.CanCollide = false p32.Size = Vector3.new(0.200000003, 6.09162045, 0.486118287) p32.BackSurface = Enum.SurfaceType.SmoothNoOutlines p32.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p32.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p32.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p32.RightSurface = Enum.SurfaceType.SmoothNoOutlines p32.TopSurface = Enum.SurfaceType.SmoothNoOutlines b32 = Instance.new("BlockMesh", p32) b32.Name = "Mesh" b32.Scale = Vector3.new(0.50920862, 1, 1) p33 = Instance.new("Part", m) p33.BrickColor = BrickColor.new("Lily white") p33.Material = Enum.Material.SmoothPlastic p33.Name = "BLD" p33.CFrame = CFrame.new(158.767548, 11.5664883, 68.8892365, 0.118325077, -0.0106279412, -0.992919743, 0.00754601927, 0.999924898, -0.00980372727, 0.992948472, -0.0063325502, 0.118396625) p33.CanCollide = false p33.Size = Vector3.new(0.200000003, 4.97152424, 0.234207362) p33.BackSurface = Enum.SurfaceType.SmoothNoOutlines p33.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p33.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p33.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p33.RightSurface = Enum.SurfaceType.SmoothNoOutlines p33.TopSurface = Enum.SurfaceType.SmoothNoOutlines b33 = Instance.new("BlockMesh", p33) b33.Name = "Mesh" b33.Scale = Vector3.new(0.58933264, 1, 1) p34 = Instance.new("Part", m) p34.BrickColor = BrickColor.new("Lily white") p34.Material = Enum.Material.SmoothPlastic p34.Name = "BLD" p34.CFrame = CFrame.new(158.730392, 13.741621, 68.8770142, 0.118353955, -0.992916465, 0.0106354197, 0.00756301219, -0.00980904698, -0.999924719, 0.992944539, 0.118425779, 0.00634848466) p34.CanCollide = false p34.Size = Vector3.new(0.200000003, 2.02519441, 0.234207362) p34.BackSurface = Enum.SurfaceType.SmoothNoOutlines p34.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p34.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p34.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p34.RightSurface = Enum.SurfaceType.SmoothNoOutlines p34.TopSurface = Enum.SurfaceType.SmoothNoOutlines b34 = Instance.new("BlockMesh", p34) b34.Name = "Mesh" b34.Scale = Vector3.new(0.58933264, 1, 1) p35 = Instance.new("Part", m) p35.BrickColor = BrickColor.new("Lily white") p35.Material = Enum.Material.SmoothPlastic p35.Name = "BLD" p35.CFrame = CFrame.new(158.740524, 14.0519733, 68.8734207, 0.11830803, 0.69460839, -0.70959568, 0.0075530177, 0.713964105, 0.700143576, 0.992950201, -0.0881924033, 0.0792214945) p35.CanCollide = false p35.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p35.BackSurface = Enum.SurfaceType.SmoothNoOutlines p35.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p35.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p35.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p35.RightSurface = Enum.SurfaceType.SmoothNoOutlines p35.TopSurface = Enum.SurfaceType.SmoothNoOutlines b35 = Instance.new("BlockMesh", p35) b35.Name = "Mesh" b35.Scale = Vector3.new(0.58933264, 0.815570593, 0.824843287) p36 = Instance.new("Part", m) p36.BrickColor = BrickColor.new("Lily white") p36.Material = Enum.Material.SmoothPlastic p36.Name = "BLD" p36.CFrame = CFrame.new(159.735458, 13.7529106, 68.7572479, 0.11830803, 0.69460839, -0.70959568, 0.0075530177, 0.713964105, 0.700143576, 0.992950201, -0.0881924033, 0.0792214945) p36.CanCollide = false p36.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p36.BackSurface = Enum.SurfaceType.SmoothNoOutlines p36.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p36.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p36.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p36.RightSurface = Enum.SurfaceType.SmoothNoOutlines p36.TopSurface = Enum.SurfaceType.SmoothNoOutlines b36 = Instance.new("BlockMesh", p36) b36.Name = "Mesh" b36.Scale = Vector3.new(0.58933264, 0.815570593, 0.824843287) p37 = Instance.new("Part", m) p37.BrickColor = BrickColor.new("Lily white") p37.Material = Enum.Material.SmoothPlastic p37.Name = "BLD" p37.CFrame = CFrame.new(157.725037, 13.7329903, 68.9969025, 0.11830803, 0.69460839, -0.70959568, 0.0075530177, 0.713964105, 0.700143576, 0.992950201, -0.0881924033, 0.0792214945) p37.CanCollide = false p37.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p37.BackSurface = Enum.SurfaceType.SmoothNoOutlines p37.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p37.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p37.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p37.RightSurface = Enum.SurfaceType.SmoothNoOutlines p37.TopSurface = Enum.SurfaceType.SmoothNoOutlines b37 = Instance.new("BlockMesh", p37) b37.Name = "Mesh" b37.Scale = Vector3.new(0.58933264, 0.815570593, 0.824843287) p38 = Instance.new("Part", m) p38.BrickColor = BrickColor.new("Lily white") p38.Material = Enum.Material.SmoothPlastic p38.Name = "BLD" p38.CFrame = CFrame.new(158.827896, 6.39891052, 68.9171371, 0.118325077, -0.0106279412, -0.992919743, 0.00754601927, 0.999924898, -0.00980372727, 0.992948472, -0.0063325502, 0.118396625) p38.CanCollide = false p38.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p38.BackSurface = Enum.SurfaceType.SmoothNoOutlines p38.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p38.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p38.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p38.RightSurface = Enum.SurfaceType.SmoothNoOutlines p38.TopSurface = Enum.SurfaceType.SmoothNoOutlines b38 = Instance.new("BlockMesh", p38) b38.Name = "Mesh" b38.Scale = Vector3.new(0.362895161, 0.388352871, 0.856761694) p39 = Instance.new("Part", m) p39.BrickColor = BrickColor.new("Steel blue") p39.Material = Enum.Material.Neon p39.Name = "BLD" p39.CFrame = CFrame.new(157.20462, 13.6575089, 69.0570068, 0.118300013, 0.908479631, -0.400841266, 0.00755601563, 0.402840495, 0.915240765, 0.992951155, -0.111301988, 0.0407916717) p39.CanCollide = false p39.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p39.BackSurface = Enum.SurfaceType.SmoothNoOutlines p39.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p39.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p39.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p39.RightSurface = Enum.SurfaceType.SmoothNoOutlines p39.TopSurface = Enum.SurfaceType.SmoothNoOutlines b39 = Instance.new("BlockMesh", p39) b39.Name = "Mesh" b39.Scale = Vector3.new(0.50920862, 1, 1) p40 = Instance.new("Part", m) p40.BrickColor = BrickColor.new("Steel blue") p40.Material = Enum.Material.Neon p40.Name = "BLD" p40.CFrame = CFrame.new(157.385162, 13.7107983, 69.0350876, 0.118293993, 0.979267836, -0.164452657, 0.00756201334, 0.164722264, 0.986312509, 0.99295181, -0.117918685, 0.0120804729) p40.CanCollide = false p40.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p40.BackSurface = Enum.SurfaceType.SmoothNoOutlines p40.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p40.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p40.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p40.RightSurface = Enum.SurfaceType.SmoothNoOutlines p40.TopSurface = Enum.SurfaceType.SmoothNoOutlines b40 = Instance.new("BlockMesh", p40) b40.Name = "Mesh" b40.Scale = Vector3.new(0.50920862, 1, 1) p41 = Instance.new("Part", m) p41.BrickColor = BrickColor.new("Lily white") p41.Material = Enum.Material.SmoothPlastic p41.Name = "BLD" p41.CFrame = CFrame.new(158.731781, 6.6681776, 68.9279327, 0.0761882588, -0.992918432, 0.0911583677, 0.712373495, -0.00976354349, -0.70173341, 0.697653711, 0.118402772, 0.706584513) p41.CanCollide = false p41.FormFactor = Enum.FormFactor.Symmetric p41.Elasticity = 0 p41.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p41.BackSurface = Enum.SurfaceType.SmoothNoOutlines p41.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p41.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p41.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p41.RightSurface = Enum.SurfaceType.SmoothNoOutlines p41.TopSurface = Enum.SurfaceType.SmoothNoOutlines b41 = Instance.new("SpecialMesh", p41) b41.MeshId = "http://www.roblox.com/Asset/?id=9756362" b41.TextureId = "" b41.MeshType = Enum.MeshType.FileMesh b41.Name = "Mesh" b41.Scale = Vector3.new(0.0979999974, 0.0979999974, 0.0979999974) p42 = Instance.new("Part", m) p42.BrickColor = BrickColor.new("Lily white") p42.Material = Enum.Material.SmoothPlastic p42.Name = "BLD" p42.CFrame = CFrame.new(158.83139, 6.66878939, 68.9153366, 0.118325077, -0.0106279412, -0.992919743, 0.00754601927, 0.999924898, -0.00980372727, 0.992948472, -0.0063325502, 0.118396625) p42.CanCollide = false p42.Size = Vector3.new(0.200000003, 0.200000003, 0.201797724) p42.BackSurface = Enum.SurfaceType.SmoothNoOutlines p42.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p42.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p42.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p42.RightSurface = Enum.SurfaceType.SmoothNoOutlines p42.TopSurface = Enum.SurfaceType.SmoothNoOutlines b42 = Instance.new("BlockMesh", p42) b42.Name = "Mesh" b42.Scale = Vector3.new(0.718227684, 0.502999544, 1) p43 = Instance.new("Part", m) p43.BrickColor = BrickColor.new("Lily white") p43.Material = Enum.Material.SmoothPlastic p43.Name = "BLD" p43.CFrame = CFrame.new(158.801743, 8.72985172, 68.9037323, 0.118325077, -0.0106279412, -0.992919743, 0.00754601927, 0.999924898, -0.00980372727, 0.992948472, -0.0063325502, 0.118396625) p43.CanCollide = false p43.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p43.BackSurface = Enum.SurfaceType.SmoothNoOutlines p43.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p43.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p43.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p43.RightSurface = Enum.SurfaceType.SmoothNoOutlines p43.TopSurface = Enum.SurfaceType.SmoothNoOutlines b43 = Instance.new("BlockMesh", p43) b43.Name = "Mesh" b43.Scale = Vector3.new(0.648554683, 0.687896371, 0.684892654) p44 = Instance.new("Part", m) p44.BrickColor = BrickColor.new("Lily white") p44.Material = Enum.Material.SmoothPlastic p44.Name = "BLD" p44.CFrame = CFrame.new(158.801895, 8.74922943, 68.9028854, 0.118325077, -0.0106279412, -0.992919743, 0.00754601927, 0.999924898, -0.00980372727, 0.992948472, -0.0063325502, 0.118396625) p44.CanCollide = false p44.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p44.BackSurface = Enum.SurfaceType.SmoothNoOutlines p44.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p44.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p44.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p44.RightSurface = Enum.SurfaceType.SmoothNoOutlines p44.TopSurface = Enum.SurfaceType.SmoothNoOutlines b44 = Instance.new("BlockMesh", p44) b44.Name = "Mesh" b44.Scale = Vector3.new(0.718227684, 0.665798903, 0.73399806) p45 = Instance.new("Part", m) p45.BrickColor = BrickColor.new("Steel blue") p45.Material = Enum.Material.Neon p45.Name = "BLD" p45.CFrame = CFrame.new(158.801086, 8.72885609, 68.9045486, 0.118325077, -0.0106279412, -0.992919743, 0.00754601927, 0.999924898, -0.00980372727, 0.992948472, -0.0063325502, 0.118396625) p45.CanCollide = false p45.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p45.BackSurface = Enum.SurfaceType.SmoothNoOutlines p45.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p45.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p45.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p45.RightSurface = Enum.SurfaceType.SmoothNoOutlines p45.TopSurface = Enum.SurfaceType.SmoothNoOutlines b45 = Instance.new("BlockMesh", p45) b45.Name = "Mesh" b45.Scale = Vector3.new(0.557979703, 0.75173372, 0.633331835) p46 = Instance.new("WedgePart", m) p46.BrickColor = BrickColor.new("Lily white") p46.Material = Enum.Material.SmoothPlastic p46.Name = "BLD" p46.CFrame = CFrame.new(158.917816, 8.71354866, 68.8893967, 0.118293978, 0.992923558, -0.0106371325, 0.00756401243, 0.00981103629, 0.999924839, 0.992951691, -0.118365817, -0.00634988584) p46.CanCollide = false p46.FormFactor = Enum.FormFactor.Symmetric p46.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p46.BackSurface = Enum.SurfaceType.SmoothNoOutlines p46.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p46.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p46.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p46.RightSurface = Enum.SurfaceType.SmoothNoOutlines p46.TopSurface = Enum.SurfaceType.SmoothNoOutlines b46 = Instance.new("SpecialMesh", p46) b46.MeshType = Enum.MeshType.Wedge b46.Name = "Mesh" b46.Scale = Vector3.new(0.627057493, 0.434583604, 0.228340343) p47 = Instance.new("Part", m) p47.BrickColor = BrickColor.new("Lily white") p47.Material = Enum.Material.SmoothPlastic p47.Name = "BLD" p47.CFrame = CFrame.new(158.807114, 8.77627563, 68.9024124, 0.118325077, -0.0106279412, -0.992919743, 0.00754601927, 0.999924898, -0.00980372727, 0.992948472, -0.0063325502, 0.118396625) p47.CanCollide = false p47.Size = Vector3.new(0.200000003, 0.200000003, 0.559285402) p47.BackSurface = Enum.SurfaceType.SmoothNoOutlines p47.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p47.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p47.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p47.RightSurface = Enum.SurfaceType.SmoothNoOutlines p47.TopSurface = Enum.SurfaceType.SmoothNoOutlines b47 = Instance.new("BlockMesh", p47) b47.Name = "Mesh" b47.Scale = Vector3.new(0.254901916, 0.542615652, 1) p48 = Instance.new("Part", m) p48.BrickColor = BrickColor.new("Lily white") p48.Material = Enum.Material.SmoothPlastic p48.Name = "BLD" p48.CFrame = CFrame.new(158.80629, 8.78682137, 68.9031525, 0.118325077, -0.0106279412, -0.992919743, 0.00754601927, 0.999924898, -0.00980372727, 0.992948472, -0.0063325502, 0.118396625) p48.CanCollide = false p48.Size = Vector3.new(0.200000003, 0.200000003, 0.505760431) p48.BackSurface = Enum.SurfaceType.SmoothNoOutlines p48.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p48.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p48.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p48.RightSurface = Enum.SurfaceType.SmoothNoOutlines p48.TopSurface = Enum.SurfaceType.SmoothNoOutlines b48 = Instance.new("BlockMesh", p48) b48.Name = "Mesh" b48.Scale = Vector3.new(0.847122908, 0.506206095, 1) p49 = Instance.new("Part", m) p49.BrickColor = BrickColor.new("Steel blue") p49.Material = Enum.Material.Neon p49.Name = "BLD" p49.CFrame = CFrame.new(156.942291, 13.4255161, 69.0900345, 0.118310012, 0.529906094, -0.839765429, 0.00755101535, 0.845200121, 0.534399152, 0.992949963, -0.0695659742, 0.0959945396) p49.CanCollide = false p49.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p49.BackSurface = Enum.SurfaceType.SmoothNoOutlines p49.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p49.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p49.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p49.RightSurface = Enum.SurfaceType.SmoothNoOutlines p49.TopSurface = Enum.SurfaceType.SmoothNoOutlines b49 = Instance.new("BlockMesh", p49) b49.Name = "Mesh" b49.Scale = Vector3.new(0.50920862, 1, 1) p50 = Instance.new("Part", m) p50.BrickColor = BrickColor.new("Steel blue") p50.Material = Enum.Material.Neon p50.Name = "BLD" p50.CFrame = CFrame.new(157.057526, 13.5612326, 69.0752792, 0.118307047, 0.747301638, -0.653871238, 0.00755501771, 0.657799125, 0.753157496, 0.99295032, -0.094044067, 0.0721765757) p50.CanCollide = false p50.Size = Vector3.new(0.200000003, 0.254450023, 0.486118287) p50.BackSurface = Enum.SurfaceType.SmoothNoOutlines p50.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p50.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p50.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p50.RightSurface = Enum.SurfaceType.SmoothNoOutlines p50.TopSurface = Enum.SurfaceType.SmoothNoOutlines b50 = Instance.new("BlockMesh", p50) b50.Name = "Mesh" b50.Scale = Vector3.new(0.50920862, 1, 1) p51 = Instance.new("Part", m) p51.BrickColor = BrickColor.new("Steel blue") p51.Material = Enum.Material.Neon p51.Name = "BLD" p51.CFrame = CFrame.new(158.826889, 6.39547873, 68.9193802, 0.118325077, -0.0106279412, -0.992919743, 0.00754601927, 0.999924898, -0.00980372727, 0.992948472, -0.0063325502, 0.118396625) p51.CanCollide = false p51.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p51.BackSurface = Enum.SurfaceType.SmoothNoOutlines p51.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p51.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p51.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p51.RightSurface = Enum.SurfaceType.SmoothNoOutlines p51.TopSurface = Enum.SurfaceType.SmoothNoOutlines b51 = Instance.new("BlockMesh", p51) b51.Name = "Mesh" b51.Scale = Vector3.new(0.557979703, 0.75173372, 0.633331835) p52 = Instance.new("WedgePart", m) p52.BrickColor = BrickColor.new("Lily white") p52.Material = Enum.Material.SmoothPlastic p52.Name = "BLD" p52.CFrame = CFrame.new(158.686249, 8.71128845, 68.9170303, -0.118353955, -0.99291575, -0.0106989676, -0.00756301219, -0.00987304188, 0.999924242, -0.992944539, 0.118426189, -0.00634090649) p52.CanCollide = false p52.FormFactor = Enum.FormFactor.Symmetric p52.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) p52.BackSurface = Enum.SurfaceType.SmoothNoOutlines p52.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p52.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p52.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p52.RightSurface = Enum.SurfaceType.SmoothNoOutlines p52.TopSurface = Enum.SurfaceType.SmoothNoOutlines b52 = Instance.new("SpecialMesh", p52) b52.MeshType = Enum.MeshType.Wedge b52.Name = "Mesh" b52.Scale = Vector3.new(0.627057493, 0.434583604, 0.228340343) p53 = Instance.new("Part", m) p53.BrickColor = BrickColor.new("Steel blue") p53.Material = Enum.Material.Neon p53.Name = "BLD" p53.CFrame = CFrame.new(158.743073, 13.739521, 68.873085, 0.118293978, 0.992923558, -0.0106371325, 0.00756401243, 0.00981103629, 0.999924839, 0.992951691, -0.118365817, -0.00634988584) p53.CanCollide = false p53.Size = Vector3.new(0.200000003, 2.56731892, 0.486118287) p53.BackSurface = Enum.SurfaceType.SmoothNoOutlines p53.BottomSurface = Enum.SurfaceType.SmoothNoOutlines p53.FrontSurface = Enum.SurfaceType.SmoothNoOutlines p53.LeftSurface = Enum.SurfaceType.SmoothNoOutlines p53.RightSurface = Enum.SurfaceType.SmoothNoOutlines p53.TopSurface = Enum.SurfaceType.SmoothNoOutlines b53 = Instance.new("BlockMesh", p53) b53.Name = "Mesh" b53.Scale = Vector3.new(0.50920862, 1, 1) w1 = Instance.new("Weld", p27) w1.Name = "Handle1" w1.Part0 = p27 w1.C0 = CFrame.new(0.000709533691, -0.000243186951, 0.000946044922, 1.00000072, 9.31322575e-10, 5.21540642e-08, 9.31322575e-10, 1.00000024, -5.58793545e-09, 5.21540642e-08, -5.52972779e-09, 1.00000024) w1.Part1 = p1 w1.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w2 = Instance.new("Weld", p27) w2.Name = "Handle2" w2.Part0 = p27 w2.C0 = CFrame.new(0.00140380859, -0.000975608826, 0.00172424316, 1.00000072, 9.31322575e-10, 5.21540642e-08, 9.31322575e-10, 1.00000024, -5.58793545e-09, 5.21540642e-08, -5.52972779e-09, 1.00000024) w2.Part1 = p2 w2.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w3 = Instance.new("Weld", p27) w3.Name = "Blade" w3.Part0 = p27 w3.C0 = CFrame.new(0, 5.51854897, 1.89195251, -1.00000036, 2.93627381e-05, -1.670653e-05, -1.67097896e-05, -6.95463386e-05, 1.00000036, 2.925843e-05, 1.00000036, 6.95349881e-05) w3.Part1 = p3 w3.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w4 = Instance.new("Weld", p27) w4.Name = "Blade" w4.Part0 = p27 w4.C0 = CFrame.new(0.00106811523, 4.57743835, 1.46974182, 1.00000048, 3.86685133e-06, -1.54301524e-05, 5.14695421e-06, 0.839943171, 0.54267472, 1.51395798e-05, -0.542674839, 0.839943349) w4.Part1 = p4 w4.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w5 = Instance.new("Weld", p27) w5.Name = "Blade" w5.Part0 = p27 w5.C0 = CFrame.new(0.00116729736, 4.57752132, -1.41996765, -1.00000072, 3.88547778e-06, -9.53674316e-06, -1.90036371e-06, 0.839946151, 0.542670369, 9.99867916e-06, 0.542670369, -0.83994621) w5.Part1 = p5 w5.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w6 = Instance.new("Weld", p27) w6.Name = "Blade" w6.Part0 = p27 w6.C0 = CFrame.new(0.00105285645, 4.71198559, 1.35224915, 1.00000048, 7.68899918e-06, -1.8671155e-05, 9.17818397e-06, 0.650401175, 0.759591222, 1.80751085e-05, -0.75959152, 0.650401294) w6.Part1 = p6 w6.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w7 = Instance.new("Weld", p27) w7.Name = "Handle1" w7.Part0 = p27 w7.C0 = CFrame.new(0.00352478027, 4.87578297, 0.00973510742, 1.00000036, 2.93403864e-05, 1.6707927e-05, 1.67097896e-05, -5.54521102e-06, -1.00000024, -2.925843e-05, 1.00000048, -5.53508289e-06) w7.Part1 = p7 w7.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w8 = Instance.new("Weld", p27) w8.Name = "Blade" w8.Part0 = p27 w8.C0 = CFrame.new(0.000114440918, 4.21279812, 1.53791809, -1.00000036, 2.93627381e-05, -1.670653e-05, -1.67097896e-05, -6.95463386e-05, 1.00000036, 2.925843e-05, 1.00000036, 6.95349881e-05) w8.Part1 = p8 w8.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w9 = Instance.new("Weld", p27) w9.Name = "Blade" w9.Part0 = p27 w9.C0 = CFrame.new(0.00215148926, 4.212924, -1.4881897, 1.00000036, 3.10391188e-05, -1.83014199e-05, 1.83028169e-05, 7.07939034e-06, 1.00000036, 3.11434269e-05, -1.00000048, 7.06792343e-06) w9.Part1 = p9 w9.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w10 = Instance.new("Weld", p27) w10.Name = "Handle1" w10.Part0 = p27 w10.C0 = CFrame.new(0.00354766846, 4.87722778, -0.707855225, 1.00000048, 6.95884228e-06, -1.70990825e-05, 7.16885552e-06, 0.707084835, 0.707129061, 1.71065331e-05, -0.70712924, 0.707084954) w10.Part1 = p10 w10.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w11 = Instance.new("Weld", p27) w11.Name = "Blade" w11.Part0 = p27 w11.C0 = CFrame.new(0.00106811523, 4.85843468, -0.970901489, -1.0000006, 2.50265002e-05, -1.68140978e-05, -1.27311796e-05, 0.155042872, 0.987908125, 2.72244215e-05, 0.987908304, -0.155042902) w11.Part1 = p11 w11.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w12 = Instance.new("Weld", p27) w12.Name = "Blade" w12.Part0 = p27 w12.C0 = CFrame.new(0.00114440918, 4.71208, -1.30250549, -1.00000048, 9.14186239e-06, -1.42306089e-05, -4.84287739e-06, 0.650422513, 0.759572983, 1.61081553e-05, 0.759573102, -0.650422573) w12.Part1 = p12 w12.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w13 = Instance.new("Weld", p27) w13.Name = "Blade" w13.Part0 = p27 w13.C0 = CFrame.new(0.00104522705, 4.85837078, 1.0206604, 1.00000048, 2.81631947e-05, -2.0920299e-05, 1.6302336e-05, 0.155048564, 0.987907231, 3.11657786e-05, -0.987907231, 0.155048579) w13.Part1 = p13 w13.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w14 = Instance.new("Weld", p27) w14.Name = "Blade" w14.Part0 = p27 w14.C0 = CFrame.new(0.00108337402, 4.80687332, -1.15335083, -1.0000006, 1.72033906e-05, -1.90958381e-05, -1.07740052e-05, 0.393840313, 0.919179142, 2.3253262e-05, 0.919179261, -0.393840432) w14.Part1 = p14 w14.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w15 = Instance.new("Weld", p27) w15.Name = "Blade" w15.Part0 = p27 w15.C0 = CFrame.new(0.00105285645, 4.80676365, 1.20314026, 1.00000048, 1.89840794e-05, -1.92858279e-05, 1.02454796e-05, 0.393858731, 0.919171393, 2.51531601e-05, -0.919171453, 0.393858761) w15.Part1 = p15 w15.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w16 = Instance.new("Weld", p27) w16.Name = "Blade" w16.Part0 = p27 w16.C0 = CFrame.new(0.00108337402, 4.87358475, 0.021270752, 1.00000036, 3.10391188e-05, -1.83014199e-05, 1.83028169e-05, 7.07939034e-06, 1.00000036, 3.11434269e-05, -1.00000048, 7.06792343e-06) w16.Part1 = p16 w16.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w17 = Instance.new("Weld", p27) w17.Name = "Handle1" w17.Part0 = p27 w17.C0 = CFrame.new(0.0034866333, 4.8771739, 0.727615356, 1.00000072, 6.92158937e-06, -1.70618296e-05, 7.16745853e-06, 0.707085252, 0.707129538, 1.719594e-05, -0.707129717, 0.707085311) w17.Part1 = p17 w17.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w18 = Instance.new("Weld", p27) w18.Name = "Blade" w18.Part0 = p27 w18.C0 = CFrame.new(0.00106811523, 6.11264467, -1.53588867, -1.00000083, 1.72555447e-05, -1.91256404e-05, -1.07744709e-05, 0.393840581, 0.919179738, 2.31638551e-05, 0.919179857, -0.3938407) w18.Part1 = p18 w18.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w19 = Instance.new("Weld", p27) w19.Name = "Blade" w19.Part0 = p27 w19.C0 = CFrame.new(0.00100708008, 6.1641469, -1.35345459, -1.00000083, 2.5101006e-05, -1.6823411e-05, -1.27311796e-05, 0.155042946, 0.987908781, 2.71350145e-05, 0.9879089, -0.155043021) w19.Part1 = p19 w19.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w20 = Instance.new("Weld", p27) w20.Name = "Blade" w20.Part0 = p27 w20.C0 = CFrame.new(0.00105285645, 5.88328886, -1.80262756, -1.00000095, 3.91155481e-06, -9.57399607e-06, -1.89943239e-06, 0.839946806, 0.542670667, 9.91672277e-06, 0.542670727, -0.839946747) w20.Part1 = p20 w20.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w21 = Instance.new("Weld", p27) w21.Name = "Blade" w21.Part0 = p27 w21.C0 = CFrame.new(0.00206756592, 5.51869154, -1.8707428, 1.00000072, 3.09795141e-05, -1.83000229e-05, 1.83028169e-05, 7.08643347e-06, 1.00000095, 3.12253833e-05, -1.00000107, 7.06332503e-06) w21.Part1 = p21 w21.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w22 = Instance.new("Weld", p27) w22.Name = "Blade" w22.Part0 = p27 w22.C0 = CFrame.new(0.00104522705, 6.01782465, -1.68502808, -1.00000072, 9.20146704e-06, -1.42678618e-05, -4.84287739e-06, 0.650422931, 0.75957346, 1.60336494e-05, 0.759573638, -0.65042299) w22.Part1 = p22 w22.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w23 = Instance.new("Weld", p27) w23.Name = "Handle1" w23.Part0 = p27 w23.C0 = CFrame.new(7.62939453e-05, -1.16082907, 0, 1.00000095, 2.79396772e-09, 1.1920929e-07, 9.31322575e-10, 1.00000083, -1.26310624e-08, 1.41561031e-07, -1.19907781e-08, 1.00000095) w23.Part1 = p23 w23.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w24 = Instance.new("Weld", p27) w24.Name = "Handle1" w24.Part0 = p27 w24.C0 = CFrame.new(0.000732421875, -1.16431618, 0.000473022461, 1.00000095, 2.79396772e-09, 1.1920929e-07, 9.31322575e-10, 1.00000083, -1.26310624e-08, 1.41561031e-07, -1.19907781e-08, 1.00000095) w24.Part1 = p24 w24.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w25 = Instance.new("Weld", p27) w25.Name = "Blade" w25.Part0 = p27 w25.C0 = CFrame.new(0.000915527344, 7.33072329, 0.00132751465, 1.00000072, 6.57886267e-06, 1.20475888e-05, 3.86778265e-06, 0.707120955, -0.707093894, -1.29193068e-05, 0.707094073, 0.707121015) w25.Part1 = p25 w25.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w26 = Instance.new("Weld", p27) w26.Name = "Handle1" w26.Part0 = p27 w26.C0 = CFrame.new(0.00371551514, 1.34898758, -4.57763672e-05, 1.00000095, 2.79396772e-09, 1.1920929e-07, 9.31322575e-10, 1.00000083, -1.26310624e-08, 1.41561031e-07, -1.19907781e-08, 1.00000095) w26.Part1 = p26 w26.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w27 = Instance.new("Weld", p27) w27.Name = "Handle1" w27.Part0 = p27 w27.C0 = CFrame.new(0.000770568848, -0.891653061, -0.107833862, 0.70712918, 2.22027302e-06, 0.707089603, 0.707095206, 2.97963852e-05, -0.707128704, -2.96384096e-05, 1.00000954, 1.11237168e-05) w27.Part1 = p28 w27.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w28 = Instance.new("Weld", p27) w28.Name = "Handle" w28.Part0 = p27 w28.C0 = CFrame.new(-5.34057617e-05, 0.89002037, -0.00241088867, 1.00000095, 2.79396772e-09, 1.1920929e-07, 9.31322575e-10, 1.00000083, -1.26310624e-08, 1.41561031e-07, -1.19907781e-08, 1.00000095) w28.Part1 = p29 w28.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w29 = Instance.new("Weld", p27) w29.Name = "Handle1" w29.Part0 = p27 w29.C0 = CFrame.new(0.000648498535, 0.890401363, -0.103851318, 0.707129002, 2.22027302e-06, 0.707089722, 0.707095385, 2.98122177e-05, -0.707128525, -2.96533108e-05, 1.00000954, 1.1138618e-05) w29.Part1 = p30 w29.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w30 = Instance.new("Weld", p27) w30.Name = "Handle1" w30.Part0 = p27 w30.C0 = CFrame.new(0.000686645508, 0.89039135, 0.0979919434, 0.707122207, 6.69282372e-06, 0.707091391, 0.707091331, 4.01428624e-05, -0.707122266, -3.31173142e-05, 1, 2.36534725e-05) w30.Part1 = p31 w30.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w31 = Instance.new("Weld", p27) w31.Name = "Blade" w31.Part0 = p27 w31.C0 = CFrame.new(0.001121521, 4.2823329, 0.000289916992, 1.00000072, 1.86264515e-09, 7.4505806e-08, 0, 1.0000006, -1.03609636e-08, 1.04308128e-07, -8.09086487e-09, 1.00000072) w31.Part1 = p32 w31.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w32 = Instance.new("Weld", p27) w32.Name = "Handle1" w32.Part0 = p27 w32.C0 = CFrame.new(0.00354003906, 4.00613403, 0.00592041016, 1.00000143, 2.32830644e-09, 1.34110451e-07, 4.65661287e-10, 1.00000083, -1.74040906e-08, 1.49011612e-07, -1.3911631e-08, 1.00000095) w32.Part1 = p33 w32.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w33 = Instance.new("Weld", p27) w33.Name = "Handle1" w33.Part0 = p27 w33.C0 = CFrame.new(0.00341796875, 6.18157005, 0.02003479, 1.00000107, 2.94297934e-05, 1.67060643e-05, 1.67102553e-05, -5.55609586e-06, -1.00000083, -2.91615725e-05, 1.00000119, -5.5267592e-06) w33.Part1 = p34 w33.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w34 = Instance.new("Weld", p27) w34.Name = "Handle1" w34.Part0 = p27 w34.C0 = CFrame.new(0.00338745117, 6.49181366, 0.00651550293, 1.00000119, 6.89923763e-06, -1.70469284e-05, 7.16838986e-06, 0.707085252, 0.707129478, 1.72108412e-05, -0.707129776, 0.707085371) w34.Part1 = p35 w34.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w35 = Instance.new("Weld", p27) w35.Name = "Handle1" w35.Part0 = p27 w35.C0 = CFrame.new(0.00350952148, 6.18293571, -0.992202759, 1.00000119, 6.89923763e-06, -1.70469284e-05, 7.16838986e-06, 0.707085252, 0.707129478, 1.72108412e-05, -0.707129776, 0.707085371) w35.Part1 = p36 w35.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w36 = Instance.new("Weld", p27) w36.Name = "Handle1" w36.Part0 = p27 w36.C0 = CFrame.new(0.00344085693, 6.1828661, 1.032547, 1.00000119, 6.89923763e-06, -1.70469284e-05, 7.16838986e-06, 0.707085252, 0.707129478, 1.72108412e-05, -0.707129776, 0.707085371) w36.Part1 = p37 w36.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w37 = Instance.new("Weld", p27) w37.Name = "Handle1" w37.Part0 = p27 w37.C0 = CFrame.new(-0.000610351563, -1.1618638, -4.57763672e-05, 1.00000143, 2.32830644e-09, 1.34110451e-07, 4.65661287e-10, 1.00000083, -1.74040906e-08, 1.49011612e-07, -1.3911631e-08, 1.00000095) w37.Part1 = p38 w37.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w38 = Instance.new("Weld", p27) w38.Name = "Blade" w38.Part0 = p27 w38.C0 = CFrame.new(0.000968933105, 6.1125412, 1.55714417, 1.00000119, 1.89244747e-05, -1.92523003e-05, 1.02459453e-05, 0.393858969, 0.919171929, 2.52500176e-05, -0.919172108, 0.393859059) w38.Part1 = p39 w38.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w39 = Instance.new("Weld", p27) w39.Name = "Blade" w39.Part0 = p27 w39.C0 = CFrame.new(0.000968933105, 6.16404724, 1.37475586, 1.00000119, 2.80886889e-05, -2.09063292e-05, 1.63028017e-05, 0.155048668, 0.987907767, 3.12551856e-05, -0.987907946, 0.155048683) w39.Part1 = p40 w39.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w40 = Instance.new("Weld", p27) w40.Name = "Handle1" w40.Part0 = p27 w40.C0 = CFrame.new(0.000762939453, -0.891664505, 0.094039917, 0.707122624, 6.69388146e-06, 0.707090914, 0.707090974, 4.01102079e-05, -0.707122564, -3.30949588e-05, 1, 2.3629651e-05) w40.Part1 = p41 w40.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w41 = Instance.new("Weld", p27) w41.Name = "Handle" w41.Part0 = p27 w41.C0 = CFrame.new(4.57763672e-05, -0.89203167, -0.00636291504, 1.00000143, 2.32830644e-09, 1.34110451e-07, 4.65661287e-10, 1.00000083, -1.74040906e-08, 1.49011612e-07, -1.3911631e-08, 1.00000095) w41.Part1 = p42 w41.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w42 = Instance.new("Weld", p27) w42.Name = "Handle1" w42.Part0 = p27 w42.C0 = CFrame.new(0.00057220459, 1.1692605, 0.00149536133, 1.00000143, 2.32830644e-09, 1.34110451e-07, 4.65661287e-10, 1.00000083, -1.74040906e-08, 1.49011612e-07, -1.3911631e-08, 1.00000095) w42.Part1 = p43 w42.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w43 = Instance.new("Weld", p27) w43.Name = "Handle1" w43.Part0 = p27 w43.C0 = CFrame.new(-0.000106811523, 1.18864012, 0.00105285645, 1.00000143, 2.32830644e-09, 1.34110451e-07, 4.65661287e-10, 1.00000083, -1.74040906e-08, 1.49011612e-07, -1.3911631e-08, 1.00000095) w43.Part1 = p44 w43.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w44 = Instance.new("Weld", p27) w44.Name = "Handle2" w44.Part0 = p27 w44.C0 = CFrame.new(0.00129699707, 1.16826677, 0.00224304199, 1.00000143, 2.32830644e-09, 1.34110451e-07, 4.65661287e-10, 1.00000083, -1.74040906e-08, 1.49011612e-07, -1.3911631e-08, 1.00000095) w44.Part1 = p45 w44.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w45 = Instance.new("Weld", p27) w45.Name = "Handle1" w45.Part0 = p27 w45.C0 = CFrame.new(-5.34057617e-05, 1.15181541, -0.11529541, 1.00000107, 3.0964613e-05, -1.82990916e-05, 1.83028169e-05, 7.09027518e-06, 1.00000095, 3.12328339e-05, -1.00000119, 7.06140418e-06) w45.Part1 = p46 w45.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w46 = Instance.new("Weld", p27) w46.Name = "Handle1" w46.Part0 = p27 w46.C0 = CFrame.new(0.000244140625, 1.21563244, -0.00445556641, 1.00000143, 2.32830644e-09, 1.34110451e-07, 4.65661287e-10, 1.00000083, -1.74040906e-08, 1.49011612e-07, -1.3911631e-08, 1.00000095) w46.Part1 = p47 w46.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w47 = Instance.new("Weld", p27) w47.Name = "Handle1" w47.Part0 = p27 w47.C0 = CFrame.new(0.000961303711, 1.22618103, -0.00364685059, 1.00000143, 2.32830644e-09, 1.34110451e-07, 4.65661287e-10, 1.00000083, -1.74040906e-08, 1.49011612e-07, -1.3911631e-08, 1.00000095) w47.Part1 = p48 w47.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w48 = Instance.new("Weld", p27) w48.Name = "Blade" w48.Part0 = p27 w48.C0 = CFrame.new(0.0009765625, 5.88314533, 1.8237915, 1.00000119, 3.82214785e-06, -1.53705478e-05, 5.14695421e-06, 0.839943647, 0.542675018, 1.52364373e-05, -0.542675316, 0.839943945) w48.Part1 = p49 w48.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w49 = Instance.new("Weld", p27) w49.Name = "Blade" w49.Part0 = p27 w49.C0 = CFrame.new(0.000984191895, 6.01771927, 1.70629883, 1.00000119, 7.62939453e-06, -1.86190009e-05, 9.17818397e-06, 0.650401652, 0.759591639, 1.81794167e-05, -0.759591997, 0.650401771) w49.Part1 = p50 w49.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w50 = Instance.new("Weld", p27) w50.Name = "Handle2" w50.Part0 = p27 w50.C0 = CFrame.new(0.00146484375, -1.16529894, 0.00126647949, 1.00000143, 2.32830644e-09, 1.34110451e-07, 4.65661287e-10, 1.00000083, -1.74040906e-08, 1.49011612e-07, -1.3911631e-08, 1.00000095) w50.Part1 = p51 w50.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w51 = Instance.new("Weld", p27) w51.Name = "Handle1" w51.Part0 = p27 w51.C0 = CFrame.new(-3.05175781e-05, 1.15184164, 0.117919922, -1.00000107, 2.94372439e-05, -1.67046674e-05, -1.67102553e-05, -6.95563504e-05, 1.00000095, 2.91615725e-05, 1.00000119, 6.95275958e-05) w51.Part1 = p52 w51.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) w52 = Instance.new("Weld", p27) w52.Name = "Blade" w52.Part0 = p27 w52.C0 = CFrame.new(0.000999450684, 6.17936039, 0.00700378418, 1.00000107, 3.0964613e-05, -1.82990916e-05, 1.83028169e-05, 7.09027518e-06, 1.00000095, 3.12328339e-05, -1.00000119, 7.06140418e-06) w52.Part1 = p53 w52.C1 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) m.Parent = char m:MakeJoints() local tr = char:WaitForChild("Torso") local lr = char:WaitForChild("Left Arm") local ra = char:WaitForChild("Right Arm") local s1 = Instance.new("Sound", char.Head) s1.Volume = 1 s1.SoundId = "rbxassetid://419372077" s1.Pitch = 1 local s2 = Instance.new("Sound", char.Head) s2.Volume = 1 s2.SoundId = "rbxassetid://419378177" local s3 = Instance.new("Sound", char.Head) s3.Volume = 1 s3.SoundId = "rbxassetid://419378177" local s4 = Instance.new("Sound", char.Head) s4.Volume = 1 s4.SoundId = "rbxassetid://320557518" local s5 = Instance.new("Sound", char.Head) s5.Volume = 1 s5.SoundId = "rbxassetid://320557537" local s6 = Instance.new("Sound", char.Head) s6.Volume = 1 s6.SoundId = "rbxassetid://433087655" local s7 = Instance.new("Sound", char.Head) s7.Volume = 1 s7.SoundId = "rbxassetid://338586299" local s8 = Instance.new("Sound", char.Head) s8.Volume = 1 s8.SoundId = "rbxassetid://338586318" local s9 = Instance.new("Sound", char.Head) s9.Volume = 1 s9.SoundId = "rbxassetid://338586331" local w3 = Instance.new("Weld", char) run = game:GetService("RunService") w3.Part0 = lr w3.Part1 = tr w3.C0 = CFrame.new(1.5, 0, 0) local w4 = Instance.new("Weld", char) w4.Part0 = ra w4.Part1 = tr w4.C0 = CFrame.new(-1.5, 0, 0) local nc = Instance.new("Weld", char) nc.Part0 = char.Torso nc.Part1 = char.Head nc.C0 = CFrame.new(0, 1.5, 0) local ll = Instance.new("Weld", char) ll.Part0 = char.Torso ll.Part1 = char["Left Leg"] ll.C0 = CFrame.new(-0.5, -2, 0) local rl = Instance.new("Weld", char) rl.Part0 = char.Torso rl.Part1 = char["Right Leg"] rl.C0 = CFrame.new(0.5, -2, 0) local ts = Instance.new("Weld", char) ts.Part0 = char.HumanoidRootPart ts.Part1 = char.Torso ts.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0) SWELD = Instance.new("Weld", char) SWELD.Part0 = char["Right Arm"] SWELD.Part1 = p27 turnonwelds = function() w3.Part1 = tr w4.Part1 = tr nc.Part1 = char.Head ll.Part1 = char["Left Leg"] rl.Part1 = char["Right Leg"] end turnoffwelds = function() w3.Part1 = nil w4.Part1 = nil nc.Part1 = nil ll.Part1 = nil rl.Part1 = nil end turnoffwelds() local walk = {ll.C0 * CFrame.new(0, 0, -0.5) * CFrame.Angles(math.rad(45), math.rad(0), math.rad(0)), rl.C0 * CFrame.new(0, 0, 0.5) * CFrame.Angles(math.rad(-45), math.rad(0), math.rad(0)), ll.C0 * CFrame.new(0, 0, 0.5) * CFrame.Angles(math.rad(-45), math.rad(0), math.rad(0)), rl.C0 * CFrame.new(0, 0, -0.5) * CFrame.Angles(math.rad(45), math.rad(0), math.rad(0)), ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-15), math.rad(0), math.rad(0)), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(5), math.rad(0), math.rad(0)), w4.C0 * CFrame.new(0, 0.4, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-20)), w3.C0 * CFrame.new(0, 0.4, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(20))} local equip = {nc.C0 * CFrame.Angles(math.rad(-10), math.rad(0), 0), w3.C0 * CFrame.new(-1.1, -0.1, -1.2) * CFrame.Angles(math.rad(-160), 0, math.rad(90)), w4.C0 * CFrame.new(1.1, -0.2, -1.2) * CFrame.Angles(math.rad(-160), 0, math.rad(-90))} local idle = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(-30), 0), nc.C0 * CFrame.Angles(0, math.rad(25), 0), ll.C0 * CFrame.new(-0.1, 0, -0.1) * CFrame.Angles(math.rad(5), math.rad(20), math.rad(0)), rl.C0 * CFrame.new(0.2, 0, 0) * CFrame.Angles(math.rad(0), math.rad(5), math.rad(5)), w3.C0 * CFrame.new(0, 0.2, 0) * CFrame.Angles(math.rad(0), math.rad(-5), math.rad(10)), w4.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(10), math.rad(-5))} local PA1 = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(30), math.rad(0)), ll.C0 * CFrame.new(-0.1, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-5)), rl.C0 * CFrame.new(0.1, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(5)), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(-30), math.rad(0)), w3.C0 * CFrame.new(0, 0.1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(8)), w4.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(190), math.rad(-50), math.rad(-70))} local PA1B = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(20), math.rad(0)), ll.C0 * CFrame.new(-0.1, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-5)), rl.C0 * CFrame.new(0.1, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(5)), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), w3.C0 * CFrame.new(0, 0.1, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(8)), w4.C0 * CFrame.new(1, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-90))} local PA21 = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-10), math.rad(0), 0), ll.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(0)), rl.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(0)), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-5), math.rad(0), 0), w3.C0 * CFrame.new(-0.5, 0, 0) * CFrame.Angles(math.rad(-60), math.rad(40), math.rad(0)), w4.C0 * CFrame.new(0.5, 0, 0) * CFrame.Angles(math.rad(-60), math.rad(-40), math.rad(0))} local PA2 = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(90), 0), ll.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(10), math.rad(-5)), rl.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(-10), math.rad(5)), nc.C0 * CFrame.Angles(math.rad(0), math.rad(-90), 0), w4.C0 * CFrame.new(1, 2, 0) * CFrame.Angles(math.rad(0), 0, math.rad(-90)), w3.C0 * CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), 0, math.rad(40))} local SK2 = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(90), 0), ll.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(10), math.rad(-5)), rl.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(-10), math.rad(5)), nc.C0 * CFrame.Angles(math.rad(0), math.rad(-90), 0), w4.C0 * CFrame.new(1, 2, 0) * CFrame.Angles(math.rad(0), 0, math.rad(-90)), w3.C0 * CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(0), 0, math.rad(40))} local SK3 = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(-30), 0), ll.C0 * CFrame.new(-0.1, 0, -0.1) * CFrame.Angles(math.rad(5), math.rad(20), math.rad(0)), rl.C0 * CFrame.new(0.2, 0, 0) * CFrame.Angles(math.rad(0), math.rad(5), math.rad(5)), nc.C0 * CFrame.Angles(0, math.rad(85), 0), w4.C0 * CFrame.new(0, 0.2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), w3.C0 * CFrame.new(-1.3, 2, 0) * CFrame.Angles(math.rad(-180), math.rad(0), math.rad(-50))} local SK4 = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), ll.C0 * CFrame.new(-0.1, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), rl.C0 * CFrame.new(0.1, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-20), math.rad(0), math.rad(0)), w4.C0 * CFrame.new(1, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-90)), w3.C0 * CFrame.new(-1, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(90))} local spin = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(-90), math.rad(0)), ll.C0 * CFrame.new(-0.1, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-5)), rl.C0 * CFrame.new(0.1, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(5)), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(90), math.rad(0)), w3.C0 * CFrame.new(-1, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(90)), w4.C0 * CFrame.new(0, 0.3, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-20))} local med = {ts.C0 * CFrame.new(0, -1.7, 0) * CFrame.Angles(math.rad(0), math.rad(0), 0), ll.C0 * CFrame.new(0, 1, -0.5) * CFrame.Angles(math.rad(0), math.rad(40), math.rad(90)), rl.C0 * CFrame.new(0, 1, -0.5) * CFrame.Angles(math.rad(0), math.rad(-40), math.rad(-90)), nc.C0 * CFrame.Angles(math.rad(-20), math.rad(0), 0), w4.C0 * CFrame.new(1.1, -0.2, -1.2) * CFrame.Angles(math.rad(-160), 0, math.rad(-90)), w3.C0 * CFrame.new(-1.1, -0.1, -1.2) * CFrame.Angles(math.rad(-160), 0, math.rad(90))} local PA3 = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(4), math.rad(-80), math.rad(5)), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(80), math.rad(0)), w4.C0 * CFrame.new(0.5, 1.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-70)), w3.C0 * CFrame.new(-2, -0.7, 0.8) * CFrame.Angles(math.rad(0), math.rad(-5), math.rad(-90)), ll.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), rl.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))} local PA3B = {ts.C0 * CFrame.new(0, -1.5, 0) * CFrame.Angles(math.rad(-30), math.rad(0), math.rad(0)), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), w4.C0 * CFrame.new(0.5, -0.3, -0.5) * CFrame.Angles(math.rad(90), math.rad(-40), math.rad(0)), w3.C0 * CFrame.new(-0.5, -0.3, -0.5) * CFrame.Angles(math.rad(90), math.rad(40), math.rad(0)), ll.C0 * CFrame.new(0, 1, -0.5) * CFrame.Angles(math.rad(-20), math.rad(0), math.rad(0)), rl.C0 * CFrame.new(0, 0.3, 0.6) * CFrame.Angles(math.rad(-30), math.rad(0), math.rad(0))} local heal = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), 0), nc.C0 * CFrame.Angles(math.rad(-10), math.rad(0), 0), w4.C0 * CFrame.new(1, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-90)), w3.C0 * CFrame.new(-1, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(90)), ll.C0 * CFrame.new(-0.1, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-5)), rl.C0 * CFrame.new(0.1, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(5))} local PA4 = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(60), math.rad(-60), 0), nc.C0 * CFrame.Angles(math.rad(-25), math.rad(50), 0), w4.C0 * CFrame.new(0.4, 1, 0.7) * CFrame.Angles(math.rad(50), 0, math.rad(-70)), w3.C0 * CFrame.new(-1.2, -0.2, 1) * CFrame.Angles(math.rad(-40), math.rad(20), math.rad(-50)), ll.C0 * CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, math.rad(0), math.rad(-30)), rl.C0 * CFrame.new(1, 0.5, 0.5) * CFrame.Angles(0, math.rad(-20), math.rad(40))} local jump = {nc.C0 * CFrame.Angles(math.rad(10), 0, 0), w4.C0 * CFrame.new(0, 0.1, -0.1) * CFrame.Angles(math.rad(20), 0, math.rad(-10)), w3.C0 * CFrame.new(0, 0.1, -0.1) * CFrame.Angles(math.rad(10), 0, math.rad(10)), ll.C0 * CFrame.new(-0.1, 0, 0.3) * CFrame.Angles(math.rad(-20), 0, math.rad(0)), rl.C0 * CFrame.new(0.2, 0, 0) * CFrame.Angles(0, 0, math.rad(10)), ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(20), math.rad(0), 0)} local jump2 = {nc.C0 * CFrame.Angles(math.rad(-10), 0, 0), w4.C0 * CFrame.new(0, 0.5, 0) * CFrame.Angles(math.rad(-30), 0, math.rad(-20)), w3.C0 * CFrame.new(0, 0.5, 0) * CFrame.Angles(math.rad(-30), 0, math.rad(20)), ll.C0 * CFrame.new(-0.15, 0, 0) * CFrame.Angles(math.rad(-5), math.rad(30), math.rad(-10)), rl.C0 * CFrame.new(0.15, 0, 0) * CFrame.Angles(math.rad(5), math.rad(-30), math.rad(10))} local stunned = {nc.C0 * CFrame.Angles(0, math.rad(90), 0), w4.C0 * CFrame.new(0, 1, 0) * CFrame.Angles(0, 0, math.rad(-50)), w3.C0 * CFrame.new(0, 1, 0) * CFrame.Angles(0, 0, math.rad(50)), ll.C0 * CFrame.new(-0.3, 0, 0) * CFrame.Angles(0, 0, math.rad(-20)), rl.C0 * CFrame.new(0.3, 0, 0) * CFrame.Angles(0, 0, math.rad(20)), ts.C0 * CFrame.new(0, -2.5, 0) * CFrame.Angles(math.rad(90), 0, 0)} local PA1C = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-30), math.rad(-40), math.rad(-30)), ll.C0 * CFrame.new(0, 0, -0.5) * CFrame.Angles(math.rad(20), math.rad(30), math.rad(-10)), rl.C0 * CFrame.new(0, -0.05, -0.5) * CFrame.Angles(math.rad(20), math.rad(-30), math.rad(10)), nc.C0 * CFrame.Angles(math.rad(-7), math.rad(-20), 0), w3.C0 * CFrame.new(0, 0.5, -0.2) * CFrame.Angles(math.rad(-100), math.rad(40), math.rad(30)), w4.C0 * CFrame.new(0, 0.6, 0) * CFrame.Angles(math.rad(30), 0, math.rad(-20))} local Stomp = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), 0), nc.C0 * CFrame.Angles(math.rad(-13), math.rad(-20), 0), ll.C0 * CFrame.new(-0.05, 0, 0) * CFrame.new(math.rad(0), math.rad(0), math.rad(0)), rl.C0 * CFrame.new(0, 0.6, -0.6) * CFrame.Angles(math.rad(0), 0, math.rad(0)), w3.C0 * CFrame.new(0, 0.7, 0) * CFrame.Angles(math.rad(-30), 0, math.rad(30)), w4.C0 * CFrame.new(0, 0.7, 0) * CFrame.Angles(math.rad(-30), 0, math.rad(-30))} local Stomp2 = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(0), 0), nc.C0 * CFrame.Angles(math.rad(-25), math.rad(-20), 0), ll.C0 * CFrame.new(-0.05, 0, 0) * CFrame.new(math.rad(0), math.rad(0), math.rad(0)), rl.C0 * CFrame.new(0, 0, -0.6) * CFrame.Angles(math.rad(0), 0, math.rad(0)), w3.C0 * CFrame.new(0, 0.7, 0) * CFrame.Angles(math.rad(-30), 0, math.rad(35)), w4.C0 * CFrame.new(0, 0.7, 0) * CFrame.Angles(math.rad(-30), 0, math.rad(-35))} local dropkick = {ts.C0 * CFrame.new(0, 0.8, 0) * CFrame.Angles(math.rad(90), math.rad(45), 0), nc.C0 * CFrame.new(0, 0, -0.2) * CFrame.Angles(math.rad(-30), math.rad(-20), 0), ll.C0 * CFrame.new(-0.2, 0, -0.3) * CFrame.Angles(math.rad(-20), math.rad(0), math.rad(0)), rl.C0 * CFrame.new(-0.05, 0, 0) * CFrame.Angles(math.rad(0), math.rad(20), math.rad(0)), w3.C0 * CFrame.new(-2.7, 1.5, 0) * CFrame.Angles(math.rad(0), 0, math.rad(170)), w4.C0 * CFrame.new(2.7, 1.5, 0) * CFrame.Angles(math.rad(0), 0, math.rad(-160))} local block = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-9), math.rad(0), 0), ll.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), rl.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), w3.C0 * CFrame.new(-0.8, 1.3, -0.6) * CFrame.Angles(math.rad(-160), math.rad(0), math.rad(0)), w4.C0 * CFrame.new(0.8, 1.3, -0.6) * CFrame.Angles(math.rad(-160), math.rad(0), math.rad(0))} local sjump = {ts.C0 * CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(-10), 0, 0), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-15), math.rad(0), 0), ll.C0 * CFrame.new(0, 0.4, 0.8) * CFrame.Angles(math.rad(-70), 0, 0), rl.C0 * CFrame.new(0, 0.8, -0.5) * CFrame.Angles(math.rad(-10), 0, 0), w3.C0 * CFrame.new(0, 0.5, 0.5) * CFrame.Angles(math.rad(-50), math.rad(0), math.rad(0)), w4.C0 * CFrame.new(0, 0, -0.5) * CFrame.Angles(math.rad(40), math.rad(0), math.rad(0))} local UpSideDownPunch = {ts.C0 * CFrame.new(0, -0.5, 0) * CFrame.Angles(math.rad(180), 0, 0), nc.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), ll.C0 * CFrame.new(-0.4, 0, 0) * CFrame.Angles(0, 0, math.rad(-20)), rl.C0 * CFrame.new(0.4, 0, 0) * CFrame.Angles(0, 0, math.rad(20)), w3.C0 * CFrame.new(0, 1.7, 0) * CFrame.Angles(math.rad(180), math.rad(0), math.rad(0)), w4.C0 * CFrame.new(0, 1.7, 0) * CFrame.Angles(math.rad(180), math.rad(0), math.rad(0))} local BackBreaker = {ts.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(10), math.rad(15), 0), nc.C0 * CFrame.Angles(math.rad(-15), math.rad(-5), 0), w4.C0 * CFrame.new(0, 0.1, 0.3) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0)), w3.C0 * CFrame.new(0, 0.5, 0.5) * CFrame.Angles(math.rad(-90), math.rad(20), math.rad(0)), ll.C0 * CFrame.new(-0.3, 0, 0.3) * CFrame.Angles(math.rad(-20), math.rad(30), math.rad(-10)), rl.C0 * CFrame.new(-0.2, 1, -0.5) * CFrame.Angles(math.rad(-40), 0, math.rad(0))} local FrontFlipKick1 = {ts.C0 * CFrame.new(0, 2, 0) * CFrame.Angles(math.rad(-8), math.rad(0), 0), nc.C0 * CFrame.Angles(math.rad(-15), math.rad(-5), 0), w4.C0 * CFrame.new(0, 1, -0.3) * CFrame.Angles(math.rad(140), math.rad(0), math.rad(0)), w3.C0 * CFrame.new(0, 1, -0.3) * CFrame.Angles(math.rad(140), math.rad(0), math.rad(0)), ll.C0 * CFrame.new(0, 1, 1) * CFrame.Angles(math.rad(-110), 0, math.rad(0)), rl.C0 * CFrame.new(0, 1, -1) * CFrame.Angles(math.rad(110), 0, math.rad(0))} f = Instance.new("ScreenGui", player.PlayerGui) f.Name = "UI" f1 = Instance.new("Frame", f) f1.BorderSizePixel = 0 f1.BackgroundColor3 = Color3.new(0, 0, 0) f1.Size = UDim2.new(0.3, 0, 0.05, 0) f1.Position = UDim2.new(0.2, 0, 0.84, 0) f1f = Instance.new("Frame", f1) f1f.BorderSizePixel = 0 f1f.BackgroundColor3 = Color3.new(255, 255, 255) f1f.Size = UDim2.new(1, 0, 1, 0) f1l = Instance.new("TextLabel", f1) f1l.TextScaled = true f1l.TextStrokeTransparency = 0 f1l.BackgroundTransparency = 1 f1l.TextColor3 = Color3.new(255, 255, 255) f1l.BorderSizePixel = 0 f1l.Size = UDim2.new(1, 0, 1, 0) f1l.Text = "[Z] Death Frost" f2 = Instance.new("Frame", f) f2.BorderSizePixel = 0 f2.BackgroundColor3 = Color3.new(0, 0, 0) f2.Size = UDim2.new(0.3, 0, 0.05, 0) f2.Position = UDim2.new(0.52, 0, 0.84, 0) f2f = Instance.new("Frame", f2) f2f.BorderSizePixel = 0 f2f.BackgroundColor3 = Color3.new(255, 255, 255) f2f.Size = UDim2.new(1, 0, 1, 0) f2l = Instance.new("TextLabel", f2) f2l.TextScaled = true f2l.TextStrokeTransparency = 0 f2l.BackgroundTransparency = 1 f2l.TextColor3 = Color3.new(255, 255, 255) f2l.BorderSizePixel = 0 f2l.Size = UDim2.new(1, 0, 1, 0) f2l.Text = "[X] Icebound" f3 = Instance.new("Frame", f) f3.BorderSizePixel = 0 f3.BackgroundColor3 = Color3.new(0, 0, 0) f3.Size = UDim2.new(0.3, 0, 0.05, 0) f3.Position = UDim2.new(0.2, 0, 0.9, 0) f3f = Instance.new("Frame", f3) f3f.BorderSizePixel = 0 f3f.BackgroundColor3 = Color3.new(255, 255, 255) f3f.Size = UDim2.new(1, 0, 1, 0) f3l = Instance.new("TextLabel", f3) f3l.TextScaled = true f3l.TextStrokeTransparency = 0 f3l.BackgroundTransparency = 1 f3l.TextColor3 = Color3.new(255, 255, 255) f3l.BorderSizePixel = 0 f3l.Size = UDim2.new(1, 0, 1, 0) f3l.Text = "[C] Phantic Guardian" f4 = Instance.new("Frame", f) f4.BorderSizePixel = 0 f4.BackgroundColor3 = Color3.new(0, 0, 0) f4.Size = UDim2.new(0.3, 0, 0.05, 0) f4.Position = UDim2.new(0.52, 0, 0.9, 0) f4f = Instance.new("Frame", f4) f4f.BorderSizePixel = 0 f4f.BackgroundColor3 = Color3.new(255, 255, 255) f4f.Size = UDim2.new(1, 0, 1, 0) f4l = Instance.new("TextLabel", f4) f4l.TextScaled = true f4l.TextStrokeTransparency = 0 f4l.BackgroundTransparency = 1 f4l.TextColor3 = Color3.new(255, 255, 255) f4l.BorderSizePixel = 0 f4l.Size = UDim2.new(1, 0, 1, 0) f4l.Text = "[V] Ice Age " f5 = Instance.new("Frame", f) f5.BorderSizePixel = 0 f5.BackgroundColor3 = Color3.new(255, 255, 255) f5.Size = UDim2.new(0.3, 0, 0.03, 0) f5.Position = UDim2.new(0.52, 0, 0.8, 0) f5f = Instance.new("Frame", f5) f5f.BorderSizePixel = 0 f5f.BackgroundColor3 = Color3.new(0, 255, 0) f5f.Size = UDim2.new(1, 0, 1, 0) f5l = Instance.new("TextLabel", f5) f5l.TextScaled = true f5l.TextStrokeTransparency = 0 f5l.BackgroundTransparency = 1 f5l.TextColor3 = Color3.new(255, 255, 255) f5l.BorderSizePixel = 0 f5l.Size = UDim2.new(1, 0, 1, 0) f5l.Text = "Health" f6 = Instance.new("Frame", f) f6.BorderSizePixel = 0 f6.BackgroundColor3 = Color3.new(255, 255, 255) f6.Size = UDim2.new(0.3, 0, 0.03, 0) f6.Position = UDim2.new(0.2, 0, 0.8, 0) f6f = Instance.new("Frame", f6) f6f.BorderSizePixel = 0 f6f.BackgroundColor3 = BrickColor.new("Deep blue").Color f6f.Size = UDim2.new(1, 0, 1, 0) f6l = Instance.new("TextLabel", f6) f6l.TextScaled = true f6l.TextStrokeTransparency = 0 f6l.BackgroundTransparency = 1 f6l.TextColor3 = Color3.new(255, 255, 255) f6l.BorderSizePixel = 0 f6l.Size = UDim2.new(1, 0, 1, 0) f6l.Text = "Mana" fa = Instance.new("TextLabel", f) fa.TextScaled = true fa.TextStrokeTransparency = 0 fa.BackgroundTransparency = 0.5 fa.BackgroundColor3 = Color3.new(0, 0, 0) fa.TextColor3 = Color3.new(255, 0, 0) fa.BorderSizePixel = 0 fa.Size = UDim2.new(0.2, 0, 0.05, 0) fa.Position = UDim2.new(0.2, 0, 0.74, 0) fa.Text = "Attack : 1" fa2 = Instance.new("TextLabel", f) fa2.TextScaled = true fa2.TextStrokeTransparency = 0 fa2.BackgroundTransparency = 0.5 fa2.BackgroundColor3 = Color3.new(0, 0, 0) fa2.TextColor3 = Color3.new(0, 255, 0) fa2.BorderSizePixel = 0 fa2.Size = UDim2.new(0.2, 0, 0.05, 0) fa2.Position = UDim2.new(0.41, 0, 0.74, 0) fa2.Text = "Speed : 1" fa3 = Instance.new("TextLabel", f) fa3.TextScaled = true fa3.TextStrokeTransparency = 0 fa3.BackgroundTransparency = 0.5 fa3.BackgroundColor3 = Color3.new(0, 0, 0) fa3.TextColor3 = Color3.new(0, 0, 255) fa3.BorderSizePixel = 0 fa3.Size = UDim2.new(0.2, 0, 0.05, 0) fa3.Position = UDim2.new(0.62, 0, 0.74, 0) fa3.Text = "Defense : 1" S1 = true S1T = 0 S1TF = 7 S2 = true S2T = 0 S2TF = 15 S3 = true S3T = 0 S3TF = 12 S4 = true S4T = 0 S4TF = 30 energy = 0 local Close1 = CFrame.new(1.5, 0, 0) local Close2 = CFrame.new(-1.5, 0, 0) local Speed = 0.3 local Open4 = w4.C0 * CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, math.rad(-30)) local h1 = nc.C0 * CFrame.Angles(math.rad(20), math.rad(-30), 0) local h2 = CFrame.new(0, 1.5, 0) local h3 = nc.C0 * CFrame.Angles(math.rad(-20), math.rad(30), 0) local opend = false local current = true local DGU = function(p, txt) s2:Play() local par = Instance.new("Part", game.Workspace) par.Transparency = 1 par.Anchored = true par.CFrame = p.CFrame par.CanCollide = false game.Debris:AddItem(par, 10) local f = Instance.new("BillboardGui", par) f.Size = UDim2.new(1.2, 0, 1.2, 0) f.AlwaysOnTop = true f.StudsOffset = Vector3.new(0, 2, 0) local fr = Instance.new("Frame", f) fr.BackgroundTransparency = 1 fr.Size = UDim2.new(1, 0, 1, 0) fr.ClipsDescendants = true local fe = Instance.new("TextLabel", fr) fe.Size = UDim2.new(1, 0, 1, 0) fe.BackgroundTransparency = 1 fe.TextColor3 = BrickColor.new("Bright yellow").Color fe.TextStrokeTransparency = 0 fe.Text = txt fe.TextScaled = true fe.Font = "Legacy" fe.Position = UDim2.new(0, 0, 1, 0) fe:TweenPosition(UDim2.new(0, 0, 0, 0), "In", "Linear", 0.5) wait(2) fe:TweenPosition(UDim2.new(0, 0, -1, 0), "In", "Linear", 0.4) for i = 0, 10 do wait() fe.TextTransparency = fe.TextTransparency + 0.1 end end local HL = function(p, txt) local par = Instance.new("Part", game.Workspace) par.Transparency = 1 par.Anchored = true par.CFrame = p.CFrame par.CanCollide = false game.Debris:AddItem(par, 10) local f = Instance.new("BillboardGui", par) f.Size = UDim2.new(1.2, 0, 1.2, 0) f.AlwaysOnTop = true f.StudsOffset = Vector3.new(0, 2, 0) local fr = Instance.new("Frame", f) fr.BackgroundTransparency = 1 fr.Size = UDim2.new(1, 0, 1, 0) fr.ClipsDescendants = true local fe = Instance.new("TextLabel", fr) fe.Size = UDim2.new(1, 0, 1, 0) fe.BackgroundTransparency = 1 fe.TextColor3 = BrickColor.new("Lime green").Color fe.TextStrokeTransparency = 0 fe.Text = txt fe.TextScaled = true fe.Font = "Legacy" fe.Position = UDim2.new(0, 0, 1, 0) fe:TweenPosition(UDim2.new(0, 0, 0, 0), "In", "Linear", 0.5) wait(2) fe:TweenPosition(UDim2.new(0, 0, -1, 0), "In", "Linear", 0.4) for i = 0, 10 do wait() fe.TextTransparency = fe.TextTransparency + 0.1 end end makeui = function(color, txt) local par = Instance.new("Part", game.Workspace) par.Transparency = 1 par.Anchored = true par.CFrame = char.Head.CFrame par.CanCollide = false game.Debris:AddItem(par, 10) local f = Instance.new("BillboardGui", par) f.Size = UDim2.new(1.2, 0, 1.2, 0) f.AlwaysOnTop = true f.StudsOffset = Vector3.new(0, 4, 0) local fr = Instance.new("Frame", f) fr.BackgroundTransparency = 1 fr.Size = UDim2.new(2, 0, 2, 0) fr.ClipsDescendants = true local fe = Instance.new("TextLabel", fr) fe.Size = UDim2.new(1, 0, 1, 0) fe.BackgroundTransparency = 1 fe.TextColor3 = Color3.new(255, 255, 255) fe.TextStrokeTransparency = 0 fe.Text = txt fe.TextScaled = true fe.Font = "SourceSansBold" game.Debris:AddItem(f, 4) fe.Position = UDim2.new(0, 0, 1, 0) fe:TweenPosition(UDim2.new(0, 0, 0, 0), "In", "Linear", 0.5) wait(2) fe:TweenPosition(UDim2.new(0, 0, -1, 0), "In", "Linear", 0.4) for i = 0, 10 do wait() fe.TextTransparency = fe.TextTransparency + 0.1 end end local TARG1, TARG2, TARG3, TARG4, TARG5, TARG6 = nil, nil, nil, nil, nil, nil local IdleAndWalk = false turnonwelds() opend = true local PartsToTransparency = {} local pars = {} local sizes = {} local poses = {} local part_to_fade = false local pa2f = nil iceeffect = function(part) local l = Instance.new("Part", char) l.BrickColor = BrickColor.new("Medium blue") l.Size = Vector3.new(1, 1, 1) l.Shape = "Ball" l.TopSurface = "Smooth" l.BottomSurface = "Smooth" l.Material = "Neon" l.CanCollide = false l.Anchored = true l.Transparency = 0 l.CFrame = part.CFrame game.Debris:AddItem(l, 5) table.insert(PartsToTransparency, l) table.insert(pars, l) table.insert(poses, l.CFrame) table.insert(sizes, Vector3.new(40, 40, 40)) end game:GetService("RunService").RenderStepped:connect(function() for i = 1, #PartsToTransparency do local part = PartsToTransparency[i] if part ~= nil then part.Transparency = part.Transparency + 0.035 if part.Transparency > 1 then table.remove(PartsToTransparency, i) end end end end ) game:GetService("RunService").RenderStepped:connect(function() for i = 1, #pars do local par = pars[i] if par ~= nil then par.Size = par.Size:lerp(sizes[i], 0.05) par.CFrame = poses[i] end if par.Size == sizes[i] then table.remove(parts, i) table.remove(sizes, i) table.remove(poses, i) end end if part_to_fade ~= false then part_to_fade = false table.insert(PartsToTransparency, pa2f) pa2f = nil end end ) makeice = function(chr) local num = 0 print("OUTPUT FROM MAKICE FOUND!") for i,v in pairs(chr.Torso:GetChildren()) do if v.ClassName == "Part" then num = num + 1 end end print("I GOT " .. tostring(num) .. " ICE") if num == 0 then local ice = makepart(0.4, false, "Medium blue", Vector3.new(1.2, 1.2, 1.2), char.Torso.CFrame, "Ice", nil, 20, false) ice.Anchored = false ice.Parent = chr.Torso ice.Name = "ICE1" local weld = Instance.new("Weld", chr) weld.Part0 = chr["Right Arm"] weld.Part1 = ice weld.C0 = CFrame.new(-0.7, 0.8, 0) * CFrame.Angles(math.rad(math.random(1, 5) * tick()), math.rad(math.random(1, 5) * tick()), math.rad(math.random(1, 5) * tick())) iceeffect(ice) else do if num == 1 then local ice = makepart(0.4, false, "Medium blue", Vector3.new(1.2, 1.2, 1.2), char.Torso.CFrame, "Ice", nil, 20, false) ice.Anchored = false ice.Parent = chr.Torso ice.Name = "ICE2" local weld = Instance.new("Weld", chr) weld.Part0 = chr["Left Arm"] weld.Part1 = ice weld.C0 = CFrame.new(0.7, 0.8, 0) * CFrame.Angles(math.rad(math.random(1, 5) * tick()), math.rad(math.random(1, 5) * tick()), math.rad(math.random(1, 5) * tick())) iceeffect(ice) else do if num == 2 then local ice = makepart(0.4, false, "Medium blue", Vector3.new(1.2, 1.2, 1.2), char.Torso.CFrame, "Ice", nil, 20, false) ice.Anchored = false ice.Parent = chr.Torso ice.Name = "ICE3" local weld = Instance.new("Weld", chr) weld.Part0 = chr["Left Leg"] weld.Part1 = ice weld.C0 = CFrame.new(0, 0.7, 0) * CFrame.Angles(math.rad(math.random(1, 5) * tick()), math.rad(math.random(1, 5) * tick()), math.rad(math.random(1, 5) * tick())) iceeffect(ice) else do if num == 3 then local ice = makepart(0.4, false, "Medium blue", Vector3.new(1.2, 1.2, 1.2), char.Torso.CFrame, "Ice", nil, 20, false) ice.Anchored = false ice.Parent = chr.Torso ice.Name = "ICE4" local weld = Instance.new("Weld", chr) weld.Part0 = chr["Right Leg"] weld.Part1 = ice weld.C0 = CFrame.new(0, 0.7, 0) * CFrame.Angles(math.rad(math.random(1, 5) * tick()), math.rad(math.random(1, 5) * tick()), math.rad(math.random(1, 5) * tick())) iceeffect(ice) else do local ice = makepart(0.4, false, "Medium blue", Vector3.new(1.2, 1.2, 1.2), char.Torso.CFrame, "Ice", nil, 20, false) ice.Anchored = false ice.Parent = chr.Torso ice.Name = "ICE1" local weld = Instance.new("Weld", chr) weld.Part0 = chr["Right Arm"] weld.Part1 = ice weld.C0 = CFrame.new(-0.7, 0.8, 0) * CFrame.Angles(math.rad(math.random(1, 5) * tick()), math.rad(math.random(1, 5) * tick()), math.rad(math.random(1, 5) * tick())) iceeffect(ice) end end end end end end end end end local wpb = true local num = 1 mouse.Button1Down:connect(function() if current == true and opend == true and stun.Value == false and healingmode == true then energy = energy - 20 S2T = 0 HBOX1:Destroy() local POS = HBOX2.CFrame do HBOX2:Destroy() local s = Instance.new("Part", game.Workspace) s.Transparency = 1 s.Size = Vector3.new(0.2, 0.2, 0.2) s.Anchored = false s.CanCollide = false s.Position = POS.p healingmode = false local fpos = nil s.Touched:connect(function() fpos = s.CFrame s:Destroy() print(fpos) end ) repeat wait() until fpos ~= nil local dsn = true print(" FPOS FOUND : " .. tostring(fpos)) local ice1 = makepart(0, false, "Steel blue", Vector3.new(0.2, 1, 0.2), fpos, "Neon", nil, 5, true) meshsomething(ice1, nil, nil, nil, "CylinderMesh") local ice2 = makepart(0, false, "Toothpaste", Vector3.new(0.2, 1.2, 0.2), fpos, "Neon", nil, 5, true) meshsomething(ice2, nil, nil, nil, "CylinderMesh") game:GetService("RunService").RenderStepped:connect(function() if dsn == true then ice1.Size = ice1.Size:lerp(Vector3.new(24, 1, 24), 0.1) ice2.Size = ice2.Size:lerp(Vector3.new(20, 1.2, 20), 0.1) ice1.CFrame = fpos ice2.CFrame = fpos if ice1.Size.X == 24 or ice1.Size.X > 24 or ice1.Size.X > 23.7 then dsn = false print("Done!") end end end ) wait(1) local getsnearme = function(studs) local list = game.Workspace:GetChildren() local targs = {} for i = 1, #list do local target = list[i] if target.ClassName == "Model" and target.Name ~= player.Name and target:FindFirstChild("Humanoid") and target:FindFirstChild("Torso") and (target.Torso.Position - ice1.Position).magnitude < studs and target ~= nil then table.insert(targs, target) end end return targs end local f = getsnearme(23) for i,v in pairs(f) do wait() print(v.Name) if v:FindFirstChild("Team").Value ~= team.Value then if v:FindFirstChild("Attack") then if v:FindFirstChild("Blocking").Value == true then v.BlockingLabel.Value = true else game.Workspace.CagePlayer:InvokeServer(v, team.Value) iceeffect(v.Torso) local dtd = math.floor(math.random(3, 5) * atk.Value / v:FindFirstChild("Defense").Value) v:FindFirstChild("Humanoid").Health = v:FindFirstChild("Humanoid").Health - dtd dfm = 5 df = nil wait() dfm = dtd df = v:FindFirstChild("Head") end else do do local dtd = math.floor(math.random(3, 5) * atk.Value) v:FindFirstChild("Humanoid").Health = v:FindFirstChild("Humanoid").Health - dtd dfm = 5 df = nil wait() dfm = dtd df = v:FindFirstChild("Head") -- DECOMPILER ERROR at PC237: LeaveBlock: unexpected jumping out DO_STMT -- DECOMPILER ERROR at PC237: LeaveBlock: unexpected jumping out IF_ELSE_STMT -- DECOMPILER ERROR at PC237: LeaveBlock: unexpected jumping out IF_STMT -- DECOMPILER ERROR at PC237: LeaveBlock: unexpected jumping out IF_THEN_STMT -- DECOMPILER ERROR at PC237: LeaveBlock: unexpected jumping out IF_STMT end end end end end for i = 0, 20 do wait() ice1.Transparency = ice1.Transparency + 0.05 ice2.Transparency = ice2.Transparency + 0.05 end return end end do if current == true and idleq == false and opend == true and wpb == true and stun.Value == false and bl.Value == false and healingmode == false then local fs = nil if num == 1 then wpb = false current = false fr = true p32.Touched:connect(function(hit) if not fr then return end if hit.Parent:FindFirstChild("Defense") then fs = math.floor(math.random(5, 7) * atk.Value / hit.Parent:FindFirstChild("Defense").Value) else fs = math.floor(math.random(5, 7) * atk.Value) end if hit.Parent.Name ~= player.Name and hit.Parent:FindFirstChild("Humanoid") and fr == true then fr = false if hit.Parent:FindFirstChild("Blocking") then if hit.Parent:FindFirstChild("Blocking").Value == true then hit.Parent.PauseBlock.Value = true wait() wait() hit.Parent.BlockingLeft.Value = 5 wait() wait() hit.Parent.PauseBlock.Value = false if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent.BlockingLabel.Value = true end stun.Value = true else if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent:FindFirstChild("Humanoid").Health = hit.Parent:FindFirstChild("Humanoid").Health - fs DGU(hit, fs) fr = false end end else -- if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent:FindFirstChild("Humanoid").Health = hit.Parent:FindFirstChild("Humanoid").Health - fs DGU(hit, fs) fr = false -- end end end end ) local tar = CFrame.new(0, -0.7, 0) * CFrame.Angles(math.rad(0), math.rad(-50), math.rad(140)) wait(0.1) TARG1 = PA1[5] TARG2 = PA1[6] TARG3 = PA1[4] TARG4 = PA1[3] TARG5 = PA1[2] TARG6 = PA1[1] STARG = tar wait(0.05) TARG1 = PA1[5] TARG2 = PA1[6] TARG3 = PA1[4] TARG4 = PA1[3] TARG5 = PA1[2] TARG6 = PA1[1] STARG = tar wait(0.05) TARG1 = PA1[5] TARG2 = PA1[6] TARG3 = PA1[4] TARG4 = PA1[3] TARG5 = PA1[2] TARG6 = PA1[1] STARG = tar TARG1 = PA1[5] TARG2 = PA1[6] TARG3 = PA1[4] TARG4 = PA1[3] TARG5 = PA1[2] TARG6 = PA1[1] STARG = tar s4:Play() local tar2 = CFrame.new(0, -0.5, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(180)) wait(0.05) TARG1 = PA1B[5] TARG2 = PA1B[6] TARG3 = PA1B[4] TARG4 = PA1B[3] TARG5 = PA1B[2] TARG6 = PA1B[1] STARG = tar2 wait(0.05) TARG1 = PA1B[5] TARG2 = PA1B[6] TARG3 = PA1B[4] TARG4 = PA1B[3] TARG5 = PA1B[2] TARG6 = PA1B[1] STARG = tar2 wait(0.05) TARG1 = PA1B[5] TARG2 = PA1B[6] TARG3 = PA1B[4] TARG4 = PA1B[3] TARG5 = PA1B[2] TARG6 = PA1B[1] STARG = tar2 wait(0.05) TARG1 = PA1B[5] TARG2 = PA1B[6] TARG3 = PA1B[4] TARG4 = PA1B[3] TARG5 = PA1B[2] TARG6 = PA1B[1] STARG = tar2 wait(0.1) current = true fr = false wait(0.1) wpb = true num = num + 1 return end do if num == 2 then wpb = false current = false fr = true p32.Touched:connect(function(hit) if not fr then return end if hit.Parent:FindFirstChild("Defense") then fs = math.floor(math.random(7, 8) * atk.Value / hit.Parent:FindFirstChild("Defense").Value) else fs = math.floor(math.random(7, 8) * atk.Value) end if hit.Parent.Name ~= player.Name and hit.Parent:FindFirstChild("Humanoid") and fr == true then fr = false if hit.Parent:FindFirstChild("Blocking") then if hit.Parent:FindFirstChild("Blocking").Value == true then if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent.PauseBlock.Value = true wait() hit.Parent.BlockingLeft.Value = 5 wait() hit.Parent.PauseBlock.Value = true end if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent.BlockingLabel.Value = true end stun.Value = true else if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent:FindFirstChild("Humanoid").Health = hit.Parent:FindFirstChild("Humanoid").Health - fs DGU(hit, fs) fr = false end end else -- if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent:FindFirstChild("Humanoid").Health = hit.Parent:FindFirstChild("Humanoid").Health - fs DGU(hit, fs) fr = false --end end end end ) s5:Play() wait(0.1) local tar = CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(60), math.rad(0), math.rad(160)) local tar2 = CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(60), math.rad(0), math.rad(160)) TARG1 = PA2[6] TARG2 = PA2[5] TARG3 = PA2[4] TARG4 = PA2[3] TARG5 = PA2[2] TARG6 = PA2[1] STARG = CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(180), 0, 0) wait(0.1) TARG1 = PA2[6] TARG2 = PA2[5] TARG3 = PA2[4] TARG4 = PA2[3] TARG5 = PA2[2] TARG6 = PA2[1] STARG = CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(180), 0, 0) wait(0.1) TARG1 = PA2[6] TARG2 = PA2[5] TARG3 = PA2[4] TARG4 = PA2[3] TARG5 = PA2[2] TARG6 = PA2[1] STARG = CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(180), 0, 0) wait(0.1) TARG1 = PA2[6] TARG2 = PA2[5] TARG3 = PA2[4] TARG4 = PA2[3] TARG5 = PA2[2] TARG6 = PA2[1] STARG = CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(180), 0, 0) wait(0.2) current = true fr = false wait(0.1) wpb = true num = num + 1 return end do if num == 3 then wpb = false current = false fr = true char["Left Arm"].Touched:connect(function(hit) if not fr then return end if hit.Parent:FindFirstChild("Defense") then fs = math.floor(math.random(8, 10) * atk.Value / hit.Parent:FindFirstChild("Defense").Value) else fs = math.floor(math.random(8, 10) * atk.Value) end if hit.Parent.Name ~= player.Name and hit.Parent:FindFirstChild("Humanoid") and fr == true then fr = false if hit.Parent:FindFirstChild("Blocking") then if hit.Parent:FindFirstChild("Blocking").Value == true then if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent.PauseBlock.Value = true wait() hit.Parent.BlockingLeft.Value = 5 wait() hit.Parent.PauseBlock.Value = true end --if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent.BlockingLabel.Value = true --end stun.Value = true else --if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent:FindFirstChild("Humanoid").Health = hit.Parent:FindFirstChild("Humanoid").Health - fs DGU(hit, fs) fr = false --end end else -- if hit.Parent:FindFirstChild("Team").Value ~= team.Value then hit.Parent:FindFirstChild("Humanoid").Health = hit.Parent:FindFirstChild("Humanoid").Health - fs DGU(hit, fs) fr = false --end end end end ) s1.Pitch = 0.8 s1:Play() wait(0.1) char.Torso.Velocity = char.HumanoidRootPart.CFrame.lookVector * 40 local tar = CFrame.new(-0.4, -1, 0) * CFrame.Angles(math.rad(60), math.rad(50), math.rad(160)) STARG = tar TARG1 = PA3[4] TARG2 = PA3[3] TARG3 = PA3[2] TARG4 = PA3[6] TARG5 = PA3[5] TARG6 = PA3[1] wait(0.1) TARG1 = PA3[4] TARG2 = PA3[3] TARG3 = PA3[2] TARG4 = PA3[6] TARG5 = PA3[5] TARG6 = PA3[1] STARG = tar wait(0.1) TARG1 = PA3[4] TARG2 = PA3[3] TARG3 = PA3[2] TARG4 = PA3[6] TARG5 = PA3[5] STARG = tar TARG6 = PA3[1] wait(0.1) TARG1 = PA3[4] TARG2 = PA3[3] TARG3 = PA3[2] TARG4 = PA3[6] TARG5 = PA3[5] TARG6 = PA3[1] STARG = tar wait(0.2) current = true fr = false wait(0.1) wpb = true num = 1 return end end end end end end ) local rtb = true local orb = nil healplrs = function() local plrs = {} local healpoints = math.floor(math.random(3, 5)) local num = 0 local getsnearme = function(studs) local list = game.Workspace:GetChildren() local targs = {} for i = 1, #list do local target = list[i] if target.ClassName == "Model" and target.Name ~= player.Name and target:FindFirstChild("Humanoid") and target:FindFirstChild("Torso") and (target.Torso.Position - char.Torso.Position).magnitude < studs then table.insert(targs, target) end end return targs end makeorb = true dgm = healpoints dg = nil wait(0.1) local hum = char:FindFirstChild("Humanoid") hum.Health = hum.Health + healpoints def.Value = def.Value + 0.03 dgm = healpoints dg = char.Head wait() local f = getsnearme(30) if f ~= nil then for i,v in pairs(f) do if v:FindFirstChild("Attack") then wait(0.1) local hum = v:FindFirstChild("Humanoid") hum.Health = hum.Health + healpoints v:FindFirstChild("Defense").Value = v:FindFirstChild("Defense").Value + 0.03 dgm = healpoints dg = v.Head else do wait(0.1) do local hum = v:FindFirstChild("Humanoid") hum.Health = hum.Health + healpoints dgm = healpoints dg = v.Head -- DECOMPILER ERROR at PC85: LeaveBlock: unexpected jumping out DO_STMT -- DECOMPILER ERROR at PC85: LeaveBlock: unexpected jumping out IF_ELSE_STMT -- DECOMPILER ERROR at PC85: LeaveBlock: unexpected jumping out IF_STMT end end end end end end local pos = 0 local pr, sz, ps = nil, nil, nil local act = false game:GetService("RunService").RenderStepped:connect(function() if makeorb == true then makeorb = false local l = Instance.new("Part", game.Workspace) l.BrickColor = BrickColor.new("Forest green") l.Size = Vector3.new(1, 1, 1) l.Shape = "Ball" l.TopSurface = "Smooth" l.BottomSurface = "Smooth" l.Material = "Neon" l.CanCollide = false l.Anchored = true l.Transparency = 0 l.CFrame = char.Torso.CFrame game.Debris:AddItem(l, 2) sz = Vector3.new(120, 120, 120) ps = char.Torso.CFrame pr = l for i = 0, 20 do wait() l.Transparency = l.Transparency + 0.05 end end end ) game:GetService("RunService").RenderStepped:connect(function() if pr ~= nil and pr.Size ~= Vector3.new(40, 40, 40) then pr.Size = pr.Size:lerp(Vector3.new(40, 40, 40), 0.05) pr.CFrame = char.Torso.CFrame end end ) game:GetService("RunService").RenderStepped:connect(function() if dg ~= lastdg then lastdg = dg if dg ~= nil then HL(dg, dgm) end end end ) game:GetService("RunService").RenderStepped:connect(function() if df ~= lastdf then lastdf = df if df ~= nil then DGU(df, dfm) end end end ) local num = 0 game:GetService("RunService").RenderStepped:connect(function() if spinning == true then char.Torso.CFrame = CFrame.new(char.Torso.Position) * CFrame.fromEulerAnglesXYZ(0, num, 0) num = num + 0.5 end end ) mouse.KeyDown:connect(function(key) key = key:lower() if key == "z" and current == true and opend == true and stun.Value == false and energy > 19 and S1 == true and healingmode == false then energy = energy - 20 S1T = 0 current = false wait(0.1) local cf = CFrame.new(0, -1, 0) * CFrame.Angles(math.rad(0), math.rad(40), math.rad(-90)) do TARG1 = spin[5] TARG2 = spin[6] TARG3 = spin[4] TARG4 = spin[3] TARG5 = spin[2] TARG6 = spin[1] STARG = cf wait(0.05) TARG1 = spin[5] TARG2 = spin[6] TARG3 = spin[4] TARG4 = spin[3] TARG5 = spin[2] TARG6 = spin[1] STARG = cf local ice = makepart(0, false, "Medium blue", Vector3.new(0.2, 0.2, 0.2), char.HumanoidRootPart.CFrame * CFrame.new(0, 0, -3) * CFrame.Angles(math.rad(90), 0, 0), "Plastic", nil, 5, true) meshsomething(ice, nil, nil, nil, "CylinderMesh") local skull = makepart(0, false, "Medium blue", Vector3.new(0.2, 0.2, 0.2), char.HumanoidRootPart.CFrame * CFrame.new(0, 0, -3) * CFrame.Angles(0, 0, 0), "Plastic", nil, 5, true) local sk = meshsomething(skull, "http://www.roblox.com/asset/?id=4770583", nil, (Vector3.new(1, 1, 1)), nil) obj = ice objs = char.HumanoidRootPart.CFrame * CFrame.new(0, 0, -3) * CFrame.Angles(math.rad(90), 0, 0) TARG7 = Vector3.new(9, 0.5, 9) TARG8 = Vector3.new(20, 20, 20) objs2 = char.HumanoidRootPart.CFrame * CFrame.new(0, 0, -8) skull.Anchored = true ice.Anchored = true ice.CanCollide = false skull.CanCollide = false wait(0.05) obj2 = sk wait(0.2) current = true local getsnearme = function(studs) local list = (game.Workspace:GetChildren()) local targ = nil for i = 1, #list do local target = list[i] if target.ClassName == "Model" and target.Name ~= player.Name and target:FindFirstChild("Humanoid") and target:FindFirstChild("Torso") and (target.Torso.Position - skull.Position).magnitude < studs and target ~= nil then targ = target studs = (target.Torso.Position - skull.Position).magnitude end end return targ end local v = getsnearme(5) wait(0.1) if v ~= nil --[[and v:FindFirstChild("Team").Value ~= team.Value--]] then if v:FindFirstChild("Stats")==nil then stats:Clone().Parent=v end if v.Stats:FindFirstChild("Attack") then if v.Stats:FindFirstChild("Blocking").Value == true then v.Stats.BlockingLabel.Value = true else makeice(v) local dtd = math.floor(math.random(7, 11) * atk.Value / v.Stats:FindFirstChild("Defense").Value) v:FindFirstChild("Humanoid").Health = v:FindFirstChild("Humanoid").Health - dtd dfm = 5 df = nil wait() dfm = dtd df = v:FindFirstChild("Head") end else local dtd = math.floor(math.random(7, 11) * atk.Value / v.Stats:FindFirstChild("Defense").Value) v:FindFirstChild("Humanoid").Health = v:FindFirstChild("Humanoid").Health - dtd dfm = 5 df = nil wait() dfm = dtd df = v:FindFirstChild("Head") end end for i = 1, 20 do wait(0.05) ice.Transparency = ice.Transparency + 0.05 skull.Transparency = skull.Transparency + 0.1 end end end end ) local r2d = false local rb = nil local r = false game:GetService("RunService").RenderStepped:connect(function() if healingmode == true and HBOX1 ~= nil and HBOX2 ~= nil then HBOX1.CFrame = CFrame.new(char.HumanoidRootPart.CFrame.X, char.HumanoidRootPart.CFrame.Y, char.HumanoidRootPart.CFrame.Z) * CFrame.new(0, -3, 0) local pos = char.Torso.Position local posx = math.abs(mouse.Target.Position.X - pos.X) local posz = math.abs(mouse.Target.Position.Z - pos.Z) local radius = math.sqrt(posx ^ 2 + posz ^ 2) if radius < 60 then HBOX2.CFrame = CFrame.new(mouse.Hit.X, mouse.Hit.Y + 1, mouse.Hit.Z) end end end ) mouse.KeyDown:connect(function(key) key = key:lower() -- DECOMPILER ERROR at PC25: Unhandled construct in 'MakeBoolean' P1 -- DECOMPILER ERROR at PC25: Unhandled construct in 'MakeBoolean' P1 if key == "x" and healingmode == false and current == true and opend == true and stun.Value == false and energy > 19 and S2 == true then healingmode = true local p1 = makepart(0.5, false, "Cyan", Vector3.new(70, 0.2, 70), char.HumanoidRootPart.CFrame * CFrame.new(0, -3, 0), "Neon", nil, nil, true) meshsomething(p1, nil, nil, nil, "CylinderMesh") p1.Parent = game.Workspace.CurrentCamera HBOX1 = p1 local p2 = makepart(0.2, false, "Really red", Vector3.new(20, 0.2, 20), char.HumanoidRootPart.CFrame * CFrame.new(0, -3, 0), "Neon", nil, nil, true) meshsomething(p2, nil, nil, nil, "CylinderMesh") p2.Parent = game.Workspace.CurrentCamera HBOX2 = p2 mouse.TargetFilter = HBOX2 healingmode = false HBOX1:Destroy() HBOX2:Destroy() end end ) ma = function() local f = Instance.new("Part", char) game.Debris:AddItem(f, 1.1) f.TopSurface = "Smooth" f.BottomSurface = "Smooth" f.BrickColor = BrickColor.new("Lime green") f.Size = Vector3.new(2, 2.4, 2) f.CanCollide = false f.Anchored = true local fm = Instance.new("SpecialMesh", f) fm.MeshId = "http://www.roblox.com/asset/?id=20329976" fm.Scale = Vector3.new(6, 1, 6) f.CFrame = CFrame.new(char.B1.CFrame.X, char.B1.CFrame.Y + -3, char.B1.CFrame.Z) for i = 0, 10 do wait() f.Transparency = f.Transparency + 0.1 end end game:GetService("RunService").RenderStepped:connect(function() if r2d == true and mc.Value > 0.9 then mc.Value = mc.Value - 0.15 end if mc.Value < 1.1 and r2d == true then mc.Value = 2 ma() end end ) game:GetService("RunService").RenderStepped:connect(function() if r == true then r = false local l = Instance.new("Part", game.Workspace) do l.BrickColor = BrickColor.new("Forest green") l.Size = Vector3.new(1, 1, 1) l.Shape = "Ball" l.TopSurface = "Smooth" l.BottomSurface = "Smooth" l.Material = "Neon" l.CanCollide = false l.Anchored = true l.Transparency = 0 l.CFrame = rb local dmg = true local getsnearme = function(studs) local list = game.Workspace:GetChildren() local targs = {} for i = 1, #list do local target = list[i] if target.ClassName == "Model" and target.Name ~= player.Name and target:FindFirstChild("Humanoid") and target:FindFirstChild("Torso") and (target.Torso.Position - l.Position).magnitude < studs and target ~= nil then table.insert(targs, target) end end return targs end game.Debris:AddItem(l, 2) sz = Vector3.new(120, 120, 120) pl = l for i = 0, 20 do wait() l.Transparency = l.Transparency + 0.05 end end end end ) game:GetService("RunService").RenderStepped:connect(function() if pl ~= nil and pl.Size ~= Vector3.new(40, 40, 40) then pl.Size = pl.Size:lerp(Vector3.new(40, 40, 40), 0.05) pl.CFrame = rb end end ) local spk, spkcf, spkm = nil, nil, nil local cf = Instance.new("CFrameValue", char) game:GetService("RunService").RenderStepped:connect(function() if spk ~= nil and spkcf ~= nil and spkm ~= nil then spk.Size = spk.Size:lerp(Vector3.new(8.02, 15, 9.39), 0.05) spk.CFrame = cf spkm.Scale = spkm.Scale:lerp(Vector3.new(10, 10, 10), 0.05) end end ) local go1, go2, gos1, gos2, p2cf = nil, nil, nil, nil, nil local acto = false game:GetService("RunService").RenderStepped:connect(function() if acto == true and go1 ~= nil and go2 ~= nil and p2cf ~= nil then go1.Size = go1.Size:lerp(gos1, 0.05) go2.Size = go2.Size:lerp(gos2, 0.05) go1.CFrame = go1.CFrame:lerp(char.HumanoidRootPart.CFrame * CFrame.new(-4, 2.5, 0) * CFrame.new(0.5, 1 + math.sin(tick()), 0), 0.1) go2.CFrame = go1.CFrame:lerp(char.HumanoidRootPart.CFrame * CFrame.new(-4, 2.5, 0) * CFrame.new(0.5, 1 + math.sin(tick()), 0), 0.1) end end ) local getsnearme = function(studs, object) local list = (game.Workspace:GetChildren()) local targ = nil for i = 1, #list do local target = list[i] if target.ClassName == "Model" and target.Name ~= player.Name and target:FindFirstChild("Humanoid") and target:FindFirstChild("Torso") and (target.Torso.Position - object.Position).magnitude < studs and target ~= nil then targ = target studs = (target.Torso.Position - object.Position).magnitude end end return targ end local ry, ryc, rys = nil, nil, nil game:GetService("RunService").RenderStepped:connect(function() if ry ~= nil and ryc ~= nil and rys ~= nil then ry.Size = ry.Size:lerp(rys, 0.05) ry.CFrame = ryc end end ) mouse.KeyDown:connect(function(key) key = key:lower() if key == "c" and current == true and opend == true and stun.Value == false and energy > 34 and S3 == true and healingmode == false then energy = energy - 26 S3T = 0 local dmg = true do current = false wait(0.1) TARG1 = SK3[6] TARG2 = SK3[5] TARG3 = SK3[4] TARG4 = SK3[3] TARG5 = SK3[2] TARG6 = SK3[1] wait(0.05) TARG1 = SK3[6] TARG2 = SK3[5] TARG3 = SK3[4] TARG4 = SK3[3] TARG5 = SK3[2] TARG6 = SK3[1] wait(0.05) TARG1 = SK3[6] TARG2 = SK3[5] TARG3 = SK3[4] TARG4 = SK3[3] TARG5 = SK3[2] TARG6 = SK3[1] wait(0.05) TARG1 = SK3[6] TARG2 = SK3[5] TARG3 = SK3[4] TARG4 = SK3[3] TARG5 = SK3[2] TARG6 = SK3[1] local out_orb = makepart(1, false, "Steel blue", Vector3.new(6, 6, 6), char.Torso.CFrame * CFrame.new(-4, 2.5, 0), "Neon", "Block", 20) local msh1 = meshsomething(out_orb, nil, nil, (Vector3.new(1, 1, 1)), nil) msh1.MeshType = "Sphere" local orb = makepart(1, false, "Toothpaste", Vector3.new(5, 5, 5), char.Torso.CFrame * CFrame.new(-4, 2.5, 0), "Neon", "Block", 20) local msh2 = meshsomething(orb, nil, nil, (Vector3.new(1, 1, 1)), nil) msh2.MeshType = "Sphere" wait(0.1) current = true p2cf = char.Torso.CFrame * CFrame.new(-4, 2.5, 0) go1 = out_orb go2 = orb gos1 = Vector3.new(3, 3, 3) gos2 = Vector3.new(2, 2, 2) acto = true for i = 0, 10 do wait(0.01) out_orb.Transparency = out_orb.Transparency - 0.07 orb.Transparency = orb.Transparency - 0.1 end wait(1) local getsnearme = function(studs) local list = (game.Workspace:GetChildren()) local targ = nil for i = 1, #list do local target = list[i] if target.ClassName == "Model" and target.Name ~= player.Name and target:FindFirstChild("Humanoid") and target:FindFirstChild("Torso") and (target.Torso.Position - out_orb.Position).magnitude < studs and target ~= nil then targ = target studs = (target.Torso.Position - out_orb.Position).magnitude end end return targ end local v = getsnearme(40) if v and v:FindFirstChild("Torso") and v:FindFirstChild("Attack") then local ray = Ray.new(out_orb.CFrame.p, v.Torso.CFrame.p - out_orb.CFrame.p.unit * 150) local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) local r = Instance.new("Part", char) r.Material = "Neon" r.BrickColor = BrickColor.New("Deep blue") r.TopSurface = "Smooth" r.Anchored = true r.Transparency = 0.5 r.BottomSurface = "Smooth" r.FormFactor = "Custom" r.Shape = "Cylinder" r.CanCollide = false local distance = (out_orb.CFrame.p - position).magnitude r.Size = Vector3.new(distance, 0.1, 0.1) print(r.Size) r.CFrame = CFrame.new(out_orb.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) * CFrame.Angles(0, math.rad(90), 0) ryc = r.CFrame ry = r rys = Vector3.new(distance, 7, 7) game.Debris:AddItem(r, 1) do if v:FindFirstChild("Team").Value ~= team.Value then local damage = math.floor(math.random(7, 9) * atk.Value * v.Defense.Value) v.Humanoid.Health = v.Humanoid.Health - damage df = nil dfm = 5 wait() df = v.Head dfm = damage end for i = 0, 20 do r.Transparency = r.Transparency + 0.05 wait() end do wait(1) local v = getsnearme(40) if v and v:FindFirstChild("Torso") and v:FindFirstChild("Attack") then local ray = Ray.new(out_orb.CFrame.p, v.Torso.CFrame.p - out_orb.CFrame.p.unit * 150) local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) local r = Instance.new("Part", char) r.Material = "Neon" r.BrickColor = BrickColor.New("Deep blue") r.TopSurface = "Smooth" r.Anchored = true r.Transparency = 0.5 r.BottomSurface = "Smooth" r.FormFactor = "Custom" r.Shape = "Cylinder" r.CanCollide = false local distance = (out_orb.CFrame.p - position).magnitude r.Size = Vector3.new(distance, 0.1, 0.1) print(r.Size) r.CFrame = CFrame.new(out_orb.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) * CFrame.Angles(0, math.rad(90), 0) ryc = r.CFrame ry = r rys = Vector3.new(distance, 7, 7) game.Debris:AddItem(r, 1) do if v:FindFirstChild("Team").Value ~= team.Value then local damage = math.floor(math.random(7, 9) * atk.Value * v.Defense.Value) v.Humanoid.Health = v.Humanoid.Health - damage makeice(v) df = nil dfm = 5 wait() df = v.Head dfm = damage end for i = 0, 20 do r.Transparency = r.Transparency + 0.05 wait() end do wait(1) local v = getsnearme(40) if v and v:FindFirstChild("Torso") and v:FindFirstChild("Attack") then local ray = Ray.new(out_orb.CFrame.p, v.Torso.CFrame.p - out_orb.CFrame.p.unit * 150) local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) local r = Instance.new("Part", char) r.Material = "Neon" r.BrickColor = BrickColor.New("Deep blue") r.TopSurface = "Smooth" r.Anchored = true r.Transparency = 0.5 r.BottomSurface = "Smooth" r.FormFactor = "Custom" r.Shape = "Cylinder" r.CanCollide = false local distance = (out_orb.CFrame.p - position).magnitude r.Size = Vector3.new(distance, 0.1, 0.1) print(r.Size) r.CFrame = CFrame.new(out_orb.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) * CFrame.Angles(0, math.rad(90), 0) ryc = r.CFrame ry = r rys = Vector3.new(distance, 7, 7) game.Debris:AddItem(r, 1) do if v:FindFirstChild("Team").Value ~= team.Value then local damage = math.floor(math.random(7, 9) * atk.Value * v.Defense.Value) v.Humanoid.Health = v.Humanoid.Health - damage makeice(v) df = nil dfm = 5 wait() df = v.Head dfm = damage end for i = 0, 20 do r.Transparency = r.Transparency + 0.05 wait() end do wait(1) gos1 = Vector3.new(10, 10, 10) gos2 = Vector3.new(9, 9, 9) for i = 0, 20 do wait(0.01) out_orb.Transparency = out_orb.Transparency + 0.05 orb.Transparency = orb.Transparency + 0.8 end ryc = nil ry = nil rys = nil acto = false go1 = nil go2 = nil end end end end end end end end end end end end ) local ttl, cfr, ttl2, cfr2 = nil, nil, nil, nil game:GetService("RunService").RenderStepped:connect(function() if ttl ~= nil then ttl.CFrame = ttl.CFrame:lerp(cfr, 0.2) end end ) game:GetService("RunService").RenderStepped:connect(function() if ttl2 ~= nil then ttl2.CFrame = ttl2.CFrame:lerp(cfr2, 0.005) end end ) game:GetService("RunService").RenderStepped:connect(function() if makeorb == true then makeorb = false local l = Instance.new("Part", game.Workspace) l.BrickColor = BrickColor.new("Steel blue") l.Size = Vector3.new(1, 1, 1) l.Shape = "Ball" l.TopSurface = "Smooth" l.BottomSurface = "Smooth" l.Material = "Neon" l.CanCollide = false l.Anchored = true l.Transparency = 0 l.CFrame = char.Torso.CFrame game.Debris:AddItem(l, 2) sz = Vector3.new(120, 120, 120) ps = char.Torso.CFrame pr = l for i = 0, 20 do wait() l.Transparency = l.Transparency + 0.05 end end end ) game:GetService("RunService").RenderStepped:connect(function() if pr ~= nil and pr.Size ~= Vector3.new(40, 40, 40) then pr.Size = pr.Size:lerp(Vector3.new(40, 40, 40), 0.05) pr.CFrame = char.Torso.CFrame end end ) game:GetService("RunService").RenderStepped:connect(function() if dg ~= lastdg then lastdg = dg if dg ~= nil then HL(dg, dgm) end end end ) game:GetService("RunService").RenderStepped:connect(function() if df ~= lastdf then lastdf = df if df ~= nil then DGU(df, dfm) end end end ) mouse.KeyDown:connect(function(key) key = key:lower() if key == "v" and current == true and opend == true and stun.Value == false and energy > 49 and S4 == true and healingmode == false then current = false skl = true wait(0.05) S4T = 0 char.Humanoid.WalkSpeed = 0 energy = energy - 59 SWELD.Part0 = char.HumanoidRootPart makeorb = true local sw = CFrame.new(0, -2, 2) * CFrame.Angles(math.rad(0), math.rad(90), math.rad(0)) STARG = sw TARG1 = SK4[6] TARG2 = SK4[5] TARG3 = SK4[4] TARG4 = SK4[3] TARG5 = SK4[2] TARG6 = SK4[1] wait(0.05) TARG1 = SK4[6] TARG2 = SK4[5] TARG3 = SK4[4] TARG4 = SK4[3] TARG5 = SK4[2] TARG6 = SK4[1] STARG = sw wait(0.05) TARG1 = SK4[6] TARG2 = SK4[5] TARG3 = SK4[4] TARG4 = SK4[3] TARG5 = SK4[2] TARG6 = SK4[1] STARG = sw wait(0.05) TARG1 = SK4[6] TARG2 = SK4[5] TARG3 = SK4[4] TARG4 = SK4[3] TARG5 = SK4[2] TARG6 = SK4[1] STARG = sw wait(0.2) local getsnearme = function(studs) local list = game.Workspace:GetChildren() local targs = {} for i = 1, #list do local target = list[i] if target.ClassName == "Model" and target.Name ~= player.Name and target:FindFirstChild("Humanoid") and target:FindFirstChild("Torso") and (target.Torso.Position - char.Torso.Position).magnitude < studs and target ~= nil then table.insert(targs, target) end end return targs end local f = getsnearme(20) for i,v in pairs(f) do if v:FindFirstChild("Attack") then if v:FindFirstChild("Blocking").Value == true then v.BlockingLabel.Value = true else if v:FindFirstChild("Team").Value ~= team.Value then v.Stunned.Value = true print("CALLING MAKE ICE FUNCTION") makeice(v) game:GetService("RunService").RenderStepped:wait() makeice(v) game:GetService("RunService").RenderStepped:wait() makeice(v) game:GetService("RunService").RenderStepped:wait() makeice(v) game:GetService("RunService").RenderStepped:wait() end print("Called") if v:FindFirstChild("Team").Value ~= team.Value then local dtd = math.floor(math.random(12, 14) * atk.Value / v:FindFirstChild("Defense").Value) v:FindFirstChild("Humanoid").Health = v:FindFirstChild("Humanoid").Health - dtd dfm = 5 df = nil wait() dfm = dtd df = v:FindFirstChild("Head") end end else do do if v:FindFirstChild("Team").Value ~= team.Value then local dtd = math.floor(math.random(12, 14) * atk.Value) v:FindFirstChild("Humanoid").Health = v:FindFirstChild("Humanoid").Health - dtd dfm = 5 df = nil wait() dfm = dtd df = v:FindFirstChild("Head") end -- DECOMPILER ERROR at PC317: LeaveBlock: unexpected jumping out DO_STMT -- DECOMPILER ERROR at PC317: LeaveBlock: unexpected jumping out IF_ELSE_STMT -- DECOMPILER ERROR at PC317: LeaveBlock: unexpected jumping out IF_STMT end end end end wait(0.2) SWELD.Part0 = char["Right Arm"] current = true skl = false end end ) local Speed = 0.2 local lspeed = 0.08 local ice = 0 game:GetService("RunService").RenderStepped:connect(function() if (Vector3.new(char.Torso.Velocity.X, 0, char.Torso.Velocity.Z)).magnitude > 2 then IdleAndWalk = true else IdleAndWalk = false end if active == true then if TARG4 ~= nil then rl.C0 = rl.C0:lerp(TARG4, lspeed) end if TARG5 ~= nil then ll.C0 = ll.C0:lerp(TARG5, lspeed) end if TARG3 ~= nil then nc.C0 = nc.C0:lerp(TARG3, lspeed) end if TARG1 ~= nil then w3.C0 = w3.C0:lerp(TARG1, 0.35) end if TARG2 ~= nil then w4.C0 = w4.C0:lerp(TARG2, 0.35) end if TARG6 ~= nil then ts.C0 = ts.C0:lerp(TARG6, Speed) end if STARG ~= nil then SWELD.C0 = SWELD.C0:lerp(STARG, Speed) end end if TARG7 ~= nil and obj ~= nil then obj.Size = obj.Size:lerp(TARG7, 0.05) obj.CFrame = objs end if TARG8 ~= nil and obj2 ~= nil then obj2.Scale = obj2.Scale:lerp(TARG8, 0.05) if obj2.Parent then obj2.Parent.CFrame = obj2.Parent.CFrame:lerp(objs2, 0.05) end end if TARG10 ~= nil and obj3 ~= nil and TARG11 ~= nil then obj3.Size = obj3.Size:lerp(TARG10, 0.05) obj3.CFrame = char.Torso.CFrame * CFrame.new(0, -2.5, 0) * TARG11 end if TARG10 ~= nil and obj3 ~= nil and obj3.Transparency ~= 1 then obj2.Transparency = obj2.Transparency + 0.05 obj3.Transparency = obj3.Transparency + 0.05 wait(0.1) end if char.Humanoid.Jump == true then gd.Value = true else gd.Value = false end if energy < 100 and current == true then energy = energy + 0.05 end for i = 1, #parts do local Part = parts[i] Part.Size = Part.Size:lerp(Vector3.new(6, 32, 7), 0.05) for x = 1, #poses do Part.CFrame = poses[i] end end if blt.Value < 99 and bl.Value == false and stun.Value == false then blt.Value = blt.Value + 0.03 end if bl.Value == true and blt.Value < 5 then bl.Value = false current = true skl = false end if posd.Value == true and pt.Value > 0 then pt.Value = pt.Value - 0.02 char.Humanoid.Health = char.Humanoid.Health - 0.11 end if pt.Value < 1 then posd.Value = false end if bl.Value == true then blt.Value = blt.Value - 0.5 end if atkt.Value > 0 then atkt.Value = atkt.Value - 0.02 else atk.Value = 1 end if deft.Value > 0 then deft.Value = deft.Value - 0.02 else def.Value = 1 end if spdt.Value > 0 then spdt.Value = spdt.Value - 0.02 else wait() if spdt.Value < 1 then spd.Value = 1 end end local DV2 = S1T / S1TF local initX6 = f1.Size.X.Scale f1f:TweenSize(UDim2.new(initX6 * DV2 * 1.665, 0, 1, 0), "In", "Linear", 1) if S1T < 14 then S1T = S1T + 0.04 S1 = false else S1 = true end if S1T == 14 then S1 = true end local DV2 = S2T / S2TF local initX6 = f2.Size.X.Scale f2f:TweenSize(UDim2.new(initX6 * DV2 * 3.566, 0, 1, 0), "In", "Linear", 1) if S2T < 14 then S2T = S2T + 0.01 S2 = false else S2 = true end if S2T == 15 then S2 = true end local DV2 = S3T / S3TF local initX6 = f3.Size.X.Scale f3f:TweenSize(UDim2.new(initX6 * DV2 * 2.855, 0, 1, 0), "In", "Linear", 1) if S3T < 14 then S3T = S3T + 0.01 S3 = false else S3 = true end if S3T == 15 then S3 = true end local DV2 = S4T / S4TF local initX6 = f4.Size.X.Scale f4f:TweenSize(UDim2.new(initX6 * DV2 * 3.45, 0, 1, 0), "In", "Linear", 1) if S4T < 29 then S4T = S4T + 0.01 S4 = false else S4 = true end if S4T == 30 then S4 = true end end ) local pja = false satk = atk.Value sdef = def.Value sspd = spd.Value atk.Changed:connect(function() if atk.Value < satk then atkt.Value = atkt.Value + 4 makeui(Color3.new(255, 0, 0), "-Damage") satk = atk.Value else atkt.Value = atkt.Value + 4 makeui(Color3.new(255, 0, 0), "+Damage") satk = atk.Value end end ) posd.Changed:connect(function() if posd.Value == false then makeui(Color3.new(255, 0, 0), "-Poison") else makeui(Color3.new(255, 0, 0), "+Poison") end end ) def.Changed:connect(function() if def.Value < sdef then deft.Value = deft.Value + 4 makeui(Color3.new(0, 0, 255), "-Defense") sdef = def.Value else deft.Value = deft.Value + 4 makeui(Color3.new(0, 0, 255), "+Defense") sdef = def.Value end end ) spd.Changed:connect(function() if spd.Value < sspd then spdt.Value = spdt.Value + 4 makeui(Color3.new(0, 255, 0), "-Speed") sspd = spd.Value else spdt.Value = spdt.Value + 4 makeui(Color3.new(0, 255, 0), "+Speed") sspd = spd.Value end end ) bll.Changed:connect(function() if bll.Value == true then local c = Instance.new("Part", game.Workspace) c.Anchored = true c.CanCollide = false c.BrickColor = BrickColor.new("Medium stone grey") c.Shape = "Ball" c.Size = Vector3.new(1, 1, 1) c.CFrame = char.Torso.CFrame c.TopSurface = "Smooth" c.BottomSurface = "Smooth" c.Transparency = 0.1 local v = Instance.new("Part", game.Workspace) v.Anchored = true v.CanCollide = false v.BrickColor = BrickColor.new("Medium stone grey") v.Size = Vector3.new(1, 1, 1) v.CFrame = char.Torso.CFrame v.TopSurface = "Smooth" v.BottomSurface = "Smooth" v.Transparency = 0.1 obj2 = c TARG8 = Vector3.new(30, 30, 30) obj3 = v TARG10 = Vector3.new(15, 21, 15) TARG11 = CFrame.new(0, 0, 0) makeui(BrickColor.new("Bright bluish green").Color, "Blocked!") bll.Value = false end end ) stun.Changed:connect(function() if stun.Value == true then makeui(Color3.new(255, 255, 0), "+Stunned") wait(1) if opend == true then stun.Value = false end end if stun.Value == false then makeui(Color3.new(255, 255, 0), "-Stunned") end end ) while true do wait() fa.Text = "Attack : " .. atk.Value local iced = 0 for i,v in pairs(char.Torso:GetChildren()) do if v.ClassName == "Part" then iced = iced + 1 end end if 4 < iced then iced = 4 end local iscp = iced * 0.1 local spdt = spd.Value - iscp fa2.Text = "Speed : " .. spdt fa3.Text = "Defense : " .. def.Value local initX5 = f5.Size.X.Scale local maxhp = char.Humanoid.MaxHealth local hp = char.Humanoid.Health local Pie = hp / maxhp f5f:TweenSize(UDim2.new(initX5 * Pie * 3.33, 0, 1, 0), "In", "Linear", 1) local DV1 = energy / 100 local initX6 = f6.Size.X.Scale f6f:TweenSize(UDim2.new(initX6 * DV1 * 3.33, 0, 1, 0), "In", "Linear", 1) if opend == true then if current == true then if idleq == false then if stun.Value == true then TARG1 = stunned[3] TARG2 = stunned[2] TARG3 = stunned[1] TARG4 = stunned[5] TARG5 = stunned[4] TARG6 = stunned[6] char.Humanoid.WalkSpeed = 0 end if stun.Value == true then char.Humanoid.JumpPower = 0 else char.Humanoid.JumpPower = 50 end if stun.Value == false and skl == false then local iced = 0 for i,v in pairs(char.Torso:GetChildren()) do if v.ClassName == "Part" then iced = iced + 1 end end if 4 < iced then iced = 4 end local iscp = iced * 0.1 local fspeed = spd.Value - iscp char.Humanoid.WalkSpeed = 16 * fspeed end if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false and pja == false then pja = true TARG1 = jump[3] TARG2 = jump[2] TARG3 = jump[1] TARG4 = jump[5] TARG5 = jump[4] TARG6 = CFrame.new(0, 0, 0) if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false then wait(0.05) end if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false then TARG1 = jump[3] TARG2 = jump[2] TARG3 = jump[1] TARG4 = jump[5] TARG5 = jump[4] TARG6 = CFrame.new(0, 0, 0) end if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false then wait(0.05) end if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false then TARG1 = jump[3] TARG2 = jump[2] TARG3 = jump[1] TARG4 = jump[5] TARG5 = jump[4] TARG6 = CFrame.new(0, 0, 0) end if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false then wait(0.05) end if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false then TARG1 = jump[3] TARG2 = jump[2] TARG3 = jump[1] TARG4 = jump[5] TARG5 = jump[4] TARG6 = CFrame.new(0, 0, 0) end if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false then TARG1 = jump2[3] TARG2 = jump2[2] TARG3 = jump2[1] TARG4 = jump2[5] TARG5 = jump2[4] TARG6 = CFrame.new(0, 0, 0) end if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false then wait(0.05) end if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false then TARG1 = jump2[3] TARG2 = jump2[2] TARG3 = jump2[1] TARG4 = jump2[5] TARG5 = jump2[4] TARG6 = CFrame.new(0, 0, 0) end if char.Humanoid.Jump == true and stun.Value == false and bl.Value == false then wait(0.15) end pja = false end local lilwl = ll.C0 * CFrame.new(0, 0, -0.5) * CFrame.Angles(math.rad(30), math.rad(0), math.rad(0)) local lirwl = rl.C0 * CFrame.new(0, 0, 0.5) * CFrame.Angles(math.rad(-30), math.rad(0), math.rad(0)) local lilwr = ll.C0 * CFrame.new(0, 0, 0.5) * CFrame.Angles(math.rad(-30), math.rad(0), math.rad(0)) local lirwr = rl.C0 * CFrame.new(0, 0, -0.5) * CFrame.Angles(math.rad(30), math.rad(0), math.rad(0)) if bl.Value == false then if IdleAndWalk == true and char.Humanoid.Jump == false and stun.Value == false then TARG1 = walk[8] TARG2 = walk[7] TARG3 = walk[6] TARG4 = walk[4] TARG5 = walk[3] TARG6 = walk[5] STARG = CFrame.new(0.2, -1, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)) if IdleAndWalk == true and char.Humanoid.Jump == false and stun.Value == false and bl.Value == false then wait(0.05) end if IdleAndWalk == true and char.Humanoid.Jump == false and stun.Value == false and bl.Value == false then wait(0.05) end if IdleAndWalk == true and char.Humanoid.Jump == false and stun.Value == false and bl.Value == false then wait(0.05) end if IdleAndWalk == true and char.Humanoid.Jump == false and stun.Value == false and bl.Value == false then wait(0.05) end if IdleAndWalk == true and char.Humanoid.Jump == false and stun.Value == false and bl.Value == false then TARG1 = walk[8] TARG2 = walk[7] TARG3 = walk[6] TARG4 = walk[2] TARG5 = walk[1] TARG6 = walk[5] end if IdleAndWalk == true and char.Humanoid.Jump == false and stun.Value == false and bl.Value == false then wait(0.05) end if IdleAndWalk == true and char.Humanoid.Jump == false and stun.Value == false and bl.Value == false then wait(0.05) end if IdleAndWalk == true and char.Humanoid.Jump == false and stun.Value == false and bl.Value == false then wait(0.05) end if IdleAndWalk ~= true or char.Humanoid.Jump ~= false or stun.Value ~= false or bl.Value == false then wait(0.05) end -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_THEN_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_THEN_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out DO_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_THEN_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_THEN_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_THEN_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_THEN_STMT -- DECOMPILER ERROR at PC15155: LeaveBlock: unexpected jumping out IF_STMT end end end end end if IdleAndWalk ~= false or char.Humanoid.Jump ~= false or stun.Value ~= false or bl.Value == false then TARG1 = idle[5] * CFrame.Angles(0, 0, 0.04 * math.sin(tick())) TARG2 = idle[6] * CFrame.Angles(0, 0, -0.04 * math.sin(tick())) TARG3 = idle[2] * CFrame.Angles(0.07 * math.sin(tick()), 0, 0) TARG4 = idle[4] * CFrame.Angles(0.07 * math.sin(tick()), 0, 0) TARG5 = idle[3] * CFrame.Angles(0.07 * math.sin(tick()), 0, 0) TARG6 = idle[1] STARG = CFrame.new(0.2, -1, 0) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(-40)) end end
-- -- This is file `luatex-hyphen.lua', -- generated with the docstrip utility. -- -- The original source files were: -- -- luatex-hyphen.dtx (with options: `lua') -- -- This is a generated file (source: luatex-hyphen.dtx). -- -- Copyright (C) 2012 by The LuaLaTeX development team. -- -- This work is under the CC0 license. -- luatexhyphen = luatexhyphen or {} local luatexhyphen = luatexhyphen local function wlog(msg, ...) texio.write_nl('log', 'luatex-hyphen: '..msg:format(...)) end local function err(msg, ...) error('luatex-hyphen: '..msg:format(...), 2) end local dbname = "language.dat.lua" local language_dat local dbfile = kpse.find_file(dbname, 'lua') if not dbfile then err("file not found: "..dbname) else wlog('using data file: %s', dbfile) language_dat = dofile(dbfile) end local function lookupname(name) if language_dat[name] then return language_dat[name], name else for canon, data in pairs(language_dat) do for _,syn in ipairs(data.synonyms) do if syn == name then return data, canon end end end end end luatexhyphen.lookupname = lookupname local function loadlanguage(lname, id) if id == 0 then return end local msg = "loading%s patterns and exceptions for: %s (\\language%d)" local ldata, cname = lookupname(lname) if not ldata then err("no entry in %s for this language: %s", dbname, lname) end if ldata.special then if ldata.special:find('^disabled:') then err("language disabled by %s: %s (%s)", dbname, cname, ldata.special:gsub('^disabled:', '')) elseif ldata.special == 'language0' then err("\\language0 should be dumped in the format") else err("bad entry in %s for language %s") end end wlog(msg, '', cname, id) for _, item in ipairs{'patterns', 'hyphenation'} do local filelist = ldata[item] if filelist ~= nil and filelist ~= '' then for _, file in ipairs(filelist:explode(',')) do local file = kpse.find_file(file) or err("file not found: %s", file) local fh = io.open(file, 'r') local data = fh:read('*a') or err("file not readable: %s", f) fh:close() lang[item](lang.new(id), data) end else if item == 'hyphenation' then item = item..' exceptions' end wlog("info: no %s for this language", item) end end end luatexhyphen.loadlanguage = loadlanguage local function adddialect(dialect, language) if dialect ~= '0' then dialect = dialect:gsub('l@', '') language = language:gsub('l@', '') data = lookupname(language) if data then data.synonyms[#data.synonyms+1] = dialect end end end luatexhyphen.adddialect = adddialect -- -- End of File `luatex-hyphen.lua'.
local function not_ready() return false, "Sorry this refactor is not ready yet! But I appreciate you very much :)" end return not_ready
--[[ FPS Meter - Client v1.0 by: standardcombo See the FPSMeter_README for information about this module. --]] local UI_TEXT = script:GetCustomProperty("UIText") if UI_TEXT and UI_TEXT.isAssigned then UI_TEXT = UI_TEXT:WaitForObject() else UI_TEXT = nil end local WRITE_TO_GLOBAL = script:GetCustomProperty("WriteToGlobal") local PRINT_TO_SCREEN = script:GetCustomProperty("PrintToScreen") local WEIGHT = script:GetCustomProperty("RollingWeight") or 0.2 local averageDeltaTime = 1 / 60 local printToScreenDelay = 0 function Tick(deltaTime) averageDeltaTime = averageDeltaTime * (1 - WEIGHT) + deltaTime * WEIGHT if WRITE_TO_GLOBAL then _G.FPS = GetAverageFrameRate() end if UI_TEXT then UI_TEXT.text = GetFrameRateString() .. " fps" elseif PRINT_TO_SCREEN then printToScreenDelay = printToScreenDelay - deltaTime if printToScreenDelay <= 0 then printToScreenDelay = 3 UI.PrintToScreen(GetFrameRateString() .. " fps") end end end function GetAverageFrameRate() if averageDeltaTime <= 0 then return 999 end local fps = 1 / averageDeltaTime if fps > 999 then return 999 end return fps end function GetFrameRateString() local fps = GetAverageFrameRate() return string.format("%.2f", fps) end local function OnFrameRateRequest() local fps = GetAverageFrameRate() Events.BroadcastToServer("FrameRate", fps) end Events.Connect("FrameRateRequest", OnFrameRateRequest)
object_tangible_quest_township_ig88_feeder_component_03 = object_tangible_quest_township_shared_ig88_feeder_component_03:new { } ObjectTemplates:addTemplate(object_tangible_quest_township_ig88_feeder_component_03, "object/tangible/quest/township/ig88_feeder_component_03.iff")
local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA) combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR) function onGetFormulaValues(player, level, attack, factor) local distanceSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE) local skillDouble, levelTotal = distanceSkill * 2, level / 5 return -(((skillDouble + attack / 2500) * 0.5) + (levelTotal) + 7), -(((skillDouble + attack / 1875) * 0.75) + (levelTotal) + 13) end combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues") function onCastSpell(creature, var) return combat:execute(creature, var) end
----------------------------------------- -- ID: 4541 -- Item: Goblin Drink -- Item Effect: Restores 1 MP while healing / 3 tick 180 mins. ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") function onItemCheck(target) return 0 end function onItemUse(target) if (not target:hasStatusEffect(tpz.effect.FOOD)) then target:addStatusEffect(tpz.effect.FOOD, 1, 3, 10800, 4541) else target:messageBasic(tpz.msg.basic.NO_EFFECT) end end function onEffectGain(target, effect) end function onEffectTick(target, effect) if (target:hasStatusEffect(tpz.effect.HEALING)) then target:addMP(effect:getPower()) end end function onEffectLose(target, effect) end
#define 初始化 oninit #include "fl_base.lua" fl_point = nil; missions = {}; missions_count = 0; missions_number = {}; missions_star = {}; mission_page = 0; fl_mission = nil; fl_mission_left = 0; function oninit() fl_point = dlg_load("t_point"); fl_point:enable("background", true); fl_point.pos=Pixel(0,0); fl_point:bind_click("close", "返回主页面"); fl_mission = fl_point:search("missions"); fl_mission_left = fl_mission.left; fl_mission.width = mission_pagecount * gamewidth(); fl_mission.left = 0; mission_page = readi("mission_page"); print("AL"..mission_page); --writei("mojing", 1010000); --writei("quanjie", 1); local page_points = MISSION_PAGE_COUNT2; local index = 0; for j=1,mission_pagecount do index = (j-1) * page_points; local xbegin = (j-1) * gamewidth() + 30; for i=0,(page_points-1) do local star = readi("ok_"..(index+1)); missions[index] = draw_create(); missions[index].context = index; missions[index]:image("images/bg.png"); if (star>0) then missions[index]:image_mode("bg/pointbg"); else missions[index]:image_mode("bg/pointno"); end missions[index].center = Pixel(65,65); missions[index].pos = Pixel(25+(i%MISSION_WIDTH)*120 + xbegin, int(i/MISSION_WIDTH) * 120); missions[index]:bind_click(""); missions_number[index] = missions[index]:add_child(); missions_number[index]:number_mode("combo_number/", 54, 0); missions_number[index].pos = Pixel(0, -20); missions_number[index].number = (index+1); missions_star[index] = {}; --writei("ok_"..(index+1), 5); missions[index].enabled = (star>0); missions_number[index].enabled = (star>0); if star > 4 then star = 4; end if star > 0 then for s=1,3 do missions_star[index][s] = missions[index]:add_child(); missions_star[index][s]:image_mode("bg/crystal"); missions_star[index][s].center = Pixel(38,38); missions_star[index][s].pos = Pixel((s-1)*38-12, 45); missions_star[index][s].scale = 0.5; missions_star[index][s].enabled = (star > s); end end fl_mission:bind_draw(missions[index]); index = index + 1; if index >= MAX_MISSIONS then break; end end end missions_count = index; 更新页面豆(); bind_input("down", "手指按下"); bind_input("up", "手指弹起"); bind_input("move", "手指移动"); page_left = -mission_page* gamewidth(); fl_mission.left = page_left; end function 进入关卡(v) local index = v.context; if missions[index].enabled then setvali("current", index + 1); local w = index*2+4; if w > 10 then w = 10; end setvali("current_w", w); setvali("current_h", w); goto("fl_game"); end end 手指按下值 = nil; 手指按下点 = nil; 手指是否按下 = false; 手指按下mission = nil; function 手指按下(pt) if pt.y > 100 and pt.y < (gameheight()-50) then pt = fl_mission:mousepoint(); cleartime("自动对齐到页面"); 手指是否按下 = true; 手指按下值 = pt; 手指按下点 = pt; for i=0,(missions_count-1) do local rc = missions[i]:draw_rect(); if point_in(rc, pt) and missions[i].enabled then missions[i].scale = 1.2; 手指按下mission = missions[i]; break; end end end end function 手指移动(pt) if 手指按下值~= nil and abs(pt.x-手指按下值.x)<5 and abs(pt.y-手指按下值.y)<5 then return; end if 手指是否按下 then pt = fl_mission:mousepoint(); local off = pt - 手指按下值; local newleft = fl_mission.left + off.x; if newleft > fl_mission_left then newleft = fl_mission_left; elseif newleft < (-gamewidth()*(mission_pagecount-1)) then newleft = (-gamewidth()*(mission_pagecount-1)); end fl_mission.left = newleft; 手指按下值 = pt; end end page_dir = 0; page_left = 0; function 自动对齐到页面(tm,endof,param,maxtm)--tm是秒计数的小数,maxtm最大时间,endof只有在计时器结束的时候被调用一次,param是自定义传入的参数 page_left = page_left + page_dir; page_dir = page_dir + symbol(page_dir)*50; local newpage_left = -mission_page* gamewidth(); if page_dir > 0 then if page_left > newpage_left then page_left = newpage_left; cleartime("自动对齐到页面"); end elseif page_left < newpage_left then page_left = newpage_left; cleartime("自动对齐到页面"); end fl_mission.left = page_left; end function 手指弹起(pt) if 手指按下点 == nil then return; end pt = fl_mission:mousepoint(); local jl = pt - 手指按下点; if 手指按下mission ~= nil then 手指按下mission.scale = 1; 手指按下mission = nil; end if 手指是否按下 then if (jl.x*jl.x+jl.y*jl.y)<MAX_CLICK_REGION then for i=0,(missions_count-1) do local rc = missions[i]:draw_rect(); if point_in(rc, pt) then 进入关卡(missions[i]); break; end end else local offsetX = fl_mission.left % gamewidth() - (gamewidth()/2); local off = 手指按下点 - pt; if off.x > 100 then --if offsetX < -200 then --mission_page = mission_page + 1; mission_page = -int(fl_mission.left / gamewidth()) + 1; --end elseif off.x < -100 then mission_page = -int(fl_mission.left / gamewidth()); end if mission_page < 0 then mission_page = 0 elseif mission_page >= mission_pagecount then mission_page = mission_pagecount - 1; end writei("mission_page", mission_page); print("sAL"..mission_page); local newpage_left = -mission_page * gamewidth(); page_left = fl_mission.left; page_dir = symbol(newpage_left - page_left) * 100; interval("自动对齐到页面", 50, 10000); --page_left = -(mission_page-1)* gamewidth(); 更新页面豆(); end end 手指按下点 = nil; 手指是否按下 = false; end function 更新页面豆() local title = fl_point:search("title"); title:element_at(0).texturemode="point"..(mission_page+1); for i=0,(mission_pagecount-1) do fl_point:enable("page"..(i+1), (i==mission_page)); end end
--====================================================================-- -- Websockets Pusher -- -- Communicate with Pusher.com server -- -- Sample code is MIT licensed, the same license which covers Lua itself -- http://en.wikipedia.org/wiki/MIT_License -- Copyright (C) 2014 David McCuskey. All Rights Reserved. --====================================================================-- print( '\n\n##############################################\n\n' ) --====================================================================-- -- Imports local WebSockets = require 'dmc_corona.dmc_websockets' -- local Utils = require( "dmc_corona.dmc_utils" ) --====================================================================-- -- Setup, Constants local ws --====================================================================-- -- Support Functions -- none --====================================================================-- -- Main Functions local function webSocketsEvent_handler( event ) -- print( "webSocketsEvent_handler", event.type ) local evt_type = event.type if evt_type == ws.ONOPEN then print( 'Received event: ONOPEN' ) elseif evt_type == ws.ONMESSAGE then local msg = event.message print( "Received event: ONMESSAGE" ) print( "message: '" .. tostring( msg.data ) .. "'\n\n" ) elseif evt_type == ws.ONCLOSE then print( "Received event: ONCLOSE" ) print( 'code:reason', event.code, event.reason ) elseif evt_type == ws.ONERROR then print( "Received event: ONERROR" ) end end ws = WebSockets{ -- non-secure -- uri='ws://ws.pusherapp.com:80/app/a6fc0e5ee5adc489d1ac?client=lua&version=1.0&protocol=7', -- secure (SSL/TLS) uri='wss://ws.pusherapp.com:443/app/a6fc0e5ee5adc489d1ac?client=lua&version=1.0&protocol=7', -- port can be here, or in URI -- port=443, -- 80/443 protocols='7' } ws:addEventListener( ws.EVENT, webSocketsEvent_handler )
RegisterCommand('adjcar', function(source, args) -- Sentinel Classic if no arg is passed local vehicleName = args[1] or 'sentinel3' if not IsModelInCdimage(vehicleName) or not IsModelAVehicle(vehicleName) then TriggerEvent('chat:addMessage', { args = { 'Nope' } }) return end -- Load model RequestModel(vehicleName) while not HasModelLoaded(vehicleName) do Wait(500) end -- get the player's position local playerPed = PlayerPedId() local pos = GetEntityCoords(playerPed) -- create the vehicle local vehicle = CreateVehicle(vehicleName, pos.x, pos.y, pos.z, GetEntityHeading(playerPed), true, false) SetVehicleMod(vehicle, 15, 3) SetPedIntoVehicle(playerPed, vehicle, -1) SetEntityAsNoLongerNeeded(vehicle) SetModelAsNoLongerNeeded(vehicleName) end, false) RegisterCommand('adjgetpos', function(source, args) -- get the player's position local pos = GetEntityCoords(PlayerPedId()) TriggerEvent('chat:addMessage', { args = { 'X: ' .. pos.x .. ' Y: ' .. pos.y .. ' Z: ' .. pos.z } }) TriggerServerEvent('adjutor:logpos', pos) end, false)
--[[ This file adds a Pokémon with missing informations to data modules, in order to test against it. The Pokémon is SnorloBello, and has no ndex, but the load function may or may not load many other informations. --]] local pokes = require('Poké-data') local pokeabils = require('PokéAbil-data') local eggs = require('PokéEggGroup-data') local items = require('PokéItems-data') local stats = require('PokéStats-data') local evos = require('Evo-data') --[[ Add SnorloBello to data modules. The only argument is a set of flags: - types (default true): SnorloBello has types - abil (default false): SnorloBello has an ability - eggs (default false): SnorloBello has an egg group - stats (default false): SnorloBello has a set of stats SnorloBello has a name and never has an ndex. Moreover, it doesn't have any evolution, but may have some types, an ability, an egg group or some stats. --]] local function loadSnorloBello(load) local name = "SnorloBello" local nameidx = name:lower() pokes[nameidx] = { name = name } if load.types == nil or load.types then pokes[nameidx].type1, pokes[nameidx].type2 = "Psico", "Psico" end pokeabils[nameidx] = { ability1 = '' } if load.abil then pokeabils[nameidx].ability1 = "Burla" end if load.eggs then eggs[nameidx] = { group1 = "mostro" } end items[nameidx] = {} if load.stats then stats[nameidx] = {hp = 45, atk = 49, def = 49, spatk = 65, spdef = 65, spe = 45, spec = 65} end evos[nameidx] = { ndex = nil, name = nameidx } end return loadSnorloBello
-- Copyright 2021 Sonu Kumar -- -- 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 -- -- https://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. -- -- get head of queue local values = redis.call('LRANGE', KEYS[1], 0, tonumber(ARGV[3]) - 1) if #values > 0 then for _, value in ipairs(values) do -- push to processing set redis.call('ZADD', KEYS[2], ARGV[2], value) -- remove from the queue redis.call('LPOP', KEYS[1]) end end; --if elements with lower priority are on the head of processing queue local v = redis.call('ZRANGE', KEYS[2], 0, 0, 'WITHSCORES') if v[1] ~= nil and tonumber(v[2]) < tonumber(ARGV[1]) then redis.call('PUBLISH', KEYS[3], v[2]) end return values;
local Engine = NeP.Engine local faceroll = { buttonMap = { }, lastFrame = false, rolling = false, bars = { "ActionButton", "MultiBarBottomRightButton", "MultiBarBottomLeftButton", "MultiBarRightButton", "MultiBarLeftButton" } } NeP.FaceRoll = CreateFrame('Frame', 'activeCastFrame', UIParent) local activeFrame = NeP.FaceRoll activeFrame:SetWidth(32) activeFrame:SetHeight(32) activeFrame:SetPoint("CENTER", UIParent, "CENTER") activeFrame.glow = activeFrame:CreateTexture() activeFrame.glow:SetTexture(0,1,1,1) activeFrame.glow:SetAllPoints(activeFrame) activeFrame.glow.texture = activeFrame:CreateTexture() activeFrame.glow.texture:SetTexture("Interface/TARGETINGFRAME/UI-RaidTargetingIcon_8") --activeFrame.glow.texture:SetVertexColor(0, 1, 0, 1) activeFrame.glow.texture:SetAllPoints(activeFrame) activeFrame:SetFrameStrata('HIGH') activeFrame:Hide() local function showActiveSpell(spell) local spellButton = faceroll.buttonMap[spell] if spellButton and spell then activeFrame:Show() activeFrame:SetPoint("CENTER", spellButton, "CENTER") end end local frame = CreateFrame("FRAME", "FooAddonFrame"); frame:RegisterEvent("ACTIONBAR_SLOT_CHANGED"); frame:RegisterEvent("PLAYER_ENTERING_WORLD"); frame:SetScript("OnEvent", function(self, event, ...) wipe(faceroll.buttonMap) for _, group in ipairs(faceroll.bars) do for i =1, 12 do local button = _G[group .. i] if button then local actionType, id, subType = GetActionInfo(ActionButton_CalculateAction(button, "LeftButton")) if actionType == 'spell' then local spell = GetSpellInfo(id) if spell then faceroll.buttonMap[spell] = button end end end end end end) -- cast on ground function Engine.CastGround(spell, target) end -- Cast function Engine.Cast(spell, target) showActiveSpell(spell) end -- Macro function Engine.Macro(text) end function Engine.UseItem(name, target) end function Engine.UseInvItem(slot) end function Engine.LineOfSight(a, b) return true end -- Distance local rangeCheck = LibStub("LibRangeCheck-2.0") function Engine.Distance(a, b) if UnitExists(b) then local minRange, maxRange = rangeCheck:GetRange(b) return maxRange or minRange end return 0 end -- Infront function Engine.Infront(a, b) return true end --[[ Generic OM ---------------------------------------------------]] local function GenericFilter(unit, objectDis) if UnitExists(unit) then local objectName = UnitName(unit) local alreadyExists = false -- Friendly Filter if UnitCanAttack('player', unit) then for i=1, #NeP.TempOM.unitEnemie do local object = NeP.TempOM.unitEnemie[i] if object.distance == objectDis and object.name == objectName then alreadyExists = true end end -- Enemie Filter elseif UnitIsFriend('player', unit) then for i=1, #NeP.TempOM.unitFriend do local object = NeP.TempOM.unitFriend[i] if object.distance == objectDis and object.name == objectName then alreadyExists = true end end end if not alreadyExists then return true end end return false end function NeP.OM.Maker() -- Self NeP.OM.addToOM('player', 5) -- Mouseover if UnitExists('mouseover') then local object = 'mouseover' local ObjDistance = Engine.Distance('player', object) if GenericFilter(object, ObjDistance) then if ObjDistance <= 100 then NeP.OM.addToOM(object) end end end -- Target Cache if UnitExists('target') then local object = 'target' local ObjDistance = Engine.Distance('player', object) if GenericFilter(object, ObjDistance) then if ObjDistance <= 100 then NeP.OM.addToOM(object) end end end -- If in Group scan frames... if IsInGroup() or IsInRaid() then local prefix = (IsInRaid() and 'raid') or 'party' for i = 1, GetNumGroupMembers() do -- Enemie local target = prefix..i..'target' local ObjDistance = Engine.Distance('player', target) if GenericFilter(target, ObjDistance) then if ObjDistance <= 100 then NeP.OM.addToOM(target) end end -- Friendly local friendly = prefix..i local ObjDistance = Engine.Distance('player', friendly) if GenericFilter(friendly, ObjDistance) then if ObjDistance <= 100 then NeP.OM.addToOM(friendly) end end end end end
--[[ Copyright © 2019, Sjshovan (Apogee) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Clutch nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Sjshovan (Apogee) BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]]-- if Clutch == nil then Clutch = {} end Clutch.name = "Clutch" Clutch.version = "0.9.1" Clutch.author = "Sjshovan (Apogee)" Clutch.contact = "Sjshovan@Gmail.com" Clutch.url_readme = "https://github.com/Ap0gee/Clutch" Clutch.description = "Clutch aims to prevent weapons from falling to the ground and grants the ability to pick them back up if they do." Clutch.commands = {"/clutch", "/clch"} Clutch.collectibles = { none = 0, hats = { hide_your_helm = 5002 } } Clutch.colors = { info = "eeeeee", primary = "9ab3e5", secondary = "6c757d", success = "28a745", warning = "ffc107", danger = "dc3545", } local function cStr(color, str) return string.format("|c%s%s|r", color, str) end local function buildHelpEntryCommand(command, description) local addon_name = cStr(Clutch.colors.primary, "/"..string.lower(Clutch.name)) local command = cStr(Clutch.colors.info, command) local description = cStr(Clutch.colors.info, description) local sep = cStr(Clutch.colors.secondary, "=>") return string.format("%s %s %s %s", addon_name, command, sep, description) end local function buildHelpEntry(key, value) local key = cStr(Clutch.colors.primary, key) local value = cStr(Clutch.colors.info, value) local sep = cStr(Clutch.colors.secondary, "=>") return string.format("%s %s %s", key, sep, value) end local function buildHelpTitle(context) local context = cStr(Clutch.colors.info, context) local title = cStr(Clutch.colors.primary, string.format("%s Help:", Clutch.name)) return string.format("%s %s", title, context) end local function buildHelpSeperator(character, count) local sep = '' for i = 1, count do sep = sep .. character end return cStr(Clutch.colors.secondary, sep) end function Clutch.displayHelp(table_help) for index, command in pairs(table_help) do d(command) end end function Clutch.clutchWeapons() local collectible_hat_active = GetActiveCollectibleByType(COLLECTIBLE_CATEGORY_TYPE_HAT) if collectible_hat_active == Clutch.collectibles.none or collectible_hat_active == Clutch.collectibles.hats.hide_your_helm then UseCollectible(Clutch.collectibles.hats.hide_your_helm) UseCollectible(Clutch.collectibles.hats.hide_your_helm) else UseCollectible(Clutch.collectibles.hats.hide_your_helm) UseCollectible(collectible_hat_active) end end function Clutch.onBoundKeyPress() d(string.format("%s: %s", cStr(Clutch.colors.primary, Clutch.name), cStr(Clutch.colors.info, "Activated!") )) Clutch.clutchWeapons() end function Clutch.onPlayerActivated() if not Clutch.startup_info_displayed then d(string.format("%s %s %s", cStr(Clutch.colors.primary, Clutch.name), cStr(Clutch.colors.info, string.format("v%s ~", Clutch.version)), cStr(Clutch.colors.primary, Clutch.author) )) Clutch.startup_info_displayed = true end Clutch.clutchWeapons() end function Clutch.onCommandEntered(args) if args == 'activate' or args == 'a' then Clutch.onBoundKeyPress() elseif args == 'info' or args == 'i' then Clutch.displayHelp(Clutch.help.info) elseif args == 'help' or args == 'h' then Clutch.displayHelp(Clutch.help.commands) else Clutch.displayHelp(Clutch.help.commands) end end function Clutch.onAddonLoaded(eventCode, addonName) if addonName ~= Clutch.name then return end EVENT_MANAGER:UnregisterForEvent(Clutch.name, EVENT_ADD_ON_LOADED) ZO_CreateStringId("SI_BINDING_NAME_CLUTCH_WEAPONS", "Clutch Weapons") for index, command in pairs(Clutch.commands) do SLASH_COMMANDS[command] = Clutch.onCommandEntered end Clutch.help = { commands = { buildHelpSeperator("=", 20), buildHelpTitle("Commands"), buildHelpSeperator('=', 20), buildHelpEntryCommand("[activate, a]", "Activate Clutch and pick up your weapons."), buildHelpEntryCommand("[help, h]", "Display Clutch commands."), buildHelpEntryCommand("[info, i]", "Display information about Clutch."), buildHelpSeperator("=", 20), }, info = { buildHelpSeperator("=", 14), buildHelpTitle("Info"), buildHelpSeperator('=', 14), buildHelpEntry("Name", Clutch.name), buildHelpEntry("Description", Clutch.description), buildHelpEntry("Author", Clutch.author), buildHelpEntry("Contact", Clutch.contact), buildHelpEntry("README", Clutch.url_readme), buildHelpEntry("Version", Clutch.version), buildHelpSeperator('=', 14), } } EVENT_MANAGER:RegisterForEvent(Clutch.name, EVENT_PLAYER_ACTIVATED, Clutch.onPlayerActivated) end EVENT_MANAGER:RegisterForEvent(Clutch.name, EVENT_ADD_ON_LOADED, Clutch.onAddonLoaded)
local oo = oo local SingleTexture = require("gwen.skins.texturing.single") local BorderedTexture = require("gwen.skins.texturing.bordered") local SkinBase = require("gwen.skins.base") local TexturedSkin = oo.InheritClass(SkinBase, "Gwen.Skin.Textured") local function NewBordered(...) local obj = BorderedTexture.New() obj:Init(...) return obj end local function NewSingle(...) local obj = SingleTexture.New() obj:Init(...) return obj end function TexturedSkin:Init(renderer, texName, fontName) -- texName is the name of the texture that will be given to the renderer self.renderer = renderer self.tex = self.renderer:LoadTexture(texName) self.defaultFont = self.renderer:LoadFont(fontName) self:InitializeColors() self:InitializeTextures() end function TexturedSkin:InitializeColors() -- TODO: Grab colour out of texture data -- These colours will have to be hard coded for the moment self.Colors = {} self.Colors.Window = {} self.Colors.Window.TitleActive = GwenColor(255, 255, 255, 204) self.Colors.Window.TitleInactive = GwenColor(255, 255, 255, 92) self.Colors.Label = {} self.Colors.Label.Default = GwenColor(209, 209, 209, 255) self.Colors.Label.Bright = GwenColor(255, 255, 255, 255) self.Colors.Label.Dark = GwenColor(10, 10, 10, 255) self.Colors.Label.Highlight = GwenColor(255, 0, 0, 255) self.Colors.Tree = {} self.Colors.Tree.Lines = GwenColor(202, 209, 215, 255) self.Colors.Tree.Normal = GwenColor(94, 102, 110, 255) self.Colors.Tree.Hover = GwenColor(51, 148, 240, 255) self.Colors.Tree.Selected = GwenColor(255, 255, 255, 255) self.Colors.Properties = {} self.Colors.Properties.Line_Normal = GwenColor(156, 156, 156, 255) self.Colors.Properties.Line_Selected = GwenColor(156, 156, 156, 255) self.Colors.Properties.Line_Hover = GwenColor(156, 156, 156, 255) self.Colors.Properties.Column_Normal = GwenColor(255, 255, 255, 0) self.Colors.Properties.Column_Selected = GwenColor(118, 199, 255, 255) self.Colors.Properties.Column_Hover = GwenColor(118, 199, 255, 59) self.Colors.Properties.Label_Normal = GwenColor(115, 115, 115, 255) self.Colors.Properties.Label_Selected = GwenColor(255, 255, 255, 255) self.Colors.Properties.Label_Hover = GwenColor(168, 168, 168, 255) self.Colors.Properties.Border = GwenColor(210, 211, 212, 255) self.Colors.Properties.Title = GwenColor(67, 67, 67, 255) self.Colors.Button = {} self.Colors.Button.Normal = GwenColor(82, 82, 82, 255) self.Colors.Button.Hover = GwenColor(46, 114, 178, 255) self.Colors.Button.Down = GwenColor(255, 255, 255, 255) self.Colors.Button.Disabled = GwenColor(82, 82, 82, 179) self.Colors.Tab = {} self.Colors.Tab.Active = {} self.Colors.Tab.Active.Normal = GwenColor(255, 255, 255, 255) self.Colors.Tab.Active.Hover = GwenColor(255, 255, 255, 255) self.Colors.Tab.Active.Down = GwenColor(255, 255, 255, 255) self.Colors.Tab.Active.Disabled = GwenColor(233, 233, 233, 204) self.Colors.Tab.Inactive = {} self.Colors.Tab.Inactive.Normal = GwenColor(255, 255, 255, 102) self.Colors.Tab.Inactive.Hover = GwenColor(249, 249, 249, 153) self.Colors.Tab.Inactive.Down = GwenColor(255, 255, 255, 255) self.Colors.Tab.Inactive.Disabled = GwenColor(210, 210, 210, 204) self.Colors.Category = {} self.Colors.Category.Header = GwenColor(255, 255, 255, 230) self.Colors.Category.Header_Closed = GwenColor(255, 255, 255, 153) self.Colors.Category.Line = {} self.Colors.Category.Line.Text = GwenColor(119, 119, 119, 255) self.Colors.Category.Line.Text_Hover = GwenColor(255, 255, 255, 255) self.Colors.Category.Line.Text_Selected = GwenColor(255, 255, 255, 255) self.Colors.Category.Line.Button = GwenColor(255, 255, 255, 0) self.Colors.Category.Line.Button_Hover = GwenColor(255, 255, 255, 0) self.Colors.Category.Line.Button_Selected = GwenColor(255, 216, 0, 255) self.Colors.Category.LineAlt = {} self.Colors.Category.LineAlt.Text = GwenColor(136, 136, 136, 255) self.Colors.Category.LineAlt.Text_Hover = GwenColor(255, 255, 255, 255) self.Colors.Category.LineAlt.Text_Selected = GwenColor(255, 255, 255, 255) self.Colors.Category.LineAlt.Button = GwenColor(0, 0, 0, 26) self.Colors.Category.LineAlt.Button_Hover = GwenColor(0, 0, 0, 26) self.Colors.Category.LineAlt.Button_Selected = GwenColor(255, 216, 0, 255) self.Colors.ModalBackground = GwenColor(255, 255, 255, 51) self.Colors.TooltipText = GwenColor(124, 124, 124, 255) end function TexturedSkin:InitializeTextures() -- TODO: Alignment local tex = self.tex self.Textures = {} self.Textures.Shadow = NewBordered(tex, 448, 0, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Tooltip = NewBordered(tex, 128, 320, 127, 31, GwenMargin(8, 8, 8, 8)) self.Textures.StatusBar = NewBordered(tex, 128, 288, 127, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Selection = NewBordered(tex, 384, 32, 31, 31, GwenMargin(4, 4, 4, 4)) self.Textures.Panel = {} self.Textures.Panel.Normal = NewBordered(tex, 256, 0, 63, 63, GwenMargin(16, 16, 16, 16)) self.Textures.Panel.Bright = NewBordered(tex, 256 + 64, 0, 63, 63, GwenMargin(16, 16, 16, 16)) self.Textures.Panel.Dark = NewBordered(tex, 256, 64, 63, 63, GwenMargin(16, 16, 16, 16)) self.Textures.Panel.Highlight = NewBordered(tex, 256 + 64, 64, 63, 63, GwenMargin(16, 16, 16, 16)) self.Textures.Window = {} self.Textures.Window.Normal = NewBordered(tex, 0, 0, 127, 127, GwenMargin(8, 32, 8, 8)) self.Textures.Window.Inactive = NewBordered(tex, 128, 0, 127, 127, GwenMargin(8, 32, 8, 8)) self.Textures.Checkbox = {} self.Textures.Checkbox.Active = {} self.Textures.Checkbox.Active.Checked = NewSingle(tex, 448, 32, 15, 15) self.Textures.Checkbox.Active.Normal = NewSingle(tex, 464, 32, 15, 15) self.Textures.Checkbox.Disabled = {} self.Textures.Checkbox.Disabled.Checked = NewSingle(tex, 448, 48, 15, 15) self.Textures.Checkbox.Disabled.Normal = NewSingle(tex, 464, 48, 15, 15) self.Textures.RadioButton = {} self.Textures.RadioButton.Active = {} self.Textures.RadioButton.Active.Checked = NewSingle(tex, 448, 64, 15, 15) self.Textures.RadioButton.Active.Normal = NewSingle(tex, 464, 64, 15, 15) self.Textures.RadioButton.Disabled = {} self.Textures.RadioButton.Disabled.Checked = NewSingle(tex, 448, 80, 15, 15) self.Textures.RadioButton.Disabled.Normal = NewSingle(tex, 464, 80, 15, 15) self.Textures.TextBox = {} self.Textures.TextBox.Normal = NewBordered(tex, 0, 150, 127, 21, GwenMargin(4, 4, 4, 4)) self.Textures.TextBox.Focus = NewBordered(tex, 0, 172, 127, 21, GwenMargin(4, 4, 4, 4)) self.Textures.TextBox.Disabled = NewBordered(tex, 0, 193, 127, 21, GwenMargin(4, 4, 4, 4)) self.Textures.Menu = {} self.Textures.Menu.Strip = NewBordered(tex, 0, 128, 127, 21, GwenMargin(1, 1, 1, 1)) self.Textures.Menu.BackgroundWithMargin = NewBordered(tex, 128, 128, 127, 63, GwenMargin(24, 8, 8, 8)) self.Textures.Menu.Background = NewBordered(tex, 128, 192, 127, 63, GwenMargin(8, 8, 8, 8)) self.Textures.Menu.Hover = NewBordered(tex, 128, 256, 127, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Menu.RightArrow = NewSingle(tex, 464, 112, 15, 15) self.Textures.Menu.Check = NewSingle(tex, 448, 112, 15, 15) self.Textures.Tab = {} self.Textures.Tab.Control = NewBordered(tex, 0, 256, 127, 127, GwenMargin(8, 8, 8, 8)) self.Textures.Tab.Bottom = {} self.Textures.Tab.Bottom.Active = NewBordered(tex, 0, 416, 63, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Tab.Bottom.Inactive = NewBordered(tex, 0 + 128, 416, 63, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Tab.Top = {} self.Textures.Tab.Top.Active = NewBordered(tex, 0, 384, 63, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Tab.Top.Inactive = NewBordered(tex, 0 + 128, 384, 63, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Tab.Left = {} self.Textures.Tab.Left.Active = NewBordered(tex, 64, 384, 31, 63, GwenMargin(8, 8, 8, 8)) self.Textures.Tab.Left.Inactive = NewBordered(tex, 64 + 128, 384, 31, 63, GwenMargin(8, 8, 8, 8)) self.Textures.Tab.Right = {} self.Textures.Tab.Right.Active = NewBordered(tex, 96, 384, 31, 63, GwenMargin(8, 8, 8, 8)) self.Textures.Tab.Right.Inactive = NewBordered(tex, 96 + 128, 384, 31, 63, GwenMargin(8, 8, 8, 8)) self.Textures.Tab.HeaderBar = NewBordered(tex, 128, 352, 127, 31, GwenMargin(4, 4, 4, 4)) self.Textures.Window = {} self.Textures.Window.Close = NewSingle(tex, 32, 448, 31, 31) self.Textures.Window.Close_Hover = NewSingle(tex, 64, 448, 31, 31) self.Textures.Window.Close_Down = NewSingle(tex, 96, 448, 31, 31) self.Textures.Window.Maxi = NewSingle(tex, 32 + 96 * 2, 448, 31, 31) self.Textures.Window.Maxi_Hover = NewSingle(tex, 64 + 96 * 2, 448, 31, 31) self.Textures.Window.Maxi_Down = NewSingle(tex, 96 + 96 * 2, 448, 31, 31) self.Textures.Window.Restore = NewSingle(tex, 32 + 96 * 2, 448 + 32, 31, 31) self.Textures.Window.Restore_Hover = NewSingle(tex, 64 + 96 * 2, 448 + 32, 31, 31) self.Textures.Window.Restore_Down = NewSingle(tex, 96 + 96 * 2, 448 + 32, 31, 31) self.Textures.Window.Mini = NewSingle(tex, 32 + 96, 448, 31, 31) self.Textures.Window.Mini_Hover = NewSingle(tex, 64 + 96, 448, 31, 31) self.Textures.Window.Mini_Down = NewSingle(tex, 96 + 96, 448, 31, 31) self.Textures.Tree = {} self.Textures.Tree.Background = NewBordered(tex, 256, 128, 127, 127, GwenMargin(16, 16, 16, 16)) self.Textures.Tree.Plus = NewSingle(tex, 448, 96, 15, 15) self.Textures.Tree.Minus = NewSingle(tex, 464, 96, 15, 15) self.Textures.Input = {} self.Textures.Input.Button = {} self.Textures.Input.Button.Normal = NewBordered(tex, 480, 0, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Input.Button.Hovered = NewBordered(tex, 480, 32, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Input.Button.Disabled = NewBordered(tex, 480, 64, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Input.Button.Pressed = NewBordered(tex, 480, 96, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Scroller = {} self.Textures.Scroller.LeftButton_Normal = NewBordered(tex, 464, 208, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.LeftButton_Hover = NewBordered(tex, 480, 208, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.LeftButton_Down = NewBordered(tex, 464, 272, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.LeftButton_Disabled = NewBordered(tex, 480 + 48, 272, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.UpButton_Normal = NewBordered(tex, 464, 208 + 16, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.UpButton_Hover = NewBordered(tex, 480, 208 + 16, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.UpButton_Down = NewBordered(tex, 464, 272 + 16, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.UpButton_Disabled = NewBordered(tex, 480 + 48, 272 + 16, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.RightButton_Normal = NewBordered(tex, 464, 208 + 32, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.RightButton_Hover = NewBordered(tex, 480, 208 + 32, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.RightButton_Down = NewBordered(tex, 464, 272 + 32, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.RightButton_Disabled = NewBordered(tex, 480 + 48, 272 + 32, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.DownButton_Normal = NewBordered(tex, 464, 208 + 48, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.DownButton_Hover = NewBordered(tex, 480, 208 + 48, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.DownButton_Down = NewBordered(tex, 464, 272 + 48, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.DownButton_Disabled = NewBordered(tex, 480 + 48, 272 + 48, 15, 15, GwenMargin(2, 2, 2, 2)) self.Textures.Scroller.TrackV = NewBordered(tex, 384, 208, 15, 127, GwenMargin(4, 4, 4, 4)) self.Textures.Scroller.ButtonV_Normal = NewBordered(tex, 384 + 16, 208, 15, 127, GwenMargin(4, 4, 4, 4)) self.Textures.Scroller.ButtonV_Hover = NewBordered(tex, 384 + 32, 208, 15, 127, GwenMargin(4, 4, 4, 4)) self.Textures.Scroller.ButtonV_Down = NewBordered(tex, 384 + 48, 208, 15, 127, GwenMargin(4, 4, 4, 4)) self.Textures.Scroller.ButtonV_Disabled = NewBordered(tex, 384 + 64, 208, 15, 127, GwenMargin(4, 4, 4, 4)) self.Textures.Scroller.TrackH = NewBordered(tex, 384, 128, 127, 15, GwenMargin(4, 4, 4, 4)) self.Textures.Scroller.ButtonH_Normal = NewBordered(tex, 384, 128 + 16, 127, 15, GwenMargin(4, 4, 4, 4)) self.Textures.Scroller.ButtonH_Hover = NewBordered(tex, 384, 128 + 32, 127, 15, GwenMargin(4, 4, 4, 4)) self.Textures.Scroller.ButtonH_Down = NewBordered(tex, 384, 128 + 48, 127, 15, GwenMargin(4, 4, 4, 4)) self.Textures.Scroller.ButtonH_Disabled = NewBordered(tex, 384, 128 + 64, 127, 15, GwenMargin(4, 4, 4, 4)) self.Textures.Input.ListBox = {} self.Textures.Input.ListBox.Background = NewBordered(tex, 256, 256, 63, 127, GwenMargin(8, 8, 8, 8)) self.Textures.Input.ListBox.Hovered = NewBordered(tex, 320, 320, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Input.ListBox.EvenLine = NewBordered(tex, 352, 256, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Input.ListBox.OddLine = NewBordered(tex, 352, 288, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Input.ListBox.EvenLineSelected = NewBordered(tex, 320, 256, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Input.ListBox.OddLineSelected = NewBordered(tex, 320, 288, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Input.ComboBox = {} self.Textures.Input.ComboBox.Normal = NewBordered(tex, 384, 336, 127, 31, GwenMargin(8, 8, 32, 8)) self.Textures.Input.ComboBox.Hover = NewBordered(tex, 384, 336 + 32, 127, 31, GwenMargin(8, 8, 32, 8)) self.Textures.Input.ComboBox.Down = NewBordered(tex, 384, 336 + 64, 127, 31, GwenMargin(8, 8, 32, 8)) self.Textures.Input.ComboBox.Disabled = NewBordered(tex, 384, 336 + 96, 127, 31, GwenMargin(8, 8, 32, 8)) self.Textures.Input.ComboBox.Button = {} self.Textures.Input.ComboBox.Button.Normal = NewSingle(tex, 496, 272, 15, 15) self.Textures.Input.ComboBox.Button.Hover = NewSingle(tex, 496, 272 + 16, 15, 15) self.Textures.Input.ComboBox.Button.Down = NewSingle(tex, 496, 272 + 32, 15, 15) self.Textures.Input.ComboBox.Button.Disabled = NewSingle(tex, 496, 272 + 48, 15, 15) self.Textures.Input.UpDown = {} self.Textures.Input.UpDown.Up = {} self.Textures.Input.UpDown.Up.Normal = NewSingle(tex, 384, 112, 7, 7) self.Textures.Input.UpDown.Up.Hover = NewSingle(tex, 384 + 8, 112, 7, 7) self.Textures.Input.UpDown.Up.Down = NewSingle(tex, 384 + 16, 112, 7, 7) self.Textures.Input.UpDown.Up.Disabled = NewSingle(tex, 384 + 24, 112, 7, 7) self.Textures.Input.UpDown.Down = {} self.Textures.Input.UpDown.Down.Normal = NewSingle(tex, 384, 120, 7, 7) self.Textures.Input.UpDown.Down.Hover = NewSingle(tex, 384 + 8, 120, 7, 7) self.Textures.Input.UpDown.Down.Down = NewSingle(tex, 384 + 16, 120, 7, 7) self.Textures.Input.UpDown.Down.Disabled = NewSingle(tex, 384 + 24, 120, 7, 7) self.Textures.ProgressBar = {} self.Textures.ProgressBar.Back = NewBordered(tex, 384, 0, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.ProgressBar.Front = NewBordered(tex, 384 + 32, 0, 31, 31, GwenMargin(8, 8, 8, 8)) self.Textures.Input.Slider = {} self.Textures.Input.Slider.H = {} self.Textures.Input.Slider.H.Normal = NewSingle(tex, 416, 32, 15, 15) self.Textures.Input.Slider.H.Hover = NewSingle(tex, 416, 32 + 16, 15, 15) self.Textures.Input.Slider.H.Down = NewSingle(tex, 416, 32 + 32, 15, 15) self.Textures.Input.Slider.H.Disabled = NewSingle(tex, 416, 32 + 48, 15, 15) self.Textures.Input.Slider.V = {} self.Textures.Input.Slider.V.Normal = NewSingle(tex, 416 + 16, 32, 15, 15) self.Textures.Input.Slider.V.Hover = NewSingle(tex, 416 + 16, 32 + 16, 15, 15) self.Textures.Input.Slider.V.Down = NewSingle(tex, 416 + 16, 32 + 32, 15, 15) self.Textures.Input.Slider.V.Disabled = NewSingle(tex, 416 + 16, 32 + 48, 15, 15) self.Textures.CategoryList = {} self.Textures.CategoryList.Outer = NewBordered(tex, 256, 384, 63, 63, GwenMargin(8, 8, 8, 8)) self.Textures.CategoryList.Inner = NewBordered(tex, 256 + 64, 384, 63, 63, GwenMargin(8, 21, 8, 8)) self.Textures.CategoryList.Header = NewBordered(tex, 320, 352, 63, 31, GwenMargin(8, 8, 8, 8)) self.Textures.GroupBox = NewBordered(tex, 0, 448, 31, 31, GwenMargin(8, 8, 8, 8)) end return TexturedSkin
-- ======= Copyright (c) 2003-2012, Unknown Worlds Entertainment, Inc. All rights reserved. ===== -- -- lua\AlienTeam.lua -- -- Created by: Charlie Cleveland (charlie@unknownworlds.com) and -- Max McGuire (max@unknownworlds.com) -- -- This class is used for teams that are actually playing the game, e.g. Marines or Aliens. -- -- ========= For more information, visit us at http://www.unknownworlds.com ===================== Script.Load("lua/TechData.lua") Script.Load("lua/Skulk.lua") Script.Load("lua/PlayingTeam.lua") Script.Load("lua/UpgradeStructureManager.lua") class 'AlienTeam' (PlayingTeam) -- Innate alien regeneration AlienTeam.kAutoHealInterval = 2 AlienTeam.kStructureAutoHealInterval = 0.5 AlienTeam.kAutoHealUpdateNum = 20 -- number of structures to update per autoheal update AlienTeam.kInfestationUpdateRate = 2 function AlienTeam:GetTeamType() return kAlienTeamType end function AlienTeam:GetIsAlienTeam() return true end function AlienTeam:Initialize(teamName, teamNumber) PlayingTeam.Initialize(self, teamName, teamNumber) self.respawnEntity = Skulk.kMapName -- List stores all the structures owned by builder player types such as the Gorge. -- This list stores them based on the player platform ID in order to maintain structure -- counts even if a player leaves and rejoins a server. self.clientOwnedStructures = { } self.lastAutoHealIndex = 1 self.updateAlienArmorInTicks = nil self.timeLastWave = 0 self.bioMassLevel = 0 self.bioMassAlertLevel = 0 self.maxBioMassLevel = 0 self.bioMassFraction = 0 end function AlienTeam:OnInitialized() PlayingTeam.OnInitialized(self) self.lastAutoHealIndex = 1 self.clientOwnedStructures = { } self.timeLastWave = 0 self.bioMassLevel = 0 self.bioMassAlertLevel = 0 self.maxBioMassLevel = 0 self.bioMassFraction = 0 end function AlienTeam:GetTeamInfoMapName() return AlienTeamInfo.kMapName end function AlienTeam:GetEggCount() return self.eggCount or 0 end local function SortByBioMassAdd(ent1, ent2) local bioMassAdd1 = ent1.biomassResearchFraction if not ent1:GetIsBuilt() then bioMassAdd1 = ent1:GetBuiltFraction() end local bioMassAdd2 = ent2.biomassResearchFraction if not ent2:GetIsBuilt() then bioMassAdd2 = ent2:GetBuiltFraction() end return bioMassAdd1 > bioMassAdd2 end local kBioMassTechIds = { kTechId.BioMassOne, kTechId.BioMassTwo, kTechId.BioMassThree, kTechId.BioMassFour, kTechId.BioMassFive, kTechId.BioMassSix, kTechId.BioMassSeven, kTechId.BioMassEight, kTechId.BioMassNine } function AlienTeam:UpdateBioMassLevel() local lastBioMassLevel = self.bioMassLevel self.bioMassLevel = 0 self.bioMassAlertLevel = 0 self.bioMassFraction = 0 local extraBioMass = 0 local progress = 0 local ents = GetEntitiesForTeam("Hive", self:GetTeamNumber()) table.sort(ents, SortByBioMassAdd) for index, entity in ipairs(ents) do if entity:GetIsAlive() then local currentBioMass = entity:GetBioMassLevel() self.bioMassLevel = self.bioMassLevel + currentBioMass local bioMassAdd = entity.biomassResearchFraction if not entity:GetIsBuilt() then bioMassAdd = bioMassAdd + entity:GetBuiltFraction() end if index == 1 then progress = bioMassAdd end currentBioMass = currentBioMass + bioMassAdd currentBioMass = currentBioMass * entity:GetHealthScalar() self.bioMassFraction = self.bioMassFraction + currentBioMass if Shared.GetTime() - entity:GetTimeLastDamageTaken() < 7 then self.bioMassAlertLevel = self.bioMassAlertLevel + currentBioMass end end end if self.techTree then for i = 1, #kBioMassTechIds do local techId = kBioMassTechIds[i] local techNode = self.techTree:GetTechNode(techId) if techNode then local techNodeProgress = i == self.bioMassLevel + 1 and progress or 0 if techNode:GetResearchProgress() ~= techNodeProgress then techNode:SetResearchProgress(techNodeProgress) self.techTree:SetTechNodeChanged(techNode, string.format("researchProgress = %.2f", techNodeProgress)) end end end end if lastBioMassLevel ~= self.bioMassLevel and self.techTree then self.techTree:SetTechChanged() end self.maxBioMassLevel = 0 for _, hive in ipairs(GetEntitiesForTeam("Hive", self:GetTeamNumber())) do if GetIsUnitActive(hive) then self.maxBioMassLevel = self.maxBioMassLevel + 3 end end end function AlienTeam:GetMaxBioMassLevel() if GetGameInfoEntity():GetWarmUpActive() then return 9 end return self.maxBioMassLevel end function AlienTeam:GetBioMassLevel() if GetGameInfoEntity():GetWarmUpActive() then return 9 end return self.bioMassLevel end function AlienTeam:GetBioMassAlertLevel() if GetGameInfoEntity():GetWarmUpActive() then return 0 end return self.bioMassAlertLevel end function AlienTeam:GetBioMassFraction() if GetGameInfoEntity():GetWarmUpActive() then return 9 end return self.bioMassFraction end function AlienTeam:RemoveGorgeStructureFromClient(techId, clientId) local structureTypeTable = self.clientOwnedStructures[clientId] if structureTypeTable then if not structureTypeTable[techId] then structureTypeTable[techId] = { } return end local removeIndex = 0 local structure for index, id in ipairs(structureTypeTable[techId]) do if id then removeIndex = index structure = Shared.GetEntity(id) break end end if structure then table.remove(structureTypeTable[techId], removeIndex) structure.consumed = true if structure:GetCanDie() then structure:Kill() else DestroyEntity(structure) end end end end local function ApplyGorgeStructureTheme(structure, player) assert(player:isa("Gorge")) if structure.SetVariant then structure:SetVariant(player:GetVariant()) end end function AlienTeam:AddGorgeStructure(player, structure) if player ~= nil and structure ~= nil then local clientId = Server.GetOwner(player):GetUserId() local structureId = structure:GetId() local techId = structure:GetTechId() if not self.clientOwnedStructures[clientId] then self.clientOwnedStructures[clientId] = { } end local structureTypeTable = self.clientOwnedStructures[clientId] if not structureTypeTable[techId] then structureTypeTable[techId] = { } end table.insertunique(structureTypeTable[techId], structureId) ApplyGorgeStructureTheme(structure, player) local numAllowedStructure = LookupTechData(techId, kTechDataMaxAmount, -1) --* self:GetNumHives() if numAllowedStructure >= 0 and table.count(structureTypeTable[techId]) > numAllowedStructure then self:RemoveGorgeStructureFromClient(techId, clientId) end end end function AlienTeam:GetDroppedGorgeStructures(player, techId) local owner = Server.GetOwner(player) if owner then local clientId = owner:GetUserId() local structureTypeTable = self.clientOwnedStructures[clientId] if structureTypeTable then return structureTypeTable[techId] end end end function AlienTeam:GetNumDroppedGorgeStructures(player, techId) local structureTypeTable = self:GetDroppedGorgeStructures(player, techId) return (not structureTypeTable and 0) or #structureTypeTable end function AlienTeam:UpdateClientOwnedStructures(oldEntityId) if oldEntityId then for clientId, structureTypeTable in pairs(self.clientOwnedStructures) do for techId, structureList in pairs(structureTypeTable) do for i, structureId in ipairs(structureList) do if structureId == oldEntityId then table.remove(structureList, i) break end end end end end end function AlienTeam:OnEntityChange(oldEntityId, newEntityId) PlayingTeam.OnEntityChange(self, oldEntityId, newEntityId) -- Check if the oldEntityId matches any client's built structure and -- handle the change. self:UpdateClientOwnedStructures(oldEntityId) end local function CreateCysts(hive, harvester, teamNumber) local hiveOrigin = hive:GetOrigin() local harvesterOrigin = harvester:GetOrigin() -- Spawn all the Cyst spawn points close to the hive. local dist = (hiveOrigin - harvesterOrigin):GetLength() for c = 1, #Server.cystSpawnPoints do local spawnPoint = Server.cystSpawnPoints[c] if (spawnPoint - hiveOrigin):GetLength() <= (dist * 1.5) then local cyst = CreateEntityForTeam(kTechId.Cyst, spawnPoint, teamNumber, nil) cyst:SetConstructionComplete() cyst:SetInfestationFullyGrown() cyst:SetImmuneToRedeploymentTime(1) end end end function AlienTeam:SpawnInitialStructures(techPoint) local tower, hive = PlayingTeam.SpawnInitialStructures(self, techPoint) hive:SetFirstLogin() hive:SetInfestationFullyGrown() -- It is possible there was not an available tower if the map is not designed properly. if tower then CreateCysts(hive, tower, self:GetTeamNumber()) end return tower, hive end function AlienTeam:GetHasAbilityToRespawn() local hives = GetEntitiesForTeam("Hive", self:GetTeamNumber()) return table.count(hives) > 0 end function AlienTeam:UpdateEggCount() self.eggCount = 0 for _, egg in ipairs(GetEntitiesForTeam("Egg", self:GetTeamNumber())) do if egg:GetIsFree() and egg:GetGestateTechId() == kTechId.Skulk then self.eggCount = self:GetEggCount() + 1 end end end function AlienTeam:AssignPlayerToEgg(player, enemyTeamPosition) local success = false -- use non-preevolved eggs sorted by "critical hives position" local lifeFormEgg local spawnPoint = player:GetDesiredSpawnPoint() if not spawnPoint then spawnPoint = enemyTeamPosition or player:GetOrigin() end local eggs = GetEntitiesForTeam("Egg", self:GetTeamNumber()) Shared.SortEntitiesByDistance(spawnPoint, eggs) -- Find the closest egg, doesn't matter which Hive owns it. for _, egg in ipairs(eggs) do -- Any unevolved egg is fine as long as it is free. if egg:GetIsFree() then if egg:GetGestateTechId() == kTechId.Skulk then egg:SetQueuedPlayerId(player:GetId()) success = true break elseif lifeFormEgg == nil then lifeFormEgg = egg end end end -- use life form egg if not success and lifeFormEgg then lifeFormEgg:SetQueuedPlayerId(player:GetId()) success = true end return success end function AlienTeam:GetCriticalHivePosition() -- get position of enemy team, ignore commanders local numPositions = 0 local teamPosition = Vector(0, 0, 0) for _, player in ipairs( GetEntitiesForTeam("Player", GetEnemyTeamNumber(self:GetTeamNumber())) ) do if (player:isa("Marine") or player:isa("Exo")) and player:GetIsAlive() then numPositions = numPositions + 1 teamPosition = teamPosition + player:GetOrigin() end end if numPositions > 0 then return teamPosition / numPositions end end function AlienTeam:UpdateEggGeneration() if not self.timeLastEggUpdate then self.timeLastEggUpdate = Shared.GetTime() end if self.timeLastEggUpdate + ScaleWithPlayerCount(kEggGenerationRate, #GetEntitiesForTeam("Player", self:GetTeamNumber())) < Shared.GetTime() then local hives = GetEntitiesForTeam("Hive", self:GetTeamNumber()) local builtHives = {} -- allow only built hives to spawn eggs for _, hive in ipairs(hives) do if hive:GetIsBuilt() and hive:GetIsAlive() then table.insert(builtHives, hive) end end for _, hive in ipairs(builtHives) do hive:UpdateSpawnEgg() end self.timeLastEggUpdate = Shared.GetTime() end end function AlienTeam:UpdateAlienSpectators() if self.timeLastSpectatorUpdate == nil then self.timeLastSpectatorUpdate = Shared.GetTime() - 1 end if self.timeLastSpectatorUpdate + 1 <= Shared.GetTime() then local alienSpectators = self:GetSortedRespawnQueue() local enemyTeamPosition = self:GetCriticalHivePosition() for i = 1, #alienSpectators do local alienSpectator = alienSpectators[i] -- Do not spawn players waiting in the auto team balance queue. if alienSpectator:isa("AlienSpectator") and not alienSpectator:GetIsWaitingForTeamBalance() then -- Consider min death time. if alienSpectator:GetRespawnQueueEntryTime() + kAlienSpawnTime < Shared.GetTime() then local egg if alienSpectator.GetHostEgg then egg = alienSpectator:GetHostEgg() end -- Player has no egg assigned, check for free egg. if egg == nil then local success = self:AssignPlayerToEgg(alienSpectator, enemyTeamPosition) -- We have no eggs currently, makes no sense to check for every spectator now. if not success then break end end end end end self.timeLastSpectatorUpdate = Shared.GetTime() end end function AlienTeam:UpdateCystConstruction(deltaTime) local numCystsToConstruct = self:GetNumCapturedTechPoints() for _, cyst in ipairs(GetEntitiesForTeam("Cyst", self:GetTeamNumber())) do local parent = cyst:GetCystParent() if not cyst:GetIsBuilt() and parent and parent:GetIsBuilt() then cyst:Construct(deltaTime) numCystsToConstruct = numCystsToConstruct - 1 end if numCystsToConstruct <= 0 then break end end end function AlienTeam:Update(timePassed) PROFILE("AlienTeam:Update") PlayingTeam.Update(self, timePassed) self:UpdateTeamAutoHeal(timePassed) self:UpdateEggGeneration() self:UpdateEggCount() self:UpdateAlienSpectators() self:UpdateBioMassLevel() local shellLevel = GetShellLevel(self:GetTeamNumber()) for index, alien in ipairs(GetEntitiesForTeam("Alien", self:GetTeamNumber())) do alien:UpdateArmorAmount(shellLevel) alien:UpdateHealthAmount(math.min(12, self.bioMassLevel), self.maxBioMassLevel) end self:UpdateCystConstruction(timePassed) end function AlienTeam:OnTechTreeUpdated() if self.updateAlienArmor then self.updateAlienArmor = false self.updateAlienArmorInTicks = 100 end end -- update every tick but only a small amount of structures function AlienTeam:UpdateTeamAutoHeal(timePassed) PROFILE("AlienTeam:UpdateTeamAutoHeal") local time = Shared.GetTime() if self.timeOfLastAutoHeal == nil then self.timeOfLastAutoHeal = Shared.GetTime() end if time > (self.timeOfLastAutoHeal + AlienTeam.kStructureAutoHealInterval) then local intervalLength = time - self.timeOfLastAutoHeal local gameEnts = GetEntitiesWithMixinForTeam("InfestationTracker", self:GetTeamNumber()) local numEnts = table.count(gameEnts) local toIndex = self.lastAutoHealIndex + AlienTeam.kAutoHealUpdateNum - 1 toIndex = ConditionalValue(toIndex <= numEnts , toIndex, numEnts) for index = self.lastAutoHealIndex, toIndex do local entity = gameEnts[index] -- players update the auto heal on their own if not entity:isa("Player") then -- we add whips as an exception here. construction should still be restricted to onInfestation, we only don't want whips to take damage off infestation local requiresInfestation = ConditionalValue(entity:isa("Whip"), false, LookupTechData(entity:GetTechId(), kTechDataRequiresInfestation)) local isOnInfestation = entity:GetGameEffectMask(kGameEffect.OnInfestation) local isHealable = entity:GetIsHealable() local deltaTime = 0 local beingCatalyzed = HasMixin(entity, "Catalyst") and entity:GetIsCatalysted() if not entity.timeLastAutoHeal then entity.timeLastAutoHeal = Shared.GetTime() else deltaTime = Shared.GetTime() - entity.timeLastAutoHeal entity.timeLastAutoHeal = Shared.GetTime() end if requiresInfestation and not isOnInfestation and not beingCatalyzed then -- Take damage! local damage = entity:GetMaxHealth() * kBalanceInfestationHurtPercentPerSecond/100 * deltaTime damage = math.max(damage, kMinHurtPerSecond) local attacker if entity.lastAttackerDidDamageTime and Shared.GetTime() < entity.lastAttackerDidDamageTime + 60 then attacker = entity:GetLastAttacker() end entity:DeductHealth(damage, attacker) end end end if self.lastAutoHealIndex + AlienTeam.kAutoHealUpdateNum >= numEnts then self.lastAutoHealIndex = 1 else self.lastAutoHealIndex = self.lastAutoHealIndex + AlienTeam.kAutoHealUpdateNum end self.timeOfLastAutoHeal = Shared.GetTime() end end function AlienTeam:InitTechTree() PlayingTeam.InitTechTree(self) -- Add special alien menus self.techTree:AddMenu(kTechId.MarkersMenu) self.techTree:AddMenu(kTechId.UpgradesMenu) self.techTree:AddMenu(kTechId.ShadePhantomMenu) self.techTree:AddMenu(kTechId.ShadePhantomStructuresMenu) self.techTree:AddMenu(kTechId.ShiftEcho, kTechId.ShiftHive) self.techTree:AddMenu(kTechId.LifeFormMenu) self.techTree:AddMenu(kTechId.SkulkMenu) self.techTree:AddMenu(kTechId.GorgeMenu) self.techTree:AddMenu(kTechId.LerkMenu) self.techTree:AddMenu(kTechId.FadeMenu) self.techTree:AddMenu(kTechId.OnosMenu) self.techTree:AddMenu(kTechId.Return) self.techTree:AddOrder(kTechId.Grow) self.techTree:AddAction(kTechId.FollowAlien) self.techTree:AddPassive(kTechId.Infestation) self.techTree:AddPassive(kTechId.SpawnAlien) self.techTree:AddPassive(kTechId.CollectResources, kTechId.Harvester) -- Add markers (orders) self.techTree:AddSpecial(kTechId.ThreatMarker, kTechId.None, kTechId.None, true) self.techTree:AddSpecial(kTechId.LargeThreatMarker, kTechId.None, kTechId.None, true) self.techTree:AddSpecial(kTechId.NeedHealingMarker, kTechId.None, kTechId.None, true) self.techTree:AddSpecial(kTechId.WeakMarker, kTechId.None, kTechId.None, true) self.techTree:AddSpecial(kTechId.ExpandingMarker, kTechId.None, kTechId.None, true) -- bio mass levels (required to unlock new abilities) self.techTree:AddSpecial(kTechId.BioMassOne) self.techTree:AddSpecial(kTechId.BioMassTwo) self.techTree:AddSpecial(kTechId.BioMassThree) self.techTree:AddSpecial(kTechId.BioMassFour) self.techTree:AddSpecial(kTechId.BioMassFive) self.techTree:AddSpecial(kTechId.BioMassSix) self.techTree:AddSpecial(kTechId.BioMassSeven) self.techTree:AddSpecial(kTechId.BioMassEight) self.techTree:AddSpecial(kTechId.BioMassNine) -- Commander abilities self.techTree:AddBuildNode(kTechId.Cyst) self.techTree:AddBuildNode(kTechId.NutrientMist) self.techTree:AddBuildNode(kTechId.Rupture, kTechId.BioMassTwo) self.techTree:AddBuildNode(kTechId.BoneWall, kTechId.BioMassThree) self.techTree:AddBuildNode(kTechId.Contamination, kTechId.BioMassNine) self.techTree:AddAction(kTechId.SelectDrifter) self.techTree:AddAction(kTechId.SelectHallucinations, kTechId.ShadeHive) self.techTree:AddAction(kTechId.SelectShift, kTechId.ShiftHive) -- Drifter triggered abilities self.techTree:AddTargetedActivation(kTechId.EnzymeCloud, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.Hallucinate, kTechId.ShadeHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.MucousMembrane, kTechId.CragHive, kTechId.None) --self.techTree:AddTargetedActivation(kTechId.Storm, kTechId.ShiftHive, kTechId.None) self.techTree:AddActivation(kTechId.DestroyHallucination) -- Drifter passive abilities self.techTree:AddPassive(kTechId.DrifterCamouflage) self.techTree:AddPassive(kTechId.DrifterCelerity) self.techTree:AddPassive(kTechId.DrifterRegeneration) -- Hive types self.techTree:AddBuildNode(kTechId.Hive, kTechId.None, kTechId.None) self.techTree:AddPassive(kTechId.HiveHeal) self.techTree:AddBuildNode(kTechId.CragHive, kTechId.Hive, kTechId.None) self.techTree:AddBuildNode(kTechId.ShadeHive, kTechId.Hive, kTechId.None) self.techTree:AddBuildNode(kTechId.ShiftHive, kTechId.Hive, kTechId.None) self.techTree:AddTechInheritance(kTechId.Hive, kTechId.CragHive) self.techTree:AddTechInheritance(kTechId.Hive, kTechId.ShiftHive) self.techTree:AddTechInheritance(kTechId.Hive, kTechId.ShadeHive) self.techTree:AddUpgradeNode(kTechId.ResearchBioMassOne) self.techTree:AddUpgradeNode(kTechId.ResearchBioMassTwo) self.techTree:AddUpgradeNode(kTechId.ResearchBioMassThree) self.techTree:AddUpgradeNode(kTechId.ResearchBioMassFour) self.techTree:AddUpgradeNode(kTechId.UpgradeToCragHive, kTechId.Hive, kTechId.None) self.techTree:AddUpgradeNode(kTechId.UpgradeToShadeHive, kTechId.Hive, kTechId.None) self.techTree:AddUpgradeNode(kTechId.UpgradeToShiftHive, kTechId.Hive, kTechId.None) self.techTree:AddBuildNode(kTechId.Harvester) self.techTree:AddBuildNode(kTechId.DrifterEgg) self.techTree:AddBuildNode(kTechId.Drifter, kTechId.None, kTechId.None, true) -- Whips self.techTree:AddBuildNode(kTechId.Whip, kTechId.None, kTechId.None) self.techTree:AddUpgradeNode(kTechId.EvolveBombard, kTechId.None, kTechId.None) self.techTree:AddPassive(kTechId.WhipBombard) self.techTree:AddPassive(kTechId.Slap) self.techTree:AddActivation(kTechId.WhipUnroot) self.techTree:AddActivation(kTechId.WhipRoot) -- Tier 1 lifeforms self.techTree:AddAction(kTechId.Skulk, kTechId.None, kTechId.None) self.techTree:AddAction(kTechId.Gorge, kTechId.None, kTechId.None) self.techTree:AddAction(kTechId.Lerk, kTechId.None, kTechId.None) self.techTree:AddAction(kTechId.Fade, kTechId.None, kTechId.None) self.techTree:AddAction(kTechId.Onos, kTechId.None, kTechId.None) self.techTree:AddBuyNode(kTechId.Egg, kTechId.None, kTechId.None) self.techTree:AddUpgradeNode(kTechId.GorgeEgg, kTechId.BioMassTwo) self.techTree:AddUpgradeNode(kTechId.LerkEgg, kTechId.BioMassTwo) self.techTree:AddUpgradeNode(kTechId.FadeEgg, kTechId.BioMassNine) self.techTree:AddUpgradeNode(kTechId.OnosEgg, kTechId.BioMassNine) -- Special alien structures. These tech nodes are modified at run-time, depending when they are built, so don't modify prereqs. self.techTree:AddBuildNode(kTechId.Crag, kTechId.Hive, kTechId.None) self.techTree:AddBuildNode(kTechId.Shift, kTechId.Hive, kTechId.None) self.techTree:AddBuildNode(kTechId.Shade, kTechId.Hive, kTechId.None) -- Alien upgrade structure self.techTree:AddBuildNode(kTechId.Shell, kTechId.CragHive) self.techTree:AddSpecial(kTechId.TwoShells, kTechId.Shell) self.techTree:AddSpecial(kTechId.ThreeShells, kTechId.TwoShells) self.techTree:AddBuildNode(kTechId.Veil, kTechId.ShadeHive) self.techTree:AddSpecial(kTechId.TwoVeils, kTechId.Veil) self.techTree:AddSpecial(kTechId.ThreeVeils, kTechId.TwoVeils) self.techTree:AddBuildNode(kTechId.Spur, kTechId.ShiftHive) self.techTree:AddSpecial(kTechId.TwoSpurs, kTechId.Spur) self.techTree:AddSpecial(kTechId.ThreeSpurs, kTechId.TwoSpurs) -- personal upgrades (all alien types) self.techTree:AddBuyNode(kTechId.Crush, kTechId.Shell, kTechId.None, kTechId.AllAliens) self.techTree:AddBuyNode(kTechId.Carapace, kTechId.Shell, kTechId.None, kTechId.AllAliens) self.techTree:AddBuyNode(kTechId.Regeneration, kTechId.Shell, kTechId.None, kTechId.AllAliens) self.techTree:AddBuyNode(kTechId.Focus, kTechId.Veil, kTechId.None, kTechId.AllAliens) self.techTree:AddBuyNode(kTechId.Aura, kTechId.Veil, kTechId.None, kTechId.AllAliens) self.techTree:AddBuyNode(kTechId.Vampirism, kTechId.Veil, kTechId.None, kTechId.AllAliens) self.techTree:AddBuyNode(kTechId.Silence, kTechId.Spur, kTechId.None, kTechId.AllAliens) self.techTree:AddBuyNode(kTechId.Celerity, kTechId.Spur, kTechId.None, kTechId.AllAliens) self.techTree:AddBuyNode(kTechId.Adrenaline, kTechId.Spur, kTechId.None, kTechId.AllAliens) -- Crag self.techTree:AddPassive(kTechId.CragHeal) self.techTree:AddActivation(kTechId.HealWave, kTechId.CragHive, kTechId.None) -- Shift self.techTree:AddActivation(kTechId.ShiftHatch, kTechId.None, kTechId.None) self.techTree:AddPassive(kTechId.ShiftEnergize, kTechId.None, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportHydra, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportWhip, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportTunnel, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportCrag, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportShade, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportShift, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportVeil, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportSpur, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportShell, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportHive, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportEgg, kTechId.ShiftHive, kTechId.None) self.techTree:AddTargetedActivation(kTechId.TeleportHarvester, kTechId.ShiftHive, kTechId.None) -- Shade self.techTree:AddPassive(kTechId.ShadeDisorient) self.techTree:AddPassive(kTechId.ShadeCloak) self.techTree:AddActivation(kTechId.ShadeInk, kTechId.ShadeHive, kTechId.None) self.techTree:AddSpecial(kTechId.TwoHives) self.techTree:AddSpecial(kTechId.ThreeHives) self.techTree:AddSpecial(kTechId.TwoWhips) self.techTree:AddSpecial(kTechId.TwoShifts) self.techTree:AddSpecial(kTechId.TwoShades) self.techTree:AddSpecial(kTechId.TwoCrags) -- abilities unlocked by bio mass: -- skulk researches self.techTree:AddResearchNode(kTechId.Leap, kTechId.None, kTechId.None, kTechId.AllAliens) self.techTree:AddResearchNode(kTechId.Xenocide, kTechId.None, kTechId.None, kTechId.AllAliens) -- gorge researches self.techTree:AddBuyNode(kTechId.BabblerAbility, kTechId.None) self.techTree:AddPassive(kTechId.WebTech, kTechId.None) --, kTechId.None, kTechId.AllAliens --FIXME Above still shows in Alien-Comm buttons/menu self.techTree:AddBuyNode(kTechId.Web, kTechId.None) self.techTree:AddBuyNode(kTechId.BabblerEgg, kTechId.None) self.techTree:AddResearchNode(kTechId.BileBomb, kTechId.None, kTechId.None, kTechId.AllAliens) -- lerk researches self.techTree:AddResearchNode(kTechId.Umbra, kTechId.None, kTechId.None, kTechId.AllAliens) self.techTree:AddResearchNode(kTechId.Spores, kTechId.None, kTechId.None, kTechId.AllAliens) -- fade researches self.techTree:AddResearchNode(kTechId.MetabolizeEnergy, kTechId.None, kTechId.None, kTechId.AllAliens) self.techTree:AddResearchNode(kTechId.MetabolizeHealth, kTechId.BioMassFive, kTechId.MetabolizeEnergy, kTechId.AllAliens) self.techTree:AddResearchNode(kTechId.Stab, kTechId.None, kTechId.None, kTechId.AllAliens) -- onos researches self.techTree:AddResearchNode(kTechId.Charge, kTechId.None, kTechId.None, kTechId.AllAliens) self.techTree:AddResearchNode(kTechId.BoneShield, kTechId.None, kTechId.None, kTechId.AllAliens) self.techTree:AddResearchNode(kTechId.Stomp, kTechId.None, kTechId.None, kTechId.AllAliens) -- gorge structures self.techTree:AddBuildNode(kTechId.GorgeTunnel) self.techTree:AddBuildNode(kTechId.Hydra) self.techTree:AddBuildNode(kTechId.Clog) self.techTree:SetComplete() end function AlienTeam:GetNumHives() local teamInfoEntity = Shared.GetEntity(self.teamInfoEntityId) return teamInfoEntity:GetNumCapturedTechPoints() end function AlienTeam:GetActiveHiveCount() local activeHiveCount = 0 for index, hive in ipairs(GetEntitiesForTeam("Hive", self:GetTeamNumber())) do if hive:GetIsAlive() and hive:GetIsBuilt() then activeHiveCount = activeHiveCount + 1 end end return activeHiveCount end function AlienTeam:GetActiveEggCount() local activeEggCount = 0 for _, egg in ipairs(GetEntitiesForTeam("Egg", self:GetTeamNumber())) do if egg:GetIsAlive() and egg:GetIsEmpty() then activeEggCount = activeEggCount + 1 end end return activeEggCount end -- -- Inform all alien players about the hive construction (add new abilities). -- function AlienTeam:OnHiveConstructed(newHive) local activeHiveCount = self:GetActiveHiveCount() for index, alien in ipairs(GetEntitiesForTeam("Alien", self:GetTeamNumber())) do if alien:GetIsAlive() and alien.OnHiveConstructed then alien:OnHiveConstructed(newHive, activeHiveCount) end end SendTeamMessage(self, kTeamMessageTypes.HiveConstructed, newHive:GetLocationId()) end -- -- Inform all alien players about the hive destruction (remove abilities). -- function AlienTeam:OnHiveDestroyed(destroyedHive) local activeHiveCount = self:GetActiveHiveCount() for index, alien in ipairs(GetEntitiesForTeam("Alien", self:GetTeamNumber())) do if alien:GetIsAlive() and alien.OnHiveDestroyed then alien:OnHiveDestroyed(destroyedHive, activeHiveCount) end end end function AlienTeam:OnUpgradeChamberConstructed(upgradeChamber) if upgradeChamber:GetTechId() == kTechId.CarapaceShell then self.updateAlienArmor = true end end function AlienTeam:OnUpgradeChamberDestroyed(upgradeChamber) if upgradeChamber:GetTechId() == kTechId.CarapaceShell then self.updateAlienArmor = true end -- These is a list of all tech to check when a upgrade chamber is destroyed. local checkForLostResearch = { [kTechId.RegenerationShell] = { "Shell", kTechId.Regeneration }, [kTechId.CarapaceShell] = { "Shell", kTechId.Carapace }, [kTechId.CrushShell] = { "Shell", kTechId.Crush }, [kTechId.CeleritySpur] = { "Spur", kTechId.Celerity }, [kTechId.AdrenalineSpur] = { "Spur", kTechId.Adrenaline }, [kTechId.SilenceSpur] = { "Spur", kTechId.Silence }, [kTechId.FocusVeil] = { "Veil", kTechId.Focus }, [kTechId.AuraVeil] = { "Veil", kTechId.Aura }, [kTechId.VampirismVeil] = { "Veil", kTechId.Vampirism } } local checkTech = checkForLostResearch[upgradeChamber:GetTechId()] if checkTech then local anyRemain = false for _, ent in ientitylist(Shared.GetEntitiesWithClassname(checkTech[1])) do -- Don't count the upgradeChamber as it is being destroyed now. if ent ~= upgradeChamber and ent:GetTechId() == upgradeChamber:GetTechId() then anyRemain = true break end end if not anyRemain then SendTeamMessage(self, kTeamMessageTypes.ResearchLost, checkTech[2]) end end end function AlienTeam:OnResearchComplete(structure, researchId) PlayingTeam.OnResearchComplete(self, structure, researchId) local checkForGainedResearch = { [kTechId.UpgradeCrushShell] = kTechId.Crush, [kTechId.UpgradeRegenerationShell] = kTechId.Regeneration, [kTechId.UpgradeCarapaceShell] = kTechId.Carapace, [kTechId.UpgradeCeleritySpur] = kTechId.Celerity, [kTechId.UpgradeAdrenalineSpur] = kTechId.Adrenaline, [kTechId.UpgradeSilenceSpur] = kTechId.Silence, [kTechId.UpgradeVampirismVeil] = kTechId.Vampirism, [kTechId.UpgradeAuraVeil] = kTechId.Aura, [kTechId.UpgradeFocusVeil] = kTechId.Focus } local gainedResearch = checkForGainedResearch[researchId] if gainedResearch then SendTeamMessage(self, kTeamMessageTypes.ResearchComplete, gainedResearch) end end function AlienTeam:GetSpectatorMapName() return AlienSpectator.kMapName end local function NotTooLate(waveTime, player) return player.GetRespawnQueueEntryTime ~= nil and player:GetRespawnQueueEntryTime() ~= nil and player:GetRespawnQueueEntryTime() + kAlienMinDeathTime < waveTime end function AlienTeam:OnEvolved(techId) local listeners = self.eventListeners['OnEvolved'] if listeners then for _, listener in ipairs(listeners) do listener(techId) end end end local function OnSetDesiredSpawnPoint(client, message) local player = client:GetControllingPlayer() if player then player.desiredSpawnPoint = message.desiredSpawnPoint end end Server.HookNetworkMessage("SetDesiredSpawnPoint", OnSetDesiredSpawnPoint)
--[[ Copyright (c) 2019 Void Works See LICENSE in the project directory for license information. Most of the credit for this mod goes to authors below whose code was compiled: Original "Fluid Void" mod by Rseding91 - redesigned by Nibuja05 (control code used for fluid voiding) "High Pressure Pipe" mod by kendfrey (code used for void pipe creation and tinting) "Void Chest +" mod by Optera (code used for void chest creation and function) --]] data:extend( { { type = "technology", name = "void-works", icon = "__Void-Works__/graphics/technology/void.png", icon_size = 128, prerequisites = { "fluid-handling", "advanced-material-processing", }, effects = { { type = "unlock-recipe", recipe = "void-pipe", }, { type = "unlock-recipe", recipe = "void-chest", }, }, unit = { time = 30, count = 100, ingredients = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, }, }, order = "c-a", }, })
return function() it("should require without errors", function() local AvatarEditorPrompts = require(script.Parent) expect(AvatarEditorPrompts).to.be.ok() end) end
function onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getStorageValue(Storage.UnnaturalSelection.Mission05) == 1 then player:setStorageValue(Storage.UnnaturalSelection.Questline, 11) player:setStorageValue(Storage.UnnaturalSelection.Mission05, 2) --Questlog, Unnatural Selection Quest "Mission 5: Ray of Light" player:say("A ray of sunlight comes down from the heaven and hits the crystal. Wow. That probably means Fasuon is supporting.", TALKTYPE_MONSTER_SAY) toPosition:sendMagicEffect(CONST_ME_HOLYAREA) end return true end
nurla_employee = Creature:new { objectName = "@mob/creature_names:businessman", randomNameType = NAME_GENERIC, randomNameTag = true, socialGroup = "townsperson", faction = "townsperson", level = 4, chanceHit = 0.24, damageMin = 40, damageMax = 45, baseXp = 62, baseHAM = 113, baseHAMmax = 138, armor = 0, resists = {0,0,0,0,0,0,0,-1,-1}, meatType = "", meatAmount = 0, hideType = "", hideAmount = 0, boneType = "", boneAmount = 0, milk = 0, tamingChance = 0, ferocity = 0, pvpBitmask = ATTACKABLE, creatureBitmask = NONE, optionsBitmask = AIENABLED + CONVERSABLE, diet = HERBIVORE, templates = { "object/mobile/dressed_commoner_fat_zabrak_male_01.iff", "object/mobile/dressed_commoner_tatooine_ishitib_male_01.iff", "object/mobile/dressed_commoner_tatooine_aqualish_female_07.iff", "object/mobile/dressed_commoner_naboo_twilek_female_01.iff", "object/mobile/dressed_commoner_old_zabrak_male_01.iff", "object/mobile/dressed_commoner_tatooine_sullustan_male_03.iff", "object/mobile/dressed_commoner_naboo_human_male_08.iff", "object/mobile/dressed_commoner_tatooine_nikto_male_03.iff", "object/mobile/dressed_commoner_old_human_female_02.iff", "object/mobile/dressed_commoner_tatooine_nikto_male_07.iff", "object/mobile/dressed_commoner_tatooine_bith_male_05.iff", "object/mobile/dressed_commoner_tatooine_ishitib_male_01.iff", "object/mobile/dressed_commoner_naboo_human_male_03.iff", "object/mobile/dressed_commoner_tatooine_bith_male_02.iff", "object/mobile/dressed_commoner_tatooine_trandoshan_male_02.iff", "object/mobile/dressed_commoner_naboo_human_female_07.iff", "object/mobile/dressed_commoner_tatooine_bith_male_01.iff", "object/mobile/dressed_commoner_tatooine_trandoshan_female_04.iff", "object/mobile/dressed_diplomat_human_female_01.iff", "object/mobile/dressed_diplomat_human_female_02.iff", "object/mobile/dressed_diplomat_human_female_03.iff", "object/mobile/dressed_diplomat_human_male_01.iff", "object/mobile/dressed_diplomat_human_male_02.iff", "object/mobile/dressed_diplomat_human_male_03.iff", "object/mobile/dressed_diplomat_trando_female_01.iff", "object/mobile/dressed_diplomat_trando_male_01.iff", "object/mobile/dressed_diplomat_zabrak_female_01.iff", "object/mobile/dressed_diplomat_zabrak_female_02.iff", "object/mobile/dressed_diplomat_zabrak_male_01.iff", "object/mobile/dressed_diplomat_zabrak_male_02.iff" }, lootGroups = {}, weapons = {}, conversationTemplate = "nurla_slinthiss_mission_target_convotemplate", attacks = brawlermaster } CreatureTemplates:addCreatureTemplate(nurla_employee, "nurla_employee")
------------------------------------------------------------ -- Buffy by Sonaza (https://sonaza.com) -- Licensed under MIT License -- See attached license text in file LICENSE ------------------------------------------------------------ local ADDON_NAME, Addon = ...; local LE = Addon.LE; local _; -- Text Strings BUFFY_SET_BINDING_TEXT = "|cffeed028Set Buffy Cast Keybind|r"; BUFFY_CHOOSE_BINDING_TEXT = "Choose a Binding"; BUFFY_PRESS_BUTTON_TEXT = "Press a key to use it as the binding"; BUFFY_TEMPORARY_BIND_TEXT = "Buffy will set a temporary binding when required and you can use any key you want without overwriting existing ones." BUFFY_CANCEL_BINDING_TEXT = "Press Escape to Cancel"; BUFFY_ACCEPT_TEXT = "Save" LE.CONSUMABLE_CATEGORY = { GENERIC = 0, DRAENOR = 5, LEGION = 6, BFA = 7, }; LE.EXPANSION = { VANILLA = 0, TBC = 1, WRATH = 2, CATACLYSM = 3, PANDARIA = 4, DRAENOR = 5, LEGION = 6, BFA = 7, }; LE.CURRENT_EXPANSION = LE.EXPANSION.BFA; LE.INSTANCETYPE_RAID = 0x1; LE.INSTANCETYPE_DUNGEON = 0x2; LE.INSTANCE_MAP_IDS = { [LE.EXPANSION.DRAENOR] = { [1228] = LE.INSTANCETYPE_RAID, -- Highmaul [1205] = LE.INSTANCETYPE_RAID, -- Blackrock Foundry [1448] = LE.INSTANCETYPE_RAID, -- Hellfire Citadel [1182] = LE.INSTANCETYPE_DUNGEON, -- Auchindoun [1175] = LE.INSTANCETYPE_DUNGEON, -- Bloodmaul Slag Mines [1208] = LE.INSTANCETYPE_DUNGEON, -- Grimrail Depot [1195] = LE.INSTANCETYPE_DUNGEON, -- Iron Docks [1176] = LE.INSTANCETYPE_DUNGEON, -- Shadowmoon Burial Grounds [1209] = LE.INSTANCETYPE_DUNGEON, -- Skyreach [1279] = LE.INSTANCETYPE_DUNGEON, -- The Everbloom [1358] = LE.INSTANCETYPE_DUNGEON, -- Upper Blackrock Spire }, [LE.EXPANSION.LEGION] = { [1520] = LE.INSTANCETYPE_RAID, -- The Emerald Nightmare [1530] = LE.INSTANCETYPE_RAID, -- The Nighthold [1648] = LE.INSTANCETYPE_RAID, -- Trial of Valor [1676] = LE.INSTANCETYPE_RAID, -- Tomb of Sargeras [1712] = LE.INSTANCETYPE_RAID, -- Antorus, the Burning Throne [1456] = LE.INSTANCETYPE_DUNGEON, -- Eye of Azshara [1458] = LE.INSTANCETYPE_DUNGEON, -- Neltharion's Lair [1466] = LE.INSTANCETYPE_DUNGEON, -- Darkheart Thicket [1477] = LE.INSTANCETYPE_DUNGEON, -- Halls of Valor [1492] = LE.INSTANCETYPE_DUNGEON, -- Maw of Souls [1493] = LE.INSTANCETYPE_DUNGEON, -- Vault of the Wardens [1501] = LE.INSTANCETYPE_DUNGEON, -- Black Rook Hold [1544] = LE.INSTANCETYPE_DUNGEON, -- Violet Hold [1516] = LE.INSTANCETYPE_DUNGEON, -- The Arcway [1571] = LE.INSTANCETYPE_DUNGEON, -- Court of Stars [1677] = LE.INSTANCETYPE_DUNGEON, -- Cathedral of Eternal Night }, [LE.EXPANSION.BFA] = { [1861] = LE.INSTANCETYPE_RAID, -- Uldir [2070] = LE.INSTANCETYPE_RAID, -- Dazar'alor [2096] = LE.INSTANCETYPE_RAID, -- Crucible of Storms [2164] = LE.INSTANCETYPE_RAID, -- The Eternal Palace [1763] = LE.INSTANCETYPE_DUNGEON, -- Atal'Dazar [1754] = LE.INSTANCETYPE_DUNGEON, -- Freehold [1762] = LE.INSTANCETYPE_DUNGEON, -- Kings Rest [1864] = LE.INSTANCETYPE_DUNGEON, -- Shrine of the Storm [1822] = LE.INSTANCETYPE_DUNGEON, -- Siege of Boralus [1877] = LE.INSTANCETYPE_DUNGEON, -- Temple of Sethraliss [1594] = LE.INSTANCETYPE_DUNGEON, -- The Motherlode [1841] = LE.INSTANCETYPE_DUNGEON, -- The Underrot [1771] = LE.INSTANCETYPE_DUNGEON, -- Tol Dagor [1862] = LE.INSTANCETYPE_DUNGEON, -- Waycrest Manor [2097] = LE.INSTANCETYPE_DUNGEON, -- Mechagon }, }; -- Enums LE.STAT = { AGILITY = 0x001, STRENGTH = 0x002, INTELLECT = 0x004, STAMINA = 0x008, HASTE = 0x010, MASTERY = 0x020, CRIT = 0x040, VERSATILITY = 0x080, SPECIAL = 0x0F0, CUSTOM = 0x100, AUTOMATIC = 0xFFF, }; LE.RATING_NAMES = { [LE.STAT.STAMINA] = "Stamina", [LE.STAT.HASTE] = "Haste", [LE.STAT.MASTERY] = "Mastery", [LE.STAT.CRIT] = "Crit", [LE.STAT.VERSATILITY] = "Versatility", }; LE.RATING_IDENTIFIERS = { [LE.STAT.HASTE] = function() return GetCombatRatingBonus(CR_HASTE_SPELL); end, [LE.STAT.MASTERY] = function() local mastery, bonusCoeff = GetMasteryEffect(); return GetCombatRatingBonus(CR_MASTERY) * bonusCoeff; end, [LE.STAT.CRIT] = function() return GetCombatRatingBonus(CR_CRIT_SPELL); end, [LE.STAT.VERSATILITY] = function() return GetCombatRatingBonus(CR_VERSATILITY_DAMAGE_DONE); end, }; LE.BUFF_SPECIAL = 0xFFF; LE.CONSUMABLE_FLASK = 0x01; LE.CONSUMABLE_RUNE = 0x02; LE.CONSUMABLE_FOOD = 0x03; LE.ALERT_TYPE_SPELL = 0x01; LE.ALERT_TYPE_ITEM = 0x02; LE.ALERT_TYPE_CUSTOM = 0x03; LE.ALERT_TYPE_SPECIAL = 0xFF; LE.SPECIAL_FOOD = 0x1; LE.SPECIAL_EATING = 0x2; LE.SPECIAL_UNLOCKED = 0x3; ----------------------------------------------------------------- -- Buff spells Addon:AddBuffSpell(2823, LE.BUFF_SPECIAL, "ROGUE_DEADLY_POISON"); Addon:AddBuffSpell(8679, LE.BUFF_SPECIAL, "ROGUE_WOUND_POISON"); Addon:AddBuffSpell(3408, LE.BUFF_SPECIAL, "ROGUE_CRIPPLING_POISON"); Addon:AddBuffSpell(108211, LE.BUFF_SPECIAL, "ROGUE_LEECHING_POISON"); Addon:AddBuffSpell(20707, LE.BUFF_SPECIAL, "WARLOCK_SOULSTONE"); Addon:AddBuffSpell(108503, LE.BUFF_SPECIAL, "WARLOCK_GRIMOIRE_OF_SACRIFICE"); Addon:AddBuffSpell(196099, LE.BUFF_SPECIAL, "WARLOCK_GRIMOIRE_OF_SACRIFICE_EFFECT"); Addon:AddBuffSpell(205022, LE.BUFF_SPECIAL, "MAGE_ARCANE_FAMILIAR"); Addon:AddBuffSpell(192106, LE.BUFF_SPECIAL, "SHAMAN_LIGHTNING_SHIELD"); Addon:AddBuffSpell(5487, LE.BUFF_SPECIAL, "DRUID_BEAR_FORM"); Addon:AddBuffSpell(768, LE.BUFF_SPECIAL, "DRUID_CAT_FORM"); Addon:AddBuffSpell(24858, LE.BUFF_SPECIAL, "DRUID_MOONKIN_FORM"); Addon:AddBuffSpell(232698, LE.BUFF_SPECIAL, "PRIEST_SHADOWFORM"); Addon:AddBuffSpell(203538, LE.BUFF_SPECIAL, "PALADIN_GREATER_BLESSING_OF_KINGS"); Addon:AddBuffSpell(203539, LE.BUFF_SPECIAL, "PALADIN_GREATER_BLESSING_OF_WISDOM"); Addon:AddBuffSpell(181943, LE.BUFF_SPECIAL, "PEPE"); Addon:AddBuffSpell(279997, LE.BUFF_SPECIAL, "HEARTSBANE_CURSE"); Addon:AddBuffSpell(6673, LE.STAT.STRENGTH + LE.STAT.AGILITY, "BATTLE_SHOUT"); Addon:AddBuffSpell(21562, LE.STAT.STAMINA, "POWER_WORD_FORTITUDE"); Addon:AddBuffSpell(1459, LE.STAT.INTELLECT, "ARCANE_INTELLECT"); local function CanPoisonWeapons() local mainhand = GetInventoryItemLink("player", 16); local mhSlot = mainhand and select(9, GetItemInfo(mainhand)) or ""; local offhand = GetInventoryItemLink("player", 17); local ohSlot = offhand and select(9, GetItemInfo(offhand)) or ""; return mhSlot == "INVTYPE_WEAPON" or mhSlot == "INVTYPE_WEAPONMAINHAND" or ohSlot == "INVTYPE_WEAPON" or ohSlot == "INVTYPE_WEAPONOFFHAND"; end LE.DRUID_FORM = { BEAR = 1, CAT = 2, TRAVEL = 3, MOONKIN = 4, }; -- Category designations -- passive = only passively casted buffs -- all = Always active for all specs -- special = Some special thing for all specs, not necessarily always enabled -- [0] = Base buffs for all specs -- [x] = Override to previous on per spec basis where x is spec number local CLASS_CASTABLE_BUFFS = { ["WARRIOR"] = { all = { { raidbuff = LE.BUFFS.BATTLE_SHOUT, }, }, }, ["DEATHKNIGHT"] = { }, ["PALADIN"] = { [3] = { { vars = { buffs = { LE.BUFFS.PALADIN_GREATER_BLESSING_OF_KINGS, LE.BUFFS.PALADIN_GREATER_BLESSING_OF_WISDOM, }, roleBuffs = { -- Priorities for roles ["DAMAGER"] = { LE.BUFFS.PALADIN_GREATER_BLESSING_OF_KINGS, LE.BUFFS.PALADIN_GREATER_BLESSING_OF_WISDOM }, ["TANK"] = { LE.BUFFS.PALADIN_GREATER_BLESSING_OF_KINGS, LE.BUFFS.PALADIN_GREATER_BLESSING_OF_WISDOM }, ["HEALER"] = { LE.BUFFS.PALADIN_GREATER_BLESSING_OF_WISDOM, LE.BUFFS.PALADIN_GREATER_BLESSING_OF_KINGS }, ["NONE"] = { LE.BUFFS.PALADIN_GREATER_BLESSING_OF_KINGS, LE.BUFFS.PALADIN_GREATER_BLESSING_OF_WISDOM }, }, roleOrder = { "TANK", "HEALER", "DAMAGER", "NONE" }, buffsRemaining = 1337, getNumBlessings = function() local knownSpells = 0; if(IsSpellKnown(LE.BUFFS.PALADIN_GREATER_BLESSING_OF_KINGS)) then knownSpells = knownSpells + 1 end if(IsSpellKnown(LE.BUFFS.PALADIN_GREATER_BLESSING_OF_WISDOM)) then knownSpells = knownSpells + 1 end return knownSpells; end, }, bufflist = function(self) local buffStatus = Addon:ScanExclusiveBuffList(self.buffs); local buffsRemaining = self.getNumBlessings() - #buffStatus["player"]; self.buffsRemaining = buffsRemaining; if(Addon.db.global.Class.Paladin.OnlyRemind) then return buffsRemaining > 0, LE.BUFFS.PALADIN_GREATER_BLESSING_OF_KINGS; end if(buffsRemaining > 0) then local isSolo = Addon:GetGroupType() == LE.GROUP_TYPE.SOLO; local buffToCast = nil; if(isSolo or Addon.db.global.Class.Paladin.SelfCastBlessings) then for _, spell in ipairs(self.buffs) do local hasBuff = Addon:UnitHasBuff("player", spell); if(not hasBuff) then buffToCast = { spell = spell, target = "player", }; break; end end else local remainingBuffs = {}; for _, buffSpellId in ipairs(self.buffs) do local found = false; for index, data in ipairs(buffStatus["player"]) do if(data.spell == buffSpellId) then found = true; break; end end if(not found) then remainingBuffs[buffSpellId] = true; end end local remainingRoleBuffs = {}; for role, roleBuffs in pairs(self.roleBuffs) do if(not remainingRoleBuffs[role]) then remainingRoleBuffs[role] = {} end for _, buffSpellId in ipairs(roleBuffs) do if(remainingBuffs[buffSpellId]) then tinsert(remainingRoleBuffs[role], buffSpellId); end end end local missingBuffs = Addon:ScanMissingPartyBuffsByRole(remainingRoleBuffs); local playerUnitID = Addon:GetPlayerUnitID(); local buffPriorities = {}; for rolePriority, role in ipairs(self.roleOrder) do if(missingBuffs[role]) then for unit, buffs in pairs(missingBuffs[role]) do local spell = buffs[1]; local priority = #buffs; local totalPriority = priority * (5-rolePriority); if(unit == playerUnitID) then totalPriority = totalPriority * 1.1; end if(spell == LE.BUFFS.PALADIN_GREATER_BLESSING_OF_WISDOM) then if(UnitPowerType(unit) == SPELL_POWER_MANA) then totalPriority = totalPriority * 1.1; else totalPriority = totalPriority * 0.5; end end tinsert(buffPriorities, { spell = spell, target = unit, priority = totalPriority, }); end end end table.sort(buffPriorities, function(a, b) if(a == nil and b == nil) then return false end if(a == nil) then return true end if(b == nil) then return false end return a.priority > b.priority; end); if(buffPriorities[1]) then buffToCast = { spell = buffPriorities[1].spell, target = buffPriorities[1].target, }; end end if(buffToCast) then self.target = buffToCast.target; return true, buffToCast.spell, buffToCast.target; end end return false; end, condition = function(self) return Addon.db.global.Class.Paladin.EnableBlessings and not InCombatLockdown(); end, description = function(self) return string.format("Missing %d blessing%s", self.buffsRemaining, self.buffsRemaining == 1 and "" or "s"); end, secondary = function(self) if(Addon.db.global.Class.Paladin.OnlyRemind) then return "A Greater Blessing"; end end, icon = function() if(Addon.db.global.Class.Paladin.OnlyRemind) then return 135993; -- Blessing of Kings icon end end, noCast = function() return Addon.db.global.Class.Paladin.OnlyRemind; end, }, }, }, ["MONK"] = { }, ["PRIEST"] = { all = { { raidbuff = LE.BUFFS.POWER_WORD_FORTITUDE, } }, [3] = { { bufflist = { LE.BUFFS.PRIEST_SHADOWFORM }, condition = function() return Addon.db.global.Class.Priest.ShadowformAlert and (not Addon.db.global.Class.Priest.OnlyInCombat or InCombatLockdown()); end, }, }, }, ["SHAMAN"] = { [2] = { { hasTalent = { 1, 3 }, bufflist = { LE.BUFFS.SHAMAN_LIGHTNING_SHIELD, }, condition = function() return Addon.db.global.Class.Shaman.EnableLightningShield; end, }, }, }, ["DRUID"] = { [1] = { { bufflist = { LE.BUFFS.DRUID_MOONKIN_FORM }, condition = function() if(not Addon.db.global.Class.Druid.FormAlert) then return false end if(Addon.db.global.Class.Druid.OnlyInCombat and not InCombatLockdown()) then return false end return GetShapeshiftForm() ~= LE.DRUID_FORM.MOONKIN; end, description = "Not in a form", }, }, [2] = { { bufflist = { LE.BUFFS.DRUID_CAT_FORM }, condition = function() if(not Addon.db.global.Class.Druid.FormAlert) then return false end if(Addon.db.global.Class.Druid.OnlyInCombat and not InCombatLockdown()) then return false end return GetShapeshiftForm() ~= LE.DRUID_FORM.CAT; end, description = "Not in a form", }, }, [3] = { { bufflist = { LE.BUFFS.DRUID_BEAR_FORM }, condition = function() if(not Addon.db.global.Class.Druid.FormAlert) then return false end if(Addon.db.global.Class.Druid.OnlyInCombat and not InCombatLockdown()) then return false end return GetShapeshiftForm() ~= LE.DRUID_FORM.BEAR; end, description = "Not in a form", }, }, }, ["ROGUE"] = { [1] = { { bufflist = { LE.BUFFS.ROGUE_DEADLY_POISON, LE.BUFFS.ROGUE_WOUND_POISON }, condition = function() return CanPoisonWeapons() and Addon.db.global.Class.Rogue.EnableLethal and not Addon.db.global.Class.Rogue.WoundPoisonPriority; end, description = "Missing Lethal Poison", }, { bufflist = { LE.BUFFS.ROGUE_WOUND_POISON, LE.BUFFS.ROGUE_DEADLY_POISON, }, condition = function() return CanPoisonWeapons() and Addon.db.global.Class.Rogue.EnableLethal and Addon.db.global.Class.Rogue.WoundPoisonPriority; end, description = "Missing Lethal Poison", }, { noTalent = { 4, 1 }, bufflist = { LE.BUFFS.ROGUE_CRIPPLING_POISON, }, condition = function() return CanPoisonWeapons() and Addon.db.global.Class.Rogue.EnableNonlethal and not Addon.db.global.Class.Rogue.SkipCrippling; end, description = "Missing Non-Lethal Poison", }, { hasTalent = { 4, 1 }, bufflist = { LE.BUFFS.ROGUE_LEECHING_POISON, }, condition = function() return CanPoisonWeapons() and Addon.db.global.Class.Rogue.EnableNonlethal; end, description = "Missing Non-Lethal Poison", }, { noTalent = { 4, 1 }, bufflist = { LE.BUFFS.ROGUE_CRIPPLING_POISON }, skipBuffCheck = true, condition = function() if(not CanPoisonWeapons() or not Addon.db.global.Class.Rogue.EnableNonlethal or Addon.db.global.Class.Rogue.SkipCrippling) then return end local _, hasBuff, remainingNonLethal, remainingLethal, duration; hasBuff, _, _, remainingNonLethal, duration = Addon:UnitHasBuff("player", LE.BUFFS.ROGUE_CRIPPLING_POISON); if(not hasBuff or Addon:WillBuffExpireSoon(remainingNonLethal)) then return false end hasBuff, _, _, remainingLethal, duration = Addon:UnitHasSomeBuff("player", { LE.BUFFS.ROGUE_WOUND_POISON, LE.BUFFS.ROGUE_DEADLY_POISON }); local remainingDiff = math.abs((remainingNonLethal or 0) - (remainingLethal or 0)); return Addon.db.global.Class.Rogue.RefreshBoth and hasBuff and remainingLethal >= duration - 20 and remainingDiff > 20; end, description = "Refresh Non-Lethal Poison Too", }, { hasTalent = { 4, 1 }, bufflist = { LE.BUFFS.ROGUE_LEECHING_POISON, }, skipBuffCheck = true, condition = function() if(not CanPoisonWeapons() or not Addon.db.global.Class.Rogue.EnableNonlethal) then return end local _, hasBuff, remainingNonLethal, remainingLethal, duration; hasBuff, _, _, remainingNonLethal, duration = Addon:UnitHasBuff("player", LE.BUFFS.ROGUE_LEECHING_POISON); if(not hasBuff or Addon:WillBuffExpireSoon(remainingNonLethal)) then return false end hasBuff, _, _, remainingLethal, duration = Addon:UnitHasSomeBuff("player", { LE.BUFFS.ROGUE_WOUND_POISON, LE.BUFFS.ROGUE_DEADLY_POISON }); local remainingDiff = math.abs((remainingNonLethal or 0) - (remainingLethal or 0)); return Addon.db.global.Class.Rogue.RefreshBoth and hasBuff and remainingLethal >= duration - 20 and remainingDiff > 20; end, description = "Refresh Non-Lethal Poison Too", }, }, [2] = { { skipBuffCheck = true, condition = function() if(not Addon.db.global.Class.Rogue.EnableFindTreasure) then return end if(InCombatLockdown()) then return end local numTrackingTypes = GetNumTrackingTypes(); for i=1, numTrackingTypes do local name, icon, active = GetTrackingInfo(i); if(icon == 1064187) then return not active; end end return false; end, info = { id = 199736, type = "custom", }, cast = function() local numTrackingTypes = GetNumTrackingTypes(); for i=1, numTrackingTypes do local name, icon, active = GetTrackingInfo(i); if(icon == 1064187) then SetTracking(i, true); return; end end end, primary = "Cast", description = "Yarr, ye treasures be mine!", }, }, }, ["MAGE"] = { all = { { raidbuff = LE.BUFFS.ARCANE_INTELLECT, } }, [1] = { { hasTalent = { 1, 3 }, bufflist = { LE.BUFFS.MAGE_ARCANE_FAMILIAR, }, condition = function() return Addon.db.global.Class.Mage.EnableArcaneFamiliar; end, }, }, }, ["WARLOCK"] = { special = { { bufflist = { LE.BUFFS.WARLOCK_SOULSTONE, }, condition = function() if(Addon:IsSpellReady(LE.BUFFS.WARLOCK_SOULSTONE) and Addon.db.global.Class.Warlock.EnableSoulstone) then if(Addon.db.global.Class.Warlock.OnlyEnableSolo and Addon:GetGroupType() ~= LE.GROUP_TYPE.SOLO) then return false end if(Addon.db.global.Class.Warlock.OnlyEnableOutside and Addon:PlayerInInstance()) then return false end if(Addon.db.global.Class.Warlock.ExpiryOverride and Addon:GetBuffRemaining("player", LE.BUFFS.WARLOCK_SOULSTONE) > 300) then return false; end return true; end return false; end, }, { hasTalent = { 6, 3 }, bufflist = { LE.BUFFS.WARLOCK_GRIMOIRE_OF_SACRIFICE }, condition = function() -- This talent location has something else for demonology if(GetSpecialization() == 2) then return false end local hasBuff = Addon:UnitHasBuff("player", LE.BUFFS.WARLOCK_GRIMOIRE_OF_SACRIFICE_EFFECT); return not hasBuff and Addon.db.global.Class.Warlock.EnableGrimoireSacrificeAlert; end, description = function() if(UnitName("pet") == nil) then return "Summon a demon to sacrifice"; end return "Sacrifice your demon"; end, }, }, }, ["HUNTER"] = { }, ["DEMONHUNTER"] = { }, }; local function tmerge(table, other) for key, value in ipairs(other) do tinsert(table, value); end return table; end function Addon:GetClassCastableBuffs(class, spec) local merged = {}; if(CLASS_CASTABLE_BUFFS[class].all) then tmerge(merged, CLASS_CASTABLE_BUFFS[class].all); end if(CLASS_CASTABLE_BUFFS[class].special) then tmerge(merged, CLASS_CASTABLE_BUFFS[class].special); end if(spec and CLASS_CASTABLE_BUFFS[class][spec]) then tmerge(merged, CLASS_CASTABLE_BUFFS[class][spec]); elseif(CLASS_CASTABLE_BUFFS[class][0]) then tmerge(merged, CLASS_CASTABLE_BUFFS[class][0]); end if(CLASS_CASTABLE_BUFFS["ALL"]) then tmerge(merged, CLASS_CASTABLE_BUFFS["ALL"]); end return merged; end local PEPE_TOY_ITEM_ID = 122293; local HEARTSBANE_GRIMOIRE_TOY_ITEM_ID = 163742; -- Miscellaneous category, low priority selfbuffs or other stuff LE.MISC_CASTABLE_BUFFS = { { bufflist = { LE.BUFFS.PEPE }, skipBuffCheck = true, condition = function() if(not Addon.db.global.PepeReminderEnabled or InCombatLockdown()) then return false end if(not PlayerHasToy(PEPE_TOY_ITEM_ID)) then return false end local inInstance, instanceType = Addon:PlayerInInstance(); if(inInstance and (instanceType == "pvp" or instanceType == "arena")) then return false end local hasBuff = Addon:UnitHasBuff("player", LE.BUFFS.PEPE); if(hasBuff) then return false end local start, duration, enable = GetItemCooldown(PEPE_TOY_ITEM_ID); return start == 0 and duration == 0; end, description = function() local quotes = { "You've not got a friend! :(", "Put a birb on it!", "It's dangerous to go alone!", "Pepe is love, Pepe is life", "It's a rough neighborhood", "Pepe for Warchief!", "You found Pepe!", "The Lil' Tangerine Traveller", }; return quotes[math.floor(GetTime() / 120) % (#quotes) + 1]; end, info = { type = "toy", id = PEPE_TOY_ITEM_ID, }, }, { bufflist = { LE.BUFFS.HEARTSBANE_CURSE }, skipBuffCheck = true, condition = function() if(not Addon.db.global.WitchCurseReminderEnabled or InCombatLockdown()) then return false end if(not PlayerHasToy(HEARTSBANE_GRIMOIRE_TOY_ITEM_ID)) then return false end local inInstance, instanceType = Addon:PlayerInInstance(); if(inInstance and (instanceType == "pvp" or instanceType == "arena")) then return false end local hasBuff = Addon:UnitHasBuff("player", LE.BUFFS.HEARTSBANE_CURSE); if(hasBuff) then return false end local start, duration, enable = GetItemCooldown(HEARTSBANE_GRIMOIRE_TOY_ITEM_ID); return start == 0 and duration == 0; end, description = function() local quotes = { "I've got 99 problems, all of them witches", }; return quotes[math.floor(GetTime() / 120) % (#quotes) + 1]; end, info = { type = "toy", id = HEARTSBANE_GRIMOIRE_TOY_ITEM_ID, }, }, } ----------------------------------------------------------------- -- Consumable spells BUFFY_CONSUMABLES = { FLASKS = {}, RUNES = {}, FOODS = {}, }; BUFFY_ITEM_SPELLS = {}; ------------------------------- -- Generic consumables Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.GENERIC, LE.STAT.AGILITY, { 147707, 129192, 118922, 86569 }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.GENERIC, LE.STAT.STRENGTH, { 147707, 118922, 86569 }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.GENERIC, LE.STAT.INTELLECT, { 147707, 118922, 86569 }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.GENERIC, LE.STAT.STAMINA, { 147707, 129192, 118922, }); Addon:AddItemSpell(147707, 242551); -- Repurposed Fel Focuser Addon:AddItemSpell(118922, 176151); -- Oralius' Crystal Addon:AddItemSpell(86569, 127230); -- Crystal of Insanity Addon:AddItemSpell(129192, 193456); -- Inquisitor's Menacing Eye Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.GENERIC, LE.STAT.CUSTOM, { }); ------------------------------- -- Draenor consumables Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.AGILITY, { 109153, 109145, }); Addon:AddItemSpell(109153, 156064); -- Greater Draenic Agility Flask Addon:AddItemSpell(109145, 156073); -- Draenic Agility Flask Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.STRENGTH, { 109156, 109148, }); Addon:AddItemSpell(109156, 156080); -- Greater Draenic Strength Flask Addon:AddItemSpell(109148, 156071); -- Draenic Strength Flask Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.INTELLECT, { 109155, 109147, }); Addon:AddItemSpell(109155, 156079); -- Greater Draenic Intellect Flask Addon:AddItemSpell(109147, 156070); -- Draenic Intellect Flask Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.STAMINA, { 109160, 109152, }); Addon:AddItemSpell(109160, 156084); -- Greater Draenic Stamina Flask Addon:AddItemSpell(109152, 156077); -- Draenic Stamina Flask -- Non-consumable rune is listed first (if exists) Addon:AddBuffItems(BUFFY_CONSUMABLES.RUNES, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.AGILITY, { 128482, 128475, 118630 }); Addon:AddItemSpell(118630, 175456); Addon:AddBuffItems(BUFFY_CONSUMABLES.RUNES, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.STRENGTH, { 128482, 128475, 118631 }); Addon:AddItemSpell(118631, 175439); Addon:AddBuffItems(BUFFY_CONSUMABLES.RUNES, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.INTELLECT, { 128482, 128475, 118632 }); Addon:AddItemSpell(118632, 175457); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.HASTE, { 122348, 111450, 118428, 111434, 111442, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.MASTERY, { 122343, 111452, 118428, 111436, 111444, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.CRIT, { 122345, 111449, 118428, 111433, 111441, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.VERSATILITY, { 122346, 111454, 118428, 111438, 111446, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.STAMINA, { 122347, 111447, 111431, 111439, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.DRAENOR, LE.STAT.SPECIAL, { 127991, }); -- Felmouth ------------------------------- -- Legion consumables Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.AGILITY, { 127858, 127848, }); Addon:AddItemSpell(127848, 188033); -- Flask of the Seventh Demon Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.STRENGTH, { 127858, 127849, }); Addon:AddItemSpell(127849, 188034); -- Flask of the Countless Armies Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.INTELLECT, { 127858, 109147, }); Addon:AddItemSpell(127847, 188031); -- Flask of the Whispered Pact Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.STAMINA, { 127858, 127850, }); Addon:AddItemSpell(127850, 188035); -- Flask of Ten Thousand Scars -- Non-consumable rune is listed first (if exists) Addon:AddBuffItems(BUFFY_CONSUMABLES.RUNES, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.AGILITY, { 153023, 140587 }); Addon:AddBuffItems(BUFFY_CONSUMABLES.RUNES, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.STRENGTH, { 153023, 140587 }); Addon:AddBuffItems(BUFFY_CONSUMABLES.RUNES, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.INTELLECT, { 153023, 140587 }); Addon:AddItemSpell(140587, 224001); Addon:AddItemSpell(153023, 224001); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.HASTE, { 133571, 133566, 133561, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.MASTERY, { 133572, 133567, 133562, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.CRIT, { 133570, 133565, 133557, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.VERSATILITY, { 133573, 133568, 133563, }); -- Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.STAMINA, { }); -- No stamina foods Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.LEGION, LE.STAT.SPECIAL, { 133574, 133569, 133564, }); -- Pepper Breath foods ------------------------------- -- BFA consumables -- Order of flasks is: greater cauldron flask, greater normal flask, cauldron flask, normal flask Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.AGILITY, { 168655, 168651, 162518, 152638, }); Addon:AddItemSpell(152638, 251836); -- Flask of the Currents Addon:AddItemSpell(168651, 298836); -- Greater Flask of the Currents Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.STRENGTH, { 168655, 168654, 162518, 152641, }); Addon:AddItemSpell(152641, 251839); -- Flask of the Undertow Addon:AddItemSpell(168654, 298841); -- Greater Flask of the Undertow Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.INTELLECT, { 168655, 168652, 162518, 152639, }); Addon:AddItemSpell(152639, 251837); -- Flask of Endless Fathoms Addon:AddItemSpell(168652, 298837); -- Greater Flask of Endless Fathoms Addon:AddBuffItems(BUFFY_CONSUMABLES.FLASKS, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.STAMINA, { 168655, 168653, 162518, 152640, }); Addon:AddItemSpell(152640, 251838); -- Flask of the Vast Horizon Addon:AddItemSpell(168653, 298839); -- Greater Flask of the Vast Horizon -- Non-consumable rune is listed first (if exists) Addon:AddBuffItems(BUFFY_CONSUMABLES.RUNES, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.AGILITY, { 160053, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.RUNES, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.STRENGTH, { 160053, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.RUNES, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.INTELLECT, { 160053, }); Addon:AddItemSpell(160053, 270058); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.HASTE, { 168313, 166804, 154884, 154883, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.MASTERY, { 168311, 166804, 154888, 154887, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.CRIT, { 168310, 166804, 154882, 154881, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.VERSATILITY, { 168314, 166804, 154886, 154885, }); Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.STAMINA, { 166342, 166343 }); --Addon:AddBuffItems(BUFFY_CONSUMABLES.FOODS, LE.CONSUMABLE_CATEGORY.BFA, LE.STAT.SPECIAL, { }); -- No special foods ------------------------------- -- Feasts BUFFY_CONSUMABLES.FEASTS = { [LE.CONSUMABLE_CATEGORY.DRAENOR] = { [175215] = { -- Savage Feast item = 118576, duration = 180, stats = 80, }, [160740] = { -- Feast of Waters item = 111458, duration = 180, stats = 12, }, [160740] = { -- Feast of Blood item = 111457, duration = 180, stats = 12, }, }, [LE.CONSUMABLE_CATEGORY.LEGION] = { [201352] = { -- Lavish Suramar Feast item = 133579, duration = 180, stats = 22, }, [201351] = { -- Hearty Feast item = 133578, duration = 180, stats = 18, }, }, [LE.CONSUMABLE_CATEGORY.BFA] = { [297048] = { -- Famine Evaluator And Snack Table item = 168315, duration = 180, stats = 131, }, [286050] = { -- Sanguinated Feast item = 166240, duration = 180, stats = 100, }, [259410] = { -- Bountiful Captain's Feast item = 156526, duration = 180, stats = 100, }, [259409] = { -- Galley Banquet item = 156525, duration = 180, stats = 75, }, }, }; ----------------------------------------------------------------- local function ltinsert(table, list) if(not table or type(table) ~= "table") then return false end if(not list or type(list) ~= "table") then return false end for key, value in ipairs(list) do table[key] = value; end end -- Reference table for main stats for classes and specs local CLASS_STAT_PREFS = { ["WARRIOR"] = { [0] = { LE.STAT.STRENGTH }, [3] = { LE.STAT.STAMINA, LE.STAT.STRENGTH }; }, ["DEATHKNIGHT"] = { [0] = { LE.STAT.STRENGTH }, [1] = { LE.STAT.STAMINA, LE.STAT.STRENGTH }, }, ["PALADIN"] = { [1] = { LE.STAT.INTELLECT }, [2] = { LE.STAT.STAMINA, LE.STAT.STRENGTH }, [3] = { LE.STAT.STRENGTH }, }, ["MONK"] = { [1] = { LE.STAT.STAMINA, LE.STAT.AGILITY }, [2] = { LE.STAT.INTELLECT }, [3] = { LE.STAT.AGILITY }, }, ["PRIEST"] = { [0] = { LE.STAT.INTELLECT }, }, ["SHAMAN"] = { [0] = { LE.STAT.INTELLECT }, [2] = { LE.STAT.AGILITY }, }, ["DRUID"] = { [1] = { LE.STAT.INTELLECT }, [2] = { LE.STAT.AGILITY }, [3] = { LE.STAT.STAMINA, LE.STAT.AGILITY }, [4] = { LE.STAT.INTELLECT }, }, ["ROGUE"] = { [0] = { LE.STAT.AGILITY }, }, ["MAGE"] = { [0] = { LE.STAT.INTELLECT }, }, ["WARLOCK"] = { [0] = { LE.STAT.INTELLECT }, }, ["HUNTER"] = { [0] = { LE.STAT.AGILITY }, }, ["DEMONHUNTER"] = { [0] = { LE.STAT.AGILITY }, [2] = { LE.STAT.STAMINA, LE.STAT.AGILITY } }, }; function Addon:GetStatPreference(class, spec_index) if(not class or not spec_index) then return -1; end local statTypes = CLASS_STAT_PREFS[class][spec_index] or CLASS_STAT_PREFS[class][0]; local stats = {}; ltinsert(stats, statTypes); if(#stats == 2 and stats[1] == LE.STAT.STAMINA and self.db.global.ConsumablesRemind.SkipStamina) then -- Swap stats stats[1], stats[2] = stats[2], stats[1] end return stats; end local TANK_SPECS = { ["WARRIOR"] = { [3] = true, }, ["DEATHKNIGHT"] = { [1] = true, }, ["PALADIN"] = { [2] = true, }, ["MONK"] = { [1] = true, }, ["DRUID"] = { [3] = true, }, ["DEMONHUNTER"] = { [2] = true, }, }; function Addon:PlayerInTankSpec() local _, PLAYER_CLASS = UnitClass("player"); local spec = GetSpecialization(); if(not TANK_SPECS[PLAYER_CLASS] or not TANK_SPECS[PLAYER_CLASS][spec]) then return false; end return TANK_SPECS[PLAYER_CLASS] and TANK_SPECS[PLAYER_CLASS][spec]; end
local SubType = { [0] = true, [1] = true, [2] = true, [3] = true, } return function (Data) assert(SubType[Data],"丢弃类型【"..Data.."】错误,必须为0,1,2,3其中之一") return Data end
local tree_cb = require'nvim-tree.config'.nvim_tree_callback require'bufferline'.setup{} require'nvim-tree'.setup{ follow = 1, view = { width = 36, mappings = { list = { { key = { '.' }, cb = tree_cb('toggle_dotfiles') }, { key = { 'n' }, cb = tree_cb('create') }, { key = { 'r' }, cb = tree_cb('full_rename') }, { key = { '<' }, cb = tree_cb('dir_up') }, { key = { '<C-r>' }, cb = tree_cb('refresh') }, } } }, update_focused_file = { enable = true, update_cwd = true, } } vim.g.nvim_tree_icons = { default = '', symlink = '', git = { unstaged = '', staged = '', unmerged = '', renamed = '', untracked = '?', deleted = '', ignored = '' }, folder_icons = { default = '', open = '', empty = '', empty_open = '', symlink = '', symlink_open = '', }, lsp = { hint = '', info = '', warning = '', error = '', } }
object_static_structure_general_waypoint_personal_cyan = object_static_structure_general_shared_waypoint_personal_cyan:new { } ObjectTemplates:addTemplate(object_static_structure_general_waypoint_personal_cyan, "object/static/structure/general/waypoint_personal_cyan.iff")
function exemplo() print("--------------------------") print("Lado negaivo de dar 'wrap' é que você não tem como retorno o estado da thread") print("--------------------------") coroutine.yield() print("--------------------------") print("Isso retornou nil, em vez de true ou false") print("--------------------------") end function love.load() threadExemplo = coroutine.wrap(exemplo) print("EXEMPLO 9") retorno = threadExemplo() print(retorno) print("RODANDOD NOVAMENTE") threadExemplo() print("FIM") end function love.update() end function love.draw() end
-- Option frame system credits to Shagu, pfUI zUI:RegisterComponent("zOptions", function () ZUI_MINIMAPBUTTON_LINE1 = "Click to toggle Options" ZUI_MINIMAPBUTTON_LINE2 = "Right-click and drag" local faction = UnitFactionGroup("player"); zUI.MinimapButtonFrame = CreateFrame("frame", "zMiniMapButtonFrame", Minimap); zMiniMapButtonFrame:EnableMouse(true); zMiniMapButtonFrame:SetFrameStrata("LOW"); zMiniMapButtonFrame:SetWidth(32); zMiniMapButtonFrame:SetHeight(32); zMiniMapButtonFrame:SetPoint("TOPLEFT", Minimap, "RIGHT", 2, 0); zMiniMapButtonFrame:RegisterEvent("VARIABLES_LOADED"); zMiniMapButtonFrame.Button = CreateFrame("Button", "zMiniMapButton", zMiniMapButtonFrame); zMiniMapButton:SetAllPoints(zMiniMapButtonFrame); --zMiniMapButton:SetNormalTexture("Interface\\AddOns\\zUI\\img\\minibutton\\zUIMapButton3"); zMiniMapButton:SetNormalTexture("Interface\\AddOns\\zUI\\img\\zUIMapButton-Up3"); zMiniMapButton:SetPushedTexture("Interface\\AddOns\\zUI\\img\\zUIMapButton-Down"); zMiniMapButton:SetHighlightTexture("Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight"); zMiniMapButtonFrame:SetScript("OnEvent", function() if(event == "VARIABLES_LOADED") then zMiniMapButton:RegisterForClicks("LeftButtonDown", "RightButtonDown"); zMiniMapButton:RegisterForDrag("RightButton"); zMiniMapButton.dragStart = false; zUI_Button_UpdatePosition(); --zUI.MinimapButton_Init(); end end) zMiniMapButton:SetScript("OnDragStart", function() zMiniMapButton.dragStart = true; end) zMiniMapButton:SetScript("OnDragStop", function() zMiniMapButton.dragStart = false; end) zMiniMapButton:SetScript("OnUpdate", function() if (zMiniMapButton.dragStart == true) then zUI_Button_BeingDragged(); end end) zMiniMapButton:SetScript("OnClick", function() if arg1=="LeftButton" then if zUI.gui:IsShown() then zUI.gui:Hide() else zUI.gui:Show() end end end) zMiniMapButton:SetScript("OnEnter", function() GameTooltip:SetOwner(this, "ANCHOR_LEFT"); GameTooltip:AddLine(ZUI_MINIMAPBUTTON_LINE1); GameTooltip:AddLine(ZUI_MINIMAPBUTTON_LINE2); GameTooltip:Show(); end) zMiniMapButton:SetScript("OnLeave", function() GameTooltip:Hide(); end) ------------------------------------------------------------------- function zUI_Button_UpdatePosition() zMiniMapButtonFrame:SetPoint( "TOPLEFT", "Minimap", "TOPLEFT", 54 - (78 * cos(zUI_config.minimap.button_pos)), (78 * sin(zUI_config.minimap.button_pos)) - 55 ); end function zUI_Button_BeingDragged() local x,y = GetCursorPosition() local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom() x = xmin-x/UIParent:GetScale()+70 y = y/UIParent:GetScale()-ymin-70 zUI_Button_SetPosition(math.deg(math.atan2(y,x))); end function zUI_Button_SetPosition(v) if(v < 0) then v = v + 360; end zUI_config.minimap.button_pos = v; zUI_Button_UpdatePosition(); end if (C.minimap.button_hide == "1") then zMiniMapButtonFrame:Hide(); end ------------------------------------------------------------------- local Reload, U, PrepareDropDownButton, CreateConfig, CreateTabFrame, CreateArea, CreateGUIEntry, EntryUpdate StaticPopupDialogs["CHANGES_RELOAD"] = { text = "Reload UI for changes to take effect.", button1 = "Reload UI", button2 = "Ignore", OnAccept = function() ReloadUI(); end, timeout = 0, whileDead = true, hideOnEscape = true } do function Reload() --CreateQuestionDialog("Some settings need to reload the UI to take effect.\nDo you want to reload now?", function() -- zUI.gui.settingChanged = nil -- ReloadUI() --end) StaticPopup_Show("CHANGES_RELOAD"); end U = setmetatable({}, { __index = function(tab,key) local ufunc if zUI[key] and zUI[key].UpdateConfig then ufunc = function() return zUI[key]:UpdateConfig() end elseif zUI.uf and zUI.uf[key] and zUI.uf[key].UpdateConfig then ufunc = function() return zUI.uf[key]:UpdateConfig() end end if ufunc then rawset(tab,key,ufunc) return ufunc end end}) function PrepareDropDownButton(index) if index > _G.UIDROPDOWNMENU_MAXBUTTONS then for i=1,3 do local name = "DropDownList" .. i .. "Button" .. index local parent = _G["DropDownList" .. i] _G.UIDROPDOWNMENU_MAXBUTTONS = index _G[name] = CreateFrame("Button", name, parent, "UIDropDownMenuButtonTemplate") _G[name]:SetID(index) end end end function EntryUpdate() if MouseIsOver(this) and not this.over then this.tex:Show() this.over = true elseif not MouseIsOver(this) and this.over then this.tex:Hide() this.over = nil end end function CreateConfig(ufunc, caption, category, config, widget, values, skip, named, type) -- this object placement if this.objectCount == nil then this.objectCount = 0 elseif not skip then this.objectCount = this.objectCount + 1 this.lineCount = 1 end if skip then if this.lineCount == nil then this.lineCount = 1 end if skip then this.lineCount = this.lineCount + 1 end end if not caption then return end -- basic frame local frame = CreateFrame("Frame", nil, this) frame:SetWidth(this.parent:GetRight()-this.parent:GetLeft()-20) frame:SetHeight(22) frame:SetPoint("TOPLEFT", this, "TOPLEFT", 5, (this.objectCount*-23)-5) -- populate search index --if caption and this and this.GetParent and widget ~= "button" and widget ~= "header" then -- local id = tostring(frame) -- -- searchDB[id] = searchDB[id] or { } -- searchDB[id][0] = caption -- searchDB[id][-1] = frame -- -- -- scrollchild scrollframe Area Area Btton -- -- this .parent :GetParent():GetParent().button -- -- this .parent :GetParent().button -- local scrollframe = this.parent -- while scrollframe.GetParent and scrollframe:GetParent() and scrollframe:GetParent().button do -- table.insert(searchDB[id], scrollframe:GetParent().button) -- scrollframe = scrollframe:GetParent() -- end --end if not widget or (widget and widget ~= "button") then if widget ~= "header" then frame:SetScript("OnUpdate", EntryUpdate) frame.tex = frame:CreateTexture(nil, "BACKGROUND") frame.tex:SetTexture(1,1,1,.05) frame.tex:SetAllPoints() frame.tex:Hide() end if not ufunc and widget ~= "header" and C.gui.reloadmarker == "1" then caption = caption .. " [|cffffaaaa!|r]" end -- caption frame.caption = frame:CreateFontString("Status", "LOW", "GameFontWhite") frame.caption:SetFont(STANDARD_TEXT_FONT, C.global.font_size) frame.caption:SetPoint("LEFT", frame, "LEFT", 3, 1) frame.caption:SetJustifyH("LEFT") frame.caption:SetText(caption) end if category == "CVAR" then category = {} category[config] = tostring(GetCVar(config)) ufunc = function() SetCVar(this:GetParent().config, this:GetParent().category[config]) end end --if category == "GVAR" then -- category = {} -- category[config] = tostring(_G[config] or 0) -- -- local U = ufunc -- -- ufunc = function() -- UIOptionsFrame_Load() -- _G[config] = this:GetChecked() and 1 or nil -- UIOptionsFrame_Save() -- if U then -- U() -- end -- end --end --if category == "UVAR" then -- category = {} -- category[config] = _G[config] -- -- local U = ufunc -- -- ufunc = function() -- _G[config] = this:GetChecked() and "1" or "0" -- if U then -- U() -- end -- end --end frame.category = category frame.config = config if widget == "color" then -- color picker frame.color = CreateFrame("Button", nil, frame) frame.color:SetWidth(24) frame.color:SetHeight(15) --CreateBackdrop(frame.color) zSkin(frame.color,0); zSkinColor(frame.color,0.3,0.3,0.3,1); frame.color:SetPoint("RIGHT" , -5, 0) frame.color.prev = frame.color:CreateTexture("OVERLAY") frame.color.prev:SetAllPoints(frame.color) local cr, cg, cb, ca = strsplit(",", category[config]) if not cr or not cg or not cb or not ca then cr, cg, cb, ca = 1, 1, 1, 1 end frame.color.prev:SetTexture(cr,cg,cb,ca) frame.color:SetScript("OnClick", function() local cr, cg, cb, ca = strsplit(",", category[config]) if not cr or not cg or not cb or not ca then cr, cg, cb, ca = 1, 1, 1, 1 end local preview = this.prev function ColorPickerFrame.func() local r,g,b = ColorPickerFrame:GetColorRGB() local a = 1 - OpacitySliderFrame:GetValue() r = round(r, 1) g = round(g, 1) b = round(b, 1) a = round(a, 1) preview:SetTexture(r,g,b,a) if not this:GetParent():IsShown() then category[config] = r .. "," .. g .. "," .. b .. "," .. a if ufunc then ufunc() else zUI.gui.settingChanged = true end end end function ColorPickerFrame.cancelFunc() preview:SetTexture(cr,cg,cb,ca) end ColorPickerFrame.opacityFunc = ColorPickerFrame.func ColorPickerFrame.element = this ColorPickerFrame.opacity = 1 - ca ColorPickerFrame.hasOpacity = 1 ColorPickerFrame:SetColorRGB(cr,cg,cb) ColorPickerFrame:SetFrameStrata("DIALOG") ShowUIPanel(ColorPickerFrame) end) -- hide shadows on wrong stratas --if frame.color.backdrop_shadow then -- frame.color.backdrop_shadow:Hide() --end end if widget == "warning" then CreateBackdrop(frame, nil, true) frame:SetBackdropBorderColor(1,.5,.5) frame:SetHeight(50) frame:SetPoint("TOPLEFT", 25, this.objectCount * -35) this.objectCount = this.objectCount + 2 frame.caption:SetJustifyH("CENTER") frame.caption:SetJustifyV("CENTER") end if widget == "header" then frame:SetBackdrop(nil) frame:SetHeight(40) this.objectCount = this.objectCount + 1 frame.caption:SetJustifyH("LEFT") frame.caption:SetJustifyV("BOTTOM") frame.caption:SetTextColor(1,0.82,0,1) -- .2,1,.8,1 frame.caption:SetAllPoints(frame) end -- use text widget (default) if not widget or widget == "text" then -- input field frame.input = CreateFrame("EditBox", nil, frame) CreateBackdrop(frame.input, nil, true) frame.input:SetTextInsets(5, 5, 5, 5) frame.input:SetTextColor(1,0.82,0,1) -- .2,1,.8,1 frame.input:SetJustifyH("RIGHT") frame.input:SetWidth(100) frame.input:SetHeight(18) frame.input:SetPoint("RIGHT" , -3, 0) frame.input:SetFontObject(GameFontNormal) frame.input:SetAutoFocus(false) frame.input:SetText(category[config]) frame.input:SetScript("OnEscapePressed", function(self) this:ClearFocus() end) frame.input:SetScript("OnTextChanged", function(self) if ( type and type ~= "number" ) or tonumber(this:GetText()) then if this:GetText() ~= this:GetParent().category[this:GetParent().config] then this:GetParent().category[this:GetParent().config] = this:GetText() if ufunc then ufunc() else zUI.gui.settingChanged = true end end this:SetTextColor(1,0.82,0,1) -- .2,1,.8,1 else this:SetTextColor(1,.3,.3,1) end end) -- hide shadows on wrong stratas if frame.input.backdrop_shadow then frame.input.backdrop_shadow:Hide() end end -- use button widget if widget == "button" then frame.button = CreateFrame("Button", "zButton", frame, "UIPanelButtonTemplate") CreateBackdrop(frame.button, nil, true) SkinButton(frame.button) frame.button:SetWidth(100) frame.button:SetHeight(20) frame.button:SetPoint("TOPRIGHT", -(this.lineCount-1) * 105, -5) frame.button:SetText(caption) frame.button:SetTextColor(1,1,1,1) frame.button:SetScript("OnClick", values) -- hide shadows on wrong stratas if frame.button.backdrop_shadow then frame.button.backdrop_shadow:Hide() end end -- use checkbox widget if widget == "checkbox" then -- input field frame.input = CreateFrame("CheckButton", nil, frame, "UICheckButtonTemplate") --frame.input:SetNormalTexture("") --frame.input:SetPushedTexture("") --frame.input:SetHighlightTexture("") --CreateBackdrop(frame.input, nil, true) frame.input:SetWidth(24) frame.input:SetHeight(24) -- 14 frame.input:SetPoint("RIGHT" , -5, 0) frame.input:SetScript("OnClick", function () if this:GetChecked() then this:GetParent().category[this:GetParent().config] = "1" else this:GetParent().category[this:GetParent().config] = "0" end if ufunc then ufunc() else zUI.gui.settingChanged = true end end) if category[config] == "1" then frame.input:SetChecked() end -- hide shadows on wrong stratas if frame.input.backdrop_shadow then frame.input.backdrop_shadow:Hide() end end -- use dropdown widget --if widget == "dropdown" and values then -- if not zUI.gui.ddc then zUI.gui.ddc = 1 else zUI.gui.ddc = zUI.gui.ddc + 1 end -- local name = zUI.gui.ddc -- if named then name = named end -- -- frame.input = CreateFrame("Frame", "zUIDropDownMenu" .. name, frame, "UIDropDownMenuTemplate") -- frame.input:ClearAllPoints() -- frame.input:SetPoint("RIGHT", 16, -3) -- -- UIDropDownMenu_SetWidth(160, frame.input) -- UIDropDownMenu_SetButtonWidth(160, frame.input) -- UIDropDownMenu_JustifyText("RIGHT", frame.input) -- UIDropDownMenu_Initialize(frame.input, function() -- local info = {} -- frame.input.values = _G.type(values)=="function" and values() or values -- for i, k in pairs(frame.input.values) do -- -- create new dropdown buttons when we reach the limit -- PrepareDropDownButton(i) -- -- -- get human readable -- local value, text = strsplit(":", k) -- text = text or value -- -- info.text = text -- info.checked = false -- info.func = function() -- UIDropDownMenu_SetSelectedID(frame.input, this:GetID(), 0) -- UIDropDownMenu_SetText(this:GetText(), frame.input) -- if category[config] ~= value then -- category[config] = value -- if ufunc then ufunc() else zUI.gui.settingChanged = true end -- end -- end -- -- UIDropDownMenu_AddButton(info) -- if category[config] == value then -- frame.input.current = i -- end -- end -- end) -- UIDropDownMenu_SetSelectedID(frame.input, frame.input.current) -- -- SkinDropDown(frame.input) -- frame.input.backdrop:Hide() -- frame.input.button.icon:SetParent(frame.input.button.backdrop) -- -- -- hide shadows on wrong stratas -- if frame.input.backdrop_shadow then -- frame.input.backdrop_shadow:Hide() -- frame.input.button.backdrop_shadow:Hide() -- end --end -- use list widget --if widget == "list" then -- if not zUI.gui.ddc then zUI.gui.ddc = 1 else zUI.gui.ddc = zUI.gui.ddc + 1 end -- local name = zUI.gui.ddc -- if named then name = named end -- -- frame.input = CreateFrame("Frame", "zUIDropDownMenu" .. name, frame, "UIDropDownMenuTemplate") -- frame.input:ClearAllPoints() -- frame.input:SetPoint("RIGHT" , -22, -3) -- frame.category = category -- frame.config = config -- -- frame.input.Refresh = function() -- local function CreateValues() -- for i, val in pairs({strsplit("#", category[config])}) do -- -- create new dropdown buttons when we reach the limit -- PrepareDropDownButton(i) -- -- UIDropDownMenu_AddButton({ -- ["text"] = val, -- ["checked"] = false, -- ["func"] = function() -- UIDropDownMenu_SetSelectedID(frame.input, this:GetID(), 0) -- end -- }) -- end -- end -- -- UIDropDownMenu_Initialize(frame.input, CreateValues) -- UIDropDownMenu_SetText("", frame.input) -- end -- -- frame.input:Refresh() -- -- UIDropDownMenu_SetWidth(160, frame.input) -- UIDropDownMenu_SetButtonWidth(160, frame.input) -- UIDropDownMenu_JustifyText("RIGHT", frame.input) -- UIDropDownMenu_SetSelectedID(frame.input, frame.input.current) -- -- SkinDropDown(frame.input) -- frame.input.backdrop:Hide() -- frame.input.button.icon:SetParent(frame.input.button.backdrop) -- -- frame.add = CreateFrame("Button", "zUIDropDownMenu" .. name .. "Add", frame, "UIPanelButtonTemplate") -- SkinButton(frame.add) -- frame.add:SetWidth(18) -- frame.add:SetHeight(18) -- frame.add:SetPoint("RIGHT", -21, 0) -- frame.add:GetFontString():SetPoint("CENTER", 1, 0) -- frame.add:SetText("+") -- frame.add:SetTextColor(.5,1,.5,1) -- frame.add:SetScript("OnClick", function() -- CreateQuestionDialog(T["New entry:"], function() -- category[config] = category[config] .. "#" .. this:GetParent().input:GetText() -- end, false, true) -- end) -- -- frame.del = CreateFrame("Button", "zUIDropDownMenu" .. name .. "Del", frame, "UIPanelButtonTemplate") -- SkinButton(frame.del) -- frame.del:SetWidth(18) -- frame.del:SetHeight(18) -- frame.del:SetPoint("RIGHT", -2, 0) -- frame.del:GetFontString():SetPoint("CENTER", 1, 0) -- frame.del:SetText("-") -- frame.del:SetTextColor(1,.5,.5,1) -- frame.del:SetScript("OnClick", function() -- local sel = UIDropDownMenu_GetSelectedID(frame.input) -- local newconf = "" -- for id, val in pairs({strsplit("#", category[config])}) do -- if id ~= sel then newconf = newconf .. "#" .. val end -- end -- category[config] = newconf -- frame.input:Refresh() -- end) -- -- -- hide shadows on wrong stratas -- if frame.input.backdrop_shadow then -- frame.input.backdrop_shadow:Hide() -- frame.input.button.backdrop_shadow:Hide() -- frame.add.backdrop_shadow:Hide() -- frame.del.backdrop_shadow:Hide() -- end -- end return frame end local TabFrameOnClick = function() if this.area:IsShown() then return else -- hide all others for id, name in pairs(this.parent) do if type(name) == "table" and name.area and id ~= "parent" then name.area:Hide() end end this.area:Show() end end local width, height = 130, 20 function CreateTabFrame(parent, title) if not parent.area.count then parent.area.count = 0 end local f = CreateFrame("Button", nil, parent.area) f:SetPoint("TOPLEFT", parent.area, "TOPLEFT", 0, -parent.area.count*height) f:SetPoint("BOTTOMRIGHT", parent.area, "TOPLEFT", width, -(parent.area.count+1)*height) f.parent = parent f:SetScript("OnMouseDown", TabFrameOnMouseDown) f:SetScript("OnClick", TabFrameOnClick) -- background f.bg = f:CreateTexture(nil, "BACKGROUND") f.bg:SetAllPoints() -- text f.text = f:CreateFontString(nil, "LOW", "GameFontWhite") --f.text:SetFont(zUI.font_default, C.global.font_size) f.text:SetFont(STANDARD_TEXT_FONT, C.global.font_size) f.text:SetAllPoints() f.text:SetText(title) -- U element count parent.area.count = parent.area.count + 1 return f end function CreateArea(parent, title, func) -- create drawarea local f = CreateFrame("Frame", nil, parent.area) f:SetPoint("TOPLEFT", parent.area, "TOPLEFT", width, 0) f:SetPoint("BOTTOMRIGHT", parent.area, "BOTTOMRIGHT", 0, 0) if not parent.firstarea then parent.firstarea = true else f:Hide() end f.button = parent[title] f.bg = f:CreateTexture(nil, "BACKGROUND") f.bg:SetTexture(1,1,1,.05) f.bg:SetAllPoints() f:SetScript("OnShow", function() this.indexed = true --1,0.82,0 this.button.text:SetTextColor(1,0.82,0,1) this.button.bg:SetTexture(1,1,1,.05) --this.button.bg:SetGradientAlpha("HORIZONTAL", 0,0,0,0, 1,1,1,.05) end) f:SetScript("OnHide", function() this.button.text:SetTextColor(1,1,1,1) this.button.bg:SetTexture(0,0,0,0) end) -- are we a frame with contents? if func then f.scroll = CreateScrollFrame(nil, f) SetAllPointsOffset(f.scroll, f, 2) f.scroll.content = CreateScrollChild(nil, f.scroll) f.scroll.content.parent = f.scroll f.scroll.content:SetScript("OnShow", function() if not this.setup then func() this.setup = true end end) end return f end function CreateGUIEntry(parent, title, populate) -- create main menu if not yet exists if not zUI.gui.frames[parent] then zUI.gui.frames[parent] = CreateTabFrame(zUI.gui.frames, parent) if title then zUI.gui.frames[parent].area = CreateArea(zUI.gui.frames, parent, nil) else -- populate area when no submenus are given zUI.gui.frames[parent].area = CreateArea(zUI.gui.frames, parent, populate) return end end -- create submenus when title was given if title and not zUI.gui.frames[parent][title] then zUI.gui.frames[parent][title] = CreateTabFrame(zUI.gui.frames[parent], title) zUI.gui.frames[parent][title].area = CreateArea(zUI.gui.frames[parent], title, populate) end end end do -- GUI Frame -- main frame zUI.gui = CreateFrame("Frame", "zOptionsGUI", UIParent) zUI.gui:SetMovable(true) zUI.gui:EnableMouse(true) zUI.gui:SetWidth(620) zUI.gui:SetHeight(480) zUI.gui:SetFrameStrata("DIALOG") zUI.gui:SetPoint("CENTER", 0, 0) zUI.gui:Hide() zUI.gui:SetBackdrop({bgFile = [[Interface\ChatFrame\ChatFrameBackground]], tiled = false, insets = {left = 1, right = 1, top = 1, bottom = 1}}) zUI.gui:SetBackdropColor(0, 0, 0, 0.96) --zUI.gui:SetBackdropBorderColor(.2, .2, .2) zUI.gui:SetMovable(true) zUI.gui:SetUserPlaced(true) zUI.gui:RegisterForDrag'LeftButton' zUI.gui:EnableMouse(true) zUI.gui:SetScript("OnMouseDown",function() this:StartMoving() end) zUI.gui:SetScript("OnMouseUp",function() this:StopMovingOrSizing() end) --zUI.gui:SetScript("OnEscapePressed", function(self) -- this:Hide() -- end) tinsert(UISpecialFrames, "zOptionsGUI") zStyle_Button(zUI.gui) --square borders. zUI.gui.Reload = Reload zUI.gui.x = CreateFrame('Button', 'ufi_optionsCloseButton', zUI.gui, 'UIPanelCloseButton') zUI.gui.x:SetWidth(24) zUI.gui.x:SetHeight(24) zUI.gui.x:SetPoint('TOPRIGHT', 4, 4) zUI.gui.x:SetScript('OnClick', function() zUI.gui:Hide() end) zUI.gui:SetScript("OnShow",function() zUI.gui.settingChanged = zUI.gui.delaySettingChanged zUI.gui.delaySettingChanged = nil -- exit unlock mode --if zUI.unlock and zUI.unlock:IsShown() then -- zUI.unlock:Hide() --end -- exit keybind mode if zUI.zKeybind and zUI.zKeybind:IsShown() then zUI.zKeybind:Hide() end end) zUI.gui:SetScript("OnHide",function() if ColorPickerFrame and ColorPickerFrame:IsShown() then ColorPickerFrame:Hide() end if zUI.gui.settingChanged then zUI.gui:Reload() end zUI.gui:Hide() end) -- decorations zUI.gui.title = zUI.gui:CreateFontString("Status", "LOW", "GameFontNormal") zUI.gui.title:SetFontObject(GameFontWhite) zUI.gui.title:SetPoint("TOPLEFT", zUI.gui, "TOPLEFT", 8, -8) zUI.gui.title:SetJustifyH("LEFT") zUI.gui.title:SetFont(STANDARD_TEXT_FONT, 14, "OUTLINE") zUI.gui.title:SetText("|cffffd200z|cff808080UI") zUI.gui.version = zUI.gui:CreateFontString("Status", "LOW", "GameFontNormal") zUI.gui.version:SetFontObject(NumberFontNormal) zUI.gui.version:SetPoint("LEFT", zUI.gui.title, "RIGHT", 0, 0) zUI.gui.version:SetJustifyH("LEFT") zUI.gui.version:SetFont("Fonts\\ARIALN.TTF", 12) zUI.gui.version:SetText("|cff555555[|r" .. zUI.version.string.. "|cff555555]|r") -- root layer zUI.gui.frames = {} zUI.gui.frames.area = CreateFrame("Frame", nil, zUI.gui) zUI.gui.frames.area:SetPoint("TOPLEFT", 7, -25) zUI.gui.frames.area:SetPoint("BOTTOMRIGHT", -7, 37) --CreateBackdrop(zUI.gui.frames.area) --zUI.gui.frames.area:SetBackdrop({bgFile = [[Interface\ChatFrame\ChatFrameBackground]], -- tiled = false, -- insets = {left = 10, right = 10, top = -1, bottom = -1}}) --zUI.gui.frames.area:SetBackdropColor(0, 0, 0, 0.5) zStyle_Button(zUI.gui.frames.area) zSkinColor(zUI.gui.frames.area,0.2,0.2,0.2,1); -- hoverbind zUI.gui.hoverbind = CreateFrame("Button", nil, zUI.gui, "UIPanelButtonTemplate") zUI.gui.hoverbind:SetPoint("LEFT", zUI.gui.frames.area, "BOTTOMRIGHT", -108, -18) zUI.gui.hoverbind:SetWidth(110) zUI.gui.hoverbind:SetHeight(25) zUI.gui.hoverbind:SetText("Keybind") zUI.gui.hoverbind:SetScript("OnClick", function() if zUI.zKeybind then zUI.zKeybind:Show() end end) end do -- Generate Config UI CreateGUIEntry("About", nil, function() local currentURL = ""; StaticPopupDialogs['URL_GITLAB_COPY_DIALOG'] = { -- COPY BOX text = 'URL', button2 = CLOSE, timeout = 0, hasEditBox = 1, maxLetters = 1024, hasWideEditBox = 1, --editBoxWidth = 350, whileDead = true, hideOnEscape = true, OnShow = function() (this.icon or getglobal(this:GetName()..'AlertIcon')):Hide() --local editBox = this.editBox or _G[this:GetName()..'EditBox'] --local editBox = this.editBox or getglobal(this:GetName()..'EditBox') local editBox = this.editBox or getglobal(this:GetName()..'WideEditBox') editBox:SetText(currentURL) --editBox:SetTexture(""); editBox:SetWidth(240) editBox:SetFocus() editBox:HighlightText(0) local button2 = this.button2 or getglobal(this:GetName()..'Button2') button2:ClearAllPoints() button2:SetPoint('TOP', editBox, 'BOTTOM', 0, 10) button2:SetWidth(150) currentURL = nil end, } this.logo = this:CreateTexture(nil, 'OVERLAY', nil, 7) if(faction) then --this.logo:SetTexture("Interface\\AddOns\\zUI\\img\\Alliance-Logo") this.logo:SetTexture("Interface\\AddOns\\zUI\\img\\"..faction.."-Logo") else this.logo:SetTexture("Interface\\AddOns\\zUI\\img\\Horde-Logo") end this.logo:SetWidth(128) this.logo:SetHeight(128) this.logo:SetPoint('TOPLEFT', 150, 0) --QuestLogFrame.Material = QuestLogFrame:CreateTexture(nil, 'OVERLAY', nil, 7) --if(faction) then -- QuestLogFrame.Material:SetTexture("Interface\\AddOns\\zUI\\img\\QuestBG_" .. faction) --else -- QuestLogFrame.Material:SetTexture("Interface\\AddOns\\zUI\\img\\QuestBG_Horde") --end --QuestLogFrame.Material:SetWidth(514) --QuestLogFrame.Material:SetHeight(354) --QuestLogFrame.Material:SetPoint('TOPLEFT', QuestLogDetailScrollFrame) --QuestLogFrame.Material:SetVertexColor(.9, .9, .9) this.welcome = this:CreateFontString("Status", "LOW", "GameFontWhite") this.welcome:SetFont(STANDARD_TEXT_FONT, C.global.font_size) this.welcome:SetPoint("TOPLEFT", 140, -160) this.welcome:SetWidth(200) this.welcome:SetJustifyH("LEFT") this.welcome:SetText("Thank you for trying |cffffd200z|cff808080UI") this.bugs = this:CreateFontString("Status", "LOW", "GameFontWhite") this.bugs:SetFont(STANDARD_TEXT_FONT, C.global.font_size) this.bugs:SetPoint("TOPLEFT", 80, -180) this.bugs:SetWidth(300) this.bugs:SetJustifyH("LEFT") this.bugs:SetText("If you find any bugs, please report them to the addon issues section on the github page.") --this.versionc:SetText(T["Version"] .. ":") local gitlab = CreateFrame("Button", nil, this, "UIPanelButtonTemplate") gitlab:SetPoint("TOPLEFT", 160, -225) gitlab:SetWidth(100) gitlab:SetHeight(20) gitlab:SetText("Github") gitlab:SetScript("OnClick", function() currentURL = "https://github.com/Ko0z/zui" StaticPopup_Show("URL_GITLAB_COPY_DIALOG") end) --zUI.gui.hoverbind = CreateFrame("Button", nil, zUI.gui, "UIPanelButtonTemplate") --zUI.gui.hoverbind:SetPoint("LEFT", zUI.gui.frames.area, "BOTTOMRIGHT", -108, -18) --zUI.gui.hoverbind:SetWidth(110) --zUI.gui.hoverbind:SetHeight(25) --zUI.gui.hoverbind:SetText("Keybind") --zUI.gui.hoverbind:SetScript("OnClick", function() -- if zUI.zKeybind then zUI.zKeybind:Show() end --end) -- version --this.versionc = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.versionc:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.versionc:SetPoint("TOPLEFT", 150, -170) --this.versionc:SetWidth(200) --this.versionc:SetJustifyH("LEFT") --this.versionc:SetText(T["Version"] .. ":") --this.version = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.version:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.version:SetPoint("TOPRIGHT", 375, -170) --this.version:SetWidth(200) --this.version:SetJustifyH("RIGHT") --this.update = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.update:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.update:SetPoint("TOPLEFT", 200, -140) --this.update:SetPoint("TOPRIGHT", 375, -140) --this.update:SetJustifyH("CENTER") --this.update:SetTextColor(.2,1,.8) -- --this.screenc = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.screenc:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.screenc:SetPoint("TOPLEFT", 200, -200) --this.screenc:SetWidth(200) --this.screenc:SetJustifyH("LEFT") --this.screenc:SetText(T["Resolution"] .. ":") -- --this.screen = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.screen:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.screen:SetPoint("TOPRIGHT", 375, -200) --this.screen:SetWidth(200) --this.screen:SetJustifyH("RIGHT") -- --this.scalec = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.scalec:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.scalec:SetPoint("TOPLEFT", 200, -220) --this.scalec:SetWidth(200) --this.scalec:SetJustifyH("LEFT") --this.scalec:SetText(T["Scaling"] .. ":") -- --this.scale = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.scale:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.scale:SetPoint("TOPRIGHT", 375, -220) --this.scale:SetWidth(200) --this.scale:SetJustifyH("RIGHT") -- --this.clientc = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.clientc:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.clientc:SetPoint("TOPLEFT", 200, -250) --this.clientc:SetWidth(200) --this.clientc:SetJustifyH("LEFT") --this.clientc:SetText(T["Gameclient"] .. ":") -- --this.client = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.client:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.client:SetPoint("TOPRIGHT", 375, -250) --this.client:SetWidth(200) --this.client:SetJustifyH("RIGHT") -- --this.langc = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.langc:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.langc:SetPoint("TOPLEFT", 200, -270) --this.langc:SetWidth(200) --this.langc:SetJustifyH("LEFT") --this.langc:SetText(T["Language"] .. ":") --this.lang = this:CreateFontString("Status", "LOW", "GameFontWhite") --this.lang:SetFont(STANDARD_TEXT_FONT, C.global.font_size) --this.lang:SetPoint("TOPRIGHT", 375, -270) --this.lang:SetWidth(200) --this.lang:SetJustifyH("RIGHT") -- ---- info updater --local f = CreateFrame("Frame", nil, this) --f:SetScript("OnUpdate", function() -- if ( this.tick or 0) > GetTime() then return else this.tick = GetTime() + 1 end -- -- local parent = this:GetParent() -- local localversion = tonumber(zUI.version.major*10000 + zUI.version.minor*100 + zUI.version.fix) -- --local remoteversion = tonumber(zUI_init.updateavailable) or 0 -- --if localversion < remoteversion then -- -- parent.update:SetText("|cffffffff[|r!|cffffffff] " .. T["A new version is available"]) -- --end -- -- --parent.version:SetText(zUI.version.string) -- parent.screen:SetText(GetCVar("gxResolution")) -- parent.scale:SetText(round(UIParent:GetEffectiveScale(),2)) -- parent.client:SetText(GetBuildInfo() .. " (" .. GetLocale() .. ")") -- parent.lang:SetText(lang) --end) end) CreateGUIEntry("General", nil, function() CreateConfig(nil, T["Auto Hide Micro Menu"], C.global, "microbuttons_auto_hide", "checkbox") CreateConfig(nil, T["Show Endcaps (Gryphons)"], C.actionbars, "endcap", "checkbox") CreateConfig(nil, T["Enable Global Dark Mode"], C.global, "darkmode", "checkbox") CreateConfig(nil, T["Quality of Life"], nil, nil, "header") CreateConfig(nil, T["Auto Dismount"], C.quality, "auto_dismount", "checkbox") CreateConfig(nil, T["Auto Stance-Switch"], C.quality, "auto_stance", "checkbox") CreateConfig(nil, T["Retarget Feign Death"], C.quality, "feign_death", "checkbox") CreateConfig(nil, T["Swingtimer"], nil, nil, "header") CreateConfig(nil, T["Hide Swingtimer"], C.quality.swingtimer, "disable", "checkbox") CreateConfig(nil, T["Swingtimer for all classes"], C.quality.swingtimer, "enable_for_all", "checkbox") CreateConfig(nil, T["Swingtimer Color"], C.swingtimer, "color", "color") end) CreateGUIEntry("Actionbars", nil, function() CreateConfig(nil, T["Enable BFA-Style"], C.actionbars, "bfa_style", "checkbox") CreateConfig(nil, T["Enable Square Style"], C.actionbars, "squarebuttons", "checkbox") CreateConfig(nil, T["Hotkey Text Color"], C.hotkeys, "color", "color") CreateConfig(nil, T["Use Blizzard Hotkey Font"], C.hotkeys, "blizzard_font", "checkbox") CreateConfig(nil, T["Action Button Border Color"], C.skin, "dark", "color") end) CreateGUIEntry("Unitframes", nil, function() CreateConfig(nil, T["Compact Unitframes"], C.unitframes, "compactmode", "checkbox") CreateConfig(nil, T["Class Portraits"], C.unitframes, "classportraits", "checkbox") CreateConfig(nil, T["Show Status Glow Effect"], C.unitframes, "statusglow", "checkbox") CreateConfig(nil, T["Improved Pet Frame"], C.unitframes, "improvedpet", "checkbox") CreateConfig(nil, T["Text"], nil, nil, "header") CreateConfig(nil, T["Show Percentage"], C.unitframes, "percentages", "checkbox") CreateConfig(nil, T["Format HP/MP-Text (1000 = 1k)"], C.unitframes, "trueformat", "checkbox") CreateConfig(nil, T["Gradient Colored HP-Text"], C.unitframes, "coloredtext", "checkbox") CreateConfig(nil, T["Text Outlines"], C.unitframes, "nameoutline", "checkbox") CreateConfig(nil, T["Hide Pet Text"], C.unitframes, "hidepettext", "checkbox") CreateConfig(nil, T["Statusbars"], nil, nil, "header") CreateConfig(nil, T["Flat Textures"], C.unitframes, "healthtexture", "checkbox") CreateConfig(nil, T["Player Class Colored Healthbar"], C.unitframes, "playerclasscolor", "checkbox") CreateConfig(nil, T["NPC Class Colored Healthbar"], C.unitframes, "npcclasscolor", "checkbox") end) CreateGUIEntry("Castbar", nil, function() CreateConfig(nil, T["Hide Blizz Castbar"], C.castbar.player, "hide_blizz", "checkbox") CreateConfig(nil, T["Castbar Color"], C.appearance.castbar, "castbarcolor", "color") CreateConfig(nil, T["Castbar Channel Color"], C.appearance.castbar, "channelcolor", "color") CreateConfig(nil, T["Flat Castbar Textures"], C.castbar, "flat_texture", "checkbox") CreateConfig(nil, T["Player Castbar"], nil, nil, "header") CreateConfig(nil, T["Hide Player Castbar"], C.castbar.player, "hide_zUI", "checkbox") CreateConfig(nil, T["Player Castbar Above"], C.castbar.player, "above", "checkbox") CreateConfig(nil, T["Target Castbar"], nil, nil, "header") CreateConfig(nil, T["Hide Target Castbar"], C.castbar.target, "hide_zUI", "checkbox") CreateConfig(nil, T["Target Castbar Above"], C.castbar.target, "above", "checkbox") end) CreateGUIEntry("Nameplates", nil, function() CreateConfig(nil, T["Debuffs"], C.nameplates, "showdebuffs", "checkbox") CreateConfig(nil, T["Castbars"], C.nameplates, "showcastbar", "checkbox") CreateConfig(nil, T["Castbar Color"], C.nameplates, "castbarcolor", "color") CreateConfig(nil, T["Spell Names"], C.nameplates, "spellname", "checkbox") CreateConfig(nil, T["Clickthrough"], C.nameplates, "clickthrough", "checkbox") CreateConfig(nil, T["Combopoints"], C.nameplates, "cpdisplay", "checkbox") CreateConfig(nil, T["Class Colored Friendly Bars"], C.nameplates, "friendclassc", "checkbox") CreateConfig(nil, T["Class Colored Hostile Bars"], C.nameplates, "enemyclassc", "checkbox") CreateConfig(nil, T["Flat Health Textures"], C.nameplates, "flat_health_textures", "checkbox") CreateConfig(nil, T["Flat Castbar Textures"], C.nameplates, "flat_cast_textures", "checkbox") end) CreateGUIEntry("Buffs & Debuffs", nil, function() CreateConfig(nil, T["Show Player Debuffs"], C.aura, "player", "checkbox") CreateConfig(nil, T["Debuffs On Top"], C.aura, "above", "checkbox") CreateConfig(nil, T["Show Timers"], C.aura, "timers", "checkbox") end) CreateGUIEntry("Cooldowns", nil, function() CreateConfig(nil, T["Timer Low Color"], C.appearance.cd, "lowcolor", "color") CreateConfig(nil, T["Timer Normal Color"], C.appearance.cd, "normalcolor", "color") CreateConfig(nil, T["Timer Minute Color"], C.appearance.cd, "minutecolor", "color") CreateConfig(nil, T["Timer Hour Color"], C.appearance.cd, "hourcolor", "color") CreateConfig(nil, T["Timer Day Color"], C.appearance.cd, "daycolor", "color") end) CreateGUIEntry("Map", nil, function() CreateConfig(nil, T["Minimap"], nil, nil, "header") CreateConfig(nil, T["Square Minimap"], C.minimap, "square", "checkbox") CreateConfig(nil, T["Hide Minimap Button"], C.minimap, "button_hide", "checkbox") --CreateConfig(nil, T["Hide Clock"], C.minimap, "hide_clock", "checkbox") end) CreateGUIEntry(T["Components"], nil, function() table.sort(zUI.components) for i,c in pairs(zUI.components) do if c ~= "zOptions" then -- create disabled entry if not existing and display zUI:UpdateConfig("disabled", nil, c, "0") CreateConfig(nil, T["Disable Component"] .. " " .. c, C.disabled, c, "checkbox") end end end) end end)
--[[ @cond ___LICENSE___ -- Copyright (c) 2017 Zefiros Software. -- -- 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. -- -- @endcond --]] local function _installZPM() printf("%%{greenbg white bright}Installing ZPM version '%s'!", zpm._VERSION) if not zpm or (zpm and not zpm.__isLoaded) then zpm.onLoad() zpm.__isLoaded = true end zpm.loader.install:install() end if zpm.env.getBinDirectory() ~= _PREMAKE_DIR then newaction { trigger = "install", description = "Installs packages", execute = function() local help = false if (#_ARGS == 1 and _ARGS[1] == "zpm") then _installZPM() else help = true end if help or zpm.cli.showHelp() then printf("%%{yellow}Show action must be one of the following commands:\n" .. " - zpm \t\tInstalls ZPM") end end } end newaction { trigger = "update", description = "Updates ZPM", execute = function() local help = false if #_ARGS == 1 and _ARGS[1] == "self" then zpm.loader.install:update() --zpm.loader.modules:update("*/*") elseif #_ARGS == 1 and _ARGS[1] == "bootstrap" then premake.action.call("update-bootstrap") elseif #_ARGS == 1 and _ARGS[1] == "registry" then premake.action.call("update-registry") elseif #_ARGS == 1 and _ARGS[1] == "zpm" then premake.action.call("update-zpm") elseif #_ARGS == 1 and _ARGS[1] == "modules" then zpm.loader.modules:update("*/*") else help = true end if help or zpm.cli.showHelp() then printf("%%{yellow}Show action must be one of the following commands:\n" .. " - self \tUpdates everything except modules\n" .. " - bootstrap \tUpdates the bootstrap module loader\n" .. " - registry \tUpdates the ZPM library registry\n" .. " - zpm \t\tUpdates ZPM itself\n" .. " - modules \tUpdates the installed modules") end end } if _ACTION == "install" or _ACTION == "update" then zpm.util.disableMainScript() end
-- Insert 'str' into 't' at a random position from 'left' to 'right' function randomInsert (t, str, left, right) local pos repeat pos = math.random(left, right) until not t[pos] t[pos] = str return pos end -- Generate a random Chess960 start position for white major pieces function chess960 () local t, b1, b2 = {} local kingPos = randomInsert(t, "K", 2, 7) randomInsert(t, "R", 1, kingPos - 1) randomInsert(t, "R", kingPos + 1, 8) b1 = randomInsert(t, "B", 1, 8) b2 = randomInsert(t, "B", 1, 8) while (b2 - b1) % 2 == 0 do t[b2] = false b2 = randomInsert(t, "B", 1, 8) end randomInsert(t, "Q", 1, 8) randomInsert(t, "N", 1, 8) randomInsert(t, "N", 1, 8) return t end -- Main procedure math.randomseed(os.time()) print(table.concat(chess960()))
local cjson = require "cjson" local crud = require "kong.api.crud_helpers" local split = require("kong.tools.utils").split local RedisFactory = require "kong.plugins.header-based-rate-limiting.redis_factory" local decode_base64 = ngx.decode_base64 local encode_base64 = ngx.encode_base64 local function decode_headers(encoded_header_composition) local individual_headers = split(encoded_header_composition, ",") local decoded_headers = {} for _, header in ipairs(individual_headers) do local decoded_header = header == "*" and "*" or decode_base64(header) table.insert(decoded_headers, decoded_header) end return decoded_headers end local function decode_header_composition(header_based_rate_limit) local result = {} for key, value in pairs(header_based_rate_limit) do if key == "header_composition" then result["header_composition"] = decode_headers(value) else result[key] = value end end return result end local function is_wildcard(header) return header == "*" or header == cjson.null end local function encode_headers(header_composition) local encoded_headers = {} for _, header in ipairs(header_composition) do local encoded_header = is_wildcard(header) and "*" or encode_base64(header) table.insert(encoded_headers, encoded_header) end return table.concat(encoded_headers, ",") end local function trim_postfix_wildcards(encoded_header_composition) return select(1, encoded_header_composition:gsub("[,*]+$", "")) end local function encode_header_composition(header_based_rate_limit) local result = {} for key, value in pairs(header_based_rate_limit) do if key == "header_composition" then result["header_composition"] = trim_postfix_wildcards(encode_headers(value)) else result[key] = value end end return result end return { ["/plugins/:plugin_id/redis-ping"] = { before = function(self, dao_factory, helpers) crud.find_plugin_by_filter(self, dao_factory, { id = self.params.plugin_id }, helpers) end, GET = function(self, dao_factory, helpers) if self.plugin.name ~= "header-based-rate-limiting" then return helpers.responses.send_HTTP_BAD_REQUEST("Plugin is not of type header-based-rate-limiting") end local success, redis_or_error = pcall(RedisFactory.create, self.plugin.config.redis) if not success then return helpers.responses.send_HTTP_BAD_REQUEST(redis_or_error.msg) end local result = redis_or_error:ping() helpers.responses.send_HTTP_OK(result) end }, ["/header-based-rate-limits"] = { POST = function(self, dao_factory, helpers) local params_with_encoded_header_composition = encode_header_composition(self.params) crud.post(params_with_encoded_header_composition, dao_factory.header_based_rate_limits, decode_header_composition) end, GET = function(self, dao_factory, helpers) crud.paginated_set(self, dao_factory.header_based_rate_limits, decode_header_composition) end, DELETE = function(self, dao_factory, helpers) dao_factory.header_based_rate_limits:truncate() helpers.responses.send_HTTP_OK() end }, ["/header-based-rate-limits/:id"] = { DELETE = function(self, dao_factory, helpers) local settings, err = dao_factory.header_based_rate_limits:find_all({ id = self.params.id }) local setting = settings and settings[1] if err or not setting then helpers.responses.send_HTTP_NOT_FOUND("Resource does not exist") end crud.delete(setting, dao_factory.header_based_rate_limits) end } }
return { summary = 'Get the location of the save directory.', description = 'Returns the absolute path to the save directory.', arguments = {}, returns = { { name = 'path', type = 'string', description = 'The absolute path to the save directory.' } }, notes = [[ The save directory takes the following form: ``` <appdata>/LOVR/<identity> ``` Where `<appdata>` is `lovr.filesystem.getAppdataDirectory` and `<identity>` is `lovr.filesystem.getIdentity` and can be customized using `lovr.conf`. ]], related = { 'lovr.filesystem.getIdentity', 'lovr.filesystem.getAppdataDirectory' } }
return require("opt.plugins.lsp.json")
--============================== Level Buttons ===============================-- LevelButtons = Class() --============================================================================-- function LevelButtons:construct(map, number, y, screenWidth, screenHeight, color) self.map = map self.number = number self.y = y self.color = color self.buttons = {} self.buttonsUnlocked = {} local buttonHeight = 2 * (screenHeight - y) / (3 * (self.number / 2 + 1)) + 1 for j=-1, 1, 2 do for i=1, self.number/2 do local buttonY = self.y + buttonHeight / 2 + ((i - 1) * 1.5 * buttonHeight) self.buttons[i + (j+1) * self.number/4] = Button(self.map, screenWidth / 2 + j*80 - 40, buttonY, 80, buttonHeight, self.color) end end self.buttonsUnlocked[1] = true self.buttonsUnlocked[10] = true end function LevelButtons:renderAll() for i=1, self.number do if not self.buttonsUnlocked[i] then self.buttons[i].color = colors['red'] self.buttons[i]:render('LOCKED') else self.buttons[i]:render(tostring(i)) end end end function LevelButtons:updateAll() for i=1, self.number do self.buttons[i]:update() if self.buttonsUnlocked[i] and self.buttons[i].clicked then gameState = 'play' map = Map(i) end end end
if not modules then modules = { } end modules ['supp-box'] = { version = 1.001, comment = "companion to supp-box.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -- this is preliminary code, use insert_before etc local lpegmatch = lpeg.match local report_hyphenation = logs.reporter("languages","hyphenation") local tex = tex local context = context local nodes = nodes local implement = interfaces.implement local nodecodes = nodes.nodecodes local disc_code = nodecodes.disc local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local glue_code = nodecodes.glue local glyph_code = nodecodes.glyph local nuts = nodes.nuts local tonut = nuts.tonut local tonode = nuts.tonode local getfield = nuts.getfield local getnext = nuts.getnext local getprev = nuts.getprev local getdisc = nuts.getdisc local getid = nuts.getid local getlist = nuts.getlist local getattribute = nuts.getattribute local getbox = nuts.getbox local takebox = nuts.takebox local setfield = nuts.setfield local setlink = nuts.setlink local setboth = nuts.setboth local setnext = nuts.setnext local setbox = nuts.setbox local setlist = nuts.setlist local free_node = nuts.free local flush_list = nuts.flush_list local copy_node = nuts.copy local copy_list = nuts.copy_list local find_tail = nuts.tail local traverse_id = nuts.traverse_id local link_nodes = nuts.linked local dimensions = nuts.dimensions local hpack = nuts.hpack local listtoutf = nodes.listtoutf local nodepool = nuts.pool local new_penalty = nodepool.penalty local new_hlist = nodepool.hlist local new_glue = nodepool.glue local setlistcolor = nodes.tracers.colors.setlist local texget = tex.get local texgetbox = tex.getbox local texsetdimen = tex.setdimen local function hyphenatedlist(head,usecolor) local current = head and tonut(head) while current do local id = getid(current) local next = getnext(current) local prev = getprev(current) if id == disc_code then local pre, post, replace = getdisc(current) if pre then setfield(current,"pre",nil) end if post then setfield(current,"post",nil) end if not usecolor then -- nothing fancy done elseif pre and post then setlistcolor(pre,"darkmagenta") setlistcolor(post,"darkcyan") elseif pre then setlistcolor(pre,"darkyellow") elseif post then setlistcolor(post,"darkyellow") end if replace then flush_list(replace) setfield(current,"replace",nil) end setboth(current) local list = link_nodes ( pre and new_penalty(10000), pre, current, post, post and new_penalty(10000) ) local tail = find_tail(list) if prev then setlink(prev,list) end if next then setlink(tail,next) end -- free_node(current) elseif id == vlist_code or id == hlist_code then hyphenatedlist(getlist(current)) end current = next end end implement { name = "hyphenatedlist", arguments = { "integer", "boolean" }, actions = function(n,color) local b = texgetbox(n) if b then hyphenatedlist(b.list,color) end end } -- local function hyphenatedhack(head,pre) -- pre = tonut(pre) -- for n in traverse_id(disc_code,tonut(head)) do -- local hyphen = getfield(n,"pre") -- if hyphen then -- flush_list(hyphen) -- end -- setfield(n,"pre",copy_list(pre)) -- end -- end -- -- commands.hyphenatedhack = hyphenatedhack local function checkedlist(list) if type(list) == "number" then return getlist(getbox(tonut(list))) else return tonut(list) end end implement { name = "showhyphenatedinlist", arguments = "integer", actions = function(box) report_hyphenation("show: %s",listtoutf(checkedlist(n),false,true)) end } local function applytochars(current,doaction,noaction,nested) while current do local id = getid(current) if nested and (id == hlist_code or id == vlist_code) then context.beginhbox() applytochars(getlist(current),doaction,noaction,nested) context.endhbox() elseif id ~= glyph_code then noaction(tonode(copy_node(current))) else doaction(tonode(copy_node(current))) end current = getnext(current) end end local function applytowords(current,doaction,noaction,nested) local start while current do local id = getid(current) if id == glue_code then if start then doaction(tonode(copy_list(start,current))) start = nil end noaction(tonode(copy_node(current))) elseif nested and (id == hlist_code or id == vlist_code) then context.beginhbox() applytowords(getlist(current),doaction,noaction,nested) context.egroup() elseif not start then start = current end current = getnext(current) end if start then doaction(tonode(copy_list(start))) end end local methods = { char = applytochars, characters = applytochars, word = applytowords, words = applytowords, } implement { name = "applytobox", arguments = { { { "box", "integer" }, { "command" }, { "method" }, { "nested", "boolean" }, } }, actions = function(specification) local list = checkedlist(specification.box) local action = methods[specification.method or "char"] if list and action then action(list,context[specification.command or "ruledhbox"],context,specification.nested) end end } local split_char = lpeg.Ct(lpeg.C(1)^0) local split_word = lpeg.tsplitat(lpeg.patterns.space) local split_line = lpeg.tsplitat(lpeg.patterns.eol) local function processsplit(specification) local str = specification.data or "" local command = specification.command or "ruledhbox" local method = specification.method or "word" local spaced = specification.spaced if method == "char" or method == "character" then local words = lpegmatch(split_char,str) for i=1,#words do local word = words[i] if word == " " then if spaced then context.space() end elseif command then context[command](word) else context(word) end end elseif method == "word" then local words = lpegmatch(split_word,str) for i=1,#words do local word = words[i] if spaced and i > 1 then context.space() end if command then context[command](word) else context(word) end end elseif method == "line" then local words = lpegmatch(split_line,str) for i=1,#words do local word = words[i] if spaced and i > 1 then context.par() end if command then context[command](word) else context(word) end end else context(str) end end implement { name = "processsplit", actions = processsplit, arguments = { { { "data" }, { "command" }, { "method" }, { "spaced", "boolean" }, } } } local a_vboxtohboxseparator = attributes.private("vboxtohboxseparator") implement { name = "vboxlisttohbox", arguments = { "integer", "integer", "dimen" }, actions = function(original,target,inbetween) local current = getlist(getbox(original)) local head = nil local tail = nil while current do local id = getid(current) local next = getnext(current) if id == hlist_code then local list = getlist(current) if head then if inbetween > 0 then local n = new_glue(0,0,inbetween) setlink(tail,n) tail = n end setlink(tail,list) else head = list end tail = find_tail(list) -- remove last separator if getid(tail) == hlist_code and getattribute(tail,a_vboxtohboxseparator) == 1 then local temp = tail local prev = getprev(tail) if next then local list = getlist(tail) setlink(prev,list) setlist(tail) tail = find_tail(list) else tail = prev end free_node(temp) end -- done setnext(tail) setlist(current) end current = next end local result = new_hlist() setlist(result,head) setbox(target,result) end } implement { name = "hboxtovbox", arguments = "integer", actions = function(n) local b = getbox(n) local factor = texget("baselineskip").width / texget("hsize") setfield(b,"depth",0) setfield(b,"height",getfield(b,"width") * factor) end } implement { name = "boxtostring", arguments = "integer", actions = function(n) context.puretext(nodes.toutf(texgetbox(n).list)) -- helper is defined later end } local function getnaturaldimensions(n) local w, h, d = 0, 0, 0 local l = getlist(getbox(n)) if l then w, h, d = dimensions(l) end texsetdimen("lastnaturalboxwd",w) texsetdimen("lastnaturalboxht",h) texsetdimen("lastnaturalboxdp",d) return w, h, d end interfaces.implement { name = "getnaturaldimensions", arguments = "integer", actions = getnaturaldimensions } interfaces.implement { name = "naturalwd", arguments = "integer", actions = function(n) getnaturaldimensions(n) context.lastnaturalboxwd(false) end } interfaces.implement { name = "getnaturalwd", arguments = "integer", actions = function(n) local w, h, d = 0, 0, 0 local l = getlist(getbox(n)) if l then w, h, d = dimensions(l) end context("\\dimexpr%i\\scaledpoint\\relax",w) end } local function setboxtonaturalwd(n) local old = takebox(n) local new = hpack(getlist(old)) setlist(old,nil) free_node(old) setbox(n,new) end interfaces.implement { name = "setnaturalwd", arguments = "integer", actions = setboxtonaturalwd } nodes.setboxtonaturalwd = setboxtonaturalwd local function firstdirinbox(n) local b = getbox(n) if b then local l = getlist(b) if l then for h in traverse_id(hlist_code,l) do return getfield(h,"dir") end end end end nodes.firstdirinbox = firstdirinbox local doifelse = commands.doifelse interfaces.implement { name = "doifelserighttoleftinbox", arguments = "integer", actions = function(n) doifelse(firstdirinbox(n) == "TRT") end }
local helpers = require "spec.helpers" describe("cargotest", function() before_each(function() helpers.before_each() vim.api.nvim_command "cd spec/fixtures/rust/crate" end) after_each(function() helpers.after_each() vim.api.nvim_command "cd -" end) it("run suite", function() helpers.view "src/main.rs" vim.api.nvim_command "TestSuite" assert.are.same(vim.g.test_latest.cmd, { "cargo", "test" }) end) it("run file", function() helpers.view "src/main.rs" vim.api.nvim_command "TestFile" assert.are.same(vim.g.test_latest.cmd, { "cargo", "test" }) helpers.view "src/somemod.rs" vim.api.nvim_command "TestFile" assert.are.same(vim.g.test_latest.cmd, { "cargo", "test", "somemod::" }) helpers.view "src/nested/mod.rs" vim.api.nvim_command "TestFile" assert.are.same(vim.g.test_latest.cmd, { "cargo", "test", "nested::" }) end) it("run nearest function", function() helpers.view("src/lib.rs", 7) assert.exists_pattern "first_test" vim.api.nvim_command "TestNearest" assert.are.same( { "cargo", "test", "tests::first_test", "--", "--exact" }, vim.g.test_latest.cmd ) end) it("run latest", function() helpers.view "src/main.rs" vim.api.nvim_command "TestFile" assert.are.same(vim.g.test_latest.cmd, { "cargo", "test" }) vim.api.nvim_command "TestLast" assert.are.same(vim.g.test_latest.cmd, { "cargo", "test" }) end) end)
for i,type in pairs(boxing.types) do data:extend({ { type = "recipe-category", name = "boxing-" .. type.name, }, }) for j,machine in pairs(data.raw["assembling-machine"]) do if machine.name:sub(1, 18) == "assembling-machine" then table.insert(machine.crafting_categories, "boxing-" .. type.name) end end end if settings.startup["player-craftable-wooden-boxing"].value then table.insert(data.raw.character.character.crafting_categories, "boxing-wooden") end
description = [[ Reports the number of algorithms (for encryption, compression, etc.) that the target SSH2 server offers. If verbosity is set, the offered algorithms are each listed by type. If the "client to server" and "server to client" algorithm lists are identical (order specifies preference) then the list is shown only once under a combined type. ]] --- -- @usage -- nmap --script ssh2-enum-algos target -- -- @output -- PORT STATE SERVICE -- 22/tcp open ssh -- | ssh2-enum-algos: -- | kex_algorithms (4) -- | diffie-hellman-group-exchange-sha256 -- | diffie-hellman-group-exchange-sha1 -- | diffie-hellman-group14-sha1 -- | diffie-hellman-group1-sha1 -- | server_host_key_algorithms (2) -- | ssh-rsa -- | ssh-dss -- | encryption_algorithms (13) -- | aes128-ctr -- | aes192-ctr -- | aes256-ctr -- | arcfour256 -- | arcfour128 -- | aes128-cbc -- | 3des-cbc -- | blowfish-cbc -- | cast128-cbc -- | aes192-cbc -- | aes256-cbc -- | arcfour -- | rijndael-cbc@lysator.liu.se -- | mac_algorithms (6) -- | hmac-md5 -- | hmac-sha1 -- | hmac-ripemd160 -- | hmac-ripemd160@openssh.com -- | hmac-sha1-96 -- | hmac-md5-96 -- | compression_algorithms (2) -- | none -- |_ zlib@openssh.com author = "Kris Katterjohn" license = "Same as Nmap--See http://nmap.org/book/man-legal.html" categories = {"safe", "discovery"} require "shortport" require "stdnse" stdnse.silent_require "openssl" stdnse.silent_require "ssh2" portrule = shortport.port_or_service(22, "ssh") -- Build onto lists{} and possibly modify parsed{} based on whether the -- algorithm name-lists are identical between the server-to-client and -- client-to-server types. Note that this simply modifies the passed tables. local combine_types = function(parsed, lists) local doubles = { "encryption_algorithms", "mac_algorithms", "compression_algorithms" } for _, i in ipairs(doubles) do local c2s = i .. "_client_to_server" local s2c = i .. "_server_to_client" if parsed[c2s] == parsed[s2c] then parsed[i] = parsed[c2s] parsed[c2s] = nil parsed[s2c] = nil table.insert(lists, i) else table.insert(lists, c2s) table.insert(lists, s2c) end end end -- Build and return the output table local output = function(parsed, lists) local out = {} for _, l in ipairs(lists) do local v = parsed[l] local a = v:len() > 0 and stdnse.strsplit(",", v) or {} local e if nmap.verbosity() > 0 then e = { ["name"] = l .. " (" .. #a .. ")" } table.insert(e, a) else e = l .. " (" .. #a .. ")" end table.insert(out, e) end return stdnse.format_output(true, out) end action = function(host, port) local sock = nmap.new_socket() local status = sock:connect(host, port) if not status then return end status = sock:receive_lines(1) if not status then sock:close() return end status = sock:send("SSH-2.0-Nmap-SSH2-Enum-Algos\r\n") if not status then sock:close() return end local ssh = ssh2.transport -- I would think that the server would send its kex data right after -- receiving and verifying our protocol id string above, then we could -- just use it here, but I've seen no definitive documentation saying -- that we don't ever send ours first. All I've seen is that if the -- server doesn't care about compatibility with older clients then it -- MAY send its kex data after the protocol id string. So I guess I'll -- send it here until I know for sure (removing this send works against -- OpenSSH though). local pkt = ssh.build(ssh.kex_init()) status = sock:send(pkt) if not status then sock:close() return end local status, response = ssh.receive_packet(sock) sock:close() if not status then return end local parsed = ssh.parse_kex_init(ssh.payload(response)) local lists = { "kex_algorithms", "server_host_key_algorithms" -- Other types will be added below in combine_types() } -- Modifies tables combine_types(parsed, lists) return output(parsed, lists) end
local skynet = require "skynet" skynet.start(function() for i = 1, 1000000000 do -- very long loop if i%100000000 == 0 then print("Endless = ", skynet.stat "endless") print("Cost time = ", skynet.stat "time") end end skynet.exit() end)
return { action = { shoot = { "space", "enter" }, pause = { "esc", "p" } }, axis = { down = {{-1, "w"}, {1, "s"}, {-1, "up"}, {1, "down"}}, right = {{-1, "a"}, {1, "d"}, {-1, "left"}, {1, "right"}} } }
require "lib.classes.class" local NullBehavior = require "lib.physics.behaviors.NullBehavior" require "Global.application.application" -------------------------------------------------------------------------------------------------------- -- class: OverworldInteractuableObjectBehavior -- param: group:str -> the group of the local context the behavior is associated to -- param: player:Player -> the player object -- The behaviour that defines how the player interacts with the interactuable objects of the overworld local OverworldInteractuableObjectBehavior = extend(NullBehavior, function(self, group, player) self.player = player self.player_object = player:getSolidObject() self.group = group end, function(group) return NullBehavior.new(group) end) -- AllObjectsInteract: None -> None -- Checks all objects that collide with the player interactuable hitbox and makes the player interact with them function OverworldInteractuableObjectBehavior.allObjectsInteract(self) local local_context_group = application:getFromLocalContext(self.group) if not (local_context_group == nil) then for _, object in pairs(local_context_group) do if object:getSolidObject():checkCollision(self.player_object) then object:interactWithPlayer(self.player) end end end end return OverworldInteractuableObjectBehavior
-- -- This plugin add Gotham colorscheme. -- VERSION = "1.1.0" AddRuntimeFile("gotham-colors", "colorscheme", "gotham.micro")
------------------------ -- Myrkr -- ------------------------ require("scripts/globals/aftermath") require("scripts/globals/status") require("scripts/globals/weaponskills") function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) -- Apply aftermath tpz.aftermath.addStatusEffect(player, tp, tpz.slot.MAIN, tpz.aftermath.type.EMPYREAN) local ftpmp = fTP(tp, 0.2, 0.4, 0.6) return 1, 0, false, ftpmp * player:getMaxMP() end
function start (song) setCamZoom(1) end function update (elapsed) if curStep >= 128 and curStep < 256 then local currentBeat = (songPos / 1000)*(bpm/30) for i=0,7 do setActorX(_G['defaultStrum'..i..'X'] + 5 * math.sin((currentBeat + i*50) * math.pi), i) end end if curStep >= 640 and curStep < 768 then local currentBeat = (songPos / 1000)*(bpm/30) for i=0,7 do setActorX(_G['defaultStrum'..i..'X'] + 5 * math.sin((currentBeat + i*50) * math.pi), i) end end if curStep == 384 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 396 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 416 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 428 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 448 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 460 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 480 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 492 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 896 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 908 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 928 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 940 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 960 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 972 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 992 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 1004 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 1408 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 1420 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 1440 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 1452 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 1472 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 1484 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 1504 then setCamZoom(1.1) setHudZoom(1.1) end if curStep == 1516 then setCamZoom(1.1) setHudZoom(1.1) end end function beatHit(beat) -- do nothing end function stepHit (step) -- do nothing end
ffi.cdef[[ void* LoadLibraryA(const char* lpLibFileName); void* GetProcAddress(void* hModule, const char* lpProcName); ]] local bass_dll = ffi.C.LoadLibraryA("bass.dll") local BASS_Init = ffi.cast("int(__stdcall*)(int, unsigned long, unsigned long, void*, void*)", ffi.C.GetProcAddress(bass_dll, "BASS_Init")) local BASS_StreamCreateURL = ffi.cast("unsigned long(__stdcall*)(const char *, unsigned long, unsigned long, void*, void*)", ffi.C.GetProcAddress(bass_dll, "BASS_StreamCreateURL")) local BASS_ChannelPlay = ffi.cast("int( __stdcall*)(unsigned long, int)", ffi.C.GetProcAddress(bass_dll, "BASS_ChannelPlay")) local BASS_ChannelStop = ffi.cast("int(__stdcall*)(unsigned long)", ffi.C.GetProcAddress(bass_dll, "BASS_ChannelStop")) local BASS_ChannelSetAttribute = ffi.cast("int(__stdcall*)( unsigned long, unsigned long, float )", ffi.C.GetProcAddress(bass_dll, "BASS_ChannelSetAttribute")) local BASS_Free = ffi.cast("int(__stdcall*)()", ffi.C.GetProcAddress(bass_dll, "BASS_Free")) local BASS_DEVICE_3D = 4 local BASS_ATTRIB_VOL = 2 local stations = { "https://streams.bigfm.de/bigfm-usrap-128-mp3", "https://streams.bigfm.de/bigfm-oldschool-128-mp3", "https://streams.bigfm.de/bigfm-hiphop-128-mp3", "http://us3.internet-radio.com:8313/", "http://45.79.6.42:2410/listen.pls?sid=1", "http://uk1.internet-radio.com:8011/", "http://us5.internet-radio.com:8279/", "http://uk7.internet-radio.com:8040/", } local names = { "none", "usrap", "old school rap", "hiphop", "kcvr rap", "westcoast", "rock", "classic rock", "90s" } ui.add_combo("station", "radio_station", names, 0) ui.add_checkbox("play", "radio_play", false) ui.add_slider_float("volume", "radio_volume", 0.0, 1.0, 0.1) local old_station = ui.get_int("radio_station") local old_can_play = old_station > 0 and ui.get_bool("radio_play") local stream, playing = 0, false BASS_Init(-1, 44100, BASS_DEVICE_3D, nil, nil) client.register_callback("frame_stage_notify", function(stage) if stage == 5 then local radio_station = ui.get_int("radio_station") local radio_play = ui.get_bool("radio_play") local can_play = radio_station > 0 and radio_play local switch = old_station ~= radio_station and can_play if switch or (can_play and not playing) then if stream ~= 0 then BASS_ChannelStop(stream) end stream = BASS_StreamCreateURL(stations[radio_station], 0, 0, nil, nil) BASS_ChannelPlay(stream, 0) playing = true end if not can_play and stream ~= 0 and playing then BASS_ChannelStop(stream) playing = false end if playing and stream ~= 0 then BASS_ChannelSetAttribute(stream, BASS_ATTRIB_VOL, ui.get_float("radio_volume")) end old_station = radio_station end end ) client.register_callback("unload", function() BASS_ChannelStop(stream) BASS_Free(); end )
-- project and version set_xmakever("2.2.3") set_project("SpinlockTest") -- add project directories or targets target("SpinlockTest") -- add rules add_rules("mode.debug") add_rules("mode.release") -- set kind set_kind("binary") -- add files add_files("src/**.cpp") add_headerfiles("inc/**.h", "inc/**.hpp") -- add include search directories add_includedirs("inc", {public = true}) -- link to another library if is_plat("linux") then add_links("pthread", "atomic") end
local AddonName, Addon = ... local L = Addon.L CheckBox = {} CheckBox.__index = CheckBox; function CheckBox:new(pGroupFrame, pTitle, pPosX, pLineIndex, pOnCheckedChange) local self = {} setmetatable(self, CheckBox) self.checkbox = CreateFrame('CheckButton', nil, pGroupFrame, 'UICheckButtonTemplate') --self.checkbox:SetWidth(pWidth) self.checkbox:SetPoint('TOPLEFT', pPosX, 45 * (1 - pLineIndex) - 25 + 11) self.checkbox:SetFrameLevel(3) self.checkbox:SetScript('OnClick', function(pSelf, pButton, pDown) if self.checkbox:GetChecked() then pOnCheckedChange(true) else pOnCheckedChange(false) end end) local title = self.checkbox:CreateFontString(nil, 'BACKGROUND', 'GameFontNormalLeft') title:ClearAllPoints() title:SetPoint('LEFT', self.checkbox, 'RIGHT') title:SetText(pTitle) return self end function CheckBox:SetChecked(pValue) self.checkbox:SetChecked(pValue) end
local gears = require('gears') local icons_dir = gears.filesystem.get_configuration_dir() .. 'theme/icons/' return { arrow_down = 'ﰬ', arrow_up = 'ﰵ', battery_charging = '', battery_discharging = '', bluetooth_off = '', bluetooth_on = '', brightness = '', chat = '', chevron_left = '', chevron_right = '', chrome = '', clock = '', code = '', download = '', ethernet = '', files = '', firefox = '', games = '', layout_floating = icons_dir .. 'layout/floating.svg', layout_max = icons_dir .. 'layout/max.svg', layout_tiled = icons_dir .. 'layout/tiled.svg', lock = '', logout = '', media = '', menu = '', pause = '', play = '', power = '', reboot = '', skip_next = '', skip_previous = '', suspend = '', terminal = '', updates = '', upload = '', volume_off = '婢', volume_on = '墳', wifi_off = '睊', wifi_on = '直', }
-- https://gabrielpoca.com/2019-11-13-a-bit-more-lua-in-your-vim/ function NavigationFloatingWin() local width = vim.api.nvim_get_option("columns") local height = vim.api.nvim_get_option("lines") local buf = vim.api.nvim_create_buf(false, true) vim.api.nvim_buf_set_var(buf, '&signcolumn', 'no') local win_height = height local win_width = width if (width > 150) then win_width = math.ceil(width * 0.9) end if (height > 35) then win_height = math.min(math.ceil(height * 3 / 4), 40) end local opts = { relative = "editor", width = win_width, height = win_height, row = math.ceil((height - win_height) / 2), col = math.ceil((width - win_width) / 2) } local win = vim.api.nvim_open_win(buf, true, opts) end
-- -- DO NOT DELETE -- -- SETTINGS MODULE -- Made by Redsaph exclusively for Cleartext -- -- janvelasco.com -- github.com/redsaph/cleartext -- -- If you have read this and have the intention -- of using this, please do not delete this flower box -- and just append on it. -- -- Thank you very much. -- -- Last modified by Redsaph on June 25, 2020 -- playerTable = { ["Windows Media Player"] = { player_controller = "Title0", player_mode = "0", player_supposed = "WMP", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_yellow#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["Foobar2000"] = { player_controller = "Title0", player_mode = "0", player_supposed = "CAD", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_yellow#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["MusicBee"] = { player_controller = "Title0", player_mode = "0", player_supposed = "CAD", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_yellow#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["Spotify (NowPlaying)"] = { player_controller = "Title0", player_mode = "0", player_supposed = "Spotify", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_yellow#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["iTunes"] = { player_controller = "Title0", player_mode = "0", player_supposed = "iTunes", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_yellow#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["VLC"] = { player_controller = "Title0", player_mode = "0", player_supposed = "CAD", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_yellow#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["WebNowPlaying"] = { player_controller = "StateButton2", player_mode = "2", player_supposed = "Spotify", disable_np = "1", disable_gpmdp = "1", disable_wnp = "0", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_yellow#", color_btn_zune_sint = "#const_gray#" }, ["GPMDP"] = { player_controller = "StateButton1", player_mode = "1", player_supposed = "Spotify", disable_np = "1", disable_gpmdp = "0", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_yellow#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["MediaMonkey"] = { player_controller = "Title0", player_mode = "0", player_supposed = "MediaMonkey", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_yellow#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["Media Player Classic"] = { player_controller = "Title0", player_mode = "0", player_supposed = "WLM", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_yellow#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["J. River Media Center"] = { player_controller = "Title0", player_mode = "0", player_supposed = "CAD", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_yellow#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["Winamp"] = { player_controller = "Title0", player_mode = "0", player_supposed = "Winamp", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_yellow#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" }, ["Zune"] = { player_controller = "Title0", player_mode = "0", player_supposed = "WLM", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_gray#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_yellow#" }, ["AIMP"] = { player_controller = "Title0", player_mode = "0", player_supposed = "AIMP", disable_np = "0", disable_gpmdp = "1", disable_wnp = "1", color_btn_aimp_sint = "#const_yellow#", color_btn_foobar2000_sint = "#const_gray#", color_btn_gpmdp_sint = "#const_gray#", color_btn_itunes_sint = "#const_gray#", color_btn_jrmc_sint = "#const_gray#", color_btn_mediamonkey_sint = "#const_gray#", color_btn_mpc_sint = "#const_gray#", color_btn_musicbee_sint = "#const_gray#", color_btn_spotify_sint = "#const_gray#", color_btn_vlc_sint = "#const_gray#", color_btn_winamp_sint = "#const_gray#", color_btn_wmp_sint = "#const_gray#", color_btn_wnp_sint = "#const_gray#", color_btn_zune_sint = "#const_gray#" } } function Initialize() dofile(SKIN:GetVariable('@')..'align.lua') end -- ends Initialize function setPlayer(selectedPlayerName) SKIN:Bang('!WriteKeyValue Variables player_setname "' .. selectedPlayerName .. '" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables player_supposed ' .. playerTable[selectedPlayerName]['player_supposed'] .. ' "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables player_mode ' .. playerTable[selectedPlayerName]['player_mode'] .. ' "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables player_controller ' .. playerTable[selectedPlayerName]['player_controller'] .. ' "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables disable_np ' .. playerTable[selectedPlayerName]['disable_np'] .. ' "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables disable_gpmdp ' .. playerTable[selectedPlayerName]['disable_gpmdp'] .. ' "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables disable_wnp ' .. playerTable[selectedPlayerName]['disable_wnp'] .. ' "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_aimp_sint "' .. playerTable[selectedPlayerName]['color_btn_aimp_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_foobar2000_sint "' .. playerTable[selectedPlayerName]['color_btn_foobar2000_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_gpmdp_sint "' .. playerTable[selectedPlayerName]['color_btn_gpmdp_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_itunes_sint "' .. playerTable[selectedPlayerName]['color_btn_itunes_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_jrmc_sint "' .. playerTable[selectedPlayerName]['color_btn_jrmc_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_mediamonkey_sint "' .. playerTable[selectedPlayerName]['color_btn_mediamonkey_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_mpc_sint "' .. playerTable[selectedPlayerName]['color_btn_mpc_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_musicbee_sint "' .. playerTable[selectedPlayerName]['color_btn_musicbee_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_spotify_sint "' .. playerTable[selectedPlayerName]['color_btn_spotify_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_vlc_sint "' .. playerTable[selectedPlayerName]['color_btn_vlc_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_winamp_sint "' .. playerTable[selectedPlayerName]['color_btn_winamp_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_wmp_sint "' .. playerTable[selectedPlayerName]['color_btn_wmp_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_wnp_sint "' .. playerTable[selectedPlayerName]['color_btn_wnp_sint'] .. '" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_zune_sint "' .. playerTable[selectedPlayerName]['color_btn_zune_sint'] .. '" "#@#var_int.inc"') end -- ends setPlayer function toggleAdaptiveHide() bool_adaptivehide = SKIN:GetVariable('bool_adaptivehide') if bool_adaptivehide == '0' then SKIN:Bang('!WriteKeyValue Variables bool_adaptivehide "1" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_adaptivehide_sint "#const_yellow#" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables bool_btn_adaptivehide_sint on "#@#var_int.inc"') else SKIN:Bang('!WriteKeyValue Variables bool_adaptivehide "0" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_adaptivehide_sint "#const_gray#" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables bool_btn_adaptivehide_sint off "#@#var_int.inc"') end end -- ends toggleAdaptiveHide function toggleScroll() bool_scroll = SKIN:GetVariable('bool_scroll') if bool_scroll == '0' then SKIN:Bang('!WriteKeyValue Variables bool_scroll "1" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_scrolling_sint "#const_gray#" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables bool_btn_scrolling_sint off "#@#var_int.inc"') else SKIN:Bang('!WriteKeyValue Variables bool_scroll "0" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_scrolling_sint "#const_yellow#" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables bool_btn_scrolling_sint on "#@#var_int.inc"') end end -- ends toggleScroll function toggleStow() bool_stow = SKIN:GetVariable('bool_stow') if bool_stow == '0' then SKIN:Bang('!WriteKeyValue Variables bool_stow "1" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables name_stowgroup "Stow" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_stow_sint "#const_yellow#" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables bool_btn_stow_sint on "#@#var_int.inc"') else SKIN:Bang('!WriteKeyValue Variables bool_stow "0" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables name_stowgroup "NULL" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_stow_sint "#const_gray#" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables bool_btn_stow_sint off "#@#var_int.inc"') end end -- ends toggleStow function toggleTrim() bool_texttrim = SKIN:GetVariable('bool_texttrim') if bool_texttrim == '0' then SKIN:Bang('!WriteKeyValue Variables bool_texttrim "1" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_trim_sint "#const_yellow#" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables bool_btn_trim_sint on "#@#var_int.inc"') print("On") else SKIN:Bang('!WriteKeyValue Variables bool_texttrim "0" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables color_btn_trim_sint "#const_gray#" "#@#var_int.inc"') SKIN:Bang('!WriteKeyValue Variables bool_btn_trim_sint off "#@#var_int.inc"') print("Off") end end -- ends toggleAdaptiveHide function rescale(size) bool_alignright = SKIN:GetVariable('bool_alignright') bool_aligncenter = SKIN:GetVariable('bool_aligncenter') -- width = SKIN:GetVariable('size') -- SKIN:Bang('!Refresh #CURRENTCONFIG#') print('size: ' .. size) SKIN:Bang('!WriteKeyValue Variables skinSize "' .. size .. '" "#@#var.inc"') -- print('in realign') -- print('bool_alignright: ' .. bool_alignright) -- print('bool_aligncenter: ' .. bool_aligncenter) if bool_alignright == '0' and bool_aligncenter == '0' then alignLeft(size) elseif bool_alignright == '1' then alignRight(size) elseif bool_aligncenter == '1' then alignCenter(size) end SKIN:Bang('!Refresh #CURRENTCONFIG#') end -- ends realign function resetFonts() SKIN:Bang('!WriteKeyValue Variables font_weightbtm 700 "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables font_texttop "Red Hat Display" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables font_textbtm "Red Hat Display" "#@#var.inc"') SKIN:Bang('!WriteKeyValue Variables font_textinterface "Red Hat Text Medium" "#@#var.inc"') end -- ends resetFonts
local Spell = { } Spell.LearnTime = 30 Spell.Description = [[ Spawns birds at the end of the wand. ]] Spell.ApplyFireDelay = 0.4 Spell.CanSelfCast = false Spell.AccuracyDecreaseVal = 0.1 Spell.NodeOffset = Vector(-791, -32, 0) function Spell:OnFire(wand) local ang = self.Owner:EyeAngles() local pos = self.Owner:EyePos() + ang:Right() * 2 + ang:Forward() * 40 sound.Play("hpwrewrite/notify.wav", pos, 60, 130) for i = 1, math.random(3, 5) do local dir = ang:Forward() + (VectorRand() * 0.1) local a = ents.Create("entity_hpwand_bird") a:SetPos(pos + VectorRand() * 10) a:SetAngles(dir:Angle()) a:Spawn() end end HpwRewrite:AddSpell("Avis", Spell)
local cache_location = vim.fn.stdpath 'cache' local bin_folder = jit.os:lower() == 'osx' and 'macOS' or jit.os local nlua_nvim_lsp = { base_directory = string.format( '%s/nlua/sumneko_lua/lua-language-server/', cache_location ), bin_location = string.format( '%s/nlua/sumneko_lua/lua-language-server/bin/%s/lua-language-server', cache_location, bin_folder ), } local sumneko_command = function() return { nlua_nvim_lsp.bin_location, '-E', string.format('%s/main.lua', nlua_nvim_lsp.base_directory), } end return require('lua-dev').setup { lspconfig = { cmd = sumneko_command(), settings = { Lua = { diagnostics = { globals = { 'vim', 'describe', 'it', 'before_each', 'after_each', 'pending', 'teardown', 'packer_plugins', 'spoon', 'hs', }, }, workspace = { library = { ['/Applications/Hammerspoon.app/Contents/Resources/extensions/hs/'] = true, }, }, completion = { keywordSnippet = 'Replace', callSnippet = 'Replace' }, telemetry = { enable = false }, }, }, }, }
--[[ LuCI - UCI model Description: Generalized UCI model FileId: $Id$ License: Copyright 2008 Steven Barth <steven@midlink.org> 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 os = require "os" local uci = require "uci" local util = require "luci.util" local table = require "table" local setmetatable, rawget, rawset = setmetatable, rawget, rawset local error, pairs, ipairs, tostring = error, pairs, ipairs, tostring local require, getmetatable, type = require, getmetatable, type --- LuCI UCI model library. -- @cstyle instance module "luci.model.uci" --- Create a new UCI-Cursor. -- @class function -- @name cursor -- @return UCI-Cursor cursor = uci.cursor APIVERSION = uci.APIVERSION --- Create a new Cursor initialized to the state directory. -- @return UCI cursor function cursor_state() return cursor(nil, "/var/state") end local Cursor = getmetatable(cursor()) --- Applies UCI configuration changes -- @param configlist List of UCI configurations -- @param command Don't apply only return the command function Cursor.apply(self, configlist, command) configlist = self:_affected(configlist) local reloadcmd = "/sbin/luci-reload " .. table.concat(configlist, " ") return command and reloadcmd or os.execute(reloadcmd .. " >/dev/null 2>&1") end --- Delete all sections of a given type that match certain criteria. -- @param config UCI config -- @param type UCI section type -- @param comparator Function that will be called for each section and -- returns a boolean whether to delete the current section (optional) function Cursor.delete_all(self, config, stype, comparator) local del = {} if type(comparator) == "table" then local tbl = comparator comparator = function(section) for k, v in pairs(tbl) do if section[k] ~= v then return false end end return true end end local function helper (section) if not comparator or comparator(section) then del[#del+1] = section[".name"] end end self:foreach(config, stype, helper) for i, j in ipairs(del) do self:delete(config, j) end end --- Create a new section and initialize it with data. -- @param config UCI config -- @param type UCI section type -- @param name UCI section name (optional) -- @param values Table of key - value pairs to initialize the section with -- @return Name of created section function Cursor.section(self, config, type, name, values) local stat = true if name then stat = self:set(config, name, type) else name = self:add(config, type) stat = name and true end if stat and values then stat = self:tset(config, name, values) end return stat and name end --- Updated the data of a section using data from a table. -- @param config UCI config -- @param section UCI section name (optional) -- @param values Table of key - value pairs to update the section with function Cursor.tset(self, config, section, values) local stat = true for k, v in pairs(values) do if k:sub(1, 1) ~= "." then stat = stat and self:set(config, section, k, v) end end return stat end --- Get a boolean option and return it's value as true or false. -- @param config UCI config -- @param section UCI section name -- @param option UCI option -- @return Boolean function Cursor.get_bool(self, ...) local val = self:get(...) return ( val == "1" or val == "true" or val == "yes" or val == "on" ) end --- Get an option or list and return values as table. -- @param config UCI config -- @param section UCI section name -- @param option UCI option -- @return UCI value function Cursor.get_list(self, config, section, option) if config and section and option then local val = self:get(config, section, option) return ( type(val) == "table" and val or { val } ) end return nil end --- Set given values as list. -- @param config UCI config -- @param section UCI section name -- @param option UCI option -- @param value UCI value -- @return Boolean whether operation succeeded function Cursor.set_list(self, config, section, option, value) if config and section and option then return self:set( config, section, option, ( type(value) == "table" and value or { value } ) ) end return false end -- Return a list of initscripts affected by configuration changes. function Cursor._affected(self, configlist) configlist = type(configlist) == "table" and configlist or {configlist} local c = cursor() c:load("ucitrack") -- Resolve dependencies local reloadlist = {} local function _resolve_deps(name) local reload = {name} local deps = {} c:foreach("ucitrack", name, function(section) if section.affects then for i, aff in ipairs(section.affects) do deps[#deps+1] = aff end end end) for i, dep in ipairs(deps) do for j, add in ipairs(_resolve_deps(dep)) do reload[#reload+1] = add end end return reload end -- Collect initscripts for j, config in ipairs(configlist) do for i, e in ipairs(_resolve_deps(config)) do if not util.contains(reloadlist, e) then reloadlist[#reloadlist+1] = e end end end return reloadlist end --- Add an anonymous section. -- @class function -- @name Cursor.add -- @param config UCI config -- @param type UCI section type -- @return Name of created section --- Get a table of unsaved changes. -- @class function -- @name Cursor.changes -- @param config UCI config -- @return Table of changes --- Commit unsaved changes. -- @class function -- @name Cursor.commit -- @param config UCI config -- @return Boolean whether operation succeeded -- @see Cursor.revert --- Deletes a section or an option. -- @class function -- @name Cursor.delete -- @param config UCI config -- @param section UCI section name -- @param option UCI option (optional) -- @return Boolean whether operation succeeded --- Call a function for every section of a certain type. -- @class function -- @name Cursor.foreach -- @param config UCI config -- @param type UCI section type -- @param callback Function to be called -- @return Boolean whether operation succeeded --- Get a section type or an option -- @class function -- @name Cursor.get -- @param config UCI config -- @param section UCI section name -- @param option UCI option (optional) -- @return UCI value --- Get all sections of a config or all values of a section. -- @class function -- @name Cursor.get_all -- @param config UCI config -- @param section UCI section name (optional) -- @return Table of UCI sections or table of UCI values --- Manually load a config. -- @class function -- @name Cursor.load -- @param config UCI config -- @return Boolean whether operation succeeded -- @see Cursor.save -- @see Cursor.unload --- Revert unsaved changes. -- @class function -- @name Cursor.revert -- @param config UCI config -- @return Boolean whether operation succeeded -- @see Cursor.commit --- Saves changes made to a config to make them committable. -- @class function -- @name Cursor.save -- @param config UCI config -- @return Boolean whether operation succeeded -- @see Cursor.load -- @see Cursor.unload --- Set a value or create a named section. -- @class function -- @name Cursor.set -- @param config UCI config -- @param section UCI section name -- @param option UCI option or UCI section type -- @param value UCI value or nil if you want to create a section -- @return Boolean whether operation succeeded --- Get the configuration directory. -- @class function -- @name Cursor.get_confdir -- @return Configuration directory --- Get the directory for uncomitted changes. -- @class function -- @name Cursor.get_savedir -- @return Save directory --- Set the configuration directory. -- @class function -- @name Cursor.set_confdir -- @param directory UCI configuration directory -- @return Boolean whether operation succeeded --- Set the directory for uncommited changes. -- @class function -- @name Cursor.set_savedir -- @param directory UCI changes directory -- @return Boolean whether operation succeeded --- Discard changes made to a config. -- @class function -- @name Cursor.unload -- @param config UCI config -- @return Boolean whether operation succeeded -- @see Cursor.load -- @see Cursor.save