content
stringlengths
5
1.05M
ModdedVehicles = {} VehicleStatus = {} ClosestPlate = nil isLoggedIn = true PlayerJob = {} local onDuty = false function DrawText3Ds(x, y, z, text) SetTextScale(0.35, 0.35) SetTextFont(4) SetTextProportional(1) SetTextColour(255, 255, 255, 215) SetTextEntry("STRING") SetTextCentre(true) AddTextComponentString(text) SetDrawOrigin(x,y,z, 0) DrawText(0.0, 0.0) local factor = (string.len(text)) / 370 DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75) ClearDrawOrigin() end Citizen.CreateThread(function() while true do if isLoggedIn then SetClosestPlate() end Citizen.Wait(1000) end end) function SetClosestPlate() local pos = GetEntityCoords(PlayerPedId(), true) local current = nil local dist = nil for id,_ in pairs(Config.Plates) do if current ~= nil then if #(pos - vector3(Config.Plates[id].coords.x, Config.Plates[id].coords.y, Config.Plates[id].coords.z)) < dist then current = id dist = #(pos - vector3(Config.Plates[id].coords.x, Config.Plates[id].coords.y, Config.Plates[id].coords.z)) end else dist = #(pos - vector3(Config.Plates[id].coords.x, Config.Plates[id].coords.y, Config.Plates[id].coords.z)) current = id end end ClosestPlate = current end RegisterNetEvent('QBCore:Client:OnPlayerLoaded') AddEventHandler('QBCore:Client:OnPlayerLoaded', function() QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job if PlayerData.job.onduty then if PlayerData.job.name == "mechanic" then TriggerServerEvent("QBCore:ToggleDuty") end end end) isLoggedIn = true QBCore.Functions.TriggerCallback('qb-vehicletuning:server:GetAttachedVehicle', function(plates) for k, v in pairs(plates) do Config.Plates[k].AttachedVehicle = v.AttachedVehicle end end) QBCore.Functions.TriggerCallback('qb-vehicletuning:server:GetDrivingDistances', function(retval) DrivingDistance = retval end) end) RegisterNetEvent('QBCore:Client:OnJobUpdate') AddEventHandler('QBCore:Client:OnJobUpdate', function(JobInfo) PlayerJob = JobInfo onDuty = PlayerJob.onduty end) RegisterNetEvent('QBCore:Client:SetDuty') AddEventHandler('QBCore:Client:SetDuty', function(duty) onDuty = duty end) Citizen.CreateThread(function() local c = Config.Locations["exit"] local Blip = AddBlipForCoord(c.x, c.y, c.z) SetBlipSprite (Blip, 446) SetBlipDisplay(Blip, 4) SetBlipScale (Blip, 0.7) SetBlipAsShortRange(Blip, true) SetBlipColour(Blip, 0) SetBlipAlpha(Blip, 0.7) BeginTextCommandSetBlipName("STRING") AddTextComponentSubstringPlayerName("Autocare Mechanic") EndTextCommandSetBlipName(Blip) end) Citizen.CreateThread(function() while true do local inRange = false if isLoggedIn then if PlayerJob.name == "mechanic" then local pos = GetEntityCoords(PlayerPedId()) local StashDistance = #(pos - Config.Locations["stash"]) local OnDutyDistance = #(pos - Config.Locations["duty"]) local VehicleDistance = #(pos - vector3(Config.Locations["vehicle"].x, Config.Locations["vehicle"].y, Config.Locations["vehicle"].z)) if onDuty then if StashDistance < 20 then inRange = true DrawMarker(2, Config.Locations["stash"].x, Config.Locations["stash"].y, Config.Locations["stash"].z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.2, 210, 50, 9, 255, false, false, false, true, false, false, false) if StashDistance < 1 then DrawText3Ds(Config.Locations["stash"].x, Config.Locations["stash"].y, Config.Locations["stash"].z, "[E] Open Stash") if IsControlJustReleased(0, 38) then TriggerEvent("inventory:client:SetCurrentStash", "mechanicstash") TriggerServerEvent("inventory:server:OpenInventory", "stash", "mechanicstash", { maxweight = 4000000, slots = 500, }) end end end end if onDuty then if VehicleDistance < 20 then inRange = true DrawMarker(2, Config.Locations["vehicle"].x, Config.Locations["vehicle"].y, Config.Locations["vehicle"].z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.2, 210, 50, 9, 255, false, false, false, true, false, false, false) if VehicleDistance < 1 then local InVehicle = IsPedInAnyVehicle(PlayerPedId()) if InVehicle then DrawText3Ds(Config.Locations["vehicle"].x, Config.Locations["vehicle"].y, Config.Locations["vehicle"].z, '[E] Hide Vehicle') if IsControlJustPressed(0, 38) then DeleteVehicle(GetVehiclePedIsIn(PlayerPedId())) end else DrawText3Ds(Config.Locations["vehicle"].x, Config.Locations["vehicle"].y, Config.Locations["vehicle"].z, '[E] Get Vehicle') if IsControlJustPressed(0, 38) then if IsControlJustPressed(0, 38) then VehicleList() Menu.hidden = not Menu.hidden end end Menu.renderGUI() end end end end if OnDutyDistance < 20 then inRange = true DrawMarker(2, Config.Locations["duty"].x, Config.Locations["duty"].y, Config.Locations["duty"].z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.2, 210, 50, 9, 255, false, false, false, true, false, false, false) if OnDutyDistance < 1 then if onDuty then DrawText3Ds(Config.Locations["duty"].x, Config.Locations["duty"].y, Config.Locations["duty"].z, "[E] Off Duty") else DrawText3Ds(Config.Locations["duty"].x, Config.Locations["duty"].y, Config.Locations["duty"].z, "[E] On Duty") end if IsControlJustReleased(0, 38) then TriggerServerEvent("QBCore:ToggleDuty") end end end if onDuty then for k, v in pairs(Config.Plates) do if v.AttachedVehicle == nil then local PlateDistance = #(pos - vector3(v.coords.x, v.coords.y, v.coords.z)) if PlateDistance < 20 then inRange = true DrawMarker(2, v.coords.x, v.coords.y, v.coords.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.2, 255, 255, 255, 255, 0, 0, 0, 1, 0, 0, 0) if PlateDistance < 2 then local veh = GetVehiclePedIsIn(PlayerPedId()) if IsPedInAnyVehicle(PlayerPedId()) then if not IsThisModelABicycle(GetEntityModel(veh)) then DrawText3Ds(v.coords.x, v.coords.y, v.coords.z + 0.3, "[E] Place The Vehicle On The Platform") if IsControlJustPressed(0, 38) then DoScreenFadeOut(150) Wait(150) Config.Plates[ClosestPlate].AttachedVehicle = veh SetEntityCoords(veh, v.coords) SetEntityHeading(veh, v.coords.w) FreezeEntityPosition(veh, true) Wait(500) DoScreenFadeIn(250) TriggerServerEvent('qb-vehicletuning:server:SetAttachedVehicle', veh, k) end else QBCore.Functions.Notify("You Cannot Put Bicycles On The Platform!", "error") end end end end else local PlateDistance = #(pos - vector3(v.coords.x, v.coords.y, v.coords.z)) if PlateDistance < 3 then inRange = true DrawText3Ds(v.coords.x, v.coords.y, v.coords.z, "[E] Open Menu") if IsControlJustPressed(0, 38) then OpenMenu() Menu.hidden = not Menu.hidden end Menu.renderGUI() end end end end if not inRange then Citizen.Wait(1500) end else Citizen.Wait(1500) end else Citizen.Wait(1500) end Citizen.Wait(3) end end) function OpenMenu() ClearMenu() Menu.addButton("Options", "VehicleOptions", nil) Menu.addButton("Close Menu", "CloseMenu", nil) end function VehicleList() ClearMenu() for k, v in pairs(Config.Vehicles) do Menu.addButton(v, "SpawnListVehicle", k) end Menu.addButton("Close Menu", "CloseMenu", nil) end function SpawnListVehicle(model) local coords = { x = Config.Locations["vehicle"].x, y = Config.Locations["vehicle"].y, z = Config.Locations["vehicle"].z, w = Config.Locations["vehicle"].w, } QBCore.Functions.SpawnVehicle(model, function(veh) SetVehicleNumberPlateText(veh, "ACBV"..tostring(math.random(1000, 9999))) SetEntityHeading(veh, coords.w) exports['LegacyFuel']:SetFuel(veh, 100.0) Menu.hidden = true TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1) TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(veh)) SetVehicleEngineOn(veh, true, true) end, coords, true) end function VehicleOptions() ClearMenu() Menu.addButton("Disconnect Vehicle", "UnattachVehicle", nil) -- Menu.addButton("Check Status", "CheckStatus", nil) Menu.addButton("Vehicle Parts", "PartsMenu", nil) Menu.addButton("Close Menu", "CloseMenu", nil) end function PartsMenu() ClearMenu() local plate = GetVehicleNumberPlateText(Config.Plates[ClosestPlate].AttachedVehicle) if VehicleStatus[plate] ~= nil then for k, v in pairs(Config.ValuesLabels) do if math.ceil(VehicleStatus[plate][k]) ~= Config.MaxStatusValues[k] then local percentage = math.ceil(VehicleStatus[plate][k]) if percentage > 100 then percentage = math.ceil(VehicleStatus[plate][k]) / 10 end Menu.addButton(v..": "..percentage.."%", "PartMenu", k) else local percentage = math.ceil(Config.MaxStatusValues[k]) if percentage > 100 then percentage = math.ceil(Config.MaxStatusValues[k]) / 10 end Menu.addButton(v..": "..percentage.."%", "NoDamage", nil) end end else for k, v in pairs(Config.ValuesLabels) do local percentage = math.ceil(Config.MaxStatusValues[k]) if percentage > 100 then percentage = math.ceil(Config.MaxStatusValues[k]) / 10 end Menu.addButton(v..": "..percentage.."%", "NoDamage", nil) end end Menu.addButton("Back", "VehicleOptions", nil) Menu.addButton("Close Menu", "CloseMenu", nil) end function CheckStatus() local plate = GetVehicleNumberPlateText(Config.Plates[ClosestPlate].AttachedVehicle) SendStatusMessage(VehicleStatus[plate]) end function PartMenu(part) ClearMenu() Menu.addButton("Repair ("..QBCore.Shared.Items[Config.RepairCostAmount[part].item]["label"].." "..Config.RepairCostAmount[part].costs.."x)", "RepairPart", part) Menu.addButton("Back", "VehicleOptions", nil) Menu.addButton("Close Menu", "CloseMenu", nil) end function NoDamage(part) ClearMenu() Menu.addButton("There Is No Damage To This Part!", "PartsMenu", part) Menu.addButton("Back", "VehicleOptions", nil) Menu.addButton("Close Menu", "CloseMenu", nil) end function RepairPart(part) local plate = GetVehicleNumberPlateText(Config.Plates[ClosestPlate].AttachedVehicle) local PartData = Config.RepairCostAmount[part] local hasitem = false local indx = 0 local countitem = 0 QBCore.Functions.TriggerCallback('qb-inventory:server:GetStashItems', function(StashItems) for k,v in pairs(StashItems) do if v.name == PartData.item then hasitem = true if v.amount >= PartData.costs then countitem = v.amount indx = k end end end if hasitem and countitem >= PartData.costs then TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"}) QBCore.Functions.Progressbar("repair_part", "Repairing " ..Config.ValuesLabels[part], math.random(5000, 10000), false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, {}, {}, {}, function() -- Done TriggerEvent('animations:client:EmoteCommandStart', {"c"}) if (countitem - PartData.costs) <= 0 then StashItems[indx] = nil else countitem = (countitem - PartData.costs) StashItems[indx].amount = countitem end TriggerEvent('qb-vehicletuning:client:RepaireeePart', part) TriggerServerEvent('qb-inventory:server:SaveStashItems', "mechanicstash", StashItems) SetTimeout(250, function() PartsMenu() end) end, function() QBCore.Functions.Notify("Repair Cancelled", "error") end) else QBCore.Functions.Notify('There Are Not Enough Materials In The Safe', 'error') end end, "mechanicstash") end -- RegisterNetEvent('qb-vehicletuning:client:RepaireeePart') AddEventHandler('qb-vehicletuning:client:RepaireeePart', function(part) local veh = Config.Plates[ClosestPlate].AttachedVehicle local plate = GetVehicleNumberPlateText(veh) if part == "engine" then SetVehicleEngineHealth(veh, Config.MaxStatusValues[part]) TriggerServerEvent("vehiclemod:server:updatePart", plate, "engine", Config.MaxStatusValues[part]) elseif part == "body" then SetVehicleBodyHealth(veh, Config.MaxStatusValues[part]) TriggerServerEvent("vehiclemod:server:updatePart", plate, "body", Config.MaxStatusValues[part]) SetVehicleFixed(veh) else TriggerServerEvent("vehiclemod:server:updatePart", plate, part, Config.MaxStatusValues[part]) end QBCore.Functions.Notify("The "..Config.ValuesLabels[part].." Is Repaired!") end) function UnattachVehicle() local coords = Config.Locations["exit"] DoScreenFadeOut(150) Wait(150) FreezeEntityPosition(Config.Plates[ClosestPlate].AttachedVehicle, false) SetEntityCoords(Config.Plates[ClosestPlate].AttachedVehicle, Config.Plates[ClosestPlate].coords.x, Config.Plates[ClosestPlate].coords.y, Config.Plates[ClosestPlate].coords.z) SetEntityHeading(Config.Plates[ClosestPlate].AttachedVehicle, Config.Plates[ClosestPlate].coords.w) TaskWarpPedIntoVehicle(PlayerPedId(), Config.Plates[ClosestPlate].AttachedVehicle, -1) Wait(500) DoScreenFadeIn(250) Config.Plates[ClosestPlate].AttachedVehicle = nil TriggerServerEvent('qb-vehicletuning:server:SetAttachedVehicle', false, ClosestPlate) end RegisterNetEvent('qb-vehicletuning:client:SetAttachedVehicle') AddEventHandler('qb-vehicletuning:client:SetAttachedVehicle', function(veh, key) if veh ~= false then Config.Plates[key].AttachedVehicle = veh else Config.Plates[key].AttachedVehicle = nil end end) Citizen.CreateThread(function() while true do Citizen.Wait(1) if (IsPedInAnyVehicle(PlayerPedId(), false)) then local veh = GetVehiclePedIsIn(PlayerPedId(),false) if ModdedVehicles[tostring(veh)] == nil and not IsThisModelABicycle(GetEntityModel(veh)) then --[[local fSteeringLock = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fSteeringLock') fSteeringLock = math.ceil((fSteeringLock * 0.6)) + 0.1 SetVehicleHandlingFloat(veh, 'CHandlingData', 'fSteeringLock', fSteeringLock) SetVehicleHandlingField(veh, 'CHandlingData', 'fSteeringLock', fSteeringLock)]]-- local fInitialDriveMaxFlatVel = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fInitialDriveMaxFlatVel') if IsThisModelABike(GetEntityModel(veh)) then local fTractionCurveMin = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fTractionCurveMin') fTractionCurveMin = fTractionCurveMin * 0.6 SetVehicleHandlingFloat(veh, 'CHandlingData', 'fTractionCurveMin', fTractionCurveMin) SetVehicleHandlingField(veh, 'CHandlingData', 'fTractionCurveMin', fTractionCurveMin) -- local fTractionCurveMax = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fTractionCurveMax') -- fTractionCurveMax = fTractionCurveMax * 0.6 -- SetVehicleHandlingFloat(veh, 'CHandlingData', 'fTractionCurveMax', fTractionCurveMax) -- SetVehicleHandlingField(veh, 'CHandlingData', 'fTractionCurveMax', fTractionCurveMax) local fInitialDriveForce = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fInitialDriveForce') fInitialDriveForce = fInitialDriveForce * 2.4 SetVehicleHandlingFloat(veh, 'CHandlingData', 'fInitialDriveForce', fInitialDriveForce) local fBrakeForce = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fBrakeForce') fBrakeForce = fBrakeForce * 1.4 SetVehicleHandlingFloat(veh, 'CHandlingData', 'fBrakeForce', fBrakeForce) SetVehicleHandlingFloat(veh, 'CHandlingData', 'fSuspensionReboundDamp', 5.000000) SetVehicleHandlingField(veh, 'CHandlingData', 'fSuspensionReboundDamp', 5.000000) SetVehicleHandlingFloat(veh, 'CHandlingData', 'fSuspensionCompDamp', 5.000000) SetVehicleHandlingField(veh, 'CHandlingData', 'fSuspensionCompDamp', 5.000000) SetVehicleHandlingFloat(veh, 'CHandlingData', 'fSuspensionForce', 22.000000) SetVehicleHandlingField(veh, 'CHandlingData', 'fSuspensionForce', 22.000000) SetVehicleHandlingFloat(veh, 'CHandlingData', 'fCollisionDamageMult', 2.500000) SetVehicleHandlingFloat(veh, 'CHandlingData', 'fEngineDamageMult', 0.120000) else local fBrakeForce = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fBrakeForce') fBrakeForce = fBrakeForce * 0.5 SetVehicleHandlingFloat(veh, 'CHandlingData', 'fBrakeForce', fBrakeForce) local fInitialDriveForce = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fInitialDriveForce') if fInitialDriveForce < 0.289 then fInitialDriveForce = fInitialDriveForce * 1.2 SetVehicleHandlingFloat(veh, 'CHandlingData', 'fInitialDriveForce', fInitialDriveForce) else fInitialDriveForce = fInitialDriveForce * 0.9 SetVehicleHandlingFloat(veh, 'CHandlingData', 'fInitialDriveForce', fInitialDriveForce) end local fInitialDragCoeff = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fInitialDragCoeff') fInitialDragCoeff = fInitialDragCoeff * 0.3 SetVehicleHandlingFloat(veh, 'CHandlingData', 'fInitialDragCoeff', fInitialDragCoeff) SetVehicleHandlingFloat(veh, 'CHandlingData', 'fEngineDamageMult', 0.100000) SetVehicleHandlingFloat(veh, 'CHandlingData', 'fCollisionDamageMult', 2.900000) end SetVehicleHandlingFloat(veh, 'CHandlingData', 'fDeformationDamageMult', 1.000000) SetVehicleHasBeenOwnedByPlayer(veh,true) ModdedVehicles[tostring(veh)] = { ["fInitialDriveMaxFlatVel"] = fInitialDriveMaxFlatVel, ["fSteeringLock"] = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fSteeringLock'), ["fTractionLossMult"] = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fTractionLossMult'), ["fLowSpeedTractionLossMult"] = GetVehicleHandlingFloat(veh, 'CHandlingData', 'fLowSpeedTractionLossMult') } else Citizen.Wait(1000) end else Citizen.Wait(2000) end end end) local effectTimer = 0 Citizen.CreateThread(function() while true do Citizen.Wait(1000) if (IsPedInAnyVehicle(PlayerPedId(), false)) then local veh = GetVehiclePedIsIn(PlayerPedId(),false) if not IsThisModelABicycle(GetEntityModel(veh)) and GetPedInVehicleSeat(veh, -1) == PlayerPedId() then local engineHealth = GetVehicleEngineHealth(veh) local bodyHealth = GetVehicleBodyHealth(veh) local plate = GetVehicleNumberPlateText(veh) if VehicleStatus[plate] == nil then TriggerServerEvent("vehiclemod:server:setupVehicleStatus", plate, engineHealth, bodyHealth) else TriggerServerEvent("vehiclemod:server:updatePart", plate, "engine", engineHealth) TriggerServerEvent("vehiclemod:server:updatePart", plate, "body", bodyHealth) effectTimer = effectTimer + 1 if effectTimer >= math.random(10, 15) then ApplyEffects(veh) effectTimer = 0 end end else effectTimer = 0 Citizen.Wait(1000) end else effectTimer = 0 Citizen.Wait(2000) end end end) RegisterNetEvent('vehiclemod:client:setVehicleStatus') AddEventHandler('vehiclemod:client:setVehicleStatus', function(plate, status) VehicleStatus[plate] = status end) RegisterNetEvent('vehiclemod:client:getVehicleStatus') AddEventHandler('vehiclemod:client:getVehicleStatus', function(plate, status) if not (IsPedInAnyVehicle(PlayerPedId(), false)) then local veh = GetVehiclePedIsIn(PlayerPedId(), true) if veh ~= nil and veh ~= 0 then local vehpos = GetEntityCoords(veh) local pos = GetEntityCoords(PlayerPedId()) if #(pos - vehpos) < 5.0 then if not IsThisModelABicycle(GetEntityModel(veh)) then local plate = GetVehicleNumberPlateText(veh) if VehicleStatus[plate] ~= nil then SendStatusMessage(VehicleStatus[plate]) else QBCore.Functions.Notify("Status Unknown", "error") end else QBCore.Functions.Notify("Not A Valid Vehicle", "error") end else QBCore.Functions.Notify("You Are Not Close Enough To The Vehicle", "error") end else QBCore.Functions.Notify("You Must Be In The Vehicle First", "error") end else QBCore.Functions.Notify("You Must Be Outside The Vehicle", "error") end end) RegisterNetEvent('vehiclemod:client:fixEverything') AddEventHandler('vehiclemod:client:fixEverything', function() if (IsPedInAnyVehicle(PlayerPedId(), false)) then local veh = GetVehiclePedIsIn(PlayerPedId(),false) if not IsThisModelABicycle(GetEntityModel(veh)) and GetPedInVehicleSeat(veh, -1) == PlayerPedId() then local plate = GetVehicleNumberPlateText(veh) TriggerServerEvent("vehiclemod:server:fixEverything", plate) else QBCore.Functions.Notify("You Are Not The Driver Or On A Bicycle", "error") end else QBCore.Functions.Notify("You Are Not In A Vehicle", "error") end end) RegisterNetEvent('vehiclemod:client:setPartLevel') AddEventHandler('vehiclemod:client:setPartLevel', function(part, level) if (IsPedInAnyVehicle(PlayerPedId(), false)) then local veh = GetVehiclePedIsIn(PlayerPedId(),false) if not IsThisModelABicycle(GetEntityModel(veh)) and GetPedInVehicleSeat(veh, -1) == PlayerPedId() then local plate = GetVehicleNumberPlateText(veh) if part == "engine" then SetVehicleEngineHealth(veh, level) TriggerServerEvent("vehiclemod:server:updatePart", plate, "engine", GetVehicleEngineHealth(veh)) elseif part == "body" then SetVehicleBodyHealth(veh, level) TriggerServerEvent("vehiclemod:server:updatePart", plate, "body", GetVehicleBodyHealth(veh)) else TriggerServerEvent("vehiclemod:server:updatePart", plate, part, level) end else QBCore.Functions.Notify("You Are Not The Driver Or On A Bicycle", "error") end else QBCore.Functions.Notify("You Are Not The Driver Or On A Bicycle", "error") end end) local openingDoor = false RegisterNetEvent('vehiclemod:client:repairPart') AddEventHandler('vehiclemod:client:repairPart', function(part, level, needAmount) -- if CanReapair() then if not IsPedInAnyVehicle(PlayerPedId(), false) then local veh = GetVehiclePedIsIn(PlayerPedId(), true) if veh ~= nil and veh ~= 0 then local vehpos = GetEntityCoords(veh) local pos = GetEntityCoords(PlayerPedId()) if #(pos - vehpos) < 5.0 then if not IsThisModelABicycle(GetEntityModel(veh)) then local plate = GetVehicleNumberPlateText(veh) if VehicleStatus[plate] ~= nil and VehicleStatus[plate][part] ~= nil then local lockpickTime = (1000 * level) if part == "body" then lockpickTime = lockpickTime / 10 end ScrapAnim(lockpickTime) QBCore.Functions.Progressbar("repair_advanced", "Repair Vehicle", lockpickTime, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, { animDict = "mp_car_bomb", anim = "car_bomb_mechanic", flags = 16, }, {}, {}, function() -- Done openingDoor = false ClearPedTasks(PlayerPedId()) if part == "body" then SetVehicleBodyHealth(veh, GetVehicleBodyHealth(veh) + level) SetVehicleFixed(veh) TriggerServerEvent("vehiclemod:server:updatePart", plate, part, GetVehicleBodyHealth(veh)) TriggerServerEvent("QBCore:Server:RemoveItem", Config.RepairCost[part], needAmount) TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items[Config.RepairCost[part]], "remove") elseif part ~= "engine" then TriggerServerEvent("vehiclemod:server:updatePart", plate, part, GetVehicleStatus(plate, part) + level) TriggerServerEvent("QBCore:Server:RemoveItem", Config.RepairCost[part], level) TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items[Config.RepairCost[part]], "remove") end end, function() -- Cancel openingDoor = false ClearPedTasks(PlayerPedId()) QBCore.Functions.Notify("Process Canceled", "error") end) else QBCore.Functions.Notify("Not A Valid Part", "error") end else QBCore.Functions.Notify("Not A Valid Vehicle", "error") end else QBCore.Functions.Notify("You Are Not Close Enough To The Vehicle", "error") end else QBCore.Functions.Notify("You Must Be In The Vehicle First", "error") end else QBCore.Functions.Notify("Youre Not In a Vehicle", "error") end -- end end) function ScrapAnim(time) local time = time / 1000 loadAnimDict("mp_car_bomb") TaskPlayAnim(PlayerPedId(), "mp_car_bomb", "car_bomb_mechanic" ,3.0, 3.0, -1, 16, 0, false, false, false) openingDoor = true Citizen.CreateThread(function() while openingDoor do TaskPlayAnim(PlayerPedId(), "mp_car_bomb", "car_bomb_mechanic", 3.0, 3.0, -1, 16, 0, 0, 0, 0) Citizen.Wait(2000) time = time - 2 if time <= 0 then openingDoor = false StopAnimTask(PlayerPedId(), "mp_car_bomb", "car_bomb_mechanic", 1.0) end end end) end function CanReapair() local retval = false for k, v in pairs(Config.Businesses) do retval = exports['qb-companies']:IsEmployee(v) end return retval end function ApplyEffects(vehicle) local plate = GetVehicleNumberPlateText(vehicle) if GetVehicleClass(vehicle) ~= 13 and GetVehicleClass(vehicle) ~= 21 and GetVehicleClass(vehicle) ~= 16 and GetVehicleClass(vehicle) ~= 15 and GetVehicleClass(vehicle) ~= 14 then if VehicleStatus[plate] ~= nil then local chance = math.random(1, 100) if VehicleStatus[plate]["radiator"] <= 80 and (chance >= 1 and chance <= 20) then local engineHealth = GetVehicleEngineHealth(vehicle) if VehicleStatus[plate]["radiator"] <= 80 and VehicleStatus[plate]["radiator"] >= 60 then SetVehicleEngineHealth(vehicle, engineHealth - math.random(10, 15)) elseif VehicleStatus[plate]["radiator"] <= 59 and VehicleStatus[plate]["radiator"] >= 40 then SetVehicleEngineHealth(vehicle, engineHealth - math.random(15, 20)) elseif VehicleStatus[plate]["radiator"] <= 39 and VehicleStatus[plate]["radiator"] >= 20 then SetVehicleEngineHealth(vehicle, engineHealth - math.random(20, 30)) elseif VehicleStatus[plate]["radiator"] <= 19 and VehicleStatus[plate]["radiator"] >= 6 then SetVehicleEngineHealth(vehicle, engineHealth - math.random(30, 40)) else SetVehicleEngineHealth(vehicle, engineHealth - math.random(40, 50)) end end if VehicleStatus[plate]["axle"] <= 80 and (chance >= 21 and chance <= 40) then if VehicleStatus[plate]["axle"] <= 80 and VehicleStatus[plate]["axle"] >= 60 then for i=0,360 do SetVehicleSteeringScale(vehicle,i) Citizen.Wait(5) end elseif VehicleStatus[plate]["axle"] <= 59 and VehicleStatus[plate]["axle"] >= 40 then for i=0,360 do Citizen.Wait(10) SetVehicleSteeringScale(vehicle,i) end elseif VehicleStatus[plate]["axle"] <= 39 and VehicleStatus[plate]["axle"] >= 20 then for i=0,360 do Citizen.Wait(15) SetVehicleSteeringScale(vehicle,i) end elseif VehicleStatus[plate]["axle"] <= 19 and VehicleStatus[plate]["axle"] >= 6 then for i=0,360 do Citizen.Wait(20) SetVehicleSteeringScale(vehicle,i) end else for i=0,360 do Citizen.Wait(25) SetVehicleSteeringScale(vehicle,i) end end end if VehicleStatus[plate]["brakes"] <= 80 and (chance >= 41 and chance <= 60) then if VehicleStatus[plate]["brakes"] <= 80 and VehicleStatus[plate]["brakes"] >= 60 then SetVehicleHandbrake(vehicle, true) Citizen.Wait(1000) SetVehicleHandbrake(vehicle, false) elseif VehicleStatus[plate]["brakes"] <= 59 and VehicleStatus[plate]["brakes"] >= 40 then SetVehicleHandbrake(vehicle, true) Citizen.Wait(3000) SetVehicleHandbrake(vehicle, false) elseif VehicleStatus[plate]["brakes"] <= 39 and VehicleStatus[plate]["brakes"] >= 20 then SetVehicleHandbrake(vehicle, true) Citizen.Wait(5000) SetVehicleHandbrake(vehicle, false) elseif VehicleStatus[plate]["brakes"] <= 19 and VehicleStatus[plate]["brakes"] >= 6 then SetVehicleHandbrake(vehicle, true) Citizen.Wait(7000) SetVehicleHandbrake(vehicle, false) else SetVehicleHandbrake(vehicle, true) Citizen.Wait(9000) SetVehicleHandbrake(vehicle, false) end end if VehicleStatus[plate]["clutch"] <= 80 and (chance >= 61 and chance <= 80) then if VehicleStatus[plate]["clutch"] <= 80 and VehicleStatus[plate]["clutch"] >= 60 then SetVehicleHandbrake(vehicle, true) SetVehicleEngineOn(vehicle,0,0,1) SetVehicleUndriveable(vehicle,true) Citizen.Wait(50) SetVehicleEngineOn(vehicle,1,0,1) SetVehicleUndriveable(vehicle,false) for i=1,360 do SetVehicleSteeringScale(vehicle, i) Citizen.Wait(5) end Citizen.Wait(500) SetVehicleHandbrake(vehicle, false) elseif VehicleStatus[plate]["clutch"] <= 59 and VehicleStatus[plate]["clutch"] >= 40 then SetVehicleHandbrake(vehicle, true) SetVehicleEngineOn(vehicle,0,0,1) SetVehicleUndriveable(vehicle,true) Citizen.Wait(100) SetVehicleEngineOn(vehicle,1,0,1) SetVehicleUndriveable(vehicle,false) for i=1,360 do SetVehicleSteeringScale(vehicle, i) Citizen.Wait(5) end Citizen.Wait(750) SetVehicleHandbrake(vehicle, false) elseif VehicleStatus[plate]["clutch"] <= 39 and VehicleStatus[plate]["clutch"] >= 20 then SetVehicleHandbrake(vehicle, true) SetVehicleEngineOn(vehicle,0,0,1) SetVehicleUndriveable(vehicle,true) Citizen.Wait(150) SetVehicleEngineOn(vehicle,1,0,1) SetVehicleUndriveable(vehicle,false) for i=1,360 do SetVehicleSteeringScale(vehicle, i) Citizen.Wait(5) end Citizen.Wait(1000) SetVehicleHandbrake(vehicle, false) elseif VehicleStatus[plate]["clutch"] <= 19 and VehicleStatus[plate]["clutch"] >= 6 then SetVehicleHandbrake(vehicle, true) SetVehicleEngineOn(vehicle,0,0,1) SetVehicleUndriveable(vehicle,true) Citizen.Wait(200) SetVehicleEngineOn(vehicle,1,0,1) SetVehicleUndriveable(vehicle,false) for i=1,360 do SetVehicleSteeringScale(vehicle, i) Citizen.Wait(5) end Citizen.Wait(1250) SetVehicleHandbrake(vehicle, false) else SetVehicleHandbrake(vehicle, true) SetVehicleEngineOn(vehicle,0,0,1) SetVehicleUndriveable(vehicle,true) Citizen.Wait(250) SetVehicleEngineOn(vehicle,1,0,1) SetVehicleUndriveable(vehicle,false) for i=1,360 do SetVehicleSteeringScale(vehicle, i) Citizen.Wait(5) end Citizen.Wait(1500) SetVehicleHandbrake(vehicle, false) end end if VehicleStatus[plate]["fuel"] <= 80 and (chance >= 81 and chance <= 100) then local fuel = exports['LegacyFuel']:GetFuel(vehicle) if VehicleStatus[plate]["fuel"] <= 80 and VehicleStatus[plate]["fuel"] >= 60 then exports['LegacyFuel']:SetFuel(vehicle, fuel - 2.0) elseif VehicleStatus[plate]["fuel"] <= 59 and VehicleStatus[plate]["fuel"] >= 40 then exports['LegacyFuel']:SetFuel(vehicle, fuel - 4.0) elseif VehicleStatus[plate]["fuel"] <= 39 and VehicleStatus[plate]["fuel"] >= 20 then exports['LegacyFuel']:SetFuel(vehicle, fuel - 6.0) elseif VehicleStatus[plate]["fuel"] <= 19 and VehicleStatus[plate]["fuel"] >= 6 then exports['LegacyFuel']:SetFuel(vehicle, fuel - 8.0) else exports['LegacyFuel']:SetFuel(vehicle, fuel - 10.0) end end end end end function loadAnimDict(dict) while (not HasAnimDictLoaded(dict)) do RequestAnimDict(dict) Citizen.Wait(5) end end function GetVehicleStatusList(plate) local retval = nil if VehicleStatus[plate] ~= nil then retval = VehicleStatus[plate] end return retval end function GetVehicleStatus(plate, part) local retval = nil if VehicleStatus[plate] ~= nil then retval = VehicleStatus[plate][part] end return retval end function SetVehicleStatus(plate, part, level) TriggerServerEvent("vehiclemod:server:updatePart", plate, part, level) end function SendStatusMessage(statusList) if statusList ~= nil then TriggerEvent('chat:addMessage', { template = '<div class="chat-message normal"><div class="chat-message-body"><strong>{0}:</strong><br><br> <strong>'.. Config.ValuesLabels["engine"] ..' (engine):</strong> {1} <br><strong>'.. Config.ValuesLabels["body"] ..' (body):</strong> {2} <br><strong>'.. Config.ValuesLabels["radiator"] ..' (radiator):</strong> {3} <br><strong>'.. Config.ValuesLabels["axle"] ..' (axle):</strong> {4}<br><strong>'.. Config.ValuesLabels["brakes"] ..' (brakes):</strong> {5}<br><strong>'.. Config.ValuesLabels["clutch"] ..' (clutch):</strong> {6}<br><strong>'.. Config.ValuesLabels["fuel"] ..' (fuel):</strong> {7}</div></div>', args = {'Vehicle Status', round(statusList["engine"]) .. "/" .. Config.MaxStatusValues["engine"] .. " ("..QBCore.Shared.Items["advancedrepairkit"]["label"]..")", round(statusList["body"]) .. "/" .. Config.MaxStatusValues["body"] .. " ("..QBCore.Shared.Items[Config.RepairCost["body"]]["label"]..")", round(statusList["radiator"]) .. "/" .. Config.MaxStatusValues["radiator"] .. ".0 ("..QBCore.Shared.Items[Config.RepairCost["radiator"]]["label"]..")", round(statusList["axle"]) .. "/" .. Config.MaxStatusValues["axle"] .. ".0 ("..QBCore.Shared.Items[Config.RepairCost["axle"]]["label"]..")", round(statusList["brakes"]) .. "/" .. Config.MaxStatusValues["brakes"] .. ".0 ("..QBCore.Shared.Items[Config.RepairCost["brakes"]]["label"]..")", round(statusList["clutch"]) .. "/" .. Config.MaxStatusValues["clutch"] .. ".0 ("..QBCore.Shared.Items[Config.RepairCost["clutch"]]["label"]..")", round(statusList["fuel"]) .. "/" .. Config.MaxStatusValues["fuel"] .. ".0 ("..QBCore.Shared.Items[Config.RepairCost["fuel"]]["label"]..")"} }) end end function round(num, numDecimalPlaces) return tonumber(string.format("%." .. (numDecimalPlaces or 1) .. "f", num)) end -- Menu Functions CloseMenu = function() Menu.hidden = true currentGarage = nil ClearMenu() end ClearMenu = function() --Menu = {} Menu.GUI = {} Menu.buttonCount = 0 Menu.selection = 0 end function noSpace(str) local normalisedString = string.gsub(str, "%s+", "") return normalisedString end
--[[-------------------------------------------------------------------- Copyright (C) 2013, 2014 Johnny C. Lam. See the file LICENSE.txt for copying permission. --]]-------------------------------------------------------------------- -- This addon tracks the damage taken by the player from non-player sources. local OVALE, Ovale = ... local OvaleDamageTaken = Ovale:NewModule("OvaleDamageTaken", "AceEvent-3.0") Ovale.OvaleDamageTaken = OvaleDamageTaken --<private-static-properties> local L = Ovale.L local OvaleDebug = Ovale.OvaleDebug local OvalePool = Ovale.OvalePool local OvaleProfiler = Ovale.OvaleProfiler local OvaleQueue = Ovale.OvaleQueue local bit_band = bit.band local bit_bor = bit.bor local strsub = string.sub local API_GetTime = GetTime local SCHOOL_MASK_ARCANE = SCHOOL_MASK_ARCANE local SCHOOL_MASK_FIRE = SCHOOL_MASK_FIRE local SCHOOL_MASK_FROST = SCHOOL_MASK_FROST local SCHOOL_MASK_HOLY = SCHOOL_MASK_HOLY local SCHOOL_MASK_NATURE = SCHOOL_MASK_NATURE local SCHOOL_MASK_NONE = SCHOOL_MASK_NONE local SCHOOL_MASK_PHYSICAL = SCHOOL_MASK_PHYSICAL local SCHOOL_MASK_SHADOW = SCHOOL_MASK_SHADOW -- Register for debugging messages. OvaleDebug:RegisterDebugging(OvaleDamageTaken) -- Register for profiling. OvaleProfiler:RegisterProfiling(OvaleDamageTaken) -- Player's GUID. local self_playerGUID = nil -- Damage event pool. local self_pool = OvalePool("OvaleDamageTaken_pool") -- Time window (past number of seconds) for which damage events are stored. local DAMAGE_TAKEN_WINDOW = 20 -- Bitmask for magic damage. local SCHOOL_MASK_MAGIC = bit_bor(SCHOOL_MASK_ARCANE, SCHOOL_MASK_FIRE, SCHOOL_MASK_FROST, SCHOOL_MASK_HOLY, SCHOOL_MASK_NATURE, SCHOOL_MASK_SHADOW) --</private-static-properties> --<public-static-properties> -- Damage event queue: new events are inserted at the front of the queue. OvaleDamageTaken.damageEvent = OvaleQueue:NewDeque("OvaleDamageTaken_damageEvent") --</public-static-properties> --<public-static-methods> function OvaleDamageTaken:OnEnable() self_playerGUID = Ovale.playerGUID self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("PLAYER_REGEN_ENABLED") end function OvaleDamageTaken:OnDisable() self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:UnregisterEvent("PLAYER_REGEN_ENABLED") self_pool:Drain() end function OvaleDamageTaken:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, cleuEvent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...) local arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25 = ... if destGUID == self_playerGUID and strsub(cleuEvent, -7) == "_DAMAGE" then self:StartProfiling("OvaleDamageTaken_COMBAT_LOG_EVENT_UNFILTERED") local now = API_GetTime() local eventPrefix = strsub(cleuEvent, 1, 6) if eventPrefix == "SWING_" then local amount = arg12 self:Debug("%s caused %d damage.", cleuEvent, amount) self:AddDamageTaken(now, amount) elseif eventPrefix == "RANGE_" or eventPrefix == "SPELL_" then local spellName, spellSchool, amount = arg13, arg14, arg15 local isMagicDamage = (bit_band(spellSchool, SCHOOL_MASK_MAGIC) > 0) if isMagicDamage then self:Debug("%s (%s) caused %d magic damage.", cleuEvent, spellName, amount) else self:Debug("%s (%s) caused %d damage.", cleuEvent, spellName, amount) end self:AddDamageTaken(now, amount, isMagicDamage) end self:StopProfiling("OvaleDamageTaken_COMBAT_LOG_EVENT_UNFILTERED") end end function OvaleDamageTaken:PLAYER_REGEN_ENABLED(event) self_pool:Drain() end function OvaleDamageTaken:AddDamageTaken(timestamp, damage, isMagicDamage) self:StartProfiling("OvaleDamageTaken_AddDamageTaken") local event = self_pool:Get() event.timestamp = timestamp event.damage = damage event.magic = isMagicDamage self.damageEvent:InsertFront(event) self:RemoveExpiredEvents(timestamp) Ovale.refreshNeeded[self_playerGUID] = true self:StopProfiling("OvaleDamageTaken_AddDamageTaken") end -- Return the total damage taken in the previous time interval (in seconds). function OvaleDamageTaken:GetRecentDamage(interval) local now = API_GetTime() local lowerBound = now - interval self:RemoveExpiredEvents(now) local total, totalMagic = 0, 0 for i, event in self.damageEvent:FrontToBackIterator() do if event.timestamp < lowerBound then break end total = total + event.damage if event.magic then totalMagic = totalMagic + event.damage end end return total, totalMagic end -- Remove all events that are more than DAMAGE_TAKEN_WINDOW seconds before the given timestamp. function OvaleDamageTaken:RemoveExpiredEvents(timestamp) self:StartProfiling("OvaleDamageTaken_RemoveExpiredEvents") while true do local event = self.damageEvent:Back() if not event then break end if event then if timestamp - event.timestamp < DAMAGE_TAKEN_WINDOW then break end self.damageEvent:RemoveBack() self_pool:Release(event) Ovale.refreshNeeded[self_playerGUID] = true end end self:StopProfiling("OvaleDamageTaken_RemoveExpiredEvents") end function OvaleDamageTaken:DebugDamageTaken() self.damageEvent:DebuggingInfo() for i, event in self.damageEvent:BackToFrontIterator() do self:Print("%d: %d damage", event.timestamp, event.damage) end end --</public-static-methods>
local pool = require "lib.core.db" local ngx_cache = require "lib.cache" local singletons = require "config.singletons" local cjson = require "cjson" local pl_stringx = require "pl.stringx" local tonumber = tonumber local setmetatable = setmetatable local ipairs = ipairs local next = next local type = type local ngx_log = ngx.log local ngx_DEBUG = ngx.DEBUG local string_format = string.format local string_len = string.len local string_split = pl_stringx.split local table_insert = table.insert local _M = {} function _M:new() local instance = {} instance.db = pool:new() instance.cachekey = "projects" setmetatable(instance, { __index = self }) return instance end -- 初始化全部项目配置 function _M:init_config() local env = singletons.config.env local projects = self.db:query("select backend_name, test_servers, beta_servers, prod_servers from projects where status = ?", {tonumber(1)}) if projects and next(projects) then for _, project in ipairs(projects) do local envserver = cjson.decode(project[env .. "_servers"]) local servers = {} servers.domain = envserver.domain or "localhost" local hosts = {} if envserver.servers and next(envserver.servers) then for _, addr in ipairs(envserver.servers) do local addrinfo = string_split(addr, ":") table_insert(hosts, { host = addrinfo[1], port = addrinfo[2] or 80 }) end end servers.servers = hosts local success, error = ngx_cache:set(self.cachekey, project.backend_name, servers) ngx_log(ngx_DEBUG, string_format("CREATE PROJECT SETTING [%s] status:%s error:%s", project.backend_name, success, error)) end end end -- 拉取按项目标识更新项目配置 function _M:update_config_by_backendname(backendname) local status = false local env = singletons.config.env local project = self.db:one("select backend_name, test_servers, beta_servers, prod_servers from projects where backend_name = ? and status = ?", { backendname, tonumber(1) }) if project then local envserver = cjson.decode(project[env .. "_servers"]) local servers = {} servers.domain = envserver.domain or "localhost" local hosts = {} if envserver.servers and next(envserver.servers) then for _, addr in ipairs(envserver.servers) do local addrinfo = string_split(addr, ":") table_insert(hosts, { host = addrinfo[1], port = addrinfo[2] or 80 }) end end servers.servers = hosts local succ, err = ngx_cache:set(self.cachekey, backendname, servers) if succ then status = true end ngx_log(ngx_DEBUG, string_format("UPDATE PROJECT SETTING [%s] status:%s error:%s", backendname, succ, err)) end return status end -- 拉取按项目标识拉取项目配置 function _M:get_config_by_backendname(backendname) if not backendname or type(backendname) ~= "string" and string_len(backendname) <= 0 then return nil end local projectconf = ngx_cache:get(self.cachekey, backendname) if not projectconf then -- 如果获取失败重新拉取 local succ = self:update_config_by_backendname(backendname) if succ then projectconf = ngx_cache:get(self.cachekey, backendname) end end return projectconf end return _M
local CLK = {} local timezone = require "timezone" function CLK:AddScreen(data) local entry = { f = data.func, duration = data.duration, refresh = data.refresh or data.duration, single = data.singleTime, speed = data.speed, } if data.front then table.insert(self.q, 1, entry) else table.insert(self.q, entry) end end function CLK:PrintTime(curr, diff) local unix, usec = rtctime.get() if unix < 946684800 then -- 01/01/2000 @ 12:00am (UTC) return "no NTP" end local tm = rtctime.epoch2cal(unix + timezone.getoffset(unix)) local s = tm["sec"] local s1 = math.floor(s / 10) + 1 local ddot = (bit.band(s, 1) > 0) and ":" or "\25" return string.format("%02d%s%02d%c%c", tm["hour"], ddot, tm["min"], 0x19, s1) end function CLK:PrintDate(curr, diff) local unix, usec = rtctime.get() if unix < 946684800 then -- 01/01/2000 @ 12:00am (UTC) return "no NTP" end local tm = rtctime.epoch2cal(unix + timezone.getoffset(unix)) local s = tm["sec"] local s1 = math.floor(s / 10) + 1 return string.format("%02d/%02d %c", tm["day"], tm["mon"], s1) end function CLK:TextSwing(curr, diff, txt) if not self.swingBuffer then local mat = self:PrintText({}, 1, txt) local str = string.char(unpack(mat)) mat = nil self.swingBuffer = string.rep("\0", self.w+1) .. str .. string.rep("\0", self.w+1) end local speed = curr.speed or 15 local pos = math.floor((diff / 1000) * speed) local done = pos > (self.swingBuffer:len() - self.w) if done then self.swingBuffer = nil return "", nil, true end local buf = {self.swingBuffer:byte(pos, pos + self.w)} return nil, nil, false, buf end function CLK:MakeBuffer(t) local now = tmr.now() / 1000 local curr = self.curr local startTime = self.startTime or 0 local diff = bit.band((now - startTime), 0x7fffffff) or 0 if not curr or (curr.duration and diff > curr.duration) then diff = 0 curr = self.q[1] if not curr then return end curr = table.remove(self.q, 1) if not curr.single then table.insert(self.q, curr) end self.curr = curr self.startTime = now if t then t:interval(curr.refresh or 1000) end end local succ, str, pos, done, buf = pcall(curr.f, self, curr, diff) if not succ then print("CLOCK: iERR:", str) str = "iERR" end if done then self.curr = nil end if str then buf = self.display:DisplayBuffer() self:PrintText(buf, pos or 1, str) end return buf end function CLK:PrintText(mat, x, txt, neg) local lookup = self.fontLookUp local font = self.font if not font or not lookup then collectgarbage() local hbeg = node.heap() lookup, font = unpack(require "font-5x7") collectgarbage() local hend = node.heap() print("CLOCK: font uses " .. tostring(hbeg - hend) .. " bytes") self.font = font self.fontLookUp = lookup end local limit = #mat local function put(p, v) if neg then v = bit.bnot(v) end if p > 0 and (limit == 0 or p <= limit) then mat[p] = v end end for i = 1, txt:len() do local char = txt:byte(i) local index = 1 + char*2 if index + 1 > #lookup then print("no glyph: ", char, string.char(char)) else local pos = struct.unpack("H", lookup:sub(index, index+1)) local len = font:byte(1 + pos) pos = pos + 1 for n = 1,len do put(x, font:byte(pos + n)) x = x + 1 end put(x, 0x00) x = x + 1 end if limit > 0 and x > limit then break end end return mat end function CLK:Refresh(t) -- local s = tmr.now() pcall(function() local buf = self:MakeBuffer(t or self.timer) if buf then self.display:WriteColumns(buf) end end) -- local e = tmr.now() -- if debugMode then -- print(string.format("refresh done in %f ms", (e - s) / 1000)) -- end end function CLK:Flush() self.curr = nil end function CLK:Pause() if self.timer then self.timer:stop() end end return { StartClock = function (timer) local clk = {} local cfg = require("sys-config").JSON("clock32x8.cfg") clk.timer = timer clk.display = require("max7219").Setup(cfg) clk.w = cfg.modules * 8 clk.q = { {f = function(self, c, d) return "Node" end, duration = 2 * 1000, refresh = 2000, single = true}, {f = function(self, c, d) return "MCU", self.w - 17 + 1 end, duration = 2 * 1000, refresh = 2000, single = true}, {f = function(self, c, d) return self:TextSwing(c, d, wifi.sta.gethostname() .. " Welcome") end, speed = 15, refresh = 100, single = true}, {f = CLK.PrintTime, duration = 30 * 1000, refresh = 1000}, {f = CLK.PrintDate, duration = 5 * 1000, refresh = 1000} } if timer then timer:alarm(10 * 1000, tmr.ALARM_AUTO, function(t) clk:Refresh(t) end) end return setmetatable(clk, {__index = CLK}) end, }
project "LiquidEnginePlatformTools" basedir "../workspace/platform-tools" kind "StaticLib" configurations { "Debug" } includedirs { "include/liquid/platform-tools" } files { "src/**.cpp", "include/**.h", } filter { "system:linux" } removefiles { "src/**.win32.cpp" } filter { "system:windows" } removefiles { "src/**.linux.cpp" } filter { "system:macosx" } files { "src/**.mm" } removefiles { "src/**.linux.cpp", "src/**.win32.cpp" }
local idn = require'idn' local prepare = function(str) return (str:gsub('[\n%s]+', ''):gsub('[uU]%+([A-F0-9]+)%s?', function(n) n = tonumber(n, 16) if(n < 128) then return string.char(n) elseif(n < 2048) then return string.char(192 + ((n - (n % 64)) / 64), 128 + (n % 64)) else return string.char(224 + ((n - (n % 4096)) / 4096), 128 + (((n % 4096) - (n % 64)) / 64), 128 + (n % 64)) end end)) end local pe = idn.punycode.encode local pd = idn.punycode.decode local ie = idn.encode context("RFC 3492 - Sample Strings", function() context("Encoding", function() test("Arabic (Egyptian)", function() assert_equal(pe(prepare[[ u+0644 u+064A u+0647 u+0645 u+0627 u+0628 u+062A u+0643 u+0644 u+0645 u+0648 u+0634 u+0639 u+0631 u+0628 u+064A u+061F ]]), 'egbpdaj6bu4bxfgehfvwxn') end) test("Chinese (simplified)", function() assert_equal(pe(prepare[[ u+4ED6 u+4EEC u+4E3A u+4EC0 u+4E48 u+4E0D u+8BF4 u+4E2D u+6587 ]]), 'ihqwcrb4cv8a8dqg056pqjye') end) test("Chinese (traditional)", function() assert_equal(pe(prepare[[ u+4ED6 u+5011 u+7232 u+4EC0 u+9EBD u+4E0D u+8AAA u+4E2D u+6587 ]]), 'ihqwctvzc91f659drss3x8bo0yb') end) test("Czech", function() assert_equal(pe(prepare[[ U+0050 u+0072 u+006F u+010D u+0070 u+0072 u+006F u+0073 u+0074 u+011B u+006E u+0065 u+006D u+006C u+0075 u+0076 u+00ED u+010D u+0065 u+0073 u+006B u+0079 ]]), 'Proprostnemluvesky-uyb24dma41a') end) test("Hebrew", function() assert_equal(pe(prepare[[ u+05DC u+05DE u+05D4 u+05D4 u+05DD u+05E4 u+05E9 u+05D5 u+05D8 u+05DC u+05D0 u+05DE u+05D3 u+05D1 u+05E8 u+05D9 u+05DD u+05E2 u+05D1 u+05E8 u+05D9 u+05EA ]]), '4dbcagdahymbxekheh6e0a7fei0b') end) test("Hindi (Devanagari)", function() assert_equal(pe(prepare[[ u+092F u+0939 u+0932 u+094B u+0917 u+0939 u+093F u+0928 u+094D u+0926 u+0940 u+0915 u+094D u+092F u+094B u+0902 u+0928 u+0939 u+0940 u+0902 u+092C u+094B u+0932 u+0938 u+0915 u+0924 u+0947 u+0939 u+0948 u+0902 ]]), 'i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd') end) test("Japanese (kanji and hiragana)", function() assert_equal(pe(prepare[[ u+306A u+305C u+307F u+3093 u+306A u+65E5 u+672C u+8A9E u+3092 u+8A71 u+3057 u+3066 u+304F u+308C u+306A u+3044 u+306E u+304B ]]), 'n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa') end) test("Korean (Hangul syllables)", function() assert_equal(pe(prepare[[ u+C138 u+ACC4 u+C758 u+BAA8 u+B4E0 u+C0AC u+B78C u+B4E4 u+C774 u+D55C u+AD6D u+C5B4 u+B97C u+C774 u+D574 u+D55C u+B2E4 u+BA74 u+C5BC u+B9C8 u+B098 u+C88B u+C744 u+AE4C ]]), '989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5jpsd879ccm6fea98c') end) test("Russian (Cyrillic)", function() assert_equal(pe(prepare[[ U+043F u+043E u+0447 u+0435 u+043C u+0443 u+0436 u+0435 u+043E u+043D u+0438 u+043D u+0435 u+0433 u+043E u+0432 u+043E u+0440 u+044F u+0442 u+043F u+043E u+0440 u+0443 u+0441 u+0441 u+043A u+0438 ]]), 'b1abfaaepdrnnbgefbadotcwatmq2g4l') end) test("Spanish", function() assert_equal(pe(prepare[[ U+0050 u+006F u+0072 u+0071 u+0075 u+00E9 u+006E u+006F u+0070 u+0075 u+0065 u+0064 u+0065 u+006E u+0073 u+0069 u+006D u+0070 u+006C u+0065 u+006D u+0065 u+006E u+0074 u+0065 u+0068 u+0061 u+0062 u+006C u+0061 u+0072 u+0065 u+006E U+0045 u+0073 u+0070 u+0061 u+00F1 u+006F u+006C ]]), 'PorqunopuedensimplementehablarenEspaol-fmd56a') end) test("Vietnamese", function() assert_equal(pe(prepare[[ U+0054 u+1EA1 u+0069 u+0073 u+0061 u+006F u+0068 u+1ECD u+006B u+0068 u+00F4 u+006E u+0067 u+0074 u+0068 u+1EC3 u+0063 u+0068 u+1EC9 u+006E u+00F3 u+0069 u+0074 u+0069 u+1EBF u+006E u+0067 U+0056 u+0069 u+1EC7 u+0074 ]]), 'TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g') end) test("3年B組金八先生", function() assert_equal(pe(prepare[[ u+0033 u+5E74 U+0042 u+7D44 u+91D1 u+516B u+5148 u+751F ]]), '3B-ww4c5e180e575a65lsy2b') end) test("安室奈美恵-with-SUPER-MONKEYS", function() assert_equal(pe(prepare[[ u+5B89 u+5BA4 u+5948 u+7F8E u+6075 u+002D u+0077 u+0069 u+0074 u+0068 u+002D U+0053 U+0055 U+0050 U+0045 U+0052 u+002D U+004D U+004F U+004E U+004B U+0045 U+0059 U+0053 ]]), '-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n') end) test("Hello-Another-Way-それぞれの場所", function() assert_equal(pe(prepare[[ U+0048 u+0065 u+006C u+006C u+006F u+002D U+0041 u+006E u+006F u+0074 u+0068 u+0065 u+0072 u+002D U+0057 u+0061 u+0079 u+002D u+305D u+308C u+305E u+308C u+306E u+5834 u+6240 ]]), 'Hello-Another-Way--fc4qua05auwb3674vfr0b') end) test("ひとつ屋根の下2", function() assert_equal(pe(prepare[[ u+3072 u+3068 u+3064 u+5C4B u+6839 u+306E u+4E0B u+0032 ]]), '2-u9tlzr9756bt3uc0v') end) test("MajiでKoiする5秒前", function() assert_equal(pe(prepare[[ U+004D u+0061 u+006A u+0069 u+3067 U+004B u+006F u+0069 u+3059 u+308B u+0035 u+79D2 u+524D ]]), 'MajiKoi5-783gue6qz075azm5e') end) test("パフィーdeルンバ", function() assert_equal(pe(prepare[[ u+30D1 u+30D5 u+30A3 u+30FC u+0064 u+0065 u+30EB u+30F3 u+30D0 ]]), 'de-jg4avhby1noc0d') end) test("そのスピードで", function() assert_equal(pe(prepare[[ u+305D u+306E u+30B9 u+30D4 u+30FC u+30C9 u+3067 ]]), 'd9juau41awczczp') end) test("-> $1.00 <-", function() assert_equal(pe(prepare[[ u+002D u+003E u+0020 u+0024 u+0031 u+002E u+0030 u+0030 u+0020 u+003C u+002D ]]), '-> $1.00 <--') end) end) context("Decoding", function() test("Arabic (Egyptian)", function() assert_equal(pd('egbpdaj6bu4bxfgehfvwxn'), prepare[[ u+0644 u+064A u+0647 u+0645 u+0627 u+0628 u+062A u+0643 u+0644 u+0645 u+0648 u+0634 u+0639 u+0631 u+0628 u+064A u+061F ]]) end) test("Chinese (simplified)", function() assert_equal(pd('ihqwcrb4cv8a8dqg056pqjye'), prepare[[ u+4ED6 u+4EEC u+4E3A u+4EC0 u+4E48 u+4E0D u+8BF4 u+4E2D u+6587 ]]) end) test("Chinese (traditional)", function() assert_equal(pd('ihqwctvzc91f659drss3x8bo0yb'), prepare[[ u+4ED6 u+5011 u+7232 u+4EC0 u+9EBD u+4E0D u+8AAA u+4E2D u+6587 ]]) end) test("Czech", function() assert_equal(pd('Proprostnemluvesky-uyb24dma41a'), prepare[[ U+0050 u+0072 u+006F u+010D u+0070 u+0072 u+006F u+0073 u+0074 u+011B u+006E u+0065 u+006D u+006C u+0075 u+0076 u+00ED u+010D u+0065 u+0073 u+006B u+0079 ]]) end) test("Hebrew", function() assert_equal(pd('4dbcagdahymbxekheh6e0a7fei0b'), prepare[[ u+05DC u+05DE u+05D4 u+05D4 u+05DD u+05E4 u+05E9 u+05D5 u+05D8 u+05DC u+05D0 u+05DE u+05D3 u+05D1 u+05E8 u+05D9 u+05DD u+05E2 u+05D1 u+05E8 u+05D9 u+05EA ]]) end) test("Hindi (Devanagari)", function() assert_equal(pd('i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd'), prepare[[ u+092F u+0939 u+0932 u+094B u+0917 u+0939 u+093F u+0928 u+094D u+0926 u+0940 u+0915 u+094D u+092F u+094B u+0902 u+0928 u+0939 u+0940 u+0902 u+092C u+094B u+0932 u+0938 u+0915 u+0924 u+0947 u+0939 u+0948 u+0902 ]]) end) test("Japanese (kanji and hiragana)", function() assert_equal(pd('n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa'), prepare[[ u+306A u+305C u+307F u+3093 u+306A u+65E5 u+672C u+8A9E u+3092 u+8A71 u+3057 u+3066 u+304F u+308C u+306A u+3044 u+306E u+304B ]]) end) test("Korean (Hangul syllables)", function() assert_equal(pd('989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5jpsd879ccm6fea98c'), prepare[[ u+C138 u+ACC4 u+C758 u+BAA8 u+B4E0 u+C0AC u+B78C u+B4E4 u+C774 u+D55C u+AD6D u+C5B4 u+B97C u+C774 u+D574 u+D55C u+B2E4 u+BA74 u+C5BC u+B9C8 u+B098 u+C88B u+C744 u+AE4C ]]) end) test("Russian (Cyrillic)", function() assert_equal(pd('b1abfaaepdrnnbgefbaDotcwatmq2g4l'), prepare[[ U+043F u+043E u+0447 u+0435 u+043C u+0443 u+0436 u+0435 u+043E u+043D u+0438 u+043D u+0435 u+0433 u+043E u+0432 u+043E u+0440 u+044F u+0442 u+043F u+043E u+0440 u+0443 u+0441 u+0441 u+043A u+0438 ]]) end) test("Spanish", function() assert_equal(pd('PorqunopuedensimplementehablarenEspaol-fmd56a'), prepare[[ U+0050 u+006F u+0072 u+0071 u+0075 u+00E9 u+006E u+006F u+0070 u+0075 u+0065 u+0064 u+0065 u+006E u+0073 u+0069 u+006D u+0070 u+006C u+0065 u+006D u+0065 u+006E u+0074 u+0065 u+0068 u+0061 u+0062 u+006C u+0061 u+0072 u+0065 u+006E U+0045 u+0073 u+0070 u+0061 u+00F1 u+006F u+006C ]]) end) test("Vietnamese", function() assert_equal(pd('TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g'), prepare[[ U+0054 u+1EA1 u+0069 u+0073 u+0061 u+006F u+0068 u+1ECD u+006B u+0068 u+00F4 u+006E u+0067 u+0074 u+0068 u+1EC3 u+0063 u+0068 u+1EC9 u+006E u+00F3 u+0069 u+0074 u+0069 u+1EBF u+006E u+0067 U+0056 u+0069 u+1EC7 u+0074 ]]) end) test("3年B組金八先生", function() assert_equal(pd('3B-ww4c5e180e575a65lsy2b'), prepare[[ u+0033 u+5E74 U+0042 u+7D44 u+91D1 u+516B u+5148 u+751F ]]) end) test("安室奈美恵-with-SUPER-MONKEYS", function() assert_equal(pd('-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n'), prepare[[ u+5B89 u+5BA4 u+5948 u+7F8E u+6075 u+002D u+0077 u+0069 u+0074 u+0068 u+002D U+0053 U+0055 U+0050 U+0045 U+0052 u+002D U+004D U+004F U+004E U+004B U+0045 U+0059 U+0053 ]]) end) test("Hello-Another-Way-それぞれの場所", function() assert_equal(pd('Hello-Another-Way--fc4qua05auwb3674vfr0b'), prepare[[ U+0048 u+0065 u+006C u+006C u+006F u+002D U+0041 u+006E u+006F u+0074 u+0068 u+0065 u+0072 u+002D U+0057 u+0061 u+0079 u+002D u+305D u+308C u+305E u+308C u+306E u+5834 u+6240 ]]) end) test("ひとつ屋根の下2", function() assert_equal(pd('2-u9tlzr9756bt3uc0v'), prepare[[ u+3072 u+3068 u+3064 u+5C4B u+6839 u+306E u+4E0B u+0032 ]]) end) test("MajiでKoiする5秒前", function() assert_equal(pd('MajiKoi5-783gue6qz075azm5e'), prepare[[ U+004D u+0061 u+006A u+0069 u+3067 U+004B u+006F u+0069 u+3059 u+308B u+0035 u+79D2 u+524D ]]) end) test("パフィーdeルンバ", function() assert_equal(pd('de-jg4avhby1noc0d'), prepare[[ u+30D1 u+30D5 u+30A3 u+30FC u+0064 u+0065 u+30EB u+30F3 u+30D0 ]]) end) test("そのスピードで", function() assert_equal(pd('d9juau41awczczp'), prepare[[ u+305D u+306E u+30B9 u+30D4 u+30FC u+30C9 u+3067 ]]) end) test("-> $1.00 <-", function() assert_equal(pd('-> $1.00 <--'), prepare[[ u+002D u+003E u+0020 u+0024 u+0031 u+002E u+0030 u+0030 u+0020 u+003C u+002D ]]) end) end) context("Hyphens", function() test("first letter first label", function() assert_nil(ie'-example') end) test("first letter second label", function() assert_nil(ie'www.-example') end) test("last letter first label", function() assert_nil(ie'example-') end) test("last letter second label", function() assert_nil(ie'www.example-') end) test("second letter first label", function() assert_equal(ie'e-xample', 'e-xample') end) test("second letter second label", function() assert_equal(ie'www.e-xample', 'www.e-xample') end) test("second last letter first label", function() assert_equal(ie'exampl-e', 'exampl-e') end) test("second last letter second label", function() assert_equal(ie'www.exampl-e', 'www.exampl-e') end) end) end)
-- SIE CONFIDENTIAL -- PhyreEngine(TM) Package 3.18.0.0 -- Copyright (C) 2016 Sony Interactive Entertainment Inc. -- All Rights Reserved. --PhyrePersistentContext -- Script to provide a simple default implementation of the functionality -- required to drive a PCameraControllerComponent. g_lastCameraDirection = {} g_cameraMode = {} -- Description: -- Updates the camera transformation based on the target object. -- Arguments: -- app: The game application. -- controller: The PCameraControllerComponent the script is attached to. local function updateFollow(app, controller) if (nil ~= controller.m_followTarget) then local elapsedTime = app:getElapsedTime() local matrix = controller.m_followTarget:getMatrix() local targetDirection = matrix[2] local characterPosition = controller.m_characterController:getCurrentPosition() controller.m_followPhysics:setTargetDistance(8.0) controller.m_followPhysics:setTargetHeight(3.0 - characterPosition.y) controller.m_followPhysics:update(characterPosition, targetDirection, elapsedTime) controller:setPosition(controller.m_followPhysics:getCameraPosition()) controller:lookAt(controller.m_followPhysics:getCameraTarget()) g_lastCameraDirection = controller.m_followPhysics:getCameraTarget() - controller.m_followPhysics:getCameraPosition(); end end -- Description: -- Updates the camera transformation based on the target object. -- Arguments: -- app: The game application. -- controller: The PCameraControllerComponent the script is attached to. local function updateFollowFixed(app, controller) if (nil ~= controller.m_followTarget) then local elapsedTime = app:getElapsedTime() local matrix = controller.m_followTarget:getMatrix() local targetPosition = matrix[3] local characterPosition = controller.m_characterController:getCurrentPosition() controller.m_followPhysics:setTargetDistance(5.0) controller.m_followPhysics:setTargetHeight(5.0 - characterPosition.y) controller.m_followPhysics:update(targetPosition, g_lastCameraDirection, elapsedTime) controller:setPosition(controller.m_followPhysics:getCameraPosition()) controller:lookAt(controller.m_followPhysics:getCameraTarget()) end end -- Description: -- Switches to the next camera type. local function nextCameraMode(controller) g_cameraMode = g_cameraMode + 1 if (g_cameraMode >= 3) then g_cameraMode = 0 end if (g_cameraMode == 0) then -- Manual. controller.m_characterController:suspendScript(); elseif (g_cameraMode == 1) then -- Follow. controller.m_characterController:resumeScript(); elseif (g_cameraMode == 2) then -- Follow at fixed distance. controller.m_characterController:resumeScript(); end end -- Description: -- PCameraControllerComponent script function called on play. -- Arguments: -- controller - The PCameraControllerComponent the script is attached to. function OnLoad(controller) local app = Phyre.PApplication.GetApplicationForScript() local translation = controller:getEntity():getWorldMatrix():getMatrix()[3] g_cameraMode = 1 if (app:getPlatformId() == "GLES" or app:getPlatformId() == "AGL2" or app:getPlatformId() == "IOS") then g_cameraMode = 0 end g_lastCameraDirection = Vector(0,0,1,0) controller:setPosition(translation) controller.m_followPhysics:setCameraPosition(translation) end -- Description: -- PCameraControllerComponent script function called each frame. -- Arguments: -- controller - The PCameraControllerComponent the script is attached to. function OnUpdate(controller) local app = Phyre.PApplication.GetApplicationForScript() local forwards = app:getInputToggled("SWITCH_CAMERA") if (forwards == true) then nextCameraMode(controller) end g_lastCameraChange = forwards; if (g_cameraMode == 0) then app:updateCamera(controller.m_controller, app:getElapsedTime(), 1.0, 1.0) elseif (g_cameraMode == 1) then updateFollow(app, controller) elseif (g_cameraMode == 2) then updateFollowFixed(app, controller) end end
local nonil = require 'without-check-nil' local m = {} function m.client() nonil.enable() local name = m.info.clientInfo.name nonil.disable() return name end function m.init(t) m.info = t end return m
--file for all settings for this program limit = 5 --number of rows to display per query --spacing for resource output id_spacing = 6 name_spacing = 15 type_spacing = 35 attribute_spacing = 6
WarningComposition = WarningComposition or {} function WarningComposition.Create(_ARG_0_, _ARG_1_) local L2_2 = WarningComposition.CreateWarningComposition(_ARG_0_, _ARG_1_) return L2_2 end Game.ImportLibrary("gui/scripts/sprites_texturesplashlegal.lua") function WarningComposition.CreateWarningComposition(_ARG_0_, _ARG_1_) local container = GUI.CreateDisplayObjectEx(_ARG_0_, "CDisplayObjectContainer", {}) local child = nil child = GUI.CreateDisplayObjectEx("Background", "CSprite", { X = "0.00000", Y = "0.00000", SizeX = "1.60000", SizeY = "1.42222", ScaleX = "1.00000", ScaleY = "1.00000", Angle = "0.00000", Enabled = true, Autosize = true, BlendMode = "AlphaBlend", USelMode = "Scale", VSelMode = "Scale", Image = "gui/textures/texturesplashlegal.bctex"}) container:AddChild(child) child = GUI.CreateDisplayObjectEx("PressALabel", "CLabel", {X = "0.35", Y = "0.72", SizeX = "0.4", SizeY = "0.1", ScaleX = "1.00000", ScaleY = "1.00000", Angle = "0.00000", Enabled = true, Text = "Press A to continue", Font = "digital_medium", TextAlignment = "Centered", Autosize = true, Outline = false, BlinkColorR = "1.00000", BlinkColorG = "1.00000", BlinkColorB = "1.00000", Blink = "0.80000" }) container:AddChild(child) GUI.SetHierarchyProperties(container, _ARG_1_) return container end
local utility = {} function utility.PrintTable1(vecDatas) print("lua table elements:") for tKey, tValue in pairs(vecDatas) do print("\t "..tKey.." => "..tValue) end end function utility.PrintTable2(vecDatas) print("lua table elements:"..#vecDatas) for i=1,#vecDatas do for j=1,#vecDatas[i] do print(i..j.." => "..vecDatas[i][j]) end end end function utility.tablelength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end local function camelCase(s) return string.gsub(s, "_%w+", function(word) local first = string.sub(word, 2, 2) local rest = string.sub(word, 3) return string.upper(first) .. rest end) end function utility.CamelCase(s) local camel = camelCase(s) --print("camel:"..camel) return (camel:gsub("^%l", string.upper)) end --- Check if a file or directory exists in this path local function exists(file) local ok, err, code = os.rename(file, file) if not ok then if code == 13 then -- Permission denied, but it exists return true end end return ok, err end --- Check if a directory exists in this path local function isdir(path) -- "/" works on both Unix and Windows return exists(path.."/") end function utility.createDirIfNotExists(path) if isdir(path) then return end os.execute("mkdir " .. path) end return utility
print("[server]init", SERVER_ID, WORKER_ID) package.path = "?;?.lua;lua/?;lua/?.lua" if WORKER_ID ~= 0 then error("[server]only sys can run init.lua") end local sys = "lua/sys/sys.lua" for i = 1, 3 do server.fork(sys); end dofile(sys)
werewolf_howl = class(AbilityBaseClass) ---------------------------------------- LinkLuaModifier( "modifier_werewolf_howl_aura", "modifiers/modifier_werewolf_howl_aura", LUA_MODIFIER_MOTION_NONE ) LinkLuaModifier( "modifier_werewolf_howl_aura_effect", "modifiers/modifier_werewolf_howl_aura_effect", LUA_MODIFIER_MOTION_NONE ) ---------------------------------------- function werewolf_howl:OnSpellStart() local caster = self:GetCaster() caster:EmitSound("LycanBoss.Howl") local nFXIndex = ParticleManager:CreateParticle( "particles/units/heroes/hero_lycan/lycan_howl_cast.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster ) ParticleManager:SetParticleControlEnt( nFXIndex, 1, caster, PATTACH_POINT_FOLLOW, "attach_mouth", caster:GetOrigin(), true ) ParticleManager:ReleaseParticleIndex( nFXIndex ) caster:AddNewModifier( caster, self, "modifier_werewolf_howl_aura", { duration = self:GetSpecialValueFor( "duration" ) } ) end ----------------------------------------
require "Items/WorldFiller" overlayMap["location_shop_generic_01_96"] = {gunstore = {"weapons_01_0", "weapons_01_8"}, ammomakerroom = {"weapons_01_0", "weapons_01_8"}, other = {"books&misc_01_88", "books&misc_01_96"}} overlayMap["location_shop_generic_01_97"] = {gunstore = {"weapons_01_1", "weapons_01_9"}, ammomakerroom = {"weapons_01_1", "weapons_01_9"}, other = {"books&misc_01_89", "books&misc_01_97"}} overlayMap["location_shop_generic_01_98"] = {gunstore = {"weapons_01_2", "weapons_01_10"}, ammomakerroom = {"weapons_01_2", "weapons_01_10"}, other = {"books&misc_01_90", "books&misc_01_98"}} overlayMap["location_shop_generic_01_99"] = {gunstore = {"weapons_01_3", "weapons_01_11"}, ammomakerroom = {"weapons_01_3", "weapons_01_11"}, other = {"books&misc_01_91", "books&misc_01_99"}} overlayMap["location_shop_generic_01_100"] = {gunstore = {"weapons_01_4", "weapons_01_12"}, ammomakerroom = {"weapons_01_4", "weapons_01_12"}, other = {"books&misc_01_92", "books&misc_01_100"}} overlayMap["location_shop_generic_01_101"] = {gunstore = {"weapons_01_5", "weapons_01_13"}, ammomakerroom = {"weapons_01_5", "weapons_01_13"}, other = {"books&misc_01_93", "books&misc_01_101"}} overlayMap["location_shop_generic_01_102"] = {gunstore = {"weapons_01_6", "weapons_01_14"}, ammomakerroom = {"weapons_01_6", "weapons_01_14"}, other = {"books&misc_01_94", "books&misc_01_102"}} overlayMap["location_shop_generic_01_103"] = {gunstore = {"weapons_01_7", "weapons_01_15"}, ammomakerroom = {"weapons_01_7", "weapons_01_15"}, other = {"books&misc_01_95", "books&misc_01_103"}} overlayMap["furniture_shelving_01_24"] = {mcgunstorestorage = {"ammo_01_14", "ammo_01_15"}, mcgunstore = {"ammo_01_14", "ammo_01_15"}, ammomakerroom = {"ammo_01_14", "ammo_01_15"}, trainingcamp = {"ammo_01_14", "ammo_01_15"}, other = {"books&misc_01_24", "books&misc_01_28"}} overlayMap["furniture_shelving_01_25"] = {mcgunstorestorage = {"ammo_01_17", "ammo_01_16"}, mcgunstore = {"ammo_01_17", "ammo_01_16"}, ammomakerroom = {"ammo_01_17", "ammo_01_16"}, trainingcamp = {"ammo_01_17", "ammo_01_16"}, other = {"books&misc_01_25", "books&misc_01_29"}} overlayMap["furniture_shelving_01_26"] = {mcgunstorestorage = {"ammo_01_21", "ammo_01_20"}, mcgunstore = {"ammo_01_21", "ammo_01_20"}, ammomakerroom = {"ammo_01_21", "ammo_01_20"}, trainingcamp = {"ammo_01_21", "ammo_01_20"}, other = {"books&misc_01_26", "books&misc_01_30"}} overlayMap["furniture_shelving_01_27"] = {mcgunstorestorage = {"ammo_01_19", "ammo_01_18"}, mcgunstore = {"ammo_01_19", "ammo_01_18"}, ammomakerroom = {"ammo_01_19", "ammo_01_18"}, trainingcamp = {"ammo_01_19", "ammo_01_18"}, other = {"books&misc_01_27", "books&misc_01_31"}}
//NS2 Reserved Slot local ReservedPlayers = { } local disconnectclients = { } local lastpasswordupdate = 0 local lastdisconnect = 0 local reserveslotactionslog = { } local serverlockstatus = false local ReservedPlayersFileName = "config://ReservedPlayers.json" local function LoadReservedPlayers() ReservedPlayers = DAK:LoadConfigFile(ReservedPlayersFileName) or { } end LoadReservedPlayers() local function SaveReservedPlayers() DAK:SaveConfigFile(ReservedPlayersFileName, ReservedPlayers) end local function DisconnectClientForReserveSlot(client) Server.DisconnectClient(client) end function GetReserveSlotPlayerData() local returnData = { } if ReservedPlayers then returnData.amount = DAK.config.reservedslots.kReservedSlots returnData.ids = { } for r = 1, #ReservedPlayers do local ReservePlayer = ReservedPlayers[r] table.insert(returnData.ids, { name = ReservePlayer.name, id = ReservePlayer.id }) end end return returnData end local function CheckReserveSlotForID(ns2ID, silent) for r = #ReservedPlayers, 1, -1 do local ReservePlayer = ReservedPlayers[r] if ReservePlayer.id == ns2ID then // Check if enough time has passed on a temporary reserve slot. if not silent then table.insert(reserveslotactionslog, "Reserve Slot check for " .. tostring(ReservePlayer.name) .. " - id: " .. tostring(ReservePlayer.id)) end local now = Shared.GetSystemTime() if ReservePlayer.time ~= 0 and now > ReservePlayer.time then return false else return true end end end //Also Check standard reserve slot system local reservedSlots = Server.GetConfigSetting("reserved_slots") if reservedSlots and reservedSlots.ids then local newPlayerIsReserved = false for name, id in pairs(reservedSlots.ids) do if id == ns2ID then return true end end end return false end local function CheckReserveStatus(client, silent) if client:GetIsVirtual() then //Bots dont get reserve slot return false end if DAK:GetClientCanRunCommand(client, "sv_hasreserve") then if not silent then table.insert(reserveslotactionslog, "Reserved Slot Entry For - id: " .. tostring(client:GetUserId()) .. " - Is Valid") ServerAdminPrint(client, "Reserved Slot Entry For - id: " .. tostring(client:GetUserId()) .. " - Is Valid") end return true end if CheckReserveSlotForID(client:GetUserId(), silent) then if not silent then ServerAdminPrint(client, "Reserved Slot Entry For " .. tostring(name) .. " - id: " .. tostring(id) .. " - Is Valid") end return true end return false end local function CheckOccupiedReserveSlots() //check for current number of occupied reserveslots local reserveCount = 0 local playerList = DAK:GetPlayerList() for r = #playerList, 1, -1 do if playerList[r] ~= nil then local plyr = playerList[r] local clnt = Server.GetOwner(playerList[r]) if plyr ~= nil and clnt ~= nil then if CheckReserveStatus(clnt, true) then reserveCount = reserveCount + 1 end end if reserveCount >= DAK.config.reservedslots.kReservedSlots then reserveCount = DAK.config.reservedslots.kReservedSlots break end end end return reserveCount end local function UpdateServerLockStatus() if DAK.config.reservedslots.kReservePassword ~= "" then local MaxPlayers = Server.GetMaxPlayers() local CurPlayers = Server.GetNumPlayers() if MaxPlayers - (CurPlayers - CheckOccupiedReserveSlots()) <= (DAK.config.reservedslots.kReservedSlots + DAK.config.reservedslots.kMinimumSlots) then if not serverlockstatus then table.insert(reserveslotactionslog, string.format("Locking Server at %s of %s players at %s.", CurPlayers, MaxPlayers, DAK:GetDateTimeString(false))) end Server.SetPassword(DAK.config.reservedslots.kReservePassword) serverlockstatus = true elseif MaxPlayers - (CurPlayers - CheckOccupiedReserveSlots()) > (DAK.config.reservedslots.kReservedSlots + DAK.config.reservedslots.kMinimumSlots) then if serverlockstatus then table.insert(reserveslotactionslog, string.format("Unlocking Server at %s of %s players at %s.", CurPlayers, MaxPlayers, DAK:GetDateTimeString(false))) end Server.SetPassword("") serverlockstatus = false end end end local function CheckReserveSlotSync() if #disconnectclients > 0 then for r = #disconnectclients, 1, -1 do if disconnectclients[r] ~= nil and DAK:VerifyClient(disconnectclients[r].clnt) and disconnectclients[r].disctime < Shared.GetTime() then DisconnectClientForReserveSlot(disconnectclients[r].clnt) table.remove(disconnectclients, r) end end end if lastdisconnect ~= 0 and Shared.GetTime() > lastdisconnect then UpdateServerLockStatus() lastdisconnect = 0 end if (Shared.GetTime() - lastpasswordupdate) >= 10 then UpdateServerLockStatus() lastpasswordupdate = Shared.GetTime() end end DAK:RegisterEventHook("OnServerUpdate", CheckReserveSlotSync, 5, "reserveslots") local function OnReserveSlotClientConnected(client) local MaxPlayers = Server.GetMaxPlayers() local CurPlayers = Server.GetNumPlayers() local serverFull = MaxPlayers - (CurPlayers - CheckOccupiedReserveSlots()) < (DAK.config.reservedslots.kReservedSlots + DAK.config.reservedslots.kMinimumSlots) local serverReallyFull = MaxPlayers - CurPlayers < DAK.config.reservedslots.kMinimumSlots local reserved = CheckReserveStatus(client, false) UpdateServerLockStatus() if serverFull and not reserved then DAK:DisplayMessageToClient(client, "ReserveSlotServerFull") table.insert(reserveslotactionslog, "Kicking player " .. tostring(client:GetUserId()) .. " for no reserve slot.") DAK:ExecutePluginGlobalFunction("enhancedlogging", EnhancedLogMessage, "Kicking player " .. tostring(client:GetUserId()) .. " for no reserve slot.") client.disconnectreason = DAK.config.reservedslots.kReserveSlotServerFullDisconnectReason table.insert(disconnectclients, {clnt = client, disctime = Shared.GetTime() + DAK.config.reservedslots.kDelayedKickTime}) return true end if serverReallyFull and reserved then local playertokick local connectiontime = 0 local playerList = DAK:GetPlayerList() for r = #playerList, 1, -1 do if playerList[r] ~= nil then local plyr = playerList[r] local clnt = Server.GetOwner(playerList[r]) if plyr ~= nil and clnt ~= nil then local clntconntime = DAK:GetClientConnectionTime(clnt) if (clntconntime <= connectiontime or connectiontime == 0) and not plyr:GetIsCommander() and not CheckReserveStatus(clnt, true) then connectiontime = clntconntime playertokick = plyr end end end end if playertokick ~= nil then local kickclient = Server.GetOwner(playertokick) local ns2id = kickclient:GetUserId() table.insert(reserveslotactionslog, "Kicking player " .. tostring(playertokick.name) .. " - id: " .. tostring(ns2id) .. " with connection time: " .. tostring(connectiontime)) DAK:ExecutePluginGlobalFunction("enhancedlogging", EnhancedLogMessage, "Kicking player " .. tostring(playertokick.name) .. " - id: " .. tostring(ns2id) .. " with connection time: " .. tostring(connectiontime)) DAK:DisplayMessageToClient(ns2id, "ReserveSlotKickedForRoom") playertokick.disconnectreason = "Kicked due to a reserved slot." table.insert(disconnectclients, {clnt = kickclient, disctime = Shared.GetTime() + DAK.config.reservedslots.kDelayedKickTime}) else table.insert(reserveslotactionslog, "Attempted to kick player but no valid player could be located") DAK:ExecutePluginGlobalFunction("enhancedlogging", EnhancedLogMessage, "Attempted to kick player but no valid player could be located") end end end DAK:RegisterEventHook("OnClientConnect", OnReserveSlotClientConnected, 6, "reserveslots") local function ReserveSlotClientDisconnect(client) lastdisconnect = Shared.GetTime() + DAK.config.reservedslots.kDelayedSyncTime end DAK:RegisterEventHook("OnClientDisconnect", ReserveSlotClientDisconnect, 5, "reserveslots") local function AddReservePlayer(client, parm1, parm2, parm3, parm4) local idNum = tonumber(parm2) if idNum == nil then idNum = DAK:GetNS2IDFromSteamID(parm2) end local exptime = tonumber(parm4) if parm1 and idNum then LoadReservedPlayers() local ReservePlayer = { name = ToString(parm1), id = idNum, reason = ToString(parm3 or ""), time = ConditionalValue(exptime, exptime, 0) } table.insert(ReservedPlayers, ReservePlayer) DAK:PrintToAllAdmins("sv_addreserve", client, ToString(parm1) .. ToString(parm2) .. ToString(parm3) .. ToString(parm4)) if client ~= nil then DAK:DisplayMessageToClient(client, "ReserveSlotGranted", ToString(idNum)) end SaveReservedPlayers() end end DAK:CreateServerAdminCommand("Console_sv_addreserve", AddReservePlayer, "<name> <player id> <reason> <time> Will add a reserve player to the list.") DAK:CreateServerAdminCommand("Console_sv_add_reserved_slot", AddReservePlayer, "<name> <player id> To support webadmin reserve slots.") local function RemoveReservePlayer(client, id) local idNum = tonumber(id) if idNum == nil then idNum = DAK:GetNS2IDFromSteamID(id) end if idNum then LoadReservedPlayers() for r = #ReservedPlayers, 1, -1 do local ReservePlayer = ReservedPlayers[r] if ReservePlayer.id == idNum then table.remove(ReservedPlayers, r) end end SaveReservedPlayers() end end DAK:CreateServerAdminCommand("Console_sv_removereserve", RemoveReservePlayer, "<player id> Will remove a reserve player from the list.") DAK:CreateServerAdminCommand("Console_sv_remove_reserved_slot", RemoveReservePlayer, "<player id> To support webadmin reserve slots.") local function DebugReserveSlots(client) for r = 1, #reserveslotactionslog, 1 do if reserveslotactionslog[r] ~= nil then ServerAdminPrint(client, reserveslotactionslog[r]) end end end DAK:CreateServerAdminCommand("Console_sv_reservedebug", DebugReserveSlots, "Will print messages logged during actions taken by reserve slot plugin.") local function ListReserveSlots(client) ServerAdminPrint(client, string.format("This server will hold %s slots open", (DAK.config.reservedslots.kReservedSlots + DAK.config.reservedslots.kMinimumSlots))) end DAK:CreateServerAdminCommand("Console_sv_reserveslots", ListReserveSlots, "Will provide the number of reserved slots on the server.", true) local function OnCheckConnectionAllowed(userId) local newPlayerIsReserved = false if DAK:GetNS2IDCanRunCommand(userId, "sv_hasreserve") then newPlayerIsReserved = true end if CheckReserveSlotForID(userId, true) then newPlayerIsReserved = true end local MaxPlayers = Server.GetMaxPlayers() local CurPlayers = Server.GetNumPlayers() + 1 //To account for yourself connecting. local serverFull = MaxPlayers - (CurPlayers - CheckOccupiedReserveSlots()) < (DAK.config.reservedslots.kReservedSlots + DAK.config.reservedslots.kMinimumSlots) if not serverFull or newPlayerIsReserved then return true end return false end //Dislike this local originalNS2EventHook = Event.Hook function Event.Hook(event, func) if event ~= "CheckConnectionAllowed" then return originalNS2EventHook(event, func) else return originalNS2EventHook(event, OnCheckConnectionAllowed) end end local function UpdateReserveSlotTag() local tags = { } Server.GetTags(tags) for t = 1, #tags do if string.find(tags[t], "R_S") then Server.RemoveTag(tags[t]) end end Server.AddTag("R_S" .. (DAK.config.reservedslots.kReservedSlots + DAK.config.reservedslots.kMinimumSlots)) end UpdateReserveSlotTag()
local WIM = WIM; -- imports local _G = _G; local table = table; local type = type; local string = string; local pairs = pairs; -- set namespace setfenv(1, WIM); constants.classes = {}; local classes = constants.classes; local classList = { "Druid", "Hunter", "Mage", "Paladin", "Priest", "Rogue", "Shaman", "Warlock", "Warrior", "Death Knight", "Monk", "Demon Hunter" }; constants.classListEng = classList; local GetNumSpecializationsForClassID, GetSpecializationInfoForClassID = _G.GetNumSpecializationsForClassID, _G.GetSpecializationInfoForClassID local function createSpecNameTable(classID) local t = {} if not isShadowlands then return t end for spec = 1, GetNumSpecializationsForClassID(classID) do local specID, name = GetSpecializationInfoForClassID(classID,spec) t[spec] = name end return t end --Male Classes - this doesn't apply to every locale classes[L["Druid"]] = { color = "ff7d0a", tag = "DRUID", talent = createSpecNameTable(11) }; classes[L["Hunter"]] = { color = "abd473", tag = "HUNTER", talent = createSpecNameTable(3) }; classes[L["Mage"]] = { color = "69ccf0", tag = "MAGE", talent = createSpecNameTable(8) }; classes[L["Paladin"]] = { color = "f58cba", tag = "PALADIN", talent = createSpecNameTable(2) }; classes[L["Priest"]] = { color = "ffffff", tag = "PRIEST", talent = createSpecNameTable(5) }; classes[L["Rogue"]] = { color = "fff569", tag = "ROGUE", talent = createSpecNameTable(4) }; classes[L["Shaman"]] = { color = "2459FF", tag = "SHAMAN", talent = createSpecNameTable(7) }; classes[L["Warlock"]] = { color = "9482ca", tag = "WARLOCK", talent = createSpecNameTable(9) }; classes[L["Warrior"]] = { color = "c79c6e", tag = "WARRIOR", talent = createSpecNameTable(1) }; classes[L["Death Knight"]] = { color = "c41f3b", tag = "DEATHKNIGHT", talent = createSpecNameTable(6) }; classes[L["Monk"]] = { color = "00ff96", tag = "MONK", talent = createSpecNameTable(10) }; classes[L["Demon Hunter"]] = { color = "a330c9", tag = "DEMONHUNTER", talent = createSpecNameTable(12) }; classes[L["Game Master"]] = { color = "00c0ff", tag = "GM", talent = {"", "", ""} -- talent place holder }; -- propigate female class types and update tags appropriately for i=1, table.getn(classList) do if(L[classList[i]] ~= L[classList[i].."F"]) then classes[L[classList[i].."F"]] = { color = classes[L[classList[i]]].color, tag = classes[L[classList[i]]].tag.."F" }; end end classes.GetClassByTag = function(t) for class, tbl in pairs(classes) do if(type(tbl) == "table") then if(tbl.tag == t) then return class; end end end -- can't find tag, before returning blank, see we're being asked for a female class, then try again. local ft = string.gsub(t, "(F)$", ""); if( ft == t) then return "" else return classes.GetClassByTag(ft); end end function classes.GetMyColoredName() local name = _G.UnitName("player"); local class, englishClass = _G.UnitClass("player"); local classColorTable = _G.RAID_CLASS_COLORS[englishClass]; return string.format("\124cff%.2x%.2x%.2x", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255)..name.."\124r" end function classes.GetColoredNameByChatEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) if(arg12 and arg12 ~= "") then local type = _G.strsplit("-", arg12 or "") if type ~= "Player" then return arg2 end--Blizzard didn't return a valid guid, so abort class colors local localizedClass, englishClass, localizedRace, englishRace, sex = _G.GetPlayerInfoByGUID(arg12) if ( englishClass ) then local classColorTable = _G.RAID_CLASS_COLORS[englishClass]; if ( not classColorTable ) then return arg2; end return string.format("\124cff%.2x%.2x%.2x", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255)..arg2.."\124r" else return arg2; end else return arg2; end end
--- 模块功能:Luat协程调度框架 --module(..., package.seeall) local sys = {} local table = _G.table local unpack = table.unpack local rtos = _G.rtos local coroutine = _G.coroutine local log = _G.log -- lib脚本版本号,只要lib中的任何一个脚本做了修改,都需要更新此版本号 SCRIPT_LIB_VER = "1.0.0" -- TaskID最大值 local TASK_TIMER_ID_MAX = 0x1FFFFF -- msgId 最大值(请勿修改否则会发生msgId碰撞的危险) local MSG_TIMER_ID_MAX = 0x7FFFFF -- 任务定时器id local taskTimerId = 0 -- 消息定时器id local msgId = TASK_TIMER_ID_MAX -- 定时器id表 local timerPool = {} local taskTimerPool = {} --消息定时器参数表 local para = {} --定时器是否循环表 --local loop = {} --lua脚本运行出错时,是否回退为本地烧写的版本 --local sRollBack = true _G.COROUTINE_ERROR_ROLL_BACK = true _G.COROUTINE_ERROR_RESTART = true -- 对coroutine.resume加一个修饰器用于捕获协程错误 local rawcoresume = coroutine.resume sys.coresume = function(...) function wrapper(co,...) local arg = {...} if not arg[1] then local traceBack = debug.traceback(co) traceBack = (traceBack and traceBack~="") and (arg[2].."\r\n"..traceBack) or arg[2] log.error("coroutine.resume",traceBack) if errDump and type(errDump.appendErr)=="function" then errDump.appendErr(traceBack) end if _G.COROUTINE_ERROR_ROLL_BACK then sys.timerStart(assert,500,false,traceBack) elseif _G.COROUTINE_ERROR_RESTART then rtos.reboot() end end return ... end local arg = {...} return wrapper(arg[1], rawcoresume(...)) end --- Task任务延时函数,只能用于任务函数中 -- @number ms 整数,最大等待126322567毫秒 -- @return 定时结束返回nil,被其他线程唤起返回调用线程传入的参数 -- @usage sys.wait(30) function sys.wait(ms) -- 参数检测,参数不能为负值 --assert(ms > 0, "The wait time cannot be negative!") -- 选一个未使用的定时器ID给该任务线程 while true do if taskTimerId >= TASK_TIMER_ID_MAX - 1 then taskTimerId = 0 else taskTimerId = taskTimerId + 1 end if taskTimerPool[taskTimerId] == nil then break end end local timerid = taskTimerId taskTimerPool[coroutine.running()] = timerid timerPool[timerid] = coroutine.running() -- 调用core的rtos定时器 if 1 ~= rtos.timer_start(timerid, ms) then log.debug("rtos.timer_start error") return end -- 挂起调用的任务线程 local message = {coroutine.yield()} if #message ~= 0 then rtos.timer_stop(timerid) taskTimerPool[coroutine.running()] = nil timerPool[timerid] = nil return unpack(message) end end --- Task任务的条件等待函数(包括事件消息和定时器消息等条件),只能用于任务函数中。 -- @param id 消息ID -- @number ms 等待超时时间,单位ms,最大等待126322567毫秒 -- @return result 接收到消息返回true,超时返回false -- @return data 接收到消息返回消息参数 -- @usage result, data = sys.waitUntil("SIM_IND", 120000) function sys.waitUntil(id, ms) sys.subscribe(id, coroutine.running()) local message = ms and {sys.wait(ms)} or {coroutine.yield()} sys.unsubscribe(id, coroutine.running()) return message[1] ~= nil, unpack(message, 2, #message) end --- Task任务的条件等待函数扩展(包括事件消息和定时器消息等条件),只能用于任务函数中。 -- @param id 消息ID -- @number ms 等待超时时间,单位ms,最大等待126322567毫秒 -- @return message 接收到消息返回message,超时返回false -- @return data 接收到消息返回消息参数 -- @usage result, data = sys.waitUntilExt("SIM_IND", 120000) function sys.waitUntilExt(id, ms) sys.subscribe(id, coroutine.running()) local message = ms and {sys.wait(ms)} or {coroutine.yield()} sys.unsubscribe(id, coroutine.running()) if message[1] ~= nil then return unpack(message) end return false end --- 创建一个任务线程,在模块最末行调用该函数并注册模块中的任务函数,main.lua导入该模块即可 -- @param fun 任务函数名,用于resume唤醒时调用 -- @param ... 任务函数fun的可变参数 -- @return co 返回该任务的线程号 -- @usage sys.taskInit(task1,'a','b') function sys.taskInit(fun, ...) local co = coroutine.create(fun) sys.coresume(co, ...) return co end ------------------------------------------ rtos消息回调处理部分 ------------------------------------------ --[[ 函数名:cmpTable 功能 :比较两个table的内容是否相同,注意:table中不能再包含table 参数 : t1:第一个table t2:第二个table 返回值:相同返回true,否则false ]] local function cmpTable(t1, t2) if not t2 then return #t1 == 0 end if #t1 == #t2 then for i = 1, #t1 do if unpack(t1, i, i) ~= unpack(t2, i, i) then return false end end return true end return false end --- 关闭定时器 -- @param val 值为number时,识别为定时器ID,值为回调函数时,需要传参数 -- @param ... val值为函数时,函数的可变参数 -- @return 无 -- @usage timerStop(1) function sys.timerStop(val, ...) -- val 为定时器ID if type(val) == 'number' then timerPool[val], para[val] = nil rtos.timer_stop(val) else for k, v in pairs(timerPool) do -- 回调函数相同 if type(v) == 'table' and v.cb == val or v == val then -- 可变参数相同 if cmpTable({...}, para[k]) then rtos.timer_stop(k) timerPool[k], para[k] = nil break end end end end end --- 关闭同一回调函数的所有定时器 -- @param fnc 定时器回调函数 -- @return 无 -- @usage timerStopAll(cbFnc) function sys.timerStopAll(fnc) for k, v in pairs(timerPool) do if type(v) == "table" and v.cb == fnc or v == fnc then rtos.timer_stop(k) timerPool[k], para[k] = nil end end end function sys.timerAdvStart(fnc, ms, _repeat, ...) --回调函数和时长检测 --assert(fnc ~= nil, "sys.timerStart(first param) is nil !") --assert(ms > 0, "sys.timerStart(Second parameter) is <= zero !") -- 关闭完全相同的定时器 local arg = {...} if #arg == 0 then sys.timerStop(fnc) else sys.timerStop(fnc, ...) end -- 为定时器申请ID,ID值 1-20 留给任务,20-30留给消息专用定时器 while true do if msgId >= MSG_TIMER_ID_MAX then msgId = TASK_TIMER_ID_MAX end msgId = msgId + 1 if timerPool[msgId] == nil then timerPool[msgId] = fnc break end end --调用底层接口启动定时器 if rtos.timer_start(msgId, ms, _repeat) ~= 1 then return end --如果存在可变参数,在定时器参数表中保存参数 if #arg ~= 0 then para[msgId] = arg end --返回定时器id return msgId end --- 开启一个定时器 -- @param fnc 定时器回调函数 -- @number ms 整数,最大定时126322567毫秒 -- @param ... 可变参数 fnc的参数 -- @return number 定时器ID,如果失败,返回nil function sys.timerStart(fnc, ms, ...) return sys.timerAdvStart(fnc, ms, 0, ...) end --- 开启一个循环定时器 -- @param fnc 定时器回调函数 -- @number ms 整数,最大定时126322567毫秒 -- @param ... 可变参数 fnc的参数 -- @return number 定时器ID,如果失败,返回nil function sys.timerLoopStart(fnc, ms, ...) return sys.timerAdvStart(fnc, ms, -1, ...) end --- 判断某个定时器是否处于开启状态 -- @param val 有两种形式 --一种是开启定时器时返回的定时器id,此形式时不需要再传入可变参数...就能唯一标记一个定时器 --另一种是开启定时器时的回调函数,此形式时必须再传入可变参数...才能唯一标记一个定时器 -- @param ... 可变参数 -- @return number 开启状态返回true,否则nil function sys.timerIsActive(val, ...) if type(val) == "number" then return timerPool[val] else for k, v in pairs(timerPool) do if v == val then if cmpTable({...}, para[k]) then return true end end end end end ------------------------------------------ LUA应用消息订阅/发布接口 ------------------------------------------ -- 订阅者列表 local subscribers = {} --内部消息队列 local messageQueue = {} --- 订阅消息 -- @param id 消息id -- @param callback 消息回调处理 -- @usage subscribe("NET_STATUS_IND", callback) function sys.subscribe(id, callback) --if not id or type(id) == "boolean" or (type(callback) ~= "function" and type(callback) ~= "thread") then -- log.warn("warning: sys.subscribe invalid parameter", id, callback) -- return --end --log.debug("sys", "subscribe", id, callback) if type(id) == "table" then -- 支持多topic订阅 for _, v in pairs(id) do sys.subscribe(v, callback) end return end if not subscribers[id] then subscribers[id] = {} end subscribers[id][callback] = true end --- 取消订阅消息 -- @param id 消息id -- @param callback 消息回调处理 -- @usage unsubscribe("NET_STATUS_IND", callback) function sys.unsubscribe(id, callback) --if not id or type(id) == "boolean" or (type(callback) ~= "function" and type(callback) ~= "thread") then -- log.warn("warning: sys.unsubscribe invalid parameter", id, callback) -- return --end --log.debug("sys", "unsubscribe", id, callback) if type(id) == "table" then -- 支持多topic订阅 for _, v in pairs(id) do sys.unsubscribe(v, callback) end return end if subscribers[id] then subscribers[id][callback] = nil end -- 判断消息是否无其他订阅 log.info("abc", ">>>>>>>>>>>>>>>>>>") for k, _ in pairs(subscribers[id]) do return end subscribers[id] = nil end --- 发布内部消息,存储在内部消息队列中 -- @param ... 可变参数,用户自定义 -- @return 无 -- @usage publish("NET_STATUS_IND") function sys.publish(...) table.insert(messageQueue, {...}) end -- 分发消息 local function dispatch() while true do if #messageQueue == 0 then break end local message = table.remove(messageQueue, 1) if subscribers[message[1]] then for callback, _ in pairs(subscribers[message[1]]) do if type(callback) == "function" then callback(unpack(message, 2, #message)) elseif type(callback) == "thread" then sys.coresume(callback, unpack(message)) end end end end end -- rtos消息回调 --local handlers = {} --setmetatable(handlers, {__index = function() return function() end end, }) --- 注册rtos消息回调处理函数 -- @number id 消息类型id -- @param handler 消息处理函数 -- @return 无 -- @usage rtos.on(rtos.MSG_KEYPAD, function(param) handle keypad message end) --function sys.on(id, handler) -- handlers[id] = handler --end ------------------------------------------ Luat 主调度框架 ------------------------------------------ local function safeRun() -- 分发内部消息 dispatch() -- 阻塞读取外部消息 local msg, param, exparam = rtos.receive(rtos.INF_TIMEOUT) --log.info("sys", msg, param, exparam, tableNSize(timerPool), tableNSize(para), tableNSize(taskTimerPool), tableNSize(subscribers)) -- 空消息? if not msg or msg == 0 then -- 无任何操作 -- 判断是否为定时器消息,并且消息是否注册 elseif msg == rtos.MSG_TIMER and timerPool[param] then if param < TASK_TIMER_ID_MAX then local taskId = timerPool[param] timerPool[param] = nil if taskTimerPool[taskId] == param then taskTimerPool[taskId] = nil sys.coresume(taskId) end else local cb = timerPool[param] --如果不是循环定时器,从定时器id表中删除此定时器 if exparam == 0 then timerPool[param] = nil end if para[param] ~= nil then cb(unpack(para[param])) if exparam == 0 then para[param] = nil end else cb() end --如果是循环定时器,继续启动此定时器 --if loop[param] then rtos.timer_start(param, loop[param]) end end --其他消息(音频消息、充电管理消息、按键消息等) --elseif type(msg) == "number" then -- handlers[msg](param, exparam) --else -- handlers[msg.id](msg) end end --- run()从底层获取core消息并及时处理相关消息,查询定时器并调度各注册成功的任务线程运行和挂起 -- @return 无 -- @usage sys.run() function sys.run() --local result, err while true do --if sRollBack then safeRun() --else -- result, err = pcall(safeRun) -- if not result then rtos.restart(err) end --end end end _G.sys_pub = sys.publish return sys ----------------------------
dofile(ModPath .. "infcore.lua") if not InFmenu.settings.enablenewassaults then return end -- The . instead of a : is not a typo, this really is how they put it into the base game. -- And yes, this really is yet another "cops spawn with no team" crash. local coplogictravel_enter_orig = CopLogicTravel.enter function CopLogicTravel.enter(data, new_logic_name, enter_params) if not data.team then -- Calling movement:team() will also force-initialize the team if it doesn't exist yet data.team = data.unit:movement():team() end return coplogictravel_enter_orig(data, new_logic_name, enter_params) end
return { entities = { {"dry-tree", {x = -3.01, y = -2.51}, {}}, {"dry-hairy-tree", {x = -1.22, y = -2.98}, {}}, {"dry-hairy-tree", {x = 3.35, y = -2.68}, {}}, {"tree-06-brown", {x = -2.63, y = -0.2}, {}}, {"dry-tree", {x = 3.71, y = -0.57}, {}}, {"dry-tree", {x = -3.41, y = 3.3}, {}}, {"dead-dry-hairy-tree", {x = 2.76, y = 2.88}, {}}, }, tiles = { {"nuclear-ground", {x = -4, y = -1}}, {"nuclear-ground", {x = -4, y = 0}}, {"nuclear-ground", {x = -4, y = 1}}, {"nuclear-ground", {x = -4, y = 2}}, {"nuclear-ground", {x = -3, y = -3}}, {"nuclear-ground", {x = -3, y = -2}}, {"nuclear-ground", {x = -3, y = -1}}, {"nuclear-ground", {x = -3, y = 0}}, {"water-green", {x = -3, y = 1}}, {"nuclear-ground", {x = -3, y = 2}}, {"nuclear-ground", {x = -3, y = 3}}, {"nuclear-ground", {x = -2, y = -3}}, {"nuclear-ground", {x = -2, y = -2}}, {"nuclear-ground", {x = -2, y = -1}}, {"water-green", {x = -2, y = 0}}, {"water-green", {x = -2, y = 1}}, {"water-green", {x = -2, y = 2}}, {"nuclear-ground", {x = -2, y = 3}}, {"nuclear-ground", {x = -1, y = -3}}, {"nuclear-ground", {x = -1, y = -2}}, {"water-green", {x = -1, y = -1}}, {"water-green", {x = -1, y = 0}}, {"water-green", {x = -1, y = 1}}, {"water-green", {x = -1, y = 2}}, {"nuclear-ground", {x = -1, y = 3}}, {"nuclear-ground", {x = 0, y = -4}}, {"nuclear-ground", {x = 0, y = -3}}, {"water-green", {x = 0, y = -2}}, {"water-green", {x = 0, y = -1}}, {"water-green", {x = 0, y = 0}}, {"water-green", {x = 0, y = 1}}, {"water-green", {x = 0, y = 2}}, {"nuclear-ground", {x = 0, y = 3}}, {"nuclear-ground", {x = 1, y = -4}}, {"nuclear-ground", {x = 1, y = -3}}, {"water-green", {x = 1, y = -2}}, {"water-green", {x = 1, y = -1}}, {"water-green", {x = 1, y = 0}}, {"water-green", {x = 1, y = 1}}, {"water-green", {x = 1, y = 2}}, {"nuclear-ground", {x = 1, y = 3}}, {"nuclear-ground", {x = 2, y = -3}}, {"water-green", {x = 2, y = -2}}, {"water-green", {x = 2, y = -1}}, {"water-green", {x = 2, y = 0}}, {"water-green", {x = 2, y = 1}}, {"nuclear-ground", {x = 2, y = 2}}, {"nuclear-ground", {x = 2, y = 3}}, {"nuclear-ground", {x = 3, y = -2}}, {"nuclear-ground", {x = 3, y = -1}}, {"nuclear-ground", {x = 3, y = 0}}, {"nuclear-ground", {x = 3, y = 1}}, {"nuclear-ground", {x = 3, y = 2}}, } }
local EDITOR = {} local function addEditor(name, callback) EDITOR[name] = function(...) net.Start("nutVendorEdit") net.WriteString(name) if (isfunction(callback)) then callback(...) end net.SendToServer() end end addEditor("name", function(name) net.WriteString(name) end) addEditor("desc", function(desc) net.WriteString(desc) end) addEditor("bubble", function(show) net.WriteBool(show) end) addEditor("mode", function(itemType, mode) if (not isnumber(mode)) then mode = nil end net.WriteString(itemType) net.WriteInt(mode or -1, 8) end) addEditor("price", function(itemType, price) net.WriteString(itemType) net.WriteInt(price or -1, 32) end) addEditor("stockDisable", function(itemType) net.WriteString(itemType) net.WriteUInt(0, 32) end) addEditor("stockMax", function(itemType, value) if (not isnumber(value)) then return end net.WriteString(itemType) net.WriteUInt(math.max(value, 1), 32) end) addEditor("stock", function(itemType, value) net.WriteString(itemType) net.WriteUInt(value, 32) end) addEditor("faction", function(factionID, allowed) net.WriteUInt(factionID, 8) net.WriteBool(allowed) end) addEditor("class", function(classID, allowed) net.WriteUInt(classID, 8) net.WriteBool(allowed) end) addEditor("model", function(model) net.WriteString(model) end) addEditor("useMoney", function(useMoney) net.WriteBool(useMoney) end) addEditor("money", function(value) if (isnumber(value)) then value = math.max(math.Round(value), 0) else value = nil end net.WriteInt(value or -1, 32) end) addEditor("scale", function(scale) net.WriteFloat(scale) end) return EDITOR
local __exports = LibStub:NewLibrary("ovale/scripts/ovale_mage_spells", 80300) if not __exports then return end __exports.registerMageSpells = function(OvaleScripts) local name = "ovale_mage_spells" local desc = "[9.0] Ovale: Mage spells" local code = [[Define(alexstraszas_fury 235870) # Dragon's Breath always critically strikes for s2 increased critical strike damage and contributes to Hot Streak. rnrnAdditionally, damage done by your next Pyroblast or Flamestrike is increased by 334277s1. SpellInfo(alexstraszas_fury cd=45 channel=0 gcd=0 offgcd=1 talent=alexstraszas_fury_talent) SpellAddBuff(alexstraszas_fury alexstraszas_fury=1) Define(ancestral_call 274738) # Invoke the spirits of your ancestors, granting you a random secondary stat for 15 seconds. SpellInfo(ancestral_call cd=120 duration=15 gcd=0 offgcd=1) SpellAddBuff(ancestral_call ancestral_call=1) Define(arcane_barrage 44425) # Launches bolts of arcane energy at the enemy target, causing (72.8 of Spell Power) Arcane damage. rnrnFor each Arcane Charge, deals 36032s2 additional damage?a321526[, grants you 321526s1 of your maximum mana,][]?a231564[ and hits 36032s3 additional nearby Ltarget:targets; for s2 of its damage][].rnrn|cFFFFFFFFConsumes all Arcane Charges.|r # Rank 3: Arcane Barrage grants you s1 of your maximum mana per Arcane Charge spent. SpellInfo(arcane_barrage cd=3) Define(arcane_blast 30451) # Blasts the target with energy, dealing (45.7 of Spell Power) Arcane damage.rnrnEach Arcane Charge increases damage by 36032s1 and mana cost by 36032s5, and reduces cast time by 36032s4.rnrn|cFFFFFFFFGenerates 1 Arcane Charge.|r SpellInfo(arcane_blast arcanecharges=-1) Define(arcane_charge_buff_0 36032) # @spelldesc114664 SpellInfo(arcane_charge_buff_0 max_stacks=4 gcd=0 offgcd=1) # Increases the damage of Arcane Blast, Arcane Missiles, Arcane Explosion, and Arcane Barrage by 36032w1.rnrnIncreases the mana cost of Arcane Blast by 36032w2?w5<0[, and reduces the cast time of Arcane Blast by w5.][.]rnrnIncreases the number of targets hit by Arcane Barrage for 50 damage by 36032w3. SpellAddBuff(arcane_charge_buff_0 arcane_charge_buff_0=1) Define(arcane_charge_buff_1 195302) SpellInfo(arcane_charge_buff_1 max_stacks=4 gcd=0 offgcd=1) # Increases the mana cost of Arcane Blast by 36032w2?w5<0[, and reduces the cast time of Arcane Blast by w5.][.]rnrnIncreases the number of targets hit by Arcane Barrage for 50 damage by 36032w3. SpellAddBuff(arcane_charge_buff_1 arcane_charge_buff_1=1) Define(arcane_explosion 1449) # Causes an explosion of magic around the caster, dealing (54.6 of Spell Power) Arcane damage to all enemies within A2 yards.?a137021[rnrn|cFFFFFFFFGenerates s1 Arcane Charge if any targets are hit.|r][] # Rank 2: Damage increased by s1. SpellInfo(arcane_explosion arcanecharges=-1) Define(arcane_familiar 205022) # Summon a Familiar that attacks your enemies and increases your maximum mana by 210126s1 for 3600 seconds. SpellInfo(arcane_familiar cd=10 duration=3600 talent=arcane_familiar_talent) SpellAddTargetDebuff(arcane_familiar arcane_familiar=1) Define(arcane_intellect 1459) # Infuses the target with brilliance, increasing their Intellect by s1 for 3600 seconds. rnrnIf target is in your party or raid, all party and raid members will be affected. SpellInfo(arcane_intellect duration=3600) # Intellect increased by w1. SpellAddTargetDebuff(arcane_intellect arcane_intellect=1) Define(arcane_missiles 5143) # Launches five waves of Arcane Missiles at the enemy over 2.5 seconds, causing a total of 5*(40.5 of Spell Power) Arcane damage. SpellInfo(arcane_missiles duration=2.5 channel=2.5 tick=0.625) SpellAddBuff(arcane_missiles arcane_missiles=1) SpellAddTargetDebuff(arcane_missiles arcane_missiles=1) Define(arcane_orb 153626) # Launches an Arcane Orb forward from your position, traveling up to 40 yards, dealing (109.2 of Spell Power) Arcane damage to enemies it passes through.rnrn|cFFFFFFFFGrants 1 Arcane Charge when cast and every time it deals damage.|r SpellInfo(arcane_orb cd=20 duration=2.5 arcanecharges=-1 talent=arcane_orb_talent) Define(arcane_power 12042) # For 10 seconds, you deal s1 more spell damage?a343208[ and your spells cost s2 less mana][]. # Rank 2: Arcane Power reduces your spells cost by 12042s2. SpellInfo(arcane_power cd=120 duration=10 gcd=0 offgcd=1) # Spell damage increased by w1.rn?a343208[Mana costs of your damaging spells reduced by w2.][] SpellAddBuff(arcane_power arcane_power=1) Define(bag_of_tricks 312411) # Pull your chosen trick from the bag and use it on target enemy or ally. Enemies take <damage> damage, while allies are healed for <healing>. SpellInfo(bag_of_tricks cd=90) Define(berserking 59621) # Permanently enchant a melee weapon to sometimes increase your attack power by 59620s1, but at the cost of reduced armor. Cannot be applied to items higher than level ecix SpellInfo(berserking gcd=0 offgcd=1) Define(blaster_master_buff 274597) # Scorch increases the damage the target takes from your Fire Blast by s1 for 30 seconds. SpellInfo(blaster_master_buff channel=-0.001 gcd=0 offgcd=1) Define(blizzard 190356) # Ice shards pelt the target area, dealing 190357m1*8 Frost damage over 8 seconds and reducing movement speed by 12486s1 for 3 seconds.?a236662[rnrnEach time Blizzard deals damage, the cooldown of Frozen Orb is reduced by 236662s1/100.1 sec.][] # Rank 3: Damage increased by s1. SpellInfo(blizzard cd=8 duration=8) Define(blood_fury_0 20572) # Increases your attack power by s1 for 15 seconds. SpellInfo(blood_fury_0 cd=120 duration=15 gcd=0 offgcd=1) # Attack power increased by w1. SpellAddBuff(blood_fury_0 blood_fury_0=1) Define(blood_fury_1 24571) # Instantly increases your rage by 300/10. SpellInfo(blood_fury_1 gcd=0 offgcd=1 rage=-30) Define(blood_fury_2 33697) # Increases your attack power and Intellect by s1 for 15 seconds. SpellInfo(blood_fury_2 cd=120 duration=15 gcd=0 offgcd=1) # Attack power and Intellect increased by w1. SpellAddBuff(blood_fury_2 blood_fury_2=1) Define(blood_fury_3 33702) # Increases your Intellect by s1 for 15 seconds. SpellInfo(blood_fury_3 cd=120 duration=15 gcd=0 offgcd=1) # Intellect increased by w1. SpellAddBuff(blood_fury_3 blood_fury_3=1) Define(blood_of_the_enemy_0 297969) # Infuse your Heart of Azeroth with Blood of the Enemy. SpellInfo(blood_of_the_enemy_0) Define(blood_of_the_enemy_1 297970) # Infuse your Heart of Azeroth with Blood of the Enemy. SpellInfo(blood_of_the_enemy_1) Define(blood_of_the_enemy_2 297971) # Infuse your Heart of Azeroth with Blood of the Enemy. SpellInfo(blood_of_the_enemy_2) Define(blood_of_the_enemy_3 299039) # Infuse your Heart of Azeroth with Blood of the Enemy. SpellInfo(blood_of_the_enemy_3) Define(brain_freeze_0 190447) # Frostbolt has a m1 chance to empower your next Flurry to be instant cast?a231584[,][ and] deal 190446s2 increased damage?a231584[, and apply Winter's Chill to the target. rnrnWinter's Chill causes the target to take damage from your spells as if it were frozen][]. SpellInfo(brain_freeze_0 channel=0 gcd=0 offgcd=1) SpellAddBuff(brain_freeze_0 brain_freeze_0=1) Define(brain_freeze_1 231584) # Brain Freeze causes your next Flurry to apply Winter's Chill to the target. rnrnWinter's Chill causes the target to take damage from your spells as if it were frozen. SpellInfo(brain_freeze_1 channel=0 gcd=0 offgcd=1) SpellAddBuff(brain_freeze_1 brain_freeze_1=1) Define(clearcasting_0 79684) # For each c*100/s1 mana you spend, you have a 1 chance to gain Clearcasting, making your next Arcane Missiles or Arcane Explosion free and channel 277726s1 faster.?a321758[rnrnArcane Missiles fires 321758s2 additional missile.][] SpellInfo(clearcasting_0 channel=0 gcd=0 offgcd=1) SpellAddBuff(clearcasting_0 clearcasting_0=1) Define(clearcasting_1 321420) # Clearcasting can stack up to s1 additional times. SpellInfo(clearcasting_1 channel=0 gcd=0 offgcd=1) SpellAddBuff(clearcasting_1 clearcasting_1=1) Define(clearcasting_2 321758) # When Clearcast, Arcane Missiles fires s2 additional lmissile:missiles;. SpellInfo(clearcasting_2 channel=0 gcd=0 offgcd=1) SpellAddBuff(clearcasting_2 clearcasting_2=1) Define(combustion 190319) # Engulfs you in flames for 10 seconds, increasing your spells' critical strike chance by s1 and granting you Mastery equal to s3 your Critical Strike stat. Castable while casting other spells. # Rank 2: Duration increased by s1/1000 sec. SpellInfo(combustion cd=120 duration=10 gcd=0 offgcd=1 tick=0.5) # Critical Strike chance of your spells increased by w1.?a231630[rnMastery increased by w2.][] SpellAddBuff(combustion combustion=1) Define(comet_storm 153595) # Calls down a series of 7 icy comets on and around the target, that deals up to 7*(40 of Spell Power) Frost damage to all enemies within 228601A1 yds of its impacts. SpellInfo(comet_storm cd=30 talent=comet_storm_talent) Define(concentrated_flame_0 295368) # Blast your target with a ball of concentrated flame, dealing 295365s2*(1+@versadmg) Fire damage to an enemy or healing an ally for 295365s2*(1+@versadmg)?a295377[, then burn the target for an additional 295377m1 of the damage or healing done over 6 seconds][]. rnrnEach cast of Concentrated Flame deals s3 increased damage or healing. This bonus resets after every third cast. SpellInfo(concentrated_flame_0 duration=6 channel=6 gcd=0 offgcd=1 tick=2) # Suffering w1 damage every t1 sec. SpellAddTargetDebuff(concentrated_flame_0 concentrated_flame_0=1) Define(concentrated_flame_1 295373) # Blast your target with a ball of concentrated flame, dealing 295365s2*(1+@versadmg) Fire damage to an enemy or healing an ally for 295365s2*(1+@versadmg)?a295377[, then burn the target for an additional 295377m1 of the damage or healing done over 6 seconds][]. rnrnEach cast of Concentrated Flame deals s3 increased damage or healing. This bonus resets after every third cast. SpellInfo(concentrated_flame_1 cd=30 channel=0) SpellAddTargetDebuff(concentrated_flame_1 concentrated_flame_3=1) Define(concentrated_flame_2 295374) # Blast your target with a ball of concentrated flame, dealing 295365s2*(1+@versadmg) Fire damage to an enemy or healing an ally for 295365s2*(1+@versadmg)?a295377[, then burn the target for an additional 295377m1 of the damage or healing done over 6 seconds][]. rnrnEach cast of Concentrated Flame deals s3 increased damage or healing. This bonus resets after every third cast. SpellInfo(concentrated_flame_2 channel=0 gcd=0 offgcd=1) Define(concentrated_flame_3 295376) # Blast your target with a ball of concentrated flame, dealing 295365s2*(1+@versadmg) Fire damage to an enemy or healing an ally for 295365s2*(1+@versadmg)?a295377[, then burn the target for an additional 295377m1 of the damage or healing done over 6 seconds][]. rnrnEach cast of Concentrated Flame deals s3 increased damage or healing. This bonus resets after every third cast. SpellInfo(concentrated_flame_3 channel=0 gcd=0 offgcd=1) Define(concentrated_flame_4 295380) # Concentrated Flame gains an enhanced appearance. SpellInfo(concentrated_flame_4 channel=0 gcd=0 offgcd=1) SpellAddBuff(concentrated_flame_4 concentrated_flame_4=1) Define(concentrated_flame_5 299349) # Blast your target with a ball of concentrated flame, dealing 295365s2*(1+@versadmg) Fire damage to an enemy or healing an ally for 295365s2*(1+@versadmg), then burn the target for an additional 295377m1 of the damage or healing done over 6 seconds.rnrnEach cast of Concentrated Flame deals s3 increased damage or healing. This bonus resets after every third cast. SpellInfo(concentrated_flame_5 cd=30 channel=0 gcd=1) SpellAddTargetDebuff(concentrated_flame_5 concentrated_flame_3=1) Define(concentrated_flame_6 299353) # Blast your target with a ball of concentrated flame, dealing 295365s2*(1+@versadmg) Fire damage to an enemy or healing an ally for 295365s2*(1+@versadmg), then burn the target for an additional 295377m1 of the damage or healing done over 6 seconds.rnrnEach cast of Concentrated Flame deals s3 increased damage or healing. This bonus resets after every third cast.rn|cFFFFFFFFMax s1 Charges.|r SpellInfo(concentrated_flame_6 cd=30 channel=0 gcd=1) SpellAddTargetDebuff(concentrated_flame_6 concentrated_flame_3=1) Define(conjure_mana_gem 759) # Conjures a Mana Gem that can be used to instantly restore 5405s1 mana, and holds up to s2 charges.rnrn@spellname118812rnConjured items disappear if logged out for more than 15 minutes. SpellInfo(conjure_mana_gem) Define(counterspell 2139) # Counters the enemy's spellcast, preventing any spell from that school of magic from being cast for 6 seconds?s12598[ and silencing the target for 55021d][]. SpellInfo(counterspell cd=24 duration=6 gcd=0 offgcd=1 interrupt=1) Define(deathborne 324220) # Transform into a powerful skeletal mage for 20 seconds. rnrnWhile in the form of a skeletal mage, your Frostbolt, Fireball, and Arcane Blast hit up to s4 enemies near your target and your spell damage is increased by s2. SpellInfo(deathborne cd=180 duration=20) # Transformed into a powerful skeletal mage, greatly enhancing your Frostbolt, Fireball, and Arcane Blast and increasing your spell damage by s2. SpellAddBuff(deathborne deathborne=1) Define(disciplinary_command 327371) # Casting a Frost, Fire and Arcane spell within 10 seconds of each other increases your Critical Strike damage of all your spells by 327371s1. This effect can only occur once every 327371s2 sec. SpellInfo(disciplinary_command cd=30 duration=20 gcd=0 offgcd=1) # Critical Strike damage increased by w1. SpellAddBuff(disciplinary_command disciplinary_command=1) Define(dragons_breath 31661) # Enemies in a cone in front of you take (58.25 of Spell Power) Fire damage and are disoriented for 4 seconds. Damage will cancel the effect. # Rank 2: Cooldown reduced by s1/-1000 sec. SpellInfo(dragons_breath cd=20 duration=4) # Disoriented. SpellAddTargetDebuff(dragons_breath dragons_breath=1) Define(ebonbolt 257537) # Launch a bolt of ice at the enemy, dealing (200 of Spell Power) Frost damage and granting you Brain Freeze. SpellInfo(ebonbolt cd=45 talent=ebonbolt_talent) Define(evocation 12051) # Increases your mana regeneration by s1 for 6 seconds. # Rank 2: Evocation's cooldown is reduced by s1. SpellInfo(evocation cd=180 duration=6 channel=6 tick=1) # Mana regeneration increased by s1. SpellAddBuff(evocation evocation=1) Define(expanded_potential_buff 327495) # Your Fireball, Frostbolt and Arcane Blast have a chance to give you Expanded Potential, which causes your next Hot Streak, Brain Freeze or Clearcasting to not be consumed. SpellInfo(expanded_potential_buff duration=300 gcd=0 offgcd=1) # Your next Hot Streak, Brain Freeze or Clearcasting will not be consumed. SpellAddBuff(expanded_potential_buff expanded_potential_buff=1) Define(fingers_of_frost 112965) # Frostbolt has a s1 chance and Frozen Orb damage has a s2 to grant a charge of Fingers of Frost.rnrnFingers of Frost causes your next Ice Lance to deal damage as if the target were frozen.rnrnMaximum 44544s1 charges. SpellInfo(fingers_of_frost channel=0 gcd=0 offgcd=1) SpellAddBuff(fingers_of_frost fingers_of_frost=1) SpellAddTargetDebuff(fingers_of_frost fingers_of_frost=1) Define(fire_blast 108853) # Blasts the enemy for (79.2 of Spell Power) Fire damage. rnrn|cFFFFFFFFFire:|r Castable while casting other spells.?a231568[ Always deals a critical strike.][] # Rank 2: Fire Blast always deals a critical strike. SpellInfo(fire_blast cd=0.5 charge_cd=12 gcd=0 offgcd=1) Define(fireball 133) # Throws a fiery ball that causes (65 of Spell Power) Fire damage.?a157642[rnrnEach time your Fireball fails to critically strike a target, it gains a stacking 157644s1 increased critical strike chance. Effect ends when Fireball critically strikes.][] # Rank 3: Increases Fireball damage by s1. SpellInfo(fireball) Define(fireblood_0 265221) # Removes all poison, disease, curse, magic, and bleed effects and increases your ?a162700[Agility]?a162702[Strength]?a162697[Agility]?a162698[Strength]?a162699[Intellect]?a162701[Intellect][primary stat] by 265226s1*3 and an additional 265226s1 for each effect removed. Lasts 8 seconds. ?s195710[This effect shares a 30 sec cooldown with other similar effects.][] SpellInfo(fireblood_0 cd=120 gcd=0 offgcd=1) Define(fireblood_1 265226) # Increases ?a162700[Agility]?a162702[Strength]?a162697[Agility]?a162698[Strength]?a162699[Intellect]?a162701[Intellect][primary stat] by s1. SpellInfo(fireblood_1 duration=8 max_stacks=6 gcd=0 offgcd=1) # Increases ?a162700[Agility]?a162702[Strength]?a162697[Agility]?a162698[Strength]?a162699[Intellect]?a162701[Intellect][primary stat] by w1. SpellAddBuff(fireblood_1 fireblood_1=1) Define(firestorm_buff 333100) # When Hot Streak activates, you have a low chance to cause all Pyroblasts and Flamestrikes to have no cast time and be guaranteed critical strikes for 5 seconds. SpellInfo(firestorm_buff duration=5 channel=5 gcd=0 offgcd=1) # Pyroblast and Flamestrike have no cast time and are guaranteed to critically strike. SpellAddBuff(firestorm_buff firestorm_buff=1) Define(flamestrike 2120) # Calls down a pillar of fire, burning all enemies within the area for (66.13 of Spell Power) Fire damage and reducing their movement speed by s2 for 8 seconds. # Rank 2: Flamestrike cast time is reduced by s1/-1000.1 sec. SpellInfo(flamestrike duration=8) # Movement speed slowed by s2. SpellAddTargetDebuff(flamestrike flamestrike=1) Define(flurry 44614) # Unleash a flurry of ice, striking the target s1 times for a total of (31.6 of Spell Power)*m1 Frost damage. Each hit reduces the target's movement speed by 228354s1 for 1 second.?a231584[rnrnWhile Brain Freeze is active, Flurry applies Winter's Chill, causing your target to take damage from your spells as if it were frozen.][] SpellInfo(flurry) Define(focused_azerite_beam_0 295258) # Focus excess Azerite energy into the Heart of Azeroth, then expel that energy outward, dealing m1*10 Fire damage to all enemies in front of you over 3 seconds.?a295263[ Castable while moving.][] SpellInfo(focused_azerite_beam_0 cd=90 duration=3 channel=3 tick=0.33) SpellAddBuff(focused_azerite_beam_0 focused_azerite_beam_0=1) SpellAddBuff(focused_azerite_beam_0 focused_azerite_beam_1=1) Define(focused_azerite_beam_1 295261) # Focus excess Azerite energy into the Heart of Azeroth, then expel that energy outward, dealing m1*10 Fire damage to all enemies in front of you over 3 seconds.?a295263[ Castable while moving.][] SpellInfo(focused_azerite_beam_1 cd=90) Define(focused_azerite_beam_2 299336) # Focus excess Azerite energy into the Heart of Azeroth, then expel that energy outward, dealing m1*10 Fire damage to all enemies in front of you over 3 seconds. SpellInfo(focused_azerite_beam_2 cd=90 duration=3 channel=3 tick=0.33) SpellAddBuff(focused_azerite_beam_2 focused_azerite_beam_0=1) SpellAddBuff(focused_azerite_beam_2 focused_azerite_beam_1=1) Define(focused_azerite_beam_3 299338) # Focus excess Azerite energy into the Heart of Azeroth, then expel that energy outward, dealing m1*10 Fire damage to all enemies in front of you over 3 seconds. Castable while moving. SpellInfo(focused_azerite_beam_3 cd=90 duration=3 channel=3 tick=0.33) SpellAddBuff(focused_azerite_beam_3 focused_azerite_beam_0=1) SpellAddBuff(focused_azerite_beam_3 focused_azerite_beam_1=1) Define(freezing_rain_buff 270232) # Frozen Orb makes Blizzard instant cast and increases its damage done by 270232s2 for 12 seconds. SpellInfo(freezing_rain_buff duration=12 gcd=0 offgcd=1) # Blizzard is instant cast and deals s2 increased damage. SpellAddBuff(freezing_rain_buff freezing_rain_buff=1) Define(freezing_winds 327478) # While Frozen Orb is active, you gain Fingers of Frost every 327478t1 sec. SpellInfo(freezing_winds duration=30 gcd=0 offgcd=1 tick=2) # Gaining Fingers of Frost every t1 sec. SpellAddBuff(freezing_winds freezing_winds=1) Define(frost_nova 122) # Blasts enemies within A2 yds of you for (4.4775 of Spell Power) Frost damage and freezes them in place for 8 seconds. Damage may interrupt the freeze effect. # Rank 2: Frost Nova duration is increased by s1/1000 sec. SpellInfo(frost_nova cd=30 duration=8) # Frozen in place?a333393[ and damage taken from @auracaster's Arcane and Fire spells increased by 333393s2][]. SpellAddTargetDebuff(frost_nova frost_nova=1) Define(frostbolt 116) # Launches a bolt of frost at the enemy, causing (51.1 of Spell Power) Frost damage and slowing movement speed by 205708s1 for 8 seconds. # Rank 2: Increases Frostbolt damage by s1. SpellInfo(frostbolt) Define(frozen 174955) # Deals m2 Frost damage, and Stuns targets for 30 seconds (8 sec PvP). SpellInfo(frozen duration=30 channel=30 gcd=0 offgcd=1) # Frozen. SpellAddTargetDebuff(frozen frozen=1) Define(frozen_orb 84714) # Launches an orb of swirling ice up to s1 yards forward which deals up to 20*(16.27 of Spell Power) Frost damage to 84721s2 enemies it passes through. Grants 1 charge of Fingers of Frost when it first damages an enemy.rnrnEnemies damaged by the Frozen Orb are slowed by 289308s1 for 3 seconds. SpellInfo(frozen_orb cd=60 duration=15 channel=15) Define(glacial_spike 199786) # Conjures a massive spike of ice, and merges your current Icicles into it. It impales your target, dealing (297 of Spell Power) damage plus all of the damage stored in your Icicles, and freezes the target in place for 4 seconds. Damage may interrupt the freeze effect.rnrnRequires 5 Icicles to cast.rnrn|cFFFFFFFFPassive:|r Ice Lance no longer launches Icicles. SpellInfo(glacial_spike talent=glacial_spike_talent) # Frozen in place. SpellAddBuff(glacial_spike glacial_spike=1) Define(gladiators_badge_0 277185) # Increases primary stat by s1 for 15 seconds.rn SpellInfo(gladiators_badge_0 cd=120 duration=15 channel=15 gcd=0 offgcd=1) # Primary stat increased by s4. SpellAddBuff(gladiators_badge_0 gladiators_badge_0=1) Define(gladiators_badge_1 345228) # Increases primary stat by s1 for 15 seconds.rn SpellInfo(gladiators_badge_1 cd=120 duration=15 channel=15 gcd=0 offgcd=1) # Primary stat increased by s1. SpellAddBuff(gladiators_badge_1 gladiators_badge_1=1) Define(guardian_of_azeroth_0 295840) # Call upon Azeroth to summon a Guardian of Azeroth for 30 seconds who impales your target with spikes of Azerite every s1/10.1 sec that deal 295834m1*(1+@versadmg) Fire damage.?a295841[ Every 303347t1 sec, the Guardian launches a volley of Azerite Spikes at its target, dealing 295841s1 Fire damage to all nearby enemies.][]?a295843[rnrnEach time the Guardian of Azeroth casts a spell, you gain 295855s1 Haste, stacking up to 295855u times. This effect ends when the Guardian of Azeroth despawns.][]rn SpellInfo(guardian_of_azeroth_0 cd=180 duration=30) SpellAddBuff(guardian_of_azeroth_0 guardian_of_azeroth_0=1) Define(guardian_of_azeroth_1 295855) # Each time the Guardian of Azeroth casts a spell, you gain 295855s1 Haste, stacking up to 295855u times. This effect ends when the Guardian of Azeroth despawns. SpellInfo(guardian_of_azeroth_1 duration=60 max_stacks=5 gcd=0 offgcd=1) # Haste increased by s1. SpellAddBuff(guardian_of_azeroth_1 guardian_of_azeroth_1=1) Define(guardian_of_azeroth_2 299355) # Call upon Azeroth to summon a Guardian of Azeroth for 30 seconds who impales your target with spikes of Azerite every 295840s1/10.1 sec that deal 295834m1*(1+@versadmg)*(1+(295836m1/100)) Fire damage. Every 303347t1 sec, the Guardian launches a volley of Azerite Spikes at its target, dealing 295841s1 Fire damage to all nearby enemies. SpellInfo(guardian_of_azeroth_2 cd=180 duration=30 gcd=1) SpellAddBuff(guardian_of_azeroth_2 guardian_of_azeroth_2=1) Define(guardian_of_azeroth_3 299358) # Call upon Azeroth to summon a Guardian of Azeroth for 30 seconds who impales your target with spikes of Azerite every 295840s1/10.1 sec that deal 295834m1*(1+@versadmg)*(1+(295836m1/100)) Fire damage. Every 303347t1 sec, the Guardian launches a volley of Azerite Spikes at its target, dealing 295841s1 Fire damage to all nearby enemies.rnrnEach time the Guardian of Azeroth casts a spell, you gain 295855s1 Haste, stacking up to 295855u times. This effect ends when the Guardian of Azeroth despawns. SpellInfo(guardian_of_azeroth_3 cd=180 duration=20 gcd=1) SpellAddBuff(guardian_of_azeroth_3 guardian_of_azeroth_3=1) Define(guardian_of_azeroth_4 300091) # Call upon Azeroth to summon a Guardian of Azeroth to aid you in combat for 30 seconds. SpellInfo(guardian_of_azeroth_4 cd=300 duration=30 gcd=1) Define(guardian_of_azeroth_5 303347) SpellInfo(guardian_of_azeroth_5 gcd=0 offgcd=1 tick=8) Define(heating_up 48107) # Scored a spell critical. A second spell critical in a row will make your next Pyroblast or Flamestrike spell instant cast, and cause double the normal Ignite damage. SpellInfo(heating_up duration=10 channel=10 max_stacks=2 gcd=0 offgcd=1) # Scored a spell critical. A second spell critical in a row will make your next Pyroblast or Flamestrike spell instant cast, and cause double the normal Ignite damage. SpellAddBuff(heating_up heating_up=1) Define(hot_streak 195283) # Getting two direct-damage critical strikes in a row with Fire spells will make your next Pyroblast or Flamestrike spell instant cast, and cause double the normal Ignite damage. SpellInfo(hot_streak channel=0 max_stacks=1 gcd=0 offgcd=1) # Your next Pyroblast or Flamestrike spell is instant cast, and causes double the normal Ignite damage. SpellAddBuff(hot_streak hot_streak=1) Define(ice_floes 108839) # Makes your next Mage spell with a cast time shorter than s2 sec castable while moving. Unaffected by the global cooldown and castable while casting. SpellInfo(ice_floes cd=20 duration=15 max_stacks=3 gcd=0 offgcd=1 talent=ice_floes_talent) # Able to move while casting spells. SpellAddBuff(ice_floes ice_floes=1) Define(ice_lance 30455) # Quickly fling a shard of ice at the target, dealing (42 of Spell Power) Frost damage?s56377[, and (42 of Spell Power)*56377m2/100 Frost damage to a second nearby target][].rnrnIce Lance damage is tripled against frozen targets. # Rank 2: Increases Ice Lance damage by s1. SpellInfo(ice_lance) Define(ice_nova 157997) # Causes a whirl of icy wind around the enemy, dealing (180 of Spell Power) Frost damage to the target and reduced damage to all other enemies within a2 yards, and freezing them in place for 2 seconds. SpellInfo(ice_nova cd=25 duration=2 talent=ice_nova_talent) # Frozen. SpellAddTargetDebuff(ice_nova ice_nova=1) Define(icy_veins 12472) # Accelerates your spellcasting for 20 seconds, granting m1 haste and preventing damage from delaying your spellcasts. # Rank 2: Duration increased by s1/1000 sec. SpellInfo(icy_veins cd=180 duration=20 gcd=0 offgcd=1) # Haste increased by w1 and immune to pushback. SpellAddBuff(icy_veins icy_veins=1) Define(ignite 12654) # Your target burns for an additional (75 of Spell Power).1 over 9 seconds of the total direct damage caused by your Fireball, Fire Blast, Scorch, Pyroblast?s153561[, Meteor][]?s257541[, Phoenix Flames][]?s198929[, Cinderstorm][], and Flamestrike. If this effect is reapplied, any remaining damage will be added to the new Ignite.rnrnPhoenix Flames causes your Ignites to spread to s4 nearby enemies. SpellInfo(ignite duration=9 channel=9 gcd=0 offgcd=1 tick=1) # Deals w1 Fire damage every t1 sec.?w3>0[rnMovement speed reduced by w3.][] SpellAddTargetDebuff(ignite ignite=1) Define(infernal_cascade 336832) # While Combustion is active, your Fire Blast grants you |cFFFFFFFFs1.1 |r increased Fire damage for 5 seconds, stacking up to 336832u times. SpellInfo(infernal_cascade duration=5 max_stacks=2 gcd=0 offgcd=1) # Fire Damage increased by w1. SpellAddBuff(infernal_cascade infernal_cascade=1) Define(lights_judgment 255647) # Call down a strike of Holy energy, dealing <damage> Holy damage to enemies within A1 yards after 3 sec. SpellInfo(lights_judgment cd=150) Define(living_bomb 44457) # The target becomes a Living Bomb, taking 217694o1 Fire damage over 4 seconds, and then exploding to deal an additional (14.000000000000002 of Spell Power) Fire damage to the target and reduced damage to all other enemies within 44461A2 yards.rnrnOther enemies hit by this explosion also become a Living Bomb, but this effect cannot spread further. SpellInfo(living_bomb cd=12 talent=living_bomb_talent) # Causes w1 Fire damage every t1 sec. After d, the target explodes, causing w2 Fire damage to the target and all other enemies within 44461A2 yards?w3>0[, and spreading Living Bomb][]. SpellAddBuff(living_bomb living_bomb=1) Define(memory_of_lucid_dreams_0 299300) # Infuse your Heart of Azeroth with Memory of Lucid Dreams. SpellInfo(memory_of_lucid_dreams_0) Define(memory_of_lucid_dreams_1 299302) # Infuse your Heart of Azeroth with Memory of Lucid Dreams. SpellInfo(memory_of_lucid_dreams_1) Define(memory_of_lucid_dreams_2 299304) # Infuse your Heart of Azeroth with Memory of Lucid Dreams. SpellInfo(memory_of_lucid_dreams_2) Define(meteor 153561) # Calls down a meteor which lands at the target location after 3 seconds, dealing (260 of Spell Power) Fire damage, split evenly between all targets within 8 yards, and burns the ground, dealing 8*(8.25 of Spell Power) Fire damage over 8.5 seconds to all enemies in the area. SpellInfo(meteor cd=45 talent=meteor_talent) Define(mirror_image 55342) # Creates s2 copies of you nearby for 40 seconds, which cast spells and attack your enemies.rnrnWhile your images are active damage taken is reduced by s3, taking direct damage will cause one of your images to dissipate. SpellInfo(mirror_image cd=120 duration=40) # Damage taken is reduced by s3 while your images are active. SpellAddBuff(mirror_image mirror_image=1) Define(mirrors_of_torment 314793) # Conjure n mirrors to torment the enemy for 25 seconds. Whenever the target attacks, casts a spell, or uses an ability, a mirror is consumed to inflict (60 of Spell Power) Shadow damage and their movement and cast speed are slowed by 320035s3. This effect cannot be triggered more often than once per 6 seconds.rnrnThe final mirror will instead inflict (151 of Spell Power) Shadow damage to the enemy, Rooting and Silencing them for 4 seconds.rnrnWhenever a mirror is consumed ?c1[you gain 345417s1 mana][]?c2[your Fire Blast cooldown is reduced by s2 sec][]?c3[you gain Brain Freeze][]. SpellInfo(mirrors_of_torment cd=90 duration=25) # Attacking, casting a spell or ability, consumes a mirror to inflict Shadow damage and reduce cast and movement speed by 320035s3. rnrnYour final mirror will instead Root and Silence you for 317589d. SpellAddTargetDebuff(mirrors_of_torment mirrors_of_torment=1) Define(nether_tempest 114923) # Places a Nether Tempest on the target which deals 114923o1 Arcane damage over 12 seconds to the target and nearby enemies within 10 yards. Limit 1 target. Deals reduced damage to secondary targets.rnrnDamage increased by 36032s1 per Arcane Charge. SpellInfo(nether_tempest duration=12 tick=1 talent=nether_tempest_talent) # Deals w1 Arcane damage and an additional w1 Arcane damage to all enemies within 114954A1 yards every t sec. SpellAddTargetDebuff(nether_tempest nether_tempest=1) Define(phoenix_flames 257541) # Hurls a Phoenix that deals (90 of Spell Power) Fire damage to the target and reduced damage to other nearby enemies. # Rank 2: Phoenix Flames gains s1 additional charge. SpellInfo(phoenix_flames cd=25) Define(presence_of_mind 205025) # Causes your next n Arcane Blasts to be instant cast. # Rank 2: Arcane Blast can be cast instantly s1 additional time. SpellInfo(presence_of_mind cd=60 gcd=0 offgcd=1) # Arcane Blast is instant cast. SpellAddBuff(presence_of_mind presence_of_mind=1) Define(purifying_blast_0 295337) # Call down a purifying beam upon the target area, dealing 295293s3*(1+@versadmg)*s2 Fire damage over 6 seconds.?a295364[ Has a low chance to immediately annihilate any specimen deemed unworthy by MOTHER.][]?a295352[rnrnWhen an enemy dies within the beam, your damage is increased by 295354s1 for 8 seconds.][]rnrnAny Aberration struck by the beam is stunned for 3 seconds. SpellInfo(purifying_blast_0 cd=60 duration=6) Define(purifying_blast_1 295338) # Call down a purifying beam upon the target area, dealing 295293s3*(1+@versadmg)*s2 Fire damage over 6 seconds.?a295364[ Has a low chance to immediately annihilate any specimen deemed unworthy by MOTHER.][]?a295352[rnrnWhen an enemy dies within the beam, your damage is increased by 295354s1 for 8 seconds.][]rnrnAny Aberration struck by the beam is stunned for 3 seconds. SpellInfo(purifying_blast_1 channel=0 gcd=0 offgcd=1) Define(purifying_blast_2 295354) # When an enemy dies within the beam, your damage is increased by 295354s1 for 8 seconds. SpellInfo(purifying_blast_2 duration=8 gcd=0 offgcd=1) # Damage dealt increased by s1. SpellAddBuff(purifying_blast_2 purifying_blast_2=1) Define(purifying_blast_3 295366) # Call down a purifying beam upon the target area, dealing 295293s3*(1+@versadmg)*s2 Fire damage over 6 seconds.?a295364[ Has a low chance to immediately annihilate any specimen deemed unworthy by MOTHER.][]?a295352[rnrnWhen an enemy dies within the beam, your damage is increased by 295354s1 for 8 seconds.][]rnrnAny Aberration struck by the beam is stunned for 3 seconds. SpellInfo(purifying_blast_3 duration=3 gcd=0 offgcd=1) # Stunned. SpellAddTargetDebuff(purifying_blast_3 purifying_blast_3=1) Define(purifying_blast_4 299345) # Call down a purifying beam upon the target area, dealing 295293s3*(1+@versadmg)*s2 Fire damage over 6 seconds. Has a low chance to immediately annihilate any specimen deemed unworthy by MOTHER.?a295352[rnrnWhen an enemy dies within the beam, your damage is increased by 295354s1 for 8 seconds.][]rnrnAny Aberration struck by the beam is stunned for 3 seconds. SpellInfo(purifying_blast_4 cd=60 duration=6 channel=6 gcd=1) Define(purifying_blast_5 299347) # Call down a purifying beam upon the target area, dealing 295293s3*(1+@versadmg)*s2 Fire damage over 6 seconds. Has a low chance to immediately annihilate any specimen deemed unworthy by MOTHER.rnrnWhen an enemy dies within the beam, your damage is increased by 295354s1 for 8 seconds.rnrnAny Aberration struck by the beam is stunned for 3 seconds. SpellInfo(purifying_blast_5 cd=60 duration=6 gcd=1) Define(pyroblast 11366) # Hurls an immense fiery boulder that causes (136.3 of Spell Power) Fire damage?a321711[ and an additional 321712o2 Fire damage over 6 seconds][]. # Rank 2: Deals an additional 321712o2 Fire damage over 6 seconds. SpellInfo(pyroblast) Define(pyroclasm 269650) # Consuming Hot Streak has a s1 chance to make your next non-instant Pyroblast cast within 15 seconds deal 269651s1 additional damage.rnrnMaximum 269651u stacks. SpellInfo(pyroclasm channel=0 gcd=0 offgcd=1 talent=pyroclasm_talent) SpellAddBuff(pyroclasm pyroclasm=1) Define(quaking_palm 107079) # Strikes the target with lightning speed, incapacitating them for 4 seconds, and turns off your attack. SpellInfo(quaking_palm cd=120 duration=4 gcd=1) # Incapacitated. SpellAddTargetDebuff(quaking_palm quaking_palm=1) Define(radiant_spark 307443) # Conjure a radiant spark that causes (76 of Spell Power) Arcane damage instantly, and an additional o2 damage over 10 seconds.rnrnThe target takes 307454s1 increased damage from your direct damage spells, stacking each time they are struck. This effect ends after 307454u spells.rn SpellInfo(radiant_spark cd=30 duration=10 interrupt=1 tick=2) # Damage taken from @auracaster increased by w1. SpellAddBuff(radiant_spark radiant_spark_vulnerability=1) # Suffering w2 Arcane damage every t2 sec. SpellAddTargetDebuff(radiant_spark radiant_spark=1) Define(radiant_spark_vulnerability 307454) # Conjure a radiant spark that causes (76 of Spell Power) Arcane damage instantly, and an additional o2 damage over 10 seconds.rnrnThe target takes 307454s1 increased damage from your direct damage spells, stacking each time they are struck. This effect ends after 307454u spells.rn SpellInfo(radiant_spark_vulnerability duration=8 max_stacks=4 gcd=0 offgcd=1) # Damage taken from @auracaster increased by w1. SpellAddTargetDebuff(radiant_spark_vulnerability radiant_spark_vulnerability=1) Define(ray_of_frost 205021) # Channel an icy beam at the enemy for 5 seconds, dealing (120 of Spell Power) Frost damage every t2 sec and slowing movement by s4. Each time Ray of Frost deals damage, its damage and snare increases by 208141s1.rnrnGenerates s3 charges of Fingers of Frost over its duration. SpellInfo(ray_of_frost cd=75 duration=5 channel=5 tick=1 talent=ray_of_frost_talent) # Movement slowed by w1.rnTaking w2 Frost damage every t2 sec. SpellAddTargetDebuff(ray_of_frost ray_of_frost=1) Define(reaping_flames_0 310690) # Burn your target with a bolt of Azerite, dealing 310712s3 Fire damage. If the target has less than s2 health?a310705[ or more than 310705s1 health][], the cooldown is reduced by s3 sec.?a310710[rnrnIf Reaping Flames kills an enemy, its cooldown is lowered to 310710s2 sec and it will deal 310710s1 increased damage on its next use.][] SpellInfo(reaping_flames_0 cd=45 channel=0) Define(reaping_flames_1 311194) # Burn your target with a bolt of Azerite, dealing 310712s3 Fire damage. If the target has less than s2 health or more than 310705s1 health, the cooldown is reduced by m3 sec. SpellInfo(reaping_flames_1 cd=45 channel=0) Define(reaping_flames_2 311195) # Burn your target with a bolt of Azerite, dealing 310712s3 Fire damage. If the target has less than s2 health or more than 310705s1 health, the cooldown is reduced by m3 sec.rnrnIf Reaping Flames kills an enemy, its cooldown is lowered to 310710s2 sec and it will deal 310710s1 increased damage on its next use. SpellInfo(reaping_flames_2 cd=45 channel=0) Define(reaping_flames_3 311202) # Burn your target with a bolt of Azerite, dealing 310712s3 Fire damage. If the target has less than s2 health?a310705[ or more than 310705s1 health][], the cooldown is reduced by s3 sec.?a310710[rnrnIf Reaping Flames kills an enemy, its cooldown is lowered to 310710s2 sec and it will deal 310710s1 increased damage on its next use.][] SpellInfo(reaping_flames_3 duration=30 gcd=0 offgcd=1) # Damage of next Reaping Flames increased by w1. SpellAddBuff(reaping_flames_3 reaping_flames_3=1) Define(reaping_flames_4 311947) SpellInfo(reaping_flames_4 duration=2 gcd=0 offgcd=1) SpellAddTargetDebuff(reaping_flames_4 reaping_flames_4=1) Define(reckless_force_buff_0 298409) # When an ability fails to critically strike, you have a high chance to gain Reckless Force. When Reckless Force reaches 302917u stacks, your critical strike is increased by 302932s1 for 4 seconds. SpellInfo(reckless_force_buff_0 max_stacks=5 gcd=0 offgcd=1 tick=10) # Gaining unstable Azerite energy. SpellAddBuff(reckless_force_buff_0 reckless_force_buff_0=1) Define(reckless_force_buff_1 304038) # When an ability fails to critically strike, you have a high chance to gain Reckless Force. When Reckless Force reaches 302917u stacks, your critical strike is increased by 302932s1 for 4 seconds. SpellInfo(reckless_force_buff_1 channel=-0.001 gcd=0 offgcd=1) SpellAddBuff(reckless_force_buff_1 reckless_force_buff_1=1) Define(ripple_in_space_0 299306) # Infuse your Heart of Azeroth with Ripple in Space. SpellInfo(ripple_in_space_0) Define(ripple_in_space_1 299307) # Infuse your Heart of Azeroth with Ripple in Space. SpellInfo(ripple_in_space_1) Define(ripple_in_space_2 299309) # Infuse your Heart of Azeroth with Ripple in Space. SpellInfo(ripple_in_space_2) Define(ripple_in_space_3 299310) # Infuse your Heart of Azeroth with Ripple in Space. SpellInfo(ripple_in_space_3) Define(rule_of_threes 264354) # When you gain your third Arcane Charge, the cost of your next Arcane Blast or Arcane Missiles is reduced by 264774s1. SpellInfo(rule_of_threes channel=0 gcd=0 offgcd=1 talent=rule_of_threes_talent) SpellAddBuff(rule_of_threes rule_of_threes=1) Define(rune_of_power 116011) # Places a Rune of Power on the ground for 15 seconds which increases your spell damage by 116014s1 while you stand within 8 yds.rnrnCasting ?a137021[Arcane Power]?a137019[Combustion][Icy Veins] will also create a Rune of Power at your location. SpellInfo(rune_of_power cd=10 charge_cd=45 duration=15 talent=rune_of_power_talent) Define(scorch 2948) # Scorches an enemy for (17.7 of Spell Power) Fire damage. Castable while moving. SpellInfo(scorch) Define(shifting_power 314791) # Draw power from the ground beneath, dealing (47.36 of Spell Power)*4 seconds/t Nature damage over 4 seconds to enemies within 325130A1 yds. rnrnWhile channeling, your Mage ability cooldowns are reduced by -s2/1000*4 seconds/t sec over 4 seconds. SpellInfo(shifting_power cd=45 duration=4 channel=4 tick=1) # Every t1 sec, deal 325130s1 Nature damage to enemies within 325130A1 yds and reduce the remaining cooldown of your abilities by -s2/1000 sec. SpellAddBuff(shifting_power shifting_power=1) Define(summon_water_elemental 31687) # Summons a Water Elemental to follow and fight for you. SpellInfo(summon_water_elemental cd=30) Define(supernova 157980) # Pulses arcane energy around the target enemy or ally, dealing (30 of Spell Power) Arcane damage to all enemies within A2 yards, and knocking them upward. A primary enemy target will take s1 increased damage. SpellInfo(supernova cd=25 talent=supernova_talent) Define(the_unbound_force_0 299321) # Infuse your Heart of Azeroth with The Unbound Force. SpellInfo(the_unbound_force_0) Define(the_unbound_force_1 299322) # Infuse your Heart of Azeroth with The Unbound Force. SpellInfo(the_unbound_force_1) Define(the_unbound_force_2 299323) # Infuse your Heart of Azeroth with The Unbound Force. SpellInfo(the_unbound_force_2) Define(the_unbound_force_3 299324) # Infuse your Heart of Azeroth with The Unbound Force. SpellInfo(the_unbound_force_3) Define(time_warp 80353) # Warp the flow of time, increasing haste by (25 of Spell Power) ?a320919[and time rate by s4 ][]for all party and raid members for 40 seconds.rnrnAllies will be unable to benefit from Bloodlust, Heroism, or Time Warp again for 600 seconds.?a320920[rnrnWhen the effect ends, you die.][] SpellInfo(time_warp cd=300 duration=40 channel=40 gcd=0 offgcd=1) # Haste increased by w1. ?W4>0[Time rate increased by w4.][]?W3=1[rnrnWhen the effect ends, you die.][] SpellAddBuff(time_warp time_warp=1) Define(touch_of_the_magi 321507) # Applies Touch of the Magi to your current target, accumulating s1 of the damage you deal to the target for 8 seconds, and then exploding for that amount of Arcane damage to the target and reduced damage to all nearby enemies.?a343215[rnrn|cFFFFFFFFGenerates s2 Arcane Charges.|r][] # Rank 2: Touch of the Magi generates 321507s2 Arcane Charges. SpellInfo(touch_of_the_magi cd=45 max_stacks=1 arcanecharges=-4) Define(winters_chill 228358) # Unleash a flurry of ice, striking the target s1 times for a total of (31.6 of Spell Power)*m1 Frost damage. Each hit reduces the target's movement speed by 228354s1 for 1 second.?a231584[rnrnWhile Brain Freeze is active, Flurry applies Winter's Chill, causing your target to take damage from your spells as if it were frozen.][] SpellInfo(winters_chill duration=6 max_stacks=2 gcd=0 offgcd=1) # Taking damage from the Mage's spells as if frozen. SpellAddTargetDebuff(winters_chill winters_chill=1) Define(worldvein_resonance_0 298606) # Infuse your Heart of Azeroth with Worldvein Resonance. SpellInfo(worldvein_resonance_0) Define(worldvein_resonance_1 298607) # Infuse your Heart of Azeroth with Worldvein Resonance. SpellInfo(worldvein_resonance_1) Define(worldvein_resonance_2 298609) # Infuse your Heart of Azeroth with Worldvein Resonance. SpellInfo(worldvein_resonance_2) Define(worldvein_resonance_3 298611) # Infuse your Heart of Azeroth with Worldvein Resonance. SpellInfo(worldvein_resonance_3) SpellList(arcane_charge_buff arcane_charge_buff_0 arcane_charge_buff_1) SpellList(blood_fury blood_fury_0 blood_fury_1 blood_fury_2 blood_fury_3) SpellList(blood_of_the_enemy blood_of_the_enemy_0 blood_of_the_enemy_1 blood_of_the_enemy_2 blood_of_the_enemy_3) SpellList(clearcasting clearcasting_0 clearcasting_1 clearcasting_2) SpellList(concentrated_flame concentrated_flame_0 concentrated_flame_1 concentrated_flame_2 concentrated_flame_3 concentrated_flame_4 concentrated_flame_5 concentrated_flame_6) SpellList(fireblood fireblood_0 fireblood_1) SpellList(focused_azerite_beam focused_azerite_beam_0 focused_azerite_beam_1 focused_azerite_beam_2 focused_azerite_beam_3) SpellList(guardian_of_azeroth guardian_of_azeroth_0 guardian_of_azeroth_1 guardian_of_azeroth_2 guardian_of_azeroth_3 guardian_of_azeroth_4 guardian_of_azeroth_5) SpellList(memory_of_lucid_dreams memory_of_lucid_dreams_0 memory_of_lucid_dreams_1 memory_of_lucid_dreams_2) SpellList(purifying_blast purifying_blast_0 purifying_blast_1 purifying_blast_2 purifying_blast_3 purifying_blast_4 purifying_blast_5) SpellList(reaping_flames reaping_flames_0 reaping_flames_1 reaping_flames_2 reaping_flames_3 reaping_flames_4) SpellList(ripple_in_space ripple_in_space_0 ripple_in_space_1 ripple_in_space_2 ripple_in_space_3) SpellList(the_unbound_force the_unbound_force_0 the_unbound_force_1 the_unbound_force_2 the_unbound_force_3) SpellList(worldvein_resonance worldvein_resonance_0 worldvein_resonance_1 worldvein_resonance_2 worldvein_resonance_3) SpellList(gladiators_badge gladiators_badge_0 gladiators_badge_1) SpellList(brain_freeze brain_freeze_0 brain_freeze_1) SpellList(reckless_force_buff reckless_force_buff_0 reckless_force_buff_1) Define(alexstraszas_fury_talent 11) #22465 # Dragon's Breath always critically strikes for s2 increased critical strike damage and contributes to Hot Streak. rnrnAdditionally, damage done by your next Pyroblast or Flamestrike is increased by 334277s1. Define(amplification_talent 1) #22458 # When Clearcast, Arcane Missiles fires s2 additional lmissile:missiles;. Define(arcane_echo_talent 11) #22467 # Direct damage you deal to enemies affected by Touch of the Magi, causes an explosion that deals (10.92 of Spell Power) Arcane damage to s1 nearby enemies. Define(arcane_familiar_talent 3) #22464 # Summon a Familiar that attacks your enemies and increases your maximum mana by 210126s1 for 3600 seconds. Define(arcane_orb_talent 17) #22449 # Launches an Arcane Orb forward from your position, traveling up to 40 yards, dealing (109.2 of Spell Power) Arcane damage to enemies it passes through.rnrn|cFFFFFFFFGrants 1 Arcane Charge when cast and every time it deals damage.|r Define(comet_storm_talent 18) #22473 # Calls down a series of 7 icy comets on and around the target, that deals up to 7*(40 of Spell Power) Frost damage to all enemies within 228601A1 yds of its impacts. Define(ebonbolt_talent 12) #22469 # Launch a bolt of ice at the enemy, dealing (200 of Spell Power) Frost damage and granting you Brain Freeze. Define(enlightened_talent 21) #21145 # Arcane damage dealt while above s1 mana is increased by 321388s1, Mana Regen while below s1 is increased by 321390s1. Define(firestarter_talent 1) #22456 # Your Fireball and Pyroblast spells always deal a critical strike when the target is above s1 health. Define(flame_on_talent 10) #22450 # Reduces the cooldown of Fire Blast by s3 seconds and increases the maximum number of charges by s1. Define(flame_patch_talent 16) #22451 # Flamestrike leaves behind a patch of flames which burns enemies within it for 8*(6 of Spell Power) Fire damage over 8 seconds. Define(from_the_ashes_talent 12) #22468 # Increases Mastery by s3 for each charge of Phoenix Flames off cooldown and your direct-damage critical strikes reduce its cooldown by s2/-1000 sec. Define(glacial_spike_talent 21) #21634 # Conjures a massive spike of ice, and merges your current Icicles into it. It impales your target, dealing (297 of Spell Power) damage plus all of the damage stored in your Icicles, and freezes the target in place for 4 seconds. Damage may interrupt the freeze effect.rnrnRequires 5 Icicles to cast.rnrn|cFFFFFFFFPassive:|r Ice Lance no longer launches Icicles. Define(ice_floes_talent 6) #23073 # Makes your next Mage spell with a cast time shorter than s2 sec castable while moving. Unaffected by the global cooldown and castable while casting. Define(ice_nova_talent 3) #22463 # Causes a whirl of icy wind around the enemy, dealing (180 of Spell Power) Frost damage to the target and reduced damage to all other enemies within a2 yards, and freezing them in place for 2 seconds. Define(kindling_talent 19) #21631 # Your Fireball, Pyroblast, Fire Blast, and Phoenix Flames critical strikes reduce the remaining cooldown on Combustion by <cdr> sec. Define(living_bomb_talent 18) #22472 # The target becomes a Living Bomb, taking 217694o1 Fire damage over 4 seconds, and then exploding to deal an additional (14.000000000000002 of Spell Power) Fire damage to the target and reduced damage to all other enemies within 44461A2 yards.rnrnOther enemies hit by this explosion also become a Living Bomb, but this effect cannot spread further. Define(meteor_talent 21) #21633 # Calls down a meteor which lands at the target location after 3 seconds, dealing (260 of Spell Power) Fire damage, split evenly between all targets within 8 yards, and burns the ground, dealing 8*(8.25 of Spell Power) Fire damage over 8.5 seconds to all enemies in the area. Define(nether_tempest_talent 12) #22470 # Places a Nether Tempest on the target which deals 114923o1 Arcane damage over 12 seconds to the target and nearby enemies within 10 yards. Limit 1 target. Deals reduced damage to secondary targets.rnrnDamage increased by 36032s1 per Arcane Charge. Define(pyroclasm_talent 20) #22220 # Consuming Hot Streak has a s1 chance to make your next non-instant Pyroblast cast within 15 seconds deal 269651s1 additional damage.rnrnMaximum 269651u stacks. Define(ray_of_frost_talent 20) #22309 # Channel an icy beam at the enemy for 5 seconds, dealing (120 of Spell Power) Frost damage every t2 sec and slowing movement by s4. Each time Ray of Frost deals damage, its damage and snare increases by 208141s1.rnrnGenerates s3 charges of Fingers of Frost over its duration. Define(resonance_talent 10) #22453 # Arcane Barrage deals s1 increased damage per target it hits. Define(rule_of_threes_talent 2) #22461 # When you gain your third Arcane Charge, the cost of your next Arcane Blast or Arcane Missiles is reduced by 264774s1. Define(rune_of_power_talent 9) #22447 # Places a Rune of Power on the ground for 15 seconds which increases your spell damage by 116014s1 while you stand within 8 yds.rnrnCasting ?a137021[Arcane Power]?a137019[Combustion][Icy Veins] will also create a Rune of Power at your location. Define(searing_touch_talent 3) #22462 # Scorch deals s2 increased damage and is a guaranteed Critical Strike when the target is below s1 health. Define(supernova_talent 18) #22474 # Pulses arcane energy around the target enemy or ally, dealing (30 of Spell Power) Arcane damage to all enemies within A2 yards, and knocking them upward. A primary enemy target will take s1 increased damage. Define(focused_resolve_item 168506) Define(ancient_knot_of_wisdom_item 166793) Define(azsharas_font_of_power_item 169314) Define(azurethos_singed_plumage_item 161377) Define(balefire_branch_item 159630) Define(gladiators_medallion_item 184268) Define(hyperthread_wristwraps_item 168989) Define(ignition_mages_fuse_item 159615) Define(manifesto_of_madness_item 174103) Define(neural_synapse_enhancer_item 168973) Define(shockbiters_fang_item 169318) Define(superior_battle_potion_of_intellect_item 168498) Define(tzanes_barkspines_item 161411) Define(blaster_master_trait 274596) Define(vision_of_perfection_essence_id 22) ]] OvaleScripts:RegisterScript("MAGE", nil, name, desc, code, "include") end
return { "B1", "I1", "I2", "I4", "I8", "F4", "F8" }
--[[Function Module program by Al Sweigart Provides useful utility functions.]] -- selectItem() selects the inventory -- slot with the named item, returns -- true if found and false if not function selectItem(name) -- check all inventory slots local item for slot = 1, 16 do item = turtle.getItemDetail(slot) if item ~= nil and item['name'] == name then turtle.select(slot) return true end end return false -- couldn't find item end -- selectEmptySlot() selects inventory -- slot that is empty, returns true if -- found, false if no empty spaces function selectEmptySlot() -- loop through all slots for slot = 1, 16 do if turtle.getItemCount(slot) == 0 then turtle.select(slot) return true end end return false -- couldn't find empty space end -- countInventory() returns the total -- number of items in the inventory function countInventory() local total = 0 for slot = 1, 16 do total = total + turtle.getItemCount(slot) end return total end -- selectAndPlaceDown() selects a nonempty slot -- and places a block from it under the turtle function selectAndPlaceDown() for slot = 1, 16 do if turtle.getItemCount(slot) > 0 then turtle.select(slot) turtle.placeDown() return end end end -- buildWall() creates a wall stretching -- in front of the turtle function buildWall(length, height) if hare.countInventory() < length * height then return false -- not enough blocks end turtle.up() local movingForward = true for currentHeight = 1, height do for currentLength = 1, length do selectAndPlaceDown() -- place the block if movingForward and currentLength ~= length then turtle.forward() elseif not movingForward and currentLength ~= length then turtle.back() end end if currentHeight ~= height then turtle.up() end movingForward = not movingForward end -- done building wall; move to end position if movingForward then -- turtle is near the start position for currentLength = 1, length do turtle.forward() end else -- turtle is near the end position turtle.forward() end -- move down to the ground for currentHeight = 1, height do turtle.down() end return true end -- buildRoom() constructs four walls -- and a ceiling function buildRoom(length, width, height) if hare.countInventory() < (((length - 1) * height * 2) + ((width - 1) * height * 2)) then return false -- not enough blocks end -- build the four walls buildWall(length - 1, height) turtle.turnRight() buildWall(width - 1, height) turtle.turnRight() buildWall(length - 1, height) turtle.turnRight() buildWall(width - 1, height) turtle.turnRight() return true end -- sweepField() moves across the rows -- and columns of an area in front and -- to the right of the turtle, calling -- the provided sweepFunc at each space function sweepField(length, width, sweepFunc) local turnRightNext = true for x = 1, width do for y = 1, length do sweepFunc() -- don't move forward on the last row if y ~= length then turtle.forward() end end -- don't turn on the last column if x ~= width then -- turn to the next column if turnRightNext then turtle.turnRight() turtle.forward() turtle.turnRight() else turtle.turnLeft() turtle.forward() turtle.turnLeft() end turnRightNext = not turnRightNext end end -- move back to the start position if width % 2 == 0 then turtle.turnRight() else for y = 1, length - 1 do turtle.back() end turtle.turnLeft() end for x = 1, width - 1 do turtle.forward() end turtle.turnRight() return true end -- buildFloor() builds a rectangular -- floor out of the blocks in the -- inventory function buildFloor(length, width) if countInventory() < length * width then return false -- not enough blocks end turtle.up() sweepField(length, width, selectAndPlaceDown) end -- findBlock() spins around searching -- for the named block next to the turtle function findBlock(name) local result, block for i = 1, 4 do result, block = turtle.inspect() if block ~= nil and block['name'] == name then return true end turtle.turnRight() end return false end -- digUntilClear() keeps digging until -- there are no more blocks (used when -- sand or gravel can fall into the path) function digUntilClear() while turtle.detect() do if not turtle.dig() then return false end end return true end -- digUpUntilClear() keeps digging up until -- there are no more blocks (used when -- sand or gravel can fall into the path) function digUpUntilClear() while turtle.detectUp() do if not turtle.digUp() then return false end end return true end
local user local id = param.get_id() if id then user = User:by_id(id) end if user then slot.put_into("title", encode.html(_"User")) else slot.put_into("title", encode.html(_"New user")) end slot.select("actions", function() ui.link{ content = _"Back", module = "user" } if user then ui.link{ content = _"Delete", form_attr = { onsubmit = "return confirm('" .. _'Are you sure?' .. "');" }, module = "user", action = "update", id = user.id, params = { delete = true }, routing = { default = { mode = "redirect", module = "user", view = "index" } } } end end) slot.select("main", function() ui.form{ attr = { class = "vertical" }, record = user, module = "user", action = "update", id = id, routing = { default = { mode = "redirect", module = "user", view = "index" } }, content = function() if id then ui.field.integer{ label = _"Id", name = "id", readonly = true } end ui.field.text{ label = _"Ident", name = "ident" } ui.field.text{ label = _"Password", name = "password" } ui.field.text{ label = _"Name", name = "name" } ui.field.boolean{ label = _"Write Priv", name = "write_priv" } ui.field.boolean{ label = _"Admin", name = "admin" } ui.submit{ text = _"Save" } end } end)
--[[ TheNexusAvenger Displays all the players in the game in the lobby. --]] local PLAYER_ENTRIES_PER_DISPLAY = 4 local Workspace = game:GetService("Workspace") local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local ReplicatedStorageProject = require(ReplicatedStorage:WaitForChild("Project"):WaitForChild("ReplicatedStorage")) local Lobby = Workspace:WaitForChild("Lobby") local PlayerScreens = Lobby:WaitForChild("PlayerScreens"):GetChildren() table.sort(PlayerScreens,function(a,b) return a.Name < b.Name end) local RankIcon = ReplicatedStorageProject:GetResource("UI.Icon.RankIcon") local PlayersToDisplay = {} --[[ Handles a player being added. --]] local function PlayerAdded(Player) --Get the stats. local PlayerStats = Player:WaitForChild("PersistentStats") local TotalKnockoutsValue = PlayerStats:WaitForChild("TotalKOs") local TimesMVPValue = PlayerStats:WaitForChild("TimesMVP") if not Player.Parent then return end --Create and add the player data. local PlayerData = { Player = Player, Knockouts = TotalKnockoutsValue.Value, MVPs = TimesMVPValue.Value, } table.insert(PlayersToDisplay,PlayerData) --Sort the players by name. table.sort(PlayersToDisplay,function(a,b) return string.lower(a.Player.Name) < string.lower(b.Player.Name) end) --Connect updating the stats. TotalKnockoutsValue:GetPropertyChangedSignal("Value"):Connect(function() PlayerData.Knockouts = TotalKnockoutsValue.Value end) TimesMVPValue:GetPropertyChangedSignal("Value"):Connect(function() PlayerData.MVPs = TimesMVPValue.Value end) end --[[ Handles a player being removed. --]] local function PlayerRemoved(Player) --Get the index to remove. local IndexToRemove for i,PlayerData in pairs(PlayersToDisplay) do if PlayerData.Player == Player then IndexToRemove = i break end end --Remove the index. if IndexToRemove then table.remove(PlayersToDisplay,IndexToRemove) end end --Connect the players. Players.PlayerAdded:Connect(PlayerAdded) Players.PlayerRemoving:Connect(PlayerRemoved) for _,Player in pairs(Players:GetPlayers()) do coroutine.wrap(function() PlayerAdded(Player) end)() end --Create the displays. for ScreenId,Screen in pairs(PlayerScreens) do --Create the container. local PlayerDisplaySurfaceGui = Instance.new("SurfaceGui") PlayerDisplaySurfaceGui.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud PlayerDisplaySurfaceGui.PixelsPerStud = 25 PlayerDisplaySurfaceGui.ResetOnSpawn = false PlayerDisplaySurfaceGui.Name = "PlayersDisplay" PlayerDisplaySurfaceGui.Adornee = Screen:WaitForChild("Screen") PlayerDisplaySurfaceGui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui") local PlayersContainer = Instance.new("Frame") PlayersContainer.BackgroundTransparency = 1 PlayersContainer.Size = UDim2.new(1,0,1,0) PlayersContainer.ClipsDescendants = true PlayersContainer.Parent = PlayerDisplaySurfaceGui --Create the player entries. local PlayerEntries = {} for _ = 1,PLAYER_ENTRIES_PER_DISPLAY + 1 do local PlayerContainer = Instance.new("Frame") PlayerContainer.BackgroundTransparency = 1 PlayerContainer.Size = UDim2.new(1/PLAYER_ENTRIES_PER_DISPLAY,0,1,0) PlayerContainer.ClipsDescendants = true PlayerContainer.Parent = PlayersContainer local PlayerImage = Instance.new("ImageLabel") PlayerImage.BackgroundTransparency = 1 PlayerImage.Position = UDim2.new(0.025,0,0.025,0) PlayerImage.Size = UDim2.new(0.95,0,0.95,0) PlayerImage.SizeConstraint = Enum.SizeConstraint.RelativeXX PlayerImage.Parent = PlayerContainer local PlayerImageCorner = Instance.new("UICorner") PlayerImageCorner.CornerRadius = UDim.new(0.2,0) PlayerImageCorner.Parent = PlayerImage local RankImage = Instance.new("ImageLabel") RankImage.BackgroundTransparency = 1 RankImage.Position = UDim2.new(0.475,0,0.475,0) RankImage.Size = UDim2.new(0.5,0,0.5,0) RankImage.Parent = PlayerImage local PlayerRankIcon = RankIcon.new(RankImage) local PlayerNameText = Instance.new("TextLabel") PlayerNameText.BackgroundTransparency = 1 PlayerNameText.Size = UDim2.new(0.95,0,0.075,0) PlayerNameText.Position = UDim2.new(0.025,0,0.675,0) PlayerNameText.Font = Enum.Font.SourceSansBold PlayerNameText.TextScaled = true PlayerNameText.TextColor3 = Color3.new(0,0,0) PlayerNameText.TextStrokeColor3 = Color3.new(1,1,1) PlayerNameText.TextStrokeTransparency = 0 PlayerNameText.Parent = PlayerContainer local KnockoutsText = Instance.new("TextLabel") KnockoutsText.BackgroundTransparency = 1 KnockoutsText.Size = UDim2.new(0.4,0,0.15,0) KnockoutsText.Position = UDim2.new(0.075,0,0.75,0) KnockoutsText.Font = Enum.Font.SourceSansBold KnockoutsText.TextScaled = true KnockoutsText.TextColor3 = Color3.new(0,0,0) KnockoutsText.TextStrokeColor3 = Color3.new(1,1,1) KnockoutsText.TextStrokeTransparency = 0 KnockoutsText.Parent = PlayerContainer local KnockoutsTitleText = Instance.new("TextLabel") KnockoutsTitleText.BackgroundTransparency = 1 KnockoutsTitleText.Size = UDim2.new(0.4,0,0.075,0) KnockoutsTitleText.Position = UDim2.new(0.075,0,0.875,0) KnockoutsTitleText.Font = Enum.Font.SourceSansBold KnockoutsTitleText.TextScaled = true KnockoutsTitleText.TextColor3 = Color3.new(0,0,0) KnockoutsTitleText.TextStrokeColor3 = Color3.new(1,1,1) KnockoutsTitleText.TextStrokeTransparency = 0 KnockoutsTitleText.Text = "Knockouts" KnockoutsTitleText.Parent = PlayerContainer local MVPsText = Instance.new("TextLabel") MVPsText.BackgroundTransparency = 1 MVPsText.Size = UDim2.new(0.4,0,0.15,0) MVPsText.Position = UDim2.new(0.525,0,0.75,0) MVPsText.Font = Enum.Font.SourceSansBold MVPsText.TextScaled = true MVPsText.TextColor3 = Color3.new(0,0,0) MVPsText.TextStrokeColor3 = Color3.new(1,1,1) MVPsText.TextStrokeTransparency = 0 MVPsText.Parent = PlayerContainer local MVPsTitleText = Instance.new("TextLabel") MVPsTitleText.BackgroundTransparency = 1 MVPsTitleText.Size = UDim2.new(0.4,0,0.075,0) MVPsTitleText.Position = UDim2.new(0.525,0,0.875,0) MVPsTitleText.Font = Enum.Font.SourceSansBold MVPsTitleText.TextScaled = true MVPsTitleText.TextColor3 = Color3.new(0,0,0) MVPsTitleText.TextStrokeColor3 = Color3.new(1,1,1) MVPsTitleText.TextStrokeTransparency = 0 MVPsTitleText.Text = "MVPs" MVPsTitleText.Parent = PlayerContainer table.insert(PlayerEntries,{ Container = PlayerContainer, PlayerImage = PlayerImage, PlayerRankIcon = PlayerRankIcon, PlayerNameText = PlayerNameText, KnockoutsText = KnockoutsText, MVPsText = MVPsText, }) end --Update the displays continously. local ListOffset = (ScreenId - 1) * PLAYER_ENTRIES_PER_DISPLAY local MaxPlayers = PLAYER_ENTRIES_PER_DISPLAY * #PlayerScreens RunService.Stepped:Connect(function() --Hide the display if the lobby is not in Workspace. if Lobby.Parent ~= Workspace then PlayerDisplaySurfaceGui.Enabled = false return end PlayerDisplaySurfaceGui.Enabled = true --Determine the offset of the list. local TimeOffset = tick() % 1 local StartIndex = math.ceil(tick() % #PlayersToDisplay) if #PlayersToDisplay <= MaxPlayers then TimeOffset = 0 StartIndex = 0 end --Update the entries. for i,PlayerEntry in pairs(PlayerEntries) do --Get the player. local StatIndex = StartIndex + ListOffset + i if #PlayersToDisplay >= MaxPlayers then while StatIndex > #PlayersToDisplay do StatIndex = StatIndex - #PlayersToDisplay end end local PlayerData = PlayersToDisplay[StatIndex] --Update the display. PlayerEntry.Container.Position = UDim2.new((i - 1 - TimeOffset)/PLAYER_ENTRIES_PER_DISPLAY,0,0,0) if PlayerData then PlayerEntry.Container.Visible = true PlayerEntry.PlayerImage.Image = "rbxthumb://type=AvatarHeadShot&id="..tostring(PlayerData.Player.UserId).."&w=420&h=420" PlayerEntry.PlayerRankIcon.Player = PlayerData.Player PlayerEntry.PlayerNameText.Text = PlayerData.Player.DisplayName PlayerEntry.KnockoutsText.Text = tostring(PlayerData.Knockouts) PlayerEntry.MVPsText.Text = tostring(PlayerData.MVPs) else PlayerEntry.Container.Visible = false PlayerEntry.PlayerRankIcon.Player = nil end end end) end
local Brain = require('game.bt.Brain') local AttackTarget = require('game.actions.AttackTarget') local PatrolTo = require('game.actions.PatrolTo') local strClassName = 'game.brains.monster_rock_mon05' local monster_rock_mon05 = lua_declare(strClassName, lua_class(strClassName, Brain)) function monster_rock_mon05:ctor(owner) Brain.ctor(self, owner, 'monster_rock_mon05') end function monster_rock_mon05:OnStart() self.bt = BehaviourTree(self, SelectorNode( { IfElseNode( function() return math.random()<0.3 end, SequenceNode( { AttackTarget("Attack4"), WaitNode(2), }), IfElseNode( function() return math.random()<0.7 end, PatrolTo(1), WaitNode(2) ) ), }) ) end return monster_rock_mon05
require("assert_substring") test("Testing case sensitive, expect is", function() local str1 = "Hello LeBlanc" assert.is_substring(str1, "LeBlanc") end) test("Testing case sensitive, expect is_not", function() local str1 = "Hello LeBlanc" assert.is_not_substring(str1, "Leblanc") end) test("Testing magic characters sensitive, expect", function() local str1 = "Hello (LeBlanc)" assert.is_substring(str1, "(LeBlanc)") end)
if game.Workspace.FilteringEnabled == true then print("This game is FE") elseif print("This game is NOT FE") end
--[[ LOVE 0.1.1a Compatibility Module v1.0.0 Developed by HTV04 TODO: * Examine functions in more situations * For example, look for unintentional or undocumented behavior * Functions need better errors * Fix mouse wheel input --]] -- Cached objects local unpack = unpack or table.unpack local love = love local ripple -- Local variables local filters = { key = { ["unknown"] = 0, -- key_unknown ["backspace"] = 8, -- key_backspace ["tab"] = 9, -- key_tab ["clear"] = 12, -- key_clear ["return"] = 13, -- key_return ["pause"] = 19, -- key_pause ["escape"] = 27, -- key_escape ["space"] = 32, -- key_space ["!"] = 33, -- key_exclaim ["\""] = 34, -- key_quotedbl ["#"] = 35, -- key_hash ["$"] = 36, -- key_dollar ["&"] = 38, -- key_ampersand ["'"] = 39, -- key_quote ["("] = 40, -- key_leftparen [")"] = 41, -- key_rightparen ["*"] = 42, -- key_asterisk ["+"] = 43, -- key_plus [","] = 44, -- key_comma ["-"] = 45, -- key_minus ["."] = 46, -- key_period ["/"] = 47, -- key_slash ["0"] = 48, -- key_0 ["1"] = 49, -- key_1 ["2"] = 50, -- key_2 ["3"] = 51, -- key_3 ["4"] = 52, -- key_4 ["5"] = 53, -- key_5 ["6"] = 54, -- key_6 ["7"] = 55, -- key_7 ["8"] = 56, -- key_8 ["9"] = 57, -- key_9 [":"] = 58, -- key_colon [";"] = 59, -- key_semicolon ["<"] = 60, -- key_less ["="] = 61, -- key_equals [">"] = 62, -- key_greater ["?"] = 63, -- key_question ["@"] = 64, -- key_at ["["] = 91, -- key_leftbracket ["\\"] = 92, -- key_backslash ["]"] = 93, -- key_rightbracket ["^"] = 94, -- key_caret ["_"] = 95, -- key_underscore ["`"] = 96, -- key_backquote ["a"] = 97, -- key_a ["b"] = 98, -- key_b ["c"] = 99, -- key_c ["d"] = 100, -- key_d ["e"] = 101, -- key_e ["f"] = 102, -- key_f ["g"] = 103, -- key_g ["h"] = 104, -- key_h ["i"] = 105, -- key_i ["j"] = 106, -- key_j ["k"] = 107, -- key_k ["l"] = 108, -- key_l ["m"] = 109, -- key_m ["n"] = 110, -- key_n ["o"] = 111, -- key_o ["p"] = 112, -- key_p ["q"] = 113, -- key_q ["r"] = 114, -- key_r ["s"] = 115, -- key_s ["t"] = 116, -- key_t ["u"] = 117, -- key_u ["v"] = 118, -- key_v ["w"] = 119, -- key_w ["x"] = 120, -- key_x ["y"] = 121, -- key_y ["z"] = 122, -- key_z ["delete"] = 127, -- key_delete ["kp0"] = 256, -- key_kp0 ["kp1"] = 257, -- key_kp1 ["kp2"] = 258, -- key_kp2 ["kp3"] = 259, -- key_kp3 ["kp4"] = 260, -- key_kp4 ["kp5"] = 261, -- key_kp5 ["kp6"] = 262, -- key_kp6 ["kp7"] = 263, -- key_kp7 ["kp8"] = 264, -- key_kp8 ["kp9"] = 265, -- key_kp9 ["kp."] = 266, -- key_kp_period ["kp/"] = 267, -- key_kp_divide ["kp*"] = 268, -- key_kp_multiply ["kp-"] = 269, -- key_kp_minus ["kp+"] = 270, -- key_kp_plus ["kpenter"] = 271, -- key_kp_enter ["kp="] = 272, -- key_kp_equals ["up"] = 273, -- key_up ["down"] = 274, -- key_down ["right"] = 275, -- key_right ["left"] = 276, -- key_left ["insert"] = 277, -- key_insert ["home"] = 278, -- key_home ["end"] = 279, -- key_end ["pageup"] = 280, -- key_pageup ["pagedown"] = 281, -- key_pagedown ["f1"] = 282, -- key_f1 ["f2"] = 283, -- key_f2 ["f3"] = 284, -- key_f3 ["f4"] = 285, -- key_f4 ["f5"] = 286, -- key_f5 ["f6"] = 287, -- key_f6 ["f7"] = 288, -- key_f7 ["f8"] = 289, -- key_f8 ["f9"] = 290, -- key_f9 ["f10"] = 291, -- key_f10 ["f11"] = 292, -- key_f11 ["f12"] = 293, -- key_f12 ["f13"] = 294, -- key_f13 ["f14"] = 295, -- key_f14 ["f15"] = 296, -- key_f15 ["numlock"] = 300, -- key_numlock ["capslock"] = 301, -- key_capslock ["scrolllock"] = 302, -- key_scrollock ["rshift"] = 303, -- key_rshift ["lshift"] = 304, -- key_lshift ["rctrl"] = 305, -- key_rctrl ["lctrl"] = 306, -- key_lctrl ["ralt"] = 307, -- key_ralt ["lalt"] = 308, -- key_lalt ["rgui"] = 312, -- key_rsuper ["lgui"] = 311, -- key_lsuper ["mode"] = 313, -- key_mode ["help"] = 315, -- key_help ["printscreen"] = 316, -- key_print ["sysreq"] = 317, -- key_sysreq ["menu"] = 319, -- key_menu ["power"] = 320, -- key_power ["currencyunit"] = 321, -- key_euro ["undo"] = 322 -- key_undo }, mouse = {1, 3, 2} } local sources = {} -- Object sources -- Audio module local variables local audioIsPlaying local audioIsPaused -- Filesystem module local variables local includes = {} love.load = function() if load then load() end end love.update = function(dt) if update then update(dt) end end love.draw = function() if render then render() end end love.mousepressed = function(x, y, button) if mousepressed then mousepressed(x, y, filters.mouse[button]) end end love.mousereleased = function(x, y, button) if mousereleased then mousereleased(x, y, filters.mouse[button]) end end love.keypressed = function(key) if keypressed then keypressed(filters.key[key]) end end love.keyreleased = function(key) if keyreleased then keyreleased(filters.key[key]) end end -- Ripple library for sound handling do ripple = { _VERSION = 'Ripple', _DESCRIPTION = 'Audio helpers for LÖVE.', _URL = 'https://github.com/tesselode/ripple', _LICENSE = [[ MIT License Copyright (c) 2019 Andrew Minnich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] } local unpack = unpack or table.unpack -- luacheck: ignore --[[ Represents an object that: - can have tags applied - has a volume - can have effects applied Tags, instances, and sounds are all taggable. Note that not all taggable objects have children - tags and sounds do, but instances do not. ]] local Taggable = {} --[[ Gets the total volume of this object given its own volume and the volume of each of its tags. ]] function Taggable:_getTotalVolume() local volume = self.volume for tag, _ in pairs(self._tags) do volume = volume * tag:_getTotalVolume() end return volume end --[[ Gets all the effects that should be applied to this object given its own effects and the effects of each of its tags. The object's own effects will override tag effects. Note: currently, if multiple tags define settings for the same effect, the final result is undefined, as taggable objects use pairs to iterate through the tags, which iterates in an undefined order. ]] function Taggable:_getAllEffects() local effects = {} for tag, _ in pairs(self._tags) do for name, filterSettings in pairs(tag:_getAllEffects()) do effects[name] = filterSettings end end for name, filterSettings in pairs(self._effects) do effects[name] = filterSettings end return effects end --[[ A callback that is called when anything happens that could lead to a change in the object's total volume. ]] function Taggable:_onChangeVolume() end --[[ A callback that is called when anything happens that could change which effects are applied to the object. ]] function Taggable:_onChangeEffects() end function Taggable:_setVolume(volume) self._volume = volume self:_onChangeVolume() end --[[ _tag, _untag, and _setEffect are analogous to the similarly named public API functions (see below), but they don't call the _onChangeVolume and _onChangeEffects callbacks. This allows me to have finer control over when to call those callbacks, so I can set multiple tags and effects without needlessly calling the callbacks for each one. ]] function Taggable:_tag(tag) self._tags[tag] = true tag._children[self] = true end function Taggable:_untag(tag) self._tags[tag] = nil tag._children[self] = nil end function Taggable:_setEffect(name, filterSettings) if filterSettings == nil then filterSettings = true end self._effects[name] = filterSettings end --[[ Given an options table, initializes the object's volume, tags, and effects. ]] function Taggable:_setOptions(options) self.volume = options and options.volume or 1 -- reset tags for tag in pairs(self._tags) do self:_untag(tag) end -- apply new tags if options and options.tags then for _, tag in ipairs(options.tags) do self:_tag(tag) end end -- reset effects for name in pairs(self._effects) do self._effects[name] = nil end -- apply new effects if options and options.effects then for name, filterSettings in pairs(options.effects) do self:_setEffect(name, filterSettings) end end -- update final volume and effects self:_onChangeVolume() self:_onChangeEffects() end function Taggable:tag(...) for i = 1, select('#', ...) do local tag = select(i, ...) self:_tag(tag) end self:_onChangeVolume() self:_onChangeEffects() end function Taggable:untag(...) for i = 1, select('#', ...) do local tag = select(i, ...) self:_untag(tag) end self:_onChangeVolume() self:_onChangeEffects() end --[[ Sets an effect for this object. filterSettings can be the following types: - table - the effect will be enabled with the filter settings given in the table - true/nil - the effect will be enabled with no filter - false - the effect will be explicitly disabled, overriding effect settings from a parent sound or tag ]] function Taggable:setEffect(name, filterSettings) self:_setEffect(name, filterSettings) self:_onChangeEffects() end function Taggable:removeEffect(name) self._effects[name] = nil self:_onChangeEffects() end function Taggable:getEffect(name) return self._effects[name] end function Taggable:__index(key) if key == 'volume' then return self._volume end return Taggable[key] end function Taggable:__newindex(key, value) if key == 'volume' then self:_setVolume(value) else rawset(self, key, value) end end --[[ Represents a tag that can be applied to sounds, instances of sounds, or other tags. ]] local Tag = {__newindex = Taggable.__newindex} function Tag:__index(key) if Tag[key] then return Tag[key] end return Taggable.__index(self, key) end function Tag:_onChangeVolume() -- tell objects using this tag about a potential -- volume change for child, _ in pairs(self._children) do child:_onChangeVolume() end end function Tag:_onChangeEffect() -- tell objects using this tag about a potential -- effect change for child, _ in pairs(self._children) do child:_onChangeEffect() end end -- Pauses all the sounds and instances tagged with this tag. function Tag:pause(fadeDuration) for child, _ in pairs(self._children) do child:pause(fadeDuration) end end -- Resumes all the sounds and instances tagged with this tag. function Tag:resume(fadeDuration) for child, _ in pairs(self._children) do child:resume(fadeDuration) end end -- Stops all the sounds and instances tagged with this tag. function Tag:stop(fadeDuration) for child, _ in pairs(self._children) do child:stop(fadeDuration) end end function ripple.newTag(options) local tag = setmetatable({ _effects = {}, _tags = {}, _children = {}, }, Tag) tag:_setOptions(options) return tag end -- Represents a specific occurrence of a sound. local Instance = {} function Instance:__index(key) if key == 'pitch' then return self._source:getPitch() elseif key == 'loop' then return self._source:isLooping() elseif Instance[key] then return Instance[key] end return Taggable.__index(self, key) end function Instance:__newindex(key, value) if key == 'pitch' then self._source:setPitch(value) elseif key == 'loop' then self._source:setLooping(value) else Taggable.__newindex(self, key, value) end end function Instance:_getTotalVolume() local volume = Taggable._getTotalVolume(self) -- apply sound volume as well as tag/self volumes volume = volume * self._sound:_getTotalVolume() -- apply fade volume volume = volume * self._fadeVolume return volume end function Instance:_getAllEffects() local effects = {} for tag, _ in pairs(self._tags) do for name, filterSettings in pairs(tag:_getAllEffects()) do effects[name] = filterSettings end end -- apply sound effects as well as tag/self effects for name, filterSettings in pairs(self._sound:_getAllEffects()) do effects[name] = filterSettings end for name, filterSettings in pairs(self._effects) do effects[name] = filterSettings end return effects end function Instance:_onChangeVolume() -- update the source's volume self._source:setVolume(self:_getTotalVolume()) end function Instance:_onChangeEffects() -- get the list of effects that should be applied local effects = self:_getAllEffects() for name, filterSettings in pairs(effects) do -- remember which effects are currently applied to the source if filterSettings == false then self._appliedEffects[name] = nil else self._appliedEffects[name] = true end if filterSettings == true then self._source:setEffect(name) else self._source:setEffect(name, filterSettings) end end -- remove effects that are currently applied but shouldn't be anymore for name in pairs(self._appliedEffects) do if not effects[name] then self._source:setEffect(name, false) self._appliedEffects[name] = nil end end end function Instance:_play(options) if options and options.fadeDuration then self._fadeVolume = 0 self._fadeSpeed = 1 / options.fadeDuration else self._fadeVolume = 1 end self._fadeDirection = 1 self._afterFadingOut = false self._paused = false self:_setOptions(options) self.pitch = options and options.pitch or 1 if options and options.loop ~= nil then self.loop = options.loop end self._source:seek(options and options.seek or 0) self._source:play() end function Instance:_update(dt) -- fade in if self._fadeDirection == 1 and self._fadeVolume < 1 then self._fadeVolume = self._fadeVolume + self._fadeSpeed * dt if self._fadeVolume > 1 then self._fadeVolume = 1 end self:_onChangeVolume() -- fade out elseif self._fadeDirection == -1 and self._fadeVolume > 0 then self._fadeVolume = self._fadeVolume - self._fadeSpeed * dt if self._fadeVolume < 0 then self._fadeVolume = 0 -- pause or stop after fading out if self._afterFadingOut == 'pause' then self:pause() elseif self._afterFadingOut == 'stop' then self:stop() end end self:_onChangeVolume() end end function Instance:isStopped() return (not self._source:audioIsPlaying()) and (not self._paused) end function Instance:pause(fadeDuration) if fadeDuration and not self._paused then self._fadeDirection = -1 self._fadeSpeed = 1 / fadeDuration self._afterFadingOut = 'pause' else self._source:pause() self._paused = true end end function Instance:resume(fadeDuration) if fadeDuration then if self._paused then self._fadeVolume = 0 self:_onChangeVolume() end self._fadeDirection = 1 self._fadeSpeed = 1 / fadeDuration end self._source:play() self._paused = false end function Instance:stop(fadeDuration) if fadeDuration and not self._paused then self._fadeDirection = -1 self._fadeSpeed = 1 / fadeDuration self._afterFadingOut = 'stop' else self._source:stop() self._paused = false end end -- Represents a sound that can be played. local Sound = {} function Sound:__index(key) if key == 'loop' then return self._source:isLooping() elseif Sound[key] then return Sound[key] end return Taggable.__index(self, key) end function Sound:__newindex(key, value) if key == 'loop' then self._source:setLooping(value) for _, instance in ipairs(self._instances) do instance.loop = value end else Taggable.__newindex(self, key, value) end end function Sound:_onChangeVolume() -- tell instances about potential volume changes for _, instance in ipairs(self._instances) do instance:_onChangeVolume() end end function Sound:_onChangeEffects() -- tell instances about potential effect changes for _, instance in ipairs(self._instances) do instance:_onChangeEffects() end end function Sound:play(options) -- reuse a stopped instance if one is available for _, instance in ipairs(self._instances) do if instance:isStopped() then instance:_play(options) return instance end end -- otherwise, create a brand new one local instance = setmetatable({ _sound = self, _source = self._source:clone(), _effects = {}, _tags = {}, _appliedEffects = {}, }, Instance) table.insert(self._instances, instance) instance:_play(options) return instance end function Sound:pause(fadeDuration) for _, instance in ipairs(self._instances) do instance:pause(fadeDuration) end end function Sound:resume(fadeDuration) for _, instance in ipairs(self._instances) do instance:resume(fadeDuration) end end function Sound:stop(fadeDuration) for _, instance in ipairs(self._instances) do instance:stop(fadeDuration) end end function Sound:update(dt) for _, instance in ipairs(self._instances) do instance:_update(dt) end end function ripple.newSound(source, options) local sound = setmetatable({ _source = source, _effects = {}, _tags = {}, _instances = {}, }, Sound) sound:_setOptions(options) if options and options.loop then sound.loop = true end return sound end end return { -- Constants key_unknown = 0, key_first = 0, key_backspace = 8, key_tab = 9, key_clear = 12, key_return = 13, key_pause = 19, key_escape = 27, key_space = 32, key_exclaim = 33, key_quotedbl = 34, key_hash = 35, key_dollar = 36, key_ampersand = 38, key_quote = 39, key_leftparen = 40, key_rightparen = 41, key_asterisk = 42, key_plus = 43, key_comma = 44, key_minus = 45, key_period = 46, key_slash = 47, key_0 = 48, key_1 = 49, key_2 = 50, key_3 = 51, key_4 = 52, key_5 = 53, key_6 = 54, key_7 = 55, key_8 = 56, key_9 = 57, key_colon = 58, key_semicolon = 59, key_less = 60, key_equals = 61, key_greater = 62, key_question = 63, key_at = 64, key_leftbracket = 91, key_backslash = 92, key_rightbracket = 93, key_caret = 94, key_underscore = 95, key_backquote = 96, key_a = 97, key_b = 98, key_c = 99, key_d = 100, key_e = 101, key_f = 102, key_g = 103, key_h = 104, key_i = 105, key_j = 106, key_k = 107, key_l = 108, key_m = 109, key_n = 110, key_o = 111, key_p = 112, key_q = 113, key_r = 114, key_s = 115, key_t = 116, key_u = 117, key_v = 118, key_w = 119, key_x = 120, key_y = 121, key_z = 122, key_delete = 127, key_kp0 = 256, key_kp1 = 257, key_kp2 = 258, key_kp3 = 259, key_kp4 = 260, key_kp5 = 261, key_kp6 = 262, key_kp7 = 263, key_kp8 = 264, key_kp9 = 265, key_kp_period = 266, key_kp_divide = 267, key_kp_multiply = 268, key_kp_minus = 269, key_kp_plus = 270, key_kp_enter = 271, key_kp_equals = 272, key_up = 273, key_down = 274, key_right = 275, key_left = 276, key_insert = 277, key_home = 278, key_end = 279, key_pageup = 280, key_pagedown = 281, key_f1 = 282, key_f2 = 283, key_f3 = 284, key_f4 = 285, key_f5 = 286, key_f6 = 287, key_f7 = 288, key_f8 = 289, key_f9 = 290, key_f10 = 291, key_f11 = 292, key_f12 = 293, key_f13 = 294, key_f14 = 295, key_f15 = 296, key_numlock = 300, key_capslock = 301, key_scrollock = 302, key_rshift = 303, key_lshift = 304, key_rctrl = 305, key_lctrl = 306, key_ralt = 307, key_lalt = 308, key_rmeta = 309, key_lmeta = 310, key_rsuper = 312, key_lsuper = 311, key_mode = 313, key_compose = 314, key_help = 315, key_print = 316, key_sysreq = 317, key_break = 318, key_menu = 319, key_power = 320, key_euro = 321, key_undo = 322, mouse_left = 1, mouse_middle = 2, mouse_right = 3, mouse_wheeldown = 5, mouse_wheelup = 4, align_left = 1, align_center = 3, align_right = 2, align_top = 4, align_bottom = 5, mode_loop = 1, mode_once = 2, mode_bounce = 3, -- Objects module objects = { newImage = function(self, filename) local object = { getWidth = function(self) return sources[self]:getWidth() end, getHeight = function(self) return sources[self]:getHeight() end } sources[object] = love.graphics.newImage(filename) return object end, newSound = function(self, filename) local object = { setVolume = function(self, volume) sources[self].volume = volume / 100 end } sources[object] = ripple.newSound(love.audio.newSource(filename, "static")) return object end, newMusic = function(self, filename) local object = {} sources[object] = love.audio.newSource(filename, "stream") return object end, newColor = function(self, red, green, blue, alpha) if not alpha then alpha = 255 end local object = { getRed = function(self) return red end, getGreen = function(self) return green end, getBlue = function(self) return blue end, getAlpha = function(self) return alpha end } sources[object] = {red, green, blue, alpha} return object end, newFont = function(self, filename, size) local object = { getHeight = function(self) return math.floor(sources[self]:getHeight() / 1.25 - 1) -- getHeight is weird end, getWidth = function(self, text) return sources[self]:getWidth(text) end } sources[object] = love.graphics.newFont(filename, math.floor(size * 1.25)) -- 1.25 is the "magic line height" for TrueType fonts return object end }, -- Graphics module graphics = { setColor = function(self, red, green, blue, alpha) local red, green, blue, alpha = red, green, blue, alpha or 255 if sources[red] then -- Color object red, green, blue, alpha = unpack(sources[red]) end love.graphics.setColor(red / 255, green / 255, blue / 255, alpha / 255) end, setBackgroundColor = function(self, red, green, blue) local red, green, blue = red, green, blue if sources[red] then -- Color object red, green, blue = unpack(sources[red]) end love.graphics.setBackgroundColor(red / 255, green / 255, blue / 255) end, setFont = function(self, font) love.graphics.setFont(sources[font]) end, draw = function(self, drawable, x, y) local source = sources[drawable] if source then -- Image love.graphics.draw(source, x, y, nil, nil, nil, source:getWidth() / 2, source:getHeight() / 2) else -- Text love.graphics.print(drawable, x, y) -- love.graphics.print(string, x, y) end end }, -- Audio module audio = { play = function(self, sound, loop) local sound = sources[sound] if sound.loop then -- Sound sound.loop = loop == 0 else -- Music sound:setLooping(loop == 0) sound:stop() end sound:play() audioIsPlaying = true audioIsPaused = false end, pause = function(self) love.audio.pause() audioIsPaused = false audioIsPaused = true end, resume = function(self) love.audio.play() audioIsPlaying = true audioIsPaused = false end, stop = function(self) love.audio.stop() audioIsPlaying = false audioIsPaused = false end, isPlaying = function(self) return audioIsPlaying end, isPaused = function(self) return audioIsPaused end, setVolume = function(self, volume) love.audio.setVolume(volume / 100) end }, -- Keyboard module keyboard = { isDown = function(self, key) return love.keyboard.isDown(filters.key[key]) end }, -- Mouse module mouse = { getX = function(self) return love.mouse.getX() end, getY = function(self) return love.mouse.getY() end, isDown = function(self, button) return love.mouse.isDown(filters.mouse[button]) end, setVisible = function(self, visible) love.mouse.setVisible(visible) end, isVisible = function(self) return love.mouse.isVisible() end }, -- Filesystem module filesystem = { include = function(filename) -- NOTE: Does not support return values if not includes[filename] then love.filesystem.load(filename)() includes[filename] = true end end }, -- Timer module timer = { getFps = function(self) return love.timer.getFPS() end } }
return { version = "1.1", luaversion = "5.1", tiledversion = "1.1.4", orientation = "orthogonal", renderorder = "right-down", width = 100, height = 10, tilewidth = 70, tileheight = 70, nextobjectid = 20, properties = {}, tilesets = { { name = "tiles_spritesheet", firstgid = 1, filename = "tiles_spritesheet.tsx", tilewidth = 70, tileheight = 70, spacing = 2, margin = 0, image = "tiles_spritesheet.png", imagewidth = 914, imageheight = 936, transparentcolor = "#ff00ff", tileoffset = { x = 0, y = 0 }, grid = { orientation = "orthogonal", width = 70, height = 70 }, properties = {}, terrains = {}, tilecount = 156, tiles = {} } }, layers = { { type = "tilelayer", name = "TileLayer1", x = 0, y = 0, width = 100, height = 10, visible = true, opacity = 1, offsetx = 0, offsety = 0, properties = {}, encoding = "base64", data = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" }, { type = "objectgroup", name = "Coins", visible = true, opacity = 1, offsetx = 0, offsety = 0, draworder = "topdown", properties = {}, objects = { { id = 7, name = "", type = "", shape = "rectangle", x = 420, y = 420, width = 70, height = 70, rotation = 0, visible = true, properties = {} }, { id = 8, name = "", type = "", shape = "rectangle", x = 630, y = 420, width = 70, height = 70, rotation = 0, visible = true, properties = {} }, { id = 9, name = "", type = "", shape = "rectangle", x = 980, y = 210, width = 70, height = 70, rotation = 0, visible = true, properties = {} }, { id = 10, name = "", type = "", shape = "rectangle", x = 1190, y = 210, width = 70, height = 70, rotation = 0, visible = true, properties = {} }, { id = 11, name = "", type = "", shape = "rectangle", x = 1400, y = 210, width = 70, height = 70, rotation = 0, visible = true, properties = {} }, { id = 16, name = "", type = "", shape = "rectangle", x = 1750, y = 70, width = 70, height = 70, rotation = 0, visible = true, properties = {} }, { id = 17, name = "", type = "", shape = "rectangle", x = 1960, y = 70, width = 70, height = 70, rotation = 0, visible = true, properties = {} }, { id = 19, name = "", type = "", shape = "rectangle", x = 2240, y = 70, width = 70, height = 70, rotation = 0, visible = true, properties = {} } } }, { type = "objectgroup", name = "Platforms", visible = true, opacity = 1, offsetx = 0, offsety = 0, draworder = "topdown", properties = {}, objects = { { id = 3, name = "", type = "", shape = "rectangle", x = 140, y = 560, width = 630, height = 70, rotation = 0, visible = true, properties = {} }, { id = 12, name = "", type = "", shape = "rectangle", x = 910, y = 350, width = 770, height = 70, rotation = 0, visible = true, properties = {} }, { id = 13, name = "", type = "", shape = "rectangle", x = 770, y = 420, width = 140, height = 70, rotation = 0, visible = true, properties = {} }, { id = 14, name = "", type = "", shape = "rectangle", x = 1610, y = 210, width = 980, height = 70, rotation = 0, visible = true, properties = {} }, { id = 15, name = "", type = "", shape = "rectangle", x = 2520, y = 70, width = 910, height = 70, rotation = 0, visible = true, properties = {} } } } } }
--[[ 新增/修改 用户扩展信息,有id就是修改,没有id就是新增 @param id_pk @param user_code_fk @param nickname @param head_icon @param sex @param signature @param hometown @param location @param company @param college @param birthday @param profession @param blood_type @param marriage ]]-- local cjson = require "cjson" local userDb = require "db.base_db" local reqArgs = require "common.request_args" local redis = require "redis.zs_redis" local responeData = require"common.api_data_help" -- 获取参数 local currentRequestArgs = reqArgs.new() local args = currentRequestArgs.getArgs() if not args.user_code and args.user_code ~= "" then local result = responeData.new_failed({},zhCn_bundles.db_parm_error) ngx.say(cjson.encode(result)) return end local user ={} if args.id_pk and args.id_pk~="" then user.id_pk=args.id_pk end if args.user_code and args.user_code~="" then user.user_code_fk=args.user_code end if args.nickname and args.nickname~="" then user.nickname=args.nickname end if args.head_icon and args.head_icon~="" then user.head_icon=args.head_icon end if args.sex and args.sex~="" then user.sex=args.sex end if args.signature and args.signature~="" then user.signature=args.signature end if args.hometown and args.hometown~="" then user.hometown=args.hometown end if args.location and args.location~="" then user.location=args.location end if args.company and args.company~="" then user.company=args.company end if args.college and args.college~="" then user.college=args.college end if args.birthday and args.birthday~="" then user.birthday=args.birthday end if args.profession and args.profession~="" then user.profession=args.profession end if args.blood_type and args.blood_type~="" then user.blood_type=args.blood_type end if args.marriage and args.marriage~="" then user.marriage=args.marriage end local userDbOp = userDb.new() local dbres = nil local err = nil if not args["id_pk"] then --新增 dbres,err = userDbOp.insertBaseToSql("t_user_ext_info",user) if not dbres then local result = responeData.new_failed({},err) ngx.say(cjson.encode(result)) return end else --更新 local kParm = {} kParm.user_code_fk = args["user_code_fk"]; kParm.id_pk = args["id_pk"]; -- 将数据存放到数据库中去 dbres,err = userDbOp.updateBaseFromSql("t_user_ext_info",user,kParm) if not dbres then local result = responeData.new_failed({},err) ngx.say(cjson.encode(result)) return end end local result = responeData.new_success({}) ngx.say(cjson.encode(result)) -- 这里是修改
Talk(0, "这位姑娘,请问这里是药王庄吗?<莫非她就是毒手药王?>", "talkname0", 1); Talk(2, "你到药王庄来所为何事?", "talkname2", 0); Talk(0, "金面佛苗大侠中毒受伤,所用毒药,乃奸人自前辈处盗来,望前辈慈悲赐予解药.", "talkname0", 1); Talk(2, "哼!姜师兄又随意将毒药给予外人,江湖上的人又将这笔帐记在师父头上了.这次又是中了什么毒?", "talkname2", 0); Talk(0, "原来毒手药王是你师父,害我前辈长前辈短的乱叫,你也不怕折寿吗?", "talkname0", 1); Talk(2, "我又没叫你叫,是你自己爱叫的.", "talkname2", 0); Talk(0, "还请姑娘请药王前辈出来,在下想向他求取断肠草的解药.", "talkname0", 1); Talk(2, "我师父已经过世了.", "talkname2", 0); Talk(0, "那这该如何是好?", "talkname0", 1); Talk(2, "这断肠草的毒并不太难解.", "talkname2", 0); Talk(0, "原来姑娘已得到药王先生的真传,还请姑娘惠赐解药.", "talkname0", 1); Talk(2, "给你解药也是可以,只要你帮我办一件事.", "talkname2", 0); Talk(0, "什么事?", "talkname0", 1); Talk(2, "你功夫好不好?", "talkname2", 0); Talk(0, "在下志在武林盟主,功夫自然不差.", "talkname0", 1); Talk(2, "口气倒是很大.好,那我要你帮我找回一样东西.", "talkname2", 0); Talk(0, "什么东西?", "talkname0", 1); Talk(2, "七心海棠.这东西自从被我姜师兄盗出去后,现在不知流落何方.若不赶快找回来的话,不知又有多少笔烂帐要记在我药王庄的头上.", "talkname2", 0); Talk(0, "那我要到那里去找?", "talkname0", 1); Talk(2, "我如果知道还要你去找吗?不过你可以多留意一些滥施毒药,迷药害人的家伙.", "talkname2", 0); Talk(0, "尚不知姑娘芳名?", "talkname0", 1); Talk(2, "程灵素.", "talkname2", 0); Talk(0, "那,灵姑娘,告辞了.", "talkname0", 1); ModifyEvent(-2, -2, -2, -2, 40, 41, -2, -2, -2, -2, -2, -2, -2); do return end;
local InstancedMap = require("api.InstancedMap") local Chara = require("api.Chara") local Assert = require("api.test.Assert") local StayingCharas = require("api.StayingCharas") local save = require("internal.global.save") local InstancedArea = require("api.InstancedArea") local Area = require("api.Area") function test_IChara_swap_places() local map = InstancedMap:new(10, 10) map:clear("elona.cobble") local player = Chara.create("base.player", 1, 2, {}, map) local ally = Chara.create("base.player", 3, 4, {}, map) Assert.eq(1, player.x) Assert.eq(2, player.y) Assert.eq(3, ally.x) Assert.eq(4, ally.y) player:swap_places(ally) Assert.eq(1, ally.x) Assert.eq(2, ally.y) Assert.eq(3, player.x) Assert.eq(4, player.y) ally:set_pos(0, 1) Assert.eq(nil, Chara.at(1, 2, map)) end function test_IChara_kill__unregisters_staying() local map = InstancedMap:new(10, 10) map:clear("elona.cobble") local area = InstancedArea:new() Area.register(area, { parent = "root" }) area:add_floor(map, 1) local chara = Chara.create("base.player", 1, 2, {}, map) StayingCharas.register_global(chara, area, 1) Assert.eq(area.uid, save.base.staying_charas:get_staying_area_for(chara).area_uid) chara:kill() Assert.eq(nil, save.base.staying_charas:get_staying_area_for(chara)) end function test_IChara_vaniquish__unregisters_staying() local map = InstancedMap:new(10, 10) map:clear("elona.cobble") local area = InstancedArea:new() Area.register(area, { parent = "root" }) area:add_floor(map, 1) local chara = Chara.create("base.player", 1, 2, {}, map) StayingCharas.register_global(chara, area, 1) Assert.eq(area.uid, save.base.staying_charas:get_staying_area_for(chara).area_uid) chara:vanquish() Assert.eq(nil, save.base.staying_charas:get_staying_area_for(chara)) end function test_IChara_remove_ownership__unregisters_staying() local map = InstancedMap:new(10, 10) map:clear("elona.cobble") local area = InstancedArea:new() Area.register(area, { parent = "root" }) area:add_floor(map, 1) local chara = Chara.create("base.player", 1, 2, {}, map) StayingCharas.register_global(chara, area, 1) Assert.eq(area.uid, save.base.staying_charas:get_staying_area_for(chara).area_uid) chara:remove_ownership() Assert.eq(nil, save.base.staying_charas:get_staying_area_for(chara)) end
-- Function definitions which were not output by -- the C preprocessor local sdl local function registerdefines(sdl) -- audio function sdl.AUDIO_BITSIZE(x) return bit.band(x, sdl.AUDIO_MASK_BITSIZE) end function sdl.AUDIO_ISFLOAT(x) return bit.band(x, sdl.AUDIO_MASK_DATATYPE) ~= 0 end function sdl.AUDIO_ISBIGENDIAN(x) return bit.band(x, sdl.AUDIO_MASK_ENDIAN) ~= 0 end function sdl.AUDIO_ISSIGNED(x) return bit.band(x, sdl.AUDIO_MASK_SIGNED) ~= 0 end function sdl.AUDIO_ISINT(x) return not sdl.AUDIO_ISFLOAT(x) end function sdl.AUDIO_ISLITTLEENDIAN(x) return not sdl.AUDIO_ISBIGENDIAN(x) end function sdl.AUDIO_ISUNSIGNED(x) return not sdl.AUDIO_ISSIGNED(x) end function sdl.loadWAV(file, spec, audio_buf, audio_len) return sdl.loadWAV_RW(sdl.RWFromFile(file, "rb"), 1, spec, audio_buf, audio_len) end -- surface sdl.blitSurface = sdl.upperBlit function sdl.MUSTLOCK(S) return bit.band(S.flags, sdl.RLEACCEL) end function sdl.loadBMP(file) return sdl.loadBMP_RW(sdl.RWFromFile(file, 'rb'), 1) end function sdl.saveBMP(surface, file) return sdl.saveBMP_RW(surface, sdl.RWFromFile(file, 'wb'), 1) end end return registerdefines
mhf = require("message_handler_factory") unistd = require("posix.unistd"); local xml_string = [=[<?xml version="1.0" encoding="UTF-8"?> <ns1:wvt xmlns:ns1="http://test_example.com"> <int>123</int> <string> This is a name: Thimmashetty Dasiah </string> <normalizedString> This is a name: Thimmashetty Dasiah </normalizedString> <token> This is a name: Thimmashetty Dasiah </token> <Name>ajs:lka.jf</Name> <NCName>ajslka.jf</NCName> <language>en-US</language> <ID>A123</ID> <IDREF>A123</IDREF> <ENTITY>A123</ENTITY> <NMTOKEN>:_0123123</NMTOKEN> <NOTATION>:_0123123 askfjaklfj asd_: :fskdjf </NOTATION> <QName>A0123123askfjaklfjasd_:fskdjf </QName> <IDREFS>A123 A123</IDREFS> <ENTITIES>A123 A234 </ENTITIES> <NMTOKENS>:_0123123 askfjaklfj asd_: :fskdjf </NMTOKENS> <boolean>true </boolean> <float>3.3E+38 </float> <double>100.15 </double> <hexBinary>48656C6C6F20576F726C642053726972616D20616E6420476F777269202121212048656C6C6F20576F726C642053726972616D20616E6420476F77726920212121202048656C6C6F20576F726C642053726972616D20616E6420476F7772692021212121 </hexBinary> <base64Binary>SGVsbG8gV29ybGQgU3JpcmFtIGFuZCBHb3dyaSAhISEgSGVsbG8gV29ybGQgU3JpcmFtIGFuZCBH b3dyaSAhISEgIEhlbGxvIFdvcmxkIFNyaXJhbSBhbmQgR293cmkgISEhIQ==</base64Binary> <anyURI>urn:one:two</anyURI> <decimal> +100.15 </decimal> <integer> +20 </integer> <positiveInteger> 1024 </positiveInteger> <long> -9223372036854775807 </long> <int> 54775807 </int> </ns1:wvt>]=] mhf = require("message_handler_factory") wvt = mhf:get_message_handler("wvt", "http://test_example.com"); local content, msg = wvt:from_xml(xml_string) if (type(content) == 'table') then require 'pl.pretty'.dump(content); else print(content, msg) end local t = require("posix.time"); --print(debug.getinfo(1).source, debug.getinfo(1).currentline); print(t.nanosleep); --print(debug.getinfo(1).source, debug.getinfo(1).currentline); local json_str = nil; local lua_obj = nil; local xml_str = nil; local i = 0; if (nil ~= content) then print("+++++++++++++++"); while (i < 30000) do json_str = wvt:to_json(content); --print(debug.getinfo(1).source, debug.getinfo(1).currentline, json_str); lua_obj = wvt:from_json(json_str); --require 'pl.pretty'.dump(lua_obj); --print(debug.getinfo(1).source, debug.getinfo(1).currentline); xml_str = wvt:to_xml(lua_obj); --print(debug.getinfo(1).source, debug.getinfo(1).currentline); content = wvt:from_xml(xml_str); --print(debug.getinfo(1).source, debug.getinfo(1).currentline, xml_str); i = i + 1; if (i%1000 == 1) then print(i); end local ts = { tv_sec = 0, tv_nsec = 1000000 } ; t.nanosleep(ts); end end print(json_str); print(xml_str); if (content ~= nil) then os.exit(true); else os.exit(false); end
local super = Class("EventListenerList", LuaObject, function() static.NULL_ARRAY = {} end).getSuperclass() function EventListenerList:init() super.init(self) self.listenerList = EventListenerList.NULL_ARRAY return self end function EventListenerList:getListenerList() return self.listenerList; end function EventListenerList:getListeners(t) local lList = self.listenerList local n = self:getListenerCount(lList, t) local result = {} local j = 0 for i = #lList-2, 1, 2 do if (lList[i] == t) then result[j] = lList[i+1] j = j + 1 end end return result end function EventListenerList:getListenerCount(t) if(not t) then return #self.listenerList/2 end local lList = self.listenerList return self:getListenerArrayCount(lList, t) end function EventListenerList:getListenerArrayCount(list, t) local count = 0; for i = 1, #list.length, 2 do if (t == list[i]) then count = count + 1 end end return count end function EventListenerList:add(t, l) if (l==nil) then return end --if (not instanceOf(l, t)) then -- throw('IllegalArgumentException("Listener " + l + " is not of type " + t)') --end if (self.listenerList == EventListenerList.NULL_ARRAY) then self.listenerList = { t, l } else local i = #self.listenerList local tmp = self.listenerList table.insert(tmp, i, t) table.insert(tmp, i+1, l) self.listenerList = tmp end end function EventListenerList:remove(t, l) if (l==nil) then return end if (not instanceOf(l, t)) then throw('IllegalArgumentException("Listener " + l + " is not of type " + t)') end local index = -1 for i = #self.listenerList-2, 1, -2 do if ((self.listenerList[i]==t) and (self.listenerList[i+1] == l)) then index = i break end end if (index ~= -1) then local tmp = self.listenerList if (index < #tmp) then table.remove(tmp, index) table.remove(tmp, index+1) end self.listenerList = (#tmp == 0) and NULL_ARRAY or tmp end end
-- Copyright (C) idevz (idevz.org) local setmetatable = setmetatable local _M = { _VERSION = '0.0.1' } local mt = {__index = _M} function _M.new(self, url) local random = { url = url, endpoints = {}, name = "random", weight = "" } return setmetatable(random, mt) end function _M.on_refresh(self, endpoints) self.endpoints = endpoints end function _M.select(self, req) for _, endpoint in ipairs(self.endpoints) do if endpoint:is_available() then return endpoint end end end function _M.select_array(self, req) end function _M.set_weight(self, weight) end function _M.select_index(self, req) end return _M
require 'libinjection' -- dofile('sqlifingerprints.lua') -- silly callback that just calls back into C -- identical to libinjection_is_sqli(sql_state, string_input, nil) -- function check_pattern_c(sqlstate) return(libinjection.sqli_blacklist(sqlstate) and libinjection.sqli_not_whitelist(sqlstate)) end -- half lua / half c checker -- use lua based fingerprint lookup and still uses C code -- to eliminate false positives function check_pattern(sqlstate) fp = sqlstate.pat if sqlifingerprints[fp] == true then -- try to eliminate certain false positives return(libinjection.sqli_not_whitelist(sqlstate)) else -- not sqli return 0 end end function lookup_word(sqlstate, ltype, word) if ltype == 'X' then return words['0' .. word:upper()] else return words[word:upper()] end end dofile('words.lua') -- THIS USES BUILT IN FINGERPRINTS -- (with last arg of 'nil') sqli = '1 union select * from table' sql_state = libinjection.sqli_state() libinjection.sqli_init(sql_state, sqli, sqli:len(), 0) print(libinjection.is_sqli(sql_state)) print(sql_state.pat) print('----') inputs = { "123 LIKE -1234.5678E+2;", "APPLE 1 9.123 'FOO' \"BAR\"", "/* BAR */ UNION ALL SELECT (2,3,4)", "1 || COS(+0X04) --FOOBAR", "dog apple @cat banana bar", "dog apple cat \"banana \'bar", "102 TABLE CLOTH" } function benchmark(imax) local x,s local t0 = os.clock() local sql_state = libinjection.sqli_state() for x = 0, imax do s = inputs[(x % 7) + 1] libinjection.sqli_init(sql_state, s, s:len(), 0) libinjection.is_sqli(sql_state) end local t1 = os.clock() print( imax / (t1-t0) ) end function benchmark_callback(imax) local x,s local t0 = os.clock() local sql_state = libinjection.sqli_state() for x = 0, imax do s = inputs[(x % 7) + 1] libinjection.sqli_init(sql_state, s, s:len(), 0) libinjection.sqli_callback(sql_state, 'lookup_word'); libinjection.is_sqli(sql_state) end local t1 = os.clock() print( imax / (t1-t0) ) end benchmark(1000000) benchmark_callback(1000000) -- THIS USES LUA FINGERPRINTS via 'check_pattern' function above if 0 then for x = 1,2 do ok = libinjection.is_sqli(sql_state) if ok == 1 then print(sql_state.pat) vec = sql_state.tokenvec for i = 1, sql_state.pat:len() do print(vec[i].type, vec[i].val) end end end end
male_models = {'a_m_m_afriamer_01','a_m_m_beach_01','a_m_m_beach_02','a_m_m_bevhills_01','a_m_m_bevhills_02','a_m_m_business_01','a_m_m_eastsa_01','a_m_m_eastsa_02','a_m_m_farmer_01','a_m_m_fatlatin_01','a_m_m_genfat_01','a_m_m_genfat_02','a_m_m_golfer_01','a_m_m_hasjew_01','a_m_m_hillbilly_01','a_m_m_hillbilly_02','a_m_m_indian_01','a_m_m_ktown_01','a_m_m_malibu_01','a_m_m_mexcntry_01','a_m_m_mexlabor_01','a_m_m_og_boss_01','a_m_m_paparazzi_01','a_m_m_polynesian_01','a_m_m_prolhost_01','a_m_m_rurmeth_01','a_m_m_salton_01','a_m_m_salton_02','a_m_m_salton_03','a_m_m_salton_04','a_m_m_skater_01','a_m_m_skidrow_01','a_m_m_socenlat_01','a_m_m_soucent_01','a_m_m_soucent_02','a_m_m_soucent_03','a_m_m_stlat_02','a_m_m_tennis_01','a_m_m_tourist_01','a_m_m_trampbeac_01','a_m_m_tramp_01','a_m_m_tranvest_01','a_m_m_tranvest_02','a_m_o_beach_01','a_m_o_genstreet_01','a_m_o_ktown_01','a_m_o_salton_01','a_m_o_soucent_01','a_m_o_soucent_02','a_m_o_soucent_03','a_m_o_tramp_01','a_m_y_beachvesp_01','a_m_y_beachvesp_02','a_m_y_beach_01','a_m_y_beach_02','a_m_y_beach_03','a_m_y_bevhills_01','a_m_y_bevhills_02','a_m_y_breakdance_01','a_m_y_busicas_01','a_m_y_business_01','a_m_y_business_02','a_m_y_business_03','a_m_y_cyclist_01','a_m_y_dhill_01','a_m_y_downtown_01','a_m_y_eastsa_01','a_m_y_eastsa_02','a_m_y_epsilon_01','a_m_y_epsilon_02','a_m_y_gay_01','a_m_y_gay_02','a_m_y_genstreet_01','a_m_y_genstreet_02','a_m_y_golfer_01','a_m_y_hasjew_01','a_m_y_hiker_01','a_m_y_hippy_01','a_m_y_hipster_01','a_m_y_hipster_02','a_m_y_hipster_03','a_m_y_indian_01','a_m_y_jetski_01','a_m_y_juggalo_01','a_m_y_ktown_01','a_m_y_ktown_02','a_m_y_latino_01','a_m_y_methhead_01','a_m_y_mexthug_01','a_m_y_motox_01','a_m_y_motox_02','a_m_y_musclbeac_01','a_m_y_musclbeac_02','a_m_y_polynesian_01','a_m_y_roadcyc_01','a_m_y_runner_01','a_m_y_runner_02','a_m_y_salton_01','a_m_y_skater_01','a_m_y_skater_02','a_m_y_soucent_01','a_m_y_soucent_02','a_m_y_soucent_03','a_m_y_soucent_04','a_m_y_stbla_01','a_m_y_stbla_02','a_m_y_stlat_01','a_m_y_stwhi_01','a_m_y_stwhi_02','a_m_y_sunbathe_01','a_m_y_surfer_01','a_m_y_vindouche_01','a_m_y_vinewood_01','a_m_y_vinewood_02','a_m_y_vinewood_03','a_m_y_vinewood_04','a_m_y_yoga_01','csb_anton','csb_ballasog','csb_burgerdrug','csb_car3guy1','csb_car3guy2','csb_chef','csb_chin_goon','csb_cletus', 'csb_customer', 'csb_fos_rep', 'csb_g', 'csb_grove_str_dlr', 'csb_hao', 'csb_hugh', 'csb_imran', 'csb_janitor', 'csb_ortega', 'csb_oscar', 'csb_porndudes', 'csb_prologuedriver', 'csb_ramp_gang', 'csb_ramp_hic', 'csb_ramp_hipster', 'csb_ramp_mex', 'csb_reporter', 'csb_roccopelosi', 'csb_trafficwarden', 'g_m_m_armboss_01','g_m_m_armgoon_01','g_m_m_armlieut_01','g_m_m_chemwork_01','g_m_m_chiboss_01','g_m_m_chicold_01','g_m_m_chigoon_01','g_m_m_chigoon_02','g_m_m_korboss_01','g_m_m_mexboss_01','g_m_m_mexboss_02','g_m_y_armgoon_02','g_m_y_azteca_01','g_m_y_ballaeast_01','g_m_y_ballaorig_01','g_m_y_ballasout_01','g_m_y_famca_01','g_m_y_famdnf_01','g_m_y_famfor_01','g_m_y_korean_01','g_m_y_korean_02','g_m_y_korlieut_01','g_m_y_lost_01','g_m_y_lost_02','g_m_y_lost_03','g_m_y_mexgang_01','g_m_y_mexgoon_01','g_m_y_mexgoon_02','g_m_y_mexgoon_03','g_m_y_pologoon_01','g_m_y_pologoon_02','g_m_y_salvaboss_01','g_m_y_salvagoon_01','g_m_y_salvagoon_02','g_m_y_salvagoon_03','g_m_y_strpunk_01','g_m_y_strpunk_02', 's_m_m_ammucountry','s_m_m_autoshop_01','s_m_m_autoshop_02','s_m_m_bouncer_01','s_m_m_ciasec_01','s_m_m_cntrybar_01','s_m_m_dockwork_01','s_m_m_doctor_01','s_m_m_fiboffice_02','s_m_m_gaffer_01','s_m_m_gardener_01','s_m_m_gentransport','s_m_m_hairdress_01','s_m_m_highsec_01','s_m_m_highsec_02','s_m_m_janitor','s_m_m_lathandy_01','s_m_m_lifeinvad_01','s_m_m_linecook','s_m_m_lsmetro_01','s_m_m_mariachi_01','s_m_m_migrant_01','s_m_m_movprem_01','s_m_m_movspace_01','s_m_m_pilot_01','s_m_m_pilot_02','s_m_m_postal_01','s_m_m_postal_02','s_m_m_scientist_01','s_m_m_strperf_01','s_m_m_strpreach_01','s_m_m_strvend_01','s_m_m_trucker_01','s_m_m_ups_01','s_m_m_ups_02','s_m_o_busker_01','s_m_y_airworker','s_m_y_ammucity_01','s_m_y_armymech_01','s_m_y_autopsy_01','s_m_y_barman_01','s_m_y_baywatch_01','s_m_y_busboy_01','s_m_y_chef_01','s_m_y_clown_01','s_m_y_construct_01','s_m_y_construct_02','s_m_y_dealer_01','s_m_y_devinsec_01','s_m_y_dockwork_01','s_m_y_dwservice_01','s_m_y_dwservice_02','s_m_y_factory_01','s_m_y_garbage','s_m_y_grip_01','s_m_y_mime','s_m_y_pestcont_01','s_m_y_pilot_01','s_m_y_prismuscl_01','s_m_y_prisoner_01','s_m_y_robber_01','s_m_y_shop_mask','s_m_y_strvend_01','s_m_y_uscg_01','s_m_y_valet_01','s_m_y_waiter_01','s_m_y_winclean_01','s_m_y_xmech_01','s_m_y_xmech_02','u_m_m_aldinapoli','u_m_m_bankman','u_m_m_bikehire_01','u_m_m_fibarchitect','u_m_m_filmdirector','u_m_m_glenstank_01','u_m_m_griff_01','u_m_m_jesus_01','u_m_m_jewelsec_01','u_m_m_jewelthief','u_m_m_markfost','u_m_m_partytarget','u_m_m_promourn_01','u_m_m_rivalpap','u_m_m_spyactor','u_m_m_willyfist','u_m_o_finguru_01','u_m_o_taphillbilly','u_m_o_tramp_01','u_m_y_antonb','u_m_y_babyd','u_m_y_baygor','u_m_y_burgerdrug_01','u_m_y_chip','u_m_y_cyclist_01','u_m_y_fibmugger_01','u_m_y_guido_01','u_m_y_gunvend_01','u_m_y_hippie_01','u_m_y_imporage','u_m_y_mani','u_m_y_militarybum','u_m_y_paparazzi','u_m_y_party_01','u_m_y_pogo_01','u_m_y_prisoner_01','u_m_y_proldriver_01','u_m_y_rsranger_01','u_m_y_sbike','u_m_y_staggrm_01','u_m_y_tattoo_01'} female_models = {'a_f_m_beach_01','a_f_m_bevhills_01','a_f_m_bevhills_02','a_f_m_bodybuild_01','a_f_m_business_02','a_f_m_downtown_01','a_f_m_eastsa_01','a_f_m_eastsa_02','a_f_m_fatbla_01','a_f_m_ktown_01','a_f_m_ktown_02','a_f_m_prolhost_01','a_f_m_salton_01','a_f_m_skidrow_01','a_f_m_soucentmc_01','a_f_m_soucent_01','a_f_m_soucent_02','a_f_m_tourist_01','a_f_m_trampbeac_01','a_f_m_tramp_01','a_f_o_genstreet_01','a_f_o_indian_01','a_f_o_ktown_01','a_f_o_salton_01','a_f_o_soucent_01','a_f_o_soucent_02','a_f_y_beach_01','a_f_y_bevhills_01','a_f_y_bevhills_02','a_f_y_bevhills_03','a_f_y_bevhills_04','a_f_y_business_01','a_f_y_business_02','a_f_y_business_03','a_f_y_business_04','a_f_y_eastsa_01','a_f_y_eastsa_02','a_f_y_eastsa_03','a_f_y_epsilon_01','a_f_y_fitness_01','a_f_y_fitness_02','a_f_y_genhot_01','a_f_y_golfer_01','a_f_y_hiker_01','a_f_y_hippie_01','a_f_y_hipster_01','a_f_y_hipster_02','a_f_y_hipster_03','a_f_y_hipster_04','a_f_y_indian_01','a_f_y_juggalo_01','a_f_y_runner_01','a_f_y_rurmeth_01','a_f_y_scdressy_01','a_f_y_skater_01','a_f_y_soucent_01','a_f_y_soucent_02','a_f_y_soucent_03','a_f_y_tennis_01','a_f_y_topless_01','a_f_y_tourist_01','a_f_y_tourist_02','a_f_y_vinewood_01','a_f_y_vinewood_02','a_f_y_vinewood_03','a_f_y_vinewood_04','a_f_y_yoga_01', 'csb_screen_writer', 'csb_stripper_01', 'csb_stripper_02', 'csb_tonya', 'csb_maude', 'csb_denise_friend', 'csb_abigail', 'csb_anita', 'g_f_y_ballas_01','g_f_y_families_01','g_f_y_lost_01','g_f_y_vagos_01','s_f_m_fembarber','s_f_m_maid_01','s_f_m_shop_high','s_f_m_sweatshop_01','s_f_y_airhostess_01','s_f_y_bartender_01','s_f_y_baywatch_01','s_f_y_factory_01','s_f_y_hooker_01','s_f_y_hooker_02','s_f_y_hooker_03','s_f_y_migrant_01','s_f_y_movprem_01','s_f_y_shop_low','s_f_y_shop_mid','s_f_y_stripperlite','s_f_y_stripper_01','s_f_y_stripper_02','s_f_y_sweatshop_01','u_f_m_miranda','u_f_m_promourn_01','u_f_o_moviestar','u_f_o_prolhost_01','u_f_y_bikerchic','u_f_y_comjane','u_f_y_hotposh_01','u_f_y_jewelass_01','u_f_y_mistress','u_f_y_poppymich','u_f_y_princess','u_f_y_spyactress'} ems_models = {'csb_mweather','csb_prolsec','csb_ramp_marine','s_f_y_ranger_01','s_f_y_scrubs_01','s_f_y_sheriff_01','s_m_m_armoured_01','s_m_m_armoured_02','s_m_m_chemsec_01','s_m_m_fiboffice_01','s_m_m_marine_01','s_m_m_marine_02','s_m_m_paramedic_01','s_m_m_prisguard_01','s_m_m_security_01','s_m_m_snowcop_01','s_m_y_blackops_01','s_m_y_blackops_02','s_m_y_doorman_01','s_m_y_fireman_01','s_m_y_hwaycop_01','s_m_y_marine_01','s_m_y_marine_02','s_m_y_marine_03','s_m_y_ranger_01','s_m_y_sheriff_01','s_m_y_swat_01'} mp_models = {'mp_g_m_pros_01','mp_m_exarmy_01','mp_m_fibsec_01'} gang_models = {'task_diff_000_c_uni'} freemode_models = {'mp_m_freemode_01','mp_f_freemode_01'} menu_options = { {name = "Tøj", f = customise, param = nil}, {name = "Tilbehør", f = accessories, param = nil}, {name = "Ansigt", f = overlays, param = nil}, {name = "Mande modeller", f = listModels, param = male_models}, {name = "Pige modeller", f = listModels, param = female_models}, {name = "Bande Tøj", f = listModels, param = gang_models}, --{name = "Online Player modeller", f = listModels, param = mp_models}, {name = "Tilpas din egen", f = listModels, param = freemode_models}, } player_data = { model = GetHashKey("mp_m_freemode_01"), new = true, clothing = { drawables = {}, textures = { 1,1,1 }, palette = {}, }, props = { drawables = {}, textures = {}, }, overlays = { drawables = {}, opacity = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, colours = { {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, }, }, } player_data = { model = GetHashKey("mp_m_freemode_01"), new = true, clothing = { drawables = {}, textures = { 1,1,1 }, palette = {}, }, props = { drawables = {}, textures = {}, }, overlays = { drawables = {}, opacity = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}, colours = { {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, {colourType = 0, colour = 0}, }, }, } local clothing_shops = { {name="Tøjbutik", id=73, x=1930.5389404297, y=3732.0217285156, z=32.8944557189941}, -- Sandy {name="Tøjbutik", id=73, x=72.2545394897461, y=-1399.10229492188, z=29.3961386871338}, -- Ved Hospitalet {name="Tøjbutik", id=73, x=123.64656829834, y=-219.440338134766, z=54.5678384399414}, -- Suburban {name="Tøjbutik", id=73, x=107.4951248169, y=-1304.8098144532, z=28.768795013428}, -- Stripper {name="Tøjbutik", id=73, x=-708.09820556641, y=-160.13116455078, z=37.44}, -- Ponsoboys Smykkebutik {name="Tøjbutik", id=73, x=-829.42053222656, y=-1073.6610107422, z=11.35}, -- BINCO VED NY HAVN {name="Tøjbutik", id=73, x=-1192.1893310547, y=-771.62634277344, z=17.33}, {name="Tøjbutik", id=0, x=-250.56561279297, y=6329.7514648438, z=32.536328887939}, -- Læge (Paleto) {name="Tøjbutik", id=0, x=450.73522949219, y=-992.59075927734, z=30.689588546753}, -- pd midtby {name="Tøjbutik", id=73, x=11.576325416565, y=6514.2587890625, z=31.88}, --PALETO {name="Tøjbutik", id=73, x=424.04415893555, y=-800.05133056641, z=29.502628326416}, --Midtby {name="Tøjbutik", id=0, x=299.0729675293, y=-598.4111328125, z=43.304019470215}, --Hospital {name="Tøjbutik", id=0, x=120.74685668945, y=-742.20629882813, z=242.25211486816}, {name="Tøjbutik", id=0, x=-1514.9837646484, y=109.6732711792, z=51.947839355469}, {name="Tøjbutik", id=0, x=1848.8012695313, y=3695.5759277344, z=34.261947631836}, {name="Tøjbutik", id=0, x=75.60033416748, y=-1967.2934570313, z=21.117895126343}, --Ballas {name="Tøjbutik", id=0, x=-812.00500488281, y=175.01802062988, z=76.745338439941}, --Mafia {name="Tøjbutik", id=0, x=1399.2115478516, y=1165.2478027344, z=114.3335723877}, -- Cartel {name="Tøjbutik", id=0, x=-78.44213104248, y=-812.21673583984, z=243.39580322266}, -- DVS {name="Tøjbutik", id=0, x=-439.84332275391, y=5992.1821289063, z=31.816152191162}, -- Paleto pd {name="Tøjbutik", id=0, x=-131.42506408691, y=-634.28845214844, z=168.82034301758}, -- Advokat {name="Tøjbutik", id=0, x=-1113.4873046875, y=-818.89080810547, z=-46.27010345459}, -- PET {name="Tøjbutik", id=0, x=-900.32214355469, y=-1446.505859375, z=7.5268034934998}, -- Yakuza } incircle = false Citizen.CreateThread(function() for _, item in pairs(clothing_shops) do item.blip = AddBlipForCoord(item.x, item.y, item.z) SetBlipSprite(item.blip, item.id) SetBlipColour(item.blip, item.colour) SetBlipScale(item.blip,0.6) SetBlipAsShortRange(item.blip, true) BeginTextCommandSetBlipName("STRING") AddTextComponentString(item.name) EndTextCommandSetBlipName(item.blip) end while true do Citizen.Wait(0) local pos = GetEntityCoords(GetPlayerPed(-1), true) for k,v in ipairs(clothing_shops) do if(Vdist(pos.x, pos.y, pos.z, v.x, v.y, v.z) < 7.5)then DrawMarker(27, v.x, v.y, v.z - 1, 0, 0, 0, 0, 0, 0, 2.0001, 2.0001, 0.5001, 1555, 0, 0,165, 0, 0, 0,0) local player = GetPlayerPed(-1) local health = GetEntityHealth(player) if GetDistanceBetweenCoords(v.x, v.y, v.z, GetEntityCoords(GetPlayerPed(-1))) < 3 then if health >= 106 then DisplayHelpText(v.x, v.y, v.z, "Tryk ~g~E~s~ for at benytte tøjshoppen") elseif health < 106 then DisplayHelpText(v.x, v.y, v.z, "Du kan ~r~ikke~s~ benytte tøjshoppen som død") DisableControlAction(0,51,true) -- Stopper dig for at kunne åbne menuen end incircle = true if IsControlJustReleased(1, 51) then -- INPUT_CELLPHONE_DOWN GUI.maxVisOptions = 20 titleTextSize = {0.85, 0.80} ------------ {p1, Size} titleRectSize = {0.23, 0.085} ----------- {Width, Height} optionTextSize = {0.5, 0.5} ------------- {p1, Size} optionRectSize = {0.23, 0.035} ---------- {Width, Height} menuX = 0.745 ----------------------------- X position of the menu menuXOption = 0.11 --------------------- X postiion of Menu.Option text menuXOtherOption = 0.06 ---------------- X position of Bools, Arrays etc text menuYModify = 0.1500 -------------------- Default: 0.1174 ------ Top bar menuYOptionDiv = 4.285 ------------------ Default: 3.56 ------ Distance between buttons menuYOptionAdd = 0.21 ------------------ Default: 0.142 ------ Move buttons up and down clothing_menu = not clothing_menu OpenClothes() end elseif(Vdist(pos.x, pos.y, pos.z, v.x, v.y, v.z) > 3.0)then incircle = false if clothing_menu then save() end clothing_menu = false end end end if clothing_menu then Menu.DisplayCurMenu() end end end)
----------------------------------------- -- ID: 5151 -- Item: plate_of_urchin_sushi -- Food Effect: 30Min, All Races ----------------------------------------- -- Health 40 -- Strength 1 -- Vitality 5 -- Accuracy % 15 (cap 72) -- Ranged ACC % 15 (cap 72) ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if target:hasStatusEffect(tpz.effect.FOOD) or target:hasStatusEffect(tpz.effect.FIELD_SUPPORT_FOOD) then result = tpz.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(tpz.effect.FOOD, 0, 0, 1800, 5151) end function onEffectGain(target, effect) target:addMod(tpz.mod.HP, 40) target:addMod(tpz.mod.STR, 1) target:addMod(tpz.mod.VIT, 5) target:addMod(tpz.mod.FOOD_ACCP, 15) target:addMod(tpz.mod.FOOD_ACC_CAP, 72) target:addMod(tpz.mod.FOOD_RACCP, 15) target:addMod(tpz.mod.FOOD_RACC_CAP, 72) end function onEffectLose(target, effect) target:delMod(tpz.mod.HP, 40) target:delMod(tpz.mod.STR, 1) target:delMod(tpz.mod.VIT, 5) target:delMod(tpz.mod.FOOD_ACCP, 15) target:delMod(tpz.mod.FOOD_ACC_CAP, 72) target:delMod(tpz.mod.FOOD_RACCP, 15) target:delMod(tpz.mod.FOOD_RACC_CAP, 72) end
util.AddNetworkString("Send Voting") util.AddNetworkString("Send Voting Choice") net.Receive("Send Voting Choice", function(_, pl) local choice = net.ReadString() if not pl.CanVote or not MapVoting.Maps[choice] then return end pl.CanVote = false MapVoting.Maps[choice] = MapVoting.Maps[choice] + 1 end) function MapVoting.Start() for _, pl in pairs(player.GetAll()) do pl.CanVote = true net.Start("Send Voting") net.WriteTable(MapVoting.Maps) net.Send(pl) end timer.Simple(MapVoting.Timer, function() RunConsoleCommand("changelevel", table.GetWinningKey(MapVoting.Maps)) end) end
-- -- Created by IntelliJ IDEA. -- User: lucien -- Date: 2016/11/18 -- Time: 16:12 -- To change this template use File | Settings | File Templates. -- local Errors = require "kong.dao.errors" local SUB_HOST = os.getenv("SUB_HOST") or "127.0.0.1" local SUB_PORT = os.getenv("SUB_PORT") or 9001 return { no_consumer = true, -- this plugin will only be API-wide, fields = { -- Describe your plugin's configuration's schema here. zmq_host = {type = "string", required = true, default=SUB_HOST}, zmq_port = {type = "number", required = true, default=SUB_PORT}, zmq_topic = {type = "string", required = false, default="weblog"}, }, self_check = function(schema, plugin_t, dao, is_updating) -- perform any custom verification local zmq_host = plugin_t.zmq_host local zmq_port = plugin_t.zmq_port if not string.find(zmq_host, "^%d+.%d+.%d+.%d+$") then return false, Errors.schema "zmq host must be ip" end if zmq_port < 1 then return false, Errors.schema "zmq port must be port" end return true end }
cflags{ '-D _GNU_SOURCE', [[-D 'SYSCONFDIR="/etc/libnl"']], '-I $dir', '-I $outdir/include', '-I $srcdir/include', '-I $srcdir/include/linux-private', } build('sed', '$outdir/include/netlink/version.h', '$srcdir/include/netlink/version.h.in', { expr={ '-e s,@PACKAGE_STRING@,\'libnl 3.5.0\',', '-e s,@PACKAGE_VERSION@,3.5.0,', '-e s,@MAJ_VERSION@,3,', '-e s,@MIN_VERSION@,5,', '-e s,@MIC_VERSION@,0,', '-e s,@LT_CURRENT@,226,', '-e s,@LT_REVISION@,0,', '-e s,@LT_AGE@,26,', }, }) pkg.hdrs = { copy('$outdir/include/netlink', '$srcdir/include/netlink', { 'addr.h', 'attr.h', 'cache.h', 'cache-api.h', 'data.h', 'errno.h', 'handlers.h', 'hash.h', 'hashtable.h', 'list.h', 'msg.h', 'netlink.h', 'netlink-compat.h', 'netlink-kernel.h', 'object.h', 'object-api.h', 'socket.h', 'types.h', 'utils.h', 'genl/ctrl.h', 'genl/family.h', 'genl/genl.h', 'genl/mngt.h', }), '$outdir/include/netlink/version.h', } lib('libnl-3.a', [[lib/( addr.c attr.c cache.c cache_mngr.c cache_mngt.c data.c error.c handlers.c msg.c nl.c object.c socket.c utils.c version.c hash.c hashtable.c mpls.c )]], {'$dir/headers'}) lib('libnl-genl-3.a', 'lib/genl/(ctrl.c family.c genl.c mngt.c)', {'$dir/headers'}) fetch 'git'
-------------------------------------------------------------------------------- -- 81-508t electric schemes -------------------------------------------------------------------------------- -- Copyright (C) 2013-2018 Metrostroi Team & FoxWorks Aerospace s.r.o. -- Contains proprietary code. See license.txt for additional information. -------------------------------------------------------------------------------- Metrostroi.DefineSystem("81_508T_Electric") function TRAIN_SYSTEM:Initialize(typ1,typ2) self.ThyristorController = true -- Load all functions from base Metrostroi.BaseSystems["Electric"].Initialize(self) for k,v in pairs(Metrostroi.BaseSystems["Electric"]) do if not self[k] and type(v) == "function" then self[k] = v end end self.RRI = 0 self.SolvePowerCircuits = Metrostroi.BaseSystems["81_710_Electric"].SolvePowerCircuits self.SolveThyristorController = Metrostroi.BaseSystems["81_710_Electric"].SolveThyristorController self.Think = Metrostroi.BaseSystems["81_710_Electric"].Think end if CLIENT then return end function TRAIN_SYSTEM:Inputs(...) return { "Type", "RRI" } end function TRAIN_SYSTEM:Outputs(...) return Metrostroi.BaseSystems["Electric"].Outputs(self,...) end -- Node values local S = {} -- Converts boolean expression to a number local function C(x) return x and 1 or 0 end local min = math.min local max = math.max function TRAIN_SYSTEM:SolveAllInternalCircuits(Train,dT,firstIter) local RheostatController = Train.RheostatController local P = Train.PositionSwitch.SelectedPosition local RK = Train.RheostatController.SelectedPosition local B = (Train.Battery.Voltage > 55) and 1 or 0 local T = Train.SolverTemporaryVariables if not T then T = {} for i=1,100 do T[i] = 0 end Train.SolverTemporaryVariables = T end local BO = min(1,B * Train.VB.Value+T[10])--B * Train.VB.Value local KV = Train.KV local KRU = Train.KRU local Panel = Train.Panel Panel.V1 = BO Train:WriteTrainWire(10,B*Train.VB.Value) S["10AK"] = BO*Train.VU.Value --10AK->AV --FIXME SAMM S["U2"] = S["10AK"]*KV["U2-10AK"] S["7G"] = BO*KV["7D-7G"] Train:WriteTrainWire(1,S["10AK"]*KV["10AK-1"]*Train.R1_5.Value) Train:WriteTrainWire(2,S["U2"]*KV["U2-2"]) Train:WriteTrainWire(3,S["U2"]*KV["U2-3"]) Train:WriteTrainWire(4,S["10AK"]*KV["U2-4"]) Train:WriteTrainWire(5,S["10AK"]*KV["U2-5"]) Train:WriteTrainWire(6,S["10AK"]*Train.RVT.Value) Train:WriteTrainWire(8,BO*KV["10-8"]) Train:WriteTrainWire(14,BO*KV["10-14A"]*KV["14A-14B"]) Train:WriteTrainWire(17,S["10AK"]*KV["10AK-17"]*Train.KU9.Value) Train:WriteTrainWire(20,S["U2"]*KV["U2-20"]) Train:WriteTrainWire(24,S["U2"]*Train.KU8.Value) Train:WriteTrainWire(25,S["U2"]*KV["U2-6"]*KV["6-25"]*Train.K25.Value) Train.RVT:TriggerInput("Set",S["U2"]*KV["U2-6"]) Train.K25:TriggerInput("Set",S["U2"]*KV["U2-6"]) Train.RV2:TriggerInput("Set",S["10AK"]*KV["33-10AK"]) Train.R1_5:TriggerInput("Set",S["10AK"]*Train.RV2.Value) Panel.AnnouncerPlaying = T[13] Train:WriteTrainWire(34,Train.RKTT.Value+Train.DKPT.Value) Panel.RRP = S["U2"]*T[18] local RCU = KV.RCU S["ZR"] = (1-Train.RRU.Value)+(B*Train.RRU.Value)*-1 Train.RZ_2:TriggerInput("Set",T[24]*RCU*(1-Train.LK4.Value)) S["18A"] = RCU*(Train.RPvozvrat.Value*100+(1-Train.LK4.Value)) Train:WriteTrainWire(18,S["18A"]) Panel.TW18 = S["18A"] local Reverser = Train.Reverser S["4A"] = T[4]*RCU S["5A"] = T[5]*RCU Reverser:TriggerInput("NZ",S["4A"]*Reverser.VP) Reverser:TriggerInput("VP",S["5A"]*Reverser.NZ) Train.LK4:TriggerInput("Set",(S["4A"]*Reverser.NZ+S["5A"]*Reverser.VP)*(1-Train.RPvozvrat.Value)*Train.LK3.Value*S["ZR"]) Train.PneumaticNo1:TriggerInput("Set",T[8]*C(17 <= RK and RK <= 18)+T[9]) --Train.PneumaticNo2:TriggerInput("Set",T[8]*(1-Train.RV3.Value)*(1-Train.RT2.Value)*((1-Train.LK4.Value)+C(RK==1))) Train.PneumaticNo2:TriggerInput("Set",T[8]*(1-Train.RT2.Value)*((1-Train.LK4.Value)+C(RK==1))) Train.RV3:TriggerInput("Set",T[14]) S["10A"] = BO*RCU self.ThyristorControllerPower = S["10A"] S["10B"] = S["10A"]*(Train.RV1.Value+Train.TR1.Value) --Train["RUTreg"] = T[9] S["10I"] = S["10A"]*RheostatController.RKM2 Train["RUTpod"] = S["10I"]*Train.LK4.Value Train["RRTpod"] = S["10I"]*(1-Train.LK1.Value) Train.RRT:TriggerInput("Close",Train.RRTuderzh*Train.RRTpod) Train.RRT:TriggerInput("Open",(1-Train.RRTuderzh)) local SDRKr = 1-Train.LK2.Value*(0.2+0.3*C(2 <=RK and RK <= 7 and P==1)) RheostatController:TriggerInput("MotorCoilState",min(1,S["10A"]*(S["10B"]*Train.RR.Value - S["10B"]*(1-Train.RR.Value)))*SDRKr) S["10N"] = S["10A"]*(RheostatController.RKM1+Train.SR1.Value*(1-Train.RUT.Value)) S["10T"] = ((1-Train.SR1.Value)+Train.RUT.Value)*(RheostatController.RKP) RheostatController:TriggerInput("MotorState",(S["10N"]+S["10T"]*(-10))) --СДПП S["10AV"] = S["10A"]*(1-Train.LK3.Value)*C(2<=RK and RK<=18)*(1-Train.LK4.Value) S["10E"] = S["10A"]*((1-Train.LK3.Value)+Train.Rper.Value+Train.PositionSwitch.PMPos) Train.SR2:TriggerInput("Set",S["10E"]*((C(P==3 or P==4)+Train.LK2.Value))*(1-Train.LK4.Value)) S["10AD"] = (1-Train.LK1.Value)*Train.SR2.Value S["10AYu"] = S["10AD"]*(1-Train.RPP.Value) S["10AZh"] = S["10AD"]* Train.TR1.Value*C(P==1 or P==2 or P==4) S["10AR"] = S["10AYu"]*(1-Train.TR1.Value)*C(2<=P and P<=4) S["10Ya"] = Train.LK3.Value*C(RK==18 and (P==1)) S["10AG"] = S["10E"]*(S["10AR"]+S["10AZh"]+S["10Ya"]) Train.PositionSwitch:TriggerInput("MotorState",-1.0 + 2.0*math.max(0,S["10AG"])) S["2A"] = T[2]*RCU S["2G"] = S["2A"]*((1-Train.TR1.Value)+(1-Train.KSB1.Value)+Train.ThyristorBU5_6.Value)*( C(1<=RK and RK<=17 and (P==1 or P==3) or (6<=RK and RK<=18 or 2<=RK and RK<=5 and Train.KSH1.Value>0 ) and (P==2 or P==4) ) ) S["2E"] = S["2G"]*Train.LK4.Value+S["10AV"] Train.RV1:TriggerInput("Set",S["2E"]*S["ZR"]) Train.SR1:TriggerInput("Set",S["2E"]*(1-Train.RRT.Value)*S["ZR"]) Train.Rper:TriggerInput("Set",T[3]*RCU*C(17<=RK and RK<=18)*S["ZR"]) Train.RU:TriggerInput("Set",S["2A"]) Train.RRU:TriggerInput("Set",T[29]) S["6A"] = T[6]*RCU Train.TR1:TriggerInput("Set",S["6A"]) Train.RPP:TriggerInput("Set",S["6A"]) S["6G"] = S["6A"]*C(P==3 or P==4) S["6Yu"] = S["6G"]*C(1<=RK and RK<=2) Train.KSB1:TriggerInput("Set",S["6Yu"]) Train.KSB2:TriggerInput("Set",S["6Yu"]) Train.RUP:TriggerInput("Set",S["6Yu"]) self.ThyristorControllerWork = S["6Yu"]+S["6G"]*Train.RUP.Value S["1A"] = T[1]*RCU S["1R"] = S["1A"]*((1-Train.RV1.Value)*C(P==1)+C(1<=RK and RK<=5 and P==2)) Train.KSH2:TriggerInput("Set",S["1R"]*S["ZR"]) --Идет обратная цепь от ЛК к 1 проводу, но мне лень Train.KSH1:TriggerInput("Set",S["1R"]*S["ZR"]) --Идет обратная цепь от ЛК к 1 проводу, но мне лень S["1P"] = S["1A"]*C(P == 1 or P == 2)*Train.NR.Value+S["6A"]*C(P==3 or P==4) Train["RUTavt"] = S["1P"]*(Train.KSB1.Value+Train.KSH2.Value)*S["ZR"] --Идет обратная цепь от ЛК к 1 проводу, но мне лень S["1G"] = S["1P"]*Train.AVT.Value*(1-Train.RPvozvrat.Value) S["1Zh"] = S["1G"]*(Train.LK3.Value+C(RK==1)*(Train.KSH2.Value+Train.KSB1.Value*Train.KSB2.Value)*C(P==1 or P==3)*Train.LK5.Value) Train.LK1:TriggerInput("Set",S["1Zh"]*C(P==1 or P==2)*S["ZR"]) Train.LK3:TriggerInput("Set",S["1Zh"]*S["ZR"]) Train.RR:TriggerInput("Set",S["1Zh"]*C(P==1 or P==3)*S["ZR"]) Train.RPvozvrat:TriggerInput("Open",T[17]*RCU) --FIXME Mayve more right RP code S["20A"] = T[20]*RCU Train.LK2:TriggerInput("Set",S["20A"]*S["ZR"]) Train.LK5:TriggerInput("Set",S["20A"]*(1-Train.RPvozvrat.Value)*S["ZR"]) Train["RRTuderzh"] = T[25] Train.RKTTsh = T[30] --Вспом цепи низкого напряжения Train:WriteTrainWire(11,BO*Train.VU2.Value) Train:WriteTrainWire(22,BO*Train.V1.Value*Train.AK.Value) Train:WriteTrainWire(23,BO*Train.KU15.Value) Train:WriteTrainWire(27,BO*Train.V4.Value) Train:WriteTrainWire(28,BO*Train.V5.Value) Panel.GRP = BO*Train.RPvozvrat.Value S["F7"] = BO*KV["F-F7"] Panel.Headlights1 = S["F7"] Panel.Headlights2 = S["F7"]*Train.VU14.Value S["D1"] = BO*KV["D-D1"] Train:WriteTrainWire(31,S["D1"]*(Train.V6.Value+Train.KU12.Value)) Train:WriteTrainWire(32,S["D1"]*Train.KU7.Value) Train:WriteTrainWire(12,S["D1"]*Train.V10.Value) Train:WriteTrainWire(16,S["D1"]*Train.V2.Value*Train.V3.Value) S["11A"] = T[11]*(1-Train.NR.Value) Panel.EmergencyLights1 = BO*Train.VU3.Value+S["11A"]*(1-Train.VU3.Value) Panel.EmergencyLights2 = S["11A"] Panel.MainLights1 = math.max(0,math.min(1, ( self.Aux750V-100 -self.Itotal*0.25*C(Train.PositionSwitch.SelectedPosition >= 3) -25*Train.KK.Value )/750*(0.5+0.5*B*Train.VB.Value*Train.KZ1.Value) )) Panel.MainLights2 = Panel.MainLights1*Train.KO.Value Train.KK:TriggerInput("Set",T[22]+T[23]) Train.KO:TriggerInput("Close",T[27]) Train.KO:TriggerInput("Open",T[28]) local BD = 1-Train.BD.Value Train:WriteTrainWire(15,BD*(1-Train.KU11.Value))--Заземление 15 провода Train.Panel.SD = (S["D1"]+BO*Train.KU11.Value)*(T[15]*(1-Train.KU11.Value)+BD) Train.VDZ:TriggerInput("Set",T[16]*BD) Train.VDOL:TriggerInput("Set",T[31]+T[12]) Train.VDOP:TriggerInput("Set",T[32]+T[12]) Panel.CBKIPower = T[10] end function TRAIN_SYSTEM:SolveRKInternalCircuits(Train,dT,firstIter) local RheostatController = Train.RheostatController local P = Train.PositionSwitch.SelectedPosition local RK = Train.RheostatController.SelectedPosition local B = (Train.Battery.Voltage > 55) and 1 or 0 local T = Train.SolverTemporaryVariables local BO = min(1,B * Train.VB.Value+T[10])--B * Train.VB.Value --local KV = Train.KV --local Panel = Train.Panel local RCU = Train.KV.RCU S["ZR"] = (1-Train.RRU.Value)+(B*Train.RRU.Value)*-1 S["10A"] = BO*RCU S["10I"] = S["10A"]*RheostatController.RKM2 Train.Panel.Sequence =S["10A"]*RheostatController.RKM1 Train["RUTpod"] = S["10I"]*Train.LK4.Value Train["RRTpod"] = S["10I"]*(1-Train.LK1.Value) Train["RRTuderzh"] = T[25] Train.RRT:TriggerInput("Close",Train.RRTuderzh*Train.RRTpod) Train.RRT:TriggerInput("Open",(1-Train.RRTuderzh)) local SDRKr = 1-Train.LK2.Value*(0.2+0.3*C(2 <=RK and RK <= 7 and P==1)) RheostatController:TriggerInput("MotorCoilState",min(1,S["10A"]*(S["10B"]*Train.RR.Value - S["10B"]*(1-Train.RR.Value)))*SDRKr) S["10N"] = S["10A"]*(RheostatController.RKM1+Train.SR1.Value*(1-Train.RUT.Value)) S["10T"] = ((1-Train.SR1.Value)+Train.RUT.Value)*(RheostatController.RKP) RheostatController:TriggerInput("MotorState",(S["10N"]+S["10T"]*(-10))) S["2A"] = T[2]*RCU S["2G"] = S["2A"]*((1-Train.TR1.Value)+(1-Train.KSB1.Value)+Train.ThyristorBU5_6.Value)*( C(1<=RK and RK<=17 and (P==1 or P==3) or (6<=RK and RK<=18 or 2<=RK and RK<=5 and Train.KSH1.Value>0 ) and (P==2 or P==4) ) ) S["2E"] = S["2G"]*Train.LK4.Value+S["10AV"] Train.RV1:TriggerInput("Set",S["2E"]*S["ZR"]) Train.SR1:TriggerInput("Set",S["2E"]*(1-Train.RRT.Value)*S["ZR"]) Train.Rper:TriggerInput("Set",T[3]*RCU*C(17<=RK and RK<=18)*S["ZR"]) --[[ S["1A"] = T[1]*RCU S["1R"] = S["1A"]*((1-Train.RV1.Value)*C(P==1)+C(1<=RK and RK<=5 and P==2)) Train.KSH2:TriggerInput("Set",S["1R"]*S["ZR"]) --Идет обратная цепь от ЛК к 1 проводу, но мне лень Train.KSH1:TriggerInput("Set",S["1R"]*S["ZR"]) --Идет обратная цепь от ЛК к 1 проводу, но мне лень Train.NR:TriggerInput("Set",1) S["1P"] = S["1A"]*C(P == 1 or P == 2)*Train.NR.Value+S["6A"]*C(P==3 or P==4) Train["RUTavt"] = S["1P"]*(Train.KSB1.Value+Train.KSH2.Value)*S["ZR"] --Идет обратная цепь от ЛК к 1 проводу, но мне лень S["1G"] = S["1P"]*Train.AVT.Value*(1-Train.RPvozvrat.Value) S["1Zh"] = S["1G"]*(Train.LK3.Value+C(RK==1)+(Train.KSH2.Value+Train.KSB1.Value*Train.KSB2.Value+C(P==1 or P==3))*Train.LK5.Value) Train.LK1:TriggerInput("Set",S["1Zh"]*C(P==1 or P==2)*S["ZR"]) Train.LK3:TriggerInput("Set",S["1Zh"]*S["ZR"]) Train.RR:TriggerInput("Set",S["1Zh"]*C(P==1 or P==3)*S["ZR"])--]] return S end local wires = {1,2,3,4,5,6,8,10,9,13,14,17,18,20,25,11,12,15,16,22,23,24,27,28,29,30,31,32} function TRAIN_SYSTEM:SolveInternalCircuits(Train,dT,firstIter) local T = Train.SolverTemporaryVariables if not T then T = {} for i,v in ipairs(wires) do T[v] = 0 end Train.SolverTemporaryVariables = T end if firstIter then for i,v in ipairs(wires) do T[v] = min(Train:ReadTrainWire(v),1) end self:SolveAllInternalCircuits(Train,dT) else self:SolveRKInternalCircuits(Train,dT) end end
local helpers = require "spec.helpers" local cjson = require "cjson" local utils = require "kong.tools.utils" local to_hex = require "resty.string".to_hex local fmt = string.format local function gen_trace_id() return to_hex(utils.get_rand_bytes(16)) end local function gen_span_id() return to_hex(utils.get_rand_bytes(8)) end for _, strategy in helpers.each_strategy() do describe("propagation tests #" .. strategy, function() local service local proxy_client lazy_setup(function() local bp = helpers.get_db_utils(strategy, { "services", "routes", "plugins" }) -- enable opentelemetry plugin globally pointing to mock server bp.plugins:insert({ name = "opentelemetry", config = { -- fake endpoint, request to backend will sliently fail endpoint = "http://localhost:8080/v1/traces", } }) service = bp.services:insert() -- kong (http) mock upstream bp.routes:insert({ service = service, hosts = { "http-route" }, }) helpers.start_kong({ database = strategy, nginx_conf = "spec/fixtures/custom_nginx.template", }) proxy_client = helpers.proxy_client() end) teardown(function() helpers.stop_kong() end) it("propagates tracing headers (b3 request)", function() local trace_id = gen_trace_id() local r = proxy_client:get("/", { headers = { ["x-b3-sampled"] = "1", ["x-b3-traceid"] = trace_id, host = "http-route", }, }) local body = assert.response(r).has.status(200) local json = cjson.decode(body) assert.equals(trace_id, json.headers["x-b3-traceid"]) assert.matches("00%-" .. trace_id .. "%-%x+-01", json.headers.traceparent) end) describe("propagates tracing headers (b3-single request)", function() it("with parent_id", function() local trace_id = gen_trace_id() local span_id = gen_span_id() local parent_id = gen_span_id() local r = proxy_client:get("/", { headers = { b3 = fmt("%s-%s-%s-%s", trace_id, span_id, "1", parent_id), host = "http-route", }, }) local body = assert.response(r).has.status(200) local json = cjson.decode(body) assert.matches(trace_id .. "%-%x+%-1%-%x+", json.headers.b3) assert.matches("00%-" .. trace_id .. "%-%x+-01", json.headers.traceparent) end) it("without parent_id", function() local trace_id = gen_trace_id() local span_id = gen_span_id() local r = proxy_client:get("/", { headers = { b3 = fmt("%s-%s-1", trace_id, span_id), host = "http-route", }, }) local body = assert.response(r).has.status(200) local json = cjson.decode(body) assert.matches(trace_id .. "%-%x+%-1", json.headers.b3) assert.matches("00%-" .. trace_id .. "%-%x+-01", json.headers.traceparent) end) end) it("propagates w3c tracing headers", function() local trace_id = gen_trace_id() -- w3c only admits 16-byte trace_ids local parent_id = gen_span_id() local r = proxy_client:get("/", { headers = { traceparent = fmt("00-%s-%s-01", trace_id, parent_id), host = "http-route" }, }) local body = assert.response(r).has.status(200) local json = cjson.decode(body) assert.matches("00%-" .. trace_id .. "%-%x+-01", json.headers.traceparent) end) it("propagates jaeger tracing headers", function() local trace_id = gen_trace_id() local span_id = gen_span_id() local parent_id = gen_span_id() local r = proxy_client:get("/", { headers = { ["uber-trace-id"] = fmt("%s:%s:%s:%s", trace_id, span_id, parent_id, "1"), host = "http-route" }, }) local body = assert.response(r).has.status(200) local json = cjson.decode(body) -- Trace ID is left padded with 0 for assert assert.matches( ('0'):rep(32-#trace_id) .. trace_id .. ":%x+:" .. span_id .. ":01", json.headers["uber-trace-id"]) end) it("propagates ot headers", function() local trace_id = gen_trace_id() local span_id = gen_span_id() local r = proxy_client:get("/", { headers = { ["ot-tracer-traceid"] = trace_id, ["ot-tracer-spanid"] = span_id, ["ot-tracer-sampled"] = "1", host = "http-route", }, }) local body = assert.response(r).has.status(200) local json = cjson.decode(body) assert.equals(trace_id, json.headers["ot-tracer-traceid"]) end) end) end
local cutil = require('cutil') local s = {} function s.serialize_orig(o) local str = ""; if type(o) == "number" then str = tostring(o); elseif type(o) == "string" then str = string.format("%q",o); elseif type(o) == "table" then str = "{"; for k,v in pairs(o) do str = str..string.format("[%s]=%s,",serialize_orig(k),serialize_orig(v)); end str = str.."}"; else str = "nil"; end return str; end --New serialization code omiting integer indexes for tables --Only do recursive call if v is a table -- Pack size 2.3X smaller, Serilization time 3.4X faster on OP function s.serialize(o) local str = ""; if type(o) == "number" then if o%1==0 then --quickest check for integer str=tostring(o); else str = string.format("%.2f",o);--2-digit precision end elseif type(o) == "string" then str = string.format("%q",o); elseif type(o) == "table" then str = "{"; local is_num=true; for k,v in pairs(o) do if type(k)=="string" then if type(v) == "number" then if v%1==0 then --quickest check for integer str = str..string.format("[%q]=%d,",k,v); else str = str..string.format("[%q]=%.2f,",k,v); end elseif type(v)=="string" then str = str..string.format("[%q]=%q,",k,v); elseif type(v)=="table" then str = str..string.format("[%q]=%s,",k, s.serialize(v)); end else if type(v) == "number" then if v%1==0 then --quickest check for integer str = str..string.format("%d,",v); else str = str..string.format("%.2f,",v); end elseif type(v)=="string" then str = str..string.format("%q,",v); elseif type(v)=="table" then str = str..string.format("%s,", s.serialize(v)); end end end str = str.."}"; else str = "nil"; end return str; end function s.serialize_array(ud, width, height, dtype, arrName, arrID) -- function s.to serialize an userdata array -- returns an array of lua arr tables -- Max size of a UDP packet local maxSize = 2^16 - 2^12; local dsize = cutil.sizeof(dtype); local arrSize = width*height*dsize; -- determine break size account for byte->ascii local rowSize = 2*width*dsize; local nrows = math.floor(maxSize/rowSize); local npackets = math.ceil(height/nrows); local ret = {}; local cptr = ud; local rowsRemaining = height; for p = 1,npackets do local crows = math.min(nrows, rowsRemaining); rowsRemaining = rowsRemaining - crows; local name = string.format('%s.%d.%d.%d', arrName, arrID, p, npackets); ret[p] = cutil.array2string(cptr, width, crows, dtype, name); cptr = cutil.ptr_add(cptr, width*crows, dtype); end return ret; end --For sending yuyv image --We don't care even rows in yuyv --So just skip every other line and save 1/2 bandwidth function s.serialize_array2(ud, width, height, dtype, arrName, arrID) -- function to serialize an userdata array -- returns an array of lua arr tables -- Max size of a UDP packet local maxSize = 2^16 - 2^12; local dsize = cutil.sizeof(dtype); local arrSize = width*height*dsize/2; --skip every other line -- determine break size account for byte->ascii local rowSize = 2*width*dsize; local nrows = math.floor(maxSize/rowSize)*2; --skip every other line local npackets = math.ceil(height/nrows); local ret = {}; local cptr = ud; local rowsRemaining = height; for p = 1,npackets do local crows = math.min(nrows, rowsRemaining); rowsRemaining = rowsRemaining - crows; local name = string.format('%s.%d.%d.%d', arrName, arrID, p, npackets); ret[p] = cutil.array2string2(cptr, width, crows, dtype, name); --skip every other line cptr = cutil.ptr_add(cptr, width*crows, dtype); end return ret; end --Label-only serialization code --Exploiting label data range (0-31) to pack each label to a single byte function s.serialize_label(ud, width, height, dtype, arrName, arrID) local dsize = cutil.sizeof(dtype); local arrSize = width*height*dsize; local ret = {}; local cptr = ud; local name = string.format('%s.%d.1.1', arrName, arrID); ret = cutil.label2string(cptr, width*height, dtype, name); return ret; end --Double-packing function s.serialize_label_double(ud, width, height, dtype, arrName, arrID) local dsize = cutil.sizeof(dtype); local arrSize = width*height*dsize; local ret = {}; local cptr = ud; local name = string.format('%s.%d.1.1', arrName, arrID); ret = cutil.label2string_double(cptr, width*height, dtype, name); return ret; end --Run-length enclding function s.serialize_label_rle(ud, width, height, dtype, arrName, arrID) local dsize = cutil.sizeof(dtype); local arrSize = width*height*dsize; local ret = {}; local cptr = ud; local name = string.format('%s.%d.1.1', arrName, arrID); ret = cutil.label2string_rle(cptr, width*height, dtype, name); return ret; end function s.deserialize(s) --local x = assert(loadstring("return "..s))(); if not s then return ''; end -- protected loadstring call ok, ret = pcall(loadstring('return '..s)); --local x = loadstring("return "..s)(); if not ok then --print(string.format("Warning: Could not deserialize message:\n%s",s)); return ''; else return ret; end end return s
--- Mouse over mixin for general utility button mouse over effects -- @module MouseOverMixin local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore")) local Maid = require("Maid") local module = {} function module:Add(class) assert(class) assert(not class.GetMouseOverColor) class.GetMouseOverColor = self.GetMouseOverColor class.GetMouseOverBoolValue = self.GetMouseOverBoolValue class.AddMouseOverEffect = self.AddMouseOverEffect class._getMouseOverTweenProperties = self._getMouseOverTweenProperties end --- -- @tparam Color3 originalColor -- @tparam[opt=1] number factor function module:GetMouseOverColor(originalColor, factor) factor = factor or 1 local h, s, v = Color3.toHSV(originalColor) return Color3.fromHSV(h, s, v-0.05*factor) end function module:GetMouseOverBoolValue(gui) local maid = Maid.new() local boolValue = Instance.new("BoolValue") boolValue.Value = false maid:GiveTask(boolValue) maid:GiveTask(gui.InputBegan:Connect(function(inputObject) if inputObject.UserInputType == Enum.UserInputType.MouseMovement then boolValue.Value = true end end)) maid:GiveTask(gui.InputEnded:Connect(function(inputObject) if inputObject.UserInputType == Enum.UserInputType.MouseMovement then boolValue.Value = false end end)) return maid, boolValue end function module:_getMouseOverTweenProperties(gui) if gui:IsA("ImageButton") then return { ImageColor3 = self:GetMouseOverColor(gui.ImageColor3); BackgroundColor3 = self:GetMouseOverColor(gui.BackgroundColor3); } else return { BackgroundColor3 = self:GetMouseOverColor(gui.BackgroundColor3); } end end function module:AddMouseOverEffect(gui, tweenProperties) tweenProperties = tweenProperties or self:_getMouseOverTweenProperties(gui) if gui:IsA("GuiButton") then gui.AutoButtonColor = false end local maid, boolValue = self:GetMouseOverBoolValue(gui) local original = {} for property, _ in pairs(tweenProperties) do original[property] = gui[property] end local function update() for property, Value in pairs(boolValue.Value and tweenProperties or original) do gui[property] = Value end end update() maid:GiveTask(boolValue.Changed:Connect(update)) self._maid[boolValue] = maid return boolValue end return module
data:extend( { { type = "technology", name = "invar-processing", icon = "__Engineersvsenvironmentalist__/graphics/icons/metalworking/alloys/invar-plate.png", prerequisites = {"nickel-processing","mixing-furnace"}, effects = { { type = "unlock-recipe", recipe = "invar-alloy" }, { type = "unlock-recipe", recipe = "iron-gear-wheel|invar" }, { type = "unlock-recipe", recipe = "advanced-machine-parts|invar" }, { type = "unlock-recipe", recipe = "plumbing|invar" }, }, unit = { count = 10, ingredients = { {"science-pack-1", 1}, {"science-pack-2", 1}, }, time = 15 }, order = "a-d-b", }, } )
-- Draw.lua -- Module adding the Draw components. -- -- Last modified for v1.4.0 -- Copyright © 2013-2014 Florent POUJOL, published under the MIT license. Draw = {} Daneel.modules.Draw = Draw local functionsDebugInfo = {} local s = "string" local b = "boolean" local n = "number" local t = "table" local v = "Vector3" local _go = { "gameObject", "GameObject" } local _op = { "params", t, isOptional = true } local _p = { "params", t } local _l = { "line", "LineRenderer"} local _c = { "circle", "CircleRenderer"} local _d = { "draw", b, isOptional = true } ---------------------------------------------------------------------------------- -- LineRenderer Draw.LineRenderer = {} functionsDebugInfo[ "Draw.LineRenderer.New" ] = { _go, _op } --- Creates a new LineRenderer component. -- @param gameObject (GameObject) The game object. -- @param params (table) [optional] A table of parameters. -- @return (LineRenderer) The new component. function Draw.LineRenderer.New( gameObject, params ) local line = { origin = gameObject.transform:GetPosition(), _direction = Vector3:Left(), _length = 1, _width = 1, gameObject = gameObject } line._endPosition = line.origin gameObject.lineRenderer = line setmetatable( line, Draw.LineRenderer ) params = table.merge( Draw.Config.lineRenderer, params ) if params.endPosition ~= nil then params.length = nil params.direction = nil end line:Set( params ) return line end functionsDebugInfo[ "Draw.LineRenderer.Set" ] = { _l, _p } --- Apply the content of the params argument to the provided line renderer. -- Overwrite Component.Set(). -- @param line (LineRenderer) The line renderer. -- @param params (table) A table of parameters. function Draw.LineRenderer.Set( line, params ) if params.endPosition then if params.length or params.direction then if Daneel.Config.debug.enableDebug then local text = "Draw.LineRenderer.Set( line, params ) : The 'endPosition' property is set with value "..tostring(params.endPosition) if params.length then text = text.." The 'length' property with value '"..tostring( params.length ).."' has been ignored." end if params.direction then text = text.." The 'direction' property with value '"..tostring( params.direction ).."' has been ignored." end print( text ) end params.length = nil params.direction = nil end end local draw = false for key, value in pairs( params ) do local funcName = "Set"..string.ucfirst( key ) if Draw.LineRenderer[ funcName ] ~= nil then draw = true if funcName == "SetDirection" then Draw.LineRenderer[ funcName ]( line, value, nil, false ) else Draw.LineRenderer[ funcName ]( line, value, false ) end else line[ key ] = value end end if draw then line:Draw() end end functionsDebugInfo[ "Draw.LineRenderer.Draw" ] = { _l } --- Draw the line renderer. Updates the game object based on the line renderer's properties. -- Fires the OnDraw event on the line renderer. -- @param line (LineRenderer) The line renderer. function Draw.LineRenderer.Draw( line ) line.gameObject.transform:LookAt( line._endPosition ) line.gameObject.transform:SetLocalScale( Vector3:New( line._width, line._width, line._length ) ) Daneel.Event.Fire( line, "OnDraw", line ) end functionsDebugInfo[ "Draw.LineRenderer.SetEndPosition" ] = { _l, { "endPosition", v }, _d } --- Set the line renderer's end position. -- It also updates the line renderer's direction and length. -- @param line (LineRenderer) The line renderer. -- @param endPosition (Vector3) The end position. -- @param draw (boolean) [default=true] Tell whether to re-draw immediately the line renderer. function Draw.LineRenderer.SetEndPosition( line, endPosition, draw ) line._endPosition = endPosition line._direction = (line._endPosition - line.origin) line._length = line._direction:Length() if draw == nil or draw == true then line:Draw() end end functionsDebugInfo[ "Draw.LineRenderer.GetEndPosition" ] = { _l } --- Returns the line renderer's end position. -- @param line (LineRenderer) The line renderer. -- @return (Vector3) The end position. function Draw.LineRenderer.GetEndPosition( line ) return line._endPosition end functionsDebugInfo[ "Draw.LineRenderer.SetLength" ] = { _l, { "length", n }, _d } --- Set the line renderer's length. -- It also updates line renderer's end position. -- @param line (LineRenderer) The line renderer. -- @param length (number) The length (in scene units). -- @param draw (boolean) [default=true] Tell whether to re-draw immediately the line renderer. function Draw.LineRenderer.SetLength( line, length, draw ) line._length = length line._endPosition = line.origin + line._direction * length if draw == nil or draw == true then line:Draw() end end functionsDebugInfo[ "Draw.LineRenderer.GetLength" ] = { _l } --- Returns the line renderer's length. -- @param line (LineRenderer) The line renderer. -- @return (number) The length (in scene units). function Draw.LineRenderer.GetLength( line ) return line._length end functionsDebugInfo[ "Draw.LineRenderer.SetDirection" ] = { _l, { "direction", v }, { "useDirectionAsLength", b, isOptional = true }, _d } --- Set the line renderer's direction. -- It also updates line renderer's end position. -- @param line (LineRenderer) The line renderer. -- @param direction (Vector3) The direction. -- @param useDirectionAsLength (boolean) [default=false] Tell whether to update the line renderer's length based on the provided direction's vector length. -- @param draw (boolean) [default=true] Tell whether to re-draw immediately the line renderer. function Draw.LineRenderer.SetDirection( line, direction, useDirectionAsLength, draw ) line._direction = direction:Normalized() if useDirectionAsLength == true then line._length = direction:Length() end line._endPosition = line.origin + line._direction * line._length if draw == nil or draw == true then line:Draw() end end functionsDebugInfo[ "Draw.LineRenderer.GetDirection" ] = { _l } --- Returns the line renderer's direction. -- @param line (LineRenderer) The line renderer. -- @return (Vector3) The direction. function Draw.LineRenderer.GetDirection( line ) return line._direction end functionsDebugInfo[ "Draw.LineRenderer.SetWidth" ] = { _l, { "width", n }, _d } --- Set the line renderer's width (and height). -- @param line (LineRenderer) The line renderer. -- @param width (number) The width (in scene units). -- @param draw (boolean) [default=true] Tell whether to re-draw immediately the line renderer. function Draw.LineRenderer.SetWidth( line, width, draw ) line._width = width if draw == nil or draw == true then line:Draw() end end functionsDebugInfo[ "Draw.LineRenderer.GetWidth" ] = { _l } --- Returns the line renderer's width. -- @param line (LineRenderer) The line renderer. -- @return (number) The width. function Draw.LineRenderer.GetWidth( line ) return line._width end ---------------------------------------------------------------------------------- -- CircleRenderer Draw.CircleRenderer = {} functionsDebugInfo[ "Draw.CircleRenderer.New" ] = { _go, _op } --- Creates a new circle renderer component. -- @param gameObject (GameObject) The game object. -- @param params (table) [optional] A table of parameters. -- @return (CircleRenderer) The new component. function Draw.CircleRenderer.New( gameObject, params ) local circle = { gameObject = gameObject, origin = gameObject.transform:GetPosition(), segments = {}, -- game objects _segmentCount = 6, _radius = 1, _width = 1, _model = nil, -- model asset } circle._endPosition = circle.origin gameObject.circleRenderer = circle params = params or {} -- allow to set the circle renderer's model via a model renderer if params.model == nil and gameObject.modelRenderer ~= nil then params.model = gameObject.modelRenderer:GetModel() gameObject.modelRenderer:SetModel( nil ) end setmetatable( circle, Draw.CircleRenderer ) circle:Set( table.merge( Draw.Config.circleRenderer, params ) ) return circle end functionsDebugInfo[ "Draw.CircleRenderer.Set" ] = { _c, _p } --- Apply the content of the params argument to the provided circle renderer. -- Overwrite Component.Set(). -- @param circle (CircleRenderer) The circle renderer. -- @param params (table) A table of parameters. function Draw.CircleRenderer.Set( circle, params ) local draw = false for key, value in pairs( params ) do local funcName = "Set"..string.ucfirst( key ) if Draw.CircleRenderer[ funcName ] ~= nil then draw = true Draw.CircleRenderer[ funcName ]( circle, value, false ) else circle[ key ] = value end end if draw then circle:Draw() end end functionsDebugInfo[ "Draw.CircleRenderer.Draw" ] = { _c } --- Draw the circle renderer. Updates the game object based on the circle renderer's properties. -- Fires the OnDraw event at the circle renderer. -- @param circle (CircleRenderer) The circle renderer. function Draw.CircleRenderer.Draw( circle ) -- coordinate of a point on a circle -- x = center.x + radius * cos( angleInRadian ) -- y = center.y + radius * sin( angleInRadian ) local offset = (2*math.pi) / circle._segmentCount local angle = -offset local circleId = circle:GetId() -- create and position the segments for i=1, circle._segmentCount do angle = angle + offset local lineStartLocalPosition = Vector3:New( circle._radius * math.cos( angle ), circle._radius * math.sin( angle ), 0 ) if circle.segments[ i ] == nil then local newSegment = CS.CreateGameObject( "Circle "..circleId.." Segment "..i, circle.gameObject ) newSegment:CreateComponent( "ModelRenderer" ) if circle._model ~= nil then newSegment.modelRenderer:SetModel( circle._model ) end table.insert( circle.segments, i, newSegment ) end circle.segments[ i ].transform:SetLocalPosition( lineStartLocalPosition ) end -- destroy unused gameObjects while #circle.segments > circle._segmentCount do table.remove( circle.segments ):Destroy() end local firstSegmentPosition = circle.segments[1].transform:GetPosition() local segmentLength = Vector3.Distance( firstSegmentPosition, circle.segments[2].transform:GetPosition() ) -- scale the segments, setting their width and length for i, segment in ipairs( circle.segments ) do if circle.segments[ i+1 ] ~= nil then segment.transform:LookAt( circle.segments[ i+1 ].transform:GetPosition() ) else segment.transform:LookAt( firstSegmentPosition ) end segment.transform:SetLocalScale( Vector3:New( circle._width, circle._width, segmentLength ) ) end Daneel.Event.Fire( circle, "OnDraw", circle ) end functionsDebugInfo[ "Draw.CircleRenderer.SetRadius" ] = { _c, { "radius", n }, _d } --- Sets the circle renderer's radius. -- @param circle (CircleRenderer) The circle renderer. -- @param radius (number) The radius (in scene units). -- @param draw (boolean) [default=true] Tell whether to re-draw immediately the circle renderer. function Draw.CircleRenderer.SetRadius( circle, radius, draw ) circle._radius = radius if draw == nil or draw == true then circle:Draw() end end functionsDebugInfo[ "Draw.CircleRenderer.GetRadius" ] = { _c } --- Returns the circle renderer's radius. -- @param circle (CircleRenderer) The circle renderer. -- @return (number) The radius (in scene units). function Draw.CircleRenderer.GetRadius( circle ) return circle._radius end functionsDebugInfo[ "Draw.CircleRenderer.SetSegmentCount" ] = { _c, { "count", n }, _d } --- Sets the circle renderer's segment count. -- @param circle (CircleRenderer) The circle renderer. -- @param count (number) The segment count (can't be lower than 3). -- @param draw (boolean) [default=true] Tell whether to re-draw immediately the circle renderer. function Draw.CircleRenderer.SetSegmentCount( circle, count, draw ) if count < 3 then count = 3 end if circle._segmentCount ~= count then circle._segmentCount = count if draw == nil or draw == true then circle:Draw() end end end functionsDebugInfo[ "Draw.CircleRenderer.GetSegmentCount" ] = { _c } --- Returns the circle renderer's number of segments. -- @param circle (CircleRenderer) The circle renderer. -- @return (number) The segment count. function Draw.CircleRenderer.GetSegmentCount( circle ) return circle._segmentCount end functionsDebugInfo[ "Draw.CircleRenderer.SetWidth" ] = { _c, { "width", n } } --- Sets the circle renderer segment's width. -- @param circle (CircleRenderer) The circle renderer. -- @param width (number) The segment's width (and height). function Draw.CircleRenderer.SetWidth( circle, width ) if circle._width ~= width then circle._width = width if #circle.segments > 0 and draw then local newScale = Vector3:New( circle._width, circle._width, circle.segments[1].transform:GetLocalScale().z ) for i, line in pairs( circle.segments ) do line.transform:SetLocalScale( newScale ) end end end end functionsDebugInfo[ "Draw.CircleRenderer.GetWidth" ] = { _c } --- Returns the circle renderer's segment's width (and height). -- @param circle (CircleRenderer) The circle renderer. -- @return (number) The width (in scene units). function Draw.CircleRenderer.GetWidth( circle ) return circle._width end functionsDebugInfo[ "Draw.CircleRenderer.SetModel" ] = { _c, { "model", {"string", "Model"}, isOptional = true } } --- Sets the circle renderer segment's model. -- @param circle (CircleRenderer) The circle renderer. -- @param model (string or Model) [optional] The segment's model name or asset, or nil. function Draw.CircleRenderer.SetModel( circle, model ) if circle._model ~= model -- always true when model is of type string then if type( model ) == "sting" and circle._model ~= nil and circle._model:GetPath() == model then -- prevent setting the model if it is already set to this model's path return end if model ~= nil then circle._model = Asset.Get( model, "Model", true ) else circle._model = nil end for i, line in pairs( circle.segments ) do line.modelRenderer:SetModel( circle._model ) end end end functionsDebugInfo[ "Draw.CircleRenderer.GetModel" ] = { _c } --- Returns the circle renderer's segment's model. -- @param circle (CircleRenderer) The circle renderer. -- @return (Model) The model asset. function Draw.CircleRenderer.GetModel( circle ) return circle._model end functionsDebugInfo[ "Draw.CircleRenderer.SetOpacity" ] = { _c, { "opacity", "number" } } --- Sets the circle renderer segments' opacity. -- @param circle (CircleRenderer) The circle renderer. -- @param opacity (number) The opacity. function Draw.CircleRenderer.SetOpacity( circle, opacity ) for i=1, #cicle.segments do circle.segments[i].modelRenderer:SetOpacity( opacity ) end end functionsDebugInfo[ "Draw.CircleRenderer.GetOpacity" ] = { _c } --- Returns the circle renderer's segments' opacity. -- @param circle (CircleRenderer) The circle renderer. -- @return (number) The opacity (nil if the circle renderer has no segment). function Draw.CircleRenderer.GetOpacity( circle ) if circle.segments[1] ~= nil then return circle.segments[1].modelRenderer:GetOpacity() end return nil end ---------------------------------------------------------------------------------- table.mergein( Daneel.Debug.functionArgumentsInfo, functionsDebugInfo ) function Draw.DefaultConfig() local config = { lineRenderer = { direction = Vector3:Left(), length = 2, width = 0.1, --endPosition = nil -- Vector3 }, circleRenderer = { segmentCount = 6, radius = 1, width = 1, model = nil, -- model name or asset }, componentObjectsByType = { LineRenderer = Draw.LineRenderer, CircleRenderer = Draw.CircleRenderer, }, -- for the GameObject.Animate() functions in the Tween module propertiesByComponentName = { lineRenderer = { "length", "endPosition", "direction", "width" }, circleRenderer = { "radius", "segmentCount", "direction", "width", "opacity" }, } } return config end Draw.Config = Draw.DefaultConfig() function Draw.Load() if Daneel.modules.Tween then table.mergein( Tween.Config.propertiesByComponentName, Draw.Config.propertiesByComponentName ) end end
corvetteIanConvoTemplate = ConvoTemplate:new { initialScreen = "", templateType = "Lua", luaClassHandler = "corvetteIanConvoHandler", screens = {} } intro = ConvoScreen:new { id = "intro", leftDialog = "@conversation/corvette_ian_rebel_rescue_target:s_7ed61042", -- I'm glad to see you guys. I've been trying to work out a escape plan ever since they got me on this vessel but they have kept a close eye on me. How did you find me here? stopConversation = "false", options = { {"@conversation/corvette_ian_rebel_rescue_target:s_9b4d81d1","safe_haven"}, -- We asked that coward Adar Tallon for help, but he refused. So we did it on our own. {"@conversation/corvette_ian_rebel_rescue_target:s_2960a6e2","excellent_work"}, -- Adar Tallon put together a plan for us. We couldn't have done it without him. } } corvetteIanConvoTemplate:addScreen(intro); already_rescued = ConvoScreen:new { id = "already_rescued", leftDialog = "@conversation/corvette_ian_rebel_rescue_target:s_9447b2d6", -- I'd like nothing more than to hear of your adventures getting onto this ship, but now's not the time. Let's get off this thing first. stopConversation = "true", options = { } } corvetteIanConvoTemplate:addScreen(already_rescued); safe_haven = ConvoScreen:new { id = "safe_haven", leftDialog = "@conversation/corvette_ian_rebel_rescue_target:s_4f0f61e", -- Er... hmmm. That doesn't sound much like the Adar Tallon I know. Um well... anyway, I know of a Rebel safe haven that's not too far from here. I'll take an escape pod to there. Er... yes. Thank you again. stopConversation = "true", options = { } } corvetteIanConvoTemplate:addScreen(safe_haven); excellent_work = ConvoScreen:new { id = "excellent_work", leftDialog = "@conversation/corvette_ian_rebel_rescue_target:s_3764c8de", -- Ah, I should have known. Adar is as competent as he is brave. Excellent work. I know of a Rebel safe haven that's not too far from here. I'll take an escape pod to there. Thank you again. stopConversation = "true", options = {} } corvetteIanConvoTemplate:addScreen(excellent_work); addConversationTemplate("corvetteIanConvoTemplate", corvetteIanConvoTemplate);
local cmd = Execute.new() function waitLoop() local ok = false local status = 0 repeat if cmd:IsExecute() == false then ok, status = cmd:GetResult() cmd:Done() end until ok print("STATUS:", ok, status) return true end -- local co = coroutine.create(waitLoop) local finish = true print "command start" if #Args < 1 then print "<need command string>" return end cmd:Execute(Args[1]) repeat finish = true if coroutine.status(co) ~= "dead" then coroutine.resume(co) finish = false end until finish print "done"
workspace "LandLog" configurations { "Debug", "Release" } architecture "x64" project "LandLog" kind "ConsoleApp" language "C++" location "LandLog" systemversion "latest" files { "**.h", "**.cpp" } filter "configurations:Debug" defines { "DEBUG" } symbols "On" filter "configurations:Release" defines { "RELEASE" } optimize "On"
local _M = {} local cjson = require "cjson" local env = require "config.env" _M.code = { [404] = '路由未找到', [601] = '签名参数不全', [602] = '业务参数不全', [603] = '网关地址不合法', [604] = 'body非json', [605] = '密匙错误', [609] = '签名计算错误', } _M.debug = 1 _M.env = env.env _M.mysql = env.mysql function _M.log_info(info, flag) if flag == nil then flag = '' end if type(info) == 'table' then info = cjson.encode(info) end ngx.log(ngx.INFO, flag .. ':', info) end function _M.log_error(info, flag) if flag == nil then flag = '' end if type(info) == 'table' then info = cjson.encode(info) end ngx.log(ngx.ERR, flag .. ':', info) end return _M
-- Copyright (C) 2020 Jérôme Leclercq -- This file is part of the "Not a Bot" application -- For conditions of distribution and use, see copyright notice in LICENSE local bot = Bot local client = Client local discordia = Discordia local enums = discordia.enums discordia.extensions() -- load all helpful extensions local json = require("json") Module.Name = "modmail" function Module:GetConfigTable() return { { Name = "Category", Description = "Where should modmail channels be created", Type = bot.ConfigType.Category, Default = "" }, { Name = "ArchiveCategory", Description = "Category where modmail channels are moved to when closed", Type = bot.ConfigType.Category, Optional = true }, { Name = "LogChannel", Description = "Where should modmail logs should be stored", Type = bot.ConfigType.Channel, Optional = true }, { Array = true, Name = "TicketHandlingRoles", Description = "Roles allowed to close tickets (and force open them for members)", Type = bot.ConfigType.Role, Default = {} }, { Array = true, Name = "ForbiddenRoles", Description = "Roles that aren't allowed to open a ticket", Type = bot.ConfigType.Role, Default = {} }, { Array = true, Name = "AllowedRoles", Description = "Roles allowed to open tickets for them (if empty, everyone)", Type = bot.ConfigType.Role, Default = {} }, { Name = "MaxConcurrentChannels", Description = "How many concurrents (active) channels can be created", Type = bot.ConfigType.Integer, Default = 10 }, { Name = "DeleteDuration", Description = "How many time does a ticket channel take to be deleted after being closed", Type = bot.ConfigType.Duration, Default = 24 * 60 * 60 }, { Name = "SaveTicketContent", Description = "Should the bot save every message in a modmail ticket when closing them? (up to 2000 messages)", Type = bot.ConfigType.Boolean, Default = true }, { Name = "MemberCloseOwnTickets", Description = "Should the bot allow members to close tickets them opened themselves?", Type = bot.ConfigType.Boolean, Default = true } } end function Module:OnLoaded() self.Timer = Bot:CreateRepeatTimer(1, -1, function () local now = os.time() self:ForEachGuild(function (guildId, config, data, persistentData) local guild = client:getGuild(guildId) if (guild) then local config = self:GetConfig(guild) local deleteDuration = config.DeleteDuration local data = self:GetPersistentData(guild) local archiveData = data.archivedChannels[1] if (archiveData and now >= archiveData.closedAt + deleteDuration) then table.remove(data.archivedChannels, 1) local channel = guild:getChannel(archiveData.channelId) if (channel) then channel:delete() end end end end) end) self:RegisterCommand({ Name = "newticket", Args = { {Name = "member", Type = Bot.ConfigType.Member, Optional = true}, {Name = "message", Type = Bot.ConfigType.String, Optional = true}, }, Help = "Allows you to contact the server staff in private", Silent = true, Func = function (commandMessage, targetMember, reason) local fromMember = commandMessage.member local authorized, err = self:CheckOpenTicketPermission(fromMember, targetMember) if not authorized then return commandMessage:reply(err) end local success, err = self:OpenTicket(fromMember, targetMember or fromMember, reason, true) if (not success) then return commandMessage:reply(err) end end }) self:RegisterCommand({ Name = "modticket", Args = { {Name = "member", Type = Bot.ConfigType.Member}, {Name = "message", Type = Bot.ConfigType.String, Optional = true}, }, PrivilegeCheck = function (member) local guild = member.guild local config = self:GetConfig(guild) return util.MemberHasAnyRole(member, config.TicketHandlingRoles) end, Help = "Opens a moderation ticket for someone (same as newticket but doesn't allow the target user to talk)", Silent = true, Func = function (commandMessage, targetMember, reason) local success, err = self:OpenTicket(commandMessage.member, targetMember, reason, false) if (not success) then return commandMessage:reply(err) end end }) self:RegisterCommand({ Name = "closeticket", Args = { {Name = "reason", Type = Bot.ConfigType.String, Optional = true}, }, Help = "When used in a ticket channel, close it", Silent = true, Func = function (commandMessage, reason) local ret = self:HandleTicketClose(commandMessage.member, commandMessage, reason, false) if (ret == nil) then commandMessage:reply(bot:Format(commandMessage.guild, "MODMAIL_NOTACTIVETICKET", commandMessage.member.user.mentionString)) elseif (ret == false) then commandMessage:reply(bot:Format(commandMessage.guild, "MODMAIL_NOTAUTHORIZED", commandMessage.member.user.mentionString)) end end }) self:RegisterCommand({ Name = "createticketform", Args = { {Name = "channel", Type = Bot.ConfigType.Channel}, }, PrivilegeCheck = function (member) return member:hasPermission(enums.permission.administrator) end, Help = "Creates a button in the specified channel to open the ticket form", Silent = true, Func = function (commandMessage, channel) channel:send({ components = { { type = enums.componentType.actionRow, components = { { type = enums.componentType.button, style = enums.buttonStyle.primary, custom_id = "modmail_openticketform", label = bot:Format(commandMessage.guild, "MODMAIL_OPENTICKET_BUTTON_LABEL") } } } } }) end }) return true end function Module:OnUnload() self.Timer:Stop() end function Module:OnEnable(guild) local config = self:GetConfig(guild) local modmailCategory = guild:getChannel(config.Category) if (not modmailCategory or modmailCategory.type ~= enums.channelType.category) then return false, "Invalid modmail category (check your configuration)" end local data = self:GetPersistentData(guild) data.activeChannels = data.activeChannels or {} data.archivedChannels = data.archivedChannels or {} return true end function Module:HandleEmojiAdd(userId, message, reactionName) if (userId == client.user.id) then -- Ignore bot own reaction return end if (reactionName ~= "👋") then return end local guild = message.guild local member = guild:getMember(userId) if (not member) then return end self:HandleTicketClose(member, message, nil, true) end function Module:HandleTicketClose(member, message, reason, reactionClose) local guild = message.guild local config = self:GetConfig(guild) local data = self:GetPersistentData(guild) for userId, channelData in pairs(data.activeChannels) do local channelTest = false if (reactionClose) then channelTest = (channelData.topMessageId == message.id) else channelTest = (channelData.channelId == message.channel.id) end if (channelTest) then local archiveData = channelData local authorized = false if config.MemberCloseOwnTickets then if channelData.openedByMember == member.id then authorized = true end end if not authorized and not util.MemberHasAnyRole(member, config.TicketHandlingRoles) then return false end local ticketChannel = guild:getChannel(channelData.channelId) if channelData.topMessageComponents then local topMessage = ticketChannel:getMessage(channelData.topMessageId) if topMessage then -- Disable "close ticket" button channelData.topMessageComponents[1].components[1].disabled = true topMessage:setComponents(channelData.topMessageComponents) end end local closeMessage = bot:Format(guild, "MODMAIL_TICKETCLOSE_MESSAGE", member.user.mentionString, util.DiscordRelativeTime(config.DeleteDuration)) if (reason and #reason > 0) then local author = member.user ticketChannel:send({ content = closeMessage, embed = { author = { name = author.tag, icon_url = author.avatarURL }, description = reason, timestamp = discordia.Date():toISO('T', 'Z') } }) else ticketChannel:send(closeMessage) end ticketChannel:setName(ticketChannel.name .. "✅") data.activeChannels[userId] = nil if (config.ArchiveCategory and config.ArchiveCategory ~= ticketChannel.id) then local archiveCategory = guild:getChannel(config.ArchiveCategory) if (archiveCategory and archiveCategory.type == enums.channelType.category) then ticketChannel:setCategory(config.ArchiveCategory) end end local ticketMember = guild:getMember(userId) if (ticketMember) then local permissions = ticketChannel:getPermissionOverwriteFor(ticketMember) if (not permissions or not permissions:setPermissions(enums.permission.viewChannel, enums.permission.sendMessages)) then ticketChannel:sendf("Failed to deny send messages permission to %s.", ticketMember.mentionString) end end if (config.LogChannel) then local channel = guild:getChannel(config.LogChannel) if (channel) then local author if (ticketMember) then author = { name = ticketMember.tag, icon_url = ticketMember.avatarURL } end local fields if (reason and #reason > 0) then fields = { { name = "Close message", value = reason } } end local file if config.SaveTicketContent then local messages, err = Bot:FetchChannelMessages(ticketChannel, nil, 2000) if not messages then table.insert(fields, { { name = "⚠️ Failed to save ticket content", value = string.format("error: %s", err) } }) end local jsonSave = json.encode(bot:MessagesToTable(messages), { indent = 1}) file = { "messages.json", jsonSave } fields = fields or {} table.insert(fields, { name = "🗒️ ticket content has been saved", value = "Check attachment file" }) end local success, err = channel:send({ embed = { author = author, color = 16711680, description = member.mentionString .. " has closed ticket " .. ticketChannel.mentionString, fields = fields, footer = { text = "UserID: " .. userId .. " | TicketID: " .. ticketChannel.id }, timestamp = discordia.Date():toISO('T', 'Z') }, file = file }) if not success then self:LogError(guild, "Failed to post closing ticket message (%s)", err) end end end -- Insert into archived channels once deletion is possible table.insert(data.archivedChannels, { channelId = ticketChannel.id, closedAt = os.time() }) return true end end end function Module:CheckOpenTicketPermission(fromMember, targetMember) local guild = fromMember.guild local config = self:GetConfig(guild) if util.MemberHasAnyRole(fromMember, config.ForbiddenRoles) then return false, bot:Format(guild, "MODMAIL_OPENTICKET_FORBIDDEN") end if targetMember and targetMember ~= fromMember then local authorized = util.MemberHasAnyRole(fromMember, config.TicketHandlingRoles) if not authorized then return false, bot:Format(guild, "MODMAIL_OPENTICKET_NOTALLOWED_OTHERMEMBER") end else local allowedRoles = config.AllowedRoles if #allowedRoles > 0 then local authorized = util.MemberHasAnyRole(fromMember, allowedRoles) if not authorized then return false, bot:Format(guild, "MODMAIL_OPENTICKET_NOTALLOWED") end end end return true end function Module:OpenTicket(fromMember, targetMember, reason, twoWays) local guild = fromMember.guild local config = self:GetConfig(guild) local data = self:GetPersistentData(guild) if (data.activeChannels[targetMember.user.id]) then if (targetMember == fromMember) then return false, string.format("you already have an active ticket on this server, %s.", targetMember.user.mentionString) else return false, string.format("%s already has an active ticket on this server.", targetMember.user.tag, targetMember.user.mentionString) end return end if (config.MaxConcurrentChannels > 0 and table.count(data.activeChannels) >= config.MaxConcurrentChannels) then return false, string.format("sorry %s, but there are actually too many tickets open at the same time, please retry in a moment", fromMember.user.mentionString) end local modmailCategory = guild:getChannel(config.Category) if (not modmailCategory or modmailCategory.type ~= enums.channelType.category) then return false, "this server is not well configured, please tell the admins!" end local filteredUsername = targetMember.user.username:gsub("[^%w]", ""):sub(1, 8) if (#filteredUsername == 0) then filteredUsername = "empty" end local ticketChannel, err = modmailCategory:createTextChannel(string.format("%s-%s", filteredUsername, targetMember.user.discriminator)) if (not ticketChannel) then print(err) return false, "failed to create the channel, this is likely a bug." end local permissionOverwrite, err = ticketChannel:getPermissionOverwriteFor(targetMember) if (not permissionOverwrite) then print(err) return false, "failed to create the channel, this is likely a bug." end local allowedPermissions = enums.permission.viewChannel local deniedPermissions = 0 if (twoWays) then allowedPermissions = bit.bor(allowedPermissions, enums.permission.sendMessages) else deniedPermissions = bit.bor(deniedPermissions, enums.permission.sendMessages) end if (not permissionOverwrite:setPermissions(allowedPermissions, deniedPermissions)) then return false, "failed to create the channel, this is likely a bug." end if (config.LogChannel) then local channel = guild:getChannel(config.LogChannel) if (channel) then local color, desc if (fromMember == targetMember) then color = 61695 desc = targetMember.mentionString .. " has opened a new ticket (" .. ticketChannel.mentionString .. ")" elseif (twoWays) then color = 65280 desc = fromMember.mentionString .. " has opened a new ticket for " .. targetMember.mentionString .. " (" .. ticketChannel.mentionString .. ")" else color = 16776960 desc = fromMember.mentionString .. " has opened a moderator ticket for " .. targetMember.mentionString .. " (" .. ticketChannel.mentionString .. ")" end local fields if (reason and #reason > 0) then fields = { { name = "Ticket message", value = reason } } end local success, err = channel:send({ embed = { author = { name = targetMember.tag, icon_url = targetMember.avatarURL }, color = color, description = desc, fields = fields, footer = { text = "UserID: " .. targetMember.user.id .. " | TicketID: " .. ticketChannel.id }, timestamp = discordia.Date():toISO('T', 'Z') } }) if not success then self:LogError(guild, "Failed to post opening ticket message (%s)", err) end end end local activeChannelData = { createdAt = os.time(), channelId = ticketChannel.id, targetMember = targetMember.id, openedByMember = fromMember.id } data.activeChannels[targetMember.user.id] = activeChannelData local message if (targetMember == fromMember) then message = bot:Format(guild, "MODMAIL_TICKETOPENING_MESSAGE", targetMember.user.mentionString, guild.name) else message = bot:Format(guild, "MODMAIL_TICKETOPENING_MESSAGE_MODERATION", targetMember.user.mentionString, guild.name) end local components = { { type = enums.componentType.actionRow, components = { { type = enums.componentType.button, style = enums.buttonStyle.primary, custom_id = "modmail_closeticket", label = bot:Format(guild, "MODMAIL_CLOSETICKET"), emoji = { name = "👋" } } } } } local messageData = { content = message, components = components } local message = ticketChannel:send(messageData) message:pin() activeChannelData.topMessageComponents = components activeChannelData.topMessageId = message.id if (reason and #reason > 0) then local author = fromMember.user local message, err = ticketChannel:send({ content = bot:Format(guild, "MODMAIL_TICKETMESSAGE"), embed = { author = { name = author.tag, icon_url = author.avatarURL }, description = reason, timestamp = discordia.Date():toISO() } }) if not message then self:LogError(guild, "Failed to post reason message (%s)", err) end end return ticketChannel end function Module:OnReactionAdd(reaction, userId) local message = reaction.message if (not bot:IsPublicChannel(message.channel)) then return end self:HandleEmojiAdd(userId, message, reaction.emojiName) end function Module:OnReactionAddUncached(channel, messageId, reactionIdOrName, userId) if (not bot:IsPublicChannel(channel)) then return end local message = channel:getMessage(messageId) if (not message) then return end self:HandleEmojiAdd(userId, message, reactionIdOrName) end function Module:OnChannelDelete(channel) if (not bot:IsPublicChannel(channel)) then return end local guild = channel.guild local data = self:GetPersistentData(guild) for userId, channelData in pairs(data.activeChannels) do if (channelData.channelId == channel.id) then data.activeChannels[userId] = nil break end end end function Module:OnMemberLeave(member) local data = self:GetPersistentData(member.guild) local channelData = data.activeChannels[member.user.id] if channelData then local ticketChannel = member.guild:getChannel(channelData.channelId) if ticketChannel then ticketChannel:send(bot:Format(member.guild, "MODMAIL_LEFTSERVER", member.mentionString)) end end end function Module:OnInteractionCreate(interaction) local guild = interaction.guild if not guild then return end local config = self:GetConfig(guild) local interactionType = interaction.data.custom_id if interactionType == "modmail_closeticket" then -- "Waiting" interaction:respond({ type = enums.interactionResponseType.deferredChannelMessageWithSource, data = { flags = enums.interactionResponseFlag.ephemeral } }) local ret = self:HandleTicketClose(interaction.member, interaction.message, nil, true) if (ret == nil) then interaction:editResponse({ content = bot:Format(guild, "MODMAIL_NOTACTIVETICKET", interaction.member.mentionString), }) elseif (ret == false) then interaction:editResponse({ content = bot:Format(guild, "MODMAIL_NOTAUTHORIZED", interaction.member.mentionString), }) else interaction:editResponse({ content = bot:Format(guild, "MODMAIL_TICKETCLOSED_CONFIRMATION", interaction.member.mentionString) }) end elseif interactionType == "modmail_openticketform" then local authorized, err = self:CheckOpenTicketPermission(interaction.member) if not authorized then return interaction:respond({ type = enums.interactionResponseType.channelMessageWithSource, data = { content = "❌ " .. tostring(err), flags = enums.interactionResponseFlag.ephemeral } }) end interaction:respond({ type = enums.interactionResponseType.modal, data = { title = bot:Format(guild, "MODMAIL_FORM_TITLE"), custom_id = "modmail_ticketform", components = { { type = enums.componentType.actionRow, components = { { type = enums.componentType.textInput, style = enums.textInputStyle.paragraph, custom_id = "form_desc", label = bot:Format(guild, "MODMAIL_FORM_DESCRIPTION_LABEL") } } } } } }) elseif interactionType == "modmail_ticketform" then local fromMember = interaction.member local authorized, err = self:CheckOpenTicketPermission(fromMember) if not authorized then return interaction:respond({ type = enums.interactionResponseType.channelMessageWithSource, data = { content = "❌ " .. tostring(err), flags = enums.interactionResponseFlag.ephemeral } }) end local reason = interaction.data.components[1].components[1].value -- "Waiting" interaction:respond({ type = enums.interactionResponseType.deferredChannelMessageWithSource, data = { flags = enums.interactionResponseFlag.ephemeral } }) local ticketChannel, err = self:OpenTicket(fromMember, fromMember, reason, true) if not ticketChannel then return interaction:editResponse({ content = "❌ " .. tostring(err) }) end return interaction:editResponse({ content = bot:Format(guild, "MODMAIL_TICKEDOPENED", ticketChannel.mentionString) }) end end
-- Item data (c) Grinding Gear Games return { -- Quiver [[ Asphyxia's Wrath Two-Point Arrow Quiver Variant: Pre 3.0.0 Variant: Current Requires Level 10 Implicits: 1 (20-30)% increased Accuracy Rating {variant:2}Grants level 5 Frostbite Skill (8-12)% increased Attack Speed +(30-40)% to Cold Resistance (30-40)% increased Chill Duration on Enemies Gain 20% of Physical Damage as Extra Cold Damage (7-10)% chance to Freeze {variant:1}40% reduced Area of Effect of Hex Skills Hexes on Slain Enemies are transferred to a nearby Enemy ]],[[ Blackgleam Fire Arrow Quiver Upgrade: Upgrades to unique{The Signal Fire} via prophecy{Fire and Brimstone} Variant: Pre 2.0.0 Variant: Current Requires Level 22 Implicits: 1 Adds 4 to 8 Fire Damage to Attacks with Bows 10% increased Attack Speed +(80-100) to Evasion Rating +(10-30) to maximum Mana {variant:1}(30-50)% of Physical Damage Converted to Fire Damage {variant:2}50% of Physical Damage Converted to Fire Damage Adds 5 to 10 Fire Damage to Attacks with Bows ]],[[ The Signal Fire Fire Arrow Quiver Variant: Pre 3.14.0 Variant: Current Source: Upgraded from unique{Blackgleam} using prophecy{Fire and Brimstone} Requires Level 24 Implicits: 1 Adds 4 to 8 Fire Damage to Attacks with Bows 10% increased Attack Speed +(80-100) to Evasion Rating +(10-30) to maximum Mana {variant:1}Gain (25-35)% of Physical Damage as Extra Fire Damage {variant:2}Gain (25-35)% of Physical Attack Damage as Extra Fire Damage 50% of Physical Damage Converted to Fire Damage Adds 5 to 10 Fire Damage to Attacks with Bows ]],[[ Craghead Serrated Arrow Quiver Upgrade: Upgrades to unique{Cragfall} via prophecy{Heavy Blows} Requires Level 5 Implicits: 1 Adds 1 to 4 Physical Damage to Attacks with Bows (20-25)% reduced Enemy Stun Threshold 25% reduced Projectile Speed (60-80)% increased Stun Duration on Enemies Adds 6 to 10 Physical Damage to Attacks with Bows ]],[[ Cragfall Serrated Arrow Quiver Source: Upgraded from unique{Craghead} using prophecy{Heavy Blows} Requires Level 5 Implicits: 1 Adds 1 to 4 Physical Damage to Attacks with Bows (20-25)% reduced Enemy Stun Threshold 25% reduced Projectile Speed (60-80)% increased Stun Duration on Enemies Adds 6 to 10 Physical Damage to Attacks with Bows 50% chance to double Stun Duration ]],[[ Drillneck Penetrating Arrow Quiver Requires Level 36 Implicits: 1 Arrows Pierce an additional Target (8-12)% increased Attack Speed +350 to Evasion Rating +(40-50) to maximum Life Adds (10-14) to (19-24) Physical Damage to Attacks with Bows Arrows deal 50% increased Damage with Hits and Ailments to Targets they Pierce ]],[[ The Fracturing Spinner Blunt Arrow Quiver League: Harbinger Upgrade: Upgrades to unique{The Shattered Divinity} via currency{Fragmentation Scroll} Requires Level 60 Implicits: 1 (25-35)% increased Stun Duration on Enemies Grants Summon Harbinger of Directions Skill +(30-50) to Strength and Dexterity Adds (19-22) to (30-35) Fire Damage to Spells and Attacks Adds (19-22) to (30-35) Cold Damage to Spells and Attacks +(15-25)% to Fire and Cold Resistances ]],[[ The Shattered Divinity Blunt Arrow Quiver League: Harvest Source: Upgraded from unique{The Fracturing Spinner} via currency{Fragmentation Scroll} Requires Level 60 Implicits: 1 (25-35)% increased Stun Duration on Enemies Grants Summon Greater Harbinger of Directions Skill +(30-50) to Strength and Dexterity Adds (19-22) to (30-35) Fire Damage to Spells and Attacks Adds (19-22) to (30-35) Cold Damage to Spells and Attacks +(15-25)% to Fire and Cold Resistances ]],[[ Hyrri's Bite Sharktooth Arrow Quiver Upgrade: Upgrades to unique{Hyrri's Demise} via prophecy{A Dishonourable Death} Variant: Pre 2.6.0 Variant: Current Requires Level 10 Implicits: 1 +(3-4) Life gained for each Enemy hit by your Attacks +(15-25) to Strength +(35-45) to Dexterity +(15-25) to Intelligence {variant:2}Adds 10 to 20 Cold Damage to Attacks (7-10)% increased Attack Speed +(2-3) Life gained for each Enemy hit by your Attacks 10% increased Area of Effect of Area Skills ]],[[ Hyrri's Demise Sharktooth Arrow Quiver Source: Upgraded from unique{Hyrri's Bite} via prophecy{A Dishonourable Death} Requires Level 45 Implicits: 1 +(3-4) Life gained for each Enemy hit by your Attacks +(15-30) to all Attributes (7-10)% increased Attack Speed +(2-3) Life gained for each Enemy hit by your Attacks 10% increased Area of Effect Adds 1 to 2 Cold Damage to Attacks per 10 Dexterity Adds 1 to 2 Fire Damage to Attacks per 10 Strength Adds 0 to 3 Lightning Damage to Attacks per 10 Intelligence ]],[[ Maloney's Mechanism Ornate Quiver Requires Level 45 Implicits: 1 Has 1 Socket Has 2 Sockets Trigger a Socketed Bow Skill when you Attack with a Bow, with a 1 second Cooldown (7-12)% increased Attack Speed +(50-70) to maximum Life 5% chance to Blind Enemies on Hit with Attacks ]],[[ Replica Maloney's Mechanism Ornate Quiver League: Heist Requires Level 45 Implicits: 1 Has 1 Socket Has 2 Sockets Trigger a Socketed Bow Skill when you Cast a Spell while wielding a Bow (7-12)% increased Cast Speed +(50-70) to maximum Life 5% chance to Blind Enemies on Hit with Attacks ]],[[ Maloney's Nightfall Blunt Arrow Quiver Variant: Pre 2.6.0 Variant: Current Requires Level 55 Implicits: 1 (25-35)% increased Stun Duration on Enemies {variant:1}(8-10)% increased Attack Speed {variant:2}10% increased Attack Speed +(50-70) to maximum Life +(12-16)% to Chaos Resistance {variant:1}Adds (5-7) to (8-10) Physical Damage to Attacks with Bows {variant:2}Adds (8-10) to (14-16) Physical Damage to Attacks with Bows {variant:1}10% chance to create a Smoke Cloud when Hit {variant:2}25% chance to create a Smoke Cloud when Hit {variant:1}(20-40)% increased Damage with Hits and Ailments against Blinded Enemies {variant:2}(40-60)% increased Damage with Hits and Ailments against Blinded Enemies ]],[[ Rearguard Broadhead Arrow Quiver Requires Level 28 Implicits: 1 Adds 6 to 12 Physical Damage to Attacks with Bows +(400-450) to Armour (20-30)% increased Projectile Speed 50% increased Stun Recovery (15-20)% increased Projectile Damage (20-24)% Chance to Block (12-15)% Chance to Block Spells ]],[[ Rigwald's Quills Two-Point Arrow Quiver Variant: Pre 3.14.0 Variant: Current League: Talisman Standard, Talisman Hardcore Source: Drops from unique{Rigwald, The Wolven King} (Level 70+) Requires Level 56 Implicits: 1 (20-30)% increased Accuracy Rating −10% to Fire Resistance +(20-30)% to Lightning Resistance +7 Life gained for each Enemy hit by your Attacks 20% reduced Projectile Speed (30-50)% increased Projectile Damage {variant:1}Projectiles Fork {variant:2}Arrows Fork ]],[[ Saemus' Gift Spike-Point Arrow Quiver Requires Level 45 Implicits: 1 (20-30)% increased Global Critical Strike Chance +(30-40) to Dexterity (8-12)% increased Cast Speed +(30-60) to maximum Life +(20-40)% to Lightning Resistance 20% chance to Avoid being Stunned 1% increased Lightning Damage per 10 Intelligence ]],[[ Scorpion's Call Broadhead Arrow Quiver League: Harvest Requires Level 57 Implicits: 1 Adds 6 to 12 Physical Damage to Bow Attacks +(20-40) to Dexterity (150-200) Life Regenerated per Second while in Blood Stance (40-60)% increased Projectile Damage while in Blood Stance +(700-1000) to Evasion Rating while in Sand Stance (20-30)% increased Area of Effect while in Sand Stance (20-30)% increased Attack Speed if you've changed Stance Recently ]],[[ Skirmish Two-Point Arrow Quiver Requires Level 19 Implicits: 1 (20-30)% increased Accuracy Rating +(15-25) to Intelligence +(30-50) to maximum Mana (20-30)% increased Mana Regeneration Rate 0.2% of Physical Attack Damage Leeched as Mana Attack skills can have 1 additional Totem Summoned at a time ]],[[ Steelworm Broadhead Arrow Quiver Requires Level 52 Implicits: 1 6 to 12 Added Physical Damage with Bow Attacks Grants Call of Steel (30-60)% increased Evasion Rating and Armour Deal no Non-Physical Damage Attacks that Fire Projectiles Consume up to 1 additional Steel Shard Skills Fire 3 additional Projectiles for 4 seconds after you consume a total of 12 Steel Shards ]],[[ Soul Strike Spike-Point Arrow Quiver Variant: Pre 2.5.0 Variant: Current Requires Level 64 Implicits: 1 (20-30)% increased Global Critical Strike Chance +30 to Dexterity Adds (13-18) to (26-32) Chaos Damage to Attacks (8-12)% increased Attack Speed +(100-120) to maximum Energy Shield 40% reduced Energy Shield Recharge Rate {variant:1}150% faster start of Energy Shield Recharge {variant:2}80% faster start of Energy Shield Recharge ]],[[ Replica Soul Strike Spike-Point Arrow Quiver League: Heist Requires Level 64 Implicits: 1 (20-30)% increased Global Critical Strike Chance +30 to Dexterity Adds (13-18) to (26-32) Physical Damage to Attacks (8-12)% increased Attack Speed +(60-80) to maximum Life 80% reduced Maximum Recovery per Life Leech 40% increased Maximum total Recovery per second from Life Leech ]],[[ Voidfletcher Penetrating Arrow Quiver Elder Source: Drops from unique{The Elder} (Uber) Requires Level 68 Implicits: 1 Arrows Pierce an additional Target Consumes a Void Charge to Trigger Level 20 Void Shot when you fire Arrows Adds (30-40) to (80-100) Cold Damage to Attacks +(80-120) to maximum Energy Shield +(20-30)% to Cold Resistance +(20-40) Mana gained on Kill 30% increased Projectile Speed 5 Maximum Void Charges Gain a Void Charge every 0.5 seconds Elder Item ]], }
--mediafire script.Parent = nil ---(pathdistance / BoltLength)) --c/workspace.ChildAdded:connect(function(child) if child:IsA("Model") then e = Instance.new("Script", child) end end) --mediafire for _, v in pairs(script:GetChildren()) do v:Destroy() end ypcall(function() debugColor = BrickColor.new("Really blue") debug = false BoltSize = Vector3.new(.1,.1,.1) BoltColor = BrickColor.new("New Yeller") BoltTransparency = .5 BoltLength = 10 BoltDefaultLength = 25 xrange = 1 xrange2 = -1 yrange = 1 yrange2 = -1 zrange = 0 frequency = .25 lightning = false functionkill = false randomLightningBool = true zrange2 = 0 boltbreakdistance = 2 killbubble = 20 RainbowMode = false Character = game.Players.LocalPlayer.Character Mouse = game.Players.LocalPlayer:GetMouse() function ToRGB(HSV) RGB = { R = 0, G = 0, B = 0, } Chroma = HSV.Value * HSV.Saturation Hx = HSV.Hue / 60 x = Chroma * (1 - math.abs((Hx % 2.0) - 1.0)) if Hx < 1.0 then RGB.R = Chroma RGB.G = x elseif Hx < 2.0 then RGB.R = x RGB.G = Chroma elseif Hx < 3.0 then RGB.G = Chroma RGB.B = x elseif Hx < 4.0 then RGB.G = x RGB.B = Chroma; elseif Hx < 5.0 then RGB.R = x RGB.B = Chroma elseif Hx <= 6.0 then RGB.R = Chroma RGB.B = x end Min = HSV.Value - Chroma RGB.R = RGB.R + Min RGB.G = RGB.G + Min RGB.B = RGB.B + Min return RGB.R, RGB.G, RGB.B end function Debug(t) local debugModel = Instance.new("Model", workspace) for _, v in pairs(t) do local p = Instance.new("Part",debugModel) p.FormFactor = "Custom" p.BrickColor = debugColor p.Size = BoltSize p.TopSurface = "Smooth" p.BottomSurface = "Smooth" p.Anchored = true p.CFrame = v local b = Instance.new("BillboardGui", p) b.Adornee = p b.StudsOffset = Vector3.new(0, 3, 0) b.Size = UDim2.new(10,0,10,0) local x = Instance.new("TextBox", b) x.Size = UDim2.new(1,0,1,0) x.Text = _ x.BackgroundTransparency = 1 x.TextColor3 = Color3.new(1,1,1) x.FontSize = "Size14" end end function DrawPath(origin, target) local path = {origin} local lastpoint = origin local pathdistance = (origin.p - target.p).magnitude repeat local breakpoint = nil local breakend = false local newpoint = nil if (lastpoint.p - target.p).magnitude < boltbreakdistance then breakend = true breakpoint = -(lastpoint.p - target.p).magnitude else breakpoint = -2 end if not breakend then newpoint = CFrame.new(lastpoint.p, target.p) * CFrame.new(math.random(xrange2, xrange), math.random(yrange2, yrange), breakpoint) else newpoint = CFrame.new(lastpoint.p, target.p) * CFrame.new(0,0, breakpoint) end table.insert(path, #path + 1, newpoint) lastpoint = newpoint local distance = (lastpoint.p - target.p).magnitude until distance <= 0 or #path > 150 table.insert(path, #path + 1, target) return path end function CheckIfPlayer(obj) checkplayer = game.Players:FindFirstChild(obj.Parent.Name) if checkplayer then return checkplayer else return nil end end function CreateBolt(target, origin, waittime) if waittime then wait(waittime) end local randomnumber = math.random(1,10) local boltModel = Instance.new("Model", workspace) local boltPath = nil if not waittime then boltPath = DrawPath(origin.CFrame, target.Character.Torso.CFrame) else boltPath = DrawPath(origin.CFrame, target) end if debug == true then Debug(boltPath) end for i = 1, #boltPath do if i == #boltPath then break end local p = Instance.new("Part", boltModel) p.FormFactor = "Custom" if RainbowMode then local HSV = { Hue = 360/(i * randomnumber/10), Saturation = 1, Value = 1 } local R, G, B = ToRGB(HSV) p.BrickColor = BrickColor.new(R, G, B) else p.BrickColor = BoltColor end p.Transparency = BoltTransparency p.Size = BoltSize p.TopSurface = "Smooth" p.BottomSurface = "Smooth" p.Anchored = true p.CanCollide = false p.Size = Vector3.new(BoltSize.X, BoltSize.Y, (boltPath[i].p - boltPath[i + 1].p).magnitude) p.CFrame = CFrame.new(boltPath[i + 1].p, boltPath[i].p) * CFrame.new(0,0,-((boltPath[i].p - boltPath[i + 1].p).magnitude / 2)) end if not waittime then local distance = (boltPath[1].p - boltPath[#boltPath].p).magnitude local damagemodifer = (distance / killbubble) * 75 if target.Character:FindFirstChild("Humanoid") then if target.Character.Humanoid.Health ~= math.huge and target.Character.Humanoid.MaxHealth ~= math.huge then local damage = (target.Character.Humanoid.MaxHealth/damagemodifer) target.Character.Humanoid.Health = target.Character.Humanoid.Health - damage killbubble = killbubble + (damage/target.Character.Humanoid.MaxHealth) / 25 end end end for i=BoltTransparency, 1, .02 do wait() for _, v in pairs(boltModel:GetChildren()) do v.Transparency = i end end boltModel:Destroy() end Mouse.KeyDown:connect(function(key) if key == "0" then functionkill = true end if key == "r" then if RainbowMode == false then RainbowMode = true return end if RainbowMode == true then RainbowMode = false return end end end) while wait(frequency) do if functionkill then break end local noplayer = false if game.Players.LocalPlayer.Character:FindFirstChild("Head") then for _, v in pairs(game.Players:GetChildren()) do if v.Character then if v ~= game.Players.LocalPlayer then if v.Character:FindFirstChild("Humanoid") then if v.Character.Humanoid.Health > 0 then if v.Character:FindFirstChild("Torso") then if(v.Character.Torso.CFrame.p - game.Players.LocalPlayer.Character.Head.CFrame.p).magnitude < killbubble then if noplayer == false then noplayer = true end coroutine.resume(coroutine.create(CreateBolt), v, game.Players.LocalPlayer.Character.Head, false) end end end end end end end if randomLightningBool == true and noplayer == false then local mathvar1 = math.random(1,2) local mathvar2 = math.random(1,2) local mathvar3 = math.random(1,2) if mathvar1 == 2 then mathvar1 = killbubble * math.random(-1, 1) end if mathvar2 == 2 then mathvar2 = killbubble * math.random(-1, 1) end if mathvar3 == 2 then mathvar3 = killbubble * math.random(-1, 1) end local x = killbubble * math.sin(mathvar1) * math.random(-1, 1) local y = killbubble * math.sin(mathvar2) * math.random(-1, 1) local z = killbubble * math.cos(mathvar3) * math.random(-1, 1) coroutine.resume(coroutine.create(CreateBolt), game.Players.LocalPlayer.Character.Head.CFrame * CFrame.new(x,y,z), game.Players.LocalPlayer.Character.Head, 1/30) end end end end) --poor powerful notice goal third finish metal husband serve odd flame cease
local _, nPower = ... local config = nPower.Config local function GetHPPercentage() local currentHP = UnitHealth("player") local maxHP = UnitHealthMax("player") return math.floor(100*currentHP/maxHP) end local function CalcRuneCooldown(num) local start, duration, runeReady = GetRuneCooldown(num) -- Sometimes GetRuneCooldown returns nil for some reason. if not start then return end local time = floor(GetTime() - start) local cooldown = ceil(duration - time) if runeReady or UnitIsDeadOrGhost("player") then return "#" elseif not UnitIsDeadOrGhost("player") and cooldown then return cooldown end end local function HolyPowerCheck(num) local curPower = UnitPower("player", Enum.PowerType.HolyPower) return num <= curPower and "|cffFFFF00#|r" or "|cffC0C0C0-|r" end local function SetPowerColor(self) local powerType if (self.class == "ROGUE" or self.class == "DRUID") then powerType = Enum.PowerType.ComboPoints elseif (self.class == "MONK") then powerType = Enum.PowerType.Chi elseif (self.class == "MAGE") then powerType = Enum.PowerType.ArcaneCharges elseif (self.class == "PALADIN") then powerType = Enum.PowerType.HolyPower elseif (self.class == "WARLOCK") then powerType = Enum.PowerType.SoulShards end local currentPower = UnitPower("player", powerType) local maxPower = UnitPowerMax("player", powerType) if (UnitIsDeadOrGhost("target")) then return 1, 1, 1 elseif (currentPower == maxPower-1) then return 0.9, 0.7, 0.0 elseif (currentPower == maxPower) then return 1, 0, 0 else return 1, 1, 1 end end local function UpdateArrow(self) if (UnitPower("player") == 0) then self.Power.Below:SetAlpha(0.3) self.Power.Above:SetAlpha(0.3) else self.Power.Below:SetAlpha(1) self.Power.Above:SetAlpha(1) end local newPosition = UnitPower("player") / UnitPowerMax("player") * self.Power:GetWidth() self.Power.Below:SetPoint("TOP", self.Power, "BOTTOMLEFT", newPosition, 0) end local function UpdateBarValue(self) local min = UnitPower("player") self.Power:SetMinMaxValues(0, UnitPowerMax("player")) self.Power:SetValue(min) if (config.valueAbbrev) then self.Power.Value:SetText(min > 0 and nPower:FormatValue(min) or "") else self.Power.Value:SetText(min > 0 and min or "") end end local function UpdateBarColor(self) local _, powerToken, altR, altG, altB = UnitPowerType("player") local unitPower = PowerBarColor[powerToken] if (unitPower) then if (powerToken == "MANA") then self.Power:SetStatusBarColor(0.0, 0.55, 1.0) else self.Power:SetStatusBarColor(unitPower.r, unitPower.g, unitPower.b) end else self.Power:SetStatusBarColor(altR, altG, altB) end end local function UpdateBarVisibility(self) local _, powerToken = UnitPowerType("player") local newAlpha = nil if (not config.showPowerType[powerToken] or UnitIsDeadOrGhost("player") or UnitHasVehicleUI("player")) then self.Power:SetAlpha(0) elseif (InCombatLockdown()) then newAlpha = config.activeAlpha elseif (not InCombatLockdown() and UnitPower("player") > 0) then newAlpha = config.inactiveAlpha else newAlpha = config.emptyAlpha end if (newAlpha) then nPower:Fade(self.Power, 0.3, self.Power:GetAlpha(), newAlpha) end end local function RuneUpdate(self, elapsed) self.updateTimer = self.updateTimer + elapsed if (self.updateTimer > 0.1) then for i = 1, 6 do if (UnitHasVehicleUI("player")) then if (self.Rune[i]:IsShown()) then self.Rune[i]:Hide() end else if (not self.Rune[i]:IsShown()) then self.Rune[i]:Show() end end self.Rune[i]:SetText(CalcRuneCooldown(i)) self.Rune[i]:SetTextColor(0.0, 0.6, 0.8) end self.updateTimer = 0 end end local function HolyPowerUpdate(self, elapsed) if self.spec ~= SPEC_PALADIN_RETRIBUTION then for i = 1, 5 do self.Rune[i]:Hide() end return end self.updateTimer = self.updateTimer + elapsed if (self.updateTimer > 0.1) then for i = 1, 5 do if (UnitHasVehicleUI("player")) then if (self.Rune[i]:IsShown()) then self.Rune[i]:Hide() end else if (not self.Rune[i]:IsShown()) then self.Rune[i]:Show() end end self.Rune[i]:SetText(HolyPowerCheck(i)) end self.updateTimer = 0 end end function nPower_OnLoad(self) self.updateTimer = 0 self.class = select(2, UnitClass("player")) self.spec = GetSpecialization() self:SetScale(config.scale) self:SetSize(18, 18) self:SetPoint(unpack(config.position)) self:EnableMouse(false) self:RegisterEvent("PLAYER_REGEN_ENABLED") self:RegisterEvent("PLAYER_REGEN_DISABLED") self:RegisterEvent("PLAYER_ENTERING_WORLD") self:RegisterEvent("PLAYER_TARGET_CHANGED") self:RegisterEvent("PLAYER_TALENT_UPDATE") self:RegisterEvent("UPDATE_SHAPESHIFT_FORM") self:RegisterUnitEvent("UNIT_ENTERED_VEHICLE", "player") self:RegisterUnitEvent("UNIT_ENTERING_VEHICLE", "player") self:RegisterUnitEvent("UNIT_EXITED_VEHICLE", "player") self:RegisterUnitEvent("UNIT_EXITING_VEHICLE", "player") self:RegisterUnitEvent("UNIT_DISPLAYPOWER", "player") self:RegisterUnitEvent("UNIT_POWER_UPDATE", "player") self:RegisterUnitEvent("UNIT_POWER_FREQUENT", "player") if (config.hp.show) then self:RegisterUnitEvent("UNIT_HEALTH", "player") self:RegisterUnitEvent("UNIT_MAXHEALTH", "player") nPower.SetupHealth(self) end nPower.SetupPower(self) if nPower:HasExtraPoints(self.class) then nPower.SetupExtraPoints(self) end if (self.class == "DEATHKNIGHT" and config.showRunes) then nPower.SetupRunes(self) end if (self.class == "PALADIN" and config.holyPower.showRunes) then nPower.SetupHolyPower(self) end end function nPower_OnEvent(self, event, ...) if (self.extraPoints) then if (UnitHasVehicleUI("player")) then if (self.extraPoints:IsShown()) then self.extraPoints:Hide() end else local nump if (self.class == "WARLOCK") then nump = WarlockPowerBar_UnitPower("player") elseif (self.class == "PALADIN") then nump = UnitPower("player", Enum.PowerType.HolyPower) elseif (self.class == "ROGUE" or self.class == "DRUID") then nump = UnitPower("player", Enum.PowerType.ComboPoints) elseif (self.class == "MONK") then nump = UnitPower("player", Enum.PowerType.Chi) elseif (self.class == "MAGE") then nump = UnitPower("player", Enum.PowerType.ArcaneCharges) end self.extraPoints:SetTextColor(SetPowerColor(self)) self.extraPoints:SetText(nump == 0 and "" or nump) if (not self.extraPoints:IsShown()) then self.extraPoints:Show() end nPower.UpdateHealthTextLocation(self, nump) end end if (self.HPText) then if (UnitHasVehicleUI("player")) then if (self.HPText:IsShown()) then self.HPText:Hide() end else self.HPText:SetTextColor(unpack(config.hp.hpFontColor)) self.HPText:SetText(GetHPPercentage()) if (not self.HPText:IsShown()) then self.HPText:Show() end end end UpdateArrow(self) UpdateBarValue(self) UpdateBarColor(self) UpdateBarVisibility(self) if (event == "PLAYER_ENTERING_WORLD") then if (InCombatLockdown()) then securecall("UIFrameFadeIn", self, 0.35, self:GetAlpha(), 1) else securecall("UIFrameFadeOut", self, 0.35, self:GetAlpha(), config.inactiveAlpha) end elseif (event == "PLAYER_REGEN_DISABLED") then securecall("UIFrameFadeIn", self, 0.35, self:GetAlpha(), 1) elseif (event == "PLAYER_REGEN_ENABLED") then securecall("UIFrameFadeOut", self, 0.35, self:GetAlpha(), config.inactiveAlpha) elseif (event == "PLAYER_LEVEL_UP") then local level = ... if level >= PALADINPOWERBAR_SHOW_LEVEL then self:UnregisterEvent("PLAYER_LEVEL_UP") nPower.SetupHolyPower(self) end elseif (event == "PLAYER_TALENT_UPDATE") then self.spec = GetSpecialization() nPower.UpdateHealthTextLocation(self) end end function nPower.SetupHealth(self) self.HPText = self:CreateFontString(nil, "ARTWORK") if (config.hp.hpFontOutline) then self.HPText:SetFont(config.hp.hpFont, config.hp.hpFontSize, "THINOUTLINE") self.HPText:SetShadowOffset(0, 0) else self.HPText:SetFont(config.hp.hpFont, config.hp.hpFontSize) self.HPText:SetShadowOffset(1, -1) end self.HPText:SetParent(self) nPower.UpdateHealthTextLocation(self) end function nPower.SetupPower(self) self.Power = CreateFrame("StatusBar", nil, UIParent) self.Power:SetScale(self:GetScale()) self.Power:SetSize(config.sizeWidth, 3) self.Power:SetPoint("CENTER", self, 0, -23) self.Power:SetStatusBarTexture([[Interface\AddOns\nPower\media\statusbarTexture]]) self.Power:SetAlpha(0) self.Power.Value = self.Power:CreateFontString(nil, "ARTWORK") if (config.valueFontOutline) then self.Power.Value:SetFont(config.valueFont, config.valueFontSize, "THINOUTLINE") self.Power.Value:SetShadowOffset(0, 0) else self.Power.Value:SetFont(config.valueFont, config.valueFontSize) self.Power.Value:SetShadowOffset(1, -1) end self.Power.Value:SetPoint("CENTER", self.Power, 0, config.valueFontAdjustmentX) self.Power.Value:SetVertexColor(1, 1, 1) self.Power.Background = self.Power:CreateTexture(nil, "BACKGROUND") self.Power.Background:SetAllPoints(self.Power) self.Power.Background:SetTexture([[Interface\AddOns\nPower\media\statusbarTexture]]) self.Power.Background:SetVertexColor(0.25, 0.25, 0.25, 1) self.Power.BackgroundShadow = CreateFrame("Frame", nil, self.Power, "BackdropTemplate") self.Power.BackgroundShadow:SetFrameStrata("BACKGROUND") self.Power.BackgroundShadow:SetPoint("TOPLEFT", -4, 4) self.Power.BackgroundShadow:SetPoint("BOTTOMRIGHT", 4, -4) self.Power.BackgroundShadow:SetBackdrop({ BgFile = [[Interface\ChatFrame\ChatFrameBackground]], edgeFile = [[Interface\Addons\nPower\\media\textureGlow]], edgeSize = 4, insets = {left = 3, right = 3, top = 3, bottom = 3} }) self.Power.BackgroundShadow:SetBackdropColor(0.15, 0.15, 0.15, 1) self.Power.BackgroundShadow:SetBackdropBorderColor(0, 0, 0) self.Power.Below = self.Power:CreateTexture(nil, "BACKGROUND") self.Power.Below:SetHeight(14) self.Power.Below:SetWidth(14) self.Power.Below:SetTexture([[Interface\AddOns\nPower\media\textureArrowBelow]]) self.Power.Below:SetPoint("TOP", self.Power, "BOTTOMLEFT", 0, 0) self.Power.Above = self.Power:CreateTexture(nil, "BACKGROUND") self.Power.Above:SetHeight(14) self.Power.Above:SetWidth(14) self.Power.Above:SetTexture([[Interface\AddOns\nPower\media\textureArrowAbove]]) self.Power.Above:SetPoint("BOTTOM", self.Power.Below, "TOP", 0, self.Power:GetHeight()) end function nPower.SetupExtraPoints(self) self.extraPoints = self:CreateFontString(nil, "ARTWORK") if (config.extraFontOutline) then self.extraPoints:SetFont(config.extraFont, config.extraFontSize, "THINOUTLINE") self.extraPoints:SetShadowOffset(0, 0) else self.extraPoints:SetFont(config.extraFont, config.extraFontSize) self.extraPoints:SetShadowOffset(1, -1) end self.extraPoints:SetParent(self) self.extraPoints:SetPoint("CENTER", 0, 0) end function nPower.SetupRunes(self) self.Rune = {} for i = 1, 6 do self.Rune[i] = self:CreateFontString(nil, "ARTWORK") self.Rune[i]:SetParent(self) if (config.rune.runeFontOutline) then self.Rune[i]:SetFont(config.rune.runeFont, config.rune.runeFontSize, "THINOUTLINE") self.Rune[i]:SetShadowOffset(0, 0) else self.Rune[i]:SetFont(config.rune.runeFont, config.rune.runeFontSize) self.Rune[i]:SetShadowOffset(1, -1) end self.Rune[i]:SetJustifyV("MIDDLE") self.Rune[i]:SetJustifyH("CENTER") self.Rune[i]:SetWidth(config.rune.runeFontSize*1.2) end -- Left Side self.Rune[3]:SetPoint("RIGHT", self, "CENTER", -2, 2) self.Rune[2]:SetPoint("RIGHT", self.Rune[3], "LEFT", -2, 0) self.Rune[1]:SetPoint("RIGHT", self.Rune[2], "LEFT", -2, 0) --Right Side self.Rune[4]:SetPoint("LEFT", self, "CENTER", 2, 2) self.Rune[5]:SetPoint("LEFT", self.Rune[4], "RIGHT", 2, 0) self.Rune[6]:SetPoint("LEFT", self.Rune[5], "RIGHT", 2, 0) self:SetScript("OnUpdate", RuneUpdate) if (self.HPText) then nPower.UpdateHealthTextLocation(self) end end function nPower.SetupHolyPower(self) if UnitLevel("player") < PALADINPOWERBAR_SHOW_LEVEL then self:RegisterEvent("PLAYER_LEVEL_UP") return end self.Rune = {} for i = 1, 5 do self.Rune[i] = self:CreateFontString(nil, "ARTWORK") self.Rune[i]:SetParent(self) if (config.holyPower.holyFontOutline) then self.Rune[i]:SetFont(config.holyPower.holyFont, config.holyPower.holyFontSize, "THINOUTLINE") self.Rune[i]:SetShadowOffset(0, 0) else self.Rune[i]:SetFont(config.holyPower.holyFont, config.holyPower.holyFontSize) self.Rune[i]:SetShadowOffset(1, -1) end self.Rune[i]:SetJustifyV("MIDDLE") self.Rune[i]:SetJustifyH("CENTER") self.Rune[i]:SetWidth(config.holyPower.holyFontSize) end -- Center Point self.Rune[3]:SetPoint("CENTER", 0, 2) -- Left Side self.Rune[2]:SetPoint("RIGHT", self.Rune[3], "LEFT", -2, 0) self.Rune[1]:SetPoint("RIGHT", self.Rune[2], "LEFT", -2, 0) -- Right Side self.Rune[4]:SetPoint("LEFT", self.Rune[3], "RIGHT", 2, 0) self.Rune[5]:SetPoint("LEFT", self.Rune[4], "RIGHT", 2, 0) self:SetScript("OnUpdate", HolyPowerUpdate) if (self.HPText) then nPower.UpdateHealthTextLocation(self) end end
return {'baptisme','baptist','baptisterium','baptistisch','baptistenpredikant','baptiste','baptist','baptiste','baptista','baptisten','baptistische','baptisteria','baptists','baptistes'}
local Enum = require("api.Enum") local IItemFood = require("mod.elona.api.aspect.IItemFood") -- -- Edible Fish -- data:add { _type = "base.item", _id = "bomb_fish", elona_id = 261, image = "elona.item_bomb_fish", value = 280, weight = 350, material = "elona.fresh", level = 3, rarity = 5000000, coefficient = 100, categories = { "elona.food", "elona.offering_fish" }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 6 } } } data:add { _type = "base.item", _id = "moonfish", elona_id = 345, image = "elona.item_moonfish", value = 900, weight = 800, material = "elona.fresh", level = 12, rarity = 500000, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } data:add { _type = "base.item", _id = "sardine", elona_id = 346, image = "elona.item_fish", value = 1200, weight = 1250, material = "elona.fresh", level = 15, rarity = 300000, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } data:add { _type = "base.item", _id = "flatfish", elona_id = 347, image = "elona.item_flatfish", value = 700, weight = 900, material = "elona.fresh", level = 10, rarity = 400000, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } data:add { _type = "base.item", _id = "manboo", elona_id = 348, image = "elona.item_manboo", value = 1500, weight = 2400, material = "elona.fresh", level = 17, rarity = 200000, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } data:add { _type = "base.item", _id = "seabream", elona_id = 349, image = "elona.item_seabream", value = 150, weight = 800, material = "elona.fresh", level = 3, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } data:add { _type = "base.item", _id = "salmon", elona_id = 350, image = "elona.item_salmon", value = 170, weight = 600, material = "elona.fresh", level = 3, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } data:add { _type = "base.item", _id = "globefish", elona_id = 351, image = "elona.item_globefish", value = 320, weight = 550, material = "elona.fresh", level = 5, rarity = 600000, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } data:add { _type = "base.item", _id = "tuna", elona_id = 352, image = "elona.item_tuna_fish", value = 640, weight = 700, material = "elona.fresh", level = 7, rarity = 500000, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } data:add { _type = "base.item", _id = "cutlassfish", elona_id = 353, image = "elona.item_cutlassfish", value = 620, weight = 600, material = "elona.fresh", level = 7, rarity = 500000, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } data:add { _type = "base.item", _id = "sandborer", elona_id = 354, image = "elona.item_sandborer", value = 380, weight = 450, material = "elona.fresh", level = 5, rarity = 600000, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } data:add { _type = "base.item", _id = "fish", elona_id = 618, image = "elona.item_fish", value = 1200, weight = 1250, material = "elona.fresh", level = 15, fltselect = Enum.FltSelect.Sp, rarity = 300000, coefficient = 100, categories = { "elona.no_generate", "elona.food", "elona.offering_fish", }, _ext = { [IItemFood] = { food_type = "elona.fish", spoilage_hours = 4 } } } -- -- Junk Fish -- data:add { _type = "base.item", _id = "wood_piece", elona_id = 43, image = "elona.item_wood_piece", value = 10, weight = 120, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.junk", "elona.junk_in_field" } } data:add { _type = "base.item", _id = "garbage", elona_id = 45, image = "elona.item_garbage", value = 8, weight = 80, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.junk", "elona.junk_in_field" } } data:add { _type = "base.item", _id = "dead_fish", elona_id = 220, image = "elona.item_bomb_fish", value = 4, weight = 50, coefficient = 100, tags = { "fish" }, categories = { "elona.tag_fish", "elona.junk", "elona.junk_in_field" } } data:add { _type = "base.item", _id = "fish_junk", elona_id = 619, image = "elona.item_fish", value = 1200, weight = 1250, level = 15, fltselect = Enum.FltSelect.Sp, rarity = 300000, coefficient = 100, categories = { "elona.no_generate", "elona.junk" } }
---------------------------------------------------------------------------------------------------- -- Creator Tools LUA File Utilities File ---------------------------------------------------------------------------------------------------- -- Author: Native Instruments -- Written by: Yaron Eshkar -- Modified: April 23, 2021 -- -- This file includes useful functions for usage in Creator Tools Lua scripts. -- Simply include this line in any script (if running a script from another location that users this file, -- make sure to point to the correct path): -- local ctFile = require("CtFile") -- Then you can simply call any function like: -- ctFile.test_function() -- -- It is also possible of course to copy entire specific functions from this list directly into your script. -- In that case remove the CtFile part from the function name, and then simply call it normally like: -- test_function() -- local root_path = filesystem.parentPath(scriptPath) package.path = root_path .. "/?.lua;" .. package.path local ctUtil = require("Modules.CtUtil") local CtFile = {} --- Test Function. -- Takes no arguments, prints to console when called. function CtFile.test_function() -- Show that the class import and test function executes by printing a line. print("Test function called") end --- Check duplicate file names in path. -- Checks a path and subfolders and returns a table listing paths of duplicate file names. -- @tparam string path the directory path to start checking from. -- @tparam string file_extention the file extention to look for. -- @tparam bool verbose_mode when true prints information to console. -- @treturn table returns a table with the paths of all duplicate file names. function CtFile.check_duplicate_file_names(path,file_extention,verbose_mode) local sample_paths_table = ctUtil.paths_to_table(path,file_extention) local file_names_table = {} local temp_duplicate_table = {} for index, file in next,sample_paths_table do file_names_table[index] = filesystem.filename(file) end for index, file in next,sample_paths_table do local duplicate_check = {} duplicate_check = ctUtil.table_collect_duplicates(file_names_table,sample_paths_table,file_names_table[index]) if #duplicate_check > 0 then for i=1,#duplicate_check do table.insert(temp_duplicate_table,duplicate_check[i]) end end end for index, file in next,sample_paths_table do local temp_table = {} temp_table = ctUtil.table_remove_duplicates(temp_duplicate_table,sample_paths_table[index]) temp_duplicate_table = {} for i=1,#temp_table do temp_duplicate_table[i] = temp_table[i] end end if verbose_mode then if #temp_duplicate_table>0 then print("Duplicate check failed! Duplicate file names found:") for i=1,#temp_duplicate_table do print(temp_duplicate_table[i]) end end end return temp_duplicate_table end --- Copy a file. -- Copies a file from source to destination path. -- @tparam string source the source file to copy. -- @tparam string destination the destination path to copy to. -- @treturn bool function CtFile.copy_file(source,destination) local execute_string if CtFile.get_os() then s1 = "/Y" execute_string = string.format([[xcopy "%s" "%s" %s]],source,destination,s1) else execute_string = string.format([[cp "%s" "%s"]],source,destination) end CtFile.run_shell_command(execute_string,false) return true end --- Create a directory. -- Creates a directory with the specified path name. -- @tparam string directory the directory path to create. -- @tparam bool verbose_mode when true prints information to console. -- @treturn bool function CtFile.create_directory(directory,verbose_mode) if verbose_mode == nil then verbose_mode = true end local execute_string if not filesystem.isDirectory(directory) then execute_string = string.format([[mkdir "%s"]],directory) CtFile.run_shell_command(execute_string,false) if verbose_mode then print("Directory "..directory.." created") end return true else if verbose_mode then print("Directory "..directory.." exists") end return false end end --- Delete a file. -- Deletes the specified file. -- @tparam string file the file to delete. -- @treturn bool function CtFile.delete_file(file) local execute_string if CtFile.get_os() then s1 = "/f" execute_string = string.format([[del %s "%s"]],s1,file) else execute_string = string.format([[rm "%s"]],file) end CtFile.run_shell_command(execute_string,false) return true end --- Get the Operating System type. -- Determine if the script is running on Windows or Mac. -- @treturn bool true if windows, otherwise false. function CtFile.get_os() local path_sep = package.config:sub(1,1) local is_win if path_sep == "\\" then is_win = true else is_win = false end return is_win end --- Run an OS shell command. -- Executes a command on the operating system console. -- @tparam string command the shell command to execute. -- @tparam bool verbose_mode when true prints information to console. -- @treturn bool function CtFile.run_shell_command(command,verbose_mode) if verbose_mode == nil then verbose_mode = true end if verbose_mode then print("Executing shell command: "..command) end os.execute(command) return true end --- Run shell command and return a string. -- Executes a command on the operating system console, optionally returing anything printed by the command to the console as a string. -- @tparam string command the shell command to execute. -- @tparam bool raw when true the function will return the result formated. -- @treturn string returns the console print result. function CtFile.capture_shell_command(command,raw) local f = assert(io.popen(command, 'r')) local s = assert(f:read('*a')) f:close() if raw then return s end s = string.gsub(s, '^%s+', '') s = string.gsub(s, '%s+$', '') s = string.gsub(s, '[\n\r]+', ' ') return s end --- Runs a shell command and prints the result to console. function CtFile.print_shell_command(command) f = assert (io.popen (command)) for line in f:lines() do print(line) end f:close() return true end --- Run a shell command on a file, overwriting the original file. -- Executes a shell command on a file, overwriting the original file with the result. A temporary file location must be specified for the processing. -- @tparam string command the shell command to execute. -- @tparam string file the original file. -- @tparam string temp_file a temporary file path for the intermediate operation. -- @treturn bool function CtFile.run_file_process(command,file,temp_file,delete_temp) if delete_temp == nil then delete_temp = true end CtFile.run_shell_command(command,false) CtFile.copy_file(temp_file,file) if delete_temp then CtFile.delete_file(temp_file) end return true end --- Reads a file and returns the contents as a string. -- Reads a file in the specified mode and returns the contents as a string. -- @tparam string file the file to read. -- @tparam string mode the read mode. -- @treturn string returns a string with the file contents. function CtFile.read_file_to_string(file,mode) local f = assert(io.open(file, mode)) local content = f:read("*all") f:close() return content end --- Replace a line in a file. -- Overwrites a given line in a file with the specfied string. -- @tparam string input_file the file to read and wtie to. -- @tparam int replace_line the line in the file to be replaced. -- @tparam string replace_content the content that should replace the line. -- @treturn bool function CtFile.replace_line_in_file(input_file,replace_line,replace_content) local file = io.open(input_file, 'r') local file_content = {} for line in file:lines() do table.insert (file_content, line) end io.close(file) file_content[replace_line] = replace_content file = io.open(input_file, 'w') for index, value in ipairs(file_content) do file:write(value..'\n') end io.close(file) return true end function CtFile.write_file(input_file,file_content) local file = io.open(input_file, 'w') file:write(file_content) io.close(file) return true end -- return the CtFile object. return CtFile
local localStorage = nil local coords = nil local function echo (msg) print(msg) end local function updatePosition () TriggerEvent('localstorage:getSharedObject', function (obj) localStorage = obj end) while not localStorage do Citizen.Wait(0) end coords = localStorage.getItem('position') if coords ~= nil then echo('Update player position') coords = json.decode(coords) SetEntityCoords( GetPlayerPed(-1), coords.x, coords.y, coords.z - 1 ) end end local function savePosition () echo('Save player position') coords = GetEntityCoords(GetPlayerPed(-1)) localStorage.setItem('position', json.encode({ x = coords.x; y = coords.y; z = coords.z; })) end AddEventHandler('playerSpawned', function () echo('Player spawned') updatePosition() end) Citizen.CreateThread(function () updatePosition() -- handle restart while true do Citizen.Wait(10000) savePosition() end end)
----------------------------------- -- Area: Horlais Peak -- Mob: Fighting Sheep -- BCNM: Hostile Herbivores -- TODO: melee attacks cause knockback. ----------------------------------- require("scripts/globals/status") ----------------------------------- function onMobInitialize(mob) mob:setMod(tpz.mod.ICERES, 75) end function onMobDeath(mob, player, isKiller) end
local cwd = (...):gsub("%.[^%.]+$", "") .. "." require(cwd .. "math") require(cwd .. "string") require(cwd .. "table") require(cwd .. "bitwise") require(cwd .. "struct") require(cwd .. "const") require(cwd .. "util") require(cwd .. "globals") require(cwd .. "config") require(cwd .. "settings") require(cwd .. "keyboard") require(cwd .. "mouse") require(cwd .. "net") --require(cwd .. "classes") -- ui require(cwd .. "ui.uiwidget") require(cwd .. "ui.uiwindow") require(cwd .. "ui.effects") require(cwd .. "ui.tooltip") require(cwd .. "ui.uibutton") require(cwd .. "ui.uicheckbox") require(cwd .. "ui.uicombobox") require(cwd .. "ui.uiimageview") require(cwd .. "ui.uiinputbox") require(cwd .. "ui.uilabel") require(cwd .. "ui.uimessagebox") require(cwd .. "ui.uiminiwindow") require(cwd .. "ui.uiminiwindowcontainer") require(cwd .. "ui.uimovabletabbar") require(cwd .. "ui.uipopupmenu") require(cwd .. "ui.uipopupscrollmenu") require(cwd .. "ui.uiprogressbar") require(cwd .. "ui.uiradiogroup") require(cwd .. "ui.uiresizeborder") require(cwd .. "ui.uiscrollarea") require(cwd .. "ui.uiscrollbar") require(cwd .. "ui.uispinbox") require(cwd .. "ui.uisplitter") require(cwd .. "ui.uitabbar") require(cwd .. "ui.uitable") require(cwd .. "ui.uitextedit") require(cwd .. "inputmessage") require(cwd .. "outputmessage") local _M = {} function _M.init() end function _M.terminate() end return _M
-- Copyright (c) 2019 StefanT <stt1@gmx.at> -- -- Original from Logistics Train Network, Copyright (c) 2017 Optera, MIT license -- -- See LICENSE.md in the project directory for license information. -- local trainStop = copy_prototype(data.raw["recipe"]["train-stop"], CTM_STOP) trainStop.enabled = false trainStop.ingredients = { {"train-stop", 1}, {"constant-combinator", 1}, {"small-lamp", 1}, {"green-wire", 2}, {"red-wire", 2} } local requester = copy_prototype(data.raw["recipe"]["small-lamp"], CTM_REQUESTER) requester.enabled = false requester.ingredients = { {"small-lamp", 1}, {"electronic-circuit", 2} } data:extend({ trainStop, requester })
local csv = require("utils.csv") local P = require("levelhead.data.properties") local E = Class(require("levelhead.data.base")) function E:initialize() --parse data file local rawHeaders self.data, rawHeaders = csv.parseString(love.filesystem.read("data/levelElements.tsv"),"\t") self.N_INHERITENCE_CHECKS = 20 --parse headers self.headers = {} for i,v in ipairs(rawHeaders) do local raw = self:reduceSelector(v) if raw:match("^name$") then self.headers.name = v elseif raw:match("^iddecimal$") then self.headers.id = v elseif raw:match("width") then self.headers.width = v elseif raw:match("height") then self.headers.height = v elseif raw:match("^parent") then self.headers.parent = v elseif raw:match("^properties") then self.headers.properties = v end end end function E:getWidth(selector) return self:getRow(selector)[self.headers.width] or "$UnknownWidth" end function E:getHeight(selector) return self:getRow(selector)[self.headers.height] or "$UnknownHeight" end function E:getSize(selector) local r = self:getRow(selector) return r[self.headers.width] or "$UnknownWidth", r[self.headers.height] or "$UnknownHeight" end function E:getParent(selector) return self:getRow(selector)[self.headers.parent] or "$UnknownParent" end --uses reduced selectors function E:buildPropertyIDMap(element) local out = {} for propId in self:iterateProperties(element) do out[self:reduceSelector(P:getName(propId))] = propId end return out end --uses reduced propertySelector -- returns nil on unknown properties data instead of a $ error string function E:getPropertyID(elementSelector,propertySelector) local row = self:getRow(elementSelector) if not row.propertyIDMap then if row[self.headers.properties]==nil then return nil end row.propertyIDMap = self:buildPropertyIDMap(elementSelector) end return row.propertyIDMap[self:reduceSelector(propertySelector)] end function E:hasProperties(selector) local start = selector for _=1,self.N_INHERITENCE_CHECKS,1 do local r = self:getRow(selector) local base = r[self.headers.properties] if base==nil then return "$UnknownProperties" end if base=="None" then return false end if base=="Inherit" then local p = r[self.headers.parent] if p==nil then return "$UnknownProperties" end selector = p else return true end end error(string.format("Failed to get property status of %q (start: %q), parent lookup took >%d checks, it's probably recursing.",selector,start,self.N_INHERITENCE_CHECKS)) end function E:iterateProperties(selector) local start = selector for _=1,self.N_INHERITENCE_CHECKS,1 do local r = self:getRow(selector) local base = r[self.headers.properties] if base==nil then error(string.format("Can't iterate unknown properties of %q (start: %q).",selector,start)) end if base=="None" then --thise object has no properties --return a function that returns nil return function() end end if base=="Inherit" then local p = r[self.headers.parent] if p==nil then error(string.format("Can't iterate properties of %q (start: %q) due to unknown parents.",selector,start)) end selector = p else --if there's only 1 id, the csv loader converts it into a number, which can't be iterated --this is a quick hack if type(base)=="number" then base = tostring(base) end --wrap string:gmatch() to tonumber() everything local f,s,v = base:gmatch("(%d+)") return function(s,v) v = f(s,v) return v==nil and nil or tonumber(v) end, s, v end end error(string.format("Failed to get property status of %q (start: %q), parent lookup took >%d checks, it's probably recursing.",selector,start,self.N_INHERITENCE_CHECKS)) end return E:new()
local pendingPing = nil local isPending = false function AddBlip(bData) pendingPing.blip = AddBlipForCoord(bData.x, bData.y, bData.z) SetBlipSprite(pendingPing.blip, bData.id) SetBlipAsShortRange(pendingPing.blip, true) SetBlipScale(pendingPing.blip, bData.scale) SetBlipColour(pendingPing.blip, bData.color) BeginTextCommandSetBlipName("STRING") AddTextComponentString(bData.name) EndTextCommandSetBlipName(pendingPing.blip) pendingPing.count = 0 end function TimeoutPingRequest() Citizen.CreateThread(function() local count = 0 while isPending do count = count + 1 if count >= Config.Timeout and isPending then exports['ND_notify']:DoHudText('inform', 'Ping From ' .. pendingPing.name .. ' Timed Out') TriggerServerEvent('ND_ping:server:SendPingResult', pendingPing.id, 'timeout') pendingPing = nil isPending = false end Citizen.Wait(1000) end end) end function TimeoutBlip() Citizen.CreateThread(function() while pendingPing ~= nil do if pendingPing.count ~= nil then if pendingPing.count >= Config.BlipDuration then RemoveBlip(pendingPing.blip) pendingPing = nil else pendingPing.count = pendingPing.count + 1 end end Citizen.Wait(1000) end end) end function RemoveBlipDistance() local player = PlayerPedId() Citizen.CreateThread(function() while pendingPing ~= nil do local plyCoords = GetEntityCoords(player) local dist = math.floor(#(vector2(pendingPing.pos.x, pendingPing.pos.y) - vector2(plyCoords.x, plyCoords.y))) if dist < Config.DeleteDistance then RemoveBlip(pendingPing.blip) pendingPing = nil else Citizen.Wait(math.floor((dist - Config.DeleteDistance) * 30)) end end end) end RegisterNetEvent('ND_ping:client:SendPing') AddEventHandler('ND_ping:client:SendPing', function(sender, senderId) if pendingPing == nil then pendingPing = {} pendingPing.id = senderId pendingPing.name = sender pendingPing.pos = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(pendingPing.id)), false) TriggerServerEvent('ND_ping:server:SendPingResult', pendingPing.id, 'received') exports['ND_notify']:DoCustomHudText('inform', pendingPing.name .. ' Sent You a Ping, Use /ping accept To Accept', (Config.Timeout * 1000)) isPending = true if Config.Timeout > 0 then TimeoutPingRequest() end else exports['ND_notify']:DoHudText('inform', sender .. ' Attempted To Ping You') TriggerServerEvent('ND_ping:server:SendPingResult', senderId, 'unable') end end) RegisterNetEvent('ND_ping:client:AcceptPing') AddEventHandler('ND_ping:client:AcceptPing', function() if isPending then local playerBlip = { name = pendingPing.name, color = Config.BlipColor, id = Config.BlipIcon, scale = Config.BlipScale, x = pendingPing.pos.x, y = pendingPing.pos.y, z = pendingPing.pos.z } AddBlip(playerBlip) if Config.RouteToPing then SetNewWaypoint(pendingPing.pos.x, pendingPing.pos.y) end if Config.Timeout > 0 then TimeoutBlip() end if Config.DeleteDistance > 0 then RemoveBlipDistance() end exports['ND_notify']:DoHudText('inform', pendingPing.name .. '\'s Location Showing On Map') TriggerServerEvent('ND_ping:server:SendPingResult', pendingPing.id, 'accept') isPending = false else exports['ND_notify']:DoHudText('inform', 'You Have No Pending Ping') end end) RegisterNetEvent('ND_ping:client:RejectPing') AddEventHandler('ND_ping:client:RejectPing', function() if pendingPing ~= nil then exports['ND_notify']:DoHudText('inform', 'Rejected Ping From ' .. pendingPing.name) TriggerServerEvent('ND_ping:server:SendPingResult', pendingPing.id, 'reject') pendingPing = nil isPending = false else exports['ND_notify']:DoHudText('inform', 'You Have No Pending Ping') end end) RegisterNetEvent('ND_ping:client:RemovePing') AddEventHandler('ND_ping:client:RemovePing', function() if pendingPing ~= nil then RemoveBlip(pendingPing.blip) pendingPing = nil exports['ND_notify']:DoHudText('inform', 'Player Ping Removed') else exports['ND_notify']:DoHudText('inform', 'You Have No Player Ping') end end)
local metadata = { plugin = { format = 'staticLibrary', -- This is the name without the 'lib' prefix. staticLibs = {'plugin_googleAnalytics','z','sqlite3'}, frameworks = {'SystemConfiguration','CoreData','iAd'}, frameworksOptional = {'AdSupport'}, }, } return metadata
data:extend({ { type = "item", name = "subterra-telepad-up", icon = "__subterra__/graphics/icons/stairs-up-icon-32.png", icon_size = 32, flags = { }, subgroup = "subterra-transport", order = "s[telepad-2]", place_result = "subterra-telepad-up", stack_size = 50 }, { type = "item", name = "subterra-telepad-down", icon = "__subterra__/graphics/icons/stairs-down-icon-32.png", icon_size = 32, flags = { }, subgroup = "subterra-transport", order = "s[telepad-1]", place_result = "subterra-telepad-down", stack_size = 50 }, -- { -- type = "rail-planner", -- name = "subterra-rail", -- icon = "__base__/graphics/icons/rail.png", -- icon_size = 32, -- flags = { }, -- subgroup = "transport", -- order = "s[train-system]-s[rail]", -- place_result = "subterra-straight-rail", -- stack_size = 100, -- straight_rail = "subterra-straight-rail", -- curved_rail = "subterra-curved-rail" -- }, })
local PlayerNumber = ... assert( PlayerNumber ) local song_bpms= {} local function format_bpm(bpm) return ("%.0f"):format(bpm) end -- Courses don't have GetDisplayBpms. if GAMESTATE:GetCurrentSong() then song_bpms= GAMESTATE:GetCurrentSong():GetDisplayBpms() song_bpms[1]= math.round(song_bpms[1]) song_bpms[2]= math.round(song_bpms[2]) if song_bpms[1] == song_bpms[2] then T1 = song_bpms[1] T2 = song_bpms[1] else T1 = song_bpms[1] T2 = song_bpms[2] end end local t = Def.ActorFrame { Def.Sprite { Texture="_Down Receptor Go"; Frame0000=0; Delay0000=1; Frame0001=1; Delay0001=1; Frame0002=2; Delay0002=1; Frame0003=3; Delay0003=1; InitCommand=cmd(y,100;rotationz,0;effectclock,"beat";diffuseramp;effectcolor1,0.1,0.1,0.1,1;effectcolor2,1,1,1,1;effectperiod,0.5;effecttiming,0.25,0.50,0,0.25;effectoffset,-0.25); }; LoadActor("black") .. { Name="Nep-Nep-Arrow", OnCommand=function(self) y = 480+50 s = 1 m = 1 song_bpms= GAMESTATE:GetCurrentSong():GetDisplayBpms() song_bpms[1]= math.round(song_bpms[1]) song_bpms[2]= math.round(song_bpms[2]) if song_bpms[1] == song_bpms[2] then bpm = format_bpm(song_bpms[1]) else T1 = format_bpm(song_bpms[1]) T2 = format_bpm(song_bpms[2]) end bpm = T2 self:playcommand('Hi') self:rotationz(0) end, HiCommand=function(self) if y <= 100 then y = 480+50 if m == 1 and song_bpms[1] ~= song_bpms[2] then bpm = T1 m = 2 elseif m == 2 and song_bpms[1] ~= song_bpms[2] then bpm = T2 m = 1 end else y = y - (0.02 * s * bpm) end self:y(y) self:sleep(0.02) self:queuecommand('Hi') end, }, LoadFont("_8-bit madness 24px")..{ Name="allofWTFcommand", InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffuse,color("#FF1100")), OnCommand=function(self) F = math.random(5,50) local speed, mode= GetSpeedModeAndValueFromPoptions(PlayerNumber) self:playcommand("SpeedChoiceChanged", {pn= PlayerNumber, mode= mode, speed= speed}) --self:settext(speed.."/"..mode) self:sleep(0.02) self:queuecommand('loop') end, SpeedChoiceChangedMessageCommand= function(self, param) if param.pn ~= PlayerNumber then return end local no_change= true if param.mode == "x" then if not song_bpms[1] then bpm = 800 else s = param.speed*.01 if m == 1 and song_bpms[1] ~= song_bpms[2] then bpm = song_bpms[1] elseif m == 2 and song_bpms[1] ~= song_bpms[2] then bpm = song_bpms[2] else bpm = song_bpms[1] end T1 = song_bpms[1] T2 = song_bpms[2] end no_change= param.speed == 100 elseif param.mode == "C" then bpm = 1 T1 = 1 T2 = 1 s = param.speed else no_change= param.speed == song_bpms[2] if song_bpms[1] == song_bpms[2] then s = param.speed bpm = param.speed else local factor= song_bpms[1] / song_bpms[2] s = 1 T1 = format_bpm(param.speed*factor) T2 = param.speed if m == 1 then bpm = format_bpm(param.speed*factor) elseif m == 2 then bpm = param.speed end end end --self:settext(m..'\nSpeed:'..s..' Bpm:'..bpm..'\n'..T1..'/'..T2) end } } return t
local segment = {} segment.name = "blahblahtestplugin" segment.help = "This is a test plugin. All it does is show off some of the features of the new command system." segment.commands = { ["test"] = { help = {embed = { title = "Test command", description = "Blah Blah Test Command. Adds two numbers together", fields = { {name = "Usage:",value = "test <number> <number>"}, {name = "Perms:",value = "any"} } }}, perms = { any = true }, args = { "number", "number" }, exec = function(msg) local n1,n2 = msg.content:match("(%d+) (%d+)") if n1 and n2 then msg:reply(n1+n2) end end, }, ["testPerms"] = { help = {embed={ title = "Test Admin Permissions", description = "Blah blah test admin descripton.", fields = { {name = "Usage:",value = "testPerms"}, {name = "Perms:",value = "administrator"} } }}, perms = { any = false, users = { ["245973168257368076"] = true }, roles = { ["738377452262522881"] = true }, perms = { "administrator" } }, exec = function(msg) msg:reply("Yes, you are an admin or the Owner of this bot. Congrats") end, }, ["shortForm"] = { exec = function(msg) msg:reply("yeeeeeeeeeeeeeeeeeeeeeeeeeeeee haw") --this is the shortest possible form of a command. --help is by default generated from args --args by default is set to none --perms is by default set to all end, } } segment.unload = function() print("Unloading package blahblahtestplugin") end return segment
keepStockRatio = 0.3 ---@class InventoryPanelResource ---@field public resource string ---@field public index number ---@field public maxStock number ---@field public localIndex number ---@field public display MicroDisplayModule ---@field public status IndicatorModule InventoryPanelResource = {} ---@class InventoryPanelData ---@field public resources InventoryPanelResource[] ---@field public panels Actor[] InventoryPanelData = {} ---@param resource string ---@param index number ---@return InventoryPanelResource function InventoryPanelResource.new(resource, index) ---@type InventoryPanelResource local obj = { resource = resource, index = index, maxStock = 0, localIndex = 0, display = nil, status = nil, } setmetatable(obj, InventoryPanelResource) InventoryPanelResource.__index = InventoryPanelResource return obj end function InventoryPanelResource:update(resource) if self.display ~= nil and self.status ~= nil then if resource.reservedAmount > 0 then self.display:setText(tostring(resource.amount) .. "\n" .. resource.reservedAmount) self.display:setColor(0.5, 0.5, 0, 0.4) else self.display:setText(tostring(resource.amount)) self.display:setColor(0, 0.5, 0, 0.4) end local sum = resource.amount - resource.reservedAmount local p = sum / self.maxStock if p <= 0 then self:setEmpty(self) elseif p >= 1 then self:setFull(self) elseif p < keepStockRatio then self:setLow(self) else self:setOK(self) end end end local STATUS_INDICATOR_ALPHA = 0.5 function InventoryPanelResource:setOK() self.status:setColor(0, 1, 0, STATUS_INDICATOR_ALPHA) end function InventoryPanelResource:setFull() self.status:setColor(1, 0.3, 0, STATUS_INDICATOR_ALPHA) end function InventoryPanelResource:setLow() self.status:setColor(1, 1, 0, STATUS_INDICATOR_ALPHA) end function InventoryPanelResource:setEmpty() self.status:setColor(1, 0, 0.01, STATUS_INDICATOR_ALPHA) end
local lua = arg[-1] io.stderr:write '----LuaSocket test: should take about a minute\n' if package.config:match '^/' then -- i.e. Unix... os.execute (lua..' ../test/testsrvr.lua &') else os.execute('start '..lua..' ../test/testsrvr.lua') end os.execute (lua..' ../test/testclnt.lua')
-- -- Author: SunLightJuly -- Date: 2014-07-29 16:56:47 -- local ArmatureTestLayer = require("layers.ArmatureTestLayer") local TestDragonBones20 = class("TestDragonBones20", ArmatureTestLayer) function TestDragonBones20:ctor(index) TestDragonBones20.super.ctor(self) self:creatTitleAndSubTitle(index) end function TestDragonBones20:onEnter() local armature = ccs.Armature:create("Dragon") armature:getAnimation():playWithIndex(1) armature:getAnimation():setSpeedScale(0.4) armature:setPosition(cc.p(display.cx, display.cy * 0.3)) armature:setScale(0.6) self:addChild(armature) end return TestDragonBones20
return function(url,parent,scriptName,scriptType) -- check if the links are valid if url == nil then warn("No url provided.") return end if url:sub(1,18) ~= "https://github.com" then warn(("%q is an invalid GitHub url."):format(url)) return end if not table.find(url:split("."),"lua") then warn("You must include a .lua file!") return end if scriptType ~= "ModuleScript" or scriptType ~= "Script" or scriptType ~= "LocalScript" then warn("You must provide a valid script type! (eg. ModuleScript, Script, LocalScript)") local startTime = tick() local rawURL = "https://raw.githubusercontent.com"..url:sub(18) -- get the raw url link local ImportedScript if rawURl then ImportedScript = Instance.new(scriptType) ImportedScript.Name = scriptName ImportedScript.Parent = parent ImportedScript.Source = game:GetService("HttpService"):GetAsync(rawURl) end print("Done importing "..url..", you can find the script at: "..ImportedScript:GetFullName()) print("Time taken: "..startTime - tick()) end
-------------------------------- -- @module PhysicsContactPreSolve -------------------------------- -- @function [parent=#PhysicsContactPreSolve] getFriction -- @param self -- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#PhysicsContactPreSolve] getRestitution -- @param self -- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#PhysicsContactPreSolve] setFriction -- @param self -- @param #float float -------------------------------- -- @function [parent=#PhysicsContactPreSolve] ignore -- @param self -------------------------------- -- @function [parent=#PhysicsContactPreSolve] getSurfaceVelocity -- @param self -- @return point_table#point_table ret (return value: point_table) -------------------------------- -- @function [parent=#PhysicsContactPreSolve] setSurfaceVelocity -- @param self -- @param #point_table point -------------------------------- -- @function [parent=#PhysicsContactPreSolve] setRestitution -- @param self -- @param #float float return nil
E2Helper.Descriptions["shipmentName"] = "Returns the name of the shipment." E2Helper.Descriptions["shipmentType"] = "Returns the class of the weapon the shipment spawns." E2Helper.Descriptions["shipmentPrice"] = "Returns the price of the shipment." E2Helper.Descriptions["shipmentAmount"] = "Returns the number of guns in the shipment." E2Helper.Descriptions["shipmentModel"] = "Returns the model of the gun in the shipment." E2Helper.Descriptions["isShipment"] = "Returns whether the entity is a shipment or not."
slot2 = "MonthCardPayCcsView" MonthCardPayCcsView = class(slot1) MonthCardPayCcsView.onCreationComplete = function (slot0) slot8 = slot0.view ClassUtil.extends(slot2, slot0, ZoomPopUpChildView, true, slot0, slot0.bg) end MonthCardPayCcsView.onZoomShowTweenComplete = function (slot0) slot3 = slot0 ZoomPopUpChildView.onZoomShowTweenComplete(slot2) end MonthCardPayCcsView.hide = function (slot0, slot1, slot2) slot7 = slot2 ZoomPopUpChildView.hide(slot4, slot0, slot1) end MonthCardPayCcsView.onBtnClick = function (slot0, slot1, slot2) if slot1 == slot0.view.btnClose then slot6 = false slot0.model.setIsShowingMonthCardPay(slot4, slot0.model) elseif slot1 == slot0.view.layerContent.btnWechat then elseif slot1 == slot0.view.layerContent.btnALi then elseif slot1 == slot0.view.layerContent.btnQQ then elseif slot1 == slot0.view.layerContent.btnUnion then elseif slot1 == slot0.view.layerContent.btnJd then elseif slot1 == slot0.view.layerContent.btnApple then end end MonthCardPayCcsView.destroy = function (slot0) slot3 = slot0.view.btnClose destroySomeObj(slot2) slot3 = slot0.view.layerContent.btnWechat destroySomeObj(slot2) slot3 = slot0.view.layerContent.btnALi destroySomeObj(slot2) slot3 = slot0.view.layerContent.btnQQ destroySomeObj(slot2) slot3 = slot0.view.layerContent.btnUnion destroySomeObj(slot2) slot3 = slot0.view.layerContent.btnJd destroySomeObj(slot2) slot3 = slot0.view.layerContent.btnApple destroySomeObj(slot2) slot3 = slot0 ZoomPopUpChildView.destroy(slot2) end return
-- Bind Keys required function bindKeys(res) if (res==getThisResource()) then bindKey("p", "down", toggleFlashers) end end addEventHandler("onClientResourceStart", getRootElement(), bindKeys) function toggleFlashers() local veh = getPedOccupiedVehicle(getLocalPlayer()) if (veh) then local modelid = getElementModel(veh) if (governmentVehicle[modelid]) then local lights = getVehicleOverrideLights(veh) local state = getElementData(veh, "flashers") if (lights==2) then if not (state) then setElementData(veh, "flashers", true, true) setVehicleLightState(veh, 0, 1) setVehicleLightState(veh, 1, 0) else setElementData(veh, "flashers", nil, true) setVehicleLightState(veh, 0, 0) setVehicleLightState(veh, 1, 0) end end end end end governmentVehicle = { [416]=true, [427]=true, [490]=true, [528]=true, [407]=true, [544]=true, [523]=true, [596]=true, [597]=true, [598]=true, [599]=true, [601]=true, [428]=true } policevehicles = { } policevehicleids = { } function streamIn() if (getElementType(source)=="vehicle") then local modelid = getElementModel(source) if (governmentVehicle[modelid]) then for i = 1, #policevehicles+1 do if (policevehicles[i]==nil) then policevehicles[i] = source policevehicleids[source] = i break end end end end end addEventHandler("onClientElementStreamIn", getRootElement(), streamIn) function streamOut() if (getElementType(source)=="vehicle") then if (policevehicleids[source]~=nil) then local id = policevehicleids[source] policevehicleids[source] = nil policevehicles[id] = nil end end end addEventHandler("onClientElementStreamOut", getRootElement(), streamOut) function doFlashes() if (#policevehicles==0) then return end for key, veh in ipairs(policevehicles) do if not (getElementType(veh)) then local id = policevehicleids[veh] policevehicleids[veh] = nil policevehicles[id] = nil elseif (getElementData(veh, "flashers")) then local state1 = getVehicleLightState(veh, 0) local state2 = getVehicleLightState(veh, 1) setVehicleLightState(veh, 0, state2) setVehicleLightState(veh, 1, state1) end end end setTimer(doFlashes, 250, 0) function vehicleBlown() setElementData(source, "flashers", nil, true) end addEventHandler("onVehicleRespawn", getRootElement(), vehicleBlown)
log("home.lua") return function(app,obs) http:send({ method="GET", url="http://kkmofang.cn/job/?id=1", type="text", onload = function(data) log(data) end, onfail = function(err) log(err) end, onresponse = function(response) log(response.headers["Content-Type"]) end }) log(obs.get({"app","title"})) end
-- ============================================================================ -- OrbFrames.lua -- ---------------------------------------------------------------------------- -- A. AddOn setup -- B. AceAddon callbacks -- C. Options table -- ============================================================================ local _, OrbFrames = ... local L = LibStub('AceLocale-3.0'):GetLocale('OrbFrames') local AceAddon = LibStub('AceAddon-3.0') local AceConfig = LibStub('AceConfig-3.0') local AceConfigCmd = LibStub('AceConfigCmd-3.0') local AceConfigDialog = LibStub('AceConfigDialog-3.0') local AceDB = LibStub('AceDB-3.0') -- ============================================================================ -- A. AddOn setup -- ============================================================================ _G.OrbFrames = AceAddon:NewAddon(OrbFrames, 'OrbFrames', 'AceConsole-3.0') -- Version info OrbFrames.version = '0.0' -- Default config data OrbFrames.defaults = { profile = { }, } -- ============================================================================ -- B. AceAddon callbacks -- ============================================================================ function OrbFrames:OnInitialize() self:InitOptions() end function OrbFrames:OnEnable() end function OrbFrames:OnDisable() end -- ============================================================================ -- C. Options table -- ============================================================================ local options = { name = 'OrbFrames', handler = OrbFrames, type = 'group', args = { } } function OrbFrames:InitOptions() self.db = AceDB:New('OrbFramesDB', self.defaults, true) AceConfig:RegisterOptionsTable('OrbFrames', options) self:RegisterChatCommand('of', 'ChatCommand') self:RegisterChatCommand('orbframes', 'ChatCommand') AceConfigDialog:AddToBlizOptions('OrbFrames') end function OrbFrames:ChatCommand(input) if InCombatLockdown() then self:Print(L['Cannot access options during combat.']) return end if not input or input:trim() == '' then self:OpenBlizzConfig() else AceConfigCmd.HandleCommand(OrbFrames, 'of', 'OrbFrames', input) end end function OrbFrames:OpenBlizzConfig() InterfaceOptionsFrame_OpenToCategory('OrbFrames') InterfaceOptionsFrame_OpenToCategory('OrbFrames') end
commun = {} commun.setup = function() enduser_setup.start( function() print("Connected to wifi as:" .. wifi.sta.getip()) end, function(err, str) print("enduser_setup: Err #" .. err .. ": " .. str) end ); tmr.alarm(2, 1000, 1, function() if wifi.ap.getip() == nil then print("Connecting to AP...") else print("IP Info: \nIP Address: ", wifi.ap.getip()) tmr.stop(2) end end) end commun.put = function(data, iv, deviceid) http.put('http://'..vars.server..'/api/v1/devices', 'Content-Type: text/plain\r\nuid: '..deviceid..'\r\niv: '..iv..'\r\n', data, function(code, data) if (code < 0) then print("HTTP request failed") else print(code, data) end end ) end
---@class EquipGrowWindow 质点成长界面 ---@field nodeState number 当前节点状态 ---@field tabState number 当前分页状态 ---@field rawModelState number 当前模型显示状态 ---@field equipData EquipMgr_EquipData local EquipGrowWindow = DClass("EquipGrowWindow", BaseWindow) _G.EquipGrowWindow = EquipGrowWindow EquipGrowWindow.RAWMODEL_STATE = { NONE = 1, -- 关闭 BROWSE = 2, -- 浏览 位于中央 EXHIBITION = 3 -- 展示 在偏左位置 } EquipGrowWindow.NODE_STATE = { NONE = 1, DETAILS = 2, INTENSIFY = 3, BREAK = 4, AWAKEN = 5, AWAKEN_SUCCESS = 6 } EquipGrowWindow.TAB_STATE = { NONE = 1, DETAILS = 2, INTENSIFY = 3, AWAKEN = 4 } EquipGrowWindow.POS_EQUIPICON = { Vector2(0, 0), Vector2(-160, 0) } function EquipGrowWindow:ctor(data) ---@type EquipMgr_EquipData self.equipData = data[1][1] end EquipGrowWindow.equipCell = {} function EquipGrowWindow:onAsset() self.assetKeys = { "UI/Component/EquipInfoCell" } self.assetComplete = function(index, obj) if index == 1 then self.equipCell = obj.gameObject end end end function EquipGrowWindow:addListeners() --self.messager:addListener(Msg.EQUIP_OPEN_SELECTSUIT, self.openSelectSuit) self.messager:addListener(Msg.EQUIP_GROW_EQUIPDATA, self.updateEquipData) self.messager:addListener(Msg.EQUIP_GROW_LOOK, self.onLookEquip) self.messager:addListener(Msg.EQUIP_GROW_SHOWAWAKEN, self.onSetAwakenSuccess) self.messager:addListener(Msg.EQUIPGROW_CHANGE_NODESTATE, self.setGrowNodesState) end function EquipGrowWindow:updateEquipData(data) self.equipData = data end function EquipGrowWindow:onDispose() self.cpt_BaseInfo:onDispose() self.cpt_Details:onDispose() self.cpt_Intensify:onDispose() self.cpt_Break:onDispose() self.cpt_Awaken:onDispose() self.cpt_AwakenSuccess:onDispose() self.messager:dispose() end function EquipGrowWindow:onAsset() end function EquipGrowWindow:onInit() self:addListeners() self:addEventHandler(self.nodes.btnDetails.onClick, self.onClickDetails) self:addEventHandler(self.nodes.btnIntensify.onClick, self.onClickIntensify) self:addEventHandler(self.nodes.btnAwaken.onClick, self.onClickAwaken) self:addEventHandler(self.nodes.btnLookBack.onClick, self.onLookBack) self:addEventHandler(self.nodes.btnAwakenBack.onClick, self.onAwakenBack) self.nodes.btnLookBack.gameObject:SetActive(false) self.cpt_BaseInfo = self:createComponent(self.nodes.nodeBaseInfo.gameObject, EquipGrow_BaseInfo) self.cpt_Details = self:createComponent(self.nodes.nodeDetails.gameObject, EquipGrow_Details) self.cpt_Intensify = self:createComponent(self.nodes.nodeIntensify.gameObject, EquipGrow_Intensify) self.cpt_Break = self:createComponent(self.nodes.nodeBreak.gameObject, EquipGrow_Break) self.cpt_Awaken = self:createComponent(self.nodes.nodeAwaken.gameObject, EquipGrow_Awaken) self.cpt_AwakenSuccess = self:createComponent(self.nodes.nodeAwakenSuccess.gameObject, EquipGrow_AwakenSuccess) MsgCenter.sendMessage(Msg.EQUIP_GROW_EQUIPDATA, self.equipData) self:setGrowNodesState(self.NODE_STATE.DETAILS) self:setTabsState(self.TAB_STATE.DETAILS) self:onSetEquipIcon() end ---点击关闭浏览 function EquipGrowWindow:onLookBack() self:onLookEquip(false) end ---点击详情 function EquipGrowWindow:onClickDetails() self:setGrowNodesState(self.NODE_STATE.DETAILS) self:setTabsState(self.TAB_STATE.DETAILS) end ---点击强化 function EquipGrowWindow:onClickIntensify() local configEquipGroup = Config.EquipStage[self.equipData.quality] local isMaxLv = self.equipData.lv >= configEquipGroup.maxlevel --isMaxLv = true -- if isMaxLv then self:setGrowNodesState(self.NODE_STATE.BREAK) else self:setGrowNodesState(self.NODE_STATE.INTENSIFY) end self:setTabsState(self.TAB_STATE.INTENSIFY) end ---点击觉醒 function EquipGrowWindow:onClickAwaken() self:setGrowNodesState(self.NODE_STATE.AWAKEN) self:setTabsState(self.TAB_STATE.AWAKEN) end function EquipGrowWindow:setTabsState(btn) if self.tabState == btn then return end self.tabState = btn self.nodes.btnDetails.transform:Find("Image_active").gameObject:SetActive(btn == self.TAB_STATE.DETAILS) self.nodes.btnIntensify.transform:Find("Image_active").gameObject:SetActive(btn == self.TAB_STATE.INTENSIFY) self.nodes.btnAwaken.transform:Find("Image_active").gameObject:SetActive(btn == self.TAB_STATE.AWAKEN) self.nodes.btnAwaken.gameObject:SetActive(EquipManager:checkSkillHasSlot(self.equipData.skills)) end function EquipGrowWindow:onSetEquipIcon() EquipManager:setEquipIcon(self, self.nodes.rawModel.transform:GetComponent(typeof(Image)), self.equipData.cId) end ---设置model显示的位置 ---@param state number self.RAWMODEL_STATE function EquipGrowWindow:setRawModelState(state) if self.rawModelState == state then return end self.rawModelState = state if state == self.RAWMODEL_STATE.NONE then self.nodes.nodeTabs.gameObject:SetActive(false) self.nodes.rawModel.gameObject:SetActive(false) elseif state == self.RAWMODEL_STATE.BROWSE then self.nodes.rawModel.gameObject:SetActive(true) self.nodes.rawModel.transform.localPosition = self.POS_EQUIPICON[1] self.nodes.nodeTabs.gameObject:SetActive(false) elseif state == self.RAWMODEL_STATE.EXHIBITION then self.nodes.rawModel.gameObject:SetActive(true) self.nodes.rawModel.transform.localPosition = self.POS_EQUIPICON[2] self.nodes.nodeTabs.gameObject:SetActive(true) end end ---设置质点培养所有节点状态 ---@param state number self.NODE_STATE function EquipGrowWindow:setGrowNodesState(state) if self.nodeState == state then return end self.nodeState = state self.nodes.nodeBaseInfo.gameObject:SetActive(false) self.nodes.nodeDetails.gameObject:SetActive(false) self.nodes.nodeIntensify.gameObject:SetActive(false) self.nodes.nodeBreak.gameObject:SetActive(false) self.nodes.nodeAwaken.gameObject:SetActive(false) self.nodes.nodeAwakenSuccess.gameObject:SetActive(false) self:setRawModelState(self.RAWMODEL_STATE.EXHIBITION) MsgCenter.sendMessage(Msg.SHOW_TOPBANNER, true) if state == self.NODE_STATE.NONE then self:setRawModelState(self.RAWMODEL_STATE.NONE) elseif state == self.NODE_STATE.DETAILS then self.nodes.nodeDetails.gameObject:SetActive(true) self.nodes.nodeBaseInfo.gameObject:SetActive(true) self.cpt_Details:onUpdateUI() elseif state == self.NODE_STATE.INTENSIFY then self.nodes.nodeIntensify.gameObject:SetActive(true) self.cpt_Intensify:onInitUI() self.cpt_Intensify:onUpdateUI() elseif state == self.NODE_STATE.BREAK then self.nodes.nodeBreak.gameObject:SetActive(true) self.nodes.nodeBaseInfo.gameObject:SetActive(true) self.cpt_Break:onInitUI() elseif state == self.NODE_STATE.AWAKEN then self.nodes.nodeAwaken.gameObject:SetActive(true) self.nodes.nodeBaseInfo.gameObject:SetActive(true) self.cpt_Awaken:onUpdateUI() elseif state == self.NODE_STATE.AWAKEN_SUCCESS then MsgCenter.sendMessage(Msg.SHOW_TOPBANNER, false) self:setRawModelState(self.RAWMODEL_STATE.BROWSE) self.nodes.nodeAwakenSuccess.gameObject:SetActive(true) self.cpt_AwakenSuccess:onUpdateUI() end end ---浏览质点 function EquipGrowWindow:onLookEquip(show) self.nodes.btnLookBack.gameObject:SetActive(show) self.nodes.imgIconBg:SetActive(not show) MsgCenter.sendMessage(Msg.SHOW_TOPBANNER,not show) if show then self:setGrowNodesState(self.NODE_STATE.NONE) self:setRawModelState(self.RAWMODEL_STATE.BROWSE) else self:setGrowNodesState(self.NODE_STATE.DETAILS) self:setRawModelState(self.RAWMODEL_STATE.EXHIBITION) end end ---觉醒界面返回 function EquipGrowWindow:onAwakenBack() --self:onSetAwakenSuccess(false) end ---设置觉醒成功界面 function EquipGrowWindow:onSetAwakenSuccess(show) self.nodes.btnAwakenBack.gameObject:SetActive(show) if show then self:setGrowNodesState(self.NODE_STATE.AWAKEN_SUCCESS) else self:setGrowNodesState(self.NODE_STATE.AWAKEN) end end
local require = require(script:FindFirstAncestor("lockbox-test-autogen").Parent.innerRequire) return function() local String = require("string"); local Array = require("lockbox.util.array"); local Stream = require("lockbox.util.stream"); local Base64 = require("lockbox.util.base64"); local test_vectors = { { plain = "foobar", enc = "Zm9vYmFy" }, { plain = "fooba", enc = "Zm9vYmE=" }, { plain = "foob", enc = "Zm9vYg==" }, { plain = "foo", enc = "Zm9v" }, { plain = "fo", enc = "Zm8=" }, { plain = "f", enc = "Zg==" }, { plain = "", enc = "" }, }; for _, v in pairs(test_vectors) do local out out = Base64.fromStream(Stream.fromString(v.plain)); assert(out == v.enc, String.format("STREAM ENCODING FAILED expected(%s) actual(%s)", v.enc, out)); out = Base64.fromArray(Array.fromString(v.plain)); assert(out == v.enc, String.format("STREAM ENCODING FAILED expected(%s) actual(%s)", v.enc, out)); out = Base64.fromString(v.plain); assert(out == v.enc, String.format("ARRAY ENECODING FAILED expected(%s) actual(%s)", v.enc, out)); out = Base64.toStream(v.enc); out = Stream.toString(out); assert(out == v.plain, String.format("ARRAY DECODING FAILED expected(%s) actual(%s)", v.plain, out)); out = Base64.toArray(v.enc); out = Array.toString(out); assert(out == v.plain, String.format("ARRAY DECODING FAILED expected(%s) actual(%s)", v.plain, out)); out = Base64.toString(v.enc); assert(out == v.plain, String.format("ARRAY DECODING FAILED expected(%s) actual(%s)", v.plain, out)); end end
--- === hs.grid === --- --- Move/resize windows within a grid --- --- Usage: local grid = require "hs.grid" --- --- The grid is an partition of your screen; by default it is 3x3, i.e. 3 cells wide by 3 cells tall. --- --- Grid cells are just a table with keys: x, y, w, h --- --- For a grid of 2x2: --- --- * a cell {x=0, y=0, w=1, h=1} will be in the upper-left corner --- * a cell {x=1, y=0, w=1, h=1} will be in the upper-right corner --- * and so on... local grid = {} local fnutils = require "hs.fnutils" local window = require "hs.window" local alert = require "hs.alert" --- hs.grid.MARGINX = 5 --- Variable --- The margin between each window horizontally. grid.MARGINX = 5 --- hs.grid.MARGINY = 5 --- Variable --- The margin between each window vertically. grid.MARGINY = 5 --- hs.grid.GRIDHEIGHT = 3 --- Variable --- The number of cells high the grid is. grid.GRIDHEIGHT = 3 --- hs.grid.GRIDWIDTH = 3 --- Variable --- The number of cells wide the grid is. grid.GRIDWIDTH = 3 local function round(num, idp) local mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult end --- hs.grid.get(win) --- Function --- Gets the cell this window is on function grid.get(win) local winframe = win:frame() local winscreen = win:screen() if not winscreen then return nil end local screenrect = win:screen():frame() local thirdscreenwidth = screenrect.w / grid.GRIDWIDTH local halfscreenheight = screenrect.h / grid.GRIDHEIGHT return { x = round((winframe.x - screenrect.x) / thirdscreenwidth), y = round((winframe.y - screenrect.y) / halfscreenheight), w = math.max(1, round(winframe.w / thirdscreenwidth)), h = math.max(1, round(winframe.h / halfscreenheight)), } end --- hs.grid.set(win, grid, screen) --- Function --- Sets the cell this window should be on function grid.set(win, cell, screen) local screenrect = screen:frame() local thirdscreenwidth = screenrect.w / grid.GRIDWIDTH local halfscreenheight = screenrect.h / grid.GRIDHEIGHT local newframe = { x = (cell.x * thirdscreenwidth) + screenrect.x, y = (cell.y * halfscreenheight) + screenrect.y, w = cell.w * thirdscreenwidth, h = cell.h * halfscreenheight, } newframe.x = newframe.x + grid.MARGINX newframe.y = newframe.y + grid.MARGINY newframe.w = newframe.w - (grid.MARGINX * 2) newframe.h = newframe.h - (grid.MARGINY * 2) win:setFrame(newframe) end --- hs.grid.snap(win) --- Function --- Snaps the window into a cell function grid.snap(win) if win:isStandard() then local gridframe = grid.get(win) if gridframe then grid.set(win, gridframe, win:screen()) end end end --- hs.grid.adjustHeight(by) --- Function --- Increases the grid by the given number of cells; may be negative function grid.adjustHeight(by) grid.GRIDHEIGHT = math.max(1, grid.GRIDHEIGHT + by) alert.show("grid is now " .. tostring(grid.GRIDHEIGHT) .. " tiles high", 1) fnutils.map(window.visibleWindows(), grid.snap) end --- hs.grid.adjustWidth(by) --- Function --- Widens the grid by the given number of cells; may be negative function grid.adjustWidth(by) grid.GRIDWIDTH = math.max(1, grid.GRIDWIDTH + by) alert.show("grid is now " .. tostring(grid.GRIDWIDTH) .. " tiles wide", 1) fnutils.map(window.visibleWindows(), grid.snap) end --- hs.grid.adjustFocusedWindow(fn) --- Function --- Passes the focused window's cell to fn and uses the result as its new cell. function grid.adjustFocusedWindow(fn) local win = window.focusedWindow() local f = grid.get(win) if f then fn(f) grid.set(win, f, win:screen()) end end --- hs.grid.maximizeWindow() --- Function --- Maximizes the focused window along the given cell. function grid.maximizeWindow() local win = window.focusedWindow() local f = {x = 0, y = 0, w = grid.GRIDWIDTH, h = grid.GRIDHEIGHT} local winscreen = win:screen() if winscreen then grid.set(win, f, winscreen) end end --- hs.grid.pushWindowNextScreen() --- Function --- Moves the focused window to the next screen, using its current cell on that screen. function grid.pushWindowNextScreen() local win = window.focusedWindow() local gridframe = grid.get(win) if gridframe then grid.set(win, gridframe, win:screen():next()) end end --- hs.grid.pushWindowPrevScreen() --- Function --- Moves the focused window to the previous screen, using its current cell on that screen. function grid.pushWindowPrevScreen() local win = window.focusedWindow() local gridframe = grid.get(win) if gridframe then grid.set(win, gridframe, win:screen():previous()) end end --- hs.grid.pushWindowLeft() --- Function --- Moves the focused window one cell to the left. function grid.pushWindowLeft() grid.adjustFocusedWindow(function(f) f.x = math.max(f.x - 1, 0) end) end --- hs.grid.pushWindowRight() --- Function --- Moves the focused window one cell to the right. function grid.pushWindowRight() grid.adjustFocusedWindow(function(f) f.x = math.min(f.x + 1, grid.GRIDWIDTH - f.w) end) end --- hs.grid.resizeWindowWider() --- Function --- Resizes the focused window's right side to be one cell wider. function grid.resizeWindowWider() grid.adjustFocusedWindow(function(f) if f.w + f.x >= grid.GRIDWIDTH and f.x > 0 then f.x = f.x - 1 end f.w = math.min(f.w + 1, grid.GRIDWIDTH - f.x) end) end --- hs.grid.resizeWindowThinner() --- Function --- Resizes the focused window's right side to be one cell thinner. function grid.resizeWindowThinner() grid.adjustFocusedWindow(function(f) f.w = math.max(f.w - 1, 1) end) end --- hs.grid.pushWindowDown() --- Function --- Moves the focused window to the bottom half of the screen. function grid.pushWindowDown() grid.adjustFocusedWindow(function(f) f.y = math.min(f.y + 1, grid.GRIDHEIGHT - f.h) end) end --- hs.grid.pushWindowUp() --- Function --- Moves the focused window to the top half of the screen. function grid.pushWindowUp() grid.adjustFocusedWindow(function(f) f.y = math.max(f.y - 1, 0) end) end --- hs.grid.resizeWindowShorter() --- Function --- Resizes the focused window so its height is 1 grid count less. function grid.resizeWindowShorter() grid.adjustFocusedWindow(function(f) f.y = f.y - 0; f.h = math.max(f.h - 1, 1) end) end --- hs.grid.resizeWindowTaller() --- Function --- Resizes the focused window so its height is 1 grid count higher. function grid.resizeWindowTaller() grid.adjustFocusedWindow(function(f) if f.y + f.h >= grid.GRIDHEIGHT and f.y > 0 then f.y = f.y -1 end f.h = math.min(f.h + 1, grid.GRIDHEIGHT - f.y) end) end return grid
---@type Config local Config = ECSLoader:ImportModule("Config") local _Config = Config.private ---@type Stats local Stats = ECSLoader:ImportModule("Stats") ---@type i18n local i18n = ECSLoader:ImportModule("i18n") function _Config:LoadMeleeSection() return { type = "group", order = 2, inline = false, width = 2, name = function() return i18n("MELEE") end, args = { showMeleeStats = { type = "toggle", order = 0, name = function() return i18n("MELEE_SETTINGS") end, desc = function() return i18n("MELEE_SETTINGS_DESC") end, width = 1.5, get = function () return ExtendedCharacterStats.profile.melee.display; end, set = function (info, value) ExtendedCharacterStats.profile.melee.display = value Stats:RebuildStatInfos() end, }, meleeAttackPower = { type = "toggle", order = 1, name = function() return i18n("MELEE_ATTACK_POWER_SETTING") end, desc = function() return i18n("MELEE_ATTACK_POWER_SETTING_DESC") end, width = 1.5, disabled = function() return (not ExtendedCharacterStats.profile.melee.display); end, get = function () return ExtendedCharacterStats.profile.melee.attackPower.display; end, set = function (info, value) ExtendedCharacterStats.profile.melee.attackPower.display = value Stats:RebuildStatInfos() end, }, meleeCrit = { type = "toggle", order = 2, name = function() return i18n("MELEE_CRIT_SETTING") end, desc = function() return i18n("MELEE_CRIT_SETTING_DESC") end, width = 1.5, disabled = function() return (not ExtendedCharacterStats.profile.melee.display); end, get = function () return ExtendedCharacterStats.profile.melee.crit.display; end, set = function (info, value) ExtendedCharacterStats.profile.melee.crit.display = value Stats:RebuildStatInfos() end, }, meleeHit = { type = "toggle", order = 3, name = function() return i18n("MELEE_HIT_SETTING") end, desc = function() return i18n("MELEE_HIT_SETTING_DESC") end, width = 1.5, disabled = function() return (not ExtendedCharacterStats.profile.melee.display); end, get = function () return ExtendedCharacterStats.profile.melee.hit.display; end, set = function (info, value) ExtendedCharacterStats.profile.melee.hit.display = value Stats:RebuildStatInfos() end, }, meleeHitGroup = { type = "group", order = 4, inline = true, name = function() return i18n("MELEE_HIT_VALUES_SETTING") end, args = { meleeHitBonus = { type = "toggle", order = 1, name = function() return i18n("HIT_BONUS_SETTING") end, desc = function() return i18n("MELEE_HIT_BONUS_SETTING_DESC") end, width = 1.5, disabled = function() return ((not ExtendedCharacterStats.profile.melee.display) or (not ExtendedCharacterStats.profile.melee.hit.display)); end, get = function () return ExtendedCharacterStats.profile.melee.hit.bonus.display; end, set = function (info, value) ExtendedCharacterStats.profile.melee.hit.bonus.display = value Stats:RebuildStatInfos() end, }, meleeMiss = { type = "toggle", order = 2, name = function() return i18n("MISS_CHANCE_SETTING") end, desc = function() return i18n("MELEE_MISS_CHANCE_SETTING_DESC") end, width = 1.5, disabled = function() return ((not ExtendedCharacterStats.profile.melee.display) or (not ExtendedCharacterStats.profile.melee.hit.display)); end, get = function () return ExtendedCharacterStats.profile.melee.hit.sameLevel.display; end, set = function (info, value) ExtendedCharacterStats.profile.melee.hit.sameLevel.display = value Stats:RebuildStatInfos() end, }, meleeMissBoss = { type = "toggle", order = 3, name = function() return i18n("MISS_CHANCE_BOSS_SETTING") end, desc = function() return i18n("MELEE_MISS_CHANCE_BOSS_SETTING_DESC") end, width = 1.5, disabled = function() return ((not ExtendedCharacterStats.profile.melee.display) or (not ExtendedCharacterStats.profile.melee.hit.display)); end, get = function () return ExtendedCharacterStats.profile.melee.hit.bossLevel.display; end, set = function (info, value) ExtendedCharacterStats.profile.melee.hit.bossLevel.display = value Stats:RebuildStatInfos() end, }, } }, }, } end
local gradient = surface.GetTextureID("gui/gradient") local surface = surface local PANEL = {} function PANEL:Init() self:AddTitle(nut.lang.Get("inventory")); self:SetSize(AdvNut.util.GetCurrentMenuSize()); self:SetPos(AdvNut.util.GetCurrentMenuPos()) self:MakePopup() self.colmunSheet = vgui.Create("DColumnSheet", self); self.colmunSheet:Dock(FILL); self.colmunSheet:DockMargin(5, 5, 5, 5); self.colmunSheet.Navigation:SetWide(self:GetWide() * 0.175); self.inventory = vgui.Create("AdvNut_inventroyPanel", self.colmunSheet); self.inventory:AddNoticeBar(nut.lang.Get("inv_tip"), 4); self.inventory:AddWeightBar(); self.inventory:Dock(FILL); self.colmunSheet:AddSheet(nut.lang.Get("inventory"), self.inventory, "icon16/box.png"); self.equippedInventory = vgui.Create("AdvNut_inventroyPanel", self.colmunSheet); self.equippedInventory:Dock(FILL); self.colmunSheet:AddSheet(nut.lang.Get("equippedinventory"), self.equippedInventory, "icon16/briefcase.png"); self:LoadItems(); end function PANEL:LoadItems() local inventoryItems = {}; local equippedItems = {}; local playerInventoryItems = LocalPlayer():GetInventory(); for k, v in pairs(playerInventoryItems) do local itemTable = nut.item.Get(k) local data; for d, item in pairs(v) do data = item.data if (itemTable) then if(data != nil and data.Equipped) then if(equippedItems[itemTable.category] == nil) then equippedItems[itemTable.category] = {}; end; table.insert(equippedItems[itemTable.category], {class = k, item = {item}, name = itemTable.name, index = d}); else if(inventoryItems[itemTable.category] == nil) then inventoryItems[itemTable.category] = {}; end; table.insert(inventoryItems[itemTable.category], {class = k, item = {item}, name = itemTable.name, index = d}); end; end; end; end; self:CreateItems(self.inventory, inventoryItems); self:CreateItems(self.equippedInventory, equippedItems); end; function PANEL:CreateItems(panel, items) panel.categories = {}; for _, itemsTable in SortedPairs(items) do for _, data in SortedPairsByMemberValue(itemsTable, 3) do local class = data.class; local items = data.item local index = data.index; local itemTable = nut.item.Get(class); if (itemTable and table.Count(items) > 0) then local categoryName = string.lower(itemTable.category); if (!panel.categories[categoryName]) then local categoryPanel = vgui.Create("AdvNut_CategoryList", panel.list); categoryPanel:Dock(TOP); categoryPanel:SetLabel(itemTable.category); categoryPanel:DockMargin(5, 5, 5, 5); local list = vgui.Create("DIconLayout"); list.Paint = function(panel, w, h) surface.SetDrawColor(Color(0, 0, 0, 0)); surface.DrawRect(0, 0, w, h); end; categoryPanel:SetContents(list); categoryPanel:InvalidateLayout(true); panel.categories[categoryName] = {list = list, category = categoryPanel, panel = panel}; end local list = panel.categories[categoryName].list; for k, v in SortedPairs(items) do local icon = list:Add("SpawnIcon"); icon:SetModel(itemTable.model or "models/error.mdl", itemTable.skin); icon:SetSize(nut.config.iconSize, nut.config.iconSize); icon:SetToolTip(nut.lang.Get("item_info", itemTable.name, itemTable:GetDesc(v.data))); icon.DoClick = function(icon) nut.item.OpenMenu(itemTable, v, index); end; if (itemTable.bodygroup) then for k, v in pairs(itemTable.bodygroup) do icon:SetBodyGroup( k, v ); end end if (itemTable.stackable) then local label = icon:Add("DLabel"); label:SetPos(8, 3); label:SetWide(64); label:SetText(v.quantity); label:SetFont("DermaDefaultBold"); label:SetDark(true); label:SetExpensiveShadow(1, Color(240, 240, 240)) else for i = 2, v.quantity do local icon = list:Add("SpawnIcon"); icon:SetModel(itemTable.model or "models/error.mdl", itemTable.skin); icon:SetSize(nut.config.iconSize, nut.config.iconSize); icon:SetToolTip(nut.lang.Get("item_info", itemTable.name, itemTable:GetDesc(v.data))); icon.DoClick = function(icon) nut.item.OpenMenu(itemTable, v, index); end; end; end; end; elseif (table.Count(items) == 0) then LocalPlayer():GetInventory()[class] = nil; end end end end; nut.char.HookVar("inv", "refreshInv", function(character) if (IsValid(nut.gui.inv)) then nut.gui.inv:Reload() end end) function PANEL:Reload() local parent = self:GetParent() self:Remove() nut.gui.inv = vgui.Create("nut_Inventory", parent) nut.gui.menu:SetCurrentMenu(nut.gui.inv, true) end vgui.Register("nut_Inventory", PANEL, "AdvNut_BaseForm") local PANEL = {}; function PANEL:Init() self:SetBackgroundColor(Color(0, 0, 0, 0)); self.list = vgui.Create("AdvNut_ScrollPanel", self); self.list:SetDrawBackground(false); self.list:Dock(FILL); end; function PANEL:AddWeightBar() local weight_tail = 25; self.weight = vgui.Create("DPanel", self); self.weight:Dock(TOP); self.weight:SetTall(weight_tail); self.weight:DockMargin(5, 2, 5, 5); self.weight:SetDrawBackground(true); self.weight.Paint = function(panel, w, h) local width = self.weightValue or 0; local color = nut.config.mainColor; surface.SetTexture(surface.GetTextureID("gui/gradient_up")); surface.SetDrawColor(0, 0, 0, 200); surface.DrawTexturedRect(0, 0, w, h); surface.SetDrawColor(132, 184, 112, 190); surface.DrawRect(0, 0, w * width, h); surface.SetDrawColor(145, 145, 145, 190); surface.DrawRect(w-(w-(w * width)), 0, w * (18 + width), h); AdvNut.util.DrawOutline(self.weight, 1, color_black); end; local weight, maxWeight = LocalPlayer():GetInvWeight(); self.weightValue = weight / maxWeight; self.weightText = vgui.Create("DLabel", self.weight); self.weightText:Dock(FILL); self.weightText:SetExpensiveShadow(1, color_black); self.weightText:SetTextColor(color_white); self.weightText:SetContentAlignment(5); self.weightText:SetText(weight.."kg".." / "..maxWeight.."kg"); end; function PANEL:AddNoticeBar(desc, barType) self.bar = self:Add("nut_NoticePanel"); self.bar:Dock(TOP); self.bar:DockMargin(5, 5, 5, 0); self.bar:SetType(barType); self.bar:SetText(desc); end; vgui.Register("AdvNut_inventroyPanel", PANEL, "AdvNut_BaseForm");
local os = os or require("os") local component = require("component") local event = require("event") local m = component.modem args = {...} if not m.isOpen(1) then m.open(1) end local function ping(addr, mode) if addr == nil then print("Cannot ping nil IPv4.") os.exit() end local mode = mode or 'value' local mac = nil if ARP then for i, v in pairs(ARP) do if (v[1] == addr or v[2] == addr or v[3] == addr) then mac = v[3] break end end end if mac == nil then m.broadcast(1, "find", addr) else if IPv4 == nil then print("Register an IPv4 before using direct ping.") os.exit() end m.send(mac, 1, "dirPing", IPv4) end local _, _, from, port, _, message = event.pull(3, "modem_message") if mac == nil then ARP[#ARP+1] = {nil, addr, from} end if mode == 'value' then print("\nFrom IPv4 . . " .. addr) print("From MAC . . . " .. from) print("Port . . . . . " .. port) print("Message . . . " .. message .. "\n") return from, port, message elseif mode == 'bool' then if from == nil then return false else return true end end end if args[1] == nil then print("Specify a command.") os.exit() elseif args[1] == 'ping' then if args[2] == nil then print("You must specify an address to ping, and optionally, the ping mode.") os.exit() elseif args[3] == nil then ping(args[2]) os.exit() else print(ping(args[2], args[3])) end elseif args[1] == 'arp' then if ARP == nil then print("ARP table has not been initialized. Cannot run command.") os.exit() end print("\nALIAS, IPv4, MAC") print("---------------------------------------") for i, v in pairs(ARP) do local one = nil if v[1] == nil then one = "N/A" else one = v[1] end print(string.format("%s, %s, %s", v[1], v[2], v[3])) end print() elseif args[1] == 'stat' then if args[2] == nil then elseif args[2] == 'port' then print("\nScanning for open ports...") local ret = "" for i=1, 65535 do if m.isOpen(i) then ret = ret .. tostring(i) .. ", " end end print("\n{" .. ret:sub(1, -3) .. "}\n") end else print("Invalid command.") end
AddCSLuaFile() ENT.Base = "bw_base_moneyprinter" ENT.Model = "models/props_lab/reciever01a.mdl" ENT.Skin = 0 ENT.Capacity = 30000000 ENT.PrintInterval = 1 ENT.PrintAmount = 10250 ENT.PrintName = "Quantum Printer" ENT.FontColor = Color(50, 90, 220) ENT.BackColor = color_white ENT.IsValidRaidable = true ENT.PresetMaxHealth = 3000
local classUtilities = require 'src.utils.class-utilities' local test = {} function test.validateOrComplain_validNoTable() classUtilities.validateOrComplain(1, 'number') end function test.validateOrComplain_validFlatTable() classUtilities.validateOrComplain({1, true, 'foo'}, {'number', 'boolean', 'string'}) end function test.validateOrComplain_validNestedTable() classUtilities.validateOrComplain({{1, true, 'foo'}, 1}, {{'number', 'boolean', 'string'}, 'number'}) end function test.validateOrComplain_invalidNoTable() local success, msg = pcall( function() classUtilities.validateOrComplain(true, 'number') end ) assert(not success, msg) end function test.validateOrComplain_invalidFlatTable() local success, msg = pcall( function() classUtilities.validateOrComplain({true, true, 'foo'}, {'number', 'boolean', 'string'}) end ) assert(not success, msg) end function test.validateOrComplain_invalidNestedTable() local success, msg = pcall( function() classUtilities.validateOrComplain({{1, true, 1}, 1}, {{'number', 'boolean', 'string'}, 'number'}) end ) assert(not success, msg) end return test
--- -- Decode RDS frames into RDS packets with a header and data payload. The -- supported data payloads are basic tuning, radiotext, and datetime. -- -- @category Protocol -- @block RDSDecoderBlock -- -- @signature in:RDSFrameType > out:RDSPacketType -- -- @usage -- local decoder = radio.RDSDecoderBlock() --- -- RDS packet type, a Lua object with properties: -- -- ``` text -- { -- header = { -- pi_code = <16-bit integer> -- group_code = <4-bit integer> -- group_version = <1-bit integer>, -- tp_code = <1-bit integer>, -- pty_code = <5-bit integer>, -- }, -- data = <payload object>, -- } -- ``` -- -- The payload object can be one of the four below. -- -- Basic tuning data payload: -- -- ``` text -- { -- type = "basictuning", -- ta_code = <1-bit integer>, -- ms_code = <1-bit integer>, -- di_position = <2-bit integer>, -- di_value = <1-bit integer>, -- af_code = {<8-bit integer>, <8-bit integer>} or nil, -- text_address = <2-bit integer>, -- text_data = <string, length 2>, -- } -- ``` -- -- Radio text data payload: -- -- ``` text -- { -- type = "radiotext", -- ab_flag = <1-bit integer>, -- text_address = <4-bit integer>, -- text_data = <string, length 4 or 2>, -- } -- ``` -- -- Datetime data payload: -- -- ``` text -- { -- type = "datetime", -- date = {year = <integer>, month = <integer>, day = <integer>}, -- time = {hour = <integer>, minute = <integer>, offset = <integer>}, -- } -- ``` -- -- Raw data payload (for unsupported group/version codes): -- -- ``` text -- { -- type = "raw", -- frame = {<16-bit integer>, <16-bit integer>, <16-bit integer>, <16-bit integer>}, -- } -- ``` -- -- @datatype RDSDecoderBlock.RDSPacketType -- @tparam table header Header table, as outlined above -- @tparam table data Data payload table, as outlined above local bit = require('bit') local json = require('radio.thirdparty.json') local block = require('radio.core.block') local types = require('radio.types') local RDSFrameType = require('radio.blocks.protocol.rdsframer').RDSFrameType -- RDS Packet Type local RDSPacketType = types.ObjectType.factory() function RDSPacketType.new(header, data) local self = setmetatable({}, RDSPacketType) self.header = header self.data = data return self end function RDSPacketType:__tostring() return string.format("RDSPacket<pi_code=0x%04x, group_code=%u, group_version=%u, tp_code=%u, pty_code=%u, payload=%s>", self.header.pi_code, self.header.group_code, self.header.group_version, self.header.tp_code, self.header.pty_code, json.encode(self.data)) end -- RDS Frame Decoders local function rds_decode_header(frame) -- See RDS Standard 2.2, pg. 13 -- Program Identification code = blocks[0][15:0] local pi_code = frame.blocks[0] -- Group code = blocks[1][15:12] local group_code = bit.rshift(frame.blocks[1], 12) -- Group version = blocks[1][11] local group_version = bit.band(bit.rshift(frame.blocks[1], 11), 0x1) -- Traffic program code = blocks[1][10] local tp_code = bit.band(bit.rshift(frame.blocks[1], 10), 0x1) -- Program type code = blocks[1][9:5] local pty_code = bit.band(bit.rshift(frame.blocks[1], 5), 0x1f) return { pi_code = pi_code, group_code = group_code, group_version = group_version, tp_code = tp_code, pty_code = pty_code, } end local function rds_decode_basic_tuning(header, frame) -- See RDS Standard 3.1.5.1, pg. 21 -- Traffic announce code = blocks[1][4] local ta_code = bit.band(bit.rshift(frame.blocks[1], 4), 0x1) -- Music/speech switch code = blocks[1][3] local ms_code = bit.band(bit.rshift(frame.blocks[1], 3), 0x1) -- Text address = blocks[1][1:0] local text_address = bit.band(frame.blocks[1], 0x3) -- Decoder identification position = ~text address local di_position = 3-text_address -- Decoder identification bit value = blocks[1][2] local di_value = bit.band(bit.rshift(frame.blocks[1], 2), 0x1) -- Alternative frequencies code = blocks[2][15:8], blocks[2][7:0] (present in version 0 only) local af_code = (header.group_version == 0) and {bit.rshift(frame.blocks[2], 8), bit.band(frame.blocks[2], 0xff)} or nil -- Text = blocks[3][15:8], blocks[3][7:0] local text_data = string.char(bit.rshift(frame.blocks[3], 8), bit.band(frame.blocks[3], 0xff)) return { type = 'basictuning', ta_code = ta_code, ms_code = ms_code, di_position = di_position, di_value = di_value, af_code = af_code, text_address = text_address, text_data = text_data, } end local function rds_decode_radiotext(header, frame) -- See RDS Standard 3.1.5.3, pg. 25 -- A/B flag = blocks[1][4] local ab_flag = bit.band(bit.rshift(frame.blocks[1], 4), 0x1) -- Text address = blocks[1][3:0] local text_address = bit.band(frame.blocks[1], 0x0f) -- Text data = 4 characters for version 0, 2 characters for version 1 local text_data if header.group_version == 0 then text_data = string.char(bit.rshift(frame.blocks[2], 8), bit.band(frame.blocks[2], 0xff), bit.rshift(frame.blocks[3], 8), bit.band(frame.blocks[3], 0xff)) else text_data = string.char(bit.rshift(frame.blocks[3], 8), bit.band(frame.blocks[3], 0xff)) end return { type = 'radiotext', ab_flag = ab_flag, text_address = text_address, text_data = text_data } end local function rds_decode_datetime(header, frame) -- See RDS Standard 3.1.5.6, pg. 28 -- Modified Julian Day code = blocks[1][1:0], blocks[2][15:1] local mjd = bit.bor(bit.lshift(bit.band(frame.blocks[1], 0x3), 15), bit.rshift(bit.band(frame.blocks[2], 0xfffe), 1)) -- Hour = blocks[2][0], blocks[3][15:12] local hour = bit.bor(bit.lshift(bit.band(frame.blocks[2], 0x1), 4), bit.rshift(bit.band(frame.blocks[3], 0xf000), 12)) -- Minute = blocks[3][11:6] local minute = bit.band(bit.rshift(frame.blocks[3], 6), 0x3f) -- Offset = blocks[3][5:0] local offset = bit.band(frame.blocks[3], 0x3f) -- Convert offset to signed hours offset = (bit.band(offset, 0x20) ~= 0) and -bit.band(offset, 0x1f) or bit.band(offset, 0x1f) offset = offset * 0.5 -- Convert MJD to year, month, day (RDS Standard Annex G, pg. 81) local yp = math.floor((mjd - 15078.2)/365.25) local mp = math.floor((mjd - 14956.1 - math.floor(yp * 365.25)) / 30.6001) local k = (mp == 14 or mp == 15) and 1 or 0 local day = mjd - 14956 - math.floor(yp * 365.25) - math.floor(mp * 30.6001) local month = mp - 1 - k * 12 local year = yp + k + 1900 return { type = 'datetime', date = {year = year, month = month, day = day}, time = {hour = hour, minute = minute, offset = offset} } end local function rds_decode_raw(header, frame) return { type = 'raw', frame = {frame.blocks[0], frame.blocks[1], frame.blocks[2], frame.blocks[3]} } end -- RDS Decode Block local RDSDecoderBlock = block.factory("RDSDecoderBlock") function RDSDecoderBlock:instantiate() self:add_type_signature({block.Input("in", RDSFrameType)}, {block.Output("out", RDSPacketType)}) end RDSDecoderBlock.RDSPacketType = RDSPacketType function RDSDecoderBlock:process(x) local out = RDSPacketType.vector() for i = 0, x.length-1 do -- Decode header local header = rds_decode_header(x.data[i]) -- Decode data local data if header.group_code == 0x0 then data = rds_decode_basic_tuning(header, x.data[i]) elseif header.group_code == 0x2 then data = rds_decode_radiotext(header, x.data[i]) elseif header.group_code == 0x4 and header.group_version == 0 then data = rds_decode_datetime(header, x.data[i]) else data = rds_decode_raw(header, x.data[i]) end -- Emit the decoded frame out:append(RDSPacketType(header, data)) end return out end return RDSDecoderBlock
local mType = Game.createMonsterType("Smuggler Baron Silvertoe") local monster = {} monster.description = "Smuggler Baron Silvertoe" monster.experience = 170 monster.outfit = { lookType = 134, lookHead = 38, lookBody = 0, lookLegs = 94, lookFeet = 95, lookAddons = 0, lookMount = 0 } monster.health = 280 monster.maxHealth = 280 monster.race = "blood" monster.corpse = 18225 monster.speed = 200 monster.manaCost = 0 monster.changeTarget = { interval = 4000, chance = 10 } monster.strategiesTarget = { nearest = 70, health = 10, damage = 10, random = 10, } monster.flags = { summonable = false, attackable = true, hostile = true, convinceable = false, pushable = false, rewardBoss = true, illusionable = false, canPushItems = true, canPushCreatures = false, staticAttackChance = 90, targetDistance = 1, runHealth = 15, healthHidden = false, isBlockable = false, canWalkOnEnergy = false, canWalkOnFire = false, canWalkOnPoison = false } monster.light = { level = 0, color = 0 } monster.summon = { maxSummons = 3, summons = { {name = "Wild Warrior", chance = 20, interval = 2000, count = 3} } } monster.voices = { interval = 5000, chance = 10, {text = "I will make your death look like an accident!", yell = false}, {text = "You should not have interferred with my bussiness!", yell = false}, {text = "Bribes are expensive, murder is cheap!", yell = false}, {text = "I see some profit in your death!", yell = false}, {text = "I expect you to die!", yell = false} } monster.loot = { {id = 3031, chance = 80000, maxCount = 30}, {id = 3294, chance = 10000} } monster.attacks = { {name ="melee", interval = 2000, chance = 100, minDamage = 0, maxDamage = -50}, {name ="combat", interval = 2000, chance = 15, type = COMBAT_PHYSICALDAMAGE, minDamage = 0, maxDamage = -40, range = 7, shootEffect = CONST_ANI_THROWINGKNIFE, target = false} } monster.defenses = { defense = 15, armor = 15, {name ="combat", interval = 2000, chance = 15, type = COMBAT_HEALING, minDamage = 10, maxDamage = 50, effect = CONST_ME_MAGIC_BLUE, target = false} } monster.elements = { {type = COMBAT_PHYSICALDAMAGE, percent = -5}, {type = COMBAT_ENERGYDAMAGE, percent = 0}, {type = COMBAT_EARTHDAMAGE, percent = 0}, {type = COMBAT_FIREDAMAGE, percent = 0}, {type = COMBAT_LIFEDRAIN, percent = 0}, {type = COMBAT_MANADRAIN, percent = 0}, {type = COMBAT_DROWNDAMAGE, percent = 0}, {type = COMBAT_ICEDAMAGE, percent = 0}, {type = COMBAT_HOLYDAMAGE , percent = 0}, {type = COMBAT_DEATHDAMAGE , percent = -5} } monster.immunities = { {type = "paralyze", condition = false}, {type = "outfit", condition = false}, {type = "invisible", condition = false}, {type = "bleed", condition = false} } mType.onThink = function(monster, interval) end mType.onAppear = function(monster, creature) if monster:getType():isRewardBoss() then monster:setReward(true) end end mType.onDisappear = function(monster, creature) end mType.onMove = function(monster, creature, fromPosition, toPosition) end mType.onSay = function(monster, creature, type, message) end mType:register(monster)
local helpers = require('test.functional.helpers')(after_each) local command = helpers.command local eval = helpers.eval local eq, neq = helpers.eq, helpers.neq local run = helpers.run describe('v:exiting', function() local cid before_each(function() helpers.clear() cid = helpers.nvim('get_api_info')[1] end) it('defaults to v:null', function() eq(1, eval('v:exiting is v:null')) end) it('is 0 on normal exit', function() local function on_setup() command('autocmd VimLeavePre * call rpcrequest('..cid..', "")') command('autocmd VimLeave * call rpcrequest('..cid..', "")') command('quit') end local function on_request() eq(0, eval('v:exiting')) return '' end run(on_request, nil, on_setup) end) it('is non-zero after :cquit', function() local function on_setup() command('autocmd VimLeavePre * call rpcrequest('..cid..', "")') command('autocmd VimLeave * call rpcrequest('..cid..', "")') command('cquit') end local function on_request() neq(0, eval('v:exiting')) return '' end run(on_request, nil, on_setup) end) end)
if not modules then modules = { } end modules ['lpdf-grp'] = { version = 1.001, comment = "companion to lpdf-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } local type, tonumber = type, tonumber local formatters, gsub = string.formatters, string.gsub local concat = table.concat local round = math.round local backends, lpdf = backends, lpdf local nodeinjections = backends.pdf.nodeinjections local colors = attributes.colors local basepoints = number.dimenfactors.bp local nodeinjections = backends.pdf.nodeinjections local codeinjections = backends.pdf.codeinjections local registrations = backends.pdf.registrations local pdfdictionary = lpdf.dictionary local pdfarray = lpdf.array local pdfconstant = lpdf.constant local pdfboolean = lpdf.boolean local pdfreference = lpdf.reference local pdfflushobject = lpdf.flushobject -- can also be done indirectly: -- -- 12 : << /AntiAlias false /ColorSpace 8 0 R /Coords [ 0.0 0.0 1.0 0.0 ] /Domain [ 0.0 1.0 ] /Extend [ true true ] /Function 22 0 R /ShadingType 2 >> -- 22 : << /Bounds [ ] /Domain [ 0.0 1.0 ] /Encode [ 0.0 1.0 ] /FunctionType 3 /Functions [ 31 0 R ] >> -- 31 : << /C0 [ 1.0 0.0 ] /C1 [ 0.0 1.0 ] /Domain [ 0.0 1.0 ] /FunctionType 2 /N 1.0 >> local function shade(stype,name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps,fractions) local func = nil -- -- domain has to be consistently added in all dictionaries here otherwise -- acrobat fails with a drawing error -- domain = pdfarray(domain) n = tonumber(n) -- if steps then local list = pdfarray() local bounds = pdfarray() local encode = pdfarray() for i=1,steps do if i < steps then bounds[i] = fractions[i] or 1 end encode[2*i-1] = 0 encode[2*i] = 1 list [i] = pdfdictionary { FunctionType = 2, Domain = domain, C0 = pdfarray(color_a[i]), C1 = pdfarray(color_b[i]), N = n, } end func = pdfdictionary { FunctionType = 3, Bounds = bounds, Encode = encode, Functions = list, Domain = domain, } else func = pdfdictionary { FunctionType = 2, Domain = domain, C0 = pdfarray(color_a), C1 = pdfarray(color_b), N = n, } end separation = separation and registrations.getspotcolorreference(separation) local s = pdfdictionary { ShadingType = stype, ColorSpace = separation and pdfreference(separation) or pdfconstant(colorspace), Domain = domain, Function = pdfreference(pdfflushobject(func)), Coords = pdfarray(coordinates), Extend = pdfarray { true, true }, AntiAlias = pdfboolean(true), } lpdf.adddocumentshade(name,pdfreference(pdfflushobject(s))) end function lpdf.circularshade(name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps,fractions) shade(3,name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps,fractions) end function lpdf.linearshade(name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps,fractions) shade(2,name,domain,color_a,color_b,n,colorspace,coordinates,separation,steps,fractions) end -- inline bitmaps but xform'd -- -- we could derive the colorspace if we strip the data -- and divide by x*y local template = "q BI %s ID %s > EI Q" local factor = 72/300 function nodeinjections.injectbitmap(t) -- encoding is ascii hex, no checking here local xresolution, yresolution = t.xresolution or 0, t.yresolution or 0 if xresolution == 0 or yresolution == 0 then return -- fatal error end local colorspace = t.colorspace if colorspace ~= "rgb" and colorspace ~= "cmyk" and colorspace ~= "gray" then -- not that efficient but ok local d = gsub(t.data,"[^0-9a-f]","") local b = math.round(#d / (xresolution * yresolution)) if b == 2 then colorspace = "gray" elseif b == 6 then colorspace = "rgb" elseif b == 8 then colorspace = "cmyk" end end colorspace = lpdf.colorspaceconstants[colorspace] if not colorspace then return -- fatal error end local d = pdfdictionary { W = xresolution, H = yresolution, CS = colorspace, BPC = 8, F = pdfconstant("AHx"), -- CS = nil, -- BPC = 1, -- IM = true, } -- for some reasons it only works well if we take a 1bp boundingbox local urx, ury = 1/basepoints, 1/basepoints -- urx = (xresolution/300)/basepoints -- ury = (yresolution/300)/basepoints local width, height = t.width or 0, t.height or 0 if width == 0 and height == 0 then width = factor * xresolution / basepoints height = factor * yresolution / basepoints elseif width == 0 then width = height * xresolution / yresolution elseif height == 0 then height = width * yresolution / xresolution end local image = img.new { stream = formatters[template](d(),t.data), width = width, height = height, bbox = { 0, 0, urx, ury }, } return img.node(image) end -- general graphic helpers function codeinjections.setfigurealternative(data,figure) local request = data.request local display = request.display if display and display ~= "" then local nested = figures.push { name = display, page = request.page, size = request.size, prefix = request.prefix, cache = request.cache, width = request.width, height = request.height, } figures.identify() local displayfigure = figures.check() if displayfigure then -- figure.aform = true img.immediatewrite(figure) local a = pdfarray { pdfdictionary { Image = pdfreference(figure.objnum), DefaultForPrinting = true, } } local d = pdfdictionary { Alternates = pdfreference(pdfflushobject(a)), } displayfigure.attr = d() figures.pop() return displayfigure, nested else figures.pop() end end end function codeinjections.getpreviewfigure(request) local figure = figures.initialize(request) if not figure then return end figure = figures.identify(figure) if not (figure and figure.status and figure.status.fullname) then return end figure = figures.check(figure) if not (figure and figure.status and figure.status.fullname) then return end local image = figure.status.private if image then img.immediatewrite(image) end return figure end function codeinjections.setfiguremask(data,figure) -- mark local request = data.request local mask = request.mask if mask and mask ~= "" then figures.push { name = mask, page = request.page, size = request.size, prefix = request.prefix, cache = request.cache, width = request.width, height = request.height, } figures.identify() local maskfigure = figures.check() if maskfigure then local image = maskfigure.status.private if image then img.immediatewrite(image) local d = pdfdictionary { Interpolate = false, SMask = pdfreference(image.objnum), } figure.attr = d() end end figures.pop() end end -- temp hack function img.package(image) -- see lpdf-u3d ** local boundingbox = image.bbox local imagetag = "Im" .. image.index local resources = pdfdictionary { ProcSet = pdfarray { pdfconstant("PDF"), pdfconstant("ImageC") }, Resources = pdfdictionary { XObject = pdfdictionary { [imagetag] = pdfreference(image.objnum) } } } local width = boundingbox[3] local height = boundingbox[4] local xform = img.scan { attr = resources(), stream = formatters["%.6F 0 0 %.6F 0 0 cm /%s Do"](width,height,imagetag), bbox = { 0, 0, width/basepoints, height/basepoints }, } img.immediatewrite(xform) return xform end -- experimental local nofpatterns = 0 local f_pattern = formatters["q /Pattern cs /%s scn 0 0 %.6F %.6F re f Q"] -- q Q is not really needed local texsavebox = tex.saveboxresource function lpdf.registerpattern(specification) nofpatterns = nofpatterns + 1 local d = pdfdictionary { Type = pdfconstant("Pattern"), PatternType = 1, PaintType = 1, TilingType = 2, XStep = (specification.width or 10) * basepoints, YStep = (specification.height or 10) * basepoints, Matrix = { 1, 0, 0, 1, (specification.hoffset or 0) * basepoints, (specification.voffset or 0) * basepoints, }, } local resources = lpdf.collectedresources{ patterns = false } local attributes = d() local onlybounds = 1 local patternobj = texsavebox(specification.number,attributes,resources,true,onlybounds) lpdf.adddocumentpattern("Pt" .. nofpatterns,lpdf.reference(patternobj )) return nofpatterns end function lpdf.patternstream(n,width,height) return f_pattern("Pt" .. n,width*basepoints,height*basepoints) end
journal.registered_pages = {} journal.entries = (function() local file_name = minetest.get_worldpath() .. "/journal_entries" minetest.register_on_shutdown(function() local file = io.open(file_name, "w") file:write(minetest.serialize(journal.entries)) file:close() end) local file = io.open(file_name, "r") if file ~= nil then local data = file:read("*a") file:close() return minetest.deserialize(data) end return {} end) () function journal.register_page(pageId,pageName,firstMessage) local first = {text = firstMessage or "", id = 1} journal.registered_pages[journal.check_modname_prefix(pageId)] = {name=pageName,first=first} end journal.register_page("journal:personal_notes","personal notes") function journal.get_page_Id(pageIndex) local i = 0 for id,_ in pairs(journal.registered_pages) do i = i + 1 if i==pageIndex then return id end end journal.log.warning("Invalid page index: "..pageIndex) end function journal.make_page(player,page) if journal.entries[player]==nil then journal.entries[player]={} end if journal.entries[player][page]==nil or journal.entries[player][page]=="" then if journal.registered_pages[page]~=nil then journal.entries[player][page]={journal.registered_pages[page].first} else journal.entries[player][page]={} end end print(type(journal.entries[player][page])) if type(journal.entries[player][page]) == "string" then journal.log.action("updating old journal page") local text = journal.entries[player][page] journal.entries[player][page]= {{ text = text }} end end local newEntryHud = { hud_elem_type = "image", position = {x=1,y=0}, scale = {x=1,y=1}, text = "NewJournalEntry.png", alignment = {x=-1,y=1}, } function journal.add_entry(player,pageId,text,entryId) local page = journal.check_modname_prefix(pageId) journal.make_page(player,page) local entry = { text = "" } if entryId == true then local current_time = math.floor(minetest.get_timeofday() * 1440) local minutes = current_time % 60 local hour = (current_time - minutes) / 60 local days = minetest.get_day_count() --print(dump(days)..","..dump(hour)..":"..dump(minutes)) --entry.text = entry.text .. "day ".. days .. ", " .. hour .. ":" .. minutes entry.text = ("%sday %d, %d:%d"):format(entry.text,days,hour,minutes) elseif entryId then entry.id = entryId end if text ~= nil then if entry.text ~= "" then entry.text = entry.text .. " " end entry.text = entry.text .. text end table.insert(journal.entries[player][page],entry) if journal.players[player].reading == page then --reload page minetest.show_formspec(player,"journal:journal_" .. player,journal.make_formspec(player,page)) else --show entry notification to player journal.players[player].unread[page] = true if journal.players[player].message==false then journal.players[player].message = minetest.get_player_by_name(player):hud_add(newEntryHud) end end end function journal.edit_entry(player,pageId,entryId,text) local page = journal.check_modname_prefix(pageId) journal.make_page(player, page) for _,e in pairs(journal.entries[player][page]) do if e.id == entryId then e.text = text end end end function journal.write_personal_notes_to_book(pname) local lpp = 14; local new_stack = ItemStack("default:book_written") local data = { title = "personal notes", text = journal.entries[pname]["journal:personal_notes"], page = 1, owner = pname, } data.text_len = #data.text data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp) local data_str = minetest.serialize(data) new_stack:set_metadata(data_str); return new_stack; end
local mats={ --sound,effect,colormod [MAT_ALIENFLESH] ={2,1,{0,0,0}}, [MAT_ANTLION] ={2,1,{0,0,0}}, [MAT_BLOODYFLESH] ={2,1,{0,0,0}}, [MAT_CLIP] ={1,1,{0,0,0}}, [MAT_COMPUTER] ={1,1,{0,0,0}}, [MAT_FLESH] ={2,1,{0,0,0}}, [MAT_GRATE] ={1,1,{0,0,0}}, [MAT_METAL] ={1,1,{0,0,0}}, [MAT_PLASTIC] ={2,1,{0,0,0}}, [MAT_SLOSH] ={2,1,{0,0,0}}, [MAT_VENT] ={1,1,{0,0,0}}, [MAT_FOLIAGE] ={2,2,{0,0,0}}, [MAT_TILE] ={2,2,{0,0,0}}, [MAT_CONCRETE] ={2,2,{0,0,0}}, [MAT_DIRT] ={2,2,{0,0,0}}, [MAT_SAND] ={2,2,{0,0,0}}, [MAT_WOOD] ={2,2,{0,0,0}}, [MAT_GLASS] ={2,2,{0,0,0}}, } local sounds={ [1]={ Sound("WAC/tank/tank_shell_metal_01.wav"), Sound("WAC/tank/tank_shell_metal_02.wav"), Sound("WAC/tank/tank_shell_metal_03.wav"), Sound("WAC/tank/tank_shell_metal_04.wav"), }, [2]={ Sound("WAC/tank/tank_shell_01.wav"), Sound("WAC/tank/tank_shell_02.wav"), Sound("WAC/tank/tank_shell_03.wav"), Sound("WAC/tank/tank_shell_04.wav"), Sound("WAC/tank/tank_shell_05.wav"), }, } function EFFECT:Init(data) self.Time = 1 self.LifeTime = CurTime() + self.Time self.vEntity = data:GetEntity() self.vOffset = data:GetOrigin() self.vAng = data:GetAngles() self.vFw = self.vAng:Forward() self.vUp = self.vAng:Up() self.vRi = self.vAng:Right() self.Mat=math.ceil(data:GetRadius()) self.Mat=(self.Mat!=0 and self.Mat)and(self.Mat)or(MAT_DIRT) self.emitter = ParticleEmitter(self.vOffset) local dlight = DynamicLight(self.vEntity:EntIndex()) if (dlight) then dlight.Pos = self.vOffset+self.vFw dlight.r = 255 dlight.g = 220 dlight.b = 0 dlight.Brightness = 3 dlight.Decay = 1700 dlight.Size = 312 dlight.DieTime = CurTime() + 0.5 end if mats[self.Mat][2]==1 then self:Normal() else self:Dirt() self:Normal() end sound.Play(sounds[mats[self.Mat][1]][math.random(#sounds[mats[self.Mat][1]])], self.vOffset, 450, 100) self.emitter:Finish() self.Entity:SetPos(self.vOffset) end function EFFECT:Normal() for i = 0, 360, 10 do local ptc = self.emitter:Add("particle/smokesprites_000"..math.random(1,9), self.vOffset) if (ptc) then ptc:SetVelocity(math.cos(i)*math.Rand(12,120)*self.vUp + math.sin(i)*math.Rand(12,120)*self.vRi+math.Rand(110, 210)*self.vFw) ptc:SetLifeTime(0) ptc:SetDieTime(math.Rand(0, 0.7)) ptc:SetStartAlpha(math.Rand(100, 130)) ptc:SetEndAlpha(0) ptc:SetStartSize(20) ptc:SetEndSize(50) ptc:SetAirResistance(300) ptc:SetRoll(math.Rand(0, 10)) ptc:SetRollDelta(math.Rand(-0.2, 0.2)) ptc:SetColor(math.Rand(80, 150), 84, 79) end ptc = self.emitter:Add("particle/smokesprites_000"..math.random(1,9), self.vOffset) if (ptc) then ptc:SetVelocity(math.cos(i)*math.Rand(150,250)*self.vUp+math.sin(i)*math.Rand(150,250)*self.vRi+math.Rand(2,110)*self.vFw) ptc:SetLifeTime(0) ptc:SetDieTime(math.Rand(0, 0.6)) ptc:SetStartAlpha(math.Rand(100, 170)) ptc:SetEndAlpha(0) ptc:SetStartSize(20) ptc:SetEndSize(50) ptc:SetAirResistance(300) ptc:SetRoll(math.Rand(0, 60)) ptc:SetRollDelta(math.Rand(-0.2, 0.2)) ptc:SetColor(math.Rand(80, 150), 94, 89) end ptc = self.emitter:Add("particles/flamelet"..math.random(1,5), self.vOffset) if (ptc) then ptc:SetVelocity(math.cos(i) * math.Rand(10,200) * self.vUp + math.sin(i) * math.Rand(10,200) * self.vRi + math.Rand(0,150) * self.vFw) ptc:SetLifeTime(0) ptc:SetDieTime(math.Rand(0, 0.22)) ptc:SetStartAlpha(math.Rand(200, 255)) ptc:SetEndAlpha(0) ptc:SetStartSize(14) ptc:SetEndSize(60) ptc:SetRoll(math.Rand(0, 100)) ptc:SetRollDelta(math.Rand(-0.2, 0.2)) ptc:SetColor(255 , 210 , 220) end end end function EFFECT:Dirt() for i = 0, 360, 10 do local ptc = self.emitter:Add("particle/smokesprites_000"..math.random(1,9), self.vOffset ) if (ptc) then ptc:SetVelocity(math.cos(i) * math.Rand(100,300) * self.vUp + math.sin(i) * math.Rand(100,300) * self.vRi + math.Rand(2,200) * self.vFw) ptc:SetLifeTime(0) ptc:SetDieTime( math.Rand(0, 4)) ptc:SetStartAlpha( math.Rand(50, 70)) ptc:SetEndAlpha(0) ptc:SetStartSize(40) ptc:SetEndSize(50) ptc:SetAirResistance(200) ptc:SetRoll(math.Rand(0, 60)) ptc:SetRollDelta(math.Rand(-0.2, 0.2)) ptc:SetColor(math.Rand(80, 100), 94, 89) end ptc = self.emitter:Add("particle/smokesprites_000"..math.random(1,9), self.vOffset ) if (ptc) then ptc:SetVelocity(math.cos(i) * math.Rand(300,500) * self.vUp + math.sin(i) * math.Rand(300,500) * self.vRi + math.Rand(0,20) * self.vFw) ptc:SetLifeTime( 0 ) ptc:SetDieTime( math.Rand( 0, 5 ) ) ptc:SetStartAlpha( math.Rand( 40, 60 ) ) ptc:SetEndAlpha( 0 ) ptc:SetStartSize( 60 ) ptc:SetEndSize( 70 ) ptc:SetAirResistance( 200 ) ptc:SetRoll( math.Rand(0, 60) ) ptc:SetRollDelta( math.Rand(-0.2, 0.2) ) ptc:SetColor( math.Rand(80, 100), 94, 89 ) end for k=1,2 do ptc = self.emitter:Add("particle/smokesprites_000"..math.random(1,9), self.vOffset) if (ptc) then ptc:SetVelocity(math.cos(i) * math.Rand(50,400) * self.vUp + math.sin(i) * math.Rand(50,400) * self.vRi + math.Rand(100,900) * self.vFw) ptc:SetLifeTime( 0 ) ptc:SetDieTime( math.Rand( 0, 3 ) ) ptc:SetStartAlpha( math.Rand( 70, 140 ) ) ptc:SetEndAlpha( 0 ) ptc:SetStartSize( 40 ) ptc:SetEndSize( 50 ) ptc:SetGravity(Vector(0,0,-150)) ptc:SetAirResistance( 300 ) ptc:SetRoll( math.Rand(0, 60) ) ptc:SetRollDelta( math.Rand(-0.2, 0.2) ) ptc:SetColor( math.Rand(80, 100), 94, 89 ) end end ptc = self.emitter:Add("effects/fleck_cement"..math.random(1, 2 ), self.vOffset) if (ptc) then ptc:SetVelocity(math.cos(i) * math.Rand(50,60) * self.vUp + math.sin(i) * math.Rand(50,60) * self.vRi + math.Rand(100,140) * self.vFw) ptc:SetLifeTime( 0 ) ptc:SetDieTime( math.Rand( 0, 1.2 ) ) ptc:SetStartAlpha( math.Rand( 50, 70 ) ) ptc:SetEndAlpha( 0 ) ptc:SetStartSize( 40 ) ptc:SetEndSize( 50 ) ptc:SetGravity( Vector( 0,0,-200 ) ) ptc:SetCollide(true) ptc:SetAirResistance( 10 ) ptc:SetRoll( math.Rand(0, 60) ) ptc:SetRollDelta( math.Rand(-0.2, 0.2) ) ptc:SetColor( 100, 100, 100 ) end ptc = self.emitter:Add("effects/fleck_cement"..math.random(1, 2), self.vOffset) if (ptc) then ptc:SetVelocity(math.cos(i)*math.Rand(1,300)*self.vUp+math.sin(i)*math.Rand(1,300)*self.vRi+math.Rand(400,940)*self.vFw) ptc:SetLifeTime(0) ptc:SetDieTime(math.Rand(0, 2)) ptc:SetStartAlpha(math.Rand(100, 170)) ptc:SetEndAlpha(0) ptc:SetStartSize(5) ptc:SetEndSize(10) ptc:SetGravity(Vector(0,0,-800)) ptc:SetCollide(true) ptc:SetAirResistance( 100 ) ptc:SetRoll( math.Rand(0, 60) ) ptc:SetRollDelta( math.Rand(-0.2, 0.2) ) ptc:SetColor( 100, 100, 100 ) end end local scount = math.Rand(3, 5) for i = 0, scount do local ptc = self.emitter:Add("particles/flamelet"..math.random(1,5), self.vOffset) if (ptc) then ptc:SetVelocity(self.vUp * math.Rand(4, 20)) ptc:SetLifeTime(0) ptc:SetDieTime( math.Rand(0, 0.15)) ptc:SetStartAlpha(150) ptc:SetEndAlpha(0) ptc:SetStartSize(8) ptc:SetEndSize(90) ptc:SetRoll(math.Rand(0, 100)) ptc:SetRollDelta(math.Rand(-0.2, 0.2)) ptc:SetColor(220 , 220 , 220) end ptc = self.emitter:Add("particles/smokey", self.vOffset) if (ptc) then ptc:SetVelocity(self.vFw * 10) ptc:SetLifeTime(0) ptc:SetDieTime(math.Rand(0, 1.2)) ptc:SetStartAlpha(math.Rand(150, 160)) ptc:SetEndAlpha(0) ptc:SetStartSize(40) ptc:SetEndSize(100) ptc:SetAirResistance(200) ptc:SetRoll(math.Rand(0, 60)) ptc:SetRollDelta(math.Rand(-0.2, 0.2)) ptc:SetColor(104, 94, 89) end end end function EFFECT:Think() return (self.LifeTime > CurTime()) end function EFFECT:Render() end
object_tangible_collection_deathtrooper_research_frequency_scanner_01 = object_tangible_collection_shared_deathtrooper_research_frequency_scanner_01:new { gameObjectType = 8211,} ObjectTemplates:addTemplate(object_tangible_collection_deathtrooper_research_frequency_scanner_01, "object/tangible/collection/deathtrooper_research_frequency_scanner_01.iff")
return Def.ActorFrame { Def.Quad { InitCommand=function(self) self:vertalign(top):xy(SCREEN_CENTER_X,SCREEN_TOP):zoomto(400,0):diffuse(color("#000000")):diffusealpha(0.5) end; OnCommand=function(self) self:easeoutquint(0.14):zoomto(400,SCREEN_HEIGHT) end; OffCommand=function(self) self:sleep(0.2):easeoutquint(0.2):addy(SCREEN_HEIGHT) end; }; };
-- cbind - A library for generating bindings. -- Written in 2014 by Jesper Oskarsson jesosk@gmail.com -- -- To the extent possible under law, the author(s) have dedicated all copyright -- and related and neighboring rights to this software to the public domain worldwide. -- This software is distributed without any warranty. -- -- You should have received a copy of the CC0 Public Domain Dedication along with this software. -- If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. require "common" require "file_io" require "c_parser" require "cdef_parser" require "dll_helper" local function print_dbg( str ) if verbose then print( str ) end end local do_config = function( config_path, ... ) local chunk = loadfile( config_path ) chunk( ... ) end do_config( ... ) if c_source_path:sub( -1 ) ~= "/" then c_source_path = c_source_path .. "/" end if cdef_source_path:sub( -1 ) ~= "/" then cdef_source_path = cdef_source_path .. "/" end if output_path:sub( -1 ) ~= "/" then output_path = output_path .. "/" end if not cpp_include_output_path then cpp_include_output_path = output_path .. "cpp/" elseif cpp_include_output_path:sub( -1 ) ~= "/" then cpp_include_output_path = cpp_include_output_path .. "/" end if not cpp_include_prefix then cpp_include_prefix = "" end local parsed_c_files, parsed_cdef_files_syntax = {}, {} local c_source_file_contents = {} local contents_by_file = {} for i, c_file in ipairs( c_source_files ) do c_source_file_contents[i] = read_file( c_source_path .. c_file, true ) contents_by_file[c_file] = c_source_file_contents[i] print_dbg( "Parsing C header '" .. c_source_path .. c_file .. "'" ) end -- Parse C headers for _, contents in ipairs( c_source_file_contents ) do local typedefs = {} ParseCHeaderTypedefs( contents, typedefs ) local includes = ParseCHeaderIncludes( contents ) for _, include in ipairs( includes ) do ParseCHeaderTypedefs( contents_by_file[include], typedefs ) end parsed_c_files[#parsed_c_files + 1] = ParseCHeader( contents, typedefs ) end local class_names, referenced_classes = {}, {}, {} -- Parse cdef files for _, cdef_file in ipairs( cdef_source_files ) do local contents = read_file( cdef_source_path .. cdef_file, true ) print_dbg( "Parsing cdef file '" .. cdef_source_path .. cdef_file .. "'" ) parsed_cdef_files_syntax[#parsed_cdef_files_syntax + 1], referenced_classes[#referenced_classes + 1] = cdef_parser:parse( contents ) class_names[#class_names + 1] = cdef_file:match( "^([%w_]+)" ) end -- Link the references with the actual modules for _, references in pairs( referenced_classes ) do for _, reference in pairs( references ) do for _, parsed_cdef in pairs( parsed_cdef_files_syntax ) do if parsed_cdef.namespace.token.value == reference.namespace and parsed_cdef.name.token.value == reference.class then reference.module = parsed_cdef end end end end for _, language in ipairs( languages ) do if language == "lua" then print_dbg( "Generating Lua binding..." ) require "bind_gen.lua" local header, source = generate_binding_lua( parsed_c_files, c_source_files ) write_file( output_path .. "lua/" .. name .. "_lua.h", header ) write_file( output_path .. "lua/" .. name .. "_lua.c", source ) generate_dll_def( name, output_path .. "lua/" .. name .. ".def", output_path .. "lua/", {name .. "_lua.h"} ) require "class_gen.lua" for i = 1, #parsed_cdef_files_syntax do local class = generate_class_lua( parsed_cdef_files_syntax[i], referenced_classes[i] ) if class ~= "" then write_file( output_path .. "lua/" .. std_to_camel( class_names[i] ) .. ".lua", class ) end end elseif language == "ruby" then print_dbg( "Generating Ruby binding..." ) require "bind_gen.ruby" local source = generate_binding_ruby( parsed_c_files ) write_file( output_path .. "ruby/" .. name .. ".rb", source ) require "class_gen.ruby" for i = 1, #parsed_cdef_files_syntax do local class = generate_class_ruby( parsed_cdef_files_syntax[i] ) if class ~= "" then write_file( output_path .. "ruby/" .. class_names[i] .. ".rb", class ) end end elseif language == "python" then print_dbg( "Generating Python binding..." ) require "bind_gen.python" local source = generate_binding_python( parsed_c_files ) write_file( output_path .. "python/" .. name .. ".py", source ) require "class_gen.python" for i = 1, #parsed_cdef_files_syntax do local class = generate_class_python( parsed_cdef_files_syntax[i], referenced_classes[i] ) if class ~= "" then class = "import " .. name .. "\n" .. class write_file( output_path .. "python/" .. class_names[i] .. ".py", class ) end end elseif language == "csharp" then print_dbg( "Generating C# binding..." ) require "bind_gen.csharp" local source = generate_binding_csharp( parsed_c_files, name ) write_file( output_path .. "csharp/" .. name .. ".cs", source ) require "class_gen.csharp" for i = 1, #parsed_cdef_files_syntax do local class = generate_class_csharp( parsed_cdef_files_syntax[i] ) write_file( output_path .. "csharp/" .. std_to_camel( class_names[i] ) .. ".cs", class ) end elseif language == "go" then print_dbg( "Generating Go! binding..." ) require "bind_gen.go_syscall" local source, makefile = generate_binding_go( parsed_c_files ) write_file( output_path .. "go/" .. name .. ".go", source ) write_file( output_path .. "go/Makefile", makefile ) elseif language == "cpp" then print_dbg( "Generating C++ binding..." ) require "class_gen.cpp" for i = 1, #parsed_cdef_files_syntax do local header, source = generate_class_cpp( parsed_cdef_files_syntax[i], referenced_classes[i], c_source_files ) write_file( cpp_include_output_path .. std_to_camel( class_names[i] ) .. ".hpp", header ) if source ~= "" then write_file( output_path .. "cpp/" .. std_to_camel( class_names[i] ) .. ".cpp", source ) end end end end
dofile("data/scripts/lib/utilities.lua") dofile("data/scripts/perks/perk.lua") dofile("data/scripts/perks/perk_list.lua") local function insert_constant(outcome) table.insert(outcome_generators, function() return outcome end) end table.insert(outcome_generators, function() -- extracted from data/scripts/items/potion.lua local materials = nil if( Random( 0, 100 ) <= 75 ) then if( Random( 0, 100000 ) <= 50 ) then potion_material = "magic_liquid_hp_regeneration" elseif( Random( 200, 100000 ) <= 250 ) then potion_material = "purifying_powder" else potion_material = random_from_array( potion_materials_magic ) end else potion_material = random_from_array( potion_materials_standard ) end local matname = GameTextGet("$mat_" .. potion_material) return { name = "Flask: " .. matname, desc = "Enjoy", func = function() local x, y = get_player_pos() -- just go ahead and assume cheatgui is installed local entity = EntityLoad( "data/hax/potion_empty.xml", x, y ) AddMaterialInventoryMaterial( entity, potion_material, 1000 ) end } end) local function resolve_localized_name(s, default) if s:sub(1,1) ~= "$" then return s end local rep = GameTextGet(s) if rep and rep ~= "" then return rep else return default or s end end table.insert(outcome_generators, function() -- spawn a random perk local perk = perk_list[math.random(1, #perk_list)] -- reroll useless perk while perk.id == "MYSTERY_EGGPLANT" do perk = perk_list[math.random(1, #perk_list)] end local perkname = resolve_localized_name(perk.ui_name, perk.id) return { name = "Perk: " .. perkname, desc = "Have fun", func = function() local x, y = get_player_pos() -- player might be dead if x ~= nil and y ~= nil then local perk_entity = perk_spawn( x, y - 8, perk.id ) local players = get_players() if players == nil then return end for i,player in ipairs(players) do -- last argument set to false, so you dont kill others perks if triggered inside the shop perk_pickup( perk_entity, player, nil, true, false ) end end end } end) local function twiddle_health(f) local damagemodels = EntityGetComponent( get_player(), "DamageModelComponent" ) if( damagemodels ~= nil ) then for i,damagemodel in ipairs(damagemodels) do local max_hp = tonumber(ComponentGetValue( damagemodel, "max_hp")) local cur_hp = tonumber(ComponentGetValue( damagemodel, "hp")) local new_cur, new_max = f(cur_hp, max_hp) ComponentSetValue( damagemodel, "max_hp", new_max) ComponentSetValue( damagemodel, "hp", new_cur) end end end insert_constant{ name = "Health Down", desc = "Unfortunate", func = function() twiddle_health(function(cur, max) max = max * 0.8 cur = math.min(max, cur) return cur, max end) end } insert_constant{ name = "Health Up", desc = "Amazing", func = function() twiddle_health(function(cur, max) return cur+1, max+1 end) end } local function urand(mag) return math.floor((math.random()*2.0 - 1.0)*mag) end local function spawn_item(path, offset_mag) local x, y = get_player_pos() local dx, dy = urand(offset_mag or 0), urand(offset_mag or 0) print(x + dx, y + dy) local entity = EntityLoad(path, x + dx, y + dy) end local function wrap_spawn(path, offset_mag) return function() spawn_item(path, offset_mag) end end -- 0 to not limit axis, -1 to limit to negative values, 1 to limit to positive values local function generate_value_in_range(max_range, min_range, limit_axis) local range = (max_range or 0) - (min_range or 0) if (limit_axis or 0) == 0 then limit_axis = Random(0, 1) == 0 and 1 or -1 end return (Random(0, range) + (min_range or 0)) * limit_axis end local function spawn_item_in_range(path, min_x_range, max_x_range, min_y_range, max_y_range, limit_x_axis, limit_y_axis, spawn_blackhole) local x, y = get_player_pos() local dx = generate_value_in_range(max_x_range, min_x_range, limit_x_axis) local dy = generate_value_in_range(max_y_range, min_y_range, limit_y_axis) if spawn_blackhole then EntityLoad("data/entities/projectiles/deck/black_hole.xml", x + dx, y + dy) end return EntityLoad(path, x + dx, y + dy) end local function spawn_item(path, min_range, max_range, spawn_blackhole) return spawn_item_in_range(path, min_range, max_range, min_range, max_range, 0, 0, spawn_blackhole) end insert_constant{ name = "The Gods Are Angry", desc = "...", func = function() spawn_item("data/entities/animals/necromancer_shop.xml", 100, 100, true) end } insert_constant{ name = "A big worm", desc = "This could be a problem", func = function() spawn_item("data/entities/animals/worm_big.xml", 100, 100) end } insert_constant{ name = "The biggest worm", desc = "oh ... oh no ... OH NO NO NO", func = function() spawn_item("data/entities/animals/worm_end.xml", 100, 150) end } insert_constant{ name = "A couple of worms", desc = "That's annoying", func = function() spawn_item("data/entities/animals/worm.xml", 50, 200) spawn_item("data/entities/animals/worm.xml", 50, 200) end } insert_constant{ name = "A can of worms", desc = "But why?", func = function() for i=1,10 do spawn_item("data/entities/animals/worm_tiny.xml", 50, 200) end end } insert_constant{ name = "Deers", desc = "Oh dear!", func = function() for i=1,5 do spawn_item("data/entities/projectiles/deck/exploding_deer.xml", 100, 300) spawn_item("data/entities/animals/deer.xml", 100, 300) end end } insert_constant{ name = "Gold rush", desc = "Quick, before it disappear", func = function() for i=1,20 do spawn_item("data/entities/items/pickup/goldnugget.xml", 50, 200) end end } insert_constant{ name = "Bomb rush", desc = "You better run", func = function() for i=1,3 do spawn_item("data/entities/projectiles/bomb.xml", 0, 50) end end } insert_constant{ name = "Sea of lava", desc = "Now, that's hot!!", func = function() spawn_item_in_range("data/entities/projectiles/deck/sea_lava.xml", 0, 200, 20, 100, 0, 1, false) end } insert_constant{ name = "ACID??", desc = "Who thought this was a good idea", func = function() spawn_item("data/entities/projectiles/deck/circle_acid.xml", 40, 120, true) end } insert_constant{ name = "Holy bombastic", desc = "That should clear the path", func = function() spawn_item("data/entities/projectiles/bomb_holy.xml", 130, 250, true) end } insert_constant{ name = "Thunderstone madness", desc = "Careful now", func = function() for i=1,10 do spawn_item("data/entities/items/pickup/thunderstone.xml", 50, 250) end end } insert_constant{ name = "Instant swimming pool", desc = "Don't forget your swimsuit", func = function() spawn_item_in_range("data/entities/projectiles/deck/sea_water.xml", 0, 0, 40, 80, 0, -1, false) end } insert_constant{ name = "Random wand generator", desc = "Make good use of it", func = function() local rnd = Random(0, 1000) if rnd < 200 then spawn_item("data/entities/items/wand_level_01.xml") elseif rnd < 600 then spawn_item("data/entities/items/wand_level_02.xml") elseif rnd < 850 then spawn_item("data/entities/items/wand_level_03.xml") elseif rnd < 998 then spawn_item("data/entities/items/wand_level_04.xml") else spawn_item("data/entities/items/wand_level_05.xml") end end }
Player = script.Parent.Parent Character = Player.Character PlayerGui = Player.PlayerGui Backpack = Player.Backpack Torso = Character.Torso Head = Character.Head LeftArm = Character["Left Arm"] LeftLeg = Character["Left Leg"] RightArm = Character["Right Arm"] RightLeg = Character["Right Leg"] LS = Torso["Left Shoulder"] LH = Torso["Left Hip"] RS = Torso["Right Shoulder"] RH = Torso["Right Hip"] ModelName = "Chocobo" attack = false attacktype = 1 Hitdeb = 0 value1=0 Neck = Torso.Neck local neckcf0 = Neck.C0 ---------------------------- --Customize Energy = 200 MaxEnergy = 200 ChocoboHP = 500 Alive = false mindamage = 20 maxdamage = 40 crtmaxdamage = 50 omindamage = mindamage omaxdamage = maxdamage ocrtmaxdamage = crtmaxdamage crtrate = 100/5 --100%/critpercentage oblkbrkr = 2 blockbreaker = oblkbrkr speed = 30 jump = 60 if Character.Name=="Fenrier" then ColorVariation = "Fenrier" elseif Character.Name=="DahNoob" then ColorVariation = "DahNoob" elseif Character.Name=="Robloxshathelper" then ColorVariation = "Robloxshathelper" else ColorVariation = "Yellow" end if ColorVariation == "Yellow" then handlecolor = BrickColor.new("Bright yellow") bcolor = BrickColor.new("Bright orange") beakcolor = BrickColor.new("Bright orange") ropecolor = BrickColor.new("Brown") eyecolor = BrickColor.new("Bright blue") elseif ColorVariation == "Red" then handlecolor =BrickColor.new("Bright red") bcolor = BrickColor.new("Black") beakcolor = BrickColor.new("Really red") ropecolor = BrickColor.new("Brown") eyecolor = BrickColor.new("Bright blue") elseif ColorVariation == "Black" then handlecolor = BrickColor.new("Black") bcolor = BrickColor.new("Brown") beakcolor = BrickColor.new("Bright orange") ropecolor = BrickColor.new("Brown") eyecolor = BrickColor.new("Bright blue") elseif ColorVariation == "Purple" then handlecolor = BrickColor.new("Alder") bcolor = BrickColor.new("Bright violet") beakcolor = BrickColor.new("Bright orange") ropecolor = BrickColor.new("Brown") eyecolor = BrickColor.new("Bright blue") elseif ColorVariation == "Fenrier" then handlecolor =BrickColor.new("White") bcolor = BrickColor.new("Bright orange") beakcolor = BrickColor.new("Bright orange") ropecolor = BrickColor.new("Brown") eyecolor = BrickColor.new("Navy blue") elseif ColorVariation == "Orange" then handlecolor =BrickColor.new("Neon orange") bcolor = BrickColor.new("Brown") beakcolor = BrickColor.new("Brown") ropecolor = BrickColor.new("Bright yellow") eyecolor = BrickColor.new("Royal purple") elseif ColorVariation == "DahNoob" then handlecolor = BrickColor.new("Black") bcolor = BrickColor.new("Medium stone grey") beakcolor = BrickColor.new("Medium stone grey") ropecolor = BrickColor.new("Brown") eyecolor = BrickColor.new("Really black") elseif ColorVariation == "Robloxshathelper" then handlecolor = BrickColor.new("Bright blue") bcolor = BrickColor.new("Bright orange") beakcolor = BrickColor.new("Bright orange") ropecolor = BrickColor.new("Brown") eyecolor = BrickColor.new("Bright blue") else --Custom handlecolor =BrickColor.new("Bright blue") bcolor = BrickColor.new("Medium blue") beakcolor = BrickColor.new("Medium blue") ropecolor = BrickColor.new("White") end Ride = true Rope = true ToolName = "Chocobo" --------------------------------------------------------------------------------------------------------------------------------------- if Character:findFirstChild("EquippedVal",true) ~= nil then Character:findFirstChild("EquippedVal",true).Parent = nil end ev = Instance.new("BoolValue",Character) ev.Name = "EquippedVal" ev.Value = false if Character:findFirstChild("Block",true) ~= nil then Character:findFirstChild("Block",true).Parent = nil end --player player = nil --welds RW, LW , RWL, LWL = Instance.new("Weld"), Instance.new("Weld"), Instance.new("Weld"), Instance.new("Weld") --what anim anim = "none" --other var player = Player ch = Character --save shoulders AoETrue = {} RSH, LSH , RHL, LHL = ch.Torso["Right Shoulder"], ch.Torso["Left Shoulder"] , ch.Torso["Right Hip"] , ch.Torso["Left Hip"] function RWFunc() RW.Part1 = ch["Right Arm"] RSH.Part1 = nil end function LWFunc() LW.Part1 = ch["Left Arm"] LSH.Part1 = nil end function RWLFunc() RWL.Part1 = ch["Right Leg"] RHL.Part1 = nil RightLeg.CanCollide = false end function LWLFunc() LWL.Part1 = ch["Left Leg"] LHL.Part1 = nil LeftLeg.CanCollide = true end function RWLRem() RWL.Part1 = nil RHL.Part1 = ch["Right Leg"] RightLeg.CanCollide = false end function LWLRem() LWL.Part1 = nil LHL.Part1 = ch["Left Leg"] LeftLeg.CanCollide = false end function RWRem() RW.Part1 = nil RSH.Part1 = ch["Right Arm"] end function LWRem() LW.Part1 = nil LSH.Part1 = ch["Left Arm"] end if Character:findFirstChild(ModelName,true) ~= nil then Character:findFirstChild(ModelName,true).Parent = nil RHL.Part1 = ch["Right Leg"] LHL.Part1 = ch["Left Leg"] RSH.Part1 = ch["Right Arm"] LSH.Part1 = ch["Left Arm"] end local swordholder = Instance.new("Model") swordholder.Name = ModelName swordholder.Parent = Character --derp RW.Part0 = ch.Torso RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0) RW.Parent = swordholder -- LW.Part0 = ch.Torso LW.C0 = CFrame.new(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8) LW.C1 = CFrame.new(0, 0.5, 0) LW.Parent = swordholder -- RWL.Part0 = ch.Torso RWL.C0 = CFrame.new(1, -1, 0) * CFrame.Angles(0, 0, 0) RWL.C1 = CFrame.new(0.5, 1, 0) RWL.Parent = swordholder -- LWL.Part0 = ch.Torso LWL.C0 = CFrame.new(-1, -1, 0) * CFrame.Angles(0, 0, 0) LWL.C1 = CFrame.new(-0.5, 1, 0) LWL.Parent = swordholder local msh1 = Instance.new("SpecialMesh") msh1.Scale = Vector3.new(1,1.2,1.2) msh1.MeshType = "Sphere" local msh2 = Instance.new("CylinderMesh") local msh3 = Instance.new("CylinderMesh") local msh4 = Instance.new("SpecialMesh") msh4.Scale = Vector3.new(1,1,1) msh4.MeshType = "Sphere" local msh5 = Instance.new("SpecialMesh") msh5.Scale = Vector3.new(1,0.75,1.2) msh5.MeshId = "http://www.roblox.com/asset/?id=1778999" local msh6 = Instance.new("SpecialMesh") msh6.Scale = Vector3.new(1,1,1) msh6.MeshType = "Sphere" local msh7 = Instance.new("SpecialMesh") msh7.Scale = Vector3.new(1,1,1) msh7.MeshType = "Sphere" local msh6a = Instance.new("SpecialMesh") msh6a.Scale = Vector3.new(1,1,1) msh6a.MeshType = "Sphere" local msh7a = Instance.new("SpecialMesh") msh7a.Scale = Vector3.new(1,1,1) msh7a.MeshType = "Sphere" local msh8 = Instance.new("SpecialMesh") msh8.Scale = Vector3.new(1,1,1) msh8.MeshType = "Sphere" local msh9 = Instance.new("SpecialMesh") msh9.Scale = Vector3.new(1,1,1) msh9.MeshType = "Sphere" local msh10 = Instance.new("SpecialMesh") msh10.Scale = Vector3.new(1,1,1) msh10.MeshType = "Sphere" local msh11 = Instance.new("SpecialMesh") msh11.Scale = Vector3.new(1,1,1) msh11.MeshType = "Sphere" local msh12 = Instance.new("SpecialMesh") msh12.Scale = Vector3.new(1,1,1) msh12.MeshType = "Sphere" local msh13 = Instance.new("SpecialMesh") msh13.Scale = Vector3.new(1,1,1) msh13.MeshType = "Sphere" local msh14 = Instance.new("SpecialMesh") msh14.Scale = Vector3.new(1,1,1) msh14.MeshType = "Sphere" local msh15 = Instance.new("SpecialMesh") msh15.Scale = Vector3.new(1,1,1) msh15.MeshType = "Sphere" local msh16 = Instance.new("SpecialMesh") msh16.Scale = Vector3.new(1,1,1) msh16.MeshType = "Sphere" local msh17 = Instance.new("SpecialMesh") msh17.Scale = Vector3.new(1,1,1) msh17.MeshType = "Sphere" local msh18 = Instance.new("SpecialMesh") msh18.Scale = Vector3.new(1,1,1) msh18.MeshType = "Sphere" local msh19 = Instance.new("SpecialMesh") msh19.Scale = Vector3.new(1,1,1) msh19.MeshType = "Sphere" local msh20 = Instance.new("SpecialMesh") msh20.Scale = Vector3.new(1,1,1) msh20.MeshType = "Sphere" local msh21 = Instance.new("SpecialMesh") msh21.Scale = Vector3.new(1,1,1) msh21.MeshType = "Sphere" local msh22 = Instance.new("CylinderMesh") local msh23 = Instance.new("CylinderMesh") local msh24 = Instance.new("BlockMesh") local msh25 = Instance.new("BlockMesh") local msh26 = Instance.new("BlockMesh") local msh27 = Instance.new("BlockMesh") local msh28 = Instance.new("CylinderMesh") local msh29 = Instance.new("CylinderMesh") local msh30 = Instance.new("BlockMesh") local msh31 = Instance.new("BlockMesh") local msh32 = Instance.new("BlockMesh") local msh33 = Instance.new("BlockMesh") local prt1 = Instance.new("Part") prt1.formFactor = 3 prt1.CanCollide = true prt1.Name = "ChocoboBody" prt1.Locked = true prt1.Size = Vector3.new(3.5,2.5,5) prt1.Parent = swordholder msh1.Parent = prt1 prt1.BrickColor = handlecolor local prt2 = Instance.new("Part") prt2.formFactor = 3 prt2.CanCollide = true prt2.Name = "ChocoboNeck" prt2.Locked = true prt2.Size = Vector3.new(1.25,2,1.25) prt2.Parent = swordholder msh2.Parent = prt2 prt2.BrickColor = handlecolor local prt3 = Instance.new("Part") prt3.formFactor = 3 prt3.CanCollide = true prt3.Name = "ChocoboNeck2" prt3.Locked = true prt3.Size = Vector3.new(1.25,2,1.25) prt3.Parent = swordholder msh3.Parent = prt3 prt3.BrickColor = handlecolor local prt3a = Instance.new("Part") prt3a.formFactor = 3 prt3a.CanCollide = false prt3a.Name = "ChocoboNeck2Joint" prt3a.Locked = true prt3a.Size = Vector3.new(0.2,0.2,0.2) prt3a.Parent = swordholder prt3a.Transparency = 1 local prt4 = Instance.new("Part") prt4.formFactor = 3 prt4.CanCollide = true prt4.Name = "Head" prt4.Locked = true prt4.Size = Vector3.new(2,2,3) prt4.Parent = swordholder msh4.Parent = prt4 prt4.BrickColor = handlecolor local trs = Instance.new("Part") trs.formFactor = 3 trs.CanCollide = true trs.Name = "Torso" trs.Locked = true trs.Size = Vector3.new(0.2,0.2,0.2) trs.Parent = swordholder trs.Transparency = 1 local wt = Instance.new("Weld") wt.Parent = trs wt.Part0 = trs wt.Part1 = prt4 wt.C0 = CFrame.Angles(math.rad(25),0,0) local prt5 = Instance.new("Part") prt5.formFactor = 3 prt5.CanCollide = false prt5.Name = "Beak" prt5.Locked = true prt5.Size = Vector3.new(1,1.5,1) prt5.Parent = swordholder msh5.Parent = prt5 prt5.BrickColor = beakcolor local prt6 = Instance.new("Part") prt6.formFactor = 3 prt6.CanCollide = false prt6.Name = "Eye1" prt6.Locked = true prt6.Size = Vector3.new(0.3,0.3,0.6) prt6.Parent = swordholder msh6.Parent = prt6 prt6.BrickColor = BrickColor.new("White") local prt7 = Instance.new("Part") prt7.formFactor = 3 prt7.CanCollide = false prt7.Name = "Eye2" prt7.Locked = true prt7.Size = Vector3.new(0.3,0.3,0.6) prt7.Parent = swordholder msh7.Parent = prt7 prt7.BrickColor = BrickColor.new("White") local prt6a = Instance.new("Part") prt6a.formFactor = 3 prt6a.CanCollide = false prt6a.Name = "Eye1a" prt6a.Locked = true prt6a.Size = Vector3.new(0.2,0.2,0.3) prt6a.Parent = swordholder msh6a.Parent = prt6a prt6a.BrickColor = eyecolor local prt7a = Instance.new("Part") prt7a.formFactor = 3 prt7a.CanCollide = false prt7a.Name = "Eye2a" prt7a.Locked = true prt7a.Size = Vector3.new(0.2,0.2,0.3) prt7a.Parent = swordholder msh7a.Parent = prt7a prt7a.BrickColor = eyecolor local prt8 = Instance.new("Part") prt8.formFactor = 3 prt8.CanCollide = false prt8.Name = "HeadFeathers" prt8.Locked = true prt8.Size = Vector3.new(1,0.2,3) prt8.Parent = swordholder msh8.Parent = prt8 prt8.BrickColor = handlecolor local prt9 = Instance.new("Part") prt9.formFactor = 3 prt9.CanCollide = false prt9.Name = "HeadFeathers" prt9.Locked = true prt9.Size = Vector3.new(1,0.2,3) prt9.Parent = swordholder msh9.Parent = prt9 prt9.BrickColor = handlecolor local prt10 = Instance.new("Part") prt10.formFactor = 3 prt10.CanCollide = false prt10.Name = "HeadFeathers" prt10.Locked = true prt10.Size = Vector3.new(1,0.2,3) prt10.Parent = swordholder msh10.Parent = prt10 prt10.BrickColor = handlecolor --Wings!! local prt11 = Instance.new("Part") prt11.formFactor = 3 prt11.CanCollide = false prt11.Name = "RightWing" prt11.Locked = true prt11.Size = Vector3.new(1,3,5) prt11.Parent = swordholder msh11.Parent = prt11 prt11.BrickColor = handlecolor local prt12 = Instance.new("Part") prt12.formFactor = 3 prt12.CanCollide = false prt12.Name = "RightWing1" prt12.Locked = true prt12.Size = Vector3.new(0.5,1,2) prt12.Parent = swordholder msh12.Parent = prt12 prt12.BrickColor = handlecolor local prt13 = Instance.new("Part") prt13.formFactor = 3 prt13.CanCollide = false prt13.Name = "RightWing2" prt13.Locked = true prt13.Size = Vector3.new(0.5,1,2) prt13.Parent = swordholder msh13.Parent = prt13 prt13.BrickColor = handlecolor local prt14 = Instance.new("Part") prt14.formFactor = 3 prt14.CanCollide = false prt14.Name = "RightWing3" prt14.Locked = true prt14.Size = Vector3.new(0.5,1,2) prt14.Parent = swordholder msh14.Parent = prt14 prt14.BrickColor = handlecolor local prt15 = Instance.new("Part") prt15.formFactor = 3 prt15.CanCollide = false prt15.Name = "RightWing4" prt15.Locked = true prt15.Size = Vector3.new(0.5,1,2) prt15.Parent = swordholder msh15.Parent = prt15 prt15.BrickColor = handlecolor local prt16 = Instance.new("Part") prt16.formFactor = 3 prt16.CanCollide = false prt16.Name = "LeftWing" prt16.Locked = true prt16.Size = Vector3.new(1,3,5) prt16.Parent = swordholder msh16.Parent = prt16 prt16.BrickColor = handlecolor local prt17 = Instance.new("Part") prt17.formFactor = 3 prt17.CanCollide = false prt17.Name = "LeftWing1" prt17.Locked = true prt17.Size = Vector3.new(0.5,1,2) prt17.Parent = swordholder msh17.Parent = prt17 prt17.BrickColor = handlecolor local prt18 = Instance.new("Part") prt18.formFactor = 3 prt18.CanCollide = false prt18.Name = "LeftWing2" prt18.Locked = true prt18.Size = Vector3.new(0.5,1,2) prt18.Parent = swordholder msh18.Parent = prt18 prt18.BrickColor = handlecolor local prt19 = Instance.new("Part") prt19.formFactor = 3 prt19.CanCollide = false prt19.Name = "LeftWing3" prt19.Locked = true prt19.Size = Vector3.new(0.5,1,2) prt19.Parent = swordholder msh19.Parent = prt19 prt19.BrickColor = handlecolor local prt20 = Instance.new("Part") prt20.formFactor = 3 prt20.CanCollide = false prt20.Name = "LeftWing4" prt20.Locked = true prt20.Size = Vector3.new(0.5,1,2) prt20.Parent = swordholder msh20.Parent = prt20 prt20.BrickColor = handlecolor --Tail local prt21 = Instance.new("Part") prt21.formFactor = 3 prt21.CanCollide = false prt21.Name = "Tail" prt21.Locked = true prt21.Size = Vector3.new(3,6,1) prt21.Parent = swordholder msh21.Parent = prt21 prt21.BrickColor = handlecolor --Legs local prt22 = Instance.new("Part") prt22.formFactor = 3 prt22.CanCollide = true prt22.Name = "RightLeg" prt22.Locked = true prt22.Size = Vector3.new(1,2,1) prt22.Parent = swordholder msh22.Parent = prt22 prt22.BrickColor = handlecolor local prt22a = Instance.new("Part") prt22a.formFactor = 3 prt22a.CanCollide = false prt22a.Name = "RightLega" prt22a.Locked = true prt22a.Size = Vector3.new(0.2,0.2,0.2) prt22a.Parent = swordholder prt22a.Transparency = 1 local prt23 = Instance.new("Part") prt23.formFactor = 3 prt23.CanCollide = false prt23.Name = "RightLeg2" prt23.Locked = true prt23.Size = Vector3.new(0.75,2,0.75) prt23.Parent = swordholder msh23.Parent = prt23 prt23.BrickColor = bcolor local prt24 = Instance.new("Part") prt24.formFactor = 3 prt24.CanCollide = false prt24.Name = "RightFeet" prt24.Locked = true prt24.Size = Vector3.new(1,0.75,2.5) prt24.Parent = swordholder msh24.Parent = prt24 prt24.BrickColor = bcolor local prt25 = Instance.new("Part") prt25.formFactor = 3 prt25.CanCollide = false prt25.Name = "RightFeet1" prt25.Locked = true prt25.Size = Vector3.new(0.3,0.3,1.5) prt25.Parent = swordholder msh25.Parent = prt25 prt25.BrickColor = bcolor local prt26 = Instance.new("Part") prt26.formFactor = 3 prt26.CanCollide = false prt26.Name = "RightFeet2" prt26.Locked = true prt26.Size = Vector3.new(0.5,0.5,1.5) prt26.Parent = swordholder msh26.Parent = prt26 prt26.BrickColor = bcolor local prt27 = Instance.new("Part") prt27.formFactor = 3 prt27.CanCollide = false prt27.Name = "RightFeet3" prt27.Locked = true prt27.Size = Vector3.new(0.5,0.5,1.5) prt27.Parent = swordholder msh27.Parent = prt27 prt27.BrickColor = bcolor local prt28 = Instance.new("Part") prt28.formFactor = 3 prt28.CanCollide = true prt28.Name = "LeftLeg" prt28.Locked = true prt28.Size = Vector3.new(1,2,1) prt28.Parent = swordholder msh28.Parent = prt28 prt28.BrickColor = handlecolor local prt28a = Instance.new("Part") prt28a.formFactor = 3 prt28a.CanCollide = false prt28a.Name = "LeftLega" prt28a.Locked = true prt28a.Size = Vector3.new(0.2,0.2,0.2) prt28a.Parent = swordholder prt28a.Transparency = 1 local prt29 = Instance.new("Part") prt29.formFactor = 3 prt29.CanCollide = false prt29.Name = "LeftLeg2" prt29.Locked = true prt29.Size = Vector3.new(0.75,2,0.75) prt29.Parent = swordholder msh29.Parent = prt29 prt29.BrickColor = bcolor local prt30 = Instance.new("Part") prt30.formFactor = 3 prt30.CanCollide = false prt30.Name = "LeftFeet" prt30.Locked = true prt30.Size = Vector3.new(1,0.75,2.5) prt30.Parent = swordholder msh30.Parent = prt30 prt30.BrickColor = bcolor local prt31 = Instance.new("Part") prt31.formFactor = 3 prt31.CanCollide = false prt31.Name = "LeftFeet1" prt31.Locked = true prt31.Size = Vector3.new(0.3,0.3,1.5) prt31.Parent = swordholder msh31.Parent = prt31 prt31.BrickColor = bcolor local prt32 = Instance.new("Part") prt32.formFactor = 3 prt32.CanCollide = false prt32.Name = "LeftFeet2" prt32.Locked = true prt32.Size = Vector3.new(0.5,0.5,1.5) prt32.Parent = swordholder msh32.Parent = prt32 prt32.BrickColor = bcolor local prt33 = Instance.new("Part") prt33.formFactor = 3 prt33.CanCollide = false prt33.Name = "RightFeet3" prt33.Locked = true prt33.Size = Vector3.new(0.5,0.5,1.5) prt33.Parent = swordholder msh33.Parent = prt33 prt33.BrickColor = bcolor --Backseat :D local prt34 = Instance.new("Seat") prt34.formFactor = 3 prt34.CanCollide = false prt34.Name = "Backseat" prt34.Locked = true prt34.Size = Vector3.new(0.2,1,0.2) prt34.Parent = swordholder prt34.Transparency = 1 -- local prt35 = Instance.new("Part") prt35.formFactor = 3 prt35.CanCollide = true prt35.Name = "Stand" prt35.Locked = true prt35.Size = Vector3.new(1,4,1) prt35.Parent = swordholder prt35.Transparency = 1 local w35 = Instance.new("Weld") w35.Parent = prt35 w35.Part0 = prt35 w35.Part1 = prt1 w35.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w35.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 2,0) --Torso local w1 = Instance.new("Weld") w1.Parent = prt1 w1.Part0 = prt1 w1.Part1 = Torso w1.C1 = CFrame.fromEulerAnglesXYZ(0, math.rad(0), math.rad(0)) * CFrame.new(0, 0,0) w1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(0),math.rad(-0), math.rad(0)) * CFrame.new(0, 3, -1) --Neck local w2 = Instance.new("Weld") w2.Parent = prt2 w2.Part0 = prt2 w2.Part1 = prt1 w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) local w3a = Instance.new("Weld") w3a.Parent = prt3a w3a.Part0 = prt3a w3a.Part1 = prt1 w3a.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w3a.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -1.5,3) local w3 = Instance.new("Weld") w3.Parent = prt3 w3.Part0 = prt3 w3.Part1 = prt3a w3.C1 = CFrame.Angles(math.rad(-20), 0, 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) --Head local w4 = Instance.new("Weld") w4.Parent = prt4 w4.Part0 = prt4 w4.Part1 = prt3 w4.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w4.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -2.5/2,0.25) local w5 = Instance.new("Weld") w5.Parent = prt5 w5.Part0 = prt5 w5.Part1 = prt4 w5.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w5.C0 = CFrame.Angles(math.rad(100), 0, 0) * CFrame.new(0, 0.25,1.45) local w6 = Instance.new("Weld") w6.Parent = prt6 w6.Part0 = prt6 w6.Part1 = prt4 w6.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w6.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0.75, -0.25,0.75) local w7 = Instance.new("Weld") w7.Parent = prt7 w7.Part0 = prt7 w7.Part1 = prt4 w7.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w7.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(-0.75, -0.25,0.75) local w6a = Instance.new("Weld") w6a.Parent = prt6a w6a.Part0 = prt6a w6a.Part1 = prt4 w6a.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w6a.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0.775, -0.25,0.91) local w7a = Instance.new("Weld") w7a.Parent = prt7a w7a.Part0 = prt7a w7a.Part1 = prt4 w7a.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w7a.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(-0.775, -0.25,0.91) local w8 = Instance.new("Weld") w8.Parent = prt8 w8.Part0 = prt8 w8.Part1 = prt4 w8.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w8.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.9,-1) local w9 = Instance.new("Weld") w9.Parent = prt9 w9.Part0 = prt9 w9.Part1 = prt4 w9.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w9.C0 = CFrame.Angles(math.rad(0), math.rad(20), math.rad(-40)) * CFrame.new(0.75, -0.5,-1) local w10 = Instance.new("Weld") w10.Parent = prt10 w10.Part0 = prt10 w10.Part1 = prt4 w10.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w10.C0 = CFrame.Angles(math.rad(0), math.rad(-20), math.rad(40)) * CFrame.new(-0.75, -0.5,-1) --Right Wing local w11 = Instance.new("Weld") w11.Parent = prt11 w11.Part0 = prt11 w11.Part1 = prt1 w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(-1.5, 0,0) local w12 = Instance.new("Weld") w12.Parent = prt12 w12.Part0 = prt12 w12.Part1 = prt11 w12.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w12.C0 = CFrame.Angles(math.rad(45), math.rad(0), math.rad(0)) * CFrame.new(0, 0,-2.5) local w13 = Instance.new("Weld") w13.Parent = prt13 w13.Part0 = prt13 w13.Part1 = prt11 w13.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w13.C0 = CFrame.Angles(math.rad(55), math.rad(0), math.rad(0)) * CFrame.new(0, -0.25,-2.25) local w14 = Instance.new("Weld") w14.Parent = prt14 w14.Part0 = prt14 w14.Part1 = prt11 w14.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w14.C0 = CFrame.Angles(math.rad(65), math.rad(0), math.rad(0)) * CFrame.new(0, -0.5,-2) local w15 = Instance.new("Weld") w15.Parent = prt15 w15.Part0 = prt15 w15.Part1 = prt11 w15.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w15.C0 = CFrame.Angles(math.rad(75), math.rad(0), math.rad(0)) * CFrame.new(0, -0.75,-1.5) --Left Wing local w16 = Instance.new("Weld") w16.Parent = prt16 w16.Part0 = prt16 w16.Part1 = prt1 w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(1.5, 0,0) local w17 = Instance.new("Weld") w17.Parent = prt17 w17.Part0 = prt17 w17.Part1 = prt16 w17.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w17.C0 = CFrame.Angles(math.rad(45), math.rad(0), math.rad(0)) * CFrame.new(0, 0,-2.5) local w18 = Instance.new("Weld") w18.Parent = prt18 w18.Part0 = prt18 w18.Part1 = prt16 w18.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w18.C0 = CFrame.Angles(math.rad(55), math.rad(0), math.rad(0)) * CFrame.new(0, -0.25,-2.25) local w19 = Instance.new("Weld") w19.Parent = prt19 w19.Part0 = prt19 w19.Part1 = prt16 w19.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w19.C0 = CFrame.Angles(math.rad(65), math.rad(0), math.rad(0)) * CFrame.new(0, -0.5,-2) local w20 = Instance.new("Weld") w20.Parent = prt20 w20.Part0 = prt20 w20.Part1 = prt16 w20.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w20.C0 = CFrame.Angles(math.rad(75), math.rad(0), math.rad(0)) * CFrame.new(0, -0.75,-1.5) --Tail local w21 = Instance.new("Weld") w21.Parent = prt21 w21.Part0 = prt21 w21.Part1 = prt1 w21.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w21.C0 = CFrame.Angles(math.rad(-30), math.rad(0), math.rad(0)) * CFrame.new(0, -1.5,-3.5) --Right Leg local w22 = Instance.new("Weld") w22.Parent = prt22 w22.Part0 = prt22 w22.Part1 = prt1 w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(20), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) local w22a = Instance.new("Weld") w22a.Parent = prt22a w22a.Part0 = prt22a w22a.Part1 = prt22 w22a.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22a.C0 = CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)) * CFrame.new(0, 1,0) local w23 = Instance.new("Weld") w23.Parent = prt23 w23.Part0 = prt23 w23.Part1 = prt22a w23.C1 = CFrame.Angles(math.rad(80), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) local w24 = Instance.new("Weld") w24.Parent = prt24 w24.Part0 = prt24 w24.Part1 = prt23 w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) local w25 = Instance.new("Weld") w25.Parent = prt25 w25.Part0 = prt25 w25.Part1 = prt24 w25.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w25.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.1,-1.5) local w26 = Instance.new("Weld") w26.Parent = prt26 w26.Part0 = prt26 w26.Part1 = prt24 w26.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w26.C0 = CFrame.Angles(math.rad(0), math.rad(45), math.rad(0)) * CFrame.new(-0.75, 0.1,1.5) local w27 = Instance.new("Weld") w27.Parent = prt27 w27.Part0 = prt27 w27.Part1 = prt24 w27.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w27.C0 = CFrame.Angles(math.rad(0), math.rad(-45), math.rad(0)) * CFrame.new(0.75, 0.1,1.5) --Left Leg local w28 = Instance.new("Weld") w28.Parent = prt28 w28.Part0 = prt28 w28.Part1 = prt1 w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(20), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) local w28a = Instance.new("Weld") w28a.Parent = prt28a w28a.Part0 = prt28a w28a.Part1 = prt28 w28a.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28a.C0 = CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)) * CFrame.new(0, 1,0) local w29 = Instance.new("Weld") w29.Parent = prt29 w29.Part0 = prt29 w29.Part1 = prt28a w29.C1 = CFrame.Angles(math.rad(80), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) local w30 = Instance.new("Weld") w30.Parent = prt30 w30.Part0 = prt30 w30.Part1 = prt29 w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) local w31 = Instance.new("Weld") w31.Parent = prt31 w31.Part0 = prt31 w31.Part1 = prt30 w31.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w31.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.1,-1.5) local w32 = Instance.new("Weld") w32.Parent = prt32 w32.Part0 = prt32 w32.Part1 = prt30 w32.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w32.C0 = CFrame.Angles(math.rad(0), math.rad(45), math.rad(0)) * CFrame.new(-0.75, 0.1,1.5) local w33 = Instance.new("Weld") w33.Parent = prt33 w33.Part0 = prt33 w33.Part1 = prt30 w33.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w33.C0 = CFrame.Angles(math.rad(0), math.rad(-45), math.rad(0)) * CFrame.new(0.75, 0.1,1.5) --Backseat local w34 = Instance.new("Weld") w34.Parent = prt1 w34.Part0 = prt34 w34.Part1 = prt1 w34.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w34.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, -1,-1.5) if Alive then local hum = Instance.new("Humanoid") hum.Parent = swordholder hum.MaxHealth = ChocoboHP hum.Health = ChocoboHP hum.PlatformStand = true end local w36 = Instance.new("Weld") local w37 = Instance.new("Weld") --[[if Rope then local msh36 = Instance.new("BlockMesh") local prt36 = Instance.new("Part") prt36.formFactor = 3 prt36.CanCollide = true prt36.Name = "MouthRope" prt36.Locked = true prt36.Size = Vector3.new(1,0.2,0.2) prt36.Parent = swordholder msh36.Parent = prt36 prt36.BrickColor = ropecolor w36.Parent = prt36 w36.Part0 = prt36 w36.Part1 = prt5 w36.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w36.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0,0) local msh37 = Instance.new("BlockMesh") local prt37 = Instance.new("Part") prt37.formFactor = 3 prt37.CanCollide = true prt37.Name = "MouthRope2" prt37.Locked = true prt37.Size = Vector3.new(3,0.2,0.2) prt37.Parent = swordholder msh37.Parent = prt37 prt37.BrickColor = ropecolor w37.Parent = prt37 w37.Part0 = prt37 w37.Part1 = Torso w37.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w37.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0,-1) local prt38a = Instance.new("Part") prt38a.formFactor = 3 prt38a.CanCollide = false prt38a.Name = "MouthRope3Joint" prt38a.Locked = true prt38a.Size = Vector3.new(0.2,0.2,0.2) prt38a.Parent = swordholder prt38a.Transparency = 1 local w38a = Instance.new("Weld") w38a.Parent = prt38a w38a.Part0 = prt38a w38a.Part1 = prt3 w38a.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w38a.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0.5, 1.5,0.5) local prt39a = Instance.new("Part") prt39a.formFactor = 3 prt39a.CanCollide = false prt39a.Name = "MouthRope4Joint" prt39a.Locked = true prt39a.Size = Vector3.new(0.2,0.2,0.2) prt39a.Parent = swordholder prt39a.Transparency = 1 local w39a = Instance.new("Weld") w39a.Parent = prt39a w39a.Part0 = prt39a w39a.Part1 = prt3 w39a.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w39a.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(-0.5, 1.5,0.5) local msh38 = Instance.new("BlockMesh") local prt38 = Instance.new("Part") prt38.formFactor = 3 prt38.Name = "MouthRope3" prt38.Locked = true prt38.Size = Vector3.new(0.2,0.2,0.2) prt38.Parent = swordholder msh38.Parent = prt38 prt38.BrickColor = ropecolor prt38.CanCollide = false prt38.Anchored = true local msh39 = Instance.new("BlockMesh") local prt39 = Instance.new("Part") prt39.formFactor = 3 prt39.Name = "MouthRope4" prt39.Locked = true prt39.Size = Vector3.new(0.2,0.2,0.2) prt39.Parent = swordholder msh39.Parent = prt39 prt39.BrickColor = ropecolor prt39.CanCollide = false prt39.Anchored = true local msh40 = Instance.new("BlockMesh") local prt40 = Instance.new("Part") prt40.formFactor = 3 prt40.Name = "MouthRope5" prt40.Locked = true prt40.Size = Vector3.new(0.2,0.2,0.2) prt40.Parent = swordholder msh40.Parent = prt40 prt40.BrickColor = ropecolor prt40.CanCollide = false prt40.Anchored = true local msh41 = Instance.new("BlockMesh") local prt41 = Instance.new("Part") prt41.formFactor = 3 prt41.Name = "MouthRope6" prt41.Locked = true prt41.Size = Vector3.new(0.2,0.2,0.2) prt41.Parent = swordholder msh41.Parent = prt41 prt41.BrickColor = ropecolor prt41.CanCollide = false prt41.Anchored = true coroutine.resume(coroutine.create(function() repeat wait() local ll = prt37.CFrame * CFrame.new(prt37.Size.x/-2,0,0) local rr = prt37.CFrame * CFrame.new(prt37.Size.x/2,0,0) local oristrpos1 = prt38a.CFrame local oristrpos2 = prt39a.CFrame local oristrpos3 = prt36.CFrame*CFrame.new((prt36.Size.x/-2)+0.1,0,0) local oristrpos4 = prt36.CFrame*CFrame.new((prt36.Size.x/2)-0.1,0,0) local mg1 = (ll.p - oristrpos1.p).magnitude local mg2 = (rr.p - oristrpos2.p).magnitude local mg3 = (oristrpos1.p - oristrpos3.p).magnitude local mg4 = (oristrpos2.p - oristrpos4.p).magnitude prt38.Size = Vector3.new(0.2,mg1,0.2) prt38.CFrame = CFrame.new((ll.p+oristrpos1.p)/2,oristrpos1.p) * CFrame.Angles(math.rad(90),0,0) prt39.Size = Vector3.new(0.2,mg2,0.2) prt39.CFrame = CFrame.new((rr.p+oristrpos2.p)/2,oristrpos2.p) * CFrame.Angles(math.rad(90),0,0) prt40.Size = Vector3.new(0.2,mg3,0.2) prt40.CFrame = CFrame.new((oristrpos1.p+oristrpos3.p)/2,oristrpos3.p) * CFrame.Angles(math.rad(90),0,0) prt41.Size = Vector3.new(0.2,mg3,0.2) prt41.CFrame = CFrame.new((oristrpos2.p+oristrpos4.p)/2,oristrpos4.p) * CFrame.Angles(math.rad(90),0,0) until false end)) end]] local function rayCast(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants return game.Workspace:FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore) end local bg = Instance.new("BodyGyro") bg.maxTorque = bg.maxTorque * math.huge local bp = Instance.new("BodyPosition") bp.maxForce = Vector3.new(math.huge,0,math.huge) bp.P = bp.p * 10 function unequipweld() w1.Part1 = nil bg.Parent = prt1 bg.cframe = prt1.CFrame local hit,pos = rayCast(Torso.Position+Vector3.new(0,10,0), Vector3.new(0,-2,0), 1000, Character) bp.position = pos + Vector3.new(0,4,0) bp.Parent = prt1 w37.Part1 = prt2 w37.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.5,-0.6) end unequipweld() bp.position = (Head.CFrame*CFrame.new(10,0,0)).p bg.cframe = Head.CFrame function equipweld() w1.Part1 = Torso bg.Parent = nil bp.Parent = nil w37.Part1 = Torso w37.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,1.25) end function ss(parent,p) --Slash local SlashSound = Instance.new("Sound") SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav" SlashSound.Parent = parent SlashSound.Volume = .7 SlashSound.Pitch = p SlashSound.PlayOnRemove = true coroutine.resume(coroutine.create(function() wait() SlashSound.Parent = nil end)) end function uss(parent,p) --unsheath local SlashSound = Instance.new("Sound") SlashSound.SoundId = "rbxasset://sounds\\unsheath.wav" SlashSound.Parent = parent SlashSound.Volume = .7 SlashSound.Pitch = p SlashSound.PlayOnRemove = true coroutine.resume(coroutine.create(function() wait() SlashSound.Parent = nil end)) end function fs(parent,p) --Fire Sound local SlashSound = Instance.new("Sound") SlashSound.SoundId = "http://www.roblox.com/asset/?id=31758982" SlashSound.Parent = parent SlashSound.Volume = .7 SlashSound.Pitch = p SlashSound.PlayOnRemove = true coroutine.resume(coroutine.create(function() wait() SlashSound.Parent = nil end)) end function ms(parent,p) --Metal Cling Sound local SlashSound = Instance.new("Sound") SlashSound.SoundId = "rbxasset://sounds\\metal.ogg" SlashSound.Parent = parent SlashSound.Volume = 5 SlashSound.Pitch = p SlashSound.PlayOnRemove = true coroutine.resume(coroutine.create(function() wait() SlashSound.Parent = nil end)) end function ws(parent,p) --Walk Sound local SlashSound = Instance.new("Sound") SlashSound.SoundId = "rbxasset://sounds\\bfsl-minifigfoots1.mp3" SlashSound.Parent = parent SlashSound.Volume = 1 SlashSound.Pitch = p SlashSound.PlayOnRemove = true coroutine.resume(coroutine.create(function() wait() SlashSound.Parent = nil end)) end -- -- function returndmg() mindamage = omindamage maxdamage = omaxdamage crtmaxdamage = ocrtmaxdamage end function subdmg(sub) mindamage = omindamage - sub maxdamage = omaxdamage - sub crtmaxdamage = ocrtmaxdamage - sub end function prcntdmg(sub) mindamage = math.floor(omindamage - (omindamage*(sub/100))) maxdamage = math.floor(omaxdamage - (omaxdamage*(sub/100))) crtmaxdamage = math.floor(ocrtmaxdamage - (ocrtmaxdamage*(sub/100))) end function tagHumanoid(humanoid, player) local creator_tag = Instance.new("ObjectValue") creator_tag.Value = player creator_tag.Name = "creator" creator_tag.Parent = humanoid end function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end function hideanim() attack = true RWRem() LWRem() RWLRem() LWLRem() unequipweld() attack = false end function equipanim() attack = true RWFunc() RWLFunc() LWLFunc() LWFunc() equipweld() for i = 0.1 ,1 ,0.1 do wait() RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(45*i),math.rad(0),math.rad(-20*i)) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, 0) LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.Angles(math.rad(45*i),math.rad(0),math.rad(20*i)) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, 0) RWL.C0 = CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(45*i), 0, math.rad(25*i)) RWL.C1 = CFrame.new(0.5, 1, 0) LWL.C0 = CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(45*i), 0, math.rad(-25*i)) LWL.C1 = CFrame.new(-0.5, 1, 0) Neck.C0 = neckcf0 * CFrame.Angles(math.rad(0),0,math.rad(0)) end attack = false end function noarms() RWRem() LWRem() w37.Part1 = prt2 w37.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.5,-0.6) end function arms() RWFunc() LWFunc() w37.Part1 = Torso w37.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,1.25) end function faketors() local T = Instance.new("Part") T.formFactor = 0 T.CanCollide = false T.Name = "FakeTorso" T.Locked = true T.Size = Torso.Size T.Parent = swordholder T.Transparency = 1 T.BrickColor = Torso.BrickColor for i,z in pairs(Character:GetChildren()) do if z.className == "CharacterMesh" then if z.BodyPart == Enum.BodyPart.Torso then local SM = Instance.new("SpecialMesh",T) SM.MeshId = "http://www.roblox.com/asset/?id=" .. z.MeshId if z.BaseTextureId ~= 0 then SM.TextureId = z.BaseTextureId elseif z.OverlayTextureId ~= 0 then SM.TextureId = z.OverlayTextureId else SM.TextureId = "" end end end end local wt = Instance.new("Weld") wt.Parent = T wt.Part0 = T wt.Part1 = Torso RW.Part0 = T LW.Part0 = T T.Transparency = 0 Torso.Transparency = 1 RHL.Part0 = T LHL.Part0 = T return wt,T end if (script.Parent.className ~= "HopperBin") then Tool = Instance.new("HopperBin") Tool.Parent = Backpack Tool.Name = ToolName script.Parent = Tool end Bin = script.Parent function damagesplat(dmg,hit,crit,blocked) local mo = Instance.new("Model") mo.Name = dmg local pa = Instance.new("Part",mo) pa.formFactor = 3 pa.Size = Vector3.new(0.8,0.3,0.8) if crit then pa.BrickColor = BrickColor.new("Bright yellow") elseif not crit then pa.BrickColor = BrickColor.new("Bright red") end if blocked then pa.BrickColor = BrickColor.new("Bright blue") end pa.CFrame = CFrame.new(hit.Position) * CFrame.new(0, 3, 0) pa.Name = "Head" local hah = Instance.new("Humanoid") hah.Parent = mo hah.MaxHealth = 0 hah.Health = 0 local bp = Instance.new("BodyPosition") bp.P = 14000 bp.maxForce = Vector3.new(math.huge, math.huge, math.huge) bp.position = hit.Position + Vector3.new(0, 5, 0) coroutine.resume(coroutine.create(function() wait() mo.Parent = workspace bp.Parent = pa wait(1.4) mo:remove() end)) return pa end function damage(hum,dmg,critornot) local pa = damagesplat(dmg,hum.Torso,critornot) hum:TakeDamage(dmg) coroutine.resume(coroutine.create(function() tagHumanoid(hum,Player) wait(1) untagHumanoid(hum) end)) return pa end function AddEnergy(add) Energy = Energy + add if Energy > MaxEnergy then Energy = MaxEnergy end end function OT(hit) --Normal Damage if Hitdeb == 1 then return end if hit.Parent == nil then return end local hum = hit.Parent:findFirstChild("Humanoid") if hum ~= nil and hum ~= Character.Humanoid then if hum.Health <= 0 then return end if hit.Parent:findFirstChild("Block") ~= nil then if hit.Parent.Block.Value then damagesplat(0,hum.Torso,false,true) Hitdeb = 1 if hit.Parent.Block:findFirstChild("BlockPower") ~= nil then if hit.Parent.Block.BlockPower.Value <= 1 then hit.Parent.Block.Value = false elseif hit.Parent.Block.BlockPower.Value > 1 then local critrandomizer = math.random(crtrate) if critrandomizer ~= 1 then hit.Parent.Block.BlockPower.Value = hit.Parent.Block.BlockPower.Value - blockbreaker elseif critrandomizer == 1 then hit.Parent.Block.BlockPower.Value = hit.Parent.Block.BlockPower.Value - blockbreaker + 2 end end end return end end local critrandomizer = math.random(crtrate) if critrandomizer ~= 1 then local rndmdamage = math.random(mindamage,maxdamage) damage(hum,rndmdamage,false) elseif critrandomizer == 1 then local rndmdamage = math.random(maxdamage,crtmaxdamage) damage(hum,rndmdamage,true) end Hitdeb = 1 end end function AoE(p,magnitude) local c = game.Workspace:GetChildren(); for i = 1, #c do local hum = c[i]:findFirstChild("Humanoid") if hum ~= nil and hum.Health ~= 0 then local head = c[i]:findFirstChild("Head"); if head ~= nil then local mag = (head.Position - p).magnitude; if mag <= magnitude and c[i].Name ~= Character.Name then local foundd = false for ii = 1 , #AoETrue do if AoETrue[ii] == c[i].Name then foundd = true end end if foundd then end -- if not foundd then local critrandomizer = math.random(crtrate) if critrandomizer ~= 1 then local rndmdamage = math.random(mindamage,maxdamage) damage(hum,rndmdamage,false) elseif critrandomizer == 1 then local rndmdamage = math.random(maxdamage,crtmaxdamage) damage(hum,rndmdamage,true) end table.insert(AoETrue,c[i].Name) end end end end end for ii = 1 , #AoETrue do table.remove(AoETrue,#AoETrue) end end -- -- function effect(Color,Ref,LP,P1) local effectsmsh = Instance.new("BlockMesh") effectsmsh.Scale = Vector3.new(1,1,1) effectsmsh.Name = "Mesh" local effectsg = Instance.new("Part") effectsg.formFactor = 3 effectsg.CanCollide = false effectsg.Name = "Eff" effectsg.Locked = true effectsg.Anchored = true effectsg.Size = Vector3.new(0.2,1,0.2) effectsg.Parent = swordholder effectsmsh.Parent = effectsg effectsg.BrickColor = BrickColor.new(Color) effectsg.Reflectance = Ref local point1 = P1 local mg = (LP.p - point1.p).magnitude effectsg.Size = Vector3.new(0.2,mg,0.2) effectsg.CFrame = CFrame.new((LP.p+point1.p)/2,point1.p) * CFrame.Angles(math.rad(90),0,0) coroutine.resume(coroutine.create(function() for i = 0 , 1 , 0.1 do wait() effectsg.Transparency = 1*i effectsmsh.Scale = Vector3.new(1-1*i,1,1-1*i) end wait() effectsg.Parent = nil end)) end -- con = nil function dmgcnnct() if con ~= nil then con:disconnect() Hitdeb = 0 end con = prt4.Touched:connect(OT) end function dmgdc() if con ~= nil then con:disconnect() Hitdeb = 0 end end function rptddmg(value,des,inc) coroutine.resume(coroutine.create(function() repeat wait(inc) Hitdeb = 0 until value == des end)) end function atktype(s,e) coroutine.resume(coroutine.create(function () attacktype = e wait(0.25) attacktype = s end)) end jumping = false walking = false function Walk() if walking or jumping then return end walking = true for i = 0.2 , 1, 0.2 do wait() w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(20-80*i), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(80-40*i), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2-0.2*i) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(20+60*i), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(80-100*i), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2-0.2*i) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(-1.5, 0,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(1.5, 0,0) end repeat for i = 0.1 , 1, 0.1 do if not walking or jumping then break end wait() w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(-60+140*i), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(40-60*i), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(80-140*i), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(-20+60*i), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(-1.5, 0,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(1.5, 0,0) end for i = 0.1 , 1, 0.1 do if not walking or jumping then break end wait() w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(80-140*i), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(-20+60*i), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(-60+140*i), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(40-60*i), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(-1.5, 0,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(1.5, 0,0) end until not walking or jumping for i = 0.2 , 1, 0.2 do if not walking or jumping then break end wait() w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(-60+80*i), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(40+40*i), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2*i) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(80-60*i), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(-20+100*i), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2*i) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(-1.5, 0,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(1.5, 0,0) end w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(20), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(80), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(20), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(80), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) end function Jump() if jumping then return end jumping = true local vel = Instance.new("BodyVelocity",prt1) vel.maxForce = Vector3.new(0,1,0) * math.huge vel.P = vel.P * 5 vel.velocity = Vector3.new(0,jump,0) coroutine.resume(coroutine.create(function() wait() wait() wait() wait() vel.Parent=nil end)) ss(Head,1) for i = 0.2 , 1 , 0.2 do wait() w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(20), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(80-80*i), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2-0.2*i) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(20), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(80-80*i), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2-0.2*i) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) --Neck w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) w3.C1 = CFrame.Angles(math.rad(-20+20*i), 0, 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) --Wings w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(-45*i)) * CFrame.new(-1.5-0.5*i, 0,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(45*i)) * CFrame.new(1.5+0.5*i, 0,0) end wait(0.5) for i = 0.2 , 1 , 0.2 do wait() w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(20), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(80*i), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2*i) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(20), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(80*i), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2*i) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) --Neck w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) w3.C1 = CFrame.Angles(math.rad(-20*i), 0, 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) --Wings w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(-45+45*i)) * CFrame.new(-2+0.5*i, 0,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(45-45*i)) * CFrame.new(2-0.5*i, 0,0) end jumping = false if prt1.Velocity.magnitude > 5 then walking = true for i = 0.2 , 1, 0.2 do wait() w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(20-80*i), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(80-40*i), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2-0.2*i) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(20+60*i), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(80-100*i), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2-0.2*i) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) end repeat for i = 0.1 , 1, 0.1 do if not walking or jumping then break end wait() w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(-60+140*i), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(40-60*i), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(80-140*i), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(-20+60*i), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) end for i = 0.1 , 1, 0.1 do if not walking or jumping then break end wait() w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(80-140*i), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(-20+60*i), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(-60+140*i), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(40-60*i), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) end until not walking or jumping for i = 0.2 , 1, 0.2 do if jumping then break end wait() w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(-60+80*i), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(40+40*i), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2*i) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(80-60*i), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(-20+100*i), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2*i) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) end w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(20), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(80), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(20), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(80), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) end end dashing = false function Dash() dashing = true for i = 0.1 ,1 , 0.1 do wait() --Neck w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) w3.C1 = CFrame.Angles(math.rad(-20-60*i), 0, 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) end dmgcnnct() rptddmg(dashing,false,1) LastPoint = prt4.CFrame * CFrame.new(0,0,prt4.Size.Y/2) repeat local Point = prt4.CFrame * CFrame.new(0,0,prt4.Size.Y/2) effect("White",0.5,LastPoint,Point) LastPoint = Point wait(0.1) if Energy >= 1 then Energy = Energy - 1 end until not buttonhold or Energy < 3 dmgdc() dashing = false for i = 0.1 ,1 , 0.1 do wait() --Neck w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) w3.C1 = CFrame.Angles(math.rad(-80+60*i), 0, 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) end end idleez = false function Idle() if idleez then return end idleez = true local rndm = math.random(1,3) for i = 0.05, 1 , 0.05 do if not walking and not dashing and not jumping then wait() w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) w3.C1 = CFrame.Angles(math.rad(-20+5*i), 0, 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) if rndm ~= 1 then w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10*i)) * CFrame.new(-1.5-0.2*i, 0,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(10*i)) * CFrame.new(1.5+0.2*i, 0,0) else w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(-45*i)) * CFrame.new(-1.5-0.5*i, 0,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(45*i)) * CFrame.new(1.5+0.5*i, 0,0) end end end if rndm == 1 then for i = 0.1 , 1 , 0.1 do if not walking and not dashing and not jumping then wait() w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) w3.C1 = CFrame.Angles(math.rad(-15+5*i) ,math.rad(0), 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(-45-45*i)) * CFrame.new(-2, -1*i,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(45+45*i)) * CFrame.new(2, -1*i,0) end end for i = 0.2 , 1 , 0.2 do if not walking and not dashing and not jumping then wait() w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) w3.C1 = CFrame.Angles(math.rad(-10+5*i),math.rad(0), 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(-90+30*i)) * CFrame.new(-2, -1,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(90-30*i)) * CFrame.new(2, -1,0) end end for i = 0.2 , 1 , 0.2 do if not walking and not dashing and not jumping then wait() w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) w3.C1 = CFrame.Angles(math.rad(-5+5*i),math.rad(0), 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(-60-30*i)) * CFrame.new(-2, -1,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(60+30*i)) * CFrame.new(2, -1,0) end end for i = 0.1 , 1 , 0.1 do if not walking and not dashing and not jumping then wait() w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) w3.C1 = CFrame.Angles(math.rad(-15*i),math.rad(0), 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(-90+45*i)) * CFrame.new(-2, -1+1*i,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(90-45*i)) * CFrame.new(2, -1+1*i,0) end end end for i = 0.025, 1 , 0.025 do if not walking and not dashing and not jumping then wait() w2.C1 = CFrame.new(0, 0,0) * CFrame.Angles(0, 0, 0) w2.C0 = CFrame.Angles(math.rad(45), 0, 0) * CFrame.new(0, -1,2.5) w3.C1 = CFrame.Angles(math.rad(-15-5*i), 0, 0) * CFrame.new(0, 0.465,0) w3.C0 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.465,0) if rndm ~= 1 then w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10+10*i)) * CFrame.new(-1.7+0.2*i, 0,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(10-10*i)) * CFrame.new(1.7-0.2*i, 0,0) else w11.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w11.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(-45+45*i)) * CFrame.new(-2+0.5*i, 0,0) w16.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w16.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(45-45*i)) * CFrame.new(2-0.5*i, 0,0) end end end idleez = false end function returnwelds() RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(45),math.rad(0),math.rad(-20)) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, 0) LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.Angles(math.rad(45),math.rad(0),math.rad(20)) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.Angles(0, 0, 0) RWL.C0 = CFrame.new(1, -1, 0) * CFrame.Angles(math.rad(45), 0, math.rad(25)) RWL.C1 = CFrame.new(0.5, 1, 0) LWL.C0 = CFrame.new(-1, -1, 0) * CFrame.Angles(math.rad(45), 0, math.rad(-25)) LWL.C1 = CFrame.new(-0.5, 1, 0) Neck.C0 = neckcf0 -- w22.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w22.C0 = CFrame.Angles(math.rad(20), math.rad(10), math.rad(0)) * CFrame.new(-0.75, 1.5,0) w23.C1 = CFrame.Angles(math.rad(80), 0, 0) * CFrame.new(0, -0.25,0) w23.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) w24.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w24.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- w28.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, 0,0) w28.C0 = CFrame.Angles(math.rad(20), math.rad(-10), math.rad(0)) * CFrame.new(0.75, 1.5,0) w29.C1 = CFrame.Angles(math.rad(80), 0, 0) * CFrame.new(0, -0.25,0) w29.C0 = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0, 0.25,0.2) w30.C1 = CFrame.Angles(math.rad(0), 0, 0) * CFrame.new(0, -0.725,0) w30.C0 = CFrame.Angles(math.rad(40), math.rad(0), math.rad(0)) * CFrame.new(0, 0.725,0.25) -- end function ride() Ride = true equipanim() end function unride() Ride = false hideanim() end function RemoveSeater() if #prt34:GetChildren() > 0 then prt34:GetChildren()[1].Parent = nil end end function onFreeFall() unride() print("Fell") value1=value1+1 end keyhold = false function ob1d(mouse) hold = true if attack then return end keyhold = true end function ob1u(mouse) keyhold = false end buttonhold = false function key(key,mouse) if attack then return end if Ride then if key == "f" then buttonhold = true Dash() end if key == " " then coroutine.resume(coroutine.create(Jump)) end end if key == "q" then if Ride then unride() else --prt4 mag=Torso.Position-prt4.Position magni=mag.magnitude if magni <=3 then swordholder:MoveTo(Head.Position+Vector3.new(0,5,0)) ride() end end end if key == "x" then RemoveSeater() end end function key2(key) if key == "f" then buttonhold = false end end function s(mouse) repeat wait() until not attack repeat wait() until not ev.Value arms() mouse.Button1Down:connect(function() ob1d(mouse) end) mouse.Button1Up:connect(function() ob1u(mouse) end) mouse.KeyDown:connect(function(ke) key(ke,mouse) end) mouse.KeyUp:connect(key2) ev.Value = true end function ds(mouse) keyhold = false repeat wait() until not attack repeat wait() until ev.Value noarms() wait(0.1) ev.Value = false end Bin.Selected:connect(s) Bin.Deselected:connect(ds) if PlayerGui:findFirstChild("EnergyMeter") ~= nil then PlayerGui:findFirstChild("EnergyMeter").Parent = nil end coroutine.resume(coroutine.create(function() repeat wait(0.1) if Ride then if dashing then Character.Humanoid.WalkSpeed = speed * 1.5 else Character.Humanoid.WalkSpeed = speed end if (prt1.Velocity * Vector3.new(1,0,1)).magnitude > 5 then coroutine.resume(coroutine.create(Walk)) walking = true elseif (prt1.Velocity * Vector3.new(1,0,1)).magnitude < 5 then walking = false AddEnergy(1) coroutine.resume(coroutine.create(function() Idle() end)) end else Character.Humanoid.WalkSpeed = 16 coroutine.resume(coroutine.create(function() Idle() end)) walking = false end until false end)) coroutine.resume(coroutine.create(function() local SG = Instance.new("ScreenGui",PlayerGui) SG.Name = "EnergyMeter" local frame = Instance.new("Frame",SG) frame.Size = UDim2.new(0.2,0,0.1,0) frame.Position = UDim2.new(0.6,0,0.05,0) frame.BackgroundColor3 = BrickColor.new("Bright blue").Color local Energytext = Instance.new("TextLabel",frame) Energytext.Size = UDim2.new(1,0,0.35,0) Energytext.BackgroundTransparency = 1 Energytext.Text = "Energy" Energytext.FontSize = "Size18" Energytext.TextColor3 = BrickColor.new("White").Color local backing = Instance.new("ImageLabel",frame) backing.Size = UDim2.new(0.8,0,0.45,0) backing.Image = "http://www.roblox.com/asset/?id=48965808" backing.Position = UDim2.new(0.1,0,0.45,0) backing.BackgroundColor3 = BrickColor.new("Black").Color local img = Instance.new("ImageLabel",backing) img.Size = UDim2.new(1,0,1,0) img.Image = "http://www.roblox.com/asset/?id=48965808" img.Position = UDim2.new(0,0,0,0) img.BackgroundColor3 = BrickColor.new("Bright blue").Color local percent = Instance.new("TextLabel",backing) percent.Size = UDim2.new(1,0,1,0) percent.BackgroundTransparency = 1 percent.TextColor3 = BrickColor.new("White").Color percent.Text = Energy.."/".. MaxEnergy percent.FontSize = "Size18" repeat wait() pcall(function() img.Size = UDim2.new(1*(Energy/MaxEnergy),0,1,0) percent.Text = Energy.."/".. MaxEnergy end) until SG.Parent == nil end)) --Character.Humanoid.FreeFalling:connect(onFreeFall) Character:MoveTo(Head.Position+Vector3.new(0,5,0)) Character.Torso.CFrame = Character.Torso.CFrame + Vector3.new(0,5,0) swordholder:MoveTo(Head.Position+Vector3.new(0,5,0)) ride() noarms() -- mediafire