From 3fce137cbb7efb173c5a2c65671829bdc951918f Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Fri, 7 Feb 2014 09:54:59 +0700 Subject: [PATCH] Follow up 4019fb4 - Wrong macro for itemdb_is_element, thx @exneval - Incompatible type issue on UNT_BANDING. bugreport:8616 http://rathena.org/board/tracker/issue-8616-error-while-recompiling/ - Skill usage messages ot conf/msg_conf/map_msg.conf instead following official client fail message by clif_skill_fail() for each failure. (related with skill_require_db.txt) --> "%s is required." (similar: 28 messages) -->"[%s] Poison effect was applied to the weapon." (similar: 8 messages) -->"Please equipped with a %s." (similar: 7 messages) Signed-off-by: Cydh Ramdh --- conf/msg_conf/map_msg.conf | 7 ++- conf/msg_conf/map_msg_idn.conf | 7 ++- src/map/clif.c | 5 +- src/map/clif.h | 1 + src/map/itemdb.h | 2 +- src/map/skill.c | 98 ++++++++++++++++++++++------------ 6 files changed, 83 insertions(+), 37 deletions(-) diff --git a/conf/msg_conf/map_msg.conf b/conf/msg_conf/map_msg.conf index 84b282a595..cd92db2fd5 100644 --- a/conf/msg_conf/map_msg.conf +++ b/conf/msg_conf/map_msg.conf @@ -729,7 +729,12 @@ 718: Personal rate information is not displayed now. 719: Personal rate information will be shown. -//720-899 free +//Skill messages +720: %s is required. +721: [%s] Poison effect was applied to the weapon. +722: Please equipped with a %s. + +//723-899 free //------------------------------------ // More atcommands message diff --git a/conf/msg_conf/map_msg_idn.conf b/conf/msg_conf/map_msg_idn.conf index b98e78e7bf..8f48cca834 100644 --- a/conf/msg_conf/map_msg_idn.conf +++ b/conf/msg_conf/map_msg_idn.conf @@ -729,7 +729,12 @@ 718: Informasi mengenai rate pribadi tidak akan ditampilkan lagi. 719: Informasi mengenai rate pribadi akan ditampilkan kembali. -//720-899 kosong +//Pesan skill +720: Membutuhkan %s. +721: Efek [%s] Poison diberikan ke senjata. +722: Butuh memakai %s. + +//723-899 kosong //------------------------------------ // Pesan dalam perintah atcommand diff --git a/src/map/clif.c b/src/map/clif.c index e20ae4fdbc..7b6f149574 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -18016,7 +18016,10 @@ void packetdb_readdb(void) * *------------------------------------------*/ int do_init_clif(void) { - const char* colors[COLOR_MAX] = { "0xFF0000" }; + const char* colors[COLOR_MAX] = { + "0xFF0000", + "0xFFFFFF", + }; int i; /** * Setup Color Table (saves unnecessary load of strtoul on every call) diff --git a/src/map/clif.h b/src/map/clif.h index 6e85a69e87..1b5a62ea45 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -824,6 +824,7 @@ void clif_monster_hp_bar( struct mob_data* md, int fd ); **/ enum clif_colors { COLOR_RED, + COLOR_WHITE, COLOR_MAX }; diff --git a/src/map/itemdb.h b/src/map/itemdb.h index d8a71d1643..395983ef19 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -428,7 +428,7 @@ struct item_data* itemdb_exists(int nameid); #define itemdb_viewid(n) (itemdb_search(n)->view_id) #define itemdb_autoequip(n) (itemdb_search(n)->flag.autoequip) #define itemdb_is_rune(n) ((n >= ITEMID_NAUTHIZ && n <= ITEMID_HAGALAZ) || n == ITEMID_LUX_ANIMA) -#define itemdb_is_element(n) (n >= ITEMID_SCARLET_PTS && n <= ITEMID_SCARLET_PTS) +#define itemdb_is_element(n) (n >= ITEMID_SCARLET_PTS && n <= ITEMID_LIME_GREEN_PTS) #define itemdb_is_spellbook(n) (n >= ITEMID_MAGIC_BOOK_FB && n <= ITEMID_MAGIC_BOOK_DL) #define itemdb_is_poison(n) (n >= ITEMID_PARALYSE && n <= ITEMID_VENOMBLEED) #define itemid_isgemstone(id) ( (id) >= ITEMID_YELLOW_GEMSTONE && (id) <= ITEMID_BLUE_GEMSTONE ) diff --git a/src/map/skill.c b/src/map/skill.c index 85221ad78a..76ae8b9000 100755 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -12851,7 +12851,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_BANDING: if( battle_check_target(&src->bl, bl, BCT_ENEMY) > 0 && !(status_get_mode(bl)&MD_BOSS) && !(tsc && tsc->data[SC_BANDING_DEFENCE]) ) - sc_start(ss, bl, SC_BANDING_DEFENCE, (status_get_lv(src) / 5) + (sg->skill_lv * 5) - (status_get_agi(bl) / 10), 90, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(ss, bl, SC_BANDING_DEFENCE, (status_get_lv(&src->bl) / 5) + (sg->skill_lv * 5) - (status_get_agi(bl) / 10), 90, skill_get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_FIRE_MANTLE: @@ -14182,18 +14182,36 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i if (require.status_count) { uint8 i; /* May has multiple requirements */ - if (!sc) { - clif_skill_fail(sd, skill_id, USESKILL_FAIL_CONDITION, 0); - return false; - } + //if (!sc) { + // clif_skill_fail(sd, skill_id, USESKILL_FAIL_CONDITION, 0); + // return false; + //} for (i = 0; i < require.status_count; i++) { - if (require.status[i] >= 0 && !sc->data[require.status[i]]) { - if (require.status[i] == SC_PUSH_CART) { - clif_skill_fail(sd,skill_id,USESKILL_FAIL_CART,0); - return false; - } - clif_skill_fail(sd, skill_id, USESKILL_FAIL_CONDITION, 0); - return false; + enum sc_type req_sc = require.status[i]; + if (req_sc == SC_NONE) + continue; + + switch (req_sc) { + /* Official fail msg */ + case SC_PUSH_CART: + if (!sc || !sc->data[SC_PUSH_CART]) { + clif_skill_fail(sd,skill_id,USESKILL_FAIL_CART,0); + return false; + } + break; + case SC_POISONINGWEAPON: + if (!sc || !sc->data[SC_POISONINGWEAPON]) { + clif_skill_fail(sd,skill_id,USESKILL_FAIL_GC_POISONINGWEAPON,0); + return false; + } + break; + + default: + if (!sc || !sc->data[req_sc]) { + clif_skill_fail(sd, skill_id, USESKILL_FAIL_CONDITION, 0); + return false; + } + break; } } } @@ -14205,8 +14223,8 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i if(!reqeqit) break; //no more required item get out of here if (!pc_checkequip2(sd,reqeqit,EQI_ACC_L,EQI_MAX)) { char output[128]; - //clif_skill_fail(sd, skill_id, USESKILL_FAIL_NEED_EQUIPMENT, reqeqit); - sprintf(output,"Please equip with a %d.",reqeqit); // Officially, some Mechanic skills failure message displays this rather than just "Skill has failed." + //Official use msgstringtable.txt for each skill failure + sprintf(output,msg_txt(sd,722),itemdb_jname(reqeqit)); clif_colormes(sd,color_table[COLOR_RED],output); return false; } @@ -14401,16 +14419,18 @@ bool skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, continue; index[i] = pc_search_inventory(sd,require.itemid[i]); if( index[i] < 0 || sd->status.inventory[index[i]].amount < require.amount[i] ) { - if( require.itemid[i] == ITEMID_RED_GEMSTONE ) - clif_skill_fail(sd,skill_id,USESKILL_FAIL_REDJAMSTONE,0);// red gemstone required - else if( require.itemid[i] == ITEMID_BLUE_GEMSTONE ) - clif_skill_fail(sd,skill_id,USESKILL_FAIL_BLUEJAMSTONE,0);// blue gemstone required - else { - // char output[128]; //not offi but more explicit msg - clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - // sprintf(output, "You need itemid=%d, amount=%d", require.itemid[i], require.amount[i]); - // clif_colormes(sd,color_table[COLOR_RED],output); - } + //if( require.itemid[i] == ITEMID_RED_GEMSTONE ) + // clif_skill_fail(sd,skill_id,USESKILL_FAIL_REDJAMSTONE,0);// red gemstone required + //else if( require.itemid[i] == ITEMID_BLUE_GEMSTONE ) + // clif_skill_fail(sd,skill_id,USESKILL_FAIL_BLUEJAMSTONE,0);// blue gemstone required + //else { + //Official is using msgstringtable.txt for each requirement failure + char output[CHAT_SIZE_MAX]; + //clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + //sprintf(output, "You need itemid=%d, amount=%d", require.itemid[i], require.amount[i]); + sprintf(output, msg_txt(sd,720), itemdb_jname(require.itemid[i])); // %s is required. + clif_colormes(sd,color_table[COLOR_RED],output); + //} return false; } } @@ -17805,29 +17825,41 @@ int skill_arrow_create (struct map_session_data *sd, int nameid) int skill_poisoningweapon( struct map_session_data *sd, int nameid) { sc_type type; int chance, i; + //uint16 msg = 1443; //Official is using msgstringtable.txt + char output[CHAT_SIZE_MAX]; + const char *msg; + nullpo_ret(sd); + if( nameid <= 0 || (i = pc_search_inventory(sd,nameid)) < 0 || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) { clif_skill_fail(sd,GC_POISONINGWEAPON,USESKILL_FAIL_LEVEL,0); return 0; } + switch( nameid ) { // t_lv used to take duration from skill_get_time2 - case ITEMID_PARALYSE: type = SC_PARALYSE; break; - case ITEMID_PYREXIA: type = SC_PYREXIA; break; - case ITEMID_DEATHHURT: type = SC_DEATHHURT; break; - case ITEMID_LEECHESEND: type = SC_LEECHESEND; break; - case ITEMID_VENOMBLEED: type = SC_VENOMBLEED; break; - case ITEMID_TOXIN: type = SC_TOXIN; break; - case ITEMID_MAGICMUSHROOM: type = SC_MAGICMUSHROOM; break; - case ITEMID_OBLIVIONCURSE: type = SC_OBLIVIONCURSE; break; + case ITEMID_PARALYSE: type = SC_PARALYSE; /*msg = 1444;*/ msg = "Paralyze"; break; + case ITEMID_PYREXIA: type = SC_PYREXIA; /*msg = 1448;*/ msg = "Pyrexia"; break; + case ITEMID_DEATHHURT: type = SC_DEATHHURT; /*msg = 1447;*/ msg = "Deathhurt"; break; + case ITEMID_LEECHESEND: type = SC_LEECHESEND; /*msg = 1450;*/ msg = "Leech End"; break; + case ITEMID_VENOMBLEED: type = SC_VENOMBLEED; /*msg = 1445;*/ msg = "Venom Bleed"; break; + case ITEMID_TOXIN: type = SC_TOXIN; /*msg = 1443;*/ msg = "Toxin"; break; + case ITEMID_MAGICMUSHROOM: type = SC_MAGICMUSHROOM; /*msg = 1446;*/ msg = "Magic Mushroom"; break; + case ITEMID_OBLIVIONCURSE: type = SC_OBLIVIONCURSE; /*msg = 1449;*/ msg = "Oblivion Curse"; break; default: clif_skill_fail(sd,GC_POISONINGWEAPON,USESKILL_FAIL_LEVEL,0); return 0; } - + chance = 2 + 2 * sd->menuskill_val; // 2 + 2 * skill_lv sc_start4(&sd->bl,&sd->bl, SC_POISONINGWEAPON, 100, pc_checkskill(sd, GC_RESEARCHNEWPOISON), //in Aegis it store the level of GC_RESEARCHNEWPOISON in val1 type, chance, 0, skill_get_time(GC_POISONINGWEAPON, sd->menuskill_val)); + sprintf(output, msg_txt(sd,721), msg); + clif_colormes(sd,color_table[COLOR_WHITE],output); + +/*#if PACKETVER >= 20110208 //! TODO: Check the correct PACKVETVER + clif_msg(sd,msg); +#endif*/ return 0; }