diff options
author | valaris <valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-11-14 16:37:27 +0000 |
---|---|---|
committer | valaris <valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-11-14 16:37:27 +0000 |
commit | 9b255549bb0d8e5c499a88564d1f91ea400a2cde (patch) | |
tree | dabfa6aa2b9e59b9d7bb77967403fbd286147553 /src | |
parent | 91ab1c082b89b1ff8e6bf377c6f96ae5a527262e (diff) | |
download | hercules-9b255549bb0d8e5c499a88564d1f91ea400a2cde.tar.gz hercules-9b255549bb0d8e5c499a88564d1f91ea400a2cde.tar.bz2 hercules-9b255549bb0d8e5c499a88564d1f91ea400a2cde.tar.xz hercules-9b255549bb0d8e5c499a88564d1f91ea400a2cde.zip |
Added zeny from mobs option.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@175 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 2 | ||||
-rw-r--r-- | src/map/battle.h | 2 | ||||
-rw-r--r-- | src/map/map.h | 2 | ||||
-rw-r--r-- | src/map/mob.c | 49 | ||||
-rw-r--r-- | src/map/party.c | 9 | ||||
-rw-r--r-- | src/map/party.h | 2 |
6 files changed, 51 insertions, 15 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 812372c31..6b4f90485 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5084,6 +5084,7 @@ static const struct { { "castrate_dex_scale", &battle_config.castrate_dex_scale }, // added by [MouseJstr] { "area_size", &battle_config.area_size }, // added by [MouseJstr] { "muting_players", &battle_config.muting_players}, // added by [Apple] + { "zeny_from_mobs", &battle_config.zeny_from_mobs}, // [Valaris] //SQL-only options start #ifndef TXT_ONLY { "mail_system", &battle_config.mail_system }, // added by [Valaris] @@ -5303,6 +5304,7 @@ void battle_set_defaults() { battle_config.max_hair_color = 9; battle_config.min_cloth_color = 0; battle_config.max_cloth_color = 4; + battle_config.zeny_from_mobs = 0; battle_config.castrate_dex_scale = 150; diff --git a/src/map/battle.h b/src/map/battle.h index 1ff90bdd7..806d74852 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -331,6 +331,8 @@ extern struct Battle_Config { int castrate_dex_scale; // added by [MouseJstr] int area_size; // added by [MouseJstr] + int zeny_from_mobs; // [Valaris] + #ifndef TXT_ONLY /* SQL-only options */ int mail_system; // [Valaris] #endif diff --git a/src/map/map.h b/src/map/map.h index 8596f781b..0cc161fd8 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -378,7 +378,7 @@ struct npc_data { struct mob_data { struct block_list bl; short n; - short base_class,class,dir,mode; + short base_class,class,dir,mode,level; short m,x0,y0,xs,ys; char name[24]; int spawndelay1,spawndelay2; diff --git a/src/map/mob.c b/src/map/mob.c index f4032662f..57ff28eda 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -124,7 +124,7 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, else m=map_mapname2mapid(mapname); - if(m<0 || amount<=0 || (class>=0 && class<=1000) || class>2000) // 値が異常なら召喚を止める + if(m<0 || amount<=0 || (class>=0 && class<=1000) || class>6000) // 値が異常なら召喚を止める return 0; if(class<0){ // ランダムに召喚 @@ -161,6 +161,15 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, else md->lootitem=NULL; + if(class>4000) { // large/tiny mobs [Valaris] + md->size=2; + class-=4000; + } + else if(class>2000) { + md->size=1; + class-=2000; + } + mob_spawn_dataset(md,mobname,class); md->bl.m=m; md->bl.x=x; @@ -211,7 +220,7 @@ int mob_once_spawn_area(struct map_session_data *sd,char *mapname, max=(y1-y0+1)*(x1-x0+1)*3; if(max>1000)max=1000; - if(m<0 || amount<=0 || (class>=0 && class<=1000) || class>2000) // 値が異常なら召喚を止める + if(m<0 || amount<=0 || (class>=0 && class<=1000) || class>6000) // A summon is stopped if a value is unusual return 0; for(i=0;i<amount;i++){ @@ -726,7 +735,7 @@ static int mob_timer(int tid,unsigned int tick,int id,int data) nullpo_retr(1, md=(struct mob_data*)bl); - if(md->bl.type!=BL_MOB) + if(!md->bl.type || md->bl.type!=BL_MOB) return 1; if(md->timer != tid){ @@ -924,6 +933,10 @@ int mob_spawn(int id) if(!md->speed) md->speed = mob_db[md->class].speed; md->def_ele = mob_db[md->class].element; + + if(!md->level) // [Valaris] + md->level=mob_db[md->class].lv; + md->master_id=0; md->master_dist=0; @@ -2048,7 +2061,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) struct map_session_data *sd = NULL,*tmpsd[DAMAGELOG_SIZE]; struct { struct party *p; - int id,base_exp,job_exp; + int id,base_exp,job_exp,zeny; } pt[DAMAGELOG_SIZE]; int pnum=0; int mvp_damage,max_hp; @@ -2072,7 +2085,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) // if(battle_config.battle_log) // printf("mob_damage %d %d %d\n",md->hp,max_hp,damage); if(md->bl.prev==NULL){ - if(battle_config.error_log) + if(battle_config.error_log==1) printf("mob_damage : BlockError!!\n"); return 0; } @@ -2124,7 +2137,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(md->attacked_id <= 0 && md->state.special_mob_ai==0) md->attacked_id = sd->bl.id; } - if(src && src->type == BL_PET && battle_config.pet_attack_exp_to_master) { + if(src && src->type == BL_PET && battle_config.pet_attack_exp_to_master==1) { struct pet_data *pd = (struct pet_data *)src; nullpo_retr(0, pd); for(i=0,minpos=0,mindmg=0x7fffffff;i<DAMAGELOG_SIZE;i++){ @@ -2316,7 +2329,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) // 経験値の分配 for(i=0;i<DAMAGELOG_SIZE;i++){ - int pid,base_exp,job_exp,flag=1; + int pid,base_exp,job_exp,flag=1,zeny=0; double per; struct party *p; if(tmpsd[i]==NULL || tmpsd[i]->bl.m != md->bl.m) @@ -2348,7 +2361,12 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) job_exp*=1.15; // pk_mode additional exp if monster >20 levels [Valaris] } if(md->state.special_mob_ai >= 1 && battle_config.alchemist_summon_reward != 1) job_exp = 0; // Added [Valaris] - + else if(battle_config.zeny_from_mobs) { + if(md->level > 0) zeny=(md->level+rand()%md->level)*per/256; // zeny calculation moblv + random moblv [Valaris] + if(mob_db[md->class].mexp > 0) + zeny*=rand()%250; + } + if((pid=tmpsd[i]->status.party_id)>0){ // パーティに入っている int j=0; for(j=0;j<pnum;j++) // 公平パーティリストにいるかどうか @@ -2360,21 +2378,31 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) pt[pnum].p=p; pt[pnum].base_exp=base_exp; pt[pnum].job_exp=job_exp; + if(battle_config.zeny_from_mobs) + pt[pnum].zeny=zeny; // zeny share [Valaris] pnum++; flag=0; } }else{ // いるときは公平 pt[j].base_exp+=base_exp; pt[j].job_exp+=job_exp; + if(battle_config.zeny_from_mobs) + pt[j].zeny+=zeny; // zeny share [Valaris] flag=0; } } - if(flag) // 各自所得 + if(flag) { // added zeny from mobs [Valaris] + if(base_exp > 0 || job_exp > 0) pc_gainexp(tmpsd[i],base_exp,job_exp); + if (battle_config.zeny_from_mobs && zeny > 0) { + pc_getzeny(tmpsd[i],zeny); // zeny from mobs [Valaris] + } + } + } // 公平分配 for(i=0;i<pnum;i++) - party_exp_share(pt[i].p,md->bl.m,pt[i].base_exp,pt[i].job_exp); + party_exp_share(pt[i].p,md->bl.m,pt[i].base_exp,pt[i].job_exp,pt[i].zeny); // item drop if(!(type&1)) { @@ -2538,6 +2566,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) } clif_clearchar_area(&md->bl,1); + if(md->level) md->level=0; map_delblock(&md->bl); if(mob_get_viewclass(md->class) <= 1000) clif_clearchar_delay(tick+3000,&md->bl,0); diff --git a/src/map/party.c b/src/map/party.c index 7d8cdafe2..82b77cf6b 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -575,8 +575,8 @@ int party_send_hp_check(struct block_list *bl,va_list ap) return 0; } -// 経験値公平分配 -int party_exp_share(struct party *p,int map,int base_exp,int job_exp) +// exp share and added zeny share [Valaris] +int party_exp_share(struct party *p,int map,int base_exp,int job_exp,int zeny) { struct map_session_data *sd; int i,c; @@ -589,8 +589,11 @@ int party_exp_share(struct party *p,int map,int base_exp,int job_exp) if(c==0) return 0; for(i=0;i<MAX_PARTY;i++) - if((sd=p->member[i].sd)!=NULL && sd->bl.m==map) + if((sd=p->member[i].sd)!=NULL && sd->bl.m==map) { pc_gainexp(sd,base_exp/c+1,job_exp/c+1); + if(battle_config.zeny_from_mobs) // zeny from mobs [Valaris] + pc_getzeny(sd,zeny/c+1); + } return 0; } diff --git a/src/map/party.h b/src/map/party.h index 28d8096f7..5259df7ff 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -40,7 +40,7 @@ int party_check_conflict(struct map_session_data *sd); int party_send_xy_clear(struct party *p); int party_send_hp_check(struct block_list *bl,va_list ap); -int party_exp_share(struct party *p,int map,int base_exp,int job_exp); +int party_exp_share(struct party *p,int map,int base_exp,int job_exp,int zeny); void party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_session_data *sd,int type,...); |