////////////////////////////////////////////////////////////// /// This function handles CMSG_GOSSIP_HELLO: ////////////////////////////////////////////////////////////// void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data) { CHECK_INWORLD_RETURN uint64 guid; recv_data >> guid; Creature* qst_giver = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid)); if(qst_giver != NULL) { //stop when talked to if(qst_giver->GetAIInterface()) qst_giver->GetAIInterface()->StopMovement(30000); // unstealth meh if(_player->IsStealth()) _player->RemoveAllAuraType(SPELL_AURA_MOD_STEALTH); // reputation _player->Reputation_OnTalk(qst_giver->m_factionDBC); LOG_DEBUG("WORLD: Received CMSG_GOSSIP_HELLO from %u", Arcpro::Util::GUID_LOPART(guid)); Arcpro::Gossip::Script* script = Arcpro::Gossip::Script::GetInterface(qst_giver); if(script != NULL) script->OnHello(qst_giver, GetPlayer()); } }
bool ScriptMgr::CallScriptedItem(Item* pItem, Player* pPlayer) { Arcpro::Gossip::Script* script = this->get_item_gossip(pItem->GetEntry()); if(script != NULL) { script->OnHello(pItem, pPlayer); return true; } return false; }
////////////////////////////////////////////////////////////// /// 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); Arcpro::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 = Arcpro::Gossip::Script::GetInterface(TO_ITEM(qst_giver)); } else qst_giver = GetPlayer()->GetMapMgr()->_GetObject(guid); if(qst_giver != NULL) { if(guidtype == HIGHGUID_TYPE_UNIT) script = Arcpro::Gossip::Script::GetInterface(TO_CREATURE(qst_giver)); else if(guidtype == HIGHGUID_TYPE_GAMEOBJECT) script = Arcpro::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); }