本文整理汇总了C++中net::MessageIn::readUInt8方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageIn::readUInt8方法的具体用法?C++ MessageIn::readUInt8怎么用?C++ MessageIn::readUInt8使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net::MessageIn
的用法示例。
在下文中一共展示了MessageIn::readUInt8方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processTradeItemAdd
void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
{
const int amount = msg.readInt32("amount");
const int type = msg.readInt16("type");
const uint8_t identify = msg.readUInt8("identify");
msg.readUInt8("attribute");
const uint8_t refine = msg.readUInt8("refine");
int cards[4];
for (int f = 0; f < 4; f++)
cards[f] = msg.readInt16("card");
if (tradeWindow)
{
if (type == 0)
{
tradeWindow->setMoney(amount);
}
else
{
tradeWindow->addItem2(type, 0,
cards, 4,
false, amount,
refine, 1,
fromBool(identify, Identified),
Damaged_false,
Favorite_false,
Equipm_false);
}
}
}
示例2: processReadMail
void MailRecv::processReadMail(Net::MessageIn &msg)
{
const int sz = msg.readInt16("len") - 101;
MailMessage *const mail = new MailMessage;
mail->id = msg.readInt32("message id");
mail->title = msg.readString(40, "title");
mail->sender = msg.readString(24, "sender name");
msg.readInt32("unused");
mail->money = msg.readInt32("money");
mail->itemAmount = msg.readInt32("item amount");
mail->itemId = msg.readInt16("item id");
mail->itemType = msg.readInt16("item type");
mail->itemIdentify = msg.readUInt8("identify");
mail->itemAttribute = msg.readUInt8("attribute");
mail->itemRefine = msg.readUInt8("refine");
for (int f = 0; f < maxCards; f ++)
mail->card[f] = msg.readUInt16("card");
const int msgLen = msg.readUInt8("msg len");
if (msgLen != sz)
logger->log("error: wrong message size");
mail->text = msg.readString(sz, "message");
msg.readUInt8("zero");
mail->strTime = timeToStr(mail->time);
mailWindow->showMessage(mail);
}
示例3: processAuctionResults
void AuctionRecv::processAuctionResults(Net::MessageIn &msg)
{
UNIMPLEMENTEDPACKET;
msg.readInt16("len");
msg.readInt32("pages");
const int itemCount = msg.readInt32("items count");
for (int f = 0; f < itemCount; f ++)
{
msg.readInt32("auction id");
msg.readString(24, "seller name");
msg.readInt16("item id"); // here item always 16 bit
msg.readInt32("auction type");
msg.readInt16("item amount"); // always 1
msg.readUInt8("identify");
msg.readUInt8("attribute");
msg.readUInt8("refine");
for (int d = 0; d < maxCards; d ++)
msg.readUInt16("card"); // here item always 16 bit
msg.readInt32("price");
msg.readInt32("buy now");
msg.readString(24, "buyer name");
msg.readInt32("timestamp");
// +++ need use ItemColorManager for color
}
}
示例4: 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]);
}
}
示例5: processItemsList
void VendingHandler::processItemsList(Net::MessageIn &msg)
{
const int count = (msg.readInt16("len") - 12) / 22;
const BeingId id = msg.readBeingId("id");
Being *const being = actorManager->findBeing(id);
if (!being)
return;
int cards[4];
CREATEWIDGETV(mBuyDialog, BuyDialog, being->getName());
mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
msg.readInt32("vender id");
for (int f = 0; f < count; f ++)
{
const int value = msg.readInt32("price");
const int amount = msg.readInt16("amount");
const int index = msg.readInt16("inv index");
const int type = msg.readUInt8("item type");
const int itemId = msg.readInt16("item id");
msg.readUInt8("identify");
msg.readUInt8("attribute");
msg.readUInt8("refine");
for (int d = 0; d < 4; d ++)
cards[d] = msg.readInt16("card");
const ItemColor color = ItemColorManager::getColorFromCards(&cards[0]);
ShopItem *const item = mBuyDialog->addItem(itemId, type,
color, amount, value);
if (item)
item->setInvIndex(index);
}
mBuyDialog->sort();
}
示例6: processOpen
void VendingRecv::processOpen(Net::MessageIn &msg)
{
const int count = (msg.readInt16("len") - 8) / 22;
msg.readInt32("id");
for (int f = 0; f < count; f ++)
{
msg.readInt32("price");
msg.readInt16("inv index");
msg.readInt16("amount");
msg.readUInt8("item type");
msg.readInt16("item id");
msg.readUInt8("identify");
msg.readUInt8("attribute");
msg.readUInt8("refine");
for (int d = 0; d < 4; d ++)
msg.readInt16("card");
if (serverVersion >= 8 && packetVersion >= 20150226)
{
for (int d = 0; d < 5; d ++)
{
msg.readInt16("rnd index");
msg.readInt16("rnd value");
msg.readUInt8("rnd param");
}
}
}
PlayerInfo::enableVending(true);
VendingModeListener::distributeEvent(true);
}
示例7: processItemMvpDropped
void ItemRecv::processItemMvpDropped(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
msg.readInt16("len");
msg.readUInt8("type");
msg.readInt16("item id");
msg.readUInt8("len");
msg.readString(24, "name");
msg.readUInt8("monster name len");
msg.readString(24, "monster name");
}
示例8:
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");
}
示例9: processGraffiti
void ItemHandler::processGraffiti(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
msg.readInt32("graffiti id");
msg.readInt32("creator id");
msg.readInt16("x");
msg.readInt16("y");
msg.readUInt8("job");
msg.readUInt8("visible");
msg.readUInt8("is content");
msg.readString(80, "text");
}
示例10: 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");
}
示例11: processTradeItemAdd
void TradeRecv::processTradeItemAdd(Net::MessageIn &msg)
{
const int type = msg.readInt16("type");
ItemTypeT itemType = ItemType::Unknown;
if (msg.getVersion() >= 20100223)
{
itemType = static_cast<ItemTypeT>(
msg.readUInt8("item type"));
}
const int amount = msg.readInt32("amount");
const uint8_t identify = msg.readUInt8("identify");
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");
if ((serverVersion >= 8 || serverVersion == 0) &&
msg.getVersion() >= 20150226)
{
for (int f = 0; f < 5; f ++)
{
msg.readInt16("rnd index");
msg.readInt16("rnd value");
msg.readUInt8("rnd param");
}
}
if (tradeWindow)
{
if (type == 0)
{
tradeWindow->setMoney(amount);
}
else
{
tradeWindow->addItem2(type,
itemType,
cards,
4,
false,
amount,
refine,
ItemColorManager::getColorFromCards(&cards[0]),
fromBool(identify, Identified),
damaged,
Favorite_false,
Equipm_false);
}
}
}
示例12: 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");
}
示例13: processSearchFailed
void SearchStoreRecv::processSearchFailed(Net::MessageIn &msg)
{
UNIMPLIMENTEDPACKET;
const int result = msg.readUInt8("result");
switch (result)
{
case 0:
NotifyManager::notify(
NotifyTypes::SEARCH_STORE_FAILED_NO_STORES);
break;
case 1:
NotifyManager::notify(
NotifyTypes::SEARCH_STORE_FAILED_MANY_RESULTS);
break;
case 2:
NotifyManager::notify(
NotifyTypes::SEARCH_STORE_FAILED_CANT_SEARCH_ANYMORE);
break;
case 3:
NotifyManager::notify(
NotifyTypes::SEARCH_STORE_FAILED_CANT_SEARCH_YET);
break;
case 4:
NotifyManager::notify(
NotifyTypes::SEARCH_STORE_FAILED_NO_INFORMATION);
break;
default:
NotifyManager::notify(
NotifyTypes::SEARCH_STORE_FAILED);
break;
}
}
示例14: processMapLogin
void GameRecv::processMapLogin(Net::MessageIn &msg)
{
unsigned char direction;
uint16_t x;
uint16_t y;
msg.readInt32("start time");
msg.readCoordinates(x, y, direction, "position");
msg.readInt8("x size");
msg.readInt8("y size");
logger->log("Protocol: Player start position: "
"(%d, %d), Direction: %d",
x, y, direction);
if (msg.getVersion() >= 20080102)
msg.readInt16("font");
if (msg.getVersion() >= 20141022 && msg.getVersion() < 20160330)
msg.readUInt8("sex");
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: processPartyCreate
void PartyHandler::processPartyCreate(Net::MessageIn &msg) const
{
if (msg.readUInt8())
NotifyManager::notify(NotifyTypes::PARTY_CREATE_FAILED);
else
NotifyManager::notify(NotifyTypes::PARTY_CREATED);
}