55 #include "utils/timer.h"
65 const uint16_t gmstatus)
83 BLOCK_END(
"BeingRecv::processBeingChangeLook")
88 msg.readBeingId(
"being id"));
90 const uint8_t type =
msg.readUInt8(
"type");
94 if ((
localPlayer ==
nullptr) || (dstBeing ==
nullptr))
96 BLOCK_END(
"BeingRecv::processBeingChangeLook")
100 BLOCK_END(
"BeingRecv::processBeingChangeLook")
108 BLOCK_END(
"BeingRecv::processBeingChangeLook")
113 msg.readBeingId(
"being id"));
115 const uint8_t type =
msg.readUInt8(
"type");
118 const int16_t
id =
msg.readInt16(
"id1");
121 id2 =
msg.readInt16(
"id2");
125 msg.readInt16(
"id2");
129 if ((
localPlayer ==
nullptr) || (dstBeing ==
nullptr))
131 BLOCK_END(
"BeingRecv::processBeingChangeLook")
135 BLOCK_END(
"BeingRecv::processBeingChangeLook")
139 Being *
const dstBeing,
155 const uint16_t look =
CAST_U16(
id / 256);
156 const int hair =
id % 256;
245 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
250 const BeingId id =
msg.readBeingId(
"account id");
251 const int16_t speed =
msg.readInt16(
"speed");
252 const uint32_t opt1 =
msg.readInt16(
"opt1");
253 const uint32_t opt2 =
msg.readInt16(
"opt2");
254 const uint32_t option =
msg.readInt16(
"option");
255 const int16_t job =
msg.readInt16(
"job");
257 if (
toInt(
id,
int) < 110000000 && job >= 1000)
261 if (dstBeing ==
nullptr)
265 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
271 if (dstBeing ==
nullptr)
273 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
277 else if (disguiseId != 0)
292 if (
party->isMember(
id))
298 const uint8_t hairStyle =
msg.readUInt8(
"hair style");
299 const uint16_t look =
msg.readUInt8(
"look");
301 const uint16_t weapon =
msg.readInt16(
"weapon");
302 const uint16_t shield =
msg.readInt16(
"shield");
303 const uint16_t headBottom =
msg.readInt16(
"head bottom");
305 const uint16_t headTop =
msg.readInt16(
"head top");
306 const uint16_t headMid =
msg.readInt16(
"head mid");
309 msg.readUInt8(
"unused");
310 msg.readInt32(
"unused");
312 const int guild =
msg.readInt32(
"guild");
322 msg.readInt16(
"emblem");
324 const uint32_t opt3 =
msg.readInt16(
"opt3");
351 ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
359 msg.readCoordinates(
x,
y, dir,
"position");
365 const uint16_t gmstatus =
msg.readInt16(
"gm status");
367 setGm(dstBeing, gmstatus);
370 const int level =
CAST_S32(
msg.readUInt8(
"level"));
374 msg.readUInt8(
"unused");
383 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
391 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
396 const BeingId id =
msg.readBeingId(
"account id");
397 const int16_t speed =
msg.readInt16(
"speed");
398 const uint32_t opt1 =
msg.readInt16(
"opt1");
399 const uint32_t opt2 =
msg.readInt16(
"opt2");
400 const uint32_t option =
msg.readInt16(
"option");
401 const int16_t job =
msg.readInt16(
"job");
403 if (
toInt(
id,
int) < 110000000 && job >= 1000)
407 if (dstBeing ==
nullptr)
411 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
417 if (dstBeing ==
nullptr)
419 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
423 else if (disguiseId != 0)
438 if (
party->isMember(
id))
444 const uint8_t hairStyle =
msg.readUInt8(
"hair style");
445 const uint16_t look =
msg.readUInt8(
"look");
447 const uint16_t weapon =
msg.readInt16(
"weapon");
448 const uint16_t shield =
msg.readInt16(
"shield");
449 const uint16_t headBottom =
msg.readInt16(
"head bottom");
450 const uint16_t headTop =
msg.readInt16(
"head top");
451 const uint16_t headMid =
msg.readInt16(
"head mid");
454 msg.readUInt8(
"unused");
455 msg.readInt32(
"unused");
457 const int guild =
msg.readInt32(
"guild");
467 msg.readInt16(
"emblem");
469 const uint32_t opt3 =
msg.readInt16(
"opt3");
496 ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
504 msg.readCoordinates(
x,
y, dir,
"position");
510 const uint16_t gmstatus =
msg.readInt16(
"gm status");
512 setGm(dstBeing, gmstatus);
515 const int level =
CAST_S32(
msg.readUInt8(
"level"));
525 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
533 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
538 const BeingId id =
msg.readBeingId(
"account id");
539 const int16_t speed =
msg.readInt16(
"speed");
540 const uint32_t opt1 =
msg.readInt16(
"opt1");
541 const uint32_t opt2 =
msg.readInt16(
"opt2");
542 const uint32_t option =
msg.readInt16(
"option");
543 const int16_t job =
msg.readInt16(
"job");
545 if (
toInt(
id,
int) < 110000000 && job >= 1000)
549 if (dstBeing ==
nullptr)
553 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
559 if (dstBeing ==
nullptr)
561 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
565 else if (disguiseId != 0)
580 if (
party->isMember(
id))
586 const uint8_t hairStyle =
msg.readUInt8(
"hair style");
587 const uint16_t look =
msg.readUInt8(
"look");
589 const uint16_t weapon =
msg.readInt16(
"weapon");
590 const uint16_t shield =
msg.readInt16(
"shield");
591 const uint16_t headBottom =
msg.readInt16(
"head bottom");
593 msg.readInt32(
"tick");
595 const uint16_t headTop =
msg.readInt16(
"head top");
596 const uint16_t headMid =
msg.readInt16(
"head mid");
599 msg.readUInt8(
"unused");
600 msg.readInt32(
"unused");
602 const int guild =
msg.readInt32(
"guild");
612 msg.readInt16(
"emblem");
614 const uint32_t opt3 =
msg.readInt16(
"opt3");
641 ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
651 msg.readCoordinatePair(srcX, srcY, dstX, dstY,
"moving path");
661 if (srcX != dstX || srcY != dstY)
677 const uint16_t gmstatus =
msg.readInt16(
"gm status");
679 setGm(dstBeing, gmstatus);
681 msg.readUInt8(
"unused");
683 const int level =
CAST_S32(
msg.readUInt8(
"level"));
687 msg.readUInt8(
"unused");
699 BLOCK_END(
"BeingRecv::processPlayerMoveUpdate")
704 BLOCK_START(
"BeingRecv::processBeingVisibleOrMove")
707 BLOCK_END(
"BeingRecv::processBeingVisibleOrMove")
714 const BeingId id =
msg.readBeingId(
"being id");
720 int16_t speed =
msg.readInt16(
"speed");
721 const uint32_t opt1 =
msg.readInt16(
"opt1");
722 const uint32_t opt2 =
msg.readInt16(
"opt2");
723 const uint32_t option =
msg.readInt16(
"option");
724 const int16_t job =
msg.readInt16(
"class");
739 if (dstBeing ==
nullptr)
743 if (job == 0 &&
toInt(
id,
int) >= 110000000)
745 BLOCK_END(
"BeingRecv::processBeingVisibleOrMove")
751 BLOCK_END(
"BeingRecv::processBeingVisibleOrMove")
757 if (dstBeing ==
nullptr)
759 BLOCK_END(
"BeingRecv::processBeingVisibleOrMove")
790 const uint8_t hairStyle =
msg.readUInt8(
"hair style");
791 const uint16_t look =
msg.readUInt8(
"look");
796 const uint16_t weapon =
msg.readInt16(
"weapon");
797 const uint16_t headBottom =
msg.readInt16(
"head bottom");
799 const uint16_t shield =
msg.readInt16(
"shield");
800 const uint16_t headTop =
msg.readInt16(
"head top");
801 const uint16_t headMid =
msg.readInt16(
"head mid");
804 msg.readUInt8(
"unused");
805 const uint16_t shoes =
msg.readInt16(
"shoes / clothes color");
812 const int hp =
msg.readInt32(
"hp");
813 const int maxHP =
msg.readInt32(
"max hp");
814 if ((hp != 0) && (maxHP != 0))
817 const int oldHP = dstBeing->
getHP();
818 if ((oldHP == 0) || oldHP > hp)
824 msg.readInt32(
"unused");
825 msg.readInt32(
"unused");
831 gloves =
msg.readInt16(
"gloves / head dir");
832 msg.readInt32(
"guild");
833 msg.readInt16(
"guild emblem");
837 const uint32_t opt3 =
msg.readInt16(
"opt3");
842 msg.readUInt8(
"attack range (was karma)"));
849 uint8_t gender =
msg.readUInt8(
"gender");
865 ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
886 msg.readCoordinates(
x,
y, dir,
"position");
905 msg.readUInt8(
"unknown");
906 msg.readUInt8(
"unknown");
907 msg.readUInt8(
"unknown");
908 msg.readUInt8(
"unknown");
909 msg.readUInt8(
"unknown");
915 BLOCK_END(
"BeingRecv::processBeingVisibleOrMove")
920 BLOCK_START(
"BeingRecv::processBeingVisibleOrMove")
923 BLOCK_END(
"BeingRecv::processBeingVisibleOrMove")
930 const BeingId id =
msg.readBeingId(
"being id");
936 int16_t speed =
msg.readInt16(
"speed");
937 const uint32_t opt1 =
msg.readInt16(
"opt1");
938 const uint32_t opt2 =
msg.readInt16(
"opt2");
939 const uint32_t option =
msg.readInt16(
"option");
940 const int16_t job =
msg.readInt16(
"class");
955 if (dstBeing ==
nullptr)
959 if (job == 0 &&
toInt(
id,
int) >= 110000000)
961 BLOCK_END(
"BeingRecv::processBeingVisibleOrMove")
967 BLOCK_END(
"BeingRecv::processBeingVisibleOrMove")
973 if (dstBeing ==
nullptr)
975 BLOCK_END(
"BeingRecv::processBeingVisibleOrMove")
998 const uint8_t hairStyle =
msg.readUInt8(
"hair style");
999 const uint16_t look =
msg.readUInt8(
"look");
1004 const uint16_t weapon =
msg.readInt16(
"weapon");
1005 const uint16_t headBottom =
msg.readInt16(
"head bottom");
1007 msg.readInt32(
"tick");
1009 const uint16_t shield =
msg.readInt16(
"shield");
1010 const uint16_t headTop =
msg.readInt16(
"head top");
1011 const uint16_t headMid =
msg.readInt16(
"head mid");
1014 msg.readUInt8(
"unused");
1015 const uint16_t shoes =
msg.readInt16(
"shoes / clothes color");
1022 const int hp =
msg.readInt32(
"hp");
1023 const int maxHP =
msg.readInt32(
"max hp");
1024 if ((hp != 0) && (maxHP != 0))
1027 const int oldHP = dstBeing->
getHP();
1028 if ((oldHP == 0) || oldHP > hp)
1029 dstBeing->
setHP(hp);
1034 msg.readInt32(
"unused");
1035 msg.readInt32(
"unused");
1041 gloves =
msg.readInt16(
"gloves / head dir");
1042 msg.readInt32(
"guild");
1043 msg.readInt16(
"guild emblem");
1047 const uint32_t opt3 =
msg.readInt16(
"opt3");
1052 msg.readUInt8(
"attack range (was karma)"));
1059 uint8_t gender =
msg.readUInt8(
"gender");
1075 ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
1097 msg.readCoordinatePair(srcX, srcY, dstX, dstY,
"move path");
1098 if (disguiseId == 0)
1108 msg.readUInt8(
"unknown");
1109 msg.readUInt8(
"unknown");
1110 msg.readUInt8(
"unknown");
1111 msg.readUInt8(
"unknown");
1112 msg.readUInt8(
"unknown");
1118 BLOCK_END(
"BeingRecv::processBeingVisibleOrMove")
1126 msg.readInt16(
"speed");
1127 msg.readInt16(
"opt1");
1128 msg.readInt16(
"opt2");
1129 msg.readInt16(
"option");
1130 msg.readInt16(
"disguise");
1131 msg.skip(25,
"unused");
1132 BLOCK_END(
"BeingRecv::processBeingSpawn")
1137 msg.readInt32(
"src id");
1138 msg.readInt32(
"dst id");
1139 msg.readInt16(
"dst x");
1140 msg.readInt16(
"dst y");
1141 msg.readInt16(
"skill num");
1142 msg.readInt32(
"skill get p1");
1143 msg.readInt32(
"cast time");
1148 BLOCK_START(
"BeingRecv::processBeingStatusChange")
1151 BLOCK_END(
"BeingRecv::processBeingStatusChange")
1156 const uint16_t status =
msg.readInt16(
"status");
1157 const BeingId id =
msg.readBeingId(
"being id");
1159 msg.readUInt8(
"flag: 0: stop, 1: start"),
Enable);
1162 if (dstBeing !=
nullptr)
1168 BLOCK_END(
"BeingRecv::processBeingStatusChange")
1176 BLOCK_END(
"BeingRecv::processBeingMove2")
1186 msg.readBeingId(
"being id"));
1194 if (dstBeing ==
nullptr)
1196 BLOCK_END(
"BeingRecv::processBeingMove2")
1204 msg.readCoordinatePair(srcX, srcY, dstX, dstY,
"move path");
1205 msg.readInt32(
"tick");
1212 BLOCK_END(
"BeingRecv::processBeingMove2")
1217 BLOCK_START(
"BeingRecv::processBeingChangeDirection")
1220 BLOCK_END(
"BeingRecv::processBeingChangeDirection")
1225 msg.readBeingId(
"being id"));
1227 if (dstBeing ==
nullptr)
1230 msg.readInt16(
"unused");
1231 msg.readUInt8(
"direction");
1232 BLOCK_END(
"BeingRecv::processBeingChangeDirection");
1236 msg.readInt16(
"unused");
1239 CAST_U8(
msg.readUInt8(
"direction") & 0x0FU));
1243 BLOCK_END(
"BeingRecv::processBeingChangeDirection")
1251 BLOCK_END(
"BeingRecv::processPlayerStop")
1256 const BeingId id =
msg.readBeingId(
"account id");
1258 if (dstBeing ==
nullptr)
1261 msg.readInt16(
"stun mode");
1262 msg.readInt16(
"status effect");
1263 msg.readInt16(
"opt?");
1264 msg.readUInt8(
"Unused?");
1268 const uint32_t opt1 =
msg.readInt16(
"opt1");
1269 const uint32_t opt2 =
msg.readInt16(
"opt2");
1270 const uint32_t option =
msg.readInt16(
"option");
1271 msg.readUInt8(
"Unused?");
1276 BLOCK_END(
"BeingRecv::processPlayerStop")
1284 BLOCK_END(
"BeingRecv::processBeingResurrect")
1290 const BeingId id =
msg.readBeingId(
"being id");
1292 if (dstBeing ==
nullptr)
1295 msg.readInt16(
"flag?");
1296 BLOCK_END(
"BeingRecv::processBeingResurrect")
1310 if (
msg.readInt16(
"flag?") == 1)
1312 BLOCK_END(
"BeingRecv::processBeingResurrect")
1317 BLOCK_START(
"BeingRecv::processPlayerGuilPartyInfo")
1320 BLOCK_END(
"BeingRecv::processPlayerGuilPartyInfo")
1325 msg.readBeingId(
"being id"));
1327 if (dstBeing !=
nullptr)
1337 msg.readString(24,
"guild name");
1338 msg.readString(24,
"guild pos");
1341 msg.readString(24,
"?");
1345 msg.readString(24,
"party name");
1346 msg.readString(24,
"guild name");
1347 msg.readString(24,
"guild pos");
1348 msg.readString(24,
"?");
1350 BLOCK_END(
"BeingRecv::processPlayerGuilPartyInfo")
1358 BLOCK_END(
"BeingRecv::processBeingSelfEffect")
1362 const BeingId id =
msg.readBeingId(
"being id");
1364 if (being ==
nullptr)
1367 msg.readInt32(
"effect type");
1368 BLOCK_END(
"BeingRecv::processBeingSelfEffect")
1372 const int effectType =
msg.readInt32(
"effect type");
1383 BLOCK_END(
"BeingRecv::processBeingSelfEffect")
1388 msg.readInt32(
"skill id");
1396 BLOCK_END(
"BeingRecv::processIpResponse")
1401 msg.readBeingId(
"being id"));
1402 if (dstBeing !=
nullptr)
1404 const std::string ip =
ipToString(
msg.readInt32(
"ip address"));
1405 dstBeing->
setIp(ip);
1409 msg.readInt32(
"ip address");
1413 BLOCK_END(
"BeingRecv::processIpResponse")
1419 const BeingId id =
msg.readBeingId(
"being id");
1420 const int rank =
msg.readInt32(
"rank");
1422 teamId =
msg.readInt32(
"team");
1426 if (dstBeing !=
nullptr)
1440 if (being ==
nullptr)
1473 BLOCK_END(
"BeingRecv::processSkillDamage")
1477 const int id =
msg.readInt16(
"skill id");
1479 msg.readBeingId(
"src being id"));
1481 msg.readBeingId(
"dst being id"));
1482 msg.readInt32(
"tick");
1483 msg.readInt32(
"src speed");
1484 msg.readInt32(
"dst speed");
1485 const int param1 =
msg.readInt32(
"damage");
1486 const int level =
msg.readInt16(
"skill level");
1487 msg.readInt16(
"div");
1488 msg.readUInt8(
"skill hit/type?");
1489 if (srcBeing !=
nullptr)
1490 srcBeing->
handleSkill(dstBeing, param1,
id, level);
1491 if (dstBeing !=
nullptr)
1493 BLOCK_END(
"BeingRecv::processSkillDamage")
1497 const uint8_t gender)
1499 if (being ==
nullptr)
ActorManager * actorManager
Net::BeingHandler * beingHandler
const BeingId BeingId_zero
#define fromBool(val, name)
Being * findBeing(const BeingId id) const
void destroy(ActorSprite *const actor)
void undelete(const ActorSprite *const actor)
bool isBlocked(const BeingId id) const
void erase(ActorSprite *const actor)
void setStatusEffectOpitons(const uint32_t option, const uint32_t opt1, const uint32_t opt2, const uint32_t opt3)
void setStatusEffect(const int32_t index, const Enable active, const IsStart start)
void setKarma(const int karma)
void setHairStyle(const unsigned int slot, const int id)
void setWeaponId(const int id)
virtual void setDirection(const uint8_t direction)
virtual void setAction(const BeingActionT &action, const int attackId)
void setGuildName(const std::string &name)
void setParty(Party *const party)
uint8_t getDirectionDelayed() const
virtual void setTileCoords(const int x, const int y)
static GenderT intToGender(const uint8_t sex) A_CONST
uint8_t getDirection() const
void setLevel(const int n)
void updateSprite(const unsigned int slot, const int id, const std::string &color)
void setWalkSpeed(const int speed)
void setPvpRank(const unsigned int rank)
uint8_t calcDirection(const int dstX, const int dstY) const
void setLook(const uint16_t look)
void recalcSpritesOrder()
void setName(const std::string &name)
void setSubtype(const BeingTypeId subtype, const uint16_t look)
void takeDamage(Being *const attacker, const int amount, const AttackTypeT type, const int attackId, const int level)
void setHairColor(const unsigned int slot, const ItemColor color)
void setMaxHP(const int hp)
const std::string & getName() const
void setSpriteId(const unsigned int slot, const int id)
void setTeamId(const uint16_t teamId)
void setGuildPos(const std::string &pos)
void setPartyName(const std::string &name)
virtual void setGender(const GenderT gender)
void setDirectionDelayed(const uint8_t direction)
void setActionTime(const int actionTime)
virtual void setGroupId(const int id)
BeingActionT getCurrentAction() const
void setIp(const std::string &ip)
void setAttackRange(const int range)
void setCachedDestination(const int dstX, const int dstY)
void handleSkill(Being *const victim, const int damage, const int skillId, const int skillLevel)
void setManner(const int manner)
ActorTypeT getType() const
void setGuild(Guild *const guild)
void setDestination(const int dstX, const int dstY)
int getIntValue(const std::string &key) const
bool trigger(const int id, Being *const being, const int rotation)
static bool getEnableGuildBot()
static Guild * getGuild(const int16_t id)
static std::string getKeyShortString(const std::string &key)
void followMoveTo(const Being *const being, const int x, const int y)
Being * getTarget() const
void imitateDirection(const Being *const being, const unsigned char dir)
void stopAttack(const bool keepAttack)
void imitateOutfit(const Being *const player, const int sprite) const
void checkNewName(Being *const being)
void imitateAction(const Being *const being, const BeingActionT &action)
virtual void requestNameById(const BeingId id) const =0
static uint8_t fromServerDirection(const uint8_t serverDir)
virtual bool haveNpcGender() const =0
virtual bool haveMove3() const =0
virtual bool haveMonsterAttackRange() const =0
virtual bool haveServerHp() const =0
static std::string keyName(const int number)
void resetDamage(const std::string &name)
int getPortalIndex(const int x, const int y)
virtual void scheduleDelete()
EffectManager * effectManager
GuildManager * guildManager
#define fromInt(val, name)
LocalPlayer * localPlayer
#define UNIMPLEMENTEDPACKETFIELD(field)
bool msg(InputEvent &event)
void processBeingChangeLookContinue(const Net::MessageIn &msg, Being *const dstBeing, const uint8_t type, const int id, const int id2, const int *const cards)
void applyPlayerAction(Net::MessageIn &msg, Being *const being, const uint8_t type)
Being * createBeing(const BeingId id, const int job)
const ItemInfo & get(const int id)
void processPlayerUpdate2(Net::MessageIn &msg)
void processBeingResurrect(Net::MessageIn &msg)
void applyPlayerAction(Net::MessageIn &msg, Being *const being, const uint8_t type)
void processSkillCasting(Net::MessageIn &msg)
void processIpResponse(Net::MessageIn &msg)
void processSkillDamage(Net::MessageIn &msg)
void processBeingMove(Net::MessageIn &msg)
void processPlayerMove(Net::MessageIn &msg)
void processPlayerUpdate1(Net::MessageIn &msg)
void processPvpSet(Net::MessageIn &msg)
void processBeingStatusChange(Net::MessageIn &msg)
void processBeingVisible(Net::MessageIn &msg)
void processBeingSelfEffect(Net::MessageIn &msg)
void processSkillCastCancel(Net::MessageIn &msg)
void processBeingSpawn(Net::MessageIn &msg)
void processPlayerStatusChange(Net::MessageIn &msg)
void processBeingChangeLook(Net::MessageIn &msg)
void processBeingChangeLook2(Net::MessageIn &msg)
void processBeingChangeLookContinue(const Net::MessageIn &msg, Being *const dstBeing, const uint8_t type, const int id, const int id2)
void processBeingMove2(Net::MessageIn &msg)
void setServerGender(Being *const being, const uint8_t gender)
void processPlayerGuilPartyInfo(Net::MessageIn &msg)
void processBeingChangeDirection(Net::MessageIn &msg)
static void setGm(Being *const dstBeing, const uint16_t gmstatus)
Net::ServerFeatures * serverFeatures
OutfitWindow * outfitWindow
#define BLOCK_START(name)
SocialWindow * socialWindow
const char * ipToString(const uint32_t address)