From f5114ec39330bb8afd756313827b4ab565736d6c Mon Sep 17 00:00:00 2001 From: shennetsind Date: Wed, 21 Dec 2011 05:07:39 +0000 Subject: Added Official Costume (Style Tab) Headgear Support git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15194 54d463be-8e91-2dee-dedb-b68131a5f0ec --- doc/item_db.txt | 24 +++++++++++++----------- src/map/pc.c | 51 ++++++++++++++++++++++++++++++++++++++++++++------- src/map/pc.h | 8 +++++++- 3 files changed, 64 insertions(+), 19 deletions(-) diff --git a/doc/item_db.txt b/doc/item_db.txt index 51bcdf8e4..767ec16ac 100644 --- a/doc/item_db.txt +++ b/doc/item_db.txt @@ -75,17 +75,19 @@ Upper: Equippable upper-types. Uses the following bitmasks: Gender: Gender restriction. 0 is female, 1 is male, 2 for both. Loc: Equipment's placement. Values are: - - 2^8 256 = Upper Headgear - 2^9 512 = Middle Headgear - 2^0 001 = Lower Headgear - 2^4 016 = Armor - 2^1 002 = Weapon - 2^5 032 = Shield - 2^2 004 = Garment - 2^6 064 = Footgear - 2^3 008 = Accessory 1 - 2^7 128 = Accessory 2 + 2^12 4096 = Costume Low Headgear + 2^11 2048 = Costume Mid Headgear + 2^10 1024 = Costume Top Headgear + 2^8 256 = Upper Headgear + 2^9 512 = Middle Headgear + 2^0 001 = Lower Headgear + 2^4 016 = Armor + 2^1 002 = Weapon + 2^5 032 = Shield + 2^2 004 = Garment + 2^6 064 = Footgear + 2^3 008 = Accessory 1 + 2^7 128 = Accessory 2 wLV: Weapon level. diff --git a/src/map/pc.c b/src/map/pc.c index d06e1253d..8070af500 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -59,7 +59,7 @@ struct fame_list smith_fame_list[MAX_FAME_LIST]; struct fame_list chemist_fame_list[MAX_FAME_LIST]; struct fame_list taekwon_fame_list[MAX_FAME_LIST]; -static unsigned short equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_AMMO}; +static unsigned short equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_LOW,EQP_AMMO}; #define MOTD_LINE_SIZE 128 static char motd_text[MOTD_LINE_SIZE][CHAT_SIZE_MAX]; // Message of the day buffer [Valaris] @@ -7377,27 +7377,48 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) } //Added check to prevent sending the same look on multiple slots -> //causes client to redraw item on top of itself. (suggested by Lupus) - if(pos & EQP_HEAD_LOW) { + if(pos & EQP_HEAD_LOW && pc_checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1) { if(id && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID))) sd->status.head_bottom = id->look; else sd->status.head_bottom = 0; clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom); } - if(pos & EQP_HEAD_TOP) { + if(pos & EQP_HEAD_TOP && pc_checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1) { if(id) sd->status.head_top = id->look; else sd->status.head_top = 0; clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); } - if(pos & EQP_HEAD_MID) { + if(pos & EQP_HEAD_MID && pc_checkequip(sd,EQP_COSTUME_HEAD_MID) == -1) { if(id && !(pos&EQP_HEAD_TOP)) sd->status.head_mid = id->look; else sd->status.head_mid = 0; clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid); } + if(pos & EQP_COSTUME_HEAD_TOP) { + if(id){ + sd->status.head_top = id->look; + } else + sd->status.head_top = 0; + clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); + } + if(pos & EQP_COSTUME_HEAD_MID) { + if(id && !(pos&EQP_HEAD_TOP)){ + sd->status.head_mid = id->look; + } else + sd->status.head_mid = 0; + clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid); + } + if(pos & EQP_COSTUME_HEAD_LOW) { + if(id && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID))){ + sd->status.head_bottom = id->look; + } else + sd->status.head_bottom = 0; + clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom); + } if(pos & EQP_SHOES) clif_changelook(&sd->bl,LOOK_SHOES,0); if( pos&EQP_GARMENT ) @@ -7481,18 +7502,34 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) pc_calcweapontype(sd); clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield); } - if(sd->status.inventory[n].equip & EQP_HEAD_LOW) { + if(sd->status.inventory[n].equip & EQP_HEAD_LOW && pc_checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1 ) { sd->status.head_bottom = 0; clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom); } - if(sd->status.inventory[n].equip & EQP_HEAD_TOP) { + if(sd->status.inventory[n].equip & EQP_HEAD_TOP && pc_checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1 ) { sd->status.head_top = 0; clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); } - if(sd->status.inventory[n].equip & EQP_HEAD_MID) { + if(sd->status.inventory[n].equip & EQP_HEAD_MID && pc_checkequip(sd,EQP_COSTUME_HEAD_MID) == -1 ) { sd->status.head_mid = 0; clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid); } + + if(sd->status.inventory[n].equip & EQP_COSTUME_HEAD_TOP) { + sd->status.head_top = ( pc_checkequip(sd,EQP_HEAD_TOP) >= 0 ) ? sd->inventory_data[pc_checkequip(sd,EQP_HEAD_TOP)]->look : 0; + clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); + } + + if(sd->status.inventory[n].equip & EQP_COSTUME_HEAD_MID) { + sd->status.head_mid = ( pc_checkequip(sd,EQP_HEAD_MID) >= 0 ) ? sd->inventory_data[pc_checkequip(sd,EQP_HEAD_MID)]->look : 0; + clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid); + } + + if(sd->status.inventory[n].equip & EQP_COSTUME_HEAD_LOW) { + sd->status.head_bottom = ( pc_checkequip(sd,EQP_HEAD_LOW) >= 0 ) ? sd->inventory_data[pc_checkequip(sd,EQP_HEAD_LOW)]->look : 0; + clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_bottom); + } + if(sd->status.inventory[n].equip & EQP_SHOES) clif_changelook(&sd->bl,LOOK_SHOES,0); if( sd->status.inventory[n].equip&EQP_GARMENT ) diff --git a/src/map/pc.h b/src/map/pc.h index 492c21e99..526e96fe3 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -164,7 +164,7 @@ struct map_session_data { struct registry save_reg; struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) - short equip_index[11]; + short equip_index[14]; unsigned int weight,max_weight; int cart_weight,cart_num; int fd; @@ -525,6 +525,9 @@ enum equip_pos { EQP_GARMENT = 0x0004, EQP_ACC_L = 0x0008, EQP_ACC_R = 0x0080, //128 + EQP_COSTUME_HEAD_TOP = 0x0400, + EQP_COSTUME_HEAD_MID = 0x0800, + EQP_COSTUME_HEAD_LOW = 0x1000, EQP_AMMO = 0x8000, //32768 }; @@ -554,6 +557,9 @@ enum equip_index { EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, + EQI_COSTUME_TOP, + EQI_COSTUME_MID, + EQI_COSTUME_LOW, EQI_AMMO, EQI_MAX }; -- cgit v1.2.3-70-g09d2