summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-06 18:38:51 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-06 18:38:51 +0000
commite7096ca70629c5fd5f824cec8e2d4307e8578913 (patch)
treeae574e1de73431050206ac7d01f3f04caaec7c41 /src/map/pc.c
parent86914c88410c49b2b84084f2165fc9b581f2986e (diff)
downloadhercules-e7096ca70629c5fd5f824cec8e2d4307e8578913.tar.gz
hercules-e7096ca70629c5fd5f824cec8e2d4307e8578913.tar.bz2
hercules-e7096ca70629c5fd5f824cec8e2d4307e8578913.tar.xz
hercules-e7096ca70629c5fd5f824cec8e2d4307e8578913.zip
- Added define clif_deadsit to send the dead state into player packets if the player is in trick dead state.
- Venom Splasher always hits (but splash damage targets can still avoid it) - Using autoloot with no arguments now toggles it between @autoloot 0 and @autoloot 100% - Falcon Assault now takes Blitz Beat lv5 as base damage. - Fixed pc_makesavestatus not updating status.option correctly. - Corrected Waterball so that higher levels can do insane amount of hits. - Altered slave behaviour. No more random walking, will stay within 2 cells of their master. - Reverted the Summon Slave behaviour to not adjust level based on number of current slaves. - Coma no longer sends SP to 1. - Updated Meteor so that when level 11 or more is casted, the area over which meteors fall is tripled. - Dark elemental characters are now inmune to Curse. - Fixed sc_data saving to sql buffer building method. Thanks to its_sparky. - Changed the map zone reading from using pow to a bit shift. - Experience has now been changed to unsigned int, and is read as such from the dbs. - Increased HT_DETECTING seek range to 7x7 - Added function map_foreachinrange which actually checks distance of nearing objects (unlike for each in area which uses a square area), may come handy for future code. - Corrected Venom Splasher: Being hit does not cancels it, works at 75% or less of target's HP, being hit normally while under the count has a chance of causing poison. Damage is +400% + 50*lv% git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5204 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c55
1 files changed, 31 insertions, 24 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 59843f095..a982bab13 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -41,8 +41,8 @@
#endif
#define PVP_CALCRANK_INTERVAL 1000 // PVP順位計算の間隔
-static int exp_table[MAX_PC_CLASS][2][MAX_LEVEL];
-static int max_level[MAX_PC_CLASS][2];
+static unsigned int exp_table[MAX_PC_CLASS][2][MAX_LEVEL];
+static unsigned int max_level[MAX_PC_CLASS][2];
static short statp[MAX_LEVEL];
// h-files are for declarations, not for implementations... [Shinomori]
@@ -416,7 +416,7 @@ int pc_makesavestatus(struct map_session_data *sd)
// 死亡?態だったのでhpを1、位置をセ?ブ場所に?更
if(!sd->state.waitingdisconnect) {
- sd->sc.option = sd->sc.option;
+ sd->status.option = sd->sc.option; //Since the option saved is in
if(pc_isdead(sd)){
pc_setrestartvalue(sd,0);
memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point));
@@ -4687,11 +4687,11 @@ int pc_checkjoblevelup(struct map_session_data *sd)
* ??値取得
*------------------------------------------
*/
-int pc_gainexp(struct map_session_data *sd,int base_exp,int job_exp)
+int pc_gainexp(struct map_session_data *sd,unsigned int base_exp,unsigned int job_exp)
{
char output[256];
float nextbp=0, nextjp=0;
- int nextb=0, nextj=0;
+ unsigned int nextb=0, nextj=0;
nullpo_retr(0, sd);
if(sd->bl.prev == NULL || pc_isdead(sd))
@@ -4702,14 +4702,10 @@ int pc_gainexp(struct map_session_data *sd,int base_exp,int job_exp)
if(sd->status.guild_id>0){ // ギルドに上納
base_exp-=guild_payexp(sd,base_exp);
- if(base_exp < 0)
- base_exp = 0;
}
if(!battle_config.multi_level_up && pc_nextbaseafter(sd) && sd->status.base_exp+base_exp >= pc_nextbaseafter(sd)) {
base_exp = pc_nextbaseafter(sd) - sd->status.base_exp;
- if (base_exp < 0)
- base_exp = 0;
}
nextb = pc_nextbaseexp(sd);
nextj = pc_nextjobexp(sd);
@@ -4719,21 +4715,16 @@ int pc_gainexp(struct map_session_data *sd,int base_exp,int job_exp)
nextjp = (float) job_exp / (float) nextj;
sd->status.base_exp += base_exp;
- if(sd->status.base_exp < 0)
- sd->status.base_exp = 0;
while(pc_checkbaselevelup(sd)) ;
clif_updatestatus(sd,SP_BASEEXP);
+
if(!battle_config.multi_level_up && pc_nextjobafter(sd) && sd->status.job_exp+job_exp >= pc_nextjobafter(sd)) {
job_exp = pc_nextjobafter(sd) - sd->status.job_exp;
- if (job_exp < 0)
- job_exp = 0;
}
sd->status.job_exp += job_exp;
- if(sd->status.job_exp < 0)
- sd->status.job_exp = 0;
while(pc_checkjoblevelup(sd)) ;
@@ -4741,11 +4732,11 @@ int pc_gainexp(struct map_session_data *sd,int base_exp,int job_exp)
if(sd->state.showexp){
sprintf(output,
- "Experienced Gained Base:%d (%.2f%%) Job:%d (%.2f%%)",base_exp,nextbp*(float)100,job_exp,nextjp*(float)100);
+ "Experience Gained Base:%d (%.2f%%) Job:%d (%.2f%%)",base_exp,nextbp*(float)100,job_exp,nextjp*(float)100);
clif_disp_onlyself(sd,output,strlen(output));
}
- return 0;
+ return 1;
}
/*==========================================
@@ -4753,11 +4744,11 @@ int pc_gainexp(struct map_session_data *sd,int base_exp,int job_exp)
*------------------------------------------
*/
-int pc_maxbaselv(struct map_session_data *sd) {
+unsigned int pc_maxbaselv(struct map_session_data *sd) {
return max_level[sd->status.class_][0];
};
-int pc_maxjoblv(struct map_session_data *sd) {
+unsigned int pc_maxjoblv(struct map_session_data *sd) {
return max_level[sd->status.class_][1];
};
@@ -4765,7 +4756,7 @@ int pc_maxjoblv(struct map_session_data *sd) {
* base level側必要??値計算
*------------------------------------------
*/
-int pc_nextbaseexp(struct map_session_data *sd)
+unsigned int pc_nextbaseexp(struct map_session_data *sd)
{
nullpo_retr(0, sd);
@@ -4779,7 +4770,7 @@ int pc_nextbaseexp(struct map_session_data *sd)
* job level側必要??値計算
*------------------------------------------
*/
-int pc_nextjobexp(struct map_session_data *sd)
+unsigned int pc_nextjobexp(struct map_session_data *sd)
{
nullpo_retr(0, sd);
@@ -4792,7 +4783,7 @@ int pc_nextjobexp(struct map_session_data *sd)
* base level after next [Valaris]
*------------------------------------------
*/
-int pc_nextbaseafter(struct map_session_data *sd)
+unsigned int pc_nextbaseafter(struct map_session_data *sd)
{
nullpo_retr(0, sd);
@@ -4806,7 +4797,7 @@ int pc_nextbaseafter(struct map_session_data *sd)
* job level after next [Valaris]
*------------------------------------------
*/
-int pc_nextjobafter(struct map_session_data *sd)
+unsigned int pc_nextjobafter(struct map_session_data *sd)
{
nullpo_retr(0, sd);
@@ -8053,6 +8044,22 @@ int pc_split_atoi(char *str,int *val, char sep, int max)
return i;
}
+int pc_split_atoui(char *str,unsigned int *val, char sep, int max)
+{
+ int i,j;
+ for (i=0; i<max; i++) {
+ if (!str) break;
+ val[i] = (unsigned int)atof(str);
+ str = strchr(str,sep);
+ if (str)
+ *str++=0;
+ }
+ //Zero up the remaining.
+ for(j=i; j < max; j++)
+ val[j] = 0;
+ return i;
+}
+
//
// 初期化物
//
@@ -8110,7 +8117,7 @@ int pc_readdb(void)
max = MAX_LEVEL;
}
//We send one less and then one more because the last entry in the exp array should hold 0.
- max_level[job][type] = pc_split_atoi(split[3], exp_table[job][type],',',max-1)+1;
+ max_level[job][type] = pc_split_atoui(split[3], exp_table[job][type],',',max-1)+1;
//Reverse check in case the array has a bunch of trailing zeros... [Skotlex]
//The reasoning behind the -2 is this... if the max level is 5, then the array
//should look like this: