Parcourir la source

Added script command openbank (#6821)

Pokye il y a 3 ans
Parent
commit
f4410fba6b
3 fichiers modifiés avec 32 ajouts et 1 suppressions
  1. 8 0
      doc/script_commands.txt
  2. 2 1
      src/map/clif.hpp
  3. 22 0
      src/map/script.cpp

+ 8 - 0
doc/script_commands.txt

@@ -8099,6 +8099,14 @@ This feature requires packet version 2017-07-26 or newer.
 
 This function is intended for use in item scripts.
 
+---------------------------------------
+
+*openbank({<char id>})
+
+Opens the Bank UI for the attached player or the given character ID.
+
+This command requires packet version 2015-01-28 or newer.
+
 ---------------------------------------
 \\
 6,1.- Unit-related commands

+ 2 - 1
src/map/clif.hpp

@@ -1159,7 +1159,8 @@ enum in_ui_type : int8 {
 };
 
 enum out_ui_type : int8 {
-	OUT_UI_STYLIST = 1,
+	OUT_UI_BANK = 0,
+	OUT_UI_STYLIST,
 	OUT_UI_QUEST = 6,
 	OUT_UI_ATTENDANCE = 7
 };

+ 22 - 0
src/map/script.cpp

@@ -25840,6 +25840,27 @@ BUILDIN_FUNC( open_quest_ui ){
 	return SCRIPT_CMD_SUCCESS;
 }
 
+BUILDIN_FUNC(openbank){
+#if PACKETVER < 20150128
+	ShowError( "buildin_openbank: This command requires PACKETVER 20150128 or newer.\n" );
+	return SCRIPT_CMD_FAILURE;
+#else
+	struct map_session_data* sd = nullptr;
+
+	if (!script_charid2sd(2, sd)) {
+		return SCRIPT_CMD_FAILURE;
+	}
+
+	if( !battle_config.feature_banking ){
+		ShowError( "buildin_openbank: banking is disabled.\n" );
+		return SCRIPT_CMD_FAILURE;
+	}
+
+	clif_ui_open( sd, OUT_UI_BANK, 0 );
+	return SCRIPT_CMD_SUCCESS;
+#endif
+}
+
 #include "../custom/script.inc"
 
 // declarations that were supposed to be exported from npc_chat.cpp
@@ -26553,6 +26574,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(laphine_upgrade, ""),
 	BUILDIN_DEF(randomoptgroup,"i"),
 	BUILDIN_DEF(open_quest_ui, "??"),
+	BUILDIN_DEF(openbank,"?"),
 #include "../custom/script_def.inc"
 
 	{NULL,NULL,NULL},