本文整理汇总了C++中net::MessageIn::skip方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageIn::skip方法的具体用法?C++ MessageIn::skip怎么用?C++ MessageIn::skip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net::MessageIn
的用法示例。
在下文中一共展示了MessageIn::skip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processCharLogin
void CharServerHandler::processCharLogin(Net::MessageIn &msg)
{
msg.skip(2, "packet len");
const int slots = msg.readInt8("MAX_CHARS");
msg.readInt8("sd->char_slots");
msg.readInt8("MAX_CHARS");
loginData.characterSlots = static_cast<uint16_t>(slots);
msg.skip(20, "unused 0");
delete_all(mCharacters);
mCharacters.clear();
// Derive number of characters from message length
const int count = (msg.getLength() - 27)
/ (106 + 4 + 2 + 16 + 4 + 4 + 4 + 4);
for (int i = 0; i < count; ++i)
{
Net::Character *const character = new Net::Character;
readPlayerData(msg, character);
mCharacters.push_back(character);
if (character->dummy)
{
logger->log("CharServer: Player: %s (%d)",
character->dummy->getName().c_str(), character->slot);
}
}
client->setState(STATE_CHAR_SELECT);
}
示例2: processCharLogin
void CharServerHandler::processCharLogin(Net::MessageIn &msg)
{
msg.skip(2); // Length word
int slots = msg.readInt16();
if (slots > 0 && slots < 30)
loginData.characterSlots = static_cast<short unsigned int>(slots);
bool version = msg.readInt8() == 1 && serverVersion > 0;
msg.skip(17); // 0 Unused
delete_all(mCharacters);
mCharacters.clear();
// Derive number of characters from message length
int count = (msg.getLength() - 24);
if (version)
count /= 120;
else
count /= 106;
for (int i = 0; i < count; ++i)
{
Net::Character *character = new Net::Character;
readPlayerData(msg, character, version);
mCharacters.push_back(character);
if (character && character->dummy)
{
logger->log("CharServer: Player: %s (%d)",
character->dummy->getName().c_str(), character->slot);
}
}
Client::setState(STATE_CHAR_SELECT);
}
示例3: processPartyMove
void PartyHandler::processPartyMove(Net::MessageIn &msg)
{
int id = msg.readInt32(); // id
PartyMember *m = nullptr;
if (Ea::taParty)
m = Ea::taParty->getMember(id);
if (m)
{
msg.skip(4); // 0
m->setX(msg.readInt16()); // x
m->setY(msg.readInt16()); // y
m->setOnline(msg.readInt8()); // online (if 0)
msg.readString(24); // party
msg.readString(24); // nick
m->setMap(msg.readString(16)); // map
}
else
{
msg.skip(4); // 0
msg.readInt16(); // x
msg.readInt16(); // y
msg.readInt8(); // online (if 0)
msg.readString(24); // party
msg.readString(24); // nick
msg.readString(16); // map
}
}
示例4: processCharLogin
void CharServerHandler::processCharLogin(Net::MessageIn &msg)
{
msg.skip(2); // Length word
const int slots = msg.readInt16();
if (slots > 0 && slots < 30)
loginData.characterSlots = static_cast<uint16_t>(slots);
msg.skip(18); // 0 Unused
delete_all(mCharacters);
mCharacters.clear();
// Derive number of characters from message length
const int count = (msg.getLength() - 24) / 106;
for (int i = 0; i < count; ++i)
{
Net::Character *const character = new Net::Character;
readPlayerData(msg, character, false);
mCharacters.push_back(character);
if (character->dummy)
{
logger->log("CharServer: Player: %s (%d)",
character->dummy->getName().c_str(), character->slot);
}
}
client->setState(STATE_CHAR_SELECT);
}
示例5: processPlayerSkills
void SkillHandler::processPlayerSkills(Net::MessageIn &msg) const
{
msg.readInt16(); // length
const int skillCount = (msg.getLength() - 4) / 37;
int updateSkill = 0;
for (int k = 0; k < skillCount; k++)
{
const int skillId = msg.readInt16();
msg.readInt16(); // target type
msg.skip(2); // skill pool flags
const int level = msg.readInt16();
msg.readInt16(); // sp
const int range = msg.readInt16();
msg.skip(24); // 0 unused
const int up = msg.readInt8();
const int oldLevel = PlayerInfo::getSkillLevel(skillId);
if (oldLevel && oldLevel != level)
updateSkill = skillId;
PlayerInfo::setSkillLevel(skillId, level);
if (skillDialog)
{
if (!skillDialog->updateSkill(skillId, range, up))
skillDialog->addSkill(skillId, level, range, up);
}
}
if (updateSkill && skillDialog)
skillDialog->playUpdateEffect(updateSkill);
}
示例6: 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;
}
}
示例7: 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
}
示例8: processGuildEmblem
void GuildHandler::processGuildEmblem(Net::MessageIn &msg) const
{
const int length = msg.readInt16();
msg.readInt32(); // Guild ID
msg.readInt32(); // Emblem ID
if (length < 12)
return;
msg.skip(length - 12); // Emblem data (unknown format)
}
示例9: processGuildExpulsion
void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) const
{
msg.skip(2); // size (can be many explusions in list)
const std::string nick = msg.readString(24); // Name (of expulsed?)
msg.skip(24); // acc
msg.readString(44); // Message
if (taGuild)
taGuild->removeMember(nick);
if (!player_node)
return;
if (nick == player_node->getName())
{
if (taGuild)
{
taGuild->removeFromMembers();
taGuild->clearMembers();
}
NotifyManager::notify(NotifyManager::GUILD_KICKED);
delete guildTab;
guildTab = nullptr;
if (socialWindow && taGuild)
socialWindow->removeTab(taGuild);
if (actorManager)
actorManager->updatePlayerColors();
}
else
{
NotifyManager::notify(NotifyManager::GUILD_USER_KICKED, nick);
if (actorManager)
{
Being *const b = actorManager->findBeingByName(
nick, Being::PLAYER);
if (b)
b->clearGuilds();
if (taGuild)
taGuild->removeMember(nick);
}
}
}
示例10: processGuildBasicInfo
void GuildHandler::processGuildBasicInfo(Net::MessageIn &msg)
{
const int guildId = msg.readInt32("guild id");
const int level = msg.readInt32("guild level");
const int members = msg.readInt32("connect member");
const int maxMembers = msg.readInt32("max member");
const int avgLevel = msg.readInt32("average level");
const int exp = msg.readInt32("exp");
const int nextExp = msg.readInt32("next exp");
msg.skip(12, "unused");
const int emblem = msg.readInt32("emblem id");
std::string name = msg.readString(24, "guild name");
std::string master = msg.readString(24, "master name");
std::string castle = msg.readString(16, "castles");
msg.readInt32("unused");
if (guildTab && showBasicInfo)
{
showBasicInfo = false;
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild name: %s"),
name.c_str()), ChatMsgType::BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild master: %s"),
master.c_str()), ChatMsgType::BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild level: %d"), level),
ChatMsgType::BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Online members: %d"),
members), ChatMsgType::BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Max members: %d"),
maxMembers), ChatMsgType::BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Average level: %d"),
avgLevel), ChatMsgType::BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild exp: %d"), exp),
ChatMsgType::BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild next exp: %d"),
nextExp), ChatMsgType::BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild castle: %s"),
castle.c_str()), ChatMsgType::BY_SERVER);
}
Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId));
if (!g)
return;
g->setName(name);
g->setEmblemId(emblem);
}
示例11:
void CharServerRecv::processCharLogin2(Net::MessageIn &msg)
{
// ignored
msg.readInt16("len");
msg.readUInt8("char slots");
msg.readUInt8("left slots");
msg.readUInt8("left slots");
msg.readUInt8("char slots");
msg.readUInt8("char slots");
msg.skip(20, "unused");
}
示例12: processGuildEmblemData
void GuildRecv::processGuildEmblemData(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
const int length = msg.readInt16("len");
msg.readInt32("guild id");
msg.readInt32("emblem id");
if (length < 12)
return;
msg.skip(length - 12, "emblem data");
}
示例13: processLoginData
void LoginHandler::processLoginData(Net::MessageIn &msg)
{
// Skip the length word
msg.skip(2); // size
clearWorlds();
const int worldCount = (msg.getLength() - 47) / 32;
mToken.session_ID1 = msg.readInt32();
mToken.account_ID = msg.readInt32();
mToken.session_ID2 = msg.readInt32();
msg.skip(4); // old ip
loginData.lastLogin = msg.readString(24);
msg.skip(2); // 0 unused bytes
// msg.skip(30); // unknown
// reserve bits for future usage
mToken.sex = Being::intToGender(static_cast<uint8_t>(
msg.readUInt8() & 3U));
for (int i = 0; i < worldCount; i++)
{
WorldInfo *const world = new WorldInfo;
world->address = msg.readInt32();
world->port = msg.readInt16();
world->name = msg.readString(20);
world->online_users = msg.readInt16();
config.setValue("updatehost", mUpdateHost);
world->updateHost = mUpdateHost;
msg.skip(2); // maintenance
msg.skip(2); // new
logger->log("Network: Server: %s (%s:%d)", world->name.c_str(),
ipToString(world->address), world->port);
mWorlds.push_back(world);
}
client->setState(STATE_WORLD_SELECT);
}
示例14: processPlayerShortcuts
void PlayerHandler::processPlayerShortcuts(Net::MessageIn &msg)
{
// +++ player shortcuts ignored. It also disabled on server side.
// may be in future better use it?
msg.readUInt8("unused?");
for (int f = 0; f < 27; f ++)
{
msg.readUInt8("type 0: item, 1: skill");
msg.readInt32("item or skill id");
msg.readInt16("skill level");
}
msg.skip(77, "unused");
}
示例15: processGuildBasicInfo
void GuildHandler::processGuildBasicInfo(Net::MessageIn &msg)
{
const int guildId = msg.readInt32(); // Guild ID
const int level = msg.readInt32(); // Guild level
const int members = msg.readInt32(); // 'Connect member'
const int maxMembers = msg.readInt32(); // 'Max member'
const int avgLevel = msg.readInt32(); // Average level
const int exp = msg.readInt32(); // Exp
const int nextExp = msg.readInt32(); // Next exp
msg.skip(16); // 0 unused
std::string name = msg.readString(24); // Name
std::string master = msg.readString(24); // Master's name
std::string castle = msg.readString(20); // Castles
// (ie: "Six Castles" or "None Taken")
if (guildTab && showBasicInfo)
{
showBasicInfo = false;
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild name: %s"),
name.c_str()), BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild master: %s"),
master.c_str()), BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild level: %d"), level), BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Online members: %d"),
members), BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Max members: %d"),
maxMembers), BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Average level: %d"),
avgLevel), BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild exp: %d"), exp), BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild next exp: %d"),
nextExp), BY_SERVER);
// TRANSLATORS: guild info message
guildTab->chatLog(strprintf(_("Guild castle: %s"),
castle.c_str()), BY_SERVER);
}
Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId));
if (!g)
return;
g->setName(name);
}