From a102b2dffb9365116701f99c0dcc486a74cbc073 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 21 Feb 2006 15:59:38 +0000 Subject: - Some fine-tuning of the warp portal code which prevents it from messing up other skills if you "precast" it. - Fixed the weapon refine code using sd->skillid instead of sd->menuskill_id - Fixed some npc_event error reports (three error where displaying at the exact same msg, making it impossible to tell which one of the three actually happened) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5356 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 6 ++++++ src/map/npc.c | 13 ++++++++++--- src/map/skill.c | 31 ++++++++++++++++++++----------- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 57d918aa7..e8c1f8393 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,12 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS 2006/02/21 + * Some cleaning of the warp portal code so that when it is "pre-casted" it + doesn't mess up with other casted skills. [Skotlex] + * Some fixing on the weapon-refine code. [Skotlex] + * Cleaned up some npc_event error reporting. [Skotlex] + * Some cleanup of the castend routines to not clear the skill variables if + for some reason the casted skill triggers another skill. [Skotlex] * Vending is now cancelled on a pc_setpos [Skotlex] * Pressure again ignores Basilica. [Skotlex] * Fixed attacker's sc being nulled when the target's sc is empty (fixes diff --git a/src/map/npc.c b/src/map/npc.c index 7bdba2a61..4a7562b18 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -208,7 +208,7 @@ int npc_timer_event(const unsigned char *eventname) // Added by RoVeRT // int xs,ys; if((ev==NULL || (nd=ev->nd)==NULL)){ - ShowWarning("npc_event: event not found [%s]\n",eventname); + ShowWarning("npc_timer_event: event not found [%s]\n",eventname); return 0; } @@ -435,11 +435,18 @@ int npc_event_do_oninit(void) int npc_addeventtimer(struct npc_data *nd,int tick,const char *name) { int i; + unsigned char *evname; + for(i=0;ieventtimer[i]==-1 ) break; if(ind) == NULL) { if (strnicmp(eventname, "GM_MONSTER",10) != 0) - ShowError("npc_event: event not found [%s]\n", mobevent); + ShowError("npc_event: (mob_kill) event not found [%s]\n", mobevent); return 0; } } else { diff --git a/src/map/skill.c b/src/map/skill.c index 33fa365bc..ced58c325 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -5730,8 +5730,10 @@ int skill_castend_id( int tid, unsigned int tick, int id,int data ) status_change_end(&sd->bl,SC_MAGICPOWER,-1); //Clean this up for future references to battle_getcurrentskill. [Skotlex] - sd->skillid = sd->skilllv = -1; - sd->skilltarget = 0; + if (sd->skilltimer == -1) { + sd->skillid = sd->skilllv = -1; + sd->skilltarget = 0; + } return 0; #undef skill_failed } @@ -5831,8 +5833,10 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data ) skill_castend_pos2(&sd->bl,sd->skillx,sd->skilly,sd->skillid,sd->skilllv,tick,0); - if (sd->skillid != AL_WARP) - sd->skillid = sd->skilllv = -1; //Clean this up for future references to battle_getcurrentskill. [Skotlex] + //Clean this up for future references to battle_getcurrentskill. [Skotlex] + if (sd->skilltimer == -1) { + sd->skillid = sd->skilllv = -1; + } return 0; #undef skill_failed } @@ -6143,7 +6147,7 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma nullpo_retr(0, sd); //Simplify skill_failed code. -#define skill_failed(sd) { sd->skillid = sd->skilllv = sd->skillitem = sd->skillitemlv = -1; sd->menuskill_id = sd->menuskill_lv = 0; } +#define skill_failed(sd) { sd->menuskill_id = sd->menuskill_lv = 0; } if( sd->bl.prev == NULL || pc_isdead(sd) ) return 0; @@ -6242,17 +6246,22 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma skill_failed(sd); return 0; } - //FIXME: What is gonna be done in the case other skills are being used - //in the middle of this block of code? Something more robust needs be - //figured out. And what about when you use another ground skill? skillx + //FIXME: What about when you use another ground skill? skillx //and skilly are messed up already... [Skotlex] + i = sd->skillid; + lv = sd->skilllv; sd->skillid = sd->menuskill_id; sd->skilllv = sd->menuskill_lv; - if(!skill_check_condition(sd,3)) + if(!skill_check_condition(sd,3)) //This checks versus skillid/skilllv... { + sd->skillid = i; + sd->skilllv = lv; skill_failed(sd); return 0; } + sd->skillid = i; + sd->skilllv = lv; + lv = sd->menuskill_lv; if(skill_check_unit_range2(&sd->bl,sd->bl.m,sd->skillx,sd->skilly,skill_num,lv) > 0) { clif_skill_fail(sd,0,0,0); @@ -9049,11 +9058,11 @@ void skill_weaponrefine(struct map_session_data *sd,int idx) item = &sd->status.inventory[idx]; if(item->nameid > 0 && ditem->type == 4) { - if (item->refine >= sd->skilllv || + if (item->refine >= sd->menuskill_lv || item->refine >= MAX_REFINE || // if it's no longer refineable ditem->flag.no_refine || // if the item isn't refinable (i = pc_search_inventory(sd, material [ditem->wlv])) < 0 ) { //fixed by Lupus (item pos can be = 0!) - clif_skill_fail(sd,sd->skillid,0,0); + clif_skill_fail(sd,sd->menuskill_id,0,0); return; } -- cgit v1.2.3-70-g09d2