本文整理汇总了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;
}
}
}
示例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;
}
}
}
}
示例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);
}
示例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);
}