I've been trying to get this working for a while now with no success. Considering i don't know much if anything when it comes to C++, i wanted to see if someone would be willing to help me get a working compile.
I'm trying to create an item with the warper gossip script along with the option to browse and buy PvP Rewards through a vendor window. This is what i've come up with so far.
Code:
case 59:
{ //PvP Vendor
Plr->GetSession()->SendInventoryList(pCreature);
}break;
{if(AutoSend)
Menu->SendTo(Plr);
{
if(!unit->HasItems())
{
sChatHandler.BlueSystemMessageToPlr(_player, "No sell template found. Report this to devs: %d (%s)", unit->GetEntry(), unit->GetCreatureName()->Name);
return;
}
WorldPacket data(((unit->GetSellItemCount() * 28) + 9)); // allocate
data.SetOpcode( SMSG_LIST_INVENTORY );
data << unit->GetGUID(30090);
data << uint8(); // placeholder for item count
ItemPrototype * curItem;
uint32 counter = 0;
for(std::vector<CreatureItem>::iterator itr = unit->GetSellItemBegin(); itr != unit->GetSellItemEnd(); ++itr)
{
if(itr->itemid)
{
if((curItem = ItemPrototypeStorage.LookupEntry(itr->itemid)))
{
data << (counter + 1);
data << curItem->ItemId;
data << curItem->DisplayInfoID;
data << (int32)(-1); //we dont suport this kind of buy, make them infinite
data << GetBuyPriceForItem(curItem, abs(itr->amount), abs(itr->amount));
data << uint32(0x00);
data << (int16)itr->amount;
data << uint16(0x00);
++counter;
}
}
}
const_cast<uint8*>(data.contents())[8] = (uint8)counter; // set count
SendPacket( &data );
sLog.outDetail( "WORLD: Sent SMSG_LIST_INVENTORY" );
}
void Warper::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupWarper(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new Warper();
mgr->register_item_gossip_script(60001,gs);
}
Thanks in advance.