summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-10-20 00:38:44 +0200
committerHaru <haru@dotalux.com>2014-10-24 00:59:21 +0200
commit138352558b04de199139d5f8124d6e3c24df8008 (patch)
tree2d9894bb9c4d630715603860745d3e77ac7851b3
parent98274e4ab8d5f8cb6381a4a625441c90020dffff (diff)
downloadhercules-138352558b04de199139d5f8124d6e3c24df8008.tar.gz
hercules-138352558b04de199139d5f8124d6e3c24df8008.tar.bz2
hercules-138352558b04de199139d5f8124d6e3c24df8008.tar.xz
hercules-138352558b04de199139d5f8124d6e3c24df8008.zip
pc_isriding* / pc_setriding* cleanup
- pc_isriding is now renamed to pc_isridingpeco, since that's what it checks (to avoid confusion). - pc_hasmount is added, to check for any of Peco, Dragon, Mado Gear, Wug Rider. - pc->setridingdragon is added. - pc->setridingwug is added. - pc->setfalcon type is changed. - pc->setmadogear type is changed. - pc->setridign is changed to pc->setridingpeco to avoid confusion. - Changed direct accesses to sd->sd.option to the proper pc_is* accessors, where applicable. - Special thanks to Kisuka. Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/atcommand.c35
-rw-r--r--src/map/battle.c6
-rw-r--r--src/map/clif.c33
-rw-r--r--src/map/pc.c133
-rw-r--r--src/map/pc.h21
-rw-r--r--src/map/script.c37
-rw-r--r--src/map/skill.c12
-rw-r--r--src/map/status.c66
-rw-r--r--src/map/unit.c2
9 files changed, 213 insertions, 132 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 049adf1fc..9472fe36d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -583,7 +583,7 @@ ACMD(who) {
iter = mapit_getallusers();
for (pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter)) {
- if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || (pl_sd->sc.option & OPTION_INVISIBLE)) && pc_get_group_level(pl_sd) > level)) { // you can look only lower or same level
+ if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || pc_isinvisible(pl_sd)) && pc_get_group_level(pl_sd) > level)) { // you can look only lower or same level
if (stristr(pl_sd->status.name, player_name) == NULL // search with no case sensitive
|| (map_id >= 0 && pl_sd->bl.m != map_id))
continue;
@@ -689,7 +689,7 @@ ACMD(whogm)
continue;
}
if (pl_level > level) {
- if (pl_sd->sc.option & OPTION_INVISIBLE)
+ if (pc_isinvisible(pl_sd))
continue;
sprintf(atcmd_output, msg_txt(913), pl_sd->status.name); // Name: %s (GM)
clif->message(fd, atcmd_output);
@@ -889,7 +889,7 @@ ACMD(option)
*
*------------------------------------------*/
ACMD(hide) {
- if (sd->sc.option & OPTION_INVISIBLE) {
+ if (pc_isinvisible(sd)) {
sd->sc.option &= ~OPTION_INVISIBLE;
if (sd->disguise != -1 )
status->set_viewdata(&sd->bl, sd->disguise);
@@ -3923,12 +3923,12 @@ ACMD(mount_peco)
clif->message(fd, atcmd_output);
return false;
}
- if( !(sd->sc.option&OPTION_DRAGON1) ) {
+ if (!pc_isridingdragon(sd)) {
clif->message(sd->fd,msg_txt(1119)); // You have mounted your Dragon.
- pc->setoption(sd, sd->sc.option|OPTION_DRAGON1);
+ pc->setridingdragon(sd, OPTION_DRAGON1);
} else {
clif->message(sd->fd,msg_txt(1120)); // You have released your Dragon.
- pc->setoption(sd, sd->sc.option&~OPTION_DRAGON1);
+ pc->setridingdragon(sd, 0);
}
return true;
}
@@ -3940,34 +3940,34 @@ ACMD(mount_peco)
}
if( !pc_isridingwug(sd) ) {
clif->message(sd->fd,msg_txt(1121)); // You have mounted your Warg.
- pc->setoption(sd, sd->sc.option|OPTION_WUGRIDER);
+ pc->setridingwug(sd, true);
} else {
clif->message(sd->fd,msg_txt(1122)); // You have released your Warg.
- pc->setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
+ pc->setridingwug(sd, false);
}
return true;
}
if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) {
if( !pc_ismadogear(sd) ) {
clif->message(sd->fd,msg_txt(1123)); // You have mounted your Mado Gear.
- pc->setoption(sd, sd->sc.option|OPTION_MADOGEAR);
+ pc->setmadogear(sd, true);
} else {
clif->message(sd->fd,msg_txt(1124)); // You have released your Mado Gear.
- pc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
+ pc->setmadogear(sd, false);
}
return true;
}
if( sd->class_&MAPID_SWORDMAN && sd->class_&JOBL_2 ) {
- if( !pc_isriding(sd) ) { // if actually no peco
+ if (!pc_isridingpeco(sd)) { // if actually no peco
if (!pc->checkskill(sd, KN_RIDING)) {
sprintf(atcmd_output, msg_txt(213), skill->get_desc(KN_RIDING)); // You need %s to mount!
clif->message(fd, atcmd_output);
return false;
}
- pc->setoption(sd, sd->sc.option | OPTION_RIDING);
+ pc->setridingpeco(sd, true);
clif->message(fd, msg_txt(102)); // You have mounted a Peco Peco.
} else {//Dismount
- pc->setoption(sd, sd->sc.option & ~OPTION_RIDING);
+ pc->setridingpeco(sd, false);
clif->message(fd, msg_txt(214)); // You have released your Peco Peco.
}
return true;
@@ -4621,8 +4621,7 @@ ACMD(disguise)
return false;
}
- if(pc_isriding(sd))
- {
+ if (pc_hasmount(sd)) {
clif->message(fd, msg_txt(1144)); // Character cannot be disguised while mounted.
return false;
}
@@ -4709,8 +4708,8 @@ ACMD(disguiseguild)
return false;
}
- for( i = 0; i < g->max_member; i++ )
- if( (pl_sd = g->member[i].sd) && !pc_isriding(pl_sd) )
+ for (i = 0; i < g->max_member; i++)
+ if ((pl_sd = g->member[i].sd) && !pc_hasmount(pl_sd))
pc->disguise(pl_sd, id);
clif->message(fd, msg_txt(122)); // Disguise applied.
@@ -8360,7 +8359,7 @@ ACMD(charcommands)
/* for new mounts */
ACMD(mount2) {
- if( sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR) ) {
+ if (pc_hasmount(sd)) {
clif->message(fd, msg_txt(1476)); // You are already mounting something else
return false;
}
diff --git a/src/map/battle.c b/src/map/battle.c
index 6844d8bda..3db887c42 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -663,10 +663,10 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in
break;
case W_1HSPEAR:
case W_2HSPEAR:
- if((skill_lv = pc->checkskill(sd,KN_SPEARMASTERY)) > 0) {
- if(pc_isridingdragon(sd))
+ if ((skill_lv = pc->checkskill(sd,KN_SPEARMASTERY)) > 0) {
+ if (pc_isridingdragon(sd))
damage += (skill_lv * 10);
- else if(pc_isriding(sd))
+ else if (pc_isridingpeco(sd))
damage += (skill_lv * 5);
else
damage += (skill_lv * 4);
diff --git a/src/map/clif.c b/src/map/clif.c
index a5928bc89..033a5e081 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5831,12 +5831,12 @@ void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type)
unsigned char buf[32];
WBUFW(buf,0) = 0x19a;
WBUFL(buf,2) = sd->bl.id;
- if(sd->sc.option&(OPTION_HIDE|OPTION_CLOAK))
+ if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK)) // TODO[Haru] Should this be pc_ishiding(sd)? (i.e. include Chase Walk and any new options)
WBUFL(buf,6) = UINT32_MAX; //On client displays as --
else
WBUFL(buf,6) = pvprank;
WBUFL(buf,10) = pvpnum;
- if(sd->sc.option&OPTION_INVISIBLE || sd->disguise != -1) //Causes crashes when a 'mob' with pvp info dies.
+ if (pc_isinvisible(sd) || sd->disguise != -1) //Causes crashes when a 'mob' with pvp info dies.
clif->send(buf,packet_len(0x19a),&sd->bl,SELF);
else if(!type)
clif->send(buf,packet_len(0x19a),&sd->bl,AREA);
@@ -9338,7 +9338,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
sd->state.hpmeter_visible = 1;
}
- if( !(sd->sc.option&OPTION_INVISIBLE) ) { // increment the number of pvp players on the map
+ if (!pc_isinvisible(sd)) { // increment the number of pvp players on the map
map->list[sd->bl.m].users_pvp++;
}
@@ -9359,7 +9359,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
if( sd->bg_id ) clif->bg_hp(sd); // BattleGround System
- if(map->list[sd->bl.m].flag.pvp && !(sd->sc.option&OPTION_INVISIBLE)) {
+ if (map->list[sd->bl.m].flag.pvp && !pc_isinvisible(sd)) {
if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris]
if (!map->list[sd->bl.m].flag.pvp_nocalcrank)
sd->pvp_timer = timer->add(timer->gettick()+200, pc->calc_pvprank_timer, sd->bl.id, 0);
@@ -9444,11 +9444,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
clif->updatestatus(sd,SP_SKILLPOINT);
clif->initialstatus(sd);
- if (sd->sc.option&OPTION_FALCON)
+ if (pc_isfalcon(sd))
clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0);
- if (sd->sc.option&(OPTION_RIDING|OPTION_DRAGON))
+ if (pc_isridingpeco(sd) || pc_isridingdragon(sd))
clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0);
- else if (sd->sc.option&OPTION_WUGRIDER)
+ else if (pc_isridingwug(sd))
clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0);
if(sd->status.manner < 0)
@@ -10488,7 +10488,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
// if player ignores everyone
if (dstsd->state.ignoreAll && pc_get_group_level(sd) <= pc_get_group_level(dstsd)) {
- if (dstsd->sc.option & OPTION_INVISIBLE && pc_get_group_level(sd) < pc_get_group_level(dstsd))
+ if (pc_isinvisible(dstsd) && pc_get_group_level(sd) < pc_get_group_level(dstsd))
clif->wis_end(fd, 1); // 1: target character is not logged in
else
clif->wis_end(fd, 3); // 3: everyone ignored by target
@@ -11162,16 +11162,17 @@ void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd)
/// 012a
void clif_parse_RemoveOption(int fd,struct map_session_data *sd)
{
- if( !(sd->sc.option&(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR))
+ if (pc_isridingpeco(sd) || pc_isfalcon(sd) || pc_isridingdragon(sd) || pc_ismadogear(sd)) {
+ // priority to remove this option before we can clear cart
+ pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
+ } else {
#ifdef NEW_CARTS
- && sd->sc.data[SC_PUSH_CART] ){
- pc->setcart(sd,0);
-#else
- ){
+ if (sd->sc.data[SC_PUSH_CART])
+ pc->setcart(sd,0);
+#else // not NEW_CARTS
pc->setoption(sd,sd->sc.option&~OPTION_CART);
-#endif
- }else // priority to remove this option before we can clear cart
- pc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
+#endif // NEW_CARTS
+ }
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 697a24507..85dab4559 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1320,7 +1320,7 @@ int pc_reg_received(struct map_session_data *sd)
clif->pLoadEndAck(sd->fd, sd);
}
- if( sd->sc.option & OPTION_INVISIBLE ) {
+ if (pc_isinvisible(sd)) {
sd->vd.class_ = INVISIBLE_CLASS;
clif->message(sd->fd, msg_txt(11)); // Invisible: On
// decrement the number of pvp players on the map
@@ -1729,7 +1729,7 @@ int pc_disguise(struct map_session_data *sd, int class_) {
if (class_ >= 0 && sd->disguise == class_)
return 0;
- if(sd->sc.option&OPTION_INVISIBLE) { //Character is invisible. Stealth class-change. [Skotlex]
+ if (pc_isinvisible(sd)) { //Character is invisible. Stealth class-change. [Skotlex]
sd->disguise = class_; //viewdata is set on uncloaking.
return 2;
}
@@ -4471,7 +4471,7 @@ int pc_useitem(struct map_session_data *sd,int n) {
} else {// not yet used item (all slots are initially empty)
sd->item_delay[i].nameid = nameid;
}
- if( !(nameid == ITEMID_REINS_OF_MOUNT && sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR)) )
+ if (!(nameid == ITEMID_REINS_OF_MOUNT && pc_hasmount(sd)))
sd->item_delay[i].tick = tick + sd->inventory_data[n]->delay;
} else {// should not happen
ShowError("pc_useitem: Exceeded item delay array capacity! (nameid=%d, char_id=%d)\n", nameid, sd->status.char_id);
@@ -8143,48 +8143,111 @@ int pc_setcart(struct map_session_data *sd,int type) {
return 0;
}
-/*==========================================
- * Give player a falcon
- *------------------------------------------*/
-int pc_setfalcon(TBL_PC* sd, int flag)
+/* FIXME: These setter methods are inconsistent in their class/skill checks.
+ They should be changed so that they all either do or skip the checks.*/
+
+/**
+ * Gives/removes a falcon.
+ *
+ * The target player needs the required skills in order to obtain a falcon.
+ *
+ * @param sd Target player.
+ * @param flag New state.
+ **/
+void pc_setfalcon(TBL_PC* sd, bool flag)
{
- if( flag ){
- if( pc->checkskill(sd,HT_FALCON)>0 ) // add falcon if he have the skill
+ if (flag) {
+ if (pc->checkskill(sd,HT_FALCON) > 0) // add falcon if he have the skill
pc->setoption(sd,sd->sc.option|OPTION_FALCON);
- } else if( pc_isfalcon(sd) ){
+ } else if (pc_isfalcon(sd)) {
pc->setoption(sd,sd->sc.option&~OPTION_FALCON); // remove falcon
}
-
- return 0;
}
-/*==========================================
- * Set player riding
- *------------------------------------------*/
-int pc_setriding(TBL_PC* sd, int flag)
+/**
+ * Mounts/dismounts a Peco or Gryphon.
+ *
+ * The target player needs the required skills in order to mount a peco.
+ *
+ * @param sd Target player.
+ * @param flag New state.
+ **/
+void pc_setridingpeco(TBL_PC* sd, bool flag)
{
- if( flag ){
- if( pc->checkskill(sd,KN_RIDING) > 0 ) // add peco
+ if (flag) {
+ if (pc->checkskill(sd, KN_RIDING))
pc->setoption(sd, sd->sc.option|OPTION_RIDING);
- } else if( pc_isriding(sd) ){
- pc->setoption(sd, sd->sc.option&~OPTION_RIDING);
+ } else if (pc_isridingpeco(sd)) {
+ pc->setoption(sd, sd->sc.option&~OPTION_RIDING);
}
-
- return 0;
}
/**
- * Gives player a mado
- * @param flag 1 Set mado
+ * Gives/removes a Mado Gear.
+ *
+ * The target player needs to be the correct class in order to obtain a mado gear.
+ *
+ * @param sd Target player.
+ * @param flag New state.
**/
-void pc_setmadogear( struct map_session_data *sd, int flag ) {
- if( flag ) {
- if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC )
+void pc_setmadogear(struct map_session_data *sd, bool flag)
+{
+ if (flag) {
+ if ((sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC)
pc->setoption(sd, sd->sc.option|OPTION_MADOGEAR);
- } else if( pc_ismadogear(sd) )
+ } else if (pc_ismadogear(sd)) {
pc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
+ }
+}
- return;
+/**
+ * Mounts/dismounts a dragon.
+ *
+ * The target player needs the required skills in order to mount a dragon.
+ *
+ * @param sd Target player.
+ * @param type New state. This must be a valid OPTION_DRAGON* or 0.
+ **/
+void pc_setridingdragon(TBL_PC* sd, unsigned int type)
+{
+ if (type&OPTION_DRAGON) {
+ // Ensure only one dragon is set at a time.
+ if (type&OPTION_DRAGON1)
+ type = OPTION_DRAGON1;
+ else if (type&OPTION_DRAGON2)
+ type = OPTION_DRAGON2;
+ else if (type&OPTION_DRAGON3)
+ type = OPTION_DRAGON3;
+ else if (type&OPTION_DRAGON4)
+ type = OPTION_DRAGON4;
+ else if (type&OPTION_DRAGON5)
+ type = OPTION_DRAGON5;
+ else
+ type = OPTION_DRAGON1;
+
+ if (pc->checkskill(sd, RK_DRAGONTRAINING))
+ pc->setoption(sd, (sd->sc.option&~OPTION_DRAGON)|type);
+ } else if (pc_isridingdragon(sd)) {
+ pc->setoption(sd,sd->sc.option&~OPTION_DRAGON); // remove dragon
+ }
+}
+
+/**
+ * Mounts/dismounts a wug.
+ *
+ * The target player needs the required skills in order to mount a wug.
+ *
+ * @param sd Target player.
+ * @param flag New state.
+ **/
+void pc_setridingwug(TBL_PC* sd, bool flag)
+{
+ if (flag) {
+ if (pc->checkskill(sd, RA_WUGRIDER) > 0)
+ pc->setoption(sd,sd->sc.option|OPTION_WUGRIDER);
+ } else if (pc_isridingwug(sd)) {
+ pc->setoption(sd,sd->sc.option&~OPTION_WUGRIDER); // remove wug
+ }
}
/**
@@ -9293,8 +9356,8 @@ int pc_calc_pvprank_sub(struct block_list *bl,va_list ap)
sd1=(struct map_session_data *)bl;
sd2=va_arg(ap,struct map_session_data *);
- if( sd1->sc.option&OPTION_INVISIBLE || sd2->sc.option&OPTION_INVISIBLE )
- {// cannot register pvp rank for hidden GMs
+ if (pc_isinvisible(sd1) ||pc_isinvisible(sd2)) {
+ // cannot register pvp rank for hidden GMs
return 0;
}
@@ -9328,8 +9391,8 @@ int pc_calc_pvprank_timer(int tid, int64 tick, int id, intptr_t data) {
return 0;
sd->pvp_timer = INVALID_TIMER;
- if( sd->sc.option&OPTION_INVISIBLE )
- {// do not calculate the pvp rank for a hidden GM
+ if (pc_isinvisible(sd)) {
+ // do not calculate the pvp rank for a hidden GM
return 0;
}
@@ -10967,8 +11030,10 @@ void pc_defaults(void) {
pc->setoption = pc_setoption;
pc->setcart = pc_setcart;
pc->setfalcon = pc_setfalcon;
- pc->setriding = pc_setriding;
+ pc->setridingpeco = pc_setridingpeco;
pc->setmadogear = pc_setmadogear;
+ pc->setridingdragon = pc_setridingdragon;
+ pc->setridingwug = pc_setridingwug;
pc->changelook = pc_changelook;
pc->equiplookall = pc_equiplookall;
diff --git a/src/map/pc.h b/src/map/pc.h
index c36704b4f..580908692 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -589,19 +589,20 @@ struct map_session_data {
#endif
#define pc_isfalcon(sd) ( (sd)->sc.option&OPTION_FALCON )
-#define pc_isriding(sd) ( (sd)->sc.option&OPTION_RIDING )
#define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE )
#define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle->bc->natural_heal_weight_rate )
#define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 )
#define pc_maxparameter(sd) ( (((sd)->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO || ((sd)->class_&MAPID_UPPERMASK) == MAPID_REBELLION || ((sd)->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E) ? battle->bc->max_extended_parameter : (sd)->class_&JOBL_THIRD ? ((sd)->class_&JOBL_BABY ? battle->bc->max_baby_third_parameter : battle->bc->max_third_parameter) : ((sd)->class_&JOBL_BABY ? battle->bc->max_baby_parameter : battle->bc->max_parameter) )
-/**
- * Ranger
- **/
+/// Generic check for mounts
+#define pc_hasmount(sd) ( (sd)->sc.option&(OPTION_RIDING|OPTION_WUGRIDER|OPTION_DRAGON|OPTION_MADOGEAR) )
+/// Knight classes Peco / Gryphon
+#define pc_isridingpeco(sd) ( (sd)->sc.option&(OPTION_RIDING) )
+/// Ranger Warg
#define pc_iswug(sd) ( (sd)->sc.option&OPTION_WUG )
#define pc_isridingwug(sd) ( (sd)->sc.option&OPTION_WUGRIDER )
-// Mechanic Magic Gear
+/// Mechanic Magic Gear
#define pc_ismadogear(sd) ( (sd)->sc.option&OPTION_MADOGEAR )
-// Rune Knight Dragon
+/// Rune Knight Dragon
#define pc_isridingdragon(sd) ( (sd)->sc.option&OPTION_DRAGON )
#define pc_stop_walking(sd, type) (unit->stop_walking(&(sd)->bl, (type)))
@@ -897,9 +898,11 @@ struct pc_interface {
int (*jobchange) (struct map_session_data *sd,int job, int upper);
int (*setoption) (struct map_session_data *sd,int type);
int (*setcart) (struct map_session_data* sd, int type);
- int (*setfalcon) (struct map_session_data* sd, int flag);
- int (*setriding) (struct map_session_data* sd, int flag);
- void (*setmadogear) (struct map_session_data* sd, int flag);
+ void (*setfalcon) (struct map_session_data *sd, bool flag);
+ void (*setridingpeco) (struct map_session_data *sd, bool flag);
+ void (*setmadogear) (struct map_session_data *sd, bool flag);
+ void (*setridingdragon) (struct map_session_data *sd, unsigned int type);
+ void (*setridingwug) (struct map_session_data *sd, bool flag);
int (*changelook) (struct map_session_data *sd,int type,int val);
int (*equiplookall) (struct map_session_data *sd);
diff --git a/src/map/script.c b/src/map/script.c
index 0588d2f24..24011c910 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -8635,10 +8635,10 @@ BUILDIN(checkfalcon)
TBL_PC* sd;
sd = script->rid2sd(st);
- if( sd == NULL )
+ if (sd == NULL)
return true;// no player attached, report source
- if( pc_isfalcon(sd) )
+ if (pc_isfalcon(sd))
script_pushint(st, 1);
else
script_pushint(st, 0);
@@ -8653,15 +8653,15 @@ BUILDIN(checkfalcon)
/// setfalcon;
BUILDIN(setfalcon)
{
- int flag = 1;
+ bool flag = true;
TBL_PC* sd;
sd = script->rid2sd(st);
- if( sd == NULL )
+ if (sd == NULL)
return true;// no player attached, report source
- if( script_hasdata(st,2) )
- flag = script_getnum(st,2);
+ if (script_hasdata(st,2))
+ flag = script_getnum(st,2) ? true : false;
pc->setfalcon(sd, flag);
@@ -8678,10 +8678,10 @@ BUILDIN(checkriding)
TBL_PC* sd;
sd = script->rid2sd(st);
- if( sd == NULL )
- return true;// no player attached, report source
+ if (sd == NULL)
+ return true; // no player attached, report source
- if( pc_isriding(sd) || pc_isridingwug(sd) || pc_isridingdragon(sd) )
+ if (pc_hasmount(sd))
script_pushint(st, 1);
else
script_pushint(st, 0);
@@ -8700,12 +8700,13 @@ BUILDIN(setriding)
TBL_PC* sd;
sd = script->rid2sd(st);
- if( sd == NULL )
+
+ if (sd == NULL)
return true;// no player attached, report source
- if( script_hasdata(st,2) )
+ if (script_hasdata(st,2))
flag = script_getnum(st,2);
- pc->setriding(sd, flag);
+ pc->setridingpeco(sd, flag ? true : false);
return true;
}
@@ -8757,15 +8758,15 @@ BUILDIN(checkmadogear)
/// setmadogear;
BUILDIN(setmadogear)
{
- int flag = 1;
+ bool flag = true;
TBL_PC* sd;
sd = script->rid2sd(st);
- if( sd == NULL )
+ if (sd == NULL)
return true;// no player attached, report source
- if( script_hasdata(st,2) )
- flag = script_getnum(st,2);
+ if (script_hasdata(st,2))
+ flag = script_getnum(st,2) ? true : false;
pc->setmadogear(sd, flag);
return true;
@@ -17383,9 +17384,9 @@ BUILDIN(ismounting) {
**/
BUILDIN(setmounting) {
TBL_PC* sd;
- if( (sd = script->rid2sd(st)) == NULL )
+ if ((sd = script->rid2sd(st)) == NULL)
return true;
- if( sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR) ) {
+ if (pc_hasmount(sd)) {
clif->msgtable(sd->fd, 0X78b);
script_pushint(st,0);//can't mount with one of these
} else {
diff --git a/src/map/skill.c b/src/map/skill.c
index 414ca74d3..5ea5cc424 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -8533,9 +8533,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
break;
case NC_SELFDESTRUCTION:
- if( sd ) {
- if( pc_ismadogear(sd) )
- pc->setmadogear(sd, 0);
+ if (sd) {
+ if (pc_ismadogear(sd))
+ pc->setmadogear(sd, false);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
skill->castend_damage_id(src, src, skill_id, skill_lv, tick, flag);
status->set_sp(src, 0, 0);
@@ -13440,7 +13440,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
}
break;
case ST_RIDING:
- if(!pc_isriding(sd) && !pc_isridingdragon(sd)) {
+ if (!pc_isridingpeco(sd) && !pc_isridingdragon(sd)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -13555,7 +13555,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
return 0;
}
case ST_PECO:
- if(!pc_isriding(sd)) {
+ if (!pc_isridingpeco(sd)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -14972,7 +14972,7 @@ int skill_frostjoke_scream(struct block_list *bl, va_list ap) {
return 0;
if (bl->type == BL_PC) {
struct map_session_data *sd = (struct map_session_data *)bl;
- if ( sd && sd->sc.option&(OPTION_INVISIBLE|OPTION_MADOGEAR) )
+ if (sd && (pc_isinvisible(sd) || pc_ismadogear(sd)))
return 0;//Frost Joke / Scream cannot target invisible or MADO Gear characters [Ind]
}
//It has been reported that Scream/Joke works the same regardless of woe-setting. [Skotlex]
diff --git a/src/map/status.c b/src/map/status.c
index 3cd28e322..d452d81d1 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2485,13 +2485,14 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
bstatus->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK);
bstatus->size = (sd->class_&JOBL_BABY)?SZ_SMALL:SZ_MEDIUM;
- if (battle_config.character_size && (pc_isriding(sd) || pc_isridingdragon(sd)) ) { //[Lupus]
+ if (battle_config.character_size && (pc_isridingpeco(sd) || pc_isridingdragon(sd))) { //[Lupus]
if (sd->class_&JOBL_BABY) {
if (battle_config.character_size&SZ_BIG)
bstatus->size++;
- } else
+ } else {
if(battle_config.character_size&SZ_MEDIUM)
bstatus->size++;
+ }
}
bstatus->aspd_rate = 1000;
bstatus->ele_lv = 1;
@@ -2780,9 +2781,10 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
sd->left_weapon.atkmods[1] = status->atkmods[1][sd->weapontype2];
sd->left_weapon.atkmods[2] = status->atkmods[2][sd->weapontype2];
- if( (pc_isriding(sd) || pc_isridingdragon(sd)) &&
- (sd->status.weapon==W_1HSPEAR || sd->status.weapon==W_2HSPEAR))
- { //When Riding with spear, damage modifier to mid-class becomes
+ if ((pc_isridingpeco(sd) || pc_isridingdragon(sd))
+ && (sd->status.weapon==W_1HSPEAR || sd->status.weapon==W_2HSPEAR)
+ ) {
+ //When Riding with spear, damage modifier to mid-class becomes
//same as versus large size.
sd->right_weapon.atkmods[1] = sd->right_weapon.atkmods[2];
sd->left_weapon.atkmods[1] = sd->left_weapon.atkmods[2];
@@ -3062,9 +3064,9 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
if((skill_lv=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
bstatus->aspd_rate -= ((skill_lv+1)/2) * 10;
- if(pc_isriding(sd))
+ if (pc_isridingpeco(sd))
bstatus->aspd_rate += 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
- else if(pc_isridingdragon(sd))
+ else if (pc_isridingdragon(sd))
bstatus->aspd_rate += 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
#else // needs more info
if((skill_lv=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
@@ -3074,9 +3076,9 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
if((skill_lv=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
bstatus->aspd_rate += ((skill_lv+1)/2) * 10;
- if(pc_isriding(sd))
+ if (pc_isridingpeco(sd))
bstatus->aspd_rate -= 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
- else if(pc_isridingdragon(sd))
+ else if (pc_isridingdragon(sd))
bstatus->aspd_rate -= 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
#endif
bstatus->adelay = 2*bstatus->amotion;
@@ -3094,7 +3096,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
// Weight
if((skill_lv=pc->checkskill(sd,MC_INCCARRY))>0)
sd->max_weight += 2000*skill_lv;
- if(pc_isriding(sd) && pc->checkskill(sd,KN_RIDING)>0)
+ if (pc_isridingpeco(sd) && pc->checkskill(sd,KN_RIDING) > 0)
sd->max_weight += 10000;
else if(pc_isridingdragon(sd))
sd->max_weight += 5000+2000*pc->checkskill(sd,RK_DRAGONTRAINING);
@@ -5231,16 +5233,16 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc
{
int val = 0;
- if( sc->data[SC_FUSION] )
+ if(sc->data[SC_FUSION]) {
val = 25;
- else if( sd ) {
- if( pc_isriding(sd) || sd->sc.option&(OPTION_DRAGON) || sd->sc.data[SC_ALL_RIDING] )
+ } else if (sd) {
+ if (pc_isridingpeco(sd) || pc_isridingdragon(sd) || sd->sc.data[SC_ALL_RIDING])
val = 25;//Same bonus
- else if( pc_isridingwug(sd) )
+ else if (pc_isridingwug(sd))
val = 15 + 5 * pc->checkskill(sd, RA_WUGRIDER);
- else if( pc_ismadogear(sd) ) {
+ else if (pc_ismadogear(sd)) {
val = (- 10 * (5 - pc->checkskill(sd,NC_MADOLICENCE)));
- if( sc->data[SC_ACCELERATION] )
+ if (sc->data[SC_ACCELERATION])
val += 25;
}
}
@@ -6178,7 +6180,7 @@ void status_set_viewdata(struct block_list *bl, int class_)
{
TBL_PC* sd = (TBL_PC*)bl;
if (pcdb_checkid(class_)) {
- if (sd->sc.option&OPTION_RIDING) {
+ if (pc_isridingpeco(sd)) {
switch (class_) { //Adapt class to a Mounted one.
case JOB_KNIGHT:
class_ = JOB_KNIGHT2;
@@ -8581,14 +8583,22 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
val2 = 20 + 10 * val1; //ASPD. Need to confirm if Movement Speed reduction is the same. [Jobbie]
val3 = 20 * val1; //HIT
if( sd ) { // Removes Animals
- if( pc_isriding(sd) ) pc->setriding(sd, 0);
- if( pc_isridingdragon(sd) ) pc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
- if( pc_iswug(sd) ) pc->setoption(sd, sd->sc.option&~OPTION_WUG);
- if( pc_isridingwug(sd) ) pc->setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
- if( pc_isfalcon(sd) ) pc->setoption(sd, sd->sc.option&~OPTION_FALCON);
- if( sd->status.pet_id > 0 ) pet->menu(sd, 3);
- if( homun_alive(sd->hd) ) homun->vaporize(sd,HOM_ST_REST);
- if( sd->md ) mercenary->delete(sd->md,3);
+ if (pc_isridingpeco(sd))
+ pc->setridingpeco(sd, false);
+ if (pc_isridingdragon(sd))
+ pc->setridingdragon(sd, 0);
+ if (pc_iswug(sd))
+ pc->setoption(sd, sd->sc.option&~OPTION_WUG);
+ if (pc_isridingwug(sd))
+ pc->setridingwug(sd, false);
+ if (pc_isfalcon(sd))
+ pc->setfalcon(sd, false);
+ if (sd->status.pet_id > 0)
+ pet->menu(sd, 3);
+ if (homun_alive(sd->hd))
+ homun->vaporize(sd,HOM_ST_REST);
+ if (sd->md)
+ mercenary->delete(sd->md,3);
}
break;
case SC__LAZINESS:
@@ -8685,8 +8695,10 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
if ( !val3 )
val3 = 50;
if( sd ) {
- if( pc_isriding(sd) ) pc->setriding(sd, 0);
- if( pc_isridingdragon(sd) ) pc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
+ if (pc_isridingpeco(sd))
+ pc->setridingpeco(sd, false);
+ if (pc_isridingdragon(sd))
+ pc->setridingdragon(sd, false);
}
}
break;
diff --git a/src/map/unit.c b/src/map/unit.c
index 769d0ccd0..a54780e83 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2385,7 +2385,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
sd->debug_file, sd->debug_line, sd->debug_func, file, line, func);
} else if (--map->list[bl->m].users == 0 && battle_config.dynamic_mobs) //[Skotlex]
map->removemobs(bl->m);
- if( !(sd->sc.option&OPTION_INVISIBLE) ) {
+ if (!(pc_isinvisible(sd))) {
// decrement the number of active pvp players on the map
--map->list[bl->m].users_pvp;
}