当前位置: 首页>>代码示例>>C++>>正文


C++ GCNPCResponse::setParameter方法代码示例

本文整理汇总了C++中GCNPCResponse::setParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ GCNPCResponse::setParameter方法的具体用法?C++ GCNPCResponse::setParameter怎么用?C++ GCNPCResponse::setParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GCNPCResponse的用法示例。


在下文中一共展示了GCNPCResponse::setParameter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: execute

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionShowTaxBalance::execute (Creature * pCreature1 , Creature * pCreature2) 
	throw(Error)
{
	__BEGIN_TRY

	Assert(pCreature1 != NULL);
	Assert(pCreature2 != NULL);
	Assert(pCreature1->isNPC());
	Assert(pCreature2->isPC());

	bool bSuccess = true;

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);

	Player* pPlayer = pPC->getPlayer();
	Assert(pPlayer != NULL);

	GuildID_t guildID = pPC->getGuildID();
	GCNPCResponse deny;

	Guild* pGuild = g_pGuildManager->getGuild(guildID);
	if(bSuccess && pGuild == NULL ) 
	{
		// 길드가 없다.
		bSuccess = false;
		deny.setCode(NPC_RESPONSE_NO_GUILD);
	}

	if(bSuccess && pGuild->getMaster() != pPC->getName() )
	{
		// 길드 마스터가 아니다.
		bSuccess = false;
		deny.setCode(NPC_RESPONSE_NOT_GUILD_MASTER);
	}

	// 길드 마스터이다.
	list<CastleInfo*> pCastleInfoList = g_pCastleInfoManager->getGuildCastleInfos(guildID);
	if(bSuccess && pCastleInfoList.empty() )
	{
		// 길드가 소유한 성이 없다.
		bSuccess = false;
		deny.setCode(NPC_RESPONSE_HAS_NO_CASTLE);
	}

    list<CastleInfo*>::iterator itr = pCastleInfoList.begin();
    CastleInfo* pCastleInfo = NULL;

	for (; itr != pCastleInfoList.end() ; itr++ )
	{
		if ((*itr)->getZoneID() == pCreature1->getZoneID() )
		{
			pCastleInfo = (*itr);
			break;
		}
	}

	if(bSuccess && pCastleInfo == NULL)
	{
		bSuccess = false;
		deny.setCode(NPC_RESPONSE_NOT_YOUR_CASTLE);
	}

	if (bSuccess )
	{
		GCNPCResponse response;
		response.setCode(NPC_RESPONSE_SHOW_TAX_BALANCE);
		response.setParameter((uint)pCastleInfo->getTaxBalance());
		pPlayer->sendPacket(&response);
	}
	else
	{
		pPlayer->sendPacket(&deny);
	}
	
	GCNPCResponse quit;
	quit.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
	pPlayer->sendPacket(&quit);

	__END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:83,代码来源:ActionShowTaxBalance.cpp

示例2: execute

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionRewardEventQuest::execute (Creature * pCreature1 , Creature * pCreature2)
throw(Error)
{
    __BEGIN_TRY

    Assert(pCreature1 != NULL);
    Assert(pCreature2 != NULL);
    Assert(pCreature1->isNPC());
    Assert(pCreature2->isPC());

    PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);
    Assert(pPC != NULL);

    if (pPC->getQuestItem() != NULL )
    {
        TPOINT pt;

        Item* pItem = pPC->getQuestItem();
        if (pItem == NULL || !pPC->getInventory()->getEmptySlot(pItem, pt ) )
        {
            GCNPCResponse gcNPCResponse;
            gcNPCResponse.setCode(NPC_RESPONSE_QUEST);
            gcNPCResponse.setParameter(COMPLETE_FAIL_NO_INVENTORY_SPACE);
            pPC->getPlayer()->sendPacket(&gcNPCResponse);

            return;
        }

        if (pPC->getInventory()->addItem(pItem, pt ) )
        {
            pPC->setQuestItem(NULL);
            pPC->getZone()->registerObject(pItem);

            pItem->create(pPC->getName(), STORAGE_INVENTORY, 0, pt.x, pt.y);
            if (pItem->isUnique() || pItem->isTimeLimitItem() )
            {
                pPC->addTimeLimitItem(pItem, 604800);
                pPC->sendTimeLimitItemInfo();
            }

            GCCreateItem gcCreateItem;
            makeGCCreateItem(&gcCreateItem, pItem, pt.x, pt.y);
            pPC->getPlayer()->sendPacket(&gcCreateItem);

            GCNPCResponse gcNPCResponse;
            gcNPCResponse.setCode(NPC_RESPONSE_QUEST);
            gcNPCResponse.setParameter(COMPLETE_SUCCESS);
            pPC->getPlayer()->sendPacket(&gcNPCResponse);

            remainTraceLog(pItem, pCreature1->getName(), pCreature2->getName(), ITEM_LOG_CREATE, DETAIL_EVENTNPC);
            return;
        }
        else
        {
            GCNPCResponse gcNPCResponse;
            gcNPCResponse.setCode(NPC_RESPONSE_QUEST);
            gcNPCResponse.setParameter(COMPLETE_FAIL_NO_INVENTORY_SPACE);
            pPC->getPlayer()->sendPacket(&gcNPCResponse);
            return;
        }

    }

    int questLevel = pPC->getQuestManager()->getEventQuestAdvanceManager()->getQuestLevel();
    ScriptID_t sID = m_ScriptID[ questLevel ];
    QuestID_t qID;

    if (!pPC->getQuestManager()->successEventQuest(questLevel, qID ) ) sID = m_CounterScriptID;
    if (pPC->getQuestManager()->getEventQuestAdvanceManager()->getStatus(questLevel) == EventQuestAdvance::EVENT_QUEST_INIT &&
            questLevel > 1 ) sID = m_CancelScriptID;

    GCNPCAsk gcNPCAsk;
    gcNPCAsk.setObjectID(pCreature1->getObjectID());
    gcNPCAsk.setScriptID(sID);
    gcNPCAsk.setNPCID(dynamic_cast<NPC*>(pCreature1)->getNPCID());

    Player* pPlayer = pCreature2->getPlayer();
    pPlayer->sendPacket(&gcNPCAsk);

    __END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:84,代码来源:ActionRewardEventQuest.cpp

示例3: execute

void CGSelectQuestHandler::execute (CGSelectQuest* pPacket , Player* pPlayer)
	 throw(Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
		
#ifdef __GAME_SERVER__

	GamePlayer* pGP = dynamic_cast<GamePlayer*>(pPlayer);
	Assert(pGP != NULL);
		
	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGP->getCreature());

	GCNPCResponse gcNPCR;
	gcNPCR.setCode(NPC_RESPONSE_QUEST);

	Creature* pCreature = pPC->getZone()->getCreature(pPacket->getNPCObjectID());
	if (pCreature == NULL || !pCreature->isNPC() )
	{
		gcNPCR.setParameter((uint)START_FAIL_CANNOT_APPLY_QUEST);
		pPlayer->sendPacket(&gcNPCR);

		return;
	}

	NPC* pNPC = dynamic_cast<NPC*>(pCreature);
	if (pNPC == NULL )
	{
		gcNPCR.setParameter((uint)START_FAIL_CANNOT_APPLY_QUEST);
		pPlayer->sendPacket(&gcNPCR);

		return;
	}

	QuestInfoManager* pQIM = pNPC->getQuestInfoManager();
	if (pQIM == NULL )
	{
		gcNPCR.setParameter((uint)START_FAIL_CANNOT_APPLY_QUEST);
		pPlayer->sendPacket(&gcNPCR);

		return;
	}

	pPC->getQuestManager()->adjustQuestStatus();
	QuestMessage code = pQIM->startQuest(pPacket->getQuestID(), pPC);

	list<QuestID_t> qList;
	pQIM->getEventQuestIDs(pPC->getQuestManager()->getEventQuestAdvanceManager()->getQuestLevel(), pPC, back_inserter(qList));

	gcNPCR.setParameter((uint)code);

	if (!pQIM->isEventQuest(pPacket->getQuestID() ) )
		pPlayer->sendPacket(&gcNPCR);

	if (code == START_SUCCESS )
	{
		pPC->sendCurrentQuestInfo();

		//cout << "Quest 시작 " << pPC->getName() << " " << pPacket->getQuestID() << endl;
	}
	else
	{
		//cout << "Quest 시작 실패 " << pPC->getName() << " " << (int)code << endl;
	}

