diff options
-rw-r--r-- | Changelog-Trunk.txt | 3 | ||||
-rw-r--r-- | db/const.txt | 24 | ||||
-rw-r--r-- | doc/script_commands.txt | 14 | ||||
-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 |
7 files changed, 86 insertions, 22 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 449c40068..5b56c2643 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,9 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2006/04/01
+ * April fool! Improved soundeffectall script command. (No, this is not a lie) [Lance]
+
2006/03/31
* Fixed skill_require_db loading of the new ammo columns.
* Added a column to specify the amount of ammo required for skills that
diff --git a/db/const.txt b/db/const.txt index 2e1aba0d7..7b97fae86 100644 --- a/db/const.txt +++ b/db/const.txt @@ -651,3 +651,27 @@ MOB_SIZE 18 MOB_RACE 19
MOB_ELEMENT 20
MOB_MODE 21
+
+ALL_CLIENT 0
+ALL_SAMEMAP 1
+AREA 2
+AREA_WOS 3
+AREA_WOC 4
+AREA_WOSC 5
+AREA_CHAT_WOC 6
+CHAT 7
+CHAT_WOS 8
+CHAT_MAINCHAT 9
+PARTY 10
+PARTY_WOS 11
+PARTY_SAMEMAP 12
+PARTY_SAMEMAP_WOS 13
+PARTY_AREA 14
+PARTY_AREA_WOS 15
+GUILD 16
+GUILD_WOS 17
+GUILD_SAMEMAP 18
+GUILD_SAMEMAP_WOS 19
+GUILD_AREA 20
+GUILD_AREA_WOS 21
+SELF 22
\ No newline at end of file diff --git a/doc/script_commands.txt b/doc/script_commands.txt index dffb448ba..0d3ad3b72 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -440,13 +440,13 @@ Variable scope is defined by a prefix before the variable name: They are stored with all the account data in "save\accreg.txt" in TXT
versions and in the SQL versions in the 'global_reg_value' table using
type 2.
-"##" - A permanent account-based variable stored by the login server.
- They are stored in "save\account.txt" and in the SQL versions in the
- 'global_reg_value' table, using type 1. The only difference you will
- note from normal # variables is when you have multiple char-servers
- connected to the same login server. The # variables are unique to each
- char-server, while the ## variables are shared by all these
- char-servers.
+"##" - A permanent account-based variable stored by the login server.
+ They are stored in "save\account.txt" and in the SQL versions in the
+ 'global_reg_value' table, using type 1. The only difference you will
+ note from normal # variables is when you have multiple char-servers
+ connected to the same login server. The # variables are unique to each
+ char-server, while the ## variables are shared by all these
+ char-servers.
Some variables are special, that is, they are already defined for you by the
scripting engine. You can see the full list somewhere in 'db/const.txt', which
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;
}
/*==========================================
|