diff options
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 148 |
1 files changed, 119 insertions, 29 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 97af2afff..2fac5b4a4 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -2232,26 +2232,56 @@ ACMD(refine) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!*message || sscanf(message, "%12d %12d", &position, &refine_level) < 2) { - clif->message(fd, msg_fd(fd,996)); // Please enter a position and an amount (usage: @refine <equip position> <+/- amount>). - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,997), EQP_HEAD_LOW); // %d: Lower Headgear + clif->message(fd, msg_fd(fd, 996)); // Please enter a position and an amount (usage: @refine <equip position> <+/- amount>). +#if PACKETVER > 20100707 + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1515), -3); // %d: Refine All Equip (Shadow) clif->message(fd, atcmd_output); - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,998), EQP_HAND_R); // %d: Right Hand + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1514), -2); // %d: Refine All Equip (Costume) clif->message(fd, atcmd_output); - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,999), EQP_GARMENT); // %d: Garment +#endif + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1513), -1); // %d: Refine All Equip (General) + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 997), EQP_HEAD_LOW); // %d: Headgear (Low) + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 998), EQP_HAND_R); // Hand (Right) + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 999), EQP_GARMENT); // %d: Garment + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1000), EQP_ACC_L); // Accessory (Left) + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1001), EQP_ARMOR); // %d: Body Armor + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1002), EQP_HAND_L); // Hand (Left) + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1003), EQP_SHOES); // %d: Shoes + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1004), EQP_ACC_R); // Accessory (Right) + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1005), EQP_HEAD_TOP); // %d: Headgear (Top) + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1006), EQP_HEAD_MID); // %d: Headgear (Mid) +#if PACKETVER > 20100707 + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1503), EQP_COSTUME_HEAD_TOP); // %d: Costume Headgear (Top) + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1504), EQP_COSTUME_HEAD_MID); // %d: Costume Headgear (Mid) clif->message(fd, atcmd_output); - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1000), EQP_ACC_L); // %d: Left Accessory + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1505), EQP_COSTUME_HEAD_LOW); // %d: Costume Headgear (Low) clif->message(fd, atcmd_output); - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1001), EQP_ARMOR); // %d: Body Armor + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1506), EQP_COSTUME_GARMENT); // %d: Costume Garment clif->message(fd, atcmd_output); - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1002), EQP_HAND_L); // %d: Left Hand + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1507), EQP_SHADOW_ARMOR); // %d: Shadow Armor clif->message(fd, atcmd_output); - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1003), EQP_SHOES); // %d: Shoes + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1508), EQP_SHADOW_WEAPON); // %d: Shadow Weapon clif->message(fd, atcmd_output); - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1004), EQP_ACC_R); // %d: Right Accessory + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1509), EQP_SHADOW_SHIELD); // %d: Shadow Shield clif->message(fd, atcmd_output); - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1005), EQP_HEAD_TOP); // %d: Top Headgear + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1510), EQP_SHADOW_SHOES); // %d: Shadow Shoes clif->message(fd, atcmd_output); - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1006), EQP_HEAD_MID); // %d: Mid Headgear + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1511), EQP_SHADOW_ACC_R); // %d: Shadow Accessory (Right) + clif->message(fd, atcmd_output); + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1512), EQP_SHADOW_ACC_L); // %d: Shadow Accessory (Left) + clif->message(fd, atcmd_output); +#endif clif->message(fd, atcmd_output); return false; } @@ -2263,22 +2293,33 @@ ACMD(refine) int idx = sd->equip_index[j]; if (idx < 0) continue; - if(j == EQI_AMMO) continue; /* can't equip ammo */ - if(j == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == idx) + if (j == EQI_AMMO) + continue; /* can't equip ammo */ + if (j == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == idx) continue; - if(j == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == idx) + if (j == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == idx) continue; - if(j == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == idx || sd->equip_index[EQI_HEAD_LOW] == idx)) + if (j == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == idx || sd->equip_index[EQI_HEAD_LOW] == idx)) + continue; + if (j == EQI_COSTUME_MID && sd->equip_index[EQI_COSTUME_LOW] == idx) + continue; + if (j == EQI_COSTUME_TOP && (sd->equip_index[EQI_COSTUME_MID] == idx || sd->equip_index[EQI_COSTUME_LOW] == idx)) continue; - if(position && !(sd->status.inventory[idx].equip & position)) + if (position == -3 && !itemdb_is_shadowequip(sd->status.inventory[idx].equip)) + continue; + else if (position == -2 && !itemdb_is_costumeequip(sd->status.inventory[idx].equip)) + continue; + else if (position == -1 && (itemdb_is_costumeequip(sd->status.inventory[idx].equip) || itemdb_is_shadowequip(sd->status.inventory[idx].equip))) + continue; + else if (position && !(sd->status.inventory[idx].equip & position)) continue; final_refine = cap_value(sd->status.inventory[idx].refine + refine_level, 0, MAX_REFINE); if (sd->status.inventory[idx].refine != final_refine) { sd->status.inventory[idx].refine = final_refine; current_position = sd->status.inventory[idx].equip; - pc->unequipitem(sd, idx, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE); + pc->unequipitem(sd, idx, PCUNEQUIPITEM_RECALC | PCUNEQUIPITEM_FORCE); clif->refine(fd, 0, idx, sd->status.inventory[idx].refine); clif->delitem(sd, idx, 1, DELITEM_MATERIALCHANGE); clif->additem(sd, idx, 1, 0); @@ -2289,11 +2330,11 @@ ACMD(refine) } if (count == 0) - clif->message(fd, msg_fd(fd,166)); // No item has been refined. + clif->message(fd, msg_fd(fd, 166)); // No item has been refined. else if (count == 1) - clif->message(fd, msg_fd(fd,167)); // 1 item has been refined. + clif->message(fd, msg_fd(fd, 167)); // 1 item has been refined. else { - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,168), count); // %d items have been refined. + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 168), count); // %d items have been refined. clif->message(fd, atcmd_output); } @@ -4464,6 +4505,38 @@ ACMD(unloadnpc) return true; } +/// Unload existing NPC within the NPC file and reload it. +/// Usage: @reloadnpc npc/sample_npc.txt +ACMD(reloadnpc) +{ + if (!*message) { + clif->message(fd, msg_fd(fd, 1385)); // Usage: @unloadnpcfile <file name> + return false; + } else if (npc->unloadfile(message) == true) { + clif->message(fd, msg_fd(fd, 1386)); // File unloaded. Be aware that mapflags and monsters spawned directly are not removed. + + FILE *fp = fopen(message, "r"); + // check if script file exists + if (fp == NULL) { + clif->message(fd, msg_fd(fd, 261)); + return false; + } + fclose(fp); + + // add to list of script sources and run it + npc->addsrcfile(message); + npc->parsesrcfile(message, true); + npc->read_event_script(); + + clif->message(fd, msg_fd(fd, 262)); + } else { + clif->message(fd, msg_fd(fd, 1387)); // File not found. + return false; + } + + return true; +} + /*========================================== * time in txt for time command (by [Yor]) *------------------------------------------*/ @@ -6720,6 +6793,9 @@ ACMD(mute) *------------------------------------------*/ ACMD(refresh) { + if (sd->npc_id > 0) + return false; + clif->refresh(sd); return true; } @@ -6731,29 +6807,41 @@ ACMD(refreshall) iter = mapit_getallusers(); for (iter_sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); iter_sd = BL_UCAST(BL_PC, mapit->next(iter))) - clif->refresh(iter_sd); + if (iter_sd->npc_id <= 0) + clif->refresh(iter_sd); mapit->free(iter); return true; } /*========================================== - * @identify + * @identify / @identifyall * => GM's magnifier. *------------------------------------------*/ ACMD(identify) { int num = 0; + bool identifyall = (strcmpi(info->command, "identifyall") == 0); - for (int i = 0; i < sd->status.inventorySize; i++) { - if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify!=1){ - num++; + if (!identifyall) { + for (int i = 0; i < sd->status.inventorySize; i++) { + if (sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify != 1) { + num++; + } } - } - if (num > 0) { - clif->item_identify_list(sd); } else { - clif->message(fd,msg_fd(fd,1238)); // There are no items to appraise. + for (int i = 0; i < sd->status.inventorySize; i++) { + if (sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify != 1) { + skill->identify(sd, i); + num++; + } + } } + + if (num == 0) + clif->message(fd,msg_fd(fd,1238)); // There are no items to appraise. + else if (!identifyall) + clif->item_identify_list(sd); + return true; } @@ -10029,6 +10117,7 @@ static void atcommand_basecommands(void) ACMD_DEF(refresh), ACMD_DEF(refreshall), ACMD_DEF(identify), + ACMD_DEF2("identifyall", identify), ACMD_DEF(misceffect), ACMD_DEF(mobsearch), ACMD_DEF(cleanmap), @@ -10118,6 +10207,7 @@ static void atcommand_basecommands(void) ACMD_DEF(addperm), ACMD_DEF2("rmvperm", addperm), ACMD_DEF(unloadnpcfile), + ACMD_DEF(reloadnpc), ACMD_DEF(cart), ACMD_DEF(cashmount), ACMD_DEF(join), |