#endif	// __GAME_SERVER__
		
	__END_DEBUG_EX __END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:68,代码来源:CGSelectQuestHandler.cpp

示例4: execute


//.........这里部分代码省略.........
	// 플레이어가 코팅하려고 하는 아이템을 가지고 있는지 검사
	if (bSlayer)
	{
		pSlayer     = dynamic_cast<Slayer*>(pPC);
		playerMoney = pSlayer->getGold();
		pItem       = pSlayer->findItemOID(ITEMOID, storage, X, Y);
	}
	else
	{
		pVampire    = dynamic_cast<Vampire*>(pPC);
		playerMoney = pVampire->getGold();
		pItem       = pVampire->findItemOID(ITEMOID, storage, X, Y);
	}

	// 아이템이 없다면 당연히 코팅할 수 없다.
	if (pItem == NULL)
	{
		response.setCode(NPC_RESPONSE_SILVER_COATING_FAIL_ITEM_NOT_EXIST);
		pPlayer->sendPacket(&response);
		return;
	}

	// 코팅하려는 아이템이 코팅될 수 없는 아이템이라면...
	switch (pItem->getItemClass())
	{
		case Item::ITEM_CLASS_BLADE:
		case Item::ITEM_CLASS_SWORD:
		case Item::ITEM_CLASS_CROSS:
		case Item::ITEM_CLASS_MACE:
			break;
		default:
			response.setCode(NPC_RESPONSE_SILVER_COATING_FAIL_ITEM_TYPE);
			pPlayer->sendPacket(&response);
			return;
	}

	coatingPrice = g_pPriceManager->getSilverCoatingPrice(pItem);
	if (coatingPrice > playerMoney)
	{
		response.setCode(NPC_RESPONSE_SILVER_COATING_FAIL_MONEY);
		pPlayer->sendPacket(&response);
		return;
	}

	// 최대 은 도금량을 얻어와서... 도금한다.
	ItemInfo* pItemInfo = g_pItemInfoManager->getItemInfo(pItem->getItemClass(), pItem->getItemType());
	pItem->setSilver(pItemInfo->getMaxSilver());

	// 돈을 줄인다.
	if (bSlayer)
	{
		//pSlayer->setGoldEx(playerMoney - coatingPrice);

		// by sigi. 2002.9.4
		pSlayer->decreaseGoldEx(coatingPrice);
		//log(LOG_REPAIR_ITEM, pSlayer->getName(), "", pItem->toString());
	}
	else
	{
		//pVampire->setGoldEx(playerMoney - coatingPrice);

		// by sigi. 2002.9.4
		pVampire->decreaseGoldEx(coatingPrice);
		//log(LOG_REPAIR_ITEM, pVampire->getName(), "", pItem->toString());
	}

	// silver만 저장하면 된다.
	// 아이템 저장 최적화. by sigi. 2002.5.13
	char pField[80];
	sprintf(pField, "Silver=%d", pItem->getSilver());
	pItem->tinysave(pField);

	// 아이템을 은으로 코팅했다는 정보를 DB에다가 저장해준다.
	// 단 분명히 STORAGE_STASH가 돌아올 수 있지만, 
	// 보관함에 있는 것을 수리한다는 것은 말이 안 되므로,
	// 저장하지 않는다.
	/*
	switch (storage)
	{
		case STORAGE_INVENTORY:
			pItem->save(pPC->getName(), STORAGE_INVENTORY, 0, X, Y);
			break;
		case STORAGE_GEAR:
			if (bSlayer) pItem->save(pSlayer->getName(),  STORAGE_GEAR, 0, X, 0);
			else         pItem->save(pVampire->getName(), STORAGE_GEAR, 0, X, 0);
			break;
		default:
			break;
	}
	*/

	// OK 패킷을 날려준다.
	response.setCode(NPC_RESPONSE_SILVER_COATING_OK);
	response.setParameter(playerMoney-coatingPrice);
	pPlayer->sendPacket(&response);
	
