当前位置: 首页>>代码示例>>C++>>正文


C++ Item::Create方法代码示例

本文整理汇总了C++中Item::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ Item::Create方法的具体用法?C++ Item::Create怎么用?C++ Item::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


在下文中一共展示了Item::Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateItem

Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, uint32 randomPropertyId)
{
    if (count < 1)
        return nullptr;                                        // don't create item at zero count

    if (ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(item))
    {
        if (count > pProto->GetMaxStackSize())
            count = pProto->GetMaxStackSize();

        MANGOS_ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");

        Item* pItem = NewItemOrBag(pProto);
        if (pItem->Create(sObjectMgr.GenerateItemLowGuid(), item, player))
        {
            pItem->SetCount(count);
            if (uint32 randId = randomPropertyId ? randomPropertyId : Item::GenerateItemRandomPropertyId(item))
                pItem->SetItemRandomProperties(randId);

            return pItem;
        }
        else
            delete pItem;
    }
    return nullptr;
}
开发者ID:killerwife,项目名称:mangos-tbc,代码行数:26,代码来源:Item.cpp

示例2: CreateItem

Item* Item::CreateItem(uint32 item, uint32 count, Player const* player )
{
    if (count < 1 )
        return NULL;                                        //don't create item at zero count

    ItemPrototype const *pProto = objmgr.GetItemPrototype(item);
    if (pProto )
    {
        if (count > pProto->Stackable )
            count = pProto->Stackable;

        assert(count !=0 && "pProto->Stackable==0 but checked at loading already");

        Item *pItem = NewItemOrBag(pProto);
        if (pItem->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM), item, player) )
        {
            pItem->SetCount(count);
            return pItem;
        }
        else
            delete pItem;
    }
    else
        assert(false);
    return NULL;
}
开发者ID:Zekom,项目名称:NeoCore,代码行数:26,代码来源:Item.cpp

示例3: CreateItem

Item* Item::CreateItem( uint32 item, uint32 count, Player const* player )
{
    if (count < 1)
        return NULL;                                        //don't create item at zero count

    if (ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item))
    {
        if (count > pProto->GetMaxStackSize())
            count = pProto->GetMaxStackSize();

        MANGOS_ASSERT(count !=0 && "pProto->Stackable==0 but checked at loading already");

        Item *pItem = NewItemOrBag( pProto );
        if (pItem->Create(sObjectMgr.GenerateItemLowGuid(), item, player) )
        {
            /** World of Warcraft Armory **/
            if (sWorld.getConfig(CONFIG_BOOL_ARMORY_SUPPORT))
            {
                if (pProto->Quality > 2 && pProto->Flags != 2048 && (pProto->Class == ITEM_CLASS_WEAPON || pProto->Class == ITEM_CLASS_ARMOR) && player)
                {
                    std::ostringstream ss;
                    sLog.outDetail("WoWArmory: write feed log (guid: %u, type: 2, data: %u)", player->GetGUIDLow(), item);
                    ss << "REPLACE INTO armory_character_feed_log (guid, type, data, date, counter, item_guid) VALUES (" << player->GetGUIDLow() << ", 2, " << item << ", UNIX_TIMESTAMP(NOW()), 1," << pItem->GetGUIDLow()  << ")";
                    CharacterDatabase.PExecute( ss.str().c_str() );
                }
            }
            /** World of Warcraft Armory **/
            pItem->SetCount( count );
            return pItem;
        }
        else
            delete pItem;
    }
    return NULL;
}
开发者ID:Seehub,项目名称:mangos,代码行数:35,代码来源:Item.cpp

示例4: CreateItem

Item* Item::CreateItem(uint32 item, uint32 count, Player const* player)
{
    if (count < 1)
        return NULL;                                        //don't create item at zero count

    ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
    if (pProto)
    {
        if (count > pProto->GetMaxStackSize())
            count = pProto->GetMaxStackSize();

        ASSERT(count !=0 && "pProto->Stackable == 0 but checked at loading already");

        Item* pItem = NewItemOrBag(pProto);
        if (pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player))
        {
            pItem->SetCount(count);
            return pItem;
        }
        else
            delete pItem;
    }
    else
        ASSERT(false);
    return NULL;
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例5: CreateItem

