本文整理汇总了C++中InPacket::readshort方法的典型用法代码示例。如果您正苦于以下问题:C++ InPacket::readshort方法的具体用法?C++ InPacket::readshort怎么用?C++ InPacket::readshort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InPacket
的用法示例。
在下文中一共展示了InPacket::readshort方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Ladder::Ladder(InPacket& recv)
{
x = recv.readshort();
y1 = recv.readshort();
y2 = recv.readshort();
ladder = recv.readbool();
}
示例2: handle
void SpawnMobHandler::handle(InPacket& recv) const
{
int32_t oid = recv.readint();
bool hascontrol = recv.readbyte() == 5;
int32_t id = recv.readint();
recv.skip(22);
Point<int16_t> position = recv.readpoint();
int8_t stance = recv.readbyte();
recv.skip(2);
uint16_t fh = recv.readshort();
int8_t effect = recv.readbyte();
if (effect > 0)
{
recv.readbyte();
recv.readshort();
if (effect == 15)
{
recv.readbyte();
}
}
int8_t team = recv.readbyte();
recv.skip(4);
Stage::get().getmobs().addmob(oid, id, hascontrol, stance, fh, effect == -2, team, position);
}
示例3: if
Footholdtree::Footholdtree(InPacket& recv)
{
int16_t leftw = 30000;
int16_t rightw = -30000;
int16_t botb = -30000;
int16_t topb = 30000;
uint16_t numbase = recv.readshort();
for (uint16_t i = 0; i < numbase; i++)
{
uint8_t layer = recv.readbyte();
uint16_t nummid = recv.readshort();
for (uint16_t j = 0; j < nummid; j++)
{
uint16_t numlast = recv.readshort();
for (uint16_t k = 0; k < numlast; k++)
{
Foothold foothold = Foothold(recv, layer);
if (foothold.getl() < leftw)
{
leftw = foothold.getl();
}
else if (foothold.getr() > rightw)
{
rightw = foothold.getr();
}
if (foothold.getb() > botb)
{
botb = foothold.getb();
}
else if (foothold.gett() < topb)
{
topb = foothold.gett();
}
uint16_t id = foothold.getid();
footholds[id] = foothold;
if (abs(foothold.getslope()) < 0.5)
{
int16_t start = foothold.getl();
int16_t end = foothold.getr();
for (int16_t i = start; i <= end; i++)
{
footholdsbyx.insert(std::make_pair(i, id));
}
}
}
}
}
walls = Range<int16_t>(leftw + 25, rightw - 25);
borders = Range<int16_t>(topb - 400, botb + 400);
}
示例4: typebyid
Background::Background(InPacket& recv)
{
node backsrc = nl::nx::map["Back"];
animation = backsrc[recv.read<string>()];
opacity = recv.readshort();
flipped = recv.readbool();
cx = recv.readshort();
cy = recv.readshort();
rx = recv.readshort();
ry = recv.readshort();
moveobj.setx(recv.readshort());
moveobj.sety(recv.readshort());
Type type = typebyid(recv.readbyte());
settype(type);
}
示例5: handle
void ServerIPHandler::handle(InPacket& recv) const
{
recv.skip(2);
// Read the ipv4 adress in a string.
string addrstr;
for (int i = 0; i < 4; i++)
{
uint8_t num = static_cast<uint8_t>(recv.readbyte());
addrstr.append(std::to_string(num));
if (i < 3)
{
addrstr.push_back('.');
}
}
// Read the port adress in a string.
string portstr = std::to_string(recv.readshort());
int32_t cid = recv.readint();
// Attempt to reconnect to the server and if successfull, login to the game.
Session::get().reconnect(addrstr.c_str(), portstr.c_str());
PlayerLoginPacket(cid).dispatch();
}
示例6:
Account::Account(InPacket& recv)
{
recv.readshort();
accid = recv.readint();
female = recv.readbool();
recv.readbool(); //is admin
gmlevel = recv.readbyte();
recv.readbyte();
name = recv.readascii();
recv.readbyte();
muted = recv.readbool();
recv.readlong(); //muted until
recv.readlong(); //creation date
recv.readint();
pin = recv.readshort();
selected = 0;
}
示例7: parseaccount
void Login::parseaccount(InPacket& recv)
{
recv.readshort();
account.accid = recv.readint();
account.female = recv.readbool();
recv.readbool(); //is admin
account.gmlevel = recv.readbyte();
recv.readbyte();
account.name = recv.readascii();
recv.readbyte();
account.muted = recv.readbool();
recv.readlong(); //muted until
recv.readlong(); //creation date
recv.readint();
account.pin = recv.readshort();
account.selected = 0;
}
示例8: handle
void ChangeStatsHandler::handle(InPacket& recv) const
{
recv.readbool(); // 'itemreaction'
int32_t updatemask = recv.readint();
Player& player = Stage::get().getplayer();
for (auto it = Maplestat::it(); it.hasnext(); it.increment())
{
Maplestat::Value stat = it.get();
if (Maplestat::compare(stat, updatemask))
{
switch (stat)
{
case Maplestat::SKIN:
player.changelook(stat, recv.readshort());
break;
case Maplestat::FACE:
case Maplestat::HAIR:
player.changelook(stat, recv.readint());
break;
case Maplestat::LEVEL:
player.changelevel(recv.readbyte());
break;
case Maplestat::JOB:
player.changejob(recv.readshort());
break;
case Maplestat::EXP:
player.getstats().setexp(recv.readint());
break;
case Maplestat::MESO:
player.getinvent().setmeso(recv.readint());
break;
default:
player.getstats().setstat(stat, recv.readshort());
player.recalcstats(false);
break;
}
}
UI::get().enable();
}
}
示例9: handlebuff
void ApplyBuffHandler::handlebuff(InPacket& recv, Buffstat::Value bs) const
{
int16_t value = recv.readshort();
int32_t skillid = recv.readint();
int32_t duration = recv.readint();
Buff buff = Buff(bs, value, skillid, duration);
Stage::get().getplayer().givebuff(buff);
UI::get().withelement(UIElement::BUFFLIST, &UIBuffList::addbuff, skillid, duration);
}
示例10: parsestats
StatsEntry Login::parsestats(InPacket& recv) const
{
StatsEntry statsentry;
statsentry.name = recv.readpadascii(13);
recv.readbool(); //gender
recv.readbyte(); //skin
recv.readint(); //face
recv.readint(); //hair
for (size_t i = 0; i < 3; i++)
{
statsentry.petids.push_back(recv.readlong());
}
statsentry.stats[Maplestat::LEVEL] = recv.readbyte();
statsentry.stats[Maplestat::JOB] = recv.readshort();
statsentry.stats[Maplestat::STR] = recv.readshort();
statsentry.stats[Maplestat::DEX] = recv.readshort();
statsentry.stats[Maplestat::INT] = recv.readshort();
statsentry.stats[Maplestat::LUK] = recv.readshort();
statsentry.stats[Maplestat::HP] = recv.readshort();
statsentry.stats[Maplestat::MAXHP] = recv.readshort();
statsentry.stats[Maplestat::MP] = recv.readshort();
statsentry.stats[Maplestat::MAXMP] = recv.readshort();
statsentry.stats[Maplestat::AP] = recv.readshort();
statsentry.stats[Maplestat::SP] = recv.readshort();
statsentry.exp = recv.readint();
statsentry.stats[Maplestat::FAME] = recv.readshort();
recv.skip(4); //gachaexp
statsentry.mapid = recv.readint();
statsentry.portal = recv.readbyte();
recv.skip(4); //timestamp
statsentry.job = CharJob(statsentry.stats[Maplestat::JOB]);
return statsentry;
}
示例11:
MapBackgrounds::MapBackgrounds(InPacket& recv)
{
int16_t size = recv.readshort();
for (int16_t i = 0; i < size; i++)
{
bool front = recv.readbool();
if (front)
{
foregrounds.push_back(recv);
}
else
{
backgrounds.push_back(recv);
}
}
black = recv.readbool();
}
示例12:
World::World(uint8_t id, InPacket& recv)
{
wid = id;
name = recv.readascii();
flag = recv.readbyte();
message = recv.readascii();
recv.readbyte();
recv.readbyte();
recv.readbyte();
recv.readbyte();
recv.readbyte();
channelcount = recv.readbyte();
for (uint8_t i = 0; i < channelcount; i++)
{
recv.readascii();
recv.readint();
chloads.push_back(recv.readbyte());
recv.readshort();
}
}
示例13: parsemovement
Movement MovementHandler::parsemovement(InPacket& recv) const
{
Movement fragment;
fragment.command = recv.readbyte();
switch (fragment.command)
{
case 0:
case 5:
case 17:
fragment.type = Movement::_ABSOLUTE;
fragment.xpos = recv.readshort();
fragment.ypos = recv.readshort();
fragment.lastx = recv.readshort();
fragment.lasty = recv.readshort();
recv.skip(2);
fragment.newstate = recv.readbyte();
fragment.duration = recv.readshort();
break;
case 1:
case 2:
case 6:
case 12:
case 13:
case 16:
fragment.type = Movement::_RELATIVE;
fragment.xpos = recv.readshort();
fragment.ypos = recv.readshort();
fragment.newstate = recv.readbyte();
fragment.duration = recv.readshort();
break;
case 11:
fragment.type = Movement::CHAIR;
fragment.xpos = recv.readshort();
fragment.ypos = recv.readshort();
recv.skip(2);
fragment.newstate = recv.readbyte();
fragment.duration = recv.readshort();
break;
case 15:
fragment.type = Movement::JUMPDOWN;
fragment.xpos = recv.readshort();
fragment.ypos = recv.readshort();
fragment.lastx = recv.readshort();
fragment.lasty = recv.readshort();
recv.skip(2);
fragment.fh = recv.readshort();
fragment.newstate = recv.readbyte();
fragment.duration = recv.readshort();
break;
case 3:
case 4:
case 7:
case 8:
case 9:
case 14:
fragment.type = Movement::NONE;
break;
case 10:
fragment.type = Movement::NONE;
//change equip
break;
}
return fragment;
}
示例14:
Foothold::Foothold(InPacket& recv)
{
id = recv.readshort();
prev = recv.readshort();
next = recv.readshort();
}