Costume System cleanup.

- Cleaned up overall system to work like officials.
- Added costume atcommand to easily enable/disable costumes.
This commit is contained in:
aleos89 2014-04-03 11:26:38 -04:00
parent 2fe8140f96
commit 0081e25922
9 changed files with 154 additions and 108 deletions

View File

@ -120,19 +120,19 @@ save_clothcolor: yes
// pack doesn't has wedding palettes (or has less than the other jobs)
wedding_ignorepalette: no
// Do not display cloth colors for the Xmas class?
// Do not display cloth colors for the Xmas costume?
// Set this to yes if your cloth palettes pack doesn't have Xmas palettes (or has less than the other jobs)
xmas_ignorepalette: no
// Do not display cloth colors for the Summer class?
// Do not display cloth colors for the Summer costume?
// Set this to yes if your cloth palettes pack doesn't have Summer palettes (or has less than the other jobs)
summer_ignorepalette: no
// Do not display cloth colors for the Hanbok class?
// Do not display cloth colors for the Hanbok costume?
// Set this to yes if your cloth palettes pack doesn't have Hanbok palettes (or has less than the other jobs)
hanbok_ignorepalette: no
// Do not display cloth colors for the Oktoberfest class?
// Do not display cloth colors for the Oktoberfest costume?
// Set this to yes if your cloth palettes pack doesn't have Oktoberfest palettes (or has less than the other jobs)
oktoberfest_ignorepalette: no

View File

@ -1561,5 +1561,12 @@
1499: Character cannot be disguised while in monster form.
1500: Transforming into monster is not allowed in Guild Wars.
// @costume
1501: '%s' is not a known costume
1502: You're already with a '%s' costume, type '@costume' to remove it.
1503: -- %s
1504: - Available Costumes
1505: Costume '%s' removed.
//Custom translations
//import: conf/msg_conf/import/map_msg_eng_conf.txt

View File

@ -1594,7 +1594,7 @@
2773,Krieger_Ring2,Glorious Mass-Production Ring,4,20,,0,,0,,0,0xFFFFFFFE,7,2,136,,61,0,0,{ bonus bAllStats,2; },{},{}
2774,Krieger_Ring3,Glorious Popularized Ring,4,20,,0,,0,,0,0xFFFFFFFE,7,2,136,,0,0,0,{ bonus bAllStats,1; },{},{}
2775,Lure,Lure,4,20,,100,,0,,0,0xFFFFFFFF,7,2,136,,0,0,0,{},{},{}
2776,Cool_Towel,Adventurer's Trusty Towel,4,20,,100,,,,0,0xFFFFFFFF,7,2,136,,0,0,0,{},{ setoption Option_Summer,1; },{ setoption Option_Summer,0; }
2776,Cool_Towel,Adventurer's Trusty Towel,4,20,,100,,,,0,0xFFFFFFFF,7,2,136,,0,0,0,{},{ sc_start SC_SUMMER,-1,0; },{ sc_end SC_SUMMER; }
2777,Shaman_Ring,Shaman Ring,4,20,,100,,0,,1,0xFFFFFFFF,7,2,136,,30,0,0,{ bonus bUseSPrate,-5; },{},{}
2778,Shaman_Earing,Shaman Earrings,4,20,,100,,0,,0,0xFFFFFFFF,7,2,136,,30,0,0,{ bonus bInt,2; },{},{}
2779,Dark_Knight_Belt,Dark Knight Belt,4,20,,500,,1,,0,0xFFFFFFFF,7,2,136,,30,0,0,{ bonus bStr,2; bonus bAgi,1; },{},{}

View File

@ -1830,7 +1830,7 @@
2773,Krieger_Ring2,Glorious Mass-Production Ring,4,20,,0,,0,,0,0xFFFFFFFE,63,2,136,,61,0,0,{ bonus bAllStats,2; },{},{}
2774,Krieger_Ring3,Glorious Popularized Ring,4,20,,0,,0,,0,0xFFFFFFFE,63,2,136,,0,0,0,{ bonus bAllStats,1; },{},{}
2775,Lure,Lure,4,20,,100,,0,,0,0xFFFFFFFF,63,2,136,,0,0,0,{},{},{}
2776,Cool_Towel,Adventurer's Trusty Towel,4,20,,100,,,,0,0xFFFFFFFF,63,2,136,,0,0,0,{},{ setoption Option_Summer,1; },{ setoption Option_Summer,0; }
2776,Cool_Towel,Adventurer's Trusty Towel,4,20,,100,,,,0,0xFFFFFFFF,63,2,136,,0,0,0,{},{ sc_start SC_SUMMER,-1,0; },{ sc_end SC_SUMMER; }
2777,Shaman_Ring,Shaman Ring,4,20,,100,,0,,1,0xFFFFFFFF,63,2,136,,30,0,0,{ bonus bUseSPrate,-5; },{},{}
2778,Shaman_Earing,Shaman Earrings,4,20,,100,,0,,0,0xFFFFFFFF,63,2,136,,30,0,0,{ bonus bInt,2; },{},{}
2779,Dark_Knight_Belt,Dark Knight Belt,4,20,,500,,1,,0,0xFFFFFFFF,63,2,136,,30,0,0,{ bonus bStr,2; bonus bAgi,1; },{},{}