Item* Item::CreateItem(uint32 item, uint32 count, Player const* player)
{
    if (count < 1)
        return NULL;                                        //don't create item at zero count

    ItemPrototype const *pProto = objmgr.GetItemPrototype(item);
    if (pProto)
    {
        if (count > pProto->GetMaxStackSize())
            count = pProto->GetMaxStackSize();

        if (pProto->Quality > 2 && pProto->Flags != 2048 && (pProto->Class == ITEM_CLASS_WEAPON || pProto->Class == ITEM_CLASS_ARMOR) && player)
        {
            /* WoWArmory Feed Log */
            std::ostringstream ss;
            sLog.outDetail("WoWArmory: write feed log (guid: %u, type: 2, data: %u", player->GetGUIDLow(), item);
            ss << "REPLACE INTO character_feed_log (guid, type, data, counter) VALUES (" << player->GetGUIDLow() << ", 2, " << item << ", 1)";
            CharacterDatabase.PExecute( ss.str().c_str() );
        }
		assert(count !=0 && "pProto->Stackable == 0 but checked at loading already");

        Item *pItem = NewItemOrBag(pProto);
        if (pItem->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM), item, player))
        {
            pItem->SetCount(count);
            return pItem;
        }
        else
            delete pItem;
    }
    else
        assert(false);
    return NULL;
}
开发者ID:VenT,项目名称:wow,代码行数:34,代码来源:Item.cpp

示例6: CreateItem

Item* Item::CreateItem(uint32 itemEntry, uint32 count, Player const* player)
{
    if (count < 1)
        return NULL;                                        //don't create item at zero count

    ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
    if (proto)
    {
        if (count > proto->GetMaxStackSize())
            count = proto->GetMaxStackSize();

        ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");

        Item* item = NewItemOrBag(proto);
        if (item->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), itemEntry, player))
        {
            item->SetCount(count);
            return item;
        }
        else
            delete item;
    }
    else
        ABORT();
    return NULL;
}
开发者ID:deathkayn,项目名称:Core-W,代码行数:26,代码来源:Item.cpp

示例7: HandleMailCreateTextItem

//used when player copies mail body to his inventory
void WorldSession::HandleMailCreateTextItem(WorldPackets::Mail::MailCreateTextItem& packet)
{
    if (!CanOpenMailBox(packet.Mailbox))
        return;

    Player* player = _player;

    Mail* m = player->GetMail(packet.MailID);
    if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr) || (m->checked & MAIL_CHECK_MASK_COPIED))
    {
        player->SendMailResult(packet.MailID, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
        return;
    }

    Item* bodyItem = new Item;                              // This is not bag and then can be used new Item.
    if (!bodyItem->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), MAIL_BODY_ITEM_TEMPLATE, player))
    {
        delete bodyItem;
        return;
    }

    // in mail template case we need create new item text
    if (m->mailTemplateId)
    {
        MailTemplateEntry const* mailTemplateEntry = sMailTemplateStore.LookupEntry(m->mailTemplateId);
        if (!mailTemplateEntry)
        {
            player->SendMailResult(packet.MailID, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
            return;
        }

        bodyItem->SetText(mailTemplateEntry->Body->Str[GetSessionDbcLocale()]);
    }
    else
        bodyItem->SetText(m->body);

    if (m->messageType == MAIL_NORMAL)
        bodyItem->SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid::Create<HighGuid::Player>(m->sender));

    bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_READABLE);

    ItemPosCountVec dest;
    uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, bodyItem, false);
    if (msg == EQUIP_ERR_OK)
    {
        m->checked = m->checked | MAIL_CHECK_MASK_COPIED;
        m->state = MAIL_STATE_CHANGED;
        player->m_mailsUpdated = true;

        player->StoreItem(dest, bodyItem, true);
        player->SendMailResult(packet.MailID, MAIL_MADE_PERMANENT, MAIL_OK);
    }
    else
    {
        player->SendMailResult(packet.MailID, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
        delete bodyItem;
    }
}
开发者ID:Regigicas,项目名称:TrinityCore,代码行数:59,代码来源:MailHandler.cpp

示例8: HandleMailCreateTextItem

/**
 * Handles the packet sent by the client when he copies the body a mail to his inventory.
 *
 * When a player copies the body of a mail to his inventory this method is called. It will create
 * a new item with the text of the mail and store it in the players inventory (if possible).
 *
 */
void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
{
    ObjectGuid mailboxGuid;
    uint32 mailId;

    recv_data >> mailboxGuid;
    recv_data >> mailId;
    recv_data.read_skip<uint32>();                          // mailTemplateId, non need, Mail store own 100% correct value anyway

    if (!CheckMailBox(mailboxGuid))
        return;

    ForwardPacketToMaster();
    MasterPlayer* pl = GetMasterPlayer();
    ASSERT(pl);
    Player* loadedPlayer = _player;

    Mail* m = pl->GetMail(mailId);
    if (!m || (!m->itemTextId && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL) || m->checked & MAIL_CHECK_MASK_COPIED)
    {
        pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
        return;
    }

    uint32 itemTextId = m->itemTextId;

    Item *bodyItem = new Item;                              // This is not bag and then can be used new Item.
    if (!bodyItem->Create(sObjectMgr.GenerateItemLowGuid(), MAIL_BODY_ITEM_TEMPLATE, pl->GetObjectGuid()))
    {
        delete bodyItem;
        return;
    }

    bodyItem->SetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID, itemTextId);
    bodyItem->SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HIGHGUID_PLAYER, m->sender));

    DETAIL_LOG("HandleMailCreateTextItem mailid=%u", mailId);

    ItemPosCountVec dest;
    uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, bodyItem, false);
    if (msg == EQUIP_ERR_OK)
    {
        m->checked = m->checked | MAIL_CHECK_MASK_COPIED;
        m->state = MAIL_STATE_CHANGED;
        pl->MarkMailsUpdated();

        loadedPlayer->StoreItem(dest, bodyItem, true);
        pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_OK);
    }
    else
    {
        pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
        delete bodyItem;
    }
}
开发者ID:Maduse,项目名称:server,代码行数:62,代码来源:MailHandler.cpp

示例9: HandleMailCreateTextItem

/**
 * Handles the packet sent by the client when he copies the body a mail to his inventory.
 *
 * When a player copies the body of a mail to his inventory this method is called. It will create
 * a new item with the text of the mail and store it in the players inventory (if possible).
 *
 */
void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
{
    uint64 mailbox;
    uint32 mailId;

    recv_data >> mailbox;
    recv_data >> mailId;
    recv_data.read_skip<uint32>();                          // mailTemplateId, non need, Mail store own 100% correct value anyway

    if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
        return;

    Player *pl = _player;

    Mail* m = pl->GetMail(mailId);
    if (!m || (!m->itemTextId && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
    {
        pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
        return;
    }

    uint32 itemTextId = m->itemTextId;

    Item *bodyItem = new Item;                              // This is not bag and then can be used new Item.
    if(!bodyItem->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, pl))
    {
        delete bodyItem;
        return;
    }

    bodyItem->SetUInt32Value( ITEM_FIELD_ITEM_TEXT_ID, itemTextId );
    bodyItem->SetUInt32Value( ITEM_FIELD_CREATOR, m->sender);

    sLog.outDetail("HandleMailCreateTextItem mailid=%u",mailId);

    ItemPosCountVec dest;
    uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, bodyItem, false );
    if( msg == EQUIP_ERR_OK )
    {
        m->itemTextId = 0;
        m->state = MAIL_STATE_CHANGED;
        pl->m_mailsUpdated = true;

        pl->StoreItem(dest, bodyItem, true);
        //bodyItem->SetState(ITEM_NEW, pl); is set automatically
        pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_OK);
    }
    else
    {
        pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
        delete bodyItem;
    }
}
开发者ID:dythzer,项目名称:mangoszero,代码行数:60,代码来源:Mail.cpp

示例10: HandleAddItemCommand

bool ChatHandler::HandleAddItemCommand(const char* args)
{
    
    WorldPacket data;

    if (!*args)  
        return false;

    char* citemid = strtok((char*)args, " ");
    char* cPos = strtok(NULL, " ");
    char* cVal = strtok(NULL, " ");

    uint32 itemid=atol(citemid);

    Player*    pl = m_session->GetPlayer();
    bool   slotfree=false;
    uint8  i,slot;
    uint32 Pos=5,Val=1;
    

    for(i =    INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END;    i++)
    {
        if (pl->GetItemBySlot(i) == NULL)
        {
            slot = i;
            slotfree=true;
            break;
        }
    }
    if (slotfree)
    {
        Item *item = new Item();    
        item->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM),    itemid, pl);

		if (!item)
			return true;
        
        
        if ((cPos) && (cVal)){
            Pos=(uint32)atol(cPos);
            Val=(uint32)atol(cVal);
            
            item->SetUInt32Value( Pos, Val );
        }

        pl->AddItemToSlot(    slot, item );
    }else{
        FillSystemMessageData(&data, m_session, "Bag is full.");
        m_session->SendPacket(&data);
    }

    return true;
}
开发者ID:Artea,项目名称:mangos-svn,代码行数:53,代码来源:Level3.cpp

