本文整理汇总了C++中CCharEntity::getStorage方法的典型用法代码示例。如果您正苦于以下问题:C++ CCharEntity::getStorage方法的具体用法?C++ CCharEntity::getStorage怎么用?C++ CCharEntity::getStorage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCharEntity
的用法示例。
在下文中一共展示了CCharEntity::getStorage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CharAfterFinish
void CMagicState::CharAfterFinish()
{
if(m_PEntity->objtype != TYPE_PC)
{
return;
}
CCharEntity* PChar = (CCharEntity*)m_PEntity;
charutils::RemoveStratagems(PChar, m_PSpell);
charutils::UpdateHealth(PChar);
// only skill up if the effect landed
if(m_PSpell->tookEffect()){
charutils::TrySkillUP(PChar, (SKILLTYPE)m_PSpell->getSkillType(), m_PTarget->GetMLevel());
if (m_PSpell->getSkillType() == SKILL_SNG)
{
CItemWeapon* PItem = (CItemWeapon*)PChar->getStorage(LOC_INVENTORY)->GetItem(PChar->equip[SLOT_RANGED]);
if (PItem == NULL || PItem->isType(ITEM_ARMOR))
{
charutils::TrySkillUP(PChar, (SKILLTYPE)PItem->getSkillType(), m_PTarget->GetMLevel());
}
}
}
PChar->pushPacket(new CCharUpdatePacket(PChar));
// make wyvern use breath
if(PChar->PPet!=NULL && ((CPetEntity*)PChar->PPet)->getPetType() == PETTYPE_WYVERN)
{
((CAIPetDummy*)PChar->PPet->PBattleAI)->m_MasterCommand = MASTERCOMMAND_HEALING_BREATH;
PChar->PPet->PBattleAI->SetCurrentAction(ACTION_MOBABILITY_START);
}
SetHiPCLvl(m_PTarget, PChar->GetMLevel());
}