Implemented Dialog Types (#8110)

Fixes #8109

Co-authored-by: Aleos <aleos89@users.noreply.github.com>
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Pokye
2024-02-26 18:08:52 -03:00
committed by GitHub
parent e196eadcaa
commit eb308dcad2
5 changed files with 207 additions and 0 deletions

View File

@@ -27123,6 +27123,106 @@ BUILDIN_FUNC(opentips){
#endif
}
BUILDIN_FUNC(setdialogalign){
map_session_data *sd;
if ( !script_rid2sd(sd) ) {
return SCRIPT_CMD_FAILURE;
}
int32 align = script_getnum( st, 2 );
if( align < DIALOG_ALIGN_LEFT || align > DIALOG_ALIGN_BOTTOM ){
ShowError( "buildin_setdialogalign: Unknown align value %d\n", align );
return SCRIPT_CMD_FAILURE;
}
clif_set_dialog_align( *sd, st->oid, static_cast<e_say_dialog_align>( align ) );
return SCRIPT_CMD_SUCCESS;
}
BUILDIN_FUNC(setdialogsize){
map_session_data *sd;
if ( !script_rid2sd(sd) ) {
script_pushint(st, 0);
return SCRIPT_CMD_FAILURE;
}
int32 x = script_getnum( st, 2 );
if( x < 0 || x > INT16_MAX ){
ShowError( "buildin_setdialogsize: x size %d is out of range [0,%d]\n", x, INT16_MAX );
return SCRIPT_CMD_FAILURE;
}
int32 y = script_getnum( st, 3 );
if( y < 0 || y > INT16_MAX ){
ShowError( "buildin_setdialogsize: y size %d is out of range [0,%d]\n", y, INT16_MAX );
return SCRIPT_CMD_FAILURE;
}
clif_set_npc_window_size( *sd, x, y );
return SCRIPT_CMD_SUCCESS;
}
BUILDIN_FUNC(setdialogpos){
map_session_data *sd;
if ( !script_rid2sd(sd) ) {
script_pushint(st, 0);
return SCRIPT_CMD_FAILURE;
}
int32 x = script_getnum( st, 2 );
if( x < 0 || x > INT16_MAX ){
ShowError( "buildin_setdialogpos: x position %d is out of range [0,%d]\n", x, INT16_MAX );
return SCRIPT_CMD_FAILURE;
}
int32 y = script_getnum( st, 3 );
if( y < 0 || y > INT16_MAX ){
ShowError( "buildin_setdialogpos: y position %d is out of range [0,%d]\n", y, INT16_MAX );
return SCRIPT_CMD_FAILURE;
}
clif_set_npc_window_pos( *sd, x, y );
return SCRIPT_CMD_SUCCESS;
}
BUILDIN_FUNC(setdialogpospercent){
map_session_data *sd;
if ( !script_rid2sd(sd) ) {
script_pushint(st, 0);
return SCRIPT_CMD_FAILURE;
}
int32 x = script_getnum( st, 2 );
if( x < 0 || x > 100 ){
ShowError( "buildin_setdialogpospercent: x rate %d is out of range [0,100]\n", x );
return SCRIPT_CMD_FAILURE;
}
int32 y = script_getnum( st, 3 );
if( y < 0 || y > 100 ){
ShowError( "buildin_setdialogpospercent: y rate %d is out of range [0,100]\n", y );
return SCRIPT_CMD_FAILURE;
}
clif_set_npc_window_pos_percent( *sd, x, y );
return SCRIPT_CMD_SUCCESS;
}
#include <custom/script.inc>
// declarations that were supposed to be exported from npc_chat.cpp
@@ -27883,6 +27983,11 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(autoloot,"??"),
BUILDIN_DEF(opentips, "i?"),
BUILDIN_DEF(setdialogalign, "i"),
BUILDIN_DEF(setdialogsize, "ii"),
BUILDIN_DEF(setdialogpos, "ii"),
BUILDIN_DEF(setdialogpospercent, "ii"),
#include <custom/script_def.inc>
{NULL,NULL,NULL},