mirror of
https://github.com/araxiaonline/RandomScriptsforAzerothCore.git
synced 2026-06-13 02:22:19 -04:00
Add files via upload
This commit is contained in:
@@ -1,19 +1,34 @@
|
||||
local AMage = {};
|
||||
local AMage = {}
|
||||
|
||||
local function CastFireball(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature:GetVictim(), 38692, true)
|
||||
creature:CastSpell(creature:GetVictim(), 38692, true)
|
||||
end
|
||||
|
||||
local function CastFrostbolt(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature:GetVictim(), 27071, true)
|
||||
end
|
||||
|
||||
local function CastBlizzard(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature:GetVictim(), 42213, true)
|
||||
end
|
||||
|
||||
local function CastArcaneExplosion(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature:GetVictim(), 19712, true)
|
||||
end
|
||||
|
||||
local function OnEnterCombat(event, creature, target)
|
||||
creature:RegisterEvent(CastFireball, 3600, 0)
|
||||
end
|
||||
|
||||
creature:RegisterEvent(CastFireball, 3600, 0)
|
||||
creature:RegisterEvent(CastFrostbolt, 7200, 0)
|
||||
creature:RegisterEvent(CastBlizzard, 9000, 0)
|
||||
creature:RegisterEvent(CastArcaneExplosion, 10800, 0)
|
||||
end
|
||||
|
||||
local function OnLeaveCombat(event, creature)
|
||||
creature:RemoveEvents()
|
||||
creature:RemoveEvents()
|
||||
end
|
||||
|
||||
local function OnDied(event, creature, killer)
|
||||
creature:RemoveEvents()
|
||||
creature:RemoveEvents()
|
||||
end
|
||||
|
||||
RegisterCreatureEvent(400027, 1, OnEnterCombat)
|
||||
|
||||
@@ -1,29 +1,45 @@
|
||||
local APriest = {};
|
||||
|
||||
local function CastSmite(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature:GetVictim(), 48122, true)
|
||||
creature:CastSpell(creature:GetVictim(), 48122, true)
|
||||
end
|
||||
|
||||
local function CastHolyFire(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature:GetVictim(), 48134, true)
|
||||
creature:CastSpell(creature:GetVictim(), 48134, true)
|
||||
end
|
||||
|
||||
local function CastSWP(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature:GetVictim(), 27605, true)
|
||||
creature:CastSpell(creature:GetVictim(), 27605, true)
|
||||
end
|
||||
|
||||
local function CastHeal(eventId, delay, calls, creature)
|
||||
local friendlyUnit = creature:GetRandomFriendlyUnit(5.0)
|
||||
if friendlyUnit then
|
||||
creature:CastSpell(friendlyUnit, 25314, true)
|
||||
end
|
||||
end
|
||||
|
||||
local function CastRenew(eventId, delay, calls, creature)
|
||||
local friendlyUnit = creature:GetRandomFriendlyUnit(5.0)
|
||||
if friendlyUnit then
|
||||
creature:CastSpell(friendlyUnit, 25315, true)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnEnterCombat(event, creature, target)
|
||||
creature:RegisterEvent(CastSmite, 2600, 0)
|
||||
creature:RegisterEvent(CastHolyFire, 5000, 0)
|
||||
creature:RegisterEvent(CastSWP, 15000, 0)
|
||||
end
|
||||
|
||||
creature:RegisterEvent(CastSmite, 2600, 0)
|
||||
creature:RegisterEvent(CastHolyFire, 5000, 0)
|
||||
creature:RegisterEvent(CastSWP, 15000, 0)
|
||||
creature:RegisterEvent(CastHeal, 10000, 0)
|
||||
creature:RegisterEvent(CastRenew, 7000, 0)
|
||||
end
|
||||
|
||||
local function OnLeaveCombat(event, creature)
|
||||
creature:RemoveEvents()
|
||||
creature:RemoveEvents()
|
||||
end
|
||||
|
||||
local function OnDied(event, creature, killer)
|
||||
creature:RemoveEvents()
|
||||
creature:RemoveEvents()
|
||||
end
|
||||
|
||||
RegisterCreatureEvent(400026, 1, OnEnterCombat)
|
||||
|
||||
51
Bolvar.lua
Normal file
51
Bolvar.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
local Bolvar = {}
|
||||
|
||||
local function CastHolyShield(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature, 20928, true)
|
||||
end
|
||||
|
||||
local function CastAS(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature:GetVictim(), 32699, true)
|
||||
end
|
||||
|
||||
local function CastHOR(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature:GetVictim(), 53595, true)
|
||||
end
|
||||
|
||||
local function CastJOL(eventId, delay, calls, creature)
|
||||
creature:CastSpell(creature:GetVictim(), 20271, true)
|
||||
end
|
||||
|
||||
local function CastAvengingWrath(event, creature)
|
||||
creature:CastSpell(creature, 31884, true)
|
||||
end
|
||||
|
||||
local function CastKings(event, creature)
|
||||
creature:CastSpell(creature, 20217, true)
|
||||
end
|
||||
|
||||
local function OnEnterCombat(event, creature, target)
|
||||
creature:RegisterEvent(CastHolyShield, 8000, 0)
|
||||
creature:RegisterEvent(CastAS, 12600, 0)
|
||||
creature:RegisterEvent(CastHOR, 5000, 0)
|
||||
creature:RegisterEvent(CastJOL, 10000, 0)
|
||||
creature:RegisterEvent(CastAvengingWrath, 1, 1)
|
||||
end
|
||||
|
||||
local function OnLeaveCombat(event, creature)
|
||||
creature:RemoveEvents()
|
||||
end
|
||||
|
||||
local function OnDied(event, creature, killer)
|
||||
creature:RemoveEvents()
|
||||
end
|
||||
|
||||
local function OnSpawn(event, creature)
|
||||
creature:CastSpell(creature, 20217, true)
|
||||
end
|
||||
|
||||
RegisterCreatureEvent(1748, 1, OnEnterCombat)
|
||||
RegisterCreatureEvent(1748, 2, OnLeaveCombat)
|
||||
RegisterCreatureEvent(1748, 4, OnDied)
|
||||
RegisterCreatureEvent(1748, 5, OnSpawn)
|
||||
|
||||
30
Bolvar2.lua
Normal file
30
Bolvar2.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
local Bolvar = 1748
|
||||
local kingsSpell = 25898
|
||||
local wisdomSpell = 25918
|
||||
local mightSpell = 25916
|
||||
|
||||
local function OnSpawn(event, creature)
|
||||
creature:CastSpell(creature, kingsSpell, true)
|
||||
end
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
player:GossipMenuAddItem(9, "|TInterface\\Icons\\spell_magic_magearmor:50:50:-43:0|tGrant me a Blessing of Kings", 0, 1, false, "", 0)
|
||||
player:GossipMenuAddItem(9, "|TInterface\\Icons\\spell_holy_sealofwisdom:50:50:-43:0|tGrant me a Blessing of Wisdom", 0, 2, false, "", 0)
|
||||
player:GossipMenuAddItem(9, "|TInterface\\Icons\\spell_holy_fistofjustice:50:50:-43:0|tGrant me a Blessing of Might", 0, 3, false, "", 0)
|
||||
player:GossipSendMenu(1, creature)
|
||||
end
|
||||
|
||||
local function OnGossipSelect(event, player, creature, sender, intid, code, menuid)
|
||||
if intid == 1 then
|
||||
player:CastSpell(player, kingsSpell, true)
|
||||
elseif intid == 2 then
|
||||
player:CastSpell(player, wisdomSpell, true)
|
||||
elseif intid == 3 then
|
||||
player:CastSpell(player, mightSpell, true)
|
||||
end
|
||||
player:GossipComplete()
|
||||
end
|
||||
|
||||
RegisterCreatureEvent(Bolvar, 5, OnSpawn)
|
||||
RegisterCreatureGossipEvent(Bolvar, 1, OnGossipHello)
|
||||
RegisterCreatureGossipEvent(Bolvar, 2, OnGossipSelect)
|
||||
74
DingMask.lua
Normal file
74
DingMask.lua
Normal file
@@ -0,0 +1,74 @@
|
||||
local npcIds1 = {
|
||||
8541,
|
||||
10417,
|
||||
4475,
|
||||
11873,
|
||||
8531,
|
||||
11551,
|
||||
10488,
|
||||
10487,
|
||||
1788,
|
||||
10414,
|
||||
10407,
|
||||
400010,
|
||||
400011,
|
||||
400015,
|
||||
400016,
|
||||
300018,
|
||||
400029
|
||||
}
|
||||
|
||||
-- Table to store NPC IDs for group 2
|
||||
local npcIds2 = {
|
||||
400013,
|
||||
400014,
|
||||
68,
|
||||
1976,
|
||||
466,
|
||||
400018,
|
||||
400019,
|
||||
400026,
|
||||
400027
|
||||
}
|
||||
|
||||
-- Function to be executed when an NPC from group 1 is spawned
|
||||
local function CastSpellOnSpawnGroup1(event, creature)
|
||||
if not creature then
|
||||
print("Error: creature was not set!")
|
||||
return
|
||||
end
|
||||
|
||||
local spellId = 28234
|
||||
creature:CastSpell(creature, spellId, true) -- minion visual
|
||||
end
|
||||
|
||||
-- Function to be executed when an NPC from group 2 is spawned
|
||||
local function CastSpellOnSpawnGroup2(event, creature)
|
||||
if not creature then
|
||||
print("Error: creature was not set!")
|
||||
return
|
||||
end
|
||||
|
||||
local spellId = 100133
|
||||
creature:CastSpell(creature, spellId, true) -- rez visual
|
||||
end
|
||||
|
||||
-- Function to be executed when an NPC from both groups leaves combat
|
||||
local function CastSpellOnLeaveCombat(event, creature)
|
||||
if not creature then
|
||||
print("Error: creature was not set!")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Register the event for NPCs in group 1
|
||||
for _, npcId in ipairs(npcIds1) do
|
||||
RegisterCreatureEvent(npcId, 5, CastSpellOnSpawnGroup1)
|
||||
RegisterCreatureEvent(npcId, 21, CastSpellOnLeaveCombat)
|
||||
end
|
||||
|
||||
-- Register the event for NPCs in group 2
|
||||
for _, npcId in ipairs(npcIds2) do
|
||||
RegisterCreatureEvent(npcId, 5, CastSpellOnSpawnGroup2)
|
||||
RegisterCreatureEvent(npcId, 21, CastSpellOnLeaveCombat)
|
||||
end
|
||||
16
KillCred.lua
Normal file
16
KillCred.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local function OnKillCredit(event, killer, killed)
|
||||
-- Check if the killed unit is a creature
|
||||
if killed:IsCreature() then
|
||||
-- Loop through all players in the world
|
||||
for _, player in pairs(GetPlayersInWorld()) do
|
||||
-- Check if the player has attacked the creature
|
||||
if player:GetUnitByGUID(killed):HasAura(2) then
|
||||
-- Give the player kill credit for the creature
|
||||
player:KilledMonsterCredit(killed:GetEntry())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Register the event handler
|
||||
RegisterPlayerEvent(7, OnKillCredit)
|
||||
@@ -1,203 +1,203 @@
|
||||
--
|
||||
-- Created by IntelliJ IDEA.
|
||||
-- User: Silvia
|
||||
-- Date: 28/02/2021
|
||||
-- Time: 23:16
|
||||
-- To change this template use File | Settings | File Templates.
|
||||
-- Originally created by Honey for Azerothcore
|
||||
-- requires ElunaLua module
|
||||
|
||||
-- Updated By: Ragundah
|
||||
-- Date: 13/05/2021
|
||||
|
||||
--Players will receive rewards when their characters reach the levels in brackets.
|
||||
------------------------------------------------------------------------------------------------
|
||||
-- ADMIN GUIDE: - compile the core with ElunaLua module
|
||||
-- - adjust config in this file
|
||||
-- - create a character who appears as sender of the mails with senderGUID
|
||||
-- - add this script to ../lua_scripts/
|
||||
------------------------------------------------------------------------------------------------
|
||||
|
||||
local Config_Gold = {}
|
||||
local Config_ItemId = {}
|
||||
local Config_ItemAmount = {}
|
||||
local LUR_playerCounter = {}
|
||||
|
||||
Config_Gold[10] = 20000 -- gold granted when reaching level [10] in copper. 10000 = 1 gold. Cost for spells 10-18 (mage): ~1g50s
|
||||
Config_Gold[20] = 140000 -- Cost for spells 20-28 (mage): ~11g
|
||||
Config_Gold[30] = 360000 -- Cost for spells 30-38 (mage): ~27g
|
||||
Config_Gold[40] = 700000 -- Cost for spells 40-48 (mage): ~50g
|
||||
Config_Gold[50] = 1000000 -- Cost for spells 50-58 (mage): ~93g
|
||||
Config_Gold[61] = 1250000
|
||||
Config_Gold[65] = 1600000
|
||||
Config_Gold[71] = 2000000
|
||||
Config_Gold[75] = 3000000
|
||||
Config_Gold[80] = 7000000
|
||||
|
||||
Config_ItemId[29] = 34492 -- item granted when reaching level [29] / 5740 is a cosmetic red rocket
|
||||
Config_ItemAmount[29] = 1 -- amount of items to be granted when reaching level [29]. Missing amounts are automatically set to 1 if an ItemId is given
|
||||
Config_ItemId[35] = 45706
|
||||
Config_ItemAmount[35] = 1
|
||||
Config_ItemId[40] = 46109
|
||||
Config_ItemAmount[40] = 1
|
||||
Config_ItemId[43] = 52001
|
||||
Config_ItemAmount[43] = 1
|
||||
Config_ItemId[46] = 45706
|
||||
Config_ItemAmount[46] = 1
|
||||
Config_ItemId[50] = 52002
|
||||
Config_ItemAmount[50] = 1
|
||||
Config_ItemId[59] = 33223
|
||||
Config_ItemAmount[59] = 1
|
||||
Config_ItemId[60] = 49646
|
||||
Config_ItemAmount[60] = 1
|
||||
Config_ItemId[64] = 9312
|
||||
Config_ItemAmount[64] = 5
|
||||
Config_ItemId[69] = 9313
|
||||
Config_ItemAmount[69] = 5
|
||||
Config_ItemId[70] = 9314
|
||||
Config_ItemAmount[70] = 5
|
||||
|
||||
-- General Settings Config
|
||||
local Config_mailText = 2 -- Which text to send in the mail to the player.
|
||||
local Config_senderGUID = 1 -- GUID/ID of the Player/Creature. If Config_preventReturn = true then you need to put Creature ID. If it's false Player GUID. 0 = No sender aka "From: Unknown".
|
||||
local Config_mailStationery = 41 -- Stationary used in the mail sent to the player. (41 Normal Mail, 61 GM/Blizzard Support, 62 Auction, 64 Valentines, 65 Christmas) Note: Use 62, 64, and 65 At your own risk.
|
||||
local Config_maxGMRank = 3 -- Checks the player's assigned GM rank. Anything above the assigned default will not receive mail/be counted for the player counter. Default 0 - Players Only. Max 3 - All GMS/Mods/Etc will receive as well.
|
||||
local Config_preventReturn = true -- Modify's the Mail database to prevent returning of rewards. Note: If you are experiencing server lag after installing this module please disable this option to see if it helps.
|
||||
|
||||
-- Config_mailText == 1 Config
|
||||
local Config_mailSubject1 = "Dinkle's reward for You!"
|
||||
local Config_mailText1 = "!\n\nYou've done well while advancing on Dinkle's Server. Here is a small reward to celebrate your heroic deeds. Go forth!\n\nKind regards,\nDinkle"
|
||||
-- Config_mailText == 2 Config
|
||||
local Config_mailSubject2 = "Dinkle's reward for You!"
|
||||
local Config_mailText2A = " and congratulations! \n\nThe bronze Dragonflight would like to inform you that you were the "
|
||||
local Config_mailText2B = " adventurer to reach the "
|
||||
local Config_mailText2C = " level of mastery.\nYour adventures have made me take notice of you, take this small reward as a token of my appreciation.\nGo forth!\n\nKind regards,\nDinkle"
|
||||
|
||||
-- Name of Eluna dB scheme
|
||||
local Config_customDbName = 'ac_eluna';
|
||||
|
||||
------------------------------------------
|
||||
-- NO ADJUSTMENTS REQUIRED BELOW THIS LINE
|
||||
------------------------------------------
|
||||
|
||||
CharDBQuery('CREATE DATABASE IF NOT EXISTS `'..Config_customDbName..'`;');
|
||||
CharDBQuery('CREATE TABLE IF NOT EXISTS `'..Config_customDbName..'`.`levelup_reward` (`level` INT NOT NULL, `counter` INT DEFAULT 0, PRIMARY KEY (`level`) );');
|
||||
|
||||
local n
|
||||
for n = 2,80,1 do
|
||||
LUR_playerCounter[n] = 0
|
||||
end
|
||||
|
||||
Data_SQL = CharDBQuery('SELECT `level`, `counter` FROM `'..Config_customDbName..'`.`levelup_reward`;');
|
||||
if Data_SQL ~= nil then
|
||||
local levelRow
|
||||
repeat
|
||||
levelRow = Data_SQL:GetUInt32(0)
|
||||
LUR_playerCounter[levelRow] = Data_SQL:GetUInt32(1)
|
||||
until not Data_SQL:NextRow()
|
||||
end
|
||||
|
||||
|
||||
local PLAYER_EVENT_ON_LEVEL_CHANGE = 13
|
||||
|
||||
local function PreventReturn(playerGUID)
|
||||
if Config_preventReturn == true then
|
||||
CharDBExecute('UPDATE `mail` SET `messageType` = 3 WHERE `sender` = '..Config_senderGUID..' AND `receiver` = '..playerGUID..' AND `messageType` = 0;')
|
||||
end
|
||||
end
|
||||
|
||||
local function GrantReward(event, player, oldLevel)
|
||||
if oldLevel ~= nil and player:GetGMRank() <= Config_maxGMRank then
|
||||
if Config_mailText == 1 then
|
||||
if Config_ItemId[oldLevel + 1] ~= nil then
|
||||
local playerName = player:GetName()
|
||||
local playerGUID = tostring(player:GetGUID())
|
||||
local itemAmount
|
||||
if Config_ItemAmount[oldLevel + 1] ~= nil then
|
||||
itemAmount = Config_ItemAmount[oldLevel + 1]
|
||||
else
|
||||
itemAmount = 1
|
||||
end
|
||||
if Config_Gold[oldLevel + 1] == nil then
|
||||
Config_Gold[oldLevel + 1] = 0
|
||||
end
|
||||
SendMail(Config_mailSubject1, "Hello "..playerName..Config_mailText1, playerGUID, Config_senderGUID, Config_mailStationery, 0, Config_Gold[oldLevel + 1],0,Config_ItemId[oldLevel + 1], Config_ItemAmount[oldLevel + 1])
|
||||
print("LevelUpReward has granted "..Config_Gold[oldLevel + 1].." copper and "..Config_ItemAmount[oldLevel + 1].." of item "..Config_ItemId[oldLevel + 1].." to character "..playerName.." with guid "..playerGUID..".")
|
||||
PreventReturn(playerGUID)
|
||||
playerName = nil
|
||||
playerGUID = nil
|
||||
return false
|
||||
elseif Config_Gold[oldLevel + 1] ~= nil then
|
||||
local playerName = player:GetName()
|
||||
local playerGUID = tostring(player:GetGUID())
|
||||
SendMail(Config_mailSubject1, "Hello "..playerName..Config_mailText1, playerGUID, Config_senderGUID, Config_mailStationery, 0, Config_Gold[oldLevel + 1])
|
||||
print("LevelUpReward has granted "..Config_Gold[oldLevel + 1].." copper to character "..playerName.." with guid "..playerGUID..".")
|
||||
PreventReturn(playerGUID)
|
||||
playerName = nil
|
||||
playerGUID = nil
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local playerCounterStr
|
||||
local currentLevelStr
|
||||
local currentLevel = oldLevel + 1
|
||||
LUR_playerCounter[currentLevel] = LUR_playerCounter[currentLevel] + 1
|
||||
CharDBExecute('REPLACE INTO `'..Config_customDbName..'`.`levelup_reward` VALUES ('..currentLevel..', '..LUR_playerCounter[currentLevel]..');');
|
||||
playerCounterStr = tostring(LUR_playerCounter[currentLevel])
|
||||
if string.sub(playerCounterStr, -1) == "1" then
|
||||
playerCounterStr = playerCounterStr.."st"
|
||||
elseif string.sub(playerCounterStr, -1) == "2" then
|
||||
playerCounterStr = playerCounterStr.."nd"
|
||||
elseif string.sub(playerCounterStr, -1) == "3" then
|
||||
playerCounterStr = playerCounterStr.."rd"
|
||||
else
|
||||
playerCounterStr = playerCounterStr.."th"
|
||||
end
|
||||
|
||||
currentLevelStr = tostring(currentLevel)
|
||||
if string.sub(currentLevelStr, -1) == "1" then
|
||||
currentLevelStr = currentLevelStr.."st"
|
||||
elseif string.sub(currentLevelStr, -1) == "2" then
|
||||
currentLevelStr = currentLevelStr.."nd"
|
||||
elseif string.sub(currentLevelStr, -1) == "3" then
|
||||
currentLevelStr = currentLevelStr.."rd"
|
||||
else
|
||||
currentLevelStr = currentLevelStr.."th"
|
||||
end
|
||||
|
||||
if Config_mailText == 2 then
|
||||
if Config_ItemId[oldLevel + 1] ~= nil and Config_mailText == 2 then
|
||||
local playerName = player:GetName()
|
||||
local playerGUID = tostring(player:GetGUID())
|
||||
local itemAmount
|
||||
if Config_ItemAmount[oldLevel + 1] ~= nil then
|
||||
itemAmount = Config_ItemAmount[oldLevel + 1]
|
||||
else
|
||||
itemAmount = 1
|
||||
end
|
||||
if Config_Gold[oldLevel + 1] == nil then
|
||||
Config_Gold[oldLevel + 1] = 0
|
||||
end
|
||||
SendMail(Config_mailSubject2, "Hello "..playerName..Config_mailText2A..playerCounterStr..Config_mailText2B..currentLevelStr..Config_mailText2C, playerGUID, Config_senderGUID, Config_mailStationery, 0, Config_Gold[oldLevel + 1],0,Config_ItemId[oldLevel + 1], Config_ItemAmount[oldLevel + 1])
|
||||
print("LevelUpReward has granted "..Config_Gold[oldLevel + 1].." copper and "..Config_ItemAmount[oldLevel + 1].." of item "..Config_ItemId[oldLevel + 1].." to character "..playerName.." with guid "..playerGUID..".")
|
||||
PreventReturn(playerGUID)
|
||||
playerName = nil
|
||||
playerGUID = nil
|
||||
return false
|
||||
elseif Config_Gold[oldLevel + 1] ~= nil and Config_mailText == 2 then
|
||||
local playerName = player:GetName()
|
||||
local playerGUID = tostring(player:GetGUID())
|
||||
SendMail(Config_mailSubject2, "Hello "..playerName..Config_mailText2A..playerCounterStr..Config_mailText2B..currentLevelStr..Config_mailText2C, playerGUID, Config_senderGUID, Config_mailStationery, 0, Config_Gold[oldLevel + 1])
|
||||
print("LevelUpReward has granted "..Config_Gold[oldLevel + 1].." copper to character "..playerName.." with guid "..playerGUID..".")
|
||||
PreventReturn(playerGUID)
|
||||
playerName = nil
|
||||
playerGUID = nil
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RegisterPlayerEvent(PLAYER_EVENT_ON_LEVEL_CHANGE, GrantReward)
|
||||
|
||||
--
|
||||
-- Created by IntelliJ IDEA.
|
||||
-- User: Silvia
|
||||
-- Date: 28/02/2021
|
||||
-- Time: 23:16
|
||||
-- To change this template use File | Settings | File Templates.
|
||||
-- Originally created by Honey for Azerothcore
|
||||
-- requires ElunaLua module
|
||||
|
||||
-- Updated By: Ragundah
|
||||
-- Date: 13/05/2021
|
||||
|
||||
--Players will receive rewards when their characters reach the levels in brackets.
|
||||
------------------------------------------------------------------------------------------------
|
||||
-- ADMIN GUIDE: - compile the core with ElunaLua module
|
||||
-- - adjust config in this file
|
||||
-- - create a character who appears as sender of the mails with senderGUID
|
||||
-- - add this script to ../lua_scripts/
|
||||
------------------------------------------------------------------------------------------------
|
||||
|
||||
local Config_Gold = {}
|
||||
local Config_ItemId = {}
|
||||
local Config_ItemAmount = {}
|
||||
local LUR_playerCounter = {}
|
||||
|
||||
Config_Gold[10] = 10000 -- gold granted when reaching level [10] in copper. 10000 = 1 gold. Cost for spells 10-18 (mage): ~1g50s
|
||||
Config_Gold[20] = 70000 -- Cost for spells 20-28 (mage): ~11g
|
||||
Config_Gold[30] = 180000 -- Cost for spells 30-38 (mage): ~27g
|
||||
Config_Gold[40] = 350000 -- Cost for spells 40-48 (mage): ~50g
|
||||
Config_Gold[50] = 650000 -- Cost for spells 50-58 (mage): ~93g
|
||||
Config_Gold[61] = 600000
|
||||
Config_Gold[65] = 800000
|
||||
Config_Gold[71] = 1000000
|
||||
Config_Gold[75] = 1800000
|
||||
Config_Gold[80] = 5000000
|
||||
|
||||
Config_ItemId[29] = 5740 -- item granted when reaching level [29] / 5740 is a cosmetic red rocket
|
||||
Config_ItemAmount[29] = 5 -- amount of items to be granted when reaching level [29]. Missing amounts are automatically set to 1 if an ItemId is given
|
||||
Config_ItemId[35] = 34412
|
||||
Config_ItemAmount[35] = 10
|
||||
Config_ItemId[39] = 9312
|
||||
Config_ItemAmount[39] = 5
|
||||
Config_ItemId[43] = 35563
|
||||
Config_ItemAmount[43] = 10
|
||||
Config_ItemId[46] = 35565
|
||||
Config_ItemAmount[46] = 10
|
||||
Config_ItemId[49] = 9313
|
||||
Config_ItemAmount[49] = 5
|
||||
Config_ItemId[59] = 9314
|
||||
Config_ItemAmount[59] = 5
|
||||
Config_ItemId[60] = 9315
|
||||
Config_ItemAmount[60] = 5
|
||||
Config_ItemId[64] = 9312
|
||||
Config_ItemAmount[64] = 5
|
||||
Config_ItemId[69] = 9313
|
||||
Config_ItemAmount[69] = 5
|
||||
Config_ItemId[70] = 9314
|
||||
Config_ItemAmount[70] = 5
|
||||
|
||||
-- General Settings Config
|
||||
local Config_mailText = 2 -- Which text to send in the mail to the player.
|
||||
local Config_senderGUID = 10667 -- GUID/ID of the Player/Creature. If Config_preventReturn = true then you need to put Creature ID. If it's false Player GUID. 0 = No sender aka "From: Unknown".
|
||||
local Config_mailStationery = 41 -- Stationary used in the mail sent to the player. (41 Normal Mail, 61 GM/Blizzard Support, 62 Auction, 64 Valentines, 65 Christmas) Note: Use 62, 64, and 65 At your own risk.
|
||||
local Config_maxGMRank = 0 -- Checks the player's assigned GM rank. Anything above the assigned default will not receive mail/be counted for the player counter. Default 0 - Players Only. Max 3 - All GMS/Mods/Etc will receive as well.
|
||||
local Config_preventReturn = true -- Modify's the Mail database to prevent returning of rewards. Note: If you are experiencing server lag after installing this module please disable this option to see if it helps.
|
||||
|
||||
-- Config_mailText == 1 Config
|
||||
local Config_mailSubject1 = "Dinkledork's reward for You!"
|
||||
local Config_mailText1 = "!\n\nYou've done well while advancing on ChromieCraft. Here is a small reward to celebrate your heroic deeds. Go forth!\n\nKind regards,\nChromie"
|
||||
-- Config_mailText == 2 Config
|
||||
local Config_mailSubject2 = "Dinkledork's reward for You!"
|
||||
local Config_mailText2A = " and congratulations! \n\nThe bronze Dragonflight would like to inform you that you were the "
|
||||
local Config_mailText2B = " adventurer to reach the "
|
||||
local Config_mailText2C = " level of mastery.\nYour adventures have made me take notice of you, take this small reward as a token of my appreciation.\nGo forth!\n\nKind regards,\nChromie"
|
||||
|
||||
-- Name of Eluna dB scheme
|
||||
local Config_customDbName = 'ac_eluna';
|
||||
|
||||
------------------------------------------
|
||||
-- NO ADJUSTMENTS REQUIRED BELOW THIS LINE
|
||||
------------------------------------------
|
||||
|
||||
CharDBQuery('CREATE DATABASE IF NOT EXISTS `'..Config_customDbName..'`;');
|
||||
CharDBQuery('CREATE TABLE IF NOT EXISTS `'..Config_customDbName..'`.`levelup_reward` (`level` INT NOT NULL, `counter` INT DEFAULT 0, PRIMARY KEY (`level`) );');
|
||||
|
||||
local n
|
||||
for n = 2,80,1 do
|
||||
LUR_playerCounter[n] = 0
|
||||
end
|
||||
|
||||
Data_SQL = CharDBQuery('SELECT `level`, `counter` FROM `'..Config_customDbName..'`.`levelup_reward`;');
|
||||
if Data_SQL ~= nil then
|
||||
local levelRow
|
||||
repeat
|
||||
levelRow = Data_SQL:GetUInt32(0)
|
||||
LUR_playerCounter[levelRow] = Data_SQL:GetUInt32(1)
|
||||
until not Data_SQL:NextRow()
|
||||
end
|
||||
|
||||
|
||||
local PLAYER_EVENT_ON_LEVEL_CHANGE = 13
|
||||
|
||||
local function PreventReturn(playerGUID)
|
||||
if Config_preventReturn == true then
|
||||
CharDBExecute('UPDATE `mail` SET `messageType` = 3 WHERE `sender` = '..Config_senderGUID..' AND `receiver` = '..playerGUID..' AND `messageType` = 0;')
|
||||
end
|
||||
end
|
||||
|
||||
local function GrantReward(event, player, oldLevel)
|
||||
if oldLevel ~= nil and player:GetGMRank() <= Config_maxGMRank then
|
||||
if Config_mailText == 1 then
|
||||
if Config_ItemId[oldLevel + 1] ~= nil then
|
||||
local playerName = player:GetName()
|
||||
local playerGUID = tostring(player:GetGUID())
|
||||
local itemAmount
|
||||
if Config_ItemAmount[oldLevel + 1] ~= nil then
|
||||
itemAmount = Config_ItemAmount[oldLevel + 1]
|
||||
else
|
||||
itemAmount = 1
|
||||
end
|
||||
if Config_Gold[oldLevel + 1] == nil then
|
||||
Config_Gold[oldLevel + 1] = 0
|
||||
end
|
||||
SendMail(Config_mailSubject1, "Hello "..playerName..Config_mailText1, playerGUID, Config_senderGUID, Config_mailStationery, 0, Config_Gold[oldLevel + 1],0,Config_ItemId[oldLevel + 1], Config_ItemAmount[oldLevel + 1])
|
||||
print("LevelUpReward has granted "..Config_Gold[oldLevel + 1].." copper and "..Config_ItemAmount[oldLevel + 1].." of item "..Config_ItemId[oldLevel + 1].." to character "..playerName.." with guid "..playerGUID..".")
|
||||
PreventReturn(playerGUID)
|
||||
playerName = nil
|
||||
playerGUID = nil
|
||||
return false
|
||||
elseif Config_Gold[oldLevel + 1] ~= nil then
|
||||
local playerName = player:GetName()
|
||||
local playerGUID = tostring(player:GetGUID())
|
||||
SendMail(Config_mailSubject1, "Hello "..playerName..Config_mailText1, playerGUID, Config_senderGUID, Config_mailStationery, 0, Config_Gold[oldLevel + 1])
|
||||
print("LevelUpReward has granted "..Config_Gold[oldLevel + 1].." copper to character "..playerName.." with guid "..playerGUID..".")
|
||||
PreventReturn(playerGUID)
|
||||
playerName = nil
|
||||
playerGUID = nil
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local playerCounterStr
|
||||
local currentLevelStr
|
||||
local currentLevel = oldLevel + 1
|
||||
LUR_playerCounter[currentLevel] = LUR_playerCounter[currentLevel] + 1
|
||||
CharDBExecute('REPLACE INTO `'..Config_customDbName..'`.`levelup_reward` VALUES ('..currentLevel..', '..LUR_playerCounter[currentLevel]..');');
|
||||
playerCounterStr = tostring(LUR_playerCounter[currentLevel])
|
||||
if string.sub(playerCounterStr, -1) == "1" then
|
||||
playerCounterStr = playerCounterStr.."st"
|
||||
elseif string.sub(playerCounterStr, -1) == "2" then
|
||||
playerCounterStr = playerCounterStr.."nd"
|
||||
elseif string.sub(playerCounterStr, -1) == "3" then
|
||||
playerCounterStr = playerCounterStr.."rd"
|
||||
else
|
||||
playerCounterStr = playerCounterStr.."th"
|
||||
end
|
||||
|
||||
currentLevelStr = tostring(currentLevel)
|
||||
if string.sub(currentLevelStr, -1) == "1" then
|
||||
currentLevelStr = currentLevelStr.."st"
|
||||
elseif string.sub(currentLevelStr, -1) == "2" then
|
||||
currentLevelStr = currentLevelStr.."nd"
|
||||
elseif string.sub(currentLevelStr, -1) == "3" then
|
||||
currentLevelStr = currentLevelStr.."rd"
|
||||
else
|
||||
currentLevelStr = currentLevelStr.."th"
|
||||
end
|
||||
|
||||
if Config_mailText == 2 then
|
||||
if Config_ItemId[oldLevel + 1] ~= nil and Config_mailText == 2 then
|
||||
local playerName = player:GetName()
|
||||
local playerGUID = tostring(player:GetGUID())
|
||||
local itemAmount
|
||||
if Config_ItemAmount[oldLevel + 1] ~= nil then
|
||||
itemAmount = Config_ItemAmount[oldLevel + 1]
|
||||
else
|
||||
itemAmount = 1
|
||||
end
|
||||
if Config_Gold[oldLevel + 1] == nil then
|
||||
Config_Gold[oldLevel + 1] = 0
|
||||
end
|
||||
SendMail(Config_mailSubject2, "Hello "..playerName..Config_mailText2A..playerCounterStr..Config_mailText2B..currentLevelStr..Config_mailText2C, playerGUID, Config_senderGUID, Config_mailStationery, 0, Config_Gold[oldLevel + 1],0,Config_ItemId[oldLevel + 1], Config_ItemAmount[oldLevel + 1])
|
||||
print("LevelUpReward has granted "..Config_Gold[oldLevel + 1].." copper and "..Config_ItemAmount[oldLevel + 1].." of item "..Config_ItemId[oldLevel + 1].." to character "..playerName.." with guid "..playerGUID..".")
|
||||
PreventReturn(playerGUID)
|
||||
playerName = nil
|
||||
playerGUID = nil
|
||||
return false
|
||||
elseif Config_Gold[oldLevel + 1] ~= nil and Config_mailText == 2 then
|
||||
local playerName = player:GetName()
|
||||
local playerGUID = tostring(player:GetGUID())
|
||||
SendMail(Config_mailSubject2, "Hello "..playerName..Config_mailText2A..playerCounterStr..Config_mailText2B..currentLevelStr..Config_mailText2C, playerGUID, Config_senderGUID, Config_mailStationery, 0, Config_Gold[oldLevel + 1])
|
||||
print("LevelUpReward has granted "..Config_Gold[oldLevel + 1].." copper to character "..playerName.." with guid "..playerGUID..".")
|
||||
PreventReturn(playerGUID)
|
||||
playerName = nil
|
||||
playerGUID = nil
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RegisterPlayerEvent(PLAYER_EVENT_ON_LEVEL_CHANGE, GrantReward)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
local Patchqwerk = {}
|
||||
local Patchqwerk = {}
|
||||
|
||||
function Patchqwerk.OnSpawn(event, creature)
|
||||
creature:SendUnitYell("Patchqwerk make Lich King proud! You die now!",0)
|
||||
creature:SetMaxHealth(4664000)
|
||||
creature:CastSpell(creature, 41924, true)
|
||||
end
|
||||
|
||||
function Patchqwerk.PoisonBoltVolley(eventId, delay, calls, creature)
|
||||
@@ -20,7 +20,7 @@ end
|
||||
function Patchqwerk.OnEnterCombat(event, creature, target)
|
||||
local yellOptions = { "Patchqwerk huuuuungry!", "Time for a snack!", "You're mine now!", "You look delicious. Patchqwerk eat you now!", "I not eat in days, time to feast!", "Me smash and eat you now!", "Me so hungry, me eat anything... even you!" }
|
||||
local randomIndex = math.random(1, 7)
|
||||
local selectedYell = yellOptions[randomIndex] --script pulls one dialogue option from above upon entering combat.
|
||||
local selectedYell = yellOptions[randomIndex]
|
||||
creature:SendUnitYell(selectedYell, 0)
|
||||
creature:RegisterEvent(Patchqwerk.PoisonBoltVolley, 7000, 0)
|
||||
creature:RegisterEvent(Patchqwerk.CastHatefulStrike, 15000, 0)
|
||||
@@ -28,8 +28,8 @@ creature:RegisterEvent(Patchqwerk.CastGore, 20000, 0)
|
||||
end
|
||||
|
||||
function Patchqwerk.OnLeaveCombat(event, creature)
|
||||
local yellOptions = { "You not so tasty afterall...", "I'll be back for seconds!", "No more play? Too bad...", "Maybe next time you'll taste better!","Me still hungry, come back later!","You not enough food, me go find more!" }
|
||||
local randomIndex = math.random(1, 6)
|
||||
local yellOptions = { "You not so tasty afterall...", "I be back for seconds!", "No more play? Too bad...", "Maybe next time you taste better!","Me still hungry, come back later!","You not enough food, me go find more!", "Awww...You no stay for dinner? You make Patchqwerk sad." }
|
||||
local randomIndex = math.random(1, 7)
|
||||
local selectedYell = yellOptions[randomIndex]
|
||||
creature:SendUnitYell(selectedYell, 0)
|
||||
creature:RemoveEvents()
|
||||
@@ -43,7 +43,19 @@ end
|
||||
creature:RemoveEvents()
|
||||
end
|
||||
|
||||
function Patchqwerk.CheckHealth(event, creature)
|
||||
if (creature:HealthBelowPct(20)) then
|
||||
creature:SendUnitYell("Patchqwerk go berserk!", 0)
|
||||
creature:CastSpell(creature, 41305, true) -- Cast the berserk spell (ID 41305)
|
||||
elseif (creature:HealthAbovePct(95)) then
|
||||
creature:CastSpell(creature, 41924, true) -- Cast the other berserk spell (ID 41924)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterCreatureEvent(400012, 1, Patchqwerk.OnEnterCombat)
|
||||
RegisterCreatureEvent(400012, 2, Patchqwerk.OnLeaveCombat)
|
||||
RegisterCreatureEvent(400012, 4, Patchqwerk.OnDied)
|
||||
RegisterCreatureEvent(400012, 5, Patchqwerk.OnSpawn)
|
||||
RegisterCreatureEvent(400012, 5, Patchqwerk.OnSpawn)
|
||||
RegisterCreatureEvent(400012, 6, Patchqwerk.CheckHealth)
|
||||
|
||||
|
||||
|
||||
11
Unbind.lua
Normal file
11
Unbind.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
local UnbindCommand = {}
|
||||
local MSG_UNBIND = "#unbind"
|
||||
|
||||
local function UnbindInstances(event, player, msg, Type, lang)
|
||||
if (msg:find(MSG_UNBIND)) then
|
||||
player:UnbindAllInstances()
|
||||
player:SendBroadcastMessage("All instances unbound.")
|
||||
end
|
||||
end
|
||||
|
||||
RegisterPlayerEvent(18, UnbindInstances)
|
||||
Reference in New Issue
Block a user