|
@@ -10836,6 +10836,81 @@ ACMD_FUNC( roulette ){
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Replaces a card ID in an equip
|
|
|
+ * Usage: @setcard <equip position> <slot> <card_id>
|
|
|
+ */
|
|
|
+ACMD_FUNC(setcard)
|
|
|
+{
|
|
|
+ nullpo_retr(-1, sd);
|
|
|
+
|
|
|
+ int position = 0, slot, card_id;
|
|
|
+
|
|
|
+ if (!message || !*message || sscanf(message, "%11d %11d %11d", &position, &slot, &card_id) < 3) {
|
|
|
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
|
|
|
+
|
|
|
+ clif_displaymessage(fd, msg_txt(sd,1527)); // Please enter the position, the slot number and the card ID (usage: @setcard <equip position> <slot> <card_id>).
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,997), EQP_HEAD_LOW); // %d: Lower Headgear
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,998), EQP_HAND_R); // %d: Right Hand
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,999), EQP_GARMENT); // %d: Garment
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1000), EQP_ACC_L); // %d: Left Accessory
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1001), EQP_ARMOR); // %d: Body Armor
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1002), EQP_HAND_L); // %d: Left Hand
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1003), EQP_SHOES); // %d: Shoes
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1004), EQP_ACC_R); // %d: Right Accessory
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1005), EQP_HEAD_TOP); // %d: Top Headgear
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1006), EQP_HEAD_MID); // %d: Mid Headgear
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (position < EQP_HEAD_LOW || position > EQP_HEAD_MID) {
|
|
|
+ clif_displaymessage(fd, msg_txt(sd,1531)); // Invalid position.
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (slot < 0 || slot >= MAX_SLOTS) {
|
|
|
+ clif_displaymessage(fd, msg_txt(sd,1532)); // Invalid slot number.
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (card_id != 0) {
|
|
|
+ std::shared_ptr<item_data> item_data = item_db.find( card_id );
|
|
|
+
|
|
|
+ if (item_data == nullptr) {
|
|
|
+ clif_displaymessage(fd, msg_txt(sd,1530)); // Invalid card ID.
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (item_data->type != IT_CARD) {
|
|
|
+ clif_displaymessage(fd, msg_txt(sd,1529)); // The item type must be a card or enchant.
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int16 i = pc_checkequip(sd, position);
|
|
|
+
|
|
|
+ if (i < 0) {
|
|
|
+ clif_displaymessage(fd, msg_txt(sd,1528)); // You are not wearing any equipment in this position.
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ int current_position = sd->inventory.u.items_inventory[i].equip;
|
|
|
+
|
|
|
+ pc_unequipitem(sd, i, 3);
|
|
|
+ log_pick_pc( sd, LOG_TYPE_COMMAND, -1, &sd->inventory.u.items_inventory[i] );
|
|
|
+ sd->inventory.u.items_inventory[i].card[slot] = card_id;
|
|
|
+ log_pick_pc( sd, LOG_TYPE_COMMAND, 1, &sd->inventory.u.items_inventory[i] );
|
|
|
+ clif_delitem(sd, i, 1, 0);
|
|
|
+ clif_additem(sd, i, 1, 0);
|
|
|
+ pc_equipitem(sd, i, current_position);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
#include <custom/atcommand.inc>
|
|
|
|
|
|
/**
|
|
@@ -11162,6 +11237,7 @@ void atcommand_basecommands(void) {
|
|
|
ACMD_DEF(addfame),
|
|
|
ACMD_DEFR(enchantgradeui, ATCMD_NOCONSOLE|ATCMD_NOAUTOTRADE),
|
|
|
ACMD_DEFR(roulette, ATCMD_NOCONSOLE|ATCMD_NOAUTOTRADE),
|
|
|
+ ACMD_DEF(setcard),
|
|
|
};
|
|
|
AtCommandInfo* atcommand;
|
|
|
int i;
|