Add files via upload

This commit is contained in:
Dinkledork
2023-03-21 02:26:56 -06:00
committed by GitHub
parent 2b50ae9df0
commit bd7b2fd4bb
26 changed files with 3354 additions and 0 deletions

60
HardcoreMode/Hardcore.lua Normal file
View File

@@ -0,0 +1,60 @@
--NPC id
local hcNPC = 90000
--This is how long the character is locked for - default is 32 years.
local banTimer = 999999999
--on death function - checks if player has token and bans character if it does.
local function PlayerDeath(event, killer, killed)
if killed:HasItem(90000,1) and killed:GetLevel() == 1 then
print(killed:GetName() .. " was killed by " .. killer:GetName())
SendWorldMessage(killed:GetName() .. " was killed by " .. killer:GetName())
Ban(1,killed:GetName(),banTimer)
end
end
--First Gossip Screen for NPC
function OnFirstTalk(event, player, unit)
if player:GetLevel() == 1 then
player:PlayDistanceSound(20431)
player:GossipMenuAddItem(0, "Looking for a challenge? Click here to try hardcore mode!", 0, 1)
player:GossipSendMenu(1, unit)
else
player:SendBroadcastMessage("You must be level 1 to access hardcore mode.")
player:PlayDistanceSound(20432)
player:GossipComplete()
end
end
--Selection for NPC gossip
function OnSelect(event, player, unit, sender, intid, code)
if intid == 1 then
player:PlayDistanceSound(20433)
player:GossipMenuAddItem(0, "Just double checking to make sure that you want to turn on hardcore mode. This will lock the character after death to be no longer playable, remove all your current gold, remove bonus starter items and Murky will no longer be with you! I will likely be adding rewards for reaching certain stages of the game later...", 0, 2)
player:GossipMenuAddItem(0, "NO TAKE ME BACK!", 0, 3)
player:GossipSendMenu(2, unit)
end
end
--if player chooses to do hardcore they receive the token and have custom items and Murky removed
function OnHardCore(event, player, unit, sender, intid, code)
if intid == 2 then
player:PlayDistanceSound(20434)
player:AddItem(90000, 1)
player:SetCoinage(0)
player:RemoveItem(60002, player:GetItemCount(60002))
player:RemoveItem(10594, player:GetItemCount(10594))
player:RemoveItem(65000, player:GetItemCount(65000))
player:RemoveSpell(24939)
player:RemoveSpell(100117)
player:RemoveSpell(100118)
--else gossip ends
else
player:GossipComplete()
player:PlayDistanceSound(20434)
end
end
RegisterCreatureGossipEvent(hcNPC, 1 , OnFirstTalk)
RegisterCreatureGossipEvent(hcNPC, 2, OnSelect)
RegisterCreatureGossipEvent(hcNPC, 2, OnHardCore)
RegisterPlayerEvent(8, PlayerDeath)

View File

@@ -0,0 +1,39 @@
local function hasItem90000(player)
return player:GetItemCount(90000) > 0
end
-- Remove custom starter items
local function removeItems(player)
local removed = false
local items = {60002, 10594, 65000}
for _, entry in ipairs(items) do
local itemCount = player:GetItemCount(entry)
if itemCount > 0 then
for i = 0, itemCount - 1 do
player:RemoveItem(entry, 1)
end
removed = true
end
end
return removed
end
-- Remove Murky
local function removeSpell(player)
player:RemoveSpell(24939)
player:RemoveSpell(100117)
player:RemoveSpell(100118)
end
-- Script body
local function onLogin(event, player)
if hasItem90000(player) then
if removeItems(player) then
player:SendBroadcastMessage("Welcome to Hardcore Mode. Please watch your step!")
end
removeSpell(player)
end
end
-- Register the script to be triggered on player login
RegisterPlayerEvent(3, onLogin)