diff options
-rw-r--r-- | Changelog-SVN.txt | 6 | ||||
-rw-r--r-- | src/map/atcommand.c | 9 | ||||
-rw-r--r-- | src/map/mob.c | 120 | ||||
-rw-r--r-- | src/map/npc.c | 3 |
4 files changed, 73 insertions, 65 deletions
diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index 0f2ba3ca5..9c324e69d 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -1,5 +1,11 @@ Date Added +03/25 + * Fixed indoorsrwstable.txt reading even when 'indoors_override_grffile' is + set to 'no' [celest] + * Fixed @monsterbig/@monstersmall not working [celest] + * Fixed @killmonster2 not working [celest] + 03/24 * Added some mapflags for new towns [Lupus] * Added timer.c optimization / timers sort fix. 'no freezing mobs anymore' Thanx 2 Yor/Freya [Lupus] diff --git a/src/map/atcommand.c b/src/map/atcommand.c index e49bb178c..0dac4f09c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -830,9 +830,16 @@ AtCommandType atcommand(struct map_session_data* sd, const int level, const char */ static int atkillmonster_sub(struct block_list *bl, va_list ap) { struct mob_data *md; + int flag; + + nullpo_retr(0, ap); nullpo_retr(0, md=(struct mob_data *)bl); + flag = va_arg(ap, int); - mob_damage(NULL, md, md->hp, 2); + if (flag) + mob_damage(NULL, md, md->hp, 2); + else + mob_delete(md); return 0; } diff --git a/src/map/mob.c b/src/map/mob.c index 002a37fb7..a4c93c2e4 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -114,40 +114,37 @@ int mob_spawn_dataset(struct mob_data *md,const char *mobname,int class_) * The MOB appearance for one time (for scripts) *------------------------------------------ */ -int mob_once_spawn(struct map_session_data *sd,char *mapname, - int x,int y,const char *mobname,int class_,int amount,const char *event) +int mob_once_spawn (struct map_session_data *sd, char *mapname, + int x, int y, const char *mobname, int class_, int amount, const char *event) { - struct mob_data *md=NULL; - int m,count,lv=255,r=class_; + struct mob_data *md = NULL; + int m, count, lv = 255; int i, j; - if( sd ) - lv=sd->status.base_level; + if(sd) lv = sd->status.base_level; - if( sd && strcmp(mapname,"this")==0) - m=sd->bl.m; + if(sd && strcmp(mapname,"this")==0) + m = sd->bl.m; else - m=map_mapname2mapid(mapname); + m = map_mapname2mapid(mapname); - if(m<0 || amount<=0 || (class_>=0 && class_<=1000) || class_>MAX_MOB_DB) // 値が異常なら召喚を止める + if (m < 0 || amount <= 0 || (class_ >= 0 && class_ <= 1000) || class_ > MAX_MOB_DB + 4000) // 値が異常なら召喚を止める return 0; - if(class_<0){ // ランダムに召喚 + if (class_ < 0) { // ランダムに召喚 int k; i = 0; j = -class_-1; - if(j>=0 && j<MAX_RANDOMMONSTER){ - do{ - class_=rand()%1000+1001; - k=rand()%1000000; - }while((mob_db[class_].max_hp <= 0 || mob_db[class_].summonper[j] <= k || - (lv<mob_db[class_].lv && battle_config.random_monster_checklv)) && (i++) < 2000); - if(i>=2000){ - class_=mob_db[0].summonper[j]; - } - }else{ + if(j >= 0 && j < MAX_RANDOMMONSTER) { + do { + class_ = rand() % 1000 + 1001; + k = rand() % 1000000; + } while ((mob_db[class_].max_hp <= 0 || mob_db[class_].summonper[j] <= k || + (battle_config.random_monster_checklv && lv < mob_db[class_].lv)) && (i++) < 2000); + if(i >= 2000) + class_ = mob_db[0].summonper[j]; + } else return 0; - } // if(battle_config.etc_log) // printf("mobclass=%d try=%d\n",class_,i); } @@ -166,62 +163,59 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, do { x = rand() % (map[m].xs - 2) + 1; y = rand() % (map[m].ys - 2) + 1; - } while ((i=map_getcell(m, x, y, CELL_CHKNOPASS)) && j++ < 64); + } while ((i = map_getcell(m, x, y, CELL_CHKNOPASS)) && j++ < 64); if (i) { // not solved? x = 0; y = 0; } } + for (count = 0; count < amount; count++) { + md = (struct mob_data *)aCalloc(1,sizeof(struct mob_data)); + memset (md, '\0', sizeof *md); - for(count=0;count<amount;count++){ - md=(struct mob_data *)aCalloc(1,sizeof(struct mob_data)); - memset(md, '\0', sizeof *md); - - if(class_>4000) { // large/tiny mobs [Valaris] - md->size=2; - class_-=4000; - } - else if(class_>MAX_MOB_DB) { - md->size=1; - class_-=MAX_MOB_DB; + if (class_ > MAX_MOB_DB + 2000) { // large/tiny mobs [Valaris] + md->size = 2; + class_ -= (MAX_MOB_DB + 2000); + } else if (class_ > MAX_MOB_DB) { + md->size = 1; + class_ -= MAX_MOB_DB; } - if(mob_db[class_].mode&0x02) - md->lootitem=(struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item)); + if(mob_db[class_].mode & 0x02) + md->lootitem = (struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item)); else - md->lootitem=NULL; + md->lootitem = NULL; - mob_spawn_dataset(md,mobname,class_); - md->bl.m=m; - md->bl.x=x; - md->bl.y=y; - if(r<0&&battle_config.dead_branch_active) md->mode=0x1+0x4+0x80; //移動してアクティブで反撃する - md->m =m; - md->x0=x; - md->y0=y; - md->xs=0; - md->ys=0; - md->spawndelay1=-1; // 一度のみフラグ - md->spawndelay2=-1; // 一度のみフラグ - - memcpy(md->npc_event,event,strlen(event)); - - md->bl.type=BL_MOB; - map_addiddb(&md->bl); - mob_spawn(md->bl.id); - - if(class_==1288) { // emperium hp based on defense level [Valaris] - struct guild_castle *gc=guild_mapname2gc(map[md->bl.m].name); + mob_spawn_dataset (md, mobname, class_); + md->bl.m = m; + md->bl.x = x; + md->bl.y = y; + if (class_ < 0 && battle_config.dead_branch_active) + md->mode = 0x1 + 0x4 + 0x80; //移動してアクティブで反撃する + md->m = m; + md->x0 = x; + md->y0 = y; + md->xs = 0; + md->ys = 0; + md->spawndelay1 = -1; // 一度のみフラグ + md->spawndelay2 = -1; // 一度のみフラグ + + memcpy(md->npc_event, event, strlen(event)); + + md->bl.type = BL_MOB; + map_addiddb (&md->bl); + mob_spawn (md->bl.id); + + if(class_ == 1288) { // emperium hp based on defense level [Valaris] + struct guild_castle *gc = guild_mapname2gc(map[md->bl.m].name); if(gc) { - mob_db[class_].max_hp+=2000*gc->defense; - md->hp=mob_db[class_].max_hp; + mob_db[class_].max_hp += 2000 * gc->defense; + md->hp = mob_db[class_].max_hp; } } // end addition [Valaris] - - } - return (amount>0)?md->bl.id:0; + return (amount > 0) ? md->bl.id : 0; } /*========================================== * The MOB appearance for one time (& area specification for scripts) diff --git a/src/map/npc.c b/src/map/npc.c index 1c5a0c585..6e22c69b3 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2399,7 +2399,8 @@ int do_init_npc(void) char c = '-'; // indoorrswtable.txt and etcinfo.txt [Celest] - npc_read_indoors(); + if (battle_config.indoors_override_grffile) + npc_read_indoors(); //npc_read_weather(); // comparing only the first 24 chars of labels that are 50 chars long isn't that nice |