summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-06-01 13:58:11 -0300
committershennetsind <ind@henn.et>2013-06-01 13:58:11 -0300
commita7ad5cc37f1b74708f1982839c4bfd932d0687b9 (patch)
tree89fb7636bc8e4dbfc0c4d526758edb76e0daaec1 /src
parentd7e44b9b752e875bd37714309ee524f9700f7d2a (diff)
downloadhercules-a7ad5cc37f1b74708f1982839c4bfd932d0687b9.tar.gz
hercules-a7ad5cc37f1b74708f1982839c4bfd932d0687b9.tar.bz2
hercules-a7ad5cc37f1b74708f1982839c4bfd932d0687b9.tar.xz
hercules-a7ad5cc37f1b74708f1982839c4bfd932d0687b9.zip
Fixed Bug #7311
Special Thanks to mleo1, Masao!~ http://hercules.ws/board/tracker/issue-7311-hideonnpc-not-working/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c34
-rw-r--r--src/map/npc.c3
2 files changed, 17 insertions, 20 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 375f4a1d0..f1aac302e 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -226,7 +226,6 @@ uint32 clif_refresh_ip(void) {
}
return 0;
}
-
#if PACKETVER >= 20071106
static inline unsigned char clif_bl_type(struct block_list *bl) {
switch (bl->type) {
@@ -850,7 +849,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
p.speed = status_get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : 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;
@@ -1092,7 +1091,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
p.speed = status_get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : 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;
@@ -1172,7 +1171,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
p.speed = status_get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : 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;
@@ -3639,16 +3638,17 @@ void clif_changeoption(struct block_list* bl)
struct map_session_data* sd;
nullpo_retv(bl);
- sc = status_get_sc(bl);
- if (!sc) return; //How can an option change if there's no sc?
+
+ if ( !(sc = status_get_sc(bl)) && bl->type != BL_NPC ) return; //How can an option change if there's no sc?
+
sd = BL_CAST(BL_PC, bl);
#if PACKETVER >= 7
WBUFW(buf,0) = 0x229;
WBUFL(buf,2) = bl->id;
- WBUFW(buf,6) = sc->opt1;
- WBUFW(buf,8) = sc->opt2;
- WBUFL(buf,10) = sc->option;
+ WBUFW(buf,6) = (sc) ? sc->opt1 : 0;
+ WBUFW(buf,8) = (sc) ? sc->opt2 : 0;
+ WBUFL(buf,10) = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
WBUFB(buf,14) = (sd)? sd->status.karma : 0;
if(disguised(bl)) {
clif->send(buf,packet_len(0x229),bl,AREA_WOS);
@@ -3662,9 +3662,9 @@ void clif_changeoption(struct block_list* bl)
#else
WBUFW(buf,0) = 0x119;
WBUFL(buf,2) = bl->id;
- WBUFW(buf,6) = sc->opt1;
- WBUFW(buf,8) = sc->opt2;
- WBUFW(buf,10) = sc->option;
+ WBUFW(buf,6) = (sc) ? sc->opt1 : 0;
+ WBUFW(buf,8) = (sc) ? sc->opt2 : 0;
+ WBUFL(buf,10) = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
WBUFB(buf,12) = (sd)? sd->status.karma : 0;
if(disguised(bl)) {
clif->send(buf,packet_len(0x119),bl,AREA_WOS);
@@ -3681,19 +3681,17 @@ void clif_changeoption(struct block_list* bl)
/// Displays status change effects on NPCs/monsters (ZC_NPC_SHOWEFST_UPDATE).
/// 028a <id>.L <effect state>.L <level>.L <showEFST>.L
-void clif_changeoption2(struct block_list* bl)
-{
+void clif_changeoption2(struct block_list* bl) {
unsigned char buf[20];
struct status_change *sc;
- sc = status_get_sc(bl);
- if (!sc) return; //How can an option change if there's no sc?
+ if ( !(sc = status_get_sc(bl)) && bl->type != BL_NPC ) return; //How can an option change if there's no sc?
WBUFW(buf,0) = 0x28a;
WBUFL(buf,2) = bl->id;
- WBUFL(buf,6) = sc->option;
+ WBUFL(buf,6) = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
WBUFL(buf,10) = clif_setlevel(bl);
- WBUFL(buf,14) = sc->opt3;
+ WBUFL(buf,14) = (sc) ? sc->opt3 : 0;
if(disguised(bl)) {
clif->send(buf,packet_len(0x28a),bl,AREA_WOS);
WBUFL(buf,2) = -bl->id;
diff --git a/src/map/npc.c b/src/map/npc.c
index cb26bd75c..75aab5550 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -197,8 +197,7 @@ int npc_enable(const char* name, int flag)
{
struct npc_data* nd = npc_name2id(name);
- if (nd==NULL)
- {
+ if ( nd == NULL ) {
ShowError("npc_enable: Attempted to %s a non-existing NPC '%s' (flag=%d).\n", (flag&3) ? "show" : "hide", name, flag);
return 0;
}