Henrybk

brAthena actor_moved

Dec 9th, 2016
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.06 KB | None | 0 0
  1. /*==========================================
  2.  * Prepares 'unit walking' packet
  3.  *------------------------------------------*/
  4. void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) {
  5.     struct map_session_data* sd;
  6.     struct status_change* sc = status->get_sc(bl);
  7.     struct view_data* vd = status->get_viewdata(bl);
  8.     struct packet_unit_walking p;
  9.     int g_id = status->get_guild_id(bl);
  10.  
  11.     nullpo_retv(bl);
  12.     nullpo_retv(ud);
  13.  
  14.     sd = BL_CAST(BL_PC, bl);
  15.  
  16.     p.PacketType = unit_walkingType;
  17. #if PACKETVER >= 20091103
  18.     p.PacketLength = sizeof(p);
  19. #endif
  20. #if PACKETVER >= 20071106
  21.     p.objecttype = clif_bl_type(bl);
  22. #endif
  23. #if PACKETVER >= 20131223
  24.     p.AID = bl->id;
  25.     p.GID = (tsd) ? tsd->status.char_id : 0;    // CCODE
  26. #else
  27.     p.GID = bl->id;
  28. #endif
  29.     p.speed = status->get_speed(bl);
  30.     p.bodyState = (sc) ? sc->opt1 : 0;
  31.     p.healthState = (sc) ? sc->opt2 : 0;
  32.     p.effectState = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0);
  33.     p.job = vd->class_;
  34.     p.head = vd->hair_style;
  35.     p.weapon = vd->weapon;
  36.     p.accessory = vd->head_bottom;
  37.     p.moveStartTime = (unsigned int)timer->gettick();
  38. #if PACKETVER < 7
  39.     p.shield = vd->shield;
  40. #endif
  41.     p.accessory2 = vd->head_top;
  42.     p.accessory3 = vd->head_mid;
  43.     p.headpalette = vd->hair_color;
  44.     p.bodypalette = vd->cloth_color;
  45.     p.headDir = (sd)? sd->head_dir : 0;
  46. #if PACKETVER >= 20101124
  47.     p.robe = vd->robe;
  48. #endif
  49.     p.GUID = g_id;
  50.     p.GEmblemVer = status->get_emblem_id(bl);
  51.     p.honor = (sd) ? sd->status.manner : 0;
  52.     p.virtue = (sc) ? sc->opt3 : 0;
  53.     p.isPKModeON = (sd && sd->status.karma) ? 1 : 0;
  54.     p.sex = vd->sex;
  55.     WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8);
  56.     p.xSize = p.ySize = (sd) ? 5 : 0;
  57.     p.clevel = clif_setlevel(bl);
  58. #if PACKETVER >= 20080102
  59.     p.font = (sd) ? sd->status.font : 0;
  60. #endif
  61. #if PACKETVER >= 20120221
  62.     if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) {
  63.         const struct mob_data *md = BL_UCCAST(BL_MOB, bl);
  64.         p.maxHP = status_get_max_hp(bl);
  65.         p.HP = status_get_hp(bl);
  66.         p.isBoss = (md->spawn != NULL && md->spawn->state.boss) ? 1 : 0;
  67.     } else {
  68.         p.maxHP = -1;
  69.         p.HP = -1;
  70.         p.isBoss = 0;
  71.     }
  72. #endif
  73. #if PACKETVER >= 20150513
  74.     p.body = vd->body_style;
  75. #endif
  76.  
  77.     clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target);
  78.  
  79.     if( disguised(bl) ) {
  80. #if PACKETVER >= 20091103
  81.         p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE
  82.         p.GID = -bl->id;
  83. #else
  84.         p.GID = -bl->id;
  85. #endif
  86.         clif->send(&p,sizeof(p),bl,SELF);
  87.     }
  88. }
  89.  
  90.  
  91. #if PACKETVER < 4
  92.     unit_walkingType = 0x7b,
  93. #elif PACKETVER < 7
  94.     unit_walkingType = 0x1da,
  95. #elif PACKETVER < 20080102
  96.     unit_walkingType = 0x22c,
  97. #elif PACKETVER < 20091103
  98.     unit_walkingType = 0x2ec,
  99. #elif PACKETVER < 20101124
  100.     unit_walkingType = 0x7f7,
  101. #elif PACKETVER < 20120221
  102.     unit_walkingType = 0x856,
  103. #elif PACKETVER < 20131223
  104.     unit_walkingType = 0x914,
  105. #elif PACKETVER < 20150513
  106.     unit_walkingType = 0x9db,
  107. #else
  108.     unit_walkingType = 0x9fd,
Advertisement
Add Comment
Please, Sign In to add comment