本文整理汇总了C++中NPC::getTaxRatio方法的典型用法代码示例。如果您正苦于以下问题:C++ NPC::getTaxRatio方法的具体用法?C++ NPC::getTaxRatio怎么用?C++ NPC::getTaxRatio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPC
的用法示例。
在下文中一共展示了NPC::getTaxRatio方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionSell::execute (Creature * pCreature1 , Creature * pCreature2)
throw(Error)
{
__BEGIN_TRY
Assert(pCreature1 != NULL);
Assert(pCreature2 != NULL);
Assert(pCreature1->isNPC());
Assert(pCreature2->isPC());
NPC* pNPC = dynamic_cast<NPC*>(pCreature1);
Player* pPlayer = pCreature2->getPlayer();
Assert(pPlayer != NULL);
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);
GCNPCResponse okpkt;
pPlayer->sendPacket(&okpkt);
GCShopVersion pkt;
pkt.setObjectID(pNPC->getObjectID());
pkt.setVersion(SHOP_RACK_NORMAL, pNPC->getShopVersion(SHOP_RACK_NORMAL));
pkt.setVersion(SHOP_RACK_SPECIAL, pNPC->getShopVersion(SHOP_RACK_SPECIAL));
pkt.setVersion(SHOP_RACK_MYSTERIOUS, pNPC->getShopVersion(SHOP_RACK_MYSTERIOUS));
int taxratio = pNPC->getTaxRatio(pPC);
if (taxratio != 100 ) pkt.setMarketCondSell(taxratio);
else pkt.setMarketCondSell(pNPC->getMarketCondSell());
pPlayer->sendPacket(&pkt);
__END_CATCH
}
示例2: execute
void CGShopRequestListHandler::execute(CGShopRequestList* pPacket , Player* pPlayer)
throw(ProtocolException , Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
Assert(pPacket != NULL);
Assert(pPlayer != NULL);
// 패킷에서 정보를 뽑아낸다.
ObjectID_t NPCID = pPacket->getObjectID();
ShopRackType_t type = pPacket->getRackType();
// 파라미터 및 패킷에서 뽑아낸 정보를 가공
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGamePlayer->getCreature());
Zone* pZone = pPC->getZone();
Creature* pNPCBase = NULL;
/*
try
{
pNPCBase = pZone->getCreature(NPCID);
}
catch (NoSuchElementException & nsee)
{
pNPCBase = NULL;
}
*/
// NoSuch제거. by sigi. 2002.5.2
pNPCBase = pZone->getCreature(NPCID);
if (pNPCBase == NULL || pNPCBase->isNPC() == false)
{
GCNPCResponse gcNPCResponse;
pPlayer->sendPacket(&gcNPCResponse);
return;
}
NPC* pNPC = dynamic_cast<NPC*>(pNPCBase);
if (type == SHOP_RACK_SPECIAL)
{
// 상품의 리스트를 패킷에다 작성한다.
GCShopList pkt;
pkt.setNPCShopType(pNPC->getShopType());
pkt.setObjectID(NPCID);
pkt.setShopVersion(pNPC->getShopVersion(type));
pkt.setShopType(type);
for (BYTE i=0; i<SHOP_RACK_INDEX_MAX; i++)
{
// 각각의 아이템 정보를 적는다.
Item* pItem = pNPC->getShopItem(type, i);
if (pItem != NULL) pkt.setShopItem(i, pItem);
}
pkt.setMarketCondBuy(pNPC->getMarketCondBuy());
// pkt.setMarketCondSell(pNPC->getMarketCondSell());
pkt.setMarketCondSell(pNPC->getTaxRatio(pPC));
// 패킷을 보내자.
pPlayer->sendPacket(&pkt);
}
else if (type == SHOP_RACK_MYSTERIOUS)
{
// 상품의 리스트를 패킷에다 작성한다.
GCShopListMysterious pkt;
pkt.setObjectID(NPCID);
pkt.setShopVersion(pNPC->getShopVersion(type));
pkt.setShopType(type);
for (BYTE i=0; i<SHOP_RACK_INDEX_MAX; i++)
{
// 각각의 아이템 정보를 적는다.
Item* pItem = pNPC->getShopItem(type, i);
if (pItem != NULL)
pkt.setShopItem(i, pItem);
}
pkt.setMarketCondBuy(pNPC->getMarketCondBuy());
// pkt.setMarketCondSell(pNPC->getMarketCondSell());
pkt.setMarketCondSell(pNPC->getTaxRatio(pPC));
// 패킷을 보내자.
pPlayer->sendPacket(&pkt);
}
else
{
throw ProtocolException("NORMAL shop item list not allowed!!!");
}
#endif
__END_DEBUG_EX __END_CATCH
}