FellipeAlbs
New Member
- Joined
- Sep 5, 2017
- Messages
- 11
- Reaction score
- 0
hello, I need help to understand about sending and receiving bytes, if anyone can explain this I will be grateful!
I'm passing code from version 0x to 1.3 and I need to understand about bytes, this is the 0x function,
this is 1.3x
the code edited by min (1.3) does not have the functionality, could someone give me this support and help me solve this?
I have doubts about sending and receiving bytes, if you can answer some questions about it, I'll be grateful!
how does it work?
first question
second question
I'm passing code from version 0x to 1.3 and I need to understand about bytes, this is the 0x function,
C++:
void ProtocolGame::reloadCreature(const Creature* creature)
{
if(!canSee(creature))
return;
// we are cheating the client in here!
uint32_t stackpos = creature->getTile()->getClientIndexOfThing(player, creature);
if(stackpos >= 10)
return;
NetworkMessage_ptr msg = getOutputBuffer();
if(msg)
{
TRACK_MESSAGE(msg);
std::list<uint32_t>::iterator it = std::find(knownCreatureList.begin(), knownCreatureList.end(), creature->getID());
if(it != knownCreatureList.end())
{
RemoveTileItem(msg, creature->getPosition(), stackpos);
msg->AddByte(0x6A);
msg->AddPosition(creature->getPosition());
msg->AddByte(stackpos);
AddCreature(msg, creature, false, creature->getID());
}
else
AddTileCreature(msg, creature->getPosition(), stackpos, creature);
}
}
this is 1.3x
C++:
void ProtocolGame::reloadCreature(const Creature* creature)
{
if (!canSee(creature))
{
return;
}
int32_t stackpos = creature->getTile()->getClientIndexOfCreature(player, creature);
if (stackpos >= 10)
{
return;
}
NetworkMessage msg;
std::unordered_set<uint32_t>::iterator it;
if ( it != knownCreatureSet.end() )
{
RemoveTileThing(msg, creature->getPosition(), stackpos);
msg.addByte(0x6A);
msg.addPosition(creature->getPosition());
msg.addByte(stackpos);
AddCreature(msg, creature, false, creature->getID());
}
else
{
sendAddCreature(creature, creature->getPosition(), stackpos, false);
}
}
the code edited by min (1.3) does not have the functionality, could someone give me this support and help me solve this?
I have doubts about sending and receiving bytes, if you can answer some questions about it, I'll be grateful!
how does it work?
msg.addByte(0x6A), msg.addPosition, msg.addByte, msg.addString;
first question
if i send a byte to the client, how can i get that byte that was sent? how does the client see this? since there are several bytes sent, how does he know I want x byte?
second question
in advance, I thank everyone who responds!how can i get bytes sent from the client and work them on the server?