From 8066c5c7908f5c0a2393b88d4eee7d141a6ff9ee Mon Sep 17 00:00:00 2001 From: lemongrass3110 Date: Tue, 16 Apr 2013 23:11:51 +0000 Subject: [PATCH] Hercules merges: -- 8ec2353: Fix bad login values. bugreport:86 -- c653a70: Added a warning for out of bounds coordinates. bugreport:419 -- 08ad9b1: Fixed bleeding not giving exp. bugreport:5811 -- 370bfb7: Updated renewal critical damage. bugreport:4464 -- 1e21ff7: Fixed @hide not getting saved on relog. bugreport:7102 git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17266 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/login/login.c | 4 ++-- src/map/battle.c | 10 ++++++++++ src/map/npc.c | 12 ++++++++++++ src/map/pc.c | 28 +++++++++++++++++++++------- src/map/status.c | 4 +++- src/map/status.h | 1 - 6 files changed, 48 insertions(+), 11 deletions(-) diff --git a/src/login/login.c b/src/login/login.c index 6d843ee423..d3675fe749 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1125,8 +1125,8 @@ int mmo_auth(struct login_session_data* sd, bool isServer) { // update session data sd->account_id = acc.account_id; - sd->login_id1 = rnd(); - sd->login_id2 = rnd(); + sd->login_id1 = rnd() + 1; + sd->login_id2 = rnd() + 1; safestrncpy(sd->lastlogin, acc.lastlogin, sizeof(sd->lastlogin)); sd->sex = acc.sex; sd->group_id = acc.group_id; diff --git a/src/map/battle.c b/src/map/battle.c index b3cbc24069..228c4bae48 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1954,7 +1954,11 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if (flag.cri) { wd.type = 0x0a; +#ifdef RENEWAL + flag.hit = 1; +#else flag.idef = flag.idef2 = flag.hit = 1; +#endif } else { //Check for Perfect Hit if(sd && sd->bonus.perfect_hit > 0 && rnd()%100 < sd->bonus.perfect_hit) flag.hit = 1; @@ -3454,6 +3458,12 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( flag.lh ) wd.damage2 = battle_calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 3, wd.flag); +#ifdef RENEWAL + if( flag.cri ){ + ATK_ADDRATE( sd->bonus.crit_atk_rate >= 100 ? sd->bonus.crit_atk_rate - 60 : 40 ); + } +#endif + if( skill_id == CR_SHIELDBOOMERANG || skill_id == PA_SHIELDCHAIN ) { //Refine bonus applies after cards and elements. short index= sd->equip_index[EQI_HAND_L]; diff --git a/src/map/npc.c b/src/map/npc.c index 3fbd7e7a80..e39f359388 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2138,6 +2138,10 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const return strchr(start,'\n');// skip and continue } + if( m != -1 && ( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys ) ) { + ShowWarning("npc_parse_warp: coordinates %d/%d are out of bounds in map %s(%dx%d), in file '%s', line '%d'\n", x, y, map[m].name, map[m].xs, map[m].ys,filepath,strline(buffer,start-buffer)); + } + CREATE(nd, struct npc_data, 1); nd->bl.id = npc_get_new_npc_id(); @@ -2203,6 +2207,10 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const m = map_mapname2mapid(mapname); } + if( m != -1 && ( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys ) ) { + ShowWarning("npc_parse_shop: coordinates %d/%d are out of bounds in map %s(%dx%d), in file '%s', line '%d'\n", x, y, map[m].name, map[m].xs, map[m].ys,filepath,strline(buffer,start-buffer)); + } + if( !strcasecmp(w2,"cashshop") ) type = CASHSHOP; else @@ -2588,6 +2596,10 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch m = map_mapname2mapid(mapname); } + if( m != -1 && ( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys ) ) { + ShowError("npc_parse_duplicate: coordinates %d/%d are out of bounds in map %s(%dx%d), in file '%s', line '%d'\n", x, y, map[m].name, map[m].xs, map[m].ys,filepath,strline(buffer,start-buffer)); + } + if( type == WARP && sscanf(w4, "%d,%d", &xs, &ys) == 2 );// , else if( type == SCRIPT && sscanf(w4, "%d,%d,%d", &class_, &xs, &ys) == 3);// ,, else if( type != WARP ) class_ = atoi(w4);// diff --git a/src/map/pc.c b/src/map/pc.c index 27dac2b58b..f21be0dbba 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -521,9 +521,9 @@ int pc_makesavestatus(struct map_session_data *sd) //Only copy the Cart/Peco/Falcon options, the rest are handled via //status change load/saving. [Skotlex] #ifdef NEW_CARTS - sd->status.option = sd->sc.option&(OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_MOUNTING); + sd->status.option = sd->sc.option&(OPTION_INVISIBLE|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_MOUNTING); #else - sd->status.option = sd->sc.option&(OPTION_CART|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_MOUNTING); + sd->status.option = sd->sc.option&(OPTION_INVISIBLE|OPTION_CART|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_MOUNTING); #endif if (sd->sc.data[SC_JAILED]) { //When Jailed, do not move last point. @@ -1005,12 +1005,11 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim pc_setinventorydata(sd); pc_setequipindex(sd); - status_change_init(&sd->bl); + if( sd->status.option&OPTION_INVISIBLE && !pc_can_use_command( sd, "hide", COMMAND_ATCOMMAND ) ){ + sd->status.option &= ~OPTION_INVISIBLE; + } - if (pc_can_use_command(sd, "hide", COMMAND_ATCOMMAND)) - sd->status.option &= (OPTION_MASK | OPTION_INVISIBLE); - else - sd->status.option &= OPTION_MASK; + status_change_init(&sd->bl); sd->sc.option = sd->status.option; //This is the actual option used in battle. //Set here because we need the inventory data for weapon sprite parsing. @@ -1237,6 +1236,21 @@ int pc_reg_received(struct map_session_data *sd) pc_inventory_rentals(sd); + if( sd->sc.option&OPTION_INVISIBLE ) { + sd->vd.class_ = INVISIBLE_CLASS; + clif_displaymessage( sd->fd, msg_txt( sd, 11 ) ); // Invisible: On + // decrement the number of pvp players on the map + map[sd->bl.m].users_pvp--; + + if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER ){ + // unregister the player for ranking + delete_timer( sd->pvp_timer, pc_calc_pvprank_timer ); + sd->pvp_timer = INVALID_TIMER; + } + + clif_changeoption( &sd->bl ); + } + return 1; } diff --git a/src/map/status.c b/src/map/status.c index 404682c09f..dbcc457ee3 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -9215,7 +9215,6 @@ int status_change_clear(struct block_list* bl, int type) { sc->opt1 = 0; sc->opt2 = 0; sc->opt3 = 0; - sc->option &= OPTION_MASK; if( type == 0 || type == 2 ) clif_changeoption(bl); @@ -10091,6 +10090,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) if (--(sce->val4) >= 0) { int hp = rnd()%600 + 200; struct block_list* src = map_id2bl(sce->val2); + if( src && bl && bl->type == BL_MOB ){ + mob_log_damage( (TBL_MOB*)bl, src, sd || hp < status->hp ? hp : status->hp - 1 ); + } map_freeblock_lock(); status_fix_damage(src, bl, sd||hphp?hp:status->hp-1, 1); if( sc->data[type] ) { diff --git a/src/map/status.h b/src/map/status.h index d3a9dac6c9..9d092caf34 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1519,7 +1519,6 @@ enum { // compound constants OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, - OPTION_MASK = ~OPTION_INVISIBLE, }; //Defines for the manner system [Skotlex]