本文整理汇总了C++中GCNPCResponse::setCode方法的典型用法代码示例。如果您正苦于以下问题:C++ GCNPCResponse::setCode方法的具体用法?C++ GCNPCResponse::setCode怎么用?C++ GCNPCResponse::setCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GCNPCResponse
的用法示例。
在下文中一共展示了GCNPCResponse::setCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
void ActionStashOpen::execute (Creature * pCreature1 , Creature * pCreature2)
throw(Error)
{
__BEGIN_TRY
Assert(pCreature1 != NULL);
Assert(pCreature2 != NULL);
Assert(pCreature1->isNPC());
Assert(pCreature2->isPC());
// 만일 플레이어가 아직 이 존에서 보관함에 관련된 OID를
// 할당받지 않았다면 여기서 할당해 준다.
if (pCreature2->isSlayer())
{
Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature2);
if (!pSlayer->getStashStatus()) pSlayer->registerStash();
}
else if (pCreature2->isVampire())
{
Vampire* pVampire = dynamic_cast<Vampire*>(pCreature2);
if (!pVampire->getStashStatus()) pVampire->registerStash();
}
else if (pCreature2->isOusters())
{
Ousters* pOusters = dynamic_cast<Ousters*>(pCreature2);
if (!pOusters->getStashStatus()) pOusters->registerStash();
}
GCNPCResponse okpkt;
okpkt.setCode(NPC_RESPONSE_INTERFACE_STASHOPEN);
pCreature2->getPlayer()->sendPacket(&okpkt);
__END_CATCH
}
示例3: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionShowWarSchedule::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);
GCWarScheduleList gcWarScheduleList;
if (g_pVariableManager->isWarActive()
&& makeGCWarScheduleList(&gcWarScheduleList, m_ZoneID ) )
{
pPC->getPlayer()->sendPacket(&gcWarScheduleList);
}
else
{
GCNPCResponse gcNPCResponse;
gcNPCResponse.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
}
__END_CATCH
}
示例4: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionWaitForMeetCouple::execute (Creature * pCreature1 , Creature * pCreature2)
throw(Error)
{
__BEGIN_TRY
Assert(pCreature1 != NULL);
Assert(pCreature2 != NULL);
Assert(pCreature1->isNPC());
Assert(pCreature2->isPC());
SYSTEM_RETURN_IF_NOT(SYSTEM_COUPLE);
NPC* pNPC = dynamic_cast<NPC*>(pCreature1);
Assert(pNPC != NULL);
// cout << "ActionWaitForMeeCouple(" << pNPC->getObjectID() << ")" << endl;
GCNPCResponse gcNPCResponse;
gcNPCResponse.setCode(NPC_RESPONSE_WAIT_FOR_MEET_COUPLE);
Player* pPlayer = pCreature2->getPlayer();
pPlayer->sendPacket(&gcNPCResponse);
__END_CATCH
}
示例5: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionCallHelicopter::execute (Creature * pCreature1, Creature * pCreature2)
throw(Error)
{
__BEGIN_TRY
Assert(pCreature1 != NULL);
Assert(pCreature2 != NULL);
Assert(pCreature1->isNPC());
Assert(pCreature2->isPC());
// 슬레이어만이 이 액션의 대상이 된다.
if (!pCreature2->isSlayer()) return;
if (pCreature2->isFlag(Effect::EFFECT_CLASS_HAS_FLAG) || pCreature2->isFlag(Effect::EFFECT_CLASS_HAS_SWEEPER)) return;
Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature2);
Assert(pSlayer != NULL);
// 슬레이어에게 이펙트를 걸어준다.
if (!pSlayer->isFlag(Effect::EFFECT_CLASS_SLAYER_PORTAL))
pSlayer->setFlag(Effect::EFFECT_CLASS_SLAYER_PORTAL);
Player* pPlayer = pCreature2->getPlayer();
Assert(pPlayer != NULL);
GCNPCResponse gcNPCResponse;
gcNPCResponse.setCode(NPC_RESPONSE_INTERFACE_HELICOPTER);
pPlayer->sendPacket(&gcNPCResponse);
__END_CATCH
}
示例6: execute
void CGRequestRepairHandler::execute (CGRequestRepair* pPacket , Player* pPlayer)
throw(ProtocolException , Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
Assert(pPacket != NULL);
Assert(pPlayer != NULL);
ObjectID_t ITEMOID = pPacket->getObjectID();
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Creature* pPC = pGamePlayer->getCreature();
bool bSlayer = false;
bool bVampire = false;
bool bOusters = false;
Item* pItem = NULL;
// 플레이어가 슬레이어인지 뱀파이어인지 구분.
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!");
if (ITEMOID == 0)
{
// ObjectID가 0이라면 모든 아이템을 수리하고자 하는 것이다.
executeAll(pPacket, pPlayer);
}
else
{
if (bSlayer) pItem = (dynamic_cast<Slayer*>(pPC))->findItemOID(ITEMOID);
else if (bVampire) pItem = (dynamic_cast<Vampire*>(pPC))->findItemOID(ITEMOID);
else if (bOusters) pItem = (dynamic_cast<Ousters*>(pPC))->findItemOID(ITEMOID);
// 플레이어가 아이템을 가지고 있다면
if (pItem != NULL)
{
// 그 아이템이 모터 사이클 키라면...
if (pItem->getItemClass() == Item::ITEM_CLASS_KEY && pItem->getItemType() == 2)
{
executeMotorcycle(pPacket, pPlayer);
return;
}
else executeNormal(pPacket, pPlayer);
}
else
{
// 아이템이 없으니, 당연히 수리할 수 없다.
GCNPCResponse response;
response.setCode(NPC_RESPONSE_REPAIR_FAIL_ITEM_NOT_EXIST);
pPlayer->sendPacket(&response);
}
}
#endif
__END_DEBUG_EX __END_CATCH
}
示例7: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionSilverCoating::execute (Creature * pCreature1 , Creature * pCreature2)
throw(Error)
{
__BEGIN_TRY
Assert(pCreature1 != NULL);
Assert(pCreature2 != NULL);
Assert(pCreature1->isNPC());
Assert(pCreature2->isPC());
GCNPCResponse okpkt;
okpkt.setCode(NPC_RESPONSE_INTERFACE_SILVER_COATING);
Player* pPlayer = pCreature2->getPlayer();
Assert(pPlayer != NULL);
pPlayer->sendPacket(&okpkt);
__END_CATCH
}
示例8: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionDownSkill::execute (Creature * pCreature1 , Creature * pCreature2)
throw(Error)
{
__BEGIN_TRY
Assert(pCreature1 != NULL);
Assert(pCreature2 != NULL);
Assert(pCreature1->isNPC());
Assert(pCreature2->isPC());
Player* pPlayer = pCreature2->getPlayer();
Assert(pPlayer != NULL);
GCNPCResponse okpkt;
okpkt.setCode(NPC_RESPONSE_DOWN_SKILL);
pPlayer->sendPacket(&okpkt);
__END_CATCH
}
示例9: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionDestroyGuild::execute (Creature * pCreature1 , Creature * pCreature2)
throw(Error)
{
__BEGIN_TRY
Assert(pCreature1 != NULL);
Assert(pCreature2 != NULL);
Assert(pCreature1->isNPC());
Assert(pCreature2->isPC());
SYSTEM_RETURN_IF_NOT(SYSTEM_GUILD);
Player* pPlayer = pCreature2->getPlayer();
Assert(pPlayer != NULL);
GCNPCResponse okpkt;
okpkt.setCode(NPC_RESPONSE_INTERFACE_DESTROY_GUILD);
pPlayer->sendPacket(&okpkt);
__END_CATCH
}
示例10: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionDenyReinforce::execute (Creature * pCreature1 , Creature * pCreature2)
throw(Error)
{
__BEGIN_TRY
#ifndef __OLD_GUILD_WAR__
Assert(pCreature1 != NULL);
Assert(pCreature2 != NULL);
Assert(pCreature1->isNPC());
Assert(pCreature2->isPC());
SYSTEM_RETURN_IF_NOT(SYSTEM_GUILD_WAR);
GCNPCResponse gcNPCResponse;
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);
GuildID_t guildID = pPC->getGuildID();
if (!g_pVariableManager->isWarActive() || !g_pVariableManager->isActiveGuildWar() )
{
gcNPCResponse.setCode(NPC_RESPONSE_WAR_UNAVAILABLE);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
return;
}
if (!g_pGuildManager->isGuildMaster(guildID, pPC ) )
{
gcNPCResponse.setCode(NPC_RESPONSE_NOT_GUILD_MASTER);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
return;
}
Zone* pZone = getZoneByZoneID(m_ZoneID);
Assert(pZone != NULL);
Assert(pZone->isCastle());
WarScheduler* pWarScheduler = pZone->getWarScheduler();
Assert(pWarScheduler != NULL);
CastleInfo* pCastleInfo = g_pCastleInfoManager->getCastleInfo(m_ZoneID);
GuildID_t ownerGuildID = pCastleInfo->getGuildID();
if (guildID != ownerGuildID )
{
gcNPCResponse.setCode(NPC_RESPONSE_NOT_YOUR_CASTLE);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
return;
}
Schedule* pNextSchedule = pWarScheduler->getRecentSchedule();
Work* pNextWork = NULL;
if (pNextSchedule != NULL ) pNextWork = pNextSchedule->getWork();
SiegeWar* pNextWar = dynamic_cast<SiegeWar*>(pNextWork);
if (pNextWar == NULL || pNextWar->recentReinforceCandidate() == 0 )
{
gcNPCResponse.setCode(NPC_RESPONSE_NO_WAR_REGISTERED);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
//SAFE_DELETE(pNextWar);
return;
}
else if (pNextWar->getReinforceGuildID() == 0 )
{
WarSchedule* pNextWarSchedule = dynamic_cast<WarSchedule*>(pNextSchedule);
Assert(pNextWarSchedule != NULL);
if (!pNextWar->denyReinforce() )
{
gcNPCResponse.setCode(NPC_RESPONSE_CANNOT_ACCEPT);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
//SAFE_DELETE(pNextWar);
return;
}
}
else
{
gcNPCResponse.setCode(NPC_RESPONSE_ALREADY_REINFORCE_ACCEPTED);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
//SAFE_DELETE(pNextWar);
return;
}
gcNPCResponse.setCode(NPC_RESPONSE_ACCEPT_OK);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
gcNPCResponse.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPC->getPlayer()->sendPacket(&gcNPCResponse);
return;
#endif
//.........这里部分代码省略.........
示例11: 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);
//.........这里部分代码省略.........
示例12: 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
}
示例13: 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
}
示例14: 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++)
{
//.........这里部分代码省略.........
示例15: execute
//.........这里部分代码省略.........
ZoneInfo* pZoneInfo = g_pZoneInfoManager->getZoneInfo(m_ZoneID);
// 유료존인데 유료사용자가 아니면...
if (pZoneInfo==NULL
|| pZoneInfo->isPayPlay() && !pGamePlayer->isPayPlaying())
{
string connectIP = pGamePlayer->getSocket()->getHost();
// 유료 서비스 사용이 가능한가?
if (pGamePlayer->loginPayPlay(connectIP, pGamePlayer->getID()))
{
sendPayInfo(pGamePlayer);
}
else if (!pGamePlayer->isFamilyFreePass() ) // 패밀리 프리 패스는 유료존으로 갈 수 있다.
{
// 유료 서비스 사용 불가인 경우
GCSystemMessage gcSystemMessage;
if (g_pConfig->getPropertyInt("IsNetMarble")==0)
{
gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CANNOT_ENTER_PAY_ZONE));
}
else
{
gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CANNOT_ENTER));
}
pGamePlayer->sendPacket (&gcSystemMessage);
bTransport = false;
}
}
} catch (NoSuchElementException&) {
}
#endif
if (bTransport)
{
if (m_ZoneID == 1410 )
{
if (pCreature->isFlag(Effect::EFFECT_CLASS_CAN_ENTER_GDR_LAIR ) )
{
Effect* pEffect = pCreature->findEffect(Effect::EFFECT_CLASS_CAN_ENTER_GDR_LAIR);
if (pEffect != NULL ) pEffect->setDeadline(0);
}
if (pCreature->isSlayer() )
{
Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
Assert(pSlayer != NULL);
// 오토바이를 타고 있으면 오토바이에서 내린다.
if (pSlayer->hasRideMotorcycle() )
{
pSlayer->getOffMotorcycle();
}
}
if (pCreature->isOusters() )
{
Ousters* pOusters = dynamic_cast<Ousters*>(pCreature);
Assert(pOusters != NULL);
// 실프 타고 있으면 내려준다
if (pOusters->isFlag(Effect::EFFECT_CLASS_SUMMON_SYLPH) )
{
Effect* pEffect = pOusters->findEffect(Effect::EFFECT_CLASS_SUMMON_SYLPH);
if (pEffect != NULL ) pEffect->setDeadline(0);
}
}
if (pCreature->isVampire() )
{
Vampire* pVampire = dynamic_cast<Vampire*>(pCreature);
Assert(pVampire != NULL);
if (pVampire->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_BAT) )
{
addUntransformCreature(pVampire->getZone(), pVampire, true);
}
}
}
if (pNPC != NULL )
{
pPC->getGQuestManager()->illegalWarp();
}
transportCreature(pCreature, m_ZoneID, m_X, m_Y, true);
}
else
{
GCNPCResponse response;
response.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pGamePlayer->sendPacket(&response);
}
__END_DEBUG
__END_CATCH
}