diff options
author | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-01 02:11:23 +0000 |
---|---|---|
committer | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-01 02:11:23 +0000 |
commit | 454ae6b78937da966545207b94b1e0a037fdb098 (patch) | |
tree | 4bbf37710cab966b03bab7280b5f425b6cebad36 /src | |
parent | bab1ce1992acc67b814e3de9f09ac58d569265b1 (diff) | |
download | hercules-454ae6b78937da966545207b94b1e0a037fdb098.tar.gz hercules-454ae6b78937da966545207b94b1e0a037fdb098.tar.bz2 hercules-454ae6b78937da966545207b94b1e0a037fdb098.tar.xz hercules-454ae6b78937da966545207b94b1e0a037fdb098.zip |
* April fool! Improved soundeffectall script command. (No, this is not a lie)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5832 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 9 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 54 |
4 files changed, 52 insertions, 15 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 8cde99aa2..e10ec8d99 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -7986,7 +7986,7 @@ atcommand_sound( if(strstr(sound_file, ".wav") == NULL)
strcat(sound_file, ".wav");
- clif_soundeffectall(&sd->bl, sound_file,0);
+ clif_soundeffectall(&sd->bl, sound_file,0,2);
return 0;
}
diff --git a/src/map/clif.c b/src/map/clif.c index 676f7c707..9472a07bd 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8317,11 +8317,16 @@ void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,char *na return;
}
-int clif_soundeffectall(struct block_list *bl, char *name, int type)
+int clif_soundeffectall(struct block_list *bl, char *name, int type, int coverage)
{
unsigned char buf[40];
memset(buf, 0, packet_len_table[0x1d3]);
+ if(coverage < 0 || coverage > 22){
+ ShowError("clif_soundeffectall: undefined coverage.\n");
+ return 0;
+ }
+
nullpo_retr(0, bl);
WBUFW(buf,0)=0x1d3;
@@ -8329,7 +8334,7 @@ int clif_soundeffectall(struct block_list *bl, char *name, int type) WBUFB(buf,26)=type;
WBUFL(buf,27)=0;
WBUFL(buf,31)=bl->id;
- clif_send(buf, packet_len_table[0x1d3], bl, AREA);
+ clif_send(buf, packet_len_table[0x1d3], bl, coverage);
return 0;
}
diff --git a/src/map/clif.h b/src/map/clif.h index b1d069a14..016598db6 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -121,7 +121,7 @@ void clif_divorced(struct map_session_data *sd, char *); void clif_adopt_process(struct map_session_data *sd);
void clif_sitting(struct map_session_data *sd);
void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,char *name,int type);
-int clif_soundeffectall(struct block_list *bl, char *name, int type);
+int clif_soundeffectall(struct block_list *bl, char *name, int type, int coverage);
// trade
int clif_traderequest(struct map_session_data *sd,char *name);
diff --git a/src/map/script.c b/src/map/script.c index acf09a796..8e09ad061 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -645,7 +645,7 @@ struct { {buildin_classchange,"classchange","ii"},
{buildin_misceffect,"misceffect","i"},
{buildin_soundeffect,"soundeffect","si"},
- {buildin_soundeffectall,"soundeffectall","si"}, // SoundEffectAll [Codemaster]
+ {buildin_soundeffectall,"soundeffectall","*"}, // SoundEffectAll [Codemaster]
{buildin_strmobinfo,"strmobinfo","ii"}, // display mob data [Valaris]
{buildin_guardian,"guardian","siisii*i"}, // summon guardians
{buildin_guardianinfo,"guardianinfo","i"}, // display guardian data [Valaris]
@@ -8148,23 +8148,55 @@ int buildin_soundeffect(struct script_state *st) return 0;
}
+int soundeffect_sub(struct block_list* bl,va_list ap)
+{
+ char *name;
+ int type;
+
+ nullpo_retr(0, bl);
+ nullpo_retr(0, ap);
+
+ name = va_arg(ap,char *);
+ type = va_arg(ap,int);
+
+ clif_soundeffect((struct map_session_data *)bl, bl, name, type);
+
+ return 0;
+}
+
int buildin_soundeffectall(struct script_state *st)
{
// [Lance] - Improved.
struct map_session_data *sd=NULL;
- char *name;
- int type=0;
+ char *name, *map = NULL;
+ struct block_list *bl;
+ int type, coverage, x0, y0, x1, y1;
name=conv_str(st,& (st->stack->stack_data[st->start+2]));
type=conv_num(st,& (st->stack->stack_data[st->start+3]));
- //if(sd)
- //{
- if(st->oid)
- clif_soundeffectall(map_id2bl(st->oid),name,type);
- else
- if((sd=script_rid2sd(st)))
- clif_soundeffectall(&sd->bl,name,type);
- //}
+ coverage=conv_num(st,& (st->stack->stack_data[st->start+4]));
+
+ if(st->oid)
+ bl = map_id2bl(st->oid);
+ else
+ bl = &(script_rid2sd(st)->bl);
+
+ if(bl){
+ if(coverage < 23){
+ clif_soundeffectall(bl,name,type,coverage);
+ }else {
+ if(st->end > st->start+9){
+ map=conv_str(st,& (st->stack->stack_data[st->start+5]));
+ x0 = conv_num(st,& (st->stack->stack_data[st->start+6]));
+ y0 = conv_num(st,& (st->stack->stack_data[st->start+7]));
+ x1 = conv_num(st,& (st->stack->stack_data[st->start+8]));
+ y1 = conv_num(st,& (st->stack->stack_data[st->start+9]));
+ map_foreachinarea(soundeffect_sub,map_mapname2mapid(map),x0,y0,x1,y1,BL_PC,name,type);
+ } else {
+ ShowError("buildin_soundeffectall: insufficient arguments for specific area broadcast.\n");
+ }
+ }
+ }
return 0;
}
/*==========================================
|