فهرست منبع

* Added the @sound command and the NPC command of soundeffectall - works just like soundeffect, but plays for everyone in the area [Codemaster] [SVN 942]

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@942 54d463be-8e91-2dee-dedb-b68131a5f0ec
codemaster 20 سال پیش
والد
کامیت
487f212144
6فایلهای تغییر یافته به همراه70 افزوده شده و 1 حذف شده
  1. 2 0
      Changelog.txt
  2. 27 0
      src/map/atcommand.c
  3. 2 1
      src/map/atcommand.h
  4. 18 0
      src/map/clif.c
  5. 1 0
      src/map/clif.h
  6. 20 0
      src/map/script.c

+ 2 - 0
Changelog.txt

@@ -1,5 +1,7 @@
 Date	Added
 01/09
+	* Added the @sound command and the NPC command of soundeffectall
+	 - works just like soundeffect, but plays for everyone in the area [Codemaster] [SVN 942]
 	* Don't allow Pets to attack Guardians outside of WoE [Codemaster] [SVN 940]
 	* Require 15% of HP or more for WE_MALE skill [Codemaster] [SVN 940]
 	* Require 15% of SP or more for WE_FEMALE skill [Codemaster] [SVN 940]

+ 27 - 0
src/map/atcommand.c

@@ -247,6 +247,7 @@ ACMD_FUNC(killid); // by Dino9021
 ACMD_FUNC(killid2); // by Dino9021
 ACMD_FUNC(charkillableid); // by Dino9021
 ACMD_FUNC(charkillableid2);  // by Dino9021
+ACMD_FUNC(sound);
 
 /*==========================================
  *AtCommandInfo atcommand_info[]�\‘¢‘̂̒è‹`
@@ -516,6 +517,7 @@ static AtCommandInfo atcommand_info[] = {
 	{ AtCommand_KillId2,                "@killid2", 60, atcommand_killid2 }, // [Dino9021]
 	{ AtCommand_CharKillableId,      "@charkillableid",    40, atcommand_charkillableid }, // [Dino9021]
 	{ AtCommand_CharKillableId2,      "@charkillableid2",    40, atcommand_charkillableid2 }, // [Dino9021]
+	{ AtCommand_Sound,		"@sound",	40,	atcommand_sound },
 
 // add new commands before this line
 	{ AtCommand_Unknown,             NULL,                1, NULL }
@@ -7557,6 +7559,31 @@ atcommand_clearweather(
 	return 0;
 } 
 
+/*===============================================================
+ * Sound Command - plays a sound for everyone! [Codemaster]
+ *---------------------------------------------------------------
+ */
+int
+atcommand_sound(
+	const int fd, struct map_session_data *sd,
+	const char *command, const char *message)
+{
+	char sound_file[100];
+
+	if(!message || !*message || sscanf(message, "%99[^\n]", sound_file) < 1) {
+		clif_displaymessage(fd, "Please, enter a sound filename. (usage: @sound <filename>)");
+		return -1;
+	}
+
+	memset(sound_file, '\0', sizeof(sound_file));
+	if(sscanf(message, "%99[^\n]", sound_file) < 1)
+		return -1;
+
+	clif_soundeffectall(&sd->bl, sound_file,0);
+
+	return 0;
+}
+
 /*==========================================
  * 	MOB Search
  *------------------------------------------

+ 2 - 1
src/map/atcommand.h

@@ -206,7 +206,7 @@ enum AtCommandType {
 	AtCommand_SendMail, // [Valaris]
 	AtCommand_DeleteMail, // [Valaris]
 	AtCommand_SendPriorityMail, // [Valaris]
-	AtCommand_Sound, // [Valaris]	
+//	AtCommand_Sound, // [Valaris]	
 	AtCommand_RefreshOnline, // [Valaris]
 	// SQL-only commands end
 #endif
@@ -232,6 +232,7 @@ enum AtCommandType {
 	AtCommand_KillId2, // by Dino9021
 	AtCommand_CharKillableId, // by Dino9021
 	AtCommand_CharKillableId2, // by Dino9021
+	AtCommand_Sound,
 
 	// end
 	AtCommand_Unknown,

+ 18 - 0
src/map/clif.c

@@ -7209,6 +7209,24 @@ 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)
+{
+	unsigned char buf[31];
+	memset(buf, 0, packet_len_table[0x1d3]);
+
+	nullpo_retr(0, bl);
+
+	WBUFW(buf,0)=0x1d3;
+	memcpy(WBUFP(buf,2), name, 24);
+	WBUFB(buf,26)=type;
+	WBUFL(buf,27)=0;
+	WBUFL(buf,31)=bl->id;
+	clif_send(buf, packet_len_table[0x1d3], bl, AREA);
+
+	return 0;
+}
+
 // displaying special effects (npcs, weather, etc) [Valaris]
 int clif_specialeffect(struct block_list *bl, int type, int flag) {
 	unsigned char buf[24];

+ 1 - 0
src/map/clif.h

@@ -93,6 +93,7 @@ void clif_wedding_effect(struct block_list *bl);
 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);
 
 // trade
 int clif_traderequest(struct map_session_data *sd,char *name);

+ 20 - 0
src/map/script.c

@@ -262,6 +262,7 @@ int buildin_clearitem(struct script_state *st);
 int buildin_classchange(struct script_state *st);
 int buildin_misceffect(struct script_state *st);
 int buildin_soundeffect(struct script_state *st);
+int buildin_soundeffectall(struct script_state *st);
 int buildin_setcastledata(struct script_state *st);
 int buildin_mapwarp(struct script_state *st);
 int buildin_inittimer(struct script_state *st);
@@ -483,6 +484,7 @@ struct {
 	{buildin_classchange,"classchange","ii"},
 	{buildin_misceffect,"misceffect","i"},
 	{buildin_soundeffect,"soundeffect","si"},
+	{buildin_soundeffectall,"soundeffectall","si"},	// 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]
@@ -5798,6 +5800,24 @@ int buildin_soundeffect(struct script_state *st)
 	}
 	return 0;
 }
+
+int buildin_soundeffectall(struct script_state *st)
+{
+	struct map_session_data *sd=script_rid2sd(st);
+	char *name;
+	int type=0;
+
+	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
+			clif_soundeffectall(&sd->bl,name,type);
+	}
+	return 0;
+}
 /*==========================================
  * pet status recovery [Valaris]
  *------------------------------------------