本文整理汇总了C++中PlayerCreature::getStashNum方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCreature::getStashNum方法的具体用法?C++ PlayerCreature::getStashNum怎么用?C++ PlayerCreature::getStashNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCreature
的用法示例。
在下文中一共展示了PlayerCreature::getStashNum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
void CGStashRequestBuyHandler::execute (CGStashRequestBuy* pPacket , Player* pPlayer)
throw(ProtocolException , Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
__BEGIN_DEBUG
#ifdef __GAME_SERVER__
Assert(pPacket != NULL);
Assert(pPlayer != NULL);
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Creature* pPC = pGamePlayer->getCreature();
PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pPC);
BYTE curStashNum = pPlayerCreature->getStashNum();
// 가지고 있는 보관함이 맥스라면 리턴
if (curStashNum >= STASH_RACK_MAX)
{
GCNPCResponse failpkt;
failpkt.setCode(NPC_RESPONSE_STASH_SELL_FAIL_MAX);
pPlayer->sendPacket(&failpkt);
return;
}
Price_t price = g_pPriceManager->getStashPrice(curStashNum+1);
// 돈이 모자라도 실패쥐.
if (pPlayerCreature->getGold() < price)
{
GCNPCResponse failpkt;
failpkt.setCode(NPC_RESPONSE_STASH_SELL_FAIL_MONEY);
pPlayer->sendPacket(&failpkt);
return;
}
// 보관함 갯수를 한 칸 늘려주고...
pPlayerCreature->setStashNumEx(curStashNum+1);
// 돈을 줄인다.
//pPlayerCreature->setGoldEx(pPlayerCreature->getGold() - price);
// by sigi. 2002.9.4
pPlayerCreature->decreaseGoldEx(price);
// 마지막으로 OK 패킷을 날려준다.
GCNPCResponse okpkt;
okpkt.setCode(NPC_RESPONSE_STASH_SELL_OK);
pPlayer->sendPacket(&okpkt);
#endif
__END_DEBUG
__END_DEBUG_EX __END_CATCH
}