added Honorable Defender buff for Alterac Valley nodes + bosses + captains

--HG--
branch : trunk
This commit is contained in:
Rat
2010-05-12 21:34:07 +02:00
parent 8a60550d9d
commit 8dfbb15b2a
2 changed files with 116 additions and 4 deletions
+71 -1
View File
@@ -64,12 +64,24 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 entry = unit->GetEntry();
/*
uint32 triggerSpawnID = 0;
if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
triggerSpawnID = AV_CPLACE_TRIGGER16;
else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
triggerSpawnID = AV_CPLACE_TRIGGER17;
else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0])
triggerSpawnID = AV_CPLACE_TRIGGER18;
else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0])
triggerSpawnID = AV_CPLACE_TRIGGER19;
*/
if (entry == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
{
CastSpellOnTeam(23658,HORDE); //this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(729,BG_AV_REP_BOSS,HORDE);
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS),HORDE);
EndBattleGround(HORDE);
DelCreature(AV_CPLACE_TRIGGER17);
}
else if (entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0])
{
@@ -77,6 +89,7 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
RewardReputationToTeam(730,BG_AV_REP_BOSS,ALLIANCE);
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS),ALLIANCE);
EndBattleGround(ALLIANCE);
DelCreature(AV_CPLACE_TRIGGER19);
}
else if (entry == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
{
@@ -95,7 +108,7 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if (creature)
YellToAll(creature,GetTrinityString(LANG_BG_AV_A_CAPTAIN_DEAD),LANG_UNIVERSAL);
DelCreature(AV_CPLACE_TRIGGER16);
}
else if (entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0])
{
@@ -114,6 +127,7 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if (creature)
YellToAll(creature,GetTrinityString(LANG_BG_AV_H_CAPTAIN_DEAD),LANG_UNIVERSAL);
DelCreature(AV_CPLACE_TRIGGER18);
}
else if (entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_H_4][0])
ChangeMineOwner(AV_NORTH_MINE,killer->GetTeam());
@@ -292,6 +306,38 @@ Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
if (level != 0)
level += m_MaxLevel - 60; //maybe we can do this more generic for custom level-range.. actually it's blizzlike
creature->SetLevel(level);
uint32 triggerSpawnID = 0;
uint32 newFaction = 0;
if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
{
triggerSpawnID = AV_CPLACE_TRIGGER16;
newFaction = 84;
}
else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0])
{
triggerSpawnID = AV_CPLACE_TRIGGER17;
newFaction = 84;
}
else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0])
{
triggerSpawnID = AV_CPLACE_TRIGGER18;
newFaction = 83;
}
else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0])
{
triggerSpawnID = AV_CPLACE_TRIGGER19;
newFaction = 83;
}
if (triggerSpawnID && newFaction)
{
if (Creature* trigger = AddCreature(WORLD_TRIGGER,triggerSpawnID,BG_AV_CreatureInfo[creature->GetEntry()][1],BG_AV_CreaturePos[triggerSpawnID][0],BG_AV_CreaturePos[triggerSpawnID][1],BG_AV_CreaturePos[triggerSpawnID][2],BG_AV_CreaturePos[triggerSpawnID][3]))
{
trigger->setFaction(newFaction);
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
}
}
return creature;
}
@@ -709,6 +755,26 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
}
for (uint8 i=0; i<4; i++)
AddAVCreature(creatureid,c_place+i);
if (node >= BG_AV_NODES_MAX)//fail safe
return;
Creature* trigger = GetBGCreature(node + 302);//0-302 other creatures
if (!trigger)
trigger = AddCreature(WORLD_TRIGGER,node + 302,owner,BG_AV_CreaturePos[node + 302][0],BG_AV_CreaturePos[node + 302][1],BG_AV_CreaturePos[node + 302][2],BG_AV_CreaturePos[node + 302][3]);
//add bonus honor aura trigger creature when node is accupied
//cast bonus aura (+50% honor in 25yards)
//aura should only apply to players who have accupied the node, set correct faction for trigger
if (trigger)
{
if (owner != ALLIANCE && owner != HORDE)//node can be neutral, remove trigger
{
DelCreature(node + 302);
return;
}
trigger->setFaction(owner == ALLIANCE ? 84 : 83);
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
}
}
void BattleGroundAV::DePopulateNode(BG_AV_Nodes node)
{
@@ -719,6 +785,10 @@ void BattleGroundAV::DePopulateNode(BG_AV_Nodes node)
//spiritguide
if (!IsTower(node) && m_BgCreatures[node])
DelCreature(node);
//remove bonus honor aura trigger creature when node is lost
if(node < BG_AV_NODES_MAX)//fail safe
DelCreature(node + 302);//NULL checks are in DelCreature! 0-302 spirit guides
}
const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object)