mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[11458] Non-item related uint64 guids replaced by ObjectGUids in Player.h
Also let ObjectAccessor::FindPlayer optimize empty guid case work.
This commit is contained in:
parent
1d781cd431
commit
151e5eae9c
13 changed files with 123 additions and 125 deletions
|
|
@ -418,8 +418,6 @@ Player::Player (WorldSession *session): Unit(), m_mover(this), m_camera(this), m
|
|||
|
||||
m_session = session;
|
||||
|
||||
m_divider = 0;
|
||||
|
||||
m_ExtraFlags = 0;
|
||||
if(GetSession()->GetSecurity() >= SEC_GAMEMASTER)
|
||||
SetAcceptTicket(true);
|
||||
|
|
@ -6514,39 +6512,39 @@ void Player::UpdateHonorFields()
|
|||
bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
|
||||
{
|
||||
// do not reward honor in arenas, but enable onkill spellproc
|
||||
if(InArena())
|
||||
if (InArena())
|
||||
{
|
||||
if(!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
if( GetBGTeam() == ((Player*)uVictim)->GetBGTeam() )
|
||||
if (GetBGTeam() == ((Player*)uVictim)->GetBGTeam())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||
if(GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
if (GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
return false;
|
||||
|
||||
uint64 victim_guid = 0;
|
||||
ObjectGuid victim_guid;
|
||||
uint32 victim_rank = 0;
|
||||
|
||||
// need call before fields update to have chance move yesterday data to appropriate fields before today data change.
|
||||
UpdateHonorFields();
|
||||
|
||||
if(honor <= 0)
|
||||
if (honor <= 0)
|
||||
{
|
||||
if(!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
|
||||
if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
|
||||
return false;
|
||||
|
||||
victim_guid = uVictim->GetGUID();
|
||||
victim_guid = uVictim->GetObjectGuid();
|
||||
|
||||
if( uVictim->GetTypeId() == TYPEID_PLAYER )
|
||||
if (uVictim->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player *pVictim = (Player *)uVictim;
|
||||
|
||||
if( GetTeam() == pVictim->GetTeam() && !sWorld.IsFFAPvPRealm() )
|
||||
if (GetTeam() == pVictim->GetTeam() && !sWorld.IsFFAPvPRealm())
|
||||
return false;
|
||||
|
||||
float f = 1; //need for total kills (?? need more info)
|
||||
|
|
@ -6568,18 +6566,18 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
|
|||
// title[15..28] -> rank[5..18]
|
||||
// title[other] -> 0
|
||||
if (victim_title == 0)
|
||||
victim_guid = 0; // Don't show HK: <rank> message, only log.
|
||||
victim_guid.Clear(); // Don't show HK: <rank> message, only log.
|
||||
else if (victim_title < 15)
|
||||
victim_rank = victim_title + 4;
|
||||
else if (victim_title < 29)
|
||||
victim_rank = victim_title - 14 + 4;
|
||||
else
|
||||
victim_guid = 0; // Don't show HK: <rank> message, only log.
|
||||
victim_guid.Clear(); // Don't show HK: <rank> message, only log.
|
||||
}
|
||||
|
||||
k_grey = MaNGOS::XP::GetGrayLevel(k_level);
|
||||
|
||||
if(v_level<=k_grey)
|
||||
if (v_level<=k_grey)
|
||||
return false;
|
||||
|
||||
float diff_level = (k_level == k_grey) ? 1 : ((float(v_level) - float(k_grey)) / (float(k_level) - float(k_grey)));
|
||||
|
|
@ -6587,7 +6585,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
|
|||
int32 v_rank =1; //need more info
|
||||
|
||||
honor = ((f * diff_level * (190 + v_rank*10))/6);
|
||||
honor *= ((float)k_level) / 70.0f; //factor of dependence on levels of the killer
|
||||
honor *= float(k_level) / 70.0f; //factor of dependence on levels of the killer
|
||||
|
||||
// count the number of playerkills in one day
|
||||
ApplyModUInt32Value(PLAYER_FIELD_KILLS, 1, true);
|
||||
|
|
@ -6614,7 +6612,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
|
|||
honor *= sWorld.getConfig(CONFIG_FLOAT_RATE_HONOR);
|
||||
honor *= (GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HONOR_GAIN) + 100.0f)/100.0f;
|
||||
|
||||
if(groupsize > 1)
|
||||
if (groupsize > 1)
|
||||
honor /= groupsize;
|
||||
|
||||
honor *= (((float)urand(8,12))/10); // approx honor: 80% - 120% of real honor
|
||||
|
|
@ -6625,11 +6623,10 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
|
|||
// victim_rank [1..4] HK: <dishonored rank>
|
||||
// victim_rank [5..19] HK: <alliance\horde rank>
|
||||
// victim_rank [0,20+] HK: <>
|
||||
WorldPacket data(SMSG_PVP_CREDIT,4+8+4);
|
||||
data << (uint32) honor;
|
||||
data << (uint64) victim_guid;
|
||||
data << (uint32) victim_rank;
|
||||
|
||||
WorldPacket data(SMSG_PVP_CREDIT, 4 + 8 + 4);
|
||||
data << uint32(honor);
|
||||
data << ObjectGuid(victim_guid);
|
||||
data << uint32(victim_rank);
|
||||
GetSession()->SendPacket(&data);
|
||||
|
||||
// add honor points
|
||||
|
|
@ -7962,8 +7959,9 @@ void Player::SendLootRelease(ObjectGuid guid)
|
|||
|
||||
void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||
{
|
||||
if (uint64 lguid = GetLootGUID())
|
||||
m_session->DoLootRelease(lguid);
|
||||
ObjectGuid lootGuid = GetLootGuid();
|
||||
if (!lootGuid.IsEmpty())
|
||||
m_session->DoLootRelease(lootGuid);
|
||||
|
||||
Loot *loot = 0;
|
||||
PermissionTypes permission = ALL_PERMISSION;
|
||||
|
|
@ -8226,7 +8224,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
|||
}
|
||||
}
|
||||
|
||||
SetLootGUID(guid);
|
||||
SetLootGuid(guid);
|
||||
|
||||
// LOOT_INSIGNIA and LOOT_FISHINGHOLE unsupported by client
|
||||
switch(loot_type)
|
||||
|
|
@ -12298,12 +12296,12 @@ void Player::SendBuyError( BuyResult msg, Creature* pCreature, uint32 item, uint
|
|||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Player::SendSellError( SellResult msg, Creature* pCreature, uint64 guid, uint32 param )
|
||||
void Player::SendSellError( SellResult msg, Creature* pCreature, ObjectGuid itemGuid, uint32 param )
|
||||
{
|
||||
DEBUG_LOG( "WORLD: Sent SMSG_SELL_ITEM" );
|
||||
WorldPacket data( SMSG_SELL_ITEM,(8+8+(param?4:0)+1)); // last check 2.0.10
|
||||
data << (pCreature ? pCreature->GetObjectGuid() : ObjectGuid());
|
||||
data << uint64(guid);
|
||||
data << ObjectGuid(itemGuid);
|
||||
if (param > 0)
|
||||
data << uint32(param);
|
||||
data << uint8(msg);
|
||||
|
|
@ -18226,14 +18224,14 @@ void Player::RemovePet(PetSaveMode mode)
|
|||
|
||||
void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const
|
||||
{
|
||||
*data << (uint8)msgtype;
|
||||
*data << (uint32)language;
|
||||
*data << (uint64)GetGUID();
|
||||
*data << (uint32)language; //language 2.1.0 ?
|
||||
*data << (uint64)GetGUID();
|
||||
*data << (uint32)(text.length()+1);
|
||||
*data << uint8(msgtype);
|
||||
*data << uint32(language);
|
||||
*data << ObjectGuid(GetObjectGuid());
|
||||
*data << uint32(language); //language 2.1.0 ?
|
||||
*data << ObjectGuid(GetObjectGuid());
|
||||
*data << uint32(text.length()+1);
|
||||
*data << text;
|
||||
*data << (uint8)chatTag();
|
||||
*data << uint8(chatTag());
|
||||
}
|
||||
|
||||
void Player::Say(const std::string& text, const uint32 language)
|
||||
|
|
@ -18257,7 +18255,7 @@ void Player::TextEmote(const std::string& text)
|
|||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT) );
|
||||
}
|
||||
|
||||
void Player::Whisper(const std::string& text, uint32 language,uint64 receiver)
|
||||
void Player::Whisper(const std::string& text, uint32 language, ObjectGuid receiver)
|
||||
{
|
||||
if (language != LANG_ADDON) // if not addon data
|
||||
language = LANG_UNIVERSAL; // whispers should always be readable
|
||||
|
|
@ -20852,22 +20850,22 @@ void Player::RewardSinglePlayerAtKill(Unit* pVictim)
|
|||
|
||||
void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource)
|
||||
{
|
||||
uint64 creature_guid = pRewardSource->GetTypeId()==TYPEID_UNIT ? pRewardSource->GetGUID() : uint64(0);
|
||||
ObjectGuid creature_guid = pRewardSource->GetTypeId()==TYPEID_UNIT ? pRewardSource->GetObjectGuid() : ObjectGuid();
|
||||
|
||||
// prepare data for near group iteration
|
||||
if(Group *pGroup = GetGroup())
|
||||
if (Group *pGroup = GetGroup())
|
||||
{
|
||||
for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player* pGroupGuy = itr->getSource();
|
||||
if(!pGroupGuy)
|
||||
if (!pGroupGuy)
|
||||
continue;
|
||||
|
||||
if(!pGroupGuy->IsAtGroupRewardDistance(pRewardSource))
|
||||
if (!pGroupGuy->IsAtGroupRewardDistance(pRewardSource))
|
||||
continue; // member (alive or dead) or his corpse at req. distance
|
||||
|
||||
// quest objectives updated only for alive group member or dead but with not released body
|
||||
if(pGroupGuy->isAlive()|| !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
|
||||
if (pGroupGuy->isAlive()|| !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
|
||||
pGroupGuy->KilledMonsterCredit(creature_id, creature_guid);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue