summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-06-04 13:13:34 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-06-04 13:13:34 +0000
commit4001777de4bc272bbbef792ea08ab1d93cea2ab2 (patch)
treef84f9fa23367b12ece48cd0d3ce0ac8538230325
parent16bbe71ddbaa0d83cc0bfe55176a1ba43eb5cad0 (diff)
downloadhercules-4001777de4bc272bbbef792ea08ab1d93cea2ab2.tar.gz
hercules-4001777de4bc272bbbef792ea08ab1d93cea2ab2.tar.bz2
hercules-4001777de4bc272bbbef792ea08ab1d93cea2ab2.tar.xz
hercules-4001777de4bc272bbbef792ea08ab1d93cea2ab2.zip
- Little cleanup to OnTouchNPC.
- Updating Release of Wish script. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12757 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--db/item_db.txt4
-rw-r--r--src/map/npc.c77
2 files changed, 36 insertions, 45 deletions
diff --git a/db/item_db.txt b/db/item_db.txt
index 02d466ec5..fce78cf5d 100644
--- a/db/item_db.txt
+++ b/db/item_db.txt
@@ -831,7 +831,7 @@
1627,Staffy,Staffy,4,,10,0,120,,1,0,0x00818315,7,2,2,1,1,0,10,{ bonus bMatkRate,15; bonus2 bAddRace,RC_Boss,50; bonus2 bAddRace,RC_NonBoss,50; },{},{}
1628,Survival_Rod_C,Refined Survivor's Rod,4,,0,0,71,,1,0,0x00818314,7,2,2,3,1,0,10,{ bonus bDex,4; bonus bMatkRate,20; bonus bMaxHP,500; },{},{}
1629,Walking_Stick,Gentleman's Staff,4,,,500,40,,1,1,0x00818315,7,2,2,4,50,1,10,{ bonus bMatkRate,15+getrefine(); bonus bDex,1; if (isequipped(5045)) bonus bDex,2; bonus bInt,2; bonus bSPrecovRate,5; },{},{}
-1630,Radiant_Wisdom,Release of Wish,4,,,500,30,,1,0,0x00018205,7,2,2,3,50,1,10,{ bonus bMatkRate,15; bonus bInt,3; },{},{}
+1630,Radiant_Wisdom,Release of Wish,4,,,500,30,,1,0,0x00018205,7,2,2,3,50,1,10,{ bonus bMatkRate,15; bonus bInt,3; bonus bSPrecovRate,6; bonus bHPrecovRate,6; bonusautoscript "{ sc_start4 SC_HPREGEN,2000,100,1,0,0; sc_start4 SC_SPREGEN,2000,50,1,0,0; }",10,BF_MAGIC; },{},{}
1631,Holy_Stick,Holy Stick,4,,,500,50,,1,1,0x00008101,7,2,2,4,70,1,10,{ bonus bMatkRate,15; bonus2 bCastrate,156,-25; bonus2 bCastrate,77,-25; bonus2 bCastrate,79,-25; },{},{}
1632,Wolong's_Magic_Staff,Wolong's Magic Staff,4,,0,0,70,,1,0,0x00818315,7,2,2,3,80,1,10,{ bonus bint,4; bonus bDex,3; bonus bMatkRate,15; bonus2 bIgnoreMdefRate,RC_DemiHuman,25; bonus bUnbreakableWeapon,0; },{},{}
1633,Wolong's_Battle_Staff,Wolong's Magic Staff,4,,0,0,70,,1,0,0x00818315,7,2,2,3,80,1,10,{ bonus bint,3; bonus bDex,3; bonus bMatkRate,15; bonus2 bMagicAddRace,RC_DemiHuman,15; bonus bUnbreakableWeapon,0; },{},{}
@@ -3421,7 +3421,7 @@
12207,VIT_Dish,Immortal Stew,0,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start SC_VITFood,1800000, 10; percentheal 15,5; },{},{}
12208,Battle_Manual,Battle Manual,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start SC_EXPBOOST,1800000,50; },{},{}
12209,Insurance,Life Insurance,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start SC_LIFEINSURANCE,1800000,0; },{},{}
-12210,Bubble_Gum,Bubble Gum,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start SC_ITEMBOOST,1800000,0;},{},{}
+12210,Bubble_Gum,Bubble Gum,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start SC_ITEMBOOST,1800000,0; },{},{}
12211,Kafra_Card,Kafra Card,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "F_CashStore"; },{},{}
12212,Giant_Fly_Wing,Giant Fly Wing,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "F_CashPartyCall"; },{},{}
12213,Neuralizer,Neuralizer,2,,,0,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "F_CashReset"; },{},{}
diff --git a/src/map/npc.c b/src/map/npc.c
index c576295df..1a888cd24 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -777,6 +777,8 @@ int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y)
return 0;
}
+// OnTouch NPC or Warp for Mobs
+// Return 1 if Warped
int npc_touch_areanpc2(struct mob_data *md)
{
int i, m = md->bl.m, x = md->bl.x, y = md->bl.y;
@@ -791,58 +793,47 @@ int npc_touch_areanpc2(struct mob_data *md)
switch( map[m].npc[i]->subtype )
{
- case WARP:
- if( battle_config.mob_warp&1 )
- {
+ case WARP:
+ if( !battle_config.mob_warp&1 )
+ continue;
xs = map[m].npc[i]->u.warp.xs;
ys = map[m].npc[i]->u.warp.ys;
- }
- else
- continue;
- break;
- case SCRIPT:
- xs = map[m].npc[i]->u.scr.xs;
- ys = map[m].npc[i]->u.scr.ys;
- snprintf(eventname, ARRAYLENGTH(eventname), "%s::OnTouchNPC", map[m].npc[i]->exname);
- break;
- default:
- continue;
+ break;
+ case SCRIPT:
+ xs = map[m].npc[i]->u.scr.xs;
+ ys = map[m].npc[i]->u.scr.ys;
+ break;
+ default:
+ continue; // Keep Searching
}
- if( x >= map[m].npc[i]->bl.x-xs && x <= map[m].npc[i]->bl.x+xs && y >= map[m].npc[i]->bl.y-ys && y <= map[m].npc[i]->bl.y+ys )
- {
- if( map[m].npc[i]->subtype == SCRIPT
- && ((ev = (struct event_data*)strdb_get(ev_db, eventname)) == NULL || ev->nd == NULL) )
- continue; // No OnTouchNPC Event found
- break;
- }
- }
-
- if( i == map[m].npc_num ) return 0;
-
- switch( map[m].npc[i]->subtype )
- {
- case WARP:
- xs = map_mapindex2mapid(map[m].npc[i]->u.warp.mapindex);
- if( xs < 0 )
- return 0; // Can't warp object between map servers...
- if( unit_warp(&md->bl, xs, map[m].npc[i]->u.warp.x, map[m].npc[i]->u.warp.y, 0) )
- return 0; // Failed to warp.
- break;
- case SCRIPT:
- {
- if( md->areanpc_id == map[m].npc[i]->bl.id )
- return 0; // Allready touch this NPC
-
- md->areanpc_id = map[m].npc[i]->bl.id;
- run_script(ev->nd->u.scr.script, ev->pos, md->bl.id, ev->nd->bl.id);
+ if( x >= map[m].npc[i]->bl.x-xs && x <= map[m].npc[i]->bl.x+xs && y >= map[m].npc[i]->bl.y-ys && y <= map[m].npc[i]->bl.y+ys )
+ { // In the npc touch area
+ switch( map[m].npc[i]->subtype )
+ {
+ case WARP:
+ xs = map_mapindex2mapid(map[m].npc[i]->u.warp.mapindex);
+ if( m < 0 )
+ break; // Cannot Warp between map servers
+ if( unit_warp(&md->bl, xs, map[m].npc[i]->u.warp.x, map[m].npc[i]->u.warp.y, 0) == 0 )
+ return 1; // Warped
+ break;
+ case SCRIPT:
+ if( map[m].npc[i]->bl.id == md->areanpc_id )
+ break; // Already touch this NPC
+ snprintf(eventname, ARRAYLENGTH(eventname), "%s::OnTouchNPC", map[m].npc[i]->exname);
+ if( (ev = (struct event_data*)strdb_get(ev_db, eventname)) == NULL || ev->nd == NULL )
+ break; // No OnTouchNPC Event
+ md->areanpc_id = map[m].npc[i]->bl.id;
+ run_script(ev->nd->u.scr.script, ev->pos, md->bl.id, ev->nd->bl.id);
+ break;
+ }
return 0;
- break;
}
}
- return 1;
+ return 0;
}
//Checks if there are any NPC on-touch objects on the given range.