Przeglądaj źródła

- 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://svn.code.sf.net/p/rathena/svn/trunk@6296 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 lat temu
rodzic
commit
d66d94cd80
7 zmienionych plików z 43 dodań i 50 usunięć
  1. 7 0
      Changelog-Trunk.txt
  2. 2 1
      conf-tmpl/battle/items.conf
  3. 13 16
      src/map/battle.c
  4. 1 0
      src/map/battle.h
  5. 4 4
      src/map/pc.c
  6. 10 1
      src/map/script.c
  7. 6 28
      src/map/skill.c

+ 7 - 0
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

+ 2 - 1
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

+ 13 - 16
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]

+ 1 - 0
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

+ 4 - 4
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;

+ 10 - 1
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]
 //-------------------------------------------------------

+ 6 - 28
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: