What features does the patch add?
a possibility to send KilledMonster to all group members from script library is needed.
For which revision was the patch created?
6841 commit [42d0d95d08c672cfcaf8c707453d6654a7270d33]
*master
Additional info
Using Player::RewardPlayerAndGroupAtKill(Unit* Victim) from scripts is not a good idea,
so I decided to create an additional method: void Player::GroupKilledMonster( uint32 entry, uint64 guid )
this reproduces some code from Player::RewardPlayerAndGroupAtKill(Unit* Victim) but seems like the best solution for me.
any comments are welcome
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 17b5e37..d0a552e 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -13054,6 +13054,24 @@ void Player::KilledMonster( uint32 entry, uint64 guid )
}
}
+void Player::GroupKilledMonster( uint32 entry, uint64 guid )
+{
+ if (Group *pGroup = GetGroup())
+ {
+ for( GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next() )
+ {
+ Player* pGroupGuy = itr->getSource();
+ if ( !pGroupGuy )
+ continue;
+ if ( !pGroupGuy->IsAtGroupRewardDistance( this ))
+ continue;
+
+ if ( pGroupGuy->isAlive() || !pGroupGuy->GetCorpse() )
+ pGroupGuy->KilledMonster( entry, guid);
+ }
+ } else KilledMonster( entry, guid );
+}
+
void Player::CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id )
{
bool isCreature = IS_CREATURE_GUID(guid);
@@ -16815,7 +16833,7 @@ uint32 Player::GetMaxPersonalArenaRatingRequirement()
}
return max_personal_rating;
}
-
+
void Player::UpdateHomebindTime(uint32 time)
{
// GMs never get homebind timer online
diff --git a/src/game/Player.h b/src/game/Player.h
index 2bf300e..b7e6b84 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1218,6 +1218,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void ItemAddedQuestCheck( uint32 entry, uint32 count );
void ItemRemovedQuestCheck( uint32 entry, uint32 count );
void KilledMonster( uint32 entry, uint64 guid );
+ void GroupKilledMonster( uint32 entry, uint64 guid );
void CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id );
void TalkedToCreature( uint32 entry, uint64 guid );
void MoneyChanged( uint32 value );