Hello. In this patch many places with same code like this function:
bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger)
{
switch(trigger)
{
case SI_AREATRIGGER_A:
if(plr->GetTeam() == ALLIANCE && plr->HasAura(SI_SILITHYST_FLAG,0))
{
// remove aura
plr->RemoveAurasDueToSpell(SI_SILITHYST_FLAG);
++ m_Gathered_A;
if(m_Gathered_A >= SI_MAX_RESOURCES)
{
BuffTeam(ALLIANCE);
sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetMangosString(LANG_OPVP_SI_CAPTURE_A,-1));
m_LastController = ALLIANCE;
m_Gathered_A = 0;
m_Gathered_H = 0;
}
UpdateWorldState();
// reward player
plr->CastSpell(plr,SI_TRACES_OF_SILITHYST,true);
// add 19 honor
plr->RewardHonor(NULL,1,19);
// add 20 cenarion circle repus
plr->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
// complete quest
plr->KilledMonster(SI_TURNIN_QUEST_CM_A,0);
}
return true;
case SI_AREATRIGGER_H:
if(plr->GetTeam() == HORDE && plr->HasAura(SI_SILITHYST_FLAG,0))
{
// remove aura
plr->RemoveAurasDueToSpell(SI_SILITHYST_FLAG);
++ m_Gathered_H;
if(m_Gathered_H >= SI_MAX_RESOURCES)
{
BuffTeam(HORDE);
sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetMangosString(LANG_OPVP_SI_CAPTURE_H,-1));
m_LastController = HORDE;
m_Gathered_A = 0;
m_Gathered_H = 0;
}
UpdateWorldState();
// reward player
plr->CastSpell(plr,SI_TRACES_OF_SILITHYST,true);
// add 19 honor
plr->RewardHonor(NULL,1,19);
// add 20 cenarion circle repu
plr->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
// complete quest
plr->KilledMonster(SI_TURNIN_QUEST_CM_H,0);
}
return true;
}
return false;
}
Maybe better something like this (cause smaller)? :
bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger)
{
if(!trigger)
return false;
if(plr->GetTeam() && plr->HasAura(SI_SILITHYST_FLAG,0))
{
// remove aura
plr->RemoveAurasDueToSpell(SI_SILITHYST_FLAG);
plr->GetTeam() == ALLIANCE ? ++m_Gathered_A : ++m_Gathered_H;
if(m_Gathered_A >= SI_MAX_RESOURCES || m_Gathered_H >= SI_MAX_RESOURCES)
{
BuffTeam(plr->GetTeam());
sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetMangosString((plr->GetTeam() == ALLIANCE) ? LANG_OPVP_SI_CAPTURE_A : LANG_OPVP_SI_CAPTURE_H, -1));
m_LastController = plr->GetTeam();
m_Gathered_A = 0;
m_Gathered_H = 0;
}
UpdateWorldState();
// reward player
plr->CastSpell(plr,SI_TRACES_OF_SILITHYST,true);
// add 19 honor
plr->RewardHonor(NULL,1,19);
// add 20 cenarion circle repus
plr->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(609), 20);
// complete quest
plr->KilledMonster((plr->GetTeam() == ALLIANCE) ? SI_TURNIN_QUEST_CM_A : SI_TURNIN_QUEST_CM_H,0);
return true;
}
return false;
}