* Fixed indoorsrwstable.txt reading

* Fixed @monsterbig/@monstersmall not working
* Fixed @killmonster2 not working

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1293 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
celest 2005-03-25 10:16:09 +00:00
parent 548fa69b15
commit f9452b9683
4 changed files with 70 additions and 62 deletions

View File

@ -1,5 +1,11 @@
Date Added 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 03/24
* Added some mapflags for new towns [Lupus] * Added some mapflags for new towns [Lupus]
* Added timer.c optimization / timers sort fix. 'no freezing mobs anymore' Thanx 2 Yor/Freya [Lupus] * Added timer.c optimization / timers sort fix. 'no freezing mobs anymore' Thanx 2 Yor/Freya [Lupus]

View File

@ -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) { static int atkillmonster_sub(struct block_list *bl, va_list ap) {
struct mob_data *md; struct mob_data *md;
int flag;
nullpo_retr(0, ap);
nullpo_retr(0, md=(struct mob_data *)bl); 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; return 0;
} }

View File

@ -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) * The MOB appearance for one time (for scripts)
*------------------------------------------ *------------------------------------------
*/ */
int mob_once_spawn(struct map_session_data *sd,char *mapname, 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 x, int y, const char *mobname, int class_, int amount, const char *event)
{ {
struct mob_data *md=NULL; struct mob_data *md = NULL;
int m,count,lv=255,r=class_; int m, count, lv = 255;
int i, j; int i, j;
if( sd ) if(sd) lv = sd->status.base_level;
lv=sd->status.base_level;
if( sd && strcmp(mapname,"this")==0) if(sd && strcmp(mapname,"this")==0)
m=sd->bl.m; m = sd->bl.m;
else 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; return 0;
if(class_<0){ // ランダムに召喚 if (class_ < 0) { // ランダムに召喚
int k; int k;
i = 0; i = 0;
j = -class_-1; j = -class_-1;
if(j>=0 && j<MAX_RANDOMMONSTER){ if(j >= 0 && j < MAX_RANDOMMONSTER) {
do{ do {
class_=rand()%1000+1001; class_ = rand() % 1000 + 1001;
k=rand()%1000000; k = rand() % 1000000;
}while((mob_db[class_].max_hp <= 0 || mob_db[class_].summonper[j] <= k || } 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); (battle_config.random_monster_checklv && lv < mob_db[class_].lv)) && (i++) < 2000);
if(i>=2000){ if(i >= 2000)
class_=mob_db[0].summonper[j]; class_ = mob_db[0].summonper[j];
} } else
}else{
return 0; return 0;
}
// if(battle_config.etc_log) // if(battle_config.etc_log)
// printf("mobclass=%d try=%d\n",class_,i); // printf("mobclass=%d try=%d\n",class_,i);
} }
@ -166,62 +163,59 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname,
do { do {
x = rand() % (map[m].xs - 2) + 1; x = rand() % (map[m].xs - 2) + 1;
y = rand() % (map[m].ys - 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? if (i) { // not solved?
x = 0; x = 0;
y = 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++){ if (class_ > MAX_MOB_DB + 2000) { // large/tiny mobs [Valaris]
md=(struct mob_data *)aCalloc(1,sizeof(struct mob_data)); md->size = 2;
memset(md, '\0', sizeof *md); class_ -= (MAX_MOB_DB + 2000);
} else if (class_ > MAX_MOB_DB) {
if(class_>4000) { // large/tiny mobs [Valaris] md->size = 1;
md->size=2; class_ -= MAX_MOB_DB;
class_-=4000;
}
else if(class_>MAX_MOB_DB) {
md->size=1;
class_-=MAX_MOB_DB;
} }
if(mob_db[class_].mode&0x02) if(mob_db[class_].mode & 0x02)
md->lootitem=(struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item)); md->lootitem = (struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item));
else else
md->lootitem=NULL; md->lootitem = NULL;
mob_spawn_dataset(md,mobname,class_); mob_spawn_dataset (md, mobname, class_);
md->bl.m=m; md->bl.m = m;
md->bl.x=x; md->bl.x = x;
md->bl.y=y; md->bl.y = y;
if(r<0&&battle_config.dead_branch_active) md->mode=0x1+0x4+0x80; //移動してアクティブで反撃する if (class_ < 0 && battle_config.dead_branch_active)
md->m =m; md->mode = 0x1 + 0x4 + 0x80; //移動してアクティブで反撃する
md->x0=x; md->m = m;
md->y0=y; md->x0 = x;
md->xs=0; md->y0 = y;
md->ys=0; md->xs = 0;
md->spawndelay1=-1; // 一度のみフラグ md->ys = 0;
md->spawndelay2=-1; // 一度のみフラグ md->spawndelay1 = -1; // 一度のみフラグ
md->spawndelay2 = -1; // 一度のみフラグ
memcpy(md->npc_event,event,strlen(event)); memcpy(md->npc_event, event, strlen(event));
md->bl.type=BL_MOB; md->bl.type = BL_MOB;
map_addiddb(&md->bl); map_addiddb (&md->bl);
mob_spawn(md->bl.id); mob_spawn (md->bl.id);
if(class_==1288) { // emperium hp based on defense level [Valaris] if(class_ == 1288) { // emperium hp based on defense level [Valaris]
struct guild_castle *gc=guild_mapname2gc(map[md->bl.m].name); struct guild_castle *gc = guild_mapname2gc(map[md->bl.m].name);
if(gc) { if(gc) {
mob_db[class_].max_hp+=2000*gc->defense; mob_db[class_].max_hp += 2000 * gc->defense;
md->hp=mob_db[class_].max_hp; md->hp = mob_db[class_].max_hp;
} }
} // end addition [Valaris] } // 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) * The MOB appearance for one time (& area specification for scripts)

View File

@ -2399,7 +2399,8 @@ int do_init_npc(void)
char c = '-'; char c = '-';
// indoorrswtable.txt and etcinfo.txt [Celest] // indoorrswtable.txt and etcinfo.txt [Celest]
npc_read_indoors(); if (battle_config.indoors_override_grffile)
npc_read_indoors();
//npc_read_weather(); //npc_read_weather();
// comparing only the first 24 chars of labels that are 50 chars long isn't that nice // comparing only the first 24 chars of labels that are 50 chars long isn't that nice