浏览代码

- Fixed Freezing Trap doing no damage (changed type from misc to weapon)
- Changed suiton's element to water (apparently fixes not being able to use water-based skills on it)
- Fixed Landmine doing no damage (decreased trigger range to 0 to match its splash range)
- Fixed the disguise commands using the wrong variable when attempting to disguise as an npc.
- Fixed a compilation warning on CELL_CHKNODAMAGE (which is a totally bad-ripoff of basilica cells anyway)
- Corrected and optimized npc_remove_map's npc array cleanup (@reloadscripts no longer report 'too many npcs per map and related dangling pointer crashes are fixed)
- Removed suspicious, yet totally unused npc_data variable 'n'
- HP loss item scripts can no longer kill you.
- Corrected the item-drop-rate check to avoid duplicate entries in @whodrops after a @reloadmobdb
- Cleaned up and optimized map_addnpc (there are never any gaps in the npc array so npc_num always points to the last valid entry)


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12180 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 17 年之前
父节点
当前提交
96684da892
共有 12 个文件被更改,包括 40 次插入30 次删除
  1. 9 0
      Changelog-Trunk.txt
  2. 5 0
      db/Changelog.txt
  3. 2 2
      db/skill_db.txt
  4. 1 1
      db/skill_unit_db.txt
  5. 1 1
      src/map/atcommand.c
  6. 1 1
      src/map/battle.c
  7. 1 1
      src/map/charcommand.c
  8. 9 15
      src/map/map.c
  9. 1 2
      src/map/map.h
  10. 1 1
      src/map/mob.c
  11. 7 6
      src/map/npc.c
  12. 2 0
      src/map/pc.c

+ 9 - 0
Changelog-Trunk.txt

@@ -3,6 +3,15 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2008/02/07
+	* Fixed the disguise commands using the wrong variable when attempting to
+	  disguise as an npc.
+	* Corrected and optimized npc_remove_map's npc array cleanup (Fixes
+	  @reloadscripts reporting 'too many npcs per map' and related dangling
+	  pointer crashes).
+	* HP loss item scripts can no longer kill you.
+	* Corrected the item-drop-rate check to avoid duplicate entries in
+	  @whodrops after a @reloadmobdb. [Skotlex]
 2008/02/04
 	* Some code cleanups. [Zephyrus]
 	- Added new Cell types (NoChat and NoDamage)

+ 5 - 0
db/Changelog.txt

@@ -37,6 +37,11 @@
 	2376 General's_Plate_Mail	Increases heal recovery effectiveness on you by 10%
 
 =======================
+2008/02/07
+	* Corrected Freezing Trap's type to weapon.
+	* Changed suiton's element to water.
+	* Changed Landmine's trigger area to 0 (1x1, to match its splash range).
+	  [Skotlex]
 2008/01/25
 	* Changed cast time of Napalm Vulcan from 1,7s to 1s. [FlavioJS]
 	  Based on X.4 and 11.2 zones

+ 2 - 2
db/skill_db.txt

@@ -162,7 +162,7 @@
 118,3,6,2,0,0x2,1,5,1,no,0,0x80,0,misc,0,	HT_SHOCKWAVE,Shockwave Trap
 119,3,6,2,0,0x3,2,5,1,no,0,0x80,0,misc,0,	HT_SANDMAN,Sandman
 120,3,6,2,0,0x3,1,5,1,no,0,0x80,0,misc,0,	HT_FLASHER,Flasher
-121,3,6,2,1,0x42,1,5,1,no,0,0x80,0,misc,0,	HT_FREEZINGTRAP,Freezing Trap
+121,3,6,2,1,0x42,1,5,1,no,0,0x80,0,weapon,0,	HT_FREEZINGTRAP,Freezing Trap
 122,3,6,2,4,0x42,1,5,1,no,0,0x80,0,misc,0,	HT_BLASTMINE,Blast Mine
 123,3,6,2,3,0x42,2,5,1,no,0,0x80,0,misc,0,	HT_CLAYMORETRAP,Claymore Trap
 124,2,6,32,0,0x1,0,1,1,no,0,0,0,misc,0,		HT_REMOVETRAP,Remove Trap
