Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Double H Release --
- --( __ \ ( ___ )|\ /|( ___ \ ( \ ( ____ \ |\ /| ( ____ )( ____ \( \ ( ____ \( ___ )( ____ \( ____ \--
- --| ( \ )| ( ) || ) ( || ( ) )| ( | ( \/ | ) ( | | ( )|| ( \/| ( | ( \/| ( ) || ( \/| ( \/--
- --| | ) || | | || | | || (__/ / | | | (__ _____ | (___) | _____ | (____)|| (__ | | | (__ | (___) || (_____ | (__ --
- --| | | || | | || | | || __ ( | | | __) (_____)| ___ |(_____) | __)| __) | | | __) | ___ |(_____ )| __) --
- --| | ) || | | || | | || ( \ \ | | | ( | ( ) | | (\ ( | ( | | | ( | ( ) | ) || ( --
- --| (__/ )| (___) || (___) || )___) )| (____/\| (____/\ | ) ( | | ) \ \__| (____/\| (____/\| (____/\| ) ( |/\____) || (____/\--
- --(______/ (_______)(_______)|/ \___/ (_______/(_______/ |/ \| |/ \__/(_______/(_______/(_______/|/ \|\_______)(_______/--
- -- Mercenary Selection System --
- -- Double H Release --
- --Sweet HH logo here--
- --//////////////////////--|
- --Standard Configuration |
- --\\\\\\\\\\\\\\\\\\\\\\--|
- local MAX_MERC = 3 --The allowed number of Mercenaries to hire
- local MAX_OFFICER = 1 --The allowed number of Officers to hire
- local GOLD_COST = 1500000 --The amount of gold required to hire mercenaries in copper value.
- --===========================---
- --Creature AI Default Settings--
- --===========================---
- local WARRIOR_ENTRY = 48281
- local MEDIC_ENTRY = 48286
- -- Warrior Settings (1 = Starting Fight Style, you can only enable one default style to start in.
- -- If you attempt to activate more then one style via cofigs, the standard style will automatically apply itself. (1=balance, 2=defensive, 3=offensive)
- local DEFAULT_WARRIOR_STYLE = 1
- -- Priest Settings (1 = Starting Fight Style, you can only enable one default style to start in. All others will default to 0.
- -- If you attempt to activate more then one style via cofigs, the standard style will automatically apply itself. (1=heals, 2=damage)
- local DEFAULT_MEDIC_STYLE = 1
- --++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
- -- DO NOT EDIT BELOW --
- --++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
- OLDSTRAT = {}
- OLDSTRAT.WARRIOR = {}
- OLDSTRAT.HEALER = {}
- function hasMerc(player, pUnit)
- for i,v in ipairs(OLDSTRAT[tostring(player)].mercs) do --wrong here
- if (tostring(v) == tostring(pUnit)) then
- return true
- end
- end
- return false
- end
- function OLDSTRAT.HookPlayerDeath(event, player)
- if (OLDSTRAT[tostring(player)] == nil) then return; end --don't even bother with this func if no mercs.
- if (OLDSTRAT[tostring(player)].mercs == nil) then return; end
- for i,v in ipairs(OLDSTRAT[tostring(player)].mercs) do
- v:Despawn(1, 60000)
- table.remove(OLDSTRAT[tostring(player)].mercs, i)
- break
- end
- OLDSTRAT[tostring(player)] = nil
- end
- RegisterServerHook(6, "OLDSTRAT.HookPlayerDeath")
- function OLDSTRAT.LeaveCombat(pUnit, event)
- pUnit:SetUInt32Value(0x52, 1) --UNIT_NPC_FLAGS
- pUnit:RemoveEvents()
- pUnit:SetUnitToFollow(OLDSTRAT[tostring(pUnit)].owner, math.random(1,8), 1)
- end
- RegisterUnitEvent(WARRIOR_ENTRY, 2, "OLDSTRAT.LeaveCombat")
- RegisterUnitEvent(MEDIC_ENTRY, 2, "OLDSTRAT.LeaveCombat")
- function OLDSTRAT.OnDied(pUnit, event)
- local player = tostring(OLDSTRAT[tostring(pUnit)].owner)
- for i,v in ipairs(OLDSTRAT[player].mercs) do
- if (tostring(v) == tostring(pUnit)) then
- table.remove(OLDSTRAT[player].mercs, i)
- break
- end
- end
- if ( #(OLDSTRAT[player].mercs) == 0 ) then --no more mercs
- OLDSTRAT[player] = nil
- end
- end
- RegisterUnitEvent(WARRIOR_ENTRY, 4, "OLDSTRAT.OnDied")
- RegisterUnitEvent(MEDIC_ENTRY, 4, "OLDSTRAT.OnDied")
- function OLDSTRAT.WARRIOR.Speak1(pUnit, event, player)
- if (OLDSTRAT[tostring(player)] == nil) then
- pUnit:GossipCreateMenu(50020, player, 0)
- pUnit:GossipMenuAddItem(0, "I see. I accept your offer.", 1, 0)
- pUnit:GossipMenuAddItem(0, "I do not need you now, Mercenary.", 3, 0)
- pUnit:GossipSendMenu(player)
- elseif (#(OLDSTRAT[tostring(player)].mercs) < MAX_MERC) and (hasMerc(player, pUnit) == false) then
- pUnit:GossipCreateMenu(50020, player, 0)
- pUnit:GossipMenuAddItem(0, "I see. I accept your offer.", 1, 0)
- pUnit:GossipMenuAddItem(0, "I do not need you now, Mercenary.", 3, 0)
- pUnit:GossipSendMenu(player)
- elseif (hasMerc(player, pUnit) == true) then
- pUnit:GossipCreateMenu(50022, player, 0)
- pUnit:GossipMenuAddItem(0, "Focus more on defense right now.", 10, 0)
- pUnit:GossipMenuAddItem(0, "Use a more balance fight style right now.", 11, 0)
- pUnit:GossipMenuAddItem(0, "Go into a more aggressive fight style for now.", 12, 0)
- pUnit:GossipSendMenu(player)
- else
- pUnit:GossipCreateMenu(50021, player, 0)
- pUnit:GossipSendMenu(player)
- end
- end
- function OLDSTRAT.HEALER.Speak1(pUnit, event, player)
- if (OLDSTRAT[tostring(player)] == nil) then
- pUnit:GossipCreateMenu(50020, player, 0)
- pUnit:GossipMenuAddItem(0, "I see. I accept your offer.", 2, 0)
- pUnit:GossipMenuAddItem(0, "I do not need you now, Mercenary.", 3, 0)
- pUnit:GossipSendMenu(player)
- elseif (#(OLDSTRAT[tostring(player)].mercs) < MAX_MERC) and (hasMerc(player, pUnit) == false) then
- pUnit:GossipCreateMenu(50020, player, 0)
- pUnit:GossipMenuAddItem(0, "I see. I accept your offer.", 2, 0)
- pUnit:GossipMenuAddItem(0, "I do not need you now, Mercenary.", 3, 0)
- pUnit:GossipSendMenu(player)
- elseif (hasMerc(player, pUnit) == true) then
- pUnit:GossipCreateMenu(50022, player, 0)
- pUnit:GossipMenuAddItem(0, "Focus more on support right now.", 20, 0)
- pUnit:GossipMenuAddItem(0, "Use a heavy damage based style for now.", 21, 0)
- pUnit:GossipSendMenu(player)
- else
- pUnit:GossipCreateMenu(50021, player, 0)
- pUnit:GossipSendMenu(player)
- end
- end
- function OLDSTRAT.WARRIOR.Selection1(pUnit, event, player, id, intid, code)
- if (intid == 1) then
- if (player:GetCoinage() < GOLD_COST) then
- pUnit:SendChatMessage(12, 0, "I apologize, "..player:GetName().." but you do not have the amount of money I require.")
- player:GossipComplete()
- else
- if (OLDSTRAT[tostring(player)] == nil) then OLDSTRAT[tostring(player)] = {}; end
- if (OLDSTRAT[tostring(player)].mercs == nil) then OLDSTRAT[tostring(player)].mercs = {}; end
- table.insert(OLDSTRAT[tostring(player)].mercs, pUnit)
- OLDSTRAT[tostring(pUnit)] = {}
- OLDSTRAT[tostring(pUnit)].owner = player
- pUnit:SetFaction(player:GetFaction())
- pUnit:SendChatMessage(12, 0, "Excellent, I look forward to working with you, "..player:GetName()..".")
- OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE = DEFAULT_WARRIOR_STYLE
- pUnit:SetUnitToFollow(player, math.random(1,8), 1)
- player:DealGoldCost(GOLD_COST)
- player:GossipComplete()
- end
- end
- if (intid == 3) then
- player:GossipComplete()
- end
- -- Warrior Segment Playstyle --
- if (intid == 10) then --Defensive Style
- pUnit:CastSpell(71)
- OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE = 2
- pUnit:SendChatMessage(12, 0, "Well, Tank mode it is then.")
- pUnit:EquipWeapons(45110, 40700, 0)
- player:GossipComplete()
- end
- if (intid == 11) then --Balance Style
- pUnit:CastSpell(2457)
- OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE = 1
- pUnit:SendChatMessage(12, 0, "Very well I shall fight in a mixed style.")
- pUnit:EquipWeapons(45165, 0, 0)
- player:GossipComplete()
- end
- if (intid == 12) then --Agressive Style
- pUnit:CastSpell(2458)
- OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE = 3
- pUnit:SendChatMessage(12, 0, "Hmm, this should be entertaining, I will be taking more damage, just so you know.")
- pUnit:EquipWeapons(46016, 46016, 0)
- player:GossipComplete()
- end
- end
- function OLDSTRAT.HEALER.Selection1(pUnit, event, player, id, intid, code)
- if (intid == 2) then
- if (player:GetCoinage() < GOLD_COST) then
- pUnit:SendChatMessage(12, 0, "I apologize, "..player:GetName().." but you do not have the amount of money I require.")
- player:GossipComplete()
- else
- if (OLDSTRAT[tostring(player)] == nil) then OLDSTRAT[tostring(player)] = {}; end
- if (OLDSTRAT[tostring(player)].mercs == nil) then OLDSTRAT[tostring(player)].mercs = {}; end
- table.insert(OLDSTRAT[tostring(player)].mercs, pUnit)
- OLDSTRAT[tostring(pUnit)] = {}
- OLDSTRAT[tostring(pUnit)].owner = player
- pUnit:SetFaction(player:GetFaction())
- pUnit:SendChatMessage(12, 0, "Excellent, I look forward to working with you, "..player:GetName()..".")
- OLDSTRAT[tostring(pUnit)].MEDIC_STYLE = DEFAULT_MEDIC_STYLE
- pUnit:SetUnitToFollow(player, math.random(2,4), math.random(1, 6))
- player:DealGoldCost(GOLD_COST)
- player:GossipComplete()
- end
- end
- if (intid == 3) then
- player:GossipComplete()
- end
- -- Priest Segment Playstyle --
- if (intid == 20) then --Support Style
- OLDSTRAT[tostring(pUnit)].MEDIC_STYLE = 1
- pUnit:RemoveAura(35194)
- pUnit:SendChatMessage(12, 0, "Oh well back to the heals.")
- player:GossipComplete()
- end
- if (intid == 21) then --Damage Style
- OLDSTRAT[tostring(pUnit)].MEDIC_STYLE = 2
- pUnit:CastSpell(35194)
- pUnit:SendChatMessage(12, 0, "Time for some fun.")
- player:GossipComplete()
- end
- end
- RegisterUnitGossipEvent(WARRIOR_ENTRY, 1, "OLDSTRAT.WARRIOR.Speak1")
- RegisterUnitGossipEvent(WARRIOR_ENTRY, 2, "OLDSTRAT.WARRIOR.Selection1")
- RegisterUnitGossipEvent(MEDIC_ENTRY, 1, "OLDSTRAT.HEALER.Speak1")
- RegisterUnitGossipEvent(MEDIC_ENTRY, 2, "OLDSTRAT.HEALER.Selection1")
- --===============================================================================================--
- -- COMBAT HANDLER FOR STANDARD WARRIORS --
- --===============================================================================================--
- --Balance Style
- local THUNDER_CLAP = 58975
- local STANDARD_CLEAVE = 30619
- local DEMORAL_SHOUT = 29584
- local MORTAL_STRIKE = 19643
- local RETALIATION = 22857
- --Defensive Style
- local SUNDER_ARMOR = 27991
- local SHIELD_BASH = 41180
- local SHIELD_WALL = 29390
- local DISARM = 30013
- local TAUNT = 37486
- --Aggressive Style
- local BLADESTORM = 63784
- local RECKLESSNESS = 13847
- local SLICE_STRIKES = 30470
- local SLAM = 52026
- local REND = 29574
- local Warrior_Balance = {THUNDER_CLAP, STANDARD_CLEAVE, DEMORAL_SHOUT, MORTAL_STRIKE, RETALIATION}
- local Warrior_Defensive = {SUNDER_ARMOR, SHIELD_BASH, SHIELD_WALL, DISARM, TAUNT}
- local Warrior_Aggressive = {BLADESTORM, RECKLESSNESS, SLICE_STRIKES, SLAM, REND}
- local Warrior_Taunts = {"This ends now!", "You stand no match against my blade!", "I fear no death!", "For the city of Stratholme!", "Your insolence amuses me.",
- "I grow tired of these games!", "Is this truly my entertainment?", "Your blood shall quench my blade!", "Death fears me!", "Fun time!"}
- function OLDSTRAT.WARRIOR.OnAggro1(pUnit, event)
- pUnit:SetUInt32Value(0x52, 0) --UNIT_NPC_FLAGS
- local speechCheck = math.random(1, 100)
- if (speechCheck <= 32) then
- local yellSay = math.random(1, 2)
- if yellSay == 1 then
- yellSay = 12
- else
- yellSay = 14
- end
- local i = math.random(1, 10)
- pUnit:SendChatMessage(yellSay, 0, Warrior_Taunts[i])
- pUnit:RegisterEvent("OLDSTRAT.WARRIOR.Select1", 7000, 0)
- end
- end
- function OLDSTRAT.WARRIOR.Select1(pUnit, event)
- if (OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE == 1) then
- OLDSTRAT.WARRIOR.Balance1(pUnit, event)
- elseif (OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE == 2) then
- OLDSTRAT.WARRIOR.Defensive1(pUnit, event)
- elseif (OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE == 3) then
- OLDSTRAT.WARRIOR.Aggressive1(pUnit, event)
- end
- end
- function OLDSTRAT.WARRIOR.Balance1(pUnit, event)
- local target = pUnit:GetMainTank()
- local useAbilityB = math.random(1, 10)
- if (useAbilityB <= 8) then
- local b = math.random(1, 5)
- if (b ~= 3) and (b ~= 5) then
- pUnit:FullCastSpellOnTarget(Warrior_Balance[b], target)
- else
- pUnit:CastSpell(Warrior_Balance[b])
- end
- end
- end
- function OLDSTRAT.WARRIOR.Defensive1(pUnit, event)
- local target = pUnit:GetMainTank()
- local useAbilityD = math.random(1, 10)
- if (useAbilityD <= 8) then
- local d = math.random(1, 5)
- if (d ~= 3) then
- pUnit:FullCastSpellOnTarget(Warrior_Defensive[d], target)
- else
- pUnit:CastSpell(Warrior_Defensive[d])
- end
- end
- end
- function OLDSTRAT.WARRIOR.Aggressive1(pUnit, event)
- local target = pUnit:GetMainTank()
- local useAbilityA = math.random(1, 10)
- if (useAbilityA <= 8) then
- local a = math.random(1, 5)
- if (a ~= 2) and (a ~= 3) then
- pUnit:FullCastSpellOnTarget(Warrior_Aggressive[a], target)
- else
- pUnit:CastSpell(Warrior_Aggressive[a])
- end
- end
- end
- RegisterUnitEvent(WARRIOR_ENTRY, 1, "OLDSTRAT.WARRIOR.OnAggro1")
- --===============================================================================================--
- -- COMBAT HANDLER FOR STANDARD HEALERS --
- --===============================================================================================--
- local Medic_Taunts = {"Oh well, another battle to fight.", "Always wtith the fighting and then me with the healing.", "This should be a fun sight.", "For the city of Stratholme!",
- "I get no respect whatsoever.", "Is this truly my entertainment?"}
- --Healing Style
- local SHIELD = 30619
- local HOLY_LIGHT = 32769
- local CHAIN_HEAL = 42477
- local RESURRECTION = 48171
- --Shadow Style
- local MIND_BLAST = 60500
- local MIND_FLAY = 28310
- local WORD_DEATH = 41375
- local Medic_Healing = {SHIELD, HOLY_LIGHT, CHAIN_HEAL}
- local Medic_Shadow = {MIND_BLAST, MIND_FLAY, WORD_DEATH}
- function OLDSTRAT.HEALER.OnAggro1(pUnit, event)
- pUnit:SetUInt32Value(0x52, 0) --UNIT_NPC_FLAGS
- local speechCheck = math.random(1, 100)
- if (speechCheck <= 32) then
- local yellSay = math.random(1, 2)
- if yellSay == 1 then
- yellSay = 12
- else
- yellSay = 14
- end
- local i = math.random(1, 6)
- pUnit:SendChatMessage(yellSay, 0, Medic_Taunts[i])
- pUnit:RegisterEvent("OLDSTRAT.HEALER.Select1", 8000, 0)
- end
- end
- function OLDSTRAT.HEALER.Select1(pUnit)
- if (OLDSTRAT[tostring(pUnit)].MEDIC_STYLE == 1) then
- OLDSTRAT.HEALER.Healing1(pUnit)
- elseif (OLDSTRAT[tostring(pUnit)].MEDIC_STYLE == 2) then
- OLDSTRAT.HEALER.Shadow1(pUnit)
- end
- end
- function OLDSTRAT.HEALER.Healing1(pUnit)
- local target = pUnit:GetRandomFriend()
- local useAbilityH = math.random(1, 10)
- if (useAbilityH <= 8) then
- local h = math.random(1, 3)
- if (h ~= 2) then
- pUnit:FullCastSpellOnTarget(Medic_Healing[h], target)
- else
- local Friend = pUnit:GetRandomFriend()
- local hpCheckP = OLDSTRAT[tostring(pUnit)].owner:GetHealthPct()
- local hpCheckU = Friend:GetHealthPct()
- if (hpCheckP < hpCheckU) then
- pUnit:FullCastSpellOnTarget(Medic_Healing[h], OLDSTRAT[tostring(pUnit)].owner)
- else
- if (Friend:IsPlayer() == true) then
- OLDSTRAT.HEALER.Retarget1(pUnit)
- end
- end
- end
- end
- end
- function OLDSTRAT.HEALER.Retarget1(pUnit)
- local Friend = pUnit:GetRandomFriend()
- if (Friend:IsPlayer() == true) then
- OLDSTRAT.HEALER.Retarget1(pUnit)
- else
- pUnit:FullCastSpellOnTarget(Medic_Healing[2], Friend)
- end
- end
- function OLDSTRAT.HEALER.Shadow1(pUnit)
- local target = pUnit:GetMainTank()
- local useAbilityS = math.random(1, 10)
- if (useAbilityS <= 8) then
- local s = math.random(1, 5)
- pUnit:FullCastSpellOnTarget(Medic_Shadow[s], target)
- end
- end
- RegisterUnitEvent(MEDIC_ENTRY, 1, "OLDSTRAT.HEALER.OnAggro1")
- -- TODO: Officers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement