diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/battle.c | 29 | ||||
-rw-r--r-- | src/map/battle.h | 1 | ||||
-rw-r--r-- | src/map/pc.c | 8 | ||||
-rw-r--r-- | src/map/script.c | 11 | ||||
-rw-r--r-- | src/map/skill.c | 34 |
5 files changed, 34 insertions, 49 deletions
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:
|