Browse Source

* April fool! Improved soundeffectall script command. (No, this is not a lie)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5832 54d463be-8e91-2dee-dedb-b68131a5f0ec
Lance 19 years ago
parent
commit
343deba71c
7 changed files with 86 additions and 22 deletions
  1. 3 0
      Changelog-Trunk.txt
  2. 24 0
      db/const.txt
  3. 7 7
      doc/script_commands.txt
  4. 1 1
      src/map/atcommand.c
  5. 7 2
      src/map/clif.c
  6. 1 1
      src/map/clif.h
  7. 43 11
      src/map/script.c

+ 3 - 0
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.
 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.
 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
 2006/03/31
 	* Fixed skill_require_db loading of the new ammo columns.
 	* Fixed skill_require_db loading of the new ammo columns.
 	* Added a column to specify the amount of ammo required for skills that
 	* Added a column to specify the amount of ammo required for skills that

+ 24 - 0
db/const.txt

@@ -651,3 +651,27 @@ MOB_SIZE	18
 MOB_RACE	19
 MOB_RACE	19
 MOB_ELEMENT	20
 MOB_ELEMENT	20
 MOB_MODE	21
 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

+ 7 - 7
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 
        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
        versions and in the SQL versions in the 'global_reg_value' table using
 		 type 2.
 		 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 
 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 
 scripting engine. You can see the full list somewhere in 'db/const.txt', which 

+ 1 - 1
src/map/atcommand.c

@@ -7986,7 +7986,7 @@ atcommand_sound(
 	if(strstr(sound_file, ".wav") == NULL)
 	if(strstr(sound_file, ".wav") == NULL)
 		strcat(sound_file, ".wav");
 		strcat(sound_file, ".wav");
 
 
-	clif_soundeffectall(&sd->bl, sound_file,0);
+	clif_soundeffectall(&sd->bl, sound_file,0,2);
 
 
 	return 0;
 	return 0;
 }
 }

+ 7 - 2
src/map/clif.c

@@ -8317,11 +8317,16 @@ void clif_soundeffect(struct map_session_data *sd,struct block_list *bl,char *na
 	return;
 	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];
 	unsigned char buf[40];
 	memset(buf, 0, packet_len_table[0x1d3]);
 	memset(buf, 0, packet_len_table[0x1d3]);
 
 
+	if(coverage < 0 || coverage > 22){
+		ShowError("clif_soundeffectall: undefined coverage.\n");
+		return 0;
+	}
+
 	nullpo_retr(0, bl);
 	nullpo_retr(0, bl);
 
 
 	WBUFW(buf,0)=0x1d3;
 	WBUFW(buf,0)=0x1d3;
@@ -8329,7 +8334,7 @@ int clif_soundeffectall(struct block_list *bl, char *name, int type)
 	WBUFB(buf,26)=type;
 	WBUFB(buf,26)=type;
 	WBUFL(buf,27)=0;
 	WBUFL(buf,27)=0;
 	WBUFL(buf,31)=bl->id;
 	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;
 	return 0;
 }
 }

+ 1 - 1
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_adopt_process(struct map_session_data *sd);
 void clif_sitting(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);
 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
 // trade
 int clif_traderequest(struct map_session_data *sd,char *name);
 int clif_traderequest(struct map_session_data *sd,char *name);

+ 43 - 11
src/map/script.c

@@ -645,7 +645,7 @@ struct {
 	{buildin_classchange,"classchange","ii"},
 	{buildin_classchange,"classchange","ii"},
 	{buildin_misceffect,"misceffect","i"},
 	{buildin_misceffect,"misceffect","i"},
 	{buildin_soundeffect,"soundeffect","si"},
 	{buildin_soundeffect,"soundeffect","si"},
-	{buildin_soundeffectall,"soundeffectall","si"},	// SoundEffectAll [Codemaster]
+	{buildin_soundeffectall,"soundeffectall","*"},	// SoundEffectAll [Codemaster]
 	{buildin_strmobinfo,"strmobinfo","ii"},	// display mob data [Valaris]
 	{buildin_strmobinfo,"strmobinfo","ii"},	// display mob data [Valaris]
 	{buildin_guardian,"guardian","siisii*i"},	// summon guardians
 	{buildin_guardian,"guardian","siisii*i"},	// summon guardians
 	{buildin_guardianinfo,"guardianinfo","i"},	// display guardian data [Valaris]
 	{buildin_guardianinfo,"guardianinfo","i"},	// display guardian data [Valaris]
@@ -8148,23 +8148,55 @@ int buildin_soundeffect(struct script_state *st)
 	return 0;
 	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)
 int buildin_soundeffectall(struct script_state *st)
 {
 {
 	// [Lance] - Improved.
 	// [Lance] - Improved.
 	struct map_session_data *sd=NULL;
 	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]));
 	name=conv_str(st,& (st->stack->stack_data[st->start+2]));
 	type=conv_num(st,& (st->stack->stack_data[st->start+3]));
 	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;
 	return 0;
 }
 }
 /*==========================================
 /*==========================================