本文整理汇总了C++中GCNPCResponse类的典型用法代码示例。如果您正苦于以下问题:C++ GCNPCResponse类的具体用法?C++ GCNPCResponse怎么用?C++ GCNPCResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GCNPCResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: throw
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
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
}
示例2: throw
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: throw
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
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: throw
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
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
}
示例5: throw
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
}
示例6: throw
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
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
}
示例7: throw
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
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
}
示例8: throw
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
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
}
示例9: throw
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
}
示例10: throw
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
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: throw
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
}
示例12: throw
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
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: throw
//.........这里部分代码省略.........
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
}
示例14: throw
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
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
}
示例15: throw
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionGiveEventItem::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);
Player* pPlayer = pPC->getPlayer();
Assert(pPlayer != NULL);
Inventory* pInventory = pPC->getInventory();
Assert(pInventory != NULL);
Zone* pZone = pPC->getZone();
Assert(pZone != NULL);
FlagSet* pFlagSet = pPC->getFlagSet();
Item::ItemClass ItemClass;
ItemType_t ItemType;
OptionType_t OptionType;
OptionType_t OptionType2;
Item* pItem;
// 이벤트 진행 기간이 아닌 경우
if (!g_pVariableManager->isActiveGiveEventItem())
{
GCNPCResponse response;
response.setCode(NPC_RESPONSE_GIVE_EVENT_ITEM_FAIL_NOW);
pPlayer->sendPacket(&response);
GCNPCResponse quit;
quit.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPlayer->sendPacket(&quit);
return;
}
// 이 값과 관련해서
// 캐릭터 생성시에 FlagSet을 바꿔줘야한다. (default ON 으로)
// 이미 선물을 교환해 갔다면
if (pFlagSet->isOn(m_FlagSetType ) )
{
GCNPCResponse response;
response.setCode(NPC_RESPONSE_GIVE_EVENT_ITEM_FAIL);
pPlayer->sendPacket(&response);
GCNPCResponse quit;
quit.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPlayer->sendPacket(&quit);
return;
}
LuaSelectItem* pLuaSelectItem = NULL;
string luaFileName;
if (pPC->isSlayer() )
{
// 루아에 슬레이어 능력치의 합을 set한다.
Slayer* pSlayer = dynamic_cast<Slayer*>(pPC);
Assert(pSlayer != NULL);
Attr_t sum = pSlayer->getSTR(ATTR_BASIC )
+ pSlayer->getDEX(ATTR_BASIC )
+ pSlayer->getINT(ATTR_BASIC);
m_pLuaSlayerItem->setSum(sum);
pLuaSelectItem = m_pLuaSlayerItem;
luaFileName = m_SlayerFilename;
}
else if (pPC->isVampire() )
{
// 루아에 뱀파이어의 레벨을 set한다.
Vampire* pVampire = dynamic_cast<Vampire*>(pPC);
Assert(pVampire != NULL);
int level = pVampire->getLevel();
m_pLuaVampireItem->setLevel(level);
pLuaSelectItem = m_pLuaVampireItem;
luaFileName = m_VampireFilename;
}
//--------------------------------------------------------
// 속도 체크를 위해서 1000번 돌려보는 코드
// 결과는.. 0.07초 정도 나왔다. 감덩~ -_-;
/*
Timeval beforeTime;
getCurrentTime(beforeTime);
//.........这里部分代码省略.........