From ee199372025b686bd21cc72c1f3ae72c73c1726e Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 18 Sep 2006 14:43:04 +0000 Subject: [PATCH] - Reloading scripts will no longer eliminate mobs with no respawn data. Watch out for duplicating Treasure Boxes? - Some cleaning of npc_final - Made speed_add_rate a linearly stacking increase. - Corrected a possible overflow when using show_mob_info to display the mob's up as a percent. - Corrected the documentation for checkoption/checkoption1/checkoption2 git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8792 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 8 +++++++ doc/script_commands.txt | 47 ++++++++++++++++++++++------------------- src/map/clif.c | 6 +++++- src/map/npc.c | 20 ++++++------------ src/map/pc.c | 2 +- 5 files changed, 46 insertions(+), 37 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 9b8e96ed4e..f543a3f729 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,14 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/09/18 + * @reloadscript scripts will no longer eliminate mobs with no respawn data. + But watch out for possible bugs (I think someone mentioned 1 extra + treasure box will spawn when you use it? This needs testing!) [Skotlex] + * Made speed_add_rate a linearly stacking increase. [Skotlex] + * Corrected a possible overflow when using show_mob_info to display the + mob's up as a percent. [Skotlex] + * Corrected the documentation for checkoption/checkoption1/checkoption2 + [Skotlex] * Reenabled client requesting to self mute, as the whole knockback packet issues of the past which were causing players to mute themselves when being knockback is no longer there. [Skotlex] diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 48b5c591e3..31a10148d7 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -2731,7 +2731,25 @@ it is better to use 'checkcart','checkfalcon','checkpeco' and other similar functions, but there are some options which you cannot get at this way. They return 1 if the option is set and 0 if the option is not set. -Option numbers valid for the first version of this command are: +Option numbers valid for the first (option) version of this command are: + +0x1 - Sight in effect. +0x2 - Hide in effect. +0x4 - Cloaking in effect. +0x8 - Cart number 1 present. +0x10 - Falcon present. +0x20 - Peco Peco present. +0x40 - GM Perfect Hide in effect. +0x80 - Cart number 2 present. +0x100 - Cart number 3 present. +0x200 - Cart number 4 present. +0x400 - Cart number 5 present. +0x800 - Orc head present. +0x1000 - The character is wearing a wedding sprite. +0x2000 - Ruwach is in effect. +0x4000 - Chasewalk in effect. + +Option numbers valid for the second version (opt1) of this command are: 1 - Petrified. 2 - Frozen. @@ -2739,7 +2757,7 @@ Option numbers valid for the first version of this command are: 4 - Sleeping. 6 - Petrifying (the state where you can still walk) -Option numbers valid for the second version of this command are: +Option numbers valid for the third version (opt2) of this command are: 1 - Poisoned. 2 - Cursed. @@ -2747,32 +2765,17 @@ Option numbers valid for the second version of this command are: 8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed) 16 - Blinded. -Option numbers valid for the third version of this command are: - -1 - Sight in effect. -2 - Hide in effect. -4 - Cloaking in effect. -8 - Falcon present. -64 - GM Perfect Hide in effect. -128 - Cart number 2 present. -256 - Cart number 3 present. -512 - Cart number 4 present. -1024 - Cart number 5 present. -2048 - Orc head present. -4096 - The character is wearing a wedding sprite. -8192 - Ruwach is in effect. -16384 - Chasewalk in effect. - -Option numbers are bitmasks - add up option numbers to check for all of them -being present at the same time in one go. +Option numbers (except for opt1) are bitmasks - you can add them up to check + for several states, but the functions will return true if at least one of them + is in effect. 'setoption' will set options on the invoking character. There are no second and -third versions of this command, so you can only change the values in the last +third versions of this command, so you can only change the values in the first list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted), the option will be added to what the character currently has; if 0, the option is removed. This is definitely not a complete list of available option flag numbers. Ask a -core developer for the full list. +core developer (or read the source: src/map/status.h) for the full list. --------------------------------------- diff --git a/src/map/clif.c b/src/map/clif.c index 3c9e697acc..67c85504ce 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7861,7 +7861,11 @@ int clif_charnameack (int fd, struct block_list *bl) if (battle_config.show_mob_info&1) str_p += sprintf(str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp); if (battle_config.show_mob_info&2) - str_p += sprintf(str_p, "HP: %d%% | ", 100*md->status.hp/md->status.max_hp); + + str_p += sprintf(str_p, "HP: %d%% | ", + md->status.max_hp > 10000? + md->status.hp/(md->status.max_hp/100): + 100*md->status.hp/md->status.max_hp); //Even thought mobhp ain't a name, we send it as one so the client //can parse it. [Skotlex] if (str_p != mobhp) { diff --git a/src/map/npc.c b/src/map/npc.c index 8e1cfd336f..fc93207a8a 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2811,7 +2811,9 @@ static int npc_cleanup_sub (struct block_list *bl, va_list ap) { npc_unload((struct npc_data *)bl); break; case BL_MOB: - unit_free(bl,0); + //This is used only on reloading npcs, so let's not free spawn-once mobs. [Skotlex] + if (((TBL_MOB*)bl)->spawn) + unit_free(bl,0); break; } @@ -2903,21 +2905,13 @@ int do_final_npc(void) { int i; struct block_list *bl; - struct npc_data *nd; - struct mob_data *md; - struct pet_data *pd; for (i = START_NPC_NUM; i < npc_id; i++){ if ((bl = map_id2bl(i))){ - if (bl->type == BL_NPC && (nd = (struct npc_data *)bl)){ - npc_unload(nd); - } else if (bl->type == BL_MOB && (md = (struct mob_data *)bl)){ - if (md->lootitem) - aFree(md->lootitem); - aFree(md); - } else if (bl->type == BL_PET && (pd = (struct pet_data *)bl)){ - aFree(pd); - } + if (bl->type == BL_NPC) + npc_unload((struct npc_data *)bl); + else if (bl->type&(BL_MOB|BL_PET)) + unit_free(bl, 0); } } diff --git a/src/map/pc.c b/src/map/pc.c index bd02b1ec3c..740bd13b7f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1472,7 +1472,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_SPEED_ADDRATE: //Stackable increase if(sd->state.lr_flag != 2) - sd->speed_add_rate = sd->speed_add_rate * (100-val)/100; + sd->speed_add_rate -= val; break; case SP_ASPD: //Raw increase // if(sd->state.lr_flag != 2)