本文整理汇总了C++中GET_TYPE_FROM_GUID函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_TYPE_FROM_GUID函数的具体用法?C++ GET_TYPE_FROM_GUID怎么用?C++ GET_TYPE_FROM_GUID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_TYPE_FROM_GUID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SystemMessage
bool ChatHandler::HandleWPStandStateCommand(const char* args, WorldSession *m_session)
{
uint64 guid = m_session->GetPlayer()->GetSelection();
if (guid == 0)
{
SystemMessage(m_session, "No selection.");
return true;
}
if(GET_TYPE_FROM_GUID(guid) != HIGHGUID_TYPE_WAYPOINT)
{
SystemMessage(m_session, "You should select a Waypoint.");
return true;
}
Player* pPlayer = m_session->GetPlayer();
AIInterface* ai = pPlayer->waypointunit;
if(!ai || !ai->GetUnit())
{
SystemMessage(m_session, "Invalid Creature, please select another one.");
return true;
}
uint32 StandState = 0;
std::stringstream ss;
uint32 wpid = GUID_LOPART(guid);
if(wpid)
{
WayPoint* wp = ai->getWayPoint(wpid);
if(wp)
{
char* pBackwards = strtok((char*)args, " ");
uint32 Backwards = (pBackwards)? atoi(pBackwards) : 0;
char* pStandState = strtok(NULL, " ");
StandState = (pStandState)? atoi(pStandState) : 0;
StandState = StandState > 8 ? 0 : StandState;
if(Backwards)
{
if(wp->backwardInfo == NULL)
wp->backwardInfo = new ConditionalData();
wp->backwardInfo->StandState = StandState;
ss << "Backward StandState for Waypoint " << wpid << " is now " << StandState;
}
else
{
if(wp->forwardInfo == NULL)
wp->forwardInfo = new ConditionalData();
wp->forwardInfo->StandState = StandState;
ss << "Forward StandState for Waypoint " << wpid << " is now " << StandState;
}
//save wp
ai->saveWayPoints();
}
SystemMessage(m_session, ss.str().c_str());
}
else
SystemMessage(m_session, "Invalid Waypoint.");
return true;
}
示例2: switch
Object* MapMgr::_GetObject(const uint64 & guid)
{
if(!guid)
return NULL;
switch(GET_TYPE_FROM_GUID(guid))
{
case HIGHGUID_TYPE_GAMEOBJECT:
return GetGameObject(GET_LOWGUID_PART(guid));
break;
case HIGHGUID_TYPE_UNIT:
case HIGHGUID_TYPE_VEHICLE:
return GetCreature(GET_LOWGUID_PART(guid));
break;
case HIGHGUID_TYPE_DYNAMICOBJECT:
return GetDynamicObject((uint32)guid);
break;
case HIGHGUID_TYPE_TRANSPORTER:
return objmgr.GetTransporter(Arcemu::Util::GUID_LOPART(guid));
break;
default:
return GetUnit(guid);
break;
}
}
示例3: SystemMessage
bool ChatHandler::HandleWPSkinCommand(const char* args, WorldSession *m_session)
{
uint64 guid = m_session->GetPlayer()->GetSelection();
if (guid == 0)
{
SystemMessage(m_session, "No selection.");
return true;
}
if(GET_TYPE_FROM_GUID(guid) != HIGHGUID_TYPE_WAYPOINT)
{
SystemMessage(m_session, "You should select a Waypoint.");
return true;
}
Player* pPlayer = m_session->GetPlayer();
AIInterface* ai = pPlayer->waypointunit;
if(!ai || !ai->GetUnit())
{
SystemMessage(m_session, "Invalid Creature, please select another one.");
return true;
}
uint32 SkinId = 0;
std::stringstream ss;
uint32 wpid = GUID_LOPART(guid);
if(wpid)
{
WayPoint* wp = ai->getWayPoint(wpid);
if(wp)
{
char* pBackwards = strtok((char*)args, " ");
uint32 Backwards = (pBackwards)? atoi(pBackwards) : 0;
char* pSkinId = strtok(NULL, " ");
SkinId = (pSkinId)? atoi(pSkinId) : 0;
if(Backwards)
{
wp->backwardskinid = SkinId;
}
else
{
wp->forwardskinid = SkinId;
}
//save wp
ai->saveWayPoints();
}
ss << "SkinID for Waypoint " << wpid << " is now " << SkinId;
SystemMessage(m_session, ss.str().c_str());
}
else
{
SystemMessage(m_session, "Invalid Waypoint.");
return true;
}
return true;
}
示例4: SystemMessage
bool ChatHandler::HandleWPInfoCommand(const char* args, WorldSession *m_session)
{
uint64 guid = m_session->GetPlayer()->GetSelection();
if (guid == 0)
{
SystemMessage(m_session, "No selection.");
return true;
}
if(GET_TYPE_FROM_GUID(guid) != HIGHGUID_TYPE_WAYPOINT)
{
SystemMessage(m_session, "You should select a Waypoint.");
return true;
}
Player* pPlayer = m_session->GetPlayer();
AIInterface* ai = pPlayer->waypointunit;
if(!ai || !ai->GetUnit())
{
SystemMessage(m_session, "Invalid Creature, please select another one.");
return true;
}
std::stringstream ss;
uint32 wpid = GUID_LOPART(guid);
if((wpid > 0) && (wpid <= ai->GetWayPointsCount()))
{
WayPoint* wp = ai->getWayPoint(wpid);
if(wp)
{
ss << "Waypoint Number " << wp->id << ":\n";
ss << "WaitTime: " << wp->waittime << "\n";
ss << "Flags: " << wp->flags;
if(wp->flags == 768)
ss << " (Fly)\n";
else if(wp->flags == 256)
ss << " (Run)\n";
else
ss << " (Walk)\n";
ss << "Backwards\n";
ss << " emoteid: " << wp->backwardemoteid << "\n";
ss << " oneshot: " << ((wp->backwardemoteoneshot == 1)? "Yes" : "No") << "\n";
ss << " skinid: " << wp->backwardskinid << "\n";
ss << "Forwards\n";
ss << " emoteid: " << wp->forwardemoteid << "\n";
ss << " oneshot: " << ((wp->forwardemoteoneshot == 1)? "Yes" : "No") << "\n";
ss << " skinid: " << wp->forwardskinid << "\n";
SendMultilineMessage(m_session, ss.str().c_str());
}
}
else
{
SystemMessage(m_session, "Invalid Waypoint.");
return true;
}
return true;
}
示例5: DEBUG_LOG
//////////////////////////////////////////////////////////////
/// This function handles CMSG_GOSSIP_SELECT_OPTION:
//////////////////////////////////////////////////////////////
void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
{
if(!_player->IsInWorld()) return;
//WorldPacket data;
uint32 option;
uint32 unk24;
uint64 guid;
int8 extra=0;
recv_data >> guid >> unk24 >> option;
DEBUG_LOG("WORLD: CMSG_GOSSIP_SELECT_OPTION Option %i Guid %.8X", option, guid );
GossipScript * Script=NULL;
Object * qst_giver=NULL;
uint32 guidtype = GET_TYPE_FROM_GUID(guid);
if(guidtype==HIGHGUID_TYPE_UNIT)
{
Creature *crt = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(!crt)
return;
qst_giver=crt;
Script=crt->GetCreatureName()?crt->GetCreatureName()->gossip_script:NULL;
}
else if(guidtype==HIGHGUID_TYPE_ITEM)
{
Item * pitem = _player->GetItemInterface()->GetItemByGUID(guid);
if(pitem==NULL)
return;
qst_giver=pitem;
Script=pitem->GetProto()->gossip_script;
}
if(!Script||!qst_giver)
return;
uint32 IntId = 1;
if(_player->CurrentGossipMenu)
{
GossipMenuItem item = _player->CurrentGossipMenu->GetItem(option);
IntId = item.IntId;
extra = item.Extra;
}
if(extra)
{
string str;
if(recv_data.rpos()!=recv_data.wpos())
recv_data >> str;
Script->GossipSelectOption(qst_giver, _player, option, IntId, str.c_str());
}
else
示例6: LOG_DEBUG
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN
LOG_DEBUG("WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY.");
if(_player->IsInBg())
return; //Added in 3.0.2, quests can be shared anywhere besides a BG
uint64 guid;
WorldPacket data(SMSG_QUESTGIVER_STATUS, 12);
Object* qst_giver = NULL;
recv_data >> guid;
uint32 guidtype = GET_TYPE_FROM_GUID(guid);
if(guidtype == HIGHGUID_TYPE_UNIT)
{
Creature* quest_giver = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(quest_giver)
qst_giver = quest_giver;
else
return;
if(!quest_giver->isQuestGiver())
{
LOG_DEBUG("WORLD: Creature is not a questgiver.");
return;
}
}
else if(guidtype == HIGHGUID_TYPE_ITEM)
{
Item* quest_giver = GetPlayer()->GetItemInterface()->GetItemByGUID(guid);
if(quest_giver)
qst_giver = quest_giver;
else
return;
}
else if(guidtype == HIGHGUID_TYPE_GAMEOBJECT)
{
GameObject* quest_giver = _player->GetMapMgr()->GetGameObject(GET_LOWGUID_PART(guid));
if(quest_giver)
qst_giver = quest_giver;
else
return;
}
if(!qst_giver)
{
LOG_DEBUG("WORLD: Invalid questgiver GUID " I64FMT ".", guid);
return;
}
data << guid << sQuestMgr.CalcStatus(qst_giver, GetPlayer());
SendPacket(&data);
}
示例7: SystemMessage
bool ChatHandler::HandleWPFlagsCommand(const char* args, WorldSession* m_session)
{
uint64 guid = m_session->GetPlayer()->GetSelection();
if(guid == 0)
{
SystemMessage(m_session, "No selection.");
return true;
}
if(GET_TYPE_FROM_GUID(guid) != HIGHGUID_TYPE_WAYPOINT)
{
SystemMessage(m_session, "You should select a Waypoint.");
return true;
}
Player* pPlayer = m_session->GetPlayer();
AIInterface* ai = pPlayer->waypointunit;
if(!ai || !ai->GetUnit())
{
SystemMessage(m_session, "Invalid Creature, please select another one.");
return true;
}
std::stringstream ss;
uint32 wpid = Arcemu::Util::GUID_LOPART(guid);
if(wpid)
{
WayPoint* wp = ai->getWayPoint(wpid);
if(wp == NULL)
{
SystemMessage(m_session, "Invalid Waypoint.");
return true;
}
uint32 flags = wp->flags;
char* pNewFlags = strtok((char*)args, " ");
uint32 NewFlags = (pNewFlags) ? atoi(pNewFlags) : 0;
wp->flags = NewFlags;
//save wp
ai->saveWayPoints();
ss << "Waypoint " << wpid << " flags changed from " << flags << " to " << NewFlags;
SystemMessage(m_session, ss.str().c_str());
}
else
{
SystemMessage(m_session, "Invalid Waypoint.");
return true;
}
return true;
}
示例8: DEBUG_LOG
void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
{
DEBUG_LOG( "WORLD"," Received CMSG_QUESTGIVER_STATUS_QUERY." );
CHECK_INWORLD_RETURN;
uint64 guid;
WorldPacket data(SMSG_QUESTGIVER_STATUS, 9);
Object* qst_giver = NULLOBJ;
recv_data >> guid;
uint32 guidtype = GET_TYPE_FROM_GUID(guid);
if(guidtype == HIGHGUID_TYPE_CREATURE)
{
Creature* quest_giver = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(quest_giver)
qst_giver = quest_giver;
else
return;
if (!quest_giver->isQuestGiver())
{
OUT_DEBUG("WORLD: Creature is not a questgiver.");
return;
}
}
else if(guidtype==HIGHGUID_TYPE_ITEM)
{
Item* quest_giver = GetPlayer()->GetItemInterface()->GetItemByGUID(guid);
if(quest_giver)
qst_giver = TO_OBJECT(quest_giver);
else
return;
}
else if(guidtype==HIGHGUID_TYPE_GAMEOBJECT)
{
GameObject* quest_giver = _player->GetMapMgr()->GetGameObject(GET_LOWGUID_PART(guid));
if(quest_giver)
qst_giver = TO_OBJECT(quest_giver);
else
return;
}
if (!qst_giver)
{
OUT_DEBUG("WORLD: Invalid questgiver GUID "I64FMT".", guid);
return;
}
data << guid << sQuestMgr.CalcStatus(qst_giver, GetPlayer());
SendPacket( &data );
}
示例9: data
void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
{
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY." );
if(!_player) return;
if(!_player->IsInWorld()) return;
uint64 guid;
WorldPacket data(SMSG_QUESTGIVER_STATUS, 12);
Object *qst_giver = NULL;
recv_data >> guid;
uint32 guidtype = GET_TYPE_FROM_GUID(guid);
if(guidtype==HIGHGUID_TYPE_UNIT)
{
Creature *quest_giver = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(quest_giver)
qst_giver = (Object*)quest_giver;
else
return;
if (!quest_giver->isQuestGiver())
{
sLog.outDebug("WORLD: Creature is not a questgiver.");
return;
}
}
else if(guidtype==HIGHGUID_TYPE_ITEM)
{
Item *quest_giver = GetPlayer()->GetItemInterface()->GetItemByGUID(guid);
if(quest_giver)
qst_giver = (Object*)quest_giver;
else
return;
}
else if(guidtype==HIGHGUID_TYPE_GAMEOBJECT)
{
GameObject *quest_giver = _player->GetMapMgr()->GetGameObject(GET_LOWGUID_PART(guid));
if(quest_giver)
qst_giver = (Object*)quest_giver;
else
return;
}
if (!qst_giver)
{
sLog.outDebug("WORLD: Invalid questgiver GUID "I64FMT".", guid);
return;
}
data << guid << sQuestMgr.CalcStatus(qst_giver, GetPlayer());
SendPacket( &data );
}
示例10: switch
Unit* MapMgr::GetUnit(const uint64 & guid)
{
/*#ifdef USING_BIG_ENDIAN
switch (((uint32*)&guid)[0])
#else
switch (((uint32*)&guid)[1])
#endif
{
case HIGHGUID_PLAYER:
return GetPlayer((uint32)guid);
break;
case HIGHGUID_UNIT:
return GetCreature((uint32)guid);
break;
case HIGHGUID_PET:
return GetPet((uint32)guid);
break;
default:
return NULL;
}*/
/*uint32 highguid = GUID_HIPART(guid);
if( highguid & HIGHGUID_UNIT )
return GetCreature( ((uint32)guid&LOWGUID_UNIT_MASK) );
else if( highguid == HIGHGUID_PLAYER ) // players are always zero
return GetPlayer( (uint32)guid );
else if( highguid & HIGHGUID_PET )
return GetPet( (uint32)guid );
else
return NULL;*/
switch(GET_TYPE_FROM_GUID(guid))
{
case HIGHGUID_TYPE_UNIT:
return GetCreature( GET_LOWGUID_PART(guid) );
break;
case HIGHGUID_TYPE_PLAYER:
return GetPlayer( (uint32)guid );
break;
case HIGHGUID_TYPE_PET:
return GetPet( (uint32)guid );
break;
}
return NULL;
}
示例11: HandlePetAction
void WorldSession::HandlePetAction(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN
//WorldPacket data;
uint64 petGuid = 0;
uint16 misc = 0;
uint16 action = 0;
uint64 targetguid = 0;
recv_data >> petGuid >> misc >> action;
//recv_data.hexlike();
//printf("Pet_Action: 0x%.4X 0x%.4X\n", misc, action);
if(GET_TYPE_FROM_GUID(petGuid) == HIGHGUID_TYPE_UNIT)
{
Creature* pCharm = GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(petGuid));
if(!pCharm)
return;
// must be a mind controlled creature..
if(action == PET_ACTION_ACTION)
{
recv_data >> targetguid;
switch(misc)
{
case PET_ACTION_ATTACK:
{
if(!sEventMgr.HasEvent(_player, EVENT_PLAYER_CHARM_ATTACK))
{
uint32 timer = pCharm->GetBaseAttackTime(MELEE);
if(!timer) timer = 2000;
sEventMgr.AddEvent(_player, &Player::_EventCharmAttack, EVENT_PLAYER_CHARM_ATTACK, timer, 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
_player->_EventCharmAttack();
}
}
break;
}
}
示例12: LOG_DETAIL
//////////////////////////////////////////////////////////////
/// This function handles CMSG_GOSSIP_SELECT_OPTION:
//////////////////////////////////////////////////////////////
void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
{
CHECK_INWORLD_RETURN
uint32 option;
uint32 unk24;
uint64 guid;
recv_data >> guid >> unk24 >> option;
LOG_DETAIL("WORLD: CMSG_GOSSIP_SELECT_OPTION Option %i Guid %.8X", option, guid);
Arcemu::Gossip::Script* script = NULL;
uint32 guidtype = GET_TYPE_FROM_GUID(guid);
Object* qst_giver;
if(guidtype == HIGHGUID_TYPE_ITEM) //Item objects are retrieved differently.
{
qst_giver = GetPlayer()->GetItemInterface()->GetItemByGUID(guid);
if(qst_giver != NULL)
script = Arcemu::Gossip::Script::GetInterface(TO_ITEM(qst_giver));
}
else
qst_giver = GetPlayer()->GetMapMgr()->_GetObject(guid);
if(qst_giver != NULL)
{
if(guidtype == HIGHGUID_TYPE_UNIT)
script = Arcemu::Gossip::Script::GetInterface(TO_CREATURE(qst_giver));
else if(guidtype == HIGHGUID_TYPE_GAMEOBJECT)
script = Arcemu::Gossip::Script::GetInterface(TO_GAMEOBJECT(qst_giver));
}
if(script != NULL)
{
string str;
if(recv_data.rpos() != recv_data.wpos())
recv_data >> str;
if(str.length() > 0)
script->OnSelectOption(qst_giver, GetPlayer() , option, str.c_str());
else
script->OnSelectOption(qst_giver, GetPlayer() , option, NULL);
}
示例13: GET_TYPE_FROM_GUID
/*Loot type MUST be
1-corpse, go
2-skinning/herbalism/minning
3-Fishing
*/
void Player::SendLoot(uint64 guid,uint8 loot_type, uint32 mapid)
{
Group * m_Group = m_playerInfo->m_Group;
if( !IsInWorld() )
return;
Loot * pLoot = NULL;
uint32 guidtype = GET_TYPE_FROM_GUID(guid);
int8 loot_method;
if( m_Group != NULL )
loot_method = m_Group->GetMethod();
else
loot_method = PARTY_LOOT_FFA;
if(guidtype == HIGHGUID_TYPE_UNIT)
{
Creature* pCreature = GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(!pCreature)return;
pLoot=&pCreature->loot;
m_currentLoot = pCreature->GetGUID();
}else if(guidtype == HIGHGUID_TYPE_GAMEOBJECT)
{
GameObject* pGO = GetMapMgr()->GetGameObject(GET_LOWGUID_PART(guid));
if(!pGO)return;
pGO->SetByte(GAMEOBJECT_BYTES_1, 0,0);
pLoot=&pGO->loot;
m_currentLoot = pGO->GetGUID();
}
else if((guidtype == HIGHGUID_TYPE_PLAYER) )
{
Player *p=GetMapMgr()->GetPlayer((uint32)guid);
if(!p)return;
pLoot=&p->loot;
m_currentLoot = p->GetGUID();
}
else if( (guidtype == HIGHGUID_TYPE_CORPSE))
{
Corpse *pCorpse = objmgr.GetCorpse((uint32)guid);
if(!pCorpse)return;
pLoot=&pCorpse->loot;
m_currentLoot = pCorpse->GetGUID();
}
else if( (guidtype == HIGHGUID_TYPE_ITEM) )
{
Item *pItem = GetItemInterface()->GetItemByGUID(guid);
if(!pItem)
return;
pLoot = pItem->loot;
m_currentLoot = pItem->GetGUID();
}
if(!pLoot)
{
// something whack happened.. damn cheaters..
return;
}
// add to looter set
pLoot->looters.insert( GetLowGUID() );
WorldPacket data, data2(32);
data.SetOpcode( SMSG_LOOT_RESPONSE );
m_lootGuid = guid;
data << uint64( guid );
data << uint8( loot_type );//loot_type;
data << uint32( pLoot->gold );
data << uint8( 0 ); //loot size reserve
std::vector<__LootItem>::iterator iter=pLoot->items.begin();
uint32 count= 0;
uint8 slottype = 0;
for(uint32 x= 0;iter!=pLoot->items.end();iter++,x++)
{
if (iter->iItemsCount == 0)
continue;
LooterSet::iterator itr = iter->has_looted.find(GetLowGUID());
if (iter->has_looted.end() != itr)
continue;
ItemPrototype* itemProto =iter->item.itemproto;
if (!itemProto)
continue;
// check if it's on ML if so only quest items and ffa loot should be shown based on mob
//.........这里部分代码省略.........
示例14: data
void LootRoll::Finalize()
{
sEventMgr.RemoveEvents(this);
// this we will have to finalize with groups types.. for now
// we'll just assume need before greed. person with highest roll
// in need gets the item.
uint32 highest = 0;
int8 hightype = -1;
uint64 player = 0;
WorldPacket data(34);
/*
Player * gplr = NULL;
for(std::map<uint64, uint32>::iterator itr = NeedRolls.begin(); itr != NeedRolls.end(); ++itr)
{
gplr = _mgr->GetPlayer((uint32)itr->first);
if(gplr) break;
}
if(!gplr)
{
for(std::map<uint64, uint32>::iterator itr = GreedRolls.begin(); itr != GreedRolls.end(); ++itr)
{
gplr = _mgr->GetPlayer((uint32)itr->first);
if(gplr) break;
}
}
*/
for (std::map<uint32, uint32>::iterator itr = m_NeedRolls.begin(); itr != m_NeedRolls.end(); ++itr)
{
if (itr->second > highest)
{
highest = itr->second;
player = itr->first;
hightype = NEED;
}
/*
data.Initialize(SMSG_LOOT_ROLL);
data << _guid << _slotid << itr->first;
data << _itemid << _itemunk1 << _itemunk2;
data << uint8(itr->second) << uint8(NEED);
if(gplr && gplr->GetGroup())
gplr->GetGroup()->SendPacketToAll(&data);
*/
}
if (!highest)
{
for (std::map<uint32, uint32>::iterator itr = m_GreedRolls.begin(); itr != m_GreedRolls.end(); ++itr)
{
if (itr->second > highest)
{
highest = itr->second;
player = itr->first;
hightype = GREED;
}
/*
data.Initialize(SMSG_LOOT_ROLL);
data << _guid << _slotid << itr->first;
data << _itemid << _itemunk1 << _itemunk2;
data << uint8(itr->second) << uint8(GREED);
if(gplr && gplr->GetGroup())
gplr->GetGroup()->SendPacketToAll(&data);
*/
}
}
Loot * pLoot = 0;
uint32 guidtype = GET_TYPE_FROM_GUID(_guid);
if (guidtype == HIGHGUID_TYPE_UNIT)
{
Creature * pc = _mgr->GetCreature(GET_LOWGUID_PART(_guid));
if (pc) pLoot = &pc->loot;
}
else if (guidtype == HIGHGUID_TYPE_GAMEOBJECT)
{
GameObject * go = _mgr->GetGameObject(GET_LOWGUID_PART(_guid));
if (go) pLoot = &go->loot;
}
if (!pLoot)
{
delete this;
return;
}
if (_slotid >= pLoot->items.size())
{
delete this;
return;
}
pLoot->items.at(_slotid).roll = NULL;
uint32 itemid = pLoot->items.at(_slotid).item.itemproto->ItemId;
uint32 amt = pLoot->items.at(_slotid).iItemsCount;
if (!amt)
//.........这里部分代码省略.........
示例15: DEBUG_LOG
void WorldSession::HandleQuestgiverRequestRewardOpcode( WorldPacket & recv_data )
{
CHECK_INWORLD_RETURN;
DEBUG_LOG( "WORLD","Received CMSG_QUESTGIVER_REQUESTREWARD_QUEST." );
uint64 guid;
uint32 quest_id;
recv_data >> guid;
recv_data >> quest_id;
bool bValid = false;
Quest *qst = NULL;
Object* qst_giver = NULL;
uint32 status = 0;
uint32 guidtype = GET_TYPE_FROM_GUID(guid);
if(guidtype==HIGHGUID_TYPE_UNIT)
{
Creature* quest_giver = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
if(quest_giver)
qst_giver = TO_OBJECT(quest_giver);
else
return;
bValid = quest_giver->isQuestGiver();
if(bValid)
{
qst = quest_giver->FindQuest(quest_id, QUESTGIVER_QUEST_END);
if(!qst)
qst = quest_giver->FindQuest(quest_id, QUESTGIVER_QUEST_START);
if(!qst)
{
OUT_DEBUG("WARNING: Cannot complete quest, as it doesnt exist.");
return;
}
status = sQuestMgr.CalcQuestStatus(qst_giver, GetPlayer(), qst, (uint8)quest_giver->GetQuestRelation(qst->id),false);
}
}
else if(guidtype==HIGHGUID_TYPE_GAMEOBJECT)
{
GameObject* quest_giver = _player->GetMapMgr()->GetGameObject(GET_LOWGUID_PART(guid));
if(quest_giver)
qst_giver = TO_OBJECT(quest_giver);
else
return; // oops..
bValid = quest_giver->isQuestGiver();
if(bValid)
{
qst = quest_giver->FindQuest(quest_id, QUESTGIVER_QUEST_END);
if(!qst)
{
OUT_DEBUG("WARNING: Cannot complete quest, as it doesnt exist.");
return;
}
status = sQuestMgr.CalcQuestStatus(qst_giver, GetPlayer(), qst, (uint8)quest_giver->GetQuestRelation(qst->id),false);
}
}
if (!qst_giver)
{
OUT_DEBUG("WORLD: Invalid questgiver GUID.");
return;
}
if (!bValid || qst == NULL)
{
OUT_DEBUG("WORLD: Creature is not a questgiver.");
return;
}
if (status == QMGR_QUEST_FINISHED)
{
WorldPacket data;
sQuestMgr.BuildOfferReward(&data, qst, qst_giver, 1, language, _player);
SendPacket(&data);
DEBUG_LOG( "WORLD","Sent SMSG_QUESTGIVER_REQUEST_ITEMS." );
}
// if we got here it means we're cheating
}