@@ -579,7 +579,7 @@
 535,0,8,4,3,0,0,10,1,yes,0,0,0,magic,1,		NJ_KAENSIN,Crimson Fire Formation
 536,9,8,1,3,0x2,2,5,3,yes,0,0,0,magic,0,		NJ_BAKUENRYU,Raging Fire Dragon
 537,9,8,1,1,0,0,10,3:4:5:6:7:8:9:10:11:12,yes,0,0,0,magic,0,	NJ_HYOUSENSOU,Spear of Ice
-538,9,6,2,0,0x1,0,10,1,yes,0,0,0,magic,0,	NJ_SUITON,Hidden Water
+538,9,6,2,1,0x1,0,10,1,yes,0,0,0,magic,0,	NJ_SUITON,Hidden Water
 539,0,6,4,1,0x2,3,5,1,yes,0,0,0,magic,0,		NJ_HYOUSYOURAKU,Ice Meteor
 540,9,8,1,4,0,0,10,1:2:2:3:3:4:4:5:5:6,yes,0,0,0,magic,0,	NJ_HUUJIN,Wind Blade
 541,9,6,4,4,0x2,2:2:3:3:4,5,1,yes,0,0,0,magic,0,	NJ_RAIGEKISAI,Lightning Strike of Destruction

+ 1 - 1
db/skill_unit_db.txt

@@ -39,7 +39,7 @@
  91,0x86,    ,  0, 2,1000,enemy, 0x000	//WZ_HEAVENDRIVE
  92,0x8e,    ,  2, 0,  -1,enemy, 0x000	//WZ_QUAGMIRE
 115,0x90,    ,  0, 1,1000,enemy, 0x006	//HT_SKIDTRAP
-116,0x93,    ,  0, 1,1000,enemy, 0x006	//HT_LANDMINE
+116,0x93,    ,  0, 0,1000,enemy, 0x006	//HT_LANDMINE
 117,0x91,    ,  0, 1,1000,enemy, 0x006	//HT_ANKLESNARE
 118,0x94,    ,  0, 1,1000,enemy, 0x006	//HT_SHOCKWAVE
 119,0x95,    ,  0, 1,1000,enemy, 0x006	//HT_SANDMAN

+ 1 - 1
src/map/atcommand.c

@@ -5178,7 +5178,7 @@ int atcommand_disguise(const int fd, struct map_session_data* sd, const char* co
 		{
 			struct npc_data* nd = npc_name2id(message);
 			if (nd != NULL)
-				id = nd->n;
+				id = nd->class_;
 		}
 	}
 

+ 1 - 1
src/map/battle.c

@@ -3020,7 +3020,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 			return -1;
 	}
 
-	if (flag&BCT_ENEMY && map_getcell(m,src->x,src->y,CELL_CHKNODAMAGE) || map_getcell(m,target->x,target->y,CELL_CHKNODAMAGE))
+	if (flag&BCT_ENEMY && (map_getcell(m,src->x,src->y,CELL_CHKNODAMAGE) || map_getcell(m,target->x,target->y,CELL_CHKNODAMAGE)))
 		return -1; // [NoDamage]
 
 	//t_bl/s_bl hold the 'master' of the attack, while src/target are the actual

+ 1 - 1
src/map/charcommand.c

@@ -2896,7 +2896,7 @@ int charcommand_disguise(const int fd, struct map_session_data* sd, const char*
 		{
 			struct npc_data* nd = npc_name2id(mob_name);
 			if (nd != NULL)
-				mob_id = nd->n;
+				mob_id = nd->class_;
 		}
 	}
 

+ 9 - 15
src/map/map.c

@@ -1980,29 +1980,23 @@ bool mapit_exists(struct s_mapiterator* mapit)
 /*==========================================
  * map.npcへ追加 (warp等の領域持ちのみ)
  *------------------------------------------*/
-int map_addnpc(int m,struct npc_data *nd)
+bool map_addnpc(int m,struct npc_data *nd)
 {
-	int i;
+	nullpo_retr(0, nd);
+
 	if( m < 0 || m >= map_num )
-		return -1;
+		return false;
 
-	ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == NULL );
-	if( i == MAX_NPC_PER_MAP )
+	if( map[m].npc_num == MAX_NPC_PER_MAP )
 	{
 		ShowWarning("too many NPCs in one map %s\n",map[m].name);
-		return -1;
+		return false;
 	}
 