#endif

	__END_DEBUG_EX __END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:101,代码来源:CGSilverCoatingHandler.cpp

示例5: execute

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionGiveLotto::execute (Creature * pCreature1 , Creature * pCreature2) 
	throw(Error)
{
	__BEGIN_TRY

	Assert(pCreature1 != NULL);
	Assert(pCreature2 != NULL);
	Assert(pCreature1->isNPC());
	Assert(pCreature2->isPC());

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);
	Assert(pPC != NULL);

	QuestID_t	qID;
	int questLevel = m_QuestLevel;

	if (questLevel < 0 ) questLevel = pPC->getQuestManager()->getEventQuestAdvanceManager()->getQuestLevel() - 1;

	//cout << "Activated : " << toString() << " ... " << pPC->getName() << " ...  " << questLevel << endl;

	EventQuestAdvance::Status status = pPC->getQuestManager()->getEventQuestAdvanceManager()->getStatus(questLevel);
	int ownerQuestLevel = pPC->getQuestManager()->getEventQuestAdvanceManager()->getQuestLevel();

	if (
		(ownerQuestLevel > questLevel && status == EventQuestAdvance::EVENT_QUEST_ADVANCED )
	||	((questLevel == 4 && ownerQuestLevel == -1 ) || pPC->getQuestManager()->successEventQuest(questLevel, qID ) )
	)
	{
		GamePlayer* pGP = dynamic_cast<GamePlayer*>(pPC->getPlayer());
		Assert (pGP != NULL);

//		if (g_pConfig->getPropertyInt("IsNetMarble" ) || !pGP->isPayPlaying() )
		if (true )
		{
			pPC->getQuestManager()->getEventQuestAdvanceManager()->rewarded(questLevel);
			pPC->getQuestManager()->getEventQuestAdvanceManager()->save();
			if (questLevel != 4 )
				pPC->getQuestManager()->questRewarded(qID);
			else
				pPC->getQuestManager()->cancelQuest();

			pPC->setLottoQuestLevel(questLevel);

			list<Item*> iList;
			pPC->getInventory()->clearQuestItem(iList);

			list<Item*>::iterator itr = iList.begin();
			list<Item*>::iterator endItr = iList.end();

			for (; itr != endItr ; ++itr )
			{
				GCDeleteInventoryItem gcDII;
				gcDII.setObjectID((*itr)->getObjectID());
				pPC->getPlayer()->sendPacket(&gcDII);
				(*itr)->destroy();
				SAFE_DELETE(*itr);
			}

			iList.clear();

			CGLotterySelect	cgLS;
			cgLS.setType(TYPE_FINISH_SCRATCH);
			cgLS.setQuestLevel(0);
			cgLS.setGiftID(0);
			CGLotterySelectHandler::execute(&cgLS, pPC->getPlayer());
//			cgLS.execute(pPC->getPlayer());

		}
		else
		{
			Player* pPlayer = pCreature2->getPlayer();
	//		pPlayer->sendPacket(&gcSM);

			GCNPCResponse gcNPCResponse;
			gcNPCResponse.setCode(NPC_RESPONSE_LOTTERY);
			gcNPCResponse.setParameter((uint)questLevel);

			pPlayer->sendPacket(&gcNPCResponse);

			filelog("EventQuest.log","ActionGiveLotto : %d to %s", questLevel, pPC->getName().c_str());
		}
	}

	GCNPCResponse gcNPCResponse;
	gcNPCResponse.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
	pPC->getPlayer()->sendPacket(&gcNPCResponse);

	__END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:92,代码来源:ActionGiveLotto.cpp

