- Updated setoption script command to receive a second (optional) argument flag. If the flag is 1, the option is added to what the player currently has; likewise using flag 2 removes only that option. No flag (or any other value) is the older behaviour of removing all other options and setting specificly what is passed.

- Updated script_commands information for setoption due to this change.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6538 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-05-09 21:09:53 +00:00
parent 20ebb32eb0
commit 73b98ea723
4 changed files with 34 additions and 12 deletions

View File

@ -4,6 +4,13 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/05/09
* Updated setoption script command to receive a second (optional) argument
flag. If the flag is 1, the option is added to what the player currently
has; likewise using flag 2 removes only that option. No flag (or any other
value) is the older behaviour of removing all other options and setting
specificly what is passed. [Skotlex]
* Updated script_commands information for setoption due to this change.
[Skotlex]
* Small fix in npc-created chat rooms to properly include the terminating 0
on the chat's event. [Skotlex]
* Fixed Fog of Wall's symmetry in respect to Misc attacks, they no longer

View File

@ -2654,7 +2654,7 @@ Note: Break won't work anymore, it has been commented out in src/map/script.c:
*checkoption(<option number>)
*checkoption1(<option number>)
*checkoption2(<option number>)
*setoption <option number>;
*setoption <option number>{,type};
The 'setoption' series of functions check for a so-called option that is set on
the invoking character. 'Options' are used to store status conditions and a lot
@ -2669,19 +2669,15 @@ Option numbers valid for the first version of this command are:
2 - Frozen.
3 - Stunned.
4 - Sleeping.
32 - Riding a Peco.
'setoption' will set options on the invoking character. There are no second and
third versions of this command, so you can only change the
petrified/frozen/stunned/sleeping/riding status in this manner.
6 - Petrifying (the state where you can still walk)
Option numbers valid for the second version of this command are:
1 - Poisoned.
2 - Cursed.
4 - Silenced.
8 - Blinded (Notice that unless you specfy variable night darkness in the
configuration, all characters will be 'blinded' during the night)
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:
@ -2697,10 +2693,14 @@ Option numbers valid for the third version of this command are:
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.
'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 list (cloak, cart, ruwach, etc). if flag is 1, the option will be added to what the character currently has; if 2, the option is removed; otherwise (or if omitted) the option is set to what is passed (that is, all other set option values are removed).
This is definitely not a complete list of available option flag numbers. Ask a
core developer for the full list.

View File

@ -537,7 +537,7 @@ struct {
{buildin_end,"end",""},
// {buildin_end,"break",""}, this might confuse advanced scripting support [Eoe]
{buildin_checkoption,"checkoption","i"},
{buildin_setoption,"setoption","i"},
{buildin_setoption,"setoption","i*"},
{buildin_setcart,"setcart",""},
{buildin_checkcart,"checkcart","*"}, //fixed by Lupus (added '*')
{buildin_setfalcon,"setfalcon",""},
@ -5079,10 +5079,26 @@ int buildin_setoption(struct script_state *st)
{
int type;
struct map_session_data *sd;
int flag=0;
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
if(st->end>st->start+3 )
flag=conv_num(st,&(st->stack->stack_data[st->start+3]) );
sd=script_rid2sd(st);
pc_setoption(sd,type);
if (!sd) return 0;
switch (flag) {
case 1: //Add option
pc_setoption(sd,sd->sc.option|type);
break;
case 2: //Remove option
pc_setoption(sd,sd->sc.option&~type);
break;
default: //Set option
pc_setoption(sd,type);
break;
}
return 0;
}

View File

@ -419,7 +419,6 @@ enum {
#define OPT2_POISON 0x001
#define OPT2_CURSE 0x002
#define OPT2_SILENCE 0x004
//0x008 Odd howl sound, Signum crucis?
#define OPT2_SIGNUMCRUCIS 0x008
#define OPT2_BLIND 0x010
//0x020 - nothing