summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-07 00:07:47 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-07 00:07:47 +0000
commit1c388b20fe58a62b05aa7364def81f196a9d1146 (patch)
tree12aaa4d0ae4d9ce5838bbc6eb5916f477a9e0d33
parent666e165062c189847ee654e8ac22d98075f75fe5 (diff)
downloadhercules-1c388b20fe58a62b05aa7364def81f196a9d1146.tar.gz
hercules-1c388b20fe58a62b05aa7364def81f196a9d1146.tar.bz2
hercules-1c388b20fe58a62b05aa7364def81f196a9d1146.tar.xz
hercules-1c388b20fe58a62b05aa7364def81f196a9d1146.zip
- 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12180 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt9
-rw-r--r--db/Changelog.txt5
-rw-r--r--db/skill_db.txt4
-rw-r--r--db/skill_unit_db.txt2
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/charcommand.c2
-rw-r--r--src/map/map.c24
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/npc.c13
-rw-r--r--src/map/pc.c2
12 files changed, 40 insertions, 30 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 4fcc20e0a..9f6ccf9b8 100644
--- a/Changelog-Trunk.txt
+++ b/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)
diff --git a/db/Changelog.txt b/db/Changelog.txt
index 9a7c9a881..66fadb438 100644
--- a/db/Changelog.txt
+++ b/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
diff --git a/db/skill_db.txt b/db/skill_db.txt
index be3eebda5..b63f14fad 100644
--- a/db/skill_db.txt
+++ b/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
diff --git a/db/skill_unit_db.txt b/db/skill_unit_db.txt
index 562ed96e4..908a91ff3 100644
--- a/db/skill_unit_db.txt
+++ b/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
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index f13306fed..689780909 100644
--- a/src/map/atcommand.c
+++ b/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_;
}
}
diff --git a/src/map/battle.c b/src/map/battle.c
index 9e5d05623..cd54a2e39 100644
--- a/src/map/battle.c
+++ b/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
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index a097dcbad..2e8c90b89 100644
--- a/src/map/charcommand.c
+++ b/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_;
}
}
diff --git a/src/map/map.c b/src/map/map.c
index 153206101..cc8de1a3a 100644
--- a/src/map/map.c
+++ b/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;
}
/*=========================================
diff --git a/src/map/map.h b/src/map/map.h
index 457494dab..84d041569 100644
--- a/src/map/map.h
+++ b/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 *);
// 床アイテム関連
int map_clearflooritem_timer(int,unsigned int,int,int);
diff --git a/src/map/mob.c b/src/map/mob.c
index f319fc144..1f78ec8d5 100644
--- a/src/map/mob.c
+++ b/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)
diff --git a/src/map/npc.c b/src/map/npc.c
index 27110a996..dbb190ebb 100644
--- a/src/map/npc.c
+++ b/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;
diff --git a/src/map/pc.c b/src/map/pc.c
index 3d0d0fc95..082a61aa3 100644
--- a/src/map/pc.c
+++ b/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) {