예제 #1
0
VOID ServerExchangeBox::Init(Obj_Human* pHuman)
{
	__ENTER_FUNCTION
	m_pMySelf = pHuman;

	//清空物品数据
	memset(m_ItemList, 0, sizeof(_ITEM)*EXCHANGE_BOX_SIZE);
	memset(m_PetItemList, 0, sizeof(_PET_DB_LOAD)*EXCHANGE_PET_BOX_SIZE);

	//初始化物品container
	_ITEMCONTAINER_INIT	containInit;
	containInit.m_nContainerSize	=	EXCHANGE_BOX_SIZE;
	m_Container.Init(&containInit);

	for(UINT i=0;i<EXCHANGE_BOX_SIZE;i++)
	{
		_ITEM_INIT	itemInit(&m_ItemList[i]);
		m_Container.GetItem(i)->Init(&itemInit);
	}
 
	//初始化宠物container
	_ITEMCONTAINER_INIT	PetContainInit;
	PetContainInit.m_nContainerSize		=	EXCHANGE_PET_BOX_SIZE;
	m_PetContainer.Init(&PetContainInit);

	for(UINT i = 0 ;i<EXCHANGE_PET_BOX_SIZE;i++)
	{
		_ITEM_INIT itemInit(&m_PetItemList[i]);
		m_PetContainer.GetItem(i)->Init(&itemInit);
	}

	CleanUp();
	__LEAVE_FUNCTION
}
예제 #2
0
VOID ServerStallBox::Init(Obj_Human* pHuman)
{
	__ENTER_FUNCTION
	m_pMySelf = pHuman;

//	Assert(pHuman->getScene());
//	m_pStallInfoMgr = pHuman->getScene()->GetStallInfoManager();

	//清空物品数据
	memset(m_ItemList, 0, sizeof(_ITEM)*STALL_BOX_SIZE);
	memset(m_PetItemList, 0, sizeof(_PET_DB_LOAD)*STALL_PET_BOX_SIZE);

	//初始化container
	_ITEMCONTAINER_INIT	containInit;
	containInit.m_nContainerSize	=	STALL_BOX_SIZE;
	m_Container.Init(&containInit);

	for(int i=0;i<STALL_BOX_SIZE;i++)
	{
		_ITEM_INIT	itemInit(&m_ItemList[i]);
		m_Container.GetItem(i)->Init(&itemInit);
	}

	//初始化宠物container
	_ITEMCONTAINER_INIT	PetContainInit;
	PetContainInit.m_nContainerSize		=	STALL_PET_BOX_SIZE;
	m_PetContainer.Init(&PetContainInit);

	for(UINT i = 0 ;i<STALL_PET_BOX_SIZE;i++)
	{
		_ITEM_INIT itemInit(&m_PetItemList[i]);
		m_PetContainer.GetItem(i)->Init(&itemInit);
	}

	m_nFirstPage = 0;

	CleanUp();

	__LEAVE_FUNCTION
}
예제 #3
0
파일: item.c 프로젝트: gastonb/R1EMU
Item *itemNew(uint64_t itemId, uint32_t itemType, uint32_t amount, uint32_t inventoryIndex) {

    Item *self;

    if ((self = calloc(1, sizeof(Item))) == NULL) {
        return NULL;
    }

    if (!itemInit(self, itemId, itemType, amount, inventoryIndex)) {
        itemDestroy(&self);
        error("Item failed to initialize.");
        return NULL;
    }

    return self;
}
예제 #4
0
Obj_ItemBox::Obj_ItemBox()
{
__ENTER_FUNCTION
		
		Item	itemIterator;

		_ITEMCONTAINER_INIT	containInit;
		containInit.m_nContainerSize	=	MAX_BOXITEM_NUMBER;
		m_Container.Init(&containInit);
		
		for(int i=0;i<MAX_BOXITEM_NUMBER;i++)
		{
			_ITEM_INIT	itemInit(&m_ItemList[i]);
			m_Container.GetItem(i)->Init(&itemInit);
		}

__LEAVE_FUNCTION
}