示例6: executeNormal


//.........这里部分代码省略.........
			pVampire->initAllStatAndSend();
			pVampire->sendRealWearingInfo();
		}
		else if (bOusters && pOusters != NULL )
		{
			pOusters->initAllStatAndSend();
			pOusters->sendRealWearingInfo();
		}
	}

	// 돈을 줄인다.
	if (bSlayer)
	{
		//pSlayer->setGoldEx(playerMoney-repairPrice);
		// by sigi. 2002.9.4
		pSlayer->decreaseGoldEx(repairPrice);
		//log(LOG_REPAIR_ITEM, pSlayer->getName(), "", pItem->toString());
	}
	else if (bVampire)
	{
		// by sigi. 2002.9.4
		pVampire->decreaseGoldEx(repairPrice);
		//log(LOG_REPAIR_ITEM, pVampire->getName(), "", pItem->toString());
	}
	else if (bOusters)
	{
		// by sigi. 2002.9.4
		pOusters->decreaseGoldEx(repairPrice);
		//log(LOG_REPAIR_ITEM, pOusters->getName(), "", pItem->toString());
	}

	// 아이템을 수리했다는 정보를 DB에다가 저장해준다.
	// 단 분명히 STORAGE_STASH가 돌아올 수 있지만, 
	// 보관함에 있는 것을 수리한다는 것은 말이 안 되므로,
	// 저장하지 않는다.


	// item저장 최적화. by sigi. 2002.5.17
	if (repairPrice>0)
	{
		char pField[80];

		if (pItem->getItemClass()==Item::ITEM_CLASS_SLAYER_PORTAL_ITEM)
		{
			SlayerPortalItem* pSPItem = dynamic_cast<SlayerPortalItem*>(pItem);
			sprintf(pField, "Charge=%d", pSPItem->getCharge());
		}
		else if (pItem->getItemClass()==Item::ITEM_CLASS_OUSTERS_SUMMON_ITEM)
		{
			OustersSummonItem* pOSItem = dynamic_cast<OustersSummonItem*>(pItem);
			sprintf(pField, "Charge=%d", pOSItem->getCharge());
		}
		else
		{
			sprintf(pField, "Durability=%d", pItem->getDurability());
		}

		pItem->tinysave(pField);
	}

	/*
	// 뭐가 됐든.. durability만 바꾸면 된다.
	// 근데.. ItemObject에 Durability field가 없는 것도 있고
	// Charge를 저장해야 하는 것도 있다.
	// 그래서.. 일단은 모두 다 저장하는 save를 이용하도록 한다.
	switch (storage)
	{
		case STORAGE_INVENTORY:
		{
			pItem->save(pPC->getName(), STORAGE_INVENTORY, 0, X, Y);
		}
		break;

		case STORAGE_GEAR:
		{
			if (bSlayer) 
			{
				pItem->save(pSlayer->getName(),  STORAGE_GEAR, 0, X, 0);
			}
			else         
			{
				pItem->save(pVampire->getName(), STORAGE_GEAR, 0, X, 0);
			}
		}
		break;

		default:
			break;
	}
	*/

	// OK 패킷을 날려준다.
	response.setCode(NPC_RESPONSE_REPAIR_OK);
	response.setParameter(playerMoney-repairPrice);
	pPlayer->sendPacket(&response);

#endif

	__END_DEBUG_EX __END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:101,代码来源:CGRequestRepairHandler.cpp

示例7: executeAll

