peculiarro Posted May 17, 2017 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 46 Reputation: 0 Joined: 05/17/17 Last Seen: June 10, 2017 Share Posted May 17, 2017 I applied this diff, then got this error. Here is my diff file. Needs fixing asap =( diff --git a/conf/battle/battle.conf b/conf/battle/battle.conf index 593d4e9..30251a4 100644 --- conf/battle/battle.conf +++ conf/battle/battle.conf @@ -158,3 +158,9 @@ warg_can_falcon: no // Should the target be able of dodging damage by snapping away to the edge of the screen? // Official behavior is "no" snap_dodge: no + +// **************************************** +// Reserved Costume ID's +// **************************************** +// Reserved Char ID for costume converted items. +reserved_costume_id: 999998 \ No newline at end of file diff --git a/doc/script_commands.txt b/doc/script_commands.txt index a4d6500..99ba739 100644 --- doc/script_commands.txt +++ doc/script_commands.txt @@ -9332,6 +9332,25 @@ solution rather than sending the map and the monster_id. --------------------------------------- +*costume <equipment position>; + +Converts equipment in <equipment position> to costume version that has no stats. + +Applicable positions are: + EQI_HEAD_TOP - Top Headgear + EQI_HEAD_MID - Middle Headgear + EQI_HEAD_LOW - Lower Headgear + EQI_GARMENT - Garment + +--------------------------------------- + +*getcostumeitem <item id>; +*getcostumeitem <"item name">; + +Spawn a costume version of an <item id> or <"item name"> in attached player's inventory. + +--------------------------------------- + *hateffect(<Hat Effect ID>,<State>); This will set a Hat Effect onto the player. The state field allows you to diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 7190474..39fad9b 100644 --- src/map/atcommand.c +++ src/map/atcommand.c @@ -1204,7 +1204,7 @@ ACMD_FUNC(heal) ACMD_FUNC(item) { char item_name[100]; - int number = 0, bound = BOUND_NONE; + int number = 0, bound = BOUND_NONE, costume = 0; char flag = 0; struct item item_tmp; struct item_data *item_data[10]; @@ -1253,6 +1253,27 @@ ACMD_FUNC(item) for(j--; j>=0; j--){ //produce items in list unsigned short item_id = item_data[j]->nameid; + if (!strcmpi(command + 1, "costumeitem")) + { + if (!battle_config.reserved_costume_id) + { + clif_displaymessage(fd, "Costume convertion is disable. Set a value for reserved_cosutme_id on your battle.conf file."); + return -1; + } + if (!(item_data[j]->equip&EQP_HEAD_LOW) && + !(item_data[j]->equip&EQP_HEAD_MID) && + !(item_data[j]->equip&EQP_HEAD_TOP) && + !(item_data[j]->equip&EQP_COSTUME_HEAD_LOW) && + !(item_data[j]->equip&EQP_COSTUME_HEAD_MID) && + !(item_data[j]->equip&EQP_COSTUME_HEAD_TOP) && + !(item_data[j]->equip&EQP_GARMENT) && + !(item_data[j]->equip&EQP_COSTUME_GARMENT)) + { + clif_displaymessage(fd, "You cannot costume this item. Costume only work for headgears."); + return -1; + } + costume = 1; + } //Check if it's stackable. if (!itemdb_isstackable2(item_data[j])) get_count = 1; @@ -1263,6 +1284,11 @@ ACMD_FUNC(item) memset(&item_tmp, 0, sizeof(item_tmp)); 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); + } item_tmp.bound = bound; if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND))) clif_additem(sd, 0, 0, flag); @@ -10171,6 +10197,7 @@ void atcommand_basecommands(void) { ACMD_DEF(clonestat), ACMD_DEF(bodystyle), ACMD_DEF(adopt), + ACMD_DEF2("costumeitem", item), ACMD_DEF(agitstart3), ACMD_DEF(agitend3), }; diff --git a/src/map/battle.c b/src/map/battle.c index 966af8e..4c8b1e6 100644 --- src/map/battle.c +++ src/map/battle.c @@ -8379,6 +8379,7 @@ static const struct _battle_data { { "exp_cost_inspiration", &battle_config.exp_cost_inspiration, 1, 0, 100, }, { "mvp_exp_reward_message", &battle_config.mvp_exp_reward_message, 0, 0, 1, }, { "can_damage_skill", &battle_config.can_damage_skill, 1, 0, BL_ALL, }, + { "reserved_costume_id", &battle_config.reserved_costume_id, 999998, 0, INT_MAX, }, { "atcommand_levelup_events", &battle_config.atcommand_levelup_events, 0, 0, 1, }, { "block_account_in_same_party", &battle_config.block_account_in_same_party, 1, 0, 1, }, { "tarotcard_equal_chance", &battle_config.tarotcard_equal_chance, 0, 0, 1, }, diff --git a/src/map/battle.h b/src/map/battle.h index e4c08a3..50daa5e 100644 --- src/map/battle.h +++ src/map/battle.h @@ -610,6 +610,7 @@ extern struct Battle_Config int exp_cost_inspiration; int mvp_exp_reward_message; int can_damage_skill; //Which BL types can damage traps + int reserved_costume_id; int atcommand_levelup_events; int block_account_in_same_party; int tarotcard_equal_chance; //Official or equal chance for each card diff --git a/src/map/map.c b/src/map/map.c index 524dcec..92f4e0f 100644 --- src/map/map.c +++ src/map/map.c @@ -1879,6 +1879,12 @@ void map_reqnickdb(struct map_session_data * sd, int charid) 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 ) { diff --git a/src/map/pc.c b/src/map/pc.c index 7c939f0..005d857 100755 --- src/map/pc.c +++ src/map/pc.c @@ -683,6 +683,15 @@ int pc_equippoint(struct map_session_data *sd,int n){ (sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO))//Kagerou and Oboro can dual wield daggers. [Rytech] return EQP_ARMS; } + if (battle_config.reserved_costume_id && + sd->inventory.u.items_inventory[n].card[0] == CARD0_CREATE && + MakeDWord(sd->inventory.u.items_inventory[n].card[2], sd->inventory.u.items_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; } + if (ep&EQP_GARMENT) { ep &= ~EQP_GARMENT; ep |= EQP_COSTUME_GARMENT; } +} return ep; } diff --git a/src/map/script.c b/src/map/script.c index 7024c99..cae2e94 100644 --- src/map/script.c +++ src/map/script.c @@ -21798,6 +21798,115 @@ BUILDIN_FUNC(getexp2) { return SCRIPT_CMD_SUCCESS; } +/*========================================== +* Costume Items +*------------------------------------------*/ +BUILDIN_FUNC(costume) +{ + int i = -1, num, ep; + TBL_PC *sd; + + num = script_getnum(st, 2); // Equip Slot + sd = script_rid2sd(st); + + if (sd == NULL) + return SCRIPT_CMD_FAILURE; + if (equip_index_check(num)) + i = pc_checkequip(sd, equip_bitmask[num]); + if (i < 0) + return SCRIPT_CMD_FAILURE; + + ep = sd->inventory.u.items_inventory[i].equip; + if (!(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) && !(ep&EQP_GARMENT)) { + ShowError("buildin_costume: Attempted to convert non-cosmetic item to costume."); + return SCRIPT_CMD_FAILURE; + } + log_pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->inventory.u.items_inventory[i]); + pc_unequipitem(sd, i, 2); + clif_delitem(sd, i, 1, 3); + // -------------------------------------------------------------------- + sd->inventory.u.items_inventory[i].refine = 0; + sd->inventory.u.items_inventory[i].attribute = 0; + sd->inventory.u.items_inventory[i].card[0] = CARD0_CREATE; + sd->inventory.u.items_inventory[i].card[1] = 0; + sd->inventory.u.items_inventory[i].card[2] = GetWord(battle_config.reserved_costume_id, 0); + sd->inventory.u.items_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; } + if (ep&EQP_GARMENT) { ep &= EQP_GARMENT; ep |= EQP_COSTUME_GARMENT; } + // -------------------------------------------------------------------- + log_pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->inventory.u.items_inventory[i]); + + clif_additem(sd, i, 1, 0); + pc_equipitem(sd, i, ep); + clif_misceffect(&sd->bl, 3); + + return SCRIPT_CMD_SUCCESS; +} + +/*=============================== + * getcostumeitem <item id>; + * getcostumeitem <"item name">; + *===============================*/ +BUILDIN_FUNC(getcostumeitem) +{ + unsigned short nameid; + struct item item_tmp; + TBL_PC *sd; + struct script_data *data; + + sd = script_rid2sd(st); + if (sd == NULL) + { // No player attached. + script_pushint(st, 0); + return SCRIPT_CMD_SUCCESS; + } + + data = script_getdata(st, 2); + get_val(st, data); + if (data_isstring(data)) { + int ep; + const char *name = conv_str(st, data); + struct item_data *item_data = itemdb_searchname(name); + if (item_data == NULL) + { //Failed + script_pushint(st, 0); + return SCRIPT_CMD_SUCCESS; + } + ep = item_data->equip; + if (!(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) && !(ep&EQP_GARMENT)){ + ShowError("buildin_getcostumeitem: Attempted to convert non-cosmetic item to costume."); + return SCRIPT_CMD_FAILURE; + } + nameid = item_data->nameid; + } + else + nameid = conv_num(st, data); + + if (!itemdb_exists(nameid)) + { // Item does not exist. + script_pushint(st, 0); + return SCRIPT_CMD_SUCCESS; + } + + memset(&item_tmp, 0, sizeof(item_tmp)); + item_tmp.nameid = nameid; + item_tmp.amount = 1; + item_tmp.identify = 1; + 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 (pc_additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT)) { + script_pushint(st, 0); + return SCRIPT_CMD_SUCCESS; //Failed to add item, we will not drop if they don't fit + } + + script_pushint(st, 1); + return SCRIPT_CMD_SUCCESS; +} + /** * Force stat recalculation of sd * recalculatestat; @@ -22711,6 +22820,8 @@ struct script_function buildin_func[] = { BUILDIN_DEF(getguildalliance,"ii"), BUILDIN_DEF(adopt,"vv"), BUILDIN_DEF(getexp2,"ii?"), + BUILDIN_DEF(costume, "i"), + BUILDIN_DEF(getcostumeitem, "v"), BUILDIN_DEF(recalculatestat,""), BUILDIN_DEF(hateffect,"ii"), BUILDIN_DEF(getrandomoptinfo, "i"), diff --git a/src/map/status.c b/src/map/status.c index d5a23bb..e88c4b1 100644 --- src/map/status.c +++ src/map/status.c @@ -3407,6 +3407,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) continue; if (!sd->inventory_data[index]) continue; + if (sd->inventory.u.items_inventory[current_equip_item_index].card[0] == CARD0_CREATE && MakeDWord(sd->inventory.u.items_inventory[current_equip_item_index].card[2], sd->inventory.u.items_inventory[current_equip_item_index].card[3]) == battle_config.reserved_costume_id) + continue; base_status->def += sd->inventory_data[index]->def; Quote Link to comment Share on other sites More sharing options...
0 peculiarro Posted May 17, 2017 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 46 Reputation: 0 Joined: 05/17/17 Last Seen: June 10, 2017 Author Share Posted May 17, 2017 I was trying to add the costume NPC Quote Link to comment Share on other sites More sharing options...
0 Asela Posted May 18, 2017 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 5 Reputation: 2 Joined: 06/20/14 Last Seen: July 11, 2023 Share Posted May 18, 2017 They refactored the script_rid2sd command. To fix, change the instances of sd = script_rid2sd(st); into script_rid2sd(sd); If you check script.c you can see how they use the command. 1 Quote Link to comment Share on other sites More sharing options...
0 peculiarro Posted May 19, 2017 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 46 Reputation: 0 Joined: 05/17/17 Last Seen: June 10, 2017 Author Share Posted May 19, 2017 On 5/18/2017 at 4:33 PM, Asela said: They refactored the script_rid2sd command. To fix, change the instances of sd = script_rid2sd(st); into script_rid2sd(sd); If you check script.c you can see how they use the command. Wow, that definitely fixed it! Wow, thank you!!! Quote Link to comment Share on other sites More sharing options...
Question
peculiarro
I applied this diff, then got this error. Here is my diff file. Needs fixing asap =(
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.