本文整理汇总了C++中net::MessageIn::readInt32方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageIn::readInt32方法的具体用法?C++ MessageIn::readInt32怎么用?C++ MessageIn::readInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net::MessageIn
的用法示例。
在下文中一共展示了MessageIn::readInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processItemDropped
void ItemHandler::processItemDropped(Net::MessageIn &msg) const
{
const int id = msg.readInt32();
const int itemId = msg.readInt16();
const unsigned char identify = msg.readInt8(); // identify flag
const int x = msg.readInt16();
const int y = msg.readInt16();
const int subX = msg.readInt8();
const int subY = msg.readInt8();
const int amount = msg.readInt16();
if (actorManager)
{
actorManager->createItem(id, itemId,
x, y, amount, identify, subX, subY);
}
}
示例2: processPartySettings
void PartyRecv::processPartySettings(Net::MessageIn &msg)
{
if (!partyTab)
{
if (!chatWindow)
return;
Ea::PartyRecv::createTab();
}
msg.readInt32("party exp");
const PartyShareT exp = static_cast<PartyShareT>(
msg.readInt8("share exp"));
const PartyShareT item = static_cast<PartyShareT>(
msg.readInt8("share item"));
Ea::PartyRecv::processPartySettingsContinue(msg, exp, item);
}
示例3: processPartyLeave
void PartyHandler::processPartyLeave(Net::MessageIn &msg)
{
int id = msg.readInt32();
std::string nick = msg.readString(24);
msg.readInt8(); // fail
if (!player_node)
return;
if (id == player_node->getId())
{
if (Ea::taParty)
{
Ea::taParty->removeFromMembers();
Ea::taParty->clearMembers();
}
SERVER_NOTICE(_("You have left the party."))
delete Ea::partyTab;
Ea::partyTab = nullptr;
if (socialWindow && Ea::taParty)
socialWindow->removeTab(Ea::taParty);
player_node->setPartyName("");
}
else
{
if (Ea::partyTab)
{
Ea::partyTab->chatLog(strprintf(
_("%s has left your party."),
nick.c_str()), BY_SERVER);
}
if (actorSpriteManager)
{
Being *b = actorSpriteManager->findBeing(id);
if (b && b->getType() == Being::PLAYER)
{
b->setParty(nullptr);
b->setPartyName("");
}
}
if (Ea::taParty)
Ea::taParty->removeMember(id);
}
}
示例4: processPlayerGetExp
void PlayerHandler::processPlayerGetExp(Net::MessageIn &msg)
{
if (!localPlayer)
return;
const BeingId id = msg.readBeingId("player id");
const int exp = msg.readInt32("exp amount");
const int stat = msg.readInt16("exp type");
const bool fromQuest = msg.readInt16("is from quest");
if (!fromQuest && id == localPlayer->getId())
{
if (stat == 1)
localPlayer->addXpMessage(exp);
else if (stat == 2)
localPlayer->addJobMessage(exp);
else
UNIMPLIMENTEDPACKET;
}
// need show particle depend on isQuest flag, for now ignored
}
示例5: processPartyInvited
void PartyHandler::processPartyInvited(Net::MessageIn &msg)
{
int id = msg.readInt32();
std::string partyName = msg.readString(24);
std::string nick("");
Being *being;
if (actorSpriteManager)
{
if ((being = actorSpriteManager->findBeing(id)))
{
if (being && being->getType() == Being::PLAYER)
nick = being->getName();
}
}
if (socialWindow)
socialWindow->showPartyInvite(partyName, nick);
}
示例6: processAskForChildReply
void FamilyRecv::processAskForChildReply(Net::MessageIn &msg)
{
const int type = msg.readInt32("type");
switch (type)
{
case 0:
NotifyManager::notify(NotifyTypes::ADOPT_CHILD_ERROR_HAVE_BABY);
break;
case 1:
NotifyManager::notify(NotifyTypes::ADOPT_CHILD_ERROR_LEVEL);
break;
case 2:
NotifyManager::notify(NotifyTypes::ADOPT_CHILD_ERROR_BABY_MARRIED);
break;
default:
UNIMPLEMENTEDPACKETFIELD(type);
break;
}
}
示例7: processBuyingStoreCreateFailed
void BuyingStoreRecv::processBuyingStoreCreateFailed(Net::MessageIn &msg)
{
const int16_t result = msg.readInt16("result");
const int weight = msg.readInt32("weight");
switch (result)
{
case 1:
default:
NotifyManager::notify(NotifyTypes::BUYING_STORE_CREATE_FAILED);
break;
case 2:
NotifyManager::notify(
NotifyTypes::BUYING_STORE_CREATE_FAILED_WEIGHT,
weight);
break;
case 8:
NotifyManager::notify(NotifyTypes::BUYING_STORE_CREATE_EMPTY);
break;
}
}
示例8: processGuildPosNameList
void GuildRecv::processGuildPosNameList(Net::MessageIn &msg)
{
if (taGuild == nullptr)
{
logger->log1("!taGuild");
return;
}
const int length = msg.readInt16("len");
if (length < 4)
return;
const int count = (length - 4) / 28;
for (int i = 0; i < count; i++)
{
const int id = msg.readInt32("position id");
const std::string name = msg.readString(24, "position name");
taGuild->addPos(id, name);
}
}
示例9: processBuyingStoreDeleteItem
void BuyingStoreRecv::processBuyingStoreDeleteItem(Net::MessageIn &msg)
{
Inventory *const inventory = localPlayer
? PlayerInfo::getInventory() : nullptr;
const int index = msg.readInt16("index") - INVENTORY_OFFSET;
const int amount = msg.readInt16("amount");
msg.readInt32("price");
if (inventory)
{
if (Item *const item = inventory->getItem(index))
{
item->increaseQuantity(-amount);
if (item->getQuantity() == 0)
inventory->removeItemAt(index);
ArrowsListener::distributeEvent();
}
}
}
示例10: processGuildPosNameList
void GuildHandler::processGuildPosNameList(Net::MessageIn &msg) const
{
if (!taGuild)
{
logger->log1("!taGuild");
return;
}
const int length = msg.readInt16();
if (length < 4)
return;
const int count = (length - 4) / 28;
for (int i = 0; i < count; i++)
{
const int id = msg.readInt32(); // ID
const std::string name = msg.readString(24); // Position name
taGuild->addPos(id, name);
}
}
示例11: processAchievementUpdate
void AchievementRecv::processAchievementUpdate(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
msg.readInt32("total points");
msg.readInt16("rank level");
msg.readInt32("rank points");
msg.readInt32("rank points need");
msg.readInt32("ach id");
msg.readUInt8("completed");
for (int d = 0; d < 10; d ++)
msg.readInt32("objective");
msg.readInt32("completed at");
msg.readUInt8("reward");
}
示例12: processAchievementList
void AchievementRecv::processAchievementList(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
const int count = (msg.readInt16("len") - 22) / 50;
msg.readInt32("total achievements");
msg.readInt32("total points");
msg.readInt16("rank level");
msg.readInt32("rank points");
msg.readInt32("rank points need");
for (int f = 0; f < count; f ++)
{
msg.readInt32("ach id");
msg.readUInt8("completed");
for (int d = 0; d < 10; d ++)
msg.readInt32("objective");
msg.readInt32("completed at");
msg.readUInt8("reward");
}
}
示例13: processPartyMemberInfo
void PartyRecv::processPartyMemberInfo(Net::MessageIn &msg)
{
const BeingId id = msg.readBeingId("account id");
if (msg.getVersion() >= 20171207)
msg.readBeingId("char id");
const bool leader = msg.readInt32("leader") == 0U;
int level = 0;
if (msg.getVersionMain() >= 20170524 ||
msg.getVersionRe() >= 20170502 ||
packets_zero == true)
{
msg.readInt16("class");
level = msg.readInt16("level");
}
const int x = msg.readInt16("x");
const int y = msg.readInt16("y");
const bool online = msg.readInt8("online") == 0U;
msg.readString(24, "party name");
const std::string nick = msg.readString(24, "player name");
const std::string map = msg.readString(16, "map name");
msg.readInt8("pickup item share (&1)");
msg.readInt8("get item share (&2)");
if (Ea::taParty == nullptr)
return;
PartyMember *const member = Ea::taParty->addMember(id, nick);
if (member != nullptr)
{
if ((partyTab != nullptr) && member->getOnline() != online)
partyTab->showOnline(nick, fromBool(online, Online));
member->setLeader(leader);
member->setOnline(online);
member->setMap(map);
member->setX(x);
member->setY(y);
if (level != 0)
member->setLevel(level);
}
}
示例14: processMapLogin
void GameRecv::processMapLogin(Net::MessageIn &msg)
{
unsigned char direction;
uint16_t x;
uint16_t y;
msg.readInt32("tick");
msg.readCoordinates(x, y, direction, "position");
msg.readInt16("unknown?");
logger->log("Protocol: Player start position: (%d, %d),"
" Direction: %d", x, y, direction);
mLastHost &= 0xffffff;
Network *const network = Network::mInstance;
if (network != nullptr)
network->pauseDispatch();
// Switch now or we'll have problems
client->setState(State::GAME);
if (localPlayer != nullptr)
localPlayer->setTileCoords(x, y);
}
示例15: processPartyUpdateHp
void PartyHandler::processPartyUpdateHp(Net::MessageIn &msg)
{
int id = msg.readInt32();
int hp = msg.readInt16();
int maxhp = msg.readInt16();
PartyMember *m = nullptr;
if (Ea::taParty)
m = Ea::taParty->getMember(id);
if (m)
{
m->setHp(hp);
m->setMaxHp(maxhp);
}
// The server only sends this when the member is in range, so
// lets make sure they get the party hilight.
if (actorSpriteManager && Ea::taParty)
{
if (Being *b = actorSpriteManager->findBeing(id))
b->setParty(Ea::taParty);
}
}