//////////////////////////////////////////////////////////////////////////////
// 모든 아이템 수리하기
//////////////////////////////////////////////////////////////////////////////
void CGRequestRepairHandler::executeAll(CGRequestRepair* pPacket , Player* pPlayer)
	 throw(ProtocolException , Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

	Creature*     pPC         = dynamic_cast<GamePlayer*>(pPlayer)->getCreature();
	Price_t       repairPrice = 0;
	GCNPCResponse response;

	bool bSendRealWearingInfo = false;

	if (pPC->isSlayer())
	{
		Slayer* pSlayer = dynamic_cast<Slayer*>(pPC);

		// 모든 아이템을 합한 수리비를 계산한다.
		for (int i=0; i<Slayer::WEAR_MAX; i++)
		{
			Item* pItem = pSlayer->getWearItem((Slayer::WearPart)i);
			if (pItem != NULL)
			{
				if (i == Slayer::WEAR_RIGHTHAND && isTwohandWeapon(pItem))
				{
					// 오른손이고, 현재 들고 있는 무기가 양손 무기라면...
					// 수리 가격에 포함시킬 필요가 없다.
				}
				else
				{
					repairPrice += g_pPriceManager->getRepairPrice(pItem);
				}
			}
		}

		// 돈이 모자라다면 리턴한다.
		if (pSlayer->getGold() < repairPrice)
		{
			response.setCode(NPC_RESPONSE_REPAIR_FAIL_MONEY);
			pPlayer->sendPacket(&response);
			return;
		}

		// 각각의 아이템을 수리하고, DB에 저장한다.
		char pField[80];

		for (int i=0; i<Slayer::WEAR_MAX; i++)
		{
			Item* pItem = pSlayer->getWearItem((Slayer::WearPart)i);
			if (pItem != NULL)
			{
				if (i == Slayer::WEAR_RIGHTHAND && isTwohandWeapon(pItem))
				{
					// 오른손이고, 현재 들고 있는 무기가 양손 무기라면...
					// 수리할 필요가 없다.
				}
				else if (isRepairableItem(pItem ) )
				{
					Durability_t oldDurability = pItem->getDurability();
					repairItem(pItem);
					if (pItem->getDurability() != oldDurability)
					{
						// DB 쿼리를 줄이기 위해서
						// 내구도의 변화가 생긴 경우에만 세이브한다.
						//pItem->save(pSlayer->getName(), STORAGE_GEAR, 0, i, 0);
						// item저장 최적화. by sigi. 2002.5.13
						sprintf(pField, "Durability=%d", pItem->getDurability());
						pItem->tinysave(pField);
					}

					if (oldDurability == 0 )
						bSendRealWearingInfo = true;
				}
			}
		}

		// 돈을 줄이고...
		//pSlayer->setGoldEx(pSlayer->getGold() - repairPrice);

		// by sigi.2002.9.4
		pSlayer->decreaseGoldEx(repairPrice);

		// 로그를 남긴다.
		//log(LOG_REPAIR_ITEM, pSlayer->getName(), "", "ALL");

		// OK 패킷을 날려준다.
		response.setCode(NPC_RESPONSE_REPAIR_OK);
		response.setParameter(pSlayer->getGold());
		pPlayer->sendPacket(&response);
	}
	else if (pPC->isVampire())
	{
		Vampire* pVampire = dynamic_cast<Vampire*>(pPC);

		// 모든 아이템을 합한 수리비를 계산한다.
		for (int i=0; i<Vampire::VAMPIRE_WEAR_MAX; i++)
		{
//.........这里部分代码省略.........
开发者ID:hillwah,项目名称:darkeden,代码行数:101,代码来源:CGRequestRepairHandler.cpp

示例8: executeMotorcycle

//////////////////////////////////////////////////////////////////////////////
// 모터 사이클을 처리한다.
//////////////////////////////////////////////////////////////////////////////
void CGRequestRepairHandler::executeMotorcycle (CGRequestRepair* pPacket , Player* pPlayer)
	 throw(ProtocolException , Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

	// 패킷 정보를 뽑아낸다.
	ObjectID_t      ITEMOID     = pPacket->getObjectID();
	Creature*       pPC         = dynamic_cast<GamePlayer*>(pPlayer)->getCreature();
	Zone*           pZone       = pPC->getZone();
	Gold_t          playerMoney = 0;
	ZoneCoord_t     CenterX     = pPC->getX();
	ZoneCoord_t     CenterY     = pPC->getY();
	Item*           pItem       = NULL;
	bool            bSlayer     = false;
	bool            bVampire    = false;
	bool            bOusters    = false;
	GCNPCResponse   response;
	
	// 플레이어가 슬레이어인지 뱀파이어인지 구분.
	if (pPC->isSlayer())       bSlayer = true;
	else if (pPC->isVampire()) bVampire = true;
	else if (pPC->isOusters()) bOusters = true;
	else throw ProtocolException("CGRequestRepairHandler::execute() : Unknown player creature!");

	// 플레이어가 수리하려고 하는 아이템을 가지고 있는지 
	// 상위에서 검사를 하기 때문에, pItem이 널일리는 없다.
	if (bSlayer)
	{
		pItem       = (dynamic_cast<Slayer*>(pPC))->findItemOID(ITEMOID);
		playerMoney = (dynamic_cast<Slayer*>(pPC))->getGold();
	}
	else if (bVampire)
	{
		pItem       = (dynamic_cast<Vampire*>(pPC))->findItemOID(ITEMOID);
		playerMoney = (dynamic_cast<Vampire*>(pPC))->getGold();
	}
	else if (bOusters)
	{
		pItem       = (dynamic_cast<Ousters*>(pPC))->findItemOID(ITEMOID);
		playerMoney = (dynamic_cast<Ousters*>(pPC))->getGold();
	}

	// 주위 일정 범위를 검색해서, 모터 사이클이 있는지 확인한다.
	for (ZoneCoord_t zx=CenterX-5; zx<=CenterX+5; zx++)
	{
		for (ZoneCoord_t zy=CenterY-5; zy<=CenterY+5; zy++)
		{
			if (!isValidZoneCoord(pZone, zx, zy)) continue;

			Tile & tile = pZone->getTile(zx, zy);

			if (tile.hasItem())
			{
				Item* pItemOnTile = tile.getItem();
				Assert(pItemOnTile != NULL);

				// 만일 아이템이 타일 위에 있을 경우, 모터 사이클인지 확인한다.
				if (pItemOnTile->getItemClass() == Item::ITEM_CLASS_MOTORCYCLE)
				{
					DWORD    targetID     = dynamic_cast<Key*>(pItem)->getTarget();
					ItemID_t motorcycleID = pItemOnTile->getItemID();

					if (targetID == motorcycleID)
					{
						Price_t repairPrice = g_pPriceManager->getRepairPrice(pItemOnTile);

						if (repairPrice > playerMoney)
						{
							response.setCode(NPC_RESPONSE_REPAIR_FAIL_MONEY);
							pPlayer->sendPacket(&response);
							return;
						}

						// 수리한다.
						repairItem(pItemOnTile);

						// 저장한다.
						//pItemOnTile->save(pPC->getName(), STORAGE_ZONE, pZone->getZoneID(), zx, zy);
						// item저장 최적화. by sigi. 2002.5.13
						char pField[80];
						sprintf(pField, "Durability=%d", pItemOnTile->getDurability());
						pItemOnTile->tinysave(pField);


						// 돈을 줄인다.
						//if (bSlayer) (dynamic_cast<Slayer*>(pPC))->setGoldEx(playerMoney-repairPrice);
						//else         (dynamic_cast<Vampire*>(pPC))->setGoldEx(playerMoney-repairPrice);

						// by sigi. 2002.9.4
						(dynamic_cast<PlayerCreature*>(pPC))->decreaseGoldEx(repairPrice);

						response.setCode(NPC_RESPONSE_REPAIR_OK);
						response.setParameter(playerMoney-repairPrice);
						pPlayer->sendPacket(&response);

//.........这里部分代码省略.........
开发者ID:hillwah,项目名称:darkeden,代码行数:101,代码来源:CGRequestRepairHandler.cpp


注:本文中的GCNPCResponse::setParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。