示例11: HandleMailCreateTextItem

void WorldSession::HandleMailCreateTextItem(WorldPacket	& recv_data	)
{
	uint32 unk1,unk2,mailid;

	recv_data >> unk1 >> unk2 >> mailid;

	sLog.outString("Mail:: CreateTextItem unk1=%d,unk2=%d,mailid=%d",unk1,unk2,mailid);

	uint32 sbit2=5;
	bool   slotfree=false;
	WorldPacket	Data;
	uint8 i,slot;

	Player*	pl = GetPlayer();
	//Item *item = new Item();

	for(i =	INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END;	++i)
	{
		if (GetPlayer()->GetItemBySlot(i) == NULL)
		{
			slot = i;
			slotfree=true;
			break;
		}
	}
	if (slotfree)
	{
		Item *item = new Item();
		//item->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM), itemid, GetPlayer());
		
		// fix me
		// you need	to create a	litter item	to database	and	add	this item pagetext id and pagetext
		item->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM),	889, GetPlayer());
		GetPlayer()->AddItemToSlot(	slot, item );

		Data.Initialize(SMSG_SEND_MAIL_RESULT);
		Data <<	uint32(mailid);
		Data <<	uint32(sbit2);
		Data <<	uint32(0);
		SendPacket(&Data);	  //delete mail	copy
	}
	else
	{ 
		Data.Initialize(SMSG_SEND_MAIL_RESULT);
		Data <<	uint32(mailid);
		Data <<	uint32(0);
		Data <<	uint32(1);
		SendPacket(&Data);	 //error, bag is full
	}
    
}
开发者ID:vata,项目名称:prebcwow,代码行数:51,代码来源:Mail.cpp

示例12: HandleAutostoreLootItemOpcode

void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
{
    uint8 slot = 0;
    uint32 itemid = 0;
    uint8 lootSlot = 0;
    WorldPacket data;
#ifndef ENABLE_GRID_SYSTEM
    Creature* pCreature = objmgr.GetObject<Creature>(GetPlayer()->GetLootGUID());
#else
    Creature* pCreature = ObjectAccessor::Instance().GetCreature(*_player, _player->GetLootGUID());
#endif
    if (!pCreature)
        return;

    recv_data >> lootSlot;
    lootSlot -=1;                                 //to prevent Slot 0 from been used "Still Rolling for item fix"


    slot = GetPlayer()->FindFreeItemSlot(INVTYPE_SLOT_ITEM);

    if (slot == INVENTORY_SLOT_ITEM_END)
    {
        // Our User doesn't have a free Slot in there bag
        data.Initialize( SMSG_INVENTORY_CHANGE_FAILURE );
        data << uint8(48);                        // Inventory Full
        data << uint64(0);
        data << uint64(0);
        data << uint8(0);
        SendPacket( &data );
        return;
    }

    if (pCreature->getItemAmount(lootSlot) == 0)  //Can't sell the item for cash
        return;

    itemid = pCreature->getItemId(lootSlot);
    pCreature->setItemAmount(lootSlot, 0);

    Item *item = new Item();
    ASSERT(item);

    item->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM), itemid, GetPlayer());
    GetPlayer()->AddItemToSlot(slot, item);

    data.Initialize( SMSG_LOOT_REMOVED );
    data << uint8(lootSlot+1);
    SendPacket( &data );

}
开发者ID:Artea,项目名称:mangos-svn,代码行数:49,代码来源:MiscHandler.cpp

示例13: createItemUpdate

