浏览代码

Implemented script command opentips (#8005)

- Opens the tip box UI for the attached player or the given character ID.
Atemo 1 年之前
父节点
当前提交
c23afaeac0
共有 3 个文件被更改,包括 27 次插入1 次删除
  1. 8 0
      doc/script_commands.txt
  2. 2 1
      src/map/clif.hpp
  3. 17 0
      src/map/script.cpp

+ 8 - 0
doc/script_commands.txt

@@ -8413,6 +8413,14 @@ error message instead.
 
 This command requires packet version 2021-11-03 or newer.
 
+---------------------------------------
+
+*opentips({<Tip ID>,{<char ID>}});
+
+Opens the tip box UI for the attached player or the given character ID.
+
+This command requires packet version 2017-11-22 or newer.
+
 ---------------------------------------
 \\
 6,1.- Unit-related commands

+ 2 - 1
src/map/clif.hpp

@@ -1181,7 +1181,8 @@ enum out_ui_type : int8 {
 	OUT_UI_STYLIST,
 	OUT_UI_CAPTCHA,
 	OUT_UI_MACRO,
-	OUT_UI_QUEST = 6,
+	OUT_UI_TIP = 5,
+	OUT_UI_QUEST,
 	OUT_UI_ATTENDANCE,
 	OUT_UI_ENCHANTGRADE,
 	OUT_UI_ENCHANT = 10,

+ 17 - 0
src/map/script.cpp

@@ -26957,6 +26957,22 @@ BUILDIN_FUNC(has_autoloot) {
 	return SCRIPT_CMD_SUCCESS;
 }
 
+BUILDIN_FUNC(opentips){
+#if PACKETVER < 20171122
+	ShowError( "buildin_opentips: This command requires PACKETVER 20171122 or newer.\n" );
+	return SCRIPT_CMD_FAILURE;
+#else
+	map_session_data* sd;
+
+	if (!script_charid2sd(3, sd)) {
+		return SCRIPT_CMD_FAILURE;
+	}
+
+	clif_ui_open( *sd, OUT_UI_TIP, script_getnum(st, 2) );
+	return SCRIPT_CMD_SUCCESS;
+#endif
+}
+
 #include <custom/script.inc>
 
 // declarations that were supposed to be exported from npc_chat.cpp
@@ -27713,6 +27729,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(isdead, "?"),
 	BUILDIN_DEF(macro_detector, "?"),
 	BUILDIN_DEF(has_autoloot,"?"),
+	BUILDIN_DEF(opentips, "i?"),
 
 #include <custom/script_def.inc>