summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-14 20:54:25 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-14 20:54:25 +0000
commit64ae7b6bc0cd76457aad32f327b816ee6d4bf7a4 (patch)
tree63c5c3d39263c30654e094004c3e4ed6cca5ffb8 /src/map/mob.c
parentfc5f99e563e4e88646e0f63f96ad33baba69cfd5 (diff)
downloadhercules-64ae7b6bc0cd76457aad32f327b816ee6d4bf7a4.tar.gz
hercules-64ae7b6bc0cd76457aad32f327b816ee6d4bf7a4.tar.bz2
hercules-64ae7b6bc0cd76457aad32f327b816ee6d4bf7a4.tar.xz
hercules-64ae7b6bc0cd76457aad32f327b816ee6d4bf7a4.zip
- Some optimizations to @noks (now using a Status Change timer).
- Added support to Self|Party|Guild options. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12205 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 2f1a8f2cc..e66a980a3 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -283,6 +283,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
{
struct block_list *s_bl;
struct map_session_data *sd, *pl_sd;
+ struct status_change_entry *sce;
struct mob_data *md;
unsigned int tick = gettick();
char output[128];
@@ -304,25 +305,28 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
return false; // Ignores GVG, PVP and AllowKS map flags
if( md->db->mexp || md->master_id )
- return false; // MVP and Slaves ignores KS
+ return false; // MVP, Slaves mobs ignores KS
- if( sd->bl.id == md->owner_id )
- break; // Same player
+ if( (sce = md->sc.data[SC_KSPROTECTED]) == NULL )
+ break; // No KS Protected
- if( !md->owner_id || !(pl_sd = map_id2sd(md->owner_id)) )
- break; // Not owner or owner offline
+ if( sd->bl.id == sce->val1 )
+ break; // Same Player
- if( pl_sd->bl.m != md->bl.m )
- break; // Owner on different map
+ if( !(pl_sd = map_id2sd(sce->val1)) )
+ break; // Owner offline
- if( DIFF_TICK(md->ks_tick, tick) <= 0 )
- break; // Protection Time's Out
+ if( pl_sd->bl.m != md->bl.m )
+ break; // Protection expires on different map
if( !pl_sd->state.noks )
- return false; // No KS Protected, but this is necessary to protect normal players
+ return false; // No KS Protected, but normal players should be protected too
+
+ if( pl_sd->state.noks == 2 && pl_sd->status.party_id && pl_sd->status.party_id == sd->status.party_id )
+ break; // Party KS allowed
- if( pl_sd->status.party_id && pl_sd->status.party_id == sd->status.party_id )
- break; // Same Party Allow KS
+ if( pl_sd->state.noks == 3 && pl_sd->status.guild_id && pl_sd->status.guild_id == sd->status.guild_id )
+ break; // Guild KS allowed
// Message to KS
if( DIFF_TICK(sd->ks_floodprotect_tick, tick) <= 0 )
@@ -345,8 +349,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
return true;
} while(0);
- md->owner_id = sd->bl.id;
- md->ks_tick = tick + battle_config.ksprotection;
+ status_change_start(target, SC_KSPROTECTED, 10000, sd->bl.id, 0, 0, 0, battle_config.ksprotection, 0);
return false;
}