本文整理汇总了C++中net::MessageIn::readInt16方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageIn::readInt16方法的具体用法?C++ MessageIn::readInt16怎么用?C++ MessageIn::readInt16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net::MessageIn
的用法示例。
在下文中一共展示了MessageIn::readInt16方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processSearchOpen
void SearchStoreHandler::processSearchOpen(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
msg.readInt16("effect");
msg.readUInt8("uses");
}
示例2: handleMessage
void TradeHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case GPMSG_TRADE_REQUEST:
{
Being *being = actorSpriteManager->findBeing(msg.readInt16());
if (!being || !mAcceptTradeRequests)
{
respond(false);
break;
}
mTrading = true;
tradePartnerName = being->getName();
tradePartnerID = being->getId();
ConfirmDialog *dlg = new ConfirmDialog(_("Request for Trade"),
strprintf(_("%s wants to trade with you, do you accept?"),
tradePartnerName.c_str()));
dlg->addActionListener(&listener);
} break;
case GPMSG_TRADE_ADD_ITEM:
{
int type = msg.readInt16();
int amount = msg.readInt8();
tradeWindow->addItem(type, false, amount);
} break;
case GPMSG_TRADE_SET_MONEY:
tradeWindow->setMoney(msg.readInt32());
break;
case GPMSG_TRADE_START:
tradeWindow->reset();
tradeWindow->setCaption(strprintf(_("Trading with %s"),
tradePartnerName.c_str()));
tradeWindow->setVisible(true);
break;
case GPMSG_TRADE_BOTH_CONFIRM:
tradeWindow->receivedOk(false);
break;
case GPMSG_TRADE_AGREED:
tradeWindow->receivedOk(false);
break;
case GPMSG_TRADE_CANCEL:
SERVER_NOTICE(_("Trade canceled."))
tradeWindow->setVisible(false);
tradeWindow->reset();
mTrading = false;
break;
case GPMSG_TRADE_COMPLETE:
SERVER_NOTICE(_("Trade completed."))
tradeWindow->setVisible(false);
tradeWindow->reset();
mTrading = false;
break;
}
}
示例3: processPartySettings
void PartyHandler::processPartySettings(Net::MessageIn &msg)
{
if (!Ea::partyTab)
{
if (!chatWindow)
return;
Ea::partyTab = new PartyTab();
Ea::partyTab->loadFromLogFile("#Party");
}
// These seem to indicate the sharing mode for exp and items
short exp = msg.readInt16();
short item = msg.readInt16();
if (!Ea::partyTab)
return;
switch (exp)
{
case PARTY_SHARE:
if (mShareExp == PARTY_SHARE)
break;
mShareExp = PARTY_SHARE;
if (Ea::partyTab)
{
Ea::partyTab->chatLog(
_("Experience sharing enabled."), BY_SERVER);
}
break;
case PARTY_SHARE_NO:
if (mShareExp == PARTY_SHARE_NO)
break;
mShareExp = PARTY_SHARE_NO;
if (Ea::partyTab)
{
Ea::partyTab->chatLog(
_("Experience sharing disabled."), BY_SERVER);
}
break;
case PARTY_SHARE_NOT_POSSIBLE:
if (mShareExp == PARTY_SHARE_NOT_POSSIBLE)
break;
mShareExp = PARTY_SHARE_NOT_POSSIBLE;
if (Ea::partyTab)
{
Ea::partyTab->chatLog(
_("Experience sharing not possible."),
BY_SERVER);
}
break;
default:
logger->log("QQQ Unknown party exp option: %d\n", exp);
break;
}
switch (item)
{
case PARTY_SHARE:
if (mShareItems == PARTY_SHARE)
break;
mShareItems = PARTY_SHARE;
if (Ea::partyTab)
{
Ea::partyTab->chatLog(
_("Item sharing enabled."), BY_SERVER);
}
break;
case PARTY_SHARE_NO:
if (mShareItems == PARTY_SHARE_NO)
break;
mShareItems = PARTY_SHARE_NO;
if (Ea::partyTab)
{
Ea::partyTab->chatLog(
_("Item sharing disabled."), BY_SERVER);
}
break;
case PARTY_SHARE_NOT_POSSIBLE:
if (mShareItems == PARTY_SHARE_NOT_POSSIBLE)
break;
mShareItems = PARTY_SHARE_NOT_POSSIBLE;
if (Ea::partyTab)
{
Ea::partyTab->chatLog(
_("Item sharing not possible."), BY_SERVER);
}
break;
default:
logger->log("QQQ Unknown party item option: %d\n",
exp);
break;
}
}
示例4: readPlayerData
void CharServerHandler::readPlayerData(Net::MessageIn &msg, Net::Character *character)
{
const Token &token =
static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
LocalPlayer *tempPlayer = new LocalPlayer(msg.readInt32(), 0);
tempPlayer->setGender(token.sex);
character->data.mAttributes[EXP] = msg.readInt32();
character->data.mAttributes[MONEY] = msg.readInt32();
character->data.mStats[JOB].exp = msg.readInt32();
int temp = msg.readInt32();
character->data.mStats[JOB].base = temp;
character->data.mStats[JOB].mod = temp;
tempPlayer->setSprite(SPRITE_SHOE, msg.readInt16());
tempPlayer->setSprite(SPRITE_GLOVES, msg.readInt16());
tempPlayer->setSprite(SPRITE_CAPE, msg.readInt16());
tempPlayer->setSprite(SPRITE_MISC1, msg.readInt16());
msg.readInt32(); // option
msg.readInt32(); // karma
msg.readInt32(); // manner
msg.skip(2); // unknown
character->data.mAttributes[HP] = msg.readInt16();
character->data.mAttributes[MAX_HP] = msg.readInt16();
character->data.mAttributes[MP] = msg.readInt16();
character->data.mAttributes[MAX_MP] = msg.readInt16();
msg.readInt16(); // speed
tempPlayer->setSubtype(msg.readInt16()); // class (used for race)
int hairStyle = msg.readInt16();
Uint16 weapon = msg.readInt16();
tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", true);
character->data.mAttributes[LEVEL] = msg.readInt16();
msg.readInt16(); // skill point
tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, msg.readInt16()); // head bottom
tempPlayer->setSprite(SPRITE_SHIELD, msg.readInt16());
tempPlayer->setSprite(SPRITE_HAT, msg.readInt16()); // head option top
tempPlayer->setSprite(SPRITE_TOPCLOTHES, msg.readInt16()); // head option mid
tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1,
hairDB.getHairColor(msg.readInt16()));
tempPlayer->setSprite(SPRITE_MISC2, msg.readInt16());
tempPlayer->setName(msg.readString(24));
character->dummy = tempPlayer;
for (int i = 0; i < 6; i++)
character->data.mStats[i + STRENGTH].base = msg.readInt8();
character->slot = msg.readInt8(); // character slot
msg.readInt8(); // unknown
}
示例5: handleMessage
void TradeHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
case SMSG_TRADE_REQUEST:
// If a trade window or request window is already open, send a
// trade cancel to any other trade request.
//
// Note that it would be nice if the server would prevent this
// situation, and that the requesting player would get a
// special message about the player being occupied.
tradePartnerName = msg.readString(24);
if (player_relations.hasPermission(tradePartnerName,
PlayerRelation::TRADE))
{
if (!player_node->tradeRequestOk())
{
Net::getTradeHandler()->respond(false);
break;
}
player_node->setTrading(true);
ConfirmDialog *dlg;
dlg = new ConfirmDialog(_("Request for Trade"),
strprintf(_("%s wants to trade with you, do you "
"accept?"), tradePartnerName.c_str()));
dlg->addActionListener(&listener);
}
else
{
Net::getTradeHandler()->respond(false);
break;
}
break;
case SMSG_TRADE_RESPONSE:
switch (msg.readInt8())
{
case 0: // Too far away
localChatTab->chatLog(_("Trading isn't possible. Trade "
"partner is too far away."), BY_SERVER);
break;
case 1: // Character doesn't exist
localChatTab->chatLog(_("Trading isn't possible. Character "
"doesn't exist."), BY_SERVER);
break;
case 2: // Invite request check failed...
localChatTab->chatLog(_("Trade cancelled due to an unknown "
"reason."), BY_SERVER);
break;
case 3: // Trade accepted
tradeWindow->reset();
tradeWindow->setCaption(strprintf(_("Trade: You and %s"),
tradePartnerName.c_str()));
tradeWindow->setVisible(true);
break;
case 4: // Trade cancelled
if (player_relations.hasPermission(tradePartnerName,
PlayerRelation::SPEECH_LOG))
localChatTab->chatLog(strprintf(_("Trade with %s "
"cancelled."), tradePartnerName.c_str()),
BY_SERVER);
// otherwise ignore silently
tradeWindow->setVisible(false);
player_node->setTrading(false);
break;
default: // Shouldn't happen as well, but to be sure
localChatTab->chatLog(_("Unhandled trade cancel packet."),
BY_SERVER);
break;
}
break;
case SMSG_TRADE_ITEM_ADD:
{
int amount = msg.readInt32();
int type = msg.readInt16();
msg.readInt8(); // identified flag
msg.readInt8(); // attribute
msg.readInt8(); // refine
msg.skip(8); // card (4 shorts)
// TODO: handle also identified, etc
if (type == 0) {
tradeWindow->setMoney(amount);
} else {
tradeWindow->addItem(type, false, amount, false);
}
}
break;
case SMSG_TRADE_ITEM_ADD_RESPONSE:
// Trade: New Item add response (was 0x00ea, now 01b1)
{
const int index = msg.readInt16() - INVENTORY_OFFSET;
Item *item = player_node->getInventory()->getItem(index);
if (!item)
{
//.........这里部分代码省略.........
示例6: readPlayerData
void CharServerHandler::readPlayerData(Net::MessageIn &msg,
Net::Character *character,
bool withColors)
{
if (!character)
return;
const Token &token =
static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
LocalPlayer *tempPlayer = new LocalPlayer(msg.readInt32(), 0);
tempPlayer->setGender(token.sex);
PlayerInfoBackend &data = character->data;
data.mAttributes[EXP] = msg.readInt32();
data.mAttributes[MONEY] = msg.readInt32();
data.mStats[JOB].exp = msg.readInt32();
int temp = msg.readInt32();
data.mStats[JOB].base = temp;
data.mStats[JOB].mod = temp;
int shoes = msg.readInt16();
int gloves = msg.readInt16();
int cape = msg.readInt16();
int misc1 = msg.readInt16();
msg.readInt32(); // option
msg.readInt32(); // karma
msg.readInt32(); // manner
msg.readInt16(); // character points left
data.mAttributes[HP] = msg.readInt16();
data.mAttributes[MAX_HP] = msg.readInt16();
data.mAttributes[MP] = msg.readInt16();
data.mAttributes[MAX_MP] = msg.readInt16();
msg.readInt16(); // speed
tempPlayer->setSubtype(msg.readInt16()); // class (used for race)
int hairStyle = msg.readInt16();
uint16_t weapon = msg.readInt16(); // server not used it. may be need use?
tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true);
data.mAttributes[LEVEL] = msg.readInt16();
msg.readInt16(); // skill point
int bottomClothes = msg.readInt16();
int shield = msg.readInt16();
int hat = msg.readInt16(); // head option top
int topClothes = msg.readInt16();
tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1,
ItemDB::get(-hairStyle).getDyeColorsString(msg.readInt16()));
int misc2 = msg.readInt16();
tempPlayer->setName(msg.readString(24));
character->dummy = tempPlayer;
for (int i = 0; i < 6; i++)
character->data.mStats[i + STR].base = msg.readInt8();
if (withColors)
{
tempPlayer->setSprite(SPRITE_SHOE, shoes, "", msg.readInt8());
tempPlayer->setSprite(SPRITE_GLOVES, gloves, "", msg.readInt8());
tempPlayer->setSprite(SPRITE_CAPE, cape, "", msg.readInt8());
tempPlayer->setSprite(SPRITE_MISC1, misc1, "", msg.readInt8());
tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes,
"", msg.readInt8());
//to avoid show error (error.xml) need remove this sprite
if (!config.getBoolValue("hideShield"))
tempPlayer->setSprite(SPRITE_SHIELD, shield, "", msg.readInt8());
else
msg.readInt8();
tempPlayer->setSprite(SPRITE_HAT, hat, "",
msg.readInt8()); // head option top
tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes, "",
msg.readInt8());
tempPlayer->setSprite(SPRITE_MISC2, misc2, "", msg.readInt8());
msg.skip(5);
character->slot = msg.readInt8(); // character slot
}
else
{
tempPlayer->setSprite(SPRITE_SHOE, shoes);
tempPlayer->setSprite(SPRITE_GLOVES, gloves);
tempPlayer->setSprite(SPRITE_CAPE, cape);
tempPlayer->setSprite(SPRITE_MISC1, misc1);
tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes);
//to avoid show error (error.xml) need remove this sprite
if (!config.getBoolValue("hideShield"))
tempPlayer->setSprite(SPRITE_SHIELD, shield);
tempPlayer->setSprite(SPRITE_HAT, hat); // head option top
tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes);
tempPlayer->setSprite(SPRITE_MISC2, misc2);
character->slot = msg.readInt8(); // character slot
//.........这里部分代码省略.........
示例7: processBattleUpdateScore
void BattleGroundRecv::processBattleUpdateScore(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
msg.readInt16("camp a points");
msg.readInt16("camp b points");
}
示例8: processAuctionClose
void AuctionRecv::processAuctionClose(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
msg.readInt16("flag");
}
示例9: handleBeingsMoveMessage
void BeingHandler::handleBeingsMoveMessage(Net::MessageIn &msg)
{
while (msg.getUnreadLength())
{
int id = msg.readInt16();
int flags = msg.readInt8();
Being *being = actorSpriteManager->findBeing(id);
int sx = 0, sy = 0, dx = 0, dy = 0, speed = 0;
if ((!flags & (MOVING_POSITION | MOVING_DESTINATION)))
continue;
if (flags & MOVING_POSITION)
{
sx = msg.readInt16();
sy = msg.readInt16();
}
if (flags & MOVING_DESTINATION)
{
dx = msg.readInt16();
dy = msg.readInt16();
speed = msg.readInt8();
}
if (!being)
continue;
if (speed)
{
/*
* The being's speed is transfered in tiles per second * 10
* to keep it transferable in a Byte.
* We set it back to tiles per second and in a float.
*/
float speedTilesSeconds = (float) speed / 10;
being->setMoveSpeed(Vector(speedTilesSeconds, speedTilesSeconds,
0));
}
// Ignore messages from the server for the local player
if (being == player_node)
continue;
// If the position differs too much from the actual one, we resync
// the being position
if (flags & MOVING_POSITION)
{
if (!being->getMap()->containsPixel(sx, sy))
{
logger->log("Warning: Received GPMSG_BEINGS_MOVE for being id "
"%i with position outside the map boundaries "
"(x = %i, y = %i)", id, sx, sy);
continue;
}
Vector serverPos(sx, sy);
if (serverPos.length()
- being->getPosition().length() > POSITION_DIFF_TOLERANCE)
being->setPosition(serverPos);
}
if (flags & MOVING_DESTINATION)
{
if (!being->getMap()->containsPixel(dx, dy))
{
logger->log("Warning: Received GPMSG_BEINGS_MOVE for being id "
"%i with destination outside the map boundaries "
"(x = %i, y = %i)", id, dx, dy);
continue;
}
being->setDestination(dx, dy);
}
}
}
示例10: processPlayerUpgradeMessage
void PlayerHandler::processPlayerUpgradeMessage(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
msg.readInt32("result");
msg.readInt16("item id");
}
示例11: processAuctionSetItem
void AuctionRecv::processAuctionSetItem(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
msg.readInt16("index");
msg.readUInt8("flag");
}
示例12: processNotifyMapInfo
void PlayerHandler::processNotifyMapInfo(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
msg.readInt16("type");
}
示例13:
void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg)
{
BLOCK_START("PlayerHandler::processPlayerStatUpdate5")
PlayerInfo::setAttribute(Attributes::CHAR_POINTS,
msg.readInt16("char points"));
unsigned int val = msg.readUInt8("str");
PlayerInfo::setStatBase(Attributes::STR, val);
if (statusWindow)
{
statusWindow->setPointsNeeded(Attributes::STR,
msg.readUInt8("str cost"));
}
else
{
msg.readUInt8("str need");
}
val = msg.readUInt8("agi");
PlayerInfo::setStatBase(Attributes::AGI, val);
if (statusWindow)
{
statusWindow->setPointsNeeded(Attributes::AGI,
msg.readUInt8("agi cost"));
}
else
{
msg.readUInt8("agi cost");
}
val = msg.readUInt8("vit");
PlayerInfo::setStatBase(Attributes::VIT, val);
if (statusWindow)
{
statusWindow->setPointsNeeded(Attributes::VIT,
msg.readUInt8("vit cost"));
}
else
{
msg.readUInt8("vit cost");
}
val = msg.readUInt8("int");
PlayerInfo::setStatBase(Attributes::INT, val);
if (statusWindow)
{
statusWindow->setPointsNeeded(Attributes::INT,
msg.readUInt8("int cost"));
}
else
{
msg.readUInt8("int cost");
}
val = msg.readUInt8("dex");
PlayerInfo::setStatBase(Attributes::DEX, val);
if (statusWindow)
{
statusWindow->setPointsNeeded(Attributes::DEX,
msg.readUInt8("dex cost"));
}
else
{
msg.readUInt8("dex cost");
}
val = msg.readUInt8("luk");
PlayerInfo::setStatBase(Attributes::LUK, val);
if (statusWindow)
{
statusWindow->setPointsNeeded(Attributes::LUK,
msg.readUInt8("luk cost"));
}
else
{
msg.readUInt8("luk cost");
}
PlayerInfo::setStatBase(Attributes::ATK,
msg.readInt16("left atk"), Notify_false);
PlayerInfo::setStatMod(Attributes::ATK, msg.readInt16("right atk"));
PlayerInfo::updateAttrs();
val = msg.readInt16("right matk");
PlayerInfo::setStatBase(Attributes::MATK, val, Notify_false);
val = msg.readInt16("left matk");
PlayerInfo::setStatMod(Attributes::MATK, val);
PlayerInfo::setStatBase(Attributes::DEF,
msg.readInt16("left def"), Notify_false);
PlayerInfo::setStatMod(Attributes::DEF, msg.readInt16("right def"));
PlayerInfo::setStatBase(Attributes::MDEF,
msg.readInt16("left mdef"), Notify_false);
PlayerInfo::setStatMod(Attributes::MDEF, msg.readInt16("right mdef"));
PlayerInfo::setStatBase(Attributes::HIT, msg.readInt16("hit"));
PlayerInfo::setStatBase(Attributes::FLEE,
//.........这里部分代码省略.........
示例14: processSearchClickAck
void SearchStoreHandler::processSearchClickAck(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
msg.readInt16("x");
msg.readInt16("y");
}
示例15: processReport
void VendingHandler::processReport(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
msg.readInt16("inv index");
msg.readInt16("amount");
}