Merge pull request #6490 from Vincent-Michael/notEvenAScratch

Battleground/Strand of the Ancients: Fix Achievement: Not Even a Scratch
This commit is contained in:
Subv
2012-07-01 14:10:36 -07:00
4 changed files with 42 additions and 7 deletions

View File

@@ -0,0 +1,6 @@
DELETE FROM `disables` WHERE `entry` IN (7626,7634) AND `sourceType`=4;
DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (7626,7634);
INSERT INTO `achievement_criteria_data` (`criteria_id`, `type`, `value1`, `value2`, `ScriptName`) VALUES
(7626, 11, 0, 0, 'achievement_not_even_a_scratch'),
(7634, 11, 0, 0, 'achievement_not_even_a_scratch');

View File

@@ -56,6 +56,8 @@ void BattlegroundSA::Reset()
GateStatus[i] = BG_SA_GATE_OK;
ShipsStarted = false;
gateDestroyed = false;
_notEvenAScratch[BG_TEAM_ALLIANCE] = true;
_notEvenAScratch[BG_TEAM_HORDE] = true;
Status = BG_SA_WARMUP;
}
@@ -553,13 +555,13 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui
SendWarningToAll(LANG_BG_SA_IS_UNDER_ATTACK, go->GetGOInfo()->name.c_str());
}
void BattlegroundSA::HandleKillUnit(Creature* unit, Player* killer)
void BattlegroundSA::HandleKillUnit(Creature* creature, Player* killer)
{
if (!unit)
return;
if (unit->GetEntry() == NPC_DEMOLISHER_SA)
if (creature->GetEntry() == NPC_DEMOLISHER_SA)
{
UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1);
_notEvenAScratch[Attackers] = false;
}
}
/*

View File

@@ -456,7 +456,7 @@ class BattlegroundSA : public Battleground
/// Called when a player deal damage to building (door)
virtual void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType);
/// Called when a player kill a unit in bg
virtual void HandleKillUnit(Creature* unit, Player* killer);
virtual void HandleKillUnit(Creature* creature, Player* killer);
/// Return the nearest graveyard where player can respawn
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/// Called when a player click on flag (graveyard flag)
@@ -531,9 +531,12 @@ class BattlegroundSA : public Battleground
/// Update score board
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
// Achievement Defense of the Ancients
// Achievement: Defense of the Ancients
bool gateDestroyed;
// Achievement: Not Even a Scratch
bool notEvenAScratch(uint32 team) const { return _notEvenAScratch[GetTeamIndexByTeamId(team)]; }
/// Id of attacker team
TeamId Attackers;
@@ -615,5 +618,7 @@ class BattlegroundSA : public Battleground
bool InitSecondRound;
std::map<uint32/*id*/, uint32/*timer*/> DemoliserRespawnList;
// Achievement: Not Even a Scratch
bool _notEvenAScratch[BG_TEAMS_COUNT];
};
#endif

View File

@@ -313,6 +313,27 @@ class achievement_tilted : public AchievementCriteriaScript
}
};
class achievement_not_even_a_scratch : public AchievementCriteriaScript
{
public:
achievement_not_even_a_scratch() : AchievementCriteriaScript("achievement_not_even_a_scratch") { }
bool OnCheck(Player* source, Unit* /*target*/)
{
if (!source)
return false;
Battleground* battleground = source->GetBattleground();
if (!battleground)
return false;
if (static_cast<BattlegroundSA*>(battleground)->notEvenAScratch(source->GetTeam()))
return true;
return false;
}
};
void AddSC_achievement_scripts()
{
new achievement_resilient_victory();
@@ -331,4 +352,5 @@ void AddSC_achievement_scripts()
new achievement_arena_kills("achievement_arena_5v5_kills", ARENA_TYPE_5v5);
new achievement_bg_sa_defense_of_ancients();
new achievement_tilted();
new achievement_not_even_a_scratch();
}