Improved support for enchantgrade (#5975)

Added further support for enchantgrade so that the enchantgrade is not lost during certain processes and can be accessed via script commands.
Also added missing logging support for it.
This commit is contained in:
Lemongrass3110
2021-05-30 00:44:50 +02:00
committed by GitHub
parent 5d92d1a000
commit 3a8e4ffbc7
8 changed files with 51 additions and 11 deletions

View File

@@ -13433,6 +13433,7 @@ BUILDIN_FUNC(successremovecards) {
item_tmp.attribute = sd->inventory.u.items_inventory[i].attribute;
item_tmp.expire_time = sd->inventory.u.items_inventory[i].expire_time;
item_tmp.bound = sd->inventory.u.items_inventory[i].bound;
item_tmp.enchantgrade = sd->inventory.u.items_inventory[i].enchantgrade;
for (int j = sd->inventory_data[i]->slots; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j];
@@ -13518,6 +13519,7 @@ BUILDIN_FUNC(failedremovecards) {
item_tmp.attribute = sd->inventory.u.items_inventory[i].attribute;
item_tmp.expire_time = sd->inventory.u.items_inventory[i].expire_time;
item_tmp.bound = sd->inventory.u.items_inventory[i].bound;
item_tmp.enchantgrade = sd->inventory.u.items_inventory[i].enchantgrade;
for (int j = sd->inventory_data[i]->slots; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->inventory.u.items_inventory[i].card[j];
@@ -14244,6 +14246,7 @@ BUILDIN_FUNC(getinventorylist)
}
pc_setreg(sd,reference_uid(add_str("@inventorylist_expire"), j),sd->inventory.u.items_inventory[i].expire_time);
pc_setreg(sd,reference_uid(add_str("@inventorylist_bound"), j),sd->inventory.u.items_inventory[i].bound);
pc_setreg(sd,reference_uid(add_str("@inventorylist_enchantgrade"), j),sd->inventory.u.items_inventory[i].enchantgrade);
for (k = 0; k < MAX_ITEM_RDM_OPT; k++)
{
sprintf(randopt_var, "@inventorylist_option_id%d",k+1);
@@ -25092,6 +25095,22 @@ BUILDIN_FUNC(refineui){
#endif
}
BUILDIN_FUNC(getenchantgrade){
struct map_session_data *sd;
if( !script_rid2sd( sd ) ){
return SCRIPT_CMD_FAILURE;
}
if( current_equip_item_index == -1 ){
return SCRIPT_CMD_FAILURE;
}
script_pushint( st, sd->inventory.u.items_inventory[current_equip_item_index].enchantgrade );
return SCRIPT_CMD_SUCCESS;
}
#include "../custom/script.inc"
// declarations that were supposed to be exported from npc_chat.cpp
@@ -25782,6 +25801,8 @@ struct script_function buildin_func[] = {
BUILDIN_DEF2(rentalcountitem, "rentalcountitem2", "viiiiiii?"),
BUILDIN_DEF2(rentalcountitem, "rentalcountitem3", "viiiiiiirrr?"),
BUILDIN_DEF(getenchantgrade, ""),
#include "../custom/script_def.inc"
{NULL,NULL,NULL},