本文整理汇总了C++中PlayerCreature::getObjectID方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCreature::getObjectID方法的具体用法?C++ PlayerCreature::getObjectID怎么用?C++ PlayerCreature::getObjectID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCreature
的用法示例。
在下文中一共展示了PlayerCreature::getObjectID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doEnqueueCommand
void ObjectController::doEnqueueCommand(uint32 command, const UnicodeString& arguments) {
PlayerCreature* object = zone->getSelfPlayer();
Locker _locker(object);
BaseMessage* message = new ObjectControllerMessage(object->getObjectID(), 0x23, 0x116);
message->insertInt(object->getNewActionCount());
message->insertInt(command);
message->insertLong(0);
message->insertUnicode(arguments);
object->getClient()->sendMessage(message);
}
示例2: doSayCommand
void ObjectController::doSayCommand(const UnicodeString& msg) {
PlayerCreature* object = zone->getSelfPlayer();
Locker _locker(object);
StringBuffer full;
full << "0 " << "0 " << "0 " << "0 " << "0 " << msg.toString();
BaseMessage* message = new ObjectControllerMessage(object->getObjectID(), 0x23, 0x116);
message->insertInt(object->getNewActionCount());
message->insertInt(String("spatialchatinternal").hashCode());
message->insertLong(0);
message->insertUnicode(full.toString());
object->getClient()->sendMessage(message);
}
示例3: execute
void CGDisplayItemHandler::execute (CGDisplayItem* pPacket , Player* pPlayer)
throw(Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
//#ifndef __TEST_SERVER__
// return;
//#endif
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);
Store* pStore = pPC->getStore();
Assert(pStore != NULL);
GCSystemMessage errorMsg;
GCNoticeEvent errorNotice;
if (pPacket->getIndex() > MAX_ITEM_NUM )
{
filelog("Store.log", "[%s:%s] (%u) 잘못된 인덱스입니다.",
pGamePlayer->getID().c_str(), pPC->getName().c_str(), pPacket->getIndex());
return;
}
if (pPacket->getX() >= pInventory->getWidth() || pPacket->getY() >= pInventory->getHeight() )
{
filelog("Store.log", "[%s:%s] (%u,%u) 인벤토리 좌표를 잘못 보내줬습니다..",
pGamePlayer->getID().c_str(), pPC->getName().c_str(), pPacket->getX(), pPacket->getY());
return;
}
Item* pItem = pInventory->getItem(pPacket->getX(), pPacket->getY());
if (pItem == NULL || pItem->getObjectID() != pPacket->getItemObjectID() )
{
filelog("Store.log", "[%s:%s] (%u, %u) : %u 아이템 좌표가 잘못되었거나 오브젝트 아이디가 잘못되었습니다.",
pGamePlayer->getID().c_str(), pPC->getName().c_str(), pPacket->getX(), pPacket->getY(), pPacket->getItemObjectID());
return;
}
if (pPC->getZone()->getTradeManager()->getTradeInfo(pPC->getName() ) != NULL )
{
filelog("Store.log", "[%s:%s] : 거래중에는 물건을 올려놓을 수 없습니다.",
pGamePlayer->getID().c_str(), pPC->getName().c_str());
return;
}
if (pStore->hasItem(pItem ) )
{
filelog("Store.log", "[%s:%s] (%u, %u) 이미 아이템이 상점에 있습니다.",
pGamePlayer->getID().c_str(), pPC->getName().c_str(), pItem->getObjectID(), pPacket->getIndex());
// errorMsg.setMessage("이미 진열된 아이템입니다.");
errorNotice.setCode(NOTICE_EVENT_ALREADY_DISPLAYED);
pGamePlayer->sendPacket(&errorNotice);
return;
}
if (pItem->isTimeLimitItem() || !canSell(pItem ) || !canTrade(pItem ) || !canTradeInventoryItem(pItem ) )
{
filelog("Store.log", "[%s:%s] (%s) 팔 수 없는 아이템입니다.",
pGamePlayer->getID().c_str(), pPC->getName().c_str(), pItem->toString().c_str());
// errorMsg.setMessage("판매할 수 없는 아이템입니다.");
errorNotice.setCode(NOTICE_EVENT_CANNOT_SELL);
pGamePlayer->sendPacket(&errorNotice);
return;
}
BYTE result = pStore->setStoreItem(pPacket->getIndex(), pItem, pPacket->getPrice());
if ( result != 0 )
{
filelog("Store.log", "[%s:%s] (%u) 아이템을 놓을 수 없습니다.",
pGamePlayer->getID().c_str(), pPC->getName().c_str(), result);
return;
}
GCMyStoreInfo gcInfo;
gcInfo.setStoreInfo(&(pStore->getStoreInfo()));
pGamePlayer->sendPacket(&gcInfo);
if (pStore->isOpen() )
{
GCAddStoreItem gcAdd;
gcAdd.setOwnerObjectID(pPC->getObjectID());
gcAdd.setIndex(pPacket->getIndex());
pStore->getStoreItem(pPacket->getIndex() ).makeStoreItemInfo(gcAdd.getItem());
pPC->getZone()->broadcastPacket(pPC->getX(), pPC->getY(), &gcAdd, pPC);
}
#endif // __GAME_SERVER__
//.........这里部分代码省略.........
示例4: executeNormal
//////////////////////////////////////////////////////////////////////////////
//
// 일반 아이템을 처리한다.
//
//////////////////////////////////////////////////////////////////////////////
void CGShopRequestSellHandler::executeNormal (CGShopRequestSell* pPacket , Player* pPlayer)
throw(ProtocolException , Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
ObjectID_t NPCID = pPacket->getObjectID();
ObjectID_t ITEMOID = pPacket->getItemObjectID();
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Creature* pCreature = pGamePlayer->getCreature();
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);
BYTE index = 0;
bool bSpecialItem = false;
Zone* pZone = pPC->getZone();
if (pZone == NULL) return sendFailPacket(pPacket, pPlayer);
Creature* pNPCBase = NULL;
/*
try
{
pNPCBase = pZone->getCreature(NPCID);
}
catch (NoSuchElementException & nsee)
{
pNPCBase = NULL;
}
*/
// NoSuch제거. by sigi. 2002.5.2
pNPCBase = pZone->getCreature(NPCID);
if (pNPCBase == NULL || !pNPCBase->isNPC()) return sendFailPacket(pPacket, pPlayer);
NPC* pNPC = dynamic_cast<NPC*>(pNPCBase);
// 플레이어가 팔려고 하는 아이템을 가지고 있는지 검사
Inventory* pInventory = pPC->getInventory();
//Gold_t playerMoney = pPC->getGold();
Item* pItem = pInventory->getItemWithObjectID(ITEMOID);
ItemNum_t itemNumber = pItem->getNum();
Price_t itemPrice = g_pPriceManager->getPrice(pItem, pNPC->getMarketCondBuy(), SHOP_RACK_NORMAL, pPC) * itemNumber;
// 플레이어의 인벤토리에 아이템을 제거한다.
pInventory->deleteItem(ITEMOID);
pItem->whenPCLost(pPC);
if (!pItem->destroy()) {
filelog("shopDBBug.txt", "NoSuchItemInDB-destroy: %s", pItem->toString().c_str());
throw DisconnectException("아이템 지울려는데 DB에 없다.");
}
// 만약 벨트라면 안에 있는 포션을 삭제해준다.
// DB에서 지우는 것은 Belt::destroy()를 부르는 것만으로 포션까지 삭제된다.
if (pItem->getItemClass() == Item::ITEM_CLASS_BELT) {
Inventory* pBeltInventory = dynamic_cast<Belt*>(pItem)->getInventory();
for (int y=0; y<pBeltInventory->getHeight(); y++) {
for (int x=0; x<pBeltInventory->getWidth(); x++) {
Item* pBeltItem = pBeltInventory->getItem(x, y);
if (pBeltItem != NULL) {
pBeltInventory->deleteItem(x, y);
SAFE_DELETE(pBeltItem);
}
}
}
}
// Skull 일 경우 Variable Manager 에서 머리값 배수 값으로 가격을 새로 계산한다
if (pItem->getItemClass() == Item::ITEM_CLASS_SKULL)
itemPrice = itemPrice * (g_pVariableManager->getHeadPriceBonus() / 100);
// ItemTrace Log 를 남겨야 한다면 남긴다
if (pItem != NULL && pItem->isTraceItem() )
remainTraceLog(pItem, pCreature->getName() , pNPC->getName(), ITEM_LOG_DELETE, DETAIL_SHOPSELL);
// 플레이어에게 물건값을 지불한다.
// pPC->setGoldEx(playerMoney+itemPrice);
// by sigi. 2002.9.4
pPC->increaseGoldEx(itemPrice);
// 플레이어가 물건 팔 때 처리할 것들을 처리한다.
pPC->sellItem(pItem);
if (pItem->getItemClass() == Item::ITEM_CLASS_MOON_CARD && pItem->getItemType() == 4)
addOlympicStat(pPC, 4, (uint)(itemNumber));
bool bClearDefaultOptionTypes = false;
if (pItem->getItemClass() == Item::ITEM_CLASS_EVENT_ITEM && pItem->getItemType() >= 32 && pItem->getItemType() <= 36)
bClearDefaultOptionTypes = true;
// NPC에게 자리가 충분하다면 플레이어가 판 아이템을 보관한다.
// 운영자 명령어로 만든 아이템은 바로 없앤다.
// 단 스페셜 아이템만을 보관한다. 노말 아이템은 그냥 버림.
//.........这里部分代码省略.........
示例5: execute
//.........这里部分代码省略.........
pGamePlayer->sendPacket(&gcNV);
return;
}
if (pItem == NULL )
{
gcNV.setCode(NICKNAME_MODIFY_FAIL_NO_ITEM);
pGamePlayer->sendPacket(&gcNV);
return;
}
// pPC->removeFlag(Effect::EFFECT_CLASS_CAN_MODIFY_NICKNAME_0);
pNickname->setNickname(pPacket->getNickname());
Statement* pStmt = NULL;
BEGIN_DB
{
pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();
pStmt->executeQuery("UPDATE NicknameBook SET Nickname='%s' WHERE OwnerID='%s' AND nID=%u",
getDBString(pNickname->getNickname()).c_str(), pPC->getName().c_str(), pNickname->getNicknameID());
SAFE_DELETE(pStmt);
}
END_DB(pStmt)
gcNV.setCode(NICKNAME_MODIFY_OK);
pGamePlayer->sendPacket(&gcNV);
if (pItem->getItemType() == 22 )
{
pInventory->deleteItem(itemOID);
pItem->destroy();
SAFE_DELETE(pItem);
GCUseOK gcOK;
pGamePlayer->sendPacket(&gcOK);
}
if (pPC->getNickname() == pNickname )
{
GCModifyNickname gcMN;
gcMN.setObjectID(pPC->getObjectID());
gcMN.setNicknameInfo(pNickname);
pPC->getZone()->broadcastPacket(pPC->getX(), pPC->getY(), &gcMN);
}
break;
}
// 닉네임 추가하기
case 24 :
{
if (pItem == NULL )
{
gcNV.setCode(NICKNAME_MODIFY_FAIL_NO_ITEM);
pGamePlayer->sendPacket(&gcNV);
return;
}
NicknameInfo* pNickname = new NicknameInfo;
pNickname->setNicknameID(pPC->getNicknameBook()->popNicknameID());
pNickname->setNicknameType(NicknameInfo::NICK_CUSTOM);
pNickname->setNickname(pPacket->getNickname());
pPC->getNicknameBook()->setNicknameInfo(pNickname->getNicknameID(), pNickname);
Statement* pStmt = NULL;
BEGIN_DB
{
pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();
pStmt->executeQuery("INSERT INTO NicknameBook (nID, OwnerID, NickType, Nickname, Time) "
"VALUES (%u, '%s', %u, '%s', now())",
pNickname->getNicknameID(), pPC->getName().c_str(), pNickname->getNicknameType(), getDBString(pNickname->getNickname()).c_str());
SAFE_DELETE(pStmt);
}
END_DB(pStmt)
gcNV.setCode(NICKNAME_MODIFY_OK);
pGamePlayer->sendPacket(&gcNV);
Packet* pNickList = pPC->getNicknameBook()->getNicknameBookListPacket();
pGamePlayer->sendPacket(pNickList);
SAFE_DELETE(pNickList);
pInventory->deleteItem(itemOID);
pItem->destroy();
SAFE_DELETE(pItem);
GCUseOK gcOK;
pGamePlayer->sendPacket(&gcOK);
break;
}
}
#endif // __GAME_SERVER__
__END_DEBUG_EX __END_CATCH
}