2 * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include "Database/DatabaseEnv.h"
23 #include "WorldPacket.h"
24 #include "WorldSession.h"
26 #include "ObjectMgr.h"
29 #include "SocialMgr.h"
32 /* differeces from off:
33 -you can uninvite yourself - is is useful
34 -you can accept invitation even if leader went offline
37 -group_destroyed msg is sent but not shown
38 -reduce xp gaining when in raid group
39 -quest sharing has to be corrected
40 -FIX sending PartyMemberStats
43 void WorldSession::SendPartyResult(PartyOperation operation
, const std::string
& member
, PartyResult res
)
45 WorldPacket
data(SMSG_PARTY_COMMAND_RESULT
, (8+member
.size()+1));
46 data
<< (uint32
)operation
;
53 void WorldSession::HandleGroupInviteOpcode( WorldPacket
& recv_data
)
55 std::string membername
;
56 recv_data
>> membername
;
57 recv_data
.read_skip
<uint32
>(); // 0 for all known invite ways
59 // attempt add selected player
62 if(!normalizePlayerName(membername
))
64 SendPartyResult(PARTY_OP_INVITE
, membername
, PARTY_RESULT_CANT_FIND_TARGET
);
68 Player
*player
= sObjectMgr
.GetPlayer(membername
.c_str());
73 SendPartyResult(PARTY_OP_INVITE
, membername
, PARTY_RESULT_CANT_FIND_TARGET
);
78 if(!sWorld
.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP
) && GetPlayer()->GetTeam() != player
->GetTeam())
80 SendPartyResult(PARTY_OP_INVITE
, membername
, PARTY_RESULT_TARGET_UNFRIENDLY
);
83 if(GetPlayer()->GetInstanceId() != 0 && player
->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player
->GetInstanceId() && GetPlayer()->GetMapId() == player
->GetMapId())
85 SendPartyResult(PARTY_OP_INVITE
, membername
, PARTY_RESULT_NOT_IN_YOUR_INSTANCE
);
89 if(player
->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
91 SendPartyResult(PARTY_OP_INVITE
, membername
, PARTY_RESULT_TARGET_IGNORE_YOU
);
95 Group
*group
= GetPlayer()->GetGroup();
96 if( group
&& group
->isBGGroup() )
97 group
= GetPlayer()->GetOriginalGroup();
99 Group
*group2
= player
->GetGroup();
100 if( group2
&& group2
->isBGGroup() )
101 group2
= player
->GetOriginalGroup();
102 // player already in another group or invited
103 if( group2
|| player
->GetGroupInvite() )
105 SendPartyResult(PARTY_OP_INVITE
, membername
, PARTY_RESULT_ALREADY_IN_GROUP
);
111 // not have permissions for invite
112 if(!group
->IsLeader(GetPlayer()->GetGUID()) && !group
->IsAssistant(GetPlayer()->GetGUID()))
114 SendPartyResult(PARTY_OP_INVITE
, "", PARTY_RESULT_YOU_NOT_LEADER
);
120 SendPartyResult(PARTY_OP_INVITE
, "", PARTY_RESULT_PARTY_FULL
);
125 // ok, but group not exist, start a new group
126 // but don't create and save the group to the DB until
127 // at least one person joins
131 // new group: if can't add then delete
132 if(!group
->AddLeaderInvite(GetPlayer()))
137 if(!group
->AddInvite(player
))
145 // already existed group: if can't add then just leave
146 if(!group
->AddInvite(player
))
153 WorldPacket
data(SMSG_GROUP_INVITE
, 10); // guess size
154 data
<< uint8(1); // ok
155 data
<< GetPlayer()->GetName();
156 player
->GetSession()->SendPacket(&data
);
158 SendPartyResult(PARTY_OP_INVITE
, membername
, PARTY_RESULT_OK
);
161 void WorldSession::HandleGroupAcceptOpcode( WorldPacket
& recv_data
)
163 recv_data
.read_skip
<uint32
>(); // value received in WorldSession::HandleGroupInviteOpcode and also skipeed currently?
165 Group
*group
= GetPlayer()->GetGroupInvite();
168 if(group
->GetLeaderGUID() == GetPlayer()->GetGUID())
170 sLog
.outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
174 // remove in from ivites in any case
175 group
->RemoveInvite(GetPlayer());
177 /** error handling **/
178 /********************/
183 SendPartyResult(PARTY_OP_INVITE
, "", PARTY_RESULT_PARTY_FULL
);
187 Player
* leader
= sObjectMgr
.GetPlayer(group
->GetLeaderGUID());
189 // forming a new group, create it
190 if(!group
->IsCreated())
193 group
->RemoveInvite(leader
);
194 if (group
->Create(group
->GetLeaderGUID(), group
->GetLeaderName()))
195 sObjectMgr
.AddGroup(group
);
200 // everything's fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
201 if(!group
->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
206 void WorldSession::HandleGroupDeclineOpcode( WorldPacket
& /*recv_data*/ )
208 Group
*group
= GetPlayer()->GetGroupInvite();
212 // remember leader if online
213 Player
*leader
= sObjectMgr
.GetPlayer(group
->GetLeaderGUID());
215 // uninvite, group can be deleted
216 GetPlayer()->UninviteFromGroup();
218 if(!leader
|| !leader
->GetSession())
222 WorldPacket
data( SMSG_GROUP_DECLINE
, 10 ); // guess size
223 data
<< GetPlayer()->GetName();
224 leader
->GetSession()->SendPacket( &data
);
227 void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket
& recv_data
)
232 //can't uninvite yourself
233 if(guid
== GetPlayer()->GetGUID())
235 sLog
.outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
239 PartyResult res
= GetPlayer()->CanUninviteFromGroup();
240 if(res
!= PARTY_RESULT_OK
)
242 SendPartyResult(PARTY_OP_LEAVE
, "", res
);
246 Group
* grp
= GetPlayer()->GetGroup();
250 if(grp
->IsMember(guid
))
252 Player::RemoveFromGroup(grp
,guid
);
256 if(Player
* plr
= grp
->GetInvited(guid
))
258 plr
->UninviteFromGroup();
262 SendPartyResult(PARTY_OP_LEAVE
, "", PARTY_RESULT_NOT_IN_YOUR_PARTY
);
265 void WorldSession::HandleGroupUninviteOpcode(WorldPacket
& recv_data
)
267 std::string membername
;
268 recv_data
>> membername
;
271 if(!normalizePlayerName(membername
))
274 // can't uninvite yourself
275 if(GetPlayer()->GetName() == membername
)
277 sLog
.outError("WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
281 PartyResult res
= GetPlayer()->CanUninviteFromGroup();
282 if(res
!= PARTY_RESULT_OK
)
284 SendPartyResult(PARTY_OP_LEAVE
, "", res
);
288 Group
* grp
= GetPlayer()->GetGroup();
292 if(uint64 guid
= grp
->GetMemberGUID(membername
))
294 Player::RemoveFromGroup(grp
,guid
);
298 if(Player
* plr
= grp
->GetInvited(membername
))
300 plr
->UninviteFromGroup();
304 SendPartyResult(PARTY_OP_LEAVE
, membername
, PARTY_RESULT_NOT_IN_YOUR_PARTY
);
307 void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket
& recv_data
)
312 Group
*group
= GetPlayer()->GetGroup();
316 Player
*player
= sObjectMgr
.GetPlayer(guid
);
318 /** error handling **/
319 if (!player
|| !group
->IsLeader(GetPlayer()->GetGUID()) || player
->GetGroup() != group
)
321 /********************/
323 // everything's fine, do it
324 group
->ChangeLeader(guid
);
327 void WorldSession::HandleGroupDisbandOpcode( WorldPacket
& /*recv_data*/ )
329 if(!GetPlayer()->GetGroup())
332 if(_player
->InBattleGround())
334 SendPartyResult(PARTY_OP_INVITE
, "", PARTY_RESULT_INVITE_RESTRICTED
);
338 /** error handling **/
339 /********************/
341 // everything's fine, do it
342 SendPartyResult(PARTY_OP_LEAVE
, GetPlayer()->GetName(), PARTY_RESULT_OK
);
344 GetPlayer()->RemoveFromGroup();
347 void WorldSession::HandleLootMethodOpcode( WorldPacket
& recv_data
)
351 uint32 lootThreshold
;
352 recv_data
>> lootMethod
>> lootMaster
>> lootThreshold
;
354 Group
*group
= GetPlayer()->GetGroup();
358 /** error handling **/
359 if(!group
->IsLeader(GetPlayer()->GetGUID()))
361 /********************/
363 // everything's fine, do it
364 group
->SetLootMethod((LootMethod
)lootMethod
);
365 group
->SetLooterGuid(lootMaster
);
366 group
->SetLootThreshold((ItemQualities
)lootThreshold
);
370 void WorldSession::HandleLootRoll( WorldPacket
&recv_data
)
373 uint32 NumberOfPlayers
;
375 recv_data
>> Guid
; //guid of the item rolled
376 recv_data
>> NumberOfPlayers
;
377 recv_data
>> rollType
;
379 //sLog.outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, rollType:%u", (uint32)Guid, NumberOfPlayers, rollType);
381 Group
* group
= GetPlayer()->GetGroup();
385 // everything's fine, do it
386 group
->CountRollVote(GetPlayer()->GetGUID(), Guid
, NumberOfPlayers
, rollType
);
391 GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED
, 1);
394 GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED
, 1);
399 void WorldSession::HandleMinimapPingOpcode(WorldPacket
& recv_data
)
405 if(!GetPlayer()->GetGroup())
408 //sLog.outDebug("Received opcode MSG_MINIMAP_PING X: %f, Y: %f", x, y);
410 /** error handling **/
411 /********************/
413 // everything is fine, do it
414 WorldPacket
data(MSG_MINIMAP_PING
, (8+4+4));
415 data
<< uint64(GetPlayer()->GetGUID());
418 GetPlayer()->GetGroup()->BroadcastPacket(&data
, true, -1, GetPlayer()->GetGUID());
421 void WorldSession::HandleRandomRollOpcode(WorldPacket
& recv_data
)
423 uint32 minimum
, maximum
, roll
;
424 recv_data
>> minimum
;
425 recv_data
>> maximum
;
427 /** error handling **/
428 if(minimum
> maximum
|| maximum
> 10000) // < 32768 for urand call
430 /********************/
432 // everything's fine, do it
433 roll
= urand(minimum
, maximum
);
435 //sLog.outDebug("ROLL: MIN: %u, MAX: %u, ROLL: %u", minimum, maximum, roll);
437 WorldPacket
data(MSG_RANDOM_ROLL
, 4+4+4+8);
438 data
<< uint32(minimum
);
439 data
<< uint32(maximum
);
440 data
<< uint32(roll
);
441 data
<< uint64(GetPlayer()->GetGUID());
442 if(GetPlayer()->GetGroup())
443 GetPlayer()->GetGroup()->BroadcastPacket(&data
, false);
448 void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket
& recv_data
)
453 Group
*group
= GetPlayer()->GetGroup();
457 /** error handling **/
458 /********************/
460 // everything's fine, do it
461 if(x
== 0xFF) // target icon request
463 group
->SendTargetIconList(this);
465 else // target icon update
467 if(group
->isRaidGroup() && !group
->IsLeader(GetPlayer()->GetGUID()) && !group
->IsAssistant(GetPlayer()->GetGUID()))
472 group
->SetTargetIcon(x
, _player
->GetGUID(), guid
);
476 void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket
& /*recv_data*/ )
478 Group
*group
= GetPlayer()->GetGroup();
482 if(_player
->InBattleGround())
485 /** error handling **/
486 if(!group
->IsLeader(GetPlayer()->GetGUID()) || group
->GetMembersCount() < 2)
488 /********************/
490 // everything's fine, do it (is it 0 (PARTY_OP_INVITE) correct code)
491 SendPartyResult(PARTY_OP_INVITE
, "", PARTY_RESULT_OK
);
492 group
->ConvertToRaid();
495 void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket
& recv_data
)
501 recv_data
>> groupNr
;
503 // we will get correct pointer for group here, so we don't have to check if group is BG raid
504 Group
*group
= GetPlayer()->GetGroup();
508 /** error handling **/
509 if(!group
->IsLeader(GetPlayer()->GetGUID()) && !group
->IsAssistant(GetPlayer()->GetGUID()))
512 if (!group
->HasFreeSlotSubGroup(groupNr
))
514 /********************/
516 // everything's fine, do it
517 group
->ChangeMembersGroup(sObjectMgr
.GetPlayer(name
.c_str()), groupNr
);
520 void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket
& recv_data
)
527 Group
*group
= GetPlayer()->GetGroup();
531 /** error handling **/
532 if(!group
->IsLeader(GetPlayer()->GetGUID()))
534 /********************/
536 // everything's fine, do it
537 group
->SetAssistant(guid
, (flag
==0?false:true));
540 void WorldSession::HandlePartyAssignmentOpcode( WorldPacket
& recv_data
)
544 recv_data
>> flag1
>> flag2
;
547 sLog
.outDebug("MSG_PARTY_ASSIGNMENT");
549 Group
*group
= GetPlayer()->GetGroup();
553 // if(flag1) Main Assist
555 // if(flag2) Main Tank
558 /** error handling **/
559 if(!group
->IsLeader(GetPlayer()->GetGUID()))
561 /********************/
563 // everything's fine, do it
565 group
->SetMainAssistant(guid
);
567 group
->SetMainTank(guid
);
570 void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket
& recv_data
)
572 if(recv_data
.empty()) // request
574 Group
*group
= GetPlayer()->GetGroup();
578 /** error handling **/
579 if(!group
->IsLeader(GetPlayer()->GetGUID()) && !group
->IsAssistant(GetPlayer()->GetGUID()))
581 /********************/
583 // everything's fine, do it
584 WorldPacket
data(MSG_RAID_READY_CHECK
, 8);
585 data
<< GetPlayer()->GetGUID();
586 group
->BroadcastPacket(&data
, false, -1);
588 group
->OfflineReadyCheck();
595 Group
*group
= GetPlayer()->GetGroup();
599 // everything's fine, do it
600 WorldPacket
data(MSG_RAID_READY_CHECK_CONFIRM
, 9);
601 data
<< GetPlayer()->GetGUID();
603 group
->BroadcastReadyCheck(&data
);
607 void WorldSession::HandleRaidReadyCheckFinishedOpcode( WorldPacket
& /*recv_data*/ )
609 //Group* group = GetPlayer()->GetGroup();
613 //if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
616 // Is any reaction need?
619 void WorldSession::BuildPartyMemberStatsChangedPacket(Player
*player
, WorldPacket
*data
)
621 uint32 mask
= player
->GetGroupUpdateFlag();
623 if (mask
== GROUP_UPDATE_FLAG_NONE
)
626 if (mask
& GROUP_UPDATE_FLAG_POWER_TYPE
) // if update power type, update current/max power also
627 mask
|= (GROUP_UPDATE_FLAG_CUR_POWER
| GROUP_UPDATE_FLAG_MAX_POWER
);
629 if (mask
& GROUP_UPDATE_FLAG_PET_POWER_TYPE
) // same for pets
630 mask
|= (GROUP_UPDATE_FLAG_PET_CUR_POWER
| GROUP_UPDATE_FLAG_PET_MAX_POWER
);
632 uint32 byteCount
= 0;
633 for (int i
= 1; i
< GROUP_UPDATE_FLAGS_COUNT
; ++i
)
635 byteCount
+= GroupUpdateLength
[i
];
637 data
->Initialize(SMSG_PARTY_MEMBER_STATS
, 8 + 4 + byteCount
);
638 *data
<< player
->GetPackGUID();
639 *data
<< (uint32
) mask
;
641 if (mask
& GROUP_UPDATE_FLAG_STATUS
)
646 *data
<< (uint16
) (MEMBER_STATUS_ONLINE
| MEMBER_STATUS_PVP
);
648 *data
<< (uint16
) MEMBER_STATUS_ONLINE
;
651 *data
<< (uint16
) MEMBER_STATUS_OFFLINE
;
654 if (mask
& GROUP_UPDATE_FLAG_CUR_HP
)
655 *data
<< (uint32
) player
->GetHealth();
657 if (mask
& GROUP_UPDATE_FLAG_MAX_HP
)
658 *data
<< (uint32
) player
->GetMaxHealth();
660 Powers powerType
= player
->getPowerType();
661 if (mask
& GROUP_UPDATE_FLAG_POWER_TYPE
)
662 *data
<< (uint8
) powerType
;
664 if (mask
& GROUP_UPDATE_FLAG_CUR_POWER
)
665 *data
<< (uint16
) player
->GetPower(powerType
);
667 if (mask
& GROUP_UPDATE_FLAG_MAX_POWER
)
668 *data
<< (uint16
) player
->GetMaxPower(powerType
);
670 if (mask
& GROUP_UPDATE_FLAG_LEVEL
)
671 *data
<< (uint16
) player
->getLevel();
673 if (mask
& GROUP_UPDATE_FLAG_ZONE
)
674 *data
<< (uint16
) player
->GetZoneId();
676 if (mask
& GROUP_UPDATE_FLAG_POSITION
)
677 *data
<< (uint16
) player
->GetPositionX() << (uint16
) player
->GetPositionY();
679 if (mask
& GROUP_UPDATE_FLAG_AURAS
)
681 const uint64
& auramask
= player
->GetAuraUpdateMask();
682 *data
<< uint64(auramask
);
683 for(uint32 i
= 0; i
< MAX_AURAS
; ++i
)
685 if(auramask
& (uint64(1) << i
))
687 *data
<< uint32(player
->GetVisibleAura(i
));
693 Pet
*pet
= player
->GetPet();
694 if (mask
& GROUP_UPDATE_FLAG_PET_GUID
)
697 *data
<< (uint64
) pet
->GetGUID();
702 if (mask
& GROUP_UPDATE_FLAG_PET_NAME
)
705 *data
<< pet
->GetName();
710 if (mask
& GROUP_UPDATE_FLAG_PET_MODEL_ID
)
713 *data
<< (uint16
) pet
->GetDisplayId();
718 if (mask
& GROUP_UPDATE_FLAG_PET_CUR_HP
)
721 *data
<< (uint32
) pet
->GetHealth();
726 if (mask
& GROUP_UPDATE_FLAG_PET_MAX_HP
)
729 *data
<< (uint32
) pet
->GetMaxHealth();
734 if (mask
& GROUP_UPDATE_FLAG_PET_POWER_TYPE
)
737 *data
<< (uint8
) pet
->getPowerType();
742 if (mask
& GROUP_UPDATE_FLAG_PET_CUR_POWER
)
745 *data
<< (uint16
) pet
->GetPower(pet
->getPowerType());
750 if (mask
& GROUP_UPDATE_FLAG_PET_MAX_POWER
)
753 *data
<< (uint16
) pet
->GetMaxPower(pet
->getPowerType());
758 if (mask
& GROUP_UPDATE_FLAG_PET_AURAS
)
762 const uint64
& auramask
= pet
->GetAuraUpdateMask();
763 *data
<< uint64(auramask
);
764 for(uint32 i
= 0; i
< MAX_AURAS
; ++i
)
766 if(auramask
& (uint64(1) << i
))
768 *data
<< uint32(pet
->GetVisibleAura(i
));
778 /*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
779 void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket
&recv_data
)
781 sLog
.outDebug("WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
785 Player
*player
= sObjectMgr
.GetPlayer(Guid
);
788 WorldPacket
data(SMSG_PARTY_MEMBER_STATS_FULL
, 3+4+2);
789 data
<< uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
790 data
.appendPackGUID(Guid
);
791 data
<< (uint32
) GROUP_UPDATE_FLAG_STATUS
;
792 data
<< (uint16
) MEMBER_STATUS_OFFLINE
;
797 Pet
*pet
= player
->GetPet();
799 WorldPacket
data(SMSG_PARTY_MEMBER_STATS_FULL
, 4+2+2+2+1+2*6+8+1+8);
800 data
<< uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
801 data
<< player
->GetPackGUID();
803 uint32 mask1
= 0x00040BFF; // common mask, real flags used 0x000040BFF
805 mask1
= 0x7FFFFFFF; // for hunters and other classes with pets
807 Powers powerType
= player
->getPowerType();
808 data
<< (uint32
) mask1
; // group update mask
809 data
<< (uint16
) MEMBER_STATUS_ONLINE
; // member's online status
810 data
<< (uint32
) player
->GetHealth(); // GROUP_UPDATE_FLAG_CUR_HP
811 data
<< (uint32
) player
->GetMaxHealth(); // GROUP_UPDATE_FLAG_MAX_HP
812 data
<< (uint8
) powerType
; // GROUP_UPDATE_FLAG_POWER_TYPE
813 data
<< (uint16
) player
->GetPower(powerType
); // GROUP_UPDATE_FLAG_CUR_POWER
814 data
<< (uint16
) player
->GetMaxPower(powerType
); // GROUP_UPDATE_FLAG_MAX_POWER
815 data
<< (uint16
) player
->getLevel(); // GROUP_UPDATE_FLAG_LEVEL
816 data
<< (uint16
) player
->GetZoneId(); // GROUP_UPDATE_FLAG_ZONE
817 data
<< (uint16
) player
->GetPositionX(); // GROUP_UPDATE_FLAG_POSITION
818 data
<< (uint16
) player
->GetPositionY(); // GROUP_UPDATE_FLAG_POSITION
821 size_t maskPos
= data
.wpos();
822 data
<< (uint64
) auramask
; // placeholder
823 for(uint8 i
= 0; i
< MAX_AURAS
; ++i
)
825 if(uint32 aura
= player
->GetVisibleAura(i
))
827 auramask
|= (uint64(1) << i
);
828 data
<< (uint32
) aura
;
832 data
.put
<uint64
>(maskPos
,auramask
); // GROUP_UPDATE_FLAG_AURAS
836 Powers petpowertype
= pet
->getPowerType();
837 data
<< (uint64
) pet
->GetGUID(); // GROUP_UPDATE_FLAG_PET_GUID
838 data
<< pet
->GetName(); // GROUP_UPDATE_FLAG_PET_NAME
839 data
<< (uint16
) pet
->GetDisplayId(); // GROUP_UPDATE_FLAG_PET_MODEL_ID
840 data
<< (uint32
) pet
->GetHealth(); // GROUP_UPDATE_FLAG_PET_CUR_HP
841 data
<< (uint32
) pet
->GetMaxHealth(); // GROUP_UPDATE_FLAG_PET_MAX_HP
842 data
<< (uint8
) petpowertype
; // GROUP_UPDATE_FLAG_PET_POWER_TYPE
843 data
<< (uint16
) pet
->GetPower(petpowertype
); // GROUP_UPDATE_FLAG_PET_CUR_POWER
844 data
<< (uint16
) pet
->GetMaxPower(petpowertype
); // GROUP_UPDATE_FLAG_PET_MAX_POWER
846 uint64 petauramask
= 0;
847 size_t petMaskPos
= data
.wpos();
848 data
<< (uint64
) petauramask
; // placeholder
849 for(uint8 i
= 0; i
< MAX_AURAS
; ++i
)
851 if(uint32 petaura
= pet
->GetVisibleAura(i
))
853 petauramask
|= (uint64(1) << i
);
854 data
<< (uint32
) petaura
;
858 data
.put
<uint64
>(petMaskPos
,petauramask
); // GROUP_UPDATE_FLAG_PET_AURAS
862 data
<< (uint8
) 0; // GROUP_UPDATE_FLAG_PET_NAME
863 data
<< (uint64
) 0; // GROUP_UPDATE_FLAG_PET_AURAS
869 /*!*/void WorldSession::HandleRequestRaidInfoOpcode( WorldPacket
& /*recv_data*/ )
871 // every time the player checks the character screen
872 _player
->SendRaidInfo();
875 void WorldSession::HandleOptOutOfLootOpcode( WorldPacket
& recv_data
)
877 sLog
.outDebug("WORLD: Received CMSG_OPT_OUT_OF_LOOT");
882 // ignore if player not loaded
883 if(!GetPlayer()) // needed because STATUS_AUTHED
886 sLog
.outError("CMSG_GROUP_PASS_ON_LOOT value<>0 for not-loaded character!");
891 sLog
.outError("CMSG_GROUP_PASS_ON_LOOT: activation not implemented!");