本文整理汇总了C++中LPCHARACTER::Save方法的典型用法代码示例。如果您正苦于以下问题:C++ LPCHARACTER::Save方法的具体用法?C++ LPCHARACTER::Save怎么用?C++ LPCHARACTER::Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPCHARACTER
的用法示例。
在下文中一共展示了LPCHARACTER::Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EndRunning
void PC::EndRunning()
{
// unlocked locked npc
{
LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
// npc АЦѕъґш °жїм
if (npc && !npc->IsPC())
{
// ±Ч їЈЗЗѕѕ°Ў іЄїЎ°Ф ¶фАО °жїм
if (ch->GetPlayerID() == npc->GetQuestNPCID())
{
npc->SetQuestNPCID(0);
sys_log(0, "QUEST NPC lock isn't unlocked : pid %u", ch->GetPlayerID());
CQuestManager::instance().WriteRunningStateToSyserr();
}
}
}
// commit data
if (HasReward())
{
Save();
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
if (ch != NULL) {
Reward(ch);
ch->Save();
}
}
m_bIsGivenReward = false;
if (m_iSendToClient)
{
sys_log(1, "QUEST end running %d", m_iSendToClient);
SendQuestInfoPakcet();
}
if (m_RunningQuestState == NULL) {
sys_log(0, "Entered PC::EndRunning() with invalid running quest state");
return;
}
QuestState * pOldState = m_RunningQuestState;
int iNowState = m_RunningQuestState->st;
m_RunningQuestState = 0;
if (m_iLastState != iNowState)
{
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
DWORD dwQuestIndex = CQuestManager::instance().GetQuestIndexByName(m_stCurQuest);
if (ch)
{
SetFlag(m_stCurQuest + ".__status", m_iLastState);
CQuestManager::instance().LeaveState(ch->GetPlayerID(), dwQuestIndex, m_iLastState);
pOldState->st = iNowState;
SetFlag(m_stCurQuest + ".__status", iNowState);
CQuestManager::instance().EnterState(ch->GetPlayerID(), dwQuestIndex, iNowState);
if (GetFlag(m_stCurQuest + ".__status") == iNowState)
CQuestManager::instance().Letter(ch->GetPlayerID(), dwQuestIndex, iNowState);
}
}
DoQuestStateChange();
}
示例2: Buy
int CShopEx::Buy(LPCHARACTER ch, BYTE pos)
{
BYTE tabIdx = pos / SHOP_HOST_ITEM_MAX_NUM;
BYTE slotPos = pos % SHOP_HOST_ITEM_MAX_NUM;
if (tabIdx >= GetTabCount())
{
sys_log(0, "ShopEx::Buy : invalid position %d : %s", pos, ch->GetName());
return SHOP_SUBHEADER_GC_INVALID_POS;
}
sys_log(0, "ShopEx::Buy : name %s pos %d", ch->GetName(), pos);
GuestMapType::iterator it = m_map_guest.find(ch);
if (it == m_map_guest.end())
return SHOP_SUBHEADER_GC_END;
TShopTableEx& shopTab = m_vec_shopTabs[tabIdx];
TShopItemTable& r_item = shopTab.items[slotPos];
if (r_item.price <= 0)
{
LogManager::instance().HackLog("SHOP_BUY_GOLD_OVERFLOW", ch);
return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;
}
DWORD dwPrice = r_item.price;
switch (shopTab.coinType)
{
case SHOP_COIN_TYPE_GOLD:
if (it->second) // if other empire, price is triple
dwPrice *= 3;
if (ch->GetGold() < (int) dwPrice)
{
sys_log(1, "ShopEx::Buy : Not enough money : %s has %d, price %d", ch->GetName(), ch->GetGold(), dwPrice);
return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY;
}
break;
case SHOP_COIN_TYPE_SECONDARY_COIN:
{
int count = ch->CountSpecifyTypeItem(ITEM_SECONDARY_COIN);
if (count < dwPrice)
{
sys_log(1, "ShopEx::Buy : Not enough myeongdojun : %s has %d, price %d", ch->GetName(), count, dwPrice);
return SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY_EX;
}
}
break;
}
LPITEM item;
item = ITEM_MANAGER::instance().CreateItem(r_item.vnum, r_item.count);
if (!item)
return SHOP_SUBHEADER_GC_SOLD_OUT;
int iEmptyPos;
if (item->IsDragonSoul())
{
iEmptyPos = ch->GetEmptyDragonSoulInventory(item);
}
else
{
iEmptyPos = ch->GetEmptyInventory(item->GetSize());
}
if (iEmptyPos < 0)
{
sys_log(1, "ShopEx::Buy : Inventory full : %s size %d", ch->GetName(), item->GetSize());
M2_DESTROY_ITEM(item);
return SHOP_SUBHEADER_GC_INVENTORY_FULL;
}
switch (shopTab.coinType)
{
case SHOP_COIN_TYPE_GOLD:
ch->PointChange(POINT_GOLD, -dwPrice, false);
break;
case SHOP_COIN_TYPE_SECONDARY_COIN:
ch->RemoveSpecifyTypeItem(ITEM_SECONDARY_COIN, dwPrice);
break;
}
if (item->IsDragonSoul())
item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
else
item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
ITEM_MANAGER::instance().FlushDelayedSave(item);
LogManager::instance().ItemLog(ch, item, "BUY", item->GetName());
if (item->GetVnum() >= 80003 && item->GetVnum() <= 80007)
{
LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), PERSONAL_SHOP_BUY, "");
}
//.........这里部分代码省略.........