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


C++ CItemContainer::GetItem方法代码示例

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


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

示例1: RemoveMemberByName

void CLinkshell::RemoveMemberByName(int8* MemberName)
{
	PROFILE_FUNC();
	for (uint32 i = 0; i < members.size(); ++i) 
	{
		if (strcmp(MemberName, members.at(i)->GetName()) == 0)
		{
            CCharEntity* PMember = (CCharEntity*)members.at(i);

            CItemLinkshell* PItemLinkshell = (CItemLinkshell*)PMember->getStorage(LOC_INVENTORY)->GetItem(PMember->equip[SLOT_LINK]);

            if (PItemLinkshell != NULL && PItemLinkshell->isType(ITEM_LINKSHELL))
            {
                linkshell::DelOnlineMember(PMember, PItemLinkshell);

                PItemLinkshell->setSubType(ITEM_UNLOCKED);

                PMember->equip[SLOT_LINK] = 0;
                PMember->nameflags.flags &= ~FLAG_LINKSHELL;

                PMember->pushPacket(new CInventoryAssignPacket(PItemLinkshell, INV_NORMAL));
                PMember->pushPacket(new CLinkshellEquipPacket(PMember));
            }

			CItemContainer* Inventory = PMember->getStorage(LOC_INVENTORY);
            for (uint8 SlotID = 0; SlotID < Inventory->GetSize(); ++SlotID)
            {
                    CItemLinkshell* PItemLinkshell = (CItemLinkshell*)Inventory->GetItem(SlotID);

					if (PItemLinkshell != NULL && PItemLinkshell->isType(ITEM_LINKSHELL) && PItemLinkshell->GetLSID() == m_id)
		            {
                        const int8* Query = "UPDATE char_inventory SET itemid = (itemid+2) WHERE charid = %u AND location = %u AND slot = %u LIMIT 1";

                        Sql_Query(SqlHandle, Query, PMember->id, LOC_INVENTORY, SlotID);

                        PItemLinkshell->SetLSID(0);
                        PItemLinkshell->setID(PItemLinkshell->getID() + 2);

                        PMember->pushPacket(new CInventoryItemPacket(PItemLinkshell, LOC_INVENTORY, SlotID));
		            }
            }
	        
            charutils::SaveCharStats(PMember);
            charutils::SaveCharEquip(PMember);

            if (PMember->status == STATUS_NORMAL) PMember->status = STATUS_UPDATE;

            PMember->pushPacket(new CInventoryFinishPacket());
            PMember->pushPacket(new CCharUpdatePacket(PMember));
            PMember->pushPacket(new CMessageSystemPacket(0,0,109));
			return;
		} 
	}
}
开发者ID:bluekirby0,项目名称:darkstar,代码行数:54,代码来源:linkshell.cpp

示例2: ChangeMemberRank

void CLinkshell::ChangeMemberRank(int8* MemberName, uint8 toSack)
{
	PROFILE_FUNC();
	//topearl = 3
	//tosack = 2
	int newId = 512 + toSack;
	
    if (newId == 514 || newId == 515)
    {
	    for (uint32 i = 0; i < members.size(); ++i) 
	    {
		    if (strcmp(MemberName, members.at(i)->GetName()) == 0)
		    {
                CCharEntity* PMember = (CCharEntity*)members.at(i);

                CItemLinkshell* PItemLinkshell = (CItemLinkshell*)PMember->getStorage(LOC_INVENTORY)->GetItem(PMember->equip[SLOT_LINK]);

                if (PItemLinkshell != NULL && PItemLinkshell->isType(ITEM_LINKSHELL))
                {
				    PItemLinkshell->setID(newId);

                    PMember->pushPacket(new CInventoryAssignPacket(PItemLinkshell, INV_NORMAL));
                    PMember->pushPacket(new CLinkshellEquipPacket(PMember));
                }

			    CItemContainer* Inventory = PMember->getStorage(LOC_INVENTORY);
                for (uint8 SlotID = 0; SlotID < Inventory->GetSize(); ++SlotID)
                {
                        CItemLinkshell* PItemLinkshell = (CItemLinkshell*)Inventory->GetItem(SlotID);

					    if (PItemLinkshell != NULL && PItemLinkshell->isType(ITEM_LINKSHELL) && PItemLinkshell->GetLSID() == m_id)
		                {
                            const int8* Query = "UPDATE char_inventory SET itemid = %u WHERE charid = %u AND location = %u AND slot = %u LIMIT 1";
						    Sql_Query(SqlHandle, Query, PItemLinkshell->getID(),PMember->id, LOC_INVENTORY, SlotID);
						    Sql_Query(SqlHandle,"UPDATE accounts_sessions SET linkshellid = %u , linkshellrank = %u WHERE charid = %u", 
										    m_id,PItemLinkshell->GetLSType(), PMember->id);
                            PMember->pushPacket(new CInventoryItemPacket(PItemLinkshell, LOC_INVENTORY, SlotID));
		                }
                }
	        
                charutils::SaveCharStats(PMember);
                charutils::SaveCharEquip(PMember);

                if (PMember->status == STATUS_NORMAL) PMember->status = STATUS_UPDATE;

                PMember->pushPacket(new CInventoryFinishPacket());
                PMember->pushPacket(new CCharUpdatePacket(PMember));
			    return;
		    } 
	    }
    }
}
开发者ID:bluekirby0,项目名称:darkstar,代码行数:52,代码来源:linkshell.cpp

示例3: UpdateGuildsStock

void UpdateGuildsStock()
{
    for (std::vector<CItemContainer*>::iterator iter = g_PGuildList.begin(); iter != g_PGuildList.end(); iter++)
	{
		CItemContainer* PGuild = *iter;
        for(uint8 slotid = 1; slotid <= PGuild->GetSize(); ++slotid)
        {
            CItemShop* PItem = (CItemShop*)PGuild->GetItem(slotid);

			PItem->setBasePrice(PItem->getMinPrice() + ((float)(PItem->getStackSize() - PItem->getQuantity()) / PItem->getStackSize()) * (PItem->getMaxPrice() - PItem->getMinPrice()));

            if (PItem->IsDailyIncrease())
            {
                PItem->setQuantity(PItem->getQuantity() + PItem->getDailyIncrease());
            }
        }
	}
    ShowDebug(CL_CYAN"UpdateGuildsStock is finished\n" CL_RESET);
}
开发者ID:Annihilus343,项目名称:darkstar,代码行数:19,代码来源:guildutils.cpp

示例4: UpdateGuildsStock

void UpdateGuildsStock()
{
    for (std::vector<CItemContainer*>::iterator iter = g_PGuildList.begin(); iter != g_PGuildList.end(); iter++)
	{
		CItemContainer* PGuild = *iter;
        for(uint8 slotid = 1; slotid <= PGuild->GetSize(); ++slotid)
        {
            CItemShop* PItem = (CItemShop*)PGuild->GetItem(slotid);

            // TODO: сначала, анализируя текущее количество предметов, обновляем их стоимость

            if (PItem->IsDailyIncrease())
            {
                PItem->setQuantity(PItem->getQuantity() + PItem->getDailyIncrease());
            }

            //TODO: set price based on previous day stock
            PItem->setBasePrice(PItem->getMinPrice());
        }
	}
    ShowDebug(CL_CYAN"UpdateGuildsStock is finished\n" CL_RESET);
}
开发者ID:ZeDingo,项目名称:darkstar,代码行数:22,代码来源:guildutils.cpp


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