- Changes to script buildin functions:
* functions checking if a player is attached as soon as possible. * functions that required a player attached and would crash if none was there terminate the script now. (others keep the current behaviour to maintain full backward compatibility) * removed the unused flag argument in guildskill. * bonus,bonus2,bonus3,bonus4 use the same function now (remains the same script-wise) * added an optional parameter to setcart,setfalcon,setriding so it's possible to remove the cart/falcon/mount or select a specific cart * other cleanups git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9636 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
e8303f77cc
commit
4b78fc3c9f
@ -3,6 +3,18 @@ Date Added
|
|||||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
|
|
||||||
|
2007/01/09
|
||||||
|
* Changes to script buildin functions: [FlavioJS]
|
||||||
|
- functions checking if a player is attached as soon as possible.
|
||||||
|
- functions that required a player attached and would crash if none was
|
||||||
|
there terminate the script now. (others keep the current behaviour to
|
||||||
|
maintain full backward compatibility)
|
||||||
|
- removed the unused flag argument in guildskill.
|
||||||
|
- bonus,bonus2,bonus3,bonus4 use the same function now (remains the same
|
||||||
|
script-wise)
|
||||||
|
- added an optional parameter to setcart,setfalcon,setriding so it's
|
||||||
|
possible to remove the cart/falcon/mount or select a specific cart
|
||||||
|
- other cleanups
|
||||||
2007/01/08
|
2007/01/08
|
||||||
* Hotfix: Freeing of freed pointer when replacing script functions. [Lance]
|
* Hotfix: Freeing of freed pointer when replacing script functions. [Lance]
|
||||||
* Unimportant cleanups
|
* Unimportant cleanups
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
//= Maeki Rika - A section on general concepts and lots of
|
//= Maeki Rika - A section on general concepts and lots of
|
||||||
//= other updates and additions.
|
//= other updates and additions.
|
||||||
//===== Version ===========================================
|
//===== Version ===========================================
|
||||||
//= 2.10.20070101
|
//= 2.11.20070109
|
||||||
//=========================================================
|
//=========================================================
|
||||||
//= 1.0 - First release, filled will as much info as I could
|
//= 1.0 - First release, filled will as much info as I could
|
||||||
//= remember or figure out, most likely there are errors,
|
//= remember or figure out, most likely there are errors,
|
||||||
@ -40,6 +40,9 @@
|
|||||||
//= 2.9.20061230 - Updated getitem and guardian. [FlavioJS]
|
//= 2.9.20061230 - Updated getitem and guardian. [FlavioJS]
|
||||||
//= 2.10.20070101 - added sleep,sleep2,awake and updated the variables section.
|
//= 2.10.20070101 - added sleep,sleep2,awake and updated the variables section.
|
||||||
//= [FlavioJS]
|
//= [FlavioJS]
|
||||||
|
//= 2.11.20070109 - removed the unused flag argument in guildskill, added an
|
||||||
|
//= optional argument to setcart,setfalcon,setriding and other cleanups
|
||||||
|
//= [FlavioJS]
|
||||||
//===== Compatible With ===================================
|
//===== Compatible With ===================================
|
||||||
//= LOL, can be used by anyone hopefully
|
//= LOL, can be used by anyone hopefully
|
||||||
//===== Description =======================================
|
//===== Description =======================================
|
||||||
@ -2578,10 +2581,10 @@ specified amount permanently. The amount can be negative. See 'statusup'.
|
|||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*bonus <bonus type>,<amount>;
|
*bonus <bonus type>,<val1>;
|
||||||
*bonus2 <bonus type>,<amount>;
|
*bonus2 <bonus type>,<val1>,<val2>;
|
||||||
*bonus3 <bonus type>,<amount>;
|
*bonus3 <bonus type>,<val1>,<val2>,<val3>;
|
||||||
*bonus4 <bonus type>,<amount>;
|
*bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
|
||||||
|
|
||||||
These commands are meant to be used in item scripts. They will probably work
|
These commands are meant to be used in item scripts. They will probably work
|
||||||
outside item scripts, but the bonus will not persist for long. They, as
|
outside item scripts, but the bonus will not persist for long. They, as
|
||||||
@ -2618,7 +2621,7 @@ previously, they will now at 0+the level given.
|
|||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*guildskill <skill id>,<level>{,<flag>}
|
*guildskill <skill id>,<level>
|
||||||
|
|
||||||
This command will bump up the specified guild skill by the specified number of
|
This command will bump up the specified guild skill by the specified number of
|
||||||
levels. This refers to the invoking character and will only work if the invoking
|
levels. This refers to the invoking character and will only work if the invoking
|
||||||
@ -2680,8 +2683,10 @@ Example 2:
|
|||||||
|
|
||||||
*getgdskilllv(<guild id>,<skill id>)
|
*getgdskilllv(<guild id>,<skill id>)
|
||||||
|
|
||||||
This function retirns the guild skills for the guild with a specified ID exactly
|
This function returns the level of the skill <skill id> of the guild <guild id>.
|
||||||
as 'getskilllv' does.
|
If the guild does not have that skill, 0 is returned.
|
||||||
|
If the guild does not exist, -1 is returned.
|
||||||
|
Refer to 'db/skill_db.txt' for the full list of skills. (GD_* are guild skills)
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -2712,7 +2717,6 @@ specially when talked to by GMs.
|
|||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*end;
|
*end;
|
||||||
*break;
|
|
||||||
|
|
||||||
This command will stop the execution for this particular script. The two
|
This command will stop the execution for this particular script. The two
|
||||||
versions are prefectly equivalent. It is the normal way to end a script which
|
versions are prefectly equivalent. It is the normal way to end a script which
|
||||||
@ -2742,16 +2746,12 @@ Without the use if 'end' it would travel through the labels until the end of the
|
|||||||
script. If you were lvl 10 or less, you would see all the speech lines, the use
|
script. If you were lvl 10 or less, you would see all the speech lines, the use
|
||||||
of 'end' stops this, and ends the script.
|
of 'end' stops this, and ends the script.
|
||||||
|
|
||||||
Note: Break won't work anymore, it has been commented out in src/map/script.c:
|
|
||||||
|
|
||||||
// {buildin_end,"break",""}, this might confuse advanced scripting support [Eoe]
|
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*checkoption(<option number>)
|
*checkoption(<option number>)
|
||||||
*checkoption1(<option number>)
|
*checkoption1(<option number>)
|
||||||
*checkoption2(<option number>)
|
*checkoption2(<option number>)
|
||||||
*setoption <option number>{,type};
|
*setoption <option number>{,<flag>};
|
||||||
|
|
||||||
The 'setoption' series of functions check for a so-called option that is set on
|
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
|
the invoking character. 'Options' are used to store status conditions and a lot
|
||||||
@ -2777,6 +2777,8 @@ Option numbers valid for the first (option) version of this command are:
|
|||||||
0x1000 - The character is wearing a wedding sprite.
|
0x1000 - The character is wearing a wedding sprite.
|
||||||
0x2000 - Ruwach is in effect.
|
0x2000 - Ruwach is in effect.
|
||||||
0x4000 - Chasewalk in effect.
|
0x4000 - Chasewalk in effect.
|
||||||
|
0x8000 - Flying or Xmas suit.
|
||||||
|
0x10000 - Sighttrasher.
|
||||||
|
|
||||||
Option numbers valid for the second version (opt1) of this command are:
|
Option numbers valid for the second version (opt1) of this command are:
|
||||||
|
|
||||||
@ -2788,11 +2790,12 @@ Option numbers valid for the second version (opt1) of this command are:
|
|||||||
|
|
||||||
Option numbers valid for the third version (opt2) of this command are:
|
Option numbers valid for the third version (opt2) of this command are:
|
||||||
|
|
||||||
1 - Poisoned.
|
0x1 - Poisoned.
|
||||||
2 - Cursed.
|
0x2 - Cursed.
|
||||||
4 - Silenced.
|
0x4 - Silenced.
|
||||||
8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
|
0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
|
||||||
16 - Blinded.
|
0x10 - Blinded.
|
||||||
|
0x80 - Deadly poisoned.
|
||||||
|
|
||||||
Option numbers (except for opt1) are bitmasks - you can add them up to check
|
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
|
for several states, but the functions will return true if at least one of them
|
||||||
@ -2808,12 +2811,14 @@ core developer (or read the source: src/map/status.h) for the full list.
|
|||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*setcart;
|
*setcart {<type>};
|
||||||
*checkcart()
|
*checkcart()
|
||||||
|
|
||||||
This command will give the invoking character a cart. The cart given will be
|
If <type> is 0 this command will remove the cart from the character.
|
||||||
cart number 1 and will work regardless of whether the character is a merchant
|
Otherwise it gives the invoking character a cart. The cart given will be
|
||||||
class or not.
|
cart number <type> and will work regardless of whether the character is a
|
||||||
|
merchant class or not.
|
||||||
|
Note: the character needs to have the skill MC_PUSHCART to gain a cart
|
||||||
|
|
||||||
The accompanying function will return 1 if the invoking character has a cart
|
The accompanying function will return 1 if the invoking character has a cart
|
||||||
(any kind of cart) and 0 if they don't.
|
(any kind of cart) and 0 if they don't.
|
||||||
@ -2822,12 +2827,14 @@ The accompanying function will return 1 if the invoking character has a cart
|
|||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*setfalcon;
|
*setfalcon {<flag>};
|
||||||
*checkfalcon()
|
*checkfalcon()
|
||||||
|
|
||||||
This command will give the invoking character a falcon. The falcon will be there
|
If <flag> is 0 this command will remove the falcon from the character.
|
||||||
|
Otherwise it gives the invoking character a falcon. The falcon will be there
|
||||||
regardless of whether the character is a hunter or not. It will (probably) not
|
regardless of whether the character is a hunter or not. It will (probably) not
|
||||||
have any useful effects for non-hunters though.
|
have any useful effects for non-hunters though.
|
||||||
|
Note: the character needs to have the skill HT_FALCON to gain a falcon
|
||||||
|
|
||||||
The accompanying function will return 1 if the invoking character has a falcon
|
The accompanying function will return 1 if the invoking character has a falcon
|
||||||
and 0 if they don't.
|
and 0 if they don't.
|
||||||
@ -2836,14 +2843,15 @@ and 0 if they don't.
|
|||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*setriding;
|
*setriding {<flag>};
|
||||||
*checkriding()
|
*checkriding()
|
||||||
|
|
||||||
This command will give the invoking character a PecoPeco (if they are a Knight
|
If <flag> is 0 this command will remove the mount from the character.
|
||||||
|
Otherwise it give the invoking character a PecoPeco (if they are a Knight
|
||||||
series class) or a GrandPeco (if they are a Crusader seriesclass). Unlike
|
series class) or a GrandPeco (if they are a Crusader seriesclass). Unlike
|
||||||
'setfalcon' and 'setcart' this will not work at all if they aren't of a class
|
'setfalcon' and 'setcart' this will not work at all if they aren't of a class
|
||||||
which can ride. This will work if the character doesn't have the riding skill,
|
which can ride.
|
||||||
however.
|
Note: the character needs to have the skill KN_RIDING to gain a mount
|
||||||
|
|
||||||
The accompanying function will return 1 if the invoking character is riding a
|
The accompanying function will return 1 if the invoking character is riding a
|
||||||
bird and 0 if they don't.
|
bird and 0 if they don't.
|
||||||
@ -2855,8 +2863,8 @@ bird and 0 if they don't.
|
|||||||
*savepoint "<map name>",<x>,<y>;
|
*savepoint "<map name>",<x>,<y>;
|
||||||
*save "<map name>",<x>,<y>;
|
*save "<map name>",<x>,<y>;
|
||||||
|
|
||||||
This command saves a point that the invoking character will return to upon
|
This command saves where the invoking character will return to upon
|
||||||
'return to save point' if dead or in some other cases. The two versions are
|
'return to save point', if dead or in some other cases. The two versions are
|
||||||
equivalent. Map name, X coordinate and Y coordinate should be perfectly obvious.
|
equivalent. Map name, X coordinate and Y coordinate should be perfectly obvious.
|
||||||
This ignores any and all map flags, and can make a character respawn where no
|
This ignores any and all map flags, and can make a character respawn where no
|
||||||
teleportation is otherwise possible.
|
teleportation is otherwise possible.
|
||||||
|
@ -1171,26 +1171,23 @@ int guild_getexp(struct map_session_data *sd,int exp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// スキルポイント割り振り
|
// スキルポイント割り振り
|
||||||
int guild_skillup(struct map_session_data *sd,int skill_num,int flag)
|
int guild_skillup(TBL_PC* sd, int skill_num)
|
||||||
{
|
{
|
||||||
struct guild *g;
|
struct guild* g;
|
||||||
int idx = skill_num - GD_SKILLBASE;
|
int idx = skill_num - GD_SKILLBASE;
|
||||||
|
|
||||||
nullpo_retr(0, sd);
|
nullpo_retr(0, sd);
|
||||||
|
|
||||||
if(idx < 0 || idx >= MAX_GUILDSKILL)
|
if( idx < 0 || idx >= MAX_GUILDSKILL || // not a guild skill
|
||||||
|
sd->status.guild_id == 0 || (g=guild_search(sd->status.guild_id)) == NULL || // no guild
|
||||||
return 0;
|
strcmp(sd->status.name, g->master) ) // not the guild master
|
||||||
if(sd->status.guild_id==0 || (g=guild_search(sd->status.guild_id))==NULL)
|
|
||||||
return 0;
|
|
||||||
if(strcmp(sd->status.name,g->master))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( (g->skill_point>0 || flag&1) &&
|
if( g->skill_point > 0 &&
|
||||||
g->skill[idx].id!=0 &&
|
g->skill[idx].id != 0 &&
|
||||||
g->skill[idx].lv < guild_skill_get_max(skill_num) ){
|
g->skill[idx].lv < guild_skill_get_max(skill_num) )
|
||||||
intif_guild_skillup(g->guild_id,skill_num,sd->status.account_id,flag);
|
intif_guild_skillup(g->guild_id, skill_num, sd->status.account_id);
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// スキルポイント割り振り通知
|
// スキルポイント割り振り通知
|
||||||
|
@ -48,7 +48,7 @@ int guild_member_leaved(int guild_id,int account_id,int char_id,int flag,
|
|||||||
const char *name,const char *mes);
|
const char *name,const char *mes);
|
||||||
int guild_expulsion(struct map_session_data *sd,int guild_id,
|
int guild_expulsion(struct map_session_data *sd,int guild_id,
|
||||||
int account_id,int char_id,const char *mes);
|
int account_id,int char_id,const char *mes);
|
||||||
int guild_skillup(struct map_session_data *sd,int skill_num,int flag);
|
int guild_skillup(struct map_session_data* sd, int skill_num);
|
||||||
void guild_block_skill(struct map_session_data *sd, int time);
|
void guild_block_skill(struct map_session_data *sd, int time);
|
||||||
int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd);
|
int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd);
|
||||||
int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag);
|
int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag);
|
||||||
|
@ -694,17 +694,16 @@ int intif_guild_position(int guild_id,int idx,struct guild_position *p)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// ギルドスキルアップ要求
|
// ギルドスキルアップ要求
|
||||||
int intif_guild_skillup(int guild_id,int skill_num,int account_id,int flag)
|
int intif_guild_skillup(int guild_id, int skill_num, int account_id)
|
||||||
{
|
{
|
||||||
if (CheckForCharServer())
|
if( CheckForCharServer() )
|
||||||
return 0;
|
return 0;
|
||||||
WFIFOHEAD(inter_fd,14);
|
WFIFOHEAD(inter_fd, 14);
|
||||||
WFIFOW(inter_fd, 0)=0x303c;
|
WFIFOW(inter_fd, 0) = 0x303c;
|
||||||
WFIFOL(inter_fd, 2)=guild_id;
|
WFIFOL(inter_fd, 2) = guild_id;
|
||||||
WFIFOL(inter_fd, 6)=skill_num;
|
WFIFOL(inter_fd, 6) = skill_num;
|
||||||
WFIFOL(inter_fd,10)=account_id;
|
WFIFOL(inter_fd, 10) = account_id;
|
||||||
//WFIFOL(inter_fd,14)=flag;
|
WFIFOSET(inter_fd, 14);
|
||||||
WFIFOSET(inter_fd,14);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// ギルド同盟/敵対要求
|
// ギルド同盟/敵対要求
|
||||||
|
@ -46,7 +46,7 @@ int intif_guild_change_gm(int guild_id, const char* name, int len);
|
|||||||
int intif_guild_change_basicinfo(int guild_id, int type, const void *data, int len);
|
int intif_guild_change_basicinfo(int guild_id, int type, const void *data, int len);
|
||||||
int intif_guild_change_memberinfo(int guild_id, int account_id, int char_id, int type, const void *data, int len);
|
int intif_guild_change_memberinfo(int guild_id, int account_id, int char_id, int type, const void *data, int len);
|
||||||
int intif_guild_position(int guild_id, int idx, struct guild_position *p);
|
int intif_guild_position(int guild_id, int idx, struct guild_position *p);
|
||||||
int intif_guild_skillup(int guild_id, int skill_num, int account_id, int flag);
|
int intif_guild_skillup(int guild_id, int skill_num, int account_id);
|
||||||
int intif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag);
|
int intif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag);
|
||||||
int intif_guild_notice(int guild_id, const char *mes1, const char *mes2);
|
int intif_guild_notice(int guild_id, const char *mes1, const char *mes2);
|
||||||
int intif_guild_emblem(int guild_id, int len, const char *data);
|
int intif_guild_emblem(int guild_id, int len, const char *data);
|
||||||
|
@ -1153,7 +1153,7 @@ struct flooritem_data {
|
|||||||
struct item item_data;
|
struct item item_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum _sp {
|
||||||
SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP, // 0-7
|
SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP, // 0-7
|
||||||
SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT, // 8-15
|
SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT, // 8-15
|
||||||
SP_INT,SP_DEX,SP_LUK,SP_CLASS,SP_ZENY,SP_SEX,SP_NEXTBASEEXP,SP_NEXTJOBEXP, // 16-23
|
SP_INT,SP_DEX,SP_LUK,SP_CLASS,SP_ZENY,SP_SEX,SP_NEXTBASEEXP,SP_NEXTJOBEXP, // 16-23
|
||||||
@ -1210,8 +1210,17 @@ enum {
|
|||||||
//are available!
|
//are available!
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum _look {
|
||||||
LOOK_BASE,LOOK_HAIR,LOOK_WEAPON,LOOK_HEAD_BOTTOM,LOOK_HEAD_TOP,LOOK_HEAD_MID,LOOK_HAIR_COLOR,LOOK_CLOTHES_COLOR,LOOK_SHIELD,LOOK_SHOES
|
LOOK_BASE,
|
||||||
|
LOOK_HAIR,
|
||||||
|
LOOK_WEAPON,
|
||||||
|
LOOK_HEAD_BOTTOM,
|
||||||
|
LOOK_HEAD_TOP,
|
||||||
|
LOOK_HEAD_MID,
|
||||||
|
LOOK_HAIR_COLOR,
|
||||||
|
LOOK_CLOTHES_COLOR,
|
||||||
|
LOOK_SHIELD,
|
||||||
|
LOOK_SHOES
|
||||||
};
|
};
|
||||||
|
|
||||||
// CELLs for non-permanent cell-based effects (Pneuma, Basilica, Npcs, etc)
|
// CELLs for non-permanent cell-based effects (Pneuma, Basilica, Npcs, etc)
|
||||||
|
65
src/map/pc.c
65
src/map/pc.c
@ -2402,47 +2402,47 @@ int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4
|
|||||||
* 2 - Like 1, except the level granted can stack with previously learned level.
|
* 2 - Like 1, except the level granted can stack with previously learned level.
|
||||||
*------------------------------------------
|
*------------------------------------------
|
||||||
*/
|
*/
|
||||||
int pc_skill(struct map_session_data *sd,int id,int level,int flag)
|
int pc_skill(TBL_PC* sd, int id, int level, int flag)
|
||||||
{
|
{
|
||||||
nullpo_retr(0, sd);
|
nullpo_retr(0, sd);
|
||||||
|
|
||||||
if(level>MAX_SKILL_LEVEL){
|
if( level > MAX_SKILL_LEVEL ){
|
||||||
if(battle_config.error_log)
|
if( battle_config.error_log )
|
||||||
ShowError("pc_skill: Skill level %d too high. Max lv supported is MAX_SKILL_LEVEL (%d)\n", level, MAX_SKILL_LEVEL);
|
ShowError("pc_skill: Skill level %d too high. Max lv supported is MAX_SKILL_LEVEL (%d)\n", level, MAX_SKILL_LEVEL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (flag) {
|
switch( flag ){
|
||||||
case 0: //Set skill data overwriting whatever was there before.
|
case 0: //Set skill data overwriting whatever was there before.
|
||||||
sd->status.skill[id].id=id;
|
sd->status.skill[id].id = id;
|
||||||
sd->status.skill[id].lv=level;
|
sd->status.skill[id].lv = level;
|
||||||
sd->status.skill[id].flag=0;
|
sd->status.skill[id].flag = 0;
|
||||||
if (!level) //Remove skill.
|
if( !level ) //Remove skill.
|
||||||
sd->status.skill[id].id = 0;
|
sd->status.skill[id].id = 0;
|
||||||
if (!skill_get_inf(id)) //Only recalculate for passive skills.
|
if( !skill_get_inf(id) ) //Only recalculate for passive skills.
|
||||||
status_calc_pc(sd,0);
|
status_calc_pc(sd, 0);
|
||||||
clif_skillinfoblock(sd);
|
clif_skillinfoblock(sd);
|
||||||
break;
|
break;
|
||||||
case 2: //Add skill bonus on top of what you had.
|
case 2: //Add skill bonus on top of what you had.
|
||||||
if (sd->status.skill[id].id==id) {
|
if( sd->status.skill[id].id == id ){
|
||||||
if (!sd->status.skill[id].flag)
|
if( !sd->status.skill[id].flag ) // Store previous level.
|
||||||
sd->status.skill[id].flag=sd->status.skill[id].lv+2; //Store previous level.
|
sd->status.skill[id].flag = sd->status.skill[id].lv + 2;
|
||||||
} else {
|
} else {
|
||||||
sd->status.skill[id].id=id;
|
sd->status.skill[id].id = id;
|
||||||
sd->status.skill[id].flag=1; //Set that this is a bonus skill.
|
sd->status.skill[id].flag = 1; //Set that this is a bonus skill.
|
||||||
}
|
}
|
||||||
sd->status.skill[id].lv+=level;
|
sd->status.skill[id].lv += level;
|
||||||
break;
|
break;
|
||||||
case 1: //Item bonus skill.
|
case 1: //Item bonus skill.
|
||||||
if(sd->status.skill[id].lv >= level)
|
if( sd->status.skill[id].lv >= level )
|
||||||
return 0;
|
return 0;
|
||||||
if(sd->status.skill[id].id==id) {
|
if( sd->status.skill[id].id == id ){
|
||||||
if (!sd->status.skill[id].flag) //Non-granted skill, store it's level.
|
if( !sd->status.skill[id].flag ) //Non-granted skill, store it's level.
|
||||||
sd->status.skill[id].flag=sd->status.skill[id].lv+2;
|
sd->status.skill[id].flag = sd->status.skill[id].lv + 2;
|
||||||
} else {
|
} else {
|
||||||
sd->status.skill[id].id=id;
|
sd->status.skill[id].id = id;
|
||||||
sd->status.skill[id].flag=1;
|
sd->status.skill[id].flag = 1;
|
||||||
}
|
}
|
||||||
sd->status.skill[id].lv=level;
|
sd->status.skill[id].lv = level;
|
||||||
break;
|
break;
|
||||||
default: //Unknown flag?
|
default: //Unknown flag?
|
||||||
return 0;
|
return 0;
|
||||||
@ -4467,7 +4467,7 @@ int pc_skillup(struct map_session_data *sd,int skill_num)
|
|||||||
nullpo_retr(0, sd);
|
nullpo_retr(0, sd);
|
||||||
|
|
||||||
if(skill_num >= GD_SKILLBASE){
|
if(skill_num >= GD_SKILLBASE){
|
||||||
guild_skillup(sd,skill_num,0);
|
guild_skillup(sd, skill_num);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5790,10 +5790,13 @@ int pc_setcart(struct map_session_data *sd,int type)
|
|||||||
* ‘é<EFBFBD>Ý’è
|
* ‘é<EFBFBD>Ý’è
|
||||||
*------------------------------------------
|
*------------------------------------------
|
||||||
*/
|
*/
|
||||||
int pc_setfalcon(struct map_session_data *sd)
|
int pc_setfalcon(TBL_PC* sd, int flag)
|
||||||
{
|
{
|
||||||
if(pc_checkskill(sd,HT_FALCON)>0){ // ファルコンマスタリ?スキル所持
|
if( flag ){
|
||||||
|
if( pc_checkskill(sd,HT_FALCON)>0 ) // ファルコンマスタリ?スキル所持
|
||||||
pc_setoption(sd,sd->sc.option|OPTION_FALCON);
|
pc_setoption(sd,sd->sc.option|OPTION_FALCON);
|
||||||
|
} else if( pc_isfalcon(sd) ){
|
||||||
|
pc_setoption(sd,sd->sc.option&~OPTION_FALCON); // remove falcon
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -5803,11 +5806,15 @@ int pc_setfalcon(struct map_session_data *sd)
|
|||||||
* ƒyƒRƒyƒR<EFBFBD>Ý’è
|
* ƒyƒRƒyƒR<EFBFBD>Ý’è
|
||||||
*------------------------------------------
|
*------------------------------------------
|
||||||
*/
|
*/
|
||||||
int pc_setriding(struct map_session_data *sd)
|
int pc_setriding(TBL_PC* sd, int flag)
|
||||||
{
|
{
|
||||||
if((pc_checkskill(sd,KN_RIDING)>0)){ // ライディングスキル所持
|
if( flag ){
|
||||||
pc_setoption(sd,sd->sc.option|OPTION_RIDING);
|
if( pc_checkskill(sd,KN_RIDING) > 0 ) // ライディングスキル所持
|
||||||
|
pc_setoption(sd, sd->sc.option|OPTION_RIDING);
|
||||||
|
} else if( pc_isriding(sd) ){
|
||||||
|
pc_setoption(sd, sd->sc.option&~OPTION_RIDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ int pc_bonus(struct map_session_data*,int,int);
|
|||||||
int pc_bonus2(struct map_session_data *sd,int,int,int);
|
int pc_bonus2(struct map_session_data *sd,int,int,int);
|
||||||
int pc_bonus3(struct map_session_data *sd,int,int,int,int);
|
int pc_bonus3(struct map_session_data *sd,int,int,int,int);
|
||||||
int pc_bonus4(struct map_session_data *sd,int,int,int,int,int);
|
int pc_bonus4(struct map_session_data *sd,int,int,int,int,int);
|
||||||
int pc_skill(struct map_session_data*,int,int,int);
|
int pc_skill(struct map_session_data* sd, int id, int level, int flag);
|
||||||
|
|
||||||
int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip);
|
int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip);
|
||||||
|
|
||||||
@ -208,9 +208,9 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp);
|
|||||||
int pc_percentheal(struct map_session_data *sd,int,int);
|
int pc_percentheal(struct map_session_data *sd,int,int);
|
||||||
int pc_jobchange(struct map_session_data *,int, int);
|
int pc_jobchange(struct map_session_data *,int, int);
|
||||||
int pc_setoption(struct map_session_data *,int);
|
int pc_setoption(struct map_session_data *,int);
|
||||||
int pc_setcart(struct map_session_data *sd,int type);
|
int pc_setcart(struct map_session_data* sd, int type);
|
||||||
int pc_setfalcon(struct map_session_data *sd);
|
int pc_setfalcon(struct map_session_data* sd, int flag);
|
||||||
int pc_setriding(struct map_session_data *sd);
|
int pc_setriding(struct map_session_data* sd, int flag);
|
||||||
int pc_changelook(struct map_session_data *,int,int);
|
int pc_changelook(struct map_session_data *,int,int);
|
||||||
int pc_equiplookall(struct map_session_data *sd);
|
int pc_equiplookall(struct map_session_data *sd);
|
||||||
|
|
||||||
|
685
src/map/script.c
685
src/map/script.c
@ -59,6 +59,9 @@
|
|||||||
#define script_getdata(st,i) &((st)->stack->stack_data[(st)->start+(i)])
|
#define script_getdata(st,i) &((st)->stack->stack_data[(st)->start+(i)])
|
||||||
/// Returns if the stack contains data at the target index
|
/// Returns if the stack contains data at the target index
|
||||||
#define script_hasdata(st,i) ( (st)->end > (st)->start + (i) )
|
#define script_hasdata(st,i) ( (st)->end > (st)->start + (i) )
|
||||||
|
/// Returns the index of the last data in the stack
|
||||||
|
#define script_lastdata(st) ( (st)->end - (st)->start + 1 )
|
||||||
|
#define script_pushint(st,val) push_val((st)->stack, C_INT, (val))
|
||||||
#define script_isstring(data) ( (data)->type == C_STR || (data)->type == C_CONSTSTR )
|
#define script_isstring(data) ( (data)->type == C_STR || (data)->type == C_CONSTSTR )
|
||||||
#define script_isint(data) ( (data)->type == C_INT )
|
#define script_isint(data) ( (data)->type == C_INT )
|
||||||
|
|
||||||
@ -1852,6 +1855,8 @@ struct map_session_data *script_rid2sd(struct script_state *st)
|
|||||||
if(!sd){
|
if(!sd){
|
||||||
ShowError("script_rid2sd: fatal error ! player not attached!\n");
|
ShowError("script_rid2sd: fatal error ! player not attached!\n");
|
||||||
report_src(st);
|
report_src(st);
|
||||||
|
//## I would also terminate script execution. [FlavioJS]
|
||||||
|
//st->state = END;
|
||||||
}
|
}
|
||||||
return sd;
|
return sd;
|
||||||
}
|
}
|
||||||
@ -3866,26 +3871,26 @@ struct script_function buildin_func[] = {
|
|||||||
{buildin_statusup,"statusup","i"},
|
{buildin_statusup,"statusup","i"},
|
||||||
{buildin_statusup2,"statusup2","ii"},
|
{buildin_statusup2,"statusup2","ii"},
|
||||||
{buildin_bonus,"bonus","ii"},
|
{buildin_bonus,"bonus","ii"},
|
||||||
{buildin_bonus2,"bonus2","iii"},
|
{buildin_bonus,"bonus2","iii"},
|
||||||
{buildin_bonus3,"bonus3","iiii"},
|
{buildin_bonus,"bonus3","iiii"},
|
||||||
{buildin_bonus4,"bonus4","iiiii"},
|
{buildin_bonus,"bonus4","iiiii"},
|
||||||
{buildin_skill,"skill","ii*"},
|
{buildin_skill,"skill","ii?"},
|
||||||
{buildin_addtoskill,"addtoskill","ii*"}, // [Valaris]
|
{buildin_addtoskill,"addtoskill","ii?"}, // [Valaris]
|
||||||
{buildin_guildskill,"guildskill","ii"},
|
{buildin_guildskill,"guildskill","ii"},
|
||||||
{buildin_getskilllv,"getskilllv","i"},
|
{buildin_getskilllv,"getskilllv","i"},
|
||||||
{buildin_getgdskilllv,"getgdskilllv","ii"},
|
{buildin_getgdskilllv,"getgdskilllv","ii"},
|
||||||
{buildin_basicskillcheck,"basicskillcheck","*"},
|
{buildin_basicskillcheck,"basicskillcheck",""},
|
||||||
{buildin_getgmlevel,"getgmlevel","*"},
|
{buildin_getgmlevel,"getgmlevel",""},
|
||||||
{buildin_end,"end",""},
|
{buildin_end,"end",""},
|
||||||
// {buildin_end,"break",""}, this might confuse advanced scripting support [Eoe]
|
// {buildin_end,"break",""}, this might confuse advanced scripting support [Eoe]
|
||||||
{buildin_checkoption,"checkoption","i"},
|
{buildin_checkoption,"checkoption","i"},
|
||||||
{buildin_setoption,"setoption","i*"},
|
{buildin_setoption,"setoption","i?"},
|
||||||
{buildin_setcart,"setcart",""},
|
{buildin_setcart,"setcart","?"},
|
||||||
{buildin_checkcart,"checkcart","*"}, //fixed by Lupus (added '*')
|
{buildin_checkcart,"checkcart",""},
|
||||||
{buildin_setfalcon,"setfalcon",""},
|
{buildin_setfalcon,"setfalcon","?"},
|
||||||
{buildin_checkfalcon,"checkfalcon","*"}, //fixed by Lupus (fixed wrong pointer, added '*')
|
{buildin_checkfalcon,"checkfalcon",""},
|
||||||
{buildin_setriding,"setriding",""},
|
{buildin_setriding,"setriding","?"},
|
||||||
{buildin_checkriding,"checkriding","*"}, //fixed by Lupus (fixed wrong pointer, added '*')
|
{buildin_checkriding,"checkriding",""},
|
||||||
{buildin_savepoint,"save","sii"},
|
{buildin_savepoint,"save","sii"},
|
||||||
{buildin_savepoint,"savepoint","sii"},
|
{buildin_savepoint,"savepoint","sii"},
|
||||||
{buildin_gettimetick,"gettimetick","i"},
|
{buildin_gettimetick,"gettimetick","i"},
|
||||||
@ -6483,408 +6488,436 @@ int buildin_statusup2(struct script_state *st)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*==========================================
|
|
||||||
* 装備品による能力値ボーナス
|
/// See 'doc/item_bonus.txt'
|
||||||
*------------------------------------------
|
/// bonus <bonus type>,<val1>
|
||||||
*/
|
/// bonus2 <bonus type>,<val1>,<val2>
|
||||||
int buildin_bonus(struct script_state *st)
|
/// bonus3 <bonus type>,<val1>,<val2>,<val3>
|
||||||
|
/// bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>
|
||||||
|
int buildin_bonus(struct script_state* st)
|
||||||
{
|
{
|
||||||
int type,val;
|
int type;
|
||||||
struct map_session_data *sd;
|
int type2;
|
||||||
|
int type3;
|
||||||
|
int type4;
|
||||||
|
int val;
|
||||||
|
TBL_PC* sd;
|
||||||
|
|
||||||
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
sd = script_rid2sd(st);
|
||||||
val=conv_num(st,& (st->stack->stack_data[st->start+3]));
|
if( sd == NULL )
|
||||||
sd=script_rid2sd(st);
|
return 0; // no player attached
|
||||||
pc_bonus(sd,type,val);
|
|
||||||
|
|
||||||
return 0;
|
type = conv_num(st, script_getdata(st,2));
|
||||||
}
|
switch( script_lastdata(st) ){
|
||||||
/*==========================================
|
case 3:
|
||||||
* 装備品による能力値ボーナス
|
val = conv_num(st, script_getdata(st,3));
|
||||||
*------------------------------------------
|
pc_bonus(sd, type, val);
|
||||||
*/
|
break;
|
||||||
int buildin_bonus2(struct script_state *st)
|
case 4:
|
||||||
{
|
type2 = conv_num(st, script_getdata(st,3));
|
||||||
int type,type2,val;
|
val = conv_num(st, script_getdata(st,4));
|
||||||
struct map_session_data *sd;
|
pc_bonus2(sd, type, type2, val);
|
||||||
|
break;
|
||||||
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
case 5:
|
||||||
type2=conv_num(st,& (st->stack->stack_data[st->start+3]));
|
type2 = conv_num(st, script_getdata(st,3));
|
||||||
val=conv_num(st,& (st->stack->stack_data[st->start+4]));
|
type3 = conv_num(st, script_getdata(st,4));
|
||||||
sd=script_rid2sd(st);
|
val = conv_num(st, script_getdata(st,5));
|
||||||
pc_bonus2(sd,type,type2,val);
|
pc_bonus3(sd, type, type2, type3, val);
|
||||||
|
break;
|
||||||
return 0;
|
case 6:
|
||||||
}
|
type2 = conv_num(st, script_getdata(st,3));
|
||||||
/*==========================================
|
type3 = conv_num(st, script_getdata(st,4));
|
||||||
* 装備品による能力値ボーナス
|
type4 = conv_num(st, script_getdata(st,5));
|
||||||
*------------------------------------------
|
val = conv_num(st, script_getdata(st,6));
|
||||||
*/
|
pc_bonus4(sd, type, type2, type3, type4, val);
|
||||||
int buildin_bonus3(struct script_state *st)
|
break;
|
||||||
{
|
default:
|
||||||
int type,type2,type3,val;
|
ShowDebug("buildin_bonus: unexpected last data (%d)\n", script_lastdata(st));
|
||||||
struct map_session_data *sd;
|
}
|
||||||
|
|
||||||
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
|
||||||
type2=conv_num(st,& (st->stack->stack_data[st->start+3]));
|
|
||||||
type3=conv_num(st,& (st->stack->stack_data[st->start+4]));
|
|
||||||
val=conv_num(st,& (st->stack->stack_data[st->start+5]));
|
|
||||||
sd=script_rid2sd(st);
|
|
||||||
pc_bonus3(sd,type,type2,type3,val);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int buildin_bonus4(struct script_state *st)
|
/// Changes the level of a player skill.
|
||||||
|
/// skill <skill id>,<level>{,<flag>}
|
||||||
|
/// @see pc_skill() for flag
|
||||||
|
int buildin_skill(struct script_state* st)
|
||||||
{
|
{
|
||||||
int type,type2,type3,type4,val;
|
int id;
|
||||||
struct map_session_data *sd;
|
int level;
|
||||||
|
int flag = 1;
|
||||||
|
TBL_PC* sd;
|
||||||
|
|
||||||
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
sd = script_rid2sd(st);
|
||||||
type2=conv_num(st,& (st->stack->stack_data[st->start+3]));
|
if( sd == NULL )
|
||||||
type3=conv_num(st,& (st->stack->stack_data[st->start+4]));
|
return 0; // no player attached
|
||||||
type4=conv_num(st,& (st->stack->stack_data[st->start+5]));
|
|
||||||
val=conv_num(st,& (st->stack->stack_data[st->start+6]));
|
|
||||||
sd=script_rid2sd(st);
|
|
||||||
pc_bonus4(sd,type,type2,type3,type4,val);
|
|
||||||
|
|
||||||
return 0;
|
id = conv_num(st, script_getdata(st,2));
|
||||||
}
|
level = conv_num(st, script_getdata(st,3));
|
||||||
/*==========================================
|
if( script_hasdata(st,4) )
|
||||||
* スキル所得
|
flag = conv_num(st, script_getdata(st,4));
|
||||||
*------------------------------------------
|
pc_skill(sd, id, level, flag);
|
||||||
*/
|
|
||||||
int buildin_skill(struct script_state *st)
|
|
||||||
{
|
|
||||||
int id,level,flag=1;
|
|
||||||
struct map_session_data *sd;
|
|
||||||
|
|
||||||
id=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
|
||||||
level=conv_num(st,& (st->stack->stack_data[st->start+3]));
|
|
||||||
if( st->end>st->start+4 )
|
|
||||||
flag=conv_num(st,&(st->stack->stack_data[st->start+4]) );
|
|
||||||
sd=script_rid2sd(st);
|
|
||||||
pc_skill(sd,id,level,flag);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add x levels of skill (stackable) [Valaris]
|
/// Changes the level of a player skill.
|
||||||
int buildin_addtoskill(struct script_state *st)
|
/// addtoskill <skill id>,<level>{,<flag>}
|
||||||
|
/// @see pc_skill() for flag
|
||||||
|
int buildin_addtoskill(struct script_state* st)
|
||||||
{
|
{
|
||||||
int id,level,flag=2;
|
int id;
|
||||||
struct map_session_data *sd;
|
int level;
|
||||||
|
int flag = 2;
|
||||||
|
TBL_PC* sd;
|
||||||
|
|
||||||
id=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
sd = script_rid2sd(st);
|
||||||
level=conv_num(st,& (st->stack->stack_data[st->start+3]));
|
if( sd == NULL )
|
||||||
if( st->end>st->start+4 )
|
return 0; // no player attached
|
||||||
flag=conv_num(st,&(st->stack->stack_data[st->start+4]) );
|
|
||||||
sd=script_rid2sd(st);
|
id = conv_num(st, script_getdata(st,2));
|
||||||
pc_skill(sd,id,level,flag);
|
level = conv_num(st, script_getdata(st,3));
|
||||||
|
if( script_hasdata(st,4) )
|
||||||
|
flag = conv_num(st, script_getdata(st,4));
|
||||||
|
pc_skill(sd, id, level, flag);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/// Increases the level of the guild skill.
|
||||||
* ギルドスキル取得
|
/// guildskill <skill id>,<level>
|
||||||
*------------------------------------------
|
int buildin_guildskill(struct script_state* st)
|
||||||
*/
|
|
||||||
int buildin_guildskill(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
int id,level,flag=0;
|
int id;
|
||||||
struct map_session_data *sd;
|
int level;
|
||||||
int i=0;
|
TBL_PC* sd;
|
||||||
|
int i;
|
||||||
|
|
||||||
id=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
sd = script_rid2sd(st);
|
||||||
level=conv_num(st,& (st->stack->stack_data[st->start+3]));
|
if( sd == NULL )
|
||||||
if( st->end>st->start+4 )
|
return 0; // needs player attached
|
||||||
flag=conv_num(st,&(st->stack->stack_data[st->start+4]) );
|
|
||||||
sd=script_rid2sd(st);
|
id = conv_num(st, script_getdata(st,2));
|
||||||
for(i=0;i<level;i++)
|
level = conv_num(st, script_getdata(st,3));
|
||||||
guild_skillup(sd,id,flag);
|
for( i=0; i < level; i++ )
|
||||||
|
guild_skillup(sd, id);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*==========================================
|
|
||||||
* スキルレベル所得
|
/// Returns the level of the player skill.
|
||||||
*------------------------------------------
|
/// getskilllv(<skill id>) -> <level>
|
||||||
*/
|
int buildin_getskilllv(struct script_state* st)
|
||||||
int buildin_getskilllv(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
int id=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
int id;
|
||||||
push_val(st->stack,C_INT, pc_checkskill( script_rid2sd(st) ,id) );
|
TBL_PC* sd;
|
||||||
|
|
||||||
|
sd = script_rid2sd(st);
|
||||||
|
if( sd == NULL ){
|
||||||
|
script_pushint(st, 0);
|
||||||
|
return 0; // needs player attached
|
||||||
|
}
|
||||||
|
|
||||||
|
id = conv_num(st, script_getdata(st,2));
|
||||||
|
script_pushint(st, pc_checkskill(sd,id));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*==========================================
|
|
||||||
* getgdskilllv(Guild_ID, Skill_ID);
|
/// Returns the level of the guild skill.
|
||||||
* skill_id = 10000 : GD_APPROVAL
|
/// getgdskilllv(<guild id>,<skill id>) -> <level>
|
||||||
* 10001 : GD_KAFRACONTRACT
|
int buildin_getgdskilllv(struct script_state* st)
|
||||||
* 10002 : GD_GUARDIANRESEARCH
|
|
||||||
* 10003 : GD_GUARDUP
|
|
||||||
* 10004 : GD_EXTENSION
|
|
||||||
*------------------------------------------
|
|
||||||
*/
|
|
||||||
int buildin_getgdskilllv(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
int guild_id=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
int guild_id;
|
||||||
int skill_id=conv_num(st,& (st->stack->stack_data[st->start+3]));
|
int skill_id;
|
||||||
struct guild *g=guild_search(guild_id);
|
struct guild* g;
|
||||||
push_val(st->stack,C_INT, (g==NULL)?-1:guild_checkskill(g,skill_id) );
|
|
||||||
|
guild_id = conv_num(st, script_getdata(st,2));
|
||||||
|
skill_id = conv_num(st, script_getdata(st,3));
|
||||||
|
g = guild_search(guild_id);
|
||||||
|
if( g == NULL )
|
||||||
|
script_pushint(st, -1);
|
||||||
|
else
|
||||||
|
script_pushint(st, guild_checkskill(g,skill_id));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
/*
|
/*
|
||||||
struct map_session_data *sd=NULL;
|
|
||||||
struct guild *g=NULL;
|
|
||||||
int skill_id;
|
int skill_id;
|
||||||
|
TBL_PC* sd;
|
||||||
|
struct guild* g = NULL;
|
||||||
|
|
||||||
|
sd = script_rid2sd(st);
|
||||||
|
if( sd == NULL )
|
||||||
|
return 0; // needs player attached
|
||||||
|
|
||||||
|
skill_id = conv_num(st, script_getdata(st,2));
|
||||||
|
if( sd->status.guild_id > 0 )
|
||||||
|
g = guild_search(sd->status.guild_id);
|
||||||
|
if( g == NULL )
|
||||||
|
script_pushint(st, -1);
|
||||||
|
else
|
||||||
|
script_pushint(st, guild_checkskill(g,skill_id+9999));
|
||||||
|
|
||||||
skill_id=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
|
||||||
sd=script_rid2sd(st);
|
|
||||||
if(sd && sd->status.guild_id > 0) g=guild_search(sd->status.guild_id);
|
|
||||||
if(sd && g) {
|
|
||||||
push_val(st->stack,C_INT, guild_checkskill(g,skill_id+9999) );
|
|
||||||
} else {
|
|
||||||
push_val(st->stack,C_INT,-1);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
/*==========================================
|
|
||||||
*
|
/// Returns the 'basic_skill_check' setting.
|
||||||
*------------------------------------------
|
/// basicskillcheck() -> <setting>
|
||||||
*/
|
int buildin_basicskillcheck(struct script_state* st)
|
||||||
int buildin_basicskillcheck(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
push_val(st->stack,C_INT, battle_config.basic_skill_check);
|
script_pushint(st, battle_config.basic_skill_check);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/*==========================================
|
|
||||||
*
|
|
||||||
*------------------------------------------
|
|
||||||
*/
|
|
||||||
int buildin_getgmlevel(struct script_state *st)
|
|
||||||
{
|
|
||||||
push_val(st->stack,C_INT, pc_isGM(script_rid2sd(st)));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/// Returns the GM level of the player.
|
||||||
*
|
/// getgmlevel() -> <level>
|
||||||
*------------------------------------------
|
int buildin_getgmlevel(struct script_state* st)
|
||||||
*/
|
{
|
||||||
int buildin_end(struct script_state *st)
|
TBL_PC* sd;
|
||||||
|
|
||||||
|
sd = script_rid2sd(st);
|
||||||
|
if( sd == NULL ){
|
||||||
|
script_pushint(st, 0);
|
||||||
|
return 0; // needs player attached
|
||||||
|
}
|
||||||
|
|
||||||
|
script_pushint(st, pc_isGM(sd));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Terminates the execution of this script instance.
|
||||||
|
/// end
|
||||||
|
int buildin_end(struct script_state* st)
|
||||||
{
|
{
|
||||||
st->state = END;
|
st->state = END;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/// Checks if the player has that option.
|
||||||
*
|
/// checkoption(<option>) -> <bool>
|
||||||
*------------------------------------------
|
int buildin_checkoption(struct script_state* st)
|
||||||
*/
|
|
||||||
int buildin_checkoption(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
int type;
|
int option;
|
||||||
struct map_session_data *sd;
|
TBL_PC* sd;
|
||||||
|
|
||||||
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
sd = script_rid2sd(st);
|
||||||
sd=script_rid2sd(st);
|
if( sd == NULL )
|
||||||
|
return buildin_end(st);// needs player attached
|
||||||
|
|
||||||
if(sd->sc.option & type){
|
option = conv_num(st, script_getdata(st,2));
|
||||||
push_val(st->stack,C_INT,1);
|
if( sd->sc.option&option )
|
||||||
} else {
|
script_pushint(st, 1);
|
||||||
push_val(st->stack,C_INT,0);
|
else
|
||||||
}
|
script_pushint(st, 0);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/*==========================================
|
|
||||||
*
|
|
||||||
*------------------------------------------
|
|
||||||
*/
|
|
||||||
int buildin_checkoption1(struct script_state *st)
|
|
||||||
{
|
|
||||||
int type;
|
|
||||||
struct map_session_data *sd;
|
|
||||||
|
|
||||||
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
|
||||||
sd=script_rid2sd(st);
|
|
||||||
|
|
||||||
if(sd->sc.opt1 & type){
|
|
||||||
push_val(st->stack,C_INT,1);
|
|
||||||
} else {
|
|
||||||
push_val(st->stack,C_INT,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/*==========================================
|
|
||||||
*
|
|
||||||
*------------------------------------------
|
|
||||||
*/
|
|
||||||
int buildin_checkoption2(struct script_state *st)
|
|
||||||
{
|
|
||||||
int type;
|
|
||||||
struct map_session_data *sd;
|
|
||||||
|
|
||||||
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
|
||||||
sd=script_rid2sd(st);
|
|
||||||
|
|
||||||
if(sd->sc.opt2 & type){
|
|
||||||
push_val(st->stack,C_INT,1);
|
|
||||||
} else {
|
|
||||||
push_val(st->stack,C_INT,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/// Checks if the player is in that opt1 state.
|
||||||
*
|
/// checkoption1(<opt1>) -> <bool>
|
||||||
*------------------------------------------
|
int buildin_checkoption1(struct script_state* st)
|
||||||
*/
|
|
||||||
int buildin_setoption(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
int type;
|
int opt1;
|
||||||
struct map_session_data *sd;
|
TBL_PC* sd;
|
||||||
int flag=1;
|
|
||||||
|
|
||||||
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
|
sd = script_rid2sd(st);
|
||||||
if(st->end>st->start+3 )
|
if( sd == NULL )
|
||||||
flag=conv_num(st,&(st->stack->stack_data[st->start+3]) );
|
return buildin_end(st);// needs player attached
|
||||||
else if (!type) { //Request to remove everything.
|
|
||||||
|
opt1 = conv_num(st, script_getdata(st,2));
|
||||||
|
if( sd->sc.opt1 == opt1 )
|
||||||
|
script_pushint(st, 1);
|
||||||
|
else
|
||||||
|
script_pushint(st, 0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks if the player has that opt2.
|
||||||
|
/// checkoption2(<opt2>) -> <bool>
|
||||||
|
int buildin_checkoption2(struct script_state* st)
|
||||||
|
{
|
||||||
|
int opt2;
|
||||||
|
TBL_PC* sd;
|
||||||
|
|
||||||
|
sd = script_rid2sd(st);
|
||||||
|
if( sd == NULL )
|
||||||
|
return buildin_end(st);// needs player attached
|
||||||
|
|
||||||
|
opt2 = conv_num(st, script_getdata(st,2));
|
||||||
|
if( sd->sc.opt2&opt2 )
|
||||||
|
script_pushint(st, 1);
|
||||||
|
else
|
||||||
|
script_pushint(st, 0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Changes the option of the player.
|
||||||
|
/// setoption <option number>{,<flag>}
|
||||||
|
int buildin_setoption(struct script_state* st)
|
||||||
|
{
|
||||||
|
int option;
|
||||||
|
int flag = 1;
|
||||||
|
TBL_PC* sd;
|
||||||
|
|
||||||
|
sd = script_rid2sd(st);
|
||||||
|
if( sd == NULL )
|
||||||
|
return 0;// needs player attached
|
||||||
|
|
||||||
|
option = conv_num(st, script_getdata(st,2));
|
||||||
|
if( script_hasdata(st,3) )
|
||||||
|
flag = conv_num(st, script_getdata(st,3));
|
||||||
|
else if( !option ){// Request to remove everything.
|
||||||
flag = 0;
|
flag = 0;
|
||||||
type = OPTION_CART|OPTION_FALCON|OPTION_RIDING;
|
option = OPTION_CART|OPTION_FALCON|OPTION_RIDING;
|
||||||
}
|
}
|
||||||
sd=script_rid2sd(st);
|
if( flag ){// Add option
|
||||||
if (!sd) return 0;
|
if( option&OPTION_WEDDING && !battle_config.wedding_modifydisplay )
|
||||||
|
option &= ~OPTION_WEDDING;// Do not show the wedding sprites
|
||||||
if (flag) {//Add option
|
pc_setoption(sd, sd->sc.option|option);
|
||||||
if (type&OPTION_WEDDING && !battle_config.wedding_modifydisplay)
|
} else// Remove option
|
||||||
type&=~OPTION_WEDDING; //Do not show the wedding sprites
|
pc_setoption(sd, sd->sc.option&~option);
|
||||||
pc_setoption(sd,sd->sc.option|type);
|
|
||||||
} else//Remove option
|
|
||||||
pc_setoption(sd,sd->sc.option&~type);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*==========================================
|
|
||||||
* Checkcart [Valaris]
|
|
||||||
*------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
int buildin_checkcart(struct script_state *st)
|
|
||||||
{
|
|
||||||
struct map_session_data *sd;
|
|
||||||
|
|
||||||
sd=script_rid2sd(st);
|
|
||||||
|
|
||||||
if(pc_iscarton(sd)){
|
|
||||||
push_val(st->stack,C_INT,1);
|
|
||||||
} else {
|
|
||||||
push_val(st->stack,C_INT,0);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*==========================================
|
|
||||||
* カートを付ける
|
|
||||||
*------------------------------------------
|
|
||||||
*/
|
|
||||||
int buildin_setcart(struct script_state *st)
|
|
||||||
{
|
|
||||||
struct map_session_data *sd;
|
|
||||||
|
|
||||||
sd=script_rid2sd(st);
|
|
||||||
pc_setcart(sd,1);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/// Returns if the player has a cart.
|
||||||
* checkfalcon [Valaris]
|
/// checkcart() -> <bool>
|
||||||
*------------------------------------------
|
/// @author Valaris
|
||||||
*/
|
int buildin_checkcart(struct script_state* st)
|
||||||
|
|
||||||
int buildin_checkfalcon(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
struct map_session_data *sd;
|
TBL_PC* sd;
|
||||||
|
|
||||||
sd=script_rid2sd(st);
|
sd = script_rid2sd(st);
|
||||||
|
if( sd == NULL )
|
||||||
|
return buildin_end(st);// needs player attached
|
||||||
|
|
||||||
if(pc_isfalcon(sd)){
|
if( pc_iscarton(sd) )
|
||||||
push_val(st->stack,C_INT,1);
|
script_pushint(st, 1);
|
||||||
} else {
|
else
|
||||||
push_val(st->stack,C_INT,0);
|
script_pushint(st, 0);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the cart of the player.
|
||||||
/*==========================================
|
/// setcart {<type>}
|
||||||
* 鷹を付ける
|
int buildin_setcart(struct script_state* st)
|
||||||
*------------------------------------------
|
|
||||||
*/
|
|
||||||
int buildin_setfalcon(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
struct map_session_data *sd;
|
int type = 1;
|
||||||
|
TBL_PC* sd;
|
||||||
|
|
||||||
sd=script_rid2sd(st);
|
sd = script_rid2sd(st);
|
||||||
pc_setfalcon(sd);
|
if( sd == NULL )
|
||||||
|
return 0;// needs player attached
|
||||||
|
|
||||||
|
if( script_hasdata(st,2) )
|
||||||
|
type = conv_num(st, script_getdata(st,2));
|
||||||
|
pc_setcart(sd, type);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/// Returns if the player has a falcon.
|
||||||
* Checkcart [Valaris]
|
/// checkfalcon() -> <bool>
|
||||||
*------------------------------------------
|
/// @author Valaris
|
||||||
*/
|
int buildin_checkfalcon(struct script_state* st)
|
||||||
|
|
||||||
int buildin_checkriding(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
struct map_session_data *sd;
|
TBL_PC* sd;
|
||||||
|
|
||||||
sd=script_rid2sd(st);
|
sd = script_rid2sd(st);
|
||||||
|
if( sd == NULL )
|
||||||
|
return buildin_end(st);// needs player attached
|
||||||
|
|
||||||
if(pc_isriding(sd)){
|
if( pc_isfalcon(sd) )
|
||||||
push_val(st->stack,C_INT,1);
|
script_pushint(st, 1);
|
||||||
} else {
|
else
|
||||||
push_val(st->stack,C_INT,0);
|
script_pushint(st, 0);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets if the player has a falcon or not.
|
||||||
/*==========================================
|
/// setfalcon {<flag>}
|
||||||
* ペコペコ乗り
|
int buildin_setfalcon(struct script_state* st)
|
||||||
*------------------------------------------
|
|
||||||
*/
|
|
||||||
int buildin_setriding(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
struct map_session_data *sd;
|
int flag = 1;
|
||||||
|
TBL_PC* sd;
|
||||||
|
|
||||||
sd=script_rid2sd(st);
|
sd = script_rid2sd(st);
|
||||||
pc_setriding(sd);
|
if( sd == NULL )
|
||||||
|
return 0;// needs player attached
|
||||||
|
|
||||||
|
if( script_hasdata(st,2) )
|
||||||
|
flag = conv_num(st, script_getdata(st,2));
|
||||||
|
|
||||||
|
pc_setfalcon(sd, flag);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/// Returns if the player is riding.
|
||||||
* セーブポイントの保存
|
/// checkriding() -> <bool>
|
||||||
*------------------------------------------
|
/// @author Valaris
|
||||||
*/
|
int buildin_checkriding(struct script_state* st)
|
||||||
int buildin_savepoint(struct script_state *st)
|
|
||||||
{
|
{
|
||||||
int x,y;
|
TBL_PC* sd;
|
||||||
|
|
||||||
|
sd = script_rid2sd(st);
|
||||||
|
if( sd == NULL )
|
||||||
|
return buildin_end(st);// needs player attached
|
||||||
|
|
||||||
|
if( pc_isriding(sd) )
|
||||||
|
script_pushint(st, 1);
|
||||||
|
else
|
||||||
|
script_pushint(st, 0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Sets if the player is riding.
|
||||||
|
/// setriding {<flag>}
|
||||||
|
int buildin_setriding(struct script_state* st)
|
||||||
|
{
|
||||||
|
int flag = 1;
|
||||||
|
TBL_PC* sd;
|
||||||
|
|
||||||
|
sd = script_rid2sd(st);
|
||||||
|
if( sd == NULL )
|
||||||
|
return 0;// needs player attached
|
||||||
|
|
||||||
|
if( script_hasdata(st,2) )
|
||||||
|
flag = conv_num(st, script_getdata(st,2));
|
||||||
|
pc_setriding(sd, flag);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Sets the save point of the player.
|
||||||
|
/// save "<map name>",<x>,<y>
|
||||||
|
/// savepoint "<map name>",<x>,<y>
|
||||||
|
int buildin_savepoint(struct script_state* st)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
short map;
|
short map;
|
||||||
char *str;
|
char* str;
|
||||||
|
TBL_PC* sd;
|
||||||
|
|
||||||
str=conv_str(st,& (st->stack->stack_data[st->start+2]));
|
sd = script_rid2sd(st);
|
||||||
x=conv_num(st,& (st->stack->stack_data[st->start+3]));
|
if( sd == NULL )
|
||||||
y=conv_num(st,& (st->stack->stack_data[st->start+4]));
|
return 0;// needs player attached
|
||||||
|
|
||||||
|
str = conv_str(st, script_getdata(st,2));
|
||||||
|
x = conv_num(st, script_getdata(st,3));
|
||||||
|
y = conv_num(st, script_getdata(st,4));
|
||||||
map = mapindex_name2id(str);
|
map = mapindex_name2id(str);
|
||||||
if (map)
|
if( map )
|
||||||
pc_setsavepoint(script_rid2sd(st),map,x,y);
|
pc_setsavepoint(sd, map, x, y);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ enum {
|
|||||||
ST_RECOV_WEIGHT_RATE,ST_MOVE_ENABLE,ST_WATER,
|
ST_RECOV_WEIGHT_RATE,ST_MOVE_ENABLE,ST_WATER,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum _skill {
|
||||||
NV_BASIC = 1,
|
NV_BASIC = 1,
|
||||||
|
|
||||||
SM_SWORD,
|
SM_SWORD,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user