本文整理汇总了C++中PlayerCreature::decreaseGoldEx方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCreature::decreaseGoldEx方法的具体用法?C++ PlayerCreature::decreaseGoldEx怎么用?C++ PlayerCreature::decreaseGoldEx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCreature
的用法示例。
在下文中一共展示了PlayerCreature::decreaseGoldEx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例2: execute
//.........这里部分代码省略.........
// ServerID_t serverID;
// ZoneID_t zoneID;
// bool bHasCastle = g_pGuildManager->hasCastle(guildID , serverID , zoneID);
// if (bHasCastle && serverID == g_pConfig->getPropertyInt("ServerID" ) && zoneID == m_ZoneID )
CastleInfo* pCastleInfo = g_pCastleInfoManager->getCastleInfo(m_ZoneID);
GuildID_t ownerGuildID = pCastleInfo->getGuildID();
if (guildID == ownerGuildID )
{
gcNPCResponse.setCode(NPC_RESPONSE_ALREADY_HAS_CASTLE);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
return;
}
// 이미 전쟁 신청을 했는가?
if (g_pGuildManager->hasWarSchedule(guildID ) )
{
gcNPCResponse.setCode(NPC_RESPONSE_WAR_ALREADY_REGISTERED);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
return;
}
// 전쟁 스케쥴이 다 찼는가?
/* if (!pWarScheduler->canAddWar(WAR_GUILD ) )
{
gcNPCResponse.setCode(NPC_RESPONSE_WAR_SCHEDULE_FULL);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
return;
}
GuildWar* pWar = new GuildWar(m_ZoneID, guildID, War::WAR_STATE_WAIT);
pWar->setRegistrationFee(warRegistrationFee);
if (!pWarScheduler->addWar(pWar ) )
{
gcNPCResponse.setCode(NPC_RESPONSE_WAR_SCHEDULE_FULL);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
SAFE_DELETE(pWar);
return;
}*/
Schedule* pNextSchedule = pWarScheduler->getRecentSchedule();
Work* pNextWork = NULL;
if (pNextSchedule != NULL ) pNextWork = pNextSchedule->getWork();
SiegeWar* pNextWar = dynamic_cast<SiegeWar*>(pNextWork);
if (pNextWar == NULL )
{
pNextWar = new SiegeWar(m_ZoneID, War::WAR_STATE_WAIT);
pNextWar->addRegistrationFee(warRegistrationFee);
pNextWar->addChallengerGuild(guildID);
if (!pWarScheduler->addWar(pNextWar ) )
{
gcNPCResponse.setCode(NPC_RESPONSE_WAR_SCHEDULE_FULL);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
SAFE_DELETE(pNextWar);
return;
}
}
else if (pNextWar->getChallengerGuildCount() < 5 )
{
WarSchedule* pNextWarSchedule = dynamic_cast<WarSchedule*>(pNextSchedule);
Assert(pNextWarSchedule != NULL);
pNextWar->addRegistrationFee(warRegistrationFee);
pNextWar->addChallengerGuild(guildID);
pNextWarSchedule->save();
}
else
{
gcNPCResponse.setCode(NPC_RESPONSE_WAR_SCHEDULE_FULL);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
// SAFE_DELETE(pNextWar);
return;
}
pPC->decreaseGoldEx(warRegistrationFee);
GCModifyInformation gcMI;
gcMI.addLongData(MODIFY_GOLD, pPC->getGold());
pPC->getPlayer()->sendPacket(&gcMI);
gcNPCResponse.setCode(NPC_RESPONSE_WAR_REGISTRATION_OK);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
return;
#endif
__END_CATCH
}