summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-15 08:55:36 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-15 08:55:36 +0000
commit09af9729fa04300ecb6c98e95962afa22a5c96b3 (patch)
treef93bd8b5dad84155c9dd265a20029ede25283bf9 /src
parente1eab1687c962cc3bea25cb66981c28be65e6e3b (diff)
downloadhercules-09af9729fa04300ecb6c98e95962afa22a5c96b3.tar.gz
hercules-09af9729fa04300ecb6c98e95962afa22a5c96b3.tar.bz2
hercules-09af9729fa04300ecb6c98e95962afa22a5c96b3.tar.xz
hercules-09af9729fa04300ecb6c98e95962afa22a5c96b3.zip
* Added experimental code to generate a stack dump when it segfaults
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1108 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/pc.c30
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/skill.c75
-rw-r--r--src/map/skill.h7
-rw-r--r--src/map/status.c5
6 files changed, 72 insertions, 48 deletions
diff --git a/src/map/map.h b/src/map/map.h
index 91e296f69..579708c51 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -215,6 +215,7 @@ struct map_session_data {
struct skill_unit_group skillunit[MAX_SKILLUNITGROUP];
struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET];
struct skill_timerskill skilltimerskill[MAX_SKILLTIMERSKILL];
+ char blockskill[MAX_SKILL]; // [celest]
unsigned short timerskill_count; // [celest]
int cloneskill_id;
int potion_hp,potion_sp,potion_per_hp,potion_per_sp;
diff --git a/src/map/pc.c b/src/map/pc.c
index 4c5438d50..8fb4188f8 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -706,6 +706,9 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars
sd->skilltimerskill[i].timer = -1;
sd->timerskill_count=0;
+ for (i=0; i<MAX_SKILL; i++)
+ sd->blockskill[i]=0;
+
memset(&sd->dev,0,sizeof(struct square));
for(i = 0; i < 5; i++) {
sd->dev.val1[i] = 0;
@@ -1833,6 +1836,33 @@ int pc_skill(struct map_session_data *sd,int id,int level,int flag)
}
/*==========================================
+ *
+ *------------------------------------------
+ */
+int pc_blockskill_end(int tid,unsigned int tick,int id,int data)
+{
+ struct map_session_data *sd;
+
+ nullpo_retr (-1, sd = map_id2sd(id));
+ sd->blockskill[data] = 0;
+
+ return 1;
+}
+void pc_blockskill_start (struct map_session_data *sd, int skillid, int tick)
+{
+ nullpo_retv(sd);
+
+ if (skillid >= 10000 && skillid < 10015)
+ skillid -= 9500;
+ else if (skillid < 1 || skillid > MAX_SKILL)
+ return;
+
+ sd->blockskill[skillid] = 1;
+ add_timer(gettick()+tick,pc_blockskill_end,sd->bl.id,skillid);
+ return;
+}
+
+/*==========================================
* カ?ド?入
*------------------------------------------
*/
diff --git a/src/map/pc.h b/src/map/pc.h
index 17fea9c13..067c3af81 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -91,6 +91,8 @@ int pc_bonus2(struct map_session_data *sd,int,int,int);
int pc_bonus3(struct map_session_data *sd,int,int,int,int);
int pc_skill(struct map_session_data*,int,int,int);
+void pc_blockskill_start (struct map_session_data*,int,int); // [celest]
+
int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip);
int pc_item_identify(struct map_session_data *sd,int idx);
diff --git a/src/map/skill.c b/src/map/skill.c
index 0206777cb..fb5cd1e40 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -810,17 +810,26 @@ int skill_trap_splash(struct block_list *bl, va_list ap );
int skill_count_target(struct block_list *bl, va_list ap );
// [MouseJstr] - skill ok to cast? and when?
-int skillnotok(int skillid, struct map_session_data *sd) {
-
- if (sd == 0)
+int skillnotok(int skillid, struct map_session_data *sd)
+{
+ nullpo_retr (1, sd);
+ //if (sd == 0)
//return 0;
- return 1;
+ //return 1;
// I think it was meant to be "no skills allowed when not a valid sd"
if (!(skillid >= 10000 && skillid < 10015))
if ((skillid > MAX_SKILL) || (skillid < 0))
return 1;
+ {
+ int i = skillid;
+ if (i >= 10000 && i < 10015)
+ i -= 9500;
+ if (sd->blockskill[i] > 0)
+ return 1;
+ }
+
if (pc_isGM(sd) >= 20)
return 0; // gm's can do anything damn thing they want
@@ -835,16 +844,16 @@ int skillnotok(int skillid, struct map_session_data *sd) {
return 1;
if (battle_config.pk_mode && !map[sd->bl.m].flag.nopvp && skill_get_nocast (skillid) & 16)
return 1;
-
- switch (skillid) {
- case AL_WARP:
- case AL_TELEPORT:
- case MC_VENDING:
- case MC_IDENTIFY:
- return 0; // always allowed
- default:
- return(map[sd->bl.m].flag.noskill);
- }
+
+ switch (skillid) {
+ case AL_WARP:
+ case AL_TELEPORT:
+ case MC_VENDING:
+ case MC_IDENTIFY:
+ return 0; // always allowed
+ default:
+ return(map[sd->bl.m].flag.noskill);
+ }
}
@@ -1495,7 +1504,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
return 0;
if(bl->type == BL_PC && pc_isdead((struct map_session_data *)bl)) //?象がPCですでに死んでいたら何もしない
return 0;
- if(bl->type == BL_PC && skillnotok(skillid, (struct map_session_data *) bl))
+ if(bl->type == BL_PC && skillnotok(skillid, (struct map_session_data *)bl))
return 0; // [MouseJstr]
if(sc_data && sc_data[SC_HIDING].timer != -1) { //ハイディング?態で
if(skill_get_pl(skillid) != 2) //スキルの?性が地?性でなければ何もしない
@@ -2784,7 +2793,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
clif_updatestatus(sd,SP_SP);
}
}
- status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0, (skilllv < 5 ? 10000: 15000),0 );
+ pc_blockskill_start (sd, skillid, (skilllv < 5 ? 10000: 15000));
}
break;
@@ -2924,7 +2933,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
return 1;
if(status_get_class(bl) == 1288)
return 1;
- if (skillnotok(skillid, (struct map_session_data *)bl)) // [MouseJstr]
+ if (sd && skillnotok(skillid, sd)) // [MouseJstr]
return 0;
map_freeblock_lock();
@@ -3266,7 +3275,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
case SM_ENDURE: /* インデュア */
clif_skill_nodamage(src,bl,skillid,skilllv,1);
status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 );
- status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,10000,0 );
+ pc_blockskill_start (sd, skillid, 10000);
break;
case SM_AUTOBERSERK: // Celest
@@ -4609,7 +4618,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
src->m,src->x-15,src->y-15,src->x+15,src->y+15,0,
src,skillid,skilllv,tick, flag|BCT_ALL|1,
skill_castend_nodamage_id);
- status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 );
+ pc_blockskill_start (sd, skillid, 300000);
}
}
break;
@@ -4634,7 +4643,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
src->m,src->x-15,src->y-15,src->x+15,src->y+15,0,
src,skillid,skilllv,tick, flag|BCT_ALL|1,
skill_castend_nodamage_id);
- status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 );
+ pc_blockskill_start (sd, skillid, 300000);
}
}
break;
@@ -4664,7 +4673,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
src->m,src->x-15,src->y-15,src->x+15,src->y+15,0,
src,skillid,skilllv,tick, flag|BCT_ALL|1,
skill_castend_nodamage_id);
- status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 );
+ pc_blockskill_start (sd, skillid, 300000);
}
}
break;
@@ -4693,7 +4702,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
pc_setpos(dstsd, sd->mapname, sd->bl.x+dx[j], sd->bl.y+dy[j], 2);
}
}
- status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 );
+ pc_blockskill_start (sd, skillid, 300000);
}
}
break;
@@ -4868,8 +4877,8 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
skillid != AM_SPHEREMINE)
clif_skill_poseffect(src,skillid,skilllv,x,y,tick);
- if (skillnotok(skillid, sd)) // [MouseJstr]
- return 0;
+ if (sd && skillnotok(skillid, sd)) // [MouseJstr]
+ return 0;
switch(skillid)
{
@@ -5002,7 +5011,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
pc_movepos(sd,x,y);
}else if( src->type==BL_MOB )
mob_warp((struct mob_data *)src,-1,x,y,0);
- status_change_start(src,SC_BLOCKSKILL,skilllv,0,MO_EXTREMITYFIST,0,2000,0 );
+ pc_blockskill_start (sd, MO_EXTREMITYFIST, 2000);
break;
case AM_CANNIBALIZE: // バイオプラント
if(sd){
@@ -5085,8 +5094,8 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma
if( sd->bl.prev == NULL || pc_isdead(sd) )
return 0;
- if(skillnotok(skill_num, sd))
- return 0;
+ if(skillnotok(skill_num, sd))
+ return 0;
if( sd->opt1>0 || sd->status.option&2 )
return 0;
@@ -5100,10 +5109,6 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma
sd->sc_data[SC_BERSERK].timer != -1 ||
sd->sc_data[SC_MARIONETTE].timer != -1)
return 0;
-
- if (sd->sc_data[SC_BLOCKSKILL].timer!=-1)
- if (skill_num == sd->sc_data[SC_BLOCKSKILL].val3)
- return 0;
}
if( skill_num != sd->skillid) /* 不正パケットらしい */
@@ -7474,10 +7479,6 @@ int skill_use_id( struct map_session_data *sd, int target_id,
if(lv==5 && skill_num!=MO_FINGEROFFENSIVE && skill_num!=MO_INVESTIGATE && skill_num!=MO_CHAINCOMBO && skill_num!=MO_EXTREMITYFIST) return 0;
}
- if (sc_data[SC_BLOCKSKILL].timer!=-1)
- if (skill_num == sc_data[SC_BLOCKSKILL].val3)
- return 0;
-
if (sc_data[SC_BASILICA].timer != -1) { // Disallow all other skills in Basilica [celest]
struct skill_unit *su;
if ((su = (struct skill_unit *)sc_data[SC_BASILICA].val4)) {
@@ -7822,10 +7823,6 @@ int skill_use_pos( struct map_session_data *sd,
sc_data[SC_MARIONETTE].timer != -1)
return 0; /* ?態異常や沈?など */
- if (sc_data[SC_BLOCKSKILL].timer!=-1)
- if (skill_num == sd->sc_data[SC_BLOCKSKILL].val3)
- return 0;
-
if (sc_data[SC_BASILICA].timer != -1) { // Basilica cancels if caster moves [celest]
struct skill_unit *su;
if ((su = (struct skill_unit *)sc_data[SC_BASILICA].val4)) {
diff --git a/src/map/skill.h b/src/map/skill.h
index d23006ddb..af2d79f59 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -353,10 +353,9 @@ enum { // struct map_session_data の status_changeの番?テ?ブル
SC_MINDBREAKER =191,
SC_SPELLBREAKER =192,
SC_LANDPROTECTOR =193,
- SC_BLOCKSKILL =194, // for disallowing the use of a skill for a time period
- SC_ADAPTATION =195,
- SC_CHASEWALK =196,
- SC_REGENERATION =201,
+ SC_ADAPTATION =194,
+ SC_CHASEWALK =195,
+ SC_REGENERATION =196,
// [Celest]
diff --git a/src/map/status.c b/src/map/status.c
index 27f134354..a98fd9559 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -3489,11 +3489,6 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
case SC_PRESERVE:
break;
- case SC_BLOCKSKILL:
- if (!tick) tick = 60000;
- if (!val3) val3 = -1;
- break;
-
case SC_SLOWDOWN:
case SC_SPEEDUP0:
calc_flag = 1;