summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/emap/clif.c81
-rw-r--r--src/emap/clif.h2
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/packets_struct.h64
4 files changed, 144 insertions, 4 deletions
diff --git a/src/emap/clif.c b/src/emap/clif.c
index 8e81d80..023d3e9 100644
--- a/src/emap/clif.c
+++ b/src/emap/clif.c
@@ -352,7 +352,7 @@ bool eclif_send(const void* buf __attribute__ ((unused)),
if (*len >= 2)
{
const int packet = RBUFW (buf, 0);
- if (packet == 0x9dd)
+ if (packet == 0x9dd || packet == 0x9dc)
{
struct map_session_data *sd = BL_CAST(BL_PC, bl);
struct SessionExt *data = session_get_bysd(sd);
@@ -364,7 +364,7 @@ bool eclif_send(const void* buf __attribute__ ((unused)),
return true;
}
}
- if (packet == 0x915)
+ if (packet == 0x915 || packet == 0x90f)
{
struct map_session_data *sd = BL_CAST(BL_PC, bl);
struct SessionExt *data = session_get_bysd(sd);
@@ -509,7 +509,7 @@ int eclif_send_actual(int *fd, void *buf, int *len)
return 0;
}
}
- if (packet == 0x9dd)
+ if (packet == 0x9dd || packet == 0x9dc)
{
struct SessionExt *data = session_get(*fd);
if (!data)
@@ -520,7 +520,7 @@ int eclif_send_actual(int *fd, void *buf, int *len)
return 0;
}
}
- if (packet == 0x915)
+ if (packet == 0x915 || packet == 0x90f)
{
struct SessionExt *data = session_get(*fd);
if (!data)
@@ -672,6 +672,74 @@ void eclif_set_unit_idle_old(struct block_list* bl,
}
+void eclif_spawn_unit_old(struct block_list* bl, enum send_target target)
+{
+ struct map_session_data* sd;
+ struct status_change* sc = status->get_sc(bl);
+ struct view_data* vd = status->get_viewdata(bl);
+ struct packet_spawn_unit_old p;
+ int g_id = status->get_guild_id(bl);
+
+ nullpo_retv(bl);
+
+ sd = BL_CAST(BL_PC, bl);
+
+ p.PacketType = 0x90f;
+ p.PacketLength = sizeof(p);
+ p.objecttype = clif_bl_type_old(bl);
+// p.AID = bl->id;
+// p.GID = (sd) ? sd->status.char_id : 0; // CCODE
+ p.GID = bl->id;
+ p.speed = status->get_speed(bl);
+ p.bodyState = (sc) ? sc->opt1 : 0;
+ p.healthState = (sc) ? sc->opt2 : 0;
+ p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
+ p.job = vd->class_;
+ p.head = vd->hair_style;
+ p.weapon = vd->weapon;
+ p.accessory = vd->head_bottom;
+ p.accessory2 = vd->head_top;
+ p.accessory3 = vd->head_mid;
+ if( bl->type == BL_NPC && vd->class_ == FLAG_CLASS ) { //The hell, why flags work like this?
+ p.accessory = status->get_emblem_id(bl);
+ p.accessory2 = GetWord(g_id, 1);
+ p.accessory3 = GetWord(g_id, 0);
+ }
+ p.headpalette = vd->hair_color;
+ p.bodypalette = vd->cloth_color;
+ p.headDir = (sd)? sd->head_dir : 0;
+ p.robe = vd->robe;
+ p.GUID = g_id;
+ p.GEmblemVer = status->get_emblem_id(bl);
+ p.honor = (sd) ? sd->status.manner : 0;
+ p.virtue = (sc) ? sc->opt3 : 0;
+ p.isPKModeON = (sd && sd->status.karma) ? 1 : 0;
+ p.sex = vd->sex;
+ WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl));
+ p.xSize = p.ySize = (sd) ? 5 : 0;
+ p.clevel = clif_setlevel(bl);
+ p.font = (sd) ? sd->status.font : 0;
+ if (battle->bc->show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) {
+ p.maxHP = status_get_max_hp(bl);
+ p.HP = status_get_hp(bl);
+ p.isBoss = ( ((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss ) ? 1 : 0;
+ } else {
+ p.maxHP = -1;
+ p.HP = -1;
+ p.isBoss = 0;
+ }
+ if( disguised(bl) ) {
+ nullpo_retv(sd);
+ if( sd->status.class_ != sd->disguise )
+ clif->send(&p,sizeof(p),bl,target);
+ p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE
+ p.GID = -bl->id;
+ clif->send(&p,sizeof(p),bl,SELF);
+ } else
+ clif->send(&p,sizeof(p),bl,target);
+
+}
+
void eclif_set_unit_idle_post(struct block_list* bl, TBL_PC *tsd,
enum send_target *target)
{
@@ -708,6 +776,11 @@ void eclif_move(struct unit_data *ud)
send_advmoving(ud, false, ud->bl, AREA_WOS);
}
+void eclif_spawn_unit_pre(struct block_list* bl, enum send_target *target)
+{
+ eclif_spawn_unit_old(bl, *target);
+}
+
bool tempChangeMap;
void eclif_parse_LoadEndAck_pre(int *fdPtr __attribute__ ((unused)),
diff --git a/src/emap/clif.h b/src/emap/clif.h
index 32605b0..021cce1 100644
--- a/src/emap/clif.h
+++ b/src/emap/clif.h
@@ -40,5 +40,7 @@ void eclif_disp_message(struct block_list* src,
void eclif_set_unit_idle_old(struct block_list* bl,
struct map_session_data *tsd,
enum send_target target);
+void eclif_spawn_unit_pre(struct block_list* bl,
+ enum send_target *target);
#endif // EVOL_MAP_CLIF
diff --git a/src/emap/init.c b/src/emap/init.c
index 27cd1ac..ce69319 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -185,6 +185,7 @@ HPExport void plugin_init (void)
addHookPre("clif->set_unit_idle", eclif_set_unit_idle);
addHookPre("clif->send_actual", eclif_send_actual);
addHookPre("clif->pLoadEndAck", eclif_parse_LoadEndAck_pre);
+ addHookPre("clif->spawn_unit", eclif_spawn_unit_pre);
addHookPre("itemdb->is_item_usable", eitemdb_is_item_usable);
addHookPre("itemdb->readdb_additional_fields", eitemdb_readdb_additional_fields);
addHookPre("itemdb->destroy_item_data", edestroy_item_data);
diff --git a/src/emap/packets_struct.h b/src/emap/packets_struct.h
index 1098953..901b135 100644
--- a/src/emap/packets_struct.h
+++ b/src/emap/packets_struct.h
@@ -91,4 +91,68 @@ struct packet_idle_unit_old {
#endif
} __attribute__((packed));
+struct packet_spawn_unit_old {
+ short PacketType;
+#if PACKETVER >= 20091103
+ short PacketLength;
+ unsigned char objecttype;
+#endif
+//#if PACKETVER >= 20131223
+// unsigned int AID;
+//#endif
+ unsigned int GID;
+ short speed;
+ short bodyState;
+ short healthState;
+#if PACKETVER < 20080102
+ short effectState;
+#else
+ int effectState;
+#endif
+ short job;
+ short head;
+#if PACKETVER < 7
+ short weapon;
+#else
+ int weapon;
+#endif
+ short accessory;
+#if PACKETVER < 7
+ short shield;
+#endif
+ short accessory2;
+ short accessory3;
+ short headpalette;
+ short bodypalette;
+ short headDir;
+#if PACKETVER >= 20101124
+ short robe;
+#endif
+ unsigned int GUID;
+ short GEmblemVer;
+ short honor;
+#if PACKETVER > 7
+ int virtue;
+#else
+ short virtue;
+#endif
+ uint8 isPKModeON;
+ unsigned char sex;
+ unsigned char PosDir[3];
+ unsigned char xSize;
+ unsigned char ySize;
+ short clevel;
+#if PACKETVER >= 20080102
+ short font;
+#endif
+#if PACKETVER >= 20120221
+ int maxHP;
+ int HP;
+ unsigned char isBoss;
+#endif
+#if PACKETVER >= 20150513
+ short body;
+#endif
+} __attribute__((packed));
+
#endif /* EVOL_MAP_PACKETS_STRUCT_H */