void ItemHandler::createItemUpdate (NetworkPacket *data, GameClient *pClient, int invcount)
{
    UpdateMask invUpdateMask;

    invUpdateMask.SetLength (64);
    Item *tempitem = new Item;

    invUpdateMask.SetBit (OBJECT_FIELD_GUID);
    invUpdateMask.SetBit (OBJECT_FIELD_GUID+1);
    invUpdateMask.SetBit (OBJECT_FIELD_TYPE);
    invUpdateMask.SetBit (OBJECT_FIELD_ENTRY);
    invUpdateMask.SetBit (OBJECT_FIELD_SCALE_X);
    invUpdateMask.SetBit (OBJECT_FIELD_PADDING);
    invUpdateMask.SetBit (ITEM_FIELD_OWNER);
    invUpdateMask.SetBit (ITEM_FIELD_CONTAINED);
    invUpdateMask.SetBit (ITEM_FIELD_OWNER +1);
    invUpdateMask.SetBit (ITEM_FIELD_CONTAINED +1);
    invUpdateMask.SetBit (ITEM_FIELD_STACK_COUNT);
    tempitem->Create(pClient->getCurrentChar()->getGuidBySlot(invcount),pClient->getCurrentChar()->getItemIdBySlot(invcount));
    tempitem->setUpdateValue (OBJECT_FIELD_GUID,
        pClient->getCurrentChar()->getGuidBySlot(invcount),
        invUpdateMask.data);
    tempitem->setUpdateValue (OBJECT_FIELD_GUID+1, 0x00000040,
        invUpdateMask.data);
    tempitem->setUpdateValue (OBJECT_FIELD_TYPE, 0x00000003,
        invUpdateMask.data);
    tempitem->setUpdateValue (OBJECT_FIELD_ENTRY,
        pClient->getCurrentChar()->getItemIdBySlot(invcount),
        invUpdateMask.data);
    tempitem->setUpdateFloatValue (OBJECT_FIELD_SCALE_X, 1.0f,
        invUpdateMask.data);
    tempitem->setUpdateValue (OBJECT_FIELD_PADDING, 0xeeeeeeee,
        invUpdateMask.data);
    tempitem->setUpdateValue (ITEM_FIELD_OWNER,
        pClient->getCurrentChar()->GetGUID().sno,
        invUpdateMask.data);
    tempitem->setUpdateValue (ITEM_FIELD_CONTAINED,
        pClient->getCurrentChar()->GetGUID().sno,
        invUpdateMask.data);
    tempitem->setUpdateValue (ITEM_FIELD_OWNER + 1, 0,
        invUpdateMask.data);
    tempitem->setUpdateValue (ITEM_FIELD_CONTAINED + 1, 0,
        invUpdateMask.data);
    tempitem->setUpdateValue (ITEM_FIELD_STACK_COUNT, 1,
        invUpdateMask.data);

    tempitem->CreateObject(&invUpdateMask, data, 0);
}
开发者ID:madhatternc,项目名称:mangos2,代码行数:48,代码来源:ItemHandler.cpp

示例14: HandleMailCreateTextItem

//used when player copies mail body to his inventory
void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
{
    CHECK_PACKET_SIZE(recv_data,8+4);

    uint64 mailbox;
    uint32 mailId;

    recv_data >> mailbox >> mailId;

    Player *pl = _player;

    Mail* m = pl->GetMail(mailId);
    if(!m || !m->itemTextId || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
    {
        pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
        return;
    }

    Item *bodyItem = new Item;                              // This is not bag and then can be used new Item.
    if(!bodyItem->Create(objmgr.GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, pl))
    {
        delete bodyItem;
        return;
    }

    bodyItem->SetUInt32Value( ITEM_FIELD_ITEM_TEXT_ID , m->itemTextId );
    bodyItem->SetUInt32Value( ITEM_FIELD_CREATOR, m->sender);

    sLog.outDetail("HandleMailCreateTextItem mailid=%u",mailId);

    ItemPosCountVec dest;
    uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, bodyItem, false );
    if( msg == EQUIP_ERR_OK )
    {
        m->itemTextId = 0;
        m->state = MAIL_STATE_CHANGED;
        pl->m_mailsUpdated = true;

        pl->StoreItem(dest, bodyItem, true);
        //bodyItem->SetState(ITEM_NEW, pl); is set automatically
        pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, 0);
    }
    else
    {
        pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_BAG_FULL, msg);
        delete bodyItem;
    }
}
开发者ID:megamage,项目名称:mangos,代码行数:49,代码来源:Mail.cpp

示例15: CreateItemAndMailToPlayer

		bool CreateItemAndMailToPlayer(Player *pPlayer, uint32 itemId)
		{
			Item *pItem = new Item();
			if(pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), itemId, pPlayer) == false)
				return false;

			MailSender toSend(MAIL_NORMAL, pPlayer->GetGUIDLow(), MAIL_STATIONERY_GM);
			SQLTransaction trans = CharacterDatabase.BeginTransaction();
			pItem->SaveToDB(trans);

			MailDraft mailDraft(REQUESTER_DEFAULT_MAIL_SUBJECT, REQUESTER_DEFAULT_MAIL_BODY);
			mailDraft.AddItem(pItem);
			mailDraft.SendMailTo(trans, MailReceiver(pPlayer), toSend);
			CharacterDatabase.CommitTransaction(trans);
			return true;
		}
开发者ID:Erotix8210,项目名称:prydevserv_backup,代码行数:16,代码来源:item_reguester.cpp


注:本文中的Item::Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。