... ... @@ -5851,6 +5851,8 @@ void getring (struct map_session_data* sd)
5851 5851 int i;
5852 5852 int action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset
5853 5853
5854 + nullpo_retr(-1, sd);
5855 +
5854 5856 if (message && *message) {
5855 5857 if (message[0] == '+') {
5856 5858 message++;
... ... @@ -5937,6 +5939,117 @@ void getring (struct map_session_data* sd)
5937 5939 }
5938 5940 return 0;
5939 5941 }
5942 +
5943 +/*==========================================
5944 + * @autoloottype
5945 + * Flags:
5946 + * 1: IT_HEALING, 2: IT_UNKNOWN, 4: IT_USABLE, 8: IT_ETC,
5947 + * 16: IT_WEAPON, 32: IT_ARMOR, 64: IT_CARD, 128: IT_PETEGG,
5948 + * 256: IT_PETARMOR, 512: IT_UNKNOWN2, 1024: IT_AMMO, 2048: IT_DELAYCONSUME
5949 + * 262144: IT_CASH
5950 + *------------------------------------------
5951 + * Credits:
5952 + * chriser
5953 + * Aleos
5954 + *------------------------------------------*/
5955 +ACMD_FUNC(autoloottype)
5956 +{
5957 + uint8 i = 0, action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset
5958 + enum item_types type;
5959 + int ITEM_NONE = 0, ITEM_MAX = 1533;
5960 +
5961 + nullpo_retr(-1, sd);
5962 +
5963 + if (message && *message) {
5964 + if (message[0] == '+') {
5965 + message++;
5966 + action = 1;
5967 + }
5968 + else if (message[0] == '-') {
5969 + message++;
5970 + action = 2;
5971 + }
5972 + else if (!strcmp(message,"reset"))
5973 + action = 4;
5974 + }
5975 +
5976 + if (action < 3) { // add or remove
5977 + if ((strncmp(message, "healing", 3) == 0) || (atoi(message) == 0))
5978 + type = IT_HEALING;
5979 + else if ((strncmp(message, "usable", 3) == 0) || (atoi(message) == 2))
5980 + type = IT_USABLE;
5981 + else if ((strncmp(message, "etc", 3) == 0) || (atoi(message) == 3))
5982 + type = IT_ETC;
5983 + else if ((strncmp(message, "weapon", 3) == 0) || (atoi(message) == 4))
5984 + type = IT_WEAPON;
5985 + else if ((strncmp(message, "armor", 3) == 0) || (atoi(message) == 5))
5986 + type = IT_ARMOR;
5987 + else if ((strncmp(message, "card", 3) == 0) || (atoi(message) == 6))
5988 + type = IT_CARD;
5989 + else if ((strncmp(message, "petegg", 4) == 0) || (atoi(message) == 7))
5990 + type = IT_PETEGG;
5991 + else if ((strncmp(message, "petarmor", 4) == 0) || (atoi(message) == 8))
5992 + type = IT_PETARMOR;
5993 + else if ((strncmp(message, "ammo", 3) == 0) || (atoi(message) == 10))
5994 + type = IT_AMMO;
5995 + else {
5996 + clif_displaymessage(fd, msg_txt(sd,1480)); // Item type not found.
5997 + return -1;
5998 + }
5999 + }
6000 +
6001 + switch (action) {
6002 + case 1:
6003 + if (sd->state.autoloottype&(1< 6004 + clif_displaymessage(fd, msg_txt(sd,1481)); // You're already autolooting this item type.
6005 + return -1;
6006 + }
6007 + if (sd->state.autoloottype == ITEM_MAX) {
6008 + clif_displaymessage(fd, msg_txt(sd,1482)); // Your autoloottype list has all item types. You can remove some items with @autoloottype -.
6009 + return -1;
6010 + }
6011 + sd->state.autolootingtype = 1; // Autoloot Activated
6012 + sd->state.autoloottype |= (1< 6013 + sprintf(atcmd_output, msg_txt(sd,1483), itemdb_typename(type), type); // Autolooting item type: '%s' {%d}
6014 + clif_displaymessage(fd, atcmd_output);
6015 + break;
6016 + case 2:
6017 + if (!(sd->state.autoloottype&(1< 6018 + clif_displaymessage(fd, msg_txt(sd,1484)); // You're currently not autolooting this item type.
6019 + return -1;
6020 + }
6021 + sd->state.autoloottype &= ~(1< 6022 + sprintf(atcmd_output, msg_txt(sd,1485), itemdb_typename(type), type); // Removed item type: '%s' {%d} from your autoloottype list.
6023 + clif_displaymessage(fd, atcmd_output);
6024 + if (sd->state.autoloottype == ITEM_NONE)
6025 + sd->state.autolootingtype = 0;
6026 + break;
6027 + case 3:
6028 + clif_displaymessage(fd, msg_txt(sd,1486)); // To add an item type to the list, use "@aloottype +". To remove an item type, use "@aloottype -".
6029 + clif_displaymessage(fd, msg_txt(sd,1487)); // Type List: healing = 0, usable = 2, etc = 3, weapon = 4, armor = 5, card = 6, petegg = 7, petarmor = 8, ammo = 10
6030 + clif_displaymessage(fd, msg_txt(sd,1488)); // "@aloottype reset" will clear your autoloottype list.
6031 + if (sd->state.autoloottype == ITEM_NONE)
6032 + clif_displaymessage(fd, msg_txt(sd,1489)); // Your autoloottype list is empty.
6033 + else {
6034 + clif_displaymessage(fd, msg_txt(sd,1490)); // Item types on your autoloottype list:
6035 + while (i < IT_MAX) {
6036 + if (sd->state.autoloottype&(1< 6037 + sprintf(atcmd_output, " '%s' {%d}", itemdb_typename(i), i);
6038 + clif_displaymessage(fd, atcmd_output);
6039 + }
6040 + i++;
6041 + }
6042 + }
6043 + break;
6044 + case 4:
6045 + sd->state.autoloottype = ITEM_NONE;
6046 + sd->state.autolootingtype = 0;
6047 + clif_displaymessage(fd, msg_txt(sd,1491)); // Your autoloottype list has been reset.
6048 + break;
6049 + }
6050 + return 0;
6051 +}
6052 +
5940 6053 /**
5941 6054 * No longer available, keeping here just in case it's back someday. [ind]
5942 6055 **/
... ... @@ -9284,6 +9397,7 @@ void atcommand_basecommands(void) {
9284 9397 ACMD_DEF(changelook),
9285 9398 ACMD_DEF(autoloot),
9286 9399 ACMD_DEF2("alootid", autolootitem),
9400 + ACMD_DEF(autoloottype),
9287 9401 ACMD_DEF(mobinfo),
9288 9402 ACMD_DEF(exp),
9289 9403 ACMD_DEF(version),