本文整理汇总了C++中net::MessageIn::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageIn::getId方法的具体用法?C++ MessageIn::getId怎么用?C++ MessageIn::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net::MessageIn
的用法示例。
在下文中一共展示了MessageIn::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleMessage
void NpcHandler::handleMessage(Net::MessageIn &msg)
{
if (msg.getId() == SMSG_NPC_CHOICE || msg.getId() == SMSG_NPC_MESSAGE)
{
msg.readInt16(); // length
}
int npcId = msg.readInt32();
Event *event = 0;
switch (msg.getId())
{
case SMSG_NPC_CHOICE:
event = new Event(Event::Menu);
event->setInt("id", npcId);
parseMenu(event, msg.readString(msg.getLength() - 8));
event->trigger(Event::NpcChannel);
break;
case SMSG_NPC_MESSAGE:
event = new Event(Event::Message);
event->setInt("id", npcId);
event->setString("text", msg.readString(msg.getLength() - 8));
event->trigger(Event::NpcChannel);
break;
case SMSG_NPC_CLOSE:
// Show the close button
event = new Event(Event::Close);
event->setInt("id", npcId);
event->trigger(Event::NpcChannel);
break;
case SMSG_NPC_NEXT:
// Show the next button
event = new Event(Event::Next);
event->setInt("id", npcId);
event->trigger(Event::NpcChannel);
break;
case SMSG_NPC_INT_INPUT:
// Request for an integer
event = new Event(Event::IntegerInput);
event->setInt("id", npcId);
event->trigger(Event::NpcChannel);
break;
case SMSG_NPC_STR_INPUT:
// Request for a string
event = new Event(Event::StringInput);
event->setInt("id", npcId);
event->trigger(Event::NpcChannel);
break;
}
delete event;
if (local_player->getCurrentAction() != Being::SIT)
local_player->setAction(Being::STAND);
}
示例2: getNpc
BeingId NpcHandler::getNpc(Net::MessageIn &msg)
{
if (msg.getId() == SMSG_NPC_CHOICE
|| msg.getId() == SMSG_NPC_MESSAGE
|| msg.getId() == SMSG_NPC_CHANGETITLE)
{
msg.readInt16("len");
}
const BeingId npcId = msg.readBeingId("npc id");
const NpcDialogs::const_iterator diag = NpcDialog::mNpcDialogs.find(npcId);
mDialog = nullptr;
if (msg.getId() == SMSG_NPC_VIEWPOINT)
return npcId;
if (diag == NpcDialog::mNpcDialogs.end())
{
// Empty dialogs don't help
if (msg.getId() == SMSG_NPC_CLOSE)
{
closeDialog(npcId);
return npcId;
}
else if (msg.getId() == SMSG_NPC_NEXT)
{
nextDialog(npcId);
return npcId;
}
else
{
CREATEWIDGETV(mDialog, NpcDialog, npcId);
mDialog->saveCamera();
if (localPlayer)
localPlayer->stopWalking(false);
NpcDialog::mNpcDialogs[npcId] = mDialog;
}
}
else
{
NpcDialog *const dialog = diag->second;
if (mDialog && mDialog != dialog)
mDialog->restoreCamera();
mDialog = dialog;
if (mDialog)
mDialog->saveCamera();
}
return npcId;
}
示例3: handleMessage
void ChatHandler::handleMessage(Net::MessageIn &msg)
{
if (!localChatTab)
return;
BLOCK_START("ChatHandler::handleMessage")
switch (msg.getId())
{
case SMSG_WHISPER_RESPONSE:
processWhisperResponse(msg);
break;
// Received whisper
case SMSG_WHISPER:
processWhisper(msg);
break;
// Received speech from being
case SMSG_BEING_CHAT:
processBeingChat(msg, false);
break;
// Received speech from being
case SMSG_BEING_CHAT2:
processBeingChat(msg, true);
break;
case SMSG_PLAYER_CHAT:
case SMSG_GM_CHAT:
processChat(msg, msg.getId() == SMSG_PLAYER_CHAT, false);
break;
case SMSG_PLAYER_CHAT2:
processChat(msg, true, true);
break;
case SMSG_MVP:
processMVP(msg);
break;
case SMSG_IGNORE_ALL_RESPONSE:
processIgnoreAllResponse(msg);
break;
default:
break;
}
BLOCK_END("ChatHandler::handleMessage")
}
示例4: handleMessage
void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case GPMSG_INVENTORY_FULL:
player_node->clearInventory();
player_node->mEquipment->setBackend(&mEqiups);
// no break!
case GPMSG_INVENTORY:
while (msg.getUnreadLength())
{
unsigned int slot = msg.readInt8();
if (slot == 255)
{
player_node->setMoney(msg.readInt32());
continue;
}
int id = msg.readInt16();
if (slot < EQUIPMENT_SIZE)
{
mEqiups.setEquipment(slot, id);
}
else if (slot >= 32 && slot < 32 + getSize(INVENTORY))
{
int amount = id ? msg.readInt8() : 0;
player_node->setInvItem(slot - 32, id, amount);
}
};
break;
}
}
示例5: handleMessage
void ItemHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case GPMSG_ITEM_APPEAR:
case GPMSG_ITEMS:
{
while (msg.getUnreadLength())
{
int itemId = msg.readInt16();
int x = msg.readInt16();
int y = msg.readInt16();
int id = (x << 16) | y; // dummy id
if (itemId)
{
actorSpriteManager->createItem(id, itemId, Vector(x, y));
}
else if (FloorItem *item = actorSpriteManager->findItem(id))
{
actorSpriteManager->destroy(item);
}
}
} break;
}
}
示例6: handleMessage
void CashShopHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case SMSG_NPC_CASH_SHOP_OPEN:
processCashShopOpen(msg);
break;
case SMSG_NPC_CASH_BUY_ACK:
processCashShopBuyAck(msg);
break;
case SMSG_NPC_CASH_POINTS:
processCashShopPoints(msg);
break;
case SMSG_NPC_CASH_BUY:
processCashShopBuy(msg);
break;
case SMSG_NPC_CASH_TAB_PRICE_LIST:
processCashShopTabPriceList(msg);
break;
case SMSG_NPC_CASH_SCHEDULE:
processCashShopSchedule(msg);
break;
default:
break;
}
}
示例7: handleMessage
void BeingHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case GPMSG_BEING_ENTER:
handleBeingEnterMessage(msg);
break;
case GPMSG_BEING_LEAVE:
handleBeingLeaveMessage(msg);
break;
case GPMSG_BEINGS_MOVE:
handleBeingsMoveMessage(msg);
break;
case GPMSG_BEING_ATTACK:
handleBeingAttackMessage(msg);
break;
case GPMSG_BEINGS_DAMAGE:
handleBeingsDamageMessage(msg);
break;
case GPMSG_BEING_ACTION_CHANGE:
handleBeingActionChangeMessage(msg);
break;
case GPMSG_BEING_LOOKS_CHANGE:
handleBeingLooksChangeMessage(msg);
break;
case GPMSG_BEING_DIR_CHANGE:
handleBeingDirChangeMessage(msg);
break;
}
}
示例8: handleMessage
void ItemHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case SMSG_ITEM_VISIBLE:
case SMSG_ITEM_DROPPED:
{
int id = msg.readInt32();
int itemId = msg.readInt16();
msg.readInt8(); // identify flag
int x = msg.readInt16();
int y = msg.readInt16();
msg.skip(4); // amount,subX,subY / subX,subY,amount
Game *game = Game::instance();
if (!game)
break;
if (Map *map = game->getCurrentMap())
actorSpriteManager->createItem(id, itemId,
map->getTileCenter(x, y));
}
break;
case SMSG_ITEM_REMOVE:
if (FloorItem *item = actorSpriteManager->findItem(msg.readInt32()))
actorSpriteManager->destroy(item);
break;
}
}
示例9: handleMessage
void ItemHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case SMSG_ITEM_VISIBLE:
processItemVisible(msg);
break;
case SMSG_ITEM_DROPPED:
processItemDropped(msg);
break;
case SMSG_ITEM_REMOVE:
processItemRemove(msg);
break;
case SMSG_GRAFFITI_VISIBLE:
processGraffiti(msg);
break;
case SMSG_ITEM_MVP_DROPPED:
processItemMvpDropped(msg);
break;
default:
break;
}
}
示例10: handleMessage
void MarketHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
default:
break;
}
}
示例11: handleMessage
void SearchStoreHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
default:
break;
}
}
示例12: handleMessage
void PlayerHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case SMSG_WALK_RESPONSE:
processWalkResponse(msg);
break;
case SMSG_PLAYER_WARP:
processPlayerWarp(msg);
break;
case SMSG_PLAYER_STAT_UPDATE_1:
processPlayerStatUpdate1(msg);
break;
case SMSG_PLAYER_STAT_UPDATE_2:
processPlayerStatUpdate2(msg);
break;
case SMSG_PLAYER_STAT_UPDATE_3: // Update a base attribute
processPlayerStatUpdate3(msg);
break;
case SMSG_PLAYER_STAT_UPDATE_4: // Attribute increase ack
processPlayerStatUpdate4(msg);
break;
// Updates stats and status points
case SMSG_PLAYER_STAT_UPDATE_5:
processPlayerStatUpdate5(msg);
break;
case SMSG_PLAYER_STAT_UPDATE_6:
processPlayerStatUpdate6(msg);
break;
case SMSG_PLAYER_ARROW_MESSAGE:
processPlayerArrowMessage(msg);
break;
case SMSG_PLAYER_SHORTCUTS:
processPlayerShortcuts(msg);
break;
case SMSG_PLAYER_SHOW_EQUIP:
processPlayerShowEquip(msg);
break;
default:
break;
}
}
示例13: handleMessage
void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case GPMSG_INVENTORY_FULL:
{
PlayerInfo::clearInventory();
PlayerInfo::getEquipment()->setBackend(&mEquips);
int count = msg.readInt16();
while (count--)
{
unsigned int slot = msg.readInt16();
int id = msg.readInt16();
unsigned int amount = msg.readInt16();
PlayerInfo::setInventoryItem(slot, id, amount);
}
while (msg.getUnreadLength())
{
unsigned int slot = msg.readInt8();
unsigned int ref = msg.readInt16();
mEquips.addEquipment(slot, ref);
}
}
break;
case GPMSG_INVENTORY:
while (msg.getUnreadLength())
{
unsigned int slot = msg.readInt16();
int id = msg.readInt16();
unsigned int amount = id ? msg.readInt16() : 0;
PlayerInfo::setInventoryItem(slot, id, amount);
}
break;
case GPMSG_EQUIP:
while (msg.getUnreadLength())
{
unsigned int ref = msg.readInt16();
int count = msg.readInt8();
while (count--)
{
unsigned int slot = msg.readInt8();
unsigned int used = msg.readInt8();
mEquips.setEquipment(slot, used, ref);
}
}
break;
}
}
示例14: handleMessage
void AdminHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case SMSG_ADMIN_KICK_ACK:
if (msg.readInt32() == 0)
NotifyManager::notify(NotifyManager::KICK_FAIL);
else
NotifyManager::notify(NotifyManager::KICK_SUCCEED);
break;
default:
break;
}
}
示例15: handleMessage
void BuySellHandler::handleMessage(Net::MessageIn &msg)
{
Being *being = actorSpriteManager->findBeing(msg.readInt16());
if (!being || being->getType() != ActorSprite::NPC)
{
return;
}
int npcId = being->getId();
switch (msg.getId())
{
case GPMSG_NPC_BUY:
{
BuyDialog* dialog = new BuyDialog(npcId);
dialog->reset();
dialog->setMoney(PlayerInfo::getAttribute(MONEY));
while (msg.getUnreadLength())
{
int itemId = msg.readInt16();
int amount = msg.readInt16();
int value = msg.readInt16();
dialog->addItem(itemId, amount, value);
}
break;
}
case GPMSG_NPC_SELL:
{
SellDialog* dialog = new SellDialog(npcId);
dialog->reset();
dialog->setMoney(PlayerInfo::getAttribute(MONEY));
while (msg.getUnreadLength())
{
int itemId = msg.readInt16();
int amount = msg.readInt16();
int value = msg.readInt16();
dialog->addItem(new Item(itemId, amount, false), value);
}
break;
}
}
}