From e322c69d27d3db8c7141d27fa8baf0745de2eae4 Mon Sep 17 00:00:00 2001 From: Dastgir Pojee Date: Fri, 18 Oct 2013 10:57:06 +0530 Subject: Since our neighbours added it, we too wanted this feature. Topic:http://hercules.ws/board/topic/2540-add-rathena-new-aloot-type/ --- src/map/atcommand.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/map/pc.c | 15 +++++-- src/map/pc.h | 2 + 3 files changed, 127 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index cc29fa1bb..a3b55a6a7 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5727,6 +5727,8 @@ ACMD(autolootitem) int i; int action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset + nullpo_retr(-1, sd); + if (message && *message) { if (message[0] == '+') { message++; @@ -5813,6 +5815,117 @@ ACMD(autolootitem) } return true; } + +/*========================================== + * @autoloottype + * Flags: + * 1: IT_HEALING, 2: IT_UNKNOWN, 4: IT_USABLE, 8: IT_ETC, + * 16: IT_WEAPON, 32: IT_ARMOR, 64: IT_CARD, 128: IT_PETEGG, + * 256: IT_PETARMOR, 512: IT_UNKNOWN2, 1024: IT_AMMO, 2048: IT_DELAYCONSUME + * 262144: IT_CASH + *------------------------------------------ + * Credits: + * chriser + * Aleos + *------------------------------------------*/ +ACMD(autoloottype){ + uint8 i = 0, action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset + enum item_types type = -1; + int ITEM_NONE = 0, ITEM_MAX = 1533; + + nullpo_retr(-1, sd); + + if (message && *message) { + if (message[0] == '+') { + message++; + action = 1; + } + else if (message[0] == '-') { + message++; + action = 2; + } + else if (!strcmp(message,"reset")) + action = 4; + } + + if (action < 3) { // add or remove + if ((strncmp(message, "healing", 3) == 0) || (atoi(message) == 0)) + type = IT_HEALING; + else if ((strncmp(message, "usable", 3) == 0) || (atoi(message) == 2)) + type = IT_USABLE; + else if ((strncmp(message, "etc", 3) == 0) || (atoi(message) == 3)) + type = IT_ETC; + else if ((strncmp(message, "weapon", 3) == 0) || (atoi(message) == 4)) + type = IT_WEAPON; + else if ((strncmp(message, "armor", 3) == 0) || (atoi(message) == 5)) + type = IT_ARMOR; + else if ((strncmp(message, "card", 3) == 0) || (atoi(message) == 6)) + type = IT_CARD; + else if ((strncmp(message, "petegg", 4) == 0) || (atoi(message) == 7)) + type = IT_PETEGG; + else if ((strncmp(message, "petarmor", 4) == 0) || (atoi(message) == 8)) + type = IT_PETARMOR; + else if ((strncmp(message, "ammo", 3) == 0) || (atoi(message) == 10)) + type = IT_AMMO; + else { + clif->message(fd, msg_txt(1489)); // Item type not found. + + return false; + } + } + + switch (action) { + case 1: + if (sd->state.autoloottype&(1<message(fd, msg_txt(1490)); // You're already autolooting this item type. + return false; + } + if (sd->state.autoloottype == ITEM_MAX) { + clif->message(fd, msg_txt(1491)); // Your autoloottype list has all item types. You can remove some items with @autoloottype -. + return false; + } + sd->state.autolootingtype = 1; // Autoloot Activated + sd->state.autoloottype |= (1<typename(type), type); // Autolooting item type: '%s' {%d} + clif->message(fd, atcmd_output); + break; + case 2: + if (!(sd->state.autoloottype&(1<message(fd, msg_txt(1493)); // You're currently not autolooting this item type. + return false; + } + sd->state.autoloottype &= ~(1<typename(type), type); // Removed item type: '%s' {%d} from your autoloottype list. + clif->message(fd, atcmd_output); + if (sd->state.autoloottype == ITEM_NONE) + sd->state.autolootingtype = 0; + break; + case 3: + clif->message(fd, msg_txt(1495)); // To add an item type to the list, use "@aloottype +". To remove an item type, use "@aloottype -". + clif->message(fd, msg_txt(1496)); // Type List: healing = 0, usable = 2, etc = 3, weapon = 4, armor = 5, card = 6, petegg = 7, petarmor = 8, ammo = 10 + clif->message(fd, msg_txt(1497)); // "@aloottype reset" will clear your autoloottype list. + if (sd->state.autoloottype == ITEM_NONE) + clif->message(fd, msg_txt(1498)); // Your autoloottype list is empty. + else { + clif->message(fd, msg_txt(1499)); // Item types on your autoloottype list: + while (i < IT_MAX) { + if (sd->state.autoloottype&(1<typename(i), i); + clif->message(fd, atcmd_output); + } + i++; + } + } + break; + case 4: + sd->state.autoloottype = ITEM_NONE; + sd->state.autolootingtype = 0; + clif->message(fd, msg_txt(1500)); // Your autoloottype list has been reset. + break; + } + return 0; +} + /** * No longer available, keeping here just in case it's back someday. [Ind] **/ @@ -9598,6 +9711,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 157d9e28a..f3f554137 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9346,11 +9346,18 @@ 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 ) + uint8 i = 0; + bool j = false; + + if (!sd->state.autolooting && !sd->state.autolootingtype) return false; - ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == nameid); - return (i != AUTOLOOTITEM_SIZE); + + if (sd->state.autolooting) + ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == nameid); + if (sd->state.autolootingtype && sd->state.autoloottype&(1< Date: Thu, 31 Oct 2013 00:08:56 +0530 Subject: Several Changes to autoloottype command. --- src/map/atcommand.c | 81 ++++++++++++++++++++++++----------------------------- src/map/pc.c | 14 ++++----- src/map/pc.h | 1 - 3 files changed, 43 insertions(+), 53 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index a3b55a6a7..605572aad 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5727,8 +5727,6 @@ ACMD(autolootitem) int i; int action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset - nullpo_retr(-1, sd); - if (message && *message) { if (message[0] == '+') { message++; @@ -5740,16 +5738,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; + } } } @@ -5829,11 +5827,10 @@ ACMD(autolootitem) * Aleos *------------------------------------------*/ ACMD(autoloottype){ - uint8 i = 0, action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset + int i; + uint8 action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset enum item_types type = -1; int ITEM_NONE = 0, ITEM_MAX = 1533; - - nullpo_retr(-1, sd); if (message && *message) { if (message[0] == '+') { @@ -5846,31 +5843,30 @@ ACMD(autoloottype){ } else if (!strcmp(message,"reset")) action = 4; - } - if (action < 3) { // add or remove - if ((strncmp(message, "healing", 3) == 0) || (atoi(message) == 0)) - type = IT_HEALING; - else if ((strncmp(message, "usable", 3) == 0) || (atoi(message) == 2)) - type = IT_USABLE; - else if ((strncmp(message, "etc", 3) == 0) || (atoi(message) == 3)) - type = IT_ETC; - else if ((strncmp(message, "weapon", 3) == 0) || (atoi(message) == 4)) - type = IT_WEAPON; - else if ((strncmp(message, "armor", 3) == 0) || (atoi(message) == 5)) - type = IT_ARMOR; - else if ((strncmp(message, "card", 3) == 0) || (atoi(message) == 6)) - type = IT_CARD; - else if ((strncmp(message, "petegg", 4) == 0) || (atoi(message) == 7)) - type = IT_PETEGG; - else if ((strncmp(message, "petarmor", 4) == 0) || (atoi(message) == 8)) - type = IT_PETARMOR; - else if ((strncmp(message, "ammo", 3) == 0) || (atoi(message) == 10)) - type = IT_AMMO; - else { - clif->message(fd, msg_txt(1489)); // Item type not found. - - return false; + if (action < 3) { // add or remove + if ((atoi(message) == 0) ||(strncmp(message, "healing", 3) == 0)) + type = IT_HEALING; + else if ((atoi(message) == 2) || (strncmp(message, "usable", 3) == 0)) + type = IT_USABLE; + else if ((atoi(message) == 3) || (strncmp(message, "etc", 3) == 0)) + type = IT_ETC; + else if ((atoi(message) == 4) || (strncmp(message, "weapon", 3) == 0)) + type = IT_WEAPON; + else if ((atoi(message) == 5) || (strncmp(message, "armor", 3) == 0)) + type = IT_ARMOR; + else if ((atoi(message) == 6) || (strncmp(message, "card", 3) == 0)) + type = IT_CARD; + else if ((atoi(message) == 7) || (strncmp(message, "petegg", 4) == 0)) + type = IT_PETEGG; + else if ((atoi(message) == 8) || (strncmp(message, "petarmor", 4) == 0)) + type = IT_PETARMOR; + else if ((atoi(message) == 10) || (strncmp(message, "ammo", 3) == 0)) + type = IT_AMMO; + else { + clif->message(fd, msg_txt(1489)); // Item type not found. + return false; + } } } @@ -5884,7 +5880,6 @@ ACMD(autoloottype){ clif->message(fd, msg_txt(1491)); // Your autoloottype list has all item types. You can remove some items with @autoloottype -. return false; } - sd->state.autolootingtype = 1; // Autoloot Activated sd->state.autoloottype |= (1<typename(type), type); // Autolooting item type: '%s' {%d} clif->message(fd, atcmd_output); @@ -5897,8 +5892,6 @@ ACMD(autoloottype){ sd->state.autoloottype &= ~(1<typename(type), type); // Removed item type: '%s' {%d} from your autoloottype list. clif->message(fd, atcmd_output); - if (sd->state.autoloottype == ITEM_NONE) - sd->state.autolootingtype = 0; break; case 3: clif->message(fd, msg_txt(1495)); // To add an item type to the list, use "@aloottype +". To remove an item type, use "@aloottype -". @@ -5908,18 +5901,16 @@ ACMD(autoloottype){ clif->message(fd, msg_txt(1498)); // Your autoloottype list is empty. else { clif->message(fd, msg_txt(1499)); // Item types on your autoloottype list: - while (i < IT_MAX) { + for(i=0; i < IT_MAX; i++){ if (sd->state.autoloottype&(1<typename(i), i); clif->message(fd, atcmd_output); } - i++; } } break; case 4: sd->state.autoloottype = ITEM_NONE; - sd->state.autolootingtype = 0; clif->message(fd, msg_txt(1500)); // Your autoloottype list has been reset. break; } diff --git a/src/map/pc.c b/src/map/pc.c index f3f554137..7966e49ab 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9346,18 +9346,18 @@ void pc_overheat(struct map_session_data *sd, int val) { */ bool pc_isautolooting(struct map_session_data *sd, int nameid) { - uint8 i = 0; + int i = 0; bool j = false; - if (!sd->state.autolooting && !sd->state.autolootingtype) + if (sd->state.autoloottype && sd->state.autoloottype&(1<state.autolooting) return false; - if (sd->state.autolooting) - ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == nameid); - if (sd->state.autolootingtype && sd->state.autoloottype&(1<state.autolootid[i] == nameid); - return (i != AUTOLOOTITEM_SIZE || j ); + return (i != AUTOLOOTITEM_SIZE); } /** diff --git a/src/map/pc.h b/src/map/pc.h index bbea0e121..bb7bff375 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -162,7 +162,6 @@ struct map_session_data { unsigned short autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus] unsigned short autoloottype; unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid - unsigned int autolootingtype : 1; //performance-saver, autolooting state for @autoloottype unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish] unsigned int gmaster_flag : 1; unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not. -- cgit v1.2.3-70-g09d2 From fa54cf57ded42d7b0b45a5025a8858a9b52a0074 Mon Sep 17 00:00:00 2001 From: Dastgir Pojee Date: Fri, 1 Nov 2013 10:27:12 +0530 Subject: Removed type_id and some unused variables from @autoloottype --- conf/messages.conf | 11 +++++------ src/map/atcommand.c | 45 +++++++++++++++++---------------------------- src/map/pc.c | 1 - 3 files changed, 22 insertions(+), 35 deletions(-) (limited to 'src/map') diff --git a/conf/messages.conf b/conf/messages.conf index ae96152f0..22ed991e2 100644 --- a/conf/messages.conf +++ b/conf/messages.conf @@ -1533,14 +1533,13 @@ 1488: Transforming into monster is not allowed in Guild Wars. // @autoloottype -1489: Item type not found. 1490: You're already autolooting this item type. -1491: Your autoloottype list has all item types. You can remove some items with @autoloottype -. -1492: Autolooting item type: '%s' {%d} +1491: Item type not found. +1492: Autolooting item type: '%s' 1493: You're currently not autolooting this item type. -1494: Removed item type: '%s' {%d} from your autoloottype list. -1495: To add an item type to the list, use "@aloottype +". To remove an item type, use "@aloottype -". -1496: Type List: healing = 0, usable = 2, etc = 3, weapon = 4, armor = 5, card = 6, petegg = 7, petarmor = 8, ammo = 10 +1494: Removed item type: '%s' from your autoloottype list. +1495: To add an item type to the list, use "@aloottype +". To remove an item type, use "@aloottype -". +1496: Type List: healing, usable, etc, weapon, armor, card, petegg, petarmor, ammo 1497: "@aloottype reset" will clear your autoloottype list. 1498: Your autoloottype list is empty. 1499: Item types on your autoloottype list: diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 605572aad..980f61ad9 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5816,21 +5816,14 @@ ACMD(autolootitem) /*========================================== * @autoloottype - * Flags: - * 1: IT_HEALING, 2: IT_UNKNOWN, 4: IT_USABLE, 8: IT_ETC, - * 16: IT_WEAPON, 32: IT_ARMOR, 64: IT_CARD, 128: IT_PETEGG, - * 256: IT_PETARMOR, 512: IT_UNKNOWN2, 1024: IT_AMMO, 2048: IT_DELAYCONSUME - * 262144: IT_CASH - *------------------------------------------ * Credits: - * chriser - * Aleos + * 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, ITEM_MAX = 1533; + int ITEM_NONE = 0; if (message && *message) { if (message[0] == '+') { @@ -5845,26 +5838,26 @@ ACMD(autoloottype){ action = 4; if (action < 3) { // add or remove - if ((atoi(message) == 0) ||(strncmp(message, "healing", 3) == 0)) + if (strncmp(message, "healing", 3) == 0) type = IT_HEALING; - else if ((atoi(message) == 2) || (strncmp(message, "usable", 3) == 0)) + else if (strncmp(message, "usable", 3) == 0) type = IT_USABLE; - else if ((atoi(message) == 3) || (strncmp(message, "etc", 3) == 0)) + else if (strncmp(message, "etc", 3) == 0) type = IT_ETC; - else if ((atoi(message) == 4) || (strncmp(message, "weapon", 3) == 0)) + else if (strncmp(message, "weapon", 3) == 0) type = IT_WEAPON; - else if ((atoi(message) == 5) || (strncmp(message, "armor", 3) == 0)) + else if (strncmp(message, "armor", 3) == 0) type = IT_ARMOR; - else if ((atoi(message) == 6) || (strncmp(message, "card", 3) == 0)) + else if (strncmp(message, "card", 3) == 0) type = IT_CARD; - else if ((atoi(message) == 7) || (strncmp(message, "petegg", 4) == 0)) + else if (strncmp(message, "petegg", 4) == 0) type = IT_PETEGG; - else if ((atoi(message) == 8) || (strncmp(message, "petarmor", 4) == 0)) + else if (strncmp(message, "petarmor", 4) == 0) type = IT_PETARMOR; - else if ((atoi(message) == 10) || (strncmp(message, "ammo", 3) == 0)) + else if (strncmp(message, "ammo", 3) == 0) type = IT_AMMO; else { - clif->message(fd, msg_txt(1489)); // Item type not found. + clif->message(fd, msg_txt(1491)); // Item type not found. return false; } } @@ -5876,12 +5869,8 @@ ACMD(autoloottype){ clif->message(fd, msg_txt(1490)); // You're already autolooting this item type. return false; } - if (sd->state.autoloottype == ITEM_MAX) { - clif->message(fd, msg_txt(1491)); // Your autoloottype list has all item types. You can remove some items with @autoloottype -. - return false; - } sd->state.autoloottype |= (1<typename(type), type); // Autolooting item type: '%s' {%d} + sprintf(atcmd_output, msg_txt(1492), itemdb->typename(type)); // Autolooting item type: '%s' clif->message(fd, atcmd_output); break; case 2: @@ -5890,12 +5879,12 @@ ACMD(autoloottype){ return false; } sd->state.autoloottype &= ~(1<typename(type), type); // Removed item type: '%s' {%d} from your autoloottype list. + 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(1495)); // To add an item type to the list, use "@aloottype +". To remove an item type, use "@aloottype -". - clif->message(fd, msg_txt(1496)); // Type List: healing = 0, usable = 2, etc = 3, weapon = 4, armor = 5, card = 6, petegg = 7, petarmor = 8, ammo = 10 + clif->message(fd, msg_txt(1495)); // To add an item type to the list, use "@aloottype +". To remove an item type, use "@aloottype -". + clif->message(fd, msg_txt(1496)); // Type List: healing, usable, etc, weapon, armor, card, petegg, petarmor, ammo clif->message(fd, msg_txt(1497)); // "@aloottype reset" will clear your autoloottype list. if (sd->state.autoloottype == ITEM_NONE) clif->message(fd, msg_txt(1498)); // Your autoloottype list is empty. @@ -5903,7 +5892,7 @@ ACMD(autoloottype){ clif->message(fd, msg_txt(1499)); // Item types on your autoloottype list: for(i=0; i < IT_MAX; i++){ if (sd->state.autoloottype&(1<typename(i), i); + sprintf(atcmd_output, " '%s'", itemdb->typename(i)); clif->message(fd, atcmd_output); } } diff --git a/src/map/pc.c b/src/map/pc.c index 7966e49ab..90a3db853 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9347,7 +9347,6 @@ void pc_overheat(struct map_session_data *sd, int val) { bool pc_isautolooting(struct map_session_data *sd, int nameid) { int i = 0; - bool j = false; if (sd->state.autoloottype && sd->state.autoloottype&(1< Date: Sat, 2 Nov 2013 18:02:36 -0200 Subject: Fixed Shadow System Bonuses Item in shadow slots are now able to give bonuses properly, thanks to rosfus for pointing it out! Also added the missing constants for script handling. Signed-off-by: shennetsind --- db/const.txt | 6 ++++++ doc/script_commands.txt | 7 +++++++ src/map/pc.c | 2 +- src/map/pc.h | 2 +- src/map/script.c | 2 +- src/map/script.h | 2 +- 6 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/db/const.txt b/db/const.txt index 3c20abc4a..cdb000417 100644 --- a/db/const.txt +++ b/db/const.txt @@ -610,6 +610,12 @@ EQI_COSTUME_HEAD_LOW 11 EQI_COSTUME_HEAD_MID 12 EQI_COSTUME_HEAD_TOP 13 EQI_COSTUME_GARMENT 14 +EQI_SHADOW_ARMOR 15 +EQI_SHADOW_WEAPON 16 +EQI_SHADOW_SHIELD 17 +EQI_SHADOW_SHOES 18 +EQI_SHADOW_ACC_R 19 +EQI_SHADOW_ACC_L 20 LOOK_BASE 0 LOOK_HAIR 1 diff --git a/doc/script_commands.txt b/doc/script_commands.txt index bd0b032f1..f2ba9f6ba 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -2550,6 +2550,13 @@ EQI_HEAD_LOW (10) - Lower Headgear (beards, some masks) EQI_COSTUME_HEAD_LOW (11) - Lower Costume Headgear EQI_COSTUME_HEAD_MID (12) - Middle Costume Headgear EQI_COSTUME_HEAD_TOP (13) - Upper Costume Headgear +EQI_COSTUME_GARMENT (14) - Costume Garment +EQI_SHADOW_ARMOR (15) - Shadow Armor +EQI_SHADOW_WEAPON (16) - Shadow Weapon +EQI_SHADOW_SHIELD (17) - Shadow Shield +EQI_SHADOW_SHOES (18) - Shadow Shoes +EQI_SHADOW_ACC_R (19) - Shadow Accessory 2 +EQI_SHADOW_ACC_L (20) - Shadow Accessory 1 Notice that a few items occupy several equipment slots, and if the character is wearing such an item, 'getequipid' will return it's ID number diff --git a/src/map/pc.c b/src/map/pc.c index 35d883b6f..41f4a1a96 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -10257,7 +10257,7 @@ void pc_defaults(void) { { SG_MOON_ANGER, SG_MOON_BLESS, SG_MOON_COMFORT, "PC_FEEL_MOON", "PC_HATE_MOB_MOON", is_day_of_moon }, { SG_STAR_ANGER, SG_STAR_BLESS, SG_STAR_COMFORT, "PC_FEEL_STAR", "PC_HATE_MOB_STAR", is_day_of_star } }; - unsigned short equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_GARMENT,EQP_AMMO}; + unsigned int equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_GARMENT,EQP_AMMO, EQP_SHADOW_ARMOR, EQP_SHADOW_WEAPON, EQP_SHADOW_SHIELD, EQP_SHADOW_SHOES, EQP_SHADOW_ACC_R, EQP_SHADOW_ACC_L }; pc = &pc_s; diff --git a/src/map/pc.h b/src/map/pc.h index fc37d0ef2..8eb7e692a 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -731,7 +731,7 @@ struct pc_interface { #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) unsigned int level_penalty[3][RC_MAX][MAX_LEVEL*2+1]; #endif - unsigned short equip_pos[EQI_MAX]; + unsigned int equip_pos[EQI_MAX]; /* */ struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE]; struct fame_list smith_fame_list[MAX_FAME_LIST]; diff --git a/src/map/script.c b/src/map/script.c index d51f27ce9..944759f39 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -18210,7 +18210,7 @@ void script_label_add(int key, int pos) { void script_defaults(void) { // aegis->athena slot position conversion table - unsigned int equip[SCRIPT_EQUIP_TABLE_SIZE] = {EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_GARMENT}; + unsigned int equip[SCRIPT_EQUIP_TABLE_SIZE] = {EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_GARMENT,EQP_SHADOW_ARMOR, EQP_SHADOW_WEAPON, EQP_SHADOW_SHIELD, EQP_SHADOW_SHOES, EQP_SHADOW_ACC_R, EQP_SHADOW_ACC_L}; script = &script_s; diff --git a/src/map/script.h b/src/map/script.h index c6cb6070b..a4d14c777 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -35,7 +35,7 @@ struct eri; //#define SCRIPT_HASH_SDBM #define SCRIPT_HASH_ELF -#define SCRIPT_EQUIP_TABLE_SIZE 14 +#define SCRIPT_EQUIP_TABLE_SIZE 20 //#define SCRIPT_DEBUG_DISP //#define SCRIPT_DEBUG_DISASM -- cgit v1.2.3-70-g09d2 From 5e002a43399f5358b7aabd1bd653f598f35287e2 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sat, 2 Nov 2013 18:54:56 -0200 Subject: Fixed Bug #7793 package parser will now throw an error when using a invalid random: field, also fixed another error message (was missing a double %) http://hercules.ws/board/tracker/issue-7793-item-packages-crash/ Signed-off-by: shennetsind --- src/map/itemdb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/map') diff --git a/src/map/itemdb.c b/src/map/itemdb.c index feb17ddc8..3fc8d526b 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1027,7 +1027,10 @@ void itemdb_read_packages(void) { if( itemdb->packages[count].random_qty ) { CREATE(itemdb->packages[count].random_groups, struct item_package_rand_group, itemdb->packages[count].random_qty); for( c = 0; c < itemdb->packages[count].random_qty; c++ ) { - CREATE(itemdb->packages[count].random_groups[c].random_list, struct item_package_rand_entry, rgroups[ i - 1 ][c]); + if( !rgroups[ i - 1 ][c] ) + ShowError("itemdb_read_packages: package '%s' missing 'Random' field %d! there must not be gaps!\n",config_setting_name(itg),c+1); + else + CREATE(itemdb->packages[count].random_groups[c].random_list, struct item_package_rand_entry, rgroups[ i - 1 ][c]); itemdb->packages[count].random_groups[c].random_qty = 0; } } @@ -1090,7 +1093,7 @@ void itemdb_read_packages(void) { itemdb->packages[count].random_groups[gidx].random_list[r].id = data ? data->nameid : 0; itemdb->packages[count].random_groups[gidx].random_list[r].qty = icount; if( (itemdb->packages[count].random_groups[gidx].random_list[r].rate = rate) == 10000 ) { - ShowWarning("itemdb_read_packages: item '%s' in '%s' has 100% drop rate!! set this item as 'Random: 0' or other items won't drop!!!\n",itname,config_setting_name(itg)); + ShowWarning("itemdb_read_packages: item '%s' in '%s' has 100%% drop rate!! set this item as 'Random: 0' or other items won't drop!!!\n",itname,config_setting_name(itg)); } itemdb->packages[count].random_groups[gidx].random_list[r].hours = expire; itemdb->packages[count].random_groups[gidx].random_list[r].announce = announce == true ? 1 : 0; -- cgit v1.2.3-70-g09d2 From 37fdcbae655c48e569398d3750d503ffe3bfae66 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sat, 2 Nov 2013 20:25:51 -0200 Subject: Fixed Bug #7786 @speed no longer screws up on map change, modified @speed feedback so its clear whether the permanent speed flag is gone, enhanced @speed by making it capable of bypassing battle_config.max_walk_speed, made status_calc_speed rely on MIN_WALK_SPEED instead of the hardcoded 0, modified MIN_WALK_SPEED from 0 to 20 (it 1) wasnt being respected and 2) less than 20 clips). @speed is now capable of moving the character faster, prior to this commit @speed 0 was equivalent to @speed 50 of this new version, @speed 20 for example is now the new maximum (and moves much faster). http://hercules.ws/board/tracker/issue-7786-speed-bug-when-changing-maps/ Thanks to Mumbles for all the info Signed-off-by: shennetsind --- conf/messages.conf | 2 +- src/common/mmo.h | 2 +- src/map/atcommand.c | 18 ++++++++++++------ src/map/map.c | 2 -- src/map/status.c | 28 +++++++++++++++------------- 5 files changed, 29 insertions(+), 23 deletions(-) (limited to 'src/map') diff --git a/conf/messages.conf b/conf/messages.conf index 7b7a99301..5d0fd7ba6 100644 --- a/conf/messages.conf +++ b/conf/messages.conf @@ -192,7 +192,7 @@ 169: The item (%d: '%s') is not equipable. 170: The item is not equipable. 171: %d - void -//172: You replace previous memo position %d - %s (%d,%d). +172: Speed returned to normal. //173: Note: you don't have the 'Warp' skill level to use it. 174: Number of status points changed. 175: Number of skill points changed. diff --git a/src/common/mmo.h b/src/common/mmo.h index 5f75f35da..349912a39 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -107,7 +107,7 @@ //Should hold the max of GLOBAL/ACCOUNT/ACCOUNT2 (needed for some arrays that hold all three) #define MAX_REG_NUM 256 #define DEFAULT_WALK_SPEED 150 -#define MIN_WALK_SPEED 0 +#define MIN_WALK_SPEED 20 /* below 20 clips animation */ #define MAX_WALK_SPEED 1000 #define MAX_STORAGE 600 #define MAX_GUILD_STORAGE 600 diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 146159c63..758ebb0db 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -766,15 +766,21 @@ ACMD(speed) return false; } - if (speed < 0) { + sd->state.permanent_speed = 0; + + if (speed < 0) sd->base_status.speed = DEFAULT_WALK_SPEED; - sd->state.permanent_speed = 0; // Remove lock when set back to default speed. - } else { + else sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED); - sd->state.permanent_speed = 1; // Set lock when set to non-default speed. - } + status_calc_bl(&sd->bl, SCB_SPEED); - clif->message(fd, msg_txt(8)); // Speed changed. + + if( sd->base_status.speed != DEFAULT_WALK_SPEED ) { + sd->state.permanent_speed = 1; // Set lock when set to non-default speed. + clif->message(fd, msg_txt(8)); // Speed changed. + } else + clif->message(fd, msg_txt(172)); //Speed returned to normal. + return true; } diff --git a/src/map/map.c b/src/map/map.c index b50297ca6..2a2f98bdc 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1722,8 +1722,6 @@ int map_quit(struct map_session_data *sd) { if( sd->state.storage_flag == 1 ) sd->state.storage_flag = 0; // No need to Double Save Storage on Quit. - if (sd->state.permanent_speed == 1) sd->state.permanent_speed = 0; // Remove lock so speed is set back to normal at login. - if( sd->ed ) { elemental->clean_effect(sd->ed); unit->remove_map(&sd->ed->bl,CLR_TELEPORT,ALC_MARK); diff --git a/src/map/status.c b/src/map/status.c index 9e98b2801..0ff30595d 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2389,11 +2389,17 @@ int status_calc_pc_(struct map_session_data* sd, bool first) { clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_CLAIRVOYANCE); memset(&sd->special_state,0,sizeof(sd->special_state)); - memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp))); - - //FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex] - if (!sd->state.permanent_speed) + + if (!sd->state.permanent_speed) { + memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp))); bstatus->speed = DEFAULT_WALK_SPEED; + } else { + int pSpeed = bstatus->speed; + memset(&bstatus->max_hp, 0, sizeof(struct status_data)-(sizeof(bstatus->hp)+sizeof(bstatus->sp))); + bstatus->speed = pSpeed; + } + + //FIXME: Most of these stuff should be calculated once, but how do I fix the memset above to do that? [Skotlex] //Give them all modes except these (useful for clones) bstatus->mode = MD_MASK&~(MD_BOSS|MD_PLANT|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK); @@ -3670,6 +3676,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { if(flag&SCB_SPEED) { struct unit_data *ud = unit->bl2ud(bl); + st->speed = status->calc_speed(bl, sc, bst->speed); //Re-walk to adjust speed (we do not check if walktimer != INVALID_TIMER @@ -3678,13 +3685,11 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { if (ud) ud->state.change_walk_target = ud->state.speed_changed = 1; - if( bl->type&BL_PC && st->speed < battle_config.max_walk_speed ) + if( bl->type&BL_PC && !(sd && sd->state.permanent_speed) && st->speed < battle_config.max_walk_speed ) st->speed = battle_config.max_walk_speed; if( bl->type&BL_HOM && battle_config.hom_setting&0x8 && ((TBL_HOM*)bl)->master) st->speed = status->get_speed(&((TBL_HOM*)bl)->master->bl); - - } if(flag&SCB_CRI && bst->cri) { @@ -5045,11 +5050,8 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc TBL_PC* sd = BL_CAST(BL_PC, bl); int speed_rate; - if( sc == NULL ) - return cap_value(speed,10,USHRT_MAX); - - if (sd && sd->state.permanent_speed) - return (short)cap_value(speed,10,USHRT_MAX); + if( sc == NULL || ( sd && sd->state.permanent_speed ) ) + return (unsigned short)cap_value(speed,MIN_WALK_SPEED,MAX_WALK_SPEED); if( sd && sd->ud.skilltimer != INVALID_TIMER && (pc->checkskill(sd,SA_FREECAST) > 0 || sd->ud.skill_id == LG_EXEEDBREAK) ) { @@ -5222,7 +5224,7 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc } - return (short)cap_value(speed,10,USHRT_MAX); + return (unsigned short)cap_value(speed,MIN_WALK_SPEED,MAX_WALK_SPEED); } // flag&1 - fixed value [malufett] -- cgit v1.2.3-70-g09d2 From 34b5ad00e2b7a3589040946b7825ef246bfafe99 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sat, 2 Nov 2013 20:56:10 -0200 Subject: Fixed Bug #7621 Magicmushroom poison now properly cancels skills being cast upon activating one of its own, also modified unit_skillcastcancel's error message upon timer deletion failure so that it becomes easier to debug in the future. http://hercules.ws/board/tracker/issue-7621-erro-map-server-waraitake/ Thanks to Beret Signed-off-by: shennetsind --- src/map/status.c | 20 ++++++++++---------- src/map/unit.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/map') diff --git a/src/map/status.c b/src/map/status.c index 0ff30595d..c06de4dfe 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -10379,7 +10379,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { if (sd && !pc_issit(sd)) { //can't cast if sit int mushroom_skill_id = 0, i; unit->stop_attack(bl); - unit->skillcastcancel(bl,1); + unit->skillcastcancel(bl,0); do { i = rnd() % MAX_SKILL_MAGICMUSHROOM_DB; mushroom_skill_id = skill->magicmushroom_db[i].skill_id; @@ -10387,15 +10387,15 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { while( mushroom_skill_id == 0 ); switch( skill->get_casttype(mushroom_skill_id) ) { // Magic Mushroom skills are buffs or area damage - case CAST_GROUND: - skill->castend_pos2(bl,bl->x,bl->y,mushroom_skill_id,1,tick,0); - break; - case CAST_NODAMAGE: - skill->castend_nodamage_id(bl,bl,mushroom_skill_id,1,tick,0); - break; - case CAST_DAMAGE: - skill->castend_damage_id(bl,bl,mushroom_skill_id,1,tick,0); - break; + case CAST_GROUND: + skill->castend_pos2(bl,bl->x,bl->y,mushroom_skill_id,1,tick,0); + break; + case CAST_NODAMAGE: + skill->castend_nodamage_id(bl,bl,mushroom_skill_id,1,tick,0); + break; + case CAST_DAMAGE: + skill->castend_damage_id(bl,bl,mushroom_skill_id,1,tick,0); + break; } } diff --git a/src/map/unit.c b/src/map/unit.c index 08e97cfee..c7ba2f6f9 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1966,7 +1966,7 @@ int unit_skillcastcancel(struct block_list *bl,int type) else ret = timer->delete( ud->skilltimer, skill->castend_id ); if( ret < 0 ) - ShowError("delete timer error : skill_id : %d\n",ret); + ShowError("delete timer error %d : skill %d (%s)\n",ret,skill_id,skill->get_name(skill_id)); ud->skilltimer = INVALID_TIMER; -- cgit v1.2.3-70-g09d2 From 6728c0fa88b84fccb6f179ae13cf8a15c1ea23a4 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 3 Nov 2013 20:19:26 +0100 Subject: Allow warp duplicates without a 'facing' value - Warps don't require a facing, so their duplicates shouldn't either. - Credits to jaBote. Signed-off-by: Haru --- doc/script_commands.txt | 4 ++-- src/map/npc.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index f2ba9f6ba..f0016b104 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -207,7 +207,7 @@ Ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter' ** Define a warp point -,,,%TAB%warp%TAB%%TAB%,,,, +,,{,}%TAB%warp%TAB%%TAB%,,,, This will define a warp NPC that will warp a player between maps, and while most arguments of that are obvious, some deserve special mention. @@ -299,7 +299,7 @@ items here. The layout used to define sale items still count, and ** Define an warp/shop/cashshop/NPC duplicate. -warp: ,,,%TAB%duplicate(