summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-22 10:01:13 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-22 10:01:13 +0000
commit6a2a8a7d451f394b132383b20e499985d026aaae (patch)
treeb7ba6c56985fee723f214dc68a30c12473204acb /src
parente18d01b53500c4d4744cfe31cacaed56f414f0da (diff)
downloadhercules-6a2a8a7d451f394b132383b20e499985d026aaae.tar.gz
hercules-6a2a8a7d451f394b132383b20e499985d026aaae.tar.bz2
hercules-6a2a8a7d451f394b132383b20e499985d026aaae.tar.xz
hercules-6a2a8a7d451f394b132383b20e499985d026aaae.zip
* Check if the player has been authentified by the char server before clearing any timers in map_quit
* Added eventtimercount and timerskill_count * Added sc_count check in skill_stop_dancing git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@723 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/map.c18
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/pc.c10
-rw-r--r--src/map/skill.c14
4 files changed, 38 insertions, 6 deletions
diff --git a/src/map/map.c b/src/map/map.c
index f909953c9..509504773 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -986,7 +986,10 @@ int map_quit(struct map_session_data *sd) {
else
storage_storage_quit(sd); // 倉庫を開いてるなら保存する
- skill_castcancel(&sd->bl,0); // 詠唱を中?する
+ // check if we've been authenticated [celest]
+ if (sd->state.auth)
+ skill_castcancel(&sd->bl,0); // 詠唱を中?する
+
skill_stop_dancing(&sd->bl,1);// ダンス/演奏中?
if(sd->sc_data && sd->sc_data[SC_BERSERK].timer!=-1) //バ?サ?ク中の終了はHPを100に
@@ -995,13 +998,18 @@ int map_quit(struct map_session_data *sd) {
skill_status_change_clear(&sd->bl,1); // ステ?タス異常を解除する
skill_clear_unitgroup(&sd->bl); // スキルユニットグル?プの削除
skill_cleartimerskill(&sd->bl);
- pc_stop_walking(sd,0);
- pc_stopattack(sd);
- pc_delinvincibletimer(sd);
+
+ // check if we've been authenticated [celest]
+ if (sd->state.auth) {
+ pc_stop_walking(sd,0);
+ pc_stopattack(sd);
+ pc_delinvincibletimer(sd);
+ }
pc_delspiritball(sd,sd->spiritball,1);
skill_gangsterparadise(sd,0);
- pc_calcstatus(sd,4);
+ if (sd->state.auth)
+ pc_calcstatus(sd,4);
// skill_clear_unitgroup(&sd->bl); // [Sara-chan]
clif_clearchar_area(&sd->bl,2);
diff --git a/src/map/map.h b/src/map/map.h
index 5067d6928..79926903c 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -210,6 +210,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];
+ unsigned short timerskill_count; // [celest]
int cloneskill_id,cloneskill_lv;
int potion_hp,potion_sp,potion_per_hp,potion_per_sp;
@@ -319,6 +320,7 @@ struct map_session_data {
char eventqueue[MAX_EVENTQUEUE][50];
int eventtimer[MAX_EVENTTIMER];
+ unsigned short eventcount; // [celest]
int last_skillid,last_skilllv; // Added by RoVeRT
diff --git a/src/map/pc.c b/src/map/pc.c
index 076d72c18..4e429f378 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -785,6 +785,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars
sd->spirit_timer[i] = -1;
for(i = 0; i < MAX_SKILLTIMERSKILL; i++)
sd->skilltimerskill[i].timer = -1;
+ sd->timerskill_count=0;
memset(&sd->dev,0,sizeof(struct square));
for(i = 0; i < 5; i++) {
@@ -837,6 +838,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars
memset(sd->eventqueue, 0, sizeof(sd->eventqueue));
for(i = 0; i < MAX_EVENTTIMER; i++)
sd->eventtimer[i] = -1;
+ sd->eventcount=0;
// 位置の設定
if (pc_setpos(sd,sd->status.last_point.map, sd->status.last_point.x, sd->status.last_point.y, 0) != 0) {
@@ -6746,6 +6748,7 @@ int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name)
memcpy(evname,name,24);
sd->eventtimer[i]=add_timer(gettick()+tick,
pc_eventtimer,sd->bl.id,(int)evname);
+ sd->eventcount++;
}
return 0;
@@ -6761,11 +6764,15 @@ int pc_deleventtimer(struct map_session_data *sd,const char *name)
nullpo_retr(0, sd);
+ if (sd->eventcount <= 0)
+ return 0;
+
for(i=0;i<MAX_EVENTTIMER;i++)
if( sd->eventtimer[i]!=-1 && strcmp(
(char *)(get_timer(sd->eventtimer[i])->data), name)==0 ){
delete_timer(sd->eventtimer[i],pc_eventtimer);
sd->eventtimer[i]=-1;
+ sd->eventcount--;
break;
}
@@ -6802,6 +6809,9 @@ int pc_cleareventtimer(struct map_session_data *sd)
nullpo_retr(0, sd);
+ if (sd->eventcount <= 0)
+ return 0;
+
for(i=0;i<MAX_EVENTTIMER;i++)
if( sd->eventtimer[i]!=-1 ){
delete_timer(sd->eventtimer[i],pc_eventtimer);
diff --git a/src/map/skill.c b/src/map/skill.c
index b206209bc..85f6c6382 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2036,6 +2036,10 @@ static int skill_timerskill(int tid, unsigned int tick, int id,int data )
nullpo_retr(0, skl);
skl->timer = -1;
+ if (sd) {
+ sd->timerskill_count--;
+ }
+
if(skl->target_id) {
struct block_list tbl;
target = map_id2bl(skl->target_id);
@@ -2162,6 +2166,7 @@ int skill_addtimerskill(struct block_list *src,unsigned int tick,int target,int
sd->skilltimerskill[i].y = y;
sd->skilltimerskill[i].type = type;
sd->skilltimerskill[i].flag = flag;
+ sd->timerskill_count++;
return 0;
}
@@ -2226,10 +2231,15 @@ int skill_cleartimerskill(struct block_list *src)
if(src->type == BL_PC) {
struct map_session_data *sd = (struct map_session_data *)src;
nullpo_retr(0, sd);
+
+ if (sd->timerskill_count <= 0)
+ return 0;
+
for(i=0;i<MAX_SKILLTIMERSKILL;i++) {
if(sd->skilltimerskill[i].timer != -1) {
delete_timer(sd->skilltimerskill[i].timer, skill_timerskill);
sd->skilltimerskill[i].timer = -1;
+ sd->timerskill_count--;
}
}
}
@@ -10460,11 +10470,13 @@ void skill_stop_dancing(struct block_list *src, int flag)
{
struct status_change* sc_data;
struct skill_unit_group* group;
+ short* sc_count;
nullpo_retv(src);
nullpo_retv(sc_data = battle_get_sc_data(src));
+ nullpo_retv(sc_count = battle_get_sc_count(src));
- if(sc_data[SC_DANCING].timer != -1) {
+ if((*sc_count)>0 && sc_data[SC_DANCING].timer != -1) {
group=(struct skill_unit_group *)sc_data[SC_DANCING].val2; //ダンスのスキルユニットIDはval2に入ってる
if(group && src->type==BL_PC && sc_data && sc_data[SC_DANCING].val4){ //合奏中?
struct map_session_data* dsd=map_id2sd(sc_data[SC_DANCING].val4); //相方のsd取得