From a4386f464b6b5eb470bf9a9d147fc0ec6e68afaf Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 26 Apr 2006 21:12:08 +0000 Subject: - Item use interval is set to a default of 100ms now. - Updated Full Buster so that the can't act delay carries on to the weapon attack delay and can't use item intervals. - Added script command getbattleflag to retrieve the current value of a battle_config switch. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6296 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 7 +++++++ conf-tmpl/battle/items.conf | 3 ++- src/map/battle.c | 29 +++++++++++++---------------- src/map/battle.h | 1 + src/map/pc.c | 8 ++++---- src/map/script.c | 11 ++++++++++- src/map/skill.c | 34 ++++++---------------------------- 7 files changed, 43 insertions(+), 50 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 65276fb72..9f1203205 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,13 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/04/26 + * Item use interval is set to a default of 100ms now since that should be + low enough to not bother real players and it should cap somehow bot/macro + spams. [Skotlex] + * Updated Full Buster so that the can't act delay carries on to the weapon + attack delay and can't use item intervals. [Skotlex] + * Added script command getbattleflag to retrieve the current value of a + battle_config switch. [Skotlex] * When Taekwons level up they get Bless and Agi Up level 10 instead of the S.Novice bonuses. [Skotlex] * Increased number of hits for TK kicks. 3 hits for TK_COUNTER and diff --git a/conf-tmpl/battle/items.conf b/conf-tmpl/battle/items.conf index 1b839e69d..4e790c3ea 100644 --- a/conf-tmpl/battle/items.conf +++ b/conf-tmpl/battle/items.conf @@ -70,7 +70,8 @@ item_check: no // How much time must pass between item uses? // Only affects the delay between using items, prevents healing item abuse. Recommended ~500 ms -item_use_interval: 0 +// On officials this is 0, but it's set to 100ms as a measure against bots/macros. +item_use_interval: 100 // The ghostring fix makes mob attacks not be affected by ghostring armor wearing players. mob_ghostring_fix: yes diff --git a/src/map/battle.c b/src/map/battle.c index 77c1981a2..72283688f 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3939,22 +3939,19 @@ int battle_set_value(char *w1, char *w2) { *battle_data_int[i].val = battle_config_switch(w2); return 1; } -/* - int val = battle_config_switch(w2); - switch(battle_data[i].size) { - case 1: - *((unsigned char *) battle_data[i].val) = val; - break; - case 2: - *((unsigned short *) battle_data[i].val) = val; - break; - case 4: - *((unsigned int *) battle_data[i].val) = val; - break; - } - return 1; + return 0; +} + +int battle_get_value(char *w1) { + int i; + for(i = 0; i < sizeof(battle_data_short) / (sizeof(battle_data_short[0])); i++) + if (strcmpi(w1, battle_data_short[i].str) == 0) { + return * battle_data_short[i].val; + } + for(i = 0; i < sizeof(battle_data_int) / (sizeof(battle_data_int[0])); i++) + if (strcmpi(w1, battle_data_int[i].str) == 0) { + return *battle_data_int[i].val; } -*/ return 0; } @@ -4064,7 +4061,7 @@ void battle_set_defaults() { battle_config.shop_exp=0; battle_config.combo_delay_rate=100; battle_config.item_check=1; - battle_config.item_use_interval=500; + battle_config.item_use_interval=100; //Use some very low value that won't bother players, but should cap bots. battle_config.wedding_modifydisplay=0; battle_config.wedding_ignorepalette=0; battle_config.xmas_ignorepalette=0; // [Valaris] diff --git a/src/map/battle.h b/src/map/battle.h index 9bd6fc2d0..aab83d460 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -433,5 +433,6 @@ extern int battle_config_read(const char *cfgName); extern void battle_validate_conf(void); extern void battle_set_defaults(void); extern int battle_set_value(char *, char *); +int battle_get_value(char *); #endif diff --git a/src/map/pc.c b/src/map/pc.c index ba54db609..fc0dc4ae6 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2671,6 +2671,7 @@ int pc_isUseitem(struct map_session_data *sd,int n) */ int pc_useitem(struct map_session_data *sd,int n) { + unsigned int tick = gettick(); int amount; unsigned char *script; @@ -2684,8 +2685,7 @@ int pc_useitem(struct map_session_data *sd,int n) return 0; //Prevent mass item usage. [Skotlex] - if (battle_config.item_use_interval && - DIFF_TICK(sd->canuseitem_tick, gettick()) > 0) + if(DIFF_TICK(sd->canuseitem_tick, tick) > 0) return 0; if (sd->sc.count && ( @@ -2719,8 +2719,8 @@ int pc_useitem(struct map_session_data *sd,int n) if (sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_ROGUE) potion_flag = 3; //Even more effective potions. } - if (battle_config.item_use_interval) - sd->canuseitem_tick= gettick() + battle_config.item_use_interval; //Update item use time. + + sd->canuseitem_tick= tick + battle_config.item_use_interval; //Update item use time. run_script(script,0,sd->bl.id,0); potion_flag = 0; return 1; diff --git a/src/map/script.c b/src/map/script.c index 20b761b2d..08cd19569 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -408,6 +408,7 @@ int buildin_npcshopitem(struct script_state *st); // [Lance] int buildin_equip(struct script_state *st); int buildin_autoequip(struct script_state *st); int buildin_setbattleflag(struct script_state *st); +int buildin_getbattleflag(struct script_state *st); // [zBuffer] List of player cont commands ---> int buildin_rid2name(struct script_state *st); int buildin_pcwalkxy(struct script_state *st); @@ -737,6 +738,7 @@ struct { {buildin_equip,"equip","i"}, {buildin_autoequip,"autoequip","ii"}, {buildin_setbattleflag,"setbattleflag","ss"}, + {buildin_getbattleflag,"getbattleflag","s"}, {buildin_setitemscript,"setitemscript","is"}, //Set NEW item bonus script. Lupus {buildin_disguise,"disguise","i"}, //disguise player. Lupus {buildin_undisguise,"undisguise","i"}, //undisguise player. Lupus @@ -9553,11 +9555,18 @@ int buildin_setbattleflag(struct script_state *st){ if (battle_set_value(flag, value) == 0) ShowWarning("buildin_setbattleflag: unknown battle_config flag '%s'",flag); else - ShowInfo("buildin_setbattleflag: battle_config flag '%s' is now set to '%s'.",flag,value); + ShowInfo("buildin_setbattleflag: battle_config flag '%s' is now set to '%s'.",flag,value); return 0; } +int buildin_getbattleflag(struct script_state *st){ + char *flag; + flag = conv_str(st,& (st->stack->stack_data[st->start+2])); + push_val(st->stack,C_INT,battle_get_value(flag)); + return 0; +} + //======================================================= // strlen [Valaris] //------------------------------------------------------- diff --git a/src/map/skill.c b/src/map/skill.c index e25d79d2b..8893d28da 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1412,9 +1412,6 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * int rate; struct map_session_data *sd=NULL; struct map_session_data *dstsd=NULL; - struct mob_data *md=NULL; - struct mob_data *dstmd=NULL; -// struct pet_data *pd=NULL; Pet's can't be inflicted! nullpo_retr(0, src); nullpo_retr(0, bl); @@ -1427,30 +1424,8 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * } if(skillid > 0 && skilllv <= 0) return 0; // don't forget auto attacks! - celest - switch (src->type) { - case BL_PC: - sd = (struct map_session_data *)src; - break; - case BL_MOB: - md = (struct mob_data *)src; - break; - case BL_PET: //Only mobs/players can be affected. [Skotlex] -// pd = (struct pet_data *)src; -// break; - default: - return 0; - } - - switch (bl->type) { - case BL_PC: - dstsd=(struct map_session_data *)bl; - break; - case BL_MOB: - dstmd=(struct mob_data *)bl; - break; - default: - return 0; - } + BL_CAST(BL_PC, src, sd); + BL_CAST(BL_PC, bl, dstsd); switch(skillid){ case 0: //Normal Attack - Nothing here yet. @@ -1921,6 +1896,10 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds if (skilllv >= 7 && sd->sc.data[SC_COMBO].timer == -1) sc_start4(src,SC_COMBO,100,SL_SMA,skilllv,0,0,skill_get_time2(skillid, skilllv)); break; + case GS_FULLBUSTER: + //Can't attack nor use items until skill's delay expires. [Skotlex] + sd->ud.attackabletime = sd->canuseitem_tick = sd->ud.canact_tick; + break; } //Switch End } @@ -3039,7 +3018,6 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s case GS_DUST: case GS_FULLBUSTER: case GS_FLING: - case NJ_SYURIKEN: case NJ_KUNAI: case NJ_HUUMA: -- cgit v1.2.3-70-g09d2