From 78f36299f3d878c935f8388ec23934239d0cdaa6 Mon Sep 17 00:00:00 2001 From: Fate Date: Sat, 10 Oct 2009 07:02:51 +0000 Subject: Better logging, initial job experience gathering, naming fixes to the skill script commands --- src/char/char.c | 2 +- src/map/clif.c | 3 ++- src/map/mob.c | 18 ++++++++++---- src/map/pc.c | 71 ++++++++++++++++++++++++++++++++++++++------------------ src/map/script.c | 4 ++-- 5 files changed, 67 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/char/char.c b/src/char/char.c index 98321ec..c60305b 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1335,7 +1335,7 @@ int mmo_char_send006b(int fd, struct char_session_data *sd) { WFIFOL(fd,j+4) = p->base_exp; WFIFOL(fd,j+8) = p->zeny; WFIFOL(fd,j+12) = p->job_exp; - WFIFOL(fd,j+16) = p->job_level; + WFIFOL(fd,j+16) = 0; //p->job_level; // [Fate] We no longer reveal this to the player, as its meaning is weird. WFIFOW(fd,j+20) = find_equip_view(p, 0x0040); // 9: shoes WFIFOW(fd,j+22) = find_equip_view(p, 0x0004); // 10: gloves diff --git a/src/map/clif.c b/src/map/clif.c index f168ae5..7f603a9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2120,7 +2120,8 @@ int clif_updatestatus(struct map_session_data *sd,int type) WFIFOL(fd,4)=sd->status.base_level; break; case SP_JOBLEVEL: - WFIFOL(fd,4)=sd->status.job_level; + return 1; // [Fate] Don't report this anymore + //WFIFOL(fd,4)=sd->status.job_level; break; case SP_MANNER: WFIFOL(fd,4)=sd->status.manner; diff --git a/src/map/mob.c b/src/map/mob.c index a5fc159..cec0b92 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2242,11 +2242,11 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if (src && src->id == md->master_id && md->mode & MOB_MODE_TURNS_AGAINST_BAD_MASTER) { - /* If the master hits a monster, have the monster turn against him */ - md->master_id = 0; - md->mode = 0x85; /* Regular war mode */ - md->target_id = src->id; - md->attacked_id = src->id; + /* If the master hits a monster, have the monster turn against him */ + md->master_id = 0; + md->mode = 0x85; /* Regular war mode */ + md->target_id = src->id; + md->attacked_id = src->id; } max_hp = battle_get_max_hp(&md->bl); @@ -2313,6 +2313,14 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) } if(src && src->type == BL_MOB && ((struct mob_data*)src)->state.special_mob_ai){ struct mob_data *md2 = (struct mob_data *)src; + struct block_list *master_bl = map_id2bl(md2->master_id); + if (master_bl->type == BL_PC) { + MAP_LOG_PC(((struct map_session_data *)master_bl), "MOB-TO-MOB-DMG FROM MOB%d %d TO MOB%d %d FOR %d", + md2->bl.id, md2->class, + md->bl.id, md->class, + damage); + } + nullpo_retr(0, md2); for(i=0,minpos=0,mindmg=0x7fffffff;idmglog[i].id==md2->master_id) diff --git a/src/map/pc.c b/src/map/pc.c index d09680f..0b251cc 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -45,8 +45,8 @@ sd->status.str, sd->status.agi, sd->status.vit, sd->status.int_, sd->status.dex, sd->status.luk) #define MAP_LOG_XP(sd, suffix) \ - MAP_LOG_PC(sd, "XP %d %d ZENY %d + %d " suffix, \ - sd->status.base_level, sd->status.base_exp, sd->status.zeny, pc_readaccountreg(sd, "BankAccount")) + MAP_LOG_PC(sd, "XP %d %d JOB %d %d %d ZENY %d + %d " suffix, \ + sd->status.base_level, sd->status.base_exp, sd->status.job_level, sd->status.job_exp, sd->status.skill_point, sd->status.zeny, pc_readaccountreg(sd, "BankAccount")) #define MAP_LOG_MAGIC(sd, suffix) \ MAP_LOG_PC(sd, "MAGIC %d %d %d %d %d %d EXP %d %d " suffix, \ @@ -1427,11 +1427,13 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->atkmods_[1] = atkmods[1][sd->weapontype2]; sd->atkmods_[2] = atkmods[2][sd->weapontype2]; +/* // job�{�[�i�X�� for(i=0;istatus.job_level && iparamb[job_bonus[s_class.upper][s_class.job][i]-1]++; } +*/ if( (skill=pc_checkskill(sd,MC_INCCARRY))>0 ) // skill can be used with an item now, thanks to orn [Valaris] sd->max_weight += skill*1000; @@ -1478,6 +1480,7 @@ int pc_calcstatus(struct map_session_data* sd,int first) if (sd->aspd_rate < 20) sd->aspd_rate = 20; +/* //1�x�����łȂ�Job70�X�p�m�r��+10 if(s_class.job == 23 && sd->die_counter == 0 && sd->status.job_level >= 70){ sd->paramb[0]+= 15; @@ -1487,6 +1490,7 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->paramb[4]+= 15; sd->paramb[5]+= 15; } +*/ sd->paramc[0]=sd->status.str+sd->paramb[0]+sd->parame[0]; sd->paramc[1]=sd->status.agi+sd->paramb[1]+sd->parame[1]; sd->paramc[2]=sd->status.vit+sd->paramb[2]+sd->parame[2]; @@ -4379,22 +4383,55 @@ int pc_checkbaselevelup(struct map_session_data *sd) return 0; } +/*======================================== + * Compute the maximum for sd->skill_point, i.e., the max. number of skill points that can still be filled in + *---------------------------------------- + */ +int pc_skillpt_potential(struct map_session_data *sd) +{ + int skill_id; + int potential = 0; + +#define RAISE_COST(x) (((x)*((x)+1))>>1) + + for (skill_id = 0; skill_id < MAX_SKILL; skill_id++) + if (sd->status.skill[skill_id].id != 0 + && sd->status.skill[skill_id].lv < skill_db[skill_id].max_raise) + potential += RAISE_COST(skill_db[skill_id].max_raise) + - RAISE_COST(sd->status.skill[skill_id].lv); +#undef RAISE_COST + + return potential; +} + int pc_checkjoblevelup(struct map_session_data *sd) { int next = pc_nextjobexp(sd); nullpo_retr(0, sd); - if(sd->status.job_exp >= next && next > 0){ + if (sd->status.job_exp >= next + && next > 0) { + + if (pc_skillpt_potential(sd) < sd->status.skill_point) { // [Fate] Bah, this is is painful. + // But the alternative is quite error-prone, and eAthena has far worse performance issues... + sd->status.job_exp = next - 1; + return 0; + } + // job�����x���A�b�v���� sd->status.job_exp -= next; - sd->status.job_level ++; - clif_updatestatus(sd,SP_JOBLEVEL); clif_updatestatus(sd,SP_NEXTJOBEXP); - sd->status.skill_point ++; + sd->status.skill_point++; clif_updatestatus(sd,SP_SKILLPOINT); pc_calcstatus(sd,0); + MAP_LOG_PC(sd, "SKILLPOINTS-UP %d", sd->status.skill_point); + + if (sd->status.job_level < 250 + && sd->status.job_level < sd->status.base_level * 2) + sd->status.job_level++; // Make levelling up a little harder + clif_misceffect(&sd->bl,1); return 1; } @@ -4422,7 +4459,7 @@ int pc_gainexp_reason(struct map_session_data *sd,int base_exp,int job_exp, int if((battle_config.pvp_exp == 0) && map[sd->bl.m].flag.pvp) // [MouseJstr] return 0; // no exp on pvp maps - MAP_LOG_PC(sd, "GAINXP %d %s", base_exp, ((reason == 2)? "SCRIPTXP" : ((reason == 1) ? "HEALXP" : "KILLXP"))); + MAP_LOG_PC(sd, "GAINXP %d %d %s", base_exp, job_exp, ((reason == 2)? "SCRIPTXP" : ((reason == 1) ? "HEALXP" : "KILLXP"))); if(sd->sc_data[SC_RICHMANKIM].timer != -1) { // added bounds checking [Vaalris] base_exp += base_exp*(25 + sd->sc_data[SC_RICHMANKIM].val1*25)/100; @@ -4525,22 +4562,12 @@ int pc_nextbaseexp(struct map_session_data *sd) */ int pc_nextjobexp(struct map_session_data *sd) { - int i; - - nullpo_retr(0, sd); - - if(sd->status.job_level>=MAX_LEVEL || sd->status.job_level<=0) - return 0; - - if(sd->status.class==0) i=7; - else if(sd->status.class<=6) i=8; - else if(sd->status.class<=22) i=9; - else if(sd->status.class==23) i=10; - else if(sd->status.class==4001) i=11; - else if(sd->status.class<=4007) i=12; - else i=13; + // [fate] For normal levels, this ranges from 20k to 50k, depending on job level. + // Job level is at most twice the player's experience level (base_level). Levelling + // from 2 to 9 is 44 points, i.e., 880k to 2.2M job experience points (this is per + // skill, obviously.) - return exp_table[i][sd->status.job_level-1]; + return 20000 + sd->status.job_level * 150; } /*========================================== diff --git a/src/map/script.c b/src/map/script.c index 60ea879..d01fc99 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -471,8 +471,8 @@ struct { {buildin_getexp,"getexp","ii"}, {buildin_getinventorylist,"getinventorylist",""}, {buildin_getskilllist,"getskilllist",""}, - {buildin_get_activated_pool_skills,"getpoolskilllist",""}, - {buildin_get_pool_skills,"getactivatedpoolskilllist",""}, + {buildin_get_pool_skills,"getpoolskilllist",""}, + {buildin_get_activated_pool_skills,"getactivatedpoolskilllist",""}, {buildin_activate_pool_skill,"poolskill","i"}, {buildin_deactivate_pool_skill,"unpoolskill","i"}, {buildin_check_pool_skill,"checkpoolskill","i"}, -- cgit v1.2.3-60-g2f50