From ea7697ef7b2ef759d5fd612e919c029ea4a7fa05 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Apr 2019 23:00:18 +0300 Subject: Extend setinitdata and getunitdata with UDT_GROUP flag --- doc/script_commands.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 13deb97f8..2aec07f29 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10174,6 +10174,7 @@ Applicable Data Types (available as constants) - UDT_LIFETIME: LifeTime - for summons. UDT_MERC_KILLCOUNT: Kill count for mercenaries UDT_STATADD: Status Points - for NPCs. + UDT_GROUP: group id returns 0 if value could not be set, 1 if successful. @@ -10236,6 +10237,7 @@ Applicable Data types (available as constants) - UDT_INTIMACY: Intimacy Rate - for summons. UDT_LIFETIME: LifeTime - for summons. UDT_MERC_KILLCOUNT: Kill count for mercenaries. + UDT_GROUP: group id returns -1 if value could not be retrieved. -- cgit v1.2.3-70-g09d2 From 8d732e3127434e576fe4a1203e609a8c6cc19cee Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Apr 2019 23:55:29 +0300 Subject: Add commands getunittitle and setunittitle This commands get/set title for non players bl --- doc/script_commands.txt | 15 +++++++++++++++ src/map/script.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) (limited to 'doc') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 2aec07f29..cc49a9c0f 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10441,3 +10441,18 @@ This value always smaller or equal to MAX_INVENTORY. Size can be changed by group of functions expandInventory* --------------------------------------- + +*getunittitle() + +Return unit title string. +Works for 20180207 main clients, 20171129 re clients, 20171130 zero clients + +--------------------------------------- + +*setunittitle(, ) + +Set unit title string. +Invisible for players, because current implimentation using title id only. +Works for 20180207 main clients, 20171129 re clients, 20171130 zero clients + +--------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index ccbe50157..eaec5a10a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -20395,6 +20395,46 @@ static BUILDIN(setunitname) return true; } +static BUILDIN(setunittitle) +{ + struct block_list *bl = map->id2bl(script_getnum(st, 2)); + if (bl == NULL) { + ShowWarning("buildin_setunittitle: Error in finding object with given game ID %d!\n", script_getnum(st, 2)); + return false; + } + + struct unit_data *ud = unit->bl2ud2(bl); + if (ud == NULL) { + ShowWarning("buildin_setunittitle: Error in finding unit_data for given game ID %d!\n", script_getnum(st, 2)); + return false; + } + + safestrncpy(ud->title, script_getstr(st, 3), NAME_LENGTH); + clif->blname_ack(0, bl); // Send update to client. + + return true; +} + +static BUILDIN(getunittitle) +{ + struct block_list *bl = map->id2bl(script_getnum(st, 2)); + if (bl == NULL) { + ShowWarning("buildin_getunitname: Error in finding object with given game ID %d!\n", script_getnum(st, 2)); + script_pushconststr(st, "Unknown"); + return false; + } + + struct unit_data *ud = unit->bl2ud(bl); + if (ud == NULL) { + ShowWarning("buildin_setunittitle: Error in finding unit_data for given game ID %d!\n", script_getnum(st, 2)); + return false; + } + + script_pushstrcopy(st, ud->title); + + return true; +} + /// Makes the unit walk to target position or target id /// Returns if it was successfull /// @@ -25771,6 +25811,8 @@ static void script_parse_builtin(void) BUILDIN_DEF(getunitdata,"ii?"), BUILDIN_DEF(getunitname,"i"), BUILDIN_DEF(setunitname,"is"), + BUILDIN_DEF(getunittitle,"i"), + BUILDIN_DEF(setunittitle,"is"), BUILDIN_DEF(unitwalk,"ii?"), BUILDIN_DEF(unitkill,"i"), BUILDIN_DEF(unitwarp,"isii"), -- cgit v1.2.3-70-g09d2 From 884225977fed41c3ad24cbc0b446480de6fc3cd3 Mon Sep 17 00:00:00 2001 From: Andrei Karas <akaras@inbox.ru> Date: Thu, 25 Apr 2019 22:16:29 +0300 Subject: Add script function for close roulette window New script function: closeroulette() --- doc/script_commands.txt | 7 +++++++ src/map/script.c | 12 ++++++++++++ 2 files changed, 19 insertions(+) (limited to 'doc') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index cc49a9c0f..4d8053da0 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10456,3 +10456,10 @@ Invisible for players, because current implimentation using title id only. Works for 20180207 main clients, 20171129 re clients, 20171130 zero clients --------------------------------------- + +*closeroulette() + +Force close roulette window. +Works for 20141008 main clients, 20140903 re, any zero. + +--------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index 80489dfac..4fb24708b 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -25275,6 +25275,16 @@ static BUILDIN(getInventorySize) return true; } +// force close roulette window if it opened +static BUILDIN(closeroulette) +{ + struct map_session_data *sd = script_rid2sd(st); + if (sd == NULL) + return false; + clif->roulette_close(sd); + return true; +} + /** * Adds a built-in script function. * @@ -26026,6 +26036,8 @@ static void script_parse_builtin(void) BUILDIN_DEF(expandInventoryResult, "i"), BUILDIN_DEF(expandInventory, "i"), BUILDIN_DEF(getInventorySize, ""), + + BUILDIN_DEF(closeroulette, ""), }; int i, len = ARRAYLENGTH(BUILDIN); RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up -- cgit v1.2.3-70-g09d2