View File

@ -9397,6 +9397,64 @@ ACMD_FUNC(fullstrip) {
return 0;
}
ACMD_FUNC(costume) {
const char* names[] = {
"Wedding",
"Xmas",
"Summer",
"Hanbok",
"Oktoberfest",
};
const int name2id[] = {
SC_WEDDING,
SC_XMAS,
SC_SUMMER,
SC_HANBOK,
SC_OKTOBERFEST
};
unsigned short k = 0, len = ARRAYLENGTH(names);
if( !message || !*message ) {
for( k = 0; k < len; k++ ) {
if( sd->sc.data[name2id[k]] ) {
sprintf(atcmd_output, msg_txt(sd, 1505), names[k]); // Costume '%s' removed.
clif_displaymessage(sd->fd, atcmd_output);
status_change_end(&sd->bl, (sc_type)name2id[k], INVALID_TIMER);
return 0;
}
}
clif_displaymessage(sd->fd, msg_txt(sd, 1504)); // Available Costumes
for( k = 0; k < len; k++ ) {
sprintf(atcmd_output, msg_txt(sd, 1503), names[k]); // -- %s
clif_displaymessage(sd->fd, atcmd_output);
}
return -1;
}
for( k = 0; k < len; k++ ) {
if( sd->sc.data[name2id[k]] ) {
sprintf(atcmd_output, msg_txt(sd, 1502), names[k]); // You're already with a '%s' costume, type '@costume' to remove it.
clif_displaymessage(sd->fd, atcmd_output);
return -1;
}
}
for( k = 0; k < len; k++ )
if( strcmpi(message, names[k]) == 0 )
break;
if( k == len ) {
sprintf(atcmd_output, msg_txt(sd, 1501), message); // '%s' is not a known costume
clif_displaymessage(sd->fd, atcmd_output);
return -1;
}
sc_start(&sd->bl, &sd->bl, (sc_type)name2id[k], 100, 0, -1);
return 0;
}
#include "../custom/atcommand.inc"
/**
@ -9684,6 +9742,7 @@ void atcommand_basecommands(void) {
ACMD_DEF(showrate),
#endif
ACMD_DEF(fullstrip),
ACMD_DEF(costume),
};
AtCommandInfo* atcommand;
int i;

View File

@ -3080,17 +3080,26 @@ void clif_changelook(struct block_list *bl,int type,int val)
else vd->shield = val;
break;
case LOOK_BASE:
vd->class_ = val;
if (vd->class_ == JOB_WEDDING || vd->class_ == JOB_XMAS || vd->class_ == JOB_SUMMER || vd->class_ == JOB_HANBOK || vd->class_ == JOB_OKTOBERFEST)
if (!sd) break;
if (sd->sc.option&OPTION_COSTUME)
vd->weapon = vd->shield = 0;
if (vd->cloth_color && (
(vd->class_ == JOB_WEDDING && battle_config.wedding_ignorepalette) ||
(vd->class_ == JOB_XMAS && battle_config.xmas_ignorepalette) ||
(vd->class_ == JOB_SUMMER && battle_config.summer_ignorepalette) ||
(vd->class_ == JOB_HANBOK && battle_config.hanbok_ignorepalette) ||
(vd->class_ == JOB_OKTOBERFEST && battle_config.oktoberfest_ignorepalette)
))
clif_changelook(bl,LOOK_CLOTHES_COLOR,0);
if (!vd->cloth_color)
break;
if (sd) {
if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette)
vd->cloth_color = 0;
if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette)
vd->cloth_color = 0;
if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette)
vd->cloth_color = 0;
if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette)
vd->cloth_color = 0;
if (sd->sc.option&OPTION_OKTOBERFEST && battle_config.oktoberfest_ignorepalette)
vd->cloth_color = 0;
}
break;
case LOOK_HAIR:
vd->hair_style = val;
@ -3108,14 +3117,18 @@ void clif_changelook(struct block_list *bl,int type,int val)
vd->hair_color = val;
break;
case LOOK_CLOTHES_COLOR:
if (val && (
(vd->class_ == JOB_WEDDING && battle_config.wedding_ignorepalette) ||
(vd->class_ == JOB_XMAS && battle_config.xmas_ignorepalette) ||
(vd->class_ == JOB_SUMMER && battle_config.summer_ignorepalette) ||
(vd->class_ == JOB_HANBOK && battle_config.hanbok_ignorepalette) ||
(vd->class_ == JOB_OKTOBERFEST && battle_config.oktoberfest_ignorepalette)
))
if (val && sd) {
if (sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette)
val = 0;
if (sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette)
val = 0;
if (sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette)
val = 0;
if (sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette)
val = 0;
if (sd->sc.option&OPTION_OKTOBERFEST && battle_config.oktoberfest_ignorepalette)
val = 0;
}
vd->cloth_color = val;
break;
case LOOK_SHOES:
@ -10255,6 +10268,9 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
if( sd->sc.option&OPTION_COSTUME )
return;
if( sd->sc.option&OPTION_COSTUME )
return;
if( sd->sc.data[SC_BASILICA] || sd->sc.data[SC__SHADOWFORM] )
return;

View File

@ -140,8 +140,8 @@ enum {
MAPID_XMAS,
MAPID_SUMMER,
MAPID_HANBOK,
MAPID_OKTOBERFEST,
MAPID_GANGSI,
MAPID_OKTOBERFEST,
//2-1 Jobs
MAPID_SUPER_NOVICE = JOBL_2_1|0x0,
MAPID_KNIGHT,

View File

@ -5341,8 +5341,8 @@ int pc_jobid2mapid(unsigned short b_class)
case JOB_XMAS: return MAPID_XMAS;
case JOB_SUMMER: return MAPID_SUMMER;
case JOB_HANBOK: return MAPID_HANBOK;
case JOB_OKTOBERFEST: return MAPID_OKTOBERFEST;
case JOB_GANGSI: return MAPID_GANGSI;
case JOB_OKTOBERFEST: return MAPID_OKTOBERFEST;
//2-1 Jobs
case JOB_SUPER_NOVICE: return MAPID_SUPER_NOVICE;
case JOB_KNIGHT: return MAPID_KNIGHT;
@ -5485,8 +5485,8 @@ int pc_mapid2jobid(unsigned short class_, int sex)
case MAPID_XMAS: return JOB_XMAS;
case MAPID_SUMMER: return JOB_SUMMER;
case MAPID_HANBOK: return JOB_HANBOK;
case MAPID_OKTOBERFEST: return JOB_OKTOBERFEST;
case MAPID_GANGSI: return JOB_GANGSI;
case MAPID_OKTOBERFEST: return JOB_OKTOBERFEST;
//2-1 Jobs
case MAPID_SUPER_NOVICE: return JOB_SUPER_NOVICE;
case MAPID_KNIGHT: return JOB_KNIGHT;
@ -8052,31 +8052,6 @@ void pc_setoption(struct map_session_data *sd,int type)
else if (!(type&OPTION_FLYING) && p_type&OPTION_FLYING)
new_look = -1;
if (type&OPTION_WEDDING && !(p_type&OPTION_WEDDING))
new_look = JOB_WEDDING;
else if (!(type&OPTION_WEDDING) && p_type&OPTION_WEDDING)
new_look = -1;
if (type&OPTION_XMAS && !(p_type&OPTION_XMAS))
new_look = JOB_XMAS;
else if (!(type&OPTION_XMAS) && p_type&OPTION_XMAS)
new_look = -1;
if (type&OPTION_SUMMER && !(p_type&OPTION_SUMMER))
new_look = JOB_SUMMER;
else if (!(type&OPTION_SUMMER) && p_type&OPTION_SUMMER)
new_look = -1;
if (type&OPTION_HANBOK && !(p_type&OPTION_HANBOK))
new_look = JOB_HANBOK;
else if (!(type&OPTION_HANBOK) && p_type&OPTION_HANBOK)
new_look = -1;
if (type&OPTION_OKTOBERFEST && !(p_type&OPTION_OKTOBERFEST))
new_look = JOB_OKTOBERFEST;
else if (!(type&OPTION_OKTOBERFEST) && p_type&OPTION_OKTOBERFEST)
new_look = -1;
if (sd->disguise || !new_look)
return; //Disguises break sprite changes

View File

@ -6812,17 +6812,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_WEDDING)
class_ = JOB_WEDDING;
else if (sd->sc.option&OPTION_SUMMER)
class_ = JOB_SUMMER;
else if (sd->sc.option&OPTION_XMAS)
class_ = JOB_XMAS;
else if (sd->sc.option&OPTION_HANBOK)
class_ = JOB_HANBOK;
else if (sd->sc.option&OPTION_OKTOBERFEST)
class_ = JOB_OKTOBERFEST;
else if (sd->sc.option&OPTION_RIDING) {
if (sd->sc.option&OPTION_RIDING) {
switch (class_) { // Adapt class to a Mounted one.
case JOB_KNIGHT:
class_ = JOB_KNIGHT2;
@ -6853,6 +6843,19 @@ 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.sex = sd->status.sex;
if (sd->vd.cloth_color) {
if(sd->sc.option&OPTION_WEDDING && battle_config.wedding_ignorepalette)
sd->vd.cloth_color = 0;
if(sd->sc.option&OPTION_XMAS && battle_config.xmas_ignorepalette)
sd->vd.cloth_color = 0;
if(sd->sc.option&OPTION_SUMMER && battle_config.summer_ignorepalette)
sd->vd.cloth_color = 0;
if(sd->sc.option&OPTION_HANBOK && battle_config.hanbok_ignorepalette)
sd->vd.cloth_color = 0;
if(sd->sc.option&OPTION_OKTOBERFEST && battle_config.oktoberfest_ignorepalette)
sd->vd.cloth_color = 0;
}
} else if (vd)
memcpy(&sd->vd, vd, sizeof(struct view_data));
else
@ -6922,15 +6925,6 @@ void status_set_viewdata(struct block_list *bl, int class_)
}
break;
}
vd = status_get_viewdata(bl);
if (vd && vd->cloth_color && (
(vd->class_==JOB_WEDDING && battle_config.wedding_ignorepalette)
|| (vd->class_==JOB_XMAS && battle_config.xmas_ignorepalette)
|| (vd->class_==JOB_SUMMER && battle_config.summer_ignorepalette)
|| (vd->class_ == JOB_HANBOK && battle_config.hanbok_ignorepalette)
|| (vd->class_ == JOB_OKTOBERFEST && battle_config.oktoberfest_ignorepalette)
))
vd->cloth_color = 0;
}
/**
@ -8444,15 +8438,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
case SC_OKTOBERFEST:
if (!vd) return 0;
// Store previous values as they could be removed.
val1 = vd->class_;
val2 = vd->weapon;
val3 = vd->shield;
val4 = vd->cloth_color;
unit_stop_attack(bl);
clif_changelook(bl,LOOK_WEAPON,0);
clif_changelook(bl,LOOK_SHIELD,0);
clif_changelook(bl,LOOK_BASE,type==SC_WEDDING?JOB_WEDDING:type==SC_XMAS?JOB_XMAS:type==SC_SUMMER?JOB_SUMMER:type==SC_HANBOK?JOB_HANBOK:JOB_OKTOBERFEST);
clif_changelook(bl,LOOK_CLOTHES_COLOR,vd->cloth_color);
break;
case SC_NOCHAT:
// !FIXME: is this correct? a hardcoded interval of 60sec? what about configuration ?_?
@ -9743,10 +9729,12 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
case SC_SUMMER:
case SC_HANBOK:
case SC_OKTOBERFEST:
if( !vd )
break;
clif_changelook(bl,LOOK_BASE,vd->class_);
clif_changelook(bl,LOOK_WEAPON,0);
clif_changelook(bl,LOOK_SHIELD,0);
clif_changelook(bl,LOOK_BASE,type==SC_WEDDING?JOB_WEDDING:type==SC_XMAS?JOB_XMAS:type==SC_SUMMER?JOB_SUMMER:type==SC_HANBOK?JOB_HANBOK:JOB_OKTOBERFEST);
clif_changelook(bl,LOOK_CLOTHES_COLOR,val4);
clif_changelook(bl,LOOK_CLOTHES_COLOR,vd->cloth_color);
break;
case SC_KAAHI:
val4 = INVALID_TIMER;
@ -10028,18 +10016,23 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
break;
case SC_WEDDING:
sc->option |= OPTION_WEDDING;
opt_flag |= 0x4;
break;
case SC_XMAS:
sc->option |= OPTION_XMAS;
opt_flag |= 0x4;
break;
case SC_SUMMER:
sc->option |= OPTION_SUMMER;
opt_flag |= 0x4;
break;
case SC_HANBOK:
sc->option |= OPTION_HANBOK;
opt_flag |= 0x4;
break;
case SC_OKTOBERFEST:
sc->option |= OPTION_OKTOBERFEST;
opt_flag |= 0x4;
break;
case SC_ORCISH:
sc->option |= OPTION_ORCISH;
@ -10052,9 +10045,15 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
}
// On Aegis, when turning on a status change, first goes the option packet, then the sc packet.
if(opt_flag)
if(opt_flag) {
clif_changeoption(bl);
if(sd && (opt_flag&0x4)) {
clif_changelook(bl,LOOK_BASE,vd->class_);
clif_changelook(bl,LOOK_WEAPON,0);
clif_changelook(bl,LOOK_SHIELD,0);
clif_changelook(bl,LOOK_CLOTHES_COLOR,vd->cloth_color);
}
}
if (calc_flag&SCB_DYE) { // Reset DYE color
if (vd && vd->cloth_color) {
val4 = vd->cloth_color;
@ -10252,8 +10251,13 @@ int status_change_clear(struct block_list* bl, int type)
case SC_S_LIFEPOTION:
case SC_L_LIFEPOTION:
case SC_PUSH_CART:
case SC_ALL_RIDING:
case SC_STYLE_CHANGE:
case SC_MOONSTAR:
case SC_SUPER_STAR:
case SC_HEAT_BARREL_AFTER:
case SC_STRANGELIGHTS:
case SC_DECORATION_OF_MUSIC:
case SC_QUEST_BUFF1:
case SC_QUEST_BUFF2:
case SC_QUEST_BUFF3:
@ -10266,8 +10270,12 @@ int status_change_clear(struct block_list* bl, int type)
case SC_WEIGHT90:
case SC_NOCHAT:
case SC_PUSH_CART:
case SC_ALL_RIDING:
case SC_STYLE_CHANGE:
case SC_MOONSTAR:
case SC_SUPER_STAR:
case SC_STRANGELIGHTS:
case SC_DECORATION_OF_MUSIC:
continue;
}
}
@ -10389,30 +10397,6 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
if(bl->type == BL_PC)
skill_break_equip(bl,bl,EQP_WEAPON,10000,BCT_SELF);
break;
case SC_WEDDING:
case SC_XMAS:
case SC_SUMMER:
case SC_HANBOK:
case SC_OKTOBERFEST:
if (!vd) break;
if (sd) {
// Load data from sd->status.* as the stored values could have changed.
// Must remove OPTION to prevent class being rechanged.
sc->option &= type==SC_WEDDING?~OPTION_WEDDING:type==SC_XMAS?~OPTION_XMAS:type==SC_SUMMER?~OPTION_SUMMER:type==SC_HANBOK?~OPTION_HANBOK:~OPTION_OKTOBERFEST;
clif_changeoption(&sd->bl);
status_set_viewdata(bl, sd->status.class_);
} else {
vd->class_ = sce->val1;
vd->weapon = sce->val2;
vd->shield = sce->val3;
vd->cloth_color = sce->val4;
}
clif_changelook(bl,LOOK_BASE,vd->class_);
clif_changelook(bl,LOOK_CLOTHES_COLOR,vd->cloth_color);
clif_changelook(bl,LOOK_WEAPON,vd->weapon);
clif_changelook(bl,LOOK_SHIELD,vd->shield);
if(sd) clif_skillinfoblock(sd);
break;
case SC_RUN:
{
struct unit_data *ud = unit_bl2ud(bl);
@ -10879,18 +10863,23 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_WEDDING:
sc->option &= ~OPTION_WEDDING;
opt_flag |= 0x4;
break;
case SC_XMAS:
sc->option &= ~OPTION_XMAS;
opt_flag |= 0x4;
break;
case SC_SUMMER:
sc->option &= ~OPTION_SUMMER;
opt_flag |= 0x4;
break;
case SC_HANBOK:
sc->option &= ~OPTION_HANBOK;
opt_flag |= 0x4;
break;
case SC_OKTOBERFEST:
sc->option &= ~OPTION_OKTOBERFEST;
opt_flag |= 0x4;
break;
case SC_ORCISH:
sc->option &= ~OPTION_ORCISH;