Преглед на файлове

Announce Accept Char id (#4203)

Adjusted script command announce to accept charID
* Fixes #3901.
* Script command announce will now accept a character ID to display locally.
Thanks to @sader1992!
Co-authored-by: Atemo <Atemo@users.noreply.github.com>
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
Sader Fawall преди 5 години
родител
ревизия
fc1c05aee9
променени са 2 файла, в които са добавени 9 реда и са изтрити 5 реда
  1. 7 3
      doc/script_commands.txt
  2. 2 2
      src/map/script.cpp

+ 7 - 3
doc/script_commands.txt

@@ -6814,7 +6814,7 @@ as soon as the progress bar activates.
 //
 ---------------------------------------
 
-*announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
+*announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>{,<char_id>}}}}}};
 
 This command will broadcast a message to all or most players, similar to
 @kami/@kamib GM commands.
@@ -6830,11 +6830,12 @@ Target flags:
 - bc_all: Broadcast message is sent server-wide (default).
 - bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
 - bc_area: Message is sent to players in the vicinity of the source.
-- bc_self: Message is sent only to current player.
+- bc_self: Message is sent only to current player , if the source flag is bc_pc it also can
+			be used to send the Message to the character id if it's provided.
 You cannot use more than one target flag.
 
 Source flags:
-- bc_pc: Broadcast source is the attached player (default).
+- bc_pc: Broadcast source is the attached player or the character id if it's provided (default).
 - bc_npc: Broadcast source is the NPC, not the player attached to the script
   (useful when a player is not attached or the message should be sent to those
   nearby the NPC).
@@ -6871,6 +6872,9 @@ but it can be used instead in NPCs to "preview" an announce.
 	// This will be shown on everyones screen that is in sight of the NPC.
 	announce "This is my message just for you people here",bc_npc|bc_area;
 
+	// This will be a private message to the player with character id 150000
+	announce "This is my message just for char id 150000",bc_self,0xFFF618,FW_NORMAL,12,0,0,150000;
+
 ---------------------------------------
 
 *mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};

+ 2 - 2
src/map/script.cpp

@@ -11162,7 +11162,7 @@ BUILDIN_FUNC(announce)
 		}else{
 			struct map_session_data* sd;
 
-			if( script_rid2sd(sd) )
+			if(script_charid2sd(9, sd))
 				bl = &sd->bl;
 			else
 				bl = NULL;
@@ -24705,7 +24705,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(attachnpctimer,"?"), // attached the player id to the npc timer [Celest]
 	BUILDIN_DEF(detachnpctimer,"?"), // detached the player id from the npc timer [Celest]
 	BUILDIN_DEF(playerattached,""), // returns id of the current attached player. [Skotlex]
-	BUILDIN_DEF(announce,"si?????"),
+	BUILDIN_DEF(announce,"si??????"),
 	BUILDIN_DEF(mapannounce,"ssi?????"),
 	BUILDIN_DEF(areaannounce,"siiiisi?????"),
 	BUILDIN_DEF(getusers,"i"),