diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-14 20:54:25 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-14 20:54:25 +0000 |
commit | 64ae7b6bc0cd76457aad32f327b816ee6d4bf7a4 (patch) | |
tree | 63c5c3d39263c30654e094004c3e4ed6cca5ffb8 /src/map | |
parent | fc5f99e563e4e88646e0f63f96ad33baba69cfd5 (diff) | |
download | hercules-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')
-rw-r--r-- | src/map/atcommand.c | 21 | ||||
-rw-r--r-- | src/map/map.h | 6 | ||||
-rw-r--r-- | src/map/mob.c | 31 | ||||
-rw-r--r-- | src/map/status.h | 2 |
4 files changed, 38 insertions, 22 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 956d32040..0faa040ef 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8140,9 +8140,24 @@ int atcommand_ksprotection(const int fd, struct map_session_data *sd, const char if( sd->state.noks ) { sd->state.noks = 0; sprintf(atcmd_output, "[ K.S Protection Inactive ]"); - } else { - sprintf(atcmd_output, "[ K.S Protection Active ]"); - sd->state.noks = 1; + } + else + { + if( !message || !*message || !strcmpi(message, "party") ) + { // Default is Party + sd->state.noks = 2; + sprintf(atcmd_output, "[ K.S Protection Active - Option: Party ]"); + } + else if( !strcmpi(message, "self") ) + { + sd->state.noks = 1; + sprintf(atcmd_output, "[ K.S Protection Active - Option: Self ]"); + } + else if( !strcmpi(message, "guild") ) + { + sd->state.noks = 3; + sprintf(atcmd_output, "[ K.S Protection Active - Option: Guild ]"); + } } clif_displaymessage(fd, atcmd_output); diff --git a/src/map/map.h b/src/map/map.h index 69f007b60..81b55bb7a 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -552,7 +552,7 @@ struct map_session_data { unsigned ignoreAll : 1; unsigned short autoloot; unsigned short autolootid; // [Zephyrus] - unsigned noks : 1; // [Zeph Kill Steal Protection] + unsigned noks : 3; // [Zeph Kill Steal Protection] struct guild *gmaster_flag; } state; struct { @@ -915,10 +915,6 @@ struct mob_data { int level; int target_id,attacked_id; - // Kill Steal Protection - int owner_id; - unsigned int ks_tick; - unsigned int next_walktime,last_thinktime,last_linktime; short move_fail_count; short lootitem_count; 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; } diff --git a/src/map/status.h b/src/map/status.h index c34c45d10..23f8ec4b1 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -284,6 +284,8 @@ enum sc_type { SC_HPREGEN, SC_INCHEALRATE, SC_PNEUMA, + SC_AUTOTRADE, + SC_KSPROTECTED, SC_MAX, //Automatically updated max, used in for's to check we are within bounds. }; int SkillStatusChangeTable(int skill); |