summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c29
-rw-r--r--src/map/battle.c3
-rw-r--r--src/map/battle.h9
-rw-r--r--src/map/clif.c30
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/pc.c17
-rw-r--r--src/map/script.c1
-rw-r--r--src/map/status.c27
-rw-r--r--src/map/status.h3
-rw-r--r--src/map/unit.h3
10 files changed, 117 insertions, 6 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index e18b81f44..ffd09caeb 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1703,6 +1703,32 @@ ACMD(model)
}
/*==========================================
+ * @bodystyle [Rytech]
+ *------------------------------------------*/
+ACMD(bodystyle)
+{
+ int body_style = 0;
+
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
+
+ if (!*message || sscanf(message, "%d", &body_style) < 1) {
+ sprintf(atcmd_output, "Please, enter a body style (usage: @bodystyle <body ID: %d-%d>).", MIN_BODY_STYLE, MAX_BODY_STYLE);
+ clif->message(fd, atcmd_output);
+ return false;
+ }
+
+ if (body_style >= MIN_BODY_STYLE && body_style <= MAX_BODY_STYLE) {
+ pc->changelook(sd, LOOK_BODY2, body_style);
+ clif->message(fd, msg_txt(36)); // Appearence changed.
+ } else {
+ clif->message(fd, msg_txt(37)); // An invalid number was specified.
+ return false;
+ }
+
+ return true;
+}
+
+/*==========================================
* @dye && @ccolor
*------------------------------------------*/
ACMD(dye)
@@ -5484,7 +5510,7 @@ ACMD(divorce)
ACMD(changelook)
{
int i, j = 0, k = 0;
- int pos[7] = { LOOK_HEAD_TOP,LOOK_HEAD_MID,LOOK_HEAD_BOTTOM,LOOK_WEAPON,LOOK_SHIELD,LOOK_SHOES,LOOK_ROBE };
+ int pos[8] = { LOOK_HEAD_TOP,LOOK_HEAD_MID,LOOK_HEAD_BOTTOM,LOOK_WEAPON,LOOK_SHIELD,LOOK_SHOES,LOOK_ROBE,LOOK_BODY2 };
if((i = sscanf(message, "%12d %12d", &j, &k)) < 1) {
clif->message(fd, msg_fd(fd,1177)); // Usage: @changelook {<position>} <view id>
@@ -9648,6 +9674,7 @@ void atcommand_basecommands(void) {
ACMD_DEF(skdebug),
ACMD_DEF(cddebug),
ACMD_DEF(lang),
+ ACMD_DEF(bodystyle),
};
int i;
diff --git a/src/map/battle.c b/src/map/battle.c
index 317b2d98a..7ceefcf49 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -7196,6 +7196,9 @@ static const struct battle_data {
{ "costume_refine_def", &battle_config.costume_refine_def, 1, 0, 1, },
{ "shadow_refine_def", &battle_config.shadow_refine_def, 1, 0, 1, },
{ "shadow_refine_atk", &battle_config.shadow_refine_atk, 1, 0, 1, },
+ { "min_body_style", &battle_config.min_body_style, 0, 0, SHRT_MAX, },
+ { "max_body_style", &battle_config.max_body_style, 4, 0, SHRT_MAX, },
+ { "save_body_style", &battle_config.save_body_style, 0, 0, 1, },
};
#ifndef STATS_OPT_OUT
/**
diff --git a/src/map/battle.h b/src/map/battle.h
index 37d78436c..49abdc730 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -43,6 +43,8 @@ struct status_data;
#define MAX_HAIR_COLOR (battle->bc->max_hair_color)
#define MIN_CLOTH_COLOR (battle->bc->min_cloth_color)
#define MAX_CLOTH_COLOR (battle->bc->max_cloth_color)
+#define MIN_BODY_STYLE (battle->bc->min_body_style)
+#define MAX_BODY_STYLE (battle->bc->max_body_style)
#define is_boss(bl) (status_get_mode(bl)&MD_BOSS) // Can refine later [Aru]
@@ -529,9 +531,14 @@ struct Battle_Config {
int show_monster_hp_bar; // [Frost]
int fix_warp_hit_delay_abuse;
-
+
+ // Refine Def/Atk
int costume_refine_def, shadow_refine_def;
int shadow_refine_atk;
+
+ // BodyStyle
+ int min_body_style, max_body_style;
+ int save_body_style;
};
/* criteria for battle_config.idletime_critera */
diff --git a/src/map/clif.c b/src/map/clif.c
index a26fece79..053017a4a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1059,7 +1059,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
}
#endif
#if PACKETVER >= 20150513
- p.body = 0;
+ p.body = vd->body_style;
#endif
clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target);
@@ -1198,7 +1198,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
}
#endif
#if PACKETVER >= 20150513
- p.body = 0;
+ p.body = vd->body_style;
#endif
if( disguised(bl) ) {
nullpo_retv(sd);
@@ -1288,7 +1288,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
}
#endif
#if PACKETVER >= 20150513
- p.body = 0;
+ p.body = vd->body_style;
#endif
clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target);
@@ -1417,6 +1417,8 @@ bool clif_spawn(struct block_list *bl)
if (vd->cloth_color)
clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS);
+ if (vd->body_style)
+ clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS);
switch (bl->type) {
case BL_PC:
@@ -1681,6 +1683,8 @@ void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *u
if(vd->cloth_color)
clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS);
+ if (vd->body_style)
+ clif->refreshlook(bl,bl->id,LOOK_BODY2,vd->body_style,AREA_WOS);
switch(bl->type) {
case BL_PC:
@@ -3120,6 +3124,11 @@ void clif_changelook(struct block_list *bl,int type,int val)
vd->cloth_color = 0;
if (sd->sc.option&OPTION_OKTOBERFEST /* TODO: config? */)
vd->cloth_color = 0;
+ if (vd->body_style && (
+ sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS ||
+ sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK ||
+ sd->sc.option&OPTION_OKTOBERFEST))
+ vd->body_style = 0;
break;
case LOOK_HAIR:
vd->hair_style = val;
@@ -3177,6 +3186,14 @@ void clif_changelook(struct block_list *bl,int type,int val)
vd->robe = val;
#endif
break;
+ case LOOK_BODY2:
+ if (val && (
+ sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS ||
+ sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK ||
+ sd->sc.option&OPTION_OKTOBERFEST))
+ val = 0;
+ vd->body_style = val;
+ break;
}
// prevent leaking the presence of GM-hidden objects
@@ -4160,6 +4177,9 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
if (vd->cloth_color)
clif->refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF);
+ if (vd->body_style)
+ clif->refreshlook(&sd->bl,bl->id,LOOK_BODY2,vd->body_style,SELF);
+
switch (bl->type) {
case BL_PC:
{
@@ -8281,6 +8301,8 @@ void clif_refresh(struct map_session_data *sd)
if (sd->vd.cloth_color)
clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF);
+ if (sd->vd.body_style)
+ clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF);
if(homun_alive(sd->hd))
clif->send_homdata(sd,SP_ACK,0);
if( sd->md ) {
@@ -9124,6 +9146,8 @@ void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) {
if(sd->vd.cloth_color)
clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF);
+ if (sd->vd.body_style)
+ clif->refreshlook(&sd->bl,sd->bl.id,LOOK_BODY2,sd->vd.body_style,SELF);
// item
clif->inventorylist(sd); // inventory list first, otherwise deleted items in pc->checkitem show up as 'unknown item'
pc->checkitem(sd);
diff --git a/src/map/map.h b/src/map/map.h
index 896c12f23..7047feab6 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -486,6 +486,7 @@ enum look {
LOOK_BODY,
LOOK_FLOOR,
LOOK_ROBE,
+ LOOK_BODY2,
};
// used by map_setcell()
diff --git a/src/map/pc.c b/src/map/pc.c
index 1045a25be..b6b6787e9 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -596,6 +596,10 @@ int pc_makesavestatus(struct map_session_data *sd)
if(!battle_config.save_clothcolor)
sd->status.clothes_color=0;
+ if (!battle_config.save_body_style)
+ sd->status.body = 0;
+
+
//Only copy the Cart/Peco/Falcon options, the rest are handled via
//status change load/saving. [Skotlex]
#ifdef NEW_CARTS
@@ -1067,6 +1071,9 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
if( sd->status.clothes_color < MIN_CLOTH_COLOR || sd->status.clothes_color > MAX_CLOTH_COLOR ) {
sd->status.clothes_color = MIN_CLOTH_COLOR;
}
+ if (sd->status.body < MIN_BODY_STYLE || sd->status.body > MAX_BODY_STYLE) {
+ sd->status.body = MIN_BODY_STYLE;
+ }
//Initializations to null/0 unneeded since map_session_data was filled with 0 upon allocation.
if(!sd->status.hp) pc_setdead(sd);
@@ -8450,6 +8457,8 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); // move sprite update to prevent client crashes with incompatible equipment [Valaris]
if(sd->vd.cloth_color)
clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
+ if (sd->vd.body_style)
+ clif->changelook(&sd->bl,LOOK_BODY2,sd->vd.body_style);
//Update skill tree.
pc->calc_skilltree(sd);
@@ -8546,6 +8555,8 @@ int pc_changelook(struct map_session_data *sd,int type,int val)
clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
if (sd->vd.cloth_color)
clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
+ if (sd->vd.body_style)
+ clif->changelook(&sd->bl,LOOK_BODY2,sd->vd.body_style);
clif->skillinfoblock(sd);
return 0;
break;
@@ -8594,6 +8605,10 @@ int pc_changelook(struct map_session_data *sd,int type,int val)
case LOOK_ROBE:
sd->status.robe = val;
break;
+ case LOOK_BODY2:
+ val = cap_value(val, MIN_BODY_STYLE, MAX_BODY_STYLE);
+ sd->status.body=val;
+ break;
}
clif->changelook(&sd->bl,type,val);
return 0;
@@ -8690,6 +8705,8 @@ int pc_setoption(struct map_session_data *sd,int type)
clif->changelook(&sd->bl,LOOK_BASE,new_look);
if (sd->vd.cloth_color)
clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
+ if( sd->vd.body_style )
+ clif->changelook(&sd->bl,LOOK_BODY2,sd->vd.body_style);
clif->skillinfoblock(sd); // Skill list needs to be updated after base change.
return 0;
diff --git a/src/map/script.c b/src/map/script.c
index 3fa0f1fd8..04b4b6a32 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -14109,6 +14109,7 @@ BUILDIN(getlook)
case LOOK_SHIELD: val = sd->status.shield; break; //8
case LOOK_SHOES: break; //9
case LOOK_ROBE: val = sd->status.robe; break; //12
+ case LOOK_BODY2: val=sd->status.body; break; //13
}
script_pushint(st,val);
diff --git a/src/map/status.c b/src/map/status.c
index d88d163f0..e96b881dd 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -6525,6 +6525,7 @@ void status_set_viewdata(struct block_list *bl, int class_)
sd->vd.hair_color = cap_value(sd->status.hair_color,0,battle_config.max_hair_color);
sd->vd.cloth_color = cap_value(sd->status.clothes_color,0,battle_config.max_cloth_color);
sd->vd.robe = sd->status.robe;
+ sd->vd.body_style = sd->status.body;
sd->vd.sex = sd->status.sex;
if ( sd->vd.cloth_color ) {
@@ -6539,6 +6540,11 @@ void status_set_viewdata(struct block_list *bl, int class_)
if( sd->sc.option&OPTION_OKTOBERFEST /* TODO: config? */ )
sd->vd.cloth_color = 0;
}
+ if ( sd->vd.body_style && (
+ sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS ||
+ sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK ||
+ sd->sc.option&OPTION_OKTOBERFEST))
+ sd->vd.body_style = 0;
} else if (vd)
memcpy(&sd->vd, vd, sizeof(struct view_data));
else
@@ -9464,6 +9470,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
clif->changelook(bl,LOOK_WEAPON,0);
clif->changelook(bl,LOOK_SHIELD,0);
clif->changelook(bl,LOOK_CLOTHES_COLOR,vd->cloth_color);
+ clif->changelook(bl,LOOK_BODY2,0);
break;
case SC_KAAHI:
val4 = INVALID_TIMER;
@@ -9869,6 +9876,17 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
calc_flag&=~SCB_DYE;
}
+#if 0 //Currently No SC's use this
+ if (calc_flag&SCB_BODY) {
+ //Reset Body Style
+ if (vd && vd->body_style) {
+ val4 = vd->body_style;
+ clif->changelook(bl,LOOK_BODY2,0);
+ }
+ calc_flag&=~SCB_BODY;
+ }
+#endif
+
if(!(flag&SCFLAG_NOICON) && !(flag&SCFLAG_LOADED && status->dbs->DisplayType[type]))
clif->status_change(bl,status->dbs->IconChangeTable[type],1,tick,(val_flag&1)?val1:1,(val_flag&2)?val2:0,(val_flag&4)?val3:0);
@@ -10752,6 +10770,14 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
calc_flag&=~SCB_DYE;
}
+#if 0 // Currently No SC's use this
+ if (calc_flag&SCB_BODY) { // Restore Body color
+ if (vd && !vd->body_style && sce->val4)
+ clif->changelook(bl,LOOK_BODY2,sce->val4);
+ calc_flag&=~SCB_BODY;
+ }
+#endif
+
//On Aegis, when turning off a status change, first goes the sc packet, then the option packet.
clif->sc_end(bl,bl->id,AREA,status->dbs->IconChangeTable[type]);
@@ -10765,6 +10791,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
clif->changelook(bl,LOOK_WEAPON,sd->vd.weapon);
clif->changelook(bl,LOOK_SHIELD,sd->vd.shield);
clif->changelook(bl,LOOK_CLOTHES_COLOR,cap_value(sd->status.clothes_color,0,battle_config.max_cloth_color));
+ clif->changelook(bl,LOOK_BODY2,cap_value(sd->status.body,0,battle_config.max_body_style));
}
}
diff --git a/src/map/status.h b/src/map/status.h
index 90b05c71c..55df4cdab 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1923,6 +1923,9 @@ enum scb_flag
SCB_RANGE = 0x10000000,
SCB_REGEN = 0x20000000,
SCB_DYE = 0x40000000, // force cloth-dye change to 0 to avoid client crashes.
+#if 0 // Currently No SC use it. Also, when this will be implemented, there will be need to change to 64bit variable
+ SCB_BODY = 0x80000000, // Force bodysStyle change to 0
+#endif
SCB_BATTLE = 0x3FFFFFFE,
SCB_ALL = 0x3FFFFFFF
diff --git a/src/map/unit.h b/src/map/unit.h
index f0933aa9a..0279d73c1 100644
--- a/src/map/unit.h
+++ b/src/map/unit.h
@@ -93,7 +93,8 @@ struct view_data {
head_bottom,
hair_style,
hair_color,
- cloth_color;
+ cloth_color,
+ body_style;
char sex;
unsigned dead_sit : 2;
};