Core/Quests: Fixed remaining issues with quest crediting (note: previous commits did not introduce issues, only revealed them)

Core/DBLayer: Fixed more compile warnings
Core/Spells: Corrected code style from revision 634af79146

Closes issue #3956.

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-09-12 19:17:58 +02:00
parent 976cc3f8c4
commit e0ffae436c
9 changed files with 33 additions and 28 deletions

View File

@@ -697,13 +697,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
case ACTION_T_KILLED_MONSTER:
//first attempt player who tapped creature
if (Player* pPlayer = me->GetLootRecipient())
pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, me);
pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, pPlayer); // pPlayer as param is a hacky solution not to use GUID
else
{
//if not available, use pActionInvoker
if (Unit* pTarget = GetTargetByType(action.killed_monster.target, pActionInvoker))
if (Player* pPlayer2 = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
pPlayer2->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, me);
pPlayer2->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, pPlayer);
}
break;
case ACTION_T_SET_INST_DATA:

View File

@@ -16117,12 +16117,12 @@ void Unit::SetAuraStack(uint32 spellId, Unit *target, uint32 stack)
aura->SetStackAmount(stack);
}
void Unit::ApplyResilience(const Unit * pVictim, float * crit, int32 * damage, bool isCrit, CombatRating type) const
void Unit::ApplyResilience(const Unit *pVictim, float *crit, int32 *damage, bool isCrit, CombatRating type) const
{
if (IsVehicle() || pVictim->IsVehicle())
return;
const Unit * source = ToPlayer();
const Unit *source = ToPlayer();
if (!source)
{
source = ToCreature();
@@ -16134,7 +16134,7 @@ void Unit::ApplyResilience(const Unit * pVictim, float * crit, int32 * damage, b
}
}
const Unit * target = pVictim->ToPlayer();
const Unit *target = pVictim->ToPlayer();
if (!target)
{
target = pVictim->ToCreature();
@@ -16145,6 +16145,7 @@ void Unit::ApplyResilience(const Unit * pVictim, float * crit, int32 * damage, b
target = target->ToPlayer();
}
}
if (!target)
return;
@@ -16152,29 +16153,35 @@ void Unit::ApplyResilience(const Unit * pVictim, float * crit, int32 * damage, b
{
case CR_CRIT_TAKEN_MELEE:
// Crit chance reduction works against nonpets
if (crit) (*crit) -= target->ToPlayer()->GetMeleeCritChanceReduction();
if (crit)
*crit -= target->ToPlayer()->GetMeleeCritChanceReduction();
if (source && damage)
{
if (isCrit) (*damage) -= target->ToPlayer()->GetMeleeCritDamageReduction((*damage));
(*damage) -= target->ToPlayer()->GetMeleeDamageReduction((*damage));
if (isCrit)
*damage -= target->ToPlayer()->GetMeleeCritDamageReduction(*damage);
*damage -= target->ToPlayer()->GetMeleeDamageReduction(*damage);
}
break;
case CR_CRIT_TAKEN_RANGED:
// Crit chance reduction works against nonpets
if (crit) (*crit) -= target->ToPlayer()->GetRangedCritChanceReduction();
if (crit)
*crit -= target->ToPlayer()->GetRangedCritChanceReduction();
if (source && damage)
{
if (isCrit) (*damage) -= target->ToPlayer()->GetRangedCritDamageReduction((*damage));
(*damage) -= target->ToPlayer()->GetRangedDamageReduction((*damage));
if (isCrit)
*damage -= target->ToPlayer()->GetRangedCritDamageReduction(*damage);
*damage -= target->ToPlayer()->GetRangedDamageReduction(*damage);
}
break;
case CR_CRIT_TAKEN_SPELL:
// Crit chance reduction works against nonpets
if (crit) (*crit) -= target->ToPlayer()->GetSpellCritChanceReduction();
if (crit)
*crit -= target->ToPlayer()->GetSpellCritChanceReduction();
if (source && damage)
{
if (isCrit) (*damage) -= target->ToPlayer()->GetSpellCritDamageReduction((*damage));
(*damage) -= target->ToPlayer()->GetSpellDamageReduction((*damage));
if (isCrit)
*damage -= target->ToPlayer()->GetSpellCritDamageReduction(*damage);
*damage -= target->ToPlayer()->GetSpellDamageReduction(*damage);
}
break;
default:

View File

@@ -763,10 +763,8 @@ public:
if (owner->GetTypeId() == TYPEID_PLAYER)
{
if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE)
{
//CAST_CRE(who)->CastSpell(owner, 52517, true);
CAST_PLR(owner)->KilledMonsterCredit(GHOULS, me->GetGUID());
}
CAST_CRE(who)->CastSpell(owner, 52517, true);
//Todo: Creatures must not be removed, but, must instead
// stand next to Gothik and be commanded into the pit
// and dig into the ground.

View File

@@ -166,7 +166,7 @@ public:
case GOSSIP_ACTION_INFO_DEF + 6:
pPlayer->SEND_GOSSIP_MENU(7761, pCreature->GetGUID());
//'kill' our trigger to update quest status
pPlayer->KilledMonsterCredit(TRIGGER_RUTGAR, pCreature->GetGUID());
pPlayer->KilledMonsterCredit(TRIGGER_RUTGAR, 0);
break;
case GOSSIP_ACTION_INFO_DEF + 9:
@@ -192,7 +192,7 @@ public:
case GOSSIP_ACTION_INFO_DEF + 14:
pPlayer->SEND_GOSSIP_MENU(7767, pCreature->GetGUID());
//'kill' our trigger to update quest status
pPlayer->KilledMonsterCredit(TRIGGER_FRANKAL, pCreature->GetGUID());
pPlayer->KilledMonsterCredit(TRIGGER_FRANKAL, 0);
break;
}
return true;

View File

@@ -151,7 +151,7 @@ public:
if (Player* pPlr = Unit::GetPlayer(*me, uiPlayerGUID))
{
pPlr->KilledMonsterCredit(NPC_EVENT_PINGER, me->GetGUID());
pPlr->KilledMonsterCredit(NPC_EVENT_PINGER, 0);
if (GameObject* pGo = pPlr->FindNearestGameObject(GO_CARCASS, 10))
pGo->Delete();
@@ -395,7 +395,7 @@ public:
{
Player* plr = Unit::GetPlayer(*me, PlayerGUID);
if (plr && plr->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE)
plr->KilledMonsterCredit(23209, me->GetGUID());
plr->KilledMonsterCredit(23209, 0);
}
PoisonTimer = 0;
me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);

View File

@@ -319,7 +319,7 @@ public:
if (rand()%100 < 25)
{
me->SummonCreature(QUEST_TARGET, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
CAST_PLR(Killer)->KilledMonsterCredit(QUEST_TARGET, me->GetGUID());
CAST_PLR(Killer)->KilledMonsterCredit(QUEST_TARGET, 0);
}
else
me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);

View File

@@ -361,7 +361,7 @@ public:
if(Creature* pTarget = GetHitCreature())
{
pPlayer->CastSpell(pPlayer, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, NULL);
pPlayer->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, pTarget->GetGUID());
pPlayer->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, 0);
pTarget->ForcedDespawn();
}
}

View File

@@ -105,7 +105,7 @@ enum Field::DataTypes ResultSet::ConvertNativeType(enum_field_types mysqlType) c
}
}
void ResultBind::BindResult(uint32& num_rows)
void ResultBind::BindResult(uint64& num_rows)
{
FreeBindBuffer();

View File

@@ -114,7 +114,7 @@ class ResultBind
CleanUp(); // Clean up buffer
}
void BindResult(uint32& num_rows);
void BindResult(uint64& num_rows);
protected:
MYSQL_BIND* m_rBind;
@@ -228,8 +228,8 @@ class PreparedResultSet
}
ResultBind* rbind;
uint32 row_position;
uint32 num_rows;
uint64 row_position;
uint64 num_rows;
};
typedef ACE_Refcounted_Auto_Ptr<PreparedResultSet, ACE_Null_Mutex> PreparedQueryResult;