本文整理汇总了C++中PlayerCreature::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCreature::getName方法的具体用法?C++ PlayerCreature::getName怎么用?C++ PlayerCreature::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCreature
的用法示例。
在下文中一共展示了PlayerCreature::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
void CGSMSSendHandler::execute (CGSMSSend* pPacket , Player* pPlayer)
throw(ProtocolException , Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
Assert(pPacket != NULL);
Assert(pPlayer != NULL);
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Assert(pGamePlayer != NULL);
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGamePlayer->getCreature());
Assert(pPC != NULL);
filelog("SMS.log", "[%s:%s] %s", pGamePlayer->getID().c_str(), pPC->getName().c_str(), pPacket->toString().c_str());
GCAddressListVerify gcVerify;
if (pPC->getSMSCharge() < pPacket->getNumbersList().size() )
{
filelog("SMS.log", "[%s:%s] Charge가 모자랍니다.", pGamePlayer->getID().c_str(), pPC->getName().c_str());
gcVerify.setCode(GCAddressListVerify::SMS_SEND_FAIL);
gcVerify.setParameter(GCAddressListVerify::SMS_SEND_FAIL_NOT_ENOUGH_CHARGE);
pGamePlayer->sendPacket(&gcVerify);
return;
}
pPC->setSMSCharge(pPC->getSMSCharge() - pPacket->getNumbersList().size());
char buffer[100];
sprintf(buffer, "SMSCharge=%u", pPC->getSMSCharge());
pPC->tinysave(buffer);
list<string>::const_iterator itr = pPacket->getNumbersList().begin();
list<string>::const_iterator endItr = pPacket->getNumbersList().end();
for (; itr != endItr ; ++itr )
{
if (SMSServiceThread::Instance().isValidNumber(*itr ) )
{
SMSMessage* pMsg = new SMSMessage(pPC->getName(), *itr, pPacket->getCallerNumber(), pPacket->getMessage());
SMSServiceThread::Instance().pushMessage(pMsg);
}
}
gcVerify.setCode(GCAddressListVerify::SMS_SEND_OK);
gcVerify.setParameter(pPC->getSMSCharge());
pGamePlayer->sendPacket(&gcVerify);
#endif
__END_DEBUG_EX __END_CATCH
}
示例2: execute
void CGModifyGuildMemberIntroHandler::execute (CGModifyGuildMemberIntro* pPacket , Player* pPlayer)
throw(Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
Assert(pPacket != NULL);
Assert(pPlayer != NULL);
SYSTEM_ASSERT(SYSTEM_GUILD);
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Assert(pGamePlayer != NULL);
Creature* pCreature = pGamePlayer->getCreature();
Assert(pCreature != NULL);
PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pCreature);
Assert(pPlayerCreature != NULL);
// 길드를 가져온다.
Guild* pGuild = g_pGuildManager->getGuild(pPlayerCreature->getGuildID());
if (pGuild==NULL) return;
// 길드 멤버 정보를 가져온다.
GuildMember* pGuildMember = pGuild->getMember(pPlayerCreature->getName());
if (pGuildMember==NULL) return;
pGuildMember->saveIntro(pPacket->getGuildMemberIntro());
#endif // __GAME_SERVER__
__END_DEBUG_EX __END_CATCH
}
示例3: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionGiveItem::execute (Creature * pCreature1 , Creature * pCreature2)
throw(Error)
{
__BEGIN_TRY
Assert(pCreature2 != NULL);
Assert(pCreature2->isPC());
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);
Assert(pPC != NULL);
Player* pPlayer = pCreature2->getPlayer();
Assert(pPlayer != NULL);
list<OptionType_t> optionTypeList;
Item* pItem = g_pItemFactoryManager->createItem(m_ItemClass, m_ItemType, optionTypeList);
Assert(pItem != NULL);
_TPOINT pt;
Inventory* pInventory = pPC->getInventory();
Assert(pInventory != NULL);
if (!pInventory->getEmptySlot(pItem, pt))
{
// ConditionHasInvenSpace 컨디션과 반드시 함께 써야만 한다.
throw Error("ActionGiveItem: 제발 ConditionHasInvenSpace랑 같이 쓰자. 인벤토리에 자리없다.");
}
CoordInven_t X = pt.x;
CoordInven_t Y = pt.y;
pPC->getZone()->getObjectRegistry().registerObject(pItem);
pInventory->addItem(X, Y, pItem);
pItem->create(pPC->getName(), STORAGE_INVENTORY, 0, X, Y);
if (pItem != NULL && pItem->isTraceItem() )
{
remainTraceLog(pItem, "ActionGiveItem", pCreature2->getName(), ITEM_LOG_CREATE, DETAIL_EVENTNPC);
remainTraceLogNew(pItem, pCreature2->getName(), ITL_GET, ITLD_EVENTNPC , pCreature2->getZone()->getZoneID());
}
// 클라이언트에 선물이 추가되었음을 알린다.
GCCreateItem gcCreateItem;
makeGCCreateItem(&gcCreateItem, pItem, X, Y);
pPlayer->sendPacket(&gcCreateItem);
__END_CATCH
}
示例4: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionGiveQuestItem::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);
TPOINT pt;
Item* pItem = pPC->getQuestItem();
if (pItem == NULL || !pPC->getInventory()->getEmptySlot(pItem, pt ) )
{
GCNPCAsk gcNPCAsk;
gcNPCAsk.setObjectID(pCreature1->getObjectID());
gcNPCAsk.setScriptID(m_CounterScriptID);
gcNPCAsk.setNPCID(dynamic_cast<NPC*>(pCreature1)->getNPCID());
pPC->getPlayer()->sendPacket(&gcNPCAsk);
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, 43200);
}
GCCreateItem gcCreateItem;
makeGCCreateItem(&gcCreateItem, pItem, pt.x, pt.y);
pPC->getPlayer()->sendPacket(&gcCreateItem);
}
__END_CATCH
}
示例5: execute
//.........这里部分代码省略.........
{
// 루아의 계산 결과를 받아 아이템을 생성한다.
pLuaSelectItem->prepare();
int result = pLuaSelectItem->executeFile(luaFileName);
LuaState::logError(result);
pLuaSelectItem->clear();
}
Timeval afterTime;
getCurrentTime(afterTime);
cout << "luaExecute time before : " << beforeTime.tv_sec << "." << beforeTime.tv_usec << endl;
cout << "luaExecute time after : " << afterTime.tv_sec << "." << afterTime.tv_usec << endl;
*/
//--------------------------------------------------------
// 루아의 계산 결과를 받아 아이템을 생성한다.
pLuaSelectItem->prepare();
int result = pLuaSelectItem->executeFile(luaFileName);
LuaState::logError(result);
ItemClass = pLuaSelectItem->getItemClass();
ItemType = pLuaSelectItem->getItemType();
OptionType = pLuaSelectItem->getOptionType();
pLuaSelectItem->clear();
if(ItemClass >= Item::ITEM_CLASS_MAX )
//|| ItemType >= ITEM_TYPE_MAX || ItemType < 0
// || OptionType == 0)
{
filelog("XMasEventError.txt", "[ ItemInfo Error ] : ItemClass = %d , ItemType = %d , OptionType = %d", ItemClass, ItemType, OptionType);
GCNPCResponse quit;
quit.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPlayer->sendPacket(&quit);
return;
}
// 클라이언트에 선물상자를 지우도록 한다.
GCDeleteInventoryItem gcDeleteInventoryItem;
gcDeleteInventoryItem.setObjectID(pGiftBoxItem->getObjectID());
pPlayer->sendPacket(&gcDeleteInventoryItem);
// 선물상자를 지운다.
pInventory->deleteItem(X, Y);
// ItemTraceLog 를 남긴다
if (pGiftBoxItem != NULL && pGiftBoxItem->isTraceItem() )
{
remainTraceLog(pGiftBoxItem, pCreature2->getName(), pCreature1->getName(), ITEM_LOG_DELETE, DETAIL_EVENTNPC);
}
pGiftBoxItem->destroy();
SAFE_DELETE(pGiftBoxItem);
// 선물(Item)을 만든다.
list<OptionType_t> optionTypeList;
if (OptionType != 0 )
optionTypeList.push_back(OptionType);
pItem = g_pItemFactoryManager->createItem(ItemClass, ItemType, optionTypeList);
Assert(pItem != NULL);
// 선물을 인벤토리에 추가한다.
pZone->getObjectRegistry().registerObject(pItem);
pInventory->addItem(X, Y, pItem);
pItem->create(pPC->getName(), STORAGE_INVENTORY, 0, X, Y);
// ItemTraceLog 를 남긴다
if (pItem != NULL && pItem->isTraceItem() )
{
remainTraceLog(pItem, pCreature1->getName(), pCreature2->getName(), ITEM_LOG_CREATE, DETAIL_EVENTNPC);
}
// 클라이언트에 선물이 추가되었음을 알린다.
GCCreateItem gcCreateItem;
makeGCCreateItem(&gcCreateItem, pItem, X, Y);
pPlayer->sendPacket(&gcCreateItem);
// Flag을 켠다.
pFlagSet->turnOn(FLAGSET_TRADE_GIFT_BOX_2002_12);
// Flag을 저장한다.
pFlagSet->save(pPC->getName());
// 아이템 교환이 이루어 졌다고 클라이언트에 알린다.
GCNPCResponse response;
response.setCode(NPC_RESPONSE_TRADE_GIFT_BOX_OK);
pPlayer->sendPacket(&response);
GCNPCResponse quit;
quit.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPlayer->sendPacket(&quit);
__END_CATCH
}
示例6: executeOpSwapAdvancementItem
//.........这里部分代码省略.........
case Item::ITEM_CLASS_OUSTERS_CHAKRAM:
case Item::ITEM_CLASS_OUSTERS_WRISTLET:
fType = FLAGSET_SWAP_WEAPON;
break;
case Item::ITEM_CLASS_COAT:
case Item::ITEM_CLASS_VAMPIRE_COAT:
case Item::ITEM_CLASS_OUSTERS_COAT:
fType = FLAGSET_SWAP_COAT;
break;
case Item::ITEM_CLASS_TROUSER:
case Item::ITEM_CLASS_OUSTERS_BOOTS:
fType = FLAGSET_SWAP_TROUSER;
break;
default:
break;
}
if (iClass == Item::ITEM_CLASS_MAX || fType == FLAGSET_MAX )
{
sendFailPacket(pPacket, pPlayer);
return;
}
FlagSet* pFlagSet = pPC->getFlagSet();
if (pFlagSet->isOn(fType) )
{
sendFailPacket(pPacket, pPlayer);
return;
}
Item* pNewItem = g_pItemFactoryManager->createItem(iClass, iType, pItem->getOptionTypeList());
if (pNewItem == NULL )
{
sendFailPacket(pPacket, pPlayer);
return;
}
pNewItem->setGrade(iGrade);
_TPOINT tp;
if (!pInventory->getEmptySlot(pNewItem, tp) )
{
SAFE_DELETE(pNewItem);
sendFailPacket(pPacket, pPlayer);
return;
}
filelog("ItemSwap.log", "[%s:%s] %s <-> %s",
pGamePlayer->getID().c_str(), pPC->getName().c_str(), pItem->toString().c_str(), pNewItem->toString().c_str());
pNewItem->setTraceItem(bTraceLog(pNewItem ));
pInventory->deleteItem(ITEMOID);
pItem->whenPCLost(pPC);
if (!pItem->destroy())
{
filelog("shopDBBug.txt", "NoSuchItemInDB-destroy: %s", pItem->toString().c_str());
throw DisconnectException("아이템 지울려는데 DB에 없다.");
}
pZone->registerObject(pNewItem);
GCShopSellOK okpkt;
okpkt.setObjectID(NPCID);
okpkt.setShopVersion(-1);
okpkt.setItemObjectID(ITEMOID);
okpkt.setPrice(0);
pGamePlayer->sendPacket(&okpkt);
// 삭제할 아이템의 ItemTrace Log 를 남겨야 한다면 남긴다
if (pItem != NULL && pItem->isTraceItem() )
{
remainTraceLog(pItem, pCreature->getName() , pNPC->getName(), ITEM_LOG_DELETE, DETAIL_SHOPSELL);
}
// 인벤토리에 추가
Assert(pInventory->addItem(pNewItem, tp ));
// DB 에 생성
pNewItem->create(pPC->getName(), STORAGE_INVENTORY, 0, tp.x, tp.y);
// 교환해줄 아이템의 ItemTrace Log 를 남겨야 한다면 남긴다
if (pNewItem->isTraceItem() )
{
remainTraceLog(pNewItem, pNPC->getName() , pCreature->getName(), ITEM_LOG_CREATE, DETAIL_SHOPBUY);
}
pFlagSet->turnOn(fType);
pFlagSet->save(pPC->getName());
GCCreateItem gcCI;
makeGCCreateItem(&gcCI, pNewItem, tp.x, tp.y);
pGamePlayer->sendPacket(&gcCI);
#endif
__END_CATCH
}
示例7: processResult
void MPlayerManager::processResult()
{
// 사용자 찾기
__ENTER_CRITICAL_SECTION((*g_pPCFinder) )
Creature* pCreature = g_pPCFinder->getCreature_LOCKED(m_pCurrentJob->getName());
if (pCreature != NULL )
{
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);
Assert(pPC != NULL);
// 파워포인트를 플레이어에 세팅
pPC->setPowerPoint(loadPowerPoint(pPC->getName() ));
GCRequestPowerPointResult gcRequestPowerPointResult;
gcRequestPowerPointResult.setSumPowerPoint(pPC->getPowerPoint());
gcRequestPowerPointResult.setRequestPowerPoint(m_pCurrentJob->getPowerPoint());
if (m_pCurrentJob->getErrorCode() == 0 )
{
gcRequestPowerPointResult.setErrorCode(0);
}
else
{
switch (m_pCurrentJob->getErrorCode() )
{
case MERR_SERVER :
gcRequestPowerPointResult.setErrorCode(GCRequestPowerPointResult::SERVER_ERROR);
break;
case MERR_CONFIRM:
case MERR_PACKET:
gcRequestPowerPointResult.setErrorCode(GCRequestPowerPointResult::CONNECT_ERROR);
break;
case MERR_PROCESS:
gcRequestPowerPointResult.setErrorCode(GCRequestPowerPointResult::PROCESS_ERROR);
break;
case MERR_SEARCH :
gcRequestPowerPointResult.setErrorCode(GCRequestPowerPointResult::NO_MEMBER);
break;
case MERR_NULLPOINT :
gcRequestPowerPointResult.setErrorCode(GCRequestPowerPointResult::NO_POINT);
break;
case MERR_MATCHING :
gcRequestPowerPointResult.setErrorCode(GCRequestPowerPointResult::NO_MATCHING);
break;
default:
filelog(MOFUS_ERROR_FILE, "INVALID ERROR CODE:%d", m_pCurrentJob->getErrorCode());
return;
}
}
// 클라이언트에 알리기
pPC->getPlayer()->sendPacket(&gcRequestPowerPointResult);
}
__LEAVE_CRITICAL_SECTION((*g_pPCFinder) )
}
示例8: 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
}
示例9: 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
}
示例10: 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
}
示例11: execute
void CGLotterySelectHandler::execute (CGLotterySelect* pPacket , Player* pPlayer)
throw(Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
GamePlayer* pGP = dynamic_cast<GamePlayer*>(pPlayer);
Assert(pGP != NULL);
Creature* pCreature = pGP->getCreature();
Assert(pCreature != NULL);
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);
Assert(pPC != NULL);
filelog("EventQuest.log", "CGLotterySelectHandler : got [%d:%d:%d] from %s", pPacket->getType(), pPacket->getGiftID(), pPacket->getQuestLevel(),
pPC->getName().c_str());
switch (pPacket->getType() )
{
case TYPE_SELECT_LOTTERY:
{
// 인벤에서 퀘스트 아이템 삭제
QuestID_t qID;
EventQuestAdvance::Status status = pPC->getQuestManager()->getEventQuestAdvanceManager()->getStatus(pPacket->getQuestLevel());
int ownerQuestLevel = pPC->getQuestManager()->getEventQuestAdvanceManager()->getQuestLevel();
if (
(ownerQuestLevel > pPacket->getQuestLevel() && status == EventQuestAdvance::EVENT_QUEST_ADVANCED ) ||
(pPacket->getQuestLevel() == 4 && ownerQuestLevel== -1 ) ||
pPC->getQuestManager()->successEventQuest(pPacket->getQuestLevel(), qID ) )
{
pPC->getQuestManager()->getEventQuestAdvanceManager()->rewarded(pPacket->getQuestLevel());
pPC->getQuestManager()->getEventQuestAdvanceManager()->save();
pPC->getQuestManager()->questRewarded(qID);
pPC->sendCurrentQuestInfo();
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();
}
else
{
filelog("EventBug.txt", "CGLotterySelectHandler : 복권 선택이 날라왔는데 완료한 퀘스트가 없다. -_-; %s[%d:%d]",
pPC->getName().c_str(), pPacket->getQuestLevel(), pPacket->getGiftID());
return;
}
GCNoticeEvent gcNE;
gcNE.setCode(NOTICE_EVENT_RESULT_LOTTERY);
if (bWinPrize(pPacket->getGiftID(), pPacket->getQuestLevel() ) )
{
// PlayerCreature 에 정보를 저장한다
pPC->setLotto(true);
pPC->setLottoRewardID(pPacket->getGiftID());
pPC->setLottoQuestLevel(pPacket->getQuestLevel());
gcNE.setParameter((uint)1);
}
else
{
// PlayerCreature 에 정보를 저장한다
pPC->setLotto(false);
pPC->setLottoRewardID(pPacket->getGiftID());
pPC->setLottoQuestLevel(pPacket->getQuestLevel());
gcNE.setParameter((uint)0);
}
pGP->sendPacket(&gcNE);
filelog("EventQuest.log", "CGLotterySelectHandler : %d to %s", gcNE.getParameter(), pPC->getName().c_str());
}
break;
case TYPE_FINISH_SCRATCH:
{
// 당첨된 경우 디비에 저장
if (pPC->isLotto() )
{
// 다시 false 로 만들어줘야함.
// 아님 담번 퀘스트에서 무조건 당첨으로 처리되니 ;;
pPC->setLotto(false);
Statement* pStmt = NULL;
BEGIN_DB
{
pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();
//.........这里部分代码省略.........
示例12: executeEventTree
void CGUseMessageItemFromInventoryHandler::executeEventTree(CGUseMessageItemFromInventory* pPacket, Player* pPlayer)
throw(ProtocolException, Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
Assert(pPacket != NULL);
Assert(pPlayer != NULL);
// 상위 함수에서 에러 체크를 많이 했기 때문에,
// 에러 체크를 대폭 축소한다.
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Creature* pCreature = pGamePlayer->getCreature();
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);
Inventory* pInventory = pPC->getInventory();
Zone* pZone = pPC->getZone();
CoordInven_t InvenX = pPacket->getX();
CoordInven_t InvenY = pPacket->getY();
Item* pItem = pInventory->getItem(InvenX, InvenY);
ObjectID_t ItemObjectID = pItem->getObjectID();
MonsterType_t MType = 0;
int time = 0;
switch (pItem->getItemType() )
{
case 12:
MType = 482;
time = g_pVariableManager->getVariable(CHRISTMAS_TREE_DECAY_TIME ) / 10;
break;
case 26:
MType = 650;
time = 21600;
break;
case 27:
MType = 650;
time = 43200;
break;
case 28:
MType = 650;
time = 86400;
break;
default:
{
filelog("EventTree.log", "이상한 아템을 썼다. : %s 가 %d", pPC->getName().c_str(), pItem->getItemType());
GCCannotUse _GCCannotUse;
_GCCannotUse.setObjectID(pPacket->getObjectID());
pGamePlayer->sendPacket(&_GCCannotUse);
}
return;
}
// 타일에 스킬을 쓰는 것이라고 보고 쓸 수 있는지를 체크한다.
// 안전지대에서는 사용할 수 없다.
// 쓸 수 있는 아이템 타입인지 왁인한다. ItemType 이 12인 것만 사용할 수 있다.
// 근처에(플레이어 주위의 5x5타일 이내) 다른 트리가 있다면 사용할 수 없다.
if (!isAbleToUseTileSkill(pCreature )
|| pZone->isMasterLair()
|| ItemObjectID != pPacket->getObjectID()
|| checkCorpse(pZone, MType, pPC->getX() - 2, pPC->getY() - 2, pPC->getX() + 2, pPC->getY() + 2 )
)
{
GCCannotUse _GCCannotUse;
_GCCannotUse.setObjectID(pPacket->getObjectID());
pGamePlayer->sendPacket(&_GCCannotUse);
return;
}
// 성이면 성주 길드원만 쓸 수 있다.
if (!pPC->isGOD() )
{
if (pZone->isCastle() )
{
if (!g_pCastleInfoManager->isCastleMember(pZone->getZoneID(), pPC ) )
{
GCCannotUse _GCCannotUse;
_GCCannotUse.setObjectID(pPacket->getObjectID());
pGamePlayer->sendPacket(&_GCCannotUse);
return;
}
}
// 성이 아닌 곳의 안전지대에선 절대 못 쓴다.
else if (pZone->getZoneLevel(pCreature->getX(), pCreature->getY()) & SAFE_ZONE)
{
GCCannotUse _GCCannotUse;
_GCCannotUse.setObjectID(pPacket->getObjectID());
pGamePlayer->sendPacket(&_GCCannotUse);
return;
}
}
/* // 트리를 존에 추가한다. (트리는 몬스터 시체를 이용한다)
MonsterCorpse* pMonsterCorpse = new MonsterCorpse(482, pPacket->getMessage(), 2);
Assert(pMonsterCorpse!=NULL);
pZone->getObjectRegistry().registerObject(pMonsterCorpse);
// 생성된 시체를 존에 추가한다.
int delayTime = g_pVariableManager->getVariable(CHRISTMAS_TREE_DECAY_TIME); // by sigi. 2002.12.17
//.........这里部分代码省略.........
示例13: execute
//.........这里部分代码省略.........
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;
}
// 루아의 계산 결과를 받아 아이템을 생성한다.
pLuaSelectItem->prepare();
int result = pLuaSelectItem->executeFile(luaFileName);
LuaState::logError(result);
ItemClass = pLuaSelectItem->getItemClass();
ItemType = pLuaSelectItem->getItemType();
OptionType = pLuaSelectItem->getOptionType();
OptionType2 = pLuaSelectItem->getOptionType2();
pLuaSelectItem->clear();
if(ItemClass >= Item::ITEM_CLASS_MAX )
{
filelog("AccountEventItemError.txt", "[ ItemInfo Error ] : ItemClass = %d , ItemType = %d , OptionType = %d", ItemClass, ItemType, OptionType);
GCNPCResponse quit;
quit.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPlayer->sendPacket(&quit);
return;
}
// 선물(Item)을 만든다.
list<OptionType_t> optionTypeList;
if (OptionType != 0 ) optionTypeList.push_back(OptionType);
if (OptionType2 != 0 ) optionTypeList.push_back(OptionType2);
pItem = g_pItemFactoryManager->createItem(ItemClass, ItemType, optionTypeList);
Assert(pItem != NULL);
// 인벤토리에 아이템을 넣을 빈 자리를 받아온다.
TPOINT p;
if (!pInventory->getEmptySlot(pItem, p))
{
SAFE_DELETE(pItem);
GCNPCResponse response;
response.setCode(NPC_RESPONSE_NO_EMPTY_SLOT);
pGamePlayer->sendPacket(&response);
GCNPCResponse quit;
quit.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPlayer->sendPacket(&quit);
return;
}
// 선물을 인벤토리에 추가한다.
pZone->getObjectRegistry().registerObject(pItem);
pInventory->addItem(p.x, p.y, pItem);
pItem->create(pPC->getName(), STORAGE_INVENTORY, 0, p.x, p.y);
// ItemTraceLog 를 남긴다
if (pItem != NULL && pItem->isTraceItem() )
{
remainTraceLog(pItem, pCreature1->getName(), pCreature2->getName(), ITEM_LOG_CREATE, DETAIL_EVENTNPC);
remainTraceLogNew(pItem, pCreature2->getName(), ITL_GET, ITLD_EVENTNPC, pCreature1->getZone()->getZoneID(), pCreature1->getX(), pCreature1->getY());
}
// 클라이언트에 선물이 추가되었음을 알린다.
GCCreateItem gcCreateItem;
makeGCCreateItem(&gcCreateItem, pItem, p.x, p.y);
pPlayer->sendPacket(&gcCreateItem);
// 선물을 받았다고 Flag 를 켠다.
pGamePlayer->setSpecialEventCount(pGamePlayer->getSpecialEventCount() | m_SpecialEventFlag);
// Flag 를 저장한다.
pGamePlayer->saveSpecialEventCount();
// 보상을 받았다고 클라이언트에 보낸다.
GCNPCResponse response;
response.setCode(NPC_RESPONSE_GIVE_EVENT_ITEM_OK);
pPlayer->sendPacket(&response);
GCNPCResponse quit;
quit.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPlayer->sendPacket(&quit);
__END_CATCH
}
示例14: execute
//.........这里部分代码省略.........
it.ItemType = getUpgradeItemType(it.ItemClass, it.ItemType, 1);
}
*/
pItem1 = g_pItemFactoryManager->createItem(it.ItemClass, it.ItemType, it.OptionType);
Assert(pItem1 != NULL);
}
}
if (pItem1 == NULL)
{
StringStream msg;
msg << "ActionTradeLairItem: "
<< (int)it.ItemClass << ", "
<< (int)it.ItemType << ", "
<< (int)it.bCreateOption << ", "
<< getOptionTypeToString(it.OptionType);
filelog("tradeLairItemBUG.txt", "%s", msg.toString().c_str());
GCSystemMessage gcSystemMessage;
gcSystemMessage.setMessage(g_pStringPool->getString(STRID_ITEM_CREATE_ERROR ));
pPlayer->sendPacket(&gcSystemMessage);
GCNPCResponse response;
response.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPlayer->sendPacket(&response);
return;
}
}
TPOINT pt;
pItem1->setGrade(min(7,ItemGradeManager::Instance().getRandomBeadGrade()));
pZone->registerObject(pItem1);
// 만약 inventory에 공간이 있다면, 넣는다.
if(pInventory->addItem(pItem1, pt))
{
pItem1->create(pPC->getName(), STORAGE_INVENTORY, 0, pt.x, pt.y);
GCCreateItem gcCreateItem;
/* gcCreateItem.setObjectID(pItem1->getObjectID());
gcCreateItem.setItemClass(pItem1->getItemClass());
gcCreateItem.setItemType(pItem1->getItemType());
gcCreateItem.setOptionType(pItem1->getOptionTypeList());
gcCreateItem.setDurability(pItem1->getDurability());
gcCreateItem.setItemNum(pItem1->getNum());
gcCreateItem.setInvenX(pt.x);
gcCreateItem.setInvenY(pt.y);
gcCreateItem.setGrade(pItem1->getGrade());*/
makeGCCreateItem(&gcCreateItem, pItem1, pt.x, pt.y);
pPlayer->sendPacket(&gcCreateItem);
// ItemTraceLog 를 남긴다
if (pItem1 != NULL && pItem1->isTraceItem() )
{
remainTraceLog(pItem1, pCreature1->getName(), pCreature2->getName(), ITEM_LOG_CREATE, DETAIL_EVENTNPC);
}
// 기존의 아이템을 없앤다
GCDeleteInventoryItem gcDeleteInventoryItem;
gcDeleteInventoryItem.setObjectID(pMasterItem->getObjectID());
pPlayer->sendPacket(&gcDeleteInventoryItem);
// 서버에서 없애준다.
pInventory->deleteItem(pMasterItem->getObjectID()); // 좌표로 바꿔주면 좋을건데..
// ItemTraceLog 를 남긴다
if (pMasterItem != NULL && pMasterItem->isTraceItem() )
{
remainTraceLog(pMasterItem, pCreature2->getName(), pCreature1->getName(), ITEM_LOG_DELETE, DETAIL_EVENTNPC);
}
pMasterItem->destroy();
SAFE_DELETE(pMasterItem);
// 사용자에게 성공 메시지 출력
// StringStream message;
// message << "성공적으로 교환되었습니다";
GCSystemMessage gcSystemMessage;
gcSystemMessage.setMessage(g_pStringPool->getString(STRID_TRADE_SUCCESS ));
pPlayer->sendPacket(&gcSystemMessage);
}
else
{
// StringStream buf;
// buf << "인벤토리에 공간이 부족합니다";
GCSystemMessage gcSystemMessage;
gcSystemMessage.setMessage(g_pStringPool->getString(STRID_NOT_ENOUGH_INVENTORY_SPACE ));
pPlayer->sendPacket(&gcSystemMessage);
}
GCNPCResponse response;
response.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
pPlayer->sendPacket(&response);
__END_CATCH
}
示例15: execute
void CGModifyNicknameHandler::execute (CGModifyNickname* pPacket , Player* pPlayer)
throw(ProtocolException, Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
Assert(pPacket != NULL);
Assert(pPlayer != NULL);
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Assert(pGamePlayer != NULL);
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGamePlayer->getCreature());
Assert(pPC != NULL);
Inventory* pInventory = pPC->getInventory();
Assert(pInventory != NULL);
GCNicknameVerify gcNV;
ObjectID_t itemOID = pPacket->getItemObjectID();
EventGiftBox* pItem = NULL;
if (itemOID != 0 )
{
pItem = dynamic_cast<EventGiftBox*>(pInventory->getItemWithObjectID(itemOID ));
if (pItem == NULL )
{
filelog("Nickname.log", "[%s:%s] 아이템이 없거나 EventGiftBox가 아닙니다.",
pPlayer->getID().c_str(),
pPC->getName().c_str());
gcNV.setCode(NICKNAME_MODIFY_FAIL_NO_ITEM);
pGamePlayer->sendPacket(&gcNV);
return;
}
}
else
{
PetInfo* pPetInfo = pPC->getPetInfo();
if (pPetInfo == NULL || pPetInfo->getPetType() != PET_PACKAGE )
{
gcNV.setCode(NICKNAME_MODIFY_FAIL_NO_ITEM);
pGamePlayer->sendPacket(&gcNV);
return;
}
pPetInfo->setNickname(pPacket->getNickname());
pPetInfo->getPetItem()->savePetInfo();
sendPetInfo(pGamePlayer, true);
gcNV.setCode(NICKNAME_MODIFY_OK);
pGamePlayer->sendPacket(&gcNV);
return;
}
switch (pItem->getItemType() )
{
// 펫 닉네임 바꾸기
case 23 :
{
PetInfo* pPetInfo = pPC->getPetInfo();
if (pPetInfo == NULL )
{
gcNV.setCode(NICKNAME_MODIFY_FAIL_NO_ITEM);
pGamePlayer->sendPacket(&gcNV);
return;
}
if (pPetInfo->getPetType() != PET_PACKAGE && pItem == NULL )
{
gcNV.setCode(NICKNAME_MODIFY_FAIL_NO_ITEM);
pGamePlayer->sendPacket(&gcNV);
return;
}
pPetInfo->setNickname(pPacket->getNickname());
pPetInfo->getPetItem()->savePetInfo();
sendPetInfo(pGamePlayer, true);
gcNV.setCode(NICKNAME_MODIFY_OK);
pGamePlayer->sendPacket(&gcNV);
if (pPetInfo->getPetType() != PET_PACKAGE )
{
pInventory->deleteItem(itemOID);
pItem->destroy();
SAFE_DELETE(pItem);
GCUseOK gcOK;
pGamePlayer->sendPacket(&gcOK);
}
return;
}
// 커스텀 닉네임 바꾸기
case 22 :
//.........这里部分代码省略.........