-	nullpo_retr(0, nd);
-
-	if( i == map[m].npc_num )
-		map[m].npc_num++;
-
-	map[m].npc[i]=nd;
-	nd->n = i;
+	map[m].npc[map[m].npc_num]=nd;
+	map[m].npc_num++;
 	idb_put(id_db,nd->bl.id,nd);
-
-	return i;
+	return true;
 }
 
 /*=========================================

+ 1 - 2
src/map/map.h

@@ -807,7 +807,6 @@ struct npc_data {
 	struct view_data *vd;
 	struct status_change sc; //They can't have status changes, but.. they want the visual opt values.
 	struct npc_data *master_nd;
-	short n;
 	short class_;
 	short speed;
 	char name[NAME_LENGTH+1];// display name
@@ -1295,7 +1294,7 @@ bool map_knowsaccount(int account_id);
 int map_quit(struct map_session_data *);
 void map_quit_ack(int account_id, int char_id);
 // npc
-int map_addnpc(int,struct npc_data *);
+bool map_addnpc(int,struct npc_data *);
 
 // �°ƒAƒCƒeƒ€ŠÖ˜A
 int map_clearflooritem_timer(int,unsigned int,int,int);

+ 1 - 1
src/map/mob.c

@@ -3427,7 +3427,7 @@ static bool mob_parse_dbrow(char** str)
 				id->maxchance = db->dropitem[i].p; //item has bigger drop chance or sold in shops
 			}
 			for (k = 0; k< MAX_SEARCH; k++) {
-				if (id->mob[k].chance < db->dropitem[i].p && id->mob[k].id != class_)
+				if (id->mob[k].chance <= db->dropitem[i].p)
 					break;
 			}
 			if (k == MAX_SEARCH)

+ 7 - 6
src/map/npc.c

@@ -1211,10 +1211,11 @@ int npc_remove_map(struct npc_data* nd)
 	map_delblock(&nd->bl);
 	//Remove npc from map[].npc list. [Skotlex]
 	ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == nd );
-	if( i >= map[m].npc_num ) return 2; //failed to find it?
+	if( i == map[m].npc_num ) return 2; //failed to find it?
 
 	map[m].npc_num--;
-	memmove(&map[m].npc[i], &map[m].npc[i+1], (map[m].npc_num-i)*sizeof(map[m].npc[0]));
+	map[m].npc[i] = map[m].npc[map[m].npc_num];
+	map[m].npc[map[m].npc_num] = NULL;
 	return 0;
 }
 
@@ -1452,7 +1453,7 @@ struct npc_data* npc_add_warp(short from_mapid, short from_x, short from_y, shor
 
 	CREATE(nd, struct npc_data, 1);
 	nd->bl.id = npc_get_new_npc_id();
-	nd->n = map_addnpc(from_mapid, nd);
+	map_addnpc(from_mapid, nd);
 	nd->bl.prev = nd->bl.next = NULL;
 	nd->bl.m = from_mapid;
 	nd->bl.x = from_x;
@@ -1514,7 +1515,7 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const
 	CREATE(nd, struct npc_data, 1);
 
 	nd->bl.id = npc_get_new_npc_id();
-	nd->n = map_addnpc(m, nd);
+	map_addnpc(m, nd);
 	nd->bl.prev = nd->bl.next = NULL;
 	nd->bl.m = m;
 	nd->bl.x = x;
@@ -1622,7 +1623,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 	nd->subtype = SHOP;
 	if( m >= 0 )
 	{// normal shop npc
-		nd->n = map_addnpc(m,nd);
+		map_addnpc(m,nd);
 		map_addblock(&nd->bl);
 		status_set_viewdata(&nd->bl, nd->class_);
 		status_change_init(&nd->bl);
@@ -1858,7 +1859,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
 
 	if( m >= 0 )
 	{
-		nd->n = map_addnpc(m, nd);
+		map_addnpc(m, nd);
 		status_change_init(&nd->bl);
 		unit_dataset(&nd->bl);
 		nd->ud.dir = dir;

+ 2 - 0
src/map/pc.c

@@ -6867,6 +6867,8 @@ void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick)
 			hp += sd->hp_loss.value;
 			sd->hp_loss.tick -= sd->hp_loss.rate;
 		}
+		if(hp >= sd->battle_status.hp)
+			hp = sd->battle_status.hp-1; //Script drains cannot kill you.
 	}
 	
 	if (sd->sp_loss.value) {