summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorGuilherme G. M <guilherme-gm@users.noreply.github.com>2017-02-26 03:41:50 -0300
committerDastgir <dastgirpojee@rocketmail.com>2017-02-26 12:11:50 +0530
commit113865cd441c1ebd04f8d0b9d7380cc852a08fb9 (patch)
treec580d334d86accdb19bac294926c5cffe5f9cccd /src/map
parent9a7a165d4dbad598907d3ecd54196e8f76c4f3f5 (diff)
downloadhercules-113865cd441c1ebd04f8d0b9d7380cc852a08fb9.tar.gz
hercules-113865cd441c1ebd04f8d0b9d7380cc852a08fb9.tar.bz2
hercules-113865cd441c1ebd04f8d0b9d7380cc852a08fb9.tar.xz
hercules-113865cd441c1ebd04f8d0b9d7380cc852a08fb9.zip
Added option to show classchange only to one player (#1587)
* Added option to show classchange only to one player
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c8
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/script.c27
4 files changed, 27 insertions, 12 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 674fbba1d..6897c357a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1352,7 +1352,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
/// 01b0 <id>.L <type>.B <value>.L
/// type:
/// unused
-void clif_class_change(struct block_list *bl, int class_, int type)
+void clif_class_change(struct block_list *bl, int class_, int type, struct map_session_data *sd)
{
nullpo_retv(bl);
@@ -1363,7 +1363,11 @@ void clif_class_change(struct block_list *bl, int class_, int type)
WBUFL(buf,2)=bl->id;
WBUFB(buf,6)=type;
WBUFL(buf,7)=class_;
- clif->send(buf,packet_len(0x1b0),bl,AREA);
+
+ if (sd == NULL)
+ clif->send(buf, packet_len(0x1b0), bl, AREA);
+ else
+ clif->send(buf, packet_len(0x1b0), &sd->bl, SELF);
}
}
diff --git a/src/map/clif.h b/src/map/clif.h
index b27adb5be..aefba5974 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -671,7 +671,7 @@ struct clif_interface {
void (*changetraplook) (struct block_list *bl,int val);
void (*refreshlook) (struct block_list *bl,int id,int type,int val,enum send_target target);
void (*sendlook) (struct block_list *bl, int id, int type, int val, int val2, enum send_target target);
- void (*class_change) (struct block_list *bl,int class_,int type);
+ void (*class_change) (struct block_list *bl,int class_,int type, struct map_session_data *sd);
void (*skill_delunit) (struct skill_unit *su);
void (*skillunit_update) (struct block_list* bl);
int (*clearunit_delayed_sub) (int tid, int64 tick, int id, intptr_t data);
diff --git a/src/map/mob.c b/src/map/mob.c
index d5932f195..74d25b805 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2832,7 +2832,7 @@ int mob_class_change (struct mob_data *md, int class_) {
mob_stop_walking(md, STOPWALKING_FLAG_NONE);
unit->skillcastcancel(&md->bl, 0);
status->set_viewdata(&md->bl, class_);
- clif->class_change(&md->bl, md->vd->class, 1);
+ clif->class_change(&md->bl, md->vd->class, 1, NULL);
status_calc_mob(md, SCO_FIRST);
md->ud.state.speed_changed = 1; //Speed change update.
diff --git a/src/map/script.c b/src/map/script.c
index ef63697a7..30295b8dc 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13840,15 +13840,26 @@ BUILDIN(undisguise)
* Transform a bl to another class,
* @type unused
*------------------------------------------*/
-BUILDIN(classchange) {
- int class, type;
- struct block_list *bl=map->id2bl(st->oid);
+BUILDIN(classchange)
+{
+ int class, type, target;
+ struct block_list *bl = map->id2bl(st->oid);
- if(bl==NULL) return true;
+ if (bl == NULL)
+ return true;
- class = script_getnum(st,2);
- type=script_getnum(st,3);
- clif->class_change(bl, class, type);
+ class = script_getnum(st, 2);
+ type = script_getnum(st, 3);
+ target = script_hasdata(st, 4) ? script_getnum(st, 4) : 0;
+
+ if (target > 0) {
+ struct map_session_data *sd = script->charid2sd(st, target);
+ if (sd != NULL) {
+ clif->class_change(bl, class, type, sd);
+ }
+ } else {
+ clif->class_change(bl, class, type, NULL);
+ }
return true;
}
@@ -21032,7 +21043,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getcartinventorylist,""),
BUILDIN_DEF(getskilllist,""),
BUILDIN_DEF(clearitem,""),
- BUILDIN_DEF(classchange,"ii"),
+ BUILDIN_DEF(classchange,"ii?"),
BUILDIN_DEF(misceffect,"i"),
BUILDIN_DEF(playbgm,"s"),
BUILDIN_DEF(playbgmall,"s?????"),