diff options
author | Mysterious <mysteriousragnarok@hotmail.com> | 2013-02-05 17:08:29 -0800 |
---|---|---|
committer | Mysterious <mysteriousragnarok@hotmail.com> | 2013-02-05 17:08:29 -0800 |
commit | 5e76d9a1a0ab36af5d8ad072ea4dcbf6122b0ae9 (patch) | |
tree | a938a98c1d3b856dd37cc989ac0d39d2de58abe1 /src | |
parent | 9909d3bf4f4ad0acad48fbe5f1cfe69e44109da9 (diff) | |
parent | 2eb3e450d53a450d2493fae0ede3632802de6dd6 (diff) | |
download | hercules-5e76d9a1a0ab36af5d8ad072ea4dcbf6122b0ae9.tar.gz hercules-5e76d9a1a0ab36af5d8ad072ea4dcbf6122b0ae9.tar.bz2 hercules-5e76d9a1a0ab36af5d8ad072ea4dcbf6122b0ae9.tar.xz hercules-5e76d9a1a0ab36af5d8ad072ea4dcbf6122b0ae9.zip |
Merge pull request #2 from HerculesWS/master
Merging Hercules Commits from Feb 3 - 5 2013.
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 9 | ||||
-rw-r--r-- | src/char/int_guild.c | 4 | ||||
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 9 | ||||
-rw-r--r-- | src/map/clif.c | 4 | ||||
-rw-r--r-- | src/map/clif.h | 4 | ||||
-rw-r--r-- | src/map/map.h | 7 | ||||
-rw-r--r-- | src/map/mob.c | 2 | ||||
-rw-r--r-- | src/map/npc.c | 27 | ||||
-rw-r--r-- | src/map/pc.c | 49 | ||||
-rw-r--r-- | src/map/pc.h | 3 | ||||
-rw-r--r-- | src/map/script.c | 6 | ||||
-rw-r--r-- | src/map/skill.c | 10 | ||||
-rw-r--r-- | src/map/status.c | 3 | ||||
-rw-r--r-- | src/map/unit.c | 12 |
15 files changed, 111 insertions, 39 deletions
diff --git a/src/char/char.c b/src/char/char.c index d454e8bd0..1b5c7898d 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -133,7 +133,7 @@ struct char_session_data { char birthdate[10+1]; // YYYY-MM-DD }; -int max_connect_user = 0; +int max_connect_user = -1; int gm_allow_group = -1; int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL; int start_zeny = 0; @@ -2154,7 +2154,8 @@ int parse_fromlogin(int fd) { ARR_FIND( 0, ARRAYLENGTH(server), server_id, server[server_id].fd > 0 && server[server_id].map[0] ); // continued from char_auth_ok... if( server_id == ARRAYLENGTH(server) || //server not online, bugreport:2359 - ( max_connect_user && count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { + (max_connect_user == 0 && sd->group_id != gm_allow_group) || + ( max_connect_user > 0 && count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) { // refuse connection (over populated) WFIFOHEAD(i,3); WFIFOW(i,0) = 0x6c; @@ -4588,8 +4589,8 @@ int char_config_read(const char* cfgName) char_new_display = atoi(w2); } else if (strcmpi(w1, "max_connect_user") == 0) { max_connect_user = atoi(w2); - if (max_connect_user < 0) - max_connect_user = 0; // unlimited online players + if (max_connect_user < -1) + max_connect_user = -1; // unlimited online players } else if(strcmpi(w1, "gm_allow_group") == 0) { gm_allow_group = atoi(w2); } else if (strcmpi(w1, "autosave_time") == 0) { diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 9cb17dca8..b3a907b1a 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -602,9 +602,9 @@ static struct guild_castle* inter_guildcastle_fromsql(int castle_id) // Read exp_guild.txt static bool exp_guild_parse_row(char* split[], int column, int current) { - int exp = atoi(split[0]); + unsigned int exp = atoll(split[0]); - if (exp < 0 || exp >= INT_MAX) { + if (exp < 0 || exp >= UINT_MAX) { ShowError("exp_guild: Invalid exp %d at line %d\n", exp, current); return false; } diff --git a/src/map/battle.c b/src/map/battle.c index 0506f2fe9..f9748833f 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5868,6 +5868,7 @@ static const struct _battle_data { **/ { "skill_trap_type", &battle_config.skill_trap_type, 0, 0, 1, }, { "item_restricted_consumption_type", &battle_config.item_restricted_consumption_type,1, 0, 1, }, + { "max_walk_path", &battle_config.max_walk_path, 17, 1, MAX_WALKPATH, }, }; #ifndef STATS_OPT_OUT /** diff --git a/src/map/battle.h b/src/map/battle.h index c5ca19b90..1354da78a 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -1,5 +1,6 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules dev team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena dev team #ifndef _BATTLE_H_ #define _BATTLE_H_ @@ -483,8 +484,12 @@ extern struct Battle_Config int atcommand_mobinfo_type; int mob_size_influence; // Enable modifications on earned experience, drop rates and monster status depending on monster size. [mkbu95] + + /** Hercules **/ int skill_trap_type; int item_restricted_consumption_type; + int max_walk_path; + } battle_config; void do_init_battle(void); diff --git a/src/map/clif.c b/src/map/clif.c index e04941336..8d5090c2c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5344,6 +5344,9 @@ void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id /// Notifies clients of a status change. /// 0196 <index>.W <id>.L <state>.B (ZC_MSG_STATE_CHANGE) [used for ending status changes and starting them on non-pc units (when needed)] /// 043f <index>.W <id>.L <state>.B <remain msec>.L { <val>.L }*3 (ZC_MSG_STATE_CHANGE2) [used exclusively for starting statuses on pcs] +/// 08ff <id>.L <index>.W <remain msec>.L { <val>.L }*3 (PACKETVER >= 20111108) +/// 0983 <index>.W <id>.L <state>.B <total msec>.L <remain msec>.L { <val>.L }*3 (PACKETVER >= 20120618) +/// 0984 <id>.L <index>.W <total msec>.L <remain msec>.L { <val>.L }*3 (PACKETVER >= 20120618) void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { unsigned char buf[32]; @@ -17111,7 +17114,6 @@ int do_init_clif(void) { clif_config.packet_db_ver = -1; // the main packet version of the DB memset(clif_config.connect_cmd, 0, sizeof(clif_config.connect_cmd)); //The default connect command will be determined after reading the packet_db [Skotlex] - memset(packet_db,0,sizeof(packet_db)); //Using the packet_db file is the only way to set up packets now [Skotlex] packetdb_readdb(); diff --git a/src/map/clif.h b/src/map/clif.h index 45e2fd4f0..8e0fc6629 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -31,8 +31,8 @@ struct party_booking_ad_info; enum {// packet DB - MAX_PACKET_DB = 0xA00, - MAX_PACKET_VER = 31, + MAX_PACKET_DB = 0xF00, + MAX_PACKET_VER = 32, MAX_PACKET_POS = 20, }; diff --git a/src/map/map.h b/src/map/map.h index 86d936972..06995024f 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1,5 +1,6 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules dev team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena dev team #ifndef _MAP_H_ #define _MAP_H_ @@ -406,7 +407,7 @@ enum _sp { SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, SP_MAGIC_HP_GAIN_VALUE, SP_ADD_CLASS_DROP_ITEM, //2041-2045 SP_EMATK, SP_SP_GAIN_RACE_ATTACK, SP_HP_GAIN_RACE_ATTACK, SP_SKILL_USE_SP_RATE, //2046-2049 SP_SKILL_COOLDOWN,SP_SKILL_FIXEDCAST, SP_SKILL_VARIABLECAST, SP_FIXCASTRATE, SP_VARCASTRATE, //2050-2054 - SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE //2055-2056 + SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE, SP_ADD_FIXEDCAST, SP_ADD_VARIABLECAST //2055-2058 }; enum _look { diff --git a/src/map/mob.c b/src/map/mob.c index 6550d9b0e..aceebc506 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1537,7 +1537,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) // Scan area for targets if (!tbl && mode&MD_LOOTER && md->lootitem && DIFF_TICK(tick, md->ud.canact_tick) > 0 && (md->lootitem_count < LOOTITEM_SIZE || battle_config.monster_loot_type != 1)) - { // Scan area for items to loot, avoid trying to loot of the mob is full and can't consume the items. + { // Scan area for items to loot, avoid trying to loot if the mob is full and can't consume the items. map_foreachinrange (mob_ai_sub_hard_lootsearch, &md->bl, view_range, BL_ITEM, md, &tbl); } diff --git a/src/map/npc.c b/src/map/npc.c index 3aabeaf98..383cd031a 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2884,24 +2884,23 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c setd_sub(st, NULL, ".@atcmd_command$", 0, (void *)command, NULL); // split atcmd parameters based on spaces - i = 0; - j = 0; - temp = (char*)aMalloc(strlen(message) + 1); - while( message[i] != '\0' ) { - if( message[i] == ' ' && k < 127 ) { - temp[j] = '\0'; - setd_sub(st, NULL, ".@atcmd_parameters$", k++, (void *)temp, NULL); - j = 0; - ++i; - } else - temp[j++] = message[i++]; + for( i = 0; i < ( strlen( message ) + 1 ) && k < 127; i ++ ) { + if( message[i] == ' ' || message[i] == '\0' ) { + if( message[ ( i - 1 ) ] == ' ' ) { + continue; // To prevent "@atcmd [space][space][space]..." + } + temp[k] = '\0'; + k = 0; + setd_sub( st, NULL, ".@atcmd_parameters$", j++, (void *)temp, NULL ); + } else { + temp[k] = message[i]; + k++; + } } - temp[j] = '\0'; - setd_sub(st, NULL, ".@atcmd_parameters$", k++, (void *)temp, NULL); - setd_sub(st, NULL, ".@atcmd_numparameters", 0, (void *)&k, NULL); + setd_sub(st, NULL, ".@atcmd_numparameters", 0, (void *)__64BPRTSIZE(j), NULL); aFree(temp); run_script_main(st); diff --git a/src/map/pc.c b/src/map/pc.c index 6f608cd49..6e24d7d49 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2591,11 +2591,22 @@ int pc_bonus(struct map_session_data *sd,int type,int val) if(sd->state.lr_flag != 2) sd->bonus.fixcastrate -= val; break; + case SP_ADD_FIXEDCAST: + if(sd->state.lr_flag != 2) + sd->bonus.add_fixcast += val; + + break; #ifdef RENEWAL_CAST case SP_VARCASTRATE: if(sd->state.lr_flag != 2) sd->bonus.varcastrate -= val; break; + case SP_ADD_VARIABLECAST: + if(sd->state.lr_flag != 2) + + sd->bonus.add_varcast += val; + + break; #endif default: ShowWarning("pc_bonus: unknown type %d %d !\n",type,val); @@ -2953,7 +2964,15 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast[i].id == 0 || sd->skillcast[i].id == type2); if (i == ARRAYLENGTH(sd->skillcast)) { //Better mention this so the array length can be updated. [Skotlex] - ShowDebug("run_script: bonus2 bCastRate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillcast), type2, val); + ShowDebug("run_script: bonus2 %s reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", + +#ifndef RENEWAL_CAST + "bCastRate", +#else + "bVariableCastrate", +#endif + + ARRAYLENGTH(sd->skillcast), type2, val); break; } if(sd->skillcast[i].id == type2) @@ -2964,6 +2983,30 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) } break; + case SP_FIXCASTRATE: + if(sd->state.lr_flag == 2) + break; + + ARR_FIND(0, ARRAYLENGTH(sd->skillfixcastrate), i, sd->skillfixcastrate[i].id == 0 || sd->skillfixcastrate[i].id == type2); + + if (i == ARRAYLENGTH(sd->skillfixcastrate)) + + { + + ShowDebug("run_script: bonus2 bFixedCastrate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillfixcastrate), type2, val); + break; + } + + if(sd->skillfixcastrate[i].id == type2) + sd->skillfixcastrate[i].val += val; + + else { + sd->skillfixcastrate[i].id = type2; + sd->skillfixcastrate[i].val = val; + } + + break; + case SP_HP_LOSS_RATE: if(sd->state.lr_flag != 2) { sd->hp_loss.value = type2; @@ -8194,6 +8237,10 @@ int pc_removecombo(struct map_session_data *sd, struct item_data *data ) { cursor++; } + + /* check if combo requirements still fit */ + if( pc_checkcombo( sd, data ) ) + continue; /* it's empty, we can clear all the memory */ if( (sd->combos.count = cursor) == 0 ) { diff --git a/src/map/pc.h b/src/map/pc.h index 870945d73..ac1950a69 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -263,7 +263,7 @@ struct map_session_data { struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills. unsigned short id; short val; - } skillatk[MAX_PC_BONUS], skillusesprate[MAX_PC_BONUS], skillusesp[MAX_PC_BONUS], skillheal[5], skillheal2[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS], skillcooldown[MAX_PC_BONUS], skillfixcast[MAX_PC_BONUS], skillvarcast[MAX_PC_BONUS]; + } skillatk[MAX_PC_BONUS], skillusesprate[MAX_PC_BONUS], skillusesp[MAX_PC_BONUS], skillheal[5], skillheal2[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS], skillcooldown[MAX_PC_BONUS], skillfixcast[MAX_PC_BONUS], skillvarcast[MAX_PC_BONUS], skillfixcastrate[MAX_PC_BONUS]; struct { short value; int rate; @@ -320,6 +320,7 @@ struct map_session_data { unsigned short unbreakable_equip; //100% break resistance on certain equipment unsigned short unstripable_equip; int fixcastrate,varcastrate; + int add_fixcast,add_varcast; int ematk; // matk bonus from equipment // int eatk; // atk bonus from equipment } bonus; diff --git a/src/map/script.c b/src/map/script.c index 60a61654a..b4f0a5d9b 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1,5 +1,6 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules dev team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena dev team //#define DEBUG_DISP //#define DEBUG_DISASM @@ -7860,6 +7861,7 @@ BUILDIN_FUNC(bonus) case SP_SKILL_FIXEDCAST: case SP_SKILL_VARIABLECAST: case SP_VARCASTRATE: + case SP_FIXCASTRATE: case SP_SKILL_USE_SP: // these bonuses support skill names val1 = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) ); diff --git a/src/map/skill.c b/src/map/skill.c index 9c07390f3..2cc3ed1ab 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -13819,6 +13819,10 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 if(sd && !(skill_get_castnodex(skill_id, skill_lv)&4) ){ // Increases/Decreases fixed/variable cast time of a skill by item/card bonuses. if( sd->bonus.varcastrate < 0 ) VARCAST_REDUCTION(sd->bonus.varcastrate); + if( sd->bonus.add_varcast != 0 ) // bonus bVariableCast + time += sd->bonus.add_varcast; + if( sd->bonus.add_fixcast != 0 ) // bonus bFixedCast + fixed += sd->bonus.add_fixcast; for (i = 0; i < ARRAYLENGTH(sd->skillfixcast) && sd->skillfixcast[i].id; i++) if (sd->skillfixcast[i].id == skill_id){ // bonus2 bSkillFixedCast fixed += sd->skillfixcast[i].val; @@ -13835,6 +13839,12 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 VARCAST_REDUCTION(i); break; } + for( i = 0; i < ARRAYLENGTH(sd->skillfixcastrate) && sd->skillfixcastrate[i].id; i++ ) + + if( sd->skillfixcastrate[i].id == skill_id ){ // bonus2 bFixedCastrate + fixcast_r = sd->skillfixcastrate[i].val; // just speculation + break; + } } if (sc && sc->count && !(skill_get_castnodex(skill_id, skill_lv)&2) ) { diff --git a/src/map/status.c b/src/map/status.c index 7840a7a7f..8fd48aefc 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1,4 +1,4 @@ -// Copyright (c) Hercules dev team, licensed under GNU GPL. +// Copyright (c) Hercules dev team, licensed under GNU GPL. // See the LICENSE file // Portions Copyright (c) Athena dev team @@ -2416,6 +2416,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) + sizeof(sd->skillcooldown) + sizeof(sd->skillfixcast) + sizeof(sd->skillvarcast) + + sizeof(sd->skillfixcastrate) ); memset (&sd->bonus, 0,sizeof(sd->bonus)); diff --git a/src/map/unit.c b/src/map/unit.c index e901d3138..45aca7d41 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1,5 +1,6 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules dev team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena dev team #include "../common/showmsg.h" #include "../common/timer.h" @@ -315,21 +316,22 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag) { struct unit_data* ud = NULL; struct status_change* sc = NULL; -#ifdef OFFICIAL_WALKPATH struct walkpath_data wpd; -#endif + nullpo_ret(bl); ud = unit_bl2ud(bl); if( ud == NULL) return 0; -#ifdef OFFICIAL_WALKPATH path_search(&wpd, bl->m, bl->x, bl->y, x, y, flag&1, CELL_CHKNOPASS); // Count walk path cells +#ifdef OFFICIAL_WALKPATH if( !path_search_long(NULL, bl->m, bl->x, bl->y, x, y, CELL_CHKNOPASS) // Check if there is an obstacle between && wpd.path_len > 14 ) // Official number of walkable cells is 14 if and only if there is an obstacle between. [malufett] return 0; #endif + if( battle_config.max_walk_path < wpd.path_len ) + return 0; if (flag&4 && DIFF_TICK(ud->canmove_tick, gettick()) > 0 && DIFF_TICK(ud->canmove_tick, gettick()) < 2000) |