summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt6
-rw-r--r--src/map/npc.c13
-rw-r--r--src/map/skill.c31
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;i<MAX_EVENTTIMER;i++)
if( nd->eventtimer[i]==-1 )
break;
if(i<MAX_EVENTTIMER){
- unsigned char *evname=(unsigned char *) aCallocA(NAME_LENGTH, sizeof(char));
+ if (!strdb_get(ev_db,name)) {
+ if (battle_config.error_log)
+ ShowError("npc_addeventimer: Event %s does not exists.\n", name);
+ return 1; //Event does not exists!
+ }
+ evname =(unsigned char *) aCallocA(NAME_LENGTH, sizeof(char));
if(evname==NULL){
ShowFatalError("npc_addeventtimer: out of memory !\n");exit(1);
}
@@ -802,7 +809,7 @@ int npc_event (struct map_session_data *sd, const unsigned char *eventname, int
ev = strdb_get(ev_db, mobevent);
if (ev == NULL || (nd = ev->nd) == 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;
}