summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/atcommand.conf1
-rw-r--r--conf/groups.conf1
-rw-r--r--conf/help.txt5
-rw-r--r--conf/messages.conf12
-rw-r--r--doc/atcommands.txt10
-rw-r--r--src/map/atcommand.c118
-rw-r--r--src/map/pc.c10
-rw-r--r--src/map/pc.h1
8 files changed, 146 insertions, 12 deletions
diff --git a/conf/atcommand.conf b/conf/atcommand.conf
index fc2a1af73..df4972067 100644
--- a/conf/atcommand.conf
+++ b/conf/atcommand.conf
@@ -56,6 +56,7 @@ aliases: {
accinfo: ["accountinfo"]
itemreset: ["clearinventory"]
channel: ["main"]
+ autoloottype: ["aloottype"]
}
/* List of commands that should not be logged at all */
diff --git a/conf/groups.conf b/conf/groups.conf
index 7c97352dc..9403e34f6 100644
--- a/conf/groups.conf
+++ b/conf/groups.conf
@@ -120,6 +120,7 @@ groups: (
noks: true
autoloot: true
alootid: true
+ autoloottype: true
autotrade: true
request: true
go: true
diff --git a/conf/help.txt b/conf/help.txt
index 211ed5b19..a65c7de70 100644
--- a/conf/help.txt
+++ b/conf/help.txt
@@ -300,3 +300,8 @@ reloadscript: "Reload all scripts."
gat: "For debugging (you inspect around gat)"
send: "For debugging (packet variety)"
nuke: "Params: <char name>\n" "Blow somebody up, including those surrounding them."
+autoloottype: "Manage a list of autolooting item types.\n"
+" To add an item type to the list, use \"@autoloottype +<type name>\".\n"
+" To remove an item type, use \"@autoloottype -<type name>\".\n"
+" Type List: healing, usable, etc, weapon, armor, card, petegg, petarmor, ammo.\n"
+" \"@autoloottype reset\" will clear your autoloottype list."
diff --git a/conf/messages.conf b/conf/messages.conf
index 5d0fd7ba6..a9f0a5984 100644
--- a/conf/messages.conf
+++ b/conf/messages.conf
@@ -1534,5 +1534,17 @@
//CashShop mapflag
1489: Cash Shop is disabled in this map
+
+// @autoloottype
+1490: You're already autolooting this item type.
+1491: Item type not found.
+1492: Autolooting item type: '%s'
+1493: You're currently not autolooting this item type.
+1494: Removed item type: '%s' from your autoloottype list.
+1495: Your autoloottype list is empty.
+1496: Item types on your autoloottype list:
+1497: Your autoloottype list has been reset.
+
+
//Custom translations
import: conf/import/msg_conf.txt
diff --git a/doc/atcommands.txt b/doc/atcommands.txt
index 42b085cd6..b2c765d6a 100644
--- a/doc/atcommands.txt
+++ b/doc/atcommands.txt
@@ -337,6 +337,16 @@ By default, 10 items can be autolooted at one time.
---------------------------------------
+@autoloottype <+/-><type name>
+@autoloottype reset
+
+Starts or stops autolooting a specified item type.
+Type List: healing, usable, etc, weapon, armor, card, petegg, petarmor, ammo.
+Typing "reset" will clear the autoloot item list.
+
+---------------------------------------
+
+
@mobsearch <monster name>
Locates and displays the position of a certain mob on the current map.
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 758ebb0db..ed5852b76 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5603,16 +5603,16 @@ ACMD(autolootitem)
}
else if (!strcmp(message,"reset"))
action = 4;
- }
-
- if (action < 3) // add or remove
- {
- if ((item_data = itemdb->exists(atoi(message))) == NULL)
- item_data = itemdb->search_name(message);
- if (!item_data) {
- // No items founds in the DB with Id or Name
- clif->message(fd, msg_txt(1189)); // Item not found.
- return false;
+
+ if (action < 3) // add or remove
+ {
+ if ((item_data = itemdb->exists(atoi(message))) == NULL)
+ item_data = itemdb->search_name(message);
+ if (!item_data) {
+ // No items founds in the DB with Id or Name
+ clif->message(fd, msg_txt(1189)); // Item not found.
+ return false;
+ }
}
}
@@ -5680,6 +5680,103 @@ ACMD(autolootitem)
}
/*==========================================
+ * @autoloottype
+ * Credits:
+ * chriser,Aleos
+ *------------------------------------------*/
+ACMD(autoloottype) {
+ int i;
+ uint8 action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset
+ enum item_types type = -1;
+ int ITEM_NONE = 0;
+
+ if (message && *message) {
+ if (message[0] == '+') {
+ message++;
+ action = 1;
+ } else if (message[0] == '-') {
+ message++;
+ action = 2;
+ } else if (strcmp(message,"reset") == 0) {
+ action = 4;
+ }
+
+ if (action < 3) {
+ // add or remove
+ if (strncmp(message, "healing", 3) == 0)
+ type = IT_HEALING;
+ else if (strncmp(message, "usable", 3) == 0)
+ type = IT_USABLE;
+ else if (strncmp(message, "etc", 3) == 0)
+ type = IT_ETC;
+ else if (strncmp(message, "weapon", 3) == 0)
+ type = IT_WEAPON;
+ else if (strncmp(message, "armor", 3) == 0)
+ type = IT_ARMOR;
+ else if (strncmp(message, "card", 3) == 0)
+ type = IT_CARD;
+ else if (strncmp(message, "petegg", 4) == 0)
+ type = IT_PETEGG;
+ else if (strncmp(message, "petarmor", 4) == 0)
+ type = IT_PETARMOR;
+ else if (strncmp(message, "ammo", 3) == 0)
+ type = IT_AMMO;
+ else {
+ clif->message(fd, msg_txt(1491)); // Item type not found.
+ return false;
+ }
+ }
+ }
+
+ switch (action) {
+ case 1:
+ if (sd->state.autoloottype&(1<<type)) {
+ clif->message(fd, msg_txt(1490)); // You're already autolooting this item type.
+ return false;
+ }
+ sd->state.autoloottype |= (1<<type); // Stores the type
+ sprintf(atcmd_output, msg_txt(1492), itemdb->typename(type)); // Autolooting item type: '%s'
+ clif->message(fd, atcmd_output);
+ break;
+ case 2:
+ if (!(sd->state.autoloottype&(1<<type))) {
+ clif->message(fd, msg_txt(1493)); // You're currently not autolooting this item type.
+ return false;
+ }
+ sd->state.autoloottype &= ~(1<<type);
+ sprintf(atcmd_output, msg_txt(1494), itemdb->typename(type)); // Removed item type: '%s' from your autoloottype list.
+ clif->message(fd, atcmd_output);
+ break;
+ case 3:
+ clif->message(fd, msg_txt(38)); // Invalid location number, or name.
+
+ {
+ // attempt to find the text help string
+ const char *text = atcommand_help_string(info);
+ if (text) clif->messageln(fd, text); // send the text to the client
+ }
+
+ if (sd->state.autoloottype == ITEM_NONE) {
+ clif->message(fd, msg_txt(1495)); // Your autoloottype list is empty.
+ } else {
+ clif->message(fd, msg_txt(1496)); // Item types on your autoloottype list:
+ for(i=0; i < IT_MAX; i++) {
+ if (sd->state.autoloottype&(1<<i)) {
+ sprintf(atcmd_output, " '%s'", itemdb->typename(i));
+ clif->message(fd, atcmd_output);
+ }
+ }
+ }
+ break;
+ case 4:
+ sd->state.autoloottype = ITEM_NONE;
+ clif->message(fd, msg_txt(1497)); // Your autoloottype list has been reset.
+ break;
+ }
+ return true;
+}
+
+/*==========================================
* It is made to snow.
*------------------------------------------*/
ACMD(snow) {
@@ -9383,6 +9480,7 @@ void atcommand_basecommands(void) {
ACMD_DEF(changelook),
ACMD_DEF(autoloot),
ACMD_DEF2("alootid", autolootitem),
+ ACMD_DEF(autoloottype),
ACMD_DEF(mobinfo),
ACMD_DEF(exp),
ACMD_DEF(version),
diff --git a/src/map/pc.c b/src/map/pc.c
index 41f4a1a96..d98393739 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -9414,10 +9414,16 @@ void pc_overheat(struct map_session_data *sd, int val) {
*/
bool pc_isautolooting(struct map_session_data *sd, int nameid)
{
- int i;
- if( !sd->state.autolooting )
+ int i = 0;
+
+ if (sd->state.autoloottype && sd->state.autoloottype&(1<<itemdb_type(nameid)))
+ return true;
+
+ if (!sd->state.autolooting)
return false;
+
ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == nameid);
+
return (i != AUTOLOOTITEM_SIZE);
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 8eb7e692a..f1535941c 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -166,6 +166,7 @@ struct map_session_data {
short pmap; // Previous map on Map Change
unsigned short autoloot;
unsigned short autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus]
+ unsigned short autoloottype;
unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid
unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish]
unsigned int gmaster_flag : 1;