summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-30 19:28:41 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-30 19:28:41 +0000
commitc8391c9c07abd235b2d40d8cfec39d62827706a7 (patch)
treed28df1f57382478a6b28f6a60f1f63bb44c44171 /src/map
parentde96c0071f2e9a2c0a97dca96a34620b9ca0473b (diff)
downloadhercules-c8391c9c07abd235b2d40d8cfec39d62827706a7.tar.gz
hercules-c8391c9c07abd235b2d40d8cfec39d62827706a7.tar.bz2
hercules-c8391c9c07abd235b2d40d8cfec39d62827706a7.tar.xz
hercules-c8391c9c07abd235b2d40d8cfec39d62827706a7.zip
- Fixed Absorb Spirit Spheres
- Added battle_config min_chat_delay (default 0) specifies in ms what is the min delay between player sent chats (whisper/global/party/guild). Messages that exceed this threshold are silently ignored for now (perhaps need to add a "DON'T SPAM" reply to the player?) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6859 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/clif.c28
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/pc.c3
-rw-r--r--src/map/skill.c13
6 files changed, 37 insertions, 11 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 4ae6ea545..8b05e544b 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3562,6 +3562,7 @@ static const struct battle_data_short {
{ "sg_miracle_skill_ratio", &battle_config.sg_miracle_skill_ratio },
{ "autospell_stacking", &battle_config.autospell_stacking },
{ "override_mob_names", &battle_config.override_mob_names },
+ { "min_chat_delay", &battle_config.min_chat_delay },
};
static const struct battle_data_int {
@@ -3980,6 +3981,7 @@ void battle_set_defaults() {
battle_config.sg_miracle_skill_duration=600000;
battle_config.autospell_stacking = 0;
battle_config.override_mob_names = 0;
+ battle_config.min_chat_delay = 0;
}
void battle_validate_conf() {
diff --git a/src/map/battle.h b/src/map/battle.h
index 3b386b42e..ec472947f 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -429,6 +429,7 @@ extern struct Battle_Config {
int sg_miracle_skill_duration;
unsigned short autospell_stacking; //Enables autospell cards to stack. [Skotlex]
unsigned short override_mob_names; //Enables overriding spawn mob names with the mob_db names. [Skotlex]
+ unsigned short min_chat_delay; //Minimum time between client messages. [Skotlex]
} battle_config;
diff --git a/src/map/clif.c b/src/map/clif.c
index 677bb3ddd..8fe61ae46 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8623,6 +8623,13 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <
(sd->sc.data[SC_BERSERK].timer != -1 || sd->sc.data[SC_NOCHAT].timer != -1 ))
return;
+ if (battle_config.min_chat_delay)
+ { //[Skotlex]
+ if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+ return;
+ sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ }
+
if (RFIFOW(fd,2)+4 < 128)
buf = buf2; //Use a static buffer.
else
@@ -8961,6 +8968,13 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
(sd->sc.data[SC_BERSERK].timer!=-1 || sd->sc.data[SC_NOCHAT].timer != -1))
return;
+ if (battle_config.min_chat_delay)
+ { //[Skotlex]
+ if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+ return;
+ sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ }
+
memcpy(&target,RFIFOP(fd, 4),NAME_LENGTH);
target[NAME_LENGTH]='\0';
@@ -10229,6 +10243,13 @@ void clif_parse_PartyMessage(int fd, struct map_session_data *sd) {
))
return;
+ if (battle_config.min_chat_delay)
+ { //[Skotlex]
+ if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+ return;
+ sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ }
+
party_send_message(sd, (char*)RFIFOP(fd,4), RFIFOW(fd,2)-4);
}
@@ -10442,6 +10463,13 @@ void clif_parse_GuildMessage(int fd,struct map_session_data *sd) {
))
return;
+ if (battle_config.min_chat_delay)
+ { //[Skotlex]
+ if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+ return;
+ sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ }
+
guild_send_message(sd, (char*)RFIFOP(fd,4), RFIFOW(fd,2)-4);
}
diff --git a/src/map/map.h b/src/map/map.h
index 5e986fa01..7beb0bb4a 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -612,6 +612,7 @@ struct map_session_data {
unsigned int canlog_tick;
unsigned int canregen_tick;
unsigned int canuseitem_tick; // [Skotlex]
+ unsigned int cantalk_tick;
int hp_sub,sp_sub;
int inchealhptick,inchealsptick,inchealspirithptick,inchealspiritsptick;
diff --git a/src/map/pc.c b/src/map/pc.c
index 8cf18635a..00c874c7c 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -612,7 +612,8 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
sd->canregen_tick = tick;
sd->canuseitem_tick = tick;
-
+ sd->cantalk_tick = tick;
+
for(i = 0; i < MAX_SKILL_LEVEL; i++)
sd->spirit_timer[i] = -1;
diff --git a/src/map/skill.c b/src/map/skill.c
index 79c1e048c..14ba8bbb1 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -3862,17 +3862,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
i = 2 * dstmd->db->lv;
mob_target(dstmd,src,0);
}
- if (sd){
- if (i > 0x7FFF)
- i = 0x7FFF;
- if (sd->status.sp + i > sd->status.max_sp)
- i = sd->status.max_sp - sd->status.sp;
- if (i) {
- sd->status.sp += i;
- clif_heal(sd->fd,SP_SP,i);
- }
- }
+ if (i) {
+ status_heal(src, 0, i, 3);
clif_skill_nodamage(src,bl,skillid,skilllv,0);
+ }
break;
case AC_MAKINGARROW: /* –î?ì?¬ */