From 68b16d11c5f3cdf67a58154dbf22ad3da60a6f9f Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Tue, 18 Mar 2014 19:01:07 +0100 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 8 +++ .../HPMHooking/HPMHooking.HookingPoints.inc | 2 + src/plugins/HPMHooking/HPMHooking.Hooks.inc | 59 ++++++++++++++++++++-- 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index 4f37743f6..0f1a72d01 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -219,6 +219,10 @@ struct { struct HPMHookPoint *HP_bg_send_xy_timer_sub_post; struct HPMHookPoint *HP_bg_send_xy_timer_pre; struct HPMHookPoint *HP_bg_send_xy_timer_post; + struct HPMHookPoint *HP_bg_afk_timer_pre; + struct HPMHookPoint *HP_bg_afk_timer_post; + struct HPMHookPoint *HP_bg_str2teamtype_pre; + struct HPMHookPoint *HP_bg_str2teamtype_post; struct HPMHookPoint *HP_bg_config_read_pre; struct HPMHookPoint *HP_bg_config_read_post; struct HPMHookPoint *HP_buyingstore_setup_pre; @@ -5252,6 +5256,10 @@ struct { int HP_bg_send_xy_timer_sub_post; int HP_bg_send_xy_timer_pre; int HP_bg_send_xy_timer_post; + int HP_bg_afk_timer_pre; + int HP_bg_afk_timer_post; + int HP_bg_str2teamtype_pre; + int HP_bg_str2teamtype_post; int HP_bg_config_read_pre; int HP_bg_config_read_post; int HP_buyingstore_setup_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index dd8c603d3..d6a6a4af2 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -115,6 +115,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(bg->send_message, HP_bg_send_message) }, { HP_POP(bg->send_xy_timer_sub, HP_bg_send_xy_timer_sub) }, { HP_POP(bg->send_xy_timer, HP_bg_send_xy_timer) }, + { HP_POP(bg->afk_timer, HP_bg_afk_timer) }, + { HP_POP(bg->str2teamtype, HP_bg_str2teamtype) }, { HP_POP(bg->config_read, HP_bg_config_read) }, /* buyingstore */ { HP_POP(buyingstore->setup, HP_buyingstore_setup) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 396b241b0..ed3e505b9 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -2648,11 +2648,11 @@ bool HP_bg_team_join(int bg_id, struct map_session_data *sd) { } return retVal___; } -int HP_bg_team_leave(struct map_session_data *sd, int flag) { +int HP_bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type flag) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_bg_team_leave_pre ) { - int (*preHookFunc) (struct map_session_data *sd, int *flag); + int (*preHookFunc) (struct map_session_data *sd, enum bg_team_leave_type *flag); for(hIndex = 0; hIndex < HPMHooks.count.HP_bg_team_leave_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_bg_team_leave_pre[hIndex].func; retVal___ = preHookFunc(sd, &flag); @@ -2666,7 +2666,7 @@ int HP_bg_team_leave(struct map_session_data *sd, int flag) { retVal___ = HPMHooks.source.bg.team_leave(sd, flag); } if( HPMHooks.count.HP_bg_team_leave_post ) { - int (*postHookFunc) (int retVal___, struct map_session_data *sd, int *flag); + int (*postHookFunc) (int retVal___, struct map_session_data *sd, enum bg_team_leave_type *flag); for(hIndex = 0; hIndex < HPMHooks.count.HP_bg_team_leave_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_bg_team_leave_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, &flag); @@ -2836,6 +2836,59 @@ int HP_bg_send_xy_timer(int tid, int64 tick, int id, intptr_t data) { } return retVal___; } +int HP_bg_afk_timer(int tid, int64 tick, int id, intptr_t data) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_bg_afk_timer_pre ) { + int (*preHookFunc) (int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_bg_afk_timer_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_bg_afk_timer_pre[hIndex].func; + retVal___ = preHookFunc(&tid, &tick, &id, &data); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.bg.afk_timer(tid, tick, id, data); + } + if( HPMHooks.count.HP_bg_afk_timer_post ) { + int (*postHookFunc) (int retVal___, int *tid, int64 *tick, int *id, intptr_t *data); + for(hIndex = 0; hIndex < HPMHooks.count.HP_bg_afk_timer_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_bg_afk_timer_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &tid, &tick, &id, &data); + } + } + return retVal___; +} +enum bg_queue_types HP_bg_str2teamtype(const char *str) { +/* Unknown return type 'enum bg_queue_types'. Initializing to '0'. */ + int hIndex = 0; + enum bg_queue_types retVal___ = 0; + if( HPMHooks.count.HP_bg_str2teamtype_pre ) { + enum bg_queue_types (*preHookFunc) (const char *str); + for(hIndex = 0; hIndex < HPMHooks.count.HP_bg_str2teamtype_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_bg_str2teamtype_pre[hIndex].func; + retVal___ = preHookFunc(str); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.bg.str2teamtype(str); + } + if( HPMHooks.count.HP_bg_str2teamtype_post ) { + enum bg_queue_types (*postHookFunc) (enum bg_queue_types retVal___, const char *str); + for(hIndex = 0; hIndex < HPMHooks.count.HP_bg_str2teamtype_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_bg_str2teamtype_post[hIndex].func; + retVal___ = postHookFunc(retVal___, str); + } + } + return retVal___; +} void HP_bg_config_read(void) { int hIndex = 0; if( HPMHooks.count.HP_bg_config_read_pre ) { -- cgit v1.2.3-70-g09d2 From f7cd6b42179e2cdb5bbea3b9c060d0fc56d265b6 Mon Sep 17 00:00:00 2001 From: AnnieRuru Date: Thu, 20 Mar 2014 04:14:49 +0800 Subject: Fix various documentation bugs Fix certain type of bonus can actually trigger with weapon skills http://hercules.ws/board/tracker/issue-7897-bug-or-bad-description/ Fix duplicate sample typo http://hercules.ws/board/tracker/issue-4984-wrong-test-duplicate-npc-sample/ skill script command doesn't has type 4 http://hercules.ws/board/tracker/issue-7565-skill-script-command-invalid-flag/ --- doc/item_bonus.txt | 20 ++++++++++---------- doc/sample/npc_test_duplicate.txt | 7 ++++--- doc/script_commands.txt | 4 ---- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt index b9dc9080f..7a37060d7 100644 --- a/doc/item_bonus.txt +++ b/doc/item_bonus.txt @@ -3,7 +3,7 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20130623 +//= 20140320 //===== Description: ========================================= //= List of script instructions used in item bonuses, //= mainly bonus/bonus2/bonus3/bonus4/bonus5 arguments. @@ -288,7 +288,7 @@ bonus2 bAddMonsterDropChainItem,n,x; Able to get item of chain type n (only cons 5=Fish, 6=Demon, 7=Demi-Human, 8=Angel, 9=Dragon, 10=Boss monster, 11=Other than (normal monster) boss monster -bonus2 bWeaponComaRace,x,y; y/100% chance to cause Coma when attacking a monster of race x with a normal attack +bonus2 bWeaponComaRace,x,y; y/100% chance to cause Coma when attacking a monster of race x with a weapon attack 0=Formless, 1=Undead, 2=Brute, 3=Plant, 4=Insect, 5=Fish, 6=Demon, 7=Demi-Human, 8=Angel, 9=Dragon, 10=Boss monster, 11=Other than (normal monster) boss monster @@ -365,7 +365,7 @@ bonus bBreakArmorRate,n; Adds a n/100% chance to break enemy's armor while atta bonus bUnbreakable,n; Reduces the break chance of all equipped equipment by n%. bonus bShortWeaponDamageReturn,n; Reflects n% of received melee damage back to the enemy that caused it. bonus bLongWeaponDamageReturn,n; Reflects n% of received ranged damage back to the enemy that caused it. -bonus2 bWeaponComaEle,x,n; Adds a n/100% chance to cause Coma when attacking a monster of element x with normal attack. +bonus2 bWeaponComaEle,x,n; Adds a n/100% chance to cause Coma when attacking a monster of element x with weapon attack. x: 0=Neutral, 1=Water, 2=Earth, 3=Fire, 4=Wind, 5=Poison, 6=Holy, 7=Dark, 8=Spirit, 9=Undead bonus2 bAddEff2,x,n; Adds a n/100% chance to cause status change x on self when attacking. @@ -375,15 +375,15 @@ bonus bMagicDamageReturn,n; Adds a n% chance to reflect targetted magic spells bonus bPerfectHide,n; Hidden/cloaked character is no longer detected by monsters with 'detector' mode (n is meaningless). bonus bNoKnockback,n; Character is no longer knocked back by enemy skills with such effect (n is meaningless). bonus bClassChange,n; Gives a n/100% chance to change the attacked monster's class with normal attack. -bonus bHPDrainValue,n; Heals +n HP with normal attack. -bonus2 bHPDrainValue,n,x; Heals +n HP with normal attack. When x is non-zero, the HP is drained instead. +bonus bHPDrainValue,n; Heals +n HP with weapon attack. +bonus2 bHPDrainValue,n,x; Heals +n HP with weapon attack. When x is non-zero, the HP is drained instead. bonus2 bWeaponAtk,x,n; Adds n ATK when weapon of type x is equipped. x: see doc/item_db.txt -> view -> weapons for possible values -bonus2 bWeaponAtkRate,x,n; Adds n% damage to normal attacks when weapon of type x is equipped. +bonus2 bWeaponAtkRate,x,n; Adds n% damage to weapon attacks when weapon of type x is equipped. x: see doc/item_db.txt -> view -> weapons for possible values bonus bDelayrate,n; Increases skill delay by n%. -bonus3 bHPDrainRateRace,r,n,x; Adds a n/10% chance to receive x% of damage dealt as HP from a monster of race r with normal attack. -bonus3 bSPDrainRateRace,r,n,x; Adds a n/10% chance to receive x% of damage dealt as SP from a monster of race r with normal attack. +bonus3 bHPDrainRateRace,r,n,x; Adds a n/10% chance to receive x% of damage dealt as HP from a monster of race r with weapon attack. +bonus3 bSPDrainRateRace,r,n,x; Adds a n/10% chance to receive x% of damage dealt as SP from a monster of race r with weapon attack. bonus3 bAddEffOnSkill,s,x,n; Adds a n/100% chance to cause status change x on enemy when using skill s (supports skill names) bonus4 bAddEffOnSkill,s,x,n,t; Adds a n/100% chance to cause status change x when using skill s (supports skill names) t: ATF_SELF = causes status change to oneself @@ -391,8 +391,8 @@ bonus4 bAddEffOnSkill,s,x,n,t; Adds a n/100% chance to cause status change x wh bonus bNoMiscDamage,n; Adds n% reduction to received misc damage. bonus bLongAtkRate,n; Increases damage of ranged attacks by n%. bonus bUnstripable,n; Armor cannot be taken off via strip skills (n is meaningless) -bonus2 bHPDrainValueRace,r,n; Heals +n HP when attacking a monster of race r with normal attack. -bonus2 bSPDrainValueRace,r,n; Heals +n SP when attacking a monster of race r with normal attack. +bonus2 bHPDrainValueRace,r,n; Heals +n HP when attacking a monster of race r with weapon attack. +bonus2 bSPDrainValueRace,r,n; Heals +n SP when attacking a monster of race r with weapon attack. bonus bMagicSPGainValue,n; Heals +n SP when killing an enemy with magic attack. bonus bMagicHPGainValue,n; Heals +n HP when killing an enemy with magic attack. diff --git a/doc/sample/npc_test_duplicate.txt b/doc/sample/npc_test_duplicate.txt index 7f2855a49..55d64bc7b 100644 --- a/doc/sample/npc_test_duplicate.txt +++ b/doc/sample/npc_test_duplicate.txt @@ -3,13 +3,13 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20131225 +//= 20140320 //===== Description: ========================================= //= An example of how duplicate NPCs are handled: //= NPC variables are shared between all duplicates. -//= Each duplicate knows its own map coordinates. +//= In this sample, to get the NPC coordinate, has to trigger OnTouch //= Duplicates always override the source NPC's trigger area (even 0x0). -//= 'OnInit' loads the middle Poring last, for some reason. +//= 'OnInit' loads the main npc last, for some reason. (check with debugmes) //============================================================ - script Test Script -1,1,1,{ @@ -19,6 +19,7 @@ OnInit: getmapxy(.map$, .x, .y, 1); + debugmes strnpcinfo(0); end; OnTouch: diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 5e3f62a69..d1175413e 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -5511,10 +5511,6 @@ Flag 3 is the same as flag 0 in that it saves to the database. However, these skills are ignored when any action is taken that adjusts the skill tree (reset/job change). -Flag 4 is the same as flag 1 in that it saves to the database. However, -these skills are ignored when any action is taken that adjusts the skill -tree (reset/job change). - --------------------------------------- *nude; -- cgit v1.2.3-70-g09d2 From a80bfc15cf01d55c556ee2924349511096bd4467 Mon Sep 17 00:00:00 2001 From: panikon Date: Thu, 20 Mar 2014 14:25:42 -0300 Subject: Fixed issue 8059 http://hercules.ws/board/tracker/issue-8059-teakwon-100-chance-on-stances/ --- src/map/skill.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/map/skill.c b/src/map/skill.c index 78f5fe3f1..18fe46afe 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -760,15 +760,15 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 // Chance to trigger Taekwon kicks [Dralnu] if(sc && !sc->data[SC_COMBOATTACK]) { if(sc->data[SC_STORMKICK_READY] && - sc_start(NULL,src,SC_COMBOATTACK, 15, TK_STORMKICK, + sc_start(src,src,SC_COMBOATTACK, 15, TK_STORMKICK, (2000 - 4*sstatus->agi - 2*sstatus->dex))) ; //Stance triggered else if(sc->data[SC_DOWNKICK_READY] && - sc_start(NULL,src,SC_COMBOATTACK, 15, TK_DOWNKICK, + sc_start(src,src,SC_COMBOATTACK, 15, TK_DOWNKICK, (2000 - 4*sstatus->agi - 2*sstatus->dex))) ; //Stance triggered else if(sc->data[SC_TURNKICK_READY] && - sc_start(NULL,src,SC_COMBOATTACK, 15, TK_TURNKICK, + sc_start(src,src,SC_COMBOATTACK, 15, TK_TURNKICK, (2000 - 4*sstatus->agi - 2*sstatus->dex))) ; //Stance triggered else if (sc->data[SC_COUNTERKICK_READY]) { //additional chance from SG_FRIEND [Komurka] @@ -777,7 +777,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 rate += rate*sc->data[SC_SKILLRATE_UP]->val2/100; status_change_end(src, SC_SKILLRATE_UP, INVALID_TIMER); } - sc_start2(NULL, src, SC_COMBOATTACK, rate, TK_COUNTER, bl->id, + sc_start2(src, src, SC_COMBOATTACK, rate, TK_COUNTER, bl->id, (2000 - 4*sstatus->agi - 2*sstatus->dex)); } } -- cgit v1.2.3-70-g09d2 From 4e73bda7d56db627d98608ba7b12711568766b79 Mon Sep 17 00:00:00 2001 From: AnnieRuru Date: Fri, 21 Mar 2014 04:55:31 +0800 Subject: Fix hunting mission and clarify weight's unit Fix hunting mission not able to take mission after a character has deleted http://hercules.ws/board/tracker/issue-8104-hunting-missiontxt-delete-character/ Clarify Weight and MaxWeight unit as in 0.1 http://hercules.ws/board/tracker/issue-7836-weight-and-maxweight/ --- doc/item_db.txt | 2 +- doc/script_commands.txt | 7 +++++++ npc/custom/quests/hunting_missions.txt | 9 ++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/item_db.txt b/doc/item_db.txt index 30aa845f3..7035ed684 100644 --- a/doc/item_db.txt +++ b/doc/item_db.txt @@ -18,7 +18,7 @@ item_db: ( Type: Item Type (int, defaults to 3 = etc item) Buy: Buy Price (int, defaults to Sell * 2) Sell: Sell Price (int, defaults to Buy / 2) - Weight: Item Weight (int, defaults to 0) + Weight: Item Weight (int, defaults to 0, units in Weight/10 ) Atk: Attack (int, defaults to 0) Matk: Magical Attack (int, defaults to 0, ignored in pre-re) Def: Defense (int, defaults to 0) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index d1175413e..767aa5459 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -522,7 +522,9 @@ JobExp - Amount of job experience points. NextBaseExp - Amount of base experience points needed to reach next level. NextJobExp - Amount of job experience points needed to reach next level. Weight - Amount of weight the character currently carries. + Display as in Weight/10. MaxWeight - Maximum weight the character can carry. + Display as in MaxWeight/10. Sex - 0 if female, 1 if male. Class - Character's job. Upper - 0 if the character is normal class, 1 if advanced, 2 if baby. @@ -2376,6 +2378,11 @@ You can also use this command to get stat values. if (readparam(bVit) > 77) mes "Only people with over 77 Vit are reading this!"; +Example 3: + + // Display your current weight + mes "Your current weight is "+( Weight/10 )+"/"+( MaxWeight/10 ); + --------------------------------------- *getcharid({,""}) diff --git a/npc/custom/quests/hunting_missions.txt b/npc/custom/quests/hunting_missions.txt index 8da51a1c0..c4e8187de 100644 --- a/npc/custom/quests/hunting_missions.txt +++ b/npc/custom/quests/hunting_missions.txt @@ -3,7 +3,7 @@ //===== By: ================================================== //= Euphy //===== Current Version: ===================================== -//= 1.3a +//= 1.4a //===== Description: ========================================= //= Random hunting missions. //= Rewards are based on quest difficulty. @@ -14,6 +14,9 @@ //= SQL query, both thanks to AnnieRuru. //= 1.3 Re-added a blacklist adapted for the SQL query. //= 1.3a Added mission reset options. +//= 1.4 Fix ranking table using new SQL database [ossi0110] +//= 1.4a Fix a bug when a character has deleted, that account +//= can't do mission. [AnnieRuru] //============================================================ prontera,152,187,6 script Hunting Missions 4_F_EDEN_MASTER,{ @@ -41,7 +44,7 @@ function Chk; function Cm; switch(select(((!Mission0)?" ~ New Mission::":": ~ Mission Status: ~ Abandon Mission")+": ~ Information: ~ Mission Shop: ~ View Top Hunters: ~ ^777777Cancel^000000")) { case 1: mes "[Hunting Missions]"; - if (#Mission_Count) { + if ( query_sql( "SELECT 1 FROM `char_reg_num_db` WHERE `key` = 'Mission0' AND `char_id` IN ( SELECT `char_id` FROM `char` WHERE `account_id` = "+ getcharid(3) +" )", .@dummy ) && #Mission_Count ) { mes "You've started a mission"; mes "on another character."; close; @@ -126,7 +129,7 @@ function Chk; function Cm; case 6: mes "[Hunting Missions]"; mes "The top hunters are:"; - query_sql("SELECT char_id AS id, (SELECT `name` FROM `char` WHERE char_id = id),`value` FROM `char_reg_num_db` WHERE `key` = 'Mission_Total' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 5",.@id,.@name$,.@val); + query_sql("SELECT char_id AS id, (SELECT `name` FROM `char` WHERE char_id = id),`value` FROM `char_reg_num_db` WHERE `key` = 'Mission_Total' ORDER BY `value` DESC LIMIT 5",.@id,.@name$,.@val); for(set .@i,0; .@i<5; set .@i,.@i+1) mes " [Rank "+(.@i+1)+"] "+((.@name$[.@i] == "")?"^777777none":"^0055FF"+.@name$[.@i]+"^000000 : ^FF0000"+.@val[.@i]+" pt.")+"^000000"; close; -- cgit v1.2.3-70-g09d2 From 0100bae77ee878e32be116bce33453b4da1b6e42 Mon Sep 17 00:00:00 2001 From: panikon Date: Thu, 20 Mar 2014 19:00:02 -0300 Subject: Fixed issue: 8047 http://hercules.ws/board/tracker/issue-8047-taekwon-stance-item/ --- src/map/skill.c | 58 ++++++++++++++++++++++++++++++++++----------------------- src/map/skill.h | 1 + src/map/unit.c | 8 ++++++-- 3 files changed, 42 insertions(+), 25 deletions(-) diff --git a/src/map/skill.c b/src/map/skill.c index 18fe46afe..390900d4f 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -12496,6 +12496,35 @@ int skill_isammotype (struct map_session_data *sd, int skill_id) ); } +/** + * Checks whether a skill can be used in combos or not + **/ +bool skill_is_combo( int skill_id ) +{ + switch( skill_id ) + { + case MO_CHAINCOMBO: + case MO_COMBOFINISH: + case CH_TIGERFIST: + case CH_CHAINCRUSH: + case MO_EXTREMITYFIST: + case TK_TURNKICK: + case TK_STORMKICK: + case TK_DOWNKICK: + case TK_COUNTER: + case TK_JUMPKICK: + case HT_POWER: + case GC_COUNTERSLASH: + case GC_WEAPONCRUSH: + case SR_FALLENEMPIRE: + case SR_DRAGONCOMBO: + case SR_TIGERCANNON: + case SR_GATEOFHELL: + return true; + } + return false; +} + int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) { struct status_data *st; struct status_change *sc; @@ -13389,29 +13418,11 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 0; } - if( sd->sc.data[SC_COMBOATTACK] ) { - switch( skill_id ) { - case MO_CHAINCOMBO: - case MO_COMBOFINISH: - case CH_TIGERFIST: - case CH_CHAINCRUSH: - case MO_EXTREMITYFIST: - case TK_TURNKICK: - case TK_STORMKICK: - case TK_DOWNKICK: - case TK_COUNTER: - case TK_JUMPKICK: - case HT_POWER: - case GC_COUNTERSLASH: - case GC_WEAPONCRUSH: - case SR_FALLENEMPIRE: - case SR_DRAGONCOMBO: - case SR_TIGERCANNON: - case SR_GATEOFHELL: - break; - default: return 0; - } - } + // There's no need to check if the skill is part of a combo if it's + // already been checked before, see unit_skilluse_id2 [Panikon] + // Note that if this check is readded part of issue:8047 will reapear! + //if( sd->sc.data[SC_COMBOATTACK] && !skill->is_combo(skill_id ) ) + // return 0; return 1; } @@ -18471,6 +18482,7 @@ void skill_defaults(void) { skill->chk = skill_chk; skill->get_casttype = skill_get_casttype; skill->get_casttype2 = skill_get_casttype2; + skill->is_combo = skill_is_combo; skill->name2id = skill_name2id; skill->isammotype = skill_isammotype; skill->castend_id = skill_castend_id; diff --git a/src/map/skill.h b/src/map/skill.h index 13d34d267..dda310bd4 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -1870,6 +1870,7 @@ struct skill_interface { /* whether its CAST_GROUND, CAST_DAMAGE or CAST_NODAMAGE */ int (*get_casttype) (uint16 skill_id); int (*get_casttype2) (uint16 index); + bool (*is_combo) (int skill_id); int (*name2id) (const char* name); int (*isammotype) (struct map_session_data *sd, int skill_id); int (*castend_id) (int tid, int64 tick, int id, intptr_t data); diff --git a/src/map/unit.c b/src/map/unit.c index 5dd63879f..39fff0eab 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1092,8 +1092,12 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui sc = NULL; //Unneeded //temp: used to signal combo-skills right now. - if (sc && sc->data[SC_COMBOATTACK] && (sc->data[SC_COMBOATTACK]->val1 == skill_id || - (sd?skill->check_condition_castbegin(sd,skill_id,skill_lv):0) )) { + if (sc && sc->data[SC_COMBOATTACK] + && skill->is_combo(skill_id) + && (sc->data[SC_COMBOATTACK]->val1 == skill_id + || ( sd?skill->check_condition_castbegin(sd,skill_id,skill_lv):0 ) + ) + ) { if (sc->data[SC_COMBOATTACK]->val2) target_id = sc->data[SC_COMBOATTACK]->val2; else -- cgit v1.2.3-70-g09d2 From 97b2b65cbe62c8e3a6b694bf6f92be8ec3c08475 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Thu, 20 Mar 2014 23:11:23 +0100 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 4 ++++ .../HPMHooking/HPMHooking.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking.Hooks.inc | 26 ++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index 0f1a72d01..3827f3e84 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -4403,6 +4403,8 @@ struct { struct HPMHookPoint *HP_skill_get_casttype_post; struct HPMHookPoint *HP_skill_get_casttype2_pre; struct HPMHookPoint *HP_skill_get_casttype2_post; + struct HPMHookPoint *HP_skill_is_combo_pre; + struct HPMHookPoint *HP_skill_is_combo_post; struct HPMHookPoint *HP_skill_name2id_pre; struct HPMHookPoint *HP_skill_name2id_post; struct HPMHookPoint *HP_skill_isammotype_pre; @@ -9440,6 +9442,8 @@ struct { int HP_skill_get_casttype_post; int HP_skill_get_casttype2_pre; int HP_skill_get_casttype2_post; + int HP_skill_is_combo_pre; + int HP_skill_is_combo_post; int HP_skill_name2id_pre; int HP_skill_name2id_post; int HP_skill_isammotype_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index d6a6a4af2..8693f6b0f 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -2237,6 +2237,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(skill->chk, HP_skill_chk) }, { HP_POP(skill->get_casttype, HP_skill_get_casttype) }, { HP_POP(skill->get_casttype2, HP_skill_get_casttype2) }, + { HP_POP(skill->is_combo, HP_skill_is_combo) }, { HP_POP(skill->name2id, HP_skill_name2id) }, { HP_POP(skill->isammotype, HP_skill_isammotype) }, { HP_POP(skill->castend_id, HP_skill_castend_id) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index ed3e505b9..f0932f518 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -56894,6 +56894,32 @@ int HP_skill_get_casttype2(uint16 index) { } return retVal___; } +bool HP_skill_is_combo(int skill_id) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_skill_is_combo_pre ) { + bool (*preHookFunc) (int *skill_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_is_combo_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_skill_is_combo_pre[hIndex].func; + retVal___ = preHookFunc(&skill_id); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.skill.is_combo(skill_id); + } + if( HPMHooks.count.HP_skill_is_combo_post ) { + bool (*postHookFunc) (bool retVal___, int *skill_id); + for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_is_combo_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_skill_is_combo_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &skill_id); + } + } + return retVal___; +} int HP_skill_name2id(const char *name) { int hIndex = 0; int retVal___ = 0; -- cgit v1.2.3-70-g09d2 From c9310f3ffdf0532ee728f256590d516106050885 Mon Sep 17 00:00:00 2001 From: panikon Date: Thu, 20 Mar 2014 21:05:16 -0300 Subject: Fixed issue 6415 http://hercules.ws/board/tracker/issue-6415-kaite-skills-reflect/ --- src/map/skill.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/map/skill.c b/src/map/skill.c index 390900d4f..4b2bc200e 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2054,8 +2054,11 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in } -//Checks if 'bl' should reflect back a spell cast by 'src'. -//type is the type of magic attack: 0: indirect (aoe), 1: direct (targetted) +// Checks if 'bl' should reflect back a spell cast by 'src'. +// type is the type of magic attack: 0: indirect (aoe), 1: direct (targetted) +// In case of success returns type of reflection, otherwise 0 +// 1 - Regular reflection (Maya) +// 2 - SL_KAITE reflection int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type) { struct status_change *sc = status->get_sc(bl); struct map_session_data* sd = BL_CAST(BL_PC, bl); @@ -2197,7 +2200,15 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr * Official Magic Reflection Behavior : damage reflected depends on gears caster wears, not target **/ #if MAGIC_REFLECTION_TYPE - if( dmg.dmg_lv != ATK_MISS ){ //Wiz SL cancelled and consumed fragment + + #if defined(DISABLE_RENEWAL) + // issue:6415 in pre-renewal Kaite reflected the entire damage received + // regardless of caster's equipament (Aegis 11.1) + if( dmg.dmg_lv != ATK_MISS && type == 1 ) //Wiz SL cancelled and consumed fragment + #else + if( dmg.dmg_lv != ATK_MISS ) //Wiz SL cancelled and consumed fragment + #endif + { short s_ele = skill->get_ele(skill_id, skill_lv); if (s_ele == -1) // the skill takes the weapon's element @@ -2218,10 +2229,9 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr status_change_end(bl, SC_ENERGYCOAT, INVALID_TIMER); //Reduction: 6% + 6% every 20% dmg.damage -= dmg.damage * (6 * (1+per)) / 100; - } - + } } - #endif + #endif /* MAGIC_REFLECTION_TYPE */ } if(sc && sc->data[SC_MAGICROD] && src == dsrc) { int sp = skill->get_sp(skill_id,skill_lv); -- cgit v1.2.3-70-g09d2 From 26f2adab3126c5b76a93c3220ccfb4aec7db07e1 Mon Sep 17 00:00:00 2001 From: jaBote Date: Fri, 21 Mar 2014 21:39:26 +0100 Subject: Update rAthena-main-upgrade.sql Added in the differences from some months ago. Very special thanks to @dastgirpojee for the autotrade saving script! None of us could test with actual data, so feel free to try it and point out any flaws you can see. --- sql-files/upgrades/rAthena-main-upgrade.sql | 258 +++++++++++++++++++++++++--- 1 file changed, 231 insertions(+), 27 deletions(-) diff --git a/sql-files/upgrades/rAthena-main-upgrade.sql b/sql-files/upgrades/rAthena-main-upgrade.sql index 19f6d55ec..165584795 100644 --- a/sql-files/upgrades/rAthena-main-upgrade.sql +++ b/sql-files/upgrades/rAthena-main-upgrade.sql @@ -4,36 +4,55 @@ -- Remember to make a backup before applying. -- We are not liable for any data loss this may cause. -- Apply in the same database you applied your main.sql +-- Last revised: March 21, 2014 20:30 -- Drop table contents from ´sc_data´ since we use a different status order than rAthena -- /!\ WARNING /!\ This will remove _ALL_ of the status effects active on the server +-- You can disable this, but this is a SECURITY MEASURE -- This will remove even jailed status from users! TRUNCATE TABLE `sc_data`; - -- Drop table `skillcooldown` since it's not used in Hercules DROP TABLE IF EXISTS `skillcooldown`; + -- Upgrades for table `cart_inventory` ALTER TABLE `cart_inventory` MODIFY `bound` tinyint(1) unsigned NOT NULL default '0'; + -- Upgrades for table `char` ALTER TABLE `char` CHANGE `moves` `slotchange` SMALLINT(3) UNSIGNED NOT NULL default '0', - ADD `char_opt` INT( 11 ) UNSIGNED NOT NULL default '0', - ADD `font` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0'; - ADD `unban_time` int(11) unsigned NOT NULL default '0'; + ADD `char_opt` INT( 11 ) UNSIGNED NOT NULL default '0' AFTER `slotchange`, + ADD `font` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `char_opt`; + -- Upgrades for table `guild_storage` ALTER TABLE `guild_storage` MODIFY `bound` tinyint(1) unsigned NOT NULL default '0'; + -- Upgrades for table `inventory` ALTER TABLE `inventory` MODIFY `bound` tinyint(1) unsigned NOT NULL default '0'; --- Bank vault is saved later since we need to make a table rAthena doesn't have first + +-- Login table will be upgraded at a later point on this file +-- so that we can save the bank vault. + + +-- Upgrades for table `mapreg` +ALTER TABLE `mapreg` MODIFY `varname` varchar(32) BINARY NOT NULL, + DROP KEY `varname`, + DROP KEY `index`, + ADD PRIMARY KEY (`varname`,`index`); + + +-- Upgrades for table `sc_data` +ALTER TABLE `sc_data` ADD PRIMARY KEY (`account_id`,`char_id`,`type`); + -- -- Table structure for table `sql_updates` -- + CREATE TABLE IF NOT EXISTS `sql_updates` ( `timestamp` int(11) unsigned NOT NULL, `ignored` enum('Yes','No') NOT NULL DEFAULT 'No', @@ -41,27 +60,35 @@ CREATE TABLE IF NOT EXISTS `sql_updates` ( ) ENGINE=MyISAM; -- Existent updates to enter -INSERT INTO `sql_updates` (`timestamp`) VALUES (1360858500); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1360951560); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1362445531); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1362528000); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1362794218); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1364409316); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1366075474); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1366078541); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1381354728); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1381423003); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1382892428); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1383162785); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1383167577); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1383205740); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1383955424); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1384545461); -INSERT INTO `sql_updates` (`timestamp`) VALUES (1384588175); +INSERT INTO `sql_updates` (`timestamp`) VALUES (1360858500); -- 2013-02-14--16-15.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1360951560); -- 2013-02-15--18-06.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1362445531); -- 2013-03-05--01-05.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1362528000); -- 2013-03-06--00-00.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1362794218); -- 2013-03-09--01-56.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1364409316); -- 2013-03-27--18-35.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1366075474); -- 2013-04-16--01-24.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1366078541); -- 2013-04-16--02-15.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1381354728); -- 2013-10-09--21-38.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1381423003); -- 2013-10-10--16-36.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1382892428); -- 2013-10-27--16-47.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1383162785); -- 2013-10-30--19-53.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1383167577); -- 2013-10-30--21-12.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1383205740); -- 2013-10-31--07-49.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1383955424); -- 2013-11-09--00-03.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1384473995); -- 2013-11-15--00-06.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1384545461); -- 2013-11-15--19-57.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1384588175); -- 2013-11-16--07-49.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1384763034); -- 2013-11-18--08-23.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1387844126); -- 2013-12-24--00-15.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1388854043); -- 2014-01-04--16-47.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1389028967); -- 2014-01-06--17-22.sql +INSERT INTO `sql_updates` (`timestamp`) VALUES (1392832626); -- 2014-02-19--17-57.sql + -- Updates to table `storage` ALTER TABLE `storage` MODIFY `bound` tinyint(1) unsigned NOT NULL default '0'; + -- -- Table structure for table `account_data` -- @@ -72,16 +99,193 @@ CREATE TABLE IF NOT EXISTS `account_data` ( `base_exp` TINYINT( 4 ) UNSIGNED NOT NULL default '100', `base_drop` TINYINT( 4 ) UNSIGNED NOT NULL default '100', `base_death` TINYINT( 4 ) UNSIGNED NOT NULL default '100', - PRIMARY KEY (`account_id`) -) ENGINE=MyISAM; + PRIMARY KEY (`account_id`) +) ENGINE=MyISAM; -- Saving bank_vault data from rAthena's login table -- to our account_data table. There may be some not working cases. - INSERT INTO `account_data` (`account_id`, `bank_vault`) SELECT `account_id`, `bank_vault` FROM `login` WHERE `bank_vault` > 0 ; --- Dropping bank_vault column from login table -ALTER TABLE `login` DROP COLUMN `bank_vault`; + +-- Upgrades for table `login` +ALTER TABLE `login` DROP COLUMN `vip_time`, + DROP COLUMN `old_group`, + DROP COLUMN `bank_vault`; + -- Drop table `bonus_script` since it's not used in Hercules DROP TABLE IF EXISTS `bonus_script`; + + +-- +-- Table structure for table `npc_market_data` +-- + +CREATE TABLE IF NOT EXISTS `npc_market_data` ( + `name` varchar(24) NOT NULL default '', + `itemid` int(11) unsigned NOT NULL default '0', + `amount` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`name`,`itemid`) +) ENGINE=MyISAM; + + +-- Autotrade saving. Very special thanks to Dastgir Pojee! +-- +-- Vending Database Update +-- + +-- Vending_Items Update +ALTER TABLE `vending_items` + ADD `char_id` INT(11) NOT NULL DEFAULT '0' AFTER `index`; + +UPDATE `vending_items` v1, `vendings` v2 + SET v1.char_id = v2.char_id + WHERE v1.vending_id = v2.id; + +ALTER TABLE `vending_items` + DROP `vending_id`, + DROP `index`, + CHANGE `cartinventory_id` `itemkey` INT(11) NOT NULL DEFAULT '0', + MODIFY `amount` INT(11) NOT NULL DEFAULT '0', + MODIFY `price` INT(11) NOT NULL DEFAULT '0'; + +ALTER TABLE `vending_items` + ADD PRIMARY KEY( `char_id`, `itemkey`); + +RENAME TABLE `vending_items` TO `autotrade_data`; + +-- Vending Data Update +ALTER TABLE `vendings` + DROP `id`, + DROP `map`, + DROP `x`, + DROP `y`, + DROP `autotrade`; + +ALTER TABLE `vendings` + CHANGE `sex` `sex_ref` ENUM('F','M') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'M'; + +ALTER TABLE `vendings` + MODIFY `account_id` INT(11) NOT NULL DEFAULT '0', + MODIFY `char_id` INT(11) NOT NULL DEFAULT '0', + ADD `sex` TINYINT(2) NOT NULL DEFAULT '0' AFTER `char_id`, + MODIFY `title` VARCHAR(80) NOT NULL DEFAULT 'Buy From Me!'; + +UPDATE `vendings` + SET `sex` = 0 + WHERE `sex_ref` = 'F'; + +UPDATE `vendings` + SET `sex` = 1 + WHERE `sex_ref` = 'M'; + +ALTER TABLE `vendings` DROP `sex_ref`; + +ALTER TABLE `vendings` ADD PRIMARY KEY( `account_id`, `char_id`); + +RENAME TABLE `vendings` TO `autotrade_merchants`; + +-- Autotrade saving ended + + +-- We don't support saving buyingstores yet... +-- Comment next statement if you want to preserve them anyways +DROP TABLE IF EXISTS `buyingstores`, `buyingstore_items`; + + +-- Saving contents of `global_reg_value` + +-- +-- Table structure for table `acc_reg_num_db` +-- + +CREATE TABLE IF NOT EXISTS `acc_reg_num_db` ( + `account_id` int(11) unsigned NOT NULL default '0', + `key` varchar(32) BINARY NOT NULL default '', + `index` int(11) unsigned NOT NULL default '0', + `value` int(11) NOT NULL default '0', + PRIMARY KEY (`account_id`,`key`,`index`), + KEY `account_id` (`account_id`) +) ENGINE=MyISAM; + + +-- +-- Table structure for table `acc_reg_str_db` +-- + +CREATE TABLE IF NOT EXISTS `acc_reg_str_db` ( + `account_id` int(11) unsigned NOT NULL default '0', + `key` varchar(32) BINARY NOT NULL default '', + `index` int(11) unsigned NOT NULL default '0', + `value` varchar(254) NOT NULL default '0', + PRIMARY KEY (`account_id`,`key`,`index`), + KEY `account_id` (`account_id`) +) ENGINE=MyISAM; + + +-- +-- Table structure for table `char_reg_num_db` +-- + +CREATE TABLE IF NOT EXISTS `char_reg_num_db` ( + `char_id` int(11) unsigned NOT NULL default '0', + `key` varchar(32) BINARY NOT NULL default '', + `index` int(11) unsigned NOT NULL default '0', + `value` int(11) NOT NULL default '0', + PRIMARY KEY (`char_id`,`key`,`index`), + KEY `char_id` (`char_id`) +) ENGINE=MyISAM; + + +-- +-- Table structure for table `char_reg_str_db` +-- + +CREATE TABLE IF NOT EXISTS `char_reg_str_db` ( + `char_id` int(11) unsigned NOT NULL default '0', + `key` varchar(32) BINARY NOT NULL default '', + `index` int(11) unsigned NOT NULL default '0', + `value` varchar(254) NOT NULL default '0', + PRIMARY KEY (`char_id`,`key`,`index`), + KEY `char_id` (`char_id`) +) ENGINE=MyISAM; + + +-- +-- Table structure for table `global_acc_reg_num_db` +-- + +CREATE TABLE IF NOT EXISTS `global_acc_reg_num_db` ( + `account_id` int(11) unsigned NOT NULL default '0', + `key` varchar(32) BINARY NOT NULL default '', + `index` int(11) unsigned NOT NULL default '0', + `value` int(11) NOT NULL default '0', + PRIMARY KEY (`account_id`,`key`,`index`), + KEY `account_id` (`account_id`) +) ENGINE=MyISAM; + + +-- +-- Table structure for table `global_acc_reg_str_db` +-- + +CREATE TABLE IF NOT EXISTS `global_acc_reg_str_db` ( + `account_id` int(11) unsigned NOT NULL default '0', + `key` varchar(32) BINARY NOT NULL default '', + `index` int(11) unsigned NOT NULL default '0', + `value` varchar(254) NOT NULL default '0', + PRIMARY KEY (`account_id`,`key`,`index`), + KEY `account_id` (`account_id`) +) ENGINE=MyISAM; + + +-- Saving the data +INSERT INTO `acc_reg_num_db` (`account_id`, `key`, `index`, `value`) SELECT `account_id`, `str`, 0, `value` FROM `global_reg_value` WHERE `type` = 2 AND `str` NOT LIKE '%$'; +INSERT INTO `acc_reg_str_db` (`account_id`, `key`, `index`, `value`) SELECT `account_id`, `str`, 0, `value` FROM `global_reg_value` WHERE `type` = 2 AND `str` LIKE '%$'; +INSERT INTO `char_reg_num_db` (`char_id`, `key`, `index`, `value`) SELECT `char_id`, `str`, 0, `value` FROM `global_reg_value` WHERE `type` = 3 AND `str` NOT LIKE '%$'; +INSERT INTO `char_reg_str_db` (`char_id`, `key`, `index`, `value`) SELECT `char_id`, `str`, 0, `value` FROM `global_reg_value` WHERE `type` = 3 AND `str` LIKE '%$'; +INSERT INTO `global_acc_reg_num_db` (`account_id`, `key`, `index`, `value`) SELECT `account_id`, `str`, 0, `value` FROM `global_reg_value` WHERE `type` = 1 AND `str` NOT LIKE '%$'; +INSERT INTO `global_acc_reg_str_db` (`account_id`, `key`, `index`, `value`) SELECT `account_id`, `str`, 0, `value` FROM `global_reg_value` WHERE `type` = 1 AND `str` LIKE '%$'; + +-- Dropping now useless table +DROP TABLE `global_reg_value`; -- cgit v1.2.3-70-g09d2 From aa120720cec6ba1ddf6ec8ac6098fef6377dddc0 Mon Sep 17 00:00:00 2001 From: panikon Date: Sat, 22 Mar 2014 00:07:10 -0300 Subject: Fixed issue 7338 (added new char configuration char_aegis_delete) http://hercules.ws/board/tracker/issue-7338-deleting-character/ As @jaBote requested in 26f2ada, renamed "rathena-logs-database-upgrade" to "rAthena-logs-upgrade.sql" and updated 'last revision'. Added a 'FIXME' in db_obj_put --- conf/char-server.conf | 5 +++ sql-files/upgrades/rAthena-logs-upgrade.sql | 13 +++++++ sql-files/upgrades/rAthena-main-upgrade.sql | 2 +- sql-files/upgrades/rathena-logs-database-upgrade | 13 ------- src/char/char.c | 47 ++++++++++++++++-------- src/common/db.c | 2 + 6 files changed, 53 insertions(+), 29 deletions(-) create mode 100644 sql-files/upgrades/rAthena-logs-upgrade.sql delete mode 100644 sql-files/upgrades/rathena-logs-database-upgrade diff --git a/conf/char-server.conf b/conf/char-server.conf index b1172e654..7ebb7ed00 100644 --- a/conf/char-server.conf +++ b/conf/char-server.conf @@ -150,6 +150,11 @@ char_del_level: 0 // NOTE: Requires client 2010-08-03aragexeRE or newer. char_del_delay: 86400 +// Block deletion if character is inside a guild or a party? (BOOL) +// default: 0 official: 1 +// !!This check is imposed by Aegis to avoid dead entries in databases and _is_not_needed_ as we clear data properly!! +char_aegis_delete: 0 + // What folder the DB files are in (item_db.txt, etc.) db_path: db diff --git a/sql-files/upgrades/rAthena-logs-upgrade.sql b/sql-files/upgrades/rAthena-logs-upgrade.sql new file mode 100644 index 000000000..b523f8444 --- /dev/null +++ b/sql-files/upgrades/rAthena-logs-upgrade.sql @@ -0,0 +1,13 @@ +-- rAthena to Hercules log database upgrade query. +-- This upgrades a FULLY UPGRADED rAthena to a FULLY UPGRADED Hercules +-- Please don't use if either rAthena or Hercules launched a SQL update after last revision date of this file. +-- Remember to make a backup before applying. +-- We are not liable for any data loss this may cause. +-- Apply in the same database you applied your logs.sql +-- Last revised: March 21, 2014 20:30 GMT + +-- Upgrades to table `picklog` +ALTER TABLE `picklog` MODIFY `type` enum('M','P','L','T','V','S','N','C','A','R','G','E','B','O','I','X','D','U') NOT NULL default 'P'; + +-- Drop table `cashlog` since it's not used in Hercules +DROP TABLE IF EXISTS `cashlog`; diff --git a/sql-files/upgrades/rAthena-main-upgrade.sql b/sql-files/upgrades/rAthena-main-upgrade.sql index 165584795..9982322e5 100644 --- a/sql-files/upgrades/rAthena-main-upgrade.sql +++ b/sql-files/upgrades/rAthena-main-upgrade.sql @@ -4,7 +4,7 @@ -- Remember to make a backup before applying. -- We are not liable for any data loss this may cause. -- Apply in the same database you applied your main.sql --- Last revised: March 21, 2014 20:30 +-- Last revised: March 21, 2014 20:30 GMT -- Drop table contents from ´sc_data´ since we use a different status order than rAthena -- /!\ WARNING /!\ This will remove _ALL_ of the status effects active on the server diff --git a/sql-files/upgrades/rathena-logs-database-upgrade b/sql-files/upgrades/rathena-logs-database-upgrade deleted file mode 100644 index 7cdf58992..000000000 --- a/sql-files/upgrades/rathena-logs-database-upgrade +++ /dev/null @@ -1,13 +0,0 @@ --- rAthena to Hercules log database upgrade query. --- This upgrades a FULLY UPGRADED rAthena to a FULLY UPGRADED Hercules --- Please don't use if either rAthena or Hercules launched a SQL update after last revision date of this file. --- Remember to make a backup before applying. --- We are not liable for any data loss this may cause. --- Apply in the same database you applied your logs.sql --- Last revision: November 10, 2013, 19:00 - --- Upgrades to table `picklog` -ALTER TABLE `picklog` MODIFY `type` enum('M','P','L','T','V','S','N','C','A','R','G','E','B','O','I','X','D','U') NOT NULL default 'P'; - --- Drop table `cashlog` since it's not used in Hercules -DROP TABLE IF EXISTS `cashlog`; diff --git a/src/char/char.c b/src/char/char.c index bf19a0012..0769067fd 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -125,6 +125,8 @@ int char_del_delay = 86400; int log_char = 1; // loggin char or not [devil] int log_inter = 1; // loggin inter or not [devil] +int char_aegis_delete = 0; // Verify if char is in guild/party or char and reacts as Aegis does (doesn't allow deletion), see char_delete2_req for more information + // Advanced subnet check [LuzZza] struct s_subnet { uint32 mask; @@ -3854,6 +3856,7 @@ int lan_subnetcheck(uint32 ip) } +/// Answers to deletion request (HC_DELETE_CHAR3_RESERVED) /// @param result /// 0 (0x718): An unknown error has occurred. /// 1: none/success @@ -3919,7 +3922,7 @@ void char_delete2_cancel_ack(int fd, int char_id, uint32 result) static void char_delete2_req(int fd, struct char_session_data* sd) {// CH: <0827>.W .L - int char_id, i; + int char_id, party_id, guild_id, i; char* data; time_t delete_date; @@ -3946,22 +3949,34 @@ static void char_delete2_req(int fd, struct char_session_data* sd) return; } -/* - // Aegis imposes these checks probably to avoid dead member - // entries in guilds/parties, otherwise they are not required. - // TODO: Figure out how these are enforced during waiting. - if( guild_id ) - {// character in guild - char_delete2_ack(fd, char_id, 4, 0); - return; - } + // This check is imposed by Aegis to avoid dead entries in databases + // _it is not needed_ as we clear data properly + // see issue: 7338 + if( char_aegis_delete ) + { + if( SQL_SUCCESS != SQL->Query(sql_handle, "SELECT `party_id`, `guild_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id) + || SQL_SUCCESS != SQL->NextRow(sql_handle) + ) + { + Sql_ShowDebug(sql_handle); + char_delete2_ack(fd, char_id, 3, 0); + return; + } + SQL->GetData(sql_handle, 0, &data, NULL); party_id = atoi(data); + SQL->GetData(sql_handle, 1, &data, NULL); guild_id = atoi(data); - if( party_id ) - {// character in party - char_delete2_ack(fd, char_id, 5, 0); - return; + if( guild_id ) + { + char_delete2_ack(fd, char_id, 4, 0); + return; + } + + if( party_id ) + { + char_delete2_ack(fd, char_id, 5, 0); + return; + } } -*/ // success delete_date = time(NULL)+char_del_delay; @@ -5258,6 +5273,8 @@ int char_config_read(const char* cfgName) char_del_level = atoi(w2); } else if (strcmpi(w1, "char_del_delay") == 0) { char_del_delay = atoi(w2); + } else if (strcmpi(w1, "char_aegis_delete") == 0) { + char_aegis_delete = atoi(w2); } else if(strcmpi(w1,"db_path")==0) { safestrncpy(db_path, w2, sizeof(db_path)); } else if (strcmpi(w1, "fame_list_alchemist") == 0) { diff --git a/src/common/db.c b/src/common/db.c index 8c15c0feb..8d6b08815 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -1846,6 +1846,8 @@ static DBData* db_obj_ensure(DBMap* self, DBKey key, DBCreateData create, ...) * @protected * @see #db_malloc_dbn(void) * @see DBMap#put + * FIXME: If this method fails shouldn't it return another value? + * Other functions rely on this to know if they were able to put something [Panikon] */ static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data) { -- cgit v1.2.3-70-g09d2 From d097f2c4b4a31885c6b04f5868563e1f48414192 Mon Sep 17 00:00:00 2001 From: panikon Date: Sat, 22 Mar 2014 15:24:22 -0300 Subject: Fixed exploit in CR_ACIDDEMONSTRATION Fixed issue 8087 http://hercules.ws/board/tracker/issue-8087-excrescent-blank-line-in-pcc/ --- src/map/battle.c | 5 ++++- src/map/pc.c | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/map/battle.c b/src/map/battle.c index 91db3202c..6836aa016 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3750,7 +3750,10 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * md.damage = 0; if (tsd) md.damage>>=1; #endif - if (md.damage < 0 || md.damage > INT_MAX>>1) + // Some monsters have totaldef higher than md.damage in some cases, leading to md.damage < 0 + if( md.damage < 0 ) + md.damage = 0; + if( md.damage > INT_MAX>>1 ) //Overflow prevention, will anyone whine if I cap it to a few billion? //Not capped to INT_MAX to give some room for further damage increase. md.damage = INT_MAX>>1; diff --git a/src/map/pc.c b/src/map/pc.c index a231d7226..d9b7ea7e1 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2705,9 +2705,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) { break; case SP_ADD_VARIABLECAST: if(sd->state.lr_flag != 2) - sd->bonus.add_varcast += val; - break; #endif case SP_ADD_MONSTER_DROP_CHAINITEM: -- cgit v1.2.3-70-g09d2