本文整理汇总了C++中net::MessageIn类的典型用法代码示例。如果您正苦于以下问题:C++ MessageIn类的具体用法?C++ MessageIn怎么用?C++ MessageIn使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MessageIn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processBuyAck
void VendingHandler::processBuyAck(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
msg.readInt16("inv index");
msg.readInt16("amount");
msg.readUInt8("flag");
}
示例2: processNpcSell
void BuySellHandler::processNpcSell(Net::MessageIn &msg, int offset)
{
msg.readInt16(); // length
int n_items = (msg.getLength() - 4) / 10;
if (n_items > 0)
{
SellDialog *dialog = new SellDialog(mNpcId);
dialog->setMoney(PlayerInfo::getAttribute(MONEY));
for (int k = 0; k < n_items; k++)
{
int index = msg.readInt16() - offset;
int value = msg.readInt32();
msg.readInt32(); // OCvalue
Item *item = PlayerInfo::getInventory()->getItem(index);
if (item && !(item->isEquipped()))
dialog->addItem(item, value);
}
}
else
{
SERVER_NOTICE(_("Nothing to sell."))
}
}
示例3: handleLooks
static void handleLooks(Being *being, Net::MessageIn &msg)
{
// Order of sent slots. Has to be in sync with the server code.
static int const nb_slots = 4;
static int const slots[nb_slots] =
{ SPRITE_WEAPON, SPRITE_HAT, SPRITE_TOPCLOTHES,
SPRITE_BOTTOMCLOTHES };
int mask = msg.readInt8();
if (mask & (1 << 7))
{
// The equipment has to be cleared first.
for (int i = 0; i < nb_slots; ++i)
{
being->setSprite(slots[i], 0);
}
}
// Fill slots enumerated by the bitmask.
for (int i = 0; i < nb_slots; ++i)
{
if (!(mask & (1 << i))) continue;
int id = msg.readInt16();
being->setSprite(slots[i], id,"", (slots[i] == SPRITE_WEAPON));
}
}
示例4: processNpcSell
void BuySellRecv::processNpcSell(Net::MessageIn &msg)
{
msg.readInt16("len");
const int n_items = (msg.getLength() - 4) / 10;
if (n_items > 0)
{
SellDialog *const dialog = CREATEWIDGETR(NpcSellDialog, mNpcId);
dialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
for (int k = 0; k < n_items; k++)
{
const int index = msg.readInt16("index") - INVENTORY_OFFSET;
const int value = msg.readInt32("value");
msg.readInt32("value?");
const Item *const item = PlayerInfo::getInventory()
->getItem(index);
if (item && item->isEquipped() == Equipped_false)
dialog->addItem(item, value);
}
}
else
{
NotifyManager::notify(NotifyTypes::SELL_LIST_EMPTY);
}
}
示例5: processPlayerRankPoints
void PlayerHandler::processPlayerRankPoints(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
msg.readInt16("type");
msg.readInt32("points");
msg.readInt32("fame");
}
示例6: processPlayerAutoShadowSpellList
void PlayerHandler::processPlayerAutoShadowSpellList(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
const int count = (msg.readInt16("len") - 8) / 2;
for (int f = 0; f < count; f ++)
msg.readInt16("skill id");
}
示例7: fromInt
void ItemRecv::processItemDropped2(Net::MessageIn &msg)
{
const BeingId id = msg.readBeingId("id");
const int itemId = msg.readInt16("item id");
const ItemTypeT itemType = static_cast<ItemTypeT>(msg.readUInt8("type"));
const Identified identified = fromInt(
msg.readUInt8("identify"), Identified);
const Damaged damaged = fromBool(msg.readUInt8("attribute"), Damaged);
const uint8_t refine = msg.readUInt8("refine");
int cards[maxCards];
for (int f = 0; f < maxCards; f++)
cards[f] = msg.readInt16("card");
const int x = msg.readInt16("x");
const int y = msg.readInt16("y");
const int amount = msg.readInt16("amount");
const int subX = CAST_S32(msg.readInt8("subx"));
const int subY = CAST_S32(msg.readInt8("suby"));
if (actorManager)
{
actorManager->createItem(id,
itemId,
x, y,
itemType,
amount,
refine,
ItemColorManager::getColorFromCards(&cards[0]),
identified,
damaged,
subX, subY,
&cards[0]);
}
}
示例8: processSkillItemListWindow
void SkillRecv::processSkillItemListWindow(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
msg.readInt32("skill level");
msg.readInt32("unused");
}
示例9: processMercenaryUpdate
void MercenaryRecv::processMercenaryUpdate(Net::MessageIn &msg)
{
const int sp = msg.readInt16("type");
const int val = msg.readInt32("value");
switch (sp)
{
setMercStat(Sp::ATK1, Attributes::MERC_ATK);
setMercStat(Sp::MATK1, Attributes::MERC_MATK);
setMercStat(Sp::HIT, Attributes::MERC_HIT);
setMercStat(Sp::CRITICAL, Attributes::MERC_CRIT);
setMercStat(Sp::DEF1, Attributes::MERC_DEF);
setMercStat(Sp::MDEF1, Attributes::MERC_MDEF);
setMercStat(Sp::MERCFLEE, Attributes::MERC_FLEE);
setMercStat(Sp::ASPD, Attributes::MERC_ATTACK_DELAY);
setMercStat(Sp::HP, Attributes::MERC_HP);
setMercStat(Sp::MAXHP, Attributes::MERC_MAX_HP);
setMercStat(Sp::SP, Attributes::MERC_MP);
setMercStat(Sp::MAXSP, Attributes::MERC_MAX_MP);
setMercStat(Sp::MERCKILLS, Attributes::MERC_KILLS);
setMercStat(Sp::MERCFAITH, Attributes::MERC_FAITH);
default:
reportAlways("Unknown mercenary stat %d",
sp);
break;
}
}
示例10: 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);
}
示例11: processTradeResponse
void TradeRecv::processTradeResponse(Net::MessageIn &msg)
{
const uint8_t type = msg.readUInt8("type");
msg.readInt32("char id");
msg.readInt16("base level");
Ea::TradeRecv::processTradeResponseContinue(type);
}
示例12: handleCreateEffectPos
void EffectHandler::handleCreateEffectPos(Net::MessageIn &msg)
{
int id = msg.readInt16();
Uint16 x = msg.readInt16();
Uint16 y = msg.readInt16();
effectManager->trigger(id, x, y);
}
示例13: processMapLogin
void GameHandler::processMapLogin(Net::MessageIn &msg)
{
unsigned char direction;
uint16_t x, 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;
GameHandler *const g = static_cast<GameHandler*>(gameHandler);
if (g)
{
Network *const network = g->mNetwork;
if (network)
network->pauseDispatch();
}
// Switch now or we'll have problems
client->setState(STATE_GAME);
if (localPlayer)
localPlayer->setTileCoords(x, y);
}
示例14: processSkillProduceEffect
void SkillRecv::processSkillProduceEffect(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
msg.readInt16("flag");
msg.readInt16("item id");
}
示例15: 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);
}