Index: atcommand.c
===================================================================
--- atcommand.c (revision 12624)
+++ atcommand.c (working copy)
@@ -1112,7 +1112,7 @@
ACMD(item)
{
char item_name[100];
- int number = 0, item_id, flag = 0;
+ int number = 0, item_id, flag = 0, costume = 0;
struct item item_tmp;
struct item_data *item_data;
int get_count, i;
@@ -1138,6 +1138,26 @@
return false;
}
+ if( !strcmpi(command+1,"costumeitem") )
+ {
+ if( !battle_config.reserved_costume_id )
+ {
+ clif->message(fd, "Costume conversion is disable. Set a value for reserved_cosutme_id on your battle.conf file.");
+ return -1;
+ }
+ if( !(item_data->equip&EQP_HEAD_LOW) &&
+ !(item_data->equip&EQP_HEAD_MID) &&
+ !(item_data->equip&EQP_HEAD_TOP) &&
+ !(item_data->equip&EQP_COSTUME_HEAD_LOW) &&
+ !(item_data->equip&EQP_COSTUME_HEAD_MID) &&
+ !(item_data->equip&EQP_COSTUME_HEAD_TOP) )
+ {
+ clif->message(fd, "You cannot costume this item. Costume only work for headgears.");
+ return -1;
+ }
+ costume = 1;
+ }
+
item_id = item_data->nameid;
get_count = number;
//Check if it's stackable.
@@ -1151,6 +1171,14 @@
item_tmp.nameid = item_id;
item_tmp.identify = 1;
+ if( costume == 1 )
+ { // Costume Item
+ item_tmp.card[0] = CARD0_CREATE;
+ item_tmp.card[2] = GetWord(battle_config.reserved_costume_id, 0);
+ item_tmp.card[3] = GetWord(battle_config.reserved_costume_id, 1);
+ }
+
+
if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
}
@@ -9671,6 +9699,7 @@
ACMD_DEF(searchstore),
ACMD_DEF(costume),
ACMD_DEF(skdebug),
+ ACMD_DEF2("costumeitem", item)
};
AtCommandInfo* cmd;
int i;
Index: battle.c
===================================================================
--- battle.c (revision 12624)
+++ battle.c (working copy)
@@ -6476,6 +6476,7 @@
{ "guild_notice_changemap", &battle_config.guild_notice_changemap, 2, 0, 2, },
{ "feature.banking", &battle_config.feature_banking, 1, 0, 1, },
{ "feature.auction", &battle_config.feature_auction, 0, 0, 2, },
+ { "reserved_costume_id", &battle_config.reserved_costume_id, 999998, 0, INT_MAX, },
};
Index: battle.h
===================================================================
--- battle.h (revision 12624)
+++ battle.h (working copy)
@@ -446,6 +446,9 @@
int min_npc_vendchat_distance;
int atcommand_mobinfo_type;
+ // Costume System
+ int reserved_costume_id;
+
int mob_size_influence; // Enable modifications on earned experience, drop rates and monster status depending on monster size. [mkbu95]
/** Hercules **/
Index: map.c
===================================================================
--- map.c (revision 12624)
+++ map.c (working copy)
@@ -1570,6 +1570,13 @@
nullpo_retv(sd);
+
+ if( battle_config.reserved_costume_id && battle_config.reserved_costume_id == charid )
+ {
+ clif->solved_charname(sd->fd, charid, "Costume");
+ return;
+ }
+
tsd = map->charid2sd(charid);
if( tsd ) {
clif->solved_charname(sd->fd, charid, tsd->status.name);
Index: pc.c
===================================================================
--- pc.c (revision 12624)
+++ pc.c (working copy)
@@ -594,8 +594,8 @@
int pc_equippoint(struct map_session_data *sd,int n)
{
- int ep = 0;
-
+ int ep = 0, char_id = 0;
+
nullpo_ret(sd);
if(!sd->inventory_data[n])
@@ -611,6 +611,15 @@
if(ep == EQP_HAND_R && (pc->checkskill(sd,AS_LEFT) > 0 || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN ||
(sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO))//Kagerou and Oboro can dual wield daggers. [Rytech]
return EQP_ARMS;
+ }
+
+ if( battle_config.reserved_costume_id &&
+ sd->status.inventory[n].card[0] == CARD0_CREATE &&
+ (char_id = MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3])) == battle_config.reserved_costume_id )
+ { // Costume Item - Converted
+ if( ep&EQP_HEAD_TOP ) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
+ if( ep&EQP_HEAD_LOW ) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
+ if( ep&EQP_HEAD_MID ) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
}
return ep;
}
@@ -1928,8 +1937,8 @@
if( autobonus[i].bonus_script )
{
int j;
- ARR_FIND( 0, EQI_MAX-1, j, sd->equip_index[j] >= 0 && sd->status.inventory[sd->equip_index[j]].equip == autobonus[i].pos );
- if( j < EQI_MAX-1 )
+ ARR_FIND( 0, EQI_MAX_BONUS, j, sd->equip_index[j] >= 0 && sd->status.inventory[sd->equip_index[j]].equip == autobonus[i].pos );
+ if( j < EQI_MAX_BONUS )
script->run_autobonus(autobonus[i].bonus_script,sd->bl.id,sd->equip_index[j]);
}
continue;
@@ -1959,8 +1968,8 @@
if( autobonus->other_script )
{
int j;
- ARR_FIND( 0, EQI_MAX-1, j, sd->equip_index[j] >= 0 && sd->status.inventory[sd->equip_index[j]].equip == autobonus->pos );
- if( j < EQI_MAX-1 )
+ ARR_FIND( 0, EQI_MAX_BONUS, j, sd->equip_index[j] >= 0 && sd->status.inventory[sd->equip_index[j]].equip == autobonus->pos );
+ if( j < EQI_MAX_BONUS )
script->run_autobonus(autobonus->other_script,sd->bl.id,sd->equip_index[j]);
}
@@ -10185,9 +10194,10 @@
{ SG_MOON_ANGER, SG_MOON_BLESS, SG_MOON_COMFORT, "PC_FEEL_MOON", "PC_HATE_MOB_MOON", is_day_of_moon },
{ SG_STAR_ANGER, SG_STAR_BLESS, SG_STAR_COMFORT, "PC_FEEL_STAR", "PC_HATE_MOB_STAR", is_day_of_star }
};
- 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_COSTUME_GARMENT,EQP_AMMO};
+// 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_COSTUME_GARMENT,EQP_AMMO};
+ 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,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_GARMENT};
+
-
pc = &pc_s;
/* vars */
Index: pc.h
===================================================================
--- pc.h (revision 12624)
+++ pc.h (working copy)
@@ -43,11 +43,12 @@
EQI_ARMOR,
EQI_HAND_L,
EQI_HAND_R,
+ EQI_AMMO,
+ EQI_MAX_BONUS = 10,
EQI_COSTUME_TOP,
EQI_COSTUME_MID,
EQI_COSTUME_LOW,
EQI_COSTUME_GARMENT,
- EQI_AMMO,
EQI_MAX
};
struct weapon_data {
Index: script.c
===================================================================
--- script.c (revision 12624)
+++ script.c (working copy)
@@ -17297,6 +17297,52 @@
return true;
}
+
+/*==========================================
+ * Costume Items
+ *------------------------------------------*/
+BUILDIN(costume)
+{
+ int i = -1, num, ep;
+ TBL_PC *sd;
+
+ num = script_getnum(st,2); // Equip Slot
+ sd = script->rid2sd(st);
+
+ if( sd == NULL )
+ return 0;
+ if( num > 0 && num <= ARRAYLENGTH(script->equip) )
+ i = pc->checkequip(sd, script->equip[num - 1]);
+ if( i < 0 )
+ return 0;
+ ep = sd->status.inventory[i].equip;
+ if( !(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) )
+ return 0;
+
+ logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
+ pc->unequipitem(sd,i,2);
+ clif->delitem(sd,i,1,3);
+ // --------------------------------------------------------------------
+ sd->status.inventory[i].refine = 0;
+ sd->status.inventory[i].attribute = 0;
+ sd->status.inventory[i].card[0] = CARD0_CREATE;
+ sd->status.inventory[i].card[1] = 0;
+ sd->status.inventory[i].card[2] = GetWord(battle_config.reserved_costume_id, 0);
+ sd->status.inventory[i].card[3] = GetWord(battle_config.reserved_costume_id, 1);
+
+ if( ep&EQP_HEAD_TOP ) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
+ if( ep&EQP_HEAD_LOW ) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
+ if( ep&EQP_HEAD_MID ) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
+ // --------------------------------------------------------------------
+ logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]);
+
+ clif->additem(sd,i,1,0);
+ pc->equipitem(sd,i,ep);
+ clif->misceffect(&sd->bl,3);
+
+ return 0;
+}
+
// declarations that were supposed to be exported from npc_chat.c
#ifdef PCRE_SUPPORT
BUILDIN(defpattern);
@@ -17798,7 +17844,10 @@
BUILDIN_DEF(checkquest, "i?"),
BUILDIN_DEF(changequest, "ii"),
BUILDIN_DEF(showevent, "ii"),
-
+
+ // Costume System
+ BUILDIN_DEF(costume,"i"),
+
/**
* hQueue [Ind/Hercules]
**/
Index: status.c
===================================================================
--- status.c (revision 12624)
+++ status.c (working copy)
@@ -2438,7 +2438,7 @@
pc->delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
// Parse equipment.
- for(i=0;i<EQI_MAX-1;i++) {
+ for(i=0;i<EQI_MAX_BONUS;i++) {
status->current_equip_item_index = index = sd->equip_index[i]; //We pass INDEX to status->current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
if(index < 0)
continue;
Index: battle.conf
===================================================================
--- battle.conf (revision 12624)
+++ battle.conf (working copy)
@@ -141,3 +141,10 @@
// range. For example, Sonic Blow requires a 2 cell distance before autocasting is allowed.
// This setting also affects autospellwhenhit.
autospell_check_range: no
+
+
+// ****************************************
+// Reserved Costume ID's
+// ****************************************
+// Reserved Char ID for costume converted items.
+reserved_costume_id: 999998
\ No newline at end of file