Jump to content

Bringer

Members
  • Posts

    743
  • Joined

  • Last visited

  • Days Won

    1

Community Answers

  1. Bringer's post in Updated Soul Link Modifications for Highrate Server was marked as the answer   
    you can still use the old Soul Linker Mod

    sample of Old Code
    case CR_SHIELDCHARGE: if (sd && sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_CRUSADER) skillratio += 60 * skill_lv; else skillratio += 20 * skill_lv; break; latest rathena changed the sd->sc.data[SC_SPIRIT] to sd->sc.getSCE(SC_SPIRIT)

    new code will be 
    if (sd && sd->sc.getSCE(SC_SPIRIT) && sd->sc.getSCE(SC_SPIRIT)->val2 == SL_CRUSADER)  
  2. Bringer's post in (solved) add ability to detects hidden and cloaked characters was marked as the answer   
    find all SC_CONCENTRATE on status.cpp
     
    case SC_SIGHT: // Reveal hidden ennemy on 3*3 range case SC_CONCENTRATE: status_change_end(bl, SC_HIDING, INVALID_TIMER); status_change_end(bl, SC_CLOAKING, INVALID_TIMER); status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); status_change_end(bl, SC_CAMOUFLAGE, INVALID_TIMER); status_change_end(bl, SC_NEWMOON, INVALID_TIMER); status_change_end(bl, SC_STEALTH, INVALID_TIMER);  
  3. Bringer's post in Item drops on player's death was marked as the answer   
    https://github.com/rathena/rathena/blob/master/npc/mapflag/nightmare.txt
  4. Bringer's post in how to remove timer in icon buffs? was marked as the answer   
    Did you try this
    https://github.com/rathena/rathena/blob/master/conf/battle/client.conf#L110
  5. Bringer's post in Adding Swap Skill was marked as the answer   
    Genwaku (Skill ID# 3021, iRO Name: Illusion - Bewitch)
     
    Check that skill
  6. Bringer's post in PVP on in all Fields and dungeons except town was marked as the answer   
    https://github.com/rathena/rathena/blob/master/conf/battle/misc.conf#L19
  7. Bringer's post in Help on Cart termination reflect and NJ UTSUSEMI was marked as the answer   
    } else { if ( sc->data[SC_REFLECTSHIELD] && skill_id != WS_CARTTERMINATION && skill_id != GS_DESPERADO ) { // Don't reflect non-skill attack if has SC_REFLECTSHIELD from Devotion bonus inheritance if (!skill_id && battle_config.devotion_rdamage_skill_only && sc->data[SC_REFLECTSHIELD]->val4) rdamage = 0; else { rdamage += damage * sc->data[SC_REFLECTSHIELD]->val2 / 100; if (rdamage < 1) rdamage = 1; } }  
  8. Bringer's post in AFK Points Disabled in Dual Client was marked as the answer   
    check this https://rathena.org/board/files/file/3647-saders-hourly-rewards/
  9. Bringer's post in Anyone know what sprite this is? Looks like a portal was marked as the answer   
    4_PURPLE_WARP
    ID: 10237 (0x27FD)
  10. Bringer's post in Professor Ecall was marked as the answer   
    Unit.cpp
    - if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill_get_inf2(ud->skill_id)&INF2_GUILD_SKILL)) + if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !pc_checkskill(sd, SA_FREECAST) ))  
  11. Bringer's post in Need help , making Magnus Exorcistmus deals damage to every mob regardless the race and element was marked as the answer   
    case UNT_MAGNUS: //if (!battle_check_undead(tstatus->race,tstatus->def_ele) && tstatus->race!=RC_ALL) //break; skill_attack(BF_MAGIC,ss,&unit->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break;  
  12. Bringer's post in How to write this item code. was marked as the answer   
    if(getskilllv("RA_AIMEDBOLT")==10) { bonus2 bSkillAtk,"RA_AIMEDBOLT",5; }  
  13. Bringer's post in Help @costume was marked as the answer   
    diff --git a/conf/battle/battle.conf b/conf/battle/battle.conf index 593d4e92f4..30251a4834 100644 --- a/conf/battle/battle.conf +++ b/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 70113c4145..d769b4364d 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -9633,6 +9633,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.cpp b/src/map/atcommand.cpp index 43d6ad4d7d..e2897a48b5 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -1218,7 +1218,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]; @@ -1267,6 +1267,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; @@ -1277,6 +1298,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); @@ -10282,6 +10308,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.cpp b/src/map/battle.cpp index 839cfb5620..d28c5f0182 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -8482,6 +8482,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.hpp b/src/map/battle.hpp index ad13f69d53..b8f36aaf00 100644 --- a/src/map/battle.hpp +++ b/src/map/battle.hpp @@ -618,6 +618,7 @@ 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.cpp b/src/map/map.cpp index 8b70459939..3b06cd032c 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -1865,6 +1865,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.cpp b/src/map/pc.cpp index c0126b1597..015381e857 100755 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -746,6 +746,7 @@ int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){ return EQP_SHADOW_ARMS; } } + return ep; } @@ -757,7 +758,18 @@ int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){ int pc_equippoint(struct map_session_data *sd,int n){ nullpo_ret(sd); - return pc_equippoint_sub(sd,sd->inventory_data[n]); + int ep = pc_equippoint_sub(sd, sd->inventory_data[n]); + + 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.cpp b/src/map/script.cpp index 0b2386c32d..70127734b0 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -22601,6 +22601,114 @@ 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 + + if (!script_rid2sd(sd)) + 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; + + if (!script_rid2sd(sd)) + { // 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; @@ -24343,6 +24451,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.cpp b/src/map/status.cpp index af4c3afb00..a296f7b89e 100644 --- a/src/map/status.cpp +++ b/src/map/status.cpp @@ -3492,6 +3492,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; try this
  14. Bringer's post in Latest @costumeitem? was marked as the answer   
    diff --git a/conf/battle/battle.conf b/conf/battle/battle.conf index 593d4e92f4..30251a4834 100644 --- a/conf/battle/battle.conf +++ b/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 70113c4145..d769b4364d 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -9633,6 +9633,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.cpp b/src/map/atcommand.cpp index 43d6ad4d7d..e2897a48b5 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -1218,7 +1218,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]; @@ -1267,6 +1267,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; @@ -1277,6 +1298,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); @@ -10282,6 +10308,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.cpp b/src/map/battle.cpp index 839cfb5620..d28c5f0182 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -8482,6 +8482,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.hpp b/src/map/battle.hpp index ad13f69d53..b8f36aaf00 100644 --- a/src/map/battle.hpp +++ b/src/map/battle.hpp @@ -618,6 +618,7 @@ 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.cpp b/src/map/map.cpp index 8b70459939..3b06cd032c 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -1865,6 +1865,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.cpp b/src/map/pc.cpp index c0126b1597..015381e857 100755 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -746,6 +746,7 @@ int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){ return EQP_SHADOW_ARMS; } } + return ep; } @@ -757,7 +758,18 @@ int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){ int pc_equippoint(struct map_session_data *sd,int n){ nullpo_ret(sd); - return pc_equippoint_sub(sd,sd->inventory_data[n]); + int ep = pc_equippoint_sub(sd, sd->inventory_data[n]); + + 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.cpp b/src/map/script.cpp index 0b2386c32d..70127734b0 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -22601,6 +22601,114 @@ 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 + + if (!script_rid2sd(sd)) + 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; + + if (!script_rid2sd(sd)) + { // 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; @@ -24343,6 +24451,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.cpp b/src/map/status.cpp index af4c3afb00..a296f7b89e 100644 --- a/src/map/status.cpp +++ b/src/map/status.cpp @@ -3492,6 +3492,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; From Secret Try this
  15. Bringer's post in Edit/create skills was marked as the answer   
    https://github.com/rathena/rathena/wiki/Adding_new_skills
  16. Bringer's post in I can not open a cookie bag with the inventory full ....because ? was marked as the answer   
    rathena\db\pre-re\item_flag.txt
    // Flagged Items // <ItemID>,<Flag> // // <Flag>: //  1 - As Dead Branch item (will be logged at `branchlog` table and cannot be used at 'nobranch' mapflag) //  2 - As item group container, check player's inventory and weight before consumed //  4 - GUID Item: When this item is obtained, will generates GUID that cannot be stacked even same or stackable item //  8 - Item will be bound item when equipped // 16 - Special Broadcast: When item dropped by monster and player loot it, will be broadcasted! // 32 - Item will not be removed on consumption. Also supports 'itemskill' // NOTE: For removing flag by import file, use "-" to remove the flag. Example, 604,-1 will removes flag 1 from Branch_Of_Dead_Tree 12130,2 //Cookie_Bag  
  17. Bringer's post in .TGA File was marked as the answer   
    Problem Solved using Photoshop Alpha Channel
  18. Bringer's post in Anybody have this things (Status ailments) was marked as the answer   
    http://herc.ws/board/topic/12978-status-ailments/
  19. Bringer's post in Custom Status Not Being Read? was marked as the answer   
    Here my Custom status Icon on Land PRO src/map/script_constants.h export_constant(SC_VOLCANO); export_constant(SC_DELUGE); export_constant(SC_VIOLENTGALE); + export_constant(SC_LANDPROTECTOR); export_constant(SI_VOLCANO); export_constant(SI_DELUGE); export_constant(SI_VIOLENTGALE); + export_constant(SI_LANDPROTECTOR);  
  20. Bringer's post in vip login was marked as the answer   
    OnPCLoginEvent: if (vip_status(1)) { dispbottom "========================"; dispbottom "Account Status : VIP"; dispbottom "Expire Date : "+vip_status(2); dispbottom "Time left : "+vip_status(3); dispbottom "========================"; end; } }
  21. Bringer's post in Please Dont Forget me Skill recast After using the skill was marked as the answer   
    check this Link
    https://rathena.org/board/topic/57240-turn-preserve-offon/
  22. Bringer's post in how to remove NPC on new_1-3 imma use it as DB room was marked as the answer   
    npc\pre-re\jobs\novice\novice.txt
     
    and comment this line
    new_1-3    mapflag    nobranch

    on mapflags
  23. Bringer's post in add knockback 1 to 2 cell when using falcon assault was marked as the answer   
    //id,range,hit,inf,element,nk,splash,max,list_num,castcancel,cast_defence_rate,inf2,maxcount,skill_type,blow_count,inf3,name,description
    // 15 Blowcount (amount of tiles skill knockbacks)
    381,5,8,1,-3,0x40,0,5,1,yes,0,0,0,misc,0,0x80,        SN_FALCONASSAULT,Falcon Assault
    db\pre-re\skill_db.txt
    db\re\skill_db.txt
  24. Bringer's post in Command script request was marked as the answer   
  25. Bringer's post in tbox event was marked as the answer   
    - script Treasure Box Summoner -1,{ OnClock2100: announce "A rare Treasure Box has been spawned somewhere in Prontera.",0; monster "prontera",0,0,"Treasure Box",1955,1,"Treasure Box Summoner::OnTBoxKilled"; OnTBoxKilled: announce "The rare Treasure Box has been destroyed by "+strcharinfo(0)+"!", bc_all; end; } this script is hidden npc
    announce every hour and drop 1 TCG only.
    change OnClock2100 to 
    OnMinute00: //Things to do ,which will happen every Hour at Minute 00  
    To drop 1 tcg edit the mob id 1995 add 7227 on drop list or can use this command automatic get the 7227 when the players killed
    getitem 7227,1; add this code below on announce
×
×
  • Create New...