summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/pc.c20
-rw-r--r--src/map/pc.h5
-rw-r--r--src/map/skill.c69
-rw-r--r--src/map/status.c1
4 files changed, 51 insertions, 44 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index d30f41873..690477d10 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -117,21 +117,25 @@ static int pc_invincible_timer(int tid,unsigned int tick,int id,int data)
return 0;
}
-int pc_setinvincibletimer(struct map_session_data *sd,int val)
+void pc_setinvincibletimer(struct map_session_data* sd, int val)
{
- nullpo_retr(0, sd);
+ nullpo_retv(sd);
- if(sd->invincible_timer != INVALID_TIMER)
+ if( sd->invincible_timer != INVALID_TIMER )
delete_timer(sd->invincible_timer,pc_invincible_timer);
sd->invincible_timer = add_timer(gettick()+val,pc_invincible_timer,sd->bl.id,0);
- return 0;
}
-void pc_delinvincibletimer_sub(struct map_session_data *sd)
+void pc_delinvincibletimer(struct map_session_data* sd)
{
- delete_timer(sd->invincible_timer,pc_invincible_timer);
- sd->invincible_timer = INVALID_TIMER;
- skill_unit_move(&sd->bl,gettick(),1);
+ nullpo_retv(sd);
+
+ if( sd->invincible_timer != INVALID_TIMER )
+ {
+ delete_timer(sd->invincible_timer,pc_invincible_timer);
+ sd->invincible_timer = INVALID_TIMER;
+ skill_unit_move(&sd->bl,gettick(),1);
+ }
}
static int pc_spiritball_timer(int tid,unsigned int tick,int id,int data)
diff --git a/src/map/pc.h b/src/map/pc.h
index 97f08c78b..fcf3665f9 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -289,9 +289,8 @@ struct skill_tree_entry {
extern struct skill_tree_entry skill_tree[MAX_PC_CLASS][MAX_SKILL_TREE];
int pc_read_gm_account(int fd);
-int pc_setinvincibletimer(struct map_session_data *sd,int);
-void pc_delinvincibletimer_sub(struct map_session_data *sd);
-#define pc_delinvincibletimer(sd) if ((sd)->invincible_timer != INVALID_TIMER) pc_delinvincibletimer_sub(sd)
+void pc_setinvincibletimer(struct map_session_data* sd, int val);
+void pc_delinvincibletimer(struct map_session_data* sd);
int pc_addspiritball(struct map_session_data *sd,int,int);
int pc_delspiritball(struct map_session_data *sd,int,int);
diff --git a/src/map/skill.c b/src/map/skill.c
index 507bca0db..66d797b04 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -6489,8 +6489,6 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
*------------------------------------------*/
int skill_castend_map (struct map_session_data *sd, int skill_num, const char *map)
{
- int x=0,y=0;
-
nullpo_retr(0, sd);
//Simplify skill_failed code.
@@ -6531,7 +6529,8 @@ int skill_castend_map (struct map_session_data *sd, int skill_num, const char *m
return 0;
}
- switch(skill_num){
+ switch(skill_num)
+ {
case AL_TELEPORT:
if(strcmp(map,"Random")==0)
pc_randomwarp(sd,3);
@@ -6545,7 +6544,9 @@ int skill_castend_map (struct map_session_data *sd, int skill_num, const char *m
struct skill_unit_group *group;
int i, lv, wx, wy;
int maxcount=0;
+ int x,y;
unsigned short mapindex;
+
mapindex = mapindex_name2id((char*)map);
if(!mapindex) { //Given map not found?
clif_skill_fail(sd,skill_num,0,0);
@@ -6574,15 +6575,15 @@ int skill_castend_map (struct map_session_data *sd, int skill_num, const char *m
wx = sd->menuskill_val>>16;
wy = sd->menuskill_val&0xffff;
- if(lv <= 0) return 0;
- for(i=0;i<lv;i++){
- if(mapindex == p[i]->map){
- x=p[i]->x;
- y=p[i]->y;
- break;
- }
- }
- if(x==0 || y==0) {
+ if( lv <= 0 ) return 0;
+ if( lv > 4 ) lv = 4; // crash prevention
+
+ // check if the chosen map exists in the memo list
+ ARR_FIND( 0, lv, i, mapindex == p[i]->map );
+ if( i < lv ) {
+ x=p[i]->x;
+ y=p[i]->y;
+ } else {
skill_failed(sd);
return 0;
}
@@ -6593,16 +6594,19 @@ int skill_castend_map (struct map_session_data *sd, int skill_num, const char *m
return 0;
}
- if(skill_check_unit_range2(&sd->bl,wx,wy,skill_num,lv) > 0) {
- clif_skill_fail(sd,0,0,0);
- skill_failed(sd);
- return 0;
- }
+ // This makes Warp Portal fail if the cell is not empty
+ //if(skill_check_unit_range2(&sd->bl,wx,wy,skill_num,lv) > 0) {
+ // clif_skill_fail(sd,0,0,0);
+ // skill_failed(sd);
+ // return 0;
+ //}
+
if((group=skill_unitsetting(&sd->bl,skill_num,lv,wx,wy,0))==NULL) {
skill_failed(sd);
return 0;
}
- //Now that there's a mapindex, use that in val3 rather than a string. [Skotlex]
+
+ // record the destination coordinates
group->val2 = (x<<16)|y;
group->val3 = mapindex;
}
@@ -6722,7 +6726,7 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid,
int active_flag=1;
int subunt=0;
- nullpo_retr(0, src);
+ nullpo_retr(NULL, src);
limit = skill_get_time(skillid,skilllv);
range = skill_get_unit_range(skillid,skilllv);
@@ -6731,22 +6735,12 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid,
unit_flag = skill_get_unit_flag(skillid);
layout = skill_get_unit_layout(skillid,skilllv,src,x,y);
- if (skillid == AL_WARP && flag && src->type == BL_SKILL)
- { //Warp Portal morphing to active mode, extract relevant data from src. [Skotlex]
- group= ((TBL_SKILL*)src)->group;
- src = map_id2bl(group->src_id);
- if (!src) return NULL;
- val2=group->val2; //Copy the (x,y) position you warp to
- val3=group->val3; //as well as the mapindex to warp to.
- }
-
BL_CAST(BL_PC, src, sd);
status = status_get_status_data(src);
- sc= status_get_sc(src); // for traps, firewall and fogwall - celest
- if (sc && !sc->count)
- sc = NULL;
+ sc = status_get_sc(src); // for traps, firewall and fogwall - celest
- switch(skillid){
+ switch(skillid)
+ {
case MG_SAFETYWALL:
val2=skilllv+1;
@@ -6761,6 +6755,15 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid,
val1=skilllv+6;
if(!(flag&1))
limit=2000;
+ else // previous implementation (not used anymore)
+ { //Warp Portal morphing to active mode, extract relevant data from src. [Skotlex]
+ if( src->type != BL_SKILL ) return NULL;
+ group = ((TBL_SKILL*)src)->group;
+ src = map_id2bl(group->src_id);
+ if( !src ) return NULL;
+ val2 = group->val2; //Copy the (x,y) position you warp to
+ val3 = group->val3; //as well as the mapindex to warp to.
+ }
break;
case PR_SANCTUARY:
@@ -10262,7 +10265,7 @@ int skill_unit_timer_sub (struct block_list* bl, va_list ap)
case UNT_WARP_ACTIVE:
// warp portal opens (morph to a UNT_WARP_WAITING cell)
- group->unit_id = UNT_WARP_WAITING;
+ group->unit_id = skill_get_unit_id(group->skill_id, 1); // UNT_WARP_WAITING
clif_changelook(&unit->bl, LOOK_BASE, group->unit_id);
// restart timers
group->limit = skill_get_time(group->skill_id,group->skill_lv);
diff --git a/src/map/status.c b/src/map/status.c
index ef559853d..6ff33adcb 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -6847,6 +6847,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
break;
case SC_SPLASHER:
+ // custom Venom Splasher countdown timer
//if (sc->data[type].val4 % 1000 == 0) {
// char timer[10];
// snprintf (timer, 10, "%d", sc->data[type].val4/1000);