summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt12
-rw-r--r--doc/script_commands.txt110
-rw-r--r--src/common/socket.c2
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/guild.c23
-rw-r--r--src/map/guild.h2
-rw-r--r--src/map/intif.c17
-rw-r--r--src/map/intif.h2
-rw-r--r--src/map/itemdb.c12
-rw-r--r--src/map/map.h15
-rw-r--r--src/map/pc.c73
-rw-r--r--src/map/pc.h8
-rw-r--r--src/map/script.c627
-rw-r--r--src/map/skill.h2
-rw-r--r--src/map/status.c2
15 files changed, 487 insertions, 422 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 575d4c005..82691bf92 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,18 @@ Date Added
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.
+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
* Hotfix: Freeing of freed pointer when replacing script functions. [Lance]
* Unimportant cleanups
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index edbeada80..a1b7ea8a9 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -9,7 +9,7 @@
//= Maeki Rika - A section on general concepts and lots of
//= other updates and additions.
//===== Version ===========================================
-//= 2.10.20070101
+//= 2.11.20070109
//=========================================================
//= 1.0 - First release, filled will as much info as I could
//= remember or figure out, most likely there are errors,
@@ -40,6 +40,9 @@
//= 2.9.20061230 - Updated getitem and guardian. [FlavioJS]
//= 2.10.20070101 - added sleep,sleep2,awake and updated the variables section.
//= [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 ===================================
//= LOL, can be used by anyone hopefully
//===== Description =======================================
@@ -2578,10 +2581,10 @@ specified amount permanently. The amount can be negative. See 'statusup'.
---------------------------------------
-*bonus <bonus type>,<amount>;
-*bonus2 <bonus type>,<amount>;
-*bonus3 <bonus type>,<amount>;
-*bonus4 <bonus type>,<amount>;
+*bonus <bonus type>,<val1>;
+*bonus2 <bonus type>,<val1>,<val2>;
+*bonus3 <bonus type>,<val1>,<val2>,<val3>;
+*bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
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
@@ -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
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>)
-This function retirns the guild skills for the guild with a specified ID exactly
-as 'getskilllv' does.
+This function returns the level of the skill <skill id> of the guild <guild id>.
+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;
-*break;
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
@@ -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
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>)
*checkoption1(<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 invoking character. 'Options' are used to store status conditions and a lot
@@ -2762,37 +2762,40 @@ return 1 if the option is set and 0 if the option is not set.
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.
+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.
+0x8000 - Flying or Xmas suit.
+0x10000 - Sighttrasher.
Option numbers valid for the second version (opt1) of this command are:
-1 - Petrified.
-2 - Frozen.
-3 - Stunned.
-4 - Sleeping.
-6 - Petrifying (the state where you can still walk)
+1 - Petrified.
+2 - Frozen.
+3 - Stunned.
+4 - Sleeping.
+6 - Petrifying (the state where you can still walk)
Option numbers valid for the third version (opt2) of this command are:
-1 - Poisoned.
-2 - Cursed.
-4 - Silenced.
-8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
-16 - Blinded.
+0x1 - Poisoned.
+0x2 - Cursed.
+0x4 - Silenced.
+0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
+0x10 - Blinded.
+0x80 - Deadly poisoned.
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
@@ -2808,12 +2811,14 @@ core developer (or read the source: src/map/status.h) for the full list.
---------------------------------------
-*setcart;
+*setcart {<type>};
*checkcart()
-This command will give the invoking character a cart. The cart given will be
-cart number 1 and will work regardless of whether the character is a merchant
-class or not.
+If <type> is 0 this command will remove the cart from the character.
+Otherwise it gives the invoking character a cart. The cart given will be
+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
(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()
-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
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
and 0 if they don't.
@@ -2836,14 +2843,15 @@ and 0 if they don't.
---------------------------------------
-*setriding;
+*setriding {<flag>};
*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
'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,
-however.
+which can ride.
+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
bird and 0 if they don't.
@@ -2855,8 +2863,8 @@ bird and 0 if they don't.
*savepoint "<map name>",<x>,<y>;
*save "<map name>",<x>,<y>;
-This command saves a point that the invoking character will return to upon
-'return to save point' if dead or in some other cases. The two versions are
+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
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
teleportation is otherwise possible.
diff --git a/src/common/socket.c b/src/common/socket.c
index 6589978bb..c03240739 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -282,7 +282,7 @@ static int connect_client(int listen_fd)
ShowError("accept failed (code %i)!\n", s_errno);
return -1;
}
-
+
if(fd_max<=fd) fd_max=fd+1;
setsocketopts(fd);
diff --git a/src/map/clif.c b/src/map/clif.c
index 8aaab7dd9..2e40bf7da 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7898,7 +7898,7 @@ int clif_charnameupdate (struct map_session_data *ssd)
memcpy(WBUFP(buf,30), p->party.name, NAME_LENGTH);
else
WBUFB(buf,30) = 0;
-
+
if (g)
{
int i, ps = -1;
diff --git a/src/map/guild.c b/src/map/guild.c
index 49d5dd0db..b71b6344b 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -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;
nullpo_retr(0, sd);
- if(idx < 0 || idx >= MAX_GUILDSKILL)
-
- return 0;
- if(sd->status.guild_id==0 || (g=guild_search(sd->status.guild_id))==NULL)
- return 0;
- if(strcmp(sd->status.name,g->master))
+ 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
+ strcmp(sd->status.name, g->master) ) // not the guild master
return 0;
- if( (g->skill_point>0 || flag&1) &&
- g->skill[idx].id!=0 &&
- g->skill[idx].lv < guild_skill_get_max(skill_num) ){
- intif_guild_skillup(g->guild_id,skill_num,sd->status.account_id,flag);
- }
+ if( g->skill_point > 0 &&
+ g->skill[idx].id != 0 &&
+ g->skill[idx].lv < guild_skill_get_max(skill_num) )
+ intif_guild_skillup(g->guild_id, skill_num, sd->status.account_id);
+
return 0;
}
// スキルポイント割り振り通知
diff --git a/src/map/guild.h b/src/map/guild.h
index 7de747b8d..6171c72f2 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -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);
int guild_expulsion(struct map_session_data *sd,int guild_id,
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);
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);
diff --git a/src/map/intif.c b/src/map/intif.c
index 54c5bf73a..18a6cc81b 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -694,17 +694,16 @@ int intif_guild_position(int guild_id,int idx,struct guild_position *p)
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;
- WFIFOHEAD(inter_fd,14);
- WFIFOW(inter_fd, 0)=0x303c;
- WFIFOL(inter_fd, 2)=guild_id;
- WFIFOL(inter_fd, 6)=skill_num;
- WFIFOL(inter_fd,10)=account_id;
- //WFIFOL(inter_fd,14)=flag;
- WFIFOSET(inter_fd,14);
+ WFIFOHEAD(inter_fd, 14);
+ WFIFOW(inter_fd, 0) = 0x303c;
+ WFIFOL(inter_fd, 2) = guild_id;
+ WFIFOL(inter_fd, 6) = skill_num;
+ WFIFOL(inter_fd, 10) = account_id;
+ WFIFOSET(inter_fd, 14);
return 0;
}
// ギルド同盟/敵対要求
diff --git a/src/map/intif.h b/src/map/intif.h
index 8fc005508..86f09e30e 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -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_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_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_notice(int guild_id, const char *mes1, const char *mes2);
int intif_guild_emblem(int guild_id, int len, const char *data);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 2d4e9a3af..7d27f4fd0 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1141,7 +1141,7 @@ static int itemdb_readdb(void)
str[19] = p; //Script
np = strchr(p,'}');
-
+
while (np && np[1] && np[1] != ',')
np = strchr(np+1,'}'); //Jump close brackets until the next field is found.
if (!np || !np[1]) {
@@ -1152,13 +1152,13 @@ static int itemdb_readdb(void)
np[1] = '\0'; //Set end of script
id->script = parse_script(str[19],filename[i],lines,0);
np+=2; //Skip to next field
-
+
if(!np || (p=strchr(np,'{'))==NULL)
continue;
-
+
str[20] = p; //Equip Script
np = strchr(p,'}');
-
+
while (np && np[1] && np[1] != ',')
np = strchr(np+1,'}'); //Jump close brackets until the next field is found.
if (!np || !np[1]) {
@@ -1166,11 +1166,11 @@ static int itemdb_readdb(void)
id->equip_script = parse_script(str[20],filename[i],lines,0);
continue;
}
-
+
np[1] = '\0'; //Set end of script
id->equip_script = parse_script(str[20],filename[i],lines,0);
np+=2; //Skip comma, to next field
-
+
if(!np || (p=strchr(np,'{'))==NULL)
continue;
//Unequip script, last column.
diff --git a/src/map/map.h b/src/map/map.h
index 70b5df912..e78ea9dcd 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1153,7 +1153,7 @@ struct flooritem_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_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
@@ -1210,8 +1210,17 @@ enum {
//are available!
};
-enum {
- 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
+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
};
// CELLs for non-permanent cell-based effects (Pneuma, Basilica, Npcs, etc)
diff --git a/src/map/pc.c b/src/map/pc.c
index 656555136..a8f16af13 100644
--- a/src/map/pc.c
+++ b/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.
*------------------------------------------
*/
-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);
- if(level>MAX_SKILL_LEVEL){
- if(battle_config.error_log)
+ if( level > MAX_SKILL_LEVEL ){
+ 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);
return 0;
}
- switch (flag) {
+ switch( flag ){
case 0: //Set skill data overwriting whatever was there before.
- sd->status.skill[id].id=id;
- sd->status.skill[id].lv=level;
- sd->status.skill[id].flag=0;
- if (!level) //Remove skill.
+ sd->status.skill[id].id = id;
+ sd->status.skill[id].lv = level;
+ sd->status.skill[id].flag = 0;
+ if( !level ) //Remove skill.
sd->status.skill[id].id = 0;
- if (!skill_get_inf(id)) //Only recalculate for passive skills.
- status_calc_pc(sd,0);
+ if( !skill_get_inf(id) ) //Only recalculate for passive skills.
+ status_calc_pc(sd, 0);
clif_skillinfoblock(sd);
break;
case 2: //Add skill bonus on top of what you had.
- if (sd->status.skill[id].id==id) {
- if (!sd->status.skill[id].flag)
- sd->status.skill[id].flag=sd->status.skill[id].lv+2; //Store previous level.
+ if( sd->status.skill[id].id == id ){
+ if( !sd->status.skill[id].flag ) // Store previous level.
+ sd->status.skill[id].flag = sd->status.skill[id].lv + 2;
} else {
- sd->status.skill[id].id=id;
- sd->status.skill[id].flag=1; //Set that this is a bonus skill.
+ sd->status.skill[id].id = id;
+ 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;
case 1: //Item bonus skill.
- if(sd->status.skill[id].lv >= level)
+ if( sd->status.skill[id].lv >= level )
return 0;
- if(sd->status.skill[id].id==id) {
- if (!sd->status.skill[id].flag) //Non-granted skill, store it's level.
- sd->status.skill[id].flag=sd->status.skill[id].lv+2;
+ if( sd->status.skill[id].id == id ){
+ if( !sd->status.skill[id].flag ) //Non-granted skill, store it's level.
+ sd->status.skill[id].flag = sd->status.skill[id].lv + 2;
} else {
- sd->status.skill[id].id=id;
- sd->status.skill[id].flag=1;
+ sd->status.skill[id].id = id;
+ sd->status.skill[id].flag = 1;
}
- sd->status.skill[id].lv=level;
+ sd->status.skill[id].lv = level;
break;
default: //Unknown flag?
return 0;
@@ -4467,7 +4467,7 @@ int pc_skillup(struct map_session_data *sd,int skill_num)
nullpo_retr(0, sd);
if(skill_num >= GD_SKILLBASE){
- guild_skillup(sd,skill_num,0);
+ guild_skillup(sd, skill_num);
return 0;
}
@@ -5790,10 +5790,13 @@ int pc_setcart(struct map_session_data *sd,int type)
* 鷹設定
*------------------------------------------
*/
-int pc_setfalcon(struct map_session_data *sd)
+int pc_setfalcon(TBL_PC* sd, int flag)
{
- if(pc_checkskill(sd,HT_FALCON)>0){ // ファルコンマスタリ?スキル所持
- pc_setoption(sd,sd->sc.option|OPTION_FALCON);
+ if( flag ){
+ if( pc_checkskill(sd,HT_FALCON)>0 ) // ファルコンマスタリ?スキル所持
+ 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;
@@ -5803,11 +5806,15 @@ int pc_setfalcon(struct map_session_data *sd)
* ペコペコ設定
*------------------------------------------
*/
-int pc_setriding(struct map_session_data *sd)
+int pc_setriding(TBL_PC* sd, int flag)
{
- if((pc_checkskill(sd,KN_RIDING)>0)){ // ライディングスキル所持
- pc_setoption(sd,sd->sc.option|OPTION_RIDING);
+ if( flag ){
+ 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;
}
@@ -6297,7 +6304,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
clif_equipitemack(sd,n,0,0); // fail
return 0;
}
-
+
if(pos == EQP_ACC) { //Accesories should only go in one of the two,
pos = req_pos&EQP_ACC;
if (pos == EQP_ACC) //User specified both slots..
@@ -6328,7 +6335,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
sd->equip_index[i] = n;
}
}
-
+
if(pos==EQP_AMMO){
clif_arrowequip(sd,n);
clif_arrow_fail(sd,3);
@@ -6494,7 +6501,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
if((sd->status.inventory[n].equip & EQP_ARMS) &&
sd->weapontype1 == 0 && sd->weapontype2 == 0)
skill_enchant_elemental_end(&sd->bl,-1);
-
+
sd->status.inventory[n].equip=0;
if(flag&1) {
diff --git a/src/map/pc.h b/src/map/pc.h
index c290ec696..06d8198f9 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -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_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_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);
@@ -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_jobchange(struct map_session_data *,int, int);
int pc_setoption(struct map_session_data *,int);
-int pc_setcart(struct map_session_data *sd,int type);
-int pc_setfalcon(struct map_session_data *sd);
-int pc_setriding(struct map_session_data *sd);
+int pc_setcart(struct map_session_data* sd, int type);
+int pc_setfalcon(struct map_session_data* sd, int flag);
+int pc_setriding(struct map_session_data* sd, int flag);
int pc_changelook(struct map_session_data *,int,int);
int pc_equiplookall(struct map_session_data *sd);
diff --git a/src/map/script.c b/src/map/script.c
index 005e471c6..bce1f6cc7 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -59,6 +59,9 @@
#define script_getdata(st,i) &((st)->stack->stack_data[(st)->start+(i)])
/// Returns if the stack contains data at the target index
#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_isint(data) ( (data)->type == C_INT )
@@ -1852,6 +1855,8 @@ struct map_session_data *script_rid2sd(struct script_state *st)
if(!sd){
ShowError("script_rid2sd: fatal error ! player not attached!\n");
report_src(st);
+ //## I would also terminate script execution. [FlavioJS]
+ //st->state = END;
}
return sd;
}
@@ -3866,26 +3871,26 @@ struct script_function buildin_func[] = {
{buildin_statusup,"statusup","i"},
{buildin_statusup2,"statusup2","ii"},
{buildin_bonus,"bonus","ii"},
- {buildin_bonus2,"bonus2","iii"},
- {buildin_bonus3,"bonus3","iiii"},
- {buildin_bonus4,"bonus4","iiiii"},
- {buildin_skill,"skill","ii*"},
- {buildin_addtoskill,"addtoskill","ii*"}, // [Valaris]
+ {buildin_bonus,"bonus2","iii"},
+ {buildin_bonus,"bonus3","iiii"},
+ {buildin_bonus,"bonus4","iiiii"},
+ {buildin_skill,"skill","ii?"},
+ {buildin_addtoskill,"addtoskill","ii?"}, // [Valaris]
{buildin_guildskill,"guildskill","ii"},
{buildin_getskilllv,"getskilllv","i"},
{buildin_getgdskilllv,"getgdskilllv","ii"},
- {buildin_basicskillcheck,"basicskillcheck","*"},
- {buildin_getgmlevel,"getgmlevel","*"},
+ {buildin_basicskillcheck,"basicskillcheck",""},
+ {buildin_getgmlevel,"getgmlevel",""},
{buildin_end,"end",""},
// {buildin_end,"break",""}, this might confuse advanced scripting support [Eoe]
{buildin_checkoption,"checkoption","i"},
- {buildin_setoption,"setoption","i*"},
- {buildin_setcart,"setcart",""},
- {buildin_checkcart,"checkcart","*"}, //fixed by Lupus (added '*')
- {buildin_setfalcon,"setfalcon",""},
- {buildin_checkfalcon,"checkfalcon","*"}, //fixed by Lupus (fixed wrong pointer, added '*')
- {buildin_setriding,"setriding",""},
- {buildin_checkriding,"checkriding","*"}, //fixed by Lupus (fixed wrong pointer, added '*')
+ {buildin_setoption,"setoption","i?"},
+ {buildin_setcart,"setcart","?"},
+ {buildin_checkcart,"checkcart",""},
+ {buildin_setfalcon,"setfalcon","?"},
+ {buildin_checkfalcon,"checkfalcon",""},
+ {buildin_setriding,"setriding","?"},
+ {buildin_checkriding,"checkriding",""},
{buildin_savepoint,"save","sii"},
{buildin_savepoint,"savepoint","sii"},
{buildin_gettimetick,"gettimetick","i"},
@@ -6483,408 +6488,436 @@ int buildin_statusup2(struct script_state *st)
return 0;
}
-/*==========================================
- * 装備品による能力値ボーナス
- *------------------------------------------
- */
-int buildin_bonus(struct script_state *st)
-{
- int type,val;
- struct map_session_data *sd;
-
- type=conv_num(st,& (st->stack->stack_data[st->start+2]));
- val=conv_num(st,& (st->stack->stack_data[st->start+3]));
- sd=script_rid2sd(st);
- pc_bonus(sd,type,val);
- return 0;
-}
-/*==========================================
- * 装備品による能力値ボーナス
- *------------------------------------------
- */
-int buildin_bonus2(struct script_state *st)
+/// See 'doc/item_bonus.txt'
+/// bonus <bonus type>,<val1>
+/// bonus2 <bonus type>,<val1>,<val2>
+/// bonus3 <bonus type>,<val1>,<val2>,<val3>
+/// bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>
+int buildin_bonus(struct script_state* st)
{
- int type,type2,val;
- struct map_session_data *sd;
+ int type;
+ int type2;
+ int type3;
+ int type4;
+ int val;
+ TBL_PC* sd;
- type=conv_num(st,& (st->stack->stack_data[st->start+2]));
- type2=conv_num(st,& (st->stack->stack_data[st->start+3]));
- val=conv_num(st,& (st->stack->stack_data[st->start+4]));
- sd=script_rid2sd(st);
- pc_bonus2(sd,type,type2,val);
+ sd = script_rid2sd(st);
+ if( sd == NULL )
+ return 0; // no player attached
+
+ 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;
+ case 4:
+ type2 = conv_num(st, script_getdata(st,3));
+ val = conv_num(st, script_getdata(st,4));
+ pc_bonus2(sd, type, type2, val);
+ break;
+ case 5:
+ type2 = conv_num(st, script_getdata(st,3));
+ type3 = conv_num(st, script_getdata(st,4));
+ val = conv_num(st, script_getdata(st,5));
+ pc_bonus3(sd, type, type2, type3, val);
+ break;
+ 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);
+ break;
+ default:
+ ShowDebug("buildin_bonus: unexpected last data (%d)\n", script_lastdata(st));
+ }
return 0;
}
-/*==========================================
- * 装備品による能力値ボーナス
- *------------------------------------------
- */
-int buildin_bonus3(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,val;
- struct map_session_data *sd;
+ int id;
+ int level;
+ int flag = 1;
+ TBL_PC* 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);
+ sd = script_rid2sd(st);
+ if( sd == NULL )
+ return 0; // no player attached
+
+ 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);
return 0;
}
-int buildin_bonus4(struct script_state *st)
+/// Changes the level of a player skill.
+/// addtoskill <skill id>,<level>{,<flag>}
+/// @see pc_skill() for flag
+int buildin_addtoskill(struct script_state* st)
{
- int type,type2,type3,type4,val;
- struct map_session_data *sd;
+ int id;
+ int level;
+ int flag = 2;
+ TBL_PC* 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]));
- 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);
+ sd = script_rid2sd(st);
+ if( sd == NULL )
+ return 0; // no player attached
+
+ 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);
return 0;
}
-/*==========================================
- * スキル所得
- *------------------------------------------
- */
-int buildin_skill(struct script_state *st)
+
+/// Increases the level of the guild skill.
+/// guildskill <skill id>,<level>
+int buildin_guildskill(struct script_state* st)
{
- int id,level,flag=1;
- struct map_session_data *sd;
+ int id;
+ int level;
+ TBL_PC* sd;
+ int i;
- 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);
+ sd = script_rid2sd(st);
+ if( sd == NULL )
+ return 0; // needs player attached
+
+ id = conv_num(st, script_getdata(st,2));
+ level = conv_num(st, script_getdata(st,3));
+ for( i=0; i < level; i++ )
+ guild_skillup(sd, id);
return 0;
}
-// add x levels of skill (stackable) [Valaris]
-int buildin_addtoskill(struct script_state *st)
+/// Returns the level of the player skill.
+/// getskilllv(<skill id>) -> <level>
+int buildin_getskilllv(struct script_state* st)
{
- int id,level,flag=2;
- struct map_session_data *sd;
+ int id;
+ TBL_PC* 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);
+ 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;
}
-/*==========================================
- * ギルドスキル取得
- *------------------------------------------
- */
-int buildin_guildskill(struct script_state *st)
+/// Returns the level of the guild skill.
+/// getgdskilllv(<guild id>,<skill id>) -> <level>
+int buildin_getgdskilllv(struct script_state* st)
{
- int id,level,flag=0;
- struct map_session_data *sd;
- int i=0;
+ int guild_id;
+ int skill_id;
+ struct guild* g;
- 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);
- for(i=0;i<level;i++)
- guild_skillup(sd,id,flag);
+ 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;
-}
-/*==========================================
- * スキルレベル所得
- *------------------------------------------
- */
-int buildin_getskilllv(struct script_state *st)
-{
- int id=conv_num(st,& (st->stack->stack_data[st->start+2]));
- push_val(st->stack,C_INT, pc_checkskill( script_rid2sd(st) ,id) );
- return 0;
-}
-/*==========================================
- * getgdskilllv(Guild_ID, Skill_ID);
- * skill_id = 10000 : GD_APPROVAL
- * 10001 : GD_KAFRACONTRACT
- * 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 skill_id=conv_num(st,& (st->stack->stack_data[st->start+3]));
- struct guild *g=guild_search(guild_id);
- push_val(st->stack,C_INT, (g==NULL)?-1:guild_checkskill(g,skill_id) );
- return 0;
/*
- struct map_session_data *sd=NULL;
- struct guild *g=NULL;
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;
*/
}
-/*==========================================
- *
- *------------------------------------------
- */
-int buildin_basicskillcheck(struct script_state *st)
+
+/// Returns the 'basic_skill_check' setting.
+/// basicskillcheck() -> <setting>
+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)
+
+/// Returns the GM level of the player.
+/// getgmlevel() -> <level>
+int buildin_getgmlevel(struct script_state* st)
{
- push_val(st->stack,C_INT, pc_isGM(script_rid2sd(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;
}
-/*==========================================
- *
- *------------------------------------------
- */
-int buildin_end(struct script_state *st)
+/// Terminates the execution of this script instance.
+/// end
+int buildin_end(struct script_state* st)
{
st->state = END;
return 0;
}
-/*==========================================
- *
- *------------------------------------------
- */
-int buildin_checkoption(struct script_state *st)
+/// Checks if the player has that option.
+/// checkoption(<option>) -> <bool>
+int buildin_checkoption(struct script_state* st)
{
- int type;
- struct map_session_data *sd;
+ int option;
+ 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){
- push_val(st->stack,C_INT,1);
- } else {
- push_val(st->stack,C_INT,0);
- }
+ option = conv_num(st, script_getdata(st,2));
+ if( sd->sc.option&option )
+ script_pushint(st, 1);
+ else
+ script_pushint(st, 0);
return 0;
}
-/*==========================================
- *
- *------------------------------------------
- */
-int buildin_checkoption1(struct script_state *st)
+
+/// Checks if the player is in that opt1 state.
+/// checkoption1(<opt1>) -> <bool>
+int buildin_checkoption1(struct script_state* st)
{
- int type;
- struct map_session_data *sd;
+ int opt1;
+ 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.opt1 & type){
- push_val(st->stack,C_INT,1);
- } else {
- push_val(st->stack,C_INT,0);
- }
+ opt1 = conv_num(st, script_getdata(st,2));
+ if( sd->sc.opt1 == opt1 )
+ script_pushint(st, 1);
+ else
+ script_pushint(st, 0);
return 0;
}
-/*==========================================
- *
- *------------------------------------------
- */
-int buildin_checkoption2(struct script_state *st)
+
+/// Checks if the player has that opt2.
+/// checkoption2(<opt2>) -> <bool>
+int buildin_checkoption2(struct script_state* st)
{
- int type;
- struct map_session_data *sd;
+ int opt2;
+ 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.opt2 & type){
- push_val(st->stack,C_INT,1);
- } else {
- push_val(st->stack,C_INT,0);
- }
+ opt2 = conv_num(st, script_getdata(st,2));
+ if( sd->sc.opt2&opt2 )
+ script_pushint(st, 1);
+ else
+ script_pushint(st, 0);
return 0;
}
-/*==========================================
- *
- *------------------------------------------
- */
-int buildin_setoption(struct script_state *st)
+/// Changes the option of the player.
+/// setoption <option number>{,<flag>}
+int buildin_setoption(struct script_state* st)
{
- int type;
- struct map_session_data *sd;
- int flag=1;
-
- 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]) );
- else if (!type) { //Request to remove everything.
+ 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;
- type = OPTION_CART|OPTION_FALCON|OPTION_RIDING;
+ option = OPTION_CART|OPTION_FALCON|OPTION_RIDING;
}
- sd=script_rid2sd(st);
- if (!sd) return 0;
+ if( flag ){// Add option
+ if( option&OPTION_WEDDING && !battle_config.wedding_modifydisplay )
+ option &= ~OPTION_WEDDING;// Do not show the wedding sprites
+ pc_setoption(sd, sd->sc.option|option);
+ } else// Remove option
+ pc_setoption(sd, sd->sc.option&~option);
- if (flag) {//Add option
- if (type&OPTION_WEDDING && !battle_config.wedding_modifydisplay)
- type&=~OPTION_WEDDING; //Do not show the wedding sprites
- 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)
+/// Returns if the player has a cart.
+/// checkcart() -> <bool>
+/// @author Valaris
+int buildin_checkcart(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_iscarton(sd) )
+ script_pushint(st, 1);
+ else
+ script_pushint(st, 0);
- 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)
+/// Sets the cart of the player.
+/// setcart {<type>}
+int buildin_setcart(struct script_state* st)
{
- struct map_session_data *sd;
+ int type = 1;
+ TBL_PC* sd;
- sd=script_rid2sd(st);
- pc_setcart(sd,1);
+ sd = script_rid2sd(st);
+ 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;
}
-/*==========================================
- * checkfalcon [Valaris]
- *------------------------------------------
- */
-
-int buildin_checkfalcon(struct script_state *st)
+/// Returns if the player has a falcon.
+/// checkfalcon() -> <bool>
+/// @author Valaris
+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)){
- push_val(st->stack,C_INT,1);
- } else {
- push_val(st->stack,C_INT,0);
- }
+ if( pc_isfalcon(sd) )
+ script_pushint(st, 1);
+ else
+ script_pushint(st, 0);
return 0;
}
-
-/*==========================================
- * 鷹を付ける
- *------------------------------------------
- */
-int buildin_setfalcon(struct script_state *st)
+/// Sets if the player has a falcon or not.
+/// setfalcon {<flag>}
+int buildin_setfalcon(struct script_state* st)
{
- struct map_session_data *sd;
+ int flag = 1;
+ TBL_PC* sd;
- sd=script_rid2sd(st);
- pc_setfalcon(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_setfalcon(sd, flag);
return 0;
}
-/*==========================================
- * Checkcart [Valaris]
- *------------------------------------------
- */
-
-int buildin_checkriding(struct script_state *st)
+/// Returns if the player is riding.
+/// checkriding() -> <bool>
+/// @author Valaris
+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)){
- push_val(st->stack,C_INT,1);
- } else {
- push_val(st->stack,C_INT,0);
- }
+ if( pc_isriding(sd) )
+ script_pushint(st, 1);
+ else
+ script_pushint(st, 0);
return 0;
}
-
-/*==========================================
- * ペコペコ乗り
- *------------------------------------------
- */
-int buildin_setriding(struct script_state *st)
+/// Sets if the player is riding.
+/// setriding {<flag>}
+int buildin_setriding(struct script_state* st)
{
- struct map_session_data *sd;
+ int flag = 1;
+ TBL_PC* sd;
- sd=script_rid2sd(st);
- pc_setriding(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;
}
-/*==========================================
- * セーブポイントの保存
- *------------------------------------------
- */
-int buildin_savepoint(struct script_state *st)
+/// 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,y;
+ int x;
+ int y;
short map;
- char *str;
+ char* str;
+ TBL_PC* sd;
- str=conv_str(st,& (st->stack->stack_data[st->start+2]));
- x=conv_num(st,& (st->stack->stack_data[st->start+3]));
- y=conv_num(st,& (st->stack->stack_data[st->start+4]));
+ sd = script_rid2sd(st);
+ if( sd == NULL )
+ 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);
- if (map)
- pc_setsavepoint(script_rid2sd(st),map,x,y);
+ if( map )
+ pc_setsavepoint(sd, map, x, y);
+
return 0;
}
diff --git a/src/map/skill.h b/src/map/skill.h
index ac08ab34b..ddb9042a0 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -272,7 +272,7 @@ enum {
ST_RECOV_WEIGHT_RATE,ST_MOVE_ENABLE,ST_WATER,
};
-enum {
+enum _skill {
NV_BASIC = 1,
SM_SWORD,
diff --git a/src/map/status.c b/src/map/status.c
index a9da05e7f..a79ff7f89 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -6036,7 +6036,7 @@ int status_change_end( struct block_list* bl , int type,int tid )
status = status_get_status_data(bl);
nullpo_retr(0,sc);
nullpo_retr(0,status);
-
+
if(type < 0 || type >= SC_MAX)
return 0;